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(); + 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); + } + +} diff --git a/core/org.eclipse.cdt.core.tests/model/org/eclipse/cdt/core/language/settings/providers/MockListenerRegisterer.java b/core/org.eclipse.cdt.core.tests/model/org/eclipse/cdt/core/language/settings/providers/MockListenerRegisterer.java index c39835629ec..d6887eb6e0a 100644 --- a/core/org.eclipse.cdt.core.tests/model/org/eclipse/cdt/core/language/settings/providers/MockListenerRegisterer.java +++ b/core/org.eclipse.cdt.core.tests/model/org/eclipse/cdt/core/language/settings/providers/MockListenerRegisterer.java @@ -1,104 +1,104 @@ -/******************************************************************************* - * 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.core.language.settings.providers; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.cdt.core.settings.model.ICConfigurationDescription; -import org.eclipse.core.runtime.Assert; - -/** - * Mock Language Settings Provider that keeps count how many times it has been registered. - */ -public class MockListenerRegisterer extends LanguageSettingsSerializableProvider implements ILanguageSettingsEditableProvider, ICListenerAgent { - private static MockListenerManager mockListenerManager = new MockListenerManager(); - - private static class MockListenerManager { - private class ListenerCount { - private MockListenerRegisterer listener; - private int count; - public ListenerCount(MockListenerRegisterer l, int cnt) { - listener = l; - count = cnt; - } - } - private List register = new ArrayList(); - - public void registerListener(MockListenerRegisterer listener) { - for (ListenerCount lc : register) { - if (lc.listener == listener) { - lc.count++; - return; - } - } - - register.add(new ListenerCount(listener, 1)); - } - - public void unregisterListener(MockListenerRegisterer listener) { - for (ListenerCount lc : register) { - if (lc.listener == listener) { - lc.count--; - Assert.isTrue(lc.count>=0); - return; - } - } - - // attempt to unregister non-registered listener - Assert.isTrue(false); - } - - /** - * Note that that count includes all listeners with that id. - */ - public int getCount(String id) { - int count = 0; - - for (ListenerCount lc : register) { - if (lc.listener.getId().equals(id)) { - count = count + lc.count; - } - } - - return count; - } - } - - public MockListenerRegisterer() { - super(); - } - public MockListenerRegisterer(String id, String name) { - super(id, name); - } - @Override - public void registerListener(ICConfigurationDescription cfgDescription) { - mockListenerManager.registerListener(this); - } - - @Override - public void unregisterListener() { - mockListenerManager.unregisterListener(this); - } - @Override - public MockListenerRegisterer cloneShallow() throws CloneNotSupportedException { - return (MockListenerRegisterer) super.cloneShallow(); - } - @Override - public MockListenerRegisterer clone() throws CloneNotSupportedException { - return (MockListenerRegisterer) super.clone(); - } - - public static int getCount(String id) { - return mockListenerManager.getCount(id); - } +/******************************************************************************* + * 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.core.language.settings.providers; + +import java.util.ArrayList; +import java.util.List; + +import org.eclipse.cdt.core.settings.model.ICConfigurationDescription; +import org.eclipse.core.runtime.Assert; + +/** + * Mock Language Settings Provider that keeps count how many times it has been registered. + */ +public class MockListenerRegisterer extends LanguageSettingsSerializableProvider implements ILanguageSettingsEditableProvider, ICListenerAgent { + private static MockListenerManager mockListenerManager = new MockListenerManager(); + + private static class MockListenerManager { + private class ListenerCount { + private MockListenerRegisterer listener; + private int count; + public ListenerCount(MockListenerRegisterer l, int cnt) { + listener = l; + count = cnt; + } + } + private List register = new ArrayList(); + + public void registerListener(MockListenerRegisterer listener) { + for (ListenerCount lc : register) { + if (lc.listener == listener) { + lc.count++; + return; + } + } + + register.add(new ListenerCount(listener, 1)); + } + + public void unregisterListener(MockListenerRegisterer listener) { + for (ListenerCount lc : register) { + if (lc.listener == listener) { + lc.count--; + Assert.isTrue(lc.count>=0); + return; + } + } + + // attempt to unregister non-registered listener + Assert.isTrue(false); + } + + /** + * Note that that count includes all listeners with that id. + */ + public int getCount(String id) { + int count = 0; + + for (ListenerCount lc : register) { + if (lc.listener.getId().equals(id)) { + count = count + lc.count; + } + } + + return count; + } + } + + public MockListenerRegisterer() { + super(); + } + public MockListenerRegisterer(String id, String name) { + super(id, name); + } + @Override + public void registerListener(ICConfigurationDescription cfgDescription) { + mockListenerManager.registerListener(this); + } + + @Override + public void unregisterListener() { + mockListenerManager.unregisterListener(this); + } + @Override + public MockListenerRegisterer cloneShallow() throws CloneNotSupportedException { + return (MockListenerRegisterer) super.cloneShallow(); + } + @Override + public MockListenerRegisterer clone() throws CloneNotSupportedException { + return (MockListenerRegisterer) super.clone(); + } + + public static int getCount(String id) { + return mockListenerManager.getCount(id); + } } \ No newline at end of file diff --git a/core/org.eclipse.cdt.core.tests/resources/cfiles/CModelElementsTestStart.h b/core/org.eclipse.cdt.core.tests/resources/cfiles/CModelElementsTestStart.h index df422c6e855..d9736eff1d3 100644 --- a/core/org.eclipse.cdt.core.tests/resources/cfiles/CModelElementsTestStart.h +++ b/core/org.eclipse.cdt.core.tests/resources/cfiles/CModelElementsTestStart.h @@ -1,146 +1,146 @@ -// include -#include "included.h" - -// macro -#define PRINT(string,msg) printf(string, msg) - -//namespace -namespace MyPackage -{ - // check class - // class - class Hello - { - // protected visibility - protected: - // field - int x; - // method - inline void setX(int X) - { - x = X; - }; - // check nested pachage - // nested namespace - namespace MyNestedPackage { - // check parent nested class - // nested class - class Y - { // public visibility - public: - // constructor - Y(); - // virtual destructor - virtual ~Y(); - }; - // check derived nested class - // derived class - class X : public Y { - // private visibility - private: - // private field - B b; - - public: - // constructor chain - X(int x) : Y(x) { - cout << "In consturctor\n"; - } - // method declaration - int doNothing(); - }; - } - }; - - // check enums - // enum without name - enum { - first = 1, - second, - third - } - ; - // enum with name - enum MyEnum { - f, - s, - t }; - - // check variables - // variable - int v; - // unsigned long variable - unsigned long vuLong; - // unsigned short variable - unsigned short vuShort; - - // check variable declarations - // variable declaration - extern int evar; - // function pointer - static void * (*orig_malloc_hook)(const char *file, int line, size_t size); - - // check functions - // simple function declaration - void foo(); - // function declaration with parameters - char* foo(int& x, - char**y); - // simple function definition - void boo(){ - int g = 0; - }; - // check Structs - // struct - struct MyStruct{ - int sint; - }; - // typedef and elaborated types - typedef struct MyStruct myStruct; - // typedef - typedef struct{ - int ss; - } myTypedef; - // unions - union U{ - int U1; - }; - - - // check templates - // template function - template - A aTemplatedFunction( B bInstance ); - // template method - class enclosing { - // public visibility - public: - template - A aTemplatedMethod( B bInstance ); - }; - // template class - template - class myarray { /* */ }; - // template struct - template - struct mystruct { /* */ }; - // template variable -// template -// char* default_alloc_template<__threads, __inst>::_S_start_free = 0; -}; - // check arrays - // arrays - int myArray [5][]; - int main(int argc, char * argv[]) - { - } - -// https://bugs.eclipse.org/bugs/show_bug.cgi?id=180815 -struct bug180815 { - int i,j; -} bug180815_var0, bug180815_var1; - -// https://bugs.eclipse.org/bugs/show_bug.cgi?id=352350 -namespace { - int bug352350; +// include +#include "included.h" + +// macro +#define PRINT(string,msg) printf(string, msg) + +//namespace +namespace MyPackage +{ + // check class + // class + class Hello + { + // protected visibility + protected: + // field + int x; + // method + inline void setX(int X) + { + x = X; + }; + // check nested pachage + // nested namespace + namespace MyNestedPackage { + // check parent nested class + // nested class + class Y + { // public visibility + public: + // constructor + Y(); + // virtual destructor + virtual ~Y(); + }; + // check derived nested class + // derived class + class X : public Y { + // private visibility + private: + // private field + B b; + + public: + // constructor chain + X(int x) : Y(x) { + cout << "In consturctor\n"; + } + // method declaration + int doNothing(); + }; + } + }; + + // check enums + // enum without name + enum { + first = 1, + second, + third + } + ; + // enum with name + enum MyEnum { + f, + s, + t }; + + // check variables + // variable + int v; + // unsigned long variable + unsigned long vuLong; + // unsigned short variable + unsigned short vuShort; + + // check variable declarations + // variable declaration + extern int evar; + // function pointer + static void * (*orig_malloc_hook)(const char *file, int line, size_t size); + + // check functions + // simple function declaration + void foo(); + // function declaration with parameters + char* foo(int& x, + char**y); + // simple function definition + void boo(){ + int g = 0; + }; + // check Structs + // struct + struct MyStruct{ + int sint; + }; + // typedef and elaborated types + typedef struct MyStruct myStruct; + // typedef + typedef struct{ + int ss; + } myTypedef; + // unions + union U{ + int U1; + }; + + + // check templates + // template function + template + A aTemplatedFunction( B bInstance ); + // template method + class enclosing { + // public visibility + public: + template + A aTemplatedMethod( B bInstance ); + }; + // template class + template + class myarray { /* */ }; + // template struct + template + struct mystruct { /* */ }; + // template variable +// template +// char* default_alloc_template<__threads, __inst>::_S_start_free = 0; +}; + // check arrays + // arrays + int myArray [5][]; + int main(int argc, char * argv[]) + { + } + +// https://bugs.eclipse.org/bugs/show_bug.cgi?id=180815 +struct bug180815 { + int i,j; +} bug180815_var0, bug180815_var1; + +// https://bugs.eclipse.org/bugs/show_bug.cgi?id=352350 +namespace { + int bug352350; } \ No newline at end of file diff --git a/core/org.eclipse.cdt.core.tests/resources/cfiles/TranslationUnits.c b/core/org.eclipse.cdt.core.tests/resources/cfiles/TranslationUnits.c index e258b183e56..2f7b355860a 100644 --- a/core/org.eclipse.cdt.core.tests/resources/cfiles/TranslationUnits.c +++ b/core/org.eclipse.cdt.core.tests/resources/cfiles/TranslationUnits.c @@ -1,70 +1,70 @@ -/* - * (c) Copyright QNX Software Systems Ltd. 2002, 2003. - * All Rights Reserved. +/* + * (c) Copyright QNX Software Systems Ltd. 2002, 2003. + * All Rights Reserved. */ -/******** - * This is a sample C file that will be used in testing the TranslationUnit - * class. It has a specific structure that will be looked for within the - * test case. - * This file is only ment to contain various C elements, and may not compile - * into a running application (but should be valid C) - */ - -#include -#include - -/* A function prototype */ -int func2p(void); - -/* A global variable */ -int globalvar; - -/* A enumeration */ -enum myenum {ENUM_A=1, ENUM_B=2, ENUM_C=3, ENUM_D=4}; - -/* A structure. This also includes a typedef around the strcture def - * which at the time of writing was not picked up. - */ -typedef struct mystruct { - int a; - char b; - long c; -} mystruct_t; - -/* A union */ -union myunion { - int x; - char y; - long z; -}; - -/* A typedef */ -typedef struct mystruct mytype; - - -/* A couple functions */ - -void * func1(void) -{ - return(NULL); -} - - -int func2(void) -{ - return(0); -} - -int main(int argc, char ** argv) -{ - int var1; - printf("Hello world\n"); -} - - -void func3() -{ - printf("This is not really here\n"); -} - - +/******** + * This is a sample C file that will be used in testing the TranslationUnit + * class. It has a specific structure that will be looked for within the + * test case. + * This file is only ment to contain various C elements, and may not compile + * into a running application (but should be valid C) + */ + +#include +#include + +/* A function prototype */ +int func2p(void); + +/* A global variable */ +int globalvar; + +/* A enumeration */ +enum myenum {ENUM_A=1, ENUM_B=2, ENUM_C=3, ENUM_D=4}; + +/* A structure. This also includes a typedef around the strcture def + * which at the time of writing was not picked up. + */ +typedef struct mystruct { + int a; + char b; + long c; +} mystruct_t; + +/* A union */ +union myunion { + int x; + char y; + long z; +}; + +/* A typedef */ +typedef struct mystruct mytype; + + +/* A couple functions */ + +void * func1(void) +{ + return(NULL); +} + + +int func2(void) +{ + return(0); +} + +int main(int argc, char ** argv) +{ + int var1; + printf("Hello world\n"); +} + + +void func3() +{ + printf("This is not really here\n"); +} + + diff --git a/core/org.eclipse.cdt.core.tests/resources/cfiles/included.h b/core/org.eclipse.cdt.core.tests/resources/cfiles/included.h index b5b6d36ac65..53eae6898ac 100644 --- a/core/org.eclipse.cdt.core.tests/resources/cfiles/included.h +++ b/core/org.eclipse.cdt.core.tests/resources/cfiles/included.h @@ -1,10 +1,10 @@ -#define size_t int -class A; - -class B; - -class C; - -class T; - -class junk; +#define size_t int +class A; + +class B; + +class C; + +class T; + +class junk; diff --git a/core/org.eclipse.cdt.core.tests/resources/cmodel/DeclaratorsTests.cpp b/core/org.eclipse.cdt.core.tests/resources/cmodel/DeclaratorsTests.cpp index f0d2c7e98c7..94df40c6076 100644 --- a/core/org.eclipse.cdt.core.tests/resources/cmodel/DeclaratorsTests.cpp +++ b/core/org.eclipse.cdt.core.tests/resources/cmodel/DeclaratorsTests.cpp @@ -1,24 +1,24 @@ -void decl_0001(char); -void (decl_0002)(char); -void ((decl_0003))(char); - -void *decl_0004(char); -void (*decl_0005)(char); -void (*(decl_0006))(char); -void ((*decl_0007))(char); - -typedef void decl_0011(char); -typedef void (decl_0012)(char); -typedef void ((decl_0013))(char); - -typedef void *decl_0014(char); -typedef void (*decl_0015)(char); -typedef void (*(decl_0016))(char); -typedef void ((*decl_0017))(char); - -typedef void decl_0021(char); -void (*decl_0022)(char); -void (*(*decl_0023(int a)))(char) { return &decl_0021; } -void (*(*(*((decl_0024)))(int))(float))(char); - -int (*decl_0031)(char(*yyy)(bool)); +void decl_0001(char); +void (decl_0002)(char); +void ((decl_0003))(char); + +void *decl_0004(char); +void (*decl_0005)(char); +void (*(decl_0006))(char); +void ((*decl_0007))(char); + +typedef void decl_0011(char); +typedef void (decl_0012)(char); +typedef void ((decl_0013))(char); + +typedef void *decl_0014(char); +typedef void (*decl_0015)(char); +typedef void (*(decl_0016))(char); +typedef void ((*decl_0017))(char); + +typedef void decl_0021(char); +void (*decl_0022)(char); +void (*(*decl_0023(int a)))(char) { return &decl_0021; } +void (*(*(*((decl_0024)))(int))(float))(char); + +int (*decl_0031)(char(*yyy)(bool)); diff --git a/core/org.eclipse.cdt.core.tests/resources/cmodel/IIncludeTest.h b/core/org.eclipse.cdt.core.tests/resources/cmodel/IIncludeTest.h index 04b6e419a44..872c9f3d811 100644 --- a/core/org.eclipse.cdt.core.tests/resources/cmodel/IIncludeTest.h +++ b/core/org.eclipse.cdt.core.tests/resources/cmodel/IIncludeTest.h @@ -1,42 +1,42 @@ -// include -#include -#include "whatever.h" -#include -#include -#include "Program Files/space.h" -#include "../up1dir.h" -#include "./samedir.h" -#include "different_extension1.hpp" -#include "different_extension2.hh" -#include "different_extension3.x" -#include -# include "whitespace_after_hash" - #include "whitespace_before_hash" - -// failure cases: -#include garbage -#include "resync_after_bad_parse_1" -#include -#include "resync_after_bad_parse_2" -#include "one" "two" "three" -#include "resync_after_bad_parse_3" - -// from the Spec: - -// from [C, 6.10.p8] -// should fail -#define EMPTY -EMPTY #include "invalid.h" - -// from [C, 6.10.2.p8]: -// should equal #include "myInclude1.h" -#define MYINCFILE "myInclude1.h" -#include MYINCFILE - -// from [C, 6.10.3.5.p6]: -// should equal #include "vers2.h" -#define INCFILE(x) vers ## x -#define xstr(x) str(x) -#define str(x) #x -#include xstr(INCFILE(2).h) - +// include +#include +#include "whatever.h" +#include +#include +#include "Program Files/space.h" +#include "../up1dir.h" +#include "./samedir.h" +#include "different_extension1.hpp" +#include "different_extension2.hh" +#include "different_extension3.x" +#include +# include "whitespace_after_hash" + #include "whitespace_before_hash" + +// failure cases: +#include garbage +#include "resync_after_bad_parse_1" +#include +#include "resync_after_bad_parse_2" +#include "one" "two" "three" +#include "resync_after_bad_parse_3" + +// from the Spec: + +// from [C, 6.10.p8] +// should fail +#define EMPTY +EMPTY #include "invalid.h" + +// from [C, 6.10.2.p8]: +// should equal #include "myInclude1.h" +#define MYINCFILE "myInclude1.h" +#include MYINCFILE + +// from [C, 6.10.3.5.p6]: +// should equal #include "vers2.h" +#define INCFILE(x) vers ## x +#define xstr(x) str(x) +#define str(x) #x +#include xstr(INCFILE(2).h) + diff --git a/core/org.eclipse.cdt.core.tests/resources/cmodel/IMacroTest.h b/core/org.eclipse.cdt.core.tests/resources/cmodel/IMacroTest.h index a5bf320efab..34fdd295164 100644 --- a/core/org.eclipse.cdt.core.tests/resources/cmodel/IMacroTest.h +++ b/core/org.eclipse.cdt.core.tests/resources/cmodel/IMacroTest.h @@ -1,4 +1,4 @@ -// macro -#define SINGLETON -#define NUMBER 1 -#define PRINT(string,msg) printf(string, msg) +// macro +#define SINGLETON +#define NUMBER 1 +#define PRINT(string,msg) printf(string, msg) diff --git a/core/org.eclipse.cdt.core.tests/resources/cmodel/ITemplate.cpp b/core/org.eclipse.cdt.core.tests/resources/cmodel/ITemplate.cpp index 9874a1f3fd4..a180890fd5a 100644 --- a/core/org.eclipse.cdt.core.tests/resources/cmodel/ITemplate.cpp +++ b/core/org.eclipse.cdt.core.tests/resources/cmodel/ITemplate.cpp @@ -1,72 +1,72 @@ -class Key; -class Value; -class SortAlgorithm; -class DefaultSort; -class T; -class X; -class Y; -class Bar; -class Foo { - template void fum(int i); -}; - -// TEMPLATE_STRUCT -template -struct Map -{ - Key* keys; - Value* values; - SortAlgorithm* sortAlgorithm; - Map(); -}; - -// TEMPLATE_CLASS -template class nonVector { - private: - T* head; - - public: - nonVector() { head =new T(); } - int length() { return 1; } - const T& first(); -}; - -// TEMPLATE_UNION -template -union ArrayOverlay { - public: - X x[size]; - Y y[size]; - - static int numArrays; -}; - - -// TEMPLATE_METHODS -class TemplateContainer { - // these are in an enclosing class - template void fum(int i); - template void scrum(void) {}; -}; - -// TEMPLATE_FUNCTION -template const T& nonVector::first() const -{ - return *head; -} - -template bool IsGreaterThan(X,X); - -template void Foo::fum(int i) {} - -// TEMPLATE_VARIABLES -template char* default_alloc_template::S_start_free = 0; - -// an instantiation, not a template: -complex cf(0,0); -//template > -//Dictionary* TheSpellCheckDictionary; - -int success; - - +class Key; +class Value; +class SortAlgorithm; +class DefaultSort; +class T; +class X; +class Y; +class Bar; +class Foo { + template void fum(int i); +}; + +// TEMPLATE_STRUCT +template +struct Map +{ + Key* keys; + Value* values; + SortAlgorithm* sortAlgorithm; + Map(); +}; + +// TEMPLATE_CLASS +template class nonVector { + private: + T* head; + + public: + nonVector() { head =new T(); } + int length() { return 1; } + const T& first(); +}; + +// TEMPLATE_UNION +template +union ArrayOverlay { + public: + X x[size]; + Y y[size]; + + static int numArrays; +}; + + +// TEMPLATE_METHODS +class TemplateContainer { + // these are in an enclosing class + template void fum(int i); + template void scrum(void) {}; +}; + +// TEMPLATE_FUNCTION +template const T& nonVector::first() const +{ + return *head; +} + +template bool IsGreaterThan(X,X); + +template void Foo::fum(int i) {} + +// TEMPLATE_VARIABLES +template char* default_alloc_template::S_start_free = 0; + +// an instantiation, not a template: +complex cf(0,0); +//template > +//Dictionary* TheSpellCheckDictionary; + +int success; + + diff --git a/core/org.eclipse.cdt.core.tests/resources/dependency/DepTest.cpp b/core/org.eclipse.cdt.core.tests/resources/dependency/DepTest.cpp index 828a3aca6cf..4dbb7f4f9b3 100644 --- a/core/org.eclipse.cdt.core.tests/resources/dependency/DepTest.cpp +++ b/core/org.eclipse.cdt.core.tests/resources/dependency/DepTest.cpp @@ -1,8 +1,8 @@ -#include "DepTest.h" -#include "d.h" - -DepTest::DepTest() -{}; -DepTest::~DepTest() -{}; - +#include "DepTest.h" +#include "d.h" + +DepTest::DepTest() +{}; +DepTest::~DepTest() +{}; + diff --git a/core/org.eclipse.cdt.core.tests/resources/dependency/DepTest.h b/core/org.eclipse.cdt.core.tests/resources/dependency/DepTest.h index c008086c156..376c76f4891 100644 --- a/core/org.eclipse.cdt.core.tests/resources/dependency/DepTest.h +++ b/core/org.eclipse.cdt.core.tests/resources/dependency/DepTest.h @@ -1,8 +1,8 @@ -#include "Inc1.h" -#include "a.h" -class DepTest{ -public: - - DepTest(); - ~DepTest(); -}; +#include "Inc1.h" +#include "a.h" +class DepTest{ +public: + + DepTest(); + ~DepTest(); +}; diff --git a/core/org.eclipse.cdt.core.tests/resources/dependency/DepTest2.cpp b/core/org.eclipse.cdt.core.tests/resources/dependency/DepTest2.cpp index 6f3000e6df3..55014b84d54 100644 --- a/core/org.eclipse.cdt.core.tests/resources/dependency/DepTest2.cpp +++ b/core/org.eclipse.cdt.core.tests/resources/dependency/DepTest2.cpp @@ -1,8 +1,8 @@ -#include "DepTest2.h" -#include "d.h" - -DepTest2::DepTest2() -{}; -DepTest2::~DepTest2() -{}; - +#include "DepTest2.h" +#include "d.h" + +DepTest2::DepTest2() +{}; +DepTest2::~DepTest2() +{}; + diff --git a/core/org.eclipse.cdt.core.tests/resources/dependency/DepTest2.h b/core/org.eclipse.cdt.core.tests/resources/dependency/DepTest2.h index 6f084a69b11..e3a8946e84e 100644 --- a/core/org.eclipse.cdt.core.tests/resources/dependency/DepTest2.h +++ b/core/org.eclipse.cdt.core.tests/resources/dependency/DepTest2.h @@ -1,8 +1,8 @@ -#include "d.h" - -class DepTest2{ -public: - - DepTest2(); - ~DepTest2(); -}; +#include "d.h" + +class DepTest2{ +public: + + DepTest2(); + ~DepTest2(); +}; diff --git a/core/org.eclipse.cdt.core.tests/resources/dependency/DepTest3.cpp b/core/org.eclipse.cdt.core.tests/resources/dependency/DepTest3.cpp index cc0d9ba24ee..e3e0086c56c 100644 --- a/core/org.eclipse.cdt.core.tests/resources/dependency/DepTest3.cpp +++ b/core/org.eclipse.cdt.core.tests/resources/dependency/DepTest3.cpp @@ -1,7 +1,7 @@ -#include "DepTest3.h" - -DepTest3::DepTest3() -{}; -DepTest3::~DepTest3() -{}; - +#include "DepTest3.h" + +DepTest3::DepTest3() +{}; +DepTest3::~DepTest3() +{}; + diff --git a/core/org.eclipse.cdt.core.tests/resources/dependency/DepTest3.h b/core/org.eclipse.cdt.core.tests/resources/dependency/DepTest3.h index b4b47ce40e4..1390e03a3cd 100644 --- a/core/org.eclipse.cdt.core.tests/resources/dependency/DepTest3.h +++ b/core/org.eclipse.cdt.core.tests/resources/dependency/DepTest3.h @@ -1,8 +1,8 @@ -#include "a.h" - -class DepTest3{ -public: - - DepTest3(); - ~DepTest3(); -}; +#include "a.h" + +class DepTest3{ +public: + + DepTest3(); + ~DepTest3(); +}; diff --git a/core/org.eclipse.cdt.core.tests/resources/dependency/Inc1.h b/core/org.eclipse.cdt.core.tests/resources/dependency/Inc1.h index 7bfbe592caa..71ea5574504 100644 --- a/core/org.eclipse.cdt.core.tests/resources/dependency/Inc1.h +++ b/core/org.eclipse.cdt.core.tests/resources/dependency/Inc1.h @@ -1,8 +1,8 @@ -#include "c.h" - -class X -{ - public: - X(){}; - ~X(){}; +#include "c.h" + +class X +{ + public: + X(){}; + ~X(){}; }; \ No newline at end of file diff --git a/core/org.eclipse.cdt.core.tests/resources/dependency/a.h b/core/org.eclipse.cdt.core.tests/resources/dependency/a.h index 3c66f940fc1..ac18143ef8d 100644 --- a/core/org.eclipse.cdt.core.tests/resources/dependency/a.h +++ b/core/org.eclipse.cdt.core.tests/resources/dependency/a.h @@ -1,8 +1,8 @@ -#include "c.h" - -class Z -{ - public: - Z(){}; - ~Z(){}; +#include "c.h" + +class Z +{ + public: + Z(){}; + ~Z(){}; }; \ No newline at end of file diff --git a/core/org.eclipse.cdt.core.tests/resources/dependency/c.h b/core/org.eclipse.cdt.core.tests/resources/dependency/c.h index bc82542a695..5c9fd01d7b2 100644 --- a/core/org.eclipse.cdt.core.tests/resources/dependency/c.h +++ b/core/org.eclipse.cdt.core.tests/resources/dependency/c.h @@ -1,6 +1,6 @@ -class Y -{ - public: - Y(){}; - ~Y(){}; +class Y +{ + public: + Y(){}; + ~Y(){}; }; \ No newline at end of file diff --git a/core/org.eclipse.cdt.core.tests/resources/dependency/d.h b/core/org.eclipse.cdt.core.tests/resources/dependency/d.h index 8dcf01a87d2..9f800e81d90 100644 --- a/core/org.eclipse.cdt.core.tests/resources/dependency/d.h +++ b/core/org.eclipse.cdt.core.tests/resources/dependency/d.h @@ -1,6 +1,6 @@ -class d -{ - public: - d(){}; - ~d(){}; +class d +{ + public: + d(){}; + ~d(){}; }; \ No newline at end of file diff --git a/core/org.eclipse.cdt.core.tests/resources/indexer/DocumentManager.cpp b/core/org.eclipse.cdt.core.tests/resources/indexer/DocumentManager.cpp index 5fb91b9ce50..155edfb47bd 100644 --- a/core/org.eclipse.cdt.core.tests/resources/indexer/DocumentManager.cpp +++ b/core/org.eclipse.cdt.core.tests/resources/indexer/DocumentManager.cpp @@ -1,25 +1,25 @@ -//#include "StdAfx.h" -#include "DocumentManager.h" - -CDocumentManager::CDocumentManager(void) -{ -} - -CDocumentManager::~CDocumentManager(void) -{ -} - -void CDocumentManager::addToControlMap(UINT threadID, IUnknown * theControl) -{ - _controlMap.insert(MUL2IUnk_Pair(threadID,theControl)); -} - -void CDocumentManager::getControl(ULONG threadID, IUnknown ** theControl) -{ - if (_controlMap.find(threadID) != _controlMap.end()) - { - theControl = &_controlMap[threadID]; - } - - -} +//#include "StdAfx.h" +#include "DocumentManager.h" + +CDocumentManager::CDocumentManager(void) +{ +} + +CDocumentManager::~CDocumentManager(void) +{ +} + +void CDocumentManager::addToControlMap(UINT threadID, IUnknown * theControl) +{ + _controlMap.insert(MUL2IUnk_Pair(threadID,theControl)); +} + +void CDocumentManager::getControl(ULONG threadID, IUnknown ** theControl) +{ + if (_controlMap.find(threadID) != _controlMap.end()) + { + theControl = &_controlMap[threadID]; + } + + +} diff --git a/core/org.eclipse.cdt.core.tests/resources/indexer/extramail.cpp b/core/org.eclipse.cdt.core.tests/resources/indexer/extramail.cpp index da47fd6b304..766afa6a80e 100644 --- a/core/org.eclipse.cdt.core.tests/resources/indexer/extramail.cpp +++ b/core/org.eclipse.cdt.core.tests/resources/indexer/extramail.cpp @@ -1,112 +1,112 @@ -#include -#include -#include -#include - -#define PRINT(a,b) cout<<(a)<<(b) -#define CASE break;case -#define MAX(a,b) (((a)>(b))?(a):(b)) - -typedef int int32; - -static void doSomething(); - -namespace Z{ - int x; - namespace X{ - namespace Y{ - enum test{cool,hi,bye,why}; - class Mail - { - public: - Mail(){} - virtual void print()=0; //Pure Virtual Function, forces redefinition - protected: - float postage; - char *type; - friend ostream& operator << (ostream& os, Mail *m); - }; - - class postcard : public Mail - { - public: - postcard(): Mail(){postage = 0.20; type = "Postcard";} - void print(){cout << type << ": $" << setiosflags(ios::fixed) - <print(); - } - //Overloaded << - for(int x =0; x type - << ": $" << m->postage < +#include +#include +#include + +#define PRINT(a,b) cout<<(a)<<(b) +#define CASE break;case +#define MAX(a,b) (((a)>(b))?(a):(b)) + +typedef int int32; + +static void doSomething(); + +namespace Z{ + int x; + namespace X{ + namespace Y{ + enum test{cool,hi,bye,why}; + class Mail + { + public: + Mail(){} + virtual void print()=0; //Pure Virtual Function, forces redefinition + protected: + float postage; + char *type; + friend ostream& operator << (ostream& os, Mail *m); + }; + + class postcard : public Mail + { + public: + postcard(): Mail(){postage = 0.20; type = "Postcard";} + void print(){cout << type << ": $" << setiosflags(ios::fixed) + <print(); + } + //Overloaded << + for(int x =0; x type + << ": $" << m->postage < - -const SimpleStruct simpleStruct = -{ - 1 - , "mySimple" - , 0.1232 -}; - -#define SIZEOF( A, B ) sizeof( A.B ) - -const OtherStruct array[] = -{ - { -#if FOO - "foo" -#else - "bar" -#endif - , SIZEOF( simpleStruct, num ) - , &t_int - , 0 - } - , { - "name" - , SIZEOF( simpleStruct, floatnum ) - , &t_float - , 1 - } -}; - - -void SimpleStruct_construct( struct SimpleStruct * const this ) -{ - this->num = 1; - this->name = "boo"; - this->floatNum = 1.5; -} - -int ConnectParams_doSomething( const struct SimpleStruct * const this ) -{ - return 1; -} +#include + +const SimpleStruct simpleStruct = +{ + 1 + , "mySimple" + , 0.1232 +}; + +#define SIZEOF( A, B ) sizeof( A.B ) + +const OtherStruct array[] = +{ + { +#if FOO + "foo" +#else + "bar" +#endif + , SIZEOF( simpleStruct, num ) + , &t_int + , 0 + } + , { + "name" + , SIZEOF( simpleStruct, floatnum ) + , &t_float + , 1 + } +}; + + +void SimpleStruct_construct( struct SimpleStruct * const this ) +{ + this->num = 1; + this->name = "boo"; + this->floatNum = 1.5; +} + +int ConnectParams_doSomething( const struct SimpleStruct * const this ) +{ + return 1; +} diff --git a/core/org.eclipse.cdt.core.tests/resources/parser/AutomatedTest/defaultC/Simple.h b/core/org.eclipse.cdt.core.tests/resources/parser/AutomatedTest/defaultC/Simple.h index 96e8ef0a741..b5012c10f5b 100644 --- a/core/org.eclipse.cdt.core.tests/resources/parser/AutomatedTest/defaultC/Simple.h +++ b/core/org.eclipse.cdt.core.tests/resources/parser/AutomatedTest/defaultC/Simple.h @@ -1,17 +1,17 @@ -#ifndef SIMPLE_H -#define SIMPLE_H - -struct SimpleStruct -{ - int num; - char name[ ]; - float floatNum; -}; - - -void SimpleStruct_construct( struct SimpleStruct * const this ); - -int SimpleStruct_doSomething( const struct SimpleStruct * const this ); - -#endif /* SIMPLE_H */ - +#ifndef SIMPLE_H +#define SIMPLE_H + +struct SimpleStruct +{ + int num; + char name[ ]; + float floatNum; +}; + + +void SimpleStruct_construct( struct SimpleStruct * const this ); + +int SimpleStruct_doSomething( const struct SimpleStruct * const this ); + +#endif /* SIMPLE_H */ + diff --git a/core/org.eclipse.cdt.core.tests/resources/parser/AutomatedTest/defaultCpp/Simple.cpp b/core/org.eclipse.cdt.core.tests/resources/parser/AutomatedTest/defaultCpp/Simple.cpp index 4b4055ade2d..471f78e6c91 100644 --- a/core/org.eclipse.cdt.core.tests/resources/parser/AutomatedTest/defaultCpp/Simple.cpp +++ b/core/org.eclipse.cdt.core.tests/resources/parser/AutomatedTest/defaultCpp/Simple.cpp @@ -1,37 +1,37 @@ -#include - -#include - -#define NULL (void *)0 - -SimpleClass::SimpleClass( void ) -{ - init( NULL ); -} - -SimpleClass::~SimpleClass( void ) -{ -} - -SimpleClass::SimpleClass( const SimpleClass & arg ) -{ - //TODO: copy constructor -} - -SimpleClass & SimpleClass::operator=( const SimpleClass & arg ) -{ - if( this != &arg ) - { - } - return *this; -} - - -void SimpleClass::init( void * foo) -{ -} - -InnerStruct & SimpleClass::getInner( void ) -{ - return inner; -} +#include + +#include + +#define NULL (void *)0 + +SimpleClass::SimpleClass( void ) +{ + init( NULL ); +} + +SimpleClass::~SimpleClass( void ) +{ +} + +SimpleClass::SimpleClass( const SimpleClass & arg ) +{ + //TODO: copy constructor +} + +SimpleClass & SimpleClass::operator=( const SimpleClass & arg ) +{ + if( this != &arg ) + { + } + return *this; +} + + +void SimpleClass::init( void * foo) +{ +} + +InnerStruct & SimpleClass::getInner( void ) +{ + return inner; +} diff --git a/core/org.eclipse.cdt.core.tests/resources/parser/AutomatedTest/defaultCpp/Simple.h b/core/org.eclipse.cdt.core.tests/resources/parser/AutomatedTest/defaultCpp/Simple.h index e22c5eefbd0..b385fcd46ff 100644 --- a/core/org.eclipse.cdt.core.tests/resources/parser/AutomatedTest/defaultCpp/Simple.h +++ b/core/org.eclipse.cdt.core.tests/resources/parser/AutomatedTest/defaultCpp/Simple.h @@ -1,32 +1,32 @@ -#ifndef SIMPLE_H -#define SIMPLE_H - -class OtherClass; - -class SimpleClass -{ -public: - SimpleClass( void ); - SimpleClass( const SimpleClass & arg ); - - virtual ~SimpleClass( void ); - - SimpleClass & operator=( const SimpleClass & arg ); - -private: - struct InnerStruct - { - inline InnerStruct( int a ){ _a = a; } - inline ~InnerStruct( void ){} - unsigned int _a; - }; - - InnerStruct inner; - - void init( void * ); - -public: - InnerStruct & getInner( void ); -}; - -#endif /* SIMPLE_H */ +#ifndef SIMPLE_H +#define SIMPLE_H + +class OtherClass; + +class SimpleClass +{ +public: + SimpleClass( void ); + SimpleClass( const SimpleClass & arg ); + + virtual ~SimpleClass( void ); + + SimpleClass & operator=( const SimpleClass & arg ); + +private: + struct InnerStruct + { + inline InnerStruct( int a ){ _a = a; } + inline ~InnerStruct( void ){} + unsigned int _a; + }; + + InnerStruct inner; + + void init( void * ); + +public: + InnerStruct & getInner( void ); +}; + +#endif /* SIMPLE_H */ diff --git a/core/org.eclipse.cdt.core.tests/resources/parser/LineNumberTest.h b/core/org.eclipse.cdt.core.tests/resources/parser/LineNumberTest.h index 16b506364f0..6660b4e9898 100644 --- a/core/org.eclipse.cdt.core.tests/resources/parser/LineNumberTest.h +++ b/core/org.eclipse.cdt.core.tests/resources/parser/LineNumberTest.h @@ -1,43 +1,43 @@ -// inclusion begins and ends on line 2 -#include - -// simple macro begins and ends on line 5; ANOTHER on line 6 -#define SIMPLE_MACRO simple -#define ANOTHER -// namespace begins on line 7, ends on line 22 -namespace MyPackage{ - // class specification begins on line 10, ends on line 21 - class Hello{ - protected: - // simple declaration begins and ends on line 13 - int x; - // simple declaration begins and ends on line 15 - void setX(int X); - public: - // simple declaration begins on line 18 and ends on line 20 - Hello( void ) : x - ( 5 ) { - } - }; -} - -// simple declaration begins on line 25 and ends on line 27 -int * - y = - 0; - -// complex macro begins on line 30 and ends on line 31 -#define COMPLEX_MACRO 33 \ - + 44 - -// template declaration begins on line 34 and ends on line 35 -template - A createA( void ); - -// enumeration begins on line 38 and ends on line 43 -enum { - one, // enumerator begins and ends on line 39 - two, // enumerator begins and ends on line 40 - three // enumerator begins on line 41, ends on line 42 - = 4 +// inclusion begins and ends on line 2 +#include + +// simple macro begins and ends on line 5; ANOTHER on line 6 +#define SIMPLE_MACRO simple +#define ANOTHER +// namespace begins on line 7, ends on line 22 +namespace MyPackage{ + // class specification begins on line 10, ends on line 21 + class Hello{ + protected: + // simple declaration begins and ends on line 13 + int x; + // simple declaration begins and ends on line 15 + void setX(int X); + public: + // simple declaration begins on line 18 and ends on line 20 + Hello( void ) : x + ( 5 ) { + } + }; +} + +// simple declaration begins on line 25 and ends on line 27 +int * + y = + 0; + +// complex macro begins on line 30 and ends on line 31 +#define COMPLEX_MACRO 33 \ + + 44 + +// template declaration begins on line 34 and ends on line 35 +template + A createA( void ); + +// enumeration begins on line 38 and ends on line 43 +enum { + one, // enumerator begins and ends on line 39 + two, // enumerator begins and ends on line 40 + three // enumerator begins on line 41, ends on line 42 + = 4 }; \ No newline at end of file diff --git a/core/org.eclipse.cdt.core.tests/resources/search/classDecl.cpp b/core/org.eclipse.cdt.core.tests/resources/search/classDecl.cpp index f2fa14f0168..94a7173c70e 100644 --- a/core/org.eclipse.cdt.core.tests/resources/search/classDecl.cpp +++ b/core/org.eclipse.cdt.core.tests/resources/search/classDecl.cpp @@ -1,102 +1,102 @@ -#include "include.h" - -#define FOO bar - -class Heal{}; - -class A { - A() {} - ~A(){} - class B { - void f( A ); - void f( A & ); - void f( A* ); - void f( int &, const char [], A ** ); - }; -}; - -namespace NS { - namespace NS2{ - struct a{}; - } - class B: public A { - public: - struct AA {}; - enum e { - One, - Two, - Three - }; - - void f(){ - using namespace NS2; - a aStruct; - } - - - - AA anotherStruct; - }; - union u{ } ; -} - -namespace NS3{ - class C : public NS::B { - e eE = One; - }; -} - -A::B b1; - -typedef NS::B NS_B; -NS_B b2; - -union u{ -}; - -class AClassForFoo {}; - -AClassForFoo foo( AClassForFoo ){ - AClassForFoo b; - return b; -} - -Head * Head::operator *= ( int index ){ - return array[ index ]; -} - -Head * Head::operator += ( int index ){ - return array[ index ]; -} - -extern int externalInt; -extern int externalIntWithInitializer = 2; -extern "C" int externCInt; -extern "C" int externCIntWithInitializer = 3; - -void forwardFunction() { } -void normalFunction() { } - -void DeclsAndDefns::forwardMethod(){ } - -int DeclsAndDefns::staticField = 5; - - -namespace bug68235{ - struct xTag { - int x; - }; - typedef xTag xType; - - typedef struct yTag { - int x; - } yType; - - class C1{ - public: - xType x; - yType y; - C1(); - ~C1(); - }; +#include "include.h" + +#define FOO bar + +class Heal{}; + +class A { + A() {} + ~A(){} + class B { + void f( A ); + void f( A & ); + void f( A* ); + void f( int &, const char [], A ** ); + }; +}; + +namespace NS { + namespace NS2{ + struct a{}; + } + class B: public A { + public: + struct AA {}; + enum e { + One, + Two, + Three + }; + + void f(){ + using namespace NS2; + a aStruct; + } + + + + AA anotherStruct; + }; + union u{ } ; +} + +namespace NS3{ + class C : public NS::B { + e eE = One; + }; +} + +A::B b1; + +typedef NS::B NS_B; +NS_B b2; + +union u{ +}; + +class AClassForFoo {}; + +AClassForFoo foo( AClassForFoo ){ + AClassForFoo b; + return b; +} + +Head * Head::operator *= ( int index ){ + return array[ index ]; +} + +Head * Head::operator += ( int index ){ + return array[ index ]; +} + +extern int externalInt; +extern int externalIntWithInitializer = 2; +extern "C" int externCInt; +extern "C" int externCIntWithInitializer = 3; + +void forwardFunction() { } +void normalFunction() { } + +void DeclsAndDefns::forwardMethod(){ } + +int DeclsAndDefns::staticField = 5; + + +namespace bug68235{ + struct xTag { + int x; + }; + typedef xTag xType; + + typedef struct yTag { + int x; + } yType; + + class C1{ + public: + xType x; + yType y; + C1(); + ~C1(); + }; } \ No newline at end of file diff --git a/core/org.eclipse.cdt.core.tests/resources/search/include.h b/core/org.eclipse.cdt.core.tests/resources/search/include.h index f9c3d75956e..bb0b00ad594 100644 --- a/core/org.eclipse.cdt.core.tests/resources/search/include.h +++ b/core/org.eclipse.cdt.core.tests/resources/search/include.h @@ -1,36 +1,36 @@ -#ifndef INCLUDE_H -#define INCLUDE_H - -class Head { - Head ** array; - - Head * operator *= ( int index ); - Head * operator * ( int index ){ return array[ index ]; } - Head * operator += ( int index ); - - operator const short & (); - operator short (); - operator short int (); - -}; - -class DeclsAndDefns{ - static int staticField; - int nonStaticField; - - void forwardMethod(); - void inlineMethod() {} -}; - -void forwardFunction(); - - -class Direction{ - void turn(); - void turn(int); - void turnAgain(void); -}; -class Right : public Direction { - void turn() { } -}; +#ifndef INCLUDE_H +#define INCLUDE_H + +class Head { + Head ** array; + + Head * operator *= ( int index ); + Head * operator * ( int index ){ return array[ index ]; } + Head * operator += ( int index ); + + operator const short & (); + operator short (); + operator short int (); + +}; + +class DeclsAndDefns{ + static int staticField; + int nonStaticField; + + void forwardMethod(); + void inlineMethod() {} +}; + +void forwardFunction(); + + +class Direction{ + void turn(); + void turn(int); + void turnAgain(void); +}; +class Right : public Direction { + void turn() { } +}; #endif \ No newline at end of file diff --git a/core/org.eclipse.cdt.core.tests/suite/org/eclipse/cdt/core/testplugin/CModelMock.java b/core/org.eclipse.cdt.core.tests/suite/org/eclipse/cdt/core/testplugin/CModelMock.java index db644fd1d62..8483e7d1163 100644 --- a/core/org.eclipse.cdt.core.tests/suite/org/eclipse/cdt/core/testplugin/CModelMock.java +++ b/core/org.eclipse.cdt.core.tests/suite/org/eclipse/cdt/core/testplugin/CModelMock.java @@ -1,496 +1,496 @@ -/******************************************************************************* - * 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.testplugin; - -import java.util.Map; - -import org.eclipse.cdt.core.cdtvariables.ICdtVariablesContributor; -import org.eclipse.cdt.core.settings.model.CConfigurationStatus; -import org.eclipse.cdt.core.settings.model.ICBuildSetting; -import org.eclipse.cdt.core.settings.model.ICConfigExtensionReference; -import org.eclipse.cdt.core.settings.model.ICConfigurationDescription; -import org.eclipse.cdt.core.settings.model.ICExternalSetting; -import org.eclipse.cdt.core.settings.model.ICFileDescription; -import org.eclipse.cdt.core.settings.model.ICFolderDescription; -import org.eclipse.cdt.core.settings.model.ICLanguageSetting; -import org.eclipse.cdt.core.settings.model.ICProjectDescription; -import org.eclipse.cdt.core.settings.model.ICResourceDescription; -import org.eclipse.cdt.core.settings.model.ICSettingContainer; -import org.eclipse.cdt.core.settings.model.ICSettingEntry; -import org.eclipse.cdt.core.settings.model.ICSettingObject; -import org.eclipse.cdt.core.settings.model.ICSourceEntry; -import org.eclipse.cdt.core.settings.model.ICStorageElement; -import org.eclipse.cdt.core.settings.model.ICTargetPlatformSetting; -import org.eclipse.cdt.core.settings.model.WriteAccessException; -import org.eclipse.cdt.core.settings.model.extension.CConfigurationData; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.QualifiedName; - -/** - * Collection of mock classes for testing - */ -public class CModelMock { - /** - * Dummy implementation of ICProjectDescription for testing. - * Feel free to override the methods you are interested to mock. - */ - public static class DummyCProjectDescription implements ICProjectDescription { - - @Override - public ICSettingObject[] getChildSettings() { - return null; - } - - @Override - public String getId() { - return null; - } - - @Override - public String getName() { - return null; - } - - @Override - public int getType() { - return 0; - } - - @Override - public boolean isValid() { - return false; - } - - @Override - public ICConfigurationDescription getConfiguration() { - return null; - } - - @Override - public ICSettingContainer getParent() { - return null; - } - - @Override - public boolean isReadOnly() { - return false; - } - - @Override - public ICStorageElement getStorage(String id, boolean create) - throws CoreException { - return null; - } - - @Override - public void removeStorage(String id) throws CoreException { - } - - @Override - public ICStorageElement importStorage(String id, ICStorageElement el) - throws UnsupportedOperationException, CoreException { - return null; - } - - @Override - public void setReadOnly(boolean readOnly, boolean keepModify) { - } - - @Override - public int getConfigurationRelations() { - return 0; - } - - @Override - public void setConfigurationRelations(int status) { - } - - @Override - public void useDefaultConfigurationRelations() { - } - - @Override - public boolean isDefaultConfigurationRelations() { - return false; - } - - @Override - public ICConfigurationDescription[] getConfigurations() { - return null; - } - - @Override - public ICConfigurationDescription getActiveConfiguration() { - return null; - } - - @Override - public void setActiveConfiguration(ICConfigurationDescription cfg) - throws WriteAccessException { - } - - @Override - public ICConfigurationDescription createConfiguration(String id, - String name, ICConfigurationDescription base) - throws CoreException, WriteAccessException { - return null; - } - - @Override - public ICConfigurationDescription createConfiguration( - String buildSystemId, CConfigurationData data) - throws CoreException, WriteAccessException { - return null; - } - - @Override - public ICConfigurationDescription getConfigurationByName(String name) { - return null; - } - - @Override - public ICConfigurationDescription getConfigurationById(String id) { - return null; - } - - @Override - public void removeConfiguration(String name) - throws WriteAccessException { - } - - @Override - public void removeConfiguration(ICConfigurationDescription cfg) - throws WriteAccessException { - } - - @Override - public IProject getProject() { - return null; - } - - @Override - public boolean isModified() { - return false; - } - - @Override - public Object getSessionProperty(QualifiedName name) { - return null; - } - - @Override - public void setSessionProperty(QualifiedName name, Object value) { - - } - - @Override - public ICConfigurationDescription getDefaultSettingConfiguration() { - return null; - } - - @Override - public void setDefaultSettingConfiguration( - ICConfigurationDescription cfg) { - } - - @Override - public boolean isCdtProjectCreating() { - return false; - } - - @Override - public void setCdtProjectCreated() { - } - - } - - /** - * Dummy implementation of ICConfigurationDescription for testing. - * Feel free to override the methods you are interested to mock. - */ - public static class DummyCConfigurationDescription implements ICConfigurationDescription { - private String id; - private ICProjectDescription projectDescription; - - public DummyCConfigurationDescription(String id) { - this.id = id; - this.projectDescription = new DummyCProjectDescription(); - } - - @Override - public ICSettingObject[] getChildSettings() { - return null; - } - - @Override - public String getId() { - return id; - } - - @Override - public String getName() { - return null; - } - - @Override - public int getType() { - return 0; - } - - @Override - public boolean isValid() { - return false; - } - - @Override - public ICConfigurationDescription getConfiguration() { - return null; - } - - @Override - public ICSettingContainer getParent() { - return null; - } - - @Override - public boolean isReadOnly() { - return false; - } - - @Override - public ICStorageElement getStorage(String id, boolean create) - throws CoreException { - return null; - } - - @Override - public void removeStorage(String id) throws CoreException { - } - - @Override - public ICStorageElement importStorage(String id, ICStorageElement el) - throws UnsupportedOperationException, CoreException { - return null; - } - - @Override - public void setReadOnly(boolean readOnly, boolean keepModify) { - } - - @Override - public boolean isActive() { - return false; - } - - @Override - public String getDescription() { - return null; - } - - @Override - public void setDescription(String des) throws WriteAccessException { - } - - @Override - public ICProjectDescription getProjectDescription() { - return projectDescription; - } - - @Override - public ICFolderDescription getRootFolderDescription() { - return null; - } - - @Override - public ICFolderDescription[] getFolderDescriptions() { - return null; - } - - @Override - public ICFileDescription[] getFileDescriptions() { - return null; - } - - @Override - public ICResourceDescription[] getResourceDescriptions() { - return null; - } - - @Override - public ICResourceDescription getResourceDescription(IPath path, - boolean exactPath) { - return null; - } - - @Override - public void removeResourceDescription(ICResourceDescription des) - throws CoreException, WriteAccessException { - } - - @Override - public ICFileDescription createFileDescription(IPath path, - ICResourceDescription base) throws CoreException, - WriteAccessException { - return null; - } - - @Override - public ICFolderDescription createFolderDescription(IPath path, - ICFolderDescription base) throws CoreException, - WriteAccessException { - return null; - } - - @Override - public String getBuildSystemId() { - return null; - } - - @Override - public CConfigurationData getConfigurationData() { - return null; - } - - @Override - public void setActive() throws WriteAccessException { - } - - @Override - public void setConfigurationData(String buildSystemId, CConfigurationData data) throws WriteAccessException { - } - - @Override - public boolean isModified() { - return false; - } - - @Override - public ICTargetPlatformSetting getTargetPlatformSetting() { - return null; - } - - @Override - public ICSourceEntry[] getSourceEntries() { - return null; - } - - @Override - public ICSourceEntry[] getResolvedSourceEntries() { - return null; - } - - @Override - public void setSourceEntries(ICSourceEntry[] entries) throws CoreException, WriteAccessException { - } - - @Override - public Map getReferenceInfo() { - return null; - } - - @Override - public void setReferenceInfo(Map refs) throws WriteAccessException { - } - - @Override - public ICExternalSetting[] getExternalSettings() { - return null; - } - - @Override - public ICExternalSetting createExternalSetting(String[] languageIDs, - String[] contentTypeIds, String[] extensions, - ICSettingEntry[] entries) throws WriteAccessException { - return null; - } - - @Override - public void removeExternalSetting(ICExternalSetting setting) throws WriteAccessException { - } - - @Override - public void removeExternalSettings() throws WriteAccessException { - } - - @Override - public ICBuildSetting getBuildSetting() { - return null; - } - - @Override - public ICdtVariablesContributor getBuildVariablesContributor() { - return null; - } - - @Override - public Object getSessionProperty(QualifiedName name) { - return null; - } - - @Override - public void setSessionProperty(QualifiedName name, Object value) { - } - - @Override - public void setName(String name) throws WriteAccessException { - } - - @Override - public ICConfigExtensionReference[] get(String extensionPointID) { - return null; - } - - @Override - public ICConfigExtensionReference create(String extensionPoint, String extension) throws CoreException { - return null; - } - - @Override - public void remove(ICConfigExtensionReference ext) throws CoreException { - } - - @Override - public void remove(String extensionPoint) throws CoreException { - } - - @Override - public boolean isPreferenceConfiguration() { - return false; - } - - @Override - public ICLanguageSetting getLanguageSettingForFile(IPath path, boolean ignoreExludeStatus) { - return null; - } - - @Override - public void setExternalSettingsProviderIds(String[] ids) { - } - - @Override - public String[] getExternalSettingsProviderIds() { - return null; - } - - @Override - public void updateExternalSettingsProviders(String[] ids) throws WriteAccessException { - } - - @Override - public CConfigurationStatus getConfigurationStatus() { - return null; - } - - } -} +/******************************************************************************* + * 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.testplugin; + +import java.util.Map; + +import org.eclipse.cdt.core.cdtvariables.ICdtVariablesContributor; +import org.eclipse.cdt.core.settings.model.CConfigurationStatus; +import org.eclipse.cdt.core.settings.model.ICBuildSetting; +import org.eclipse.cdt.core.settings.model.ICConfigExtensionReference; +import org.eclipse.cdt.core.settings.model.ICConfigurationDescription; +import org.eclipse.cdt.core.settings.model.ICExternalSetting; +import org.eclipse.cdt.core.settings.model.ICFileDescription; +import org.eclipse.cdt.core.settings.model.ICFolderDescription; +import org.eclipse.cdt.core.settings.model.ICLanguageSetting; +import org.eclipse.cdt.core.settings.model.ICProjectDescription; +import org.eclipse.cdt.core.settings.model.ICResourceDescription; +import org.eclipse.cdt.core.settings.model.ICSettingContainer; +import org.eclipse.cdt.core.settings.model.ICSettingEntry; +import org.eclipse.cdt.core.settings.model.ICSettingObject; +import org.eclipse.cdt.core.settings.model.ICSourceEntry; +import org.eclipse.cdt.core.settings.model.ICStorageElement; +import org.eclipse.cdt.core.settings.model.ICTargetPlatformSetting; +import org.eclipse.cdt.core.settings.model.WriteAccessException; +import org.eclipse.cdt.core.settings.model.extension.CConfigurationData; +import org.eclipse.core.resources.IProject; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IPath; +import org.eclipse.core.runtime.QualifiedName; + +/** + * Collection of mock classes for testing + */ +public class CModelMock { + /** + * Dummy implementation of ICProjectDescription for testing. + * Feel free to override the methods you are interested to mock. + */ + public static class DummyCProjectDescription implements ICProjectDescription { + + @Override + public ICSettingObject[] getChildSettings() { + return null; + } + + @Override + public String getId() { + return null; + } + + @Override + public String getName() { + return null; + } + + @Override + public int getType() { + return 0; + } + + @Override + public boolean isValid() { + return false; + } + + @Override + public ICConfigurationDescription getConfiguration() { + return null; + } + + @Override + public ICSettingContainer getParent() { + return null; + } + + @Override + public boolean isReadOnly() { + return false; + } + + @Override + public ICStorageElement getStorage(String id, boolean create) + throws CoreException { + return null; + } + + @Override + public void removeStorage(String id) throws CoreException { + } + + @Override + public ICStorageElement importStorage(String id, ICStorageElement el) + throws UnsupportedOperationException, CoreException { + return null; + } + + @Override + public void setReadOnly(boolean readOnly, boolean keepModify) { + } + + @Override + public int getConfigurationRelations() { + return 0; + } + + @Override + public void setConfigurationRelations(int status) { + } + + @Override + public void useDefaultConfigurationRelations() { + } + + @Override + public boolean isDefaultConfigurationRelations() { + return false; + } + + @Override + public ICConfigurationDescription[] getConfigurations() { + return null; + } + + @Override + public ICConfigurationDescription getActiveConfiguration() { + return null; + } + + @Override + public void setActiveConfiguration(ICConfigurationDescription cfg) + throws WriteAccessException { + } + + @Override + public ICConfigurationDescription createConfiguration(String id, + String name, ICConfigurationDescription base) + throws CoreException, WriteAccessException { + return null; + } + + @Override + public ICConfigurationDescription createConfiguration( + String buildSystemId, CConfigurationData data) + throws CoreException, WriteAccessException { + return null; + } + + @Override + public ICConfigurationDescription getConfigurationByName(String name) { + return null; + } + + @Override + public ICConfigurationDescription getConfigurationById(String id) { + return null; + } + + @Override + public void removeConfiguration(String name) + throws WriteAccessException { + } + + @Override + public void removeConfiguration(ICConfigurationDescription cfg) + throws WriteAccessException { + } + + @Override + public IProject getProject() { + return null; + } + + @Override + public boolean isModified() { + return false; + } + + @Override + public Object getSessionProperty(QualifiedName name) { + return null; + } + + @Override + public void setSessionProperty(QualifiedName name, Object value) { + + } + + @Override + public ICConfigurationDescription getDefaultSettingConfiguration() { + return null; + } + + @Override + public void setDefaultSettingConfiguration( + ICConfigurationDescription cfg) { + } + + @Override + public boolean isCdtProjectCreating() { + return false; + } + + @Override + public void setCdtProjectCreated() { + } + + } + + /** + * Dummy implementation of ICConfigurationDescription for testing. + * Feel free to override the methods you are interested to mock. + */ + public static class DummyCConfigurationDescription implements ICConfigurationDescription { + private String id; + private ICProjectDescription projectDescription; + + public DummyCConfigurationDescription(String id) { + this.id = id; + this.projectDescription = new DummyCProjectDescription(); + } + + @Override + public ICSettingObject[] getChildSettings() { + return null; + } + + @Override + public String getId() { + return id; + } + + @Override + public String getName() { + return null; + } + + @Override + public int getType() { + return 0; + } + + @Override + public boolean isValid() { + return false; + } + + @Override + public ICConfigurationDescription getConfiguration() { + return null; + } + + @Override + public ICSettingContainer getParent() { + return null; + } + + @Override + public boolean isReadOnly() { + return false; + } + + @Override + public ICStorageElement getStorage(String id, boolean create) + throws CoreException { + return null; + } + + @Override + public void removeStorage(String id) throws CoreException { + } + + @Override + public ICStorageElement importStorage(String id, ICStorageElement el) + throws UnsupportedOperationException, CoreException { + return null; + } + + @Override + public void setReadOnly(boolean readOnly, boolean keepModify) { + } + + @Override + public boolean isActive() { + return false; + } + + @Override + public String getDescription() { + return null; + } + + @Override + public void setDescription(String des) throws WriteAccessException { + } + + @Override + public ICProjectDescription getProjectDescription() { + return projectDescription; + } + + @Override + public ICFolderDescription getRootFolderDescription() { + return null; + } + + @Override + public ICFolderDescription[] getFolderDescriptions() { + return null; + } + + @Override + public ICFileDescription[] getFileDescriptions() { + return null; + } + + @Override + public ICResourceDescription[] getResourceDescriptions() { + return null; + } + + @Override + public ICResourceDescription getResourceDescription(IPath path, + boolean exactPath) { + return null; + } + + @Override + public void removeResourceDescription(ICResourceDescription des) + throws CoreException, WriteAccessException { + } + + @Override + public ICFileDescription createFileDescription(IPath path, + ICResourceDescription base) throws CoreException, + WriteAccessException { + return null; + } + + @Override + public ICFolderDescription createFolderDescription(IPath path, + ICFolderDescription base) throws CoreException, + WriteAccessException { + return null; + } + + @Override + public String getBuildSystemId() { + return null; + } + + @Override + public CConfigurationData getConfigurationData() { + return null; + } + + @Override + public void setActive() throws WriteAccessException { + } + + @Override + public void setConfigurationData(String buildSystemId, CConfigurationData data) throws WriteAccessException { + } + + @Override + public boolean isModified() { + return false; + } + + @Override + public ICTargetPlatformSetting getTargetPlatformSetting() { + return null; + } + + @Override + public ICSourceEntry[] getSourceEntries() { + return null; + } + + @Override + public ICSourceEntry[] getResolvedSourceEntries() { + return null; + } + + @Override + public void setSourceEntries(ICSourceEntry[] entries) throws CoreException, WriteAccessException { + } + + @Override + public Map getReferenceInfo() { + return null; + } + + @Override + public void setReferenceInfo(Map refs) throws WriteAccessException { + } + + @Override + public ICExternalSetting[] getExternalSettings() { + return null; + } + + @Override + public ICExternalSetting createExternalSetting(String[] languageIDs, + String[] contentTypeIds, String[] extensions, + ICSettingEntry[] entries) throws WriteAccessException { + return null; + } + + @Override + public void removeExternalSetting(ICExternalSetting setting) throws WriteAccessException { + } + + @Override + public void removeExternalSettings() throws WriteAccessException { + } + + @Override + public ICBuildSetting getBuildSetting() { + return null; + } + + @Override + public ICdtVariablesContributor getBuildVariablesContributor() { + return null; + } + + @Override + public Object getSessionProperty(QualifiedName name) { + return null; + } + + @Override + public void setSessionProperty(QualifiedName name, Object value) { + } + + @Override + public void setName(String name) throws WriteAccessException { + } + + @Override + public ICConfigExtensionReference[] get(String extensionPointID) { + return null; + } + + @Override + public ICConfigExtensionReference create(String extensionPoint, String extension) throws CoreException { + return null; + } + + @Override + public void remove(ICConfigExtensionReference ext) throws CoreException { + } + + @Override + public void remove(String extensionPoint) throws CoreException { + } + + @Override + public boolean isPreferenceConfiguration() { + return false; + } + + @Override + public ICLanguageSetting getLanguageSettingForFile(IPath path, boolean ignoreExludeStatus) { + return null; + } + + @Override + public void setExternalSettingsProviderIds(String[] ids) { + } + + @Override + public String[] getExternalSettingsProviderIds() { + return null; + } + + @Override + public void updateExternalSettingsProviders(String[] ids) throws WriteAccessException { + } + + @Override + public CConfigurationStatus getConfigurationStatus() { + return null; + } + + } +} diff --git a/core/org.eclipse.cdt.core.win32.x86/.project b/core/org.eclipse.cdt.core.win32.x86/.project index 29368923c4c..35ed365d43b 100644 --- a/core/org.eclipse.cdt.core.win32.x86/.project +++ b/core/org.eclipse.cdt.core.win32.x86/.project @@ -1,22 +1,22 @@ - - - org.eclipse.cdt.core.win32.x86 - - - - - - org.eclipse.pde.ManifestBuilder - - - - - org.eclipse.pde.SchemaBuilder - - - - - - org.eclipse.pde.PluginNature - - + + + org.eclipse.cdt.core.win32.x86 + + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.pde.PluginNature + + diff --git a/core/org.eclipse.cdt.core.win32.x86/about.html b/core/org.eclipse.cdt.core.win32.x86/about.html index 5eba4faba08..d7c511887d6 100644 --- a/core/org.eclipse.cdt.core.win32.x86/about.html +++ b/core/org.eclipse.cdt.core.win32.x86/about.html @@ -1,24 +1,24 @@ - - -About - - -

About This Content

- -

June 22, 2007

-

License

- -

The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise -indicated below, the Content is provided to you under the terms and conditions of the -Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available -at http://www.eclipse.org/legal/epl-v10.html. -For purposes of the EPL, "Program" will mean the Content.

- -

If you did not receive this Content directly from the Eclipse Foundation, the Content is -being redistributed by another party ("Redistributor") and different terms and conditions may -apply to your use of any object code in the Content. Check the Redistributor's license that was -provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise -indicated below, the terms and conditions of the EPL still apply to any source code in the Content -and such source code may be obtained at http://www.eclipse.org.

- + + +About + + +

About This Content

+ +

June 22, 2007

+

License

+ +

The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise +indicated below, the Content is provided to you under the terms and conditions of the +Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available +at http://www.eclipse.org/legal/epl-v10.html. +For purposes of the EPL, "Program" will mean the Content.

+ +

If you did not receive this Content directly from the Eclipse Foundation, the Content is +being redistributed by another party ("Redistributor") and different terms and conditions may +apply to your use of any object code in the Content. Check the Redistributor's license that was +provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise +indicated below, the terms and conditions of the EPL still apply to any source code in the Content +and such source code may be obtained at http://www.eclipse.org.

+ \ No newline at end of file diff --git a/core/org.eclipse.cdt.core.win32.x86/build.properties b/core/org.eclipse.cdt.core.win32.x86/build.properties index 437fccbc0c7..7432ecbfa61 100644 --- a/core/org.eclipse.cdt.core.win32.x86/build.properties +++ b/core/org.eclipse.cdt.core.win32.x86/build.properties @@ -1,15 +1,15 @@ -############################################################################### -# Copyright (c) 2011 Marc-Andre Laperle 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: -# Marc-Andre Laperle - initial API and implementation -############################################################################### -bin.includes = META-INF/,\ - os/,\ - about.html,\ - plugin.properties -src.includes = about.html +############################################################################### +# Copyright (c) 2011 Marc-Andre Laperle 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: +# Marc-Andre Laperle - initial API and implementation +############################################################################### +bin.includes = META-INF/,\ + os/,\ + about.html,\ + plugin.properties +src.includes = about.html diff --git a/core/org.eclipse.cdt.core.win32.x86_64/.project b/core/org.eclipse.cdt.core.win32.x86_64/.project index 11d5a0fe822..f3a99b7c96b 100644 --- a/core/org.eclipse.cdt.core.win32.x86_64/.project +++ b/core/org.eclipse.cdt.core.win32.x86_64/.project @@ -1,22 +1,22 @@ - - - org.eclipse.cdt.core.win32.x86_64 - - - - - - org.eclipse.pde.ManifestBuilder - - - - - org.eclipse.pde.SchemaBuilder - - - - - - org.eclipse.pde.PluginNature - - + + + org.eclipse.cdt.core.win32.x86_64 + + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.pde.PluginNature + + diff --git a/core/org.eclipse.cdt.core.win32.x86_64/about.html b/core/org.eclipse.cdt.core.win32.x86_64/about.html index 5eba4faba08..d7c511887d6 100644 --- a/core/org.eclipse.cdt.core.win32.x86_64/about.html +++ b/core/org.eclipse.cdt.core.win32.x86_64/about.html @@ -1,24 +1,24 @@ - - -About - - -

About This Content

- -

June 22, 2007

-

License

- -

The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise -indicated below, the Content is provided to you under the terms and conditions of the -Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available -at http://www.eclipse.org/legal/epl-v10.html. -For purposes of the EPL, "Program" will mean the Content.

- -

If you did not receive this Content directly from the Eclipse Foundation, the Content is -being redistributed by another party ("Redistributor") and different terms and conditions may -apply to your use of any object code in the Content. Check the Redistributor's license that was -provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise -indicated below, the terms and conditions of the EPL still apply to any source code in the Content -and such source code may be obtained at http://www.eclipse.org.

- + + +About + + +

About This Content

+ +

June 22, 2007

+

License

+ +

The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise +indicated below, the Content is provided to you under the terms and conditions of the +Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available +at http://www.eclipse.org/legal/epl-v10.html. +For purposes of the EPL, "Program" will mean the Content.

+ +

If you did not receive this Content directly from the Eclipse Foundation, the Content is +being redistributed by another party ("Redistributor") and different terms and conditions may +apply to your use of any object code in the Content. Check the Redistributor's license that was +provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise +indicated below, the terms and conditions of the EPL still apply to any source code in the Content +and such source code may be obtained at http://www.eclipse.org.

+ \ No newline at end of file diff --git a/core/org.eclipse.cdt.core.win32.x86_64/build.properties b/core/org.eclipse.cdt.core.win32.x86_64/build.properties index 437fccbc0c7..7432ecbfa61 100644 --- a/core/org.eclipse.cdt.core.win32.x86_64/build.properties +++ b/core/org.eclipse.cdt.core.win32.x86_64/build.properties @@ -1,15 +1,15 @@ -############################################################################### -# Copyright (c) 2011 Marc-Andre Laperle 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: -# Marc-Andre Laperle - initial API and implementation -############################################################################### -bin.includes = META-INF/,\ - os/,\ - about.html,\ - plugin.properties -src.includes = about.html +############################################################################### +# Copyright (c) 2011 Marc-Andre Laperle 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: +# Marc-Andre Laperle - initial API and implementation +############################################################################### +bin.includes = META-INF/,\ + os/,\ + about.html,\ + plugin.properties +src.includes = about.html diff --git a/core/org.eclipse.cdt.core.win32/library/Makefile_x86_64.mk b/core/org.eclipse.cdt.core.win32/library/Makefile_x86_64.mk index bec950a18d2..5fe1804cc99 100644 --- a/core/org.eclipse.cdt.core.win32/library/Makefile_x86_64.mk +++ b/core/org.eclipse.cdt.core.win32/library/Makefile_x86_64.mk @@ -1,73 +1,73 @@ -#******************************************************************************* -# Copyright (c) 2011 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 -#******************************************************************************* - -# Makefile (nmake) for Core fragment on Windows x86_64 - -OS = win32 -ARCH = x86_64 - -JDK_INCLUDES= "$(JAVA_HOME)\include" -JDK_OS_INCLUDES= "$(JAVA_HOME)\include/$(OS)" - -CC=cl -DEBUG_FLAGS = -DDEBUG_MONITOR -DREAD_REPORT -CFLAGS = /TP /I$(JDK_INCLUDES) /I$(JDK_OS_INCLUDES) /EHs /nologo -CFLAGS_UNICODE = /D "_UNICODE" /D "UNICODE" $(CFLAGS) - -INSTALL_DIR = ..\..\org.eclipse.cdt.core.$(OS).$(ARCH)\os\$(OS)\$(ARCH) - -DLL_SPAWNER = spawner.dll -OBJS_SPAWNER=StdAfx.obj Win32ProcessEx.obj iostream.obj raise.obj spawner.obj - -DLL_WINREG = winreg.dll -OBJS_WINREG=winreg/winreg.obj - -EXE_STARTER = starter.exe -OBJS_STARTER=starter/starter.obj - -EXE_LISTTASKS = listtasks.exe -OBJS_LISTTASKS=listtasks/listtasks.obj listtasks/StdAfx.obj - -.c.obj: - cl /c $(CFLAGS_UNICODE) $*.c /Fo$@ - -.cpp.obj: - cl /c $(CFLAGS_UNICODE) $*.cpp /Fo$@ - -#TODO: Use unicode for listtasks, see bug 353460 -listtasks/listtasks.obj: - cl /c $(CFLAGS) $*.cpp /Fo$@ - -spawner: $(OBJS_SPAWNER) - link /dll /nologo /out:$(DLL_SPAWNER) $(OBJS_SPAWNER) User32.lib - -winreg: $(OBJS_WINREG) - link /dll /nologo /out:$(DLL_WINREG) $(OBJS_WINREG) Advapi32.lib - -starter: $(OBJS_STARTER) - link /nologo /out:$(EXE_STARTER) $(OBJS_STARTER) Psapi.Lib Shell32.lib - -listtasks: $(OBJS_LISTTASKS) - link /nologo /out:$(EXE_LISTTASKS) $(OBJS_LISTTASKS) Psapi.Lib - -all: spawner winreg starter listtasks - -clean: - del *.obj *.lib *.exp *.exe *.dll winreg\*.obj starter\*.obj listtasks\*.obj - -rebuild: clean all - -install: all - copy *.dll $(INSTALL_DIR) - copy *.exe $(INSTALL_DIR) - -uninstall: - del $(INSTALL_DIR)\*.dll $(INSTALL_DIR)\*.exe +#******************************************************************************* +# Copyright (c) 2011 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 +#******************************************************************************* + +# Makefile (nmake) for Core fragment on Windows x86_64 + +OS = win32 +ARCH = x86_64 + +JDK_INCLUDES= "$(JAVA_HOME)\include" +JDK_OS_INCLUDES= "$(JAVA_HOME)\include/$(OS)" + +CC=cl +DEBUG_FLAGS = -DDEBUG_MONITOR -DREAD_REPORT +CFLAGS = /TP /I$(JDK_INCLUDES) /I$(JDK_OS_INCLUDES) /EHs /nologo +CFLAGS_UNICODE = /D "_UNICODE" /D "UNICODE" $(CFLAGS) + +INSTALL_DIR = ..\..\org.eclipse.cdt.core.$(OS).$(ARCH)\os\$(OS)\$(ARCH) + +DLL_SPAWNER = spawner.dll +OBJS_SPAWNER=StdAfx.obj Win32ProcessEx.obj iostream.obj raise.obj spawner.obj + +DLL_WINREG = winreg.dll +OBJS_WINREG=winreg/winreg.obj + +EXE_STARTER = starter.exe +OBJS_STARTER=starter/starter.obj + +EXE_LISTTASKS = listtasks.exe +OBJS_LISTTASKS=listtasks/listtasks.obj listtasks/StdAfx.obj + +.c.obj: + cl /c $(CFLAGS_UNICODE) $*.c /Fo$@ + +.cpp.obj: + cl /c $(CFLAGS_UNICODE) $*.cpp /Fo$@ + +#TODO: Use unicode for listtasks, see bug 353460 +listtasks/listtasks.obj: + cl /c $(CFLAGS) $*.cpp /Fo$@ + +spawner: $(OBJS_SPAWNER) + link /dll /nologo /out:$(DLL_SPAWNER) $(OBJS_SPAWNER) User32.lib + +winreg: $(OBJS_WINREG) + link /dll /nologo /out:$(DLL_WINREG) $(OBJS_WINREG) Advapi32.lib + +starter: $(OBJS_STARTER) + link /nologo /out:$(EXE_STARTER) $(OBJS_STARTER) Psapi.Lib Shell32.lib + +listtasks: $(OBJS_LISTTASKS) + link /nologo /out:$(EXE_LISTTASKS) $(OBJS_LISTTASKS) Psapi.Lib + +all: spawner winreg starter listtasks + +clean: + del *.obj *.lib *.exp *.exe *.dll winreg\*.obj starter\*.obj listtasks\*.obj + +rebuild: clean all + +install: all + copy *.dll $(INSTALL_DIR) + copy *.exe $(INSTALL_DIR) + +uninstall: + del $(INSTALL_DIR)\*.dll $(INSTALL_DIR)\*.exe diff --git a/core/org.eclipse.cdt.core.win32/library/Readme64.txt b/core/org.eclipse.cdt.core.win32/library/Readme64.txt index fc59c9e51c4..ce6b1379478 100644 --- a/core/org.eclipse.cdt.core.win32/library/Readme64.txt +++ b/core/org.eclipse.cdt.core.win32/library/Readme64.txt @@ -1,23 +1,23 @@ -#******************************************************************************* -# Copyright (c) 2011 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 -#******************************************************************************* - -How to build the Win32 x86_64 core fragment: - -1. Prerequisites -- Install Windows SDK 7.1. If the SDK is not installed in the default location or if you want to try a different SDK, modify setenv64.bat accordingly. -- Make sure your JAVA_HOME environment variable is set and points to a 64 bit JDK (C:\Program Files\Java\jdkX.X.X not C:\Program Files (x86)\Java\jdkX.X.X ) - -2. Build and install -- In a command prompt, execute setenv64.bat. -The command prompt should turn to a different color and print a message about targeting x64. -- Execute build64.bat -This will build the dlls and executables, copy them to org.eclipse.cdt.core.win32.x86_64\os\win32\x86_64 then clean the build directories. -Optionally, you can use nmake /f Makefile_x86_64.mk TARGET directly. Refer to Makefile_x86_64.mk for valid targets. +#******************************************************************************* +# Copyright (c) 2011 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 +#******************************************************************************* + +How to build the Win32 x86_64 core fragment: + +1. Prerequisites +- Install Windows SDK 7.1. If the SDK is not installed in the default location or if you want to try a different SDK, modify setenv64.bat accordingly. +- Make sure your JAVA_HOME environment variable is set and points to a 64 bit JDK (C:\Program Files\Java\jdkX.X.X not C:\Program Files (x86)\Java\jdkX.X.X ) + +2. Build and install +- In a command prompt, execute setenv64.bat. +The command prompt should turn to a different color and print a message about targeting x64. +- Execute build64.bat +This will build the dlls and executables, copy them to org.eclipse.cdt.core.win32.x86_64\os\win32\x86_64 then clean the build directories. +Optionally, you can use nmake /f Makefile_x86_64.mk TARGET directly. Refer to Makefile_x86_64.mk for valid targets. diff --git a/core/org.eclipse.cdt.core.win32/library/build64.bat b/core/org.eclipse.cdt.core.win32/library/build64.bat index 8ec30651315..41201d443b6 100644 --- a/core/org.eclipse.cdt.core.win32/library/build64.bat +++ b/core/org.eclipse.cdt.core.win32/library/build64.bat @@ -1,12 +1,12 @@ -@rem *************************************************************************** -@rem Copyright (c) 2011 Marc-Andre Laperle and others. -@rem All rights reserved. This program and the accompanying materials -@rem are made available under the terms of the Eclipse Public License v1.0 -@rem which accompanies this distribution, and is available at -@rem http://www.eclipse.org/legal/epl-v10.html -@rem -@rem Contributors: -@rem Marc-Andre Laperle - initial API and implementation -@rem *************************************************************************** - +@rem *************************************************************************** +@rem Copyright (c) 2011 Marc-Andre Laperle and others. +@rem All rights reserved. This program and the accompanying materials +@rem are made available under the terms of the Eclipse Public License v1.0 +@rem which accompanies this distribution, and is available at +@rem http://www.eclipse.org/legal/epl-v10.html +@rem +@rem Contributors: +@rem Marc-Andre Laperle - initial API and implementation +@rem *************************************************************************** + nmake /f Makefile_x86_64.mk /NOLOGO install clean \ No newline at end of file diff --git a/core/org.eclipse.cdt.core.win32/library/cdt-win32.sln b/core/org.eclipse.cdt.core.win32/library/cdt-win32.sln index 5367a43acb8..01d10abe31e 100644 --- a/core/org.eclipse.cdt.core.win32/library/cdt-win32.sln +++ b/core/org.eclipse.cdt.core.win32/library/cdt-win32.sln @@ -1,33 +1,33 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 2013 -VisualStudioVersion = 12.0.31101.0 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "winreg", "winreg\winreg.vcxproj", "{4CA57EA3-42F2-4CC1-8E95-5C707A8E7363}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Mixed Platforms = Debug|Mixed Platforms - Debug|Win32 = Debug|Win32 - Debug|x64 = Debug|x64 - Release|Mixed Platforms = Release|Mixed Platforms - Release|Win32 = Release|Win32 - Release|x64 = Release|x64 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {4CA57EA3-42F2-4CC1-8E95-5C707A8E7363}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32 - {4CA57EA3-42F2-4CC1-8E95-5C707A8E7363}.Debug|Mixed Platforms.Build.0 = Debug|Win32 - {4CA57EA3-42F2-4CC1-8E95-5C707A8E7363}.Debug|Win32.ActiveCfg = Debug|Win32 - {4CA57EA3-42F2-4CC1-8E95-5C707A8E7363}.Debug|Win32.Build.0 = Debug|Win32 - {4CA57EA3-42F2-4CC1-8E95-5C707A8E7363}.Debug|x64.ActiveCfg = Debug|Win32 - {4CA57EA3-42F2-4CC1-8E95-5C707A8E7363}.Release|Mixed Platforms.ActiveCfg = Release|Win32 - {4CA57EA3-42F2-4CC1-8E95-5C707A8E7363}.Release|Mixed Platforms.Build.0 = Release|Win32 - {4CA57EA3-42F2-4CC1-8E95-5C707A8E7363}.Release|Win32.ActiveCfg = Release|Win32 - {4CA57EA3-42F2-4CC1-8E95-5C707A8E7363}.Release|Win32.Build.0 = Release|Win32 - {4CA57EA3-42F2-4CC1-8E95-5C707A8E7363}.Release|x64.ActiveCfg = Release|x64 - {4CA57EA3-42F2-4CC1-8E95-5C707A8E7363}.Release|x64.Build.0 = Release|x64 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 2013 +VisualStudioVersion = 12.0.31101.0 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "winreg", "winreg\winreg.vcxproj", "{4CA57EA3-42F2-4CC1-8E95-5C707A8E7363}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Mixed Platforms = Debug|Mixed Platforms + Debug|Win32 = Debug|Win32 + Debug|x64 = Debug|x64 + Release|Mixed Platforms = Release|Mixed Platforms + Release|Win32 = Release|Win32 + Release|x64 = Release|x64 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {4CA57EA3-42F2-4CC1-8E95-5C707A8E7363}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32 + {4CA57EA3-42F2-4CC1-8E95-5C707A8E7363}.Debug|Mixed Platforms.Build.0 = Debug|Win32 + {4CA57EA3-42F2-4CC1-8E95-5C707A8E7363}.Debug|Win32.ActiveCfg = Debug|Win32 + {4CA57EA3-42F2-4CC1-8E95-5C707A8E7363}.Debug|Win32.Build.0 = Debug|Win32 + {4CA57EA3-42F2-4CC1-8E95-5C707A8E7363}.Debug|x64.ActiveCfg = Debug|Win32 + {4CA57EA3-42F2-4CC1-8E95-5C707A8E7363}.Release|Mixed Platforms.ActiveCfg = Release|Win32 + {4CA57EA3-42F2-4CC1-8E95-5C707A8E7363}.Release|Mixed Platforms.Build.0 = Release|Win32 + {4CA57EA3-42F2-4CC1-8E95-5C707A8E7363}.Release|Win32.ActiveCfg = Release|Win32 + {4CA57EA3-42F2-4CC1-8E95-5C707A8E7363}.Release|Win32.Build.0 = Release|Win32 + {4CA57EA3-42F2-4CC1-8E95-5C707A8E7363}.Release|x64.ActiveCfg = Release|x64 + {4CA57EA3-42F2-4CC1-8E95-5C707A8E7363}.Release|x64.Build.0 = Release|x64 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/core/org.eclipse.cdt.core.win32/library/listtasks/StdAfx.cpp b/core/org.eclipse.cdt.core.win32/library/listtasks/StdAfx.cpp index ace4d4df66d..f231562921e 100644 --- a/core/org.eclipse.cdt.core.win32/library/listtasks/StdAfx.cpp +++ b/core/org.eclipse.cdt.core.win32/library/listtasks/StdAfx.cpp @@ -1,18 +1,18 @@ -/******************************************************************************* - * Copyright (c) 2002 - 2005 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 - *******************************************************************************/ -// stdafx.cpp : source file that includes just the standard includes -// ProcList.pch will be the pre-compiled header -// stdafx.obj will contain the pre-compiled type information - -#include "stdafx.h" - -// TODO: reference any additional headers you need in STDAFX.H -// and not in this file +/******************************************************************************* + * Copyright (c) 2002 - 2005 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 + *******************************************************************************/ +// stdafx.cpp : source file that includes just the standard includes +// ProcList.pch will be the pre-compiled header +// stdafx.obj will contain the pre-compiled type information + +#include "stdafx.h" + +// TODO: reference any additional headers you need in STDAFX.H +// and not in this file diff --git a/core/org.eclipse.cdt.core.win32/library/listtasks/StdAfx.h b/core/org.eclipse.cdt.core.win32/library/listtasks/StdAfx.h index 3eebdec8144..f51c2a6b60d 100644 --- a/core/org.eclipse.cdt.core.win32/library/listtasks/StdAfx.h +++ b/core/org.eclipse.cdt.core.win32/library/listtasks/StdAfx.h @@ -1,29 +1,29 @@ -/******************************************************************************* - * Copyright (c) 2002 - 2005 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 - *******************************************************************************/ -// stdafx.h : include file for standard system include files, -// or project specific include files that are used frequently, but -// are changed infrequently -// - -#if !defined(AFX_STDAFX_H__CB3B970F_AA1A_4B59_9F98_DDBEA28470AF__INCLUDED_) -#define AFX_STDAFX_H__CB3B970F_AA1A_4B59_9F98_DDBEA28470AF__INCLUDED_ - -#if _MSC_VER > 1000 -#pragma once -#endif // _MSC_VER > 1000 - - -// TODO: reference additional headers your program requires here - -//{{AFX_INSERT_LOCATION}} -// Microsoft Visual C++ will insert additional declarations immediately before the previous line. - -#endif // !defined(AFX_STDAFX_H__CB3B970F_AA1A_4B59_9F98_DDBEA28470AF__INCLUDED_) +/******************************************************************************* + * Copyright (c) 2002 - 2005 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 + *******************************************************************************/ +// stdafx.h : include file for standard system include files, +// or project specific include files that are used frequently, but +// are changed infrequently +// + +#if !defined(AFX_STDAFX_H__CB3B970F_AA1A_4B59_9F98_DDBEA28470AF__INCLUDED_) +#define AFX_STDAFX_H__CB3B970F_AA1A_4B59_9F98_DDBEA28470AF__INCLUDED_ + +#if _MSC_VER > 1000 +#pragma once +#endif // _MSC_VER > 1000 + + +// TODO: reference additional headers your program requires here + +//{{AFX_INSERT_LOCATION}} +// Microsoft Visual C++ will insert additional declarations immediately before the previous line. + +#endif // !defined(AFX_STDAFX_H__CB3B970F_AA1A_4B59_9F98_DDBEA28470AF__INCLUDED_) diff --git a/core/org.eclipse.cdt.core.win32/library/listtasks/listtasks.cpp b/core/org.eclipse.cdt.core.win32/library/listtasks/listtasks.cpp index c6a626c26d7..bdfc126abb1 100644 --- a/core/org.eclipse.cdt.core.win32/library/listtasks/listtasks.cpp +++ b/core/org.eclipse.cdt.core.win32/library/listtasks/listtasks.cpp @@ -1,346 +1,346 @@ -/******************************************************************************* - * Copyright (c) 2002, 2011 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 - *******************************************************************************/ -// ProcList.cpp : Defines the entry point for the console application. -// - -#include "stdafx.h" - -#include "listtasks.h" -#include -#include -#include -#include - -using namespace std; - -typedef struct -{ - DWORD dwPID ; - PROCENUMPROC lpProc ; - DWORD lParam ; - BOOL bEnd ; -} EnumInfoStruct ; - -BOOL WINAPI Enum16( DWORD dwThreadId, WORD hMod16, WORD hTask16, - PSZ pszModName, PSZ pszFileName, LPARAM lpUserDefined ) ; - -BOOL CALLBACK OutProcInfo( DWORD pid, WORD, LPSTR procName, LPARAM ) ; - -int main(int argc, char* argv[]) -{ - EnumProcs(OutProcInfo, 0); - return 0; -} - - - -/********************* -EnumProc.cpp -*********************/ - -// The EnumProcs function takes a pointer to a callback function -// that will be called once per process in the system providing -// process EXE filename and process ID. -// Callback function definition: -// BOOL CALLBACK Proc( DWORD dw, LPCSTR lpstr, LPARAM lParam ) ; -// -// lpProc -- Address of callback routine. -// -// lParam -- A user-defined LPARAM value to be passed to -// the callback routine. -BOOL WINAPI EnumProcs( PROCENUMPROC lpProc, LPARAM lParam ) -{ - OSVERSIONINFO osver ; - HINSTANCE hInstLib ; - HINSTANCE hInstLib2 ; - HANDLE hSnapShot ; - PROCESSENTRY32 procentry ; - BOOL bFlag ; - LPDWORD lpdwPIDs ; - DWORD dwSize, dwSize2, dwIndex ; - HMODULE hMod ; - HANDLE hProcess ; - char szFileName[ MAX_PATH ] ; - EnumInfoStruct sInfo ; - - // ToolHelp Function Pointers. - HANDLE (WINAPI *lpfCreateToolhelp32Snapshot)(DWORD,DWORD) ; - BOOL (WINAPI *lpfProcess32First)(HANDLE,LPPROCESSENTRY32) ; - BOOL (WINAPI *lpfProcess32Next)(HANDLE,LPPROCESSENTRY32) ; - - // PSAPI Function Pointers. - BOOL (WINAPI *lpfEnumProcesses)( DWORD *, DWORD cb, DWORD * ); - BOOL (WINAPI *lpfEnumProcessModules)( HANDLE, HMODULE *, - DWORD, LPDWORD ); - DWORD (WINAPI *lpfGetModuleFileNameEx)( HANDLE, HMODULE, - LPTSTR, DWORD ); - - // VDMDBG Function Pointers. - INT (WINAPI *lpfVDMEnumTaskWOWEx)( DWORD, - TASKENUMPROCEX fp, LPARAM ); - - - // Check to see if were running under Windows95 or - // Windows NT. - osver.dwOSVersionInfoSize = sizeof( osver ) ; - if( !GetVersionEx( &osver ) ) - { - return FALSE ; - } - - // If Windows NT: - if( osver.dwPlatformId == VER_PLATFORM_WIN32_NT ) - { - - // Load library and get the procedures explicitly. We do - // this so that we don't have to worry about modules using - // this code failing to load under Windows 95, because - // it can't resolve references to the PSAPI.DLL. - hInstLib = LoadLibraryA( "PSAPI.DLL" ) ; - if( hInstLib == NULL ) - return FALSE ; - - SYSTEM_INFO systemInfo; - - GetSystemInfo(&systemInfo); - bool isWin64 = systemInfo.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64; - - if(!isWin64) - { - hInstLib2 = LoadLibraryA( "VDMDBG.DLL" ) ; - if( hInstLib2 == NULL ) - return FALSE ; - } - - // Get procedure addresses. - lpfEnumProcesses = (BOOL(WINAPI *)(DWORD *,DWORD,DWORD*)) - GetProcAddress( hInstLib, "EnumProcesses" ) ; - lpfEnumProcessModules = (BOOL(WINAPI *)(HANDLE, HMODULE *, - DWORD, LPDWORD)) GetProcAddress( hInstLib, - "EnumProcessModules" ) ; - lpfGetModuleFileNameEx =(DWORD (WINAPI *)(HANDLE, HMODULE, - LPTSTR, DWORD )) GetProcAddress( hInstLib, - "GetModuleFileNameExA" ) ; - if(!isWin64) - { - lpfVDMEnumTaskWOWEx =(INT(WINAPI *)( DWORD, TASKENUMPROCEX, - LPARAM))GetProcAddress( hInstLib2, "VDMEnumTaskWOWEx" ); - } - if( lpfEnumProcesses == NULL || - lpfEnumProcessModules == NULL || - lpfGetModuleFileNameEx == NULL || - (!isWin64 && lpfVDMEnumTaskWOWEx == NULL)) - { - FreeLibrary( hInstLib ) ; - if(!isWin64) - { - FreeLibrary( hInstLib2 ) ; - } - return FALSE ; - } - - // Call the PSAPI function EnumProcesses to get all of the - // ProcID's currently in the system. - // NOTE: In the documentation, the third parameter of - // EnumProcesses is named cbNeeded, which implies that you - // can call the function once to find out how much space to - // allocate for a buffer and again to fill the buffer. - // This is not the case. The cbNeeded parameter returns - // the number of PIDs returned, so if your buffer size is - // zero cbNeeded returns zero. - // NOTE: The "HeapAlloc" loop here ensures that we - // actually allocate a buffer large enough for all the - // PIDs in the system. - dwSize2 = 256 * sizeof( DWORD ) ; - lpdwPIDs = NULL ; - do - { - if( lpdwPIDs ) - { - HeapFree( GetProcessHeap(), 0, lpdwPIDs ) ; - dwSize2 *= 2 ; - } - lpdwPIDs = (LPDWORD)HeapAlloc( GetProcessHeap(), 0, dwSize2 ); - if( lpdwPIDs == NULL ) - { - FreeLibrary( hInstLib ) ; - if(!isWin64) - { - FreeLibrary( hInstLib2 ) ; - } - return FALSE ; - } - if( !lpfEnumProcesses( lpdwPIDs, dwSize2, &dwSize ) ) - { - HeapFree( GetProcessHeap(), 0, lpdwPIDs ) ; - FreeLibrary( hInstLib ) ; - if(!isWin64) - { - FreeLibrary( hInstLib2 ) ; - } - return FALSE ; - } - }while( dwSize == dwSize2 ) ; - - // How many ProcID's did we get? - dwSize /= sizeof( DWORD ) ; - - // Loop through each ProcID. - for( dwIndex = 0 ; dwIndex < dwSize ; dwIndex++ ) - { - szFileName[0] = 0 ; - // Open the process (if we can... security does not - // permit every process in the system). - hProcess = OpenProcess( - PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, - FALSE, lpdwPIDs[ dwIndex ] ) ; - if( hProcess != NULL ) - { - // Here we call EnumProcessModules to get only the - // first module in the process this is important, - // because this will be the .EXE module for which we - // will retrieve the full path name in a second. - if( lpfEnumProcessModules( hProcess, &hMod, - sizeof( hMod ), &dwSize2 ) ) - { - // Get Full pathname: - if( !lpfGetModuleFileNameEx( hProcess, hMod, - szFileName, sizeof( szFileName ) ) ) - { - szFileName[0] = 0 ; - } - } - CloseHandle( hProcess ) ; - } - // Regardless of OpenProcess success or failure, we - // still call the enum func with the ProcID. - if(!lpProc( lpdwPIDs[dwIndex], 0, szFileName, lParam)) - break ; - - // Did we just bump into an NTVDM? - if(!isWin64 && _stricmp( szFileName+(strlen(szFileName)-9), - "NTVDM.EXE")==0) - { - // Fill in some info for the 16-bit enum proc. - sInfo.dwPID = lpdwPIDs[dwIndex] ; - sInfo.lpProc = lpProc ; - sInfo.lParam = lParam ; - sInfo.bEnd = FALSE ; - // Enum the 16-bit stuff. - lpfVDMEnumTaskWOWEx( lpdwPIDs[dwIndex], - (TASKENUMPROCEX) Enum16, - (LPARAM) &sInfo); - - // Did our main enum func say quit? - if(sInfo.bEnd) - break ; - } - } - - HeapFree( GetProcessHeap(), 0, lpdwPIDs ) ; - if(!isWin64) - { - FreeLibrary( hInstLib2 ) ; - } - - // If Windows 95: - }else if( osver.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS ) - { - - - hInstLib = LoadLibraryA( "Kernel32.DLL" ) ; - if( hInstLib == NULL ) - return FALSE ; - - // Get procedure addresses. - // We are linking to these functions of Kernel32 - // explicitly, because otherwise a module using - // this code would fail to load under Windows NT, - // which does not have the Toolhelp32 - // functions in the Kernel 32. - lpfCreateToolhelp32Snapshot= - (HANDLE(WINAPI *)(DWORD,DWORD)) - GetProcAddress( hInstLib, - "CreateToolhelp32Snapshot" ) ; - lpfProcess32First= - (BOOL(WINAPI *)(HANDLE,LPPROCESSENTRY32)) - GetProcAddress( hInstLib, "Process32First" ) ; - lpfProcess32Next= - (BOOL(WINAPI *)(HANDLE,LPPROCESSENTRY32)) - GetProcAddress( hInstLib, "Process32Next" ) ; - if( lpfProcess32Next == NULL || - lpfProcess32First == NULL || - lpfCreateToolhelp32Snapshot == NULL ) - { - FreeLibrary( hInstLib ) ; - return FALSE ; - } - - // Get a handle to a Toolhelp snapshot of the systems - // processes. - hSnapShot = lpfCreateToolhelp32Snapshot( - TH32CS_SNAPPROCESS, 0 ) ; - if( hSnapShot == INVALID_HANDLE_VALUE ) - { - FreeLibrary( hInstLib ) ; - return FALSE ; - } - - // Get the first process' information. - procentry.dwSize = sizeof(PROCESSENTRY32) ; - bFlag = lpfProcess32First( hSnapShot, &procentry ) ; - - // While there are processes, keep looping. - while( bFlag ) - { - // Call the enum func with the filename and ProcID. - if(lpProc( procentry.th32ProcessID, 0, - procentry.szExeFile, lParam )) - { - procentry.dwSize = sizeof(PROCESSENTRY32) ; - bFlag = lpfProcess32Next( hSnapShot, &procentry ); - }else - bFlag = FALSE ; - } - - - }else - return FALSE ; - - // Free the library. - FreeLibrary( hInstLib ) ; - - return TRUE ; -} - -BOOL WINAPI Enum16( DWORD dwThreadId, WORD hMod16, WORD hTask16, - PSZ pszModName, PSZ pszFileName, LPARAM lpUserDefined ) -{ - BOOL bRet ; - - EnumInfoStruct *psInfo = (EnumInfoStruct *)lpUserDefined ; - - bRet = psInfo->lpProc( psInfo->dwPID, hTask16, pszFileName, - psInfo->lParam ) ; - - if(!bRet) - { - psInfo->bEnd = TRUE ; - } - - return !bRet; -} - -BOOL CALLBACK OutProcInfo( DWORD pid, WORD, LPSTR procName, LPARAM ) -{ - cout << setw(10) << pid << '\t' << procName << '\n'; - return TRUE; -} +/******************************************************************************* + * Copyright (c) 2002, 2011 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 + *******************************************************************************/ +// ProcList.cpp : Defines the entry point for the console application. +// + +#include "stdafx.h" + +#include "listtasks.h" +#include +#include +#include +#include + +using namespace std; + +typedef struct +{ + DWORD dwPID ; + PROCENUMPROC lpProc ; + DWORD lParam ; + BOOL bEnd ; +} EnumInfoStruct ; + +BOOL WINAPI Enum16( DWORD dwThreadId, WORD hMod16, WORD hTask16, + PSZ pszModName, PSZ pszFileName, LPARAM lpUserDefined ) ; + +BOOL CALLBACK OutProcInfo( DWORD pid, WORD, LPSTR procName, LPARAM ) ; + +int main(int argc, char* argv[]) +{ + EnumProcs(OutProcInfo, 0); + return 0; +} + + + +/********************* +EnumProc.cpp +*********************/ + +// The EnumProcs function takes a pointer to a callback function +// that will be called once per process in the system providing +// process EXE filename and process ID. +// Callback function definition: +// BOOL CALLBACK Proc( DWORD dw, LPCSTR lpstr, LPARAM lParam ) ; +// +// lpProc -- Address of callback routine. +// +// lParam -- A user-defined LPARAM value to be passed to +// the callback routine. +BOOL WINAPI EnumProcs( PROCENUMPROC lpProc, LPARAM lParam ) +{ + OSVERSIONINFO osver ; + HINSTANCE hInstLib ; + HINSTANCE hInstLib2 ; + HANDLE hSnapShot ; + PROCESSENTRY32 procentry ; + BOOL bFlag ; + LPDWORD lpdwPIDs ; + DWORD dwSize, dwSize2, dwIndex ; + HMODULE hMod ; + HANDLE hProcess ; + char szFileName[ MAX_PATH ] ; + EnumInfoStruct sInfo ; + + // ToolHelp Function Pointers. + HANDLE (WINAPI *lpfCreateToolhelp32Snapshot)(DWORD,DWORD) ; + BOOL (WINAPI *lpfProcess32First)(HANDLE,LPPROCESSENTRY32) ; + BOOL (WINAPI *lpfProcess32Next)(HANDLE,LPPROCESSENTRY32) ; + + // PSAPI Function Pointers. + BOOL (WINAPI *lpfEnumProcesses)( DWORD *, DWORD cb, DWORD * ); + BOOL (WINAPI *lpfEnumProcessModules)( HANDLE, HMODULE *, + DWORD, LPDWORD ); + DWORD (WINAPI *lpfGetModuleFileNameEx)( HANDLE, HMODULE, + LPTSTR, DWORD ); + + // VDMDBG Function Pointers. + INT (WINAPI *lpfVDMEnumTaskWOWEx)( DWORD, + TASKENUMPROCEX fp, LPARAM ); + + + // Check to see if were running under Windows95 or + // Windows NT. + osver.dwOSVersionInfoSize = sizeof( osver ) ; + if( !GetVersionEx( &osver ) ) + { + return FALSE ; + } + + // If Windows NT: + if( osver.dwPlatformId == VER_PLATFORM_WIN32_NT ) + { + + // Load library and get the procedures explicitly. We do + // this so that we don't have to worry about modules using + // this code failing to load under Windows 95, because + // it can't resolve references to the PSAPI.DLL. + hInstLib = LoadLibraryA( "PSAPI.DLL" ) ; + if( hInstLib == NULL ) + return FALSE ; + + SYSTEM_INFO systemInfo; + + GetSystemInfo(&systemInfo); + bool isWin64 = systemInfo.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64; + + if(!isWin64) + { + hInstLib2 = LoadLibraryA( "VDMDBG.DLL" ) ; + if( hInstLib2 == NULL ) + return FALSE ; + } + + // Get procedure addresses. + lpfEnumProcesses = (BOOL(WINAPI *)(DWORD *,DWORD,DWORD*)) + GetProcAddress( hInstLib, "EnumProcesses" ) ; + lpfEnumProcessModules = (BOOL(WINAPI *)(HANDLE, HMODULE *, + DWORD, LPDWORD)) GetProcAddress( hInstLib, + "EnumProcessModules" ) ; + lpfGetModuleFileNameEx =(DWORD (WINAPI *)(HANDLE, HMODULE, + LPTSTR, DWORD )) GetProcAddress( hInstLib, + "GetModuleFileNameExA" ) ; + if(!isWin64) + { + lpfVDMEnumTaskWOWEx =(INT(WINAPI *)( DWORD, TASKENUMPROCEX, + LPARAM))GetProcAddress( hInstLib2, "VDMEnumTaskWOWEx" ); + } + if( lpfEnumProcesses == NULL || + lpfEnumProcessModules == NULL || + lpfGetModuleFileNameEx == NULL || + (!isWin64 && lpfVDMEnumTaskWOWEx == NULL)) + { + FreeLibrary( hInstLib ) ; + if(!isWin64) + { + FreeLibrary( hInstLib2 ) ; + } + return FALSE ; + } + + // Call the PSAPI function EnumProcesses to get all of the + // ProcID's currently in the system. + // NOTE: In the documentation, the third parameter of + // EnumProcesses is named cbNeeded, which implies that you + // can call the function once to find out how much space to + // allocate for a buffer and again to fill the buffer. + // This is not the case. The cbNeeded parameter returns + // the number of PIDs returned, so if your buffer size is + // zero cbNeeded returns zero. + // NOTE: The "HeapAlloc" loop here ensures that we + // actually allocate a buffer large enough for all the + // PIDs in the system. + dwSize2 = 256 * sizeof( DWORD ) ; + lpdwPIDs = NULL ; + do + { + if( lpdwPIDs ) + { + HeapFree( GetProcessHeap(), 0, lpdwPIDs ) ; + dwSize2 *= 2 ; + } + lpdwPIDs = (LPDWORD)HeapAlloc( GetProcessHeap(), 0, dwSize2 ); + if( lpdwPIDs == NULL ) + { + FreeLibrary( hInstLib ) ; + if(!isWin64) + { + FreeLibrary( hInstLib2 ) ; + } + return FALSE ; + } + if( !lpfEnumProcesses( lpdwPIDs, dwSize2, &dwSize ) ) + { + HeapFree( GetProcessHeap(), 0, lpdwPIDs ) ; + FreeLibrary( hInstLib ) ; + if(!isWin64) + { + FreeLibrary( hInstLib2 ) ; + } + return FALSE ; + } + }while( dwSize == dwSize2 ) ; + + // How many ProcID's did we get? + dwSize /= sizeof( DWORD ) ; + + // Loop through each ProcID. + for( dwIndex = 0 ; dwIndex < dwSize ; dwIndex++ ) + { + szFileName[0] = 0 ; + // Open the process (if we can... security does not + // permit every process in the system). + hProcess = OpenProcess( + PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, + FALSE, lpdwPIDs[ dwIndex ] ) ; + if( hProcess != NULL ) + { + // Here we call EnumProcessModules to get only the + // first module in the process this is important, + // because this will be the .EXE module for which we + // will retrieve the full path name in a second. + if( lpfEnumProcessModules( hProcess, &hMod, + sizeof( hMod ), &dwSize2 ) ) + { + // Get Full pathname: + if( !lpfGetModuleFileNameEx( hProcess, hMod, + szFileName, sizeof( szFileName ) ) ) + { + szFileName[0] = 0 ; + } + } + CloseHandle( hProcess ) ; + } + // Regardless of OpenProcess success or failure, we + // still call the enum func with the ProcID. + if(!lpProc( lpdwPIDs[dwIndex], 0, szFileName, lParam)) + break ; + + // Did we just bump into an NTVDM? + if(!isWin64 && _stricmp( szFileName+(strlen(szFileName)-9), + "NTVDM.EXE")==0) + { + // Fill in some info for the 16-bit enum proc. + sInfo.dwPID = lpdwPIDs[dwIndex] ; + sInfo.lpProc = lpProc ; + sInfo.lParam = lParam ; + sInfo.bEnd = FALSE ; + // Enum the 16-bit stuff. + lpfVDMEnumTaskWOWEx( lpdwPIDs[dwIndex], + (TASKENUMPROCEX) Enum16, + (LPARAM) &sInfo); + + // Did our main enum func say quit? + if(sInfo.bEnd) + break ; + } + } + + HeapFree( GetProcessHeap(), 0, lpdwPIDs ) ; + if(!isWin64) + { + FreeLibrary( hInstLib2 ) ; + } + + // If Windows 95: + }else if( osver.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS ) + { + + + hInstLib = LoadLibraryA( "Kernel32.DLL" ) ; + if( hInstLib == NULL ) + return FALSE ; + + // Get procedure addresses. + // We are linking to these functions of Kernel32 + // explicitly, because otherwise a module using + // this code would fail to load under Windows NT, + // which does not have the Toolhelp32 + // functions in the Kernel 32. + lpfCreateToolhelp32Snapshot= + (HANDLE(WINAPI *)(DWORD,DWORD)) + GetProcAddress( hInstLib, + "CreateToolhelp32Snapshot" ) ; + lpfProcess32First= + (BOOL(WINAPI *)(HANDLE,LPPROCESSENTRY32)) + GetProcAddress( hInstLib, "Process32First" ) ; + lpfProcess32Next= + (BOOL(WINAPI *)(HANDLE,LPPROCESSENTRY32)) + GetProcAddress( hInstLib, "Process32Next" ) ; + if( lpfProcess32Next == NULL || + lpfProcess32First == NULL || + lpfCreateToolhelp32Snapshot == NULL ) + { + FreeLibrary( hInstLib ) ; + return FALSE ; + } + + // Get a handle to a Toolhelp snapshot of the systems + // processes. + hSnapShot = lpfCreateToolhelp32Snapshot( + TH32CS_SNAPPROCESS, 0 ) ; + if( hSnapShot == INVALID_HANDLE_VALUE ) + { + FreeLibrary( hInstLib ) ; + return FALSE ; + } + + // Get the first process' information. + procentry.dwSize = sizeof(PROCESSENTRY32) ; + bFlag = lpfProcess32First( hSnapShot, &procentry ) ; + + // While there are processes, keep looping. + while( bFlag ) + { + // Call the enum func with the filename and ProcID. + if(lpProc( procentry.th32ProcessID, 0, + procentry.szExeFile, lParam )) + { + procentry.dwSize = sizeof(PROCESSENTRY32) ; + bFlag = lpfProcess32Next( hSnapShot, &procentry ); + }else + bFlag = FALSE ; + } + + + }else + return FALSE ; + + // Free the library. + FreeLibrary( hInstLib ) ; + + return TRUE ; +} + +BOOL WINAPI Enum16( DWORD dwThreadId, WORD hMod16, WORD hTask16, + PSZ pszModName, PSZ pszFileName, LPARAM lpUserDefined ) +{ + BOOL bRet ; + + EnumInfoStruct *psInfo = (EnumInfoStruct *)lpUserDefined ; + + bRet = psInfo->lpProc( psInfo->dwPID, hTask16, pszFileName, + psInfo->lParam ) ; + + if(!bRet) + { + psInfo->bEnd = TRUE ; + } + + return !bRet; +} + +BOOL CALLBACK OutProcInfo( DWORD pid, WORD, LPSTR procName, LPARAM ) +{ + cout << setw(10) << pid << '\t' << procName << '\n'; + return TRUE; +} diff --git a/core/org.eclipse.cdt.core.win32/library/listtasks/listtasks.dsp b/core/org.eclipse.cdt.core.win32/library/listtasks/listtasks.dsp index d14d3c49bc1..da100f1a4e5 100644 --- a/core/org.eclipse.cdt.core.win32/library/listtasks/listtasks.dsp +++ b/core/org.eclipse.cdt.core.win32/library/listtasks/listtasks.dsp @@ -1,117 +1,117 @@ -# Microsoft Developer Studio Project File - Name="listtasks" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Console Application" 0x0103 - -CFG=listtasks - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "listtasks.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "listtasks.mak" CFG="listtasks - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "listtasks - Win32 Release" (based on "Win32 (x86) Console Application") -!MESSAGE "listtasks - Win32 Debug" (based on "Win32 (x86) Console Application") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -RSC=rc.exe - -!IF "$(CFG)" == "listtasks - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /Yu"stdafx.h" /FD /c -# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /Yu"stdafx.h" /FD /c -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 - -!ELSEIF "$(CFG)" == "listtasks - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /Yu"stdafx.h" /FD /GZ /c -# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /Yu"stdafx.h" /FD /GZ /c -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept - -!ENDIF - -# Begin Target - -# Name "listtasks - Win32 Release" -# Name "listtasks - Win32 Debug" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Source File - -SOURCE=.\listtasks.cpp -# End Source File -# Begin Source File - -SOURCE=.\StdAfx.cpp -# ADD CPP /Yc"stdafx.h" -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# Begin Source File - -SOURCE=.\listtasks.h -# End Source File -# Begin Source File - -SOURCE=.\StdAfx.h -# End Source File -# End Group -# Begin Group "Resource Files" - -# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" -# End Group -# Begin Source File - -SOURCE=.\ReadMe.txt -# End Source File -# End Target -# End Project +# Microsoft Developer Studio Project File - Name="listtasks" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 +# ** DO NOT EDIT ** + +# TARGTYPE "Win32 (x86) Console Application" 0x0103 + +CFG=listtasks - Win32 Debug +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "listtasks.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "listtasks.mak" CFG="listtasks - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "listtasks - Win32 Release" (based on "Win32 (x86) Console Application") +!MESSAGE "listtasks - Win32 Debug" (based on "Win32 (x86) Console Application") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +# PROP Scc_ProjName "" +# PROP Scc_LocalPath "" +CPP=cl.exe +RSC=rc.exe + +!IF "$(CFG)" == "listtasks - Win32 Release" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 0 +# PROP BASE Output_Dir "Release" +# PROP BASE Intermediate_Dir "Release" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 0 +# PROP Output_Dir "Release" +# PROP Intermediate_Dir "Release" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /Yu"stdafx.h" /FD /c +# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /Yu"stdafx.h" /FD /c +# ADD BASE RSC /l 0x409 /d "NDEBUG" +# ADD RSC /l 0x409 /d "NDEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 + +!ELSEIF "$(CFG)" == "listtasks - Win32 Debug" + +# PROP BASE Use_MFC 0 +# PROP BASE Use_Debug_Libraries 1 +# PROP BASE Output_Dir "Debug" +# PROP BASE Intermediate_Dir "Debug" +# PROP BASE Target_Dir "" +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "Debug" +# PROP Intermediate_Dir "Debug" +# PROP Target_Dir "" +# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /Yu"stdafx.h" /FD /GZ /c +# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /Yu"stdafx.h" /FD /GZ /c +# ADD BASE RSC /l 0x409 /d "_DEBUG" +# ADD RSC /l 0x409 /d "_DEBUG" +BSC32=bscmake.exe +# ADD BASE BSC32 /nologo +# ADD BSC32 /nologo +LINK32=link.exe +# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept +# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept + +!ENDIF + +# Begin Target + +# Name "listtasks - Win32 Release" +# Name "listtasks - Win32 Debug" +# Begin Group "Source Files" + +# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" +# Begin Source File + +SOURCE=.\listtasks.cpp +# End Source File +# Begin Source File + +SOURCE=.\StdAfx.cpp +# ADD CPP /Yc"stdafx.h" +# End Source File +# End Group +# Begin Group "Header Files" + +# PROP Default_Filter "h;hpp;hxx;hm;inl" +# Begin Source File + +SOURCE=.\listtasks.h +# End Source File +# Begin Source File + +SOURCE=.\StdAfx.h +# End Source File +# End Group +# Begin Group "Resource Files" + +# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" +# End Group +# Begin Source File + +SOURCE=.\ReadMe.txt +# End Source File +# End Target +# End Project diff --git a/core/org.eclipse.cdt.core.win32/library/listtasks/listtasks.dsw b/core/org.eclipse.cdt.core.win32/library/listtasks/listtasks.dsw index 329bd2f44e0..914555a178f 100644 --- a/core/org.eclipse.cdt.core.win32/library/listtasks/listtasks.dsw +++ b/core/org.eclipse.cdt.core.win32/library/listtasks/listtasks.dsw @@ -1,29 +1,29 @@ -Microsoft Developer Studio Workspace File, Format Version 6.00 -# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! - -############################################################################### - -Project: "listtasks"=.\listtasks.dsp - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Global: - -Package=<5> -{{{ -}}} - -Package=<3> -{{{ -}}} - -############################################################################### - +Microsoft Developer Studio Workspace File, Format Version 6.00 +# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! + +############################################################################### + +Project: "listtasks"=.\listtasks.dsp - Package Owner=<4> + +Package=<5> +{{{ +}}} + +Package=<4> +{{{ +}}} + +############################################################################### + +Global: + +Package=<5> +{{{ +}}} + +Package=<3> +{{{ +}}} + +############################################################################### + diff --git a/core/org.eclipse.cdt.core.win32/library/listtasks/listtasks.h b/core/org.eclipse.cdt.core.win32/library/listtasks/listtasks.h index ded4503f798..67cf3be123d 100644 --- a/core/org.eclipse.cdt.core.win32/library/listtasks/listtasks.h +++ b/core/org.eclipse.cdt.core.win32/library/listtasks/listtasks.h @@ -1,22 +1,22 @@ -/******************************************************************************* - * Copyright (c) 2002 - 2005 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 - *******************************************************************************/ -#include - -#ifndef __LISTTASKS_H -#define __LISTTASKS_H - -typedef BOOL (CALLBACK *PROCENUMPROC)( DWORD, WORD, LPSTR, - LPARAM ) ; - -BOOL WINAPI EnumProcs( PROCENUMPROC lpProc, LPARAM lParam ) ; - - +/******************************************************************************* + * Copyright (c) 2002 - 2005 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 + *******************************************************************************/ +#include + +#ifndef __LISTTASKS_H +#define __LISTTASKS_H + +typedef BOOL (CALLBACK *PROCENUMPROC)( DWORD, WORD, LPSTR, + LPARAM ) ; + +BOOL WINAPI EnumProcs( PROCENUMPROC lpProc, LPARAM lParam ) ; + + #endif \ No newline at end of file diff --git a/core/org.eclipse.cdt.core.win32/library/pty/jni/include/PTY.h b/core/org.eclipse.cdt.core.win32/library/pty/jni/include/PTY.h index 5c80c5793c8..d73d5c00e16 100644 --- a/core/org.eclipse.cdt.core.win32/library/pty/jni/include/PTY.h +++ b/core/org.eclipse.cdt.core.win32/library/pty/jni/include/PTY.h @@ -1,45 +1,45 @@ -/* DO NOT EDIT THIS FILE - it is machine generated */ -#include -/* Header for class org_eclipse_cdt_utils_pty_PTY */ - -#ifndef _Included_org_eclipse_cdt_utils_pty_PTY -#define _Included_org_eclipse_cdt_utils_pty_PTY -#ifdef __cplusplus -extern "C" { -#endif -/* - * Class: org_eclipse_cdt_utils_pty_PTY - * Method: openMaster - * Signature: (Z)Ljava/lang/String; - */ -JNIEXPORT jstring JNICALL Java_org_eclipse_cdt_utils_pty_PTY_openMaster - (JNIEnv *, jobject, jboolean); - -/* - * Class: org_eclipse_cdt_utils_pty_PTY - * Method: change_window_size - * Signature: (III)I - */ -JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_pty_PTY_change_1window_1size - (JNIEnv *, jobject, jint, jint, jint); - -/* - * Class: org_eclipse_cdt_utils_pty_PTY - * Method: exec2 - * Signature: ([Ljava/lang/String;[Ljava/lang/String;Ljava/lang/String;[ILjava/lang/String;IZ)I - */ -JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_pty_PTY_exec2 - (JNIEnv *, jobject, jobjectArray, jobjectArray, jstring, jintArray, jstring, jint, jboolean); - -/* - * Class: org_eclipse_cdt_utils_pty_PTY - * Method: waitFor - * Signature: (II)I - */ -JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_pty_PTY_waitFor - (JNIEnv *, jobject, jint, jint); - -#ifdef __cplusplus -} -#endif -#endif +/* DO NOT EDIT THIS FILE - it is machine generated */ +#include +/* Header for class org_eclipse_cdt_utils_pty_PTY */ + +#ifndef _Included_org_eclipse_cdt_utils_pty_PTY +#define _Included_org_eclipse_cdt_utils_pty_PTY +#ifdef __cplusplus +extern "C" { +#endif +/* + * Class: org_eclipse_cdt_utils_pty_PTY + * Method: openMaster + * Signature: (Z)Ljava/lang/String; + */ +JNIEXPORT jstring JNICALL Java_org_eclipse_cdt_utils_pty_PTY_openMaster + (JNIEnv *, jobject, jboolean); + +/* + * Class: org_eclipse_cdt_utils_pty_PTY + * Method: change_window_size + * Signature: (III)I + */ +JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_pty_PTY_change_1window_1size + (JNIEnv *, jobject, jint, jint, jint); + +/* + * Class: org_eclipse_cdt_utils_pty_PTY + * Method: exec2 + * Signature: ([Ljava/lang/String;[Ljava/lang/String;Ljava/lang/String;[ILjava/lang/String;IZ)I + */ +JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_pty_PTY_exec2 + (JNIEnv *, jobject, jobjectArray, jobjectArray, jstring, jintArray, jstring, jint, jboolean); + +/* + * Class: org_eclipse_cdt_utils_pty_PTY + * Method: waitFor + * Signature: (II)I + */ +JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_pty_PTY_waitFor + (JNIEnv *, jobject, jint, jint); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/core/org.eclipse.cdt.core.win32/library/pty/jni/include/PTYInputStream.h b/core/org.eclipse.cdt.core.win32/library/pty/jni/include/PTYInputStream.h index 86cd5bdd240..7767be6bd8c 100644 --- a/core/org.eclipse.cdt.core.win32/library/pty/jni/include/PTYInputStream.h +++ b/core/org.eclipse.cdt.core.win32/library/pty/jni/include/PTYInputStream.h @@ -1,31 +1,31 @@ -/* DO NOT EDIT THIS FILE - it is machine generated */ -#include -/* Header for class org_eclipse_cdt_utils_pty_PTYInputStream */ - -#ifndef _Included_org_eclipse_cdt_utils_pty_PTYInputStream -#define _Included_org_eclipse_cdt_utils_pty_PTYInputStream -#ifdef __cplusplus -extern "C" { -#endif -#undef org_eclipse_cdt_utils_pty_PTYInputStream_MAX_SKIP_BUFFER_SIZE -#define org_eclipse_cdt_utils_pty_PTYInputStream_MAX_SKIP_BUFFER_SIZE 2048L -/* - * Class: org_eclipse_cdt_utils_pty_PTYInputStream - * Method: read0 - * Signature: (I[BI)I - */ -JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_pty_PTYInputStream_read0 - (JNIEnv *, jobject, jint, jbyteArray, jint); - -/* - * Class: org_eclipse_cdt_utils_pty_PTYInputStream - * Method: close0 - * Signature: (I)I - */ -JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_pty_PTYInputStream_close0 - (JNIEnv *, jobject, jint); - -#ifdef __cplusplus -} -#endif -#endif +/* DO NOT EDIT THIS FILE - it is machine generated */ +#include +/* Header for class org_eclipse_cdt_utils_pty_PTYInputStream */ + +#ifndef _Included_org_eclipse_cdt_utils_pty_PTYInputStream +#define _Included_org_eclipse_cdt_utils_pty_PTYInputStream +#ifdef __cplusplus +extern "C" { +#endif +#undef org_eclipse_cdt_utils_pty_PTYInputStream_MAX_SKIP_BUFFER_SIZE +#define org_eclipse_cdt_utils_pty_PTYInputStream_MAX_SKIP_BUFFER_SIZE 2048L +/* + * Class: org_eclipse_cdt_utils_pty_PTYInputStream + * Method: read0 + * Signature: (I[BI)I + */ +JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_pty_PTYInputStream_read0 + (JNIEnv *, jobject, jint, jbyteArray, jint); + +/* + * Class: org_eclipse_cdt_utils_pty_PTYInputStream + * Method: close0 + * Signature: (I)I + */ +JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_pty_PTYInputStream_close0 + (JNIEnv *, jobject, jint); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/core/org.eclipse.cdt.core.win32/library/pty/jni/include/PTYOutputStream.h b/core/org.eclipse.cdt.core.win32/library/pty/jni/include/PTYOutputStream.h index 108ef248d8c..fb28491060e 100644 --- a/core/org.eclipse.cdt.core.win32/library/pty/jni/include/PTYOutputStream.h +++ b/core/org.eclipse.cdt.core.win32/library/pty/jni/include/PTYOutputStream.h @@ -1,29 +1,29 @@ -/* DO NOT EDIT THIS FILE - it is machine generated */ -#include -/* Header for class org_eclipse_cdt_utils_pty_PTYOutputStream */ - -#ifndef _Included_org_eclipse_cdt_utils_pty_PTYOutputStream -#define _Included_org_eclipse_cdt_utils_pty_PTYOutputStream -#ifdef __cplusplus -extern "C" { -#endif -/* - * Class: org_eclipse_cdt_utils_pty_PTYOutputStream - * Method: write0 - * Signature: (I[BI)I - */ -JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_pty_PTYOutputStream_write0 - (JNIEnv *, jobject, jint, jbyteArray, jint); - -/* - * Class: org_eclipse_cdt_utils_pty_PTYOutputStream - * Method: close0 - * Signature: (I)I - */ -JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_pty_PTYOutputStream_close0 - (JNIEnv *, jobject, jint); - -#ifdef __cplusplus -} -#endif -#endif +/* DO NOT EDIT THIS FILE - it is machine generated */ +#include +/* Header for class org_eclipse_cdt_utils_pty_PTYOutputStream */ + +#ifndef _Included_org_eclipse_cdt_utils_pty_PTYOutputStream +#define _Included_org_eclipse_cdt_utils_pty_PTYOutputStream +#ifdef __cplusplus +extern "C" { +#endif +/* + * Class: org_eclipse_cdt_utils_pty_PTYOutputStream + * Method: write0 + * Signature: (I[BI)I + */ +JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_pty_PTYOutputStream_write0 + (JNIEnv *, jobject, jint, jbyteArray, jint); + +/* + * Class: org_eclipse_cdt_utils_pty_PTYOutputStream + * Method: close0 + * Signature: (I)I + */ +JNIEXPORT jint JNICALL Java_org_eclipse_cdt_utils_pty_PTYOutputStream_close0 + (JNIEnv *, jobject, jint); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/core/org.eclipse.cdt.core.win32/library/pty/pty.sln b/core/org.eclipse.cdt.core.win32/library/pty/pty.sln index bd82345255b..220c281aade 100644 --- a/core/org.eclipse.cdt.core.win32/library/pty/pty.sln +++ b/core/org.eclipse.cdt.core.win32/library/pty/pty.sln @@ -1,46 +1,46 @@ - -Microsoft Visual Studio Solution File, Format Version 11.00 -# Visual C++ Express 2010 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pty", "pty.vcxproj", "{5589D515-1C56-4641-97CF-3C4561109258}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "winpty", "winpty.vcxproj", "{D7BFF73A-A86A-47FF-AD2B-CC2EFCAD5ABD}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "winpty-agent", "winpty-agent.vcxproj", "{E7A42398-12E7-4BC1-B72B-5D62B71E9816}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Win32 = Debug|Win32 - Debug|x64 = Debug|x64 - Release|Win32 = Release|Win32 - Release|x64 = Release|x64 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {5589D515-1C56-4641-97CF-3C4561109258}.Debug|Win32.ActiveCfg = Debug|Win32 - {5589D515-1C56-4641-97CF-3C4561109258}.Debug|Win32.Build.0 = Debug|Win32 - {5589D515-1C56-4641-97CF-3C4561109258}.Debug|x64.ActiveCfg = Debug|x64 - {5589D515-1C56-4641-97CF-3C4561109258}.Debug|x64.Build.0 = Debug|x64 - {5589D515-1C56-4641-97CF-3C4561109258}.Release|Win32.ActiveCfg = Release|Win32 - {5589D515-1C56-4641-97CF-3C4561109258}.Release|Win32.Build.0 = Release|Win32 - {5589D515-1C56-4641-97CF-3C4561109258}.Release|x64.ActiveCfg = Release|x64 - {5589D515-1C56-4641-97CF-3C4561109258}.Release|x64.Build.0 = Release|x64 - {D7BFF73A-A86A-47FF-AD2B-CC2EFCAD5ABD}.Debug|Win32.ActiveCfg = Debug|Win32 - {D7BFF73A-A86A-47FF-AD2B-CC2EFCAD5ABD}.Debug|Win32.Build.0 = Debug|Win32 - {D7BFF73A-A86A-47FF-AD2B-CC2EFCAD5ABD}.Debug|x64.ActiveCfg = Debug|x64 - {D7BFF73A-A86A-47FF-AD2B-CC2EFCAD5ABD}.Debug|x64.Build.0 = Debug|x64 - {D7BFF73A-A86A-47FF-AD2B-CC2EFCAD5ABD}.Release|Win32.ActiveCfg = Release|Win32 - {D7BFF73A-A86A-47FF-AD2B-CC2EFCAD5ABD}.Release|Win32.Build.0 = Release|Win32 - {D7BFF73A-A86A-47FF-AD2B-CC2EFCAD5ABD}.Release|x64.ActiveCfg = Release|x64 - {D7BFF73A-A86A-47FF-AD2B-CC2EFCAD5ABD}.Release|x64.Build.0 = Release|x64 - {E7A42398-12E7-4BC1-B72B-5D62B71E9816}.Debug|Win32.ActiveCfg = Debug|Win32 - {E7A42398-12E7-4BC1-B72B-5D62B71E9816}.Debug|Win32.Build.0 = Debug|Win32 - {E7A42398-12E7-4BC1-B72B-5D62B71E9816}.Debug|x64.ActiveCfg = Debug|x64 - {E7A42398-12E7-4BC1-B72B-5D62B71E9816}.Debug|x64.Build.0 = Debug|x64 - {E7A42398-12E7-4BC1-B72B-5D62B71E9816}.Release|Win32.ActiveCfg = Release|Win32 - {E7A42398-12E7-4BC1-B72B-5D62B71E9816}.Release|Win32.Build.0 = Release|Win32 - {E7A42398-12E7-4BC1-B72B-5D62B71E9816}.Release|x64.ActiveCfg = Release|x64 - {E7A42398-12E7-4BC1-B72B-5D62B71E9816}.Release|x64.Build.0 = Release|x64 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal + +Microsoft Visual Studio Solution File, Format Version 11.00 +# Visual C++ Express 2010 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pty", "pty.vcxproj", "{5589D515-1C56-4641-97CF-3C4561109258}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "winpty", "winpty.vcxproj", "{D7BFF73A-A86A-47FF-AD2B-CC2EFCAD5ABD}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "winpty-agent", "winpty-agent.vcxproj", "{E7A42398-12E7-4BC1-B72B-5D62B71E9816}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + Debug|x64 = Debug|x64 + Release|Win32 = Release|Win32 + Release|x64 = Release|x64 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {5589D515-1C56-4641-97CF-3C4561109258}.Debug|Win32.ActiveCfg = Debug|Win32 + {5589D515-1C56-4641-97CF-3C4561109258}.Debug|Win32.Build.0 = Debug|Win32 + {5589D515-1C56-4641-97CF-3C4561109258}.Debug|x64.ActiveCfg = Debug|x64 + {5589D515-1C56-4641-97CF-3C4561109258}.Debug|x64.Build.0 = Debug|x64 + {5589D515-1C56-4641-97CF-3C4561109258}.Release|Win32.ActiveCfg = Release|Win32 + {5589D515-1C56-4641-97CF-3C4561109258}.Release|Win32.Build.0 = Release|Win32 + {5589D515-1C56-4641-97CF-3C4561109258}.Release|x64.ActiveCfg = Release|x64 + {5589D515-1C56-4641-97CF-3C4561109258}.Release|x64.Build.0 = Release|x64 + {D7BFF73A-A86A-47FF-AD2B-CC2EFCAD5ABD}.Debug|Win32.ActiveCfg = Debug|Win32 + {D7BFF73A-A86A-47FF-AD2B-CC2EFCAD5ABD}.Debug|Win32.Build.0 = Debug|Win32 + {D7BFF73A-A86A-47FF-AD2B-CC2EFCAD5ABD}.Debug|x64.ActiveCfg = Debug|x64 + {D7BFF73A-A86A-47FF-AD2B-CC2EFCAD5ABD}.Debug|x64.Build.0 = Debug|x64 + {D7BFF73A-A86A-47FF-AD2B-CC2EFCAD5ABD}.Release|Win32.ActiveCfg = Release|Win32 + {D7BFF73A-A86A-47FF-AD2B-CC2EFCAD5ABD}.Release|Win32.Build.0 = Release|Win32 + {D7BFF73A-A86A-47FF-AD2B-CC2EFCAD5ABD}.Release|x64.ActiveCfg = Release|x64 + {D7BFF73A-A86A-47FF-AD2B-CC2EFCAD5ABD}.Release|x64.Build.0 = Release|x64 + {E7A42398-12E7-4BC1-B72B-5D62B71E9816}.Debug|Win32.ActiveCfg = Debug|Win32 + {E7A42398-12E7-4BC1-B72B-5D62B71E9816}.Debug|Win32.Build.0 = Debug|Win32 + {E7A42398-12E7-4BC1-B72B-5D62B71E9816}.Debug|x64.ActiveCfg = Debug|x64 + {E7A42398-12E7-4BC1-B72B-5D62B71E9816}.Debug|x64.Build.0 = Debug|x64 + {E7A42398-12E7-4BC1-B72B-5D62B71E9816}.Release|Win32.ActiveCfg = Release|Win32 + {E7A42398-12E7-4BC1-B72B-5D62B71E9816}.Release|Win32.Build.0 = Release|Win32 + {E7A42398-12E7-4BC1-B72B-5D62B71E9816}.Release|x64.ActiveCfg = Release|x64 + {E7A42398-12E7-4BC1-B72B-5D62B71E9816}.Release|x64.Build.0 = Release|x64 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/core/org.eclipse.cdt.core.win32/library/pty/pty.vcxproj b/core/org.eclipse.cdt.core.win32/library/pty/pty.vcxproj index 29311ce2b06..7d526ce88b1 100644 --- a/core/org.eclipse.cdt.core.win32/library/pty/pty.vcxproj +++ b/core/org.eclipse.cdt.core.win32/library/pty/pty.vcxproj @@ -1,177 +1,177 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - {5589D515-1C56-4641-97CF-3C4561109258} - Win32Proj - pty - - - - DynamicLibrary - true - Unicode - Windows7.1SDK - - - DynamicLibrary - true - Unicode - Windows7.1SDK - - - DynamicLibrary - false - true - Unicode - Windows7.1SDK - - - DynamicLibrary - false - true - Unicode - Windows7.1SDK - - - - - - - - - - - - - - - - - - - true - $(SolutionDir)$(Platform)\$(Configuration)\ - $(Platform)\$(Configuration)\$(ProjectName)\ - - - true - $(Platform)\$(Configuration)\$(ProjectName)\ - - - false - $(SolutionDir)$(Platform)\$(Configuration)\ - $(Platform)\$(Configuration)\$(ProjectName)\ - - - false - $(Platform)\$(Configuration)\$(ProjectName)\ - - - - NotUsing - Level3 - Disabled - WIN32;_DEBUG;_WINDOWS;_USRDLL;_SCL_SECURE_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) - ./jni/include;C:\NoScan\Apps\Java\jdk1.6.0_31\include;C:\NoScan\Apps\Java\jdk1.6.0_31\include\win32;..\winpty\include;.;%(AdditionalIncludeDirectories) - MultiThreadedDebug - - - Windows - true - DelayImp.lib;winpty.lib;%(AdditionalDependencies) - $(SolutionDir)$(Platform)\$(Configuration)\ - winpty.dll;%(DelayLoadDLLs) - - - - - NotUsing - Level3 - Disabled - _SCL_SECURE_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;WIN32;_DEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) - ./jni/include;C:\NoScan\Apps\Java\jdk1.6.0_31\include;C:\NoScan\Apps\Java\jdk1.6.0_31\include\win32;..\winpty\include;.;%(AdditionalIncludeDirectories) - MultiThreadedDebug - - - Windows - true - DelayImp.lib;winpty.lib;%(AdditionalDependencies) - $(SolutionDir)$(Platform)\$(Configuration)\ - winpty.dll;%(DelayLoadDLLs) - - - - - Level3 - - - MaxSpeed - true - true - WIN32;NDEBUG;_WINDOWS;_USRDLL;_SCL_SECURE_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) - ./jni/include;C:\NoScan\Apps\Java\jdk1.6.0_31\include;C:\NoScan\Apps\Java\jdk1.6.0_31\include\win32;..\winpty\include;.;%(AdditionalIncludeDirectories) - MultiThreaded - - - Windows - true - true - true - DelayImp.lib;winpty.lib;%(AdditionalDependencies) - $(SolutionDir)$(Platform)\$(Configuration)\ - winpty.dll;%(DelayLoadDLLs) - - - - - Level3 - - - MaxSpeed - true - true - _SCL_SECURE_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;WIN32;NDEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) - ./jni/include;C:\NoScan\Apps\Java\jdk1.6.0_31\include;C:\NoScan\Apps\Java\jdk1.6.0_31\include\win32;..\winpty\include;.;%(AdditionalIncludeDirectories) - MultiThreaded - - - Windows - true - true - true - DelayImp.lib;winpty.lib;%(AdditionalDependencies) - $(SolutionDir)$(Platform)\$(Configuration)\ - winpty.dll;%(DelayLoadDLLs) - - - - - - - - - - - - - - + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + {5589D515-1C56-4641-97CF-3C4561109258} + Win32Proj + pty + + + + DynamicLibrary + true + Unicode + Windows7.1SDK + + + DynamicLibrary + true + Unicode + Windows7.1SDK + + + DynamicLibrary + false + true + Unicode + Windows7.1SDK + + + DynamicLibrary + false + true + Unicode + Windows7.1SDK + + + + + + + + + + + + + + + + + + + true + $(SolutionDir)$(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\$(ProjectName)\ + + + true + $(Platform)\$(Configuration)\$(ProjectName)\ + + + false + $(SolutionDir)$(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\$(ProjectName)\ + + + false + $(Platform)\$(Configuration)\$(ProjectName)\ + + + + NotUsing + Level3 + Disabled + WIN32;_DEBUG;_WINDOWS;_USRDLL;_SCL_SECURE_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + ./jni/include;C:\NoScan\Apps\Java\jdk1.6.0_31\include;C:\NoScan\Apps\Java\jdk1.6.0_31\include\win32;..\winpty\include;.;%(AdditionalIncludeDirectories) + MultiThreadedDebug + + + Windows + true + DelayImp.lib;winpty.lib;%(AdditionalDependencies) + $(SolutionDir)$(Platform)\$(Configuration)\ + winpty.dll;%(DelayLoadDLLs) + + + + + NotUsing + Level3 + Disabled + _SCL_SECURE_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;WIN32;_DEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) + ./jni/include;C:\NoScan\Apps\Java\jdk1.6.0_31\include;C:\NoScan\Apps\Java\jdk1.6.0_31\include\win32;..\winpty\include;.;%(AdditionalIncludeDirectories) + MultiThreadedDebug + + + Windows + true + DelayImp.lib;winpty.lib;%(AdditionalDependencies) + $(SolutionDir)$(Platform)\$(Configuration)\ + winpty.dll;%(DelayLoadDLLs) + + + + + Level3 + + + MaxSpeed + true + true + WIN32;NDEBUG;_WINDOWS;_USRDLL;_SCL_SECURE_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + ./jni/include;C:\NoScan\Apps\Java\jdk1.6.0_31\include;C:\NoScan\Apps\Java\jdk1.6.0_31\include\win32;..\winpty\include;.;%(AdditionalIncludeDirectories) + MultiThreaded + + + Windows + true + true + true + DelayImp.lib;winpty.lib;%(AdditionalDependencies) + $(SolutionDir)$(Platform)\$(Configuration)\ + winpty.dll;%(DelayLoadDLLs) + + + + + Level3 + + + MaxSpeed + true + true + _SCL_SECURE_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;WIN32;NDEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) + ./jni/include;C:\NoScan\Apps\Java\jdk1.6.0_31\include;C:\NoScan\Apps\Java\jdk1.6.0_31\include\win32;..\winpty\include;.;%(AdditionalIncludeDirectories) + MultiThreaded + + + Windows + true + true + true + DelayImp.lib;winpty.lib;%(AdditionalDependencies) + $(SolutionDir)$(Platform)\$(Configuration)\ + winpty.dll;%(DelayLoadDLLs) + + + + + + + + + + + + + + \ No newline at end of file diff --git a/core/org.eclipse.cdt.core.win32/library/pty/pty.vcxproj.filters b/core/org.eclipse.cdt.core.win32/library/pty/pty.vcxproj.filters index 4c428115fd8..b92d3375bf7 100644 --- a/core/org.eclipse.cdt.core.win32/library/pty/pty.vcxproj.filters +++ b/core/org.eclipse.cdt.core.win32/library/pty/pty.vcxproj.filters @@ -1,30 +1,30 @@ - - - - - {679c3039-d4a8-48db-9a3b-33f73f3b44c0} - - - {b7f98685-8f42-40d2-bd2b-65bcbac17645} - - - - - include - - - include - - - include - - - - - src - - - src - - + + + + + {679c3039-d4a8-48db-9a3b-33f73f3b44c0} + + + {b7f98685-8f42-40d2-bd2b-65bcbac17645} + + + + + include + + + include + + + include + + + + + src + + + src + + \ No newline at end of file diff --git a/core/org.eclipse.cdt.core.win32/library/pty/winpty-agent.vcxproj b/core/org.eclipse.cdt.core.win32/library/pty/winpty-agent.vcxproj index 69e8ac3b008..0eef37a0900 100644 --- a/core/org.eclipse.cdt.core.win32/library/pty/winpty-agent.vcxproj +++ b/core/org.eclipse.cdt.core.win32/library/pty/winpty-agent.vcxproj @@ -1,185 +1,185 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - {E7A42398-12E7-4BC1-B72B-5D62B71E9816} - Win32Proj - winptyagent - - - - Application - true - Unicode - Windows7.1SDK - - - Application - true - Unicode - Windows7.1SDK - - - Application - false - true - Unicode - Windows7.1SDK - - - Application - false - true - Unicode - Windows7.1SDK - - - - - - - - - - - - - - - - - - - true - $(SolutionDir)$(Platform)\$(Configuration)\ - $(Platform)\$(Configuration)\$(ProjectName)\ - - - true - $(SolutionDir)$(Platform)\$(Configuration)\ - $(Platform)\$(Configuration)\$(ProjectName)\ - - - false - $(SolutionDir)$(Platform)\$(Configuration)\ - $(Platform)\$(Configuration)\$(ProjectName)\ - - - false - $(SolutionDir)$(Platform)\$(Configuration)\ - $(Platform)\$(Configuration)\$(ProjectName)\ - - - - NotUsing - Level3 - Disabled - WIN32;_WINDOWS;NOMINMAX;_DEBUG;_CONSOLE;_SCL_SECURE_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) - ..\winpty\include;%(AdditionalIncludeDirectories) - MultiThreadedDebug - - - Console - true - - - - - NotUsing - Level3 - Disabled - WIN32;_WINDOWS;NOMINMAX;_DEBUG;_CONSOLE;_SCL_SECURE_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) - ..\winpty\include;%(AdditionalIncludeDirectories) - MultiThreadedDebug - - - Console - true - - - - - Level3 - NotUsing - MaxSpeed - true - true - WIN32;_WINDOWS;NOMINMAX;NDEBUG;_CONSOLE;_SCL_SECURE_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) - ..\winpty\include;%(AdditionalIncludeDirectories) - MultiThreaded - - - Console - false - true - true - - - - - Level3 - NotUsing - MaxSpeed - true - true - WIN32;_WINDOWS;NOMINMAX;NDEBUG;_CONSOLE;_SCL_SECURE_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) - ..\winpty\include;%(AdditionalIncludeDirectories) - MultiThreaded - - - Console - false - true - true - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + {E7A42398-12E7-4BC1-B72B-5D62B71E9816} + Win32Proj + winptyagent + + + + Application + true + Unicode + Windows7.1SDK + + + Application + true + Unicode + Windows7.1SDK + + + Application + false + true + Unicode + Windows7.1SDK + + + Application + false + true + Unicode + Windows7.1SDK + + + + + + + + + + + + + + + + + + + true + $(SolutionDir)$(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\$(ProjectName)\ + + + true + $(SolutionDir)$(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\$(ProjectName)\ + + + false + $(SolutionDir)$(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\$(ProjectName)\ + + + false + $(SolutionDir)$(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\$(ProjectName)\ + + + + NotUsing + Level3 + Disabled + WIN32;_WINDOWS;NOMINMAX;_DEBUG;_CONSOLE;_SCL_SECURE_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + ..\winpty\include;%(AdditionalIncludeDirectories) + MultiThreadedDebug + + + Console + true + + + + + NotUsing + Level3 + Disabled + WIN32;_WINDOWS;NOMINMAX;_DEBUG;_CONSOLE;_SCL_SECURE_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + ..\winpty\include;%(AdditionalIncludeDirectories) + MultiThreadedDebug + + + Console + true + + + + + Level3 + NotUsing + MaxSpeed + true + true + WIN32;_WINDOWS;NOMINMAX;NDEBUG;_CONSOLE;_SCL_SECURE_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + ..\winpty\include;%(AdditionalIncludeDirectories) + MultiThreaded + + + Console + false + true + true + + + + + Level3 + NotUsing + MaxSpeed + true + true + WIN32;_WINDOWS;NOMINMAX;NDEBUG;_CONSOLE;_SCL_SECURE_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + ..\winpty\include;%(AdditionalIncludeDirectories) + MultiThreaded + + + Console + false + true + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/core/org.eclipse.cdt.core.win32/library/pty/winpty-agent.vcxproj.filters b/core/org.eclipse.cdt.core.win32/library/pty/winpty-agent.vcxproj.filters index 17401866621..46cdf6beaa8 100644 --- a/core/org.eclipse.cdt.core.win32/library/pty/winpty-agent.vcxproj.filters +++ b/core/org.eclipse.cdt.core.win32/library/pty/winpty-agent.vcxproj.filters @@ -1,90 +1,90 @@ - - - - - {a7174beb-334f-4496-868c-348a80e5f4d8} - - - {0c9e153d-99b4-4f47-ba3c-57e53e1c71b7} - - - - - shared - - - shared - - - shared - - - shared - - - agent - - - agent - - - agent - - - agent - - - agent - - - agent - - - agent - - - agent - - - agent - - - agent - - - - - shared - - - agent - - - agent - - - agent - - - agent - - - agent - - - agent - - - agent - - - agent - - - agent - - - agent - - + + + + + {a7174beb-334f-4496-868c-348a80e5f4d8} + + + {0c9e153d-99b4-4f47-ba3c-57e53e1c71b7} + + + + + shared + + + shared + + + shared + + + shared + + + agent + + + agent + + + agent + + + agent + + + agent + + + agent + + + agent + + + agent + + + agent + + + agent + + + + + shared + + + agent + + + agent + + + agent + + + agent + + + agent + + + agent + + + agent + + + agent + + + agent + + + agent + + \ No newline at end of file diff --git a/core/org.eclipse.cdt.core.win32/library/pty/winpty.vcxproj b/core/org.eclipse.cdt.core.win32/library/pty/winpty.vcxproj index bf4fabb5b4d..e83366bc905 100644 --- a/core/org.eclipse.cdt.core.win32/library/pty/winpty.vcxproj +++ b/core/org.eclipse.cdt.core.win32/library/pty/winpty.vcxproj @@ -1,167 +1,167 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - {D7BFF73A-A86A-47FF-AD2B-CC2EFCAD5ABD} - Win32Proj - winpty - - - - DynamicLibrary - true - Unicode - Windows7.1SDK - - - DynamicLibrary - true - Unicode - Windows7.1SDK - - - DynamicLibrary - false - true - Unicode - Windows7.1SDK - - - DynamicLibrary - false - true - Unicode - Windows7.1SDK - - - - - - - - - - - - - - - - - - - true - $(SolutionDir)$(Platform)\$(Configuration)\ - $(Platform)\$(Configuration)\$(ProjectName)\ - - - true - $(SolutionDir)$(Platform)\$(Configuration)\ - $(Platform)\$(Configuration)\$(ProjectName)\ - - - false - $(SolutionDir)$(Platform)\$(Configuration)\ - $(Platform)\$(Configuration)\$(ProjectName)\ - - - false - $(SolutionDir)$(Platform)\$(Configuration)\ - $(Platform)\$(Configuration)\$(ProjectName)\ - - - - NotUsing - Level3 - Disabled - WIN32;NOMINMAX;_DEBUG;_WINDOWS;_USRDLL;_SCL_SECURE_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;WINPTY;%(PreprocessorDefinitions) - ..\winpty\include;%(AdditionalIncludeDirectories) - MultiThreadedDebug - - - Windows - true - - - - - NotUsing - Level3 - Disabled - WIN32;_WINDOWS;NOMINMAX;_DEBUG;_USRDLL;_SCL_SECURE_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;WINPTY;%(PreprocessorDefinitions) - ..\winpty\include;%(AdditionalIncludeDirectories) - MultiThreadedDebug - - - Windows - true - - - - - Level3 - NotUsing - MaxSpeed - true - true - WIN32;NOMINMAX;NDEBUG;_WINDOWS;_USRDLL;_SCL_SECURE_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;WINPTY;%(PreprocessorDefinitions) - ..\winpty\include;%(AdditionalIncludeDirectories) - MultiThreaded - - - Windows - false - true - true - - - - - Level3 - NotUsing - MaxSpeed - true - true - WIN32;_WINDOWS;NOMINMAX;NDEBUG;_USRDLL;_SCL_SECURE_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;WINPTY;%(PreprocessorDefinitions) - ..\winpty\include;%(AdditionalIncludeDirectories) - MultiThreaded - - - Windows - false - true - true - - - - - - - - - - - - - - - - + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + {D7BFF73A-A86A-47FF-AD2B-CC2EFCAD5ABD} + Win32Proj + winpty + + + + DynamicLibrary + true + Unicode + Windows7.1SDK + + + DynamicLibrary + true + Unicode + Windows7.1SDK + + + DynamicLibrary + false + true + Unicode + Windows7.1SDK + + + DynamicLibrary + false + true + Unicode + Windows7.1SDK + + + + + + + + + + + + + + + + + + + true + $(SolutionDir)$(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\$(ProjectName)\ + + + true + $(SolutionDir)$(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\$(ProjectName)\ + + + false + $(SolutionDir)$(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\$(ProjectName)\ + + + false + $(SolutionDir)$(Platform)\$(Configuration)\ + $(Platform)\$(Configuration)\$(ProjectName)\ + + + + NotUsing + Level3 + Disabled + WIN32;NOMINMAX;_DEBUG;_WINDOWS;_USRDLL;_SCL_SECURE_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;WINPTY;%(PreprocessorDefinitions) + ..\winpty\include;%(AdditionalIncludeDirectories) + MultiThreadedDebug + + + Windows + true + + + + + NotUsing + Level3 + Disabled + WIN32;_WINDOWS;NOMINMAX;_DEBUG;_USRDLL;_SCL_SECURE_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;WINPTY;%(PreprocessorDefinitions) + ..\winpty\include;%(AdditionalIncludeDirectories) + MultiThreadedDebug + + + Windows + true + + + + + Level3 + NotUsing + MaxSpeed + true + true + WIN32;NOMINMAX;NDEBUG;_WINDOWS;_USRDLL;_SCL_SECURE_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;WINPTY;%(PreprocessorDefinitions) + ..\winpty\include;%(AdditionalIncludeDirectories) + MultiThreaded + + + Windows + false + true + true + + + + + Level3 + NotUsing + MaxSpeed + true + true + WIN32;_WINDOWS;NOMINMAX;NDEBUG;_USRDLL;_SCL_SECURE_NO_WARNINGS;_CRT_SECURE_NO_WARNINGS;WINPTY;%(PreprocessorDefinitions) + ..\winpty\include;%(AdditionalIncludeDirectories) + MultiThreaded + + + Windows + false + true + true + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/core/org.eclipse.cdt.core.win32/library/pty/winpty.vcxproj.filters b/core/org.eclipse.cdt.core.win32/library/pty/winpty.vcxproj.filters index ad2b6019f77..86016e30242 100644 --- a/core/org.eclipse.cdt.core.win32/library/pty/winpty.vcxproj.filters +++ b/core/org.eclipse.cdt.core.win32/library/pty/winpty.vcxproj.filters @@ -1,39 +1,39 @@ - - - - - {6f8f9f7f-1797-423e-9189-990b2baff405} - - - {6fa1f334-3a7c-4a8c-970b-15c2a6a08ba2} - - - {84962cba-90e7-4b83-8656-6563b933bb73} - - - - - shared - - - shared - - - shared - - - shared - - - include - - - - - shared - - - libwinpty - - + + + + + {6f8f9f7f-1797-423e-9189-990b2baff405} + + + {6fa1f334-3a7c-4a8c-970b-15c2a6a08ba2} + + + {84962cba-90e7-4b83-8656-6563b933bb73} + + + + + shared + + + shared + + + shared + + + shared + + + include + + + + + shared + + + libwinpty + + \ No newline at end of file diff --git a/core/org.eclipse.cdt.core.win32/library/winreg/dllmain.cpp b/core/org.eclipse.cdt.core.win32/library/winreg/dllmain.cpp index 6e297985f3b..fb210e2a522 100644 --- a/core/org.eclipse.cdt.core.win32/library/winreg/dllmain.cpp +++ b/core/org.eclipse.cdt.core.win32/library/winreg/dllmain.cpp @@ -1,28 +1,28 @@ -/******************************************************************************* - * Copyright (c) 2015 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 - *******************************************************************************/ -#include "stdafx.h" - -BOOL APIENTRY DllMain( HMODULE hModule, - DWORD ul_reason_for_call, - LPVOID lpReserved - ) -{ - switch (ul_reason_for_call) - { - case DLL_PROCESS_ATTACH: - case DLL_THREAD_ATTACH: - case DLL_THREAD_DETACH: - case DLL_PROCESS_DETACH: - break; - } - return TRUE; -} - +/******************************************************************************* + * Copyright (c) 2015 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 + *******************************************************************************/ +#include "stdafx.h" + +BOOL APIENTRY DllMain( HMODULE hModule, + DWORD ul_reason_for_call, + LPVOID lpReserved + ) +{ + switch (ul_reason_for_call) + { + case DLL_PROCESS_ATTACH: + case DLL_THREAD_ATTACH: + case DLL_THREAD_DETACH: + case DLL_PROCESS_DETACH: + break; + } + return TRUE; +} + diff --git a/core/org.eclipse.cdt.core.win32/library/winreg/stdafx.cpp b/core/org.eclipse.cdt.core.win32/library/winreg/stdafx.cpp index c97de4cd232..74d5be2a887 100644 --- a/core/org.eclipse.cdt.core.win32/library/winreg/stdafx.cpp +++ b/core/org.eclipse.cdt.core.win32/library/winreg/stdafx.cpp @@ -1,14 +1,14 @@ -/******************************************************************************* - * Copyright (c) 2015 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 - *******************************************************************************/ -#include "stdafx.h" - -// TODO: reference any additional headers you need in STDAFX.H -// and not in this file +/******************************************************************************* + * Copyright (c) 2015 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 + *******************************************************************************/ +#include "stdafx.h" + +// TODO: reference any additional headers you need in STDAFX.H +// and not in this file diff --git a/core/org.eclipse.cdt.core.win32/library/winreg/stdafx.h b/core/org.eclipse.cdt.core.win32/library/winreg/stdafx.h index 0babced30e7..d3a8b238d5f 100644 --- a/core/org.eclipse.cdt.core.win32/library/winreg/stdafx.h +++ b/core/org.eclipse.cdt.core.win32/library/winreg/stdafx.h @@ -1,22 +1,22 @@ -/******************************************************************************* - * Copyright (c) 2015 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 - *******************************************************************************/ -#pragma once - -#include "targetver.h" - -#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers -// Windows Header Files: -#include -#include - - - -// TODO: reference additional headers your program requires here +/******************************************************************************* + * Copyright (c) 2015 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 + *******************************************************************************/ +#pragma once + +#include "targetver.h" + +#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers +// Windows Header Files: +#include +#include + + + +// TODO: reference additional headers your program requires here diff --git a/core/org.eclipse.cdt.core.win32/library/winreg/targetver.h b/core/org.eclipse.cdt.core.win32/library/winreg/targetver.h index d27181a16d6..061a668b8c4 100644 --- a/core/org.eclipse.cdt.core.win32/library/winreg/targetver.h +++ b/core/org.eclipse.cdt.core.win32/library/winreg/targetver.h @@ -1,18 +1,18 @@ -/******************************************************************************* - * Copyright (c) 2015 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 - *******************************************************************************/ -#pragma once - -// Including SDKDDKVer.h defines the highest available Windows platform. - -// If you wish to build your application for a previous Windows platform, include WinSDKVer.h and -// set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h. - -#include +/******************************************************************************* + * Copyright (c) 2015 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 + *******************************************************************************/ +#pragma once + +// Including SDKDDKVer.h defines the highest available Windows platform. + +// If you wish to build your application for a previous Windows platform, include WinSDKVer.h and +// set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h. + +#include diff --git a/core/org.eclipse.cdt.core.win32/library/winreg/winreg.cpp b/core/org.eclipse.cdt.core.win32/library/winreg/winreg.cpp index 231910a1f77..c64a43ae870 100644 --- a/core/org.eclipse.cdt.core.win32/library/winreg/winreg.cpp +++ b/core/org.eclipse.cdt.core.win32/library/winreg/winreg.cpp @@ -1,151 +1,151 @@ -/******************************************************************************* - * Copyright (c) 2015 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 - *******************************************************************************/ -#include "stdafx.h" - -static jstring getValue(JNIEnv * env, HKEY key, jstring subkey, jstring name) { - const jchar * csubkey = env->GetStringChars(subkey, NULL); - const jchar * cname = env->GetStringChars(name, NULL); - jstring result = NULL; - - HKEY skey; - LONG rc = RegOpenKeyEx(key, (const wchar_t *)csubkey, 0, KEY_READ, &skey); - if (rc == ERROR_SUCCESS) { - DWORD type; - wchar_t buffer[256]; - DWORD len = sizeof(buffer); - rc = RegQueryValueEx(skey, (const wchar_t *)cname, NULL, &type, (BYTE *)&buffer, &len); - if (rc == ERROR_SUCCESS) { - result = env->NewString((jchar *) buffer, (jsize) wcslen(buffer)); - } - RegCloseKey(skey); - } - - env->ReleaseStringChars(subkey, csubkey); - env->ReleaseStringChars(name, cname); - - return result; -} - -extern "C" -JNIEXPORT jstring JNICALL Java_org_eclipse_cdt_utils_WindowsRegistry_getLocalMachineValue( -JNIEnv * env, jobject obj, jstring subkey, jstring name) -{ - return getValue(env, HKEY_LOCAL_MACHINE, subkey, name); -} - -extern "C" -JNIEXPORT jstring JNICALL Java_org_eclipse_cdt_utils_WindowsRegistry_getCurrentUserValue( -JNIEnv * env, jobject obj, jstring subkey, jstring name) -{ - return getValue(env, HKEY_CURRENT_USER, subkey, name); -} - -/* -* Given a subkey (string) under HKEY_LOCAL_MACHINE, and an index (starting from 0) -* to the key's array of values, return the name of the indexed value. -* The return value is null on any error or when the index is invalid. -*/ - -static jstring getValueName(JNIEnv * env, HKEY key, jstring subkey, jint index) { - const jchar * csubkey = env->GetStringChars(subkey, NULL); - jstring result = NULL; - - HKEY skey; - LONG rc = RegOpenKeyEx(key, (const wchar_t *)csubkey, 0, KEY_READ, &skey); - if (rc != ERROR_SUCCESS) - return NULL; - - wchar_t valueName[256]; - DWORD nameSize = sizeof(valueName) + 2; - - rc = RegEnumValue(skey, index, - valueName, // UNICODE string - &nameSize, - NULL, NULL, - NULL, // data string - NULL); // size in BYTE of data. - - if (rc == ERROR_SUCCESS) - { - result = env->NewString((jchar *)valueName, nameSize); - } - - RegCloseKey(skey); - - env->ReleaseStringChars(subkey, csubkey); - - return result; -} - -extern "C" -JNIEXPORT jstring JNICALL Java_org_eclipse_cdt_utils_WindowsRegistry_getLocalMachineValueName( -JNIEnv * env, jobject obj, jstring subkey, jint index) -{ - return getValueName(env, HKEY_LOCAL_MACHINE, subkey, index); -} - -extern "C" -JNIEXPORT jstring JNICALL Java_org_eclipse_cdt_utils_WindowsRegistry_getCurrentUserValueName( -JNIEnv * env, jobject obj, jstring subkey, jint index) -{ - return getValueName(env, HKEY_CURRENT_USER, subkey, index); -} - -/* -* Given a subkey (string) under HKEY_LOCAL_MACHINE, and an index (starting from 0) -* to the key's array of keys, return the name of the indexed key. -* The return value is null on any error or when the index is invalid. -*/ - -static jstring getKeyName(JNIEnv * env, HKEY key, jstring subkey, jint index) { - const jchar * csubkey = env->GetStringChars(subkey, NULL); - jstring result = NULL; - - HKEY skey; - LONG rc = RegOpenKeyEx(key, (const wchar_t *)csubkey, 0, KEY_READ, &skey); - if (rc != ERROR_SUCCESS) - return NULL; - - wchar_t keyName[256]; - DWORD nameSize = sizeof(keyName) + 2; - - rc = RegEnumKeyEx(skey, index, - keyName, // UNICODE string - &nameSize, - NULL, NULL, - NULL, - NULL); // size in BYTE of data. - - if (rc == ERROR_SUCCESS) - { - result = env->NewString((jchar *)keyName, nameSize); - } - - RegCloseKey(skey); - - env->ReleaseStringChars(subkey, csubkey); - - return result; -} - -extern "C" -JNIEXPORT jstring JNICALL Java_org_eclipse_cdt_utils_WindowsRegistry_getLocalMachineKeyName( -JNIEnv * env, jobject obj, jstring subkey, jint index) -{ - return getKeyName(env, HKEY_LOCAL_MACHINE, subkey, index); -} - -extern "C" -JNIEXPORT jstring JNICALL Java_org_eclipse_cdt_utils_WindowsRegistry_getCurrentUserKeyName( -JNIEnv * env, jobject obj, jstring subkey, jint index) -{ - return getKeyName(env, HKEY_CURRENT_USER, subkey, index); -} +/******************************************************************************* + * Copyright (c) 2015 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 + *******************************************************************************/ +#include "stdafx.h" + +static jstring getValue(JNIEnv * env, HKEY key, jstring subkey, jstring name) { + const jchar * csubkey = env->GetStringChars(subkey, NULL); + const jchar * cname = env->GetStringChars(name, NULL); + jstring result = NULL; + + HKEY skey; + LONG rc = RegOpenKeyEx(key, (const wchar_t *)csubkey, 0, KEY_READ, &skey); + if (rc == ERROR_SUCCESS) { + DWORD type; + wchar_t buffer[256]; + DWORD len = sizeof(buffer); + rc = RegQueryValueEx(skey, (const wchar_t *)cname, NULL, &type, (BYTE *)&buffer, &len); + if (rc == ERROR_SUCCESS) { + result = env->NewString((jchar *) buffer, (jsize) wcslen(buffer)); + } + RegCloseKey(skey); + } + + env->ReleaseStringChars(subkey, csubkey); + env->ReleaseStringChars(name, cname); + + return result; +} + +extern "C" +JNIEXPORT jstring JNICALL Java_org_eclipse_cdt_utils_WindowsRegistry_getLocalMachineValue( +JNIEnv * env, jobject obj, jstring subkey, jstring name) +{ + return getValue(env, HKEY_LOCAL_MACHINE, subkey, name); +} + +extern "C" +JNIEXPORT jstring JNICALL Java_org_eclipse_cdt_utils_WindowsRegistry_getCurrentUserValue( +JNIEnv * env, jobject obj, jstring subkey, jstring name) +{ + return getValue(env, HKEY_CURRENT_USER, subkey, name); +} + +/* +* Given a subkey (string) under HKEY_LOCAL_MACHINE, and an index (starting from 0) +* to the key's array of values, return the name of the indexed value. +* The return value is null on any error or when the index is invalid. +*/ + +static jstring getValueName(JNIEnv * env, HKEY key, jstring subkey, jint index) { + const jchar * csubkey = env->GetStringChars(subkey, NULL); + jstring result = NULL; + + HKEY skey; + LONG rc = RegOpenKeyEx(key, (const wchar_t *)csubkey, 0, KEY_READ, &skey); + if (rc != ERROR_SUCCESS) + return NULL; + + wchar_t valueName[256]; + DWORD nameSize = sizeof(valueName) + 2; + + rc = RegEnumValue(skey, index, + valueName, // UNICODE string + &nameSize, + NULL, NULL, + NULL, // data string + NULL); // size in BYTE of data. + + if (rc == ERROR_SUCCESS) + { + result = env->NewString((jchar *)valueName, nameSize); + } + + RegCloseKey(skey); + + env->ReleaseStringChars(subkey, csubkey); + + return result; +} + +extern "C" +JNIEXPORT jstring JNICALL Java_org_eclipse_cdt_utils_WindowsRegistry_getLocalMachineValueName( +JNIEnv * env, jobject obj, jstring subkey, jint index) +{ + return getValueName(env, HKEY_LOCAL_MACHINE, subkey, index); +} + +extern "C" +JNIEXPORT jstring JNICALL Java_org_eclipse_cdt_utils_WindowsRegistry_getCurrentUserValueName( +JNIEnv * env, jobject obj, jstring subkey, jint index) +{ + return getValueName(env, HKEY_CURRENT_USER, subkey, index); +} + +/* +* Given a subkey (string) under HKEY_LOCAL_MACHINE, and an index (starting from 0) +* to the key's array of keys, return the name of the indexed key. +* The return value is null on any error or when the index is invalid. +*/ + +static jstring getKeyName(JNIEnv * env, HKEY key, jstring subkey, jint index) { + const jchar * csubkey = env->GetStringChars(subkey, NULL); + jstring result = NULL; + + HKEY skey; + LONG rc = RegOpenKeyEx(key, (const wchar_t *)csubkey, 0, KEY_READ, &skey); + if (rc != ERROR_SUCCESS) + return NULL; + + wchar_t keyName[256]; + DWORD nameSize = sizeof(keyName) + 2; + + rc = RegEnumKeyEx(skey, index, + keyName, // UNICODE string + &nameSize, + NULL, NULL, + NULL, + NULL); // size in BYTE of data. + + if (rc == ERROR_SUCCESS) + { + result = env->NewString((jchar *)keyName, nameSize); + } + + RegCloseKey(skey); + + env->ReleaseStringChars(subkey, csubkey); + + return result; +} + +extern "C" +JNIEXPORT jstring JNICALL Java_org_eclipse_cdt_utils_WindowsRegistry_getLocalMachineKeyName( +JNIEnv * env, jobject obj, jstring subkey, jint index) +{ + return getKeyName(env, HKEY_LOCAL_MACHINE, subkey, index); +} + +extern "C" +JNIEXPORT jstring JNICALL Java_org_eclipse_cdt_utils_WindowsRegistry_getCurrentUserKeyName( +JNIEnv * env, jobject obj, jstring subkey, jint index) +{ + return getKeyName(env, HKEY_CURRENT_USER, subkey, index); +} diff --git a/core/org.eclipse.cdt.core.win32/library/winreg/winreg.vcxproj b/core/org.eclipse.cdt.core.win32/library/winreg/winreg.vcxproj index 994ba556f5a..0c82aec90f9 100644 --- a/core/org.eclipse.cdt.core.win32/library/winreg/winreg.vcxproj +++ b/core/org.eclipse.cdt.core.win32/library/winreg/winreg.vcxproj @@ -1,175 +1,175 @@ - - - - - Debug - Win32 - - - Debug - x64 - - - Release - Win32 - - - Release - x64 - - - - {4CA57EA3-42F2-4CC1-8E95-5C707A8E7363} - Win32Proj - winreg - - - - DynamicLibrary - true - v120 - Unicode - - - DynamicLibrary - true - v120 - Unicode - - - DynamicLibrary - false - v120 - true - Unicode - - - DynamicLibrary - false - v120 - true - Unicode - - - - - - - - - - - - - - - - - - - true - - - true - - - false - $(SolutionDir)..\..\org.eclipse.cdt.core.win32.x86\os\win32\x86\ - - - - false - $(SolutionDir)..\..\org.eclipse.cdt.core.win32.x86_64\os\win32\x86_64\ - - - - - Use - Level3 - Disabled - WIN32;_DEBUG;_WINDOWS;_USRDLL;WINREG_EXPORTS;%(PreprocessorDefinitions) - - - Windows - true - - - - - Use - Level3 - Disabled - WIN32;_DEBUG;_WINDOWS;_USRDLL;WINREG_EXPORTS;%(PreprocessorDefinitions) - - - Windows - true - - - - - Level3 - Use - MaxSpeed - true - true - WIN32;NDEBUG;_WINDOWS;_USRDLL;WINREG_EXPORTS;%(PreprocessorDefinitions) - C:\Program Files\Java\jdk1.8.0_31\include;C:\Program Files\Java\jdk1.8.0_31\include\win32 - MultiThreaded - - - Windows - true - true - true - - - - - Level3 - Use - MaxSpeed - true - true - WIN32;NDEBUG;_WINDOWS;_USRDLL;WINREG_EXPORTS;%(PreprocessorDefinitions) - C:\Program Files\Java\jdk1.8.0_31\include;C:\Program Files\Java\jdk1.8.0_31\include\win32 - MultiThreaded - - - Windows - true - true - true - - - - - - - - - false - false - - - - - false - false - - - - - - - Create - Create - Create - Create - - - - - - + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + {4CA57EA3-42F2-4CC1-8E95-5C707A8E7363} + Win32Proj + winreg + + + + DynamicLibrary + true + v120 + Unicode + + + DynamicLibrary + true + v120 + Unicode + + + DynamicLibrary + false + v120 + true + Unicode + + + DynamicLibrary + false + v120 + true + Unicode + + + + + + + + + + + + + + + + + + + true + + + true + + + false + $(SolutionDir)..\..\org.eclipse.cdt.core.win32.x86\os\win32\x86\ + + + + false + $(SolutionDir)..\..\org.eclipse.cdt.core.win32.x86_64\os\win32\x86_64\ + + + + + Use + Level3 + Disabled + WIN32;_DEBUG;_WINDOWS;_USRDLL;WINREG_EXPORTS;%(PreprocessorDefinitions) + + + Windows + true + + + + + Use + Level3 + Disabled + WIN32;_DEBUG;_WINDOWS;_USRDLL;WINREG_EXPORTS;%(PreprocessorDefinitions) + + + Windows + true + + + + + Level3 + Use + MaxSpeed + true + true + WIN32;NDEBUG;_WINDOWS;_USRDLL;WINREG_EXPORTS;%(PreprocessorDefinitions) + C:\Program Files\Java\jdk1.8.0_31\include;C:\Program Files\Java\jdk1.8.0_31\include\win32 + MultiThreaded + + + Windows + true + true + true + + + + + Level3 + Use + MaxSpeed + true + true + WIN32;NDEBUG;_WINDOWS;_USRDLL;WINREG_EXPORTS;%(PreprocessorDefinitions) + C:\Program Files\Java\jdk1.8.0_31\include;C:\Program Files\Java\jdk1.8.0_31\include\win32 + MultiThreaded + + + Windows + true + true + true + + + + + + + + + false + false + + + + + false + false + + + + + + + Create + Create + Create + Create + + + + + + \ No newline at end of file diff --git a/core/org.eclipse.cdt.core.win32/library/winreg/winreg.vcxproj.filters b/core/org.eclipse.cdt.core.win32/library/winreg/winreg.vcxproj.filters index 41d99849235..afa4a0f572f 100644 --- a/core/org.eclipse.cdt.core.win32/library/winreg/winreg.vcxproj.filters +++ b/core/org.eclipse.cdt.core.win32/library/winreg/winreg.vcxproj.filters @@ -1,36 +1,36 @@ - - - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hh;hpp;hxx;hm;inl;inc;xsd - - - {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms - - - - - Header Files - - - Header Files - - - - - Source Files - - - Source Files - - - Source Files - - + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + + + Header Files + + + Header Files + + + + + Source Files + + + Source Files + + + Source Files + + \ No newline at end of file diff --git a/core/org.eclipse.cdt.core.win32/plugin.properties b/core/org.eclipse.cdt.core.win32/plugin.properties index 0b31b3ca94e..9dec4fd06a0 100644 --- a/core/org.eclipse.cdt.core.win32/plugin.properties +++ b/core/org.eclipse.cdt.core.win32/plugin.properties @@ -1,2 +1,2 @@ -fragmentName.linux=C/C++ Development Tools Core for Windows -providerName=Eclipse CDT +fragmentName.linux=C/C++ Development Tools Core for Windows +providerName=Eclipse CDT diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/language/settings/providers/ILanguageSettingsProvidersKeeper.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/language/settings/providers/ILanguageSettingsProvidersKeeper.java index fb9be5d5ae4..0d2a44c9b6d 100644 --- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/language/settings/providers/ILanguageSettingsProvidersKeeper.java +++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/language/settings/providers/ILanguageSettingsProvidersKeeper.java @@ -1,69 +1,69 @@ -/******************************************************************************* - * Copyright (c) 2011, 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 +/******************************************************************************* + * Copyright (c) 2011, 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.List; - -import org.eclipse.cdt.core.settings.model.ICLanguageSettingEntry; -/** - * Interface to express ability (of a configuration description) to handle Language Settings - * Providers. - * @see ILanguageSettingsProvider - * - * @since 5.4 - * - */ -public interface ILanguageSettingsProvidersKeeper { - /** - * Sets the list of language settings providers. Language settings providers are - * used to supply language settings {@link ICLanguageSettingEntry} such as include paths - * or preprocessor macros. - * - * @param providers - the list of providers to assign to the owner (configuration description). - * This method clones the internal list or otherwise ensures immutability of the internal - * list before actual addition to the project model. That is to ensure that there is no - * back-door access and all changes in the list done by this method which fires notifications - * to the registered listeners about the accompanied changes in settings entries, see - * {@link LanguageSettingsManager#registerLanguageSettingsChangeListener(ILanguageSettingsChangeListener)}. - */ - public void setLanguageSettingProviders(List providers); - - /** - * Returns the list of language settings providers. Language settings providers are - * used to supply language settings {@link ICLanguageSettingEntry} such as include paths - * or preprocessor macros. - * - * @return the list of providers to assign to the owner (configuration description). This - * returns immutable list. Use {@link #setLanguageSettingProviders(List)} to change. - * This method does not return {@code null}. - */ - public List getLanguageSettingProviders(); - - /** - * Sets the list of IDs of default language settings providers. - *

- * The method is intended to be used by MBS to set the list from tool-chain definition. - * The default list from the tool-chain is used, for example, while resetting - * configuration providers to default in UI. - * - * @param ids - default provider IDs specified in the tool-chain. - */ - public void setDefaultLanguageSettingsProvidersIds(String[] ids); - - /** - * Retrieve the list of IDs of default language settings providers. - * Normally the list would come from the tool-chain definition. - * - * @return default provider IDs or {@code null} if default providers are not defined. - */ - public String[] getDefaultLanguageSettingsProvidersIds(); - -} +package org.eclipse.cdt.core.language.settings.providers; + +import java.util.List; + +import org.eclipse.cdt.core.settings.model.ICLanguageSettingEntry; +/** + * Interface to express ability (of a configuration description) to handle Language Settings + * Providers. + * @see ILanguageSettingsProvider + * + * @since 5.4 + * + */ +public interface ILanguageSettingsProvidersKeeper { + /** + * Sets the list of language settings providers. Language settings providers are + * used to supply language settings {@link ICLanguageSettingEntry} such as include paths + * or preprocessor macros. + * + * @param providers - the list of providers to assign to the owner (configuration description). + * This method clones the internal list or otherwise ensures immutability of the internal + * list before actual addition to the project model. That is to ensure that there is no + * back-door access and all changes in the list done by this method which fires notifications + * to the registered listeners about the accompanied changes in settings entries, see + * {@link LanguageSettingsManager#registerLanguageSettingsChangeListener(ILanguageSettingsChangeListener)}. + */ + public void setLanguageSettingProviders(List providers); + + /** + * Returns the list of language settings providers. Language settings providers are + * used to supply language settings {@link ICLanguageSettingEntry} such as include paths + * or preprocessor macros. + * + * @return the list of providers to assign to the owner (configuration description). This + * returns immutable list. Use {@link #setLanguageSettingProviders(List)} to change. + * This method does not return {@code null}. + */ + public List getLanguageSettingProviders(); + + /** + * Sets the list of IDs of default language settings providers. + *

+ * The method is intended to be used by MBS to set the list from tool-chain definition. + * The default list from the tool-chain is used, for example, while resetting + * configuration providers to default in UI. + * + * @param ids - default provider IDs specified in the tool-chain. + */ + public void setDefaultLanguageSettingsProvidersIds(String[] ids); + + /** + * Retrieve the list of IDs of default language settings providers. + * Normally the list would come from the tool-chain definition. + * + * @return default provider IDs or {@code null} if default providers are not defined. + */ + public String[] getDefaultLanguageSettingsProvidersIds(); + +} diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/language/settings/providers/IWorkingDirectoryTracker.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/language/settings/providers/IWorkingDirectoryTracker.java index 6bf62071aa3..4f64bc39cd2 100644 --- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/language/settings/providers/IWorkingDirectoryTracker.java +++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/language/settings/providers/IWorkingDirectoryTracker.java @@ -1,28 +1,28 @@ -/******************************************************************************* - * Copyright (c) 2012, 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.net.URI; - -/** - * Interface for console parsers able to track current working directory for build. - * - * @since 5.4 - */ -public interface IWorkingDirectoryTracker { - /** - * Returns current working directory for the current build command as determined from - * build output. - * - * @return URI of current working directory or {@code null}. - */ - public URI getWorkingDirectoryURI(); -} +/******************************************************************************* + * Copyright (c) 2012, 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.net.URI; + +/** + * Interface for console parsers able to track current working directory for build. + * + * @since 5.4 + */ +public interface IWorkingDirectoryTracker { + /** + * Returns current working directory for the current build command as determined from + * build output. + * + * @return URI of current working directory or {@code null}. + */ + public URI getWorkingDirectoryURI(); +} diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/language/settings/providers/LanguageSettingsStorage.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/language/settings/providers/LanguageSettingsStorage.java index 992ee4e7097..a3e0e76468c 100644 --- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/language/settings/providers/LanguageSettingsStorage.java +++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/language/settings/providers/LanguageSettingsStorage.java @@ -1,266 +1,266 @@ -/******************************************************************************* - * Copyright (c) 2011, 2014 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) 2011, 2014 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.Collections; -import java.util.Comparator; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.Set; - -import org.eclipse.cdt.core.settings.model.ICLanguageSettingEntry; -import org.eclipse.cdt.core.settings.model.ICSettingEntry; -import org.eclipse.cdt.internal.core.WeakHashSet; -import org.eclipse.cdt.internal.core.WeakHashSetSynchronized; - -/** - * The class representing the (in-memory) storage for language settings entries {@link ICLanguageSettingEntry}. - * - * @since 5.4 - */ -public class LanguageSettingsStorage implements Cloneable { - /** Storage to keep settings entries. */ - protected Map>> fStorage = new HashMap>>(); - - /** - * Pool of LSE lists implemented as WeakHashSet. That allows to gain memory savings - * at the expense of CPU time. WeakHashSet handles garbage collection when a list is not - * referenced anywhere else. See JavaDoc {@link java.lang.ref.WeakReference} about weak reference objects. - */ - private static WeakHashSet> listPool = new WeakHashSetSynchronized>(); - - /** - * Returns the list of setting entries for the given resource and language. - *
Note that this list is unmodifiable. - * - * @param rcProjectPath - path to the resource relative to the project. - * @param languageId - language id. - * - * @return the list of setting entries or {@code null} if no settings defined. - */ - public List getSettingEntries(String rcProjectPath, String languageId) { - List entries = null; - Map> langMap = fStorage.get(languageId); - if (langMap!=null) { - entries = langMap.get(rcProjectPath); - } - return entries; - } - - /** - * Some providers may collect entries in pretty much random order. For the intent of - * predictability, UI usability and efficient storage the entries are sorted by kinds - * and secondary by name for kinds where the secondary order is not significant. - * - * @param entries - list of entries to sort. - * @return - sorted entries. - */ - private List sortEntries(List entries) { - List sortedEntries = new ArrayList<>(entries); - Collections.sort(sortedEntries, new Comparator() { - /** - * This comparator sorts by kinds first and the macros are sorted additionally by name. - */ - @Override - public int compare(ICLanguageSettingEntry entry0, ICLanguageSettingEntry entry1) { - int kind0 = entry0.getKind(); - int kind1 = entry1.getKind(); - if (kind0 == ICSettingEntry.MACRO && kind1 == ICSettingEntry.MACRO) { - return entry0.getName().compareTo(entry1.getName()); - } - - return kind0 - kind1; - }}); - - return sortedEntries; - } - - /** - * Sets language settings entries for the resource and language. - * - * @param rcProjectPath - path to the resource relative to the project. If {@code null} the entries are - * considered to be being defined as default entries for resources. - * @param languageId - language id. If {@code null}, then entries are considered - * to be defined for the language scope. - * @param entries - language settings entries to set. - */ - public void setSettingEntries(String rcProjectPath, String languageId, - List entries) { - synchronized (fStorage) { - if (entries!=null) { - Map> langMap = fStorage.get(languageId); - if (langMap == null) { - langMap = new HashMap>(); - fStorage.put(languageId, langMap); - } - List sortedEntries = getPooledList(sortEntries(entries), false); - langMap.put(rcProjectPath, sortedEntries); - } else { - // reduct the empty maps in the tables - Map> langMap = fStorage.get(languageId); - if (langMap != null) { - langMap.remove(rcProjectPath); - if (langMap.isEmpty()) { - fStorage.remove(languageId); - } - } - } - } - } - - /** - * @return {@code true} if the storage is empty or {@code false} otherwise. - */ - public boolean isEmpty() { - return fStorage.isEmpty(); - } - - /** - * Clear all the entries for all resources and all languages. - */ - public void clear() { - synchronized (fStorage) { - fStorage.clear(); - } - } - - /** - * @return set of all languages associated with the entries. - * Note that the storage can keep default entries for the language scope - * of the provider, so the set can contain {@code null}. - */ - public Set getLanguages() { - return new HashSet(fStorage.keySet()); - } - - /** - * Returns set of paths for all resources associated with entries for given language. - * The paths are project relative. - * - * @param languageId - language ID. - * @return the set of resource paths associated with entries for the given language or empty set. - * Note that the storage can keep default entries for resources, so the set can contain {@code null}. - */ - public Set getResourcePaths(String languageId) { - Map> rcPathsMap = fStorage.get(languageId); - if (rcPathsMap == null) { - return new HashSet(); - } - return new HashSet(rcPathsMap.keySet()); - } - - /** - * Find and return the equal list of entries from the pool. - * - * @param entries - list of entries to pool. - * @param copy - specify {@code true} to copy the list in order to prevent - * back-door modification on the original list changes. - * @return returns the list of entries from the pool. - */ - private static List getPooledList(List entries, boolean copy) { - if (entries == null) - return null; - - List pooledList = listPool.get(entries); - if (pooledList != null) { - return pooledList; - } - - if (entries.size() == 0) { - return getPooledEmptyList(); - } - - if (copy) { - entries = new ArrayList(entries); - } - pooledList = Collections.unmodifiableList(entries); - return listPool.add(pooledList); - } - - /** - * Find and return the equal list of entries from the pool to conserve the memory. - * - * @param entries - list of entries to pool. - * @return returns the list of entries from the pool. - */ - public static List getPooledList(List entries) { - return getPooledList(entries, true); - } - - /** - * @return Returns the empty immutable list which is pooled. Use this call rather than creating - * new empty array to ensure that faster shallow operator '==' can be used instead of equals() - * which goes deep on HashMaps. - */ - public static List getPooledEmptyList() { - List pooledEmptyList = Collections.emptyList(); - return listPool.add(pooledEmptyList); - } - - /** - * Clone storage for the entries. Copies references for lists of entries as a whole. - * Note that that is OK as the lists kept in storage are unmodifiable and pooled. - */ - @Override - public LanguageSettingsStorage clone() throws CloneNotSupportedException { - LanguageSettingsStorage storageClone = (LanguageSettingsStorage) super.clone(); - storageClone.fStorage = new HashMap>>(); - synchronized (fStorage) { - Set>>> entrySetLang = fStorage.entrySet(); - for (Entry>> entryLang : entrySetLang) { - String langId = entryLang.getKey(); - Map> mapRc = entryLang.getValue(); - Map> mapRcClone = new HashMap>(); - Set>> entrySetRc = mapRc.entrySet(); - for (Entry> entryRc : entrySetRc) { - String rcProjectPath = entryRc.getKey(); - List lsEntries = entryRc.getValue(); - // don't need to clone entries, they are from the LSE lists pool - mapRcClone.put(rcProjectPath, lsEntries); - } - storageClone.fStorage.put(langId, mapRcClone); - } - } - return storageClone; - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ((fStorage == null) ? 0 : fStorage.hashCode()); - return result; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; - LanguageSettingsStorage other = (LanguageSettingsStorage) obj; - if (fStorage == null) { - if (other.fStorage != null) - return false; - } else if (!fStorage.equals(other.fStorage)) - return false; - return true; - } - -} +package org.eclipse.cdt.core.language.settings.providers; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.Comparator; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import org.eclipse.cdt.core.settings.model.ICLanguageSettingEntry; +import org.eclipse.cdt.core.settings.model.ICSettingEntry; +import org.eclipse.cdt.internal.core.WeakHashSet; +import org.eclipse.cdt.internal.core.WeakHashSetSynchronized; + +/** + * The class representing the (in-memory) storage for language settings entries {@link ICLanguageSettingEntry}. + * + * @since 5.4 + */ +public class LanguageSettingsStorage implements Cloneable { + /** Storage to keep settings entries. */ + protected Map>> fStorage = new HashMap>>(); + + /** + * Pool of LSE lists implemented as WeakHashSet. That allows to gain memory savings + * at the expense of CPU time. WeakHashSet handles garbage collection when a list is not + * referenced anywhere else. See JavaDoc {@link java.lang.ref.WeakReference} about weak reference objects. + */ + private static WeakHashSet> listPool = new WeakHashSetSynchronized>(); + + /** + * Returns the list of setting entries for the given resource and language. + *
Note that this list is unmodifiable. + * + * @param rcProjectPath - path to the resource relative to the project. + * @param languageId - language id. + * + * @return the list of setting entries or {@code null} if no settings defined. + */ + public List getSettingEntries(String rcProjectPath, String languageId) { + List entries = null; + Map> langMap = fStorage.get(languageId); + if (langMap!=null) { + entries = langMap.get(rcProjectPath); + } + return entries; + } + + /** + * Some providers may collect entries in pretty much random order. For the intent of + * predictability, UI usability and efficient storage the entries are sorted by kinds + * and secondary by name for kinds where the secondary order is not significant. + * + * @param entries - list of entries to sort. + * @return - sorted entries. + */ + private List sortEntries(List entries) { + List sortedEntries = new ArrayList<>(entries); + Collections.sort(sortedEntries, new Comparator() { + /** + * This comparator sorts by kinds first and the macros are sorted additionally by name. + */ + @Override + public int compare(ICLanguageSettingEntry entry0, ICLanguageSettingEntry entry1) { + int kind0 = entry0.getKind(); + int kind1 = entry1.getKind(); + if (kind0 == ICSettingEntry.MACRO && kind1 == ICSettingEntry.MACRO) { + return entry0.getName().compareTo(entry1.getName()); + } + + return kind0 - kind1; + }}); + + return sortedEntries; + } + + /** + * Sets language settings entries for the resource and language. + * + * @param rcProjectPath - path to the resource relative to the project. If {@code null} the entries are + * considered to be being defined as default entries for resources. + * @param languageId - language id. If {@code null}, then entries are considered + * to be defined for the language scope. + * @param entries - language settings entries to set. + */ + public void setSettingEntries(String rcProjectPath, String languageId, + List entries) { + synchronized (fStorage) { + if (entries!=null) { + Map> langMap = fStorage.get(languageId); + if (langMap == null) { + langMap = new HashMap>(); + fStorage.put(languageId, langMap); + } + List sortedEntries = getPooledList(sortEntries(entries), false); + langMap.put(rcProjectPath, sortedEntries); + } else { + // reduct the empty maps in the tables + Map> langMap = fStorage.get(languageId); + if (langMap != null) { + langMap.remove(rcProjectPath); + if (langMap.isEmpty()) { + fStorage.remove(languageId); + } + } + } + } + } + + /** + * @return {@code true} if the storage is empty or {@code false} otherwise. + */ + public boolean isEmpty() { + return fStorage.isEmpty(); + } + + /** + * Clear all the entries for all resources and all languages. + */ + public void clear() { + synchronized (fStorage) { + fStorage.clear(); + } + } + + /** + * @return set of all languages associated with the entries. + * Note that the storage can keep default entries for the language scope + * of the provider, so the set can contain {@code null}. + */ + public Set getLanguages() { + return new HashSet(fStorage.keySet()); + } + + /** + * Returns set of paths for all resources associated with entries for given language. + * The paths are project relative. + * + * @param languageId - language ID. + * @return the set of resource paths associated with entries for the given language or empty set. + * Note that the storage can keep default entries for resources, so the set can contain {@code null}. + */ + public Set getResourcePaths(String languageId) { + Map> rcPathsMap = fStorage.get(languageId); + if (rcPathsMap == null) { + return new HashSet(); + } + return new HashSet(rcPathsMap.keySet()); + } + + /** + * Find and return the equal list of entries from the pool. + * + * @param entries - list of entries to pool. + * @param copy - specify {@code true} to copy the list in order to prevent + * back-door modification on the original list changes. + * @return returns the list of entries from the pool. + */ + private static List getPooledList(List entries, boolean copy) { + if (entries == null) + return null; + + List pooledList = listPool.get(entries); + if (pooledList != null) { + return pooledList; + } + + if (entries.size() == 0) { + return getPooledEmptyList(); + } + + if (copy) { + entries = new ArrayList(entries); + } + pooledList = Collections.unmodifiableList(entries); + return listPool.add(pooledList); + } + + /** + * Find and return the equal list of entries from the pool to conserve the memory. + * + * @param entries - list of entries to pool. + * @return returns the list of entries from the pool. + */ + public static List getPooledList(List entries) { + return getPooledList(entries, true); + } + + /** + * @return Returns the empty immutable list which is pooled. Use this call rather than creating + * new empty array to ensure that faster shallow operator '==' can be used instead of equals() + * which goes deep on HashMaps. + */ + public static List getPooledEmptyList() { + List pooledEmptyList = Collections.emptyList(); + return listPool.add(pooledEmptyList); + } + + /** + * Clone storage for the entries. Copies references for lists of entries as a whole. + * Note that that is OK as the lists kept in storage are unmodifiable and pooled. + */ + @Override + public LanguageSettingsStorage clone() throws CloneNotSupportedException { + LanguageSettingsStorage storageClone = (LanguageSettingsStorage) super.clone(); + storageClone.fStorage = new HashMap>>(); + synchronized (fStorage) { + Set>>> entrySetLang = fStorage.entrySet(); + for (Entry>> entryLang : entrySetLang) { + String langId = entryLang.getKey(); + Map> mapRc = entryLang.getValue(); + Map> mapRcClone = new HashMap>(); + Set>> entrySetRc = mapRc.entrySet(); + for (Entry> entryRc : entrySetRc) { + String rcProjectPath = entryRc.getKey(); + List lsEntries = entryRc.getValue(); + // don't need to clone entries, they are from the LSE lists pool + mapRcClone.put(rcProjectPath, lsEntries); + } + storageClone.fStorage.put(langId, mapRcClone); + } + } + return storageClone; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((fStorage == null) ? 0 : fStorage.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + LanguageSettingsStorage other = (LanguageSettingsStorage) obj; + if (fStorage == null) { + if (other.fStorage != null) + return false; + } else if (!fStorage.equals(other.fStorage)) + return false; + return true; + } + +} diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/language/settings/providers/ScannerDiscoveryLegacySupport.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/language/settings/providers/ScannerDiscoveryLegacySupport.java index ab7b58ea514..6159f1641e2 100644 --- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/language/settings/providers/ScannerDiscoveryLegacySupport.java +++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/language/settings/providers/ScannerDiscoveryLegacySupport.java @@ -1,289 +1,289 @@ -/******************************************************************************* - * Copyright (c) 2009, 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 - * Sergey Prigogin (Google) - *******************************************************************************/ - -package org.eclipse.cdt.core.language.settings.providers; - -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.eclipse.cdt.core.CCorePlugin; -import org.eclipse.cdt.core.model.CoreModel; -import org.eclipse.cdt.core.settings.model.ICConfigurationDescription; -import org.eclipse.cdt.core.settings.model.ICProjectDescription; -import org.eclipse.cdt.internal.core.LocalProjectScope; -import org.eclipse.cdt.internal.core.language.settings.providers.ReferencedProjectsLanguageSettingsProvider; -import org.eclipse.cdt.internal.core.language.settings.providers.ScannerInfoExtensionLanguageSettingsProvider; -import org.eclipse.cdt.internal.core.model.PathEntryManager; -import org.eclipse.cdt.internal.core.settings.model.CProjectDescriptionManager; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.preferences.InstanceScope; -import org.osgi.service.prefs.BackingStoreException; -import org.osgi.service.prefs.Preferences; - -/** - * Collection of utilities for legacy support of older Scanner Discovery functionality. - * This class is temporary and not intended to be used by clients. - * - * @noextend This class is not intended to be subclassed by clients. - * @noinstantiate This class is not intended to be instantiated by clients. - * - * @since 5.4 - */ -public class ScannerDiscoveryLegacySupport { - /** ID of User language settings provider (from org.eclipse.cdt.ui) */ - public static final String USER_LANGUAGE_SETTINGS_PROVIDER_ID = "org.eclipse.cdt.ui.UserLanguageSettingsProvider"; //$NON-NLS-1$ - /** ID of MBS language settings provider (from org.eclipse.cdt.managedbuilder.core) */ - public static final String MBS_LANGUAGE_SETTINGS_PROVIDER_ID = "org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider"; //$NON-NLS-1$ - - /** - * ID of ScannerInfo language settings provider wrapping ScannerInfoProvider defined by org.eclipse.cdt.core.ScannerInfoProvider extension point - * @since 5.5 - */ - public static final String SI_LANGUAGE_SETTINGS_PROVIDER_ID = "org.eclipse.cdt.core.LegacyScannerInfoLanguageSettingsProvider"; //$NON-NLS-1$ - - /** - * ID of language settings provider wrapping {@link org.eclipse.cdt.core.resources.ScannerProvider} of {@link PathEntryManager} for 3.X projects - * @since 5.5 - */ - public static final String PATH_ENTRY_MANAGER_LANGUAGE_SETTINGS_PROVIDER_ID = "org.eclipse.cdt.core.PathEntryScannerInfoLanguageSettingsProvider"; //$NON-NLS-1$ - - private static String DISABLE_LSP_PREFERENCE = "language.settings.providers.disabled"; //$NON-NLS-1$ - private static boolean DISABLE_LSP_DEFAULT_PROJECT = false; - private static boolean DISABLE_LSP_DEFAULT_WORKSPACE = false; - private static final String PREFERENCES_QUALIFIER_CCORE = CCorePlugin.PLUGIN_ID; - - private static Map legacyProfiles = null; - - /** - * Get preferences node for org.eclipse.cdt.core. - * - * @param project - project to get preferences or {@code null} for workspace preferences - * @return - */ - private static Preferences getPreferences(IProject project) { - if (project == null) { - return InstanceScope.INSTANCE.getNode(PREFERENCES_QUALIFIER_CCORE); - } else { - return new LocalProjectScope(project).getNode(PREFERENCES_QUALIFIER_CCORE); - } - } - - /** - * Checks if Language Settings functionality is defined for given project in preferences. - * - * @param project - project to check the preference or {@code null} for workspace preference - * @return {@code true} if functionality is defined - * - * @noreference This method is temporary and not intended to be referenced by clients. - * - * @since 5.5 - */ - public static boolean isLanguageSettingsProvidersFunctionalityDefined(IProject project) { - Preferences pref = getPreferences(project); - String value = pref.get(DISABLE_LSP_PREFERENCE, null); - return value != null; - } - - /** - * Checks if Language Settings functionality is enabled for given project. - * Note that disabling on workspace level will disable it for all projects. - * - * @param project - project to check the preference or {@code null} for workspace preference - * @return {@code true} if functionality is enabled - * - * @noreference This method is temporary and not intended to be referenced by clients. - */ - public static boolean isLanguageSettingsProvidersFunctionalityEnabled(IProject project) { - boolean isEnabledInWorkspace = !getPreferences(null).getBoolean(DISABLE_LSP_PREFERENCE, DISABLE_LSP_DEFAULT_WORKSPACE); - if (isEnabledInWorkspace && project != null) { - return !getPreferences(project).getBoolean(DISABLE_LSP_PREFERENCE, DISABLE_LSP_DEFAULT_PROJECT); - } - return isEnabledInWorkspace; - } - - /** - * Enable/disable Language Settings functionality for the given project. - * - * @param project or {@code null} for workspace preference - * @param value {@code true} to enable or {@code false} to disable the functionality. - * - * @noreference This method is temporary and not intended to be referenced by clients. - */ - public static void setLanguageSettingsProvidersFunctionalityEnabled(IProject project, boolean value) { - Preferences pref = getPreferences(project); - if (value == isLanguageSettingsProvidersFunctionalityEnabled(project)) - return; - pref.putBoolean(DISABLE_LSP_PREFERENCE, !value); - // Scanner info provider have changed - clear the cached copy (http://bugs.eclipse.org/413357). - CCorePlugin.getDefault().resetCachedScannerInfoProvider(project); - try { - pref.flush(); - } catch (BackingStoreException e) { - CCorePlugin.log(e); - } - } - - /** - * Check if legacy Scanner Discovery in MBS should be active. - * @noreference This is internal helper method to support compatibility with previous versions - * which is not intended to be referenced by clients. - */ - public static boolean isMbsLanguageSettingsProviderOn(ICConfigurationDescription cfgDescription) { - if (cfgDescription instanceof ILanguageSettingsProvidersKeeper) { - List lsProviders = ((ILanguageSettingsProvidersKeeper) cfgDescription).getLanguageSettingProviders(); - for (ILanguageSettingsProvider lsp : lsProviders) { - if (MBS_LANGUAGE_SETTINGS_PROVIDER_ID.equals(lsp.getId())) { - return true; - } - } - } - return false; - } - - /** - * Check if legacy Scanner Discovery should be active. - * which is not intended to be referenced by clients. - */ - private static boolean isLegacyProviderOn(ICConfigurationDescription cfgDescription) { - if (cfgDescription instanceof ILanguageSettingsProvidersKeeper) { - List lsProviders = ((ILanguageSettingsProvidersKeeper) cfgDescription).getLanguageSettingProviders(); - for (ILanguageSettingsProvider lsp : lsProviders) { - String id = lsp.getId(); - if (MBS_LANGUAGE_SETTINGS_PROVIDER_ID.equals(id) || SI_LANGUAGE_SETTINGS_PROVIDER_ID.equals(id) || PATH_ENTRY_MANAGER_LANGUAGE_SETTINGS_PROVIDER_ID.equals(id)) { - return true; - } - } - } - return false; - } - - /** - * @noreference This is internal helper method to support compatibility with previous versions - * which is not intended to be referenced by clients. - */ - public static boolean isLegacyScannerDiscoveryOn(ICConfigurationDescription cfgDescription) { - IProject project = null; - if (cfgDescription != null) { - ICProjectDescription prjDescription = cfgDescription.getProjectDescription(); - if (prjDescription != null) { - project = prjDescription.getProject(); - } - } - return !isLanguageSettingsProvidersFunctionalityEnabled(project) || isLegacyProviderOn(cfgDescription); - } - - /** - * @noreference This is internal helper method to support compatibility with previous versions - * which is not intended to be referenced by clients. - */ - public static boolean isLegacyScannerDiscoveryOn(IProject project) { - ICConfigurationDescription cfgDescription = null; - ICProjectDescription prjDescription = CoreModel.getDefault().getProjectDescription(project); - if (prjDescription != null) { - cfgDescription = prjDescription.getActiveConfiguration(); - } - return !isLanguageSettingsProvidersFunctionalityEnabled(project) || isLegacyProviderOn(cfgDescription); - } - - /** - * Return list containing User provider and one of wrapper providers to support legacy projects (backward compatibility). - * - * @noreference This is internal helper method to support compatibility with previous versions - * which is not intended to be referenced by clients. - * @since 5.5 - */ - public static String[] getDefaultProviderIdsLegacy(ICConfigurationDescription cfgDescription) { - boolean useScannerInfoProviderExtension = new ScannerInfoExtensionLanguageSettingsProvider().getScannerInfoProvider(cfgDescription) != null; - String legacyProviderId; - if (useScannerInfoProviderExtension) { - legacyProviderId = SI_LANGUAGE_SETTINGS_PROVIDER_ID; - } else if (CProjectDescriptionManager.getInstance().isNewStyleCfg(cfgDescription)) { - legacyProviderId = MBS_LANGUAGE_SETTINGS_PROVIDER_ID; - } else { - legacyProviderId = PATH_ENTRY_MANAGER_LANGUAGE_SETTINGS_PROVIDER_ID; - } - - return new String[] {USER_LANGUAGE_SETTINGS_PROVIDER_ID, ReferencedProjectsLanguageSettingsProvider.ID, legacyProviderId}; - } - - /** - * Checks if the provider is applicable for configuration from backward compatibility point of view - * - * @noreference This is internal helper method to support compatibility with previous versions - * which is not intended to be referenced by clients. - * @since 5.5 - */ - public static boolean isProviderCompatible(String providerId, ICConfigurationDescription cfgDescription) { - if (cfgDescription != null) { - boolean useScannerInfoProviderExtension = new ScannerInfoExtensionLanguageSettingsProvider().getScannerInfoProvider(cfgDescription) != null; - if (SI_LANGUAGE_SETTINGS_PROVIDER_ID.equals(providerId)) { - return useScannerInfoProviderExtension; - } - - boolean isNewStyleCfg = CProjectDescriptionManager.getInstance().isNewStyleCfg(cfgDescription); - if (MBS_LANGUAGE_SETTINGS_PROVIDER_ID.equals(providerId)) { - return !useScannerInfoProviderExtension && isNewStyleCfg; - } - - if (PATH_ENTRY_MANAGER_LANGUAGE_SETTINGS_PROVIDER_ID.equals(providerId)) { - return !useScannerInfoProviderExtension && !isNewStyleCfg; - } - } - - return true; - } - - /** - * If not defined yet, define property that controls if language settings providers functionality enabled for a given project. - * Workspace preference is checked and the project property is set to match it. - * - * @param project - project to define enablement. - * @since 5.5 - */ - public static void defineLanguageSettingsEnablement(IProject project) { - if (project != null && ! ScannerDiscoveryLegacySupport.isLanguageSettingsProvidersFunctionalityDefined(project)) { - boolean isPreferenceEnabled = ScannerDiscoveryLegacySupport.isLanguageSettingsProvidersFunctionalityEnabled(null); - ScannerDiscoveryLegacySupport.setLanguageSettingsProvidersFunctionalityEnabled(project, isPreferenceEnabled); - } - } - - /** - * Returns the values of scanner discovery profiles (scannerConfigDiscoveryProfileId) which were deprecated - * and replaced with language settings providers in plugin.xml. - * This (temporary) function serves as fail-safe switch during the transition. - * - * @param id - can be id of either org.eclipse.cdt.managedbuilder.internal.core.InputType - * or org.eclipse.cdt.managedbuilder.internal.core.ToolChain. - * @return legacy scannerConfigDiscoveryProfileId. - */ - @SuppressWarnings("nls") - public static String getDeprecatedLegacyProfiles(String id) { - if (legacyProfiles == null) { - legacyProfiles = new HashMap(); - - // InputTypes - legacyProfiles.put("cdt.managedbuild.tool.gnu.c.compiler.input", "org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC|org.eclipse.cdt.make.core.GCCStandardMakePerFileProfile"); - legacyProfiles.put("cdt.managedbuild.tool.gnu.cpp.compiler.input", "org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP|org.eclipse.cdt.make.core.GCCStandardMakePerFileProfile"); - legacyProfiles.put("cdt.managedbuild.tool.gnu.c.compiler.input.cygwin", "org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileC"); - legacyProfiles.put("cdt.managedbuild.tool.gnu.cpp.compiler.input.cygwin", "org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileCPP"); - legacyProfiles.put("cdt.managedbuild.tool.xlc.c.compiler.input", "org.eclipse.cdt.managedbuilder.xlc.core.XLCManagedMakePerProjectProfile"); - legacyProfiles.put("cdt.managedbuild.tool.xlc.cpp.c.compiler.input", "org.eclipse.cdt.managedbuilder.xlc.core.XLCManagedMakePerProjectProfile"); - legacyProfiles.put("cdt.managedbuild.tool.xlc.cpp.compiler.input", "org.eclipse.cdt.managedbuilder.xlc.core.XLCManagedMakePerProjectProfileCPP"); - - // Toolchains - } - - return legacyProfiles.get(id); - } - -} +/******************************************************************************* + * Copyright (c) 2009, 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 + * Sergey Prigogin (Google) + *******************************************************************************/ + +package org.eclipse.cdt.core.language.settings.providers; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.eclipse.cdt.core.CCorePlugin; +import org.eclipse.cdt.core.model.CoreModel; +import org.eclipse.cdt.core.settings.model.ICConfigurationDescription; +import org.eclipse.cdt.core.settings.model.ICProjectDescription; +import org.eclipse.cdt.internal.core.LocalProjectScope; +import org.eclipse.cdt.internal.core.language.settings.providers.ReferencedProjectsLanguageSettingsProvider; +import org.eclipse.cdt.internal.core.language.settings.providers.ScannerInfoExtensionLanguageSettingsProvider; +import org.eclipse.cdt.internal.core.model.PathEntryManager; +import org.eclipse.cdt.internal.core.settings.model.CProjectDescriptionManager; +import org.eclipse.core.resources.IProject; +import org.eclipse.core.runtime.preferences.InstanceScope; +import org.osgi.service.prefs.BackingStoreException; +import org.osgi.service.prefs.Preferences; + +/** + * Collection of utilities for legacy support of older Scanner Discovery functionality. + * This class is temporary and not intended to be used by clients. + * + * @noextend This class is not intended to be subclassed by clients. + * @noinstantiate This class is not intended to be instantiated by clients. + * + * @since 5.4 + */ +public class ScannerDiscoveryLegacySupport { + /** ID of User language settings provider (from org.eclipse.cdt.ui) */ + public static final String USER_LANGUAGE_SETTINGS_PROVIDER_ID = "org.eclipse.cdt.ui.UserLanguageSettingsProvider"; //$NON-NLS-1$ + /** ID of MBS language settings provider (from org.eclipse.cdt.managedbuilder.core) */ + public static final String MBS_LANGUAGE_SETTINGS_PROVIDER_ID = "org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider"; //$NON-NLS-1$ + + /** + * ID of ScannerInfo language settings provider wrapping ScannerInfoProvider defined by org.eclipse.cdt.core.ScannerInfoProvider extension point + * @since 5.5 + */ + public static final String SI_LANGUAGE_SETTINGS_PROVIDER_ID = "org.eclipse.cdt.core.LegacyScannerInfoLanguageSettingsProvider"; //$NON-NLS-1$ + + /** + * ID of language settings provider wrapping {@link org.eclipse.cdt.core.resources.ScannerProvider} of {@link PathEntryManager} for 3.X projects + * @since 5.5 + */ + public static final String PATH_ENTRY_MANAGER_LANGUAGE_SETTINGS_PROVIDER_ID = "org.eclipse.cdt.core.PathEntryScannerInfoLanguageSettingsProvider"; //$NON-NLS-1$ + + private static String DISABLE_LSP_PREFERENCE = "language.settings.providers.disabled"; //$NON-NLS-1$ + private static boolean DISABLE_LSP_DEFAULT_PROJECT = false; + private static boolean DISABLE_LSP_DEFAULT_WORKSPACE = false; + private static final String PREFERENCES_QUALIFIER_CCORE = CCorePlugin.PLUGIN_ID; + + private static Map legacyProfiles = null; + + /** + * Get preferences node for org.eclipse.cdt.core. + * + * @param project - project to get preferences or {@code null} for workspace preferences + * @return + */ + private static Preferences getPreferences(IProject project) { + if (project == null) { + return InstanceScope.INSTANCE.getNode(PREFERENCES_QUALIFIER_CCORE); + } else { + return new LocalProjectScope(project).getNode(PREFERENCES_QUALIFIER_CCORE); + } + } + + /** + * Checks if Language Settings functionality is defined for given project in preferences. + * + * @param project - project to check the preference or {@code null} for workspace preference + * @return {@code true} if functionality is defined + * + * @noreference This method is temporary and not intended to be referenced by clients. + * + * @since 5.5 + */ + public static boolean isLanguageSettingsProvidersFunctionalityDefined(IProject project) { + Preferences pref = getPreferences(project); + String value = pref.get(DISABLE_LSP_PREFERENCE, null); + return value != null; + } + + /** + * Checks if Language Settings functionality is enabled for given project. + * Note that disabling on workspace level will disable it for all projects. + * + * @param project - project to check the preference or {@code null} for workspace preference + * @return {@code true} if functionality is enabled + * + * @noreference This method is temporary and not intended to be referenced by clients. + */ + public static boolean isLanguageSettingsProvidersFunctionalityEnabled(IProject project) { + boolean isEnabledInWorkspace = !getPreferences(null).getBoolean(DISABLE_LSP_PREFERENCE, DISABLE_LSP_DEFAULT_WORKSPACE); + if (isEnabledInWorkspace && project != null) { + return !getPreferences(project).getBoolean(DISABLE_LSP_PREFERENCE, DISABLE_LSP_DEFAULT_PROJECT); + } + return isEnabledInWorkspace; + } + + /** + * Enable/disable Language Settings functionality for the given project. + * + * @param project or {@code null} for workspace preference + * @param value {@code true} to enable or {@code false} to disable the functionality. + * + * @noreference This method is temporary and not intended to be referenced by clients. + */ + public static void setLanguageSettingsProvidersFunctionalityEnabled(IProject project, boolean value) { + Preferences pref = getPreferences(project); + if (value == isLanguageSettingsProvidersFunctionalityEnabled(project)) + return; + pref.putBoolean(DISABLE_LSP_PREFERENCE, !value); + // Scanner info provider have changed - clear the cached copy (http://bugs.eclipse.org/413357). + CCorePlugin.getDefault().resetCachedScannerInfoProvider(project); + try { + pref.flush(); + } catch (BackingStoreException e) { + CCorePlugin.log(e); + } + } + + /** + * Check if legacy Scanner Discovery in MBS should be active. + * @noreference This is internal helper method to support compatibility with previous versions + * which is not intended to be referenced by clients. + */ + public static boolean isMbsLanguageSettingsProviderOn(ICConfigurationDescription cfgDescription) { + if (cfgDescription instanceof ILanguageSettingsProvidersKeeper) { + List lsProviders = ((ILanguageSettingsProvidersKeeper) cfgDescription).getLanguageSettingProviders(); + for (ILanguageSettingsProvider lsp : lsProviders) { + if (MBS_LANGUAGE_SETTINGS_PROVIDER_ID.equals(lsp.getId())) { + return true; + } + } + } + return false; + } + + /** + * Check if legacy Scanner Discovery should be active. + * which is not intended to be referenced by clients. + */ + private static boolean isLegacyProviderOn(ICConfigurationDescription cfgDescription) { + if (cfgDescription instanceof ILanguageSettingsProvidersKeeper) { + List lsProviders = ((ILanguageSettingsProvidersKeeper) cfgDescription).getLanguageSettingProviders(); + for (ILanguageSettingsProvider lsp : lsProviders) { + String id = lsp.getId(); + if (MBS_LANGUAGE_SETTINGS_PROVIDER_ID.equals(id) || SI_LANGUAGE_SETTINGS_PROVIDER_ID.equals(id) || PATH_ENTRY_MANAGER_LANGUAGE_SETTINGS_PROVIDER_ID.equals(id)) { + return true; + } + } + } + return false; + } + + /** + * @noreference This is internal helper method to support compatibility with previous versions + * which is not intended to be referenced by clients. + */ + public static boolean isLegacyScannerDiscoveryOn(ICConfigurationDescription cfgDescription) { + IProject project = null; + if (cfgDescription != null) { + ICProjectDescription prjDescription = cfgDescription.getProjectDescription(); + if (prjDescription != null) { + project = prjDescription.getProject(); + } + } + return !isLanguageSettingsProvidersFunctionalityEnabled(project) || isLegacyProviderOn(cfgDescription); + } + + /** + * @noreference This is internal helper method to support compatibility with previous versions + * which is not intended to be referenced by clients. + */ + public static boolean isLegacyScannerDiscoveryOn(IProject project) { + ICConfigurationDescription cfgDescription = null; + ICProjectDescription prjDescription = CoreModel.getDefault().getProjectDescription(project); + if (prjDescription != null) { + cfgDescription = prjDescription.getActiveConfiguration(); + } + return !isLanguageSettingsProvidersFunctionalityEnabled(project) || isLegacyProviderOn(cfgDescription); + } + + /** + * Return list containing User provider and one of wrapper providers to support legacy projects (backward compatibility). + * + * @noreference This is internal helper method to support compatibility with previous versions + * which is not intended to be referenced by clients. + * @since 5.5 + */ + public static String[] getDefaultProviderIdsLegacy(ICConfigurationDescription cfgDescription) { + boolean useScannerInfoProviderExtension = new ScannerInfoExtensionLanguageSettingsProvider().getScannerInfoProvider(cfgDescription) != null; + String legacyProviderId; + if (useScannerInfoProviderExtension) { + legacyProviderId = SI_LANGUAGE_SETTINGS_PROVIDER_ID; + } else if (CProjectDescriptionManager.getInstance().isNewStyleCfg(cfgDescription)) { + legacyProviderId = MBS_LANGUAGE_SETTINGS_PROVIDER_ID; + } else { + legacyProviderId = PATH_ENTRY_MANAGER_LANGUAGE_SETTINGS_PROVIDER_ID; + } + + return new String[] {USER_LANGUAGE_SETTINGS_PROVIDER_ID, ReferencedProjectsLanguageSettingsProvider.ID, legacyProviderId}; + } + + /** + * Checks if the provider is applicable for configuration from backward compatibility point of view + * + * @noreference This is internal helper method to support compatibility with previous versions + * which is not intended to be referenced by clients. + * @since 5.5 + */ + public static boolean isProviderCompatible(String providerId, ICConfigurationDescription cfgDescription) { + if (cfgDescription != null) { + boolean useScannerInfoProviderExtension = new ScannerInfoExtensionLanguageSettingsProvider().getScannerInfoProvider(cfgDescription) != null; + if (SI_LANGUAGE_SETTINGS_PROVIDER_ID.equals(providerId)) { + return useScannerInfoProviderExtension; + } + + boolean isNewStyleCfg = CProjectDescriptionManager.getInstance().isNewStyleCfg(cfgDescription); + if (MBS_LANGUAGE_SETTINGS_PROVIDER_ID.equals(providerId)) { + return !useScannerInfoProviderExtension && isNewStyleCfg; + } + + if (PATH_ENTRY_MANAGER_LANGUAGE_SETTINGS_PROVIDER_ID.equals(providerId)) { + return !useScannerInfoProviderExtension && !isNewStyleCfg; + } + } + + return true; + } + + /** + * If not defined yet, define property that controls if language settings providers functionality enabled for a given project. + * Workspace preference is checked and the project property is set to match it. + * + * @param project - project to define enablement. + * @since 5.5 + */ + public static void defineLanguageSettingsEnablement(IProject project) { + if (project != null && ! ScannerDiscoveryLegacySupport.isLanguageSettingsProvidersFunctionalityDefined(project)) { + boolean isPreferenceEnabled = ScannerDiscoveryLegacySupport.isLanguageSettingsProvidersFunctionalityEnabled(null); + ScannerDiscoveryLegacySupport.setLanguageSettingsProvidersFunctionalityEnabled(project, isPreferenceEnabled); + } + } + + /** + * Returns the values of scanner discovery profiles (scannerConfigDiscoveryProfileId) which were deprecated + * and replaced with language settings providers in plugin.xml. + * This (temporary) function serves as fail-safe switch during the transition. + * + * @param id - can be id of either org.eclipse.cdt.managedbuilder.internal.core.InputType + * or org.eclipse.cdt.managedbuilder.internal.core.ToolChain. + * @return legacy scannerConfigDiscoveryProfileId. + */ + @SuppressWarnings("nls") + public static String getDeprecatedLegacyProfiles(String id) { + if (legacyProfiles == null) { + legacyProfiles = new HashMap(); + + // InputTypes + legacyProfiles.put("cdt.managedbuild.tool.gnu.c.compiler.input", "org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileC|org.eclipse.cdt.make.core.GCCStandardMakePerFileProfile"); + legacyProfiles.put("cdt.managedbuild.tool.gnu.cpp.compiler.input", "org.eclipse.cdt.managedbuilder.core.GCCManagedMakePerProjectProfileCPP|org.eclipse.cdt.make.core.GCCStandardMakePerFileProfile"); + legacyProfiles.put("cdt.managedbuild.tool.gnu.c.compiler.input.cygwin", "org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileC"); + legacyProfiles.put("cdt.managedbuild.tool.gnu.cpp.compiler.input.cygwin", "org.eclipse.cdt.managedbuilder.core.GCCWinManagedMakePerProjectProfileCPP"); + legacyProfiles.put("cdt.managedbuild.tool.xlc.c.compiler.input", "org.eclipse.cdt.managedbuilder.xlc.core.XLCManagedMakePerProjectProfile"); + legacyProfiles.put("cdt.managedbuild.tool.xlc.cpp.c.compiler.input", "org.eclipse.cdt.managedbuilder.xlc.core.XLCManagedMakePerProjectProfile"); + legacyProfiles.put("cdt.managedbuild.tool.xlc.cpp.compiler.input", "org.eclipse.cdt.managedbuilder.xlc.core.XLCManagedMakePerProjectProfileCPP"); + + // Toolchains + } + + return legacyProfiles.get(id); + } + +} diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/ICElement.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/ICElement.java index 1cb99ec7ee5..be3ed312b7b 100644 --- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/ICElement.java +++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/model/ICElement.java @@ -1,437 +1,437 @@ -/******************************************************************************* - * Copyright (c) 2000, 2014 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 - * Markus Schorn (Wind River Systems) - * Anton Leherbauer (Wind River Systems) +/******************************************************************************* + * Copyright (c) 2000, 2014 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 + * Markus Schorn (Wind River Systems) + * Anton Leherbauer (Wind River Systems) *******************************************************************************/ -package org.eclipse.cdt.core.model; - -import java.net.URI; - -import org.eclipse.core.resources.IResource; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.IPath; - -/** - * Common protocol for all elements provided by the C model. - * - * @noextend This interface is not intended to be extended by clients. - * @noimplement This interface is not intended to be implemented by clients. - */ -public interface ICElement extends IAdaptable { - /** @since 5.6 */ - public static final ICElement[] EMPTY_ARRAY = {}; - - /** - * IResource from 10-20 - */ - - /** - * Constant representing a C Root workspace (IWorkspaceRoot object). - * A C element with this type can be safely cast to ICModel. - */ - static final int C_MODEL = 10; - - /** - * Constant representing a C project (IProject object). - * A C element with this type can be safely cast to ICProject. - */ - static final int C_PROJECT = 11; - - /** - * Constant representing a folder (ICContainer object). - * A C element with this type can be safely cast to ICContainer. - */ - static final int C_CCONTAINER = 12; - - static final int C_BINARY = 14; - - static final int C_ARCHIVE = 18; - /** - * Virtual container serving as a place holder. - */ - static final int C_VCONTAINER = 30; - - /** - * Constant representing a C/C++ children of a Translation Unit - */ - static final int C_UNIT = 60; - - /** - * Namespace. - */ - static final int C_NAMESPACE = 61; - - /** - * Using. - */ - static final int C_USING = 62; - - /** - * Enumeration. - */ - static final int C_ENUMERATION = 63; - - /** - * Declaration of a class without the definition. - * class C; - */ - static final int C_CLASS_DECLARATION = 64; - - /** - * Constant representing a class structure. - */ - static final int C_CLASS = 65; - - /** - * Declaration of a structure without the definition. - * struct C; - */ - static final int C_STRUCT_DECLARATION = 66; - - /** - * Constant representing a struct structure. - */ - static final int C_STRUCT = 67; - - /** - * Declaration of a union without the definition. - * struct C; - */ - static final int C_UNION_DECLARATION = 68; - - /** - * Constant representing a union structure. - */ - static final int C_UNION = 69; - - /** - * A method definition part of a structure(class, struct, union). - */ - static final int C_METHOD = 70; - - /** - * A method declaration part of a structure(class, struct, union). - */ - static final int C_METHOD_DECLARATION = 71; - - /** - * A Field definition part of a structure(class, struct, union). - */ - static final int C_FIELD = 72; - - /** - * a C/C++ function prototype. - */ - static final int C_FUNCTION_DECLARATION = 73; - - /** - * a C/C++ function definition. - */ - static final int C_FUNCTION = 74; - - /** - * Preprocessor #include directive. - */ - static final int C_INCLUDE = 75; - - /** - * Global variable. - */ - static final int C_VARIABLE = 76; - - /** - * variable Declaration. - */ - static final int C_VARIABLE_DECLARATION = 77; - - /** - * Local Variable. - */ - static final int C_VARIABLE_LOCAL = 78; - - /** - * A preprocessor macro. - */ - static final int C_MACRO = 79; - - /** - * a Typedef. - */ - static final int C_TYPEDEF = 80; - - /** - * Enumerator. - */ - static final int C_ENUMERATOR = 81; - - /** - * C++ template class declaration without a definition. - */ - static final int C_TEMPLATE_CLASS_DECLARATION = 82; - - /** - * C++ template class with definition. - */ - static final int C_TEMPLATE_CLASS = 83; - - /** - * C++ template struct. - */ - static final int C_TEMPLATE_STRUCT_DECLARATION = 84; - - /** - * C++ template struct. - */ - static final int C_TEMPLATE_STRUCT = 85; - - /** - * C++ template union. - */ - static final int C_TEMPLATE_UNION_DECLARATION = 86; - - /** - * C++ template union. - */ - static final int C_TEMPLATE_UNION = 87; - - /** - * C++ template function declaration. - */ - static final int C_TEMPLATE_FUNCTION_DECLARATION = 88; - - /** - * C++ template function. - */ - static final int C_TEMPLATE_FUNCTION = 89; - - /** - * C++ template method. - */ - static final int C_TEMPLATE_METHOD_DECLARATION = 90; - - /** - * C++ template method. - */ - static final int C_TEMPLATE_METHOD = 91; - - /** - * C++ template variable. - */ - static final int C_TEMPLATE_VARIABLE = 92; - - /** - * An unknown ICElement. Mainly used to determine what elements are not yet implemented. - * i.e. the new DOM Parser supports open declaration on labels, while the old parser did not - */ - static final int C_UNKNOWN_DECLARATION = 93; - - /** - * Assembly label. - * - * @since 5.0 - */ - static final int ASM_LABEL= 94; - - /** - * @deprecated use {@link IMethodDeclaration#isConstructor()} - * @noreference This field is not intended to be referenced by clients. - */ - @Deprecated - static final int C_CLASS_CTOR = 0x100; - - /** - * @deprecated use {@link IMethodDeclaration#isDestructor()} - * @noreference This field is not intended to be referenced by clients. - */ - @Deprecated - static final int C_CLASS_DTOR = 0x200; - - /** - * @deprecated use {@link IDeclaration#isStatic()} - * @noreference This field is not intended to be referenced by clients. - */ - @Deprecated - static final int C_STORAGE_STATIC = 0x400; - - /** - * @deprecated not used anymore - * @noreference This field is not intended to be referenced by clients. - */ - @Deprecated - static final int C_STORAGE_EXTERN = 0x800; - - /** - * @deprecated use {@link IMember#getVisibility()} - * @noreference This field is not intended to be referenced by clients. - */ - @Deprecated - static final int CPP_PRIVATE = 0x1000; - - /** - * @deprecated use {@link IMember#getVisibility()} - * @noreference This field is not intended to be referenced by clients. - */ - @Deprecated - static final int CPP_PUBLIC = 0x2000; - - /** - * @deprecated use {@link IMember#getVisibility()} - * @noreference This field is not intended to be referenced by clients. - */ - @Deprecated - static final int CPP_PROTECTED = 0x4000; - /** - * @deprecated use {@link IMethodDeclaration#isFriend()} - * @noreference This field is not intended to be referenced by clients. - */ - @Deprecated - static final int CPP_FRIEND = 0x8000; - - /** - * Returns whether this C element exists in the model. - * - * @return {@code true} if this element exists in the C model - */ - boolean exists(); - - /** - * Returns the first ancestor of this C element that has the given type. - * Returns {@code null} if no such an ancestor can be found. - * This is a handle-only method. - * - * @param ancestorType the given type - * @return the first ancestor of this C element that has the given type, {@code null} if no such - * an ancestor can be found - * @since 2.0 - */ - ICElement getAncestor(int ancestorType); - - /** - * Returns the name of this element. - * - * @return the element name - */ - String getElementName(); - - /** - * Returns this element's kind encoded as an integer. - * This is a handle-only method. - * - * @return the kind of element; one of the constants declared in {@link ICElement} - */ - int getElementType(); - - /** - * Returns the C model. - * - * @return the C model - */ - ICModel getCModel(); - - /** - * Returns the C project this element is contained in, or {@code null} if this element - * is not contained in any C project - * - * @return the containing C project, or {@code null} if this element is - * not contained in a C project - */ - ICProject getCProject(); - - /** - * Returns the element directly containing this element, - * or {@code null} if this element has no parent. - * - * @return the parent element, or {@code null} if this element has no parent - */ - ICElement getParent(); - - /** - * Returns the path to the innermost resource enclosing this element. - * If this element is not included in an external archive, - * the path returned is the full, absolute path to the underlying resource, - * relative to the workbench. - * If this element is included in an external archive, - * the path returned is the absolute path to the archive in the file system. - * This is a handle-only method. - */ - IPath getPath(); - - /** - * Returns an absolute URI corresponding to the innermost file enclosing this element. - * - * @since 5.0 - * @return the URI corresponding to the location - */ - URI getLocationURI(); - - /** - * Returns the underlying resource that contains this element, or {@code null} if this element - * is not contained in a resource. - * - * @return the underlying resource, or {@code null} if none - */ - IResource getUnderlyingResource(); - - /** - * Returns the corresponding resource for this element, or {@code null} if this element - * does not have a corresponding resource. - * - * @return the corresponding resource, or {@code null} if none - */ - IResource getResource(); - - /** - * Returns whether this C element is read-only. An element is read-only - * if its structure cannot be modified by the C model. - * - * @return {@code true} if this element is read-only - */ - boolean isReadOnly(); - - /** - * Returns whether the structure of this element is known. For example, for a - * translation unit that could not be parsed, {@code false} is returned. - * If the structure of an element is unknown, navigations will return reasonable - * defaults. For example, {@code getChildren} will return an empty collection. - *

- * Note: This does not imply anything about consistency with the - * underlying resource/buffer contents. - * - * @return {@code true} if the structure of this element is known - * @exception CModelException if this element does not exist or if an - * exception occurs while accessing its corresponding resource - */ - boolean isStructureKnown() throws CModelException; - - /** - * Accept a visitor and walk the ICElement tree with it. - * - * @param visitor - * @throws CModelException - */ - void accept(ICElementVisitor visitor) throws CoreException; - - /** - * Returns a string representation of this element handle. The format of the - * string is not specified; however, the identifier is stable across - * workspace sessions, and can be used to recreate this handle via the - * CoreModel.create(String) method. - *

- * Some element types, like binaries, do not support handle identifiers and - * return {@code null}. - * - * @return the string handle identifier, or {@code null} if the element type is not supported - * @see CoreModel#create(java.lang.String) - * - * @since 5.0 - */ - String getHandleIdentifier(); -} +package org.eclipse.cdt.core.model; + +import java.net.URI; + +import org.eclipse.core.resources.IResource; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.core.runtime.IPath; + +/** + * Common protocol for all elements provided by the C model. + * + * @noextend This interface is not intended to be extended by clients. + * @noimplement This interface is not intended to be implemented by clients. + */ +public interface ICElement extends IAdaptable { + /** @since 5.6 */ + public static final ICElement[] EMPTY_ARRAY = {}; + + /** + * IResource from 10-20 + */ + + /** + * Constant representing a C Root workspace (IWorkspaceRoot object). + * A C element with this type can be safely cast to ICModel. + */ + static final int C_MODEL = 10; + + /** + * Constant representing a C project (IProject object). + * A C element with this type can be safely cast to ICProject. + */ + static final int C_PROJECT = 11; + + /** + * Constant representing a folder (ICContainer object). + * A C element with this type can be safely cast to ICContainer. + */ + static final int C_CCONTAINER = 12; + + static final int C_BINARY = 14; + + static final int C_ARCHIVE = 18; + /** + * Virtual container serving as a place holder. + */ + static final int C_VCONTAINER = 30; + + /** + * Constant representing a C/C++ children of a Translation Unit + */ + static final int C_UNIT = 60; + + /** + * Namespace. + */ + static final int C_NAMESPACE = 61; + + /** + * Using. + */ + static final int C_USING = 62; + + /** + * Enumeration. + */ + static final int C_ENUMERATION = 63; + + /** + * Declaration of a class without the definition. + * class C; + */ + static final int C_CLASS_DECLARATION = 64; + + /** + * Constant representing a class structure. + */ + static final int C_CLASS = 65; + + /** + * Declaration of a structure without the definition. + * struct C; + */ + static final int C_STRUCT_DECLARATION = 66; + + /** + * Constant representing a struct structure. + */ + static final int C_STRUCT = 67; + + /** + * Declaration of a union without the definition. + * struct C; + */ + static final int C_UNION_DECLARATION = 68; + + /** + * Constant representing a union structure. + */ + static final int C_UNION = 69; + + /** + * A method definition part of a structure(class, struct, union). + */ + static final int C_METHOD = 70; + + /** + * A method declaration part of a structure(class, struct, union). + */ + static final int C_METHOD_DECLARATION = 71; + + /** + * A Field definition part of a structure(class, struct, union). + */ + static final int C_FIELD = 72; + + /** + * a C/C++ function prototype. + */ + static final int C_FUNCTION_DECLARATION = 73; + + /** + * a C/C++ function definition. + */ + static final int C_FUNCTION = 74; + + /** + * Preprocessor #include directive. + */ + static final int C_INCLUDE = 75; + + /** + * Global variable. + */ + static final int C_VARIABLE = 76; + + /** + * variable Declaration. + */ + static final int C_VARIABLE_DECLARATION = 77; + + /** + * Local Variable. + */ + static final int C_VARIABLE_LOCAL = 78; + + /** + * A preprocessor macro. + */ + static final int C_MACRO = 79; + + /** + * a Typedef. + */ + static final int C_TYPEDEF = 80; + + /** + * Enumerator. + */ + static final int C_ENUMERATOR = 81; + + /** + * C++ template class declaration without a definition. + */ + static final int C_TEMPLATE_CLASS_DECLARATION = 82; + + /** + * C++ template class with definition. + */ + static final int C_TEMPLATE_CLASS = 83; + + /** + * C++ template struct. + */ + static final int C_TEMPLATE_STRUCT_DECLARATION = 84; + + /** + * C++ template struct. + */ + static final int C_TEMPLATE_STRUCT = 85; + + /** + * C++ template union. + */ + static final int C_TEMPLATE_UNION_DECLARATION = 86; + + /** + * C++ template union. + */ + static final int C_TEMPLATE_UNION = 87; + + /** + * C++ template function declaration. + */ + static final int C_TEMPLATE_FUNCTION_DECLARATION = 88; + + /** + * C++ template function. + */ + static final int C_TEMPLATE_FUNCTION = 89; + + /** + * C++ template method. + */ + static final int C_TEMPLATE_METHOD_DECLARATION = 90; + + /** + * C++ template method. + */ + static final int C_TEMPLATE_METHOD = 91; + + /** + * C++ template variable. + */ + static final int C_TEMPLATE_VARIABLE = 92; + + /** + * An unknown ICElement. Mainly used to determine what elements are not yet implemented. + * i.e. the new DOM Parser supports open declaration on labels, while the old parser did not + */ + static final int C_UNKNOWN_DECLARATION = 93; + + /** + * Assembly label. + * + * @since 5.0 + */ + static final int ASM_LABEL= 94; + + /** + * @deprecated use {@link IMethodDeclaration#isConstructor()} + * @noreference This field is not intended to be referenced by clients. + */ + @Deprecated + static final int C_CLASS_CTOR = 0x100; + + /** + * @deprecated use {@link IMethodDeclaration#isDestructor()} + * @noreference This field is not intended to be referenced by clients. + */ + @Deprecated + static final int C_CLASS_DTOR = 0x200; + + /** + * @deprecated use {@link IDeclaration#isStatic()} + * @noreference This field is not intended to be referenced by clients. + */ + @Deprecated + static final int C_STORAGE_STATIC = 0x400; + + /** + * @deprecated not used anymore + * @noreference This field is not intended to be referenced by clients. + */ + @Deprecated + static final int C_STORAGE_EXTERN = 0x800; + + /** + * @deprecated use {@link IMember#getVisibility()} + * @noreference This field is not intended to be referenced by clients. + */ + @Deprecated + static final int CPP_PRIVATE = 0x1000; + + /** + * @deprecated use {@link IMember#getVisibility()} + * @noreference This field is not intended to be referenced by clients. + */ + @Deprecated + static final int CPP_PUBLIC = 0x2000; + + /** + * @deprecated use {@link IMember#getVisibility()} + * @noreference This field is not intended to be referenced by clients. + */ + @Deprecated + static final int CPP_PROTECTED = 0x4000; + /** + * @deprecated use {@link IMethodDeclaration#isFriend()} + * @noreference This field is not intended to be referenced by clients. + */ + @Deprecated + static final int CPP_FRIEND = 0x8000; + + /** + * Returns whether this C element exists in the model. + * + * @return {@code true} if this element exists in the C model + */ + boolean exists(); + + /** + * Returns the first ancestor of this C element that has the given type. + * Returns {@code null} if no such an ancestor can be found. + * This is a handle-only method. + * + * @param ancestorType the given type + * @return the first ancestor of this C element that has the given type, {@code null} if no such + * an ancestor can be found + * @since 2.0 + */ + ICElement getAncestor(int ancestorType); + + /** + * Returns the name of this element. + * + * @return the element name + */ + String getElementName(); + + /** + * Returns this element's kind encoded as an integer. + * This is a handle-only method. + * + * @return the kind of element; one of the constants declared in {@link ICElement} + */ + int getElementType(); + + /** + * Returns the C model. + * + * @return the C model + */ + ICModel getCModel(); + + /** + * Returns the C project this element is contained in, or {@code null} if this element + * is not contained in any C project + * + * @return the containing C project, or {@code null} if this element is + * not contained in a C project + */ + ICProject getCProject(); + + /** + * Returns the element directly containing this element, + * or {@code null} if this element has no parent. + * + * @return the parent element, or {@code null} if this element has no parent + */ + ICElement getParent(); + + /** + * Returns the path to the innermost resource enclosing this element. + * If this element is not included in an external archive, + * the path returned is the full, absolute path to the underlying resource, + * relative to the workbench. + * If this element is included in an external archive, + * the path returned is the absolute path to the archive in the file system. + * This is a handle-only method. + */ + IPath getPath(); + + /** + * Returns an absolute URI corresponding to the innermost file enclosing this element. + * + * @since 5.0 + * @return the URI corresponding to the location + */ + URI getLocationURI(); + + /** + * Returns the underlying resource that contains this element, or {@code null} if this element + * is not contained in a resource. + * + * @return the underlying resource, or {@code null} if none + */ + IResource getUnderlyingResource(); + + /** + * Returns the corresponding resource for this element, or {@code null} if this element + * does not have a corresponding resource. + * + * @return the corresponding resource, or {@code null} if none + */ + IResource getResource(); + + /** + * Returns whether this C element is read-only. An element is read-only + * if its structure cannot be modified by the C model. + * + * @return {@code true} if this element is read-only + */ + boolean isReadOnly(); + + /** + * Returns whether the structure of this element is known. For example, for a + * translation unit that could not be parsed, {@code false} is returned. + * If the structure of an element is unknown, navigations will return reasonable + * defaults. For example, {@code getChildren} will return an empty collection. + *

+ * Note: This does not imply anything about consistency with the + * underlying resource/buffer contents. + * + * @return {@code true} if the structure of this element is known + * @exception CModelException if this element does not exist or if an + * exception occurs while accessing its corresponding resource + */ + boolean isStructureKnown() throws CModelException; + + /** + * Accept a visitor and walk the ICElement tree with it. + * + * @param visitor + * @throws CModelException + */ + void accept(ICElementVisitor visitor) throws CoreException; + + /** + * Returns a string representation of this element handle. The format of the + * string is not specified; however, the identifier is stable across + * workspace sessions, and can be used to recreate this handle via the + * CoreModel.create(String) method. + *

+ * Some element types, like binaries, do not support handle identifiers and + * return {@code null}. + * + * @return the string handle identifier, or {@code null} if the element type is not supported + * @see CoreModel#create(java.lang.String) + * + * @since 5.0 + */ + String getHandleIdentifier(); +} diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/settings/model/ICFileDescription.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/settings/model/ICFileDescription.java index 74fef6b7267..298098dd9e0 100644 --- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/settings/model/ICFileDescription.java +++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/core/settings/model/ICFileDescription.java @@ -1,15 +1,15 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Intel 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: - * Intel Corporation - Initial API and implementation +/******************************************************************************* + * Copyright (c) 2007, 2010 Intel 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: + * Intel Corporation - Initial API and implementation *******************************************************************************/ -package org.eclipse.cdt.core.settings.model; - -public interface ICFileDescription extends ICResourceDescription { - ICLanguageSetting getLanguageSetting(); -} +package org.eclipse.cdt.core.settings.model; + +public interface ICFileDescription extends ICResourceDescription { + ICLanguageSetting getLanguageSetting(); +} diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/language/settings/providers/LanguageSettingsDelta.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/language/settings/providers/LanguageSettingsDelta.java index 5aef3614481..282be48054b 100644 --- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/language/settings/providers/LanguageSettingsDelta.java +++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/language/settings/providers/LanguageSettingsDelta.java @@ -1,116 +1,116 @@ -/******************************************************************************* - * 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.internal.core.language.settings.providers; - -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Set; -import java.util.TreeSet; - -import org.eclipse.cdt.core.language.settings.providers.LanguageSettingsStorage; -import org.eclipse.cdt.core.settings.model.ICLanguageSettingEntry; - - -/** - * Contains the delta of changes that occurred as a result of modifying - * language settings entries {@link ICLanguageSettingEntry}. The delta is - * associated with a configuration description. - * - *

- * EXPERIMENTAL. This class interface is not stable yet as - * it is not currently clear how it may need to be used in future. Only bare - * minimum is provided here at this point (CDT 8.1, Juno). - * There is no guarantee that this API will work or that it will remain the same. - * Please do not use this API without consulting with the CDT team. - *

- * - * @noextend This interface is not intended to be extended by clients. - * @noinstantiate This class is not intended to be instantiated by clients. - */ -public class LanguageSettingsDelta { - // maps are ordered by providers - private LinkedHashMap oldLanguageSettingsState; - private LinkedHashMap newLanguageSettingsState; - - private Set paths = null; - - /** - * Constructor. - * - * @param oldState - old language settings storage state. - * @param newState - new language settings storage state. - */ - public LanguageSettingsDelta(LinkedHashMap oldState, LinkedHashMap newState) { - oldLanguageSettingsState = oldState; - newLanguageSettingsState = newState; - } - - /** - * @return resource paths affected by changes represented by this delta. - */ - public Set getAffectedResourcePaths() { - if (paths != null) { - return paths; - } - - paths = new TreeSet(); - - LanguageSettingsStorage oldCombinedStorage = combineStorage(oldLanguageSettingsState); - LanguageSettingsStorage newCombinedStorage = combineStorage(newLanguageSettingsState); - - for (String lang : oldCombinedStorage.getLanguages()) { - for (String path : oldCombinedStorage.getResourcePaths(lang)) { - if (oldCombinedStorage.getSettingEntries(path, lang) != newCombinedStorage.getSettingEntries(path, lang)) { - if (path == null) { - // add path of the project - path = ""; //$NON-NLS-1$ - } - paths.add(path); - } - } - } - - for (String lang : newCombinedStorage.getLanguages()) { - for (String path : newCombinedStorage.getResourcePaths(lang)) { - if (newCombinedStorage.getSettingEntries(path, lang) != oldCombinedStorage.getSettingEntries(path, lang)) { - if (path == null) { - // add path of the project - path = ""; //$NON-NLS-1$ - } - paths.add(path); - } - } - } - - return paths; - } - - /** - * Language settings entries from different providers can overlap. This method resolves all overlapping - * ones combining entries into one aggregate storage. - */ - private LanguageSettingsStorage combineStorage(LinkedHashMap state) { - LanguageSettingsStorage combinedStore = new LanguageSettingsStorage(); - for (LanguageSettingsStorage providerStore : state.values()) { - for (String lang : providerStore.getLanguages()) { - for (String path : providerStore.getResourcePaths(lang)) { - // provider (store) higher on the list overrides others below - if (combinedStore.getSettingEntries(path, lang) == null) { - List entries = providerStore.getSettingEntries(path, lang); - combinedStore.setSettingEntries(path, lang, entries); - } - } - } - } - - return combinedStore; - } -} +/******************************************************************************* + * 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.internal.core.language.settings.providers; + +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Set; +import java.util.TreeSet; + +import org.eclipse.cdt.core.language.settings.providers.LanguageSettingsStorage; +import org.eclipse.cdt.core.settings.model.ICLanguageSettingEntry; + + +/** + * Contains the delta of changes that occurred as a result of modifying + * language settings entries {@link ICLanguageSettingEntry}. The delta is + * associated with a configuration description. + * + *

+ * EXPERIMENTAL. This class interface is not stable yet as + * it is not currently clear how it may need to be used in future. Only bare + * minimum is provided here at this point (CDT 8.1, Juno). + * There is no guarantee that this API will work or that it will remain the same. + * Please do not use this API without consulting with the CDT team. + *

+ * + * @noextend This interface is not intended to be extended by clients. + * @noinstantiate This class is not intended to be instantiated by clients. + */ +public class LanguageSettingsDelta { + // maps are ordered by providers + private LinkedHashMap oldLanguageSettingsState; + private LinkedHashMap newLanguageSettingsState; + + private Set paths = null; + + /** + * Constructor. + * + * @param oldState - old language settings storage state. + * @param newState - new language settings storage state. + */ + public LanguageSettingsDelta(LinkedHashMap oldState, LinkedHashMap newState) { + oldLanguageSettingsState = oldState; + newLanguageSettingsState = newState; + } + + /** + * @return resource paths affected by changes represented by this delta. + */ + public Set getAffectedResourcePaths() { + if (paths != null) { + return paths; + } + + paths = new TreeSet(); + + LanguageSettingsStorage oldCombinedStorage = combineStorage(oldLanguageSettingsState); + LanguageSettingsStorage newCombinedStorage = combineStorage(newLanguageSettingsState); + + for (String lang : oldCombinedStorage.getLanguages()) { + for (String path : oldCombinedStorage.getResourcePaths(lang)) { + if (oldCombinedStorage.getSettingEntries(path, lang) != newCombinedStorage.getSettingEntries(path, lang)) { + if (path == null) { + // add path of the project + path = ""; //$NON-NLS-1$ + } + paths.add(path); + } + } + } + + for (String lang : newCombinedStorage.getLanguages()) { + for (String path : newCombinedStorage.getResourcePaths(lang)) { + if (newCombinedStorage.getSettingEntries(path, lang) != oldCombinedStorage.getSettingEntries(path, lang)) { + if (path == null) { + // add path of the project + path = ""; //$NON-NLS-1$ + } + paths.add(path); + } + } + } + + return paths; + } + + /** + * Language settings entries from different providers can overlap. This method resolves all overlapping + * ones combining entries into one aggregate storage. + */ + private LanguageSettingsStorage combineStorage(LinkedHashMap state) { + LanguageSettingsStorage combinedStore = new LanguageSettingsStorage(); + for (LanguageSettingsStorage providerStore : state.values()) { + for (String lang : providerStore.getLanguages()) { + for (String path : providerStore.getResourcePaths(lang)) { + // provider (store) higher on the list overrides others below + if (combinedStore.getSettingEntries(path, lang) == null) { + List entries = providerStore.getSettingEntries(path, lang); + combinedStore.setSettingEntries(path, lang, entries); + } + } + } + } + + return combinedStore; + } +} diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/language/settings/providers/LanguageSettingsSerializableStorage.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/language/settings/providers/LanguageSettingsSerializableStorage.java index 5e5cbeea774..a74154de47a 100644 --- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/language/settings/providers/LanguageSettingsSerializableStorage.java +++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/language/settings/providers/LanguageSettingsSerializableStorage.java @@ -1,228 +1,228 @@ -/******************************************************************************* - * 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 +/******************************************************************************* + * 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.internal.core.language.settings.providers; - -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; - -import org.eclipse.cdt.core.language.settings.providers.LanguageSettingsStorage; -import org.eclipse.cdt.core.settings.model.ICLanguageSettingEntry; -import org.eclipse.cdt.core.settings.model.ICSettingEntry; -import org.eclipse.cdt.core.settings.model.util.CDataUtil; -import org.eclipse.cdt.core.settings.model.util.LanguageSettingEntriesSerializer; -import org.eclipse.cdt.internal.core.XmlUtil; -import org.w3c.dom.Element; -import org.w3c.dom.Node; -import org.w3c.dom.NodeList; - -/** - * The class representing persistent storage for language settings entries {@link ICLanguageSettingEntry}. - */ -public class LanguageSettingsSerializableStorage extends LanguageSettingsStorage { - private static final String ELEM_LANGUAGE = "language"; //$NON-NLS-1$ - private static final String ATTR_LANGUAGE_ID = "id"; //$NON-NLS-1$ - private static final String ELEM_RESOURCE = "resource"; //$NON-NLS-1$ - private static final String ATTR_PROJECT_PATH = "project-relative-path"; //$NON-NLS-1$ - - private static final String ELEM_ENTRY = LanguageSettingsExtensionManager.ELEM_ENTRY; - private static final String ATTR_ENTRY_KIND = LanguageSettingsExtensionManager.ATTR_ENTRY_KIND; - private static final String ATTR_ENTRY_NAME = LanguageSettingsExtensionManager.ATTR_ENTRY_NAME; - private static final String ATTR_ENTRY_VALUE = LanguageSettingsExtensionManager.ATTR_ENTRY_VALUE; - private static final String ELEM_ENTRY_FLAG = LanguageSettingsExtensionManager.ELEM_ENTRY_FLAG; - - /** - * Serialize the provider entries under parent XML element. - * - * @param elementProvider - element where to serialize the entries. - */ - public void serializeEntries(Element elementProvider) { - synchronized (fStorage) { - for (Entry>> entryLang : fStorage.entrySet()) { - serializeLanguage(elementProvider, entryLang.getKey(), entryLang.getValue()); - } - } - } - - /** - * Serialize the provider entries for a given language list. - */ - private void serializeLanguage(Element parentElement, String langId, Map> langMap) { - if (langId!=null) { - Element elementLanguage = XmlUtil.appendElement(parentElement, ELEM_LANGUAGE, new String[] {ATTR_LANGUAGE_ID, langId}); - parentElement = elementLanguage; - } - for (Entry> entryRc : langMap.entrySet()) { - serializeResource(parentElement, entryRc.getKey(), entryRc.getValue()); - } - } - - /** - * Serialize the provider entries for a given resource list. - */ - private void serializeResource(Element parentElement, String rcProjectPath, List rcList) { - if (rcProjectPath!=null) { - Element elementRc = XmlUtil.appendElement(parentElement, ELEM_RESOURCE, new String[] {ATTR_PROJECT_PATH, rcProjectPath}); - parentElement = elementRc; - } - serializeSettingEntries(parentElement, rcList); - } - - /** - * Serialize given settings entries. - */ - private void serializeSettingEntries(Element parentElement, List settingEntries) { - for (ICLanguageSettingEntry entry : settingEntries) { - Element elementSettingEntry = XmlUtil.appendElement(parentElement, ELEM_ENTRY, new String[] { - ATTR_ENTRY_KIND, LanguageSettingEntriesSerializer.kindToString(entry.getKind()), - ATTR_ENTRY_NAME, entry.getName(), - }); - switch (entry.getKind()) { - case ICSettingEntry.MACRO: - elementSettingEntry.setAttribute(ATTR_ENTRY_VALUE, entry.getValue()); - break; -// case ICLanguageSettingEntry.LIBRARY_FILE: -// // YAGNI: sourceAttachment fields may need to be covered -// break; - } - int flags = entry.getFlags(); - if (flags != 0) { - // Element elementFlag = - XmlUtil.appendElement(elementSettingEntry, ELEM_ENTRY_FLAG, new String[] { - ATTR_ENTRY_VALUE, LanguageSettingEntriesSerializer.composeFlagsString(entry.getFlags()) - }); - } - } - } - - /** - * Load provider entries from XML provider element. - * - * @param providerNode - parent XML element "provider" where entries are defined. - */ - public void loadEntries(Element providerNode) { - List settings = new ArrayList(); - NodeList nodes = providerNode.getChildNodes(); - for (int i=0;i 0) { - setSettingEntries(null, null, settings); - } - } - - /** - * Load a setting entry from XML element. - */ - private ICLanguageSettingEntry loadSettingEntry(Node parentElement) { - String settingKind = XmlUtil.determineAttributeValue(parentElement, ATTR_ENTRY_KIND); - String settingName = XmlUtil.determineAttributeValue(parentElement, ATTR_ENTRY_NAME); - - NodeList flagNodes = parentElement.getChildNodes(); - int flags = 0; - for (int i=0;i settings = new ArrayList(); - NodeList nodes = parentNode.getChildNodes(); - for (int i=0;i 0) { - setSettingEntries(null, langId, settings); - } - } - - /** - * Load entries defined in resource element. - */ - private void loadResourceElement(Node parentNode, String cfgId, String langId) { - String rcProjectPath = XmlUtil.determineAttributeValue(parentNode, ATTR_PROJECT_PATH); - - List settings = new ArrayList(); - NodeList nodes = parentNode.getChildNodes(); - for (int i=0;i 0) { - setSettingEntries(rcProjectPath, langId, settings); - } - } - - @Override - public LanguageSettingsSerializableStorage clone() throws CloneNotSupportedException { - return (LanguageSettingsSerializableStorage) super.clone(); - } - -} +package org.eclipse.cdt.internal.core.language.settings.providers; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; + +import org.eclipse.cdt.core.language.settings.providers.LanguageSettingsStorage; +import org.eclipse.cdt.core.settings.model.ICLanguageSettingEntry; +import org.eclipse.cdt.core.settings.model.ICSettingEntry; +import org.eclipse.cdt.core.settings.model.util.CDataUtil; +import org.eclipse.cdt.core.settings.model.util.LanguageSettingEntriesSerializer; +import org.eclipse.cdt.internal.core.XmlUtil; +import org.w3c.dom.Element; +import org.w3c.dom.Node; +import org.w3c.dom.NodeList; + +/** + * The class representing persistent storage for language settings entries {@link ICLanguageSettingEntry}. + */ +public class LanguageSettingsSerializableStorage extends LanguageSettingsStorage { + private static final String ELEM_LANGUAGE = "language"; //$NON-NLS-1$ + private static final String ATTR_LANGUAGE_ID = "id"; //$NON-NLS-1$ + private static final String ELEM_RESOURCE = "resource"; //$NON-NLS-1$ + private static final String ATTR_PROJECT_PATH = "project-relative-path"; //$NON-NLS-1$ + + private static final String ELEM_ENTRY = LanguageSettingsExtensionManager.ELEM_ENTRY; + private static final String ATTR_ENTRY_KIND = LanguageSettingsExtensionManager.ATTR_ENTRY_KIND; + private static final String ATTR_ENTRY_NAME = LanguageSettingsExtensionManager.ATTR_ENTRY_NAME; + private static final String ATTR_ENTRY_VALUE = LanguageSettingsExtensionManager.ATTR_ENTRY_VALUE; + private static final String ELEM_ENTRY_FLAG = LanguageSettingsExtensionManager.ELEM_ENTRY_FLAG; + + /** + * Serialize the provider entries under parent XML element. + * + * @param elementProvider - element where to serialize the entries. + */ + public void serializeEntries(Element elementProvider) { + synchronized (fStorage) { + for (Entry>> entryLang : fStorage.entrySet()) { + serializeLanguage(elementProvider, entryLang.getKey(), entryLang.getValue()); + } + } + } + + /** + * Serialize the provider entries for a given language list. + */ + private void serializeLanguage(Element parentElement, String langId, Map> langMap) { + if (langId!=null) { + Element elementLanguage = XmlUtil.appendElement(parentElement, ELEM_LANGUAGE, new String[] {ATTR_LANGUAGE_ID, langId}); + parentElement = elementLanguage; + } + for (Entry> entryRc : langMap.entrySet()) { + serializeResource(parentElement, entryRc.getKey(), entryRc.getValue()); + } + } + + /** + * Serialize the provider entries for a given resource list. + */ + private void serializeResource(Element parentElement, String rcProjectPath, List rcList) { + if (rcProjectPath!=null) { + Element elementRc = XmlUtil.appendElement(parentElement, ELEM_RESOURCE, new String[] {ATTR_PROJECT_PATH, rcProjectPath}); + parentElement = elementRc; + } + serializeSettingEntries(parentElement, rcList); + } + + /** + * Serialize given settings entries. + */ + private void serializeSettingEntries(Element parentElement, List settingEntries) { + for (ICLanguageSettingEntry entry : settingEntries) { + Element elementSettingEntry = XmlUtil.appendElement(parentElement, ELEM_ENTRY, new String[] { + ATTR_ENTRY_KIND, LanguageSettingEntriesSerializer.kindToString(entry.getKind()), + ATTR_ENTRY_NAME, entry.getName(), + }); + switch (entry.getKind()) { + case ICSettingEntry.MACRO: + elementSettingEntry.setAttribute(ATTR_ENTRY_VALUE, entry.getValue()); + break; +// case ICLanguageSettingEntry.LIBRARY_FILE: +// // YAGNI: sourceAttachment fields may need to be covered +// break; + } + int flags = entry.getFlags(); + if (flags != 0) { + // Element elementFlag = + XmlUtil.appendElement(elementSettingEntry, ELEM_ENTRY_FLAG, new String[] { + ATTR_ENTRY_VALUE, LanguageSettingEntriesSerializer.composeFlagsString(entry.getFlags()) + }); + } + } + } + + /** + * Load provider entries from XML provider element. + * + * @param providerNode - parent XML element "provider" where entries are defined. + */ + public void loadEntries(Element providerNode) { + List settings = new ArrayList(); + NodeList nodes = providerNode.getChildNodes(); + for (int i=0;i 0) { + setSettingEntries(null, null, settings); + } + } + + /** + * Load a setting entry from XML element. + */ + private ICLanguageSettingEntry loadSettingEntry(Node parentElement) { + String settingKind = XmlUtil.determineAttributeValue(parentElement, ATTR_ENTRY_KIND); + String settingName = XmlUtil.determineAttributeValue(parentElement, ATTR_ENTRY_NAME); + + NodeList flagNodes = parentElement.getChildNodes(); + int flags = 0; + for (int i=0;i settings = new ArrayList(); + NodeList nodes = parentNode.getChildNodes(); + for (int i=0;i 0) { + setSettingEntries(null, langId, settings); + } + } + + /** + * Load entries defined in resource element. + */ + private void loadResourceElement(Node parentNode, String cfgId, String langId) { + String rcProjectPath = XmlUtil.determineAttributeValue(parentNode, ATTR_PROJECT_PATH); + + List settings = new ArrayList(); + NodeList nodes = parentNode.getChildNodes(); + for (int i=0;i 0) { + setSettingEntries(rcProjectPath, langId, settings); + } + } + + @Override + public LanguageSettingsSerializableStorage clone() throws CloneNotSupportedException { + return (LanguageSettingsSerializableStorage) super.clone(); + } + +} diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/language/settings/providers/PathEntryScannerInfoLanguageSettingsProvider.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/language/settings/providers/PathEntryScannerInfoLanguageSettingsProvider.java index ee3ae24a027..8e390c88644 100644 --- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/language/settings/providers/PathEntryScannerInfoLanguageSettingsProvider.java +++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/language/settings/providers/PathEntryScannerInfoLanguageSettingsProvider.java @@ -1,165 +1,165 @@ -/******************************************************************************* - * 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.internal.core.language.settings.providers; - -import java.util.ArrayList; -import java.util.Comparator; -import java.util.LinkedHashMap; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Map.Entry; -import java.util.Set; -import java.util.TreeSet; - -import org.eclipse.cdt.core.CCorePlugin; -import org.eclipse.cdt.core.language.settings.providers.LanguageSettingsBaseProvider; -import org.eclipse.cdt.core.model.ICProject; -import org.eclipse.cdt.core.model.IContainerEntry; -import org.eclipse.cdt.core.model.IIncludeEntry; -import org.eclipse.cdt.core.model.IIncludeFileEntry; -import org.eclipse.cdt.core.model.ILibraryEntry; -import org.eclipse.cdt.core.model.IMacroEntry; -import org.eclipse.cdt.core.model.IMacroFileEntry; -import org.eclipse.cdt.core.model.IPathEntry; -import org.eclipse.cdt.core.model.IPathEntryContainer; -import org.eclipse.cdt.core.model.IPathEntryContainerExtension; -import org.eclipse.cdt.core.resources.IPathEntryStore; -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.ICSettingEntry; -import org.eclipse.cdt.core.settings.model.util.CDataUtil; -import org.eclipse.cdt.internal.core.model.CModelManager; -import org.eclipse.cdt.internal.core.model.DefaultPathEntryStore; -import org.eclipse.cdt.internal.core.model.PathEntryManager; -import org.eclipse.cdt.internal.core.model.PathEntryUtil; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IPath; - -/** - * Wrapper class intended to provide backward compatibility with ScannerInfo supplied by {@link PathEntryManager}. - */ -public class PathEntryScannerInfoLanguageSettingsProvider extends LanguageSettingsBaseProvider { - @Override - public List getSettingEntries(ICConfigurationDescription cfgDescription, IResource rc, String languageId) { - if (cfgDescription == null) { - return null; - } - ICProjectDescription prjDescription = cfgDescription.getProjectDescription(); - if (prjDescription == null) { - return null; - } - - IProject project = prjDescription.getProject(); - ICProject cproject = CModelManager.getDefault().getCModel().getCProject(project); - IPath projectPath = cproject.getPath(); - - // using map of sets to support specific ordering of entries - LinkedHashMap> pathEntriesMap = new LinkedHashMap>(); - pathEntriesMap.put(IPathEntry.CDT_INCLUDE, new LinkedHashSet()); - // keep macros sorted - pathEntriesMap.put(IPathEntry.CDT_MACRO, new TreeSet(new Comparator() { - @Override - public int compare(IPathEntry macro1, IPathEntry macro2) { - if (macro1 instanceof IMacroEntry && macro2 instanceof IMacroEntry) { - return ((IMacroEntry)macro1).getMacroName().compareTo(((IMacroEntry)macro2).getMacroName()); - } - return 0; - } - })); - pathEntriesMap.put(IPathEntry.CDT_INCLUDE_FILE, new LinkedHashSet()); - pathEntriesMap.put(IPathEntry.CDT_MACRO_FILE, new LinkedHashSet()); - pathEntriesMap.put(IPathEntry.CDT_LIBRARY, new LinkedHashSet()); - - IPathEntryStore pathEntryStore = new DefaultPathEntryStore(project); - int typesMask = IPathEntry.CDT_INCLUDE | IPathEntry.CDT_MACRO | IPathEntry.CDT_INCLUDE_FILE | IPathEntry.CDT_MACRO_FILE | IPathEntry.CDT_LIBRARY; - try { - IPathEntry[] storePathEntries = pathEntryStore.getRawPathEntries(); - for (IPathEntry storePathEntry : storePathEntries) { - if (storePathEntry instanceof IContainerEntry) { - try { - IPathEntryContainer container = PathEntryManager.getDefault().getPathEntryContainer((IContainerEntry) storePathEntry, cproject); - if (container != null) { - IPathEntry[] pathEntries = null; - if (container instanceof IPathEntryContainerExtension) { - pathEntries = ((IPathEntryContainerExtension)container).getPathEntries(rc.getFullPath(), typesMask); - } else { - pathEntries = container.getPathEntries(); - } - if (pathEntries != null) { - for (IPathEntry pathEntry : pathEntries) { - collectPathEntry(pathEntriesMap, projectPath, pathEntry); - } - } - } - } catch (CoreException e) { - CCorePlugin.log(e); - } - } else { - collectPathEntry(pathEntriesMap, projectPath, storePathEntry); - } - } - } catch (CoreException e) { - CCorePlugin.log(e); - } - - Set lsEntries = new LinkedHashSet(); - for (Entry> entrySet : pathEntriesMap.entrySet()) { - Set pathEntries = entrySet.getValue(); - for (IPathEntry pathEntry : pathEntries) { - ICLanguageSettingEntry lsEntry = toLanguageSettingsEntry(pathEntry); - if (lsEntry != null) { - lsEntries.add(lsEntry); - } - } - } - - return LanguageSettingsSerializableStorage.getPooledList(new ArrayList(lsEntries)); - } - - private void collectPathEntry(LinkedHashMap> pathEntriesMap, IPath projectPath, IPathEntry pathEntry) { - switch (pathEntry.getEntryKind()) { - case IPathEntry.CDT_INCLUDE: - case IPathEntry.CDT_MACRO: - case IPathEntry.CDT_INCLUDE_FILE: - case IPathEntry.CDT_MACRO_FILE: - case IPathEntry.CDT_LIBRARY: - IPathEntry resolvedPathEntry = PathEntryUtil.cloneEntryAndExpand(projectPath, pathEntry); - Set set = pathEntriesMap.get(resolvedPathEntry.getEntryKind()); - if (set != null) { - set.add(resolvedPathEntry); - } - } - } - - private ICLanguageSettingEntry toLanguageSettingsEntry(IPathEntry pathEntry) { - switch (pathEntry.getEntryKind()) { - case IPathEntry.CDT_INCLUDE: - IIncludeEntry includeEntry = (IIncludeEntry)pathEntry; - return CDataUtil.createCIncludePathEntry(includeEntry.getFullIncludePath().toOSString(), includeEntry.isSystemInclude() ? 0 : ICSettingEntry.LOCAL); - case IPathEntry.CDT_MACRO: - IMacroEntry macroEntry = (IMacroEntry) pathEntry; - return CDataUtil.createCMacroEntry(macroEntry.getMacroName(), macroEntry.getMacroValue(), 0); - case IPathEntry.CDT_INCLUDE_FILE: - IIncludeFileEntry includeFileEntry = (IIncludeFileEntry) pathEntry; - return CDataUtil.createCIncludeFileEntry(includeFileEntry.getFullIncludeFilePath().toOSString(), 0); - case IPathEntry.CDT_MACRO_FILE: - IMacroFileEntry macroFileEntry = (IMacroFileEntry) pathEntry; - return CDataUtil.createCMacroFileEntry(macroFileEntry.getFullMacroFilePath().toOSString(), 0); - case IPathEntry.CDT_LIBRARY: - ILibraryEntry libraryEntry = (ILibraryEntry) pathEntry; - return CDataUtil.createCLibraryFileEntry(libraryEntry.getFullLibraryPath().toOSString(), 0); - } - return null; - } -} +/******************************************************************************* + * 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.internal.core.language.settings.providers; + +import java.util.ArrayList; +import java.util.Comparator; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map.Entry; +import java.util.Set; +import java.util.TreeSet; + +import org.eclipse.cdt.core.CCorePlugin; +import org.eclipse.cdt.core.language.settings.providers.LanguageSettingsBaseProvider; +import org.eclipse.cdt.core.model.ICProject; +import org.eclipse.cdt.core.model.IContainerEntry; +import org.eclipse.cdt.core.model.IIncludeEntry; +import org.eclipse.cdt.core.model.IIncludeFileEntry; +import org.eclipse.cdt.core.model.ILibraryEntry; +import org.eclipse.cdt.core.model.IMacroEntry; +import org.eclipse.cdt.core.model.IMacroFileEntry; +import org.eclipse.cdt.core.model.IPathEntry; +import org.eclipse.cdt.core.model.IPathEntryContainer; +import org.eclipse.cdt.core.model.IPathEntryContainerExtension; +import org.eclipse.cdt.core.resources.IPathEntryStore; +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.ICSettingEntry; +import org.eclipse.cdt.core.settings.model.util.CDataUtil; +import org.eclipse.cdt.internal.core.model.CModelManager; +import org.eclipse.cdt.internal.core.model.DefaultPathEntryStore; +import org.eclipse.cdt.internal.core.model.PathEntryManager; +import org.eclipse.cdt.internal.core.model.PathEntryUtil; +import org.eclipse.core.resources.IProject; +import org.eclipse.core.resources.IResource; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IPath; + +/** + * Wrapper class intended to provide backward compatibility with ScannerInfo supplied by {@link PathEntryManager}. + */ +public class PathEntryScannerInfoLanguageSettingsProvider extends LanguageSettingsBaseProvider { + @Override + public List getSettingEntries(ICConfigurationDescription cfgDescription, IResource rc, String languageId) { + if (cfgDescription == null) { + return null; + } + ICProjectDescription prjDescription = cfgDescription.getProjectDescription(); + if (prjDescription == null) { + return null; + } + + IProject project = prjDescription.getProject(); + ICProject cproject = CModelManager.getDefault().getCModel().getCProject(project); + IPath projectPath = cproject.getPath(); + + // using map of sets to support specific ordering of entries + LinkedHashMap> pathEntriesMap = new LinkedHashMap>(); + pathEntriesMap.put(IPathEntry.CDT_INCLUDE, new LinkedHashSet()); + // keep macros sorted + pathEntriesMap.put(IPathEntry.CDT_MACRO, new TreeSet(new Comparator() { + @Override + public int compare(IPathEntry macro1, IPathEntry macro2) { + if (macro1 instanceof IMacroEntry && macro2 instanceof IMacroEntry) { + return ((IMacroEntry)macro1).getMacroName().compareTo(((IMacroEntry)macro2).getMacroName()); + } + return 0; + } + })); + pathEntriesMap.put(IPathEntry.CDT_INCLUDE_FILE, new LinkedHashSet()); + pathEntriesMap.put(IPathEntry.CDT_MACRO_FILE, new LinkedHashSet()); + pathEntriesMap.put(IPathEntry.CDT_LIBRARY, new LinkedHashSet()); + + IPathEntryStore pathEntryStore = new DefaultPathEntryStore(project); + int typesMask = IPathEntry.CDT_INCLUDE | IPathEntry.CDT_MACRO | IPathEntry.CDT_INCLUDE_FILE | IPathEntry.CDT_MACRO_FILE | IPathEntry.CDT_LIBRARY; + try { + IPathEntry[] storePathEntries = pathEntryStore.getRawPathEntries(); + for (IPathEntry storePathEntry : storePathEntries) { + if (storePathEntry instanceof IContainerEntry) { + try { + IPathEntryContainer container = PathEntryManager.getDefault().getPathEntryContainer((IContainerEntry) storePathEntry, cproject); + if (container != null) { + IPathEntry[] pathEntries = null; + if (container instanceof IPathEntryContainerExtension) { + pathEntries = ((IPathEntryContainerExtension)container).getPathEntries(rc.getFullPath(), typesMask); + } else { + pathEntries = container.getPathEntries(); + } + if (pathEntries != null) { + for (IPathEntry pathEntry : pathEntries) { + collectPathEntry(pathEntriesMap, projectPath, pathEntry); + } + } + } + } catch (CoreException e) { + CCorePlugin.log(e); + } + } else { + collectPathEntry(pathEntriesMap, projectPath, storePathEntry); + } + } + } catch (CoreException e) { + CCorePlugin.log(e); + } + + Set lsEntries = new LinkedHashSet(); + for (Entry> entrySet : pathEntriesMap.entrySet()) { + Set pathEntries = entrySet.getValue(); + for (IPathEntry pathEntry : pathEntries) { + ICLanguageSettingEntry lsEntry = toLanguageSettingsEntry(pathEntry); + if (lsEntry != null) { + lsEntries.add(lsEntry); + } + } + } + + return LanguageSettingsSerializableStorage.getPooledList(new ArrayList(lsEntries)); + } + + private void collectPathEntry(LinkedHashMap> pathEntriesMap, IPath projectPath, IPathEntry pathEntry) { + switch (pathEntry.getEntryKind()) { + case IPathEntry.CDT_INCLUDE: + case IPathEntry.CDT_MACRO: + case IPathEntry.CDT_INCLUDE_FILE: + case IPathEntry.CDT_MACRO_FILE: + case IPathEntry.CDT_LIBRARY: + IPathEntry resolvedPathEntry = PathEntryUtil.cloneEntryAndExpand(projectPath, pathEntry); + Set set = pathEntriesMap.get(resolvedPathEntry.getEntryKind()); + if (set != null) { + set.add(resolvedPathEntry); + } + } + } + + private ICLanguageSettingEntry toLanguageSettingsEntry(IPathEntry pathEntry) { + switch (pathEntry.getEntryKind()) { + case IPathEntry.CDT_INCLUDE: + IIncludeEntry includeEntry = (IIncludeEntry)pathEntry; + return CDataUtil.createCIncludePathEntry(includeEntry.getFullIncludePath().toOSString(), includeEntry.isSystemInclude() ? 0 : ICSettingEntry.LOCAL); + case IPathEntry.CDT_MACRO: + IMacroEntry macroEntry = (IMacroEntry) pathEntry; + return CDataUtil.createCMacroEntry(macroEntry.getMacroName(), macroEntry.getMacroValue(), 0); + case IPathEntry.CDT_INCLUDE_FILE: + IIncludeFileEntry includeFileEntry = (IIncludeFileEntry) pathEntry; + return CDataUtil.createCIncludeFileEntry(includeFileEntry.getFullIncludeFilePath().toOSString(), 0); + case IPathEntry.CDT_MACRO_FILE: + IMacroFileEntry macroFileEntry = (IMacroFileEntry) pathEntry; + return CDataUtil.createCMacroFileEntry(macroFileEntry.getFullMacroFilePath().toOSString(), 0); + case IPathEntry.CDT_LIBRARY: + ILibraryEntry libraryEntry = (ILibraryEntry) pathEntry; + return CDataUtil.createCLibraryFileEntry(libraryEntry.getFullLibraryPath().toOSString(), 0); + } + return null; + } +} diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/language/settings/providers/ReferencedProjectsLanguageSettingsProvider.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/language/settings/providers/ReferencedProjectsLanguageSettingsProvider.java index 68dc700d0be..3fca1995de1 100644 --- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/language/settings/providers/ReferencedProjectsLanguageSettingsProvider.java +++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/language/settings/providers/ReferencedProjectsLanguageSettingsProvider.java @@ -1,79 +1,79 @@ -/******************************************************************************* - * 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.internal.core.language.settings.providers; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.cdt.core.language.settings.providers.LanguageSettingsBaseProvider; -import org.eclipse.cdt.core.language.settings.providers.LanguageSettingsManager; -import org.eclipse.cdt.core.language.settings.providers.LanguageSettingsStorage; -import org.eclipse.cdt.core.model.CoreModelUtil; -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.ICSettingEntry; -import org.eclipse.cdt.core.settings.model.util.CDataUtil; -import org.eclipse.core.resources.IResource; - -/** - * Language settings provider to provide entries exported from referenced projects. - */ -public class ReferencedProjectsLanguageSettingsProvider extends LanguageSettingsBaseProvider { - /** ID of the provider used in extension point from plugin.xml */ - public static final String ID = "org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider"; //$NON-NLS-1$ - - final private ThreadLocal recursiveCallIndicator = new ThreadLocal() { - @Override - protected Boolean initialValue() { - return false; - } - }; - - @Override - public List getSettingEntries(ICConfigurationDescription cfgDescription, IResource rc, String languageId) { - if (recursiveCallIndicator.get()) { - // Recursive call indicates that the provider of a referenced project is called. - // Only exported entries of the original configuration should be considered, - // entries of referenced projects are not re-exported. - return null; - } - - if (cfgDescription == null) { - return null; - } - ICProjectDescription prjDescription = cfgDescription.getProjectDescription(); - if (prjDescription == null) { - return null; - } - - try { - recursiveCallIndicator.set(true); - List entries = new ArrayList(); - ICConfigurationDescription[] refCfgDescriptions = CoreModelUtil.getReferencedConfigurationDescriptions(cfgDescription, false); - for (ICConfigurationDescription refCfgDescription : refCfgDescriptions) { - List refEntries = LanguageSettingsManager.getSettingEntriesByKind(refCfgDescription, rc, languageId, ICSettingEntry.ALL); - for (ICLanguageSettingEntry refEntry : refEntries) { - int flags = refEntry.getFlags(); - if ((flags & ICSettingEntry.EXPORTED) == ICSettingEntry.EXPORTED) { - // create a new entry with EXPORTED flag cleared - ICLanguageSettingEntry entry = CDataUtil.createEntry(refEntry, flags & ~ICSettingEntry.EXPORTED); - entries.add(entry); - } - } - } - - return LanguageSettingsStorage.getPooledList(new ArrayList(entries)); - } finally { - recursiveCallIndicator.set(false); - } - } -} +/******************************************************************************* + * 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.internal.core.language.settings.providers; + +import java.util.ArrayList; +import java.util.List; + +import org.eclipse.cdt.core.language.settings.providers.LanguageSettingsBaseProvider; +import org.eclipse.cdt.core.language.settings.providers.LanguageSettingsManager; +import org.eclipse.cdt.core.language.settings.providers.LanguageSettingsStorage; +import org.eclipse.cdt.core.model.CoreModelUtil; +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.ICSettingEntry; +import org.eclipse.cdt.core.settings.model.util.CDataUtil; +import org.eclipse.core.resources.IResource; + +/** + * Language settings provider to provide entries exported from referenced projects. + */ +public class ReferencedProjectsLanguageSettingsProvider extends LanguageSettingsBaseProvider { + /** ID of the provider used in extension point from plugin.xml */ + public static final String ID = "org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider"; //$NON-NLS-1$ + + final private ThreadLocal recursiveCallIndicator = new ThreadLocal() { + @Override + protected Boolean initialValue() { + return false; + } + }; + + @Override + public List getSettingEntries(ICConfigurationDescription cfgDescription, IResource rc, String languageId) { + if (recursiveCallIndicator.get()) { + // Recursive call indicates that the provider of a referenced project is called. + // Only exported entries of the original configuration should be considered, + // entries of referenced projects are not re-exported. + return null; + } + + if (cfgDescription == null) { + return null; + } + ICProjectDescription prjDescription = cfgDescription.getProjectDescription(); + if (prjDescription == null) { + return null; + } + + try { + recursiveCallIndicator.set(true); + List entries = new ArrayList(); + ICConfigurationDescription[] refCfgDescriptions = CoreModelUtil.getReferencedConfigurationDescriptions(cfgDescription, false); + for (ICConfigurationDescription refCfgDescription : refCfgDescriptions) { + List refEntries = LanguageSettingsManager.getSettingEntriesByKind(refCfgDescription, rc, languageId, ICSettingEntry.ALL); + for (ICLanguageSettingEntry refEntry : refEntries) { + int flags = refEntry.getFlags(); + if ((flags & ICSettingEntry.EXPORTED) == ICSettingEntry.EXPORTED) { + // create a new entry with EXPORTED flag cleared + ICLanguageSettingEntry entry = CDataUtil.createEntry(refEntry, flags & ~ICSettingEntry.EXPORTED); + entries.add(entry); + } + } + } + + return LanguageSettingsStorage.getPooledList(new ArrayList(entries)); + } finally { + recursiveCallIndicator.set(false); + } + } +} diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/language/settings/providers/ScannerInfoExtensionLanguageSettingsProvider.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/language/settings/providers/ScannerInfoExtensionLanguageSettingsProvider.java index 956b7919d1a..ea6cf1054d5 100644 --- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/language/settings/providers/ScannerInfoExtensionLanguageSettingsProvider.java +++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/language/settings/providers/ScannerInfoExtensionLanguageSettingsProvider.java @@ -1,158 +1,158 @@ -/******************************************************************************* - * 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.internal.core.language.settings.providers; - -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.TreeMap; - -import org.eclipse.cdt.core.AbstractCExtension; -import org.eclipse.cdt.core.CCorePlugin; -import org.eclipse.cdt.core.language.settings.providers.LanguageSettingsBaseProvider; -import org.eclipse.cdt.core.parser.IExtendedScannerInfo; -import org.eclipse.cdt.core.parser.IScannerInfo; -import org.eclipse.cdt.core.parser.IScannerInfoProvider; -import org.eclipse.cdt.core.settings.model.ICConfigExtensionReference; -import org.eclipse.cdt.core.settings.model.ICConfigurationDescription; -import org.eclipse.cdt.core.settings.model.ICLanguageSettingEntry; -import org.eclipse.cdt.core.settings.model.ICSettingEntry; -import org.eclipse.cdt.core.settings.model.util.CDataUtil; -import org.eclipse.cdt.core.settings.model.util.CExtensionUtil; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IConfigurationElement; - -/** - * Wrapper class intended to provide backward compatibility with ScannerInfoProvider defined by org.eclipse.cdt.core.ScannerInfoProvider extension point - */ -public class ScannerInfoExtensionLanguageSettingsProvider extends LanguageSettingsBaseProvider { - @Override - public List getSettingEntries(ICConfigurationDescription cfgDescription, IResource rc, String languageId) { - List entries = new ArrayList(); - IScannerInfoProvider scannerInfoProvider = getScannerInfoProvider(cfgDescription); - if (scannerInfoProvider != null) { - IScannerInfo si = scannerInfoProvider.getScannerInformation(rc); - if (si != null) { - if (si instanceof IExtendedScannerInfo) { - addLocalIncludePaths(entries, (IExtendedScannerInfo) si); - } - - addSystemIncludePaths(entries, si); - addDefinedSymbols(entries, si); - - if (si instanceof IExtendedScannerInfo) { - addIncludeFiles(entries, (IExtendedScannerInfo) si); - addMacroFiles(entries, (IExtendedScannerInfo) si); - } - - if (!entries.isEmpty()) { - return LanguageSettingsSerializableStorage.getPooledList(entries); - } - } - } - return null; - } - - /** - * Return ScannerInfoProvider defined in configuration metadata in .cproject. - * - * @param cfgDescription - configuration description. - * @return an instance of ScannerInfoProvider or {@code null}. - */ - public IScannerInfoProvider getScannerInfoProvider(ICConfigurationDescription cfgDescription) { - if (cfgDescription == null || cfgDescription.isPreferenceConfiguration()) { - return null; - } - - IScannerInfoProvider scannerInfoProvider = null; - ICConfigExtensionReference[] refs = cfgDescription.get(CCorePlugin.BUILD_SCANNER_INFO_UNIQ_ID); - if (refs != null && refs.length > 0) { - ICConfigExtensionReference ref = refs[0]; - try { - AbstractCExtension cExtension = null; - IConfigurationElement el = CExtensionUtil.getFirstConfigurationElement(ref, "cextension", false); //$NON-NLS-1$ - cExtension = (AbstractCExtension)el.createExecutableExtension("run"); //$NON-NLS-1$ - cExtension.setExtensionReference(ref); - cExtension.setProject(ref.getConfiguration().getProjectDescription().getProject()); - if (cExtension instanceof IScannerInfoProvider) { - scannerInfoProvider = (IScannerInfoProvider) cExtension; - } - } catch (CoreException e) { - CCorePlugin.log(e); - } - } - return scannerInfoProvider; - } - - /** - * Add local include paths to the list of entries. - */ - private void addLocalIncludePaths(List entries, IExtendedScannerInfo esi) { - String[] localIncludePaths = esi.getLocalIncludePath(); - if (localIncludePaths != null) { - for (String path : localIncludePaths) { - entries.add(CDataUtil.createCIncludePathEntry(path, ICSettingEntry.LOCAL)); - } - } - } - - /** - * Add system include paths to the list of entries. - */ - private void addSystemIncludePaths(List entries, IScannerInfo si) { - String[] includePaths = si.getIncludePaths(); - if (includePaths != null) { - for (String path : includePaths) { - entries.add(CDataUtil.createCIncludePathEntry(path, 0)); - } - } - } - - /** - * Add defined macros to the list of entries. - */ - private void addDefinedSymbols(List entries, IScannerInfo si) { - Map definedSymbols = si.getDefinedSymbols(); - if (definedSymbols != null) { - for (Entry entry : new TreeMap(definedSymbols).entrySet()) { - String name = entry.getKey(); - String value = entry.getValue(); - entries.add(CDataUtil.createCMacroEntry(name, value, 0)); - } - } - } - - /** - * Add include files to the list of entries. - */ - private void addIncludeFiles(List entries, IExtendedScannerInfo esi) { - String[] includeFiles = esi.getIncludeFiles(); - if (includeFiles != null) { - for (String path : includeFiles) { - entries.add(CDataUtil.createCIncludeFileEntry(path, 0)); - } - } - } - - /** - * Add macro files to the list of entries. - */ - private void addMacroFiles(List entries, IExtendedScannerInfo esi) { - String[] macroFiles = esi.getMacroFiles(); - if (macroFiles != null) { - for (String path : macroFiles) { - entries.add(CDataUtil.createCMacroFileEntry(path, 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.internal.core.language.settings.providers; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.TreeMap; + +import org.eclipse.cdt.core.AbstractCExtension; +import org.eclipse.cdt.core.CCorePlugin; +import org.eclipse.cdt.core.language.settings.providers.LanguageSettingsBaseProvider; +import org.eclipse.cdt.core.parser.IExtendedScannerInfo; +import org.eclipse.cdt.core.parser.IScannerInfo; +import org.eclipse.cdt.core.parser.IScannerInfoProvider; +import org.eclipse.cdt.core.settings.model.ICConfigExtensionReference; +import org.eclipse.cdt.core.settings.model.ICConfigurationDescription; +import org.eclipse.cdt.core.settings.model.ICLanguageSettingEntry; +import org.eclipse.cdt.core.settings.model.ICSettingEntry; +import org.eclipse.cdt.core.settings.model.util.CDataUtil; +import org.eclipse.cdt.core.settings.model.util.CExtensionUtil; +import org.eclipse.core.resources.IResource; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IConfigurationElement; + +/** + * Wrapper class intended to provide backward compatibility with ScannerInfoProvider defined by org.eclipse.cdt.core.ScannerInfoProvider extension point + */ +public class ScannerInfoExtensionLanguageSettingsProvider extends LanguageSettingsBaseProvider { + @Override + public List getSettingEntries(ICConfigurationDescription cfgDescription, IResource rc, String languageId) { + List entries = new ArrayList(); + IScannerInfoProvider scannerInfoProvider = getScannerInfoProvider(cfgDescription); + if (scannerInfoProvider != null) { + IScannerInfo si = scannerInfoProvider.getScannerInformation(rc); + if (si != null) { + if (si instanceof IExtendedScannerInfo) { + addLocalIncludePaths(entries, (IExtendedScannerInfo) si); + } + + addSystemIncludePaths(entries, si); + addDefinedSymbols(entries, si); + + if (si instanceof IExtendedScannerInfo) { + addIncludeFiles(entries, (IExtendedScannerInfo) si); + addMacroFiles(entries, (IExtendedScannerInfo) si); + } + + if (!entries.isEmpty()) { + return LanguageSettingsSerializableStorage.getPooledList(entries); + } + } + } + return null; + } + + /** + * Return ScannerInfoProvider defined in configuration metadata in .cproject. + * + * @param cfgDescription - configuration description. + * @return an instance of ScannerInfoProvider or {@code null}. + */ + public IScannerInfoProvider getScannerInfoProvider(ICConfigurationDescription cfgDescription) { + if (cfgDescription == null || cfgDescription.isPreferenceConfiguration()) { + return null; + } + + IScannerInfoProvider scannerInfoProvider = null; + ICConfigExtensionReference[] refs = cfgDescription.get(CCorePlugin.BUILD_SCANNER_INFO_UNIQ_ID); + if (refs != null && refs.length > 0) { + ICConfigExtensionReference ref = refs[0]; + try { + AbstractCExtension cExtension = null; + IConfigurationElement el = CExtensionUtil.getFirstConfigurationElement(ref, "cextension", false); //$NON-NLS-1$ + cExtension = (AbstractCExtension)el.createExecutableExtension("run"); //$NON-NLS-1$ + cExtension.setExtensionReference(ref); + cExtension.setProject(ref.getConfiguration().getProjectDescription().getProject()); + if (cExtension instanceof IScannerInfoProvider) { + scannerInfoProvider = (IScannerInfoProvider) cExtension; + } + } catch (CoreException e) { + CCorePlugin.log(e); + } + } + return scannerInfoProvider; + } + + /** + * Add local include paths to the list of entries. + */ + private void addLocalIncludePaths(List entries, IExtendedScannerInfo esi) { + String[] localIncludePaths = esi.getLocalIncludePath(); + if (localIncludePaths != null) { + for (String path : localIncludePaths) { + entries.add(CDataUtil.createCIncludePathEntry(path, ICSettingEntry.LOCAL)); + } + } + } + + /** + * Add system include paths to the list of entries. + */ + private void addSystemIncludePaths(List entries, IScannerInfo si) { + String[] includePaths = si.getIncludePaths(); + if (includePaths != null) { + for (String path : includePaths) { + entries.add(CDataUtil.createCIncludePathEntry(path, 0)); + } + } + } + + /** + * Add defined macros to the list of entries. + */ + private void addDefinedSymbols(List entries, IScannerInfo si) { + Map definedSymbols = si.getDefinedSymbols(); + if (definedSymbols != null) { + for (Entry entry : new TreeMap(definedSymbols).entrySet()) { + String name = entry.getKey(); + String value = entry.getValue(); + entries.add(CDataUtil.createCMacroEntry(name, value, 0)); + } + } + } + + /** + * Add include files to the list of entries. + */ + private void addIncludeFiles(List entries, IExtendedScannerInfo esi) { + String[] includeFiles = esi.getIncludeFiles(); + if (includeFiles != null) { + for (String path : includeFiles) { + entries.add(CDataUtil.createCIncludeFileEntry(path, 0)); + } + } + } + + /** + * Add macro files to the list of entries. + */ + private void addMacroFiles(List entries, IExtendedScannerInfo esi) { + String[] macroFiles = esi.getMacroFiles(); + if (macroFiles != null) { + for (String path : macroFiles) { + entries.add(CDataUtil.createCMacroFileEntry(path, 0)); + } + } + } +} diff --git a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/BatchOperation.java b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/BatchOperation.java index d294ae94ede..8a70bff4f2c 100644 --- a/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/BatchOperation.java +++ b/core/org.eclipse.cdt.core/model/org/eclipse/cdt/internal/core/model/BatchOperation.java @@ -1,59 +1,59 @@ -/******************************************************************************* - * Copyright (c) 2001, 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: - * Rational Software - initial implementation +/******************************************************************************* + * Copyright (c) 2001, 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: + * Rational Software - initial implementation *******************************************************************************/ -package org.eclipse.cdt.internal.core.model; - -import org.eclipse.core.resources.IResourceStatus; -import org.eclipse.core.resources.IWorkspaceRunnable; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.cdt.core.model.ICModelStatus; -import org.eclipse.cdt.core.model.CModelException; - -/** - * An operation created as a result of a call to JavaCore.run(IWorkspaceRunnable, IProgressMonitor) - * that encapsulates a user defined IWorkspaceRunnable. - */ -public class BatchOperation extends CModelOperation { - protected IWorkspaceRunnable runnable; - - public BatchOperation(IWorkspaceRunnable runnable) { - this.runnable = runnable; - } - - /* (non-Javadoc) - * @see org.eclipse.jdt.internal.core.JavaModelOperation#executeOperation() - */ - @Override - protected void executeOperation() throws CModelException { - try { - this.runnable.run(fMonitor); - } catch (CoreException ce) { - if (ce instanceof CModelException) { - throw (CModelException)ce; - } - if (ce.getStatus().getCode() == IResourceStatus.OPERATION_FAILED) { - Throwable e= ce.getStatus().getException(); - if (e instanceof CModelException) { - throw (CModelException) e; - } - } - throw new CModelException(ce); - } - } - - /* (non-Javadoc) - * @see org.eclipse.jdt.internal.core.JavaModelOperation#verify() - */ - @Override - protected ICModelStatus verify() { - // cannot verify user defined operation - return CModelStatus.VERIFIED_OK; - } -} +package org.eclipse.cdt.internal.core.model; + +import org.eclipse.core.resources.IResourceStatus; +import org.eclipse.core.resources.IWorkspaceRunnable; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.cdt.core.model.ICModelStatus; +import org.eclipse.cdt.core.model.CModelException; + +/** + * An operation created as a result of a call to JavaCore.run(IWorkspaceRunnable, IProgressMonitor) + * that encapsulates a user defined IWorkspaceRunnable. + */ +public class BatchOperation extends CModelOperation { + protected IWorkspaceRunnable runnable; + + public BatchOperation(IWorkspaceRunnable runnable) { + this.runnable = runnable; + } + + /* (non-Javadoc) + * @see org.eclipse.jdt.internal.core.JavaModelOperation#executeOperation() + */ + @Override + protected void executeOperation() throws CModelException { + try { + this.runnable.run(fMonitor); + } catch (CoreException ce) { + if (ce instanceof CModelException) { + throw (CModelException)ce; + } + if (ce.getStatus().getCode() == IResourceStatus.OPERATION_FAILED) { + Throwable e= ce.getStatus().getException(); + if (e instanceof CModelException) { + throw (CModelException) e; + } + } + throw new CModelException(ce); + } + } + + /* (non-Javadoc) + * @see org.eclipse.jdt.internal.core.JavaModelOperation#verify() + */ + @Override + protected ICModelStatus verify() { + // cannot verify user defined operation + return CModelStatus.VERIFIED_OK; + } +} diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/ICPPAliasTemplate.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/ICPPAliasTemplate.java index 897abdd2173..c3491406ca8 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/ICPPAliasTemplate.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/ast/cpp/ICPPAliasTemplate.java @@ -1,28 +1,28 @@ -/******************************************************************************* - * Copyright (c) 2012, 2014 Institute for Software, HSR Hochschule fuer Technik - * Rapperswil, University of applied sciences. - * 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: - * Thomas Corbat (IFS) - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.core.dom.ast.cpp; - -import org.eclipse.cdt.core.dom.ast.IType; - -/** - * Represents an alias template (14.5.7). - * @since 5.5 - * - * @noextend This interface is not intended to be extended by clients. - * @noimplement This interface is not intended to be implemented by clients. - */ -public interface ICPPAliasTemplate extends IType, ICPPTemplateDefinition { - /** - * Returns the aliased type. - */ - public IType getType(); -} +/******************************************************************************* + * Copyright (c) 2012, 2014 Institute for Software, HSR Hochschule fuer Technik + * Rapperswil, University of applied sciences. + * 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: + * Thomas Corbat (IFS) - Initial API and implementation + *******************************************************************************/ +package org.eclipse.cdt.core.dom.ast.cpp; + +import org.eclipse.cdt.core.dom.ast.IType; + +/** + * Represents an alias template (14.5.7). + * @since 5.5 + * + * @noextend This interface is not intended to be extended by clients. + * @noimplement This interface is not intended to be implemented by clients. + */ +public interface ICPPAliasTemplate extends IType, ICPPTemplateDefinition { + /** + * Returns the aliased type. + */ + public IType getType(); +} diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/rewrite/DeclarationGenerator.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/rewrite/DeclarationGenerator.java index 5ab56f46e1e..4082f1b0c04 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/rewrite/DeclarationGenerator.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/dom/rewrite/DeclarationGenerator.java @@ -1,47 +1,47 @@ -/******************************************************************************* - * Copyright (c) 2010, 2013 Tomasz Wesolowski - * 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 + * 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.core.dom.rewrite; - -import org.eclipse.cdt.core.dom.ast.IASTDeclSpecifier; -import org.eclipse.cdt.core.dom.ast.IASTDeclarator; -import org.eclipse.cdt.core.dom.ast.INodeFactory; -import org.eclipse.cdt.core.dom.ast.IType; -import org.eclipse.cdt.internal.core.dom.rewrite.DeclarationGeneratorImpl; - -/** - * This class handles the creation of {@link IASTDeclarator}s and {@link IASTDeclSpecifier}s - * for a given type. - * - * @author Tomasz Wesolowski - * @noextend This interface is not intended to be extended by clients. - * @since 5.3 - */ -public abstract class DeclarationGenerator { - - public static DeclarationGenerator create(INodeFactory factory) { - return new DeclarationGeneratorImpl(factory); - } - - /** - * Creates a new {@link IASTDeclSpecifier} for a given {@link IType}. - * @param type the type to describe - * @return the generated declaration specifier - */ - public abstract IASTDeclSpecifier createDeclSpecFromType(IType type); - - /** - * Creates a new {@link IASTDeclarator} for a given {@link IType}. - * @param type the type to describe - * @param name the name for the declarator - * @return the generated declarator - */ - public abstract IASTDeclarator createDeclaratorFromType(IType type, char[] name); +package org.eclipse.cdt.core.dom.rewrite; + +import org.eclipse.cdt.core.dom.ast.IASTDeclSpecifier; +import org.eclipse.cdt.core.dom.ast.IASTDeclarator; +import org.eclipse.cdt.core.dom.ast.INodeFactory; +import org.eclipse.cdt.core.dom.ast.IType; +import org.eclipse.cdt.internal.core.dom.rewrite.DeclarationGeneratorImpl; + +/** + * This class handles the creation of {@link IASTDeclarator}s and {@link IASTDeclSpecifier}s + * for a given type. + * + * @author Tomasz Wesolowski + * @noextend This interface is not intended to be extended by clients. + * @since 5.3 + */ +public abstract class DeclarationGenerator { + + public static DeclarationGenerator create(INodeFactory factory) { + return new DeclarationGeneratorImpl(factory); + } + + /** + * Creates a new {@link IASTDeclSpecifier} for a given {@link IType}. + * @param type the type to describe + * @return the generated declaration specifier + */ + public abstract IASTDeclSpecifier createDeclSpecFromType(IType type); + + /** + * Creates a new {@link IASTDeclarator} for a given {@link IType}. + * @param type the type to describe + * @param name the name for the declarator + * @return the generated declarator + */ + public abstract IASTDeclarator createDeclaratorFromType(IType type, char[] name); } \ No newline at end of file diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/index/ResourceContainerRelativeLocationConverter.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/index/ResourceContainerRelativeLocationConverter.java index 4c86e4326eb..018730f8337 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/index/ResourceContainerRelativeLocationConverter.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/index/ResourceContainerRelativeLocationConverter.java @@ -8,14 +8,14 @@ * Contributors: * Andrew Ferguson (Symbian) - Initial implementation *******************************************************************************/ -package org.eclipse.cdt.core.index; +package org.eclipse.cdt.core.index; import org.eclipse.cdt.internal.core.index.IndexFileLocation; import org.eclipse.core.resources.IContainer; import org.eclipse.core.resources.IResource; import org.eclipse.core.resources.IWorkspaceRoot; import org.eclipse.core.resources.ResourcesPlugin; import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.Path; +import org.eclipse.core.runtime.Path; /** * A location converter for converting project resource locations to be relative to a specified @@ -33,13 +33,13 @@ public class ResourceContainerRelativeLocationConverter implements IIndexLocatio public ResourceContainerRelativeLocationConverter(IContainer container) { this.fullPath = container.getFullPath(); this.root = ResourcesPlugin.getWorkspace().getRoot(); - } + } @Override public IIndexFileLocation fromInternalFormat(String raw) { IResource member= root.getFile(fullPath.append(raw)); return new IndexFileLocation(member.getLocationURI(), member.getFullPath().toString()); - } + } @Override public String toInternalFormat(IIndexFileLocation location) { String sFullPath= location.getFullPath(); @@ -51,4 +51,4 @@ public class ResourceContainerRelativeLocationConverter implements IIndexLocatio } return null; } -} +} diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/StandardAttributes.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/StandardAttributes.java index 1597a77dafa..bcca01f1b47 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/StandardAttributes.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/core/parser/StandardAttributes.java @@ -1,30 +1,30 @@ -/******************************************************************************* - * Copyright (c) 2017 Institute for Software, HSR Hochschule fuer Technik - * 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.core.parser; - -/** - * @noextend This class is not intended to be subclassed by clients. - * @noinstantiate This class is not intended to be instantiated by clients. - * @since 6.3 - */ -@SuppressWarnings("nls") -public class StandardAttributes { - public static final String CARRIES_DEPENDENCY = "carries_dependency"; - public static final String DEPRECATED = "deprecated"; - public static final String FALLTHROUGH = "fallthrough"; - public static final String MAYBE_UNUSED = "maybe_unused"; - public static final String NODISCARD = "nodiscard"; - public static final String NORETURN = "noreturn"; - - public static final char[] cCARRIES_DEPENDENCY = "carries_dependency".toCharArray(); - public static final char[] cDEPRECATED = "deprecated".toCharArray(); - public static final char[] cFALLTHROUGH = "fallthrough".toCharArray(); - public static final char[] cMAYBE_UNUSED = "maybe_unused".toCharArray(); - public static final char[] cNODISCARD = "nodiscard".toCharArray(); - public static final char[] cNORETURN = "noreturn".toCharArray(); -} +/******************************************************************************* + * Copyright (c) 2017 Institute for Software, HSR Hochschule fuer Technik + * 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.core.parser; + +/** + * @noextend This class is not intended to be subclassed by clients. + * @noinstantiate This class is not intended to be instantiated by clients. + * @since 6.3 + */ +@SuppressWarnings("nls") +public class StandardAttributes { + public static final String CARRIES_DEPENDENCY = "carries_dependency"; + public static final String DEPRECATED = "deprecated"; + public static final String FALLTHROUGH = "fallthrough"; + public static final String MAYBE_UNUSED = "maybe_unused"; + public static final String NODISCARD = "nodiscard"; + public static final String NORETURN = "noreturn"; + + public static final char[] cCARRIES_DEPENDENCY = "carries_dependency".toCharArray(); + public static final char[] cDEPRECATED = "deprecated".toCharArray(); + public static final char[] cFALLTHROUGH = "fallthrough".toCharArray(); + public static final char[] cMAYBE_UNUSED = "maybe_unused".toCharArray(); + public static final char[] cNODISCARD = "nodiscard".toCharArray(); + public static final char[] cNORETURN = "noreturn".toCharArray(); +} diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPAliasTemplate.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPAliasTemplate.java index 5f098d4fbe4..594cda3abbd 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPAliasTemplate.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPAliasTemplate.java @@ -1,167 +1,167 @@ -/******************************************************************************* - * Copyright (c) 2012 Institute for Software, HSR Hochschule fuer Technik - * Rapperswil, University of applied sciences. - * 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: - * Thomas Corbat (IFS) - Initial API and implementation - * Sergey Prigogin (Google) - *******************************************************************************/ -package org.eclipse.cdt.internal.core.dom.parser.cpp; - -import org.eclipse.cdt.core.dom.ILinkage; -import org.eclipse.cdt.core.dom.ast.ASTTypeUtil; -import org.eclipse.cdt.core.dom.ast.DOMException; -import org.eclipse.cdt.core.dom.ast.IASTName; -import org.eclipse.cdt.core.dom.ast.IASTNode; -import org.eclipse.cdt.core.dom.ast.IBinding; -import org.eclipse.cdt.core.dom.ast.IScope; -import org.eclipse.cdt.core.dom.ast.IType; -import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTTemplateDeclaration; -import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTTemplateParameter; -import org.eclipse.cdt.core.dom.ast.cpp.ICPPAliasTemplate; -import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateParameter; -import org.eclipse.cdt.core.parser.util.ArrayUtil; -import org.eclipse.cdt.internal.core.dom.Linkage; -import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPTemplates; -import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPVisitor; -import org.eclipse.core.runtime.PlatformObject; - -public class CPPAliasTemplate extends PlatformObject - implements ICPPAliasTemplate, ICPPTemplateParameterOwner, ICPPInternalBinding { - private final IASTName aliasName; - private final IType aliasedType; - private ICPPTemplateParameter[] templateParameters; - - public CPPAliasTemplate(IASTName aliasName, IType aliasedType) { - this.aliasName = aliasName; - this.aliasedType = aliasedType; - aliasName.setBinding(this); - } - - @Override - public IType getType() { - return aliasedType; - } - - @Override - public String getName() { - return new String(getNameCharArray()); - } - - @Override - public char[] getNameCharArray() { - return aliasName.getSimpleID(); - } - - @Override - public ILinkage getLinkage() { - return Linkage.CPP_LINKAGE; - } - - @Override - public IBinding getOwner() { - return CPPVisitor.findDeclarationOwner(aliasName, true); - } - - @Override - public IScope getScope() throws DOMException { - return CPPVisitor.getContainingScope(aliasName.getParent()); - } - - @Override - public boolean isSameType(IType type) { - if (type == null) { - return false; - } - IType aliasedType = getType(); - return type.isSameType(aliasedType); - } - - @Override - public Object clone() { - IType t = null; - try { - t = (IType) super.clone(); - } catch (CloneNotSupportedException e) { - // Not going to happen - } - return t; - } - - @Override - public String[] getQualifiedName() throws DOMException { - return CPPVisitor.getQualifiedName(this); - } - - @Override - public char[][] getQualifiedNameCharArray() throws DOMException { - return CPPVisitor.getQualifiedNameCharArray(this); - } - - @Override - public boolean isGloballyQualified() throws DOMException { - return true; - } - - @Override - public ICPPTemplateParameter[] getTemplateParameters() { - if (templateParameters == null) { - ICPPASTTemplateDeclaration template = CPPTemplates.getTemplateDeclaration(aliasName); - if (template == null) - return ICPPTemplateParameter.EMPTY_TEMPLATE_PARAMETER_ARRAY; - ICPPASTTemplateParameter[] params = template.getTemplateParameters(); - IBinding p = null; - ICPPTemplateParameter[] result = null; - for (ICPPASTTemplateParameter param : params) { - p= CPPTemplates.getTemplateParameterName(param).resolveBinding(); - if (p instanceof ICPPTemplateParameter) { - result = ArrayUtil.append(ICPPTemplateParameter.class, result, (ICPPTemplateParameter) p); - } - } - templateParameters = ArrayUtil.trim(ICPPTemplateParameter.class, result); - } - return templateParameters; - } - - @Override - public IBinding resolveTemplateParameter(ICPPTemplateParameter templateParameter) { - int pos= templateParameter.getParameterPosition(); - - ICPPASTTemplateParameter[] params = CPPTemplates.getTemplateDeclaration(aliasName).getTemplateParameters(); - if (pos < params.length) { - final IASTName oName = CPPTemplates.getTemplateParameterName(params[pos]); - return oName.resolvePreBinding(); - } - return templateParameter; - } - - @Override - public IASTNode getDefinition() { - return aliasName; - } - - @Override - public IASTNode[] getDeclarations() { - return null; - } - - @Override - public void addDefinition(IASTNode node) { - throw new UnsupportedOperationException(); - } - - @Override - public void addDeclaration(IASTNode node) { - throw new UnsupportedOperationException(); - } - - /** For debugging only. */ - @Override - public String toString() { - return ASTTypeUtil.getQualifiedName(this) + " -> " + ASTTypeUtil.getType(aliasedType, true); //$NON-NLS-1$ - } -} +/******************************************************************************* + * Copyright (c) 2012 Institute for Software, HSR Hochschule fuer Technik + * Rapperswil, University of applied sciences. + * 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: + * Thomas Corbat (IFS) - Initial API and implementation + * Sergey Prigogin (Google) + *******************************************************************************/ +package org.eclipse.cdt.internal.core.dom.parser.cpp; + +import org.eclipse.cdt.core.dom.ILinkage; +import org.eclipse.cdt.core.dom.ast.ASTTypeUtil; +import org.eclipse.cdt.core.dom.ast.DOMException; +import org.eclipse.cdt.core.dom.ast.IASTName; +import org.eclipse.cdt.core.dom.ast.IASTNode; +import org.eclipse.cdt.core.dom.ast.IBinding; +import org.eclipse.cdt.core.dom.ast.IScope; +import org.eclipse.cdt.core.dom.ast.IType; +import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTTemplateDeclaration; +import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTTemplateParameter; +import org.eclipse.cdt.core.dom.ast.cpp.ICPPAliasTemplate; +import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateParameter; +import org.eclipse.cdt.core.parser.util.ArrayUtil; +import org.eclipse.cdt.internal.core.dom.Linkage; +import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPTemplates; +import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPVisitor; +import org.eclipse.core.runtime.PlatformObject; + +public class CPPAliasTemplate extends PlatformObject + implements ICPPAliasTemplate, ICPPTemplateParameterOwner, ICPPInternalBinding { + private final IASTName aliasName; + private final IType aliasedType; + private ICPPTemplateParameter[] templateParameters; + + public CPPAliasTemplate(IASTName aliasName, IType aliasedType) { + this.aliasName = aliasName; + this.aliasedType = aliasedType; + aliasName.setBinding(this); + } + + @Override + public IType getType() { + return aliasedType; + } + + @Override + public String getName() { + return new String(getNameCharArray()); + } + + @Override + public char[] getNameCharArray() { + return aliasName.getSimpleID(); + } + + @Override + public ILinkage getLinkage() { + return Linkage.CPP_LINKAGE; + } + + @Override + public IBinding getOwner() { + return CPPVisitor.findDeclarationOwner(aliasName, true); + } + + @Override + public IScope getScope() throws DOMException { + return CPPVisitor.getContainingScope(aliasName.getParent()); + } + + @Override + public boolean isSameType(IType type) { + if (type == null) { + return false; + } + IType aliasedType = getType(); + return type.isSameType(aliasedType); + } + + @Override + public Object clone() { + IType t = null; + try { + t = (IType) super.clone(); + } catch (CloneNotSupportedException e) { + // Not going to happen + } + return t; + } + + @Override + public String[] getQualifiedName() throws DOMException { + return CPPVisitor.getQualifiedName(this); + } + + @Override + public char[][] getQualifiedNameCharArray() throws DOMException { + return CPPVisitor.getQualifiedNameCharArray(this); + } + + @Override + public boolean isGloballyQualified() throws DOMException { + return true; + } + + @Override + public ICPPTemplateParameter[] getTemplateParameters() { + if (templateParameters == null) { + ICPPASTTemplateDeclaration template = CPPTemplates.getTemplateDeclaration(aliasName); + if (template == null) + return ICPPTemplateParameter.EMPTY_TEMPLATE_PARAMETER_ARRAY; + ICPPASTTemplateParameter[] params = template.getTemplateParameters(); + IBinding p = null; + ICPPTemplateParameter[] result = null; + for (ICPPASTTemplateParameter param : params) { + p= CPPTemplates.getTemplateParameterName(param).resolveBinding(); + if (p instanceof ICPPTemplateParameter) { + result = ArrayUtil.append(ICPPTemplateParameter.class, result, (ICPPTemplateParameter) p); + } + } + templateParameters = ArrayUtil.trim(ICPPTemplateParameter.class, result); + } + return templateParameters; + } + + @Override + public IBinding resolveTemplateParameter(ICPPTemplateParameter templateParameter) { + int pos= templateParameter.getParameterPosition(); + + ICPPASTTemplateParameter[] params = CPPTemplates.getTemplateDeclaration(aliasName).getTemplateParameters(); + if (pos < params.length) { + final IASTName oName = CPPTemplates.getTemplateParameterName(params[pos]); + return oName.resolvePreBinding(); + } + return templateParameter; + } + + @Override + public IASTNode getDefinition() { + return aliasName; + } + + @Override + public IASTNode[] getDeclarations() { + return null; + } + + @Override + public void addDefinition(IASTNode node) { + throw new UnsupportedOperationException(); + } + + @Override + public void addDeclaration(IASTNode node) { + throw new UnsupportedOperationException(); + } + + /** For debugging only. */ + @Override + public String toString() { + return ASTTypeUtil.getQualifiedName(this) + " -> " + ASTTypeUtil.getType(aliasedType, true); //$NON-NLS-1$ + } +} diff --git a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPAliasTemplateInstance.java b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPAliasTemplateInstance.java index 0f595659952..2274469a4f1 100644 --- a/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPAliasTemplateInstance.java +++ b/core/org.eclipse.cdt.core/parser/org/eclipse/cdt/internal/core/dom/parser/cpp/CPPAliasTemplateInstance.java @@ -1,166 +1,166 @@ -/******************************************************************************* - * Copyright (c) 2012, 2016 Institute for Software, HSR Hochschule fuer Technik - * Rapperswil, University of applied sciences. - * 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: - * Thomas Corbat (IFS) - Initial API and implementation - * Sergey Prigogin (Google) +/******************************************************************************* + * Copyright (c) 2012, 2016 Institute for Software, HSR Hochschule fuer Technik + * Rapperswil, University of applied sciences. + * 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: + * Thomas Corbat (IFS) - Initial API and implementation + * Sergey Prigogin (Google) *******************************************************************************/ -package org.eclipse.cdt.internal.core.dom.parser.cpp; - -import org.eclipse.cdt.core.dom.ILinkage; -import org.eclipse.cdt.core.dom.ast.ASTTypeUtil; -import org.eclipse.cdt.core.dom.ast.DOMException; -import org.eclipse.cdt.core.dom.ast.IASTNode; -import org.eclipse.cdt.core.dom.ast.IBinding; -import org.eclipse.cdt.core.dom.ast.IScope; -import org.eclipse.cdt.core.dom.ast.IType; -import org.eclipse.cdt.core.dom.ast.cpp.ICPPAliasTemplate; -import org.eclipse.cdt.core.dom.ast.cpp.ICPPAliasTemplateInstance; -import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateArgument; -import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateParameterMap; -import org.eclipse.cdt.core.parser.util.CharArrayUtils; -import org.eclipse.cdt.internal.core.dom.Linkage; -import org.eclipse.cdt.internal.core.dom.parser.ITypeContainer; -import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPVisitor; - -public class CPPAliasTemplateInstance extends CPPSpecialization implements ICPPAliasTemplateInstance, - ITypeContainer { - private IType aliasedType; - private ICPPTemplateArgument[] fArguments; - - public CPPAliasTemplateInstance(ICPPAliasTemplate aliasTemplate, IType aliasedType, IBinding owner, - ICPPTemplateParameterMap argumentMap, ICPPTemplateArgument[] arguments) { - super(aliasTemplate, owner, argumentMap); - this.aliasedType = aliasedType; - this.fArguments = arguments; - } - - @Override - public ICPPAliasTemplate getTemplateDefinition() { - return (ICPPAliasTemplate) super.getSpecializedBinding(); - } - - @Override - public boolean isSameType(IType other) { - if (other == aliasedType) - return true; - if (aliasedType != null) { - return aliasedType.isSameType(other); - } - return false; - } - - @Override - public IType getType() { - return aliasedType; - } - - @Override - public void setType(IType type) { - aliasedType = type; - } - - @Override - public Object clone() { - try { - return super.clone(); - } catch (CloneNotSupportedException e) { - } - return null; - } - - @Override - public String getName() { - return new String(getNameCharArray()); - } - - @Override - public char[] getNameCharArray() { - char[] name = getTemplateDefinition().getNameCharArray(); - if (name != null) { - return name; - } - return CharArrayUtils.EMPTY_CHAR_ARRAY; - } - - @Override - public ILinkage getLinkage() { - return Linkage.CPP_LINKAGE; - } - - @Override - public IBinding getOwner() { - if (getTemplateDefinition() != null) { - return getTemplateDefinition().getOwner(); - } - return null; - } - - @Override - public IScope getScope() throws DOMException { - if (getTemplateDefinition() != null) { - return getTemplateDefinition().getScope(); - } - return null; - } - - @Override - public String[] getQualifiedName() { - return CPPVisitor.getQualifiedName(this); - } - - @Override - public char[][] getQualifiedNameCharArray() { - return CPPVisitor.getQualifiedNameCharArray(this); - } - - @Override - public boolean isGloballyQualified() throws DOMException { - return getTemplateDefinition().isGloballyQualified(); - } - - @Override - public IASTNode getDefinition() { - if (getTemplateDefinition() instanceof ICPPInternalBinding) { - return ((ICPPInternalBinding) getTemplateDefinition()).getDefinition(); - } - return null; - } - - @Override - public IASTNode[] getDeclarations() { - return null; - } - - @Override - public void addDefinition(IASTNode node) { - throw new UnsupportedOperationException(); - } - - @Override - public void addDeclaration(IASTNode node) { - throw new UnsupportedOperationException(); - } - - /** For debugging only. */ - @Override - public String toString() { - return ASTTypeUtil.getQualifiedName(this) + " -> " + ASTTypeUtil.getType(aliasedType, true); //$NON-NLS-1$ - } - - @Override - public ICPPTemplateArgument[] getTemplateArguments() { - return fArguments; - } - - @Override - public boolean isExplicitSpecialization() { - // Alias templates cannot have explicit specializations. - return false; - } -} +package org.eclipse.cdt.internal.core.dom.parser.cpp; + +import org.eclipse.cdt.core.dom.ILinkage; +import org.eclipse.cdt.core.dom.ast.ASTTypeUtil; +import org.eclipse.cdt.core.dom.ast.DOMException; +import org.eclipse.cdt.core.dom.ast.IASTNode; +import org.eclipse.cdt.core.dom.ast.IBinding; +import org.eclipse.cdt.core.dom.ast.IScope; +import org.eclipse.cdt.core.dom.ast.IType; +import org.eclipse.cdt.core.dom.ast.cpp.ICPPAliasTemplate; +import org.eclipse.cdt.core.dom.ast.cpp.ICPPAliasTemplateInstance; +import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateArgument; +import org.eclipse.cdt.core.dom.ast.cpp.ICPPTemplateParameterMap; +import org.eclipse.cdt.core.parser.util.CharArrayUtils; +import org.eclipse.cdt.internal.core.dom.Linkage; +import org.eclipse.cdt.internal.core.dom.parser.ITypeContainer; +import org.eclipse.cdt.internal.core.dom.parser.cpp.semantics.CPPVisitor; + +public class CPPAliasTemplateInstance extends CPPSpecialization implements ICPPAliasTemplateInstance, + ITypeContainer { + private IType aliasedType; + private ICPPTemplateArgument[] fArguments; + + public CPPAliasTemplateInstance(ICPPAliasTemplate aliasTemplate, IType aliasedType, IBinding owner, + ICPPTemplateParameterMap argumentMap, ICPPTemplateArgument[] arguments) { + super(aliasTemplate, owner, argumentMap); + this.aliasedType = aliasedType; + this.fArguments = arguments; + } + + @Override + public ICPPAliasTemplate getTemplateDefinition() { + return (ICPPAliasTemplate) super.getSpecializedBinding(); + } + + @Override + public boolean isSameType(IType other) { + if (other == aliasedType) + return true; + if (aliasedType != null) { + return aliasedType.isSameType(other); + } + return false; + } + + @Override + public IType getType() { + return aliasedType; + } + + @Override + public void setType(IType type) { + aliasedType = type; + } + + @Override + public Object clone() { + try { + return super.clone(); + } catch (CloneNotSupportedException e) { + } + return null; + } + + @Override + public String getName() { + return new String(getNameCharArray()); + } + + @Override + public char[] getNameCharArray() { + char[] name = getTemplateDefinition().getNameCharArray(); + if (name != null) { + return name; + } + return CharArrayUtils.EMPTY_CHAR_ARRAY; + } + + @Override + public ILinkage getLinkage() { + return Linkage.CPP_LINKAGE; + } + + @Override + public IBinding getOwner() { + if (getTemplateDefinition() != null) { + return getTemplateDefinition().getOwner(); + } + return null; + } + + @Override + public IScope getScope() throws DOMException { + if (getTemplateDefinition() != null) { + return getTemplateDefinition().getScope(); + } + return null; + } + + @Override + public String[] getQualifiedName() { + return CPPVisitor.getQualifiedName(this); + } + + @Override + public char[][] getQualifiedNameCharArray() { + return CPPVisitor.getQualifiedNameCharArray(this); + } + + @Override + public boolean isGloballyQualified() throws DOMException { + return getTemplateDefinition().isGloballyQualified(); + } + + @Override + public IASTNode getDefinition() { + if (getTemplateDefinition() instanceof ICPPInternalBinding) { + return ((ICPPInternalBinding) getTemplateDefinition()).getDefinition(); + } + return null; + } + + @Override + public IASTNode[] getDeclarations() { + return null; + } + + @Override + public void addDefinition(IASTNode node) { + throw new UnsupportedOperationException(); + } + + @Override + public void addDeclaration(IASTNode node) { + throw new UnsupportedOperationException(); + } + + /** For debugging only. */ + @Override + public String toString() { + return ASTTypeUtil.getQualifiedName(this) + " -> " + ASTTypeUtil.getType(aliasedType, true); //$NON-NLS-1$ + } + + @Override + public ICPPTemplateArgument[] getTemplateArguments() { + return fArguments; + } + + @Override + public boolean isExplicitSpecialization() { + // Alias templates cannot have explicit specializations. + return false; + } +} diff --git a/core/org.eclipse.cdt.core/schema/buildConfigProvider.exsd b/core/org.eclipse.cdt.core/schema/buildConfigProvider.exsd index 3abc3226dcc..c2d7de5cf85 100644 --- a/core/org.eclipse.cdt.core/schema/buildConfigProvider.exsd +++ b/core/org.eclipse.cdt.core/schema/buildConfigProvider.exsd @@ -1,119 +1,119 @@ - - - - - - - - - [Enter description of this extension point.] - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - [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.] - - - - - + + + + + + + + + [Enter description of this extension point.] + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + [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/core/org.eclipse.cdt.core/schema/toolChainProvider.exsd b/core/org.eclipse.cdt.core/schema/toolChainProvider.exsd index 78c09ea5a12..b4962a3957e 100644 --- a/core/org.eclipse.cdt.core/schema/toolChainProvider.exsd +++ b/core/org.eclipse.cdt.core/schema/toolChainProvider.exsd @@ -1,132 +1,132 @@ - - - - - - - - - A toolchain provider provides automatically discovered toolchains when requested. Providers have enablement to make sure they aren't called unless there's a good chance they have toolchains to offer. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - [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.] - - - - - + + + + + + + + + A toolchain provider provides automatically discovered toolchains when requested. Providers have enablement to make sure they aren't called unless there's a good chance they have toolchains to offer. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + [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/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/build/IToolChain.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/build/IToolChain.java index 3e9bd08818a..fab7d8ad5cf 100644 --- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/build/IToolChain.java +++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/core/build/IToolChain.java @@ -1,274 +1,274 @@ -/******************************************************************************* - * 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.core.build; - -import java.net.URI; -import java.nio.file.Path; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import java.util.Map; - -import org.eclipse.cdt.core.envvar.IEnvironmentVariable; -import org.eclipse.cdt.core.model.ILanguage; -import org.eclipse.cdt.core.parser.IExtendedScannerInfo; -import org.eclipse.core.resources.IBuildConfiguration; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.runtime.IAdaptable; - -/** - * Toolchains are a collection of tools that take the source code and converts - * it into an executable system. - * - * @since 6.0 - */ -public interface IToolChain extends IAdaptable { - - /** - * Property: The OS the toolchain builds for. - */ - static final String ATTR_OS = "os"; //$NON-NLS-1$ - - /** - * Property: The CPU architecture the toolchain supports. - */ - static final String ATTR_ARCH = "arch"; //$NON-NLS-1$ - - /** - * Property: A package ID to reflect different version/package line up of - * the platform this toolchain supports. - */ - static final String ATTR_PACKAGE = "package"; //$NON-NLS-1$ - - /** - * The provider of the toolchain. - * - * @return toolchain provider - */ - IToolChainProvider getProvider(); - - /** - * The ID of the toolchain - * - * @return toolchain ID - */ - String getId(); - - /** - * The version of the toolchain - * - * @deprecated the version doesn't matter. id's for a given type must be unique. - * @return toolchain version - */ - @Deprecated - String getVersion(); - - /** - * The user friendly name for the toolchain - * - * @return toolchain name - */ - String getName(); - - /** - * The type id for the toolchain. The combination of type id and toolchain id - * uniquely identify the toolchain in the system. - * - * @since 6.4 - */ - default String getTypeId() { - // Subclasses really need to override this. There can be multiple providers for - // a given toolchain type. - return getProvider().getId(); - } - - /** - * Returns an property of the toolchain. Used to determine applicability of - * a toolchain for a given situation. - * - * @param key - * key of the property - * @return value of the property or null if the toolchain does not have that - * property - */ - String getProperty(String key); - - /** - * Set a property on the toolchain. - * - * @param key - * key of the property - * @param value - * value of the property - */ - void setProperty(String key, String value); - - /** - * Return the environment variables to be set when invoking the tools in the - * toolchain. - * - * @return environment variables - */ - IEnvironmentVariable[] getVariables(); - - /** - * Return the environment variable of the given name used when invoking the - * toolchain. - * - * @param name - * environment variable name - * @return environment variable value - */ - IEnvironmentVariable getVariable(String name); - - /** - * Returns the error parser IDs use to create error markers for builds with - * this toolchain. - * - * @return error parser IDs - */ - String[] getErrorParserIds(); - - /** - * Returns the IDs for the binary parsers that can parse the build output of - * the toolchain. - * - * @return binary parser IDs for this toolchain - */ - String getBinaryParserId(); - - /** - * Get the scanner info for a given build config, command, base scanner - * info, resource and build directory. - * - * @param buildConfig - * the build configuration this scanner info applies to - * @param command - * the compile command that is used to build the resource - * @param baseScannerInfo - * base scanner info that this scanner info extends/replaces - * @param resource - * the resource this scanner info applies to, usually a source - * file - * @param buildDirectoryURI - * where the build command is run to build this resource - * @return scanner info for this resource - * @since 6.1 - */ - default IExtendedScannerInfo getScannerInfo(IBuildConfiguration buildConfig, List command, - IExtendedScannerInfo baseScannerInfo, IResource resource, URI buildDirectoryURI) { - return null; - } - - @Deprecated - default IExtendedScannerInfo getScannerInfo(IBuildConfiguration buildConfig, Path command, String[] args, - IExtendedScannerInfo baseScannerInfo, IResource resource, URI buildDirectoryURI) { - List commandStrings = new ArrayList<>(args.length + 1); - commandStrings.add(command.toString()); - commandStrings.addAll(Arrays.asList(args)); - return getScannerInfo(buildConfig, commandStrings, baseScannerInfo, resource, buildDirectoryURI); - } - - /** - * Return the default scanner info for this toolchain. This is used before - * any build information is available to provide at least a minimal scanner - * info based on the compiler built-ins. - * - * @param buildConfig - * the build configuration this scanner info applies to - * @param baseScannerInfo - * base scanner info that this scanner info extends/replaces - * @param language - * the source language that selects the tool to provide scanner - * info for - * @param buildDirectoryURI - * the build directory that would be used to run commands - * @returns default scanner info for this language - * @since 6.1 - */ - default IExtendedScannerInfo getDefaultScannerInfo(IBuildConfiguration buildConfig, - IExtendedScannerInfo baseScannerInfo, ILanguage language, URI buildDirectoryURI) { - return null; - } - - /** - * Returns the absolute path of the tool represented by the command - * - * @param command - * the command as it usually appears on the command line - * @return the absolute path to the tool for the command - */ - Path getCommandPath(Path command); - - /** - * Returns the list of compiler tools. - * - * @return list of compiler tools - */ - String[] getCompileCommands(); - - /** - * Returns the list of compiler tools for a given language. - * - * @param language - * the language for the commands - * @return the compile commands for the language - * @since 6.1 - */ - default String[] getCompileCommands(ILanguage language) { - return new String[0]; - } - - /** - * Returns the list of resources referenced in a compile command. - * - * @param command - * the compile command - * @param buildDirectoryURI - * the directory the compile command runs in - * @return the list of resources referenced in the compile command - * @since 6.1 - */ - default IResource[] getResourcesFromCommand(List command, URI buildDirectoryURI) { - return new IResource[0]; - } - - @Deprecated - default IResource[] getResourcesFromCommand(String[] command, URI buildDirectoryURI) { - return getResourcesFromCommand(Arrays.asList(command), buildDirectoryURI); - } - - /** - * Strips the resources from the compile command. Use to produce the common - * parts of the command shared by a number of resources. - * - * @param command - * the original compile command - * @param resources - * the resources this command compiles for usually returned by - * getResourcesFromCommand() - * @return the stripped command - * @since 6.1 - */ - default List stripCommand(List command, IResource[] resources) { - return command; - } - - /** - * @since 6.1 - */ - default boolean matches(Map properties) { - for (Map.Entry property : properties.entrySet()) { - if (!property.getValue().equals(getProperty(property.getKey()))) { - return false; - } - } - return true; - } - -} +/******************************************************************************* + * 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.core.build; + +import java.net.URI; +import java.nio.file.Path; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.Map; + +import org.eclipse.cdt.core.envvar.IEnvironmentVariable; +import org.eclipse.cdt.core.model.ILanguage; +import org.eclipse.cdt.core.parser.IExtendedScannerInfo; +import org.eclipse.core.resources.IBuildConfiguration; +import org.eclipse.core.resources.IResource; +import org.eclipse.core.runtime.IAdaptable; + +/** + * Toolchains are a collection of tools that take the source code and converts + * it into an executable system. + * + * @since 6.0 + */ +public interface IToolChain extends IAdaptable { + + /** + * Property: The OS the toolchain builds for. + */ + static final String ATTR_OS = "os"; //$NON-NLS-1$ + + /** + * Property: The CPU architecture the toolchain supports. + */ + static final String ATTR_ARCH = "arch"; //$NON-NLS-1$ + + /** + * Property: A package ID to reflect different version/package line up of + * the platform this toolchain supports. + */ + static final String ATTR_PACKAGE = "package"; //$NON-NLS-1$ + + /** + * The provider of the toolchain. + * + * @return toolchain provider + */ + IToolChainProvider getProvider(); + + /** + * The ID of the toolchain + * + * @return toolchain ID + */ + String getId(); + + /** + * The version of the toolchain + * + * @deprecated the version doesn't matter. id's for a given type must be unique. + * @return toolchain version + */ + @Deprecated + String getVersion(); + + /** + * The user friendly name for the toolchain + * + * @return toolchain name + */ + String getName(); + + /** + * The type id for the toolchain. The combination of type id and toolchain id + * uniquely identify the toolchain in the system. + * + * @since 6.4 + */ + default String getTypeId() { + // Subclasses really need to override this. There can be multiple providers for + // a given toolchain type. + return getProvider().getId(); + } + + /** + * Returns an property of the toolchain. Used to determine applicability of + * a toolchain for a given situation. + * + * @param key + * key of the property + * @return value of the property or null if the toolchain does not have that + * property + */ + String getProperty(String key); + + /** + * Set a property on the toolchain. + * + * @param key + * key of the property + * @param value + * value of the property + */ + void setProperty(String key, String value); + + /** + * Return the environment variables to be set when invoking the tools in the + * toolchain. + * + * @return environment variables + */ + IEnvironmentVariable[] getVariables(); + + /** + * Return the environment variable of the given name used when invoking the + * toolchain. + * + * @param name + * environment variable name + * @return environment variable value + */ + IEnvironmentVariable getVariable(String name); + + /** + * Returns the error parser IDs use to create error markers for builds with + * this toolchain. + * + * @return error parser IDs + */ + String[] getErrorParserIds(); + + /** + * Returns the IDs for the binary parsers that can parse the build output of + * the toolchain. + * + * @return binary parser IDs for this toolchain + */ + String getBinaryParserId(); + + /** + * Get the scanner info for a given build config, command, base scanner + * info, resource and build directory. + * + * @param buildConfig + * the build configuration this scanner info applies to + * @param command + * the compile command that is used to build the resource + * @param baseScannerInfo + * base scanner info that this scanner info extends/replaces + * @param resource + * the resource this scanner info applies to, usually a source + * file + * @param buildDirectoryURI + * where the build command is run to build this resource + * @return scanner info for this resource + * @since 6.1 + */ + default IExtendedScannerInfo getScannerInfo(IBuildConfiguration buildConfig, List command, + IExtendedScannerInfo baseScannerInfo, IResource resource, URI buildDirectoryURI) { + return null; + } + + @Deprecated + default IExtendedScannerInfo getScannerInfo(IBuildConfiguration buildConfig, Path command, String[] args, + IExtendedScannerInfo baseScannerInfo, IResource resource, URI buildDirectoryURI) { + List commandStrings = new ArrayList<>(args.length + 1); + commandStrings.add(command.toString()); + commandStrings.addAll(Arrays.asList(args)); + return getScannerInfo(buildConfig, commandStrings, baseScannerInfo, resource, buildDirectoryURI); + } + + /** + * Return the default scanner info for this toolchain. This is used before + * any build information is available to provide at least a minimal scanner + * info based on the compiler built-ins. + * + * @param buildConfig + * the build configuration this scanner info applies to + * @param baseScannerInfo + * base scanner info that this scanner info extends/replaces + * @param language + * the source language that selects the tool to provide scanner + * info for + * @param buildDirectoryURI + * the build directory that would be used to run commands + * @returns default scanner info for this language + * @since 6.1 + */ + default IExtendedScannerInfo getDefaultScannerInfo(IBuildConfiguration buildConfig, + IExtendedScannerInfo baseScannerInfo, ILanguage language, URI buildDirectoryURI) { + return null; + } + + /** + * Returns the absolute path of the tool represented by the command + * + * @param command + * the command as it usually appears on the command line + * @return the absolute path to the tool for the command + */ + Path getCommandPath(Path command); + + /** + * Returns the list of compiler tools. + * + * @return list of compiler tools + */ + String[] getCompileCommands(); + + /** + * Returns the list of compiler tools for a given language. + * + * @param language + * the language for the commands + * @return the compile commands for the language + * @since 6.1 + */ + default String[] getCompileCommands(ILanguage language) { + return new String[0]; + } + + /** + * Returns the list of resources referenced in a compile command. + * + * @param command + * the compile command + * @param buildDirectoryURI + * the directory the compile command runs in + * @return the list of resources referenced in the compile command + * @since 6.1 + */ + default IResource[] getResourcesFromCommand(List command, URI buildDirectoryURI) { + return new IResource[0]; + } + + @Deprecated + default IResource[] getResourcesFromCommand(String[] command, URI buildDirectoryURI) { + return getResourcesFromCommand(Arrays.asList(command), buildDirectoryURI); + } + + /** + * Strips the resources from the compile command. Use to produce the common + * parts of the command shared by a number of resources. + * + * @param command + * the original compile command + * @param resources + * the resources this command compiles for usually returned by + * getResourcesFromCommand() + * @return the stripped command + * @since 6.1 + */ + default List stripCommand(List command, IResource[] resources) { + return command; + } + + /** + * @since 6.1 + */ + default boolean matches(Map properties) { + for (Map.Entry property : properties.entrySet()) { + if (!property.getValue().equals(getProperty(property.getKey()))) { + return false; + } + } + return true; + } + +} diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/StreamProgressMonitor.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/StreamProgressMonitor.java index 551401d8e6a..aa7f7d2f31e 100644 --- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/StreamProgressMonitor.java +++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/StreamProgressMonitor.java @@ -1,109 +1,109 @@ -/******************************************************************************* - * Copyright (c) 2000, 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 +/******************************************************************************* + * Copyright (c) 2000, 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.internal.core; - -import java.io.IOException; -import java.io.OutputStream; - -import org.eclipse.core.runtime.IProgressMonitor; - -/** - * Helper class to report progress of the build via {@link IProgressMonitor} - */ -public class StreamProgressMonitor extends OutputStream { - - private IProgressMonitor monitor; - private OutputStream console; - private final int fTotalWork; - private int halfWay; - private int currentIncrement = 2; - private int nextProgress = currentIncrement; - private int worked = 0; - - public StreamProgressMonitor(IProgressMonitor mon, OutputStream cos, int totalWork) { - monitor = mon; - console = cos; - fTotalWork = totalWork; - halfWay = fTotalWork / 2; - monitor.beginTask("", fTotalWork); //$NON-NLS-1$ - } - - private void progressUpdate() { - if (--nextProgress <= 0) { - //we have exhausted the current increment, so report progress - if (fTotalWork > worked) { - monitor.worked(1); - } - worked++; - if (worked >= halfWay) { - //we have passed the current halfway point, so double the - //increment and reset the halfway point. - currentIncrement *= 2; - halfWay += (fTotalWork - halfWay) / 2; - } - //reset the progress counter to another full increment - nextProgress = currentIncrement; - } - } - /** - * @see java.io.OutputStream#close() - */ - @Override - public void close() throws IOException { - if (console != null) { - console.close(); - } - monitor.done(); - } - - /** - * @see java.io.OutputStream#flush() - */ - @Override - public void flush() throws IOException { - if (console != null) { - console.flush(); - } - } - - /** - * @see java.io.OutputStream#write(int) - */ - @Override - public synchronized void write(int b) throws IOException { - if (console != null) { - console.write(b); - } - progressUpdate(); - } - - /** - * @see java.io.OutputStream#write(byte[], int, int) - */ - @Override - public synchronized void write(byte[] b, int off, int len) throws IOException { - if (b == null) { - throw new NullPointerException(); - } else if (off != 0 || (len < 0) || (len > b.length)) { - throw new IndexOutOfBoundsException(); - } else if (len == 0) { - return; - } - if (console != null) { - console.write(b, off, len); - } - progressUpdate(); - } - - public int getWorkDone() { - return worked; - } -} +package org.eclipse.cdt.internal.core; + +import java.io.IOException; +import java.io.OutputStream; + +import org.eclipse.core.runtime.IProgressMonitor; + +/** + * Helper class to report progress of the build via {@link IProgressMonitor} + */ +public class StreamProgressMonitor extends OutputStream { + + private IProgressMonitor monitor; + private OutputStream console; + private final int fTotalWork; + private int halfWay; + private int currentIncrement = 2; + private int nextProgress = currentIncrement; + private int worked = 0; + + public StreamProgressMonitor(IProgressMonitor mon, OutputStream cos, int totalWork) { + monitor = mon; + console = cos; + fTotalWork = totalWork; + halfWay = fTotalWork / 2; + monitor.beginTask("", fTotalWork); //$NON-NLS-1$ + } + + private void progressUpdate() { + if (--nextProgress <= 0) { + //we have exhausted the current increment, so report progress + if (fTotalWork > worked) { + monitor.worked(1); + } + worked++; + if (worked >= halfWay) { + //we have passed the current halfway point, so double the + //increment and reset the halfway point. + currentIncrement *= 2; + halfWay += (fTotalWork - halfWay) / 2; + } + //reset the progress counter to another full increment + nextProgress = currentIncrement; + } + } + /** + * @see java.io.OutputStream#close() + */ + @Override + public void close() throws IOException { + if (console != null) { + console.close(); + } + monitor.done(); + } + + /** + * @see java.io.OutputStream#flush() + */ + @Override + public void flush() throws IOException { + if (console != null) { + console.flush(); + } + } + + /** + * @see java.io.OutputStream#write(int) + */ + @Override + public synchronized void write(int b) throws IOException { + if (console != null) { + console.write(b); + } + progressUpdate(); + } + + /** + * @see java.io.OutputStream#write(byte[], int, int) + */ + @Override + public synchronized void write(byte[] b, int off, int len) throws IOException { + if (b == null) { + throw new NullPointerException(); + } else if (off != 0 || (len < 0) || (len > b.length)) { + throw new IndexOutOfBoundsException(); + } else if (len == 0) { + return; + } + if (console != null) { + console.write(b, off, len); + } + progressUpdate(); + } + + public int getWorkDone() { + return worked; + } +} diff --git a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/envvar/ToolChainEnvironmentSupplier.java b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/envvar/ToolChainEnvironmentSupplier.java index 889fade0c6c..176312db830 100644 --- a/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/envvar/ToolChainEnvironmentSupplier.java +++ b/core/org.eclipse.cdt.core/src/org/eclipse/cdt/internal/core/envvar/ToolChainEnvironmentSupplier.java @@ -1,64 +1,64 @@ -/******************************************************************************* - * 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.internal.core.envvar; - -import org.eclipse.cdt.core.CCorePlugin; -import org.eclipse.cdt.core.build.ICBuildConfiguration; -import org.eclipse.cdt.core.build.IToolChain; -import org.eclipse.cdt.core.envvar.IEnvironmentVariable; -import org.eclipse.core.resources.IBuildConfiguration; -import org.eclipse.core.runtime.CoreException; - -public class ToolChainEnvironmentSupplier implements ICoreEnvironmentVariableSupplier { - - @Override - public IEnvironmentVariable getVariable(String name, Object context) { - if (context instanceof IBuildConfiguration) { - ICBuildConfiguration config = ((IBuildConfiguration) context) - .getAdapter(ICBuildConfiguration.class); - if (config != null) { - try { - IToolChain toolChain = config.getToolChain(); - if (toolChain != null) { - return toolChain.getVariable(name); - } - } catch (CoreException e) { - CCorePlugin.log(e); - return null; - } - } - } - return null; - } - - @Override - public IEnvironmentVariable[] getVariables(Object context) { - if (context instanceof IBuildConfiguration) { - ICBuildConfiguration config = ((IBuildConfiguration) context) - .getAdapter(ICBuildConfiguration.class); - if (config != null) { - try { - IToolChain toolChain = config.getToolChain(); - if (toolChain != null) { - return toolChain.getVariables(); - } - } catch (CoreException e) { - CCorePlugin.log(e); - return null; - } - } - } - return null; - } - - @Override - public boolean appendEnvironment(Object context) { - return true; - } - -} +/******************************************************************************* + * 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.internal.core.envvar; + +import org.eclipse.cdt.core.CCorePlugin; +import org.eclipse.cdt.core.build.ICBuildConfiguration; +import org.eclipse.cdt.core.build.IToolChain; +import org.eclipse.cdt.core.envvar.IEnvironmentVariable; +import org.eclipse.core.resources.IBuildConfiguration; +import org.eclipse.core.runtime.CoreException; + +public class ToolChainEnvironmentSupplier implements ICoreEnvironmentVariableSupplier { + + @Override + public IEnvironmentVariable getVariable(String name, Object context) { + if (context instanceof IBuildConfiguration) { + ICBuildConfiguration config = ((IBuildConfiguration) context) + .getAdapter(ICBuildConfiguration.class); + if (config != null) { + try { + IToolChain toolChain = config.getToolChain(); + if (toolChain != null) { + return toolChain.getVariable(name); + } + } catch (CoreException e) { + CCorePlugin.log(e); + return null; + } + } + } + return null; + } + + @Override + public IEnvironmentVariable[] getVariables(Object context) { + if (context instanceof IBuildConfiguration) { + ICBuildConfiguration config = ((IBuildConfiguration) context) + .getAdapter(ICBuildConfiguration.class); + if (config != null) { + try { + IToolChain toolChain = config.getToolChain(); + if (toolChain != null) { + return toolChain.getVariables(); + } + } catch (CoreException e) { + CCorePlugin.log(e); + return null; + } + } + } + return null; + } + + @Override + public boolean appendEnvironment(Object context) { + return true; + } + +} diff --git a/core/org.eclipse.cdt.core/templateengine/org/eclipse/cdt/core/templateengine/TemplateCategory.java b/core/org.eclipse.cdt.core/templateengine/org/eclipse/cdt/core/templateengine/TemplateCategory.java index 265ee19d3a4..058b50fb320 100644 --- a/core/org.eclipse.cdt.core/templateengine/org/eclipse/cdt/core/templateengine/TemplateCategory.java +++ b/core/org.eclipse.cdt.core/templateengine/org/eclipse/cdt/core/templateengine/TemplateCategory.java @@ -1,44 +1,44 @@ -/******************************************************************************* - * Copyright (c) 2012 Wind River 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: - * Doug Schaefer - initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.core.templateengine; - -import java.util.List; - -/** - * @author Doug Schaefer - * @since 5.4 - */ -public class TemplateCategory { - - private final String id; - private String label; - private List parentCategoryIds; - - public TemplateCategory(String id, String label, List parentCategoryIds) { - this.id = id; - this.label = label; - this.parentCategoryIds = parentCategoryIds; - } - - public String getId() { - return id; - } - - public String getLabel() { - return label; - } - - public List getParentCategoryIds() { - return parentCategoryIds; - } - -} +/******************************************************************************* + * Copyright (c) 2012 Wind River 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: + * Doug Schaefer - initial API and implementation + *******************************************************************************/ + +package org.eclipse.cdt.core.templateengine; + +import java.util.List; + +/** + * @author Doug Schaefer + * @since 5.4 + */ +public class TemplateCategory { + + private final String id; + private String label; + private List parentCategoryIds; + + public TemplateCategory(String id, String label, List parentCategoryIds) { + this.id = id; + this.label = label; + this.parentCategoryIds = parentCategoryIds; + } + + public String getId() { + return id; + } + + public String getLabel() { + return label; + } + + public List getParentCategoryIds() { + return parentCategoryIds; + } + +} diff --git a/core/org.eclipse.cdt.core/templateengine/org/eclipse/cdt/core/templateengine/TemplateEngine2.java b/core/org.eclipse.cdt.core/templateengine/org/eclipse/cdt/core/templateengine/TemplateEngine2.java index 1e172ca620c..a6aa4c1d247 100644 --- a/core/org.eclipse.cdt.core/templateengine/org/eclipse/cdt/core/templateengine/TemplateEngine2.java +++ b/core/org.eclipse.cdt.core/templateengine/org/eclipse/cdt/core/templateengine/TemplateEngine2.java @@ -1,33 +1,33 @@ -/******************************************************************************* - * Copyright (c) 2012 Wind River 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: - * Doug Schaefer - initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.core.templateengine; - -/** - * @author Doug Schaefer - * @since 5.4 - */ -public class TemplateEngine2 extends TemplateEngine { - - /** - * Project type for new templates. Default if not set in extension. - */ - public static final String NEW_TEMPLATE = "newTemplate"; //$NON-NLS-1$ - - public static TemplateEngine2 getDefault() { - return (TemplateEngine2)TemplateEngine.getDefault(); - } - - public TemplateCategory getCategory(String id) { - return categoryMap.get(id); - } - -} +/******************************************************************************* + * Copyright (c) 2012 Wind River 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: + * Doug Schaefer - initial API and implementation + *******************************************************************************/ + +package org.eclipse.cdt.core.templateengine; + +/** + * @author Doug Schaefer + * @since 5.4 + */ +public class TemplateEngine2 extends TemplateEngine { + + /** + * Project type for new templates. Default if not set in extension. + */ + public static final String NEW_TEMPLATE = "newTemplate"; //$NON-NLS-1$ + + public static TemplateEngine2 getDefault() { + return (TemplateEngine2)TemplateEngine.getDefault(); + } + + public TemplateCategory getCategory(String id) { + return categoryMap.get(id); + } + +} diff --git a/core/org.eclipse.cdt.core/templateengine/org/eclipse/cdt/core/templateengine/TemplateInfo2.java b/core/org.eclipse.cdt.core/templateengine/org/eclipse/cdt/core/templateengine/TemplateInfo2.java index 478e0cf2618..5a11b23ed4f 100644 --- a/core/org.eclipse.cdt.core/templateengine/org/eclipse/cdt/core/templateengine/TemplateInfo2.java +++ b/core/org.eclipse.cdt.core/templateengine/org/eclipse/cdt/core/templateengine/TemplateInfo2.java @@ -1,39 +1,39 @@ -/******************************************************************************* - * Copyright (c) 2012 Wind River 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: - * Doug Schaefer - initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.core.templateengine; - -import java.util.List; -import java.util.Set; - -/** - * Template info extended to include new stuff for new new project wizard UI. - * - * @author Doug Schaefer - * @since 5.4 - */ -public class TemplateInfo2 extends TemplateInfo { - - private List parentCategoryIds; - - public TemplateInfo2(String templateId, String projectTypeId, String filterPattern, - String templatePath, String pluginId, Set toolChainIdSet, - Object extraPagesProvider, boolean isCategory, List parentCategoryIds) { - super(templateId, projectTypeId, filterPattern, templatePath, pluginId, toolChainIdSet, - extraPagesProvider, isCategory); - this.parentCategoryIds = parentCategoryIds; - } - - public List getParentCategoryIds() { - return parentCategoryIds; - } - -} +/******************************************************************************* + * Copyright (c) 2012 Wind River 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: + * Doug Schaefer - initial API and implementation + *******************************************************************************/ + +package org.eclipse.cdt.core.templateengine; + +import java.util.List; +import java.util.Set; + +/** + * Template info extended to include new stuff for new new project wizard UI. + * + * @author Doug Schaefer + * @since 5.4 + */ +public class TemplateInfo2 extends TemplateInfo { + + private List parentCategoryIds; + + public TemplateInfo2(String templateId, String projectTypeId, String filterPattern, + String templatePath, String pluginId, Set toolChainIdSet, + Object extraPagesProvider, boolean isCategory, List parentCategoryIds) { + super(templateId, projectTypeId, filterPattern, templatePath, pluginId, toolChainIdSet, + extraPagesProvider, isCategory); + this.parentCategoryIds = parentCategoryIds; + } + + public List getParentCategoryIds() { + return parentCategoryIds; + } + +} diff --git a/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/internal/core/Cygwin.java b/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/internal/core/Cygwin.java index 902f6e1ba54..80884db7c83 100644 --- a/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/internal/core/Cygwin.java +++ b/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/internal/core/Cygwin.java @@ -1,333 +1,333 @@ -/******************************************************************************* - * Copyright (c) 2012, 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.internal.core; - -import java.io.BufferedReader; -import java.io.File; -import java.io.IOException; -import java.io.InputStreamReader; -import java.util.Collections; -import java.util.Map; - -import org.eclipse.cdt.core.CCorePlugin; -import org.eclipse.cdt.core.envvar.IEnvironmentVariable; -import org.eclipse.cdt.core.settings.model.ICConfigurationDescription; -import org.eclipse.cdt.core.settings.model.util.CDataUtil; -import org.eclipse.cdt.utils.PathUtil; -import org.eclipse.cdt.utils.WindowsRegistry; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.Path; -import org.eclipse.core.runtime.Platform; - -/** - * A collection of cygwin-related utilities. - */ -public class Cygwin { - public static final String ENV_CYGWIN_HOME = "CYGWIN_HOME"; //$NON-NLS-1$ - private static final String ENV_PATH = "PATH"; //$NON-NLS-1$ - - private static final String CYGPATH = "cygpath"; //$NON-NLS-1$ - private static final String DEFAULT_ROOT = "C:\\cygwin"; //$NON-NLS-1$ - private static final String CYGWIN_DLL = "cygwin1.dll"; //$NON-NLS-1$ - private static final String REGISTRY_KEY_SETUP = "SOFTWARE\\Cygwin\\setup"; //$NON-NLS-1$ - private static final String REGISTRY_KEY_SETUP_WIN64 = "SOFTWARE\\Wow6432Node\\Cygwin\\setup"; //$NON-NLS-1$ - // note that in Cygwin 1.7 the mount point storage has been moved out of the registry - private static final String REGISTRY_KEY_MOUNTS = "SOFTWARE\\Cygnus Solutions\\Cygwin\\mounts v2\\"; //$NON-NLS-1$ - private static final String PATH_NAME = "native"; //$NON-NLS-1$ - private static final String ROOTPATTERN = "/"; //$NON-NLS-1$ - private static final char SLASH = '/'; - private static final char BACKSLASH = '\\'; - - private static final boolean isWindowsPlatform = Platform.getOS().equals(Platform.OS_WIN32); - - private static String envPathValueCached = null; - private static String envCygwinHomeValueCached = null; - private static String cygwinLocation = null; - private static boolean isCygwinLocationCached = false; - - private final static Map cygpathLocationCache = Collections.synchronizedMap(new LRUCache(1,20)); - private final static Map translatedPathsCache = Collections.synchronizedMap(new LRUCache(10,500)); - - /** - * Find location of "cygpath" utility on the file system. - */ - private static String findCygpathLocation(String envPath) { - if (envPath == null) { - // $PATH from user preferences - IEnvironmentVariable varPath = CCorePlugin.getDefault().getBuildEnvironmentManager().getVariable(ENV_PATH, (ICConfigurationDescription) null, true); - if (varPath != null) { - envPath = varPath.getValue(); - } - } - - String cygpathLocation = cygpathLocationCache.get(envPath); - if (cygpathLocation == null) { - IPath loc = PathUtil.findProgramLocation(CYGPATH, envPath); - cygpathLocation = loc != null ? loc.toOSString() : null; - cygpathLocationCache.put(envPath, cygpathLocation); - } - return cygpathLocation; - } - - /** - * Check if cygwin path conversion utilities are available in the path. - * Tells whether cygwin is installed in the path. - * - * @param envPath - list of directories to search for cygwin utilities separated - * by path separator (format of environment variable $PATH) - * or {@code null} to use current $PATH. - * @return {@code true} if cygwin is available, {@code false} otherwise. - */ - public static boolean isAvailable(String envPath) { - return isWindowsPlatform && findCygpathLocation(envPath) != null; - } - - /** - * Check if cygwin path conversion utilities are available in $PATH. - * Tells whether cygwin is installed in the path. - * - * @return {@code true} if cygwin is available, {@code false} otherwise. - */ - public static boolean isAvailable() { - return isWindowsPlatform && findCygpathLocation(null) != null; - } - - /** - * Run program (assuming cygpath) and return the translated path which is the first line of output. - */ - private static String runCygpath(String[] args) throws IOException { - String command = getCommand(args); - String translatedPath = translatedPathsCache.get(command); - if (translatedPath == null) { - Process cygpathProcess = Runtime.getRuntime().exec(args); - BufferedReader stdout = new BufferedReader(new InputStreamReader(cygpathProcess.getInputStream())); - String firstLine = null; - try { - firstLine = stdout.readLine(); - } finally { - stdout.close(); - } - if (firstLine == null) { - throw new IOException("Unable read output from command=[" + command + "]"); //$NON-NLS-1$ //$NON-NLS-2$ - } - translatedPath = firstLine.trim(); - translatedPathsCache.put(command, translatedPath); - } - - return translatedPath; - } - - /** - * Construct a command from arguments array. - */ - private static String getCommand(String[] args) { - String command = ""; //$NON-NLS-1$ - for (String arg : args) { - command = command + arg + ' '; - } - return command.trim(); - } - - /** - * Conversion from Cygwin path to Windows path. - * Note that there is no need to cache results, they are already cached internally. - * - * @param cygwinPath - cygwin path. - * @param envPath - list of directories to search for cygwin utilities separated - * by path separator (format of environment variable $PATH). - * @return Windows style converted path. Note that that also converts cygwin links to their targets. - * - * @throws UnsupportedOperationException if Cygwin is unavailable. - * @throws IOException on IO problem. - */ - public static String cygwinToWindowsPath(String cygwinPath, String envPath) throws IOException, UnsupportedOperationException { - if (cygwinPath == null || cygwinPath.trim().length() == 0) - return cygwinPath; - - if (!isWindowsPlatform) { - throw new UnsupportedOperationException("Not a Windows system, Cygwin is unavailable."); //$NON-NLS-1$ - } - - String cygpathLocation = findCygpathLocation(envPath); - if (cygpathLocation == null) { - throw new UnsupportedOperationException(CYGPATH + " is not in the system search path."); //$NON-NLS-1$ - } - - String windowsPath = runCygpath(new String[] {cygpathLocation, "-w", cygwinPath}); //$NON-NLS-1$ - return windowsPath; - } - - /** - * Conversion from Cygwin path to Windows path. - * Note that there is no need to cache results, they are already cached internally. - * - * @param cygwinPath - cygwin path. - * @return Windows style converted path. Note that that also converts cygwin links to their targets. - * - * @throws UnsupportedOperationException if Cygwin is unavailable. - * @throws IOException on IO problem. - */ - public static String cygwinToWindowsPath(String cygwinPath) throws IOException, UnsupportedOperationException { - return cygwinToWindowsPath(cygwinPath, null); - } - - /** - * Conversion from Windows path to Cygwin path. - * Note that there is no need to cache results, they are already cached internally. - * - * @param windowsPath - Windows path. - * @param envPath - list of directories to search for cygwin utilities (value of environment variable $PATH). - * @return Cygwin style converted path. - * - * @throws UnsupportedOperationException if Cygwin is unavailable. - * @throws IOException on IO problem. - */ - public static String windowsToCygwinPath(String windowsPath, String envPath) throws IOException, UnsupportedOperationException { - if (windowsPath == null || windowsPath.trim().length() == 0) - return windowsPath; - - if (!isWindowsPlatform) { - throw new UnsupportedOperationException("Not a Windows system, Cygwin is unavailable."); //$NON-NLS-1$ - } - - String cygpathLocation = findCygpathLocation(envPath); - if (cygpathLocation == null) { - throw new UnsupportedOperationException(CYGPATH + " is not in the system search path."); //$NON-NLS-1$ - } - - String cygwinPath = runCygpath(new String[] {cygpathLocation, "-u", windowsPath}); //$NON-NLS-1$ - return cygwinPath; - } - - /** - * Conversion from Windows path to Cygwin path. - * Note that there is no need to cache results, they are already cached internally. - * - * @param windowsPath - Windows path. - * @return Cygwin style converted path. - * - * @throws UnsupportedOperationException if Cygwin is unavailable. - * @throws IOException on IO problem. - */ - public static String windowsToCygwinPath(String windowsPath) throws IOException, UnsupportedOperationException { - return windowsToCygwinPath(windowsPath, null); - } - - /** - * Find location where Cygwin is installed. A number of locations is being checked, - * such as environment variable $CYGWIN_HOME, $PATH, Windows registry et al. - *

- * If you use this do not cache results to ensure user preferences are accounted for. - * Please rely on internal caching. - * - * @return Location of Cygwin root folder "/" on file system in Windows format. - */ - public static String getCygwinHome() { - if (!isWindowsPlatform) { - return null; - } - - IEnvironmentVariable varPath = CCorePlugin.getDefault().getBuildEnvironmentManager().getVariable(ENV_PATH, (ICConfigurationDescription) null, true); - String envPathValue = varPath != null ? varPath.getValue() : null; - IEnvironmentVariable varCygwinHome = CCorePlugin.getDefault().getBuildEnvironmentManager().getVariable(ENV_CYGWIN_HOME, (ICConfigurationDescription) null, true); - String envCygwinHomeValue = varCygwinHome != null ? varCygwinHome.getValue() : null; - - // isCygwinLocationCached is used to figure fact of caching when all cached objects are null - if (isCygwinLocationCached && CDataUtil.objectsEqual(envPathValue, envPathValueCached) && CDataUtil.objectsEqual(envCygwinHomeValue, envCygwinHomeValueCached)) { - return cygwinLocation; - } - - cygwinLocation = findCygwinRoot(envPathValue, envCygwinHomeValue); - - envPathValueCached = envPathValue; - envCygwinHomeValueCached = envCygwinHomeValue; - isCygwinLocationCached = true; - - return cygwinLocation; - } - - /** - * Reads required value from registry. Looks in both - * HKEY_CURRENT_USER and HKEY_LOCAL_MACHINE - * - * @param key Registry key - * @param name Registry value to read - * @return corresponding string value or null if nothing found - */ - private static String readValueFromRegistry(String key, String name) { - WindowsRegistry registry = WindowsRegistry.getRegistry(); - if (registry != null) { - String s = registry.getCurrentUserValue(key, name); - if(s == null) { - s = registry.getLocalMachineValue(key, name); - } - - if (s != null) { - return (s.replace(BACKSLASH, SLASH)); - } - } - return null; - } - - /** - * @return The absolute path to cygwin's root or null if not found - */ - private static String findCygwinRoot(String envPathValue, String envCygwinHomeValue) { - String rootValue = null; - - // Check $CYGWIN_HOME - if (envCygwinHomeValue != null && !envCygwinHomeValue.isEmpty()) { - IPath location = new Path(envCygwinHomeValue + "/bin/" + CYGWIN_DLL); //$NON-NLS-1$ - if (location.toFile().exists()) { - // get rootValue from "rootValue\bin\cygwin1.dll" - rootValue = location.removeLastSegments(2).toOSString(); - } - } - - // Look in PATH values. Look for cygwin1.dll - if(rootValue == null) { - IPath location = PathUtil.findProgramLocation(CYGWIN_DLL, envPathValue); - if (location != null) { - // get rootValue from "rootValue\bin\cygwin1.dll" - rootValue = location.removeLastSegments(2).toOSString(); - } - } - - // Try to find the root dir in SOFTWARE\Cygwin\setup - if(rootValue == null) { - rootValue = readValueFromRegistry(REGISTRY_KEY_SETUP, "rootdir"); //$NON-NLS-1$ - } - - // Try to find the root dir in SOFTWARE\Wow6432Node\Cygwin\setup - if(rootValue == null) { - rootValue = readValueFromRegistry(REGISTRY_KEY_SETUP_WIN64, "rootdir"); //$NON-NLS-1$ - } - - // Try to find the root dir in SOFTWARE\Cygnus Solutions - if (rootValue == null) { - rootValue = readValueFromRegistry(REGISTRY_KEY_MOUNTS + ROOTPATTERN, PATH_NAME); - } - - // Try the default Cygwin install dir - if(rootValue == null) { - File file = new File(DEFAULT_ROOT); - if (file.exists() && file.isDirectory()) - rootValue = DEFAULT_ROOT; - } - - if(rootValue != null) { - rootValue = rootValue.replace(BACKSLASH, SLASH); - } - - return rootValue; - } - -} +/******************************************************************************* + * Copyright (c) 2012, 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.internal.core; + +import java.io.BufferedReader; +import java.io.File; +import java.io.IOException; +import java.io.InputStreamReader; +import java.util.Collections; +import java.util.Map; + +import org.eclipse.cdt.core.CCorePlugin; +import org.eclipse.cdt.core.envvar.IEnvironmentVariable; +import org.eclipse.cdt.core.settings.model.ICConfigurationDescription; +import org.eclipse.cdt.core.settings.model.util.CDataUtil; +import org.eclipse.cdt.utils.PathUtil; +import org.eclipse.cdt.utils.WindowsRegistry; +import org.eclipse.core.runtime.IPath; +import org.eclipse.core.runtime.Path; +import org.eclipse.core.runtime.Platform; + +/** + * A collection of cygwin-related utilities. + */ +public class Cygwin { + public static final String ENV_CYGWIN_HOME = "CYGWIN_HOME"; //$NON-NLS-1$ + private static final String ENV_PATH = "PATH"; //$NON-NLS-1$ + + private static final String CYGPATH = "cygpath"; //$NON-NLS-1$ + private static final String DEFAULT_ROOT = "C:\\cygwin"; //$NON-NLS-1$ + private static final String CYGWIN_DLL = "cygwin1.dll"; //$NON-NLS-1$ + private static final String REGISTRY_KEY_SETUP = "SOFTWARE\\Cygwin\\setup"; //$NON-NLS-1$ + private static final String REGISTRY_KEY_SETUP_WIN64 = "SOFTWARE\\Wow6432Node\\Cygwin\\setup"; //$NON-NLS-1$ + // note that in Cygwin 1.7 the mount point storage has been moved out of the registry + private static final String REGISTRY_KEY_MOUNTS = "SOFTWARE\\Cygnus Solutions\\Cygwin\\mounts v2\\"; //$NON-NLS-1$ + private static final String PATH_NAME = "native"; //$NON-NLS-1$ + private static final String ROOTPATTERN = "/"; //$NON-NLS-1$ + private static final char SLASH = '/'; + private static final char BACKSLASH = '\\'; + + private static final boolean isWindowsPlatform = Platform.getOS().equals(Platform.OS_WIN32); + + private static String envPathValueCached = null; + private static String envCygwinHomeValueCached = null; + private static String cygwinLocation = null; + private static boolean isCygwinLocationCached = false; + + private final static Map cygpathLocationCache = Collections.synchronizedMap(new LRUCache(1,20)); + private final static Map translatedPathsCache = Collections.synchronizedMap(new LRUCache(10,500)); + + /** + * Find location of "cygpath" utility on the file system. + */ + private static String findCygpathLocation(String envPath) { + if (envPath == null) { + // $PATH from user preferences + IEnvironmentVariable varPath = CCorePlugin.getDefault().getBuildEnvironmentManager().getVariable(ENV_PATH, (ICConfigurationDescription) null, true); + if (varPath != null) { + envPath = varPath.getValue(); + } + } + + String cygpathLocation = cygpathLocationCache.get(envPath); + if (cygpathLocation == null) { + IPath loc = PathUtil.findProgramLocation(CYGPATH, envPath); + cygpathLocation = loc != null ? loc.toOSString() : null; + cygpathLocationCache.put(envPath, cygpathLocation); + } + return cygpathLocation; + } + + /** + * Check if cygwin path conversion utilities are available in the path. + * Tells whether cygwin is installed in the path. + * + * @param envPath - list of directories to search for cygwin utilities separated + * by path separator (format of environment variable $PATH) + * or {@code null} to use current $PATH. + * @return {@code true} if cygwin is available, {@code false} otherwise. + */ + public static boolean isAvailable(String envPath) { + return isWindowsPlatform && findCygpathLocation(envPath) != null; + } + + /** + * Check if cygwin path conversion utilities are available in $PATH. + * Tells whether cygwin is installed in the path. + * + * @return {@code true} if cygwin is available, {@code false} otherwise. + */ + public static boolean isAvailable() { + return isWindowsPlatform && findCygpathLocation(null) != null; + } + + /** + * Run program (assuming cygpath) and return the translated path which is the first line of output. + */ + private static String runCygpath(String[] args) throws IOException { + String command = getCommand(args); + String translatedPath = translatedPathsCache.get(command); + if (translatedPath == null) { + Process cygpathProcess = Runtime.getRuntime().exec(args); + BufferedReader stdout = new BufferedReader(new InputStreamReader(cygpathProcess.getInputStream())); + String firstLine = null; + try { + firstLine = stdout.readLine(); + } finally { + stdout.close(); + } + if (firstLine == null) { + throw new IOException("Unable read output from command=[" + command + "]"); //$NON-NLS-1$ //$NON-NLS-2$ + } + translatedPath = firstLine.trim(); + translatedPathsCache.put(command, translatedPath); + } + + return translatedPath; + } + + /** + * Construct a command from arguments array. + */ + private static String getCommand(String[] args) { + String command = ""; //$NON-NLS-1$ + for (String arg : args) { + command = command + arg + ' '; + } + return command.trim(); + } + + /** + * Conversion from Cygwin path to Windows path. + * Note that there is no need to cache results, they are already cached internally. + * + * @param cygwinPath - cygwin path. + * @param envPath - list of directories to search for cygwin utilities separated + * by path separator (format of environment variable $PATH). + * @return Windows style converted path. Note that that also converts cygwin links to their targets. + * + * @throws UnsupportedOperationException if Cygwin is unavailable. + * @throws IOException on IO problem. + */ + public static String cygwinToWindowsPath(String cygwinPath, String envPath) throws IOException, UnsupportedOperationException { + if (cygwinPath == null || cygwinPath.trim().length() == 0) + return cygwinPath; + + if (!isWindowsPlatform) { + throw new UnsupportedOperationException("Not a Windows system, Cygwin is unavailable."); //$NON-NLS-1$ + } + + String cygpathLocation = findCygpathLocation(envPath); + if (cygpathLocation == null) { + throw new UnsupportedOperationException(CYGPATH + " is not in the system search path."); //$NON-NLS-1$ + } + + String windowsPath = runCygpath(new String[] {cygpathLocation, "-w", cygwinPath}); //$NON-NLS-1$ + return windowsPath; + } + + /** + * Conversion from Cygwin path to Windows path. + * Note that there is no need to cache results, they are already cached internally. + * + * @param cygwinPath - cygwin path. + * @return Windows style converted path. Note that that also converts cygwin links to their targets. + * + * @throws UnsupportedOperationException if Cygwin is unavailable. + * @throws IOException on IO problem. + */ + public static String cygwinToWindowsPath(String cygwinPath) throws IOException, UnsupportedOperationException { + return cygwinToWindowsPath(cygwinPath, null); + } + + /** + * Conversion from Windows path to Cygwin path. + * Note that there is no need to cache results, they are already cached internally. + * + * @param windowsPath - Windows path. + * @param envPath - list of directories to search for cygwin utilities (value of environment variable $PATH). + * @return Cygwin style converted path. + * + * @throws UnsupportedOperationException if Cygwin is unavailable. + * @throws IOException on IO problem. + */ + public static String windowsToCygwinPath(String windowsPath, String envPath) throws IOException, UnsupportedOperationException { + if (windowsPath == null || windowsPath.trim().length() == 0) + return windowsPath; + + if (!isWindowsPlatform) { + throw new UnsupportedOperationException("Not a Windows system, Cygwin is unavailable."); //$NON-NLS-1$ + } + + String cygpathLocation = findCygpathLocation(envPath); + if (cygpathLocation == null) { + throw new UnsupportedOperationException(CYGPATH + " is not in the system search path."); //$NON-NLS-1$ + } + + String cygwinPath = runCygpath(new String[] {cygpathLocation, "-u", windowsPath}); //$NON-NLS-1$ + return cygwinPath; + } + + /** + * Conversion from Windows path to Cygwin path. + * Note that there is no need to cache results, they are already cached internally. + * + * @param windowsPath - Windows path. + * @return Cygwin style converted path. + * + * @throws UnsupportedOperationException if Cygwin is unavailable. + * @throws IOException on IO problem. + */ + public static String windowsToCygwinPath(String windowsPath) throws IOException, UnsupportedOperationException { + return windowsToCygwinPath(windowsPath, null); + } + + /** + * Find location where Cygwin is installed. A number of locations is being checked, + * such as environment variable $CYGWIN_HOME, $PATH, Windows registry et al. + *

+ * If you use this do not cache results to ensure user preferences are accounted for. + * Please rely on internal caching. + * + * @return Location of Cygwin root folder "/" on file system in Windows format. + */ + public static String getCygwinHome() { + if (!isWindowsPlatform) { + return null; + } + + IEnvironmentVariable varPath = CCorePlugin.getDefault().getBuildEnvironmentManager().getVariable(ENV_PATH, (ICConfigurationDescription) null, true); + String envPathValue = varPath != null ? varPath.getValue() : null; + IEnvironmentVariable varCygwinHome = CCorePlugin.getDefault().getBuildEnvironmentManager().getVariable(ENV_CYGWIN_HOME, (ICConfigurationDescription) null, true); + String envCygwinHomeValue = varCygwinHome != null ? varCygwinHome.getValue() : null; + + // isCygwinLocationCached is used to figure fact of caching when all cached objects are null + if (isCygwinLocationCached && CDataUtil.objectsEqual(envPathValue, envPathValueCached) && CDataUtil.objectsEqual(envCygwinHomeValue, envCygwinHomeValueCached)) { + return cygwinLocation; + } + + cygwinLocation = findCygwinRoot(envPathValue, envCygwinHomeValue); + + envPathValueCached = envPathValue; + envCygwinHomeValueCached = envCygwinHomeValue; + isCygwinLocationCached = true; + + return cygwinLocation; + } + + /** + * Reads required value from registry. Looks in both + * HKEY_CURRENT_USER and HKEY_LOCAL_MACHINE + * + * @param key Registry key + * @param name Registry value to read + * @return corresponding string value or null if nothing found + */ + private static String readValueFromRegistry(String key, String name) { + WindowsRegistry registry = WindowsRegistry.getRegistry(); + if (registry != null) { + String s = registry.getCurrentUserValue(key, name); + if(s == null) { + s = registry.getLocalMachineValue(key, name); + } + + if (s != null) { + return (s.replace(BACKSLASH, SLASH)); + } + } + return null; + } + + /** + * @return The absolute path to cygwin's root or null if not found + */ + private static String findCygwinRoot(String envPathValue, String envCygwinHomeValue) { + String rootValue = null; + + // Check $CYGWIN_HOME + if (envCygwinHomeValue != null && !envCygwinHomeValue.isEmpty()) { + IPath location = new Path(envCygwinHomeValue + "/bin/" + CYGWIN_DLL); //$NON-NLS-1$ + if (location.toFile().exists()) { + // get rootValue from "rootValue\bin\cygwin1.dll" + rootValue = location.removeLastSegments(2).toOSString(); + } + } + + // Look in PATH values. Look for cygwin1.dll + if(rootValue == null) { + IPath location = PathUtil.findProgramLocation(CYGWIN_DLL, envPathValue); + if (location != null) { + // get rootValue from "rootValue\bin\cygwin1.dll" + rootValue = location.removeLastSegments(2).toOSString(); + } + } + + // Try to find the root dir in SOFTWARE\Cygwin\setup + if(rootValue == null) { + rootValue = readValueFromRegistry(REGISTRY_KEY_SETUP, "rootdir"); //$NON-NLS-1$ + } + + // Try to find the root dir in SOFTWARE\Wow6432Node\Cygwin\setup + if(rootValue == null) { + rootValue = readValueFromRegistry(REGISTRY_KEY_SETUP_WIN64, "rootdir"); //$NON-NLS-1$ + } + + // Try to find the root dir in SOFTWARE\Cygnus Solutions + if (rootValue == null) { + rootValue = readValueFromRegistry(REGISTRY_KEY_MOUNTS + ROOTPATTERN, PATH_NAME); + } + + // Try the default Cygwin install dir + if(rootValue == null) { + File file = new File(DEFAULT_ROOT); + if (file.exists() && file.isDirectory()) + rootValue = DEFAULT_ROOT; + } + + if(rootValue != null) { + rootValue = rootValue.replace(BACKSLASH, SLASH); + } + + return rootValue; + } + +} diff --git a/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/internal/core/LRUCache.java b/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/internal/core/LRUCache.java index 817613c6406..df63401266e 100644 --- a/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/internal/core/LRUCache.java +++ b/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/internal/core/LRUCache.java @@ -1,50 +1,50 @@ -/******************************************************************************* - * 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.internal.core; - -import java.util.LinkedHashMap; -import java.util.Map.Entry; - -/** - * A simple cache with limited number of items in the cache. LRUCache discards the Least Recently Used items first. - * Based on {@link LinkedHashMap}. Note that {@link LinkedHashMap} has built-in facility to support cache like that - * which is described in its JavaDoc. - */ -public class LRUCache extends LinkedHashMap { - private int fLimit; - - /** - * Constructs an empty LRUCache with the specified limit on the number of items in the cache. - * - * @param limit - the maximum number of items to keep in the cache. - */ - public LRUCache(int limit) { - super(limit, 0.75f, true); - fLimit= limit; - } - - /** - * Constructs an empty LRUCache with the specified initial capacity and limit on the number of items in the cache. - * - * @param initialCapacity - initial capacity. - * @param limit - the maximum number of items to keep in the cache. - */ - public LRUCache(int initialCapacity, int limit) { - super(initialCapacity, 0.75f, true); - fLimit= limit; - } - - @Override - protected boolean removeEldestEntry(Entry eldest) { - return size() >= fLimit; - } +/******************************************************************************* + * 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.internal.core; + +import java.util.LinkedHashMap; +import java.util.Map.Entry; + +/** + * A simple cache with limited number of items in the cache. LRUCache discards the Least Recently Used items first. + * Based on {@link LinkedHashMap}. Note that {@link LinkedHashMap} has built-in facility to support cache like that + * which is described in its JavaDoc. + */ +public class LRUCache extends LinkedHashMap { + private int fLimit; + + /** + * Constructs an empty LRUCache with the specified limit on the number of items in the cache. + * + * @param limit - the maximum number of items to keep in the cache. + */ + public LRUCache(int limit) { + super(limit, 0.75f, true); + fLimit= limit; + } + + /** + * Constructs an empty LRUCache with the specified initial capacity and limit on the number of items in the cache. + * + * @param initialCapacity - initial capacity. + * @param limit - the maximum number of items to keep in the cache. + */ + public LRUCache(int initialCapacity, int limit) { + super(initialCapacity, 0.75f, true); + fLimit= limit; + } + + @Override + protected boolean removeEldestEntry(Entry eldest) { + return size() >= fLimit; + } } \ No newline at end of file diff --git a/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/internal/core/MinGW.java b/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/internal/core/MinGW.java index ad62fc2378b..e1cbceb5888 100644 --- a/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/internal/core/MinGW.java +++ b/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/internal/core/MinGW.java @@ -1,359 +1,359 @@ -/******************************************************************************* - * Copyright (c) 2012, 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.internal.core; - -import java.io.File; -import java.util.Collections; -import java.util.Map; -import java.util.WeakHashMap; - -import org.eclipse.cdt.core.CCorePlugin; -import org.eclipse.cdt.core.envvar.IEnvironmentVariable; -import org.eclipse.cdt.core.settings.model.ICConfigurationDescription; -import org.eclipse.cdt.core.settings.model.util.CDataUtil; -import org.eclipse.cdt.utils.PathUtil; -import org.eclipse.cdt.utils.WindowsRegistry; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.Path; -import org.eclipse.core.runtime.Platform; - -/** - * A collection of MinGW-related utility methods. - */ -public class MinGW { - public static final String ENV_MINGW_HOME = "MINGW_HOME"; //$NON-NLS-1$ - public static final String ENV_MSYS_HOME = "MSYS_HOME"; //$NON-NLS-1$ - private static final String ENV_PATH = "PATH"; //$NON-NLS-1$ - - private static final boolean isWindowsPlatform = Platform.getOS().equals(Platform.OS_WIN32); - - private static String envPathValueCached = null; - private static String envMinGWHomeValueCached = null; - private static String minGWLocation = null; - private static boolean isMinGWLocationCached = false; - - private static String envMinGWHomeValueCached_msys = null; - private static String mSysLocation = null; - private static boolean isMSysLocationCached = false; - - private final static Map mingwLocationCache = Collections - .synchronizedMap(new WeakHashMap(1)); - - /** - * @return The absolute path to MinGW root folder or {@code null} if not - * found - */ - private static String findMinGWRoot(String envPathValue, String envMinGWHomeValue) { - String rootValue = null; - - // Check $MINGW_HOME - if (envMinGWHomeValue != null && !envMinGWHomeValue.isEmpty()) { - IPath mingwBinDir = new Path(envMinGWHomeValue + "\\bin"); //$NON-NLS-1$ - if (mingwBinDir.toFile().isDirectory()) { - rootValue = mingwBinDir.removeLastSegments(1).toOSString(); - } - } - - // Try the mingw directory in the platform install directory - // CDT distributions like Wascana may distribute MinGW like that - if (rootValue == null) { - IPath installPath = new Path(Platform.getInstallLocation().getURL().getFile()); - IPath mingwBinDir = installPath.append("mingw\\bin"); //$NON-NLS-1$ - if (mingwBinDir.toFile().isDirectory()) { - rootValue = mingwBinDir.removeLastSegments(1).toOSString(); - } - } - - // Look in PATH values. Look for mingw32-gcc.exe or - // x86_64-w64-mingw32-gcc.exe - if (rootValue == null) { - rootValue = findMingwInPath(envPathValue); - } - - // Look in MSYS2 - if (rootValue == null) { - 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$ - String installLocation = registry.getCurrentUserValue(compKey, "InstallLocation"); //$NON-NLS-1$ - String mingwLocation = installLocation + "\\mingw64"; //$NON-NLS-1$ - File gccFile = new File(mingwLocation + "\\bin\\gcc.exe"); //$NON-NLS-1$ - if (gccFile.canExecute()) { - rootValue = mingwLocation; - break; - } else { - mingwLocation = installLocation + "\\mingw32"; //$NON-NLS-1$ - gccFile = new File(mingwLocation + "\\bin\\gcc.exe"); //$NON-NLS-1$ - if (gccFile.canExecute()) { - rootValue = mingwLocation; - break; - } - } - } else if ("MSYS2 32bit".equals(displayName)) { //$NON-NLS-1$ - key32bit = compKey; - } - } else { - if ("MSYS2 32bit".equals(displayName)) { //$NON-NLS-1$ - String installLocation = registry.getCurrentUserValue(compKey, "InstallLocation"); //$NON-NLS-1$ - String mingwLocation = installLocation + "\\mingw32"; //$NON-NLS-1$ - File gccFile = new File(mingwLocation + "\\bin\\gcc.exe"); //$NON-NLS-1$ - if (gccFile.canExecute()) { - rootValue = mingwLocation; - break; - } - } - } - } - - if (on64bit && key32bit != null) { - String installLocation = registry.getCurrentUserValue(key32bit, "InstallLocation"); //$NON-NLS-1$ - String mingwLocation = installLocation + "\\mingw64"; //$NON-NLS-1$ - File gccFile = new File(mingwLocation + "\\bin\\gcc.exe"); //$NON-NLS-1$ - if (gccFile.canExecute()) { - rootValue = mingwLocation; - } else { - mingwLocation = installLocation + "\\mingw32"; //$NON-NLS-1$ - gccFile = new File(mingwLocation + "\\bin\\gcc.exe"); //$NON-NLS-1$ - if (gccFile.canExecute()) { - rootValue = mingwLocation; - } - } - } - } - - // Try the default MinGW install dir - if (rootValue == null) { - IPath mingwBinDir = new Path("C:\\MinGW"); //$NON-NLS-1$ - if (mingwBinDir.toFile().isDirectory()) { - rootValue = mingwBinDir.toOSString(); - } - } - - return rootValue; - } - - private static String findMingwInPath(String envPath) { - if (envPath == null) { - // $PATH from user preferences - IEnvironmentVariable varPath = CCorePlugin.getDefault().getBuildEnvironmentManager() - .getVariable(ENV_PATH, (ICConfigurationDescription) null, true); - if (varPath != null) { - envPath = varPath.getValue(); - } - } - - String mingwLocation = mingwLocationCache.get(envPath); - // check if WeakHashMap contains the key as null may be the cached value - if (mingwLocation == null && !mingwLocationCache.containsKey(envPath)) { - // Check for MinGW-w64 on Windows 64 bit, see - // http://mingw-w64.sourceforge.net/ - if (Platform.ARCH_X86_64.equals(Platform.getOSArch())) { - IPath gcc64Loc = PathUtil.findProgramLocation("x86_64-w64-mingw32-gcc.exe", envPath); //$NON-NLS-1$ - if (gcc64Loc != null) { - mingwLocation = gcc64Loc.removeLastSegments(2).toOSString(); - } - } - - // Look for mingw32-gcc.exe - if (mingwLocation == null) { - IPath gccLoc = PathUtil.findProgramLocation("mingw32-gcc.exe", envPath); //$NON-NLS-1$ - if (gccLoc != null) { - mingwLocation = gccLoc.removeLastSegments(2).toOSString(); - } - } - mingwLocationCache.put(envPath, mingwLocation); - } - - return mingwLocation; - } - - private static String findMSysRoot(String envMinGWHomeValue) { - String msysHome = null; - - // Look in the install location parent dir - IPath installPath = new Path(Platform.getInstallLocation().getURL().getFile()); - IPath installMsysBin = installPath.append("msys\\bin"); //$NON-NLS-1$ - if (installMsysBin.toFile().isDirectory()) { - msysHome = installMsysBin.removeLastSegments(1).toOSString(); - } - - // Look under $MINGW_HOME - if (msysHome == null) { - if (envMinGWHomeValue != null && !envMinGWHomeValue.isEmpty()) { - IPath minGwMsysBin = new Path(envMinGWHomeValue + "\\msys\\1.0\\bin"); //$NON-NLS-1$ - if (minGwMsysBin.toFile().isDirectory()) { - msysHome = minGwMsysBin.removeLastSegments(1).toOSString(); - } - } - } - - // Try under MSYS2 - if (msysHome == null) { - // Give preference to msys64 on 64-bit platforms and ignore 64 on - // 32-bit platforms - 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$ - String home = registry.getCurrentUserValue(compKey, "InstallLocation"); //$NON-NLS-1$ - if (new File(home).isDirectory()) { - msysHome = home; - break; - } - } else if ("MSYS2 32bit".equals(displayName)) { //$NON-NLS-1$ - key32bit = compKey; - } - } else { - if ("MSYS2 32bit".equals(displayName)) { //$NON-NLS-1$ - String home = registry.getCurrentUserValue(compKey, "InstallLocation"); //$NON-NLS-1$ - if (new File(home).isDirectory()) { - msysHome = home; - break; - } - } - } - } - - if (on64bit && key32bit != null) { - String home = registry.getCurrentUserValue(key32bit, "InstallLocation"); //$NON-NLS-1$ - if (new File(home).isDirectory()) { - msysHome = home; - } - } - } - - // Try under default MinGW dir - if (msysHome == null) { - IPath minGwMsysBin = new Path("C:\\MinGW\\msys\\1.0\\bin"); //$NON-NLS-1$ - if (minGwMsysBin.toFile().isDirectory()) { - msysHome = minGwMsysBin.removeLastSegments(1).toOSString(); - } - } - - // Try in default MSYS root folder - if (msysHome == null) { - IPath defaultMsysBin = new Path("C:\\msys\\1.0\\bin"); //$NON-NLS-1$ - if (defaultMsysBin.toFile().isDirectory()) { - msysHome = defaultMsysBin.removeLastSegments(1).toOSString(); - } - } - return msysHome; - } - - /** - * Find location where MinGW is installed. A number of locations is being - * checked, such as environment variable $MINGW_HOME, $PATH, Windows - * registry et al.
- *
- * If you use this do not cache results to ensure user preferences are - * accounted for. Please rely on internal caching. - * - * @return MinGW root ("/") path in Windows format. - */ - public static String getMinGWHome() { - if (!isWindowsPlatform) { - return null; - } - - IEnvironmentVariable varPath = CCorePlugin.getDefault().getBuildEnvironmentManager() - .getVariable(ENV_PATH, (ICConfigurationDescription) null, true); - String envPathValue = varPath != null ? varPath.getValue() : null; - IEnvironmentVariable varMinGWHome = CCorePlugin.getDefault().getBuildEnvironmentManager() - .getVariable(ENV_MINGW_HOME, (ICConfigurationDescription) null, true); - String envMinGWHomeValue = varMinGWHome != null ? varMinGWHome.getValue() : null; - - // isMinGWLocationCached is used to figure fact of caching when all - // cached objects are null - if (isMinGWLocationCached && CDataUtil.objectsEqual(envPathValue, envPathValueCached) - && CDataUtil.objectsEqual(envMinGWHomeValue, envMinGWHomeValueCached)) { - return minGWLocation; - } - - minGWLocation = findMinGWRoot(envPathValue, envMinGWHomeValue); - envPathValueCached = envPathValue; - envMinGWHomeValueCached = envMinGWHomeValue; - isMinGWLocationCached = true; - - return minGWLocation; - } - - /** - * Find location where MSys is installed. Environment variable $MSYS_HOME - * and some predetermined locations are being checked.
- *
- * If you use this do not cache results to ensure user preferences are - * accounted for. Please rely on internal caching. - * - * @return MSys root ("/") path in Windows format. - */ - public static String getMSysHome() { - if (!isWindowsPlatform) { - return null; - } - - // Use $MSYS_HOME if defined - IEnvironmentVariable varMsysHome = CCorePlugin.getDefault().getBuildEnvironmentManager() - .getVariable(ENV_MSYS_HOME, (ICConfigurationDescription) null, true); - String msysHomeValue = varMsysHome != null ? varMsysHome.getValue() : null; - if (msysHomeValue != null) { - return msysHomeValue; - } - - String envMinGWHomeValue = getMinGWHome(); - - // isMSysLocationCached is used to figure whether it was cached when all - // cached objects are null - if (isMSysLocationCached && CDataUtil.objectsEqual(envMinGWHomeValue, envMinGWHomeValueCached_msys)) { - return mSysLocation; - } - - mSysLocation = findMSysRoot(envMinGWHomeValue); - envMinGWHomeValueCached_msys = envMinGWHomeValue; - isMSysLocationCached = true; - - return mSysLocation; - } - - /** - * Check if MinGW is available in the path. - * - * @param envPath - * - list of directories to search for MinGW separated by path - * separator (format of environment variable $PATH) or - * {@code null} to use current $PATH. - * @return {@code true} if MinGW is available, {@code false} otherwise. - */ - public static boolean isAvailable(String envPath) { - return isWindowsPlatform && findMingwInPath(envPath) != null; - } - - /** - * Check if MinGW is available in $PATH. - * - * @return {@code true} if MinGW is available, {@code false} otherwise. - */ - public static boolean isAvailable() { - return isWindowsPlatform && findMingwInPath(null) != null; - } -} +/******************************************************************************* + * Copyright (c) 2012, 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.internal.core; + +import java.io.File; +import java.util.Collections; +import java.util.Map; +import java.util.WeakHashMap; + +import org.eclipse.cdt.core.CCorePlugin; +import org.eclipse.cdt.core.envvar.IEnvironmentVariable; +import org.eclipse.cdt.core.settings.model.ICConfigurationDescription; +import org.eclipse.cdt.core.settings.model.util.CDataUtil; +import org.eclipse.cdt.utils.PathUtil; +import org.eclipse.cdt.utils.WindowsRegistry; +import org.eclipse.core.runtime.IPath; +import org.eclipse.core.runtime.Path; +import org.eclipse.core.runtime.Platform; + +/** + * A collection of MinGW-related utility methods. + */ +public class MinGW { + public static final String ENV_MINGW_HOME = "MINGW_HOME"; //$NON-NLS-1$ + public static final String ENV_MSYS_HOME = "MSYS_HOME"; //$NON-NLS-1$ + private static final String ENV_PATH = "PATH"; //$NON-NLS-1$ + + private static final boolean isWindowsPlatform = Platform.getOS().equals(Platform.OS_WIN32); + + private static String envPathValueCached = null; + private static String envMinGWHomeValueCached = null; + private static String minGWLocation = null; + private static boolean isMinGWLocationCached = false; + + private static String envMinGWHomeValueCached_msys = null; + private static String mSysLocation = null; + private static boolean isMSysLocationCached = false; + + private final static Map mingwLocationCache = Collections + .synchronizedMap(new WeakHashMap(1)); + + /** + * @return The absolute path to MinGW root folder or {@code null} if not + * found + */ + private static String findMinGWRoot(String envPathValue, String envMinGWHomeValue) { + String rootValue = null; + + // Check $MINGW_HOME + if (envMinGWHomeValue != null && !envMinGWHomeValue.isEmpty()) { + IPath mingwBinDir = new Path(envMinGWHomeValue + "\\bin"); //$NON-NLS-1$ + if (mingwBinDir.toFile().isDirectory()) { + rootValue = mingwBinDir.removeLastSegments(1).toOSString(); + } + } + + // Try the mingw directory in the platform install directory + // CDT distributions like Wascana may distribute MinGW like that + if (rootValue == null) { + IPath installPath = new Path(Platform.getInstallLocation().getURL().getFile()); + IPath mingwBinDir = installPath.append("mingw\\bin"); //$NON-NLS-1$ + if (mingwBinDir.toFile().isDirectory()) { + rootValue = mingwBinDir.removeLastSegments(1).toOSString(); + } + } + + // Look in PATH values. Look for mingw32-gcc.exe or + // x86_64-w64-mingw32-gcc.exe + if (rootValue == null) { + rootValue = findMingwInPath(envPathValue); + } + + // Look in MSYS2 + if (rootValue == null) { + 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$ + String installLocation = registry.getCurrentUserValue(compKey, "InstallLocation"); //$NON-NLS-1$ + String mingwLocation = installLocation + "\\mingw64"; //$NON-NLS-1$ + File gccFile = new File(mingwLocation + "\\bin\\gcc.exe"); //$NON-NLS-1$ + if (gccFile.canExecute()) { + rootValue = mingwLocation; + break; + } else { + mingwLocation = installLocation + "\\mingw32"; //$NON-NLS-1$ + gccFile = new File(mingwLocation + "\\bin\\gcc.exe"); //$NON-NLS-1$ + if (gccFile.canExecute()) { + rootValue = mingwLocation; + break; + } + } + } else if ("MSYS2 32bit".equals(displayName)) { //$NON-NLS-1$ + key32bit = compKey; + } + } else { + if ("MSYS2 32bit".equals(displayName)) { //$NON-NLS-1$ + String installLocation = registry.getCurrentUserValue(compKey, "InstallLocation"); //$NON-NLS-1$ + String mingwLocation = installLocation + "\\mingw32"; //$NON-NLS-1$ + File gccFile = new File(mingwLocation + "\\bin\\gcc.exe"); //$NON-NLS-1$ + if (gccFile.canExecute()) { + rootValue = mingwLocation; + break; + } + } + } + } + + if (on64bit && key32bit != null) { + String installLocation = registry.getCurrentUserValue(key32bit, "InstallLocation"); //$NON-NLS-1$ + String mingwLocation = installLocation + "\\mingw64"; //$NON-NLS-1$ + File gccFile = new File(mingwLocation + "\\bin\\gcc.exe"); //$NON-NLS-1$ + if (gccFile.canExecute()) { + rootValue = mingwLocation; + } else { + mingwLocation = installLocation + "\\mingw32"; //$NON-NLS-1$ + gccFile = new File(mingwLocation + "\\bin\\gcc.exe"); //$NON-NLS-1$ + if (gccFile.canExecute()) { + rootValue = mingwLocation; + } + } + } + } + + // Try the default MinGW install dir + if (rootValue == null) { + IPath mingwBinDir = new Path("C:\\MinGW"); //$NON-NLS-1$ + if (mingwBinDir.toFile().isDirectory()) { + rootValue = mingwBinDir.toOSString(); + } + } + + return rootValue; + } + + private static String findMingwInPath(String envPath) { + if (envPath == null) { + // $PATH from user preferences + IEnvironmentVariable varPath = CCorePlugin.getDefault().getBuildEnvironmentManager() + .getVariable(ENV_PATH, (ICConfigurationDescription) null, true); + if (varPath != null) { + envPath = varPath.getValue(); + } + } + + String mingwLocation = mingwLocationCache.get(envPath); + // check if WeakHashMap contains the key as null may be the cached value + if (mingwLocation == null && !mingwLocationCache.containsKey(envPath)) { + // Check for MinGW-w64 on Windows 64 bit, see + // http://mingw-w64.sourceforge.net/ + if (Platform.ARCH_X86_64.equals(Platform.getOSArch())) { + IPath gcc64Loc = PathUtil.findProgramLocation("x86_64-w64-mingw32-gcc.exe", envPath); //$NON-NLS-1$ + if (gcc64Loc != null) { + mingwLocation = gcc64Loc.removeLastSegments(2).toOSString(); + } + } + + // Look for mingw32-gcc.exe + if (mingwLocation == null) { + IPath gccLoc = PathUtil.findProgramLocation("mingw32-gcc.exe", envPath); //$NON-NLS-1$ + if (gccLoc != null) { + mingwLocation = gccLoc.removeLastSegments(2).toOSString(); + } + } + mingwLocationCache.put(envPath, mingwLocation); + } + + return mingwLocation; + } + + private static String findMSysRoot(String envMinGWHomeValue) { + String msysHome = null; + + // Look in the install location parent dir + IPath installPath = new Path(Platform.getInstallLocation().getURL().getFile()); + IPath installMsysBin = installPath.append("msys\\bin"); //$NON-NLS-1$ + if (installMsysBin.toFile().isDirectory()) { + msysHome = installMsysBin.removeLastSegments(1).toOSString(); + } + + // Look under $MINGW_HOME + if (msysHome == null) { + if (envMinGWHomeValue != null && !envMinGWHomeValue.isEmpty()) { + IPath minGwMsysBin = new Path(envMinGWHomeValue + "\\msys\\1.0\\bin"); //$NON-NLS-1$ + if (minGwMsysBin.toFile().isDirectory()) { + msysHome = minGwMsysBin.removeLastSegments(1).toOSString(); + } + } + } + + // Try under MSYS2 + if (msysHome == null) { + // Give preference to msys64 on 64-bit platforms and ignore 64 on + // 32-bit platforms + 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$ + String home = registry.getCurrentUserValue(compKey, "InstallLocation"); //$NON-NLS-1$ + if (new File(home).isDirectory()) { + msysHome = home; + break; + } + } else if ("MSYS2 32bit".equals(displayName)) { //$NON-NLS-1$ + key32bit = compKey; + } + } else { + if ("MSYS2 32bit".equals(displayName)) { //$NON-NLS-1$ + String home = registry.getCurrentUserValue(compKey, "InstallLocation"); //$NON-NLS-1$ + if (new File(home).isDirectory()) { + msysHome = home; + break; + } + } + } + } + + if (on64bit && key32bit != null) { + String home = registry.getCurrentUserValue(key32bit, "InstallLocation"); //$NON-NLS-1$ + if (new File(home).isDirectory()) { + msysHome = home; + } + } + } + + // Try under default MinGW dir + if (msysHome == null) { + IPath minGwMsysBin = new Path("C:\\MinGW\\msys\\1.0\\bin"); //$NON-NLS-1$ + if (minGwMsysBin.toFile().isDirectory()) { + msysHome = minGwMsysBin.removeLastSegments(1).toOSString(); + } + } + + // Try in default MSYS root folder + if (msysHome == null) { + IPath defaultMsysBin = new Path("C:\\msys\\1.0\\bin"); //$NON-NLS-1$ + if (defaultMsysBin.toFile().isDirectory()) { + msysHome = defaultMsysBin.removeLastSegments(1).toOSString(); + } + } + return msysHome; + } + + /** + * Find location where MinGW is installed. A number of locations is being + * checked, such as environment variable $MINGW_HOME, $PATH, Windows + * registry et al.
+ *
+ * If you use this do not cache results to ensure user preferences are + * accounted for. Please rely on internal caching. + * + * @return MinGW root ("/") path in Windows format. + */ + public static String getMinGWHome() { + if (!isWindowsPlatform) { + return null; + } + + IEnvironmentVariable varPath = CCorePlugin.getDefault().getBuildEnvironmentManager() + .getVariable(ENV_PATH, (ICConfigurationDescription) null, true); + String envPathValue = varPath != null ? varPath.getValue() : null; + IEnvironmentVariable varMinGWHome = CCorePlugin.getDefault().getBuildEnvironmentManager() + .getVariable(ENV_MINGW_HOME, (ICConfigurationDescription) null, true); + String envMinGWHomeValue = varMinGWHome != null ? varMinGWHome.getValue() : null; + + // isMinGWLocationCached is used to figure fact of caching when all + // cached objects are null + if (isMinGWLocationCached && CDataUtil.objectsEqual(envPathValue, envPathValueCached) + && CDataUtil.objectsEqual(envMinGWHomeValue, envMinGWHomeValueCached)) { + return minGWLocation; + } + + minGWLocation = findMinGWRoot(envPathValue, envMinGWHomeValue); + envPathValueCached = envPathValue; + envMinGWHomeValueCached = envMinGWHomeValue; + isMinGWLocationCached = true; + + return minGWLocation; + } + + /** + * Find location where MSys is installed. Environment variable $MSYS_HOME + * and some predetermined locations are being checked.
+ *
+ * If you use this do not cache results to ensure user preferences are + * accounted for. Please rely on internal caching. + * + * @return MSys root ("/") path in Windows format. + */ + public static String getMSysHome() { + if (!isWindowsPlatform) { + return null; + } + + // Use $MSYS_HOME if defined + IEnvironmentVariable varMsysHome = CCorePlugin.getDefault().getBuildEnvironmentManager() + .getVariable(ENV_MSYS_HOME, (ICConfigurationDescription) null, true); + String msysHomeValue = varMsysHome != null ? varMsysHome.getValue() : null; + if (msysHomeValue != null) { + return msysHomeValue; + } + + String envMinGWHomeValue = getMinGWHome(); + + // isMSysLocationCached is used to figure whether it was cached when all + // cached objects are null + if (isMSysLocationCached && CDataUtil.objectsEqual(envMinGWHomeValue, envMinGWHomeValueCached_msys)) { + return mSysLocation; + } + + mSysLocation = findMSysRoot(envMinGWHomeValue); + envMinGWHomeValueCached_msys = envMinGWHomeValue; + isMSysLocationCached = true; + + return mSysLocation; + } + + /** + * Check if MinGW is available in the path. + * + * @param envPath + * - list of directories to search for MinGW separated by path + * separator (format of environment variable $PATH) or + * {@code null} to use current $PATH. + * @return {@code true} if MinGW is available, {@code false} otherwise. + */ + public static boolean isAvailable(String envPath) { + return isWindowsPlatform && findMingwInPath(envPath) != null; + } + + /** + * Check if MinGW is available in $PATH. + * + * @return {@code true} if MinGW is available, {@code false} otherwise. + */ + public static boolean isAvailable() { + return isWindowsPlatform && findMingwInPath(null) != null; + } +} diff --git a/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/envvar/IEnvironmentChangeListener.java b/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/envvar/IEnvironmentChangeListener.java index 6adea60095c..10340bb9375 100644 --- a/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/envvar/IEnvironmentChangeListener.java +++ b/core/org.eclipse.cdt.core/utils/org/eclipse/cdt/utils/envvar/IEnvironmentChangeListener.java @@ -1,27 +1,27 @@ -/******************************************************************************* - * 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.utils.envvar; - - -/** - * Interface for listeners to changes in environment variables defined by user - * on CDT Environment page in Preferences. - * - * @since 5.5 - */ -public interface IEnvironmentChangeListener { - /** - * Indicates that environment variables have been changed. - * - * @param event - details of the event. - */ - public void handleEvent(IEnvironmentChangeEvent event); -} +/******************************************************************************* + * 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.utils.envvar; + + +/** + * Interface for listeners to changes in environment variables defined by user + * on CDT Environment page in Preferences. + * + * @since 5.5 + */ +public interface IEnvironmentChangeListener { + /** + * Indicates that environment variables have been changed. + * + * @param event - details of the event. + */ + public void handleEvent(IEnvironmentChangeEvent event); +} diff --git a/core/org.eclipse.cdt.ui.tests/resources/contentassist/CompletionTestStart.h b/core/org.eclipse.cdt.ui.tests/resources/contentassist/CompletionTestStart.h index 33da8f2c080..01b014b3425 100644 --- a/core/org.eclipse.cdt.ui.tests/resources/contentassist/CompletionTestStart.h +++ b/core/org.eclipse.cdt.ui.tests/resources/contentassist/CompletionTestStart.h @@ -1,72 +1,72 @@ -#define DEBUG 1 -#define AMacro(x) x+1 -#define XMacro(x,y) x+y - -int aVariable; -int xVariable; - -bool aFunction(); -bool xFunction(); - -enum anEnumeration { - aFirstEnum, - aSecondEnum, - aThirdEnum -}; - -enum xEnumeration { - xFirstEnum, - xSecondEnum, - xThirdEnum -}; - -struct AStruct{ - int aStructField; -}; - -struct XStruct{ - int xStructField; -}; - -void anotherFunction(){ - int aLocalDeclaration = 1; -} - -void xOtherFunction(){ - int xLocalDeclaration = 1; -} - -class aClass { -public: - int aField; - float xAClassField; - int aMethod(); - void xAClassMethod(int x); -}; - -class anotherClass { -public: - int anotherField; - void anotherMethod(); -}; - -class xOtherClass { -public: - xOtherClass(char*); - xOtherClass(int); - int xOtherField; - void xOtherMethod(); - void xOtherMethod(int); -}; - -namespace aNamespace { - void aNamespaceFunction(){ - } -}; - -namespace xNamespace { - void xNamespaceFunction(){ - } -}; - - +#define DEBUG 1 +#define AMacro(x) x+1 +#define XMacro(x,y) x+y + +int aVariable; +int xVariable; + +bool aFunction(); +bool xFunction(); + +enum anEnumeration { + aFirstEnum, + aSecondEnum, + aThirdEnum +}; + +enum xEnumeration { + xFirstEnum, + xSecondEnum, + xThirdEnum +}; + +struct AStruct{ + int aStructField; +}; + +struct XStruct{ + int xStructField; +}; + +void anotherFunction(){ + int aLocalDeclaration = 1; +} + +void xOtherFunction(){ + int xLocalDeclaration = 1; +} + +class aClass { +public: + int aField; + float xAClassField; + int aMethod(); + void xAClassMethod(int x); +}; + +class anotherClass { +public: + int anotherField; + void anotherMethod(); +}; + +class xOtherClass { +public: + xOtherClass(char*); + xOtherClass(int); + int xOtherField; + void xOtherMethod(); + void xOtherMethod(int); +}; + +namespace aNamespace { + void aNamespaceFunction(){ + } +}; + +namespace xNamespace { + void xNamespaceFunction(){ + } +}; + + diff --git a/core/org.eclipse.cdt.ui.tests/resources/contentassist/CompletionTestStart1.cpp b/core/org.eclipse.cdt.ui.tests/resources/contentassist/CompletionTestStart1.cpp index 7316b66f9a7..37fb07c8803 100644 --- a/core/org.eclipse.cdt.ui.tests/resources/contentassist/CompletionTestStart1.cpp +++ b/core/org.eclipse.cdt.ui.tests/resources/contentassist/CompletionTestStart1.cpp @@ -1,6 +1,6 @@ -#include "CompletionTestStart.h" - -void anotherClass::anotherMethod() -{ - a -} +#include "CompletionTestStart.h" + +void anotherClass::anotherMethod() +{ + a +} diff --git a/core/org.eclipse.cdt.ui.tests/resources/contentassist/CompletionTestStart10.cpp b/core/org.eclipse.cdt.ui.tests/resources/contentassist/CompletionTestStart10.cpp index 26d5d6f57e8..c308ac03b1a 100644 --- a/core/org.eclipse.cdt.ui.tests/resources/contentassist/CompletionTestStart10.cpp +++ b/core/org.eclipse.cdt.ui.tests/resources/contentassist/CompletionTestStart10.cpp @@ -1,7 +1,7 @@ -#include "CompletionTestStart.h" - -void anotherClass::anotherMethod() -{ - aClass* c = new aClass(); - c-> -} +#include "CompletionTestStart.h" + +void anotherClass::anotherMethod() +{ + aClass* c = new aClass(); + c-> +} diff --git a/core/org.eclipse.cdt.ui.tests/resources/contentassist/CompletionTestStart11.cpp b/core/org.eclipse.cdt.ui.tests/resources/contentassist/CompletionTestStart11.cpp index 60434778568..98b4bdf8489 100644 --- a/core/org.eclipse.cdt.ui.tests/resources/contentassist/CompletionTestStart11.cpp +++ b/core/org.eclipse.cdt.ui.tests/resources/contentassist/CompletionTestStart11.cpp @@ -1,3 +1,3 @@ -#include "CompletionTestStart.h" - - +#include "CompletionTestStart.h" + + diff --git a/core/org.eclipse.cdt.ui.tests/resources/contentassist/CompletionTestStart12.h b/core/org.eclipse.cdt.ui.tests/resources/contentassist/CompletionTestStart12.h index 29e593e9a8e..8b0fe2ac05c 100644 --- a/core/org.eclipse.cdt.ui.tests/resources/contentassist/CompletionTestStart12.h +++ b/core/org.eclipse.cdt.ui.tests/resources/contentassist/CompletionTestStart12.h @@ -1,6 +1,6 @@ -#include "CompletionTestStart.h" - -class aThirdClass { - int x; - -}; +#include "CompletionTestStart.h" + +class aThirdClass { + int x; + +}; diff --git a/core/org.eclipse.cdt.ui.tests/resources/contentassist/CompletionTestStart13.h b/core/org.eclipse.cdt.ui.tests/resources/contentassist/CompletionTestStart13.h index b41aa044f55..daf8f016612 100644 --- a/core/org.eclipse.cdt.ui.tests/resources/contentassist/CompletionTestStart13.h +++ b/core/org.eclipse.cdt.ui.tests/resources/contentassist/CompletionTestStart13.h @@ -1,5 +1,5 @@ -#include "CompletionTestStart.h" - -class aThirdClass { - -}; +#include "CompletionTestStart.h" + +class aThirdClass { + +}; diff --git a/core/org.eclipse.cdt.ui.tests/resources/contentassist/CompletionTestStart14.cpp b/core/org.eclipse.cdt.ui.tests/resources/contentassist/CompletionTestStart14.cpp index 5d33709a5a7..bd11959c9a4 100644 --- a/core/org.eclipse.cdt.ui.tests/resources/contentassist/CompletionTestStart14.cpp +++ b/core/org.eclipse.cdt.ui.tests/resources/contentassist/CompletionTestStart14.cpp @@ -1,5 +1,5 @@ -#include "CompletionTestStart.h" - -void foo(int x){ - int y = a -} +#include "CompletionTestStart.h" + +void foo(int x){ + int y = a +} diff --git a/core/org.eclipse.cdt.ui.tests/resources/contentassist/CompletionTestStart15.cpp b/core/org.eclipse.cdt.ui.tests/resources/contentassist/CompletionTestStart15.cpp index 238e95c0f8f..8b10c71995b 100644 --- a/core/org.eclipse.cdt.ui.tests/resources/contentassist/CompletionTestStart15.cpp +++ b/core/org.eclipse.cdt.ui.tests/resources/contentassist/CompletionTestStart15.cpp @@ -1,5 +1,5 @@ -#include "CompletionTestStart.h" - -void foo(int x){ - int y = -} +#include "CompletionTestStart.h" + +void foo(int x){ + int y = +} diff --git a/core/org.eclipse.cdt.ui.tests/resources/contentassist/CompletionTestStart16.cpp b/core/org.eclipse.cdt.ui.tests/resources/contentassist/CompletionTestStart16.cpp index 8e4eed27f1f..90e459559cb 100644 --- a/core/org.eclipse.cdt.ui.tests/resources/contentassist/CompletionTestStart16.cpp +++ b/core/org.eclipse.cdt.ui.tests/resources/contentassist/CompletionTestStart16.cpp @@ -1,3 +1,3 @@ -#include "CompletionTestStart.h" - -void foo ( a +#include "CompletionTestStart.h" + +void foo ( a diff --git a/core/org.eclipse.cdt.ui.tests/resources/contentassist/CompletionTestStart17.cpp b/core/org.eclipse.cdt.ui.tests/resources/contentassist/CompletionTestStart17.cpp index fb9f4cda180..0dae57ff522 100644 --- a/core/org.eclipse.cdt.ui.tests/resources/contentassist/CompletionTestStart17.cpp +++ b/core/org.eclipse.cdt.ui.tests/resources/contentassist/CompletionTestStart17.cpp @@ -1,3 +1,3 @@ -#include "CompletionTestStart.h" - -void foo ( +#include "CompletionTestStart.h" + +void foo ( diff --git a/core/org.eclipse.cdt.ui.tests/resources/contentassist/CompletionTestStart18.cpp b/core/org.eclipse.cdt.ui.tests/resources/contentassist/CompletionTestStart18.cpp index aa593d21370..b4a5ec71ee0 100644 --- a/core/org.eclipse.cdt.ui.tests/resources/contentassist/CompletionTestStart18.cpp +++ b/core/org.eclipse.cdt.ui.tests/resources/contentassist/CompletionTestStart18.cpp @@ -1,6 +1,6 @@ -#include "CompletionTestStart.h" - -class ClassA { - void foo ( a -}; - +#include "CompletionTestStart.h" + +class ClassA { + void foo ( a +}; + diff --git a/core/org.eclipse.cdt.ui.tests/resources/contentassist/CompletionTestStart19.cpp b/core/org.eclipse.cdt.ui.tests/resources/contentassist/CompletionTestStart19.cpp index 6ec3631b5dc..4ad14958f60 100644 --- a/core/org.eclipse.cdt.ui.tests/resources/contentassist/CompletionTestStart19.cpp +++ b/core/org.eclipse.cdt.ui.tests/resources/contentassist/CompletionTestStart19.cpp @@ -1,5 +1,5 @@ -#include "CompletionTestStart.h" - -class ClassA { - void foo ( -}; +#include "CompletionTestStart.h" + +class ClassA { + void foo ( +}; diff --git a/core/org.eclipse.cdt.ui.tests/resources/contentassist/CompletionTestStart2.cpp b/core/org.eclipse.cdt.ui.tests/resources/contentassist/CompletionTestStart2.cpp index 23afd8cf770..a7ba3be4f2e 100644 --- a/core/org.eclipse.cdt.ui.tests/resources/contentassist/CompletionTestStart2.cpp +++ b/core/org.eclipse.cdt.ui.tests/resources/contentassist/CompletionTestStart2.cpp @@ -1,7 +1,7 @@ -#include "CompletionTestStart.h" - -void anotherClass::anotherMethod() -{ - aClass c; - c.a -} +#include "CompletionTestStart.h" + +void anotherClass::anotherMethod() +{ + aClass c; + c.a +} diff --git a/core/org.eclipse.cdt.ui.tests/resources/contentassist/CompletionTestStart20.h b/core/org.eclipse.cdt.ui.tests/resources/contentassist/CompletionTestStart20.h index c0dd03edf34..3f388823558 100644 --- a/core/org.eclipse.cdt.ui.tests/resources/contentassist/CompletionTestStart20.h +++ b/core/org.eclipse.cdt.ui.tests/resources/contentassist/CompletionTestStart20.h @@ -1,4 +1,4 @@ -#include "CompletionTestStart.h" - -class ClassA : public a - +#include "CompletionTestStart.h" + +class ClassA : public a + diff --git a/core/org.eclipse.cdt.ui.tests/resources/contentassist/CompletionTestStart21.h b/core/org.eclipse.cdt.ui.tests/resources/contentassist/CompletionTestStart21.h index 142826ffde4..0e065c26c0e 100644 --- a/core/org.eclipse.cdt.ui.tests/resources/contentassist/CompletionTestStart21.h +++ b/core/org.eclipse.cdt.ui.tests/resources/contentassist/CompletionTestStart21.h @@ -1,3 +1,3 @@ -#include "CompletionTestStart.h" - -class ClassA : public +#include "CompletionTestStart.h" + +class ClassA : public diff --git a/core/org.eclipse.cdt.ui.tests/resources/contentassist/CompletionTestStart22.cpp b/core/org.eclipse.cdt.ui.tests/resources/contentassist/CompletionTestStart22.cpp index 721d0efbe98..621d904c21f 100644 --- a/core/org.eclipse.cdt.ui.tests/resources/contentassist/CompletionTestStart22.cpp +++ b/core/org.eclipse.cdt.ui.tests/resources/contentassist/CompletionTestStart22.cpp @@ -1,8 +1,8 @@ -#include "CompletionTestStart.h" - -void anotherClass::anotherMethod() -{ - try { - } catch ( a - -} +#include "CompletionTestStart.h" + +void anotherClass::anotherMethod() +{ + try { + } catch ( a + +} diff --git a/core/org.eclipse.cdt.ui.tests/resources/contentassist/CompletionTestStart23.cpp b/core/org.eclipse.cdt.ui.tests/resources/contentassist/CompletionTestStart23.cpp index 5e2cbae78aa..05c0ada5de5 100644 --- a/core/org.eclipse.cdt.ui.tests/resources/contentassist/CompletionTestStart23.cpp +++ b/core/org.eclipse.cdt.ui.tests/resources/contentassist/CompletionTestStart23.cpp @@ -1,7 +1,7 @@ -#include "CompletionTestStart.h" - -void anotherClass::anotherMethod() -{ - try { - } catch ( -} +#include "CompletionTestStart.h" + +void anotherClass::anotherMethod() +{ + try { + } catch ( +} diff --git a/core/org.eclipse.cdt.ui.tests/resources/contentassist/CompletionTestStart24.cpp b/core/org.eclipse.cdt.ui.tests/resources/contentassist/CompletionTestStart24.cpp index 1af4d33b200..351a73eb20c 100644 --- a/core/org.eclipse.cdt.ui.tests/resources/contentassist/CompletionTestStart24.cpp +++ b/core/org.eclipse.cdt.ui.tests/resources/contentassist/CompletionTestStart24.cpp @@ -1,3 +1,3 @@ -#include "CompletionTestStart.h" - -using +#include "CompletionTestStart.h" + +using diff --git a/core/org.eclipse.cdt.ui.tests/resources/contentassist/CompletionTestStart25.cpp b/core/org.eclipse.cdt.ui.tests/resources/contentassist/CompletionTestStart25.cpp index 6f1f93e3984..2606b81e112 100644 --- a/core/org.eclipse.cdt.ui.tests/resources/contentassist/CompletionTestStart25.cpp +++ b/core/org.eclipse.cdt.ui.tests/resources/contentassist/CompletionTestStart25.cpp @@ -1,3 +1,3 @@ -#include "CompletionTestStart.h" - -using a +#include "CompletionTestStart.h" + +using a diff --git a/core/org.eclipse.cdt.ui.tests/resources/contentassist/CompletionTestStart26.cpp b/core/org.eclipse.cdt.ui.tests/resources/contentassist/CompletionTestStart26.cpp index 5a09fa91ecf..40dcc80481c 100644 --- a/core/org.eclipse.cdt.ui.tests/resources/contentassist/CompletionTestStart26.cpp +++ b/core/org.eclipse.cdt.ui.tests/resources/contentassist/CompletionTestStart26.cpp @@ -1,3 +1,3 @@ -#include "CompletionTestStart.h" - -#ifdef +#include "CompletionTestStart.h" + +#ifdef diff --git a/core/org.eclipse.cdt.ui.tests/resources/contentassist/CompletionTestStart27.cpp b/core/org.eclipse.cdt.ui.tests/resources/contentassist/CompletionTestStart27.cpp index 4f474a2883f..0d43dd4bd28 100644 --- a/core/org.eclipse.cdt.ui.tests/resources/contentassist/CompletionTestStart27.cpp +++ b/core/org.eclipse.cdt.ui.tests/resources/contentassist/CompletionTestStart27.cpp @@ -1,3 +1,3 @@ -#include "CompletionTestStart.h" - -#ifdef D +#include "CompletionTestStart.h" + +#ifdef D diff --git a/core/org.eclipse.cdt.ui.tests/resources/contentassist/CompletionTestStart28.cpp b/core/org.eclipse.cdt.ui.tests/resources/contentassist/CompletionTestStart28.cpp index 6b50a7263f5..d7ba50e7bba 100644 --- a/core/org.eclipse.cdt.ui.tests/resources/contentassist/CompletionTestStart28.cpp +++ b/core/org.eclipse.cdt.ui.tests/resources/contentassist/CompletionTestStart28.cpp @@ -1,6 +1,6 @@ -#include "CompletionTestStart.h" - -void anotherClass::anotherMethod() -{ - aClass myClass = new a -} +#include "CompletionTestStart.h" + +void anotherClass::anotherMethod() +{ + aClass myClass = new a +} diff --git a/core/org.eclipse.cdt.ui.tests/resources/contentassist/CompletionTestStart29.cpp b/core/org.eclipse.cdt.ui.tests/resources/contentassist/CompletionTestStart29.cpp index 7ee28ed7cc8..f5723c07aa3 100644 --- a/core/org.eclipse.cdt.ui.tests/resources/contentassist/CompletionTestStart29.cpp +++ b/core/org.eclipse.cdt.ui.tests/resources/contentassist/CompletionTestStart29.cpp @@ -1,7 +1,7 @@ -#include "CompletionTestStart.h" - -void anotherClass::anotherMethod() -{ - aClass myClass = new -} - +#include "CompletionTestStart.h" + +void anotherClass::anotherMethod() +{ + aClass myClass = new +} + diff --git a/core/org.eclipse.cdt.ui.tests/resources/contentassist/CompletionTestStart3.cpp b/core/org.eclipse.cdt.ui.tests/resources/contentassist/CompletionTestStart3.cpp index 9baf9431709..c756e46477b 100644 --- a/core/org.eclipse.cdt.ui.tests/resources/contentassist/CompletionTestStart3.cpp +++ b/core/org.eclipse.cdt.ui.tests/resources/contentassist/CompletionTestStart3.cpp @@ -1,3 +1,3 @@ -#include "CompletionTestStart.h" - - a +#include "CompletionTestStart.h" + + a diff --git a/core/org.eclipse.cdt.ui.tests/resources/contentassist/CompletionTestStart30.cpp b/core/org.eclipse.cdt.ui.tests/resources/contentassist/CompletionTestStart30.cpp index 9010ea4240a..fdf3cbae8e3 100644 --- a/core/org.eclipse.cdt.ui.tests/resources/contentassist/CompletionTestStart30.cpp +++ b/core/org.eclipse.cdt.ui.tests/resources/contentassist/CompletionTestStart30.cpp @@ -1,6 +1,6 @@ -#include "CompletionTestStart.h" - -void anotherClass::anotherMethod() -{ - aNamespace:: -} +#include "CompletionTestStart.h" + +void anotherClass::anotherMethod() +{ + aNamespace:: +} diff --git a/core/org.eclipse.cdt.ui.tests/resources/contentassist/CompletionTestStart31.cpp b/core/org.eclipse.cdt.ui.tests/resources/contentassist/CompletionTestStart31.cpp index 63286f3bf6f..f4156bde5c0 100644 --- a/core/org.eclipse.cdt.ui.tests/resources/contentassist/CompletionTestStart31.cpp +++ b/core/org.eclipse.cdt.ui.tests/resources/contentassist/CompletionTestStart31.cpp @@ -1,6 +1,6 @@ -#include "CompletionTestStart.h" - -void anotherClass::anotherMethod() -{ - aNamespace::a -} +#include "CompletionTestStart.h" + +void anotherClass::anotherMethod() +{ + aNamespace::a +} diff --git a/core/org.eclipse.cdt.ui.tests/resources/contentassist/CompletionTestStart32.cpp b/core/org.eclipse.cdt.ui.tests/resources/contentassist/CompletionTestStart32.cpp index 463a3446454..e62ae6a5e58 100644 --- a/core/org.eclipse.cdt.ui.tests/resources/contentassist/CompletionTestStart32.cpp +++ b/core/org.eclipse.cdt.ui.tests/resources/contentassist/CompletionTestStart32.cpp @@ -1,3 +1,3 @@ -#include "CompletionTestStart.h" - -using namespace +#include "CompletionTestStart.h" + +using namespace diff --git a/core/org.eclipse.cdt.ui.tests/resources/contentassist/CompletionTestStart33.cpp b/core/org.eclipse.cdt.ui.tests/resources/contentassist/CompletionTestStart33.cpp index f6fd9f0e9d7..f52d73b753d 100644 --- a/core/org.eclipse.cdt.ui.tests/resources/contentassist/CompletionTestStart33.cpp +++ b/core/org.eclipse.cdt.ui.tests/resources/contentassist/CompletionTestStart33.cpp @@ -1,3 +1,3 @@ -#include "CompletionTestStart.h" - -using namespace a +#include "CompletionTestStart.h" + +using namespace a diff --git a/core/org.eclipse.cdt.ui.tests/resources/contentassist/CompletionTestStart34.cpp b/core/org.eclipse.cdt.ui.tests/resources/contentassist/CompletionTestStart34.cpp index 260938d2cad..ccabe827f35 100644 --- a/core/org.eclipse.cdt.ui.tests/resources/contentassist/CompletionTestStart34.cpp +++ b/core/org.eclipse.cdt.ui.tests/resources/contentassist/CompletionTestStart34.cpp @@ -1,6 +1,6 @@ -#include "CompletionTestStart.h" - -int anotherClass::anotherMethod(){ - xOtherClass c; - c.xOtherMethod ( -} +#include "CompletionTestStart.h" + +int anotherClass::anotherMethod(){ + xOtherClass c; + c.xOtherMethod ( +} diff --git a/core/org.eclipse.cdt.ui.tests/resources/contentassist/CompletionTestStart35.cpp b/core/org.eclipse.cdt.ui.tests/resources/contentassist/CompletionTestStart35.cpp index c30d27fa823..1c2f6353189 100644 --- a/core/org.eclipse.cdt.ui.tests/resources/contentassist/CompletionTestStart35.cpp +++ b/core/org.eclipse.cdt.ui.tests/resources/contentassist/CompletionTestStart35.cpp @@ -1,5 +1,5 @@ -#include "CompletionTestStart.h" - -int anotherClass::anotherMethod(){ - xOtherClass* a = new xOtherClass ( -} +#include "CompletionTestStart.h" + +int anotherClass::anotherMethod(){ + xOtherClass* a = new xOtherClass ( +} diff --git a/core/org.eclipse.cdt.ui.tests/resources/contentassist/CompletionTestStart36.cpp b/core/org.eclipse.cdt.ui.tests/resources/contentassist/CompletionTestStart36.cpp index 9799e8a1949..d715732c140 100644 --- a/core/org.eclipse.cdt.ui.tests/resources/contentassist/CompletionTestStart36.cpp +++ b/core/org.eclipse.cdt.ui.tests/resources/contentassist/CompletionTestStart36.cpp @@ -1,7 +1,7 @@ -#include "CompletionTestStart.h" - -void aClass::aMethod() -{ - int xLocal = 0; - xAClassMethod( x -} +#include "CompletionTestStart.h" + +void aClass::aMethod() +{ + int xLocal = 0; + xAClassMethod( x +} diff --git a/core/org.eclipse.cdt.ui.tests/resources/contentassist/CompletionTestStart37.cpp b/core/org.eclipse.cdt.ui.tests/resources/contentassist/CompletionTestStart37.cpp index a9e27fb56a0..157101251a5 100644 --- a/core/org.eclipse.cdt.ui.tests/resources/contentassist/CompletionTestStart37.cpp +++ b/core/org.eclipse.cdt.ui.tests/resources/contentassist/CompletionTestStart37.cpp @@ -1,5 +1,5 @@ -#include "CompletionTestStart.h" - -typedef int myType; - - m +#include "CompletionTestStart.h" + +typedef int myType; + + m diff --git a/core/org.eclipse.cdt.ui.tests/resources/contentassist/CompletionTestStart38.cpp b/core/org.eclipse.cdt.ui.tests/resources/contentassist/CompletionTestStart38.cpp index 3e5a238a22c..bf249f93a24 100644 --- a/core/org.eclipse.cdt.ui.tests/resources/contentassist/CompletionTestStart38.cpp +++ b/core/org.eclipse.cdt.ui.tests/resources/contentassist/CompletionTestStart38.cpp @@ -1,11 +1,11 @@ -class Foo{ -public: -Foo(); -class DEF{}; -void bar(); -static void fum(); -static int x; -int y; -}; - +class Foo{ +public: +Foo(); +class DEF{}; +void bar(); +static void fum(); +static int x; +int y; +}; + Foo:: \ No newline at end of file diff --git a/core/org.eclipse.cdt.ui.tests/resources/contentassist/CompletionTestStart39.cpp b/core/org.eclipse.cdt.ui.tests/resources/contentassist/CompletionTestStart39.cpp index 077937373bc..ad0577d18cb 100644 --- a/core/org.eclipse.cdt.ui.tests/resources/contentassist/CompletionTestStart39.cpp +++ b/core/org.eclipse.cdt.ui.tests/resources/contentassist/CompletionTestStart39.cpp @@ -1,10 +1,10 @@ -class Foo{ -public: -Foo(); -void bar(); -static void fum(); -static int x; -int y; -}; - +class Foo{ +public: +Foo(); +void bar(); +static void fum(); +static int x; +int y; +}; + void Foo:: \ No newline at end of file diff --git a/core/org.eclipse.cdt.ui.tests/resources/contentassist/CompletionTestStart4.h b/core/org.eclipse.cdt.ui.tests/resources/contentassist/CompletionTestStart4.h index d09cc7c4d10..25c504e0a8b 100644 --- a/core/org.eclipse.cdt.ui.tests/resources/contentassist/CompletionTestStart4.h +++ b/core/org.eclipse.cdt.ui.tests/resources/contentassist/CompletionTestStart4.h @@ -1,5 +1,5 @@ -#include "CompletionTestStart.h" - -class aThirdClass { - a -}; +#include "CompletionTestStart.h" + +class aThirdClass { + a +}; diff --git a/core/org.eclipse.cdt.ui.tests/resources/contentassist/CompletionTestStart5.cpp b/core/org.eclipse.cdt.ui.tests/resources/contentassist/CompletionTestStart5.cpp index ae96bff9fc7..a0656bbd714 100644 --- a/core/org.eclipse.cdt.ui.tests/resources/contentassist/CompletionTestStart5.cpp +++ b/core/org.eclipse.cdt.ui.tests/resources/contentassist/CompletionTestStart5.cpp @@ -1,6 +1,6 @@ -#include "CompletionTestStart.h" - -void anotherClass::anotherMethod() -{ - -} +#include "CompletionTestStart.h" + +void anotherClass::anotherMethod() +{ + +} diff --git a/core/org.eclipse.cdt.ui.tests/resources/contentassist/CompletionTestStart6.cpp b/core/org.eclipse.cdt.ui.tests/resources/contentassist/CompletionTestStart6.cpp index 57d57b987fd..21ff5cc2a0e 100644 --- a/core/org.eclipse.cdt.ui.tests/resources/contentassist/CompletionTestStart6.cpp +++ b/core/org.eclipse.cdt.ui.tests/resources/contentassist/CompletionTestStart6.cpp @@ -1,7 +1,7 @@ -#include "CompletionTestStart.h" - -void anotherClass::anotherMethod() -{ - aClass* c = new aClass(); - c->a -} +#include "CompletionTestStart.h" + +void anotherClass::anotherMethod() +{ + aClass* c = new aClass(); + c->a +} diff --git a/core/org.eclipse.cdt.ui.tests/resources/contentassist/CompletionTestStart7.cpp b/core/org.eclipse.cdt.ui.tests/resources/contentassist/CompletionTestStart7.cpp index d91f3a4f204..faaecc249b3 100644 --- a/core/org.eclipse.cdt.ui.tests/resources/contentassist/CompletionTestStart7.cpp +++ b/core/org.eclipse.cdt.ui.tests/resources/contentassist/CompletionTestStart7.cpp @@ -1,10 +1,10 @@ -#include "CompletionTestStart.h" - -aClass* foo(){ - return new aClass(); -} - -void anotherClass::anotherMethod() -{ - foo()->a -} +#include "CompletionTestStart.h" + +aClass* foo(){ + return new aClass(); +} + +void anotherClass::anotherMethod() +{ + foo()->a +} diff --git a/core/org.eclipse.cdt.ui.tests/resources/contentassist/CompletionTestStart8.cpp b/core/org.eclipse.cdt.ui.tests/resources/contentassist/CompletionTestStart8.cpp index 0dd8dffa0d0..e3701dba399 100644 --- a/core/org.eclipse.cdt.ui.tests/resources/contentassist/CompletionTestStart8.cpp +++ b/core/org.eclipse.cdt.ui.tests/resources/contentassist/CompletionTestStart8.cpp @@ -1,5 +1,5 @@ -#include "CompletionTestStart.h" - -void foo(int x){ - int y = AM -} +#include "CompletionTestStart.h" + +void foo(int x){ + int y = AM +} diff --git a/core/org.eclipse.cdt.ui.tests/resources/contentassist/CompletionTestStart9.cpp b/core/org.eclipse.cdt.ui.tests/resources/contentassist/CompletionTestStart9.cpp index 6fa0e57c1ab..24bf9db6187 100644 --- a/core/org.eclipse.cdt.ui.tests/resources/contentassist/CompletionTestStart9.cpp +++ b/core/org.eclipse.cdt.ui.tests/resources/contentassist/CompletionTestStart9.cpp @@ -1,7 +1,7 @@ -#include "CompletionTestStart.h" - -void anotherClass::anotherMethod() -{ - aClass c; - c. -} +#include "CompletionTestStart.h" + +void anotherClass::anotherMethod() +{ + aClass c; + c. +} diff --git a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/AutomatedSuite.java b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/AutomatedSuite.java index b85184476c3..d903ce74653 100644 --- a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/AutomatedSuite.java +++ b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/AutomatedSuite.java @@ -1,47 +1,47 @@ -/******************************************************************************* - * Copyright (c) 2000, 2017 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 - * Anton Leherbauer (Wind River Systems) - * Markus Schorn (Wind River Systems) - * Jonah Graham (Kichwa Coders) - converted to new style suite (Bug 515178) - *******************************************************************************/ -package org.eclipse.cdt.ui.tests; - -import org.junit.runner.RunWith; -import org.junit.runners.Suite; - -/** - * Test all areas of the UI. - */ -@RunWith(Suite.class) -@Suite.SuiteClasses({ - org.eclipse.cdt.ui.tests.text.TextTestSuite.class, - org.eclipse.cdt.ui.tests.outline.OutlineTestSuite.class, - org.eclipse.cdt.ui.tests.viewsupport.ViewSupportTestSuite.class, - org.eclipse.cdt.ui.tests.callhierarchy.CallHierarchyTestSuite.class, - org.eclipse.cdt.ui.tests.callhierarchy.extension.CHExtensionTest.class, - org.eclipse.cdt.ui.tests.typehierarchy.TypeHierarchyTestSuite.class, - org.eclipse.cdt.ui.tests.includebrowser.IncludeBrowserTestSuite.class, - org.eclipse.cdt.ui.tests.text.contentassist.ContentAssistTestSuite.class, - org.eclipse.cdt.ui.tests.text.contentassist2.ContentAssist2TestSuite.class, - org.eclipse.cdt.ui.tests.text.selection.SelectionTestSuite.class, - org.eclipse.cdt.ui.tests.quickfix.AssistQuickFixTest.class, - org.eclipse.cdt.ui.tests.buildconsole.BuildConsoleTests.class, - org.eclipse.cdt.ui.tests.search.SearchTestSuite.class, - org.eclipse.cdt.ui.tests.refactoring.RefactoringTestSuite.class, - org.eclipse.cdt.ui.tests.chelp.CHelpTest.class, - org.eclipse.cdt.ui.tests.wizards.classwizard.ClassWizardTestSuite.class, - org.eclipse.cdt.ui.tests.wizards.settingswizards.SettingsWizardTestSuite.class, - org.eclipse.cdt.ui.tests.misc.MiscTestSuite.class, - org.eclipse.cdt.ui.tests.editor.EditorTestSuite.class, - org.eclipse.cdt.ui.tests.templateengine.AllTemplateEngineTests.class, - -}) -public class AutomatedSuite { -} +/******************************************************************************* + * Copyright (c) 2000, 2017 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 + * Anton Leherbauer (Wind River Systems) + * Markus Schorn (Wind River Systems) + * Jonah Graham (Kichwa Coders) - converted to new style suite (Bug 515178) + *******************************************************************************/ +package org.eclipse.cdt.ui.tests; + +import org.junit.runner.RunWith; +import org.junit.runners.Suite; + +/** + * Test all areas of the UI. + */ +@RunWith(Suite.class) +@Suite.SuiteClasses({ + org.eclipse.cdt.ui.tests.text.TextTestSuite.class, + org.eclipse.cdt.ui.tests.outline.OutlineTestSuite.class, + org.eclipse.cdt.ui.tests.viewsupport.ViewSupportTestSuite.class, + org.eclipse.cdt.ui.tests.callhierarchy.CallHierarchyTestSuite.class, + org.eclipse.cdt.ui.tests.callhierarchy.extension.CHExtensionTest.class, + org.eclipse.cdt.ui.tests.typehierarchy.TypeHierarchyTestSuite.class, + org.eclipse.cdt.ui.tests.includebrowser.IncludeBrowserTestSuite.class, + org.eclipse.cdt.ui.tests.text.contentassist.ContentAssistTestSuite.class, + org.eclipse.cdt.ui.tests.text.contentassist2.ContentAssist2TestSuite.class, + org.eclipse.cdt.ui.tests.text.selection.SelectionTestSuite.class, + org.eclipse.cdt.ui.tests.quickfix.AssistQuickFixTest.class, + org.eclipse.cdt.ui.tests.buildconsole.BuildConsoleTests.class, + org.eclipse.cdt.ui.tests.search.SearchTestSuite.class, + org.eclipse.cdt.ui.tests.refactoring.RefactoringTestSuite.class, + org.eclipse.cdt.ui.tests.chelp.CHelpTest.class, + org.eclipse.cdt.ui.tests.wizards.classwizard.ClassWizardTestSuite.class, + org.eclipse.cdt.ui.tests.wizards.settingswizards.SettingsWizardTestSuite.class, + org.eclipse.cdt.ui.tests.misc.MiscTestSuite.class, + org.eclipse.cdt.ui.tests.editor.EditorTestSuite.class, + org.eclipse.cdt.ui.tests.templateengine.AllTemplateEngineTests.class, + +}) +public class AutomatedSuite { +} diff --git a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/callhierarchy/extension/CHContentProvider.java b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/callhierarchy/extension/CHContentProvider.java index f04412856ae..31dba4a22c2 100644 --- a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/callhierarchy/extension/CHContentProvider.java +++ b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/callhierarchy/extension/CHContentProvider.java @@ -1,61 +1,61 @@ -/******************************************************************************* - * Copyright (c) 2018 Wind River Systems, Inc. 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: - * Lidia Popescu - [536255] initial API and implementation. Extension point for open call hierarchy view - *******************************************************************************/ -package org.eclipse.cdt.ui.tests.callhierarchy.extension; - -import org.eclipse.jface.viewers.IOpenListener; - -import org.eclipse.cdt.core.model.ICElement; -import org.eclipse.cdt.ui.ICHEContentProvider; - -import org.eclipse.cdt.internal.core.model.ext.FunctionDeclarationHandle; - -/** - * This class implements ICHEProvider and provides test information - * */ -public class CHContentProvider implements ICHEContentProvider { - - @Override - public Object[] asyncComputeExtendedRoot(Object parentElement) { - Object[] object =null; - if (parentElement instanceof ICElement) { - ICElement element = (ICElement)parentElement; - if ( isDslFunction(element)) { - // check if this function declaration comes from a DSL file - DslNode node = new DslNode(element); - node.setProject(element.getCProject()); - return new Object[]{node}; - } - } - return object; - } - - @Override - public IOpenListener getCCallHierarchyOpenListener() { - return new CHOpenListener(); - } - - /** - * E.g. A custom implementation, suppose that functions that ends with - * "_dsl" have been originally declared in a DSL file. - * @param cElement - * @return - */ - private static boolean isDslFunction(ICElement cElement) { - if (cElement instanceof FunctionDeclarationHandle) { - FunctionDeclarationHandle f = (FunctionDeclarationHandle)cElement; - if (f.getElementName() !=null & f.getElementName().endsWith("_dsl")) { - return true; - } - } - return false; - } - -} +/******************************************************************************* + * Copyright (c) 2018 Wind River Systems, Inc. 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: + * Lidia Popescu - [536255] initial API and implementation. Extension point for open call hierarchy view + *******************************************************************************/ +package org.eclipse.cdt.ui.tests.callhierarchy.extension; + +import org.eclipse.jface.viewers.IOpenListener; + +import org.eclipse.cdt.core.model.ICElement; +import org.eclipse.cdt.ui.ICHEContentProvider; + +import org.eclipse.cdt.internal.core.model.ext.FunctionDeclarationHandle; + +/** + * This class implements ICHEProvider and provides test information + * */ +public class CHContentProvider implements ICHEContentProvider { + + @Override + public Object[] asyncComputeExtendedRoot(Object parentElement) { + Object[] object =null; + if (parentElement instanceof ICElement) { + ICElement element = (ICElement)parentElement; + if ( isDslFunction(element)) { + // check if this function declaration comes from a DSL file + DslNode node = new DslNode(element); + node.setProject(element.getCProject()); + return new Object[]{node}; + } + } + return object; + } + + @Override + public IOpenListener getCCallHierarchyOpenListener() { + return new CHOpenListener(); + } + + /** + * E.g. A custom implementation, suppose that functions that ends with + * "_dsl" have been originally declared in a DSL file. + * @param cElement + * @return + */ + private static boolean isDslFunction(ICElement cElement) { + if (cElement instanceof FunctionDeclarationHandle) { + FunctionDeclarationHandle f = (FunctionDeclarationHandle)cElement; + if (f.getElementName() !=null & f.getElementName().endsWith("_dsl")) { + return true; + } + } + return false; + } + +} diff --git a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/callhierarchy/extension/CHExtensionTest.java b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/callhierarchy/extension/CHExtensionTest.java index af8b5c0b3a8..35dd3c1e4bc 100644 --- a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/callhierarchy/extension/CHExtensionTest.java +++ b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/callhierarchy/extension/CHExtensionTest.java @@ -1,106 +1,106 @@ -/******************************************************************************* - * Copyright (c) 2018 Wind River Systems, Inc. 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: - * Lidia Popescu - initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.ui.tests.callhierarchy.extension; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.runtime.Platform; -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.widgets.Tree; -import org.eclipse.ui.plugin.AbstractUIPlugin; - -import org.eclipse.cdt.ui.CUIPlugin; -import org.eclipse.cdt.ui.tests.callhierarchy.CallHierarchyBaseTest; - -import org.eclipse.cdt.internal.ui.editor.CEditor; - -import junit.framework.TestSuite; - -/** - * @author Lidia Popescu - * - */ -public class CHExtensionTest extends CallHierarchyBaseTest { - - private static final String FILE_NAME_MAIN_C = "CallHierarchy_main.c"; - private static final String FILE_NAME_DSL = "CallHierarchy_test.java"; - private static final String FILE_NAME_C = "CallHierarchy_test.c"; - - public CHExtensionTest(String name) { - super(name); - } - - public static TestSuite suite() { - return new TestSuite(CHExtensionTest.class); - } - -// {CallHierarchy_main.c} -// extern void function_c(void); -// extern void function_dsl(void); -// -// void main(void) -// { -// function_c(); -// function_dsl(); -// } - -// {CallHierarchy_test.c} -// void function_c(void) -// { -// printf("Hello, world!\n"); -// } - -// {CallHierarchy_test.java} -// /** Suppose this code is written in a different custom programming language, any DSL, e.g. Java*/ -// class CallHierarchy_test { -// public static void function_dsl() { -// System.out.println("Hello, world!"); -// } -// } - public void testCallHierarchy() throws Exception { - - assertNotNull(Platform.getExtensionRegistry().getExtensionPoint("org.eclipse.cdt.ui.CCallHierarchy")); - - ImageDescriptor imageDesc = AbstractUIPlugin.imageDescriptorFromPlugin(CUIPlugin.PLUGIN_ID, CHLabelProvider.ICON_PATH); - assertNotNull(imageDesc); - Image image = imageDesc.createImage(); //$NON-NLS-1$ - assertNotNull(image); - - String content = readTaggedComment(FILE_NAME_DSL); - assertNotNull(content); - IFile file= createFile(getProject(), FILE_NAME_DSL, content); - - content = readTaggedComment(FILE_NAME_C); - assertNotNull(content); - file= createFile(getProject(), FILE_NAME_C, content); - waitUntilFileIsIndexed(fIndex, file); - - content = readTaggedComment(FILE_NAME_MAIN_C); - assertNotNull(content); - file= createFile(getProject(), FILE_NAME_MAIN_C, content); - waitUntilFileIsIndexed(fIndex, file); - CEditor editor = openEditor(file); - - String functionName ="function_c"; - editor.selectAndReveal(content.indexOf(functionName), functionName.length()); - openCallHierarchy(editor); - Tree tree = getCHTreeViewer().getTree(); - checkTreeNode(tree, 0, "function_c() : void"); - checkTreeNode(tree, 0, 0 ,"main() : void"); - - functionName ="function_dsl"; - editor.selectAndReveal(content.indexOf(functionName), functionName.length()); - openCallHierarchy(editor); - tree = getCHTreeViewer().getTree(); - checkTreeNode(tree, 0, "JAVA function function_dsl()"); - checkTreeNode(tree, 0, 0, "function_dsl() : void"); - } -} +/******************************************************************************* + * Copyright (c) 2018 Wind River Systems, Inc. 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: + * Lidia Popescu - initial API and implementation + *******************************************************************************/ +package org.eclipse.cdt.ui.tests.callhierarchy.extension; + +import org.eclipse.core.resources.IFile; +import org.eclipse.core.runtime.Platform; +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.widgets.Tree; +import org.eclipse.ui.plugin.AbstractUIPlugin; + +import org.eclipse.cdt.ui.CUIPlugin; +import org.eclipse.cdt.ui.tests.callhierarchy.CallHierarchyBaseTest; + +import org.eclipse.cdt.internal.ui.editor.CEditor; + +import junit.framework.TestSuite; + +/** + * @author Lidia Popescu + * + */ +public class CHExtensionTest extends CallHierarchyBaseTest { + + private static final String FILE_NAME_MAIN_C = "CallHierarchy_main.c"; + private static final String FILE_NAME_DSL = "CallHierarchy_test.java"; + private static final String FILE_NAME_C = "CallHierarchy_test.c"; + + public CHExtensionTest(String name) { + super(name); + } + + public static TestSuite suite() { + return new TestSuite(CHExtensionTest.class); + } + +// {CallHierarchy_main.c} +// extern void function_c(void); +// extern void function_dsl(void); +// +// void main(void) +// { +// function_c(); +// function_dsl(); +// } + +// {CallHierarchy_test.c} +// void function_c(void) +// { +// printf("Hello, world!\n"); +// } + +// {CallHierarchy_test.java} +// /** Suppose this code is written in a different custom programming language, any DSL, e.g. Java*/ +// class CallHierarchy_test { +// public static void function_dsl() { +// System.out.println("Hello, world!"); +// } +// } + public void testCallHierarchy() throws Exception { + + assertNotNull(Platform.getExtensionRegistry().getExtensionPoint("org.eclipse.cdt.ui.CCallHierarchy")); + + ImageDescriptor imageDesc = AbstractUIPlugin.imageDescriptorFromPlugin(CUIPlugin.PLUGIN_ID, CHLabelProvider.ICON_PATH); + assertNotNull(imageDesc); + Image image = imageDesc.createImage(); //$NON-NLS-1$ + assertNotNull(image); + + String content = readTaggedComment(FILE_NAME_DSL); + assertNotNull(content); + IFile file= createFile(getProject(), FILE_NAME_DSL, content); + + content = readTaggedComment(FILE_NAME_C); + assertNotNull(content); + file= createFile(getProject(), FILE_NAME_C, content); + waitUntilFileIsIndexed(fIndex, file); + + content = readTaggedComment(FILE_NAME_MAIN_C); + assertNotNull(content); + file= createFile(getProject(), FILE_NAME_MAIN_C, content); + waitUntilFileIsIndexed(fIndex, file); + CEditor editor = openEditor(file); + + String functionName ="function_c"; + editor.selectAndReveal(content.indexOf(functionName), functionName.length()); + openCallHierarchy(editor); + Tree tree = getCHTreeViewer().getTree(); + checkTreeNode(tree, 0, "function_c() : void"); + checkTreeNode(tree, 0, 0 ,"main() : void"); + + functionName ="function_dsl"; + editor.selectAndReveal(content.indexOf(functionName), functionName.length()); + openCallHierarchy(editor); + tree = getCHTreeViewer().getTree(); + checkTreeNode(tree, 0, "JAVA function function_dsl()"); + checkTreeNode(tree, 0, 0, "function_dsl() : void"); + } +} diff --git a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/callhierarchy/extension/CHLabelProvider.java b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/callhierarchy/extension/CHLabelProvider.java index 86ae3cfcd3f..a400878599b 100644 --- a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/callhierarchy/extension/CHLabelProvider.java +++ b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/callhierarchy/extension/CHLabelProvider.java @@ -1,72 +1,72 @@ -/******************************************************************************* - * Copyright (c) 2018 Wind River Systems, Inc. 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: - * Lidia Popescu - initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.ui.tests.callhierarchy.extension; - -import org.eclipse.jface.viewers.DelegatingStyledCellLabelProvider.IStyledLabelProvider; -import org.eclipse.jface.viewers.ILabelProviderListener; -import org.eclipse.jface.viewers.StyledCellLabelProvider; -import org.eclipse.jface.viewers.StyledString; -import org.eclipse.swt.graphics.Image; -import org.eclipse.ui.plugin.AbstractUIPlugin; - -import org.eclipse.cdt.core.model.ICElement; -import org.eclipse.cdt.ui.CUIPlugin; - -public class CHLabelProvider implements IStyledLabelProvider { - - public static String ICON_PATH= "$nl$/icons/obj16/container_obj.gif"; - - @Override - public void addListener(ILabelProviderListener listener) { - } - - @Override - public void dispose() { - } - - @Override - public boolean isLabelProperty(Object element, String property) { - return true; - } - - @Override - public void removeListener(ILabelProviderListener listener) { - } - - @Override - public StyledString getStyledText(Object element) { - if (element instanceof DslNode) { - DslNode node = (DslNode)element; - ICElement decl = node.getRepresentedDeclaration(); - - if (decl !=null) { - StyledString label = new StyledString(); - label.append(decl.getElementName()); - if (node.getDslNodeName() != null) { - return StyledCellLabelProvider.styleDecoratedString(node.getDslNodeName(), StyledString.DECORATIONS_STYLER, label); - } - return label; - } - } - return null; - } - - @Override - public Image getImage(Object element) { - if (element instanceof DslNode) { - Image img = AbstractUIPlugin.imageDescriptorFromPlugin( - CUIPlugin.PLUGIN_ID, ICON_PATH).createImage(); //$NON-NLS-1$ - return img; - } - return null; - } - -} +/******************************************************************************* + * Copyright (c) 2018 Wind River Systems, Inc. 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: + * Lidia Popescu - initial API and implementation + *******************************************************************************/ +package org.eclipse.cdt.ui.tests.callhierarchy.extension; + +import org.eclipse.jface.viewers.DelegatingStyledCellLabelProvider.IStyledLabelProvider; +import org.eclipse.jface.viewers.ILabelProviderListener; +import org.eclipse.jface.viewers.StyledCellLabelProvider; +import org.eclipse.jface.viewers.StyledString; +import org.eclipse.swt.graphics.Image; +import org.eclipse.ui.plugin.AbstractUIPlugin; + +import org.eclipse.cdt.core.model.ICElement; +import org.eclipse.cdt.ui.CUIPlugin; + +public class CHLabelProvider implements IStyledLabelProvider { + + public static String ICON_PATH= "$nl$/icons/obj16/container_obj.gif"; + + @Override + public void addListener(ILabelProviderListener listener) { + } + + @Override + public void dispose() { + } + + @Override + public boolean isLabelProperty(Object element, String property) { + return true; + } + + @Override + public void removeListener(ILabelProviderListener listener) { + } + + @Override + public StyledString getStyledText(Object element) { + if (element instanceof DslNode) { + DslNode node = (DslNode)element; + ICElement decl = node.getRepresentedDeclaration(); + + if (decl !=null) { + StyledString label = new StyledString(); + label.append(decl.getElementName()); + if (node.getDslNodeName() != null) { + return StyledCellLabelProvider.styleDecoratedString(node.getDslNodeName(), StyledString.DECORATIONS_STYLER, label); + } + return label; + } + } + return null; + } + + @Override + public Image getImage(Object element) { + if (element instanceof DslNode) { + Image img = AbstractUIPlugin.imageDescriptorFromPlugin( + CUIPlugin.PLUGIN_ID, ICON_PATH).createImage(); //$NON-NLS-1$ + return img; + } + return null; + } + +} diff --git a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/callhierarchy/extension/CHOpenListener.java b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/callhierarchy/extension/CHOpenListener.java index 4023687829b..579879c8484 100644 --- a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/callhierarchy/extension/CHOpenListener.java +++ b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/callhierarchy/extension/CHOpenListener.java @@ -1,92 +1,92 @@ -/******************************************************************************* - * Copyright (c) 2018 Wind River Systems, Inc. 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: - * Lidia Popescu - initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.ui.tests.callhierarchy.extension; - -import java.util.HashMap; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IMarker; -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.jface.viewers.IOpenListener; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.OpenEvent; -import org.eclipse.jface.viewers.TreeSelection; -import org.eclipse.ui.IEditorDescriptor; -import org.eclipse.ui.IEditorInput; -import org.eclipse.ui.IEditorPart; -import org.eclipse.ui.IWorkbenchPage; -import org.eclipse.ui.PartInitException; -import org.eclipse.ui.PlatformUI; -import org.eclipse.ui.ide.IDE; -import org.eclipse.ui.part.FileEditorInput; -import org.eclipse.ui.progress.UIJob; - -import org.eclipse.cdt.core.model.ICProject; -import org.eclipse.cdt.ui.testplugin.CTestPlugin; - - -public class CHOpenListener implements IOpenListener { - - /** On Node click open corresponding file */ - @Override - public void open(OpenEvent event) { - if (event !=null ) { - ISelection selection = event.getSelection(); - if (selection instanceof TreeSelection ) { - TreeSelection treeSelection = (TreeSelection)selection; - Object element = treeSelection.getFirstElement(); - if (element instanceof DslNode) { - DslNode node = (DslNode)element; - ICProject project = node.getProject(); - /** - * Based on a custom algorithm the corresponding file and line should be found and open. Suppose that the file - * 'CallHierarchy_test.java' has been found, and the line number '3' where the function 'function_dsl' is defined. - */ - IFile file = project.getProject().getFile("CallHierarchy_test.java"); - IWorkbenchPage page= PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActivePart().getSite().getPage(); - IEditorInput input = new FileEditorInput(file); - IEditorDescriptor desc = PlatformUI.getWorkbench().getEditorRegistry().getDefaultEditor(input.getName()); - - UIJob ui = new UIJob("Open File") { - - @Override - public IStatus runInUIThread(IProgressMonitor monitor) { - try { - String editorId = null; - if (desc == null || desc.isOpenExternal()) { - editorId = "org.eclipse.ui.DefaultTextEditor"; - } else { - editorId = desc.getId(); - } - IEditorPart editor = page.openEditor(input, editorId); - IMarker fMarker = file.createMarker(IMarker.TEXT); - HashMap map = new HashMap(); - map.put(IMarker.LINE_NUMBER, 3); - fMarker.setAttributes(map); - IDE.gotoMarker(editor,fMarker); - - } catch (PartInitException e) { - e.printStackTrace(); - } catch (CoreException e) { - e.printStackTrace(); - } - return new Status(IStatus.OK, CTestPlugin.PLUGIN_ID, ""); - } - }; - ui.schedule(); - } - } - } - } -} +/******************************************************************************* + * Copyright (c) 2018 Wind River Systems, Inc. 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: + * Lidia Popescu - initial API and implementation + *******************************************************************************/ +package org.eclipse.cdt.ui.tests.callhierarchy.extension; + +import java.util.HashMap; + +import org.eclipse.core.resources.IFile; +import org.eclipse.core.resources.IMarker; +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.jface.viewers.IOpenListener; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.OpenEvent; +import org.eclipse.jface.viewers.TreeSelection; +import org.eclipse.ui.IEditorDescriptor; +import org.eclipse.ui.IEditorInput; +import org.eclipse.ui.IEditorPart; +import org.eclipse.ui.IWorkbenchPage; +import org.eclipse.ui.PartInitException; +import org.eclipse.ui.PlatformUI; +import org.eclipse.ui.ide.IDE; +import org.eclipse.ui.part.FileEditorInput; +import org.eclipse.ui.progress.UIJob; + +import org.eclipse.cdt.core.model.ICProject; +import org.eclipse.cdt.ui.testplugin.CTestPlugin; + + +public class CHOpenListener implements IOpenListener { + + /** On Node click open corresponding file */ + @Override + public void open(OpenEvent event) { + if (event !=null ) { + ISelection selection = event.getSelection(); + if (selection instanceof TreeSelection ) { + TreeSelection treeSelection = (TreeSelection)selection; + Object element = treeSelection.getFirstElement(); + if (element instanceof DslNode) { + DslNode node = (DslNode)element; + ICProject project = node.getProject(); + /** + * Based on a custom algorithm the corresponding file and line should be found and open. Suppose that the file + * 'CallHierarchy_test.java' has been found, and the line number '3' where the function 'function_dsl' is defined. + */ + IFile file = project.getProject().getFile("CallHierarchy_test.java"); + IWorkbenchPage page= PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActivePart().getSite().getPage(); + IEditorInput input = new FileEditorInput(file); + IEditorDescriptor desc = PlatformUI.getWorkbench().getEditorRegistry().getDefaultEditor(input.getName()); + + UIJob ui = new UIJob("Open File") { + + @Override + public IStatus runInUIThread(IProgressMonitor monitor) { + try { + String editorId = null; + if (desc == null || desc.isOpenExternal()) { + editorId = "org.eclipse.ui.DefaultTextEditor"; + } else { + editorId = desc.getId(); + } + IEditorPart editor = page.openEditor(input, editorId); + IMarker fMarker = file.createMarker(IMarker.TEXT); + HashMap map = new HashMap(); + map.put(IMarker.LINE_NUMBER, 3); + fMarker.setAttributes(map); + IDE.gotoMarker(editor,fMarker); + + } catch (PartInitException e) { + e.printStackTrace(); + } catch (CoreException e) { + e.printStackTrace(); + } + return new Status(IStatus.OK, CTestPlugin.PLUGIN_ID, ""); + } + }; + ui.schedule(); + } + } + } + } +} diff --git a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/callhierarchy/extension/DslNode.java b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/callhierarchy/extension/DslNode.java index 9da5175c153..7515fb44b35 100644 --- a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/callhierarchy/extension/DslNode.java +++ b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/callhierarchy/extension/DslNode.java @@ -1,76 +1,76 @@ -/******************************************************************************* - * Copyright (c) 2018 Wind River Systems, Inc. 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: - * Lidia Popescu - initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.ui.tests.callhierarchy.extension; - -import org.eclipse.core.runtime.IAdaptable; - -import org.eclipse.cdt.core.model.ICElement; -import org.eclipse.cdt.core.model.ICProject; -import org.eclipse.cdt.ui.ICHENode; - - -/** - * The dsl node sample - * */ -public class DslNode implements IAdaptable, ICHENode { - - private ICElement fRepresentedDecl; - private ICProject mProject; - private String mDslNodeName; - - /** - * Constructor used for Open Call Hierarchy command - * */ - public DslNode(ICElement decl) { - this.fRepresentedDecl = decl; - } - - /** - * Constructor used for Open Dsl declaration command - * */ - public DslNode() { - - } - - public ICProject getProject() { - return mProject; - } - - - public void setProject(ICProject mProject) { - this.mProject = mProject; - } - - @Override - public ICElement getRepresentedDeclaration() { - return fRepresentedDecl; - } - - - @Override - public T getAdapter(Class adapterClass) { - if (adapterClass == ICElement.class) { - return (T)getRepresentedDeclaration(); - } - return null; - } - - /** - * Should be displayed with an indication that this is the dsl, - * e.g. "Java function ". - * */ - public String getDslNodeName() { - if ( mDslNodeName == null ) { - mDslNodeName = "JAVA function " + fRepresentedDecl.getElementName()+"()"; - } - return mDslNodeName; - } -} +/******************************************************************************* + * Copyright (c) 2018 Wind River Systems, Inc. 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: + * Lidia Popescu - initial API and implementation + *******************************************************************************/ +package org.eclipse.cdt.ui.tests.callhierarchy.extension; + +import org.eclipse.core.runtime.IAdaptable; + +import org.eclipse.cdt.core.model.ICElement; +import org.eclipse.cdt.core.model.ICProject; +import org.eclipse.cdt.ui.ICHENode; + + +/** + * The dsl node sample + * */ +public class DslNode implements IAdaptable, ICHENode { + + private ICElement fRepresentedDecl; + private ICProject mProject; + private String mDslNodeName; + + /** + * Constructor used for Open Call Hierarchy command + * */ + public DslNode(ICElement decl) { + this.fRepresentedDecl = decl; + } + + /** + * Constructor used for Open Dsl declaration command + * */ + public DslNode() { + + } + + public ICProject getProject() { + return mProject; + } + + + public void setProject(ICProject mProject) { + this.mProject = mProject; + } + + @Override + public ICElement getRepresentedDeclaration() { + return fRepresentedDecl; + } + + + @Override + public T getAdapter(Class adapterClass) { + if (adapterClass == ICElement.class) { + return (T)getRepresentedDeclaration(); + } + return null; + } + + /** + * Should be displayed with an indication that this is the dsl, + * e.g. "Java function ". + * */ + public String getDslNodeName() { + if ( mDslNodeName == null ) { + mDslNodeName = "JAVA function " + fRepresentedDecl.getElementName()+"()"; + } + return mDslNodeName; + } +} diff --git a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist2/TemplateProposalTest.java b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist2/TemplateProposalTest.java index 6edae0b2ce6..47545979aad 100644 --- a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist2/TemplateProposalTest.java +++ b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/text/contentassist2/TemplateProposalTest.java @@ -1,223 +1,223 @@ -/******************************************************************************* - * Copyright (c) 2012, 2014 Marc-Andre Laperle 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: - * Marc-Andre Laperle - initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.ui.tests.text.contentassist2; - -import junit.framework.Test; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IProject; -import org.eclipse.jface.text.templates.Template; -import org.eclipse.jface.text.templates.persistence.TemplatePersistenceData; -import org.eclipse.jface.text.templates.persistence.TemplateStore; - -import org.eclipse.cdt.core.testplugin.util.BaseTestCase; -import org.eclipse.cdt.ui.CUIPlugin; - -import org.eclipse.cdt.internal.corext.template.c.CContextType; - - -public class TemplateProposalTest extends AbstractContentAssistTest { - - public TemplateProposalTest(String name) { - super(name, true); - } - - public TemplateProposalTest(String name, boolean isCpp) { - super(name, isCpp); - } - - public static Test suite() { - return BaseTestCase.suite(TemplateProposalTest.class, "_"); - } - - @Override - protected void setUp() throws Exception { - super.setUp(); - - // Remove all the default templates. Tests will add templates as necessary. - TemplateStore templateStore = CUIPlugin.getDefault().getTemplateStore(); - TemplatePersistenceData[] templateData = templateStore.getTemplateData(false); - for (TemplatePersistenceData templatePersistenceData : templateData) { - templateStore.delete(templatePersistenceData); - } - } - - @Override - protected void tearDown() throws Exception { - super.tearDown(); - - // Restore the default templates - CUIPlugin.getDefault().getTemplateStore().restoreDefaults(); - } - - private static final String HEADER_FILE_NAME = "CompletionTest.h"; - private static final String SOURCE_FILE_NAME = "CompletionTest.cpp"; - private static final String SELECTION_START_TAG = "/*sel-start*/"; - private static final String SELECTION_END_TAG = "/*sel-end*/"; - - private static final String TEMPLATE_NAME_WORD_SELECTION = "word selection template"; - private static final String TEMPLATE_NAME_WORD_SELECTION_DISP = TEMPLATE_NAME_WORD_SELECTION + " - "; - private static final String TEMPLATE_NAME_LINE_SELECTION = "line selection template"; - private static final String TEMPLATE_NAME_LINE_SELECTION_DISP = TEMPLATE_NAME_LINE_SELECTION + " - "; - - protected int fSelectionOffset; - protected int fSelectionLength; - private IProject fProject; - - @Override - protected IFile setUpProjectContent(IProject project) throws Exception { - fProject= project; - StringBuilder sourceContent= getContentsForTest(1)[0]; - fSelectionOffset= sourceContent.indexOf(SELECTION_START_TAG); - assertTrue("No selection start specified", fSelectionOffset >= 0); - sourceContent.delete(fSelectionOffset, fSelectionOffset + SELECTION_START_TAG.length()); - int selEndOffset = sourceContent.indexOf(SELECTION_END_TAG); - - if (selEndOffset >= 0) { - sourceContent.delete(selEndOffset, selEndOffset + SELECTION_END_TAG.length()); - fSelectionLength = selEndOffset - fSelectionOffset; - } else { - fSelectionLength = 0; - } - - return createFile(project, SOURCE_FILE_NAME, sourceContent.toString()); - } - - private void addWordSelectionTemplate() { - Template newTemplate = new Template(TEMPLATE_NAME_WORD_SELECTION, "", CContextType.ID, "cout << ${word_selection};", true); - TemplatePersistenceData data= new TemplatePersistenceData(newTemplate, true); - CUIPlugin.getDefault().getTemplateStore().add(data); - } - - private void addLineSelectionTemplate() { - Template newTemplate = new Template(TEMPLATE_NAME_LINE_SELECTION, "", CContextType.ID, "cout << ${line_selection};", true); - TemplatePersistenceData data= new TemplatePersistenceData(newTemplate, true); - CUIPlugin.getDefault().getTemplateStore().add(data); - } - - protected static final int DEFAULT_FLAGS = AbstractContentAssistTest.DEFAULT_FLAGS | IS_COMPLETION | IS_TEMPLATE; - - protected void assertCompletionResults(String[] expected) throws Exception { - assertContentAssistResults(fSelectionOffset, fSelectionLength, expected, DEFAULT_FLAGS, CompareType.ID); - } - - //void func() { - ///*sel-start*/test foo bar/*sel-end*/ - //} - public void testFullLineSelection() throws Exception { - addLineSelectionTemplate(); - addWordSelectionTemplate(); - final String[] expected= { - TEMPLATE_NAME_LINE_SELECTION_DISP - }; - assertCompletionResults(expected); - } - - //void func() { - ///*sel-start*/test foo bar - //test foo bar/*sel-end*/ - //} - public void testMultiLineSelection() throws Exception { - addLineSelectionTemplate(); - addWordSelectionTemplate(); - final String[] expected= { - TEMPLATE_NAME_LINE_SELECTION_DISP - }; - assertCompletionResults(expected); - } - - //void func() { - //foo /*sel-start*/test/*sel-end*/ - //} - public void testWordSelection() throws Exception { - addLineSelectionTemplate(); - addWordSelectionTemplate(); - final String[] expected= { - TEMPLATE_NAME_WORD_SELECTION_DISP - }; - assertCompletionResults(expected); - } - - //void func() { - //foo/*sel-start*/test/*sel-end*/ - //} - public void testPartialLineWordSelection() throws Exception { - addLineSelectionTemplate(); - addWordSelectionTemplate(); - final String[] expected= { - TEMPLATE_NAME_WORD_SELECTION_DISP - }; - assertCompletionResults(expected); - } - - //void func() { - //test foo/*sel-start*/bar - //test foo /*sel-end*/bar - //} - public void testWordSelectionOverMultiLine() throws Exception { - addLineSelectionTemplate(); - addWordSelectionTemplate(); - final String[] expected= { - TEMPLATE_NAME_WORD_SELECTION_DISP - }; - assertCompletionResults(expected); - } - - //void func() { - // /*sel-start*/test/*sel-end*/ - //} - public void testBug298554_lineSelectedWithoutWhitespaces() throws Exception { - addLineSelectionTemplate(); - final String[] expected= { - TEMPLATE_NAME_LINE_SELECTION_DISP - }; - assertCompletionResults(expected); - } - - //void func() { - // /*sel-start*/test foo bar - //test foo bar/*sel-end*/ - //} - public void testBug298554_multiLineSelectedWithoutWhitespaces() throws Exception { - addWordSelectionTemplate(); - addLineSelectionTemplate(); - final String[] expected= { - TEMPLATE_NAME_LINE_SELECTION_DISP - }; - assertCompletionResults(expected); - } - - //void func() { - // /*sel-start*/test/*sel-end*/ - //} - public void testBug304482_onlyWordOnLine() throws Exception { - addLineSelectionTemplate(); - addWordSelectionTemplate(); - final String[] expected= { - TEMPLATE_NAME_LINE_SELECTION_DISP, - TEMPLATE_NAME_WORD_SELECTION_DISP - }; - assertCompletionResults(expected); - } - - //void func() { - ///*sel-start*/test/*sel-end*/ - //} - public void testBug304482_onlyWordOnLineStartOfLine() throws Exception { - addLineSelectionTemplate(); - addWordSelectionTemplate(); - final String[] expected= { - TEMPLATE_NAME_LINE_SELECTION_DISP, - TEMPLATE_NAME_WORD_SELECTION_DISP - }; - assertCompletionResults(expected); - } - -} +/******************************************************************************* + * Copyright (c) 2012, 2014 Marc-Andre Laperle 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: + * Marc-Andre Laperle - initial API and implementation + *******************************************************************************/ +package org.eclipse.cdt.ui.tests.text.contentassist2; + +import junit.framework.Test; + +import org.eclipse.core.resources.IFile; +import org.eclipse.core.resources.IProject; +import org.eclipse.jface.text.templates.Template; +import org.eclipse.jface.text.templates.persistence.TemplatePersistenceData; +import org.eclipse.jface.text.templates.persistence.TemplateStore; + +import org.eclipse.cdt.core.testplugin.util.BaseTestCase; +import org.eclipse.cdt.ui.CUIPlugin; + +import org.eclipse.cdt.internal.corext.template.c.CContextType; + + +public class TemplateProposalTest extends AbstractContentAssistTest { + + public TemplateProposalTest(String name) { + super(name, true); + } + + public TemplateProposalTest(String name, boolean isCpp) { + super(name, isCpp); + } + + public static Test suite() { + return BaseTestCase.suite(TemplateProposalTest.class, "_"); + } + + @Override + protected void setUp() throws Exception { + super.setUp(); + + // Remove all the default templates. Tests will add templates as necessary. + TemplateStore templateStore = CUIPlugin.getDefault().getTemplateStore(); + TemplatePersistenceData[] templateData = templateStore.getTemplateData(false); + for (TemplatePersistenceData templatePersistenceData : templateData) { + templateStore.delete(templatePersistenceData); + } + } + + @Override + protected void tearDown() throws Exception { + super.tearDown(); + + // Restore the default templates + CUIPlugin.getDefault().getTemplateStore().restoreDefaults(); + } + + private static final String HEADER_FILE_NAME = "CompletionTest.h"; + private static final String SOURCE_FILE_NAME = "CompletionTest.cpp"; + private static final String SELECTION_START_TAG = "/*sel-start*/"; + private static final String SELECTION_END_TAG = "/*sel-end*/"; + + private static final String TEMPLATE_NAME_WORD_SELECTION = "word selection template"; + private static final String TEMPLATE_NAME_WORD_SELECTION_DISP = TEMPLATE_NAME_WORD_SELECTION + " - "; + private static final String TEMPLATE_NAME_LINE_SELECTION = "line selection template"; + private static final String TEMPLATE_NAME_LINE_SELECTION_DISP = TEMPLATE_NAME_LINE_SELECTION + " - "; + + protected int fSelectionOffset; + protected int fSelectionLength; + private IProject fProject; + + @Override + protected IFile setUpProjectContent(IProject project) throws Exception { + fProject= project; + StringBuilder sourceContent= getContentsForTest(1)[0]; + fSelectionOffset= sourceContent.indexOf(SELECTION_START_TAG); + assertTrue("No selection start specified", fSelectionOffset >= 0); + sourceContent.delete(fSelectionOffset, fSelectionOffset + SELECTION_START_TAG.length()); + int selEndOffset = sourceContent.indexOf(SELECTION_END_TAG); + + if (selEndOffset >= 0) { + sourceContent.delete(selEndOffset, selEndOffset + SELECTION_END_TAG.length()); + fSelectionLength = selEndOffset - fSelectionOffset; + } else { + fSelectionLength = 0; + } + + return createFile(project, SOURCE_FILE_NAME, sourceContent.toString()); + } + + private void addWordSelectionTemplate() { + Template newTemplate = new Template(TEMPLATE_NAME_WORD_SELECTION, "", CContextType.ID, "cout << ${word_selection};", true); + TemplatePersistenceData data= new TemplatePersistenceData(newTemplate, true); + CUIPlugin.getDefault().getTemplateStore().add(data); + } + + private void addLineSelectionTemplate() { + Template newTemplate = new Template(TEMPLATE_NAME_LINE_SELECTION, "", CContextType.ID, "cout << ${line_selection};", true); + TemplatePersistenceData data= new TemplatePersistenceData(newTemplate, true); + CUIPlugin.getDefault().getTemplateStore().add(data); + } + + protected static final int DEFAULT_FLAGS = AbstractContentAssistTest.DEFAULT_FLAGS | IS_COMPLETION | IS_TEMPLATE; + + protected void assertCompletionResults(String[] expected) throws Exception { + assertContentAssistResults(fSelectionOffset, fSelectionLength, expected, DEFAULT_FLAGS, CompareType.ID); + } + + //void func() { + ///*sel-start*/test foo bar/*sel-end*/ + //} + public void testFullLineSelection() throws Exception { + addLineSelectionTemplate(); + addWordSelectionTemplate(); + final String[] expected= { + TEMPLATE_NAME_LINE_SELECTION_DISP + }; + assertCompletionResults(expected); + } + + //void func() { + ///*sel-start*/test foo bar + //test foo bar/*sel-end*/ + //} + public void testMultiLineSelection() throws Exception { + addLineSelectionTemplate(); + addWordSelectionTemplate(); + final String[] expected= { + TEMPLATE_NAME_LINE_SELECTION_DISP + }; + assertCompletionResults(expected); + } + + //void func() { + //foo /*sel-start*/test/*sel-end*/ + //} + public void testWordSelection() throws Exception { + addLineSelectionTemplate(); + addWordSelectionTemplate(); + final String[] expected= { + TEMPLATE_NAME_WORD_SELECTION_DISP + }; + assertCompletionResults(expected); + } + + //void func() { + //foo/*sel-start*/test/*sel-end*/ + //} + public void testPartialLineWordSelection() throws Exception { + addLineSelectionTemplate(); + addWordSelectionTemplate(); + final String[] expected= { + TEMPLATE_NAME_WORD_SELECTION_DISP + }; + assertCompletionResults(expected); + } + + //void func() { + //test foo/*sel-start*/bar + //test foo /*sel-end*/bar + //} + public void testWordSelectionOverMultiLine() throws Exception { + addLineSelectionTemplate(); + addWordSelectionTemplate(); + final String[] expected= { + TEMPLATE_NAME_WORD_SELECTION_DISP + }; + assertCompletionResults(expected); + } + + //void func() { + // /*sel-start*/test/*sel-end*/ + //} + public void testBug298554_lineSelectedWithoutWhitespaces() throws Exception { + addLineSelectionTemplate(); + final String[] expected= { + TEMPLATE_NAME_LINE_SELECTION_DISP + }; + assertCompletionResults(expected); + } + + //void func() { + // /*sel-start*/test foo bar + //test foo bar/*sel-end*/ + //} + public void testBug298554_multiLineSelectedWithoutWhitespaces() throws Exception { + addWordSelectionTemplate(); + addLineSelectionTemplate(); + final String[] expected= { + TEMPLATE_NAME_LINE_SELECTION_DISP + }; + assertCompletionResults(expected); + } + + //void func() { + // /*sel-start*/test/*sel-end*/ + //} + public void testBug304482_onlyWordOnLine() throws Exception { + addLineSelectionTemplate(); + addWordSelectionTemplate(); + final String[] expected= { + TEMPLATE_NAME_LINE_SELECTION_DISP, + TEMPLATE_NAME_WORD_SELECTION_DISP + }; + assertCompletionResults(expected); + } + + //void func() { + ///*sel-start*/test/*sel-end*/ + //} + public void testBug304482_onlyWordOnLineStartOfLine() throws Exception { + addLineSelectionTemplate(); + addWordSelectionTemplate(); + final String[] expected= { + TEMPLATE_NAME_LINE_SELECTION_DISP, + TEMPLATE_NAME_WORD_SELECTION_DISP + }; + assertCompletionResults(expected); + } + +} diff --git a/core/org.eclipse.cdt.ui/schema/CCallHierarchy.exsd b/core/org.eclipse.cdt.ui/schema/CCallHierarchy.exsd index f0a235b9c9c..1c349f889ae 100644 --- a/core/org.eclipse.cdt.ui/schema/CCallHierarchy.exsd +++ b/core/org.eclipse.cdt.ui/schema/CCallHierarchy.exsd @@ -1,148 +1,148 @@ - - - - - - - - - This Call Hierarchy Tree Extension makes possible to extend the CH tree content by adding a new node at the top of the tree, respectivity to customize it's icon and style text, and to add additional click listeners. This could be usefull for mixed source projects, when original declaration of a CDT node comes from a different programming language. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 6.4 - - - - - - - - - A full sample of implementation is provided in org.eclipse.cdt.ui.tests plugin. -<extension - point="org.eclipse.cdt.ui.CCallHierarchy"> - <CallHierarchyLabelProvider - class="org.eclipse.cdt.ui.tests.callhierarchy.extension.CHLabelProvider" - id="org.eclipse.cdt.ui.tests.callhierarchy.extension.CHLabelProvider"> - </CallHierarchyLabelProvider> - <CallHierarchyContentProvider - class="org.eclipse.cdt.ui.tests.callhierarchy.extension.CHContentProvider" - id="org.eclipse.cdt.ui.tests.callhierarchy.extension.CHContentProvider"> - </CallHierarchyContentProvider> - </extension> - - - - - - - - - - - [Enter API information here.] - - - - - - - - - [Enter information about supplied implementation of this extension point.] - - - - - + + + + + + + + + This Call Hierarchy Tree Extension makes possible to extend the CH tree content by adding a new node at the top of the tree, respectivity to customize it's icon and style text, and to add additional click listeners. This could be usefull for mixed source projects, when original declaration of a CDT node comes from a different programming language. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 6.4 + + + + + + + + + A full sample of implementation is provided in org.eclipse.cdt.ui.tests plugin. +<extension + point="org.eclipse.cdt.ui.CCallHierarchy"> + <CallHierarchyLabelProvider + class="org.eclipse.cdt.ui.tests.callhierarchy.extension.CHLabelProvider" + id="org.eclipse.cdt.ui.tests.callhierarchy.extension.CHLabelProvider"> + </CallHierarchyLabelProvider> + <CallHierarchyContentProvider + class="org.eclipse.cdt.ui.tests.callhierarchy.extension.CHContentProvider" + id="org.eclipse.cdt.ui.tests.callhierarchy.extension.CHContentProvider"> + </CallHierarchyContentProvider> + </extension> + + + + + + + + + + + [Enter API information here.] + + + + + + + + + [Enter information about supplied implementation of this extension point.] + + + + + diff --git a/core/org.eclipse.cdt.ui/schema/newToolChainWizards.exsd b/core/org.eclipse.cdt.ui/schema/newToolChainWizards.exsd index c316643ab07..4ca38d8ac34 100644 --- a/core/org.eclipse.cdt.ui/schema/newToolChainWizards.exsd +++ b/core/org.eclipse.cdt.ui/schema/newToolChainWizards.exsd @@ -1,129 +1,129 @@ - - - - - - - - - [Enter description of this extension point.] - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - [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.] - - - - - + + + + + + + + + [Enter description of this extension point.] + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + [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/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/ImageCombo.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/ImageCombo.java index e4f308de5f7..18a52ee082d 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/ImageCombo.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/ImageCombo.java @@ -1,1502 +1,1502 @@ -/******************************************************************************* - * Copyright (c) 2000, 2015 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 Corporation - initial API and implementation - * Tom Seidel - enhancements for image-handling +/******************************************************************************* + * Copyright (c) 2000, 2015 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 Corporation - initial API and implementation + * Tom Seidel - enhancements for image-handling *******************************************************************************/ -package org.eclipse.cdt.internal.ui; - -import java.util.Arrays; - -import org.eclipse.swt.SWT; -import org.eclipse.swt.SWTException; -import org.eclipse.swt.accessibility.ACC; -import org.eclipse.swt.accessibility.AccessibleAdapter; -import org.eclipse.swt.accessibility.AccessibleControlAdapter; -import org.eclipse.swt.accessibility.AccessibleControlEvent; -import org.eclipse.swt.accessibility.AccessibleEvent; -import org.eclipse.swt.accessibility.AccessibleTextAdapter; -import org.eclipse.swt.accessibility.AccessibleTextEvent; -import org.eclipse.swt.events.ModifyListener; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.events.SelectionListener; -import org.eclipse.swt.graphics.Color; -import org.eclipse.swt.graphics.Font; -import org.eclipse.swt.graphics.GC; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.graphics.Point; -import org.eclipse.swt.graphics.Rectangle; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Event; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Layout; -import org.eclipse.swt.widgets.Listener; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.swt.widgets.Table; -import org.eclipse.swt.widgets.TableItem; -import org.eclipse.swt.widgets.Text; -import org.eclipse.swt.widgets.TypedListener; -import org.eclipse.swt.widgets.Widget; - -/** - * The ImageCombo class represents a selectable user interface object - * that combines a text field and a table and issues notification - * when an item is selected from the table. - *

- * Note that although this class is a subclass of Composite, - * it does not make sense to add children to it, or set a layout on it. - *

- *
- *
Styles: - *
BORDER, READ_ONLY, FLAT
- *
Events: - *
Selection
- *
- */ -public final class ImageCombo extends Composite { - - Text text; - Table table; - int visibleItemCount = 5; - Shell popup; - Button arrow; - boolean hasFocus; - Listener listener, filter; - Color foreground, background; - Font font; - -/** - * Constructs a new instance of this class given its parent - * and a style value describing its behavior and appearance. - *

- * The style value is either one of the style constants defined in - * class SWT which is applicable to instances of this - * class, or must be built by bitwise OR'ing together - * (that is, using the int "|" operator) two or more - * of those SWT style constants. The class description - * lists the style constants that are applicable to the class. - * Style bits are also inherited from superclasses. - *

- * - * @param parent a widget which will be the parent of the new instance (cannot be null) - * @param style the style of widget to construct - * - * @exception IllegalArgumentException
    - *
  • ERROR_NULL_ARGUMENT - if the parent is null
  • - *
- * @exception SWTException
    - *
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent
  • - *
- * - * @see SWT#BORDER - * @see SWT#READ_ONLY - * @see SWT#FLAT - * @see Widget#getStyle() - */ -public ImageCombo (Composite parent, int style) { - super (parent, style = checkStyle (style)); - - int textStyle = SWT.SINGLE; - if ((style & SWT.READ_ONLY) != 0) textStyle |= SWT.READ_ONLY; - if ((style & SWT.FLAT) != 0) textStyle |= SWT.FLAT; - text = new Text (this, SWT.NONE); - int arrowStyle = SWT.ARROW | SWT.DOWN; - if ((style & SWT.FLAT) != 0) arrowStyle |= SWT.FLAT; - arrow = new Button (this, arrowStyle); - - listener = new Listener () { - @Override - public void handleEvent (Event event) { - if (popup == event.widget) { - popupEvent (event); - return; - } - if (text == event.widget) { - textEvent (event); - return; - } - if (table == event.widget) { - listEvent (event); - return; - } - if (arrow == event.widget) { - arrowEvent (event); - return; - } - if (ImageCombo.this == event.widget) { - comboEvent (event); - return; - } - if (getShell () == event.widget) { - handleFocus (SWT.FocusOut); - } - } - }; - filter = new Listener() { - @Override - public void handleEvent(Event event) { - Shell shell = ((Control)event.widget).getShell (); - if (shell == ImageCombo.this.getShell ()) { - handleFocus (SWT.FocusOut); - } - } - }; - - int [] comboEvents = {SWT.Dispose, SWT.Move, SWT.Resize}; - for (int i=0; i - *
  • ERROR_NULL_ARGUMENT - if the string is null
  • - * - * @exception SWTException
      - *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • - *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • - *
    - * - * @see #add(String,int) - */ -public void add (String string, Image image) { - checkWidget(); - if (string == null) SWT.error (SWT.ERROR_NULL_ARGUMENT); - TableItem newItem = new TableItem(this.table,SWT.NONE); - newItem.setText(string); - if (image != null) newItem.setImage(image); -} -/** - * Adds the argument to the receiver's list at the given - * zero-relative index. - *

    - * Note: To add an item at the end of the list, use the - * result of calling getItemCount() as the - * index or use add(String). - *

    - * - * @param string the new item - * @param index the index for the item - * - * @exception IllegalArgumentException
      - *
    • ERROR_NULL_ARGUMENT - if the string is null
    • - *
    • ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list (inclusive)
    • - *
    - * @exception SWTException
      - *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • - *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • - *
    - * - * @see #add(String) - */ -public void add (String string,Image image, int index) { - checkWidget(); - if (string == null) SWT.error (SWT.ERROR_NULL_ARGUMENT); - TableItem newItem = new TableItem(this.table,SWT.NONE,index); - if (image != null) newItem.setImage(image); -} -/** - * Adds the listener to the collection of listeners who will - * be notified when the receiver's text is modified, by sending - * it one of the messages defined in the ModifyListener - * interface. - * - * @param listener the listener which should be notified - * - * @exception IllegalArgumentException
      - *
    • ERROR_NULL_ARGUMENT - if the listener is null
    • - *
    - * @exception SWTException
      - *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • - *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • - *
    - * - * @see ModifyListener - * @see #removeModifyListener - */ -public void addModifyListener (ModifyListener listener) { - checkWidget(); - if (listener == null) SWT.error (SWT.ERROR_NULL_ARGUMENT); - TypedListener typedListener = new TypedListener (listener); - addListener (SWT.Modify, typedListener); -} -/** - * Adds the listener to the collection of listeners who will - * be notified when the receiver's selection changes, by sending - * it one of the messages defined in the SelectionListener - * interface. - *

    - * widgetSelected is called when the combo's list selection changes. - * widgetDefaultSelected is typically called when ENTER is pressed the combo's text area. - *

    - * - * @param listener the listener which should be notified - * - * @exception IllegalArgumentException
      - *
    • ERROR_NULL_ARGUMENT - if the listener is null
    • - *
    - * @exception SWTException
      - *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • - *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • - *
    - * - * @see SelectionListener - * @see #removeSelectionListener - * @see SelectionEvent - */ -public void addSelectionListener(SelectionListener listener) { - checkWidget(); - if (listener == null) SWT.error (SWT.ERROR_NULL_ARGUMENT); - TypedListener typedListener = new TypedListener (listener); - addListener (SWT.Selection,typedListener); - addListener (SWT.DefaultSelection,typedListener); -} -void arrowEvent (Event event) { - switch (event.type) { - case SWT.FocusIn: { - handleFocus (SWT.FocusIn); - break; - } - case SWT.Selection: { - dropDown (!isDropped ()); - break; - } - } -} -/** - * Sets the selection in the receiver's text field to an empty - * selection starting just before the first character. If the - * text field is editable, this has the effect of placing the - * i-beam at the start of the text. - *

    - * Note: To clear the selected items in the receiver's list, - * use deselectAll(). - *

    - * - * @exception SWTException
      - *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • - *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • - *
    - * - * @see #deselectAll - */ -public void clearSelection () { - checkWidget (); - text.clearSelection (); - table.deselectAll (); -} -void comboEvent (Event event) { - switch (event.type) { - case SWT.Dispose: - if (popup != null && !popup.isDisposed ()) { - table.removeListener (SWT.Dispose, listener); - popup.dispose (); - } - Shell shell = getShell (); - shell.removeListener (SWT.Deactivate, listener); - Display display = getDisplay (); - display.removeFilter (SWT.FocusIn, filter); - popup = null; - text = null; - table = null; - arrow = null; - break; - case SWT.Move: - dropDown (false); - break; - case SWT.Resize: - internalLayout (false); - break; - } -} - -@Override -public Point computeSize (int wHint, int hHint, boolean changed) { - checkWidget (); - int width = 0, height = 0; - String[] items = getStringsFromTable(); - int textWidth = 0; - GC gc = new GC (text); - int spacer = gc.stringExtent (" ").x; //$NON-NLS-1$ - for (int i = 0; i < items.length; i++) { - textWidth = Math.max (gc.stringExtent (items[i]).x, textWidth); - } - gc.dispose(); - Point textSize = text.computeSize (SWT.DEFAULT, SWT.DEFAULT, changed); - Point arrowSize = arrow.computeSize (SWT.DEFAULT, SWT.DEFAULT, changed); - Point listSize = table.computeSize (wHint, SWT.DEFAULT, changed); - int borderWidth = getBorderWidth (); - - height = Math.max (hHint, Math.max (textSize.y, arrowSize.y) + 2*borderWidth); - width = Math.max (wHint, Math.max (textWidth + 2*spacer + arrowSize.x + 2*borderWidth, listSize.x)); - return new Point (width, height); -} -void createPopup(int selectionIndex) { - // create shell and list - popup = new Shell (getShell (), SWT.NO_TRIM | SWT.ON_TOP); - int style = getStyle (); - int listStyle = SWT.SINGLE | SWT.V_SCROLL; - if ((style & SWT.FLAT) != 0) listStyle |= SWT.FLAT; - if ((style & SWT.RIGHT_TO_LEFT) != 0) listStyle |= SWT.RIGHT_TO_LEFT; - if ((style & SWT.LEFT_TO_RIGHT) != 0) listStyle |= SWT.LEFT_TO_RIGHT; - // create a table instead of a list. - table = new Table (popup, listStyle); - if (font != null) table.setFont (font); - if (foreground != null) table.setForeground (foreground); - if (background != null) table.setBackground (background); - - int [] popupEvents = {SWT.Close, SWT.Paint, SWT.Deactivate}; - for (int i=0; i - *
  • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  • - *
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
  • - * - */ -public void deselect (int index) { - checkWidget (); - table.deselect (index); -} -/** - * Deselects all selected items in the receiver's list. - *

    - * Note: To clear the selection in the receiver's text field, - * use clearSelection(). - *

    - * - * @exception SWTException
      - *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • - *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • - *
    - * - * @see #clearSelection - */ -public void deselectAll () { - checkWidget (); - table.deselectAll (); -} -void dropDown (boolean drop) { - if (drop == isDropped ()) return; - if (!drop) { - popup.setVisible (false); - if (!isDisposed ()&& arrow.isFocusControl()) { - text.setFocus(); - } - return; - } - - if (getShell() != popup.getParent ()) { - TableItem[] items = table.getItems (); - int selectionIndex = table.getSelectionIndex (); - table.removeListener (SWT.Dispose, listener); - popup.dispose(); - popup = null; - table = null; - createPopup (selectionIndex); - } - - Point size = getSize (); - int itemCount = table.getItemCount (); - itemCount = (itemCount == 0) ? visibleItemCount : Math.min(visibleItemCount, itemCount); - int itemHeight = table.getItemHeight () * itemCount; - Point listSize = table.computeSize (SWT.DEFAULT, itemHeight, false); - table.setBounds (1, 1, Math.max (size.x - 2, listSize.x), listSize.y); - - int index = table.getSelectionIndex (); - if (index != -1) table.setTopIndex (index); - Display display = getDisplay (); - Rectangle listRect = table.getBounds (); - Rectangle parentRect = display.map (getParent (), null, getBounds ()); - Point comboSize = getSize (); - Rectangle displayRect = getMonitor ().getClientArea (); - int width = Math.max (comboSize.x, listRect.width + 2); - int height = listRect.height + 2; - int x = parentRect.x; - int y = parentRect.y + comboSize.y; - if (y + height > displayRect.y + displayRect.height) y = parentRect.y - height; - popup.setBounds (x, y, width, height); - popup.setVisible (true); - table.setFocus (); -} -/* - * Return the Label immediately preceding the receiver in the z-order, - * or null if none. - */ -Label getAssociatedLabel () { - Control[] siblings = getParent ().getChildren (); - for (int i = 0; i < siblings.length; i++) { - if (siblings [i] == ImageCombo.this) { - if (i > 0 && siblings [i-1] instanceof Label) { - return (Label) siblings [i-1]; - } - } - } - return null; -} -@Override -public Control [] getChildren () { - checkWidget(); - return new Control [0]; -} -/** - * Gets the editable state. - * - * @return whether or not the reciever is editable - * - * @exception SWTException
      - *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • - *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • - *
    - * - * @since 3.0 - */ -public boolean getEditable () { - checkWidget (); - return text.getEditable(); -} -/** - * Returns the item at the given, zero-relative index in the - * receiver's list. Throws an exception if the index is out - * of range. - * - * @param index the index of the item to return - * @return the item at the given index - * - * @exception IllegalArgumentException
      - *
    • ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list minus 1 (inclusive)
    • - *
    - * @exception SWTException
      - *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • - *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • - *
    - */ -public TableItem getItem (int index) { - checkWidget(); - return this.table.getItem (index); -} -/** - * Returns the number of items contained in the receiver's list. - * - * @return the number of items - * - * @exception SWTException
      - *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • - *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • - *
    - */ -public int getItemCount () { - checkWidget (); - return table.getItemCount (); -} -/** - * Returns the height of the area which would be used to - * display one of the items in the receiver's list. - * - * @return the height of one item - * - * @exception SWTException
      - *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • - *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • - *
    - */ -public int getItemHeight () { - checkWidget (); - return table.getItemHeight (); -} -/** - * Returns an array of Strings which are the items - * in the receiver's list. - *

    - * Note: This is not the actual structure used by the receiver - * to maintain its list of items, so modifying the array will - * not affect the receiver. - *

    - * - * @return the items in the receiver's list - * - * @exception SWTException
      - *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • - *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • - *
    - */ -public TableItem [] getItems () { - checkWidget (); - return table.getItems (); -} -char getMnemonic (String string) { - int index = 0; - int length = string.length (); - do { - while ((index < length) && (string.charAt (index) != '&')) index++; - if (++index >= length) return '\0'; - if (string.charAt (index) != '&') return string.charAt (index); - index++; - } while (index < length); - return '\0'; -} - -String [] getStringsFromTable() -{ - String[] items = new String[this.table.getItems().length]; - for (int i = 0, n = items.length; i < n; i++) { - items[i]=this.table.getItem(i).getText(); - } - return items; -} -/** - * Returns a Point whose x coordinate is the start - * of the selection in the receiver's text field, and whose y - * coordinate is the end of the selection. The returned values - * are zero-relative. An "empty" selection as indicated by - * the the x and y coordinates having the same value. - * - * @return a point representing the selection start and end - * - * @exception SWTException
      - *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • - *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • - *
    - */ -public Point getSelection () { - checkWidget (); - return text.getSelection (); -} -/** - * Returns the zero-relative index of the item which is currently - * selected in the receiver's list, or -1 if no item is selected. - * - * @return the index of the selected item - * - * @exception SWTException
      - *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • - *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • - *
    - */ -public int getSelectionIndex () { - checkWidget (); - return table.getSelectionIndex (); -} -@Override -public int getStyle () { - int style = super.getStyle (); - style &= ~SWT.READ_ONLY; - if (!text.getEditable()) style |= SWT.READ_ONLY; - return style; -} -/** - * Returns a string containing a copy of the contents of the - * receiver's text field. - * - * @return the receiver's text - * - * @exception SWTException
      - *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • - *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • - *
    - */ -public String getText () { - checkWidget (); - return text.getText (); -} -/** - * Returns the height of the receivers's text field. - * - * @return the text height - * - * @exception SWTException
      - *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • - *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • - *
    - */ -public int getTextHeight () { - checkWidget (); - return text.getLineHeight (); -} -/** - * Returns the maximum number of characters that the receiver's - * text field is capable of holding. If this has not been changed - * by setTextLimit(), it will be the constant - * Combo.LIMIT. - * - * @return the text limit - * - * @exception SWTException
      - *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • - *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • - *
    - */ -public int getTextLimit () { - checkWidget (); - return text.getTextLimit (); -} -/** - * Gets the number of items that are visible in the drop - * down portion of the receiver's list. - * - * @return the number of items that are visible - * - * @exception SWTException
      - *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • - *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • - *
    - * - * @since 3.0 - */ -public int getVisibleItemCount () { - checkWidget (); - return visibleItemCount; -} -void handleFocus (int type) { - if (isDisposed ()) return; - switch (type) { - case SWT.FocusIn: { - if (hasFocus) return; - if (getEditable ()) text.selectAll (); - hasFocus = true; - Shell shell = getShell (); - shell.removeListener (SWT.Deactivate, listener); - shell.addListener (SWT.Deactivate, listener); - Display display = getDisplay (); - display.removeFilter (SWT.FocusIn, filter); - display.addFilter (SWT.FocusIn, filter); - Event e = new Event (); - notifyListeners (SWT.FocusIn, e); - break; - } - case SWT.FocusOut: { - if (!hasFocus) return; - Control focusControl = getDisplay ().getFocusControl (); - if (focusControl == arrow || focusControl == table || focusControl == text) return; - hasFocus = false; - Shell shell = getShell (); - shell.removeListener(SWT.Deactivate, listener); - Display display = getDisplay (); - display.removeFilter (SWT.FocusIn, filter); - Event e = new Event (); - notifyListeners (SWT.FocusOut, e); - break; - } - } -} -/** - * Searches the receiver's list starting at the first item - * (index 0) until an item is found that is equal to the - * argument, and returns the index of that item. If no item - * is found, returns -1. - * - * @param string the search item - * @return the index of the item - * - * @exception IllegalArgumentException
      - *
    • ERROR_NULL_ARGUMENT - if the string is null
    • - *
    - * @exception SWTException
      - *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • - *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • - *
    - */ -public int indexOf (String string) { - checkWidget (); - if (string == null) SWT.error (SWT.ERROR_NULL_ARGUMENT); - return Arrays.asList(getStringsFromTable()).indexOf (string); -} - - -void initAccessible() { - AccessibleAdapter accessibleAdapter = new AccessibleAdapter () { - @Override - public void getName (AccessibleEvent e) { - String name = null; - Label label = getAssociatedLabel (); - if (label != null) { - name = stripMnemonic (label.getText()); - } - e.result = name; - } - @Override - public void getKeyboardShortcut(AccessibleEvent e) { - String shortcut = null; - Label label = getAssociatedLabel (); - if (label != null) { - String text = label.getText (); - if (text != null) { - char mnemonic = getMnemonic (text); - if (mnemonic != '\0') { - shortcut = "Alt+"+mnemonic; //$NON-NLS-1$ - } - } - } - e.result = shortcut; - } - @Override - public void getHelp (AccessibleEvent e) { - e.result = getToolTipText (); - } - }; - getAccessible ().addAccessibleListener (accessibleAdapter); - text.getAccessible ().addAccessibleListener (accessibleAdapter); - table.getAccessible ().addAccessibleListener (accessibleAdapter); - - arrow.getAccessible ().addAccessibleListener (new AccessibleAdapter() { - @Override - public void getName (AccessibleEvent e) { - e.result = isDropped () ? SWT.getMessage ("SWT_Close") : SWT.getMessage ("SWT_Open"); //$NON-NLS-1$ //$NON-NLS-2$ - } - @Override - public void getKeyboardShortcut (AccessibleEvent e) { - e.result = "Alt+Down Arrow"; //$NON-NLS-1$ - } - @Override - public void getHelp (AccessibleEvent e) { - e.result = getToolTipText (); - } - }); - - getAccessible().addAccessibleTextListener (new AccessibleTextAdapter() { - @Override - public void getCaretOffset (AccessibleTextEvent e) { - e.offset = text.getCaretPosition (); - } - }); - - getAccessible().addAccessibleControlListener (new AccessibleControlAdapter() { - @Override - public void getChildAtPoint (AccessibleControlEvent e) { - Point testPoint = toControl (e.x, e.y); - if (getBounds ().contains (testPoint)) { - e.childID = ACC.CHILDID_SELF; - } - } - - @Override - public void getLocation (AccessibleControlEvent e) { - Rectangle location = getBounds (); - Point pt = toDisplay (location.x, location.y); - e.x = pt.x; - e.y = pt.y; - e.width = location.width; - e.height = location.height; - } - - @Override - public void getChildCount (AccessibleControlEvent e) { - e.detail = 0; - } - - @Override - public void getRole (AccessibleControlEvent e) { - e.detail = ACC.ROLE_COMBOBOX; - } - - @Override - public void getState (AccessibleControlEvent e) { - e.detail = ACC.STATE_NORMAL; - } - - @Override - public void getValue (AccessibleControlEvent e) { - e.result = getText (); - } - }); - - text.getAccessible ().addAccessibleControlListener (new AccessibleControlAdapter () { - @Override - public void getRole (AccessibleControlEvent e) { - e.detail = text.getEditable () ? ACC.ROLE_TEXT : ACC.ROLE_LABEL; - } - }); - - arrow.getAccessible ().addAccessibleControlListener (new AccessibleControlAdapter() { - @Override - public void getDefaultAction (AccessibleControlEvent e) { - e.result = isDropped () ? SWT.getMessage ("SWT_Close") : SWT.getMessage ("SWT_Open"); //$NON-NLS-1$ //$NON-NLS-2$ - } - }); -} -boolean isDropped () { - return popup.getVisible (); -} -@Override -public boolean isFocusControl () { - checkWidget(); - if (text.isFocusControl () || arrow.isFocusControl () || table.isFocusControl () || popup.isFocusControl ()) { - return true; - } - return super.isFocusControl (); -} -void internalLayout (boolean changed) { - if (isDropped ()) dropDown (false); - Rectangle rect = getClientArea (); - int width = rect.width; - int height = rect.height; - Point arrowSize = arrow.computeSize (SWT.DEFAULT, height, changed); - text.setBounds (0, 0, width - arrowSize.x, height); - arrow.setBounds (width - arrowSize.x, 0, arrowSize.x, arrowSize.y); -} -void listEvent (Event event) { - switch (event.type) { - case SWT.Dispose: - if (getShell () != popup.getParent ()) { - TableItem[] items = table.getItems (); - int selectionIndex = table.getSelectionIndex (); - popup = null; - table = null; - createPopup (selectionIndex); - } - break; - case SWT.FocusIn: { - handleFocus (SWT.FocusIn); - break; - } - case SWT.MouseUp: { - if (event.button != 1) return; - dropDown (false); - break; - } - case SWT.Selection: { - int index = table.getSelectionIndex (); - if (index == -1) return; - text.setText (table.getItem (index).getText()); - text.selectAll (); - table.setSelection (index); - Event e = new Event (); - e.time = event.time; - e.stateMask = event.stateMask; - e.doit = event.doit; - notifyListeners (SWT.Selection, e); - event.doit = e.doit; - break; - } - case SWT.Traverse: { - switch (event.detail) { - case SWT.TRAVERSE_RETURN: - case SWT.TRAVERSE_ESCAPE: - case SWT.TRAVERSE_ARROW_PREVIOUS: - case SWT.TRAVERSE_ARROW_NEXT: - event.doit = false; - break; - } - Event e = new Event (); - e.time = event.time; - e.detail = event.detail; - e.doit = event.doit; - e.character = event.character; - e.keyCode = event.keyCode; - notifyListeners (SWT.Traverse, e); - event.doit = e.doit; - event.detail = e.detail; - break; - } - case SWT.KeyUp: { - Event e = new Event (); - e.time = event.time; - e.character = event.character; - e.keyCode = event.keyCode; - e.stateMask = event.stateMask; - notifyListeners (SWT.KeyUp, e); - break; - } - case SWT.KeyDown: { - if (event.character == SWT.ESC) { - // Escape key cancels popup list - dropDown (false); - } - if ((event.stateMask & SWT.ALT) != 0 && (event.keyCode == SWT.ARROW_UP || event.keyCode == SWT.ARROW_DOWN)) { - dropDown (false); - } - if (event.character == SWT.CR) { - // Enter causes default selection - dropDown (false); - Event e = new Event (); - e.time = event.time; - e.stateMask = event.stateMask; - notifyListeners (SWT.DefaultSelection, e); - } - // At this point the widget may have been disposed. - // If so, do not continue. - if (isDisposed ()) break; - Event e = new Event(); - e.time = event.time; - e.character = event.character; - e.keyCode = event.keyCode; - e.stateMask = event.stateMask; - notifyListeners(SWT.KeyDown, e); - break; - - } - } -} - -void popupEvent(Event event) { - switch (event.type) { - case SWT.Paint: - // draw black rectangle around list - Rectangle listRect = table.getBounds(); - Color black = getDisplay().getSystemColor(SWT.COLOR_BLACK); - event.gc.setForeground(black); - event.gc.drawRectangle(0, 0, listRect.width + 1, listRect.height + 1); - break; - case SWT.Close: - event.doit = false; - dropDown (false); - break; - case SWT.Deactivate: - dropDown (false); - break; - } -} -@Override -public void redraw () { - super.redraw(); - text.redraw(); - arrow.redraw(); - if (popup.isVisible()) table.redraw(); -} -@Override -public void redraw (int x, int y, int width, int height, boolean all) { - super.redraw(x, y, width, height, true); -} - -/** - * Removes the item from the receiver's list at the given - * zero-relative index. - * - * @param index the index for the item - * - * @exception IllegalArgumentException
      - *
    • ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list minus 1 (inclusive)
    • - *
    - * @exception SWTException
      - *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • - *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • - *
    - */ -public void remove (int index) { - checkWidget(); - table.remove (index); -} -/** - * Removes the items from the receiver's list which are - * between the given zero-relative start and end - * indices (inclusive). - * - * @param start the start of the range - * @param end the end of the range - * - * @exception IllegalArgumentException
      - *
    • ERROR_INVALID_RANGE - if either the start or end are not between 0 and the number of elements in the list minus 1 (inclusive)
    • - *
    - * @exception SWTException
      - *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • - *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • - *
    - */ -public void remove (int start, int end) { - checkWidget(); - table.remove (start, end); -} -/** - * Searches the receiver's list starting at the first item - * until an item is found that is equal to the argument, - * and removes that item from the list. - * - * @param string the item to remove - * - * @exception IllegalArgumentException
      - *
    • ERROR_NULL_ARGUMENT - if the string is null
    • - *
    • ERROR_INVALID_ARGUMENT - if the string is not found in the list
    • - *
    - * @exception SWTException
      - *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • - *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • - *
    - */ -public void remove (String string) { - checkWidget(); - if (string == null) SWT.error (SWT.ERROR_NULL_ARGUMENT); - int index = -1; - for (int i = 0, n = table.getItemCount(); i < n; i++) { - if (table.getItem(i).getText().equals(string)) { - index = i; - break; - } - } - remove(index); -} -/** - * Removes all of the items from the receiver's list and clear the - * contents of receiver's text field. - *

    - * @exception SWTException

      - *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • - *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • - *
    - */ -public void removeAll () { - checkWidget(); - text.setText (""); //$NON-NLS-1$ - table.removeAll (); -} -/** - * Removes the listener from the collection of listeners who will - * be notified when the receiver's text is modified. - * - * @param listener the listener which should no longer be notified - * - * @exception IllegalArgumentException
      - *
    • ERROR_NULL_ARGUMENT - if the listener is null
    • - *
    - * @exception SWTException
      - *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • - *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • - *
    - * - * @see ModifyListener - * @see #addModifyListener - */ -public void removeModifyListener (ModifyListener listener) { - checkWidget(); - if (listener == null) SWT.error (SWT.ERROR_NULL_ARGUMENT); - removeListener(SWT.Modify, listener); -} -/** - * Removes the listener from the collection of listeners who will - * be notified when the receiver's selection changes. - * - * @param listener the listener which should no longer be notified - * - * @exception IllegalArgumentException
      - *
    • ERROR_NULL_ARGUMENT - if the listener is null
    • - *
    - * @exception SWTException
      - *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • - *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • - *
    - * - * @see SelectionListener - * @see #addSelectionListener - */ -public void removeSelectionListener (SelectionListener listener) { - checkWidget(); - if (listener == null) SWT.error (SWT.ERROR_NULL_ARGUMENT); - removeListener(SWT.Selection, listener); - removeListener(SWT.DefaultSelection,listener); -} -/** - * Selects the item at the given zero-relative index in the receiver's - * list. If the item at the index was already selected, it remains - * selected. Indices that are out of range are ignored. - * - * @param index the index of the item to select - * - * @exception SWTException
      - *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • - *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • - *
    - */ -public void select (int index) { - checkWidget(); - if (index == -1) { - table.deselectAll (); - text.setText (""); //$NON-NLS-1$ - return; - } - if (0 <= index && index < table.getItemCount()) { - if (index != getSelectionIndex()) { - text.setText (table.getItem (index).getText()); - text.selectAll (); - table.select (index); - table.showSelection (); - } - } -} -@Override -public void setBackground (Color color) { - super.setBackground(color); - background = color; - if (text != null) text.setBackground(color); - if (table != null) table.setBackground(color); - if (arrow != null) arrow.setBackground(color); -} -/** - * Sets the editable state. - * - * @param editable the new editable state - * - * @exception SWTException
      - *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • - *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • - *
    - * - * @since 3.0 - */ -public void setEditable (boolean editable) { - checkWidget (); - text.setEditable(editable); -} -@Override -public void setEnabled (boolean enabled) { - super.setEnabled(enabled); - if (popup != null) popup.setVisible (false); - if (text != null) text.setEnabled(enabled); - if (arrow != null) arrow.setEnabled(enabled); -} -@Override -public boolean setFocus () { - checkWidget(); - return text.setFocus (); -} -@Override -public void setFont (Font font) { - super.setFont (font); - this.font = font; - text.setFont (font); - table.setFont (font); - internalLayout (true); -} -@Override -public void setForeground (Color color) { - super.setForeground(color); - foreground = color; - if (text != null) text.setForeground(color); - if (table != null) table.setForeground(color); - if (arrow != null) arrow.setForeground(color); -} -/** - * Sets the text of the item in the receiver's list at the given - * zero-relative index to the string argument. This is equivalent - * to remove'ing the old item at the index, and then - * add'ing the new item at that index. - * - * @param index the index for the item - * @param string the new text for the item - * - * @exception IllegalArgumentException
      - *
    • ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list minus 1 (inclusive)
    • - *
    • ERROR_NULL_ARGUMENT - if the string is null
    • - *
    - * @exception SWTException
      - *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • - *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • - *
    - */ -public void setItem (int index, String string, Image image) { - checkWidget(); - remove(index); - add(string,image,index); -} -/** - * Sets the receiver's list to be the given array of items. - * - * @param items the array of items - * - * @exception IllegalArgumentException
      - *
    • ERROR_NULL_ARGUMENT - if the items array is null
    • - *
    • ERROR_INVALID_ARGUMENT - if an item in the items array is null
    • - *
    - * @exception SWTException
      - *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • - *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • - *
    - */ -public void setItems (String [] items) { - checkWidget (); - this.table.removeAll(); - for (int i = 0, n = items.length; i < n; i++) { - add(items[i],null); - } - if (!text.getEditable ()) text.setText (""); //$NON-NLS-1$ -} - -/** - * Sets the layout which is associated with the receiver to be - * the argument which may be null. - *

    - * Note : No Layout can be set on this Control because it already - * manages the size and position of its children. - *

    - * - * @param layout the receiver's new layout or null - * - * @exception SWTException
      - *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • - *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • - *
    - */ -@Override -public void setLayout (Layout layout) { - checkWidget (); - return; -} -/** - * Sets the selection in the receiver's text field to the - * range specified by the argument whose x coordinate is the - * start of the selection and whose y coordinate is the end - * of the selection. - * - * @param selection a point representing the new selection start and end - * - * @exception IllegalArgumentException
      - *
    • ERROR_NULL_ARGUMENT - if the point is null
    • - *
    - * @exception SWTException
      - *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • - *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • - *
    - */ -public void setSelection (Point selection) { - checkWidget(); - if (selection == null) SWT.error (SWT.ERROR_NULL_ARGUMENT); - text.setSelection (selection.x, selection.y); -} - -/** - * Sets the contents of the receiver's text field to the - * given string. - *

    - * Note: The text field in a Combo is typically - * only capable of displaying a single line of text. Thus, - * setting the text to a string containing line breaks or - * other special characters will probably cause it to - * display incorrectly. - *

    - * - * @param string the new text - * - * @exception IllegalArgumentException
      - *
    • ERROR_NULL_ARGUMENT - if the string is null
    • - *
    - * @exception SWTException
      - *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • - *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • - *
    - */ -public void setText (String string) { - checkWidget(); - if (string == null) SWT.error (SWT.ERROR_NULL_ARGUMENT); - int index = -1; - for (int i = 0, n = table.getItemCount(); i < n; i++) { - if (table.getItem(i).getText().equals(string)) { - index = i; - break; - } - } - if (index == -1) { - table.deselectAll (); - text.setText (string); - return; - } - text.setText (string); - text.selectAll (); - table.setSelection (index); - table.showSelection (); -} -/** - * Sets the maximum number of characters that the receiver's - * text field is capable of holding to be the argument. - * - * @param limit new text limit - * - * @exception IllegalArgumentException
      - *
    • ERROR_CANNOT_BE_ZERO - if the limit is zero
    • - *
    - * @exception SWTException
      - *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • - *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • - *
    - */ -public void setTextLimit (int limit) { - checkWidget(); - text.setTextLimit (limit); -} - -@Override -public void setToolTipText (String string) { - checkWidget(); - super.setToolTipText(string); - arrow.setToolTipText (string); - text.setToolTipText (string); -} - -@Override -public void setVisible (boolean visible) { - super.setVisible(visible); - if (!visible) popup.setVisible(false); -} -/** - * Sets the number of items that are visible in the drop - * down portion of the receiver's list. - * - * @param count the new number of items to be visible - * - * @exception SWTException
      - *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • - *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • - *
    - * - * @since 3.0 - */ -public void setVisibleItemCount (int count) { - checkWidget (); - if (count < 0) return; - visibleItemCount = count; -} -String stripMnemonic (String string) { - int index = 0; - int length = string.length (); - do { - while ((index < length) && (string.charAt (index) != '&')) index++; - if (++index >= length) return string; - if (string.charAt (index) != '&') { - return string.substring(0, index-1) + string.substring(index, length); - } - index++; - } while (index < length); - return string; -} -void textEvent (Event event) { - switch (event.type) { - case SWT.FocusIn: { - handleFocus (SWT.FocusIn); - break; - } - case SWT.KeyDown: { - if (event.character == SWT.CR) { - dropDown (false); - Event e = new Event (); - e.time = event.time; - e.stateMask = event.stateMask; - notifyListeners (SWT.DefaultSelection, e); - } - //At this point the widget may have been disposed. - // If so, do not continue. - if (isDisposed ()) break; - - if (event.keyCode == SWT.ARROW_UP || event.keyCode == SWT.ARROW_DOWN) { - event.doit = false; - if ((event.stateMask & SWT.ALT) != 0) { - boolean dropped = isDropped (); - text.selectAll (); - if (!dropped) setFocus (); - dropDown (!dropped); - break; - } - - int oldIndex = getSelectionIndex (); - if (event.keyCode == SWT.ARROW_UP) { - select (Math.max (oldIndex - 1, 0)); - } else { - select (Math.min (oldIndex + 1, getItemCount () - 1)); - } - if (oldIndex != getSelectionIndex ()) { - Event e = new Event(); - e.time = event.time; - e.stateMask = event.stateMask; - notifyListeners (SWT.Selection, e); - } - //At this point the widget may have been disposed. - // If so, do not continue. - if (isDisposed ()) break; - } - - // Further work : Need to add support for incremental search in - // pop up list as characters typed in text widget - - Event e = new Event (); - e.time = event.time; - e.character = event.character; - e.keyCode = event.keyCode; - e.stateMask = event.stateMask; - notifyListeners (SWT.KeyDown, e); - break; - } - case SWT.KeyUp: { - Event e = new Event (); - e.time = event.time; - e.character = event.character; - e.keyCode = event.keyCode; - e.stateMask = event.stateMask; - notifyListeners (SWT.KeyUp, e); - break; - } - case SWT.Modify: { - table.deselectAll (); - Event e = new Event (); - e.time = event.time; - notifyListeners (SWT.Modify, e); - break; - } - case SWT.MouseDown: { - if (event.button != 1) return; - if (text.getEditable ()) return; - boolean dropped = isDropped (); - text.selectAll (); - if (!dropped) setFocus (); - dropDown (!dropped); - break; - } - case SWT.MouseUp: { - if (event.button != 1) return; - if (text.getEditable ()) return; - text.selectAll (); - break; - } - case SWT.Traverse: { - switch (event.detail) { - case SWT.TRAVERSE_RETURN: - case SWT.TRAVERSE_ARROW_PREVIOUS: - case SWT.TRAVERSE_ARROW_NEXT: - // The enter causes default selection and - // the arrow keys are used to manipulate the list contents so - // do not use them for traversal. - event.doit = false; - break; - } - - Event e = new Event (); - e.time = event.time; - e.detail = event.detail; - e.doit = event.doit; - e.character = event.character; - e.keyCode = event.keyCode; - notifyListeners (SWT.Traverse, e); - event.doit = e.doit; - event.detail = e.detail; - break; - } - } -} -} +package org.eclipse.cdt.internal.ui; + +import java.util.Arrays; + +import org.eclipse.swt.SWT; +import org.eclipse.swt.SWTException; +import org.eclipse.swt.accessibility.ACC; +import org.eclipse.swt.accessibility.AccessibleAdapter; +import org.eclipse.swt.accessibility.AccessibleControlAdapter; +import org.eclipse.swt.accessibility.AccessibleControlEvent; +import org.eclipse.swt.accessibility.AccessibleEvent; +import org.eclipse.swt.accessibility.AccessibleTextAdapter; +import org.eclipse.swt.accessibility.AccessibleTextEvent; +import org.eclipse.swt.events.ModifyListener; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.events.SelectionListener; +import org.eclipse.swt.graphics.Color; +import org.eclipse.swt.graphics.Font; +import org.eclipse.swt.graphics.GC; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.graphics.Point; +import org.eclipse.swt.graphics.Rectangle; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Event; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Layout; +import org.eclipse.swt.widgets.Listener; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.swt.widgets.Table; +import org.eclipse.swt.widgets.TableItem; +import org.eclipse.swt.widgets.Text; +import org.eclipse.swt.widgets.TypedListener; +import org.eclipse.swt.widgets.Widget; + +/** + * The ImageCombo class represents a selectable user interface object + * that combines a text field and a table and issues notification + * when an item is selected from the table. + *

    + * Note that although this class is a subclass of Composite, + * it does not make sense to add children to it, or set a layout on it. + *

    + *
    + *
    Styles: + *
    BORDER, READ_ONLY, FLAT
    + *
    Events: + *
    Selection
    + *
    + */ +public final class ImageCombo extends Composite { + + Text text; + Table table; + int visibleItemCount = 5; + Shell popup; + Button arrow; + boolean hasFocus; + Listener listener, filter; + Color foreground, background; + Font font; + +/** + * Constructs a new instance of this class given its parent + * and a style value describing its behavior and appearance. + *

    + * The style value is either one of the style constants defined in + * class SWT which is applicable to instances of this + * class, or must be built by bitwise OR'ing together + * (that is, using the int "|" operator) two or more + * of those SWT style constants. The class description + * lists the style constants that are applicable to the class. + * Style bits are also inherited from superclasses. + *

    + * + * @param parent a widget which will be the parent of the new instance (cannot be null) + * @param style the style of widget to construct + * + * @exception IllegalArgumentException
      + *
    • ERROR_NULL_ARGUMENT - if the parent is null
    • + *
    + * @exception SWTException
      + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the parent
    • + *
    + * + * @see SWT#BORDER + * @see SWT#READ_ONLY + * @see SWT#FLAT + * @see Widget#getStyle() + */ +public ImageCombo (Composite parent, int style) { + super (parent, style = checkStyle (style)); + + int textStyle = SWT.SINGLE; + if ((style & SWT.READ_ONLY) != 0) textStyle |= SWT.READ_ONLY; + if ((style & SWT.FLAT) != 0) textStyle |= SWT.FLAT; + text = new Text (this, SWT.NONE); + int arrowStyle = SWT.ARROW | SWT.DOWN; + if ((style & SWT.FLAT) != 0) arrowStyle |= SWT.FLAT; + arrow = new Button (this, arrowStyle); + + listener = new Listener () { + @Override + public void handleEvent (Event event) { + if (popup == event.widget) { + popupEvent (event); + return; + } + if (text == event.widget) { + textEvent (event); + return; + } + if (table == event.widget) { + listEvent (event); + return; + } + if (arrow == event.widget) { + arrowEvent (event); + return; + } + if (ImageCombo.this == event.widget) { + comboEvent (event); + return; + } + if (getShell () == event.widget) { + handleFocus (SWT.FocusOut); + } + } + }; + filter = new Listener() { + @Override + public void handleEvent(Event event) { + Shell shell = ((Control)event.widget).getShell (); + if (shell == ImageCombo.this.getShell ()) { + handleFocus (SWT.FocusOut); + } + } + }; + + int [] comboEvents = {SWT.Dispose, SWT.Move, SWT.Resize}; + for (int i=0; i + *
  • ERROR_NULL_ARGUMENT - if the string is null
  • + * + * @exception SWTException
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • + *
    + * + * @see #add(String,int) + */ +public void add (String string, Image image) { + checkWidget(); + if (string == null) SWT.error (SWT.ERROR_NULL_ARGUMENT); + TableItem newItem = new TableItem(this.table,SWT.NONE); + newItem.setText(string); + if (image != null) newItem.setImage(image); +} +/** + * Adds the argument to the receiver's list at the given + * zero-relative index. + *

    + * Note: To add an item at the end of the list, use the + * result of calling getItemCount() as the + * index or use add(String). + *

    + * + * @param string the new item + * @param index the index for the item + * + * @exception IllegalArgumentException
      + *
    • ERROR_NULL_ARGUMENT - if the string is null
    • + *
    • ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list (inclusive)
    • + *
    + * @exception SWTException
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • + *
    + * + * @see #add(String) + */ +public void add (String string,Image image, int index) { + checkWidget(); + if (string == null) SWT.error (SWT.ERROR_NULL_ARGUMENT); + TableItem newItem = new TableItem(this.table,SWT.NONE,index); + if (image != null) newItem.setImage(image); +} +/** + * Adds the listener to the collection of listeners who will + * be notified when the receiver's text is modified, by sending + * it one of the messages defined in the ModifyListener + * interface. + * + * @param listener the listener which should be notified + * + * @exception IllegalArgumentException
      + *
    • ERROR_NULL_ARGUMENT - if the listener is null
    • + *
    + * @exception SWTException
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • + *
    + * + * @see ModifyListener + * @see #removeModifyListener + */ +public void addModifyListener (ModifyListener listener) { + checkWidget(); + if (listener == null) SWT.error (SWT.ERROR_NULL_ARGUMENT); + TypedListener typedListener = new TypedListener (listener); + addListener (SWT.Modify, typedListener); +} +/** + * Adds the listener to the collection of listeners who will + * be notified when the receiver's selection changes, by sending + * it one of the messages defined in the SelectionListener + * interface. + *

    + * widgetSelected is called when the combo's list selection changes. + * widgetDefaultSelected is typically called when ENTER is pressed the combo's text area. + *

    + * + * @param listener the listener which should be notified + * + * @exception IllegalArgumentException
      + *
    • ERROR_NULL_ARGUMENT - if the listener is null
    • + *
    + * @exception SWTException
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • + *
    + * + * @see SelectionListener + * @see #removeSelectionListener + * @see SelectionEvent + */ +public void addSelectionListener(SelectionListener listener) { + checkWidget(); + if (listener == null) SWT.error (SWT.ERROR_NULL_ARGUMENT); + TypedListener typedListener = new TypedListener (listener); + addListener (SWT.Selection,typedListener); + addListener (SWT.DefaultSelection,typedListener); +} +void arrowEvent (Event event) { + switch (event.type) { + case SWT.FocusIn: { + handleFocus (SWT.FocusIn); + break; + } + case SWT.Selection: { + dropDown (!isDropped ()); + break; + } + } +} +/** + * Sets the selection in the receiver's text field to an empty + * selection starting just before the first character. If the + * text field is editable, this has the effect of placing the + * i-beam at the start of the text. + *

    + * Note: To clear the selected items in the receiver's list, + * use deselectAll(). + *

    + * + * @exception SWTException
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • + *
    + * + * @see #deselectAll + */ +public void clearSelection () { + checkWidget (); + text.clearSelection (); + table.deselectAll (); +} +void comboEvent (Event event) { + switch (event.type) { + case SWT.Dispose: + if (popup != null && !popup.isDisposed ()) { + table.removeListener (SWT.Dispose, listener); + popup.dispose (); + } + Shell shell = getShell (); + shell.removeListener (SWT.Deactivate, listener); + Display display = getDisplay (); + display.removeFilter (SWT.FocusIn, filter); + popup = null; + text = null; + table = null; + arrow = null; + break; + case SWT.Move: + dropDown (false); + break; + case SWT.Resize: + internalLayout (false); + break; + } +} + +@Override +public Point computeSize (int wHint, int hHint, boolean changed) { + checkWidget (); + int width = 0, height = 0; + String[] items = getStringsFromTable(); + int textWidth = 0; + GC gc = new GC (text); + int spacer = gc.stringExtent (" ").x; //$NON-NLS-1$ + for (int i = 0; i < items.length; i++) { + textWidth = Math.max (gc.stringExtent (items[i]).x, textWidth); + } + gc.dispose(); + Point textSize = text.computeSize (SWT.DEFAULT, SWT.DEFAULT, changed); + Point arrowSize = arrow.computeSize (SWT.DEFAULT, SWT.DEFAULT, changed); + Point listSize = table.computeSize (wHint, SWT.DEFAULT, changed); + int borderWidth = getBorderWidth (); + + height = Math.max (hHint, Math.max (textSize.y, arrowSize.y) + 2*borderWidth); + width = Math.max (wHint, Math.max (textWidth + 2*spacer + arrowSize.x + 2*borderWidth, listSize.x)); + return new Point (width, height); +} +void createPopup(int selectionIndex) { + // create shell and list + popup = new Shell (getShell (), SWT.NO_TRIM | SWT.ON_TOP); + int style = getStyle (); + int listStyle = SWT.SINGLE | SWT.V_SCROLL; + if ((style & SWT.FLAT) != 0) listStyle |= SWT.FLAT; + if ((style & SWT.RIGHT_TO_LEFT) != 0) listStyle |= SWT.RIGHT_TO_LEFT; + if ((style & SWT.LEFT_TO_RIGHT) != 0) listStyle |= SWT.LEFT_TO_RIGHT; + // create a table instead of a list. + table = new Table (popup, listStyle); + if (font != null) table.setFont (font); + if (foreground != null) table.setForeground (foreground); + if (background != null) table.setBackground (background); + + int [] popupEvents = {SWT.Close, SWT.Paint, SWT.Deactivate}; + for (int i=0; i + *
  • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  • + *
  • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
  • + * + */ +public void deselect (int index) { + checkWidget (); + table.deselect (index); +} +/** + * Deselects all selected items in the receiver's list. + *

    + * Note: To clear the selection in the receiver's text field, + * use clearSelection(). + *

    + * + * @exception SWTException
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • + *
    + * + * @see #clearSelection + */ +public void deselectAll () { + checkWidget (); + table.deselectAll (); +} +void dropDown (boolean drop) { + if (drop == isDropped ()) return; + if (!drop) { + popup.setVisible (false); + if (!isDisposed ()&& arrow.isFocusControl()) { + text.setFocus(); + } + return; + } + + if (getShell() != popup.getParent ()) { + TableItem[] items = table.getItems (); + int selectionIndex = table.getSelectionIndex (); + table.removeListener (SWT.Dispose, listener); + popup.dispose(); + popup = null; + table = null; + createPopup (selectionIndex); + } + + Point size = getSize (); + int itemCount = table.getItemCount (); + itemCount = (itemCount == 0) ? visibleItemCount : Math.min(visibleItemCount, itemCount); + int itemHeight = table.getItemHeight () * itemCount; + Point listSize = table.computeSize (SWT.DEFAULT, itemHeight, false); + table.setBounds (1, 1, Math.max (size.x - 2, listSize.x), listSize.y); + + int index = table.getSelectionIndex (); + if (index != -1) table.setTopIndex (index); + Display display = getDisplay (); + Rectangle listRect = table.getBounds (); + Rectangle parentRect = display.map (getParent (), null, getBounds ()); + Point comboSize = getSize (); + Rectangle displayRect = getMonitor ().getClientArea (); + int width = Math.max (comboSize.x, listRect.width + 2); + int height = listRect.height + 2; + int x = parentRect.x; + int y = parentRect.y + comboSize.y; + if (y + height > displayRect.y + displayRect.height) y = parentRect.y - height; + popup.setBounds (x, y, width, height); + popup.setVisible (true); + table.setFocus (); +} +/* + * Return the Label immediately preceding the receiver in the z-order, + * or null if none. + */ +Label getAssociatedLabel () { + Control[] siblings = getParent ().getChildren (); + for (int i = 0; i < siblings.length; i++) { + if (siblings [i] == ImageCombo.this) { + if (i > 0 && siblings [i-1] instanceof Label) { + return (Label) siblings [i-1]; + } + } + } + return null; +} +@Override +public Control [] getChildren () { + checkWidget(); + return new Control [0]; +} +/** + * Gets the editable state. + * + * @return whether or not the reciever is editable + * + * @exception SWTException
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • + *
    + * + * @since 3.0 + */ +public boolean getEditable () { + checkWidget (); + return text.getEditable(); +} +/** + * Returns the item at the given, zero-relative index in the + * receiver's list. Throws an exception if the index is out + * of range. + * + * @param index the index of the item to return + * @return the item at the given index + * + * @exception IllegalArgumentException
      + *
    • ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list minus 1 (inclusive)
    • + *
    + * @exception SWTException
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • + *
    + */ +public TableItem getItem (int index) { + checkWidget(); + return this.table.getItem (index); +} +/** + * Returns the number of items contained in the receiver's list. + * + * @return the number of items + * + * @exception SWTException
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • + *
    + */ +public int getItemCount () { + checkWidget (); + return table.getItemCount (); +} +/** + * Returns the height of the area which would be used to + * display one of the items in the receiver's list. + * + * @return the height of one item + * + * @exception SWTException
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • + *
    + */ +public int getItemHeight () { + checkWidget (); + return table.getItemHeight (); +} +/** + * Returns an array of Strings which are the items + * in the receiver's list. + *

    + * Note: This is not the actual structure used by the receiver + * to maintain its list of items, so modifying the array will + * not affect the receiver. + *

    + * + * @return the items in the receiver's list + * + * @exception SWTException
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • + *
    + */ +public TableItem [] getItems () { + checkWidget (); + return table.getItems (); +} +char getMnemonic (String string) { + int index = 0; + int length = string.length (); + do { + while ((index < length) && (string.charAt (index) != '&')) index++; + if (++index >= length) return '\0'; + if (string.charAt (index) != '&') return string.charAt (index); + index++; + } while (index < length); + return '\0'; +} + +String [] getStringsFromTable() +{ + String[] items = new String[this.table.getItems().length]; + for (int i = 0, n = items.length; i < n; i++) { + items[i]=this.table.getItem(i).getText(); + } + return items; +} +/** + * Returns a Point whose x coordinate is the start + * of the selection in the receiver's text field, and whose y + * coordinate is the end of the selection. The returned values + * are zero-relative. An "empty" selection as indicated by + * the the x and y coordinates having the same value. + * + * @return a point representing the selection start and end + * + * @exception SWTException
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • + *
    + */ +public Point getSelection () { + checkWidget (); + return text.getSelection (); +} +/** + * Returns the zero-relative index of the item which is currently + * selected in the receiver's list, or -1 if no item is selected. + * + * @return the index of the selected item + * + * @exception SWTException
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • + *
    + */ +public int getSelectionIndex () { + checkWidget (); + return table.getSelectionIndex (); +} +@Override +public int getStyle () { + int style = super.getStyle (); + style &= ~SWT.READ_ONLY; + if (!text.getEditable()) style |= SWT.READ_ONLY; + return style; +} +/** + * Returns a string containing a copy of the contents of the + * receiver's text field. + * + * @return the receiver's text + * + * @exception SWTException
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • + *
    + */ +public String getText () { + checkWidget (); + return text.getText (); +} +/** + * Returns the height of the receivers's text field. + * + * @return the text height + * + * @exception SWTException
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • + *
    + */ +public int getTextHeight () { + checkWidget (); + return text.getLineHeight (); +} +/** + * Returns the maximum number of characters that the receiver's + * text field is capable of holding. If this has not been changed + * by setTextLimit(), it will be the constant + * Combo.LIMIT. + * + * @return the text limit + * + * @exception SWTException
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • + *
    + */ +public int getTextLimit () { + checkWidget (); + return text.getTextLimit (); +} +/** + * Gets the number of items that are visible in the drop + * down portion of the receiver's list. + * + * @return the number of items that are visible + * + * @exception SWTException
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • + *
    + * + * @since 3.0 + */ +public int getVisibleItemCount () { + checkWidget (); + return visibleItemCount; +} +void handleFocus (int type) { + if (isDisposed ()) return; + switch (type) { + case SWT.FocusIn: { + if (hasFocus) return; + if (getEditable ()) text.selectAll (); + hasFocus = true; + Shell shell = getShell (); + shell.removeListener (SWT.Deactivate, listener); + shell.addListener (SWT.Deactivate, listener); + Display display = getDisplay (); + display.removeFilter (SWT.FocusIn, filter); + display.addFilter (SWT.FocusIn, filter); + Event e = new Event (); + notifyListeners (SWT.FocusIn, e); + break; + } + case SWT.FocusOut: { + if (!hasFocus) return; + Control focusControl = getDisplay ().getFocusControl (); + if (focusControl == arrow || focusControl == table || focusControl == text) return; + hasFocus = false; + Shell shell = getShell (); + shell.removeListener(SWT.Deactivate, listener); + Display display = getDisplay (); + display.removeFilter (SWT.FocusIn, filter); + Event e = new Event (); + notifyListeners (SWT.FocusOut, e); + break; + } + } +} +/** + * Searches the receiver's list starting at the first item + * (index 0) until an item is found that is equal to the + * argument, and returns the index of that item. If no item + * is found, returns -1. + * + * @param string the search item + * @return the index of the item + * + * @exception IllegalArgumentException
      + *
    • ERROR_NULL_ARGUMENT - if the string is null
    • + *
    + * @exception SWTException
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • + *
    + */ +public int indexOf (String string) { + checkWidget (); + if (string == null) SWT.error (SWT.ERROR_NULL_ARGUMENT); + return Arrays.asList(getStringsFromTable()).indexOf (string); +} + + +void initAccessible() { + AccessibleAdapter accessibleAdapter = new AccessibleAdapter () { + @Override + public void getName (AccessibleEvent e) { + String name = null; + Label label = getAssociatedLabel (); + if (label != null) { + name = stripMnemonic (label.getText()); + } + e.result = name; + } + @Override + public void getKeyboardShortcut(AccessibleEvent e) { + String shortcut = null; + Label label = getAssociatedLabel (); + if (label != null) { + String text = label.getText (); + if (text != null) { + char mnemonic = getMnemonic (text); + if (mnemonic != '\0') { + shortcut = "Alt+"+mnemonic; //$NON-NLS-1$ + } + } + } + e.result = shortcut; + } + @Override + public void getHelp (AccessibleEvent e) { + e.result = getToolTipText (); + } + }; + getAccessible ().addAccessibleListener (accessibleAdapter); + text.getAccessible ().addAccessibleListener (accessibleAdapter); + table.getAccessible ().addAccessibleListener (accessibleAdapter); + + arrow.getAccessible ().addAccessibleListener (new AccessibleAdapter() { + @Override + public void getName (AccessibleEvent e) { + e.result = isDropped () ? SWT.getMessage ("SWT_Close") : SWT.getMessage ("SWT_Open"); //$NON-NLS-1$ //$NON-NLS-2$ + } + @Override + public void getKeyboardShortcut (AccessibleEvent e) { + e.result = "Alt+Down Arrow"; //$NON-NLS-1$ + } + @Override + public void getHelp (AccessibleEvent e) { + e.result = getToolTipText (); + } + }); + + getAccessible().addAccessibleTextListener (new AccessibleTextAdapter() { + @Override + public void getCaretOffset (AccessibleTextEvent e) { + e.offset = text.getCaretPosition (); + } + }); + + getAccessible().addAccessibleControlListener (new AccessibleControlAdapter() { + @Override + public void getChildAtPoint (AccessibleControlEvent e) { + Point testPoint = toControl (e.x, e.y); + if (getBounds ().contains (testPoint)) { + e.childID = ACC.CHILDID_SELF; + } + } + + @Override + public void getLocation (AccessibleControlEvent e) { + Rectangle location = getBounds (); + Point pt = toDisplay (location.x, location.y); + e.x = pt.x; + e.y = pt.y; + e.width = location.width; + e.height = location.height; + } + + @Override + public void getChildCount (AccessibleControlEvent e) { + e.detail = 0; + } + + @Override + public void getRole (AccessibleControlEvent e) { + e.detail = ACC.ROLE_COMBOBOX; + } + + @Override + public void getState (AccessibleControlEvent e) { + e.detail = ACC.STATE_NORMAL; + } + + @Override + public void getValue (AccessibleControlEvent e) { + e.result = getText (); + } + }); + + text.getAccessible ().addAccessibleControlListener (new AccessibleControlAdapter () { + @Override + public void getRole (AccessibleControlEvent e) { + e.detail = text.getEditable () ? ACC.ROLE_TEXT : ACC.ROLE_LABEL; + } + }); + + arrow.getAccessible ().addAccessibleControlListener (new AccessibleControlAdapter() { + @Override + public void getDefaultAction (AccessibleControlEvent e) { + e.result = isDropped () ? SWT.getMessage ("SWT_Close") : SWT.getMessage ("SWT_Open"); //$NON-NLS-1$ //$NON-NLS-2$ + } + }); +} +boolean isDropped () { + return popup.getVisible (); +} +@Override +public boolean isFocusControl () { + checkWidget(); + if (text.isFocusControl () || arrow.isFocusControl () || table.isFocusControl () || popup.isFocusControl ()) { + return true; + } + return super.isFocusControl (); +} +void internalLayout (boolean changed) { + if (isDropped ()) dropDown (false); + Rectangle rect = getClientArea (); + int width = rect.width; + int height = rect.height; + Point arrowSize = arrow.computeSize (SWT.DEFAULT, height, changed); + text.setBounds (0, 0, width - arrowSize.x, height); + arrow.setBounds (width - arrowSize.x, 0, arrowSize.x, arrowSize.y); +} +void listEvent (Event event) { + switch (event.type) { + case SWT.Dispose: + if (getShell () != popup.getParent ()) { + TableItem[] items = table.getItems (); + int selectionIndex = table.getSelectionIndex (); + popup = null; + table = null; + createPopup (selectionIndex); + } + break; + case SWT.FocusIn: { + handleFocus (SWT.FocusIn); + break; + } + case SWT.MouseUp: { + if (event.button != 1) return; + dropDown (false); + break; + } + case SWT.Selection: { + int index = table.getSelectionIndex (); + if (index == -1) return; + text.setText (table.getItem (index).getText()); + text.selectAll (); + table.setSelection (index); + Event e = new Event (); + e.time = event.time; + e.stateMask = event.stateMask; + e.doit = event.doit; + notifyListeners (SWT.Selection, e); + event.doit = e.doit; + break; + } + case SWT.Traverse: { + switch (event.detail) { + case SWT.TRAVERSE_RETURN: + case SWT.TRAVERSE_ESCAPE: + case SWT.TRAVERSE_ARROW_PREVIOUS: + case SWT.TRAVERSE_ARROW_NEXT: + event.doit = false; + break; + } + Event e = new Event (); + e.time = event.time; + e.detail = event.detail; + e.doit = event.doit; + e.character = event.character; + e.keyCode = event.keyCode; + notifyListeners (SWT.Traverse, e); + event.doit = e.doit; + event.detail = e.detail; + break; + } + case SWT.KeyUp: { + Event e = new Event (); + e.time = event.time; + e.character = event.character; + e.keyCode = event.keyCode; + e.stateMask = event.stateMask; + notifyListeners (SWT.KeyUp, e); + break; + } + case SWT.KeyDown: { + if (event.character == SWT.ESC) { + // Escape key cancels popup list + dropDown (false); + } + if ((event.stateMask & SWT.ALT) != 0 && (event.keyCode == SWT.ARROW_UP || event.keyCode == SWT.ARROW_DOWN)) { + dropDown (false); + } + if (event.character == SWT.CR) { + // Enter causes default selection + dropDown (false); + Event e = new Event (); + e.time = event.time; + e.stateMask = event.stateMask; + notifyListeners (SWT.DefaultSelection, e); + } + // At this point the widget may have been disposed. + // If so, do not continue. + if (isDisposed ()) break; + Event e = new Event(); + e.time = event.time; + e.character = event.character; + e.keyCode = event.keyCode; + e.stateMask = event.stateMask; + notifyListeners(SWT.KeyDown, e); + break; + + } + } +} + +void popupEvent(Event event) { + switch (event.type) { + case SWT.Paint: + // draw black rectangle around list + Rectangle listRect = table.getBounds(); + Color black = getDisplay().getSystemColor(SWT.COLOR_BLACK); + event.gc.setForeground(black); + event.gc.drawRectangle(0, 0, listRect.width + 1, listRect.height + 1); + break; + case SWT.Close: + event.doit = false; + dropDown (false); + break; + case SWT.Deactivate: + dropDown (false); + break; + } +} +@Override +public void redraw () { + super.redraw(); + text.redraw(); + arrow.redraw(); + if (popup.isVisible()) table.redraw(); +} +@Override +public void redraw (int x, int y, int width, int height, boolean all) { + super.redraw(x, y, width, height, true); +} + +/** + * Removes the item from the receiver's list at the given + * zero-relative index. + * + * @param index the index for the item + * + * @exception IllegalArgumentException
      + *
    • ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list minus 1 (inclusive)
    • + *
    + * @exception SWTException
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • + *
    + */ +public void remove (int index) { + checkWidget(); + table.remove (index); +} +/** + * Removes the items from the receiver's list which are + * between the given zero-relative start and end + * indices (inclusive). + * + * @param start the start of the range + * @param end the end of the range + * + * @exception IllegalArgumentException
      + *
    • ERROR_INVALID_RANGE - if either the start or end are not between 0 and the number of elements in the list minus 1 (inclusive)
    • + *
    + * @exception SWTException
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • + *
    + */ +public void remove (int start, int end) { + checkWidget(); + table.remove (start, end); +} +/** + * Searches the receiver's list starting at the first item + * until an item is found that is equal to the argument, + * and removes that item from the list. + * + * @param string the item to remove + * + * @exception IllegalArgumentException
      + *
    • ERROR_NULL_ARGUMENT - if the string is null
    • + *
    • ERROR_INVALID_ARGUMENT - if the string is not found in the list
    • + *
    + * @exception SWTException
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • + *
    + */ +public void remove (String string) { + checkWidget(); + if (string == null) SWT.error (SWT.ERROR_NULL_ARGUMENT); + int index = -1; + for (int i = 0, n = table.getItemCount(); i < n; i++) { + if (table.getItem(i).getText().equals(string)) { + index = i; + break; + } + } + remove(index); +} +/** + * Removes all of the items from the receiver's list and clear the + * contents of receiver's text field. + *

    + * @exception SWTException

      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • + *
    + */ +public void removeAll () { + checkWidget(); + text.setText (""); //$NON-NLS-1$ + table.removeAll (); +} +/** + * Removes the listener from the collection of listeners who will + * be notified when the receiver's text is modified. + * + * @param listener the listener which should no longer be notified + * + * @exception IllegalArgumentException
      + *
    • ERROR_NULL_ARGUMENT - if the listener is null
    • + *
    + * @exception SWTException
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • + *
    + * + * @see ModifyListener + * @see #addModifyListener + */ +public void removeModifyListener (ModifyListener listener) { + checkWidget(); + if (listener == null) SWT.error (SWT.ERROR_NULL_ARGUMENT); + removeListener(SWT.Modify, listener); +} +/** + * Removes the listener from the collection of listeners who will + * be notified when the receiver's selection changes. + * + * @param listener the listener which should no longer be notified + * + * @exception IllegalArgumentException
      + *
    • ERROR_NULL_ARGUMENT - if the listener is null
    • + *
    + * @exception SWTException
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • + *
    + * + * @see SelectionListener + * @see #addSelectionListener + */ +public void removeSelectionListener (SelectionListener listener) { + checkWidget(); + if (listener == null) SWT.error (SWT.ERROR_NULL_ARGUMENT); + removeListener(SWT.Selection, listener); + removeListener(SWT.DefaultSelection,listener); +} +/** + * Selects the item at the given zero-relative index in the receiver's + * list. If the item at the index was already selected, it remains + * selected. Indices that are out of range are ignored. + * + * @param index the index of the item to select + * + * @exception SWTException
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • + *
    + */ +public void select (int index) { + checkWidget(); + if (index == -1) { + table.deselectAll (); + text.setText (""); //$NON-NLS-1$ + return; + } + if (0 <= index && index < table.getItemCount()) { + if (index != getSelectionIndex()) { + text.setText (table.getItem (index).getText()); + text.selectAll (); + table.select (index); + table.showSelection (); + } + } +} +@Override +public void setBackground (Color color) { + super.setBackground(color); + background = color; + if (text != null) text.setBackground(color); + if (table != null) table.setBackground(color); + if (arrow != null) arrow.setBackground(color); +} +/** + * Sets the editable state. + * + * @param editable the new editable state + * + * @exception SWTException
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • + *
    + * + * @since 3.0 + */ +public void setEditable (boolean editable) { + checkWidget (); + text.setEditable(editable); +} +@Override +public void setEnabled (boolean enabled) { + super.setEnabled(enabled); + if (popup != null) popup.setVisible (false); + if (text != null) text.setEnabled(enabled); + if (arrow != null) arrow.setEnabled(enabled); +} +@Override +public boolean setFocus () { + checkWidget(); + return text.setFocus (); +} +@Override +public void setFont (Font font) { + super.setFont (font); + this.font = font; + text.setFont (font); + table.setFont (font); + internalLayout (true); +} +@Override +public void setForeground (Color color) { + super.setForeground(color); + foreground = color; + if (text != null) text.setForeground(color); + if (table != null) table.setForeground(color); + if (arrow != null) arrow.setForeground(color); +} +/** + * Sets the text of the item in the receiver's list at the given + * zero-relative index to the string argument. This is equivalent + * to remove'ing the old item at the index, and then + * add'ing the new item at that index. + * + * @param index the index for the item + * @param string the new text for the item + * + * @exception IllegalArgumentException
      + *
    • ERROR_INVALID_RANGE - if the index is not between 0 and the number of elements in the list minus 1 (inclusive)
    • + *
    • ERROR_NULL_ARGUMENT - if the string is null
    • + *
    + * @exception SWTException
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • + *
    + */ +public void setItem (int index, String string, Image image) { + checkWidget(); + remove(index); + add(string,image,index); +} +/** + * Sets the receiver's list to be the given array of items. + * + * @param items the array of items + * + * @exception IllegalArgumentException
      + *
    • ERROR_NULL_ARGUMENT - if the items array is null
    • + *
    • ERROR_INVALID_ARGUMENT - if an item in the items array is null
    • + *
    + * @exception SWTException
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • + *
    + */ +public void setItems (String [] items) { + checkWidget (); + this.table.removeAll(); + for (int i = 0, n = items.length; i < n; i++) { + add(items[i],null); + } + if (!text.getEditable ()) text.setText (""); //$NON-NLS-1$ +} + +/** + * Sets the layout which is associated with the receiver to be + * the argument which may be null. + *

    + * Note : No Layout can be set on this Control because it already + * manages the size and position of its children. + *

    + * + * @param layout the receiver's new layout or null + * + * @exception SWTException
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • + *
    + */ +@Override +public void setLayout (Layout layout) { + checkWidget (); + return; +} +/** + * Sets the selection in the receiver's text field to the + * range specified by the argument whose x coordinate is the + * start of the selection and whose y coordinate is the end + * of the selection. + * + * @param selection a point representing the new selection start and end + * + * @exception IllegalArgumentException
      + *
    • ERROR_NULL_ARGUMENT - if the point is null
    • + *
    + * @exception SWTException
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • + *
    + */ +public void setSelection (Point selection) { + checkWidget(); + if (selection == null) SWT.error (SWT.ERROR_NULL_ARGUMENT); + text.setSelection (selection.x, selection.y); +} + +/** + * Sets the contents of the receiver's text field to the + * given string. + *

    + * Note: The text field in a Combo is typically + * only capable of displaying a single line of text. Thus, + * setting the text to a string containing line breaks or + * other special characters will probably cause it to + * display incorrectly. + *

    + * + * @param string the new text + * + * @exception IllegalArgumentException
      + *
    • ERROR_NULL_ARGUMENT - if the string is null
    • + *
    + * @exception SWTException
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • + *
    + */ +public void setText (String string) { + checkWidget(); + if (string == null) SWT.error (SWT.ERROR_NULL_ARGUMENT); + int index = -1; + for (int i = 0, n = table.getItemCount(); i < n; i++) { + if (table.getItem(i).getText().equals(string)) { + index = i; + break; + } + } + if (index == -1) { + table.deselectAll (); + text.setText (string); + return; + } + text.setText (string); + text.selectAll (); + table.setSelection (index); + table.showSelection (); +} +/** + * Sets the maximum number of characters that the receiver's + * text field is capable of holding to be the argument. + * + * @param limit new text limit + * + * @exception IllegalArgumentException
      + *
    • ERROR_CANNOT_BE_ZERO - if the limit is zero
    • + *
    + * @exception SWTException
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • + *
    + */ +public void setTextLimit (int limit) { + checkWidget(); + text.setTextLimit (limit); +} + +@Override +public void setToolTipText (String string) { + checkWidget(); + super.setToolTipText(string); + arrow.setToolTipText (string); + text.setToolTipText (string); +} + +@Override +public void setVisible (boolean visible) { + super.setVisible(visible); + if (!visible) popup.setVisible(false); +} +/** + * Sets the number of items that are visible in the drop + * down portion of the receiver's list. + * + * @param count the new number of items to be visible + * + * @exception SWTException
      + *
    • ERROR_WIDGET_DISPOSED - if the receiver has been disposed
    • + *
    • ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
    • + *
    + * + * @since 3.0 + */ +public void setVisibleItemCount (int count) { + checkWidget (); + if (count < 0) return; + visibleItemCount = count; +} +String stripMnemonic (String string) { + int index = 0; + int length = string.length (); + do { + while ((index < length) && (string.charAt (index) != '&')) index++; + if (++index >= length) return string; + if (string.charAt (index) != '&') { + return string.substring(0, index-1) + string.substring(index, length); + } + index++; + } while (index < length); + return string; +} +void textEvent (Event event) { + switch (event.type) { + case SWT.FocusIn: { + handleFocus (SWT.FocusIn); + break; + } + case SWT.KeyDown: { + if (event.character == SWT.CR) { + dropDown (false); + Event e = new Event (); + e.time = event.time; + e.stateMask = event.stateMask; + notifyListeners (SWT.DefaultSelection, e); + } + //At this point the widget may have been disposed. + // If so, do not continue. + if (isDisposed ()) break; + + if (event.keyCode == SWT.ARROW_UP || event.keyCode == SWT.ARROW_DOWN) { + event.doit = false; + if ((event.stateMask & SWT.ALT) != 0) { + boolean dropped = isDropped (); + text.selectAll (); + if (!dropped) setFocus (); + dropDown (!dropped); + break; + } + + int oldIndex = getSelectionIndex (); + if (event.keyCode == SWT.ARROW_UP) { + select (Math.max (oldIndex - 1, 0)); + } else { + select (Math.min (oldIndex + 1, getItemCount () - 1)); + } + if (oldIndex != getSelectionIndex ()) { + Event e = new Event(); + e.time = event.time; + e.stateMask = event.stateMask; + notifyListeners (SWT.Selection, e); + } + //At this point the widget may have been disposed. + // If so, do not continue. + if (isDisposed ()) break; + } + + // Further work : Need to add support for incremental search in + // pop up list as characters typed in text widget + + Event e = new Event (); + e.time = event.time; + e.character = event.character; + e.keyCode = event.keyCode; + e.stateMask = event.stateMask; + notifyListeners (SWT.KeyDown, e); + break; + } + case SWT.KeyUp: { + Event e = new Event (); + e.time = event.time; + e.character = event.character; + e.keyCode = event.keyCode; + e.stateMask = event.stateMask; + notifyListeners (SWT.KeyUp, e); + break; + } + case SWT.Modify: { + table.deselectAll (); + Event e = new Event (); + e.time = event.time; + notifyListeners (SWT.Modify, e); + break; + } + case SWT.MouseDown: { + if (event.button != 1) return; + if (text.getEditable ()) return; + boolean dropped = isDropped (); + text.selectAll (); + if (!dropped) setFocus (); + dropDown (!dropped); + break; + } + case SWT.MouseUp: { + if (event.button != 1) return; + if (text.getEditable ()) return; + text.selectAll (); + break; + } + case SWT.Traverse: { + switch (event.detail) { + case SWT.TRAVERSE_RETURN: + case SWT.TRAVERSE_ARROW_PREVIOUS: + case SWT.TRAVERSE_ARROW_NEXT: + // The enter causes default selection and + // the arrow keys are used to manipulate the list contents so + // do not use them for traversal. + event.doit = false; + break; + } + + Event e = new Event (); + e.time = event.time; + e.detail = event.detail; + e.doit = event.doit; + e.character = event.character; + e.keyCode = event.keyCode; + notifyListeners (SWT.Traverse, e); + event.doit = e.doit; + event.detail = e.detail; + break; + } + } +} +} diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/callhierarchy/CHEProviderSettings.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/callhierarchy/CHEProviderSettings.java index b36fda158dd..c2d2fbf0bd1 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/callhierarchy/CHEProviderSettings.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/callhierarchy/CHEProviderSettings.java @@ -1,97 +1,97 @@ -/******************************************************************************* - * Copyright (c) 2018 Wind River Systems, Inc. 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: - * Lidia Popescu - [536255] initial API and implementation. Extension point for open call hierarchy view - *******************************************************************************/ -package org.eclipse.cdt.internal.ui.callhierarchy; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IConfigurationElement; -import org.eclipse.core.runtime.IExtension; -import org.eclipse.core.runtime.IExtensionPoint; -import org.eclipse.core.runtime.Platform; -import org.eclipse.jface.viewers.DelegatingStyledCellLabelProvider.IStyledLabelProvider; -import org.eclipse.jface.viewers.IOpenListener; - -import org.eclipse.cdt.ui.ICHEContentProvider; - -/** - * The Call Hierarchy Extension provider Settings - * Responsible to load all available extensions for EXTENSION_POINT_ID - * */ -public class CHEProviderSettings { - - private static final String EXTENSION_POINT_ID = "org.eclipse.cdt.ui.CCallHierarchy"; //$NON-NLS-1$ - private static final String ELEMENT_NAME_CONTENT = "CallHierarchyContentProvider"; //$NON-NLS-1$ - private static final String ELEMENT_NAME_LABEL = "CallHierarchyLabelProvider"; //$NON-NLS-1$ - private static final String ATTRIB_CLASS = "class"; //$NON-NLS-1$ - - IOpenListener[] openListeners =null; - - static ICHEContentProvider[] chContentProviders = null; - static IStyledLabelProvider[] chLabelProviders = null; - - private static void loadExtensions() { - List chCProviders = new ArrayList(); - List chLProviders = new ArrayList(); - - IExtensionPoint extensionPoint = Platform.getExtensionRegistry().getExtensionPoint(EXTENSION_POINT_ID); - if (extensionPoint != null) { - IExtension[] extensions = extensionPoint.getExtensions(); - if (extensions != null) { - for (IExtension ex : extensions) { - for (IConfigurationElement el : ex.getConfigurationElements()) { - if (el.getName().equals(ELEMENT_NAME_CONTENT)) { - ICHEContentProvider provider = null; - try { - provider = (ICHEContentProvider) el.createExecutableExtension(ATTRIB_CLASS); - } catch (CoreException e) { - e.printStackTrace(); - } - if (provider != null) { - chCProviders.add(provider); - } - } - if (el.getName().equals(ELEMENT_NAME_LABEL)) { - IStyledLabelProvider provider = null; - try { - provider = (IStyledLabelProvider) el.createExecutableExtension(ATTRIB_CLASS); - } catch (CoreException e) { - e.printStackTrace(); - } - if (provider != null) { - chLProviders.add(provider); - } - } - } - } - } - } - chLabelProviders = chLProviders.toArray(new IStyledLabelProvider[chLProviders.size()]); - chContentProviders = chCProviders.toArray(new ICHEContentProvider[chCProviders.size()]); - } - - - - public static IStyledLabelProvider[] getCCallHierarchyLabelProviders() { - if ( chLabelProviders == null) { - loadExtensions(); - } - return chLabelProviders; - } - - public static ICHEContentProvider[] getCCallHierarchyContentProviders() { - if ( chContentProviders == null) { - loadExtensions(); - } - return chContentProviders; - } -} +/******************************************************************************* + * Copyright (c) 2018 Wind River Systems, Inc. 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: + * Lidia Popescu - [536255] initial API and implementation. Extension point for open call hierarchy view + *******************************************************************************/ +package org.eclipse.cdt.internal.ui.callhierarchy; + +import java.util.ArrayList; +import java.util.List; + +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IConfigurationElement; +import org.eclipse.core.runtime.IExtension; +import org.eclipse.core.runtime.IExtensionPoint; +import org.eclipse.core.runtime.Platform; +import org.eclipse.jface.viewers.DelegatingStyledCellLabelProvider.IStyledLabelProvider; +import org.eclipse.jface.viewers.IOpenListener; + +import org.eclipse.cdt.ui.ICHEContentProvider; + +/** + * The Call Hierarchy Extension provider Settings + * Responsible to load all available extensions for EXTENSION_POINT_ID + * */ +public class CHEProviderSettings { + + private static final String EXTENSION_POINT_ID = "org.eclipse.cdt.ui.CCallHierarchy"; //$NON-NLS-1$ + private static final String ELEMENT_NAME_CONTENT = "CallHierarchyContentProvider"; //$NON-NLS-1$ + private static final String ELEMENT_NAME_LABEL = "CallHierarchyLabelProvider"; //$NON-NLS-1$ + private static final String ATTRIB_CLASS = "class"; //$NON-NLS-1$ + + IOpenListener[] openListeners =null; + + static ICHEContentProvider[] chContentProviders = null; + static IStyledLabelProvider[] chLabelProviders = null; + + private static void loadExtensions() { + List chCProviders = new ArrayList(); + List chLProviders = new ArrayList(); + + IExtensionPoint extensionPoint = Platform.getExtensionRegistry().getExtensionPoint(EXTENSION_POINT_ID); + if (extensionPoint != null) { + IExtension[] extensions = extensionPoint.getExtensions(); + if (extensions != null) { + for (IExtension ex : extensions) { + for (IConfigurationElement el : ex.getConfigurationElements()) { + if (el.getName().equals(ELEMENT_NAME_CONTENT)) { + ICHEContentProvider provider = null; + try { + provider = (ICHEContentProvider) el.createExecutableExtension(ATTRIB_CLASS); + } catch (CoreException e) { + e.printStackTrace(); + } + if (provider != null) { + chCProviders.add(provider); + } + } + if (el.getName().equals(ELEMENT_NAME_LABEL)) { + IStyledLabelProvider provider = null; + try { + provider = (IStyledLabelProvider) el.createExecutableExtension(ATTRIB_CLASS); + } catch (CoreException e) { + e.printStackTrace(); + } + if (provider != null) { + chLProviders.add(provider); + } + } + } + } + } + } + chLabelProviders = chLProviders.toArray(new IStyledLabelProvider[chLProviders.size()]); + chContentProviders = chCProviders.toArray(new ICHEContentProvider[chCProviders.size()]); + } + + + + public static IStyledLabelProvider[] getCCallHierarchyLabelProviders() { + if ( chLabelProviders == null) { + loadExtensions(); + } + return chLabelProviders; + } + + public static ICHEContentProvider[] getCCallHierarchyContentProviders() { + if ( chContentProviders == null) { + loadExtensions(); + } + return chContentProviders; + } +} diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/callhierarchy/CHPinAction.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/callhierarchy/CHPinAction.java index 4eaf05c409e..b0c4d051152 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/callhierarchy/CHPinAction.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/callhierarchy/CHPinAction.java @@ -1,38 +1,38 @@ -/******************************************************************************* - * Copyright (c) 2011, 2013 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 Corporation - initial API and implementation - * Marc-Andre Laperle - Adapted to CDT from JDT +/******************************************************************************* + * Copyright (c) 2011, 2013 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 Corporation - initial API and implementation + * Marc-Andre Laperle - Adapted to CDT from JDT *******************************************************************************/ -package org.eclipse.cdt.internal.ui.callhierarchy; - -import org.eclipse.jface.action.Action; -import org.eclipse.jface.action.IAction; - -import org.eclipse.cdt.internal.ui.CPluginImages; - -public class CHPinAction extends Action { - private CHViewPart fView; - - /** - * Constructs a 'Pin Call Hierarchy view' action. - * - * @param view the Call Hierarchy view - */ - public CHPinAction(CHViewPart view) { - super(CHMessages.CHPinAction_label, IAction.AS_CHECK_BOX); - setToolTipText(CHMessages.CHPinAction_tooltip); - CPluginImages.setImageDescriptors(this, CPluginImages.T_LCL, "pin_view.gif"); //$NON-NLS-1$ - fView= view; - } - - @Override - public void run() { - fView.setPinned(isChecked()); - } -} +package org.eclipse.cdt.internal.ui.callhierarchy; + +import org.eclipse.jface.action.Action; +import org.eclipse.jface.action.IAction; + +import org.eclipse.cdt.internal.ui.CPluginImages; + +public class CHPinAction extends Action { + private CHViewPart fView; + + /** + * Constructs a 'Pin Call Hierarchy view' action. + * + * @param view the Call Hierarchy view + */ + public CHPinAction(CHViewPart view) { + super(CHMessages.CHPinAction_label, IAction.AS_CHECK_BOX); + setToolTipText(CHMessages.CHPinAction_tooltip); + CPluginImages.setImageDescriptors(this, CPluginImages.T_LCL, "pin_view.gif"); //$NON-NLS-1$ + fView= view; + } + + @Override + public void run() { + fView.setPinned(isChecked()); + } +} diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/AddIncludeAction.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/AddIncludeAction.java index 447d24e3548..c5730c9ec09 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/AddIncludeAction.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/AddIncludeAction.java @@ -1,190 +1,190 @@ -/******************************************************************************* - * Copyright (c) 2013, 2014 Google, Inc 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: - * Sergey Prigogin (Google) - initial API and implementation +/******************************************************************************* + * Copyright (c) 2013, 2014 Google, Inc 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: + * Sergey Prigogin (Google) - initial API and implementation *******************************************************************************/ -package org.eclipse.cdt.internal.ui.editor; - -import java.util.Collection; - -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; -import org.eclipse.jface.dialogs.ErrorDialog; -import org.eclipse.jface.text.BadLocationException; -import org.eclipse.jface.text.IDocument; -import org.eclipse.jface.text.ITextSelection; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.LabelProvider; -import org.eclipse.jface.window.Window; -import org.eclipse.osgi.util.NLS; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.text.edits.MalformedTreeException; -import org.eclipse.text.edits.MultiTextEdit; -import org.eclipse.text.undo.DocumentUndoManagerRegistry; -import org.eclipse.text.undo.IDocumentUndoManager; -import org.eclipse.ui.IEditorInput; -import org.eclipse.ui.dialogs.ElementListSelectionDialog; -import org.eclipse.ui.texteditor.ITextEditor; -import org.eclipse.ui.texteditor.TextEditorAction; - -import org.eclipse.cdt.core.CCorePlugin; -import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit; -import org.eclipse.cdt.core.index.IIndex; -import org.eclipse.cdt.core.index.IIndexManager; -import org.eclipse.cdt.core.model.ITranslationUnit; -import org.eclipse.cdt.ui.CUIPlugin; - -import org.eclipse.cdt.internal.core.model.ASTCache; - -import org.eclipse.cdt.internal.ui.BusyCursorJobRunner; -import org.eclipse.cdt.internal.ui.ICHelpContextIds; -import org.eclipse.cdt.internal.ui.refactoring.includes.IElementSelector; -import org.eclipse.cdt.internal.ui.refactoring.includes.IncludeCreator; - -/** - * Adds an '#include' statement and, optionally, a 'using' declaration necessary to resolve a name. - */ -public class AddIncludeAction extends TextEditorAction { - private IElementSelector fAmbiguityResolver; - - /** - * Constructor - * @param editor The editor on which this Add Include action should operate. - */ - public AddIncludeAction(ITextEditor editor) { - super(CEditorMessages.getBundleForConstructedKeys(), "AddInclude.", editor); //$NON-NLS-1$ - CUIPlugin.getDefault().getWorkbench().getHelpSystem().setHelp(this, ICHelpContextIds.ADD_INCLUDE_ON_SELECTION_ACTION); - final Shell shell = editor.getEditorSite().getShell(); - fAmbiguityResolver = new IElementSelector() { - @SuppressWarnings("unchecked") - @Override - public T selectElement(final Collection elements) { - final Object[] result = new Object[1]; - runInUIThread(new Runnable() { - @Override - public void run() { - ElementListSelectionDialog dialog= - new ElementListSelectionDialog(shell, new LabelProvider()); - dialog.setElements(elements.toArray()); - dialog.setTitle(CEditorMessages.AddInclude_label); - dialog.setMessage(CEditorMessages.AddInclude_description); - if (dialog.open() == Window.OK) - result[0] = dialog.getFirstResult(); - } - }); - return (T) result[0]; - } - }; - } - - @Override - public void run() { - final ITextEditor editor = getTextEditor(); - final ITranslationUnit tu = getTranslationUnit(editor); - if (tu == null) { - return; - } - final ISelection selection= getTextEditor().getSelectionProvider().getSelection(); - if (selection.isEmpty() || !(selection instanceof ITextSelection)) { - return; - } - if (!validateEditorInputState()) { - return; - } - - final MultiTextEdit[] holder = new MultiTextEdit[1]; - // We can't use SharedASTJob because IncludeCreator needs to disable promiscuous - // binding resolution, and you can't mix promiscuous and non-promiscuous binding - // resolution in the same AST. - Job job = new Job(CEditorMessages.AddInclude_action) { - @Override - public IStatus run(IProgressMonitor monitor) { - try { - IIndex index= CCorePlugin.getIndexManager().getIndex(tu.getCProject(), - IIndexManager.ADD_DEPENDENCIES | IIndexManager.ADD_EXTENSION_FRAGMENTS_ADD_IMPORT); - try { - index.acquireReadLock(); - IASTTranslationUnit ast = tu.getAST(index, ASTCache.PARSE_MODE); - if (ast == null) { - return CUIPlugin.createErrorStatus( - NLS.bind(CEditorMessages.AddInclude_ast_not_available, tu.getPath().toOSString())); - } - IncludeCreator creator = new IncludeCreator(tu, index, fAmbiguityResolver); - holder[0] = creator.createInclude(ast, (ITextSelection) selection); - return Status.OK_STATUS; - } catch (InterruptedException e) { - return Status.CANCEL_STATUS; - } finally { - index.releaseReadLock(); - } - } catch (CoreException e) { - return e.getStatus(); - } - } - }; - IStatus status = BusyCursorJobRunner.execute(job); - if (status.isOK()) { - MultiTextEdit edit = holder[0]; - if (edit.hasChildren()) { - // Apply text edits. - IEditorInput editorInput = editor.getEditorInput(); - IDocument document = editor.getDocumentProvider().getDocument(editorInput); - IDocumentUndoManager manager= DocumentUndoManagerRegistry.getDocumentUndoManager(document); - manager.beginCompoundChange(); - try { - edit.apply(document); - } catch (MalformedTreeException | BadLocationException e) { - CUIPlugin.log(e); - } - manager.endCompoundChange(); - } - } else if (status.matches(IStatus.ERROR)) { - ErrorDialog.openError(editor.getEditorSite().getShell(), - CEditorMessages.AddInclude_error_title, - CEditorMessages.AddInclude_insertion_failed, status); - } - } - - private static void runInUIThread(Runnable runnable) { - if (Display.getCurrent() != null) { - runnable.run(); - } else { - Display.getDefault().syncExec(runnable); - } - } - - @Override - public void update() { - ITextEditor editor = getTextEditor(); - setEnabled(editor != null && getTranslationUnit(editor) != null); - } - - /** - * Returns the translation unit of the given editor. - * - * @param editor The editor. - * @return The translation unit. - */ - private static ITranslationUnit getTranslationUnit(ITextEditor editor) { - if (editor == null) { - return null; - } - return CUIPlugin.getDefault().getWorkingCopyManager().getWorkingCopy(editor.getEditorInput()); - } - - /** - * For tests only. - */ - public void setAmbiguityResolver(IElementSelector fAmbiguityResolver) { - this.fAmbiguityResolver = fAmbiguityResolver; - } -} +package org.eclipse.cdt.internal.ui.editor; + +import java.util.Collection; + +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; +import org.eclipse.jface.dialogs.ErrorDialog; +import org.eclipse.jface.text.BadLocationException; +import org.eclipse.jface.text.IDocument; +import org.eclipse.jface.text.ITextSelection; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.viewers.LabelProvider; +import org.eclipse.jface.window.Window; +import org.eclipse.osgi.util.NLS; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Shell; +import org.eclipse.text.edits.MalformedTreeException; +import org.eclipse.text.edits.MultiTextEdit; +import org.eclipse.text.undo.DocumentUndoManagerRegistry; +import org.eclipse.text.undo.IDocumentUndoManager; +import org.eclipse.ui.IEditorInput; +import org.eclipse.ui.dialogs.ElementListSelectionDialog; +import org.eclipse.ui.texteditor.ITextEditor; +import org.eclipse.ui.texteditor.TextEditorAction; + +import org.eclipse.cdt.core.CCorePlugin; +import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit; +import org.eclipse.cdt.core.index.IIndex; +import org.eclipse.cdt.core.index.IIndexManager; +import org.eclipse.cdt.core.model.ITranslationUnit; +import org.eclipse.cdt.ui.CUIPlugin; + +import org.eclipse.cdt.internal.core.model.ASTCache; + +import org.eclipse.cdt.internal.ui.BusyCursorJobRunner; +import org.eclipse.cdt.internal.ui.ICHelpContextIds; +import org.eclipse.cdt.internal.ui.refactoring.includes.IElementSelector; +import org.eclipse.cdt.internal.ui.refactoring.includes.IncludeCreator; + +/** + * Adds an '#include' statement and, optionally, a 'using' declaration necessary to resolve a name. + */ +public class AddIncludeAction extends TextEditorAction { + private IElementSelector fAmbiguityResolver; + + /** + * Constructor + * @param editor The editor on which this Add Include action should operate. + */ + public AddIncludeAction(ITextEditor editor) { + super(CEditorMessages.getBundleForConstructedKeys(), "AddInclude.", editor); //$NON-NLS-1$ + CUIPlugin.getDefault().getWorkbench().getHelpSystem().setHelp(this, ICHelpContextIds.ADD_INCLUDE_ON_SELECTION_ACTION); + final Shell shell = editor.getEditorSite().getShell(); + fAmbiguityResolver = new IElementSelector() { + @SuppressWarnings("unchecked") + @Override + public T selectElement(final Collection elements) { + final Object[] result = new Object[1]; + runInUIThread(new Runnable() { + @Override + public void run() { + ElementListSelectionDialog dialog= + new ElementListSelectionDialog(shell, new LabelProvider()); + dialog.setElements(elements.toArray()); + dialog.setTitle(CEditorMessages.AddInclude_label); + dialog.setMessage(CEditorMessages.AddInclude_description); + if (dialog.open() == Window.OK) + result[0] = dialog.getFirstResult(); + } + }); + return (T) result[0]; + } + }; + } + + @Override + public void run() { + final ITextEditor editor = getTextEditor(); + final ITranslationUnit tu = getTranslationUnit(editor); + if (tu == null) { + return; + } + final ISelection selection= getTextEditor().getSelectionProvider().getSelection(); + if (selection.isEmpty() || !(selection instanceof ITextSelection)) { + return; + } + if (!validateEditorInputState()) { + return; + } + + final MultiTextEdit[] holder = new MultiTextEdit[1]; + // We can't use SharedASTJob because IncludeCreator needs to disable promiscuous + // binding resolution, and you can't mix promiscuous and non-promiscuous binding + // resolution in the same AST. + Job job = new Job(CEditorMessages.AddInclude_action) { + @Override + public IStatus run(IProgressMonitor monitor) { + try { + IIndex index= CCorePlugin.getIndexManager().getIndex(tu.getCProject(), + IIndexManager.ADD_DEPENDENCIES | IIndexManager.ADD_EXTENSION_FRAGMENTS_ADD_IMPORT); + try { + index.acquireReadLock(); + IASTTranslationUnit ast = tu.getAST(index, ASTCache.PARSE_MODE); + if (ast == null) { + return CUIPlugin.createErrorStatus( + NLS.bind(CEditorMessages.AddInclude_ast_not_available, tu.getPath().toOSString())); + } + IncludeCreator creator = new IncludeCreator(tu, index, fAmbiguityResolver); + holder[0] = creator.createInclude(ast, (ITextSelection) selection); + return Status.OK_STATUS; + } catch (InterruptedException e) { + return Status.CANCEL_STATUS; + } finally { + index.releaseReadLock(); + } + } catch (CoreException e) { + return e.getStatus(); + } + } + }; + IStatus status = BusyCursorJobRunner.execute(job); + if (status.isOK()) { + MultiTextEdit edit = holder[0]; + if (edit.hasChildren()) { + // Apply text edits. + IEditorInput editorInput = editor.getEditorInput(); + IDocument document = editor.getDocumentProvider().getDocument(editorInput); + IDocumentUndoManager manager= DocumentUndoManagerRegistry.getDocumentUndoManager(document); + manager.beginCompoundChange(); + try { + edit.apply(document); + } catch (MalformedTreeException | BadLocationException e) { + CUIPlugin.log(e); + } + manager.endCompoundChange(); + } + } else if (status.matches(IStatus.ERROR)) { + ErrorDialog.openError(editor.getEditorSite().getShell(), + CEditorMessages.AddInclude_error_title, + CEditorMessages.AddInclude_insertion_failed, status); + } + } + + private static void runInUIThread(Runnable runnable) { + if (Display.getCurrent() != null) { + runnable.run(); + } else { + Display.getDefault().syncExec(runnable); + } + } + + @Override + public void update() { + ITextEditor editor = getTextEditor(); + setEnabled(editor != null && getTranslationUnit(editor) != null); + } + + /** + * Returns the translation unit of the given editor. + * + * @param editor The editor. + * @return The translation unit. + */ + private static ITranslationUnit getTranslationUnit(ITextEditor editor) { + if (editor == null) { + return null; + } + return CUIPlugin.getDefault().getWorkingCopyManager().getWorkingCopy(editor.getEditorInput()); + } + + /** + * For tests only. + */ + public void setAmbiguityResolver(IElementSelector fAmbiguityResolver) { + this.fAmbiguityResolver = fAmbiguityResolver; + } +} diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/OrganizeIncludesAction.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/OrganizeIncludesAction.java index 7fb44bbae9f..cb4055e7ab3 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/OrganizeIncludesAction.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/OrganizeIncludesAction.java @@ -1,143 +1,143 @@ -/******************************************************************************* - * Copyright (c) 2012, 2014 Mathias Kunter 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: - * Mathias Kunter - initial API and implementation - * Sergey Prigogin (Google) +/******************************************************************************* + * Copyright (c) 2012, 2014 Mathias Kunter 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: + * Mathias Kunter - initial API and implementation + * Sergey Prigogin (Google) *******************************************************************************/ -package org.eclipse.cdt.internal.ui.editor; - -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; -import org.eclipse.jface.dialogs.ErrorDialog; -import org.eclipse.jface.text.BadLocationException; -import org.eclipse.jface.text.IDocument; -import org.eclipse.osgi.util.NLS; -import org.eclipse.text.edits.MalformedTreeException; -import org.eclipse.text.edits.MultiTextEdit; -import org.eclipse.text.undo.DocumentUndoManagerRegistry; -import org.eclipse.text.undo.IDocumentUndoManager; -import org.eclipse.ui.IEditorInput; -import org.eclipse.ui.texteditor.ITextEditor; -import org.eclipse.ui.texteditor.TextEditorAction; - -import org.eclipse.cdt.core.CCorePlugin; -import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit; -import org.eclipse.cdt.core.index.IIndex; -import org.eclipse.cdt.core.index.IIndexManager; -import org.eclipse.cdt.core.model.ITranslationUnit; -import org.eclipse.cdt.ui.CUIPlugin; - -import org.eclipse.cdt.internal.core.model.ASTCache; - -import org.eclipse.cdt.internal.ui.BusyCursorJobRunner; -import org.eclipse.cdt.internal.ui.ICHelpContextIds; -import org.eclipse.cdt.internal.ui.refactoring.includes.IHeaderChooser; -import org.eclipse.cdt.internal.ui.refactoring.includes.IncludeOrganizer; - -/** - * Organizes the include directives and forward declarations of a source or header file. - */ -public class OrganizeIncludesAction extends TextEditorAction { - /** - * Constructor - * @param editor The editor on which this Organize Includes action should operate. - */ - public OrganizeIncludesAction(ITextEditor editor) { - super(CEditorMessages.getBundleForConstructedKeys(), "OrganizeIncludes.", editor); //$NON-NLS-1$ - CUIPlugin.getDefault().getWorkbench().getHelpSystem().setHelp(this, ICHelpContextIds.ORGANIZE_INCLUDES_ACTION); - } - - @Override - public void run() { - final ITextEditor editor = getTextEditor(); - final ITranslationUnit tu = getTranslationUnit(editor); - if (tu == null) { - return; - } - if (!validateEditorInputState()) { - return; - } - - final IHeaderChooser headerChooser = new InteractiveHeaderChooser( - CEditorMessages.OrganizeIncludes_label, editor.getSite().getShell()); - final MultiTextEdit[] holder = new MultiTextEdit[1]; - // We can't use SharedASTJob because IncludeOrganizer needs to disable promiscuous - // binding resolution, and you can't mix promiscuous and non-promiscuous binding - // resolution in the same AST. - Job job = new Job(CEditorMessages.OrganizeIncludes_action) { - @Override - public IStatus run(IProgressMonitor monitor) { - try { - IIndex index= CCorePlugin.getIndexManager().getIndex(tu.getCProject(), - IIndexManager.ADD_DEPENDENCIES | IIndexManager.ADD_EXTENSION_FRAGMENTS_ADD_IMPORT); - try { - index.acquireReadLock(); - IASTTranslationUnit ast = tu.getAST(index, ASTCache.PARSE_MODE); - if (ast == null) { - return CUIPlugin.createErrorStatus( - NLS.bind(CEditorMessages.OrganizeIncludes_ast_not_available, tu.getPath().toOSString())); - } - IncludeOrganizer organizer = new IncludeOrganizer(tu, index, headerChooser); - holder[0] = organizer.organizeIncludes(ast); - return Status.OK_STATUS; - } catch (InterruptedException e) { - return Status.CANCEL_STATUS; - } finally { - index.releaseReadLock(); - } - } catch (CoreException e) { - return e.getStatus(); - } - } - }; - IStatus status = BusyCursorJobRunner.execute(job); - if (status.isOK()) { - MultiTextEdit edit = holder[0]; - if (edit.hasChildren()) { - // Apply the text edit. - IEditorInput editorInput = editor.getEditorInput(); - IDocument document = editor.getDocumentProvider().getDocument(editorInput); - IDocumentUndoManager manager= DocumentUndoManagerRegistry.getDocumentUndoManager(document); - manager.beginCompoundChange(); - try { - edit.apply(document); - } catch (MalformedTreeException e) { - CUIPlugin.log(e); - } catch (BadLocationException e) { - CUIPlugin.log(e); - } - manager.endCompoundChange(); - } - } else if (status.matches(IStatus.ERROR)) { - ErrorDialog.openError(editor.getEditorSite().getShell(), - CEditorMessages.OrganizeIncludes_error_title, - CEditorMessages.OrganizeIncludes_insertion_failed, status); - } - } - - @Override - public void update() { - ITextEditor editor = getTextEditor(); - setEnabled(editor != null && getTranslationUnit(editor) != null); - } - - /** - * Returns the translation unit of the given editor. - * @param editor The editor. - * @return The translation unit. - */ - private static ITranslationUnit getTranslationUnit(ITextEditor editor) { - if (editor == null) { - return null; - } - return CUIPlugin.getDefault().getWorkingCopyManager().getWorkingCopy(editor.getEditorInput()); - } -} +package org.eclipse.cdt.internal.ui.editor; + +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; +import org.eclipse.jface.dialogs.ErrorDialog; +import org.eclipse.jface.text.BadLocationException; +import org.eclipse.jface.text.IDocument; +import org.eclipse.osgi.util.NLS; +import org.eclipse.text.edits.MalformedTreeException; +import org.eclipse.text.edits.MultiTextEdit; +import org.eclipse.text.undo.DocumentUndoManagerRegistry; +import org.eclipse.text.undo.IDocumentUndoManager; +import org.eclipse.ui.IEditorInput; +import org.eclipse.ui.texteditor.ITextEditor; +import org.eclipse.ui.texteditor.TextEditorAction; + +import org.eclipse.cdt.core.CCorePlugin; +import org.eclipse.cdt.core.dom.ast.IASTTranslationUnit; +import org.eclipse.cdt.core.index.IIndex; +import org.eclipse.cdt.core.index.IIndexManager; +import org.eclipse.cdt.core.model.ITranslationUnit; +import org.eclipse.cdt.ui.CUIPlugin; + +import org.eclipse.cdt.internal.core.model.ASTCache; + +import org.eclipse.cdt.internal.ui.BusyCursorJobRunner; +import org.eclipse.cdt.internal.ui.ICHelpContextIds; +import org.eclipse.cdt.internal.ui.refactoring.includes.IHeaderChooser; +import org.eclipse.cdt.internal.ui.refactoring.includes.IncludeOrganizer; + +/** + * Organizes the include directives and forward declarations of a source or header file. + */ +public class OrganizeIncludesAction extends TextEditorAction { + /** + * Constructor + * @param editor The editor on which this Organize Includes action should operate. + */ + public OrganizeIncludesAction(ITextEditor editor) { + super(CEditorMessages.getBundleForConstructedKeys(), "OrganizeIncludes.", editor); //$NON-NLS-1$ + CUIPlugin.getDefault().getWorkbench().getHelpSystem().setHelp(this, ICHelpContextIds.ORGANIZE_INCLUDES_ACTION); + } + + @Override + public void run() { + final ITextEditor editor = getTextEditor(); + final ITranslationUnit tu = getTranslationUnit(editor); + if (tu == null) { + return; + } + if (!validateEditorInputState()) { + return; + } + + final IHeaderChooser headerChooser = new InteractiveHeaderChooser( + CEditorMessages.OrganizeIncludes_label, editor.getSite().getShell()); + final MultiTextEdit[] holder = new MultiTextEdit[1]; + // We can't use SharedASTJob because IncludeOrganizer needs to disable promiscuous + // binding resolution, and you can't mix promiscuous and non-promiscuous binding + // resolution in the same AST. + Job job = new Job(CEditorMessages.OrganizeIncludes_action) { + @Override + public IStatus run(IProgressMonitor monitor) { + try { + IIndex index= CCorePlugin.getIndexManager().getIndex(tu.getCProject(), + IIndexManager.ADD_DEPENDENCIES | IIndexManager.ADD_EXTENSION_FRAGMENTS_ADD_IMPORT); + try { + index.acquireReadLock(); + IASTTranslationUnit ast = tu.getAST(index, ASTCache.PARSE_MODE); + if (ast == null) { + return CUIPlugin.createErrorStatus( + NLS.bind(CEditorMessages.OrganizeIncludes_ast_not_available, tu.getPath().toOSString())); + } + IncludeOrganizer organizer = new IncludeOrganizer(tu, index, headerChooser); + holder[0] = organizer.organizeIncludes(ast); + return Status.OK_STATUS; + } catch (InterruptedException e) { + return Status.CANCEL_STATUS; + } finally { + index.releaseReadLock(); + } + } catch (CoreException e) { + return e.getStatus(); + } + } + }; + IStatus status = BusyCursorJobRunner.execute(job); + if (status.isOK()) { + MultiTextEdit edit = holder[0]; + if (edit.hasChildren()) { + // Apply the text edit. + IEditorInput editorInput = editor.getEditorInput(); + IDocument document = editor.getDocumentProvider().getDocument(editorInput); + IDocumentUndoManager manager= DocumentUndoManagerRegistry.getDocumentUndoManager(document); + manager.beginCompoundChange(); + try { + edit.apply(document); + } catch (MalformedTreeException e) { + CUIPlugin.log(e); + } catch (BadLocationException e) { + CUIPlugin.log(e); + } + manager.endCompoundChange(); + } + } else if (status.matches(IStatus.ERROR)) { + ErrorDialog.openError(editor.getEditorSite().getShell(), + CEditorMessages.OrganizeIncludes_error_title, + CEditorMessages.OrganizeIncludes_insertion_failed, status); + } + } + + @Override + public void update() { + ITextEditor editor = getTextEditor(); + setEnabled(editor != null && getTranslationUnit(editor) != null); + } + + /** + * Returns the translation unit of the given editor. + * @param editor The editor. + * @return The translation unit. + */ + private static ITranslationUnit getTranslationUnit(ITextEditor editor) { + if (editor == null) { + return null; + } + return CUIPlugin.getDefault().getWorkingCopyManager().getWorkingCopy(editor.getEditorInput()); + } +} diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/language/settings/providers/LanguageSettingsImages.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/language/settings/providers/LanguageSettingsImages.java index 47f418009bc..63879cf26c9 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/language/settings/providers/LanguageSettingsImages.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/language/settings/providers/LanguageSettingsImages.java @@ -1,245 +1,245 @@ -/******************************************************************************* - * Copyright (c) 2010, 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.internal.ui.language.settings.providers; - -import org.eclipse.core.resources.IResource; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Path; -import org.eclipse.core.runtime.Status; -import org.eclipse.jface.viewers.IDecoration; -import org.eclipse.swt.graphics.Image; - -import org.eclipse.cdt.core.settings.model.ACPathEntry; -import org.eclipse.cdt.core.settings.model.ICConfigurationDescription; -import org.eclipse.cdt.core.settings.model.ICLanguageSettingEntry; -import org.eclipse.cdt.core.settings.model.ICSettingEntry; -import org.eclipse.cdt.core.settings.model.util.CDataUtil; -import org.eclipse.cdt.ui.CDTSharedImages; -import org.eclipse.cdt.ui.CUIPlugin; -import org.eclipse.cdt.utils.UNCPathConverter; -import org.eclipse.cdt.utils.cdtvariables.CdtVariableResolver; - -import org.eclipse.cdt.internal.ui.newui.Messages; - -/** - * Helper class to provide unified images for {@link ICLanguageSettingEntry}. - */ -public class LanguageSettingsImages { - // evaluates to "/${ProjName)/" - private static final String PROJ_NAME_PREFIX = '/' + CdtVariableResolver.createVariableReference(CdtVariableResolver.VAR_PROJ_NAME) + '/'; - - /** - * Check if the language settings entry should be presented as "project-relative" in UI. - * - * @param entry - language settings entry to check. - * @return {@code true} if the entry should be displayed as "project-relative", {@code false} otherwise. - */ - public static boolean isProjectRelative(ICLanguageSettingEntry entry) { - if (entry instanceof ACPathEntry) { - String path = entry.getName(); - return ((ACPathEntry) entry).isValueWorkspacePath() && path.startsWith(PROJ_NAME_PREFIX); - } - return false; - } - - /** - * Convert path used by {@link ICLanguageSettingEntry} to label representing project-relative portion. - * - * @param path - path to convert to label in project-relative format. - * @return label to be used to display the path in UI. - */ - public static String toProjectRelative(String path) { - if (path.startsWith(LanguageSettingsImages.PROJ_NAME_PREFIX)) { - return path.substring(LanguageSettingsImages.PROJ_NAME_PREFIX.length()); - } - return path; - } - - /** - * Convert label for project-relative path back to path representation carried by {@link ICLanguageSettingEntry}. - * - * @param label - label in project-relative format. - * @return path to be used by {@link ICLanguageSettingEntry}. - */ - public static String fromProjectRelative(String label) { - return LanguageSettingsImages.PROJ_NAME_PREFIX + label; - } - - /** - * Returns image for the given {@link ICLanguageSettingEntry} from internally managed repository including - * necessary overlays for given configuration description. - * - * @param kind - kind of {@link ICLanguageSettingEntry}, i.e. {@link ICSettingEntry#INCLUDE_PATH} etc. - * @param flags - flags of {@link ICSettingEntry}. - * @param isProjectRelative specifies if the image should present "project-relative" icon. - * @return the image for the entry with appropriate overlays. - */ - public static Image getImage(int kind, int flags, boolean isProjectRelative) { - String imageKey = getImageKey(kind, flags, isProjectRelative); - if (imageKey != null) { - return CDTSharedImages.getImage(imageKey); - } - return null; - } - - /** - * Returns image for the given entry from internally managed repository including - * necessary overlays for given configuration description. - * - * @param entry - language settings entry to get an image for. - * @param cfgDescription - configuration description of the entry. - * @return the image for the entry with appropriate overlays. - */ - public static Image getImage(ICLanguageSettingEntry entry, ICConfigurationDescription cfgDescription) { - int kind = entry.getKind(); - int flags = entry.getFlags(); - boolean isProjectRelative = isProjectRelative(entry); - - String imageKey = getImageKey(kind, flags, isProjectRelative); - Image image = null; - if (imageKey != null) { - String[] overlayKeys = new String[5]; - - if ((flags & ICSettingEntry.UNDEFINED) != 0) { - image = CDTSharedImages.getImageOverlaid(imageKey, CDTSharedImages.IMG_OVR_INACTIVE, IDecoration.BOTTOM_LEFT); - } else { - String overlayKeyStatus=null; - IStatus status = getStatus(entry, cfgDescription); - switch (status.getSeverity()) { - case IStatus.ERROR: - overlayKeyStatus = CDTSharedImages.IMG_OVR_ERROR; - break; - case IStatus.WARNING: - overlayKeyStatus = CDTSharedImages.IMG_OVR_WARNING; - break; - case IStatus.INFO: - overlayKeyStatus = CDTSharedImages.IMG_OVR_WARNING; - break; - } - if (overlayKeyStatus != null) { - overlayKeys[IDecoration.BOTTOM_LEFT]=overlayKeyStatus; - } - - if ((flags & ICSettingEntry.EXPORTED) != 0) { - overlayKeys[IDecoration.BOTTOM_RIGHT]=CDTSharedImages.IMG_OVR_EXPORTED; - } - - image = CDTSharedImages.getImageOverlaid(imageKey, overlayKeys); - } - } - return image; - } - - /** - * @return the base key for the image. - */ - public static String getImageKey(int kind, int flag, boolean isProjectRelative) { - String imageKey = null; - - boolean isWorkspacePath = (flag & ICSettingEntry.VALUE_WORKSPACE_PATH) != 0; - boolean isBuiltin = (flag & ICSettingEntry.BUILTIN) != 0; - boolean isFramework = (flag & ICSettingEntry.FRAMEWORKS_MAC) != 0; - - switch (kind) { - case ICSettingEntry.INCLUDE_PATH: - if (isWorkspacePath) { - if (isProjectRelative) { - imageKey = CDTSharedImages.IMG_OBJS_INCLUDES_FOLDER_PROJECT; - } else { - imageKey = CDTSharedImages.IMG_OBJS_INCLUDES_FOLDER_WORKSPACE; - } - } else if (isFramework) { - imageKey = CDTSharedImages.IMG_OBJS_FRAMEWORKS_FOLDER; - } else if (isBuiltin) { - imageKey = CDTSharedImages.IMG_OBJS_INCLUDES_FOLDER_SYSTEM; - } else { - imageKey = CDTSharedImages.IMG_OBJS_INCLUDES_FOLDER; - } - break; - case ICSettingEntry.INCLUDE_FILE: - imageKey = CDTSharedImages.IMG_OBJS_TUNIT_HEADER; - break; - case ICSettingEntry.MACRO: - imageKey = CDTSharedImages.IMG_OBJS_MACRO; - break; - case ICSettingEntry.MACRO_FILE: - imageKey = CDTSharedImages.IMG_OBJS_MACROS_FILE; - break; - case ICSettingEntry.LIBRARY_PATH: - imageKey = CDTSharedImages.IMG_OBJS_LIBRARY_FOLDER; - break; - case ICSettingEntry.LIBRARY_FILE: - imageKey = CDTSharedImages.IMG_OBJS_LIBRARY; - break; - } - if (imageKey == null) - imageKey = CDTSharedImages.IMG_OBJS_UNKNOWN_TYPE; - return imageKey; - } - - /** - * Checking if the entry points to existing or accessible location. - * @param entry - resolved entry - */ - private static boolean isLocationOk(ACPathEntry entry) { - boolean exists = true; - boolean isWorkspacePath = (entry.getFlags() & ICSettingEntry.VALUE_WORKSPACE_PATH) != 0; - if (isWorkspacePath) { - IPath path = new Path(entry.getValue()); - IResource rc = ResourcesPlugin.getWorkspace().getRoot().findMember(path); - exists = (rc !=null) && rc.isAccessible(); - } else if (UNCPathConverter.isUNC(entry.getName())) { - return true; - } else { - String pathname = entry.getName(); - java.io.File file = new java.io.File(pathname); - exists = file.exists(); - } - return exists; - } - - /** - * Defines status object for the status message line. - * - * @param entry - the entry to check status on. - * @param cfgDescription - configuration description of the entry. - * @return a status object defining severity and message. - */ - public static IStatus getStatus(ICLanguageSettingEntry entry, ICConfigurationDescription cfgDescription) { - if (entry instanceof ACPathEntry) { - if (!entry.isResolved()) { - ICLanguageSettingEntry[] entries = CDataUtil.resolveEntries(new ICLanguageSettingEntry[] {entry}, cfgDescription); - if (entries != null && entries.length > 0) { - entry = entries[0]; - } - } - - ACPathEntry acEntry = (ACPathEntry)entry; - String acEntryName = acEntry.getName(); - IPath path = new Path(acEntryName); - if (!path.isAbsolute()) { - return new Status(IStatus.INFO, CUIPlugin.PLUGIN_ID, Messages.LanguageSettingsImages_UsingRelativePathsNotRecommended); - } - if (!isLocationOk(acEntry)) { - if (acEntry.isFile()) { - return new Status(IStatus.WARNING, CUIPlugin.PLUGIN_ID, Messages.LanguageSettingsImages_FileDoesNotExist); - } else { - return new Status(IStatus.WARNING, CUIPlugin.PLUGIN_ID, Messages.LanguageSettingsImages_FolderDoesNotExist); - } - } - - } - return Status.OK_STATUS; - } - -} +/******************************************************************************* + * Copyright (c) 2010, 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.internal.ui.language.settings.providers; + +import org.eclipse.core.resources.IResource; +import org.eclipse.core.resources.ResourcesPlugin; +import org.eclipse.core.runtime.IPath; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Path; +import org.eclipse.core.runtime.Status; +import org.eclipse.jface.viewers.IDecoration; +import org.eclipse.swt.graphics.Image; + +import org.eclipse.cdt.core.settings.model.ACPathEntry; +import org.eclipse.cdt.core.settings.model.ICConfigurationDescription; +import org.eclipse.cdt.core.settings.model.ICLanguageSettingEntry; +import org.eclipse.cdt.core.settings.model.ICSettingEntry; +import org.eclipse.cdt.core.settings.model.util.CDataUtil; +import org.eclipse.cdt.ui.CDTSharedImages; +import org.eclipse.cdt.ui.CUIPlugin; +import org.eclipse.cdt.utils.UNCPathConverter; +import org.eclipse.cdt.utils.cdtvariables.CdtVariableResolver; + +import org.eclipse.cdt.internal.ui.newui.Messages; + +/** + * Helper class to provide unified images for {@link ICLanguageSettingEntry}. + */ +public class LanguageSettingsImages { + // evaluates to "/${ProjName)/" + private static final String PROJ_NAME_PREFIX = '/' + CdtVariableResolver.createVariableReference(CdtVariableResolver.VAR_PROJ_NAME) + '/'; + + /** + * Check if the language settings entry should be presented as "project-relative" in UI. + * + * @param entry - language settings entry to check. + * @return {@code true} if the entry should be displayed as "project-relative", {@code false} otherwise. + */ + public static boolean isProjectRelative(ICLanguageSettingEntry entry) { + if (entry instanceof ACPathEntry) { + String path = entry.getName(); + return ((ACPathEntry) entry).isValueWorkspacePath() && path.startsWith(PROJ_NAME_PREFIX); + } + return false; + } + + /** + * Convert path used by {@link ICLanguageSettingEntry} to label representing project-relative portion. + * + * @param path - path to convert to label in project-relative format. + * @return label to be used to display the path in UI. + */ + public static String toProjectRelative(String path) { + if (path.startsWith(LanguageSettingsImages.PROJ_NAME_PREFIX)) { + return path.substring(LanguageSettingsImages.PROJ_NAME_PREFIX.length()); + } + return path; + } + + /** + * Convert label for project-relative path back to path representation carried by {@link ICLanguageSettingEntry}. + * + * @param label - label in project-relative format. + * @return path to be used by {@link ICLanguageSettingEntry}. + */ + public static String fromProjectRelative(String label) { + return LanguageSettingsImages.PROJ_NAME_PREFIX + label; + } + + /** + * Returns image for the given {@link ICLanguageSettingEntry} from internally managed repository including + * necessary overlays for given configuration description. + * + * @param kind - kind of {@link ICLanguageSettingEntry}, i.e. {@link ICSettingEntry#INCLUDE_PATH} etc. + * @param flags - flags of {@link ICSettingEntry}. + * @param isProjectRelative specifies if the image should present "project-relative" icon. + * @return the image for the entry with appropriate overlays. + */ + public static Image getImage(int kind, int flags, boolean isProjectRelative) { + String imageKey = getImageKey(kind, flags, isProjectRelative); + if (imageKey != null) { + return CDTSharedImages.getImage(imageKey); + } + return null; + } + + /** + * Returns image for the given entry from internally managed repository including + * necessary overlays for given configuration description. + * + * @param entry - language settings entry to get an image for. + * @param cfgDescription - configuration description of the entry. + * @return the image for the entry with appropriate overlays. + */ + public static Image getImage(ICLanguageSettingEntry entry, ICConfigurationDescription cfgDescription) { + int kind = entry.getKind(); + int flags = entry.getFlags(); + boolean isProjectRelative = isProjectRelative(entry); + + String imageKey = getImageKey(kind, flags, isProjectRelative); + Image image = null; + if (imageKey != null) { + String[] overlayKeys = new String[5]; + + if ((flags & ICSettingEntry.UNDEFINED) != 0) { + image = CDTSharedImages.getImageOverlaid(imageKey, CDTSharedImages.IMG_OVR_INACTIVE, IDecoration.BOTTOM_LEFT); + } else { + String overlayKeyStatus=null; + IStatus status = getStatus(entry, cfgDescription); + switch (status.getSeverity()) { + case IStatus.ERROR: + overlayKeyStatus = CDTSharedImages.IMG_OVR_ERROR; + break; + case IStatus.WARNING: + overlayKeyStatus = CDTSharedImages.IMG_OVR_WARNING; + break; + case IStatus.INFO: + overlayKeyStatus = CDTSharedImages.IMG_OVR_WARNING; + break; + } + if (overlayKeyStatus != null) { + overlayKeys[IDecoration.BOTTOM_LEFT]=overlayKeyStatus; + } + + if ((flags & ICSettingEntry.EXPORTED) != 0) { + overlayKeys[IDecoration.BOTTOM_RIGHT]=CDTSharedImages.IMG_OVR_EXPORTED; + } + + image = CDTSharedImages.getImageOverlaid(imageKey, overlayKeys); + } + } + return image; + } + + /** + * @return the base key for the image. + */ + public static String getImageKey(int kind, int flag, boolean isProjectRelative) { + String imageKey = null; + + boolean isWorkspacePath = (flag & ICSettingEntry.VALUE_WORKSPACE_PATH) != 0; + boolean isBuiltin = (flag & ICSettingEntry.BUILTIN) != 0; + boolean isFramework = (flag & ICSettingEntry.FRAMEWORKS_MAC) != 0; + + switch (kind) { + case ICSettingEntry.INCLUDE_PATH: + if (isWorkspacePath) { + if (isProjectRelative) { + imageKey = CDTSharedImages.IMG_OBJS_INCLUDES_FOLDER_PROJECT; + } else { + imageKey = CDTSharedImages.IMG_OBJS_INCLUDES_FOLDER_WORKSPACE; + } + } else if (isFramework) { + imageKey = CDTSharedImages.IMG_OBJS_FRAMEWORKS_FOLDER; + } else if (isBuiltin) { + imageKey = CDTSharedImages.IMG_OBJS_INCLUDES_FOLDER_SYSTEM; + } else { + imageKey = CDTSharedImages.IMG_OBJS_INCLUDES_FOLDER; + } + break; + case ICSettingEntry.INCLUDE_FILE: + imageKey = CDTSharedImages.IMG_OBJS_TUNIT_HEADER; + break; + case ICSettingEntry.MACRO: + imageKey = CDTSharedImages.IMG_OBJS_MACRO; + break; + case ICSettingEntry.MACRO_FILE: + imageKey = CDTSharedImages.IMG_OBJS_MACROS_FILE; + break; + case ICSettingEntry.LIBRARY_PATH: + imageKey = CDTSharedImages.IMG_OBJS_LIBRARY_FOLDER; + break; + case ICSettingEntry.LIBRARY_FILE: + imageKey = CDTSharedImages.IMG_OBJS_LIBRARY; + break; + } + if (imageKey == null) + imageKey = CDTSharedImages.IMG_OBJS_UNKNOWN_TYPE; + return imageKey; + } + + /** + * Checking if the entry points to existing or accessible location. + * @param entry - resolved entry + */ + private static boolean isLocationOk(ACPathEntry entry) { + boolean exists = true; + boolean isWorkspacePath = (entry.getFlags() & ICSettingEntry.VALUE_WORKSPACE_PATH) != 0; + if (isWorkspacePath) { + IPath path = new Path(entry.getValue()); + IResource rc = ResourcesPlugin.getWorkspace().getRoot().findMember(path); + exists = (rc !=null) && rc.isAccessible(); + } else if (UNCPathConverter.isUNC(entry.getName())) { + return true; + } else { + String pathname = entry.getName(); + java.io.File file = new java.io.File(pathname); + exists = file.exists(); + } + return exists; + } + + /** + * Defines status object for the status message line. + * + * @param entry - the entry to check status on. + * @param cfgDescription - configuration description of the entry. + * @return a status object defining severity and message. + */ + public static IStatus getStatus(ICLanguageSettingEntry entry, ICConfigurationDescription cfgDescription) { + if (entry instanceof ACPathEntry) { + if (!entry.isResolved()) { + ICLanguageSettingEntry[] entries = CDataUtil.resolveEntries(new ICLanguageSettingEntry[] {entry}, cfgDescription); + if (entries != null && entries.length > 0) { + entry = entries[0]; + } + } + + ACPathEntry acEntry = (ACPathEntry)entry; + String acEntryName = acEntry.getName(); + IPath path = new Path(acEntryName); + if (!path.isAbsolute()) { + return new Status(IStatus.INFO, CUIPlugin.PLUGIN_ID, Messages.LanguageSettingsImages_UsingRelativePathsNotRecommended); + } + if (!isLocationOk(acEntry)) { + if (acEntry.isFile()) { + return new Status(IStatus.WARNING, CUIPlugin.PLUGIN_ID, Messages.LanguageSettingsImages_FileDoesNotExist); + } else { + return new Status(IStatus.WARNING, CUIPlugin.PLUGIN_ID, Messages.LanguageSettingsImages_FolderDoesNotExist); + } + } + + } + return Status.OK_STATUS; + } + +} diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/language/settings/providers/LanguageSettingsProviderAssociationManager.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/language/settings/providers/LanguageSettingsProviderAssociationManager.java index 7cb5c087873..c57ad83a23b 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/language/settings/providers/LanguageSettingsProviderAssociationManager.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/language/settings/providers/LanguageSettingsProviderAssociationManager.java @@ -1,361 +1,361 @@ -/******************************************************************************* - * 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.internal.ui.language.settings.providers; - -import java.net.MalformedURLException; -import java.net.URL; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; - -import org.eclipse.core.runtime.IConfigurationElement; -import org.eclipse.core.runtime.IExtension; -import org.eclipse.core.runtime.IExtensionPoint; -import org.eclipse.core.runtime.IExtensionRegistry; -import org.eclipse.core.runtime.Platform; - -import org.eclipse.cdt.core.language.settings.providers.ILanguageSettingsProvider; -import org.eclipse.cdt.ui.CDTSharedImages; -import org.eclipse.cdt.ui.CUIPlugin; -import org.eclipse.cdt.ui.dialogs.ICOptionPage; - -/** - * This class manages extensions of extension point org.eclipse.cdt.core.LanguageSettingsProvider - * which defines appearance and behavior of UI controls for Language Settings Providers. - * - * @noextend This class is not intended to be subclassed by clients. - * @noinstantiate This class is not intended to be instantiated by clients. - */ -public class LanguageSettingsProviderAssociationManager { - /** Name of the extension point for contributing language settings provider associations */ - private static final String PROVIDER_ASSOCIATION_EXTENSION_POINT_SIMPLE_ID = "LanguageSettingsProviderAssociation"; //$NON-NLS-1$ - - private static final String ELEM_ID_ASSOCIATION = "id-association"; //$NON-NLS-1$ - private static final String ELEM_CLASS_ASSOCIATION = "class-association"; //$NON-NLS-1$ - private static final String ATTR_ID = "id"; //$NON-NLS-1$ - private static final String ATTR_CLASS = "class"; //$NON-NLS-1$ - private static final String ATTR_ICON = "icon"; //$NON-NLS-1$ - private static final String ATTR_PAGE = "page"; //$NON-NLS-1$ - private static final String ATTR_UI_CLEAR_ENTRIES = "ui-clear-entries"; //$NON-NLS-1$ - private static final String ATTR_UI_EDIT_ENTRIES = "ui-edit-entries"; //$NON-NLS-1$ - - private static boolean isLoaded = false; - private static List loadedIcons = new ArrayList(); - private static Map fImagesUrlById = new HashMap(); - private static Map fImagesUrlByClass = new HashMap(); - private static List fRegirestedIds = new ArrayList(); - private static List fRegisteredClasses = new ArrayList(); - - private static Map> fAssociationsById = new HashMap>(); - private static Map> fAssociationsByClass = new HashMap>(); - - /** - * Load extensions into memory maps. - */ - private static void loadExtensions() { - if (isLoaded) { - return; - } - isLoaded = true; - - IExtensionRegistry registry = Platform.getExtensionRegistry(); - IExtensionPoint extension = registry.getExtensionPoint(CUIPlugin.PLUGIN_ID, PROVIDER_ASSOCIATION_EXTENSION_POINT_SIMPLE_ID); - if (extension != null) { - IExtension[] extensions = extension.getExtensions(); - for (IExtension ext : extensions) { - @SuppressWarnings("unused") - String extensionID = ext.getUniqueIdentifier(); - for (IConfigurationElement cfgEl : ext.getConfigurationElements()) { - if (cfgEl.getName().equals(ELEM_ID_ASSOCIATION)) { - String id = cfgEl.getAttribute(ATTR_ID); - URL url = getIconUrl(cfgEl); - fImagesUrlById.put(id, url); - fRegirestedIds.add(id); - - Map properties = new HashMap(); - putNotEmpty(properties, ATTR_PAGE, cfgEl.getAttribute(ATTR_PAGE)); - putNotEmpty(properties, ATTR_UI_CLEAR_ENTRIES, cfgEl.getAttribute(ATTR_UI_CLEAR_ENTRIES)); - putNotEmpty(properties, ATTR_UI_EDIT_ENTRIES, cfgEl.getAttribute(ATTR_UI_EDIT_ENTRIES)); - fAssociationsById.put(id, properties); - } else if (cfgEl.getName().equals(ELEM_CLASS_ASSOCIATION)) { - String className = cfgEl.getAttribute(ATTR_CLASS); - URL url = getIconUrl(cfgEl); - fImagesUrlByClass.put(className, url); - String pageClass = cfgEl.getAttribute(ATTR_PAGE); - if (pageClass != null && pageClass.length() > 0) { - fRegisteredClasses.add(className); - } - - Map properties = new HashMap(); - putNotEmpty(properties, ATTR_PAGE, cfgEl.getAttribute(ATTR_PAGE)); - putNotEmpty(properties, ATTR_UI_CLEAR_ENTRIES, cfgEl.getAttribute(ATTR_UI_CLEAR_ENTRIES)); - putNotEmpty(properties, ATTR_UI_EDIT_ENTRIES, cfgEl.getAttribute(ATTR_UI_EDIT_ENTRIES)); - fAssociationsByClass.put(className, properties); - } - } - } - } - - } - - /** - * Put value into properties ignoring nulls. - */ - private static void putNotEmpty(Map properties, String key, String value) { - if (value != null) - properties.put(key, value); - } - - /** - * Find icon URL in its bundle. - */ - private static URL getIconUrl(IConfigurationElement config) { - URL url = null; - try { - String iconName = config.getAttribute(ATTR_ICON); - if (iconName != null) { - URL pluginInstallUrl = Platform.getBundle(config.getDeclaringExtension().getContributor().getName()).getEntry("/"); //$NON-NLS-1$ - url = new URL(pluginInstallUrl, iconName); - if (loadedIcons.contains(url)) { - return url; - } - } - } catch (MalformedURLException e) { - CUIPlugin.log(e); - } - - loadedIcons.add(url); - if (url != null) { - CDTSharedImages.register(url); - } - - return url; - } - - /** - * Get image URL for language settings provider with the given ID. - * - * @param providerId - ID of language settings provider. - * @return image URL or {@code null}. - */ - public static URL getImageUrl(String providerId) { - loadExtensions(); - return fImagesUrlById.get(providerId); - } - - /** - * Create an Options page for language settings provider with given ID. - */ - private static ICOptionPage createOptionsPageById(String providerId) { - loadExtensions(); - - if (fRegirestedIds.contains(providerId)) { - IExtensionRegistry registry = Platform.getExtensionRegistry(); - IExtensionPoint extension = registry.getExtensionPoint(CUIPlugin.PLUGIN_ID, PROVIDER_ASSOCIATION_EXTENSION_POINT_SIMPLE_ID); - if (extension != null) { - IExtension[] extensions = extension.getExtensions(); - for (IExtension ext : extensions) { - try { - @SuppressWarnings("unused") - String extensionID = ext.getUniqueIdentifier(); - for (IConfigurationElement cfgEl : ext.getConfigurationElements()) { - if (cfgEl.getName().equals(ELEM_ID_ASSOCIATION)) { - String id = cfgEl.getAttribute(ATTR_ID); - if (providerId.equals(id)) { - String pageClass = cfgEl.getAttribute(ATTR_PAGE); - if (pageClass != null && pageClass.trim().length() > 0) { - ICOptionPage page = (ICOptionPage) cfgEl.createExecutableExtension(ATTR_PAGE); - return page; - } - } - } - } - } catch (Exception e) { - CUIPlugin.log("Cannot load LanguageSettingsProviderAssociation extension " + ext.getUniqueIdentifier(), e); //$NON-NLS-1$ - } - } - } - } - return null; - } - - /** - * Create an Options page for language settings provider class by its name. - */ - private static ICOptionPage createOptionsPageByClass(String providerClassName) { - loadExtensions(); - - if (fRegisteredClasses.contains(providerClassName)) { - IExtensionRegistry registry = Platform.getExtensionRegistry(); - IExtensionPoint extension = registry.getExtensionPoint(CUIPlugin.PLUGIN_ID, PROVIDER_ASSOCIATION_EXTENSION_POINT_SIMPLE_ID); - if (extension != null) { - IExtension[] extensions = extension.getExtensions(); - for (IExtension ext : extensions) { - try { - @SuppressWarnings("unused") - String extensionID = ext.getUniqueIdentifier(); - for (IConfigurationElement cfgEl : ext.getConfigurationElements()) { - if (cfgEl.getName().equals(ELEM_CLASS_ASSOCIATION)) { - String className = cfgEl.getAttribute(ATTR_CLASS); - if (providerClassName.equals(className)) { - String pageClass = cfgEl.getAttribute(ATTR_PAGE); - if (pageClass!=null && pageClass.trim().length()>0) { - ICOptionPage page = (ICOptionPage) cfgEl.createExecutableExtension(ATTR_PAGE); - return page; - } - } - } - } - } catch (Exception e) { - CUIPlugin.log("Cannot load LanguageSettingsProviderAssociation extension " + ext.getUniqueIdentifier(), e); //$NON-NLS-1$ - } - } - } - } - return null; - } - - /** - * Returns Language Settings Provider image registered for closest superclass - * or interface. - * - * @param providerClass - class to find Language Settings Provider image. - * @return image or {@code null} - */ - public static URL getImage(Class providerClass) { - URL url = null; - - outer: for (Class c = providerClass; c != null; c = c.getSuperclass()) { - url = getImageURL(c); - if (url != null) { - break; - } - - // this does not check for super-interfaces, feel free to implement as needed - for (Class i : c.getInterfaces()) { - url = getImageURL(i); - if (url != null) { - break outer; - } - } - } - return url; - } - - /** - * Return image URL registered for the given class. - */ - private static URL getImageURL(Class clazz) { - String className = clazz.getCanonicalName(); - for (Entry entry : fImagesUrlByClass.entrySet()) { - if (entry.getKey().equals(className)) { - return entry.getValue(); - } - } - return null; - } - - /** - * Returns language settings provider Options page registered for closest superclass. - * - * @param provider - instance of provider to create Options page for. - * @return image or {@code null}. - */ - public static ICOptionPage createOptionsPage(ILanguageSettingsProvider provider) { - String id = provider.getId(); - ICOptionPage optionsPage = createOptionsPageById(id); - if (optionsPage != null) { - return optionsPage; - } - - Class clazz = provider.getClass(); - outer: for (Class c = clazz ;c != null; c = c.getSuperclass()) { - optionsPage = createOptionsPageByClass(c); - if (optionsPage != null) { - break; - } - - // this does not check for super-interfaces, feel free to implement as needed - for (Class i : c.getInterfaces()) { - optionsPage = createOptionsPageByClass(i); - if (optionsPage != null) { - break outer; - } - } - } - return optionsPage; - } - - /** - * Create an Options page for language settings provider class. - */ - private static ICOptionPage createOptionsPageByClass(Class clazz) { - ICOptionPage optionsPage = null; - String className = clazz.getCanonicalName(); - if (fRegisteredClasses.contains(className)) { - optionsPage = createOptionsPageByClass(className); - } - return optionsPage; - } - - /** - * Returns value of the attribute of the provider by id or closest superclass. - */ - private static boolean getBooleanAttribute(ILanguageSettingsProvider provider, String attr) { - loadExtensions(); - - String id = provider.getId(); - - Map properties = fAssociationsById.get(id); - if (properties != null) { - return Boolean.parseBoolean(properties.get(attr)); - } - - for (Class c = provider.getClass();c != null; c = c.getSuperclass()) { - String className = c.getCanonicalName(); - properties = fAssociationsByClass.get(className); - if (properties != null) { - return Boolean.parseBoolean(properties.get(attr)); - } - - // this does not check for superinterfaces, feel free to implement as needed - for (Class i : c.getInterfaces()) { - String interfaceName = i.getCanonicalName(); - properties = fAssociationsByClass.get(interfaceName); - if (properties != null) { - return Boolean.parseBoolean(properties.get(attr)); - } - } - } - return false; - } - - /** - * Check if the user is allowed to edit language settings provider entries in UI. - * @param provider - language settings provider. - * @return {@code true} if editing is allowed or {@code false} if not. - */ - public static boolean isAllowedToEditEntries(ILanguageSettingsProvider provider) { - return getBooleanAttribute(provider, ATTR_UI_EDIT_ENTRIES); - } - - /** - * Check if the user is allowed to clear language settings provider entries in UI. - * @param provider - language settings provider. - * @return {@code true} if clearing is allowed or {@code false} if not. - */ - public static boolean isAllowedToClear(ILanguageSettingsProvider provider) { - return getBooleanAttribute(provider, ATTR_UI_CLEAR_ENTRIES); - } - -} +/******************************************************************************* + * 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.internal.ui.language.settings.providers; + +import java.net.MalformedURLException; +import java.net.URL; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; + +import org.eclipse.core.runtime.IConfigurationElement; +import org.eclipse.core.runtime.IExtension; +import org.eclipse.core.runtime.IExtensionPoint; +import org.eclipse.core.runtime.IExtensionRegistry; +import org.eclipse.core.runtime.Platform; + +import org.eclipse.cdt.core.language.settings.providers.ILanguageSettingsProvider; +import org.eclipse.cdt.ui.CDTSharedImages; +import org.eclipse.cdt.ui.CUIPlugin; +import org.eclipse.cdt.ui.dialogs.ICOptionPage; + +/** + * This class manages extensions of extension point org.eclipse.cdt.core.LanguageSettingsProvider + * which defines appearance and behavior of UI controls for Language Settings Providers. + * + * @noextend This class is not intended to be subclassed by clients. + * @noinstantiate This class is not intended to be instantiated by clients. + */ +public class LanguageSettingsProviderAssociationManager { + /** Name of the extension point for contributing language settings provider associations */ + private static final String PROVIDER_ASSOCIATION_EXTENSION_POINT_SIMPLE_ID = "LanguageSettingsProviderAssociation"; //$NON-NLS-1$ + + private static final String ELEM_ID_ASSOCIATION = "id-association"; //$NON-NLS-1$ + private static final String ELEM_CLASS_ASSOCIATION = "class-association"; //$NON-NLS-1$ + private static final String ATTR_ID = "id"; //$NON-NLS-1$ + private static final String ATTR_CLASS = "class"; //$NON-NLS-1$ + private static final String ATTR_ICON = "icon"; //$NON-NLS-1$ + private static final String ATTR_PAGE = "page"; //$NON-NLS-1$ + private static final String ATTR_UI_CLEAR_ENTRIES = "ui-clear-entries"; //$NON-NLS-1$ + private static final String ATTR_UI_EDIT_ENTRIES = "ui-edit-entries"; //$NON-NLS-1$ + + private static boolean isLoaded = false; + private static List loadedIcons = new ArrayList(); + private static Map fImagesUrlById = new HashMap(); + private static Map fImagesUrlByClass = new HashMap(); + private static List fRegirestedIds = new ArrayList(); + private static List fRegisteredClasses = new ArrayList(); + + private static Map> fAssociationsById = new HashMap>(); + private static Map> fAssociationsByClass = new HashMap>(); + + /** + * Load extensions into memory maps. + */ + private static void loadExtensions() { + if (isLoaded) { + return; + } + isLoaded = true; + + IExtensionRegistry registry = Platform.getExtensionRegistry(); + IExtensionPoint extension = registry.getExtensionPoint(CUIPlugin.PLUGIN_ID, PROVIDER_ASSOCIATION_EXTENSION_POINT_SIMPLE_ID); + if (extension != null) { + IExtension[] extensions = extension.getExtensions(); + for (IExtension ext : extensions) { + @SuppressWarnings("unused") + String extensionID = ext.getUniqueIdentifier(); + for (IConfigurationElement cfgEl : ext.getConfigurationElements()) { + if (cfgEl.getName().equals(ELEM_ID_ASSOCIATION)) { + String id = cfgEl.getAttribute(ATTR_ID); + URL url = getIconUrl(cfgEl); + fImagesUrlById.put(id, url); + fRegirestedIds.add(id); + + Map properties = new HashMap(); + putNotEmpty(properties, ATTR_PAGE, cfgEl.getAttribute(ATTR_PAGE)); + putNotEmpty(properties, ATTR_UI_CLEAR_ENTRIES, cfgEl.getAttribute(ATTR_UI_CLEAR_ENTRIES)); + putNotEmpty(properties, ATTR_UI_EDIT_ENTRIES, cfgEl.getAttribute(ATTR_UI_EDIT_ENTRIES)); + fAssociationsById.put(id, properties); + } else if (cfgEl.getName().equals(ELEM_CLASS_ASSOCIATION)) { + String className = cfgEl.getAttribute(ATTR_CLASS); + URL url = getIconUrl(cfgEl); + fImagesUrlByClass.put(className, url); + String pageClass = cfgEl.getAttribute(ATTR_PAGE); + if (pageClass != null && pageClass.length() > 0) { + fRegisteredClasses.add(className); + } + + Map properties = new HashMap(); + putNotEmpty(properties, ATTR_PAGE, cfgEl.getAttribute(ATTR_PAGE)); + putNotEmpty(properties, ATTR_UI_CLEAR_ENTRIES, cfgEl.getAttribute(ATTR_UI_CLEAR_ENTRIES)); + putNotEmpty(properties, ATTR_UI_EDIT_ENTRIES, cfgEl.getAttribute(ATTR_UI_EDIT_ENTRIES)); + fAssociationsByClass.put(className, properties); + } + } + } + } + + } + + /** + * Put value into properties ignoring nulls. + */ + private static void putNotEmpty(Map properties, String key, String value) { + if (value != null) + properties.put(key, value); + } + + /** + * Find icon URL in its bundle. + */ + private static URL getIconUrl(IConfigurationElement config) { + URL url = null; + try { + String iconName = config.getAttribute(ATTR_ICON); + if (iconName != null) { + URL pluginInstallUrl = Platform.getBundle(config.getDeclaringExtension().getContributor().getName()).getEntry("/"); //$NON-NLS-1$ + url = new URL(pluginInstallUrl, iconName); + if (loadedIcons.contains(url)) { + return url; + } + } + } catch (MalformedURLException e) { + CUIPlugin.log(e); + } + + loadedIcons.add(url); + if (url != null) { + CDTSharedImages.register(url); + } + + return url; + } + + /** + * Get image URL for language settings provider with the given ID. + * + * @param providerId - ID of language settings provider. + * @return image URL or {@code null}. + */ + public static URL getImageUrl(String providerId) { + loadExtensions(); + return fImagesUrlById.get(providerId); + } + + /** + * Create an Options page for language settings provider with given ID. + */ + private static ICOptionPage createOptionsPageById(String providerId) { + loadExtensions(); + + if (fRegirestedIds.contains(providerId)) { + IExtensionRegistry registry = Platform.getExtensionRegistry(); + IExtensionPoint extension = registry.getExtensionPoint(CUIPlugin.PLUGIN_ID, PROVIDER_ASSOCIATION_EXTENSION_POINT_SIMPLE_ID); + if (extension != null) { + IExtension[] extensions = extension.getExtensions(); + for (IExtension ext : extensions) { + try { + @SuppressWarnings("unused") + String extensionID = ext.getUniqueIdentifier(); + for (IConfigurationElement cfgEl : ext.getConfigurationElements()) { + if (cfgEl.getName().equals(ELEM_ID_ASSOCIATION)) { + String id = cfgEl.getAttribute(ATTR_ID); + if (providerId.equals(id)) { + String pageClass = cfgEl.getAttribute(ATTR_PAGE); + if (pageClass != null && pageClass.trim().length() > 0) { + ICOptionPage page = (ICOptionPage) cfgEl.createExecutableExtension(ATTR_PAGE); + return page; + } + } + } + } + } catch (Exception e) { + CUIPlugin.log("Cannot load LanguageSettingsProviderAssociation extension " + ext.getUniqueIdentifier(), e); //$NON-NLS-1$ + } + } + } + } + return null; + } + + /** + * Create an Options page for language settings provider class by its name. + */ + private static ICOptionPage createOptionsPageByClass(String providerClassName) { + loadExtensions(); + + if (fRegisteredClasses.contains(providerClassName)) { + IExtensionRegistry registry = Platform.getExtensionRegistry(); + IExtensionPoint extension = registry.getExtensionPoint(CUIPlugin.PLUGIN_ID, PROVIDER_ASSOCIATION_EXTENSION_POINT_SIMPLE_ID); + if (extension != null) { + IExtension[] extensions = extension.getExtensions(); + for (IExtension ext : extensions) { + try { + @SuppressWarnings("unused") + String extensionID = ext.getUniqueIdentifier(); + for (IConfigurationElement cfgEl : ext.getConfigurationElements()) { + if (cfgEl.getName().equals(ELEM_CLASS_ASSOCIATION)) { + String className = cfgEl.getAttribute(ATTR_CLASS); + if (providerClassName.equals(className)) { + String pageClass = cfgEl.getAttribute(ATTR_PAGE); + if (pageClass!=null && pageClass.trim().length()>0) { + ICOptionPage page = (ICOptionPage) cfgEl.createExecutableExtension(ATTR_PAGE); + return page; + } + } + } + } + } catch (Exception e) { + CUIPlugin.log("Cannot load LanguageSettingsProviderAssociation extension " + ext.getUniqueIdentifier(), e); //$NON-NLS-1$ + } + } + } + } + return null; + } + + /** + * Returns Language Settings Provider image registered for closest superclass + * or interface. + * + * @param providerClass - class to find Language Settings Provider image. + * @return image or {@code null} + */ + public static URL getImage(Class providerClass) { + URL url = null; + + outer: for (Class c = providerClass; c != null; c = c.getSuperclass()) { + url = getImageURL(c); + if (url != null) { + break; + } + + // this does not check for super-interfaces, feel free to implement as needed + for (Class i : c.getInterfaces()) { + url = getImageURL(i); + if (url != null) { + break outer; + } + } + } + return url; + } + + /** + * Return image URL registered for the given class. + */ + private static URL getImageURL(Class clazz) { + String className = clazz.getCanonicalName(); + for (Entry entry : fImagesUrlByClass.entrySet()) { + if (entry.getKey().equals(className)) { + return entry.getValue(); + } + } + return null; + } + + /** + * Returns language settings provider Options page registered for closest superclass. + * + * @param provider - instance of provider to create Options page for. + * @return image or {@code null}. + */ + public static ICOptionPage createOptionsPage(ILanguageSettingsProvider provider) { + String id = provider.getId(); + ICOptionPage optionsPage = createOptionsPageById(id); + if (optionsPage != null) { + return optionsPage; + } + + Class clazz = provider.getClass(); + outer: for (Class c = clazz ;c != null; c = c.getSuperclass()) { + optionsPage = createOptionsPageByClass(c); + if (optionsPage != null) { + break; + } + + // this does not check for super-interfaces, feel free to implement as needed + for (Class i : c.getInterfaces()) { + optionsPage = createOptionsPageByClass(i); + if (optionsPage != null) { + break outer; + } + } + } + return optionsPage; + } + + /** + * Create an Options page for language settings provider class. + */ + private static ICOptionPage createOptionsPageByClass(Class clazz) { + ICOptionPage optionsPage = null; + String className = clazz.getCanonicalName(); + if (fRegisteredClasses.contains(className)) { + optionsPage = createOptionsPageByClass(className); + } + return optionsPage; + } + + /** + * Returns value of the attribute of the provider by id or closest superclass. + */ + private static boolean getBooleanAttribute(ILanguageSettingsProvider provider, String attr) { + loadExtensions(); + + String id = provider.getId(); + + Map properties = fAssociationsById.get(id); + if (properties != null) { + return Boolean.parseBoolean(properties.get(attr)); + } + + for (Class c = provider.getClass();c != null; c = c.getSuperclass()) { + String className = c.getCanonicalName(); + properties = fAssociationsByClass.get(className); + if (properties != null) { + return Boolean.parseBoolean(properties.get(attr)); + } + + // this does not check for superinterfaces, feel free to implement as needed + for (Class i : c.getInterfaces()) { + String interfaceName = i.getCanonicalName(); + properties = fAssociationsByClass.get(interfaceName); + if (properties != null) { + return Boolean.parseBoolean(properties.get(attr)); + } + } + } + return false; + } + + /** + * Check if the user is allowed to edit language settings provider entries in UI. + * @param provider - language settings provider. + * @return {@code true} if editing is allowed or {@code false} if not. + */ + public static boolean isAllowedToEditEntries(ILanguageSettingsProvider provider) { + return getBooleanAttribute(provider, ATTR_UI_EDIT_ENTRIES); + } + + /** + * Check if the user is allowed to clear language settings provider entries in UI. + * @param provider - language settings provider. + * @return {@code true} if clearing is allowed or {@code false} if not. + */ + public static boolean isAllowedToClear(ILanguageSettingsProvider provider) { + return getBooleanAttribute(provider, ATTR_UI_CLEAR_ENTRIES); + } + +} diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/language/settings/providers/LanguageSettingsProvidersLabelProvider.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/language/settings/providers/LanguageSettingsProvidersLabelProvider.java index b7c8598a6b8..9b305e7159f 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/language/settings/providers/LanguageSettingsProvidersLabelProvider.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/language/settings/providers/LanguageSettingsProvidersLabelProvider.java @@ -1,101 +1,101 @@ -/******************************************************************************* - * 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.internal.ui.language.settings.providers; - -import java.net.URL; - -import org.eclipse.jface.viewers.IDecoration; -import org.eclipse.jface.viewers.LabelProvider; -import org.eclipse.osgi.util.NLS; -import org.eclipse.swt.graphics.Image; - -import org.eclipse.cdt.core.language.settings.providers.ILanguageSettingsProvider; -import org.eclipse.cdt.core.language.settings.providers.LanguageSettingsManager; -import org.eclipse.cdt.ui.CDTSharedImages; - -import org.eclipse.cdt.internal.ui.newui.Messages; - -/** - * Label provider for language settings providers. - * - */ -public class LanguageSettingsProvidersLabelProvider extends LabelProvider { - private static final String TEST_PLUGIN_ID_PATTERN = "org.eclipse.cdt.*.tests.*"; //$NON-NLS-1$ - private static final String OOPS = "OOPS"; //$NON-NLS-1$ - - /** - * Returns base image key (for image without overlay). - */ - protected String getBaseKey(ILanguageSettingsProvider provider) { - String imageKey = null; - // try id-association - String id = provider.getId(); - URL url = LanguageSettingsProviderAssociationManager.getImageUrl(id); - // try class-association - if (url == null) { - ILanguageSettingsProvider rawProvider = LanguageSettingsManager.getRawProvider(provider); - if (rawProvider != null) { - url = LanguageSettingsProviderAssociationManager.getImage(rawProvider.getClass()); - } - } - if (url != null) { - imageKey = url.toString(); - } - - if (imageKey == null) { - if (id.matches(TEST_PLUGIN_ID_PATTERN)) { - imageKey = CDTSharedImages.IMG_OBJS_CDT_TESTING; - } else { - imageKey = CDTSharedImages.IMG_OBJS_EXTENSION; - } - } - return imageKey; - } - - /** - * Returns keys for image overlays. Returning {@code null} is not allowed. - */ - protected String[] getOverlayKeys(ILanguageSettingsProvider provider) { - String[] overlayKeys = new String[5]; - if (provider.getName() == null) { - overlayKeys[IDecoration.BOTTOM_LEFT] = CDTSharedImages.IMG_OVR_ERROR; - } - return overlayKeys; - } - - @Override - public Image getImage(Object element) { - if (element instanceof ILanguageSettingsProvider) { - ILanguageSettingsProvider provider = (ILanguageSettingsProvider)element; - String imageKey = getBaseKey(provider); - String[] overlayKeys = getOverlayKeys(provider); - return CDTSharedImages.getImageOverlaid(imageKey, overlayKeys); - } - return null; - } - - @Override - public String getText(Object element) { - if (element instanceof ILanguageSettingsProvider) { - ILanguageSettingsProvider provider = (ILanguageSettingsProvider) element; - String name = provider.getName(); - if (name != null) { - if (LanguageSettingsManager.isWorkspaceProvider(provider)) { - name = name + Messages.LanguageSettingsProvidersLabelProvider_TextDecorator_Shared; - } - return name; - } - return NLS.bind(Messages.GeneralMessages_NonAccessibleID, provider.getId()); - } - return OOPS; - } - +/******************************************************************************* + * 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.internal.ui.language.settings.providers; + +import java.net.URL; + +import org.eclipse.jface.viewers.IDecoration; +import org.eclipse.jface.viewers.LabelProvider; +import org.eclipse.osgi.util.NLS; +import org.eclipse.swt.graphics.Image; + +import org.eclipse.cdt.core.language.settings.providers.ILanguageSettingsProvider; +import org.eclipse.cdt.core.language.settings.providers.LanguageSettingsManager; +import org.eclipse.cdt.ui.CDTSharedImages; + +import org.eclipse.cdt.internal.ui.newui.Messages; + +/** + * Label provider for language settings providers. + * + */ +public class LanguageSettingsProvidersLabelProvider extends LabelProvider { + private static final String TEST_PLUGIN_ID_PATTERN = "org.eclipse.cdt.*.tests.*"; //$NON-NLS-1$ + private static final String OOPS = "OOPS"; //$NON-NLS-1$ + + /** + * Returns base image key (for image without overlay). + */ + protected String getBaseKey(ILanguageSettingsProvider provider) { + String imageKey = null; + // try id-association + String id = provider.getId(); + URL url = LanguageSettingsProviderAssociationManager.getImageUrl(id); + // try class-association + if (url == null) { + ILanguageSettingsProvider rawProvider = LanguageSettingsManager.getRawProvider(provider); + if (rawProvider != null) { + url = LanguageSettingsProviderAssociationManager.getImage(rawProvider.getClass()); + } + } + if (url != null) { + imageKey = url.toString(); + } + + if (imageKey == null) { + if (id.matches(TEST_PLUGIN_ID_PATTERN)) { + imageKey = CDTSharedImages.IMG_OBJS_CDT_TESTING; + } else { + imageKey = CDTSharedImages.IMG_OBJS_EXTENSION; + } + } + return imageKey; + } + + /** + * Returns keys for image overlays. Returning {@code null} is not allowed. + */ + protected String[] getOverlayKeys(ILanguageSettingsProvider provider) { + String[] overlayKeys = new String[5]; + if (provider.getName() == null) { + overlayKeys[IDecoration.BOTTOM_LEFT] = CDTSharedImages.IMG_OVR_ERROR; + } + return overlayKeys; + } + + @Override + public Image getImage(Object element) { + if (element instanceof ILanguageSettingsProvider) { + ILanguageSettingsProvider provider = (ILanguageSettingsProvider)element; + String imageKey = getBaseKey(provider); + String[] overlayKeys = getOverlayKeys(provider); + return CDTSharedImages.getImageOverlaid(imageKey, overlayKeys); + } + return null; + } + + @Override + public String getText(Object element) { + if (element instanceof ILanguageSettingsProvider) { + ILanguageSettingsProvider provider = (ILanguageSettingsProvider) element; + String name = provider.getName(); + if (name != null) { + if (LanguageSettingsManager.isWorkspaceProvider(provider)) { + name = name + Messages.LanguageSettingsProvidersLabelProvider_TextDecorator_Shared; + } + return name; + } + return NLS.bind(Messages.GeneralMessages_NonAccessibleID, provider.getId()); + } + return OOPS; + } + } \ No newline at end of file diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/newui/StatusMessageLine.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/newui/StatusMessageLine.java index 28a0b187e9d..4e786b96a1c 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/newui/StatusMessageLine.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/newui/StatusMessageLine.java @@ -1,81 +1,81 @@ -/******************************************************************************* - * 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.internal.ui.newui; - -import org.eclipse.core.runtime.IStatus; -import org.eclipse.jface.dialogs.Dialog; -import org.eclipse.jface.resource.JFaceResources; -import org.eclipse.swt.SWT; -import org.eclipse.swt.custom.CLabel; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.widgets.Composite; - -/** - * A message line displaying a status. - * See also org.eclipse.jface.dialogs.StatusDialog.MessageLine. - */ -public class StatusMessageLine { - private CLabel fLabel; - - /** - * Constructor. - * - * @param parent - parent element. - * @param style - the style of the control. Refer to {@link CLabel#CLabel(Composite, int)}. - * @param span - how many columns it should span. - */ - public StatusMessageLine(Composite parent, int style, int span) { - fLabel = new CLabel(parent, style); - if (span!=1) { - GridData gd = new GridData(SWT.FILL, SWT.NONE, true, false); - gd.horizontalSpan = span; - fLabel.setLayoutData(gd); - } - } - - /** - * Find an image associated with the status. - */ - private Image findImage(IStatus status) { - if (status.isOK()) { - return null; - } else if (status.matches(IStatus.ERROR)) { - return JFaceResources.getImage(Dialog.DLG_IMG_MESSAGE_ERROR); - } else if (status.matches(IStatus.WARNING)) { - return JFaceResources.getImage(Dialog.DLG_IMG_MESSAGE_WARNING); - } else if (status.matches(IStatus.INFO)) { - return JFaceResources.getImage(Dialog.DLG_IMG_MESSAGE_INFO); - } - return null; - } - - /** - * Assign {@link IStatus} object to the message line. The status should provide - * severity for the icon and message to display. - * - * @param status - status object for the message line. - */ - public void setErrorStatus(IStatus status) { - if (status != null && !status.isOK()) { - String message = status.getMessage(); - if (message != null && message.length() > 0) { - fLabel.setText(message); - fLabel.setImage(findImage(status)); - fLabel.layout(); - return; - } - } - fLabel.setText(""); //$NON-NLS-1$ - fLabel.setImage(null); - } + +package org.eclipse.cdt.internal.ui.newui; + +import org.eclipse.core.runtime.IStatus; +import org.eclipse.jface.dialogs.Dialog; +import org.eclipse.jface.resource.JFaceResources; +import org.eclipse.swt.SWT; +import org.eclipse.swt.custom.CLabel; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.widgets.Composite; + +/** + * A message line displaying a status. + * See also org.eclipse.jface.dialogs.StatusDialog.MessageLine. + */ +public class StatusMessageLine { + private CLabel fLabel; + + /** + * Constructor. + * + * @param parent - parent element. + * @param style - the style of the control. Refer to {@link CLabel#CLabel(Composite, int)}. + * @param span - how many columns it should span. + */ + public StatusMessageLine(Composite parent, int style, int span) { + fLabel = new CLabel(parent, style); + if (span!=1) { + GridData gd = new GridData(SWT.FILL, SWT.NONE, true, false); + gd.horizontalSpan = span; + fLabel.setLayoutData(gd); + } + } + + /** + * Find an image associated with the status. + */ + private Image findImage(IStatus status) { + if (status.isOK()) { + return null; + } else if (status.matches(IStatus.ERROR)) { + return JFaceResources.getImage(Dialog.DLG_IMG_MESSAGE_ERROR); + } else if (status.matches(IStatus.WARNING)) { + return JFaceResources.getImage(Dialog.DLG_IMG_MESSAGE_WARNING); + } else if (status.matches(IStatus.INFO)) { + return JFaceResources.getImage(Dialog.DLG_IMG_MESSAGE_INFO); + } + return null; + } + + /** + * Assign {@link IStatus} object to the message line. The status should provide + * severity for the icon and message to display. + * + * @param status - status object for the message line. + */ + public void setErrorStatus(IStatus status) { + if (status != null && !status.isOK()) { + String message = status.getMessage(); + if (message != null && message.length() > 0) { + fLabel.setText(message); + fLabel.setImage(findImage(status)); + fLabel.layout(); + return; + } + } + fLabel.setText(""); //$NON-NLS-1$ + fLabel.setImage(null); + } } \ No newline at end of file diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/extractlocalvariable/ExtractLocalVariableRefactoringContribution.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/extractlocalvariable/ExtractLocalVariableRefactoringContribution.java index 03591892266..ca77e54400d 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/extractlocalvariable/ExtractLocalVariableRefactoringContribution.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/extractlocalvariable/ExtractLocalVariableRefactoringContribution.java @@ -1,33 +1,33 @@ -/******************************************************************************* - * Copyright (c) 2009, 2012 Institute for Software, HSR Hochschule fuer Technik - * Rapperswil, University of applied sciences 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: - * Institute for Software (IFS)- initial API and implementation +/******************************************************************************* + * Copyright (c) 2009, 2012 Institute for Software, HSR Hochschule fuer Technik + * Rapperswil, University of applied sciences 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: + * Institute for Software (IFS)- initial API and implementation ******************************************************************************/ -package org.eclipse.cdt.internal.ui.refactoring.extractlocalvariable; - -import java.util.Map; - -import org.eclipse.ltk.core.refactoring.RefactoringDescriptor; - -import org.eclipse.cdt.internal.ui.refactoring.CRefactoringContribution; - -/** - * @author Emanuel Graf IFS - */ -public class ExtractLocalVariableRefactoringContribution extends CRefactoringContribution { - @SuppressWarnings({ "unchecked", "rawtypes" }) - @Override - public RefactoringDescriptor createDescriptor(String id, String project, String description, - String comment, Map arguments, int flags) throws IllegalArgumentException { - if (id.equals(ExtractLocalVariableRefactoring.ID)) { - return new ExtractLocalVariableRefactoringDescriptor(project, description, comment, arguments); - } - return null; - } -} +package org.eclipse.cdt.internal.ui.refactoring.extractlocalvariable; + +import java.util.Map; + +import org.eclipse.ltk.core.refactoring.RefactoringDescriptor; + +import org.eclipse.cdt.internal.ui.refactoring.CRefactoringContribution; + +/** + * @author Emanuel Graf IFS + */ +public class ExtractLocalVariableRefactoringContribution extends CRefactoringContribution { + @SuppressWarnings({ "unchecked", "rawtypes" }) + @Override + public RefactoringDescriptor createDescriptor(String id, String project, String description, + String comment, Map arguments, int flags) throws IllegalArgumentException { + if (id.equals(ExtractLocalVariableRefactoring.ID)) { + return new ExtractLocalVariableRefactoringDescriptor(project, description, comment, arguments); + } + return null; + } +} diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/extractlocalvariable/ExtractLocalVariableRefactoringDescriptor.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/extractlocalvariable/ExtractLocalVariableRefactoringDescriptor.java index d4efbd7b831..6d840c05b38 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/extractlocalvariable/ExtractLocalVariableRefactoringDescriptor.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/extractlocalvariable/ExtractLocalVariableRefactoringDescriptor.java @@ -1,48 +1,48 @@ -/******************************************************************************* - * Copyright (c) 2009, 2012 Institute for Software, HSR Hochschule fuer Technik - * Rapperswil, University of applied sciences 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: - * Institute for Software (IFS)- initial API and implementation - * Sergey Prigogin (Google) - ******************************************************************************/ -package org.eclipse.cdt.internal.ui.refactoring.extractlocalvariable; - -import java.util.Map; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.ltk.core.refactoring.RefactoringDescriptor; -import org.eclipse.ltk.core.refactoring.RefactoringStatus; - -import org.eclipse.cdt.core.model.ICProject; - -import org.eclipse.cdt.internal.ui.refactoring.CRefactoring; -import org.eclipse.cdt.internal.ui.refactoring.CRefactoringDescriptor; - -/** - * @author Emanuel Graf IFS - */ -public class ExtractLocalVariableRefactoringDescriptor extends CRefactoringDescriptor { - static protected final String NAME = "name"; //$NON-NLS-1$ - - public ExtractLocalVariableRefactoringDescriptor(String project, String description, - String comment, Map arguments) { - super(ExtractLocalVariableRefactoring.ID, project, description, comment, - RefactoringDescriptor.MULTI_CHANGE, arguments); - } - - @Override - public CRefactoring createRefactoring(RefactoringStatus status) throws CoreException { - ISelection selection = getSelection(); - ICProject proj = getCProject(); - ExtractLocalVariableRefactoring refactoring = - new ExtractLocalVariableRefactoring(getTranslationUnit(), selection, proj); - refactoring.getRefactoringInfo().setName(arguments.get(NAME)); - return refactoring; - } -} +/******************************************************************************* + * Copyright (c) 2009, 2012 Institute for Software, HSR Hochschule fuer Technik + * Rapperswil, University of applied sciences 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: + * Institute for Software (IFS)- initial API and implementation + * Sergey Prigogin (Google) + ******************************************************************************/ +package org.eclipse.cdt.internal.ui.refactoring.extractlocalvariable; + +import java.util.Map; + +import org.eclipse.core.runtime.CoreException; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.ltk.core.refactoring.RefactoringDescriptor; +import org.eclipse.ltk.core.refactoring.RefactoringStatus; + +import org.eclipse.cdt.core.model.ICProject; + +import org.eclipse.cdt.internal.ui.refactoring.CRefactoring; +import org.eclipse.cdt.internal.ui.refactoring.CRefactoringDescriptor; + +/** + * @author Emanuel Graf IFS + */ +public class ExtractLocalVariableRefactoringDescriptor extends CRefactoringDescriptor { + static protected final String NAME = "name"; //$NON-NLS-1$ + + public ExtractLocalVariableRefactoringDescriptor(String project, String description, + String comment, Map arguments) { + super(ExtractLocalVariableRefactoring.ID, project, description, comment, + RefactoringDescriptor.MULTI_CHANGE, arguments); + } + + @Override + public CRefactoring createRefactoring(RefactoringStatus status) throws CoreException { + ISelection selection = getSelection(); + ICProject proj = getCProject(); + ExtractLocalVariableRefactoring refactoring = + new ExtractLocalVariableRefactoring(getTranslationUnit(), selection, proj); + refactoring.getRefactoringInfo().setName(arguments.get(NAME)); + return refactoring; + } +} diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/extractlocalvariable/ExtractLocalVariableRefactoringRunner.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/extractlocalvariable/ExtractLocalVariableRefactoringRunner.java index 45b0fcdc77b..7b1c09ce2b6 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/extractlocalvariable/ExtractLocalVariableRefactoringRunner.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/extractlocalvariable/ExtractLocalVariableRefactoringRunner.java @@ -1,43 +1,43 @@ -/******************************************************************************* - * Copyright (c) 2008, 2012 Institute for Software, HSR Hochschule fuer Technik - * Rapperswil, University of applied sciences 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: - * Tom Ball (Google) - initial API and implementation - * Sergey Prigogin (Google) - *******************************************************************************/ -package org.eclipse.cdt.internal.ui.refactoring.extractlocalvariable; - -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.window.IShellProvider; - -import org.eclipse.cdt.core.model.ICElement; -import org.eclipse.cdt.core.model.ICProject; - -import org.eclipse.cdt.internal.ui.refactoring.RefactoringRunner; -import org.eclipse.cdt.internal.ui.refactoring.RefactoringSaveHelper; - -/** - * Extract Local Variable refactoring runner. - * - * @author Tom Ball - */ -public class ExtractLocalVariableRefactoringRunner extends RefactoringRunner { - - public ExtractLocalVariableRefactoringRunner(ICElement element, ISelection selection, - IShellProvider shellProvider, ICProject cProject) { - super(element, selection, shellProvider, cProject); - } - - @Override - public void run() { - ExtractLocalVariableRefactoring refactoring = - new ExtractLocalVariableRefactoring(element, selection, project); - ExtractLocalVariableWizard wizard = new ExtractLocalVariableWizard(refactoring); - run(wizard, refactoring, RefactoringSaveHelper.SAVE_NOTHING); - } -} +/******************************************************************************* + * Copyright (c) 2008, 2012 Institute for Software, HSR Hochschule fuer Technik + * Rapperswil, University of applied sciences 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: + * Tom Ball (Google) - initial API and implementation + * Sergey Prigogin (Google) + *******************************************************************************/ +package org.eclipse.cdt.internal.ui.refactoring.extractlocalvariable; + +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.jface.window.IShellProvider; + +import org.eclipse.cdt.core.model.ICElement; +import org.eclipse.cdt.core.model.ICProject; + +import org.eclipse.cdt.internal.ui.refactoring.RefactoringRunner; +import org.eclipse.cdt.internal.ui.refactoring.RefactoringSaveHelper; + +/** + * Extract Local Variable refactoring runner. + * + * @author Tom Ball + */ +public class ExtractLocalVariableRefactoringRunner extends RefactoringRunner { + + public ExtractLocalVariableRefactoringRunner(ICElement element, ISelection selection, + IShellProvider shellProvider, ICProject cProject) { + super(element, selection, shellProvider, cProject); + } + + @Override + public void run() { + ExtractLocalVariableRefactoring refactoring = + new ExtractLocalVariableRefactoring(element, selection, project); + ExtractLocalVariableWizard wizard = new ExtractLocalVariableWizard(refactoring); + run(wizard, refactoring, RefactoringSaveHelper.SAVE_NOTHING); + } +} diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/ICHEContentProvider.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/ICHEContentProvider.java index 21a5a5d3e81..50abf41fb81 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/ICHEContentProvider.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/ICHEContentProvider.java @@ -1,24 +1,24 @@ -/******************************************************************************* - * Copyright (c) 2018 Wind River Systems, Inc. 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: - * Lidia Popescu - [536255] initial API and implementation. Extension point for open call hierarchy view - *******************************************************************************/ -package org.eclipse.cdt.ui; - - -import org.eclipse.jface.viewers.IOpenListener; -/** - * The Call Hierarchy Extension Content Provider Interface - * @since 6.4 - * */ -public interface ICHEContentProvider { - - Object[] asyncComputeExtendedRoot(Object parentElement); - - IOpenListener getCCallHierarchyOpenListener(); -} +/******************************************************************************* + * Copyright (c) 2018 Wind River Systems, Inc. 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: + * Lidia Popescu - [536255] initial API and implementation. Extension point for open call hierarchy view + *******************************************************************************/ +package org.eclipse.cdt.ui; + + +import org.eclipse.jface.viewers.IOpenListener; +/** + * The Call Hierarchy Extension Content Provider Interface + * @since 6.4 + * */ +public interface ICHEContentProvider { + + Object[] asyncComputeExtendedRoot(Object parentElement); + + IOpenListener getCCallHierarchyOpenListener(); +} diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/ICHENode.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/ICHENode.java index 08e952d5fd0..378f4ffc63d 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/ICHENode.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/ICHENode.java @@ -1,23 +1,23 @@ -/******************************************************************************* - * Copyright (c) 2018 Wind River Systems, Inc. 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: - * Lidia Popescu - [536255] initial API and implementation. Extension point for open call hierarchy view - *******************************************************************************/ -package org.eclipse.cdt.ui; - - -import org.eclipse.cdt.core.model.ICElement; - -/** - * The Call Hierarchy Extension Node - * @since 6.4 - */ -public interface ICHENode { - - ICElement getRepresentedDeclaration(); -} +/******************************************************************************* + * Copyright (c) 2018 Wind River Systems, Inc. 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: + * Lidia Popescu - [536255] initial API and implementation. Extension point for open call hierarchy view + *******************************************************************************/ +package org.eclipse.cdt.ui; + + +import org.eclipse.cdt.core.model.ICElement; + +/** + * The Call Hierarchy Extension Node + * @since 6.4 + */ +public interface ICHENode { + + ICElement getRepresentedDeclaration(); +} diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/actions/WorkingSetConfigAction.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/actions/WorkingSetConfigAction.java index 5078610280a..b331f70e718 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/actions/WorkingSetConfigAction.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/actions/WorkingSetConfigAction.java @@ -1,84 +1,84 @@ -/******************************************************************************* - * Copyright (c) 2008, 2009, 2012 Intel Corporation, 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: - * Intel Corporation - initial API and implementation - * QNX Software Systems - [272416] Rework the config sets dialog - * Freescale Semiconductor - [392954] disable the action if only empty working sets exist - *******************************************************************************/ -package org.eclipse.cdt.ui.actions; - -import org.eclipse.jface.action.IAction; -import org.eclipse.jface.util.IPropertyChangeListener; -import org.eclipse.jface.util.PropertyChangeEvent; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.ui.IWorkbenchWindow; -import org.eclipse.ui.IWorkbenchWindowActionDelegate; -import org.eclipse.ui.IWorkingSet; -import org.eclipse.ui.IWorkingSetManager; - -import org.eclipse.cdt.ui.CUIPlugin; - -import org.eclipse.cdt.internal.ui.workingsets.WorkingSetConfigurationDialog; - -/** - */ -public class WorkingSetConfigAction implements IWorkbenchWindowActionDelegate, IPropertyChangeListener { - - private static final IWorkingSetManager wsm = CUIPlugin.getDefault().getWorkbench().getWorkingSetManager(); - private boolean enabled = true; - private IWorkbenchWindow window; - private IAction action; - - @Override - public void run(IAction action) { - this.action = action; - checkWS(); - if (enabled) { - new WorkingSetConfigurationDialog(window.getShell()).open(); - } - } - - @Override - public void selectionChanged(IAction action, ISelection selection) { - this.action = action; - checkWS(); - } - - @Override - public void dispose() { - wsm.removePropertyChangeListener(this); - } - - @Override - public void init(IWorkbenchWindow window) { - this.window = window; - wsm.addPropertyChangeListener(this); - checkWS(); - } - - private void checkWS() { - enabled = false; - IWorkingSet[] w = wsm.getWorkingSets(); - if (w == null) - w = new IWorkingSet[0]; - for (IWorkingSet ws : w) { - if (!ws.isEmpty()) { - enabled = true; - break; - } - } - if (action != null) { - action.setEnabled(enabled); - } - } - - @Override - public void propertyChange(PropertyChangeEvent event) { - checkWS(); - } -} +/******************************************************************************* + * Copyright (c) 2008, 2009, 2012 Intel Corporation, 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: + * Intel Corporation - initial API and implementation + * QNX Software Systems - [272416] Rework the config sets dialog + * Freescale Semiconductor - [392954] disable the action if only empty working sets exist + *******************************************************************************/ +package org.eclipse.cdt.ui.actions; + +import org.eclipse.jface.action.IAction; +import org.eclipse.jface.util.IPropertyChangeListener; +import org.eclipse.jface.util.PropertyChangeEvent; +import org.eclipse.jface.viewers.ISelection; +import org.eclipse.ui.IWorkbenchWindow; +import org.eclipse.ui.IWorkbenchWindowActionDelegate; +import org.eclipse.ui.IWorkingSet; +import org.eclipse.ui.IWorkingSetManager; + +import org.eclipse.cdt.ui.CUIPlugin; + +import org.eclipse.cdt.internal.ui.workingsets.WorkingSetConfigurationDialog; + +/** + */ +public class WorkingSetConfigAction implements IWorkbenchWindowActionDelegate, IPropertyChangeListener { + + private static final IWorkingSetManager wsm = CUIPlugin.getDefault().getWorkbench().getWorkingSetManager(); + private boolean enabled = true; + private IWorkbenchWindow window; + private IAction action; + + @Override + public void run(IAction action) { + this.action = action; + checkWS(); + if (enabled) { + new WorkingSetConfigurationDialog(window.getShell()).open(); + } + } + + @Override + public void selectionChanged(IAction action, ISelection selection) { + this.action = action; + checkWS(); + } + + @Override + public void dispose() { + wsm.removePropertyChangeListener(this); + } + + @Override + public void init(IWorkbenchWindow window) { + this.window = window; + wsm.addPropertyChangeListener(this); + checkWS(); + } + + private void checkWS() { + enabled = false; + IWorkingSet[] w = wsm.getWorkingSets(); + if (w == null) + w = new IWorkingSet[0]; + for (IWorkingSet ws : w) { + if (!ws.isEmpty()) { + enabled = true; + break; + } + } + if (action != null) { + action.setEnabled(enabled); + } + } + + @Override + public void propertyChange(PropertyChangeEvent event) { + checkWS(); + } +} diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/language/settings/providers/AbstractLanguageSettingProviderOptionPage.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/language/settings/providers/AbstractLanguageSettingProviderOptionPage.java index a9352ab0b77..298c620fac9 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/language/settings/providers/AbstractLanguageSettingProviderOptionPage.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/language/settings/providers/AbstractLanguageSettingProviderOptionPage.java @@ -1,88 +1,88 @@ -/******************************************************************************* - * 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.ui.language.settings.providers; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IProgressMonitor; - -import org.eclipse.cdt.core.language.settings.providers.ILanguageSettingsProvider; -import org.eclipse.cdt.core.language.settings.providers.LanguageSettingsManager; -import org.eclipse.cdt.ui.dialogs.AbstractCOptionPage; -import org.eclipse.cdt.ui.newui.AbstractCPropertyTab; - -import org.eclipse.cdt.internal.ui.language.settings.providers.LanguageSettingsProviderTab; - -/** - * Abstract class to implement language settings providers Options page. - * - *

    - * EXPERIMENTAL. This class interface is not stable yet as - * it is not currently clear how it may need to be used in future. Only bare - * minimum is provided here at this point (CDT 8.1, Juno). - * There is no guarantee that this API will work or that it will remain the same. - * Please do not use this API without consulting with the CDT team. - *

    - * @noextend This class is not intended to be subclassed by clients, only internally by CDT. - * - * @since 5.4 - */ -public abstract class AbstractLanguageSettingProviderOptionPage extends AbstractCOptionPage { - protected LanguageSettingsProviderTab providerTab; - protected String providerId; - - /** - * Initialize the options page with the owning tab and provider ID. - * - * @param providerTab - provider tab which owns the options page. - * @param providerId - ID of the provider the options page is for. - */ - public void init(AbstractCPropertyTab providerTab, String providerId) { - this.providerTab = (LanguageSettingsProviderTab) providerTab; - this.providerId = providerId; - } - - /** - * Get provider being displayed on this Options Page. - * @return provider. - */ - public ILanguageSettingsProvider getProvider() { - return LanguageSettingsManager.getRawProvider(providerTab.getProvider(providerId)); - } - - /** - * Get working copy of the provider to allow its options to be modified. - * @return working copy of the provider. - */ - public ILanguageSettingsProvider getProviderWorkingCopy() { - return providerTab.getWorkingCopy(providerId); - } - - /** - * Refresh provider item in the table and update buttons. - * This method is intended for use by an Options Page of the provider. - * - * @param provider - provider item in the table to refresh. - */ - public void refreshItem(ILanguageSettingsProvider provider) { - providerTab.refreshItem(provider); - } - - @Override - public void performApply(IProgressMonitor monitor) throws CoreException { - // normally should be handled by LanguageSettingsProviderTab - } - - @Override - public void performDefaults() { - // normally should be handled by LanguageSettingsProviderTab - } - -} +/******************************************************************************* + * 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.ui.language.settings.providers; + +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IProgressMonitor; + +import org.eclipse.cdt.core.language.settings.providers.ILanguageSettingsProvider; +import org.eclipse.cdt.core.language.settings.providers.LanguageSettingsManager; +import org.eclipse.cdt.ui.dialogs.AbstractCOptionPage; +import org.eclipse.cdt.ui.newui.AbstractCPropertyTab; + +import org.eclipse.cdt.internal.ui.language.settings.providers.LanguageSettingsProviderTab; + +/** + * Abstract class to implement language settings providers Options page. + * + *

    + * EXPERIMENTAL. This class interface is not stable yet as + * it is not currently clear how it may need to be used in future. Only bare + * minimum is provided here at this point (CDT 8.1, Juno). + * There is no guarantee that this API will work or that it will remain the same. + * Please do not use this API without consulting with the CDT team. + *

    + * @noextend This class is not intended to be subclassed by clients, only internally by CDT. + * + * @since 5.4 + */ +public abstract class AbstractLanguageSettingProviderOptionPage extends AbstractCOptionPage { + protected LanguageSettingsProviderTab providerTab; + protected String providerId; + + /** + * Initialize the options page with the owning tab and provider ID. + * + * @param providerTab - provider tab which owns the options page. + * @param providerId - ID of the provider the options page is for. + */ + public void init(AbstractCPropertyTab providerTab, String providerId) { + this.providerTab = (LanguageSettingsProviderTab) providerTab; + this.providerId = providerId; + } + + /** + * Get provider being displayed on this Options Page. + * @return provider. + */ + public ILanguageSettingsProvider getProvider() { + return LanguageSettingsManager.getRawProvider(providerTab.getProvider(providerId)); + } + + /** + * Get working copy of the provider to allow its options to be modified. + * @return working copy of the provider. + */ + public ILanguageSettingsProvider getProviderWorkingCopy() { + return providerTab.getWorkingCopy(providerId); + } + + /** + * Refresh provider item in the table and update buttons. + * This method is intended for use by an Options Page of the provider. + * + * @param provider - provider item in the table to refresh. + */ + public void refreshItem(ILanguageSettingsProvider provider) { + providerTab.refreshItem(provider); + } + + @Override + public void performApply(IProgressMonitor monitor) throws CoreException { + // normally should be handled by LanguageSettingsProviderTab + } + + @Override + public void performDefaults() { + // normally should be handled by LanguageSettingsProviderTab + } + +} diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/language/settings/providers/LanguageSettingsProvidersImages.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/language/settings/providers/LanguageSettingsProvidersImages.java index 7317e6e8c4c..e88fe13eb06 100644 --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/language/settings/providers/LanguageSettingsProvidersImages.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/language/settings/providers/LanguageSettingsProvidersImages.java @@ -1,33 +1,33 @@ -/******************************************************************************* - * Copyright (c) 2012, 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.ui.language.settings.providers; - -import java.net.URL; - -import org.eclipse.cdt.internal.ui.language.settings.providers.LanguageSettingsProviderAssociationManager; - -/** - * Utility class to provide API for language settings providers images. - * - * @since 5.4 - */ -public class LanguageSettingsProvidersImages { - /** - * Get image URL for language settings provider with the given ID. - * - * @param providerId - ID of language settings provider. - * @return image URL or {@code null}. - */ - public static URL getImageUrl(String providerId) { - return LanguageSettingsProviderAssociationManager.getImageUrl(providerId); - } - -} +/******************************************************************************* + * Copyright (c) 2012, 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.ui.language.settings.providers; + +import java.net.URL; + +import org.eclipse.cdt.internal.ui.language.settings.providers.LanguageSettingsProviderAssociationManager; + +/** + * Utility class to provide API for language settings providers images. + * + * @since 5.4 + */ +public class LanguageSettingsProvidersImages { + /** + * Get image URL for language settings provider with the given ID. + * + * @param providerId - ID of language settings provider. + * @return image URL or {@code null}. + */ + public static URL getImageUrl(String providerId) { + return LanguageSettingsProviderAssociationManager.getImageUrl(providerId); + } + +} diff --git a/cross/org.eclipse.cdt.build.crossgcc/.classpath b/cross/org.eclipse.cdt.build.crossgcc/.classpath index b862a296d38..eca7bdba8f0 100644 --- a/cross/org.eclipse.cdt.build.crossgcc/.classpath +++ b/cross/org.eclipse.cdt.build.crossgcc/.classpath @@ -1,7 +1,7 @@ - - - - - - - + + + + + + + diff --git a/cross/org.eclipse.cdt.build.crossgcc/.settings/org.eclipse.jdt.core.prefs b/cross/org.eclipse.cdt.build.crossgcc/.settings/org.eclipse.jdt.core.prefs index 2eed35de4b7..86a6dab55c4 100644 --- a/cross/org.eclipse.cdt.build.crossgcc/.settings/org.eclipse.jdt.core.prefs +++ b/cross/org.eclipse.cdt.build.crossgcc/.settings/org.eclipse.jdt.core.prefs @@ -1,8 +1,8 @@ -#Wed Nov 16 18:18:23 EST 2011 -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.compliance=1.8 -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.8 +#Wed Nov 16 18:18:23 EST 2011 +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.compliance=1.8 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.8 diff --git a/cross/org.eclipse.cdt.build.crossgcc/src/org/eclipse/cdt/internal/build/crossgcc/Messages.java b/cross/org.eclipse.cdt.build.crossgcc/src/org/eclipse/cdt/internal/build/crossgcc/Messages.java index 7dc2f139283..52a652e5ed6 100644 --- a/cross/org.eclipse.cdt.build.crossgcc/src/org/eclipse/cdt/internal/build/crossgcc/Messages.java +++ b/cross/org.eclipse.cdt.build.crossgcc/src/org/eclipse/cdt/internal/build/crossgcc/Messages.java @@ -1,30 +1,30 @@ -/******************************************************************************* - * Copyright (c) 2011, 2014 Marc-Andre Laperle 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: - * Marc-Andre Laperle - initial API and implementation +/******************************************************************************* + * Copyright (c) 2011, 2014 Marc-Andre Laperle 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: + * Marc-Andre Laperle - initial API and implementation *******************************************************************************/ -package org.eclipse.cdt.internal.build.crossgcc; - -import org.eclipse.osgi.util.NLS; - -public class Messages extends NLS { - public static String SetCrossCommandWizardPage_browse; - public static String SetCrossCommandWizardPage_description; - public static String SetCrossCommandWizardPage_name; - public static String SetCrossCommandWizardPage_path; - public static String SetCrossCommandWizardPage_prefix; - public static String SetCrossCommandWizardPage_title; - - static { - // Initialize resource bundle. - NLS.initializeMessages(Messages.class.getName(), Messages.class); - } - - private Messages() { - } -} +package org.eclipse.cdt.internal.build.crossgcc; + +import org.eclipse.osgi.util.NLS; + +public class Messages extends NLS { + public static String SetCrossCommandWizardPage_browse; + public static String SetCrossCommandWizardPage_description; + public static String SetCrossCommandWizardPage_name; + public static String SetCrossCommandWizardPage_path; + public static String SetCrossCommandWizardPage_prefix; + public static String SetCrossCommandWizardPage_title; + + static { + // Initialize resource bundle. + NLS.initializeMessages(Messages.class.getName(), Messages.class); + } + + private Messages() { + } +} diff --git a/cross/org.eclipse.cdt.build.crossgcc/src/org/eclipse/cdt/internal/build/crossgcc/Messages.properties b/cross/org.eclipse.cdt.build.crossgcc/src/org/eclipse/cdt/internal/build/crossgcc/Messages.properties index aed22f3dc2a..bd386dc7a89 100644 --- a/cross/org.eclipse.cdt.build.crossgcc/src/org/eclipse/cdt/internal/build/crossgcc/Messages.properties +++ b/cross/org.eclipse.cdt.build.crossgcc/src/org/eclipse/cdt/internal/build/crossgcc/Messages.properties @@ -1,16 +1,16 @@ -############################################################################### -# Copyright (c) 2011, 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 -############################################################################### -SetCrossCommandWizardPage_browse=Browse... -SetCrossCommandWizardPage_description=Configure the Cross GCC path and prefix -SetCrossCommandWizardPage_name=Cross GCC Command Wizard Page -SetCrossCommandWizardPage_path=Cross compiler path: -SetCrossCommandWizardPage_prefix=Cross compiler prefix: -SetCrossCommandWizardPage_title=Cross GCC Command +############################################################################### +# Copyright (c) 2011, 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 +############################################################################### +SetCrossCommandWizardPage_browse=Browse... +SetCrossCommandWizardPage_description=Configure the Cross GCC path and prefix +SetCrossCommandWizardPage_name=Cross GCC Command Wizard Page +SetCrossCommandWizardPage_path=Cross compiler path: +SetCrossCommandWizardPage_prefix=Cross compiler prefix: +SetCrossCommandWizardPage_title=Cross GCC Command diff --git a/cross/org.eclipse.cdt.build.crossgcc/src/org/eclipse/cdt/internal/build/crossgcc/SetCrossCommandOperation.java b/cross/org.eclipse.cdt.build.crossgcc/src/org/eclipse/cdt/internal/build/crossgcc/SetCrossCommandOperation.java index 89aaf7d8f6a..52e999b02f1 100644 --- a/cross/org.eclipse.cdt.build.crossgcc/src/org/eclipse/cdt/internal/build/crossgcc/SetCrossCommandOperation.java +++ b/cross/org.eclipse.cdt.build.crossgcc/src/org/eclipse/cdt/internal/build/crossgcc/SetCrossCommandOperation.java @@ -1,66 +1,66 @@ -/******************************************************************************* - * Copyright (c) 2009, 2013 Wind River Systems, Inc. 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: - * Doug Schaefer - initial API and implementation - * Marc-Andre Laperle - Moved to an operation for a custom wizard page - *******************************************************************************/ -package org.eclipse.cdt.internal.build.crossgcc; -import java.lang.reflect.InvocationTargetException; - -import org.eclipse.cdt.core.templateengine.SharedDefaults; -import org.eclipse.cdt.managedbuilder.core.IConfiguration; -import org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo; -import org.eclipse.cdt.managedbuilder.core.IOption; -import org.eclipse.cdt.managedbuilder.core.IToolChain; -import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager; -import org.eclipse.cdt.managedbuilder.ui.wizards.MBSCustomPageManager; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.jface.operation.IRunnableWithProgress; - -/** - * An operation that runs when the new project wizard finishes for the Cross GCC toolchain. - * It reuses the information from {@link SetCrossCommandWizardPage} to set build options (prefix and path). - * It also clears and reruns scanner discovery to account for the modified command. - * - */ -public class SetCrossCommandOperation implements IRunnableWithProgress { - - public void run(IProgressMonitor monitor) throws InvocationTargetException, - InterruptedException { - - String projectName = (String) MBSCustomPageManager.getPageProperty(SetCrossCommandWizardPage.PAGE_ID, SetCrossCommandWizardPage.CROSS_PROJECT_NAME); - String prefix = (String) MBSCustomPageManager.getPageProperty(SetCrossCommandWizardPage.PAGE_ID, SetCrossCommandWizardPage.CROSS_COMMAND_PREFIX); - String path = (String) MBSCustomPageManager.getPageProperty(SetCrossCommandWizardPage.PAGE_ID, SetCrossCommandWizardPage.CROSS_COMMAND_PATH); - - SharedDefaults.getInstance().getSharedDefaultsMap().put(SetCrossCommandWizardPage.SHARED_DEFAULTS_PATH_KEY, path); - SharedDefaults.getInstance().getSharedDefaultsMap().put(SetCrossCommandWizardPage.SHARED_DEFAULTS_PREFIX_KEY, prefix); - SharedDefaults.getInstance().updateShareDefaultsMap(SharedDefaults.getInstance().getSharedDefaultsMap()); - - IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName); - if (!project.exists()) - return; - - IManagedBuildInfo buildInfo = ManagedBuildManager.getBuildInfo(project); - if (buildInfo == null) - return; - - IConfiguration[] configs = buildInfo.getManagedProject().getConfigurations(); - for (IConfiguration config : configs) { - IToolChain toolchain = config.getToolChain(); - IOption option = toolchain.getOptionBySuperClassId("cdt.managedbuild.option.gnu.cross.prefix"); //$NON-NLS-1$ - ManagedBuildManager.setOption(config, toolchain, option, prefix); - option = toolchain.getOptionBySuperClassId("cdt.managedbuild.option.gnu.cross.path"); //$NON-NLS-1$ - ManagedBuildManager.setOption(config, toolchain, option, path); - } - - ManagedBuildManager.saveBuildInfo(project, true); - } - -} +/******************************************************************************* + * Copyright (c) 2009, 2013 Wind River Systems, Inc. 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: + * Doug Schaefer - initial API and implementation + * Marc-Andre Laperle - Moved to an operation for a custom wizard page + *******************************************************************************/ +package org.eclipse.cdt.internal.build.crossgcc; +import java.lang.reflect.InvocationTargetException; + +import org.eclipse.cdt.core.templateengine.SharedDefaults; +import org.eclipse.cdt.managedbuilder.core.IConfiguration; +import org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo; +import org.eclipse.cdt.managedbuilder.core.IOption; +import org.eclipse.cdt.managedbuilder.core.IToolChain; +import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager; +import org.eclipse.cdt.managedbuilder.ui.wizards.MBSCustomPageManager; +import org.eclipse.core.resources.IProject; +import org.eclipse.core.resources.ResourcesPlugin; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.jface.operation.IRunnableWithProgress; + +/** + * An operation that runs when the new project wizard finishes for the Cross GCC toolchain. + * It reuses the information from {@link SetCrossCommandWizardPage} to set build options (prefix and path). + * It also clears and reruns scanner discovery to account for the modified command. + * + */ +public class SetCrossCommandOperation implements IRunnableWithProgress { + + public void run(IProgressMonitor monitor) throws InvocationTargetException, + InterruptedException { + + String projectName = (String) MBSCustomPageManager.getPageProperty(SetCrossCommandWizardPage.PAGE_ID, SetCrossCommandWizardPage.CROSS_PROJECT_NAME); + String prefix = (String) MBSCustomPageManager.getPageProperty(SetCrossCommandWizardPage.PAGE_ID, SetCrossCommandWizardPage.CROSS_COMMAND_PREFIX); + String path = (String) MBSCustomPageManager.getPageProperty(SetCrossCommandWizardPage.PAGE_ID, SetCrossCommandWizardPage.CROSS_COMMAND_PATH); + + SharedDefaults.getInstance().getSharedDefaultsMap().put(SetCrossCommandWizardPage.SHARED_DEFAULTS_PATH_KEY, path); + SharedDefaults.getInstance().getSharedDefaultsMap().put(SetCrossCommandWizardPage.SHARED_DEFAULTS_PREFIX_KEY, prefix); + SharedDefaults.getInstance().updateShareDefaultsMap(SharedDefaults.getInstance().getSharedDefaultsMap()); + + IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName); + if (!project.exists()) + return; + + IManagedBuildInfo buildInfo = ManagedBuildManager.getBuildInfo(project); + if (buildInfo == null) + return; + + IConfiguration[] configs = buildInfo.getManagedProject().getConfigurations(); + for (IConfiguration config : configs) { + IToolChain toolchain = config.getToolChain(); + IOption option = toolchain.getOptionBySuperClassId("cdt.managedbuild.option.gnu.cross.prefix"); //$NON-NLS-1$ + ManagedBuildManager.setOption(config, toolchain, option, prefix); + option = toolchain.getOptionBySuperClassId("cdt.managedbuild.option.gnu.cross.path"); //$NON-NLS-1$ + ManagedBuildManager.setOption(config, toolchain, option, path); + } + + ManagedBuildManager.saveBuildInfo(project, true); + } + +} diff --git a/cross/org.eclipse.cdt.launch.serial-feature/.project b/cross/org.eclipse.cdt.launch.serial-feature/.project index acb0250e3e2..5a3db9614fc 100644 --- a/cross/org.eclipse.cdt.launch.serial-feature/.project +++ b/cross/org.eclipse.cdt.launch.serial-feature/.project @@ -1,17 +1,17 @@ - - - org.eclipse.cdt.launch.serial-feature - - - - - - org.eclipse.pde.FeatureBuilder - - - - - - org.eclipse.pde.FeatureNature - - + + + org.eclipse.cdt.launch.serial-feature + + + + + + org.eclipse.pde.FeatureBuilder + + + + + + org.eclipse.pde.FeatureNature + + diff --git a/cross/org.eclipse.cdt.launch.serial-feature/build.properties b/cross/org.eclipse.cdt.launch.serial-feature/build.properties index 3104d6d76e7..b3a611b5c93 100644 --- a/cross/org.eclipse.cdt.launch.serial-feature/build.properties +++ b/cross/org.eclipse.cdt.launch.serial-feature/build.properties @@ -1,2 +1,2 @@ -bin.includes = feature.xml,\ - feature.properties +bin.includes = feature.xml,\ + feature.properties diff --git a/cross/org.eclipse.cdt.launch.serial-feature/feature.properties b/cross/org.eclipse.cdt.launch.serial-feature/feature.properties index e205deff831..e875fb0969f 100644 --- a/cross/org.eclipse.cdt.launch.serial-feature/feature.properties +++ b/cross/org.eclipse.cdt.launch.serial-feature/feature.properties @@ -1,17 +1,17 @@ -############################################################################### -# 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 -############################################################################### - -featureName=C/C++ Launch over Serial -providerName=Eclipse CDT -description=Coordination for launching over a serial port that is also used for terminal access. -copyright=\ -Copyright (c) 2017 QNX Software Systems and others.\n\ -All rights reserved. This program and the accompanying materials\n\ -are made available under the terms of the Eclipse Public License v1.0\n\ -which accompanies this distribution, and is available at\n\ -http://www.eclipse.org/legal/epl-v10.html +############################################################################### +# 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 +############################################################################### + +featureName=C/C++ Launch over Serial +providerName=Eclipse CDT +description=Coordination for launching over a serial port that is also used for terminal access. +copyright=\ +Copyright (c) 2017 QNX Software Systems and others.\n\ +All rights reserved. This program and the accompanying materials\n\ +are made available under the terms of the Eclipse Public License v1.0\n\ +which accompanies this distribution, and is available at\n\ +http://www.eclipse.org/legal/epl-v10.html diff --git a/cross/org.eclipse.cdt.launch.serial-feature/feature.xml b/cross/org.eclipse.cdt.launch.serial-feature/feature.xml index d47d406d1be..70757bbb49e 100644 --- a/cross/org.eclipse.cdt.launch.serial-feature/feature.xml +++ b/cross/org.eclipse.cdt.launch.serial-feature/feature.xml @@ -1,35 +1,35 @@ - - - - - %description - - - - %copyright - - - - %license - - - - - - - + + + + + %description + + + + %copyright + + + + %license + + + + + + + diff --git a/cross/org.eclipse.cdt.launch.serial.core/.classpath b/cross/org.eclipse.cdt.launch.serial.core/.classpath index b862a296d38..eca7bdba8f0 100644 --- a/cross/org.eclipse.cdt.launch.serial.core/.classpath +++ b/cross/org.eclipse.cdt.launch.serial.core/.classpath @@ -1,7 +1,7 @@ - - - - - - - + + + + + + + diff --git a/cross/org.eclipse.cdt.launch.serial.core/.project b/cross/org.eclipse.cdt.launch.serial.core/.project index 0bad6ef6c55..26dde19dd6d 100644 --- a/cross/org.eclipse.cdt.launch.serial.core/.project +++ b/cross/org.eclipse.cdt.launch.serial.core/.project @@ -1,28 +1,28 @@ - - - org.eclipse.cdt.launch.serial.core - - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.pde.ManifestBuilder - - - - - org.eclipse.pde.SchemaBuilder - - - - - - org.eclipse.pde.PluginNature - org.eclipse.jdt.core.javanature - - + + + org.eclipse.cdt.launch.serial.core + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + + diff --git a/cross/org.eclipse.cdt.launch.serial.core/.settings/org.eclipse.jdt.core.prefs b/cross/org.eclipse.cdt.launch.serial.core/.settings/org.eclipse.jdt.core.prefs index 295926d9641..0c68a61dca8 100644 --- a/cross/org.eclipse.cdt.launch.serial.core/.settings/org.eclipse.jdt.core.prefs +++ b/cross/org.eclipse.cdt.launch.serial.core/.settings/org.eclipse.jdt.core.prefs @@ -1,7 +1,7 @@ -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.compliance=1.8 -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.8 +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.compliance=1.8 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.8 diff --git a/cross/org.eclipse.cdt.launch.serial.core/build.properties b/cross/org.eclipse.cdt.launch.serial.core/build.properties index 2d575990465..786b1df9364 100644 --- a/cross/org.eclipse.cdt.launch.serial.core/build.properties +++ b/cross/org.eclipse.cdt.launch.serial.core/build.properties @@ -1,6 +1,6 @@ -source.. = src/ -output.. = bin/ -bin.includes = META-INF/,\ - .,\ - plugin.xml,\ - about.html +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + .,\ + plugin.xml,\ + about.html diff --git a/cross/org.eclipse.cdt.launch.serial.core/plugin.xml b/cross/org.eclipse.cdt.launch.serial.core/plugin.xml index 537bc36e76b..7ca6053ce00 100644 --- a/cross/org.eclipse.cdt.launch.serial.core/plugin.xml +++ b/cross/org.eclipse.cdt.launch.serial.core/plugin.xml @@ -1,29 +1,29 @@ - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + diff --git a/cross/org.eclipse.cdt.launch.serial.core/src/org/eclipse/cdt/launch/serial/SerialFlashLaunchTargetProvider.java b/cross/org.eclipse.cdt.launch.serial.core/src/org/eclipse/cdt/launch/serial/SerialFlashLaunchTargetProvider.java index ec3e47f63c6..53a814c3637 100644 --- a/cross/org.eclipse.cdt.launch.serial.core/src/org/eclipse/cdt/launch/serial/SerialFlashLaunchTargetProvider.java +++ b/cross/org.eclipse.cdt.launch.serial.core/src/org/eclipse/cdt/launch/serial/SerialFlashLaunchTargetProvider.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.launch.serial; - -import org.eclipse.launchbar.core.target.ILaunchTarget; -import org.eclipse.launchbar.core.target.ILaunchTargetManager; -import org.eclipse.launchbar.core.target.ILaunchTargetProvider; -import org.eclipse.launchbar.core.target.TargetStatus; - -/** - * Launch Target used to flash images to a device over a serial port, usually - * USB serial. - */ -public class SerialFlashLaunchTargetProvider implements ILaunchTargetProvider { - - public static final String TYPE_ID = "org.eclipse.cdt.launch.serial.core.serialFlashTarget"; //$NON-NLS-1$ - - public static final String ATTR_SERIAL_PORT = "org.eclipse.cdt.launch.serial.core.serialPort"; //$NON-NLS-1$ - - @Override - public void init(ILaunchTargetManager targetManager) { - // Nothing to do at init time - } - - @Override - public TargetStatus getStatus(ILaunchTarget target) { - // Always OK - return TargetStatus.OK_STATUS; - } - -} +/******************************************************************************* + * 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.launch.serial; + +import org.eclipse.launchbar.core.target.ILaunchTarget; +import org.eclipse.launchbar.core.target.ILaunchTargetManager; +import org.eclipse.launchbar.core.target.ILaunchTargetProvider; +import org.eclipse.launchbar.core.target.TargetStatus; + +/** + * Launch Target used to flash images to a device over a serial port, usually + * USB serial. + */ +public class SerialFlashLaunchTargetProvider implements ILaunchTargetProvider { + + public static final String TYPE_ID = "org.eclipse.cdt.launch.serial.core.serialFlashTarget"; //$NON-NLS-1$ + + public static final String ATTR_SERIAL_PORT = "org.eclipse.cdt.launch.serial.core.serialPort"; //$NON-NLS-1$ + + @Override + public void init(ILaunchTargetManager targetManager) { + // Nothing to do at init time + } + + @Override + public TargetStatus getStatus(ILaunchTarget target) { + // Always OK + return TargetStatus.OK_STATUS; + } + +} diff --git a/cross/org.eclipse.cdt.launch.serial.core/src/org/eclipse/cdt/launch/serial/internal/Activator.java b/cross/org.eclipse.cdt.launch.serial.core/src/org/eclipse/cdt/launch/serial/internal/Activator.java index ca9822e4d29..b197e1574bd 100644 --- a/cross/org.eclipse.cdt.launch.serial.core/src/org/eclipse/cdt/launch/serial/internal/Activator.java +++ b/cross/org.eclipse.cdt.launch.serial.core/src/org/eclipse/cdt/launch/serial/internal/Activator.java @@ -1,30 +1,30 @@ -/******************************************************************************* - * 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.launch.serial.internal; - -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Plugin; -import org.osgi.framework.BundleContext; - -public class Activator extends Plugin { - - public static final String PLUGIN_ID = "org.eclipse.cdt.launch.serial.core"; //$NON-NLS-1$ - - private static Activator plugin; - - @Override - public void start(BundleContext context) throws Exception { - super.start(context); - plugin = this; - } - - public static void log(IStatus status) { - plugin.getLog().log(status); - } - -} +/******************************************************************************* + * 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.launch.serial.internal; + +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Plugin; +import org.osgi.framework.BundleContext; + +public class Activator extends Plugin { + + public static final String PLUGIN_ID = "org.eclipse.cdt.launch.serial.core"; //$NON-NLS-1$ + + private static Activator plugin; + + @Override + public void start(BundleContext context) throws Exception { + super.start(context); + plugin = this; + } + + public static void log(IStatus status) { + plugin.getLog().log(status); + } + +} diff --git a/cross/org.eclipse.cdt.launch.serial.core/src/org/eclipse/cdt/launch/serial/internal/Messages.java b/cross/org.eclipse.cdt.launch.serial.core/src/org/eclipse/cdt/launch/serial/internal/Messages.java index 3b18b53d8d4..f6298a4c333 100644 --- a/cross/org.eclipse.cdt.launch.serial.core/src/org/eclipse/cdt/launch/serial/internal/Messages.java +++ b/cross/org.eclipse.cdt.launch.serial.core/src/org/eclipse/cdt/launch/serial/internal/Messages.java @@ -1,23 +1,23 @@ -/******************************************************************************* - * 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.launch.serial.internal; - -import org.eclipse.osgi.util.NLS; - -public class Messages extends NLS { - private static final String BUNDLE_NAME = "org.eclipse.cdt.launch.serial.internal.messages"; //$NON-NLS-1$ - public static String SerialFlashLaunch_Pause; - public static String SerialFlashLaunch_Resume; - 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.launch.serial.internal; + +import org.eclipse.osgi.util.NLS; + +public class Messages extends NLS { + private static final String BUNDLE_NAME = "org.eclipse.cdt.launch.serial.internal.messages"; //$NON-NLS-1$ + public static String SerialFlashLaunch_Pause; + public static String SerialFlashLaunch_Resume; + static { + // initialize resource bundle + NLS.initializeMessages(BUNDLE_NAME, Messages.class); + } + + private Messages() { + } +} diff --git a/cross/org.eclipse.cdt.launch.serial.core/src/org/eclipse/cdt/launch/serial/internal/SerialFlashLaunch.java b/cross/org.eclipse.cdt.launch.serial.core/src/org/eclipse/cdt/launch/serial/internal/SerialFlashLaunch.java index e810d708f32..5126a18ddec 100644 --- a/cross/org.eclipse.cdt.launch.serial.core/src/org/eclipse/cdt/launch/serial/internal/SerialFlashLaunch.java +++ b/cross/org.eclipse.cdt.launch.serial.core/src/org/eclipse/cdt/launch/serial/internal/SerialFlashLaunch.java @@ -1,67 +1,67 @@ -/******************************************************************************* - * 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.launch.serial.internal; - -import java.io.IOException; - -import org.eclipse.cdt.launch.serial.SerialFlashLaunchTargetProvider; -import org.eclipse.cdt.serial.SerialPort; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.debug.core.DebugEvent; -import org.eclipse.debug.core.DebugPlugin; -import org.eclipse.debug.core.ILaunchConfiguration; -import org.eclipse.debug.core.model.ISourceLocator; -import org.eclipse.launchbar.core.target.ILaunchTarget; -import org.eclipse.launchbar.core.target.launch.TargetedLaunch; - -public class SerialFlashLaunch extends TargetedLaunch { - - private SerialPort serialPort; - private boolean wasOpen; - - public SerialFlashLaunch(ILaunchConfiguration launchConfiguration, String mode, ISourceLocator locator, - ILaunchTarget target) { - super(launchConfiguration, mode, target, locator); - String serialPortName = target.getAttribute(SerialFlashLaunchTargetProvider.ATTR_SERIAL_PORT, ""); //$NON-NLS-1$ - if (!serialPortName.isEmpty()) { - serialPort = SerialPort.get(serialPortName); - } - - DebugPlugin.getDefault().addDebugEventListener(this); - } - - public void start() { - if (serialPort != null) { - wasOpen = serialPort.isOpen(); - if (wasOpen) { - try { - serialPort.pause(); - } catch (IOException e) { - Activator.log(new Status(IStatus.ERROR, Activator.PLUGIN_ID, Messages.SerialFlashLaunch_Pause, e)); - } - } - } else { - wasOpen = false; - } - } - - @Override - public void handleDebugEvents(DebugEvent[] events) { - super.handleDebugEvents(events); - if (isTerminated() && wasOpen) { - try { - serialPort.resume(); - } catch (IOException e) { - Activator.log(new Status(IStatus.ERROR, Activator.PLUGIN_ID, Messages.SerialFlashLaunch_Resume, e)); - } - wasOpen = false; - } - } - -} +/******************************************************************************* + * 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.launch.serial.internal; + +import java.io.IOException; + +import org.eclipse.cdt.launch.serial.SerialFlashLaunchTargetProvider; +import org.eclipse.cdt.serial.SerialPort; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Status; +import org.eclipse.debug.core.DebugEvent; +import org.eclipse.debug.core.DebugPlugin; +import org.eclipse.debug.core.ILaunchConfiguration; +import org.eclipse.debug.core.model.ISourceLocator; +import org.eclipse.launchbar.core.target.ILaunchTarget; +import org.eclipse.launchbar.core.target.launch.TargetedLaunch; + +public class SerialFlashLaunch extends TargetedLaunch { + + private SerialPort serialPort; + private boolean wasOpen; + + public SerialFlashLaunch(ILaunchConfiguration launchConfiguration, String mode, ISourceLocator locator, + ILaunchTarget target) { + super(launchConfiguration, mode, target, locator); + String serialPortName = target.getAttribute(SerialFlashLaunchTargetProvider.ATTR_SERIAL_PORT, ""); //$NON-NLS-1$ + if (!serialPortName.isEmpty()) { + serialPort = SerialPort.get(serialPortName); + } + + DebugPlugin.getDefault().addDebugEventListener(this); + } + + public void start() { + if (serialPort != null) { + wasOpen = serialPort.isOpen(); + if (wasOpen) { + try { + serialPort.pause(); + } catch (IOException e) { + Activator.log(new Status(IStatus.ERROR, Activator.PLUGIN_ID, Messages.SerialFlashLaunch_Pause, e)); + } + } + } else { + wasOpen = false; + } + } + + @Override + public void handleDebugEvents(DebugEvent[] events) { + super.handleDebugEvents(events); + if (isTerminated() && wasOpen) { + try { + serialPort.resume(); + } catch (IOException e) { + Activator.log(new Status(IStatus.ERROR, Activator.PLUGIN_ID, Messages.SerialFlashLaunch_Resume, e)); + } + wasOpen = false; + } + } + +} diff --git a/cross/org.eclipse.cdt.launch.serial.core/src/org/eclipse/cdt/launch/serial/internal/SerialFlashLaunchConfigDelegate.java b/cross/org.eclipse.cdt.launch.serial.core/src/org/eclipse/cdt/launch/serial/internal/SerialFlashLaunchConfigDelegate.java index 3473c4296f3..eef3d006f38 100644 --- a/cross/org.eclipse.cdt.launch.serial.core/src/org/eclipse/cdt/launch/serial/internal/SerialFlashLaunchConfigDelegate.java +++ b/cross/org.eclipse.cdt.launch.serial.core/src/org/eclipse/cdt/launch/serial/internal/SerialFlashLaunchConfigDelegate.java @@ -1,37 +1,37 @@ -/******************************************************************************* - * 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.launch.serial.internal; - -import org.eclipse.cdt.debug.core.launch.CoreBuildGenericLaunchConfigDelegate; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.debug.core.ILaunch; -import org.eclipse.debug.core.ILaunchConfiguration; -import org.eclipse.launchbar.core.target.ILaunchTarget; -import org.eclipse.launchbar.core.target.launch.ITargetedLaunch; - -public class SerialFlashLaunchConfigDelegate extends CoreBuildGenericLaunchConfigDelegate { - - public static final String TYPE_ID = "org.eclipse.cdt.launch.serial.launchConfigurationType"; //$NON-NLS-1$ - - @Override - public ITargetedLaunch getLaunch(ILaunchConfiguration configuration, String mode, ILaunchTarget target) - throws CoreException { - return new SerialFlashLaunch(configuration, mode, null, target); - } - - @Override - public void launch(ILaunchConfiguration configuration, String mode, ILaunch launch, IProgressMonitor monitor) - throws CoreException { - // Start the launch (pause the serial port) - ((SerialFlashLaunch) launch).start(); - - super.launch(configuration, mode, launch, 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.launch.serial.internal; + +import org.eclipse.cdt.debug.core.launch.CoreBuildGenericLaunchConfigDelegate; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.debug.core.ILaunch; +import org.eclipse.debug.core.ILaunchConfiguration; +import org.eclipse.launchbar.core.target.ILaunchTarget; +import org.eclipse.launchbar.core.target.launch.ITargetedLaunch; + +public class SerialFlashLaunchConfigDelegate extends CoreBuildGenericLaunchConfigDelegate { + + public static final String TYPE_ID = "org.eclipse.cdt.launch.serial.launchConfigurationType"; //$NON-NLS-1$ + + @Override + public ITargetedLaunch getLaunch(ILaunchConfiguration configuration, String mode, ILaunchTarget target) + throws CoreException { + return new SerialFlashLaunch(configuration, mode, null, target); + } + + @Override + public void launch(ILaunchConfiguration configuration, String mode, ILaunch launch, IProgressMonitor monitor) + throws CoreException { + // Start the launch (pause the serial port) + ((SerialFlashLaunch) launch).start(); + + super.launch(configuration, mode, launch, monitor); + } + +} diff --git a/cross/org.eclipse.cdt.launch.serial.core/src/org/eclipse/cdt/launch/serial/internal/SerialFlashLaunchConfigProvider.java b/cross/org.eclipse.cdt.launch.serial.core/src/org/eclipse/cdt/launch/serial/internal/SerialFlashLaunchConfigProvider.java index d1cfb4dff92..7bbc6a2c7f4 100644 --- a/cross/org.eclipse.cdt.launch.serial.core/src/org/eclipse/cdt/launch/serial/internal/SerialFlashLaunchConfigProvider.java +++ b/cross/org.eclipse.cdt.launch.serial.core/src/org/eclipse/cdt/launch/serial/internal/SerialFlashLaunchConfigProvider.java @@ -1,32 +1,32 @@ -/******************************************************************************* - * 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.launch.serial.internal; - -import org.eclipse.cdt.debug.core.launch.CoreBuildGenericLaunchConfigProvider; -import org.eclipse.cdt.launch.serial.SerialFlashLaunchTargetProvider; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.debug.core.DebugPlugin; -import org.eclipse.debug.core.ILaunchConfigurationType; -import org.eclipse.launchbar.core.ILaunchDescriptor; -import org.eclipse.launchbar.core.target.ILaunchTarget; - -public class SerialFlashLaunchConfigProvider extends CoreBuildGenericLaunchConfigProvider { - - @Override - public boolean supports(ILaunchDescriptor descriptor, ILaunchTarget target) throws CoreException { - return target.getTypeId().equals(SerialFlashLaunchTargetProvider.TYPE_ID); - } - - @Override - public ILaunchConfigurationType getLaunchConfigurationType(ILaunchDescriptor descriptor, ILaunchTarget target) - throws CoreException { - return DebugPlugin.getDefault().getLaunchManager() - .getLaunchConfigurationType(SerialFlashLaunchConfigDelegate.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.launch.serial.internal; + +import org.eclipse.cdt.debug.core.launch.CoreBuildGenericLaunchConfigProvider; +import org.eclipse.cdt.launch.serial.SerialFlashLaunchTargetProvider; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.debug.core.DebugPlugin; +import org.eclipse.debug.core.ILaunchConfigurationType; +import org.eclipse.launchbar.core.ILaunchDescriptor; +import org.eclipse.launchbar.core.target.ILaunchTarget; + +public class SerialFlashLaunchConfigProvider extends CoreBuildGenericLaunchConfigProvider { + + @Override + public boolean supports(ILaunchDescriptor descriptor, ILaunchTarget target) throws CoreException { + return target.getTypeId().equals(SerialFlashLaunchTargetProvider.TYPE_ID); + } + + @Override + public ILaunchConfigurationType getLaunchConfigurationType(ILaunchDescriptor descriptor, ILaunchTarget target) + throws CoreException { + return DebugPlugin.getDefault().getLaunchManager() + .getLaunchConfigurationType(SerialFlashLaunchConfigDelegate.TYPE_ID); + } + +} diff --git a/cross/org.eclipse.cdt.launch.serial.core/src/org/eclipse/cdt/launch/serial/internal/messages.properties b/cross/org.eclipse.cdt.launch.serial.core/src/org/eclipse/cdt/launch/serial/internal/messages.properties index 02efebb9d0b..1c2f13475f9 100644 --- a/cross/org.eclipse.cdt.launch.serial.core/src/org/eclipse/cdt/launch/serial/internal/messages.properties +++ b/cross/org.eclipse.cdt.launch.serial.core/src/org/eclipse/cdt/launch/serial/internal/messages.properties @@ -1,9 +1,9 @@ -################################################################################ -# 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 -################################################################################ -SerialFlashLaunch_Pause=Pausing serial port -SerialFlashLaunch_Resume=Resuming serial port +################################################################################ +# 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 +################################################################################ +SerialFlashLaunch_Pause=Pausing serial port +SerialFlashLaunch_Resume=Resuming serial port diff --git a/cross/org.eclipse.cdt.launch.serial.ui/.classpath b/cross/org.eclipse.cdt.launch.serial.ui/.classpath index b862a296d38..eca7bdba8f0 100644 --- a/cross/org.eclipse.cdt.launch.serial.ui/.classpath +++ b/cross/org.eclipse.cdt.launch.serial.ui/.classpath @@ -1,7 +1,7 @@ - - - - - - - + + + + + + + diff --git a/cross/org.eclipse.cdt.launch.serial.ui/.project b/cross/org.eclipse.cdt.launch.serial.ui/.project index 0977dd1f5ea..9da42b751e3 100644 --- a/cross/org.eclipse.cdt.launch.serial.ui/.project +++ b/cross/org.eclipse.cdt.launch.serial.ui/.project @@ -1,28 +1,28 @@ - - - org.eclipse.cdt.launch.serial.ui - - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.pde.ManifestBuilder - - - - - org.eclipse.pde.SchemaBuilder - - - - - - org.eclipse.pde.PluginNature - org.eclipse.jdt.core.javanature - - + + + org.eclipse.cdt.launch.serial.ui + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + + diff --git a/cross/org.eclipse.cdt.launch.serial.ui/.settings/org.eclipse.jdt.core.prefs b/cross/org.eclipse.cdt.launch.serial.ui/.settings/org.eclipse.jdt.core.prefs index 295926d9641..0c68a61dca8 100644 --- a/cross/org.eclipse.cdt.launch.serial.ui/.settings/org.eclipse.jdt.core.prefs +++ b/cross/org.eclipse.cdt.launch.serial.ui/.settings/org.eclipse.jdt.core.prefs @@ -1,7 +1,7 @@ -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.compliance=1.8 -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.8 +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.compliance=1.8 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.8 diff --git a/cross/org.eclipse.cdt.launch.serial.ui/build.properties b/cross/org.eclipse.cdt.launch.serial.ui/build.properties index 983cdc39a95..4ba0a0c298b 100644 --- a/cross/org.eclipse.cdt.launch.serial.ui/build.properties +++ b/cross/org.eclipse.cdt.launch.serial.ui/build.properties @@ -1,7 +1,7 @@ -source.. = src/ -output.. = bin/ -bin.includes = META-INF/,\ - .,\ - plugin.xml,\ - icons/,\ - about.html +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + .,\ + plugin.xml,\ + icons/,\ + about.html diff --git a/cross/org.eclipse.cdt.launch.serial.ui/plugin.xml b/cross/org.eclipse.cdt.launch.serial.ui/plugin.xml index ae904e80c65..cf4e3d60cbb 100644 --- a/cross/org.eclipse.cdt.launch.serial.ui/plugin.xml +++ b/cross/org.eclipse.cdt.launch.serial.ui/plugin.xml @@ -1,34 +1,34 @@ - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + diff --git a/cross/org.eclipse.cdt.launch.serial.ui/src/org/eclipse/cdt/launch/serial/ui/internal/Activator.java b/cross/org.eclipse.cdt.launch.serial.ui/src/org/eclipse/cdt/launch/serial/ui/internal/Activator.java index 42ec9d2a6a7..931ddd3b5ba 100644 --- a/cross/org.eclipse.cdt.launch.serial.ui/src/org/eclipse/cdt/launch/serial/ui/internal/Activator.java +++ b/cross/org.eclipse.cdt.launch.serial.ui/src/org/eclipse/cdt/launch/serial/ui/internal/Activator.java @@ -1,52 +1,52 @@ -/******************************************************************************* - * 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.launch.serial.ui.internal; - -import org.eclipse.core.runtime.IStatus; -import org.eclipse.jface.resource.ImageRegistry; -import org.eclipse.swt.graphics.Image; -import org.eclipse.ui.plugin.AbstractUIPlugin; -import org.osgi.framework.BundleContext; -import org.osgi.framework.ServiceReference; - -public class Activator extends AbstractUIPlugin { - - public static final String PLUGIN_ID = "org.eclipse.cdt.launch.serial.ui"; //$NON-NLS-1$ - - public static final String IMG_CDT_LOGO = "org.eclipse.cdt.launch.serial.ui.cdt_logo_16"; //$NON-NLS-1$ - - private static AbstractUIPlugin plugin; - - @Override - public void start(BundleContext context) throws Exception { - super.start(context); - plugin = this; - } - - @Override - protected void initializeImageRegistry(ImageRegistry reg) { - super.initializeImageRegistry(reg); - - reg.put(IMG_CDT_LOGO, imageDescriptorFromPlugin(PLUGIN_ID, "icons/cdt_logo_16.png")); //$NON-NLS-1$ - } - - public static Image getImage(String key) { - return plugin.getImageRegistry().get(key); - } - - public static void log(IStatus status) { - plugin.getLog().log(status); - } - - public static T getService(Class service) { - BundleContext context = plugin.getBundle().getBundleContext(); - ServiceReference ref = context.getServiceReference(service); - return ref != null ? context.getService(ref) : null; - } - -} +/******************************************************************************* + * 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.launch.serial.ui.internal; + +import org.eclipse.core.runtime.IStatus; +import org.eclipse.jface.resource.ImageRegistry; +import org.eclipse.swt.graphics.Image; +import org.eclipse.ui.plugin.AbstractUIPlugin; +import org.osgi.framework.BundleContext; +import org.osgi.framework.ServiceReference; + +public class Activator extends AbstractUIPlugin { + + public static final String PLUGIN_ID = "org.eclipse.cdt.launch.serial.ui"; //$NON-NLS-1$ + + public static final String IMG_CDT_LOGO = "org.eclipse.cdt.launch.serial.ui.cdt_logo_16"; //$NON-NLS-1$ + + private static AbstractUIPlugin plugin; + + @Override + public void start(BundleContext context) throws Exception { + super.start(context); + plugin = this; + } + + @Override + protected void initializeImageRegistry(ImageRegistry reg) { + super.initializeImageRegistry(reg); + + reg.put(IMG_CDT_LOGO, imageDescriptorFromPlugin(PLUGIN_ID, "icons/cdt_logo_16.png")); //$NON-NLS-1$ + } + + public static Image getImage(String key) { + return plugin.getImageRegistry().get(key); + } + + public static void log(IStatus status) { + plugin.getLog().log(status); + } + + public static T getService(Class service) { + BundleContext context = plugin.getBundle().getBundleContext(); + ServiceReference ref = context.getServiceReference(service); + return ref != null ? context.getService(ref) : null; + } + +} diff --git a/cross/org.eclipse.cdt.launch.serial.ui/src/org/eclipse/cdt/launch/serial/ui/internal/Messages.java b/cross/org.eclipse.cdt.launch.serial.ui/src/org/eclipse/cdt/launch/serial/ui/internal/Messages.java index 716945251ef..79a3e0e86ad 100644 --- a/cross/org.eclipse.cdt.launch.serial.ui/src/org/eclipse/cdt/launch/serial/ui/internal/Messages.java +++ b/cross/org.eclipse.cdt.launch.serial.ui/src/org/eclipse/cdt/launch/serial/ui/internal/Messages.java @@ -1,29 +1,29 @@ -/******************************************************************************* - * 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.launch.serial.ui.internal; - -import org.eclipse.osgi.util.NLS; - -public class Messages extends NLS { - private static final String BUNDLE_NAME = "org.eclipse.cdt.launch.serial.ui.internal.messages"; //$NON-NLS-1$ - public static String NewSerialFlashTargetWizard_Title; - public static String NewSerialFlashTargetWizardPage_CPUArchitecture; - public static String NewSerialFlashTargetWizardPage_Description; - public static String NewSerialFlashTargetWizardPage_Fetching; - public static String NewSerialFlashTargetWizardPage_Name; - public static String NewSerialFlashTargetWizardPage_OperatingSystem; - public static String NewSerialFlashTargetWizardPage_SerialPort; - public static String NewSerialFlashTargetWizardPage_Title; - 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.launch.serial.ui.internal; + +import org.eclipse.osgi.util.NLS; + +public class Messages extends NLS { + private static final String BUNDLE_NAME = "org.eclipse.cdt.launch.serial.ui.internal.messages"; //$NON-NLS-1$ + public static String NewSerialFlashTargetWizard_Title; + public static String NewSerialFlashTargetWizardPage_CPUArchitecture; + public static String NewSerialFlashTargetWizardPage_Description; + public static String NewSerialFlashTargetWizardPage_Fetching; + public static String NewSerialFlashTargetWizardPage_Name; + public static String NewSerialFlashTargetWizardPage_OperatingSystem; + public static String NewSerialFlashTargetWizardPage_SerialPort; + public static String NewSerialFlashTargetWizardPage_Title; + static { + // initialize resource bundle + NLS.initializeMessages(BUNDLE_NAME, Messages.class); + } + + private Messages() { + } +} diff --git a/cross/org.eclipse.cdt.launch.serial.ui/src/org/eclipse/cdt/launch/serial/ui/internal/NewSerialFlashTargetWizard.java b/cross/org.eclipse.cdt.launch.serial.ui/src/org/eclipse/cdt/launch/serial/ui/internal/NewSerialFlashTargetWizard.java index b1f28537234..f79a35db6a8 100644 --- a/cross/org.eclipse.cdt.launch.serial.ui/src/org/eclipse/cdt/launch/serial/ui/internal/NewSerialFlashTargetWizard.java +++ b/cross/org.eclipse.cdt.launch.serial.ui/src/org/eclipse/cdt/launch/serial/ui/internal/NewSerialFlashTargetWizard.java @@ -1,53 +1,53 @@ -/******************************************************************************* - * 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.launch.serial.ui.internal; - -import org.eclipse.cdt.launch.serial.SerialFlashLaunchTargetProvider; -import org.eclipse.launchbar.core.target.ILaunchTarget; -import org.eclipse.launchbar.core.target.ILaunchTargetManager; -import org.eclipse.launchbar.core.target.ILaunchTargetWorkingCopy; -import org.eclipse.launchbar.ui.target.LaunchTargetWizard; - -public class NewSerialFlashTargetWizard extends LaunchTargetWizard { - - private NewSerialFlashTargetWizardPage page; - - public NewSerialFlashTargetWizard() { - setWindowTitle(Messages.NewSerialFlashTargetWizard_Title); - } - - @Override - public void addPages() { - super.addPages(); - - page = new NewSerialFlashTargetWizardPage(getLaunchTarget()); - addPage(page); - } - - @Override - public boolean performFinish() { - ILaunchTargetManager manager = Activator.getService(ILaunchTargetManager.class); - String typeId = SerialFlashLaunchTargetProvider.TYPE_ID; - String id = page.getTargetName(); - - ILaunchTarget target = getLaunchTarget(); - if (target == null) { - target = manager.addLaunchTarget(typeId, id); - } - - ILaunchTargetWorkingCopy wc = target.getWorkingCopy(); - wc.setId(id); - wc.setAttribute(ILaunchTarget.ATTR_OS, page.getOS()); - wc.setAttribute(ILaunchTarget.ATTR_ARCH, page.getArch()); - wc.setAttribute(SerialFlashLaunchTargetProvider.ATTR_SERIAL_PORT, page.getSerialPortName()); - wc.save(); - - return true; - } - -} +/******************************************************************************* + * 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.launch.serial.ui.internal; + +import org.eclipse.cdt.launch.serial.SerialFlashLaunchTargetProvider; +import org.eclipse.launchbar.core.target.ILaunchTarget; +import org.eclipse.launchbar.core.target.ILaunchTargetManager; +import org.eclipse.launchbar.core.target.ILaunchTargetWorkingCopy; +import org.eclipse.launchbar.ui.target.LaunchTargetWizard; + +public class NewSerialFlashTargetWizard extends LaunchTargetWizard { + + private NewSerialFlashTargetWizardPage page; + + public NewSerialFlashTargetWizard() { + setWindowTitle(Messages.NewSerialFlashTargetWizard_Title); + } + + @Override + public void addPages() { + super.addPages(); + + page = new NewSerialFlashTargetWizardPage(getLaunchTarget()); + addPage(page); + } + + @Override + public boolean performFinish() { + ILaunchTargetManager manager = Activator.getService(ILaunchTargetManager.class); + String typeId = SerialFlashLaunchTargetProvider.TYPE_ID; + String id = page.getTargetName(); + + ILaunchTarget target = getLaunchTarget(); + if (target == null) { + target = manager.addLaunchTarget(typeId, id); + } + + ILaunchTargetWorkingCopy wc = target.getWorkingCopy(); + wc.setId(id); + wc.setAttribute(ILaunchTarget.ATTR_OS, page.getOS()); + wc.setAttribute(ILaunchTarget.ATTR_ARCH, page.getArch()); + wc.setAttribute(SerialFlashLaunchTargetProvider.ATTR_SERIAL_PORT, page.getSerialPortName()); + wc.save(); + + return true; + } + +} diff --git a/cross/org.eclipse.cdt.launch.serial.ui/src/org/eclipse/cdt/launch/serial/ui/internal/NewSerialFlashTargetWizardPage.java b/cross/org.eclipse.cdt.launch.serial.ui/src/org/eclipse/cdt/launch/serial/ui/internal/NewSerialFlashTargetWizardPage.java index 58ab4e7660a..a6b5aa558fd 100644 --- a/cross/org.eclipse.cdt.launch.serial.ui/src/org/eclipse/cdt/launch/serial/ui/internal/NewSerialFlashTargetWizardPage.java +++ b/cross/org.eclipse.cdt.launch.serial.ui/src/org/eclipse/cdt/launch/serial/ui/internal/NewSerialFlashTargetWizardPage.java @@ -1,130 +1,130 @@ -/******************************************************************************* - * 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.launch.serial.ui.internal; - -import java.io.IOException; - -import org.eclipse.cdt.launch.serial.SerialFlashLaunchTargetProvider; -import org.eclipse.cdt.serial.SerialPort; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.jface.wizard.WizardPage; -import org.eclipse.launchbar.core.target.ILaunchTarget; -import org.eclipse.swt.SWT; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Combo; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Text; - -public class NewSerialFlashTargetWizardPage extends WizardPage { - - private ILaunchTarget launchTarget; - - private Text nameText; - private Text osText; - private Text archText; - private Combo serialPortCombo; - - public NewSerialFlashTargetWizardPage(ILaunchTarget launchTarget) { - super(NewSerialFlashTargetWizardPage.class.getName()); - this.launchTarget = launchTarget; - setTitle(Messages.NewSerialFlashTargetWizardPage_Title); - setDescription(Messages.NewSerialFlashTargetWizardPage_Description); - } - - @Override - public void createControl(Composite parent) { - Composite comp = new Composite(parent, SWT.NONE); - comp.setLayout(new GridLayout(2, false)); - setControl(comp); - - Label label = new Label(comp, SWT.NONE); - label.setText(Messages.NewSerialFlashTargetWizardPage_Name); - - nameText = new Text(comp, SWT.BORDER); - nameText.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); - if (launchTarget != null) { - nameText.setText(launchTarget.getId()); - } - - label = new Label(comp, SWT.NONE); - label.setText(Messages.NewSerialFlashTargetWizardPage_OperatingSystem); - - osText = new Text(comp, SWT.BORDER); - osText.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); - if (launchTarget != null) { - String os = launchTarget.getAttribute(ILaunchTarget.ATTR_OS, null); - if (os != null) { - osText.setText(os); - } - } - - label = new Label(comp, SWT.NONE); - label.setText(Messages.NewSerialFlashTargetWizardPage_CPUArchitecture); - - archText = new Text(comp, SWT.BORDER); - archText.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); - if (launchTarget != null) { - String arch = launchTarget.getAttribute(ILaunchTarget.ATTR_ARCH, null); - if (arch != null) { - archText.setText(arch); - } - } - - label = new Label(comp, SWT.NONE); - label.setText(Messages.NewSerialFlashTargetWizardPage_SerialPort); - - serialPortCombo = new Combo(comp, SWT.NONE); - try { - String[] ports = SerialPort.list(); - for (String port : ports) { - serialPortCombo.add(port); - } - if (serialPortCombo.getItemCount() > 0) { - if (launchTarget != null) { - String targetPort = launchTarget.getAttribute(SerialFlashLaunchTargetProvider.ATTR_SERIAL_PORT, - null); - if (targetPort != null) { - int i = 0; - for (String port : ports) { - if (port.equals(targetPort)) { - serialPortCombo.select(i); - break; - } - } - } - } - - if (serialPortCombo.getSelectionIndex() < 0) { - serialPortCombo.select(0); - } - } - } catch (IOException e) { - Activator.log(new Status(IStatus.ERROR, Activator.PLUGIN_ID, Messages.NewSerialFlashTargetWizardPage_Fetching, e)); - } - } - - public String getTargetName() { - return nameText.getText(); - } - - public String getOS() { - return osText.getText(); - } - - public String getArch() { - return archText.getText(); - } - - public String getSerialPortName() { - return serialPortCombo.getText(); - } - -} +/******************************************************************************* + * 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.launch.serial.ui.internal; + +import java.io.IOException; + +import org.eclipse.cdt.launch.serial.SerialFlashLaunchTargetProvider; +import org.eclipse.cdt.serial.SerialPort; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Status; +import org.eclipse.jface.wizard.WizardPage; +import org.eclipse.launchbar.core.target.ILaunchTarget; +import org.eclipse.swt.SWT; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Combo; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Text; + +public class NewSerialFlashTargetWizardPage extends WizardPage { + + private ILaunchTarget launchTarget; + + private Text nameText; + private Text osText; + private Text archText; + private Combo serialPortCombo; + + public NewSerialFlashTargetWizardPage(ILaunchTarget launchTarget) { + super(NewSerialFlashTargetWizardPage.class.getName()); + this.launchTarget = launchTarget; + setTitle(Messages.NewSerialFlashTargetWizardPage_Title); + setDescription(Messages.NewSerialFlashTargetWizardPage_Description); + } + + @Override + public void createControl(Composite parent) { + Composite comp = new Composite(parent, SWT.NONE); + comp.setLayout(new GridLayout(2, false)); + setControl(comp); + + Label label = new Label(comp, SWT.NONE); + label.setText(Messages.NewSerialFlashTargetWizardPage_Name); + + nameText = new Text(comp, SWT.BORDER); + nameText.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); + if (launchTarget != null) { + nameText.setText(launchTarget.getId()); + } + + label = new Label(comp, SWT.NONE); + label.setText(Messages.NewSerialFlashTargetWizardPage_OperatingSystem); + + osText = new Text(comp, SWT.BORDER); + osText.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); + if (launchTarget != null) { + String os = launchTarget.getAttribute(ILaunchTarget.ATTR_OS, null); + if (os != null) { + osText.setText(os); + } + } + + label = new Label(comp, SWT.NONE); + label.setText(Messages.NewSerialFlashTargetWizardPage_CPUArchitecture); + + archText = new Text(comp, SWT.BORDER); + archText.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); + if (launchTarget != null) { + String arch = launchTarget.getAttribute(ILaunchTarget.ATTR_ARCH, null); + if (arch != null) { + archText.setText(arch); + } + } + + label = new Label(comp, SWT.NONE); + label.setText(Messages.NewSerialFlashTargetWizardPage_SerialPort); + + serialPortCombo = new Combo(comp, SWT.NONE); + try { + String[] ports = SerialPort.list(); + for (String port : ports) { + serialPortCombo.add(port); + } + if (serialPortCombo.getItemCount() > 0) { + if (launchTarget != null) { + String targetPort = launchTarget.getAttribute(SerialFlashLaunchTargetProvider.ATTR_SERIAL_PORT, + null); + if (targetPort != null) { + int i = 0; + for (String port : ports) { + if (port.equals(targetPort)) { + serialPortCombo.select(i); + break; + } + } + } + } + + if (serialPortCombo.getSelectionIndex() < 0) { + serialPortCombo.select(0); + } + } + } catch (IOException e) { + Activator.log(new Status(IStatus.ERROR, Activator.PLUGIN_ID, Messages.NewSerialFlashTargetWizardPage_Fetching, e)); + } + } + + public String getTargetName() { + return nameText.getText(); + } + + public String getOS() { + return osText.getText(); + } + + public String getArch() { + return archText.getText(); + } + + public String getSerialPortName() { + return serialPortCombo.getText(); + } + +} diff --git a/cross/org.eclipse.cdt.launch.serial.ui/src/org/eclipse/cdt/launch/serial/ui/internal/SerialFlashLaunchConfigTabGroup.java b/cross/org.eclipse.cdt.launch.serial.ui/src/org/eclipse/cdt/launch/serial/ui/internal/SerialFlashLaunchConfigTabGroup.java index 96f26d4eac2..47f9dd78941 100644 --- a/cross/org.eclipse.cdt.launch.serial.ui/src/org/eclipse/cdt/launch/serial/ui/internal/SerialFlashLaunchConfigTabGroup.java +++ b/cross/org.eclipse.cdt.launch.serial.ui/src/org/eclipse/cdt/launch/serial/ui/internal/SerialFlashLaunchConfigTabGroup.java @@ -1,24 +1,24 @@ -/******************************************************************************* - * 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.launch.serial.ui.internal; - -import org.eclipse.cdt.launch.ui.corebuild.GenericMainTab; -import org.eclipse.debug.ui.AbstractLaunchConfigurationTabGroup; -import org.eclipse.debug.ui.CommonTab; -import org.eclipse.debug.ui.EnvironmentTab; -import org.eclipse.debug.ui.ILaunchConfigurationDialog; -import org.eclipse.debug.ui.ILaunchConfigurationTab; - -public class SerialFlashLaunchConfigTabGroup extends AbstractLaunchConfigurationTabGroup { - - @Override - public void createTabs(ILaunchConfigurationDialog dialog, String mode) { - setTabs(new ILaunchConfigurationTab[] { new GenericMainTab(), new EnvironmentTab(), new CommonTab() }); - } - -} +/******************************************************************************* + * 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.launch.serial.ui.internal; + +import org.eclipse.cdt.launch.ui.corebuild.GenericMainTab; +import org.eclipse.debug.ui.AbstractLaunchConfigurationTabGroup; +import org.eclipse.debug.ui.CommonTab; +import org.eclipse.debug.ui.EnvironmentTab; +import org.eclipse.debug.ui.ILaunchConfigurationDialog; +import org.eclipse.debug.ui.ILaunchConfigurationTab; + +public class SerialFlashLaunchConfigTabGroup extends AbstractLaunchConfigurationTabGroup { + + @Override + public void createTabs(ILaunchConfigurationDialog dialog, String mode) { + setTabs(new ILaunchConfigurationTab[] { new GenericMainTab(), new EnvironmentTab(), new CommonTab() }); + } + +} diff --git a/cross/org.eclipse.cdt.launch.serial.ui/src/org/eclipse/cdt/launch/serial/ui/internal/SerialFlashLaunchTargetLabelProvider.java b/cross/org.eclipse.cdt.launch.serial.ui/src/org/eclipse/cdt/launch/serial/ui/internal/SerialFlashLaunchTargetLabelProvider.java index d0060c7e224..a7011d41eee 100644 --- a/cross/org.eclipse.cdt.launch.serial.ui/src/org/eclipse/cdt/launch/serial/ui/internal/SerialFlashLaunchTargetLabelProvider.java +++ b/cross/org.eclipse.cdt.launch.serial.ui/src/org/eclipse/cdt/launch/serial/ui/internal/SerialFlashLaunchTargetLabelProvider.java @@ -1,35 +1,35 @@ -/******************************************************************************* - * 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.launch.serial.ui.internal; - -import org.eclipse.jface.viewers.LabelProvider; -import org.eclipse.launchbar.core.target.ILaunchTarget; -import org.eclipse.swt.graphics.Image; - -public class SerialFlashLaunchTargetLabelProvider extends LabelProvider { - - @Override - public String getText(Object element) { - if (element instanceof ILaunchTarget) { - return ((ILaunchTarget) element).getId(); - } - return super.getText(element); - } - - @Override - public Image getImage(Object element) { - if (element instanceof ILaunchTarget) { - Image image = Activator.getImage(Activator.IMG_CDT_LOGO); - if (image != null) { - return image; - } - } - return super.getImage(element); - } - -} +/******************************************************************************* + * 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.launch.serial.ui.internal; + +import org.eclipse.jface.viewers.LabelProvider; +import org.eclipse.launchbar.core.target.ILaunchTarget; +import org.eclipse.swt.graphics.Image; + +public class SerialFlashLaunchTargetLabelProvider extends LabelProvider { + + @Override + public String getText(Object element) { + if (element instanceof ILaunchTarget) { + return ((ILaunchTarget) element).getId(); + } + return super.getText(element); + } + + @Override + public Image getImage(Object element) { + if (element instanceof ILaunchTarget) { + Image image = Activator.getImage(Activator.IMG_CDT_LOGO); + if (image != null) { + return image; + } + } + return super.getImage(element); + } + +} diff --git a/cross/org.eclipse.cdt.launch.serial.ui/src/org/eclipse/cdt/launch/serial/ui/internal/messages.properties b/cross/org.eclipse.cdt.launch.serial.ui/src/org/eclipse/cdt/launch/serial/ui/internal/messages.properties index a250eee1ba5..8023e0fa82f 100644 --- a/cross/org.eclipse.cdt.launch.serial.ui/src/org/eclipse/cdt/launch/serial/ui/internal/messages.properties +++ b/cross/org.eclipse.cdt.launch.serial.ui/src/org/eclipse/cdt/launch/serial/ui/internal/messages.properties @@ -1,15 +1,15 @@ -################################################################################ -# 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 -################################################################################ -NewSerialFlashTargetWizard_Title=New Serial Flash Target -NewSerialFlashTargetWizardPage_CPUArchitecture=CPU Architecture: -NewSerialFlashTargetWizardPage_Description=Enter name and properties for the target. -NewSerialFlashTargetWizardPage_Fetching=Fetching serial ports -NewSerialFlashTargetWizardPage_Name=Name: -NewSerialFlashTargetWizardPage_OperatingSystem=Operating System: -NewSerialFlashTargetWizardPage_SerialPort=Serial Port: -NewSerialFlashTargetWizardPage_Title=Serial Flash Target +################################################################################ +# 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 +################################################################################ +NewSerialFlashTargetWizard_Title=New Serial Flash Target +NewSerialFlashTargetWizardPage_CPUArchitecture=CPU Architecture: +NewSerialFlashTargetWizardPage_Description=Enter name and properties for the target. +NewSerialFlashTargetWizardPage_Fetching=Fetching serial ports +NewSerialFlashTargetWizardPage_Name=Name: +NewSerialFlashTargetWizardPage_OperatingSystem=Operating System: +NewSerialFlashTargetWizardPage_SerialPort=Serial Port: +NewSerialFlashTargetWizardPage_Title=Serial Flash Target diff --git a/debug/org.eclipse.cdt.debug.application.doc/customBuildCallbacks.xml b/debug/org.eclipse.cdt.debug.application.doc/customBuildCallbacks.xml index e0a92a65f0f..53a5bbd0435 100644 --- a/debug/org.eclipse.cdt.debug.application.doc/customBuildCallbacks.xml +++ b/debug/org.eclipse.cdt.debug.application.doc/customBuildCallbacks.xml @@ -1,163 +1,163 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/debug/org.eclipse.cdt.debug.application/configGenerator.xml b/debug/org.eclipse.cdt.debug.application/configGenerator.xml index 6f5e41896b0..5a9f107ead5 100644 --- a/debug/org.eclipse.cdt.debug.application/configGenerator.xml +++ b/debug/org.eclipse.cdt.debug.application/configGenerator.xml @@ -1,15 +1,15 @@ - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + diff --git a/debug/org.eclipse.cdt.debug.core/schema/BreakpointAction.exsd b/debug/org.eclipse.cdt.debug.core/schema/BreakpointAction.exsd index 7c5b6bac2b1..992cad8e211 100644 --- a/debug/org.eclipse.cdt.debug.core/schema/BreakpointAction.exsd +++ b/debug/org.eclipse.cdt.debug.core/schema/BreakpointAction.exsd @@ -1,106 +1,106 @@ - - - - - - - - - Extension to provide additional actions to execute when a breakpoint is hit. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - [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.] - - - - - - - - - Copyright (c) 2007 Nokia 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 - - - - + + + + + + + + + Extension to provide additional actions to execute when a breakpoint is hit. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + [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.] + + + + + + + + + Copyright (c) 2007 Nokia 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 + + + + diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/launch/CoreBuildGenericLaunchConfigDelegate.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/launch/CoreBuildGenericLaunchConfigDelegate.java index 217c6dced4f..b3909f12d61 100644 --- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/launch/CoreBuildGenericLaunchConfigDelegate.java +++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/launch/CoreBuildGenericLaunchConfigDelegate.java @@ -1,88 +1,88 @@ -/******************************************************************************* - * 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.debug.core.launch; - -import java.io.File; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -import org.eclipse.cdt.debug.core.CDebugCorePlugin; -import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants; -import org.eclipse.cdt.debug.internal.core.Messages; -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.variables.IStringVariableManager; -import org.eclipse.core.variables.VariablesPlugin; -import org.eclipse.debug.core.DebugPlugin; -import org.eclipse.debug.core.ILaunch; -import org.eclipse.debug.core.ILaunchConfiguration; - -/** - * Delegate for Generic Launches over the Generic Launch Target. Can be - * overriden to support launch customization for similar targets. - * - * @since 8.3 - */ -public class CoreBuildGenericLaunchConfigDelegate extends CoreBuildLaunchConfigDelegate { - - public static final String TYPE_ID = "org.eclipse.cdt.debug.core.genericLaunchConfigType"; //$NON-NLS-1$ - - @Override - public void launch(ILaunchConfiguration configuration, String mode, ILaunch launch, IProgressMonitor monitor) - throws CoreException { - IStringVariableManager varManager = VariablesPlugin.getDefault().getStringVariableManager(); - - String location = configuration.getAttribute(ICDTLaunchConfigurationConstants.ATTR_LOCATION, ""); //$NON-NLS-1$ - if (location.isEmpty()) { - launch.addProcess(new NullProcess(launch, Messages.CoreBuildGenericLaunchConfigDelegate_NoAction)); - return; - } else { - String substLocation = varManager.performStringSubstitution(location); - if (substLocation.isEmpty()) { - throw new CoreException(new Status(IStatus.ERROR, CDebugCorePlugin.PLUGIN_ID, - String.format(Messages.CoreBuildGenericLaunchConfigDelegate_SubstitutionFailed, location))); - } - location = substLocation; - } - - if (!new File(location).canExecute()) { - throw new CoreException(new Status(IStatus.ERROR, CDebugCorePlugin.PLUGIN_ID, - String.format(Messages.CoreBuildGenericLaunchConfigDelegate_CommandNotValid, location))); - } - - List commands = new ArrayList<>(); - commands.add(location); - - String arguments = configuration.getAttribute(ICDTLaunchConfigurationConstants.ATTR_TOOL_ARGUMENTS, ""); //$NON-NLS-1$ - if (!arguments.isEmpty()) { - commands.addAll(Arrays.asList(varManager.performStringSubstitution(arguments).split(" "))); //$NON-NLS-1$ - } - - String workingDirectory = configuration.getAttribute(ICDTLaunchConfigurationConstants.ATTR_WORKING_DIRECTORY, - ""); //$NON-NLS-1$ - File workingDir; - if (workingDirectory.isEmpty()) { - workingDir = new File(getProject(configuration).getLocationURI()); - } else { - workingDir = new File(varManager.performStringSubstitution(workingDirectory)); - if (!workingDir.isDirectory()) { - throw new CoreException(new Status(IStatus.ERROR, CDebugCorePlugin.PLUGIN_ID, - String.format(Messages.CoreBuildGenericLaunchConfigDelegate_WorkingDirNotExists, location))); - } - } - - String[] envp = DebugPlugin.getDefault().getLaunchManager().getEnvironment(configuration); - - Process p = DebugPlugin.exec(commands.toArray(new String[0]), workingDir, envp); - DebugPlugin.newProcess(launch, p, String.join(" ", commands)); //$NON-NLS-1$ - } - -} +/******************************************************************************* + * 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.debug.core.launch; + +import java.io.File; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import org.eclipse.cdt.debug.core.CDebugCorePlugin; +import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants; +import org.eclipse.cdt.debug.internal.core.Messages; +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.variables.IStringVariableManager; +import org.eclipse.core.variables.VariablesPlugin; +import org.eclipse.debug.core.DebugPlugin; +import org.eclipse.debug.core.ILaunch; +import org.eclipse.debug.core.ILaunchConfiguration; + +/** + * Delegate for Generic Launches over the Generic Launch Target. Can be + * overriden to support launch customization for similar targets. + * + * @since 8.3 + */ +public class CoreBuildGenericLaunchConfigDelegate extends CoreBuildLaunchConfigDelegate { + + public static final String TYPE_ID = "org.eclipse.cdt.debug.core.genericLaunchConfigType"; //$NON-NLS-1$ + + @Override + public void launch(ILaunchConfiguration configuration, String mode, ILaunch launch, IProgressMonitor monitor) + throws CoreException { + IStringVariableManager varManager = VariablesPlugin.getDefault().getStringVariableManager(); + + String location = configuration.getAttribute(ICDTLaunchConfigurationConstants.ATTR_LOCATION, ""); //$NON-NLS-1$ + if (location.isEmpty()) { + launch.addProcess(new NullProcess(launch, Messages.CoreBuildGenericLaunchConfigDelegate_NoAction)); + return; + } else { + String substLocation = varManager.performStringSubstitution(location); + if (substLocation.isEmpty()) { + throw new CoreException(new Status(IStatus.ERROR, CDebugCorePlugin.PLUGIN_ID, + String.format(Messages.CoreBuildGenericLaunchConfigDelegate_SubstitutionFailed, location))); + } + location = substLocation; + } + + if (!new File(location).canExecute()) { + throw new CoreException(new Status(IStatus.ERROR, CDebugCorePlugin.PLUGIN_ID, + String.format(Messages.CoreBuildGenericLaunchConfigDelegate_CommandNotValid, location))); + } + + List commands = new ArrayList<>(); + commands.add(location); + + String arguments = configuration.getAttribute(ICDTLaunchConfigurationConstants.ATTR_TOOL_ARGUMENTS, ""); //$NON-NLS-1$ + if (!arguments.isEmpty()) { + commands.addAll(Arrays.asList(varManager.performStringSubstitution(arguments).split(" "))); //$NON-NLS-1$ + } + + String workingDirectory = configuration.getAttribute(ICDTLaunchConfigurationConstants.ATTR_WORKING_DIRECTORY, + ""); //$NON-NLS-1$ + File workingDir; + if (workingDirectory.isEmpty()) { + workingDir = new File(getProject(configuration).getLocationURI()); + } else { + workingDir = new File(varManager.performStringSubstitution(workingDirectory)); + if (!workingDir.isDirectory()) { + throw new CoreException(new Status(IStatus.ERROR, CDebugCorePlugin.PLUGIN_ID, + String.format(Messages.CoreBuildGenericLaunchConfigDelegate_WorkingDirNotExists, location))); + } + } + + String[] envp = DebugPlugin.getDefault().getLaunchManager().getEnvironment(configuration); + + Process p = DebugPlugin.exec(commands.toArray(new String[0]), workingDir, envp); + DebugPlugin.newProcess(launch, p, String.join(" ", commands)); //$NON-NLS-1$ + } + +} diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/launch/CoreBuildGenericLaunchConfigProvider.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/launch/CoreBuildGenericLaunchConfigProvider.java index 7cc54a1260b..24439e69d5d 100644 --- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/launch/CoreBuildGenericLaunchConfigProvider.java +++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/launch/CoreBuildGenericLaunchConfigProvider.java @@ -1,165 +1,165 @@ -package org.eclipse.cdt.debug.core.launch; - -import java.util.HashMap; -import java.util.Map; -import java.util.Map.Entry; - -import org.eclipse.cdt.debug.core.CDebugCorePlugin; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.debug.core.DebugPlugin; -import org.eclipse.debug.core.ILaunchConfiguration; -import org.eclipse.debug.core.ILaunchConfigurationType; -import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; -import org.eclipse.launchbar.core.AbstractLaunchConfigProvider; -import org.eclipse.launchbar.core.ILaunchDescriptor; -import org.eclipse.launchbar.core.target.ILaunchTarget; -import org.eclipse.launchbar.core.target.ILaunchTargetManager; - -/** - * Core launch configuration provider used by generic target types. - * - * @since 8.3 - */ -public class CoreBuildGenericLaunchConfigProvider extends AbstractLaunchConfigProvider { - - private static final String ATTR_OS = CDebugCorePlugin.PLUGIN_ID + ".target_os"; //$NON-NLS-1$ - private static final String ATTR_ARCH = CDebugCorePlugin.PLUGIN_ID + ".target_arch"; //$NON-NLS-1$ - private static final String EMPTY = ""; //$NON-NLS-1$ - - private Map> configs = new HashMap<>(); - - @Override - public boolean supports(ILaunchDescriptor descriptor, ILaunchTarget target) throws CoreException { - return target.getTypeId().equals(GenericTargetTypeProvider.TYPE_ID); - } - - @Override - public ILaunchConfigurationType getLaunchConfigurationType(ILaunchDescriptor descriptor, ILaunchTarget target) - throws CoreException { - return DebugPlugin.getDefault().getLaunchManager() - .getLaunchConfigurationType(CoreBuildGenericLaunchConfigDelegate.TYPE_ID); - } - - @Override - public ILaunchConfiguration getLaunchConfiguration(ILaunchDescriptor descriptor, ILaunchTarget target) - throws CoreException { - ILaunchConfiguration config = null; - IProject project = descriptor.getAdapter(IProject.class); - if (project != null) { - Map projectConfigs = configs.get(project); - if (projectConfigs == null) { - projectConfigs = new HashMap<>(); - configs.put(project, projectConfigs); - } - - String os = target.getAttribute(ILaunchTarget.ATTR_OS, EMPTY); - String arch = target.getAttribute(ILaunchTarget.ATTR_ARCH, EMPTY); - String targetConfig = os + '.' + arch; - config = projectConfigs.get(targetConfig); - if (config == null) { - config = createLaunchConfiguration(descriptor, target); - } - } - return config; - } - - @Override - protected void populateLaunchConfiguration(ILaunchDescriptor descriptor, ILaunchTarget target, - ILaunchConfigurationWorkingCopy workingCopy) throws CoreException { - super.populateLaunchConfiguration(descriptor, target, workingCopy); - - // Set the project - IProject project = descriptor.getAdapter(IProject.class); - workingCopy.setMappedResources(new IResource[] { project }); - - // set the OS and ARCH - String os = target.getAttribute(ILaunchTarget.ATTR_OS, EMPTY); - workingCopy.setAttribute(ATTR_OS, os); - - String arch = target.getAttribute(ILaunchTarget.ATTR_ARCH, EMPTY); - workingCopy.setAttribute(ATTR_ARCH, arch); - } - - @Override - public boolean launchConfigurationAdded(ILaunchConfiguration configuration) throws CoreException { - // TODO make sure it's the correct type - if (ownsLaunchConfiguration(configuration)) { - IProject project = configuration.getMappedResources()[0].getProject(); - Map projectConfigs = configs.get(project); - if (projectConfigs == null) { - projectConfigs = new HashMap<>(); - configs.put(project, projectConfigs); - } - - String os = configuration.getAttribute(ATTR_OS, EMPTY); - String arch = configuration.getAttribute(ATTR_ARCH, EMPTY); - String targetConfig = os + '.' + arch; - projectConfigs.put(targetConfig, configuration); - return true; - } - return false; - } - - @Override - public boolean launchConfigurationRemoved(ILaunchConfiguration configuration) throws CoreException { - for (Entry> projectEntry : configs.entrySet()) { - Map projectConfigs = projectEntry.getValue(); - for (Entry entry : projectConfigs.entrySet()) { - if (configuration.equals(entry.getValue())) { - projectConfigs.remove(entry.getKey()); - if (projectConfigs.isEmpty()) { - configs.remove(projectEntry.getKey()); - } - return true; - } - } - } - return false; - } - - @Override - public boolean launchConfigurationChanged(ILaunchConfiguration configuration) throws CoreException { - // nothing to do - return false; - } - - @Override - public void launchDescriptorRemoved(ILaunchDescriptor descriptor) throws CoreException { - IProject project = descriptor.getAdapter(IProject.class); - if (project != null) { - Map projectConfigs = configs.get(project); - if (projectConfigs != null) { - for (ILaunchConfiguration config : projectConfigs.values()) { - config.delete(); - } - } - } - } - - @Override - public void launchTargetRemoved(ILaunchTarget target) throws CoreException { - // Any other targets have the same OS and ARCH? - String os = target.getAttribute(ILaunchTarget.ATTR_OS, EMPTY); - String arch = target.getAttribute(ILaunchTarget.ATTR_ARCH, EMPTY); - - ILaunchTargetManager targetManager = CDebugCorePlugin.getService(ILaunchTargetManager.class); - for (ILaunchTarget t : targetManager.getLaunchTargets()) { - if (!target.equals(t) && os.equals(t.getAttribute(ILaunchTarget.ATTR_OS, EMPTY)) - && arch.equals(t.getAttribute(ILaunchTarget.ATTR_ARCH, EMPTY))) { - // Yup, nothing to do then - return; - } - } - - for (Entry> projectEntry : configs.entrySet()) { - Map projectConfigs = projectEntry.getValue(); - ILaunchConfiguration config = projectConfigs.get(os); - if (config != null) { - config.delete(); - } - } - } - -} +package org.eclipse.cdt.debug.core.launch; + +import java.util.HashMap; +import java.util.Map; +import java.util.Map.Entry; + +import org.eclipse.cdt.debug.core.CDebugCorePlugin; +import org.eclipse.core.resources.IProject; +import org.eclipse.core.resources.IResource; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.debug.core.DebugPlugin; +import org.eclipse.debug.core.ILaunchConfiguration; +import org.eclipse.debug.core.ILaunchConfigurationType; +import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; +import org.eclipse.launchbar.core.AbstractLaunchConfigProvider; +import org.eclipse.launchbar.core.ILaunchDescriptor; +import org.eclipse.launchbar.core.target.ILaunchTarget; +import org.eclipse.launchbar.core.target.ILaunchTargetManager; + +/** + * Core launch configuration provider used by generic target types. + * + * @since 8.3 + */ +public class CoreBuildGenericLaunchConfigProvider extends AbstractLaunchConfigProvider { + + private static final String ATTR_OS = CDebugCorePlugin.PLUGIN_ID + ".target_os"; //$NON-NLS-1$ + private static final String ATTR_ARCH = CDebugCorePlugin.PLUGIN_ID + ".target_arch"; //$NON-NLS-1$ + private static final String EMPTY = ""; //$NON-NLS-1$ + + private Map> configs = new HashMap<>(); + + @Override + public boolean supports(ILaunchDescriptor descriptor, ILaunchTarget target) throws CoreException { + return target.getTypeId().equals(GenericTargetTypeProvider.TYPE_ID); + } + + @Override + public ILaunchConfigurationType getLaunchConfigurationType(ILaunchDescriptor descriptor, ILaunchTarget target) + throws CoreException { + return DebugPlugin.getDefault().getLaunchManager() + .getLaunchConfigurationType(CoreBuildGenericLaunchConfigDelegate.TYPE_ID); + } + + @Override + public ILaunchConfiguration getLaunchConfiguration(ILaunchDescriptor descriptor, ILaunchTarget target) + throws CoreException { + ILaunchConfiguration config = null; + IProject project = descriptor.getAdapter(IProject.class); + if (project != null) { + Map projectConfigs = configs.get(project); + if (projectConfigs == null) { + projectConfigs = new HashMap<>(); + configs.put(project, projectConfigs); + } + + String os = target.getAttribute(ILaunchTarget.ATTR_OS, EMPTY); + String arch = target.getAttribute(ILaunchTarget.ATTR_ARCH, EMPTY); + String targetConfig = os + '.' + arch; + config = projectConfigs.get(targetConfig); + if (config == null) { + config = createLaunchConfiguration(descriptor, target); + } + } + return config; + } + + @Override + protected void populateLaunchConfiguration(ILaunchDescriptor descriptor, ILaunchTarget target, + ILaunchConfigurationWorkingCopy workingCopy) throws CoreException { + super.populateLaunchConfiguration(descriptor, target, workingCopy); + + // Set the project + IProject project = descriptor.getAdapter(IProject.class); + workingCopy.setMappedResources(new IResource[] { project }); + + // set the OS and ARCH + String os = target.getAttribute(ILaunchTarget.ATTR_OS, EMPTY); + workingCopy.setAttribute(ATTR_OS, os); + + String arch = target.getAttribute(ILaunchTarget.ATTR_ARCH, EMPTY); + workingCopy.setAttribute(ATTR_ARCH, arch); + } + + @Override + public boolean launchConfigurationAdded(ILaunchConfiguration configuration) throws CoreException { + // TODO make sure it's the correct type + if (ownsLaunchConfiguration(configuration)) { + IProject project = configuration.getMappedResources()[0].getProject(); + Map projectConfigs = configs.get(project); + if (projectConfigs == null) { + projectConfigs = new HashMap<>(); + configs.put(project, projectConfigs); + } + + String os = configuration.getAttribute(ATTR_OS, EMPTY); + String arch = configuration.getAttribute(ATTR_ARCH, EMPTY); + String targetConfig = os + '.' + arch; + projectConfigs.put(targetConfig, configuration); + return true; + } + return false; + } + + @Override + public boolean launchConfigurationRemoved(ILaunchConfiguration configuration) throws CoreException { + for (Entry> projectEntry : configs.entrySet()) { + Map projectConfigs = projectEntry.getValue(); + for (Entry entry : projectConfigs.entrySet()) { + if (configuration.equals(entry.getValue())) { + projectConfigs.remove(entry.getKey()); + if (projectConfigs.isEmpty()) { + configs.remove(projectEntry.getKey()); + } + return true; + } + } + } + return false; + } + + @Override + public boolean launchConfigurationChanged(ILaunchConfiguration configuration) throws CoreException { + // nothing to do + return false; + } + + @Override + public void launchDescriptorRemoved(ILaunchDescriptor descriptor) throws CoreException { + IProject project = descriptor.getAdapter(IProject.class); + if (project != null) { + Map projectConfigs = configs.get(project); + if (projectConfigs != null) { + for (ILaunchConfiguration config : projectConfigs.values()) { + config.delete(); + } + } + } + } + + @Override + public void launchTargetRemoved(ILaunchTarget target) throws CoreException { + // Any other targets have the same OS and ARCH? + String os = target.getAttribute(ILaunchTarget.ATTR_OS, EMPTY); + String arch = target.getAttribute(ILaunchTarget.ATTR_ARCH, EMPTY); + + ILaunchTargetManager targetManager = CDebugCorePlugin.getService(ILaunchTargetManager.class); + for (ILaunchTarget t : targetManager.getLaunchTargets()) { + if (!target.equals(t) && os.equals(t.getAttribute(ILaunchTarget.ATTR_OS, EMPTY)) + && arch.equals(t.getAttribute(ILaunchTarget.ATTR_ARCH, EMPTY))) { + // Yup, nothing to do then + return; + } + } + + for (Entry> projectEntry : configs.entrySet()) { + Map projectConfigs = projectEntry.getValue(); + ILaunchConfiguration config = projectConfigs.get(os); + if (config != null) { + config.delete(); + } + } + } + +} diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/launch/NullProcess.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/launch/NullProcess.java index ca62c059340..bab959fbcd3 100644 --- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/launch/NullProcess.java +++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/launch/NullProcess.java @@ -1,107 +1,107 @@ -/******************************************************************************* - * 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.debug.core.launch; - -import java.io.IOException; - -import org.eclipse.core.runtime.PlatformObject; -import org.eclipse.debug.core.DebugException; -import org.eclipse.debug.core.ILaunch; -import org.eclipse.debug.core.IStreamListener; -import org.eclipse.debug.core.model.IProcess; -import org.eclipse.debug.core.model.IStreamMonitor; -import org.eclipse.debug.core.model.IStreamsProxy; - -/** - * A simple process that only spits out a message then terminates. - * - * @since 8.3 - */ -public class NullProcess extends PlatformObject implements IProcess { - - private final String message; - private final ILaunch launch; - - public NullProcess(ILaunch launch, String message) { - this.launch = launch; - this.message = message; - } - - @Override - public boolean canTerminate() { - return true; - } - - @Override - public boolean isTerminated() { - return true; - } - - @Override - public void terminate() throws DebugException { - } - - @Override - public String getLabel() { - return launch.getLaunchConfiguration().getName(); - } - - @Override - public ILaunch getLaunch() { - return launch; - } - - @Override - public IStreamsProxy getStreamsProxy() { - return new IStreamsProxy() { - @Override - public void write(String input) throws IOException { - // TODO Auto-generated method stub - - } - - @Override - public IStreamMonitor getOutputStreamMonitor() { - return new IStreamMonitor() { - @Override - public void removeListener(IStreamListener listener) { - } - - @Override - public String getContents() { - return message; - } - - @Override - public void addListener(IStreamListener listener) { - } - }; - } - - @Override - public IStreamMonitor getErrorStreamMonitor() { - return null; - } - }; - } - - @Override - public void setAttribute(String key, String value) { - } - - @Override - public String getAttribute(String key) { - return null; - } - - @Override - public int getExitValue() throws DebugException { - return 0; - } - -} +/******************************************************************************* + * 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.debug.core.launch; + +import java.io.IOException; + +import org.eclipse.core.runtime.PlatformObject; +import org.eclipse.debug.core.DebugException; +import org.eclipse.debug.core.ILaunch; +import org.eclipse.debug.core.IStreamListener; +import org.eclipse.debug.core.model.IProcess; +import org.eclipse.debug.core.model.IStreamMonitor; +import org.eclipse.debug.core.model.IStreamsProxy; + +/** + * A simple process that only spits out a message then terminates. + * + * @since 8.3 + */ +public class NullProcess extends PlatformObject implements IProcess { + + private final String message; + private final ILaunch launch; + + public NullProcess(ILaunch launch, String message) { + this.launch = launch; + this.message = message; + } + + @Override + public boolean canTerminate() { + return true; + } + + @Override + public boolean isTerminated() { + return true; + } + + @Override + public void terminate() throws DebugException { + } + + @Override + public String getLabel() { + return launch.getLaunchConfiguration().getName(); + } + + @Override + public ILaunch getLaunch() { + return launch; + } + + @Override + public IStreamsProxy getStreamsProxy() { + return new IStreamsProxy() { + @Override + public void write(String input) throws IOException { + // TODO Auto-generated method stub + + } + + @Override + public IStreamMonitor getOutputStreamMonitor() { + return new IStreamMonitor() { + @Override + public void removeListener(IStreamListener listener) { + } + + @Override + public String getContents() { + return message; + } + + @Override + public void addListener(IStreamListener listener) { + } + }; + } + + @Override + public IStreamMonitor getErrorStreamMonitor() { + return null; + } + }; + } + + @Override + public void setAttribute(String key, String value) { + } + + @Override + public String getAttribute(String key) { + return null; + } + + @Override + public int getExitValue() throws DebugException { + return 0; + } + +} diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/Messages.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/Messages.java index 7de4c1786fe..e72f4cb2ee7 100644 --- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/Messages.java +++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/Messages.java @@ -1,25 +1,25 @@ -/******************************************************************************* - * 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.debug.internal.core; - -import org.eclipse.osgi.util.NLS; - -public class Messages extends NLS { - private static final String BUNDLE_NAME = "org.eclipse.cdt.debug.internal.core.messages"; //$NON-NLS-1$ - public static String CoreBuildGenericLaunchConfigDelegate_CommandNotValid; - public static String CoreBuildGenericLaunchConfigDelegate_NoAction; - public static String CoreBuildGenericLaunchConfigDelegate_SubstitutionFailed; - public static String CoreBuildGenericLaunchConfigDelegate_WorkingDirNotExists; - 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.debug.internal.core; + +import org.eclipse.osgi.util.NLS; + +public class Messages extends NLS { + private static final String BUNDLE_NAME = "org.eclipse.cdt.debug.internal.core.messages"; //$NON-NLS-1$ + public static String CoreBuildGenericLaunchConfigDelegate_CommandNotValid; + public static String CoreBuildGenericLaunchConfigDelegate_NoAction; + public static String CoreBuildGenericLaunchConfigDelegate_SubstitutionFailed; + public static String CoreBuildGenericLaunchConfigDelegate_WorkingDirNotExists; + static { + // initialize resource bundle + NLS.initializeMessages(BUNDLE_NAME, Messages.class); + } + + private Messages() { + } +} diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/breakpoints/CBreakpointImportParticipant.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/breakpoints/CBreakpointImportParticipant.java index 6d9037fef4d..995eb38c6f9 100644 --- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/breakpoints/CBreakpointImportParticipant.java +++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/breakpoints/CBreakpointImportParticipant.java @@ -1,164 +1,164 @@ -/******************************************************************************* - * Copyright (c) 2015 Freescale Semiconductors 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: - * Dan Ungureanu (Freescale Semiconductors) - Initial implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.internal.core.breakpoints; - -import java.util.Map; - -import org.eclipse.cdt.debug.core.model.ICBreakpoint; -import org.eclipse.cdt.debug.core.model.ICEventBreakpoint; -import org.eclipse.cdt.debug.core.model.ICLineBreakpoint; -import org.eclipse.core.resources.IMarker; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.debug.core.model.IBreakpoint; -import org.eclipse.debug.core.model.IBreakpointImportParticipant; - -/** - * Initial implementation covering matching breakpoints at import for all platform C/C++ breakpoints - */ -public class CBreakpointImportParticipant implements IBreakpointImportParticipant { - /* - * (non-Javadoc) - * - * @see - * org.eclipse.debug.core.model.IBreakpointImportParticipant#matches(java - * .util.Map, org.eclipse.debug.core.model.IBreakpoint) - */ - public boolean matches(Map attributes, IBreakpoint breakpoint) - throws CoreException { - if (attributes == null || breakpoint == null) { - return false; - } - String type = (String) attributes.get("type"); //$NON-NLS-1$ - if (type == null) { - return false; - } - if (!breakpoint.getMarker().getType().equals(type)) { - return false; - } - if (breakpoint instanceof AbstractLineBreakpoint) { - return matchesLineBreakpoint(attributes, - (AbstractLineBreakpoint) breakpoint); - } - if (breakpoint instanceof AbstractTracepoint) { - return matchesTracepoint(attributes, - (AbstractTracepoint) breakpoint); - } - if (breakpoint instanceof CEventBreakpoint) { - return matchesEventBreakpoint(attributes, (CEventBreakpoint) breakpoint); - } - if (breakpoint instanceof CWatchpoint) { - return matchesWatchpoint(attributes, (CWatchpoint) breakpoint); - } - return false; - } - - /* - * (non-Javadoc) - * @see org.eclipse.debug.core.model.IBreakpointImportParticipant#verify(org.eclipse.debug.core.model.IBreakpoint) - */ - @Override - public void verify(IBreakpoint breakpoint) throws CoreException {} - - - /** - * Compares two attributes in a null safe way - * - * @param attr1 - * the first attribute - * @param attr2 - * the second attribute - * @return true if the attributes are equal, false otherwise. If both - * attributes are null they are considered to be equal - */ - private boolean attributesEqual(Object attr1, Object attr2) { - if (attr1 == null) { - return attr2 == null; - } - return attr1.equals(attr2); - } - - /** - * Returns if the given map of attributes matches the given breakpoint - * Works for any breakpoint class that extends AbstractLineBreakpoint - * - * @param attributes - * @param breakpoint - * @return true if the attributes match the breakpoint's attributes, false - * otherwise - * @throws CoreException - */ - private boolean matchesLineBreakpoint(Map attributes, AbstractLineBreakpoint breakpoint) - throws CoreException { - Integer line = (Integer) attributes.get(IMarker.LINE_NUMBER); - int lineNumber = (line == null ? -1 : line.intValue()); - return breakpoint.getLineNumber() == lineNumber - && attributesEqual(breakpoint.getType(), attributes.get(CBreakpoint.TYPE)) - && attributesEqual(breakpoint.getSourceHandle(), attributes.get(ICBreakpoint.SOURCE_HANDLE)) - && attributesEqual(breakpoint.getMarker().getAttribute(ICLineBreakpoint.ADDRESS), attributes.get(ICLineBreakpoint.ADDRESS)) - && attributesEqual(breakpoint.getMarker().getAttribute(ICLineBreakpoint.FUNCTION), attributes.get(ICLineBreakpoint.FUNCTION)); - } - - /** - * Returns if the given map of attributes matches the given tracepoint - * Works for any breakpoint class that extends AbstractTracepoint - * - * @param attributes - * @param tracepoint - * @return true if the attributes match the tracepoint's attributes, false - * otherwise - * @throws CoreException - */ - private boolean matchesTracepoint(Map attributes, AbstractTracepoint tracepoint) - throws CoreException { - Integer line = (Integer) attributes.get(IMarker.LINE_NUMBER); - int lineNumber = (line == null ? -1 : line.intValue()); - return tracepoint.getLineNumber() == lineNumber - && attributesEqual(tracepoint.getType(), attributes.get(CBreakpoint.TYPE)) - && attributesEqual(tracepoint.getSourceHandle(), attributes.get(ICBreakpoint.SOURCE_HANDLE)) - && attributesEqual(tracepoint.getMarker().getAttribute(ICLineBreakpoint.ADDRESS), attributes.get(ICLineBreakpoint.ADDRESS)) - && attributesEqual(tracepoint.getMarker().getAttribute(ICLineBreakpoint.FUNCTION), attributes.get(ICLineBreakpoint.FUNCTION)); - } - - /** - * Returns if the given map of attributes matches the given event breakpoint - * - * @param attributes - * @param breakpoint - * @return true if the attributes match the event breakpoint's attributes, false - * otherwise - * @throws CoreException - */ - private boolean matchesEventBreakpoint(Map attributes, CEventBreakpoint breakpoint) - throws CoreException { - return breakpoint.getEventArgument().equals( - attributes.get(ICEventBreakpoint.EVENT_ARG)) - && attributesEqual(breakpoint.getEventType(), - attributes.get(ICEventBreakpoint.EVENT_TYPE_ID)); - } - - /** - * Returns if the given map of attributes matches the given watchpoint - * - * @param attributes - * @param breakpoint - * @return true if the attributes match the watchpoint's attributes, false - * otherwise - * @throws CoreException - */ - private boolean matchesWatchpoint(Map attributes, CWatchpoint watchpoint) - throws CoreException { - return watchpoint.getExpression().equals( - attributes.get(CWatchpoint.EXPRESSION)) - && attributesEqual(watchpoint.getType(), - attributes.get(CBreakpoint.TYPE)); - } - -} +/******************************************************************************* + * Copyright (c) 2015 Freescale Semiconductors 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: + * Dan Ungureanu (Freescale Semiconductors) - Initial implementation + *******************************************************************************/ +package org.eclipse.cdt.debug.internal.core.breakpoints; + +import java.util.Map; + +import org.eclipse.cdt.debug.core.model.ICBreakpoint; +import org.eclipse.cdt.debug.core.model.ICEventBreakpoint; +import org.eclipse.cdt.debug.core.model.ICLineBreakpoint; +import org.eclipse.core.resources.IMarker; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.debug.core.model.IBreakpoint; +import org.eclipse.debug.core.model.IBreakpointImportParticipant; + +/** + * Initial implementation covering matching breakpoints at import for all platform C/C++ breakpoints + */ +public class CBreakpointImportParticipant implements IBreakpointImportParticipant { + /* + * (non-Javadoc) + * + * @see + * org.eclipse.debug.core.model.IBreakpointImportParticipant#matches(java + * .util.Map, org.eclipse.debug.core.model.IBreakpoint) + */ + public boolean matches(Map attributes, IBreakpoint breakpoint) + throws CoreException { + if (attributes == null || breakpoint == null) { + return false; + } + String type = (String) attributes.get("type"); //$NON-NLS-1$ + if (type == null) { + return false; + } + if (!breakpoint.getMarker().getType().equals(type)) { + return false; + } + if (breakpoint instanceof AbstractLineBreakpoint) { + return matchesLineBreakpoint(attributes, + (AbstractLineBreakpoint) breakpoint); + } + if (breakpoint instanceof AbstractTracepoint) { + return matchesTracepoint(attributes, + (AbstractTracepoint) breakpoint); + } + if (breakpoint instanceof CEventBreakpoint) { + return matchesEventBreakpoint(attributes, (CEventBreakpoint) breakpoint); + } + if (breakpoint instanceof CWatchpoint) { + return matchesWatchpoint(attributes, (CWatchpoint) breakpoint); + } + return false; + } + + /* + * (non-Javadoc) + * @see org.eclipse.debug.core.model.IBreakpointImportParticipant#verify(org.eclipse.debug.core.model.IBreakpoint) + */ + @Override + public void verify(IBreakpoint breakpoint) throws CoreException {} + + + /** + * Compares two attributes in a null safe way + * + * @param attr1 + * the first attribute + * @param attr2 + * the second attribute + * @return true if the attributes are equal, false otherwise. If both + * attributes are null they are considered to be equal + */ + private boolean attributesEqual(Object attr1, Object attr2) { + if (attr1 == null) { + return attr2 == null; + } + return attr1.equals(attr2); + } + + /** + * Returns if the given map of attributes matches the given breakpoint + * Works for any breakpoint class that extends AbstractLineBreakpoint + * + * @param attributes + * @param breakpoint + * @return true if the attributes match the breakpoint's attributes, false + * otherwise + * @throws CoreException + */ + private boolean matchesLineBreakpoint(Map attributes, AbstractLineBreakpoint breakpoint) + throws CoreException { + Integer line = (Integer) attributes.get(IMarker.LINE_NUMBER); + int lineNumber = (line == null ? -1 : line.intValue()); + return breakpoint.getLineNumber() == lineNumber + && attributesEqual(breakpoint.getType(), attributes.get(CBreakpoint.TYPE)) + && attributesEqual(breakpoint.getSourceHandle(), attributes.get(ICBreakpoint.SOURCE_HANDLE)) + && attributesEqual(breakpoint.getMarker().getAttribute(ICLineBreakpoint.ADDRESS), attributes.get(ICLineBreakpoint.ADDRESS)) + && attributesEqual(breakpoint.getMarker().getAttribute(ICLineBreakpoint.FUNCTION), attributes.get(ICLineBreakpoint.FUNCTION)); + } + + /** + * Returns if the given map of attributes matches the given tracepoint + * Works for any breakpoint class that extends AbstractTracepoint + * + * @param attributes + * @param tracepoint + * @return true if the attributes match the tracepoint's attributes, false + * otherwise + * @throws CoreException + */ + private boolean matchesTracepoint(Map attributes, AbstractTracepoint tracepoint) + throws CoreException { + Integer line = (Integer) attributes.get(IMarker.LINE_NUMBER); + int lineNumber = (line == null ? -1 : line.intValue()); + return tracepoint.getLineNumber() == lineNumber + && attributesEqual(tracepoint.getType(), attributes.get(CBreakpoint.TYPE)) + && attributesEqual(tracepoint.getSourceHandle(), attributes.get(ICBreakpoint.SOURCE_HANDLE)) + && attributesEqual(tracepoint.getMarker().getAttribute(ICLineBreakpoint.ADDRESS), attributes.get(ICLineBreakpoint.ADDRESS)) + && attributesEqual(tracepoint.getMarker().getAttribute(ICLineBreakpoint.FUNCTION), attributes.get(ICLineBreakpoint.FUNCTION)); + } + + /** + * Returns if the given map of attributes matches the given event breakpoint + * + * @param attributes + * @param breakpoint + * @return true if the attributes match the event breakpoint's attributes, false + * otherwise + * @throws CoreException + */ + private boolean matchesEventBreakpoint(Map attributes, CEventBreakpoint breakpoint) + throws CoreException { + return breakpoint.getEventArgument().equals( + attributes.get(ICEventBreakpoint.EVENT_ARG)) + && attributesEqual(breakpoint.getEventType(), + attributes.get(ICEventBreakpoint.EVENT_TYPE_ID)); + } + + /** + * Returns if the given map of attributes matches the given watchpoint + * + * @param attributes + * @param breakpoint + * @return true if the attributes match the watchpoint's attributes, false + * otherwise + * @throws CoreException + */ + private boolean matchesWatchpoint(Map attributes, CWatchpoint watchpoint) + throws CoreException { + return watchpoint.getExpression().equals( + attributes.get(CWatchpoint.EXPRESSION)) + && attributesEqual(watchpoint.getType(), + attributes.get(CBreakpoint.TYPE)); + } + +} diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/messages.properties b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/messages.properties index c00aff78954..387004aeef9 100644 --- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/messages.properties +++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/messages.properties @@ -1,11 +1,11 @@ -############################################################################### -# Copyright (c) 2003, 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 -############################################################################### -CoreBuildGenericLaunchConfigDelegate_CommandNotValid=Not a valid command "%s" -CoreBuildGenericLaunchConfigDelegate_NoAction=No action specified. Skipping. -CoreBuildGenericLaunchConfigDelegate_SubstitutionFailed=Variable substitution failed "%s" -CoreBuildGenericLaunchConfigDelegate_WorkingDirNotExists=Working directory %s does not exist +############################################################################### +# Copyright (c) 2003, 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 +############################################################################### +CoreBuildGenericLaunchConfigDelegate_CommandNotValid=Not a valid command "%s" +CoreBuildGenericLaunchConfigDelegate_NoAction=No action specified. Skipping. +CoreBuildGenericLaunchConfigDelegate_SubstitutionFailed=Variable substitution failed "%s" +CoreBuildGenericLaunchConfigDelegate_WorkingDirNotExists=Working directory %s does not exist diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/preferences/StringSetSerializer.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/preferences/StringSetSerializer.java index fd8c60fea3e..42da492c9ba 100644 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/preferences/StringSetSerializer.java +++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/preferences/StringSetSerializer.java @@ -1,55 +1,55 @@ -/******************************************************************************* - * Copyright (c) 2006, 2016 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 Corporation - initial API and implementation +/******************************************************************************* + * Copyright (c) 2006, 2016 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 Corporation - initial API and implementation *******************************************************************************/ -package org.eclipse.cdt.debug.internal.ui.preferences; - -import java.util.HashSet; -import java.util.Iterator; -import java.util.Set; -import java.util.StringTokenizer; - -import org.eclipse.core.runtime.Assert; - -public final class StringSetSerializer { - private static final String DELIM= "\0"; //$NON-NLS-1$ - private StringSetSerializer() { - } - - public static String serialize(Set strings) { - Assert.isLegal(strings != null); - StringBuilder buf= new StringBuilder(strings.size() * 20); - for (Iterator it= strings.iterator(); it.hasNext();) { - buf.append(it.next()); - if (it.hasNext()) - buf.append(DELIM); - } - return buf.toString(); - } - - public static Set deserialize(String serialized) { - Assert.isLegal(serialized != null); - Set marked= new HashSet(); - StringTokenizer tok= new StringTokenizer(serialized, DELIM); - while (tok.hasMoreTokens()) - marked.add(tok.nextToken()); - return marked; - } - - public static String[] getDifference(String oldValue, String newValue) { - Set oldSet= deserialize(oldValue); - Set newSet= deserialize(newValue); - Set intersection= new HashSet(oldSet); - intersection.retainAll(newSet); - oldSet.removeAll(intersection); - newSet.removeAll(intersection); - oldSet.addAll(newSet); - return oldSet.toArray(new String[oldSet.size()]); - } -} +package org.eclipse.cdt.debug.internal.ui.preferences; + +import java.util.HashSet; +import java.util.Iterator; +import java.util.Set; +import java.util.StringTokenizer; + +import org.eclipse.core.runtime.Assert; + +public final class StringSetSerializer { + private static final String DELIM= "\0"; //$NON-NLS-1$ + private StringSetSerializer() { + } + + public static String serialize(Set strings) { + Assert.isLegal(strings != null); + StringBuilder buf= new StringBuilder(strings.size() * 20); + for (Iterator it= strings.iterator(); it.hasNext();) { + buf.append(it.next()); + if (it.hasNext()) + buf.append(DELIM); + } + return buf.toString(); + } + + public static Set deserialize(String serialized) { + Assert.isLegal(serialized != null); + Set marked= new HashSet(); + StringTokenizer tok= new StringTokenizer(serialized, DELIM); + while (tok.hasMoreTokens()) + marked.add(tok.nextToken()); + return marked; + } + + public static String[] getDifference(String oldValue, String newValue) { + Set oldSet= deserialize(oldValue); + Set newSet= deserialize(newValue); + Set intersection= new HashSet(oldSet); + intersection.retainAll(newSet); + oldSet.removeAll(intersection); + newSet.removeAll(intersection); + oldSet.addAll(newSet); + return oldSet.toArray(new String[oldSet.size()]); + } +} diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/breakpointactions/CLICommandAction.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/breakpointactions/CLICommandAction.java index f5b11815764..3fed228efb2 100644 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/breakpointactions/CLICommandAction.java +++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/breakpointactions/CLICommandAction.java @@ -1,124 +1,124 @@ -/******************************************************************************* - * 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 - * - * Contributors: - * Alena Laskavaia (QNX)- Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.ui.breakpointactions; - -import java.text.MessageFormat; - -import org.eclipse.cdt.debug.core.CDIDebugModel; -import org.eclipse.cdt.debug.core.breakpointactions.AbstractBreakpointAction; -import org.eclipse.cdt.debug.core.breakpointactions.ICLIDebugActionEnabler; -import org.eclipse.cdt.debug.internal.core.ICDebugInternalConstants; -import org.eclipse.cdt.debug.internal.ui.IInternalCDebugUIConstants; -import org.eclipse.cdt.debug.ui.CDebugUIPlugin; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.debug.core.DebugPlugin; -import org.eclipse.debug.core.model.IBreakpoint; -import org.w3c.dom.DOMException; -import org.w3c.dom.Document; -import org.w3c.dom.Element; - -/** - * This breakpoint action allows to pass arbitrary command line command to debugger backend. - * For example in case of gdb it would be something like - * p myGlobal - * cont - * @since 8.0 - */ -public class CLICommandAction extends AbstractBreakpointAction { - private static final String COMMAND_ATT = "command"; //$NON-NLS-1$ - private String command = ""; //$NON-NLS-1$ - - @Override - public IStatus execute(IBreakpoint breakpoint, IAdaptable context, IProgressMonitor monitor) { - ICLIDebugActionEnabler enabler = context.getAdapter(ICLIDebugActionEnabler.class); - if (enabler != null) { - try { - enabler.execute(getCommand()); - } catch (Exception e) { - return errorStatus(e); - } - } else - return new Status(IStatus.ERROR, CDebugUIPlugin.getUniqueIdentifier(), - IInternalCDebugUIConstants.INTERNAL_ERROR, - Messages.getString("CLICommandAction.NoSupport"), null); //$NON-NLS-1$ - return monitor.isCanceled() ? Status.CANCEL_STATUS : Status.OK_STATUS; - } - - private IStatus errorStatus(Exception ex) { - String errorMsg = MessageFormat.format(Messages.getString("CLICommandAction.error.0"), //$NON-NLS-1$ - new Object[] { getSummary() }); - return new Status(IStatus.ERROR, CDIDebugModel.getPluginIdentifier(), - ICDebugInternalConstants.STATUS_CODE_ERROR, errorMsg, ex); - } - - @Override - public String getDefaultName() { - return Messages.getString("CLICommandAction.UntitledName"); //$NON-NLS-1$ - } - - @Override - public String getIdentifier() { - return "org.eclipse.cdt.debug.ui.breakpointactions.CLICommandAction"; //$NON-NLS-1$ - } - - @Override - public String getMemento() { - try { - Document doc = DebugPlugin.newDocument(); - Element rootElement = doc.createElement(COMMAND_ATT); - rootElement.setAttribute(COMMAND_ATT, command); - doc.appendChild(rootElement); - return DebugPlugin.serializeDocument(doc); - } catch (DOMException | CoreException e) { - CDebugUIPlugin.log(e); - - } - return ""; //$NON-NLS-1$ - } - - public String getCommand() { - return command; - } - - public void setCommand(String command) { - this.command = command; - } - - @Override - public String getSummary() { - String summary = getCommand(); - if (summary.length() > 32) - summary = summary.substring(0, 32); - return summary; - } - - @Override - public String getTypeName() { - return Messages.getString("CLICommandAction.TypeName"); //$NON-NLS-1$ - } - - @Override - public void initializeFromMemento(String data) { - try { - Element root = DebugPlugin.parseDocument(data); - String value = root.getAttribute(COMMAND_ATT); - if (value == null) - value = ""; //$NON-NLS-1$ - command = value; - } catch (Exception e) { - CDebugUIPlugin.log(e); - } - } -} +/******************************************************************************* + * 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 + * + * Contributors: + * Alena Laskavaia (QNX)- Initial API and implementation + *******************************************************************************/ +package org.eclipse.cdt.debug.ui.breakpointactions; + +import java.text.MessageFormat; + +import org.eclipse.cdt.debug.core.CDIDebugModel; +import org.eclipse.cdt.debug.core.breakpointactions.AbstractBreakpointAction; +import org.eclipse.cdt.debug.core.breakpointactions.ICLIDebugActionEnabler; +import org.eclipse.cdt.debug.internal.core.ICDebugInternalConstants; +import org.eclipse.cdt.debug.internal.ui.IInternalCDebugUIConstants; +import org.eclipse.cdt.debug.ui.CDebugUIPlugin; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Status; +import org.eclipse.debug.core.DebugPlugin; +import org.eclipse.debug.core.model.IBreakpoint; +import org.w3c.dom.DOMException; +import org.w3c.dom.Document; +import org.w3c.dom.Element; + +/** + * This breakpoint action allows to pass arbitrary command line command to debugger backend. + * For example in case of gdb it would be something like + * p myGlobal + * cont + * @since 8.0 + */ +public class CLICommandAction extends AbstractBreakpointAction { + private static final String COMMAND_ATT = "command"; //$NON-NLS-1$ + private String command = ""; //$NON-NLS-1$ + + @Override + public IStatus execute(IBreakpoint breakpoint, IAdaptable context, IProgressMonitor monitor) { + ICLIDebugActionEnabler enabler = context.getAdapter(ICLIDebugActionEnabler.class); + if (enabler != null) { + try { + enabler.execute(getCommand()); + } catch (Exception e) { + return errorStatus(e); + } + } else + return new Status(IStatus.ERROR, CDebugUIPlugin.getUniqueIdentifier(), + IInternalCDebugUIConstants.INTERNAL_ERROR, + Messages.getString("CLICommandAction.NoSupport"), null); //$NON-NLS-1$ + return monitor.isCanceled() ? Status.CANCEL_STATUS : Status.OK_STATUS; + } + + private IStatus errorStatus(Exception ex) { + String errorMsg = MessageFormat.format(Messages.getString("CLICommandAction.error.0"), //$NON-NLS-1$ + new Object[] { getSummary() }); + return new Status(IStatus.ERROR, CDIDebugModel.getPluginIdentifier(), + ICDebugInternalConstants.STATUS_CODE_ERROR, errorMsg, ex); + } + + @Override + public String getDefaultName() { + return Messages.getString("CLICommandAction.UntitledName"); //$NON-NLS-1$ + } + + @Override + public String getIdentifier() { + return "org.eclipse.cdt.debug.ui.breakpointactions.CLICommandAction"; //$NON-NLS-1$ + } + + @Override + public String getMemento() { + try { + Document doc = DebugPlugin.newDocument(); + Element rootElement = doc.createElement(COMMAND_ATT); + rootElement.setAttribute(COMMAND_ATT, command); + doc.appendChild(rootElement); + return DebugPlugin.serializeDocument(doc); + } catch (DOMException | CoreException e) { + CDebugUIPlugin.log(e); + + } + return ""; //$NON-NLS-1$ + } + + public String getCommand() { + return command; + } + + public void setCommand(String command) { + this.command = command; + } + + @Override + public String getSummary() { + String summary = getCommand(); + if (summary.length() > 32) + summary = summary.substring(0, 32); + return summary; + } + + @Override + public String getTypeName() { + return Messages.getString("CLICommandAction.TypeName"); //$NON-NLS-1$ + } + + @Override + public void initializeFromMemento(String data) { + try { + Element root = DebugPlugin.parseDocument(data); + String value = root.getAttribute(COMMAND_ATT); + if (value == null) + value = ""; //$NON-NLS-1$ + command = value; + } catch (Exception e) { + CDebugUIPlugin.log(e); + } + } +} diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/breakpointactions/CLICommandActionComposite.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/breakpointactions/CLICommandActionComposite.java index 2ee432bc6ba..663a233cfa3 100644 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/breakpointactions/CLICommandActionComposite.java +++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/breakpointactions/CLICommandActionComposite.java @@ -1,43 +1,43 @@ -/******************************************************************************* - * 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 - * - * Contributors: - * Alena Laskavaia (QNX)- Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.ui.breakpointactions; - -import org.eclipse.jface.layout.GridDataFactory; -import org.eclipse.jface.layout.GridLayoutFactory; -import org.eclipse.swt.SWT; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Text; - -/** - * This composite show a little text field (multi-line) that allow to enter to enter debugger commands. - * Interpretation of that depends on the backend - * - * @since 8.0 - */ -public class CLICommandActionComposite extends Composite { - private Text command; - - public CLICommandActionComposite(Composite parent, int style, CLICommandActionPage commandActionPage) { - super(parent, style); - setLayout(GridLayoutFactory.fillDefaults().create()); - Label messageToLogLabel = new Label(this, SWT.NONE); - messageToLogLabel.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create()); - messageToLogLabel.setText(Messages.getString("CLICommandActionComposite.0")); //$NON-NLS-1$ - command = new Text(this, SWT.BORDER | SWT.WRAP); - command.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create()); - command.setText(commandActionPage.getCLICommandAction().getCommand()); - } - - public String getCommand() { - return command.getText(); - } -} +/******************************************************************************* + * 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 + * + * Contributors: + * Alena Laskavaia (QNX)- Initial API and implementation + *******************************************************************************/ +package org.eclipse.cdt.debug.ui.breakpointactions; + +import org.eclipse.jface.layout.GridDataFactory; +import org.eclipse.jface.layout.GridLayoutFactory; +import org.eclipse.swt.SWT; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Text; + +/** + * This composite show a little text field (multi-line) that allow to enter to enter debugger commands. + * Interpretation of that depends on the backend + * + * @since 8.0 + */ +public class CLICommandActionComposite extends Composite { + private Text command; + + public CLICommandActionComposite(Composite parent, int style, CLICommandActionPage commandActionPage) { + super(parent, style); + setLayout(GridLayoutFactory.fillDefaults().create()); + Label messageToLogLabel = new Label(this, SWT.NONE); + messageToLogLabel.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create()); + messageToLogLabel.setText(Messages.getString("CLICommandActionComposite.0")); //$NON-NLS-1$ + command = new Text(this, SWT.BORDER | SWT.WRAP); + command.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create()); + command.setText(commandActionPage.getCLICommandAction().getCommand()); + } + + public String getCommand() { + return command.getText(); + } +} diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/breakpointactions/CLICommandActionPage.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/breakpointactions/CLICommandActionPage.java index 7b6d606a89a..0979ac5cfa8 100644 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/breakpointactions/CLICommandActionPage.java +++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/breakpointactions/CLICommandActionPage.java @@ -1,45 +1,45 @@ -/******************************************************************************* - * 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 - * - * Contributors: - * Alena Laskavaia (QNX)- Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.ui.breakpointactions; - -import org.eclipse.cdt.debug.core.breakpointactions.IBreakpointAction; -import org.eclipse.cdt.debug.ui.breakpointactions.IBreakpointActionPage; -import org.eclipse.core.runtime.PlatformObject; -import org.eclipse.swt.widgets.Composite; - -/** - * @since 8.0 - */ -public class CLICommandActionPage extends PlatformObject implements - IBreakpointActionPage { - private CLICommandAction cliCommandAction; - private CLICommandActionComposite editor; - - public CLICommandAction getCLICommandAction() { - return cliCommandAction; - } - - @Override - public void actionDialogCanceled() { - } - - @Override - public void actionDialogOK() { - cliCommandAction.setCommand(editor.getCommand()); - } - - @Override - public Composite createComposite(IBreakpointAction action, Composite composite, int style) { - cliCommandAction = (CLICommandAction) action; - editor = new CLICommandActionComposite(composite, style, this); - return editor; - } -} +/******************************************************************************* + * 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 + * + * Contributors: + * Alena Laskavaia (QNX)- Initial API and implementation + *******************************************************************************/ +package org.eclipse.cdt.debug.ui.breakpointactions; + +import org.eclipse.cdt.debug.core.breakpointactions.IBreakpointAction; +import org.eclipse.cdt.debug.ui.breakpointactions.IBreakpointActionPage; +import org.eclipse.core.runtime.PlatformObject; +import org.eclipse.swt.widgets.Composite; + +/** + * @since 8.0 + */ +public class CLICommandActionPage extends PlatformObject implements + IBreakpointActionPage { + private CLICommandAction cliCommandAction; + private CLICommandActionComposite editor; + + public CLICommandAction getCLICommandAction() { + return cliCommandAction; + } + + @Override + public void actionDialogCanceled() { + } + + @Override + public void actionDialogOK() { + cliCommandAction.setCommand(editor.getCommand()); + } + + @Override + public Composite createComposite(IBreakpointAction action, Composite composite, int style) { + cliCommandAction = (CLICommandAction) action; + editor = new CLICommandActionComposite(composite, style, this); + return editor; + } +} diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/breakpointactions/IBreakpointActionPage.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/breakpointactions/IBreakpointActionPage.java index f89419a0a6b..3bf7ffdd881 100644 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/breakpointactions/IBreakpointActionPage.java +++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/breakpointactions/IBreakpointActionPage.java @@ -1,32 +1,32 @@ -/******************************************************************************* - * Copyright (c) 2007 Nokia 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: - * Nokia - initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.ui.breakpointactions; - -import org.eclipse.cdt.debug.core.breakpointactions.IBreakpointAction; -import org.eclipse.swt.widgets.Composite; - -/** - * - * THIS INTERFACE IS PROVISIONAL AND WILL CHANGE IN THE FUTURE - * PLUG-INS USING THIS INTERFACE WILL NEED - * TO BE REVISED TO WORK WITH FUTURE VERSIONS OF CDT. - * - */ - -public interface IBreakpointActionPage { - - public void actionDialogCanceled(); - - public void actionDialogOK(); - - public Composite createComposite(IBreakpointAction action, Composite composite, int style); - -} +/******************************************************************************* + * Copyright (c) 2007 Nokia 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: + * Nokia - initial API and implementation + *******************************************************************************/ +package org.eclipse.cdt.debug.ui.breakpointactions; + +import org.eclipse.cdt.debug.core.breakpointactions.IBreakpointAction; +import org.eclipse.swt.widgets.Composite; + +/** + * + * THIS INTERFACE IS PROVISIONAL AND WILL CHANGE IN THE FUTURE + * PLUG-INS USING THIS INTERFACE WILL NEED + * TO BE REVISED TO WORK WITH FUTURE VERSIONS OF CDT. + * + */ + +public interface IBreakpointActionPage { + + public void actionDialogCanceled(); + + public void actionDialogOK(); + + public Composite createComposite(IBreakpointAction action, Composite composite, int style); + +} diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/breakpointactions/LogActionComposite.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/breakpointactions/LogActionComposite.java index 031b30979e7..63d922cc8db 100644 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/breakpointactions/LogActionComposite.java +++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/breakpointactions/LogActionComposite.java @@ -1,75 +1,75 @@ -/******************************************************************************* - * Copyright (c) 2007, 2012 Nokia 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: - * Nokia - initial API and implementation +/******************************************************************************* + * Copyright (c) 2007, 2012 Nokia 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: + * Nokia - initial API and implementation *******************************************************************************/ -package org.eclipse.cdt.debug.ui.breakpointactions; - -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.swt.widgets.Label; -import org.eclipse.swt.widgets.Text; - -public class LogActionComposite extends Composite { - - private Button expressionButton; - private LogActionPage logActionPage; - private Text message; - - public LogActionComposite(Composite parent, int style, LogActionPage logActionPage) { - super(parent, style); - final GridLayout gridLayout = new GridLayout(); - gridLayout.numColumns = 2; - setLayout(gridLayout); - - this.logActionPage = logActionPage; - - final Label messageToLogLabel = new Label(this, SWT.NONE); - messageToLogLabel.setLayoutData(new GridData(GridData.BEGINNING, GridData.CENTER, false, false, 2, 1)); - messageToLogLabel.setText(Messages.getString("LogActionComposite.0")); //$NON-NLS-1$ - - message = new Text(this, SWT.BORDER | SWT.WRAP); - message.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true, 2, 1)); - - expressionButton = new Button(this, SWT.CHECK); - expressionButton.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(final SelectionEvent e) { - } - }); - expressionButton.setText(Messages.getString("LogActionComposite.1")); //$NON-NLS-1$ - // - - message.setText(this.logActionPage.getLogAction().getMessage()); - expressionButton.setSelection(this.logActionPage.getLogAction().isEvaluateExpression()); - } - - @Override - protected void checkSubclass() { - // Disable the check that prevents subclassing of SWT components - } - - @Override - public void dispose() { - super.dispose(); - } - - public boolean getIsExpression() { - return expressionButton.getSelection(); - } - - public String getMessage() { - return message.getText(); - } - -} +package org.eclipse.cdt.debug.ui.breakpointactions; + +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.swt.widgets.Label; +import org.eclipse.swt.widgets.Text; + +public class LogActionComposite extends Composite { + + private Button expressionButton; + private LogActionPage logActionPage; + private Text message; + + public LogActionComposite(Composite parent, int style, LogActionPage logActionPage) { + super(parent, style); + final GridLayout gridLayout = new GridLayout(); + gridLayout.numColumns = 2; + setLayout(gridLayout); + + this.logActionPage = logActionPage; + + final Label messageToLogLabel = new Label(this, SWT.NONE); + messageToLogLabel.setLayoutData(new GridData(GridData.BEGINNING, GridData.CENTER, false, false, 2, 1)); + messageToLogLabel.setText(Messages.getString("LogActionComposite.0")); //$NON-NLS-1$ + + message = new Text(this, SWT.BORDER | SWT.WRAP); + message.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true, 2, 1)); + + expressionButton = new Button(this, SWT.CHECK); + expressionButton.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(final SelectionEvent e) { + } + }); + expressionButton.setText(Messages.getString("LogActionComposite.1")); //$NON-NLS-1$ + // + + message.setText(this.logActionPage.getLogAction().getMessage()); + expressionButton.setSelection(this.logActionPage.getLogAction().isEvaluateExpression()); + } + + @Override + protected void checkSubclass() { + // Disable the check that prevents subclassing of SWT components + } + + @Override + public void dispose() { + super.dispose(); + } + + public boolean getIsExpression() { + return expressionButton.getSelection(); + } + + public String getMessage() { + return message.getText(); + } + +} diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/breakpointactions/Messages.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/breakpointactions/Messages.java index 13dc00cafd6..24261cf6841 100644 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/breakpointactions/Messages.java +++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/breakpointactions/Messages.java @@ -1,32 +1,32 @@ -/******************************************************************************* - * Copyright (c) 2007 Nokia 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: - * Nokia - initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.ui.breakpointactions; - -import java.util.MissingResourceException; -import java.util.ResourceBundle; - -public class Messages { - private static final String BUNDLE_NAME = "org.eclipse.cdt.debug.ui.breakpointactions.messages"; //$NON-NLS-1$ - - private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME); - - private Messages() { - } - - public static String getString(String key) { - // TODO Auto-generated method stub - try { - return RESOURCE_BUNDLE.getString(key); - } catch (MissingResourceException e) { - return '!' + key + '!'; - } - } -} +/******************************************************************************* + * Copyright (c) 2007 Nokia 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: + * Nokia - initial API and implementation + *******************************************************************************/ +package org.eclipse.cdt.debug.ui.breakpointactions; + +import java.util.MissingResourceException; +import java.util.ResourceBundle; + +public class Messages { + private static final String BUNDLE_NAME = "org.eclipse.cdt.debug.ui.breakpointactions.messages"; //$NON-NLS-1$ + + private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME); + + private Messages() { + } + + public static String getString(String key) { + // TODO Auto-generated method stub + try { + return RESOURCE_BUNDLE.getString(key); + } catch (MissingResourceException e) { + return '!' + key + '!'; + } + } +} diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/breakpointactions/PreferenceConstants.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/breakpointactions/PreferenceConstants.java index 96a77c8e18f..e77ec1105dc 100644 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/breakpointactions/PreferenceConstants.java +++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/breakpointactions/PreferenceConstants.java @@ -1,26 +1,26 @@ -/******************************************************************************* - * Copyright (c) 2007 Nokia 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: - * Nokia - initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.debug.ui.breakpointactions; - -/** - * Constant definitions for plug-in preferences - */ -public class PreferenceConstants { - - public static final String P_PATH = "pathPreference"; //$NON-NLS-1$ - - public static final String P_BOOLEAN = "booleanPreference"; //$NON-NLS-1$ - - public static final String P_CHOICE = "choicePreference"; //$NON-NLS-1$ - - public static final String P_STRING = "stringPreference"; //$NON-NLS-1$ - -} +/******************************************************************************* + * Copyright (c) 2007 Nokia 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: + * Nokia - initial API and implementation + *******************************************************************************/ +package org.eclipse.cdt.debug.ui.breakpointactions; + +/** + * Constant definitions for plug-in preferences + */ +public class PreferenceConstants { + + public static final String P_PATH = "pathPreference"; //$NON-NLS-1$ + + public static final String P_BOOLEAN = "booleanPreference"; //$NON-NLS-1$ + + public static final String P_CHOICE = "choicePreference"; //$NON-NLS-1$ + + public static final String P_STRING = "stringPreference"; //$NON-NLS-1$ + +} diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/breakpointactions/PreferenceInitializer.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/breakpointactions/PreferenceInitializer.java index a87093be472..d6a717a5e3e 100644 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/breakpointactions/PreferenceInitializer.java +++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/breakpointactions/PreferenceInitializer.java @@ -1,35 +1,35 @@ -/******************************************************************************* - * Copyright (c) 2007, 2012 Nokia 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: - * Nokia - initial API and implementation +/******************************************************************************* + * Copyright (c) 2007, 2012 Nokia 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: + * Nokia - initial API and implementation *******************************************************************************/ -package org.eclipse.cdt.debug.ui.breakpointactions; - -import org.eclipse.cdt.debug.ui.CDebugUIPlugin; -import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer; -import org.eclipse.jface.preference.IPreferenceStore; - -/** - * Class used to initialize default preference values. - */ -public class PreferenceInitializer extends AbstractPreferenceInitializer { - - /* - * (non-Javadoc) - * - * @see org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer#initializeDefaultPreferences() - */ - @Override - public void initializeDefaultPreferences() { - IPreferenceStore store = CDebugUIPlugin.getDefault().getPreferenceStore(); - store.setDefault(PreferenceConstants.P_BOOLEAN, true); - store.setDefault(PreferenceConstants.P_CHOICE, "choice2"); //$NON-NLS-1$ - store.setDefault(PreferenceConstants.P_STRING, Messages.getString("PreferenceInitializer.1")); //$NON-NLS-1$ - } - -} +package org.eclipse.cdt.debug.ui.breakpointactions; + +import org.eclipse.cdt.debug.ui.CDebugUIPlugin; +import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer; +import org.eclipse.jface.preference.IPreferenceStore; + +/** + * Class used to initialize default preference values. + */ +public class PreferenceInitializer extends AbstractPreferenceInitializer { + + /* + * (non-Javadoc) + * + * @see org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer#initializeDefaultPreferences() + */ + @Override + public void initializeDefaultPreferences() { + IPreferenceStore store = CDebugUIPlugin.getDefault().getPreferenceStore(); + store.setDefault(PreferenceConstants.P_BOOLEAN, true); + store.setDefault(PreferenceConstants.P_CHOICE, "choice2"); //$NON-NLS-1$ + store.setDefault(PreferenceConstants.P_STRING, Messages.getString("PreferenceInitializer.1")); //$NON-NLS-1$ + } + +} diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/breakpointactions/SoundActionComposite.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/breakpointactions/SoundActionComposite.java index 5c44796655e..59685c2b9a5 100644 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/breakpointactions/SoundActionComposite.java +++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/breakpointactions/SoundActionComposite.java @@ -1,178 +1,178 @@ -/******************************************************************************* - * Copyright (c) 2007, 2012 Nokia 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: - * Nokia - initial API and implementation +/******************************************************************************* + * Copyright (c) 2007, 2012 Nokia 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: + * Nokia - initial API and implementation *******************************************************************************/ -package org.eclipse.cdt.debug.ui.breakpointactions; - -import java.io.File; -import java.util.ArrayList; -import java.util.Collections; -import java.util.Iterator; - -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.ModifyEvent; -import org.eclipse.swt.events.ModifyListener; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Combo; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.FileDialog; -import org.eclipse.swt.widgets.Label; - -public class SoundActionComposite extends Composite { - - private static final String[] soundFileExtensions = new String[] { "*.wav", "*.mid", "*.au", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - "*.aiff" }; //$NON-NLS-1$ - - private Combo combo_1; - private ModifyListener comboModifyListener = null; - private File selectedSoundFile = null; - private SoundActionPage soundActionPage; - private Label soundFilePathLabel; - private Button tryItButton; - - /** - * Create the composite - * - * @param parent - * @param style - * @param page - */ - public SoundActionComposite(Composite parent, int style, SoundActionPage page) { - super(parent, style); - soundActionPage = page; - final GridLayout gridLayout = new GridLayout(); - gridLayout.numColumns = 2; - setLayout(gridLayout); - - final Label playSoundLabel = new Label(this, SWT.NONE); - playSoundLabel.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 2, 1)); - playSoundLabel.setText(Messages.getString("SoundActionComposite.4")); //$NON-NLS-1$ - - combo_1 = new Combo(this, SWT.READ_ONLY); - final GridData gridData = new GridData(SWT.FILL, SWT.CENTER, true, false); - combo_1.setLayoutData(gridData); - - comboModifyListener = new ModifyListener() { - @Override - public void modifyText(ModifyEvent e) { - if (combo_1.getText().length() > 0) { - String filePath = combo_1.getText(); - File soundFile = new File(filePath); - if (soundFile.exists()) { - soundFilePathLabel.setText(filePath); - tryItButton.setEnabled(true); - selectedSoundFile = soundFile; - } else { - soundFilePathLabel.setText(Messages.getString("SoundActionComposite.9")); //$NON-NLS-1$ - tryItButton.setEnabled(false); - } - } - } - }; - rebuildRecentSoundsCombo(); - combo_1.addModifyListener(comboModifyListener); - - final String mediaPath = page.getMediaPath(); - - final Button browseButton = new Button(this, SWT.NONE); - browseButton.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - FileDialog dialog = new FileDialog(getShell(), SWT.NONE); - dialog.setText(Messages.getString("SoundActionComposite.5")); //$NON-NLS-1$ - dialog.setFilterExtensions(soundFileExtensions); - if (mediaPath.length() > 0) - dialog.setFilterPath(mediaPath); - - String res = dialog.open(); - if (res != null) { - setSoundFile(res); - } - } - }); - browseButton.setText(Messages.getString("SoundActionComposite.6")); //$NON-NLS-1$ - - tryItButton = new Button(this, SWT.NONE); - tryItButton.setLayoutData(new GridData()); - tryItButton.setText(Messages.getString("SoundActionComposite.7")); //$NON-NLS-1$ - tryItButton.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - File soundFile = new File(soundFilePathLabel.getText()); - playSoundFile(soundFile); - } - }); - - soundFilePathLabel = new Label(this, SWT.NONE); - final GridData gridData_1 = new GridData(GridData.FILL_HORIZONTAL); - gridData_1.horizontalSpan = 2; - soundFilePathLabel.setLayoutData(gridData_1); - soundFilePathLabel.setText(""); //$NON-NLS-1$ - - // - if (soundActionPage.getSoundAction().getSoundFile() != null) - setSoundFile(soundActionPage.getSoundAction().getSoundFile().getAbsolutePath()); - } - - private void addRecentSound(File soundFile) { - soundActionPage.addRecentSound(soundFile); - rebuildRecentSoundsCombo(); - } - - @Override - protected void checkSubclass() { - // Disable the check that prevents subclassing of SWT components - } - - @Override - public void dispose() { - super.dispose(); - } - - public File getSoundFile() { - return selectedSoundFile; - } - - protected void playSoundFile(File soundFile) { - SoundAction.playSoundFile(soundFile); - } - - private void rebuildRecentSoundsCombo() { - combo_1.removeAll(); - - ArrayList sortedSounds = new ArrayList(soundActionPage.getRecentSounds()); - Collections.sort(sortedSounds); - - for (Iterator iter = sortedSounds.iterator(); iter.hasNext();) { - File element = iter.next(); - combo_1.add(element.getAbsolutePath()); - } - } - - private void setSoundFile(String filePath) { - combo_1.removeModifyListener(comboModifyListener); - File soundFile = new File(filePath); - if (soundFile.exists()) { - addRecentSound(soundFile); - combo_1.setText(soundFile.getAbsolutePath()); - soundFilePathLabel.setText(filePath); - tryItButton.setEnabled(true); - selectedSoundFile = soundFile; - } else { - soundFilePathLabel.setText(Messages.getString("SoundActionComposite.9")); //$NON-NLS-1$ - tryItButton.setEnabled(false); - } - combo_1.addModifyListener(comboModifyListener); - } - -} +package org.eclipse.cdt.debug.ui.breakpointactions; + +import java.io.File; +import java.util.ArrayList; +import java.util.Collections; +import java.util.Iterator; + +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.ModifyEvent; +import org.eclipse.swt.events.ModifyListener; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Combo; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.FileDialog; +import org.eclipse.swt.widgets.Label; + +public class SoundActionComposite extends Composite { + + private static final String[] soundFileExtensions = new String[] { "*.wav", "*.mid", "*.au", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + "*.aiff" }; //$NON-NLS-1$ + + private Combo combo_1; + private ModifyListener comboModifyListener = null; + private File selectedSoundFile = null; + private SoundActionPage soundActionPage; + private Label soundFilePathLabel; + private Button tryItButton; + + /** + * Create the composite + * + * @param parent + * @param style + * @param page + */ + public SoundActionComposite(Composite parent, int style, SoundActionPage page) { + super(parent, style); + soundActionPage = page; + final GridLayout gridLayout = new GridLayout(); + gridLayout.numColumns = 2; + setLayout(gridLayout); + + final Label playSoundLabel = new Label(this, SWT.NONE); + playSoundLabel.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 2, 1)); + playSoundLabel.setText(Messages.getString("SoundActionComposite.4")); //$NON-NLS-1$ + + combo_1 = new Combo(this, SWT.READ_ONLY); + final GridData gridData = new GridData(SWT.FILL, SWT.CENTER, true, false); + combo_1.setLayoutData(gridData); + + comboModifyListener = new ModifyListener() { + @Override + public void modifyText(ModifyEvent e) { + if (combo_1.getText().length() > 0) { + String filePath = combo_1.getText(); + File soundFile = new File(filePath); + if (soundFile.exists()) { + soundFilePathLabel.setText(filePath); + tryItButton.setEnabled(true); + selectedSoundFile = soundFile; + } else { + soundFilePathLabel.setText(Messages.getString("SoundActionComposite.9")); //$NON-NLS-1$ + tryItButton.setEnabled(false); + } + } + } + }; + rebuildRecentSoundsCombo(); + combo_1.addModifyListener(comboModifyListener); + + final String mediaPath = page.getMediaPath(); + + final Button browseButton = new Button(this, SWT.NONE); + browseButton.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + FileDialog dialog = new FileDialog(getShell(), SWT.NONE); + dialog.setText(Messages.getString("SoundActionComposite.5")); //$NON-NLS-1$ + dialog.setFilterExtensions(soundFileExtensions); + if (mediaPath.length() > 0) + dialog.setFilterPath(mediaPath); + + String res = dialog.open(); + if (res != null) { + setSoundFile(res); + } + } + }); + browseButton.setText(Messages.getString("SoundActionComposite.6")); //$NON-NLS-1$ + + tryItButton = new Button(this, SWT.NONE); + tryItButton.setLayoutData(new GridData()); + tryItButton.setText(Messages.getString("SoundActionComposite.7")); //$NON-NLS-1$ + tryItButton.addSelectionListener(new SelectionAdapter() { + @Override + public void widgetSelected(SelectionEvent e) { + File soundFile = new File(soundFilePathLabel.getText()); + playSoundFile(soundFile); + } + }); + + soundFilePathLabel = new Label(this, SWT.NONE); + final GridData gridData_1 = new GridData(GridData.FILL_HORIZONTAL); + gridData_1.horizontalSpan = 2; + soundFilePathLabel.setLayoutData(gridData_1); + soundFilePathLabel.setText(""); //$NON-NLS-1$ + + // + if (soundActionPage.getSoundAction().getSoundFile() != null) + setSoundFile(soundActionPage.getSoundAction().getSoundFile().getAbsolutePath()); + } + + private void addRecentSound(File soundFile) { + soundActionPage.addRecentSound(soundFile); + rebuildRecentSoundsCombo(); + } + + @Override + protected void checkSubclass() { + // Disable the check that prevents subclassing of SWT components + } + + @Override + public void dispose() { + super.dispose(); + } + + public File getSoundFile() { + return selectedSoundFile; + } + + protected void playSoundFile(File soundFile) { + SoundAction.playSoundFile(soundFile); + } + + private void rebuildRecentSoundsCombo() { + combo_1.removeAll(); + + ArrayList sortedSounds = new ArrayList(soundActionPage.getRecentSounds()); + Collections.sort(sortedSounds); + + for (Iterator iter = sortedSounds.iterator(); iter.hasNext();) { + File element = iter.next(); + combo_1.add(element.getAbsolutePath()); + } + } + + private void setSoundFile(String filePath) { + combo_1.removeModifyListener(comboModifyListener); + File soundFile = new File(filePath); + if (soundFile.exists()) { + addRecentSound(soundFile); + combo_1.setText(soundFile.getAbsolutePath()); + soundFilePathLabel.setText(filePath); + tryItButton.setEnabled(true); + selectedSoundFile = soundFile; + } else { + soundFilePathLabel.setText(Messages.getString("SoundActionComposite.9")); //$NON-NLS-1$ + tryItButton.setEnabled(false); + } + combo_1.addModifyListener(comboModifyListener); + } + +} diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/disassembly/rulers/AbstractContributedRulerColumn.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/disassembly/rulers/AbstractContributedRulerColumn.java index a46aaf45a49..b32434c71ea 100644 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/disassembly/rulers/AbstractContributedRulerColumn.java +++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/disassembly/rulers/AbstractContributedRulerColumn.java @@ -1,66 +1,66 @@ -/******************************************************************************* - * Copyright (c) 2006, 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 Corporation - initial API and implementation - * Wind River Systems, Inc. - adapted for for disassembly parts - *******************************************************************************/ -package org.eclipse.cdt.debug.ui.disassembly.rulers; - -import org.eclipse.core.runtime.Assert; -import org.eclipse.core.runtime.IConfigurationElement; - -import org.eclipse.ui.IWorkbenchPart; - - -/** - * Helper class for contributions to the - * org.eclipse.cdt.debug.ui.disassemblyRulerColumns extension point. - *

    - * Subclasses must have a zero-argument constructor so that they can be created by - * {@link IConfigurationElement#createExecutableExtension(String)}.

    - * - * @since 7.2 - */ -public abstract class AbstractContributedRulerColumn implements IContributedRulerColumn { - /** The contribution descriptor. */ - private RulerColumnDescriptor fDescriptor; - /** The target disassembly part. */ - private IWorkbenchPart fDisassembly; - - @Override - public final RulerColumnDescriptor getDescriptor() { - return fDescriptor; - } - - @Override - public final void setDescriptor(RulerColumnDescriptor descriptor) { - Assert.isLegal(descriptor != null); - Assert.isTrue(fDescriptor == null); - fDescriptor= descriptor; - } - - @Override - public final void setDisassemblyPart(IWorkbenchPart disassembly) { - Assert.isLegal(disassembly != null); - Assert.isTrue(fDisassembly == null); - fDisassembly= disassembly; - } - - @Override - public final IWorkbenchPart getDisassemblyPart() { - return fDisassembly; - } - - @Override - public void columnCreated() { - } - - @Override - public void columnRemoved() { - } -} +/******************************************************************************* + * Copyright (c) 2006, 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 Corporation - initial API and implementation + * Wind River Systems, Inc. - adapted for for disassembly parts + *******************************************************************************/ +package org.eclipse.cdt.debug.ui.disassembly.rulers; + +import org.eclipse.core.runtime.Assert; +import org.eclipse.core.runtime.IConfigurationElement; + +import org.eclipse.ui.IWorkbenchPart; + + +/** + * Helper class for contributions to the + * org.eclipse.cdt.debug.ui.disassemblyRulerColumns extension point. + *

    + * Subclasses must have a zero-argument constructor so that they can be created by + * {@link IConfigurationElement#createExecutableExtension(String)}.

    + * + * @since 7.2 + */ +public abstract class AbstractContributedRulerColumn implements IContributedRulerColumn { + /** The contribution descriptor. */ + private RulerColumnDescriptor fDescriptor; + /** The target disassembly part. */ + private IWorkbenchPart fDisassembly; + + @Override + public final RulerColumnDescriptor getDescriptor() { + return fDescriptor; + } + + @Override + public final void setDescriptor(RulerColumnDescriptor descriptor) { + Assert.isLegal(descriptor != null); + Assert.isTrue(fDescriptor == null); + fDescriptor= descriptor; + } + + @Override + public final void setDisassemblyPart(IWorkbenchPart disassembly) { + Assert.isLegal(disassembly != null); + Assert.isTrue(fDisassembly == null); + fDisassembly= disassembly; + } + + @Override + public final IWorkbenchPart getDisassemblyPart() { + return fDisassembly; + } + + @Override + public void columnCreated() { + } + + @Override + public void columnRemoved() { + } +} diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/disassembly/rulers/IColumnSupport.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/disassembly/rulers/IColumnSupport.java index ea21e15a4b7..1a6f316f961 100644 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/disassembly/rulers/IColumnSupport.java +++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/disassembly/rulers/IColumnSupport.java @@ -1,62 +1,62 @@ -/******************************************************************************* - * Copyright (c) 2007, 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 Corporation - initial API and implementation - * Wind River Systems, Inc. - adapted for for disassembly parts - *******************************************************************************/ -package org.eclipse.cdt.debug.ui.disassembly.rulers; - - -/** - * Provides support to modify and query the visibility of - * ruler columns and test whether a ruler column is supported. - *

    - * This interface must not be implemented by clients. - *

    - * - * @since 7.2 - * @noimplement This interface is not intended to be implemented by clients. - * @noextend This interface is not intended to be extended by clients. - */ -public interface IColumnSupport { - - /** - * Returns true if the column described by descriptor is - * currently showing, false if not. - * - * @param descriptor the column descriptor - * @return true if the specified column is currently visible - */ - boolean isColumnVisible(RulerColumnDescriptor descriptor); - - /** - * Attempts to set the visibility of the column described by descriptor. Nothing - * happens if the visibility is already as requested, or if the column is not supported by the - * editor. - * - * @param descriptor the column descriptor - * @param visible true to show the column, false to hide it - */ - void setColumnVisible(RulerColumnDescriptor descriptor, boolean visible); - - /** - * Returns true if the column described by descriptor is - * supported by the receiver's editor, false if id is not the - * identifier of a known column contribution, if the column does not target the editor, or if - * the editor does not support contributed columns. - * - * @param descriptor the column descriptor - * @return true if the specified column is supported - */ - boolean isColumnSupported(RulerColumnDescriptor descriptor); - - /** - * Removes and disposes all currently visible ruler columns. - */ - void dispose(); +/******************************************************************************* + * Copyright (c) 2007, 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 Corporation - initial API and implementation + * Wind River Systems, Inc. - adapted for for disassembly parts + *******************************************************************************/ +package org.eclipse.cdt.debug.ui.disassembly.rulers; + + +/** + * Provides support to modify and query the visibility of + * ruler columns and test whether a ruler column is supported. + *

    + * This interface must not be implemented by clients. + *

    + * + * @since 7.2 + * @noimplement This interface is not intended to be implemented by clients. + * @noextend This interface is not intended to be extended by clients. + */ +public interface IColumnSupport { + + /** + * Returns true if the column described by descriptor is + * currently showing, false if not. + * + * @param descriptor the column descriptor + * @return true if the specified column is currently visible + */ + boolean isColumnVisible(RulerColumnDescriptor descriptor); + + /** + * Attempts to set the visibility of the column described by descriptor. Nothing + * happens if the visibility is already as requested, or if the column is not supported by the + * editor. + * + * @param descriptor the column descriptor + * @param visible true to show the column, false to hide it + */ + void setColumnVisible(RulerColumnDescriptor descriptor, boolean visible); + + /** + * Returns true if the column described by descriptor is + * supported by the receiver's editor, false if id is not the + * identifier of a known column contribution, if the column does not target the editor, or if + * the editor does not support contributed columns. + * + * @param descriptor the column descriptor + * @return true if the specified column is supported + */ + boolean isColumnSupported(RulerColumnDescriptor descriptor); + + /** + * Removes and disposes all currently visible ruler columns. + */ + void dispose(); } \ No newline at end of file diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/disassembly/rulers/IContributedRulerColumn.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/disassembly/rulers/IContributedRulerColumn.java index 4c2e7c616ba..20d4fbca9af 100644 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/disassembly/rulers/IContributedRulerColumn.java +++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/disassembly/rulers/IContributedRulerColumn.java @@ -1,99 +1,99 @@ -/******************************************************************************* - * Copyright (c) 2006, 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 Corporation - initial API and implementation - * Wind River Systems, Inc. - adapted for for disassembly parts - *******************************************************************************/ -package org.eclipse.cdt.debug.ui.disassembly.rulers; - - -import org.eclipse.core.runtime.IConfigurationElement; -import org.eclipse.jface.text.source.IVerticalRulerColumn; -import org.eclipse.ui.IWorkbenchPart; - - -/** - * Interface that has to be implemented by contributions to the - * org.eclipse.cdt.debug.ui.disassembly.rulerColumns extension point. - *

    - * Implementors must have a zero-argument constructor so that they can be created - * by {@link IConfigurationElement#createExecutableExtension(String)}.

    - * - * @since 7.2 - */ -public interface IContributedRulerColumn extends IVerticalRulerColumn { - - /** - * Returns the extension point descriptor of this ruler. - * - * @return descriptor the extension point descriptor of this ruler or null if called before {@link #columnCreated()} - */ - RulerColumnDescriptor getDescriptor(); - - /** - * Sets the extension point descriptor of this ruler. - *

    - * This method will be called by the framework and must not - * be called by clients.

    - * - * @param descriptor the extension point descriptor - */ - void setDescriptor(RulerColumnDescriptor descriptor); - - /** - * Sets the disassembly part (called right after the extension was instantiated). - *

    - * This method will be called by the framework and must not - * be called by clients.

    - * - * @param disassembly the disassembly part targeted by this ruler instance - */ - void setDisassemblyPart(IWorkbenchPart disassembly); - - /** - * Returns the disassembly part targeted by this ruler instance. - * - * @return the disassembly part targeted by this ruler instance or null if called before {@link #columnCreated()} - */ - IWorkbenchPart getDisassemblyPart(); - - /** - * Hook method called after a column has been instantiated, but before it is - * added to a {@link org.eclipse.jface.text.source.CompositeRuler} and before - * {@linkplain org.eclipse.jface.text.source.IVerticalRulerColumn#createControl(org.eclipse.jface.text.source.CompositeRuler, org.eclipse.swt.widgets.Composite) createControl} - * is called. - *

    - * This happens when - *

      - *
    • the column is set visible by the user or programmatically
    • - *
    • the disassembly part is created, if this ruler targets the disassembly part and is enabled by default
    • - *
    • the disassembly part input changes and the column now targets the new disassembly part contents.
    • - *

    - */ - void columnCreated(); - - /** - * Hook method called after a column has been removed from the {@link org.eclipse.jface.text.source.CompositeRuler}. - *

    - * This happens when - *

      - *
    • the column is hidden by the user or programmatically
    • - *
    • the disassembly part is closed
    • - *
    • the disassembly part input changes and the column no longer targets the disassembly part - * contents.
    • - *
    - *

    - *

    - * The column will not be used after this method has been called. A new - * column will be instantiated if the same column type should be shown for - * the same disassembly part. - *

    - */ - void columnRemoved(); - -} +/******************************************************************************* + * Copyright (c) 2006, 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 Corporation - initial API and implementation + * Wind River Systems, Inc. - adapted for for disassembly parts + *******************************************************************************/ +package org.eclipse.cdt.debug.ui.disassembly.rulers; + + +import org.eclipse.core.runtime.IConfigurationElement; +import org.eclipse.jface.text.source.IVerticalRulerColumn; +import org.eclipse.ui.IWorkbenchPart; + + +/** + * Interface that has to be implemented by contributions to the + * org.eclipse.cdt.debug.ui.disassembly.rulerColumns extension point. + *

    + * Implementors must have a zero-argument constructor so that they can be created + * by {@link IConfigurationElement#createExecutableExtension(String)}.

    + * + * @since 7.2 + */ +public interface IContributedRulerColumn extends IVerticalRulerColumn { + + /** + * Returns the extension point descriptor of this ruler. + * + * @return descriptor the extension point descriptor of this ruler or null if called before {@link #columnCreated()} + */ + RulerColumnDescriptor getDescriptor(); + + /** + * Sets the extension point descriptor of this ruler. + *

    + * This method will be called by the framework and must not + * be called by clients.

    + * + * @param descriptor the extension point descriptor + */ + void setDescriptor(RulerColumnDescriptor descriptor); + + /** + * Sets the disassembly part (called right after the extension was instantiated). + *

    + * This method will be called by the framework and must not + * be called by clients.

    + * + * @param disassembly the disassembly part targeted by this ruler instance + */ + void setDisassemblyPart(IWorkbenchPart disassembly); + + /** + * Returns the disassembly part targeted by this ruler instance. + * + * @return the disassembly part targeted by this ruler instance or null if called before {@link #columnCreated()} + */ + IWorkbenchPart getDisassemblyPart(); + + /** + * Hook method called after a column has been instantiated, but before it is + * added to a {@link org.eclipse.jface.text.source.CompositeRuler} and before + * {@linkplain org.eclipse.jface.text.source.IVerticalRulerColumn#createControl(org.eclipse.jface.text.source.CompositeRuler, org.eclipse.swt.widgets.Composite) createControl} + * is called. + *

    + * This happens when + *

      + *
    • the column is set visible by the user or programmatically
    • + *
    • the disassembly part is created, if this ruler targets the disassembly part and is enabled by default
    • + *
    • the disassembly part input changes and the column now targets the new disassembly part contents.
    • + *

    + */ + void columnCreated(); + + /** + * Hook method called after a column has been removed from the {@link org.eclipse.jface.text.source.CompositeRuler}. + *

    + * This happens when + *

      + *
    • the column is hidden by the user or programmatically
    • + *
    • the disassembly part is closed
    • + *
    • the disassembly part input changes and the column no longer targets the disassembly part + * contents.
    • + *
    + *

    + *

    + * The column will not be used after this method has been called. A new + * column will be instantiated if the same column type should be shown for + * the same disassembly part. + *

    + */ + void columnRemoved(); + +} diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/disassembly/rulers/RulerColumnDescriptor.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/disassembly/rulers/RulerColumnDescriptor.java index 1154a9e94d4..6a89a44d8d0 100644 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/disassembly/rulers/RulerColumnDescriptor.java +++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/disassembly/rulers/RulerColumnDescriptor.java @@ -1,307 +1,307 @@ -/******************************************************************************* - * Copyright (c) 2005, 2015 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 Corporation - initial API and implementation - * Wind River Systems, Inc. - adapted for for disassembly parts +/******************************************************************************* + * Copyright (c) 2005, 2015 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 Corporation - initial API and implementation + * Wind River Systems, Inc. - adapted for for disassembly parts *******************************************************************************/ -package org.eclipse.cdt.debug.ui.disassembly.rulers; - -import java.net.URL; - -import org.eclipse.core.runtime.Assert; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IConfigurationElement; -import org.eclipse.core.runtime.InvalidRegistryObjectException; -import org.eclipse.core.runtime.content.IContentType; -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.ui.IWorkbenchPart; -import org.eclipse.ui.IWorkbenchPartSite; -import org.eclipse.ui.internal.texteditor.rulers.ExtensionPointHelper; -import org.eclipse.ui.internal.texteditor.rulers.RulerColumnMessages; -import org.eclipse.ui.internal.texteditor.rulers.RulerColumnPlacement; -import org.eclipse.ui.internal.texteditor.rulers.RulerColumnTarget; - - -/** - * The description of an extension to the - * org.eclipse.ui.workbench.texteditor.rulerColumns extension point. Instances are - * immutable. Instances can be obtained from a {@link RulerColumnRegistry}. - * - * @since 7.2 - * @noinstantiate This class is not intended to be instantiated by clients. - */ -public final class RulerColumnDescriptor { - /** The extension schema name of the class attribute. */ - private static final String CLASS= "class"; //$NON-NLS-1$ - /** The extension schema name of the id attribute. */ - private static final String ID= "id"; //$NON-NLS-1$ - /** The extension schema name of the optional name attribute. */ - private static final String NAME= "name"; //$NON-NLS-1$ - /** The extension schema name of the optional enabled attribute. */ - private static final String ENABLED= "enabled"; //$NON-NLS-1$ - /** The extension schema name of the optional icon attribute. */ - private static final String ICON= "icon"; //$NON-NLS-1$ - /** The extension schema name of the optional global attribute. */ - private static final String GLOBAL= "global"; //$NON-NLS-1$ - /** The extension schema name of the optional menu inclusion attribute. */ - private static final String INCLUDE_IN_MENU= "includeInMenu"; //$NON-NLS-1$ - /** The extension schema name of the targetEditor element. */ - private static final String TARGET_ID= "targetId"; //$NON-NLS-1$ - /** The extension schema name of the targetClass element. */ - private static final String TARGET_CLASS= "targetClass"; //$NON-NLS-1$ - /** The extension schema name of the placement element. */ - private static final String PLACEMENT= "placement"; //$NON-NLS-1$ - - /** The identifier of the extension. */ - private final String fId; - /** The name of the extension, equal to the id if no name is given. */ - private final String fName; - /** The icon descriptor. */ - private final ImageDescriptor fIcon; - /** The configuration element of this extension. */ - private final IConfigurationElement fElement; - /** The target specification of the ruler column contribution. */ - private final RulerColumnTarget fTarget; - /** The placement specification of the ruler column contribution. */ - private final RulerColumnPlacement fRulerColumnPlacement; - /** The default enablement setting of the ruler column contribution. */ - private final boolean fDefaultEnablement; - /** The global setting of the ruler column contribution. */ - private final boolean fIsGlobal; - /** The menu inclusion setting of the ruler column contribution. */ - private final boolean fIncludeInMenu; - - /** - * Creates a new descriptor. - * - * @param element the configuration element to read - * @param registry the computer registry creating this descriptor - * @throws InvalidRegistryObjectException if the configuration element is no longer valid - * @throws CoreException if the configuration element does not conform to the extension point spec - */ - RulerColumnDescriptor(IConfigurationElement element, RulerColumnRegistry registry) throws InvalidRegistryObjectException, CoreException { - Assert.isLegal(registry != null); - Assert.isLegal(element != null); - fElement= element; - - ExtensionPointHelper helper= new ExtensionPointHelper(element); - - fId= helper.getNonNullAttribute(ID); - fName= helper.getDefaultAttribute(NAME, fId); - helper.getNonNullAttribute(CLASS); // just check validity - URL iconURL= helper.getDefaultResourceURL(ICON, null); - fIcon= iconURL == null ? null : ImageDescriptor.createFromURL(iconURL); - fDefaultEnablement= helper.getDefaultAttribute(ENABLED, true); - fIsGlobal= helper.getDefaultAttribute(GLOBAL, true); - fIncludeInMenu= helper.getDefaultAttribute(INCLUDE_IN_MENU, true); - - IConfigurationElement[] targetEditors= element.getChildren(TARGET_ID); - IConfigurationElement[] targetClasses= element.getChildren(TARGET_CLASS); - - RulerColumnTarget combined= null; - for (int i= 0; i < targetEditors.length; i++) { - IConfigurationElement targetEditor= targetEditors[i]; - RulerColumnTarget target= RulerColumnTarget.createEditorIdTarget(new ExtensionPointHelper(targetEditor).getNonNullAttribute(ID)); - combined= RulerColumnTarget.createOrTarget(combined, target); - } - for (int i= 0; i < targetClasses.length; i++) { - IConfigurationElement targetClass= targetClasses[i]; - RulerColumnTarget target= RulerColumnTarget.createClassTarget(new ExtensionPointHelper(targetClass).getNonNullAttribute(CLASS)); - combined= RulerColumnTarget.createOrTarget(combined, target); - } - fTarget= combined; - - IConfigurationElement[] placements= element.getChildren(PLACEMENT); - switch (placements.length) { - case 0: - fRulerColumnPlacement= new RulerColumnPlacement(); - break; - case 1: - fRulerColumnPlacement= new RulerColumnPlacement(placements[0]); - break; - default: - helper.fail(RulerColumnMessages.RulerColumnDescriptor_invalid_placement_msg); - fRulerColumnPlacement= null; // dummy - break; - } - - Assert.isTrue(fTarget != null); - Assert.isTrue(fRulerColumnPlacement != null); - } - - /** - * Returns the identifier of the described extension. - * - * @return the identifier of the described extension - */ - public String getId() { - return fId; - } - - /** - * Returns the name of the described extension. - * - * @return the name of the described extension - */ - public String getName() { - return fName; - } - - /** - * Returns the image descriptor of the described extension, null if it does not - * have an image. - * - * @return the image descriptor of the described extension or null for no image - */ - public ImageDescriptor getIcon() { - return fIcon; - } - - RulerColumnTarget getTarget() { - return fTarget; - } - - RulerColumnPlacement getPlacement() { - return fRulerColumnPlacement; - } - - /** - * Returns the default enablement of the described extension. Editors that support this - * contribution should typically enable the column by default. - * - * @return the default enablement of the described extension - */ - public boolean getDefaultEnablement() { - return fDefaultEnablement; - } - - /** - * Returns the global property of the described extension. Changing the visibility of a column - * with the global property set to true should typically affect all matching - * editors. Changing the visibility of a column with the global property set to - * false should only affect the current disassembly part. - * - * @return the global property of the described extension - */ - public boolean isGlobal() { - return fIsGlobal; - } - - /** - * Returns the menu inclusion property of the described extension. A toggle menu entry should be - * inluded in the ruler context menu for columns with this property set to true. - * - * @return the menu inclusion property of the described extension - */ - public boolean isIncludedInMenu() { - return fIncludeInMenu; - } - - /** - * Returns true if this contribution matches the passed disassembly part , false if not. - * - * @param disassembly the disassembly part to check - * @return true if this contribution targets the passed disassembly part - */ - public boolean matchesPart(IWorkbenchPart disassembly) { - Assert.isLegal(disassembly != null); - RulerColumnTarget target= getTarget(); - - IWorkbenchPartSite site= disassembly.getSite(); - if (site != null && target.matchesEditorId(site.getId())) - return true; - - if (target.matchesClass(disassembly.getClass())) - return true; - - IContentType contentType= getContentType(disassembly); - return contentType != null && target.matchesContentType(contentType); - - } - - /** - * Creates a {@link IContributedRulerColumn} instance as described by the receiver. This may load the contributing plug-in. - * - * @param disassembly the disassembly part that loads the contributed column - * @return the instantiated column - * @throws CoreException as thrown by {@link IConfigurationElement#createExecutableExtension(String)} - * @throws InvalidRegistryObjectException as thrown by {@link IConfigurationElement#createExecutableExtension(String)} - */ - public IContributedRulerColumn createColumn(IWorkbenchPart disassembly) throws CoreException, InvalidRegistryObjectException { - Assert.isLegal(disassembly != null); - IContributedRulerColumn column= (IContributedRulerColumn)fElement.createExecutableExtension(CLASS); - column.setDescriptor(this); - column.setDisassemblyPart(disassembly); - column.columnCreated(); - return column; - } - - /* - * @see java.lang.Object#toString() - * @since 3.3 - */ - @Override - public String toString() { - return "RulerColumnDescriptor[name=" + getName() + "]"; //$NON-NLS-1$ //$NON-NLS-2$ - } - - IConfigurationElement getConfigurationElement() { - return fElement; - } - - /* - * @see java.lang.Object#hashCode() - */ - @Override - public int hashCode() { - final int prime= 31; - int result= 1; - result= prime * result + ((fId == null) ? 0 : fId.hashCode()); - return result; - } - - /* - * @see java.lang.Object#equals(java.lang.Object) - */ - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; - final RulerColumnDescriptor other= (RulerColumnDescriptor) obj; - if (fId == null) { - if (other.fId != null) - return false; - } else if (!fId.equals(other.fId)) - return false; - return true; - } - - /** - * Returns the content type of the disassembly part's input, null if the disassembly part input or - * the document provider is null or the content type cannot be determined. - * - * @param disassembly part the disassembly part to get the content type from - * @return the content type of the disassembly part's input, null if it cannot be - * determined - */ - private IContentType getContentType(IWorkbenchPart disassembly) { - return null; - } - - String getContributor() { - try { - return fElement.getContributor().getName(); - } catch (InvalidRegistryObjectException e) { - return "unknown"; //$NON-NLS-1$ - } - } -} +package org.eclipse.cdt.debug.ui.disassembly.rulers; + +import java.net.URL; + +import org.eclipse.core.runtime.Assert; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IConfigurationElement; +import org.eclipse.core.runtime.InvalidRegistryObjectException; +import org.eclipse.core.runtime.content.IContentType; +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.ui.IWorkbenchPart; +import org.eclipse.ui.IWorkbenchPartSite; +import org.eclipse.ui.internal.texteditor.rulers.ExtensionPointHelper; +import org.eclipse.ui.internal.texteditor.rulers.RulerColumnMessages; +import org.eclipse.ui.internal.texteditor.rulers.RulerColumnPlacement; +import org.eclipse.ui.internal.texteditor.rulers.RulerColumnTarget; + + +/** + * The description of an extension to the + * org.eclipse.ui.workbench.texteditor.rulerColumns extension point. Instances are + * immutable. Instances can be obtained from a {@link RulerColumnRegistry}. + * + * @since 7.2 + * @noinstantiate This class is not intended to be instantiated by clients. + */ +public final class RulerColumnDescriptor { + /** The extension schema name of the class attribute. */ + private static final String CLASS= "class"; //$NON-NLS-1$ + /** The extension schema name of the id attribute. */ + private static final String ID= "id"; //$NON-NLS-1$ + /** The extension schema name of the optional name attribute. */ + private static final String NAME= "name"; //$NON-NLS-1$ + /** The extension schema name of the optional enabled attribute. */ + private static final String ENABLED= "enabled"; //$NON-NLS-1$ + /** The extension schema name of the optional icon attribute. */ + private static final String ICON= "icon"; //$NON-NLS-1$ + /** The extension schema name of the optional global attribute. */ + private static final String GLOBAL= "global"; //$NON-NLS-1$ + /** The extension schema name of the optional menu inclusion attribute. */ + private static final String INCLUDE_IN_MENU= "includeInMenu"; //$NON-NLS-1$ + /** The extension schema name of the targetEditor element. */ + private static final String TARGET_ID= "targetId"; //$NON-NLS-1$ + /** The extension schema name of the targetClass element. */ + private static final String TARGET_CLASS= "targetClass"; //$NON-NLS-1$ + /** The extension schema name of the placement element. */ + private static final String PLACEMENT= "placement"; //$NON-NLS-1$ + + /** The identifier of the extension. */ + private final String fId; + /** The name of the extension, equal to the id if no name is given. */ + private final String fName; + /** The icon descriptor. */ + private final ImageDescriptor fIcon; + /** The configuration element of this extension. */ + private final IConfigurationElement fElement; + /** The target specification of the ruler column contribution. */ + private final RulerColumnTarget fTarget; + /** The placement specification of the ruler column contribution. */ + private final RulerColumnPlacement fRulerColumnPlacement; + /** The default enablement setting of the ruler column contribution. */ + private final boolean fDefaultEnablement; + /** The global setting of the ruler column contribution. */ + private final boolean fIsGlobal; + /** The menu inclusion setting of the ruler column contribution. */ + private final boolean fIncludeInMenu; + + /** + * Creates a new descriptor. + * + * @param element the configuration element to read + * @param registry the computer registry creating this descriptor + * @throws InvalidRegistryObjectException if the configuration element is no longer valid + * @throws CoreException if the configuration element does not conform to the extension point spec + */ + RulerColumnDescriptor(IConfigurationElement element, RulerColumnRegistry registry) throws InvalidRegistryObjectException, CoreException { + Assert.isLegal(registry != null); + Assert.isLegal(element != null); + fElement= element; + + ExtensionPointHelper helper= new ExtensionPointHelper(element); + + fId= helper.getNonNullAttribute(ID); + fName= helper.getDefaultAttribute(NAME, fId); + helper.getNonNullAttribute(CLASS); // just check validity + URL iconURL= helper.getDefaultResourceURL(ICON, null); + fIcon= iconURL == null ? null : ImageDescriptor.createFromURL(iconURL); + fDefaultEnablement= helper.getDefaultAttribute(ENABLED, true); + fIsGlobal= helper.getDefaultAttribute(GLOBAL, true); + fIncludeInMenu= helper.getDefaultAttribute(INCLUDE_IN_MENU, true); + + IConfigurationElement[] targetEditors= element.getChildren(TARGET_ID); + IConfigurationElement[] targetClasses= element.getChildren(TARGET_CLASS); + + RulerColumnTarget combined= null; + for (int i= 0; i < targetEditors.length; i++) { + IConfigurationElement targetEditor= targetEditors[i]; + RulerColumnTarget target= RulerColumnTarget.createEditorIdTarget(new ExtensionPointHelper(targetEditor).getNonNullAttribute(ID)); + combined= RulerColumnTarget.createOrTarget(combined, target); + } + for (int i= 0; i < targetClasses.length; i++) { + IConfigurationElement targetClass= targetClasses[i]; + RulerColumnTarget target= RulerColumnTarget.createClassTarget(new ExtensionPointHelper(targetClass).getNonNullAttribute(CLASS)); + combined= RulerColumnTarget.createOrTarget(combined, target); + } + fTarget= combined; + + IConfigurationElement[] placements= element.getChildren(PLACEMENT); + switch (placements.length) { + case 0: + fRulerColumnPlacement= new RulerColumnPlacement(); + break; + case 1: + fRulerColumnPlacement= new RulerColumnPlacement(placements[0]); + break; + default: + helper.fail(RulerColumnMessages.RulerColumnDescriptor_invalid_placement_msg); + fRulerColumnPlacement= null; // dummy + break; + } + + Assert.isTrue(fTarget != null); + Assert.isTrue(fRulerColumnPlacement != null); + } + + /** + * Returns the identifier of the described extension. + * + * @return the identifier of the described extension + */ + public String getId() { + return fId; + } + + /** + * Returns the name of the described extension. + * + * @return the name of the described extension + */ + public String getName() { + return fName; + } + + /** + * Returns the image descriptor of the described extension, null if it does not + * have an image. + * + * @return the image descriptor of the described extension or null for no image + */ + public ImageDescriptor getIcon() { + return fIcon; + } + + RulerColumnTarget getTarget() { + return fTarget; + } + + RulerColumnPlacement getPlacement() { + return fRulerColumnPlacement; + } + + /** + * Returns the default enablement of the described extension. Editors that support this + * contribution should typically enable the column by default. + * + * @return the default enablement of the described extension + */ + public boolean getDefaultEnablement() { + return fDefaultEnablement; + } + + /** + * Returns the global property of the described extension. Changing the visibility of a column + * with the global property set to true should typically affect all matching + * editors. Changing the visibility of a column with the global property set to + * false should only affect the current disassembly part. + * + * @return the global property of the described extension + */ + public boolean isGlobal() { + return fIsGlobal; + } + + /** + * Returns the menu inclusion property of the described extension. A toggle menu entry should be + * inluded in the ruler context menu for columns with this property set to true. + * + * @return the menu inclusion property of the described extension + */ + public boolean isIncludedInMenu() { + return fIncludeInMenu; + } + + /** + * Returns true if this contribution matches the passed disassembly part , false if not. + * + * @param disassembly the disassembly part to check + * @return true if this contribution targets the passed disassembly part + */ + public boolean matchesPart(IWorkbenchPart disassembly) { + Assert.isLegal(disassembly != null); + RulerColumnTarget target= getTarget(); + + IWorkbenchPartSite site= disassembly.getSite(); + if (site != null && target.matchesEditorId(site.getId())) + return true; + + if (target.matchesClass(disassembly.getClass())) + return true; + + IContentType contentType= getContentType(disassembly); + return contentType != null && target.matchesContentType(contentType); + + } + + /** + * Creates a {@link IContributedRulerColumn} instance as described by the receiver. This may load the contributing plug-in. + * + * @param disassembly the disassembly part that loads the contributed column + * @return the instantiated column + * @throws CoreException as thrown by {@link IConfigurationElement#createExecutableExtension(String)} + * @throws InvalidRegistryObjectException as thrown by {@link IConfigurationElement#createExecutableExtension(String)} + */ + public IContributedRulerColumn createColumn(IWorkbenchPart disassembly) throws CoreException, InvalidRegistryObjectException { + Assert.isLegal(disassembly != null); + IContributedRulerColumn column= (IContributedRulerColumn)fElement.createExecutableExtension(CLASS); + column.setDescriptor(this); + column.setDisassemblyPart(disassembly); + column.columnCreated(); + return column; + } + + /* + * @see java.lang.Object#toString() + * @since 3.3 + */ + @Override + public String toString() { + return "RulerColumnDescriptor[name=" + getName() + "]"; //$NON-NLS-1$ //$NON-NLS-2$ + } + + IConfigurationElement getConfigurationElement() { + return fElement; + } + + /* + * @see java.lang.Object#hashCode() + */ + @Override + public int hashCode() { + final int prime= 31; + int result= 1; + result= prime * result + ((fId == null) ? 0 : fId.hashCode()); + return result; + } + + /* + * @see java.lang.Object#equals(java.lang.Object) + */ + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + final RulerColumnDescriptor other= (RulerColumnDescriptor) obj; + if (fId == null) { + if (other.fId != null) + return false; + } else if (!fId.equals(other.fId)) + return false; + return true; + } + + /** + * Returns the content type of the disassembly part's input, null if the disassembly part input or + * the document provider is null or the content type cannot be determined. + * + * @param disassembly part the disassembly part to get the content type from + * @return the content type of the disassembly part's input, null if it cannot be + * determined + */ + private IContentType getContentType(IWorkbenchPart disassembly) { + return null; + } + + String getContributor() { + try { + return fElement.getContributor().getName(); + } catch (InvalidRegistryObjectException e) { + return "unknown"; //$NON-NLS-1$ + } + } +} diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/disassembly/rulers/RulerColumnRegistry.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/disassembly/rulers/RulerColumnRegistry.java index 024d07e97b0..1fb7f1229f3 100644 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/disassembly/rulers/RulerColumnRegistry.java +++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/disassembly/rulers/RulerColumnRegistry.java @@ -1,294 +1,294 @@ -/******************************************************************************* - * Copyright (c) 2000, 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 Corporation - initial API and implementation - * Wind River Systems, Inc. - adapted for for disassembly parts - *******************************************************************************/ -package org.eclipse.cdt.debug.ui.disassembly.rulers; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.Comparator; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.ListIterator; -import java.util.Map; -import java.util.Set; - -import org.eclipse.cdt.debug.ui.CDebugUIPlugin; -import org.eclipse.core.runtime.Assert; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IConfigurationElement; -import org.eclipse.core.runtime.IExtensionRegistry; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.InvalidRegistryObjectException; -import org.eclipse.core.runtime.Platform; -import org.eclipse.core.runtime.Status; -import org.eclipse.ui.internal.texteditor.TextEditorPlugin; -import org.eclipse.ui.internal.texteditor.rulers.DAG; -import org.eclipse.ui.internal.texteditor.rulers.ExtensionPointHelper; -import org.eclipse.ui.internal.texteditor.rulers.RulerColumnMessages; -import org.eclipse.ui.internal.texteditor.rulers.RulerColumnPlacementConstraint; -import org.eclipse.ui.texteditor.ConfigurationElementSorter; - -import com.ibm.icu.text.MessageFormat; - - -/** - * A registry for all extensions to the - * rulerColumns extension point. - * - * @since 7.2 - * @noinstantiate This class is not intended to be instantiated by clients. - */ -public final class RulerColumnRegistry { - - private static final String EXTENSION_POINT= "disassemblyRulerColumns"; //$NON-NLS-1$ - private static final String QUALIFIED_EXTENSION_POINT= CDebugUIPlugin.PLUGIN_ID + '.' + EXTENSION_POINT; - - /** The singleton instance. */ - private static RulerColumnRegistry fgSingleton= null; - - /** - * Returns the default computer registry. - * - * @return the singleton instance - */ - public static synchronized RulerColumnRegistry getDefault() { - if (fgSingleton == null) { - fgSingleton= new RulerColumnRegistry(); - } - - return fgSingleton; - } - - /** - * All descriptors (element type: - * {@link RulerColumnDescriptor}). - */ - private List fDescriptors= null; - /** - * All descriptors by id (element type: {@link RulerColumnDescriptor}). - */ - private Map fDescriptorMap= null; - - /** - * true if this registry has been loaded. - */ - private boolean fLoaded= false; - - /** - * Creates a new instance. - */ - RulerColumnRegistry() { - } - - /** - * Returns the list of {@link RulerColumnDescriptor}s describing all extensions to the - * rulerColumns extension point. The list's iterator traverses the descriptors in - * the ordering implied by the placement specifications of the contributions. - *

    - * The returned list is unmodifiable and guaranteed to never change. Note that the set of - * descriptors may change over time due to dynamic plug-in removal or addition. - *

    - * - * @return the sorted list of extensions to the rulerColumns extension point - * (element type: {@link RulerColumnDescriptor}) - */ - public List getColumnDescriptors() { - ensureExtensionPointRead(); - return fDescriptors; - } - - /** - * Returns the {@link RulerColumnDescriptor} with the given identity, null if no - * such descriptor exists. - * - * @param id the identity of the ruler contribution as given in the extension point xml. - * @return the {@link RulerColumnDescriptor} with the given identity, null if no - * such descriptor exists - */ - public RulerColumnDescriptor getColumnDescriptor(String id) { - Assert.isLegal(id != null); - ensureExtensionPointRead(); - return fDescriptorMap.get(id); - } - - /** - * Ensures that the extensions are read and stored in - * fDescriptorsByPartition. - */ - private void ensureExtensionPointRead() { - boolean reload; - synchronized (this) { - reload= !fLoaded; - fLoaded= true; - } - if (reload) - reload(); - } - - /** - * Reloads the extensions to the extension point. - *

    - * This method can be called more than once in order to reload from - * a changed extension registry. - *

    - */ - public void reload() { - IExtensionRegistry registry= Platform.getExtensionRegistry(); - List elements= new ArrayList(Arrays.asList(registry.getConfigurationElementsFor(CDebugUIPlugin.PLUGIN_ID, EXTENSION_POINT))); - - List descriptors= new ArrayList(); - Map descriptorMap= new HashMap(); - - for (Iterator iter= elements.iterator(); iter.hasNext();) { - IConfigurationElement element= iter.next(); - try { - RulerColumnDescriptor desc= new RulerColumnDescriptor(element, this); - String id= desc.getId(); - if (descriptorMap.containsKey(id)) { - noteDuplicateId(desc); - continue; - } - - descriptors.add(desc); - descriptorMap.put(id, desc); - } catch (InvalidRegistryObjectException x) { - /* - * Element is not valid any longer as the contributing plug-in was unloaded or for - * some other reason. Do not include the extension in the list and inform the user - * about it. - */ - noteInvalidExtension(element, x); - } catch (CoreException x) { - warnUser(x.getStatus()); - } - } - - sort(descriptors); - - synchronized (this) { - fDescriptors= Collections.unmodifiableList(descriptors); - fDescriptorMap= Collections.unmodifiableMap(descriptorMap); - } - } - - /** - * Sorts the column contributions. - * - * @param descriptors the descriptors to sort - */ - @SuppressWarnings("unchecked") - private void sort(List descriptors) { - /* - * Topological sort of the DAG defined by the plug-in dependencies - * 1. TopoSort descriptors by plug-in dependency - * 2. Insert into Directed Acyclic Graph - * 3. TopoSort DAG: pick the source with the lowest gravity and remove from DAG - */ - ConfigurationElementSorter sorter= new ConfigurationElementSorter() { - @Override - public IConfigurationElement getConfigurationElement(Object object) { - return ((RulerColumnDescriptor) object).getConfigurationElement(); - } - }; - RulerColumnDescriptor[] array= new RulerColumnDescriptor[descriptors.size()]; - descriptors.toArray(array); - sorter.sort(array); - - Map descriptorsById= new HashMap(); - for (RulerColumnDescriptor desc : array) { - descriptorsById.put(desc.getId(), desc); - } - - DAG dag= new DAG(); - for (RulerColumnDescriptor desc : array) { - dag.addVertex(desc); - - Set before= desc.getPlacement().getConstraints(); - for (Iterator it= before.iterator(); it.hasNext();) { - RulerColumnPlacementConstraint constraint= (RulerColumnPlacementConstraint) it.next(); - String id= constraint.getId(); - RulerColumnDescriptor target= descriptorsById.get(id); - if (target == null) { - noteUnknownTarget(desc, id); - } else { - boolean success; - if (constraint.isBefore()) - success= dag.addEdge(desc, target); - else - success= dag.addEdge(target, desc); - if (!success) - noteCycle(desc, target); - } - } - } - - Comparator gravityComp= new Comparator() { - @Override - public int compare(RulerColumnDescriptor o1, RulerColumnDescriptor o2) { - float diff= o1.getPlacement().getGravity() - o2.getPlacement().getGravity(); - if (diff == 0) - return 0; - if (diff < 0) - return -1; - return 1; - } - }; - - /* Topological sort - always select the source with the least gravity */ - Set toProcess= dag.getSources(); - int index= 0; - while (!toProcess.isEmpty()) { - RulerColumnDescriptor next= Collections.min(toProcess, gravityComp); - array[index]= next; - index++; - dag.removeVertex(next); - toProcess= dag.getSources(); - } - Assert.isTrue(index == array.length); - - ListIterator it= descriptors.listIterator(); - for (int i= 0; i < index; i++) { - it.next(); - it.set(array[i]); - } - } - - private void noteInvalidExtension(IConfigurationElement element, InvalidRegistryObjectException x) { - String message= MessageFormat.format(RulerColumnMessages.RulerColumnRegistry_invalid_msg, new Object[] {ExtensionPointHelper.findId(element)}); - warnUser(message, x); - } - - private void noteUnknownTarget(RulerColumnDescriptor desc, String referencedId) { - String message= MessageFormat.format(RulerColumnMessages.RulerColumnRegistry_unresolved_placement_msg, new Object[] {QUALIFIED_EXTENSION_POINT, referencedId, desc.getName(), desc.getContributor()}); - warnUser(message, null); - } - - private void noteCycle(RulerColumnDescriptor desc, RulerColumnDescriptor target) { - String message= MessageFormat.format(RulerColumnMessages.RulerColumnRegistry_cyclic_placement_msg, new Object[] {QUALIFIED_EXTENSION_POINT, target.getName(), desc.getName(), desc.getContributor()}); - warnUser(message, null); - } - - private void noteDuplicateId(RulerColumnDescriptor desc) { - String message= MessageFormat.format(RulerColumnMessages.RulerColumnRegistry_duplicate_id_msg, new Object[] {QUALIFIED_EXTENSION_POINT, desc.getId(), desc.getContributor()}); - warnUser(message, null); - } - - private void warnUser(String message, Exception exception) { - IStatus status= new Status(IStatus.WARNING, TextEditorPlugin.PLUGIN_ID, IStatus.OK, message, exception); - warnUser(status); - } - - private void warnUser(IStatus status) { - TextEditorPlugin.getDefault().getLog().log(status); - } -} +/******************************************************************************* + * Copyright (c) 2000, 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 Corporation - initial API and implementation + * Wind River Systems, Inc. - adapted for for disassembly parts + *******************************************************************************/ +package org.eclipse.cdt.debug.ui.disassembly.rulers; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.Comparator; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.ListIterator; +import java.util.Map; +import java.util.Set; + +import org.eclipse.cdt.debug.ui.CDebugUIPlugin; +import org.eclipse.core.runtime.Assert; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IConfigurationElement; +import org.eclipse.core.runtime.IExtensionRegistry; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.InvalidRegistryObjectException; +import org.eclipse.core.runtime.Platform; +import org.eclipse.core.runtime.Status; +import org.eclipse.ui.internal.texteditor.TextEditorPlugin; +import org.eclipse.ui.internal.texteditor.rulers.DAG; +import org.eclipse.ui.internal.texteditor.rulers.ExtensionPointHelper; +import org.eclipse.ui.internal.texteditor.rulers.RulerColumnMessages; +import org.eclipse.ui.internal.texteditor.rulers.RulerColumnPlacementConstraint; +import org.eclipse.ui.texteditor.ConfigurationElementSorter; + +import com.ibm.icu.text.MessageFormat; + + +/** + * A registry for all extensions to the + * rulerColumns extension point. + * + * @since 7.2 + * @noinstantiate This class is not intended to be instantiated by clients. + */ +public final class RulerColumnRegistry { + + private static final String EXTENSION_POINT= "disassemblyRulerColumns"; //$NON-NLS-1$ + private static final String QUALIFIED_EXTENSION_POINT= CDebugUIPlugin.PLUGIN_ID + '.' + EXTENSION_POINT; + + /** The singleton instance. */ + private static RulerColumnRegistry fgSingleton= null; + + /** + * Returns the default computer registry. + * + * @return the singleton instance + */ + public static synchronized RulerColumnRegistry getDefault() { + if (fgSingleton == null) { + fgSingleton= new RulerColumnRegistry(); + } + + return fgSingleton; + } + + /** + * All descriptors (element type: + * {@link RulerColumnDescriptor}). + */ + private List fDescriptors= null; + /** + * All descriptors by id (element type: {@link RulerColumnDescriptor}). + */ + private Map fDescriptorMap= null; + + /** + * true if this registry has been loaded. + */ + private boolean fLoaded= false; + + /** + * Creates a new instance. + */ + RulerColumnRegistry() { + } + + /** + * Returns the list of {@link RulerColumnDescriptor}s describing all extensions to the + * rulerColumns extension point. The list's iterator traverses the descriptors in + * the ordering implied by the placement specifications of the contributions. + *

    + * The returned list is unmodifiable and guaranteed to never change. Note that the set of + * descriptors may change over time due to dynamic plug-in removal or addition. + *

    + * + * @return the sorted list of extensions to the rulerColumns extension point + * (element type: {@link RulerColumnDescriptor}) + */ + public List getColumnDescriptors() { + ensureExtensionPointRead(); + return fDescriptors; + } + + /** + * Returns the {@link RulerColumnDescriptor} with the given identity, null if no + * such descriptor exists. + * + * @param id the identity of the ruler contribution as given in the extension point xml. + * @return the {@link RulerColumnDescriptor} with the given identity, null if no + * such descriptor exists + */ + public RulerColumnDescriptor getColumnDescriptor(String id) { + Assert.isLegal(id != null); + ensureExtensionPointRead(); + return fDescriptorMap.get(id); + } + + /** + * Ensures that the extensions are read and stored in + * fDescriptorsByPartition. + */ + private void ensureExtensionPointRead() { + boolean reload; + synchronized (this) { + reload= !fLoaded; + fLoaded= true; + } + if (reload) + reload(); + } + + /** + * Reloads the extensions to the extension point. + *

    + * This method can be called more than once in order to reload from + * a changed extension registry. + *

    + */ + public void reload() { + IExtensionRegistry registry= Platform.getExtensionRegistry(); + List elements= new ArrayList(Arrays.asList(registry.getConfigurationElementsFor(CDebugUIPlugin.PLUGIN_ID, EXTENSION_POINT))); + + List descriptors= new ArrayList(); + Map descriptorMap= new HashMap(); + + for (Iterator iter= elements.iterator(); iter.hasNext();) { + IConfigurationElement element= iter.next(); + try { + RulerColumnDescriptor desc= new RulerColumnDescriptor(element, this); + String id= desc.getId(); + if (descriptorMap.containsKey(id)) { + noteDuplicateId(desc); + continue; + } + + descriptors.add(desc); + descriptorMap.put(id, desc); + } catch (InvalidRegistryObjectException x) { + /* + * Element is not valid any longer as the contributing plug-in was unloaded or for + * some other reason. Do not include the extension in the list and inform the user + * about it. + */ + noteInvalidExtension(element, x); + } catch (CoreException x) { + warnUser(x.getStatus()); + } + } + + sort(descriptors); + + synchronized (this) { + fDescriptors= Collections.unmodifiableList(descriptors); + fDescriptorMap= Collections.unmodifiableMap(descriptorMap); + } + } + + /** + * Sorts the column contributions. + * + * @param descriptors the descriptors to sort + */ + @SuppressWarnings("unchecked") + private void sort(List descriptors) { + /* + * Topological sort of the DAG defined by the plug-in dependencies + * 1. TopoSort descriptors by plug-in dependency + * 2. Insert into Directed Acyclic Graph + * 3. TopoSort DAG: pick the source with the lowest gravity and remove from DAG + */ + ConfigurationElementSorter sorter= new ConfigurationElementSorter() { + @Override + public IConfigurationElement getConfigurationElement(Object object) { + return ((RulerColumnDescriptor) object).getConfigurationElement(); + } + }; + RulerColumnDescriptor[] array= new RulerColumnDescriptor[descriptors.size()]; + descriptors.toArray(array); + sorter.sort(array); + + Map descriptorsById= new HashMap(); + for (RulerColumnDescriptor desc : array) { + descriptorsById.put(desc.getId(), desc); + } + + DAG dag= new DAG(); + for (RulerColumnDescriptor desc : array) { + dag.addVertex(desc); + + Set before= desc.getPlacement().getConstraints(); + for (Iterator it= before.iterator(); it.hasNext();) { + RulerColumnPlacementConstraint constraint= (RulerColumnPlacementConstraint) it.next(); + String id= constraint.getId(); + RulerColumnDescriptor target= descriptorsById.get(id); + if (target == null) { + noteUnknownTarget(desc, id); + } else { + boolean success; + if (constraint.isBefore()) + success= dag.addEdge(desc, target); + else + success= dag.addEdge(target, desc); + if (!success) + noteCycle(desc, target); + } + } + } + + Comparator gravityComp= new Comparator() { + @Override + public int compare(RulerColumnDescriptor o1, RulerColumnDescriptor o2) { + float diff= o1.getPlacement().getGravity() - o2.getPlacement().getGravity(); + if (diff == 0) + return 0; + if (diff < 0) + return -1; + return 1; + } + }; + + /* Topological sort - always select the source with the least gravity */ + Set toProcess= dag.getSources(); + int index= 0; + while (!toProcess.isEmpty()) { + RulerColumnDescriptor next= Collections.min(toProcess, gravityComp); + array[index]= next; + index++; + dag.removeVertex(next); + toProcess= dag.getSources(); + } + Assert.isTrue(index == array.length); + + ListIterator it= descriptors.listIterator(); + for (int i= 0; i < index; i++) { + it.next(); + it.set(array[i]); + } + } + + private void noteInvalidExtension(IConfigurationElement element, InvalidRegistryObjectException x) { + String message= MessageFormat.format(RulerColumnMessages.RulerColumnRegistry_invalid_msg, new Object[] {ExtensionPointHelper.findId(element)}); + warnUser(message, x); + } + + private void noteUnknownTarget(RulerColumnDescriptor desc, String referencedId) { + String message= MessageFormat.format(RulerColumnMessages.RulerColumnRegistry_unresolved_placement_msg, new Object[] {QUALIFIED_EXTENSION_POINT, referencedId, desc.getName(), desc.getContributor()}); + warnUser(message, null); + } + + private void noteCycle(RulerColumnDescriptor desc, RulerColumnDescriptor target) { + String message= MessageFormat.format(RulerColumnMessages.RulerColumnRegistry_cyclic_placement_msg, new Object[] {QUALIFIED_EXTENSION_POINT, target.getName(), desc.getName(), desc.getContributor()}); + warnUser(message, null); + } + + private void noteDuplicateId(RulerColumnDescriptor desc) { + String message= MessageFormat.format(RulerColumnMessages.RulerColumnRegistry_duplicate_id_msg, new Object[] {QUALIFIED_EXTENSION_POINT, desc.getId(), desc.getContributor()}); + warnUser(message, null); + } + + private void warnUser(String message, Exception exception) { + IStatus status= new Status(IStatus.WARNING, TextEditorPlugin.PLUGIN_ID, IStatus.OK, message, exception); + warnUser(status); + } + + private void warnUser(IStatus status) { + TextEditorPlugin.getDefault().getLog().log(status); + } +} diff --git a/debug/org.eclipse.cdt.gdb/about.ini b/debug/org.eclipse.cdt.gdb/about.ini index 2411cc21096..e07a7bb377e 100644 --- a/debug/org.eclipse.cdt.gdb/about.ini +++ b/debug/org.eclipse.cdt.gdb/about.ini @@ -1,24 +1,24 @@ -# about.ini -# contains information about a feature -# java.io.Properties file (ISO 8859-1 with "\" escapes) -# "%key" are externalized strings defined in about.properties -# This file does not need to be translated. - -# Property "aboutText" contains blurb for "About" dialog (translated) -aboutText=%blurb - -# Property "windowImage" contains path to window icon (16x16) -# needed for primary features only - -# Property "featureImage" contains path to feature image (32x32) -featureImage=cdt_logo_icon32.png - -# Property "aboutImage" contains path to product image (500x330 or 115x164) -# needed for primary features only - -# Property "appName" contains name of the application (translated) -# needed for primary features only - -# Property "welcomePerspective" contains the id of the perspective in which the -# welcome page is to be opened. -# optional +# about.ini +# contains information about a feature +# java.io.Properties file (ISO 8859-1 with "\" escapes) +# "%key" are externalized strings defined in about.properties +# This file does not need to be translated. + +# Property "aboutText" contains blurb for "About" dialog (translated) +aboutText=%blurb + +# Property "windowImage" contains path to window icon (16x16) +# needed for primary features only + +# Property "featureImage" contains path to feature image (32x32) +featureImage=cdt_logo_icon32.png + +# Property "aboutImage" contains path to product image (500x330 or 115x164) +# needed for primary features only + +# Property "appName" contains name of the application (translated) +# needed for primary features only + +# Property "welcomePerspective" contains the id of the perspective in which the +# welcome page is to be opened. +# optional diff --git a/debug/org.eclipse.cdt.gdb/about.mappings b/debug/org.eclipse.cdt.gdb/about.mappings index c39de2d7fe5..0824105e69d 100644 --- a/debug/org.eclipse.cdt.gdb/about.mappings +++ b/debug/org.eclipse.cdt.gdb/about.mappings @@ -1,9 +1,9 @@ -# about.mappings -# contains fill-ins for about.properties -# java.io.Properties file (ISO 8859-1 with "\" escapes) -# This file does not need to be translated. - -# The following should contain the build version. -# e.g. "0=20020612" -# This value will be added automaticaly via the build scripts +# about.mappings +# contains fill-ins for about.properties +# java.io.Properties file (ISO 8859-1 with "\" escapes) +# This file does not need to be translated. + +# The following should contain the build version. +# e.g. "0=20020612" +# This value will be added automaticaly via the build scripts 0=@build@ \ No newline at end of file diff --git a/doc/org.eclipse.cdt.doc.isv/schema.css b/doc/org.eclipse.cdt.doc.isv/schema.css index 4efbf267284..00f9d01bff8 100644 --- a/doc/org.eclipse.cdt.doc.isv/schema.css +++ b/doc/org.eclipse.cdt.doc.isv/schema.css @@ -1,66 +1,66 @@ -H6.CaptionFigColumn#header { - font-size:16px; - display:inline -} - -P.Note#copyright { - font-size: smaller; - font-style: normal; - color: #336699; - display:inline; - margin-top: 3.000000pt; - margin-bottom: 11.000000pt; - margin-right: 0.000000pt; - margin-left: 0.000000pt; -} - -P.Code#dtd { - color: #800000; - margin-top: 0.000000pt; - margin-bottom: 0.000000pt; - margin-right: 0.000000pt; - margin-left: 10.000000pt; -} - -P.Code#dtdAttlist { - color: #800000; - margin-top: 0.000000pt; - margin-bottom: 0.000000pt; - margin-right: 0.000000pt; - margin-left: 20.000000pt; -} - -P.Code#tag { - color: #000080; - display:inline; - margin-top: 0.000000pt; - margin-bottom: 0.000000pt; - margin-right: 0.000000pt; - margin-left: 0.000000pt; -} - -P.Code#cstring { - color: #008000; - display:inline; - margin-top: 0.000000pt; - margin-bottom: 0.000000pt; - margin-right: 0.000000pt; - margin-left: 0.000000pt; -} - -.ConfigMarkup#elementDesc { - color: black; - margin-top: 0.000000pt; - margin-bottom: 0.000000pt; - margin-right: 0.000000pt; - margin-left: 10.000000pt; -} - -.ConfigMarkup#attlistDesc { - color: black; - margin-top: 0.000000pt; - margin-bottom: 0.000000pt; - margin-right: 0.000000pt; - margin-left: 32.000000pt; -} - +H6.CaptionFigColumn#header { + font-size:16px; + display:inline +} + +P.Note#copyright { + font-size: smaller; + font-style: normal; + color: #336699; + display:inline; + margin-top: 3.000000pt; + margin-bottom: 11.000000pt; + margin-right: 0.000000pt; + margin-left: 0.000000pt; +} + +P.Code#dtd { + color: #800000; + margin-top: 0.000000pt; + margin-bottom: 0.000000pt; + margin-right: 0.000000pt; + margin-left: 10.000000pt; +} + +P.Code#dtdAttlist { + color: #800000; + margin-top: 0.000000pt; + margin-bottom: 0.000000pt; + margin-right: 0.000000pt; + margin-left: 20.000000pt; +} + +P.Code#tag { + color: #000080; + display:inline; + margin-top: 0.000000pt; + margin-bottom: 0.000000pt; + margin-right: 0.000000pt; + margin-left: 0.000000pt; +} + +P.Code#cstring { + color: #008000; + display:inline; + margin-top: 0.000000pt; + margin-bottom: 0.000000pt; + margin-right: 0.000000pt; + margin-left: 0.000000pt; +} + +.ConfigMarkup#elementDesc { + color: black; + margin-top: 0.000000pt; + margin-bottom: 0.000000pt; + margin-right: 0.000000pt; + margin-left: 10.000000pt; +} + +.ConfigMarkup#attlistDesc { + color: black; + margin-top: 0.000000pt; + margin-bottom: 0.000000pt; + margin-right: 0.000000pt; + margin-left: 32.000000pt; +} + diff --git a/doc/org.eclipse.cdt.doc.user/customBuildCallbacks.xml b/doc/org.eclipse.cdt.doc.user/customBuildCallbacks.xml index e0a92a65f0f..53a5bbd0435 100644 --- a/doc/org.eclipse.cdt.doc.user/customBuildCallbacks.xml +++ b/doc/org.eclipse.cdt.doc.user/customBuildCallbacks.xml @@ -1,163 +1,163 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/view/Messages.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/view/Messages.java index af36ef7c1b4..699c4b1da13 100644 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/view/Messages.java +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/view/Messages.java @@ -1,25 +1,25 @@ -/******************************************************************************* - * Copyright (c) 2012, 2014 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 Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.dsf.gdb.multicorevisualizer.internal.ui.view; - -import org.eclipse.osgi.util.NLS; - -public class Messages extends NLS { - public static String MulticoreVisualizer_name; - public static String MulticoreVisualizer_tooltip; - static { - // initialize resource bundle - NLS.initializeMessages(Messages.class.getName(), Messages.class); - } - - private Messages() { - } -} +/******************************************************************************* + * Copyright (c) 2012, 2014 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 Corporation - initial API and implementation + *******************************************************************************/ +package org.eclipse.cdt.dsf.gdb.multicorevisualizer.internal.ui.view; + +import org.eclipse.osgi.util.NLS; + +public class Messages extends NLS { + public static String MulticoreVisualizer_name; + public static String MulticoreVisualizer_tooltip; + static { + // initialize resource bundle + NLS.initializeMessages(Messages.class.getName(), Messages.class); + } + + private Messages() { + } +} diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/view/Messages.properties b/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/view/Messages.properties index 96c244d3df5..5cfd1086b1c 100644 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/view/Messages.properties +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.multicorevisualizer.ui/src/org/eclipse/cdt/dsf/gdb/multicorevisualizer/internal/ui/view/Messages.properties @@ -1,12 +1,12 @@ -############################################################################### -# Copyright (c) 2012 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 Corporation - initial API and implementation -############################################################################### -MulticoreVisualizer_name=Multicore Visualizer -MulticoreVisualizer_tooltip=Displays current state of selected debug target +############################################################################### +# Copyright (c) 2012 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 Corporation - initial API and implementation +############################################################################### +MulticoreVisualizer_name=Multicore Visualizer +MulticoreVisualizer_tooltip=Displays current state of selected debug target diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.tests/src/org/eclipse/cdt/dsf/gdb/service/CommonDsfTest.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.tests/src/org/eclipse/cdt/dsf/gdb/service/CommonDsfTest.java index 094bcb18f75..5182a0ad472 100644 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.tests/src/org/eclipse/cdt/dsf/gdb/service/CommonDsfTest.java +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.tests/src/org/eclipse/cdt/dsf/gdb/service/CommonDsfTest.java @@ -1,109 +1,109 @@ -/******************************************************************************* - * Copyright (c) 2017 Renesas Electronics 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: - * Bruno Medeiros (Renesas) - initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.dsf.gdb.service; - -import static org.junit.Assert.fail; - -import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants; -import org.eclipse.cdt.dsf.concurrent.DataRequestMonitor; -import org.eclipse.cdt.dsf.concurrent.DefaultDsfExecutor; -import org.eclipse.cdt.dsf.concurrent.RequestMonitor; -import org.eclipse.cdt.dsf.debug.model.DsfLaunch; -import org.eclipse.cdt.dsf.gdb.internal.GdbPlugin; -import org.eclipse.cdt.dsf.service.DsfSession; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.debug.core.DebugPlugin; -import org.eclipse.debug.core.ILaunch; -import org.eclipse.debug.core.ILaunchConfigurationType; -import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; -import org.eclipse.debug.core.ILaunchManager; -import org.eclipse.debug.core.model.ISourceLocator; -import org.junit.AfterClass; -import org.junit.Before; -import org.junit.BeforeClass; - -/** - * Helper base class for running DSF related tests - */ -public class CommonDsfTest extends CommonTest { - - protected static DsfSession fSession = null; - - /** - * Setup the test. - * The session is typically configured once per class load, but we allow subclasses to override this, - * and sometimes re-setup during a test (or interactive debugging). - * Therefore {@link Before} is used, not {@link BeforeClass}. - */ - @Before - public void setup() { - if(fSession != null) { - return; // Already set-up - } - - doSetupSession(); - } - - protected void doSetupSession() { - fSession = DsfSession.startSession(new DefaultDsfExecutor(GdbPlugin.PLUGIN_ID), GdbPlugin.PLUGIN_ID); - - registerLaunch(); - } - - @AfterClass - public static void tearDown() { - if(fSession != null) { - DsfSession.endSession(fSession); - fSession = null; - } - } - - protected ILaunchConfigurationType getCLaunchConfigType() { - return getLaunchManager().getLaunchConfigurationType(ICDTLaunchConfigurationConstants.ID_LAUNCH_C_APP); - } - - protected ILaunchManager getLaunchManager() { - return DebugPlugin.getDefault().getLaunchManager(); - } - - protected void registerLaunch() { - ILaunchConfigurationWorkingCopy lc; - try { - lc = getCLaunchConfigType().newInstance(null, "TestLaunch"); - } catch(CoreException e) { - fail(e.getMessage()); - return; - } - ISourceLocator sourceLocator = null; - DsfLaunch dsfLaunch = new DsfLaunch(lc, ILaunchManager.DEBUG_MODE, sourceLocator); - fSession.registerModelAdapter(ILaunch.class, dsfLaunch); - } - - protected RequestMonitor newRequestMonitor() { - return new RequestMonitor(fSession.getExecutor(), null); - } - - protected DataRequestMonitor newDataRequestMonitor() { - return new DataRequestMonitor<>(fSession.getExecutor(), null); - } -} - -/** - * Misc test utilities. - */ -class CommonTest { - /* ----------------- ----------------- */ - - @SafeVarargs - public static T[] array(T... elems) { - return elems; - } +/******************************************************************************* + * Copyright (c) 2017 Renesas Electronics 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: + * Bruno Medeiros (Renesas) - initial API and implementation + *******************************************************************************/ +package org.eclipse.cdt.dsf.gdb.service; + +import static org.junit.Assert.fail; + +import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants; +import org.eclipse.cdt.dsf.concurrent.DataRequestMonitor; +import org.eclipse.cdt.dsf.concurrent.DefaultDsfExecutor; +import org.eclipse.cdt.dsf.concurrent.RequestMonitor; +import org.eclipse.cdt.dsf.debug.model.DsfLaunch; +import org.eclipse.cdt.dsf.gdb.internal.GdbPlugin; +import org.eclipse.cdt.dsf.service.DsfSession; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.debug.core.DebugPlugin; +import org.eclipse.debug.core.ILaunch; +import org.eclipse.debug.core.ILaunchConfigurationType; +import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; +import org.eclipse.debug.core.ILaunchManager; +import org.eclipse.debug.core.model.ISourceLocator; +import org.junit.AfterClass; +import org.junit.Before; +import org.junit.BeforeClass; + +/** + * Helper base class for running DSF related tests + */ +public class CommonDsfTest extends CommonTest { + + protected static DsfSession fSession = null; + + /** + * Setup the test. + * The session is typically configured once per class load, but we allow subclasses to override this, + * and sometimes re-setup during a test (or interactive debugging). + * Therefore {@link Before} is used, not {@link BeforeClass}. + */ + @Before + public void setup() { + if(fSession != null) { + return; // Already set-up + } + + doSetupSession(); + } + + protected void doSetupSession() { + fSession = DsfSession.startSession(new DefaultDsfExecutor(GdbPlugin.PLUGIN_ID), GdbPlugin.PLUGIN_ID); + + registerLaunch(); + } + + @AfterClass + public static void tearDown() { + if(fSession != null) { + DsfSession.endSession(fSession); + fSession = null; + } + } + + protected ILaunchConfigurationType getCLaunchConfigType() { + return getLaunchManager().getLaunchConfigurationType(ICDTLaunchConfigurationConstants.ID_LAUNCH_C_APP); + } + + protected ILaunchManager getLaunchManager() { + return DebugPlugin.getDefault().getLaunchManager(); + } + + protected void registerLaunch() { + ILaunchConfigurationWorkingCopy lc; + try { + lc = getCLaunchConfigType().newInstance(null, "TestLaunch"); + } catch(CoreException e) { + fail(e.getMessage()); + return; + } + ISourceLocator sourceLocator = null; + DsfLaunch dsfLaunch = new DsfLaunch(lc, ILaunchManager.DEBUG_MODE, sourceLocator); + fSession.registerModelAdapter(ILaunch.class, dsfLaunch); + } + + protected RequestMonitor newRequestMonitor() { + return new RequestMonitor(fSession.getExecutor(), null); + } + + protected DataRequestMonitor newDataRequestMonitor() { + return new DataRequestMonitor<>(fSession.getExecutor(), null); + } +} + +/** + * Misc test utilities. + */ +class CommonTest { + /* ----------------- ----------------- */ + + @SafeVarargs + public static T[] array(T... elems) { + return elems; + } } \ No newline at end of file diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb.tests/src/org/eclipse/cdt/dsf/mi/service/command/commands/TestMIGDBSetSysroot.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb.tests/src/org/eclipse/cdt/dsf/mi/service/command/commands/TestMIGDBSetSysroot.java index 2de9908980d..50623c1373e 100644 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb.tests/src/org/eclipse/cdt/dsf/mi/service/command/commands/TestMIGDBSetSysroot.java +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb.tests/src/org/eclipse/cdt/dsf/mi/service/command/commands/TestMIGDBSetSysroot.java @@ -1,73 +1,73 @@ -/******************************************************************************* - * Copyright (c) 2016 Ingenico. - * 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: - * Ingenico - Sysroot with spaces (Bug 497693) - *******************************************************************************/ -package org.eclipse.cdt.dsf.mi.service.command.commands; - -import static org.junit.Assert.assertEquals; - -import org.eclipse.cdt.dsf.concurrent.DefaultDsfExecutor; -import org.eclipse.cdt.dsf.datamodel.IDMContext; -import org.eclipse.cdt.dsf.debug.service.command.ICommandControlService.ICommandControlDMContext; -import org.eclipse.cdt.dsf.gdb.internal.GdbPlugin; -import org.eclipse.cdt.dsf.gdb.service.command.GDBControlDMContext; -import org.eclipse.cdt.dsf.service.DsfSession; -import org.junit.Test; - -/** - * Verifies that the set sysroot MI command don't add double quotes if path contains space. - * - */ -public class TestMIGDBSetSysroot { - - @Test - public void pathWithSpaceShouldNotBe() { - MIGDBSetSysroot setSysrootCommand = new MIGDBSetSysroot(new TestContext(), "/tmp/test with space/"); - assertEquals("Wrong syntax for command", "-gdb-set sysroot /tmp/test with space/\n", - setSysrootCommand.constructCommand()); - } - - @Test - public void pathWithDoubleQuotesShouldNotBe() { - MIGDBSetSysroot setSysrootCommand = new MIGDBSetSysroot(new TestContext(), "/tmp/test with\"double quotes/"); - assertEquals("Wrong syntax for command", "-gdb-set sysroot /tmp/test with\"double quotes/\n", - setSysrootCommand.constructCommand()); - - - } - - private class TestContext implements ICommandControlDMContext { - private DsfSession session = null; - - public TestContext() { - session = DsfSession.startSession(new DefaultDsfExecutor(GdbPlugin.PLUGIN_ID), GdbPlugin.PLUGIN_ID); - } - - @Override - public IDMContext[] getParents() { - return new IDMContext[] { new GDBControlDMContext(getSessionId(), "1") }; - } - - @Override - public String getSessionId() { - return session.getId(); - } - - @Override - public T getAdapter(Class adapter) { - return null; - } - - @Override - public String getCommandControlId() { - return null; - } - } - -} +/******************************************************************************* + * Copyright (c) 2016 Ingenico. + * 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: + * Ingenico - Sysroot with spaces (Bug 497693) + *******************************************************************************/ +package org.eclipse.cdt.dsf.mi.service.command.commands; + +import static org.junit.Assert.assertEquals; + +import org.eclipse.cdt.dsf.concurrent.DefaultDsfExecutor; +import org.eclipse.cdt.dsf.datamodel.IDMContext; +import org.eclipse.cdt.dsf.debug.service.command.ICommandControlService.ICommandControlDMContext; +import org.eclipse.cdt.dsf.gdb.internal.GdbPlugin; +import org.eclipse.cdt.dsf.gdb.service.command.GDBControlDMContext; +import org.eclipse.cdt.dsf.service.DsfSession; +import org.junit.Test; + +/** + * Verifies that the set sysroot MI command don't add double quotes if path contains space. + * + */ +public class TestMIGDBSetSysroot { + + @Test + public void pathWithSpaceShouldNotBe() { + MIGDBSetSysroot setSysrootCommand = new MIGDBSetSysroot(new TestContext(), "/tmp/test with space/"); + assertEquals("Wrong syntax for command", "-gdb-set sysroot /tmp/test with space/\n", + setSysrootCommand.constructCommand()); + } + + @Test + public void pathWithDoubleQuotesShouldNotBe() { + MIGDBSetSysroot setSysrootCommand = new MIGDBSetSysroot(new TestContext(), "/tmp/test with\"double quotes/"); + assertEquals("Wrong syntax for command", "-gdb-set sysroot /tmp/test with\"double quotes/\n", + setSysrootCommand.constructCommand()); + + + } + + private class TestContext implements ICommandControlDMContext { + private DsfSession session = null; + + public TestContext() { + session = DsfSession.startSession(new DefaultDsfExecutor(GdbPlugin.PLUGIN_ID), GdbPlugin.PLUGIN_ID); + } + + @Override + public IDMContext[] getParents() { + return new IDMContext[] { new GDBControlDMContext(getSessionId(), "1") }; + } + + @Override + public String getSessionId() { + return session.getId(); + } + + @Override + public T getAdapter(Class adapter) { + return null; + } + + @Override + public String getCommandControlId() { + return null; + } + } + +} diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/GdbDebugOptions.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/GdbDebugOptions.java index 3db5fe29c40..916c38b65ab 100644 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/GdbDebugOptions.java +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/internal/GdbDebugOptions.java @@ -1,123 +1,123 @@ -/******************************************************************************* - * Copyright (c) 2012, 2014 Sage Electronic Engineering, LLC. 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: - * Jason Litton (Sage Electronic Engineering, LLC) - initial API and implementation +/******************************************************************************* + * Copyright (c) 2012, 2014 Sage Electronic Engineering, LLC. 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: + * Jason Litton (Sage Electronic Engineering, LLC) - initial API and implementation *******************************************************************************/ - -package org.eclipse.cdt.dsf.gdb.internal; - -import java.util.Hashtable; - -import org.eclipse.osgi.service.debug.DebugOptions; -import org.eclipse.osgi.service.debug.DebugOptionsListener; -import org.eclipse.osgi.service.debug.DebugTrace; -import org.osgi.framework.BundleContext; - -/** - * Hooks our debug options to the Platform trace functionality. - * In essence, we can open Window -> Preferences -> Tracing - * and turn on debug options for this package. The debug output - * will come out on the console and can be saved directly to - * a file. Classes that need to be debugged can call into - * GdbDebugOptions to get debug flags. If new flags need to be - * created, they will need to have a unique identifier and added to - * the .options file in this plugin - * - * @since 4.1 - * - */ -public class GdbDebugOptions implements DebugOptionsListener { - - private static final String DEBUG_FLAG = "org.eclipse.cdt.dsf.gdb/debug"; //$NON-NLS-1$ - private static final String DEBUG_TIMEOUTS_FLAG = "org.eclipse.cdt.dsf.gdb/debug/timeouts"; //$NON-NLS-1$ - - public static boolean DEBUG = false; - public static boolean DEBUG_COMMAND_TIMEOUTS = false; - - /** - * The {@link DebugTrace} object to print to OSGi tracing - */ - private static DebugTrace fgDebugTrace; - - /** - * Constructor - */ - public GdbDebugOptions(BundleContext context) { - Hashtable props = new Hashtable(2); - props.put(org.eclipse.osgi.service.debug.DebugOptions.LISTENER_SYMBOLICNAME, GdbPlugin.getUniqueIdentifier()); - context.registerService(DebugOptionsListener.class.getName(), this, props); - } - - - @Override - public void optionsChanged(DebugOptions options) { - fgDebugTrace = options.newDebugTrace(GdbPlugin.getUniqueIdentifier()); - DEBUG = options.getBooleanOption(DEBUG_FLAG, false); - DEBUG_COMMAND_TIMEOUTS = options.getBooleanOption(DEBUG_TIMEOUTS_FLAG, false); - } - - /** - * Prints the given message to System.out and to the OSGi tracing (if started) - * @param option the option or null - * @param message the message to print or null - * @param throwable the {@link Throwable} or null - */ - public static void trace(String option, String message, Throwable throwable) { - trace(option, message, 100, throwable); - } - - /** - * Prints the given message to System.out and to the OSGi tracing (if started) - * @param option the option or null - * @param message the message to print or null - * @param lineMax the number of character at which point the line should be - * split. Minimum 100. Negative number to indicate no split. - * @param throwable the {@link Throwable} or null - */ - public static void trace(String option, String message, int lineMax, Throwable throwable) { - if (lineMax < 0) { - lineMax = Integer.MAX_VALUE; - } else if (lineMax < 100) { - lineMax = 100; - } - - //divide the string into substrings of 'lineMax' chars or less for printing to console - String systemPrintableMessage = message; - while (systemPrintableMessage.length() > lineMax) { - String partial = systemPrintableMessage.substring(0, lineMax); - systemPrintableMessage = systemPrintableMessage.substring(lineMax); - System.out.println(partial + "\\"); //$NON-NLS-1$ - } - System.out.print(systemPrintableMessage); - //then pass the original message to be traced into a file - if(fgDebugTrace != null) { - fgDebugTrace.trace(option, message, throwable); - } - } - - /** - * Prints the given message to System.out and to the OSGi tracing (if enabled) - * - * @param message the message or null - * @param lineMax the number of character at which point the line should be - * split. Minimum 100. Negative number to indicate no split. - */ - public static void trace(String message, int lineMax) { - trace(null, message, lineMax, null); - } - - /** - * Prints the given message to System.out and to the OSGi tracing (if enabled) - * - * @param message the message or null - */ - public static void trace(String message) { - trace(null, message, null); - } - -} + +package org.eclipse.cdt.dsf.gdb.internal; + +import java.util.Hashtable; + +import org.eclipse.osgi.service.debug.DebugOptions; +import org.eclipse.osgi.service.debug.DebugOptionsListener; +import org.eclipse.osgi.service.debug.DebugTrace; +import org.osgi.framework.BundleContext; + +/** + * Hooks our debug options to the Platform trace functionality. + * In essence, we can open Window -> Preferences -> Tracing + * and turn on debug options for this package. The debug output + * will come out on the console and can be saved directly to + * a file. Classes that need to be debugged can call into + * GdbDebugOptions to get debug flags. If new flags need to be + * created, they will need to have a unique identifier and added to + * the .options file in this plugin + * + * @since 4.1 + * + */ +public class GdbDebugOptions implements DebugOptionsListener { + + private static final String DEBUG_FLAG = "org.eclipse.cdt.dsf.gdb/debug"; //$NON-NLS-1$ + private static final String DEBUG_TIMEOUTS_FLAG = "org.eclipse.cdt.dsf.gdb/debug/timeouts"; //$NON-NLS-1$ + + public static boolean DEBUG = false; + public static boolean DEBUG_COMMAND_TIMEOUTS = false; + + /** + * The {@link DebugTrace} object to print to OSGi tracing + */ + private static DebugTrace fgDebugTrace; + + /** + * Constructor + */ + public GdbDebugOptions(BundleContext context) { + Hashtable props = new Hashtable(2); + props.put(org.eclipse.osgi.service.debug.DebugOptions.LISTENER_SYMBOLICNAME, GdbPlugin.getUniqueIdentifier()); + context.registerService(DebugOptionsListener.class.getName(), this, props); + } + + + @Override + public void optionsChanged(DebugOptions options) { + fgDebugTrace = options.newDebugTrace(GdbPlugin.getUniqueIdentifier()); + DEBUG = options.getBooleanOption(DEBUG_FLAG, false); + DEBUG_COMMAND_TIMEOUTS = options.getBooleanOption(DEBUG_TIMEOUTS_FLAG, false); + } + + /** + * Prints the given message to System.out and to the OSGi tracing (if started) + * @param option the option or null + * @param message the message to print or null + * @param throwable the {@link Throwable} or null + */ + public static void trace(String option, String message, Throwable throwable) { + trace(option, message, 100, throwable); + } + + /** + * Prints the given message to System.out and to the OSGi tracing (if started) + * @param option the option or null + * @param message the message to print or null + * @param lineMax the number of character at which point the line should be + * split. Minimum 100. Negative number to indicate no split. + * @param throwable the {@link Throwable} or null + */ + public static void trace(String option, String message, int lineMax, Throwable throwable) { + if (lineMax < 0) { + lineMax = Integer.MAX_VALUE; + } else if (lineMax < 100) { + lineMax = 100; + } + + //divide the string into substrings of 'lineMax' chars or less for printing to console + String systemPrintableMessage = message; + while (systemPrintableMessage.length() > lineMax) { + String partial = systemPrintableMessage.substring(0, lineMax); + systemPrintableMessage = systemPrintableMessage.substring(lineMax); + System.out.println(partial + "\\"); //$NON-NLS-1$ + } + System.out.print(systemPrintableMessage); + //then pass the original message to be traced into a file + if(fgDebugTrace != null) { + fgDebugTrace.trace(option, message, throwable); + } + } + + /** + * Prints the given message to System.out and to the OSGi tracing (if enabled) + * + * @param message the message or null + * @param lineMax the number of character at which point the line should be + * split. Minimum 100. Negative number to indicate no split. + */ + public static void trace(String message, int lineMax) { + trace(null, message, lineMax, null); + } + + /** + * Prints the given message to System.out and to the OSGi tracing (if enabled) + * + * @param message the message or null + */ + public static void trace(String message) { + trace(null, message, null); + } + +} diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/command/CommandFactory_6_8.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/command/CommandFactory_6_8.java index 63887022390..b8b1abd946e 100644 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/command/CommandFactory_6_8.java +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/gdb/service/command/CommandFactory_6_8.java @@ -1,40 +1,40 @@ -/******************************************************************************* - * Copyright (c) 2010 Ericsson 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: - * Ericsson - initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.dsf.gdb.service.command; - -import org.eclipse.cdt.dsf.debug.service.IBreakpoints.IBreakpointsTargetDMContext; -import org.eclipse.cdt.dsf.debug.service.command.ICommand; -import org.eclipse.cdt.dsf.mi.service.command.CommandFactory; -import org.eclipse.cdt.dsf.mi.service.command.commands.MIBreakInsert; -import org.eclipse.cdt.dsf.mi.service.command.output.MIBreakInsertInfo; - -/** - * A command factory for commands that should only be used starting with GDB 6.8 - * @since 4.0 */ -public class CommandFactory_6_8 extends CommandFactory { - - @Override - public ICommand createMIBreakInsert(IBreakpointsTargetDMContext ctx, String func) { - return new MIBreakInsert(ctx, func, true); - } - - @Override - public ICommand createMIBreakInsert(IBreakpointsTargetDMContext ctx, boolean isTemporary, - boolean isHardware, String condition, int ignoreCount, String line, String tid) { - return new MIBreakInsert(ctx, isTemporary, isHardware, condition, ignoreCount, line, tid, true); - } - - @Override - public ICommand createMIBreakInsert(IBreakpointsTargetDMContext ctx, boolean isTemporary, - boolean isHardware, String condition, int ignoreCount, String location, String tid, boolean disabled, boolean isTracepoint) { - return new MIBreakInsert(ctx, isTemporary, isHardware, condition, ignoreCount, location, tid, disabled, isTracepoint, true); - } -} +/******************************************************************************* + * Copyright (c) 2010 Ericsson 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: + * Ericsson - initial API and implementation + *******************************************************************************/ +package org.eclipse.cdt.dsf.gdb.service.command; + +import org.eclipse.cdt.dsf.debug.service.IBreakpoints.IBreakpointsTargetDMContext; +import org.eclipse.cdt.dsf.debug.service.command.ICommand; +import org.eclipse.cdt.dsf.mi.service.command.CommandFactory; +import org.eclipse.cdt.dsf.mi.service.command.commands.MIBreakInsert; +import org.eclipse.cdt.dsf.mi.service.command.output.MIBreakInsertInfo; + +/** + * A command factory for commands that should only be used starting with GDB 6.8 + * @since 4.0 */ +public class CommandFactory_6_8 extends CommandFactory { + + @Override + public ICommand createMIBreakInsert(IBreakpointsTargetDMContext ctx, String func) { + return new MIBreakInsert(ctx, func, true); + } + + @Override + public ICommand createMIBreakInsert(IBreakpointsTargetDMContext ctx, boolean isTemporary, + boolean isHardware, String condition, int ignoreCount, String line, String tid) { + return new MIBreakInsert(ctx, isTemporary, isHardware, condition, ignoreCount, line, tid, true); + } + + @Override + public ICommand createMIBreakInsert(IBreakpointsTargetDMContext ctx, boolean isTemporary, + boolean isHardware, String condition, int ignoreCount, String location, String tid, boolean disabled, boolean isTracepoint) { + return new MIBreakInsert(ctx, isTemporary, isHardware, condition, ignoreCount, location, tid, disabled, isTracepoint, true); + } +} diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/CLIJump.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/CLIJump.java index c6c02a7c310..bfbc007c6de 100644 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/CLIJump.java +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/CLIJump.java @@ -1,28 +1,28 @@ -/******************************************************************************* - * Copyright (c) 2010 Ericsson 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: - * Ericsson - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.dsf.mi.service.command.commands; - -import org.eclipse.cdt.dsf.debug.service.IRunControl.IExecutionDMContext; -import org.eclipse.cdt.dsf.mi.service.command.output.MIInfo; - -/** - * jump LINESPEC - * jump LOCATION - * Resume execution at line LINESPEC or at address given by LOCATION. - * - * @since 3.0 - */ -public class CLIJump extends CLICommand { - - public CLIJump(IExecutionDMContext ctx, String location) { - super(ctx, "jump " + location); //$NON-NLS-1$ - } -} +/******************************************************************************* + * Copyright (c) 2010 Ericsson 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: + * Ericsson - Initial API and implementation + *******************************************************************************/ +package org.eclipse.cdt.dsf.mi.service.command.commands; + +import org.eclipse.cdt.dsf.debug.service.IRunControl.IExecutionDMContext; +import org.eclipse.cdt.dsf.mi.service.command.output.MIInfo; + +/** + * jump LINESPEC + * jump LOCATION + * Resume execution at line LINESPEC or at address given by LOCATION. + * + * @since 3.0 + */ +public class CLIJump extends CLICommand { + + public CLIJump(IExecutionDMContext ctx, String location) { + super(ctx, "jump " + location); //$NON-NLS-1$ + } +} diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIExecArguments.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIExecArguments.java index 15753e1336c..36f98f216b9 100644 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIExecArguments.java +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIExecArguments.java @@ -1,31 +1,31 @@ -/******************************************************************************* - * Copyright (c) 2011 Tensilica 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: - * Abeer Bagul (Tensilica) - Initial API and implementation - *******************************************************************************/ - -package org.eclipse.cdt.dsf.mi.service.command.commands; - -import org.eclipse.cdt.dsf.mi.service.IMIContainerDMContext; -import org.eclipse.cdt.dsf.mi.service.command.output.MIInfo; - -/** - * - * -exec-arguments ARGS - * - * Set the inferior program arguments, to be used in the next `-exec-run'. - * Equivalent to using {@link MIGDBSetArgs} - * - * @since 4.0 - */ -public class MIExecArguments extends MICommand -{ - public MIExecArguments(IMIContainerDMContext ctx, String[] args) { - super(ctx, "-exec-arguments", args); //$NON-NLS-1$ - } -} +/******************************************************************************* + * Copyright (c) 2011 Tensilica 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: + * Abeer Bagul (Tensilica) - Initial API and implementation + *******************************************************************************/ + +package org.eclipse.cdt.dsf.mi.service.command.commands; + +import org.eclipse.cdt.dsf.mi.service.IMIContainerDMContext; +import org.eclipse.cdt.dsf.mi.service.command.output.MIInfo; + +/** + * + * -exec-arguments ARGS + * + * Set the inferior program arguments, to be used in the next `-exec-run'. + * Equivalent to using {@link MIGDBSetArgs} + * + * @since 4.0 + */ +public class MIExecArguments extends MICommand +{ + public MIExecArguments(IMIContainerDMContext ctx, String[] args) { + super(ctx, "-exec-arguments", args); //$NON-NLS-1$ + } +} diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBSetCharset.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBSetCharset.java index 1b842f27ee7..e6c6bbd8c63 100644 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBSetCharset.java +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBSetCharset.java @@ -1,30 +1,30 @@ -/******************************************************************************* - * Copyright (c) 2012 Mathias Kunter 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: - * Mathias Kunter - Initial API and implementation -*******************************************************************************/ - -package org.eclipse.cdt.dsf.mi.service.command.commands; - -import org.eclipse.cdt.dsf.debug.service.command.ICommandControlService.ICommandControlDMContext; - -/** - * - * -gdb-set charset CHARSET - * - * Sets both the current host and target charset to CHARSET. The host charset is the - * charset used by gdb. The target charset is the charset used by the char type of the - * inferior program. - * - * @since 4.1 - */ -public class MIGDBSetCharset extends MIGDBSet { - public MIGDBSetCharset(ICommandControlDMContext ctx, String charset) { - super(ctx, new String[] {"charset", charset}); //$NON-NLS-1$ - } -} +/******************************************************************************* + * Copyright (c) 2012 Mathias Kunter 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: + * Mathias Kunter - Initial API and implementation +*******************************************************************************/ + +package org.eclipse.cdt.dsf.mi.service.command.commands; + +import org.eclipse.cdt.dsf.debug.service.command.ICommandControlService.ICommandControlDMContext; + +/** + * + * -gdb-set charset CHARSET + * + * Sets both the current host and target charset to CHARSET. The host charset is the + * charset used by gdb. The target charset is the charset used by the char type of the + * inferior program. + * + * @since 4.1 + */ +public class MIGDBSetCharset extends MIGDBSet { + public MIGDBSetCharset(ICommandControlDMContext ctx, String charset) { + super(ctx, new String[] {"charset", charset}); //$NON-NLS-1$ + } +} diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBSetHostCharset.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBSetHostCharset.java index 86047488bfb..59cf05f2576 100644 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBSetHostCharset.java +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBSetHostCharset.java @@ -1,28 +1,28 @@ -/******************************************************************************* - * Copyright (c) 2012 Mathias Kunter 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: - * Mathias Kunter - Initial API and implementation -*******************************************************************************/ - -package org.eclipse.cdt.dsf.mi.service.command.commands; - -import org.eclipse.cdt.dsf.debug.service.command.ICommandControlService.ICommandControlDMContext; - -/** - * - * -gdb-set host-charset CHARSET - * - * Sets the current host charset to CHARSET. The host charset is the charset used by gdb. - * - * @since 4.1 - */ -public class MIGDBSetHostCharset extends MIGDBSet { - public MIGDBSetHostCharset(ICommandControlDMContext ctx, String hostCharset) { - super(ctx, new String[] {"host-charset", hostCharset}); //$NON-NLS-1$ - } -} +/******************************************************************************* + * Copyright (c) 2012 Mathias Kunter 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: + * Mathias Kunter - Initial API and implementation +*******************************************************************************/ + +package org.eclipse.cdt.dsf.mi.service.command.commands; + +import org.eclipse.cdt.dsf.debug.service.command.ICommandControlService.ICommandControlDMContext; + +/** + * + * -gdb-set host-charset CHARSET + * + * Sets the current host charset to CHARSET. The host charset is the charset used by gdb. + * + * @since 4.1 + */ +public class MIGDBSetHostCharset extends MIGDBSet { + public MIGDBSetHostCharset(ICommandControlDMContext ctx, String hostCharset) { + super(ctx, new String[] {"host-charset", hostCharset}); //$NON-NLS-1$ + } +} diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBSetNewConsole.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBSetNewConsole.java index 814b822dfae..e99d7a451ba 100644 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBSetNewConsole.java +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBSetNewConsole.java @@ -1,27 +1,27 @@ -/******************************************************************************* - * Copyright (c) 2017 Kichwa Coders 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: - * Kichwa Coders - initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.dsf.mi.service.command.commands; - -import org.eclipse.cdt.dsf.datamodel.IDMContext; - -/** - * -gdb-set new-console on|off - * - * Set whether to start in a new console or not - * - * @since 5.4 - */ -public class MIGDBSetNewConsole extends MIGDBSet { - - public MIGDBSetNewConsole(IDMContext ctx, boolean isSet) { - super(ctx, new String[] { "new-console", isSet ? "on" : "off" }); //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$ - } -} +/******************************************************************************* + * Copyright (c) 2017 Kichwa Coders 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: + * Kichwa Coders - initial API and implementation + *******************************************************************************/ +package org.eclipse.cdt.dsf.mi.service.command.commands; + +import org.eclipse.cdt.dsf.datamodel.IDMContext; + +/** + * -gdb-set new-console on|off + * + * Set whether to start in a new console or not + * + * @since 5.4 + */ +public class MIGDBSetNewConsole extends MIGDBSet { + + public MIGDBSetNewConsole(IDMContext ctx, boolean isSet) { + super(ctx, new String[] { "new-console", isSet ? "on" : "off" }); //$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$ + } +} diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBSetPrintObject.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBSetPrintObject.java index f78900958ea..cecd32a90f3 100644 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBSetPrintObject.java +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBSetPrintObject.java @@ -1,30 +1,30 @@ -/******************************************************************************* - * Copyright (c) 2012 Anton Gorenkov 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: - * Anton Gorenkov - initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.dsf.mi.service.command.commands; - -import org.eclipse.cdt.dsf.debug.service.command.ICommandControlService.ICommandControlDMContext; - -/** - * - * -gdb-set print object [on | off] - * - * When on: - * for GDB <= 7.4, Runtime Type Information will be used in the gdb console. - * for GDB >= 7.5, Runtime Type Information will be used in the debug views. - * When off, only static type of variable is taken into account. - * - * @since 4.1 - */ -public class MIGDBSetPrintObject extends MIGDBSet { - public MIGDBSetPrintObject(ICommandControlDMContext ctx, boolean enable) { - super(ctx, new String[] {"print", "object", enable ? "on" : "off"}); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - } -} +/******************************************************************************* + * Copyright (c) 2012 Anton Gorenkov 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: + * Anton Gorenkov - initial API and implementation + *******************************************************************************/ +package org.eclipse.cdt.dsf.mi.service.command.commands; + +import org.eclipse.cdt.dsf.debug.service.command.ICommandControlService.ICommandControlDMContext; + +/** + * + * -gdb-set print object [on | off] + * + * When on: + * for GDB <= 7.4, Runtime Type Information will be used in the gdb console. + * for GDB >= 7.5, Runtime Type Information will be used in the debug views. + * When off, only static type of variable is taken into account. + * + * @since 4.1 + */ +public class MIGDBSetPrintObject extends MIGDBSet { + public MIGDBSetPrintObject(ICommandControlDMContext ctx, boolean enable) { + super(ctx, new String[] {"print", "object", enable ? "on" : "off"}); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ + } +} diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBSetPrintSevenbitStrings.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBSetPrintSevenbitStrings.java index 9ec0c93ebc4..4ea1730548f 100644 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBSetPrintSevenbitStrings.java +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBSetPrintSevenbitStrings.java @@ -1,29 +1,29 @@ -/******************************************************************************* - * Copyright (c) 2012 Mathias Kunter 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: - * Mathias Kunter - Initial API and implementation -*******************************************************************************/ - -package org.eclipse.cdt.dsf.mi.service.command.commands; - -import org.eclipse.cdt.dsf.debug.service.command.ICommandControlService.ICommandControlDMContext; - -/** - * - * -gdb-set print sevenbit-strings [on | off] - * - * When on, gdb displays any eight-bit characters (in strings or character values) using - * the octal escape notation \nnn. When off, prints full eight-bit characters. - * - * @since 4.1 - */ -public class MIGDBSetPrintSevenbitStrings extends MIGDBSet { - public MIGDBSetPrintSevenbitStrings(ICommandControlDMContext ctx, boolean enable) { - super(ctx, new String[] {"print", "sevenbit-strings", enable ? "on" : "off"}); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - } -} +/******************************************************************************* + * Copyright (c) 2012 Mathias Kunter 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: + * Mathias Kunter - Initial API and implementation +*******************************************************************************/ + +package org.eclipse.cdt.dsf.mi.service.command.commands; + +import org.eclipse.cdt.dsf.debug.service.command.ICommandControlService.ICommandControlDMContext; + +/** + * + * -gdb-set print sevenbit-strings [on | off] + * + * When on, gdb displays any eight-bit characters (in strings or character values) using + * the octal escape notation \nnn. When off, prints full eight-bit characters. + * + * @since 4.1 + */ +public class MIGDBSetPrintSevenbitStrings extends MIGDBSet { + public MIGDBSetPrintSevenbitStrings(ICommandControlDMContext ctx, boolean enable) { + super(ctx, new String[] {"print", "sevenbit-strings", enable ? "on" : "off"}); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ + } +} diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBSetTargetCharset.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBSetTargetCharset.java index 26f1def4375..ac93ccfdec1 100644 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBSetTargetCharset.java +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBSetTargetCharset.java @@ -1,29 +1,29 @@ -/******************************************************************************* - * Copyright (c) 2012 Mathias Kunter 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: - * Mathias Kunter - Initial API and implementation -*******************************************************************************/ - -package org.eclipse.cdt.dsf.mi.service.command.commands; - -import org.eclipse.cdt.dsf.debug.service.command.ICommandControlService.ICommandControlDMContext; - -/** - * - * -gdb-set target-charset CHARSET - * - * Sets the current target charset to CHARSET. The target charset is the charset used - * by the char type of the inferior program. - * - * @since 4.1 - */ -public class MIGDBSetTargetCharset extends MIGDBSet { - public MIGDBSetTargetCharset(ICommandControlDMContext ctx, String targetCharset) { - super(ctx, new String[] {"target-charset", targetCharset}); //$NON-NLS-1$ - } -} +/******************************************************************************* + * Copyright (c) 2012 Mathias Kunter 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: + * Mathias Kunter - Initial API and implementation +*******************************************************************************/ + +package org.eclipse.cdt.dsf.mi.service.command.commands; + +import org.eclipse.cdt.dsf.debug.service.command.ICommandControlService.ICommandControlDMContext; + +/** + * + * -gdb-set target-charset CHARSET + * + * Sets the current target charset to CHARSET. The target charset is the charset used + * by the char type of the inferior program. + * + * @since 4.1 + */ +public class MIGDBSetTargetCharset extends MIGDBSet { + public MIGDBSetTargetCharset(ICommandControlDMContext ctx, String targetCharset) { + super(ctx, new String[] {"target-charset", targetCharset}); //$NON-NLS-1$ + } +} diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBSetTargetWideCharset.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBSetTargetWideCharset.java index 1ebf2770754..afa5322f08f 100644 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBSetTargetWideCharset.java +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBSetTargetWideCharset.java @@ -1,31 +1,31 @@ -/******************************************************************************* - * Copyright (c) 2012 Mathias Kunter 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: - * Mathias Kunter - Initial API and implementation -*******************************************************************************/ - -package org.eclipse.cdt.dsf.mi.service.command.commands; - -import org.eclipse.cdt.dsf.debug.service.command.ICommandControlService.ICommandControlDMContext; - -/** - * - * -gdb-set target-wide-charset CHARSET - * - * Sets the current target wide charset to CHARSET. The target wide charset is the charset - * used by the wchar_t type of the inferior program. - * - * Available with gdb 7.0 - * - * @since 4.1 - */ -public class MIGDBSetTargetWideCharset extends MIGDBSet { - public MIGDBSetTargetWideCharset(ICommandControlDMContext ctx, String targetWideCharset) { - super(ctx, new String[] {"target-wide-charset", targetWideCharset}); //$NON-NLS-1$ - } -} +/******************************************************************************* + * Copyright (c) 2012 Mathias Kunter 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: + * Mathias Kunter - Initial API and implementation +*******************************************************************************/ + +package org.eclipse.cdt.dsf.mi.service.command.commands; + +import org.eclipse.cdt.dsf.debug.service.command.ICommandControlService.ICommandControlDMContext; + +/** + * + * -gdb-set target-wide-charset CHARSET + * + * Sets the current target wide charset to CHARSET. The target wide charset is the charset + * used by the wchar_t type of the inferior program. + * + * Available with gdb 7.0 + * + * @since 4.1 + */ +public class MIGDBSetTargetWideCharset extends MIGDBSet { + public MIGDBSetTargetWideCharset(ICommandControlDMContext ctx, String targetWideCharset) { + super(ctx, new String[] {"target-wide-charset", targetWideCharset}); //$NON-NLS-1$ + } +} diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBShowNewConsole.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBShowNewConsole.java index 49fa6dddc85..1ffac2d0b12 100644 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBShowNewConsole.java +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/commands/MIGDBShowNewConsole.java @@ -1,34 +1,34 @@ -/******************************************************************************* - * Copyright (c) 2017 Kichwa Coders 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: - * Kichwa Coders - initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.dsf.mi.service.command.commands; - -import org.eclipse.cdt.dsf.datamodel.IDMContext; -import org.eclipse.cdt.dsf.mi.service.command.output.MIGDBShowNewConsoleInfo; -import org.eclipse.cdt.dsf.mi.service.command.output.MIOutput; - -/** - * - * -gdb-show new-console - * - * @since 5.4 - * - */ -public class MIGDBShowNewConsole extends MIGDBShow { - - public MIGDBShowNewConsole(IDMContext ctx) { - super(ctx, new String[] { "new-console" }); //$NON-NLS-1$ - } - - @Override - public MIGDBShowNewConsoleInfo getResult(MIOutput miResult) { - return new MIGDBShowNewConsoleInfo(miResult); - } -} +/******************************************************************************* + * Copyright (c) 2017 Kichwa Coders 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: + * Kichwa Coders - initial API and implementation + *******************************************************************************/ +package org.eclipse.cdt.dsf.mi.service.command.commands; + +import org.eclipse.cdt.dsf.datamodel.IDMContext; +import org.eclipse.cdt.dsf.mi.service.command.output.MIGDBShowNewConsoleInfo; +import org.eclipse.cdt.dsf.mi.service.command.output.MIOutput; + +/** + * + * -gdb-show new-console + * + * @since 5.4 + * + */ +public class MIGDBShowNewConsole extends MIGDBShow { + + public MIGDBShowNewConsole(IDMContext ctx) { + super(ctx, new String[] { "new-console" }); //$NON-NLS-1$ + } + + @Override + public MIGDBShowNewConsoleInfo getResult(MIOutput miResult) { + return new MIGDBShowNewConsoleInfo(miResult); + } +} diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIGDBShowNewConsoleInfo.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIGDBShowNewConsoleInfo.java index 3ba608be8d5..c9cf9e24cb0 100644 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIGDBShowNewConsoleInfo.java +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIGDBShowNewConsoleInfo.java @@ -1,51 +1,51 @@ -/******************************************************************************* - * Copyright (c) 2017 Kichwa Coders 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: - * Kichwa Coders - initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.dsf.mi.service.command.output; - -/** - * @since 5.4 - */ -public class MIGDBShowNewConsoleInfo extends MIInfo { - - private Boolean fIsSet = null; - - public MIGDBShowNewConsoleInfo(MIOutput record) { - super(record); - parse(); - } - - protected void parse() { - if (isDone()) { - MIOutput out = getMIOutput(); - MIResultRecord outr = out.getMIResultRecord(); - if (outr != null) { - MIResult[] results = outr.getMIResults(); - for (int i = 0; i < results.length; i++) { - String var = results[i].getVariable(); - if (var.equals("value")) { //$NON-NLS-1$ - MIValue value = results[i].getMIValue(); - if (value instanceof MIConst) { - fIsSet = "on".equals(((MIConst) value).getString()); //$NON-NLS-1$ - } - } - } - } - } - } - - /** - * Return if child will launch in a new console, or null if - * new-console unsupported. - */ - public Boolean isSet() { - return fIsSet; - } -} +/******************************************************************************* + * Copyright (c) 2017 Kichwa Coders 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: + * Kichwa Coders - initial API and implementation + *******************************************************************************/ +package org.eclipse.cdt.dsf.mi.service.command.output; + +/** + * @since 5.4 + */ +public class MIGDBShowNewConsoleInfo extends MIInfo { + + private Boolean fIsSet = null; + + public MIGDBShowNewConsoleInfo(MIOutput record) { + super(record); + parse(); + } + + protected void parse() { + if (isDone()) { + MIOutput out = getMIOutput(); + MIResultRecord outr = out.getMIResultRecord(); + if (outr != null) { + MIResult[] results = outr.getMIResults(); + for (int i = 0; i < results.length; i++) { + String var = results[i].getVariable(); + if (var.equals("value")) { //$NON-NLS-1$ + MIValue value = results[i].getMIValue(); + if (value instanceof MIConst) { + fIsSet = "on".equals(((MIConst) value).getString()); //$NON-NLS-1$ + } + } + } + } + } + } + + /** + * Return if child will launch in a new console, or null if + * new-console unsupported. + */ + public Boolean isSet() { + return fIsSet; + } +} diff --git a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIStringHandler.java b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIStringHandler.java index d0c9a86b956..63ccb209846 100644 --- a/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIStringHandler.java +++ b/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIStringHandler.java @@ -1,459 +1,459 @@ -/******************************************************************************* - * Copyright (c) 2012, 2016 Mathias Kunter 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: - * Mathias Kunter - Initial Implementation (Bug 307311) - *******************************************************************************/ -package org.eclipse.cdt.dsf.mi.service.command.output; - -import java.nio.ByteBuffer; -import java.nio.CharBuffer; -import java.nio.charset.Charset; -import java.nio.charset.CharsetDecoder; -import java.nio.charset.CharsetEncoder; -import java.text.ParseException; -import java.util.EnumSet; -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.Map.Entry; - -/** - * The MIStringHandler class provides several static functions to handle C and / or MI strings. - * @since 4.1 - */ -public class MIStringHandler { - - /** - * A map of special characters which are used within escape notations to represent a - * corresponding Unicode code point (i.e. character code). - */ - // Use a LinkedHashMap to preserve order, so as to get 'e' and not 'E' - private static Map fSpecialCharactersToCodePointMap = new LinkedHashMap(); - static { - fSpecialCharactersToCodePointMap.put('a', 0x07); // Alert (bell) character - fSpecialCharactersToCodePointMap.put('b', 0x08); // Backspace character - fSpecialCharactersToCodePointMap.put('e', 0x1B); // GNU extension: Escape character - fSpecialCharactersToCodePointMap.put('E', 0x1B); // same as 'e' - fSpecialCharactersToCodePointMap.put('f', 0x0C); // Form feed character - fSpecialCharactersToCodePointMap.put('n', 0x0A); // New line character - fSpecialCharactersToCodePointMap.put('r', 0x0D); // Carriage return character - fSpecialCharactersToCodePointMap.put('t', 0x09); // Horizontal tabulation character - fSpecialCharactersToCodePointMap.put('v', 0x0B); // Vertical tabulation character - fSpecialCharactersToCodePointMap.put('\'', 0x27); // Single quotation mark - fSpecialCharactersToCodePointMap.put('"', 0x22); // Double quotation mark - fSpecialCharactersToCodePointMap.put('\\', 0x5C); // Backslash - fSpecialCharactersToCodePointMap.put('?', 0x3F); // Literal question mark - } - - /** - * An internal helper enumeration which holds the current status while parsing an escaped - * text sequence. - */ - private enum EscapeStatus { - NONE, - BEGIN, - OCTAL_NUMBER, - HEX_NUMBER, - UNICODE_SHORT_NUMBER, - UNICODE_LONG_NUMBER, - VALID, - INVALID - } - - /** - * An enumeration defining the escape sequences which should be parsed. - */ - public enum ParseFlags { - SPECIAL_CHARS, - OCTAL_NUMBERS, - HEX_NUMBERS, - UNICODE_SHORT_NUMBERS, - UNICODE_LONG_NUMBERS - } - - /** - * Translates the given C string into a string suitable for display. This includes handling - * of escaped characters and different string encodings. This is necessary in order to correctly - * deal with non-ASCII strings. - * @param str The C string to translate. - * @param escapeChars Defines whether non-printable characters should be escaped within - * the translated string, or not. - * @return The translated string. - */ - public static String translateCString(String str, boolean escapeChars) { - if (escapeChars) { - // Don't parse the special character escape notations here. We can do this here because - // we want to keep them in their escaped form anyway, and because the following string - // transcoding process isn't affected by escaped special chars. By doing so we avoid - // caring about some nasty details of the special character escaping process: for - // example, single quotation marks are commonly only escaped within character constants, - // while double quotation marks are commonly only escaped within string constants. By - // not parsing the special character escape notations at all here, we just keep the - // original special character escaping provided by the given MI string. - str = parseString(str, EnumSet.complementOf(EnumSet.of(ParseFlags.SPECIAL_CHARS))); - } else { - // Parse all escaped characters. - str = parseString(str); - } - - // Transcode the string in order to handle non-ASCII strings correctly. - str = transcodeString(str); - - if (escapeChars) { - // Escape any non-printable characters again, as we want to be able to display them. - // However, don't escape any printable special chars, as they haven't been parsed before. - str = escapeString(str, false); - } else { - // No escaping necessary here. We however have to make sure that we use the correct line - // separation character sequence. - str = str.replace("\n", System.getProperty("line.separator", "\n")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - } - - return str; - } - - /** - * Returns whether the given character is a special character, or not. - * @param c The character to test. - * @return The test result. - */ - public static boolean isSpecialChar(char c) { - return fSpecialCharactersToCodePointMap.containsKey(c); - } - - /** - * Returns whether the given Unicode code point is a special code point, or not. - * @param codePoint The Unicode code point to test. - * @return The test result. - */ - public static boolean isSpecialCodePoint(int codePoint) { - return fSpecialCharactersToCodePointMap.containsValue(codePoint); - } - - /** - * Parses the given special character into an Unicode code point. - * @param c The special character to parse. - * @return The parsed Unicode code point. - * @throws ParseException Thrown when the given character can't be parsed. This happens when it's - * not a special character. - */ - public static int parseSpecialChar(char c) throws ParseException { - Integer codePoint = fSpecialCharactersToCodePointMap.get(c); - if (codePoint != null) { - return codePoint; - } - throw new ParseException("The given character '" + c + "' is not a special character.", 0); //$NON-NLS-1$ //$NON-NLS-2$ - } - - /** - * Parses the given special Unicode code point into a character. - * @param codePoint The special Unicode code point to parse. - * @return The parsed character. - * @throws ParseException Thrown when the given Unicode code point can't be parsed. This happens - * when it's not a special code point. - */ - public static char parseSpecialCodePoint(int codePoint) throws ParseException { - for (Entry entry : fSpecialCharactersToCodePointMap.entrySet()) { - if (entry.getValue().equals(codePoint)) { - return entry.getKey(); - } - } - throw new ParseException("The given Unicode code point " + codePoint + " is not a special code point.", 0); //$NON-NLS-1$ //$NON-NLS-2$ - } - - /** - * This is an overloaded function. See the Javadoc of the other function overload for details. - * @param str The string which should be parsed. - * @return The parsed string. - */ - public static String parseString(String str) { - return parseString(str, EnumSet.allOf(ParseFlags.class)); - } - - /** - * Parses any escaped characters and replaces them with their corresponding Unicode code points. - * This function parses all escape notations which are supported by gcc and / or gdb. Those are:

    - * - *
      - *
    • Special char escape notations: \a, \b, \e, \E, \f, \n, \r, \t, \v, \', \", \\, and \?
    • - * - *
    • Octal escape notation: An initial backslash, followed by 1, 2, or 3 octal digits. Values - * above 0xFF are ignored. Octal escape notations may not use more than 3 octal digits.
    • - * - *
    • Hexadecimal escape notation: An initial backslash, followed by an "x" and 1 or more - * hexadecimal digits. Hexadecimal escape notations may not use more than 4 hexadecimal digits - * (although gcc accepts hexadecimal escape notations of any arbitrary length).
    • - * - *
    • Short Unicode escape notation: An initial backslash, followed by an "u" and exactly 4 - * hexadecimal digits.
    • - * - *
    • Long Unicode escape notation: An initial backslash, followed by an "U" and exactly 8 - * hexadecimal digits.
    • - *
    - * @param str The string which should be parsed. - * @param parseFlags The set of escape notations which should be parsed. - * @return The parsed string. - */ - public static String parseString(String str, EnumSet parseFlags) { - StringBuilder buffer = new StringBuilder(); - StringBuilder escapeBuffer = new StringBuilder(); - EscapeStatus escStatus = EscapeStatus.NONE; - - for (int i = 0; i < str.length(); i++) { - char c = str.charAt(i); - boolean consumeChar = true; - boolean isLastChar = i == str.length() - 1; - - if (escStatus == EscapeStatus.NONE) { - if (c == '\\') { - // Escaping begins. Reset the escape buffer. - escapeBuffer.setLength(0); - escapeBuffer.append(c); - escStatus = EscapeStatus.BEGIN; - } - } else if (escStatus == EscapeStatus.BEGIN) { - if (parseFlags.contains(ParseFlags.SPECIAL_CHARS) && isSpecialChar(c)) { - try { - buffer.appendCodePoint(parseSpecialChar(c)); - escStatus = EscapeStatus.VALID; - } catch (ParseException e) { - // This is just for completeness. We will actually never catch any ParseException here - // since we already checked the character with isSpecialChar() before. - escapeBuffer.append(c); - escStatus = EscapeStatus.INVALID; - } - } else if (parseFlags.contains(ParseFlags.OCTAL_NUMBERS) && c >= '0' && c <= '7') { - escStatus = EscapeStatus.OCTAL_NUMBER; - // Don't consume this character right now - as this wouldn't work if it's the last character. - consumeChar = false; - } else if (parseFlags.contains(ParseFlags.HEX_NUMBERS) && c == 'x') { - escStatus = EscapeStatus.HEX_NUMBER; - } else if (parseFlags.contains(ParseFlags.UNICODE_SHORT_NUMBERS) && c == 'u') { - escStatus = EscapeStatus.UNICODE_SHORT_NUMBER; - } else if (parseFlags.contains(ParseFlags.UNICODE_LONG_NUMBERS) && c == 'U') { - escStatus = EscapeStatus.UNICODE_LONG_NUMBER; - } else { - escStatus = EscapeStatus.INVALID; - } - if (consumeChar) { - escapeBuffer.append(c); - } - } else if (escStatus == EscapeStatus.HEX_NUMBER) { - // Only consume this character if it belongs to the escape sequence. - consumeChar = (c >= '0' && c <= '9') || (c >= 'a' && c <= 'f') || (c >= 'A' && c <= 'F'); - if (consumeChar) { - escapeBuffer.append(c); - } - - if (!consumeChar || isLastChar || escapeBuffer.length() == 6) { - // The escape sequence is terminated. Set the escape status to invalid until - // we know that it's actually valid. - escStatus = EscapeStatus.INVALID; - if (escapeBuffer.length() > 2) { - // Decode the hexadecimal number. - try { - int codePoint = Integer.parseInt(escapeBuffer.toString().substring(2), 16); - if (codePoint <= 0x10FFFF) { - buffer.appendCodePoint(codePoint); - escStatus = EscapeStatus.VALID; - } - } catch (NumberFormatException e) { - } - } - } - } else if (escStatus == EscapeStatus.UNICODE_SHORT_NUMBER || escStatus == EscapeStatus.UNICODE_LONG_NUMBER) { - // Only consume this character if it belongs to the escape sequence. - consumeChar = (c >= '0' && c <= '9') || (c >= 'a' && c <= 'f') || (c >= 'A' && c <= 'F'); - if (consumeChar) { - escapeBuffer.append(c); - } - - int finalLength = escStatus == EscapeStatus.UNICODE_SHORT_NUMBER ? 6 : 10; - if (escapeBuffer.length() == finalLength) { - // The escape sequence is terminated. Set the escape status to invalid until - // we know that it's actually valid. Decode the hexadecimal number. - escStatus = EscapeStatus.INVALID; - try { - int codePoint = Integer.parseInt(escapeBuffer.toString().substring(2), 16); - if (codePoint <= 0x10FFFF) { - buffer.appendCodePoint(codePoint); - escStatus = EscapeStatus.VALID; - } - } catch (NumberFormatException e) { - } - } else if (!consumeChar || isLastChar) { - // The escape sequence is terminated and invalid. - escStatus = EscapeStatus.INVALID; - } - } else if (escStatus == EscapeStatus.OCTAL_NUMBER) { - // Only consume this character if it belongs to the escape sequence. - consumeChar = c >= '0' && c <= '7'; - if (consumeChar) { - escapeBuffer.append(c); - } - - if (!consumeChar || isLastChar || escapeBuffer.length() == 4) { - // The escape sequence is terminated. Set the escape status to invalid until - // we know that it's actually valid. - escStatus = EscapeStatus.INVALID; - if (escapeBuffer.length() > 1) { - // Decode the octal number. - try { - int codePoint = Integer.parseInt(escapeBuffer.toString().substring(1), 8); - if (codePoint <= 0xFF) { - buffer.appendCodePoint(codePoint); - escStatus = EscapeStatus.VALID; - } - } catch (NumberFormatException e) { - } - } - } - } - - if (escStatus == EscapeStatus.NONE) { - // Current character isn't escaped - copy it over to the destination buffer. - buffer.append(c); - } else if (escStatus == EscapeStatus.VALID) { - escStatus = EscapeStatus.NONE; - } else if (escStatus == EscapeStatus.INVALID) { - buffer.append(escapeBuffer); - escStatus = EscapeStatus.NONE; - } - - if (!consumeChar) { - // Don't consume the current character. - i--; - } - } - - // Check for non-finished escape sequences at the end of the string. - if (escStatus != EscapeStatus.NONE) { - buffer.append(escapeBuffer); - } - - // Convert the buffer into a string and return it. - return buffer.toString(); - } - - /** - * Transcodes the given string. This is done as follows:

    - * 1) The given string is encoded into a binary byte buffer.

    - * 2) It's tested whether this binary byte buffer seems to represent a string which is encoded as - * either ASCII, Latin-1, or UTF-8. If this is the case, the binary byte buffer is decoded back into - * a string and this string is returned. If the test is negative, the given string is returned without - * modification because its encoding can't be reliably determined in this case. - * The most important use case of this function is to transcode a string which is actually UTF-8 but has - * been incorrectly decoded as Latin-1 instead. - * @param str The string to transcode. - * @return The transcoded string. - */ - public static String transcodeString(String str) { - // Try to transcode the string from Latin-1 to UTF-8 (ASCII doesn't need to be explicitly - // considered here since Latin-1 is backwards compatible with ASCII). The transcoding will - // almost certainly only succeed if the string actually *is* encoded in UTF-8. If the - // transcoding fails, the string is simply left unchanged. - try { - // First, try to encode the string as Latin-1 in order to obtain the binary byte - // representation of the string. - CharsetEncoder latin1Encoder = Charset.forName("ISO-8859-1").newEncoder(); //$NON-NLS-1$ - ByteBuffer stringBytes = latin1Encoder.encode(CharBuffer.wrap(str.toCharArray())); - - // Next, try to decode the string as UTF-8. This will almost certainly only succeed - // if the string actually *is* encoded in UTF-8. Note that if the decoding fails, - // an exception is thrown before the str variable is assigned. The original string - // is therefore left unchanged in this case. - CharsetDecoder utf8Decoder = Charset.forName("UTF-8").newDecoder(); //$NON-NLS-1$ - str = utf8Decoder.decode(stringBytes).toString(); - } catch (Exception e) { - } - - return str; - } - - /** - * Escapes any non-printable characters as well as the printable special characters single quotation - * mark, double quotation mark, backslash, and literal question mark within the given string. Supports - * the entire Unicode code space. - * @param str The string which should be escaped. - * @return The escaped string. - */ - public static String escapeString(String str) { - return escapeString(str, true); - } - - /** - * Escapes any non-printable characters within the given string. Supports the entire Unicode code space. - * @param str The string which should be escaped. - * @param escapePrintableSpecialChars Defines whether the printable special characters single - * quotation mark, double quotation mark, backslash, and literal question mark should be - * escaped as well, or not. - * @return The escaped string. - */ - public static String escapeString(String str, boolean escapePrintableSpecialChars) { - StringBuilder buffer = new StringBuilder(); - - for (int i = 0; i < str.length(); i++) { - // Get the current character code point. Note that using the Java "char" data type isn't - // sufficient here, as it can't handle all Unicode characters. - int codePoint = str.codePointAt(i); - if (Character.isSupplementaryCodePoint(codePoint)) { - i++; - } - - // Check the code point type of the character in order to determine whether it's - // printable or not. - int codePointType = Character.getType(codePoint); - switch (codePointType) { - case Character.LINE_SEPARATOR: - case Character.PARAGRAPH_SEPARATOR: - case Character.CONTROL: - case Character.PRIVATE_USE: - case Character.SURROGATE: - case Character.UNASSIGNED: - // Non-printable character. - if (isSpecialCodePoint(codePoint)) { - // Escape by using the special character escape notation. - buffer.append('\\'); - try { - buffer.append(parseSpecialCodePoint(codePoint)); - } catch (ParseException e) { - buffer.appendCodePoint(codePoint); - } - } else if (codePoint == 0x00) { - // Escape the null character separately - don't use leading zeros. - buffer.append("\\0"); //$NON-NLS-1$ - } else if (codePoint <= 0xFF) { - // Escape by using the octal escape notation. - buffer.append(String.format("\\%03o", codePoint)); //$NON-NLS-1$ - } else if (codePoint <= 0xFFFF) { - // Escape by using the short Unicode escape notation. - buffer.append(String.format("\\u%04x", codePoint)); //$NON-NLS-1$ - } else { - // Escape by using the long Unicode escape notation. - buffer.append(String.format("\\U%08x", codePoint)); //$NON-NLS-1$ - } - break; - default: - // Printable character. - if (escapePrintableSpecialChars && isSpecialCodePoint(codePoint)) { - // Escape by using the special character escape notation. - buffer.append('\\'); - try { - buffer.append(parseSpecialCodePoint(codePoint)); - } catch (ParseException e) { - buffer.appendCodePoint(codePoint); - } - } else { - // Don't escape. - buffer.appendCodePoint(codePoint); - } - } - } - - return buffer.toString(); - } -} +/******************************************************************************* + * Copyright (c) 2012, 2016 Mathias Kunter 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: + * Mathias Kunter - Initial Implementation (Bug 307311) + *******************************************************************************/ +package org.eclipse.cdt.dsf.mi.service.command.output; + +import java.nio.ByteBuffer; +import java.nio.CharBuffer; +import java.nio.charset.Charset; +import java.nio.charset.CharsetDecoder; +import java.nio.charset.CharsetEncoder; +import java.text.ParseException; +import java.util.EnumSet; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.Map.Entry; + +/** + * The MIStringHandler class provides several static functions to handle C and / or MI strings. + * @since 4.1 + */ +public class MIStringHandler { + + /** + * A map of special characters which are used within escape notations to represent a + * corresponding Unicode code point (i.e. character code). + */ + // Use a LinkedHashMap to preserve order, so as to get 'e' and not 'E' + private static Map fSpecialCharactersToCodePointMap = new LinkedHashMap(); + static { + fSpecialCharactersToCodePointMap.put('a', 0x07); // Alert (bell) character + fSpecialCharactersToCodePointMap.put('b', 0x08); // Backspace character + fSpecialCharactersToCodePointMap.put('e', 0x1B); // GNU extension: Escape character + fSpecialCharactersToCodePointMap.put('E', 0x1B); // same as 'e' + fSpecialCharactersToCodePointMap.put('f', 0x0C); // Form feed character + fSpecialCharactersToCodePointMap.put('n', 0x0A); // New line character + fSpecialCharactersToCodePointMap.put('r', 0x0D); // Carriage return character + fSpecialCharactersToCodePointMap.put('t', 0x09); // Horizontal tabulation character + fSpecialCharactersToCodePointMap.put('v', 0x0B); // Vertical tabulation character + fSpecialCharactersToCodePointMap.put('\'', 0x27); // Single quotation mark + fSpecialCharactersToCodePointMap.put('"', 0x22); // Double quotation mark + fSpecialCharactersToCodePointMap.put('\\', 0x5C); // Backslash + fSpecialCharactersToCodePointMap.put('?', 0x3F); // Literal question mark + } + + /** + * An internal helper enumeration which holds the current status while parsing an escaped + * text sequence. + */ + private enum EscapeStatus { + NONE, + BEGIN, + OCTAL_NUMBER, + HEX_NUMBER, + UNICODE_SHORT_NUMBER, + UNICODE_LONG_NUMBER, + VALID, + INVALID + } + + /** + * An enumeration defining the escape sequences which should be parsed. + */ + public enum ParseFlags { + SPECIAL_CHARS, + OCTAL_NUMBERS, + HEX_NUMBERS, + UNICODE_SHORT_NUMBERS, + UNICODE_LONG_NUMBERS + } + + /** + * Translates the given C string into a string suitable for display. This includes handling + * of escaped characters and different string encodings. This is necessary in order to correctly + * deal with non-ASCII strings. + * @param str The C string to translate. + * @param escapeChars Defines whether non-printable characters should be escaped within + * the translated string, or not. + * @return The translated string. + */ + public static String translateCString(String str, boolean escapeChars) { + if (escapeChars) { + // Don't parse the special character escape notations here. We can do this here because + // we want to keep them in their escaped form anyway, and because the following string + // transcoding process isn't affected by escaped special chars. By doing so we avoid + // caring about some nasty details of the special character escaping process: for + // example, single quotation marks are commonly only escaped within character constants, + // while double quotation marks are commonly only escaped within string constants. By + // not parsing the special character escape notations at all here, we just keep the + // original special character escaping provided by the given MI string. + str = parseString(str, EnumSet.complementOf(EnumSet.of(ParseFlags.SPECIAL_CHARS))); + } else { + // Parse all escaped characters. + str = parseString(str); + } + + // Transcode the string in order to handle non-ASCII strings correctly. + str = transcodeString(str); + + if (escapeChars) { + // Escape any non-printable characters again, as we want to be able to display them. + // However, don't escape any printable special chars, as they haven't been parsed before. + str = escapeString(str, false); + } else { + // No escaping necessary here. We however have to make sure that we use the correct line + // separation character sequence. + str = str.replace("\n", System.getProperty("line.separator", "\n")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + } + + return str; + } + + /** + * Returns whether the given character is a special character, or not. + * @param c The character to test. + * @return The test result. + */ + public static boolean isSpecialChar(char c) { + return fSpecialCharactersToCodePointMap.containsKey(c); + } + + /** + * Returns whether the given Unicode code point is a special code point, or not. + * @param codePoint The Unicode code point to test. + * @return The test result. + */ + public static boolean isSpecialCodePoint(int codePoint) { + return fSpecialCharactersToCodePointMap.containsValue(codePoint); + } + + /** + * Parses the given special character into an Unicode code point. + * @param c The special character to parse. + * @return The parsed Unicode code point. + * @throws ParseException Thrown when the given character can't be parsed. This happens when it's + * not a special character. + */ + public static int parseSpecialChar(char c) throws ParseException { + Integer codePoint = fSpecialCharactersToCodePointMap.get(c); + if (codePoint != null) { + return codePoint; + } + throw new ParseException("The given character '" + c + "' is not a special character.", 0); //$NON-NLS-1$ //$NON-NLS-2$ + } + + /** + * Parses the given special Unicode code point into a character. + * @param codePoint The special Unicode code point to parse. + * @return The parsed character. + * @throws ParseException Thrown when the given Unicode code point can't be parsed. This happens + * when it's not a special code point. + */ + public static char parseSpecialCodePoint(int codePoint) throws ParseException { + for (Entry entry : fSpecialCharactersToCodePointMap.entrySet()) { + if (entry.getValue().equals(codePoint)) { + return entry.getKey(); + } + } + throw new ParseException("The given Unicode code point " + codePoint + " is not a special code point.", 0); //$NON-NLS-1$ //$NON-NLS-2$ + } + + /** + * This is an overloaded function. See the Javadoc of the other function overload for details. + * @param str The string which should be parsed. + * @return The parsed string. + */ + public static String parseString(String str) { + return parseString(str, EnumSet.allOf(ParseFlags.class)); + } + + /** + * Parses any escaped characters and replaces them with their corresponding Unicode code points. + * This function parses all escape notations which are supported by gcc and / or gdb. Those are:

    + * + *
      + *
    • Special char escape notations: \a, \b, \e, \E, \f, \n, \r, \t, \v, \', \", \\, and \?
    • + * + *
    • Octal escape notation: An initial backslash, followed by 1, 2, or 3 octal digits. Values + * above 0xFF are ignored. Octal escape notations may not use more than 3 octal digits.
    • + * + *
    • Hexadecimal escape notation: An initial backslash, followed by an "x" and 1 or more + * hexadecimal digits. Hexadecimal escape notations may not use more than 4 hexadecimal digits + * (although gcc accepts hexadecimal escape notations of any arbitrary length).
    • + * + *
    • Short Unicode escape notation: An initial backslash, followed by an "u" and exactly 4 + * hexadecimal digits.
    • + * + *
    • Long Unicode escape notation: An initial backslash, followed by an "U" and exactly 8 + * hexadecimal digits.
    • + *
    + * @param str The string which should be parsed. + * @param parseFlags The set of escape notations which should be parsed. + * @return The parsed string. + */ + public static String parseString(String str, EnumSet parseFlags) { + StringBuilder buffer = new StringBuilder(); + StringBuilder escapeBuffer = new StringBuilder(); + EscapeStatus escStatus = EscapeStatus.NONE; + + for (int i = 0; i < str.length(); i++) { + char c = str.charAt(i); + boolean consumeChar = true; + boolean isLastChar = i == str.length() - 1; + + if (escStatus == EscapeStatus.NONE) { + if (c == '\\') { + // Escaping begins. Reset the escape buffer. + escapeBuffer.setLength(0); + escapeBuffer.append(c); + escStatus = EscapeStatus.BEGIN; + } + } else if (escStatus == EscapeStatus.BEGIN) { + if (parseFlags.contains(ParseFlags.SPECIAL_CHARS) && isSpecialChar(c)) { + try { + buffer.appendCodePoint(parseSpecialChar(c)); + escStatus = EscapeStatus.VALID; + } catch (ParseException e) { + // This is just for completeness. We will actually never catch any ParseException here + // since we already checked the character with isSpecialChar() before. + escapeBuffer.append(c); + escStatus = EscapeStatus.INVALID; + } + } else if (parseFlags.contains(ParseFlags.OCTAL_NUMBERS) && c >= '0' && c <= '7') { + escStatus = EscapeStatus.OCTAL_NUMBER; + // Don't consume this character right now - as this wouldn't work if it's the last character. + consumeChar = false; + } else if (parseFlags.contains(ParseFlags.HEX_NUMBERS) && c == 'x') { + escStatus = EscapeStatus.HEX_NUMBER; + } else if (parseFlags.contains(ParseFlags.UNICODE_SHORT_NUMBERS) && c == 'u') { + escStatus = EscapeStatus.UNICODE_SHORT_NUMBER; + } else if (parseFlags.contains(ParseFlags.UNICODE_LONG_NUMBERS) && c == 'U') { + escStatus = EscapeStatus.UNICODE_LONG_NUMBER; + } else { + escStatus = EscapeStatus.INVALID; + } + if (consumeChar) { + escapeBuffer.append(c); + } + } else if (escStatus == EscapeStatus.HEX_NUMBER) { + // Only consume this character if it belongs to the escape sequence. + consumeChar = (c >= '0' && c <= '9') || (c >= 'a' && c <= 'f') || (c >= 'A' && c <= 'F'); + if (consumeChar) { + escapeBuffer.append(c); + } + + if (!consumeChar || isLastChar || escapeBuffer.length() == 6) { + // The escape sequence is terminated. Set the escape status to invalid until + // we know that it's actually valid. + escStatus = EscapeStatus.INVALID; + if (escapeBuffer.length() > 2) { + // Decode the hexadecimal number. + try { + int codePoint = Integer.parseInt(escapeBuffer.toString().substring(2), 16); + if (codePoint <= 0x10FFFF) { + buffer.appendCodePoint(codePoint); + escStatus = EscapeStatus.VALID; + } + } catch (NumberFormatException e) { + } + } + } + } else if (escStatus == EscapeStatus.UNICODE_SHORT_NUMBER || escStatus == EscapeStatus.UNICODE_LONG_NUMBER) { + // Only consume this character if it belongs to the escape sequence. + consumeChar = (c >= '0' && c <= '9') || (c >= 'a' && c <= 'f') || (c >= 'A' && c <= 'F'); + if (consumeChar) { + escapeBuffer.append(c); + } + + int finalLength = escStatus == EscapeStatus.UNICODE_SHORT_NUMBER ? 6 : 10; + if (escapeBuffer.length() == finalLength) { + // The escape sequence is terminated. Set the escape status to invalid until + // we know that it's actually valid. Decode the hexadecimal number. + escStatus = EscapeStatus.INVALID; + try { + int codePoint = Integer.parseInt(escapeBuffer.toString().substring(2), 16); + if (codePoint <= 0x10FFFF) { + buffer.appendCodePoint(codePoint); + escStatus = EscapeStatus.VALID; + } + } catch (NumberFormatException e) { + } + } else if (!consumeChar || isLastChar) { + // The escape sequence is terminated and invalid. + escStatus = EscapeStatus.INVALID; + } + } else if (escStatus == EscapeStatus.OCTAL_NUMBER) { + // Only consume this character if it belongs to the escape sequence. + consumeChar = c >= '0' && c <= '7'; + if (consumeChar) { + escapeBuffer.append(c); + } + + if (!consumeChar || isLastChar || escapeBuffer.length() == 4) { + // The escape sequence is terminated. Set the escape status to invalid until + // we know that it's actually valid. + escStatus = EscapeStatus.INVALID; + if (escapeBuffer.length() > 1) { + // Decode the octal number. + try { + int codePoint = Integer.parseInt(escapeBuffer.toString().substring(1), 8); + if (codePoint <= 0xFF) { + buffer.appendCodePoint(codePoint); + escStatus = EscapeStatus.VALID; + } + } catch (NumberFormatException e) { + } + } + } + } + + if (escStatus == EscapeStatus.NONE) { + // Current character isn't escaped - copy it over to the destination buffer. + buffer.append(c); + } else if (escStatus == EscapeStatus.VALID) { + escStatus = EscapeStatus.NONE; + } else if (escStatus == EscapeStatus.INVALID) { + buffer.append(escapeBuffer); + escStatus = EscapeStatus.NONE; + } + + if (!consumeChar) { + // Don't consume the current character. + i--; + } + } + + // Check for non-finished escape sequences at the end of the string. + if (escStatus != EscapeStatus.NONE) { + buffer.append(escapeBuffer); + } + + // Convert the buffer into a string and return it. + return buffer.toString(); + } + + /** + * Transcodes the given string. This is done as follows:

    + * 1) The given string is encoded into a binary byte buffer.

    + * 2) It's tested whether this binary byte buffer seems to represent a string which is encoded as + * either ASCII, Latin-1, or UTF-8. If this is the case, the binary byte buffer is decoded back into + * a string and this string is returned. If the test is negative, the given string is returned without + * modification because its encoding can't be reliably determined in this case. + * The most important use case of this function is to transcode a string which is actually UTF-8 but has + * been incorrectly decoded as Latin-1 instead. + * @param str The string to transcode. + * @return The transcoded string. + */ + public static String transcodeString(String str) { + // Try to transcode the string from Latin-1 to UTF-8 (ASCII doesn't need to be explicitly + // considered here since Latin-1 is backwards compatible with ASCII). The transcoding will + // almost certainly only succeed if the string actually *is* encoded in UTF-8. If the + // transcoding fails, the string is simply left unchanged. + try { + // First, try to encode the string as Latin-1 in order to obtain the binary byte + // representation of the string. + CharsetEncoder latin1Encoder = Charset.forName("ISO-8859-1").newEncoder(); //$NON-NLS-1$ + ByteBuffer stringBytes = latin1Encoder.encode(CharBuffer.wrap(str.toCharArray())); + + // Next, try to decode the string as UTF-8. This will almost certainly only succeed + // if the string actually *is* encoded in UTF-8. Note that if the decoding fails, + // an exception is thrown before the str variable is assigned. The original string + // is therefore left unchanged in this case. + CharsetDecoder utf8Decoder = Charset.forName("UTF-8").newDecoder(); //$NON-NLS-1$ + str = utf8Decoder.decode(stringBytes).toString(); + } catch (Exception e) { + } + + return str; + } + + /** + * Escapes any non-printable characters as well as the printable special characters single quotation + * mark, double quotation mark, backslash, and literal question mark within the given string. Supports + * the entire Unicode code space. + * @param str The string which should be escaped. + * @return The escaped string. + */ + public static String escapeString(String str) { + return escapeString(str, true); + } + + /** + * Escapes any non-printable characters within the given string. Supports the entire Unicode code space. + * @param str The string which should be escaped. + * @param escapePrintableSpecialChars Defines whether the printable special characters single + * quotation mark, double quotation mark, backslash, and literal question mark should be + * escaped as well, or not. + * @return The escaped string. + */ + public static String escapeString(String str, boolean escapePrintableSpecialChars) { + StringBuilder buffer = new StringBuilder(); + + for (int i = 0; i < str.length(); i++) { + // Get the current character code point. Note that using the Java "char" data type isn't + // sufficient here, as it can't handle all Unicode characters. + int codePoint = str.codePointAt(i); + if (Character.isSupplementaryCodePoint(codePoint)) { + i++; + } + + // Check the code point type of the character in order to determine whether it's + // printable or not. + int codePointType = Character.getType(codePoint); + switch (codePointType) { + case Character.LINE_SEPARATOR: + case Character.PARAGRAPH_SEPARATOR: + case Character.CONTROL: + case Character.PRIVATE_USE: + case Character.SURROGATE: + case Character.UNASSIGNED: + // Non-printable character. + if (isSpecialCodePoint(codePoint)) { + // Escape by using the special character escape notation. + buffer.append('\\'); + try { + buffer.append(parseSpecialCodePoint(codePoint)); + } catch (ParseException e) { + buffer.appendCodePoint(codePoint); + } + } else if (codePoint == 0x00) { + // Escape the null character separately - don't use leading zeros. + buffer.append("\\0"); //$NON-NLS-1$ + } else if (codePoint <= 0xFF) { + // Escape by using the octal escape notation. + buffer.append(String.format("\\%03o", codePoint)); //$NON-NLS-1$ + } else if (codePoint <= 0xFFFF) { + // Escape by using the short Unicode escape notation. + buffer.append(String.format("\\u%04x", codePoint)); //$NON-NLS-1$ + } else { + // Escape by using the long Unicode escape notation. + buffer.append(String.format("\\U%08x", codePoint)); //$NON-NLS-1$ + } + break; + default: + // Printable character. + if (escapePrintableSpecialChars && isSpecialCodePoint(codePoint)) { + // Escape by using the special character escape notation. + buffer.append('\\'); + try { + buffer.append(parseSpecialCodePoint(codePoint)); + } catch (ParseException e) { + buffer.appendCodePoint(codePoint); + } + } else { + // Don't escape. + buffer.appendCodePoint(codePoint); + } + } + } + + return buffer.toString(); + } +} diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/DisassemblyColumnSupport.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/DisassemblyColumnSupport.java index aee832fb070..baccd1edea5 100644 --- a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/DisassemblyColumnSupport.java +++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/DisassemblyColumnSupport.java @@ -1,206 +1,206 @@ -/******************************************************************************* - * Copyright (c) 2011, 2013 Wind River Systems, Inc. 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: - * Wind River Systems - initial API and implementation +/******************************************************************************* + * Copyright (c) 2011, 2013 Wind River Systems, Inc. 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: + * Wind River Systems - initial API and implementation *******************************************************************************/ -package org.eclipse.cdt.dsf.debug.internal.ui.disassembly; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -import org.eclipse.cdt.debug.ui.disassembly.rulers.IColumnSupport; -import org.eclipse.cdt.debug.ui.disassembly.rulers.IContributedRulerColumn; -import org.eclipse.cdt.debug.ui.disassembly.rulers.RulerColumnDescriptor; -import org.eclipse.cdt.debug.ui.disassembly.rulers.RulerColumnRegistry; -import org.eclipse.core.runtime.Assert; -import org.eclipse.core.runtime.SafeRunner; -import org.eclipse.jface.text.source.CompositeRuler; -import org.eclipse.jface.text.source.IVerticalRulerColumn; -import org.eclipse.jface.text.source.IVerticalRulerInfo; -import org.eclipse.jface.util.SafeRunnable; - -/** - * Implements the ruler column support of for the given disassembly part. - *

    - * This is currently only used to support vertical ruler columns. - *

    - */ -class DisassemblyColumnSupport implements IColumnSupport { - private final DisassemblyPart fDisassembly; - private final RulerColumnRegistry fRegistry; - private final List fColumns; - - /** - * Creates a new column support for the given disassembly part. Only the disassembly part itself should normally - * create such an instance. - * - * @param editor the disassembly part - * @param registry the contribution registry to refer to - */ - public DisassemblyColumnSupport(DisassemblyPart disassembly, RulerColumnRegistry registry) { - Assert.isLegal(disassembly != null); - Assert.isLegal(registry != null); - fDisassembly= disassembly; - fRegistry= registry; - fColumns= new ArrayList(); - } - - /* - * @see org.eclipse.ui.texteditor.IColumnSupport#setColumnVisible(java.lang.String, boolean) - */ - @Override - public final void setColumnVisible(RulerColumnDescriptor descriptor, boolean visible) { - Assert.isLegal(descriptor != null); - - final CompositeRuler ruler= getRuler(); - if (ruler == null) - return; - - if (!isColumnSupported(descriptor)) - visible= false; - - if (isColumnVisible(descriptor)) { - if (!visible) - removeColumn(ruler, descriptor); - } else { - if (visible) - addColumn(ruler, descriptor); - } - } - - private void addColumn(final CompositeRuler ruler, final RulerColumnDescriptor descriptor) { - - final int idx= computeIndex(ruler, descriptor); - - SafeRunnable runnable= new SafeRunnable() { - @Override - public void run() throws Exception { - IContributedRulerColumn column= descriptor.createColumn(fDisassembly); - fColumns.add(column); - initializeColumn(column); - ruler.addDecorator(idx, column); - } - }; - SafeRunner.run(runnable); - } - - /** - * Hook to let subclasses initialize a newly created column. - *

    - * Subclasses may extend this method.

    - * - * @param column the created column - */ - protected void initializeColumn(IContributedRulerColumn column) { - } - - private void removeColumn(final CompositeRuler ruler, final RulerColumnDescriptor descriptor) { - removeColumn(ruler, getVisibleColumn(ruler, descriptor)); - } - - private void removeColumn(final CompositeRuler ruler, final IContributedRulerColumn rulerColumn) { - if (rulerColumn != null) { - SafeRunnable runnable= new SafeRunnable() { - @Override - public void run() throws Exception { - if (ruler != null) - ruler.removeDecorator(rulerColumn); - rulerColumn.columnRemoved(); - } - }; - SafeRunner.run(runnable); - } - } - - /** - * Returns the currently visible column matching id, null if - * none. - * - * @param ruler the composite ruler to scan - * @param descriptor the descriptor of the column of interest - * @return the matching column or null - */ - private IContributedRulerColumn getVisibleColumn(CompositeRuler ruler, RulerColumnDescriptor descriptor) { - for (Iterator it= ruler.getDecoratorIterator(); it.hasNext();) { - IVerticalRulerColumn column= (IVerticalRulerColumn)it.next(); - if (column instanceof IContributedRulerColumn) { - IContributedRulerColumn rulerColumn= (IContributedRulerColumn)column; - RulerColumnDescriptor rcd= rulerColumn.getDescriptor(); - if (descriptor.equals(rcd)) - return rulerColumn; - } - } - return null; - } - - /** - * Computes the insertion index for a column contribution into the currently visible columns. - * - * @param ruler the composite ruler into which to insert the column - * @param descriptor the descriptor to compute the index for - * @return the insertion index for a new column - */ - private int computeIndex(CompositeRuler ruler, RulerColumnDescriptor descriptor) { - int index= 0; - List all= fRegistry.getColumnDescriptors(); - int newPos= all.indexOf(descriptor); - for (Iterator it= ruler.getDecoratorIterator(); it.hasNext();) { - IVerticalRulerColumn column= (IVerticalRulerColumn) it.next(); - if (column instanceof IContributedRulerColumn) { - RulerColumnDescriptor rcd= ((IContributedRulerColumn)column).getDescriptor(); - if (rcd != null && all.indexOf(rcd) > newPos) - break; - } - index++; - } - return index; - } - - @Override - public final boolean isColumnVisible(RulerColumnDescriptor descriptor) { - Assert.isLegal(descriptor != null); - CompositeRuler ruler= getRuler(); - return ruler != null && getVisibleColumn(ruler, descriptor) != null; - } - - @Override - public final boolean isColumnSupported(RulerColumnDescriptor descriptor) { - Assert.isLegal(descriptor != null); - if (getRuler() == null) - return false; - - return descriptor.matchesPart(fDisassembly); - } - - /** - * Returns the disassembly part's vertical ruler, if it is a {@link CompositeRuler}, null - * otherwise. - * - * @return the disassembly part's {@link CompositeRuler} or null - */ - private CompositeRuler getRuler() { - Object ruler= fDisassembly.getAdapter(IVerticalRulerInfo.class); - if (ruler instanceof CompositeRuler) - return (CompositeRuler) ruler; - return null; - } - - /** - * {@inheritDoc} - *

    - * Subclasses may extend this method.

    - * - */ - @Override - public void dispose() { - for (Iterator iter= new ArrayList(fColumns).iterator(); iter.hasNext();) - removeColumn(getRuler(), iter.next()); - fColumns.clear(); - } -} +package org.eclipse.cdt.dsf.debug.internal.ui.disassembly; + +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + +import org.eclipse.cdt.debug.ui.disassembly.rulers.IColumnSupport; +import org.eclipse.cdt.debug.ui.disassembly.rulers.IContributedRulerColumn; +import org.eclipse.cdt.debug.ui.disassembly.rulers.RulerColumnDescriptor; +import org.eclipse.cdt.debug.ui.disassembly.rulers.RulerColumnRegistry; +import org.eclipse.core.runtime.Assert; +import org.eclipse.core.runtime.SafeRunner; +import org.eclipse.jface.text.source.CompositeRuler; +import org.eclipse.jface.text.source.IVerticalRulerColumn; +import org.eclipse.jface.text.source.IVerticalRulerInfo; +import org.eclipse.jface.util.SafeRunnable; + +/** + * Implements the ruler column support of for the given disassembly part. + *

    + * This is currently only used to support vertical ruler columns. + *

    + */ +class DisassemblyColumnSupport implements IColumnSupport { + private final DisassemblyPart fDisassembly; + private final RulerColumnRegistry fRegistry; + private final List fColumns; + + /** + * Creates a new column support for the given disassembly part. Only the disassembly part itself should normally + * create such an instance. + * + * @param editor the disassembly part + * @param registry the contribution registry to refer to + */ + public DisassemblyColumnSupport(DisassemblyPart disassembly, RulerColumnRegistry registry) { + Assert.isLegal(disassembly != null); + Assert.isLegal(registry != null); + fDisassembly= disassembly; + fRegistry= registry; + fColumns= new ArrayList(); + } + + /* + * @see org.eclipse.ui.texteditor.IColumnSupport#setColumnVisible(java.lang.String, boolean) + */ + @Override + public final void setColumnVisible(RulerColumnDescriptor descriptor, boolean visible) { + Assert.isLegal(descriptor != null); + + final CompositeRuler ruler= getRuler(); + if (ruler == null) + return; + + if (!isColumnSupported(descriptor)) + visible= false; + + if (isColumnVisible(descriptor)) { + if (!visible) + removeColumn(ruler, descriptor); + } else { + if (visible) + addColumn(ruler, descriptor); + } + } + + private void addColumn(final CompositeRuler ruler, final RulerColumnDescriptor descriptor) { + + final int idx= computeIndex(ruler, descriptor); + + SafeRunnable runnable= new SafeRunnable() { + @Override + public void run() throws Exception { + IContributedRulerColumn column= descriptor.createColumn(fDisassembly); + fColumns.add(column); + initializeColumn(column); + ruler.addDecorator(idx, column); + } + }; + SafeRunner.run(runnable); + } + + /** + * Hook to let subclasses initialize a newly created column. + *

    + * Subclasses may extend this method.

    + * + * @param column the created column + */ + protected void initializeColumn(IContributedRulerColumn column) { + } + + private void removeColumn(final CompositeRuler ruler, final RulerColumnDescriptor descriptor) { + removeColumn(ruler, getVisibleColumn(ruler, descriptor)); + } + + private void removeColumn(final CompositeRuler ruler, final IContributedRulerColumn rulerColumn) { + if (rulerColumn != null) { + SafeRunnable runnable= new SafeRunnable() { + @Override + public void run() throws Exception { + if (ruler != null) + ruler.removeDecorator(rulerColumn); + rulerColumn.columnRemoved(); + } + }; + SafeRunner.run(runnable); + } + } + + /** + * Returns the currently visible column matching id, null if + * none. + * + * @param ruler the composite ruler to scan + * @param descriptor the descriptor of the column of interest + * @return the matching column or null + */ + private IContributedRulerColumn getVisibleColumn(CompositeRuler ruler, RulerColumnDescriptor descriptor) { + for (Iterator it= ruler.getDecoratorIterator(); it.hasNext();) { + IVerticalRulerColumn column= (IVerticalRulerColumn)it.next(); + if (column instanceof IContributedRulerColumn) { + IContributedRulerColumn rulerColumn= (IContributedRulerColumn)column; + RulerColumnDescriptor rcd= rulerColumn.getDescriptor(); + if (descriptor.equals(rcd)) + return rulerColumn; + } + } + return null; + } + + /** + * Computes the insertion index for a column contribution into the currently visible columns. + * + * @param ruler the composite ruler into which to insert the column + * @param descriptor the descriptor to compute the index for + * @return the insertion index for a new column + */ + private int computeIndex(CompositeRuler ruler, RulerColumnDescriptor descriptor) { + int index= 0; + List all= fRegistry.getColumnDescriptors(); + int newPos= all.indexOf(descriptor); + for (Iterator it= ruler.getDecoratorIterator(); it.hasNext();) { + IVerticalRulerColumn column= (IVerticalRulerColumn) it.next(); + if (column instanceof IContributedRulerColumn) { + RulerColumnDescriptor rcd= ((IContributedRulerColumn)column).getDescriptor(); + if (rcd != null && all.indexOf(rcd) > newPos) + break; + } + index++; + } + return index; + } + + @Override + public final boolean isColumnVisible(RulerColumnDescriptor descriptor) { + Assert.isLegal(descriptor != null); + CompositeRuler ruler= getRuler(); + return ruler != null && getVisibleColumn(ruler, descriptor) != null; + } + + @Override + public final boolean isColumnSupported(RulerColumnDescriptor descriptor) { + Assert.isLegal(descriptor != null); + if (getRuler() == null) + return false; + + return descriptor.matchesPart(fDisassembly); + } + + /** + * Returns the disassembly part's vertical ruler, if it is a {@link CompositeRuler}, null + * otherwise. + * + * @return the disassembly part's {@link CompositeRuler} or null + */ + private CompositeRuler getRuler() { + Object ruler= fDisassembly.getAdapter(IVerticalRulerInfo.class); + if (ruler instanceof CompositeRuler) + return (CompositeRuler) ruler; + return null; + } + + /** + * {@inheritDoc} + *

    + * Subclasses may extend this method.

    + * + */ + @Override + public void dispose() { + for (Iterator iter= new ArrayList(fColumns).iterator(); iter.hasNext();) + removeColumn(getRuler(), iter.next()); + fColumns.clear(); + } +} diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/OpcodeRulerColumn.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/OpcodeRulerColumn.java index 923bc1be350..60aef05e688 100644 --- a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/OpcodeRulerColumn.java +++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/OpcodeRulerColumn.java @@ -1,126 +1,126 @@ -/******************************************************************************* - * Copyright (c) 2011, 2014 Wind River 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: - * Wind River Systems - initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.dsf.debug.internal.ui.disassembly; - -import org.eclipse.cdt.debug.internal.ui.disassembly.dsf.AddressRangePosition; -import org.eclipse.cdt.debug.internal.ui.disassembly.dsf.DisassemblyPosition; -import org.eclipse.cdt.dsf.debug.internal.ui.disassembly.model.DisassemblyDocument; -import org.eclipse.cdt.dsf.debug.internal.ui.disassembly.preferences.DisassemblyPreferenceConstants; -import org.eclipse.cdt.dsf.debug.internal.ui.disassembly.provisional.DisassemblyRulerColumn; -import org.eclipse.jface.preference.IPreferenceStore; -import org.eclipse.jface.text.BadLocationException; -import org.eclipse.jface.util.PropertyChangeEvent; - -/** - * A vertical ruler column to display the opcodes of instructions. - */ -public class OpcodeRulerColumn extends DisassemblyRulerColumn { - - public static final String ID = "org.eclipse.cdt.dsf.ui.disassemblyColumn.opcode"; //$NON-NLS-1$ - - /** Maximum width of column (in characters) */ - private static final int MAXWIDTH= 20; - - private int fRadix; - private String fRadixPrefix; - - /** - * Default constructor. - */ - public OpcodeRulerColumn() { - super(); - setForeground(getColor(DisassemblyPreferenceConstants.CODE_BYTES_COLOR)); - setRadix(getPreferenceStore().getInt(DisassemblyPreferenceConstants.OPCODE_RADIX)); - } - - public void setRadix(int radix) { - fRadix= radix; - setShowRadixPrefix(); - } - - public void setShowRadixPrefix() { - if (fRadix == 16) { - fRadixPrefix = "0x"; //$NON-NLS-1$ - } else if (fRadix == 8) { - fRadixPrefix = "0"; //$NON-NLS-1$ - } else { - fRadixPrefix = null; - } - } - - /* - * @see org.eclipse.jface.text.source.LineNumberRulerColumn#createDisplayString(int) - */ - @Override - protected String createDisplayString(int line) { - int nChars = computeNumberOfCharacters(); - if (nChars > 0) { - DisassemblyDocument doc = (DisassemblyDocument)getParentRuler().getTextViewer().getDocument(); - try { - int offset = doc.getLineOffset(line); - AddressRangePosition pos = doc.getDisassemblyPosition(offset); - if (pos instanceof DisassemblyPosition && pos.length > 0 && pos.offset == offset && pos.fValid) { - DisassemblyPosition disassPos = (DisassemblyPosition)pos; - if (disassPos.fOpcodes != null) { - // Format the output. - String str = disassPos.fOpcodes.toString(fRadix); - int prefixLength = 0; - - if (fRadixPrefix != null) - prefixLength = fRadixPrefix.length(); - - StringBuilder buf = new StringBuilder(nChars); - - if (prefixLength != 0) - buf.append(fRadixPrefix); - - for (int i=str.length()+prefixLength; i < nChars; ++i) - buf.append('0'); - buf.append(str); - if (buf.length() > nChars) - buf.delete(nChars, buf.length()); - return buf.toString(); - } - } else if (pos != null && !pos.fValid) { - return DOTS.substring(0, nChars); - } - } catch (BadLocationException e) { - // silently ignored - } - } - return ""; //$NON-NLS-1$ - } - - @Override - protected int computeNumberOfCharacters() { - DisassemblyDocument doc = (DisassemblyDocument)getParentRuler().getTextViewer().getDocument(); - return Math.min(MAXWIDTH, doc.getMaxOpcodeLength(fRadix)); - } - - @Override - public void propertyChange(PropertyChangeEvent event) { - String property = event.getProperty(); - IPreferenceStore store = getPreferenceStore(); - boolean needRedraw = false; - if (DisassemblyPreferenceConstants.CODE_BYTES_COLOR.equals(property)) { - setForeground(getColor(property)); - needRedraw = true; - } else if (DisassemblyPreferenceConstants.OPCODE_RADIX.equals(property)) { - setRadix(store.getInt(property)); - layout(false); - needRedraw = true; - } - if (needRedraw) { - redraw(); - } - } - -} +/******************************************************************************* + * Copyright (c) 2011, 2014 Wind River 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: + * Wind River Systems - initial API and implementation + *******************************************************************************/ +package org.eclipse.cdt.dsf.debug.internal.ui.disassembly; + +import org.eclipse.cdt.debug.internal.ui.disassembly.dsf.AddressRangePosition; +import org.eclipse.cdt.debug.internal.ui.disassembly.dsf.DisassemblyPosition; +import org.eclipse.cdt.dsf.debug.internal.ui.disassembly.model.DisassemblyDocument; +import org.eclipse.cdt.dsf.debug.internal.ui.disassembly.preferences.DisassemblyPreferenceConstants; +import org.eclipse.cdt.dsf.debug.internal.ui.disassembly.provisional.DisassemblyRulerColumn; +import org.eclipse.jface.preference.IPreferenceStore; +import org.eclipse.jface.text.BadLocationException; +import org.eclipse.jface.util.PropertyChangeEvent; + +/** + * A vertical ruler column to display the opcodes of instructions. + */ +public class OpcodeRulerColumn extends DisassemblyRulerColumn { + + public static final String ID = "org.eclipse.cdt.dsf.ui.disassemblyColumn.opcode"; //$NON-NLS-1$ + + /** Maximum width of column (in characters) */ + private static final int MAXWIDTH= 20; + + private int fRadix; + private String fRadixPrefix; + + /** + * Default constructor. + */ + public OpcodeRulerColumn() { + super(); + setForeground(getColor(DisassemblyPreferenceConstants.CODE_BYTES_COLOR)); + setRadix(getPreferenceStore().getInt(DisassemblyPreferenceConstants.OPCODE_RADIX)); + } + + public void setRadix(int radix) { + fRadix= radix; + setShowRadixPrefix(); + } + + public void setShowRadixPrefix() { + if (fRadix == 16) { + fRadixPrefix = "0x"; //$NON-NLS-1$ + } else if (fRadix == 8) { + fRadixPrefix = "0"; //$NON-NLS-1$ + } else { + fRadixPrefix = null; + } + } + + /* + * @see org.eclipse.jface.text.source.LineNumberRulerColumn#createDisplayString(int) + */ + @Override + protected String createDisplayString(int line) { + int nChars = computeNumberOfCharacters(); + if (nChars > 0) { + DisassemblyDocument doc = (DisassemblyDocument)getParentRuler().getTextViewer().getDocument(); + try { + int offset = doc.getLineOffset(line); + AddressRangePosition pos = doc.getDisassemblyPosition(offset); + if (pos instanceof DisassemblyPosition && pos.length > 0 && pos.offset == offset && pos.fValid) { + DisassemblyPosition disassPos = (DisassemblyPosition)pos; + if (disassPos.fOpcodes != null) { + // Format the output. + String str = disassPos.fOpcodes.toString(fRadix); + int prefixLength = 0; + + if (fRadixPrefix != null) + prefixLength = fRadixPrefix.length(); + + StringBuilder buf = new StringBuilder(nChars); + + if (prefixLength != 0) + buf.append(fRadixPrefix); + + for (int i=str.length()+prefixLength; i < nChars; ++i) + buf.append('0'); + buf.append(str); + if (buf.length() > nChars) + buf.delete(nChars, buf.length()); + return buf.toString(); + } + } else if (pos != null && !pos.fValid) { + return DOTS.substring(0, nChars); + } + } catch (BadLocationException e) { + // silently ignored + } + } + return ""; //$NON-NLS-1$ + } + + @Override + protected int computeNumberOfCharacters() { + DisassemblyDocument doc = (DisassemblyDocument)getParentRuler().getTextViewer().getDocument(); + return Math.min(MAXWIDTH, doc.getMaxOpcodeLength(fRadix)); + } + + @Override + public void propertyChange(PropertyChangeEvent event) { + String property = event.getProperty(); + IPreferenceStore store = getPreferenceStore(); + boolean needRedraw = false; + if (DisassemblyPreferenceConstants.CODE_BYTES_COLOR.equals(property)) { + setForeground(getColor(property)); + needRedraw = true; + } else if (DisassemblyPreferenceConstants.OPCODE_RADIX.equals(property)) { + setRadix(store.getInt(property)); + layout(false); + needRedraw = true; + } + if (needRedraw) { + redraw(); + } + } + +} diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/provisional/DisassemblyAnnotationModel.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/provisional/DisassemblyAnnotationModel.java index 89848d1c955..bcf08590494 100644 --- a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/provisional/DisassemblyAnnotationModel.java +++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/provisional/DisassemblyAnnotationModel.java @@ -1,90 +1,90 @@ -/******************************************************************************* - * Copyright (c) 2011, 2015 Wind River Systems, Inc. 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: - * Wind River Systems - initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.dsf.debug.internal.ui.disassembly.provisional; - -import java.math.BigInteger; - -import org.eclipse.cdt.debug.internal.ui.disassembly.dsf.AddressRangePosition; -import org.eclipse.cdt.debug.internal.ui.disassembly.dsf.LabelPosition; -import org.eclipse.cdt.dsf.debug.internal.ui.disassembly.model.DisassemblyDocument; -import org.eclipse.core.resources.IFile; -import org.eclipse.jface.text.BadPositionCategoryException; -import org.eclipse.jface.text.Position; -import org.eclipse.jface.text.source.AnnotationModel; - -public class DisassemblyAnnotationModel extends AnnotationModel { - - public DisassemblyAnnotationModel() { - super(); - } - - private DisassemblyDocument getDisassemblyDocument() { - return (DisassemblyDocument) fDocument; - } - - protected Position createPositionFromSourceLine(String fileName, int lineNumber) { - if (fileName != null) { - return getDisassemblyDocument().getSourcePosition(fileName, lineNumber); - } - return null; - } - - protected Position createPositionFromSourceLine(IFile file, int lineNumber) { - if (file != null) { - return getDisassemblyDocument().getSourcePosition(file, lineNumber); - } - return null; - } - - protected Position createPositionFromAddress(BigInteger address) { - if (address != null) { - AddressRangePosition p= getDisassemblyDocument().getDisassemblyPosition(address); - if (p != null && p.fValid) { - return new Position(p.offset, p.length); - } - } - return null; - } - - protected Position createPositionFromLabel(BigInteger address) { - if (address != null) { - LabelPosition p = getDisassemblyDocument().getLabelPosition(address); - if (p != null && p.fValid) { - return new Position(p.offset, p.length); - } - } - return null; - } - - protected Position createPositionFromLabel(String label) { - if (label != null) { - try { - Position[] labelPositions = getDisassemblyDocument().getPositions(DisassemblyDocument.CATEGORY_LABELS); - int labelLen = label.length(); - for (Position position : labelPositions) { - if (position instanceof LabelPosition) { - String candidate = ((LabelPosition) position).fLabel; - if (candidate != null && candidate.startsWith(label)) { - // exact match or followed by () - if (candidate.length() == labelLen || candidate.charAt(labelLen) == '(') { - return new Position(position.offset, position.length); - } - } - } - } - } catch (BadPositionCategoryException exc) { - return null; - } - } - return null; - } - +/******************************************************************************* + * Copyright (c) 2011, 2015 Wind River Systems, Inc. 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: + * Wind River Systems - initial API and implementation + *******************************************************************************/ +package org.eclipse.cdt.dsf.debug.internal.ui.disassembly.provisional; + +import java.math.BigInteger; + +import org.eclipse.cdt.debug.internal.ui.disassembly.dsf.AddressRangePosition; +import org.eclipse.cdt.debug.internal.ui.disassembly.dsf.LabelPosition; +import org.eclipse.cdt.dsf.debug.internal.ui.disassembly.model.DisassemblyDocument; +import org.eclipse.core.resources.IFile; +import org.eclipse.jface.text.BadPositionCategoryException; +import org.eclipse.jface.text.Position; +import org.eclipse.jface.text.source.AnnotationModel; + +public class DisassemblyAnnotationModel extends AnnotationModel { + + public DisassemblyAnnotationModel() { + super(); + } + + private DisassemblyDocument getDisassemblyDocument() { + return (DisassemblyDocument) fDocument; + } + + protected Position createPositionFromSourceLine(String fileName, int lineNumber) { + if (fileName != null) { + return getDisassemblyDocument().getSourcePosition(fileName, lineNumber); + } + return null; + } + + protected Position createPositionFromSourceLine(IFile file, int lineNumber) { + if (file != null) { + return getDisassemblyDocument().getSourcePosition(file, lineNumber); + } + return null; + } + + protected Position createPositionFromAddress(BigInteger address) { + if (address != null) { + AddressRangePosition p= getDisassemblyDocument().getDisassemblyPosition(address); + if (p != null && p.fValid) { + return new Position(p.offset, p.length); + } + } + return null; + } + + protected Position createPositionFromLabel(BigInteger address) { + if (address != null) { + LabelPosition p = getDisassemblyDocument().getLabelPosition(address); + if (p != null && p.fValid) { + return new Position(p.offset, p.length); + } + } + return null; + } + + protected Position createPositionFromLabel(String label) { + if (label != null) { + try { + Position[] labelPositions = getDisassemblyDocument().getPositions(DisassemblyDocument.CATEGORY_LABELS); + int labelLen = label.length(); + for (Position position : labelPositions) { + if (position instanceof LabelPosition) { + String candidate = ((LabelPosition) position).fLabel; + if (candidate != null && candidate.startsWith(label)) { + // exact match or followed by () + if (candidate.length() == labelLen || candidate.charAt(labelLen) == '(') { + return new Position(position.offset, position.length); + } + } + } + } + } catch (BadPositionCategoryException exc) { + return null; + } + } + return null; + } + } \ No newline at end of file diff --git a/dsf/org.eclipse.cdt.examples.dsf/src/org/eclipse/cdt/examples/dsf/.gitignore b/dsf/org.eclipse.cdt.examples.dsf/src/org/eclipse/cdt/examples/dsf/.gitignore index ed1d9f9bb09..2bcdbc9ae83 100644 --- a/dsf/org.eclipse.cdt.examples.dsf/src/org/eclipse/cdt/examples/dsf/.gitignore +++ b/dsf/org.eclipse.cdt.examples.dsf/src/org/eclipse/cdt/examples/dsf/.gitignore @@ -1,2 +1,2 @@ -dataviewer -requestmonitor +dataviewer +requestmonitor diff --git a/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/internal/corebuild/GenericLaunchConfigTabGroup.java b/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/internal/corebuild/GenericLaunchConfigTabGroup.java index 7f6ce2376c4..7880e674004 100644 --- a/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/internal/corebuild/GenericLaunchConfigTabGroup.java +++ b/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/internal/corebuild/GenericLaunchConfigTabGroup.java @@ -1,28 +1,28 @@ -/******************************************************************************* - * 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.launch.internal.corebuild; - -import org.eclipse.cdt.launch.ui.corebuild.GenericMainTab; -import org.eclipse.debug.ui.AbstractLaunchConfigurationTabGroup; -import org.eclipse.debug.ui.CommonTab; -import org.eclipse.debug.ui.EnvironmentTab; -import org.eclipse.debug.ui.ILaunchConfigurationDialog; -import org.eclipse.debug.ui.ILaunchConfigurationTab; - -public class GenericLaunchConfigTabGroup extends AbstractLaunchConfigurationTabGroup { - - @Override - public void createTabs(ILaunchConfigurationDialog dialog, String mode) { - setTabs(new ILaunchConfigurationTab[] { - new GenericMainTab(), - new EnvironmentTab(), - new CommonTab() - }); - } - -} +/******************************************************************************* + * 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.launch.internal.corebuild; + +import org.eclipse.cdt.launch.ui.corebuild.GenericMainTab; +import org.eclipse.debug.ui.AbstractLaunchConfigurationTabGroup; +import org.eclipse.debug.ui.CommonTab; +import org.eclipse.debug.ui.EnvironmentTab; +import org.eclipse.debug.ui.ILaunchConfigurationDialog; +import org.eclipse.debug.ui.ILaunchConfigurationTab; + +public class GenericLaunchConfigTabGroup extends AbstractLaunchConfigurationTabGroup { + + @Override + public void createTabs(ILaunchConfigurationDialog dialog, String mode) { + setTabs(new ILaunchConfigurationTab[] { + new GenericMainTab(), + new EnvironmentTab(), + new CommonTab() + }); + } + +} diff --git a/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/internal/ui/Messages.java b/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/internal/ui/Messages.java index d24424c3b25..7ea6a40efad 100644 --- a/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/internal/ui/Messages.java +++ b/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/internal/ui/Messages.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.launch.internal.ui; - -import org.eclipse.osgi.util.NLS; - -public class Messages extends NLS { - private static final String BUNDLE_NAME = "org.eclipse.cdt.launch.internal.ui.messages"; //$NON-NLS-1$ - public static String GenericMainTab_Arguments; - public static String GenericMainTab_BrowseFileSystem; - public static String GenericMainTab_BrowseWorkspace; - public static String GenericMainTab_Location; - public static String GenericMainTab_LocationNotAFile; - public static String GenericMainTab_LocationNotExists; - public static String GenericMainTab_Main; - public static String GenericMainTab_Quotes; - public static String GenericMainTab_SelectResource; - public static String GenericMainTab_SelectWorkingDir; - public static String GenericMainTab_SpecifyLocation; - public static String GenericMainTab_Variables; - public static String GenericMainTab_WorkingDirectory; - public static String GenericMainTab_WorkingDirNotADir; - public static String GenericMainTab_WorkingDirNotExists; - 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.launch.internal.ui; + +import org.eclipse.osgi.util.NLS; + +public class Messages extends NLS { + private static final String BUNDLE_NAME = "org.eclipse.cdt.launch.internal.ui.messages"; //$NON-NLS-1$ + public static String GenericMainTab_Arguments; + public static String GenericMainTab_BrowseFileSystem; + public static String GenericMainTab_BrowseWorkspace; + public static String GenericMainTab_Location; + public static String GenericMainTab_LocationNotAFile; + public static String GenericMainTab_LocationNotExists; + public static String GenericMainTab_Main; + public static String GenericMainTab_Quotes; + public static String GenericMainTab_SelectResource; + public static String GenericMainTab_SelectWorkingDir; + public static String GenericMainTab_SpecifyLocation; + public static String GenericMainTab_Variables; + public static String GenericMainTab_WorkingDirectory; + public static String GenericMainTab_WorkingDirNotADir; + public static String GenericMainTab_WorkingDirNotExists; + static { + // initialize resource bundle + NLS.initializeMessages(BUNDLE_NAME, Messages.class); + } + + private Messages() { + } +} diff --git a/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/internal/ui/messages.properties b/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/internal/ui/messages.properties index 31e814f228e..0deb8c421b3 100644 --- a/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/internal/ui/messages.properties +++ b/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/internal/ui/messages.properties @@ -1,22 +1,22 @@ -############################################################################### -# Copyright (c) 2002, 2015 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 -############################################################################### -GenericMainTab_Arguments=Arguments: -GenericMainTab_BrowseFileSystem=Browse File System... -GenericMainTab_BrowseWorkspace=Browse Workspace... -GenericMainTab_Location=Location -GenericMainTab_LocationNotAFile=External tool location specified is not a file -GenericMainTab_LocationNotExists=External tool location does not exist -GenericMainTab_Main=Main -GenericMainTab_Quotes=Note: Enclose an argument containing spaces using double-quotes (\\"). -GenericMainTab_SelectResource=Select a resource: -GenericMainTab_SelectWorkingDir=Select a working directory: -GenericMainTab_SpecifyLocation=Please specify the location of the external tool you would like to configure. -GenericMainTab_Variables=Variables... -GenericMainTab_WorkingDirectory=Working Directory: -GenericMainTab_WorkingDirNotADir=The specified location is not a directory -GenericMainTab_WorkingDirNotExists=External tool working directory does not exist or is invalid +############################################################################### +# Copyright (c) 2002, 2015 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 +############################################################################### +GenericMainTab_Arguments=Arguments: +GenericMainTab_BrowseFileSystem=Browse File System... +GenericMainTab_BrowseWorkspace=Browse Workspace... +GenericMainTab_Location=Location +GenericMainTab_LocationNotAFile=External tool location specified is not a file +GenericMainTab_LocationNotExists=External tool location does not exist +GenericMainTab_Main=Main +GenericMainTab_Quotes=Note: Enclose an argument containing spaces using double-quotes (\\"). +GenericMainTab_SelectResource=Select a resource: +GenericMainTab_SelectWorkingDir=Select a working directory: +GenericMainTab_SpecifyLocation=Please specify the location of the external tool you would like to configure. +GenericMainTab_Variables=Variables... +GenericMainTab_WorkingDirectory=Working Directory: +GenericMainTab_WorkingDirNotADir=The specified location is not a directory +GenericMainTab_WorkingDirNotExists=External tool working directory does not exist or is invalid diff --git a/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/ui/corebuild/GenericMainTab.java b/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/ui/corebuild/GenericMainTab.java index 45f93ca97bd..2cec528b67e 100644 --- a/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/ui/corebuild/GenericMainTab.java +++ b/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/ui/corebuild/GenericMainTab.java @@ -1,715 +1,715 @@ -/******************************************************************************* - * Copyright (c) 2000, 2017 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 - * - * copied from: - * org.eclipse.ui.externaltools.internal.launchConfigurations.GenericMainTab - *******************************************************************************/ -package org.eclipse.cdt.launch.ui.corebuild; - -import java.io.File; - -import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants; -import org.eclipse.cdt.launch.internal.ui.LaunchImages; -import org.eclipse.cdt.launch.internal.ui.LaunchUIPlugin; -import org.eclipse.cdt.launch.internal.ui.Messages; -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.variables.IStringVariableManager; -import org.eclipse.core.variables.VariablesPlugin; -import org.eclipse.debug.core.ILaunchConfiguration; -import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; -import org.eclipse.debug.ui.AbstractLaunchConfigurationTab; -import org.eclipse.debug.ui.StringVariableSelectionDialog; -import org.eclipse.jface.dialogs.Dialog; -import org.eclipse.jface.dialogs.IDialogConstants; -import org.eclipse.swt.SWT; -import org.eclipse.swt.accessibility.AccessibleAdapter; -import org.eclipse.swt.accessibility.AccessibleEvent; -import org.eclipse.swt.events.ModifyEvent; -import org.eclipse.swt.events.ModifyListener; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.events.TraverseEvent; -import org.eclipse.swt.events.TraverseListener; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.DirectoryDialog; -import org.eclipse.swt.widgets.FileDialog; -import org.eclipse.swt.widgets.Group; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Text; -import org.eclipse.ui.dialogs.ContainerSelectionDialog; -import org.eclipse.ui.dialogs.ResourceSelectionDialog; - -/** - * @since 9.2 - */ -public class GenericMainTab extends AbstractLaunchConfigurationTab { - - public final static String FIRST_EDIT = "editedByExternalToolsMainTab"; //$NON-NLS-1$ - - protected Text locationField; - protected Text workDirectoryField; - protected Button fileLocationButton; - protected Button workspaceLocationButton; - protected Button variablesLocationButton; - protected Button fileWorkingDirectoryButton; - protected Button workspaceWorkingDirectoryButton; - protected Button variablesWorkingDirectoryButton; - - protected Text argumentField; - protected Button argumentVariablesButton; - - protected SelectionAdapter selectionAdapter; - - protected boolean fInitializing = false; - private boolean userEdited = false; - - protected WidgetListener fListener = new WidgetListener(); - - /** - * A listener to update for text modification and widget selection. - */ - protected class WidgetListener extends SelectionAdapter implements ModifyListener { - @Override - public void modifyText(ModifyEvent e) { - if (!fInitializing) { - setDirty(true); - userEdited = true; - updateLaunchConfigurationDialog(); - } - } - - @Override - public void widgetSelected(SelectionEvent e) { - setDirty(true); - Object source = e.getSource(); - if (source == workspaceLocationButton) { - handleWorkspaceLocationButtonSelected(); - } else if (source == fileLocationButton) { - handleFileLocationButtonSelected(); - } else if (source == workspaceWorkingDirectoryButton) { - handleWorkspaceWorkingDirectoryButtonSelected(); - } else if (source == fileWorkingDirectoryButton) { - handleFileWorkingDirectoryButtonSelected(); - } else if (source == argumentVariablesButton) { - handleVariablesButtonSelected(argumentField); - } else if (source == variablesLocationButton) { - handleVariablesButtonSelected(locationField); - } else if (source == variablesWorkingDirectoryButton) { - handleVariablesButtonSelected(workDirectoryField); - } - } - - } - - /* - * (non-Javadoc) - * - * @see - * org.eclipse.debug.ui.ILaunchConfigurationTab#createControl(org.eclipse.swt. - * widgets.Composite) - */ - @Override - public void createControl(Composite parent) { - Composite mainComposite = new Composite(parent, SWT.NONE); - setControl(mainComposite); - mainComposite.setFont(parent.getFont()); - GridLayout layout = new GridLayout(); - layout.numColumns = 1; - GridData gridData = new GridData(GridData.FILL_HORIZONTAL); - mainComposite.setLayout(layout); - mainComposite.setLayoutData(gridData); - - createLocationComponent(mainComposite); - createWorkDirectoryComponent(mainComposite); - createArgumentComponent(mainComposite); - createVerticalSpacer(mainComposite, 1); - - Dialog.applyDialogFont(parent); - } - - /** - * Creates the controls needed to edit the location attribute of an external - * tool - * - * @param parent - * the composite to create the controls in - */ - protected void createLocationComponent(Composite parent) { - Group group = new Group(parent, SWT.NONE); - String locationLabel = getLocationLabel(); - group.setText(locationLabel); - GridLayout layout = new GridLayout(); - layout.numColumns = 1; - GridData gridData = new GridData(GridData.FILL_HORIZONTAL); - group.setLayout(layout); - group.setLayoutData(gridData); - - locationField = new Text(group, SWT.BORDER); - gridData = new GridData(GridData.FILL_HORIZONTAL); - gridData.widthHint = IDialogConstants.ENTRY_FIELD_WIDTH; - locationField.setLayoutData(gridData); - locationField.addModifyListener(fListener); - addControlAccessibleListener(locationField, group.getText()); - - Composite buttonComposite = new Composite(group, SWT.NONE); - layout = new GridLayout(); - layout.marginHeight = 0; - layout.marginWidth = 0; - layout.numColumns = 3; - gridData = new GridData(GridData.HORIZONTAL_ALIGN_END); - buttonComposite.setLayout(layout); - buttonComposite.setLayoutData(gridData); - buttonComposite.setFont(parent.getFont()); - - workspaceLocationButton = createPushButton(buttonComposite, Messages.GenericMainTab_BrowseWorkspace, null); - workspaceLocationButton.addSelectionListener(fListener); - addControlAccessibleListener(workspaceLocationButton, - group.getText() + " " + workspaceLocationButton.getText()); //$NON-NLS-1$ - - fileLocationButton = createPushButton(buttonComposite, Messages.GenericMainTab_BrowseFileSystem, null); - fileLocationButton.addSelectionListener(fListener); - addControlAccessibleListener(fileLocationButton, group.getText() + " " + fileLocationButton.getText()); //$NON-NLS-1$ - - variablesLocationButton = createPushButton(buttonComposite, Messages.GenericMainTab_Variables, null); - variablesLocationButton.addSelectionListener(fListener); - addControlAccessibleListener(variablesLocationButton, - group.getText() + " " + variablesLocationButton.getText()); //$NON-NLS-1$ - } - - /** - * Returns the label used for the location widgets. Subclasses may wish to - * override. - */ - protected String getLocationLabel() { - return Messages.GenericMainTab_Location; - } - - /** - * Creates the controls needed to edit the working directory attribute of an - * external tool - * - * @param parent - * the composite to create the controls in - */ - protected void createWorkDirectoryComponent(Composite parent) { - Group group = new Group(parent, SWT.NONE); - String groupName = getWorkingDirectoryLabel(); - group.setText(groupName); - GridLayout layout = new GridLayout(); - layout.numColumns = 1; - GridData gridData = new GridData(GridData.FILL_HORIZONTAL); - group.setLayout(layout); - group.setLayoutData(gridData); - - workDirectoryField = new Text(group, SWT.BORDER); - GridData data = new GridData(GridData.FILL_HORIZONTAL); - data.widthHint = IDialogConstants.ENTRY_FIELD_WIDTH; - workDirectoryField.setLayoutData(data); - workDirectoryField.addModifyListener(fListener); - addControlAccessibleListener(workDirectoryField, group.getText()); - - Composite buttonComposite = new Composite(group, SWT.NONE); - layout = new GridLayout(); - layout.marginWidth = 0; - layout.marginHeight = 0; - layout.numColumns = 3; - gridData = new GridData(GridData.HORIZONTAL_ALIGN_END); - buttonComposite.setLayout(layout); - buttonComposite.setLayoutData(gridData); - buttonComposite.setFont(parent.getFont()); - - workspaceWorkingDirectoryButton = createPushButton(buttonComposite, Messages.GenericMainTab_BrowseWorkspace, null); - workspaceWorkingDirectoryButton.addSelectionListener(fListener); - addControlAccessibleListener(workspaceWorkingDirectoryButton, - group.getText() + " " + workspaceWorkingDirectoryButton.getText()); //$NON-NLS-1$ - - fileWorkingDirectoryButton = createPushButton(buttonComposite, Messages.GenericMainTab_BrowseFileSystem, null); - fileWorkingDirectoryButton.addSelectionListener(fListener); - addControlAccessibleListener(fileWorkingDirectoryButton, group.getText() + " " + fileLocationButton.getText()); //$NON-NLS-1$ - - variablesWorkingDirectoryButton = createPushButton(buttonComposite, Messages.GenericMainTab_Variables, null); - variablesWorkingDirectoryButton.addSelectionListener(fListener); - addControlAccessibleListener(variablesWorkingDirectoryButton, - group.getText() + " " + variablesWorkingDirectoryButton.getText()); //$NON-NLS-1$ - } - - /** - * Return the String to use as the label for the working directory field. - * Subclasses may wish to override. - */ - protected String getWorkingDirectoryLabel() { - return Messages.GenericMainTab_WorkingDirectory; - } - - /** - * Creates the controls needed to edit the argument and prompt for argument - * attributes of an external tool - * - * @param parent - * the composite to create the controls in - */ - protected void createArgumentComponent(Composite parent) { - Group group = new Group(parent, SWT.NONE); - String groupName = Messages.GenericMainTab_Arguments; - group.setText(groupName); - GridLayout layout = new GridLayout(); - layout.numColumns = 1; - GridData gridData = new GridData(GridData.FILL_BOTH); - group.setLayout(layout); - group.setLayoutData(gridData); - group.setFont(parent.getFont()); - - argumentField = new Text(group, SWT.MULTI | SWT.WRAP | SWT.BORDER | SWT.V_SCROLL); - argumentField.addTraverseListener(new TraverseListener() { - @Override - public void keyTraversed(TraverseEvent event) { - if (event.detail == SWT.TRAVERSE_RETURN && (event.stateMask & SWT.MODIFIER_MASK) != 0) { - event.doit = true; - } - } - }); - - gridData = new GridData(GridData.FILL_BOTH); - gridData.widthHint = IDialogConstants.ENTRY_FIELD_WIDTH; - gridData.heightHint = 30; - argumentField.setLayoutData(gridData); - argumentField.addModifyListener(fListener); - addControlAccessibleListener(argumentField, group.getText()); - - Composite composite = new Composite(group, SWT.NONE); - layout = new GridLayout(); - layout.numColumns = 1; - layout.marginHeight = 0; - layout.marginWidth = 0; - gridData = new GridData(GridData.HORIZONTAL_ALIGN_END); - composite.setLayout(layout); - composite.setLayoutData(gridData); - composite.setFont(parent.getFont()); - - argumentVariablesButton = createPushButton(composite, Messages.GenericMainTab_Variables, null); - argumentVariablesButton.addSelectionListener(fListener); - addControlAccessibleListener(argumentVariablesButton, argumentVariablesButton.getText()); // need to strip the - // mnemonic from - // buttons - - Label instruction = new Label(group, SWT.NONE); - instruction.setText(Messages.GenericMainTab_Quotes); - gridData = new GridData(GridData.HORIZONTAL_ALIGN_FILL); - gridData.horizontalSpan = 2; - instruction.setLayoutData(gridData); - } - - /* - * (non-Javadoc) - * - * @see - * org.eclipse.debug.ui.ILaunchConfigurationTab#setDefaults(org.eclipse.debug. - * core.ILaunchConfigurationWorkingCopy) - */ - @Override - public void setDefaults(ILaunchConfigurationWorkingCopy configuration) { - configuration.setAttribute(FIRST_EDIT, true); - } - - /* - * (non-Javadoc) - * - * @see - * org.eclipse.debug.ui.ILaunchConfigurationTab#initializeFrom(org.eclipse.debug - * .core.ILaunchConfiguration) - */ - @Override - public void initializeFrom(ILaunchConfiguration configuration) { - fInitializing = true; - updateLocation(configuration); - updateWorkingDirectory(configuration); - updateArgument(configuration); - fInitializing = false; - setDirty(false); - } - - /** - * Updates the working directory widgets to match the state of the given launch - * configuration. - */ - protected void updateWorkingDirectory(ILaunchConfiguration configuration) { - String workingDir = ""; //$NON-NLS-1$ - try { - workingDir = configuration.getAttribute(ICDTLaunchConfigurationConstants.ATTR_WORKING_DIRECTORY, ""); //$NON-NLS-1$ - } catch (CoreException ce) { - LaunchUIPlugin.log(ce.getStatus()); - } - workDirectoryField.setText(workingDir); - } - - /** - * Updates the location widgets to match the state of the given launch - * configuration. - */ - protected void updateLocation(ILaunchConfiguration configuration) { - String location = ""; //$NON-NLS-1$ - try { - location = configuration.getAttribute(ICDTLaunchConfigurationConstants.ATTR_LOCATION, ""); //$NON-NLS-1$ - } catch (CoreException ce) { - LaunchUIPlugin.log(ce.getStatus()); - } - locationField.setText(location); - } - - /** - * Updates the argument widgets to match the state of the given launch - * configuration. - */ - protected void updateArgument(ILaunchConfiguration configuration) { - String arguments = ""; //$NON-NLS-1$ - try { - arguments = configuration.getAttribute(ICDTLaunchConfigurationConstants.ATTR_TOOL_ARGUMENTS, ""); //$NON-NLS-1$ - } catch (CoreException ce) { - LaunchUIPlugin.log(ce.getStatus()); - } - argumentField.setText(arguments); - } - - /* - * (non-Javadoc) - * - * @see - * org.eclipse.debug.ui.ILaunchConfigurationTab#performApply(org.eclipse.debug. - * core.ILaunchConfigurationWorkingCopy) - */ - @Override - public void performApply(ILaunchConfigurationWorkingCopy configuration) { - String location = locationField.getText().trim(); - if (location.length() == 0) { - configuration.setAttribute(ICDTLaunchConfigurationConstants.ATTR_LOCATION, (String) null); - } else { - configuration.setAttribute(ICDTLaunchConfigurationConstants.ATTR_LOCATION, location); - } - - String workingDirectory = workDirectoryField.getText().trim(); - if (workingDirectory.length() == 0) { - configuration.setAttribute(ICDTLaunchConfigurationConstants.ATTR_WORKING_DIRECTORY, (String) null); - } else { - configuration.setAttribute(ICDTLaunchConfigurationConstants.ATTR_WORKING_DIRECTORY, workingDirectory); - } - - String arguments = argumentField.getText().trim(); - if (arguments.length() == 0) { - configuration.setAttribute(ICDTLaunchConfigurationConstants.ATTR_TOOL_ARGUMENTS, (String) null); - } else { - configuration.setAttribute(ICDTLaunchConfigurationConstants.ATTR_TOOL_ARGUMENTS, arguments); - } - - if (userEdited) { - configuration.setAttribute(FIRST_EDIT, (String) null); - } - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.debug.ui.ILaunchConfigurationTab#getName() - */ - @Override - public String getName() { - return Messages.GenericMainTab_Main; - } - - /* - * (non-Javadoc) - * - * @see - * org.eclipse.debug.ui.ILaunchConfigurationTab#isValid(org.eclipse.debug.core. - * ILaunchConfiguration) - */ - @Override - public boolean isValid(ILaunchConfiguration launchConfig) { - setErrorMessage(null); - setMessage(null); - boolean newConfig = false; - try { - newConfig = launchConfig.getAttribute(FIRST_EDIT, false); - } catch (CoreException e) { - // assume false is correct - } - return validateLocation(newConfig) && validateWorkDirectory(); - } - - /** - * Validates the content of the location field. - */ - protected boolean validateLocation(boolean newConfig) { - String location = locationField.getText().trim(); - if (location.length() < 1) { - setErrorMessage(null); - setMessage(Messages.GenericMainTab_SpecifyLocation); - return true; - } - - String expandedLocation = null; - try { - expandedLocation = resolveValue(location); - if (expandedLocation == null) { // a variable that needs to be resolved at runtime - return true; - } - } catch (CoreException e) { - setErrorMessage(e.getStatus().getMessage()); - return false; - } - - File file = new File(expandedLocation); - if (!file.exists()) { // The file does not exist. - if (!newConfig) { - setErrorMessage(Messages.GenericMainTab_LocationNotExists); - } - return false; - } - if (!file.isFile()) { - if (!newConfig) { - setErrorMessage(Messages.GenericMainTab_LocationNotAFile); - } - return false; - } - return true; - } - - /** - * Validates the variables of the given string to determine if all variables are - * valid - * - * @param expression - * expression with variables - * @exception CoreException - * if a variable is specified that does not exist - */ - private void validateVaribles(String expression) throws CoreException { - IStringVariableManager manager = VariablesPlugin.getDefault().getStringVariableManager(); - manager.validateStringVariables(expression); - } - - private String resolveValue(String expression) throws CoreException { - String expanded = null; - try { - expanded = getValue(expression); - } catch (CoreException e) { // possibly just a variable that needs to be resolved at runtime - validateVaribles(expression); - return null; - } - return expanded; - } - - /** - * Validates the value of the given string to determine if any/all variables are - * valid - * - * @param expression - * expression with variables - * @return whether the expression contained any variable values - * @exception CoreException - * if variable resolution fails - */ - private String getValue(String expression) throws CoreException { - IStringVariableManager manager = VariablesPlugin.getDefault().getStringVariableManager(); - return manager.performStringSubstitution(expression); - } - - /** - * Validates the content of the working directory field. - */ - protected boolean validateWorkDirectory() { - String dir = workDirectoryField.getText().trim(); - if (dir.length() <= 0) { - return true; - } - - String expandedDir = null; - try { - expandedDir = resolveValue(dir); - if (expandedDir == null) { // a variable that needs to be resolved at runtime - return true; - } - } catch (CoreException e) { - setErrorMessage(e.getStatus().getMessage()); - return false; - } - - File file = new File(expandedDir); - if (!file.exists()) { // The directory does not exist. - setErrorMessage(Messages.GenericMainTab_WorkingDirNotExists); - return false; - } - if (!file.isDirectory()) { - setErrorMessage(Messages.GenericMainTab_WorkingDirNotADir); - return false; - } - return true; - } - - /** - * Prompts the user to choose a location from the filesystem and sets the - * location as the full path of the selected file. - */ - protected void handleFileLocationButtonSelected() { - FileDialog fileDialog = new FileDialog(getShell(), SWT.NONE); - fileDialog.setFileName(locationField.getText()); - String text = fileDialog.open(); - if (text != null) { - locationField.setText(text); - } - } - - /** - * Prompts the user for a workspace location within the workspace and sets the - * location as a String containing the workspace_loc variable or - * null if no location was obtained from the user. - */ - protected void handleWorkspaceLocationButtonSelected() { - ResourceSelectionDialog dialog; - dialog = new ResourceSelectionDialog(getShell(), ResourcesPlugin.getWorkspace().getRoot(), - Messages.GenericMainTab_SelectResource); - dialog.open(); - Object[] results = dialog.getResult(); - if (results == null || results.length < 1) { - return; - } - IResource resource = (IResource) results[0]; - locationField.setText(newVariableExpression("workspace_loc", resource.getFullPath().toString())); //$NON-NLS-1$ - } - - /** - * Prompts the user for a working directory location within the workspace and - * sets the working directory as a String containing the workspace_loc variable - * or null if no location was obtained from the user. - */ - protected void handleWorkspaceWorkingDirectoryButtonSelected() { - ContainerSelectionDialog containerDialog; - containerDialog = new ContainerSelectionDialog(getShell(), ResourcesPlugin.getWorkspace().getRoot(), false, - Messages.GenericMainTab_SelectWorkingDir); - containerDialog.open(); - Object[] resource = containerDialog.getResult(); - String text = null; - if (resource != null && resource.length > 0) { - text = newVariableExpression("workspace_loc", ((IPath) resource[0]).toString()); //$NON-NLS-1$ - } - if (text != null) { - workDirectoryField.setText(text); - } - } - - /** - * Returns a new variable expression with the given variable and the given - * argument. - * - * @see IStringVariableManager#generateVariableExpression(String, String) - */ - protected String newVariableExpression(String varName, String arg) { - return VariablesPlugin.getDefault().getStringVariableManager().generateVariableExpression(varName, arg); - } - - /** - * Prompts the user to choose a working directory from the filesystem. - */ - protected void handleFileWorkingDirectoryButtonSelected() { - DirectoryDialog dialog = new DirectoryDialog(getShell(), SWT.SAVE); - dialog.setMessage(Messages.GenericMainTab_SelectWorkingDir); - dialog.setFilterPath(workDirectoryField.getText()); - String text = dialog.open(); - if (text != null) { - workDirectoryField.setText(text); - } - } - - /** - * A variable entry button has been pressed for the given text field. Prompt the - * user for a variable and enter the result in the given field. - */ - private void handleVariablesButtonSelected(Text textField) { - String variable = getVariable(); - if (variable != null) { - textField.insert(variable); - } - } - - /** - * Prompts the user to choose and configure a variable and returns the resulting - * string, suitable to be used as an attribute. - */ - private String getVariable() { - StringVariableSelectionDialog dialog = new StringVariableSelectionDialog(getShell()); - dialog.open(); - return dialog.getVariableExpression(); - } - - /* - * (non-Javadoc) - * - * @see org.eclipse.debug.ui.ILaunchConfigurationTab#getImage() - */ - @Override - public Image getImage() { - return LaunchImages.get(LaunchImages.IMG_VIEW_MAIN_TAB); - } - - /* - * (non-Javadoc) - * - * @see - * org.eclipse.debug.ui.ILaunchConfigurationTab#deactivated(org.eclipse.debug. - * core.ILaunchConfigurationWorkingCopy) - */ - @Override - public void deactivated(ILaunchConfigurationWorkingCopy workingCopy) { - } - - /* - * (non-Javadoc) - * - * @see - * org.eclipse.debug.ui.ILaunchConfigurationTab#activated(org.eclipse.debug.core - * .ILaunchConfigurationWorkingCopy) - */ - @Override - public void activated(ILaunchConfigurationWorkingCopy workingCopy) { - } - - /* - * Fix for Bug 60163 Accessibility: New Builder Dialog missing object info for - * textInput controls - */ - public void addControlAccessibleListener(Control control, String controlName) { - // strip mnemonic (&) - String[] strs = controlName.split("&"); //$NON-NLS-1$ - StringBuffer stripped = new StringBuffer(); - for (int i = 0; i < strs.length; i++) { - stripped.append(strs[i]); - } - control.getAccessible().addAccessibleListener(new ControlAccessibleListener(stripped.toString())); - } - - private class ControlAccessibleListener extends AccessibleAdapter { - private String controlName; - - ControlAccessibleListener(String name) { - controlName = name; - } - - @Override - public void getName(AccessibleEvent e) { - e.result = controlName; - } - - } - -} +/******************************************************************************* + * Copyright (c) 2000, 2017 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 + * + * copied from: + * org.eclipse.ui.externaltools.internal.launchConfigurations.GenericMainTab + *******************************************************************************/ +package org.eclipse.cdt.launch.ui.corebuild; + +import java.io.File; + +import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants; +import org.eclipse.cdt.launch.internal.ui.LaunchImages; +import org.eclipse.cdt.launch.internal.ui.LaunchUIPlugin; +import org.eclipse.cdt.launch.internal.ui.Messages; +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.variables.IStringVariableManager; +import org.eclipse.core.variables.VariablesPlugin; +import org.eclipse.debug.core.ILaunchConfiguration; +import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; +import org.eclipse.debug.ui.AbstractLaunchConfigurationTab; +import org.eclipse.debug.ui.StringVariableSelectionDialog; +import org.eclipse.jface.dialogs.Dialog; +import org.eclipse.jface.dialogs.IDialogConstants; +import org.eclipse.swt.SWT; +import org.eclipse.swt.accessibility.AccessibleAdapter; +import org.eclipse.swt.accessibility.AccessibleEvent; +import org.eclipse.swt.events.ModifyEvent; +import org.eclipse.swt.events.ModifyListener; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.events.TraverseEvent; +import org.eclipse.swt.events.TraverseListener; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.DirectoryDialog; +import org.eclipse.swt.widgets.FileDialog; +import org.eclipse.swt.widgets.Group; +import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Text; +import org.eclipse.ui.dialogs.ContainerSelectionDialog; +import org.eclipse.ui.dialogs.ResourceSelectionDialog; + +/** + * @since 9.2 + */ +public class GenericMainTab extends AbstractLaunchConfigurationTab { + + public final static String FIRST_EDIT = "editedByExternalToolsMainTab"; //$NON-NLS-1$ + + protected Text locationField; + protected Text workDirectoryField; + protected Button fileLocationButton; + protected Button workspaceLocationButton; + protected Button variablesLocationButton; + protected Button fileWorkingDirectoryButton; + protected Button workspaceWorkingDirectoryButton; + protected Button variablesWorkingDirectoryButton; + + protected Text argumentField; + protected Button argumentVariablesButton; + + protected SelectionAdapter selectionAdapter; + + protected boolean fInitializing = false; + private boolean userEdited = false; + + protected WidgetListener fListener = new WidgetListener(); + + /** + * A listener to update for text modification and widget selection. + */ + protected class WidgetListener extends SelectionAdapter implements ModifyListener { + @Override + public void modifyText(ModifyEvent e) { + if (!fInitializing) { + setDirty(true); + userEdited = true; + updateLaunchConfigurationDialog(); + } + } + + @Override + public void widgetSelected(SelectionEvent e) { + setDirty(true); + Object source = e.getSource(); + if (source == workspaceLocationButton) { + handleWorkspaceLocationButtonSelected(); + } else if (source == fileLocationButton) { + handleFileLocationButtonSelected(); + } else if (source == workspaceWorkingDirectoryButton) { + handleWorkspaceWorkingDirectoryButtonSelected(); + } else if (source == fileWorkingDirectoryButton) { + handleFileWorkingDirectoryButtonSelected(); + } else if (source == argumentVariablesButton) { + handleVariablesButtonSelected(argumentField); + } else if (source == variablesLocationButton) { + handleVariablesButtonSelected(locationField); + } else if (source == variablesWorkingDirectoryButton) { + handleVariablesButtonSelected(workDirectoryField); + } + } + + } + + /* + * (non-Javadoc) + * + * @see + * org.eclipse.debug.ui.ILaunchConfigurationTab#createControl(org.eclipse.swt. + * widgets.Composite) + */ + @Override + public void createControl(Composite parent) { + Composite mainComposite = new Composite(parent, SWT.NONE); + setControl(mainComposite); + mainComposite.setFont(parent.getFont()); + GridLayout layout = new GridLayout(); + layout.numColumns = 1; + GridData gridData = new GridData(GridData.FILL_HORIZONTAL); + mainComposite.setLayout(layout); + mainComposite.setLayoutData(gridData); + + createLocationComponent(mainComposite); + createWorkDirectoryComponent(mainComposite); + createArgumentComponent(mainComposite); + createVerticalSpacer(mainComposite, 1); + + Dialog.applyDialogFont(parent); + } + + /** + * Creates the controls needed to edit the location attribute of an external + * tool + * + * @param parent + * the composite to create the controls in + */ + protected void createLocationComponent(Composite parent) { + Group group = new Group(parent, SWT.NONE); + String locationLabel = getLocationLabel(); + group.setText(locationLabel); + GridLayout layout = new GridLayout(); + layout.numColumns = 1; + GridData gridData = new GridData(GridData.FILL_HORIZONTAL); + group.setLayout(layout); + group.setLayoutData(gridData); + + locationField = new Text(group, SWT.BORDER); + gridData = new GridData(GridData.FILL_HORIZONTAL); + gridData.widthHint = IDialogConstants.ENTRY_FIELD_WIDTH; + locationField.setLayoutData(gridData); + locationField.addModifyListener(fListener); + addControlAccessibleListener(locationField, group.getText()); + + Composite buttonComposite = new Composite(group, SWT.NONE); + layout = new GridLayout(); + layout.marginHeight = 0; + layout.marginWidth = 0; + layout.numColumns = 3; + gridData = new GridData(GridData.HORIZONTAL_ALIGN_END); + buttonComposite.setLayout(layout); + buttonComposite.setLayoutData(gridData); + buttonComposite.setFont(parent.getFont()); + + workspaceLocationButton = createPushButton(buttonComposite, Messages.GenericMainTab_BrowseWorkspace, null); + workspaceLocationButton.addSelectionListener(fListener); + addControlAccessibleListener(workspaceLocationButton, + group.getText() + " " + workspaceLocationButton.getText()); //$NON-NLS-1$ + + fileLocationButton = createPushButton(buttonComposite, Messages.GenericMainTab_BrowseFileSystem, null); + fileLocationButton.addSelectionListener(fListener); + addControlAccessibleListener(fileLocationButton, group.getText() + " " + fileLocationButton.getText()); //$NON-NLS-1$ + + variablesLocationButton = createPushButton(buttonComposite, Messages.GenericMainTab_Variables, null); + variablesLocationButton.addSelectionListener(fListener); + addControlAccessibleListener(variablesLocationButton, + group.getText() + " " + variablesLocationButton.getText()); //$NON-NLS-1$ + } + + /** + * Returns the label used for the location widgets. Subclasses may wish to + * override. + */ + protected String getLocationLabel() { + return Messages.GenericMainTab_Location; + } + + /** + * Creates the controls needed to edit the working directory attribute of an + * external tool + * + * @param parent + * the composite to create the controls in + */ + protected void createWorkDirectoryComponent(Composite parent) { + Group group = new Group(parent, SWT.NONE); + String groupName = getWorkingDirectoryLabel(); + group.setText(groupName); + GridLayout layout = new GridLayout(); + layout.numColumns = 1; + GridData gridData = new GridData(GridData.FILL_HORIZONTAL); + group.setLayout(layout); + group.setLayoutData(gridData); + + workDirectoryField = new Text(group, SWT.BORDER); + GridData data = new GridData(GridData.FILL_HORIZONTAL); + data.widthHint = IDialogConstants.ENTRY_FIELD_WIDTH; + workDirectoryField.setLayoutData(data); + workDirectoryField.addModifyListener(fListener); + addControlAccessibleListener(workDirectoryField, group.getText()); + + Composite buttonComposite = new Composite(group, SWT.NONE); + layout = new GridLayout(); + layout.marginWidth = 0; + layout.marginHeight = 0; + layout.numColumns = 3; + gridData = new GridData(GridData.HORIZONTAL_ALIGN_END); + buttonComposite.setLayout(layout); + buttonComposite.setLayoutData(gridData); + buttonComposite.setFont(parent.getFont()); + + workspaceWorkingDirectoryButton = createPushButton(buttonComposite, Messages.GenericMainTab_BrowseWorkspace, null); + workspaceWorkingDirectoryButton.addSelectionListener(fListener); + addControlAccessibleListener(workspaceWorkingDirectoryButton, + group.getText() + " " + workspaceWorkingDirectoryButton.getText()); //$NON-NLS-1$ + + fileWorkingDirectoryButton = createPushButton(buttonComposite, Messages.GenericMainTab_BrowseFileSystem, null); + fileWorkingDirectoryButton.addSelectionListener(fListener); + addControlAccessibleListener(fileWorkingDirectoryButton, group.getText() + " " + fileLocationButton.getText()); //$NON-NLS-1$ + + variablesWorkingDirectoryButton = createPushButton(buttonComposite, Messages.GenericMainTab_Variables, null); + variablesWorkingDirectoryButton.addSelectionListener(fListener); + addControlAccessibleListener(variablesWorkingDirectoryButton, + group.getText() + " " + variablesWorkingDirectoryButton.getText()); //$NON-NLS-1$ + } + + /** + * Return the String to use as the label for the working directory field. + * Subclasses may wish to override. + */ + protected String getWorkingDirectoryLabel() { + return Messages.GenericMainTab_WorkingDirectory; + } + + /** + * Creates the controls needed to edit the argument and prompt for argument + * attributes of an external tool + * + * @param parent + * the composite to create the controls in + */ + protected void createArgumentComponent(Composite parent) { + Group group = new Group(parent, SWT.NONE); + String groupName = Messages.GenericMainTab_Arguments; + group.setText(groupName); + GridLayout layout = new GridLayout(); + layout.numColumns = 1; + GridData gridData = new GridData(GridData.FILL_BOTH); + group.setLayout(layout); + group.setLayoutData(gridData); + group.setFont(parent.getFont()); + + argumentField = new Text(group, SWT.MULTI | SWT.WRAP | SWT.BORDER | SWT.V_SCROLL); + argumentField.addTraverseListener(new TraverseListener() { + @Override + public void keyTraversed(TraverseEvent event) { + if (event.detail == SWT.TRAVERSE_RETURN && (event.stateMask & SWT.MODIFIER_MASK) != 0) { + event.doit = true; + } + } + }); + + gridData = new GridData(GridData.FILL_BOTH); + gridData.widthHint = IDialogConstants.ENTRY_FIELD_WIDTH; + gridData.heightHint = 30; + argumentField.setLayoutData(gridData); + argumentField.addModifyListener(fListener); + addControlAccessibleListener(argumentField, group.getText()); + + Composite composite = new Composite(group, SWT.NONE); + layout = new GridLayout(); + layout.numColumns = 1; + layout.marginHeight = 0; + layout.marginWidth = 0; + gridData = new GridData(GridData.HORIZONTAL_ALIGN_END); + composite.setLayout(layout); + composite.setLayoutData(gridData); + composite.setFont(parent.getFont()); + + argumentVariablesButton = createPushButton(composite, Messages.GenericMainTab_Variables, null); + argumentVariablesButton.addSelectionListener(fListener); + addControlAccessibleListener(argumentVariablesButton, argumentVariablesButton.getText()); // need to strip the + // mnemonic from + // buttons + + Label instruction = new Label(group, SWT.NONE); + instruction.setText(Messages.GenericMainTab_Quotes); + gridData = new GridData(GridData.HORIZONTAL_ALIGN_FILL); + gridData.horizontalSpan = 2; + instruction.setLayoutData(gridData); + } + + /* + * (non-Javadoc) + * + * @see + * org.eclipse.debug.ui.ILaunchConfigurationTab#setDefaults(org.eclipse.debug. + * core.ILaunchConfigurationWorkingCopy) + */ + @Override + public void setDefaults(ILaunchConfigurationWorkingCopy configuration) { + configuration.setAttribute(FIRST_EDIT, true); + } + + /* + * (non-Javadoc) + * + * @see + * org.eclipse.debug.ui.ILaunchConfigurationTab#initializeFrom(org.eclipse.debug + * .core.ILaunchConfiguration) + */ + @Override + public void initializeFrom(ILaunchConfiguration configuration) { + fInitializing = true; + updateLocation(configuration); + updateWorkingDirectory(configuration); + updateArgument(configuration); + fInitializing = false; + setDirty(false); + } + + /** + * Updates the working directory widgets to match the state of the given launch + * configuration. + */ + protected void updateWorkingDirectory(ILaunchConfiguration configuration) { + String workingDir = ""; //$NON-NLS-1$ + try { + workingDir = configuration.getAttribute(ICDTLaunchConfigurationConstants.ATTR_WORKING_DIRECTORY, ""); //$NON-NLS-1$ + } catch (CoreException ce) { + LaunchUIPlugin.log(ce.getStatus()); + } + workDirectoryField.setText(workingDir); + } + + /** + * Updates the location widgets to match the state of the given launch + * configuration. + */ + protected void updateLocation(ILaunchConfiguration configuration) { + String location = ""; //$NON-NLS-1$ + try { + location = configuration.getAttribute(ICDTLaunchConfigurationConstants.ATTR_LOCATION, ""); //$NON-NLS-1$ + } catch (CoreException ce) { + LaunchUIPlugin.log(ce.getStatus()); + } + locationField.setText(location); + } + + /** + * Updates the argument widgets to match the state of the given launch + * configuration. + */ + protected void updateArgument(ILaunchConfiguration configuration) { + String arguments = ""; //$NON-NLS-1$ + try { + arguments = configuration.getAttribute(ICDTLaunchConfigurationConstants.ATTR_TOOL_ARGUMENTS, ""); //$NON-NLS-1$ + } catch (CoreException ce) { + LaunchUIPlugin.log(ce.getStatus()); + } + argumentField.setText(arguments); + } + + /* + * (non-Javadoc) + * + * @see + * org.eclipse.debug.ui.ILaunchConfigurationTab#performApply(org.eclipse.debug. + * core.ILaunchConfigurationWorkingCopy) + */ + @Override + public void performApply(ILaunchConfigurationWorkingCopy configuration) { + String location = locationField.getText().trim(); + if (location.length() == 0) { + configuration.setAttribute(ICDTLaunchConfigurationConstants.ATTR_LOCATION, (String) null); + } else { + configuration.setAttribute(ICDTLaunchConfigurationConstants.ATTR_LOCATION, location); + } + + String workingDirectory = workDirectoryField.getText().trim(); + if (workingDirectory.length() == 0) { + configuration.setAttribute(ICDTLaunchConfigurationConstants.ATTR_WORKING_DIRECTORY, (String) null); + } else { + configuration.setAttribute(ICDTLaunchConfigurationConstants.ATTR_WORKING_DIRECTORY, workingDirectory); + } + + String arguments = argumentField.getText().trim(); + if (arguments.length() == 0) { + configuration.setAttribute(ICDTLaunchConfigurationConstants.ATTR_TOOL_ARGUMENTS, (String) null); + } else { + configuration.setAttribute(ICDTLaunchConfigurationConstants.ATTR_TOOL_ARGUMENTS, arguments); + } + + if (userEdited) { + configuration.setAttribute(FIRST_EDIT, (String) null); + } + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.debug.ui.ILaunchConfigurationTab#getName() + */ + @Override + public String getName() { + return Messages.GenericMainTab_Main; + } + + /* + * (non-Javadoc) + * + * @see + * org.eclipse.debug.ui.ILaunchConfigurationTab#isValid(org.eclipse.debug.core. + * ILaunchConfiguration) + */ + @Override + public boolean isValid(ILaunchConfiguration launchConfig) { + setErrorMessage(null); + setMessage(null); + boolean newConfig = false; + try { + newConfig = launchConfig.getAttribute(FIRST_EDIT, false); + } catch (CoreException e) { + // assume false is correct + } + return validateLocation(newConfig) && validateWorkDirectory(); + } + + /** + * Validates the content of the location field. + */ + protected boolean validateLocation(boolean newConfig) { + String location = locationField.getText().trim(); + if (location.length() < 1) { + setErrorMessage(null); + setMessage(Messages.GenericMainTab_SpecifyLocation); + return true; + } + + String expandedLocation = null; + try { + expandedLocation = resolveValue(location); + if (expandedLocation == null) { // a variable that needs to be resolved at runtime + return true; + } + } catch (CoreException e) { + setErrorMessage(e.getStatus().getMessage()); + return false; + } + + File file = new File(expandedLocation); + if (!file.exists()) { // The file does not exist. + if (!newConfig) { + setErrorMessage(Messages.GenericMainTab_LocationNotExists); + } + return false; + } + if (!file.isFile()) { + if (!newConfig) { + setErrorMessage(Messages.GenericMainTab_LocationNotAFile); + } + return false; + } + return true; + } + + /** + * Validates the variables of the given string to determine if all variables are + * valid + * + * @param expression + * expression with variables + * @exception CoreException + * if a variable is specified that does not exist + */ + private void validateVaribles(String expression) throws CoreException { + IStringVariableManager manager = VariablesPlugin.getDefault().getStringVariableManager(); + manager.validateStringVariables(expression); + } + + private String resolveValue(String expression) throws CoreException { + String expanded = null; + try { + expanded = getValue(expression); + } catch (CoreException e) { // possibly just a variable that needs to be resolved at runtime + validateVaribles(expression); + return null; + } + return expanded; + } + + /** + * Validates the value of the given string to determine if any/all variables are + * valid + * + * @param expression + * expression with variables + * @return whether the expression contained any variable values + * @exception CoreException + * if variable resolution fails + */ + private String getValue(String expression) throws CoreException { + IStringVariableManager manager = VariablesPlugin.getDefault().getStringVariableManager(); + return manager.performStringSubstitution(expression); + } + + /** + * Validates the content of the working directory field. + */ + protected boolean validateWorkDirectory() { + String dir = workDirectoryField.getText().trim(); + if (dir.length() <= 0) { + return true; + } + + String expandedDir = null; + try { + expandedDir = resolveValue(dir); + if (expandedDir == null) { // a variable that needs to be resolved at runtime + return true; + } + } catch (CoreException e) { + setErrorMessage(e.getStatus().getMessage()); + return false; + } + + File file = new File(expandedDir); + if (!file.exists()) { // The directory does not exist. + setErrorMessage(Messages.GenericMainTab_WorkingDirNotExists); + return false; + } + if (!file.isDirectory()) { + setErrorMessage(Messages.GenericMainTab_WorkingDirNotADir); + return false; + } + return true; + } + + /** + * Prompts the user to choose a location from the filesystem and sets the + * location as the full path of the selected file. + */ + protected void handleFileLocationButtonSelected() { + FileDialog fileDialog = new FileDialog(getShell(), SWT.NONE); + fileDialog.setFileName(locationField.getText()); + String text = fileDialog.open(); + if (text != null) { + locationField.setText(text); + } + } + + /** + * Prompts the user for a workspace location within the workspace and sets the + * location as a String containing the workspace_loc variable or + * null if no location was obtained from the user. + */ + protected void handleWorkspaceLocationButtonSelected() { + ResourceSelectionDialog dialog; + dialog = new ResourceSelectionDialog(getShell(), ResourcesPlugin.getWorkspace().getRoot(), + Messages.GenericMainTab_SelectResource); + dialog.open(); + Object[] results = dialog.getResult(); + if (results == null || results.length < 1) { + return; + } + IResource resource = (IResource) results[0]; + locationField.setText(newVariableExpression("workspace_loc", resource.getFullPath().toString())); //$NON-NLS-1$ + } + + /** + * Prompts the user for a working directory location within the workspace and + * sets the working directory as a String containing the workspace_loc variable + * or null if no location was obtained from the user. + */ + protected void handleWorkspaceWorkingDirectoryButtonSelected() { + ContainerSelectionDialog containerDialog; + containerDialog = new ContainerSelectionDialog(getShell(), ResourcesPlugin.getWorkspace().getRoot(), false, + Messages.GenericMainTab_SelectWorkingDir); + containerDialog.open(); + Object[] resource = containerDialog.getResult(); + String text = null; + if (resource != null && resource.length > 0) { + text = newVariableExpression("workspace_loc", ((IPath) resource[0]).toString()); //$NON-NLS-1$ + } + if (text != null) { + workDirectoryField.setText(text); + } + } + + /** + * Returns a new variable expression with the given variable and the given + * argument. + * + * @see IStringVariableManager#generateVariableExpression(String, String) + */ + protected String newVariableExpression(String varName, String arg) { + return VariablesPlugin.getDefault().getStringVariableManager().generateVariableExpression(varName, arg); + } + + /** + * Prompts the user to choose a working directory from the filesystem. + */ + protected void handleFileWorkingDirectoryButtonSelected() { + DirectoryDialog dialog = new DirectoryDialog(getShell(), SWT.SAVE); + dialog.setMessage(Messages.GenericMainTab_SelectWorkingDir); + dialog.setFilterPath(workDirectoryField.getText()); + String text = dialog.open(); + if (text != null) { + workDirectoryField.setText(text); + } + } + + /** + * A variable entry button has been pressed for the given text field. Prompt the + * user for a variable and enter the result in the given field. + */ + private void handleVariablesButtonSelected(Text textField) { + String variable = getVariable(); + if (variable != null) { + textField.insert(variable); + } + } + + /** + * Prompts the user to choose and configure a variable and returns the resulting + * string, suitable to be used as an attribute. + */ + private String getVariable() { + StringVariableSelectionDialog dialog = new StringVariableSelectionDialog(getShell()); + dialog.open(); + return dialog.getVariableExpression(); + } + + /* + * (non-Javadoc) + * + * @see org.eclipse.debug.ui.ILaunchConfigurationTab#getImage() + */ + @Override + public Image getImage() { + return LaunchImages.get(LaunchImages.IMG_VIEW_MAIN_TAB); + } + + /* + * (non-Javadoc) + * + * @see + * org.eclipse.debug.ui.ILaunchConfigurationTab#deactivated(org.eclipse.debug. + * core.ILaunchConfigurationWorkingCopy) + */ + @Override + public void deactivated(ILaunchConfigurationWorkingCopy workingCopy) { + } + + /* + * (non-Javadoc) + * + * @see + * org.eclipse.debug.ui.ILaunchConfigurationTab#activated(org.eclipse.debug.core + * .ILaunchConfigurationWorkingCopy) + */ + @Override + public void activated(ILaunchConfigurationWorkingCopy workingCopy) { + } + + /* + * Fix for Bug 60163 Accessibility: New Builder Dialog missing object info for + * textInput controls + */ + public void addControlAccessibleListener(Control control, String controlName) { + // strip mnemonic (&) + String[] strs = controlName.split("&"); //$NON-NLS-1$ + StringBuffer stripped = new StringBuffer(); + for (int i = 0; i < strs.length; i++) { + stripped.append(strs[i]); + } + control.getAccessible().addAccessibleListener(new ControlAccessibleListener(stripped.toString())); + } + + private class ControlAccessibleListener extends AccessibleAdapter { + private String controlName; + + ControlAccessibleListener(String name) { + controlName = name; + } + + @Override + public void getName(AccessibleEvent e) { + e.result = controlName; + } + + } + +} diff --git a/llvm/org.eclipse.cdt.managedbuilder.llvm.tests/.classpath b/llvm/org.eclipse.cdt.managedbuilder.llvm.tests/.classpath index bd877a46212..707ff80c7a0 100644 --- a/llvm/org.eclipse.cdt.managedbuilder.llvm.tests/.classpath +++ b/llvm/org.eclipse.cdt.managedbuilder.llvm.tests/.classpath @@ -1,8 +1,8 @@ - - - - - - - - + + + + + + + + diff --git a/llvm/org.eclipse.cdt.managedbuilder.llvm.tests/.settings/org.eclipse.jdt.core.prefs b/llvm/org.eclipse.cdt.managedbuilder.llvm.tests/.settings/org.eclipse.jdt.core.prefs index 1257f252fb6..7492e964e67 100644 --- a/llvm/org.eclipse.cdt.managedbuilder.llvm.tests/.settings/org.eclipse.jdt.core.prefs +++ b/llvm/org.eclipse.cdt.managedbuilder.llvm.tests/.settings/org.eclipse.jdt.core.prefs @@ -1,81 +1,81 @@ -#Wed Mar 02 15:23:00 KST 2011 -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=error -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.autoboxing=error -org.eclipse.jdt.core.compiler.problem.comparingIdentical=error -org.eclipse.jdt.core.compiler.problem.deadCode=error +#Wed Mar 02 15:23:00 KST 2011 +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=error +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.autoboxing=error +org.eclipse.jdt.core.compiler.problem.comparingIdentical=error +org.eclipse.jdt.core.compiler.problem.deadCode=error 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.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=error -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.problem.fallthroughCase=error -org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled -org.eclipse.jdt.core.compiler.problem.fieldHiding=error -org.eclipse.jdt.core.compiler.problem.finalParameterBound=error -org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=error +org.eclipse.jdt.core.compiler.problem.emptyStatement=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.problem.fallthroughCase=error +org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled +org.eclipse.jdt.core.compiler.problem.fieldHiding=error +org.eclipse.jdt.core.compiler.problem.finalParameterBound=error +org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=error org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning -org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=error -org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=disabled -org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=error -org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=error -org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=error -org.eclipse.jdt.core.compiler.problem.localVariableHiding=error -org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=error -org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=error -org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=error -org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=error -org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled -org.eclipse.jdt.core.compiler.problem.missingSerialVersion=error -org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=error -org.eclipse.jdt.core.compiler.problem.noEffectAssignment=error -org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=error -org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=error -org.eclipse.jdt.core.compiler.problem.nullReference=error -org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=error -org.eclipse.jdt.core.compiler.problem.parameterAssignment=error -org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=error -org.eclipse.jdt.core.compiler.problem.potentialNullReference=error -org.eclipse.jdt.core.compiler.problem.rawTypeReference=error -org.eclipse.jdt.core.compiler.problem.redundantNullCheck=error -org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=error -org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=error -org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=error -org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled -org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=error -org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled -org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled -org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=error -org.eclipse.jdt.core.compiler.problem.typeParameterHiding=error -org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=enabled -org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=error -org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore -org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=error -org.eclipse.jdt.core.compiler.problem.unnecessaryElse=error -org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=error -org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=error -org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=error -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=error -org.eclipse.jdt.core.compiler.problem.unusedLocal=error -org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=error -org.eclipse.jdt.core.compiler.problem.unusedParameter=error -org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled -org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled -org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled -org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=error -org.eclipse.jdt.core.compiler.problem.unusedWarningToken=error -org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=error -org.eclipse.jdt.core.compiler.source=1.8 +org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=error +org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=disabled +org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=error +org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=error +org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=error +org.eclipse.jdt.core.compiler.problem.localVariableHiding=error +org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=error +org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=error +org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=error +org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=error +org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled +org.eclipse.jdt.core.compiler.problem.missingSerialVersion=error +org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=error +org.eclipse.jdt.core.compiler.problem.noEffectAssignment=error +org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=error +org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=error +org.eclipse.jdt.core.compiler.problem.nullReference=error +org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=error +org.eclipse.jdt.core.compiler.problem.parameterAssignment=error +org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=error +org.eclipse.jdt.core.compiler.problem.potentialNullReference=error +org.eclipse.jdt.core.compiler.problem.rawTypeReference=error +org.eclipse.jdt.core.compiler.problem.redundantNullCheck=error +org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=error +org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=error +org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=error +org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled +org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=error +org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled +org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled +org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=error +org.eclipse.jdt.core.compiler.problem.typeParameterHiding=error +org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=enabled +org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=error +org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore +org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=error +org.eclipse.jdt.core.compiler.problem.unnecessaryElse=error +org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=error +org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=error +org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=error +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=error +org.eclipse.jdt.core.compiler.problem.unusedLocal=error +org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=error +org.eclipse.jdt.core.compiler.problem.unusedParameter=error +org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled +org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled +org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled +org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=error +org.eclipse.jdt.core.compiler.problem.unusedWarningToken=error +org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=error +org.eclipse.jdt.core.compiler.source=1.8 diff --git a/llvm/org.eclipse.cdt.managedbuilder.llvm.tests/.settings/org.eclipse.wst.xsl.core.prefs b/llvm/org.eclipse.cdt.managedbuilder.llvm.tests/.settings/org.eclipse.wst.xsl.core.prefs index 3fa634ebd2b..3854a9f0005 100644 --- a/llvm/org.eclipse.cdt.managedbuilder.llvm.tests/.settings/org.eclipse.wst.xsl.core.prefs +++ b/llvm/org.eclipse.cdt.managedbuilder.llvm.tests/.settings/org.eclipse.wst.xsl.core.prefs @@ -1,12 +1,12 @@ -#Tue Mar 01 18:13:46 KST 2011 -CHECK_CALL_TEMPLATES=2 -CHECK_XPATHS=2 -CIRCULAR_REF=2 -DUPLICATE_PARAMETER=2 -EMPTY_PARAM=1 -MISSING_INCLUDE=2 -MISSING_PARAM=1 -NAME_ATTRIBUTE_EMPTY=2 -NAME_ATTRIBUTE_MISSING=2 -TEMPLATE_CONFLICT=2 -eclipse.preferences.version=1 +#Tue Mar 01 18:13:46 KST 2011 +CHECK_CALL_TEMPLATES=2 +CHECK_XPATHS=2 +CIRCULAR_REF=2 +DUPLICATE_PARAMETER=2 +EMPTY_PARAM=1 +MISSING_INCLUDE=2 +MISSING_PARAM=1 +NAME_ATTRIBUTE_EMPTY=2 +NAME_ATTRIBUTE_MISSING=2 +TEMPLATE_CONFLICT=2 +eclipse.preferences.version=1 diff --git a/llvm/org.eclipse.cdt.managedbuilder.llvm.tests/build.properties b/llvm/org.eclipse.cdt.managedbuilder.llvm.tests/build.properties index 5daf9f2ad62..feb5464f652 100644 --- a/llvm/org.eclipse.cdt.managedbuilder.llvm.tests/build.properties +++ b/llvm/org.eclipse.cdt.managedbuilder.llvm.tests/build.properties @@ -1,7 +1,7 @@ -source.. = src/ -output.. = bin/ -bin.includes = META-INF/,\ - .,\ - OSGI-INF/l10n/bundle.properties,\ - OSGI-INF/,\ - about.html +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + .,\ + OSGI-INF/l10n/bundle.properties,\ + OSGI-INF/,\ + about.html diff --git a/llvm/org.eclipse.cdt.managedbuilder.llvm.tests/src/org/eclipse/cdt/managedbuilder/llvm/tests/JUnit_tests.java b/llvm/org.eclipse.cdt.managedbuilder.llvm.tests/src/org/eclipse/cdt/managedbuilder/llvm/tests/JUnit_tests.java index 4890503b214..9226280307e 100644 --- a/llvm/org.eclipse.cdt.managedbuilder.llvm.tests/src/org/eclipse/cdt/managedbuilder/llvm/tests/JUnit_tests.java +++ b/llvm/org.eclipse.cdt.managedbuilder.llvm.tests/src/org/eclipse/cdt/managedbuilder/llvm/tests/JUnit_tests.java @@ -1,40 +1,40 @@ -/******************************************************************************* - * Copyright (c) 2010, 2013 Nokia Siemens Networks Oyj, Finland. - * 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: - * Nokia Siemens Networks - initial implementation +/******************************************************************************* + * Copyright (c) 2010, 2013 Nokia Siemens Networks Oyj, Finland. + * 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: + * Nokia Siemens Networks - initial implementation *******************************************************************************/ -package org.eclipse.cdt.managedbuilder.llvm.tests; -import junit.framework.TestCase; - -/** - * Automated testing with JUnit. - * - * @author Petri Tuononen - * - */ -public class JUnit_tests extends TestCase { - - public JUnit_tests(String name) { - super(name); - } - - @Override - protected void setUp() { } - - @Override - protected void tearDown() { } - - public static void testBooleanTrue() { - assertTrue(true); - } - - public static void testBooleanFalse() { - assertTrue(false); - } - +package org.eclipse.cdt.managedbuilder.llvm.tests; +import junit.framework.TestCase; + +/** + * Automated testing with JUnit. + * + * @author Petri Tuononen + * + */ +public class JUnit_tests extends TestCase { + + public JUnit_tests(String name) { + super(name); + } + + @Override + protected void setUp() { } + + @Override + protected void tearDown() { } + + public static void testBooleanTrue() { + assertTrue(true); + } + + public static void testBooleanFalse() { + assertTrue(false); + } + } \ No newline at end of file diff --git a/llvm/org.eclipse.cdt.managedbuilder.llvm.tests/src/org/eclipse/cdt/managedbuilder/llvm/tests/messages.properties b/llvm/org.eclipse.cdt.managedbuilder.llvm.tests/src/org/eclipse/cdt/managedbuilder/llvm/tests/messages.properties index e1ff9ed5a5b..857102aadd0 100644 --- a/llvm/org.eclipse.cdt.managedbuilder.llvm.tests/src/org/eclipse/cdt/managedbuilder/llvm/tests/messages.properties +++ b/llvm/org.eclipse.cdt.managedbuilder.llvm.tests/src/org/eclipse/cdt/managedbuilder/llvm/tests/messages.properties @@ -1 +1 @@ -Activator_0=org.eclipse.cdt.managedbuilder.llvm.tests +Activator_0=org.eclipse.cdt.managedbuilder.llvm.tests diff --git a/llvm/org.eclipse.cdt.managedbuilder.llvm.tests/test.xml b/llvm/org.eclipse.cdt.managedbuilder.llvm.tests/test.xml index 702e7b4af10..673da9f5ae6 100644 --- a/llvm/org.eclipse.cdt.managedbuilder.llvm.tests/test.xml +++ b/llvm/org.eclipse.cdt.managedbuilder.llvm.tests/test.xml @@ -1,103 +1,103 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/.project b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/.project index 227f85df957..7bf5e5da254 100755 --- a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/.project +++ b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/.project @@ -1,45 +1,45 @@ - - - org.eclipse.cdt.managedbuilder.llvm.ui - @key 32303037303533312D3130303020636F6D2E6E736E2E72742E7377732E7377742E6364742E6D616E616765646275696C6465722E6C6C766D2E75692F7074756F6E6F6E65 - - - - - com.trolltech.qtjambi.juicBuilder - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.pde.ManifestBuilder - - - - - org.eclipse.pde.SchemaBuilder - - - - - com.soyatec.additional.Builder - - - - - org.eclipse.pde.api.tools.apiAnalysisBuilder - - - - - - org.eclipse.pde.PluginNature - org.eclipse.jdt.core.javanature - com.soyatec.additional.Nature - org.eclipse.pde.api.tools.apiAnalysisNature - - + + + org.eclipse.cdt.managedbuilder.llvm.ui + @key 32303037303533312D3130303020636F6D2E6E736E2E72742E7377732E7377742E6364742E6D616E616765646275696C6465722E6C6C766D2E75692F7074756F6E6F6E65 + + + + + com.trolltech.qtjambi.juicBuilder + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + com.soyatec.additional.Builder + + + + + org.eclipse.pde.api.tools.apiAnalysisBuilder + + + + + + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + com.soyatec.additional.Nature + org.eclipse.pde.api.tools.apiAnalysisNature + + diff --git a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/build.properties b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/build.properties index ac0ebbc5abb..50a28ba614a 100755 --- a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/build.properties +++ b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/build.properties @@ -1,14 +1,14 @@ -source.. = src/ -output.. = bin/ -bin.includes = plugin.xml,\ - META-INF/,\ - .,\ - plugin.properties,\ - about.html,\ - about.ini,\ - about.mappings,\ - about.properties,\ - cdt_logo_icon32.png,\ - help/ -src.includes = patches/,\ - help/,\ +source.. = src/ +output.. = bin/ +bin.includes = plugin.xml,\ + META-INF/,\ + .,\ + plugin.properties,\ + about.html,\ + about.ini,\ + about.mappings,\ + about.properties,\ + cdt_logo_icon32.png,\ + help/ +src.includes = patches/,\ + help/,\ diff --git a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/allclasses-frame.html b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/allclasses-frame.html index 944abbab773..1f6b28ac2e0 100644 --- a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/allclasses-frame.html +++ b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/allclasses-frame.html @@ -1,69 +1,69 @@ - - - - - - -All Classes - - - - - - - - - - - -All Classes -
    - - - - - -
    IncludePathListEditor -
    -LibraryListEditor -
    -LibraryPathListEditor -
    -LlvmBuildEnvironmentVariable -
    -LlvmDependencyCalculator2 -
    -LlvmDependencyCalculator2Commands -
    -LlvmEnvironmentVariableSupplier -
    -LlvmIsToolChainSupported -
    -LlvmListEditor -
    -LlvmPreferencePage -
    -LlvmPreferenceStore -
    -LlvmProjectNature -
    -LlvmScannerInfoCollector -
    -LlvmToolOptionPathUtil -
    -LlvmUIPlugin -
    -ManagedLlvmScannerInfoConsoleParser -
    -Messages -
    -PreferenceConstants -
    -PreferenceInitializer -
    -Separators -
    -
    - - - + + + + + + +All Classes + + + + + + + + + + + +All Classes +
    + + + + + +
    IncludePathListEditor +
    +LibraryListEditor +
    +LibraryPathListEditor +
    +LlvmBuildEnvironmentVariable +
    +LlvmDependencyCalculator2 +
    +LlvmDependencyCalculator2Commands +
    +LlvmEnvironmentVariableSupplier +
    +LlvmIsToolChainSupported +
    +LlvmListEditor +
    +LlvmPreferencePage +
    +LlvmPreferenceStore +
    +LlvmProjectNature +
    +LlvmScannerInfoCollector +
    +LlvmToolOptionPathUtil +
    +LlvmUIPlugin +
    +ManagedLlvmScannerInfoConsoleParser +
    +Messages +
    +PreferenceConstants +
    +PreferenceInitializer +
    +Separators +
    +
    + + + diff --git a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/allclasses-noframe.html b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/allclasses-noframe.html index 7306bc8f487..f5468bccde6 100644 --- a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/allclasses-noframe.html +++ b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/allclasses-noframe.html @@ -1,69 +1,69 @@ - - - - - - -All Classes - - - - - - - - - - - -All Classes -
    - - - - - -
    IncludePathListEditor -
    -LibraryListEditor -
    -LibraryPathListEditor -
    -LlvmBuildEnvironmentVariable -
    -LlvmDependencyCalculator2 -
    -LlvmDependencyCalculator2Commands -
    -LlvmEnvironmentVariableSupplier -
    -LlvmIsToolChainSupported -
    -LlvmListEditor -
    -LlvmPreferencePage -
    -LlvmPreferenceStore -
    -LlvmProjectNature -
    -LlvmScannerInfoCollector -
    -LlvmToolOptionPathUtil -
    -LlvmUIPlugin -
    -ManagedLlvmScannerInfoConsoleParser -
    -Messages -
    -PreferenceConstants -
    -PreferenceInitializer -
    -Separators -
    -
    - - - + + + + + + +All Classes + + + + + + + + + + + +All Classes +
    + + + + + +
    IncludePathListEditor +
    +LibraryListEditor +
    +LibraryPathListEditor +
    +LlvmBuildEnvironmentVariable +
    +LlvmDependencyCalculator2 +
    +LlvmDependencyCalculator2Commands +
    +LlvmEnvironmentVariableSupplier +
    +LlvmIsToolChainSupported +
    +LlvmListEditor +
    +LlvmPreferencePage +
    +LlvmPreferenceStore +
    +LlvmProjectNature +
    +LlvmScannerInfoCollector +
    +LlvmToolOptionPathUtil +
    +LlvmUIPlugin +
    +ManagedLlvmScannerInfoConsoleParser +
    +Messages +
    +PreferenceConstants +
    +PreferenceInitializer +
    +Separators +
    +
    + + + diff --git a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/constant-values.html b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/constant-values.html index 0fe37ff3b83..3a52ce849bd 100644 --- a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/constant-values.html +++ b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/constant-values.html @@ -1,318 +1,318 @@ - - - - - - -Constant Field Values - - - - - - - - - - - - -
    - - - - - - - - - - - - - - - -
    - -
    - - - -
    -
    -

    -Constant Field Values

    -
    -
    -Contents - - - - - - -
    -org.eclipse.*
    - -

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    org.eclipse.cdt.managedbuilder.llvm.ui.LlvmEnvironmentVariableSupplier
    -private static final java.lang.StringENV_VAR_NAME_INCLUDE_PATH"INCLUDE_PATH"
    -private static final java.lang.StringENV_VAR_NAME_LIBRARIES"LIBRARIES"
    -private static final java.lang.StringENV_VAR_NAME_LIBRARY_PATH"LLVM_LIB_SEARCH_PATH"
    -private static final java.lang.StringENV_VAR_NAME_LLVM_BIN"LLVM_BIN_PATH"
    -private static final java.lang.StringENV_VAR_NAME_LLVMINTERP"LLVMINTERP"
    -private static final java.lang.StringENV_VAR_NAME_PATH"PATH"
    - -

    - -

    - - - - - - - - - - - - - - - - - -
    org.eclipse.cdt.managedbuilder.llvm.ui.LlvmUIPlugin
    -public static final java.lang.StringPLUGIN_ID"org.eclipse.cdt.managedbuilder.llvm.ui"
    -private static final java.lang.StringPROPERTIES"plugin.properties"
    - -

    - -

    - - - - - - - - - - - - -
    org.eclipse.cdt.managedbuilder.llvm.ui.preferences.Messages
    -private static final java.lang.StringBUNDLE_NAME"org.eclipse.cdt.managedbuilder.llvm.ui.preferences.messages"
    - -

    - -

    - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    org.eclipse.cdt.managedbuilder.llvm.ui.preferences.PreferenceConstants
    -public static final java.lang.StringP_LLVM_INCLUDE_PATH"Include path used in LLVM compilations"
    -public static final java.lang.StringP_LLVM_LIBRARIES"Libraries used in LLVM builds"
    -public static final java.lang.StringP_LLVM_LIBRARY_PATH"Library path used in LLVM builds"
    -public static final java.lang.StringP_LLVM_PATH"LLVM installation folder"
    - -

    - -

    - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    org.eclipse.cdt.managedbuilder.llvm.util.LlvmToolOptionPathUtil
    -public static final intINCLUDE1
    -public static final intLIB2
    -public static final intLIB_PATH3
    -private static final java.lang.StringlinkerInputType"bc"
    - -

    - -

    -


    - - - - - - - - - - - - - - - -
    - -
    - - - -
    - - - + + + + + + +Constant Field Values + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + +
    + +
    + + + +
    +
    +

    +Constant Field Values

    +
    +
    +Contents + + + + + + +
    +org.eclipse.*
    + +

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    org.eclipse.cdt.managedbuilder.llvm.ui.LlvmEnvironmentVariableSupplier
    +private static final java.lang.StringENV_VAR_NAME_INCLUDE_PATH"INCLUDE_PATH"
    +private static final java.lang.StringENV_VAR_NAME_LIBRARIES"LIBRARIES"
    +private static final java.lang.StringENV_VAR_NAME_LIBRARY_PATH"LLVM_LIB_SEARCH_PATH"
    +private static final java.lang.StringENV_VAR_NAME_LLVM_BIN"LLVM_BIN_PATH"
    +private static final java.lang.StringENV_VAR_NAME_LLVMINTERP"LLVMINTERP"
    +private static final java.lang.StringENV_VAR_NAME_PATH"PATH"
    + +

    + +

    + + + + + + + + + + + + + + + + + +
    org.eclipse.cdt.managedbuilder.llvm.ui.LlvmUIPlugin
    +public static final java.lang.StringPLUGIN_ID"org.eclipse.cdt.managedbuilder.llvm.ui"
    +private static final java.lang.StringPROPERTIES"plugin.properties"
    + +

    + +

    + + + + + + + + + + + + +
    org.eclipse.cdt.managedbuilder.llvm.ui.preferences.Messages
    +private static final java.lang.StringBUNDLE_NAME"org.eclipse.cdt.managedbuilder.llvm.ui.preferences.messages"
    + +

    + +

    + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    org.eclipse.cdt.managedbuilder.llvm.ui.preferences.PreferenceConstants
    +public static final java.lang.StringP_LLVM_INCLUDE_PATH"Include path used in LLVM compilations"
    +public static final java.lang.StringP_LLVM_LIBRARIES"Libraries used in LLVM builds"
    +public static final java.lang.StringP_LLVM_LIBRARY_PATH"Library path used in LLVM builds"
    +public static final java.lang.StringP_LLVM_PATH"LLVM installation folder"
    + +

    + +

    + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    org.eclipse.cdt.managedbuilder.llvm.util.LlvmToolOptionPathUtil
    +public static final intINCLUDE1
    +public static final intLIB2
    +public static final intLIB_PATH3
    +private static final java.lang.StringlinkerInputType"bc"
    + +

    + +

    +


    + + + + + + + + + + + + + + + +
    + +
    + + + +
    + + + diff --git a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/deprecated-list.html b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/deprecated-list.html index 120b0b53193..aa93b33f187 100644 --- a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/deprecated-list.html +++ b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/deprecated-list.html @@ -1,146 +1,146 @@ - - - - - - -Deprecated List - - - - - - - - - - - - -
    - - - - - - - - - - - - - - - -
    - -
    - - - -
    -
    -

    -Deprecated API

    -
    -
    -Contents
      -
    - -
    - - - - - - - - - - - - - - - -
    - -
    - - - -
    - - - + + + + + + +Deprecated List + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + +
    + +
    + + + +
    +
    +

    +Deprecated API

    +
    +
    +Contents
      +
    + +
    + + + + + + + + + + + + + + + +
    + +
    + + + +
    + + + diff --git a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/help-doc.html b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/help-doc.html index 4f0c8f62cab..0625a95bb7c 100644 --- a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/help-doc.html +++ b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/help-doc.html @@ -1,223 +1,223 @@ - - - - - - -API Help - - - - - - - - - - - - -
    - - - - - - - - - - - - - - - -
    - -
    - - - -
    -
    -

    -How This API Document Is Organized

    -
    -This API (Application Programming Interface) document has pages corresponding to the items in the navigation bar, described as follows.

    -Overview

    -
    - -

    -The Overview page is the front page of this API document and provides a list of all packages with a summary for each. This page can also contain an overall description of the set of packages.

    -

    -Package

    -
    - -

    -Each package has a page that contains a list of its classes and interfaces, with a summary for each. This page can contain four categories:

      -
    • Interfaces (italic)
    • Classes
    • Enums
    • Exceptions
    • Errors
    • Annotation Types
    -
    -

    -Class/Interface

    -
    - -

    -Each class, interface, nested class and nested interface has its own separate page. Each of these pages has three sections consisting of a class/interface description, summary tables, and detailed member descriptions:

      -
    • Class inheritance diagram
    • Direct Subclasses
    • All Known Subinterfaces
    • All Known Implementing Classes
    • Class/interface declaration
    • Class/interface description -

      -

    • Nested Class Summary
    • Field Summary
    • Constructor Summary
    • Method Summary -

      -

    • Field Detail
    • Constructor Detail
    • Method Detail
    -Each summary entry contains the first sentence from the detailed description for that item. The summary entries are alphabetical, while the detailed descriptions are in the order they appear in the source code. This preserves the logical groupings established by the programmer.
    - -

    -Annotation Type

    -
    - -

    -Each annotation type has its own separate page with the following sections:

      -
    • Annotation Type declaration
    • Annotation Type description
    • Required Element Summary
    • Optional Element Summary
    • Element Detail
    -
    - -

    -Enum

    -
    - -

    -Each enum has its own separate page with the following sections:

      -
    • Enum declaration
    • Enum description
    • Enum Constant Summary
    • Enum Constant Detail
    -
    -

    -Use

    -
    -Each documented package, class and interface has its own Use page. This page describes what packages, classes, methods, constructors and fields use any part of the given class or package. Given a class or interface A, its Use page includes subclasses of A, fields declared as A, methods that return A, and methods and constructors with parameters of type A. You can access this page by first going to the package, class or interface, then clicking on the "Use" link in the navigation bar.
    -

    -Tree (Class Hierarchy)

    -
    -There is a Class Hierarchy page for all packages, plus a hierarchy for each package. Each hierarchy page contains a list of classes and a list of interfaces. The classes are organized by inheritance structure starting with java.lang.Object. The interfaces do not inherit from java.lang.Object.
      -
    • When viewing the Overview page, clicking on "Tree" displays the hierarchy for all packages.
    • When viewing a particular package, class or interface page, clicking "Tree" displays the hierarchy for only that package.
    -
    -

    -Deprecated API

    -
    -The Deprecated API page lists all of the API that have been deprecated. A deprecated API is not recommended for use, generally due to improvements, and a replacement API is usually given. Deprecated APIs may be removed in future implementations.
    -

    -Index

    -
    -The Index contains an alphabetic list of all classes, interfaces, constructors, methods, and fields.
    -

    -Prev/Next

    -These links take you to the next or previous class, interface, package, or related page.

    -Frames/No Frames

    -These links show and hide the HTML frames. All pages are available with or without frames. -

    -

    -Serialized Form

    -Each serializable or externalizable class has a description of its serialization fields and methods. This information is of interest to re-implementors, not to developers using the API. While there is no link in the navigation bar, you can get to this information by going to any serialized class and clicking "Serialized Form" in the "See also" section of the class description. -

    -

    -Constant Field Values

    -The Constant Field Values page lists the static final fields and their values. -

    - - -This help file applies to API documentation generated using the standard doclet. - -
    -


    - - - - - - - - - - - - - - - -
    - -
    - - - -
    - - - + + + + + + +API Help + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + +
    + +
    + + + +
    +
    +

    +How This API Document Is Organized

    +
    +This API (Application Programming Interface) document has pages corresponding to the items in the navigation bar, described as follows.

    +Overview

    +
    + +

    +The Overview page is the front page of this API document and provides a list of all packages with a summary for each. This page can also contain an overall description of the set of packages.

    +

    +Package

    +
    + +

    +Each package has a page that contains a list of its classes and interfaces, with a summary for each. This page can contain four categories:

      +
    • Interfaces (italic)
    • Classes
    • Enums
    • Exceptions
    • Errors
    • Annotation Types
    +
    +

    +Class/Interface

    +
    + +

    +Each class, interface, nested class and nested interface has its own separate page. Each of these pages has three sections consisting of a class/interface description, summary tables, and detailed member descriptions:

      +
    • Class inheritance diagram
    • Direct Subclasses
    • All Known Subinterfaces
    • All Known Implementing Classes
    • Class/interface declaration
    • Class/interface description +

      +

    • Nested Class Summary
    • Field Summary
    • Constructor Summary
    • Method Summary +

      +

    • Field Detail
    • Constructor Detail
    • Method Detail
    +Each summary entry contains the first sentence from the detailed description for that item. The summary entries are alphabetical, while the detailed descriptions are in the order they appear in the source code. This preserves the logical groupings established by the programmer.
    + +

    +Annotation Type

    +
    + +

    +Each annotation type has its own separate page with the following sections:

      +
    • Annotation Type declaration
    • Annotation Type description
    • Required Element Summary
    • Optional Element Summary
    • Element Detail
    +
    + +

    +Enum

    +
    + +

    +Each enum has its own separate page with the following sections:

      +
    • Enum declaration
    • Enum description
    • Enum Constant Summary
    • Enum Constant Detail
    +
    +

    +Use

    +
    +Each documented package, class and interface has its own Use page. This page describes what packages, classes, methods, constructors and fields use any part of the given class or package. Given a class or interface A, its Use page includes subclasses of A, fields declared as A, methods that return A, and methods and constructors with parameters of type A. You can access this page by first going to the package, class or interface, then clicking on the "Use" link in the navigation bar.
    +

    +Tree (Class Hierarchy)

    +
    +There is a Class Hierarchy page for all packages, plus a hierarchy for each package. Each hierarchy page contains a list of classes and a list of interfaces. The classes are organized by inheritance structure starting with java.lang.Object. The interfaces do not inherit from java.lang.Object.
      +
    • When viewing the Overview page, clicking on "Tree" displays the hierarchy for all packages.
    • When viewing a particular package, class or interface page, clicking "Tree" displays the hierarchy for only that package.
    +
    +

    +Deprecated API

    +
    +The Deprecated API page lists all of the API that have been deprecated. A deprecated API is not recommended for use, generally due to improvements, and a replacement API is usually given. Deprecated APIs may be removed in future implementations.
    +

    +Index

    +
    +The Index contains an alphabetic list of all classes, interfaces, constructors, methods, and fields.
    +

    +Prev/Next

    +These links take you to the next or previous class, interface, package, or related page.

    +Frames/No Frames

    +These links show and hide the HTML frames. All pages are available with or without frames. +

    +

    +Serialized Form

    +Each serializable or externalizable class has a description of its serialization fields and methods. This information is of interest to re-implementors, not to developers using the API. While there is no link in the navigation bar, you can get to this information by going to any serialized class and clicking "Serialized Form" in the "See also" section of the class description. +

    +

    +Constant Field Values

    +The Constant Field Values page lists the static final fields and their values. +

    + + +This help file applies to API documentation generated using the standard doclet. + +
    +


    + + + + + + + + + + + + + + + +
    + +
    + + + +
    + + + diff --git a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/index-files/index-1.html b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/index-files/index-1.html index 410881fd5c8..1ae9adccffd 100644 --- a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/index-files/index-1.html +++ b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/index-files/index-1.html @@ -1,218 +1,218 @@ - - - - - - -A-Index - - - - - - - - - - - - -
    - - - - - - - - - - - - - - - -
    - -
    - - - -A B C D E F G I L M N O P R S U V
    -

    -A

    -
    -
    addButton - -Variable in class org.eclipse.cdt.managedbuilder.llvm.ui.preferences.LlvmListEditor -
    The Add button. -
    addIncludePath(String) - -Static method in class org.eclipse.cdt.managedbuilder.llvm.ui.LlvmEnvironmentVariableSupplier -
    Append a new include path. -
    addIncludePathToToolOption(IConfiguration, ITool, IOption, String) - -Static method in class org.eclipse.cdt.managedbuilder.llvm.util.LlvmToolOptionPathUtil -
    Adds include path for given Build configuration's Tool's Include path Option. -
    addInputToToolOption(IConfiguration, ITool, IOption, String, String[]) - -Static method in class org.eclipse.cdt.managedbuilder.llvm.util.LlvmToolOptionPathUtil -
    Adds a new value to specific Option. -
    addLibrary(String) - -Static method in class org.eclipse.cdt.managedbuilder.llvm.ui.LlvmEnvironmentVariableSupplier -
    Append a new library. -
    addLibraryPath(String) - -Static method in class org.eclipse.cdt.managedbuilder.llvm.ui.LlvmEnvironmentVariableSupplier -
    Append a new library path. -
    addLibrarySearchPathToToolOption(IConfiguration, ITool, IOption, String) - -Static method in class org.eclipse.cdt.managedbuilder.llvm.util.LlvmToolOptionPathUtil -
    Adds new Library search path for the Linker's Library search path Option. -
    addLibraryToToolOption(IConfiguration, ITool, IOption, String) - -Static method in class org.eclipse.cdt.managedbuilder.llvm.util.LlvmToolOptionPathUtil -
    Adds new Library for the Linker's Libraries Option. -
    addLlvmIncludePath(String) - -Static method in class org.eclipse.cdt.managedbuilder.llvm.util.LlvmToolOptionPathUtil + + + + + + +A-Index + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + +
    + +
    + + + +A B C D E F G I L M N O P R S U V
    +

    +A

    +
    +
    addButton - +Variable in class org.eclipse.cdt.managedbuilder.llvm.ui.preferences.LlvmListEditor +
    The Add button. +
    addIncludePath(String) - +Static method in class org.eclipse.cdt.managedbuilder.llvm.ui.LlvmEnvironmentVariableSupplier +
    Append a new include path. +
    addIncludePathToToolOption(IConfiguration, ITool, IOption, String) - +Static method in class org.eclipse.cdt.managedbuilder.llvm.util.LlvmToolOptionPathUtil +
    Adds include path for given Build configuration's Tool's Include path Option. +
    addInputToToolOption(IConfiguration, ITool, IOption, String, String[]) - +Static method in class org.eclipse.cdt.managedbuilder.llvm.util.LlvmToolOptionPathUtil +
    Adds a new value to specific Option. +
    addLibrary(String) - +Static method in class org.eclipse.cdt.managedbuilder.llvm.ui.LlvmEnvironmentVariableSupplier +
    Append a new library. +
    addLibraryPath(String) - +Static method in class org.eclipse.cdt.managedbuilder.llvm.ui.LlvmEnvironmentVariableSupplier +
    Append a new library path. +
    addLibrarySearchPathToToolOption(IConfiguration, ITool, IOption, String) - +Static method in class org.eclipse.cdt.managedbuilder.llvm.util.LlvmToolOptionPathUtil +
    Adds new Library search path for the Linker's Library search path Option. +
    addLibraryToToolOption(IConfiguration, ITool, IOption, String) - +Static method in class org.eclipse.cdt.managedbuilder.llvm.util.LlvmToolOptionPathUtil +
    Adds new Library for the Linker's Libraries Option. +
    addLlvmIncludePath(String) - +Static method in class org.eclipse.cdt.managedbuilder.llvm.util.LlvmToolOptionPathUtil
    Adds new include path to LLVM Assembler's Include path option for every project - in the workspace that use LLVM Toolchain and for for every build configuration. -
    addLlvmIncludePathToToolOption(IConfiguration, String) - -Static method in class org.eclipse.cdt.managedbuilder.llvm.util.LlvmToolOptionPathUtil -
    Adds an include path to LLVM front-end's include path option. -
    addLlvmLib(String) - -Static method in class org.eclipse.cdt.managedbuilder.llvm.util.LlvmToolOptionPathUtil + in the workspace that use LLVM Toolchain and for for every build configuration. +
    addLlvmIncludePathToToolOption(IConfiguration, String) - +Static method in class org.eclipse.cdt.managedbuilder.llvm.util.LlvmToolOptionPathUtil +
    Adds an include path to LLVM front-end's include path option. +
    addLlvmLib(String) - +Static method in class org.eclipse.cdt.managedbuilder.llvm.util.LlvmToolOptionPathUtil
    Adds a new Library to LLVM linker's Libraries Option for every project - in the workspace that use LLVM Toolchain and for for every build configuration. -
    addLlvmLibSearchPath(String) - -Static method in class org.eclipse.cdt.managedbuilder.llvm.util.LlvmToolOptionPathUtil + in the workspace that use LLVM Toolchain and for for every build configuration. +
    addLlvmLibSearchPath(String) - +Static method in class org.eclipse.cdt.managedbuilder.llvm.util.LlvmToolOptionPathUtil
    Adds a new Library search path directory to LLVM linker's Library search path Option for every project in the workspace that use LLVM Toolchain and for for every - build configuration. -
    addLlvmLibSearchPathToToolOption(IConfiguration, String) - -Static method in class org.eclipse.cdt.managedbuilder.llvm.util.LlvmToolOptionPathUtil -
    Adds a Library search path to LLVM linker's Library search path Option. -
    addLlvmLibToToolOption(IConfiguration, String) - -Static method in class org.eclipse.cdt.managedbuilder.llvm.util.LlvmToolOptionPathUtil -
    Adds a Library to LLVM linker's Libraries Option. -
    addNewPathToExistingPathList(String[], String) - -Static method in class org.eclipse.cdt.managedbuilder.llvm.util.LlvmToolOptionPathUtil -
    Adds one or more paths to the list of paths. -
    addPathToSelectedToolOptionBuildConf(IConfiguration, String, int) - -Static method in class org.eclipse.cdt.managedbuilder.llvm.util.LlvmToolOptionPathUtil -
    Add a path to specific build configuration's Tool option. -
    addPathToToolOption(String, int) - -Static method in class org.eclipse.cdt.managedbuilder.llvm.util.LlvmToolOptionPathUtil -
    Adds a path to Tool option. -
    addPressed() - -Method in class org.eclipse.cdt.managedbuilder.llvm.ui.preferences.LlvmListEditor -
    Notifies that the Add button has been pressed. -
    appendIncludePath(String) - -Static method in class org.eclipse.cdt.managedbuilder.llvm.ui.preferences.LlvmPreferenceStore -
    Append an include path to the LLVM Preference store. -
    appendLibrary(String) - -Static method in class org.eclipse.cdt.managedbuilder.llvm.ui.preferences.LlvmPreferenceStore -
    Append a library to the LLVM Preference store. -
    appendLibraryPath(String) - -Static method in class org.eclipse.cdt.managedbuilder.llvm.ui.preferences.LlvmPreferenceStore -
    Append a library path to the LLVM Preference store. -
    appendLlvmEnvironmentVariable(String, String, String) - -Static method in class org.eclipse.cdt.managedbuilder.llvm.ui.LlvmEnvironmentVariableSupplier -
    Append a new LLVM environment variable to existing list. -
    appendValue(String, String) - -Static method in class org.eclipse.cdt.managedbuilder.llvm.ui.preferences.LlvmPreferenceStore -
    Append a new value to the Preference store if it doesn't already exists. -
    arrayToString(String[]) - -Static method in class org.eclipse.cdt.managedbuilder.llvm.util.LlvmToolOptionPathUtil -
    Append an array of Strings to a String separated by a path separator. -
    -
    - - - - - - - - - - - - - - - -
    - -
    - - - -A B C D E F G I L M N O P R S U V
    - - - + build configuration. +
    addLlvmLibSearchPathToToolOption(IConfiguration, String) - +Static method in class org.eclipse.cdt.managedbuilder.llvm.util.LlvmToolOptionPathUtil +
    Adds a Library search path to LLVM linker's Library search path Option. +
    addLlvmLibToToolOption(IConfiguration, String) - +Static method in class org.eclipse.cdt.managedbuilder.llvm.util.LlvmToolOptionPathUtil +
    Adds a Library to LLVM linker's Libraries Option. +
    addNewPathToExistingPathList(String[], String) - +Static method in class org.eclipse.cdt.managedbuilder.llvm.util.LlvmToolOptionPathUtil +
    Adds one or more paths to the list of paths. +
    addPathToSelectedToolOptionBuildConf(IConfiguration, String, int) - +Static method in class org.eclipse.cdt.managedbuilder.llvm.util.LlvmToolOptionPathUtil +
    Add a path to specific build configuration's Tool option. +
    addPathToToolOption(String, int) - +Static method in class org.eclipse.cdt.managedbuilder.llvm.util.LlvmToolOptionPathUtil +
    Adds a path to Tool option. +
    addPressed() - +Method in class org.eclipse.cdt.managedbuilder.llvm.ui.preferences.LlvmListEditor +
    Notifies that the Add button has been pressed. +
    appendIncludePath(String) - +Static method in class org.eclipse.cdt.managedbuilder.llvm.ui.preferences.LlvmPreferenceStore +
    Append an include path to the LLVM Preference store. +
    appendLibrary(String) - +Static method in class org.eclipse.cdt.managedbuilder.llvm.ui.preferences.LlvmPreferenceStore +
    Append a library to the LLVM Preference store. +
    appendLibraryPath(String) - +Static method in class org.eclipse.cdt.managedbuilder.llvm.ui.preferences.LlvmPreferenceStore +
    Append a library path to the LLVM Preference store. +
    appendLlvmEnvironmentVariable(String, String, String) - +Static method in class org.eclipse.cdt.managedbuilder.llvm.ui.LlvmEnvironmentVariableSupplier +
    Append a new LLVM environment variable to existing list. +
    appendValue(String, String) - +Static method in class org.eclipse.cdt.managedbuilder.llvm.ui.preferences.LlvmPreferenceStore +
    Append a new value to the Preference store if it doesn't already exists. +
    arrayToString(String[]) - +Static method in class org.eclipse.cdt.managedbuilder.llvm.util.LlvmToolOptionPathUtil +
    Append an array of Strings to a String separated by a path separator. +
    +
    + + + + + + + + + + + + + + + +
    + +
    + + + +A B C D E F G I L M N O P R S U V
    + + + diff --git a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/index-files/index-10.html b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/index-files/index-10.html index 7ed8a2f87e4..8bbc4c9f959 100644 --- a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/index-files/index-10.html +++ b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/index-files/index-10.html @@ -1,149 +1,149 @@ - - - - - - -M-Index - - - - - - - - - - - - -
    - - - - - - - - - - - - - - - -
    - -
    - - - -A B C D E F G I L M N O P R S U V
    -

    -M

    -
    + + + + + + +M-Index + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + +
    + +
    + + + +A B C D E F G I L M N O P R S U V
    +

    +M

    +
    ManagedLlvmScannerInfoConsoleParser - Class in org.eclipse.cdt.managedbuilder.llvm.scannerconfig
    Copy/pasted from org.eclipse.cdt.managedbuilder.internal.scannerconfig.ManagedGCCScannerInfoConsoleParser - because that class cannot be referenced to due to restrictions in the exported packages definition.
    ManagedLlvmScannerInfoConsoleParser() - -Constructor for class org.eclipse.cdt.managedbuilder.llvm.scannerconfig.ManagedLlvmScannerInfoConsoleParser -
      -
    Messages - Class in org.eclipse.cdt.managedbuilder.llvm.ui.preferences
     
    Messages() - -Constructor for class org.eclipse.cdt.managedbuilder.llvm.ui.preferences.Messages -
      -
    -
    - - - - - - - - - - - - - - - -
    - -
    - - - -A B C D E F G I L M N O P R S U V
    - - - + because that class cannot be referenced to due to restrictions in the exported packages definition.
    ManagedLlvmScannerInfoConsoleParser() - +Constructor for class org.eclipse.cdt.managedbuilder.llvm.scannerconfig.ManagedLlvmScannerInfoConsoleParser +
      +
    Messages - Class in org.eclipse.cdt.managedbuilder.llvm.ui.preferences
     
    Messages() - +Constructor for class org.eclipse.cdt.managedbuilder.llvm.ui.preferences.Messages +
      +
    +
    + + + + + + + + + + + + + + + +
    + +
    + + + +A B C D E F G I L M N O P R S U V
    + + + diff --git a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/index-files/index-11.html b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/index-files/index-11.html index 2c113ebf038..1c2a77dbd3d 100644 --- a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/index-files/index-11.html +++ b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/index-files/index-11.html @@ -1,148 +1,148 @@ - - - - - - -N-Index - - - - - - - - - - - - -
    - - - - - - - - - - - - - - - -
    - -
    - - - -A B C D E F G I L M N O P R S U V
    -

    -N

    -
    -
    name - -Variable in class org.eclipse.cdt.managedbuilder.llvm.ui.LlvmBuildEnvironmentVariable -
      -
    notifyPreferenceChange() - -Static method in class org.eclipse.cdt.managedbuilder.llvm.ui.LlvmEnvironmentVariableSupplier -
    This is to be called if some of the preference paths have changed. -
    -
    - - - - - - - - - - - - - - - -
    - -
    - - - -A B C D E F G I L M N O P R S U V
    - - - + + + + + + +N-Index + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + +
    + +
    + + + +A B C D E F G I L M N O P R S U V
    +

    +N

    +
    +
    name - +Variable in class org.eclipse.cdt.managedbuilder.llvm.ui.LlvmBuildEnvironmentVariable +
      +
    notifyPreferenceChange() - +Static method in class org.eclipse.cdt.managedbuilder.llvm.ui.LlvmEnvironmentVariableSupplier +
    This is to be called if some of the preference paths have changed. +
    +
    + + + + + + + + + + + + + + + +
    + +
    + + + +A B C D E F G I L M N O P R S U V
    + + + diff --git a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/index-files/index-12.html b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/index-files/index-12.html index 4f3274b491d..ef27b809cdd 100644 --- a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/index-files/index-12.html +++ b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/index-files/index-12.html @@ -1,145 +1,145 @@ - - - - - - -O-Index - - - - - - - - - - - - -
    - - - - - - - - - - - - - - - -
    - -
    - - - -A B C D E F G I L M N O P R S U V
    -

    -O

    -
    -
    operation - -Variable in class org.eclipse.cdt.managedbuilder.llvm.ui.LlvmBuildEnvironmentVariable -
      -
    org.eclipse.cdt.managedbuilder.llvm.makegen - package org.eclipse.cdt.managedbuilder.llvm.makegen
     
    org.eclipse.cdt.managedbuilder.llvm.scannerconfig - package org.eclipse.cdt.managedbuilder.llvm.scannerconfig
     
    org.eclipse.cdt.managedbuilder.llvm.ui - package org.eclipse.cdt.managedbuilder.llvm.ui
     
    org.eclipse.cdt.managedbuilder.llvm.ui.preferences - package org.eclipse.cdt.managedbuilder.llvm.ui.preferences
     
    org.eclipse.cdt.managedbuilder.llvm.util - package org.eclipse.cdt.managedbuilder.llvm.util
     
    -
    - - - - - - - - - - - - - - - -
    - -
    - - - -A B C D E F G I L M N O P R S U V
    - - - + + + + + + +O-Index + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + +
    + +
    + + + +A B C D E F G I L M N O P R S U V
    +

    +O

    +
    +
    operation - +Variable in class org.eclipse.cdt.managedbuilder.llvm.ui.LlvmBuildEnvironmentVariable +
      +
    org.eclipse.cdt.managedbuilder.llvm.makegen - package org.eclipse.cdt.managedbuilder.llvm.makegen
     
    org.eclipse.cdt.managedbuilder.llvm.scannerconfig - package org.eclipse.cdt.managedbuilder.llvm.scannerconfig
     
    org.eclipse.cdt.managedbuilder.llvm.ui - package org.eclipse.cdt.managedbuilder.llvm.ui
     
    org.eclipse.cdt.managedbuilder.llvm.ui.preferences - package org.eclipse.cdt.managedbuilder.llvm.ui.preferences
     
    org.eclipse.cdt.managedbuilder.llvm.util - package org.eclipse.cdt.managedbuilder.llvm.util
     
    +
    + + + + + + + + + + + + + + + +
    + +
    + + + +A B C D E F G I L M N O P R S U V
    + + + diff --git a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/index-files/index-13.html b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/index-files/index-13.html index a579641b358..b5c9e72c317 100644 --- a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/index-files/index-13.html +++ b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/index-files/index-13.html @@ -1,190 +1,190 @@ - - - - - - -P-Index - - - - - - - - - - - - -
    - - - - - - - - - - - - - - - -
    - -
    - - - -A B C D E F G I L M N O P R S U V
    -

    -P

    -
    -
    P_LLVM_INCLUDE_PATH - -Static variable in class org.eclipse.cdt.managedbuilder.llvm.ui.preferences.PreferenceConstants -
      -
    P_LLVM_LIBRARIES - -Static variable in class org.eclipse.cdt.managedbuilder.llvm.ui.preferences.PreferenceConstants -
      -
    P_LLVM_LIBRARY_PATH - -Static variable in class org.eclipse.cdt.managedbuilder.llvm.ui.preferences.PreferenceConstants -
      -
    P_LLVM_PATH - -Static variable in class org.eclipse.cdt.managedbuilder.llvm.ui.preferences.PreferenceConstants -
      -
    parseString(String) - -Method in class org.eclipse.cdt.managedbuilder.llvm.ui.preferences.LlvmListEditor -
      -
    pathExists(String) - -Static method in class org.eclipse.cdt.managedbuilder.llvm.util.LlvmToolOptionPathUtil -
    Checks if a file path exists. -
    pathSeparator - -Static variable in class org.eclipse.cdt.managedbuilder.llvm.util.Separators -
      -
    plugin - -Static variable in class org.eclipse.cdt.managedbuilder.llvm.ui.LlvmUIPlugin -
      -
    PLUGIN_ID - -Static variable in class org.eclipse.cdt.managedbuilder.llvm.ui.LlvmUIPlugin -
      -
    PreferenceConstants - Class in org.eclipse.cdt.managedbuilder.llvm.ui.preferences
    Constant definitions for plug-in preferences
    PreferenceConstants() - -Constructor for class org.eclipse.cdt.managedbuilder.llvm.ui.preferences.PreferenceConstants -
      -
    PreferenceInitializer - Class in org.eclipse.cdt.managedbuilder.llvm.ui.preferences
    Class used to initialize the default preference values.
    PreferenceInitializer() - -Constructor for class org.eclipse.cdt.managedbuilder.llvm.ui.preferences.PreferenceInitializer -
      -
    preferencesChanged - -Static variable in class org.eclipse.cdt.managedbuilder.llvm.ui.LlvmEnvironmentVariableSupplier -
      -
    processLine(String) - -Method in class org.eclipse.cdt.managedbuilder.llvm.scannerconfig.ManagedLlvmScannerInfoConsoleParser -
      -
    project - -Variable in class org.eclipse.cdt.managedbuilder.llvm.ui.LlvmProjectNature -
      -
    PROPERTIES - -Static variable in class org.eclipse.cdt.managedbuilder.llvm.ui.LlvmUIPlugin -
      -
    properties - -Variable in class org.eclipse.cdt.managedbuilder.llvm.ui.LlvmUIPlugin -
      -
    -
    - - - - - - - - - - - - - - - -
    - -
    - - - -A B C D E F G I L M N O P R S U V
    - - - + + + + + + +P-Index + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + +
    + +
    + + + +A B C D E F G I L M N O P R S U V
    +

    +P

    +
    +
    P_LLVM_INCLUDE_PATH - +Static variable in class org.eclipse.cdt.managedbuilder.llvm.ui.preferences.PreferenceConstants +
      +
    P_LLVM_LIBRARIES - +Static variable in class org.eclipse.cdt.managedbuilder.llvm.ui.preferences.PreferenceConstants +
      +
    P_LLVM_LIBRARY_PATH - +Static variable in class org.eclipse.cdt.managedbuilder.llvm.ui.preferences.PreferenceConstants +
      +
    P_LLVM_PATH - +Static variable in class org.eclipse.cdt.managedbuilder.llvm.ui.preferences.PreferenceConstants +
      +
    parseString(String) - +Method in class org.eclipse.cdt.managedbuilder.llvm.ui.preferences.LlvmListEditor +
      +
    pathExists(String) - +Static method in class org.eclipse.cdt.managedbuilder.llvm.util.LlvmToolOptionPathUtil +
    Checks if a file path exists. +
    pathSeparator - +Static variable in class org.eclipse.cdt.managedbuilder.llvm.util.Separators +
      +
    plugin - +Static variable in class org.eclipse.cdt.managedbuilder.llvm.ui.LlvmUIPlugin +
      +
    PLUGIN_ID - +Static variable in class org.eclipse.cdt.managedbuilder.llvm.ui.LlvmUIPlugin +
      +
    PreferenceConstants - Class in org.eclipse.cdt.managedbuilder.llvm.ui.preferences
    Constant definitions for plug-in preferences
    PreferenceConstants() - +Constructor for class org.eclipse.cdt.managedbuilder.llvm.ui.preferences.PreferenceConstants +
      +
    PreferenceInitializer - Class in org.eclipse.cdt.managedbuilder.llvm.ui.preferences
    Class used to initialize the default preference values.
    PreferenceInitializer() - +Constructor for class org.eclipse.cdt.managedbuilder.llvm.ui.preferences.PreferenceInitializer +
      +
    preferencesChanged - +Static variable in class org.eclipse.cdt.managedbuilder.llvm.ui.LlvmEnvironmentVariableSupplier +
      +
    processLine(String) - +Method in class org.eclipse.cdt.managedbuilder.llvm.scannerconfig.ManagedLlvmScannerInfoConsoleParser +
      +
    project - +Variable in class org.eclipse.cdt.managedbuilder.llvm.ui.LlvmProjectNature +
      +
    PROPERTIES - +Static variable in class org.eclipse.cdt.managedbuilder.llvm.ui.LlvmUIPlugin +
      +
    properties - +Variable in class org.eclipse.cdt.managedbuilder.llvm.ui.LlvmUIPlugin +
      +
    +
    + + + + + + + + + + + + + + + +
    + +
    + + + +A B C D E F G I L M N O P R S U V
    + + + diff --git a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/index-files/index-14.html b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/index-files/index-14.html index 8701020419f..258c895d04d 100644 --- a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/index-files/index-14.html +++ b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/index-files/index-14.html @@ -1,215 +1,215 @@ - - - - - - -R-Index - - - - - - - - - - - - -
    - - - - - - - - - - - - - - - -
    - -
    - - - -A B C D E F G I L M N O P R S U V
    -

    -R

    -
    -
    removeButton - -Variable in class org.eclipse.cdt.managedbuilder.llvm.ui.preferences.LlvmListEditor -
    The Remove button. -
    removeIncludePath(String) - -Static method in class org.eclipse.cdt.managedbuilder.llvm.ui.preferences.LlvmPreferenceStore -
    Remove a include path from the LLVM preference store. -
    removeIncludePathFromToolOption(IConfiguration, ITool, IOption, String) - -Static method in class org.eclipse.cdt.managedbuilder.llvm.util.LlvmToolOptionPathUtil -
    Removes an include path from given Build configuration's Tool's Include path Option. -
    removeInputFromToolOption(IConfiguration, ITool, IOption, String, String[]) - -Static method in class org.eclipse.cdt.managedbuilder.llvm.util.LlvmToolOptionPathUtil -
    Removes a value from a specific Option. -
    removeLibrary(String) - -Static method in class org.eclipse.cdt.managedbuilder.llvm.ui.preferences.LlvmPreferenceStore -
    Remove a library from the LLVM preference store. -
    removeLibraryFromToolOption(IConfiguration, ITool, IOption, String) - -Static method in class org.eclipse.cdt.managedbuilder.llvm.util.LlvmToolOptionPathUtil -
    Removes a new Library from the Linker's Libraries Option. -
    removeLibraryPath(String) - -Static method in class org.eclipse.cdt.managedbuilder.llvm.ui.preferences.LlvmPreferenceStore -
    Remove a library path from the LLVM preference store. -
    removeLibrarySearchPathFromToolOption(IConfiguration, ITool, IOption, String) - -Static method in class org.eclipse.cdt.managedbuilder.llvm.util.LlvmToolOptionPathUtil -
    Removes a Library search path from the Linker's Library search path Option. -
    removeLlvmIncludePath(String) - -Static method in class org.eclipse.cdt.managedbuilder.llvm.util.LlvmToolOptionPathUtil + + + + + + +R-Index + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + +
    + +
    + + + +A B C D E F G I L M N O P R S U V
    +

    +R

    +
    +
    removeButton - +Variable in class org.eclipse.cdt.managedbuilder.llvm.ui.preferences.LlvmListEditor +
    The Remove button. +
    removeIncludePath(String) - +Static method in class org.eclipse.cdt.managedbuilder.llvm.ui.preferences.LlvmPreferenceStore +
    Remove a include path from the LLVM preference store. +
    removeIncludePathFromToolOption(IConfiguration, ITool, IOption, String) - +Static method in class org.eclipse.cdt.managedbuilder.llvm.util.LlvmToolOptionPathUtil +
    Removes an include path from given Build configuration's Tool's Include path Option. +
    removeInputFromToolOption(IConfiguration, ITool, IOption, String, String[]) - +Static method in class org.eclipse.cdt.managedbuilder.llvm.util.LlvmToolOptionPathUtil +
    Removes a value from a specific Option. +
    removeLibrary(String) - +Static method in class org.eclipse.cdt.managedbuilder.llvm.ui.preferences.LlvmPreferenceStore +
    Remove a library from the LLVM preference store. +
    removeLibraryFromToolOption(IConfiguration, ITool, IOption, String) - +Static method in class org.eclipse.cdt.managedbuilder.llvm.util.LlvmToolOptionPathUtil +
    Removes a new Library from the Linker's Libraries Option. +
    removeLibraryPath(String) - +Static method in class org.eclipse.cdt.managedbuilder.llvm.ui.preferences.LlvmPreferenceStore +
    Remove a library path from the LLVM preference store. +
    removeLibrarySearchPathFromToolOption(IConfiguration, ITool, IOption, String) - +Static method in class org.eclipse.cdt.managedbuilder.llvm.util.LlvmToolOptionPathUtil +
    Removes a Library search path from the Linker's Library search path Option. +
    removeLlvmIncludePath(String) - +Static method in class org.eclipse.cdt.managedbuilder.llvm.util.LlvmToolOptionPathUtil
    Removes an include path from LLVM Assembler's Include path option for every project - in the workspace that use LLVM Toolchain and for for every build configuration. -
    removeLlvmIncludePathFromToolOption(IConfiguration, String) - -Static method in class org.eclipse.cdt.managedbuilder.llvm.util.LlvmToolOptionPathUtil -
    Removes an include path from LLVM front-end's include path option. -
    removeLlvmLib(String) - -Static method in class org.eclipse.cdt.managedbuilder.llvm.util.LlvmToolOptionPathUtil + in the workspace that use LLVM Toolchain and for for every build configuration. +
    removeLlvmIncludePathFromToolOption(IConfiguration, String) - +Static method in class org.eclipse.cdt.managedbuilder.llvm.util.LlvmToolOptionPathUtil +
    Removes an include path from LLVM front-end's include path option. +
    removeLlvmLib(String) - +Static method in class org.eclipse.cdt.managedbuilder.llvm.util.LlvmToolOptionPathUtil
    Removes a Library to LLVM linker's Libraries Option for every project - in the workspace that use LLVM Toolchain and for for every build configuration. -
    removeLlvmLibFromToolOption(IConfiguration, String) - -Static method in class org.eclipse.cdt.managedbuilder.llvm.util.LlvmToolOptionPathUtil -
    Removes a Library from LLVM linker's Libraries Option. -
    removeLlvmLibSearchPath(String) - -Static method in class org.eclipse.cdt.managedbuilder.llvm.util.LlvmToolOptionPathUtil + in the workspace that use LLVM Toolchain and for for every build configuration. +
    removeLlvmLibFromToolOption(IConfiguration, String) - +Static method in class org.eclipse.cdt.managedbuilder.llvm.util.LlvmToolOptionPathUtil +
    Removes a Library from LLVM linker's Libraries Option. +
    removeLlvmLibSearchPath(String) - +Static method in class org.eclipse.cdt.managedbuilder.llvm.util.LlvmToolOptionPathUtil
    Removes a Library search path directory from LLVM linker's Library search path Option for every project in the workspace that use LLVM Toolchain and for for every - build configuration. -
    removeLlvmLibSearchPathFromToolOption(IConfiguration, String) - -Static method in class org.eclipse.cdt.managedbuilder.llvm.util.LlvmToolOptionPathUtil -
    Removes a Library search path from LLVM linker's Library search path Option. -
    removePathFromExistingPathList(String[], String) - -Static method in class org.eclipse.cdt.managedbuilder.llvm.util.LlvmToolOptionPathUtil -
    Removes one path from the list of paths. -
    removePathFromSelectedToolOptionBuildConf(IConfiguration, String, int) - -Static method in class org.eclipse.cdt.managedbuilder.llvm.util.LlvmToolOptionPathUtil -
    Removes a path from specific build configuration's Tool option. -
    removePathFromToolOption(String, int) - -Static method in class org.eclipse.cdt.managedbuilder.llvm.util.LlvmToolOptionPathUtil -
    Removes a path from Tool option. -
    removePressed() - -Method in class org.eclipse.cdt.managedbuilder.llvm.ui.preferences.IncludePathListEditor -
      -
    removePressed() - -Method in class org.eclipse.cdt.managedbuilder.llvm.ui.preferences.LibraryListEditor -
      -
    removePressed() - -Method in class org.eclipse.cdt.managedbuilder.llvm.ui.preferences.LibraryPathListEditor -
      -
    removePressed() - -Method in class org.eclipse.cdt.managedbuilder.llvm.ui.preferences.LlvmListEditor -
    Notifies that the Remove button has been pressed. -
    removeValue(String, String) - -Static method in class org.eclipse.cdt.managedbuilder.llvm.ui.preferences.LlvmPreferenceStore -
    Remove a value from the LLVM preference store. -
    resourceBundle - -Variable in class org.eclipse.cdt.managedbuilder.llvm.ui.LlvmUIPlugin -
      -
    -
    - - - - - - - - - - - - - - - -
    - -
    - - - -A B C D E F G I L M N O P R S U V
    - - - + build configuration. +
    removeLlvmLibSearchPathFromToolOption(IConfiguration, String) - +Static method in class org.eclipse.cdt.managedbuilder.llvm.util.LlvmToolOptionPathUtil +
    Removes a Library search path from LLVM linker's Library search path Option. +
    removePathFromExistingPathList(String[], String) - +Static method in class org.eclipse.cdt.managedbuilder.llvm.util.LlvmToolOptionPathUtil +
    Removes one path from the list of paths. +
    removePathFromSelectedToolOptionBuildConf(IConfiguration, String, int) - +Static method in class org.eclipse.cdt.managedbuilder.llvm.util.LlvmToolOptionPathUtil +
    Removes a path from specific build configuration's Tool option. +
    removePathFromToolOption(String, int) - +Static method in class org.eclipse.cdt.managedbuilder.llvm.util.LlvmToolOptionPathUtil +
    Removes a path from Tool option. +
    removePressed() - +Method in class org.eclipse.cdt.managedbuilder.llvm.ui.preferences.IncludePathListEditor +
      +
    removePressed() - +Method in class org.eclipse.cdt.managedbuilder.llvm.ui.preferences.LibraryListEditor +
      +
    removePressed() - +Method in class org.eclipse.cdt.managedbuilder.llvm.ui.preferences.LibraryPathListEditor +
      +
    removePressed() - +Method in class org.eclipse.cdt.managedbuilder.llvm.ui.preferences.LlvmListEditor +
    Notifies that the Remove button has been pressed. +
    removeValue(String, String) - +Static method in class org.eclipse.cdt.managedbuilder.llvm.ui.preferences.LlvmPreferenceStore +
    Remove a value from the LLVM preference store. +
    resourceBundle - +Variable in class org.eclipse.cdt.managedbuilder.llvm.ui.LlvmUIPlugin +
      +
    +
    + + + + + + + + + + + + + + + +
    + +
    + + + +A B C D E F G I L M N O P R S U V
    + + + diff --git a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/index-files/index-15.html b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/index-files/index-15.html index 2977f1294b8..2bd5369a0b1 100644 --- a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/index-files/index-15.html +++ b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/index-files/index-15.html @@ -1,199 +1,199 @@ - - - - - - -S-Index - - - - - - - - - - - - -
    - - - - - - - - - - - - - - - -
    - -
    - - - -A B C D E F G I L M N O P R S U V
    -

    -S

    -
    -
    selectionChanged() - -Method in class org.eclipse.cdt.managedbuilder.llvm.ui.preferences.LlvmListEditor -
    Invoked when the selection in the list has changed. -
    selectionListener - -Variable in class org.eclipse.cdt.managedbuilder.llvm.ui.preferences.LlvmListEditor -
    The selection listener. -
    Separators - Class in org.eclipse.cdt.managedbuilder.llvm.util
    Provides different separators such as file and path separators.
    Separators() - -Constructor for class org.eclipse.cdt.managedbuilder.llvm.util.Separators -
      -
    setBinPath(String) - -Static method in class org.eclipse.cdt.managedbuilder.llvm.ui.LlvmEnvironmentVariableSupplier -
    Set path to LLVM bin. -
    setBinPath(String) - -Static method in class org.eclipse.cdt.managedbuilder.llvm.ui.preferences.LlvmPreferenceStore -
    Set LLVM bin path to the LLVM Preference store. -
    setIncludePath(String) - -Static method in class org.eclipse.cdt.managedbuilder.llvm.ui.preferences.LlvmPreferenceStore -
    Set LLVM include path to the LLVM Preference store. -
    setLibrary(String) - -Static method in class org.eclipse.cdt.managedbuilder.llvm.ui.preferences.LlvmPreferenceStore -
    Set LLVM library to the LLVM Preference store. -
    setLibraryPath(String) - -Static method in class org.eclipse.cdt.managedbuilder.llvm.ui.preferences.LlvmPreferenceStore -
    Set LLVM library path to the LLVM Preference store. -
    setLlvmEnvironmentVariable(String, String) - -Static method in class org.eclipse.cdt.managedbuilder.llvm.ui.LlvmEnvironmentVariableSupplier -
    Set LLVM environment variable. -
    setLlvmEnvironmentVariableReplace(String, String) - -Static method in class org.eclipse.cdt.managedbuilder.llvm.ui.LlvmEnvironmentVariableSupplier -
    Set LLVM environment variable by replacing the existing paths. -
    setPreferenceStoreValue(String, String) - -Static method in class org.eclipse.cdt.managedbuilder.llvm.ui.preferences.LlvmPreferenceStore -
    Set LLVM Preference store value. -
    setProject(IProject) - -Method in class org.eclipse.cdt.managedbuilder.llvm.ui.LlvmProjectNature -
    Set the project. -
    shutdown() - -Method in class org.eclipse.cdt.managedbuilder.llvm.scannerconfig.ManagedLlvmScannerInfoConsoleParser -
      -
    start(BundleContext) - -Method in class org.eclipse.cdt.managedbuilder.llvm.ui.LlvmUIPlugin -
      -
    startup(IProject, IScannerInfoCollector) - -Method in class org.eclipse.cdt.managedbuilder.llvm.scannerconfig.ManagedLlvmScannerInfoConsoleParser -
      -
    stop(BundleContext) - -Method in class org.eclipse.cdt.managedbuilder.llvm.ui.LlvmUIPlugin -
      -
    stringToArray(String) - -Static method in class org.eclipse.cdt.managedbuilder.llvm.util.LlvmToolOptionPathUtil -
    Split paths to a String array. -
    supported - -Variable in class org.eclipse.cdt.managedbuilder.llvm.ui.LlvmIsToolChainSupported -
      -
    swap(boolean) - -Method in class org.eclipse.cdt.managedbuilder.llvm.ui.preferences.LlvmListEditor -
    Moves the currently selected item up or down. -
    -
    - - - - - - - - - - - - - - - -
    - -
    - - - -A B C D E F G I L M N O P R S U V
    - - - + + + + + + +S-Index + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + +
    + +
    + + + +A B C D E F G I L M N O P R S U V
    +

    +S

    +
    +
    selectionChanged() - +Method in class org.eclipse.cdt.managedbuilder.llvm.ui.preferences.LlvmListEditor +
    Invoked when the selection in the list has changed. +
    selectionListener - +Variable in class org.eclipse.cdt.managedbuilder.llvm.ui.preferences.LlvmListEditor +
    The selection listener. +
    Separators - Class in org.eclipse.cdt.managedbuilder.llvm.util
    Provides different separators such as file and path separators.
    Separators() - +Constructor for class org.eclipse.cdt.managedbuilder.llvm.util.Separators +
      +
    setBinPath(String) - +Static method in class org.eclipse.cdt.managedbuilder.llvm.ui.LlvmEnvironmentVariableSupplier +
    Set path to LLVM bin. +
    setBinPath(String) - +Static method in class org.eclipse.cdt.managedbuilder.llvm.ui.preferences.LlvmPreferenceStore +
    Set LLVM bin path to the LLVM Preference store. +
    setIncludePath(String) - +Static method in class org.eclipse.cdt.managedbuilder.llvm.ui.preferences.LlvmPreferenceStore +
    Set LLVM include path to the LLVM Preference store. +
    setLibrary(String) - +Static method in class org.eclipse.cdt.managedbuilder.llvm.ui.preferences.LlvmPreferenceStore +
    Set LLVM library to the LLVM Preference store. +
    setLibraryPath(String) - +Static method in class org.eclipse.cdt.managedbuilder.llvm.ui.preferences.LlvmPreferenceStore +
    Set LLVM library path to the LLVM Preference store. +
    setLlvmEnvironmentVariable(String, String) - +Static method in class org.eclipse.cdt.managedbuilder.llvm.ui.LlvmEnvironmentVariableSupplier +
    Set LLVM environment variable. +
    setLlvmEnvironmentVariableReplace(String, String) - +Static method in class org.eclipse.cdt.managedbuilder.llvm.ui.LlvmEnvironmentVariableSupplier +
    Set LLVM environment variable by replacing the existing paths. +
    setPreferenceStoreValue(String, String) - +Static method in class org.eclipse.cdt.managedbuilder.llvm.ui.preferences.LlvmPreferenceStore +
    Set LLVM Preference store value. +
    setProject(IProject) - +Method in class org.eclipse.cdt.managedbuilder.llvm.ui.LlvmProjectNature +
    Set the project. +
    shutdown() - +Method in class org.eclipse.cdt.managedbuilder.llvm.scannerconfig.ManagedLlvmScannerInfoConsoleParser +
      +
    start(BundleContext) - +Method in class org.eclipse.cdt.managedbuilder.llvm.ui.LlvmUIPlugin +
      +
    startup(IProject, IScannerInfoCollector) - +Method in class org.eclipse.cdt.managedbuilder.llvm.scannerconfig.ManagedLlvmScannerInfoConsoleParser +
      +
    stop(BundleContext) - +Method in class org.eclipse.cdt.managedbuilder.llvm.ui.LlvmUIPlugin +
      +
    stringToArray(String) - +Static method in class org.eclipse.cdt.managedbuilder.llvm.util.LlvmToolOptionPathUtil +
    Split paths to a String array. +
    supported - +Variable in class org.eclipse.cdt.managedbuilder.llvm.ui.LlvmIsToolChainSupported +
      +
    swap(boolean) - +Method in class org.eclipse.cdt.managedbuilder.llvm.ui.preferences.LlvmListEditor +
    Moves the currently selected item up or down. +
    +
    + + + + + + + + + + + + + + + +
    + +
    + + + +A B C D E F G I L M N O P R S U V
    + + + diff --git a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/index-files/index-16.html b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/index-files/index-16.html index 180b5cad72b..5d1b062a77e 100644 --- a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/index-files/index-16.html +++ b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/index-files/index-16.html @@ -1,148 +1,148 @@ - - - - - - -U-Index - - - - - - - - - - - - -
    - - - - - - - - - - - - - - - -
    - -
    - - - -A B C D E F G I L M N O P R S U V
    -

    -U

    -
    -
    upButton - -Variable in class org.eclipse.cdt.managedbuilder.llvm.ui.preferences.LlvmListEditor -
    The Up button. -
    upPressed() - -Method in class org.eclipse.cdt.managedbuilder.llvm.ui.preferences.LlvmListEditor -
    Notifies that the Up button has been pressed. -
    -
    - - - - - - - - - - - - - - - -
    - -
    - - - -A B C D E F G I L M N O P R S U V
    - - - + + + + + + +U-Index + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + +
    + +
    + + + +A B C D E F G I L M N O P R S U V
    +

    +U

    +
    +
    upButton - +Variable in class org.eclipse.cdt.managedbuilder.llvm.ui.preferences.LlvmListEditor +
    The Up button. +
    upPressed() - +Method in class org.eclipse.cdt.managedbuilder.llvm.ui.preferences.LlvmListEditor +
    Notifies that the Up button has been pressed. +
    +
    + + + + + + + + + + + + + + + +
    + +
    + + + +A B C D E F G I L M N O P R S U V
    + + + diff --git a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/index-files/index-17.html b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/index-files/index-17.html index 7d1111f34e7..736692406a3 100644 --- a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/index-files/index-17.html +++ b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/index-files/index-17.html @@ -1,145 +1,145 @@ - - - - - - -V-Index - - - - - - - - - - - - -
    - - - - - - - - - - - - - - - -
    - -
    - - - -A B C D E F G I L M N O P R S U V
    -

    -V

    -
    -
    value - -Variable in class org.eclipse.cdt.managedbuilder.llvm.ui.LlvmBuildEnvironmentVariable -
      -
    -
    - - - - - - - - - - - - - - - -
    - -
    - - - -A B C D E F G I L M N O P R S U V
    - - - + + + + + + +V-Index + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + +
    + +
    + + + +A B C D E F G I L M N O P R S U V
    +

    +V

    +
    +
    value - +Variable in class org.eclipse.cdt.managedbuilder.llvm.ui.LlvmBuildEnvironmentVariable +
      +
    +
    + + + + + + + + + + + + + + + +
    + +
    + + + +A B C D E F G I L M N O P R S U V
    + + + diff --git a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/index-files/index-2.html b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/index-files/index-2.html index f55137b47b2..c0046824779 100644 --- a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/index-files/index-2.html +++ b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/index-files/index-2.html @@ -1,149 +1,149 @@ - - - - - - -B-Index - - - - - - - - - - - - -
    - - - - - - - - - - - - - - - -
    - -
    - - - -A B C D E F G I L M N O P R S U V
    -

    -B

    -
    -
    BUNDLE_NAME - -Static variable in class org.eclipse.cdt.managedbuilder.llvm.ui.preferences.Messages -
      -
    buttonBox - -Variable in class org.eclipse.cdt.managedbuilder.llvm.ui.preferences.LlvmListEditor + + + + + + +B-Index + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + +
    + +
    + + + +A B C D E F G I L M N O P R S U V
    +

    +B

    +
    +
    BUNDLE_NAME - +Static variable in class org.eclipse.cdt.managedbuilder.llvm.ui.preferences.Messages +
      +
    buttonBox - +Variable in class org.eclipse.cdt.managedbuilder.llvm.ui.preferences.LlvmListEditor
    The button box containing the Add, Remove, Up, and Down buttons; - null if none (before creation or after disposal). -
    -
    - - - - - - - - - - - - - - - -
    - -
    - - - -A B C D E F G I L M N O P R S U V
    - - - + null if none (before creation or after disposal). +
    +
    + + + + + + + + + + + + + + + +
    + +
    + + + +A B C D E F G I L M N O P R S U V
    + + + diff --git a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/index-files/index-3.html b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/index-files/index-3.html index 1201b645056..ed4c7adb630 100644 --- a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/index-files/index-3.html +++ b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/index-files/index-3.html @@ -1,160 +1,160 @@ - - - - - - -C-Index - - - - - - - - - - - - -
    - - - - - - - - - - - - - - - -
    - -
    - - - -A B C D E F G I L M N O P R S U V
    -

    -C

    -
    -
    configure() - -Method in class org.eclipse.cdt.managedbuilder.llvm.ui.LlvmProjectNature -
    Configure the project which have this project nature. -
    createButtons(Composite) - -Method in class org.eclipse.cdt.managedbuilder.llvm.ui.preferences.LlvmListEditor -
    Creates the Add, Remove, Up, and Down button in the given button box. -
    createFieldEditors() - -Method in class org.eclipse.cdt.managedbuilder.llvm.ui.preferences.LlvmPreferencePage -
      -
    createList(String[]) - -Method in class org.eclipse.cdt.managedbuilder.llvm.ui.preferences.LlvmListEditor -
      -
    createPushButton(Composite, String) - -Method in class org.eclipse.cdt.managedbuilder.llvm.ui.preferences.LlvmListEditor -
    Helper method to create a push button. -
    createSelectionListener() - -Method in class org.eclipse.cdt.managedbuilder.llvm.ui.preferences.LlvmListEditor -
    Creates a selection listener. -
    -
    - - - - - - - - - - - - - - - -
    - -
    - - - -A B C D E F G I L M N O P R S U V
    - - - + + + + + + +C-Index + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + +
    + +
    + + + +A B C D E F G I L M N O P R S U V
    +

    +C

    +
    +
    configure() - +Method in class org.eclipse.cdt.managedbuilder.llvm.ui.LlvmProjectNature +
    Configure the project which have this project nature. +
    createButtons(Composite) - +Method in class org.eclipse.cdt.managedbuilder.llvm.ui.preferences.LlvmListEditor +
    Creates the Add, Remove, Up, and Down button in the given button box. +
    createFieldEditors() - +Method in class org.eclipse.cdt.managedbuilder.llvm.ui.preferences.LlvmPreferencePage +
      +
    createList(String[]) - +Method in class org.eclipse.cdt.managedbuilder.llvm.ui.preferences.LlvmListEditor +
      +
    createPushButton(Composite, String) - +Method in class org.eclipse.cdt.managedbuilder.llvm.ui.preferences.LlvmListEditor +
    Helper method to create a push button. +
    createSelectionListener() - +Method in class org.eclipse.cdt.managedbuilder.llvm.ui.preferences.LlvmListEditor +
    Creates a selection listener. +
    +
    + + + + + + + + + + + + + + + +
    + +
    + + + +A B C D E F G I L M N O P R S U V
    + + + diff --git a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/index-files/index-4.html b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/index-files/index-4.html index fe8466a67e3..9aca515eeda 100644 --- a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/index-files/index-4.html +++ b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/index-files/index-4.html @@ -1,154 +1,154 @@ - - - - - - -D-Index - - - - - - - - - - - - -
    - - - - - - - - - - - - - - - -
    - -
    - - - -A B C D E F G I L M N O P R S U V
    -

    -D

    -
    -
    deconfigure() - -Method in class org.eclipse.cdt.managedbuilder.llvm.ui.LlvmProjectNature -
    Deconfigure those projects which have this project nature. -
    doCalcManagedBuildOnState() - -Method in class org.eclipse.cdt.managedbuilder.llvm.scannerconfig.ManagedLlvmScannerInfoConsoleParser -
      -
    downButton - -Variable in class org.eclipse.cdt.managedbuilder.llvm.ui.preferences.LlvmListEditor -
    The Down button. -
    downPressed() - -Method in class org.eclipse.cdt.managedbuilder.llvm.ui.preferences.LlvmListEditor -
    Notifies that the Down button has been pressed. -
    -
    - - - - - - - - - - - - - - - -
    - -
    - - - -A B C D E F G I L M N O P R S U V
    - - - + + + + + + +D-Index + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + +
    + +
    + + + +A B C D E F G I L M N O P R S U V
    +

    +D

    +
    +
    deconfigure() - +Method in class org.eclipse.cdt.managedbuilder.llvm.ui.LlvmProjectNature +
    Deconfigure those projects which have this project nature. +
    doCalcManagedBuildOnState() - +Method in class org.eclipse.cdt.managedbuilder.llvm.scannerconfig.ManagedLlvmScannerInfoConsoleParser +
      +
    downButton - +Variable in class org.eclipse.cdt.managedbuilder.llvm.ui.preferences.LlvmListEditor +
    The Down button. +
    downPressed() - +Method in class org.eclipse.cdt.managedbuilder.llvm.ui.preferences.LlvmListEditor +
    Notifies that the Down button has been pressed. +
    +
    + + + + + + + + + + + + + + + +
    + +
    + + + +A B C D E F G I L M N O P R S U V
    + + + diff --git a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/index-files/index-5.html b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/index-files/index-5.html index c87910b191d..25bbd86075d 100644 --- a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/index-files/index-5.html +++ b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/index-files/index-5.html @@ -1,160 +1,160 @@ - - - - - - -E-Index - - - - - - - - - - - - -
    - - - - - - - - - - - - - - - -
    - -
    - - - -A B C D E F G I L M N O P R S U V
    -

    -E

    -
    -
    ENV_VAR_NAME_INCLUDE_PATH - -Static variable in class org.eclipse.cdt.managedbuilder.llvm.ui.LlvmEnvironmentVariableSupplier -
      -
    ENV_VAR_NAME_LIBRARIES - -Static variable in class org.eclipse.cdt.managedbuilder.llvm.ui.LlvmEnvironmentVariableSupplier -
      -
    ENV_VAR_NAME_LIBRARY_PATH - -Static variable in class org.eclipse.cdt.managedbuilder.llvm.ui.LlvmEnvironmentVariableSupplier -
      -
    ENV_VAR_NAME_LLVM_BIN - -Static variable in class org.eclipse.cdt.managedbuilder.llvm.ui.LlvmEnvironmentVariableSupplier -
      -
    ENV_VAR_NAME_LLVMINTERP - -Static variable in class org.eclipse.cdt.managedbuilder.llvm.ui.LlvmEnvironmentVariableSupplier -
      -
    ENV_VAR_NAME_PATH - -Static variable in class org.eclipse.cdt.managedbuilder.llvm.ui.LlvmEnvironmentVariableSupplier -
      -
    -
    - - - - - - - - - - - - - - - -
    - -
    - - - -A B C D E F G I L M N O P R S U V
    - - - + + + + + + +E-Index + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + +
    + +
    + + + +A B C D E F G I L M N O P R S U V
    +

    +E

    +
    +
    ENV_VAR_NAME_INCLUDE_PATH - +Static variable in class org.eclipse.cdt.managedbuilder.llvm.ui.LlvmEnvironmentVariableSupplier +
      +
    ENV_VAR_NAME_LIBRARIES - +Static variable in class org.eclipse.cdt.managedbuilder.llvm.ui.LlvmEnvironmentVariableSupplier +
      +
    ENV_VAR_NAME_LIBRARY_PATH - +Static variable in class org.eclipse.cdt.managedbuilder.llvm.ui.LlvmEnvironmentVariableSupplier +
      +
    ENV_VAR_NAME_LLVM_BIN - +Static variable in class org.eclipse.cdt.managedbuilder.llvm.ui.LlvmEnvironmentVariableSupplier +
      +
    ENV_VAR_NAME_LLVMINTERP - +Static variable in class org.eclipse.cdt.managedbuilder.llvm.ui.LlvmEnvironmentVariableSupplier +
      +
    ENV_VAR_NAME_PATH - +Static variable in class org.eclipse.cdt.managedbuilder.llvm.ui.LlvmEnvironmentVariableSupplier +
      +
    +
    + + + + + + + + + + + + + + + +
    + +
    + + + +A B C D E F G I L M N O P R S U V
    + + + diff --git a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/index-files/index-6.html b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/index-files/index-6.html index c90b2f01975..7108f12878c 100644 --- a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/index-files/index-6.html +++ b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/index-files/index-6.html @@ -1,151 +1,151 @@ - - - - - - -F-Index - - - - - - - - - - - - -
    - - - - - - - - - - - - - - - -
    - -
    - - - -A B C D E F G I L M N O P R S U V
    -

    -F

    -
    -
    fileSeparator - -Static variable in class org.eclipse.cdt.managedbuilder.llvm.util.Separators -
      -
    findBinDir(String, String) - -Static method in class org.eclipse.cdt.managedbuilder.llvm.ui.LlvmEnvironmentVariableSupplier -
    Get a specific path for given parameters. -
    fManagedBuildOnState - -Variable in class org.eclipse.cdt.managedbuilder.llvm.scannerconfig.ManagedLlvmScannerInfoConsoleParser -
      -
    -
    - - - - - - - - - - - - - - - -
    - -
    - - - -A B C D E F G I L M N O P R S U V
    - - - + + + + + + +F-Index + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + +
    + +
    + + + +A B C D E F G I L M N O P R S U V
    +

    +F

    +
    +
    fileSeparator - +Static variable in class org.eclipse.cdt.managedbuilder.llvm.util.Separators +
      +
    findBinDir(String, String) - +Static method in class org.eclipse.cdt.managedbuilder.llvm.ui.LlvmEnvironmentVariableSupplier +
    Get a specific path for given parameters. +
    fManagedBuildOnState - +Variable in class org.eclipse.cdt.managedbuilder.llvm.scannerconfig.ManagedLlvmScannerInfoConsoleParser +
      +
    +
    + + + + + + + + + + + + + + + +
    + +
    + + + +A B C D E F G I L M N O P R S U V
    + + + diff --git a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/index-files/index-7.html b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/index-files/index-7.html index 288b6ed37de..4a4c154fdd4 100644 --- a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/index-files/index-7.html +++ b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/index-files/index-7.html @@ -1,298 +1,298 @@ - - - - - - -G-Index - - - - - - - - - - - - -
    - - - - - - - - - - - - - - - -
    - -
    - - - -A B C D E F G I L M N O P R S U V
    -

    -G

    -
    -
    getAllBuildConfigs(IProject) - -Static method in class org.eclipse.cdt.managedbuilder.llvm.util.LlvmToolOptionPathUtil -
    Returns all build configurations of the project. -
    getBinDirIfLlvm_ar(String) - -Static method in class org.eclipse.cdt.managedbuilder.llvm.ui.LlvmEnvironmentVariableSupplier + + + + + + +G-Index + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + +
    + +
    + + + +A B C D E F G I L M N O P R S U V
    +

    +G

    +
    +
    getAllBuildConfigs(IProject) - +Static method in class org.eclipse.cdt.managedbuilder.llvm.util.LlvmToolOptionPathUtil +
    Returns all build configurations of the project. +
    getBinDirIfLlvm_ar(String) - +Static method in class org.eclipse.cdt.managedbuilder.llvm.ui.LlvmEnvironmentVariableSupplier
    Get the full path for llvm executable if the bin path given - as a parameter is found and executable exists in that path. -
    getBinPath() - -Static method in class org.eclipse.cdt.managedbuilder.llvm.ui.LlvmEnvironmentVariableSupplier -
    Get LLVM bin path -
    getBinPath() - -Static method in class org.eclipse.cdt.managedbuilder.llvm.ui.preferences.LlvmPreferenceStore -
    Get the LLVM bin path value from the LLVM Preference store. -
    getButtonBoxControl(Composite) - -Method in class org.eclipse.cdt.managedbuilder.llvm.ui.preferences.LlvmListEditor + as a parameter is found and executable exists in that path. +
    getBinPath() - +Static method in class org.eclipse.cdt.managedbuilder.llvm.ui.LlvmEnvironmentVariableSupplier +
    Get LLVM bin path +
    getBinPath() - +Static method in class org.eclipse.cdt.managedbuilder.llvm.ui.preferences.LlvmPreferenceStore +
    Get the LLVM bin path value from the LLVM Preference store. +
    getButtonBoxControl(Composite) - +Method in class org.eclipse.cdt.managedbuilder.llvm.ui.preferences.LlvmListEditor
    Returns this field editor's button box containing the Add, Remove, - Up, and Down button. -
    getDefault() - -Static method in class org.eclipse.cdt.managedbuilder.llvm.ui.LlvmUIPlugin -
    Returns the shared instance -
    getDelimiter() - -Method in class org.eclipse.cdt.managedbuilder.llvm.ui.LlvmBuildEnvironmentVariable -
    Get a delimiter. -
    getDependencyCommandOptions() - -Method in class org.eclipse.cdt.managedbuilder.llvm.makegen.LlvmDependencyCalculator2Commands -
      -
    getDependencySourceInfo(IPath, IResource, IBuildObject, ITool, IPath) - -Method in class org.eclipse.cdt.managedbuilder.llvm.makegen.LlvmDependencyCalculator2 -
      -
    getDependencySourceInfo(IPath, IBuildObject, ITool, IPath) - -Method in class org.eclipse.cdt.managedbuilder.llvm.makegen.LlvmDependencyCalculator2 -
      -
    getDescription() - -Method in class org.eclipse.cdt.managedbuilder.llvm.ui.preferences.LlvmPreferencePage -
      -
    getDirIfLlvmFound(String, String) - -Static method in class org.eclipse.cdt.managedbuilder.llvm.ui.LlvmEnvironmentVariableSupplier -
    Get LLVM executable path. -
    getExistingPaths(String) - -Static method in class org.eclipse.cdt.managedbuilder.llvm.ui.preferences.LlvmPreferenceStore -
    Get existing paths from the Preference store. -
    getFileSeparator() - -Static method in class org.eclipse.cdt.managedbuilder.llvm.util.Separators -
    Get file separator. -
    getIncludePath() - -Static method in class org.eclipse.cdt.managedbuilder.llvm.ui.LlvmEnvironmentVariableSupplier -
    Get LLVM include paths -
    getIncludePath() - -Static method in class org.eclipse.cdt.managedbuilder.llvm.ui.preferences.LlvmPreferenceStore -
    Get the LLVM include path value from the LLVM Preference store. -
    getIToolByInputType(IConfiguration, String) - -Static method in class org.eclipse.cdt.managedbuilder.llvm.util.LlvmToolOptionPathUtil -
    Returns ITool associated with the input extension. -
    getIToolPathOption(ITool, String) - -Static method in class org.eclipse.cdt.managedbuilder.llvm.util.LlvmToolOptionPathUtil -
    Returns Tool's Option type by Id. -
    getLibraries() - -Static method in class org.eclipse.cdt.managedbuilder.llvm.ui.LlvmEnvironmentVariableSupplier -
    Get LLVM libraries -
    getLibraries() - -Static method in class org.eclipse.cdt.managedbuilder.llvm.ui.preferences.LlvmPreferenceStore -
    Get the LLVM library from the LLVM Preference store. -
    getLibraryPath() - -Static method in class org.eclipse.cdt.managedbuilder.llvm.ui.LlvmEnvironmentVariableSupplier -
    Get LLVM library paths -
    getLibraryPath() - -Static method in class org.eclipse.cdt.managedbuilder.llvm.ui.preferences.LlvmPreferenceStore -
    Get the LLVM library path value from the LLVM Preference Store. -
    getListControl(Composite) - -Method in class org.eclipse.cdt.managedbuilder.llvm.ui.preferences.LlvmListEditor -
    Returns this field editor's list control. -
    getLlvmEnvironmentVariable(String) - -Static method in class org.eclipse.cdt.managedbuilder.llvm.ui.LlvmEnvironmentVariableSupplier -
    Get LLVM environment variable. -
    getLlvmFrontEnd(IConfiguration) - -Static method in class org.eclipse.cdt.managedbuilder.llvm.util.LlvmToolOptionPathUtil -
    Return LLVM front-end according to the input type. -
    getLlvmFrontEndIncludePathOption(IConfiguration) - -Static method in class org.eclipse.cdt.managedbuilder.llvm.util.LlvmToolOptionPathUtil -
    Returns LLVM front-end Include path Option type. -
    getLlvmLinker(IConfiguration) - -Static method in class org.eclipse.cdt.managedbuilder.llvm.util.LlvmToolOptionPathUtil -
    Returns LLVM linker. -
    getLlvmLinkerLibrariesOption(IConfiguration) - -Static method in class org.eclipse.cdt.managedbuilder.llvm.util.LlvmToolOptionPathUtil -
    Returns LLVM Linker Libraries Option type. -
    getLlvmLinkerLibrarySearchPathOption(IConfiguration) - -Static method in class org.eclipse.cdt.managedbuilder.llvm.util.LlvmToolOptionPathUtil -
    Returns LLVM Linker Library search path Option type. -
    getName() - -Method in class org.eclipse.cdt.managedbuilder.llvm.ui.LlvmBuildEnvironmentVariable -
    Get name of the llvm environment variable. -
    getNewInputObject() - -Method in class org.eclipse.cdt.managedbuilder.llvm.ui.preferences.IncludePathListEditor -
      -
    getNewInputObject() - -Method in class org.eclipse.cdt.managedbuilder.llvm.ui.preferences.LibraryListEditor -
      -
    getNewInputObject() - -Method in class org.eclipse.cdt.managedbuilder.llvm.ui.preferences.LibraryPathListEditor -
      -
    getOperation() - -Method in class org.eclipse.cdt.managedbuilder.llvm.ui.LlvmBuildEnvironmentVariable -
    Get operation of the llvm environment variable. -
    getOptionId(ITool, int) - -Static method in class org.eclipse.cdt.managedbuilder.llvm.util.LlvmToolOptionPathUtil -
    Returns Tool's option id. -
    getPathSeparator() - -Static method in class org.eclipse.cdt.managedbuilder.llvm.util.Separators -
    Get path separator. -
    getPreferenceStore() - -Static method in class org.eclipse.cdt.managedbuilder.llvm.ui.preferences.LlvmPreferenceStore -
    Get the LLVM Preference store. -
    getPreferenceStoreValue(String) - -Static method in class org.eclipse.cdt.managedbuilder.llvm.ui.preferences.LlvmPreferenceStore -
    Get a value from the LLVM Preference store. -
    getPreferenceStoreValueAsArray(String) - -Static method in class org.eclipse.cdt.managedbuilder.llvm.ui.preferences.LlvmPreferenceStore -
    Get values from the LLVM Preference store as a String array. -
    getProject() - -Method in class org.eclipse.cdt.managedbuilder.llvm.ui.LlvmProjectNature -
    Return the project. -
    getProjectsInWorkspace() - -Static method in class org.eclipse.cdt.managedbuilder.llvm.util.LlvmToolOptionPathUtil -
    Returns all projects in the workspace. -
    getProperties() - -Method in class org.eclipse.cdt.managedbuilder.llvm.ui.LlvmUIPlugin -
    Get plugin.properties -
    getPropertyString(String) - -Static method in class org.eclipse.cdt.managedbuilder.llvm.ui.LlvmUIPlugin -
    Get String from the plugin.properties file -
    getResourceBundle() - -Method in class org.eclipse.cdt.managedbuilder.llvm.ui.LlvmUIPlugin -
    Returns the plugin's resource bundle, -
    getResourceString(String) - -Static method in class org.eclipse.cdt.managedbuilder.llvm.ui.LlvmUIPlugin + Up, and Down button. +
    getDefault() - +Static method in class org.eclipse.cdt.managedbuilder.llvm.ui.LlvmUIPlugin +
    Returns the shared instance +
    getDelimiter() - +Method in class org.eclipse.cdt.managedbuilder.llvm.ui.LlvmBuildEnvironmentVariable +
    Get a delimiter. +
    getDependencyCommandOptions() - +Method in class org.eclipse.cdt.managedbuilder.llvm.makegen.LlvmDependencyCalculator2Commands +
      +
    getDependencySourceInfo(IPath, IResource, IBuildObject, ITool, IPath) - +Method in class org.eclipse.cdt.managedbuilder.llvm.makegen.LlvmDependencyCalculator2 +
      +
    getDependencySourceInfo(IPath, IBuildObject, ITool, IPath) - +Method in class org.eclipse.cdt.managedbuilder.llvm.makegen.LlvmDependencyCalculator2 +
      +
    getDescription() - +Method in class org.eclipse.cdt.managedbuilder.llvm.ui.preferences.LlvmPreferencePage +
      +
    getDirIfLlvmFound(String, String) - +Static method in class org.eclipse.cdt.managedbuilder.llvm.ui.LlvmEnvironmentVariableSupplier +
    Get LLVM executable path. +
    getExistingPaths(String) - +Static method in class org.eclipse.cdt.managedbuilder.llvm.ui.preferences.LlvmPreferenceStore +
    Get existing paths from the Preference store. +
    getFileSeparator() - +Static method in class org.eclipse.cdt.managedbuilder.llvm.util.Separators +
    Get file separator. +
    getIncludePath() - +Static method in class org.eclipse.cdt.managedbuilder.llvm.ui.LlvmEnvironmentVariableSupplier +
    Get LLVM include paths +
    getIncludePath() - +Static method in class org.eclipse.cdt.managedbuilder.llvm.ui.preferences.LlvmPreferenceStore +
    Get the LLVM include path value from the LLVM Preference store. +
    getIToolByInputType(IConfiguration, String) - +Static method in class org.eclipse.cdt.managedbuilder.llvm.util.LlvmToolOptionPathUtil +
    Returns ITool associated with the input extension. +
    getIToolPathOption(ITool, String) - +Static method in class org.eclipse.cdt.managedbuilder.llvm.util.LlvmToolOptionPathUtil +
    Returns Tool's Option type by Id. +
    getLibraries() - +Static method in class org.eclipse.cdt.managedbuilder.llvm.ui.LlvmEnvironmentVariableSupplier +
    Get LLVM libraries +
    getLibraries() - +Static method in class org.eclipse.cdt.managedbuilder.llvm.ui.preferences.LlvmPreferenceStore +
    Get the LLVM library from the LLVM Preference store. +
    getLibraryPath() - +Static method in class org.eclipse.cdt.managedbuilder.llvm.ui.LlvmEnvironmentVariableSupplier +
    Get LLVM library paths +
    getLibraryPath() - +Static method in class org.eclipse.cdt.managedbuilder.llvm.ui.preferences.LlvmPreferenceStore +
    Get the LLVM library path value from the LLVM Preference Store. +
    getListControl(Composite) - +Method in class org.eclipse.cdt.managedbuilder.llvm.ui.preferences.LlvmListEditor +
    Returns this field editor's list control. +
    getLlvmEnvironmentVariable(String) - +Static method in class org.eclipse.cdt.managedbuilder.llvm.ui.LlvmEnvironmentVariableSupplier +
    Get LLVM environment variable. +
    getLlvmFrontEnd(IConfiguration) - +Static method in class org.eclipse.cdt.managedbuilder.llvm.util.LlvmToolOptionPathUtil +
    Return LLVM front-end according to the input type. +
    getLlvmFrontEndIncludePathOption(IConfiguration) - +Static method in class org.eclipse.cdt.managedbuilder.llvm.util.LlvmToolOptionPathUtil +
    Returns LLVM front-end Include path Option type. +
    getLlvmLinker(IConfiguration) - +Static method in class org.eclipse.cdt.managedbuilder.llvm.util.LlvmToolOptionPathUtil +
    Returns LLVM linker. +
    getLlvmLinkerLibrariesOption(IConfiguration) - +Static method in class org.eclipse.cdt.managedbuilder.llvm.util.LlvmToolOptionPathUtil +
    Returns LLVM Linker Libraries Option type. +
    getLlvmLinkerLibrarySearchPathOption(IConfiguration) - +Static method in class org.eclipse.cdt.managedbuilder.llvm.util.LlvmToolOptionPathUtil +
    Returns LLVM Linker Library search path Option type. +
    getName() - +Method in class org.eclipse.cdt.managedbuilder.llvm.ui.LlvmBuildEnvironmentVariable +
    Get name of the llvm environment variable. +
    getNewInputObject() - +Method in class org.eclipse.cdt.managedbuilder.llvm.ui.preferences.IncludePathListEditor +
      +
    getNewInputObject() - +Method in class org.eclipse.cdt.managedbuilder.llvm.ui.preferences.LibraryListEditor +
      +
    getNewInputObject() - +Method in class org.eclipse.cdt.managedbuilder.llvm.ui.preferences.LibraryPathListEditor +
      +
    getOperation() - +Method in class org.eclipse.cdt.managedbuilder.llvm.ui.LlvmBuildEnvironmentVariable +
    Get operation of the llvm environment variable. +
    getOptionId(ITool, int) - +Static method in class org.eclipse.cdt.managedbuilder.llvm.util.LlvmToolOptionPathUtil +
    Returns Tool's option id. +
    getPathSeparator() - +Static method in class org.eclipse.cdt.managedbuilder.llvm.util.Separators +
    Get path separator. +
    getPreferenceStore() - +Static method in class org.eclipse.cdt.managedbuilder.llvm.ui.preferences.LlvmPreferenceStore +
    Get the LLVM Preference store. +
    getPreferenceStoreValue(String) - +Static method in class org.eclipse.cdt.managedbuilder.llvm.ui.preferences.LlvmPreferenceStore +
    Get a value from the LLVM Preference store. +
    getPreferenceStoreValueAsArray(String) - +Static method in class org.eclipse.cdt.managedbuilder.llvm.ui.preferences.LlvmPreferenceStore +
    Get values from the LLVM Preference store as a String array. +
    getProject() - +Method in class org.eclipse.cdt.managedbuilder.llvm.ui.LlvmProjectNature +
    Return the project. +
    getProjectsInWorkspace() - +Static method in class org.eclipse.cdt.managedbuilder.llvm.util.LlvmToolOptionPathUtil +
    Returns all projects in the workspace. +
    getProperties() - +Method in class org.eclipse.cdt.managedbuilder.llvm.ui.LlvmUIPlugin +
    Get plugin.properties +
    getPropertyString(String) - +Static method in class org.eclipse.cdt.managedbuilder.llvm.ui.LlvmUIPlugin +
    Get String from the plugin.properties file +
    getResourceBundle() - +Method in class org.eclipse.cdt.managedbuilder.llvm.ui.LlvmUIPlugin +
    Returns the plugin's resource bundle, +
    getResourceString(String) - +Static method in class org.eclipse.cdt.managedbuilder.llvm.ui.LlvmUIPlugin
    Returns the string from the plugin's resource bundle, - or 'key' if not found. -
    getSelectionListener() - -Method in class org.eclipse.cdt.managedbuilder.llvm.ui.preferences.LlvmListEditor -
    Returns this field editor's selection listener. -
    getShell() - -Method in class org.eclipse.cdt.managedbuilder.llvm.ui.preferences.LlvmListEditor -
    Returns this field editor's shell. -
    getSysEnvPath(String) - -Static method in class org.eclipse.cdt.managedbuilder.llvm.ui.LlvmEnvironmentVariableSupplier -
    Returns a system environment variable path -
    getValue() - -Method in class org.eclipse.cdt.managedbuilder.llvm.ui.LlvmBuildEnvironmentVariable -
    Get value of the llvm environment variable. -
    getVariable(String, IConfiguration, IEnvironmentVariableProvider) - -Method in class org.eclipse.cdt.managedbuilder.llvm.ui.LlvmEnvironmentVariableSupplier -
      -
    getVariables(IConfiguration, IEnvironmentVariableProvider) - -Method in class org.eclipse.cdt.managedbuilder.llvm.ui.LlvmEnvironmentVariableSupplier -
      -
    -
    - - - - - - - - - - - - - - - -
    - -
    - - - -A B C D E F G I L M N O P R S U V
    - - - + or 'key' if not found. +
    getSelectionListener() - +Method in class org.eclipse.cdt.managedbuilder.llvm.ui.preferences.LlvmListEditor +
    Returns this field editor's selection listener. +
    getShell() - +Method in class org.eclipse.cdt.managedbuilder.llvm.ui.preferences.LlvmListEditor +
    Returns this field editor's shell. +
    getSysEnvPath(String) - +Static method in class org.eclipse.cdt.managedbuilder.llvm.ui.LlvmEnvironmentVariableSupplier +
    Returns a system environment variable path +
    getValue() - +Method in class org.eclipse.cdt.managedbuilder.llvm.ui.LlvmBuildEnvironmentVariable +
    Get value of the llvm environment variable. +
    getVariable(String, IConfiguration, IEnvironmentVariableProvider) - +Method in class org.eclipse.cdt.managedbuilder.llvm.ui.LlvmEnvironmentVariableSupplier +
      +
    getVariables(IConfiguration, IEnvironmentVariableProvider) - +Method in class org.eclipse.cdt.managedbuilder.llvm.ui.LlvmEnvironmentVariableSupplier +
      +
    +
    + + + + + + + + + + + + + + + +
    + +
    + + + +A B C D E F G I L M N O P R S U V
    + + + diff --git a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/index-files/index-8.html b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/index-files/index-8.html index 93676936af0..9fe453b1547 100644 --- a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/index-files/index-8.html +++ b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/index-files/index-8.html @@ -1,172 +1,172 @@ - - - - - - -I-Index - - - - - - - - - - - - -
    - - - - - - - - - - - - - - - -
    - -
    - - - -A B C D E F G I L M N O P R S U V
    -

    -I

    -
    -
    INCLUDE - -Static variable in class org.eclipse.cdt.managedbuilder.llvm.util.LlvmToolOptionPathUtil -
      -
    IncludePathListEditor - Class in org.eclipse.cdt.managedbuilder.llvm.ui.preferences
    New implementation of LlvmListEditor.
    IncludePathListEditor(String, String, Composite) - -Constructor for class org.eclipse.cdt.managedbuilder.llvm.ui.preferences.IncludePathListEditor -
    Constructor. -
    IncludePathListEditor_0 - -Static variable in class org.eclipse.cdt.managedbuilder.llvm.ui.preferences.Messages -
      -
    IncludePathListEditor_1 - -Static variable in class org.eclipse.cdt.managedbuilder.llvm.ui.preferences.Messages -
      -
    init(IWorkbench) - -Method in class org.eclipse.cdt.managedbuilder.llvm.ui.preferences.LlvmPreferencePage -
      -
    initializeDefaultPreferences() - -Method in class org.eclipse.cdt.managedbuilder.llvm.ui.preferences.PreferenceInitializer -
      -
    initializePaths() - -Static method in class org.eclipse.cdt.managedbuilder.llvm.ui.LlvmEnvironmentVariableSupplier -
    Initializes llvm environment variable paths from the system environment variables. -
    inputTypes - -Static variable in class org.eclipse.cdt.managedbuilder.llvm.util.LlvmToolOptionPathUtil -
      -
    isManagedBuildOn() - -Method in class org.eclipse.cdt.managedbuilder.llvm.scannerconfig.ManagedLlvmScannerInfoConsoleParser -
      -
    isSupported(IToolChain, Version, String) - -Method in class org.eclipse.cdt.managedbuilder.llvm.ui.LlvmIsToolChainSupported -
    Return a boolean value that informs if the LLVM Toolchain is supported. -
    -
    - - - - - - - - - - - - - - - -
    - -
    - - - -A B C D E F G I L M N O P R S U V
    - - - + + + + + + +I-Index + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + +
    + +
    + + + +A B C D E F G I L M N O P R S U V
    +

    +I

    +
    +
    INCLUDE - +Static variable in class org.eclipse.cdt.managedbuilder.llvm.util.LlvmToolOptionPathUtil +
      +
    IncludePathListEditor - Class in org.eclipse.cdt.managedbuilder.llvm.ui.preferences
    New implementation of LlvmListEditor.
    IncludePathListEditor(String, String, Composite) - +Constructor for class org.eclipse.cdt.managedbuilder.llvm.ui.preferences.IncludePathListEditor +
    Constructor. +
    IncludePathListEditor_0 - +Static variable in class org.eclipse.cdt.managedbuilder.llvm.ui.preferences.Messages +
      +
    IncludePathListEditor_1 - +Static variable in class org.eclipse.cdt.managedbuilder.llvm.ui.preferences.Messages +
      +
    init(IWorkbench) - +Method in class org.eclipse.cdt.managedbuilder.llvm.ui.preferences.LlvmPreferencePage +
      +
    initializeDefaultPreferences() - +Method in class org.eclipse.cdt.managedbuilder.llvm.ui.preferences.PreferenceInitializer +
      +
    initializePaths() - +Static method in class org.eclipse.cdt.managedbuilder.llvm.ui.LlvmEnvironmentVariableSupplier +
    Initializes llvm environment variable paths from the system environment variables. +
    inputTypes - +Static variable in class org.eclipse.cdt.managedbuilder.llvm.util.LlvmToolOptionPathUtil +
      +
    isManagedBuildOn() - +Method in class org.eclipse.cdt.managedbuilder.llvm.scannerconfig.ManagedLlvmScannerInfoConsoleParser +
      +
    isSupported(IToolChain, Version, String) - +Method in class org.eclipse.cdt.managedbuilder.llvm.ui.LlvmIsToolChainSupported +
    Return a boolean value that informs if the LLVM Toolchain is supported. +
    +
    + + + + + + + + + + + + + + + +
    + +
    + + + +A B C D E F G I L M N O P R S U V
    + + + diff --git a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/index-files/index-9.html b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/index-files/index-9.html index f37a7d81a3a..ece84be11d2 100644 --- a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/index-files/index-9.html +++ b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/index-files/index-9.html @@ -1,237 +1,237 @@ - - - - - - -L-Index - - - - - - - - - - - - -
    - - - - - - - - - - - - - - - -
    - -
    - - - -A B C D E F G I L M N O P R S U V
    -

    -L

    -
    -
    LIB - -Static variable in class org.eclipse.cdt.managedbuilder.llvm.util.LlvmToolOptionPathUtil -
      -
    LIB_PATH - -Static variable in class org.eclipse.cdt.managedbuilder.llvm.util.LlvmToolOptionPathUtil -
      -
    LibraryListEditor - Class in org.eclipse.cdt.managedbuilder.llvm.ui.preferences
    New implementation of LlvmListEditor.
    LibraryListEditor(String, String, Composite) - -Constructor for class org.eclipse.cdt.managedbuilder.llvm.ui.preferences.LibraryListEditor -
    Constructor. -
    LibraryListEditor_0 - -Static variable in class org.eclipse.cdt.managedbuilder.llvm.ui.preferences.Messages -
      -
    LibraryPathListEditor - Class in org.eclipse.cdt.managedbuilder.llvm.ui.preferences
    New implementation of LlvmListEditor.
    LibraryPathListEditor(String, String, Composite) - -Constructor for class org.eclipse.cdt.managedbuilder.llvm.ui.preferences.LibraryPathListEditor -
    Constructor. -
    LibraryPathListEditor_0 - -Static variable in class org.eclipse.cdt.managedbuilder.llvm.ui.preferences.Messages -
      -
    LibraryPathListEditor_1 - -Static variable in class org.eclipse.cdt.managedbuilder.llvm.ui.preferences.Messages -
      -
    linkerInputType - -Static variable in class org.eclipse.cdt.managedbuilder.llvm.util.LlvmToolOptionPathUtil -
      -
    list - -Variable in class org.eclipse.cdt.managedbuilder.llvm.ui.preferences.LlvmListEditor + + + + + + +L-Index + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + +
    + +
    + + + +A B C D E F G I L M N O P R S U V
    +

    +L

    +
    +
    LIB - +Static variable in class org.eclipse.cdt.managedbuilder.llvm.util.LlvmToolOptionPathUtil +
      +
    LIB_PATH - +Static variable in class org.eclipse.cdt.managedbuilder.llvm.util.LlvmToolOptionPathUtil +
      +
    LibraryListEditor - Class in org.eclipse.cdt.managedbuilder.llvm.ui.preferences
    New implementation of LlvmListEditor.
    LibraryListEditor(String, String, Composite) - +Constructor for class org.eclipse.cdt.managedbuilder.llvm.ui.preferences.LibraryListEditor +
    Constructor. +
    LibraryListEditor_0 - +Static variable in class org.eclipse.cdt.managedbuilder.llvm.ui.preferences.Messages +
      +
    LibraryPathListEditor - Class in org.eclipse.cdt.managedbuilder.llvm.ui.preferences
    New implementation of LlvmListEditor.
    LibraryPathListEditor(String, String, Composite) - +Constructor for class org.eclipse.cdt.managedbuilder.llvm.ui.preferences.LibraryPathListEditor +
    Constructor. +
    LibraryPathListEditor_0 - +Static variable in class org.eclipse.cdt.managedbuilder.llvm.ui.preferences.Messages +
      +
    LibraryPathListEditor_1 - +Static variable in class org.eclipse.cdt.managedbuilder.llvm.ui.preferences.Messages +
      +
    linkerInputType - +Static variable in class org.eclipse.cdt.managedbuilder.llvm.util.LlvmToolOptionPathUtil +
      +
    list - +Variable in class org.eclipse.cdt.managedbuilder.llvm.ui.preferences.LlvmListEditor
    The list widget; null if none - (before creation or after disposal). -
    LlvmBuildEnvironmentVariable - Class in org.eclipse.cdt.managedbuilder.llvm.ui
    Implemented type that contains BuildEnvironmentalVariables.
    LlvmBuildEnvironmentVariable(String, String, int) - -Constructor for class org.eclipse.cdt.managedbuilder.llvm.ui.LlvmBuildEnvironmentVariable -
    Constructor. -
    LlvmDependencyCalculator2 - Class in org.eclipse.cdt.managedbuilder.llvm.makegen
     
    LlvmDependencyCalculator2() - -Constructor for class org.eclipse.cdt.managedbuilder.llvm.makegen.LlvmDependencyCalculator2 -
      -
    LlvmDependencyCalculator2Commands - Class in org.eclipse.cdt.managedbuilder.llvm.makegen
     
    LlvmDependencyCalculator2Commands(IPath, IResource, IBuildObject, ITool, IPath) - -Constructor for class org.eclipse.cdt.managedbuilder.llvm.makegen.LlvmDependencyCalculator2Commands -
      -
    LlvmDependencyCalculator2Commands(IPath, IBuildObject, ITool, IPath) - -Constructor for class org.eclipse.cdt.managedbuilder.llvm.makegen.LlvmDependencyCalculator2Commands -
      -
    llvmEnvironmentVariables - -Static variable in class org.eclipse.cdt.managedbuilder.llvm.ui.LlvmEnvironmentVariableSupplier -
      -
    LlvmEnvironmentVariableSupplier - Class in org.eclipse.cdt.managedbuilder.llvm.ui
    Contains LLVM environment variables.
    LlvmEnvironmentVariableSupplier() - -Constructor for class org.eclipse.cdt.managedbuilder.llvm.ui.LlvmEnvironmentVariableSupplier -
    Constructor. -
    LlvmIsToolChainSupported - Class in org.eclipse.cdt.managedbuilder.llvm.ui
    Based on MingwIsToolChainSupported.
    LlvmIsToolChainSupported() - -Constructor for class org.eclipse.cdt.managedbuilder.llvm.ui.LlvmIsToolChainSupported -
    Constructor. -
    LlvmListEditor - Class in org.eclipse.cdt.managedbuilder.llvm.ui.preferences
    An abstract list editor that manages a list of input values.
    LlvmListEditor(String, String, Composite) - -Constructor for class org.eclipse.cdt.managedbuilder.llvm.ui.preferences.LlvmListEditor -
    Creates a list field editor. + (before creation or after disposal). +
    LlvmBuildEnvironmentVariable - Class in org.eclipse.cdt.managedbuilder.llvm.ui
    Implemented type that contains BuildEnvironmentalVariables.
    LlvmBuildEnvironmentVariable(String, String, int) - +Constructor for class org.eclipse.cdt.managedbuilder.llvm.ui.LlvmBuildEnvironmentVariable +
    Constructor. +
    LlvmDependencyCalculator2 - Class in org.eclipse.cdt.managedbuilder.llvm.makegen
     
    LlvmDependencyCalculator2() - +Constructor for class org.eclipse.cdt.managedbuilder.llvm.makegen.LlvmDependencyCalculator2 +
      +
    LlvmDependencyCalculator2Commands - Class in org.eclipse.cdt.managedbuilder.llvm.makegen
     
    LlvmDependencyCalculator2Commands(IPath, IResource, IBuildObject, ITool, IPath) - +Constructor for class org.eclipse.cdt.managedbuilder.llvm.makegen.LlvmDependencyCalculator2Commands +
      +
    LlvmDependencyCalculator2Commands(IPath, IBuildObject, ITool, IPath) - +Constructor for class org.eclipse.cdt.managedbuilder.llvm.makegen.LlvmDependencyCalculator2Commands +
      +
    llvmEnvironmentVariables - +Static variable in class org.eclipse.cdt.managedbuilder.llvm.ui.LlvmEnvironmentVariableSupplier +
      +
    LlvmEnvironmentVariableSupplier - Class in org.eclipse.cdt.managedbuilder.llvm.ui
    Contains LLVM environment variables.
    LlvmEnvironmentVariableSupplier() - +Constructor for class org.eclipse.cdt.managedbuilder.llvm.ui.LlvmEnvironmentVariableSupplier +
    Constructor. +
    LlvmIsToolChainSupported - Class in org.eclipse.cdt.managedbuilder.llvm.ui
    Based on MingwIsToolChainSupported.
    LlvmIsToolChainSupported() - +Constructor for class org.eclipse.cdt.managedbuilder.llvm.ui.LlvmIsToolChainSupported +
    Constructor. +
    LlvmListEditor - Class in org.eclipse.cdt.managedbuilder.llvm.ui.preferences
    An abstract list editor that manages a list of input values.
    LlvmListEditor(String, String, Composite) - +Constructor for class org.eclipse.cdt.managedbuilder.llvm.ui.preferences.LlvmListEditor +
    Creates a list field editor.
    LlvmPreferencePage - Class in org.eclipse.cdt.managedbuilder.llvm.ui.preferences
    This class represents a preference page that - is contributed to the Preferences dialog.
    LlvmPreferencePage() - -Constructor for class org.eclipse.cdt.managedbuilder.llvm.ui.preferences.LlvmPreferencePage -
    Constructor. -
    LlvmPreferencePage_0 - -Static variable in class org.eclipse.cdt.managedbuilder.llvm.ui.preferences.Messages -
      -
    LlvmPreferencePage_1 - -Static variable in class org.eclipse.cdt.managedbuilder.llvm.ui.preferences.Messages -
      -
    LlvmPreferencePage_2 - -Static variable in class org.eclipse.cdt.managedbuilder.llvm.ui.preferences.Messages -
      -
    LlvmPreferencePage_3 - -Static variable in class org.eclipse.cdt.managedbuilder.llvm.ui.preferences.Messages -
      -
    LlvmPreferencePage_4 - -Static variable in class org.eclipse.cdt.managedbuilder.llvm.ui.preferences.Messages -
      -
    LlvmPreferenceStore - Class in org.eclipse.cdt.managedbuilder.llvm.ui.preferences
    Class used to access the LLVM Preference store values.
    LlvmPreferenceStore() - -Constructor for class org.eclipse.cdt.managedbuilder.llvm.ui.preferences.LlvmPreferenceStore -
      -
    LlvmProjectNature - Class in org.eclipse.cdt.managedbuilder.llvm.ui
    Implements project nature for LLVM projects.
    LlvmProjectNature() - -Constructor for class org.eclipse.cdt.managedbuilder.llvm.ui.LlvmProjectNature -
      + is contributed to the Preferences dialog.
    LlvmPreferencePage() - +Constructor for class org.eclipse.cdt.managedbuilder.llvm.ui.preferences.LlvmPreferencePage +
    Constructor. +
    LlvmPreferencePage_0 - +Static variable in class org.eclipse.cdt.managedbuilder.llvm.ui.preferences.Messages +
      +
    LlvmPreferencePage_1 - +Static variable in class org.eclipse.cdt.managedbuilder.llvm.ui.preferences.Messages +
      +
    LlvmPreferencePage_2 - +Static variable in class org.eclipse.cdt.managedbuilder.llvm.ui.preferences.Messages +
      +
    LlvmPreferencePage_3 - +Static variable in class org.eclipse.cdt.managedbuilder.llvm.ui.preferences.Messages +
      +
    LlvmPreferencePage_4 - +Static variable in class org.eclipse.cdt.managedbuilder.llvm.ui.preferences.Messages +
      +
    LlvmPreferenceStore - Class in org.eclipse.cdt.managedbuilder.llvm.ui.preferences
    Class used to access the LLVM Preference store values.
    LlvmPreferenceStore() - +Constructor for class org.eclipse.cdt.managedbuilder.llvm.ui.preferences.LlvmPreferenceStore +
      +
    LlvmProjectNature - Class in org.eclipse.cdt.managedbuilder.llvm.ui
    Implements project nature for LLVM projects.
    LlvmProjectNature() - +Constructor for class org.eclipse.cdt.managedbuilder.llvm.ui.LlvmProjectNature +
     
    LlvmScannerInfoCollector - Class in org.eclipse.cdt.managedbuilder.llvm.scannerconfig
    Implementation class for gathering the built-in compiler settings for - Clang/LLVM targets.
    LlvmScannerInfoCollector() - -Constructor for class org.eclipse.cdt.managedbuilder.llvm.scannerconfig.LlvmScannerInfoCollector -
      + Clang/LLVM targets.
    LlvmScannerInfoCollector() - +Constructor for class org.eclipse.cdt.managedbuilder.llvm.scannerconfig.LlvmScannerInfoCollector +
     
    LlvmToolOptionPathUtil - Class in org.eclipse.cdt.managedbuilder.llvm.util
    The main purpose of this class is to add include paths and libraries and library search paths for LLVM assembler and linker Tools which are added in Preferences->LLVM to all projects - and build configurations that use LLVM ToolChain.
    LlvmToolOptionPathUtil() - -Constructor for class org.eclipse.cdt.managedbuilder.llvm.util.LlvmToolOptionPathUtil -
      -
    LlvmUIPlugin - Class in org.eclipse.cdt.managedbuilder.llvm.ui
    The activator class controls the plug-in life cycle.
    LlvmUIPlugin() - -Constructor for class org.eclipse.cdt.managedbuilder.llvm.ui.LlvmUIPlugin -
    Constructor. -
    log(Throwable) - -Method in class org.eclipse.cdt.managedbuilder.llvm.ui.LlvmUIPlugin -
    Log error. -
    log(IStatus) - -Method in class org.eclipse.cdt.managedbuilder.llvm.ui.LlvmUIPlugin -
    Log status. -
    -
    - - - - - - - - - - - - - - - -
    - -
    - - - -A B C D E F G I L M N O P R S U V
    - - - + and build configurations that use LLVM ToolChain.
    LlvmToolOptionPathUtil() - +Constructor for class org.eclipse.cdt.managedbuilder.llvm.util.LlvmToolOptionPathUtil +
      +
    LlvmUIPlugin - Class in org.eclipse.cdt.managedbuilder.llvm.ui
    The activator class controls the plug-in life cycle.
    LlvmUIPlugin() - +Constructor for class org.eclipse.cdt.managedbuilder.llvm.ui.LlvmUIPlugin +
    Constructor. +
    log(Throwable) - +Method in class org.eclipse.cdt.managedbuilder.llvm.ui.LlvmUIPlugin +
    Log error. +
    log(IStatus) - +Method in class org.eclipse.cdt.managedbuilder.llvm.ui.LlvmUIPlugin +
    Log status. +
    +
    + + + + + + + + + + + + + + + +
    + +
    + + + +A B C D E F G I L M N O P R S U V
    + + + diff --git a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/index.html b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/index.html index 56759fa6f24..1bb6fa212e6 100644 --- a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/index.html +++ b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/index.html @@ -1,39 +1,39 @@ - - - - - - -Generated Documentation (Untitled) - - - - - - - - - - - -<H2> -Frame Alert</H2> - -<P> -This document is designed to be viewed using the frames feature. If you see this message, you are using a non-frame-capable web client. -<BR> -Link to<A HREF="overview-summary.html">Non-frame version.</A> - - - + + + + + + +Generated Documentation (Untitled) + + + + + + + + + + + +<H2> +Frame Alert</H2> + +<P> +This document is designed to be viewed using the frames feature. If you see this message, you are using a non-frame-capable web client. +<BR> +Link to<A HREF="overview-summary.html">Non-frame version.</A> + + + diff --git a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/makegen/LlvmDependencyCalculator2.html b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/makegen/LlvmDependencyCalculator2.html index c6cdd3709da..d7cd33aaaa3 100644 --- a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/makegen/LlvmDependencyCalculator2.html +++ b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/makegen/LlvmDependencyCalculator2.html @@ -1,322 +1,322 @@ - - - - - - -LlvmDependencyCalculator2 - - - - - - - - - - - - -
    - - - - - - - - - - - - - - - - - - - -
    - -
    - - - -
    - -

    - -org.eclipse.cdt.managedbuilder.llvm.makegen -
    -Class LlvmDependencyCalculator2

    -
    -java.lang.Object
    -  extended by org.eclipse.cdt.managedbuilder.makegen.gnu.DefaultGCCDependencyCalculator2
    -      extended by org.eclipse.cdt.managedbuilder.llvm.makegen.LlvmDependencyCalculator2
    -
    -
    -
    All Implemented Interfaces:
    org.eclipse.cdt.managedbuilder.makegen.IManagedDependencyGenerator2, org.eclipse.cdt.managedbuilder.makegen.IManagedDependencyGeneratorType
    -
    -
    -
    -
    public class LlvmDependencyCalculator2
    extends org.eclipse.cdt.managedbuilder.makegen.gnu.DefaultGCCDependencyCalculator2
    - - -

    -


    - -

    - - - - - - - -
    -Field Summary
    - - - - - - - -
    Fields inherited from interface org.eclipse.cdt.managedbuilder.makegen.IManagedDependencyGeneratorType
    TYPE_BUILD_COMMANDS, TYPE_COMMAND, TYPE_CUSTOM, TYPE_EXTERNAL, TYPE_INDEXER, TYPE_NODEPENDENCIES, TYPE_NODEPS, TYPE_OLD_TYPE_LIMIT, TYPE_PREBUILD_COMMANDS
    -  - - - - - - - - - - -
    -Constructor Summary
    LlvmDependencyCalculator2() - -
    -           
    -  - - - - - - - - - - - - - - - -
    -Method Summary
    - org.eclipse.cdt.managedbuilder.makegen.IManagedDependencyInfogetDependencySourceInfo(org.eclipse.core.runtime.IPath source, - org.eclipse.cdt.managedbuilder.core.IBuildObject buildContext, - org.eclipse.cdt.managedbuilder.core.ITool tool, - org.eclipse.core.runtime.IPath topBuildDirectory) - -
    -           
    - org.eclipse.cdt.managedbuilder.makegen.IManagedDependencyInfogetDependencySourceInfo(org.eclipse.core.runtime.IPath source, - org.eclipse.core.resources.IResource resource, - org.eclipse.cdt.managedbuilder.core.IBuildObject buildContext, - org.eclipse.cdt.managedbuilder.core.ITool tool, - org.eclipse.core.runtime.IPath topBuildDirectory) - -
    -           
    - - - - - - - -
    Methods inherited from class org.eclipse.cdt.managedbuilder.makegen.gnu.DefaultGCCDependencyCalculator2
    getCalculatorType, getDependencyFileExtension, postProcessDependencyFile
    - - - - - - - -
    Methods inherited from class java.lang.Object
    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    -  -

    - - - - - - - - -
    -Constructor Detail
    - -

    -LlvmDependencyCalculator2

    -
    -public LlvmDependencyCalculator2()
    -
    -
    - - - - - - - - -
    -Method Detail
    - -

    -getDependencySourceInfo

    -
    -public org.eclipse.cdt.managedbuilder.makegen.IManagedDependencyInfo getDependencySourceInfo(org.eclipse.core.runtime.IPath source,
    -                                                                                             org.eclipse.core.resources.IResource resource,
    -                                                                                             org.eclipse.cdt.managedbuilder.core.IBuildObject buildContext,
    -                                                                                             org.eclipse.cdt.managedbuilder.core.ITool tool,
    -                                                                                             org.eclipse.core.runtime.IPath topBuildDirectory)
    -
    -
    -
    Specified by:
    getDependencySourceInfo in interface org.eclipse.cdt.managedbuilder.makegen.IManagedDependencyGenerator2
    Overrides:
    getDependencySourceInfo in class org.eclipse.cdt.managedbuilder.makegen.gnu.DefaultGCCDependencyCalculator2
    -
    -
    -
    -
    -
    -
    - -

    -getDependencySourceInfo

    -
    -public org.eclipse.cdt.managedbuilder.makegen.IManagedDependencyInfo getDependencySourceInfo(org.eclipse.core.runtime.IPath source,
    -                                                                                             org.eclipse.cdt.managedbuilder.core.IBuildObject buildContext,
    -                                                                                             org.eclipse.cdt.managedbuilder.core.ITool tool,
    -                                                                                             org.eclipse.core.runtime.IPath topBuildDirectory)
    -
    -
    -
    Specified by:
    getDependencySourceInfo in interface org.eclipse.cdt.managedbuilder.makegen.IManagedDependencyGenerator2
    Overrides:
    getDependencySourceInfo in class org.eclipse.cdt.managedbuilder.makegen.gnu.DefaultGCCDependencyCalculator2
    -
    -
    -
    -
    -
    - -
    - - - - - - - - - - - - - - - - - - - -
    - -
    - - - -
    - - - + + + + + + +LlvmDependencyCalculator2 + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + + + + + +
    + +
    + + + +
    + +

    + +org.eclipse.cdt.managedbuilder.llvm.makegen +
    +Class LlvmDependencyCalculator2

    +
    +java.lang.Object
    +  extended by org.eclipse.cdt.managedbuilder.makegen.gnu.DefaultGCCDependencyCalculator2
    +      extended by org.eclipse.cdt.managedbuilder.llvm.makegen.LlvmDependencyCalculator2
    +
    +
    +
    All Implemented Interfaces:
    org.eclipse.cdt.managedbuilder.makegen.IManagedDependencyGenerator2, org.eclipse.cdt.managedbuilder.makegen.IManagedDependencyGeneratorType
    +
    +
    +
    +
    public class LlvmDependencyCalculator2
    extends org.eclipse.cdt.managedbuilder.makegen.gnu.DefaultGCCDependencyCalculator2
    + + +

    +


    + +

    + + + + + + + +
    +Field Summary
    + + + + + + + +
    Fields inherited from interface org.eclipse.cdt.managedbuilder.makegen.IManagedDependencyGeneratorType
    TYPE_BUILD_COMMANDS, TYPE_COMMAND, TYPE_CUSTOM, TYPE_EXTERNAL, TYPE_INDEXER, TYPE_NODEPENDENCIES, TYPE_NODEPS, TYPE_OLD_TYPE_LIMIT, TYPE_PREBUILD_COMMANDS
    +  + + + + + + + + + + +
    +Constructor Summary
    LlvmDependencyCalculator2() + +
    +           
    +  + + + + + + + + + + + + + + + +
    +Method Summary
    + org.eclipse.cdt.managedbuilder.makegen.IManagedDependencyInfogetDependencySourceInfo(org.eclipse.core.runtime.IPath source, + org.eclipse.cdt.managedbuilder.core.IBuildObject buildContext, + org.eclipse.cdt.managedbuilder.core.ITool tool, + org.eclipse.core.runtime.IPath topBuildDirectory) + +
    +           
    + org.eclipse.cdt.managedbuilder.makegen.IManagedDependencyInfogetDependencySourceInfo(org.eclipse.core.runtime.IPath source, + org.eclipse.core.resources.IResource resource, + org.eclipse.cdt.managedbuilder.core.IBuildObject buildContext, + org.eclipse.cdt.managedbuilder.core.ITool tool, + org.eclipse.core.runtime.IPath topBuildDirectory) + +
    +           
    + + + + + + + +
    Methods inherited from class org.eclipse.cdt.managedbuilder.makegen.gnu.DefaultGCCDependencyCalculator2
    getCalculatorType, getDependencyFileExtension, postProcessDependencyFile
    + + + + + + + +
    Methods inherited from class java.lang.Object
    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    +  +

    + + + + + + + + +
    +Constructor Detail
    + +

    +LlvmDependencyCalculator2

    +
    +public LlvmDependencyCalculator2()
    +
    +
    + + + + + + + + +
    +Method Detail
    + +

    +getDependencySourceInfo

    +
    +public org.eclipse.cdt.managedbuilder.makegen.IManagedDependencyInfo getDependencySourceInfo(org.eclipse.core.runtime.IPath source,
    +                                                                                             org.eclipse.core.resources.IResource resource,
    +                                                                                             org.eclipse.cdt.managedbuilder.core.IBuildObject buildContext,
    +                                                                                             org.eclipse.cdt.managedbuilder.core.ITool tool,
    +                                                                                             org.eclipse.core.runtime.IPath topBuildDirectory)
    +
    +
    +
    Specified by:
    getDependencySourceInfo in interface org.eclipse.cdt.managedbuilder.makegen.IManagedDependencyGenerator2
    Overrides:
    getDependencySourceInfo in class org.eclipse.cdt.managedbuilder.makegen.gnu.DefaultGCCDependencyCalculator2
    +
    +
    +
    +
    +
    +
    + +

    +getDependencySourceInfo

    +
    +public org.eclipse.cdt.managedbuilder.makegen.IManagedDependencyInfo getDependencySourceInfo(org.eclipse.core.runtime.IPath source,
    +                                                                                             org.eclipse.cdt.managedbuilder.core.IBuildObject buildContext,
    +                                                                                             org.eclipse.cdt.managedbuilder.core.ITool tool,
    +                                                                                             org.eclipse.core.runtime.IPath topBuildDirectory)
    +
    +
    +
    Specified by:
    getDependencySourceInfo in interface org.eclipse.cdt.managedbuilder.makegen.IManagedDependencyGenerator2
    Overrides:
    getDependencySourceInfo in class org.eclipse.cdt.managedbuilder.makegen.gnu.DefaultGCCDependencyCalculator2
    +
    +
    +
    +
    +
    + +
    + + + + + + + + + + + + + + + + + + + +
    + +
    + + + +
    + + + diff --git a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/makegen/LlvmDependencyCalculator2Commands.html b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/makegen/LlvmDependencyCalculator2Commands.html index e17064594d6..b89985f1c5e 100644 --- a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/makegen/LlvmDependencyCalculator2Commands.html +++ b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/makegen/LlvmDependencyCalculator2Commands.html @@ -1,300 +1,300 @@ - - - - - - -LlvmDependencyCalculator2Commands - - - - - - - - - - - - -
    - - - - - - - - - - - - - - - - - - - -
    - -
    - - - -
    - -

    - -org.eclipse.cdt.managedbuilder.llvm.makegen -
    -Class LlvmDependencyCalculator2Commands

    -
    -java.lang.Object
    -  extended by org.eclipse.cdt.managedbuilder.makegen.gnu.DefaultGCCDependencyCalculator2Commands
    -      extended by org.eclipse.cdt.managedbuilder.llvm.makegen.LlvmDependencyCalculator2Commands
    -
    -
    -
    All Implemented Interfaces:
    org.eclipse.cdt.managedbuilder.makegen.IManagedDependencyCommands, org.eclipse.cdt.managedbuilder.makegen.IManagedDependencyInfo
    -
    -
    -
    -
    public class LlvmDependencyCalculator2Commands
    extends org.eclipse.cdt.managedbuilder.makegen.gnu.DefaultGCCDependencyCalculator2Commands
    - - -

    -


    - -

    - - - - - - - - - - - - - - -
    -Constructor Summary
    LlvmDependencyCalculator2Commands(org.eclipse.core.runtime.IPath source, - org.eclipse.cdt.managedbuilder.core.IBuildObject buildContext, - org.eclipse.cdt.managedbuilder.core.ITool tool, - org.eclipse.core.runtime.IPath topBuildDirectory) - -
    -           
    LlvmDependencyCalculator2Commands(org.eclipse.core.runtime.IPath source, - org.eclipse.core.resources.IResource resource, - org.eclipse.cdt.managedbuilder.core.IBuildObject buildContext, - org.eclipse.cdt.managedbuilder.core.ITool tool, - org.eclipse.core.runtime.IPath topBuildDirectory) - -
    -           
    -  - - - - - - - - - - - -
    -Method Summary
    - java.lang.String[]getDependencyCommandOptions() - -
    -           
    - - - - - - - -
    Methods inherited from class org.eclipse.cdt.managedbuilder.makegen.gnu.DefaultGCCDependencyCalculator2Commands
    areCommandsGeneric, getBuildContext, getDependencyFiles, getPostToolDependencyCommands, getPreToolDependencyCommands, getSource, getTool, getTopBuildDirectory
    - - - - - - - -
    Methods inherited from class java.lang.Object
    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    -  -

    - - - - - - - - -
    -Constructor Detail
    - -

    -LlvmDependencyCalculator2Commands

    -
    -public LlvmDependencyCalculator2Commands(org.eclipse.core.runtime.IPath source,
    -                                         org.eclipse.core.resources.IResource resource,
    -                                         org.eclipse.cdt.managedbuilder.core.IBuildObject buildContext,
    -                                         org.eclipse.cdt.managedbuilder.core.ITool tool,
    -                                         org.eclipse.core.runtime.IPath topBuildDirectory)
    -
    -
    -
    Parameters:
    source - IPath
    resource - IResource
    buildContext - IBuildObject
    tool - ITool
    topBuildDirectory - IPath
    -
    -
    - -

    -LlvmDependencyCalculator2Commands

    -
    -public LlvmDependencyCalculator2Commands(org.eclipse.core.runtime.IPath source,
    -                                         org.eclipse.cdt.managedbuilder.core.IBuildObject buildContext,
    -                                         org.eclipse.cdt.managedbuilder.core.ITool tool,
    -                                         org.eclipse.core.runtime.IPath topBuildDirectory)
    -
    -
    -
    Parameters:
    source - IPath
    buildContext - IBuildObject
    tool - ITool
    topBuildDirectory - IPath
    -
    - - - - - - - - -
    -Method Detail
    - -

    -getDependencyCommandOptions

    -
    -public java.lang.String[] getDependencyCommandOptions()
    -
    -
    -
    Specified by:
    getDependencyCommandOptions in interface org.eclipse.cdt.managedbuilder.makegen.IManagedDependencyCommands
    Overrides:
    getDependencyCommandOptions in class org.eclipse.cdt.managedbuilder.makegen.gnu.DefaultGCCDependencyCalculator2Commands
    -
    -
    -
    -
    -
    - -
    - - - - - - - - - - - - - - - - - - - -
    - -
    - - - -
    - - - + + + + + + +LlvmDependencyCalculator2Commands + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + + + + + +
    + +
    + + + +
    + +

    + +org.eclipse.cdt.managedbuilder.llvm.makegen +
    +Class LlvmDependencyCalculator2Commands

    +
    +java.lang.Object
    +  extended by org.eclipse.cdt.managedbuilder.makegen.gnu.DefaultGCCDependencyCalculator2Commands
    +      extended by org.eclipse.cdt.managedbuilder.llvm.makegen.LlvmDependencyCalculator2Commands
    +
    +
    +
    All Implemented Interfaces:
    org.eclipse.cdt.managedbuilder.makegen.IManagedDependencyCommands, org.eclipse.cdt.managedbuilder.makegen.IManagedDependencyInfo
    +
    +
    +
    +
    public class LlvmDependencyCalculator2Commands
    extends org.eclipse.cdt.managedbuilder.makegen.gnu.DefaultGCCDependencyCalculator2Commands
    + + +

    +


    + +

    + + + + + + + + + + + + + + +
    +Constructor Summary
    LlvmDependencyCalculator2Commands(org.eclipse.core.runtime.IPath source, + org.eclipse.cdt.managedbuilder.core.IBuildObject buildContext, + org.eclipse.cdt.managedbuilder.core.ITool tool, + org.eclipse.core.runtime.IPath topBuildDirectory) + +
    +           
    LlvmDependencyCalculator2Commands(org.eclipse.core.runtime.IPath source, + org.eclipse.core.resources.IResource resource, + org.eclipse.cdt.managedbuilder.core.IBuildObject buildContext, + org.eclipse.cdt.managedbuilder.core.ITool tool, + org.eclipse.core.runtime.IPath topBuildDirectory) + +
    +           
    +  + + + + + + + + + + + +
    +Method Summary
    + java.lang.String[]getDependencyCommandOptions() + +
    +           
    + + + + + + + +
    Methods inherited from class org.eclipse.cdt.managedbuilder.makegen.gnu.DefaultGCCDependencyCalculator2Commands
    areCommandsGeneric, getBuildContext, getDependencyFiles, getPostToolDependencyCommands, getPreToolDependencyCommands, getSource, getTool, getTopBuildDirectory
    + + + + + + + +
    Methods inherited from class java.lang.Object
    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    +  +

    + + + + + + + + +
    +Constructor Detail
    + +

    +LlvmDependencyCalculator2Commands

    +
    +public LlvmDependencyCalculator2Commands(org.eclipse.core.runtime.IPath source,
    +                                         org.eclipse.core.resources.IResource resource,
    +                                         org.eclipse.cdt.managedbuilder.core.IBuildObject buildContext,
    +                                         org.eclipse.cdt.managedbuilder.core.ITool tool,
    +                                         org.eclipse.core.runtime.IPath topBuildDirectory)
    +
    +
    +
    Parameters:
    source - IPath
    resource - IResource
    buildContext - IBuildObject
    tool - ITool
    topBuildDirectory - IPath
    +
    +
    + +

    +LlvmDependencyCalculator2Commands

    +
    +public LlvmDependencyCalculator2Commands(org.eclipse.core.runtime.IPath source,
    +                                         org.eclipse.cdt.managedbuilder.core.IBuildObject buildContext,
    +                                         org.eclipse.cdt.managedbuilder.core.ITool tool,
    +                                         org.eclipse.core.runtime.IPath topBuildDirectory)
    +
    +
    +
    Parameters:
    source - IPath
    buildContext - IBuildObject
    tool - ITool
    topBuildDirectory - IPath
    +
    + + + + + + + + +
    +Method Detail
    + +

    +getDependencyCommandOptions

    +
    +public java.lang.String[] getDependencyCommandOptions()
    +
    +
    +
    Specified by:
    getDependencyCommandOptions in interface org.eclipse.cdt.managedbuilder.makegen.IManagedDependencyCommands
    Overrides:
    getDependencyCommandOptions in class org.eclipse.cdt.managedbuilder.makegen.gnu.DefaultGCCDependencyCalculator2Commands
    +
    +
    +
    +
    +
    + +
    + + + + + + + + + + + + + + + + + + + +
    + +
    + + + +
    + + + diff --git a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/makegen/class-use/LlvmDependencyCalculator2.html b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/makegen/class-use/LlvmDependencyCalculator2.html index 929152368a8..30b35ac8aa8 100644 --- a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/makegen/class-use/LlvmDependencyCalculator2.html +++ b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/makegen/class-use/LlvmDependencyCalculator2.html @@ -1,144 +1,144 @@ - - - - - - -Uses of Class org.eclipse.cdt.managedbuilder.llvm.makegen.LlvmDependencyCalculator2 - - - - - - - - - - - - -
    - - - - - - - - - - - - - - - -
    - -
    - - - -
    -
    -

    -Uses of Class
    org.eclipse.cdt.managedbuilder.llvm.makegen.LlvmDependencyCalculator2

    -
    -No usage of org.eclipse.cdt.managedbuilder.llvm.makegen.LlvmDependencyCalculator2 -

    -


    - - - - - - - - - - - - - - - -
    - -
    - - - -
    - - - + + + + + + +Uses of Class org.eclipse.cdt.managedbuilder.llvm.makegen.LlvmDependencyCalculator2 + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + +
    + +
    + + + +
    +
    +

    +Uses of Class
    org.eclipse.cdt.managedbuilder.llvm.makegen.LlvmDependencyCalculator2

    +
    +No usage of org.eclipse.cdt.managedbuilder.llvm.makegen.LlvmDependencyCalculator2 +

    +


    + + + + + + + + + + + + + + + +
    + +
    + + + +
    + + + diff --git a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/makegen/class-use/LlvmDependencyCalculator2Commands.html b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/makegen/class-use/LlvmDependencyCalculator2Commands.html index fbeab5dddf9..b8dc23ee4ec 100644 --- a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/makegen/class-use/LlvmDependencyCalculator2Commands.html +++ b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/makegen/class-use/LlvmDependencyCalculator2Commands.html @@ -1,144 +1,144 @@ - - - - - - -Uses of Class org.eclipse.cdt.managedbuilder.llvm.makegen.LlvmDependencyCalculator2Commands - - - - - - - - - - - - -
    - - - - - - - - - - - - - - - -
    - -
    - - - -
    -
    -

    -Uses of Class
    org.eclipse.cdt.managedbuilder.llvm.makegen.LlvmDependencyCalculator2Commands

    -
    -No usage of org.eclipse.cdt.managedbuilder.llvm.makegen.LlvmDependencyCalculator2Commands -

    -


    - - - - - - - - - - - - - - - -
    - -
    - - - -
    - - - + + + + + + +Uses of Class org.eclipse.cdt.managedbuilder.llvm.makegen.LlvmDependencyCalculator2Commands + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + +
    + +
    + + + +
    +
    +

    +Uses of Class
    org.eclipse.cdt.managedbuilder.llvm.makegen.LlvmDependencyCalculator2Commands

    +
    +No usage of org.eclipse.cdt.managedbuilder.llvm.makegen.LlvmDependencyCalculator2Commands +

    +


    + + + + + + + + + + + + + + + +
    + +
    + + + +
    + + + diff --git a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/makegen/package-frame.html b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/makegen/package-frame.html index 0a6fbb537e9..add1a57e58c 100644 --- a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/makegen/package-frame.html +++ b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/makegen/package-frame.html @@ -1,34 +1,34 @@ - - - - - - -org.eclipse.cdt.managedbuilder.llvm.makegen - - - - - - - - - - - -org.eclipse.cdt.managedbuilder.llvm.makegen - - - - -
    -Classes  - -
    -LlvmDependencyCalculator2 -
    -LlvmDependencyCalculator2Commands
    - - - - + + + + + + +org.eclipse.cdt.managedbuilder.llvm.makegen + + + + + + + + + + + +org.eclipse.cdt.managedbuilder.llvm.makegen + + + + +
    +Classes  + +
    +LlvmDependencyCalculator2 +
    +LlvmDependencyCalculator2Commands
    + + + + diff --git a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/makegen/package-summary.html b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/makegen/package-summary.html index 6ba84db3000..d9ba3c864c3 100644 --- a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/makegen/package-summary.html +++ b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/makegen/package-summary.html @@ -1,161 +1,161 @@ - - - - - - -org.eclipse.cdt.managedbuilder.llvm.makegen - - - - - - - - - - - - -
    - - - - - - - - - - - - - - - -
    - -
    - - - -
    -

    -Package org.eclipse.cdt.managedbuilder.llvm.makegen -

    - - - - - - - - - - - - - -
    -Class Summary
    LlvmDependencyCalculator2 
    LlvmDependencyCalculator2Commands 
    -  - -

    -

    -
    -
    - - - - - - - - - - - - - - - -
    - -
    - - - -
    - - - + + + + + + +org.eclipse.cdt.managedbuilder.llvm.makegen + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + +
    + +
    + + + +
    +

    +Package org.eclipse.cdt.managedbuilder.llvm.makegen +

    + + + + + + + + + + + + + +
    +Class Summary
    LlvmDependencyCalculator2 
    LlvmDependencyCalculator2Commands 
    +  + +

    +

    +
    +
    + + + + + + + + + + + + + + + +
    + +
    + + + +
    + + + diff --git a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/makegen/package-tree.html b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/makegen/package-tree.html index 1fb5487aa93..69b9cdcc95d 100644 --- a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/makegen/package-tree.html +++ b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/makegen/package-tree.html @@ -1,159 +1,159 @@ - - - - - - -org.eclipse.cdt.managedbuilder.llvm.makegen Class Hierarchy - - - - - - - - - - - - -
    - - - - - - - - - - - - - - - -
    - -
    - - - -
    -
    -

    -Hierarchy For Package org.eclipse.cdt.managedbuilder.llvm.makegen -

    -
    -
    -
    Package Hierarchies:
    All Packages
    -
    -

    -Class Hierarchy -

    -
      -
    • java.lang.Object
        -
      • org.eclipse.cdt.managedbuilder.makegen.gnu.DefaultGCCDependencyCalculator2 (implements org.eclipse.cdt.managedbuilder.makegen.IManagedDependencyGenerator2) - -
      • org.eclipse.cdt.managedbuilder.makegen.gnu.DefaultGCCDependencyCalculator2Commands (implements org.eclipse.cdt.managedbuilder.makegen.IManagedDependencyCommands) - -
      -
    -
    - - - - - - - - - - - - - - - -
    - -
    - - - -
    - - - + + + + + + +org.eclipse.cdt.managedbuilder.llvm.makegen Class Hierarchy + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + +
    + +
    + + + +
    +
    +

    +Hierarchy For Package org.eclipse.cdt.managedbuilder.llvm.makegen +

    +
    +
    +
    Package Hierarchies:
    All Packages
    +
    +

    +Class Hierarchy +

    +
      +
    • java.lang.Object
        +
      • org.eclipse.cdt.managedbuilder.makegen.gnu.DefaultGCCDependencyCalculator2 (implements org.eclipse.cdt.managedbuilder.makegen.IManagedDependencyGenerator2) + +
      • org.eclipse.cdt.managedbuilder.makegen.gnu.DefaultGCCDependencyCalculator2Commands (implements org.eclipse.cdt.managedbuilder.makegen.IManagedDependencyCommands) + +
      +
    +
    + + + + + + + + + + + + + + + +
    + +
    + + + +
    + + + diff --git a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/makegen/package-use.html b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/makegen/package-use.html index 84d15416b63..3782be77fa9 100644 --- a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/makegen/package-use.html +++ b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/makegen/package-use.html @@ -1,144 +1,144 @@ - - - - - - -Uses of Package org.eclipse.cdt.managedbuilder.llvm.makegen - - - - - - - - - - - - -
    - - - - - - - - - - - - - - - -
    - -
    - - - -
    -
    -

    -Uses of Package
    org.eclipse.cdt.managedbuilder.llvm.makegen

    -
    -No usage of org.eclipse.cdt.managedbuilder.llvm.makegen -

    -


    - - - - - - - - - - - - - - - -
    - -
    - - - -
    - - - + + + + + + +Uses of Package org.eclipse.cdt.managedbuilder.llvm.makegen + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + +
    + +
    + + + +
    +
    +

    +Uses of Package
    org.eclipse.cdt.managedbuilder.llvm.makegen

    +
    +No usage of org.eclipse.cdt.managedbuilder.llvm.makegen +

    +


    + + + + + + + + + + + + + + + +
    + +
    + + + +
    + + + diff --git a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/scannerconfig/LLVMScannerInfoCollector.html b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/scannerconfig/LLVMScannerInfoCollector.html index e62691d282c..8ace3bfe601 100644 --- a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/scannerconfig/LLVMScannerInfoCollector.html +++ b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/scannerconfig/LLVMScannerInfoCollector.html @@ -1,280 +1,280 @@ - - - - - - -LlvmScannerInfoCollector - - - - - - - - - - - - -
    - - - - - - - - - - - - - - - - - - - -
    - -
    - - - -
    - -

    - -org.eclipse.cdt.managedbuilder.llvm.scannerconfig -
    -Class LlvmScannerInfoCollector

    -
    -java.lang.Object
    -  extended by org.eclipse.cdt.make.internal.core.scannerconfig2.PerProjectSICollector
    -      extended by org.eclipse.cdt.managedbuilder.llvm.scannerconfig.LlvmScannerInfoCollector
    -
    -
    -
    All Implemented Interfaces:
    org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollector, org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollector2, org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollector3, org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollectorCleaner, org.eclipse.cdt.managedbuilder.scannerconfig.IManagedScannerInfoCollector
    -
    -
    -
    -
    public class LlvmScannerInfoCollector
    extends org.eclipse.cdt.make.internal.core.scannerconfig2.PerProjectSICollector
    implements org.eclipse.cdt.managedbuilder.scannerconfig.IManagedScannerInfoCollector
    - - -

    + + + + + + +LlvmScannerInfoCollector + + + + + + + + + + + + +


    + + + + + + + + + + + + + + + + + + + +
    + +
    + + + +
    + +

    + +org.eclipse.cdt.managedbuilder.llvm.scannerconfig +
    +Class LlvmScannerInfoCollector

    +
    +java.lang.Object
    +  extended by org.eclipse.cdt.make.internal.core.scannerconfig2.PerProjectSICollector
    +      extended by org.eclipse.cdt.managedbuilder.llvm.scannerconfig.LlvmScannerInfoCollector
    +
    +
    +
    All Implemented Interfaces:
    org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollector, org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollector2, org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollector3, org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollectorCleaner, org.eclipse.cdt.managedbuilder.scannerconfig.IManagedScannerInfoCollector
    +
    +
    +
    +
    public class LlvmScannerInfoCollector
    extends org.eclipse.cdt.make.internal.core.scannerconfig2.PerProjectSICollector
    implements org.eclipse.cdt.managedbuilder.scannerconfig.IManagedScannerInfoCollector
    + + +

    Implementation class for gathering the built-in compiler settings for Clang/LLVM targets. The assumption is that the tools will answer path information in POSIX format and that the Scanner will be able to search for - files using this format. -

    - -

    -


    - -

    - - - - - - - -
    -Field Summary
    - - - - - - - -
    Fields inherited from class org.eclipse.cdt.make.internal.core.scannerconfig2.PerProjectSICollector
    COLLECTOR_ID
    -  - - - - - - - - - - -
    -Constructor Summary
    LlvmScannerInfoCollector() - -
    -           
    -  - - - - - - - -
    -Method Summary
    - - - - - - - -
    Methods inherited from class org.eclipse.cdt.make.internal.core.scannerconfig2.PerProjectSICollector
    calculateCompilerBuiltins, contributeToScannerConfig, contributeToScannerConfig, createPathInfoObject, deleteAll, deleteAllPaths, deleteAllSymbols, deletePath, deleteSymbol, deserialize, getCollectedScannerInfo, getContext, getDefinedSymbols, getIncludePaths, serialize, setInfoContext, setProject, updateScannerConfiguration
    - - - - - - - -
    Methods inherited from class java.lang.Object
    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    - - - - - - - -
    Methods inherited from interface org.eclipse.cdt.managedbuilder.scannerconfig.IManagedScannerInfoCollector
    getDefinedSymbols, getIncludePaths, setProject
    - - - - - - - -
    Methods inherited from interface org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollector
    contributeToScannerConfig, getCollectedScannerInfo
    -  -

    - - - - - - - - -
    -Constructor Detail
    - -

    -LlvmScannerInfoCollector

    -
    -public LlvmScannerInfoCollector()
    -
    -
    - -
    - - - - - - - - - - - - - - - - - - - -
    - -
    - - - -
    - - - + files using this format. +

    + +

    +


    + +

    + + + + + + + +
    +Field Summary
    + + + + + + + +
    Fields inherited from class org.eclipse.cdt.make.internal.core.scannerconfig2.PerProjectSICollector
    COLLECTOR_ID
    +  + + + + + + + + + + +
    +Constructor Summary
    LlvmScannerInfoCollector() + +
    +           
    +  + + + + + + + +
    +Method Summary
    + + + + + + + +
    Methods inherited from class org.eclipse.cdt.make.internal.core.scannerconfig2.PerProjectSICollector
    calculateCompilerBuiltins, contributeToScannerConfig, contributeToScannerConfig, createPathInfoObject, deleteAll, deleteAllPaths, deleteAllSymbols, deletePath, deleteSymbol, deserialize, getCollectedScannerInfo, getContext, getDefinedSymbols, getIncludePaths, serialize, setInfoContext, setProject, updateScannerConfiguration
    + + + + + + + +
    Methods inherited from class java.lang.Object
    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    + + + + + + + +
    Methods inherited from interface org.eclipse.cdt.managedbuilder.scannerconfig.IManagedScannerInfoCollector
    getDefinedSymbols, getIncludePaths, setProject
    + + + + + + + +
    Methods inherited from interface org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollector
    contributeToScannerConfig, getCollectedScannerInfo
    +  +

    + + + + + + + + +
    +Constructor Detail
    + +

    +LlvmScannerInfoCollector

    +
    +public LlvmScannerInfoCollector()
    +
    +
    + +
    + + + + + + + + + + + + + + + + + + + +
    + +
    + + + +
    + + + diff --git a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/scannerconfig/ManagedLlvmScannerInfoConsoleParser.html b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/scannerconfig/ManagedLlvmScannerInfoConsoleParser.html index e69d578db2a..fc0fad91309 100644 --- a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/scannerconfig/ManagedLlvmScannerInfoConsoleParser.html +++ b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/scannerconfig/ManagedLlvmScannerInfoConsoleParser.html @@ -1,417 +1,417 @@ - - - - - - -ManagedLlvmScannerInfoConsoleParser - - - - - - - - - - - - -
    - - - - - - - - - - - - - - - - - - - -
    - -
    - - - -
    - -

    - -org.eclipse.cdt.managedbuilder.llvm.scannerconfig -
    -Class ManagedLlvmScannerInfoConsoleParser

    -
    -java.lang.Object
    -  extended by org.eclipse.cdt.make.internal.core.scannerconfig.gnu.AbstractGCCBOPConsoleParser
    -      extended by org.eclipse.cdt.make.internal.core.scannerconfig.gnu.GCCScannerInfoConsoleParser
    -          extended by org.eclipse.cdt.managedbuilder.llvm.scannerconfig.ManagedLlvmScannerInfoConsoleParser
    -
    -
    -
    All Implemented Interfaces:
    org.eclipse.cdt.core.IConsoleParser, org.eclipse.cdt.make.core.scannerconfig.IScannerInfoConsoleParser
    -
    -
    -
    -
    public class ManagedLlvmScannerInfoConsoleParser
    extends org.eclipse.cdt.make.internal.core.scannerconfig.gnu.GCCScannerInfoConsoleParser
    - - -

    + + + + + + +ManagedLlvmScannerInfoConsoleParser + + + + + + + + + + + + +


    + + + + + + + + + + + + + + + + + + + +
    + +
    + + + +
    + +

    + +org.eclipse.cdt.managedbuilder.llvm.scannerconfig +
    +Class ManagedLlvmScannerInfoConsoleParser

    +
    +java.lang.Object
    +  extended by org.eclipse.cdt.make.internal.core.scannerconfig.gnu.AbstractGCCBOPConsoleParser
    +      extended by org.eclipse.cdt.make.internal.core.scannerconfig.gnu.GCCScannerInfoConsoleParser
    +          extended by org.eclipse.cdt.managedbuilder.llvm.scannerconfig.ManagedLlvmScannerInfoConsoleParser
    +
    +
    +
    All Implemented Interfaces:
    org.eclipse.cdt.core.IConsoleParser, org.eclipse.cdt.make.core.scannerconfig.IScannerInfoConsoleParser
    +
    +
    +
    +
    public class ManagedLlvmScannerInfoConsoleParser
    extends org.eclipse.cdt.make.internal.core.scannerconfig.gnu.GCCScannerInfoConsoleParser
    + + +

    Copy/pasted from org.eclipse.cdt.managedbuilder.internal.scannerconfig.ManagedGCCScannerInfoConsoleParser because that class cannot be referenced to due to restrictions in the exported packages definition. - TODO: Javadoc comments -

    - -

    -


    - -

    - - - - - - - - - - - -
    -Field Summary
    -private  java.lang.BooleanfManagedBuildOnState - -
    -           
    - - - - - - - -
    Fields inherited from class org.eclipse.cdt.make.internal.core.scannerconfig.gnu.AbstractGCCBOPConsoleParser
    DASHD, DASHI, DASHIDASH
    -  - - - - - - - - - - -
    -Constructor Summary
    ManagedLlvmScannerInfoConsoleParser() - -
    -           
    -  - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -Method Summary
    -protected  booleandoCalcManagedBuildOnState() - -
    -           
    -protected  booleanisManagedBuildOn() - -
    -           
    - booleanprocessLine(java.lang.String line) - -
    -           
    - voidshutdown() - -
    -           
    - voidstartup(org.eclipse.core.resources.IProject project, - org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollector collector) - -
    -           
    - - - - - - - -
    Methods inherited from class org.eclipse.cdt.make.internal.core.scannerconfig.gnu.GCCScannerInfoConsoleParser
    getUtility, processCommand, setDefaultMacroDefinitionValue, startup
    - - - - - - - -
    Methods inherited from class org.eclipse.cdt.make.internal.core.scannerconfig.gnu.AbstractGCCBOPConsoleParser
    findCompilerInvocation, getCollector, getProject, processSingleLine, tokenize
    - - - - - - - -
    Methods inherited from class java.lang.Object
    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    -  -

    - - - - - - - - -
    -Field Detail
    - -

    -fManagedBuildOnState

    -
    -private java.lang.Boolean fManagedBuildOnState
    -
    -
    -
    -
    - - - - - - - - -
    -Constructor Detail
    - -

    -ManagedLlvmScannerInfoConsoleParser

    -
    -public ManagedLlvmScannerInfoConsoleParser()
    -
    -
    - - - - - - - - -
    -Method Detail
    - -

    -processLine

    -
    -public boolean processLine(java.lang.String line)
    -
    -
    -
    Specified by:
    processLine in interface org.eclipse.cdt.core.IConsoleParser
    Overrides:
    processLine in class org.eclipse.cdt.make.internal.core.scannerconfig.gnu.AbstractGCCBOPConsoleParser
    -
    -
    -
    Parameters:
    line - String -
    Returns:
    boolean
    -
    -
    -
    - -

    -shutdown

    -
    -public void shutdown()
    -
    -
    -
    Specified by:
    shutdown in interface org.eclipse.cdt.core.IConsoleParser
    Overrides:
    shutdown in class org.eclipse.cdt.make.internal.core.scannerconfig.gnu.AbstractGCCBOPConsoleParser
    -
    -
    -
    -
    -
    -
    - -

    -startup

    -
    -public void startup(org.eclipse.core.resources.IProject project,
    -                    org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollector collector)
    -
    -
    -
    Overrides:
    startup in class org.eclipse.cdt.make.internal.core.scannerconfig.gnu.AbstractGCCBOPConsoleParser
    -
    -
    -
    Parameters:
    project - IProject
    collector - IScannerInfoCollector
    -
    -
    -
    - -

    -isManagedBuildOn

    -
    -protected boolean isManagedBuildOn()
    -
    -
    - -
    Returns:
    boolean
    -
    -
    -
    - -

    -doCalcManagedBuildOnState

    -
    -protected boolean doCalcManagedBuildOnState()
    -
    -
    - -
    Returns:
    boolean
    -
    -
    - -
    - - - - - - - - - - - - - - - - - - - -
    - -
    - - - -
    - - - + TODO: Javadoc comments +

    + +

    +


    + +

    + + + + + + + + + + + +
    +Field Summary
    +private  java.lang.BooleanfManagedBuildOnState + +
    +           
    + + + + + + + +
    Fields inherited from class org.eclipse.cdt.make.internal.core.scannerconfig.gnu.AbstractGCCBOPConsoleParser
    DASHD, DASHI, DASHIDASH
    +  + + + + + + + + + + +
    +Constructor Summary
    ManagedLlvmScannerInfoConsoleParser() + +
    +           
    +  + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +Method Summary
    +protected  booleandoCalcManagedBuildOnState() + +
    +           
    +protected  booleanisManagedBuildOn() + +
    +           
    + booleanprocessLine(java.lang.String line) + +
    +           
    + voidshutdown() + +
    +           
    + voidstartup(org.eclipse.core.resources.IProject project, + org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollector collector) + +
    +           
    + + + + + + + +
    Methods inherited from class org.eclipse.cdt.make.internal.core.scannerconfig.gnu.GCCScannerInfoConsoleParser
    getUtility, processCommand, setDefaultMacroDefinitionValue, startup
    + + + + + + + +
    Methods inherited from class org.eclipse.cdt.make.internal.core.scannerconfig.gnu.AbstractGCCBOPConsoleParser
    findCompilerInvocation, getCollector, getProject, processSingleLine, tokenize
    + + + + + + + +
    Methods inherited from class java.lang.Object
    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    +  +

    + + + + + + + + +
    +Field Detail
    + +

    +fManagedBuildOnState

    +
    +private java.lang.Boolean fManagedBuildOnState
    +
    +
    +
    +
    + + + + + + + + +
    +Constructor Detail
    + +

    +ManagedLlvmScannerInfoConsoleParser

    +
    +public ManagedLlvmScannerInfoConsoleParser()
    +
    +
    + + + + + + + + +
    +Method Detail
    + +

    +processLine

    +
    +public boolean processLine(java.lang.String line)
    +
    +
    +
    Specified by:
    processLine in interface org.eclipse.cdt.core.IConsoleParser
    Overrides:
    processLine in class org.eclipse.cdt.make.internal.core.scannerconfig.gnu.AbstractGCCBOPConsoleParser
    +
    +
    +
    Parameters:
    line - String +
    Returns:
    boolean
    +
    +
    +
    + +

    +shutdown

    +
    +public void shutdown()
    +
    +
    +
    Specified by:
    shutdown in interface org.eclipse.cdt.core.IConsoleParser
    Overrides:
    shutdown in class org.eclipse.cdt.make.internal.core.scannerconfig.gnu.AbstractGCCBOPConsoleParser
    +
    +
    +
    +
    +
    +
    + +

    +startup

    +
    +public void startup(org.eclipse.core.resources.IProject project,
    +                    org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollector collector)
    +
    +
    +
    Overrides:
    startup in class org.eclipse.cdt.make.internal.core.scannerconfig.gnu.AbstractGCCBOPConsoleParser
    +
    +
    +
    Parameters:
    project - IProject
    collector - IScannerInfoCollector
    +
    +
    +
    + +

    +isManagedBuildOn

    +
    +protected boolean isManagedBuildOn()
    +
    +
    + +
    Returns:
    boolean
    +
    +
    +
    + +

    +doCalcManagedBuildOnState

    +
    +protected boolean doCalcManagedBuildOnState()
    +
    +
    + +
    Returns:
    boolean
    +
    +
    + +
    + + + + + + + + + + + + + + + + + + + +
    + +
    + + + +
    + + + diff --git a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/scannerconfig/class-use/LLVMScannerInfoCollector.html b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/scannerconfig/class-use/LLVMScannerInfoCollector.html index c9ddef95b58..2a00dae5ff6 100644 --- a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/scannerconfig/class-use/LLVMScannerInfoCollector.html +++ b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/scannerconfig/class-use/LLVMScannerInfoCollector.html @@ -1,144 +1,144 @@ - - - - - - -Uses of Class org.eclipse.cdt.managedbuilder.llvm.scannerconfig.LlvmScannerInfoCollector - - - - - - - - - - - - -
    - - - - - - - - - - - - - - - -
    - -
    - - - -
    -
    -

    -Uses of Class
    org.eclipse.cdt.managedbuilder.llvm.scannerconfig.LlvmScannerInfoCollector

    -
    -No usage of org.eclipse.cdt.managedbuilder.llvm.scannerconfig.LlvmScannerInfoCollector -

    -


    - - - - - - - - - - - - - - - -
    - -
    - - - -
    - - - + + + + + + +Uses of Class org.eclipse.cdt.managedbuilder.llvm.scannerconfig.LlvmScannerInfoCollector + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + +
    + +
    + + + +
    +
    +

    +Uses of Class
    org.eclipse.cdt.managedbuilder.llvm.scannerconfig.LlvmScannerInfoCollector

    +
    +No usage of org.eclipse.cdt.managedbuilder.llvm.scannerconfig.LlvmScannerInfoCollector +

    +


    + + + + + + + + + + + + + + + +
    + +
    + + + +
    + + + diff --git a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/scannerconfig/class-use/ManagedLlvmScannerInfoConsoleParser.html b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/scannerconfig/class-use/ManagedLlvmScannerInfoConsoleParser.html index 17d17e14bd3..da696c507f4 100644 --- a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/scannerconfig/class-use/ManagedLlvmScannerInfoConsoleParser.html +++ b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/scannerconfig/class-use/ManagedLlvmScannerInfoConsoleParser.html @@ -1,144 +1,144 @@ - - - - - - -Uses of Class org.eclipse.cdt.managedbuilder.llvm.scannerconfig.ManagedLlvmScannerInfoConsoleParser - - - - - - - - - - - - -
    - - - - - - - - - - - - - - - -
    - -
    - - - -
    -
    -

    -Uses of Class
    org.eclipse.cdt.managedbuilder.llvm.scannerconfig.ManagedLlvmScannerInfoConsoleParser

    -
    -No usage of org.eclipse.cdt.managedbuilder.llvm.scannerconfig.ManagedLlvmScannerInfoConsoleParser -

    -


    - - - - - - - - - - - - - - - -
    - -
    - - - -
    - - - + + + + + + +Uses of Class org.eclipse.cdt.managedbuilder.llvm.scannerconfig.ManagedLlvmScannerInfoConsoleParser + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + +
    + +
    + + + +
    +
    +

    +Uses of Class
    org.eclipse.cdt.managedbuilder.llvm.scannerconfig.ManagedLlvmScannerInfoConsoleParser

    +
    +No usage of org.eclipse.cdt.managedbuilder.llvm.scannerconfig.ManagedLlvmScannerInfoConsoleParser +

    +


    + + + + + + + + + + + + + + + +
    + +
    + + + +
    + + + diff --git a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/scannerconfig/package-frame.html b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/scannerconfig/package-frame.html index 044aee56a0e..99dcc7eedbe 100644 --- a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/scannerconfig/package-frame.html +++ b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/scannerconfig/package-frame.html @@ -1,34 +1,34 @@ - - - - - - -org.eclipse.cdt.managedbuilder.llvm.scannerconfig - - - - - - - - - - - -org.eclipse.cdt.managedbuilder.llvm.scannerconfig - - - - -
    -Classes  - -
    -LlvmScannerInfoCollector -
    -ManagedLlvmScannerInfoConsoleParser
    - - - - + + + + + + +org.eclipse.cdt.managedbuilder.llvm.scannerconfig + + + + + + + + + + + +org.eclipse.cdt.managedbuilder.llvm.scannerconfig + + + + +
    +Classes  + +
    +LlvmScannerInfoCollector +
    +ManagedLlvmScannerInfoConsoleParser
    + + + + diff --git a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/scannerconfig/package-summary.html b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/scannerconfig/package-summary.html index 5ee712bf064..f89eef7e5ee 100644 --- a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/scannerconfig/package-summary.html +++ b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/scannerconfig/package-summary.html @@ -1,163 +1,163 @@ - - - - - - -org.eclipse.cdt.managedbuilder.llvm.scannerconfig - - - - - - - - - - - - -
    - - - - - - - - - - - - - - - -
    - -
    - - - -
    -

    -Package org.eclipse.cdt.managedbuilder.llvm.scannerconfig -

    - - - - - - - + + + + + + +org.eclipse.cdt.managedbuilder.llvm.scannerconfig + + + + + + + + + + + + +
    + + + + + +
    -Class Summary
    LlvmScannerInfoCollector
    + + + + + + + + + +
    + +
    + + + +
    +

    +Package org.eclipse.cdt.managedbuilder.llvm.scannerconfig +

    + + + + + + + - - - + Clang/LLVM targets. + + + - -
    +Class Summary
    LlvmScannerInfoCollector Implementation class for gathering the built-in compiler settings for - Clang/LLVM targets.
    ManagedLlvmScannerInfoConsoleParser
    ManagedLlvmScannerInfoConsoleParser Copy/pasted from org.eclipse.cdt.managedbuilder.internal.scannerconfig.ManagedGCCScannerInfoConsoleParser - because that class cannot be referenced to due to restrictions in the exported packages definition.
    -  - -

    -

    -
    -
    - - - - - - - - - - - - - - - -
    - -
    - - - -
    - - - + because that class cannot be referenced to due to restrictions in the exported packages definition. + + +  + +

    +

    +
    +
    + + + + + + + + + + + + + + + +
    + +
    + + + +
    + + + diff --git a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/scannerconfig/package-tree.html b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/scannerconfig/package-tree.html index 5dcc65961b0..7d4c45654f2 100644 --- a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/scannerconfig/package-tree.html +++ b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/scannerconfig/package-tree.html @@ -1,162 +1,162 @@ - - - - - - -org.eclipse.cdt.managedbuilder.llvm.scannerconfig Class Hierarchy - - - - - - - - - - - - -
    - - - - - - - - - - - - - - - -
    - -
    - - - -
    -
    -

    -Hierarchy For Package org.eclipse.cdt.managedbuilder.llvm.scannerconfig -

    -
    -
    -
    Package Hierarchies:
    All Packages
    -
    -

    -Class Hierarchy -

    -
      -
    • java.lang.Object
        -
      • org.eclipse.cdt.make.internal.core.scannerconfig.gnu.AbstractGCCBOPConsoleParser (implements org.eclipse.cdt.make.core.scannerconfig.IScannerInfoConsoleParser) - -
      • org.eclipse.cdt.make.internal.core.scannerconfig2.PerProjectSICollector (implements org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollector3, org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollectorCleaner) -
          -
        • org.eclipse.cdt.managedbuilder.llvm.scannerconfig.LlvmScannerInfoCollector (implements org.eclipse.cdt.managedbuilder.scannerconfig.IManagedScannerInfoCollector) -
        -
      -
    -
    - - - - - - - - - - - - - - - -
    - -
    - - - -
    - - - + + + + + + +org.eclipse.cdt.managedbuilder.llvm.scannerconfig Class Hierarchy + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + +
    + +
    + + + +
    +
    +

    +Hierarchy For Package org.eclipse.cdt.managedbuilder.llvm.scannerconfig +

    +
    +
    +
    Package Hierarchies:
    All Packages
    +
    +

    +Class Hierarchy +

    +
      +
    • java.lang.Object
        +
      • org.eclipse.cdt.make.internal.core.scannerconfig.gnu.AbstractGCCBOPConsoleParser (implements org.eclipse.cdt.make.core.scannerconfig.IScannerInfoConsoleParser) + +
      • org.eclipse.cdt.make.internal.core.scannerconfig2.PerProjectSICollector (implements org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollector3, org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollectorCleaner) +
          +
        • org.eclipse.cdt.managedbuilder.llvm.scannerconfig.LlvmScannerInfoCollector (implements org.eclipse.cdt.managedbuilder.scannerconfig.IManagedScannerInfoCollector) +
        +
      +
    +
    + + + + + + + + + + + + + + + +
    + +
    + + + +
    + + + diff --git a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/scannerconfig/package-use.html b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/scannerconfig/package-use.html index 2d052d16c06..b9030730072 100644 --- a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/scannerconfig/package-use.html +++ b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/scannerconfig/package-use.html @@ -1,144 +1,144 @@ - - - - - - -Uses of Package org.eclipse.cdt.managedbuilder.llvm.scannerconfig - - - - - - - - - - - - -
    - - - - - - - - - - - - - - - -
    - -
    - - - -
    -
    -

    -Uses of Package
    org.eclipse.cdt.managedbuilder.llvm.scannerconfig

    -
    -No usage of org.eclipse.cdt.managedbuilder.llvm.scannerconfig -

    -


    - - - - - - - - - - - - - - - -
    - -
    - - - -
    - - - + + + + + + +Uses of Package org.eclipse.cdt.managedbuilder.llvm.scannerconfig + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + +
    + +
    + + + +
    +
    +

    +Uses of Package
    org.eclipse.cdt.managedbuilder.llvm.scannerconfig

    +
    +No usage of org.eclipse.cdt.managedbuilder.llvm.scannerconfig +

    +


    + + + + + + + + + + + + + + + +
    + +
    + + + +
    + + + diff --git a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/ui/LlvmBuildEnvironmentVariable.html b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/ui/LlvmBuildEnvironmentVariable.html index f92b51e4407..e8dce0ec582 100644 --- a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/ui/LlvmBuildEnvironmentVariable.html +++ b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/ui/LlvmBuildEnvironmentVariable.html @@ -1,429 +1,429 @@ - - - - - - -LlvmBuildEnvironmentVariable - - - - - - - - - - - - -
    - - - - - - - - - - - - - - - - - - - -
    - -
    - - - -
    - -

    - -org.eclipse.cdt.managedbuilder.llvm.ui -
    -Class LlvmBuildEnvironmentVariable

    -
    -java.lang.Object
    -  extended by org.eclipse.cdt.managedbuilder.llvm.ui.LlvmBuildEnvironmentVariable
    -
    -
    -
    All Implemented Interfaces:
    org.eclipse.cdt.core.envvar.IEnvironmentVariable, org.eclipse.cdt.managedbuilder.envvar.IBuildEnvironmentVariable
    -
    -
    -
    -
    public class LlvmBuildEnvironmentVariable
    extends java.lang.Object
    implements org.eclipse.cdt.managedbuilder.envvar.IBuildEnvironmentVariable
    - - -

    -Implemented type that contains BuildEnvironmentalVariables. -

    - -

    -


    - -

    - - - - - - - - - - - - - - - - - - - -
    -Field Summary
    -private  java.lang.Stringname - -
    -           
    -private  intoperation - -
    -           
    -private  java.lang.Stringvalue - -
    -           
    - - - - - - - -
    Fields inherited from interface org.eclipse.cdt.managedbuilder.envvar.IBuildEnvironmentVariable
    ENVVAR_APPEND, ENVVAR_PREPEND, ENVVAR_REMOVE, ENVVAR_REPLACE
    -  - - - - - - - - - - -
    -Constructor Summary
    LlvmBuildEnvironmentVariable(java.lang.String name, - java.lang.String value, - int operation) - -
    -          Constructor.
    -  - - - - - - - - - - - - - - - - - - - - - - - -
    -Method Summary
    - java.lang.StringgetDelimiter() - -
    -          Get a delimiter.
    - java.lang.StringgetName() - -
    -          Get name of the llvm environment variable.
    - intgetOperation() - -
    -          Get operation of the llvm environment variable.
    - java.lang.StringgetValue() - -
    -          Get value of the llvm environment variable.
    - - - - - - - -
    Methods inherited from class java.lang.Object
    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    -  -

    - - - - - - - - -
    -Field Detail
    - -

    -name

    -
    -private final java.lang.String name
    -
    -
    -
    -
    -
    - -

    -value

    -
    -private final java.lang.String value
    -
    -
    -
    -
    -
    - -

    -operation

    -
    -private final int operation
    -
    -
    -
    -
    - - - - - - - - -
    -Constructor Detail
    - -

    -LlvmBuildEnvironmentVariable

    -
    -public LlvmBuildEnvironmentVariable(java.lang.String name,
    -                                    java.lang.String value,
    -                                    int operation)
    -
    -
    Constructor. -

    -

    -
    Parameters:
    name - Name for the environment variable
    value - Value for the environment variable
    operation - Operation of the environment variable
    -
    - - - - - - - - -
    -Method Detail
    - -

    -getDelimiter

    -
    -public java.lang.String getDelimiter()
    -
    -
    Get a delimiter. -

    -

    -
    Specified by:
    getDelimiter in interface org.eclipse.cdt.core.envvar.IEnvironmentVariable
    Specified by:
    getDelimiter in interface org.eclipse.cdt.managedbuilder.envvar.IBuildEnvironmentVariable
    -
    -
    - -
    Returns:
    String delimiter
    -
    -
    -
    - -

    -getName

    -
    -public java.lang.String getName()
    -
    -
    Get name of the llvm environment variable. -

    -

    -
    Specified by:
    getName in interface org.eclipse.cdt.core.envvar.IEnvironmentVariable
    Specified by:
    getName in interface org.eclipse.cdt.managedbuilder.envvar.IBuildEnvironmentVariable
    -
    -
    - -
    Returns:
    name The name of the llvm environment variable
    -
    -
    -
    - -

    -getOperation

    -
    -public int getOperation()
    -
    -
    Get operation of the llvm environment variable. -

    -

    -
    Specified by:
    getOperation in interface org.eclipse.cdt.core.envvar.IEnvironmentVariable
    Specified by:
    getOperation in interface org.eclipse.cdt.managedbuilder.envvar.IBuildEnvironmentVariable
    -
    -
    - -
    Returns:
    operation The operation of the llvm environment variable
    -
    -
    -
    - -

    -getValue

    -
    -public java.lang.String getValue()
    -
    -
    Get value of the llvm environment variable. -

    -

    -
    Specified by:
    getValue in interface org.eclipse.cdt.core.envvar.IEnvironmentVariable
    Specified by:
    getValue in interface org.eclipse.cdt.managedbuilder.envvar.IBuildEnvironmentVariable
    -
    -
    - -
    Returns:
    value The value of the llvm environment variable.
    -
    -
    - -
    - - - - - - - - - - - - - - - - - - - -
    - -
    - - - -
    - - - + + + + + + +LlvmBuildEnvironmentVariable + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + + + + + +
    + +
    + + + +
    + +

    + +org.eclipse.cdt.managedbuilder.llvm.ui +
    +Class LlvmBuildEnvironmentVariable

    +
    +java.lang.Object
    +  extended by org.eclipse.cdt.managedbuilder.llvm.ui.LlvmBuildEnvironmentVariable
    +
    +
    +
    All Implemented Interfaces:
    org.eclipse.cdt.core.envvar.IEnvironmentVariable, org.eclipse.cdt.managedbuilder.envvar.IBuildEnvironmentVariable
    +
    +
    +
    +
    public class LlvmBuildEnvironmentVariable
    extends java.lang.Object
    implements org.eclipse.cdt.managedbuilder.envvar.IBuildEnvironmentVariable
    + + +

    +Implemented type that contains BuildEnvironmentalVariables. +

    + +

    +


    + +

    + + + + + + + + + + + + + + + + + + + +
    +Field Summary
    +private  java.lang.Stringname + +
    +           
    +private  intoperation + +
    +           
    +private  java.lang.Stringvalue + +
    +           
    + + + + + + + +
    Fields inherited from interface org.eclipse.cdt.managedbuilder.envvar.IBuildEnvironmentVariable
    ENVVAR_APPEND, ENVVAR_PREPEND, ENVVAR_REMOVE, ENVVAR_REPLACE
    +  + + + + + + + + + + +
    +Constructor Summary
    LlvmBuildEnvironmentVariable(java.lang.String name, + java.lang.String value, + int operation) + +
    +          Constructor.
    +  + + + + + + + + + + + + + + + + + + + + + + + +
    +Method Summary
    + java.lang.StringgetDelimiter() + +
    +          Get a delimiter.
    + java.lang.StringgetName() + +
    +          Get name of the llvm environment variable.
    + intgetOperation() + +
    +          Get operation of the llvm environment variable.
    + java.lang.StringgetValue() + +
    +          Get value of the llvm environment variable.
    + + + + + + + +
    Methods inherited from class java.lang.Object
    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    +  +

    + + + + + + + + +
    +Field Detail
    + +

    +name

    +
    +private final java.lang.String name
    +
    +
    +
    +
    +
    + +

    +value

    +
    +private final java.lang.String value
    +
    +
    +
    +
    +
    + +

    +operation

    +
    +private final int operation
    +
    +
    +
    +
    + + + + + + + + +
    +Constructor Detail
    + +

    +LlvmBuildEnvironmentVariable

    +
    +public LlvmBuildEnvironmentVariable(java.lang.String name,
    +                                    java.lang.String value,
    +                                    int operation)
    +
    +
    Constructor. +

    +

    +
    Parameters:
    name - Name for the environment variable
    value - Value for the environment variable
    operation - Operation of the environment variable
    +
    + + + + + + + + +
    +Method Detail
    + +

    +getDelimiter

    +
    +public java.lang.String getDelimiter()
    +
    +
    Get a delimiter. +

    +

    +
    Specified by:
    getDelimiter in interface org.eclipse.cdt.core.envvar.IEnvironmentVariable
    Specified by:
    getDelimiter in interface org.eclipse.cdt.managedbuilder.envvar.IBuildEnvironmentVariable
    +
    +
    + +
    Returns:
    String delimiter
    +
    +
    +
    + +

    +getName

    +
    +public java.lang.String getName()
    +
    +
    Get name of the llvm environment variable. +

    +

    +
    Specified by:
    getName in interface org.eclipse.cdt.core.envvar.IEnvironmentVariable
    Specified by:
    getName in interface org.eclipse.cdt.managedbuilder.envvar.IBuildEnvironmentVariable
    +
    +
    + +
    Returns:
    name The name of the llvm environment variable
    +
    +
    +
    + +

    +getOperation

    +
    +public int getOperation()
    +
    +
    Get operation of the llvm environment variable. +

    +

    +
    Specified by:
    getOperation in interface org.eclipse.cdt.core.envvar.IEnvironmentVariable
    Specified by:
    getOperation in interface org.eclipse.cdt.managedbuilder.envvar.IBuildEnvironmentVariable
    +
    +
    + +
    Returns:
    operation The operation of the llvm environment variable
    +
    +
    +
    + +

    +getValue

    +
    +public java.lang.String getValue()
    +
    +
    Get value of the llvm environment variable. +

    +

    +
    Specified by:
    getValue in interface org.eclipse.cdt.core.envvar.IEnvironmentVariable
    Specified by:
    getValue in interface org.eclipse.cdt.managedbuilder.envvar.IBuildEnvironmentVariable
    +
    +
    + +
    Returns:
    value The value of the llvm environment variable.
    +
    +
    + +
    + + + + + + + + + + + + + + + + + + + +
    + +
    + + + +
    + + + diff --git a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/ui/LlvmEnvironmentVariableSupplier.html b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/ui/LlvmEnvironmentVariableSupplier.html index 58c751628e6..4b58297ef0b 100644 --- a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/ui/LlvmEnvironmentVariableSupplier.html +++ b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/ui/LlvmEnvironmentVariableSupplier.html @@ -1,908 +1,908 @@ - - - - - - -LlvmEnvironmentVariableSupplier - - - - - - - - - - - - -
    - - - - - - - - - - - - - - - - - - - -
    - -
    - - - -
    - -

    - -org.eclipse.cdt.managedbuilder.llvm.ui -
    -Class LlvmEnvironmentVariableSupplier

    -
    -java.lang.Object
    -  extended by org.eclipse.cdt.managedbuilder.llvm.ui.LlvmEnvironmentVariableSupplier
    -
    -
    -
    All Implemented Interfaces:
    org.eclipse.cdt.managedbuilder.envvar.IConfigurationEnvironmentVariableSupplier
    -
    -
    -
    -
    public class LlvmEnvironmentVariableSupplier
    extends java.lang.Object
    implements org.eclipse.cdt.managedbuilder.envvar.IConfigurationEnvironmentVariableSupplier
    - - -

    -Contains LLVM environment variables. -

    - -

    -


    - -

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -Field Summary
    -private static java.lang.StringENV_VAR_NAME_INCLUDE_PATH - -
    -           
    -private static java.lang.StringENV_VAR_NAME_LIBRARIES - -
    -           
    -private static java.lang.StringENV_VAR_NAME_LIBRARY_PATH - -
    -           
    -private static java.lang.StringENV_VAR_NAME_LLVM_BIN - -
    -           
    -private static java.lang.StringENV_VAR_NAME_LLVMINTERP - -
    -           
    -private static java.lang.StringENV_VAR_NAME_PATH - -
    -           
    -private static java.util.HashMap<java.lang.String,LlvmBuildEnvironmentVariable>llvmEnvironmentVariables - -
    -           
    -private static booleanpreferencesChanged - -
    -           
    -  - - - - - - - - - - -
    -Constructor Summary
    LlvmEnvironmentVariableSupplier() - -
    -          Constructor.
    -  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    -Method Summary
    -static voidaddIncludePath(java.lang.String path) - -
    -          Append a new include path.
    -static voidaddLibrary(java.lang.String lib) - -
    -          Append a new library.
    -static voidaddLibraryPath(java.lang.String path) - -
    -          Append a new library path.
    -private static voidappendLlvmEnvironmentVariable(java.lang.String name, - java.lang.String oldPath, - java.lang.String path) - -
    -          Append a new LLVM environment variable to existing list.
    -private static java.lang.StringfindBinDir(java.lang.String pathKey, - java.lang.String subDirName) - -
    -          Get a specific path for given parameters.
    -private static java.lang.StringgetBinDirIfLlvm_ar(java.lang.String binPathTemp) - -
    + + + + + + +LlvmEnvironmentVariableSupplier + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + + + + + +
    + +
    + + + +
    + +

    + +org.eclipse.cdt.managedbuilder.llvm.ui +
    +Class LlvmEnvironmentVariableSupplier

    +
    +java.lang.Object
    +  extended by org.eclipse.cdt.managedbuilder.llvm.ui.LlvmEnvironmentVariableSupplier
    +
    +
    +
    All Implemented Interfaces:
    org.eclipse.cdt.managedbuilder.envvar.IConfigurationEnvironmentVariableSupplier
    +
    +
    +
    +
    public class LlvmEnvironmentVariableSupplier
    extends java.lang.Object
    implements org.eclipse.cdt.managedbuilder.envvar.IConfigurationEnvironmentVariableSupplier
    + + +

    +Contains LLVM environment variables. +

    + +

    +


    + +

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +Field Summary
    +private static java.lang.StringENV_VAR_NAME_INCLUDE_PATH + +
    +           
    +private static java.lang.StringENV_VAR_NAME_LIBRARIES + +
    +           
    +private static java.lang.StringENV_VAR_NAME_LIBRARY_PATH + +
    +           
    +private static java.lang.StringENV_VAR_NAME_LLVM_BIN + +
    +           
    +private static java.lang.StringENV_VAR_NAME_LLVMINTERP + +
    +           
    +private static java.lang.StringENV_VAR_NAME_PATH + +
    +           
    +private static java.util.HashMap<java.lang.String,LlvmBuildEnvironmentVariable>llvmEnvironmentVariables + +
    +           
    +private static booleanpreferencesChanged + +
    +           
    +  + + + + + + + + + + +
    +Constructor Summary
    LlvmEnvironmentVariableSupplier() + +
    +          Constructor.
    +  + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    +Method Summary
    +static voidaddIncludePath(java.lang.String path) + +
    +          Append a new include path.
    +static voidaddLibrary(java.lang.String lib) + +
    +          Append a new library.
    +static voidaddLibraryPath(java.lang.String path) + +
    +          Append a new library path.
    +private static voidappendLlvmEnvironmentVariable(java.lang.String name, + java.lang.String oldPath, + java.lang.String path) + +
    +          Append a new LLVM environment variable to existing list.
    +private static java.lang.StringfindBinDir(java.lang.String pathKey, + java.lang.String subDirName) + +
    +          Get a specific path for given parameters.
    +private static java.lang.StringgetBinDirIfLlvm_ar(java.lang.String binPathTemp) + +
              Get the full path for llvm executable if the bin path given - as a parameter is found and executable exists in that path.
    -static java.lang.StringgetBinPath() - -
    -          Get LLVM bin path
    -private static java.lang.StringgetDirIfLlvmFound(java.lang.String candidatePath, - java.lang.String subPath) - -
    -          Get LLVM executable path.
    -static java.lang.StringgetIncludePath() - -
    -          Get LLVM include paths
    -static java.lang.StringgetLibraries() - -
    -          Get LLVM libraries
    -static java.lang.StringgetLibraryPath() - -
    -          Get LLVM library paths
    -static LlvmBuildEnvironmentVariablegetLlvmEnvironmentVariable(java.lang.String envName) - -
    -          Get LLVM environment variable.
    -private static java.lang.StringgetSysEnvPath(java.lang.String envName) - -
    -          Returns a system environment variable path
    - org.eclipse.cdt.managedbuilder.envvar.IBuildEnvironmentVariablegetVariable(java.lang.String variableName, - org.eclipse.cdt.managedbuilder.core.IConfiguration configuration, - org.eclipse.cdt.managedbuilder.envvar.IEnvironmentVariableProvider provider) - -
    -           
    - org.eclipse.cdt.managedbuilder.envvar.IBuildEnvironmentVariable[]getVariables(org.eclipse.cdt.managedbuilder.core.IConfiguration configuration, - org.eclipse.cdt.managedbuilder.envvar.IEnvironmentVariableProvider provider) - -
    -           
    -private static voidinitializePaths() - -
    -          Initializes llvm environment variable paths from the system environment variables.
    -static voidnotifyPreferenceChange() - -
    -          This is to be called if some of the preference paths have changed.
    -static voidsetBinPath(java.lang.String path) - -
    -          Set path to LLVM bin.
    -private static voidsetLlvmEnvironmentVariable(java.lang.String name, - java.lang.String path) - -
    -          Set LLVM environment variable.
    -static voidsetLlvmEnvironmentVariableReplace(java.lang.String name, - java.lang.String path) - -
    -          Set LLVM environment variable by replacing the existing paths.
    - - - - - - - -
    Methods inherited from class java.lang.Object
    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    -  -

    - - - - - - - - -
    -Field Detail
    - -

    -preferencesChanged

    -
    -private static boolean preferencesChanged
    -
    -
    -
    -
    -
    - -

    -llvmEnvironmentVariables

    -
    -private static java.util.HashMap<java.lang.String,LlvmBuildEnvironmentVariable> llvmEnvironmentVariables
    -
    -
    -
    -
    -
    - -

    -ENV_VAR_NAME_LLVM_BIN

    -
    -private static final java.lang.String ENV_VAR_NAME_LLVM_BIN
    -
    -
    -
    See Also:
    Constant Field Values
    -
    -
    - -

    -ENV_VAR_NAME_LLVMINTERP

    -
    -private static final java.lang.String ENV_VAR_NAME_LLVMINTERP
    -
    -
    -
    See Also:
    Constant Field Values
    -
    -
    - -

    -ENV_VAR_NAME_PATH

    -
    -private static final java.lang.String ENV_VAR_NAME_PATH
    -
    -
    -
    See Also:
    Constant Field Values
    -
    -
    - -

    -ENV_VAR_NAME_INCLUDE_PATH

    -
    -private static final java.lang.String ENV_VAR_NAME_INCLUDE_PATH
    -
    -
    -
    See Also:
    Constant Field Values
    -
    -
    - -

    -ENV_VAR_NAME_LIBRARY_PATH

    -
    -private static final java.lang.String ENV_VAR_NAME_LIBRARY_PATH
    -
    -
    -
    See Also:
    Constant Field Values
    -
    -
    - -

    -ENV_VAR_NAME_LIBRARIES

    -
    -private static final java.lang.String ENV_VAR_NAME_LIBRARIES
    -
    -
    -
    See Also:
    Constant Field Values
    -
    - - - - - - - - -
    -Constructor Detail
    - -

    -LlvmEnvironmentVariableSupplier

    -
    -public LlvmEnvironmentVariableSupplier()
    -
    -
    Constructor. -

    -

    - - - - - - - - -
    -Method Detail
    - -

    -initializePaths

    -
    -private static void initializePaths()
    -
    -
    Initializes llvm environment variable paths from the system environment variables. -

    -

    -
    -
    -
    -
    -
    -
    -
    - -

    -getBinPath

    -
    -public static java.lang.String getBinPath()
    -
    -
    Get LLVM bin path -

    -

    -
    -
    -
    - -
    Returns:
    LLVM bin path
    -
    -
    -
    - -

    -getIncludePath

    -
    -public static java.lang.String getIncludePath()
    -
    -
    Get LLVM include paths -

    -

    -
    -
    -
    - -
    Returns:
    LLVM include paths
    -
    -
    -
    - -

    -getLibraryPath

    -
    -public static java.lang.String getLibraryPath()
    -
    -
    Get LLVM library paths -

    -

    -
    -
    -
    - -
    Returns:
    LLVM library paths
    -
    -
    -
    - -

    -getLibraries

    -
    -public static java.lang.String getLibraries()
    -
    -
    Get LLVM libraries -

    -

    -
    -
    -
    - -
    Returns:
    LLVM libraries
    -
    -
    -
    - -

    -setBinPath

    -
    -public static void setBinPath(java.lang.String path)
    -
    -
    Set path to LLVM bin. -

    -

    -
    -
    -
    -
    Parameters:
    path - Path to LLVM bin location.
    -
    -
    -
    - -

    -addIncludePath

    -
    -public static void addIncludePath(java.lang.String path)
    -
    -
    Append a new include path. -

    -

    -
    -
    -
    -
    Parameters:
    path - Include path
    -
    -
    -
    - -

    -addLibraryPath

    -
    -public static void addLibraryPath(java.lang.String path)
    -
    -
    Append a new library path. -

    -

    -
    -
    -
    -
    Parameters:
    path - Library path
    -
    -
    -
    - -

    -addLibrary

    -
    -public static void addLibrary(java.lang.String lib)
    -
    -
    Append a new library. -

    -

    -
    -
    -
    -
    Parameters:
    lib - Library file
    -
    -
    -
    - -

    -notifyPreferenceChange

    -
    -public static void notifyPreferenceChange()
    -
    -
    This is to be called if some of the preference paths have changed. -

    -

    -
    -
    -
    -
    -
    -
    -
    - -

    -findBinDir

    -
    -private static java.lang.String findBinDir(java.lang.String pathKey,
    -                                           java.lang.String subDirName)
    -
    -
    Get a specific path for given parameters. -

    -

    -
    -
    -
    -
    Parameters:
    pathKey - Path for specific location
    subDirName - Additional sub-path -
    Returns:
    bin path
    -
    -
    -
    - -

    -getDirIfLlvmFound

    -
    -private static java.lang.String getDirIfLlvmFound(java.lang.String candidatePath,
    -                                                  java.lang.String subPath)
    -
    -
    Get LLVM executable path. -

    -

    -
    -
    -
    -
    Parameters:
    candidatePath - Suggestion for LLVM executable path
    subPath - Additional sub-path for LLVM executable path -
    Returns:
    Full path for LLVM executable if valid, otherwise null
    -
    -
    -
    - -

    -getBinDirIfLlvm_ar

    -
    -private static java.lang.String getBinDirIfLlvm_ar(java.lang.String binPathTemp)
    -
    + as a parameter is found and executable exists in that path.
    +static java.lang.StringgetBinPath() + +
    +          Get LLVM bin path
    +private static java.lang.StringgetDirIfLlvmFound(java.lang.String candidatePath, + java.lang.String subPath) + +
    +          Get LLVM executable path.
    +static java.lang.StringgetIncludePath() + +
    +          Get LLVM include paths
    +static java.lang.StringgetLibraries() + +
    +          Get LLVM libraries
    +static java.lang.StringgetLibraryPath() + +
    +          Get LLVM library paths
    +static LlvmBuildEnvironmentVariablegetLlvmEnvironmentVariable(java.lang.String envName) + +
    +          Get LLVM environment variable.
    +private static java.lang.StringgetSysEnvPath(java.lang.String envName) + +
    +          Returns a system environment variable path
    + org.eclipse.cdt.managedbuilder.envvar.IBuildEnvironmentVariablegetVariable(java.lang.String variableName, + org.eclipse.cdt.managedbuilder.core.IConfiguration configuration, + org.eclipse.cdt.managedbuilder.envvar.IEnvironmentVariableProvider provider) + +
    +           
    + org.eclipse.cdt.managedbuilder.envvar.IBuildEnvironmentVariable[]getVariables(org.eclipse.cdt.managedbuilder.core.IConfiguration configuration, + org.eclipse.cdt.managedbuilder.envvar.IEnvironmentVariableProvider provider) + +
    +           
    +private static voidinitializePaths() + +
    +          Initializes llvm environment variable paths from the system environment variables.
    +static voidnotifyPreferenceChange() + +
    +          This is to be called if some of the preference paths have changed.
    +static voidsetBinPath(java.lang.String path) + +
    +          Set path to LLVM bin.
    +private static voidsetLlvmEnvironmentVariable(java.lang.String name, + java.lang.String path) + +
    +          Set LLVM environment variable.
    +static voidsetLlvmEnvironmentVariableReplace(java.lang.String name, + java.lang.String path) + +
    +          Set LLVM environment variable by replacing the existing paths.
    + + + + + + + +
    Methods inherited from class java.lang.Object
    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    +  +

    + + + + + + + + +
    +Field Detail
    + +

    +preferencesChanged

    +
    +private static boolean preferencesChanged
    +
    +
    +
    +
    +
    + +

    +llvmEnvironmentVariables

    +
    +private static java.util.HashMap<java.lang.String,LlvmBuildEnvironmentVariable> llvmEnvironmentVariables
    +
    +
    +
    +
    +
    + +

    +ENV_VAR_NAME_LLVM_BIN

    +
    +private static final java.lang.String ENV_VAR_NAME_LLVM_BIN
    +
    +
    +
    See Also:
    Constant Field Values
    +
    +
    + +

    +ENV_VAR_NAME_LLVMINTERP

    +
    +private static final java.lang.String ENV_VAR_NAME_LLVMINTERP
    +
    +
    +
    See Also:
    Constant Field Values
    +
    +
    + +

    +ENV_VAR_NAME_PATH

    +
    +private static final java.lang.String ENV_VAR_NAME_PATH
    +
    +
    +
    See Also:
    Constant Field Values
    +
    +
    + +

    +ENV_VAR_NAME_INCLUDE_PATH

    +
    +private static final java.lang.String ENV_VAR_NAME_INCLUDE_PATH
    +
    +
    +
    See Also:
    Constant Field Values
    +
    +
    + +

    +ENV_VAR_NAME_LIBRARY_PATH

    +
    +private static final java.lang.String ENV_VAR_NAME_LIBRARY_PATH
    +
    +
    +
    See Also:
    Constant Field Values
    +
    +
    + +

    +ENV_VAR_NAME_LIBRARIES

    +
    +private static final java.lang.String ENV_VAR_NAME_LIBRARIES
    +
    +
    +
    See Also:
    Constant Field Values
    +
    + + + + + + + + +
    +Constructor Detail
    + +

    +LlvmEnvironmentVariableSupplier

    +
    +public LlvmEnvironmentVariableSupplier()
    +
    +
    Constructor. +

    +

    + + + + + + + + +
    +Method Detail
    + +

    +initializePaths

    +
    +private static void initializePaths()
    +
    +
    Initializes llvm environment variable paths from the system environment variables. +

    +

    +
    +
    +
    +
    +
    +
    +
    + +

    +getBinPath

    +
    +public static java.lang.String getBinPath()
    +
    +
    Get LLVM bin path +

    +

    +
    +
    +
    + +
    Returns:
    LLVM bin path
    +
    +
    +
    + +

    +getIncludePath

    +
    +public static java.lang.String getIncludePath()
    +
    +
    Get LLVM include paths +

    +

    +
    +
    +
    + +
    Returns:
    LLVM include paths
    +
    +
    +
    + +

    +getLibraryPath

    +
    +public static java.lang.String getLibraryPath()
    +
    +
    Get LLVM library paths +

    +

    +
    +
    +
    + +
    Returns:
    LLVM library paths
    +
    +
    +
    + +

    +getLibraries

    +
    +public static java.lang.String getLibraries()
    +
    +
    Get LLVM libraries +

    +

    +
    +
    +
    + +
    Returns:
    LLVM libraries
    +
    +
    +
    + +

    +setBinPath

    +
    +public static void setBinPath(java.lang.String path)
    +
    +
    Set path to LLVM bin. +

    +

    +
    +
    +
    +
    Parameters:
    path - Path to LLVM bin location.
    +
    +
    +
    + +

    +addIncludePath

    +
    +public static void addIncludePath(java.lang.String path)
    +
    +
    Append a new include path. +

    +

    +
    +
    +
    +
    Parameters:
    path - Include path
    +
    +
    +
    + +

    +addLibraryPath

    +
    +public static void addLibraryPath(java.lang.String path)
    +
    +
    Append a new library path. +

    +

    +
    +
    +
    +
    Parameters:
    path - Library path
    +
    +
    +
    + +

    +addLibrary

    +
    +public static void addLibrary(java.lang.String lib)
    +
    +
    Append a new library. +

    +

    +
    +
    +
    +
    Parameters:
    lib - Library file
    +
    +
    +
    + +

    +notifyPreferenceChange

    +
    +public static void notifyPreferenceChange()
    +
    +
    This is to be called if some of the preference paths have changed. +

    +

    +
    +
    +
    +
    +
    +
    +
    + +

    +findBinDir

    +
    +private static java.lang.String findBinDir(java.lang.String pathKey,
    +                                           java.lang.String subDirName)
    +
    +
    Get a specific path for given parameters. +

    +

    +
    +
    +
    +
    Parameters:
    pathKey - Path for specific location
    subDirName - Additional sub-path +
    Returns:
    bin path
    +
    +
    +
    + +

    +getDirIfLlvmFound

    +
    +private static java.lang.String getDirIfLlvmFound(java.lang.String candidatePath,
    +                                                  java.lang.String subPath)
    +
    +
    Get LLVM executable path. +

    +

    +
    +
    +
    +
    Parameters:
    candidatePath - Suggestion for LLVM executable path
    subPath - Additional sub-path for LLVM executable path +
    Returns:
    Full path for LLVM executable if valid, otherwise null
    +
    +
    +
    + +

    +getBinDirIfLlvm_ar

    +
    +private static java.lang.String getBinDirIfLlvm_ar(java.lang.String binPathTemp)
    +
    Get the full path for llvm executable if the bin path given - as a parameter is found and executable exists in that path. -

    -

    -
    -
    -
    -
    Parameters:
    binPathTemp - User provided bin directory path -
    Returns:
    bin path where llvm-ar is located if executable exists
    -
    -
    -
    - -

    -getLlvmEnvironmentVariable

    -
    -public static LlvmBuildEnvironmentVariable getLlvmEnvironmentVariable(java.lang.String envName)
    -
    -
    Get LLVM environment variable. -

    -

    -
    -
    -
    -
    Parameters:
    envName - Name of the environment variable
    -
    -
    -
    - -

    -setLlvmEnvironmentVariable

    -
    -private static void setLlvmEnvironmentVariable(java.lang.String name,
    -                                               java.lang.String path)
    -
    -
    Set LLVM environment variable. -

    -

    -
    -
    -
    -
    Parameters:
    name - Name for the environment variable
    path - Path for the environment variable
    -
    -
    -
    - -

    -setLlvmEnvironmentVariableReplace

    -
    -public static void setLlvmEnvironmentVariableReplace(java.lang.String name,
    -                                                     java.lang.String path)
    -
    -
    Set LLVM environment variable by replacing the existing paths. -

    -

    -
    -
    -
    -
    Parameters:
    name - Name for the environment variable
    path - Path for the environment variable
    -
    -
    -
    - -

    -appendLlvmEnvironmentVariable

    -
    -private static void appendLlvmEnvironmentVariable(java.lang.String name,
    -                                                  java.lang.String oldPath,
    -                                                  java.lang.String path)
    -
    -
    Append a new LLVM environment variable to existing list. -

    -

    -
    -
    -
    -
    Parameters:
    name - Name of the preference
    oldPath - Old paths/preference values
    path - New path to be added to the environment variable
    -
    -
    -
    - -

    -getSysEnvPath

    -
    -private static java.lang.String getSysEnvPath(java.lang.String envName)
    -
    -
    Returns a system environment variable path -

    -

    -
    -
    -
    -
    Parameters:
    envName - Environment variable name -
    Returns:
    system environment variable path
    -
    -
    -
    - -

    -getVariable

    -
    -public org.eclipse.cdt.managedbuilder.envvar.IBuildEnvironmentVariable getVariable(java.lang.String variableName,
    -                                                                                   org.eclipse.cdt.managedbuilder.core.IConfiguration configuration,
    -                                                                                   org.eclipse.cdt.managedbuilder.envvar.IEnvironmentVariableProvider provider)
    -
    -
    -
    Specified by:
    getVariable in interface org.eclipse.cdt.managedbuilder.envvar.IConfigurationEnvironmentVariableSupplier
    -
    -
    -
    -
    -
    -
    - -

    -getVariables

    -
    -public org.eclipse.cdt.managedbuilder.envvar.IBuildEnvironmentVariable[] getVariables(org.eclipse.cdt.managedbuilder.core.IConfiguration configuration,
    -                                                                                      org.eclipse.cdt.managedbuilder.envvar.IEnvironmentVariableProvider provider)
    -
    -
    -
    Specified by:
    getVariables in interface org.eclipse.cdt.managedbuilder.envvar.IConfigurationEnvironmentVariableSupplier
    -
    -
    -
    -
    -
    - -
    - - - - - - - - - - - - - - - - - - - -
    - -
    - - - -
    - - - + as a parameter is found and executable exists in that path. +

    +

    +
    +
    +
    +
    Parameters:
    binPathTemp - User provided bin directory path +
    Returns:
    bin path where llvm-ar is located if executable exists
    +
    + +
    + +

    +getLlvmEnvironmentVariable

    +
    +public static LlvmBuildEnvironmentVariable getLlvmEnvironmentVariable(java.lang.String envName)
    +
    +
    Get LLVM environment variable. +

    +

    +
    +
    +
    +
    Parameters:
    envName - Name of the environment variable
    +
    +
    +
    + +

    +setLlvmEnvironmentVariable

    +
    +private static void setLlvmEnvironmentVariable(java.lang.String name,
    +                                               java.lang.String path)
    +
    +
    Set LLVM environment variable. +

    +

    +
    +
    +
    +
    Parameters:
    name - Name for the environment variable
    path - Path for the environment variable
    +
    +
    +
    + +

    +setLlvmEnvironmentVariableReplace

    +
    +public static void setLlvmEnvironmentVariableReplace(java.lang.String name,
    +                                                     java.lang.String path)
    +
    +
    Set LLVM environment variable by replacing the existing paths. +

    +

    +
    +
    +
    +
    Parameters:
    name - Name for the environment variable
    path - Path for the environment variable
    +
    +
    +
    + +

    +appendLlvmEnvironmentVariable

    +
    +private static void appendLlvmEnvironmentVariable(java.lang.String name,
    +                                                  java.lang.String oldPath,
    +                                                  java.lang.String path)
    +
    +
    Append a new LLVM environment variable to existing list. +

    +

    +
    +
    +
    +
    Parameters:
    name - Name of the preference
    oldPath - Old paths/preference values
    path - New path to be added to the environment variable
    +
    +
    +
    + +

    +getSysEnvPath

    +
    +private static java.lang.String getSysEnvPath(java.lang.String envName)
    +
    +
    Returns a system environment variable path +

    +

    +
    +
    +
    +
    Parameters:
    envName - Environment variable name +
    Returns:
    system environment variable path
    +
    +
    +
    + +

    +getVariable

    +
    +public org.eclipse.cdt.managedbuilder.envvar.IBuildEnvironmentVariable getVariable(java.lang.String variableName,
    +                                                                                   org.eclipse.cdt.managedbuilder.core.IConfiguration configuration,
    +                                                                                   org.eclipse.cdt.managedbuilder.envvar.IEnvironmentVariableProvider provider)
    +
    +
    +
    Specified by:
    getVariable in interface org.eclipse.cdt.managedbuilder.envvar.IConfigurationEnvironmentVariableSupplier
    +
    +
    +
    +
    +
    +
    + +

    +getVariables

    +
    +public org.eclipse.cdt.managedbuilder.envvar.IBuildEnvironmentVariable[] getVariables(org.eclipse.cdt.managedbuilder.core.IConfiguration configuration,
    +                                                                                      org.eclipse.cdt.managedbuilder.envvar.IEnvironmentVariableProvider provider)
    +
    +
    +
    Specified by:
    getVariables in interface org.eclipse.cdt.managedbuilder.envvar.IConfigurationEnvironmentVariableSupplier
    +
    +
    +
    +
    +
    + +
    + + + + + + + + + + + + + + + + + + + +
    + +
    + + + +
    + + + diff --git a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/ui/LlvmIsToolChainSupported.html b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/ui/LlvmIsToolChainSupported.html index e27fd587d01..598313ea359 100644 --- a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/ui/LlvmIsToolChainSupported.html +++ b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/ui/LlvmIsToolChainSupported.html @@ -1,307 +1,307 @@ - - - - - - -LlvmIsToolChainSupported - - - - - - - - - - - - -
    - - - - - - - - - - - - - - - - - - - -
    - -
    - - - -
    - -

    - -org.eclipse.cdt.managedbuilder.llvm.ui -
    -Class LlvmIsToolChainSupported

    -
    -java.lang.Object
    -  extended by org.eclipse.cdt.managedbuilder.llvm.ui.LlvmIsToolChainSupported
    -
    -
    -
    All Implemented Interfaces:
    org.eclipse.cdt.managedbuilder.core.IManagedIsToolChainSupported
    -
    -
    -
    -
    public class LlvmIsToolChainSupported
    extends java.lang.Object
    implements org.eclipse.cdt.managedbuilder.core.IManagedIsToolChainSupported
    - - -

    -Based on MingwIsToolChainSupported. -

    - -

    -


    - -

    - - - - - - - - - - - -
    -Field Summary
    -private  booleansupported - -
    -           
    -  - - - - - - - - - - -
    -Constructor Summary
    LlvmIsToolChainSupported() - -
    -          Constructor.
    -  - - - - - - - - - - - -
    -Method Summary
    - booleanisSupported(org.eclipse.cdt.managedbuilder.core.IToolChain toolChain, - org.osgi.framework.Version version, - java.lang.String instance) - -
    -          Return a boolean value that informs if the LLVM Toolchain is supported.
    - - - - - - - -
    Methods inherited from class java.lang.Object
    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    -  -

    - - - - - - - - -
    -Field Detail
    - -

    -supported

    -
    -private final boolean supported
    -
    -
    -
    -
    - - - - - - - - -
    -Constructor Detail
    - -

    -LlvmIsToolChainSupported

    -
    -public LlvmIsToolChainSupported()
    -
    + + + + + + +LlvmIsToolChainSupported + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + + + + + +
    + +
    + + + +
    + +

    + +org.eclipse.cdt.managedbuilder.llvm.ui +
    +Class LlvmIsToolChainSupported

    +
    +java.lang.Object
    +  extended by org.eclipse.cdt.managedbuilder.llvm.ui.LlvmIsToolChainSupported
    +
    +
    +
    All Implemented Interfaces:
    org.eclipse.cdt.managedbuilder.core.IManagedIsToolChainSupported
    +
    +
    +
    +
    public class LlvmIsToolChainSupported
    extends java.lang.Object
    implements org.eclipse.cdt.managedbuilder.core.IManagedIsToolChainSupported
    + + +

    +Based on MingwIsToolChainSupported. +

    + +

    +


    + +

    + + + + + + + + + + + +
    +Field Summary
    +private  booleansupported + +
    +           
    +  + + + + + + + + + + +
    +Constructor Summary
    LlvmIsToolChainSupported() + +
    +          Constructor.
    +  + + + + + + + + + + + +
    +Method Summary
    + booleanisSupported(org.eclipse.cdt.managedbuilder.core.IToolChain toolChain, + org.osgi.framework.Version version, + java.lang.String instance) + +
    +          Return a boolean value that informs if the LLVM Toolchain is supported.
    + + + + + + + +
    Methods inherited from class java.lang.Object
    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    +  +

    + + + + + + + + +
    +Field Detail
    + +

    +supported

    +
    +private final boolean supported
    +
    +
    +
    +
    + + + + + + + + +
    +Constructor Detail
    + +

    +LlvmIsToolChainSupported

    +
    +public LlvmIsToolChainSupported()
    +
    Constructor. - LLVM Toolchain is supported if binary path for LLVM Tools can be found. -

    -

    - - - - - - - - -
    -Method Detail
    - -

    -isSupported

    -
    -public boolean isSupported(org.eclipse.cdt.managedbuilder.core.IToolChain toolChain,
    -                           org.osgi.framework.Version version,
    -                           java.lang.String instance)
    -
    -
    Return a boolean value that informs if the LLVM Toolchain is supported. -

    -

    -
    Specified by:
    isSupported in interface org.eclipse.cdt.managedbuilder.core.IManagedIsToolChainSupported
    -
    -
    -
    -
    -
    - -
    - - - - - - - - - - - - - - - - - - - -
    - -
    - - - -
    - - - + LLVM Toolchain is supported if binary path for LLVM Tools can be found. +

    +

    + + + + + + + + +
    +Method Detail
    + +

    +isSupported

    +
    +public boolean isSupported(org.eclipse.cdt.managedbuilder.core.IToolChain toolChain,
    +                           org.osgi.framework.Version version,
    +                           java.lang.String instance)
    +
    +
    Return a boolean value that informs if the LLVM Toolchain is supported. +

    +

    +
    Specified by:
    isSupported in interface org.eclipse.cdt.managedbuilder.core.IManagedIsToolChainSupported
    +
    +
    +
    +
    +
    + +
    + + + + + + + + + + + + + + + + + + + +
    + +
    + + + +
    + + + diff --git a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/ui/LlvmProjectNature.html b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/ui/LlvmProjectNature.html index 015acec2153..cec194235fa 100644 --- a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/ui/LlvmProjectNature.html +++ b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/ui/LlvmProjectNature.html @@ -1,379 +1,379 @@ - - - - - - -LlvmProjectNature - - - - - - - - - - - - -
    - - - - - - - - - - - - - - - - - - - -
    - -
    - - - -
    - -

    - -org.eclipse.cdt.managedbuilder.llvm.ui -
    -Class LlvmProjectNature

    -
    -java.lang.Object
    -  extended by org.eclipse.cdt.managedbuilder.llvm.ui.LlvmProjectNature
    -
    -
    -
    All Implemented Interfaces:
    org.eclipse.core.resources.IProjectNature
    -
    -
    -
    -
    public class LlvmProjectNature
    extends java.lang.Object
    implements org.eclipse.core.resources.IProjectNature
    - - -

    -Implements project nature for LLVM projects. -

    - -

    -


    - -

    - - - - - - - - - - - -
    -Field Summary
    -private  org.eclipse.core.resources.IProjectproject - -
    -           
    -  - - - - - - - - - - -
    -Constructor Summary
    LlvmProjectNature() - -
    -           
    -  - - - - - - - - - - - - - - - - - - - - - - - -
    -Method Summary
    - voidconfigure() - -
    -          Configure the project which have this project nature.
    - voiddeconfigure() - -
    -          Deconfigure those projects which have this project nature.
    - org.eclipse.core.resources.IProjectgetProject() - -
    -          Return the project.
    - voidsetProject(org.eclipse.core.resources.IProject proj) - -
    -          Set the project.
    - - - - - - - -
    Methods inherited from class java.lang.Object
    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    -  -

    - - - - - - - - -
    -Field Detail
    - -

    -project

    -
    -private org.eclipse.core.resources.IProject project
    -
    -
    -
    -
    - - - - - - - - -
    -Constructor Detail
    - -

    -LlvmProjectNature

    -
    -public LlvmProjectNature()
    -
    -
    - - - - - - - - -
    -Method Detail
    - -

    -configure

    -
    -public void configure()
    -               throws org.eclipse.core.runtime.CoreException
    -
    -
    Configure the project which have this project nature. -

    -

    -
    Specified by:
    configure in interface org.eclipse.core.resources.IProjectNature
    -
    -
    - -
    Throws: -
    org.eclipse.core.runtime.CoreException
    -
    -
    -
    - -

    -deconfigure

    -
    -public void deconfigure()
    -                 throws org.eclipse.core.runtime.CoreException
    -
    -
    Deconfigure those projects which have this project nature. -

    -

    -
    Specified by:
    deconfigure in interface org.eclipse.core.resources.IProjectNature
    -
    -
    - -
    Throws: -
    org.eclipse.core.runtime.CoreException
    -
    -
    -
    - -

    -getProject

    -
    -public org.eclipse.core.resources.IProject getProject()
    -
    -
    Return the project. -

    -

    -
    Specified by:
    getProject in interface org.eclipse.core.resources.IProjectNature
    -
    -
    - -
    Returns:
    IProject
    -
    -
    -
    - -

    -setProject

    -
    -public void setProject(org.eclipse.core.resources.IProject proj)
    -
    -
    Set the project. -

    -

    -
    Specified by:
    setProject in interface org.eclipse.core.resources.IProjectNature
    -
    -
    -
    Parameters:
    proj - IProject
    -
    -
    - -
    - - - - - - - - - - - - - - - - - - - -
    - -
    - - - -
    - - - + + + + + + +LlvmProjectNature + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + + + + + +
    + +
    + + + +
    + +

    + +org.eclipse.cdt.managedbuilder.llvm.ui +
    +Class LlvmProjectNature

    +
    +java.lang.Object
    +  extended by org.eclipse.cdt.managedbuilder.llvm.ui.LlvmProjectNature
    +
    +
    +
    All Implemented Interfaces:
    org.eclipse.core.resources.IProjectNature
    +
    +
    +
    +
    public class LlvmProjectNature
    extends java.lang.Object
    implements org.eclipse.core.resources.IProjectNature
    + + +

    +Implements project nature for LLVM projects. +

    + +

    +


    + +

    + + + + + + + + + + + +
    +Field Summary
    +private  org.eclipse.core.resources.IProjectproject + +
    +           
    +  + + + + + + + + + + +
    +Constructor Summary
    LlvmProjectNature() + +
    +           
    +  + + + + + + + + + + + + + + + + + + + + + + + +
    +Method Summary
    + voidconfigure() + +
    +          Configure the project which have this project nature.
    + voiddeconfigure() + +
    +          Deconfigure those projects which have this project nature.
    + org.eclipse.core.resources.IProjectgetProject() + +
    +          Return the project.
    + voidsetProject(org.eclipse.core.resources.IProject proj) + +
    +          Set the project.
    + + + + + + + +
    Methods inherited from class java.lang.Object
    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    +  +

    + + + + + + + + +
    +Field Detail
    + +

    +project

    +
    +private org.eclipse.core.resources.IProject project
    +
    +
    +
    +
    + + + + + + + + +
    +Constructor Detail
    + +

    +LlvmProjectNature

    +
    +public LlvmProjectNature()
    +
    +
    + + + + + + + + +
    +Method Detail
    + +

    +configure

    +
    +public void configure()
    +               throws org.eclipse.core.runtime.CoreException
    +
    +
    Configure the project which have this project nature. +

    +

    +
    Specified by:
    configure in interface org.eclipse.core.resources.IProjectNature
    +
    +
    + +
    Throws: +
    org.eclipse.core.runtime.CoreException
    +
    +
    +
    + +

    +deconfigure

    +
    +public void deconfigure()
    +                 throws org.eclipse.core.runtime.CoreException
    +
    +
    Deconfigure those projects which have this project nature. +

    +

    +
    Specified by:
    deconfigure in interface org.eclipse.core.resources.IProjectNature
    +
    +
    + +
    Throws: +
    org.eclipse.core.runtime.CoreException
    +
    +
    +
    + +

    +getProject

    +
    +public org.eclipse.core.resources.IProject getProject()
    +
    +
    Return the project. +

    +

    +
    Specified by:
    getProject in interface org.eclipse.core.resources.IProjectNature
    +
    +
    + +
    Returns:
    IProject
    +
    +
    +
    + +

    +setProject

    +
    +public void setProject(org.eclipse.core.resources.IProject proj)
    +
    +
    Set the project. +

    +

    +
    Specified by:
    setProject in interface org.eclipse.core.resources.IProjectNature
    +
    +
    +
    Parameters:
    proj - IProject
    +
    +
    + +
    + + + + + + + + + + + + + + + + + + + +
    + +
    + + + +
    + + + diff --git a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/ui/LlvmUIPlugin.html b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/ui/LlvmUIPlugin.html index 257b3c0404b..4f376b37bbf 100644 --- a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/ui/LlvmUIPlugin.html +++ b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/ui/LlvmUIPlugin.html @@ -1,582 +1,582 @@ - - - - - - -LlvmUIPlugin - - - - - - - - - - - - -
    - - - - - - - - - - - - - - - - - - - -
    - -
    - - - -
    - -

    - -org.eclipse.cdt.managedbuilder.llvm.ui -
    -Class LlvmUIPlugin

    -
    -java.lang.Object
    -  extended by org.eclipse.core.runtime.Plugin
    -      extended by org.eclipse.ui.plugin.AbstractUIPlugin
    -          extended by org.eclipse.cdt.managedbuilder.llvm.ui.LlvmUIPlugin
    -
    -
    -
    All Implemented Interfaces:
    org.osgi.framework.BundleActivator
    -
    -
    -
    -
    public class LlvmUIPlugin
    extends org.eclipse.ui.plugin.AbstractUIPlugin
    - - -

    + + + + + + +LlvmUIPlugin + + + + + + + + + + + + +


    + + + + + + + + + + + + + + + + + + + +
    + +
    + + + +
    + +

    + +org.eclipse.cdt.managedbuilder.llvm.ui +
    +Class LlvmUIPlugin

    +
    +java.lang.Object
    +  extended by org.eclipse.core.runtime.Plugin
    +      extended by org.eclipse.ui.plugin.AbstractUIPlugin
    +          extended by org.eclipse.cdt.managedbuilder.llvm.ui.LlvmUIPlugin
    +
    +
    +
    All Implemented Interfaces:
    org.osgi.framework.BundleActivator
    +
    +
    +
    +
    public class LlvmUIPlugin
    extends org.eclipse.ui.plugin.AbstractUIPlugin
    + + +

    The activator class controls the plug-in life cycle. - The main plugin class to be used in the desktop. -

    - -

    -


    - -

    - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -Field Summary
    -private static LlvmUIPluginplugin - -
    -           
    -static java.lang.StringPLUGIN_ID - -
    -           
    -private  java.util.PropertyResourceBundleproperties - -
    -           
    -private static java.lang.StringPROPERTIES - -
    -           
    -private  java.util.ResourceBundleresourceBundle - -
    -           
    - - - - - - - -
    Fields inherited from class org.eclipse.core.runtime.Plugin
    PLUGIN_PREFERENCE_SCOPE, PREFERENCES_DEFAULT_OVERRIDE_BASE_NAME, PREFERENCES_DEFAULT_OVERRIDE_FILE_NAME
    -  - - - - - - - - - - -
    -Constructor Summary
    LlvmUIPlugin() - -
    -          Constructor.
    -  - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + +
    -Method Summary
    -static LlvmUIPlugingetDefault() - -
    -          Returns the shared instance
    - java.util.PropertyResourceBundlegetProperties() - -
    -          Get plugin.properties
    -static java.lang.StringgetPropertyString(java.lang.String var) - -
    -          Get String from the plugin.properties file
    - java.util.ResourceBundlegetResourceBundle() - -
    -          Returns the plugin's resource bundle,
    -static java.lang.StringgetResourceString(java.lang.String key) - -
    + The main plugin class to be used in the desktop. +

    + +

    +


    + +

    + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +Field Summary
    +private static LlvmUIPluginplugin + +
    +           
    +static java.lang.StringPLUGIN_ID + +
    +           
    +private  java.util.PropertyResourceBundleproperties + +
    +           
    +private static java.lang.StringPROPERTIES + +
    +           
    +private  java.util.ResourceBundleresourceBundle + +
    +           
    + + + + + + + +
    Fields inherited from class org.eclipse.core.runtime.Plugin
    PLUGIN_PREFERENCE_SCOPE, PREFERENCES_DEFAULT_OVERRIDE_BASE_NAME, PREFERENCES_DEFAULT_OVERRIDE_FILE_NAME
    +  + + + + + + + + + + +
    +Constructor Summary
    LlvmUIPlugin() + +
    +          Constructor.
    +  + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - -
    +Method Summary
    +static LlvmUIPlugingetDefault() + +
    +          Returns the shared instance
    + java.util.PropertyResourceBundlegetProperties() + +
    +          Get plugin.properties
    +static java.lang.StringgetPropertyString(java.lang.String var) + +
    +          Get String from the plugin.properties file
    + java.util.ResourceBundlegetResourceBundle() + +
    +          Returns the plugin's resource bundle,
    +static java.lang.StringgetResourceString(java.lang.String key) + +
              Returns the string from the plugin's resource bundle, - or 'key' if not found.
    - voidlog(org.eclipse.core.runtime.IStatus status) - -
    -          Log status.
    - voidlog(java.lang.Throwable e) - -
    -          Log error.
    - voidstart(org.osgi.framework.BundleContext context) - -
    -           
    - voidstop(org.osgi.framework.BundleContext context) - -
    -           
    - - - - - - - -
    Methods inherited from class org.eclipse.ui.plugin.AbstractUIPlugin
    createImageRegistry, getDialogSettings, getImageRegistry, getPreferenceStore, getWorkbench, imageDescriptorFromPlugin, initializeDefaultPluginPreferences, initializeDefaultPreferences, initializeImageRegistry, loadDialogSettings, loadPreferenceStore, refreshPluginActions, saveDialogSettings, savePreferenceStore, shutdown, startup
    - - - - - - - -
    Methods inherited from class org.eclipse.core.runtime.Plugin
    find, find, getBundle, getDescriptor, getLog, getPluginPreferences, getStateLocation, internalInitializeDefaultPluginPreferences, isDebugging, openStream, openStream, savePluginPreferences, setDebugging, toString
    - - - - - - - -
    Methods inherited from class java.lang.Object
    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    -  -

    - - - - - - - - -
    -Field Detail
    - -

    -PLUGIN_ID

    -
    -public static final java.lang.String PLUGIN_ID
    -
    -
    -
    See Also:
    Constant Field Values
    -
    -
    - -

    -plugin

    -
    -private static LlvmUIPlugin plugin
    -
    -
    -
    -
    -
    - -

    -resourceBundle

    -
    -private java.util.ResourceBundle resourceBundle
    -
    -
    -
    -
    -
    - -

    -PROPERTIES

    -
    -private static final java.lang.String PROPERTIES
    -
    -
    -
    See Also:
    Constant Field Values
    -
    -
    - -

    -properties

    -
    -private java.util.PropertyResourceBundle properties
    -
    -
    -
    -
    - - - - - - - - -
    -Constructor Detail
    - -

    -LlvmUIPlugin

    -
    -public LlvmUIPlugin()
    -
    -
    Constructor. -

    -

    - - - - - - - - -
    -Method Detail
    - -

    -start

    -
    -public void start(org.osgi.framework.BundleContext context)
    -           throws java.lang.Exception
    -
    -
    -
    Specified by:
    start in interface org.osgi.framework.BundleActivator
    Overrides:
    start in class org.eclipse.ui.plugin.AbstractUIPlugin
    -
    -
    - -
    Throws: -
    java.lang.Exception
    -
    -
    -
    - -

    -stop

    -
    -public void stop(org.osgi.framework.BundleContext context)
    -          throws java.lang.Exception
    -
    -
    -
    Specified by:
    stop in interface org.osgi.framework.BundleActivator
    Overrides:
    stop in class org.eclipse.ui.plugin.AbstractUIPlugin
    -
    -
    - -
    Throws: -
    java.lang.Exception
    -
    -
    -
    - -

    -getDefault

    -
    -public static LlvmUIPlugin getDefault()
    -
    -
    Returns the shared instance -

    -

    - -
    Returns:
    the shared instance
    -
    -
    -
    - -

    -getResourceString

    -
    -public static java.lang.String getResourceString(java.lang.String key)
    -
    + or 'key' if not found.
    + voidlog(org.eclipse.core.runtime.IStatus status) + +
    +          Log status.
    + voidlog(java.lang.Throwable e) + +
    +          Log error.
    + voidstart(org.osgi.framework.BundleContext context) + +
    +           
    + voidstop(org.osgi.framework.BundleContext context) + +
    +           
    + + + + + + + +
    Methods inherited from class org.eclipse.ui.plugin.AbstractUIPlugin
    createImageRegistry, getDialogSettings, getImageRegistry, getPreferenceStore, getWorkbench, imageDescriptorFromPlugin, initializeDefaultPluginPreferences, initializeDefaultPreferences, initializeImageRegistry, loadDialogSettings, loadPreferenceStore, refreshPluginActions, saveDialogSettings, savePreferenceStore, shutdown, startup
    + + + + + + + +
    Methods inherited from class org.eclipse.core.runtime.Plugin
    find, find, getBundle, getDescriptor, getLog, getPluginPreferences, getStateLocation, internalInitializeDefaultPluginPreferences, isDebugging, openStream, openStream, savePluginPreferences, setDebugging, toString
    + + + + + + + +
    Methods inherited from class java.lang.Object
    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    +  +

    + + + + + + + + +
    +Field Detail
    + +

    +PLUGIN_ID

    +
    +public static final java.lang.String PLUGIN_ID
    +
    +
    +
    See Also:
    Constant Field Values
    +
    +
    + +

    +plugin

    +
    +private static LlvmUIPlugin plugin
    +
    +
    +
    +
    +
    + +

    +resourceBundle

    +
    +private java.util.ResourceBundle resourceBundle
    +
    +
    +
    +
    +
    + +

    +PROPERTIES

    +
    +private static final java.lang.String PROPERTIES
    +
    +
    +
    See Also:
    Constant Field Values
    +
    +
    + +

    +properties

    +
    +private java.util.PropertyResourceBundle properties
    +
    +
    +
    +
    + + + + + + + + +
    +Constructor Detail
    + +

    +LlvmUIPlugin

    +
    +public LlvmUIPlugin()
    +
    +
    Constructor. +

    +

    + + + + + + + + +
    +Method Detail
    + +

    +start

    +
    +public void start(org.osgi.framework.BundleContext context)
    +           throws java.lang.Exception
    +
    +
    +
    Specified by:
    start in interface org.osgi.framework.BundleActivator
    Overrides:
    start in class org.eclipse.ui.plugin.AbstractUIPlugin
    +
    +
    + +
    Throws: +
    java.lang.Exception
    +
    +
    +
    + +

    +stop

    +
    +public void stop(org.osgi.framework.BundleContext context)
    +          throws java.lang.Exception
    +
    +
    +
    Specified by:
    stop in interface org.osgi.framework.BundleActivator
    Overrides:
    stop in class org.eclipse.ui.plugin.AbstractUIPlugin
    +
    +
    + +
    Throws: +
    java.lang.Exception
    +
    +
    +
    + +

    +getDefault

    +
    +public static LlvmUIPlugin getDefault()
    +
    +
    Returns the shared instance +

    +

    + +
    Returns:
    the shared instance
    +
    +
    +
    + +

    +getResourceString

    +
    +public static java.lang.String getResourceString(java.lang.String key)
    +
    Returns the string from the plugin's resource bundle, - or 'key' if not found. -

    -

    -
    -
    -
    -
    - -

    -getResourceBundle

    -
    -public java.util.ResourceBundle getResourceBundle()
    -
    -
    Returns the plugin's resource bundle, -

    -

    -
    -
    -
    -
    - -

    -log

    -
    -public void log(java.lang.Throwable e)
    -
    -
    Log error. -

    -

    -
    Parameters:
    e -
    -
    -
    -
    - -

    -log

    -
    -public void log(org.eclipse.core.runtime.IStatus status)
    -
    -
    Log status. -

    -

    -
    Parameters:
    status -
    -
    -
    -
    - -

    -getProperties

    -
    -public java.util.PropertyResourceBundle getProperties()
    -
    -
    Get plugin.properties -

    -

    - -
    Returns:
    PropertyResourceBundle
    -
    -
    -
    - -

    -getPropertyString

    -
    -public static java.lang.String getPropertyString(java.lang.String var)
    -
    -
    Get String from the plugin.properties file -

    -

    -
    Parameters:
    var - Variable name wanted as a String e.g. "ToolName.assembler.llvm" -
    Returns:
    String e.g. LLVM assembler
    -
    -
    - -
    - - - - - - - - - - - - - - - - - - - -
    - -
    - - - -
    - - - + or 'key' if not found. +

    +

    +
    +
    + +
    + +

    +getResourceBundle

    +
    +public java.util.ResourceBundle getResourceBundle()
    +
    +
    Returns the plugin's resource bundle, +

    +

    +
    +
    +
    +
    + +

    +log

    +
    +public void log(java.lang.Throwable e)
    +
    +
    Log error. +

    +

    +
    Parameters:
    e -
    +
    +
    +
    + +

    +log

    +
    +public void log(org.eclipse.core.runtime.IStatus status)
    +
    +
    Log status. +

    +

    +
    Parameters:
    status -
    +
    +
    +
    + +

    +getProperties

    +
    +public java.util.PropertyResourceBundle getProperties()
    +
    +
    Get plugin.properties +

    +

    + +
    Returns:
    PropertyResourceBundle
    +
    +
    +
    + +

    +getPropertyString

    +
    +public static java.lang.String getPropertyString(java.lang.String var)
    +
    +
    Get String from the plugin.properties file +

    +

    +
    Parameters:
    var - Variable name wanted as a String e.g. "ToolName.assembler.llvm" +
    Returns:
    String e.g. LLVM assembler
    +
    +
    + +
    + + + + + + + + + + + + + + + + + + + +
    + +
    + + + +
    + + + diff --git a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/ui/class-use/LlvmBuildEnvironmentVariable.html b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/ui/class-use/LlvmBuildEnvironmentVariable.html index 9977ef20a60..8a531ccb1e5 100644 --- a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/ui/class-use/LlvmBuildEnvironmentVariable.html +++ b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/ui/class-use/LlvmBuildEnvironmentVariable.html @@ -1,196 +1,196 @@ - - - - - - -Uses of Class org.eclipse.cdt.managedbuilder.llvm.ui.LlvmBuildEnvironmentVariable - - - - - - - - - - - - -
    - - - - - - - - - - - - - - - -
    - -
    - - - -
    -
    -

    -Uses of Class
    org.eclipse.cdt.managedbuilder.llvm.ui.LlvmBuildEnvironmentVariable

    -
    - - - - - - - - - -
    -Packages that use LlvmBuildEnvironmentVariable
    org.eclipse.cdt.managedbuilder.llvm.ui  
    -  -

    - - - - - -
    -Uses of LlvmBuildEnvironmentVariable in org.eclipse.cdt.managedbuilder.llvm.ui
    -  -

    - - - - - - - - - -
    Fields in org.eclipse.cdt.managedbuilder.llvm.ui with type parameters of type LlvmBuildEnvironmentVariable
    -private static java.util.HashMap<java.lang.String,LlvmBuildEnvironmentVariable>LlvmEnvironmentVariableSupplier.llvmEnvironmentVariables - -
    -           
    -  -

    - - - - - - - - - -
    Methods in org.eclipse.cdt.managedbuilder.llvm.ui that return LlvmBuildEnvironmentVariable
    -static LlvmBuildEnvironmentVariableLlvmEnvironmentVariableSupplier.getLlvmEnvironmentVariable(java.lang.String envName) - -
    -          Get LLVM environment variable.
    -  -

    -


    - - - - - - - - - - - - - - - -
    - -
    - - - -
    - - - + + + + + + +Uses of Class org.eclipse.cdt.managedbuilder.llvm.ui.LlvmBuildEnvironmentVariable + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + +
    + +
    + + + +
    +
    +

    +Uses of Class
    org.eclipse.cdt.managedbuilder.llvm.ui.LlvmBuildEnvironmentVariable

    +
    + + + + + + + + + +
    +Packages that use LlvmBuildEnvironmentVariable
    org.eclipse.cdt.managedbuilder.llvm.ui  
    +  +

    + + + + + +
    +Uses of LlvmBuildEnvironmentVariable in org.eclipse.cdt.managedbuilder.llvm.ui
    +  +

    + + + + + + + + + +
    Fields in org.eclipse.cdt.managedbuilder.llvm.ui with type parameters of type LlvmBuildEnvironmentVariable
    +private static java.util.HashMap<java.lang.String,LlvmBuildEnvironmentVariable>LlvmEnvironmentVariableSupplier.llvmEnvironmentVariables + +
    +           
    +  +

    + + + + + + + + + +
    Methods in org.eclipse.cdt.managedbuilder.llvm.ui that return LlvmBuildEnvironmentVariable
    +static LlvmBuildEnvironmentVariableLlvmEnvironmentVariableSupplier.getLlvmEnvironmentVariable(java.lang.String envName) + +
    +          Get LLVM environment variable.
    +  +

    +


    + + + + + + + + + + + + + + + +
    + +
    + + + +
    + + + diff --git a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/ui/class-use/LlvmEnvironmentVariableSupplier.html b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/ui/class-use/LlvmEnvironmentVariableSupplier.html index 34c1af1d43c..e5e64caedaa 100644 --- a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/ui/class-use/LlvmEnvironmentVariableSupplier.html +++ b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/ui/class-use/LlvmEnvironmentVariableSupplier.html @@ -1,144 +1,144 @@ - - - - - - -Uses of Class org.eclipse.cdt.managedbuilder.llvm.ui.LlvmEnvironmentVariableSupplier - - - - - - - - - - - - -
    - - - - - - - - - - - - - - - -
    - -
    - - - -
    -
    -

    -Uses of Class
    org.eclipse.cdt.managedbuilder.llvm.ui.LlvmEnvironmentVariableSupplier

    -
    -No usage of org.eclipse.cdt.managedbuilder.llvm.ui.LlvmEnvironmentVariableSupplier -

    -


    - - - - - - - - - - - - - - - -
    - -
    - - - -
    - - - + + + + + + +Uses of Class org.eclipse.cdt.managedbuilder.llvm.ui.LlvmEnvironmentVariableSupplier + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + +
    + +
    + + + +
    +
    +

    +Uses of Class
    org.eclipse.cdt.managedbuilder.llvm.ui.LlvmEnvironmentVariableSupplier

    +
    +No usage of org.eclipse.cdt.managedbuilder.llvm.ui.LlvmEnvironmentVariableSupplier +

    +


    + + + + + + + + + + + + + + + +
    + +
    + + + +
    + + + diff --git a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/ui/class-use/LlvmIsToolChainSupported.html b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/ui/class-use/LlvmIsToolChainSupported.html index 50be807e34b..26a4125feb7 100644 --- a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/ui/class-use/LlvmIsToolChainSupported.html +++ b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/ui/class-use/LlvmIsToolChainSupported.html @@ -1,144 +1,144 @@ - - - - - - -Uses of Class org.eclipse.cdt.managedbuilder.llvm.ui.LlvmIsToolChainSupported - - - - - - - - - - - - -
    - - - - - - - - - - - - - - - -
    - -
    - - - -
    -
    -

    -Uses of Class
    org.eclipse.cdt.managedbuilder.llvm.ui.LlvmIsToolChainSupported

    -
    -No usage of org.eclipse.cdt.managedbuilder.llvm.ui.LlvmIsToolChainSupported -

    -


    - - - - - - - - - - - - - - - -
    - -
    - - - -
    - - - + + + + + + +Uses of Class org.eclipse.cdt.managedbuilder.llvm.ui.LlvmIsToolChainSupported + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + +
    + +
    + + + +
    +
    +

    +Uses of Class
    org.eclipse.cdt.managedbuilder.llvm.ui.LlvmIsToolChainSupported

    +
    +No usage of org.eclipse.cdt.managedbuilder.llvm.ui.LlvmIsToolChainSupported +

    +


    + + + + + + + + + + + + + + + +
    + +
    + + + +
    + + + diff --git a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/ui/class-use/LlvmProjectNature.html b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/ui/class-use/LlvmProjectNature.html index 201280584c0..f225fa5d8ec 100644 --- a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/ui/class-use/LlvmProjectNature.html +++ b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/ui/class-use/LlvmProjectNature.html @@ -1,144 +1,144 @@ - - - - - - -Uses of Class org.eclipse.cdt.managedbuilder.llvm.ui.LlvmProjectNature - - - - - - - - - - - - -
    - - - - - - - - - - - - - - - -
    - -
    - - - -
    -
    -

    -Uses of Class
    org.eclipse.cdt.managedbuilder.llvm.ui.LlvmProjectNature

    -
    -No usage of org.eclipse.cdt.managedbuilder.llvm.ui.LlvmProjectNature -

    -


    - - - - - - - - - - - - - - - -
    - -
    - - - -
    - - - + + + + + + +Uses of Class org.eclipse.cdt.managedbuilder.llvm.ui.LlvmProjectNature + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + +
    + +
    + + + +
    +
    +

    +Uses of Class
    org.eclipse.cdt.managedbuilder.llvm.ui.LlvmProjectNature

    +
    +No usage of org.eclipse.cdt.managedbuilder.llvm.ui.LlvmProjectNature +

    +


    + + + + + + + + + + + + + + + +
    + +
    + + + +
    + + + diff --git a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/ui/class-use/LlvmUIPlugin.html b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/ui/class-use/LlvmUIPlugin.html index 401b1c7b245..9c2a95b7559 100644 --- a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/ui/class-use/LlvmUIPlugin.html +++ b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/ui/class-use/LlvmUIPlugin.html @@ -1,196 +1,196 @@ - - - - - - -Uses of Class org.eclipse.cdt.managedbuilder.llvm.ui.LlvmUIPlugin - - - - - - - - - - - - -
    - - - - - - - - - - - - - - - -
    - -
    - - - -
    -
    -

    -Uses of Class
    org.eclipse.cdt.managedbuilder.llvm.ui.LlvmUIPlugin

    -
    - - - - - - - - - -
    -Packages that use LlvmUIPlugin
    org.eclipse.cdt.managedbuilder.llvm.ui  
    -  -

    - - - - - -
    -Uses of LlvmUIPlugin in org.eclipse.cdt.managedbuilder.llvm.ui
    -  -

    - - - - - - - - - -
    Fields in org.eclipse.cdt.managedbuilder.llvm.ui declared as LlvmUIPlugin
    -private static LlvmUIPluginLlvmUIPlugin.plugin - -
    -           
    -  -

    - - - - - - - - - -
    Methods in org.eclipse.cdt.managedbuilder.llvm.ui that return LlvmUIPlugin
    -static LlvmUIPluginLlvmUIPlugin.getDefault() - -
    -          Returns the shared instance
    -  -

    -


    - - - - - - - - - - - - - - - -
    - -
    - - - -
    - - - + + + + + + +Uses of Class org.eclipse.cdt.managedbuilder.llvm.ui.LlvmUIPlugin + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + +
    + +
    + + + +
    +
    +

    +Uses of Class
    org.eclipse.cdt.managedbuilder.llvm.ui.LlvmUIPlugin

    +
    + + + + + + + + + +
    +Packages that use LlvmUIPlugin
    org.eclipse.cdt.managedbuilder.llvm.ui  
    +  +

    + + + + + +
    +Uses of LlvmUIPlugin in org.eclipse.cdt.managedbuilder.llvm.ui
    +  +

    + + + + + + + + + +
    Fields in org.eclipse.cdt.managedbuilder.llvm.ui declared as LlvmUIPlugin
    +private static LlvmUIPluginLlvmUIPlugin.plugin + +
    +           
    +  +

    + + + + + + + + + +
    Methods in org.eclipse.cdt.managedbuilder.llvm.ui that return LlvmUIPlugin
    +static LlvmUIPluginLlvmUIPlugin.getDefault() + +
    +          Returns the shared instance
    +  +

    +


    + + + + + + + + + + + + + + + +
    + +
    + + + +
    + + + diff --git a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/ui/package-frame.html b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/ui/package-frame.html index 1f604df6bd2..3ae344f66aa 100644 --- a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/ui/package-frame.html +++ b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/ui/package-frame.html @@ -1,40 +1,40 @@ - - - - - - -org.eclipse.cdt.managedbuilder.llvm.ui - - - - - - - - - - - -org.eclipse.cdt.managedbuilder.llvm.ui - - - - -
    -Classes  - -
    -LlvmBuildEnvironmentVariable -
    -LlvmEnvironmentVariableSupplier -
    -LlvmIsToolChainSupported -
    -LlvmProjectNature -
    -LlvmUIPlugin
    - - - - + + + + + + +org.eclipse.cdt.managedbuilder.llvm.ui + + + + + + + + + + + +org.eclipse.cdt.managedbuilder.llvm.ui + + + + +
    +Classes  + +
    +LlvmBuildEnvironmentVariable +
    +LlvmEnvironmentVariableSupplier +
    +LlvmIsToolChainSupported +
    +LlvmProjectNature +
    +LlvmUIPlugin
    + + + + diff --git a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/ui/package-summary.html b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/ui/package-summary.html index b57a184bd60..5b724dcbe07 100644 --- a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/ui/package-summary.html +++ b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/ui/package-summary.html @@ -1,173 +1,173 @@ - - - - - - -org.eclipse.cdt.managedbuilder.llvm.ui - - - - - - - - - - - - -
    - - - - - - - - - - - - - - - -
    - -
    - - - -
    -

    -Package org.eclipse.cdt.managedbuilder.llvm.ui -

    - - - - - - - - - - - - - - - - - - - - - - - - - -
    -Class Summary
    LlvmBuildEnvironmentVariableImplemented type that contains BuildEnvironmentalVariables.
    LlvmEnvironmentVariableSupplierContains LLVM environment variables.
    LlvmIsToolChainSupportedBased on MingwIsToolChainSupported.
    LlvmProjectNatureImplements project nature for LLVM projects.
    LlvmUIPluginThe activator class controls the plug-in life cycle.
    -  - -

    -

    -
    -
    - - - - - - - - - - - - - - - -
    - -
    - - - -
    - - - + + + + + + +org.eclipse.cdt.managedbuilder.llvm.ui + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + +
    + +
    + + + +
    +

    +Package org.eclipse.cdt.managedbuilder.llvm.ui +

    + + + + + + + + + + + + + + + + + + + + + + + + + +
    +Class Summary
    LlvmBuildEnvironmentVariableImplemented type that contains BuildEnvironmentalVariables.
    LlvmEnvironmentVariableSupplierContains LLVM environment variables.
    LlvmIsToolChainSupportedBased on MingwIsToolChainSupported.
    LlvmProjectNatureImplements project nature for LLVM projects.
    LlvmUIPluginThe activator class controls the plug-in life cycle.
    +  + +

    +

    +
    +
    + + + + + + + + + + + + + + + +
    + +
    + + + +
    + + + diff --git a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/ui/package-tree.html b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/ui/package-tree.html index bc0dddc0212..25b95e41579 100644 --- a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/ui/package-tree.html +++ b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/ui/package-tree.html @@ -1,162 +1,162 @@ - - - - - - -org.eclipse.cdt.managedbuilder.llvm.ui Class Hierarchy - - - - - - - - - - - - -
    - - - - - - - - - - - - - - - -
    - -
    - - - -
    -
    -

    -Hierarchy For Package org.eclipse.cdt.managedbuilder.llvm.ui -

    -
    -
    -
    Package Hierarchies:
    All Packages
    -
    -

    -Class Hierarchy -

    -
      -
    • java.lang.Object
        -
      • org.eclipse.cdt.managedbuilder.llvm.ui.LlvmBuildEnvironmentVariable (implements org.eclipse.cdt.managedbuilder.envvar.IBuildEnvironmentVariable) -
      • org.eclipse.cdt.managedbuilder.llvm.ui.LlvmEnvironmentVariableSupplier (implements org.eclipse.cdt.managedbuilder.envvar.IConfigurationEnvironmentVariableSupplier) -
      • org.eclipse.cdt.managedbuilder.llvm.ui.LlvmIsToolChainSupported (implements org.eclipse.cdt.managedbuilder.core.IManagedIsToolChainSupported) -
      • org.eclipse.cdt.managedbuilder.llvm.ui.LlvmProjectNature (implements org.eclipse.core.resources.IProjectNature) -
      • org.eclipse.core.runtime.Plugin (implements org.osgi.framework.BundleActivator) -
          -
        • org.eclipse.ui.plugin.AbstractUIPlugin -
        -
      -
    -
    - - - - - - - - - - - - - - - -
    - -
    - - - -
    - - - + + + + + + +org.eclipse.cdt.managedbuilder.llvm.ui Class Hierarchy + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + +
    + +
    + + + +
    +
    +

    +Hierarchy For Package org.eclipse.cdt.managedbuilder.llvm.ui +

    +
    +
    +
    Package Hierarchies:
    All Packages
    +
    +

    +Class Hierarchy +

    +
      +
    • java.lang.Object
        +
      • org.eclipse.cdt.managedbuilder.llvm.ui.LlvmBuildEnvironmentVariable (implements org.eclipse.cdt.managedbuilder.envvar.IBuildEnvironmentVariable) +
      • org.eclipse.cdt.managedbuilder.llvm.ui.LlvmEnvironmentVariableSupplier (implements org.eclipse.cdt.managedbuilder.envvar.IConfigurationEnvironmentVariableSupplier) +
      • org.eclipse.cdt.managedbuilder.llvm.ui.LlvmIsToolChainSupported (implements org.eclipse.cdt.managedbuilder.core.IManagedIsToolChainSupported) +
      • org.eclipse.cdt.managedbuilder.llvm.ui.LlvmProjectNature (implements org.eclipse.core.resources.IProjectNature) +
      • org.eclipse.core.runtime.Plugin (implements org.osgi.framework.BundleActivator) +
          +
        • org.eclipse.ui.plugin.AbstractUIPlugin +
        +
      +
    +
    + + + + + + + + + + + + + + + +
    + +
    + + + +
    + + + diff --git a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/ui/package-use.html b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/ui/package-use.html index d672249cb6c..eaa18044a58 100644 --- a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/ui/package-use.html +++ b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/ui/package-use.html @@ -1,176 +1,176 @@ - - - - - - -Uses of Package org.eclipse.cdt.managedbuilder.llvm.ui - - - - - - - - - - - - -
    - - - - - - - - - - - - - - - -
    - -
    - - - -
    -
    -

    -Uses of Package
    org.eclipse.cdt.managedbuilder.llvm.ui

    -
    - - - - - - - - - -
    -Packages that use org.eclipse.cdt.managedbuilder.llvm.ui
    org.eclipse.cdt.managedbuilder.llvm.ui  
    -  -

    - - - - - - - - - - - -
    -Classes in org.eclipse.cdt.managedbuilder.llvm.ui used by org.eclipse.cdt.managedbuilder.llvm.ui
    LlvmBuildEnvironmentVariable - -
    -          Implemented type that contains BuildEnvironmentalVariables.
    LlvmUIPlugin - -
    -          The activator class controls the plug-in life cycle.
    -  -

    -


    - - - - - - - - - - - - - - - -
    - -
    - - - -
    - - - + + + + + + +Uses of Package org.eclipse.cdt.managedbuilder.llvm.ui + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + +
    + +
    + + + +
    +
    +

    +Uses of Package
    org.eclipse.cdt.managedbuilder.llvm.ui

    +
    + + + + + + + + + +
    +Packages that use org.eclipse.cdt.managedbuilder.llvm.ui
    org.eclipse.cdt.managedbuilder.llvm.ui  
    +  +

    + + + + + + + + + + + +
    +Classes in org.eclipse.cdt.managedbuilder.llvm.ui used by org.eclipse.cdt.managedbuilder.llvm.ui
    LlvmBuildEnvironmentVariable + +
    +          Implemented type that contains BuildEnvironmentalVariables.
    LlvmUIPlugin + +
    +          The activator class controls the plug-in life cycle.
    +  +

    +


    + + + + + + + + + + + + + + + +
    + +
    + + + +
    + + + diff --git a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/ui/preferences/IncludePathListEditor.html b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/ui/preferences/IncludePathListEditor.html index 3440908fcf3..08e2d04b9db 100644 --- a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/ui/preferences/IncludePathListEditor.html +++ b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/ui/preferences/IncludePathListEditor.html @@ -1,350 +1,350 @@ - - - - - - -IncludePathListEditor - - - - - - - - - - - - -
    - - - - - - - - - - - - - - - - - - - -
    - -
    - - - -
    - -

    - -org.eclipse.cdt.managedbuilder.llvm.ui.preferences -
    -Class IncludePathListEditor

    -
    -java.lang.Object
    -  extended by org.eclipse.jface.preference.FieldEditor
    -      extended by org.eclipse.jface.preference.ListEditor
    -          extended by org.eclipse.cdt.managedbuilder.llvm.ui.preferences.LlvmListEditor
    -              extended by org.eclipse.cdt.managedbuilder.llvm.ui.preferences.IncludePathListEditor
    -
    -
    -
    -
    public class IncludePathListEditor
    extends LlvmListEditor
    - - -

    + + + + + + +IncludePathListEditor + + + + + + + + + + + + +


    + + + + + + + + + + + + + + + + + + + +
    + +
    + + + +
    + +

    + +org.eclipse.cdt.managedbuilder.llvm.ui.preferences +
    +Class IncludePathListEditor

    +
    +java.lang.Object
    +  extended by org.eclipse.jface.preference.FieldEditor
    +      extended by org.eclipse.jface.preference.ListEditor
    +          extended by org.eclipse.cdt.managedbuilder.llvm.ui.preferences.LlvmListEditor
    +              extended by org.eclipse.cdt.managedbuilder.llvm.ui.preferences.IncludePathListEditor
    +
    +
    +
    +
    public class IncludePathListEditor
    extends LlvmListEditor
    + + +

    New implementation of LlvmListEditor. - Used to select an include path from the dialog. -

    - -

    -


    - -

    - - - - - - - -
    -Field Summary
    - - - - - - - -
    Fields inherited from class org.eclipse.cdt.managedbuilder.llvm.ui.preferences.LlvmListEditor
    addButton, buttonBox, downButton, list, removeButton, upButton
    - - - - - - - -
    Fields inherited from class org.eclipse.jface.preference.FieldEditor
    HORIZONTAL_GAP, IS_VALID, VALUE
    -  - - - - - - - - - - -
    -Constructor Summary
    IncludePathListEditor(java.lang.String name, - java.lang.String labelText, - org.eclipse.swt.widgets.Composite parent) - -
    -          Constructor.
    -  - - - - - - - - - - - - - - - -
    -Method Summary
    -protected  java.lang.StringgetNewInputObject() - -
    -           
    -protected  voidremovePressed() - -
    -          Notifies that the Remove button has been pressed.
    - - - - - - - -
    Methods inherited from class org.eclipse.cdt.managedbuilder.llvm.ui.preferences.LlvmListEditor
    addPressed, createList, createSelectionListener, downPressed, getButtonBoxControl, getListControl, getShell, parseString, selectionChanged, upPressed
    - - - - - - - -
    Methods inherited from class org.eclipse.jface.preference.ListEditor
    adjustForNumColumns, doFillIntoGrid, doLoad, doLoadDefault, doStore, getAddButton, getDownButton, getList, getNumberOfControls, getRemoveButton, getUpButton, setEnabled, setFocus
    - - - - - - - -
    Methods inherited from class org.eclipse.jface.preference.FieldEditor
    applyFont, checkParent, clearErrorMessage, clearMessage, convertHorizontalDLUsToPixels, convertVerticalDLUsToPixels, createControl, dispose, fillIntoGrid, fireStateChanged, fireValueChanged, getFieldEditorFontName, getLabelControl, getLabelControl, getLabelText, getPage, getPreferenceName, getPreferencePage, getPreferenceStore, init, isValid, load, loadDefault, presentsDefaultValue, refreshValidState, setButtonLayoutData, setLabelText, setPage, setPreferenceName, setPreferencePage, setPreferenceStore, setPresentsDefaultValue, setPropertyChangeListener, showErrorMessage, showMessage, store
    - - - - - - - -
    Methods inherited from class java.lang.Object
    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    -  -

    - - - - - - - - -
    -Constructor Detail
    - -

    -IncludePathListEditor

    -
    -IncludePathListEditor(java.lang.String name,
    -                      java.lang.String labelText,
    -                      org.eclipse.swt.widgets.Composite parent)
    -
    -
    Constructor. -

    -

    -
    Parameters:
    name - the name of the preference this field editor works on
    labelText - the label text of the field editor
    parent - the parent of the field editor's control
    -
    - - - - - - - - -
    -Method Detail
    - -

    -getNewInputObject

    -
    -protected java.lang.String getNewInputObject()
    -
    -
    -
    Specified by:
    getNewInputObject in class org.eclipse.jface.preference.ListEditor
    -
    -
    -
    -
    -
    -
    - -

    -removePressed

    -
    -protected void removePressed()
    -
    -
    Description copied from class: LlvmListEditor
    -
    Notifies that the Remove button has been pressed. -

    -

    -
    Specified by:
    removePressed in class LlvmListEditor
    -
    -
    -
    -
    -
    - -
    - - - - - - - - - - - - - - - - - - - -
    - -
    - - - -
    - - - + Used to select an include path from the dialog. +

    + +

    +


    + +

    + + + + + + + +
    +Field Summary
    + + + + + + + +
    Fields inherited from class org.eclipse.cdt.managedbuilder.llvm.ui.preferences.LlvmListEditor
    addButton, buttonBox, downButton, list, removeButton, upButton
    + + + + + + + +
    Fields inherited from class org.eclipse.jface.preference.FieldEditor
    HORIZONTAL_GAP, IS_VALID, VALUE
    +  + + + + + + + + + + +
    +Constructor Summary
    IncludePathListEditor(java.lang.String name, + java.lang.String labelText, + org.eclipse.swt.widgets.Composite parent) + +
    +          Constructor.
    +  + + + + + + + + + + + + + + + +
    +Method Summary
    +protected  java.lang.StringgetNewInputObject() + +
    +           
    +protected  voidremovePressed() + +
    +          Notifies that the Remove button has been pressed.
    + + + + + + + +
    Methods inherited from class org.eclipse.cdt.managedbuilder.llvm.ui.preferences.LlvmListEditor
    addPressed, createList, createSelectionListener, downPressed, getButtonBoxControl, getListControl, getShell, parseString, selectionChanged, upPressed
    + + + + + + + +
    Methods inherited from class org.eclipse.jface.preference.ListEditor
    adjustForNumColumns, doFillIntoGrid, doLoad, doLoadDefault, doStore, getAddButton, getDownButton, getList, getNumberOfControls, getRemoveButton, getUpButton, setEnabled, setFocus
    + + + + + + + +
    Methods inherited from class org.eclipse.jface.preference.FieldEditor
    applyFont, checkParent, clearErrorMessage, clearMessage, convertHorizontalDLUsToPixels, convertVerticalDLUsToPixels, createControl, dispose, fillIntoGrid, fireStateChanged, fireValueChanged, getFieldEditorFontName, getLabelControl, getLabelControl, getLabelText, getPage, getPreferenceName, getPreferencePage, getPreferenceStore, init, isValid, load, loadDefault, presentsDefaultValue, refreshValidState, setButtonLayoutData, setLabelText, setPage, setPreferenceName, setPreferencePage, setPreferenceStore, setPresentsDefaultValue, setPropertyChangeListener, showErrorMessage, showMessage, store
    + + + + + + + +
    Methods inherited from class java.lang.Object
    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    +  +

    + + + + + + + + +
    +Constructor Detail
    + +

    +IncludePathListEditor

    +
    +IncludePathListEditor(java.lang.String name,
    +                      java.lang.String labelText,
    +                      org.eclipse.swt.widgets.Composite parent)
    +
    +
    Constructor. +

    +

    +
    Parameters:
    name - the name of the preference this field editor works on
    labelText - the label text of the field editor
    parent - the parent of the field editor's control
    +
    + + + + + + + + +
    +Method Detail
    + +

    +getNewInputObject

    +
    +protected java.lang.String getNewInputObject()
    +
    +
    +
    Specified by:
    getNewInputObject in class org.eclipse.jface.preference.ListEditor
    +
    +
    +
    +
    +
    +
    + +

    +removePressed

    +
    +protected void removePressed()
    +
    +
    Description copied from class: LlvmListEditor
    +
    Notifies that the Remove button has been pressed. +

    +

    +
    Specified by:
    removePressed in class LlvmListEditor
    +
    +
    +
    +
    +
    + +
    + + + + + + + + + + + + + + + + + + + +
    + +
    + + + +
    + + + diff --git a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/ui/preferences/LibraryListEditor.html b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/ui/preferences/LibraryListEditor.html index 18d87ee9006..80f2a794c89 100644 --- a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/ui/preferences/LibraryListEditor.html +++ b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/ui/preferences/LibraryListEditor.html @@ -1,350 +1,350 @@ - - - - - - -LibraryListEditor - - - - - - - - - - - - -
    - - - - - - - - - - - - - - - - - - - -
    - -
    - - - -
    - -

    - -org.eclipse.cdt.managedbuilder.llvm.ui.preferences -
    -Class LibraryListEditor

    -
    -java.lang.Object
    -  extended by org.eclipse.jface.preference.FieldEditor
    -      extended by org.eclipse.jface.preference.ListEditor
    -          extended by org.eclipse.cdt.managedbuilder.llvm.ui.preferences.LlvmListEditor
    -              extended by org.eclipse.cdt.managedbuilder.llvm.ui.preferences.LibraryListEditor
    -
    -
    -
    -
    public class LibraryListEditor
    extends LlvmListEditor
    - - -

    + + + + + + +LibraryListEditor + + + + + + + + + + + + +


    + + + + + + + + + + + + + + + + + + + +
    + +
    + + + +
    + +

    + +org.eclipse.cdt.managedbuilder.llvm.ui.preferences +
    +Class LibraryListEditor

    +
    +java.lang.Object
    +  extended by org.eclipse.jface.preference.FieldEditor
    +      extended by org.eclipse.jface.preference.ListEditor
    +          extended by org.eclipse.cdt.managedbuilder.llvm.ui.preferences.LlvmListEditor
    +              extended by org.eclipse.cdt.managedbuilder.llvm.ui.preferences.LibraryListEditor
    +
    +
    +
    +
    public class LibraryListEditor
    extends LlvmListEditor
    + + +

    New implementation of LlvmListEditor. - Used to select a library file from the dialog. -

    - -

    -


    - -

    - - - - - - - -
    -Field Summary
    - - - - - - - -
    Fields inherited from class org.eclipse.cdt.managedbuilder.llvm.ui.preferences.LlvmListEditor
    addButton, buttonBox, downButton, list, removeButton, upButton
    - - - - - - - -
    Fields inherited from class org.eclipse.jface.preference.FieldEditor
    HORIZONTAL_GAP, IS_VALID, VALUE
    -  - - - - - - - - - - -
    -Constructor Summary
    LibraryListEditor(java.lang.String name, - java.lang.String labelText, - org.eclipse.swt.widgets.Composite parent) - -
    -          Constructor.
    -  - - - - - - - - - - - - - - - -
    -Method Summary
    -protected  java.lang.StringgetNewInputObject() - -
    -           
    -protected  voidremovePressed() - -
    -          Notifies that the Remove button has been pressed.
    - - - - - - - -
    Methods inherited from class org.eclipse.cdt.managedbuilder.llvm.ui.preferences.LlvmListEditor
    addPressed, createList, createSelectionListener, downPressed, getButtonBoxControl, getListControl, getShell, parseString, selectionChanged, upPressed
    - - - - - - - -
    Methods inherited from class org.eclipse.jface.preference.ListEditor
    adjustForNumColumns, doFillIntoGrid, doLoad, doLoadDefault, doStore, getAddButton, getDownButton, getList, getNumberOfControls, getRemoveButton, getUpButton, setEnabled, setFocus
    - - - - - - - -
    Methods inherited from class org.eclipse.jface.preference.FieldEditor
    applyFont, checkParent, clearErrorMessage, clearMessage, convertHorizontalDLUsToPixels, convertVerticalDLUsToPixels, createControl, dispose, fillIntoGrid, fireStateChanged, fireValueChanged, getFieldEditorFontName, getLabelControl, getLabelControl, getLabelText, getPage, getPreferenceName, getPreferencePage, getPreferenceStore, init, isValid, load, loadDefault, presentsDefaultValue, refreshValidState, setButtonLayoutData, setLabelText, setPage, setPreferenceName, setPreferencePage, setPreferenceStore, setPresentsDefaultValue, setPropertyChangeListener, showErrorMessage, showMessage, store
    - - - - - - - -
    Methods inherited from class java.lang.Object
    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    -  -

    - - - - - - - - -
    -Constructor Detail
    - -

    -LibraryListEditor

    -
    -LibraryListEditor(java.lang.String name,
    -                  java.lang.String labelText,
    -                  org.eclipse.swt.widgets.Composite parent)
    -
    -
    Constructor. -

    -

    -
    Parameters:
    name -
    labelText -
    parent -
    -
    - - - - - - - - -
    -Method Detail
    - -

    -getNewInputObject

    -
    -protected java.lang.String getNewInputObject()
    -
    -
    -
    Specified by:
    getNewInputObject in class org.eclipse.jface.preference.ListEditor
    -
    -
    -
    -
    -
    -
    - -

    -removePressed

    -
    -protected void removePressed()
    -
    -
    Description copied from class: LlvmListEditor
    -
    Notifies that the Remove button has been pressed. -

    -

    -
    Specified by:
    removePressed in class LlvmListEditor
    -
    -
    -
    -
    -
    - -
    - - - - - - - - - - - - - - - - - - - -
    - -
    - - - -
    - - - + Used to select a library file from the dialog. +

    + +

    +


    + +

    + + + + + + + +
    +Field Summary
    + + + + + + + +
    Fields inherited from class org.eclipse.cdt.managedbuilder.llvm.ui.preferences.LlvmListEditor
    addButton, buttonBox, downButton, list, removeButton, upButton
    + + + + + + + +
    Fields inherited from class org.eclipse.jface.preference.FieldEditor
    HORIZONTAL_GAP, IS_VALID, VALUE
    +  + + + + + + + + + + +
    +Constructor Summary
    LibraryListEditor(java.lang.String name, + java.lang.String labelText, + org.eclipse.swt.widgets.Composite parent) + +
    +          Constructor.
    +  + + + + + + + + + + + + + + + +
    +Method Summary
    +protected  java.lang.StringgetNewInputObject() + +
    +           
    +protected  voidremovePressed() + +
    +          Notifies that the Remove button has been pressed.
    + + + + + + + +
    Methods inherited from class org.eclipse.cdt.managedbuilder.llvm.ui.preferences.LlvmListEditor
    addPressed, createList, createSelectionListener, downPressed, getButtonBoxControl, getListControl, getShell, parseString, selectionChanged, upPressed
    + + + + + + + +
    Methods inherited from class org.eclipse.jface.preference.ListEditor
    adjustForNumColumns, doFillIntoGrid, doLoad, doLoadDefault, doStore, getAddButton, getDownButton, getList, getNumberOfControls, getRemoveButton, getUpButton, setEnabled, setFocus
    + + + + + + + +
    Methods inherited from class org.eclipse.jface.preference.FieldEditor
    applyFont, checkParent, clearErrorMessage, clearMessage, convertHorizontalDLUsToPixels, convertVerticalDLUsToPixels, createControl, dispose, fillIntoGrid, fireStateChanged, fireValueChanged, getFieldEditorFontName, getLabelControl, getLabelControl, getLabelText, getPage, getPreferenceName, getPreferencePage, getPreferenceStore, init, isValid, load, loadDefault, presentsDefaultValue, refreshValidState, setButtonLayoutData, setLabelText, setPage, setPreferenceName, setPreferencePage, setPreferenceStore, setPresentsDefaultValue, setPropertyChangeListener, showErrorMessage, showMessage, store
    + + + + + + + +
    Methods inherited from class java.lang.Object
    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    +  +

    + + + + + + + + +
    +Constructor Detail
    + +

    +LibraryListEditor

    +
    +LibraryListEditor(java.lang.String name,
    +                  java.lang.String labelText,
    +                  org.eclipse.swt.widgets.Composite parent)
    +
    +
    Constructor. +

    +

    +
    Parameters:
    name -
    labelText -
    parent -
    +
    + + + + + + + + +
    +Method Detail
    + +

    +getNewInputObject

    +
    +protected java.lang.String getNewInputObject()
    +
    +
    +
    Specified by:
    getNewInputObject in class org.eclipse.jface.preference.ListEditor
    +
    +
    +
    +
    +
    +
    + +

    +removePressed

    +
    +protected void removePressed()
    +
    +
    Description copied from class: LlvmListEditor
    +
    Notifies that the Remove button has been pressed. +

    +

    +
    Specified by:
    removePressed in class LlvmListEditor
    +
    +
    +
    +
    +
    + +
    + + + + + + + + + + + + + + + + + + + +
    + +
    + + + +
    + + + diff --git a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/ui/preferences/LibraryPathListEditor.html b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/ui/preferences/LibraryPathListEditor.html index 6c15820990a..17deb4b6627 100644 --- a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/ui/preferences/LibraryPathListEditor.html +++ b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/ui/preferences/LibraryPathListEditor.html @@ -1,350 +1,350 @@ - - - - - - -LibraryPathListEditor - - - - - - - - - - - - -
    - - - - - - - - - - - - - - - - - - - -
    - -
    - - - -
    - -

    - -org.eclipse.cdt.managedbuilder.llvm.ui.preferences -
    -Class LibraryPathListEditor

    -
    -java.lang.Object
    -  extended by org.eclipse.jface.preference.FieldEditor
    -      extended by org.eclipse.jface.preference.ListEditor
    -          extended by org.eclipse.cdt.managedbuilder.llvm.ui.preferences.LlvmListEditor
    -              extended by org.eclipse.cdt.managedbuilder.llvm.ui.preferences.LibraryPathListEditor
    -
    -
    -
    -
    public class LibraryPathListEditor
    extends LlvmListEditor
    - - -

    + + + + + + +LibraryPathListEditor + + + + + + + + + + + + +


    + + + + + + + + + + + + + + + + + + + +
    + +
    + + + +
    + +

    + +org.eclipse.cdt.managedbuilder.llvm.ui.preferences +
    +Class LibraryPathListEditor

    +
    +java.lang.Object
    +  extended by org.eclipse.jface.preference.FieldEditor
    +      extended by org.eclipse.jface.preference.ListEditor
    +          extended by org.eclipse.cdt.managedbuilder.llvm.ui.preferences.LlvmListEditor
    +              extended by org.eclipse.cdt.managedbuilder.llvm.ui.preferences.LibraryPathListEditor
    +
    +
    +
    +
    public class LibraryPathListEditor
    extends LlvmListEditor
    + + +

    New implementation of LlvmListEditor. - Used to select a library path from the dialog. -

    - -

    -


    - -

    - - - - - - - -
    -Field Summary
    - - - - - - - -
    Fields inherited from class org.eclipse.cdt.managedbuilder.llvm.ui.preferences.LlvmListEditor
    addButton, buttonBox, downButton, list, removeButton, upButton
    - - - - - - - -
    Fields inherited from class org.eclipse.jface.preference.FieldEditor
    HORIZONTAL_GAP, IS_VALID, VALUE
    -  - - - - - - - - - - -
    -Constructor Summary
    LibraryPathListEditor(java.lang.String name, - java.lang.String labelText, - org.eclipse.swt.widgets.Composite parent) - -
    -          Constructor.
    -  - - - - - - - - - - - - - - - -
    -Method Summary
    -protected  java.lang.StringgetNewInputObject() - -
    -           
    -protected  voidremovePressed() - -
    -          Notifies that the Remove button has been pressed.
    - - - - - - - -
    Methods inherited from class org.eclipse.cdt.managedbuilder.llvm.ui.preferences.LlvmListEditor
    addPressed, createList, createSelectionListener, downPressed, getButtonBoxControl, getListControl, getShell, parseString, selectionChanged, upPressed
    - - - - - - - -
    Methods inherited from class org.eclipse.jface.preference.ListEditor
    adjustForNumColumns, doFillIntoGrid, doLoad, doLoadDefault, doStore, getAddButton, getDownButton, getList, getNumberOfControls, getRemoveButton, getUpButton, setEnabled, setFocus
    - - - - - - - -
    Methods inherited from class org.eclipse.jface.preference.FieldEditor
    applyFont, checkParent, clearErrorMessage, clearMessage, convertHorizontalDLUsToPixels, convertVerticalDLUsToPixels, createControl, dispose, fillIntoGrid, fireStateChanged, fireValueChanged, getFieldEditorFontName, getLabelControl, getLabelControl, getLabelText, getPage, getPreferenceName, getPreferencePage, getPreferenceStore, init, isValid, load, loadDefault, presentsDefaultValue, refreshValidState, setButtonLayoutData, setLabelText, setPage, setPreferenceName, setPreferencePage, setPreferenceStore, setPresentsDefaultValue, setPropertyChangeListener, showErrorMessage, showMessage, store
    - - - - - - - -
    Methods inherited from class java.lang.Object
    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    -  -

    - - - - - - - - -
    -Constructor Detail
    - -

    -LibraryPathListEditor

    -
    -LibraryPathListEditor(java.lang.String name,
    -                      java.lang.String labelText,
    -                      org.eclipse.swt.widgets.Composite parent)
    -
    -
    Constructor. -

    -

    -
    Parameters:
    name - the name of the preference this field editor works on
    labelText - the label text of the field editor
    parent - the parent of the field editor's control
    -
    - - - - - - - - -
    -Method Detail
    - -

    -getNewInputObject

    -
    -protected java.lang.String getNewInputObject()
    -
    -
    -
    Specified by:
    getNewInputObject in class org.eclipse.jface.preference.ListEditor
    -
    -
    -
    -
    -
    -
    - -

    -removePressed

    -
    -protected void removePressed()
    -
    -
    Description copied from class: LlvmListEditor
    -
    Notifies that the Remove button has been pressed. -

    -

    -
    Specified by:
    removePressed in class LlvmListEditor
    -
    -
    -
    -
    -
    - -
    - - - - - - - - - - - - - - - - - - - -
    - -
    - - - -
    - - - + Used to select a library path from the dialog. +

    + +

    +


    + +

    + + + + + + + +
    +Field Summary
    + + + + + + + +
    Fields inherited from class org.eclipse.cdt.managedbuilder.llvm.ui.preferences.LlvmListEditor
    addButton, buttonBox, downButton, list, removeButton, upButton
    + + + + + + + +
    Fields inherited from class org.eclipse.jface.preference.FieldEditor
    HORIZONTAL_GAP, IS_VALID, VALUE
    +  + + + + + + + + + + +
    +Constructor Summary
    LibraryPathListEditor(java.lang.String name, + java.lang.String labelText, + org.eclipse.swt.widgets.Composite parent) + +
    +          Constructor.
    +  + + + + + + + + + + + + + + + +
    +Method Summary
    +protected  java.lang.StringgetNewInputObject() + +
    +           
    +protected  voidremovePressed() + +
    +          Notifies that the Remove button has been pressed.
    + + + + + + + +
    Methods inherited from class org.eclipse.cdt.managedbuilder.llvm.ui.preferences.LlvmListEditor
    addPressed, createList, createSelectionListener, downPressed, getButtonBoxControl, getListControl, getShell, parseString, selectionChanged, upPressed
    + + + + + + + +
    Methods inherited from class org.eclipse.jface.preference.ListEditor
    adjustForNumColumns, doFillIntoGrid, doLoad, doLoadDefault, doStore, getAddButton, getDownButton, getList, getNumberOfControls, getRemoveButton, getUpButton, setEnabled, setFocus
    + + + + + + + +
    Methods inherited from class org.eclipse.jface.preference.FieldEditor
    applyFont, checkParent, clearErrorMessage, clearMessage, convertHorizontalDLUsToPixels, convertVerticalDLUsToPixels, createControl, dispose, fillIntoGrid, fireStateChanged, fireValueChanged, getFieldEditorFontName, getLabelControl, getLabelControl, getLabelText, getPage, getPreferenceName, getPreferencePage, getPreferenceStore, init, isValid, load, loadDefault, presentsDefaultValue, refreshValidState, setButtonLayoutData, setLabelText, setPage, setPreferenceName, setPreferencePage, setPreferenceStore, setPresentsDefaultValue, setPropertyChangeListener, showErrorMessage, showMessage, store
    + + + + + + + +
    Methods inherited from class java.lang.Object
    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    +  +

    + + + + + + + + +
    +Constructor Detail
    + +

    +LibraryPathListEditor

    +
    +LibraryPathListEditor(java.lang.String name,
    +                      java.lang.String labelText,
    +                      org.eclipse.swt.widgets.Composite parent)
    +
    +
    Constructor. +

    +

    +
    Parameters:
    name - the name of the preference this field editor works on
    labelText - the label text of the field editor
    parent - the parent of the field editor's control
    +
    + + + + + + + + +
    +Method Detail
    + +

    +getNewInputObject

    +
    +protected java.lang.String getNewInputObject()
    +
    +
    +
    Specified by:
    getNewInputObject in class org.eclipse.jface.preference.ListEditor
    +
    +
    +
    +
    +
    +
    + +

    +removePressed

    +
    +protected void removePressed()
    +
    +
    Description copied from class: LlvmListEditor
    +
    Notifies that the Remove button has been pressed. +

    +

    +
    Specified by:
    removePressed in class LlvmListEditor
    +
    +
    +
    +
    +
    + +
    + + + + + + + + + + + + + + + + + + + +
    + +
    + + + +
    + + + diff --git a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/ui/preferences/LlvmListEditor.html b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/ui/preferences/LlvmListEditor.html index aa81a240d9a..9126d01768d 100644 --- a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/ui/preferences/LlvmListEditor.html +++ b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/ui/preferences/LlvmListEditor.html @@ -1,795 +1,795 @@ - - - - - - -LlvmListEditor - - - - - - - - - - - - -
    - - - - - - - - - - - - - - - - - - - -
    - -
    - - - -
    - -

    - -org.eclipse.cdt.managedbuilder.llvm.ui.preferences -
    -Class LlvmListEditor

    -
    -java.lang.Object
    -  extended by org.eclipse.jface.preference.FieldEditor
    -      extended by org.eclipse.jface.preference.ListEditor
    -          extended by org.eclipse.cdt.managedbuilder.llvm.ui.preferences.LlvmListEditor
    -
    -
    -
    Direct Known Subclasses:
    IncludePathListEditor, LibraryListEditor, LibraryPathListEditor
    -
    -
    -
    -
    public abstract class LlvmListEditor
    extends org.eclipse.jface.preference.ListEditor
    - - -

    + + + + + + +LlvmListEditor + + + + + + + + + + + + +


    + + + + + + + + + + + + + + + + + + + +
    + +
    + + + +
    + +

    + +org.eclipse.cdt.managedbuilder.llvm.ui.preferences +
    +Class LlvmListEditor

    +
    +java.lang.Object
    +  extended by org.eclipse.jface.preference.FieldEditor
    +      extended by org.eclipse.jface.preference.ListEditor
    +          extended by org.eclipse.cdt.managedbuilder.llvm.ui.preferences.LlvmListEditor
    +
    +
    +
    Direct Known Subclasses:
    IncludePathListEditor, LibraryListEditor, LibraryPathListEditor
    +
    +
    +
    +
    public abstract class LlvmListEditor
    extends org.eclipse.jface.preference.ListEditor
    + + +

    An abstract list editor that manages a list of input values. The editor displays a list containing the values, buttons for adding and removing - values, and Up and Down buttons to adjust the order of elements in the list. -

    - -

    -


    - -

    - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    -Field Summary
    -(package private)  org.eclipse.swt.widgets.ButtonaddButton - -
    -          The Add button.
    -(package private)  org.eclipse.swt.widgets.CompositebuttonBox - -
    + values, and Up and Down buttons to adjust the order of elements in the list. +

    + +

    +


    + +

    + + + + + + + + + + + + + + - - - - - - - - + + + + + + + + - - - - - - - - - - - - - -
    +Field Summary
    +(package private)  org.eclipse.swt.widgets.ButtonaddButton + +
    +          The Add button.
    +(package private)  org.eclipse.swt.widgets.CompositebuttonBox + +
              The button box containing the Add, Remove, Up, and Down buttons; - null if none (before creation or after disposal).
    -(package private)  org.eclipse.swt.widgets.ButtondownButton - -
    -          The Down button.
    -(package private)  org.eclipse.swt.widgets.Listlist - -
    + null if none (before creation or after disposal).
    +(package private)  org.eclipse.swt.widgets.ButtondownButton + +
    +          The Down button.
    +(package private)  org.eclipse.swt.widgets.Listlist + +
              The list widget; null if none - (before creation or after disposal).
    -(package private)  org.eclipse.swt.widgets.ButtonremoveButton - -
    -          The Remove button.
    -private  org.eclipse.swt.events.SelectionListenerselectionListener - -
    -          The selection listener.
    -(package private)  org.eclipse.swt.widgets.ButtonupButton - -
    -          The Up button.
    - - - - - - - -
    Fields inherited from class org.eclipse.jface.preference.FieldEditor
    HORIZONTAL_GAP, IS_VALID, VALUE
    -  - - - - - - - - - - - -
    -Constructor Summary
    -protected LlvmListEditor(java.lang.String name, - java.lang.String labelText, - org.eclipse.swt.widgets.Composite parent) - -
    -          Creates a list field editor.
    -  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + +
    -Method Summary
    -(package private)  voidaddPressed() - -
    -          Notifies that the Add button has been pressed.
    -private  voidcreateButtons(org.eclipse.swt.widgets.Composite box) - -
    -          Creates the Add, Remove, Up, and Down button in the given button box.
    -protected  java.lang.StringcreateList(java.lang.String[] items) - -
    -           
    -private  org.eclipse.swt.widgets.ButtoncreatePushButton(org.eclipse.swt.widgets.Composite parent, - java.lang.String key) - -
    -          Helper method to create a push button.
    - voidcreateSelectionListener() - -
    -          Creates a selection listener.
    -(package private)  voiddownPressed() - -
    -          Notifies that the Down button has been pressed.
    - org.eclipse.swt.widgets.CompositegetButtonBoxControl(org.eclipse.swt.widgets.Composite parent) - -
    + (before creation or after disposal).
    +(package private)  org.eclipse.swt.widgets.ButtonremoveButton + +
    +          The Remove button.
    +private  org.eclipse.swt.events.SelectionListenerselectionListener + +
    +          The selection listener.
    +(package private)  org.eclipse.swt.widgets.ButtonupButton + +
    +          The Up button.
    + + + + + + + +
    Fields inherited from class org.eclipse.jface.preference.FieldEditor
    HORIZONTAL_GAP, IS_VALID, VALUE
    +  + + + + + + + + + + + +
    +Constructor Summary
    +protected LlvmListEditor(java.lang.String name, + java.lang.String labelText, + org.eclipse.swt.widgets.Composite parent) + +
    +          Creates a list field editor.
    +  + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    +Method Summary
    +(package private)  voidaddPressed() + +
    +          Notifies that the Add button has been pressed.
    +private  voidcreateButtons(org.eclipse.swt.widgets.Composite box) + +
    +          Creates the Add, Remove, Up, and Down button in the given button box.
    +protected  java.lang.StringcreateList(java.lang.String[] items) + +
    +           
    +private  org.eclipse.swt.widgets.ButtoncreatePushButton(org.eclipse.swt.widgets.Composite parent, + java.lang.String key) + +
    +          Helper method to create a push button.
    + voidcreateSelectionListener() + +
    +          Creates a selection listener.
    +(package private)  voiddownPressed() + +
    +          Notifies that the Down button has been pressed.
    + org.eclipse.swt.widgets.CompositegetButtonBoxControl(org.eclipse.swt.widgets.Composite parent) + +
              Returns this field editor's button box containing the Add, Remove, - Up, and Down button.
    - org.eclipse.swt.widgets.ListgetListControl(org.eclipse.swt.widgets.Composite parent) - -
    -          Returns this field editor's list control.
    -private  org.eclipse.swt.events.SelectionListenergetSelectionListener() - -
    -          Returns this field editor's selection listener.
    -protected  org.eclipse.swt.widgets.ShellgetShell() - -
    -          Returns this field editor's shell.
    -protected  java.lang.String[]parseString(java.lang.String stringList) - -
    -           
    -protected abstract  voidremovePressed() - -
    -          Notifies that the Remove button has been pressed.
    -protected  voidselectionChanged() - -
    -          Invoked when the selection in the list has changed.
    -private  voidswap(boolean up) - -
    -          Moves the currently selected item up or down.
    -(package private)  voidupPressed() - -
    -          Notifies that the Up button has been pressed.
    - - - - - - - -
    Methods inherited from class org.eclipse.jface.preference.ListEditor
    adjustForNumColumns, doFillIntoGrid, doLoad, doLoadDefault, doStore, getAddButton, getDownButton, getList, getNewInputObject, getNumberOfControls, getRemoveButton, getUpButton, setEnabled, setFocus
    - - - - - - - -
    Methods inherited from class org.eclipse.jface.preference.FieldEditor
    applyFont, checkParent, clearErrorMessage, clearMessage, convertHorizontalDLUsToPixels, convertVerticalDLUsToPixels, createControl, dispose, fillIntoGrid, fireStateChanged, fireValueChanged, getFieldEditorFontName, getLabelControl, getLabelControl, getLabelText, getPage, getPreferenceName, getPreferencePage, getPreferenceStore, init, isValid, load, loadDefault, presentsDefaultValue, refreshValidState, setButtonLayoutData, setLabelText, setPage, setPreferenceName, setPreferencePage, setPreferenceStore, setPresentsDefaultValue, setPropertyChangeListener, showErrorMessage, showMessage, store
    - - - - - - - -
    Methods inherited from class java.lang.Object
    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    -  -

    - - - - - - - - -
    -Field Detail
    - -

    -list

    -
    -org.eclipse.swt.widgets.List list
    -
    + Up, and Down button.
    + org.eclipse.swt.widgets.ListgetListControl(org.eclipse.swt.widgets.Composite parent) + +
    +          Returns this field editor's list control.
    +private  org.eclipse.swt.events.SelectionListenergetSelectionListener() + +
    +          Returns this field editor's selection listener.
    +protected  org.eclipse.swt.widgets.ShellgetShell() + +
    +          Returns this field editor's shell.
    +protected  java.lang.String[]parseString(java.lang.String stringList) + +
    +           
    +protected abstract  voidremovePressed() + +
    +          Notifies that the Remove button has been pressed.
    +protected  voidselectionChanged() + +
    +          Invoked when the selection in the list has changed.
    +private  voidswap(boolean up) + +
    +          Moves the currently selected item up or down.
    +(package private)  voidupPressed() + +
    +          Notifies that the Up button has been pressed.
    + + + + + + + +
    Methods inherited from class org.eclipse.jface.preference.ListEditor
    adjustForNumColumns, doFillIntoGrid, doLoad, doLoadDefault, doStore, getAddButton, getDownButton, getList, getNewInputObject, getNumberOfControls, getRemoveButton, getUpButton, setEnabled, setFocus
    + + + + + + + +
    Methods inherited from class org.eclipse.jface.preference.FieldEditor
    applyFont, checkParent, clearErrorMessage, clearMessage, convertHorizontalDLUsToPixels, convertVerticalDLUsToPixels, createControl, dispose, fillIntoGrid, fireStateChanged, fireValueChanged, getFieldEditorFontName, getLabelControl, getLabelControl, getLabelText, getPage, getPreferenceName, getPreferencePage, getPreferenceStore, init, isValid, load, loadDefault, presentsDefaultValue, refreshValidState, setButtonLayoutData, setLabelText, setPage, setPreferenceName, setPreferencePage, setPreferenceStore, setPresentsDefaultValue, setPropertyChangeListener, showErrorMessage, showMessage, store
    + + + + + + + +
    Methods inherited from class java.lang.Object
    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    +  +

    + + + + + + + + +
    +Field Detail
    + +

    +list

    +
    +org.eclipse.swt.widgets.List list
    +
    The list widget; null if none - (before creation or after disposal). -

    -

    -
    -
    -
    - -

    -buttonBox

    -
    -org.eclipse.swt.widgets.Composite buttonBox
    -
    + (before creation or after disposal). +

    +

    +
    +
    +
    + +

    +buttonBox

    +
    +org.eclipse.swt.widgets.Composite buttonBox
    +
    The button box containing the Add, Remove, Up, and Down buttons; - null if none (before creation or after disposal). -

    -

    -
    -
    -
    - -

    -addButton

    -
    -org.eclipse.swt.widgets.Button addButton
    -
    -
    The Add button. -

    -

    -
    -
    -
    - -

    -removeButton

    -
    -org.eclipse.swt.widgets.Button removeButton
    -
    -
    The Remove button. -

    -

    -
    -
    -
    - -

    -upButton

    -
    -org.eclipse.swt.widgets.Button upButton
    -
    -
    The Up button. -

    -

    -
    -
    -
    - -

    -downButton

    -
    -org.eclipse.swt.widgets.Button downButton
    -
    -
    The Down button. -

    -

    -
    -
    -
    - -

    -selectionListener

    -
    -private org.eclipse.swt.events.SelectionListener selectionListener
    -
    -
    The selection listener. -

    -

    -
    -
    - - - - - - - - -
    -Constructor Detail
    - -

    -LlvmListEditor

    -
    -protected LlvmListEditor(java.lang.String name,
    -                         java.lang.String labelText,
    -                         org.eclipse.swt.widgets.Composite parent)
    -
    -
    Creates a list field editor. -

    -

    -
    Parameters:
    name - the name of the preference this field editor works on
    labelText - the label text of the field editor
    parent - the parent of the field editor's control
    -
    - - - - - - - - -
    -Method Detail
    - -

    -createList

    -
    -protected java.lang.String createList(java.lang.String[] items)
    -
    -
    -
    Specified by:
    createList in class org.eclipse.jface.preference.ListEditor
    -
    -
    -
    -
    -
    -
    - -

    -parseString

    -
    -protected java.lang.String[] parseString(java.lang.String stringList)
    -
    -
    -
    Specified by:
    parseString in class org.eclipse.jface.preference.ListEditor
    -
    -
    -
    -
    -
    -
    - -

    -createButtons

    -
    -private void createButtons(org.eclipse.swt.widgets.Composite box)
    -
    -
    Creates the Add, Remove, Up, and Down button in the given button box. -

    -

    -
    Parameters:
    box - the box for the buttons
    -
    -
    -
    - -

    -createPushButton

    -
    -private org.eclipse.swt.widgets.Button createPushButton(org.eclipse.swt.widgets.Composite parent,
    -                                                        java.lang.String key)
    -
    -
    Helper method to create a push button. -

    -

    -
    Parameters:
    parent - the parent control
    key - the resource name used to supply the button's label text -
    Returns:
    Button
    -
    -
    -
    - -

    -createSelectionListener

    -
    -public void createSelectionListener()
    -
    -
    Creates a selection listener. -

    -

    -
    Overrides:
    createSelectionListener in class org.eclipse.jface.preference.ListEditor
    -
    -
    -
    -
    -
    -
    - -

    -getButtonBoxControl

    -
    -public org.eclipse.swt.widgets.Composite getButtonBoxControl(org.eclipse.swt.widgets.Composite parent)
    -
    + null if none (before creation or after disposal). +

    +

    +
    +
    +
    + +

    +addButton

    +
    +org.eclipse.swt.widgets.Button addButton
    +
    +
    The Add button. +

    +

    +
    +
    +
    + +

    +removeButton

    +
    +org.eclipse.swt.widgets.Button removeButton
    +
    +
    The Remove button. +

    +

    +
    +
    +
    + +

    +upButton

    +
    +org.eclipse.swt.widgets.Button upButton
    +
    +
    The Up button. +

    +

    +
    +
    +
    + +

    +downButton

    +
    +org.eclipse.swt.widgets.Button downButton
    +
    +
    The Down button. +

    +

    +
    +
    +
    + +

    +selectionListener

    +
    +private org.eclipse.swt.events.SelectionListener selectionListener
    +
    +
    The selection listener. +

    +

    +
    +
    + + + + + + + + +
    +Constructor Detail
    + +

    +LlvmListEditor

    +
    +protected LlvmListEditor(java.lang.String name,
    +                         java.lang.String labelText,
    +                         org.eclipse.swt.widgets.Composite parent)
    +
    +
    Creates a list field editor. +

    +

    +
    Parameters:
    name - the name of the preference this field editor works on
    labelText - the label text of the field editor
    parent - the parent of the field editor's control
    +
    + + + + + + + + +
    +Method Detail
    + +

    +createList

    +
    +protected java.lang.String createList(java.lang.String[] items)
    +
    +
    +
    Specified by:
    createList in class org.eclipse.jface.preference.ListEditor
    +
    +
    +
    +
    +
    +
    + +

    +parseString

    +
    +protected java.lang.String[] parseString(java.lang.String stringList)
    +
    +
    +
    Specified by:
    parseString in class org.eclipse.jface.preference.ListEditor
    +
    +
    +
    +
    +
    +
    + +

    +createButtons

    +
    +private void createButtons(org.eclipse.swt.widgets.Composite box)
    +
    +
    Creates the Add, Remove, Up, and Down button in the given button box. +

    +

    +
    Parameters:
    box - the box for the buttons
    +
    +
    +
    + +

    +createPushButton

    +
    +private org.eclipse.swt.widgets.Button createPushButton(org.eclipse.swt.widgets.Composite parent,
    +                                                        java.lang.String key)
    +
    +
    Helper method to create a push button. +

    +

    +
    Parameters:
    parent - the parent control
    key - the resource name used to supply the button's label text +
    Returns:
    Button
    +
    +
    +
    + +

    +createSelectionListener

    +
    +public void createSelectionListener()
    +
    +
    Creates a selection listener. +

    +

    +
    Overrides:
    createSelectionListener in class org.eclipse.jface.preference.ListEditor
    +
    +
    +
    +
    +
    +
    + +

    +getButtonBoxControl

    +
    +public org.eclipse.swt.widgets.Composite getButtonBoxControl(org.eclipse.swt.widgets.Composite parent)
    +
    Returns this field editor's button box containing the Add, Remove, - Up, and Down button. -

    -

    -
    Overrides:
    getButtonBoxControl in class org.eclipse.jface.preference.ListEditor
    -
    -
    -
    Parameters:
    parent - the parent control -
    Returns:
    the button box
    -
    -
    -
    - -

    -getListControl

    -
    -public org.eclipse.swt.widgets.List getListControl(org.eclipse.swt.widgets.Composite parent)
    -
    -
    Returns this field editor's list control. -

    -

    -
    Overrides:
    getListControl in class org.eclipse.jface.preference.ListEditor
    -
    -
    -
    Parameters:
    parent - the parent control -
    Returns:
    the list control
    -
    -
    -
    - -

    -getSelectionListener

    -
    -private org.eclipse.swt.events.SelectionListener getSelectionListener()
    -
    -
    Returns this field editor's selection listener. The listener is created if nessessary. -

    -

    - -
    Returns:
    the selection listener
    -
    -
    -
    - -

    -selectionChanged

    -
    -protected void selectionChanged()
    -
    + Up, and Down button. +

    +

    +
    Overrides:
    getButtonBoxControl in class org.eclipse.jface.preference.ListEditor
    +
    +
    +
    Parameters:
    parent - the parent control +
    Returns:
    the button box
    +
    +
    +
    + +

    +getListControl

    +
    +public org.eclipse.swt.widgets.List getListControl(org.eclipse.swt.widgets.Composite parent)
    +
    +
    Returns this field editor's list control. +

    +

    +
    Overrides:
    getListControl in class org.eclipse.jface.preference.ListEditor
    +
    +
    +
    Parameters:
    parent - the parent control +
    Returns:
    the list control
    +
    +
    +
    + +

    +getSelectionListener

    +
    +private org.eclipse.swt.events.SelectionListener getSelectionListener()
    +
    +
    Returns this field editor's selection listener. The listener is created if nessessary. +

    +

    + +
    Returns:
    the selection listener
    +
    +
    +
    + +

    +selectionChanged

    +
    +protected void selectionChanged()
    +
    Invoked when the selection in the list has changed.

    The default implementation of this method utilizes the selection index and the size of the list to toggle the enablement of the up, down and remove buttons. -

    -

    -

    -
    Overrides:
    selectionChanged in class org.eclipse.jface.preference.ListEditor
    -
    -
    -
    -
    -
    -
    - -

    -swap

    -
    -private void swap(boolean up)
    -
    -
    Moves the currently selected item up or down. -

    -

    +

    +

    +

    +
    Overrides:
    selectionChanged in class org.eclipse.jface.preference.ListEditor
    +
    +
    +
    +
    +
    +
    + +

    +swap

    +
    +private void swap(boolean up)
    +
    +
    Moves the currently selected item up or down. +

    +

    Parameters:
    up - true if the item should move up, - and false if it should move down
    -
    -
    -
    - -

    -getShell

    -
    -protected org.eclipse.swt.widgets.Shell getShell()
    -
    + and false if it should move down
    +
    +
    +
    + +

    +getShell

    +
    +protected org.eclipse.swt.widgets.Shell getShell()
    +
    Returns this field editor's shell.

    This method is internal to the framework; subclasses should not call this method. -

    -

    -

    -
    Overrides:
    getShell in class org.eclipse.jface.preference.ListEditor
    -
    -
    - -
    Returns:
    the shell
    -
    -
    -
    - -

    -addPressed

    -
    -void addPressed()
    -
    -
    Notifies that the Add button has been pressed. -

    -

    -
    -
    -
    -
    - -

    -removePressed

    -
    -protected abstract void removePressed()
    -
    -
    Notifies that the Remove button has been pressed. -

    -

    -
    -
    -
    -
    - -

    -upPressed

    -
    -void upPressed()
    -
    -
    Notifies that the Up button has been pressed. -

    -

    -
    -
    -
    -
    - -

    -downPressed

    -
    -void downPressed()
    -
    -
    Notifies that the Down button has been pressed. -

    -

    -
    -
    -
    - -
    - - - - - - - - - - - - - - - - - - - -
    - -
    - - - -
    - - - +

    +

    +

    +
    Overrides:
    getShell in class org.eclipse.jface.preference.ListEditor
    +
    +
    + +
    Returns:
    the shell
    +
    + +
    + +

    +addPressed

    +
    +void addPressed()
    +
    +
    Notifies that the Add button has been pressed. +

    +

    +
    +
    +
    +
    + +

    +removePressed

    +
    +protected abstract void removePressed()
    +
    +
    Notifies that the Remove button has been pressed. +

    +

    +
    +
    +
    +
    + +

    +upPressed

    +
    +void upPressed()
    +
    +
    Notifies that the Up button has been pressed. +

    +

    +
    +
    +
    +
    + +

    +downPressed

    +
    +void downPressed()
    +
    +
    Notifies that the Down button has been pressed. +

    +

    +
    +
    +
    + +
    + + + + + + + + + + + + + + + + + + + +
    + +
    + + + +
    + + + diff --git a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/ui/preferences/LlvmPreferencePage.html b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/ui/preferences/LlvmPreferencePage.html index 975de64e55a..70b446a5b5e 100644 --- a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/ui/preferences/LlvmPreferencePage.html +++ b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/ui/preferences/LlvmPreferencePage.html @@ -1,112 +1,112 @@ - - - - - - -LlvmPreferencePage - - - - - - - - - - - - -
    - - - - - - - - - - - - - - - - - - - -
    - -
    - - - -
    - -

    - -org.eclipse.cdt.managedbuilder.llvm.ui.preferences -
    -Class LlvmPreferencePage

    -
    -java.lang.Object
    -  extended by org.eclipse.jface.dialogs.DialogPage
    -      extended by org.eclipse.jface.preference.PreferencePage
    -          extended by org.eclipse.jface.preference.FieldEditorPreferencePage
    -              extended by org.eclipse.cdt.managedbuilder.llvm.ui.preferences.LlvmPreferencePage
    -
    -
    -
    All Implemented Interfaces:
    java.util.EventListener, org.eclipse.jface.dialogs.IDialogPage, org.eclipse.jface.dialogs.IMessageProvider, org.eclipse.jface.preference.IPreferencePage, org.eclipse.jface.util.IPropertyChangeListener, org.eclipse.ui.IWorkbenchPreferencePage
    -
    -
    -
    -
    public class LlvmPreferencePage
    extends org.eclipse.jface.preference.FieldEditorPreferencePage
    implements org.eclipse.ui.IWorkbenchPreferencePage
    - - -

    + + + + + + +LlvmPreferencePage + + + + + + + + + + + + +


    + + + + + + + + + + + + + + + + + + + +
    + +
    + + + +
    + +

    + +org.eclipse.cdt.managedbuilder.llvm.ui.preferences +
    +Class LlvmPreferencePage

    +
    +java.lang.Object
    +  extended by org.eclipse.jface.dialogs.DialogPage
    +      extended by org.eclipse.jface.preference.PreferencePage
    +          extended by org.eclipse.jface.preference.FieldEditorPreferencePage
    +              extended by org.eclipse.cdt.managedbuilder.llvm.ui.preferences.LlvmPreferencePage
    +
    +
    +
    All Implemented Interfaces:
    java.util.EventListener, org.eclipse.jface.dialogs.IDialogPage, org.eclipse.jface.dialogs.IMessageProvider, org.eclipse.jface.preference.IPreferencePage, org.eclipse.jface.util.IPropertyChangeListener, org.eclipse.ui.IWorkbenchPreferencePage
    +
    +
    +
    +
    public class LlvmPreferencePage
    extends org.eclipse.jface.preference.FieldEditorPreferencePage
    implements org.eclipse.ui.IWorkbenchPreferencePage
    + + +

    This class represents a preference page that is contributed to the Preferences dialog. By subclassing FieldEditorPreferencePage, we @@ -120,278 +120,278 @@ This class represents a preference page that be accessed directly via the preference store. TODO: When creating a new project with LLVM, automatically get values - from PreferencePage to Paths & Symbols. -

    - -

    -


    - -

    - - - - - - - -
    -Field Summary
    - - - - - - - -
    Fields inherited from class org.eclipse.jface.preference.FieldEditorPreferencePage
    FLAT, GRID, MARGIN_HEIGHT, MARGIN_WIDTH, VERTICAL_SPACING
    - - - - - - - -
    Fields inherited from interface org.eclipse.jface.dialogs.IMessageProvider
    ERROR, INFORMATION, NONE, WARNING
    -  - - - - - - - - - - -
    -Constructor Summary
    LlvmPreferencePage() - -
    -          Constructor.
    -  - - - - - - - - - - - - - - - - - - - -
    -Method Summary
    -protected  voidcreateFieldEditors() - -
    -           
    - java.lang.StringgetDescription() - -
    -           
    - voidinit(org.eclipse.ui.IWorkbench workbench) - -
    -           
    - - - - - - - -
    Methods inherited from class org.eclipse.jface.preference.FieldEditorPreferencePage
    addField, adjustGridLayout, applyFont, checkState, createContents, dispose, getFieldEditorParent, initialize, performDefaults, performOk, propertyChange, setVisible
    - - - - - - - -
    Methods inherited from class org.eclipse.jface.preference.PreferencePage
    applyData, applyDialogFont, computeSize, contributeButtons, createControl, createDescriptionLabel, createNoteComposite, doComputeSize, doGetPreferenceStore, getApplyButton, getContainer, getDefaultsButton, getPreferenceStore, isValid, noDefaultAndApplyButton, okToLeave, performApply, performCancel, performHelp, setContainer, setErrorMessage, setMessage, setPreferenceStore, setSize, setTitle, setValid, toString, updateApplyButton
    - - - - - - - -
    Methods inherited from class org.eclipse.jface.dialogs.DialogPage
    convertHeightInCharsToPixels, convertHorizontalDLUsToPixels, convertVerticalDLUsToPixels, convertWidthInCharsToPixels, getControl, getDialogFontName, getErrorMessage, getFont, getImage, getMessage, getMessageType, getShell, getTitle, getToolTipText, initializeDialogUnits, isControlCreated, setButtonLayoutData, setControl, setDescription, setImageDescriptor, setMessage
    - - - - - - - -
    Methods inherited from class java.lang.Object
    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    - - - - - - - -
    Methods inherited from interface org.eclipse.jface.preference.IPreferencePage
    computeSize, isValid, okToLeave, performCancel, performOk, setContainer, setSize
    - - - - - - - -
    Methods inherited from interface org.eclipse.jface.dialogs.IDialogPage
    createControl, dispose, getControl, getErrorMessage, getImage, getMessage, getTitle, performHelp, setDescription, setImageDescriptor, setTitle, setVisible
    -  -

    - - - - - - - - -
    -Constructor Detail
    - -

    -LlvmPreferencePage

    -
    -public LlvmPreferencePage()
    -
    + from PreferencePage to Paths & Symbols. +

    + +

    +


    + +

    + + + + + + + +
    +Field Summary
    + + + + + + + +
    Fields inherited from class org.eclipse.jface.preference.FieldEditorPreferencePage
    FLAT, GRID, MARGIN_HEIGHT, MARGIN_WIDTH, VERTICAL_SPACING
    + + + + + + + +
    Fields inherited from interface org.eclipse.jface.dialogs.IMessageProvider
    ERROR, INFORMATION, NONE, WARNING
    +  + + + + + + + + + + +
    +Constructor Summary
    LlvmPreferencePage() + +
    +          Constructor.
    +  + + + + + + + + + + + + + + + + + + + +
    +Method Summary
    +protected  voidcreateFieldEditors() + +
    +           
    + java.lang.StringgetDescription() + +
    +           
    + voidinit(org.eclipse.ui.IWorkbench workbench) + +
    +           
    + + + + + + + +
    Methods inherited from class org.eclipse.jface.preference.FieldEditorPreferencePage
    addField, adjustGridLayout, applyFont, checkState, createContents, dispose, getFieldEditorParent, initialize, performDefaults, performOk, propertyChange, setVisible
    + + + + + + + +
    Methods inherited from class org.eclipse.jface.preference.PreferencePage
    applyData, applyDialogFont, computeSize, contributeButtons, createControl, createDescriptionLabel, createNoteComposite, doComputeSize, doGetPreferenceStore, getApplyButton, getContainer, getDefaultsButton, getPreferenceStore, isValid, noDefaultAndApplyButton, okToLeave, performApply, performCancel, performHelp, setContainer, setErrorMessage, setMessage, setPreferenceStore, setSize, setTitle, setValid, toString, updateApplyButton
    + + + + + + + +
    Methods inherited from class org.eclipse.jface.dialogs.DialogPage
    convertHeightInCharsToPixels, convertHorizontalDLUsToPixels, convertVerticalDLUsToPixels, convertWidthInCharsToPixels, getControl, getDialogFontName, getErrorMessage, getFont, getImage, getMessage, getMessageType, getShell, getTitle, getToolTipText, initializeDialogUnits, isControlCreated, setButtonLayoutData, setControl, setDescription, setImageDescriptor, setMessage
    + + + + + + + +
    Methods inherited from class java.lang.Object
    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    + + + + + + + +
    Methods inherited from interface org.eclipse.jface.preference.IPreferencePage
    computeSize, isValid, okToLeave, performCancel, performOk, setContainer, setSize
    + + + + + + + +
    Methods inherited from interface org.eclipse.jface.dialogs.IDialogPage
    createControl, dispose, getControl, getErrorMessage, getImage, getMessage, getTitle, performHelp, setDescription, setImageDescriptor, setTitle, setVisible
    +  +

    + + + + + + + + +
    +Constructor Detail
    + +

    +LlvmPreferencePage

    +
    +public LlvmPreferencePage()
    +
    Constructor. - Sets a preference store to use the LLVM preference store. -

    -

    - - - - - - - - -
    -Method Detail
    - -

    -init

    -
    -public void init(org.eclipse.ui.IWorkbench workbench)
    -
    -
    -
    Specified by:
    init in interface org.eclipse.ui.IWorkbenchPreferencePage
    -
    -
    -
    -
    -
    -
    - -

    -getDescription

    -
    -public java.lang.String getDescription()
    -
    -
    -
    Specified by:
    getDescription in interface org.eclipse.jface.dialogs.IDialogPage
    Overrides:
    getDescription in class org.eclipse.jface.dialogs.DialogPage
    -
    -
    -
    -
    -
    -
    - -

    -createFieldEditors

    -
    -protected void createFieldEditors()
    -
    -
    -
    Specified by:
    createFieldEditors in class org.eclipse.jface.preference.FieldEditorPreferencePage
    -
    -
    -
    -
    -
    - -
    - - - - - - - - - - - - - - - - - - - -
    - -
    - - - -
    - - - + Sets a preference store to use the LLVM preference store. +

    +

    + + + + + + + + +
    +Method Detail
    + +

    +init

    +
    +public void init(org.eclipse.ui.IWorkbench workbench)
    +
    +
    +
    Specified by:
    init in interface org.eclipse.ui.IWorkbenchPreferencePage
    +
    +
    +
    +
    +
    +
    + +

    +getDescription

    +
    +public java.lang.String getDescription()
    +
    +
    +
    Specified by:
    getDescription in interface org.eclipse.jface.dialogs.IDialogPage
    Overrides:
    getDescription in class org.eclipse.jface.dialogs.DialogPage
    +
    +
    +
    +
    +
    +
    + +

    +createFieldEditors

    +
    +protected void createFieldEditors()
    +
    +
    +
    Specified by:
    createFieldEditors in class org.eclipse.jface.preference.FieldEditorPreferencePage
    +
    +
    +
    +
    +
    + +
    + + + + + + + + + + + + + + + + + + + +
    + +
    + + + +
    + + + diff --git a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/ui/preferences/LlvmPreferenceStore.html b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/ui/preferences/LlvmPreferenceStore.html index 398875aa996..bb6fd537622 100644 --- a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/ui/preferences/LlvmPreferenceStore.html +++ b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/ui/preferences/LlvmPreferenceStore.html @@ -1,696 +1,696 @@ - - - - - - -LlvmPreferenceStore - - - - - - - - - - - - -
    - - - - - - - - - - - - - - - - - - - -
    - -
    - - - -
    - -

    - -org.eclipse.cdt.managedbuilder.llvm.ui.preferences -
    -Class LlvmPreferenceStore

    -
    -java.lang.Object
    -  extended by org.eclipse.cdt.managedbuilder.llvm.ui.preferences.LlvmPreferenceStore
    -
    -
    -
    -
    public class LlvmPreferenceStore
    extends java.lang.Object
    - - -

    + + + + + + +LlvmPreferenceStore + + + + + + + + + + + + +


    + + + + + + + + + + + + + + + + + + + +
    + +
    + + + +
    + +

    + +org.eclipse.cdt.managedbuilder.llvm.ui.preferences +
    +Class LlvmPreferenceStore

    +
    +java.lang.Object
    +  extended by org.eclipse.cdt.managedbuilder.llvm.ui.preferences.LlvmPreferenceStore
    +
    +
    +
    +
    public class LlvmPreferenceStore
    extends java.lang.Object
    + + +

    Class used to access the LLVM Preference store values. - This class is not intended to be subclassed by clients. -

    - -

    -


    - -

    - - - - - - - - - - - -
    -Constructor Summary
    LlvmPreferenceStore() - -
    -           
    -  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -Method Summary
    -static voidappendIncludePath(java.lang.String path) - -
    -          Append an include path to the LLVM Preference store.
    -static voidappendLibrary(java.lang.String lib) - -
    -          Append a library to the LLVM Preference store.
    -static voidappendLibraryPath(java.lang.String path) - -
    -          Append a library path to the LLVM Preference store.
    -static voidappendValue(java.lang.String name, - java.lang.String value) - -
    -          Append a new value to the Preference store if it doesn't already exists.
    -static java.lang.StringgetBinPath() - -
    -          Get the LLVM bin path value from the LLVM Preference store.
    -private static java.lang.StringgetExistingPaths(java.lang.String name) - -
    -          Get existing paths from the Preference store.
    -static java.lang.StringgetIncludePath() - -
    -          Get the LLVM include path value from the LLVM Preference store.
    -static java.lang.StringgetLibraries() - -
    -          Get the LLVM library from the LLVM Preference store.
    -static java.lang.StringgetLibraryPath() - -
    -          Get the LLVM library path value from the LLVM Preference Store.
    -static org.eclipse.core.runtime.preferences.IEclipsePreferencesgetPreferenceStore() - -
    -          Get the LLVM Preference store.
    -static java.lang.StringgetPreferenceStoreValue(java.lang.String name) - -
    -          Get a value from the LLVM Preference store.
    -static java.lang.String[]getPreferenceStoreValueAsArray(java.lang.String name) - -
    -          Get values from the LLVM Preference store as a String array.
    -static voidremoveIncludePath(java.lang.String path) - -
    -          Remove a include path from the LLVM preference store.
    -static voidremoveLibrary(java.lang.String lib) - -
    -          Remove a library from the LLVM preference store.
    -static voidremoveLibraryPath(java.lang.String path) - -
    -          Remove a library path from the LLVM preference store.
    -static voidremoveValue(java.lang.String name, - java.lang.String value) - -
    -          Remove a value from the LLVM preference store.
    -static voidsetBinPath(java.lang.String path) - -
    -          Set LLVM bin path to the LLVM Preference store.
    -static voidsetIncludePath(java.lang.String path) - -
    -          Set LLVM include path to the LLVM Preference store.
    -static voidsetLibrary(java.lang.String lib) - -
    -          Set LLVM library to the LLVM Preference store.
    -static voidsetLibraryPath(java.lang.String path) - -
    -          Set LLVM library path to the LLVM Preference store.
    -static voidsetPreferenceStoreValue(java.lang.String name, - java.lang.String value) - -
    -          Set LLVM Preference store value.
    - - - - - - - -
    Methods inherited from class java.lang.Object
    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    -  -

    - - - - - - - - -
    -Constructor Detail
    - -

    -LlvmPreferenceStore

    -
    -public LlvmPreferenceStore()
    -
    -
    - - - - - - - - -
    -Method Detail
    - -

    -getPreferenceStore

    -
    -public static org.eclipse.core.runtime.preferences.IEclipsePreferences getPreferenceStore()
    -
    -
    Get the LLVM Preference store. -

    -

    - -
    Returns:
    LLVM Preference store.
    -
    -
    -
    - -

    -getPreferenceStoreValue

    -
    -public static java.lang.String getPreferenceStoreValue(java.lang.String name)
    -
    -
    Get a value from the LLVM Preference store. -

    -

    -
    Parameters:
    name - the name of the preference -
    Returns:
    the string-valued preference
    -
    -
    -
    - -

    -getBinPath

    -
    -public static java.lang.String getBinPath()
    -
    -
    Get the LLVM bin path value from the LLVM Preference store. -

    -

    - -
    Returns:
    the LLVM bin path value.
    -
    -
    -
    - -

    -getIncludePath

    -
    -public static java.lang.String getIncludePath()
    -
    -
    Get the LLVM include path value from the LLVM Preference store. -

    -

    - -
    Returns:
    the LLVM include path value.
    -
    -
    -
    - -

    -getLibraryPath

    -
    -public static java.lang.String getLibraryPath()
    -
    -
    Get the LLVM library path value from the LLVM Preference Store. -

    -

    - -
    Returns:
    the LLVM library path value.
    -
    -
    -
    - -

    -getLibraries

    -
    -public static java.lang.String getLibraries()
    -
    -
    Get the LLVM library from the LLVM Preference store. -

    -

    - -
    Returns:
    the LLVM library value.
    -
    -
    -
    - -

    -getPreferenceStoreValueAsArray

    -
    -public static java.lang.String[] getPreferenceStoreValueAsArray(java.lang.String name)
    -
    + This class is not intended to be subclassed by clients. +

    + +

    +


    + +

    + + + + + + + + + + + +
    +Constructor Summary
    LlvmPreferenceStore() + +
    +           
    +  + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +Method Summary
    +static voidappendIncludePath(java.lang.String path) + +
    +          Append an include path to the LLVM Preference store.
    +static voidappendLibrary(java.lang.String lib) + +
    +          Append a library to the LLVM Preference store.
    +static voidappendLibraryPath(java.lang.String path) + +
    +          Append a library path to the LLVM Preference store.
    +static voidappendValue(java.lang.String name, + java.lang.String value) + +
    +          Append a new value to the Preference store if it doesn't already exists.
    +static java.lang.StringgetBinPath() + +
    +          Get the LLVM bin path value from the LLVM Preference store.
    +private static java.lang.StringgetExistingPaths(java.lang.String name) + +
    +          Get existing paths from the Preference store.
    +static java.lang.StringgetIncludePath() + +
    +          Get the LLVM include path value from the LLVM Preference store.
    +static java.lang.StringgetLibraries() + +
    +          Get the LLVM library from the LLVM Preference store.
    +static java.lang.StringgetLibraryPath() + +
    +          Get the LLVM library path value from the LLVM Preference Store.
    +static org.eclipse.core.runtime.preferences.IEclipsePreferencesgetPreferenceStore() + +
    +          Get the LLVM Preference store.
    +static java.lang.StringgetPreferenceStoreValue(java.lang.String name) + +
    +          Get a value from the LLVM Preference store.
    +static java.lang.String[]getPreferenceStoreValueAsArray(java.lang.String name) + +
    +          Get values from the LLVM Preference store as a String array.
    +static voidremoveIncludePath(java.lang.String path) + +
    +          Remove a include path from the LLVM preference store.
    +static voidremoveLibrary(java.lang.String lib) + +
    +          Remove a library from the LLVM preference store.
    +static voidremoveLibraryPath(java.lang.String path) + +
    +          Remove a library path from the LLVM preference store.
    +static voidremoveValue(java.lang.String name, + java.lang.String value) + +
    +          Remove a value from the LLVM preference store.
    +static voidsetBinPath(java.lang.String path) + +
    +          Set LLVM bin path to the LLVM Preference store.
    +static voidsetIncludePath(java.lang.String path) + +
    +          Set LLVM include path to the LLVM Preference store.
    +static voidsetLibrary(java.lang.String lib) + +
    +          Set LLVM library to the LLVM Preference store.
    +static voidsetLibraryPath(java.lang.String path) + +
    +          Set LLVM library path to the LLVM Preference store.
    +static voidsetPreferenceStoreValue(java.lang.String name, + java.lang.String value) + +
    +          Set LLVM Preference store value.
    + + + + + + + +
    Methods inherited from class java.lang.Object
    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    +  +

    + + + + + + + + +
    +Constructor Detail
    + +

    +LlvmPreferenceStore

    +
    +public LlvmPreferenceStore()
    +
    +
    + + + + + + + + +
    +Method Detail
    + +

    +getPreferenceStore

    +
    +public static org.eclipse.core.runtime.preferences.IEclipsePreferences getPreferenceStore()
    +
    +
    Get the LLVM Preference store. +

    +

    + +
    Returns:
    LLVM Preference store.
    +
    +
    +
    + +

    +getPreferenceStoreValue

    +
    +public static java.lang.String getPreferenceStoreValue(java.lang.String name)
    +
    +
    Get a value from the LLVM Preference store. +

    +

    +
    Parameters:
    name - the name of the preference +
    Returns:
    the string-valued preference
    +
    +
    +
    + +

    +getBinPath

    +
    +public static java.lang.String getBinPath()
    +
    +
    Get the LLVM bin path value from the LLVM Preference store. +

    +

    + +
    Returns:
    the LLVM bin path value.
    +
    +
    +
    + +

    +getIncludePath

    +
    +public static java.lang.String getIncludePath()
    +
    +
    Get the LLVM include path value from the LLVM Preference store. +

    +

    + +
    Returns:
    the LLVM include path value.
    +
    +
    +
    + +

    +getLibraryPath

    +
    +public static java.lang.String getLibraryPath()
    +
    +
    Get the LLVM library path value from the LLVM Preference Store. +

    +

    + +
    Returns:
    the LLVM library path value.
    +
    +
    +
    + +

    +getLibraries

    +
    +public static java.lang.String getLibraries()
    +
    +
    Get the LLVM library from the LLVM Preference store. +

    +

    + +
    Returns:
    the LLVM library value.
    +
    +
    +
    + +

    +getPreferenceStoreValueAsArray

    +
    +public static java.lang.String[] getPreferenceStoreValueAsArray(java.lang.String name)
    +
    Get values from the LLVM Preference store as a String array. Used to get Preference store values which consist of multiple paths - separated by a path separator. -

    -

    -
    Parameters:
    name - the name of the preference -
    Returns:
    A String array containing all Preference store values
    -
    -
    -
    - -

    -setPreferenceStoreValue

    -
    -public static void setPreferenceStoreValue(java.lang.String name,
    -                                           java.lang.String value)
    -
    -
    Set LLVM Preference store value. -

    -

    -
    Parameters:
    name - the name of the preference
    value - the string-valued preference
    -
    -
    -
    - -

    -setBinPath

    -
    -public static void setBinPath(java.lang.String path)
    -
    -
    Set LLVM bin path to the LLVM Preference store. -

    -

    -
    Parameters:
    path - the path to the LLVM bin path.
    -
    -
    -
    - -

    -setIncludePath

    -
    -public static void setIncludePath(java.lang.String path)
    -
    -
    Set LLVM include path to the LLVM Preference store. -

    -

    -
    Parameters:
    path - LLVM include path.
    -
    -
    -
    - -

    -setLibraryPath

    -
    -public static void setLibraryPath(java.lang.String path)
    -
    -
    Set LLVM library path to the LLVM Preference store. -

    -

    -
    Parameters:
    path - LLVM library path.
    -
    -
    -
    - -

    -setLibrary

    -
    -public static void setLibrary(java.lang.String lib)
    -
    -
    Set LLVM library to the LLVM Preference store. -

    -

    -
    Parameters:
    lib - LLVM library.
    -
    -
    -
    - -

    -getExistingPaths

    -
    -private static java.lang.String getExistingPaths(java.lang.String name)
    -
    -
    Get existing paths from the Preference store. -

    -

    -
    Parameters:
    name - the name of the preference -
    Returns:
    paths
    -
    -
    -
    - -

    -appendValue

    -
    -public static void appendValue(java.lang.String name,
    -                               java.lang.String value)
    -
    -
    Append a new value to the Preference store if it doesn't already exists. -

    -

    -
    Parameters:
    name - the name of the preference
    value - the string-valued preference
    -
    -
    -
    - -

    -appendIncludePath

    -
    -public static void appendIncludePath(java.lang.String path)
    -
    -
    Append an include path to the LLVM Preference store. -

    -

    -
    Parameters:
    path - the LLVM include path.
    -
    -
    -
    - -

    -appendLibraryPath

    -
    -public static void appendLibraryPath(java.lang.String path)
    -
    -
    Append a library path to the LLVM Preference store. -

    -

    -
    Parameters:
    path - the LLVM library path.
    -
    -
    -
    - -

    -appendLibrary

    -
    -public static void appendLibrary(java.lang.String lib)
    -
    -
    Append a library to the LLVM Preference store. -

    -

    -
    Parameters:
    lib - the LLVM library.
    -
    -
    -
    - -

    -removeValue

    -
    -public static void removeValue(java.lang.String name,
    -                               java.lang.String value)
    -
    -
    Remove a value from the LLVM preference store. -

    -

    -
    Parameters:
    name - Name of the preference
    value - Value to remove from the preference store
    -
    -
    -
    - -

    -removeIncludePath

    -
    -public static void removeIncludePath(java.lang.String path)
    -
    -
    Remove a include path from the LLVM preference store. -

    -

    -
    Parameters:
    path - The include path to be removed from the LLVM preference store.
    -
    -
    -
    - -

    -removeLibraryPath

    -
    -public static void removeLibraryPath(java.lang.String path)
    -
    -
    Remove a library path from the LLVM preference store. -

    -

    -
    Parameters:
    path - The library path to be removed from the LLVM preference store.
    -
    -
    -
    - -

    -removeLibrary

    -
    -public static void removeLibrary(java.lang.String lib)
    -
    -
    Remove a library from the LLVM preference store. -

    -

    -
    Parameters:
    lib - The library to be removed from the LLVM preference store.
    -
    -
    - -
    - - - - - - - - - - - - - - - - - - - -
    - -
    - - - -
    - - - + separated by a path separator. +

    +

    +
    Parameters:
    name - the name of the preference +
    Returns:
    A String array containing all Preference store values
    +
    +
    +
    + +

    +setPreferenceStoreValue

    +
    +public static void setPreferenceStoreValue(java.lang.String name,
    +                                           java.lang.String value)
    +
    +
    Set LLVM Preference store value. +

    +

    +
    Parameters:
    name - the name of the preference
    value - the string-valued preference
    +
    +
    +
    + +

    +setBinPath

    +
    +public static void setBinPath(java.lang.String path)
    +
    +
    Set LLVM bin path to the LLVM Preference store. +

    +

    +
    Parameters:
    path - the path to the LLVM bin path.
    +
    +
    +
    + +

    +setIncludePath

    +
    +public static void setIncludePath(java.lang.String path)
    +
    +
    Set LLVM include path to the LLVM Preference store. +

    +

    +
    Parameters:
    path - LLVM include path.
    +
    +
    +
    + +

    +setLibraryPath

    +
    +public static void setLibraryPath(java.lang.String path)
    +
    +
    Set LLVM library path to the LLVM Preference store. +

    +

    +
    Parameters:
    path - LLVM library path.
    +
    +
    +
    + +

    +setLibrary

    +
    +public static void setLibrary(java.lang.String lib)
    +
    +
    Set LLVM library to the LLVM Preference store. +

    +

    +
    Parameters:
    lib - LLVM library.
    +
    +
    +
    + +

    +getExistingPaths

    +
    +private static java.lang.String getExistingPaths(java.lang.String name)
    +
    +
    Get existing paths from the Preference store. +

    +

    +
    Parameters:
    name - the name of the preference +
    Returns:
    paths
    +
    +
    +
    + +

    +appendValue

    +
    +public static void appendValue(java.lang.String name,
    +                               java.lang.String value)
    +
    +
    Append a new value to the Preference store if it doesn't already exists. +

    +

    +
    Parameters:
    name - the name of the preference
    value - the string-valued preference
    +
    +
    +
    + +

    +appendIncludePath

    +
    +public static void appendIncludePath(java.lang.String path)
    +
    +
    Append an include path to the LLVM Preference store. +

    +

    +
    Parameters:
    path - the LLVM include path.
    +
    +
    +
    + +

    +appendLibraryPath

    +
    +public static void appendLibraryPath(java.lang.String path)
    +
    +
    Append a library path to the LLVM Preference store. +

    +

    +
    Parameters:
    path - the LLVM library path.
    +
    +
    +
    + +

    +appendLibrary

    +
    +public static void appendLibrary(java.lang.String lib)
    +
    +
    Append a library to the LLVM Preference store. +

    +

    +
    Parameters:
    lib - the LLVM library.
    +
    +
    +
    + +

    +removeValue

    +
    +public static void removeValue(java.lang.String name,
    +                               java.lang.String value)
    +
    +
    Remove a value from the LLVM preference store. +

    +

    +
    Parameters:
    name - Name of the preference
    value - Value to remove from the preference store
    +
    +
    +
    + +

    +removeIncludePath

    +
    +public static void removeIncludePath(java.lang.String path)
    +
    +
    Remove a include path from the LLVM preference store. +

    +

    +
    Parameters:
    path - The include path to be removed from the LLVM preference store.
    +
    +
    +
    + +

    +removeLibraryPath

    +
    +public static void removeLibraryPath(java.lang.String path)
    +
    +
    Remove a library path from the LLVM preference store. +

    +

    +
    Parameters:
    path - The library path to be removed from the LLVM preference store.
    +
    +
    +
    + +

    +removeLibrary

    +
    +public static void removeLibrary(java.lang.String lib)
    +
    +
    Remove a library from the LLVM preference store. +

    +

    +
    Parameters:
    lib - The library to be removed from the LLVM preference store.
    +
    +
    + +
    + + + + + + + + + + + + + + + + + + + +
    + +
    + + + +
    + + + diff --git a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/ui/preferences/Messages.html b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/ui/preferences/Messages.html index 101231e83bb..8fd5f43ffe8 100644 --- a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/ui/preferences/Messages.html +++ b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/ui/preferences/Messages.html @@ -1,452 +1,452 @@ - - - - - - -Messages - - - - - - - - - - - - -
    - - - - - - - - - - - - - - - - - - - -
    - -
    - - - -
    - -

    - -org.eclipse.cdt.managedbuilder.llvm.ui.preferences -
    -Class Messages

    -
    -java.lang.Object
    -  extended by org.eclipse.osgi.util.NLS
    -      extended by org.eclipse.cdt.managedbuilder.llvm.ui.preferences.Messages
    -
    -
    -
    -
    public class Messages
    extends org.eclipse.osgi.util.NLS
    - - -

    -


    - -

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -Field Summary
    -private static java.lang.StringBUNDLE_NAME - -
    -           
    -static java.lang.StringIncludePathListEditor_0 - -
    -           
    -static java.lang.StringIncludePathListEditor_1 - -
    -           
    -static java.lang.StringLibraryListEditor_0 - -
    -           
    -static java.lang.StringLibraryPathListEditor_0 - -
    -           
    -static java.lang.StringLibraryPathListEditor_1 - -
    -           
    -static java.lang.StringLlvmPreferencePage_0 - -
    -           
    -static java.lang.StringLlvmPreferencePage_1 - -
    -           
    -static java.lang.StringLlvmPreferencePage_2 - -
    -           
    -static java.lang.StringLlvmPreferencePage_3 - -
    -           
    -static java.lang.StringLlvmPreferencePage_4 - -
    -           
    -  - - - - - - - - - - - -
    -Constructor Summary
    -private Messages() - -
    -           
    -  - - - - - - - -
    -Method Summary
    - - - - - - - -
    Methods inherited from class org.eclipse.osgi.util.NLS
    bind, bind, bind, initializeMessages
    - - - - - - - -
    Methods inherited from class java.lang.Object
    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    -  -

    - - - - - - - - -
    -Field Detail
    - -

    -BUNDLE_NAME

    -
    -private static final java.lang.String BUNDLE_NAME
    -
    -
    -
    See Also:
    Constant Field Values
    -
    -
    - -

    -IncludePathListEditor_0

    -
    -public static java.lang.String IncludePathListEditor_0
    -
    -
    -
    -
    -
    - -

    -IncludePathListEditor_1

    -
    -public static java.lang.String IncludePathListEditor_1
    -
    -
    -
    -
    -
    - -

    -LibraryListEditor_0

    -
    -public static java.lang.String LibraryListEditor_0
    -
    -
    -
    -
    -
    - -

    -LibraryPathListEditor_0

    -
    -public static java.lang.String LibraryPathListEditor_0
    -
    -
    -
    -
    -
    - -

    -LibraryPathListEditor_1

    -
    -public static java.lang.String LibraryPathListEditor_1
    -
    -
    -
    -
    -
    - -

    -LlvmPreferencePage_0

    -
    -public static java.lang.String LlvmPreferencePage_0
    -
    -
    -
    -
    -
    - -

    -LlvmPreferencePage_1

    -
    -public static java.lang.String LlvmPreferencePage_1
    -
    -
    -
    -
    -
    - -

    -LlvmPreferencePage_2

    -
    -public static java.lang.String LlvmPreferencePage_2
    -
    -
    -
    -
    -
    - -

    -LlvmPreferencePage_3

    -
    -public static java.lang.String LlvmPreferencePage_3
    -
    -
    -
    -
    -
    - -

    -LlvmPreferencePage_4

    -
    -public static java.lang.String LlvmPreferencePage_4
    -
    -
    -
    -
    - - - - - - - - -
    -Constructor Detail
    - -

    -Messages

    -
    -private Messages()
    -
    -
    - -
    - - - - - - - - - - - - - - - - - - - -
    - -
    - - - -
    - - - + + + + + + +Messages + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + + + + + +
    + +
    + + + +
    + +

    + +org.eclipse.cdt.managedbuilder.llvm.ui.preferences +
    +Class Messages

    +
    +java.lang.Object
    +  extended by org.eclipse.osgi.util.NLS
    +      extended by org.eclipse.cdt.managedbuilder.llvm.ui.preferences.Messages
    +
    +
    +
    +
    public class Messages
    extends org.eclipse.osgi.util.NLS
    + + +

    +


    + +

    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +Field Summary
    +private static java.lang.StringBUNDLE_NAME + +
    +           
    +static java.lang.StringIncludePathListEditor_0 + +
    +           
    +static java.lang.StringIncludePathListEditor_1 + +
    +           
    +static java.lang.StringLibraryListEditor_0 + +
    +           
    +static java.lang.StringLibraryPathListEditor_0 + +
    +           
    +static java.lang.StringLibraryPathListEditor_1 + +
    +           
    +static java.lang.StringLlvmPreferencePage_0 + +
    +           
    +static java.lang.StringLlvmPreferencePage_1 + +
    +           
    +static java.lang.StringLlvmPreferencePage_2 + +
    +           
    +static java.lang.StringLlvmPreferencePage_3 + +
    +           
    +static java.lang.StringLlvmPreferencePage_4 + +
    +           
    +  + + + + + + + + + + + +
    +Constructor Summary
    +private Messages() + +
    +           
    +  + + + + + + + +
    +Method Summary
    + + + + + + + +
    Methods inherited from class org.eclipse.osgi.util.NLS
    bind, bind, bind, initializeMessages
    + + + + + + + +
    Methods inherited from class java.lang.Object
    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    +  +

    + + + + + + + + +
    +Field Detail
    + +

    +BUNDLE_NAME

    +
    +private static final java.lang.String BUNDLE_NAME
    +
    +
    +
    See Also:
    Constant Field Values
    +
    +
    + +

    +IncludePathListEditor_0

    +
    +public static java.lang.String IncludePathListEditor_0
    +
    +
    +
    +
    +
    + +

    +IncludePathListEditor_1

    +
    +public static java.lang.String IncludePathListEditor_1
    +
    +
    +
    +
    +
    + +

    +LibraryListEditor_0

    +
    +public static java.lang.String LibraryListEditor_0
    +
    +
    +
    +
    +
    + +

    +LibraryPathListEditor_0

    +
    +public static java.lang.String LibraryPathListEditor_0
    +
    +
    +
    +
    +
    + +

    +LibraryPathListEditor_1

    +
    +public static java.lang.String LibraryPathListEditor_1
    +
    +
    +
    +
    +
    + +

    +LlvmPreferencePage_0

    +
    +public static java.lang.String LlvmPreferencePage_0
    +
    +
    +
    +
    +
    + +

    +LlvmPreferencePage_1

    +
    +public static java.lang.String LlvmPreferencePage_1
    +
    +
    +
    +
    +
    + +

    +LlvmPreferencePage_2

    +
    +public static java.lang.String LlvmPreferencePage_2
    +
    +
    +
    +
    +
    + +

    +LlvmPreferencePage_3

    +
    +public static java.lang.String LlvmPreferencePage_3
    +
    +
    +
    +
    +
    + +

    +LlvmPreferencePage_4

    +
    +public static java.lang.String LlvmPreferencePage_4
    +
    +
    +
    +
    + + + + + + + + +
    +Constructor Detail
    + +

    +Messages

    +
    +private Messages()
    +
    +
    + +
    + + + + + + + + + + + + + + + + + + + +
    + +
    + + + +
    + + + diff --git a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/ui/preferences/PreferenceConstants.html b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/ui/preferences/PreferenceConstants.html index 1e68c8e6e57..f1b69f9b524 100644 --- a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/ui/preferences/PreferenceConstants.html +++ b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/ui/preferences/PreferenceConstants.html @@ -1,318 +1,318 @@ - - - - - - -PreferenceConstants - - - - - - - - - - - - -
    - - - - - - - - - - - - - - - - - - - -
    - -
    - - - -
    - -

    - -org.eclipse.cdt.managedbuilder.llvm.ui.preferences -
    -Class PreferenceConstants

    -
    -java.lang.Object
    -  extended by org.eclipse.cdt.managedbuilder.llvm.ui.preferences.PreferenceConstants
    -
    -
    -
    -
    public class PreferenceConstants
    extends java.lang.Object
    - - -

    -Constant definitions for plug-in preferences -

    - -

    -


    - -

    - - - - - - - - - - - - - - - - - - - - - - - -
    -Field Summary
    -static java.lang.StringP_LLVM_INCLUDE_PATH - -
    -           
    -static java.lang.StringP_LLVM_LIBRARIES - -
    -           
    -static java.lang.StringP_LLVM_LIBRARY_PATH - -
    -           
    -static java.lang.StringP_LLVM_PATH - -
    -           
    -  - - - - - - - - - - -
    -Constructor Summary
    PreferenceConstants() - -
    -           
    -  - - - - - - - -
    -Method Summary
    - - - - - - - -
    Methods inherited from class java.lang.Object
    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    -  -

    - - - - - - - - -
    -Field Detail
    - -

    -P_LLVM_PATH

    -
    -public static final java.lang.String P_LLVM_PATH
    -
    -
    -
    See Also:
    Constant Field Values
    -
    -
    - -

    -P_LLVM_INCLUDE_PATH

    -
    -public static final java.lang.String P_LLVM_INCLUDE_PATH
    -
    -
    -
    See Also:
    Constant Field Values
    -
    -
    - -

    -P_LLVM_LIBRARY_PATH

    -
    -public static final java.lang.String P_LLVM_LIBRARY_PATH
    -
    -
    -
    See Also:
    Constant Field Values
    -
    -
    - -

    -P_LLVM_LIBRARIES

    -
    -public static final java.lang.String P_LLVM_LIBRARIES
    -
    -
    -
    See Also:
    Constant Field Values
    -
    - - - - - - - - -
    -Constructor Detail
    - -

    -PreferenceConstants

    -
    -public PreferenceConstants()
    -
    -
    - -
    - - - - - - - - - - - - - - - - - - - -
    - -
    - - - -
    - - - + + + + + + +PreferenceConstants + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + + + + + +
    + +
    + + + +
    + +

    + +org.eclipse.cdt.managedbuilder.llvm.ui.preferences +
    +Class PreferenceConstants

    +
    +java.lang.Object
    +  extended by org.eclipse.cdt.managedbuilder.llvm.ui.preferences.PreferenceConstants
    +
    +
    +
    +
    public class PreferenceConstants
    extends java.lang.Object
    + + +

    +Constant definitions for plug-in preferences +

    + +

    +


    + +

    + + + + + + + + + + + + + + + + + + + + + + + +
    +Field Summary
    +static java.lang.StringP_LLVM_INCLUDE_PATH + +
    +           
    +static java.lang.StringP_LLVM_LIBRARIES + +
    +           
    +static java.lang.StringP_LLVM_LIBRARY_PATH + +
    +           
    +static java.lang.StringP_LLVM_PATH + +
    +           
    +  + + + + + + + + + + +
    +Constructor Summary
    PreferenceConstants() + +
    +           
    +  + + + + + + + +
    +Method Summary
    + + + + + + + +
    Methods inherited from class java.lang.Object
    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    +  +

    + + + + + + + + +
    +Field Detail
    + +

    +P_LLVM_PATH

    +
    +public static final java.lang.String P_LLVM_PATH
    +
    +
    +
    See Also:
    Constant Field Values
    +
    +
    + +

    +P_LLVM_INCLUDE_PATH

    +
    +public static final java.lang.String P_LLVM_INCLUDE_PATH
    +
    +
    +
    See Also:
    Constant Field Values
    +
    +
    + +

    +P_LLVM_LIBRARY_PATH

    +
    +public static final java.lang.String P_LLVM_LIBRARY_PATH
    +
    +
    +
    See Also:
    Constant Field Values
    +
    +
    + +

    +P_LLVM_LIBRARIES

    +
    +public static final java.lang.String P_LLVM_LIBRARIES
    +
    +
    +
    See Also:
    Constant Field Values
    +
    + + + + + + + + +
    +Constructor Detail
    + +

    +PreferenceConstants

    +
    +public PreferenceConstants()
    +
    +
    + +
    + + + + + + + + + + + + + + + + + + + +
    + +
    + + + +
    + + + diff --git a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/ui/preferences/PreferenceInitializer.html b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/ui/preferences/PreferenceInitializer.html index 91106f3bd58..37c93d6d741 100644 --- a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/ui/preferences/PreferenceInitializer.html +++ b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/ui/preferences/PreferenceInitializer.html @@ -1,260 +1,260 @@ - - - - - - -PreferenceInitializer - - - - - - - - - - - - -
    - - - - - - - - - - - - - - - - - - - -
    - -
    - - - -
    - -

    - -org.eclipse.cdt.managedbuilder.llvm.ui.preferences -
    -Class PreferenceInitializer

    -
    -java.lang.Object
    -  extended by org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer
    -      extended by org.eclipse.cdt.managedbuilder.llvm.ui.preferences.PreferenceInitializer
    -
    -
    -
    -
    public class PreferenceInitializer
    extends org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer
    - - -

    -Class used to initialize the default preference values. -

    - -

    -


    - -

    - - - - - - - - - - - -
    -Constructor Summary
    PreferenceInitializer() - -
    -           
    -  - - - - - - - - - - - -
    -Method Summary
    - voidinitializeDefaultPreferences() - -
    -           
    - - - - - - - -
    Methods inherited from class java.lang.Object
    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    -  -

    - - - - - - - - -
    -Constructor Detail
    - -

    -PreferenceInitializer

    -
    -public PreferenceInitializer()
    -
    -
    - - - - - - - - -
    -Method Detail
    - -

    -initializeDefaultPreferences

    -
    -public void initializeDefaultPreferences()
    -
    -
    -
    Specified by:
    initializeDefaultPreferences in class org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer
    -
    -
    -
    -
    -
    - -
    - - - - - - - - - - - - - - - - - - - -
    - -
    - - - -
    - - - + + + + + + +PreferenceInitializer + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + + + + + +
    + +
    + + + +
    + +

    + +org.eclipse.cdt.managedbuilder.llvm.ui.preferences +
    +Class PreferenceInitializer

    +
    +java.lang.Object
    +  extended by org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer
    +      extended by org.eclipse.cdt.managedbuilder.llvm.ui.preferences.PreferenceInitializer
    +
    +
    +
    +
    public class PreferenceInitializer
    extends org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer
    + + +

    +Class used to initialize the default preference values. +

    + +

    +


    + +

    + + + + + + + + + + + +
    +Constructor Summary
    PreferenceInitializer() + +
    +           
    +  + + + + + + + + + + + +
    +Method Summary
    + voidinitializeDefaultPreferences() + +
    +           
    + + + + + + + +
    Methods inherited from class java.lang.Object
    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    +  +

    + + + + + + + + +
    +Constructor Detail
    + +

    +PreferenceInitializer

    +
    +public PreferenceInitializer()
    +
    +
    + + + + + + + + +
    +Method Detail
    + +

    +initializeDefaultPreferences

    +
    +public void initializeDefaultPreferences()
    +
    +
    +
    Specified by:
    initializeDefaultPreferences in class org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer
    +
    +
    +
    +
    +
    + +
    + + + + + + + + + + + + + + + + + + + +
    + +
    + + + +
    + + + diff --git a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/ui/preferences/class-use/IncludePathListEditor.html b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/ui/preferences/class-use/IncludePathListEditor.html index 6dd04e45eae..5e48ea4ac52 100644 --- a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/ui/preferences/class-use/IncludePathListEditor.html +++ b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/ui/preferences/class-use/IncludePathListEditor.html @@ -1,144 +1,144 @@ - - - - - - -Uses of Class org.eclipse.cdt.managedbuilder.llvm.ui.preferences.IncludePathListEditor - - - - - - - - - - - - -
    - - - - - - - - - - - - - - - -
    - -
    - - - -
    -
    -

    -Uses of Class
    org.eclipse.cdt.managedbuilder.llvm.ui.preferences.IncludePathListEditor

    -
    -No usage of org.eclipse.cdt.managedbuilder.llvm.ui.preferences.IncludePathListEditor -

    -


    - - - - - - - - - - - - - - - -
    - -
    - - - -
    - - - + + + + + + +Uses of Class org.eclipse.cdt.managedbuilder.llvm.ui.preferences.IncludePathListEditor + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + +
    + +
    + + + +
    +
    +

    +Uses of Class
    org.eclipse.cdt.managedbuilder.llvm.ui.preferences.IncludePathListEditor

    +
    +No usage of org.eclipse.cdt.managedbuilder.llvm.ui.preferences.IncludePathListEditor +

    +


    + + + + + + + + + + + + + + + +
    + +
    + + + +
    + + + diff --git a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/ui/preferences/class-use/LibraryListEditor.html b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/ui/preferences/class-use/LibraryListEditor.html index 143df572b1e..471356c849f 100644 --- a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/ui/preferences/class-use/LibraryListEditor.html +++ b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/ui/preferences/class-use/LibraryListEditor.html @@ -1,144 +1,144 @@ - - - - - - -Uses of Class org.eclipse.cdt.managedbuilder.llvm.ui.preferences.LibraryListEditor - - - - - - - - - - - - -
    - - - - - - - - - - - - - - - -
    - -
    - - - -
    -
    -

    -Uses of Class
    org.eclipse.cdt.managedbuilder.llvm.ui.preferences.LibraryListEditor

    -
    -No usage of org.eclipse.cdt.managedbuilder.llvm.ui.preferences.LibraryListEditor -

    -


    - - - - - - - - - - - - - - - -
    - -
    - - - -
    - - - + + + + + + +Uses of Class org.eclipse.cdt.managedbuilder.llvm.ui.preferences.LibraryListEditor + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + +
    + +
    + + + +
    +
    +

    +Uses of Class
    org.eclipse.cdt.managedbuilder.llvm.ui.preferences.LibraryListEditor

    +
    +No usage of org.eclipse.cdt.managedbuilder.llvm.ui.preferences.LibraryListEditor +

    +


    + + + + + + + + + + + + + + + +
    + +
    + + + +
    + + + diff --git a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/ui/preferences/class-use/LibraryPathListEditor.html b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/ui/preferences/class-use/LibraryPathListEditor.html index 250be33f3f9..489e7bece8d 100644 --- a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/ui/preferences/class-use/LibraryPathListEditor.html +++ b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/ui/preferences/class-use/LibraryPathListEditor.html @@ -1,144 +1,144 @@ - - - - - - -Uses of Class org.eclipse.cdt.managedbuilder.llvm.ui.preferences.LibraryPathListEditor - - - - - - - - - - - - -
    - - - - - - - - - - - - - - - -
    - -
    - - - -
    -
    -

    -Uses of Class
    org.eclipse.cdt.managedbuilder.llvm.ui.preferences.LibraryPathListEditor

    -
    -No usage of org.eclipse.cdt.managedbuilder.llvm.ui.preferences.LibraryPathListEditor -

    -


    - - - - - - - - - - - - - - - -
    - -
    - - - -
    - - - + + + + + + +Uses of Class org.eclipse.cdt.managedbuilder.llvm.ui.preferences.LibraryPathListEditor + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + +
    + +
    + + + +
    +
    +

    +Uses of Class
    org.eclipse.cdt.managedbuilder.llvm.ui.preferences.LibraryPathListEditor

    +
    +No usage of org.eclipse.cdt.managedbuilder.llvm.ui.preferences.LibraryPathListEditor +

    +


    + + + + + + + + + + + + + + + +
    + +
    + + + +
    + + + diff --git a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/ui/preferences/class-use/LlvmListEditor.html b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/ui/preferences/class-use/LlvmListEditor.html index eda667df1c8..b000edad6bc 100644 --- a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/ui/preferences/class-use/LlvmListEditor.html +++ b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/ui/preferences/class-use/LlvmListEditor.html @@ -1,196 +1,196 @@ - - - - - - -Uses of Class org.eclipse.cdt.managedbuilder.llvm.ui.preferences.LlvmListEditor - - - - - - - - - - - - -
    - - - - - - - - - - - - - - - -
    - -
    - - - -
    -
    -

    -Uses of Class
    org.eclipse.cdt.managedbuilder.llvm.ui.preferences.LlvmListEditor

    -
    - - - - - - - - - -
    -Packages that use LlvmListEditor
    org.eclipse.cdt.managedbuilder.llvm.ui.preferences  
    -  -

    - - - - - -
    -Uses of LlvmListEditor in org.eclipse.cdt.managedbuilder.llvm.ui.preferences
    -  -

    - - - - - - - - - - - - - - - - - -
    Subclasses of LlvmListEditor in org.eclipse.cdt.managedbuilder.llvm.ui.preferences
    - classIncludePathListEditor - -
    -          New implementation of LlvmListEditor.
    - classLibraryListEditor - -
    -          New implementation of LlvmListEditor.
    - classLibraryPathListEditor - -
    -          New implementation of LlvmListEditor.
    -  -

    -


    - - - - - - - - - - - - - - - -
    - -
    - - - -
    - - - + + + + + + +Uses of Class org.eclipse.cdt.managedbuilder.llvm.ui.preferences.LlvmListEditor + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + +
    + +
    + + + +
    +
    +

    +Uses of Class
    org.eclipse.cdt.managedbuilder.llvm.ui.preferences.LlvmListEditor

    +
    + + + + + + + + + +
    +Packages that use LlvmListEditor
    org.eclipse.cdt.managedbuilder.llvm.ui.preferences  
    +  +

    + + + + + +
    +Uses of LlvmListEditor in org.eclipse.cdt.managedbuilder.llvm.ui.preferences
    +  +

    + + + + + + + + + + + + + + + + + +
    Subclasses of LlvmListEditor in org.eclipse.cdt.managedbuilder.llvm.ui.preferences
    + classIncludePathListEditor + +
    +          New implementation of LlvmListEditor.
    + classLibraryListEditor + +
    +          New implementation of LlvmListEditor.
    + classLibraryPathListEditor + +
    +          New implementation of LlvmListEditor.
    +  +

    +


    + + + + + + + + + + + + + + + +
    + +
    + + + +
    + + + diff --git a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/ui/preferences/class-use/LlvmPreferencePage.html b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/ui/preferences/class-use/LlvmPreferencePage.html index 287a0bbcb34..1a00c561c6f 100644 --- a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/ui/preferences/class-use/LlvmPreferencePage.html +++ b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/ui/preferences/class-use/LlvmPreferencePage.html @@ -1,144 +1,144 @@ - - - - - - -Uses of Class org.eclipse.cdt.managedbuilder.llvm.ui.preferences.LlvmPreferencePage - - - - - - - - - - - - -
    - - - - - - - - - - - - - - - -
    - -
    - - - -
    -
    -

    -Uses of Class
    org.eclipse.cdt.managedbuilder.llvm.ui.preferences.LlvmPreferencePage

    -
    -No usage of org.eclipse.cdt.managedbuilder.llvm.ui.preferences.LlvmPreferencePage -

    -


    - - - - - - - - - - - - - - - -
    - -
    - - - -
    - - - + + + + + + +Uses of Class org.eclipse.cdt.managedbuilder.llvm.ui.preferences.LlvmPreferencePage + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + +
    + +
    + + + +
    +
    +

    +Uses of Class
    org.eclipse.cdt.managedbuilder.llvm.ui.preferences.LlvmPreferencePage

    +
    +No usage of org.eclipse.cdt.managedbuilder.llvm.ui.preferences.LlvmPreferencePage +

    +


    + + + + + + + + + + + + + + + +
    + +
    + + + +
    + + + diff --git a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/ui/preferences/class-use/LlvmPreferenceStore.html b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/ui/preferences/class-use/LlvmPreferenceStore.html index 0a940acd56d..b81da0321c7 100644 --- a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/ui/preferences/class-use/LlvmPreferenceStore.html +++ b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/ui/preferences/class-use/LlvmPreferenceStore.html @@ -1,144 +1,144 @@ - - - - - - -Uses of Class org.eclipse.cdt.managedbuilder.llvm.ui.preferences.LlvmPreferenceStore - - - - - - - - - - - - -
    - - - - - - - - - - - - - - - -
    - -
    - - - -
    -
    -

    -Uses of Class
    org.eclipse.cdt.managedbuilder.llvm.ui.preferences.LlvmPreferenceStore

    -
    -No usage of org.eclipse.cdt.managedbuilder.llvm.ui.preferences.LlvmPreferenceStore -

    -


    - - - - - - - - - - - - - - - -
    - -
    - - - -
    - - - + + + + + + +Uses of Class org.eclipse.cdt.managedbuilder.llvm.ui.preferences.LlvmPreferenceStore + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + +
    + +
    + + + +
    +
    +

    +Uses of Class
    org.eclipse.cdt.managedbuilder.llvm.ui.preferences.LlvmPreferenceStore

    +
    +No usage of org.eclipse.cdt.managedbuilder.llvm.ui.preferences.LlvmPreferenceStore +

    +


    + + + + + + + + + + + + + + + +
    + +
    + + + +
    + + + diff --git a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/ui/preferences/class-use/Messages.html b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/ui/preferences/class-use/Messages.html index 72af07fd6c7..344df255b05 100644 --- a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/ui/preferences/class-use/Messages.html +++ b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/ui/preferences/class-use/Messages.html @@ -1,144 +1,144 @@ - - - - - - -Uses of Class org.eclipse.cdt.managedbuilder.llvm.ui.preferences.Messages - - - - - - - - - - - - -
    - - - - - - - - - - - - - - - -
    - -
    - - - -
    -
    -

    -Uses of Class
    org.eclipse.cdt.managedbuilder.llvm.ui.preferences.Messages

    -
    -No usage of org.eclipse.cdt.managedbuilder.llvm.ui.preferences.Messages -

    -


    - - - - - - - - - - - - - - - -
    - -
    - - - -
    - - - + + + + + + +Uses of Class org.eclipse.cdt.managedbuilder.llvm.ui.preferences.Messages + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + +
    + +
    + + + +
    +
    +

    +Uses of Class
    org.eclipse.cdt.managedbuilder.llvm.ui.preferences.Messages

    +
    +No usage of org.eclipse.cdt.managedbuilder.llvm.ui.preferences.Messages +

    +


    + + + + + + + + + + + + + + + +
    + +
    + + + +
    + + + diff --git a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/ui/preferences/class-use/PreferenceConstants.html b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/ui/preferences/class-use/PreferenceConstants.html index 17a1ee132bb..d38cc483e0a 100644 --- a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/ui/preferences/class-use/PreferenceConstants.html +++ b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/ui/preferences/class-use/PreferenceConstants.html @@ -1,144 +1,144 @@ - - - - - - -Uses of Class org.eclipse.cdt.managedbuilder.llvm.ui.preferences.PreferenceConstants - - - - - - - - - - - - -
    - - - - - - - - - - - - - - - -
    - -
    - - - -
    -
    -

    -Uses of Class
    org.eclipse.cdt.managedbuilder.llvm.ui.preferences.PreferenceConstants

    -
    -No usage of org.eclipse.cdt.managedbuilder.llvm.ui.preferences.PreferenceConstants -

    -


    - - - - - - - - - - - - - - - -
    - -
    - - - -
    - - - + + + + + + +Uses of Class org.eclipse.cdt.managedbuilder.llvm.ui.preferences.PreferenceConstants + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + +
    + +
    + + + +
    +
    +

    +Uses of Class
    org.eclipse.cdt.managedbuilder.llvm.ui.preferences.PreferenceConstants

    +
    +No usage of org.eclipse.cdt.managedbuilder.llvm.ui.preferences.PreferenceConstants +

    +


    + + + + + + + + + + + + + + + +
    + +
    + + + +
    + + + diff --git a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/ui/preferences/class-use/PreferenceInitializer.html b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/ui/preferences/class-use/PreferenceInitializer.html index 89c0c322904..df9da793c54 100644 --- a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/ui/preferences/class-use/PreferenceInitializer.html +++ b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/ui/preferences/class-use/PreferenceInitializer.html @@ -1,144 +1,144 @@ - - - - - - -Uses of Class org.eclipse.cdt.managedbuilder.llvm.ui.preferences.PreferenceInitializer - - - - - - - - - - - - -
    - - - - - - - - - - - - - - - -
    - -
    - - - -
    -
    -

    -Uses of Class
    org.eclipse.cdt.managedbuilder.llvm.ui.preferences.PreferenceInitializer

    -
    -No usage of org.eclipse.cdt.managedbuilder.llvm.ui.preferences.PreferenceInitializer -

    -


    - - - - - - - - - - - - - - - -
    - -
    - - - -
    - - - + + + + + + +Uses of Class org.eclipse.cdt.managedbuilder.llvm.ui.preferences.PreferenceInitializer + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + +
    + +
    + + + +
    +
    +

    +Uses of Class
    org.eclipse.cdt.managedbuilder.llvm.ui.preferences.PreferenceInitializer

    +
    +No usage of org.eclipse.cdt.managedbuilder.llvm.ui.preferences.PreferenceInitializer +

    +


    + + + + + + + + + + + + + + + +
    + +
    + + + +
    + + + diff --git a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/ui/preferences/package-frame.html b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/ui/preferences/package-frame.html index 0cebbaeaca9..533f49daca1 100644 --- a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/ui/preferences/package-frame.html +++ b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/ui/preferences/package-frame.html @@ -1,48 +1,48 @@ - - - - - - -org.eclipse.cdt.managedbuilder.llvm.ui.preferences - - - - - - - - - - - -org.eclipse.cdt.managedbuilder.llvm.ui.preferences - - - - -
    -Classes  - -
    -IncludePathListEditor -
    -LibraryListEditor -
    -LibraryPathListEditor -
    -LlvmListEditor -
    -LlvmPreferencePage -
    -LlvmPreferenceStore -
    -Messages -
    -PreferenceConstants -
    -PreferenceInitializer
    - - - - + + + + + + +org.eclipse.cdt.managedbuilder.llvm.ui.preferences + + + + + + + + + + + +org.eclipse.cdt.managedbuilder.llvm.ui.preferences + + + + +
    +Classes  + +
    +IncludePathListEditor +
    +LibraryListEditor +
    +LibraryPathListEditor +
    +LlvmListEditor +
    +LlvmPreferencePage +
    +LlvmPreferenceStore +
    +Messages +
    +PreferenceConstants +
    +PreferenceInitializer
    + + + + diff --git a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/ui/preferences/package-summary.html b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/ui/preferences/package-summary.html index 9493a863271..54a1732ad7d 100644 --- a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/ui/preferences/package-summary.html +++ b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/ui/preferences/package-summary.html @@ -1,190 +1,190 @@ - - - - - - -org.eclipse.cdt.managedbuilder.llvm.ui.preferences - - - - - - - - - - - - -
    - - - - - - - - - - - - - - - -
    - -
    - - - -
    -

    -Package org.eclipse.cdt.managedbuilder.llvm.ui.preferences -

    - - - - - - - - - - - - - - - - - - - - - - - + + + + + + +org.eclipse.cdt.managedbuilder.llvm.ui.preferences + + + + + + + + + + + + +
    + + + + + +
    -Class Summary
    IncludePathListEditorNew implementation of LlvmListEditor.
    LibraryListEditorNew implementation of LlvmListEditor.
    LibraryPathListEditorNew implementation of LlvmListEditor.
    LlvmListEditorAn abstract list editor that manages a list of input values.
    LlvmPreferencePage
    + + + + + + + + + +
    + +
    + + + +
    +

    +Package org.eclipse.cdt.managedbuilder.llvm.ui.preferences +

    + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - -
    +Class Summary
    IncludePathListEditorNew implementation of LlvmListEditor.
    LibraryListEditorNew implementation of LlvmListEditor.
    LibraryPathListEditorNew implementation of LlvmListEditor.
    LlvmListEditorAn abstract list editor that manages a list of input values.
    LlvmPreferencePage This class represents a preference page that - is contributed to the Preferences dialog.
    LlvmPreferenceStoreClass used to access the LLVM Preference store values.
    Messages 
    PreferenceConstantsConstant definitions for plug-in preferences
    PreferenceInitializerClass used to initialize the default preference values.
    -  - -

    -

    -
    -
    - - - - - - - - - - - - - - - -
    - -
    - - - -
    - - - + is contributed to the Preferences dialog. + + +LlvmPreferenceStore +Class used to access the LLVM Preference store values. + + +Messages +  + + +PreferenceConstants +Constant definitions for plug-in preferences + + +PreferenceInitializer +Class used to initialize the default preference values. + + +  + +

    +

    +
    +
    + + + + + + + + + + + + + + + +
    + +
    + + + +
    + + + diff --git a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/ui/preferences/package-tree.html b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/ui/preferences/package-tree.html index 43fe035b3bf..62c52f4b4e6 100644 --- a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/ui/preferences/package-tree.html +++ b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/ui/preferences/package-tree.html @@ -1,173 +1,173 @@ - - - - - - -org.eclipse.cdt.managedbuilder.llvm.ui.preferences Class Hierarchy - - - - - - - - - - - - -
    - - - - - - - - - - - - - - - -
    - -
    - - - -
    -
    -

    -Hierarchy For Package org.eclipse.cdt.managedbuilder.llvm.ui.preferences -

    -
    -
    -
    Package Hierarchies:
    All Packages
    -
    -

    -Class Hierarchy -

    -
      -
    • java.lang.Object
        -
      • org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer -
      • org.eclipse.jface.dialogs.DialogPage (implements org.eclipse.jface.dialogs.IDialogPage, org.eclipse.jface.dialogs.IMessageProvider) -
          -
        • org.eclipse.jface.preference.PreferencePage (implements org.eclipse.jface.preference.IPreferencePage) -
            -
          • org.eclipse.jface.preference.FieldEditorPreferencePage (implements org.eclipse.jface.util.IPropertyChangeListener) -
              -
            • org.eclipse.cdt.managedbuilder.llvm.ui.preferences.LlvmPreferencePage (implements org.eclipse.ui.IWorkbenchPreferencePage) -
            -
          -
        -
      • org.eclipse.jface.preference.FieldEditor -
      • org.eclipse.cdt.managedbuilder.llvm.ui.preferences.LlvmPreferenceStore
      • org.eclipse.osgi.util.NLS
          -
        • org.eclipse.cdt.managedbuilder.llvm.ui.preferences.Messages
        -
      • org.eclipse.cdt.managedbuilder.llvm.ui.preferences.PreferenceConstants
      -
    -
    - - - - - - - - - - - - - - - -
    - -
    - - - -
    - - - + + + + + + +org.eclipse.cdt.managedbuilder.llvm.ui.preferences Class Hierarchy + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + +
    + +
    + + + +
    +
    +

    +Hierarchy For Package org.eclipse.cdt.managedbuilder.llvm.ui.preferences +

    +
    +
    +
    Package Hierarchies:
    All Packages
    +
    +

    +Class Hierarchy +

    +
      +
    • java.lang.Object
        +
      • org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer +
      • org.eclipse.jface.dialogs.DialogPage (implements org.eclipse.jface.dialogs.IDialogPage, org.eclipse.jface.dialogs.IMessageProvider) +
          +
        • org.eclipse.jface.preference.PreferencePage (implements org.eclipse.jface.preference.IPreferencePage) +
            +
          • org.eclipse.jface.preference.FieldEditorPreferencePage (implements org.eclipse.jface.util.IPropertyChangeListener) +
              +
            • org.eclipse.cdt.managedbuilder.llvm.ui.preferences.LlvmPreferencePage (implements org.eclipse.ui.IWorkbenchPreferencePage) +
            +
          +
        +
      • org.eclipse.jface.preference.FieldEditor +
      • org.eclipse.cdt.managedbuilder.llvm.ui.preferences.LlvmPreferenceStore
      • org.eclipse.osgi.util.NLS
          +
        • org.eclipse.cdt.managedbuilder.llvm.ui.preferences.Messages
        +
      • org.eclipse.cdt.managedbuilder.llvm.ui.preferences.PreferenceConstants
      +
    +
    + + + + + + + + + + + + + + + +
    + +
    + + + +
    + + + diff --git a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/ui/preferences/package-use.html b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/ui/preferences/package-use.html index 623b409e7da..796af4eb1b9 100644 --- a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/ui/preferences/package-use.html +++ b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/ui/preferences/package-use.html @@ -1,170 +1,170 @@ - - - - - - -Uses of Package org.eclipse.cdt.managedbuilder.llvm.ui.preferences - - - - - - - - - - - - -
    - - - - - - - - - - - - - - - -
    - -
    - - - -
    -
    -

    -Uses of Package
    org.eclipse.cdt.managedbuilder.llvm.ui.preferences

    -
    - - - - - - - - - -
    -Packages that use org.eclipse.cdt.managedbuilder.llvm.ui.preferences
    org.eclipse.cdt.managedbuilder.llvm.ui.preferences  
    -  -

    - - - - - - - - -
    -Classes in org.eclipse.cdt.managedbuilder.llvm.ui.preferences used by org.eclipse.cdt.managedbuilder.llvm.ui.preferences
    LlvmListEditor - -
    -          An abstract list editor that manages a list of input values.
    -  -

    -


    - - - - - - - - - - - - - - - -
    - -
    - - - -
    - - - + + + + + + +Uses of Package org.eclipse.cdt.managedbuilder.llvm.ui.preferences + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + +
    + +
    + + + +
    +
    +

    +Uses of Package
    org.eclipse.cdt.managedbuilder.llvm.ui.preferences

    +
    + + + + + + + + + +
    +Packages that use org.eclipse.cdt.managedbuilder.llvm.ui.preferences
    org.eclipse.cdt.managedbuilder.llvm.ui.preferences  
    +  +

    + + + + + + + + +
    +Classes in org.eclipse.cdt.managedbuilder.llvm.ui.preferences used by org.eclipse.cdt.managedbuilder.llvm.ui.preferences
    LlvmListEditor + +
    +          An abstract list editor that manages a list of input values.
    +  +

    +


    + + + + + + + + + + + + + + + +
    + +
    + + + +
    + + + diff --git a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/util/LlvmToolOptionPathUtil.html b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/util/LlvmToolOptionPathUtil.html index a7587f079ad..77cda5bc604 100644 --- a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/util/LlvmToolOptionPathUtil.html +++ b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/util/LlvmToolOptionPathUtil.html @@ -1,1293 +1,1293 @@ - - - - - - -LlvmToolOptionPathUtil - - - - - - - - - - - - -
    - - - - - - - - - - - - - - - - - - - -
    - -
    - - - -
    - -

    - -org.eclipse.cdt.managedbuilder.llvm.util -
    -Class LlvmToolOptionPathUtil

    -
    -java.lang.Object
    -  extended by org.eclipse.cdt.managedbuilder.llvm.util.LlvmToolOptionPathUtil
    -
    -
    -
    -
    public class LlvmToolOptionPathUtil
    extends java.lang.Object
    - - -

    + + + + + + +LlvmToolOptionPathUtil + + + + + + + + + + + + +


    + + + + + + + + + + + + + + + + + + + +
    + +
    + + + +
    + +

    + +org.eclipse.cdt.managedbuilder.llvm.util +
    +Class LlvmToolOptionPathUtil

    +
    +java.lang.Object
    +  extended by org.eclipse.cdt.managedbuilder.llvm.util.LlvmToolOptionPathUtil
    +
    +
    +
    +
    public class LlvmToolOptionPathUtil
    extends java.lang.Object
    + + +

    The main purpose of this class is to add include paths and libraries and library search paths for LLVM assembler and linker Tools which are added in Preferences->LLVM to all projects and build configurations that use LLVM ToolChain. Values added in Preferences->LLVM will - show in Project->Properties->C/C++ General->Paths and Symbols tabs. -

    - -

    -


    - -

    - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -Field Summary
    -static intINCLUDE - -
    -           
    -private static java.lang.String[]inputTypes - -
    -           
    -static intLIB - -
    -           
    -static intLIB_PATH - -
    -           
    -private static java.lang.StringlinkerInputType - -
    -           
    -  - - - - - - - - - - -
    -Constructor Summary
    LlvmToolOptionPathUtil() - -
    -           
    -  - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + +
    -Method Summary
    -private static voidaddIncludePathToToolOption(org.eclipse.cdt.managedbuilder.core.IConfiguration cf, - org.eclipse.cdt.managedbuilder.core.ITool cfTool, - org.eclipse.cdt.managedbuilder.core.IOption option, - java.lang.String newIncludePath) - -
    -          Adds include path for given Build configuration's Tool's Include path Option.
    -private static voidaddInputToToolOption(org.eclipse.cdt.managedbuilder.core.IConfiguration cf, - org.eclipse.cdt.managedbuilder.core.ITool cfTool, - org.eclipse.cdt.managedbuilder.core.IOption option, - java.lang.String newValue, - java.lang.String[] existingValues) - -
    -          Adds a new value to specific Option.
    -private static voidaddLibrarySearchPathToToolOption(org.eclipse.cdt.managedbuilder.core.IConfiguration cf, - org.eclipse.cdt.managedbuilder.core.ITool cfTool, - org.eclipse.cdt.managedbuilder.core.IOption option, - java.lang.String newSearchPath) - -
    -          Adds new Library search path for the Linker's Library search path Option.
    -private static voidaddLibraryToToolOption(org.eclipse.cdt.managedbuilder.core.IConfiguration cf, - org.eclipse.cdt.managedbuilder.core.ITool cfTool, - org.eclipse.cdt.managedbuilder.core.IOption option, - java.lang.String newLibrary) - -
    -          Adds new Library for the Linker's Libraries Option.
    -static voidaddLlvmIncludePath(java.lang.String includePath) - -
    + show in Project->Properties->C/C++ General->Paths and Symbols tabs. +

    + +

    +


    + +

    + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    +Field Summary
    +static intINCLUDE + +
    +           
    +private static java.lang.String[]inputTypes + +
    +           
    +static intLIB + +
    +           
    +static intLIB_PATH + +
    +           
    +private static java.lang.StringlinkerInputType + +
    +           
    +  + + + + + + + + + + +
    +Constructor Summary
    LlvmToolOptionPathUtil() + +
    +           
    +  + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - + + + + + + + + - - - - + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - + + + + + + + + - - - - - - - - + + + + + + + + - - - - - - - - - - - - - - - - - - - - - -
    +Method Summary
    +private static voidaddIncludePathToToolOption(org.eclipse.cdt.managedbuilder.core.IConfiguration cf, + org.eclipse.cdt.managedbuilder.core.ITool cfTool, + org.eclipse.cdt.managedbuilder.core.IOption option, + java.lang.String newIncludePath) + +
    +          Adds include path for given Build configuration's Tool's Include path Option.
    +private static voidaddInputToToolOption(org.eclipse.cdt.managedbuilder.core.IConfiguration cf, + org.eclipse.cdt.managedbuilder.core.ITool cfTool, + org.eclipse.cdt.managedbuilder.core.IOption option, + java.lang.String newValue, + java.lang.String[] existingValues) + +
    +          Adds a new value to specific Option.
    +private static voidaddLibrarySearchPathToToolOption(org.eclipse.cdt.managedbuilder.core.IConfiguration cf, + org.eclipse.cdt.managedbuilder.core.ITool cfTool, + org.eclipse.cdt.managedbuilder.core.IOption option, + java.lang.String newSearchPath) + +
    +          Adds new Library search path for the Linker's Library search path Option.
    +private static voidaddLibraryToToolOption(org.eclipse.cdt.managedbuilder.core.IConfiguration cf, + org.eclipse.cdt.managedbuilder.core.ITool cfTool, + org.eclipse.cdt.managedbuilder.core.IOption option, + java.lang.String newLibrary) + +
    +          Adds new Library for the Linker's Libraries Option.
    +static voidaddLlvmIncludePath(java.lang.String includePath) + +
              Adds new include path to LLVM Assembler's Include path option for every project - in the workspace that use LLVM Toolchain and for for every build configuration.
    -private static booleanaddLlvmIncludePathToToolOption(org.eclipse.cdt.managedbuilder.core.IConfiguration cf, - java.lang.String newIncludePath) - -
    -          Adds an include path to LLVM front-end's include path option.
    -static voidaddLlvmLib(java.lang.String lib) - -
    + in the workspace that use LLVM Toolchain and for for every build configuration.
    +private static booleanaddLlvmIncludePathToToolOption(org.eclipse.cdt.managedbuilder.core.IConfiguration cf, + java.lang.String newIncludePath) + +
    +          Adds an include path to LLVM front-end's include path option.
    +static voidaddLlvmLib(java.lang.String lib) + +
              Adds a new Library to LLVM linker's Libraries Option for every project - in the workspace that use LLVM Toolchain and for for every build configuration.
    -static voidaddLlvmLibSearchPath(java.lang.String libDir) - -
    + in the workspace that use LLVM Toolchain and for for every build configuration.
    +static voidaddLlvmLibSearchPath(java.lang.String libDir) + +
              Adds a new Library search path directory to LLVM linker's Library search path Option for every project in the workspace that use LLVM Toolchain and for for every - build configuration.
    -private static booleanaddLlvmLibSearchPathToToolOption(org.eclipse.cdt.managedbuilder.core.IConfiguration cf, - java.lang.String libDir) - -
    -          Adds a Library search path to LLVM linker's Library search path Option.
    -private static booleanaddLlvmLibToToolOption(org.eclipse.cdt.managedbuilder.core.IConfiguration cf, - java.lang.String lib) - -
    -          Adds a Library to LLVM linker's Libraries Option.
    -static java.lang.String[]addNewPathToExistingPathList(java.lang.String[] existingPaths, - java.lang.String newPath) - -
    -          Adds one or more paths to the list of paths.
    -private static booleanaddPathToSelectedToolOptionBuildConf(org.eclipse.cdt.managedbuilder.core.IConfiguration cf, - java.lang.String path, - int var) - -
    -          Add a path to specific build configuration's Tool option.
    -private static voidaddPathToToolOption(java.lang.String path, - int var) - -
    -          Adds a path to Tool option.
    -static java.lang.StringarrayToString(java.lang.String[] array) - -
    -          Append an array of Strings to a String separated by a path separator.
    -private static org.eclipse.cdt.managedbuilder.core.IConfiguration[]getAllBuildConfigs(org.eclipse.core.resources.IProject proj) - -
    -          Returns all build configurations of the project.
    -private static org.eclipse.cdt.managedbuilder.core.IToolgetIToolByInputType(org.eclipse.cdt.managedbuilder.core.IConfiguration cf, - java.lang.String ext) - -
    -          Returns ITool associated with the input extension.
    -private static org.eclipse.cdt.managedbuilder.core.IOptiongetIToolPathOption(org.eclipse.cdt.managedbuilder.core.ITool cfTool, - java.lang.String optionId) - -
    -          Returns Tool's Option type by Id.
    -private static org.eclipse.cdt.managedbuilder.core.IToolgetLlvmFrontEnd(org.eclipse.cdt.managedbuilder.core.IConfiguration cf) - -
    -          Return LLVM front-end according to the input type.
    -private static org.eclipse.cdt.managedbuilder.core.IOptiongetLlvmFrontEndIncludePathOption(org.eclipse.cdt.managedbuilder.core.IConfiguration cf) - -
    -          Returns LLVM front-end Include path Option type.
    -private static org.eclipse.cdt.managedbuilder.core.IToolgetLlvmLinker(org.eclipse.cdt.managedbuilder.core.IConfiguration cf) - -
    -          Returns LLVM linker.
    -private static org.eclipse.cdt.managedbuilder.core.IOptiongetLlvmLinkerLibrariesOption(org.eclipse.cdt.managedbuilder.core.IConfiguration cf) - -
    -          Returns LLVM Linker Libraries Option type.
    -private static org.eclipse.cdt.managedbuilder.core.IOptiongetLlvmLinkerLibrarySearchPathOption(org.eclipse.cdt.managedbuilder.core.IConfiguration cf) - -
    -          Returns LLVM Linker Library search path Option type.
    -private static java.lang.StringgetOptionId(org.eclipse.cdt.managedbuilder.core.ITool cfTool, - int optionValueType) - -
    -          Returns Tool's option id.
    -static org.eclipse.core.resources.IProject[]getProjectsInWorkspace() - -
    -          Returns all projects in the workspace.
    -private static booleanpathExists(java.lang.String path) - -
    -          Checks if a file path exists.
    -private static voidremoveIncludePathFromToolOption(org.eclipse.cdt.managedbuilder.core.IConfiguration cf, - org.eclipse.cdt.managedbuilder.core.ITool cfTool, - org.eclipse.cdt.managedbuilder.core.IOption option, - java.lang.String removeIncludePath) - -
    -          Removes an include path from given Build configuration's Tool's Include path Option.
    -private static voidremoveInputFromToolOption(org.eclipse.cdt.managedbuilder.core.IConfiguration cf, - org.eclipse.cdt.managedbuilder.core.ITool cfTool, - org.eclipse.cdt.managedbuilder.core.IOption option, - java.lang.String removeValue, - java.lang.String[] existingValues) - -
    -          Removes a value from a specific Option.
    -private static voidremoveLibraryFromToolOption(org.eclipse.cdt.managedbuilder.core.IConfiguration cf, - org.eclipse.cdt.managedbuilder.core.ITool cfTool, - org.eclipse.cdt.managedbuilder.core.IOption option, - java.lang.String removeLibrary) - -
    -          Removes a new Library from the Linker's Libraries Option.
    -private static voidremoveLibrarySearchPathFromToolOption(org.eclipse.cdt.managedbuilder.core.IConfiguration cf, - org.eclipse.cdt.managedbuilder.core.ITool cfTool, - org.eclipse.cdt.managedbuilder.core.IOption option, - java.lang.String removeSearchPath) - -
    -          Removes a Library search path from the Linker's Library search path Option.
    -static voidremoveLlvmIncludePath(java.lang.String includePath) - -
    + build configuration.
    +private static booleanaddLlvmLibSearchPathToToolOption(org.eclipse.cdt.managedbuilder.core.IConfiguration cf, + java.lang.String libDir) + +
    +          Adds a Library search path to LLVM linker's Library search path Option.
    +private static booleanaddLlvmLibToToolOption(org.eclipse.cdt.managedbuilder.core.IConfiguration cf, + java.lang.String lib) + +
    +          Adds a Library to LLVM linker's Libraries Option.
    +static java.lang.String[]addNewPathToExistingPathList(java.lang.String[] existingPaths, + java.lang.String newPath) + +
    +          Adds one or more paths to the list of paths.
    +private static booleanaddPathToSelectedToolOptionBuildConf(org.eclipse.cdt.managedbuilder.core.IConfiguration cf, + java.lang.String path, + int var) + +
    +          Add a path to specific build configuration's Tool option.
    +private static voidaddPathToToolOption(java.lang.String path, + int var) + +
    +          Adds a path to Tool option.
    +static java.lang.StringarrayToString(java.lang.String[] array) + +
    +          Append an array of Strings to a String separated by a path separator.
    +private static org.eclipse.cdt.managedbuilder.core.IConfiguration[]getAllBuildConfigs(org.eclipse.core.resources.IProject proj) + +
    +          Returns all build configurations of the project.
    +private static org.eclipse.cdt.managedbuilder.core.IToolgetIToolByInputType(org.eclipse.cdt.managedbuilder.core.IConfiguration cf, + java.lang.String ext) + +
    +          Returns ITool associated with the input extension.
    +private static org.eclipse.cdt.managedbuilder.core.IOptiongetIToolPathOption(org.eclipse.cdt.managedbuilder.core.ITool cfTool, + java.lang.String optionId) + +
    +          Returns Tool's Option type by Id.
    +private static org.eclipse.cdt.managedbuilder.core.IToolgetLlvmFrontEnd(org.eclipse.cdt.managedbuilder.core.IConfiguration cf) + +
    +          Return LLVM front-end according to the input type.
    +private static org.eclipse.cdt.managedbuilder.core.IOptiongetLlvmFrontEndIncludePathOption(org.eclipse.cdt.managedbuilder.core.IConfiguration cf) + +
    +          Returns LLVM front-end Include path Option type.
    +private static org.eclipse.cdt.managedbuilder.core.IToolgetLlvmLinker(org.eclipse.cdt.managedbuilder.core.IConfiguration cf) + +
    +          Returns LLVM linker.
    +private static org.eclipse.cdt.managedbuilder.core.IOptiongetLlvmLinkerLibrariesOption(org.eclipse.cdt.managedbuilder.core.IConfiguration cf) + +
    +          Returns LLVM Linker Libraries Option type.
    +private static org.eclipse.cdt.managedbuilder.core.IOptiongetLlvmLinkerLibrarySearchPathOption(org.eclipse.cdt.managedbuilder.core.IConfiguration cf) + +
    +          Returns LLVM Linker Library search path Option type.
    +private static java.lang.StringgetOptionId(org.eclipse.cdt.managedbuilder.core.ITool cfTool, + int optionValueType) + +
    +          Returns Tool's option id.
    +static org.eclipse.core.resources.IProject[]getProjectsInWorkspace() + +
    +          Returns all projects in the workspace.
    +private static booleanpathExists(java.lang.String path) + +
    +          Checks if a file path exists.
    +private static voidremoveIncludePathFromToolOption(org.eclipse.cdt.managedbuilder.core.IConfiguration cf, + org.eclipse.cdt.managedbuilder.core.ITool cfTool, + org.eclipse.cdt.managedbuilder.core.IOption option, + java.lang.String removeIncludePath) + +
    +          Removes an include path from given Build configuration's Tool's Include path Option.
    +private static voidremoveInputFromToolOption(org.eclipse.cdt.managedbuilder.core.IConfiguration cf, + org.eclipse.cdt.managedbuilder.core.ITool cfTool, + org.eclipse.cdt.managedbuilder.core.IOption option, + java.lang.String removeValue, + java.lang.String[] existingValues) + +
    +          Removes a value from a specific Option.
    +private static voidremoveLibraryFromToolOption(org.eclipse.cdt.managedbuilder.core.IConfiguration cf, + org.eclipse.cdt.managedbuilder.core.ITool cfTool, + org.eclipse.cdt.managedbuilder.core.IOption option, + java.lang.String removeLibrary) + +
    +          Removes a new Library from the Linker's Libraries Option.
    +private static voidremoveLibrarySearchPathFromToolOption(org.eclipse.cdt.managedbuilder.core.IConfiguration cf, + org.eclipse.cdt.managedbuilder.core.ITool cfTool, + org.eclipse.cdt.managedbuilder.core.IOption option, + java.lang.String removeSearchPath) + +
    +          Removes a Library search path from the Linker's Library search path Option.
    +static voidremoveLlvmIncludePath(java.lang.String includePath) + +
              Removes an include path from LLVM Assembler's Include path option for every project - in the workspace that use LLVM Toolchain and for for every build configuration.
    -private static booleanremoveLlvmIncludePathFromToolOption(org.eclipse.cdt.managedbuilder.core.IConfiguration cf, - java.lang.String removeIncludePath) - -
    -          Removes an include path from LLVM front-end's include path option.
    -static voidremoveLlvmLib(java.lang.String lib) - -
    + in the workspace that use LLVM Toolchain and for for every build configuration.
    +private static booleanremoveLlvmIncludePathFromToolOption(org.eclipse.cdt.managedbuilder.core.IConfiguration cf, + java.lang.String removeIncludePath) + +
    +          Removes an include path from LLVM front-end's include path option.
    +static voidremoveLlvmLib(java.lang.String lib) + +
              Removes a Library to LLVM linker's Libraries Option for every project - in the workspace that use LLVM Toolchain and for for every build configuration.
    -private static booleanremoveLlvmLibFromToolOption(org.eclipse.cdt.managedbuilder.core.IConfiguration cf, - java.lang.String removeLib) - -
    -          Removes a Library from LLVM linker's Libraries Option.
    -static voidremoveLlvmLibSearchPath(java.lang.String libDir) - -
    + in the workspace that use LLVM Toolchain and for for every build configuration.
    +private static booleanremoveLlvmLibFromToolOption(org.eclipse.cdt.managedbuilder.core.IConfiguration cf, + java.lang.String removeLib) + +
    +          Removes a Library from LLVM linker's Libraries Option.
    +static voidremoveLlvmLibSearchPath(java.lang.String libDir) + +
              Removes a Library search path directory from LLVM linker's Library search path Option for every project in the workspace that use LLVM Toolchain and for for every - build configuration.
    -private static booleanremoveLlvmLibSearchPathFromToolOption(org.eclipse.cdt.managedbuilder.core.IConfiguration cf, - java.lang.String removeLibDir) - -
    -          Removes a Library search path from LLVM linker's Library search path Option.
    -static java.lang.String[]removePathFromExistingPathList(java.lang.String[] existingPaths, - java.lang.String removePath) - -
    -          Removes one path from the list of paths.
    -private static booleanremovePathFromSelectedToolOptionBuildConf(org.eclipse.cdt.managedbuilder.core.IConfiguration cf, - java.lang.String path, - int var) - -
    -          Removes a path from specific build configuration's Tool option.
    -private static voidremovePathFromToolOption(java.lang.String path, - int var) - -
    -          Removes a path from Tool option.
    -static java.lang.String[]stringToArray(java.lang.String str) - -
    -          Split paths to a String array.
    - - - - - - - -
    Methods inherited from class java.lang.Object
    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    -  -

    - - - - - - - - -
    -Field Detail
    - -

    -linkerInputType

    -
    -private static final java.lang.String linkerInputType
    -
    -
    -
    See Also:
    Constant Field Values
    -
    -
    - -

    -inputTypes

    -
    -private static final java.lang.String[] inputTypes
    -
    -
    -
    -
    -
    - -

    -INCLUDE

    -
    -public static final int INCLUDE
    -
    -
    -
    See Also:
    Constant Field Values
    -
    -
    - -

    -LIB

    -
    -public static final int LIB
    -
    -
    -
    See Also:
    Constant Field Values
    -
    -
    - -

    -LIB_PATH

    -
    -public static final int LIB_PATH
    -
    -
    -
    See Also:
    Constant Field Values
    -
    - - - - - - - - -
    -Constructor Detail
    - -

    -LlvmToolOptionPathUtil

    -
    -public LlvmToolOptionPathUtil()
    -
    -
    - - - - - - - - -
    -Method Detail
    - -

    -addLlvmIncludePath

    -
    -public static void addLlvmIncludePath(java.lang.String includePath)
    -
    + build configuration.
    +private static booleanremoveLlvmLibSearchPathFromToolOption(org.eclipse.cdt.managedbuilder.core.IConfiguration cf, + java.lang.String removeLibDir) + +
    +          Removes a Library search path from LLVM linker's Library search path Option.
    +static java.lang.String[]removePathFromExistingPathList(java.lang.String[] existingPaths, + java.lang.String removePath) + +
    +          Removes one path from the list of paths.
    +private static booleanremovePathFromSelectedToolOptionBuildConf(org.eclipse.cdt.managedbuilder.core.IConfiguration cf, + java.lang.String path, + int var) + +
    +          Removes a path from specific build configuration's Tool option.
    +private static voidremovePathFromToolOption(java.lang.String path, + int var) + +
    +          Removes a path from Tool option.
    +static java.lang.String[]stringToArray(java.lang.String str) + +
    +          Split paths to a String array.
    + + + + + + + +
    Methods inherited from class java.lang.Object
    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    +  +

    + + + + + + + + +
    +Field Detail
    + +

    +linkerInputType

    +
    +private static final java.lang.String linkerInputType
    +
    +
    +
    See Also:
    Constant Field Values
    +
    +
    + +

    +inputTypes

    +
    +private static final java.lang.String[] inputTypes
    +
    +
    +
    +
    +
    + +

    +INCLUDE

    +
    +public static final int INCLUDE
    +
    +
    +
    See Also:
    Constant Field Values
    +
    +
    + +

    +LIB

    +
    +public static final int LIB
    +
    +
    +
    See Also:
    Constant Field Values
    +
    +
    + +

    +LIB_PATH

    +
    +public static final int LIB_PATH
    +
    +
    +
    See Also:
    Constant Field Values
    +
    + + + + + + + + +
    +Constructor Detail
    + +

    +LlvmToolOptionPathUtil

    +
    +public LlvmToolOptionPathUtil()
    +
    +
    + + + + + + + + +
    +Method Detail
    + +

    +addLlvmIncludePath

    +
    +public static void addLlvmIncludePath(java.lang.String includePath)
    +
    Adds new include path to LLVM Assembler's Include path option for every project - in the workspace that use LLVM Toolchain and for for every build configuration. -

    -

    -
    Parameters:
    includePath - Include path for LLVM assembler's Include Option
    -
    -
    -
    - -

    -removeLlvmIncludePath

    -
    -public static void removeLlvmIncludePath(java.lang.String includePath)
    -
    + in the workspace that use LLVM Toolchain and for for every build configuration. +

    +

    +
    Parameters:
    includePath - Include path for LLVM assembler's Include Option
    +
    +
    +
    + +

    +removeLlvmIncludePath

    +
    +public static void removeLlvmIncludePath(java.lang.String includePath)
    +
    Removes an include path from LLVM Assembler's Include path option for every project - in the workspace that use LLVM Toolchain and for for every build configuration. -

    -

    -
    Parameters:
    includePath - Include path for LLVM assembler's Include Option
    -
    -
    -
    - -

    -addLlvmLib

    -
    -public static void addLlvmLib(java.lang.String lib)
    -
    + in the workspace that use LLVM Toolchain and for for every build configuration. +

    +

    +
    Parameters:
    includePath - Include path for LLVM assembler's Include Option
    +
    +
    +
    + +

    +addLlvmLib

    +
    +public static void addLlvmLib(java.lang.String lib)
    +
    Adds a new Library to LLVM linker's Libraries Option for every project - in the workspace that use LLVM Toolchain and for for every build configuration. -

    -

    -
    Parameters:
    lib - Library name for the LLVM linker's Libraries Option
    -
    -
    -
    - -

    -removeLlvmLib

    -
    -public static void removeLlvmLib(java.lang.String lib)
    -
    + in the workspace that use LLVM Toolchain and for for every build configuration. +

    +

    +
    Parameters:
    lib - Library name for the LLVM linker's Libraries Option
    +
    +
    +
    + +

    +removeLlvmLib

    +
    +public static void removeLlvmLib(java.lang.String lib)
    +
    Removes a Library to LLVM linker's Libraries Option for every project - in the workspace that use LLVM Toolchain and for for every build configuration. -

    -

    -
    Parameters:
    lib - Library name for the LLVM linker's Libraries Option
    -
    -
    -
    - -

    -addLlvmLibSearchPath

    -
    -public static void addLlvmLibSearchPath(java.lang.String libDir)
    -
    + in the workspace that use LLVM Toolchain and for for every build configuration. +

    +

    +
    Parameters:
    lib - Library name for the LLVM linker's Libraries Option
    +
    +
    +
    + +

    +addLlvmLibSearchPath

    +
    +public static void addLlvmLibSearchPath(java.lang.String libDir)
    +
    Adds a new Library search path directory to LLVM linker's Library search path Option for every project in the workspace that use LLVM Toolchain and for for every - build configuration. -

    -

    -
    Parameters:
    libDir - Library search path directory for LLVM linker's Library search path Option
    -
    -
    -
    - -

    -removeLlvmLibSearchPath

    -
    -public static void removeLlvmLibSearchPath(java.lang.String libDir)
    -
    + build configuration. +

    +

    +
    Parameters:
    libDir - Library search path directory for LLVM linker's Library search path Option
    +
    +
    +
    + +

    +removeLlvmLibSearchPath

    +
    +public static void removeLlvmLibSearchPath(java.lang.String libDir)
    +
    Removes a Library search path directory from LLVM linker's Library search path Option for every project in the workspace that use LLVM Toolchain and for for every - build configuration. -

    -

    -
    Parameters:
    libDir - Library search path directory for LLVM linker's Library search path Option
    -
    -
    -
    - -

    -addPathToToolOption

    -
    -private static void addPathToToolOption(java.lang.String path,
    -                                        int var)
    -
    -
    Adds a path to Tool option. -

    -

    -
    Parameters:
    path - Path to add to Tool option
    var - Tool option's value
    -
    -
    -
    - -

    -removePathFromToolOption

    -
    -private static void removePathFromToolOption(java.lang.String path,
    -                                             int var)
    -
    -
    Removes a path from Tool option. -

    -

    -
    Parameters:
    path - Path to remove from Tool option
    var - Tool option's value
    -
    -
    -
    - -

    -addPathToSelectedToolOptionBuildConf

    -
    -private static boolean addPathToSelectedToolOptionBuildConf(org.eclipse.cdt.managedbuilder.core.IConfiguration cf,
    -                                                            java.lang.String path,
    -                                                            int var)
    -
    -
    Add a path to specific build configuration's Tool option. -

    -

    -
    Parameters:
    cf - Build configuration
    path - Path or file name to add
    var - Value of the option type -
    Returns:
    boolean True if path was added successfully
    -
    -
    -
    - -

    -removePathFromSelectedToolOptionBuildConf

    -
    -private static boolean removePathFromSelectedToolOptionBuildConf(org.eclipse.cdt.managedbuilder.core.IConfiguration cf,
    -                                                                 java.lang.String path,
    -                                                                 int var)
    -
    -
    Removes a path from specific build configuration's Tool option. -

    -

    -
    Parameters:
    cf - Build configuration
    path - Path or file name to remove
    var - Value of the option type -
    Returns:
    boolean True if path was removed successfully
    -
    -
    -
    - -

    -getProjectsInWorkspace

    -
    -public static org.eclipse.core.resources.IProject[] getProjectsInWorkspace()
    -
    -
    Returns all projects in the workspace. -

    -

    - -
    Returns:
    IProject[]
    -
    -
    -
    - -

    -getAllBuildConfigs

    -
    -private static org.eclipse.cdt.managedbuilder.core.IConfiguration[] getAllBuildConfigs(org.eclipse.core.resources.IProject proj)
    -
    -
    Returns all build configurations of the project. -

    -

    -
    Parameters:
    proj - IProject Project -
    Returns:
    IConfiguration[] Build configurations
    -
    -
    -
    - -

    -addLlvmIncludePathToToolOption

    -
    -private static boolean addLlvmIncludePathToToolOption(org.eclipse.cdt.managedbuilder.core.IConfiguration cf,
    -                                                      java.lang.String newIncludePath)
    -
    -
    Adds an include path to LLVM front-end's include path option. -

    -

    -
    Parameters:
    cf - IConfiguration Build configuration
    newIncludePath - Include path to be added to LLVM front-end's Include path option
    -
    -
    -
    - -

    -removeLlvmIncludePathFromToolOption

    -
    -private static boolean removeLlvmIncludePathFromToolOption(org.eclipse.cdt.managedbuilder.core.IConfiguration cf,
    -                                                           java.lang.String removeIncludePath)
    -
    -
    Removes an include path from LLVM front-end's include path option. -

    -

    -
    Parameters:
    cf - IConfiguration Build configuration
    removeIncludePath - Include path to be removed from LLVM front-end's Include path option
    -
    -
    -
    - -

    -addLlvmLibToToolOption

    -
    -private static boolean addLlvmLibToToolOption(org.eclipse.cdt.managedbuilder.core.IConfiguration cf,
    -                                              java.lang.String lib)
    -
    -
    Adds a Library to LLVM linker's Libraries Option. -

    -

    -
    Parameters:
    cf - IConfiguration Build configuration
    lib - Library name -
    Returns:
    boolean Returns true if Library Option was added successfully for the LLVM Linker.
    -
    -
    -
    - -

    -removeLlvmLibFromToolOption

    -
    -private static boolean removeLlvmLibFromToolOption(org.eclipse.cdt.managedbuilder.core.IConfiguration cf,
    -                                                   java.lang.String removeLib)
    -
    -
    Removes a Library from LLVM linker's Libraries Option. -

    -

    -
    Parameters:
    cf - IConfiguration Build configuration
    removeLib - Library name -
    Returns:
    boolean Returns true if Library Option was removed successfully from the LLVM Linker.
    -
    -
    -
    - -

    -addLlvmLibSearchPathToToolOption

    -
    -private static boolean addLlvmLibSearchPathToToolOption(org.eclipse.cdt.managedbuilder.core.IConfiguration cf,
    -                                                        java.lang.String libDir)
    -
    -
    Adds a Library search path to LLVM linker's Library search path Option. -

    -

    -
    Parameters:
    cf - IConfiguration Build configuration
    libDir - Library search path -
    Returns:
    boolean Returns true if Library search path Option was added successfully for the LLVM Linker.
    -
    -
    -
    - -

    -removeLlvmLibSearchPathFromToolOption

    -
    -private static boolean removeLlvmLibSearchPathFromToolOption(org.eclipse.cdt.managedbuilder.core.IConfiguration cf,
    -                                                             java.lang.String removeLibDir)
    -
    -
    Removes a Library search path from LLVM linker's Library search path Option. -

    -

    -
    Parameters:
    cf - IConfiguration Build configuration
    removeLibDir - Library search path -
    Returns:
    boolean Returns true if Library search path Option was removed successfully from the LLVM Linker.
    -
    -
    -
    - -

    -addIncludePathToToolOption

    -
    -private static void addIncludePathToToolOption(org.eclipse.cdt.managedbuilder.core.IConfiguration cf,
    -                                               org.eclipse.cdt.managedbuilder.core.ITool cfTool,
    -                                               org.eclipse.cdt.managedbuilder.core.IOption option,
    -                                               java.lang.String newIncludePath)
    -
    -
    Adds include path for given Build configuration's Tool's Include path Option. -

    -

    -
    Parameters:
    cf - IConfiguration Build configuration
    cfTool - ITool Tool
    option - Tool Option type
    newIncludePath - Include path to be added to Tool's Include path option
    -
    -
    -
    - -

    -removeIncludePathFromToolOption

    -
    -private static void removeIncludePathFromToolOption(org.eclipse.cdt.managedbuilder.core.IConfiguration cf,
    -                                                    org.eclipse.cdt.managedbuilder.core.ITool cfTool,
    -                                                    org.eclipse.cdt.managedbuilder.core.IOption option,
    -                                                    java.lang.String removeIncludePath)
    -
    -
    Removes an include path from given Build configuration's Tool's Include path Option. -

    -

    -
    Parameters:
    cf - IConfiguration Build configuration
    cfTool - ITool Tool
    option - Tool Option type
    removeIncludePath - Include path to be removed from Tool's Include path option
    -
    -
    -
    - -

    -addLibraryToToolOption

    -
    -private static void addLibraryToToolOption(org.eclipse.cdt.managedbuilder.core.IConfiguration cf,
    -                                           org.eclipse.cdt.managedbuilder.core.ITool cfTool,
    -                                           org.eclipse.cdt.managedbuilder.core.IOption option,
    -                                           java.lang.String newLibrary)
    -
    -
    Adds new Library for the Linker's Libraries Option. -

    -

    -
    Parameters:
    cf - IConfiguration Build configuration
    cfTool - ITool Tool
    option - Tool Option type
    newLibrary - Library
    -
    -
    -
    - -

    -removeLibraryFromToolOption

    -
    -private static void removeLibraryFromToolOption(org.eclipse.cdt.managedbuilder.core.IConfiguration cf,
    -                                                org.eclipse.cdt.managedbuilder.core.ITool cfTool,
    -                                                org.eclipse.cdt.managedbuilder.core.IOption option,
    -                                                java.lang.String removeLibrary)
    -
    -
    Removes a new Library from the Linker's Libraries Option. -

    -

    -
    Parameters:
    cf - IConfiguration Build configuration
    cfTool - ITool Tool
    option - Tool Option type
    removeLibrary - Library
    -
    -
    -
    - -

    -addLibrarySearchPathToToolOption

    -
    -private static void addLibrarySearchPathToToolOption(org.eclipse.cdt.managedbuilder.core.IConfiguration cf,
    -                                                     org.eclipse.cdt.managedbuilder.core.ITool cfTool,
    -                                                     org.eclipse.cdt.managedbuilder.core.IOption option,
    -                                                     java.lang.String newSearchPath)
    -
    -
    Adds new Library search path for the Linker's Library search path Option. -

    -

    -
    Parameters:
    cf - IConfiguration Build configuration
    cfTool - ITool Tool
    option - Tool Option type
    newSearchPath - Library search path
    -
    -
    -
    - -

    -removeLibrarySearchPathFromToolOption

    -
    -private static void removeLibrarySearchPathFromToolOption(org.eclipse.cdt.managedbuilder.core.IConfiguration cf,
    -                                                          org.eclipse.cdt.managedbuilder.core.ITool cfTool,
    -                                                          org.eclipse.cdt.managedbuilder.core.IOption option,
    -                                                          java.lang.String removeSearchPath)
    -
    + build configuration. +

    +

    +
    Parameters:
    libDir - Library search path directory for LLVM linker's Library search path Option
    +
    +
    +
    + +

    +addPathToToolOption

    +
    +private static void addPathToToolOption(java.lang.String path,
    +                                        int var)
    +
    +
    Adds a path to Tool option. +

    +

    +
    Parameters:
    path - Path to add to Tool option
    var - Tool option's value
    +
    +
    +
    + +

    +removePathFromToolOption

    +
    +private static void removePathFromToolOption(java.lang.String path,
    +                                             int var)
    +
    +
    Removes a path from Tool option. +

    +

    +
    Parameters:
    path - Path to remove from Tool option
    var - Tool option's value
    +
    +
    +
    + +

    +addPathToSelectedToolOptionBuildConf

    +
    +private static boolean addPathToSelectedToolOptionBuildConf(org.eclipse.cdt.managedbuilder.core.IConfiguration cf,
    +                                                            java.lang.String path,
    +                                                            int var)
    +
    +
    Add a path to specific build configuration's Tool option. +

    +

    +
    Parameters:
    cf - Build configuration
    path - Path or file name to add
    var - Value of the option type +
    Returns:
    boolean True if path was added successfully
    +
    +
    +
    + +

    +removePathFromSelectedToolOptionBuildConf

    +
    +private static boolean removePathFromSelectedToolOptionBuildConf(org.eclipse.cdt.managedbuilder.core.IConfiguration cf,
    +                                                                 java.lang.String path,
    +                                                                 int var)
    +
    +
    Removes a path from specific build configuration's Tool option. +

    +

    +
    Parameters:
    cf - Build configuration
    path - Path or file name to remove
    var - Value of the option type +
    Returns:
    boolean True if path was removed successfully
    +
    +
    +
    + +

    +getProjectsInWorkspace

    +
    +public static org.eclipse.core.resources.IProject[] getProjectsInWorkspace()
    +
    +
    Returns all projects in the workspace. +

    +

    + +
    Returns:
    IProject[]
    +
    +
    +
    + +

    +getAllBuildConfigs

    +
    +private static org.eclipse.cdt.managedbuilder.core.IConfiguration[] getAllBuildConfigs(org.eclipse.core.resources.IProject proj)
    +
    +
    Returns all build configurations of the project. +

    +

    +
    Parameters:
    proj - IProject Project +
    Returns:
    IConfiguration[] Build configurations
    +
    +
    +
    + +

    +addLlvmIncludePathToToolOption

    +
    +private static boolean addLlvmIncludePathToToolOption(org.eclipse.cdt.managedbuilder.core.IConfiguration cf,
    +                                                      java.lang.String newIncludePath)
    +
    +
    Adds an include path to LLVM front-end's include path option. +

    +

    +
    Parameters:
    cf - IConfiguration Build configuration
    newIncludePath - Include path to be added to LLVM front-end's Include path option
    +
    +
    +
    + +

    +removeLlvmIncludePathFromToolOption

    +
    +private static boolean removeLlvmIncludePathFromToolOption(org.eclipse.cdt.managedbuilder.core.IConfiguration cf,
    +                                                           java.lang.String removeIncludePath)
    +
    +
    Removes an include path from LLVM front-end's include path option. +

    +

    +
    Parameters:
    cf - IConfiguration Build configuration
    removeIncludePath - Include path to be removed from LLVM front-end's Include path option
    +
    +
    +
    + +

    +addLlvmLibToToolOption

    +
    +private static boolean addLlvmLibToToolOption(org.eclipse.cdt.managedbuilder.core.IConfiguration cf,
    +                                              java.lang.String lib)
    +
    +
    Adds a Library to LLVM linker's Libraries Option. +

    +

    +
    Parameters:
    cf - IConfiguration Build configuration
    lib - Library name +
    Returns:
    boolean Returns true if Library Option was added successfully for the LLVM Linker.
    +
    +
    +
    + +

    +removeLlvmLibFromToolOption

    +
    +private static boolean removeLlvmLibFromToolOption(org.eclipse.cdt.managedbuilder.core.IConfiguration cf,
    +                                                   java.lang.String removeLib)
    +
    +
    Removes a Library from LLVM linker's Libraries Option. +

    +

    +
    Parameters:
    cf - IConfiguration Build configuration
    removeLib - Library name +
    Returns:
    boolean Returns true if Library Option was removed successfully from the LLVM Linker.
    +
    +
    +
    + +

    +addLlvmLibSearchPathToToolOption

    +
    +private static boolean addLlvmLibSearchPathToToolOption(org.eclipse.cdt.managedbuilder.core.IConfiguration cf,
    +                                                        java.lang.String libDir)
    +
    +
    Adds a Library search path to LLVM linker's Library search path Option. +

    +

    +
    Parameters:
    cf - IConfiguration Build configuration
    libDir - Library search path +
    Returns:
    boolean Returns true if Library search path Option was added successfully for the LLVM Linker.
    +
    +
    +
    + +

    +removeLlvmLibSearchPathFromToolOption

    +
    +private static boolean removeLlvmLibSearchPathFromToolOption(org.eclipse.cdt.managedbuilder.core.IConfiguration cf,
    +                                                             java.lang.String removeLibDir)
    +
    +
    Removes a Library search path from LLVM linker's Library search path Option. +

    +

    +
    Parameters:
    cf - IConfiguration Build configuration
    removeLibDir - Library search path +
    Returns:
    boolean Returns true if Library search path Option was removed successfully from the LLVM Linker.
    +
    +
    +
    + +

    +addIncludePathToToolOption

    +
    +private static void addIncludePathToToolOption(org.eclipse.cdt.managedbuilder.core.IConfiguration cf,
    +                                               org.eclipse.cdt.managedbuilder.core.ITool cfTool,
    +                                               org.eclipse.cdt.managedbuilder.core.IOption option,
    +                                               java.lang.String newIncludePath)
    +
    +
    Adds include path for given Build configuration's Tool's Include path Option. +

    +

    +
    Parameters:
    cf - IConfiguration Build configuration
    cfTool - ITool Tool
    option - Tool Option type
    newIncludePath - Include path to be added to Tool's Include path option
    +
    +
    +
    + +

    +removeIncludePathFromToolOption

    +
    +private static void removeIncludePathFromToolOption(org.eclipse.cdt.managedbuilder.core.IConfiguration cf,
    +                                                    org.eclipse.cdt.managedbuilder.core.ITool cfTool,
    +                                                    org.eclipse.cdt.managedbuilder.core.IOption option,
    +                                                    java.lang.String removeIncludePath)
    +
    +
    Removes an include path from given Build configuration's Tool's Include path Option. +

    +

    +
    Parameters:
    cf - IConfiguration Build configuration
    cfTool - ITool Tool
    option - Tool Option type
    removeIncludePath - Include path to be removed from Tool's Include path option
    +
    +
    +
    + +

    +addLibraryToToolOption

    +
    +private static void addLibraryToToolOption(org.eclipse.cdt.managedbuilder.core.IConfiguration cf,
    +                                           org.eclipse.cdt.managedbuilder.core.ITool cfTool,
    +                                           org.eclipse.cdt.managedbuilder.core.IOption option,
    +                                           java.lang.String newLibrary)
    +
    +
    Adds new Library for the Linker's Libraries Option. +

    +

    +
    Parameters:
    cf - IConfiguration Build configuration
    cfTool - ITool Tool
    option - Tool Option type
    newLibrary - Library
    +
    +
    +
    + +

    +removeLibraryFromToolOption

    +
    +private static void removeLibraryFromToolOption(org.eclipse.cdt.managedbuilder.core.IConfiguration cf,
    +                                                org.eclipse.cdt.managedbuilder.core.ITool cfTool,
    +                                                org.eclipse.cdt.managedbuilder.core.IOption option,
    +                                                java.lang.String removeLibrary)
    +
    +
    Removes a new Library from the Linker's Libraries Option. +

    +

    +
    Parameters:
    cf - IConfiguration Build configuration
    cfTool - ITool Tool
    option - Tool Option type
    removeLibrary - Library
    +
    +
    +
    + +

    +addLibrarySearchPathToToolOption

    +
    +private static void addLibrarySearchPathToToolOption(org.eclipse.cdt.managedbuilder.core.IConfiguration cf,
    +                                                     org.eclipse.cdt.managedbuilder.core.ITool cfTool,
    +                                                     org.eclipse.cdt.managedbuilder.core.IOption option,
    +                                                     java.lang.String newSearchPath)
    +
    +
    Adds new Library search path for the Linker's Library search path Option. +

    +

    +
    Parameters:
    cf - IConfiguration Build configuration
    cfTool - ITool Tool
    option - Tool Option type
    newSearchPath - Library search path
    +
    +
    +
    + +

    +removeLibrarySearchPathFromToolOption

    +
    +private static void removeLibrarySearchPathFromToolOption(org.eclipse.cdt.managedbuilder.core.IConfiguration cf,
    +                                                          org.eclipse.cdt.managedbuilder.core.ITool cfTool,
    +                                                          org.eclipse.cdt.managedbuilder.core.IOption option,
    +                                                          java.lang.String removeSearchPath)
    +
    Removes a Library search path from the Linker's Library search path Option. - Since CDT 8.0 (Bugzilla Bug 321040) -

    -

    -
    Parameters:
    cf - IConfiguration Build configuration
    cfTool - ITool Tool
    option - Tool Option type
    removeSearchPath - Library search path
    -
    -
    -
    - -

    -addInputToToolOption

    -
    -private static void addInputToToolOption(org.eclipse.cdt.managedbuilder.core.IConfiguration cf,
    -                                         org.eclipse.cdt.managedbuilder.core.ITool cfTool,
    -                                         org.eclipse.cdt.managedbuilder.core.IOption option,
    -                                         java.lang.String newValue,
    -                                         java.lang.String[] existingValues)
    -
    -
    Adds a new value to specific Option. -

    -

    -
    Parameters:
    cf - IConfiguration Build configuration
    cfTool - ITool Tool
    option - Tool Option type
    newValue - New value to be added to the Option type
    existingValues - Existing Option type values
    -
    -
    -
    - -

    -removeInputFromToolOption

    -
    -private static void removeInputFromToolOption(org.eclipse.cdt.managedbuilder.core.IConfiguration cf,
    -                                              org.eclipse.cdt.managedbuilder.core.ITool cfTool,
    -                                              org.eclipse.cdt.managedbuilder.core.IOption option,
    -                                              java.lang.String removeValue,
    -                                              java.lang.String[] existingValues)
    -
    -
    Removes a value from a specific Option. -

    -

    -
    Parameters:
    cf - IConfiguration Build configuration
    cfTool - ITool Tool
    option - Tool Option type
    removeValue - Value to be removed from the Option type
    existingValues - Existing Option type values
    -
    -
    -
    - -

    -getLlvmFrontEnd

    -
    -private static org.eclipse.cdt.managedbuilder.core.ITool getLlvmFrontEnd(org.eclipse.cdt.managedbuilder.core.IConfiguration cf)
    -
    -
    Return LLVM front-end according to the input type. -

    -

    -
    Parameters:
    cf - IConfiguration Build configuration -
    Returns:
    ITool LLVM front-end
    -
    -
    -
    - -

    -getLlvmLinker

    -
    -private static org.eclipse.cdt.managedbuilder.core.ITool getLlvmLinker(org.eclipse.cdt.managedbuilder.core.IConfiguration cf)
    -
    -
    Returns LLVM linker. -

    -

    -
    Parameters:
    cf - IConfiguration Build configuration -
    Returns:
    ITool LLVM linker
    -
    -
    -
    - -

    -getIToolByInputType

    -
    -private static org.eclipse.cdt.managedbuilder.core.ITool getIToolByInputType(org.eclipse.cdt.managedbuilder.core.IConfiguration cf,
    -                                                                             java.lang.String ext)
    -
    -
    Returns ITool associated with the input extension. -

    -

    -
    Parameters:
    cf - IConfiguration Build configuration
    ext - input extension associated with ITool -
    Returns:
    ITool Tool that matches input extension
    -
    -
    -
    - -

    -getLlvmFrontEndIncludePathOption

    -
    -private static org.eclipse.cdt.managedbuilder.core.IOption getLlvmFrontEndIncludePathOption(org.eclipse.cdt.managedbuilder.core.IConfiguration cf)
    -
    -
    Returns LLVM front-end Include path Option type. -

    -

    -
    Parameters:
    cf - IConfiguration Project build configuration -
    Returns:
    IOption Tool option type
    -
    -
    -
    - -

    -getLlvmLinkerLibrariesOption

    -
    -private static org.eclipse.cdt.managedbuilder.core.IOption getLlvmLinkerLibrariesOption(org.eclipse.cdt.managedbuilder.core.IConfiguration cf)
    -
    -
    Returns LLVM Linker Libraries Option type. -

    -

    -
    Parameters:
    cf - IConfiguration Project build configuration -
    Returns:
    IOption Tool option type
    -
    -
    -
    - -

    -getLlvmLinkerLibrarySearchPathOption

    -
    -private static org.eclipse.cdt.managedbuilder.core.IOption getLlvmLinkerLibrarySearchPathOption(org.eclipse.cdt.managedbuilder.core.IConfiguration cf)
    -
    -
    Returns LLVM Linker Library search path Option type. -

    -

    -
    Parameters:
    cf - IConfiguration Project build configuration -
    Returns:
    IOption Tool option type
    -
    -
    -
    - -

    -getOptionId

    -
    -private static java.lang.String getOptionId(org.eclipse.cdt.managedbuilder.core.ITool cfTool,
    -                                            int optionValueType)
    -
    -
    Returns Tool's option id. -

    -

    -
    Parameters:
    cfTool - ITool Tool
    optionValueType - Option's value type. -
    Returns:
    optionId Tool's option id.
    -
    -
    -
    - -

    -getIToolPathOption

    -
    -private static org.eclipse.cdt.managedbuilder.core.IOption getIToolPathOption(org.eclipse.cdt.managedbuilder.core.ITool cfTool,
    -                                                                              java.lang.String optionId)
    -
    -
    Returns Tool's Option type by Id. -

    -

    -
    Parameters:
    cfTool - ITool Tool
    optionId - String Tool option type id -
    Returns:
    IOption Tool option type
    -
    -
    -
    - -

    -addNewPathToExistingPathList

    -
    -public static java.lang.String[] addNewPathToExistingPathList(java.lang.String[] existingPaths,
    -                                                              java.lang.String newPath)
    -
    -
    Adds one or more paths to the list of paths. -

    -

    + Since CDT 8.0 (Bugzilla Bug 321040) +

    +

    +
    Parameters:
    cf - IConfiguration Build configuration
    cfTool - ITool Tool
    option - Tool Option type
    removeSearchPath - Library search path
    +
    +
    +
    + +

    +addInputToToolOption

    +
    +private static void addInputToToolOption(org.eclipse.cdt.managedbuilder.core.IConfiguration cf,
    +                                         org.eclipse.cdt.managedbuilder.core.ITool cfTool,
    +                                         org.eclipse.cdt.managedbuilder.core.IOption option,
    +                                         java.lang.String newValue,
    +                                         java.lang.String[] existingValues)
    +
    +
    Adds a new value to specific Option. +

    +

    +
    Parameters:
    cf - IConfiguration Build configuration
    cfTool - ITool Tool
    option - Tool Option type
    newValue - New value to be added to the Option type
    existingValues - Existing Option type values
    +
    +
    +
    + +

    +removeInputFromToolOption

    +
    +private static void removeInputFromToolOption(org.eclipse.cdt.managedbuilder.core.IConfiguration cf,
    +                                              org.eclipse.cdt.managedbuilder.core.ITool cfTool,
    +                                              org.eclipse.cdt.managedbuilder.core.IOption option,
    +                                              java.lang.String removeValue,
    +                                              java.lang.String[] existingValues)
    +
    +
    Removes a value from a specific Option. +

    +

    +
    Parameters:
    cf - IConfiguration Build configuration
    cfTool - ITool Tool
    option - Tool Option type
    removeValue - Value to be removed from the Option type
    existingValues - Existing Option type values
    +
    +
    +
    + +

    +getLlvmFrontEnd

    +
    +private static org.eclipse.cdt.managedbuilder.core.ITool getLlvmFrontEnd(org.eclipse.cdt.managedbuilder.core.IConfiguration cf)
    +
    +
    Return LLVM front-end according to the input type. +

    +

    +
    Parameters:
    cf - IConfiguration Build configuration +
    Returns:
    ITool LLVM front-end
    +
    +
    +
    + +

    +getLlvmLinker

    +
    +private static org.eclipse.cdt.managedbuilder.core.ITool getLlvmLinker(org.eclipse.cdt.managedbuilder.core.IConfiguration cf)
    +
    +
    Returns LLVM linker. +

    +

    +
    Parameters:
    cf - IConfiguration Build configuration +
    Returns:
    ITool LLVM linker
    +
    +
    +
    + +

    +getIToolByInputType

    +
    +private static org.eclipse.cdt.managedbuilder.core.ITool getIToolByInputType(org.eclipse.cdt.managedbuilder.core.IConfiguration cf,
    +                                                                             java.lang.String ext)
    +
    +
    Returns ITool associated with the input extension. +

    +

    +
    Parameters:
    cf - IConfiguration Build configuration
    ext - input extension associated with ITool +
    Returns:
    ITool Tool that matches input extension
    +
    +
    +
    + +

    +getLlvmFrontEndIncludePathOption

    +
    +private static org.eclipse.cdt.managedbuilder.core.IOption getLlvmFrontEndIncludePathOption(org.eclipse.cdt.managedbuilder.core.IConfiguration cf)
    +
    +
    Returns LLVM front-end Include path Option type. +

    +

    +
    Parameters:
    cf - IConfiguration Project build configuration +
    Returns:
    IOption Tool option type
    +
    +
    +
    + +

    +getLlvmLinkerLibrariesOption

    +
    +private static org.eclipse.cdt.managedbuilder.core.IOption getLlvmLinkerLibrariesOption(org.eclipse.cdt.managedbuilder.core.IConfiguration cf)
    +
    +
    Returns LLVM Linker Libraries Option type. +

    +

    +
    Parameters:
    cf - IConfiguration Project build configuration +
    Returns:
    IOption Tool option type
    +
    +
    +
    + +

    +getLlvmLinkerLibrarySearchPathOption

    +
    +private static org.eclipse.cdt.managedbuilder.core.IOption getLlvmLinkerLibrarySearchPathOption(org.eclipse.cdt.managedbuilder.core.IConfiguration cf)
    +
    +
    Returns LLVM Linker Library search path Option type. +

    +

    +
    Parameters:
    cf - IConfiguration Project build configuration +
    Returns:
    IOption Tool option type
    +
    +
    +
    + +

    +getOptionId

    +
    +private static java.lang.String getOptionId(org.eclipse.cdt.managedbuilder.core.ITool cfTool,
    +                                            int optionValueType)
    +
    +
    Returns Tool's option id. +

    +

    +
    Parameters:
    cfTool - ITool Tool
    optionValueType - Option's value type. +
    Returns:
    optionId Tool's option id.
    +
    +
    +
    + +

    +getIToolPathOption

    +
    +private static org.eclipse.cdt.managedbuilder.core.IOption getIToolPathOption(org.eclipse.cdt.managedbuilder.core.ITool cfTool,
    +                                                                              java.lang.String optionId)
    +
    +
    Returns Tool's Option type by Id. +

    +

    +
    Parameters:
    cfTool - ITool Tool
    optionId - String Tool option type id +
    Returns:
    IOption Tool option type
    +
    +
    +
    + +

    +addNewPathToExistingPathList

    +
    +public static java.lang.String[] addNewPathToExistingPathList(java.lang.String[] existingPaths,
    +                                                              java.lang.String newPath)
    +
    +
    Adds one or more paths to the list of paths. +

    +

    Parameters:
    existingPaths - Existing list of paths to add to
    newPath - New path to add. May include multiple directories with a path delimiter java.io.File.pathSeparator - (usually semicolon (Win) or colon (Linux/Mac), OS specific) -
    Returns:
    String[] List that includes existing paths as well as new paths.
    -
    -
    -
    - -

    -removePathFromExistingPathList

    -
    -public static java.lang.String[] removePathFromExistingPathList(java.lang.String[] existingPaths,
    -                                                                java.lang.String removePath)
    -
    -
    Removes one path from the list of paths. -

    -

    -
    Parameters:
    existingPaths - Existing list of paths to remove from
    removePath - Path to be removed. -
    Returns:
    String[] List that includes existing paths without the path that was removed.
    -
    -
    -
    - -

    -stringToArray

    -
    -public static java.lang.String[] stringToArray(java.lang.String str)
    -
    -
    Split paths to a String array. -

    -

    -
    Parameters:
    str - String of paths separated by a path separator. -
    Returns:
    String array containing multiple paths.
    -
    -
    -
    - -

    -arrayToString

    -
    -public static java.lang.String arrayToString(java.lang.String[] array)
    -
    -
    Append an array of Strings to a String separated by a path separator. -

    -

    -
    Parameters:
    array - An array of Strings. + (usually semicolon (Win) or colon (Linux/Mac), OS specific) +
    Returns:
    String[] List that includes existing paths as well as new paths.
    +
    +
    +
    + +

    +removePathFromExistingPathList

    +
    +public static java.lang.String[] removePathFromExistingPathList(java.lang.String[] existingPaths,
    +                                                                java.lang.String removePath)
    +
    +
    Removes one path from the list of paths. +

    +

    +
    Parameters:
    existingPaths - Existing list of paths to remove from
    removePath - Path to be removed. +
    Returns:
    String[] List that includes existing paths without the path that was removed.
    +
    +
    +
    + +

    +stringToArray

    +
    +public static java.lang.String[] stringToArray(java.lang.String str)
    +
    +
    Split paths to a String array. +

    +

    +
    Parameters:
    str - String of paths separated by a path separator. +
    Returns:
    String array containing multiple paths.
    +
    +
    +
    + +

    +arrayToString

    +
    +public static java.lang.String arrayToString(java.lang.String[] array)
    +
    +
    Append an array of Strings to a String separated by a path separator. +

    +

    +
    Parameters:
    array - An array of Strings.
    Returns:
    string which contains all indexes of - a String array separated by a path separator.
    -
    -
    -
    - -

    -pathExists

    -
    -private static boolean pathExists(java.lang.String path)
    -
    -
    Checks if a file path exists. -

    -

    - -
    Returns:
    boolean True if the file exists.
    -
    -
    - -
    - - - - - - - - - - - - - - - - - - - -
    - -
    - - - -
    - - - + a String array separated by a path separator.
    + + +
    + +

    +pathExists

    +
    +private static boolean pathExists(java.lang.String path)
    +
    +
    Checks if a file path exists. +

    +

    + +
    Returns:
    boolean True if the file exists.
    +
    +
    + +
    + + + + + + + + + + + + + + + + + + + +
    + +
    + + + +
    + + + diff --git a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/util/Separators.html b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/util/Separators.html index 835247dcda3..bbec29d740a 100644 --- a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/util/Separators.html +++ b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/util/Separators.html @@ -1,335 +1,335 @@ - - - - - - -Separators - - - - - - - - - - - - -
    - - - - - - - - - - - - - - - - - - - -
    - -
    - - - -
    - -

    - -org.eclipse.cdt.managedbuilder.llvm.util -
    -Class Separators

    -
    -java.lang.Object
    -  extended by org.eclipse.cdt.managedbuilder.llvm.util.Separators
    -
    -
    -
    -
    public class Separators
    extends java.lang.Object
    - - -

    -Provides different separators such as file and path separators. -

    - -

    -


    - -

    - - - - - - - - - - - - - - - -
    -Field Summary
    -private static java.lang.StringfileSeparator - -
    -           
    -private static java.lang.StringpathSeparator - -
    -           
    -  - - - - - - - - - - -
    -Constructor Summary
    Separators() - -
    -           
    -  - - - - - - - - - - - - - - - -
    -Method Summary
    -static java.lang.StringgetFileSeparator() - -
    -          Get file separator.
    -static java.lang.StringgetPathSeparator() - -
    -          Get path separator.
    - - - - - - - -
    Methods inherited from class java.lang.Object
    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    -  -

    - - - - - - - - -
    -Field Detail
    - -

    -pathSeparator

    -
    -private static java.lang.String pathSeparator
    -
    -
    -
    -
    -
    - -

    -fileSeparator

    -
    -private static java.lang.String fileSeparator
    -
    -
    -
    -
    - - - - - - - - -
    -Constructor Detail
    - -

    -Separators

    -
    -public Separators()
    -
    -
    - - - - - - - - -
    -Method Detail
    - -

    -getPathSeparator

    -
    -public static java.lang.String getPathSeparator()
    -
    -
    Get path separator. -

    -

    - -
    Returns:
    path separator
    -
    -
    -
    - -

    -getFileSeparator

    -
    -public static java.lang.String getFileSeparator()
    -
    -
    Get file separator. -

    -

    - -
    Returns:
    file separator
    -
    -
    - -
    - - - - - - - - - - - - - - - - - - - -
    - -
    - - - -
    - - - + + + + + + +Separators + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + + + + + +
    + +
    + + + +
    + +

    + +org.eclipse.cdt.managedbuilder.llvm.util +
    +Class Separators

    +
    +java.lang.Object
    +  extended by org.eclipse.cdt.managedbuilder.llvm.util.Separators
    +
    +
    +
    +
    public class Separators
    extends java.lang.Object
    + + +

    +Provides different separators such as file and path separators. +

    + +

    +


    + +

    + + + + + + + + + + + + + + + +
    +Field Summary
    +private static java.lang.StringfileSeparator + +
    +           
    +private static java.lang.StringpathSeparator + +
    +           
    +  + + + + + + + + + + +
    +Constructor Summary
    Separators() + +
    +           
    +  + + + + + + + + + + + + + + + +
    +Method Summary
    +static java.lang.StringgetFileSeparator() + +
    +          Get file separator.
    +static java.lang.StringgetPathSeparator() + +
    +          Get path separator.
    + + + + + + + +
    Methods inherited from class java.lang.Object
    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    +  +

    + + + + + + + + +
    +Field Detail
    + +

    +pathSeparator

    +
    +private static java.lang.String pathSeparator
    +
    +
    +
    +
    +
    + +

    +fileSeparator

    +
    +private static java.lang.String fileSeparator
    +
    +
    +
    +
    + + + + + + + + +
    +Constructor Detail
    + +

    +Separators

    +
    +public Separators()
    +
    +
    + + + + + + + + +
    +Method Detail
    + +

    +getPathSeparator

    +
    +public static java.lang.String getPathSeparator()
    +
    +
    Get path separator. +

    +

    + +
    Returns:
    path separator
    +
    +
    +
    + +

    +getFileSeparator

    +
    +public static java.lang.String getFileSeparator()
    +
    +
    Get file separator. +

    +

    + +
    Returns:
    file separator
    +
    +
    + +
    + + + + + + + + + + + + + + + + + + + +
    + +
    + + + +
    + + + diff --git a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/util/class-use/LlvmToolOptionPathUtil.html b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/util/class-use/LlvmToolOptionPathUtil.html index dbc4bdc0d95..c3be1244865 100644 --- a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/util/class-use/LlvmToolOptionPathUtil.html +++ b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/util/class-use/LlvmToolOptionPathUtil.html @@ -1,144 +1,144 @@ - - - - - - -Uses of Class org.eclipse.cdt.managedbuilder.llvm.util.LlvmToolOptionPathUtil - - - - - - - - - - - - -
    - - - - - - - - - - - - - - - -
    - -
    - - - -
    -
    -

    -Uses of Class
    org.eclipse.cdt.managedbuilder.llvm.util.LlvmToolOptionPathUtil

    -
    -No usage of org.eclipse.cdt.managedbuilder.llvm.util.LlvmToolOptionPathUtil -

    -


    - - - - - - - - - - - - - - - -
    - -
    - - - -
    - - - + + + + + + +Uses of Class org.eclipse.cdt.managedbuilder.llvm.util.LlvmToolOptionPathUtil + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + +
    + +
    + + + +
    +
    +

    +Uses of Class
    org.eclipse.cdt.managedbuilder.llvm.util.LlvmToolOptionPathUtil

    +
    +No usage of org.eclipse.cdt.managedbuilder.llvm.util.LlvmToolOptionPathUtil +

    +


    + + + + + + + + + + + + + + + +
    + +
    + + + +
    + + + diff --git a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/util/class-use/Separators.html b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/util/class-use/Separators.html index 422ea345c56..5c5193dfa31 100644 --- a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/util/class-use/Separators.html +++ b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/util/class-use/Separators.html @@ -1,144 +1,144 @@ - - - - - - -Uses of Class org.eclipse.cdt.managedbuilder.llvm.util.Separators - - - - - - - - - - - - -
    - - - - - - - - - - - - - - - -
    - -
    - - - -
    -
    -

    -Uses of Class
    org.eclipse.cdt.managedbuilder.llvm.util.Separators

    -
    -No usage of org.eclipse.cdt.managedbuilder.llvm.util.Separators -

    -


    - - - - - - - - - - - - - - - -
    - -
    - - - -
    - - - + + + + + + +Uses of Class org.eclipse.cdt.managedbuilder.llvm.util.Separators + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + +
    + +
    + + + +
    +
    +

    +Uses of Class
    org.eclipse.cdt.managedbuilder.llvm.util.Separators

    +
    +No usage of org.eclipse.cdt.managedbuilder.llvm.util.Separators +

    +


    + + + + + + + + + + + + + + + +
    + +
    + + + +
    + + + diff --git a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/util/package-frame.html b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/util/package-frame.html index 0586374efa5..17f027ef44e 100644 --- a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/util/package-frame.html +++ b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/util/package-frame.html @@ -1,34 +1,34 @@ - - - - - - -org.eclipse.cdt.managedbuilder.llvm.util - - - - - - - - - - - -org.eclipse.cdt.managedbuilder.llvm.util - - - - -
    -Classes  - -
    -LlvmToolOptionPathUtil -
    -Separators
    - - - - + + + + + + +org.eclipse.cdt.managedbuilder.llvm.util + + + + + + + + + + + +org.eclipse.cdt.managedbuilder.llvm.util + + + + +
    +Classes  + +
    +LlvmToolOptionPathUtil +
    +Separators
    + + + + diff --git a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/util/package-summary.html b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/util/package-summary.html index 1126c90b48b..72ddad1f50c 100644 --- a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/util/package-summary.html +++ b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/util/package-summary.html @@ -1,163 +1,163 @@ - - - - - - -org.eclipse.cdt.managedbuilder.llvm.util - - - - - - - - - - - - -
    - - - - - - - - - - - - - - - -
    - -
    - - - -
    -

    -Package org.eclipse.cdt.managedbuilder.llvm.util -

    - - - - - - - + + + + + + +org.eclipse.cdt.managedbuilder.llvm.util + + + + + + + + + + + + +
    + + + + + +
    -Class Summary
    LlvmToolOptionPathUtil
    + + + + + + + + + +
    + +
    + + + +
    +

    +Package org.eclipse.cdt.managedbuilder.llvm.util +

    + + + + + + + - - - - - -
    +Class Summary
    LlvmToolOptionPathUtil The main purpose of this class is to add include paths and libraries and library search paths for LLVM assembler and linker Tools which are added in Preferences->LLVM to all projects - and build configurations that use LLVM ToolChain.
    SeparatorsProvides different separators such as file and path separators.
    -  - -

    -

    -
    -
    - - - - - - - - - - - - - - - -
    - -
    - - - -
    - - - + and build configurations that use LLVM ToolChain. + + +Separators +Provides different separators such as file and path separators. + + +  + +

    +

    +
    +
    + + + + + + + + + + + + + + + +
    + +
    + + + +
    + + + diff --git a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/util/package-tree.html b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/util/package-tree.html index d8107ee9061..14d053a66ba 100644 --- a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/util/package-tree.html +++ b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/util/package-tree.html @@ -1,153 +1,153 @@ - - - - - - -org.eclipse.cdt.managedbuilder.llvm.util Class Hierarchy - - - - - - - - - - - - -
    - - - - - - - - - - - - - - - -
    - -
    - - - -
    -
    -

    -Hierarchy For Package org.eclipse.cdt.managedbuilder.llvm.util -

    -
    -
    -
    Package Hierarchies:
    All Packages
    -
    -

    -Class Hierarchy -

    - -
    - - - - - - - - - - - - - - - -
    - -
    - - - -
    - - - + + + + + + +org.eclipse.cdt.managedbuilder.llvm.util Class Hierarchy + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + +
    + +
    + + + +
    +
    +

    +Hierarchy For Package org.eclipse.cdt.managedbuilder.llvm.util +

    +
    +
    +
    Package Hierarchies:
    All Packages
    +
    +

    +Class Hierarchy +

    + +
    + + + + + + + + + + + + + + + +
    + +
    + + + +
    + + + diff --git a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/util/package-use.html b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/util/package-use.html index 1e0e338aa73..4c20353b051 100644 --- a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/util/package-use.html +++ b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/org/eclipse/cdt/managedbuilder/llvm/util/package-use.html @@ -1,144 +1,144 @@ - - - - - - -Uses of Package org.eclipse.cdt.managedbuilder.llvm.util - - - - - - - - - - - - -
    - - - - - - - - - - - - - - - -
    - -
    - - - -
    -
    -

    -Uses of Package
    org.eclipse.cdt.managedbuilder.llvm.util

    -
    -No usage of org.eclipse.cdt.managedbuilder.llvm.util -

    -


    - - - - - - - - - - - - - - - -
    - -
    - - - -
    - - - + + + + + + +Uses of Package org.eclipse.cdt.managedbuilder.llvm.util + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + +
    + +
    + + + +
    +
    +

    +Uses of Package
    org.eclipse.cdt.managedbuilder.llvm.util

    +
    +No usage of org.eclipse.cdt.managedbuilder.llvm.util +

    +


    + + + + + + + + + + + + + + + +
    + +
    + + + +
    + + + diff --git a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/overview-frame.html b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/overview-frame.html index 7757830a48b..de6037dfbf7 100644 --- a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/overview-frame.html +++ b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/overview-frame.html @@ -1,50 +1,50 @@ - - - - - - -Overview List - - - - - - - - - - - - - - - -
    -
    - - - - - -
    All Classes -

    - -Packages -
    -org.eclipse.cdt.managedbuilder.llvm.makegen -
    -org.eclipse.cdt.managedbuilder.llvm.scannerconfig -
    -org.eclipse.cdt.managedbuilder.llvm.ui -
    -org.eclipse.cdt.managedbuilder.llvm.ui.preferences -
    -org.eclipse.cdt.managedbuilder.llvm.util -
    -

    - -

    -  - - + + + + + + +Overview List + + + + + + + + + + + + + + + +
    +
    + + + + + +
    All Classes +

    + +Packages +
    +org.eclipse.cdt.managedbuilder.llvm.makegen +
    +org.eclipse.cdt.managedbuilder.llvm.scannerconfig +
    +org.eclipse.cdt.managedbuilder.llvm.ui +
    +org.eclipse.cdt.managedbuilder.llvm.ui.preferences +
    +org.eclipse.cdt.managedbuilder.llvm.util +
    +

    + +

    +  + + diff --git a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/overview-summary.html b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/overview-summary.html index d181a3b310a..4ef5947cbdc 100644 --- a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/overview-summary.html +++ b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/overview-summary.html @@ -1,167 +1,167 @@ - - - - - - -Overview - - - - - - - - - - - - -


    - - - - - - - - - - - - - - - -
    - -
    - - - -
    - - - - - - - - - - - - - - - - - - - - - - - - - -
    -Packages
    org.eclipse.cdt.managedbuilder.llvm.makegen 
    org.eclipse.cdt.managedbuilder.llvm.scannerconfig 
    org.eclipse.cdt.managedbuilder.llvm.ui 
    org.eclipse.cdt.managedbuilder.llvm.ui.preferences 
    org.eclipse.cdt.managedbuilder.llvm.util 
    - -


    - - - - - - - - - - - - - - - -
    - -
    - - - -
    - - - + + + + + + +Overview + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + +
    + +
    + + + +
    + + + + + + + + + + + + + + + + + + + + + + + + + +
    +Packages
    org.eclipse.cdt.managedbuilder.llvm.makegen 
    org.eclipse.cdt.managedbuilder.llvm.scannerconfig 
    org.eclipse.cdt.managedbuilder.llvm.ui 
    org.eclipse.cdt.managedbuilder.llvm.ui.preferences 
    org.eclipse.cdt.managedbuilder.llvm.util 
    + +


    + + + + + + + + + + + + + + + +
    + +
    + + + +
    + + + diff --git a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/overview-tree.html b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/overview-tree.html index b28e162d957..e0028d767f1 100644 --- a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/overview-tree.html +++ b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/overview-tree.html @@ -1,196 +1,196 @@ - - - - - - -Class Hierarchy - - - - - - - - - - - - -
    - - - - - - - - - - - - - - - -
    - -
    - - - -
    -
    -

    -Hierarchy For All Packages

    -
    -
    -
    Package Hierarchies:
    org.eclipse.cdt.managedbuilder.llvm.makegen, org.eclipse.cdt.managedbuilder.llvm.scannerconfig, org.eclipse.cdt.managedbuilder.llvm.ui, org.eclipse.cdt.managedbuilder.llvm.ui.preferences, org.eclipse.cdt.managedbuilder.llvm.util
    -
    -

    -Class Hierarchy -

    -
      -
    • java.lang.Object
        -
      • org.eclipse.cdt.make.internal.core.scannerconfig.gnu.AbstractGCCBOPConsoleParser (implements org.eclipse.cdt.make.core.scannerconfig.IScannerInfoConsoleParser) - -
      • org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer -
      • org.eclipse.cdt.managedbuilder.makegen.gnu.DefaultGCCDependencyCalculator2 (implements org.eclipse.cdt.managedbuilder.makegen.IManagedDependencyGenerator2) - -
      • org.eclipse.cdt.managedbuilder.makegen.gnu.DefaultGCCDependencyCalculator2Commands (implements org.eclipse.cdt.managedbuilder.makegen.IManagedDependencyCommands) - -
      • org.eclipse.jface.dialogs.DialogPage (implements org.eclipse.jface.dialogs.IDialogPage, org.eclipse.jface.dialogs.IMessageProvider) -
          -
        • org.eclipse.jface.preference.PreferencePage (implements org.eclipse.jface.preference.IPreferencePage) -
            -
          • org.eclipse.jface.preference.FieldEditorPreferencePage (implements org.eclipse.jface.util.IPropertyChangeListener) -
              -
            • org.eclipse.cdt.managedbuilder.llvm.ui.preferences.LlvmPreferencePage (implements org.eclipse.ui.IWorkbenchPreferencePage) -
            -
          -
        -
      • org.eclipse.jface.preference.FieldEditor -
      • org.eclipse.cdt.managedbuilder.llvm.ui.LlvmBuildEnvironmentVariable (implements org.eclipse.cdt.managedbuilder.envvar.IBuildEnvironmentVariable) -
      • org.eclipse.cdt.managedbuilder.llvm.ui.LlvmEnvironmentVariableSupplier (implements org.eclipse.cdt.managedbuilder.envvar.IConfigurationEnvironmentVariableSupplier) -
      • org.eclipse.cdt.managedbuilder.llvm.ui.LlvmIsToolChainSupported (implements org.eclipse.cdt.managedbuilder.core.IManagedIsToolChainSupported) -
      • org.eclipse.cdt.managedbuilder.llvm.ui.preferences.LlvmPreferenceStore
      • org.eclipse.cdt.managedbuilder.llvm.ui.LlvmProjectNature (implements org.eclipse.core.resources.IProjectNature) -
      • org.eclipse.cdt.managedbuilder.llvm.util.LlvmToolOptionPathUtil
      • org.eclipse.osgi.util.NLS
          -
        • org.eclipse.cdt.managedbuilder.llvm.ui.preferences.Messages
        -
      • org.eclipse.cdt.make.internal.core.scannerconfig2.PerProjectSICollector (implements org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollector3, org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollectorCleaner) -
          -
        • org.eclipse.cdt.managedbuilder.llvm.scannerconfig.LlvmScannerInfoCollector (implements org.eclipse.cdt.managedbuilder.scannerconfig.IManagedScannerInfoCollector) -
        -
      • org.eclipse.core.runtime.Plugin (implements org.osgi.framework.BundleActivator) -
          -
        • org.eclipse.ui.plugin.AbstractUIPlugin -
        -
      • org.eclipse.cdt.managedbuilder.llvm.ui.preferences.PreferenceConstants
      • org.eclipse.cdt.managedbuilder.llvm.util.Separators
      -
    -
    - - - - - - - - - - - - - - - -
    - -
    - - - -
    - - - + + + + + + +Class Hierarchy + + + + + + + + + + + + +
    + + + + + + + + + + + + + + + +
    + +
    + + + +
    +
    +

    +Hierarchy For All Packages

    +
    +
    +
    Package Hierarchies:
    org.eclipse.cdt.managedbuilder.llvm.makegen, org.eclipse.cdt.managedbuilder.llvm.scannerconfig, org.eclipse.cdt.managedbuilder.llvm.ui, org.eclipse.cdt.managedbuilder.llvm.ui.preferences, org.eclipse.cdt.managedbuilder.llvm.util
    +
    +

    +Class Hierarchy +

    +
      +
    • java.lang.Object
        +
      • org.eclipse.cdt.make.internal.core.scannerconfig.gnu.AbstractGCCBOPConsoleParser (implements org.eclipse.cdt.make.core.scannerconfig.IScannerInfoConsoleParser) + +
      • org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer +
      • org.eclipse.cdt.managedbuilder.makegen.gnu.DefaultGCCDependencyCalculator2 (implements org.eclipse.cdt.managedbuilder.makegen.IManagedDependencyGenerator2) + +
      • org.eclipse.cdt.managedbuilder.makegen.gnu.DefaultGCCDependencyCalculator2Commands (implements org.eclipse.cdt.managedbuilder.makegen.IManagedDependencyCommands) + +
      • org.eclipse.jface.dialogs.DialogPage (implements org.eclipse.jface.dialogs.IDialogPage, org.eclipse.jface.dialogs.IMessageProvider) +
          +
        • org.eclipse.jface.preference.PreferencePage (implements org.eclipse.jface.preference.IPreferencePage) +
            +
          • org.eclipse.jface.preference.FieldEditorPreferencePage (implements org.eclipse.jface.util.IPropertyChangeListener) +
              +
            • org.eclipse.cdt.managedbuilder.llvm.ui.preferences.LlvmPreferencePage (implements org.eclipse.ui.IWorkbenchPreferencePage) +
            +
          +
        +
      • org.eclipse.jface.preference.FieldEditor +
      • org.eclipse.cdt.managedbuilder.llvm.ui.LlvmBuildEnvironmentVariable (implements org.eclipse.cdt.managedbuilder.envvar.IBuildEnvironmentVariable) +
      • org.eclipse.cdt.managedbuilder.llvm.ui.LlvmEnvironmentVariableSupplier (implements org.eclipse.cdt.managedbuilder.envvar.IConfigurationEnvironmentVariableSupplier) +
      • org.eclipse.cdt.managedbuilder.llvm.ui.LlvmIsToolChainSupported (implements org.eclipse.cdt.managedbuilder.core.IManagedIsToolChainSupported) +
      • org.eclipse.cdt.managedbuilder.llvm.ui.preferences.LlvmPreferenceStore
      • org.eclipse.cdt.managedbuilder.llvm.ui.LlvmProjectNature (implements org.eclipse.core.resources.IProjectNature) +
      • org.eclipse.cdt.managedbuilder.llvm.util.LlvmToolOptionPathUtil
      • org.eclipse.osgi.util.NLS
          +
        • org.eclipse.cdt.managedbuilder.llvm.ui.preferences.Messages
        +
      • org.eclipse.cdt.make.internal.core.scannerconfig2.PerProjectSICollector (implements org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollector3, org.eclipse.cdt.make.core.scannerconfig.IScannerInfoCollectorCleaner) +
          +
        • org.eclipse.cdt.managedbuilder.llvm.scannerconfig.LlvmScannerInfoCollector (implements org.eclipse.cdt.managedbuilder.scannerconfig.IManagedScannerInfoCollector) +
        +
      • org.eclipse.core.runtime.Plugin (implements org.osgi.framework.BundleActivator) +
          +
        • org.eclipse.ui.plugin.AbstractUIPlugin +
        +
      • org.eclipse.cdt.managedbuilder.llvm.ui.preferences.PreferenceConstants
      • org.eclipse.cdt.managedbuilder.llvm.util.Separators
      +
    +
    + + + + + + + + + + + + + + + +
    + +
    + + + +
    + + + diff --git a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/package-list b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/package-list index 892bbef180e..9864b4bb485 100644 --- a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/package-list +++ b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/package-list @@ -1,5 +1,5 @@ -org.eclipse.cdt.managedbuilder.llvm.makegen -org.eclipse.cdt.managedbuilder.llvm.scannerconfig -org.eclipse.cdt.managedbuilder.llvm.ui -org.eclipse.cdt.managedbuilder.llvm.ui.preferences -org.eclipse.cdt.managedbuilder.llvm.util +org.eclipse.cdt.managedbuilder.llvm.makegen +org.eclipse.cdt.managedbuilder.llvm.scannerconfig +org.eclipse.cdt.managedbuilder.llvm.ui +org.eclipse.cdt.managedbuilder.llvm.ui.preferences +org.eclipse.cdt.managedbuilder.llvm.util diff --git a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/stylesheet.css b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/stylesheet.css index cbd34286b1c..6ea9e516161 100644 --- a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/stylesheet.css +++ b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/doc/stylesheet.css @@ -1,29 +1,29 @@ -/* Javadoc style sheet */ - -/* Define colors, fonts and other style attributes here to override the defaults */ - -/* Page background color */ -body { background-color: #FFFFFF; color:#000000 } - -/* Headings */ -h1 { font-size: 145% } - -/* Table colors */ -.TableHeadingColor { background: #CCCCFF; color:#000000 } /* Dark mauve */ -.TableSubHeadingColor { background: #EEEEFF; color:#000000 } /* Light mauve */ -.TableRowColor { background: #FFFFFF; color:#000000 } /* White */ - -/* Font used in left-hand frame lists */ -.FrameTitleFont { font-size: 100%; font-family: Helvetica, Arial, sans-serif; color:#000000 } -.FrameHeadingFont { font-size: 90%; font-family: Helvetica, Arial, sans-serif; color:#000000 } -.FrameItemFont { font-size: 90%; font-family: Helvetica, Arial, sans-serif; color:#000000 } - -/* Navigation bar fonts and colors */ -.NavBarCell1 { background-color:#EEEEFF; color:#000000} /* Light mauve */ -.NavBarCell1Rev { background-color:#00008B; color:#FFFFFF} /* Dark Blue */ -.NavBarFont1 { font-family: Arial, Helvetica, sans-serif; color:#000000;color:#000000;} -.NavBarFont1Rev { font-family: Arial, Helvetica, sans-serif; color:#FFFFFF;color:#FFFFFF;} - -.NavBarCell2 { font-family: Arial, Helvetica, sans-serif; background-color:#FFFFFF; color:#000000} -.NavBarCell3 { font-family: Arial, Helvetica, sans-serif; background-color:#FFFFFF; color:#000000} - +/* Javadoc style sheet */ + +/* Define colors, fonts and other style attributes here to override the defaults */ + +/* Page background color */ +body { background-color: #FFFFFF; color:#000000 } + +/* Headings */ +h1 { font-size: 145% } + +/* Table colors */ +.TableHeadingColor { background: #CCCCFF; color:#000000 } /* Dark mauve */ +.TableSubHeadingColor { background: #EEEEFF; color:#000000 } /* Light mauve */ +.TableRowColor { background: #FFFFFF; color:#000000 } /* White */ + +/* Font used in left-hand frame lists */ +.FrameTitleFont { font-size: 100%; font-family: Helvetica, Arial, sans-serif; color:#000000 } +.FrameHeadingFont { font-size: 90%; font-family: Helvetica, Arial, sans-serif; color:#000000 } +.FrameItemFont { font-size: 90%; font-family: Helvetica, Arial, sans-serif; color:#000000 } + +/* Navigation bar fonts and colors */ +.NavBarCell1 { background-color:#EEEEFF; color:#000000} /* Light mauve */ +.NavBarCell1Rev { background-color:#00008B; color:#FFFFFF} /* Dark Blue */ +.NavBarFont1 { font-family: Arial, Helvetica, sans-serif; color:#000000;color:#000000;} +.NavBarFont1Rev { font-family: Arial, Helvetica, sans-serif; color:#FFFFFF;color:#FFFFFF;} + +.NavBarCell2 { font-family: Arial, Helvetica, sans-serif; background-color:#FFFFFF; color:#000000} +.NavBarCell3 { font-family: Arial, Helvetica, sans-serif; background-color:#FFFFFF; color:#000000} + diff --git a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/plugin.properties b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/plugin.properties index 9ee465b8318..fd9b12167a8 100755 --- a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/plugin.properties +++ b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/plugin.properties @@ -1,228 +1,228 @@ -############################################################################### -# Copyright (c) 2010 Nokia Siemens Networks Oyj, Finland. -# 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: -# Nokia Siemens Networks Oyj, initial LLVM support as an add-on to CDT. -############################################################################### - -# plugin names -pluginName=LLVM Managed Build Definitions -providerName=Eclipse CDT - -# Build Model Names -TargetName.llvm=LLVM -TargetName.llvm.bitcode=LLVM bitcode - -# Tool-chain names -ToolChainName.llvm=LLVM -ToolChainName.llvm.with.linker=LLVM with C/C++ Linker -ToolChainName.llvm.with.static.compiler=LLVM with static compiler -ToolChainName.llvm.static.compiler.linux=LLVM with static compiler (Linux) -ToolChainName.llvm.static.compiler.macosx=LLVM with static compiler (MacOSX) -ToolChainName.llvm.static.compiler.win32=LLVM with static compiler (Windows) -ToolChainName.llvm.jit=LLVM with JIT/Interpreter -ToolChainName.llvm.jit.linux=LLVM with JIT/Interpreter (Linux) -ToolChainName.llvm.jit.macosx=LLVM with JIT/Interpreter (MacOSX) -ToolChainName.llvm.jit.win32=LLVM with JIT/Interpreter (Windows) -ToolChainName.llvm.clang=LLVM with Clang -ToolChainName.llvm.clang.win32.mingw=LLVM with Clang (Windows) (MinGW) -ToolChainName.llvm.clang.win32.cygwin=LLVM with Clang (Windows) (Cygwin) -ToolChainName.llvm.linux=LLVM with Clang (Linux) -ToolChainName.llvm.macosx=LLVM with Clang (MacOSX) -ToolChainName.llvm.gnu=LLVM with GCC -ToolChainName.llvm.gnu.linux=LLVM with GCC (Linux) -ToolChainName.llvm.gnu.macosx=LLVM with GCC (MacOSX) -ToolChainName.llvm.gnu.win32.cygwin=LLVM with GCC (Windows) (Cygwin) -ToolChainName.llvm.gnu.win32.mingw=LLVM with GCC (Windows) (MinGW) - -# Default Configuration Names -# START NON-TRANSLATABLE -ConfigName.Rel=Release -ConfigName.Dbg=Debug -ConfigName.Rel.Win32=Release -ConfigName.Dbg.Win32=Debug -ConfigName.Rel.Gnu=Release -ConfigName.Dbg.Gnu=Debug - -# END NON-TRANSLATABLE - -# Generic platform names (copied from org.eclipse.cdt.managedbuilder.gnu.ui) -PlatformName.Rel=Release Platform -PlatformName.Dbg=Debug Platform - -# LLVM tool names -ToolName.archiver.llvm=LLVM archiver -ToolName.assembler.llvm=LLVM assembler -ToolName.compiler.llvm.abstract=Abstract LLVM C/C++ compiler -ToolName.compiler.llvm.c.abstract=Abstract LLVM C compiler -ToolName.compiler.llvm.cpp.abstract=Abstract LLVM C++ compiler -ToolName.compiler.llvm.c=LLVM Clang -ToolName.compiler.llvm.cpp=LLVM Clang++ -ToolName.compiler.llvm.gcc=LLVM GCC -ToolName.compiler.llvm.g++=LLVM G++ -ToolName.linker.llvm.c=LLVM Clang C linker -ToolName.linker.llvm.cpp=LLVM Clang C++ linker -ToolName.linker.llvm.gcc=LLVM GNU C linker -ToolName.linker.llvm.g++=LLVM GNU C++ linker -ToolName.llc.llvm=LLVM Static Compiler -ToolName.llc.llvm.c=LLVM C Static Compiler -ToolName.llc.llvm.cpp=LLVM C++ Static Compiler -ToolName.lli.llvm=LLVM JIT compiler/Interpreter - -# Option Names -# Generic Category Names -#OptionCategory.Symbols = Symbols -OptionCategory.Dialect = Dialect -OptionCategory.Preproc=Preprocessor -OptionCategory.Dirs=Directories -OptionCategory.General=General -OptionCategory.Optimize=Optimization -OptionCategory.Debug=Debugging -OptionCategory.Warn=Warnings -OptionCategory.Misc=Miscellaneous -OptionCategory.Includes=Includes -OptionCategory.Libs=Libraries -OptionCategory.Options=Options -OptionCategory.Optimizations=Optimization Options -OptionCategory.FloatingPointOptions=Floating Point Options -OptionCategory.CodeGenerationOptions=Code Generation Options -#OptionCategory.Shared.Settings=Shared Library Settings - -# Generic Option Names -Option.Posix.PreprocOnly=Preprocess only (-E) -#Option.Posix.Nostdinc=Do not search system directories (-nostdinc) - -Option.Posix.DefSym=Defined symbols (-D) -Option.Posix.UndefSym=Undefined symbols (-U) - -Option.Posix.InclPaths=Include paths (-I) - -Option.Posix.OptLevel=Optimization Level -Option.Posix.Optimize.None=None (-O0) -Option.Posix.Optimize.Optimize=Optimize (-O1) -Option.Posix.Optimize.More=Optimize more (-O2) -Option.Posix.Optimize.Most=Optimize most (-O3) -Option.Posix.Optimize.Runtime=Optimize at run-time (-O4) -Option.Posix.Optimize.Flags=Other optimization flags - -Option.Posix.DebugLevel=Debug Level -Option.Posix.Debug.None=None -Option.Posix.Debug.Min=Minimal (-g1) -Option.Posix.Debug.Def=Default (-g) -Option.Posix.Debug.Max=Maximum (-g3) -Option.Posix.Debug.Other=Other debugging flags -#Option.Posix.Debug.gprof=Generate gprof information (-pg) -#Option.Posix.Debug.prof=Generate prof information (-p) - -Option.Posix.Warn.Syntax=Check syntax only (-fsyntax-only) -Option.Posix.Warn.Pedandic=Pedantic (-pedantic) -Option.Posix.Warn.PedErrors=Pedantic warnings as errors (-pedantic-errors) -Option.Posix.Warn.nowarn=Inhibit all warnings (-w) -Option.Posix.Warn.allwarn=All warnings (-Wall) -Option.Posix.Warn.toerrs=Warnings as errors (-Werror) - -Option.Posix.Verbose=Verbose (-v) -Option.OtherFlags=Other flags -#Option.Posix.Ansi=Support ANSI programs (-ansi) - -Option.Posix.Archiver.delete=Delete files from the archive -Option.Posix.Archiver.print.contents=Print the table of contents -#Option.Posix.Linker.NoStartFiles=Do not use standard start files (-nostartfiles) -#Option.Posix.Linker.NoDefLibs=Do not use default libraries (-nodefaultlibs) -#Option.Posix.Linker.NoStdLibs=No startup or default libs (-nostdlib) -Option.Posix.Linker.Strip=Omit all debug and symbol information (-strip-all) -Option.Posix.Linker.Strip.Debug=Omit all debug information (-strip-debug) -Option.Posix.Linker.Stats=Print statistics -Option.Posix.Linker.Verbose=Verbose mode -Option.Posix.Linker.Verification=Verification pass -Option.Posix.Linker.DisableInternalize=Disable Internalize -Option.Posix.Linker.DisableOptimization=Disable Optimization -Option.Posix.Linker.DisableInhiling=Disable Inhiling -#Option.Posix.Linker.Static=No shared libraries (-static) -#Option.Posix.Linker.XLinker=Other options (-Xlinker [option]) -Option.Posix.Linker.Flags=Linker flags -Option.Posix.Libs=Libraries (-l) -Option.Posix.Libsearch=Library search path (-L) -Option.Posix.UserBcs=Other bytecode files -#Option.Posix.Linker.Shared=Shared (-shared) -#Option.Posix.Linker.SOName=Shared object name (-Wl,-soname=) -#Option.Posix.Linker.Implib=Import Library name (-Wl,--out-implib=) -#Option.Posix.Linker.Defname=DEF file name (-Wl,--output-def=) -Option.Posix.Linker.link_as_library=Create a library -Option.Posix.Linker.LlvmOptions=Input/Output Options -Option.Posix.Linker.native=Create native binary (with LLVM native code generator) -Option.Posix.Linker.nativeCBackend=Create native binary (with C backend code generator) -Option.Posix.Static.Compiler.Flags=Static Compiler Flags - -Option.Llvm.printStats=Print statistics -Option.Llvm.Archiver.Flags=Archiver flags -Option.Llvm.Llc.Flags=LLC flags -Option.Llvm.Llc.EmitC=Emit C code (not assembly) -Option.Llvm.Llc.Arch=Specify architecture for assembly code (x86 or sparcv9) -Option.Llvm.llc.optimization.disableExcessPrecisionOptimization=Disable optimizations that may produce excess precision for floating point -Option.Llvm.llc.optimization.disableFramePointerEliminationOptimization=Disable frame pointer elimination optimization -Option.Llvm.Lli.Flags=LLVM JIT/Interpreter flags -Option.Llvm.Lli.ForceInterpreter=Force Interpreter -Option.Llvm.Lli.disable-excess-fp-precision=Disable optimizations that may increase floating point precision -Option.Llvm.Lli.enable-finite-only-fp-math=Enable optimizations that assume only finite floating point math -Option.Llvm.Lli.enable-unsafe-fp-math=Enable optimizations that may decrease floating point precision -Option.Llvm.Lli.soft-float=Generate software floating point library calls instead of equivalent hardware instructions -Option.Llvm.Lli.disable-post-RA-scheduler=Disable scheduling after register allocation -Option.Llvm.Lli.disable-spill-fusing=Disable fusing of spill code into instructions -Option.Llvm.Lli.enable-correct-eh-support=Make the -lowerinvoke pass insert expensive, but correct, EH code -Option.Llvm.Lli.jit-enable-eh=Exception handling should be enabled in the just-in-time compiler -Option.Llvm.Assembler.Flags=Assembler flags -Option.Llvm.Assembler.warn.suppress=Suppress warnings (-W) -Option.Llvm.Assembler.version=Announce version (-v) - -# Platform specific option names -#Option.Windows.Windres.OutputFormat = Output format -#Option.Windows.Windres.OutputFormat.Coff = coff (--output-format coff) -#Option.Windows.Windres.OutputFormat.RC = rc (--output-format rc) -#Option.Windows.Windres.OutputFormat.Res = res (--output-format res) -#Option.MacOSX.Linker.Shared=Shared (-dynamiclib) - -# Artifact types -BuildProperty.type.name.bcexe=LLVM bytecode executable for LLI -BuildProperty.type.name.bclib=LLVM bytecode library - -# Content types -ContentType.LlvmBytecodeFileName=LLVM bytecode file -#LLVM assembler file (human-readable) -ContentType.LlvmSourceFileName=LLVM -ContentType.LlvmExecutableFileName=LLVM executable -ContentType.LlvmAssemblerCode=LLVM Assembly Code - -# Languages -Language.LlvmAssembly=LLVM bytecode assembly - -option.name = Clang Option -page.name = LLVM -extension.name = Clang++ managed make per project SCD profile -extension.name.0 = Clang managed make per project SCD profile -extension.name.1 = LLVM-G++ managed make per project SCD profile -extension.name.2 = LLVM-GCC managed make per project SCD profile -option.tip = In this mode the linker will print additional information about the actions it takes, programs it executes, etc. -option.tip.0 = Strip all debug and symbol information from the executable to make it smaller. -option.tip.1 = Strip all debug information from the executable to make it smaller. -option.tip.2 = Run the verification pass after each of the passes to verify intermediate results. -option.tip.3 = Do not mark all symbols as internal. -option.tip.4 = Completely disable optimization. -option.tip.5 = Do not run the inlining pass. Functions will not be inlined into other functions. -option.tip.6 = Generate a native machine code executable. -option.tip.7 = Generate a native machine code executable with the LLVM C backend. Uses the C backend to generate code for the program instead of an LLVM native code generator. -option.tip.8 = Link the bitcode files together as a library, not an executable. In this mode, undefined symbols will be permitted. -option.tip.9 = Print the table of contents. -option.tip.10 = Print statistics recorded by code-generation passes. -option.tip.11 = Disable optimizations that may produce excess precision for floating point. Note that this option can dramatically slow down code on some systems (e.g. X86). -option.tip.12 = Print statistics from the code-generation passes. -enumeratedOptionValue.name = true -enumeratedOptionValue.name.0 = false -option.tip.13 = Causes lli to generate software floating point library calls instead of equivalent hardware instructions. -option.tip.14 = Causes lli to enable optimizations that may decrease floating point precision. -option.tip.15 = Disable optimizations that may increase floating point precision. +############################################################################### +# Copyright (c) 2010 Nokia Siemens Networks Oyj, Finland. +# 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: +# Nokia Siemens Networks Oyj, initial LLVM support as an add-on to CDT. +############################################################################### + +# plugin names +pluginName=LLVM Managed Build Definitions +providerName=Eclipse CDT + +# Build Model Names +TargetName.llvm=LLVM +TargetName.llvm.bitcode=LLVM bitcode + +# Tool-chain names +ToolChainName.llvm=LLVM +ToolChainName.llvm.with.linker=LLVM with C/C++ Linker +ToolChainName.llvm.with.static.compiler=LLVM with static compiler +ToolChainName.llvm.static.compiler.linux=LLVM with static compiler (Linux) +ToolChainName.llvm.static.compiler.macosx=LLVM with static compiler (MacOSX) +ToolChainName.llvm.static.compiler.win32=LLVM with static compiler (Windows) +ToolChainName.llvm.jit=LLVM with JIT/Interpreter +ToolChainName.llvm.jit.linux=LLVM with JIT/Interpreter (Linux) +ToolChainName.llvm.jit.macosx=LLVM with JIT/Interpreter (MacOSX) +ToolChainName.llvm.jit.win32=LLVM with JIT/Interpreter (Windows) +ToolChainName.llvm.clang=LLVM with Clang +ToolChainName.llvm.clang.win32.mingw=LLVM with Clang (Windows) (MinGW) +ToolChainName.llvm.clang.win32.cygwin=LLVM with Clang (Windows) (Cygwin) +ToolChainName.llvm.linux=LLVM with Clang (Linux) +ToolChainName.llvm.macosx=LLVM with Clang (MacOSX) +ToolChainName.llvm.gnu=LLVM with GCC +ToolChainName.llvm.gnu.linux=LLVM with GCC (Linux) +ToolChainName.llvm.gnu.macosx=LLVM with GCC (MacOSX) +ToolChainName.llvm.gnu.win32.cygwin=LLVM with GCC (Windows) (Cygwin) +ToolChainName.llvm.gnu.win32.mingw=LLVM with GCC (Windows) (MinGW) + +# Default Configuration Names +# START NON-TRANSLATABLE +ConfigName.Rel=Release +ConfigName.Dbg=Debug +ConfigName.Rel.Win32=Release +ConfigName.Dbg.Win32=Debug +ConfigName.Rel.Gnu=Release +ConfigName.Dbg.Gnu=Debug + +# END NON-TRANSLATABLE + +# Generic platform names (copied from org.eclipse.cdt.managedbuilder.gnu.ui) +PlatformName.Rel=Release Platform +PlatformName.Dbg=Debug Platform + +# LLVM tool names +ToolName.archiver.llvm=LLVM archiver +ToolName.assembler.llvm=LLVM assembler +ToolName.compiler.llvm.abstract=Abstract LLVM C/C++ compiler +ToolName.compiler.llvm.c.abstract=Abstract LLVM C compiler +ToolName.compiler.llvm.cpp.abstract=Abstract LLVM C++ compiler +ToolName.compiler.llvm.c=LLVM Clang +ToolName.compiler.llvm.cpp=LLVM Clang++ +ToolName.compiler.llvm.gcc=LLVM GCC +ToolName.compiler.llvm.g++=LLVM G++ +ToolName.linker.llvm.c=LLVM Clang C linker +ToolName.linker.llvm.cpp=LLVM Clang C++ linker +ToolName.linker.llvm.gcc=LLVM GNU C linker +ToolName.linker.llvm.g++=LLVM GNU C++ linker +ToolName.llc.llvm=LLVM Static Compiler +ToolName.llc.llvm.c=LLVM C Static Compiler +ToolName.llc.llvm.cpp=LLVM C++ Static Compiler +ToolName.lli.llvm=LLVM JIT compiler/Interpreter + +# Option Names +# Generic Category Names +#OptionCategory.Symbols = Symbols +OptionCategory.Dialect = Dialect +OptionCategory.Preproc=Preprocessor +OptionCategory.Dirs=Directories +OptionCategory.General=General +OptionCategory.Optimize=Optimization +OptionCategory.Debug=Debugging +OptionCategory.Warn=Warnings +OptionCategory.Misc=Miscellaneous +OptionCategory.Includes=Includes +OptionCategory.Libs=Libraries +OptionCategory.Options=Options +OptionCategory.Optimizations=Optimization Options +OptionCategory.FloatingPointOptions=Floating Point Options +OptionCategory.CodeGenerationOptions=Code Generation Options +#OptionCategory.Shared.Settings=Shared Library Settings + +# Generic Option Names +Option.Posix.PreprocOnly=Preprocess only (-E) +#Option.Posix.Nostdinc=Do not search system directories (-nostdinc) + +Option.Posix.DefSym=Defined symbols (-D) +Option.Posix.UndefSym=Undefined symbols (-U) + +Option.Posix.InclPaths=Include paths (-I) + +Option.Posix.OptLevel=Optimization Level +Option.Posix.Optimize.None=None (-O0) +Option.Posix.Optimize.Optimize=Optimize (-O1) +Option.Posix.Optimize.More=Optimize more (-O2) +Option.Posix.Optimize.Most=Optimize most (-O3) +Option.Posix.Optimize.Runtime=Optimize at run-time (-O4) +Option.Posix.Optimize.Flags=Other optimization flags + +Option.Posix.DebugLevel=Debug Level +Option.Posix.Debug.None=None +Option.Posix.Debug.Min=Minimal (-g1) +Option.Posix.Debug.Def=Default (-g) +Option.Posix.Debug.Max=Maximum (-g3) +Option.Posix.Debug.Other=Other debugging flags +#Option.Posix.Debug.gprof=Generate gprof information (-pg) +#Option.Posix.Debug.prof=Generate prof information (-p) + +Option.Posix.Warn.Syntax=Check syntax only (-fsyntax-only) +Option.Posix.Warn.Pedandic=Pedantic (-pedantic) +Option.Posix.Warn.PedErrors=Pedantic warnings as errors (-pedantic-errors) +Option.Posix.Warn.nowarn=Inhibit all warnings (-w) +Option.Posix.Warn.allwarn=All warnings (-Wall) +Option.Posix.Warn.toerrs=Warnings as errors (-Werror) + +Option.Posix.Verbose=Verbose (-v) +Option.OtherFlags=Other flags +#Option.Posix.Ansi=Support ANSI programs (-ansi) + +Option.Posix.Archiver.delete=Delete files from the archive +Option.Posix.Archiver.print.contents=Print the table of contents +#Option.Posix.Linker.NoStartFiles=Do not use standard start files (-nostartfiles) +#Option.Posix.Linker.NoDefLibs=Do not use default libraries (-nodefaultlibs) +#Option.Posix.Linker.NoStdLibs=No startup or default libs (-nostdlib) +Option.Posix.Linker.Strip=Omit all debug and symbol information (-strip-all) +Option.Posix.Linker.Strip.Debug=Omit all debug information (-strip-debug) +Option.Posix.Linker.Stats=Print statistics +Option.Posix.Linker.Verbose=Verbose mode +Option.Posix.Linker.Verification=Verification pass +Option.Posix.Linker.DisableInternalize=Disable Internalize +Option.Posix.Linker.DisableOptimization=Disable Optimization +Option.Posix.Linker.DisableInhiling=Disable Inhiling +#Option.Posix.Linker.Static=No shared libraries (-static) +#Option.Posix.Linker.XLinker=Other options (-Xlinker [option]) +Option.Posix.Linker.Flags=Linker flags +Option.Posix.Libs=Libraries (-l) +Option.Posix.Libsearch=Library search path (-L) +Option.Posix.UserBcs=Other bytecode files +#Option.Posix.Linker.Shared=Shared (-shared) +#Option.Posix.Linker.SOName=Shared object name (-Wl,-soname=) +#Option.Posix.Linker.Implib=Import Library name (-Wl,--out-implib=) +#Option.Posix.Linker.Defname=DEF file name (-Wl,--output-def=) +Option.Posix.Linker.link_as_library=Create a library +Option.Posix.Linker.LlvmOptions=Input/Output Options +Option.Posix.Linker.native=Create native binary (with LLVM native code generator) +Option.Posix.Linker.nativeCBackend=Create native binary (with C backend code generator) +Option.Posix.Static.Compiler.Flags=Static Compiler Flags + +Option.Llvm.printStats=Print statistics +Option.Llvm.Archiver.Flags=Archiver flags +Option.Llvm.Llc.Flags=LLC flags +Option.Llvm.Llc.EmitC=Emit C code (not assembly) +Option.Llvm.Llc.Arch=Specify architecture for assembly code (x86 or sparcv9) +Option.Llvm.llc.optimization.disableExcessPrecisionOptimization=Disable optimizations that may produce excess precision for floating point +Option.Llvm.llc.optimization.disableFramePointerEliminationOptimization=Disable frame pointer elimination optimization +Option.Llvm.Lli.Flags=LLVM JIT/Interpreter flags +Option.Llvm.Lli.ForceInterpreter=Force Interpreter +Option.Llvm.Lli.disable-excess-fp-precision=Disable optimizations that may increase floating point precision +Option.Llvm.Lli.enable-finite-only-fp-math=Enable optimizations that assume only finite floating point math +Option.Llvm.Lli.enable-unsafe-fp-math=Enable optimizations that may decrease floating point precision +Option.Llvm.Lli.soft-float=Generate software floating point library calls instead of equivalent hardware instructions +Option.Llvm.Lli.disable-post-RA-scheduler=Disable scheduling after register allocation +Option.Llvm.Lli.disable-spill-fusing=Disable fusing of spill code into instructions +Option.Llvm.Lli.enable-correct-eh-support=Make the -lowerinvoke pass insert expensive, but correct, EH code +Option.Llvm.Lli.jit-enable-eh=Exception handling should be enabled in the just-in-time compiler +Option.Llvm.Assembler.Flags=Assembler flags +Option.Llvm.Assembler.warn.suppress=Suppress warnings (-W) +Option.Llvm.Assembler.version=Announce version (-v) + +# Platform specific option names +#Option.Windows.Windres.OutputFormat = Output format +#Option.Windows.Windres.OutputFormat.Coff = coff (--output-format coff) +#Option.Windows.Windres.OutputFormat.RC = rc (--output-format rc) +#Option.Windows.Windres.OutputFormat.Res = res (--output-format res) +#Option.MacOSX.Linker.Shared=Shared (-dynamiclib) + +# Artifact types +BuildProperty.type.name.bcexe=LLVM bytecode executable for LLI +BuildProperty.type.name.bclib=LLVM bytecode library + +# Content types +ContentType.LlvmBytecodeFileName=LLVM bytecode file +#LLVM assembler file (human-readable) +ContentType.LlvmSourceFileName=LLVM +ContentType.LlvmExecutableFileName=LLVM executable +ContentType.LlvmAssemblerCode=LLVM Assembly Code + +# Languages +Language.LlvmAssembly=LLVM bytecode assembly + +option.name = Clang Option +page.name = LLVM +extension.name = Clang++ managed make per project SCD profile +extension.name.0 = Clang managed make per project SCD profile +extension.name.1 = LLVM-G++ managed make per project SCD profile +extension.name.2 = LLVM-GCC managed make per project SCD profile +option.tip = In this mode the linker will print additional information about the actions it takes, programs it executes, etc. +option.tip.0 = Strip all debug and symbol information from the executable to make it smaller. +option.tip.1 = Strip all debug information from the executable to make it smaller. +option.tip.2 = Run the verification pass after each of the passes to verify intermediate results. +option.tip.3 = Do not mark all symbols as internal. +option.tip.4 = Completely disable optimization. +option.tip.5 = Do not run the inlining pass. Functions will not be inlined into other functions. +option.tip.6 = Generate a native machine code executable. +option.tip.7 = Generate a native machine code executable with the LLVM C backend. Uses the C backend to generate code for the program instead of an LLVM native code generator. +option.tip.8 = Link the bitcode files together as a library, not an executable. In this mode, undefined symbols will be permitted. +option.tip.9 = Print the table of contents. +option.tip.10 = Print statistics recorded by code-generation passes. +option.tip.11 = Disable optimizations that may produce excess precision for floating point. Note that this option can dramatically slow down code on some systems (e.g. X86). +option.tip.12 = Print statistics from the code-generation passes. +enumeratedOptionValue.name = true +enumeratedOptionValue.name.0 = false +option.tip.13 = Causes lli to generate software floating point library calls instead of equivalent hardware instructions. +option.tip.14 = Causes lli to enable optimizations that may decrease floating point precision. +option.tip.15 = Disable optimizations that may increase floating point precision. option.tip.16 = Enable optimizations that assumes only finite floating point math. That is, there is no NAN or Inf values. \ No newline at end of file diff --git a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/plugin.xml b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/plugin.xml index b5aabd8e6ae..edcfd3bca93 100755 --- a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/plugin.xml +++ b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/plugin.xml @@ -1,5357 +1,5357 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/scripts/find_path.bat b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/scripts/find_path.bat index 622f3af1b60..b30a8f51ce0 100644 --- a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/scripts/find_path.bat +++ b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/scripts/find_path.bat @@ -1,9 +1,9 @@ -@echo OFF - -for %%D in (c,d,e) do ( - If exist %%D:\ ( - for /f "delims=" %%f in ('dir /b /s %%D:\%1 2^> NUL') do ( - @echo %1 found: %%~dpf - ) - ) +@echo OFF + +for %%D in (c,d,e) do ( + If exist %%D:\ ( + for /f "delims=" %%f in ('dir /b /s %%D:\%1 2^> NUL') do ( + @echo %1 found: %%~dpf + ) + ) ) \ No newline at end of file diff --git a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/src/org/eclipse/cdt/managedbuilder/llvm/makegen/LlvmDependencyCalculator2.java b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/src/org/eclipse/cdt/managedbuilder/llvm/makegen/LlvmDependencyCalculator2.java index 8b9db769493..84739b0a72f 100755 --- a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/src/org/eclipse/cdt/managedbuilder/llvm/makegen/LlvmDependencyCalculator2.java +++ b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/src/org/eclipse/cdt/managedbuilder/llvm/makegen/LlvmDependencyCalculator2.java @@ -1,43 +1,43 @@ -/******************************************************************************* - * Copyright (c) 2010-2013 Nokia Siemens Networks Oyj, Finland. - * 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: - * Nokia Siemens Networks - initial implementation - * Leo Hippelainen - Initial implementation - *******************************************************************************/ -package org.eclipse.cdt.managedbuilder.llvm.makegen; - -import org.eclipse.cdt.managedbuilder.core.IBuildObject; -import org.eclipse.cdt.managedbuilder.core.ITool; -import org.eclipse.cdt.managedbuilder.makegen.IManagedDependencyInfo; -import org.eclipse.cdt.managedbuilder.makegen.gnu.DefaultGCCDependencyCalculator2; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.runtime.IPath; - -public class LlvmDependencyCalculator2 extends DefaultGCCDependencyCalculator2 { - - /* - * (non-Javadoc) - * @see org.eclipse.cdt.managedbuilder.makegen.IManagedDependencyGenerator2#getDependencySourceInfo(org.eclipse.core.runtime.IPath, - * org.eclipse.cdt.managedbuilder.core.IBuildObject, org.eclipse.cdt.managedbuilder.core.ITool, org.eclipse.core.runtime.IPath) - */ - @Override - public IManagedDependencyInfo getDependencySourceInfo(IPath source, IResource resource, IBuildObject buildContext, - ITool tool, IPath topBuildDirectory) { - return new LlvmDependencyCalculator2Commands(source, resource, buildContext, tool, topBuildDirectory); - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.managedbuilder.makegen.IManagedDependencyGenerator2#getDependencySourceInfo(org.eclipse.core.runtime.IPath, - * org.eclipse.cdt.managedbuilder.core.IBuildObject, org.eclipse.cdt.managedbuilder.core.ITool, org.eclipse.core.runtime.IPath) - */ - @Override - public IManagedDependencyInfo getDependencySourceInfo(IPath source, IBuildObject buildContext, ITool tool, IPath topBuildDirectory) { - return new LlvmDependencyCalculator2Commands(source, buildContext, tool, topBuildDirectory); - } - -} +/******************************************************************************* + * Copyright (c) 2010-2013 Nokia Siemens Networks Oyj, Finland. + * 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: + * Nokia Siemens Networks - initial implementation + * Leo Hippelainen - Initial implementation + *******************************************************************************/ +package org.eclipse.cdt.managedbuilder.llvm.makegen; + +import org.eclipse.cdt.managedbuilder.core.IBuildObject; +import org.eclipse.cdt.managedbuilder.core.ITool; +import org.eclipse.cdt.managedbuilder.makegen.IManagedDependencyInfo; +import org.eclipse.cdt.managedbuilder.makegen.gnu.DefaultGCCDependencyCalculator2; +import org.eclipse.core.resources.IResource; +import org.eclipse.core.runtime.IPath; + +public class LlvmDependencyCalculator2 extends DefaultGCCDependencyCalculator2 { + + /* + * (non-Javadoc) + * @see org.eclipse.cdt.managedbuilder.makegen.IManagedDependencyGenerator2#getDependencySourceInfo(org.eclipse.core.runtime.IPath, + * org.eclipse.cdt.managedbuilder.core.IBuildObject, org.eclipse.cdt.managedbuilder.core.ITool, org.eclipse.core.runtime.IPath) + */ + @Override + public IManagedDependencyInfo getDependencySourceInfo(IPath source, IResource resource, IBuildObject buildContext, + ITool tool, IPath topBuildDirectory) { + return new LlvmDependencyCalculator2Commands(source, resource, buildContext, tool, topBuildDirectory); + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.managedbuilder.makegen.IManagedDependencyGenerator2#getDependencySourceInfo(org.eclipse.core.runtime.IPath, + * org.eclipse.cdt.managedbuilder.core.IBuildObject, org.eclipse.cdt.managedbuilder.core.ITool, org.eclipse.core.runtime.IPath) + */ + @Override + public IManagedDependencyInfo getDependencySourceInfo(IPath source, IBuildObject buildContext, ITool tool, IPath topBuildDirectory) { + return new LlvmDependencyCalculator2Commands(source, buildContext, tool, topBuildDirectory); + } + +} diff --git a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/src/org/eclipse/cdt/managedbuilder/llvm/makegen/LlvmDependencyCalculator2Commands.java b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/src/org/eclipse/cdt/managedbuilder/llvm/makegen/LlvmDependencyCalculator2Commands.java index fbce602bff9..b832788afa2 100755 --- a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/src/org/eclipse/cdt/managedbuilder/llvm/makegen/LlvmDependencyCalculator2Commands.java +++ b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/src/org/eclipse/cdt/managedbuilder/llvm/makegen/LlvmDependencyCalculator2Commands.java @@ -1,61 +1,61 @@ -/******************************************************************************* - * Copyright (c) 2010-2013 Nokia Siemens Networks Oyj, Finland. - * 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: - * Nokia Siemens Networks - initial implementation - * Leo Hippelainen - Initial implementation - *******************************************************************************/ -package org.eclipse.cdt.managedbuilder.llvm.makegen; - -import org.eclipse.cdt.managedbuilder.core.IBuildObject; -import org.eclipse.cdt.managedbuilder.core.ITool; -import org.eclipse.cdt.managedbuilder.makegen.gnu.DefaultGCCDependencyCalculator2Commands; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.runtime.IPath; - -public class LlvmDependencyCalculator2Commands extends - DefaultGCCDependencyCalculator2Commands { - - - /** - * @param source IPath - * @param resource IResource - * @param buildContext IBuildObject - * @param tool ITool - * @param topBuildDirectory IPath - */ - public LlvmDependencyCalculator2Commands(IPath source, IResource resource, IBuildObject buildContext, ITool tool, IPath topBuildDirectory){ - super(source, resource, buildContext, tool, topBuildDirectory); - } - - /** - * @param source IPath - * @param buildContext IBuildObject - * @param tool ITool - * @param topBuildDirectory IPath - */ - public LlvmDependencyCalculator2Commands(IPath source, - IBuildObject buildContext, ITool tool, IPath topBuildDirectory) { - super(source, buildContext, tool, topBuildDirectory); - } - - /* - * (non-Javadoc) - * @see org.eclipse.cdt.managedbuilder.makegen.IManagedDependencyCommands#getDependencyCommandOptions() - */ - @Override - public String[] getDependencyCommandOptions() { - String[] options = new String[2]; - // -MMD - options[0] = "-MMD"; //$NON-NLS-1$ - // -MP - options[1] = "-MP"; //$NON-NLS-1$ - // TODO: Check if -MF and/or -MT supported or needed with Clang - return options; - } - -} +/******************************************************************************* + * Copyright (c) 2010-2013 Nokia Siemens Networks Oyj, Finland. + * 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: + * Nokia Siemens Networks - initial implementation + * Leo Hippelainen - Initial implementation + *******************************************************************************/ +package org.eclipse.cdt.managedbuilder.llvm.makegen; + +import org.eclipse.cdt.managedbuilder.core.IBuildObject; +import org.eclipse.cdt.managedbuilder.core.ITool; +import org.eclipse.cdt.managedbuilder.makegen.gnu.DefaultGCCDependencyCalculator2Commands; +import org.eclipse.core.resources.IResource; +import org.eclipse.core.runtime.IPath; + +public class LlvmDependencyCalculator2Commands extends + DefaultGCCDependencyCalculator2Commands { + + + /** + * @param source IPath + * @param resource IResource + * @param buildContext IBuildObject + * @param tool ITool + * @param topBuildDirectory IPath + */ + public LlvmDependencyCalculator2Commands(IPath source, IResource resource, IBuildObject buildContext, ITool tool, IPath topBuildDirectory){ + super(source, resource, buildContext, tool, topBuildDirectory); + } + + /** + * @param source IPath + * @param buildContext IBuildObject + * @param tool ITool + * @param topBuildDirectory IPath + */ + public LlvmDependencyCalculator2Commands(IPath source, + IBuildObject buildContext, ITool tool, IPath topBuildDirectory) { + super(source, buildContext, tool, topBuildDirectory); + } + + /* + * (non-Javadoc) + * @see org.eclipse.cdt.managedbuilder.makegen.IManagedDependencyCommands#getDependencyCommandOptions() + */ + @Override + public String[] getDependencyCommandOptions() { + String[] options = new String[2]; + // -MMD + options[0] = "-MMD"; //$NON-NLS-1$ + // -MP + options[1] = "-MP"; //$NON-NLS-1$ + // TODO: Check if -MF and/or -MT supported or needed with Clang + return options; + } + +} diff --git a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/src/org/eclipse/cdt/managedbuilder/llvm/ui/LlvmEnvironmentVariableSupplier.java b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/src/org/eclipse/cdt/managedbuilder/llvm/ui/LlvmEnvironmentVariableSupplier.java index 808a8a76996..62a398c28f9 100755 --- a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/src/org/eclipse/cdt/managedbuilder/llvm/ui/LlvmEnvironmentVariableSupplier.java +++ b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/src/org/eclipse/cdt/managedbuilder/llvm/ui/LlvmEnvironmentVariableSupplier.java @@ -1,454 +1,454 @@ -/******************************************************************************* - * Copyright (c) 2010, 2016 Nokia Siemens Networks Oyj, Finland. - * 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: - * Nokia Siemens Networks - initial implementation - * Leo Hippelainen - Initial implementation - * Petri Tuononen - Initial implementation - * Marc-Andre Laperle (Ericsson) +/******************************************************************************* + * Copyright (c) 2010, 2016 Nokia Siemens Networks Oyj, Finland. + * 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: + * Nokia Siemens Networks - initial implementation + * Leo Hippelainen - Initial implementation + * Petri Tuononen - Initial implementation + * Marc-Andre Laperle (Ericsson) *******************************************************************************/ -package org.eclipse.cdt.managedbuilder.llvm.ui; - -import java.io.File; -import java.util.HashMap; - -import org.eclipse.cdt.internal.core.MinGW; -import org.eclipse.cdt.managedbuilder.core.IConfiguration; -import org.eclipse.cdt.managedbuilder.envvar.IBuildEnvironmentVariable; -import org.eclipse.cdt.managedbuilder.envvar.IConfigurationEnvironmentVariableSupplier; -import org.eclipse.cdt.managedbuilder.envvar.IEnvironmentVariableProvider; -import org.eclipse.cdt.managedbuilder.gnu.cygwin.GnuCygwinConfigurationEnvironmentSupplier; -import org.eclipse.cdt.managedbuilder.gnu.mingw.MingwEnvironmentVariableSupplier; -import org.eclipse.cdt.managedbuilder.llvm.ui.preferences.LlvmPreferenceStore; -import org.eclipse.cdt.managedbuilder.llvm.util.Separators; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.Path; - -/** - * Contains LLVM environment variables. - * - * @noextend This class is not intended to be subclassed by clients. - */ -public class LlvmEnvironmentVariableSupplier implements IConfigurationEnvironmentVariableSupplier { - // toggle for preference changes - private static boolean preferencesChanged = true; - // LLVM environment variable data structure - private static HashMap llvmEnvironmentVariables = - new HashMap<>(6); - // Environment variables for HashMap usage - private static final String ENV_VAR_NAME_LLVM_BIN = "LLVM_BIN_PATH"; //$NON-NLS-1$ - private static final String ENV_VAR_NAME_LLVMINTERP = "LLVMINTERP"; //$NON-NLS-1$ - private static final String ENV_VAR_NAME_PATH = "PATH"; //$NON-NLS-1$ - private static final String ENV_VAR_NAME_INCLUDE_PATH = "INCLUDE_PATH"; //$NON-NLS-1$ - private static final String ENV_VAR_NAME_LIBRARY_PATH = "LLVM_LIB_SEARCH_PATH"; //$NON-NLS-1$ - private static final String ENV_VAR_NAME_LIBRARIES = "LIBRARIES"; //$NON-NLS-1$ - - /** - * Initializes llvm environment variable paths from the system environment variables. - */ - public static void initializePaths() { //TODO: Is this actually called anywhere? - // get bin path - String binPath = getBinPath(); - // set LLVM bin path environment variable - setLlvmEnvironmentVariableReplace(ENV_VAR_NAME_LLVM_BIN, binPath); - // if bin path exists - if (binPath != null && binPath.length()!=0) { - String pathStr = binPath; - // if OS is Windows (Windows specific settings) - if (System.getProperty("os.name").toLowerCase().indexOf("win") >= 0) { //$NON-NLS-1$ //$NON-NLS-2$ - try { - // try to find mingw or cygwin path from PATH environment variable - IBuildEnvironmentVariable envPath = - llvmEnvironmentVariables.get(ENV_VAR_NAME_PATH); - IBuildEnvironmentVariable mingwPath=null, cygwinPath=null; - // if path is empty - if (envPath == null) { - // try to find mingw path from MingwEnvironmentVariableSupplier - IConfigurationEnvironmentVariableSupplier mingwEnvironmentVariables = - new MingwEnvironmentVariableSupplier(); - mingwPath = mingwEnvironmentVariables.getVariable( - ENV_VAR_NAME_PATH, null, null); - // try to find cygwin path from GnuCygwinConfigurationEnvironmentSupplier - IConfigurationEnvironmentVariableSupplier cygwinEnvironmentVariables = - new GnuCygwinConfigurationEnvironmentSupplier(); - cygwinPath = cygwinEnvironmentVariables.getVariable( - ENV_VAR_NAME_PATH, null, null); - - } - // if mingw found - if (mingwPath != null) { - //form full path - pathStr = pathStr + System.getProperty("path.separator") + mingwPath.getValue(); //$NON-NLS-1$ - } - // if cygwin found - if (cygwinPath != null) { - //form full path - pathStr = pathStr + System.getProperty("path.separator") + cygwinPath.getValue(); //$NON-NLS-1$ - } - } catch (Exception e) { - //TODO: Emit proper error message and enter it to Eclipse error log. - e.printStackTrace(); - } - } - //initialize environment variable cache values - setLlvmEnvironmentVariable(ENV_VAR_NAME_PATH, pathStr); - setLlvmEnvironmentVariable(ENV_VAR_NAME_LLVMINTERP, binPath + Separators.getFileSeparator() + "lli"); //$NON-NLS-1$ - setLlvmEnvironmentVariable(ENV_VAR_NAME_INCLUDE_PATH, getSysEnvPath(ENV_VAR_NAME_INCLUDE_PATH)); - setLlvmEnvironmentVariable(ENV_VAR_NAME_LIBRARY_PATH, getSysEnvPath(ENV_VAR_NAME_LIBRARY_PATH)); - setLlvmEnvironmentVariable(ENV_VAR_NAME_LIBRARIES, getSysEnvPath(ENV_VAR_NAME_LIBRARIES)); - preferencesChanged = false; - } - } - - /** - * Returns LLVM bin path - * - * @return LLVM bin path - */ - public static String getBinPath() { - return findBinDir(ENV_VAR_NAME_LLVM_BIN, "bin"); //$NON-NLS-1$ - } - - /** - * Returns LLVM include paths - * - * @return LLVM include paths - */ - public static String getIncludePath() { - return getLlvmEnvironmentVariable(ENV_VAR_NAME_INCLUDE_PATH).getValue(); - } - - /** - * Returns LLVM library paths - * - * @return LLVM library paths - */ - public static String getLibraryPath() { - return getLlvmEnvironmentVariable(ENV_VAR_NAME_LIBRARY_PATH).getValue(); - } - - /** - * Returns LLVM libraries - * - * @return LLVM libraries - */ - public static String getLibraries() { - return getLlvmEnvironmentVariable(ENV_VAR_NAME_LIBRARIES).getValue(); - } - - /** - * Sets path to LLVM bin. - * - * @param path Path to LLVM bin location. - */ - public static void setBinPath(String path) { - setLlvmEnvironmentVariableReplace(ENV_VAR_NAME_LLVM_BIN, path); - } - - /** - * Appends a new include path. - * - * @param path Include path - */ - public static void addIncludePath(String path) { - String existingIncPaths = getIncludePath(); - //add the include path only if it doesn't already exists - if (!existingIncPaths.contains(path)) { - appendLlvmEnvironmentVariable(ENV_VAR_NAME_INCLUDE_PATH, existingIncPaths, path); - } - } - - /** - * Appends a new library path. - * - * @param path Library path - */ - public static void addLibraryPath(String path) { - String existingLibPaths = getLibraryPath(); - //add the library path only if it doesn't already exists - if (!existingLibPaths.contains(path)) { - appendLlvmEnvironmentVariable(ENV_VAR_NAME_LIBRARY_PATH, existingLibPaths, path); - } - } - - /** - * Appends a new library. - * - * @param lib Library file - */ - public static void addLibrary(String lib) { - String existingLibs = getLibraries(); - //add the library only if it doesn't already exists - if (!existingLibs.contains(lib)) { - appendLlvmEnvironmentVariable(ENV_VAR_NAME_LIBRARIES, existingLibs, lib); - } - } - - /** - * This is to be called if some of the preference paths have changed. - */ - public static void notifyPreferenceChange() { //TODO: Change - preferencesChanged = true; - } - - /** - * Returns a specific path for given parameters. - * - * @param pathKey Path for specific location - * @param subDirName Additional sub-path - * @return bin path - */ - private static String findBinDir(String pathKey, String subDirName) { - String resultPath = null; - // If preferences haven't been changed, try to find the bin path from the LLVM environment - // variable map. - if (!preferencesChanged) { //TODO: Change - //get current path - LlvmBuildEnvironmentVariable earlierValue = llvmEnvironmentVariables.get(pathKey); - //if earlier LlvmBuildEnvironmentVariable exists - if (null != earlierValue) { - //return current path - return earlierValue.getValue(); - } - } else { - // Try if the path is set in the LLVM plug-in preferences - String preferenceLocation = LlvmPreferenceStore.getBinPath(); - // if preference exists - if (null != preferenceLocation) { - // remove white spaces from preference location - preferenceLocation = preferenceLocation.trim(); - // if preference location is not empty - if (preferenceLocation.length()!=0) { - // get path for LLVM executable - resultPath = getDirIfLlvmFound(preferenceLocation, null); - // if LLVM executable path doesn't exist - if (null == resultPath) { - // If no luck check next with sub directory name appended - resultPath = getDirIfLlvmFound(preferenceLocation, - subDirName); - } - } - } - if (null == resultPath) { - // If still no luck try all folders listed in PATH - String pathVariable = System.getenv(ENV_VAR_NAME_PATH); - // split paths to String array - String[] paths = pathVariable.split(Separators.getPathSeparator()); - // check every path if LLVM executable is found - for (String pathStr : paths) { - resultPath = getDirIfLlvmFound(pathStr, null); - // stop loop if LLVM executable path is found - if (null != resultPath) { - break; - } - } - } - // return found path - return resultPath; - } - return null; - } - - /** - * Returns LLVM executable path. - * - * @param candidatePath Suggestion for LLVM executable path - * @param subPath Additional sub-path for LLVM executable path - * @return Full path for LLVM executable if valid, otherwise null - */ - private static String getDirIfLlvmFound(String candidatePath, String subPath) { - String llvmPath = candidatePath; - // If there is a trailing / or \, remove it - if (llvmPath.endsWith(Separators.getFileSeparator()) && llvmPath.length() > 1) { - llvmPath = llvmPath.substring(0, candidatePath.length() - 1); - } - // If subPath exists and is not empty -> append it to candidatePath. - if (null != subPath && !subPath.isEmpty()) { - // Form full path. - llvmPath = llvmPath + Separators.getFileSeparator() + subPath; - } - // Return a full path for LLVM executable if it's valid, otherwise null. - return getBinDirIfLlvm_ar(llvmPath); - } - - /** - * Returns the full path for llvm executable if the bin path given - * as a parameter is found and executable exists in that path. - * - * @param binPathTemp User provided bin directory path - * @return bin path where llvm-ar is located if executable exists - */ - private static String getBinDirIfLlvm_ar(String binPathTemp) { - //if given directory is found - if (new Path(binPathTemp).toFile().isDirectory()) { - String llvm_executable = "llvm-ar"; //$NON-NLS-1$ - File arFileFullPath = null; - // If OS is Windows -> add .exe to the executable name. - if (System.getProperty("os.name").toLowerCase().indexOf("win") >= 0) { //$NON-NLS-1$//$NON-NLS-2$ - llvm_executable = llvm_executable + ".exe"; //$NON-NLS-1$ - } - // Form full executable path - arFileFullPath = new File(binPathTemp, llvm_executable); - // Check if file exists -> proper LLVM installation exists. - if (arFileFullPath.isFile()) { - // Return path where llvm-ar exists. - return binPathTemp; - } - } - return null; - } - - /** - * @return location of $MINGW_HOME/bin folder on the file-system. - * @deprecated. Deprecated as of CDT 8.2. Note that MinGW root path in general may depend on configuration. - * - * If you use this do not cache results to ensure user preferences are accounted for. - * Please rely on internal caching. - */ - @Deprecated - private static IPath getBinDir() { - IPath binDir = null; - String minGWHome = MinGW.getMinGWHome(); - if (minGWHome != null) { - binDir = new Path(minGWHome).append("bin"); //$NON-NLS-1$ - } - return binDir; - } - - /** - * Returns stdc++ library path located in MinGW installation. - * - * @return stdc++ library path for MinGW - */ - public static String getMinGWStdLib() { - // get mingw bin path - IPath mingwBinPath = getBinDir(); - if (mingwBinPath != null) { - StringBuilder sB = new StringBuilder(mingwBinPath.toOSString()); - // drop bin - if (sB.length() >= 3) { - sB.delete(sB.length() - 3, sB.length()); - // append mingw lib subdir - sB.append("lib\\gcc\\mingw32\\"); //$NON-NLS-1$ - // get all files in the directory - File f = new File(sB.toString()); - if (f.isDirectory()) { - String[] list = f.list(); - if (list.length > 0) { - // append the first dir - sB.append(list[0]); - return sB.toString(); - } - } - } - } - - return null; - } - - /** - * - * Returns LLVM environment variable. - * - * @param envName Name of the environment variable - */ - public static LlvmBuildEnvironmentVariable getLlvmEnvironmentVariable(String envName) { - return llvmEnvironmentVariables.get(envName); - } - - /** - * Sets LLVM environment variable. - * - * @param name Name for the environment variable - * @param path Path for the environment variable - */ - private static void setLlvmEnvironmentVariable(String name, String path) { - // append a new path in front of the the old path in HashMap that contains - // the specific LLVM environment variable - llvmEnvironmentVariables.put(name, new LlvmBuildEnvironmentVariable( - name, path, IBuildEnvironmentVariable.ENVVAR_APPEND)); - } - - /** - * Sets LLVM environment variable by replacing the existing paths. - * - * @param name Name for the environment variable - * @param path Path for the environment variable - */ - public static void setLlvmEnvironmentVariableReplace(String name, String path) { - // replace the old path in HashMap that contains the specific LLVM environment variable - llvmEnvironmentVariables.put(name, new LlvmBuildEnvironmentVariable( - name, path, IBuildEnvironmentVariable.ENVVAR_REPLACE)); - } - - /** - * Appends a new LLVM environment variable to existing list. - * - * @param name Name of the preference - * @param oldPath Old paths/preference values - * @param path New path to be added to the environment variable - */ - public static void appendLlvmEnvironmentVariable(String name, String oldPath, String path) { - String newPath = null; - boolean ok = false; - // if oldPath exists - if (oldPath!=null) { - //if the oldPath isn't empty - if (!oldPath.trim().isEmpty()) { - StringBuilder sB = new StringBuilder(); - // append old path - sB.append(oldPath); - // append a path separator - sB.append(Separators.getPathSeparator()); - // append the new path - sB.append(path); - // construct a new full path - newPath = sB.toString(); - ok = true; - } - } - if (!ok) { - newPath=path; - } - // Set new path to the HashMap that contains the specific LLVM environment variable - // if newPath exists. - if (newPath != null) { - // if the newPath isn't empty - if (!newPath.trim().isEmpty()) { - // add new values to the LLVM environment variable - llvmEnvironmentVariables.put(name, new LlvmBuildEnvironmentVariable(name, newPath, - IBuildEnvironmentVariable.ENVVAR_APPEND)); - } - } - } - - /** - * Returns a system environment variable path - * - * @param envName Environment variable name - * @return system environment variable path - */ - private static String getSysEnvPath(String envName) { - String path = System.getenv(envName); - if (path != null) { - return path; - } - return ""; //$NON-NLS-1$ - } - - @Override - public IBuildEnvironmentVariable getVariable(String variableName, IConfiguration configuration, - IEnvironmentVariableProvider provider) { - return llvmEnvironmentVariables.get(variableName); - } - - @Override - public IBuildEnvironmentVariable[] getVariables(IConfiguration configuration, - IEnvironmentVariableProvider provider) { - return llvmEnvironmentVariables.values().toArray(new IBuildEnvironmentVariable[0]); - } -} +package org.eclipse.cdt.managedbuilder.llvm.ui; + +import java.io.File; +import java.util.HashMap; + +import org.eclipse.cdt.internal.core.MinGW; +import org.eclipse.cdt.managedbuilder.core.IConfiguration; +import org.eclipse.cdt.managedbuilder.envvar.IBuildEnvironmentVariable; +import org.eclipse.cdt.managedbuilder.envvar.IConfigurationEnvironmentVariableSupplier; +import org.eclipse.cdt.managedbuilder.envvar.IEnvironmentVariableProvider; +import org.eclipse.cdt.managedbuilder.gnu.cygwin.GnuCygwinConfigurationEnvironmentSupplier; +import org.eclipse.cdt.managedbuilder.gnu.mingw.MingwEnvironmentVariableSupplier; +import org.eclipse.cdt.managedbuilder.llvm.ui.preferences.LlvmPreferenceStore; +import org.eclipse.cdt.managedbuilder.llvm.util.Separators; +import org.eclipse.core.runtime.IPath; +import org.eclipse.core.runtime.Path; + +/** + * Contains LLVM environment variables. + * + * @noextend This class is not intended to be subclassed by clients. + */ +public class LlvmEnvironmentVariableSupplier implements IConfigurationEnvironmentVariableSupplier { + // toggle for preference changes + private static boolean preferencesChanged = true; + // LLVM environment variable data structure + private static HashMap llvmEnvironmentVariables = + new HashMap<>(6); + // Environment variables for HashMap usage + private static final String ENV_VAR_NAME_LLVM_BIN = "LLVM_BIN_PATH"; //$NON-NLS-1$ + private static final String ENV_VAR_NAME_LLVMINTERP = "LLVMINTERP"; //$NON-NLS-1$ + private static final String ENV_VAR_NAME_PATH = "PATH"; //$NON-NLS-1$ + private static final String ENV_VAR_NAME_INCLUDE_PATH = "INCLUDE_PATH"; //$NON-NLS-1$ + private static final String ENV_VAR_NAME_LIBRARY_PATH = "LLVM_LIB_SEARCH_PATH"; //$NON-NLS-1$ + private static final String ENV_VAR_NAME_LIBRARIES = "LIBRARIES"; //$NON-NLS-1$ + + /** + * Initializes llvm environment variable paths from the system environment variables. + */ + public static void initializePaths() { //TODO: Is this actually called anywhere? + // get bin path + String binPath = getBinPath(); + // set LLVM bin path environment variable + setLlvmEnvironmentVariableReplace(ENV_VAR_NAME_LLVM_BIN, binPath); + // if bin path exists + if (binPath != null && binPath.length()!=0) { + String pathStr = binPath; + // if OS is Windows (Windows specific settings) + if (System.getProperty("os.name").toLowerCase().indexOf("win") >= 0) { //$NON-NLS-1$ //$NON-NLS-2$ + try { + // try to find mingw or cygwin path from PATH environment variable + IBuildEnvironmentVariable envPath = + llvmEnvironmentVariables.get(ENV_VAR_NAME_PATH); + IBuildEnvironmentVariable mingwPath=null, cygwinPath=null; + // if path is empty + if (envPath == null) { + // try to find mingw path from MingwEnvironmentVariableSupplier + IConfigurationEnvironmentVariableSupplier mingwEnvironmentVariables = + new MingwEnvironmentVariableSupplier(); + mingwPath = mingwEnvironmentVariables.getVariable( + ENV_VAR_NAME_PATH, null, null); + // try to find cygwin path from GnuCygwinConfigurationEnvironmentSupplier + IConfigurationEnvironmentVariableSupplier cygwinEnvironmentVariables = + new GnuCygwinConfigurationEnvironmentSupplier(); + cygwinPath = cygwinEnvironmentVariables.getVariable( + ENV_VAR_NAME_PATH, null, null); + + } + // if mingw found + if (mingwPath != null) { + //form full path + pathStr = pathStr + System.getProperty("path.separator") + mingwPath.getValue(); //$NON-NLS-1$ + } + // if cygwin found + if (cygwinPath != null) { + //form full path + pathStr = pathStr + System.getProperty("path.separator") + cygwinPath.getValue(); //$NON-NLS-1$ + } + } catch (Exception e) { + //TODO: Emit proper error message and enter it to Eclipse error log. + e.printStackTrace(); + } + } + //initialize environment variable cache values + setLlvmEnvironmentVariable(ENV_VAR_NAME_PATH, pathStr); + setLlvmEnvironmentVariable(ENV_VAR_NAME_LLVMINTERP, binPath + Separators.getFileSeparator() + "lli"); //$NON-NLS-1$ + setLlvmEnvironmentVariable(ENV_VAR_NAME_INCLUDE_PATH, getSysEnvPath(ENV_VAR_NAME_INCLUDE_PATH)); + setLlvmEnvironmentVariable(ENV_VAR_NAME_LIBRARY_PATH, getSysEnvPath(ENV_VAR_NAME_LIBRARY_PATH)); + setLlvmEnvironmentVariable(ENV_VAR_NAME_LIBRARIES, getSysEnvPath(ENV_VAR_NAME_LIBRARIES)); + preferencesChanged = false; + } + } + + /** + * Returns LLVM bin path + * + * @return LLVM bin path + */ + public static String getBinPath() { + return findBinDir(ENV_VAR_NAME_LLVM_BIN, "bin"); //$NON-NLS-1$ + } + + /** + * Returns LLVM include paths + * + * @return LLVM include paths + */ + public static String getIncludePath() { + return getLlvmEnvironmentVariable(ENV_VAR_NAME_INCLUDE_PATH).getValue(); + } + + /** + * Returns LLVM library paths + * + * @return LLVM library paths + */ + public static String getLibraryPath() { + return getLlvmEnvironmentVariable(ENV_VAR_NAME_LIBRARY_PATH).getValue(); + } + + /** + * Returns LLVM libraries + * + * @return LLVM libraries + */ + public static String getLibraries() { + return getLlvmEnvironmentVariable(ENV_VAR_NAME_LIBRARIES).getValue(); + } + + /** + * Sets path to LLVM bin. + * + * @param path Path to LLVM bin location. + */ + public static void setBinPath(String path) { + setLlvmEnvironmentVariableReplace(ENV_VAR_NAME_LLVM_BIN, path); + } + + /** + * Appends a new include path. + * + * @param path Include path + */ + public static void addIncludePath(String path) { + String existingIncPaths = getIncludePath(); + //add the include path only if it doesn't already exists + if (!existingIncPaths.contains(path)) { + appendLlvmEnvironmentVariable(ENV_VAR_NAME_INCLUDE_PATH, existingIncPaths, path); + } + } + + /** + * Appends a new library path. + * + * @param path Library path + */ + public static void addLibraryPath(String path) { + String existingLibPaths = getLibraryPath(); + //add the library path only if it doesn't already exists + if (!existingLibPaths.contains(path)) { + appendLlvmEnvironmentVariable(ENV_VAR_NAME_LIBRARY_PATH, existingLibPaths, path); + } + } + + /** + * Appends a new library. + * + * @param lib Library file + */ + public static void addLibrary(String lib) { + String existingLibs = getLibraries(); + //add the library only if it doesn't already exists + if (!existingLibs.contains(lib)) { + appendLlvmEnvironmentVariable(ENV_VAR_NAME_LIBRARIES, existingLibs, lib); + } + } + + /** + * This is to be called if some of the preference paths have changed. + */ + public static void notifyPreferenceChange() { //TODO: Change + preferencesChanged = true; + } + + /** + * Returns a specific path for given parameters. + * + * @param pathKey Path for specific location + * @param subDirName Additional sub-path + * @return bin path + */ + private static String findBinDir(String pathKey, String subDirName) { + String resultPath = null; + // If preferences haven't been changed, try to find the bin path from the LLVM environment + // variable map. + if (!preferencesChanged) { //TODO: Change + //get current path + LlvmBuildEnvironmentVariable earlierValue = llvmEnvironmentVariables.get(pathKey); + //if earlier LlvmBuildEnvironmentVariable exists + if (null != earlierValue) { + //return current path + return earlierValue.getValue(); + } + } else { + // Try if the path is set in the LLVM plug-in preferences + String preferenceLocation = LlvmPreferenceStore.getBinPath(); + // if preference exists + if (null != preferenceLocation) { + // remove white spaces from preference location + preferenceLocation = preferenceLocation.trim(); + // if preference location is not empty + if (preferenceLocation.length()!=0) { + // get path for LLVM executable + resultPath = getDirIfLlvmFound(preferenceLocation, null); + // if LLVM executable path doesn't exist + if (null == resultPath) { + // If no luck check next with sub directory name appended + resultPath = getDirIfLlvmFound(preferenceLocation, + subDirName); + } + } + } + if (null == resultPath) { + // If still no luck try all folders listed in PATH + String pathVariable = System.getenv(ENV_VAR_NAME_PATH); + // split paths to String array + String[] paths = pathVariable.split(Separators.getPathSeparator()); + // check every path if LLVM executable is found + for (String pathStr : paths) { + resultPath = getDirIfLlvmFound(pathStr, null); + // stop loop if LLVM executable path is found + if (null != resultPath) { + break; + } + } + } + // return found path + return resultPath; + } + return null; + } + + /** + * Returns LLVM executable path. + * + * @param candidatePath Suggestion for LLVM executable path + * @param subPath Additional sub-path for LLVM executable path + * @return Full path for LLVM executable if valid, otherwise null + */ + private static String getDirIfLlvmFound(String candidatePath, String subPath) { + String llvmPath = candidatePath; + // If there is a trailing / or \, remove it + if (llvmPath.endsWith(Separators.getFileSeparator()) && llvmPath.length() > 1) { + llvmPath = llvmPath.substring(0, candidatePath.length() - 1); + } + // If subPath exists and is not empty -> append it to candidatePath. + if (null != subPath && !subPath.isEmpty()) { + // Form full path. + llvmPath = llvmPath + Separators.getFileSeparator() + subPath; + } + // Return a full path for LLVM executable if it's valid, otherwise null. + return getBinDirIfLlvm_ar(llvmPath); + } + + /** + * Returns the full path for llvm executable if the bin path given + * as a parameter is found and executable exists in that path. + * + * @param binPathTemp User provided bin directory path + * @return bin path where llvm-ar is located if executable exists + */ + private static String getBinDirIfLlvm_ar(String binPathTemp) { + //if given directory is found + if (new Path(binPathTemp).toFile().isDirectory()) { + String llvm_executable = "llvm-ar"; //$NON-NLS-1$ + File arFileFullPath = null; + // If OS is Windows -> add .exe to the executable name. + if (System.getProperty("os.name").toLowerCase().indexOf("win") >= 0) { //$NON-NLS-1$//$NON-NLS-2$ + llvm_executable = llvm_executable + ".exe"; //$NON-NLS-1$ + } + // Form full executable path + arFileFullPath = new File(binPathTemp, llvm_executable); + // Check if file exists -> proper LLVM installation exists. + if (arFileFullPath.isFile()) { + // Return path where llvm-ar exists. + return binPathTemp; + } + } + return null; + } + + /** + * @return location of $MINGW_HOME/bin folder on the file-system. + * @deprecated. Deprecated as of CDT 8.2. Note that MinGW root path in general may depend on configuration. + * + * If you use this do not cache results to ensure user preferences are accounted for. + * Please rely on internal caching. + */ + @Deprecated + private static IPath getBinDir() { + IPath binDir = null; + String minGWHome = MinGW.getMinGWHome(); + if (minGWHome != null) { + binDir = new Path(minGWHome).append("bin"); //$NON-NLS-1$ + } + return binDir; + } + + /** + * Returns stdc++ library path located in MinGW installation. + * + * @return stdc++ library path for MinGW + */ + public static String getMinGWStdLib() { + // get mingw bin path + IPath mingwBinPath = getBinDir(); + if (mingwBinPath != null) { + StringBuilder sB = new StringBuilder(mingwBinPath.toOSString()); + // drop bin + if (sB.length() >= 3) { + sB.delete(sB.length() - 3, sB.length()); + // append mingw lib subdir + sB.append("lib\\gcc\\mingw32\\"); //$NON-NLS-1$ + // get all files in the directory + File f = new File(sB.toString()); + if (f.isDirectory()) { + String[] list = f.list(); + if (list.length > 0) { + // append the first dir + sB.append(list[0]); + return sB.toString(); + } + } + } + } + + return null; + } + + /** + * + * Returns LLVM environment variable. + * + * @param envName Name of the environment variable + */ + public static LlvmBuildEnvironmentVariable getLlvmEnvironmentVariable(String envName) { + return llvmEnvironmentVariables.get(envName); + } + + /** + * Sets LLVM environment variable. + * + * @param name Name for the environment variable + * @param path Path for the environment variable + */ + private static void setLlvmEnvironmentVariable(String name, String path) { + // append a new path in front of the the old path in HashMap that contains + // the specific LLVM environment variable + llvmEnvironmentVariables.put(name, new LlvmBuildEnvironmentVariable( + name, path, IBuildEnvironmentVariable.ENVVAR_APPEND)); + } + + /** + * Sets LLVM environment variable by replacing the existing paths. + * + * @param name Name for the environment variable + * @param path Path for the environment variable + */ + public static void setLlvmEnvironmentVariableReplace(String name, String path) { + // replace the old path in HashMap that contains the specific LLVM environment variable + llvmEnvironmentVariables.put(name, new LlvmBuildEnvironmentVariable( + name, path, IBuildEnvironmentVariable.ENVVAR_REPLACE)); + } + + /** + * Appends a new LLVM environment variable to existing list. + * + * @param name Name of the preference + * @param oldPath Old paths/preference values + * @param path New path to be added to the environment variable + */ + public static void appendLlvmEnvironmentVariable(String name, String oldPath, String path) { + String newPath = null; + boolean ok = false; + // if oldPath exists + if (oldPath!=null) { + //if the oldPath isn't empty + if (!oldPath.trim().isEmpty()) { + StringBuilder sB = new StringBuilder(); + // append old path + sB.append(oldPath); + // append a path separator + sB.append(Separators.getPathSeparator()); + // append the new path + sB.append(path); + // construct a new full path + newPath = sB.toString(); + ok = true; + } + } + if (!ok) { + newPath=path; + } + // Set new path to the HashMap that contains the specific LLVM environment variable + // if newPath exists. + if (newPath != null) { + // if the newPath isn't empty + if (!newPath.trim().isEmpty()) { + // add new values to the LLVM environment variable + llvmEnvironmentVariables.put(name, new LlvmBuildEnvironmentVariable(name, newPath, + IBuildEnvironmentVariable.ENVVAR_APPEND)); + } + } + } + + /** + * Returns a system environment variable path + * + * @param envName Environment variable name + * @return system environment variable path + */ + private static String getSysEnvPath(String envName) { + String path = System.getenv(envName); + if (path != null) { + return path; + } + return ""; //$NON-NLS-1$ + } + + @Override + public IBuildEnvironmentVariable getVariable(String variableName, IConfiguration configuration, + IEnvironmentVariableProvider provider) { + return llvmEnvironmentVariables.get(variableName); + } + + @Override + public IBuildEnvironmentVariable[] getVariables(IConfiguration configuration, + IEnvironmentVariableProvider provider) { + return llvmEnvironmentVariables.values().toArray(new IBuildEnvironmentVariable[0]); + } +} diff --git a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/src/org/eclipse/cdt/managedbuilder/llvm/ui/LlvmIsToolChainSupported.java b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/src/org/eclipse/cdt/managedbuilder/llvm/ui/LlvmIsToolChainSupported.java index f2389506f02..0c14f0d5810 100755 --- a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/src/org/eclipse/cdt/managedbuilder/llvm/ui/LlvmIsToolChainSupported.java +++ b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/src/org/eclipse/cdt/managedbuilder/llvm/ui/LlvmIsToolChainSupported.java @@ -1,52 +1,52 @@ -/******************************************************************************* - * Copyright (c) 2010-2015 Nokia Siemens Networks Oyj, Finland. - * 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: - * Nokia Siemens Networks - initial implementation - * Leo Hippelainen - Initial implementation +/******************************************************************************* + * Copyright (c) 2010-2015 Nokia Siemens Networks Oyj, Finland. + * 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: + * Nokia Siemens Networks - initial implementation + * Leo Hippelainen - Initial implementation *******************************************************************************/ -package org.eclipse.cdt.managedbuilder.llvm.ui; - -import org.eclipse.cdt.managedbuilder.core.IManagedIsToolChainSupported; -import org.eclipse.cdt.managedbuilder.core.IToolChain; -import org.osgi.framework.Version; - -/** - * Based on MingwIsToolChainSupported. - * - */ -public class LlvmIsToolChainSupported implements IManagedIsToolChainSupported { - - private final boolean supported; - - /** - * Constructor. - * LLVM Toolchain is supported if binary path for LLVM Tools can be found. - */ - public LlvmIsToolChainSupported() { - // Only supported if we can find the llvm tools. - this.supported = LlvmEnvironmentVariableSupplier.getBinPath() != null; - } - - /* (non-Javadoc) - * @see org.eclipse.cdt.managedbuilder.core.IManagedIsToolChainSupported#isSupported(org.eclipse.cdt.managedbuilder.core.IToolChain, - * org.osgi.framework.Version, java.lang.String) - */ - /** - * Return a boolean value that informs if the LLVM Toolchain is supported. - */ - @Override - public boolean isSupported(IToolChain toolChain, - /* - * Version is supported from CDT 7.1.0. - * Use org.osgi.framework.PluginVersionIdentifier with older CDT versions. - */ - Version version, String instance) { - return this.supported; - } - -} +package org.eclipse.cdt.managedbuilder.llvm.ui; + +import org.eclipse.cdt.managedbuilder.core.IManagedIsToolChainSupported; +import org.eclipse.cdt.managedbuilder.core.IToolChain; +import org.osgi.framework.Version; + +/** + * Based on MingwIsToolChainSupported. + * + */ +public class LlvmIsToolChainSupported implements IManagedIsToolChainSupported { + + private final boolean supported; + + /** + * Constructor. + * LLVM Toolchain is supported if binary path for LLVM Tools can be found. + */ + public LlvmIsToolChainSupported() { + // Only supported if we can find the llvm tools. + this.supported = LlvmEnvironmentVariableSupplier.getBinPath() != null; + } + + /* (non-Javadoc) + * @see org.eclipse.cdt.managedbuilder.core.IManagedIsToolChainSupported#isSupported(org.eclipse.cdt.managedbuilder.core.IToolChain, + * org.osgi.framework.Version, java.lang.String) + */ + /** + * Return a boolean value that informs if the LLVM Toolchain is supported. + */ + @Override + public boolean isSupported(IToolChain toolChain, + /* + * Version is supported from CDT 7.1.0. + * Use org.osgi.framework.PluginVersionIdentifier with older CDT versions. + */ + Version version, String instance) { + return this.supported; + } + +} diff --git a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/src/org/eclipse/cdt/managedbuilder/llvm/ui/LlvmUIPlugin.java b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/src/org/eclipse/cdt/managedbuilder/llvm/ui/LlvmUIPlugin.java index f5f7f37fdb8..69c2a7ee0d8 100755 --- a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/src/org/eclipse/cdt/managedbuilder/llvm/ui/LlvmUIPlugin.java +++ b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/src/org/eclipse/cdt/managedbuilder/llvm/ui/LlvmUIPlugin.java @@ -1,177 +1,177 @@ -/******************************************************************************* - * Copyright (c) 2010-2013 Nokia Siemens Networks Oyj, Finland. - * 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: - * Nokia Siemens Networks - initial implementation - * Leo Hippelainen - Initial implementation - * Petri Tuononen - Initial implementation - *******************************************************************************/ -package org.eclipse.cdt.managedbuilder.llvm.ui; - -import java.io.IOException; -import java.util.MissingResourceException; -import java.util.PropertyResourceBundle; -import java.util.ResourceBundle; - -import org.eclipse.cdt.managedbuilder.llvm.util.LlvmResourceListener; -import org.eclipse.core.resources.IResourceChangeEvent; -import org.eclipse.core.resources.IResourceChangeListener; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.FileLocator; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Path; -import org.eclipse.core.runtime.Status; -import org.eclipse.ui.plugin.AbstractUIPlugin; -import org.osgi.framework.BundleContext; - -/** - * The activator class controls the plug-in life cycle. - * The main plugin class to be used in the desktop. - * - * @noextend This class is not intended to be subclassed by clients. - * @noimplement This class is not intended to be instantiated by clients. - */ -public class LlvmUIPlugin extends AbstractUIPlugin { - - //The plug-in ID - public static final String PLUGIN_ID = "org.eclipse.cdt.managedbuilder.llvm.ui"; //$NON-NLS-1$ - - //The shared instance - private static LlvmUIPlugin plugin; - - //Resource bundle - private ResourceBundle resourceBundle; - - //Name for the properties file - private final static String PROPERTIES = "plugin.properties"; //$NON-NLS-1$ - - //Property Resource bundle - private PropertyResourceBundle properties; - - //Resource listeners - private IResourceChangeListener listener = new LlvmResourceListener(); - private IResourceChangeListener listener2 = new LlvmResourceListener(); - - /** - * Constructor. - */ - public LlvmUIPlugin() { - super(); - plugin = this; - } - - /* - * (non-Javadoc) - * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext) - */ - @Override - public void start(BundleContext context) throws Exception { - super.start(context); - plugin = this; -// LlvmEnvironmentVariableSupplier.initializePaths(); - //add resource change listeners to the workspace - ResourcesPlugin.getWorkspace().addResourceChangeListener( - this.listener, IResourceChangeEvent.PRE_BUILD); - ResourcesPlugin.getWorkspace().addResourceChangeListener( - this.listener2, IResourceChangeEvent.POST_BUILD); - } - - /* - * (non-Javadoc) - * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext) - */ - @Override - public void stop(BundleContext context) throws Exception { - super.stop(context); - plugin = null; - this.resourceBundle = null; - } - - /** - * Returns the shared instance - * - * @return the shared instance - */ - public static LlvmUIPlugin getDefault() { - return plugin; - } - - /** - * Returns the string from the plugin's resource bundle, - * or 'key' if not found. - */ - public static String getResourceString(String key) { - ResourceBundle bundle = LlvmUIPlugin.getDefault().getResourceBundle(); - try { - return (bundle != null) ? bundle.getString(key) : key; - } catch (MissingResourceException e) { - return key; - } - } - - /** - * Returns the plugin's resource bundle, - */ - public ResourceBundle getResourceBundle() { - try { - if (this.resourceBundle == null) - this.resourceBundle = ResourceBundle.getBundle(this.getClass().getName()+ "Resources"); //$NON-NLS-1$ - } catch (MissingResourceException x) { - this.resourceBundle = null; - } - return this.resourceBundle; - } - - /** - * Log error. - * - * @param e - */ - public void log(Throwable e) { - log(new Status(IStatus.ERROR, PLUGIN_ID, IStatus.ERROR, "Error", e)); //$NON-NLS-1$ - } - - /** - * Log status. - * - * @param status - */ - public void log(IStatus status) { - getLog().log(status); - } - - /** - * Get plugin.properties - * - * @return PropertyResourceBundle - */ - public PropertyResourceBundle getProperties(){ - if (this.properties == null){ - try { - this.properties = new PropertyResourceBundle( - FileLocator.openStream(this.getBundle(), - new Path(PROPERTIES),false)); - } catch (IOException e) { - //log error - e.getMessage(); - } - } - return this.properties; - } - - /** - * Get String from the plugin.properties file - * - * @param var Variable name wanted as a String e.g. "ToolName.assembler.llvm" - * @return String e.g. LLVM assembler - */ - public static String getPropertyString(String var) { - PropertyResourceBundle properties = LlvmUIPlugin.getDefault().getProperties(); - return properties.getString(var); - } - -} +/******************************************************************************* + * Copyright (c) 2010-2013 Nokia Siemens Networks Oyj, Finland. + * 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: + * Nokia Siemens Networks - initial implementation + * Leo Hippelainen - Initial implementation + * Petri Tuononen - Initial implementation + *******************************************************************************/ +package org.eclipse.cdt.managedbuilder.llvm.ui; + +import java.io.IOException; +import java.util.MissingResourceException; +import java.util.PropertyResourceBundle; +import java.util.ResourceBundle; + +import org.eclipse.cdt.managedbuilder.llvm.util.LlvmResourceListener; +import org.eclipse.core.resources.IResourceChangeEvent; +import org.eclipse.core.resources.IResourceChangeListener; +import org.eclipse.core.resources.ResourcesPlugin; +import org.eclipse.core.runtime.FileLocator; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Path; +import org.eclipse.core.runtime.Status; +import org.eclipse.ui.plugin.AbstractUIPlugin; +import org.osgi.framework.BundleContext; + +/** + * The activator class controls the plug-in life cycle. + * The main plugin class to be used in the desktop. + * + * @noextend This class is not intended to be subclassed by clients. + * @noimplement This class is not intended to be instantiated by clients. + */ +public class LlvmUIPlugin extends AbstractUIPlugin { + + //The plug-in ID + public static final String PLUGIN_ID = "org.eclipse.cdt.managedbuilder.llvm.ui"; //$NON-NLS-1$ + + //The shared instance + private static LlvmUIPlugin plugin; + + //Resource bundle + private ResourceBundle resourceBundle; + + //Name for the properties file + private final static String PROPERTIES = "plugin.properties"; //$NON-NLS-1$ + + //Property Resource bundle + private PropertyResourceBundle properties; + + //Resource listeners + private IResourceChangeListener listener = new LlvmResourceListener(); + private IResourceChangeListener listener2 = new LlvmResourceListener(); + + /** + * Constructor. + */ + public LlvmUIPlugin() { + super(); + plugin = this; + } + + /* + * (non-Javadoc) + * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext) + */ + @Override + public void start(BundleContext context) throws Exception { + super.start(context); + plugin = this; +// LlvmEnvironmentVariableSupplier.initializePaths(); + //add resource change listeners to the workspace + ResourcesPlugin.getWorkspace().addResourceChangeListener( + this.listener, IResourceChangeEvent.PRE_BUILD); + ResourcesPlugin.getWorkspace().addResourceChangeListener( + this.listener2, IResourceChangeEvent.POST_BUILD); + } + + /* + * (non-Javadoc) + * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext) + */ + @Override + public void stop(BundleContext context) throws Exception { + super.stop(context); + plugin = null; + this.resourceBundle = null; + } + + /** + * Returns the shared instance + * + * @return the shared instance + */ + public static LlvmUIPlugin getDefault() { + return plugin; + } + + /** + * Returns the string from the plugin's resource bundle, + * or 'key' if not found. + */ + public static String getResourceString(String key) { + ResourceBundle bundle = LlvmUIPlugin.getDefault().getResourceBundle(); + try { + return (bundle != null) ? bundle.getString(key) : key; + } catch (MissingResourceException e) { + return key; + } + } + + /** + * Returns the plugin's resource bundle, + */ + public ResourceBundle getResourceBundle() { + try { + if (this.resourceBundle == null) + this.resourceBundle = ResourceBundle.getBundle(this.getClass().getName()+ "Resources"); //$NON-NLS-1$ + } catch (MissingResourceException x) { + this.resourceBundle = null; + } + return this.resourceBundle; + } + + /** + * Log error. + * + * @param e + */ + public void log(Throwable e) { + log(new Status(IStatus.ERROR, PLUGIN_ID, IStatus.ERROR, "Error", e)); //$NON-NLS-1$ + } + + /** + * Log status. + * + * @param status + */ + public void log(IStatus status) { + getLog().log(status); + } + + /** + * Get plugin.properties + * + * @return PropertyResourceBundle + */ + public PropertyResourceBundle getProperties(){ + if (this.properties == null){ + try { + this.properties = new PropertyResourceBundle( + FileLocator.openStream(this.getBundle(), + new Path(PROPERTIES),false)); + } catch (IOException e) { + //log error + e.getMessage(); + } + } + return this.properties; + } + + /** + * Get String from the plugin.properties file + * + * @param var Variable name wanted as a String e.g. "ToolName.assembler.llvm" + * @return String e.g. LLVM assembler + */ + public static String getPropertyString(String var) { + PropertyResourceBundle properties = LlvmUIPlugin.getDefault().getProperties(); + return properties.getString(var); + } + +} diff --git a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/src/org/eclipse/cdt/managedbuilder/llvm/ui/preferences/Messages.java b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/src/org/eclipse/cdt/managedbuilder/llvm/ui/preferences/Messages.java index 8a93b18a846..c0579135fb2 100644 --- a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/src/org/eclipse/cdt/managedbuilder/llvm/ui/preferences/Messages.java +++ b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/src/org/eclipse/cdt/managedbuilder/llvm/ui/preferences/Messages.java @@ -1,38 +1,38 @@ -/******************************************************************************* - * Copyright (c) 2010-2013 Nokia Siemens Networks Oyj, Finland. - * 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: - * Nokia Siemens Networks - initial implementation - * Petri Tuononen - Initial implementation - *******************************************************************************/ -package org.eclipse.cdt.managedbuilder.llvm.ui.preferences; - -import org.eclipse.osgi.util.NLS; - -public class Messages extends NLS { - - private static final String BUNDLE_NAME = "org.eclipse.cdt.managedbuilder.llvm.ui.preferences.messages"; //$NON-NLS-1$ - public static String IncludePathListEditor_0; - public static String IncludePathListEditor_1; - public static String LibraryListEditor_0; - public static String LibraryPathListEditor_0; - public static String LibraryPathListEditor_1; - public static String LlvmPreferencePage_0; - public static String LlvmPreferencePage_1; - public static String LlvmPreferencePage_2; - public static String LlvmPreferencePage_3; - public static String LlvmPreferencePage_4; - - static { - // initialize resource bundle - NLS.initializeMessages(BUNDLE_NAME, Messages.class); - } - - private Messages() { - } - -} +/******************************************************************************* + * Copyright (c) 2010-2013 Nokia Siemens Networks Oyj, Finland. + * 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: + * Nokia Siemens Networks - initial implementation + * Petri Tuononen - Initial implementation + *******************************************************************************/ +package org.eclipse.cdt.managedbuilder.llvm.ui.preferences; + +import org.eclipse.osgi.util.NLS; + +public class Messages extends NLS { + + private static final String BUNDLE_NAME = "org.eclipse.cdt.managedbuilder.llvm.ui.preferences.messages"; //$NON-NLS-1$ + public static String IncludePathListEditor_0; + public static String IncludePathListEditor_1; + public static String LibraryListEditor_0; + public static String LibraryPathListEditor_0; + public static String LibraryPathListEditor_1; + public static String LlvmPreferencePage_0; + public static String LlvmPreferencePage_1; + public static String LlvmPreferencePage_2; + public static String LlvmPreferencePage_3; + public static String LlvmPreferencePage_4; + + static { + // initialize resource bundle + NLS.initializeMessages(BUNDLE_NAME, Messages.class); + } + + private Messages() { + } + +} diff --git a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/src/org/eclipse/cdt/managedbuilder/llvm/ui/preferences/messages.properties b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/src/org/eclipse/cdt/managedbuilder/llvm/ui/preferences/messages.properties index a60f392c598..a58ce4812da 100644 --- a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/src/org/eclipse/cdt/managedbuilder/llvm/ui/preferences/messages.properties +++ b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/src/org/eclipse/cdt/managedbuilder/llvm/ui/preferences/messages.properties @@ -1,10 +1,10 @@ -IncludePathListEditor_0=Browse a directory path -IncludePathListEditor_1=Select a directory -LibraryListEditor_0=Browse a directory path -LibraryPathListEditor_0=Browse a directory path -LibraryPathListEditor_1=Select a directory -LlvmPreferencePage_0=Preferences for LLVM tool chain. -LlvmPreferencePage_1=LLVM &Installation folder: -LlvmPreferencePage_2=Include directories -LlvmPreferencePage_3=Libraries -LlvmPreferencePage_4=Library search path directories +IncludePathListEditor_0=Browse a directory path +IncludePathListEditor_1=Select a directory +LibraryListEditor_0=Browse a directory path +LibraryPathListEditor_0=Browse a directory path +LibraryPathListEditor_1=Select a directory +LlvmPreferencePage_0=Preferences for LLVM tool chain. +LlvmPreferencePage_1=LLVM &Installation folder: +LlvmPreferencePage_2=Include directories +LlvmPreferencePage_3=Libraries +LlvmPreferencePage_4=Library search path directories diff --git a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/src/org/eclipse/cdt/managedbuilder/llvm/util/FileUtil.java b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/src/org/eclipse/cdt/managedbuilder/llvm/util/FileUtil.java index 00fb27ec18b..6a2ae066029 100644 --- a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/src/org/eclipse/cdt/managedbuilder/llvm/util/FileUtil.java +++ b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/src/org/eclipse/cdt/managedbuilder/llvm/util/FileUtil.java @@ -1,44 +1,44 @@ -/******************************************************************************* - * Copyright (c) 2011-2013 Nokia Siemens Networks Oyj, Finland. - * 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: - * Nokia Siemens Networks - initial implementation - * Petri Tuononen - Initial implementation - *******************************************************************************/ -package org.eclipse.cdt.managedbuilder.llvm.util; - -import java.io.File; - -public class FileUtil { - - /** - * Searches cpp and cc file types recursively and returns true if - * the directory tree contains at least one instance of them. - * - * @param directory - * @param filter - * @return - */ - public static boolean containsCppFile(File directory) { - File[] entries = directory.listFiles(); - String path = null; - for (File entry : entries) { - path = entry.getAbsolutePath(); - if (path!=null) { - if (path.contains(".cpp") || path.contains(".cc")) { //$NON-NLS-1$ //$NON-NLS-2$ - return true; - } - } - - if (entry.isDirectory()) { - containsCppFile(entry); - } - } - return false; - } - -} +/******************************************************************************* + * Copyright (c) 2011-2013 Nokia Siemens Networks Oyj, Finland. + * 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: + * Nokia Siemens Networks - initial implementation + * Petri Tuononen - Initial implementation + *******************************************************************************/ +package org.eclipse.cdt.managedbuilder.llvm.util; + +import java.io.File; + +public class FileUtil { + + /** + * Searches cpp and cc file types recursively and returns true if + * the directory tree contains at least one instance of them. + * + * @param directory + * @param filter + * @return + */ + public static boolean containsCppFile(File directory) { + File[] entries = directory.listFiles(); + String path = null; + for (File entry : entries) { + path = entry.getAbsolutePath(); + if (path!=null) { + if (path.contains(".cpp") || path.contains(".cc")) { //$NON-NLS-1$ //$NON-NLS-2$ + return true; + } + } + + if (entry.isDirectory()) { + containsCppFile(entry); + } + } + return false; + } + +} diff --git a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/src/org/eclipse/cdt/managedbuilder/llvm/util/ProjectIndex.java b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/src/org/eclipse/cdt/managedbuilder/llvm/util/ProjectIndex.java index 7deaa9899db..ba698d53171 100644 --- a/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/src/org/eclipse/cdt/managedbuilder/llvm/util/ProjectIndex.java +++ b/llvm/org.eclipse.cdt.managedbuilder.llvm.ui/src/org/eclipse/cdt/managedbuilder/llvm/util/ProjectIndex.java @@ -1,29 +1,29 @@ -/******************************************************************************* - * Copyright (c) 2011-2013 Nokia Siemens Networks Oyj, Finland. - * 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: - * Nokia Siemens Networks - initial implementation - * Petri Tuononen - Initial implementation - *******************************************************************************/ -package org.eclipse.cdt.managedbuilder.llvm.util; - -import org.eclipse.cdt.core.CCorePlugin; -import org.eclipse.cdt.core.model.CoreModel; -import org.eclipse.cdt.core.model.ICProject; -import org.eclipse.core.resources.IProject; - -public class ProjectIndex { - - /** - * Rebuilts the index of the selected project in the workspace. - */ - public static void rebuiltIndex(IProject proj) { - ICProject cproject = CoreModel.getDefault().getCModel().getCProject(proj.getName()); - CCorePlugin.getIndexManager().reindex(cproject); - } - -} +/******************************************************************************* + * Copyright (c) 2011-2013 Nokia Siemens Networks Oyj, Finland. + * 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: + * Nokia Siemens Networks - initial implementation + * Petri Tuononen - Initial implementation + *******************************************************************************/ +package org.eclipse.cdt.managedbuilder.llvm.util; + +import org.eclipse.cdt.core.CCorePlugin; +import org.eclipse.cdt.core.model.CoreModel; +import org.eclipse.cdt.core.model.ICProject; +import org.eclipse.core.resources.IProject; + +public class ProjectIndex { + + /** + * Rebuilts the index of the selected project in the workspace. + */ + public static void rebuiltIndex(IProject proj) { + ICProject cproject = CoreModel.getDefault().getCModel().getCProject(proj.getName()); + CCorePlugin.getIndexManager().reindex(cproject); + } + +} diff --git a/qt/org.eclipse.cdt.qt.core.tests/scripts/ecma5-defs.js b/qt/org.eclipse.cdt.qt.core.tests/scripts/ecma5-defs.js index 9255014c280..4535e2d73e6 100644 --- a/qt/org.eclipse.cdt.qt.core.tests/scripts/ecma5-defs.js +++ b/qt/org.eclipse.cdt.qt.core.tests/scripts/ecma5-defs.js @@ -1,968 +1,968 @@ -ecma5defs = { - "!name": "ecma5", - "!define": { - "Error.prototype": "Error.prototype" - }, - "Infinity": { - "!type": "number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Infinity", - "!doc": "A numeric value representing infinity." - }, - "undefined": { - "!type": "?", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/undefined", - "!doc": "The value undefined." - }, - "NaN": { - "!type": "number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/NaN", - "!doc": "A value representing Not-A-Number." - }, - "Object": { - "!type": "fn()", - "getPrototypeOf": { - "!type": "fn(obj: ?) -> ?", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object/getPrototypeOf", - "!doc": "Returns the prototype (i.e. the internal prototype) of the specified object." - }, - "create": { - "!type": "fn(proto: ?) -> !custom:Object_create", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object/create", - "!doc": "Creates a new object with the specified prototype object and properties." - }, - "defineProperty": { - "!type": "fn(obj: ?, prop: string, desc: ?) -> !custom:Object_defineProperty", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object/defineProperty", - "!doc": "Defines a new property directly on an object, or modifies an existing property on an object, and returns the object. If you want to see how to use the Object.defineProperty method with a binary-flags-like syntax, see this article." - }, - "defineProperties": { - "!type": "fn(obj: ?, props: ?) -> !custom:Object_defineProperties", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object/defineProperty", - "!doc": "Defines a new property directly on an object, or modifies an existing property on an object, and returns the object. If you want to see how to use the Object.defineProperty method with a binary-flags-like syntax, see this article." - }, - "getOwnPropertyDescriptor": { - "!type": "fn(obj: ?, prop: string) -> ?", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object/getOwnPropertyDescriptor", - "!doc": "Returns a property descriptor for an own property (that is, one directly present on an object, not present by dint of being along an object's prototype chain) of a given object." - }, - "keys": { - "!type": "fn(obj: ?) -> [string]", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object/keys", - "!doc": "Returns an array of a given object's own enumerable properties, in the same order as that provided by a for-in loop (the difference being that a for-in loop enumerates properties in the prototype chain as well)." - }, - "getOwnPropertyNames": { - "!type": "fn(obj: ?) -> [string]", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object/getOwnPropertyNames", - "!doc": "Returns an array of all properties (enumerable or not) found directly upon a given object." - }, - "seal": { - "!type": "fn(obj: ?)", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object/seal", - "!doc": "Seals an object, preventing new properties from being added to it and marking all existing properties as non-configurable. Values of present properties can still be changed as long as they are writable." - }, - "isSealed": { - "!type": "fn(obj: ?) -> bool", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object/isSealed", - "!doc": "Determine if an object is sealed." - }, - "freeze": { - "!type": "fn(obj: ?) -> !0", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object/freeze", - "!doc": "Freezes an object: that is, prevents new properties from being added to it; prevents existing properties from being removed; and prevents existing properties, or their enumerability, configurability, or writability, from being changed. In essence the object is made effectively immutable. The method returns the object being frozen." - }, - "isFrozen": { - "!type": "fn(obj: ?) -> bool", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object/isFrozen", - "!doc": "Determine if an object is frozen." - }, - "preventExtensions": { - "!type": "fn(obj: ?)", - "!url": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/preventExtensions", - "!doc": "Prevents new properties from ever being added to an object." - }, - "isExtensible": { - "!type": "fn(obj: ?) -> bool", - "!url": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/isExtensible", - "!doc": "The Object.isExtensible() method determines if an object is extensible (whether it can have new properties added to it)." - }, - "prototype": { - "!stdProto": "Object", - "toString": { - "!type": "fn() -> string", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object/toString", - "!doc": "Returns a string representing the object." - }, - "toLocaleString": { - "!type": "fn() -> string", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object/toLocaleString", - "!doc": "Returns a string representing the object. This method is meant to be overriden by derived objects for locale-specific purposes." - }, - "valueOf": { - "!type": "fn() -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object/valueOf", - "!doc": "Returns the primitive value of the specified object" - }, - "hasOwnProperty": { - "!type": "fn(prop: string) -> bool", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object/hasOwnProperty", - "!doc": "Returns a boolean indicating whether the object has the specified property." - }, - "propertyIsEnumerable": { - "!type": "fn(prop: string) -> bool", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object/propertyIsEnumerable", - "!doc": "Returns a Boolean indicating whether the specified property is enumerable." - }, - "isPrototypeOf": { - "!type": "fn(obj: ?) -> bool", - "!url": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/isPrototypeOf", - "!doc": "Tests for an object in another object's prototype chain." - } - }, - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object", - "!doc": "Creates an object wrapper." - }, - "Function": { - "!type": "fn(body: string) -> fn()", - "prototype": { - "!stdProto": "Function", - "apply": { - "!type": "fn(this: ?, args: [?])", - "!effects": [ - "call and return !this this=!0 !1. !1. !1." - ], - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Function/apply", - "!doc": "Calls a function with a given this value and arguments provided as an array (or an array like object)." - }, - "call": { - "!type": "fn(this: ?, args?: ?) -> !this.!ret", - "!effects": [ - "call and return !this this=!0 !1 !2 !3 !4" - ], - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Function/call", - "!doc": "Calls a function with a given this value and arguments provided individually." - }, - "bind": { - "!type": "fn(this: ?, args?: ?) -> !custom:Function_bind", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Function/bind", - "!doc": "Creates a new function that, when called, has its this keyword set to the provided value, with a given sequence of arguments preceding any provided when the new function was called." - }, - "prototype": "?" - }, - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Function", - "!doc": "Every function in JavaScript is actually a Function object." - }, - "Array": { - "!type": "fn(size: number) -> !custom:Array_ctor", - "isArray": { - "!type": "fn(value: ?) -> bool", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/isArray", - "!doc": "Returns true if an object is an array, false if it is not." - }, - "prototype": { - "!stdProto": "Array", - "length": { - "!type": "number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/length", - "!doc": "An unsigned, 32-bit integer that specifies the number of elements in an array." - }, - "concat": { - "!type": "fn(other: [?]) -> !this", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/concat", - "!doc": "Returns a new array comprised of this array joined with other array(s) and/or value(s)." - }, - "join": { - "!type": "fn(separator?: string) -> string", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/join", - "!doc": "Joins all elements of an array into a string." - }, - "splice": { - "!type": "fn(pos: number, amount: number)", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/splice", - "!doc": "Changes the content of an array, adding new elements while removing old elements." - }, - "pop": { - "!type": "fn() -> !this.", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/pop", - "!doc": "Removes the last element from an array and returns that element." - }, - "push": { - "!type": "fn(newelt: ?) -> number", - "!effects": [ - "propagate !0 !this." - ], - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/push", - "!doc": "Mutates an array by appending the given elements and returning the new length of the array." - }, - "shift": { - "!type": "fn() -> !this.", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/shift", - "!doc": "Removes the first element from an array and returns that element. This method changes the length of the array." - }, - "unshift": { - "!type": "fn(newelt: ?) -> number", - "!effects": [ - "propagate !0 !this." - ], - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/unshift", - "!doc": "Adds one or more elements to the beginning of an array and returns the new length of the array." - }, - "slice": { - "!type": "fn(from: number, to?: number) -> !this", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/slice", - "!doc": "Returns a shallow copy of a portion of an array." - }, - "reverse": { - "!type": "fn()", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/reverse", - "!doc": "Reverses an array in place. The first array element becomes the last and the last becomes the first." - }, - "sort": { - "!type": "fn(compare?: fn(a: ?, b: ?) -> number)", - "!effects": [ - "call !0 !this. !this." - ], - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/sort", - "!doc": "Sorts the elements of an array in place and returns the array." - }, - "indexOf": { - "!type": "fn(elt: ?, from?: number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/indexOf", - "!doc": "Returns the first index at which a given element can be found in the array, or -1 if it is not present." - }, - "lastIndexOf": { - "!type": "fn(elt: ?, from?: number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/lastIndexOf", - "!doc": "Returns the last index at which a given element can be found in the array, or -1 if it is not present. The array is searched backwards, starting at fromIndex." - }, - "every": { - "!type": "fn(test: fn(elt: ?, i: number) -> bool, context?: ?) -> bool", - "!effects": [ - "call !0 this=!1 !this. number" - ], - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/every", - "!doc": "Tests whether all elements in the array pass the test implemented by the provided function." - }, - "some": { - "!type": "fn(test: fn(elt: ?, i: number) -> bool, context?: ?) -> bool", - "!effects": [ - "call !0 this=!1 !this. number" - ], - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/some", - "!doc": "Tests whether some element in the array passes the test implemented by the provided function." - }, - "filter": { - "!type": "fn(test: fn(elt: ?, i: number) -> bool, context?: ?) -> !this", - "!effects": [ - "call !0 this=!1 !this. number" - ], - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/filter", - "!doc": "Creates a new array with all elements that pass the test implemented by the provided function." - }, - "forEach": { - "!type": "fn(f: fn(elt: ?, i: number), context?: ?)", - "!effects": [ - "call !0 this=!1 !this. number" - ], - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/forEach", - "!doc": "Executes a provided function once per array element." - }, - "map": { - "!type": "fn(f: fn(elt: ?, i: number) -> ?, context?: ?) -> [!0.!ret]", - "!effects": [ - "call !0 this=!1 !this. number" - ], - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/map", - "!doc": "Creates a new array with the results of calling a provided function on every element in this array." - }, - "reduce": { - "!type": "fn(combine: fn(sum: ?, elt: ?, i: number) -> ?, init?: ?) -> !0.!ret", - "!effects": [ - "call !0 !1 !this. number" - ], - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/Reduce", - "!doc": "Apply a function against an accumulator and each value of the array (from left-to-right) as to reduce it to a single value." - }, - "reduceRight": { - "!type": "fn(combine: fn(sum: ?, elt: ?, i: number) -> ?, init?: ?) -> !0.!ret", - "!effects": [ - "call !0 !1 !this. number" - ], - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/ReduceRight", - "!doc": "Apply a function simultaneously against two values of the array (from right-to-left) as to reduce it to a single value." - } - }, - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array", - "!doc": "The JavaScript Array global object is a constructor for arrays, which are high-level, list-like objects." - }, - "String": { - "!type": "fn(value: ?) -> string", - "fromCharCode": { - "!type": "fn(code: number) -> string", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/fromCharCode", - "!doc": "Returns a string created by using the specified sequence of Unicode values." - }, - "prototype": { - "!stdProto": "String", - "length": { - "!type": "number", - "!url": "https://developer.mozilla.org/en/docs/JavaScript/Reference/Global_Objects/String/length", - "!doc": "Represents the length of a string." - }, - "": "string", - "charAt": { - "!type": "fn(i: number) -> string", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/charAt", - "!doc": "Returns the specified character from a string." - }, - "charCodeAt": { - "!type": "fn(i: number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/charCodeAt", - "!doc": "Returns the numeric Unicode value of the character at the given index (except for unicode codepoints > 0x10000)." - }, - "indexOf": { - "!type": "fn(char: string, from?: number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/indexOf", - "!doc": "Returns the index within the calling String object of the first occurrence of the specified value, starting the search at fromIndex,\nreturns -1 if the value is not found." - }, - "lastIndexOf": { - "!type": "fn(char: string, from?: number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/lastIndexOf", - "!doc": "Returns the index within the calling String object of the last occurrence of the specified value, or -1 if not found. The calling string is searched backward, starting at fromIndex." - }, - "substring": { - "!type": "fn(from: number, to?: number) -> string", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/substring", - "!doc": "Returns a subset of a string between one index and another, or through the end of the string." - }, - "substr": { - "!type": "fn(from: number, length?: number) -> string", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/substr", - "!doc": "Returns the characters in a string beginning at the specified location through the specified number of characters." - }, - "slice": { - "!type": "fn(from: number, to?: number) -> string", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/slice", - "!doc": "Extracts a section of a string and returns a new string." - }, - "trim": { - "!type": "fn() -> string", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/Trim", - "!doc": "Removes whitespace from both ends of the string." - }, - "toUpperCase": { - "!type": "fn() -> string", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/toUpperCase", - "!doc": "Returns the calling string value converted to uppercase." - }, - "toLowerCase": { - "!type": "fn() -> string", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/toLowerCase", - "!doc": "Returns the calling string value converted to lowercase." - }, - "toLocaleUpperCase": { - "!type": "fn() -> string", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/toLocaleUpperCase", - "!doc": "Returns the calling string value converted to upper case, according to any locale-specific case mappings." - }, - "toLocaleLowerCase": { - "!type": "fn() -> string", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/toLocaleLowerCase", - "!doc": "Returns the calling string value converted to lower case, according to any locale-specific case mappings." - }, - "split": { - "!type": "fn(pattern: string) -> [string]", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/split", - "!doc": "Splits a String object into an array of strings by separating the string into substrings." - }, - "concat": { - "!type": "fn(other: string) -> string", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/concat", - "!doc": "Combines the text of two or more strings and returns a new string." - }, - "localeCompare": { - "!type": "fn(other: string) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/localeCompare", - "!doc": "Returns a number indicating whether a reference string comes before or after or is the same as the given string in sort order." - }, - "match": { - "!type": "fn(pattern: +RegExp) -> [string]", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/match", - "!doc": "Used to retrieve the matches when matching a string against a regular expression." - }, - "replace": { - "!type": "fn(pattern: string|+RegExp, replacement: string) -> string", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/replace", - "!doc": "Returns a new string with some or all matches of a pattern replaced by a replacement. The pattern can be a string or a RegExp, and the replacement can be a string or a function to be called for each match." - }, - "search": { - "!type": "fn(pattern: +RegExp) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/search", - "!doc": "Executes the search for a match between a regular expression and this String object." - } - }, - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String", - "!doc": "The String global object is a constructor for strings, or a sequence of characters." - }, - "Number": { - "!type": "fn(value: ?) -> number", - "MAX_VALUE": { - "!type": "number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number/MAX_VALUE", - "!doc": "The maximum numeric value representable in JavaScript." - }, - "MIN_VALUE": { - "!type": "number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number/MIN_VALUE", - "!doc": "The smallest positive numeric value representable in JavaScript." - }, - "POSITIVE_INFINITY": { - "!type": "number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number/POSITIVE_INFINITY", - "!doc": "A value representing the positive Infinity value." - }, - "NEGATIVE_INFINITY": { - "!type": "number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number/NEGATIVE_INFINITY", - "!doc": "A value representing the negative Infinity value." - }, - "prototype": { - "!stdProto": "Number", - "toString": { - "!type": "fn(radix?: number) -> string", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number/toString", - "!doc": "Returns a string representing the specified Number object" - }, - "toFixed": { - "!type": "fn(digits: number) -> string", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number/toFixed", - "!doc": "Formats a number using fixed-point notation" - }, - "toExponential": { - "!type": "fn(digits: number) -> string", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number/toExponential", - "!doc": "Returns a string representing the Number object in exponential notation" - }, - "toPrecision": { - "!type": "fn(digits: number) -> string", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number/toPrecision", - "!doc": "The toPrecision() method returns a string representing the number to the specified precision." - } - }, - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number", - "!doc": "The Number JavaScript object is a wrapper object allowing you to work with numerical values. A Number object is created using the Number() constructor." - }, - "Boolean": { - "!type": "fn(value: ?) -> bool", - "prototype": { - "!stdProto": "Boolean" - }, - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Boolean", - "!doc": "The Boolean object is an object wrapper for a boolean value." - }, - "RegExp": { - "!type": "fn(source: string, flags?: string)", - "prototype": { - "!stdProto": "RegExp", - "exec": { - "!type": "fn(input: string) -> [string]", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/RegExp/exec", - "!doc": "Executes a search for a match in a specified string. Returns a result array, or null." - }, - "test": { - "!type": "fn(input: string) -> bool", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/RegExp/test", - "!doc": "Executes the search for a match between a regular expression and a specified string. Returns true or false." - }, - "global": { - "!type": "bool", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/RegExp", - "!doc": "Creates a regular expression object for matching text with a pattern." - }, - "ignoreCase": { - "!type": "bool", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/RegExp", - "!doc": "Creates a regular expression object for matching text with a pattern." - }, - "multiline": { - "!type": "bool", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/RegExp/multiline", - "!doc": "Reflects whether or not to search in strings across multiple lines.\n" - }, - "source": { - "!type": "string", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/RegExp/source", - "!doc": "A read-only property that contains the text of the pattern, excluding the forward slashes.\n" - }, - "lastIndex": { - "!type": "number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/RegExp/lastIndex", - "!doc": "A read/write integer property that specifies the index at which to start the next match." - } - }, - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/RegExp", - "!doc": "Creates a regular expression object for matching text with a pattern." - }, - "Date": { - "!type": "fn(ms: number)", - "parse": { - "!type": "fn(source: string) -> +Date", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/parse", - "!doc": "Parses a string representation of a date, and returns the number of milliseconds since January 1, 1970, 00:00:00 UTC." - }, - "UTC": { - "!type": "fn(year: number, month: number, date: number, hour?: number, min?: number, sec?: number, ms?: number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/UTC", - "!doc": "Accepts the same parameters as the longest form of the constructor, and returns the number of milliseconds in a Date object since January 1, 1970, 00:00:00, universal time." - }, - "now": { - "!type": "fn() -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/now", - "!doc": "Returns the number of milliseconds elapsed since 1 January 1970 00:00:00 UTC." - }, - "prototype": { - "toUTCString": { - "!type": "fn() -> string", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/toUTCString", - "!doc": "Converts a date to a string, using the universal time convention." - }, - "toISOString": { - "!type": "fn() -> string", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/toISOString", - "!doc": "JavaScript provides a direct way to convert a date object into a string in ISO format, the ISO 8601 Extended Format." - }, - "toDateString": { - "!type": "fn() -> string", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/toDateString", - "!doc": "Returns the date portion of a Date object in human readable form in American English." - }, - "toTimeString": { - "!type": "fn() -> string", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/toTimeString", - "!doc": "Returns the time portion of a Date object in human readable form in American English." - }, - "toLocaleDateString": { - "!type": "fn() -> string", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/toLocaleDateString", - "!doc": "Converts a date to a string, returning the \"date\" portion using the operating system's locale's conventions.\n" - }, - "toLocaleTimeString": { - "!type": "fn() -> string", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/toLocaleTimeString", - "!doc": "Converts a date to a string, returning the \"time\" portion using the current locale's conventions." - }, - "getTime": { - "!type": "fn() -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/getTime", - "!doc": "Returns the numeric value corresponding to the time for the specified date according to universal time." - }, - "getFullYear": { - "!type": "fn() -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/getFullYear", - "!doc": "Returns the year of the specified date according to local time." - }, - "getYear": { - "!type": "fn() -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/getYear", - "!doc": "Returns the year in the specified date according to local time." - }, - "getMonth": { - "!type": "fn() -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/getMonth", - "!doc": "Returns the month in the specified date according to local time." - }, - "getUTCMonth": { - "!type": "fn() -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/getUTCMonth", - "!doc": "Returns the month of the specified date according to universal time.\n" - }, - "getDate": { - "!type": "fn() -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/getDate", - "!doc": "Returns the day of the month for the specified date according to local time." - }, - "getUTCDate": { - "!type": "fn() -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/getUTCDate", - "!doc": "Returns the day (date) of the month in the specified date according to universal time.\n" - }, - "getDay": { - "!type": "fn() -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/getDay", - "!doc": "Returns the day of the week for the specified date according to local time." - }, - "getUTCDay": { - "!type": "fn() -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/getUTCDay", - "!doc": "Returns the day of the week in the specified date according to universal time.\n" - }, - "getHours": { - "!type": "fn() -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/getHours", - "!doc": "Returns the hour for the specified date according to local time." - }, - "getUTCHours": { - "!type": "fn() -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/getUTCHours", - "!doc": "Returns the hours in the specified date according to universal time.\n" - }, - "getMinutes": { - "!type": "fn() -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/getMinutes", - "!doc": "Returns the minutes in the specified date according to local time." - }, - "getUTCMinutes": { - "!type": "fn() -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date", - "!doc": "Creates JavaScript Date instances which let you work with dates and times." - }, - "getSeconds": { - "!type": "fn() -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/getSeconds", - "!doc": "Returns the seconds in the specified date according to local time." - }, - "getUTCSeconds": { - "!type": "fn() -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/getUTCSeconds", - "!doc": "Returns the seconds in the specified date according to universal time.\n" - }, - "getMilliseconds": { - "!type": "fn() -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/getMilliseconds", - "!doc": "Returns the milliseconds in the specified date according to local time." - }, - "getUTCMilliseconds": { - "!type": "fn() -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/getUTCMilliseconds", - "!doc": "Returns the milliseconds in the specified date according to universal time.\n" - }, - "getTimezoneOffset": { - "!type": "fn() -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/getTimezoneOffset", - "!doc": "Returns the time-zone offset from UTC, in minutes, for the current locale." - }, - "setTime": { - "!type": "fn(date: +Date) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/setTime", - "!doc": "Sets the Date object to the time represented by a number of milliseconds since January 1, 1970, 00:00:00 UTC.\n" - }, - "setFullYear": { - "!type": "fn(year: number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/setFullYear", - "!doc": "Sets the full year for a specified date according to local time.\n" - }, - "setUTCFullYear": { - "!type": "fn(year: number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/setUTCFullYear", - "!doc": "Sets the full year for a specified date according to universal time.\n" - }, - "setMonth": { - "!type": "fn(month: number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/setMonth", - "!doc": "Set the month for a specified date according to local time." - }, - "setUTCMonth": { - "!type": "fn(month: number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/setUTCMonth", - "!doc": "Sets the month for a specified date according to universal time.\n" - }, - "setDate": { - "!type": "fn(day: number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/setDate", - "!doc": "Sets the day of the month for a specified date according to local time." - }, - "setUTCDate": { - "!type": "fn(day: number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/setUTCDate", - "!doc": "Sets the day of the month for a specified date according to universal time.\n" - }, - "setHours": { - "!type": "fn(hour: number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/setHours", - "!doc": "Sets the hours for a specified date according to local time, and returns the number of milliseconds since 1 January 1970 00:00:00 UTC until the time represented by the updated Date instance." - }, - "setUTCHours": { - "!type": "fn(hour: number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/setUTCHours", - "!doc": "Sets the hour for a specified date according to universal time.\n" - }, - "setMinutes": { - "!type": "fn(min: number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/setMinutes", - "!doc": "Sets the minutes for a specified date according to local time." - }, - "setUTCMinutes": { - "!type": "fn(min: number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/setUTCMinutes", - "!doc": "Sets the minutes for a specified date according to universal time.\n" - }, - "setSeconds": { - "!type": "fn(sec: number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/setSeconds", - "!doc": "Sets the seconds for a specified date according to local time." - }, - "setUTCSeconds": { - "!type": "fn(sec: number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/setUTCSeconds", - "!doc": "Sets the seconds for a specified date according to universal time.\n" - }, - "setMilliseconds": { - "!type": "fn(ms: number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/setMilliseconds", - "!doc": "Sets the milliseconds for a specified date according to local time.\n" - }, - "setUTCMilliseconds": { - "!type": "fn(ms: number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/setUTCMilliseconds", - "!doc": "Sets the milliseconds for a specified date according to universal time.\n" - } - }, - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date", - "!doc": "Creates JavaScript Date instances which let you work with dates and times." - }, - "Error": { - "!type": "fn(message: string)", - "prototype": { - "name": { - "!type": "string", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Error/name", - "!doc": "A name for the type of error." - }, - "message": { - "!type": "string", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Error/message", - "!doc": "A human-readable description of the error." - } - }, - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Error", - "!doc": "Creates an error object." - }, - "SyntaxError": { - "!type": "fn(message: string)", - "prototype": "Error.prototype", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/SyntaxError", - "!doc": "Represents an error when trying to interpret syntactically invalid code." - }, - "ReferenceError": { - "!type": "fn(message: string)", - "prototype": "Error.prototype", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/ReferenceError", - "!doc": "Represents an error when a non-existent variable is referenced." - }, - "URIError": { - "!type": "fn(message: string)", - "prototype": "Error.prototype", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/URIError", - "!doc": "Represents an error when a malformed URI is encountered." - }, - "EvalError": { - "!type": "fn(message: string)", - "prototype": "Error.prototype", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/EvalError", - "!doc": "Represents an error regarding the eval function." - }, - "RangeError": { - "!type": "fn(message: string)", - "prototype": "Error.prototype", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/RangeError", - "!doc": "Represents an error when a number is not within the correct range allowed." - }, - "TypeError": { - "!type": "fn(message: string)", - "prototype": "Error.prototype", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/TypeError", - "!doc": "Represents an error an error when a value is not of the expected type." - }, - "parseInt": { - "!type": "fn(string: string, radix?: number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/parseInt", - "!doc": "Parses a string argument and returns an integer of the specified radix or base." - }, - "parseFloat": { - "!type": "fn(string: string) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/parseFloat", - "!doc": "Parses a string argument and returns a floating point number." - }, - "isNaN": { - "!type": "fn(value: number) -> bool", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/isNaN", - "!doc": "Determines whether a value is NaN or not. Be careful, this function is broken. You may be interested in ECMAScript 6 Number.isNaN." - }, - "isFinite": { - "!type": "fn(value: number) -> bool", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/isFinite", - "!doc": "Determines whether the passed value is a finite number." - }, - "eval": { - "!type": "fn(code: string) -> ?", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/eval", - "!doc": "Evaluates JavaScript code represented as a string." - }, - "encodeURI": { - "!type": "fn(uri: string) -> string", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/encodeURI", - "!doc": "Encodes a Uniform Resource Identifier (URI) by replacing each instance of certain characters by one, two, three, or four escape sequences representing the UTF-8 encoding of the character (will only be four escape sequences for characters composed of two \"surrogate\" characters)." - }, - "encodeURIComponent": { - "!type": "fn(uri: string) -> string", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/encodeURIComponent", - "!doc": "Encodes a Uniform Resource Identifier (URI) component by replacing each instance of certain characters by one, two, three, or four escape sequences representing the UTF-8 encoding of the character (will only be four escape sequences for characters composed of two \"surrogate\" characters)." - }, - "decodeURI": { - "!type": "fn(uri: string) -> string", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/decodeURI", - "!doc": "Decodes a Uniform Resource Identifier (URI) previously created by encodeURI or by a similar routine." - }, - "decodeURIComponent": { - "!type": "fn(uri: string) -> string", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/decodeURIComponent", - "!doc": "Decodes a Uniform Resource Identifier (URI) component previously created by encodeURIComponent or by a similar routine." - }, - "Math": { - "E": { - "!type": "number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/E", - "!doc": "The base of natural logarithms, e, approximately 2.718." - }, - "LN2": { - "!type": "number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/LN2", - "!doc": "The natural logarithm of 2, approximately 0.693." - }, - "LN10": { - "!type": "number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/LN10", - "!doc": "The natural logarithm of 10, approximately 2.302." - }, - "LOG2E": { - "!type": "number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/LOG2E", - "!doc": "The base 2 logarithm of E (approximately 1.442)." - }, - "LOG10E": { - "!type": "number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/LOG10E", - "!doc": "The base 10 logarithm of E (approximately 0.434)." - }, - "SQRT1_2": { - "!type": "number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/SQRT1_2", - "!doc": "The square root of 1/2; equivalently, 1 over the square root of 2, approximately 0.707." - }, - "SQRT2": { - "!type": "number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/SQRT2", - "!doc": "The square root of 2, approximately 1.414." - }, - "PI": { - "!type": "number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/PI", - "!doc": "The ratio of the circumference of a circle to its diameter, approximately 3.14159." - }, - "abs": { - "!type": "fn(number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/abs", - "!doc": "Returns the absolute value of a number." - }, - "cos": { - "!type": "fn(number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/cos", - "!doc": "Returns the cosine of a number." - }, - "sin": { - "!type": "fn(number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/sin", - "!doc": "Returns the sine of a number." - }, - "tan": { - "!type": "fn(number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/tan", - "!doc": "Returns the tangent of a number." - }, - "acos": { - "!type": "fn(number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/acos", - "!doc": "Returns the arccosine (in radians) of a number." - }, - "asin": { - "!type": "fn(number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/asin", - "!doc": "Returns the arcsine (in radians) of a number." - }, - "atan": { - "!type": "fn(number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/atan", - "!doc": "Returns the arctangent (in radians) of a number." - }, - "atan2": { - "!type": "fn(y: number, x: number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/atan2", - "!doc": "Returns the arctangent of the quotient of its arguments." - }, - "ceil": { - "!type": "fn(number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/ceil", - "!doc": "Returns the smallest integer greater than or equal to a number." - }, - "floor": { - "!type": "fn(number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/floor", - "!doc": "Returns the largest integer less than or equal to a number." - }, - "round": { - "!type": "fn(number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/round", - "!doc": "Returns the value of a number rounded to the nearest integer." - }, - "exp": { - "!type": "fn(number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/exp", - "!doc": "Returns Ex, where x is the argument, and E is Euler's constant, the base of the natural logarithms." - }, - "log": { - "!type": "fn(number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/log", - "!doc": "Returns the natural logarithm (base E) of a number." - }, - "sqrt": { - "!type": "fn(number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/sqrt", - "!doc": "Returns the square root of a number." - }, - "pow": { - "!type": "fn(number, number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/pow", - "!doc": "Returns base to the exponent power, that is, baseexponent." - }, - "max": { - "!type": "fn(number, number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/max", - "!doc": "Returns the largest of zero or more numbers." - }, - "min": { - "!type": "fn(number, number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/min", - "!doc": "Returns the smallest of zero or more numbers." - }, - "random": { - "!type": "fn() -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/random", - "!doc": "Returns a floating-point, pseudo-random number in the range [0, 1) that is, from 0 (inclusive) up to but not including 1 (exclusive), which you can then scale to your desired range." - }, - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math", - "!doc": "A built-in object that has properties and methods for mathematical constants and functions." - }, - "JSON": { - "parse": { - "!type": "fn(json: string) -> ?", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/JSON/parse", - "!doc": "Parse a string as JSON, optionally transforming the value produced by parsing." - }, - "stringify": { - "!type": "fn(value: ?) -> string", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/JSON/stringify", - "!doc": "Convert a value to JSON, optionally replacing values if a replacer function is specified, or optionally including only the specified properties if a replacer array is specified." - }, - "!url": "https://developer.mozilla.org/en-US/docs/JSON", - "!doc": "JSON (JavaScript Object Notation) is a data-interchange format. It closely resembles a subset of JavaScript syntax, although it is not a strict subset. (See JSON in the JavaScript Reference for full details.) It is useful when writing any kind of JavaScript-based application, including websites and browser extensions. For example, you might store user information in JSON format in a cookie, or you might store extension preferences in JSON in a string-valued browser preference." - } -}; +ecma5defs = { + "!name": "ecma5", + "!define": { + "Error.prototype": "Error.prototype" + }, + "Infinity": { + "!type": "number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Infinity", + "!doc": "A numeric value representing infinity." + }, + "undefined": { + "!type": "?", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/undefined", + "!doc": "The value undefined." + }, + "NaN": { + "!type": "number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/NaN", + "!doc": "A value representing Not-A-Number." + }, + "Object": { + "!type": "fn()", + "getPrototypeOf": { + "!type": "fn(obj: ?) -> ?", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object/getPrototypeOf", + "!doc": "Returns the prototype (i.e. the internal prototype) of the specified object." + }, + "create": { + "!type": "fn(proto: ?) -> !custom:Object_create", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object/create", + "!doc": "Creates a new object with the specified prototype object and properties." + }, + "defineProperty": { + "!type": "fn(obj: ?, prop: string, desc: ?) -> !custom:Object_defineProperty", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object/defineProperty", + "!doc": "Defines a new property directly on an object, or modifies an existing property on an object, and returns the object. If you want to see how to use the Object.defineProperty method with a binary-flags-like syntax, see this article." + }, + "defineProperties": { + "!type": "fn(obj: ?, props: ?) -> !custom:Object_defineProperties", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object/defineProperty", + "!doc": "Defines a new property directly on an object, or modifies an existing property on an object, and returns the object. If you want to see how to use the Object.defineProperty method with a binary-flags-like syntax, see this article." + }, + "getOwnPropertyDescriptor": { + "!type": "fn(obj: ?, prop: string) -> ?", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object/getOwnPropertyDescriptor", + "!doc": "Returns a property descriptor for an own property (that is, one directly present on an object, not present by dint of being along an object's prototype chain) of a given object." + }, + "keys": { + "!type": "fn(obj: ?) -> [string]", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object/keys", + "!doc": "Returns an array of a given object's own enumerable properties, in the same order as that provided by a for-in loop (the difference being that a for-in loop enumerates properties in the prototype chain as well)." + }, + "getOwnPropertyNames": { + "!type": "fn(obj: ?) -> [string]", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object/getOwnPropertyNames", + "!doc": "Returns an array of all properties (enumerable or not) found directly upon a given object." + }, + "seal": { + "!type": "fn(obj: ?)", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object/seal", + "!doc": "Seals an object, preventing new properties from being added to it and marking all existing properties as non-configurable. Values of present properties can still be changed as long as they are writable." + }, + "isSealed": { + "!type": "fn(obj: ?) -> bool", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object/isSealed", + "!doc": "Determine if an object is sealed." + }, + "freeze": { + "!type": "fn(obj: ?) -> !0", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object/freeze", + "!doc": "Freezes an object: that is, prevents new properties from being added to it; prevents existing properties from being removed; and prevents existing properties, or their enumerability, configurability, or writability, from being changed. In essence the object is made effectively immutable. The method returns the object being frozen." + }, + "isFrozen": { + "!type": "fn(obj: ?) -> bool", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object/isFrozen", + "!doc": "Determine if an object is frozen." + }, + "preventExtensions": { + "!type": "fn(obj: ?)", + "!url": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/preventExtensions", + "!doc": "Prevents new properties from ever being added to an object." + }, + "isExtensible": { + "!type": "fn(obj: ?) -> bool", + "!url": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/isExtensible", + "!doc": "The Object.isExtensible() method determines if an object is extensible (whether it can have new properties added to it)." + }, + "prototype": { + "!stdProto": "Object", + "toString": { + "!type": "fn() -> string", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object/toString", + "!doc": "Returns a string representing the object." + }, + "toLocaleString": { + "!type": "fn() -> string", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object/toLocaleString", + "!doc": "Returns a string representing the object. This method is meant to be overriden by derived objects for locale-specific purposes." + }, + "valueOf": { + "!type": "fn() -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object/valueOf", + "!doc": "Returns the primitive value of the specified object" + }, + "hasOwnProperty": { + "!type": "fn(prop: string) -> bool", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object/hasOwnProperty", + "!doc": "Returns a boolean indicating whether the object has the specified property." + }, + "propertyIsEnumerable": { + "!type": "fn(prop: string) -> bool", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object/propertyIsEnumerable", + "!doc": "Returns a Boolean indicating whether the specified property is enumerable." + }, + "isPrototypeOf": { + "!type": "fn(obj: ?) -> bool", + "!url": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/isPrototypeOf", + "!doc": "Tests for an object in another object's prototype chain." + } + }, + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object", + "!doc": "Creates an object wrapper." + }, + "Function": { + "!type": "fn(body: string) -> fn()", + "prototype": { + "!stdProto": "Function", + "apply": { + "!type": "fn(this: ?, args: [?])", + "!effects": [ + "call and return !this this=!0 !1. !1. !1." + ], + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Function/apply", + "!doc": "Calls a function with a given this value and arguments provided as an array (or an array like object)." + }, + "call": { + "!type": "fn(this: ?, args?: ?) -> !this.!ret", + "!effects": [ + "call and return !this this=!0 !1 !2 !3 !4" + ], + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Function/call", + "!doc": "Calls a function with a given this value and arguments provided individually." + }, + "bind": { + "!type": "fn(this: ?, args?: ?) -> !custom:Function_bind", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Function/bind", + "!doc": "Creates a new function that, when called, has its this keyword set to the provided value, with a given sequence of arguments preceding any provided when the new function was called." + }, + "prototype": "?" + }, + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Function", + "!doc": "Every function in JavaScript is actually a Function object." + }, + "Array": { + "!type": "fn(size: number) -> !custom:Array_ctor", + "isArray": { + "!type": "fn(value: ?) -> bool", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/isArray", + "!doc": "Returns true if an object is an array, false if it is not." + }, + "prototype": { + "!stdProto": "Array", + "length": { + "!type": "number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/length", + "!doc": "An unsigned, 32-bit integer that specifies the number of elements in an array." + }, + "concat": { + "!type": "fn(other: [?]) -> !this", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/concat", + "!doc": "Returns a new array comprised of this array joined with other array(s) and/or value(s)." + }, + "join": { + "!type": "fn(separator?: string) -> string", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/join", + "!doc": "Joins all elements of an array into a string." + }, + "splice": { + "!type": "fn(pos: number, amount: number)", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/splice", + "!doc": "Changes the content of an array, adding new elements while removing old elements." + }, + "pop": { + "!type": "fn() -> !this.", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/pop", + "!doc": "Removes the last element from an array and returns that element." + }, + "push": { + "!type": "fn(newelt: ?) -> number", + "!effects": [ + "propagate !0 !this." + ], + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/push", + "!doc": "Mutates an array by appending the given elements and returning the new length of the array." + }, + "shift": { + "!type": "fn() -> !this.", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/shift", + "!doc": "Removes the first element from an array and returns that element. This method changes the length of the array." + }, + "unshift": { + "!type": "fn(newelt: ?) -> number", + "!effects": [ + "propagate !0 !this." + ], + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/unshift", + "!doc": "Adds one or more elements to the beginning of an array and returns the new length of the array." + }, + "slice": { + "!type": "fn(from: number, to?: number) -> !this", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/slice", + "!doc": "Returns a shallow copy of a portion of an array." + }, + "reverse": { + "!type": "fn()", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/reverse", + "!doc": "Reverses an array in place. The first array element becomes the last and the last becomes the first." + }, + "sort": { + "!type": "fn(compare?: fn(a: ?, b: ?) -> number)", + "!effects": [ + "call !0 !this. !this." + ], + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/sort", + "!doc": "Sorts the elements of an array in place and returns the array." + }, + "indexOf": { + "!type": "fn(elt: ?, from?: number) -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/indexOf", + "!doc": "Returns the first index at which a given element can be found in the array, or -1 if it is not present." + }, + "lastIndexOf": { + "!type": "fn(elt: ?, from?: number) -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/lastIndexOf", + "!doc": "Returns the last index at which a given element can be found in the array, or -1 if it is not present. The array is searched backwards, starting at fromIndex." + }, + "every": { + "!type": "fn(test: fn(elt: ?, i: number) -> bool, context?: ?) -> bool", + "!effects": [ + "call !0 this=!1 !this. number" + ], + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/every", + "!doc": "Tests whether all elements in the array pass the test implemented by the provided function." + }, + "some": { + "!type": "fn(test: fn(elt: ?, i: number) -> bool, context?: ?) -> bool", + "!effects": [ + "call !0 this=!1 !this. number" + ], + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/some", + "!doc": "Tests whether some element in the array passes the test implemented by the provided function." + }, + "filter": { + "!type": "fn(test: fn(elt: ?, i: number) -> bool, context?: ?) -> !this", + "!effects": [ + "call !0 this=!1 !this. number" + ], + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/filter", + "!doc": "Creates a new array with all elements that pass the test implemented by the provided function." + }, + "forEach": { + "!type": "fn(f: fn(elt: ?, i: number), context?: ?)", + "!effects": [ + "call !0 this=!1 !this. number" + ], + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/forEach", + "!doc": "Executes a provided function once per array element." + }, + "map": { + "!type": "fn(f: fn(elt: ?, i: number) -> ?, context?: ?) -> [!0.!ret]", + "!effects": [ + "call !0 this=!1 !this. number" + ], + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/map", + "!doc": "Creates a new array with the results of calling a provided function on every element in this array." + }, + "reduce": { + "!type": "fn(combine: fn(sum: ?, elt: ?, i: number) -> ?, init?: ?) -> !0.!ret", + "!effects": [ + "call !0 !1 !this. number" + ], + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/Reduce", + "!doc": "Apply a function against an accumulator and each value of the array (from left-to-right) as to reduce it to a single value." + }, + "reduceRight": { + "!type": "fn(combine: fn(sum: ?, elt: ?, i: number) -> ?, init?: ?) -> !0.!ret", + "!effects": [ + "call !0 !1 !this. number" + ], + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/ReduceRight", + "!doc": "Apply a function simultaneously against two values of the array (from right-to-left) as to reduce it to a single value." + } + }, + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array", + "!doc": "The JavaScript Array global object is a constructor for arrays, which are high-level, list-like objects." + }, + "String": { + "!type": "fn(value: ?) -> string", + "fromCharCode": { + "!type": "fn(code: number) -> string", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/fromCharCode", + "!doc": "Returns a string created by using the specified sequence of Unicode values." + }, + "prototype": { + "!stdProto": "String", + "length": { + "!type": "number", + "!url": "https://developer.mozilla.org/en/docs/JavaScript/Reference/Global_Objects/String/length", + "!doc": "Represents the length of a string." + }, + "": "string", + "charAt": { + "!type": "fn(i: number) -> string", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/charAt", + "!doc": "Returns the specified character from a string." + }, + "charCodeAt": { + "!type": "fn(i: number) -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/charCodeAt", + "!doc": "Returns the numeric Unicode value of the character at the given index (except for unicode codepoints > 0x10000)." + }, + "indexOf": { + "!type": "fn(char: string, from?: number) -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/indexOf", + "!doc": "Returns the index within the calling String object of the first occurrence of the specified value, starting the search at fromIndex,\nreturns -1 if the value is not found." + }, + "lastIndexOf": { + "!type": "fn(char: string, from?: number) -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/lastIndexOf", + "!doc": "Returns the index within the calling String object of the last occurrence of the specified value, or -1 if not found. The calling string is searched backward, starting at fromIndex." + }, + "substring": { + "!type": "fn(from: number, to?: number) -> string", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/substring", + "!doc": "Returns a subset of a string between one index and another, or through the end of the string." + }, + "substr": { + "!type": "fn(from: number, length?: number) -> string", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/substr", + "!doc": "Returns the characters in a string beginning at the specified location through the specified number of characters." + }, + "slice": { + "!type": "fn(from: number, to?: number) -> string", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/slice", + "!doc": "Extracts a section of a string and returns a new string." + }, + "trim": { + "!type": "fn() -> string", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/Trim", + "!doc": "Removes whitespace from both ends of the string." + }, + "toUpperCase": { + "!type": "fn() -> string", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/toUpperCase", + "!doc": "Returns the calling string value converted to uppercase." + }, + "toLowerCase": { + "!type": "fn() -> string", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/toLowerCase", + "!doc": "Returns the calling string value converted to lowercase." + }, + "toLocaleUpperCase": { + "!type": "fn() -> string", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/toLocaleUpperCase", + "!doc": "Returns the calling string value converted to upper case, according to any locale-specific case mappings." + }, + "toLocaleLowerCase": { + "!type": "fn() -> string", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/toLocaleLowerCase", + "!doc": "Returns the calling string value converted to lower case, according to any locale-specific case mappings." + }, + "split": { + "!type": "fn(pattern: string) -> [string]", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/split", + "!doc": "Splits a String object into an array of strings by separating the string into substrings." + }, + "concat": { + "!type": "fn(other: string) -> string", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/concat", + "!doc": "Combines the text of two or more strings and returns a new string." + }, + "localeCompare": { + "!type": "fn(other: string) -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/localeCompare", + "!doc": "Returns a number indicating whether a reference string comes before or after or is the same as the given string in sort order." + }, + "match": { + "!type": "fn(pattern: +RegExp) -> [string]", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/match", + "!doc": "Used to retrieve the matches when matching a string against a regular expression." + }, + "replace": { + "!type": "fn(pattern: string|+RegExp, replacement: string) -> string", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/replace", + "!doc": "Returns a new string with some or all matches of a pattern replaced by a replacement. The pattern can be a string or a RegExp, and the replacement can be a string or a function to be called for each match." + }, + "search": { + "!type": "fn(pattern: +RegExp) -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/search", + "!doc": "Executes the search for a match between a regular expression and this String object." + } + }, + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String", + "!doc": "The String global object is a constructor for strings, or a sequence of characters." + }, + "Number": { + "!type": "fn(value: ?) -> number", + "MAX_VALUE": { + "!type": "number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number/MAX_VALUE", + "!doc": "The maximum numeric value representable in JavaScript." + }, + "MIN_VALUE": { + "!type": "number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number/MIN_VALUE", + "!doc": "The smallest positive numeric value representable in JavaScript." + }, + "POSITIVE_INFINITY": { + "!type": "number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number/POSITIVE_INFINITY", + "!doc": "A value representing the positive Infinity value." + }, + "NEGATIVE_INFINITY": { + "!type": "number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number/NEGATIVE_INFINITY", + "!doc": "A value representing the negative Infinity value." + }, + "prototype": { + "!stdProto": "Number", + "toString": { + "!type": "fn(radix?: number) -> string", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number/toString", + "!doc": "Returns a string representing the specified Number object" + }, + "toFixed": { + "!type": "fn(digits: number) -> string", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number/toFixed", + "!doc": "Formats a number using fixed-point notation" + }, + "toExponential": { + "!type": "fn(digits: number) -> string", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number/toExponential", + "!doc": "Returns a string representing the Number object in exponential notation" + }, + "toPrecision": { + "!type": "fn(digits: number) -> string", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number/toPrecision", + "!doc": "The toPrecision() method returns a string representing the number to the specified precision." + } + }, + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number", + "!doc": "The Number JavaScript object is a wrapper object allowing you to work with numerical values. A Number object is created using the Number() constructor." + }, + "Boolean": { + "!type": "fn(value: ?) -> bool", + "prototype": { + "!stdProto": "Boolean" + }, + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Boolean", + "!doc": "The Boolean object is an object wrapper for a boolean value." + }, + "RegExp": { + "!type": "fn(source: string, flags?: string)", + "prototype": { + "!stdProto": "RegExp", + "exec": { + "!type": "fn(input: string) -> [string]", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/RegExp/exec", + "!doc": "Executes a search for a match in a specified string. Returns a result array, or null." + }, + "test": { + "!type": "fn(input: string) -> bool", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/RegExp/test", + "!doc": "Executes the search for a match between a regular expression and a specified string. Returns true or false." + }, + "global": { + "!type": "bool", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/RegExp", + "!doc": "Creates a regular expression object for matching text with a pattern." + }, + "ignoreCase": { + "!type": "bool", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/RegExp", + "!doc": "Creates a regular expression object for matching text with a pattern." + }, + "multiline": { + "!type": "bool", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/RegExp/multiline", + "!doc": "Reflects whether or not to search in strings across multiple lines.\n" + }, + "source": { + "!type": "string", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/RegExp/source", + "!doc": "A read-only property that contains the text of the pattern, excluding the forward slashes.\n" + }, + "lastIndex": { + "!type": "number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/RegExp/lastIndex", + "!doc": "A read/write integer property that specifies the index at which to start the next match." + } + }, + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/RegExp", + "!doc": "Creates a regular expression object for matching text with a pattern." + }, + "Date": { + "!type": "fn(ms: number)", + "parse": { + "!type": "fn(source: string) -> +Date", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/parse", + "!doc": "Parses a string representation of a date, and returns the number of milliseconds since January 1, 1970, 00:00:00 UTC." + }, + "UTC": { + "!type": "fn(year: number, month: number, date: number, hour?: number, min?: number, sec?: number, ms?: number) -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/UTC", + "!doc": "Accepts the same parameters as the longest form of the constructor, and returns the number of milliseconds in a Date object since January 1, 1970, 00:00:00, universal time." + }, + "now": { + "!type": "fn() -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/now", + "!doc": "Returns the number of milliseconds elapsed since 1 January 1970 00:00:00 UTC." + }, + "prototype": { + "toUTCString": { + "!type": "fn() -> string", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/toUTCString", + "!doc": "Converts a date to a string, using the universal time convention." + }, + "toISOString": { + "!type": "fn() -> string", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/toISOString", + "!doc": "JavaScript provides a direct way to convert a date object into a string in ISO format, the ISO 8601 Extended Format." + }, + "toDateString": { + "!type": "fn() -> string", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/toDateString", + "!doc": "Returns the date portion of a Date object in human readable form in American English." + }, + "toTimeString": { + "!type": "fn() -> string", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/toTimeString", + "!doc": "Returns the time portion of a Date object in human readable form in American English." + }, + "toLocaleDateString": { + "!type": "fn() -> string", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/toLocaleDateString", + "!doc": "Converts a date to a string, returning the \"date\" portion using the operating system's locale's conventions.\n" + }, + "toLocaleTimeString": { + "!type": "fn() -> string", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/toLocaleTimeString", + "!doc": "Converts a date to a string, returning the \"time\" portion using the current locale's conventions." + }, + "getTime": { + "!type": "fn() -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/getTime", + "!doc": "Returns the numeric value corresponding to the time for the specified date according to universal time." + }, + "getFullYear": { + "!type": "fn() -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/getFullYear", + "!doc": "Returns the year of the specified date according to local time." + }, + "getYear": { + "!type": "fn() -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/getYear", + "!doc": "Returns the year in the specified date according to local time." + }, + "getMonth": { + "!type": "fn() -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/getMonth", + "!doc": "Returns the month in the specified date according to local time." + }, + "getUTCMonth": { + "!type": "fn() -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/getUTCMonth", + "!doc": "Returns the month of the specified date according to universal time.\n" + }, + "getDate": { + "!type": "fn() -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/getDate", + "!doc": "Returns the day of the month for the specified date according to local time." + }, + "getUTCDate": { + "!type": "fn() -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/getUTCDate", + "!doc": "Returns the day (date) of the month in the specified date according to universal time.\n" + }, + "getDay": { + "!type": "fn() -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/getDay", + "!doc": "Returns the day of the week for the specified date according to local time." + }, + "getUTCDay": { + "!type": "fn() -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/getUTCDay", + "!doc": "Returns the day of the week in the specified date according to universal time.\n" + }, + "getHours": { + "!type": "fn() -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/getHours", + "!doc": "Returns the hour for the specified date according to local time." + }, + "getUTCHours": { + "!type": "fn() -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/getUTCHours", + "!doc": "Returns the hours in the specified date according to universal time.\n" + }, + "getMinutes": { + "!type": "fn() -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/getMinutes", + "!doc": "Returns the minutes in the specified date according to local time." + }, + "getUTCMinutes": { + "!type": "fn() -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date", + "!doc": "Creates JavaScript Date instances which let you work with dates and times." + }, + "getSeconds": { + "!type": "fn() -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/getSeconds", + "!doc": "Returns the seconds in the specified date according to local time." + }, + "getUTCSeconds": { + "!type": "fn() -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/getUTCSeconds", + "!doc": "Returns the seconds in the specified date according to universal time.\n" + }, + "getMilliseconds": { + "!type": "fn() -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/getMilliseconds", + "!doc": "Returns the milliseconds in the specified date according to local time." + }, + "getUTCMilliseconds": { + "!type": "fn() -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/getUTCMilliseconds", + "!doc": "Returns the milliseconds in the specified date according to universal time.\n" + }, + "getTimezoneOffset": { + "!type": "fn() -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/getTimezoneOffset", + "!doc": "Returns the time-zone offset from UTC, in minutes, for the current locale." + }, + "setTime": { + "!type": "fn(date: +Date) -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/setTime", + "!doc": "Sets the Date object to the time represented by a number of milliseconds since January 1, 1970, 00:00:00 UTC.\n" + }, + "setFullYear": { + "!type": "fn(year: number) -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/setFullYear", + "!doc": "Sets the full year for a specified date according to local time.\n" + }, + "setUTCFullYear": { + "!type": "fn(year: number) -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/setUTCFullYear", + "!doc": "Sets the full year for a specified date according to universal time.\n" + }, + "setMonth": { + "!type": "fn(month: number) -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/setMonth", + "!doc": "Set the month for a specified date according to local time." + }, + "setUTCMonth": { + "!type": "fn(month: number) -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/setUTCMonth", + "!doc": "Sets the month for a specified date according to universal time.\n" + }, + "setDate": { + "!type": "fn(day: number) -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/setDate", + "!doc": "Sets the day of the month for a specified date according to local time." + }, + "setUTCDate": { + "!type": "fn(day: number) -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/setUTCDate", + "!doc": "Sets the day of the month for a specified date according to universal time.\n" + }, + "setHours": { + "!type": "fn(hour: number) -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/setHours", + "!doc": "Sets the hours for a specified date according to local time, and returns the number of milliseconds since 1 January 1970 00:00:00 UTC until the time represented by the updated Date instance." + }, + "setUTCHours": { + "!type": "fn(hour: number) -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/setUTCHours", + "!doc": "Sets the hour for a specified date according to universal time.\n" + }, + "setMinutes": { + "!type": "fn(min: number) -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/setMinutes", + "!doc": "Sets the minutes for a specified date according to local time." + }, + "setUTCMinutes": { + "!type": "fn(min: number) -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/setUTCMinutes", + "!doc": "Sets the minutes for a specified date according to universal time.\n" + }, + "setSeconds": { + "!type": "fn(sec: number) -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/setSeconds", + "!doc": "Sets the seconds for a specified date according to local time." + }, + "setUTCSeconds": { + "!type": "fn(sec: number) -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/setUTCSeconds", + "!doc": "Sets the seconds for a specified date according to universal time.\n" + }, + "setMilliseconds": { + "!type": "fn(ms: number) -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/setMilliseconds", + "!doc": "Sets the milliseconds for a specified date according to local time.\n" + }, + "setUTCMilliseconds": { + "!type": "fn(ms: number) -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/setUTCMilliseconds", + "!doc": "Sets the milliseconds for a specified date according to universal time.\n" + } + }, + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date", + "!doc": "Creates JavaScript Date instances which let you work with dates and times." + }, + "Error": { + "!type": "fn(message: string)", + "prototype": { + "name": { + "!type": "string", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Error/name", + "!doc": "A name for the type of error." + }, + "message": { + "!type": "string", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Error/message", + "!doc": "A human-readable description of the error." + } + }, + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Error", + "!doc": "Creates an error object." + }, + "SyntaxError": { + "!type": "fn(message: string)", + "prototype": "Error.prototype", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/SyntaxError", + "!doc": "Represents an error when trying to interpret syntactically invalid code." + }, + "ReferenceError": { + "!type": "fn(message: string)", + "prototype": "Error.prototype", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/ReferenceError", + "!doc": "Represents an error when a non-existent variable is referenced." + }, + "URIError": { + "!type": "fn(message: string)", + "prototype": "Error.prototype", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/URIError", + "!doc": "Represents an error when a malformed URI is encountered." + }, + "EvalError": { + "!type": "fn(message: string)", + "prototype": "Error.prototype", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/EvalError", + "!doc": "Represents an error regarding the eval function." + }, + "RangeError": { + "!type": "fn(message: string)", + "prototype": "Error.prototype", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/RangeError", + "!doc": "Represents an error when a number is not within the correct range allowed." + }, + "TypeError": { + "!type": "fn(message: string)", + "prototype": "Error.prototype", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/TypeError", + "!doc": "Represents an error an error when a value is not of the expected type." + }, + "parseInt": { + "!type": "fn(string: string, radix?: number) -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/parseInt", + "!doc": "Parses a string argument and returns an integer of the specified radix or base." + }, + "parseFloat": { + "!type": "fn(string: string) -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/parseFloat", + "!doc": "Parses a string argument and returns a floating point number." + }, + "isNaN": { + "!type": "fn(value: number) -> bool", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/isNaN", + "!doc": "Determines whether a value is NaN or not. Be careful, this function is broken. You may be interested in ECMAScript 6 Number.isNaN." + }, + "isFinite": { + "!type": "fn(value: number) -> bool", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/isFinite", + "!doc": "Determines whether the passed value is a finite number." + }, + "eval": { + "!type": "fn(code: string) -> ?", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/eval", + "!doc": "Evaluates JavaScript code represented as a string." + }, + "encodeURI": { + "!type": "fn(uri: string) -> string", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/encodeURI", + "!doc": "Encodes a Uniform Resource Identifier (URI) by replacing each instance of certain characters by one, two, three, or four escape sequences representing the UTF-8 encoding of the character (will only be four escape sequences for characters composed of two \"surrogate\" characters)." + }, + "encodeURIComponent": { + "!type": "fn(uri: string) -> string", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/encodeURIComponent", + "!doc": "Encodes a Uniform Resource Identifier (URI) component by replacing each instance of certain characters by one, two, three, or four escape sequences representing the UTF-8 encoding of the character (will only be four escape sequences for characters composed of two \"surrogate\" characters)." + }, + "decodeURI": { + "!type": "fn(uri: string) -> string", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/decodeURI", + "!doc": "Decodes a Uniform Resource Identifier (URI) previously created by encodeURI or by a similar routine." + }, + "decodeURIComponent": { + "!type": "fn(uri: string) -> string", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/decodeURIComponent", + "!doc": "Decodes a Uniform Resource Identifier (URI) component previously created by encodeURIComponent or by a similar routine." + }, + "Math": { + "E": { + "!type": "number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/E", + "!doc": "The base of natural logarithms, e, approximately 2.718." + }, + "LN2": { + "!type": "number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/LN2", + "!doc": "The natural logarithm of 2, approximately 0.693." + }, + "LN10": { + "!type": "number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/LN10", + "!doc": "The natural logarithm of 10, approximately 2.302." + }, + "LOG2E": { + "!type": "number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/LOG2E", + "!doc": "The base 2 logarithm of E (approximately 1.442)." + }, + "LOG10E": { + "!type": "number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/LOG10E", + "!doc": "The base 10 logarithm of E (approximately 0.434)." + }, + "SQRT1_2": { + "!type": "number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/SQRT1_2", + "!doc": "The square root of 1/2; equivalently, 1 over the square root of 2, approximately 0.707." + }, + "SQRT2": { + "!type": "number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/SQRT2", + "!doc": "The square root of 2, approximately 1.414." + }, + "PI": { + "!type": "number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/PI", + "!doc": "The ratio of the circumference of a circle to its diameter, approximately 3.14159." + }, + "abs": { + "!type": "fn(number) -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/abs", + "!doc": "Returns the absolute value of a number." + }, + "cos": { + "!type": "fn(number) -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/cos", + "!doc": "Returns the cosine of a number." + }, + "sin": { + "!type": "fn(number) -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/sin", + "!doc": "Returns the sine of a number." + }, + "tan": { + "!type": "fn(number) -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/tan", + "!doc": "Returns the tangent of a number." + }, + "acos": { + "!type": "fn(number) -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/acos", + "!doc": "Returns the arccosine (in radians) of a number." + }, + "asin": { + "!type": "fn(number) -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/asin", + "!doc": "Returns the arcsine (in radians) of a number." + }, + "atan": { + "!type": "fn(number) -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/atan", + "!doc": "Returns the arctangent (in radians) of a number." + }, + "atan2": { + "!type": "fn(y: number, x: number) -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/atan2", + "!doc": "Returns the arctangent of the quotient of its arguments." + }, + "ceil": { + "!type": "fn(number) -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/ceil", + "!doc": "Returns the smallest integer greater than or equal to a number." + }, + "floor": { + "!type": "fn(number) -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/floor", + "!doc": "Returns the largest integer less than or equal to a number." + }, + "round": { + "!type": "fn(number) -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/round", + "!doc": "Returns the value of a number rounded to the nearest integer." + }, + "exp": { + "!type": "fn(number) -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/exp", + "!doc": "Returns Ex, where x is the argument, and E is Euler's constant, the base of the natural logarithms." + }, + "log": { + "!type": "fn(number) -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/log", + "!doc": "Returns the natural logarithm (base E) of a number." + }, + "sqrt": { + "!type": "fn(number) -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/sqrt", + "!doc": "Returns the square root of a number." + }, + "pow": { + "!type": "fn(number, number) -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/pow", + "!doc": "Returns base to the exponent power, that is, baseexponent." + }, + "max": { + "!type": "fn(number, number) -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/max", + "!doc": "Returns the largest of zero or more numbers." + }, + "min": { + "!type": "fn(number, number) -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/min", + "!doc": "Returns the smallest of zero or more numbers." + }, + "random": { + "!type": "fn() -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/random", + "!doc": "Returns a floating-point, pseudo-random number in the range [0, 1) that is, from 0 (inclusive) up to but not including 1 (exclusive), which you can then scale to your desired range." + }, + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math", + "!doc": "A built-in object that has properties and methods for mathematical constants and functions." + }, + "JSON": { + "parse": { + "!type": "fn(json: string) -> ?", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/JSON/parse", + "!doc": "Parse a string as JSON, optionally transforming the value produced by parsing." + }, + "stringify": { + "!type": "fn(value: ?) -> string", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/JSON/stringify", + "!doc": "Convert a value to JSON, optionally replacing values if a replacer function is specified, or optionally including only the specified properties if a replacer array is specified." + }, + "!url": "https://developer.mozilla.org/en-US/docs/JSON", + "!doc": "JSON (JavaScript Object Notation) is a data-interchange format. It closely resembles a subset of JavaScript syntax, although it is not a strict subset. (See JSON in the JavaScript Reference for full details.) It is useful when writing any kind of JavaScript-based application, including websites and browser extensions. For example, you might store user information in JSON format in a cookie, or you might store extension preferences in JSON in a string-valued browser preference." + } +}; diff --git a/qt/org.eclipse.cdt.qt.core.tests/src/org/eclipse/cdt/qt/core/tests/QMLDirectoryLexerTests.java b/qt/org.eclipse.cdt.qt.core.tests/src/org/eclipse/cdt/qt/core/tests/QMLDirectoryLexerTests.java index 316430fa4d8..1944c6feec3 100644 --- a/qt/org.eclipse.cdt.qt.core.tests/src/org/eclipse/cdt/qt/core/tests/QMLDirectoryLexerTests.java +++ b/qt/org.eclipse.cdt.qt.core.tests/src/org/eclipse/cdt/qt/core/tests/QMLDirectoryLexerTests.java @@ -1,287 +1,287 @@ -/******************************************************************************* - * Copyright (c) 2015 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.qt.core.tests; - -import static org.junit.Assert.*; - -import java.io.ByteArrayInputStream; -import java.io.InputStream; - -import org.eclipse.cdt.internal.qt.core.location.Position; -import org.eclipse.cdt.qt.core.qmldir.QMLDirectoryLexer; -import org.eclipse.cdt.qt.core.qmldir.QMLDirectoryLexer.Token; -import org.eclipse.cdt.qt.core.qmldir.QMLDirectoryLexer.TokenType; -import org.junit.Test; - -@SuppressWarnings("nls") -public class QMLDirectoryLexerTests { - private void assertToken(TokenType type, String text, int start, int end, Position locStart, Position locEnd, Token actual) { - // Check token type and text - assertEquals("Unexpected token type", type, actual.getType()); - assertEquals("Unexpected token text", text, actual.getText()); - - // Check position offsets - assertEquals("Unexpected start position", start, actual.getStart()); - assertEquals("Unexpected end position", end, actual.getEnd()); - - // Check SourceLocation start - assertEquals("Unexpected location start line", locStart.getLine(), actual.getLocation().getStart().getLine()); - assertEquals("Unexpected location start column", locStart.getColumn(), actual.getLocation().getStart().getColumn()); - - // Check SourceLocation end - assertEquals("Unexpected location end line", locEnd.getLine(), actual.getLocation().getEnd().getLine()); - assertEquals("Unexpected location end column", locEnd.getColumn(), actual.getLocation().getEnd().getColumn()); - } - - private InputStream createInputStream(String s) { - return new ByteArrayInputStream(s.getBytes()); - } - - @Test - public void testCommentToken() { - QMLDirectoryLexer lexer = new QMLDirectoryLexer(); - lexer.setInput(new ByteArrayInputStream("# This is a comment".getBytes())); - assertToken(TokenType.COMMENT, - "# This is a comment", - 0, 19, - new Position(1, 0), new Position(1, 19), - lexer.nextToken(false)); - } - - @Test - public void testMultipleCommentTokens() { - QMLDirectoryLexer lexer = new QMLDirectoryLexer(); - lexer.setInput(createInputStream("# This is a comment\n# This is another comment\n")); - assertToken(TokenType.COMMENT, - "# This is a comment", - 0, 19, - new Position(1, 0), new Position(1, 19), - lexer.nextToken(false)); - assertEquals(TokenType.COMMAND_END, lexer.nextToken(false).getType()); - assertToken(TokenType.COMMENT, - "# This is another comment", - 20, 45, - new Position(2, 0), new Position(2, 25), - lexer.nextToken(false)); - assertEquals(TokenType.COMMAND_END, lexer.nextToken(false).getType()); - assertEquals(TokenType.EOF, lexer.nextToken(false).getType()); - } - - @Test - public void testModuleToken() { - QMLDirectoryLexer lexer = new QMLDirectoryLexer(); - lexer.setInput(createInputStream("module")); - assertToken(TokenType.MODULE, - "module", - 0, 6, - new Position(1, 0), new Position(1, 6), - lexer.nextToken()); - } - - @Test - public void testTypeInfoToken() { - QMLDirectoryLexer lexer = new QMLDirectoryLexer(); - lexer.setInput(createInputStream("typeinfo")); - assertToken(TokenType.TYPEINFO, - "typeinfo", - 0, 8, - new Position(1, 0), new Position(1, 8), - lexer.nextToken()); - } - - @Test - public void testSingletonToken() { - QMLDirectoryLexer lexer = new QMLDirectoryLexer(); - lexer.setInput(createInputStream("singleton")); - assertToken(TokenType.SINGLETON, - "singleton", - 0, 9, - new Position(1, 0), new Position(1, 9), - lexer.nextToken()); - } - - @Test - public void testInternalToken() { - QMLDirectoryLexer lexer = new QMLDirectoryLexer(); - lexer.setInput(createInputStream("internal")); - assertToken(TokenType.INTERNAL, - "internal", - 0, 8, - new Position(1, 0), new Position(1, 8), - lexer.nextToken()); - } - - @Test - public void testPluginToken() { - QMLDirectoryLexer lexer = new QMLDirectoryLexer(); - lexer.setInput(createInputStream("plugin")); - assertToken(TokenType.PLUGIN, - "plugin", - 0, 6, - new Position(1, 0), new Position(1, 6), - lexer.nextToken()); - } - - @Test - public void testClassnameToken() { - QMLDirectoryLexer lexer = new QMLDirectoryLexer(); - lexer.setInput(createInputStream("classname")); - assertToken(TokenType.CLASSNAME, - "classname", - 0, 9, - new Position(1, 0), new Position(1, 9), - lexer.nextToken()); - } - - @Test - public void testDependsToken() { - QMLDirectoryLexer lexer = new QMLDirectoryLexer(); - lexer.setInput(createInputStream("depends")); - assertToken(TokenType.DEPENDS, - "depends", - 0, 7, - new Position(1, 0), new Position(1, 7), - lexer.nextToken()); - } - - @Test - public void testDesignerSupportedToken() { - QMLDirectoryLexer lexer = new QMLDirectoryLexer(); - lexer.setInput(createInputStream("designersupported")); - assertToken(TokenType.DESIGNERSUPPORTED, - "designersupported", - 0, 17, - new Position(1, 0), new Position(1, 17), - lexer.nextToken()); - } - - @Test - public void testWordToken() { - QMLDirectoryLexer lexer = new QMLDirectoryLexer(); - lexer.setInput(createInputStream("QtQuick.Control")); - assertToken(TokenType.WORD, - "QtQuick.Control", - 0, 15, - new Position(1, 0), new Position(1, 15), - lexer.nextToken()); - } - - @Test - public void testWordTokenContainsKeyword() { - QMLDirectoryLexer lexer = new QMLDirectoryLexer(); - lexer.setInput(createInputStream("plugins.test")); - assertToken(TokenType.WORD, - "plugins.test", - 0, 12, - new Position(1, 0), new Position(1, 12), - lexer.nextToken()); - } - - @Test - public void testWordTokenAsRelativePath() { - QMLDirectoryLexer lexer = new QMLDirectoryLexer(); - lexer.setInput(createInputStream("./test/something/")); - assertToken(TokenType.WORD, - "./test/something/", - 0, 17, - new Position(1, 0), new Position(1, 17), - lexer.nextToken()); - } - - @Test - public void testWordTokenAsAbsoluteWindowsPath() { - QMLDirectoryLexer lexer = new QMLDirectoryLexer(); - lexer.setInput(createInputStream("C:\\Users\\someone\\test\\something\\")); - assertToken(TokenType.WORD, - "C:\\Users\\someone\\test\\something\\", - 0, 32, - new Position(1, 0), new Position(1, 32), - lexer.nextToken()); - } - - @Test - public void testWordTokenAsAbsoluteUnixPath() { - QMLDirectoryLexer lexer = new QMLDirectoryLexer(); - lexer.setInput(createInputStream("/usr/local/test/something/")); - assertToken(TokenType.WORD, - "/usr/local/test/something/", - 0, 26, - new Position(1, 0), new Position(1, 26), - lexer.nextToken()); - } - - @Test - public void testDecimalToken() { - QMLDirectoryLexer lexer = new QMLDirectoryLexer(); - lexer.setInput(createInputStream("2.3")); - assertToken(TokenType.DECIMAL, - "2.3", - 0, 3, - new Position(1, 0), new Position(1, 3), - lexer.nextToken()); - } - - @Test - public void testIntegerToken() { - QMLDirectoryLexer lexer = new QMLDirectoryLexer(); - lexer.setInput(createInputStream("3")); - assertToken(TokenType.INTEGER, - "3", - 0, 1, - new Position(1, 0), new Position(1, 1), - lexer.nextToken()); - } - - @Test - public void testWhitespaceToken() { - QMLDirectoryLexer lexer = new QMLDirectoryLexer(); - lexer.setInput(createInputStream(" \t\n")); - assertToken(TokenType.WHITESPACE, - " \t", - 0, 2, - new Position(1, 0), new Position(1, 2), - lexer.nextToken(false)); - } - - @Test - public void testCommandEndToken() { - QMLDirectoryLexer lexer = new QMLDirectoryLexer(); - lexer.setInput(createInputStream("\n")); - assertToken(TokenType.COMMAND_END, - "\\n", - 0, 1, - new Position(1, 0), new Position(1, 1), - lexer.nextToken()); - } - - @Test - public void testEOFToken() { - QMLDirectoryLexer lexer = new QMLDirectoryLexer(); - lexer.setInput(createInputStream("")); - assertToken(TokenType.EOF, - "", - 0, 0, - new Position(1, 0), new Position(1, 0), - lexer.nextToken()); - } - - @Test - public void testEOFTokenAfterCommand() { - QMLDirectoryLexer lexer = new QMLDirectoryLexer(); - lexer.setInput(createInputStream("\n")); - lexer.nextToken(); - assertToken(TokenType.EOF, - "", - 1, 1, - new Position(2, 0), new Position(2, 0), - lexer.nextToken()); - } -} +/******************************************************************************* + * Copyright (c) 2015 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.qt.core.tests; + +import static org.junit.Assert.*; + +import java.io.ByteArrayInputStream; +import java.io.InputStream; + +import org.eclipse.cdt.internal.qt.core.location.Position; +import org.eclipse.cdt.qt.core.qmldir.QMLDirectoryLexer; +import org.eclipse.cdt.qt.core.qmldir.QMLDirectoryLexer.Token; +import org.eclipse.cdt.qt.core.qmldir.QMLDirectoryLexer.TokenType; +import org.junit.Test; + +@SuppressWarnings("nls") +public class QMLDirectoryLexerTests { + private void assertToken(TokenType type, String text, int start, int end, Position locStart, Position locEnd, Token actual) { + // Check token type and text + assertEquals("Unexpected token type", type, actual.getType()); + assertEquals("Unexpected token text", text, actual.getText()); + + // Check position offsets + assertEquals("Unexpected start position", start, actual.getStart()); + assertEquals("Unexpected end position", end, actual.getEnd()); + + // Check SourceLocation start + assertEquals("Unexpected location start line", locStart.getLine(), actual.getLocation().getStart().getLine()); + assertEquals("Unexpected location start column", locStart.getColumn(), actual.getLocation().getStart().getColumn()); + + // Check SourceLocation end + assertEquals("Unexpected location end line", locEnd.getLine(), actual.getLocation().getEnd().getLine()); + assertEquals("Unexpected location end column", locEnd.getColumn(), actual.getLocation().getEnd().getColumn()); + } + + private InputStream createInputStream(String s) { + return new ByteArrayInputStream(s.getBytes()); + } + + @Test + public void testCommentToken() { + QMLDirectoryLexer lexer = new QMLDirectoryLexer(); + lexer.setInput(new ByteArrayInputStream("# This is a comment".getBytes())); + assertToken(TokenType.COMMENT, + "# This is a comment", + 0, 19, + new Position(1, 0), new Position(1, 19), + lexer.nextToken(false)); + } + + @Test + public void testMultipleCommentTokens() { + QMLDirectoryLexer lexer = new QMLDirectoryLexer(); + lexer.setInput(createInputStream("# This is a comment\n# This is another comment\n")); + assertToken(TokenType.COMMENT, + "# This is a comment", + 0, 19, + new Position(1, 0), new Position(1, 19), + lexer.nextToken(false)); + assertEquals(TokenType.COMMAND_END, lexer.nextToken(false).getType()); + assertToken(TokenType.COMMENT, + "# This is another comment", + 20, 45, + new Position(2, 0), new Position(2, 25), + lexer.nextToken(false)); + assertEquals(TokenType.COMMAND_END, lexer.nextToken(false).getType()); + assertEquals(TokenType.EOF, lexer.nextToken(false).getType()); + } + + @Test + public void testModuleToken() { + QMLDirectoryLexer lexer = new QMLDirectoryLexer(); + lexer.setInput(createInputStream("module")); + assertToken(TokenType.MODULE, + "module", + 0, 6, + new Position(1, 0), new Position(1, 6), + lexer.nextToken()); + } + + @Test + public void testTypeInfoToken() { + QMLDirectoryLexer lexer = new QMLDirectoryLexer(); + lexer.setInput(createInputStream("typeinfo")); + assertToken(TokenType.TYPEINFO, + "typeinfo", + 0, 8, + new Position(1, 0), new Position(1, 8), + lexer.nextToken()); + } + + @Test + public void testSingletonToken() { + QMLDirectoryLexer lexer = new QMLDirectoryLexer(); + lexer.setInput(createInputStream("singleton")); + assertToken(TokenType.SINGLETON, + "singleton", + 0, 9, + new Position(1, 0), new Position(1, 9), + lexer.nextToken()); + } + + @Test + public void testInternalToken() { + QMLDirectoryLexer lexer = new QMLDirectoryLexer(); + lexer.setInput(createInputStream("internal")); + assertToken(TokenType.INTERNAL, + "internal", + 0, 8, + new Position(1, 0), new Position(1, 8), + lexer.nextToken()); + } + + @Test + public void testPluginToken() { + QMLDirectoryLexer lexer = new QMLDirectoryLexer(); + lexer.setInput(createInputStream("plugin")); + assertToken(TokenType.PLUGIN, + "plugin", + 0, 6, + new Position(1, 0), new Position(1, 6), + lexer.nextToken()); + } + + @Test + public void testClassnameToken() { + QMLDirectoryLexer lexer = new QMLDirectoryLexer(); + lexer.setInput(createInputStream("classname")); + assertToken(TokenType.CLASSNAME, + "classname", + 0, 9, + new Position(1, 0), new Position(1, 9), + lexer.nextToken()); + } + + @Test + public void testDependsToken() { + QMLDirectoryLexer lexer = new QMLDirectoryLexer(); + lexer.setInput(createInputStream("depends")); + assertToken(TokenType.DEPENDS, + "depends", + 0, 7, + new Position(1, 0), new Position(1, 7), + lexer.nextToken()); + } + + @Test + public void testDesignerSupportedToken() { + QMLDirectoryLexer lexer = new QMLDirectoryLexer(); + lexer.setInput(createInputStream("designersupported")); + assertToken(TokenType.DESIGNERSUPPORTED, + "designersupported", + 0, 17, + new Position(1, 0), new Position(1, 17), + lexer.nextToken()); + } + + @Test + public void testWordToken() { + QMLDirectoryLexer lexer = new QMLDirectoryLexer(); + lexer.setInput(createInputStream("QtQuick.Control")); + assertToken(TokenType.WORD, + "QtQuick.Control", + 0, 15, + new Position(1, 0), new Position(1, 15), + lexer.nextToken()); + } + + @Test + public void testWordTokenContainsKeyword() { + QMLDirectoryLexer lexer = new QMLDirectoryLexer(); + lexer.setInput(createInputStream("plugins.test")); + assertToken(TokenType.WORD, + "plugins.test", + 0, 12, + new Position(1, 0), new Position(1, 12), + lexer.nextToken()); + } + + @Test + public void testWordTokenAsRelativePath() { + QMLDirectoryLexer lexer = new QMLDirectoryLexer(); + lexer.setInput(createInputStream("./test/something/")); + assertToken(TokenType.WORD, + "./test/something/", + 0, 17, + new Position(1, 0), new Position(1, 17), + lexer.nextToken()); + } + + @Test + public void testWordTokenAsAbsoluteWindowsPath() { + QMLDirectoryLexer lexer = new QMLDirectoryLexer(); + lexer.setInput(createInputStream("C:\\Users\\someone\\test\\something\\")); + assertToken(TokenType.WORD, + "C:\\Users\\someone\\test\\something\\", + 0, 32, + new Position(1, 0), new Position(1, 32), + lexer.nextToken()); + } + + @Test + public void testWordTokenAsAbsoluteUnixPath() { + QMLDirectoryLexer lexer = new QMLDirectoryLexer(); + lexer.setInput(createInputStream("/usr/local/test/something/")); + assertToken(TokenType.WORD, + "/usr/local/test/something/", + 0, 26, + new Position(1, 0), new Position(1, 26), + lexer.nextToken()); + } + + @Test + public void testDecimalToken() { + QMLDirectoryLexer lexer = new QMLDirectoryLexer(); + lexer.setInput(createInputStream("2.3")); + assertToken(TokenType.DECIMAL, + "2.3", + 0, 3, + new Position(1, 0), new Position(1, 3), + lexer.nextToken()); + } + + @Test + public void testIntegerToken() { + QMLDirectoryLexer lexer = new QMLDirectoryLexer(); + lexer.setInput(createInputStream("3")); + assertToken(TokenType.INTEGER, + "3", + 0, 1, + new Position(1, 0), new Position(1, 1), + lexer.nextToken()); + } + + @Test + public void testWhitespaceToken() { + QMLDirectoryLexer lexer = new QMLDirectoryLexer(); + lexer.setInput(createInputStream(" \t\n")); + assertToken(TokenType.WHITESPACE, + " \t", + 0, 2, + new Position(1, 0), new Position(1, 2), + lexer.nextToken(false)); + } + + @Test + public void testCommandEndToken() { + QMLDirectoryLexer lexer = new QMLDirectoryLexer(); + lexer.setInput(createInputStream("\n")); + assertToken(TokenType.COMMAND_END, + "\\n", + 0, 1, + new Position(1, 0), new Position(1, 1), + lexer.nextToken()); + } + + @Test + public void testEOFToken() { + QMLDirectoryLexer lexer = new QMLDirectoryLexer(); + lexer.setInput(createInputStream("")); + assertToken(TokenType.EOF, + "", + 0, 0, + new Position(1, 0), new Position(1, 0), + lexer.nextToken()); + } + + @Test + public void testEOFTokenAfterCommand() { + QMLDirectoryLexer lexer = new QMLDirectoryLexer(); + lexer.setInput(createInputStream("\n")); + lexer.nextToken(); + assertToken(TokenType.EOF, + "", + 1, 1, + new Position(2, 0), new Position(2, 0), + lexer.nextToken()); + } +} diff --git a/qt/org.eclipse.cdt.qt.core.tests/src/org/eclipse/cdt/qt/core/tests/QMLDirectoryParserTests.java b/qt/org.eclipse.cdt.qt.core.tests/src/org/eclipse/cdt/qt/core/tests/QMLDirectoryParserTests.java index 74333f01e29..2ef27911ed1 100644 --- a/qt/org.eclipse.cdt.qt.core.tests/src/org/eclipse/cdt/qt/core/tests/QMLDirectoryParserTests.java +++ b/qt/org.eclipse.cdt.qt.core.tests/src/org/eclipse/cdt/qt/core/tests/QMLDirectoryParserTests.java @@ -1,308 +1,308 @@ -/******************************************************************************* - * Copyright (c) 2015 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.qt.core.tests; - -import static org.hamcrest.CoreMatchers.*; -import static org.junit.Assert.*; - -import java.io.ByteArrayInputStream; -import java.io.InputStream; - -import org.eclipse.cdt.internal.qt.core.location.Position; -import org.eclipse.cdt.qt.core.location.IPosition; -import org.eclipse.cdt.qt.core.qmldir.IQDirAST; -import org.eclipse.cdt.qt.core.qmldir.IQDirASTNode; -import org.eclipse.cdt.qt.core.qmldir.IQDirClassnameCommand; -import org.eclipse.cdt.qt.core.qmldir.IQDirCommentCommand; -import org.eclipse.cdt.qt.core.qmldir.IQDirDependsCommand; -import org.eclipse.cdt.qt.core.qmldir.IQDirDesignerSupportedCommand; -import org.eclipse.cdt.qt.core.qmldir.IQDirInternalCommand; -import org.eclipse.cdt.qt.core.qmldir.IQDirModuleCommand; -import org.eclipse.cdt.qt.core.qmldir.IQDirPluginCommand; -import org.eclipse.cdt.qt.core.qmldir.IQDirResourceCommand; -import org.eclipse.cdt.qt.core.qmldir.IQDirSingletonCommand; -import org.eclipse.cdt.qt.core.qmldir.IQDirSyntaxError; -import org.eclipse.cdt.qt.core.qmldir.IQDirTypeInfoCommand; -import org.eclipse.cdt.qt.core.qmldir.QMLDirectoryParser; -import org.eclipse.cdt.qt.core.qmldir.QMLDirectoryParser.SyntaxError; -import org.junit.Test; - -@SuppressWarnings("nls") -public class QMLDirectoryParserTests { - - public void assertLocation(int start, int end, IPosition locStart, IPosition locEnd, IQDirASTNode node) { - // Check position offsets - assertEquals("Unexpected start position", start, node.getStart()); - assertEquals("Unexpected end position", end, node.getEnd()); - - // Check SourceLocation start - assertEquals("Unexpected location start line", locStart.getLine(), node.getLocation().getStart().getLine()); - assertEquals("Unexpected location start column", locStart.getColumn(), node.getLocation().getStart().getColumn()); - } - - private InputStream createInputStream(String s) { - return new ByteArrayInputStream(s.getBytes()); - } - - @Test - public void testModuleCommand() { - QMLDirectoryParser parser = new QMLDirectoryParser(); - IQDirAST ast = parser.parse(createInputStream("module QtQuick.Controls\n"), false); - assertEquals("Unexpected command list size", 1, ast.getCommands().size()); - assertThat("Unexpected command", ast.getCommands().get(0), instanceOf(IQDirModuleCommand.class)); - IQDirModuleCommand mod = (IQDirModuleCommand) ast.getCommands().get(0); - assertEquals("Unexpected qualified ID", "QtQuick.Controls", mod.getModuleIdentifier().getText()); - assertLocation(0, 24, new Position(1, 0), new Position(1, 24), mod); - } - - @Test - public void testModuleNoIdentifier() { - try { - QMLDirectoryParser parser = new QMLDirectoryParser(); - parser.parse(createInputStream("module\n"), false); - fail("Parser did not throw SyntaxError"); - } catch (SyntaxError e) { - assertEquals("Unexpected token '\\n' (1:6)", e.getMessage()); - } - } - - @Test - public void testSingletonCommand() { - QMLDirectoryParser parser = new QMLDirectoryParser(); - IQDirAST ast = parser.parse(createInputStream("singleton Singleton 2.3 Singleton.qml\n"), false); - assertEquals("Unexpected command list size", 1, ast.getCommands().size()); - assertThat("Unexpected command", ast.getCommands().get(0), instanceOf(IQDirSingletonCommand.class)); - IQDirSingletonCommand singleton = (IQDirSingletonCommand) ast.getCommands().get(0); - assertEquals("Unexpected type name", "Singleton", singleton.getTypeName().getText()); - assertEquals("Unexpected initial version", "2.3", singleton.getInitialVersion().getVersionString()); - assertEquals("Unexpected file name", "Singleton.qml", singleton.getFile().getText()); - assertLocation(0, 38, new Position(1, 0), new Position(1, 38), singleton); - } - - @Test - public void testInvalidVersionNumber() { - try { - QMLDirectoryParser parser = new QMLDirectoryParser(); - parser.parse(createInputStream("singleton Singleton 2 Singleton.qml\n"), false); - fail("Parser did not throw SyntaxError"); - } catch (SyntaxError e) { - assertEquals("Unexpected token '2' (1:20)", e.getMessage()); - } - } - - @Test - public void testInternalCommand() { - QMLDirectoryParser parser = new QMLDirectoryParser(); - IQDirAST ast = parser.parse(createInputStream("internal MyPrivateType MyPrivateType.qml\n"), false); - assertEquals("Unexpected command list size", 1, ast.getCommands().size()); - assertThat("Unexpected command", ast.getCommands().get(0), instanceOf(IQDirInternalCommand.class)); - IQDirInternalCommand internal = (IQDirInternalCommand) ast.getCommands().get(0); - assertEquals("Unexpected type name", "MyPrivateType", internal.getTypeName().getText()); - assertEquals("Unexpected file name", "MyPrivateType.qml", internal.getFile().getText()); - assertLocation(0, 41, new Position(1, 0), new Position(1, 41), internal); - } - - @Test - public void testResourceCommand() { - QMLDirectoryParser parser = new QMLDirectoryParser(); - IQDirAST ast = parser.parse(createInputStream("MyScript 1.0 MyScript.qml\n"), false); - assertEquals("Unexpected command list size", 1, ast.getCommands().size()); - assertThat("Unexpected command", ast.getCommands().get(0), instanceOf(IQDirResourceCommand.class)); - IQDirResourceCommand resource = (IQDirResourceCommand) ast.getCommands().get(0); - assertEquals("Unexpected type name", "MyScript", resource.getResourceIdentifier().getText()); - assertEquals("Unexpected initial version", "1.0", resource.getInitialVersion().getVersionString()); - assertEquals("Unexpected file name", "MyScript.qml", resource.getFile().getText()); - assertLocation(0, 26, new Position(1, 0), new Position(1, 26), resource); - } - - @Test - public void testPluginCommand() { - QMLDirectoryParser parser = new QMLDirectoryParser(); - IQDirAST ast = parser.parse(createInputStream("plugin MyPluginLibrary\n"), false); - assertEquals("Unexpected command list size", 1, ast.getCommands().size()); - assertThat("Unexpected command", ast.getCommands().get(0), instanceOf(IQDirPluginCommand.class)); - IQDirPluginCommand plugin = (IQDirPluginCommand) ast.getCommands().get(0); - assertEquals("Unexpected identifier", "MyPluginLibrary", plugin.getName().getText()); - assertEquals("Unexpected path", null, plugin.getPath()); - assertLocation(0, 23, new Position(1, 0), new Position(1, 23), plugin); - } - - @Test - public void testPluginCommandWithPath() { - QMLDirectoryParser parser = new QMLDirectoryParser(); - IQDirAST ast = parser.parse(createInputStream("plugin MyPluginLibrary ./lib/\n"), false); - assertEquals("Unexpected command list size", 1, ast.getCommands().size()); - assertThat("Unexpected command", ast.getCommands().get(0), instanceOf(IQDirPluginCommand.class)); - IQDirPluginCommand plugin = (IQDirPluginCommand) ast.getCommands().get(0); - assertEquals("Unexpected identifier", "MyPluginLibrary", plugin.getName().getText()); - assertEquals("Unexpected path", "./lib/", plugin.getPath().getText()); - assertLocation(0, 30, new Position(1, 0), new Position(1, 30), plugin); - } - - @Test - public void testClassnameCommand() { - QMLDirectoryParser parser = new QMLDirectoryParser(); - IQDirAST ast = parser.parse(createInputStream("classname MyClass\n"), false); - assertEquals("Unexpected command list size", 1, ast.getCommands().size()); - assertThat("Unexpected command", ast.getCommands().get(0), instanceOf(IQDirClassnameCommand.class)); - IQDirClassnameCommand classname = (IQDirClassnameCommand) ast.getCommands().get(0); - assertEquals("Unexpected class name", "MyClass", classname.getIdentifier().getText()); - assertLocation(0, 18, new Position(1, 0), new Position(1, 18), classname); - } - - @Test - public void testTypeInfoCommand() { - QMLDirectoryParser parser = new QMLDirectoryParser(); - IQDirAST ast = parser.parse(createInputStream("typeinfo mymodule.qmltypes\n"), false); - assertEquals("Unexpected command list size", 1, ast.getCommands().size()); - assertThat("Unexpected command", ast.getCommands().get(0), instanceOf(IQDirTypeInfoCommand.class)); - IQDirTypeInfoCommand typeinfo = (IQDirTypeInfoCommand) ast.getCommands().get(0); - assertEquals("Unexpected file name", "mymodule.qmltypes", typeinfo.getFile().getText()); - assertLocation(0, 27, new Position(1, 0), new Position(1, 27), typeinfo); - } - - @Test - public void testDependsCommand() { - QMLDirectoryParser parser = new QMLDirectoryParser(); - IQDirAST ast = parser.parse(createInputStream("depends MyOtherModule 1.0\n"), false); - assertEquals("Unexpected command list size", 1, ast.getCommands().size()); - assertThat("Unexpected command", ast.getCommands().get(0), instanceOf(IQDirDependsCommand.class)); - IQDirDependsCommand depends = (IQDirDependsCommand) ast.getCommands().get(0); - assertEquals("Unexpected module identifier", "MyOtherModule", depends.getModuleIdentifier().getText()); - assertEquals("Unexpected initial version", "1.0", depends.getInitialVersion().getVersionString()); - assertLocation(0, 26, new Position(1, 0), new Position(1, 26), depends); - } - - @Test - public void testDesignerSupportedCommand() { - QMLDirectoryParser parser = new QMLDirectoryParser(); - IQDirAST ast = parser.parse(createInputStream("designersupported\n"), false); - assertEquals("Unexpected command list size", 1, ast.getCommands().size()); - assertThat("Unexpected command", ast.getCommands().get(0), instanceOf(IQDirDesignerSupportedCommand.class)); - assertLocation(0, 18, new Position(1, 0), new Position(1, 18), ast.getCommands().get(0)); - } - - @Test - public void testCommentCommand() { - QMLDirectoryParser parser = new QMLDirectoryParser(); - IQDirAST ast = parser.parse(createInputStream("# This is a comment command\n"), false); - assertEquals("Unexpected command list size", 1, ast.getCommands().size()); - assertThat("Unexpected command", ast.getCommands().get(0), instanceOf(IQDirCommentCommand.class)); - IQDirCommentCommand comment = (IQDirCommentCommand) ast.getCommands().get(0); - assertEquals("Unexpected text", "# This is a comment command", comment.getText()); - } - - @Test - public void testSyntaxErrorCommand() { - QMLDirectoryParser parser = new QMLDirectoryParser(); - IQDirAST ast = parser.parse(createInputStream("classname")); - assertEquals("Unexpected command list size", 1, ast.getCommands().size()); - assertThat("Unexpected command", ast.getCommands().get(0), instanceOf(IQDirSyntaxError.class)); - IQDirSyntaxError err = (IQDirSyntaxError) ast.getCommands().get(0); - assertEquals("Unexpected message", "Unexpected token 'EOF' (1:9)", err.getSyntaxError().getMessage()); - assertLocation(0, 9, new Position(1, 0), new Position(1, 9), err); - } - - @Test - public void testSyntaxErrorCommandIncludesWholeLine() { - QMLDirectoryParser parser = new QMLDirectoryParser(); - IQDirAST ast = parser.parse(createInputStream("classname class extra\n")); - assertEquals("Unexpected command list size", 1, ast.getCommands().size()); - assertThat("Unexpected command", ast.getCommands().get(0), instanceOf(IQDirSyntaxError.class)); - IQDirSyntaxError err = (IQDirSyntaxError) ast.getCommands().get(0); - assertEquals("Unexpected message", "Expected token '\\n' or 'EOF', but saw 'extra' (1:16)", - err.getSyntaxError().getMessage()); - assertLocation(0, 22, new Position(1, 0), new Position(1, 22), err); - } - - @Test - public void testExampleQMLDirFile() { - QMLDirectoryParser parser = new QMLDirectoryParser(); - IQDirAST ast = parser.parse(createInputStream("module QtQuick\n" + - "plugin qtquick2plugin\n" + - "classname QtQuick2Plugin\n" + - "typeinfo plugins.qmltypes\n" + - "designersupported\n")); - - assertEquals("Unexpected command list size", 5, ast.getCommands().size()); - // Module Command (index 0) - assertThat("Unexpected command", ast.getCommands().get(0), instanceOf(IQDirModuleCommand.class)); - IQDirModuleCommand mod = (IQDirModuleCommand) ast.getCommands().get(0); - assertEquals("Unexpected module qualified ID", "QtQuick", mod.getModuleIdentifier().getText()); - // Plugin Command (index 1) - assertThat("Unexpected command", ast.getCommands().get(1), instanceOf(IQDirPluginCommand.class)); - IQDirPluginCommand plugin = (IQDirPluginCommand) ast.getCommands().get(1); - assertEquals("Unexpected plugin identifier", "qtquick2plugin", plugin.getName().getText()); - assertEquals("Unexpected plugin path", null, plugin.getPath()); - // Classname Command (index 2) - assertThat("Unexpected command", ast.getCommands().get(2), instanceOf(IQDirClassnameCommand.class)); - IQDirClassnameCommand classname = (IQDirClassnameCommand) ast.getCommands().get(2); - assertEquals("Unexpected class name", "QtQuick2Plugin", classname.getIdentifier().getText()); - // Type Info Command (index 3) - assertThat("Unexpected command", ast.getCommands().get(3), instanceOf(IQDirTypeInfoCommand.class)); - IQDirTypeInfoCommand typeinfo = (IQDirTypeInfoCommand) ast.getCommands().get(3); - assertEquals("Unexpected type info file name", "plugins.qmltypes", typeinfo.getFile().getText()); - // Designer Supported Command (index 4) - assertThat("Unexpected command", ast.getCommands().get(4), instanceOf(IQDirDesignerSupportedCommand.class)); - } - - @Test - public void testExampleQMLDirFileWithError() { - QMLDirectoryParser parser = new QMLDirectoryParser(); - IQDirAST ast = parser.parse(createInputStream("module QtQuick\n" + - "plugin qtquick2plugin\n" + - "classnames QtQuick2Plugin\n" + - "typeinfo plugins.qmltypes\n" + - "designersupported\n")); - - assertEquals("Unexpected command list size", 5, ast.getCommands().size()); - // Module Command (index 0) - assertThat("Unexpected command", ast.getCommands().get(0), instanceOf(IQDirModuleCommand.class)); - IQDirModuleCommand mod = (IQDirModuleCommand) ast.getCommands().get(0); - assertEquals("Unexpected module qualified ID", "QtQuick", mod.getModuleIdentifier().getText()); - // Plugin Command (index 1) - assertThat("Unexpected command", ast.getCommands().get(1), instanceOf(IQDirPluginCommand.class)); - IQDirPluginCommand plugin = (IQDirPluginCommand) ast.getCommands().get(1); - assertEquals("Unexpected plugin identifier", "qtquick2plugin", plugin.getName().getText()); - assertEquals("Unexpected plugin path", null, plugin.getPath()); - // Syntax Error Command (index 2) - assertThat("Unexpected command", ast.getCommands().get(2), instanceOf(IQDirSyntaxError.class)); - IQDirSyntaxError err = (IQDirSyntaxError) ast.getCommands().get(2); - assertEquals("Unexpected error message", "Unexpected token 'QtQuick2Plugin' (3:11)", err.getSyntaxError().getMessage()); - // Type Info Command (index 3) - assertThat("Unexpected command", ast.getCommands().get(3), instanceOf(IQDirTypeInfoCommand.class)); - IQDirTypeInfoCommand typeinfo = (IQDirTypeInfoCommand) ast.getCommands().get(3); - assertEquals("Unexpected type info file name", "plugins.qmltypes", typeinfo.getFile().getText()); - // Designer Supported Command (index 4) - assertThat("Unexpected command", ast.getCommands().get(4), instanceOf(IQDirDesignerSupportedCommand.class)); - } - - @Test - public void testParseTwoDifferentStreams() { - QMLDirectoryParser parser = new QMLDirectoryParser(); - - // Parse module QtQuick.Controls - IQDirAST ast = parser.parse(createInputStream("module QtQuick.Controls\n"), false); - assertEquals("Unexpected command list size", 1, ast.getCommands().size()); - assertThat("Unexpected command", ast.getCommands().get(0), instanceOf(IQDirModuleCommand.class)); - IQDirModuleCommand mod = (IQDirModuleCommand) ast.getCommands().get(0); - assertEquals("Unexpected qualified ID", "QtQuick.Controls", mod.getModuleIdentifier().getText()); - assertLocation(0, 24, new Position(1, 0), new Position(1, 24), mod); - - // Parse a second module MyModule - ast = parser.parse(createInputStream("module MyModule\n"), false); - assertEquals("Unexpected command list size", 1, ast.getCommands().size()); - assertThat("Unexpected command", ast.getCommands().get(0), instanceOf(IQDirModuleCommand.class)); - mod = (IQDirModuleCommand) ast.getCommands().get(0); - assertEquals("Unexpected qualified ID", "MyModule", mod.getModuleIdentifier().getText()); - assertLocation(0, 16, new Position(1, 0), new Position(1, 16), mod); - } -} +/******************************************************************************* + * Copyright (c) 2015 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.qt.core.tests; + +import static org.hamcrest.CoreMatchers.*; +import static org.junit.Assert.*; + +import java.io.ByteArrayInputStream; +import java.io.InputStream; + +import org.eclipse.cdt.internal.qt.core.location.Position; +import org.eclipse.cdt.qt.core.location.IPosition; +import org.eclipse.cdt.qt.core.qmldir.IQDirAST; +import org.eclipse.cdt.qt.core.qmldir.IQDirASTNode; +import org.eclipse.cdt.qt.core.qmldir.IQDirClassnameCommand; +import org.eclipse.cdt.qt.core.qmldir.IQDirCommentCommand; +import org.eclipse.cdt.qt.core.qmldir.IQDirDependsCommand; +import org.eclipse.cdt.qt.core.qmldir.IQDirDesignerSupportedCommand; +import org.eclipse.cdt.qt.core.qmldir.IQDirInternalCommand; +import org.eclipse.cdt.qt.core.qmldir.IQDirModuleCommand; +import org.eclipse.cdt.qt.core.qmldir.IQDirPluginCommand; +import org.eclipse.cdt.qt.core.qmldir.IQDirResourceCommand; +import org.eclipse.cdt.qt.core.qmldir.IQDirSingletonCommand; +import org.eclipse.cdt.qt.core.qmldir.IQDirSyntaxError; +import org.eclipse.cdt.qt.core.qmldir.IQDirTypeInfoCommand; +import org.eclipse.cdt.qt.core.qmldir.QMLDirectoryParser; +import org.eclipse.cdt.qt.core.qmldir.QMLDirectoryParser.SyntaxError; +import org.junit.Test; + +@SuppressWarnings("nls") +public class QMLDirectoryParserTests { + + public void assertLocation(int start, int end, IPosition locStart, IPosition locEnd, IQDirASTNode node) { + // Check position offsets + assertEquals("Unexpected start position", start, node.getStart()); + assertEquals("Unexpected end position", end, node.getEnd()); + + // Check SourceLocation start + assertEquals("Unexpected location start line", locStart.getLine(), node.getLocation().getStart().getLine()); + assertEquals("Unexpected location start column", locStart.getColumn(), node.getLocation().getStart().getColumn()); + } + + private InputStream createInputStream(String s) { + return new ByteArrayInputStream(s.getBytes()); + } + + @Test + public void testModuleCommand() { + QMLDirectoryParser parser = new QMLDirectoryParser(); + IQDirAST ast = parser.parse(createInputStream("module QtQuick.Controls\n"), false); + assertEquals("Unexpected command list size", 1, ast.getCommands().size()); + assertThat("Unexpected command", ast.getCommands().get(0), instanceOf(IQDirModuleCommand.class)); + IQDirModuleCommand mod = (IQDirModuleCommand) ast.getCommands().get(0); + assertEquals("Unexpected qualified ID", "QtQuick.Controls", mod.getModuleIdentifier().getText()); + assertLocation(0, 24, new Position(1, 0), new Position(1, 24), mod); + } + + @Test + public void testModuleNoIdentifier() { + try { + QMLDirectoryParser parser = new QMLDirectoryParser(); + parser.parse(createInputStream("module\n"), false); + fail("Parser did not throw SyntaxError"); + } catch (SyntaxError e) { + assertEquals("Unexpected token '\\n' (1:6)", e.getMessage()); + } + } + + @Test + public void testSingletonCommand() { + QMLDirectoryParser parser = new QMLDirectoryParser(); + IQDirAST ast = parser.parse(createInputStream("singleton Singleton 2.3 Singleton.qml\n"), false); + assertEquals("Unexpected command list size", 1, ast.getCommands().size()); + assertThat("Unexpected command", ast.getCommands().get(0), instanceOf(IQDirSingletonCommand.class)); + IQDirSingletonCommand singleton = (IQDirSingletonCommand) ast.getCommands().get(0); + assertEquals("Unexpected type name", "Singleton", singleton.getTypeName().getText()); + assertEquals("Unexpected initial version", "2.3", singleton.getInitialVersion().getVersionString()); + assertEquals("Unexpected file name", "Singleton.qml", singleton.getFile().getText()); + assertLocation(0, 38, new Position(1, 0), new Position(1, 38), singleton); + } + + @Test + public void testInvalidVersionNumber() { + try { + QMLDirectoryParser parser = new QMLDirectoryParser(); + parser.parse(createInputStream("singleton Singleton 2 Singleton.qml\n"), false); + fail("Parser did not throw SyntaxError"); + } catch (SyntaxError e) { + assertEquals("Unexpected token '2' (1:20)", e.getMessage()); + } + } + + @Test + public void testInternalCommand() { + QMLDirectoryParser parser = new QMLDirectoryParser(); + IQDirAST ast = parser.parse(createInputStream("internal MyPrivateType MyPrivateType.qml\n"), false); + assertEquals("Unexpected command list size", 1, ast.getCommands().size()); + assertThat("Unexpected command", ast.getCommands().get(0), instanceOf(IQDirInternalCommand.class)); + IQDirInternalCommand internal = (IQDirInternalCommand) ast.getCommands().get(0); + assertEquals("Unexpected type name", "MyPrivateType", internal.getTypeName().getText()); + assertEquals("Unexpected file name", "MyPrivateType.qml", internal.getFile().getText()); + assertLocation(0, 41, new Position(1, 0), new Position(1, 41), internal); + } + + @Test + public void testResourceCommand() { + QMLDirectoryParser parser = new QMLDirectoryParser(); + IQDirAST ast = parser.parse(createInputStream("MyScript 1.0 MyScript.qml\n"), false); + assertEquals("Unexpected command list size", 1, ast.getCommands().size()); + assertThat("Unexpected command", ast.getCommands().get(0), instanceOf(IQDirResourceCommand.class)); + IQDirResourceCommand resource = (IQDirResourceCommand) ast.getCommands().get(0); + assertEquals("Unexpected type name", "MyScript", resource.getResourceIdentifier().getText()); + assertEquals("Unexpected initial version", "1.0", resource.getInitialVersion().getVersionString()); + assertEquals("Unexpected file name", "MyScript.qml", resource.getFile().getText()); + assertLocation(0, 26, new Position(1, 0), new Position(1, 26), resource); + } + + @Test + public void testPluginCommand() { + QMLDirectoryParser parser = new QMLDirectoryParser(); + IQDirAST ast = parser.parse(createInputStream("plugin MyPluginLibrary\n"), false); + assertEquals("Unexpected command list size", 1, ast.getCommands().size()); + assertThat("Unexpected command", ast.getCommands().get(0), instanceOf(IQDirPluginCommand.class)); + IQDirPluginCommand plugin = (IQDirPluginCommand) ast.getCommands().get(0); + assertEquals("Unexpected identifier", "MyPluginLibrary", plugin.getName().getText()); + assertEquals("Unexpected path", null, plugin.getPath()); + assertLocation(0, 23, new Position(1, 0), new Position(1, 23), plugin); + } + + @Test + public void testPluginCommandWithPath() { + QMLDirectoryParser parser = new QMLDirectoryParser(); + IQDirAST ast = parser.parse(createInputStream("plugin MyPluginLibrary ./lib/\n"), false); + assertEquals("Unexpected command list size", 1, ast.getCommands().size()); + assertThat("Unexpected command", ast.getCommands().get(0), instanceOf(IQDirPluginCommand.class)); + IQDirPluginCommand plugin = (IQDirPluginCommand) ast.getCommands().get(0); + assertEquals("Unexpected identifier", "MyPluginLibrary", plugin.getName().getText()); + assertEquals("Unexpected path", "./lib/", plugin.getPath().getText()); + assertLocation(0, 30, new Position(1, 0), new Position(1, 30), plugin); + } + + @Test + public void testClassnameCommand() { + QMLDirectoryParser parser = new QMLDirectoryParser(); + IQDirAST ast = parser.parse(createInputStream("classname MyClass\n"), false); + assertEquals("Unexpected command list size", 1, ast.getCommands().size()); + assertThat("Unexpected command", ast.getCommands().get(0), instanceOf(IQDirClassnameCommand.class)); + IQDirClassnameCommand classname = (IQDirClassnameCommand) ast.getCommands().get(0); + assertEquals("Unexpected class name", "MyClass", classname.getIdentifier().getText()); + assertLocation(0, 18, new Position(1, 0), new Position(1, 18), classname); + } + + @Test + public void testTypeInfoCommand() { + QMLDirectoryParser parser = new QMLDirectoryParser(); + IQDirAST ast = parser.parse(createInputStream("typeinfo mymodule.qmltypes\n"), false); + assertEquals("Unexpected command list size", 1, ast.getCommands().size()); + assertThat("Unexpected command", ast.getCommands().get(0), instanceOf(IQDirTypeInfoCommand.class)); + IQDirTypeInfoCommand typeinfo = (IQDirTypeInfoCommand) ast.getCommands().get(0); + assertEquals("Unexpected file name", "mymodule.qmltypes", typeinfo.getFile().getText()); + assertLocation(0, 27, new Position(1, 0), new Position(1, 27), typeinfo); + } + + @Test + public void testDependsCommand() { + QMLDirectoryParser parser = new QMLDirectoryParser(); + IQDirAST ast = parser.parse(createInputStream("depends MyOtherModule 1.0\n"), false); + assertEquals("Unexpected command list size", 1, ast.getCommands().size()); + assertThat("Unexpected command", ast.getCommands().get(0), instanceOf(IQDirDependsCommand.class)); + IQDirDependsCommand depends = (IQDirDependsCommand) ast.getCommands().get(0); + assertEquals("Unexpected module identifier", "MyOtherModule", depends.getModuleIdentifier().getText()); + assertEquals("Unexpected initial version", "1.0", depends.getInitialVersion().getVersionString()); + assertLocation(0, 26, new Position(1, 0), new Position(1, 26), depends); + } + + @Test + public void testDesignerSupportedCommand() { + QMLDirectoryParser parser = new QMLDirectoryParser(); + IQDirAST ast = parser.parse(createInputStream("designersupported\n"), false); + assertEquals("Unexpected command list size", 1, ast.getCommands().size()); + assertThat("Unexpected command", ast.getCommands().get(0), instanceOf(IQDirDesignerSupportedCommand.class)); + assertLocation(0, 18, new Position(1, 0), new Position(1, 18), ast.getCommands().get(0)); + } + + @Test + public void testCommentCommand() { + QMLDirectoryParser parser = new QMLDirectoryParser(); + IQDirAST ast = parser.parse(createInputStream("# This is a comment command\n"), false); + assertEquals("Unexpected command list size", 1, ast.getCommands().size()); + assertThat("Unexpected command", ast.getCommands().get(0), instanceOf(IQDirCommentCommand.class)); + IQDirCommentCommand comment = (IQDirCommentCommand) ast.getCommands().get(0); + assertEquals("Unexpected text", "# This is a comment command", comment.getText()); + } + + @Test + public void testSyntaxErrorCommand() { + QMLDirectoryParser parser = new QMLDirectoryParser(); + IQDirAST ast = parser.parse(createInputStream("classname")); + assertEquals("Unexpected command list size", 1, ast.getCommands().size()); + assertThat("Unexpected command", ast.getCommands().get(0), instanceOf(IQDirSyntaxError.class)); + IQDirSyntaxError err = (IQDirSyntaxError) ast.getCommands().get(0); + assertEquals("Unexpected message", "Unexpected token 'EOF' (1:9)", err.getSyntaxError().getMessage()); + assertLocation(0, 9, new Position(1, 0), new Position(1, 9), err); + } + + @Test + public void testSyntaxErrorCommandIncludesWholeLine() { + QMLDirectoryParser parser = new QMLDirectoryParser(); + IQDirAST ast = parser.parse(createInputStream("classname class extra\n")); + assertEquals("Unexpected command list size", 1, ast.getCommands().size()); + assertThat("Unexpected command", ast.getCommands().get(0), instanceOf(IQDirSyntaxError.class)); + IQDirSyntaxError err = (IQDirSyntaxError) ast.getCommands().get(0); + assertEquals("Unexpected message", "Expected token '\\n' or 'EOF', but saw 'extra' (1:16)", + err.getSyntaxError().getMessage()); + assertLocation(0, 22, new Position(1, 0), new Position(1, 22), err); + } + + @Test + public void testExampleQMLDirFile() { + QMLDirectoryParser parser = new QMLDirectoryParser(); + IQDirAST ast = parser.parse(createInputStream("module QtQuick\n" + + "plugin qtquick2plugin\n" + + "classname QtQuick2Plugin\n" + + "typeinfo plugins.qmltypes\n" + + "designersupported\n")); + + assertEquals("Unexpected command list size", 5, ast.getCommands().size()); + // Module Command (index 0) + assertThat("Unexpected command", ast.getCommands().get(0), instanceOf(IQDirModuleCommand.class)); + IQDirModuleCommand mod = (IQDirModuleCommand) ast.getCommands().get(0); + assertEquals("Unexpected module qualified ID", "QtQuick", mod.getModuleIdentifier().getText()); + // Plugin Command (index 1) + assertThat("Unexpected command", ast.getCommands().get(1), instanceOf(IQDirPluginCommand.class)); + IQDirPluginCommand plugin = (IQDirPluginCommand) ast.getCommands().get(1); + assertEquals("Unexpected plugin identifier", "qtquick2plugin", plugin.getName().getText()); + assertEquals("Unexpected plugin path", null, plugin.getPath()); + // Classname Command (index 2) + assertThat("Unexpected command", ast.getCommands().get(2), instanceOf(IQDirClassnameCommand.class)); + IQDirClassnameCommand classname = (IQDirClassnameCommand) ast.getCommands().get(2); + assertEquals("Unexpected class name", "QtQuick2Plugin", classname.getIdentifier().getText()); + // Type Info Command (index 3) + assertThat("Unexpected command", ast.getCommands().get(3), instanceOf(IQDirTypeInfoCommand.class)); + IQDirTypeInfoCommand typeinfo = (IQDirTypeInfoCommand) ast.getCommands().get(3); + assertEquals("Unexpected type info file name", "plugins.qmltypes", typeinfo.getFile().getText()); + // Designer Supported Command (index 4) + assertThat("Unexpected command", ast.getCommands().get(4), instanceOf(IQDirDesignerSupportedCommand.class)); + } + + @Test + public void testExampleQMLDirFileWithError() { + QMLDirectoryParser parser = new QMLDirectoryParser(); + IQDirAST ast = parser.parse(createInputStream("module QtQuick\n" + + "plugin qtquick2plugin\n" + + "classnames QtQuick2Plugin\n" + + "typeinfo plugins.qmltypes\n" + + "designersupported\n")); + + assertEquals("Unexpected command list size", 5, ast.getCommands().size()); + // Module Command (index 0) + assertThat("Unexpected command", ast.getCommands().get(0), instanceOf(IQDirModuleCommand.class)); + IQDirModuleCommand mod = (IQDirModuleCommand) ast.getCommands().get(0); + assertEquals("Unexpected module qualified ID", "QtQuick", mod.getModuleIdentifier().getText()); + // Plugin Command (index 1) + assertThat("Unexpected command", ast.getCommands().get(1), instanceOf(IQDirPluginCommand.class)); + IQDirPluginCommand plugin = (IQDirPluginCommand) ast.getCommands().get(1); + assertEquals("Unexpected plugin identifier", "qtquick2plugin", plugin.getName().getText()); + assertEquals("Unexpected plugin path", null, plugin.getPath()); + // Syntax Error Command (index 2) + assertThat("Unexpected command", ast.getCommands().get(2), instanceOf(IQDirSyntaxError.class)); + IQDirSyntaxError err = (IQDirSyntaxError) ast.getCommands().get(2); + assertEquals("Unexpected error message", "Unexpected token 'QtQuick2Plugin' (3:11)", err.getSyntaxError().getMessage()); + // Type Info Command (index 3) + assertThat("Unexpected command", ast.getCommands().get(3), instanceOf(IQDirTypeInfoCommand.class)); + IQDirTypeInfoCommand typeinfo = (IQDirTypeInfoCommand) ast.getCommands().get(3); + assertEquals("Unexpected type info file name", "plugins.qmltypes", typeinfo.getFile().getText()); + // Designer Supported Command (index 4) + assertThat("Unexpected command", ast.getCommands().get(4), instanceOf(IQDirDesignerSupportedCommand.class)); + } + + @Test + public void testParseTwoDifferentStreams() { + QMLDirectoryParser parser = new QMLDirectoryParser(); + + // Parse module QtQuick.Controls + IQDirAST ast = parser.parse(createInputStream("module QtQuick.Controls\n"), false); + assertEquals("Unexpected command list size", 1, ast.getCommands().size()); + assertThat("Unexpected command", ast.getCommands().get(0), instanceOf(IQDirModuleCommand.class)); + IQDirModuleCommand mod = (IQDirModuleCommand) ast.getCommands().get(0); + assertEquals("Unexpected qualified ID", "QtQuick.Controls", mod.getModuleIdentifier().getText()); + assertLocation(0, 24, new Position(1, 0), new Position(1, 24), mod); + + // Parse a second module MyModule + ast = parser.parse(createInputStream("module MyModule\n"), false); + assertEquals("Unexpected command list size", 1, ast.getCommands().size()); + assertThat("Unexpected command", ast.getCommands().get(0), instanceOf(IQDirModuleCommand.class)); + mod = (IQDirModuleCommand) ast.getCommands().get(0); + assertEquals("Unexpected qualified ID", "MyModule", mod.getModuleIdentifier().getText()); + assertLocation(0, 16, new Position(1, 0), new Position(1, 16), mod); + } +} diff --git a/qt/org.eclipse.cdt.qt.core/acorn-qml/index.js b/qt/org.eclipse.cdt.qt.core/acorn-qml/index.js index 7f4ad9d5586..6bc36dd58ed 100644 --- a/qt/org.eclipse.cdt.qt.core/acorn-qml/index.js +++ b/qt/org.eclipse.cdt.qt.core/acorn-qml/index.js @@ -1,21 +1,21 @@ -/******************************************************************************* - * Copyright (c) 2015 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 - *******************************************************************************/ -(function (mod) { - if (typeof exports == "object" && typeof module == "object") // CommonJS - return mod(require("./inject.js"), require("acorn")); - if (typeof define == "function" && define.amd) // AMD - return define(["./inject.js", "acorn/dist/acorn"], mod); - mod(acornQMLInjector, acorn); // Plain browser env -})(function (acornQMLInjector, acorn) { - 'use strict'; - - acornQMLInjector.inject(acorn); +/******************************************************************************* + * Copyright (c) 2015 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 + *******************************************************************************/ +(function (mod) { + if (typeof exports == "object" && typeof module == "object") // CommonJS + return mod(require("./inject.js"), require("acorn")); + if (typeof define == "function" && define.amd) // AMD + return define(["./inject.js", "acorn/dist/acorn"], mod); + mod(acornQMLInjector, acorn); // Plain browser env +})(function (acornQMLInjector, acorn) { + 'use strict'; + + acornQMLInjector.inject(acorn); }); \ No newline at end of file diff --git a/qt/org.eclipse.cdt.qt.core/acorn-qml/inject.js b/qt/org.eclipse.cdt.qt.core/acorn-qml/inject.js index 3dc09cb40e1..6e27ab94a83 100644 --- a/qt/org.eclipse.cdt.qt.core/acorn-qml/inject.js +++ b/qt/org.eclipse.cdt.qt.core/acorn-qml/inject.js @@ -1,650 +1,650 @@ -/******************************************************************************* - * Copyright (c) 2015 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 - *******************************************************************************/ -(function (root, mod) { - if (typeof exports === "object" && typeof module === "object") // CommonJS - return mod(exports); - if (typeof define === "function" && define.amd) // AMD - return define(["exports"], mod); - mod(root.acornQMLInjector || (root.acornQMLInjector = {})); // Plain browser env -})(this, function (exports) { - 'use strict'; - - exports.inject = function (acorn) { - // Add the 'mode' option to acorn - acorn.defaultOptions.mode = "qml"; - - // Acorn token types - var tt = acorn.tokTypes; - - // QML token types - var qtt = acorn.qmlTokTypes = {}; - var keywords = acorn.qmlKeywords = {}; - - /* - * Shorthand for defining keywords in the 'keywords' variable with the following - * format: - * keywords[name].isPrimitive : if this is a primitive type - * keywords[name].isQMLContextual : if this is a contextual keyword for QML - * - * Also stores the token's name in qtt._ for easy referencing later. None - * of these keywords will be tokenized and, as such, are allowed to be used in - * JavaScript expressions by acorn. The 'isQMLContextual' boolean in keywords refers - * to those contextual keywords that are also contextual in QML's parser rules such - * as 'color', 'list', 'alias', etc. - */ - function kw(name, options) { - if (options === undefined) - options = {}; - qtt["_" + name] = name; - keywords[name] = {}; - keywords[name].isPrimitive = options.isPrimitive ? true : false; - keywords[name].isQMLContextual = options.isQMLContextual ? true : false; - } - - // QML keywords - kw("import"); - kw("pragma"); - kw("property", { isQMLContextual: true }); - kw("readonly", { isQMLContextual: true }); - kw("signal", { isQMLContextual: true }); - kw("as"); - kw("on", { isQMLContextual: true }); - kw("boolean", { isPrimitive: true }); - kw("double", { isPrimitive: true }); - kw("int", { isPrimitive: true }); - kw("alias", { isPrimitive: true, isQMLContextual: true }); - kw("list", { isPrimitive: true, isQMLContextual: true }); - kw("color", { isPrimitive: true, isQMLContextual: true }); - kw("real", { isPrimitive: true, isQMLContextual: true }); - kw("string", { isPrimitive: true, isQMLContextual: true }); - kw("url", { isPrimitive: true, isQMLContextual: true }); - - // Future reserved words - kw("transient"); - kw("synchronized"); - kw("abstract"); - kw("volatile"); - kw("native"); - kw("goto"); - kw("byte"); - kw("long"); - kw("char"); - kw("short"); - kw("float"); - - // QML parser methods - var pp = acorn.Parser.prototype; - - /* - * Parses a set of QML Header Items (QMLImport or QMLPragma) - */ - pp.qml_parseHeaderItemList = function () { - var node = this.startNode(); - node.items = []; - - var loop = true; - while (loop) { - if (this.isContextual(qtt._import)) { - node.items.push(this.qml_parseImport()); - } else if (this.isContextual(qtt._pragma)) { - node.items.push(this.qml_parsePragma()); - } else { - loop = false; - } - } - - return this.finishNode(node, "QMLHeaderItemList"); - }; - - /* - * Parses a QML Pragma statement of the form: - * 'pragma' - */ - pp.qml_parsePragma = function () { - var node = this.startNode(); - this.expectContextual(qtt._pragma); - node.id = this.qml_parseQualifiedId(true); - this.semicolon(); - return this.finishNode(node, "QMLPragma"); - }; - - /* - * Parses a QML Import of the form: - * 'import' [as ] - * 'import' [as ] - * - * as specified by http://doc.qt.io/qt-5/qtqml-syntax-imports.html - */ - pp.qml_parseImport = function () { - var node = this.startNode(); - - if (!this.eatContextual(qtt._import)) { - this.unexpected(); - } - - switch (this.type) { - case tt.name: - node.module = this.qml_parseModule(); - node.directory = null; - break; - case tt.string: - node.module = null; - node.directory = this.parseLiteral(this.value); - break; - default: - this.unexpected(); - } - - // Parse the qualifier, if any - if (this.isContextual(qtt._as)) { - node.qualifier = this.qml_parseQualifier(); - } - this.semicolon(); - - return this.finishNode(node, "QMLImport"); - }; - - /* - * Parses a QML Module of the form: - * - */ - pp.qml_parseModule = function () { - var node = this.startNode(); - - node.id = this.qml_parseQualifiedId(false); - if (this.type === tt.num) { - node.version = this.qml_parseVersionLiteral(); - } else { - this.unexpected(); - } - - return this.finishNode(node, "QMLModule"); - }; - - /* - * Parses a QML Version Literal which consists of a major and minor - * version separated by a '.' - */ - pp.qml_parseVersionLiteral = function () { - var node = this.startNode(); - - node.value = this.value; - node.raw = this.input.slice(this.start, this.end); - if (!(/(\d+)\.(\d+)/.exec(node.raw))) { - this.raise(this.start, "QML module must specify major and minor version"); - } - this.next(); - - return this.finishNode(node, "QMLVersionLiteral"); - }; - - /* - * Parses a QML Qualifier of the form: - * 'as' - */ - pp.qml_parseQualifier = function () { - var node = this.startNode(); - this.expectContextual(qtt._as); - node.id = this.qml_parseIdent(false); - return this.finishNode(node, "QMLQualifier"); - }; - - /* - * Parses a QML Object Definition of the form: - * { ()* } - * - * http://doc.qt.io/qt-5/qtqml-syntax-basics.html#object-declarations - */ - pp.qml_parseObjectDefinition = function (node, isBinding) { - if (!node) { - node = this.startNode(); - } - if (!node.id) { - node.id = this.qml_parseQualifiedId(false); - } - node.body = this.qml_parseObjectInitializer(); - return this.finishNode(node, isBinding ? "QMLObjectBinding" : "QMLObjectDefinition"); - }; - - /* - * Parses a QML Object Initializer of the form: - * '{' * '}' - */ - pp.qml_parseObjectInitializer = function () { - var node = this.startNode(); - this.expect(tt.braceL); - node.members = []; - while (this.type !== tt.braceR) { - node.members.push(this.qml_parseObjectMember()); - } - this.expect(tt.braceR); - return this.finishNode(node, "QMLObjectInitializer"); - }; - - /* - * Parses a QML Object Member which can be one of the following: - * - a QML Property Binding - * - a QML Property Declaration - * - a QML Property Modifier - * - a QML Object Literal - * - a JavaScript Function Declaration - * - a QML Signal Definition - */ - pp.qml_parseObjectMember = function () { - if (this.type === tt._default || this.isContextual(qtt._readonly) || this.isContextual(qtt._property)) { - return this.qml_parsePropertyDeclaration(); - } else if (this.isContextual(qtt._signal)) { - return this.qml_parseSignalDefinition(); - } else if (this.type === tt._function) { - return this.qml_parseFunctionMember(); - } - return this.qml_parseObjectDefinitionOrPropertyBinding(); - }; - - /* - * Parses a JavaScript function as a member of a QML Object Literal - */ - pp.qml_parseFunctionMember = function () { - var node = this.startNode(); - this.expect(tt._function); - return this.parseFunction(node, true); - }; - - /* - * Parses a QML Object Definition or Property Binding depending on the tokens found. - */ - pp.qml_parseObjectDefinitionOrPropertyBinding = function (node) { - if (!node) { - node = this.startNode(); - } - if (!node.id) { - node.id = this.qml_parseQualifiedId(false); - } - switch (this.type) { - case tt.braceL: - return this.qml_parseObjectDefinition(node); - case tt.colon: - return this.qml_parsePropertyBinding(node); - } - this.unexpected(); - }; - - /* - * Parses a QML Property Modifier of the form: - * 'on' - - * TODO: Call this method in the normal parser once we can do lookahead - * Without lookahead, telling the difference between an Object Declaration, - * Property Binding, and Property Modifier would be too difficult. For now, - * we've implemented a workaround for Object Declarations and Property Bindings - * until Acorn gets lookahead. - */ - pp.qml_parsePropertyModifier = function () { - var node = this.startNode(); - node.kind = this.qml_parseQualifiedID(false); - this.expectContextual(qtt._on); - node.id = this.qml_parseQualifiedID(false); - node.body = this.qml_parseObjectInitializer(); - return this.finishNode(node, "QMLPropertyModifier"); - }; - - /* - * Parses a QML Property Binding of the form: - * - */ - pp.qml_parsePropertyBinding = function (node) { - if (!node) { - node = this.startNode(); - } - if (!node.id) { - node.id = this.qml_parseQualifiedId(false); - } - this.expect(tt.colon); - node.binding = this.qml_parseBinding(); - return this.finishNode(node, "QMLPropertyBinding"); - }; - - /* - * Parses a QML Signal Definition of the form: - * 'signal' [( [',' ]* )]? - */ - pp.qml_parseSignalDefinition = function () { - var node = this.startNode(); - - // Parse as a qualified id in case this is not a signal definition - var signal = this.qml_parseQualifiedId(true); - if (signal.parts.length === 1) { - if (signal.name !== qtt._signal) { - this.unexpected(); - } - - if (this.type === tt.colon || this.type === tt.braceL) { - // This is a property binding or object literal - node.id = signal; - return this.qml_parseObjectDefinitionOrPropertyBinding(node); - } - } else { - // Signal keyword is a qualified ID. This is not a signal definition - node.id = signal; - return this.qml_parseObjectDefinitionOrPropertyBinding(node); - } - - node.id = this.qml_parseIdent(false); - this.qml_parseSignalParams(node); - this.semicolon(); - return this.finishNode(node, "QMLSignalDefinition"); - }; - - /* - * Parses QML Signal Parameters of the form: - * [( [',' ]* )]? - */ - pp.qml_parseSignalParams = function (node) { - node.params = []; - if (this.eat(tt.parenL)) { - if (!this.eat(tt.parenR)) { - do { - var param = this.startNode(); - param.kind = this.qml_parsePropertyType(); - param.id = this.qml_parseIdent(false); - node.params.push(this.finishNode(param, "QMLParameter")); - } while (this.eat(tt.comma)); - this.expect(tt.parenR); - } - } - }; - - /* - * Parses a QML Property Declaration of the form: - * ['default'|'readonly'] 'property' [] - */ - pp.qml_parsePropertyDeclaration = function () { - var node = this.startNode(); - - // Parse 'default' or 'readonly' - node.default = false; - node.readonly = false; - if (this.eat(tt._default)) { - node.default = true; - } else if (this.isContextual(qtt._readonly)) { - // Parse as a qualified id in case this is not a property declaration - var readonly = this.qml_parseQualifiedId(true); - if (readonly.parts.length === 1) { - if (this.type === tt.colon || this.type === tt.braceL) { - // This is a property binding or object literal. - node.id = readonly; - return this.qml_parseObjectDefinitionOrPropertyBinding(node); - } - node.readonly = true; - } else { - // Readonly keyword is a qualified ID. This is not a property declaration. - node.id = readonly; - return this.qml_parseObjectDefinitionOrPropertyBinding(node); - } - } - - // Parse as a qualified id in case this is not a property declaration - var property = this.qml_parseQualifiedId(true); - if (property.parts.length === 1 || node.default || node.readonly) { - if (property.name !== qtt._property) { - this.unexpected(); - } - - if (this.type === tt.colon || this.type === tt.braceL) { - // This is a property binding or object literal. - node.default = undefined; - node.readonly = undefined; - node.id = property; - return this.qml_parseObjectDefinitionOrPropertyBinding(node); - } - } else { - // Property keyword is a qualified ID. This is not a property declaration. - node.default = undefined; - node.readonly = undefined; - node.id = property; - return this.qml_parseObjectDefinitionOrPropertyBinding(node); - } - - node.kind = this.qml_parsePropertyType(); - if (this.value === "<") { - this.expect(tt.relational); // '<' - node.modifier = this.qml_parsePropertyType(); - if (this.value !== ">") { - this.unexpected(); - } - this.expect(tt.relational); // '>' - } - - node.id = this.qml_parseIdent(false); - if (!this.eat(tt.colon)) { - node.binding = null; - this.semicolon(); - } else { - node.binding = this.qml_parseBinding(); - } - - return this.finishNode(node, "QMLPropertyDeclaration"); - }; - - /* - * Parses a QML Property Type of the form: - * - */ - pp.qml_parsePropertyType = function () { - var node = this.startNode(); - node.primitive = false; - if (this.qml_isPrimitiveType(this.type, this.value)) { - node.primitive = true; - } - node.id = this.qml_parseIdent(true); - return this.finishNode(node, "QMLPropertyType"); - }; - - /* - * Parses one of the following possibilities for a QML Property assignment: - * - QML Object Binding - * - QML Array Binding - * - QML Script Binding - */ - pp.qml_parseBinding = function () { - if (this.options.mode === "qmltypes") { - return this.qml_parseScriptBinding(false); - } - - // TODO: solve ambiguity where a QML Object Literal starts with a - // Qualified Id that looks very similar to a MemberExpression in - // JavaScript. For now, we just won't parse statements like: - // test: QMLObject { } - // test: QMLObject.QualifiedId { } - return this.qml_parseScriptBinding(true); - }; - - /* - * Parses a QML Array Binding of the form: - * '[' [ (',' )*] ']' - * - * TODO: call this in the parser once we can use lookahead to distinguish between - * a QML Array Binding and a JavaScript array. - */ - pp.qml_parseArrayBinding = function () { - var node = this.startNode(); - this.expect(tt.bracketL); - node.members = []; - while (!this.eat(tt.bracketR)) { - node.members.push(this.qml_parseObjectDefinition()); - } - return this.finishNode(node, "QMLArrayBinding"); - }; - - /* - * Parses one of the following Script Bindings: - * - Single JavaScript Expression - * - QML Statement Block (A block of JavaScript statements) - */ - pp.qml_parseScriptBinding = function (allowStatementBlock) { - var node = this.startNode(); - node.block = false; - if (allowStatementBlock && this.type === tt.braceL) { - node.block = true; - node.script = this.qml_parseStatementBlock(); - } else { - node.script = this.parseExpression(false); - this.semicolon(); - } - return this.finishNode(node, "QMLScriptBinding"); - }; - - /* - * Parses a QML Statement Block of the form: - * { * } - */ - pp.qml_parseStatementBlock = function () { - var node = this.startNode(); - this.expect(tt.braceL); - node.body = []; - while (!this.eat(tt.braceR)) { - node.body.push(this.parseStatement(true, false)); - } - return this.finishNode(node, "QMLStatementBlock"); - }; - - /* - * Parses a Qualified ID of the form: - * ('.' )* - * - * If 'liberal' is true then this method will allow non-contextual QML keywords as - * identifiers. - */ - pp.qml_parseQualifiedId = function (liberal) { - var node = this.startNode(); - node.parts = []; - node.parts.push(this.qml_parseIdent(liberal)); - while (this.eat(tt.dot)) { - node.parts.push(this.qml_parseIdent(liberal)); - } - - node.name = ""; - for (var i = 0; i < node.parts.length; i++) { - node.name += node.parts[i].name; - if (i < node.parts.length - 1) { - node.name += "."; - } - } - - return this.finishNode(node, "QMLQualifiedID"); - }; - - /* - * Parses an Identifier in a QML Context. That is, this method uses 'isQMLContextual' - * to throw an error if a non-contextual QML keyword is found. - * - * If 'liberal' is true then this method will allow non-contextual QML keywords as - * identifiers. - */ - pp.qml_parseIdent = function (liberal) { - // Check for non-contextual QML keywords - if (!liberal) { - if (!this.qml_isIdent(this.type, this.value)) { - this.unexpected(); - } - } - return this.parseIdent(liberal); - }; - - /* - * Returns whether or not a given token type and name can be a QML Identifier. - * Uses the 'isQMLContextual' boolean of 'keywords' to determine this. - */ - pp.qml_isIdent = function (type, name) { - if (type === tt.name) { - var key; - if ((key = keywords[name])) { - return key.isQMLContextual; - } - return true; - } - return false; - }; - - /* - * Returns whether or not the current token is a QML primitive type and consumes - * it as a side effect if it is. - */ - pp.qml_eatPrimitiveType = function (type, name) { - if (this.qml_isPrimitiveType(type, name)) { - this.next(); - return true; - } - return false; - }; - - /* - * Returns whether or not the current token is a QML primitive type. - */ - pp.qml_isPrimitiveType = function (type, name) { - if (name === "var") { - return true; - } - - if (type === tt.name) { - var key; - if ((key = keywords[name])) { - return key.isPrimitive; - } - } - return false; - }; - - acorn.plugins.qml = function (instance) { - - // Extend acorn's 'parseTopLevel' method - instance.extend("parseTopLevel", function (nextMethod) { - return function (node) { - // Make parsing simpler by only allowing ECMA Version 5 or older ('import' is - // not a keyword in this version of ECMA Script). Qt 5.5 runs with ECMA Script - // 5 anyway, so this makes sense. - if (!this.options.ecmaVersion || this.options.ecmaVersion > 5) { - throw new Error("QML only supports ECMA Script Language Specification 5 or older"); - } - - // Disabled 'qmltypes' mode for now since the normal parser can't parse it anyway - if (this.options.mode === "qml") { - // Force strict mode - this.strict = true; - - // Most of QML's constructs sit at the top-level of the parse tree, - // replacing JavaScripts top-level. Here we are parsing such things - // as the root object literal and header statements of QML. Eventually, - // these rules will delegate down to JavaScript expressions. - node.mode = this.options.mode; - node.headerItemList = this.qml_parseHeaderItemList(); - node.rootObject = null; - if (this.type !== tt.eof) { - node.rootObject = this.qml_parseObjectDefinition(); - } - - if (!this.eat(tt.eof)) { - this.raise(this.pos, "Expected EOF after QML Root Object"); - } - - return this.finishNode(node, "QMLProgram"); - } else if (this.options.mode === "js") { - return nextMethod.call(this, node); - } else { - throw new Error("Unknown mode '" + this.options.mode + "'"); - } - }; - }); - }; - - return acorn; - }; +/******************************************************************************* + * Copyright (c) 2015 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 + *******************************************************************************/ +(function (root, mod) { + if (typeof exports === "object" && typeof module === "object") // CommonJS + return mod(exports); + if (typeof define === "function" && define.amd) // AMD + return define(["exports"], mod); + mod(root.acornQMLInjector || (root.acornQMLInjector = {})); // Plain browser env +})(this, function (exports) { + 'use strict'; + + exports.inject = function (acorn) { + // Add the 'mode' option to acorn + acorn.defaultOptions.mode = "qml"; + + // Acorn token types + var tt = acorn.tokTypes; + + // QML token types + var qtt = acorn.qmlTokTypes = {}; + var keywords = acorn.qmlKeywords = {}; + + /* + * Shorthand for defining keywords in the 'keywords' variable with the following + * format: + * keywords[name].isPrimitive : if this is a primitive type + * keywords[name].isQMLContextual : if this is a contextual keyword for QML + * + * Also stores the token's name in qtt._ for easy referencing later. None + * of these keywords will be tokenized and, as such, are allowed to be used in + * JavaScript expressions by acorn. The 'isQMLContextual' boolean in keywords refers + * to those contextual keywords that are also contextual in QML's parser rules such + * as 'color', 'list', 'alias', etc. + */ + function kw(name, options) { + if (options === undefined) + options = {}; + qtt["_" + name] = name; + keywords[name] = {}; + keywords[name].isPrimitive = options.isPrimitive ? true : false; + keywords[name].isQMLContextual = options.isQMLContextual ? true : false; + } + + // QML keywords + kw("import"); + kw("pragma"); + kw("property", { isQMLContextual: true }); + kw("readonly", { isQMLContextual: true }); + kw("signal", { isQMLContextual: true }); + kw("as"); + kw("on", { isQMLContextual: true }); + kw("boolean", { isPrimitive: true }); + kw("double", { isPrimitive: true }); + kw("int", { isPrimitive: true }); + kw("alias", { isPrimitive: true, isQMLContextual: true }); + kw("list", { isPrimitive: true, isQMLContextual: true }); + kw("color", { isPrimitive: true, isQMLContextual: true }); + kw("real", { isPrimitive: true, isQMLContextual: true }); + kw("string", { isPrimitive: true, isQMLContextual: true }); + kw("url", { isPrimitive: true, isQMLContextual: true }); + + // Future reserved words + kw("transient"); + kw("synchronized"); + kw("abstract"); + kw("volatile"); + kw("native"); + kw("goto"); + kw("byte"); + kw("long"); + kw("char"); + kw("short"); + kw("float"); + + // QML parser methods + var pp = acorn.Parser.prototype; + + /* + * Parses a set of QML Header Items (QMLImport or QMLPragma) + */ + pp.qml_parseHeaderItemList = function () { + var node = this.startNode(); + node.items = []; + + var loop = true; + while (loop) { + if (this.isContextual(qtt._import)) { + node.items.push(this.qml_parseImport()); + } else if (this.isContextual(qtt._pragma)) { + node.items.push(this.qml_parsePragma()); + } else { + loop = false; + } + } + + return this.finishNode(node, "QMLHeaderItemList"); + }; + + /* + * Parses a QML Pragma statement of the form: + * 'pragma' + */ + pp.qml_parsePragma = function () { + var node = this.startNode(); + this.expectContextual(qtt._pragma); + node.id = this.qml_parseQualifiedId(true); + this.semicolon(); + return this.finishNode(node, "QMLPragma"); + }; + + /* + * Parses a QML Import of the form: + * 'import' [as ] + * 'import' [as ] + * + * as specified by http://doc.qt.io/qt-5/qtqml-syntax-imports.html + */ + pp.qml_parseImport = function () { + var node = this.startNode(); + + if (!this.eatContextual(qtt._import)) { + this.unexpected(); + } + + switch (this.type) { + case tt.name: + node.module = this.qml_parseModule(); + node.directory = null; + break; + case tt.string: + node.module = null; + node.directory = this.parseLiteral(this.value); + break; + default: + this.unexpected(); + } + + // Parse the qualifier, if any + if (this.isContextual(qtt._as)) { + node.qualifier = this.qml_parseQualifier(); + } + this.semicolon(); + + return this.finishNode(node, "QMLImport"); + }; + + /* + * Parses a QML Module of the form: + * + */ + pp.qml_parseModule = function () { + var node = this.startNode(); + + node.id = this.qml_parseQualifiedId(false); + if (this.type === tt.num) { + node.version = this.qml_parseVersionLiteral(); + } else { + this.unexpected(); + } + + return this.finishNode(node, "QMLModule"); + }; + + /* + * Parses a QML Version Literal which consists of a major and minor + * version separated by a '.' + */ + pp.qml_parseVersionLiteral = function () { + var node = this.startNode(); + + node.value = this.value; + node.raw = this.input.slice(this.start, this.end); + if (!(/(\d+)\.(\d+)/.exec(node.raw))) { + this.raise(this.start, "QML module must specify major and minor version"); + } + this.next(); + + return this.finishNode(node, "QMLVersionLiteral"); + }; + + /* + * Parses a QML Qualifier of the form: + * 'as' + */ + pp.qml_parseQualifier = function () { + var node = this.startNode(); + this.expectContextual(qtt._as); + node.id = this.qml_parseIdent(false); + return this.finishNode(node, "QMLQualifier"); + }; + + /* + * Parses a QML Object Definition of the form: + * { ()* } + * + * http://doc.qt.io/qt-5/qtqml-syntax-basics.html#object-declarations + */ + pp.qml_parseObjectDefinition = function (node, isBinding) { + if (!node) { + node = this.startNode(); + } + if (!node.id) { + node.id = this.qml_parseQualifiedId(false); + } + node.body = this.qml_parseObjectInitializer(); + return this.finishNode(node, isBinding ? "QMLObjectBinding" : "QMLObjectDefinition"); + }; + + /* + * Parses a QML Object Initializer of the form: + * '{' * '}' + */ + pp.qml_parseObjectInitializer = function () { + var node = this.startNode(); + this.expect(tt.braceL); + node.members = []; + while (this.type !== tt.braceR) { + node.members.push(this.qml_parseObjectMember()); + } + this.expect(tt.braceR); + return this.finishNode(node, "QMLObjectInitializer"); + }; + + /* + * Parses a QML Object Member which can be one of the following: + * - a QML Property Binding + * - a QML Property Declaration + * - a QML Property Modifier + * - a QML Object Literal + * - a JavaScript Function Declaration + * - a QML Signal Definition + */ + pp.qml_parseObjectMember = function () { + if (this.type === tt._default || this.isContextual(qtt._readonly) || this.isContextual(qtt._property)) { + return this.qml_parsePropertyDeclaration(); + } else if (this.isContextual(qtt._signal)) { + return this.qml_parseSignalDefinition(); + } else if (this.type === tt._function) { + return this.qml_parseFunctionMember(); + } + return this.qml_parseObjectDefinitionOrPropertyBinding(); + }; + + /* + * Parses a JavaScript function as a member of a QML Object Literal + */ + pp.qml_parseFunctionMember = function () { + var node = this.startNode(); + this.expect(tt._function); + return this.parseFunction(node, true); + }; + + /* + * Parses a QML Object Definition or Property Binding depending on the tokens found. + */ + pp.qml_parseObjectDefinitionOrPropertyBinding = function (node) { + if (!node) { + node = this.startNode(); + } + if (!node.id) { + node.id = this.qml_parseQualifiedId(false); + } + switch (this.type) { + case tt.braceL: + return this.qml_parseObjectDefinition(node); + case tt.colon: + return this.qml_parsePropertyBinding(node); + } + this.unexpected(); + }; + + /* + * Parses a QML Property Modifier of the form: + * 'on' + + * TODO: Call this method in the normal parser once we can do lookahead + * Without lookahead, telling the difference between an Object Declaration, + * Property Binding, and Property Modifier would be too difficult. For now, + * we've implemented a workaround for Object Declarations and Property Bindings + * until Acorn gets lookahead. + */ + pp.qml_parsePropertyModifier = function () { + var node = this.startNode(); + node.kind = this.qml_parseQualifiedID(false); + this.expectContextual(qtt._on); + node.id = this.qml_parseQualifiedID(false); + node.body = this.qml_parseObjectInitializer(); + return this.finishNode(node, "QMLPropertyModifier"); + }; + + /* + * Parses a QML Property Binding of the form: + * + */ + pp.qml_parsePropertyBinding = function (node) { + if (!node) { + node = this.startNode(); + } + if (!node.id) { + node.id = this.qml_parseQualifiedId(false); + } + this.expect(tt.colon); + node.binding = this.qml_parseBinding(); + return this.finishNode(node, "QMLPropertyBinding"); + }; + + /* + * Parses a QML Signal Definition of the form: + * 'signal' [( [',' ]* )]? + */ + pp.qml_parseSignalDefinition = function () { + var node = this.startNode(); + + // Parse as a qualified id in case this is not a signal definition + var signal = this.qml_parseQualifiedId(true); + if (signal.parts.length === 1) { + if (signal.name !== qtt._signal) { + this.unexpected(); + } + + if (this.type === tt.colon || this.type === tt.braceL) { + // This is a property binding or object literal + node.id = signal; + return this.qml_parseObjectDefinitionOrPropertyBinding(node); + } + } else { + // Signal keyword is a qualified ID. This is not a signal definition + node.id = signal; + return this.qml_parseObjectDefinitionOrPropertyBinding(node); + } + + node.id = this.qml_parseIdent(false); + this.qml_parseSignalParams(node); + this.semicolon(); + return this.finishNode(node, "QMLSignalDefinition"); + }; + + /* + * Parses QML Signal Parameters of the form: + * [( [',' ]* )]? + */ + pp.qml_parseSignalParams = function (node) { + node.params = []; + if (this.eat(tt.parenL)) { + if (!this.eat(tt.parenR)) { + do { + var param = this.startNode(); + param.kind = this.qml_parsePropertyType(); + param.id = this.qml_parseIdent(false); + node.params.push(this.finishNode(param, "QMLParameter")); + } while (this.eat(tt.comma)); + this.expect(tt.parenR); + } + } + }; + + /* + * Parses a QML Property Declaration of the form: + * ['default'|'readonly'] 'property' [] + */ + pp.qml_parsePropertyDeclaration = function () { + var node = this.startNode(); + + // Parse 'default' or 'readonly' + node.default = false; + node.readonly = false; + if (this.eat(tt._default)) { + node.default = true; + } else if (this.isContextual(qtt._readonly)) { + // Parse as a qualified id in case this is not a property declaration + var readonly = this.qml_parseQualifiedId(true); + if (readonly.parts.length === 1) { + if (this.type === tt.colon || this.type === tt.braceL) { + // This is a property binding or object literal. + node.id = readonly; + return this.qml_parseObjectDefinitionOrPropertyBinding(node); + } + node.readonly = true; + } else { + // Readonly keyword is a qualified ID. This is not a property declaration. + node.id = readonly; + return this.qml_parseObjectDefinitionOrPropertyBinding(node); + } + } + + // Parse as a qualified id in case this is not a property declaration + var property = this.qml_parseQualifiedId(true); + if (property.parts.length === 1 || node.default || node.readonly) { + if (property.name !== qtt._property) { + this.unexpected(); + } + + if (this.type === tt.colon || this.type === tt.braceL) { + // This is a property binding or object literal. + node.default = undefined; + node.readonly = undefined; + node.id = property; + return this.qml_parseObjectDefinitionOrPropertyBinding(node); + } + } else { + // Property keyword is a qualified ID. This is not a property declaration. + node.default = undefined; + node.readonly = undefined; + node.id = property; + return this.qml_parseObjectDefinitionOrPropertyBinding(node); + } + + node.kind = this.qml_parsePropertyType(); + if (this.value === "<") { + this.expect(tt.relational); // '<' + node.modifier = this.qml_parsePropertyType(); + if (this.value !== ">") { + this.unexpected(); + } + this.expect(tt.relational); // '>' + } + + node.id = this.qml_parseIdent(false); + if (!this.eat(tt.colon)) { + node.binding = null; + this.semicolon(); + } else { + node.binding = this.qml_parseBinding(); + } + + return this.finishNode(node, "QMLPropertyDeclaration"); + }; + + /* + * Parses a QML Property Type of the form: + * + */ + pp.qml_parsePropertyType = function () { + var node = this.startNode(); + node.primitive = false; + if (this.qml_isPrimitiveType(this.type, this.value)) { + node.primitive = true; + } + node.id = this.qml_parseIdent(true); + return this.finishNode(node, "QMLPropertyType"); + }; + + /* + * Parses one of the following possibilities for a QML Property assignment: + * - QML Object Binding + * - QML Array Binding + * - QML Script Binding + */ + pp.qml_parseBinding = function () { + if (this.options.mode === "qmltypes") { + return this.qml_parseScriptBinding(false); + } + + // TODO: solve ambiguity where a QML Object Literal starts with a + // Qualified Id that looks very similar to a MemberExpression in + // JavaScript. For now, we just won't parse statements like: + // test: QMLObject { } + // test: QMLObject.QualifiedId { } + return this.qml_parseScriptBinding(true); + }; + + /* + * Parses a QML Array Binding of the form: + * '[' [ (',' )*] ']' + * + * TODO: call this in the parser once we can use lookahead to distinguish between + * a QML Array Binding and a JavaScript array. + */ + pp.qml_parseArrayBinding = function () { + var node = this.startNode(); + this.expect(tt.bracketL); + node.members = []; + while (!this.eat(tt.bracketR)) { + node.members.push(this.qml_parseObjectDefinition()); + } + return this.finishNode(node, "QMLArrayBinding"); + }; + + /* + * Parses one of the following Script Bindings: + * - Single JavaScript Expression + * - QML Statement Block (A block of JavaScript statements) + */ + pp.qml_parseScriptBinding = function (allowStatementBlock) { + var node = this.startNode(); + node.block = false; + if (allowStatementBlock && this.type === tt.braceL) { + node.block = true; + node.script = this.qml_parseStatementBlock(); + } else { + node.script = this.parseExpression(false); + this.semicolon(); + } + return this.finishNode(node, "QMLScriptBinding"); + }; + + /* + * Parses a QML Statement Block of the form: + * { * } + */ + pp.qml_parseStatementBlock = function () { + var node = this.startNode(); + this.expect(tt.braceL); + node.body = []; + while (!this.eat(tt.braceR)) { + node.body.push(this.parseStatement(true, false)); + } + return this.finishNode(node, "QMLStatementBlock"); + }; + + /* + * Parses a Qualified ID of the form: + * ('.' )* + * + * If 'liberal' is true then this method will allow non-contextual QML keywords as + * identifiers. + */ + pp.qml_parseQualifiedId = function (liberal) { + var node = this.startNode(); + node.parts = []; + node.parts.push(this.qml_parseIdent(liberal)); + while (this.eat(tt.dot)) { + node.parts.push(this.qml_parseIdent(liberal)); + } + + node.name = ""; + for (var i = 0; i < node.parts.length; i++) { + node.name += node.parts[i].name; + if (i < node.parts.length - 1) { + node.name += "."; + } + } + + return this.finishNode(node, "QMLQualifiedID"); + }; + + /* + * Parses an Identifier in a QML Context. That is, this method uses 'isQMLContextual' + * to throw an error if a non-contextual QML keyword is found. + * + * If 'liberal' is true then this method will allow non-contextual QML keywords as + * identifiers. + */ + pp.qml_parseIdent = function (liberal) { + // Check for non-contextual QML keywords + if (!liberal) { + if (!this.qml_isIdent(this.type, this.value)) { + this.unexpected(); + } + } + return this.parseIdent(liberal); + }; + + /* + * Returns whether or not a given token type and name can be a QML Identifier. + * Uses the 'isQMLContextual' boolean of 'keywords' to determine this. + */ + pp.qml_isIdent = function (type, name) { + if (type === tt.name) { + var key; + if ((key = keywords[name])) { + return key.isQMLContextual; + } + return true; + } + return false; + }; + + /* + * Returns whether or not the current token is a QML primitive type and consumes + * it as a side effect if it is. + */ + pp.qml_eatPrimitiveType = function (type, name) { + if (this.qml_isPrimitiveType(type, name)) { + this.next(); + return true; + } + return false; + }; + + /* + * Returns whether or not the current token is a QML primitive type. + */ + pp.qml_isPrimitiveType = function (type, name) { + if (name === "var") { + return true; + } + + if (type === tt.name) { + var key; + if ((key = keywords[name])) { + return key.isPrimitive; + } + } + return false; + }; + + acorn.plugins.qml = function (instance) { + + // Extend acorn's 'parseTopLevel' method + instance.extend("parseTopLevel", function (nextMethod) { + return function (node) { + // Make parsing simpler by only allowing ECMA Version 5 or older ('import' is + // not a keyword in this version of ECMA Script). Qt 5.5 runs with ECMA Script + // 5 anyway, so this makes sense. + if (!this.options.ecmaVersion || this.options.ecmaVersion > 5) { + throw new Error("QML only supports ECMA Script Language Specification 5 or older"); + } + + // Disabled 'qmltypes' mode for now since the normal parser can't parse it anyway + if (this.options.mode === "qml") { + // Force strict mode + this.strict = true; + + // Most of QML's constructs sit at the top-level of the parse tree, + // replacing JavaScripts top-level. Here we are parsing such things + // as the root object literal and header statements of QML. Eventually, + // these rules will delegate down to JavaScript expressions. + node.mode = this.options.mode; + node.headerItemList = this.qml_parseHeaderItemList(); + node.rootObject = null; + if (this.type !== tt.eof) { + node.rootObject = this.qml_parseObjectDefinition(); + } + + if (!this.eat(tt.eof)) { + this.raise(this.pos, "Expected EOF after QML Root Object"); + } + + return this.finishNode(node, "QMLProgram"); + } else if (this.options.mode === "js") { + return nextMethod.call(this, node); + } else { + throw new Error("Unknown mode '" + this.options.mode + "'"); + } + }; + }); + }; + + return acorn; + }; }); \ No newline at end of file diff --git a/qt/org.eclipse.cdt.qt.core/acorn-qml/loose/index.js b/qt/org.eclipse.cdt.qt.core/acorn-qml/loose/index.js index 524c15db178..7b0bdc97a36 100644 --- a/qt/org.eclipse.cdt.qt.core/acorn-qml/loose/index.js +++ b/qt/org.eclipse.cdt.qt.core/acorn-qml/loose/index.js @@ -1,21 +1,21 @@ -/******************************************************************************* - * Copyright (c) 2015 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 - *******************************************************************************/ -(function (mod) { - if (typeof exports == "object" && typeof module == "object") // CommonJS - return mod(require("./inject.js"), require("acorn"), require("acorn/dist/acorn_loose")); - if (typeof define == "function" && define.amd) // AMD - return define(["./inject.js", "acorn", "acorn/dist/acorn_loose"], mod); - mod(acornQMLLooseInjector, acorn, acorn); // Plain browser env -})(function (acornQMLLooseInjector, acorn, acorn_loose) { - "use strict"; - - acornQMLLooseInjector.inject(acorn); +/******************************************************************************* + * Copyright (c) 2015 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 + *******************************************************************************/ +(function (mod) { + if (typeof exports == "object" && typeof module == "object") // CommonJS + return mod(require("./inject.js"), require("acorn"), require("acorn/dist/acorn_loose")); + if (typeof define == "function" && define.amd) // AMD + return define(["./inject.js", "acorn", "acorn/dist/acorn_loose"], mod); + mod(acornQMLLooseInjector, acorn, acorn); // Plain browser env +})(function (acornQMLLooseInjector, acorn, acorn_loose) { + "use strict"; + + acornQMLLooseInjector.inject(acorn); }); \ No newline at end of file diff --git a/qt/org.eclipse.cdt.qt.core/acorn-qml/loose/inject.js b/qt/org.eclipse.cdt.qt.core/acorn-qml/loose/inject.js index 0c2e0425834..64959ecb5eb 100644 --- a/qt/org.eclipse.cdt.qt.core/acorn-qml/loose/inject.js +++ b/qt/org.eclipse.cdt.qt.core/acorn-qml/loose/inject.js @@ -1,678 +1,678 @@ -/******************************************************************************* - * Copyright (c) 2015 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 - *******************************************************************************/ - -// This will only be visible globally if we are in a browser environment -var injectQMLLoose; - -(function (root, mod) { - if (typeof exports === "object" && typeof module === "object") // CommonJS - return mod(module.exports); - if (typeof define === "function" && define.amd) // AMD - return define(["exports"], mod); - mod(root.acornQMLLooseInjector || (root.acornQMLLooseInjector = {})); // Plain browser env -})(this, function (exports) { - "use strict"; - - exports.inject = function (acorn) { - // Acorn token types - var tt = acorn.tokTypes; - - // QML token types - var qtt = acorn.qmlTokTypes; - var keywords = acorn.qmlKeywords; - - // QML parser methods - var lp = acorn.LooseParser.prototype; - var pp = acorn.Parser.prototype; - - /* - * Parses a set of QML Header Items (QMLImport or QMLPragma) - */ - lp.qml_parseHeaderItemList = function () { - var node = this.startNode(); - node.items = []; - - var loop = true; - while (loop) { - if (this.isContextual(qtt._import)) { - node.items.push(this.qml_parseImport()); - } else if (this.isContextual(qtt._pragma)) { - node.items.push(this.qml_parsePragma()); - } else { - loop = false; - } - } - - return this.finishNode(node, "QMLHeaderItemList"); - }; - - /* - * Parses a QML Pragma statement of the form: - * 'pragma' - */ - lp.qml_parsePragma = function () { - var node = this.startNode(); - this.expectContextual(qtt._pragma); - node.id = this.qml_parseQualifiedId(true); - this.semicolon(); - return this.finishNode(node, "QMLPragma"); - }; - - /* - * Parses a QML Import of the form: - * 'import' [as ] - * 'import' [as ] - * - * as specified by http://doc.qt.io/qt-5/qtqml-syntax-imports.html - */ - lp.qml_parseImport = function () { - var node = this.startNode(); - this.expectContextual(qtt._import); - - switch (this.tok.type) { - case tt.string: - node.module = null; - node.directory = this.parseExprAtom(); - break; - default: - node.module = this.qml_parseModule(); - node.directory = null; - break; - } - - // Parse the qualifier, if any - if (this.isContextual(qtt._as)) { - node.qualifier = this.qml_parseQualifier(); - } - this.semicolon(); - - return this.finishNode(node, "QMLImport"); - }; - - /* - * Parses a QML Module of the form: - * - */ - lp.qml_parseModule = function () { - var node = this.startNode(); - - node.id = this.qml_parseQualifiedId(false); - node.version = this.qml_parseVersionLiteral(); - - return this.finishNode(node, "QMLModule"); - }; - - /* - * Parses a QML Version Literal which consists of a major and minor - * version separated by a '.' - */ - lp.qml_parseVersionLiteral = function () { - var node = this.startNode(); - - var matches; - if (this.tok.type === tt.num) { - node.raw = this.input.slice(this.tok.start, this.tok.end); - node.value = this.tok.value; - this.next(); - } else { - node.value = 0; - node.raw = "0.0"; - } - - return this.finishNode(node, "QMLVersionLiteral"); - }; - - /* - * Parses a QML Qualifier of the form: - * 'as' - */ - lp.qml_parseQualifier = function () { - var node = this.startNode(); - this.expectContextual(qtt._as); - node.id = this.qml_parseIdent(false); - return this.finishNode(node, "QMLQualifier"); - }; - - /* - * Parses a QML Object Definition of the form: - * { ()* } - * - * http://doc.qt.io/qt-5/qtqml-syntax-basics.html#object-declarations - */ - lp.qml_parseObjectDefinition = function (isBinding) { - var node = this.startNode(); - node.id = this.qml_parseQualifiedId(false); - node.body = this.qml_parseObjectInitializer(); - return this.finishNode(node, isBinding ? "QMLObjectBinding" : "QMLObjectDefinition"); - }; - - /* - * Parses a QML Object Initializer of the form: - * '{' * '}' - */ - lp.qml_parseObjectInitializer = function () { - var node = this.startNode(); - this.pushCx(); - this.expect(tt.braceL); - var blockIndent = this.curIndent, - line = this.curLineStart; - node.members = []; - while (!this.closes(tt.braceR, blockIndent, line, true)) { - var member = this.qml_parseObjectMember(); - if (member) { - node.members.push(member); - } - } - this.popCx(); - this.eat(tt.braceR); - return this.finishNode(node, "QMLObjectInitializer"); - }; - - /* - * Parses a QML Object Member which can be one of the following: - * - a QML Property Binding - * - a QML Property Declaration - * - a QML Property Modifier - * - a QML Object Literal - * - a JavaScript Function Declaration - * - a QML Signal Definition - */ - lp.qml_parseObjectMember = function () { - if (this.tok.type === tt._default || this.isContextual(qtt._readonly) || this.isContextual(qtt._property) || this.qml_isPrimitiveType(this.tok.type, this.tok.value)) { - return this.qml_parsePropertyDeclaration(); - } else if (this.isContextual(qtt._signal)) { - return this.qml_parseSignalDefinition(); - } else if (this.tok.type === tt._function) { - return this.qml_parseFunctionMember(); - } else if (this.qml_isIdent(this.tok.type, this.tok.value) || this.tok.type === tt.dot) { - var la = this.lookAhead(1); - if (this.qml_isIdent(la.type, la.value) && la.value !== qtt._on) { - // Two identifiers in a row means this is most likely a property declaration - // with the 'property' token missing. - return this.qml_parsePropertyDeclaration(); - } else { - return this.qml_parseMemberStartsWithIdentifier() || this.qml_parsePropertyBinding(); - } - } else if (this.tok.type === tt.colon) { - return this.qml_parsePropertyBinding(); - } else if (this.tok.type === tt.braceL) { - return this.qml_parseObjectDefinition(); - } - // ignore the current token if it didn't pass the previous tests - this.next(); - }; - - /* - * Parses a QML Object Member that starts with an identifier. This method solves the - * ambiguities that arise from QML having multiple Object Members that start with - * Qualified IDs as well as the fact that several of its keywords can be used as part - * of these Qualified IDs. - */ - lp.qml_parseMemberStartsWithIdentifier = function () { - // Jump past the potential Qualified ID - var i = 1, - la = this.tok; - if (this.qml_isIdent(la.type, la.value)) { - la = this.lookAhead(i++); - } - while (la.type === tt.dot) { - la = this.lookAhead(i++); - if (this.qml_isIdent(la.type, la.value)) { - la = this.lookAhead(i++); - } - } - - // Check the last lookahead token - switch (la.type) { - case tt.braceL: - return this.qml_parseObjectDefinition(); - case tt.colon: - return this.qml_parsePropertyBinding(); - case tt.name: - if (la.value === qtt._on) { - return this.qml_parsePropertyModifier(); - } - break; - } - return null; - }; - - /* - * Parses a JavaScript function as a member of a QML Object Literal - */ - lp.qml_parseFunctionMember = function () { - var node = this.startNode(); - this.expect(tt._function); - return this.qml_parseFunction(node, true); - }; - - /* - * QML version of 'parseFunction' needed to have proper error tolerant parsing - * for QML member functions versus their JavaScript counterparts. The main - * difference between the two functions is that this implementation will not - * forcefully insert '(' and '{' tokens for the body and parameters. Instead, - * it will silently create an empty parameter list or body and let parsing - * continue normally. - */ - lp.qml_parseFunction = function (node, isStatement) { - this.initFunction(node); - if (this.tok.type === tt.name) node.id = this.parseIdent(); - else if (isStatement) node.id = this.dummyIdent(); - node.params = this.tok.type === tt.parenL ? this.parseFunctionParams() : []; - if (this.tok.type === tt.braceL) { - node.body = this.parseBlock(); - } else { - if (this.options.locations) { - node.body = this.startNodeAt([this.last.end, this.last.loc.end]); - } else { - node.body = this.startNodeAt(this.last.end); - } - node.body.body = []; - this.finishNode(node.body, "BlockStatement"); - } - return this.finishNode(node, isStatement ? "FunctionDeclaration" : "FunctionExpression"); - }; - - /* - * Parses a QML Property Modifier of the form: - * 'on' - */ - lp.qml_parsePropertyModifier = function () { - var node = this.startNode(); - node.kind = this.qml_parseQualifiedId(false); - this.expectContextual(qtt._on); - node.id = this.qml_parseQualifiedId(false); - node.body = this.qml_parseObjectInitializer(); - return this.finishNode(node, "QMLPropertyModifier"); - }; - - /* - * Parses a QML Property of the form: - * - */ - lp.qml_parsePropertyBinding = function () { - var node = this.startNode(); - node.id = this.qml_parseQualifiedId(false); - var start = this.storeCurrentPos(); - this.expect(tt.colon); - node.binding = this.qml_parseBinding(start); - return this.finishNode(node, "QMLPropertyBinding"); - }; - - /* - * Parses a QML Signal Definition of the form: - * 'signal' [( [',' ]* )]? - */ - lp.qml_parseSignalDefinition = function () { - var node = this.startNode(); - - // Check if this is an object literal or property binding first - var objOrBind = this.qml_parseMemberStartsWithIdentifier(); - if (objOrBind) { - return objOrBind; - } - this.expectContextual(qtt._signal); - - node.id = this.qml_parseIdent(false); - this.qml_parseSignalParams(node); - this.semicolon(); - return this.finishNode(node, "QMLSignalDefinition"); - }; - - /* - * Checks if the given node is a dummy identifier - */ - function isDummy(node) { - return node.name === "✖"; - } - - /* - * Parses QML Signal Parameters of the form: - * [( [',' ]* )]? - */ - lp.qml_parseSignalParams = function (node) { - this.pushCx(); - var indent = this.curIndent, - line = this.curLineStart; - node.params = []; - if (this.eat(tt.parenL)) { - while (!this.closes(tt.parenR, indent + 1, line) && this.tok.type !== tt.braceR) { - var param = this.startNode(); - param.kind = this.qml_parsePropertyType(); - - // Break out of an infinite loop where we continously consume dummy ids - if (isDummy(param.kind.id) && this.tok.type !== tt.comma) { - break; - } - - param.id = this.qml_parseIdent(false); - node.params.push(this.finishNode(param, "QMLParameter")); - - // Break out of an infinite loop where we continously consume dummy ids - if (isDummy(param.id) && this.tok.type !== tt.comma) { - break; - } - this.eat(tt.comma); - } - this.popCx(); - if (!this.eat(tt.parenR)) { - // If there is no closing brace, make the node span to the start - // of the next token (this is useful for Tern) - this.last.end = this.tok.start; - if (this.options.locations) this.last.loc.end = this.tok.loc.start; - } - } - }; - - /* - * Parses a QML Property Declaration of the form: - * ['default'|'readonly'] 'property' [] - */ - lp.qml_parsePropertyDeclaration = function () { - var node = this.startNode(); - var objOrBind = null; - - // Parse 'default' or 'readonly' - node.default = false; - node.readonly = false; - if (this.eat(tt._default)) { - node.default = true; - } else if (this.isContextual(qtt._readonly)) { - objOrBind = this.qml_parseMemberStartsWithIdentifier(); - if (objOrBind) { - objOrBind.default = undefined; - objOrBind.readonly = undefined; - return objOrBind; - } - this.expectContextual(qtt._readonly); - node.readonly = true; - } - - if (!node.default && !node.readonly) { - objOrBind = this.qml_parseMemberStartsWithIdentifier(); - if (objOrBind) { - return objOrBind; - } - this.expectContextual(qtt._property); - } else { - this.expectContextual(qtt._property); - } - - - node.kind = this.qml_parsePropertyType(); - if (this.tok.value === "<") { - this.expect(tt.relational); // '<' - node.modifier = this.qml_parsePropertyType(); - this.expect(tt.relational); // '>' - } - - node.id = this.qml_parseIdent(false); - - var start = this.storeCurrentPos(); - if (this.eat(tt.colon)) { - node.binding = this.qml_parseBinding(start); - } else { - node.binding = null; - this.semicolon(); - } - - return this.finishNode(node, "QMLPropertyDeclaration"); - }; - - /* - * Parses a QML Property Type of the form: - * - */ - lp.qml_parsePropertyType = function () { - var node = this.startNode(); - node.primitive = false; - if (this.qml_isPrimitiveType(this.tok.type, this.tok.value)) { - node.primitive = true; - } - node.id = this.qml_parseIdent(true); - return this.finishNode(node, "QMLPropertyType"); - }; - - /* - * Parses one of the following possibilities for a QML Property assignment: - * - QML Object Binding - * - QML Array Binding - * - QML Script Binding - */ - lp.qml_parseBinding = function (start) { - var i, la; - if (this.options.mode === "qmltypes") { - return this.qml_parseScriptBinding(start, false); - } - - if (this.tok.type === tt.braceL) { - return this.qml_parseScriptBinding(start, true); - } else if (this.tok.type === tt.bracketL) { - // Perform look ahead to determine whether this is an expression or - // a QML Array Binding - i = 1; - la = this.lookAhead(i++); - if (la.type === tt.name) { - while (la.type === tt.dot || la.type === tt.name) { - la = this.lookAhead(i++); - } - if (la.type === tt.braceL) { - return this.qml_parseArrayBinding(); - } - } - return this.qml_parseScriptBinding(start, true); - } - // Perform look ahead to determine whether this is an expression or - // a QML Object Literal - i = 1; - la = this.tok; - if (this.qml_isIdent(la.type, la.value)) { - la = this.lookAhead(i++); - } - while (la.type === tt.dot) { - la = this.lookAhead(i++); - if (this.qml_isIdent(la.type, la.value)) { - la = this.lookAhead(i++); - } - } - - if (la.type === tt.braceL) { - return this.qml_parseObjectDefinition(true); - } else { - return this.qml_parseScriptBinding(start, true); - } - }; - - /* - * Parses a QML Array Binding of the form: - * '[' [ (',' )*] ']' - */ - lp.qml_parseArrayBinding = function () { - var node = this.startNode(); - var indent = this.curIndent, - line = this.curLineStart; - this.pushCx(); - this.expect(tt.bracketL); - node.elements = []; - while (!this.closes(tt.bracketR, indent + 1, line) && this.tok.type !== tt.braceR) { - var obj = this.qml_parseObjectDefinition(); - node.elements.push(obj); - - // Break out of an infinite loop where we continously consume dummy ids - if (isDummy(obj.id) && this.tok.type !== tt.comma) { - break; - } - - this.eat(tt.comma); - } - this.popCx(); - if (!this.eat(tt.bracketR)) { - // If there is no closing brace, make the node span to the start - // of the next token (this is useful for Tern) - this.last.end = this.tok.start; - if (this.options.locations) this.last.loc.end = this.tok.loc.start; - } - return this.finishNode(node, "QMLArrayBinding"); - }; - - /* - * Parses one of the following Script Bindings: - * - Single JavaScript Expression - * - QML Statement Block (A block of JavaScript statements) - */ - lp.qml_parseScriptBinding = function (start, allowStatementBlock) { - // Help out Tern a little by starting the Script Binding at the end of - // the colon token (only if we consume invalid syntax). - var node = this.startNodeAt(start); - node.block = false; - if (allowStatementBlock && this.tok.type === tt.braceL) { - node.block = true; - node.script = this.qml_parseStatementBlock(); - } else { - node.script = this.parseExpression(false); - this.semicolon(); - } - - // If this node consumed valid syntax, reset its start position - if (node.script.type !== "Identifier" || node.script.name !== "✖") { - if (node.loc) { - node.loc.start = node.script.loc.start; - } - if (node.range) { - node.range = node.script.range; - } - node.start = node.script.start; - node.end = node.script.end; - } - - return this.finishNode(node, "QMLScriptBinding"); - }; - - /* - * Parses a QML Statement Block of the form: - * { * } - */ - lp.qml_parseStatementBlock = function () { - var node = this.startNode(); - this.pushCx(); - this.expect(tt.braceL); - var blockIndent = this.curIndent, - line = this.curLineStart; - node.body = []; - while (!this.closes(tt.braceR, blockIndent, line, true)) { - node.body.push(this.parseStatement(true, false)); - } - this.popCx(); - this.eat(tt.braceR); - return this.finishNode(node, "QMLStatementBlock"); - }; - - /* - * Parses a Qualified ID of the form: - * ('.' )* - * - * If 'liberal' is true then this method will allow non-contextual QML keywords as - * identifiers. - */ - lp.qml_parseQualifiedId = function (liberal) { - var node = this.startNode(); - node.parts = []; - node.parts.push(this.qml_parseIdent(liberal)); - while (this.eat(tt.dot)) { - node.parts.push(this.qml_parseIdent(liberal)); - } - - node.name = ""; - for (var i = 0; i < node.parts.length; i++) { - node.name += node.parts[i].name; - if (i < node.parts.length - 1) { - node.name += "."; - } - } - - return this.finishNode(node, "QMLQualifiedID"); - }; - - /* - * Parses an Identifier in a QML Context. That is, this method uses 'isQMLContextual' - * to throw an error if a non-contextual QML keyword is found. - * - * If 'liberal' is true then this method will allow non-contextual QML keywords as - * identifiers. - */ - lp.qml_parseIdent = function (liberal) { - // Check for non-contextual QML keywords - if (!liberal) { - if (!this.qml_isIdent(this.tok.type, this.tok.value)) { - return this.dummyIdent(); - } - } - return this.parseIdent(); - }; - - /* - * Checks the next token to see if it matches the given contextual keyword. If the - * contextual keyword was not found, this function looks ahead at the next two tokens - * and jumps ahead if it was found there. Returns whether or not the keyword was found. - */ - lp.expectContextual = function (name) { - if (this.eatContextual(name)) return true; - for (var i = 1; i <= 2; i++) { - if (this.lookAhead(i).type == tt.name && this.lookAhead(i).value === name) { - for (var j = 0; j < i; j++) this.next(); - return true; - } - } - }; - - // Functions left un-changed from the main parser - lp.qml_isIdent = pp.qml_isIdent; - lp.qml_eatPrimitiveType = pp.qml_eatPrimitiveType; - lp.qml_isPrimitiveType = pp.qml_isPrimitiveType; - - acorn.pluginsLoose.qml = function (instance) { - - // Extend acorn's 'parseTopLevel' method - instance.extend("parseTopLevel", function (nextMethod) { - return function () { - // Make parsing simpler by only allowing ECMA Version 5 or older ('import' is - // not a keyword in this version of ECMA Script). Qt 5.5 runs with ECMA Script - // 5 anyway, so this makes sense. - if (!this.options.ecmaVersion || this.options.ecmaVersion > 5) { - throw new Error("QML only supports ECMA Script Language Specification 5 or older"); - } - - if (this.options.mode === "qml" || this.options.mode === "qmltypes") { - // Most of QML's constructs sit at the top-level of the parse tree, - // replacing JavaScripts top-level. Here we are parsing such things - // as the root object literal and header statements of QML. Eventually, - // these rules will delegate down to JavaScript expressions. - var node = this.startNode(); - node.mode = this.options.mode; - node.headerItemList = this.qml_parseHeaderItemList(); - node.rootObject = null; - if (this.tok.type !== tt.eof) { - node.rootObject = this.qml_parseObjectDefinition(); - } - - return this.finishNode(node, "QMLProgram"); - } else if (this.options.mode === "js") { - return nextMethod.call(this); - } else { - throw new Error("Unknown mode '" + this.options.mode + "'"); - } - }; - }); - }; - - return acorn; - }; +/******************************************************************************* + * Copyright (c) 2015 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 + *******************************************************************************/ + +// This will only be visible globally if we are in a browser environment +var injectQMLLoose; + +(function (root, mod) { + if (typeof exports === "object" && typeof module === "object") // CommonJS + return mod(module.exports); + if (typeof define === "function" && define.amd) // AMD + return define(["exports"], mod); + mod(root.acornQMLLooseInjector || (root.acornQMLLooseInjector = {})); // Plain browser env +})(this, function (exports) { + "use strict"; + + exports.inject = function (acorn) { + // Acorn token types + var tt = acorn.tokTypes; + + // QML token types + var qtt = acorn.qmlTokTypes; + var keywords = acorn.qmlKeywords; + + // QML parser methods + var lp = acorn.LooseParser.prototype; + var pp = acorn.Parser.prototype; + + /* + * Parses a set of QML Header Items (QMLImport or QMLPragma) + */ + lp.qml_parseHeaderItemList = function () { + var node = this.startNode(); + node.items = []; + + var loop = true; + while (loop) { + if (this.isContextual(qtt._import)) { + node.items.push(this.qml_parseImport()); + } else if (this.isContextual(qtt._pragma)) { + node.items.push(this.qml_parsePragma()); + } else { + loop = false; + } + } + + return this.finishNode(node, "QMLHeaderItemList"); + }; + + /* + * Parses a QML Pragma statement of the form: + * 'pragma' + */ + lp.qml_parsePragma = function () { + var node = this.startNode(); + this.expectContextual(qtt._pragma); + node.id = this.qml_parseQualifiedId(true); + this.semicolon(); + return this.finishNode(node, "QMLPragma"); + }; + + /* + * Parses a QML Import of the form: + * 'import' [as ] + * 'import' [as ] + * + * as specified by http://doc.qt.io/qt-5/qtqml-syntax-imports.html + */ + lp.qml_parseImport = function () { + var node = this.startNode(); + this.expectContextual(qtt._import); + + switch (this.tok.type) { + case tt.string: + node.module = null; + node.directory = this.parseExprAtom(); + break; + default: + node.module = this.qml_parseModule(); + node.directory = null; + break; + } + + // Parse the qualifier, if any + if (this.isContextual(qtt._as)) { + node.qualifier = this.qml_parseQualifier(); + } + this.semicolon(); + + return this.finishNode(node, "QMLImport"); + }; + + /* + * Parses a QML Module of the form: + * + */ + lp.qml_parseModule = function () { + var node = this.startNode(); + + node.id = this.qml_parseQualifiedId(false); + node.version = this.qml_parseVersionLiteral(); + + return this.finishNode(node, "QMLModule"); + }; + + /* + * Parses a QML Version Literal which consists of a major and minor + * version separated by a '.' + */ + lp.qml_parseVersionLiteral = function () { + var node = this.startNode(); + + var matches; + if (this.tok.type === tt.num) { + node.raw = this.input.slice(this.tok.start, this.tok.end); + node.value = this.tok.value; + this.next(); + } else { + node.value = 0; + node.raw = "0.0"; + } + + return this.finishNode(node, "QMLVersionLiteral"); + }; + + /* + * Parses a QML Qualifier of the form: + * 'as' + */ + lp.qml_parseQualifier = function () { + var node = this.startNode(); + this.expectContextual(qtt._as); + node.id = this.qml_parseIdent(false); + return this.finishNode(node, "QMLQualifier"); + }; + + /* + * Parses a QML Object Definition of the form: + * { ()* } + * + * http://doc.qt.io/qt-5/qtqml-syntax-basics.html#object-declarations + */ + lp.qml_parseObjectDefinition = function (isBinding) { + var node = this.startNode(); + node.id = this.qml_parseQualifiedId(false); + node.body = this.qml_parseObjectInitializer(); + return this.finishNode(node, isBinding ? "QMLObjectBinding" : "QMLObjectDefinition"); + }; + + /* + * Parses a QML Object Initializer of the form: + * '{' * '}' + */ + lp.qml_parseObjectInitializer = function () { + var node = this.startNode(); + this.pushCx(); + this.expect(tt.braceL); + var blockIndent = this.curIndent, + line = this.curLineStart; + node.members = []; + while (!this.closes(tt.braceR, blockIndent, line, true)) { + var member = this.qml_parseObjectMember(); + if (member) { + node.members.push(member); + } + } + this.popCx(); + this.eat(tt.braceR); + return this.finishNode(node, "QMLObjectInitializer"); + }; + + /* + * Parses a QML Object Member which can be one of the following: + * - a QML Property Binding + * - a QML Property Declaration + * - a QML Property Modifier + * - a QML Object Literal + * - a JavaScript Function Declaration + * - a QML Signal Definition + */ + lp.qml_parseObjectMember = function () { + if (this.tok.type === tt._default || this.isContextual(qtt._readonly) || this.isContextual(qtt._property) || this.qml_isPrimitiveType(this.tok.type, this.tok.value)) { + return this.qml_parsePropertyDeclaration(); + } else if (this.isContextual(qtt._signal)) { + return this.qml_parseSignalDefinition(); + } else if (this.tok.type === tt._function) { + return this.qml_parseFunctionMember(); + } else if (this.qml_isIdent(this.tok.type, this.tok.value) || this.tok.type === tt.dot) { + var la = this.lookAhead(1); + if (this.qml_isIdent(la.type, la.value) && la.value !== qtt._on) { + // Two identifiers in a row means this is most likely a property declaration + // with the 'property' token missing. + return this.qml_parsePropertyDeclaration(); + } else { + return this.qml_parseMemberStartsWithIdentifier() || this.qml_parsePropertyBinding(); + } + } else if (this.tok.type === tt.colon) { + return this.qml_parsePropertyBinding(); + } else if (this.tok.type === tt.braceL) { + return this.qml_parseObjectDefinition(); + } + // ignore the current token if it didn't pass the previous tests + this.next(); + }; + + /* + * Parses a QML Object Member that starts with an identifier. This method solves the + * ambiguities that arise from QML having multiple Object Members that start with + * Qualified IDs as well as the fact that several of its keywords can be used as part + * of these Qualified IDs. + */ + lp.qml_parseMemberStartsWithIdentifier = function () { + // Jump past the potential Qualified ID + var i = 1, + la = this.tok; + if (this.qml_isIdent(la.type, la.value)) { + la = this.lookAhead(i++); + } + while (la.type === tt.dot) { + la = this.lookAhead(i++); + if (this.qml_isIdent(la.type, la.value)) { + la = this.lookAhead(i++); + } + } + + // Check the last lookahead token + switch (la.type) { + case tt.braceL: + return this.qml_parseObjectDefinition(); + case tt.colon: + return this.qml_parsePropertyBinding(); + case tt.name: + if (la.value === qtt._on) { + return this.qml_parsePropertyModifier(); + } + break; + } + return null; + }; + + /* + * Parses a JavaScript function as a member of a QML Object Literal + */ + lp.qml_parseFunctionMember = function () { + var node = this.startNode(); + this.expect(tt._function); + return this.qml_parseFunction(node, true); + }; + + /* + * QML version of 'parseFunction' needed to have proper error tolerant parsing + * for QML member functions versus their JavaScript counterparts. The main + * difference between the two functions is that this implementation will not + * forcefully insert '(' and '{' tokens for the body and parameters. Instead, + * it will silently create an empty parameter list or body and let parsing + * continue normally. + */ + lp.qml_parseFunction = function (node, isStatement) { + this.initFunction(node); + if (this.tok.type === tt.name) node.id = this.parseIdent(); + else if (isStatement) node.id = this.dummyIdent(); + node.params = this.tok.type === tt.parenL ? this.parseFunctionParams() : []; + if (this.tok.type === tt.braceL) { + node.body = this.parseBlock(); + } else { + if (this.options.locations) { + node.body = this.startNodeAt([this.last.end, this.last.loc.end]); + } else { + node.body = this.startNodeAt(this.last.end); + } + node.body.body = []; + this.finishNode(node.body, "BlockStatement"); + } + return this.finishNode(node, isStatement ? "FunctionDeclaration" : "FunctionExpression"); + }; + + /* + * Parses a QML Property Modifier of the form: + * 'on' + */ + lp.qml_parsePropertyModifier = function () { + var node = this.startNode(); + node.kind = this.qml_parseQualifiedId(false); + this.expectContextual(qtt._on); + node.id = this.qml_parseQualifiedId(false); + node.body = this.qml_parseObjectInitializer(); + return this.finishNode(node, "QMLPropertyModifier"); + }; + + /* + * Parses a QML Property of the form: + * + */ + lp.qml_parsePropertyBinding = function () { + var node = this.startNode(); + node.id = this.qml_parseQualifiedId(false); + var start = this.storeCurrentPos(); + this.expect(tt.colon); + node.binding = this.qml_parseBinding(start); + return this.finishNode(node, "QMLPropertyBinding"); + }; + + /* + * Parses a QML Signal Definition of the form: + * 'signal' [( [',' ]* )]? + */ + lp.qml_parseSignalDefinition = function () { + var node = this.startNode(); + + // Check if this is an object literal or property binding first + var objOrBind = this.qml_parseMemberStartsWithIdentifier(); + if (objOrBind) { + return objOrBind; + } + this.expectContextual(qtt._signal); + + node.id = this.qml_parseIdent(false); + this.qml_parseSignalParams(node); + this.semicolon(); + return this.finishNode(node, "QMLSignalDefinition"); + }; + + /* + * Checks if the given node is a dummy identifier + */ + function isDummy(node) { + return node.name === "✖"; + } + + /* + * Parses QML Signal Parameters of the form: + * [( [',' ]* )]? + */ + lp.qml_parseSignalParams = function (node) { + this.pushCx(); + var indent = this.curIndent, + line = this.curLineStart; + node.params = []; + if (this.eat(tt.parenL)) { + while (!this.closes(tt.parenR, indent + 1, line) && this.tok.type !== tt.braceR) { + var param = this.startNode(); + param.kind = this.qml_parsePropertyType(); + + // Break out of an infinite loop where we continously consume dummy ids + if (isDummy(param.kind.id) && this.tok.type !== tt.comma) { + break; + } + + param.id = this.qml_parseIdent(false); + node.params.push(this.finishNode(param, "QMLParameter")); + + // Break out of an infinite loop where we continously consume dummy ids + if (isDummy(param.id) && this.tok.type !== tt.comma) { + break; + } + this.eat(tt.comma); + } + this.popCx(); + if (!this.eat(tt.parenR)) { + // If there is no closing brace, make the node span to the start + // of the next token (this is useful for Tern) + this.last.end = this.tok.start; + if (this.options.locations) this.last.loc.end = this.tok.loc.start; + } + } + }; + + /* + * Parses a QML Property Declaration of the form: + * ['default'|'readonly'] 'property' [] + */ + lp.qml_parsePropertyDeclaration = function () { + var node = this.startNode(); + var objOrBind = null; + + // Parse 'default' or 'readonly' + node.default = false; + node.readonly = false; + if (this.eat(tt._default)) { + node.default = true; + } else if (this.isContextual(qtt._readonly)) { + objOrBind = this.qml_parseMemberStartsWithIdentifier(); + if (objOrBind) { + objOrBind.default = undefined; + objOrBind.readonly = undefined; + return objOrBind; + } + this.expectContextual(qtt._readonly); + node.readonly = true; + } + + if (!node.default && !node.readonly) { + objOrBind = this.qml_parseMemberStartsWithIdentifier(); + if (objOrBind) { + return objOrBind; + } + this.expectContextual(qtt._property); + } else { + this.expectContextual(qtt._property); + } + + + node.kind = this.qml_parsePropertyType(); + if (this.tok.value === "<") { + this.expect(tt.relational); // '<' + node.modifier = this.qml_parsePropertyType(); + this.expect(tt.relational); // '>' + } + + node.id = this.qml_parseIdent(false); + + var start = this.storeCurrentPos(); + if (this.eat(tt.colon)) { + node.binding = this.qml_parseBinding(start); + } else { + node.binding = null; + this.semicolon(); + } + + return this.finishNode(node, "QMLPropertyDeclaration"); + }; + + /* + * Parses a QML Property Type of the form: + * + */ + lp.qml_parsePropertyType = function () { + var node = this.startNode(); + node.primitive = false; + if (this.qml_isPrimitiveType(this.tok.type, this.tok.value)) { + node.primitive = true; + } + node.id = this.qml_parseIdent(true); + return this.finishNode(node, "QMLPropertyType"); + }; + + /* + * Parses one of the following possibilities for a QML Property assignment: + * - QML Object Binding + * - QML Array Binding + * - QML Script Binding + */ + lp.qml_parseBinding = function (start) { + var i, la; + if (this.options.mode === "qmltypes") { + return this.qml_parseScriptBinding(start, false); + } + + if (this.tok.type === tt.braceL) { + return this.qml_parseScriptBinding(start, true); + } else if (this.tok.type === tt.bracketL) { + // Perform look ahead to determine whether this is an expression or + // a QML Array Binding + i = 1; + la = this.lookAhead(i++); + if (la.type === tt.name) { + while (la.type === tt.dot || la.type === tt.name) { + la = this.lookAhead(i++); + } + if (la.type === tt.braceL) { + return this.qml_parseArrayBinding(); + } + } + return this.qml_parseScriptBinding(start, true); + } + // Perform look ahead to determine whether this is an expression or + // a QML Object Literal + i = 1; + la = this.tok; + if (this.qml_isIdent(la.type, la.value)) { + la = this.lookAhead(i++); + } + while (la.type === tt.dot) { + la = this.lookAhead(i++); + if (this.qml_isIdent(la.type, la.value)) { + la = this.lookAhead(i++); + } + } + + if (la.type === tt.braceL) { + return this.qml_parseObjectDefinition(true); + } else { + return this.qml_parseScriptBinding(start, true); + } + }; + + /* + * Parses a QML Array Binding of the form: + * '[' [ (',' )*] ']' + */ + lp.qml_parseArrayBinding = function () { + var node = this.startNode(); + var indent = this.curIndent, + line = this.curLineStart; + this.pushCx(); + this.expect(tt.bracketL); + node.elements = []; + while (!this.closes(tt.bracketR, indent + 1, line) && this.tok.type !== tt.braceR) { + var obj = this.qml_parseObjectDefinition(); + node.elements.push(obj); + + // Break out of an infinite loop where we continously consume dummy ids + if (isDummy(obj.id) && this.tok.type !== tt.comma) { + break; + } + + this.eat(tt.comma); + } + this.popCx(); + if (!this.eat(tt.bracketR)) { + // If there is no closing brace, make the node span to the start + // of the next token (this is useful for Tern) + this.last.end = this.tok.start; + if (this.options.locations) this.last.loc.end = this.tok.loc.start; + } + return this.finishNode(node, "QMLArrayBinding"); + }; + + /* + * Parses one of the following Script Bindings: + * - Single JavaScript Expression + * - QML Statement Block (A block of JavaScript statements) + */ + lp.qml_parseScriptBinding = function (start, allowStatementBlock) { + // Help out Tern a little by starting the Script Binding at the end of + // the colon token (only if we consume invalid syntax). + var node = this.startNodeAt(start); + node.block = false; + if (allowStatementBlock && this.tok.type === tt.braceL) { + node.block = true; + node.script = this.qml_parseStatementBlock(); + } else { + node.script = this.parseExpression(false); + this.semicolon(); + } + + // If this node consumed valid syntax, reset its start position + if (node.script.type !== "Identifier" || node.script.name !== "✖") { + if (node.loc) { + node.loc.start = node.script.loc.start; + } + if (node.range) { + node.range = node.script.range; + } + node.start = node.script.start; + node.end = node.script.end; + } + + return this.finishNode(node, "QMLScriptBinding"); + }; + + /* + * Parses a QML Statement Block of the form: + * { * } + */ + lp.qml_parseStatementBlock = function () { + var node = this.startNode(); + this.pushCx(); + this.expect(tt.braceL); + var blockIndent = this.curIndent, + line = this.curLineStart; + node.body = []; + while (!this.closes(tt.braceR, blockIndent, line, true)) { + node.body.push(this.parseStatement(true, false)); + } + this.popCx(); + this.eat(tt.braceR); + return this.finishNode(node, "QMLStatementBlock"); + }; + + /* + * Parses a Qualified ID of the form: + * ('.' )* + * + * If 'liberal' is true then this method will allow non-contextual QML keywords as + * identifiers. + */ + lp.qml_parseQualifiedId = function (liberal) { + var node = this.startNode(); + node.parts = []; + node.parts.push(this.qml_parseIdent(liberal)); + while (this.eat(tt.dot)) { + node.parts.push(this.qml_parseIdent(liberal)); + } + + node.name = ""; + for (var i = 0; i < node.parts.length; i++) { + node.name += node.parts[i].name; + if (i < node.parts.length - 1) { + node.name += "."; + } + } + + return this.finishNode(node, "QMLQualifiedID"); + }; + + /* + * Parses an Identifier in a QML Context. That is, this method uses 'isQMLContextual' + * to throw an error if a non-contextual QML keyword is found. + * + * If 'liberal' is true then this method will allow non-contextual QML keywords as + * identifiers. + */ + lp.qml_parseIdent = function (liberal) { + // Check for non-contextual QML keywords + if (!liberal) { + if (!this.qml_isIdent(this.tok.type, this.tok.value)) { + return this.dummyIdent(); + } + } + return this.parseIdent(); + }; + + /* + * Checks the next token to see if it matches the given contextual keyword. If the + * contextual keyword was not found, this function looks ahead at the next two tokens + * and jumps ahead if it was found there. Returns whether or not the keyword was found. + */ + lp.expectContextual = function (name) { + if (this.eatContextual(name)) return true; + for (var i = 1; i <= 2; i++) { + if (this.lookAhead(i).type == tt.name && this.lookAhead(i).value === name) { + for (var j = 0; j < i; j++) this.next(); + return true; + } + } + }; + + // Functions left un-changed from the main parser + lp.qml_isIdent = pp.qml_isIdent; + lp.qml_eatPrimitiveType = pp.qml_eatPrimitiveType; + lp.qml_isPrimitiveType = pp.qml_isPrimitiveType; + + acorn.pluginsLoose.qml = function (instance) { + + // Extend acorn's 'parseTopLevel' method + instance.extend("parseTopLevel", function (nextMethod) { + return function () { + // Make parsing simpler by only allowing ECMA Version 5 or older ('import' is + // not a keyword in this version of ECMA Script). Qt 5.5 runs with ECMA Script + // 5 anyway, so this makes sense. + if (!this.options.ecmaVersion || this.options.ecmaVersion > 5) { + throw new Error("QML only supports ECMA Script Language Specification 5 or older"); + } + + if (this.options.mode === "qml" || this.options.mode === "qmltypes") { + // Most of QML's constructs sit at the top-level of the parse tree, + // replacing JavaScripts top-level. Here we are parsing such things + // as the root object literal and header statements of QML. Eventually, + // these rules will delegate down to JavaScript expressions. + var node = this.startNode(); + node.mode = this.options.mode; + node.headerItemList = this.qml_parseHeaderItemList(); + node.rootObject = null; + if (this.tok.type !== tt.eof) { + node.rootObject = this.qml_parseObjectDefinition(); + } + + return this.finishNode(node, "QMLProgram"); + } else if (this.options.mode === "js") { + return nextMethod.call(this); + } else { + throw new Error("Unknown mode '" + this.options.mode + "'"); + } + }; + }); + }; + + return acorn; + }; }); \ No newline at end of file diff --git a/qt/org.eclipse.cdt.qt.core/acorn-qml/package.json b/qt/org.eclipse.cdt.qt.core/acorn-qml/package.json index 1a452cba41a..12ed66314d6 100644 --- a/qt/org.eclipse.cdt.qt.core/acorn-qml/package.json +++ b/qt/org.eclipse.cdt.qt.core/acorn-qml/package.json @@ -1,12 +1,12 @@ -{ - "name": "acorn-qml", - "description": "QML Parser", - "license": "EPL-1.0", - "version": "0.0.0", - "scripts": { - "test": "node test/run.js" - }, - "dependencies": { - "acorn": "^2.6.4" - } +{ + "name": "acorn-qml", + "description": "QML Parser", + "license": "EPL-1.0", + "version": "0.0.0", + "scripts": { + "test": "node test/run.js" + }, + "dependencies": { + "acorn": "^2.6.4" + } } \ No newline at end of file diff --git a/qt/org.eclipse.cdt.qt.core/acorn-qml/test/driver.js b/qt/org.eclipse.cdt.qt.core/acorn-qml/test/driver.js index 8c5fdcc9ffd..bee02325c5b 100644 --- a/qt/org.eclipse.cdt.qt.core/acorn-qml/test/driver.js +++ b/qt/org.eclipse.cdt.qt.core/acorn-qml/test/driver.js @@ -1,113 +1,113 @@ -/******************************************************************************* - * Copyright (c) 2015 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 - *******************************************************************************/ -"use strict"; - -var tests = []; - -exports.test = function(code, ast, options) { - tests.push({code: code, ast: ast, options: options}); -}; -exports.testFail = function(code, message, options) { - tests.push({code: code, error: message, options: options}); -}; -exports.testAssert = function(code, assert, options) { - tests.push({code: code, assert: assert, options: options}); -}; - -exports.runTests = function(config, callback) { - var parse = config.parse; - var opts = config.options || {}; - - for (var i = 0; i < tests.length; ++i) { - var test = tests[i]; - if (config.filter && !config.filter(test)) continue; - try { - var testOpts = test.options || {locations: true}; - for (var opt in opts) { - testOpts[opt] = opts[opt]; - } - var expected = {}; - if ((expected.onComment = testOpts.onComment)) { - testOpts.onComment = []; - } - if ((expected.onToken = testOpts.onToken)) { - testOpts.onToken = []; - } - testOpts.plugins = { qml: true }; - testOpts.pluginsLoose = { qml: true }; - var ast = parse(test.code, testOpts); - if (test.error) { - if (config.loose) { - callback("ok", test.code); - } else { - callback("fail", test.code, "Expected error message: " + test.error + "\nBut parsing succeeded."); - } - } - else if (test.assert) { - var error = test.assert(ast); - if (error) callback("fail", test.code, - "\n Assertion failed:\n " + error); - else callback("ok", test.code); - } else { - var mis = misMatch(test.ast, ast); - for (var name in expected) { - if (mis) break; - if (expected[name]) { - mis = misMatch(expected[name], testOpts[name]); - testOpts[name] = expected[name]; - } - } - if (mis) callback("fail", test.code, mis); - else callback("ok", test.code); - } - } catch(e) { - if (!(e instanceof SyntaxError || e instanceof Error)) { - throw e; - } - if (test.error) { - if (e.message == test.error) callback("ok", test.code); - else callback("fail", test.code, - "Expected error message: " + test.error + "\nGot error message: " + e.message); - } else { - callback("error", test.code, e.stack || e.toString()); - } - } - } -}; - -function ppJSON(v) { return v instanceof RegExp ? v.toString() : JSON.stringify(v, null, 2); } -function addPath(str, pt) { - if (str.charAt(str.length-1) == ")") - return str.slice(0, str.length-1) + "/" + pt + ")"; - return str + " (" + pt + ")"; -} - -var misMatch = exports.misMatch = function(exp, act) { - var mis = null; - if (!exp || !act || (typeof exp != "object") || (typeof act != "object")) { - if (exp !== act) return ppJSON(exp) + " !== " + ppJSON(act); - } else if (exp instanceof RegExp || act instanceof RegExp) { - var left = ppJSON(exp), right = ppJSON(act); - if (left !== right) return left + " !== " + right; - } else if (exp.splice) { - if (!act.slice) return ppJSON(exp) + " != " + ppJSON(act); - if (act.length != exp.length) return "array length mismatch " + exp.length + " != " + act.length; - for (var i = 0; i < act.length; ++i) { - mis = misMatch(exp[i], act[i]); - if (mis) return addPath(mis, i); - } - } else { - for (var prop in exp) { - mis = misMatch(exp[prop], act[prop]); - if (mis) return addPath(mis, prop); - } - } +/******************************************************************************* + * Copyright (c) 2015 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 + *******************************************************************************/ +"use strict"; + +var tests = []; + +exports.test = function(code, ast, options) { + tests.push({code: code, ast: ast, options: options}); +}; +exports.testFail = function(code, message, options) { + tests.push({code: code, error: message, options: options}); +}; +exports.testAssert = function(code, assert, options) { + tests.push({code: code, assert: assert, options: options}); +}; + +exports.runTests = function(config, callback) { + var parse = config.parse; + var opts = config.options || {}; + + for (var i = 0; i < tests.length; ++i) { + var test = tests[i]; + if (config.filter && !config.filter(test)) continue; + try { + var testOpts = test.options || {locations: true}; + for (var opt in opts) { + testOpts[opt] = opts[opt]; + } + var expected = {}; + if ((expected.onComment = testOpts.onComment)) { + testOpts.onComment = []; + } + if ((expected.onToken = testOpts.onToken)) { + testOpts.onToken = []; + } + testOpts.plugins = { qml: true }; + testOpts.pluginsLoose = { qml: true }; + var ast = parse(test.code, testOpts); + if (test.error) { + if (config.loose) { + callback("ok", test.code); + } else { + callback("fail", test.code, "Expected error message: " + test.error + "\nBut parsing succeeded."); + } + } + else if (test.assert) { + var error = test.assert(ast); + if (error) callback("fail", test.code, + "\n Assertion failed:\n " + error); + else callback("ok", test.code); + } else { + var mis = misMatch(test.ast, ast); + for (var name in expected) { + if (mis) break; + if (expected[name]) { + mis = misMatch(expected[name], testOpts[name]); + testOpts[name] = expected[name]; + } + } + if (mis) callback("fail", test.code, mis); + else callback("ok", test.code); + } + } catch(e) { + if (!(e instanceof SyntaxError || e instanceof Error)) { + throw e; + } + if (test.error) { + if (e.message == test.error) callback("ok", test.code); + else callback("fail", test.code, + "Expected error message: " + test.error + "\nGot error message: " + e.message); + } else { + callback("error", test.code, e.stack || e.toString()); + } + } + } +}; + +function ppJSON(v) { return v instanceof RegExp ? v.toString() : JSON.stringify(v, null, 2); } +function addPath(str, pt) { + if (str.charAt(str.length-1) == ")") + return str.slice(0, str.length-1) + "/" + pt + ")"; + return str + " (" + pt + ")"; +} + +var misMatch = exports.misMatch = function(exp, act) { + var mis = null; + if (!exp || !act || (typeof exp != "object") || (typeof act != "object")) { + if (exp !== act) return ppJSON(exp) + " !== " + ppJSON(act); + } else if (exp instanceof RegExp || act instanceof RegExp) { + var left = ppJSON(exp), right = ppJSON(act); + if (left !== right) return left + " !== " + right; + } else if (exp.splice) { + if (!act.slice) return ppJSON(exp) + " != " + ppJSON(act); + if (act.length != exp.length) return "array length mismatch " + exp.length + " != " + act.length; + for (var i = 0; i < act.length; ++i) { + mis = misMatch(exp[i], act[i]); + if (mis) return addPath(mis, i); + } + } else { + for (var prop in exp) { + mis = misMatch(exp[prop], act[prop]); + if (mis) return addPath(mis, prop); + } + } }; \ No newline at end of file diff --git a/qt/org.eclipse.cdt.qt.core/acorn-qml/test/run.js b/qt/org.eclipse.cdt.qt.core/acorn-qml/test/run.js index 07816ecda7d..dab4c8d4daa 100644 --- a/qt/org.eclipse.cdt.qt.core/acorn-qml/test/run.js +++ b/qt/org.eclipse.cdt.qt.core/acorn-qml/test/run.js @@ -1,114 +1,114 @@ -/******************************************************************************* - * Copyright (c) 2015 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 - *******************************************************************************/ -"use strict"; - -// Get the driver and test code -var driver = require("./driver.js"); -require("./tests-qml.js"); - -// Get and inject the QML plugin into Acorn -var acorn = require("acorn"); -require("acorn/dist/acorn_loose"); -require(".."); -require("../loose"); - -function group(name) { - if (typeof console === "object" && console.group) { - console.group(name); - } -} - -function groupEnd() { - if (typeof console === "object" && console.groupEnd) { - console.groupEnd(name); - } -} - -function log(title, message) { - if (typeof console === "object") console.log(title, message); -} - -var stats, modes = { - "Normal QML": { - config: { - parse: acorn.parse, - filter: function (test) { - var opts = test.options || {}; - return opts.normal !== false && opts.qmltypes !== true; - } - } - }, - "Loose QML": { - config: { - parse: acorn.parse_dammit, - filter: function (test) { - var opts = test.options || {}; - return opts.loose !== false && opts.qmltypes !== true; - } - } - }, - "Loose QMLTypes": { - config: { - parse: acorn.parse_dammit, - options: { - mode: "qmltypes" - }, - filter: function (test) { - var opts = test.options || {}; - return opts.loose !== false && opts.qmltypes !== false; - } - } - } -}; - -function report(state, code, message) { - if (state != "ok") {++stats.failed; log(code, message);} - ++stats.testsRun; -} - -group("Errors"); - -for (var name in modes) { - group(name); - var mode = modes[name]; - stats = mode.stats = {testsRun: 0, failed: 0}; - var t0 = +new Date(); - driver.runTests(mode.config, report); - mode.stats.duration = +new Date() - t0; - groupEnd(); -} - -groupEnd(); - -function outputStats(name, stats) { - log(name + ":", stats.testsRun + " tests run in " + stats.duration + "ms; " + - (stats.failed ? stats.failed + " failures." : "all passed.")); -} - -var total = {testsRun: 0, failed: 0, duration: 0}; - -group("Stats"); - -for (var name in modes) { - var stats = modes[name].stats; - outputStats(name + " parser", stats); - for (var key in stats) total[key] += stats[key]; -} - -outputStats("Total", total); - -groupEnd(); - -if (total.failed && typeof process === "object") { - process.stdout.write("", function () { - process.exit(1); - }); +/******************************************************************************* + * Copyright (c) 2015 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 + *******************************************************************************/ +"use strict"; + +// Get the driver and test code +var driver = require("./driver.js"); +require("./tests-qml.js"); + +// Get and inject the QML plugin into Acorn +var acorn = require("acorn"); +require("acorn/dist/acorn_loose"); +require(".."); +require("../loose"); + +function group(name) { + if (typeof console === "object" && console.group) { + console.group(name); + } +} + +function groupEnd() { + if (typeof console === "object" && console.groupEnd) { + console.groupEnd(name); + } +} + +function log(title, message) { + if (typeof console === "object") console.log(title, message); +} + +var stats, modes = { + "Normal QML": { + config: { + parse: acorn.parse, + filter: function (test) { + var opts = test.options || {}; + return opts.normal !== false && opts.qmltypes !== true; + } + } + }, + "Loose QML": { + config: { + parse: acorn.parse_dammit, + filter: function (test) { + var opts = test.options || {}; + return opts.loose !== false && opts.qmltypes !== true; + } + } + }, + "Loose QMLTypes": { + config: { + parse: acorn.parse_dammit, + options: { + mode: "qmltypes" + }, + filter: function (test) { + var opts = test.options || {}; + return opts.loose !== false && opts.qmltypes !== false; + } + } + } +}; + +function report(state, code, message) { + if (state != "ok") {++stats.failed; log(code, message);} + ++stats.testsRun; +} + +group("Errors"); + +for (var name in modes) { + group(name); + var mode = modes[name]; + stats = mode.stats = {testsRun: 0, failed: 0}; + var t0 = +new Date(); + driver.runTests(mode.config, report); + mode.stats.duration = +new Date() - t0; + groupEnd(); +} + +groupEnd(); + +function outputStats(name, stats) { + log(name + ":", stats.testsRun + " tests run in " + stats.duration + "ms; " + + (stats.failed ? stats.failed + " failures." : "all passed.")); +} + +var total = {testsRun: 0, failed: 0, duration: 0}; + +group("Stats"); + +for (var name in modes) { + var stats = modes[name].stats; + outputStats(name + " parser", stats); + for (var key in stats) total[key] += stats[key]; +} + +outputStats("Total", total); + +groupEnd(); + +if (total.failed && typeof process === "object") { + process.stdout.write("", function () { + process.exit(1); + }); } \ No newline at end of file diff --git a/qt/org.eclipse.cdt.qt.core/acorn-qml/test/tests-qml.js b/qt/org.eclipse.cdt.qt.core/acorn-qml/test/tests-qml.js index 4610eb23362..4d2362db130 100644 --- a/qt/org.eclipse.cdt.qt.core/acorn-qml/test/tests-qml.js +++ b/qt/org.eclipse.cdt.qt.core/acorn-qml/test/tests-qml.js @@ -1,4022 +1,4022 @@ -/******************************************************************************* - * Copyright (c) 2015 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 - *******************************************************************************/ -"use strict"; - -var driver = require("./driver.js"); -var test = driver.test; -var testFail = driver.testFail; -var tokTypes = driver.tokTypes; - -testFail('', "QML only supports ECMA Script Language Specification 5 or older", - { locations: true, ecmaVersion: 6, allowReserved: false }); - -test('import QtQuick 2.02', headerItemList([{ - type: "QMLImport", - loc: { - start: { line: 1, column: 0 }, - end: { line: 1, column: 19 } - }, - module: { - type: "QMLModule", - loc: { - start: { line: 1, column: 7 }, - end: { line: 1, column: 19 } - }, - id: { - type: "QMLQualifiedID", - loc: { - start: { line: 1, column: 7 }, - end: { line: 1, column: 14 } - }, - parts: [{ type: "Identifier", name: "QtQuick" }], - name: "QtQuick" - }, - version: { - type: "QMLVersionLiteral", - loc: { - start: { line: 1, column: 15 }, - end: { line: 1, column: 19 } - }, - value: 2.02, - raw: "2.02" - } - } -}])); - -test('import "./file.js"', headerItemList([{ - type: "QMLImport", - loc: { - start: { line: 1, column: 0 }, - end: { line: 1, column: 18 } - }, - directory: { - type: "Literal", - loc: { - start: { line: 1, column: 7 }, - end: { line: 1, column: 18 } - }, - value: "./file.js", - raw: "\"./file.js\"" - } -}])); - -test('import "./file.js" as MyModule', headerItemList([{ - type: "QMLImport", - loc: { - start: { line: 1, column: 0 }, - end: { line: 1, column: 30 } - }, - directory: { - type: "Literal", - loc: { - start: { line: 1, column: 7 }, - end: { line: 1, column: 18 } - }, - value: "./file.js", - raw: "\"./file.js\"" - }, - qualifier: { - type: "QMLQualifier", - loc: { - start: { line: 1, column: 19 }, - end: { line: 1, column: 30 } - }, - id: { - type: "Identifier", - loc: { - start: { line: 1, column: 22 }, - end: { line: 1, column: 30 } - }, - name: "MyModule" - } - } -}])); - -testFail('import QtQuick ver', - "Unexpected token (1:15)", - { locations: true, loose: false }); - -testFail('import QtQuick 0x01', - "QML module must specify major and minor version (1:15)", - { locations: true, loose: false }); - -testFail('import QtQuick 1', - "QML module must specify major and minor version (1:15)", - { locations: true, loose: false }); - -test('import QtQuick 2.2\nimport "./file.js"', headerItemList([ - { - type: "QMLImport", - loc: { - start: { line: 1, column: 0 }, - end: { line: 1, column: 18 } - }, - module: { - type: "QMLModule", - loc: { - start: { line: 1, column: 7 }, - end: { line: 1, column: 18 } - }, - id: { - type: "QMLQualifiedID", - loc: { - start: { line: 1, column: 7 }, - end: { line: 1, column: 14 } - }, - parts: [{ type: "Identifier", name: "QtQuick" }], - name: "QtQuick" - }, - version: { - type: "QMLVersionLiteral", - loc: { - start: { line: 1, column: 15 }, - end: { line: 1, column: 18 } - }, - value: 2.2, - raw: "2.2" - } - } - }, - { - type: "QMLImport", - loc: { - start: { line: 2, column: 0 }, - end: { line: 2, column: 18 } - }, - directory: { - type: "Literal", - loc: { - start: { line: 2, column: 7 }, - end: { line: 2, column: 18 } - }, - value: "./file.js", - raw: "\"./file.js\"" - } - } -])); - -test('import QtQuick 2.2;import "./file.js"', headerItemList([ - { - type: "QMLImport", - loc: { - start: { line: 1, column: 0 }, - end: { line: 1, column: 19 } - }, - module: { - type: "QMLModule", - loc: { - start: { line: 1, column: 7 }, - end: { line: 1, column: 18 } - }, - id: { - type: "QMLQualifiedID", - loc: { - start: { line: 1, column: 7 }, - end: { line: 1, column: 14 } - }, - parts: [{ type: "Identifier", name: "QtQuick" }], - name: "QtQuick" - }, - version: { - type: "QMLVersionLiteral", - loc: { - start: { line: 1, column: 15 }, - end: { line: 1, column: 18 } - }, - value: 2.2, - raw: "2.2" - } - } - }, - { - type: "QMLImport", - loc: { - start: { line: 1, column: 19 }, - end: { line: 1, column: 37 } - }, - directory: { - type: "Literal", - loc: { - start: { line: 1, column: 26 }, - end: { line: 1, column: 37 } - }, - value: "./file.js", - raw: "\"./file.js\"" - } - } -])); - -test('import Module 1.0 as MyModule', headerItemList([ - { - type: "QMLImport", - loc: { - start: { line: 1, column: 0 }, - end: { line: 1, column: 29 } - }, - module: { - type: "QMLModule", - loc: { - start: { line: 1, column: 7 }, - end: { line: 1, column: 17 } - }, - id: { - type: "QMLQualifiedID", - loc: { - start: { line: 1, column: 7 }, - end: { line: 1, column: 13 } - }, - parts: [{ type: "Identifier", name: "Module" }], - name: "Module" - }, - version: { - type: "QMLVersionLiteral", - loc: { - start: { line: 1, column: 14 }, - end: { line: 1, column: 17 } - }, - value: 1, - raw: "1.0" - } - }, - qualifier: { - type: "QMLQualifier", - loc: { - start: { line: 1, column: 18 }, - end: { line: 1, column: 29 } - }, - id: { - type: "Identifier", - loc: { - start: { line: 1, column: 21 }, - end: { line: 1, column: 29 } - }, - name: "MyModule" - } - } - } -])); - -test('import Qualified.Id.Test 1.0', headerItemList([ - { - type: "QMLImport", - loc: { - start: { line: 1, column: 0 }, - end: { line: 1, column: 28 } - }, - module: { - type: "QMLModule", - loc: { - start: { line: 1, column: 7 }, - end: { line: 1, column: 28 } - }, - id: { - type: "QMLQualifiedID", - loc: { - start: { line: 1, column: 7 }, - end: { line: 1, column: 24 } - }, - parts: [ - { type: "Identifier", name: "Qualified" }, - { type: "Identifier", name: "Id" }, - { type: "Identifier", name: "Test" } - ], - name: "Qualified.Id.Test" - }, - version: { - type: "QMLVersionLiteral", - loc: { - start: { line: 1, column: 25 }, - end: { line: 1, column: 28 } - }, - value: 1, - raw: "1.0" - } - } - } -])); - -test('pragma Singleton', headerItemList([ - { - type: "QMLPragma", - loc: { - start: { line: 1, column: 0 }, - end: { line: 1, column: 16 } - }, - id: { - type: "QMLQualifiedID", - loc: { - start: { line: 1, column: 7 }, - end: { line: 1, column: 16 } - }, - parts: [{ type: "Identifier", name: "Singleton" }], - name: "Singleton" - } - } -])); - -test('pragma Singleton\npragma Other', headerItemList([ - { - type: "QMLPragma", - loc: { - start: { line: 1, column: 0 }, - end: { line: 1, column: 16 } - }, - id: { - type: "QMLQualifiedID", - loc: { - start: { line: 1, column: 7 }, - end: { line: 1, column: 16 } - }, - parts: [{ type: "Identifier", name: "Singleton" }], - name: "Singleton" - } - }, - { - type: "QMLPragma", - loc: { - start: { line: 2, column: 0 }, - end: { line: 2, column: 12 } - }, - id: { - type: "QMLQualifiedID", - loc: { - start: { line: 2, column: 7 }, - end: { line: 2, column: 12 } - }, - parts: [{ type: "Identifier", name: "Other" }], - name: "Other" - } - } -])); - -test('pragma Singleton;pragma Other', headerItemList([ - { - type: "QMLPragma", - loc: { - start: { line: 1, column: 0 }, - end: { line: 1, column: 17 } - }, - id: { - type: "QMLQualifiedID", - loc: { - start: { line: 1, column: 7 }, - end: { line: 1, column: 16 } - }, - parts: [{ type: "Identifier", name: "Singleton" }], - name: "Singleton" - } - }, - { - type: "QMLPragma", - loc: { - start: { line: 1, column: 17 }, - end: { line: 1, column: 29 } - }, - id: { - type: "QMLQualifiedID", - loc: { - start: { line: 1, column: 24 }, - end: { line: 1, column: 29 } - }, - parts: [{ type: "Identifier", name: "Other" }], - name: "Other" - } - } -])); - -test('Window {}', rootObject({ - type: "QMLObjectDefinition", - loc: { - start: { line: 1, column: 0 }, - end: { line: 1, column: 9 } - }, - id: { - type: "QMLQualifiedID", - loc: { - start: { line: 1, column: 0 }, - end: { line: 1, column: 6 } - }, - parts: [{ type: "Identifier", name: "Window" }], - name: "Window" - }, - body: { - type: "QMLObjectInitializer", - loc: { - start: { line: 1, column: 7 }, - end: { line: 1, column: 9 } - }, - members: [] - } -})); - -test('QtQuick.Window {}', rootObject({ - type: "QMLObjectDefinition", - loc: { - start: { line: 1, column: 0 }, - end: { line: 1, column: 17 } - }, - id: { - type: "QMLQualifiedID", - loc: { - start: { line: 1, column: 0 }, - end: { line: 1, column: 14 } - }, - parts: [ - { type: "Identifier", name: "QtQuick" }, - { type: "Identifier", name: "Window" } - ], - name: "QtQuick.Window" - }, - body: { - type: "QMLObjectInitializer", - loc: { - start: { line: 1, column: 15 }, - end: { line: 1, column: 17 } - }, - members: [] - } -})); - -test('property {}', rootObject({ - type: "QMLObjectDefinition", - loc: { - start: { line: 1, column: 0 }, - end: { line: 1, column: 11 } - }, - id: { - type: "QMLQualifiedID", - loc: { - start: { line: 1, column: 0 }, - end: { line: 1, column: 8 } - }, - parts: [{ type: "Identifier", name: "property" }], - name: "property" - }, - body: { - type: "QMLObjectInitializer", - loc: { - start: { line: 1, column: 9 }, - end: { line: 1, column: 11 } - }, - members: [] - } -})); - -test('readonly {}', rootObject({ - type: "QMLObjectDefinition", - loc: { - start: { line: 1, column: 0 }, - end: { line: 1, column: 11 } - }, - id: { - type: "QMLQualifiedID", - loc: { - start: { line: 1, column: 0 }, - end: { line: 1, column: 8 } - }, - parts: [{ type: "Identifier", name: "readonly" }], - name: "readonly" - }, - body: { - type: "QMLObjectInitializer", - loc: { - start: { line: 1, column: 9 }, - end: { line: 1, column: 11 } - }, - members: [] - } -})); - -test('signal {}', rootObject({ - type: "QMLObjectDefinition", - loc: { - start: { line: 1, column: 0 }, - end: { line: 1, column: 9 } - }, - id: { - type: "QMLQualifiedID", - loc: { - start: { line: 1, column: 0 }, - end: { line: 1, column: 6 } - }, - parts: [{ type: "Identifier", name: "signal" }], - name: "signal" - }, - body: { - type: "QMLObjectInitializer", - loc: { - start: { line: 1, column: 7 }, - end: { line: 1, column: 9 } - }, - members: [] - } -})); - -test('alias {}', rootObject({ - type: "QMLObjectDefinition", - loc: { - start: { line: 1, column: 0 }, - end: { line: 1, column: 8 } - }, - id: { - type: "QMLQualifiedID", - loc: { - start: { line: 1, column: 0 }, - end: { line: 1, column: 5 } - }, - parts: [{ type: "Identifier", name: "alias" }], - name: "alias" - }, - body: { - type: "QMLObjectInitializer", - loc: { - start: { line: 1, column: 6 }, - end: { line: 1, column: 8 } - }, - members: [] - } -})); - -test('list {}', rootObject({ - type: "QMLObjectDefinition", - loc: { - start: { line: 1, column: 0 }, - end: { line: 1, column: 7 } - }, - id: { - type: "QMLQualifiedID", - loc: { - start: { line: 1, column: 0 }, - end: { line: 1, column: 4 } - }, - parts: [{ type: "Identifier", name: "list" }], - name: "list" - }, - body: { - type: "QMLObjectInitializer", - loc: { - start: { line: 1, column: 5 }, - end: { line: 1, column: 7 } - }, - members: [] - } -})); - -test('color {}', rootObject({ - type: "QMLObjectDefinition", - loc: { - start: { line: 1, column: 0 }, - end: { line: 1, column: 8 } - }, - id: { - type: "QMLQualifiedID", - loc: { - start: { line: 1, column: 0 }, - end: { line: 1, column: 5 } - }, - parts: [{ type: "Identifier", name: "color" }], - name: "color" - }, - body: { - type: "QMLObjectInitializer", - loc: { - start: { line: 1, column: 6 }, - end: { line: 1, column: 8 } - }, - members: [] - } -})); - -test('real {}', rootObject({ - type: "QMLObjectDefinition", - loc: { - start: { line: 1, column: 0 }, - end: { line: 1, column: 7 } - }, - id: { - type: "QMLQualifiedID", - loc: { - start: { line: 1, column: 0 }, - end: { line: 1, column: 4 } - }, - parts: [{ type: "Identifier", name: "real" }], - name: "real" - }, - body: { - type: "QMLObjectInitializer", - loc: { - start: { line: 1, column: 5 }, - end: { line: 1, column: 7 } - }, - members: [] - } -})); - -test('string {}', rootObject({ - type: "QMLObjectDefinition", - loc: { - start: { line: 1, column: 0 }, - end: { line: 1, column: 9 } - }, - id: { - type: "QMLQualifiedID", - loc: { - start: { line: 1, column: 0 }, - end: { line: 1, column: 6 } - }, - parts: [{ type: "Identifier", name: "string" }], - name: "string" - }, - body: { - type: "QMLObjectInitializer", - loc: { - start: { line: 1, column: 7 }, - end: { line: 1, column: 9 } - }, - members: [] - } -})); - -test('url {}', rootObject({ - type: "QMLObjectDefinition", - loc: { - start: { line: 1, column: 0 }, - end: { line: 1, column: 6 } - }, - id: { - type: "QMLQualifiedID", - loc: { - start: { line: 1, column: 0 }, - end: { line: 1, column: 3 } - }, - parts: [{ type: "Identifier", name: "url" }], - name: "url" - }, - body: { - type: "QMLObjectInitializer", - loc: { - start: { line: 1, column: 4 }, - end: { line: 1, column: 6 } - }, - members: [] - } -})); - -test('Window {Button {}}', rootObjectMembers([{ - type: "QMLObjectDefinition", - loc: { - start: { line: 1, column: 8 }, - end: { line: 1, column: 17 } - }, - id: { - type: "QMLQualifiedID", - loc: { - start: { line: 1, column: 8 }, - end: { line: 1, column: 14 } - }, - parts: [{ type: "Identifier", name: "Button" }], - name: "Button" - }, - body: { - type: "QMLObjectInitializer", - loc: { - start: { line: 1, column: 15 }, - end: { line: 1, column: 17 } - }, - members: [] - } -}])); - -test('a{ property {} }', rootObjectMembers([{ - type: "QMLObjectDefinition", - loc: { - start: { line: 1, column: 3 }, - end: { line: 1, column: 14 } - }, - id: { - type: "QMLQualifiedID", - loc: { - start: { line: 1, column: 3 }, - end: { line: 1, column: 11 } - }, - parts: [{ type: "Identifier", name: "property" }], - name: "property" - }, - body: { - type: "QMLObjectInitializer", - loc: { - start: { line: 1, column: 12 }, - end: { line: 1, column: 14 } - }, - members: [] - } -}])); - -test('a{ readonly {} }', rootObjectMembers([{ - type: "QMLObjectDefinition", - loc: { - start: { line: 1, column: 3 }, - end: { line: 1, column: 14 } - }, - id: { - type: "QMLQualifiedID", - loc: { - start: { line: 1, column: 3 }, - end: { line: 1, column: 11 } - }, - parts: [{ type: "Identifier", name: "readonly" }], - name: "readonly" - }, - body: { - type: "QMLObjectInitializer", - loc: { - start: { line: 1, column: 12 }, - end: { line: 1, column: 14 } - }, - members: [] - } -}])); - -test('a{ signal {} }', rootObjectMembers([{ - type: "QMLObjectDefinition", - loc: { - start: { line: 1, column: 3 }, - end: { line: 1, column: 12 } - }, - id: { - type: "QMLQualifiedID", - loc: { - start: { line: 1, column: 3 }, - end: { line: 1, column: 9 } - }, - parts: [{ type: "Identifier", name: "signal" }], - name: "signal" - }, - body: { - type: "QMLObjectInitializer", - loc: { - start: { line: 1, column: 10 }, - end: { line: 1, column: 12 } - }, - members: [] - } -}])); - -testFail('a{ readonly property var as: 3 }', - "Unexpected token (1:25)", - { locations: true, loose: false }); - -test('a{ readonly property var w: 3 }', rootObjectMembers([{ - type: "QMLPropertyDeclaration", - loc: { - start: { line: 1, column: 3 }, - end: { line: 1, column: 29 } - }, - default: false, - readonly: true, - kind: { - type: "QMLPropertyType", - loc: { - start: { line: 1, column: 21 }, - end: { line: 1, column: 24 } - }, - primitive: true, - id: { type: "Identifier", name: "var"} - }, - id: { - type: "Identifier", - loc: { - start: { line: 1, column: 25 }, - end: { line: 1, column: 26 } - }, - name: "w" - }, - binding: { - type: "QMLScriptBinding", - loc: { - start: { line: 1, column: 28 }, - end: { line: 1, column: 29 } - }, - script: { - type: "Literal", - value: 3, - raw: "3" - } - } -}])); - -test('a{ default property var w: 3 }', rootObjectMembers([{ - type: "QMLPropertyDeclaration", - loc: { - start: { line: 1, column: 3 }, - end: { line: 1, column: 28 } - }, - default: true, - readonly: false, - kind: { - type: "QMLPropertyType", - loc: { - start: { line: 1, column: 20 }, - end: { line: 1, column: 23 } - }, - primitive: true, - id: { type: "Identifier", name: "var"} - }, - id: { - type: "Identifier", - loc: { - start: { line: 1, column: 24 }, - end: { line: 1, column: 25 } - }, - name: "w" - }, - binding: { - type: "QMLScriptBinding", - loc: { - start: { line: 1, column: 27 }, - end: { line: 1, column: 28 } - }, - script: { - type: "Literal", - value: 3, - raw: "3" - } - } -}])); - -testFail('a{ property var public: 3 }', - "The keyword 'public' is reserved (1:16)", - { locations: true, loose: false }); - -testFail('a{ property var export: 3 }', - "The keyword 'export' is reserved (1:16)", - { locations: true, loose: false }); - -test('a{ property var w: 3 }', rootObjectMembers([{ - type: "QMLPropertyDeclaration", - loc: { - start: { line: 1, column: 3 }, - end: { line: 1, column: 20 } - }, - default: false, - readonly: false, - kind: { - type: "QMLPropertyType", - loc: { - start: { line: 1, column: 12 }, - end: { line: 1, column: 15 } - }, - primitive: true, - id: { type: "Identifier", name: "var"} - }, - id: { - type: "Identifier", - loc: { - start: { line: 1, column: 16 }, - end: { line: 1, column: 17 } - }, - name: "w" - }, - binding: { - type: "QMLScriptBinding", - loc: { - start: { line: 1, column: 19 }, - end: { line: 1, column: 20 } - }, - script: { - type: "Literal", - value: 3, - raw: "3" - } - } -}])); - -test('a{ property boolean w: 3 }', rootObjectMembers([{ - type: "QMLPropertyDeclaration", - loc: { - start: { line: 1, column: 3 }, - end: { line: 1, column: 24 } - }, - default: false, - readonly: false, - kind: { - type: "QMLPropertyType", - loc: { - start: { line: 1, column: 12 }, - end: { line: 1, column: 19 } - }, - primitive: true, - id: { type: "Identifier", name: "boolean"} - }, - id: { - type: "Identifier", - loc: { - start: { line: 1, column: 20 }, - end: { line: 1, column: 21 } - }, - name: "w" - }, - binding: { - type: "QMLScriptBinding", - loc: { - start: { line: 1, column: 23 }, - end: { line: 1, column: 24 } - }, - script: { - type: "Literal", - value: 3, - raw: "3" - } - } -}])); - -test('a{ property double w: 3 }', rootObjectMembers([{ - type: "QMLPropertyDeclaration", - loc: { - start: { line: 1, column: 3 }, - end: { line: 1, column: 23 } - }, - default: false, - readonly: false, - kind: { - type: "QMLPropertyType", - loc: { - start: { line: 1, column: 12 }, - end: { line: 1, column: 18 } - }, - primitive: true, - id: { type: "Identifier", name: "double"} - }, - id: { - type: "Identifier", - loc: { - start: { line: 1, column: 19 }, - end: { line: 1, column: 20 } - }, - name: "w" - }, - binding: { - type: "QMLScriptBinding", - loc: { - start: { line: 1, column: 22 }, - end: { line: 1, column: 23 } - }, - script: { - type: "Literal", - value: 3, - raw: "3" - } - } -}])); - -test('a{ property int w: 3 }', rootObjectMembers([{ - type: "QMLPropertyDeclaration", - loc: { - start: { line: 1, column: 3 }, - end: { line: 1, column: 20 } - }, - default: false, - readonly: false, - kind: { - type: "QMLPropertyType", - loc: { - start: { line: 1, column: 12 }, - end: { line: 1, column: 15 } - }, - primitive: true, - id: { type: "Identifier", name: "int"} - }, - id: { - type: "Identifier", - loc: { - start: { line: 1, column: 16 }, - end: { line: 1, column: 17 } - }, - name: "w" - }, - binding: { - type: "QMLScriptBinding", - loc: { - start: { line: 1, column: 19 }, - end: { line: 1, column: 20 } - }, - script: { - type: "Literal", - value: 3, - raw: "3" - } - } -}])); - -test('a{ property list w: 3 }', rootObjectMembers([{ - type: "QMLPropertyDeclaration", - loc: { - start: { line: 1, column: 3 }, - end: { line: 1, column: 27 } - }, - default: false, - readonly: false, - kind: { - type: "QMLPropertyType", - loc: { - start: { line: 1, column: 12 }, - end: { line: 1, column: 16 } - }, - primitive: true, - id: { type: "Identifier", name: "list"}, - }, - modifier: { - type: "QMLPropertyType", - loc: { - start: { line: 1, column: 17 }, - end: { line: 1, column: 21 } - }, - primitive: false, - id: { type: "Identifier", name: "Type" } - }, - id: { - type: "Identifier", - loc: { - start: { line: 1, column: 23 }, - end: { line: 1, column: 24 } - }, - name: "w" - }, - binding: { - type: "QMLScriptBinding", - loc: { - start: { line: 1, column: 26 }, - end: { line: 1, column: 27 } - }, - script: { - type: "Literal", - value: 3, - raw: "3" - } - } -}])); - -test('a{ property color w: 3 }', rootObjectMembers([{ - type: "QMLPropertyDeclaration", - loc: { - start: { line: 1, column: 3 }, - end: { line: 1, column: 22 } - }, - default: false, - readonly: false, - kind: { - type: "QMLPropertyType", - loc: { - start: { line: 1, column: 12 }, - end: { line: 1, column: 17 } - }, - primitive: true, - id: { type: "Identifier", name: "color"} - }, - id: { - type: "Identifier", - loc: { - start: { line: 1, column: 18 }, - end: { line: 1, column: 19 } - }, - name: "w" - }, - binding: { - type: "QMLScriptBinding", - loc: { - start: { line: 1, column: 21 }, - end: { line: 1, column: 22 } - }, - script: { - type: "Literal", - value: 3, - raw: "3" - } - } -}])); - -test('a{ property real w: 3 }', rootObjectMembers([{ - type: "QMLPropertyDeclaration", - loc: { - start: { line: 1, column: 3 }, - end: { line: 1, column: 21 } - }, - default: false, - readonly: false, - kind: { - type: "QMLPropertyType", - loc: { - start: { line: 1, column: 12 }, - end: { line: 1, column: 16 } - }, - primitive: true, - id: { type: "Identifier", name: "real"} - }, - id: { - type: "Identifier", - loc: { - start: { line: 1, column: 17 }, - end: { line: 1, column: 18 } - }, - name: "w" - }, - binding: { - type: "QMLScriptBinding", - loc: { - start: { line: 1, column: 20 }, - end: { line: 1, column: 21 } - }, - script: { - type: "Literal", - value: 3, - raw: "3" - } - } -}])); - -test('a{ property string w: 3 }', rootObjectMembers([{ - type: "QMLPropertyDeclaration", - loc: { - start: { line: 1, column: 3 }, - end: { line: 1, column: 23 } - }, - default: false, - readonly: false, - kind: { - type: "QMLPropertyType", - loc: { - start: { line: 1, column: 12 }, - end: { line: 1, column: 18 } - }, - primitive: true, - id: { type: "Identifier", name: "string"} - }, - id: { - type: "Identifier", - loc: { - start: { line: 1, column: 19 }, - end: { line: 1, column: 20 } - }, - name: "w" - }, - binding: { - type: "QMLScriptBinding", - loc: { - start: { line: 1, column: 22 }, - end: { line: 1, column: 23 } - }, - script: { - type: "Literal", - value: 3, - raw: "3" - } - } -}])); - -test('a{ property url w: 3 }', rootObjectMembers([{ - type: "QMLPropertyDeclaration", - loc: { - start: { line: 1, column: 3 }, - end: { line: 1, column: 20 } - }, - default: false, - readonly: false, - kind: { - type: "QMLPropertyType", - loc: { - start: { line: 1, column: 12 }, - end: { line: 1, column: 15 } - }, - primitive: true, - id: { type: "Identifier", name: "url"} - }, - id: { - type: "Identifier", - loc: { - start: { line: 1, column: 16 }, - end: { line: 1, column: 17 } - }, - name: "w" - }, - binding: { - type: "QMLScriptBinding", - loc: { - start: { line: 1, column: 19 }, - end: { line: 1, column: 20 } - }, - script: { - type: "Literal", - value: 3, - raw: "3" - } - } -}])); - - -test('a{ property QtObject w: 3 }', rootObjectMembers([{ - type: "QMLPropertyDeclaration", - loc: { - start: { line: 1, column: 3 }, - end: { line: 1, column: 25 } - }, - default: false, - readonly: false, - kind: { - type: "QMLPropertyType", - loc: { - start: { line: 1, column: 12 }, - end: { line: 1, column: 20 } - }, - primitive: false, - id: { type: "Identifier", name: "QtObject"} - }, - id: { - type: "Identifier", - loc: { - start: { line: 1, column: 21 }, - end: { line: 1, column: 22 } - }, - name: "w" - }, - binding: { - type: "QMLScriptBinding", - loc: { - start: { line: 1, column: 24 }, - end: { line: 1, column: 25 } - }, - script: { - type: "Literal", - value: 3, - raw: "3" - } - } -}])); - -test('a{ property alias w: 3 }', rootObjectMembers([{ - type: "QMLPropertyDeclaration", - loc: { - start: { line: 1, column: 3 }, - end: { line: 1, column: 22 } - }, - default: false, - readonly: false, - kind: { - type: "QMLPropertyType", - loc: { - start: { line: 1, column: 12 }, - end: { line: 1, column: 17 } - }, - primitive: true, - id: { type: "Identifier", name: "alias"} - }, - id: { - type: "Identifier", - loc: { - start: { line: 1, column: 18 }, - end: { line: 1, column: 19 } - }, - name: "w" - }, - binding: { - type: "QMLScriptBinding", - loc: { - start: { line: 1, column: 21 }, - end: { line: 1, column: 22 } - }, - script: { - type: "Literal", - value: 3, - raw: "3" - } - } -}])); - -test('a{ w: 3 }', rootObjectMembers([{ - type: "QMLPropertyBinding", - loc: { - start: { line: 1, column: 3 }, - end: { line: 1, column: 7 } - }, - id: { - type: "QMLQualifiedID", - loc: { - start: { line: 1, column: 3 }, - end: { line: 1, column: 4 } - }, - parts: [{ type: "Identifier", name: "w" }], - name: "w" - }, - binding: { - type: "QMLScriptBinding", - loc: { - start: { line: 1, column: 6 }, - end: { line: 1, column: 7 } - }, - script: { - type: "Literal", - value: 3, - raw: "3" - } - } -}])); - -test('a{ x.y.z: 3 }', rootObjectMembers([{ - type: "QMLPropertyBinding", - loc: { - start: { line: 1, column: 3 }, - end: { line: 1, column: 11 } - }, - id: { - type: "QMLQualifiedID", - loc: { - start: { line: 1, column: 3 }, - end: { line: 1, column: 8 } - }, - parts: [ - { type: "Identifier", name: "x" }, - { type: "Identifier", name: "y" }, - { type: "Identifier", name: "z" } - ], - name: "x.y.z" - }, - binding: { - type: "QMLScriptBinding", - loc: { - start: { line: 1, column: 10 }, - end: { line: 1, column: 11 } - }, - script: { - type: "Literal", - value: 3, - raw: "3" - } - } -}])); - -testFail('a{ import: 3 }', - "Unexpected token (1:3)", - { locations: true, loose: false }); - -testFail('a{ pragma: 3 }', - "Unexpected token (1:3)", - { locations: true, loose: false }); - -testFail('a{ as: 3 }', - "Unexpected token (1:3)", - { locations: true, loose: false }); - -testFail('a{ boolean: 3 }', - "Unexpected token (1:3)", - { locations: true, loose: false }); - -testFail('a{ double: 3 }', - "Unexpected token (1:3)", - { locations: true, loose: false }); - -testFail('a{ int: 3 }', - "Unexpected token (1:3)", - { locations: true, loose: false }); - -test('a{ alias: 3 }', rootObjectMembers([{ - type: "QMLPropertyBinding", - loc: { - start: { line: 1, column: 3 }, - end: { line: 1, column: 11 } - }, - id: { - type: "QMLQualifiedID", - loc: { - start: { line: 1, column: 3 }, - end: { line: 1, column: 8 } - }, - parts: [{ type: "Identifier", name: "alias" }], - name: "alias" - }, - binding: { - type: "QMLScriptBinding", - loc: { - start: { line: 1, column: 10 }, - end: { line: 1, column: 11 } - }, - script: { - type: "Literal", - value: 3, - raw: "3" - } - } -}])); - -test('a{ list: 3 }', rootObjectMembers([{ - type: "QMLPropertyBinding", - loc: { - start: { line: 1, column: 3 }, - end: { line: 1, column: 10 } - }, - id: { - type: "QMLQualifiedID", - loc: { - start: { line: 1, column: 3 }, - end: { line: 1, column: 7 } - }, - parts: [{ type: "Identifier", name: "list" }], - name: "list" - }, - binding: { - type: "QMLScriptBinding", - loc: { - start: { line: 1, column: 9 }, - end: { line: 1, column: 10 } - }, - script: { - type: "Literal", - value: 3, - raw: "3" - } - } -}])); - -test('a{ property: 3 }', rootObjectMembers([{ - type: "QMLPropertyBinding", - loc: { - start: { line: 1, column: 3 }, - end: { line: 1, column: 14 } - }, - id: { - type: "QMLQualifiedID", - loc: { - start: { line: 1, column: 3 }, - end: { line: 1, column: 11 } - }, - parts: [{ type: "Identifier", name: "property" }], - name: "property" - }, - binding: { - type: "QMLScriptBinding", - loc: { - start: { line: 1, column: 13 }, - end: { line: 1, column: 14 } - }, - script: { - type: "Literal", - value: 3, - raw: "3" - } - } -}])); - -test('a{ readonly: 3 }', rootObjectMembers([{ - type: "QMLPropertyBinding", - loc: { - start: { line: 1, column: 3 }, - end: { line: 1, column: 14 } - }, - id: { - type: "QMLQualifiedID", - loc: { - start: { line: 1, column: 3 }, - end: { line: 1, column: 11 } - }, - parts: [{ type: "Identifier", name: "readonly" }], - name: "readonly" - }, - binding: { - type: "QMLScriptBinding", - loc: { - start: { line: 1, column: 13 }, - end: { line: 1, column: 14 } - }, - script: { - type: "Literal", - value: 3, - raw: "3" - } - } -}])); - -test('a{ signal: 3 }', rootObjectMembers([{ - type: "QMLPropertyBinding", - loc: { - start: { line: 1, column: 3 }, - end: { line: 1, column: 12 } - }, - id: { - type: "QMLQualifiedID", - loc: { - start: { line: 1, column: 3 }, - end: { line: 1, column: 9 } - }, - parts: [{ type: "Identifier", name: "signal" }], - name: "signal" - }, - binding: { - type: "QMLScriptBinding", - loc: { - start: { line: 1, column: 11 }, - end: { line: 1, column: 12 } - }, - script: { - type: "Literal", - value: 3, - raw: "3" - } - } -}])); - -test('a{ color: 3 }', rootObjectMembers([{ - type: "QMLPropertyBinding", - loc: { - start: { line: 1, column: 3 }, - end: { line: 1, column: 11 } - }, - id: { - type: "QMLQualifiedID", - loc: { - start: { line: 1, column: 3 }, - end: { line: 1, column: 8 } - }, - parts: [{ type: "Identifier", name: "color" }], - name: "color" - }, - binding: { - type: "QMLScriptBinding", - loc: { - start: { line: 1, column: 10 }, - end: { line: 1, column: 11 } - }, - script: { - type: "Literal", - value: 3, - raw: "3" - } - } -}])); - -test('a{ real: 3 }', rootObjectMembers([{ - type: "QMLPropertyBinding", - loc: { - start: { line: 1, column: 3 }, - end: { line: 1, column: 10 } - }, - id: { - type: "QMLQualifiedID", - loc: { - start: { line: 1, column: 3 }, - end: { line: 1, column: 7 } - }, - parts: [{ type: "Identifier", name: "real" }], - name: "real" - }, - binding: { - type: "QMLScriptBinding", - loc: { - start: { line: 1, column: 9 }, - end: { line: 1, column: 10 } - }, - script: { - type: "Literal", - value: 3, - raw: "3" - } - } -}])); - -test('a{ string: 3 }', rootObjectMembers([{ - type: "QMLPropertyBinding", - loc: { - start: { line: 1, column: 3 }, - end: { line: 1, column: 12 } - }, - id: { - type: "QMLQualifiedID", - loc: { - start: { line: 1, column: 3 }, - end: { line: 1, column: 9 } - }, - parts: [{ type: "Identifier", name: "string" }], - name: "string" - }, - binding: { - type: "QMLScriptBinding", - loc: { - start: { line: 1, column: 11 }, - end: { line: 1, column: 12 } - }, - script: { - type: "Literal", - value: 3, - raw: "3" - } - } -}])); - -test('a{ url: 3 }', rootObjectMembers([{ - type: "QMLPropertyBinding", - loc: { - start: { line: 1, column: 3 }, - end: { line: 1, column: 9 } - }, - id: { - type: "QMLQualifiedID", - loc: { - start: { line: 1, column: 3 }, - end: { line: 1, column: 6 } - }, - parts: [{ type: "Identifier", name: "url" }], - name: "url" - }, - binding: { - type: "QMLScriptBinding", - loc: { - start: { line: 1, column: 8 }, - end: { line: 1, column: 9 } - }, - script: { - type: "Literal", - value: 3, - raw: "3" - } - } -}])); - -test('a{ onClicked: Qt.quit(0) }', rootObjectMembers([{ - type: "QMLPropertyBinding", - loc: { - start: { line: 1, column: 3 }, - end: { line: 1, column: 24 } - }, - id: { - type: "QMLQualifiedID", - loc: { - start: { line: 1, column: 3 }, - end: { line: 1, column: 12 } - }, - parts: [{ type: "Identifier", name: "onClicked" }], - name: "onClicked" - }, - binding: { - type: "QMLScriptBinding", - loc: { - start: { line: 1, column: 14 }, - end: { line: 1, column: 24 } - }, - script: { - type: "CallExpression", - callee: { - type: "MemberExpression", - loc: { - start: { line: 1, column: 14 }, - end: { line: 1, column: 21 } - }, - object: { - type: "Identifier", - loc: { - start: { line: 1, column: 14 }, - end: { line: 1, column: 16 } - }, - name: "Qt" - }, - property: { - type: "Identifier", - loc: { - start: { line: 1, column: 17 }, - end: { line: 1, column: 21 } - }, - name: "quit" - }, - computed: false - }, - arguments: [{ - type: "Literal", - loc: { - start: { line: 1, column: 22 }, - end: { line: 1, column: 23 } - }, - value: 0, - raw: "0" - }] - } - } -}])); - -test('a{b:pragma}', javaScript({ - type: "Identifier", - loc: { - start: { line: 1, column: 4 }, - end: { line: 1, column: 10 } - }, - name: "pragma" -})); - -test('a{b:property}', javaScript({ - type: "Identifier", - loc: { - start: { line: 1, column: 4 }, - end: { line: 1, column: 12 } - }, - name: "property" -})); - -test('a{b:readonly}', javaScript({ - type: "Identifier", - loc: { - start: { line: 1, column: 4 }, - end: { line: 1, column: 12 } - }, - name: "readonly" -})); - -test('a{b:signal}', javaScript({ - type: "Identifier", - loc: { - start: { line: 1, column: 4 }, - end: { line: 1, column: 10 } - }, - name: "signal" -})); - -test('a{b:alias}', javaScript({ - type: "Identifier", - loc: { - start: { line: 1, column: 4 }, - end: { line: 1, column: 9 } - }, - name: "alias" -})); - -test('a{b:list}', javaScript({ - type: "Identifier", - loc: { - start: { line: 1, column: 4 }, - end: { line: 1, column: 8 } - }, - name: "list" -})); - -test('a{b:color}', javaScript({ - type: "Identifier", - loc: { - start: { line: 1, column: 4 }, - end: { line: 1, column: 9 } - }, - name: "color" -})); - -test('a{b:real}', javaScript({ - type: "Identifier", - loc: { - start: { line: 1, column: 4 }, - end: { line: 1, column: 8 } - }, - name: "real" -})); - -test('a{b:string}', javaScript({ - type: "Identifier", - loc: { - start: { line: 1, column: 4 }, - end: { line: 1, column: 10 } - }, - name: "string" -})); - -test('a{b:url}', javaScript({ - type: "Identifier", - loc: { - start: { line: 1, column: 4 }, - end: { line: 1, column: 7 } - }, - name: "url" -})); - -test('a{b:[]}', javaScript({ - type: "ArrayExpression", - loc: { - start: { line: 1, column: 4 }, - end: { line: 1, column: 6 } - }, - elements: [] -})); - -test('a{b:[{}]}', javaScript({ - type: "ArrayExpression", - loc: { - start: { line: 1, column: 4 }, - end: { line: 1, column: 8 } - }, - elements: [{ - type: "ObjectExpression", - loc: { - start: { line: 1, column: 5 }, - end: { line: 1, column: 7 } - }, - }] -})); - -test('a{ function fn() {} }', rootObjectMembers([{ - type: "FunctionDeclaration", - loc: { - start: { line: 1, column: 3 }, - end: { line: 1, column: 19 } - }, - id: { - type: "Identifier", - loc: { - start: { line: 1, column: 12 }, - end: { line: 1, column: 14 } - }, - name: "fn" - }, - params: [], - body: { - type: "BlockStatement", - loc: { - start: { line: 1, column: 17 }, - end: { line: 1, column: 19 } - }, - body: [] - } -}])); - -test('a{ function add(a, b) { return a + b } }', rootObjectMembers([{ - type: "FunctionDeclaration", - loc: { - start: { line: 1, column: 3 }, - end: { line: 1, column: 38 } - }, - id: { - type: "Identifier", - name: "add" - }, - params: [ - { type: "Identifier", name: "a" }, - { type: "Identifier", name: "b" } - ], - body: { - type: "BlockStatement", - loc: { - start: { line: 1, column: 22 }, - end: { line: 1, column: 38 } - }, - body: [{ - type: "ReturnStatement", - argument: { - type: "BinaryExpression", - left: { type: "Identifier", name: "a" }, - operator: "+", - right: { type: "Identifier", name: "b" } - } - }] - } -}])); - -testFail('a{ function () {} }', - "Unexpected token (1:12)", - { locations: true, loose: false }); - -test('a{ signal b }', rootObjectMembers([{ - type: "QMLSignalDefinition", - loc: { - start: { line: 1, column: 3 }, - end: { line: 1, column: 11 } - }, - id: { - type: "Identifier", - loc: { - start: { line: 1, column: 10 }, - end: { line: 1, column: 11 } - }, - name: "b" - }, - params: [] -}])); - -test('a{ signal b () }', rootObjectMembers([{ - type: "QMLSignalDefinition", - loc: { - start: { line: 1, column: 3 }, - end: { line: 1, column: 14 } - }, - id: { - type: "Identifier", - loc: { - start: { line: 1, column: 10 }, - end: { line: 1, column: 11 } - }, - name: "b" - }, - params: [] -}])); - -test('a{ signal b (type param)}', rootObjectMembers([{ - type: "QMLSignalDefinition", - loc: { - start: { line: 1, column: 3 }, - end: { line: 1, column: 24 } - }, - id: { - type: "Identifier", - loc: { - start: { line: 1, column: 10 }, - end: { line: 1, column: 11 } - }, - name: "b" - }, - params: [{ - type: "QMLParameter", - loc: { - start: { line: 1, column: 13 }, - end: { line: 1, column: 23 } - }, - kind: { - type: "QMLPropertyType", - loc: { - start: { line: 1, column: 13 }, - end: { line: 1, column: 17 } - }, - primitive: false, - id: { type: "Identifier", name: "type" } - }, - id: { - type: "Identifier", - loc: { - start: { line: 1, column: 18 }, - end: { line: 1, column: 23 } - }, - name: "param" - } - }] -}])); - -test('a{ signal b (type1 param1, type2 param2, type3 param3)}', rootObjectMembers([{ - type: "QMLSignalDefinition", - loc: { - start: { line: 1, column: 3 }, - end: { line: 1, column: 54 } - }, - id: { - type: "Identifier", - loc: { - start: { line: 1, column: 10 }, - end: { line: 1, column: 11 } - }, - name: "b" - }, - params: [ - { - type: "QMLParameter", - loc: { - start: { line: 1, column: 13 }, - end: { line: 1, column: 25 } - }, - kind: { - type: "QMLPropertyType", - loc: { - start: { line: 1, column: 13 }, - end: { line: 1, column: 18 } - }, - primitive: false, - id: { type: "Identifier", name: "type1" } - }, - id: { - type: "Identifier", - loc: { - start: { line: 1, column: 19 }, - end: { line: 1, column: 25 } - }, - name: "param1" - } - }, - { - type: "QMLParameter", - loc: { - start: { line: 1, column: 27 }, - end: { line: 1, column: 39 } - }, - kind: { - type: "QMLPropertyType", - loc: { - start: { line: 1, column: 27 }, - end: { line: 1, column: 32 } - }, - primitive: false, - id: { type: "Identifier", name: "type2" } - }, - id: { - type: "Identifier", - loc: { - start: { line: 1, column: 33 }, - end: { line: 1, column: 39 } - }, - name: "param2" - } - }, - { - type: "QMLParameter", - loc: { - start: { line: 1, column: 41 }, - end: { line: 1, column: 53 } - }, - kind: { - type: "QMLPropertyType", - loc: { - start: { line: 1, column: 41 }, - end: { line: 1, column: 46 } - }, - primitive: false, - id: { type: "Identifier", name: "type3" } - }, - id: { - type: "Identifier", - loc: { - start: { line: 1, column: 47 }, - end: { line: 1, column: 53 } - }, - name: "param3" - } - } - ] -}])); - -test('a{ id: test }', rootObjectMembers([{ - type: "QMLPropertyBinding", - loc: { - start: { line: 1, column: 3 }, - end: { line: 1, column: 11 } - }, - id: { - type: "QMLQualifiedID", - loc: { - start: { line: 1, column: 3 }, - end: { line: 1, column: 5 } - }, - parts: [{ - type: "Identifier", - loc: { - start: { line: 1, column: 3 }, - end: { line: 1, column: 5 } - }, - name: "id" - }], - name: "id" - }, - binding: { - type: "QMLScriptBinding", - loc: { - start: { line: 1, column: 7 }, - end: { line: 1, column: 11 } - }, - script: { - type: "Identifier", - name: "test" - } - } -}])); - -/* -* Test the base QML Hello World program created by Eclipse CDT. -*/ -test('import QtQuick 2.3\nimport QtQuick.Window 2.2\nWindow {\n\tvisible: true\n\n\tMouseArea {\n\t\tanchors.fill: parent\n\t\tonClicked: {\n\t\t\tQt.quit();\n\t\t}\n\t}\n\tText {\n\t\ttext: qsTr("Hello World")\n\t\tanchors.centerIn: parent\n\t}\n}', - program([{ - type: "QMLImport", - loc: { - start: { line: 1, column: 0 - }, - end: { line: 1, column: 18 } - }, - module: { - type: "QMLModule", - loc: { - start: { line: 1, column: 7 }, - end: { line: 1, column: 18 } - }, - id: { - type: "QMLQualifiedID", - loc: { - start: { line: 1, column: 7 }, - end: { line: 1, column: 14 } - }, - parts: [{ type: "Identifier", name: "QtQuick" }], - name: "QtQuick" - }, - version: { - type: "QMLVersionLiteral", - loc: { - start: { line: 1, column: 15 }, - end: { line: 1, column: 18 } - }, - raw: "2.3", - } - } - }, - { - type: "QMLImport", - loc: { - start: { line: 2, column: 0 }, - end: { line: 2, column: 25 } - }, - module: { - type: "QMLModule", - loc: { - start: { line: 2, column: 7 }, - end: { line: 2, column: 25 } - }, - id: { - type: "QMLQualifiedID", - loc: { - start: { line: 2, column: 7 }, - end: { line: 2, column: 21 } - }, - parts: [ - { type: "Identifier", name: "QtQuick" }, - { type: "Identifier", name: "Window" } - ], - name: "QtQuick.Window" - }, - version: { - type: "QMLVersionLiteral", - loc: { - start: { line: 2, column: 22 }, - end: { line: 2, column: 25 } - }, - raw: "2.2", - } - } - }],{ - type: "QMLObjectDefinition", - loc: { - start: { line: 3, column: 0 }, - end: { line: 16, column: 1 } - }, - id: { - type: "QMLQualifiedID", - loc: { - start: { line: 3, column: 0 }, - end: { line: 3, column: 6 } - }, - parts: [{ type: "Identifier", name: "Window" }], - name: "Window" - }, - body: { - type: "QMLObjectInitializer", - loc: { - start: { line: 3, column: 7 }, - end: { line: 16, column: 1 } - }, - members: [ - { - type: "QMLPropertyBinding", - loc: { - start: { line: 4, column: 1 }, - end: { line: 4, column: 14 } - }, - id: { - type: "QMLQualifiedID", - loc: { - start: { line: 4, column: 1 }, - end: { line: 4, column: 8 } - }, - parts: [{ type: "Identifier", name: "visible" }], - name: "visible" - }, - binding: { - type: "QMLScriptBinding", - loc: { - start: { line: 4, column: 10 }, - end: { line: 4, column: 14 } - }, - script: { - type: "Literal", - value: true, - raw: "true" - } - } - }, - { - type: "QMLObjectDefinition", - loc: { - start: { line: 6, column: 1 }, - end: { line: 11, column: 2 } - }, - id: { - type: "QMLQualifiedID", - loc: { - start: { line: 6, column: 1 }, - end: { line: 6, column: 10 } - }, - parts: [{ type: "Identifier", name: "MouseArea" }], - name: "MouseArea" - }, - body: { - type: "QMLObjectInitializer", - loc: { - start: { line: 6, column: 11 }, - end: { line: 11, column: 2 } - }, - members: [ - { - type: "QMLPropertyBinding", - loc: { - start: { line: 7, column: 2 }, - end: { line: 7, column: 22 } - }, - id: { - type: "QMLQualifiedID", - loc: { - start: { line: 7, column: 2 }, - end: { line: 7, column: 14 } - }, - parts: [ - { type: "Identifier", name: "anchors" }, - { type: "Identifier", name: "fill" } - ], - name: "anchors.fill" - }, - binding: { - type: "QMLScriptBinding", - loc: { - start: { line: 7, column: 16 }, - end: { line: 7, column: 22 } - }, - script: { - type: "Identifier", - name: "parent" - } - } - }, - { - type: "QMLPropertyBinding", - loc: { - start: { line: 8, column: 2 }, - end: { line: 10, column: 3 } - }, - id: { - type: "QMLQualifiedID", - loc: { - start: { line: 8, column: 2 }, - end: { line: 8, column: 11 } - }, - parts: [{ type: "Identifier", name: "onClicked" }], - name: "onClicked" - }, - binding: { - type: "QMLScriptBinding", - loc: { - start: { line: 8, column: 13 }, - end: { line: 10, column: 3 } - }, - script: { - type: "QMLStatementBlock", - body: [{ - type: "ExpressionStatement", - expression: { - type: "CallExpression", - callee: { - type: "MemberExpression", - object: { - type: "Identifier", - name: "Qt" - }, - property: { - type: "Identifier", - name: "quit" - }, - computed: false - }, - arguments: [] - } - }] - } - } - } - ] - } - }, - { - type: "QMLObjectDefinition", - loc: { - start: { line: 12, column: 1 }, - end: { line: 15, column: 2 } - }, - id: { - type: "QMLQualifiedID", - loc: { - start: { line: 12, column: 1 }, - end: { line: 12, column: 5 } - }, - parts: [{ type: "Identifier", name: "Text" }], - name: "Text" - }, - body: { - type: "QMLObjectInitializer", - loc: { - start: { line: 12, column: 6 }, - end: { line: 15, column: 2 } - }, - members: [ - { - type: "QMLPropertyBinding", - loc: { - start: { line: 13, column: 2 }, - end: { line: 13, column: 27 } - }, - id: { - type: "QMLQualifiedID", - loc: { - start: { line: 13, column: 2 }, - end: { line: 13, column: 6 } - }, - parts: [{ type: "Identifier", name: "text" }], - name: "text" - }, - binding: { - type: "QMLScriptBinding", - loc: { - start: { line: 13, column: 8 }, - end: { line: 13, column: 27 } - }, - script: { - type: "CallExpression", - callee: { - type: "Identifier", - name: "qsTr" - }, - arguments: [{ - type: "Literal", - value: "Hello World", - raw: "\"Hello World\"" - }] - } - } - }, - { - type: "QMLPropertyBinding", - loc: { - start: { line: 14, column: 2 }, - end: { line: 14, column: 26 } - }, - id: { - type: "QMLQualifiedID", - loc: { - start: { line: 14, column: 2 }, - end: { line: 14, column: 18 } - }, - parts: [ - { type: "Identifier", name: "anchors" }, - { type: "Identifier", name: "centerIn" } - ], - name: "anchors.centerIn" - }, - binding: { - type: "QMLScriptBinding", - script: { - type: "Identifier", - name: "parent" - } - } - } - ] - } - } - ] - } - } -), { locations: true, qmltypes: false }); - -/*************************************************************************** -* Loose Parser Tests * -****************************************************************************/ -function testLoose(code, ast, options) { - var opts = options || {}; - opts.loose = true; - opts.normal = false; - opts.locations = true; - test(code, ast, opts); -} - -testLoose('import QtQuick', headerItemList([{ - type: "QMLImport", - loc: { - start: { line: 1, column: 0 }, - end: { line: 1, column: 14 } - }, - module: { - type: "QMLModule", - loc: { - start: { line: 1, column: 7 }, - end: { line: 1, column: 14 } - }, - id: { - type: "QMLQualifiedID", - loc: { - start: { line: 1, column: 7 }, - end: { line: 1, column: 14 } - }, - parts: [{ type: "Identifier", name: "QtQuick" }], - name: "QtQuick" - }, - version: { - type: "QMLVersionLiteral", - loc: { - start: { line: 1, column: 14 }, - end: { line: 1, column: 14 } - }, - value: 0, - raw: "0.0" - } - } -}])); - -testLoose('import ', headerItemList([{ - type: "QMLImport", - loc: { - start: { line: 1, column: 0 }, - end: { line: 1, column: 7 } - }, - module: { - type: "QMLModule", - loc: { - start: { line: 1, column: 7 }, - end: { line: 1, column: 7 } - }, - id: { - type: "QMLQualifiedID", - loc: { - start: { line: 1, column: 7 }, - end: { line: 1, column: 7 } - }, - parts: [{ type: "Identifier", name: "✖" }], - name: "✖" - }, - version: { - type: "QMLVersionLiteral", - loc: { - start: { line: 1, column: 7 }, - end: { line: 1, column: 7 } - }, - value: 0, - raw: "0.0" - } - } -}])); - -testLoose('import QtQuick 0x01', headerItemList([{ - type: "QMLImport", - loc: { - start: { line: 1, column: 0 }, - end: { line: 1, column: 19 } - }, - module: { - type: "QMLModule", - loc: { - start: { line: 1, column: 7 }, - end: { line: 1, column: 19 } - }, - id: { - type: "QMLQualifiedID", - loc: { - start: { line: 1, column: 7 }, - end: { line: 1, column: 14 } - }, - parts: [{ type: "Identifier", name: "QtQuick" }], - name: "QtQuick" - }, - version: { - type: "QMLVersionLiteral", - loc: { - start: { line: 1, column: 15 }, - end: { line: 1, column: 19 } - }, - value: 1, - raw: "0x01" - } - } -}])); - -testLoose('import QtQuick 1', headerItemList([{ - type: "QMLImport", - loc: { - start: { line: 1, column: 0 }, - end: { line: 1, column: 16 } - }, - module: { - type: "QMLModule", - loc: { - start: { line: 1, column: 7 }, - end: { line: 1, column: 16 } - }, - id: { - type: "QMLQualifiedID", - loc: { - start: { line: 1, column: 7 }, - end: { line: 1, column: 14 } - }, - parts: [{ type: "Identifier", name: "QtQuick" }], - name: "QtQuick" - }, - version: { - type: "QMLVersionLiteral", - loc: { - start: { line: 1, column: 15 }, - end: { line: 1, column: 16 } - }, - value: 1, - raw: "1" - } - } -}])); - -testLoose('import "./file.js', headerItemList([{ - type: "QMLImport", - loc: { - start: { line: 1, column: 0 }, - end: { line: 1, column: 17 } - }, - directory: { - type: "Literal", - loc: { - start: { line: 1, column: 7 }, - end: { line: 1, column: 17 } - }, - value: "./file.js", - raw: "\"./file.js" - } -}])); - -testLoose('import QtQuick 2.2 as ', headerItemList([{ - type: "QMLImport", - loc: { - start: { line: 1, column: 0 }, - end: { line: 1, column: 22 } - }, - module: { - type: "QMLModule", - loc: { - start: { line: 1, column: 7 }, - end: { line: 1, column: 18 } - }, - id: { - type: "QMLQualifiedID", - loc: { - start: { line: 1, column: 7 }, - end: { line: 1, column: 14 } - }, - parts: [{ type: "Identifier", name: "QtQuick" }], - name: "QtQuick" - }, - version: { - type: "QMLVersionLiteral", - loc: { - start: { line: 1, column: 15 }, - end: { line: 1, column: 18 } - }, - value: 2.2, - raw: "2.2" - } - }, - qualifier: { - type: "QMLQualifier", - loc: { - start: { line: 1, column: 19 }, - end: { line: 1, column: 22 } - }, - id: { - type: "Identifier", - loc: { - start: { line: 1, column: 22 }, - end: { line: 1, column: 22 } - }, - name: "✖" - } - } -}])); - -testLoose('Window {', rootObject({ - type: "QMLObjectDefinition", - loc: { - start: { line: 1, column: 0 }, - end: { line: 1, column: 8 } - }, - id: { - type: "QMLQualifiedID", - loc: { - start: { line: 1, column: 0 }, - end: { line: 1, column: 6 } - }, - parts: [{ type: "Identifier", name: "Window" }], - name: "Window" - }, - body: { - type: "QMLObjectInitializer", - loc: { - start: { line: 1, column: 7 }, - end: { line: 1, column: 8 } - }, - members: [] - } -})); - -testLoose('Window {\n\tprop: 3', rootObject({ - type: "QMLObjectDefinition", - loc: { - start: { line: 1, column: 0 }, - end: { line: 2, column: 8 } - }, - id: { - type: "QMLQualifiedID", - loc: { - start: { line: 1, column: 0 }, - end: { line: 1, column: 6 } - }, - parts: [{ type: "Identifier", name: "Window" }], - name: "Window" - }, - body: { - type: "QMLObjectInitializer", - loc: { - start: { line: 1, column: 7 }, - end: { line: 2, column: 8 } - }, - members: [{ - type: "QMLPropertyBinding", - loc: { - start: { line: 2, column: 1 }, - end: { line: 2, column: 8 } - }, - id: { - type: "QMLQualifiedID", - loc: { - start: { line: 2, column: 1 }, - end: { line: 2, column: 5 } - }, - parts: [{ type: "Identifier", name: "prop" }], - name: "prop" - }, - binding: { - type: "QMLScriptBinding", - loc: { - start: { line: 2, column: 7 }, - end: { line: 2, column: 8 } - }, - script: { - type: "Literal", - value: 3, - raw: "3" - } - } - }] - } -})); - -testLoose('a {\n\tb {\n\n\tc {\n}', rootObject({ - type: "QMLObjectDefinition", - loc: { - start: { line: 1, column: 0 }, - end: { line: 5, column: 1 } - }, - id: { - type: "QMLQualifiedID", - loc: { - start: { line: 1, column: 0 }, - end: { line: 1, column: 1 } - }, - parts: [{ type: "Identifier", name: "a" }], - name: "a" - }, - body: { - type: "QMLObjectInitializer", - loc: { - start: { line: 1, column: 2 }, - end: { line: 5, column: 1 } - }, - members: [{ - type: "QMLObjectDefinition", - loc: { - start: { line: 2, column: 1 }, - end: { line: 5, column: 1 } - }, - id: { - type: "QMLQualifiedID", - loc: { - start: { line: 2, column: 1 }, - end: { line: 2, column: 2 } - }, - parts: [{ type: "Identifier", name: "b" }], - name: "b" - }, - body: { - type: "QMLObjectInitializer", - loc: { - start: { line: 2, column: 3 }, - end: { line: 5, column: 1 } - }, - members: [{ - type: "QMLObjectDefinition", - loc: { - start: { line: 4, column: 1 }, - end: { line: 5, column: 1 } - }, - id: { - type: "QMLQualifiedID", - loc: { - start: { line: 4, column: 1 }, - end: { line: 4, column: 2 } - }, - parts: [{ type: "Identifier", name: "c" }], - name: "c" - }, - body: { - type: "QMLObjectInitializer", - loc: { - start: { line: 4, column: 3 }, - end: { line: 5, column: 1 } - }, - members: [] - } - }] - } - }] - } -})); - -testLoose('a{ property var }', rootObjectMembers([{ - type: "QMLPropertyDeclaration", - loc: { - start: { line: 1, column: 3 }, - end: { line: 1, column: 17 } - }, - default: false, - readonly: false, - kind: { - type: "QMLPropertyType", - loc: { - start: { line: 1, column: 12 }, - end: { line: 1, column: 15 } - }, - primitive: true, - id: { type: "Identifier", name: "var"} - }, - id: { - type: "Identifier", - loc: { - start: { line: 1, column: 17 }, - end: { line: 1, column: 17 } - }, - name: "✖" - }, - binding: null -}])); - -testLoose('a{ w }', rootObjectMembers([{ - type: "QMLPropertyBinding", - loc: { - start: { line: 1, column: 3 }, - end: { line: 1, column: 5 } - }, - id: { - type: "QMLQualifiedID", - loc: { - start: { line: 1, column: 3 }, - end: { line: 1, column: 4 } - }, - parts: [{ type: "Identifier", name: "w" }], - name: "w" - }, - binding: { - type: "QMLScriptBinding", - loc: { - start: { line: 1, column: 5 }, - end: { line: 1, column: 5 } - }, - script: { - type: "Identifier", - name: "✖" - } - } -}])); - -testLoose('a{ w: }', rootObjectMembers([{ - type: "QMLPropertyBinding", - loc: { - start: { line: 1, column: 3 }, - end: { line: 1, column: 7 } - }, - id: { - type: "QMLQualifiedID", - loc: { - start: { line: 1, column: 3 }, - end: { line: 1, column: 4 } - }, - parts: [{ type: "Identifier", name: "w" }], - name: "w" - }, - binding: { - type: "QMLScriptBinding", - loc: { - start: { line: 1, column: 4 }, - end: { line: 1, column: 7 } - }, - script: { - type: "Identifier", - name: "✖" - } - } -}])); - -testLoose('a{ : 3 }', rootObjectMembers([{ - type: "QMLPropertyBinding", - loc: { - start: { line: 1, column: 3 }, - end: { line: 1, column: 6 } - }, - id: { - type: "QMLQualifiedID", - loc: { - start: { line: 1, column: 3 }, - end: { line: 1, column: 3 } - }, - parts: [{ type: "Identifier", name: "✖" }], - name: "✖" - }, - binding: { - type: "QMLScriptBinding", - loc: { - start: { line: 1, column: 5 }, - end: { line: 1, column: 6 } - }, - script: { - type: "Literal", - value: 3, - raw: "3" - } - } -}])); - -testLoose('a{ anchors.: 3 }', rootObjectMembers([{ - type: "QMLPropertyBinding", - loc: { - start: { line: 1, column: 3 }, - end: { line: 1, column: 14 } - }, - id: { - type: "QMLQualifiedID", - loc: { - start: { line: 1, column: 3 }, - end: { line: 1, column: 11 } - }, - parts: [ - { type: "Identifier", name: "anchors" }, - { type: "Identifier", name: "✖" } - ], - name: "anchors.✖" - }, - binding: { - type: "QMLScriptBinding", - loc: { - start: { line: 1, column: 13 }, - end: { line: 1, column: 14 } - }, - script: { - type: "Literal", - value: 3, - raw: "3" - } - } -}])); - -testLoose('a{ anchors..: 3 }', rootObjectMembers([{ - type: "QMLPropertyBinding", - loc: { - start: { line: 1, column: 3 }, - end: { line: 1, column: 15 } - }, - id: { - type: "QMLQualifiedID", - loc: { - start: { line: 1, column: 3 }, - end: { line: 1, column: 12 } - }, - parts: [ - { type: "Identifier", name: "anchors" }, - { type: "Identifier", name: "✖" }, - { type: "Identifier", name: "✖" } - ], - name: "anchors.✖.✖" - }, - binding: { - type: "QMLScriptBinding", - loc: { - start: { line: 1, column: 14 }, - end: { line: 1, column: 15 } - }, - script: { - type: "Literal", - value: 3, - raw: "3" - } - } -}])); - -testLoose('a{ ..: 3 }', rootObjectMembers([{ - type: "QMLPropertyBinding", - loc: { - start: { line: 1, column: 3 }, - end: { line: 1, column: 8 } - }, - id: { - type: "QMLQualifiedID", - loc: { - start: { line: 1, column: 3 }, - end: { line: 1, column: 5 } - }, - parts: [ - { type: "Identifier", name: "✖" }, - { type: "Identifier", name: "✖" }, - { type: "Identifier", name: "✖" } - ], - name: "✖.✖.✖" - }, - binding: { - type: "QMLScriptBinding", - loc: { - start: { line: 1, column: 7 }, - end: { line: 1, column: 8 } - }, - script: { - type: "Literal", - value: 3, - raw: "3" - } - } -}])); - -testLoose('a{ var }', rootObjectMembers([{ - type: "QMLPropertyDeclaration", - loc: { - start: { line: 1, column: 3 }, - end: { line: 1, column: 7 } - }, - default: false, - readonly: false, - kind: { - type: "QMLPropertyType", - loc: { - start: { line: 1, column: 3 }, - end: { line: 1, column: 6 } - }, - primitive: true, - id: { type: "Identifier", name: "var"} - }, - id: { - type: "Identifier", - loc: { - start: { line: 1, column: 7 }, - end: { line: 1, column: 7 } - }, - name: "✖" - }, - binding: null -}])); - -testLoose('a{ var w }', rootObjectMembers([{ - type: "QMLPropertyDeclaration", - loc: { - start: { line: 1, column: 3 }, - end: { line: 1, column: 8 } - }, - default: false, - readonly: false, - kind: { - type: "QMLPropertyType", - loc: { - start: { line: 1, column: 3 }, - end: { line: 1, column: 6 } - }, - primitive: true, - id: { type: "Identifier", name: "var"} - }, - id: { - type: "Identifier", - loc: { - start: { line: 1, column: 7 }, - end: { line: 1, column: 8 } - }, - name: "w" - }, - binding: null -}])); - -testLoose('a{ obj w }', rootObjectMembers([{ - type: "QMLPropertyDeclaration", - loc: { - start: { line: 1, column: 3 }, - end: { line: 1, column: 8 } - }, - default: false, - readonly: false, - kind: { - type: "QMLPropertyType", - loc: { - start: { line: 1, column: 3 }, - end: { line: 1, column: 6 } - }, - primitive: false, - id: { type: "Identifier", name: "obj"} - }, - id: { - type: "Identifier", - loc: { - start: { line: 1, column: 7 }, - end: { line: 1, column: 8 } - }, - name: "w" - }, - binding: null -}])); - -// TODO: Allow this to run with the normal parser once the ambiguity is solved -testLoose('a{ property var b: Window {} }', rootObjectMembers([{ - type: "QMLPropertyDeclaration", - loc: { - start: { line: 1, column: 3 }, - end: { line: 1, column: 28 } - }, - default: false, - readonly: false, - kind: { - type: "QMLPropertyType", - loc: { - start: { line: 1, column: 12 }, - end: { line: 1, column: 15 } - }, - primitive: true, - id: { type: "Identifier", name: "var"} - }, - id: { - type: "Identifier", - loc: { - start: { line: 1, column: 16 }, - end: { line: 1, column: 17 } - }, - name: "b" - }, - binding: { - type: "QMLObjectBinding", - loc: { - start: { line: 1, column: 19 }, - end: { line: 1, column: 28 } - }, - id: { - type: "QMLQualifiedID", - loc: { - start: { line: 1, column: 19 }, - end: { line: 1, column: 25 } - }, - parts: [{ type: "Identifier", name: "Window" }], - name: "Window" - }, - body: { - type: "QMLObjectInitializer", - loc: { - start: { line: 1, column: 26 }, - end: { line: 1, column: 28 } - }, - members: [] - } - } -}]), { locations: true, qmltypes: false }); - -// TODO: Allow this to run with the normal parser once the ambiguity is solved -testLoose('a{ b: Window {} }', rootObjectMembers([{ - type: "QMLPropertyBinding", - loc: { - start: { line: 1, column: 3 }, - end: { line: 1, column: 15 } - }, - id: { - type: "QMLQualifiedID", - loc: { - start: { line: 1, column: 3 }, - end: { line: 1, column: 4 } - }, - parts: [{ type: "Identifier", name: "b" }], - name: "b" - }, - binding: { - type: "QMLObjectBinding", - loc: { - start: { line: 1, column: 6 }, - end: { line: 1, column: 15 } - }, - id: { - type: "QMLQualifiedID", - loc: { - start: { line: 1, column: 6 }, - end: { line: 1, column: 12 } - }, - parts: [{ type: "Identifier", name: "Window" }], - name: "Window" - }, - body: { - type: "QMLObjectInitializer", - loc: { - start: { line: 1, column: 13 }, - end: { line: 1, column: 15 } - }, - members: [] - } - } -}]), { locations: true, qmltypes: false }); - -testLoose('a{ signal }', rootObjectMembers([{ - type: "QMLSignalDefinition", - loc: { - start: { line: 1, column: 3 }, - end: { line: 1, column: 10 } - }, - id: { - type: "Identifier", - loc: { - start: { line: 1, column: 10 }, - end: { line: 1, column: 10 } - }, - name: "✖" - }, - params: [] -}])); - -testLoose('a{ signal () }', rootObjectMembers([{ - type: "QMLSignalDefinition", - loc: { - start: { line: 1, column: 3 }, - end: { line: 1, column: 12 } - }, - id: { - type: "Identifier", - loc: { - start: { line: 1, column: 10 }, - end: { line: 1, column: 10 } - }, - name: "✖" - }, - params: [] -}])); - -testLoose('a{ signal test( }', rootObjectMembers([{ - type: "QMLSignalDefinition", - loc: { - start: { line: 1, column: 3 }, - end: { line: 1, column: 16 } - }, - id: { - type: "Identifier", - loc: { - start: { line: 1, column: 10 }, - end: { line: 1, column: 14 } - }, - name: "test" - }, - params: [] -}])); - -testLoose('a{ signal test(int test }', rootObjectMembers([{ - type: "QMLSignalDefinition", - loc: { - start: { line: 1, column: 3 }, - end: { line: 1, column: 24 } - }, - id: { - type: "Identifier", - loc: { - start: { line: 1, column: 10 }, - end: { line: 1, column: 14 } - }, - name: "test" - }, - params: [{ - type: "QMLParameter", - loc: { - start: { line: 1, column: 15 }, - end: { line: 1, column: 23 } - }, - kind: { - type: "QMLPropertyType", - loc: { - start: { line: 1, column: 15 }, - end: { line: 1, column: 18 } - }, - primitive: true, - id: { type: "Identifier", name: "int" } - }, - id: { - type: "Identifier", - loc: { - start: { line: 1, column: 19 }, - end: { line: 1, column: 23 } - }, - name: "test" - } - }] -}])); - -testLoose('Window {\n\tfunction\n\tproperty var prop\n}', rootObjectMembers([ - { - type: "FunctionDeclaration", - loc: { - start: { line: 2, column: 1 }, - end: { line: 3, column: 9 } - }, - id: { - type: "Identifier", - loc: { - start: { line: 3, column: 1 }, - end: { line: 3, column: 9 } - }, - name: "property" - }, - params: [], - body: { - type: "BlockStatement", - loc: { - start: { line: 3, column: 9 }, - end: { line: 3, column: 9 } - }, - body: [] - } - }, - { - type: "QMLPropertyDeclaration", - loc: { - start: { line: 3, column: 10 }, - end: { line: 3, column: 18 } - }, - default: false, - readonly: false, - kind: { - type: "QMLPropertyType", - loc: { - start: { line: 3, column: 10 }, - end: { line: 3, column: 13 } - }, - primitive: true, - id: { type: "Identifier", name: "var"} - }, - id: { - type: "Identifier", - loc: { - start: { line: 3, column: 14 }, - end: { line: 3, column: 18 } - }, - name: "prop" - }, - binding: null - } -])); - -testLoose('Window {\n\tfunction (something)\n\tproperty var prop\n}', rootObjectMembers([ - { - type: "FunctionDeclaration", - loc: { - start: { line: 2, column: 1 }, - end: { line: 2, column: 21 } - }, - id: { - type: "Identifier", - loc: { - start: { line: 2, column: 10 }, - end: { line: 2, column: 10 } - }, - name: "✖" - }, - params: [ - { - type: "Identifier", - loc: { - start: { line: 2, column: 11 }, - end: { line: 2, column: 20 } - }, - name: "something" - } - ], - body: { - type: "BlockStatement", - loc: { - start: { line: 2, column: 21 }, - end: { line: 2, column: 21 } - }, - body: [] - } - }, - { - type: "QMLPropertyDeclaration", - loc: { - start: { line: 3, column: 1 }, - end: { line: 3, column: 18 } - }, - default: false, - readonly: false, - kind: { - type: "QMLPropertyType", - loc: { - start: { line: 3, column: 10 }, - end: { line: 3, column: 13 } - }, - primitive: true, - id: { type: "Identifier", name: "var"} - }, - id: { - type: "Identifier", - loc: { - start: { line: 3, column: 14 }, - end: { line: 3, column: 18 } - }, - name: "prop" - }, - binding: null - } -])); - -testLoose('Window {\n\tfunction (\n\tproperty var prop\n}', rootObjectMembers([ - { - type: "FunctionDeclaration", - loc: { - start: { line: 2, column: 1 }, - end: { line: 3, column: 1 } - }, - id: { - type: "Identifier", - loc: { - start: { line: 2, column: 10 }, - end: { line: 2, column: 10 } - }, - name: "✖" - }, - params: [], - body: { - type: "BlockStatement", - loc: { - start: { line: 3, column: 1 }, - end: { line: 3, column: 1 } - }, - body: [] - } - }, - { - type: "QMLPropertyDeclaration", - loc: { - start: { line: 3, column: 1 }, - end: { line: 3, column: 18 } - }, - default: false, - readonly: false, - kind: { - type: "QMLPropertyType", - loc: { - start: { line: 3, column: 10 }, - end: { line: 3, column: 13 } - }, - primitive: true, - id: { type: "Identifier", name: "var"} - }, - id: { - type: "Identifier", - loc: { - start: { line: 3, column: 14 }, - end: { line: 3, column: 18 } - }, - name: "prop" - }, - binding: null - } -])); - -// TODO: Allow this to run on the normal parser once the ambiguity is solved -testLoose("a{ QtObject on test {} }", rootObjectMembers([{ - type: "QMLPropertyModifier", - loc: { - start: { line: 1, column: 3 }, - end: { line: 1, column: 22 } - }, - kind: { - type: "QMLQualifiedID", - loc: { - start: { line: 1, column: 3 }, - end: { line: 1, column: 11 } - }, - parts: [{ type: "Identifier", name: "QtObject" }], - name: "QtObject" - }, - id: { - type: "QMLQualifiedID", - loc: { - start: { line: 1, column: 15 }, - end: { line: 1, column: 19 } - }, - parts: [{ type: "Identifier", name: "test" }], - name: "test" - }, - body: { - type: "QMLObjectInitializer", - loc: { - start: { line: 1, column: 20 }, - end: { line: 1, column: 22 } - }, - members: [] - } -}])); - -// TODO: Allow this to run on the normal parser once the ambiguity is solved -testLoose("a{ QtObject on test {} }", rootObjectMembers([{ - type: "QMLPropertyModifier", - loc: { - start: { line: 1, column: 3 }, - end: { line: 1, column: 22 } - }, - kind: { - type: "QMLQualifiedID", - loc: { - start: { line: 1, column: 3 }, - end: { line: 1, column: 11 } - }, - parts: [{ type: "Identifier", name: "QtObject" }], - name: "QtObject" - }, - id: { - type: "QMLQualifiedID", - loc: { - start: { line: 1, column: 15 }, - end: { line: 1, column: 19 } - }, - parts: [{ type: "Identifier", name: "test" }], - name: "test" - }, - body: { - type: "QMLObjectInitializer", - loc: { - start: { line: 1, column: 20 }, - end: { line: 1, column: 22 } - }, - members: [] - } -}])); - -testLoose("a{ QtObject. on test {} }", rootObjectMembers([{ - type: "QMLPropertyBinding", - loc: { - start: { line: 1, column: 3 }, - end: { line: 1, column: 23 } - }, - id: { - type: "QMLQualifiedID", - loc: { - start: { line: 1, column: 3 }, - end: { line: 1, column: 15 } - }, - parts: [ - { type: "Identifier", name: "QtObject" }, - { type: "Identifier", name: "on" } - ], - name: "QtObject.on" - }, - binding: { - type: "QMLObjectBinding", - loc: { - start: { line: 1, column: 16 }, - end: { line: 1, column: 23 } - }, - id: { - type: "QMLQualifiedID", - loc: { - start: { line: 1, column: 16 }, - end: { line: 1, column: 20 } - }, - parts: [{ type: "Identifier", name: "test" }], - name: "test" - }, - body: { - type: "QMLObjectInitializer", - loc: { - start: { line: 1, column: 21 }, - end: { line: 1, column: 23 } - }, - members: [] - } - } -}]), { locations: true, qmltypes: false } ); - -// TODO: Allow this to run on the normal parser once the ambiguity is solved -testLoose("a{ s: [ QtObject {} ] }", rootObjectMembers([{ - type: "QMLPropertyBinding", - loc: { - start: { line: 1, column: 3 }, - end: { line: 1, column: 21 } - }, - id: { - type: "QMLQualifiedID", - loc: { - start: { line: 1, column: 3 }, - end: { line: 1, column: 4 } - }, - parts: [{ type: "Identifier", name: "s" }], - name: "s" - }, - binding: { - type: "QMLArrayBinding", - loc: { - start: { line: 1, column: 6 }, - end: { line: 1, column: 21 } - }, - elements: [ - { - type: "QMLObjectDefinition", - loc: { - start: { line: 1, column: 8 }, - end: { line: 1, column: 19 } - }, - id: { - type: "QMLQualifiedID", - loc: { - start: { line: 1, column: 8 }, - end: { line: 1, column: 16 } - }, - parts: [{ type: "Identifier", name: "QtObject" }], - name: "QtObject" - }, - body: { - type: "QMLObjectInitializer", - loc: { - start: { line: 1, column: 17 }, - end: { line: 1, column: 19 } - }, - members: [] - } - } - ] - } -}]), { locations: true, qmltypes: false }); - -// TODO: Allow this to run on the normal parser once the ambiguity is solved -testLoose("a{ s: [ QtObject {}, QtObject {} ] }", rootObjectMembers([{ - type: "QMLPropertyBinding", - loc: { - start: { line: 1, column: 3 }, - end: { line: 1, column: 34 } - }, - id: { - type: "QMLQualifiedID", - loc: { - start: { line: 1, column: 3 }, - end: { line: 1, column: 4 } - }, - parts: [{ type: "Identifier", name: "s" }], - name: "s" - }, - binding: { - type: "QMLArrayBinding", - loc: { - start: { line: 1, column: 6 }, - end: { line: 1, column: 34 } - }, - elements: [ - { - type: "QMLObjectDefinition", - loc: { - start: { line: 1, column: 8 }, - end: { line: 1, column: 19 } - }, - id: { - type: "QMLQualifiedID", - loc: { - start: { line: 1, column: 8 }, - end: { line: 1, column: 16 } - }, - parts: [{ type: "Identifier", name: "QtObject" }], - name: "QtObject" - }, - body: { - type: "QMLObjectInitializer", - loc: { - start: { line: 1, column: 17 }, - end: { line: 1, column: 19 } - }, - members: [] - } - }, - { - type: "QMLObjectDefinition", - loc: { - start: { line: 1, column: 21 }, - end: { line: 1, column: 32 } - }, - id: { - type: "QMLQualifiedID", - loc: { - start: { line: 1, column: 21 }, - end: { line: 1, column: 29 } - }, - parts: [{ type: "Identifier", name: "QtObject" }], - name: "QtObject" - }, - body: { - type: "QMLObjectInitializer", - loc: { - start: { line: 1, column: 30 }, - end: { line: 1, column: 32 } - }, - members: [] - } - } - ] - } -}]), { locations: true, qmltypes: false }); - -// TODO: Allow this to run on the normal parser once the ambiguity is solved -testLoose("a{ s: [ QtObject ] }", rootObjectMembers([{ - type: "QMLPropertyBinding", - loc: { - start: { line: 1, column: 3 }, - end: { line: 1, column: 18 } - }, - id: { - type: "QMLQualifiedID", - loc: { - start: { line: 1, column: 3 }, - end: { line: 1, column: 4 } - }, - parts: [{ type: "Identifier", name: "s" }], - name: "s" - }, - binding: { - type: "QMLScriptBinding", - loc: { - start: { line: 1, column: 6 }, - end: { line: 1, column: 18 } - }, - block: false, - script: { - type: "ArrayExpression", - loc: { - start: { line: 1, column: 6 }, - end: { line: 1, column: 18 } - }, - elements: [ - { - type: "Identifier", - loc: { - start: { line: 1, column: 8 }, - end: { line: 1, column: 16 } - }, - name: "QtObject" - } - ] - } - } -}] -), { locations: true, qmltypes: false }); - -// TODO: Allow this to run on the normal parser once the ambiguity is solved -testLoose("a{ property var s: [ QtObject {} ] }", rootObjectMembers([{ - type: "QMLPropertyDeclaration", - loc: { - start: { line: 1, column: 3 }, - end: { line: 1, column: 34 } - }, - default: false, - readonly: false, - kind: { - type: "QMLPropertyType", - loc: { - start: { line: 1, column: 12 }, - end: { line: 1, column: 15 } - }, - primitive: true, - id: { type: "Identifier", name: "var" } - }, - id: { - type: "Identifier", - loc: { - start: { line: 1, column: 16 }, - end: { line: 1, column: 17 } - }, - name: "s" - }, - binding: { - type: "QMLArrayBinding", - loc: { - start: { line: 1, column: 19 }, - end: { line: 1, column: 34 } - }, - elements: [ - { - type: "QMLObjectDefinition", - loc: { - start: { line: 1, column: 21 }, - end: { line: 1, column: 32 } - }, - id: { - type: "QMLQualifiedID", - loc: { - start: { line: 1, column: 21 }, - end: { line: 1, column: 29 } - }, - parts: [{ type: "Identifier", name: "QtObject" }], - name: "QtObject" - }, - body: { - type: "QMLObjectInitializer", - loc: { - start: { line: 1, column: 30 }, - end: { line: 1, column: 32 } - }, - members: [] - } - } - ] - } -}]), { locations: true, qmltypes: false }); - -// TODO: Allow this to run on the normal parser once the ambiguity is solved -testLoose("a{ property var s: [ QtObject ] }", rootObjectMembers([{ - type: "QMLPropertyDeclaration", - loc: { - start: { line: 1, column: 3 }, - end: { line: 1, column: 31 } - }, - default: false, - readonly: false, - kind: { - type: "QMLPropertyType", - loc: { - start: { line: 1, column: 12 }, - end: { line: 1, column: 15 } - }, - primitive: true, - id: { type: "Identifier", name: "var" } - }, - id: { - type: "Identifier", - loc: { - start: { line: 1, column: 16 }, - end: { line: 1, column: 17 } - }, - name: "s" - }, - binding: { - type: "QMLScriptBinding", - loc: { - start: { line: 1, column: 19 }, - end: { line: 1, column: 31 } - }, - block: false, - script: { - type: "ArrayExpression", - loc: { - start: { line: 1, column: 19 }, - end: { line: 1, column: 31 } - }, - elements: [ - { - type: "Identifier", - loc: { - start: { line: 1, column: 21 }, - end: { line: 1, column: 29 } - }, - name: "QtObject" - } - ] - } - } -}]), { locations: true, qmltypes: false }); - -testLoose("a{ s: [ QtObject {} }", rootObjectMembers([{ - type: "QMLPropertyBinding", - loc: { - start: { line: 1, column: 3 }, - end: { line: 1, column: 20 } - }, - id: { - type: "QMLQualifiedID", - loc: { - start: { line: 1, column: 3 }, - end: { line: 1, column: 4 } - }, - parts: [{ type: "Identifier", name: "s" }], - name: "s" - }, - binding: { - type: "QMLArrayBinding", - loc: { - start: { line: 1, column: 6 }, - end: { line: 1, column: 20 } - }, - elements: [ - { - type: "QMLObjectDefinition", - loc: { - start: { line: 1, column: 8 }, - end: { line: 1, column: 19 } - }, - id: { - type: "QMLQualifiedID", - loc: { - start: { line: 1, column: 8 }, - end: { line: 1, column: 16 } - }, - parts: [{ type: "Identifier", name: "QtObject" }], - name: "QtObject" - }, - body: { - type: "QMLObjectInitializer", - loc: { - start: { line: 1, column: 17 }, - end: { line: 1, column: 19 } - }, - members: [] - } - } - ] - } -}]), { locations: true, qmltypes: false }); - -testLoose("a{ s: [ QtObject { ] }", rootObjectMembers([{ - type: "QMLPropertyBinding", - loc: { - start: { line: 1, column: 3 }, - end: { line: 1, column: 22 } - }, - id: { - type: "QMLQualifiedID", - loc: { - start: { line: 1, column: 3 }, - end: { line: 1, column: 4 } - }, - parts: [{ type: "Identifier", name: "s" }], - name: "s" - }, - binding: { - type: "QMLArrayBinding", - loc: { - start: { line: 1, column: 6 }, - end: { line: 1, column: 22 } - }, - elements: [ - { - type: "QMLObjectDefinition", - loc: { - start: { line: 1, column: 8 }, - end: { line: 1, column: 22 } - }, - id: { - type: "QMLQualifiedID", - loc: { - start: { line: 1, column: 8 }, - end: { line: 1, column: 16 } - }, - parts: [{ type: "Identifier", name: "QtObject" }], - name: "QtObject" - }, - body: { - type: "QMLObjectInitializer", - loc: { - start: { line: 1, column: 17 }, - end: { line: 1, column: 22 } - }, - members: [] - } - } - ] - } -}]), { locations: true, qmltypes: false }); - -/*************************************************************************** -* QMLTypes Parser Tests * -****************************************************************************/ -function testQMLTypes(code, ast, options) { - var opts = options || {}; - opts.qmltypes = true; - opts.locations = true; - test(code, ast, opts); -} - -testQMLTypes("a{ b: {} }", javaScript({ - type: "ObjectExpression", - loc: { - start: { line: 1, column: 6 }, - end: { line: 1, column: 8 } - }, - properties: [] -})); - -testQMLTypes('a{ b: "test" }', javaScript({ - type: "Literal", - loc: { - start: { line: 1, column: 6 }, - end: { line: 1, column: 12 } - }, - value: "test", - raw: '"test"' -})); - -testQMLTypes('a{ b: ["one", "two"] }', javaScript({ - type: "ArrayExpression", - loc: { - start: { line: 1, column: 6 }, - end: { line: 1, column: 20 } - }, - elements: [ - { - type: "Literal", - loc: { - start: { line: 1, column: 7 }, - end: { line: 1, column: 12 } - }, - value: "one", - raw: '"one"' - }, - { - type: "Literal", - loc: { - start: { line: 1, column: 14 }, - end: { line: 1, column: 19 } - }, - value: "two", - raw: '"two"' - } - ] -})); - -/* -* Creates a Program with 'headerItemList' and 'rootObject' as the program's expected -* body. -*/ -function program(headerItemList, rootObject) { - return { - type: "QMLProgram", - headerItemList: { - type: "QMLHeaderItemList", - items: headerItemList || [] - }, - rootObject: rootObject || null - }; -} - -/* -* Creates a QMLHeaderItemList with 'stmts' as the expected statements and 'prog' as the -* parent Program. A value of null for 'prog' will append the QMLHeaderItemList AST to -* the Program returned by program(). -*/ -function headerItemList(items, prog) { - prog = prog || program(); - prog.headerItemList.items = items; - return prog; -} - -/* -* Creates a QMLObjectDefinition with 'stmts' as the expected statements and 'prog' as the parent -* Program. A value of null for 'prog' will append the QMLObjectDefinition AST to the Program -* returned by program(). -*/ -function rootObject(obj, prog) { - prog = prog || program(); - prog.rootObject = obj; - return prog; -} - -/* -* Creates a QMLObjectInitializer with 'members' as the expected members and 'obj' as the parent -* QMLObjectDefinition. A value of null for 'obj' will append the QMLObjectInitializer AST to the -* QMLObjectDefinition returned by rootObject(). -*/ -function rootObjectMembers(members, obj) { - var rootObj = obj || rootObject({ - type: "QMLObjectDefinition", - body: { - type: "QMLObjectInitializer", - members: members - } - }); - return rootObj; -} - -/* -* Creates a JavaScript Expression with 'expr' as the expected expression and 'objMembers' as -* the parent QMLObjectInitializer. A value of null for 'objMembers' will append the JavaScript -* Expression to the QMLObjectInitializer returned by rootObjectMembers(). -*/ -function javaScript(expr, objMembers) { - objMembers = objMembers || rootObjectMembers([{ - type: "QMLPropertyBinding", - binding: { - type: "QMLScriptBinding", - script: expr - } - }]); - return objMembers; +/******************************************************************************* + * Copyright (c) 2015 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 + *******************************************************************************/ +"use strict"; + +var driver = require("./driver.js"); +var test = driver.test; +var testFail = driver.testFail; +var tokTypes = driver.tokTypes; + +testFail('', "QML only supports ECMA Script Language Specification 5 or older", + { locations: true, ecmaVersion: 6, allowReserved: false }); + +test('import QtQuick 2.02', headerItemList([{ + type: "QMLImport", + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 19 } + }, + module: { + type: "QMLModule", + loc: { + start: { line: 1, column: 7 }, + end: { line: 1, column: 19 } + }, + id: { + type: "QMLQualifiedID", + loc: { + start: { line: 1, column: 7 }, + end: { line: 1, column: 14 } + }, + parts: [{ type: "Identifier", name: "QtQuick" }], + name: "QtQuick" + }, + version: { + type: "QMLVersionLiteral", + loc: { + start: { line: 1, column: 15 }, + end: { line: 1, column: 19 } + }, + value: 2.02, + raw: "2.02" + } + } +}])); + +test('import "./file.js"', headerItemList([{ + type: "QMLImport", + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 18 } + }, + directory: { + type: "Literal", + loc: { + start: { line: 1, column: 7 }, + end: { line: 1, column: 18 } + }, + value: "./file.js", + raw: "\"./file.js\"" + } +}])); + +test('import "./file.js" as MyModule', headerItemList([{ + type: "QMLImport", + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 30 } + }, + directory: { + type: "Literal", + loc: { + start: { line: 1, column: 7 }, + end: { line: 1, column: 18 } + }, + value: "./file.js", + raw: "\"./file.js\"" + }, + qualifier: { + type: "QMLQualifier", + loc: { + start: { line: 1, column: 19 }, + end: { line: 1, column: 30 } + }, + id: { + type: "Identifier", + loc: { + start: { line: 1, column: 22 }, + end: { line: 1, column: 30 } + }, + name: "MyModule" + } + } +}])); + +testFail('import QtQuick ver', + "Unexpected token (1:15)", + { locations: true, loose: false }); + +testFail('import QtQuick 0x01', + "QML module must specify major and minor version (1:15)", + { locations: true, loose: false }); + +testFail('import QtQuick 1', + "QML module must specify major and minor version (1:15)", + { locations: true, loose: false }); + +test('import QtQuick 2.2\nimport "./file.js"', headerItemList([ + { + type: "QMLImport", + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 18 } + }, + module: { + type: "QMLModule", + loc: { + start: { line: 1, column: 7 }, + end: { line: 1, column: 18 } + }, + id: { + type: "QMLQualifiedID", + loc: { + start: { line: 1, column: 7 }, + end: { line: 1, column: 14 } + }, + parts: [{ type: "Identifier", name: "QtQuick" }], + name: "QtQuick" + }, + version: { + type: "QMLVersionLiteral", + loc: { + start: { line: 1, column: 15 }, + end: { line: 1, column: 18 } + }, + value: 2.2, + raw: "2.2" + } + } + }, + { + type: "QMLImport", + loc: { + start: { line: 2, column: 0 }, + end: { line: 2, column: 18 } + }, + directory: { + type: "Literal", + loc: { + start: { line: 2, column: 7 }, + end: { line: 2, column: 18 } + }, + value: "./file.js", + raw: "\"./file.js\"" + } + } +])); + +test('import QtQuick 2.2;import "./file.js"', headerItemList([ + { + type: "QMLImport", + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 19 } + }, + module: { + type: "QMLModule", + loc: { + start: { line: 1, column: 7 }, + end: { line: 1, column: 18 } + }, + id: { + type: "QMLQualifiedID", + loc: { + start: { line: 1, column: 7 }, + end: { line: 1, column: 14 } + }, + parts: [{ type: "Identifier", name: "QtQuick" }], + name: "QtQuick" + }, + version: { + type: "QMLVersionLiteral", + loc: { + start: { line: 1, column: 15 }, + end: { line: 1, column: 18 } + }, + value: 2.2, + raw: "2.2" + } + } + }, + { + type: "QMLImport", + loc: { + start: { line: 1, column: 19 }, + end: { line: 1, column: 37 } + }, + directory: { + type: "Literal", + loc: { + start: { line: 1, column: 26 }, + end: { line: 1, column: 37 } + }, + value: "./file.js", + raw: "\"./file.js\"" + } + } +])); + +test('import Module 1.0 as MyModule', headerItemList([ + { + type: "QMLImport", + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 29 } + }, + module: { + type: "QMLModule", + loc: { + start: { line: 1, column: 7 }, + end: { line: 1, column: 17 } + }, + id: { + type: "QMLQualifiedID", + loc: { + start: { line: 1, column: 7 }, + end: { line: 1, column: 13 } + }, + parts: [{ type: "Identifier", name: "Module" }], + name: "Module" + }, + version: { + type: "QMLVersionLiteral", + loc: { + start: { line: 1, column: 14 }, + end: { line: 1, column: 17 } + }, + value: 1, + raw: "1.0" + } + }, + qualifier: { + type: "QMLQualifier", + loc: { + start: { line: 1, column: 18 }, + end: { line: 1, column: 29 } + }, + id: { + type: "Identifier", + loc: { + start: { line: 1, column: 21 }, + end: { line: 1, column: 29 } + }, + name: "MyModule" + } + } + } +])); + +test('import Qualified.Id.Test 1.0', headerItemList([ + { + type: "QMLImport", + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 28 } + }, + module: { + type: "QMLModule", + loc: { + start: { line: 1, column: 7 }, + end: { line: 1, column: 28 } + }, + id: { + type: "QMLQualifiedID", + loc: { + start: { line: 1, column: 7 }, + end: { line: 1, column: 24 } + }, + parts: [ + { type: "Identifier", name: "Qualified" }, + { type: "Identifier", name: "Id" }, + { type: "Identifier", name: "Test" } + ], + name: "Qualified.Id.Test" + }, + version: { + type: "QMLVersionLiteral", + loc: { + start: { line: 1, column: 25 }, + end: { line: 1, column: 28 } + }, + value: 1, + raw: "1.0" + } + } + } +])); + +test('pragma Singleton', headerItemList([ + { + type: "QMLPragma", + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 16 } + }, + id: { + type: "QMLQualifiedID", + loc: { + start: { line: 1, column: 7 }, + end: { line: 1, column: 16 } + }, + parts: [{ type: "Identifier", name: "Singleton" }], + name: "Singleton" + } + } +])); + +test('pragma Singleton\npragma Other', headerItemList([ + { + type: "QMLPragma", + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 16 } + }, + id: { + type: "QMLQualifiedID", + loc: { + start: { line: 1, column: 7 }, + end: { line: 1, column: 16 } + }, + parts: [{ type: "Identifier", name: "Singleton" }], + name: "Singleton" + } + }, + { + type: "QMLPragma", + loc: { + start: { line: 2, column: 0 }, + end: { line: 2, column: 12 } + }, + id: { + type: "QMLQualifiedID", + loc: { + start: { line: 2, column: 7 }, + end: { line: 2, column: 12 } + }, + parts: [{ type: "Identifier", name: "Other" }], + name: "Other" + } + } +])); + +test('pragma Singleton;pragma Other', headerItemList([ + { + type: "QMLPragma", + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 17 } + }, + id: { + type: "QMLQualifiedID", + loc: { + start: { line: 1, column: 7 }, + end: { line: 1, column: 16 } + }, + parts: [{ type: "Identifier", name: "Singleton" }], + name: "Singleton" + } + }, + { + type: "QMLPragma", + loc: { + start: { line: 1, column: 17 }, + end: { line: 1, column: 29 } + }, + id: { + type: "QMLQualifiedID", + loc: { + start: { line: 1, column: 24 }, + end: { line: 1, column: 29 } + }, + parts: [{ type: "Identifier", name: "Other" }], + name: "Other" + } + } +])); + +test('Window {}', rootObject({ + type: "QMLObjectDefinition", + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 9 } + }, + id: { + type: "QMLQualifiedID", + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 6 } + }, + parts: [{ type: "Identifier", name: "Window" }], + name: "Window" + }, + body: { + type: "QMLObjectInitializer", + loc: { + start: { line: 1, column: 7 }, + end: { line: 1, column: 9 } + }, + members: [] + } +})); + +test('QtQuick.Window {}', rootObject({ + type: "QMLObjectDefinition", + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 17 } + }, + id: { + type: "QMLQualifiedID", + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 14 } + }, + parts: [ + { type: "Identifier", name: "QtQuick" }, + { type: "Identifier", name: "Window" } + ], + name: "QtQuick.Window" + }, + body: { + type: "QMLObjectInitializer", + loc: { + start: { line: 1, column: 15 }, + end: { line: 1, column: 17 } + }, + members: [] + } +})); + +test('property {}', rootObject({ + type: "QMLObjectDefinition", + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 11 } + }, + id: { + type: "QMLQualifiedID", + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 8 } + }, + parts: [{ type: "Identifier", name: "property" }], + name: "property" + }, + body: { + type: "QMLObjectInitializer", + loc: { + start: { line: 1, column: 9 }, + end: { line: 1, column: 11 } + }, + members: [] + } +})); + +test('readonly {}', rootObject({ + type: "QMLObjectDefinition", + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 11 } + }, + id: { + type: "QMLQualifiedID", + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 8 } + }, + parts: [{ type: "Identifier", name: "readonly" }], + name: "readonly" + }, + body: { + type: "QMLObjectInitializer", + loc: { + start: { line: 1, column: 9 }, + end: { line: 1, column: 11 } + }, + members: [] + } +})); + +test('signal {}', rootObject({ + type: "QMLObjectDefinition", + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 9 } + }, + id: { + type: "QMLQualifiedID", + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 6 } + }, + parts: [{ type: "Identifier", name: "signal" }], + name: "signal" + }, + body: { + type: "QMLObjectInitializer", + loc: { + start: { line: 1, column: 7 }, + end: { line: 1, column: 9 } + }, + members: [] + } +})); + +test('alias {}', rootObject({ + type: "QMLObjectDefinition", + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 8 } + }, + id: { + type: "QMLQualifiedID", + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 5 } + }, + parts: [{ type: "Identifier", name: "alias" }], + name: "alias" + }, + body: { + type: "QMLObjectInitializer", + loc: { + start: { line: 1, column: 6 }, + end: { line: 1, column: 8 } + }, + members: [] + } +})); + +test('list {}', rootObject({ + type: "QMLObjectDefinition", + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 7 } + }, + id: { + type: "QMLQualifiedID", + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 4 } + }, + parts: [{ type: "Identifier", name: "list" }], + name: "list" + }, + body: { + type: "QMLObjectInitializer", + loc: { + start: { line: 1, column: 5 }, + end: { line: 1, column: 7 } + }, + members: [] + } +})); + +test('color {}', rootObject({ + type: "QMLObjectDefinition", + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 8 } + }, + id: { + type: "QMLQualifiedID", + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 5 } + }, + parts: [{ type: "Identifier", name: "color" }], + name: "color" + }, + body: { + type: "QMLObjectInitializer", + loc: { + start: { line: 1, column: 6 }, + end: { line: 1, column: 8 } + }, + members: [] + } +})); + +test('real {}', rootObject({ + type: "QMLObjectDefinition", + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 7 } + }, + id: { + type: "QMLQualifiedID", + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 4 } + }, + parts: [{ type: "Identifier", name: "real" }], + name: "real" + }, + body: { + type: "QMLObjectInitializer", + loc: { + start: { line: 1, column: 5 }, + end: { line: 1, column: 7 } + }, + members: [] + } +})); + +test('string {}', rootObject({ + type: "QMLObjectDefinition", + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 9 } + }, + id: { + type: "QMLQualifiedID", + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 6 } + }, + parts: [{ type: "Identifier", name: "string" }], + name: "string" + }, + body: { + type: "QMLObjectInitializer", + loc: { + start: { line: 1, column: 7 }, + end: { line: 1, column: 9 } + }, + members: [] + } +})); + +test('url {}', rootObject({ + type: "QMLObjectDefinition", + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 6 } + }, + id: { + type: "QMLQualifiedID", + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 3 } + }, + parts: [{ type: "Identifier", name: "url" }], + name: "url" + }, + body: { + type: "QMLObjectInitializer", + loc: { + start: { line: 1, column: 4 }, + end: { line: 1, column: 6 } + }, + members: [] + } +})); + +test('Window {Button {}}', rootObjectMembers([{ + type: "QMLObjectDefinition", + loc: { + start: { line: 1, column: 8 }, + end: { line: 1, column: 17 } + }, + id: { + type: "QMLQualifiedID", + loc: { + start: { line: 1, column: 8 }, + end: { line: 1, column: 14 } + }, + parts: [{ type: "Identifier", name: "Button" }], + name: "Button" + }, + body: { + type: "QMLObjectInitializer", + loc: { + start: { line: 1, column: 15 }, + end: { line: 1, column: 17 } + }, + members: [] + } +}])); + +test('a{ property {} }', rootObjectMembers([{ + type: "QMLObjectDefinition", + loc: { + start: { line: 1, column: 3 }, + end: { line: 1, column: 14 } + }, + id: { + type: "QMLQualifiedID", + loc: { + start: { line: 1, column: 3 }, + end: { line: 1, column: 11 } + }, + parts: [{ type: "Identifier", name: "property" }], + name: "property" + }, + body: { + type: "QMLObjectInitializer", + loc: { + start: { line: 1, column: 12 }, + end: { line: 1, column: 14 } + }, + members: [] + } +}])); + +test('a{ readonly {} }', rootObjectMembers([{ + type: "QMLObjectDefinition", + loc: { + start: { line: 1, column: 3 }, + end: { line: 1, column: 14 } + }, + id: { + type: "QMLQualifiedID", + loc: { + start: { line: 1, column: 3 }, + end: { line: 1, column: 11 } + }, + parts: [{ type: "Identifier", name: "readonly" }], + name: "readonly" + }, + body: { + type: "QMLObjectInitializer", + loc: { + start: { line: 1, column: 12 }, + end: { line: 1, column: 14 } + }, + members: [] + } +}])); + +test('a{ signal {} }', rootObjectMembers([{ + type: "QMLObjectDefinition", + loc: { + start: { line: 1, column: 3 }, + end: { line: 1, column: 12 } + }, + id: { + type: "QMLQualifiedID", + loc: { + start: { line: 1, column: 3 }, + end: { line: 1, column: 9 } + }, + parts: [{ type: "Identifier", name: "signal" }], + name: "signal" + }, + body: { + type: "QMLObjectInitializer", + loc: { + start: { line: 1, column: 10 }, + end: { line: 1, column: 12 } + }, + members: [] + } +}])); + +testFail('a{ readonly property var as: 3 }', + "Unexpected token (1:25)", + { locations: true, loose: false }); + +test('a{ readonly property var w: 3 }', rootObjectMembers([{ + type: "QMLPropertyDeclaration", + loc: { + start: { line: 1, column: 3 }, + end: { line: 1, column: 29 } + }, + default: false, + readonly: true, + kind: { + type: "QMLPropertyType", + loc: { + start: { line: 1, column: 21 }, + end: { line: 1, column: 24 } + }, + primitive: true, + id: { type: "Identifier", name: "var"} + }, + id: { + type: "Identifier", + loc: { + start: { line: 1, column: 25 }, + end: { line: 1, column: 26 } + }, + name: "w" + }, + binding: { + type: "QMLScriptBinding", + loc: { + start: { line: 1, column: 28 }, + end: { line: 1, column: 29 } + }, + script: { + type: "Literal", + value: 3, + raw: "3" + } + } +}])); + +test('a{ default property var w: 3 }', rootObjectMembers([{ + type: "QMLPropertyDeclaration", + loc: { + start: { line: 1, column: 3 }, + end: { line: 1, column: 28 } + }, + default: true, + readonly: false, + kind: { + type: "QMLPropertyType", + loc: { + start: { line: 1, column: 20 }, + end: { line: 1, column: 23 } + }, + primitive: true, + id: { type: "Identifier", name: "var"} + }, + id: { + type: "Identifier", + loc: { + start: { line: 1, column: 24 }, + end: { line: 1, column: 25 } + }, + name: "w" + }, + binding: { + type: "QMLScriptBinding", + loc: { + start: { line: 1, column: 27 }, + end: { line: 1, column: 28 } + }, + script: { + type: "Literal", + value: 3, + raw: "3" + } + } +}])); + +testFail('a{ property var public: 3 }', + "The keyword 'public' is reserved (1:16)", + { locations: true, loose: false }); + +testFail('a{ property var export: 3 }', + "The keyword 'export' is reserved (1:16)", + { locations: true, loose: false }); + +test('a{ property var w: 3 }', rootObjectMembers([{ + type: "QMLPropertyDeclaration", + loc: { + start: { line: 1, column: 3 }, + end: { line: 1, column: 20 } + }, + default: false, + readonly: false, + kind: { + type: "QMLPropertyType", + loc: { + start: { line: 1, column: 12 }, + end: { line: 1, column: 15 } + }, + primitive: true, + id: { type: "Identifier", name: "var"} + }, + id: { + type: "Identifier", + loc: { + start: { line: 1, column: 16 }, + end: { line: 1, column: 17 } + }, + name: "w" + }, + binding: { + type: "QMLScriptBinding", + loc: { + start: { line: 1, column: 19 }, + end: { line: 1, column: 20 } + }, + script: { + type: "Literal", + value: 3, + raw: "3" + } + } +}])); + +test('a{ property boolean w: 3 }', rootObjectMembers([{ + type: "QMLPropertyDeclaration", + loc: { + start: { line: 1, column: 3 }, + end: { line: 1, column: 24 } + }, + default: false, + readonly: false, + kind: { + type: "QMLPropertyType", + loc: { + start: { line: 1, column: 12 }, + end: { line: 1, column: 19 } + }, + primitive: true, + id: { type: "Identifier", name: "boolean"} + }, + id: { + type: "Identifier", + loc: { + start: { line: 1, column: 20 }, + end: { line: 1, column: 21 } + }, + name: "w" + }, + binding: { + type: "QMLScriptBinding", + loc: { + start: { line: 1, column: 23 }, + end: { line: 1, column: 24 } + }, + script: { + type: "Literal", + value: 3, + raw: "3" + } + } +}])); + +test('a{ property double w: 3 }', rootObjectMembers([{ + type: "QMLPropertyDeclaration", + loc: { + start: { line: 1, column: 3 }, + end: { line: 1, column: 23 } + }, + default: false, + readonly: false, + kind: { + type: "QMLPropertyType", + loc: { + start: { line: 1, column: 12 }, + end: { line: 1, column: 18 } + }, + primitive: true, + id: { type: "Identifier", name: "double"} + }, + id: { + type: "Identifier", + loc: { + start: { line: 1, column: 19 }, + end: { line: 1, column: 20 } + }, + name: "w" + }, + binding: { + type: "QMLScriptBinding", + loc: { + start: { line: 1, column: 22 }, + end: { line: 1, column: 23 } + }, + script: { + type: "Literal", + value: 3, + raw: "3" + } + } +}])); + +test('a{ property int w: 3 }', rootObjectMembers([{ + type: "QMLPropertyDeclaration", + loc: { + start: { line: 1, column: 3 }, + end: { line: 1, column: 20 } + }, + default: false, + readonly: false, + kind: { + type: "QMLPropertyType", + loc: { + start: { line: 1, column: 12 }, + end: { line: 1, column: 15 } + }, + primitive: true, + id: { type: "Identifier", name: "int"} + }, + id: { + type: "Identifier", + loc: { + start: { line: 1, column: 16 }, + end: { line: 1, column: 17 } + }, + name: "w" + }, + binding: { + type: "QMLScriptBinding", + loc: { + start: { line: 1, column: 19 }, + end: { line: 1, column: 20 } + }, + script: { + type: "Literal", + value: 3, + raw: "3" + } + } +}])); + +test('a{ property list w: 3 }', rootObjectMembers([{ + type: "QMLPropertyDeclaration", + loc: { + start: { line: 1, column: 3 }, + end: { line: 1, column: 27 } + }, + default: false, + readonly: false, + kind: { + type: "QMLPropertyType", + loc: { + start: { line: 1, column: 12 }, + end: { line: 1, column: 16 } + }, + primitive: true, + id: { type: "Identifier", name: "list"}, + }, + modifier: { + type: "QMLPropertyType", + loc: { + start: { line: 1, column: 17 }, + end: { line: 1, column: 21 } + }, + primitive: false, + id: { type: "Identifier", name: "Type" } + }, + id: { + type: "Identifier", + loc: { + start: { line: 1, column: 23 }, + end: { line: 1, column: 24 } + }, + name: "w" + }, + binding: { + type: "QMLScriptBinding", + loc: { + start: { line: 1, column: 26 }, + end: { line: 1, column: 27 } + }, + script: { + type: "Literal", + value: 3, + raw: "3" + } + } +}])); + +test('a{ property color w: 3 }', rootObjectMembers([{ + type: "QMLPropertyDeclaration", + loc: { + start: { line: 1, column: 3 }, + end: { line: 1, column: 22 } + }, + default: false, + readonly: false, + kind: { + type: "QMLPropertyType", + loc: { + start: { line: 1, column: 12 }, + end: { line: 1, column: 17 } + }, + primitive: true, + id: { type: "Identifier", name: "color"} + }, + id: { + type: "Identifier", + loc: { + start: { line: 1, column: 18 }, + end: { line: 1, column: 19 } + }, + name: "w" + }, + binding: { + type: "QMLScriptBinding", + loc: { + start: { line: 1, column: 21 }, + end: { line: 1, column: 22 } + }, + script: { + type: "Literal", + value: 3, + raw: "3" + } + } +}])); + +test('a{ property real w: 3 }', rootObjectMembers([{ + type: "QMLPropertyDeclaration", + loc: { + start: { line: 1, column: 3 }, + end: { line: 1, column: 21 } + }, + default: false, + readonly: false, + kind: { + type: "QMLPropertyType", + loc: { + start: { line: 1, column: 12 }, + end: { line: 1, column: 16 } + }, + primitive: true, + id: { type: "Identifier", name: "real"} + }, + id: { + type: "Identifier", + loc: { + start: { line: 1, column: 17 }, + end: { line: 1, column: 18 } + }, + name: "w" + }, + binding: { + type: "QMLScriptBinding", + loc: { + start: { line: 1, column: 20 }, + end: { line: 1, column: 21 } + }, + script: { + type: "Literal", + value: 3, + raw: "3" + } + } +}])); + +test('a{ property string w: 3 }', rootObjectMembers([{ + type: "QMLPropertyDeclaration", + loc: { + start: { line: 1, column: 3 }, + end: { line: 1, column: 23 } + }, + default: false, + readonly: false, + kind: { + type: "QMLPropertyType", + loc: { + start: { line: 1, column: 12 }, + end: { line: 1, column: 18 } + }, + primitive: true, + id: { type: "Identifier", name: "string"} + }, + id: { + type: "Identifier", + loc: { + start: { line: 1, column: 19 }, + end: { line: 1, column: 20 } + }, + name: "w" + }, + binding: { + type: "QMLScriptBinding", + loc: { + start: { line: 1, column: 22 }, + end: { line: 1, column: 23 } + }, + script: { + type: "Literal", + value: 3, + raw: "3" + } + } +}])); + +test('a{ property url w: 3 }', rootObjectMembers([{ + type: "QMLPropertyDeclaration", + loc: { + start: { line: 1, column: 3 }, + end: { line: 1, column: 20 } + }, + default: false, + readonly: false, + kind: { + type: "QMLPropertyType", + loc: { + start: { line: 1, column: 12 }, + end: { line: 1, column: 15 } + }, + primitive: true, + id: { type: "Identifier", name: "url"} + }, + id: { + type: "Identifier", + loc: { + start: { line: 1, column: 16 }, + end: { line: 1, column: 17 } + }, + name: "w" + }, + binding: { + type: "QMLScriptBinding", + loc: { + start: { line: 1, column: 19 }, + end: { line: 1, column: 20 } + }, + script: { + type: "Literal", + value: 3, + raw: "3" + } + } +}])); + + +test('a{ property QtObject w: 3 }', rootObjectMembers([{ + type: "QMLPropertyDeclaration", + loc: { + start: { line: 1, column: 3 }, + end: { line: 1, column: 25 } + }, + default: false, + readonly: false, + kind: { + type: "QMLPropertyType", + loc: { + start: { line: 1, column: 12 }, + end: { line: 1, column: 20 } + }, + primitive: false, + id: { type: "Identifier", name: "QtObject"} + }, + id: { + type: "Identifier", + loc: { + start: { line: 1, column: 21 }, + end: { line: 1, column: 22 } + }, + name: "w" + }, + binding: { + type: "QMLScriptBinding", + loc: { + start: { line: 1, column: 24 }, + end: { line: 1, column: 25 } + }, + script: { + type: "Literal", + value: 3, + raw: "3" + } + } +}])); + +test('a{ property alias w: 3 }', rootObjectMembers([{ + type: "QMLPropertyDeclaration", + loc: { + start: { line: 1, column: 3 }, + end: { line: 1, column: 22 } + }, + default: false, + readonly: false, + kind: { + type: "QMLPropertyType", + loc: { + start: { line: 1, column: 12 }, + end: { line: 1, column: 17 } + }, + primitive: true, + id: { type: "Identifier", name: "alias"} + }, + id: { + type: "Identifier", + loc: { + start: { line: 1, column: 18 }, + end: { line: 1, column: 19 } + }, + name: "w" + }, + binding: { + type: "QMLScriptBinding", + loc: { + start: { line: 1, column: 21 }, + end: { line: 1, column: 22 } + }, + script: { + type: "Literal", + value: 3, + raw: "3" + } + } +}])); + +test('a{ w: 3 }', rootObjectMembers([{ + type: "QMLPropertyBinding", + loc: { + start: { line: 1, column: 3 }, + end: { line: 1, column: 7 } + }, + id: { + type: "QMLQualifiedID", + loc: { + start: { line: 1, column: 3 }, + end: { line: 1, column: 4 } + }, + parts: [{ type: "Identifier", name: "w" }], + name: "w" + }, + binding: { + type: "QMLScriptBinding", + loc: { + start: { line: 1, column: 6 }, + end: { line: 1, column: 7 } + }, + script: { + type: "Literal", + value: 3, + raw: "3" + } + } +}])); + +test('a{ x.y.z: 3 }', rootObjectMembers([{ + type: "QMLPropertyBinding", + loc: { + start: { line: 1, column: 3 }, + end: { line: 1, column: 11 } + }, + id: { + type: "QMLQualifiedID", + loc: { + start: { line: 1, column: 3 }, + end: { line: 1, column: 8 } + }, + parts: [ + { type: "Identifier", name: "x" }, + { type: "Identifier", name: "y" }, + { type: "Identifier", name: "z" } + ], + name: "x.y.z" + }, + binding: { + type: "QMLScriptBinding", + loc: { + start: { line: 1, column: 10 }, + end: { line: 1, column: 11 } + }, + script: { + type: "Literal", + value: 3, + raw: "3" + } + } +}])); + +testFail('a{ import: 3 }', + "Unexpected token (1:3)", + { locations: true, loose: false }); + +testFail('a{ pragma: 3 }', + "Unexpected token (1:3)", + { locations: true, loose: false }); + +testFail('a{ as: 3 }', + "Unexpected token (1:3)", + { locations: true, loose: false }); + +testFail('a{ boolean: 3 }', + "Unexpected token (1:3)", + { locations: true, loose: false }); + +testFail('a{ double: 3 }', + "Unexpected token (1:3)", + { locations: true, loose: false }); + +testFail('a{ int: 3 }', + "Unexpected token (1:3)", + { locations: true, loose: false }); + +test('a{ alias: 3 }', rootObjectMembers([{ + type: "QMLPropertyBinding", + loc: { + start: { line: 1, column: 3 }, + end: { line: 1, column: 11 } + }, + id: { + type: "QMLQualifiedID", + loc: { + start: { line: 1, column: 3 }, + end: { line: 1, column: 8 } + }, + parts: [{ type: "Identifier", name: "alias" }], + name: "alias" + }, + binding: { + type: "QMLScriptBinding", + loc: { + start: { line: 1, column: 10 }, + end: { line: 1, column: 11 } + }, + script: { + type: "Literal", + value: 3, + raw: "3" + } + } +}])); + +test('a{ list: 3 }', rootObjectMembers([{ + type: "QMLPropertyBinding", + loc: { + start: { line: 1, column: 3 }, + end: { line: 1, column: 10 } + }, + id: { + type: "QMLQualifiedID", + loc: { + start: { line: 1, column: 3 }, + end: { line: 1, column: 7 } + }, + parts: [{ type: "Identifier", name: "list" }], + name: "list" + }, + binding: { + type: "QMLScriptBinding", + loc: { + start: { line: 1, column: 9 }, + end: { line: 1, column: 10 } + }, + script: { + type: "Literal", + value: 3, + raw: "3" + } + } +}])); + +test('a{ property: 3 }', rootObjectMembers([{ + type: "QMLPropertyBinding", + loc: { + start: { line: 1, column: 3 }, + end: { line: 1, column: 14 } + }, + id: { + type: "QMLQualifiedID", + loc: { + start: { line: 1, column: 3 }, + end: { line: 1, column: 11 } + }, + parts: [{ type: "Identifier", name: "property" }], + name: "property" + }, + binding: { + type: "QMLScriptBinding", + loc: { + start: { line: 1, column: 13 }, + end: { line: 1, column: 14 } + }, + script: { + type: "Literal", + value: 3, + raw: "3" + } + } +}])); + +test('a{ readonly: 3 }', rootObjectMembers([{ + type: "QMLPropertyBinding", + loc: { + start: { line: 1, column: 3 }, + end: { line: 1, column: 14 } + }, + id: { + type: "QMLQualifiedID", + loc: { + start: { line: 1, column: 3 }, + end: { line: 1, column: 11 } + }, + parts: [{ type: "Identifier", name: "readonly" }], + name: "readonly" + }, + binding: { + type: "QMLScriptBinding", + loc: { + start: { line: 1, column: 13 }, + end: { line: 1, column: 14 } + }, + script: { + type: "Literal", + value: 3, + raw: "3" + } + } +}])); + +test('a{ signal: 3 }', rootObjectMembers([{ + type: "QMLPropertyBinding", + loc: { + start: { line: 1, column: 3 }, + end: { line: 1, column: 12 } + }, + id: { + type: "QMLQualifiedID", + loc: { + start: { line: 1, column: 3 }, + end: { line: 1, column: 9 } + }, + parts: [{ type: "Identifier", name: "signal" }], + name: "signal" + }, + binding: { + type: "QMLScriptBinding", + loc: { + start: { line: 1, column: 11 }, + end: { line: 1, column: 12 } + }, + script: { + type: "Literal", + value: 3, + raw: "3" + } + } +}])); + +test('a{ color: 3 }', rootObjectMembers([{ + type: "QMLPropertyBinding", + loc: { + start: { line: 1, column: 3 }, + end: { line: 1, column: 11 } + }, + id: { + type: "QMLQualifiedID", + loc: { + start: { line: 1, column: 3 }, + end: { line: 1, column: 8 } + }, + parts: [{ type: "Identifier", name: "color" }], + name: "color" + }, + binding: { + type: "QMLScriptBinding", + loc: { + start: { line: 1, column: 10 }, + end: { line: 1, column: 11 } + }, + script: { + type: "Literal", + value: 3, + raw: "3" + } + } +}])); + +test('a{ real: 3 }', rootObjectMembers([{ + type: "QMLPropertyBinding", + loc: { + start: { line: 1, column: 3 }, + end: { line: 1, column: 10 } + }, + id: { + type: "QMLQualifiedID", + loc: { + start: { line: 1, column: 3 }, + end: { line: 1, column: 7 } + }, + parts: [{ type: "Identifier", name: "real" }], + name: "real" + }, + binding: { + type: "QMLScriptBinding", + loc: { + start: { line: 1, column: 9 }, + end: { line: 1, column: 10 } + }, + script: { + type: "Literal", + value: 3, + raw: "3" + } + } +}])); + +test('a{ string: 3 }', rootObjectMembers([{ + type: "QMLPropertyBinding", + loc: { + start: { line: 1, column: 3 }, + end: { line: 1, column: 12 } + }, + id: { + type: "QMLQualifiedID", + loc: { + start: { line: 1, column: 3 }, + end: { line: 1, column: 9 } + }, + parts: [{ type: "Identifier", name: "string" }], + name: "string" + }, + binding: { + type: "QMLScriptBinding", + loc: { + start: { line: 1, column: 11 }, + end: { line: 1, column: 12 } + }, + script: { + type: "Literal", + value: 3, + raw: "3" + } + } +}])); + +test('a{ url: 3 }', rootObjectMembers([{ + type: "QMLPropertyBinding", + loc: { + start: { line: 1, column: 3 }, + end: { line: 1, column: 9 } + }, + id: { + type: "QMLQualifiedID", + loc: { + start: { line: 1, column: 3 }, + end: { line: 1, column: 6 } + }, + parts: [{ type: "Identifier", name: "url" }], + name: "url" + }, + binding: { + type: "QMLScriptBinding", + loc: { + start: { line: 1, column: 8 }, + end: { line: 1, column: 9 } + }, + script: { + type: "Literal", + value: 3, + raw: "3" + } + } +}])); + +test('a{ onClicked: Qt.quit(0) }', rootObjectMembers([{ + type: "QMLPropertyBinding", + loc: { + start: { line: 1, column: 3 }, + end: { line: 1, column: 24 } + }, + id: { + type: "QMLQualifiedID", + loc: { + start: { line: 1, column: 3 }, + end: { line: 1, column: 12 } + }, + parts: [{ type: "Identifier", name: "onClicked" }], + name: "onClicked" + }, + binding: { + type: "QMLScriptBinding", + loc: { + start: { line: 1, column: 14 }, + end: { line: 1, column: 24 } + }, + script: { + type: "CallExpression", + callee: { + type: "MemberExpression", + loc: { + start: { line: 1, column: 14 }, + end: { line: 1, column: 21 } + }, + object: { + type: "Identifier", + loc: { + start: { line: 1, column: 14 }, + end: { line: 1, column: 16 } + }, + name: "Qt" + }, + property: { + type: "Identifier", + loc: { + start: { line: 1, column: 17 }, + end: { line: 1, column: 21 } + }, + name: "quit" + }, + computed: false + }, + arguments: [{ + type: "Literal", + loc: { + start: { line: 1, column: 22 }, + end: { line: 1, column: 23 } + }, + value: 0, + raw: "0" + }] + } + } +}])); + +test('a{b:pragma}', javaScript({ + type: "Identifier", + loc: { + start: { line: 1, column: 4 }, + end: { line: 1, column: 10 } + }, + name: "pragma" +})); + +test('a{b:property}', javaScript({ + type: "Identifier", + loc: { + start: { line: 1, column: 4 }, + end: { line: 1, column: 12 } + }, + name: "property" +})); + +test('a{b:readonly}', javaScript({ + type: "Identifier", + loc: { + start: { line: 1, column: 4 }, + end: { line: 1, column: 12 } + }, + name: "readonly" +})); + +test('a{b:signal}', javaScript({ + type: "Identifier", + loc: { + start: { line: 1, column: 4 }, + end: { line: 1, column: 10 } + }, + name: "signal" +})); + +test('a{b:alias}', javaScript({ + type: "Identifier", + loc: { + start: { line: 1, column: 4 }, + end: { line: 1, column: 9 } + }, + name: "alias" +})); + +test('a{b:list}', javaScript({ + type: "Identifier", + loc: { + start: { line: 1, column: 4 }, + end: { line: 1, column: 8 } + }, + name: "list" +})); + +test('a{b:color}', javaScript({ + type: "Identifier", + loc: { + start: { line: 1, column: 4 }, + end: { line: 1, column: 9 } + }, + name: "color" +})); + +test('a{b:real}', javaScript({ + type: "Identifier", + loc: { + start: { line: 1, column: 4 }, + end: { line: 1, column: 8 } + }, + name: "real" +})); + +test('a{b:string}', javaScript({ + type: "Identifier", + loc: { + start: { line: 1, column: 4 }, + end: { line: 1, column: 10 } + }, + name: "string" +})); + +test('a{b:url}', javaScript({ + type: "Identifier", + loc: { + start: { line: 1, column: 4 }, + end: { line: 1, column: 7 } + }, + name: "url" +})); + +test('a{b:[]}', javaScript({ + type: "ArrayExpression", + loc: { + start: { line: 1, column: 4 }, + end: { line: 1, column: 6 } + }, + elements: [] +})); + +test('a{b:[{}]}', javaScript({ + type: "ArrayExpression", + loc: { + start: { line: 1, column: 4 }, + end: { line: 1, column: 8 } + }, + elements: [{ + type: "ObjectExpression", + loc: { + start: { line: 1, column: 5 }, + end: { line: 1, column: 7 } + }, + }] +})); + +test('a{ function fn() {} }', rootObjectMembers([{ + type: "FunctionDeclaration", + loc: { + start: { line: 1, column: 3 }, + end: { line: 1, column: 19 } + }, + id: { + type: "Identifier", + loc: { + start: { line: 1, column: 12 }, + end: { line: 1, column: 14 } + }, + name: "fn" + }, + params: [], + body: { + type: "BlockStatement", + loc: { + start: { line: 1, column: 17 }, + end: { line: 1, column: 19 } + }, + body: [] + } +}])); + +test('a{ function add(a, b) { return a + b } }', rootObjectMembers([{ + type: "FunctionDeclaration", + loc: { + start: { line: 1, column: 3 }, + end: { line: 1, column: 38 } + }, + id: { + type: "Identifier", + name: "add" + }, + params: [ + { type: "Identifier", name: "a" }, + { type: "Identifier", name: "b" } + ], + body: { + type: "BlockStatement", + loc: { + start: { line: 1, column: 22 }, + end: { line: 1, column: 38 } + }, + body: [{ + type: "ReturnStatement", + argument: { + type: "BinaryExpression", + left: { type: "Identifier", name: "a" }, + operator: "+", + right: { type: "Identifier", name: "b" } + } + }] + } +}])); + +testFail('a{ function () {} }', + "Unexpected token (1:12)", + { locations: true, loose: false }); + +test('a{ signal b }', rootObjectMembers([{ + type: "QMLSignalDefinition", + loc: { + start: { line: 1, column: 3 }, + end: { line: 1, column: 11 } + }, + id: { + type: "Identifier", + loc: { + start: { line: 1, column: 10 }, + end: { line: 1, column: 11 } + }, + name: "b" + }, + params: [] +}])); + +test('a{ signal b () }', rootObjectMembers([{ + type: "QMLSignalDefinition", + loc: { + start: { line: 1, column: 3 }, + end: { line: 1, column: 14 } + }, + id: { + type: "Identifier", + loc: { + start: { line: 1, column: 10 }, + end: { line: 1, column: 11 } + }, + name: "b" + }, + params: [] +}])); + +test('a{ signal b (type param)}', rootObjectMembers([{ + type: "QMLSignalDefinition", + loc: { + start: { line: 1, column: 3 }, + end: { line: 1, column: 24 } + }, + id: { + type: "Identifier", + loc: { + start: { line: 1, column: 10 }, + end: { line: 1, column: 11 } + }, + name: "b" + }, + params: [{ + type: "QMLParameter", + loc: { + start: { line: 1, column: 13 }, + end: { line: 1, column: 23 } + }, + kind: { + type: "QMLPropertyType", + loc: { + start: { line: 1, column: 13 }, + end: { line: 1, column: 17 } + }, + primitive: false, + id: { type: "Identifier", name: "type" } + }, + id: { + type: "Identifier", + loc: { + start: { line: 1, column: 18 }, + end: { line: 1, column: 23 } + }, + name: "param" + } + }] +}])); + +test('a{ signal b (type1 param1, type2 param2, type3 param3)}', rootObjectMembers([{ + type: "QMLSignalDefinition", + loc: { + start: { line: 1, column: 3 }, + end: { line: 1, column: 54 } + }, + id: { + type: "Identifier", + loc: { + start: { line: 1, column: 10 }, + end: { line: 1, column: 11 } + }, + name: "b" + }, + params: [ + { + type: "QMLParameter", + loc: { + start: { line: 1, column: 13 }, + end: { line: 1, column: 25 } + }, + kind: { + type: "QMLPropertyType", + loc: { + start: { line: 1, column: 13 }, + end: { line: 1, column: 18 } + }, + primitive: false, + id: { type: "Identifier", name: "type1" } + }, + id: { + type: "Identifier", + loc: { + start: { line: 1, column: 19 }, + end: { line: 1, column: 25 } + }, + name: "param1" + } + }, + { + type: "QMLParameter", + loc: { + start: { line: 1, column: 27 }, + end: { line: 1, column: 39 } + }, + kind: { + type: "QMLPropertyType", + loc: { + start: { line: 1, column: 27 }, + end: { line: 1, column: 32 } + }, + primitive: false, + id: { type: "Identifier", name: "type2" } + }, + id: { + type: "Identifier", + loc: { + start: { line: 1, column: 33 }, + end: { line: 1, column: 39 } + }, + name: "param2" + } + }, + { + type: "QMLParameter", + loc: { + start: { line: 1, column: 41 }, + end: { line: 1, column: 53 } + }, + kind: { + type: "QMLPropertyType", + loc: { + start: { line: 1, column: 41 }, + end: { line: 1, column: 46 } + }, + primitive: false, + id: { type: "Identifier", name: "type3" } + }, + id: { + type: "Identifier", + loc: { + start: { line: 1, column: 47 }, + end: { line: 1, column: 53 } + }, + name: "param3" + } + } + ] +}])); + +test('a{ id: test }', rootObjectMembers([{ + type: "QMLPropertyBinding", + loc: { + start: { line: 1, column: 3 }, + end: { line: 1, column: 11 } + }, + id: { + type: "QMLQualifiedID", + loc: { + start: { line: 1, column: 3 }, + end: { line: 1, column: 5 } + }, + parts: [{ + type: "Identifier", + loc: { + start: { line: 1, column: 3 }, + end: { line: 1, column: 5 } + }, + name: "id" + }], + name: "id" + }, + binding: { + type: "QMLScriptBinding", + loc: { + start: { line: 1, column: 7 }, + end: { line: 1, column: 11 } + }, + script: { + type: "Identifier", + name: "test" + } + } +}])); + +/* +* Test the base QML Hello World program created by Eclipse CDT. +*/ +test('import QtQuick 2.3\nimport QtQuick.Window 2.2\nWindow {\n\tvisible: true\n\n\tMouseArea {\n\t\tanchors.fill: parent\n\t\tonClicked: {\n\t\t\tQt.quit();\n\t\t}\n\t}\n\tText {\n\t\ttext: qsTr("Hello World")\n\t\tanchors.centerIn: parent\n\t}\n}', + program([{ + type: "QMLImport", + loc: { + start: { line: 1, column: 0 + }, + end: { line: 1, column: 18 } + }, + module: { + type: "QMLModule", + loc: { + start: { line: 1, column: 7 }, + end: { line: 1, column: 18 } + }, + id: { + type: "QMLQualifiedID", + loc: { + start: { line: 1, column: 7 }, + end: { line: 1, column: 14 } + }, + parts: [{ type: "Identifier", name: "QtQuick" }], + name: "QtQuick" + }, + version: { + type: "QMLVersionLiteral", + loc: { + start: { line: 1, column: 15 }, + end: { line: 1, column: 18 } + }, + raw: "2.3", + } + } + }, + { + type: "QMLImport", + loc: { + start: { line: 2, column: 0 }, + end: { line: 2, column: 25 } + }, + module: { + type: "QMLModule", + loc: { + start: { line: 2, column: 7 }, + end: { line: 2, column: 25 } + }, + id: { + type: "QMLQualifiedID", + loc: { + start: { line: 2, column: 7 }, + end: { line: 2, column: 21 } + }, + parts: [ + { type: "Identifier", name: "QtQuick" }, + { type: "Identifier", name: "Window" } + ], + name: "QtQuick.Window" + }, + version: { + type: "QMLVersionLiteral", + loc: { + start: { line: 2, column: 22 }, + end: { line: 2, column: 25 } + }, + raw: "2.2", + } + } + }],{ + type: "QMLObjectDefinition", + loc: { + start: { line: 3, column: 0 }, + end: { line: 16, column: 1 } + }, + id: { + type: "QMLQualifiedID", + loc: { + start: { line: 3, column: 0 }, + end: { line: 3, column: 6 } + }, + parts: [{ type: "Identifier", name: "Window" }], + name: "Window" + }, + body: { + type: "QMLObjectInitializer", + loc: { + start: { line: 3, column: 7 }, + end: { line: 16, column: 1 } + }, + members: [ + { + type: "QMLPropertyBinding", + loc: { + start: { line: 4, column: 1 }, + end: { line: 4, column: 14 } + }, + id: { + type: "QMLQualifiedID", + loc: { + start: { line: 4, column: 1 }, + end: { line: 4, column: 8 } + }, + parts: [{ type: "Identifier", name: "visible" }], + name: "visible" + }, + binding: { + type: "QMLScriptBinding", + loc: { + start: { line: 4, column: 10 }, + end: { line: 4, column: 14 } + }, + script: { + type: "Literal", + value: true, + raw: "true" + } + } + }, + { + type: "QMLObjectDefinition", + loc: { + start: { line: 6, column: 1 }, + end: { line: 11, column: 2 } + }, + id: { + type: "QMLQualifiedID", + loc: { + start: { line: 6, column: 1 }, + end: { line: 6, column: 10 } + }, + parts: [{ type: "Identifier", name: "MouseArea" }], + name: "MouseArea" + }, + body: { + type: "QMLObjectInitializer", + loc: { + start: { line: 6, column: 11 }, + end: { line: 11, column: 2 } + }, + members: [ + { + type: "QMLPropertyBinding", + loc: { + start: { line: 7, column: 2 }, + end: { line: 7, column: 22 } + }, + id: { + type: "QMLQualifiedID", + loc: { + start: { line: 7, column: 2 }, + end: { line: 7, column: 14 } + }, + parts: [ + { type: "Identifier", name: "anchors" }, + { type: "Identifier", name: "fill" } + ], + name: "anchors.fill" + }, + binding: { + type: "QMLScriptBinding", + loc: { + start: { line: 7, column: 16 }, + end: { line: 7, column: 22 } + }, + script: { + type: "Identifier", + name: "parent" + } + } + }, + { + type: "QMLPropertyBinding", + loc: { + start: { line: 8, column: 2 }, + end: { line: 10, column: 3 } + }, + id: { + type: "QMLQualifiedID", + loc: { + start: { line: 8, column: 2 }, + end: { line: 8, column: 11 } + }, + parts: [{ type: "Identifier", name: "onClicked" }], + name: "onClicked" + }, + binding: { + type: "QMLScriptBinding", + loc: { + start: { line: 8, column: 13 }, + end: { line: 10, column: 3 } + }, + script: { + type: "QMLStatementBlock", + body: [{ + type: "ExpressionStatement", + expression: { + type: "CallExpression", + callee: { + type: "MemberExpression", + object: { + type: "Identifier", + name: "Qt" + }, + property: { + type: "Identifier", + name: "quit" + }, + computed: false + }, + arguments: [] + } + }] + } + } + } + ] + } + }, + { + type: "QMLObjectDefinition", + loc: { + start: { line: 12, column: 1 }, + end: { line: 15, column: 2 } + }, + id: { + type: "QMLQualifiedID", + loc: { + start: { line: 12, column: 1 }, + end: { line: 12, column: 5 } + }, + parts: [{ type: "Identifier", name: "Text" }], + name: "Text" + }, + body: { + type: "QMLObjectInitializer", + loc: { + start: { line: 12, column: 6 }, + end: { line: 15, column: 2 } + }, + members: [ + { + type: "QMLPropertyBinding", + loc: { + start: { line: 13, column: 2 }, + end: { line: 13, column: 27 } + }, + id: { + type: "QMLQualifiedID", + loc: { + start: { line: 13, column: 2 }, + end: { line: 13, column: 6 } + }, + parts: [{ type: "Identifier", name: "text" }], + name: "text" + }, + binding: { + type: "QMLScriptBinding", + loc: { + start: { line: 13, column: 8 }, + end: { line: 13, column: 27 } + }, + script: { + type: "CallExpression", + callee: { + type: "Identifier", + name: "qsTr" + }, + arguments: [{ + type: "Literal", + value: "Hello World", + raw: "\"Hello World\"" + }] + } + } + }, + { + type: "QMLPropertyBinding", + loc: { + start: { line: 14, column: 2 }, + end: { line: 14, column: 26 } + }, + id: { + type: "QMLQualifiedID", + loc: { + start: { line: 14, column: 2 }, + end: { line: 14, column: 18 } + }, + parts: [ + { type: "Identifier", name: "anchors" }, + { type: "Identifier", name: "centerIn" } + ], + name: "anchors.centerIn" + }, + binding: { + type: "QMLScriptBinding", + script: { + type: "Identifier", + name: "parent" + } + } + } + ] + } + } + ] + } + } +), { locations: true, qmltypes: false }); + +/*************************************************************************** +* Loose Parser Tests * +****************************************************************************/ +function testLoose(code, ast, options) { + var opts = options || {}; + opts.loose = true; + opts.normal = false; + opts.locations = true; + test(code, ast, opts); +} + +testLoose('import QtQuick', headerItemList([{ + type: "QMLImport", + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 14 } + }, + module: { + type: "QMLModule", + loc: { + start: { line: 1, column: 7 }, + end: { line: 1, column: 14 } + }, + id: { + type: "QMLQualifiedID", + loc: { + start: { line: 1, column: 7 }, + end: { line: 1, column: 14 } + }, + parts: [{ type: "Identifier", name: "QtQuick" }], + name: "QtQuick" + }, + version: { + type: "QMLVersionLiteral", + loc: { + start: { line: 1, column: 14 }, + end: { line: 1, column: 14 } + }, + value: 0, + raw: "0.0" + } + } +}])); + +testLoose('import ', headerItemList([{ + type: "QMLImport", + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 7 } + }, + module: { + type: "QMLModule", + loc: { + start: { line: 1, column: 7 }, + end: { line: 1, column: 7 } + }, + id: { + type: "QMLQualifiedID", + loc: { + start: { line: 1, column: 7 }, + end: { line: 1, column: 7 } + }, + parts: [{ type: "Identifier", name: "✖" }], + name: "✖" + }, + version: { + type: "QMLVersionLiteral", + loc: { + start: { line: 1, column: 7 }, + end: { line: 1, column: 7 } + }, + value: 0, + raw: "0.0" + } + } +}])); + +testLoose('import QtQuick 0x01', headerItemList([{ + type: "QMLImport", + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 19 } + }, + module: { + type: "QMLModule", + loc: { + start: { line: 1, column: 7 }, + end: { line: 1, column: 19 } + }, + id: { + type: "QMLQualifiedID", + loc: { + start: { line: 1, column: 7 }, + end: { line: 1, column: 14 } + }, + parts: [{ type: "Identifier", name: "QtQuick" }], + name: "QtQuick" + }, + version: { + type: "QMLVersionLiteral", + loc: { + start: { line: 1, column: 15 }, + end: { line: 1, column: 19 } + }, + value: 1, + raw: "0x01" + } + } +}])); + +testLoose('import QtQuick 1', headerItemList([{ + type: "QMLImport", + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 16 } + }, + module: { + type: "QMLModule", + loc: { + start: { line: 1, column: 7 }, + end: { line: 1, column: 16 } + }, + id: { + type: "QMLQualifiedID", + loc: { + start: { line: 1, column: 7 }, + end: { line: 1, column: 14 } + }, + parts: [{ type: "Identifier", name: "QtQuick" }], + name: "QtQuick" + }, + version: { + type: "QMLVersionLiteral", + loc: { + start: { line: 1, column: 15 }, + end: { line: 1, column: 16 } + }, + value: 1, + raw: "1" + } + } +}])); + +testLoose('import "./file.js', headerItemList([{ + type: "QMLImport", + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 17 } + }, + directory: { + type: "Literal", + loc: { + start: { line: 1, column: 7 }, + end: { line: 1, column: 17 } + }, + value: "./file.js", + raw: "\"./file.js" + } +}])); + +testLoose('import QtQuick 2.2 as ', headerItemList([{ + type: "QMLImport", + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 22 } + }, + module: { + type: "QMLModule", + loc: { + start: { line: 1, column: 7 }, + end: { line: 1, column: 18 } + }, + id: { + type: "QMLQualifiedID", + loc: { + start: { line: 1, column: 7 }, + end: { line: 1, column: 14 } + }, + parts: [{ type: "Identifier", name: "QtQuick" }], + name: "QtQuick" + }, + version: { + type: "QMLVersionLiteral", + loc: { + start: { line: 1, column: 15 }, + end: { line: 1, column: 18 } + }, + value: 2.2, + raw: "2.2" + } + }, + qualifier: { + type: "QMLQualifier", + loc: { + start: { line: 1, column: 19 }, + end: { line: 1, column: 22 } + }, + id: { + type: "Identifier", + loc: { + start: { line: 1, column: 22 }, + end: { line: 1, column: 22 } + }, + name: "✖" + } + } +}])); + +testLoose('Window {', rootObject({ + type: "QMLObjectDefinition", + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 8 } + }, + id: { + type: "QMLQualifiedID", + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 6 } + }, + parts: [{ type: "Identifier", name: "Window" }], + name: "Window" + }, + body: { + type: "QMLObjectInitializer", + loc: { + start: { line: 1, column: 7 }, + end: { line: 1, column: 8 } + }, + members: [] + } +})); + +testLoose('Window {\n\tprop: 3', rootObject({ + type: "QMLObjectDefinition", + loc: { + start: { line: 1, column: 0 }, + end: { line: 2, column: 8 } + }, + id: { + type: "QMLQualifiedID", + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 6 } + }, + parts: [{ type: "Identifier", name: "Window" }], + name: "Window" + }, + body: { + type: "QMLObjectInitializer", + loc: { + start: { line: 1, column: 7 }, + end: { line: 2, column: 8 } + }, + members: [{ + type: "QMLPropertyBinding", + loc: { + start: { line: 2, column: 1 }, + end: { line: 2, column: 8 } + }, + id: { + type: "QMLQualifiedID", + loc: { + start: { line: 2, column: 1 }, + end: { line: 2, column: 5 } + }, + parts: [{ type: "Identifier", name: "prop" }], + name: "prop" + }, + binding: { + type: "QMLScriptBinding", + loc: { + start: { line: 2, column: 7 }, + end: { line: 2, column: 8 } + }, + script: { + type: "Literal", + value: 3, + raw: "3" + } + } + }] + } +})); + +testLoose('a {\n\tb {\n\n\tc {\n}', rootObject({ + type: "QMLObjectDefinition", + loc: { + start: { line: 1, column: 0 }, + end: { line: 5, column: 1 } + }, + id: { + type: "QMLQualifiedID", + loc: { + start: { line: 1, column: 0 }, + end: { line: 1, column: 1 } + }, + parts: [{ type: "Identifier", name: "a" }], + name: "a" + }, + body: { + type: "QMLObjectInitializer", + loc: { + start: { line: 1, column: 2 }, + end: { line: 5, column: 1 } + }, + members: [{ + type: "QMLObjectDefinition", + loc: { + start: { line: 2, column: 1 }, + end: { line: 5, column: 1 } + }, + id: { + type: "QMLQualifiedID", + loc: { + start: { line: 2, column: 1 }, + end: { line: 2, column: 2 } + }, + parts: [{ type: "Identifier", name: "b" }], + name: "b" + }, + body: { + type: "QMLObjectInitializer", + loc: { + start: { line: 2, column: 3 }, + end: { line: 5, column: 1 } + }, + members: [{ + type: "QMLObjectDefinition", + loc: { + start: { line: 4, column: 1 }, + end: { line: 5, column: 1 } + }, + id: { + type: "QMLQualifiedID", + loc: { + start: { line: 4, column: 1 }, + end: { line: 4, column: 2 } + }, + parts: [{ type: "Identifier", name: "c" }], + name: "c" + }, + body: { + type: "QMLObjectInitializer", + loc: { + start: { line: 4, column: 3 }, + end: { line: 5, column: 1 } + }, + members: [] + } + }] + } + }] + } +})); + +testLoose('a{ property var }', rootObjectMembers([{ + type: "QMLPropertyDeclaration", + loc: { + start: { line: 1, column: 3 }, + end: { line: 1, column: 17 } + }, + default: false, + readonly: false, + kind: { + type: "QMLPropertyType", + loc: { + start: { line: 1, column: 12 }, + end: { line: 1, column: 15 } + }, + primitive: true, + id: { type: "Identifier", name: "var"} + }, + id: { + type: "Identifier", + loc: { + start: { line: 1, column: 17 }, + end: { line: 1, column: 17 } + }, + name: "✖" + }, + binding: null +}])); + +testLoose('a{ w }', rootObjectMembers([{ + type: "QMLPropertyBinding", + loc: { + start: { line: 1, column: 3 }, + end: { line: 1, column: 5 } + }, + id: { + type: "QMLQualifiedID", + loc: { + start: { line: 1, column: 3 }, + end: { line: 1, column: 4 } + }, + parts: [{ type: "Identifier", name: "w" }], + name: "w" + }, + binding: { + type: "QMLScriptBinding", + loc: { + start: { line: 1, column: 5 }, + end: { line: 1, column: 5 } + }, + script: { + type: "Identifier", + name: "✖" + } + } +}])); + +testLoose('a{ w: }', rootObjectMembers([{ + type: "QMLPropertyBinding", + loc: { + start: { line: 1, column: 3 }, + end: { line: 1, column: 7 } + }, + id: { + type: "QMLQualifiedID", + loc: { + start: { line: 1, column: 3 }, + end: { line: 1, column: 4 } + }, + parts: [{ type: "Identifier", name: "w" }], + name: "w" + }, + binding: { + type: "QMLScriptBinding", + loc: { + start: { line: 1, column: 4 }, + end: { line: 1, column: 7 } + }, + script: { + type: "Identifier", + name: "✖" + } + } +}])); + +testLoose('a{ : 3 }', rootObjectMembers([{ + type: "QMLPropertyBinding", + loc: { + start: { line: 1, column: 3 }, + end: { line: 1, column: 6 } + }, + id: { + type: "QMLQualifiedID", + loc: { + start: { line: 1, column: 3 }, + end: { line: 1, column: 3 } + }, + parts: [{ type: "Identifier", name: "✖" }], + name: "✖" + }, + binding: { + type: "QMLScriptBinding", + loc: { + start: { line: 1, column: 5 }, + end: { line: 1, column: 6 } + }, + script: { + type: "Literal", + value: 3, + raw: "3" + } + } +}])); + +testLoose('a{ anchors.: 3 }', rootObjectMembers([{ + type: "QMLPropertyBinding", + loc: { + start: { line: 1, column: 3 }, + end: { line: 1, column: 14 } + }, + id: { + type: "QMLQualifiedID", + loc: { + start: { line: 1, column: 3 }, + end: { line: 1, column: 11 } + }, + parts: [ + { type: "Identifier", name: "anchors" }, + { type: "Identifier", name: "✖" } + ], + name: "anchors.✖" + }, + binding: { + type: "QMLScriptBinding", + loc: { + start: { line: 1, column: 13 }, + end: { line: 1, column: 14 } + }, + script: { + type: "Literal", + value: 3, + raw: "3" + } + } +}])); + +testLoose('a{ anchors..: 3 }', rootObjectMembers([{ + type: "QMLPropertyBinding", + loc: { + start: { line: 1, column: 3 }, + end: { line: 1, column: 15 } + }, + id: { + type: "QMLQualifiedID", + loc: { + start: { line: 1, column: 3 }, + end: { line: 1, column: 12 } + }, + parts: [ + { type: "Identifier", name: "anchors" }, + { type: "Identifier", name: "✖" }, + { type: "Identifier", name: "✖" } + ], + name: "anchors.✖.✖" + }, + binding: { + type: "QMLScriptBinding", + loc: { + start: { line: 1, column: 14 }, + end: { line: 1, column: 15 } + }, + script: { + type: "Literal", + value: 3, + raw: "3" + } + } +}])); + +testLoose('a{ ..: 3 }', rootObjectMembers([{ + type: "QMLPropertyBinding", + loc: { + start: { line: 1, column: 3 }, + end: { line: 1, column: 8 } + }, + id: { + type: "QMLQualifiedID", + loc: { + start: { line: 1, column: 3 }, + end: { line: 1, column: 5 } + }, + parts: [ + { type: "Identifier", name: "✖" }, + { type: "Identifier", name: "✖" }, + { type: "Identifier", name: "✖" } + ], + name: "✖.✖.✖" + }, + binding: { + type: "QMLScriptBinding", + loc: { + start: { line: 1, column: 7 }, + end: { line: 1, column: 8 } + }, + script: { + type: "Literal", + value: 3, + raw: "3" + } + } +}])); + +testLoose('a{ var }', rootObjectMembers([{ + type: "QMLPropertyDeclaration", + loc: { + start: { line: 1, column: 3 }, + end: { line: 1, column: 7 } + }, + default: false, + readonly: false, + kind: { + type: "QMLPropertyType", + loc: { + start: { line: 1, column: 3 }, + end: { line: 1, column: 6 } + }, + primitive: true, + id: { type: "Identifier", name: "var"} + }, + id: { + type: "Identifier", + loc: { + start: { line: 1, column: 7 }, + end: { line: 1, column: 7 } + }, + name: "✖" + }, + binding: null +}])); + +testLoose('a{ var w }', rootObjectMembers([{ + type: "QMLPropertyDeclaration", + loc: { + start: { line: 1, column: 3 }, + end: { line: 1, column: 8 } + }, + default: false, + readonly: false, + kind: { + type: "QMLPropertyType", + loc: { + start: { line: 1, column: 3 }, + end: { line: 1, column: 6 } + }, + primitive: true, + id: { type: "Identifier", name: "var"} + }, + id: { + type: "Identifier", + loc: { + start: { line: 1, column: 7 }, + end: { line: 1, column: 8 } + }, + name: "w" + }, + binding: null +}])); + +testLoose('a{ obj w }', rootObjectMembers([{ + type: "QMLPropertyDeclaration", + loc: { + start: { line: 1, column: 3 }, + end: { line: 1, column: 8 } + }, + default: false, + readonly: false, + kind: { + type: "QMLPropertyType", + loc: { + start: { line: 1, column: 3 }, + end: { line: 1, column: 6 } + }, + primitive: false, + id: { type: "Identifier", name: "obj"} + }, + id: { + type: "Identifier", + loc: { + start: { line: 1, column: 7 }, + end: { line: 1, column: 8 } + }, + name: "w" + }, + binding: null +}])); + +// TODO: Allow this to run with the normal parser once the ambiguity is solved +testLoose('a{ property var b: Window {} }', rootObjectMembers([{ + type: "QMLPropertyDeclaration", + loc: { + start: { line: 1, column: 3 }, + end: { line: 1, column: 28 } + }, + default: false, + readonly: false, + kind: { + type: "QMLPropertyType", + loc: { + start: { line: 1, column: 12 }, + end: { line: 1, column: 15 } + }, + primitive: true, + id: { type: "Identifier", name: "var"} + }, + id: { + type: "Identifier", + loc: { + start: { line: 1, column: 16 }, + end: { line: 1, column: 17 } + }, + name: "b" + }, + binding: { + type: "QMLObjectBinding", + loc: { + start: { line: 1, column: 19 }, + end: { line: 1, column: 28 } + }, + id: { + type: "QMLQualifiedID", + loc: { + start: { line: 1, column: 19 }, + end: { line: 1, column: 25 } + }, + parts: [{ type: "Identifier", name: "Window" }], + name: "Window" + }, + body: { + type: "QMLObjectInitializer", + loc: { + start: { line: 1, column: 26 }, + end: { line: 1, column: 28 } + }, + members: [] + } + } +}]), { locations: true, qmltypes: false }); + +// TODO: Allow this to run with the normal parser once the ambiguity is solved +testLoose('a{ b: Window {} }', rootObjectMembers([{ + type: "QMLPropertyBinding", + loc: { + start: { line: 1, column: 3 }, + end: { line: 1, column: 15 } + }, + id: { + type: "QMLQualifiedID", + loc: { + start: { line: 1, column: 3 }, + end: { line: 1, column: 4 } + }, + parts: [{ type: "Identifier", name: "b" }], + name: "b" + }, + binding: { + type: "QMLObjectBinding", + loc: { + start: { line: 1, column: 6 }, + end: { line: 1, column: 15 } + }, + id: { + type: "QMLQualifiedID", + loc: { + start: { line: 1, column: 6 }, + end: { line: 1, column: 12 } + }, + parts: [{ type: "Identifier", name: "Window" }], + name: "Window" + }, + body: { + type: "QMLObjectInitializer", + loc: { + start: { line: 1, column: 13 }, + end: { line: 1, column: 15 } + }, + members: [] + } + } +}]), { locations: true, qmltypes: false }); + +testLoose('a{ signal }', rootObjectMembers([{ + type: "QMLSignalDefinition", + loc: { + start: { line: 1, column: 3 }, + end: { line: 1, column: 10 } + }, + id: { + type: "Identifier", + loc: { + start: { line: 1, column: 10 }, + end: { line: 1, column: 10 } + }, + name: "✖" + }, + params: [] +}])); + +testLoose('a{ signal () }', rootObjectMembers([{ + type: "QMLSignalDefinition", + loc: { + start: { line: 1, column: 3 }, + end: { line: 1, column: 12 } + }, + id: { + type: "Identifier", + loc: { + start: { line: 1, column: 10 }, + end: { line: 1, column: 10 } + }, + name: "✖" + }, + params: [] +}])); + +testLoose('a{ signal test( }', rootObjectMembers([{ + type: "QMLSignalDefinition", + loc: { + start: { line: 1, column: 3 }, + end: { line: 1, column: 16 } + }, + id: { + type: "Identifier", + loc: { + start: { line: 1, column: 10 }, + end: { line: 1, column: 14 } + }, + name: "test" + }, + params: [] +}])); + +testLoose('a{ signal test(int test }', rootObjectMembers([{ + type: "QMLSignalDefinition", + loc: { + start: { line: 1, column: 3 }, + end: { line: 1, column: 24 } + }, + id: { + type: "Identifier", + loc: { + start: { line: 1, column: 10 }, + end: { line: 1, column: 14 } + }, + name: "test" + }, + params: [{ + type: "QMLParameter", + loc: { + start: { line: 1, column: 15 }, + end: { line: 1, column: 23 } + }, + kind: { + type: "QMLPropertyType", + loc: { + start: { line: 1, column: 15 }, + end: { line: 1, column: 18 } + }, + primitive: true, + id: { type: "Identifier", name: "int" } + }, + id: { + type: "Identifier", + loc: { + start: { line: 1, column: 19 }, + end: { line: 1, column: 23 } + }, + name: "test" + } + }] +}])); + +testLoose('Window {\n\tfunction\n\tproperty var prop\n}', rootObjectMembers([ + { + type: "FunctionDeclaration", + loc: { + start: { line: 2, column: 1 }, + end: { line: 3, column: 9 } + }, + id: { + type: "Identifier", + loc: { + start: { line: 3, column: 1 }, + end: { line: 3, column: 9 } + }, + name: "property" + }, + params: [], + body: { + type: "BlockStatement", + loc: { + start: { line: 3, column: 9 }, + end: { line: 3, column: 9 } + }, + body: [] + } + }, + { + type: "QMLPropertyDeclaration", + loc: { + start: { line: 3, column: 10 }, + end: { line: 3, column: 18 } + }, + default: false, + readonly: false, + kind: { + type: "QMLPropertyType", + loc: { + start: { line: 3, column: 10 }, + end: { line: 3, column: 13 } + }, + primitive: true, + id: { type: "Identifier", name: "var"} + }, + id: { + type: "Identifier", + loc: { + start: { line: 3, column: 14 }, + end: { line: 3, column: 18 } + }, + name: "prop" + }, + binding: null + } +])); + +testLoose('Window {\n\tfunction (something)\n\tproperty var prop\n}', rootObjectMembers([ + { + type: "FunctionDeclaration", + loc: { + start: { line: 2, column: 1 }, + end: { line: 2, column: 21 } + }, + id: { + type: "Identifier", + loc: { + start: { line: 2, column: 10 }, + end: { line: 2, column: 10 } + }, + name: "✖" + }, + params: [ + { + type: "Identifier", + loc: { + start: { line: 2, column: 11 }, + end: { line: 2, column: 20 } + }, + name: "something" + } + ], + body: { + type: "BlockStatement", + loc: { + start: { line: 2, column: 21 }, + end: { line: 2, column: 21 } + }, + body: [] + } + }, + { + type: "QMLPropertyDeclaration", + loc: { + start: { line: 3, column: 1 }, + end: { line: 3, column: 18 } + }, + default: false, + readonly: false, + kind: { + type: "QMLPropertyType", + loc: { + start: { line: 3, column: 10 }, + end: { line: 3, column: 13 } + }, + primitive: true, + id: { type: "Identifier", name: "var"} + }, + id: { + type: "Identifier", + loc: { + start: { line: 3, column: 14 }, + end: { line: 3, column: 18 } + }, + name: "prop" + }, + binding: null + } +])); + +testLoose('Window {\n\tfunction (\n\tproperty var prop\n}', rootObjectMembers([ + { + type: "FunctionDeclaration", + loc: { + start: { line: 2, column: 1 }, + end: { line: 3, column: 1 } + }, + id: { + type: "Identifier", + loc: { + start: { line: 2, column: 10 }, + end: { line: 2, column: 10 } + }, + name: "✖" + }, + params: [], + body: { + type: "BlockStatement", + loc: { + start: { line: 3, column: 1 }, + end: { line: 3, column: 1 } + }, + body: [] + } + }, + { + type: "QMLPropertyDeclaration", + loc: { + start: { line: 3, column: 1 }, + end: { line: 3, column: 18 } + }, + default: false, + readonly: false, + kind: { + type: "QMLPropertyType", + loc: { + start: { line: 3, column: 10 }, + end: { line: 3, column: 13 } + }, + primitive: true, + id: { type: "Identifier", name: "var"} + }, + id: { + type: "Identifier", + loc: { + start: { line: 3, column: 14 }, + end: { line: 3, column: 18 } + }, + name: "prop" + }, + binding: null + } +])); + +// TODO: Allow this to run on the normal parser once the ambiguity is solved +testLoose("a{ QtObject on test {} }", rootObjectMembers([{ + type: "QMLPropertyModifier", + loc: { + start: { line: 1, column: 3 }, + end: { line: 1, column: 22 } + }, + kind: { + type: "QMLQualifiedID", + loc: { + start: { line: 1, column: 3 }, + end: { line: 1, column: 11 } + }, + parts: [{ type: "Identifier", name: "QtObject" }], + name: "QtObject" + }, + id: { + type: "QMLQualifiedID", + loc: { + start: { line: 1, column: 15 }, + end: { line: 1, column: 19 } + }, + parts: [{ type: "Identifier", name: "test" }], + name: "test" + }, + body: { + type: "QMLObjectInitializer", + loc: { + start: { line: 1, column: 20 }, + end: { line: 1, column: 22 } + }, + members: [] + } +}])); + +// TODO: Allow this to run on the normal parser once the ambiguity is solved +testLoose("a{ QtObject on test {} }", rootObjectMembers([{ + type: "QMLPropertyModifier", + loc: { + start: { line: 1, column: 3 }, + end: { line: 1, column: 22 } + }, + kind: { + type: "QMLQualifiedID", + loc: { + start: { line: 1, column: 3 }, + end: { line: 1, column: 11 } + }, + parts: [{ type: "Identifier", name: "QtObject" }], + name: "QtObject" + }, + id: { + type: "QMLQualifiedID", + loc: { + start: { line: 1, column: 15 }, + end: { line: 1, column: 19 } + }, + parts: [{ type: "Identifier", name: "test" }], + name: "test" + }, + body: { + type: "QMLObjectInitializer", + loc: { + start: { line: 1, column: 20 }, + end: { line: 1, column: 22 } + }, + members: [] + } +}])); + +testLoose("a{ QtObject. on test {} }", rootObjectMembers([{ + type: "QMLPropertyBinding", + loc: { + start: { line: 1, column: 3 }, + end: { line: 1, column: 23 } + }, + id: { + type: "QMLQualifiedID", + loc: { + start: { line: 1, column: 3 }, + end: { line: 1, column: 15 } + }, + parts: [ + { type: "Identifier", name: "QtObject" }, + { type: "Identifier", name: "on" } + ], + name: "QtObject.on" + }, + binding: { + type: "QMLObjectBinding", + loc: { + start: { line: 1, column: 16 }, + end: { line: 1, column: 23 } + }, + id: { + type: "QMLQualifiedID", + loc: { + start: { line: 1, column: 16 }, + end: { line: 1, column: 20 } + }, + parts: [{ type: "Identifier", name: "test" }], + name: "test" + }, + body: { + type: "QMLObjectInitializer", + loc: { + start: { line: 1, column: 21 }, + end: { line: 1, column: 23 } + }, + members: [] + } + } +}]), { locations: true, qmltypes: false } ); + +// TODO: Allow this to run on the normal parser once the ambiguity is solved +testLoose("a{ s: [ QtObject {} ] }", rootObjectMembers([{ + type: "QMLPropertyBinding", + loc: { + start: { line: 1, column: 3 }, + end: { line: 1, column: 21 } + }, + id: { + type: "QMLQualifiedID", + loc: { + start: { line: 1, column: 3 }, + end: { line: 1, column: 4 } + }, + parts: [{ type: "Identifier", name: "s" }], + name: "s" + }, + binding: { + type: "QMLArrayBinding", + loc: { + start: { line: 1, column: 6 }, + end: { line: 1, column: 21 } + }, + elements: [ + { + type: "QMLObjectDefinition", + loc: { + start: { line: 1, column: 8 }, + end: { line: 1, column: 19 } + }, + id: { + type: "QMLQualifiedID", + loc: { + start: { line: 1, column: 8 }, + end: { line: 1, column: 16 } + }, + parts: [{ type: "Identifier", name: "QtObject" }], + name: "QtObject" + }, + body: { + type: "QMLObjectInitializer", + loc: { + start: { line: 1, column: 17 }, + end: { line: 1, column: 19 } + }, + members: [] + } + } + ] + } +}]), { locations: true, qmltypes: false }); + +// TODO: Allow this to run on the normal parser once the ambiguity is solved +testLoose("a{ s: [ QtObject {}, QtObject {} ] }", rootObjectMembers([{ + type: "QMLPropertyBinding", + loc: { + start: { line: 1, column: 3 }, + end: { line: 1, column: 34 } + }, + id: { + type: "QMLQualifiedID", + loc: { + start: { line: 1, column: 3 }, + end: { line: 1, column: 4 } + }, + parts: [{ type: "Identifier", name: "s" }], + name: "s" + }, + binding: { + type: "QMLArrayBinding", + loc: { + start: { line: 1, column: 6 }, + end: { line: 1, column: 34 } + }, + elements: [ + { + type: "QMLObjectDefinition", + loc: { + start: { line: 1, column: 8 }, + end: { line: 1, column: 19 } + }, + id: { + type: "QMLQualifiedID", + loc: { + start: { line: 1, column: 8 }, + end: { line: 1, column: 16 } + }, + parts: [{ type: "Identifier", name: "QtObject" }], + name: "QtObject" + }, + body: { + type: "QMLObjectInitializer", + loc: { + start: { line: 1, column: 17 }, + end: { line: 1, column: 19 } + }, + members: [] + } + }, + { + type: "QMLObjectDefinition", + loc: { + start: { line: 1, column: 21 }, + end: { line: 1, column: 32 } + }, + id: { + type: "QMLQualifiedID", + loc: { + start: { line: 1, column: 21 }, + end: { line: 1, column: 29 } + }, + parts: [{ type: "Identifier", name: "QtObject" }], + name: "QtObject" + }, + body: { + type: "QMLObjectInitializer", + loc: { + start: { line: 1, column: 30 }, + end: { line: 1, column: 32 } + }, + members: [] + } + } + ] + } +}]), { locations: true, qmltypes: false }); + +// TODO: Allow this to run on the normal parser once the ambiguity is solved +testLoose("a{ s: [ QtObject ] }", rootObjectMembers([{ + type: "QMLPropertyBinding", + loc: { + start: { line: 1, column: 3 }, + end: { line: 1, column: 18 } + }, + id: { + type: "QMLQualifiedID", + loc: { + start: { line: 1, column: 3 }, + end: { line: 1, column: 4 } + }, + parts: [{ type: "Identifier", name: "s" }], + name: "s" + }, + binding: { + type: "QMLScriptBinding", + loc: { + start: { line: 1, column: 6 }, + end: { line: 1, column: 18 } + }, + block: false, + script: { + type: "ArrayExpression", + loc: { + start: { line: 1, column: 6 }, + end: { line: 1, column: 18 } + }, + elements: [ + { + type: "Identifier", + loc: { + start: { line: 1, column: 8 }, + end: { line: 1, column: 16 } + }, + name: "QtObject" + } + ] + } + } +}] +), { locations: true, qmltypes: false }); + +// TODO: Allow this to run on the normal parser once the ambiguity is solved +testLoose("a{ property var s: [ QtObject {} ] }", rootObjectMembers([{ + type: "QMLPropertyDeclaration", + loc: { + start: { line: 1, column: 3 }, + end: { line: 1, column: 34 } + }, + default: false, + readonly: false, + kind: { + type: "QMLPropertyType", + loc: { + start: { line: 1, column: 12 }, + end: { line: 1, column: 15 } + }, + primitive: true, + id: { type: "Identifier", name: "var" } + }, + id: { + type: "Identifier", + loc: { + start: { line: 1, column: 16 }, + end: { line: 1, column: 17 } + }, + name: "s" + }, + binding: { + type: "QMLArrayBinding", + loc: { + start: { line: 1, column: 19 }, + end: { line: 1, column: 34 } + }, + elements: [ + { + type: "QMLObjectDefinition", + loc: { + start: { line: 1, column: 21 }, + end: { line: 1, column: 32 } + }, + id: { + type: "QMLQualifiedID", + loc: { + start: { line: 1, column: 21 }, + end: { line: 1, column: 29 } + }, + parts: [{ type: "Identifier", name: "QtObject" }], + name: "QtObject" + }, + body: { + type: "QMLObjectInitializer", + loc: { + start: { line: 1, column: 30 }, + end: { line: 1, column: 32 } + }, + members: [] + } + } + ] + } +}]), { locations: true, qmltypes: false }); + +// TODO: Allow this to run on the normal parser once the ambiguity is solved +testLoose("a{ property var s: [ QtObject ] }", rootObjectMembers([{ + type: "QMLPropertyDeclaration", + loc: { + start: { line: 1, column: 3 }, + end: { line: 1, column: 31 } + }, + default: false, + readonly: false, + kind: { + type: "QMLPropertyType", + loc: { + start: { line: 1, column: 12 }, + end: { line: 1, column: 15 } + }, + primitive: true, + id: { type: "Identifier", name: "var" } + }, + id: { + type: "Identifier", + loc: { + start: { line: 1, column: 16 }, + end: { line: 1, column: 17 } + }, + name: "s" + }, + binding: { + type: "QMLScriptBinding", + loc: { + start: { line: 1, column: 19 }, + end: { line: 1, column: 31 } + }, + block: false, + script: { + type: "ArrayExpression", + loc: { + start: { line: 1, column: 19 }, + end: { line: 1, column: 31 } + }, + elements: [ + { + type: "Identifier", + loc: { + start: { line: 1, column: 21 }, + end: { line: 1, column: 29 } + }, + name: "QtObject" + } + ] + } + } +}]), { locations: true, qmltypes: false }); + +testLoose("a{ s: [ QtObject {} }", rootObjectMembers([{ + type: "QMLPropertyBinding", + loc: { + start: { line: 1, column: 3 }, + end: { line: 1, column: 20 } + }, + id: { + type: "QMLQualifiedID", + loc: { + start: { line: 1, column: 3 }, + end: { line: 1, column: 4 } + }, + parts: [{ type: "Identifier", name: "s" }], + name: "s" + }, + binding: { + type: "QMLArrayBinding", + loc: { + start: { line: 1, column: 6 }, + end: { line: 1, column: 20 } + }, + elements: [ + { + type: "QMLObjectDefinition", + loc: { + start: { line: 1, column: 8 }, + end: { line: 1, column: 19 } + }, + id: { + type: "QMLQualifiedID", + loc: { + start: { line: 1, column: 8 }, + end: { line: 1, column: 16 } + }, + parts: [{ type: "Identifier", name: "QtObject" }], + name: "QtObject" + }, + body: { + type: "QMLObjectInitializer", + loc: { + start: { line: 1, column: 17 }, + end: { line: 1, column: 19 } + }, + members: [] + } + } + ] + } +}]), { locations: true, qmltypes: false }); + +testLoose("a{ s: [ QtObject { ] }", rootObjectMembers([{ + type: "QMLPropertyBinding", + loc: { + start: { line: 1, column: 3 }, + end: { line: 1, column: 22 } + }, + id: { + type: "QMLQualifiedID", + loc: { + start: { line: 1, column: 3 }, + end: { line: 1, column: 4 } + }, + parts: [{ type: "Identifier", name: "s" }], + name: "s" + }, + binding: { + type: "QMLArrayBinding", + loc: { + start: { line: 1, column: 6 }, + end: { line: 1, column: 22 } + }, + elements: [ + { + type: "QMLObjectDefinition", + loc: { + start: { line: 1, column: 8 }, + end: { line: 1, column: 22 } + }, + id: { + type: "QMLQualifiedID", + loc: { + start: { line: 1, column: 8 }, + end: { line: 1, column: 16 } + }, + parts: [{ type: "Identifier", name: "QtObject" }], + name: "QtObject" + }, + body: { + type: "QMLObjectInitializer", + loc: { + start: { line: 1, column: 17 }, + end: { line: 1, column: 22 } + }, + members: [] + } + } + ] + } +}]), { locations: true, qmltypes: false }); + +/*************************************************************************** +* QMLTypes Parser Tests * +****************************************************************************/ +function testQMLTypes(code, ast, options) { + var opts = options || {}; + opts.qmltypes = true; + opts.locations = true; + test(code, ast, opts); +} + +testQMLTypes("a{ b: {} }", javaScript({ + type: "ObjectExpression", + loc: { + start: { line: 1, column: 6 }, + end: { line: 1, column: 8 } + }, + properties: [] +})); + +testQMLTypes('a{ b: "test" }', javaScript({ + type: "Literal", + loc: { + start: { line: 1, column: 6 }, + end: { line: 1, column: 12 } + }, + value: "test", + raw: '"test"' +})); + +testQMLTypes('a{ b: ["one", "two"] }', javaScript({ + type: "ArrayExpression", + loc: { + start: { line: 1, column: 6 }, + end: { line: 1, column: 20 } + }, + elements: [ + { + type: "Literal", + loc: { + start: { line: 1, column: 7 }, + end: { line: 1, column: 12 } + }, + value: "one", + raw: '"one"' + }, + { + type: "Literal", + loc: { + start: { line: 1, column: 14 }, + end: { line: 1, column: 19 } + }, + value: "two", + raw: '"two"' + } + ] +})); + +/* +* Creates a Program with 'headerItemList' and 'rootObject' as the program's expected +* body. +*/ +function program(headerItemList, rootObject) { + return { + type: "QMLProgram", + headerItemList: { + type: "QMLHeaderItemList", + items: headerItemList || [] + }, + rootObject: rootObject || null + }; +} + +/* +* Creates a QMLHeaderItemList with 'stmts' as the expected statements and 'prog' as the +* parent Program. A value of null for 'prog' will append the QMLHeaderItemList AST to +* the Program returned by program(). +*/ +function headerItemList(items, prog) { + prog = prog || program(); + prog.headerItemList.items = items; + return prog; +} + +/* +* Creates a QMLObjectDefinition with 'stmts' as the expected statements and 'prog' as the parent +* Program. A value of null for 'prog' will append the QMLObjectDefinition AST to the Program +* returned by program(). +*/ +function rootObject(obj, prog) { + prog = prog || program(); + prog.rootObject = obj; + return prog; +} + +/* +* Creates a QMLObjectInitializer with 'members' as the expected members and 'obj' as the parent +* QMLObjectDefinition. A value of null for 'obj' will append the QMLObjectInitializer AST to the +* QMLObjectDefinition returned by rootObject(). +*/ +function rootObjectMembers(members, obj) { + var rootObj = obj || rootObject({ + type: "QMLObjectDefinition", + body: { + type: "QMLObjectInitializer", + members: members + } + }); + return rootObj; +} + +/* +* Creates a JavaScript Expression with 'expr' as the expected expression and 'objMembers' as +* the parent QMLObjectInitializer. A value of null for 'objMembers' will append the JavaScript +* Expression to the QMLObjectInitializer returned by rootObjectMembers(). +*/ +function javaScript(expr, objMembers) { + objMembers = objMembers || rootObjectMembers([{ + type: "QMLPropertyBinding", + binding: { + type: "QMLScriptBinding", + script: expr + } + }]); + return objMembers; } \ No newline at end of file diff --git a/qt/org.eclipse.cdt.qt.core/acorn-qml/walk/index.js b/qt/org.eclipse.cdt.qt.core/acorn-qml/walk/index.js index a1883ac501f..09063fc7034 100644 --- a/qt/org.eclipse.cdt.qt.core/acorn-qml/walk/index.js +++ b/qt/org.eclipse.cdt.qt.core/acorn-qml/walk/index.js @@ -1,85 +1,85 @@ -/******************************************************************************* - * Copyright (c) 2015 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 - *******************************************************************************/ -(function (mod) { - if (typeof exports == "object" && typeof module == "object") // CommonJS - return mod(require("acorn/dist/walk")); - if (typeof define == "function" && define.amd) // AMD - return define(["acorn/dist/walk"], mod); - mod(acorn.walk); // Plain browser env -})(function (walk) { - "use strict"; - - function skipThrough(node, st, c) { - c(node, st); - } - - function ignore(node, st, c) {} - - function extendWalk(walker, funcs) { - for (var prop in funcs) { - walker[prop] = funcs[prop]; - } - } - - extendWalk(walk.base, { - QMLProgram: function (node, st, c) { - c(node.headerItemList, st); - if (node.rootObject) { - c(node.rootObject, st, "QMLRootObject"); - } - }, - QMLHeaderItemList: function (node, st, c) { - for (var i = 0; i < node.items.length; i++) { - c(node.items[i], st, "QMLHeaderItem"); - } - }, - QMLHeaderItem: skipThrough, - QMLImport: ignore, - QMLPragma: ignore, - QMLRootObject: skipThrough, - QMLObjectDefinition: function (node, st, c) { - c(node.body, st); - }, - QMLObjectInitializer: function (node, st, c) { - for (var i = 0; i < node.members.length; i++) { - c(node.members[i], st, "QMLObjectMember"); - } - }, - QMLObjectMember: skipThrough, - QMLPropertyDeclaration: function (node, st, c) { - if (node.binding) { - c(node.binding, st, "QMLBinding"); - } - }, - QMLSignalDefinition: ignore, - QMLPropertyBinding: function (node, st, c) { - c(node.binding, st, "QMLBinding"); - }, - QMLBinding: skipThrough, - QMLObjectBinding: function (node, st, c) { - c(node.body, st); - }, - QMLArrayBinding: function (node, st, c) { - for (var i = 0; i < node.elements.length; i++) { - c(node.elements[i], st); - } - }, - QMLScriptBinding: function (node, st, c) { - c(node.script, st); - }, - QMLQualifiedID: ignore, - QMLStatementBlock: function (node, st, c) { - for (var i = 0; i < node.body.length; i++) { - c(node.body[i], st, "Statement"); - } - } - }); +/******************************************************************************* + * Copyright (c) 2015 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 + *******************************************************************************/ +(function (mod) { + if (typeof exports == "object" && typeof module == "object") // CommonJS + return mod(require("acorn/dist/walk")); + if (typeof define == "function" && define.amd) // AMD + return define(["acorn/dist/walk"], mod); + mod(acorn.walk); // Plain browser env +})(function (walk) { + "use strict"; + + function skipThrough(node, st, c) { + c(node, st); + } + + function ignore(node, st, c) {} + + function extendWalk(walker, funcs) { + for (var prop in funcs) { + walker[prop] = funcs[prop]; + } + } + + extendWalk(walk.base, { + QMLProgram: function (node, st, c) { + c(node.headerItemList, st); + if (node.rootObject) { + c(node.rootObject, st, "QMLRootObject"); + } + }, + QMLHeaderItemList: function (node, st, c) { + for (var i = 0; i < node.items.length; i++) { + c(node.items[i], st, "QMLHeaderItem"); + } + }, + QMLHeaderItem: skipThrough, + QMLImport: ignore, + QMLPragma: ignore, + QMLRootObject: skipThrough, + QMLObjectDefinition: function (node, st, c) { + c(node.body, st); + }, + QMLObjectInitializer: function (node, st, c) { + for (var i = 0; i < node.members.length; i++) { + c(node.members[i], st, "QMLObjectMember"); + } + }, + QMLObjectMember: skipThrough, + QMLPropertyDeclaration: function (node, st, c) { + if (node.binding) { + c(node.binding, st, "QMLBinding"); + } + }, + QMLSignalDefinition: ignore, + QMLPropertyBinding: function (node, st, c) { + c(node.binding, st, "QMLBinding"); + }, + QMLBinding: skipThrough, + QMLObjectBinding: function (node, st, c) { + c(node.body, st); + }, + QMLArrayBinding: function (node, st, c) { + for (var i = 0; i < node.elements.length; i++) { + c(node.elements[i], st); + } + }, + QMLScriptBinding: function (node, st, c) { + c(node.script, st); + }, + QMLQualifiedID: ignore, + QMLStatementBlock: function (node, st, c) { + for (var i = 0; i < node.body.length; i++) { + c(node.body[i], st, "Statement"); + } + } + }); }); \ No newline at end of file diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/QMLModuleResolver.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/QMLModuleResolver.java index 602533ee129..40d91caec70 100644 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/QMLModuleResolver.java +++ b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/QMLModuleResolver.java @@ -1,99 +1,99 @@ -/******************************************************************************* - * Copyright (c) 2015 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.internal.qt.core; - -import java.io.File; -import java.io.FileInputStream; -import java.io.IOException; -import java.io.InputStream; -import java.nio.file.Path; - -import javax.script.ScriptException; - -import org.eclipse.cdt.internal.qt.core.qmltypes.QMLModelBuilder; -import org.eclipse.cdt.internal.qt.core.qmltypes.QMLModuleInfo; -import org.eclipse.cdt.qt.core.IQtInstall; -import org.eclipse.cdt.qt.core.IQtInstallManager; -import org.eclipse.cdt.qt.core.qmldir.QMLDirectoryInfo; -import org.eclipse.cdt.qt.core.qmljs.IQmlASTNode; - -public class QMLModuleResolver { - private final QMLAnalyzer analyzer; - private final IQtInstallManager manager; - private final QMLModelBuilder builder; - - public QMLModuleResolver(QMLAnalyzer analyzer) { - this.analyzer = analyzer; - this.manager = Activator.getService(IQtInstallManager.class); - this.builder = new QMLModelBuilder(); - } - - // TODO: determine exactly how to give this to Tern. For now we'll just return the reference to the QMLModuleInfo - // that we found - public QMLModuleInfo resolveModule(String module) throws NoSuchMethodException, ScriptException { - QMLModuleInfo info = builder.getModule(module); - if (info == null) { - Path path = getModulePath(module); - if (path != null) { - File qmldir = path.resolve("qmldir").normalize().toFile(); //$NON-NLS-1$ - try { - String types = getQmlTypesFile(qmldir); - File qmlTypes = path.resolve(types).toFile(); - String typeContents = fileToString(qmlTypes); - IQmlASTNode ast = analyzer.parseString(typeContents, "qmltypes", false, false); //$NON-NLS-1$ - info = builder.addModule(module, ast); - } catch (IOException e) { - Activator.log(e); - } - } - } - return info; - } - - private String fileToString(File file) throws IOException { - try (InputStream stream = new FileInputStream(file)) { - StringBuilder sb = new StringBuilder(); - int read = -1; - while ((read = stream.read()) != -1) { - sb.append((char) read); - } - return sb.toString(); - } - } - - private String getQmlTypesFile(File qmldir) throws IOException { - try (InputStream stream = new FileInputStream(qmldir)) { - QMLDirectoryInfo info = new QMLDirectoryInfo(stream); - return info.getTypesFileName(); - } - } - - private Path getModulePath(String module) { - if (module != null) { - for (IQtInstall install : manager.getInstalls()) { - Path qmlPath = install.getQmlPath(); - Path modPath = null; - if (module.equals("QtQuick")) { //$NON-NLS-1$ - modPath = qmlPath.resolve("QtQuick.2").normalize(); //$NON-NLS-1$ - } else { - modPath = qmlPath; - for (String part : module.split("\\.")) { //$NON-NLS-1$ - modPath = modPath.resolve(part).normalize(); - } - } - if (modPath.toFile().exists()) { - return modPath; - } - } - } - return null; - } -} +/******************************************************************************* + * Copyright (c) 2015 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.internal.qt.core; + +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.nio.file.Path; + +import javax.script.ScriptException; + +import org.eclipse.cdt.internal.qt.core.qmltypes.QMLModelBuilder; +import org.eclipse.cdt.internal.qt.core.qmltypes.QMLModuleInfo; +import org.eclipse.cdt.qt.core.IQtInstall; +import org.eclipse.cdt.qt.core.IQtInstallManager; +import org.eclipse.cdt.qt.core.qmldir.QMLDirectoryInfo; +import org.eclipse.cdt.qt.core.qmljs.IQmlASTNode; + +public class QMLModuleResolver { + private final QMLAnalyzer analyzer; + private final IQtInstallManager manager; + private final QMLModelBuilder builder; + + public QMLModuleResolver(QMLAnalyzer analyzer) { + this.analyzer = analyzer; + this.manager = Activator.getService(IQtInstallManager.class); + this.builder = new QMLModelBuilder(); + } + + // TODO: determine exactly how to give this to Tern. For now we'll just return the reference to the QMLModuleInfo + // that we found + public QMLModuleInfo resolveModule(String module) throws NoSuchMethodException, ScriptException { + QMLModuleInfo info = builder.getModule(module); + if (info == null) { + Path path = getModulePath(module); + if (path != null) { + File qmldir = path.resolve("qmldir").normalize().toFile(); //$NON-NLS-1$ + try { + String types = getQmlTypesFile(qmldir); + File qmlTypes = path.resolve(types).toFile(); + String typeContents = fileToString(qmlTypes); + IQmlASTNode ast = analyzer.parseString(typeContents, "qmltypes", false, false); //$NON-NLS-1$ + info = builder.addModule(module, ast); + } catch (IOException e) { + Activator.log(e); + } + } + } + return info; + } + + private String fileToString(File file) throws IOException { + try (InputStream stream = new FileInputStream(file)) { + StringBuilder sb = new StringBuilder(); + int read = -1; + while ((read = stream.read()) != -1) { + sb.append((char) read); + } + return sb.toString(); + } + } + + private String getQmlTypesFile(File qmldir) throws IOException { + try (InputStream stream = new FileInputStream(qmldir)) { + QMLDirectoryInfo info = new QMLDirectoryInfo(stream); + return info.getTypesFileName(); + } + } + + private Path getModulePath(String module) { + if (module != null) { + for (IQtInstall install : manager.getInstalls()) { + Path qmlPath = install.getQmlPath(); + Path modPath = null; + if (module.equals("QtQuick")) { //$NON-NLS-1$ + modPath = qmlPath.resolve("QtQuick.2").normalize(); //$NON-NLS-1$ + } else { + modPath = qmlPath; + for (String part : module.split("\\.")) { //$NON-NLS-1$ + modPath = modPath.resolve(part).normalize(); + } + } + if (modPath.toFile().exists()) { + return modPath; + } + } + } + return null; + } +} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/QmlASTNodeHandler.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/QmlASTNodeHandler.java index 46e98663935..1e2d4e8fce1 100644 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/QmlASTNodeHandler.java +++ b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/QmlASTNodeHandler.java @@ -1,252 +1,252 @@ -/******************************************************************************* - * Copyright (c) 2015, 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 - * - * Contributors: - * QNX Software Systems - Initial API and implementation - *******************************************************************************/ -package org.eclipse.cdt.internal.qt.core; - -import java.lang.invoke.MethodHandles; -import java.lang.reflect.Array; -import java.lang.reflect.Constructor; -import java.lang.reflect.InvocationHandler; -import java.lang.reflect.Method; -import java.lang.reflect.Proxy; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import javax.script.Bindings; - -import org.eclipse.cdt.internal.qt.core.location.Position; -import org.eclipse.cdt.internal.qt.core.location.SourceLocation; -import org.eclipse.cdt.qt.core.IQMLAnalyzer; -import org.eclipse.cdt.qt.core.location.ISourceLocation; -import org.eclipse.cdt.qt.core.qmljs.IJSLiteral; -import org.eclipse.cdt.qt.core.qmljs.IJSRegExpLiteral; -import org.eclipse.cdt.qt.core.qmljs.IQmlASTNode; -import org.eclipse.cdt.qt.core.qmljs.IQmlObjectDefinition; -import org.eclipse.cdt.qt.core.qmljs.IQmlRootObject; - -/** - * Translates a JavaScript {@link Bindings} object into a QML AST. This class employs {@link java.lang.reflect.Proxy} in order to - * dynamically create the AST at runtime. - *

    - * To begin translation simply call the static method createQmlASTProxy. The AST is translated only when it needs to be - * (i.e. when one of its 'get' methods are called). - */ -public class QmlASTNodeHandler implements InvocationHandler { - private static final String NODE_QML_PREFIX = "QML"; //$NON-NLS-1$ - private static final String NODE_TYPE_PROPERTY = "type"; //$NON-NLS-1$ - private static final String NODE_REGEX_PROPERTY = "regex"; //$NON-NLS-1$ - private static final String CREATE_ENUM_METHOD = "fromObject"; //$NON-NLS-1$ - private static final String AST_PACKAGE = "org.eclipse.cdt.qt.core.qmljs."; //$NON-NLS-1$ - private static final String AST_QML_PREFIX = "IQml"; //$NON-NLS-1$ - private static final String AST_JS_PREFIX = "IJS"; //$NON-NLS-1$ - - private static String getPropertyName(String method) { - String name = ""; //$NON-NLS-1$ - if (method.startsWith("is")) { //$NON-NLS-1$ - name = method.substring(2, 3).toLowerCase() + method.substring(3); - } else if (method.startsWith("get")) { //$NON-NLS-1$ - name = method.substring(3, 4).toLowerCase() + method.substring(4); - } - if (name.equalsIgnoreCase("identifier")) { //$NON-NLS-1$ - return "id"; //$NON-NLS-1$ - } else if (name.equalsIgnoreCase("location")) { //$NON-NLS-1$ - return "loc"; //$NON-NLS-1$ - } - return name; - } - - /** - * Constructs a new {@link IQmlASTNode} from the given {@link Bindings}. This is a helper method equivalent to - * createQmlASTProxy(node, null) - * - * @param node - * the AST node as retrieved from Nashorn - * @return a Proxy representing the given node - * @throws ClassNotFoundException - * if the node does not represent a valid QML AST Node - * @see {@link QmlASTNodeHandler#createQmlASTProxy(Bindings, Class)} - */ - public static IQmlASTNode createQmlASTProxy(Bindings node) throws ClassNotFoundException { - return createQmlASTProxy(node, null); - } - - /** - * Constructs a new {@link IQmlASTNode} from the given {@link Bindings}. If a return type is specified, it will take precedence - * over the type retrieved from the binding. This is useful for nodes that extend, but do not add functionality to, an acorn AST - * element. A good example of this is {@link IQmlRootObject} which extends {@link IQmlObjectDefinition}. We can easily determine - * the location in the AST at which we want an IQmlRootObject over an IQmlObjectDefinition and set the returnType accordingly. - * - * @param node - * the node as retrieved from acorn - * @param returnType - * the expected node to return or null - * @return a Proxy representing the given node - * @throws ClassNotFoundException - * if the node does not represent a valid QML AST Node - */ - public static IQmlASTNode createQmlASTProxy(Bindings node, Class returnType) throws ClassNotFoundException { - String type = (String) node.getOrDefault(NODE_TYPE_PROPERTY, ""); //$NON-NLS-1$ - if (type.startsWith(NODE_QML_PREFIX)) { - type = AST_QML_PREFIX + type.substring(3); - } else { - type = AST_JS_PREFIX + type; - } - Class astClass = Class.forName(AST_PACKAGE + type); - if (astClass.equals(IJSLiteral.class)) { - // If this is a Literal, we have to distinguish it between a RegExp Literal using the 'regex' property - if (node.get(NODE_REGEX_PROPERTY) != null) { - astClass = IJSRegExpLiteral.class; - } - } - if (returnType != null) { - if (!IQmlASTNode.class.isAssignableFrom(astClass)) { - throw new ClassCastException(astClass + " cannot be cast to " + IQmlASTNode.class); //$NON-NLS-1$ - } - if (astClass.isAssignableFrom(returnType)) { - astClass = returnType; - } - } - return (IQmlASTNode) Proxy.newProxyInstance(QmlASTNodeHandler.class.getClassLoader(), - new Class[] { astClass }, - new QmlASTNodeHandler(node)); - } - - private final QMLAnalyzer analyzer; - private final Bindings node; - private final Map methodResults; - - private QmlASTNodeHandler(Bindings node) { - this.analyzer = (QMLAnalyzer) Activator.getService(IQMLAnalyzer.class); - this.node = node; - this.methodResults = new HashMap<>(); - } - - @Override - public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { - String mName = method.getName(); - if (!methodResults.containsKey(method.getName())) { - // Invoke the default implementation of the method if possible - if (method.isDefault()) { - final Class declaringClass = method.getDeclaringClass(); - Constructor constructor = MethodHandles.Lookup.class.getDeclaredConstructor(Class.class, - int.class); - constructor.setAccessible(true); - methodResults.put(mName, constructor.newInstance(declaringClass, MethodHandles.Lookup.PRIVATE) - .unreflectSpecial(method, declaringClass) - .bindTo(proxy) - .invokeWithArguments(args)); - } else { - // Use the return type of the method as well as its contents of the node to get the Object to return - String pName = getPropertyName(mName); - methodResults.put(mName, handleObject(node.get(pName), method.getReturnType())); - } - } - return methodResults.get(mName); - } - - private Object handleObject(Object value, Class expectedType) throws Throwable { - if (expectedType.isArray()) { - Object arr = Array.newInstance(expectedType.getComponentType(), ((Bindings) value).size()); - int ctr = 0; - for (Object obj : ((Bindings) value).values()) { - Array.set(arr, ctr++, handleObject(obj, expectedType.getComponentType())); - } - return arr; - } else if (expectedType.equals(Object.class)) { - return value; - } else if (expectedType.isAssignableFrom(ISourceLocation.class)) { - // ISourceLocation doesn't correspond to an AST Node and needs to be created manually from - // the given Bindings. - if (value instanceof Bindings) { - Bindings bind = (Bindings) value; - SourceLocation loc = new SourceLocation(); - loc.setSource((String) bind.get("source")); //$NON-NLS-1$ - Bindings start = (Bindings) bind.get("start"); //$NON-NLS-1$ - loc.setStart(new Position(((Number) start.get("line")).intValue(), //$NON-NLS-1$ - ((Number) start.get("column")).intValue())); //$NON-NLS-1$ - Bindings end = (Bindings) bind.get("end"); //$NON-NLS-1$ - loc.setEnd(new Position(((Number) end.get("line")).intValue(), //$NON-NLS-1$ - ((Number) end.get("column")).intValue())); //$NON-NLS-1$ - return loc; - } - return new SourceLocation(); - } else if (expectedType.isAssignableFrom(List.class)) { - if (value instanceof Bindings) { - List list = new ArrayList<>(); - for (Bindings object : analyzer.toJavaArray((Bindings) value, Bindings[].class)) { - list.add(QmlASTNodeHandler.createQmlASTProxy(object)); - } - return list; - } - return null; - } else if (expectedType.isPrimitive()) { - return handlePrimitive(value, expectedType); - } else if (expectedType.isAssignableFrom(Number.class)) { - if (value instanceof Number) { - return value; - } - return 0; - } else if (expectedType.isEnum()) { - return expectedType.getMethod(CREATE_ENUM_METHOD, Object.class).invoke(null, value); - } else if (value instanceof Bindings) { - return QmlASTNodeHandler.createQmlASTProxy((Bindings) value, expectedType); - } - return value; - } - - private Object handlePrimitive(Object value, Class expectedType) throws Throwable { - if (expectedType.isPrimitive()) { - if (expectedType.equals(Boolean.TYPE)) { - if (value instanceof Boolean) { - return value; - } - return false; - } else if (expectedType.equals(Character.TYPE)) { - if (value instanceof Character) { - return value; - } - return '\0'; - } else if (expectedType.equals(Byte.TYPE)) { - if (value instanceof Number) { - return ((Number) value).byteValue(); - } - return (byte) 0; - } else if (expectedType.equals(Short.TYPE)) { - if (value instanceof Number) { - return ((Number) value).shortValue(); - } - return (short) 0; - } else if (expectedType.equals(Integer.TYPE)) { - if (value instanceof Number) { - return ((Number) value).intValue(); - } - return 0; - } else if (expectedType.equals(Long.TYPE)) { - if (value instanceof Number) { - return ((Number) value).longValue(); - } - return 0l; - } else if (expectedType.equals(Float.TYPE)) { - if (value instanceof Number) { - return ((Number) value).floatValue(); - } - return 0.0f; - } else if (expectedType.equals(Double.TYPE)) { - if (value instanceof Number) { - return ((Number) value).doubleValue(); - } - return 0.0d; - } - } - throw new IllegalArgumentException("expectedType was not a primitive type"); //$NON-NLS-1$ - } -} +/******************************************************************************* + * Copyright (c) 2015, 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 + * + * Contributors: + * QNX Software Systems - Initial API and implementation + *******************************************************************************/ +package org.eclipse.cdt.internal.qt.core; + +import java.lang.invoke.MethodHandles; +import java.lang.reflect.Array; +import java.lang.reflect.Constructor; +import java.lang.reflect.InvocationHandler; +import java.lang.reflect.Method; +import java.lang.reflect.Proxy; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.script.Bindings; + +import org.eclipse.cdt.internal.qt.core.location.Position; +import org.eclipse.cdt.internal.qt.core.location.SourceLocation; +import org.eclipse.cdt.qt.core.IQMLAnalyzer; +import org.eclipse.cdt.qt.core.location.ISourceLocation; +import org.eclipse.cdt.qt.core.qmljs.IJSLiteral; +import org.eclipse.cdt.qt.core.qmljs.IJSRegExpLiteral; +import org.eclipse.cdt.qt.core.qmljs.IQmlASTNode; +import org.eclipse.cdt.qt.core.qmljs.IQmlObjectDefinition; +import org.eclipse.cdt.qt.core.qmljs.IQmlRootObject; + +/** + * Translates a JavaScript {@link Bindings} object into a QML AST. This class employs {@link java.lang.reflect.Proxy} in order to + * dynamically create the AST at runtime. + *

    + * To begin translation simply call the static method createQmlASTProxy. The AST is translated only when it needs to be + * (i.e. when one of its 'get' methods are called). + */ +public class QmlASTNodeHandler implements InvocationHandler { + private static final String NODE_QML_PREFIX = "QML"; //$NON-NLS-1$ + private static final String NODE_TYPE_PROPERTY = "type"; //$NON-NLS-1$ + private static final String NODE_REGEX_PROPERTY = "regex"; //$NON-NLS-1$ + private static final String CREATE_ENUM_METHOD = "fromObject"; //$NON-NLS-1$ + private static final String AST_PACKAGE = "org.eclipse.cdt.qt.core.qmljs."; //$NON-NLS-1$ + private static final String AST_QML_PREFIX = "IQml"; //$NON-NLS-1$ + private static final String AST_JS_PREFIX = "IJS"; //$NON-NLS-1$ + + private static String getPropertyName(String method) { + String name = ""; //$NON-NLS-1$ + if (method.startsWith("is")) { //$NON-NLS-1$ + name = method.substring(2, 3).toLowerCase() + method.substring(3); + } else if (method.startsWith("get")) { //$NON-NLS-1$ + name = method.substring(3, 4).toLowerCase() + method.substring(4); + } + if (name.equalsIgnoreCase("identifier")) { //$NON-NLS-1$ + return "id"; //$NON-NLS-1$ + } else if (name.equalsIgnoreCase("location")) { //$NON-NLS-1$ + return "loc"; //$NON-NLS-1$ + } + return name; + } + + /** + * Constructs a new {@link IQmlASTNode} from the given {@link Bindings}. This is a helper method equivalent to + * createQmlASTProxy(node, null) + * + * @param node + * the AST node as retrieved from Nashorn + * @return a Proxy representing the given node + * @throws ClassNotFoundException + * if the node does not represent a valid QML AST Node + * @see {@link QmlASTNodeHandler#createQmlASTProxy(Bindings, Class)} + */ + public static IQmlASTNode createQmlASTProxy(Bindings node) throws ClassNotFoundException { + return createQmlASTProxy(node, null); + } + + /** + * Constructs a new {@link IQmlASTNode} from the given {@link Bindings}. If a return type is specified, it will take precedence + * over the type retrieved from the binding. This is useful for nodes that extend, but do not add functionality to, an acorn AST + * element. A good example of this is {@link IQmlRootObject} which extends {@link IQmlObjectDefinition}. We can easily determine + * the location in the AST at which we want an IQmlRootObject over an IQmlObjectDefinition and set the returnType accordingly. + * + * @param node + * the node as retrieved from acorn + * @param returnType + * the expected node to return or null + * @return a Proxy representing the given node + * @throws ClassNotFoundException + * if the node does not represent a valid QML AST Node + */ + public static IQmlASTNode createQmlASTProxy(Bindings node, Class returnType) throws ClassNotFoundException { + String type = (String) node.getOrDefault(NODE_TYPE_PROPERTY, ""); //$NON-NLS-1$ + if (type.startsWith(NODE_QML_PREFIX)) { + type = AST_QML_PREFIX + type.substring(3); + } else { + type = AST_JS_PREFIX + type; + } + Class astClass = Class.forName(AST_PACKAGE + type); + if (astClass.equals(IJSLiteral.class)) { + // If this is a Literal, we have to distinguish it between a RegExp Literal using the 'regex' property + if (node.get(NODE_REGEX_PROPERTY) != null) { + astClass = IJSRegExpLiteral.class; + } + } + if (returnType != null) { + if (!IQmlASTNode.class.isAssignableFrom(astClass)) { + throw new ClassCastException(astClass + " cannot be cast to " + IQmlASTNode.class); //$NON-NLS-1$ + } + if (astClass.isAssignableFrom(returnType)) { + astClass = returnType; + } + } + return (IQmlASTNode) Proxy.newProxyInstance(QmlASTNodeHandler.class.getClassLoader(), + new Class[] { astClass }, + new QmlASTNodeHandler(node)); + } + + private final QMLAnalyzer analyzer; + private final Bindings node; + private final Map methodResults; + + private QmlASTNodeHandler(Bindings node) { + this.analyzer = (QMLAnalyzer) Activator.getService(IQMLAnalyzer.class); + this.node = node; + this.methodResults = new HashMap<>(); + } + + @Override + public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { + String mName = method.getName(); + if (!methodResults.containsKey(method.getName())) { + // Invoke the default implementation of the method if possible + if (method.isDefault()) { + final Class declaringClass = method.getDeclaringClass(); + Constructor constructor = MethodHandles.Lookup.class.getDeclaredConstructor(Class.class, + int.class); + constructor.setAccessible(true); + methodResults.put(mName, constructor.newInstance(declaringClass, MethodHandles.Lookup.PRIVATE) + .unreflectSpecial(method, declaringClass) + .bindTo(proxy) + .invokeWithArguments(args)); + } else { + // Use the return type of the method as well as its contents of the node to get the Object to return + String pName = getPropertyName(mName); + methodResults.put(mName, handleObject(node.get(pName), method.getReturnType())); + } + } + return methodResults.get(mName); + } + + private Object handleObject(Object value, Class expectedType) throws Throwable { + if (expectedType.isArray()) { + Object arr = Array.newInstance(expectedType.getComponentType(), ((Bindings) value).size()); + int ctr = 0; + for (Object obj : ((Bindings) value).values()) { + Array.set(arr, ctr++, handleObject(obj, expectedType.getComponentType())); + } + return arr; + } else if (expectedType.equals(Object.class)) { + return value; + } else if (expectedType.isAssignableFrom(ISourceLocation.class)) { + // ISourceLocation doesn't correspond to an AST Node and needs to be created manually from + // the given Bindings. + if (value instanceof Bindings) { + Bindings bind = (Bindings) value; + SourceLocation loc = new SourceLocation(); + loc.setSource((String) bind.get("source")); //$NON-NLS-1$ + Bindings start = (Bindings) bind.get("start"); //$NON-NLS-1$ + loc.setStart(new Position(((Number) start.get("line")).intValue(), //$NON-NLS-1$ + ((Number) start.get("column")).intValue())); //$NON-NLS-1$ + Bindings end = (Bindings) bind.get("end"); //$NON-NLS-1$ + loc.setEnd(new Position(((Number) end.get("line")).intValue(), //$NON-NLS-1$ + ((Number) end.get("column")).intValue())); //$NON-NLS-1$ + return loc; + } + return new SourceLocation(); + } else if (expectedType.isAssignableFrom(List.class)) { + if (value instanceof Bindings) { + List list = new ArrayList<>(); + for (Bindings object : analyzer.toJavaArray((Bindings) value, Bindings[].class)) { + list.add(QmlASTNodeHandler.createQmlASTProxy(object)); + } + return list; + } + return null; + } else if (expectedType.isPrimitive()) { + return handlePrimitive(value, expectedType); + } else if (expectedType.isAssignableFrom(Number.class)) { + if (value instanceof Number) { + return value; + } + return 0; + } else if (expectedType.isEnum()) { + return expectedType.getMethod(CREATE_ENUM_METHOD, Object.class).invoke(null, value); + } else if (value instanceof Bindings) { + return QmlASTNodeHandler.createQmlASTProxy((Bindings) value, expectedType); + } + return value; + } + + private Object handlePrimitive(Object value, Class expectedType) throws Throwable { + if (expectedType.isPrimitive()) { + if (expectedType.equals(Boolean.TYPE)) { + if (value instanceof Boolean) { + return value; + } + return false; + } else if (expectedType.equals(Character.TYPE)) { + if (value instanceof Character) { + return value; + } + return '\0'; + } else if (expectedType.equals(Byte.TYPE)) { + if (value instanceof Number) { + return ((Number) value).byteValue(); + } + return (byte) 0; + } else if (expectedType.equals(Short.TYPE)) { + if (value instanceof Number) { + return ((Number) value).shortValue(); + } + return (short) 0; + } else if (expectedType.equals(Integer.TYPE)) { + if (value instanceof Number) { + return ((Number) value).intValue(); + } + return 0; + } else if (expectedType.equals(Long.TYPE)) { + if (value instanceof Number) { + return ((Number) value).longValue(); + } + return 0l; + } else if (expectedType.equals(Float.TYPE)) { + if (value instanceof Number) { + return ((Number) value).floatValue(); + } + return 0.0f; + } else if (expectedType.equals(Double.TYPE)) { + if (value instanceof Number) { + return ((Number) value).doubleValue(); + } + return 0.0d; + } + } + throw new IllegalArgumentException("expectedType was not a primitive type"); //$NON-NLS-1$ + } +} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/location/Position.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/location/Position.java index 1ec2df36bb8..b8cdfc6fa06 100644 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/location/Position.java +++ b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/location/Position.java @@ -1,38 +1,38 @@ -/******************************************************************************* - * Copyright (c) 2015 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.internal.qt.core.location; - -import org.eclipse.cdt.qt.core.location.IPosition; - -public class Position implements IPosition { - private final int line; - private final int column; - - public Position(int line, int column) { - this.line = line; - this.column = column; - } - - @Override - public int getLine() { - return line; - } - - @Override - public int getColumn() { - return column; - } - - @Override - public String toString() { - return "(" + line + ":" + column + ")"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - } -} +/******************************************************************************* + * Copyright (c) 2015 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.internal.qt.core.location; + +import org.eclipse.cdt.qt.core.location.IPosition; + +public class Position implements IPosition { + private final int line; + private final int column; + + public Position(int line, int column) { + this.line = line; + this.column = column; + } + + @Override + public int getLine() { + return line; + } + + @Override + public int getColumn() { + return column; + } + + @Override + public String toString() { + return "(" + line + ":" + column + ")"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + } +} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/location/SourceLocation.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/location/SourceLocation.java index d1a702a7720..12e42a241d9 100644 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/location/SourceLocation.java +++ b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/location/SourceLocation.java @@ -1,58 +1,58 @@ -/******************************************************************************* - * Copyright (c) 2015 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.internal.qt.core.location; - -import org.eclipse.cdt.qt.core.location.IPosition; -import org.eclipse.cdt.qt.core.location.ISourceLocation; - -public class SourceLocation implements ISourceLocation { - private String source; - private IPosition start; - private IPosition end; - - public SourceLocation() { - this(null, null, null); - } - - public SourceLocation(String source, IPosition start, IPosition end) { - this.source = source; - this.start = start; - this.end = end; - } - - public void setSource(String value) { - this.source = value; - } - - @Override - public String getSource() { - return source; - } - - public void setStart(IPosition value) { - this.start = value; - } - - @Override - public IPosition getStart() { - return start; - } - - public void setEnd(IPosition value) { - this.end = value; - } - - @Override - public IPosition getEnd() { - return end; - } - -} +/******************************************************************************* + * Copyright (c) 2015 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.internal.qt.core.location; + +import org.eclipse.cdt.qt.core.location.IPosition; +import org.eclipse.cdt.qt.core.location.ISourceLocation; + +public class SourceLocation implements ISourceLocation { + private String source; + private IPosition start; + private IPosition end; + + public SourceLocation() { + this(null, null, null); + } + + public SourceLocation(String source, IPosition start, IPosition end) { + this.source = source; + this.start = start; + this.end = end; + } + + public void setSource(String value) { + this.source = value; + } + + @Override + public String getSource() { + return source; + } + + public void setStart(IPosition value) { + this.start = value; + } + + @Override + public IPosition getStart() { + return start; + } + + public void setEnd(IPosition value) { + this.end = value; + } + + @Override + public IPosition getEnd() { + return end; + } + +} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/qmldir/QDirAST.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/qmldir/QDirAST.java index 78f0f3e62eb..5a618546840 100644 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/qmldir/QDirAST.java +++ b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/qmldir/QDirAST.java @@ -1,36 +1,36 @@ -/******************************************************************************* - * Copyright (c) 2015 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.internal.qt.core.qmldir; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -import org.eclipse.cdt.qt.core.qmldir.IQDirAST; -import org.eclipse.cdt.qt.core.qmldir.IQDirCommand; - -public class QDirAST extends QDirASTNode implements IQDirAST { - private final List commands; - - public QDirAST() { - commands = new ArrayList<>(); - } - - public void addCommand(IQDirCommand command) { - commands.add(command); - } - - @Override - public List getCommands() { - return Collections.unmodifiableList(commands); - } - -} +/******************************************************************************* + * Copyright (c) 2015 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.internal.qt.core.qmldir; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +import org.eclipse.cdt.qt.core.qmldir.IQDirAST; +import org.eclipse.cdt.qt.core.qmldir.IQDirCommand; + +public class QDirAST extends QDirASTNode implements IQDirAST { + private final List commands; + + public QDirAST() { + commands = new ArrayList<>(); + } + + public void addCommand(IQDirCommand command) { + commands.add(command); + } + + @Override + public List getCommands() { + return Collections.unmodifiableList(commands); + } + +} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/qmldir/QDirASTNode.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/qmldir/QDirASTNode.java index a3fd9322755..1a9e3ef4fd0 100644 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/qmldir/QDirASTNode.java +++ b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/qmldir/QDirASTNode.java @@ -1,55 +1,55 @@ -/******************************************************************************* - * Copyright (c) 2015 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.internal.qt.core.qmldir; - -import org.eclipse.cdt.internal.qt.core.location.SourceLocation; -import org.eclipse.cdt.qt.core.qmldir.IQDirASTNode; - -public class QDirASTNode implements IQDirASTNode { - - private SourceLocation location; - private int start; - private int end; - - public QDirASTNode() { - this.location = new SourceLocation(); - this.start = -1; - this.end = -1; - } - - public void setLocation(SourceLocation value) { - this.location = value; - } - - @Override - public SourceLocation getLocation() { - return location; - } - - public void setStart(int value) { - this.start = value; - } - - @Override - public int getStart() { - return start; - } - - public void setEnd(int value) { - this.end = value; - } - - @Override - public int getEnd() { - return end; - } - -} +/******************************************************************************* + * Copyright (c) 2015 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.internal.qt.core.qmldir; + +import org.eclipse.cdt.internal.qt.core.location.SourceLocation; +import org.eclipse.cdt.qt.core.qmldir.IQDirASTNode; + +public class QDirASTNode implements IQDirASTNode { + + private SourceLocation location; + private int start; + private int end; + + public QDirASTNode() { + this.location = new SourceLocation(); + this.start = -1; + this.end = -1; + } + + public void setLocation(SourceLocation value) { + this.location = value; + } + + @Override + public SourceLocation getLocation() { + return location; + } + + public void setStart(int value) { + this.start = value; + } + + @Override + public int getStart() { + return start; + } + + public void setEnd(int value) { + this.end = value; + } + + @Override + public int getEnd() { + return end; + } + +} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/qmldir/QDirClassnameCommand.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/qmldir/QDirClassnameCommand.java index 6963f345416..a1ea7ab75ac 100644 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/qmldir/QDirClassnameCommand.java +++ b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/qmldir/QDirClassnameCommand.java @@ -1,28 +1,28 @@ -/******************************************************************************* - * Copyright (c) 2015 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.internal.qt.core.qmldir; - -import org.eclipse.cdt.qt.core.qmldir.IQDirClassnameCommand; - -public class QDirClassnameCommand extends QDirASTNode implements IQDirClassnameCommand { - - private QDirWord ident; - - public void setIdentifier(QDirWord value) { - this.ident = value; - } - - @Override - public QDirWord getIdentifier() { - return ident; - } - -} +/******************************************************************************* + * Copyright (c) 2015 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.internal.qt.core.qmldir; + +import org.eclipse.cdt.qt.core.qmldir.IQDirClassnameCommand; + +public class QDirClassnameCommand extends QDirASTNode implements IQDirClassnameCommand { + + private QDirWord ident; + + public void setIdentifier(QDirWord value) { + this.ident = value; + } + + @Override + public QDirWord getIdentifier() { + return ident; + } + +} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/qmldir/QDirCommentCommand.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/qmldir/QDirCommentCommand.java index 40505866bb0..b44d34be567 100644 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/qmldir/QDirCommentCommand.java +++ b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/qmldir/QDirCommentCommand.java @@ -1,28 +1,28 @@ -/******************************************************************************* - * Copyright (c) 2015 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.internal.qt.core.qmldir; - -import org.eclipse.cdt.qt.core.qmldir.IQDirCommentCommand; - -public class QDirCommentCommand extends QDirASTNode implements IQDirCommentCommand { - - private String text; - - public void setText(String value) { - this.text = value; - } - - @Override - public String getText() { - return text; - } - -} +/******************************************************************************* + * Copyright (c) 2015 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.internal.qt.core.qmldir; + +import org.eclipse.cdt.qt.core.qmldir.IQDirCommentCommand; + +public class QDirCommentCommand extends QDirASTNode implements IQDirCommentCommand { + + private String text; + + public void setText(String value) { + this.text = value; + } + + @Override + public String getText() { + return text; + } + +} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/qmldir/QDirDependsCommand.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/qmldir/QDirDependsCommand.java index 45639004a4f..15ffaa40900 100644 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/qmldir/QDirDependsCommand.java +++ b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/qmldir/QDirDependsCommand.java @@ -1,38 +1,38 @@ -/******************************************************************************* - * Copyright (c) 2015 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.internal.qt.core.qmldir; - -import org.eclipse.cdt.qt.core.qmldir.IQDirDependsCommand; - -public class QDirDependsCommand extends QDirASTNode implements IQDirDependsCommand { - - private QDirWord moduleName; - private QDirVersion version; - - public void setModuleIdentifier(QDirWord value) { - this.moduleName = value; - } - - @Override - public QDirWord getModuleIdentifier() { - return moduleName; - } - - public void setInitialVersion(QDirVersion value) { - this.version = value; - } - - @Override - public QDirVersion getInitialVersion() { - return version; - } - -} +/******************************************************************************* + * Copyright (c) 2015 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.internal.qt.core.qmldir; + +import org.eclipse.cdt.qt.core.qmldir.IQDirDependsCommand; + +public class QDirDependsCommand extends QDirASTNode implements IQDirDependsCommand { + + private QDirWord moduleName; + private QDirVersion version; + + public void setModuleIdentifier(QDirWord value) { + this.moduleName = value; + } + + @Override + public QDirWord getModuleIdentifier() { + return moduleName; + } + + public void setInitialVersion(QDirVersion value) { + this.version = value; + } + + @Override + public QDirVersion getInitialVersion() { + return version; + } + +} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/qmldir/QDirDesignerSupportedCommand.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/qmldir/QDirDesignerSupportedCommand.java index 9b7583a437c..b73274eefac 100644 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/qmldir/QDirDesignerSupportedCommand.java +++ b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/qmldir/QDirDesignerSupportedCommand.java @@ -1,16 +1,16 @@ -/******************************************************************************* - * Copyright (c) 2015 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.internal.qt.core.qmldir; - -import org.eclipse.cdt.qt.core.qmldir.IQDirDesignerSupportedCommand; - -public class QDirDesignerSupportedCommand extends QDirASTNode implements IQDirDesignerSupportedCommand { -} +/******************************************************************************* + * Copyright (c) 2015 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.internal.qt.core.qmldir; + +import org.eclipse.cdt.qt.core.qmldir.IQDirDesignerSupportedCommand; + +public class QDirDesignerSupportedCommand extends QDirASTNode implements IQDirDesignerSupportedCommand { +} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/qmldir/QDirInternalCommand.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/qmldir/QDirInternalCommand.java index b437e8dc708..9262ffec54a 100644 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/qmldir/QDirInternalCommand.java +++ b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/qmldir/QDirInternalCommand.java @@ -1,38 +1,38 @@ -/******************************************************************************* - * Copyright (c) 2015 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.internal.qt.core.qmldir; - -import org.eclipse.cdt.qt.core.qmldir.IQDirInternalCommand; - -public class QDirInternalCommand extends QDirASTNode implements IQDirInternalCommand { - - private QDirWord typeName; - private QDirWord file; - - public void setTypeName(QDirWord value) { - this.typeName = value; - } - - @Override - public QDirWord getTypeName() { - return typeName; - } - - public void setFile(QDirWord value) { - this.file = value; - } - - @Override - public QDirWord getFile() { - return file; - } - -} +/******************************************************************************* + * Copyright (c) 2015 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.internal.qt.core.qmldir; + +import org.eclipse.cdt.qt.core.qmldir.IQDirInternalCommand; + +public class QDirInternalCommand extends QDirASTNode implements IQDirInternalCommand { + + private QDirWord typeName; + private QDirWord file; + + public void setTypeName(QDirWord value) { + this.typeName = value; + } + + @Override + public QDirWord getTypeName() { + return typeName; + } + + public void setFile(QDirWord value) { + this.file = value; + } + + @Override + public QDirWord getFile() { + return file; + } + +} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/qmldir/QDirModuleCommand.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/qmldir/QDirModuleCommand.java index cea1f44b25b..08b29a05777 100644 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/qmldir/QDirModuleCommand.java +++ b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/qmldir/QDirModuleCommand.java @@ -1,27 +1,27 @@ -/******************************************************************************* - * Copyright (c) 2015 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.internal.qt.core.qmldir; - -import org.eclipse.cdt.qt.core.qmldir.IQDirModuleCommand; - -public class QDirModuleCommand extends QDirASTNode implements IQDirModuleCommand { - private QDirWord identifier; - - public void setModuleIdentifier(QDirWord value) { - this.identifier = value; - } - - @Override - public QDirWord getModuleIdentifier() { - return identifier; - } - -} +/******************************************************************************* + * Copyright (c) 2015 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.internal.qt.core.qmldir; + +import org.eclipse.cdt.qt.core.qmldir.IQDirModuleCommand; + +public class QDirModuleCommand extends QDirASTNode implements IQDirModuleCommand { + private QDirWord identifier; + + public void setModuleIdentifier(QDirWord value) { + this.identifier = value; + } + + @Override + public QDirWord getModuleIdentifier() { + return identifier; + } + +} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/qmldir/QDirPluginCommand.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/qmldir/QDirPluginCommand.java index 61fbb2fbdbe..e2ff96311d5 100644 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/qmldir/QDirPluginCommand.java +++ b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/qmldir/QDirPluginCommand.java @@ -1,38 +1,38 @@ -/******************************************************************************* - * Copyright (c) 2015 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.internal.qt.core.qmldir; - -import org.eclipse.cdt.qt.core.qmldir.IQDirPluginCommand; - -public class QDirPluginCommand extends QDirASTNode implements IQDirPluginCommand { - - private QDirWord qid; - private QDirWord path; - - public void setName(QDirWord value) { - this.qid = value; - } - - @Override - public QDirWord getName() { - return qid; - } - - public void setPath(QDirWord value) { - this.path = value; - } - - @Override - public QDirWord getPath() { - return path; - } - -} +/******************************************************************************* + * Copyright (c) 2015 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.internal.qt.core.qmldir; + +import org.eclipse.cdt.qt.core.qmldir.IQDirPluginCommand; + +public class QDirPluginCommand extends QDirASTNode implements IQDirPluginCommand { + + private QDirWord qid; + private QDirWord path; + + public void setName(QDirWord value) { + this.qid = value; + } + + @Override + public QDirWord getName() { + return qid; + } + + public void setPath(QDirWord value) { + this.path = value; + } + + @Override + public QDirWord getPath() { + return path; + } + +} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/qmldir/QDirResourceCommand.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/qmldir/QDirResourceCommand.java index 7c9b8541a80..7c3a2e5c280 100644 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/qmldir/QDirResourceCommand.java +++ b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/qmldir/QDirResourceCommand.java @@ -1,47 +1,47 @@ -/******************************************************************************* - * Copyright (c) 2015 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.internal.qt.core.qmldir; - -import org.eclipse.cdt.qt.core.qmldir.IQDirResourceCommand; - -public class QDirResourceCommand extends QDirASTNode implements IQDirResourceCommand { - private QDirWord typeName; - private QDirVersion version; - private QDirWord file; - - public void setResourceIdentifier(QDirWord value) { - this.typeName = value; - } - - @Override - public QDirWord getResourceIdentifier() { - return typeName; - } - - public void setInitialVersion(QDirVersion value) { - this.version = value; - } - - @Override - public QDirVersion getInitialVersion() { - return version; - } - - public void setFile(QDirWord value) { - this.file = value; - } - - @Override - public QDirWord getFile() { - return file; - } - -} +/******************************************************************************* + * Copyright (c) 2015 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.internal.qt.core.qmldir; + +import org.eclipse.cdt.qt.core.qmldir.IQDirResourceCommand; + +public class QDirResourceCommand extends QDirASTNode implements IQDirResourceCommand { + private QDirWord typeName; + private QDirVersion version; + private QDirWord file; + + public void setResourceIdentifier(QDirWord value) { + this.typeName = value; + } + + @Override + public QDirWord getResourceIdentifier() { + return typeName; + } + + public void setInitialVersion(QDirVersion value) { + this.version = value; + } + + @Override + public QDirVersion getInitialVersion() { + return version; + } + + public void setFile(QDirWord value) { + this.file = value; + } + + @Override + public QDirWord getFile() { + return file; + } + +} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/qmldir/QDirSingletonCommand.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/qmldir/QDirSingletonCommand.java index 03208f0afd6..933ccaaefd8 100644 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/qmldir/QDirSingletonCommand.java +++ b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/qmldir/QDirSingletonCommand.java @@ -1,48 +1,48 @@ -/******************************************************************************* - * Copyright (c) 2015 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.internal.qt.core.qmldir; - -import org.eclipse.cdt.qt.core.qmldir.IQDirSingletonCommand; - -public class QDirSingletonCommand extends QDirASTNode implements IQDirSingletonCommand { - - private QDirWord typeName; - private QDirVersion version; - private QDirWord file; - - public void setTypeName(QDirWord value) { - this.typeName = value; - } - - @Override - public QDirWord getTypeName() { - return typeName; - } - - public void setInitialVersion(QDirVersion value) { - this.version = value; - } - - @Override - public QDirVersion getInitialVersion() { - return version; - } - - public void setFile(QDirWord value) { - this.file = value; - } - - @Override - public QDirWord getFile() { - return file; - } - -} +/******************************************************************************* + * Copyright (c) 2015 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.internal.qt.core.qmldir; + +import org.eclipse.cdt.qt.core.qmldir.IQDirSingletonCommand; + +public class QDirSingletonCommand extends QDirASTNode implements IQDirSingletonCommand { + + private QDirWord typeName; + private QDirVersion version; + private QDirWord file; + + public void setTypeName(QDirWord value) { + this.typeName = value; + } + + @Override + public QDirWord getTypeName() { + return typeName; + } + + public void setInitialVersion(QDirVersion value) { + this.version = value; + } + + @Override + public QDirVersion getInitialVersion() { + return version; + } + + public void setFile(QDirWord value) { + this.file = value; + } + + @Override + public QDirWord getFile() { + return file; + } + +} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/qmldir/QDirSyntaxError.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/qmldir/QDirSyntaxError.java index a66b968ddb3..d186887cc70 100644 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/qmldir/QDirSyntaxError.java +++ b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/qmldir/QDirSyntaxError.java @@ -1,40 +1,40 @@ -/******************************************************************************* - * Copyright (c) 2015 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.internal.qt.core.qmldir; - -import org.eclipse.cdt.qt.core.qmldir.IQDirASTNode; -import org.eclipse.cdt.qt.core.qmldir.IQDirSyntaxError; -import org.eclipse.cdt.qt.core.qmldir.QMLDirectoryLexer.Token; -import org.eclipse.cdt.qt.core.qmldir.QMLDirectoryParser.SyntaxError; - -public class QDirSyntaxError extends QDirASTNode implements IQDirSyntaxError { - private SyntaxError exception; - - public QDirSyntaxError(SyntaxError exception) { - this.exception = exception; - } - - @Override - public Token getOffendingToken() { - return this.exception.getOffendingToken(); - } - - @Override - public IQDirASTNode getIncompleteNode() { - return this.exception.getIncompleteNode(); - } - - @Override - public SyntaxError getSyntaxError() { - return this.exception; - } - -} +/******************************************************************************* + * Copyright (c) 2015 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.internal.qt.core.qmldir; + +import org.eclipse.cdt.qt.core.qmldir.IQDirASTNode; +import org.eclipse.cdt.qt.core.qmldir.IQDirSyntaxError; +import org.eclipse.cdt.qt.core.qmldir.QMLDirectoryLexer.Token; +import org.eclipse.cdt.qt.core.qmldir.QMLDirectoryParser.SyntaxError; + +public class QDirSyntaxError extends QDirASTNode implements IQDirSyntaxError { + private SyntaxError exception; + + public QDirSyntaxError(SyntaxError exception) { + this.exception = exception; + } + + @Override + public Token getOffendingToken() { + return this.exception.getOffendingToken(); + } + + @Override + public IQDirASTNode getIncompleteNode() { + return this.exception.getIncompleteNode(); + } + + @Override + public SyntaxError getSyntaxError() { + return this.exception; + } + +} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/qmldir/QDirTypeInfoCommand.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/qmldir/QDirTypeInfoCommand.java index 9b2f00e1a9b..0332e141ee2 100644 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/qmldir/QDirTypeInfoCommand.java +++ b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/qmldir/QDirTypeInfoCommand.java @@ -1,28 +1,28 @@ -/******************************************************************************* - * Copyright (c) 2015 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.internal.qt.core.qmldir; - -import org.eclipse.cdt.qt.core.qmldir.IQDirTypeInfoCommand; - -public class QDirTypeInfoCommand extends QDirASTNode implements IQDirTypeInfoCommand { - - private QDirWord file; - - public void setFile(QDirWord value) { - this.file = value; - } - - @Override - public QDirWord getFile() { - return file; - } - -} +/******************************************************************************* + * Copyright (c) 2015 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.internal.qt.core.qmldir; + +import org.eclipse.cdt.qt.core.qmldir.IQDirTypeInfoCommand; + +public class QDirTypeInfoCommand extends QDirASTNode implements IQDirTypeInfoCommand { + + private QDirWord file; + + public void setFile(QDirWord value) { + this.file = value; + } + + @Override + public QDirWord getFile() { + return file; + } + +} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/qmldir/QDirVersion.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/qmldir/QDirVersion.java index 4a3c3dabe3a..161ffdf6726 100644 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/qmldir/QDirVersion.java +++ b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/qmldir/QDirVersion.java @@ -1,28 +1,28 @@ -/******************************************************************************* - * Copyright (c) 2015 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.internal.qt.core.qmldir; - -import org.eclipse.cdt.qt.core.qmldir.IQDirVersion; - -public class QDirVersion extends QDirASTNode implements IQDirVersion { - - private String version; - - public void setVersionString(String value) { - this.version = value; - } - - @Override - public String getVersionString() { - return version; - } - -} +/******************************************************************************* + * Copyright (c) 2015 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.internal.qt.core.qmldir; + +import org.eclipse.cdt.qt.core.qmldir.IQDirVersion; + +public class QDirVersion extends QDirASTNode implements IQDirVersion { + + private String version; + + public void setVersionString(String value) { + this.version = value; + } + + @Override + public String getVersionString() { + return version; + } + +} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/qmldir/QDirWord.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/qmldir/QDirWord.java index 89aac96b739..76ea26a8bf0 100644 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/qmldir/QDirWord.java +++ b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/qmldir/QDirWord.java @@ -1,28 +1,28 @@ -/******************************************************************************* - * Copyright (c) 2015 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.internal.qt.core.qmldir; - -import org.eclipse.cdt.qt.core.qmldir.IQDirWord; - -public class QDirWord extends QDirASTNode implements IQDirWord { - - private String text; - - public void setText(String value) { - this.text = value; - } - - @Override - public String getText() { - return text; - } - -} +/******************************************************************************* + * Copyright (c) 2015 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.internal.qt.core.qmldir; + +import org.eclipse.cdt.qt.core.qmldir.IQDirWord; + +public class QDirWord extends QDirASTNode implements IQDirWord { + + private String text; + + public void setText(String value) { + this.text = value; + } + + @Override + public String getText() { + return text; + } + +} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/qmltypes/QMLComponentInfo.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/qmltypes/QMLComponentInfo.java index b33d24a18a5..5a30528aaf1 100644 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/qmltypes/QMLComponentInfo.java +++ b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/qmltypes/QMLComponentInfo.java @@ -1,139 +1,139 @@ -/******************************************************************************* - * Copyright (c) 2015 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.internal.qt.core.qmltypes; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.List; - -import org.eclipse.cdt.qt.core.qmljs.IQmlObjectDefinition; -import org.eclipse.cdt.qt.core.qmljs.IQmlObjectMember; -import org.eclipse.cdt.qt.core.qmljs.IQmlPropertyBinding; - -public class QMLComponentInfo { - static final String IDENTIFIER = "Component"; //$NON-NLS-1$ - - static final String PROPERTY_NAME = "name"; //$NON-NLS-1$ - static final String PROPERTY_PROTOTYPE = "prototype"; //$NON-NLS-1$ - static final String PROPERTY_DEF_PROPERTY = "defaultProperty"; //$NON-NLS-1$ - static final String PROPERTY_ATTACHED_TYPE = "attachedType"; //$NON-NLS-1$ - static final String PROPERTY_EXPORTS = "exports"; //$NON-NLS-1$ - static final String PROPERTY_EXPORT_REVISIONS = "exportMetaObjectRevisions"; //$NON-NLS-1$ - - private String name; - private String prototype; - private String defaultProperty; - private String attachedType; - private Integer[] exportMetaObjectRevisions; - private List exportList = new ArrayList<>(); - private List propertyList = new ArrayList<>(); - private List methodList = new ArrayList<>(); - private List signalList = new ArrayList<>(); - private List enumList = new ArrayList<>(); - - protected QMLComponentInfo(QMLModelBuilder builder, IQmlObjectDefinition obj) { - builder.ensureIdentifier(obj.getIdentifier(), IDENTIFIER); - for (IQmlObjectMember member : obj.getBody().getMembers()) { - if (member instanceof IQmlPropertyBinding) { - IQmlPropertyBinding prop = (IQmlPropertyBinding) member; - switch (prop.getIdentifier().getName()) { - case PROPERTY_NAME: - this.name = builder.getStringBinding(prop); - break; - case PROPERTY_PROTOTYPE: - this.prototype = builder.getStringBinding(prop); - break; - case PROPERTY_DEF_PROPERTY: - this.defaultProperty = builder.getStringBinding(prop); - break; - case PROPERTY_ATTACHED_TYPE: - this.attachedType = builder.getStringBinding(prop); - break; - case PROPERTY_EXPORTS: - String[] exports = builder.getStringArrayBinding(prop); - for (String exp : exports) { - this.exportList.add(new QMLExportInfo(builder, exp)); - } - break; - case PROPERTY_EXPORT_REVISIONS: - this.exportMetaObjectRevisions = builder.getIntegerArrayBinding(prop); - break; - default: - } - } else if (member instanceof IQmlObjectDefinition) { - IQmlObjectDefinition object = (IQmlObjectDefinition) member; - switch (object.getIdentifier().getName()) { - case QMLPropertyInfo.IDENTIFIER: - this.propertyList.add(new QMLPropertyInfo(builder, object)); - break; - case QMLMethodInfo.IDENTIFIER: - this.methodList.add(new QMLMethodInfo(builder, object)); - break; - case QMLSignalInfo.IDENTIFIER: - this.signalList.add(new QMLSignalInfo(builder, object)); - break; - case QMLEnumInfo.IDENTIFIER: - this.enumList.add(new QMLEnumInfo(builder, object)); - break; - default: - } - } else { - builder.unexpectedNode(member); - } - } - exportList = Collections.unmodifiableList(exportList); - propertyList = Collections.unmodifiableList(propertyList); - methodList = Collections.unmodifiableList(methodList); - signalList = Collections.unmodifiableList(signalList); - enumList = Collections.unmodifiableList(enumList); - } - - public String getName() { - return name; - } - - public String getPrototype() { - return prototype; - } - - public String getDefaultProperty() { - return defaultProperty; - } - - public String getAttachedType() { - return attachedType; - } - - public List getExports() { - return exportList; - } - - public Integer[] getExportMetaObjectRevisions() { - return Arrays.copyOf(exportMetaObjectRevisions, exportMetaObjectRevisions.length); - } - - public List getProperties() { - return propertyList; - } - - public List getMethods() { - return methodList; - } - - public List getSignals() { - return signalList; - } - - public List getEnums() { - return enumList; - } -} +/******************************************************************************* + * Copyright (c) 2015 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.internal.qt.core.qmltypes; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; + +import org.eclipse.cdt.qt.core.qmljs.IQmlObjectDefinition; +import org.eclipse.cdt.qt.core.qmljs.IQmlObjectMember; +import org.eclipse.cdt.qt.core.qmljs.IQmlPropertyBinding; + +public class QMLComponentInfo { + static final String IDENTIFIER = "Component"; //$NON-NLS-1$ + + static final String PROPERTY_NAME = "name"; //$NON-NLS-1$ + static final String PROPERTY_PROTOTYPE = "prototype"; //$NON-NLS-1$ + static final String PROPERTY_DEF_PROPERTY = "defaultProperty"; //$NON-NLS-1$ + static final String PROPERTY_ATTACHED_TYPE = "attachedType"; //$NON-NLS-1$ + static final String PROPERTY_EXPORTS = "exports"; //$NON-NLS-1$ + static final String PROPERTY_EXPORT_REVISIONS = "exportMetaObjectRevisions"; //$NON-NLS-1$ + + private String name; + private String prototype; + private String defaultProperty; + private String attachedType; + private Integer[] exportMetaObjectRevisions; + private List exportList = new ArrayList<>(); + private List propertyList = new ArrayList<>(); + private List methodList = new ArrayList<>(); + private List signalList = new ArrayList<>(); + private List enumList = new ArrayList<>(); + + protected QMLComponentInfo(QMLModelBuilder builder, IQmlObjectDefinition obj) { + builder.ensureIdentifier(obj.getIdentifier(), IDENTIFIER); + for (IQmlObjectMember member : obj.getBody().getMembers()) { + if (member instanceof IQmlPropertyBinding) { + IQmlPropertyBinding prop = (IQmlPropertyBinding) member; + switch (prop.getIdentifier().getName()) { + case PROPERTY_NAME: + this.name = builder.getStringBinding(prop); + break; + case PROPERTY_PROTOTYPE: + this.prototype = builder.getStringBinding(prop); + break; + case PROPERTY_DEF_PROPERTY: + this.defaultProperty = builder.getStringBinding(prop); + break; + case PROPERTY_ATTACHED_TYPE: + this.attachedType = builder.getStringBinding(prop); + break; + case PROPERTY_EXPORTS: + String[] exports = builder.getStringArrayBinding(prop); + for (String exp : exports) { + this.exportList.add(new QMLExportInfo(builder, exp)); + } + break; + case PROPERTY_EXPORT_REVISIONS: + this.exportMetaObjectRevisions = builder.getIntegerArrayBinding(prop); + break; + default: + } + } else if (member instanceof IQmlObjectDefinition) { + IQmlObjectDefinition object = (IQmlObjectDefinition) member; + switch (object.getIdentifier().getName()) { + case QMLPropertyInfo.IDENTIFIER: + this.propertyList.add(new QMLPropertyInfo(builder, object)); + break; + case QMLMethodInfo.IDENTIFIER: + this.methodList.add(new QMLMethodInfo(builder, object)); + break; + case QMLSignalInfo.IDENTIFIER: + this.signalList.add(new QMLSignalInfo(builder, object)); + break; + case QMLEnumInfo.IDENTIFIER: + this.enumList.add(new QMLEnumInfo(builder, object)); + break; + default: + } + } else { + builder.unexpectedNode(member); + } + } + exportList = Collections.unmodifiableList(exportList); + propertyList = Collections.unmodifiableList(propertyList); + methodList = Collections.unmodifiableList(methodList); + signalList = Collections.unmodifiableList(signalList); + enumList = Collections.unmodifiableList(enumList); + } + + public String getName() { + return name; + } + + public String getPrototype() { + return prototype; + } + + public String getDefaultProperty() { + return defaultProperty; + } + + public String getAttachedType() { + return attachedType; + } + + public List getExports() { + return exportList; + } + + public Integer[] getExportMetaObjectRevisions() { + return Arrays.copyOf(exportMetaObjectRevisions, exportMetaObjectRevisions.length); + } + + public List getProperties() { + return propertyList; + } + + public List getMethods() { + return methodList; + } + + public List getSignals() { + return signalList; + } + + public List getEnums() { + return enumList; + } +} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/qmltypes/QMLEnumInfo.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/qmltypes/QMLEnumInfo.java index 3d1c19dc0b2..99676d4d851 100644 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/qmltypes/QMLEnumInfo.java +++ b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/qmltypes/QMLEnumInfo.java @@ -1,96 +1,96 @@ -/******************************************************************************* - * Copyright (c) 2015 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.internal.qt.core.qmltypes; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -import org.eclipse.cdt.qt.core.qmljs.IJSObjectExpression; -import org.eclipse.cdt.qt.core.qmljs.IJSProperty; -import org.eclipse.cdt.qt.core.qmljs.IQmlObjectDefinition; -import org.eclipse.cdt.qt.core.qmljs.IQmlObjectMember; -import org.eclipse.cdt.qt.core.qmljs.IQmlPropertyBinding; -import org.eclipse.cdt.qt.core.qmljs.IQmlScriptBinding; -import org.eclipse.cdt.qt.core.qmljs.QMLExpressionEvaluator; -import org.eclipse.cdt.qt.core.qmljs.QMLExpressionEvaluator.InvalidExpressionException; - -public class QMLEnumInfo { - public static class EnumConst { - private final String identifier; - private final int value; - - private EnumConst(String ident, int val) { - this.identifier = ident; - this.value = val; - } - - public String getIdentifier() { - return identifier; - } - - public int getValue() { - return value; - } - } - - static final String IDENTIFIER = "Enum"; //$NON-NLS-1$ - - static final String PROPERTY_NAME = "name"; //$NON-NLS-1$ - static final String PROPERTY_VALUE = "values"; //$NON-NLS-1$ - - private String name; - private List constantList = new ArrayList<>(); - - QMLEnumInfo(QMLModelBuilder builder, IQmlObjectDefinition obj) { - if (builder.ensureIdentifier(obj.getIdentifier(), IDENTIFIER)) { - for (IQmlObjectMember member : obj.getBody().getMembers()) { - if (builder.ensureNode(member, IQmlPropertyBinding.class)) { - IQmlPropertyBinding prop = (IQmlPropertyBinding) member; - switch (prop.getIdentifier().getName()) { - case PROPERTY_NAME: - this.name = builder.getStringBinding(prop); - break; - case PROPERTY_VALUE: - if (builder.ensureNode(prop.getBinding(), IQmlScriptBinding.class)) { - IQmlScriptBinding binding = ((IQmlScriptBinding) prop.getBinding()); - if (builder.ensureNode(binding.getScript(), IJSObjectExpression.class)) { - IJSObjectExpression objExpr = (IJSObjectExpression) binding.getScript(); - for (IJSProperty property : objExpr.getProperties()) { - Object value; - try { - value = QMLExpressionEvaluator.evaluateConstExpr(property.getValue()); - if (value instanceof Number) { - constantList.add(new EnumConst(property.getType(), ((Number) value).intValue())); - } - } catch (InvalidExpressionException e) { - builder.handleException(e); - } - } - } - } - break; - default: - } - } - } - } - constantList = Collections.unmodifiableList(constantList); - } - - public String getName() { - return name; - } - - public List getConstants() { - return constantList; - } -} +/******************************************************************************* + * Copyright (c) 2015 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.internal.qt.core.qmltypes; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +import org.eclipse.cdt.qt.core.qmljs.IJSObjectExpression; +import org.eclipse.cdt.qt.core.qmljs.IJSProperty; +import org.eclipse.cdt.qt.core.qmljs.IQmlObjectDefinition; +import org.eclipse.cdt.qt.core.qmljs.IQmlObjectMember; +import org.eclipse.cdt.qt.core.qmljs.IQmlPropertyBinding; +import org.eclipse.cdt.qt.core.qmljs.IQmlScriptBinding; +import org.eclipse.cdt.qt.core.qmljs.QMLExpressionEvaluator; +import org.eclipse.cdt.qt.core.qmljs.QMLExpressionEvaluator.InvalidExpressionException; + +public class QMLEnumInfo { + public static class EnumConst { + private final String identifier; + private final int value; + + private EnumConst(String ident, int val) { + this.identifier = ident; + this.value = val; + } + + public String getIdentifier() { + return identifier; + } + + public int getValue() { + return value; + } + } + + static final String IDENTIFIER = "Enum"; //$NON-NLS-1$ + + static final String PROPERTY_NAME = "name"; //$NON-NLS-1$ + static final String PROPERTY_VALUE = "values"; //$NON-NLS-1$ + + private String name; + private List constantList = new ArrayList<>(); + + QMLEnumInfo(QMLModelBuilder builder, IQmlObjectDefinition obj) { + if (builder.ensureIdentifier(obj.getIdentifier(), IDENTIFIER)) { + for (IQmlObjectMember member : obj.getBody().getMembers()) { + if (builder.ensureNode(member, IQmlPropertyBinding.class)) { + IQmlPropertyBinding prop = (IQmlPropertyBinding) member; + switch (prop.getIdentifier().getName()) { + case PROPERTY_NAME: + this.name = builder.getStringBinding(prop); + break; + case PROPERTY_VALUE: + if (builder.ensureNode(prop.getBinding(), IQmlScriptBinding.class)) { + IQmlScriptBinding binding = ((IQmlScriptBinding) prop.getBinding()); + if (builder.ensureNode(binding.getScript(), IJSObjectExpression.class)) { + IJSObjectExpression objExpr = (IJSObjectExpression) binding.getScript(); + for (IJSProperty property : objExpr.getProperties()) { + Object value; + try { + value = QMLExpressionEvaluator.evaluateConstExpr(property.getValue()); + if (value instanceof Number) { + constantList.add(new EnumConst(property.getType(), ((Number) value).intValue())); + } + } catch (InvalidExpressionException e) { + builder.handleException(e); + } + } + } + } + break; + default: + } + } + } + } + constantList = Collections.unmodifiableList(constantList); + } + + public String getName() { + return name; + } + + public List getConstants() { + return constantList; + } +} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/qmltypes/QMLExportInfo.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/qmltypes/QMLExportInfo.java index 2a4707ed626..7fd83edf732 100644 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/qmltypes/QMLExportInfo.java +++ b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/qmltypes/QMLExportInfo.java @@ -1,37 +1,37 @@ -/******************************************************************************* - * Copyright (c) 2015 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.internal.qt.core.qmltypes; - -public class QMLExportInfo { - private String type; - private String version; - - QMLExportInfo(QMLModelBuilder builder, String export) { - String[] info = export.split("\\h+"); //$NON-NLS-1$ - switch (info.length) { - case 2: - this.type = info[0]; - this.version = info[1]; - break; - case 1: - this.type = info[0]; - break; - } - } - - public String getType() { - return type; - } - - public String getVersion() { - return version; - } -} +/******************************************************************************* + * Copyright (c) 2015 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.internal.qt.core.qmltypes; + +public class QMLExportInfo { + private String type; + private String version; + + QMLExportInfo(QMLModelBuilder builder, String export) { + String[] info = export.split("\\h+"); //$NON-NLS-1$ + switch (info.length) { + case 2: + this.type = info[0]; + this.version = info[1]; + break; + case 1: + this.type = info[0]; + break; + } + } + + public String getType() { + return type; + } + + public String getVersion() { + return version; + } +} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/qmltypes/QMLMethodInfo.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/qmltypes/QMLMethodInfo.java index a09b6fd8f16..01a4c71ec62 100644 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/qmltypes/QMLMethodInfo.java +++ b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/qmltypes/QMLMethodInfo.java @@ -1,69 +1,69 @@ -/******************************************************************************* - * Copyright (c) 2015 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.internal.qt.core.qmltypes; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.cdt.qt.core.qmljs.IQmlObjectDefinition; -import org.eclipse.cdt.qt.core.qmljs.IQmlObjectMember; -import org.eclipse.cdt.qt.core.qmljs.IQmlPropertyBinding; - -public class QMLMethodInfo { - static final String IDENTIFIER = "Method"; //$NON-NLS-1$ - - static final String PROPERTY_NAME = "name"; //$NON-NLS-1$ s - static final String PROPERTY_TYPE = "type"; //$NON-NLS-1$ - static final String PROPERTY_REVISION = "revision"; //$NON-NLS-1$ - - private String name; - private String type; - private int revision; - private List parameterList = new ArrayList<>(); - - QMLMethodInfo(QMLModelBuilder builder, IQmlObjectDefinition obj) { - if (builder.ensureIdentifier(obj.getIdentifier(), IDENTIFIER)) { - for (IQmlObjectMember member : obj.getBody().getMembers()) { - if (member instanceof IQmlPropertyBinding) { - IQmlPropertyBinding prop = (IQmlPropertyBinding) member; - switch (prop.getIdentifier().getName()) { - case PROPERTY_NAME: - this.name = builder.getStringBinding(prop); - break; - case PROPERTY_TYPE: - this.type = builder.getStringBinding(prop); - break; - case PROPERTY_REVISION: - this.revision = builder.getIntegerBinding(prop); - break; - default: - } - } else if (member instanceof IQmlObjectDefinition) { - this.parameterList.add(new QMLParameterInfo(builder, (IQmlObjectDefinition) member)); - } else { - builder.unexpectedNode(member); - } - } - } - } - - public String getName() { - return name; - } - - public String getType() { - return type; - } - - public int getRevision() { - return revision; - } -} +/******************************************************************************* + * Copyright (c) 2015 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.internal.qt.core.qmltypes; + +import java.util.ArrayList; +import java.util.List; + +import org.eclipse.cdt.qt.core.qmljs.IQmlObjectDefinition; +import org.eclipse.cdt.qt.core.qmljs.IQmlObjectMember; +import org.eclipse.cdt.qt.core.qmljs.IQmlPropertyBinding; + +public class QMLMethodInfo { + static final String IDENTIFIER = "Method"; //$NON-NLS-1$ + + static final String PROPERTY_NAME = "name"; //$NON-NLS-1$ s + static final String PROPERTY_TYPE = "type"; //$NON-NLS-1$ + static final String PROPERTY_REVISION = "revision"; //$NON-NLS-1$ + + private String name; + private String type; + private int revision; + private List parameterList = new ArrayList<>(); + + QMLMethodInfo(QMLModelBuilder builder, IQmlObjectDefinition obj) { + if (builder.ensureIdentifier(obj.getIdentifier(), IDENTIFIER)) { + for (IQmlObjectMember member : obj.getBody().getMembers()) { + if (member instanceof IQmlPropertyBinding) { + IQmlPropertyBinding prop = (IQmlPropertyBinding) member; + switch (prop.getIdentifier().getName()) { + case PROPERTY_NAME: + this.name = builder.getStringBinding(prop); + break; + case PROPERTY_TYPE: + this.type = builder.getStringBinding(prop); + break; + case PROPERTY_REVISION: + this.revision = builder.getIntegerBinding(prop); + break; + default: + } + } else if (member instanceof IQmlObjectDefinition) { + this.parameterList.add(new QMLParameterInfo(builder, (IQmlObjectDefinition) member)); + } else { + builder.unexpectedNode(member); + } + } + } + } + + public String getName() { + return name; + } + + public String getType() { + return type; + } + + public int getRevision() { + return revision; + } +} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/qmltypes/QMLModelBuilder.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/qmltypes/QMLModelBuilder.java index 401d941e4b5..f7dd6da11db 100644 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/qmltypes/QMLModelBuilder.java +++ b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/qmltypes/QMLModelBuilder.java @@ -1,191 +1,191 @@ -/******************************************************************************* - * Copyright (c) 2015 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.internal.qt.core.qmltypes; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Map; - -import org.eclipse.cdt.internal.qt.core.Activator; -import org.eclipse.cdt.qt.core.qmljs.IJSArrayExpression; -import org.eclipse.cdt.qt.core.qmljs.IJSExpression; -import org.eclipse.cdt.qt.core.qmljs.IQmlASTNode; -import org.eclipse.cdt.qt.core.qmljs.IQmlBinding; -import org.eclipse.cdt.qt.core.qmljs.IQmlProgram; -import org.eclipse.cdt.qt.core.qmljs.IQmlPropertyBinding; -import org.eclipse.cdt.qt.core.qmljs.IQmlQualifiedID; -import org.eclipse.cdt.qt.core.qmljs.IQmlRootObject; -import org.eclipse.cdt.qt.core.qmljs.IQmlScriptBinding; -import org.eclipse.cdt.qt.core.qmljs.QMLExpressionEvaluator; -import org.eclipse.cdt.qt.core.qmljs.QMLExpressionEvaluator.InvalidExpressionException; - -public class QMLModelBuilder { - - private final Map moduleMap = new HashMap<>(); - - public QMLModelBuilder() { - } - - public QMLModuleInfo addModule(String module, IQmlASTNode ast) { - QMLModuleInfo info = moduleMap.get(module); - if (!moduleMap.containsKey(module)) { - if (ensureNode(ast, IQmlProgram.class)) { - IQmlRootObject obj = ((IQmlProgram) ast).getRootObject(); - if (ensureNode(obj, IQmlRootObject.class)) { - info = new QMLModuleInfo(this, obj); - moduleMap.put(module, info); - } - } - } - return info; - } - - public QMLModuleInfo getModule(String module) { - return moduleMap.get(module); - } - - public boolean hasModule(String module) { - return moduleMap.get(module) != null; - } - - boolean ensureIdentifier(IQmlQualifiedID actual, String expected) { - if (!actual.getName().equals(expected)) { - Activator.log("[QmlTypes] Unexpected node identifier: expected '" + expected + "', but was '" //$NON-NLS-1$ //$NON-NLS-2$ - + actual.getName() + "'"); //$NON-NLS-1$ - return false; - } - return true; - } - - boolean ensureNode(IQmlASTNode actual, Class expected) { - if (!expected.isInstance(actual)) { - Activator.log("[QmlTypes] Expected node '" + expected + "', but was '" + actual.getClass().getInterfaces()[0] + "'"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - return false; - } - return true; - } - - boolean ensureValue(Object actual, Class expected) { - if (!expected.isInstance(actual)) { - Activator.log("[QmlTypes] Unexpected value: expected '" + expected + "', but was '" //$NON-NLS-1$ //$NON-NLS-2$ - + actual.getClass().getInterfaces()[0] + "'"); //$NON-NLS-1$ - return false; - } - return true; - } - - void unexpectedNode(IQmlASTNode node) { - Activator.log("[QmlTypes] Unexpected node '" + node.getClass().getInterfaces()[0] + "'"); //$NON-NLS-1$ //$NON-NLS-2$ - } - - String getStringBinding(IQmlPropertyBinding prop) { - IQmlBinding b = prop.getBinding(); - if (ensureNode(b, IQmlScriptBinding.class)) { - IQmlScriptBinding sb = (IQmlScriptBinding) b; - if (ensureNode(sb.getScript(), IJSExpression.class)) { - try { - Object value = QMLExpressionEvaluator.evaluateConstExpr((IJSExpression) sb.getScript()); - if (value instanceof String) { - return (String) value; - } - } catch (InvalidExpressionException e) { - handleException(e); - } - } - } - return null; - } - - String[] getStringArrayBinding(IQmlPropertyBinding prop) { - ArrayList result = new ArrayList<>(); - IQmlBinding b = prop.getBinding(); - if (ensureNode(b, IQmlScriptBinding.class)) { - IQmlScriptBinding sb = (IQmlScriptBinding) b; - if (ensureNode(sb.getScript(), IJSArrayExpression.class)) { - IJSArrayExpression arrExpr = (IJSArrayExpression) sb.getScript(); - for (IJSExpression expr : arrExpr.getElements()) { - try { - Object value = QMLExpressionEvaluator.evaluateConstExpr(expr); - if (value instanceof String) { - result.add((String) value); - } - } catch (InvalidExpressionException e) { - handleException(e); - } - } - } - } - return result.toArray(new String[result.size()]); - } - - public Integer[] getIntegerArrayBinding(IQmlPropertyBinding prop) { - ArrayList result = new ArrayList<>(); - IQmlBinding b = prop.getBinding(); - if (ensureNode(b, IQmlScriptBinding.class)) { - IQmlScriptBinding sb = (IQmlScriptBinding) b; - if (ensureNode(sb.getScript(), IJSArrayExpression.class)) { - IJSArrayExpression arrExpr = (IJSArrayExpression) sb.getScript(); - for (IJSExpression expr : arrExpr.getElements()) { - try { - Object value = QMLExpressionEvaluator.evaluateConstExpr(expr); - if (value instanceof Number) { - result.add(((Number) value).intValue()); - } - } catch (InvalidExpressionException e) { - handleException(e); - } - } - } - } - return result.toArray(new Integer[result.size()]); - } - - boolean getBooleanBinding(IQmlPropertyBinding prop) { - IQmlBinding b = prop.getBinding(); - if (ensureNode(b, IQmlScriptBinding.class)) { - IQmlScriptBinding sb = (IQmlScriptBinding) b; - if (ensureNode(sb.getScript(), IJSExpression.class)) { - try { - Object value = QMLExpressionEvaluator.evaluateConstExpr((IJSExpression) sb.getScript()); - if (value instanceof Number) { - return (Boolean) value; - } - } catch (InvalidExpressionException e) { - handleException(e); - } - } - } - return false; - } - - public Integer getIntegerBinding(IQmlPropertyBinding prop) { - IQmlBinding b = prop.getBinding(); - if (ensureNode(b, IQmlScriptBinding.class)) { - IQmlScriptBinding sb = (IQmlScriptBinding) b; - if (ensureNode(sb.getScript(), IJSExpression.class)) { - try { - Object value = QMLExpressionEvaluator.evaluateConstExpr((IJSExpression) sb.getScript()); - if (value instanceof Number) { - return ((Number) value).intValue(); - } - } catch (InvalidExpressionException e) { - handleException(e); - } - } - } - return 0; - } - - public void handleException(Throwable t) { - Activator.log("[QmlTypes] " + t.getMessage()); //$NON-NLS-1$ - } - -} +/******************************************************************************* + * Copyright (c) 2015 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.internal.qt.core.qmltypes; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Map; + +import org.eclipse.cdt.internal.qt.core.Activator; +import org.eclipse.cdt.qt.core.qmljs.IJSArrayExpression; +import org.eclipse.cdt.qt.core.qmljs.IJSExpression; +import org.eclipse.cdt.qt.core.qmljs.IQmlASTNode; +import org.eclipse.cdt.qt.core.qmljs.IQmlBinding; +import org.eclipse.cdt.qt.core.qmljs.IQmlProgram; +import org.eclipse.cdt.qt.core.qmljs.IQmlPropertyBinding; +import org.eclipse.cdt.qt.core.qmljs.IQmlQualifiedID; +import org.eclipse.cdt.qt.core.qmljs.IQmlRootObject; +import org.eclipse.cdt.qt.core.qmljs.IQmlScriptBinding; +import org.eclipse.cdt.qt.core.qmljs.QMLExpressionEvaluator; +import org.eclipse.cdt.qt.core.qmljs.QMLExpressionEvaluator.InvalidExpressionException; + +public class QMLModelBuilder { + + private final Map moduleMap = new HashMap<>(); + + public QMLModelBuilder() { + } + + public QMLModuleInfo addModule(String module, IQmlASTNode ast) { + QMLModuleInfo info = moduleMap.get(module); + if (!moduleMap.containsKey(module)) { + if (ensureNode(ast, IQmlProgram.class)) { + IQmlRootObject obj = ((IQmlProgram) ast).getRootObject(); + if (ensureNode(obj, IQmlRootObject.class)) { + info = new QMLModuleInfo(this, obj); + moduleMap.put(module, info); + } + } + } + return info; + } + + public QMLModuleInfo getModule(String module) { + return moduleMap.get(module); + } + + public boolean hasModule(String module) { + return moduleMap.get(module) != null; + } + + boolean ensureIdentifier(IQmlQualifiedID actual, String expected) { + if (!actual.getName().equals(expected)) { + Activator.log("[QmlTypes] Unexpected node identifier: expected '" + expected + "', but was '" //$NON-NLS-1$ //$NON-NLS-2$ + + actual.getName() + "'"); //$NON-NLS-1$ + return false; + } + return true; + } + + boolean ensureNode(IQmlASTNode actual, Class expected) { + if (!expected.isInstance(actual)) { + Activator.log("[QmlTypes] Expected node '" + expected + "', but was '" + actual.getClass().getInterfaces()[0] + "'"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + return false; + } + return true; + } + + boolean ensureValue(Object actual, Class expected) { + if (!expected.isInstance(actual)) { + Activator.log("[QmlTypes] Unexpected value: expected '" + expected + "', but was '" //$NON-NLS-1$ //$NON-NLS-2$ + + actual.getClass().getInterfaces()[0] + "'"); //$NON-NLS-1$ + return false; + } + return true; + } + + void unexpectedNode(IQmlASTNode node) { + Activator.log("[QmlTypes] Unexpected node '" + node.getClass().getInterfaces()[0] + "'"); //$NON-NLS-1$ //$NON-NLS-2$ + } + + String getStringBinding(IQmlPropertyBinding prop) { + IQmlBinding b = prop.getBinding(); + if (ensureNode(b, IQmlScriptBinding.class)) { + IQmlScriptBinding sb = (IQmlScriptBinding) b; + if (ensureNode(sb.getScript(), IJSExpression.class)) { + try { + Object value = QMLExpressionEvaluator.evaluateConstExpr((IJSExpression) sb.getScript()); + if (value instanceof String) { + return (String) value; + } + } catch (InvalidExpressionException e) { + handleException(e); + } + } + } + return null; + } + + String[] getStringArrayBinding(IQmlPropertyBinding prop) { + ArrayList result = new ArrayList<>(); + IQmlBinding b = prop.getBinding(); + if (ensureNode(b, IQmlScriptBinding.class)) { + IQmlScriptBinding sb = (IQmlScriptBinding) b; + if (ensureNode(sb.getScript(), IJSArrayExpression.class)) { + IJSArrayExpression arrExpr = (IJSArrayExpression) sb.getScript(); + for (IJSExpression expr : arrExpr.getElements()) { + try { + Object value = QMLExpressionEvaluator.evaluateConstExpr(expr); + if (value instanceof String) { + result.add((String) value); + } + } catch (InvalidExpressionException e) { + handleException(e); + } + } + } + } + return result.toArray(new String[result.size()]); + } + + public Integer[] getIntegerArrayBinding(IQmlPropertyBinding prop) { + ArrayList result = new ArrayList<>(); + IQmlBinding b = prop.getBinding(); + if (ensureNode(b, IQmlScriptBinding.class)) { + IQmlScriptBinding sb = (IQmlScriptBinding) b; + if (ensureNode(sb.getScript(), IJSArrayExpression.class)) { + IJSArrayExpression arrExpr = (IJSArrayExpression) sb.getScript(); + for (IJSExpression expr : arrExpr.getElements()) { + try { + Object value = QMLExpressionEvaluator.evaluateConstExpr(expr); + if (value instanceof Number) { + result.add(((Number) value).intValue()); + } + } catch (InvalidExpressionException e) { + handleException(e); + } + } + } + } + return result.toArray(new Integer[result.size()]); + } + + boolean getBooleanBinding(IQmlPropertyBinding prop) { + IQmlBinding b = prop.getBinding(); + if (ensureNode(b, IQmlScriptBinding.class)) { + IQmlScriptBinding sb = (IQmlScriptBinding) b; + if (ensureNode(sb.getScript(), IJSExpression.class)) { + try { + Object value = QMLExpressionEvaluator.evaluateConstExpr((IJSExpression) sb.getScript()); + if (value instanceof Number) { + return (Boolean) value; + } + } catch (InvalidExpressionException e) { + handleException(e); + } + } + } + return false; + } + + public Integer getIntegerBinding(IQmlPropertyBinding prop) { + IQmlBinding b = prop.getBinding(); + if (ensureNode(b, IQmlScriptBinding.class)) { + IQmlScriptBinding sb = (IQmlScriptBinding) b; + if (ensureNode(sb.getScript(), IJSExpression.class)) { + try { + Object value = QMLExpressionEvaluator.evaluateConstExpr((IJSExpression) sb.getScript()); + if (value instanceof Number) { + return ((Number) value).intValue(); + } + } catch (InvalidExpressionException e) { + handleException(e); + } + } + } + return 0; + } + + public void handleException(Throwable t) { + Activator.log("[QmlTypes] " + t.getMessage()); //$NON-NLS-1$ + } + +} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/qmltypes/QMLModuleInfo.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/qmltypes/QMLModuleInfo.java index 83afa3e0e36..df54b9924f1 100644 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/qmltypes/QMLModuleInfo.java +++ b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/qmltypes/QMLModuleInfo.java @@ -1,40 +1,40 @@ -/******************************************************************************* - * Copyright (c) 2015 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.internal.qt.core.qmltypes; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -import org.eclipse.cdt.qt.core.qmljs.IQmlObjectDefinition; -import org.eclipse.cdt.qt.core.qmljs.IQmlObjectMember; -import org.eclipse.cdt.qt.core.qmljs.IQmlRootObject; - -public class QMLModuleInfo { - static final String IDENTIFIER = "Module"; //$NON-NLS-1$ - - private List componentsList = new ArrayList<>(); - - QMLModuleInfo(QMLModelBuilder builder, IQmlRootObject obj) { - if (builder.ensureIdentifier(obj.getIdentifier(), IDENTIFIER)) { - for (IQmlObjectMember member : obj.getBody().getMembers()) { - if (builder.ensureNode(member, IQmlObjectDefinition.class)) { - componentsList.add(new QMLComponentInfo(builder, (IQmlObjectDefinition) member)); - } - } - } - componentsList = Collections.unmodifiableList(componentsList); - } - - public List getComponents() { - return componentsList; - } -} +/******************************************************************************* + * Copyright (c) 2015 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.internal.qt.core.qmltypes; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +import org.eclipse.cdt.qt.core.qmljs.IQmlObjectDefinition; +import org.eclipse.cdt.qt.core.qmljs.IQmlObjectMember; +import org.eclipse.cdt.qt.core.qmljs.IQmlRootObject; + +public class QMLModuleInfo { + static final String IDENTIFIER = "Module"; //$NON-NLS-1$ + + private List componentsList = new ArrayList<>(); + + QMLModuleInfo(QMLModelBuilder builder, IQmlRootObject obj) { + if (builder.ensureIdentifier(obj.getIdentifier(), IDENTIFIER)) { + for (IQmlObjectMember member : obj.getBody().getMembers()) { + if (builder.ensureNode(member, IQmlObjectDefinition.class)) { + componentsList.add(new QMLComponentInfo(builder, (IQmlObjectDefinition) member)); + } + } + } + componentsList = Collections.unmodifiableList(componentsList); + } + + public List getComponents() { + return componentsList; + } +} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/qmltypes/QMLParameterInfo.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/qmltypes/QMLParameterInfo.java index b1d6ad7b04a..70918fb1e08 100644 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/qmltypes/QMLParameterInfo.java +++ b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/qmltypes/QMLParameterInfo.java @@ -1,52 +1,52 @@ -/******************************************************************************* - * Copyright (c) 2015 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.internal.qt.core.qmltypes; - -import org.eclipse.cdt.qt.core.qmljs.IQmlObjectDefinition; -import org.eclipse.cdt.qt.core.qmljs.IQmlObjectMember; -import org.eclipse.cdt.qt.core.qmljs.IQmlPropertyBinding; - -public class QMLParameterInfo { - static final String IDENTIFIER = "Parameter"; //$NON-NLS-1$ - - static final String PROPERTY_NAME = "name"; //$NON-NLS-1$ - static final String PROPERTY_TYPE = "type"; //$NON-NLS-1$ - - private String name; - private String type; - - QMLParameterInfo(QMLModelBuilder builder, IQmlObjectDefinition obj) { - if (builder.ensureIdentifier(obj.getIdentifier(), IDENTIFIER)) { - for (IQmlObjectMember member : obj.getBody().getMembers()) { - if (builder.ensureNode(member, IQmlPropertyBinding.class)) { - IQmlPropertyBinding prop = (IQmlPropertyBinding) member; - switch (prop.getIdentifier().getName()) { - case PROPERTY_NAME: - this.name = builder.getStringBinding(prop); - break; - case PROPERTY_TYPE: - this.type = builder.getStringBinding(prop); - break; - default: - } - } - } - } - } - - public String getName() { - return name; - } - - public String getType() { - return type; - } -} +/******************************************************************************* + * Copyright (c) 2015 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.internal.qt.core.qmltypes; + +import org.eclipse.cdt.qt.core.qmljs.IQmlObjectDefinition; +import org.eclipse.cdt.qt.core.qmljs.IQmlObjectMember; +import org.eclipse.cdt.qt.core.qmljs.IQmlPropertyBinding; + +public class QMLParameterInfo { + static final String IDENTIFIER = "Parameter"; //$NON-NLS-1$ + + static final String PROPERTY_NAME = "name"; //$NON-NLS-1$ + static final String PROPERTY_TYPE = "type"; //$NON-NLS-1$ + + private String name; + private String type; + + QMLParameterInfo(QMLModelBuilder builder, IQmlObjectDefinition obj) { + if (builder.ensureIdentifier(obj.getIdentifier(), IDENTIFIER)) { + for (IQmlObjectMember member : obj.getBody().getMembers()) { + if (builder.ensureNode(member, IQmlPropertyBinding.class)) { + IQmlPropertyBinding prop = (IQmlPropertyBinding) member; + switch (prop.getIdentifier().getName()) { + case PROPERTY_NAME: + this.name = builder.getStringBinding(prop); + break; + case PROPERTY_TYPE: + this.type = builder.getStringBinding(prop); + break; + default: + } + } + } + } + } + + public String getName() { + return name; + } + + public String getType() { + return type; + } +} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/qmltypes/QMLPropertyInfo.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/qmltypes/QMLPropertyInfo.java index 704c3a55d44..c3f7d29b00f 100644 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/qmltypes/QMLPropertyInfo.java +++ b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/qmltypes/QMLPropertyInfo.java @@ -1,88 +1,88 @@ -/******************************************************************************* - * Copyright (c) 2015 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.internal.qt.core.qmltypes; - -import org.eclipse.cdt.qt.core.qmljs.IQmlObjectDefinition; -import org.eclipse.cdt.qt.core.qmljs.IQmlObjectMember; -import org.eclipse.cdt.qt.core.qmljs.IQmlPropertyBinding; - -public class QMLPropertyInfo { - static final String IDENTIFIER = "Property"; //$NON-NLS-1$ - - static final String PROPERTY_NAME = "name"; //$NON-NLS-1$ - static final String PROPERTY_TYPE = "type"; //$NON-NLS-1$ - static final String PROPERTY_READONLY = "isReadonly"; //$NON-NLS-1$ - static final String PROPERTY_POINTER = "isPointer"; //$NON-NLS-1$ - static final String PROPERTY_LIST = "isList"; //$NON-NLS-1$ - static final String PROPERTY_REVISION = "revision"; //$NON-NLS-1$ - - private String name; - private String type; - private boolean readonly = false; - private boolean pointer = false; - private boolean list = false; - private int revision; - - QMLPropertyInfo(QMLModelBuilder builder, IQmlObjectDefinition obj) { - if (builder.ensureIdentifier(obj.getIdentifier(), IDENTIFIER)) { - for (IQmlObjectMember member : obj.getBody().getMembers()) { - if (builder.ensureNode(member, IQmlPropertyBinding.class)) { - IQmlPropertyBinding prop = (IQmlPropertyBinding) member; - switch (prop.getIdentifier().getName()) { - case PROPERTY_NAME: - this.name = builder.getStringBinding(prop); - break; - case PROPERTY_TYPE: - this.type = builder.getStringBinding(prop); - break; - case PROPERTY_READONLY: - this.readonly = builder.getBooleanBinding(prop); - break; - case PROPERTY_POINTER: - this.pointer = builder.getBooleanBinding(prop); - break; - case PROPERTY_LIST: - this.list = builder.getBooleanBinding(prop); - break; - case PROPERTY_REVISION: - this.revision = builder.getIntegerBinding(prop); - break; - default: - } - } - } - } - } - - public String getName() { - return name; - } - - public String getType() { - return type; - } - - public int getRevision() { - return revision; - } - - public boolean isReadonly() { - return readonly; - } - - public boolean isPointer() { - return pointer; - } - - public boolean isList() { - return list; - } -} +/******************************************************************************* + * Copyright (c) 2015 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.internal.qt.core.qmltypes; + +import org.eclipse.cdt.qt.core.qmljs.IQmlObjectDefinition; +import org.eclipse.cdt.qt.core.qmljs.IQmlObjectMember; +import org.eclipse.cdt.qt.core.qmljs.IQmlPropertyBinding; + +public class QMLPropertyInfo { + static final String IDENTIFIER = "Property"; //$NON-NLS-1$ + + static final String PROPERTY_NAME = "name"; //$NON-NLS-1$ + static final String PROPERTY_TYPE = "type"; //$NON-NLS-1$ + static final String PROPERTY_READONLY = "isReadonly"; //$NON-NLS-1$ + static final String PROPERTY_POINTER = "isPointer"; //$NON-NLS-1$ + static final String PROPERTY_LIST = "isList"; //$NON-NLS-1$ + static final String PROPERTY_REVISION = "revision"; //$NON-NLS-1$ + + private String name; + private String type; + private boolean readonly = false; + private boolean pointer = false; + private boolean list = false; + private int revision; + + QMLPropertyInfo(QMLModelBuilder builder, IQmlObjectDefinition obj) { + if (builder.ensureIdentifier(obj.getIdentifier(), IDENTIFIER)) { + for (IQmlObjectMember member : obj.getBody().getMembers()) { + if (builder.ensureNode(member, IQmlPropertyBinding.class)) { + IQmlPropertyBinding prop = (IQmlPropertyBinding) member; + switch (prop.getIdentifier().getName()) { + case PROPERTY_NAME: + this.name = builder.getStringBinding(prop); + break; + case PROPERTY_TYPE: + this.type = builder.getStringBinding(prop); + break; + case PROPERTY_READONLY: + this.readonly = builder.getBooleanBinding(prop); + break; + case PROPERTY_POINTER: + this.pointer = builder.getBooleanBinding(prop); + break; + case PROPERTY_LIST: + this.list = builder.getBooleanBinding(prop); + break; + case PROPERTY_REVISION: + this.revision = builder.getIntegerBinding(prop); + break; + default: + } + } + } + } + } + + public String getName() { + return name; + } + + public String getType() { + return type; + } + + public int getRevision() { + return revision; + } + + public boolean isReadonly() { + return readonly; + } + + public boolean isPointer() { + return pointer; + } + + public boolean isList() { + return list; + } +} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/qmltypes/QMLSignalInfo.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/qmltypes/QMLSignalInfo.java index 70193b90d28..b56280fe5ea 100644 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/qmltypes/QMLSignalInfo.java +++ b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/internal/qt/core/qmltypes/QMLSignalInfo.java @@ -1,69 +1,69 @@ -/******************************************************************************* - * Copyright (c) 2015 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.internal.qt.core.qmltypes; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.cdt.qt.core.qmljs.IQmlObjectDefinition; -import org.eclipse.cdt.qt.core.qmljs.IQmlObjectMember; -import org.eclipse.cdt.qt.core.qmljs.IQmlPropertyBinding; - -public class QMLSignalInfo { - static final String IDENTIFIER = "Signal"; //$NON-NLS-1$ - - static final String PROPERTY_NAME = "name"; //$NON-NLS-1$ s - static final String PROPERTY_TYPE = "type"; //$NON-NLS-1$ - static final String PROPERTY_REVISION = "revision"; //$NON-NLS-1$ - - private String name; - private String type; - private Integer revision; - private List parameterList = new ArrayList<>(); - - QMLSignalInfo(QMLModelBuilder builder, IQmlObjectDefinition obj) { - if (builder.ensureIdentifier(obj.getIdentifier(), IDENTIFIER)) { - for (IQmlObjectMember member : obj.getBody().getMembers()) { - if (member instanceof IQmlPropertyBinding) { - IQmlPropertyBinding prop = (IQmlPropertyBinding) member; - switch (prop.getIdentifier().getName()) { - case PROPERTY_NAME: - this.name = builder.getStringBinding(prop); - break; - case PROPERTY_TYPE: - this.type = builder.getStringBinding(prop); - break; - case PROPERTY_REVISION: - this.revision = builder.getIntegerBinding(prop); - break; - default: - } - } else if (member instanceof IQmlObjectDefinition) { - this.parameterList.add(new QMLParameterInfo(builder, (IQmlObjectDefinition) member)); - } else { - builder.unexpectedNode(member); - } - } - } - } - - public String getName() { - return name; - } - - public String getType() { - return type; - } - - public int getRevision() { - return revision; - } -} +/******************************************************************************* + * Copyright (c) 2015 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.internal.qt.core.qmltypes; + +import java.util.ArrayList; +import java.util.List; + +import org.eclipse.cdt.qt.core.qmljs.IQmlObjectDefinition; +import org.eclipse.cdt.qt.core.qmljs.IQmlObjectMember; +import org.eclipse.cdt.qt.core.qmljs.IQmlPropertyBinding; + +public class QMLSignalInfo { + static final String IDENTIFIER = "Signal"; //$NON-NLS-1$ + + static final String PROPERTY_NAME = "name"; //$NON-NLS-1$ s + static final String PROPERTY_TYPE = "type"; //$NON-NLS-1$ + static final String PROPERTY_REVISION = "revision"; //$NON-NLS-1$ + + private String name; + private String type; + private Integer revision; + private List parameterList = new ArrayList<>(); + + QMLSignalInfo(QMLModelBuilder builder, IQmlObjectDefinition obj) { + if (builder.ensureIdentifier(obj.getIdentifier(), IDENTIFIER)) { + for (IQmlObjectMember member : obj.getBody().getMembers()) { + if (member instanceof IQmlPropertyBinding) { + IQmlPropertyBinding prop = (IQmlPropertyBinding) member; + switch (prop.getIdentifier().getName()) { + case PROPERTY_NAME: + this.name = builder.getStringBinding(prop); + break; + case PROPERTY_TYPE: + this.type = builder.getStringBinding(prop); + break; + case PROPERTY_REVISION: + this.revision = builder.getIntegerBinding(prop); + break; + default: + } + } else if (member instanceof IQmlObjectDefinition) { + this.parameterList.add(new QMLParameterInfo(builder, (IQmlObjectDefinition) member)); + } else { + builder.unexpectedNode(member); + } + } + } + } + + public String getName() { + return name; + } + + public String getType() { + return type; + } + + public int getRevision() { + return revision; + } +} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/IQMLAnalyzer.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/IQMLAnalyzer.java index 6c8343f110f..877243c5933 100644 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/IQMLAnalyzer.java +++ b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/IQMLAnalyzer.java @@ -1,46 +1,46 @@ -/******************************************************************************* - * Copyright (c) 2015 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.qt.core; - -import java.io.IOException; -import java.util.Collection; -import java.util.List; - -import javax.script.Bindings; -import javax.script.ScriptException; - -import org.eclipse.cdt.qt.core.qmljs.IQmlASTNode; - -public interface IQMLAnalyzer { - - void addFile(String fileName, String code) throws NoSuchMethodException, ScriptException; - - void deleteFile(String fileName) throws NoSuchMethodException, ScriptException; - - IQmlASTNode parseFile(String fileName, String text) throws NoSuchMethodException, ScriptException; - - IQmlASTNode parseString(String text) throws NoSuchMethodException, ScriptException; - - IQmlASTNode parseString(String text, String mode, boolean locations, boolean ranges) - throws NoSuchMethodException, ScriptException; - - Collection getCompletions(String fileName, String text, int pos) - throws NoSuchMethodException, ScriptException; - - Collection getCompletions(String fileName, String text, int pos, boolean includeKeywords) - throws NoSuchMethodException, ScriptException; - - List getDefinition(String identifier, String fileName, String text, int pos) - throws NoSuchMethodException, ScriptException; - - void load() throws ScriptException, IOException, NoSuchMethodException; - +/******************************************************************************* + * Copyright (c) 2015 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.qt.core; + +import java.io.IOException; +import java.util.Collection; +import java.util.List; + +import javax.script.Bindings; +import javax.script.ScriptException; + +import org.eclipse.cdt.qt.core.qmljs.IQmlASTNode; + +public interface IQMLAnalyzer { + + void addFile(String fileName, String code) throws NoSuchMethodException, ScriptException; + + void deleteFile(String fileName) throws NoSuchMethodException, ScriptException; + + IQmlASTNode parseFile(String fileName, String text) throws NoSuchMethodException, ScriptException; + + IQmlASTNode parseString(String text) throws NoSuchMethodException, ScriptException; + + IQmlASTNode parseString(String text, String mode, boolean locations, boolean ranges) + throws NoSuchMethodException, ScriptException; + + Collection getCompletions(String fileName, String text, int pos) + throws NoSuchMethodException, ScriptException; + + Collection getCompletions(String fileName, String text, int pos, boolean includeKeywords) + throws NoSuchMethodException, ScriptException; + + List getDefinition(String identifier, String fileName, String text, int pos) + throws NoSuchMethodException, ScriptException; + + void load() throws ScriptException, IOException, NoSuchMethodException; + } \ No newline at end of file diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/IQtBuildConfiguration.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/IQtBuildConfiguration.java index 024a91a9688..7e72da89438 100644 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/IQtBuildConfiguration.java +++ b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/IQtBuildConfiguration.java @@ -1,38 +1,38 @@ -/******************************************************************************* - * 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.qt.core; - -import java.nio.file.Path; - -import org.eclipse.cdt.core.build.ICBuildConfiguration; -import org.eclipse.core.runtime.CoreException; - -/** - * Qt specific build configuration settings. - * - * @noimplement - */ -public interface IQtBuildConfiguration extends ICBuildConfiguration { - - Path getBuildDirectory() throws CoreException; - - Path getQmakeCommand(); - - String[] getQmakeConfig(); - - /** - * @deprecated use getBuildOutput() instead - */ - @Deprecated - Path getProgramPath() throws CoreException; - - String getLaunchMode(); - - IQtInstall getQtInstall(); - -} +/******************************************************************************* + * 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.qt.core; + +import java.nio.file.Path; + +import org.eclipse.cdt.core.build.ICBuildConfiguration; +import org.eclipse.core.runtime.CoreException; + +/** + * Qt specific build configuration settings. + * + * @noimplement + */ +public interface IQtBuildConfiguration extends ICBuildConfiguration { + + Path getBuildDirectory() throws CoreException; + + Path getQmakeCommand(); + + String[] getQmakeConfig(); + + /** + * @deprecated use getBuildOutput() instead + */ + @Deprecated + Path getProgramPath() throws CoreException; + + String getLaunchMode(); + + IQtInstall getQtInstall(); + +} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/location/IPosition.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/location/IPosition.java index e4f98f7df53..48d635a5b08 100644 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/location/IPosition.java +++ b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/location/IPosition.java @@ -1,30 +1,30 @@ -/******************************************************************************* - * Copyright (c) 2015 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.qt.core.location; - -/** - * Stores a line/offset pair as integers. - */ -public interface IPosition { - /** - * Gets the one-indexed line number indicated by this IPosition - * - * @return the line number - */ - public int getLine(); - - /** - * Gets the zero-indexed column indicated by this IPosition - * - * @return the column - */ - public int getColumn(); -} +/******************************************************************************* + * Copyright (c) 2015 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.qt.core.location; + +/** + * Stores a line/offset pair as integers. + */ +public interface IPosition { + /** + * Gets the one-indexed line number indicated by this IPosition + * + * @return the line number + */ + public int getLine(); + + /** + * Gets the zero-indexed column indicated by this IPosition + * + * @return the column + */ + public int getColumn(); +} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/location/ISourceLocation.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/location/ISourceLocation.java index 98383ff1c19..07f441e1623 100644 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/location/ISourceLocation.java +++ b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/location/ISourceLocation.java @@ -1,38 +1,38 @@ -/******************************************************************************* - * Copyright (c) 2015 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.qt.core.location; - -/** - * Represents a location in a source file. Uses the {@link IPosition} interface to store the start and end locations as a - * line/offset pair. - */ -public interface ISourceLocation { - /** - * Gets the String representing the source of this ISourceLocation - * - * @return the source or null if not available - */ - public String getSource(); - - /** - * Gets the zero-indexed offset indicating the start of this ISourceLocation - * - * @return the start offset - */ - public IPosition getStart(); - - /** - * Gets the zero-indexed offset indicating the end of this ISourceLocation - * - * @return the end offset - */ - public IPosition getEnd(); -} +/******************************************************************************* + * Copyright (c) 2015 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.qt.core.location; + +/** + * Represents a location in a source file. Uses the {@link IPosition} interface to store the start and end locations as a + * line/offset pair. + */ +public interface ISourceLocation { + /** + * Gets the String representing the source of this ISourceLocation + * + * @return the source or null if not available + */ + public String getSource(); + + /** + * Gets the zero-indexed offset indicating the start of this ISourceLocation + * + * @return the start offset + */ + public IPosition getStart(); + + /** + * Gets the zero-indexed offset indicating the end of this ISourceLocation + * + * @return the end offset + */ + public IPosition getEnd(); +} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmldir/IQDirAST.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmldir/IQDirAST.java index 314614a2333..cb9bcaf3eed 100644 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmldir/IQDirAST.java +++ b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmldir/IQDirAST.java @@ -1,26 +1,26 @@ -/******************************************************************************* - * Copyright (c) 2015 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.qt.core.qmldir; - -import java.util.List; - -/** - * The main entry point into the qmldir AST. This interface contains a list of Commands specified within the qmldir file that it - * represents. - */ -public interface IQDirAST extends IQDirASTNode { - /** - * Gets the list of commands in the qmldir file that this IQDirAST represents. - * - * @return the list of all commands in the qmldir file - */ - public List getCommands(); -} +/******************************************************************************* + * Copyright (c) 2015 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.qt.core.qmldir; + +import java.util.List; + +/** + * The main entry point into the qmldir AST. This interface contains a list of Commands specified within the qmldir file that it + * represents. + */ +public interface IQDirAST extends IQDirASTNode { + /** + * Gets the list of commands in the qmldir file that this IQDirAST represents. + * + * @return the list of all commands in the qmldir file + */ + public List getCommands(); +} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmldir/IQDirASTNode.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmldir/IQDirASTNode.java index 2dd877e6b1f..37b364b7d4f 100644 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmldir/IQDirASTNode.java +++ b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmldir/IQDirASTNode.java @@ -1,41 +1,41 @@ -/******************************************************************************* - * Copyright (c) 2015 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.qt.core.qmldir; - -import org.eclipse.cdt.qt.core.location.ISourceLocation; - -/** - * The base type for all qmldir AST nodes. Contains methods for retrieving a node's positional information. - */ -public interface IQDirASTNode { - /** - * Gets a more detailed description of this node's location than {@link IQDirASTNode#getStart()} and - * {@link IQDirASTNode#getStart()}. This method allows the retrieval of line and column information in order to make output for - * syntax errors and the like more human-readable. - * - * @return the {@link ISourceLocation} representing this node's location in the source - */ - public ISourceLocation getLocation(); - - /** - * Gets the zero-indexed offset indicating the start of this node in the source. - * - * @return the node's start offset - */ - public int getStart(); - - /** - * Gets the zero-indexed offset indicating the end of this node in the source. - * - * @return the node's end offset - */ - public int getEnd(); -} +/******************************************************************************* + * Copyright (c) 2015 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.qt.core.qmldir; + +import org.eclipse.cdt.qt.core.location.ISourceLocation; + +/** + * The base type for all qmldir AST nodes. Contains methods for retrieving a node's positional information. + */ +public interface IQDirASTNode { + /** + * Gets a more detailed description of this node's location than {@link IQDirASTNode#getStart()} and + * {@link IQDirASTNode#getStart()}. This method allows the retrieval of line and column information in order to make output for + * syntax errors and the like more human-readable. + * + * @return the {@link ISourceLocation} representing this node's location in the source + */ + public ISourceLocation getLocation(); + + /** + * Gets the zero-indexed offset indicating the start of this node in the source. + * + * @return the node's start offset + */ + public int getStart(); + + /** + * Gets the zero-indexed offset indicating the end of this node in the source. + * + * @return the node's end offset + */ + public int getEnd(); +} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmldir/IQDirClassnameCommand.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmldir/IQDirClassnameCommand.java index 13ce512dea8..5018b691412 100644 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmldir/IQDirClassnameCommand.java +++ b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmldir/IQDirClassnameCommand.java @@ -1,25 +1,25 @@ -/******************************************************************************* - * Copyright (c) 2015 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.qt.core.qmldir; - -/** - * An AST Node representing a Classname Command in a qmldir file. - * - * @see Module Definition qmldir Files - */ -public interface IQDirClassnameCommand extends IQDirCommand { - /** - * Gets the IQDirWord representing the identifier for the classname. - * - * @return the identifier for the classname - */ - public IQDirWord getIdentifier(); -} +/******************************************************************************* + * Copyright (c) 2015 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.qt.core.qmldir; + +/** + * An AST Node representing a Classname Command in a qmldir file. + * + * @see Module Definition qmldir Files + */ +public interface IQDirClassnameCommand extends IQDirCommand { + /** + * Gets the IQDirWord representing the identifier for the classname. + * + * @return the identifier for the classname + */ + public IQDirWord getIdentifier(); +} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmldir/IQDirCommand.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmldir/IQDirCommand.java index 7a785aed919..75b6c154a92 100644 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmldir/IQDirCommand.java +++ b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmldir/IQDirCommand.java @@ -1,19 +1,19 @@ -/******************************************************************************* - * Copyright (c) 2015 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.qt.core.qmldir; - -/** - * The base interface for all qmldir AST nodes that function as commands. - * - * @see Module Definition qmldir Files - */ -public interface IQDirCommand extends IQDirASTNode { -} +/******************************************************************************* + * Copyright (c) 2015 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.qt.core.qmldir; + +/** + * The base interface for all qmldir AST nodes that function as commands. + * + * @see Module Definition qmldir Files + */ +public interface IQDirCommand extends IQDirASTNode { +} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmldir/IQDirCommentCommand.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmldir/IQDirCommentCommand.java index cec1c25531f..87f269faf28 100644 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmldir/IQDirCommentCommand.java +++ b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmldir/IQDirCommentCommand.java @@ -1,25 +1,25 @@ -/******************************************************************************* - * Copyright (c) 2015 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.qt.core.qmldir; - -/** - * An AST Node representing a Comment Command in a qmldir file. - * - * @see Module Definition qmldir Files - */ -public interface IQDirCommentCommand extends IQDirCommand { - /** - * Gets the String representation of this comment as it appears in the qmldir file. - * - * @return the String representation of this comment - */ - public String getText(); -} +/******************************************************************************* + * Copyright (c) 2015 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.qt.core.qmldir; + +/** + * An AST Node representing a Comment Command in a qmldir file. + * + * @see Module Definition qmldir Files + */ +public interface IQDirCommentCommand extends IQDirCommand { + /** + * Gets the String representation of this comment as it appears in the qmldir file. + * + * @return the String representation of this comment + */ + public String getText(); +} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmldir/IQDirDependsCommand.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmldir/IQDirDependsCommand.java index 0e6fbcc6bcd..93cb7728bc7 100644 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmldir/IQDirDependsCommand.java +++ b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmldir/IQDirDependsCommand.java @@ -1,32 +1,32 @@ -/******************************************************************************* - * Copyright (c) 2015 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.qt.core.qmldir; - -/** - * An AST Node representing a Depends Command in a qmldir file. - * - * @see Module Definition qmldir Files - */ -public interface IQDirDependsCommand extends IQDirCommand { - /** - * Gets the IQDirWord representing the module identifier that this qmldir module depends on. - * - * @return the module identifier - */ - public IQDirWord getModuleIdentifier(); - - /** - * Gets the IQDirVersion representing the initial version of the module that this qmldir module depends on. - * - * @return the initial version - */ - public IQDirVersion getInitialVersion(); -} +/******************************************************************************* + * Copyright (c) 2015 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.qt.core.qmldir; + +/** + * An AST Node representing a Depends Command in a qmldir file. + * + * @see Module Definition qmldir Files + */ +public interface IQDirDependsCommand extends IQDirCommand { + /** + * Gets the IQDirWord representing the module identifier that this qmldir module depends on. + * + * @return the module identifier + */ + public IQDirWord getModuleIdentifier(); + + /** + * Gets the IQDirVersion representing the initial version of the module that this qmldir module depends on. + * + * @return the initial version + */ + public IQDirVersion getInitialVersion(); +} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmldir/IQDirDesignerSupportedCommand.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmldir/IQDirDesignerSupportedCommand.java index 1619501ac44..09e905aebfd 100644 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmldir/IQDirDesignerSupportedCommand.java +++ b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmldir/IQDirDesignerSupportedCommand.java @@ -1,19 +1,19 @@ -/******************************************************************************* - * Copyright (c) 2015 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.qt.core.qmldir; - -/** - * An AST Node representing a Designer Supported Command in a qmldir file. - * - * @see Module Definition qmldir Files - */ -public interface IQDirDesignerSupportedCommand extends IQDirCommand { -} +/******************************************************************************* + * Copyright (c) 2015 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.qt.core.qmldir; + +/** + * An AST Node representing a Designer Supported Command in a qmldir file. + * + * @see Module Definition qmldir Files + */ +public interface IQDirDesignerSupportedCommand extends IQDirCommand { +} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmldir/IQDirInternalCommand.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmldir/IQDirInternalCommand.java index 0af6388e6b7..5608afcd8d1 100644 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmldir/IQDirInternalCommand.java +++ b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmldir/IQDirInternalCommand.java @@ -1,32 +1,32 @@ -/******************************************************************************* - * Copyright (c) 2015 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.qt.core.qmldir; - -/** - * An AST Node representing an Internal Command in a qmldir file. - * - * @see Module Definition qmldir Files - */ -public interface IQDirInternalCommand extends IQDirCommand { - /** - * Gets the IQDirWord representing the type name of the internal type. - * - * @return the type names - */ - public IQDirWord getTypeName(); - - /** - * Gets the IQDirWord representing the filename of the internal type. - * - * @return the filename - */ - public IQDirWord getFile(); -} +/******************************************************************************* + * Copyright (c) 2015 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.qt.core.qmldir; + +/** + * An AST Node representing an Internal Command in a qmldir file. + * + * @see Module Definition qmldir Files + */ +public interface IQDirInternalCommand extends IQDirCommand { + /** + * Gets the IQDirWord representing the type name of the internal type. + * + * @return the type names + */ + public IQDirWord getTypeName(); + + /** + * Gets the IQDirWord representing the filename of the internal type. + * + * @return the filename + */ + public IQDirWord getFile(); +} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmldir/IQDirModuleCommand.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmldir/IQDirModuleCommand.java index 6ad218e970a..90dfaddd80f 100644 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmldir/IQDirModuleCommand.java +++ b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmldir/IQDirModuleCommand.java @@ -1,25 +1,25 @@ -/******************************************************************************* - * Copyright (c) 2015 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.qt.core.qmldir; - -/** - * An AST Node representing a Module Command in a qmldir file. - * - * @see Module Definition qmldir Files - */ -public interface IQDirModuleCommand extends IQDirCommand { - /** - * Gets the IQDirWord representing the identifier for the module. - * - * @return the identifier for the module - */ - public IQDirWord getModuleIdentifier(); -} +/******************************************************************************* + * Copyright (c) 2015 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.qt.core.qmldir; + +/** + * An AST Node representing a Module Command in a qmldir file. + * + * @see Module Definition qmldir Files + */ +public interface IQDirModuleCommand extends IQDirCommand { + /** + * Gets the IQDirWord representing the identifier for the module. + * + * @return the identifier for the module + */ + public IQDirWord getModuleIdentifier(); +} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmldir/IQDirPluginCommand.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmldir/IQDirPluginCommand.java index bd1c4279cb6..87b044bf7bf 100644 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmldir/IQDirPluginCommand.java +++ b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmldir/IQDirPluginCommand.java @@ -1,32 +1,32 @@ -/******************************************************************************* - * Copyright (c) 2015 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.qt.core.qmldir; - -/** - * An AST Node representing a Plugin Command in a qmldir file. - * - * @see Module Definition qmldir Files - */ -public interface IQDirPluginCommand extends IQDirCommand { - /** - * Gets the IQDirWord representing the name of the plugin. - * - * @return the plugin name - */ - public IQDirWord getName(); - - /** - * Gets the IQDirWord representing the path to the plugin if it was given. - * - * @return the path to the plugin or null if not available - */ - public IQDirWord getPath(); -} +/******************************************************************************* + * Copyright (c) 2015 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.qt.core.qmldir; + +/** + * An AST Node representing a Plugin Command in a qmldir file. + * + * @see Module Definition qmldir Files + */ +public interface IQDirPluginCommand extends IQDirCommand { + /** + * Gets the IQDirWord representing the name of the plugin. + * + * @return the plugin name + */ + public IQDirWord getName(); + + /** + * Gets the IQDirWord representing the path to the plugin if it was given. + * + * @return the path to the plugin or null if not available + */ + public IQDirWord getPath(); +} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmldir/IQDirResourceCommand.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmldir/IQDirResourceCommand.java index d92838d2da4..5288fd732e3 100644 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmldir/IQDirResourceCommand.java +++ b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmldir/IQDirResourceCommand.java @@ -1,39 +1,39 @@ -/******************************************************************************* - * Copyright (c) 2015 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.qt.core.qmldir; - -/** - * An AST Node representing a Resource Command in a qmldir file. - * - * @see Module Definition qmldir Files - */ -public interface IQDirResourceCommand extends IQDirCommand { - /** - * Gets the IQDirWord representing the identifier of the resource. - * - * @return the identifier of the resource - */ - public IQDirWord getResourceIdentifier(); - - /** - * Gets the IQDirVersion representing the initial version of the resource. - * - * @return the initial version - */ - public IQDirVersion getInitialVersion(); - - /** - * Gets the IQDirWord representing the filename of the resource. - * - * @return the filename - */ - public IQDirWord getFile(); -} +/******************************************************************************* + * Copyright (c) 2015 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.qt.core.qmldir; + +/** + * An AST Node representing a Resource Command in a qmldir file. + * + * @see Module Definition qmldir Files + */ +public interface IQDirResourceCommand extends IQDirCommand { + /** + * Gets the IQDirWord representing the identifier of the resource. + * + * @return the identifier of the resource + */ + public IQDirWord getResourceIdentifier(); + + /** + * Gets the IQDirVersion representing the initial version of the resource. + * + * @return the initial version + */ + public IQDirVersion getInitialVersion(); + + /** + * Gets the IQDirWord representing the filename of the resource. + * + * @return the filename + */ + public IQDirWord getFile(); +} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmldir/IQDirSingletonCommand.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmldir/IQDirSingletonCommand.java index 7d5547cf4ae..f9e4c246e9f 100644 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmldir/IQDirSingletonCommand.java +++ b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmldir/IQDirSingletonCommand.java @@ -1,39 +1,39 @@ -/******************************************************************************* - * Copyright (c) 2015 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.qt.core.qmldir; - -/** - * An AST Node representing a Singleton Command in a qmldir file. - * - * @see Module Definition qmldir Files - */ -public interface IQDirSingletonCommand extends IQDirCommand { - /** - * Gets the IQDirWord representing the type name of the singleton type. - * - * @return the type name - */ - public IQDirWord getTypeName(); - - /** - * Gets the IQDirVersion representing the initial version of the singleton type. - * - * @return the initial version - */ - public IQDirVersion getInitialVersion(); - - /** - * Gets the IQDirWord representing the filename of the singleton type. - * - * @return the filename - */ - public IQDirWord getFile(); -} +/******************************************************************************* + * Copyright (c) 2015 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.qt.core.qmldir; + +/** + * An AST Node representing a Singleton Command in a qmldir file. + * + * @see Module Definition qmldir Files + */ +public interface IQDirSingletonCommand extends IQDirCommand { + /** + * Gets the IQDirWord representing the type name of the singleton type. + * + * @return the type name + */ + public IQDirWord getTypeName(); + + /** + * Gets the IQDirVersion representing the initial version of the singleton type. + * + * @return the initial version + */ + public IQDirVersion getInitialVersion(); + + /** + * Gets the IQDirWord representing the filename of the singleton type. + * + * @return the filename + */ + public IQDirWord getFile(); +} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmldir/IQDirSyntaxError.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmldir/IQDirSyntaxError.java index 142a125f95c..5417bc8ee6e 100644 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmldir/IQDirSyntaxError.java +++ b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmldir/IQDirSyntaxError.java @@ -1,43 +1,43 @@ -/******************************************************************************* - * Copyright (c) 2015 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.qt.core.qmldir; - -import org.eclipse.cdt.qt.core.qmldir.QMLDirectoryLexer.Token; -import org.eclipse.cdt.qt.core.qmldir.QMLDirectoryParser.SyntaxError; - -/** - * An AST Node representing a syntax error in a qmldir file. Due to the fact that the qmldir file is so simple, a syntax error will - * only occur at the command level while the parser jumps to the next line to recover. - */ -public interface IQDirSyntaxError extends IQDirCommand { - /** - * Gets the token that caused the parser to fail. This is a helper method equivalent to - * getSyntaxError.getOffendingToken(). - * - * @return the offending token. - */ - public Token getOffendingToken(); - - /** - * Gets the node that the parser was working on before it failed (if available). This is a helper method equivalent to - * getSyntaxError.getIncompleteNode(). - * - * @return the incomplete node or null if not available - */ - public IQDirASTNode getIncompleteNode(); - - /** - * Gets the syntax error that occurred. - * - * @return the syntax error - */ - public SyntaxError getSyntaxError(); -} +/******************************************************************************* + * Copyright (c) 2015 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.qt.core.qmldir; + +import org.eclipse.cdt.qt.core.qmldir.QMLDirectoryLexer.Token; +import org.eclipse.cdt.qt.core.qmldir.QMLDirectoryParser.SyntaxError; + +/** + * An AST Node representing a syntax error in a qmldir file. Due to the fact that the qmldir file is so simple, a syntax error will + * only occur at the command level while the parser jumps to the next line to recover. + */ +public interface IQDirSyntaxError extends IQDirCommand { + /** + * Gets the token that caused the parser to fail. This is a helper method equivalent to + * getSyntaxError.getOffendingToken(). + * + * @return the offending token. + */ + public Token getOffendingToken(); + + /** + * Gets the node that the parser was working on before it failed (if available). This is a helper method equivalent to + * getSyntaxError.getIncompleteNode(). + * + * @return the incomplete node or null if not available + */ + public IQDirASTNode getIncompleteNode(); + + /** + * Gets the syntax error that occurred. + * + * @return the syntax error + */ + public SyntaxError getSyntaxError(); +} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmldir/IQDirTypeInfoCommand.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmldir/IQDirTypeInfoCommand.java index 943690d8a98..6ddd9dae8f3 100644 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmldir/IQDirTypeInfoCommand.java +++ b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmldir/IQDirTypeInfoCommand.java @@ -1,25 +1,25 @@ -/******************************************************************************* - * Copyright (c) 2015 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.qt.core.qmldir; - -/** - * An AST Node representing a Type Info Command in a qmldir file. - * - * @see Module Definition qmldir Files - */ -public interface IQDirTypeInfoCommand extends IQDirCommand { - /** - * Gets the IQDirWord representing the filename of the type info file. - * - * @return the filename of the type info file - */ - public IQDirWord getFile(); -} +/******************************************************************************* + * Copyright (c) 2015 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.qt.core.qmldir; + +/** + * An AST Node representing a Type Info Command in a qmldir file. + * + * @see Module Definition qmldir Files + */ +public interface IQDirTypeInfoCommand extends IQDirCommand { + /** + * Gets the IQDirWord representing the filename of the type info file. + * + * @return the filename of the type info file + */ + public IQDirWord getFile(); +} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmldir/IQDirVersion.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmldir/IQDirVersion.java index f8f715277d3..a65c55d179d 100644 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmldir/IQDirVersion.java +++ b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmldir/IQDirVersion.java @@ -1,23 +1,23 @@ -/******************************************************************************* - * Copyright (c) 2015 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.qt.core.qmldir; - -/** - * An AST Node representing a version String of the form <MajorVersion>.<MinorVersion> - */ -public interface IQDirVersion extends IQDirASTNode { - /** - * Gets the String value of this version. The result will always be of the form "<MajorVersion>.<MinorVersion>" - * - * @return a string value of this version - */ - public String getVersionString(); -} +/******************************************************************************* + * Copyright (c) 2015 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.qt.core.qmldir; + +/** + * An AST Node representing a version String of the form <MajorVersion>.<MinorVersion> + */ +public interface IQDirVersion extends IQDirASTNode { + /** + * Gets the String value of this version. The result will always be of the form "<MajorVersion>.<MinorVersion>" + * + * @return a string value of this version + */ + public String getVersionString(); +} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmldir/IQDirWord.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmldir/IQDirWord.java index 2afa6e005ce..e7e61712245 100644 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmldir/IQDirWord.java +++ b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmldir/IQDirWord.java @@ -1,27 +1,27 @@ -/******************************************************************************* - * Copyright (c) 2015 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.qt.core.qmldir; - -/** - * An AST Node representing a set of characters that does not contain whitespace and does not start with a digit. This encompasses - * the syntax for Identifiers, Qualified IDs, Paths, and File Names all in one parser rule. - */ -public interface IQDirWord extends IQDirASTNode { - /** - * Gets the String representing this word as it appears in the qmldir file.
    - *
    - * Note: The text is not modified or validated in any way when it is parsed. It is necessary for the caller to perform - * semantic validation of the returned value to ensure it represents a valid identifier, filename, or path. - * - * @return a string representing this word - */ - public String getText(); -} +/******************************************************************************* + * Copyright (c) 2015 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.qt.core.qmldir; + +/** + * An AST Node representing a set of characters that does not contain whitespace and does not start with a digit. This encompasses + * the syntax for Identifiers, Qualified IDs, Paths, and File Names all in one parser rule. + */ +public interface IQDirWord extends IQDirASTNode { + /** + * Gets the String representing this word as it appears in the qmldir file.
    + *
    + * Note: The text is not modified or validated in any way when it is parsed. It is necessary for the caller to perform + * semantic validation of the returned value to ensure it represents a valid identifier, filename, or path. + * + * @return a string representing this word + */ + public String getText(); +} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmldir/QMLDirectoryInfo.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmldir/QMLDirectoryInfo.java index be70e0c39cd..8451a64c6b9 100644 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmldir/QMLDirectoryInfo.java +++ b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmldir/QMLDirectoryInfo.java @@ -1,180 +1,180 @@ -/******************************************************************************* - * Copyright (c) 2015 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.qt.core.qmldir; - -import java.io.InputStream; -import java.nio.file.InvalidPathException; -import java.nio.file.Path; -import java.nio.file.Paths; -import java.util.Collection; -import java.util.Collections; -import java.util.LinkedList; - -import org.eclipse.cdt.internal.qt.core.Activator; - -public class QMLDirectoryInfo { - public static class Module { - private final String name; - private final String initialVersion; - - public Module(String name, String ver) { - this.name = name; - this.initialVersion = ver; - } - - public String getName() { - return name; - } - - public String getInitialVersion() { - return initialVersion; - } - } - - public static class Plugin { - private final String name; - private final Path path; - - private Plugin(String name, String path) { - this.name = name; - Path p = null; - if (path != null) { - try { - p = Paths.get(path); - } catch (InvalidPathException e) { - Activator.log(e); - } - } - this.path = p; - } - - public String getName() { - return name; - } - - public Path getRelativePath() { - return path; - } - } - - public static class ResourceFile { - private final String name; - private final boolean internal; - private final boolean singleton; - private final String initialVersion; - - private ResourceFile(String name, String ver, boolean internal, boolean singleton) { - this.name = name; - this.initialVersion = ver; - this.internal = internal; - this.singleton = singleton; - } - - public String getName() { - return name; - } - - public String getInitialVersion() { - return initialVersion; - } - - public boolean isSingleton() { - return singleton; - } - - public boolean isInternal() { - return internal; - } - } - - private String moduleIdentifier; - private Plugin plugin; - private String classname; - private String typeInfo; - private final Collection depends; - private final Collection resources; - private boolean designersupported; - - public QMLDirectoryInfo(InputStream input) { - this.depends = new LinkedList<>(); - this.resources = new LinkedList<>(); - - IQDirAST ast = new QMLDirectoryParser().parse(input); - for (IQDirCommand c : ast.getCommands()) { - if (c instanceof IQDirModuleCommand) { - if (moduleIdentifier == null) { - moduleIdentifier = ((IQDirModuleCommand) c).getModuleIdentifier().getText(); - } - } else if (c instanceof IQDirPluginCommand) { - if (plugin == null) { - IQDirPluginCommand pc = (IQDirPluginCommand) c; - plugin = new Plugin(pc.getName().getText(), pc.getPath() != null ? pc.getPath().getText() : null); - } - } else if (c instanceof IQDirTypeInfoCommand) { - if (typeInfo == null) { - typeInfo = ((IQDirTypeInfoCommand) c).getFile().getText(); - } - } else if (c instanceof IQDirResourceCommand) { - IQDirResourceCommand rc = (IQDirResourceCommand) c; - resources.add(new ResourceFile(rc.getFile().getText(), - rc.getInitialVersion().getVersionString(), - false, false)); - } else if (c instanceof IQDirInternalCommand) { - IQDirInternalCommand rc = (IQDirInternalCommand) c; - resources.add(new ResourceFile(rc.getFile().getText(), - null, true, false)); - } else if (c instanceof IQDirSingletonCommand) { - IQDirSingletonCommand rc = (IQDirSingletonCommand) c; - resources.add(new ResourceFile(rc.getFile().getText(), - rc.getInitialVersion().getVersionString(), - false, true)); - } else if (c instanceof IQDirDependsCommand) { - IQDirDependsCommand dc = (IQDirDependsCommand) c; - depends.add(new Module(dc.getModuleIdentifier().getText(), - dc.getInitialVersion().getVersionString())); - } else if (c instanceof IQDirClassnameCommand) { - if (classname == null) { - classname = ((IQDirClassnameCommand) c).getIdentifier().getText(); - } - } else if (c instanceof IQDirDesignerSupportedCommand) { - designersupported = true; - } - } - } - - public String getModuleIdentifier() { - return moduleIdentifier; - } - - public Plugin getPlugin() { - return plugin; - } - - public String getClassname() { - return classname; - } - - public String getTypesFileName() { - return typeInfo; - } - - public Collection getDependentModules() { - return Collections.unmodifiableCollection(depends); - } - - public Collection getResources() { - return Collections.unmodifiableCollection(resources); - } - - public boolean isDesignersupported() { - return designersupported; - } -} +/******************************************************************************* + * Copyright (c) 2015 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.qt.core.qmldir; + +import java.io.InputStream; +import java.nio.file.InvalidPathException; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.util.Collection; +import java.util.Collections; +import java.util.LinkedList; + +import org.eclipse.cdt.internal.qt.core.Activator; + +public class QMLDirectoryInfo { + public static class Module { + private final String name; + private final String initialVersion; + + public Module(String name, String ver) { + this.name = name; + this.initialVersion = ver; + } + + public String getName() { + return name; + } + + public String getInitialVersion() { + return initialVersion; + } + } + + public static class Plugin { + private final String name; + private final Path path; + + private Plugin(String name, String path) { + this.name = name; + Path p = null; + if (path != null) { + try { + p = Paths.get(path); + } catch (InvalidPathException e) { + Activator.log(e); + } + } + this.path = p; + } + + public String getName() { + return name; + } + + public Path getRelativePath() { + return path; + } + } + + public static class ResourceFile { + private final String name; + private final boolean internal; + private final boolean singleton; + private final String initialVersion; + + private ResourceFile(String name, String ver, boolean internal, boolean singleton) { + this.name = name; + this.initialVersion = ver; + this.internal = internal; + this.singleton = singleton; + } + + public String getName() { + return name; + } + + public String getInitialVersion() { + return initialVersion; + } + + public boolean isSingleton() { + return singleton; + } + + public boolean isInternal() { + return internal; + } + } + + private String moduleIdentifier; + private Plugin plugin; + private String classname; + private String typeInfo; + private final Collection depends; + private final Collection resources; + private boolean designersupported; + + public QMLDirectoryInfo(InputStream input) { + this.depends = new LinkedList<>(); + this.resources = new LinkedList<>(); + + IQDirAST ast = new QMLDirectoryParser().parse(input); + for (IQDirCommand c : ast.getCommands()) { + if (c instanceof IQDirModuleCommand) { + if (moduleIdentifier == null) { + moduleIdentifier = ((IQDirModuleCommand) c).getModuleIdentifier().getText(); + } + } else if (c instanceof IQDirPluginCommand) { + if (plugin == null) { + IQDirPluginCommand pc = (IQDirPluginCommand) c; + plugin = new Plugin(pc.getName().getText(), pc.getPath() != null ? pc.getPath().getText() : null); + } + } else if (c instanceof IQDirTypeInfoCommand) { + if (typeInfo == null) { + typeInfo = ((IQDirTypeInfoCommand) c).getFile().getText(); + } + } else if (c instanceof IQDirResourceCommand) { + IQDirResourceCommand rc = (IQDirResourceCommand) c; + resources.add(new ResourceFile(rc.getFile().getText(), + rc.getInitialVersion().getVersionString(), + false, false)); + } else if (c instanceof IQDirInternalCommand) { + IQDirInternalCommand rc = (IQDirInternalCommand) c; + resources.add(new ResourceFile(rc.getFile().getText(), + null, true, false)); + } else if (c instanceof IQDirSingletonCommand) { + IQDirSingletonCommand rc = (IQDirSingletonCommand) c; + resources.add(new ResourceFile(rc.getFile().getText(), + rc.getInitialVersion().getVersionString(), + false, true)); + } else if (c instanceof IQDirDependsCommand) { + IQDirDependsCommand dc = (IQDirDependsCommand) c; + depends.add(new Module(dc.getModuleIdentifier().getText(), + dc.getInitialVersion().getVersionString())); + } else if (c instanceof IQDirClassnameCommand) { + if (classname == null) { + classname = ((IQDirClassnameCommand) c).getIdentifier().getText(); + } + } else if (c instanceof IQDirDesignerSupportedCommand) { + designersupported = true; + } + } + } + + public String getModuleIdentifier() { + return moduleIdentifier; + } + + public Plugin getPlugin() { + return plugin; + } + + public String getClassname() { + return classname; + } + + public String getTypesFileName() { + return typeInfo; + } + + public Collection getDependentModules() { + return Collections.unmodifiableCollection(depends); + } + + public Collection getResources() { + return Collections.unmodifiableCollection(resources); + } + + public boolean isDesignersupported() { + return designersupported; + } +} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmldir/QMLDirectoryLexer.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmldir/QMLDirectoryLexer.java index 0e0756e718b..7e15fbfb31a 100644 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmldir/QMLDirectoryLexer.java +++ b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmldir/QMLDirectoryLexer.java @@ -1,252 +1,252 @@ -/******************************************************************************* - * Copyright (c) 2015 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.qt.core.qmldir; - -import java.io.InputStream; -import java.util.Scanner; -import java.util.regex.MatchResult; -import java.util.regex.Pattern; - -import org.eclipse.cdt.internal.qt.core.location.Position; -import org.eclipse.cdt.internal.qt.core.location.SourceLocation; -import org.eclipse.cdt.qt.core.location.ISourceLocation; - -/** - * Converts an InputStream representing a qmldir file into a stream of tokens through successive calls to - * nextToken. This lexer uses regular expressions to match its 16 valid token types: - *
      - *
    • COMMENT: A single line comment that begins with '#' - *
    • MODULE: Keyword 'module' - *
    • TYPEINFO: The keyword 'typeinfo' - *
    • SINGLETON: The keyword 'singleton' - *
    • INTERNAL: The keyword 'internal' - *
    • PLUGIN: The keyword 'plugin' - *
    • CLASSNAME: The keyword 'classname' - *
    • DEPENDS: The keyword 'depends' - *
    • DESIGNERSUPPORTED: The keyword 'designersupported' - *
    • WORD: A group of characters that form an identifier, filename, or path - *
    • DECIMAL: A number of the form [0-9]+ '.' [0-9]+ - *
    • INTEGER: An integer of the form [0-9]+ - *
    • WHITESPACE: A group of whitespace characters (not including newlines) - *
    • COMMAND_END: A newline character - *
    • UNKNOWN: A group of characters that does not match any of the preceding tokens - *
    • EOF: End of File - *
    - */ -public class QMLDirectoryLexer { - /** - * A single matched token returned by a QMLDirectoryLexer. A Token stores information on how it was - * matched including the type of token, the exact text that was matched, and its position in the InputStream . - */ - public static class Token { - private final TokenType tokType; - private final String raw; - private final ISourceLocation location; - private final int start; - private final int end; - - private Token(TokenType type, MatchResult match, int line, int lineStart) { - this(type, match.group(), match.start(), match.end(), line, lineStart); - } - - private Token(TokenType type, String raw, int start, int end, int line, int lineStart) { - this.tokType = type; - raw = raw.replaceAll("\n", "\\\\n"); //$NON-NLS-1$ //$NON-NLS-2$ - raw = raw.replaceAll("\r", "\\\\r"); //$NON-NLS-1$ //$NON-NLS-2$ - this.raw = raw; - this.start = start; - this.end = end; - this.location = new SourceLocation(null, - new Position(line, start - lineStart), - new Position(line, end - lineStart)); - } - - /** - * Get the type of token that was matched. - * - * @return the type of token - */ - public TokenType getType() { - return tokType; - } - - /** - * Gets the raw text that this token was matched with. - * - * @return a String representing the matched text - */ - public String getText() { - return raw; - } - - /** - * Gets a more detailed description of this token's location in the InputStream than {@link Token#getStart()} - * and {@link Token#getEnd()}. This method allows the retrieval of line and column information in order to make output for - * syntax errors and the like more human-readable. - * - * @return the {@link ISourceLocation} representing this token's location in the InputStream - */ - public ISourceLocation getLocation() { - return location; - } - - /** - * Gets the zero-indexed offset indicating the start of this token in the InputStream. - * - * @return the token's start offset - */ - public int getStart() { - return start; - } - - /** - * Gets the zero-indexed offset indicating the end of this token in the InputStream. - * - * @return the token's end offset - */ - public int getEnd() { - return end; - } - } - - /** - * An Enumeration encompassing the 16 possible types of tokens returned by a QMLDirectoryLexer. - * - * @see org.eclipse.cdt.qt.core.qmldir.QMLDirectoryLexer - */ - public static enum TokenType { - COMMENT("#.*$"), //$NON-NLS-1$ - MODULE("module(?=\\s|$)"), //$NON-NLS-1$ - TYPEINFO("typeinfo(?=\\s|$)"), //$NON-NLS-1$ - SINGLETON("singleton(?=\\s|$)"), //$NON-NLS-1$ - INTERNAL("internal(?=\\s|$)"), //$NON-NLS-1$ - PLUGIN("plugin(?=\\s|$)"), //$NON-NLS-1$ - CLASSNAME("classname(?=\\s|$)"), //$NON-NLS-1$ - DEPENDS("depends(?=\\s|$)"), //$NON-NLS-1$ - DESIGNERSUPPORTED("designersupported(?=\\s|$)"), //$NON-NLS-1$ - WORD("[^0-9\\s][^\\s]*"), //$NON-NLS-1$ - DECIMAL("[0-9]+\\.[0-9]+"), //$NON-NLS-1$ - INTEGER("[0-9]+"), //$NON-NLS-1$ - WHITESPACE("\\h+"), //$NON-NLS-1$ - COMMAND_END("(?:\r\n)|\n"), //$NON-NLS-1$ - UNKNOWN(".+"), //$NON-NLS-1$ - EOF(null); - - private static Pattern pattern; - - private static Pattern patternForAllTerminals() { - if (pattern == null) { - String regex = ""; //$NON-NLS-1$ - TokenType[] tokens = TokenType.values(); - for (int i = 0; i < TokenType.values().length; i++) { - TokenType tok = tokens[i]; - if (tok.regex != null) { - if (i != 0) { - regex += "|"; //$NON-NLS-1$ - } - regex += "(" + tok.regex + ")"; //$NON-NLS-1$ //$NON-NLS-2$ - } - } - pattern = Pattern.compile(regex, Pattern.MULTILINE); - } - return pattern; - } - - private final String regex; - - private TokenType(String regex) { - this.regex = regex; - } - } - - private Scanner input; - private MatchResult lastMatch; - private int currentLine; - private int currentLineStart; - - /** - * Creates a new QMLDirectoryLexer without initializing any of the its internal state. A call to - * setInput is necessary to fully initialize the lexer before any calls to nextToken. - */ - public QMLDirectoryLexer() { - } - - /** - * Prepares for lexical analysis by giving the lexer an InputStream to retrieve text from. - * - * @param input - * the input to perform lexical analysis on - */ - public void setInput(InputStream input) { - this.input = new Scanner(input); - this.lastMatch = null; - this.currentLine = 1; - this.currentLineStart = 0; - } - - /** - * Retrieves the next valid token from the InputStream given by setInput. This is a helper method to - * skip whitespace that is equivalent to QMLDirectoryLexer.nextToken(true). - * - * @return the next token in the InputStream - * @throws IllegalArgumentException - * if setInput has not been called - */ - public Token nextToken() throws IllegalArgumentException { - return nextToken(true); - } - - /** - * Retrieves the next valid token from the InputStream given by setInput. This method has the ability - * to skip over whitespace tokens by setting skipWhitespace to true. - * - * @param skipWhitespace - * whether or not the lexer should skip whitespace tokens - * @return the next token in the InputStream - * @throws IllegalArgumentException - * if setInput has not been called - */ - public Token nextToken(boolean skipWhitespace) throws IllegalArgumentException { - if (input == null) { - throw new IllegalArgumentException("Input cannot be null"); //$NON-NLS-1$ - } - if (input.findWithinHorizon(TokenType.patternForAllTerminals(), 0) == null) { - if (lastMatch != null) { - return new Token(TokenType.EOF, "", lastMatch.end(), lastMatch.end(), currentLine, currentLineStart); //$NON-NLS-1$ - } else { - return new Token(TokenType.EOF, "", 0, 0, 1, 0); //$NON-NLS-1$ - } - } else { - int groupNo = 1; - for (TokenType t : TokenType.values()) { - if (t.regex != null) { - if (input.match().start(groupNo) != -1) { - lastMatch = input.match(); - Token next = null; - if (!(t.equals(TokenType.WHITESPACE) && skipWhitespace)) { - next = new Token(t, input.match(), currentLine, currentLineStart); - } else { - next = nextToken(skipWhitespace); - } - if (t.equals(TokenType.COMMAND_END)) { - // Advance the line number information - currentLine++; - currentLineStart = input.match().end(); - } - return next; - } - groupNo++; - } - } - return new Token(TokenType.UNKNOWN, input.match(), currentLine, currentLineStart); - } - } -} +/******************************************************************************* + * Copyright (c) 2015 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.qt.core.qmldir; + +import java.io.InputStream; +import java.util.Scanner; +import java.util.regex.MatchResult; +import java.util.regex.Pattern; + +import org.eclipse.cdt.internal.qt.core.location.Position; +import org.eclipse.cdt.internal.qt.core.location.SourceLocation; +import org.eclipse.cdt.qt.core.location.ISourceLocation; + +/** + * Converts an InputStream representing a qmldir file into a stream of tokens through successive calls to + * nextToken. This lexer uses regular expressions to match its 16 valid token types: + *
      + *
    • COMMENT: A single line comment that begins with '#' + *
    • MODULE: Keyword 'module' + *
    • TYPEINFO: The keyword 'typeinfo' + *
    • SINGLETON: The keyword 'singleton' + *
    • INTERNAL: The keyword 'internal' + *
    • PLUGIN: The keyword 'plugin' + *
    • CLASSNAME: The keyword 'classname' + *
    • DEPENDS: The keyword 'depends' + *
    • DESIGNERSUPPORTED: The keyword 'designersupported' + *
    • WORD: A group of characters that form an identifier, filename, or path + *
    • DECIMAL: A number of the form [0-9]+ '.' [0-9]+ + *
    • INTEGER: An integer of the form [0-9]+ + *
    • WHITESPACE: A group of whitespace characters (not including newlines) + *
    • COMMAND_END: A newline character + *
    • UNKNOWN: A group of characters that does not match any of the preceding tokens + *
    • EOF: End of File + *
    + */ +public class QMLDirectoryLexer { + /** + * A single matched token returned by a QMLDirectoryLexer. A Token stores information on how it was + * matched including the type of token, the exact text that was matched, and its position in the InputStream . + */ + public static class Token { + private final TokenType tokType; + private final String raw; + private final ISourceLocation location; + private final int start; + private final int end; + + private Token(TokenType type, MatchResult match, int line, int lineStart) { + this(type, match.group(), match.start(), match.end(), line, lineStart); + } + + private Token(TokenType type, String raw, int start, int end, int line, int lineStart) { + this.tokType = type; + raw = raw.replaceAll("\n", "\\\\n"); //$NON-NLS-1$ //$NON-NLS-2$ + raw = raw.replaceAll("\r", "\\\\r"); //$NON-NLS-1$ //$NON-NLS-2$ + this.raw = raw; + this.start = start; + this.end = end; + this.location = new SourceLocation(null, + new Position(line, start - lineStart), + new Position(line, end - lineStart)); + } + + /** + * Get the type of token that was matched. + * + * @return the type of token + */ + public TokenType getType() { + return tokType; + } + + /** + * Gets the raw text that this token was matched with. + * + * @return a String representing the matched text + */ + public String getText() { + return raw; + } + + /** + * Gets a more detailed description of this token's location in the InputStream than {@link Token#getStart()} + * and {@link Token#getEnd()}. This method allows the retrieval of line and column information in order to make output for + * syntax errors and the like more human-readable. + * + * @return the {@link ISourceLocation} representing this token's location in the InputStream + */ + public ISourceLocation getLocation() { + return location; + } + + /** + * Gets the zero-indexed offset indicating the start of this token in the InputStream. + * + * @return the token's start offset + */ + public int getStart() { + return start; + } + + /** + * Gets the zero-indexed offset indicating the end of this token in the InputStream. + * + * @return the token's end offset + */ + public int getEnd() { + return end; + } + } + + /** + * An Enumeration encompassing the 16 possible types of tokens returned by a QMLDirectoryLexer. + * + * @see org.eclipse.cdt.qt.core.qmldir.QMLDirectoryLexer + */ + public static enum TokenType { + COMMENT("#.*$"), //$NON-NLS-1$ + MODULE("module(?=\\s|$)"), //$NON-NLS-1$ + TYPEINFO("typeinfo(?=\\s|$)"), //$NON-NLS-1$ + SINGLETON("singleton(?=\\s|$)"), //$NON-NLS-1$ + INTERNAL("internal(?=\\s|$)"), //$NON-NLS-1$ + PLUGIN("plugin(?=\\s|$)"), //$NON-NLS-1$ + CLASSNAME("classname(?=\\s|$)"), //$NON-NLS-1$ + DEPENDS("depends(?=\\s|$)"), //$NON-NLS-1$ + DESIGNERSUPPORTED("designersupported(?=\\s|$)"), //$NON-NLS-1$ + WORD("[^0-9\\s][^\\s]*"), //$NON-NLS-1$ + DECIMAL("[0-9]+\\.[0-9]+"), //$NON-NLS-1$ + INTEGER("[0-9]+"), //$NON-NLS-1$ + WHITESPACE("\\h+"), //$NON-NLS-1$ + COMMAND_END("(?:\r\n)|\n"), //$NON-NLS-1$ + UNKNOWN(".+"), //$NON-NLS-1$ + EOF(null); + + private static Pattern pattern; + + private static Pattern patternForAllTerminals() { + if (pattern == null) { + String regex = ""; //$NON-NLS-1$ + TokenType[] tokens = TokenType.values(); + for (int i = 0; i < TokenType.values().length; i++) { + TokenType tok = tokens[i]; + if (tok.regex != null) { + if (i != 0) { + regex += "|"; //$NON-NLS-1$ + } + regex += "(" + tok.regex + ")"; //$NON-NLS-1$ //$NON-NLS-2$ + } + } + pattern = Pattern.compile(regex, Pattern.MULTILINE); + } + return pattern; + } + + private final String regex; + + private TokenType(String regex) { + this.regex = regex; + } + } + + private Scanner input; + private MatchResult lastMatch; + private int currentLine; + private int currentLineStart; + + /** + * Creates a new QMLDirectoryLexer without initializing any of the its internal state. A call to + * setInput is necessary to fully initialize the lexer before any calls to nextToken. + */ + public QMLDirectoryLexer() { + } + + /** + * Prepares for lexical analysis by giving the lexer an InputStream to retrieve text from. + * + * @param input + * the input to perform lexical analysis on + */ + public void setInput(InputStream input) { + this.input = new Scanner(input); + this.lastMatch = null; + this.currentLine = 1; + this.currentLineStart = 0; + } + + /** + * Retrieves the next valid token from the InputStream given by setInput. This is a helper method to + * skip whitespace that is equivalent to QMLDirectoryLexer.nextToken(true). + * + * @return the next token in the InputStream + * @throws IllegalArgumentException + * if setInput has not been called + */ + public Token nextToken() throws IllegalArgumentException { + return nextToken(true); + } + + /** + * Retrieves the next valid token from the InputStream given by setInput. This method has the ability + * to skip over whitespace tokens by setting skipWhitespace to true. + * + * @param skipWhitespace + * whether or not the lexer should skip whitespace tokens + * @return the next token in the InputStream + * @throws IllegalArgumentException + * if setInput has not been called + */ + public Token nextToken(boolean skipWhitespace) throws IllegalArgumentException { + if (input == null) { + throw new IllegalArgumentException("Input cannot be null"); //$NON-NLS-1$ + } + if (input.findWithinHorizon(TokenType.patternForAllTerminals(), 0) == null) { + if (lastMatch != null) { + return new Token(TokenType.EOF, "", lastMatch.end(), lastMatch.end(), currentLine, currentLineStart); //$NON-NLS-1$ + } else { + return new Token(TokenType.EOF, "", 0, 0, 1, 0); //$NON-NLS-1$ + } + } else { + int groupNo = 1; + for (TokenType t : TokenType.values()) { + if (t.regex != null) { + if (input.match().start(groupNo) != -1) { + lastMatch = input.match(); + Token next = null; + if (!(t.equals(TokenType.WHITESPACE) && skipWhitespace)) { + next = new Token(t, input.match(), currentLine, currentLineStart); + } else { + next = nextToken(skipWhitespace); + } + if (t.equals(TokenType.COMMAND_END)) { + // Advance the line number information + currentLine++; + currentLineStart = input.match().end(); + } + return next; + } + groupNo++; + } + } + return new Token(TokenType.UNKNOWN, input.match(), currentLine, currentLineStart); + } + } +} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmldir/QMLDirectoryParser.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmldir/QMLDirectoryParser.java index 5af75b43669..98ac4f8b037 100644 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmldir/QMLDirectoryParser.java +++ b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmldir/QMLDirectoryParser.java @@ -1,423 +1,423 @@ -/******************************************************************************* - * Copyright (c) 2015 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.qt.core.qmldir; - -import java.io.InputStream; -import java.util.Stack; - -import org.eclipse.cdt.internal.qt.core.location.SourceLocation; -import org.eclipse.cdt.internal.qt.core.qmldir.QDirAST; -import org.eclipse.cdt.internal.qt.core.qmldir.QDirASTNode; -import org.eclipse.cdt.internal.qt.core.qmldir.QDirClassnameCommand; -import org.eclipse.cdt.internal.qt.core.qmldir.QDirCommentCommand; -import org.eclipse.cdt.internal.qt.core.qmldir.QDirDependsCommand; -import org.eclipse.cdt.internal.qt.core.qmldir.QDirDesignerSupportedCommand; -import org.eclipse.cdt.internal.qt.core.qmldir.QDirInternalCommand; -import org.eclipse.cdt.internal.qt.core.qmldir.QDirModuleCommand; -import org.eclipse.cdt.internal.qt.core.qmldir.QDirPluginCommand; -import org.eclipse.cdt.internal.qt.core.qmldir.QDirResourceCommand; -import org.eclipse.cdt.internal.qt.core.qmldir.QDirSingletonCommand; -import org.eclipse.cdt.internal.qt.core.qmldir.QDirSyntaxError; -import org.eclipse.cdt.internal.qt.core.qmldir.QDirTypeInfoCommand; -import org.eclipse.cdt.internal.qt.core.qmldir.QDirVersion; -import org.eclipse.cdt.internal.qt.core.qmldir.QDirWord; -import org.eclipse.cdt.qt.core.qmldir.QMLDirectoryLexer.Token; -import org.eclipse.cdt.qt.core.qmldir.QMLDirectoryLexer.TokenType; - -/** - * Converts an InputStream representing a qmldir file into an Abstract Syntax Tree. Uses the {@link QMLDirectoryLexer} - * under the hood to match tokens which it then uses to construct the AST. Also, a QMLDirectoryParser has the ability - * to skip over syntax errors and include them in its AST rather than returning upon the first error. - */ -public class QMLDirectoryParser { - /** - * An exception thrown when a QMLDirectoryParser encounters a syntax error. This class stores information on the - * offending token as well as the node the parser was working on before it failed (if available). - */ - public static class SyntaxError extends RuntimeException { - private static final long serialVersionUID = 6608815552297970623L; - - private final IQDirASTNode incompleteNode; - private final Token offendingToken; - - /** - * Creates a new SyntaxError. - * - * @param node - * the incomplete working node - * @param token - * the offending token - * @param message - * the message to display - */ - public SyntaxError(IQDirASTNode node, Token token, String message) { - super(message); - this.incompleteNode = node; - this.offendingToken = token; - } - - /** - * Gets the token that caused the parser to fail. - * - * @return the offending token - */ - public Token getOffendingToken() { - return offendingToken; - } - - /** - * Gets the last node that the parser was working on before it failed or null if that information isn't present. - * - * @return the incomplete node or null if not available - */ - public IQDirASTNode getIncompleteNode() { - return incompleteNode; - } - } - - private final QMLDirectoryLexer lexer; - private final Stack workingNodes; - private Token tok; - - /** - * Initializes a new QMLDirectoryParser capable of parsing an InputStream and returning an AST. - */ - public QMLDirectoryParser() { - this.lexer = new QMLDirectoryLexer(); - this.workingNodes = new Stack<>(); - } - - /** - * Parses the given InputStream into an Abstract Syntax Tree. This is a helper method equivalent to - * parse(input, true). That is, the parser will attempt to recover once it hits an error and include an - * {@link IQDirSyntaxError} node in the AST. - * - * @param input - * the input to parse - * @return the Abstract Syntax Tree representing the input - * @see QMLDirectoryParser#parse(InputStream, boolean) - */ - public IQDirAST parse(InputStream input) { - return parse(input, true); - } - - /** - * Parses the given InputStream into an Abstract Syntax Tree. If tolerateErrors is true, - * any syntax errors will be included in the AST as a separate {@link IQDirSyntaxErrorCommand}. The parser will then attempt to - * recover by jumping to the next line and continue parsing. A value of false tells the parser to throw a - * {@link SyntaxError} on the first problem it encounters. - * - * @param input - * the input to parse - * @param tolerateErrors - * whether or not the parser should be error tolerant - * @return the Abstract Syntax Tree representing the input - */ - public IQDirAST parse(InputStream input, boolean tolerateErrors) { - // Clear out any leftover state - this.lexer.setInput(input); - this.workingNodes.clear(); - - QDirAST ast = new QDirAST(); - nextToken(); - while (tok.getType() != TokenType.EOF) { - try { - switch (tok.getType()) { - case MODULE: - ast.addCommand(parseModuleCommand()); - break; - case SINGLETON: - ast.addCommand(parseSingletonCommand()); - break; - case INTERNAL: - ast.addCommand(parseInternalCommand()); - break; - case WORD: - ast.addCommand(parseResourceCommand()); - break; - case PLUGIN: - ast.addCommand(parsePluginCommand()); - break; - case CLASSNAME: - ast.addCommand(parseClassnameCommand()); - break; - case TYPEINFO: - ast.addCommand(parseTypeInfoCommand()); - break; - case DEPENDS: - ast.addCommand(parseDependsCommand()); - break; - case DESIGNERSUPPORTED: - ast.addCommand(parseDesignerSupportedCommand()); - break; - case COMMENT: - ast.addCommand(parseCommentCommand()); - break; - case COMMAND_END: - // This is just an empty line that should be ignored - nextToken(); - break; - default: - throw unexpectedToken(); - } - } catch (SyntaxError e) { - if (!tolerateErrors) { - throw e; - } - // Add the syntax error to the AST and jump to the next line - QDirSyntaxError errNode = new QDirSyntaxError(e); - markStart(errNode); - IQDirASTNode node = e.getIncompleteNode(); - if (node != null) { - errNode.setLocation((SourceLocation) node.getLocation()); - errNode.setStart(node.getStart()); - errNode.setEnd(node.getEnd()); - } - while (!eat(TokenType.COMMAND_END) && !eat(TokenType.EOF)) { - nextToken(); - } - markEnd(); - ast.addCommand(errNode); - } - } - return ast; - } - - private void nextToken() { - nextToken(true); - } - - private void nextToken(boolean skipWhitespace) { - tok = lexer.nextToken(skipWhitespace); - } - - private void markStart(QDirASTNode node) { - workingNodes.push(node); - node.setStart(tok.getStart()); - node.setLocation(new SourceLocation()); - node.getLocation().setStart(tok.getLocation().getStart()); - } - - private void markEnd() { - QDirASTNode node = workingNodes.pop(); - node.setEnd(tok.getEnd()); - node.getLocation().setEnd(tok.getLocation().getEnd()); - } - - private boolean eat(TokenType type) { - if (tok.getType() == type) { - nextToken(); - return true; - } - return false; - } - - private SyntaxError syntaxError(String message) { - return new SyntaxError(workingNodes.peek(), tok, message + " " + tok.getLocation().getStart().toString()); //$NON-NLS-1$ - } - - private SyntaxError unexpectedToken() { - String tokenText = tok.getText(); - if (tok.getType() == TokenType.EOF) { - tokenText = "EOF"; //$NON-NLS-1$ - } - return syntaxError("Unexpected token '" + tokenText + "'"); //$NON-NLS-1$ //$NON-NLS-2$ - } - - private void expect(TokenType type) { - if (tok.getType() != type) { - throw unexpectedToken(); - } - nextToken(); - } - - private void expectCommandEnd() { - // Allow EOF to be substituted for COMMAND_END - if (tok.getType() == TokenType.EOF) { - nextToken(); - return; - } - if (tok.getType() != TokenType.COMMAND_END) { - throw syntaxError("Expected token '\\n' or 'EOF', but saw '" + tok.getText() + "'"); //$NON-NLS-1$ //$NON-NLS-2$ - } - nextToken(); - } - - private QDirModuleCommand parseModuleCommand() { - QDirModuleCommand node = new QDirModuleCommand(); - markStart(node); - expect(TokenType.MODULE); - if (tok.getType() == TokenType.WORD) { - node.setModuleIdentifier(parseWord()); - expectCommandEnd(); - markEnd(); - return node; - } - throw unexpectedToken(); - } - - private QDirSingletonCommand parseSingletonCommand() { - QDirSingletonCommand node = new QDirSingletonCommand(); - markStart(node); - expect(TokenType.SINGLETON); - if (tok.getType() == TokenType.WORD) { - node.setTypeName(parseWord()); - if (tok.getType() == TokenType.DECIMAL) { - node.setInitialVersion(parseVersion()); - if (tok.getType() == TokenType.WORD) { - node.setFile(parseWord()); - expectCommandEnd(); - markEnd(); - return node; - } - } - } - throw unexpectedToken(); - }; - - private QDirInternalCommand parseInternalCommand() { - QDirInternalCommand node = new QDirInternalCommand(); - markStart(node); - expect(TokenType.INTERNAL); - if (tok.getType() == TokenType.WORD) { - node.setTypeName(parseWord()); - if (tok.getType() == TokenType.WORD) { - node.setFile(parseWord()); - expectCommandEnd(); - markEnd(); - return node; - } - } - throw unexpectedToken(); - } - - private QDirResourceCommand parseResourceCommand() { - QDirResourceCommand node = new QDirResourceCommand(); - markStart(node); - if (tok.getType() == TokenType.WORD) { - node.setResourceIdentifier(parseWord()); - if (tok.getType() == TokenType.DECIMAL) { - node.setInitialVersion(parseVersion()); - if (tok.getType() == TokenType.WORD) { - node.setFile(parseWord()); - expectCommandEnd(); - markEnd(); - return node; - } - } - } - throw unexpectedToken(); - } - - private QDirPluginCommand parsePluginCommand() { - QDirPluginCommand node = new QDirPluginCommand(); - markStart(node); - expect(TokenType.PLUGIN); - if (tok.getType() == TokenType.WORD) { - node.setName(parseWord()); - if (tok.getType() == TokenType.WORD) { - node.setPath(parseWord()); - } - expectCommandEnd(); - markEnd(); - return node; - } - throw unexpectedToken(); - } - - private QDirClassnameCommand parseClassnameCommand() { - QDirClassnameCommand node = new QDirClassnameCommand(); - markStart(node); - expect(TokenType.CLASSNAME); - if (tok.getType() == TokenType.WORD) { - node.setIdentifier(parseWord()); - expectCommandEnd(); - markEnd(); - return node; - } - throw unexpectedToken(); - } - - private QDirTypeInfoCommand parseTypeInfoCommand() { - QDirTypeInfoCommand node = new QDirTypeInfoCommand(); - markStart(node); - expect(TokenType.TYPEINFO); - if (tok.getType() == TokenType.WORD) { - node.setFile(parseWord()); - expectCommandEnd(); - markEnd(); - return node; - } - throw unexpectedToken(); - } - - private QDirDependsCommand parseDependsCommand() { - QDirDependsCommand node = new QDirDependsCommand(); - markStart(node); - expect(TokenType.DEPENDS); - if (tok.getType() == TokenType.WORD) { - node.setModuleIdentifier(parseWord()); - if (tok.getType() == TokenType.DECIMAL) { - node.setInitialVersion(parseVersion()); - expectCommandEnd(); - markEnd(); - return node; - } - } - throw unexpectedToken(); - } - - private QDirDesignerSupportedCommand parseDesignerSupportedCommand() { - QDirDesignerSupportedCommand node = new QDirDesignerSupportedCommand(); - markStart(node); - expect(TokenType.DESIGNERSUPPORTED); - expectCommandEnd(); - markEnd(); - return node; - } - - private QDirCommentCommand parseCommentCommand() { - QDirCommentCommand node = new QDirCommentCommand(); - markStart(node); - if (tok.getType() == TokenType.COMMENT) { - node.setText(tok.getText()); - nextToken(); - expectCommandEnd(); - markEnd(); - return node; - } - throw unexpectedToken(); - } - - private QDirVersion parseVersion() { - QDirVersion node = new QDirVersion(); - markStart(node); - if (tok.getType() == TokenType.DECIMAL) { - node.setVersionString(tok.getText()); - nextToken(); - markEnd(); - return node; - } - throw unexpectedToken(); - } - - private QDirWord parseWord() { - QDirWord node = new QDirWord(); - markStart(node); - if (tok.getType() == TokenType.WORD) { - node.setText(tok.getText()); - nextToken(); - markEnd(); - return node; - } - throw unexpectedToken(); - } -} +/******************************************************************************* + * Copyright (c) 2015 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.qt.core.qmldir; + +import java.io.InputStream; +import java.util.Stack; + +import org.eclipse.cdt.internal.qt.core.location.SourceLocation; +import org.eclipse.cdt.internal.qt.core.qmldir.QDirAST; +import org.eclipse.cdt.internal.qt.core.qmldir.QDirASTNode; +import org.eclipse.cdt.internal.qt.core.qmldir.QDirClassnameCommand; +import org.eclipse.cdt.internal.qt.core.qmldir.QDirCommentCommand; +import org.eclipse.cdt.internal.qt.core.qmldir.QDirDependsCommand; +import org.eclipse.cdt.internal.qt.core.qmldir.QDirDesignerSupportedCommand; +import org.eclipse.cdt.internal.qt.core.qmldir.QDirInternalCommand; +import org.eclipse.cdt.internal.qt.core.qmldir.QDirModuleCommand; +import org.eclipse.cdt.internal.qt.core.qmldir.QDirPluginCommand; +import org.eclipse.cdt.internal.qt.core.qmldir.QDirResourceCommand; +import org.eclipse.cdt.internal.qt.core.qmldir.QDirSingletonCommand; +import org.eclipse.cdt.internal.qt.core.qmldir.QDirSyntaxError; +import org.eclipse.cdt.internal.qt.core.qmldir.QDirTypeInfoCommand; +import org.eclipse.cdt.internal.qt.core.qmldir.QDirVersion; +import org.eclipse.cdt.internal.qt.core.qmldir.QDirWord; +import org.eclipse.cdt.qt.core.qmldir.QMLDirectoryLexer.Token; +import org.eclipse.cdt.qt.core.qmldir.QMLDirectoryLexer.TokenType; + +/** + * Converts an InputStream representing a qmldir file into an Abstract Syntax Tree. Uses the {@link QMLDirectoryLexer} + * under the hood to match tokens which it then uses to construct the AST. Also, a QMLDirectoryParser has the ability + * to skip over syntax errors and include them in its AST rather than returning upon the first error. + */ +public class QMLDirectoryParser { + /** + * An exception thrown when a QMLDirectoryParser encounters a syntax error. This class stores information on the + * offending token as well as the node the parser was working on before it failed (if available). + */ + public static class SyntaxError extends RuntimeException { + private static final long serialVersionUID = 6608815552297970623L; + + private final IQDirASTNode incompleteNode; + private final Token offendingToken; + + /** + * Creates a new SyntaxError. + * + * @param node + * the incomplete working node + * @param token + * the offending token + * @param message + * the message to display + */ + public SyntaxError(IQDirASTNode node, Token token, String message) { + super(message); + this.incompleteNode = node; + this.offendingToken = token; + } + + /** + * Gets the token that caused the parser to fail. + * + * @return the offending token + */ + public Token getOffendingToken() { + return offendingToken; + } + + /** + * Gets the last node that the parser was working on before it failed or null if that information isn't present. + * + * @return the incomplete node or null if not available + */ + public IQDirASTNode getIncompleteNode() { + return incompleteNode; + } + } + + private final QMLDirectoryLexer lexer; + private final Stack workingNodes; + private Token tok; + + /** + * Initializes a new QMLDirectoryParser capable of parsing an InputStream and returning an AST. + */ + public QMLDirectoryParser() { + this.lexer = new QMLDirectoryLexer(); + this.workingNodes = new Stack<>(); + } + + /** + * Parses the given InputStream into an Abstract Syntax Tree. This is a helper method equivalent to + * parse(input, true). That is, the parser will attempt to recover once it hits an error and include an + * {@link IQDirSyntaxError} node in the AST. + * + * @param input + * the input to parse + * @return the Abstract Syntax Tree representing the input + * @see QMLDirectoryParser#parse(InputStream, boolean) + */ + public IQDirAST parse(InputStream input) { + return parse(input, true); + } + + /** + * Parses the given InputStream into an Abstract Syntax Tree. If tolerateErrors is true, + * any syntax errors will be included in the AST as a separate {@link IQDirSyntaxErrorCommand}. The parser will then attempt to + * recover by jumping to the next line and continue parsing. A value of false tells the parser to throw a + * {@link SyntaxError} on the first problem it encounters. + * + * @param input + * the input to parse + * @param tolerateErrors + * whether or not the parser should be error tolerant + * @return the Abstract Syntax Tree representing the input + */ + public IQDirAST parse(InputStream input, boolean tolerateErrors) { + // Clear out any leftover state + this.lexer.setInput(input); + this.workingNodes.clear(); + + QDirAST ast = new QDirAST(); + nextToken(); + while (tok.getType() != TokenType.EOF) { + try { + switch (tok.getType()) { + case MODULE: + ast.addCommand(parseModuleCommand()); + break; + case SINGLETON: + ast.addCommand(parseSingletonCommand()); + break; + case INTERNAL: + ast.addCommand(parseInternalCommand()); + break; + case WORD: + ast.addCommand(parseResourceCommand()); + break; + case PLUGIN: + ast.addCommand(parsePluginCommand()); + break; + case CLASSNAME: + ast.addCommand(parseClassnameCommand()); + break; + case TYPEINFO: + ast.addCommand(parseTypeInfoCommand()); + break; + case DEPENDS: + ast.addCommand(parseDependsCommand()); + break; + case DESIGNERSUPPORTED: + ast.addCommand(parseDesignerSupportedCommand()); + break; + case COMMENT: + ast.addCommand(parseCommentCommand()); + break; + case COMMAND_END: + // This is just an empty line that should be ignored + nextToken(); + break; + default: + throw unexpectedToken(); + } + } catch (SyntaxError e) { + if (!tolerateErrors) { + throw e; + } + // Add the syntax error to the AST and jump to the next line + QDirSyntaxError errNode = new QDirSyntaxError(e); + markStart(errNode); + IQDirASTNode node = e.getIncompleteNode(); + if (node != null) { + errNode.setLocation((SourceLocation) node.getLocation()); + errNode.setStart(node.getStart()); + errNode.setEnd(node.getEnd()); + } + while (!eat(TokenType.COMMAND_END) && !eat(TokenType.EOF)) { + nextToken(); + } + markEnd(); + ast.addCommand(errNode); + } + } + return ast; + } + + private void nextToken() { + nextToken(true); + } + + private void nextToken(boolean skipWhitespace) { + tok = lexer.nextToken(skipWhitespace); + } + + private void markStart(QDirASTNode node) { + workingNodes.push(node); + node.setStart(tok.getStart()); + node.setLocation(new SourceLocation()); + node.getLocation().setStart(tok.getLocation().getStart()); + } + + private void markEnd() { + QDirASTNode node = workingNodes.pop(); + node.setEnd(tok.getEnd()); + node.getLocation().setEnd(tok.getLocation().getEnd()); + } + + private boolean eat(TokenType type) { + if (tok.getType() == type) { + nextToken(); + return true; + } + return false; + } + + private SyntaxError syntaxError(String message) { + return new SyntaxError(workingNodes.peek(), tok, message + " " + tok.getLocation().getStart().toString()); //$NON-NLS-1$ + } + + private SyntaxError unexpectedToken() { + String tokenText = tok.getText(); + if (tok.getType() == TokenType.EOF) { + tokenText = "EOF"; //$NON-NLS-1$ + } + return syntaxError("Unexpected token '" + tokenText + "'"); //$NON-NLS-1$ //$NON-NLS-2$ + } + + private void expect(TokenType type) { + if (tok.getType() != type) { + throw unexpectedToken(); + } + nextToken(); + } + + private void expectCommandEnd() { + // Allow EOF to be substituted for COMMAND_END + if (tok.getType() == TokenType.EOF) { + nextToken(); + return; + } + if (tok.getType() != TokenType.COMMAND_END) { + throw syntaxError("Expected token '\\n' or 'EOF', but saw '" + tok.getText() + "'"); //$NON-NLS-1$ //$NON-NLS-2$ + } + nextToken(); + } + + private QDirModuleCommand parseModuleCommand() { + QDirModuleCommand node = new QDirModuleCommand(); + markStart(node); + expect(TokenType.MODULE); + if (tok.getType() == TokenType.WORD) { + node.setModuleIdentifier(parseWord()); + expectCommandEnd(); + markEnd(); + return node; + } + throw unexpectedToken(); + } + + private QDirSingletonCommand parseSingletonCommand() { + QDirSingletonCommand node = new QDirSingletonCommand(); + markStart(node); + expect(TokenType.SINGLETON); + if (tok.getType() == TokenType.WORD) { + node.setTypeName(parseWord()); + if (tok.getType() == TokenType.DECIMAL) { + node.setInitialVersion(parseVersion()); + if (tok.getType() == TokenType.WORD) { + node.setFile(parseWord()); + expectCommandEnd(); + markEnd(); + return node; + } + } + } + throw unexpectedToken(); + }; + + private QDirInternalCommand parseInternalCommand() { + QDirInternalCommand node = new QDirInternalCommand(); + markStart(node); + expect(TokenType.INTERNAL); + if (tok.getType() == TokenType.WORD) { + node.setTypeName(parseWord()); + if (tok.getType() == TokenType.WORD) { + node.setFile(parseWord()); + expectCommandEnd(); + markEnd(); + return node; + } + } + throw unexpectedToken(); + } + + private QDirResourceCommand parseResourceCommand() { + QDirResourceCommand node = new QDirResourceCommand(); + markStart(node); + if (tok.getType() == TokenType.WORD) { + node.setResourceIdentifier(parseWord()); + if (tok.getType() == TokenType.DECIMAL) { + node.setInitialVersion(parseVersion()); + if (tok.getType() == TokenType.WORD) { + node.setFile(parseWord()); + expectCommandEnd(); + markEnd(); + return node; + } + } + } + throw unexpectedToken(); + } + + private QDirPluginCommand parsePluginCommand() { + QDirPluginCommand node = new QDirPluginCommand(); + markStart(node); + expect(TokenType.PLUGIN); + if (tok.getType() == TokenType.WORD) { + node.setName(parseWord()); + if (tok.getType() == TokenType.WORD) { + node.setPath(parseWord()); + } + expectCommandEnd(); + markEnd(); + return node; + } + throw unexpectedToken(); + } + + private QDirClassnameCommand parseClassnameCommand() { + QDirClassnameCommand node = new QDirClassnameCommand(); + markStart(node); + expect(TokenType.CLASSNAME); + if (tok.getType() == TokenType.WORD) { + node.setIdentifier(parseWord()); + expectCommandEnd(); + markEnd(); + return node; + } + throw unexpectedToken(); + } + + private QDirTypeInfoCommand parseTypeInfoCommand() { + QDirTypeInfoCommand node = new QDirTypeInfoCommand(); + markStart(node); + expect(TokenType.TYPEINFO); + if (tok.getType() == TokenType.WORD) { + node.setFile(parseWord()); + expectCommandEnd(); + markEnd(); + return node; + } + throw unexpectedToken(); + } + + private QDirDependsCommand parseDependsCommand() { + QDirDependsCommand node = new QDirDependsCommand(); + markStart(node); + expect(TokenType.DEPENDS); + if (tok.getType() == TokenType.WORD) { + node.setModuleIdentifier(parseWord()); + if (tok.getType() == TokenType.DECIMAL) { + node.setInitialVersion(parseVersion()); + expectCommandEnd(); + markEnd(); + return node; + } + } + throw unexpectedToken(); + } + + private QDirDesignerSupportedCommand parseDesignerSupportedCommand() { + QDirDesignerSupportedCommand node = new QDirDesignerSupportedCommand(); + markStart(node); + expect(TokenType.DESIGNERSUPPORTED); + expectCommandEnd(); + markEnd(); + return node; + } + + private QDirCommentCommand parseCommentCommand() { + QDirCommentCommand node = new QDirCommentCommand(); + markStart(node); + if (tok.getType() == TokenType.COMMENT) { + node.setText(tok.getText()); + nextToken(); + expectCommandEnd(); + markEnd(); + return node; + } + throw unexpectedToken(); + } + + private QDirVersion parseVersion() { + QDirVersion node = new QDirVersion(); + markStart(node); + if (tok.getType() == TokenType.DECIMAL) { + node.setVersionString(tok.getText()); + nextToken(); + markEnd(); + return node; + } + throw unexpectedToken(); + } + + private QDirWord parseWord() { + QDirWord node = new QDirWord(); + markStart(node); + if (tok.getType() == TokenType.WORD) { + node.setText(tok.getText()); + nextToken(); + markEnd(); + return node; + } + throw unexpectedToken(); + } +} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSArrayExpression.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSArrayExpression.java index 34251ab0882..1a6eb0a6a0a 100644 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSArrayExpression.java +++ b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSArrayExpression.java @@ -1,26 +1,26 @@ -/******************************************************************************* - * Copyright (c) 2015 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.qt.core.qmljs; - -import java.util.List; - -/** - * A JavaScript array expression from the ESTree - * Specification - */ -public interface IJSArrayExpression extends IJSExpression { - @Override - default String getType() { - return "ArrayExpression"; //$NON-NLS-1$ - } - - public List getElements(); -} +/******************************************************************************* + * Copyright (c) 2015 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.qt.core.qmljs; + +import java.util.List; + +/** + * A JavaScript array expression from the ESTree + * Specification + */ +public interface IJSArrayExpression extends IJSExpression { + @Override + default String getType() { + return "ArrayExpression"; //$NON-NLS-1$ + } + + public List getElements(); +} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSAssignmentExpression.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSAssignmentExpression.java index 0bd47ba92be..a828dd5379b 100644 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSAssignmentExpression.java +++ b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSAssignmentExpression.java @@ -1,68 +1,68 @@ -/******************************************************************************* - * Copyright (c) 2015 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.qt.core.qmljs; - -/** - * A JavaScript assignment expression from the - * ESTree Specification - */ -public interface IJSAssignmentExpression extends IJSExpression { - /** - * An Enumeration covering the 12 assignment operators in JavaScript - */ - enum AssignmentOperator { - Assign("="), //$NON-NLS-1$ - AssignAdd("+="), //$NON-NLS-1$ - AssignSubtract("-="), //$NON-NLS-1$ - AssignMultiply("*="), //$NON-NLS-1$ - AssignDivide("/="), //$NON-NLS-1$ - AssignModulus("%="), //$NON-NLS-1$ - AssignLeftShift("<<="), //$NON-NLS-1$ - AssignRightShift(">>="), //$NON-NLS-1$ - AssignUnsignedRightShift(">>>="), //$NON-NLS-1$ - AssignOr("|="), //$NON-NLS-1$ - AssignExclusiveOr("^"), //$NON-NLS-1$ - AssignAnd("&="); //$NON-NLS-1$ - - public static AssignmentOperator fromObject(Object obj) { - if (obj instanceof String) { - for (AssignmentOperator op : AssignmentOperator.values()) { - if (obj.equals(op.toString())) { - return op; - } - } - } - return null; - } - - private final String op; - - private AssignmentOperator(String op) { - this.op = op; - } - - @Override - public String toString() { - return this.op; - } - } - - @Override - default String getType() { - return "AssignmentExpression"; //$NON-NLS-1$ - } - - public AssignmentOperator getOperator(); - - public IJSExpression getLeft(); - - public IJSExpression getRight(); -} +/******************************************************************************* + * Copyright (c) 2015 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.qt.core.qmljs; + +/** + * A JavaScript assignment expression from the + * ESTree Specification + */ +public interface IJSAssignmentExpression extends IJSExpression { + /** + * An Enumeration covering the 12 assignment operators in JavaScript + */ + enum AssignmentOperator { + Assign("="), //$NON-NLS-1$ + AssignAdd("+="), //$NON-NLS-1$ + AssignSubtract("-="), //$NON-NLS-1$ + AssignMultiply("*="), //$NON-NLS-1$ + AssignDivide("/="), //$NON-NLS-1$ + AssignModulus("%="), //$NON-NLS-1$ + AssignLeftShift("<<="), //$NON-NLS-1$ + AssignRightShift(">>="), //$NON-NLS-1$ + AssignUnsignedRightShift(">>>="), //$NON-NLS-1$ + AssignOr("|="), //$NON-NLS-1$ + AssignExclusiveOr("^"), //$NON-NLS-1$ + AssignAnd("&="); //$NON-NLS-1$ + + public static AssignmentOperator fromObject(Object obj) { + if (obj instanceof String) { + for (AssignmentOperator op : AssignmentOperator.values()) { + if (obj.equals(op.toString())) { + return op; + } + } + } + return null; + } + + private final String op; + + private AssignmentOperator(String op) { + this.op = op; + } + + @Override + public String toString() { + return this.op; + } + } + + @Override + default String getType() { + return "AssignmentExpression"; //$NON-NLS-1$ + } + + public AssignmentOperator getOperator(); + + public IJSExpression getLeft(); + + public IJSExpression getRight(); +} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSBinaryExpression.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSBinaryExpression.java index 37958a8ce76..a112fd6cba2 100644 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSBinaryExpression.java +++ b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSBinaryExpression.java @@ -1,76 +1,76 @@ -/******************************************************************************* - * Copyright (c) 2015 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.qt.core.qmljs; - -/** - * A JavaScript binary expression from the ESTree - * Specification - */ -public interface IJSBinaryExpression extends IJSExpression { - /** - * An Enumeration covering the 21 binary operators in JavaScript - */ - enum BinaryOperator { - Equality("=="), //$NON-NLS-1$ - Inequality("!="), //$NON-NLS-1$ - StrictEquality("==="), //$NON-NLS-1$ - LessThan("<"), //$NON-NLS-1$ - LessThanOrEqual("<="), //$NON-NLS-1$ - GreaterThan(">"), //$NON-NLS-1$ - GreaterThanOrEqual(">="), //$NON-NLS-1$ - LeftShift("<<"), //$NON-NLS-1$ - RightShift(">>"), //$NON-NLS-1$ - UnsignedRightShift(">>>"), //$NON-NLS-1$ - Add("+"), //$NON-NLS-1$ - Subtract("-"), //$NON-NLS-1$ - Multiply("*"), //$NON-NLS-1$ - Divide("/"), //$NON-NLS-1$ - Modulus("%"), //$NON-NLS-1$ - Or("|"), //$NON-NLS-1$ - EclusiveOr("^"), //$NON-NLS-1$ - And("&"), //$NON-NLS-1$ - In("in"), //$NON-NLS-1$ - Instanceof("instanceof"); //$NON-NLS-1$ - - public static BinaryOperator fromObject(Object obj) { - if (obj instanceof String) { - for (BinaryOperator op : BinaryOperator.values()) { - if (obj.equals(op.toString())) { - return op; - } - } - } - return null; - } - - private final String op; - - private BinaryOperator(String op) { - this.op = op; - } - - @Override - public String toString() { - return this.op; - } - } - - @Override - default String getType() { - return "BinaryExpression"; //$NON-NLS-1$ - } - - public BinaryOperator getOperator(); - - public IJSExpression getLeft(); - - public IJSExpression getRight(); -} +/******************************************************************************* + * Copyright (c) 2015 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.qt.core.qmljs; + +/** + * A JavaScript binary expression from the ESTree + * Specification + */ +public interface IJSBinaryExpression extends IJSExpression { + /** + * An Enumeration covering the 21 binary operators in JavaScript + */ + enum BinaryOperator { + Equality("=="), //$NON-NLS-1$ + Inequality("!="), //$NON-NLS-1$ + StrictEquality("==="), //$NON-NLS-1$ + LessThan("<"), //$NON-NLS-1$ + LessThanOrEqual("<="), //$NON-NLS-1$ + GreaterThan(">"), //$NON-NLS-1$ + GreaterThanOrEqual(">="), //$NON-NLS-1$ + LeftShift("<<"), //$NON-NLS-1$ + RightShift(">>"), //$NON-NLS-1$ + UnsignedRightShift(">>>"), //$NON-NLS-1$ + Add("+"), //$NON-NLS-1$ + Subtract("-"), //$NON-NLS-1$ + Multiply("*"), //$NON-NLS-1$ + Divide("/"), //$NON-NLS-1$ + Modulus("%"), //$NON-NLS-1$ + Or("|"), //$NON-NLS-1$ + EclusiveOr("^"), //$NON-NLS-1$ + And("&"), //$NON-NLS-1$ + In("in"), //$NON-NLS-1$ + Instanceof("instanceof"); //$NON-NLS-1$ + + public static BinaryOperator fromObject(Object obj) { + if (obj instanceof String) { + for (BinaryOperator op : BinaryOperator.values()) { + if (obj.equals(op.toString())) { + return op; + } + } + } + return null; + } + + private final String op; + + private BinaryOperator(String op) { + this.op = op; + } + + @Override + public String toString() { + return this.op; + } + } + + @Override + default String getType() { + return "BinaryExpression"; //$NON-NLS-1$ + } + + public BinaryOperator getOperator(); + + public IJSExpression getLeft(); + + public IJSExpression getRight(); +} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSBlockStatement.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSBlockStatement.java index b055638f13c..08861ae2873 100644 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSBlockStatement.java +++ b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSBlockStatement.java @@ -1,26 +1,26 @@ -/******************************************************************************* - * Copyright (c) 2015 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.qt.core.qmljs; - -import java.util.List; - -/** - * A JavaScript block statement from the ESTree - * Specification - */ -public interface IJSBlockStatement extends IJSStatement { - @Override - default String getType() { - return "BlockStatement"; //$NON-NLS-1$ - } - - public List getBody(); -} +/******************************************************************************* + * Copyright (c) 2015 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.qt.core.qmljs; + +import java.util.List; + +/** + * A JavaScript block statement from the ESTree + * Specification + */ +public interface IJSBlockStatement extends IJSStatement { + @Override + default String getType() { + return "BlockStatement"; //$NON-NLS-1$ + } + + public List getBody(); +} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSBreakStatement.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSBreakStatement.java index 4dbf9fbbfdf..9242b1706ae 100644 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSBreakStatement.java +++ b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSBreakStatement.java @@ -1,24 +1,24 @@ -/******************************************************************************* - * Copyright (c) 2015 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.qt.core.qmljs; - -/** - * A JavaScript break statement from the ESTree - * Specification - */ -public interface IJSBreakStatement extends IJSStatement { - @Override - default String getType() { - return "BreakStatement"; //$NON-NLS-1$ - } - - public IJSIdentifier getLabel(); -} +/******************************************************************************* + * Copyright (c) 2015 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.qt.core.qmljs; + +/** + * A JavaScript break statement from the ESTree + * Specification + */ +public interface IJSBreakStatement extends IJSStatement { + @Override + default String getType() { + return "BreakStatement"; //$NON-NLS-1$ + } + + public IJSIdentifier getLabel(); +} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSCallExpression.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSCallExpression.java index dc534d9a917..c835dab9d6c 100644 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSCallExpression.java +++ b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSCallExpression.java @@ -1,28 +1,28 @@ -/******************************************************************************* - * Copyright (c) 2015 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.qt.core.qmljs; - -import java.util.List; - -/** - * A JavaScript call expression from the ESTree - * Specification - */ -public interface IJSCallExpression extends IJSExpression { - @Override - default String getType() { - return "CallExpression"; //$NON-NLS-1$ - } - - public IJSExpression getCallee(); - - public List getArguments(); -} +/******************************************************************************* + * Copyright (c) 2015 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.qt.core.qmljs; + +import java.util.List; + +/** + * A JavaScript call expression from the ESTree + * Specification + */ +public interface IJSCallExpression extends IJSExpression { + @Override + default String getType() { + return "CallExpression"; //$NON-NLS-1$ + } + + public IJSExpression getCallee(); + + public List getArguments(); +} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSCatchClause.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSCatchClause.java index 68d6076c6c4..6232f46f882 100644 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSCatchClause.java +++ b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSCatchClause.java @@ -1,26 +1,26 @@ -/******************************************************************************* - * Copyright (c) 2015 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.qt.core.qmljs; - -/** - * A JavaScript catch clause from the ESTree - * Specification - */ -public interface IJSCatchClause extends IQmlASTNode { - @Override - default String getType() { - return "CatchClause"; //$NON-NLS-1$ - } - - public IJSPattern getParam(); - - public IJSBlockStatement getBody(); -} +/******************************************************************************* + * Copyright (c) 2015 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.qt.core.qmljs; + +/** + * A JavaScript catch clause from the ESTree + * Specification + */ +public interface IJSCatchClause extends IQmlASTNode { + @Override + default String getType() { + return "CatchClause"; //$NON-NLS-1$ + } + + public IJSPattern getParam(); + + public IJSBlockStatement getBody(); +} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSConditionalExpression.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSConditionalExpression.java index 385f85404ac..bf3ba3df3cf 100644 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSConditionalExpression.java +++ b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSConditionalExpression.java @@ -1,28 +1,28 @@ -/******************************************************************************* - * Copyright (c) 2015 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.qt.core.qmljs; - -/** - * A JavaScript conditional expression from the - * ESTree Specification - */ -public interface IJSConditionalExpression extends IJSExpression { - @Override - default String getType() { - return "ConditionalExpression"; //$NON-NLS-1$ - } - - public IJSExpression getTest(); - - public IJSExpression getAlternate(); - - public IJSExpression getConsequent(); -} +/******************************************************************************* + * Copyright (c) 2015 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.qt.core.qmljs; + +/** + * A JavaScript conditional expression from the + * ESTree Specification + */ +public interface IJSConditionalExpression extends IJSExpression { + @Override + default String getType() { + return "ConditionalExpression"; //$NON-NLS-1$ + } + + public IJSExpression getTest(); + + public IJSExpression getAlternate(); + + public IJSExpression getConsequent(); +} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSContinueStatement.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSContinueStatement.java index 3943169e5ab..26f8cb5328b 100644 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSContinueStatement.java +++ b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSContinueStatement.java @@ -1,24 +1,24 @@ -/******************************************************************************* - * Copyright (c) 2015 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.qt.core.qmljs; - -/** - * A JavaScript continue statement from the ESTree - * Specification - */ -public interface IJSContinueStatement extends IJSStatement { - @Override - default String getType() { - return "ContinueStatement"; //$NON-NLS-1$ - } - - public IJSIdentifier getLabel(); -} +/******************************************************************************* + * Copyright (c) 2015 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.qt.core.qmljs; + +/** + * A JavaScript continue statement from the ESTree + * Specification + */ +public interface IJSContinueStatement extends IJSStatement { + @Override + default String getType() { + return "ContinueStatement"; //$NON-NLS-1$ + } + + public IJSIdentifier getLabel(); +} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSDebuggerStatement.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSDebuggerStatement.java index 74ac14b6a0d..293ffec779d 100644 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSDebuggerStatement.java +++ b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSDebuggerStatement.java @@ -1,22 +1,22 @@ -/******************************************************************************* - * Copyright (c) 2015 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.qt.core.qmljs; - -/** - * A JavaScript debugger statement from the ESTree - * Specification - */ -public interface IJSDebuggerStatement extends IJSStatement { - @Override - default String getType() { - return "DebuggerStatement"; //$NON-NLS-1$ - } -} +/******************************************************************************* + * Copyright (c) 2015 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.qt.core.qmljs; + +/** + * A JavaScript debugger statement from the ESTree + * Specification + */ +public interface IJSDebuggerStatement extends IJSStatement { + @Override + default String getType() { + return "DebuggerStatement"; //$NON-NLS-1$ + } +} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSDeclaration.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSDeclaration.java index 8a03246a8dc..b0fd10c6f3b 100644 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSDeclaration.java +++ b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSDeclaration.java @@ -1,18 +1,18 @@ -/******************************************************************************* - * Copyright (c) 2015 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.qt.core.qmljs; - -/** - * A JavaScript declaration from the ESTree - * Specification - */ -public interface IJSDeclaration extends IJSStatement { -} +/******************************************************************************* + * Copyright (c) 2015 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.qt.core.qmljs; + +/** + * A JavaScript declaration from the ESTree + * Specification + */ +public interface IJSDeclaration extends IJSStatement { +} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSDoWhileStatement.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSDoWhileStatement.java index ac2a1cf916e..f21ed0a30c1 100644 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSDoWhileStatement.java +++ b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSDoWhileStatement.java @@ -1,26 +1,26 @@ -/******************************************************************************* - * Copyright (c) 2015 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.qt.core.qmljs; - -/** - * A JavaScript do while statement from the ESTree - * Specification - */ -public interface IJSDoWhileStatement extends IJSStatement { - @Override - default String getType() { - return "DoWhileStatement"; //$NON-NLS-1$ - } - - public IJSExpression getTest(); - - public IJSStatement getBody(); -} +/******************************************************************************* + * Copyright (c) 2015 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.qt.core.qmljs; + +/** + * A JavaScript do while statement from the ESTree + * Specification + */ +public interface IJSDoWhileStatement extends IJSStatement { + @Override + default String getType() { + return "DoWhileStatement"; //$NON-NLS-1$ + } + + public IJSExpression getTest(); + + public IJSStatement getBody(); +} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSEmptyStatement.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSEmptyStatement.java index fa6b54597e9..55e806696be 100644 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSEmptyStatement.java +++ b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSEmptyStatement.java @@ -1,22 +1,22 @@ -/******************************************************************************* - * Copyright (c) 2015 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.qt.core.qmljs; - -/** - * An empty JavaScrit statement from the ESTree - * Specification - */ -public interface IJSEmptyStatement extends IJSStatement { - @Override - default String getType() { - return "EmptyStatement"; //$NON-NLS-1$ - } -} +/******************************************************************************* + * Copyright (c) 2015 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.qt.core.qmljs; + +/** + * An empty JavaScrit statement from the ESTree + * Specification + */ +public interface IJSEmptyStatement extends IJSStatement { + @Override + default String getType() { + return "EmptyStatement"; //$NON-NLS-1$ + } +} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSExpression.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSExpression.java index 8f1f70e5557..3154196c360 100644 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSExpression.java +++ b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSExpression.java @@ -1,18 +1,18 @@ -/******************************************************************************* - * Copyright (c) 2015 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.qt.core.qmljs; - -/** - * A JavaScript expression from the ESTree - * Specification - */ -public interface IJSExpression extends IQmlASTNode { -} +/******************************************************************************* + * Copyright (c) 2015 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.qt.core.qmljs; + +/** + * A JavaScript expression from the ESTree + * Specification + */ +public interface IJSExpression extends IQmlASTNode { +} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSExpressionStatement.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSExpressionStatement.java index 988dba7ef28..c51fa3e8c98 100644 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSExpressionStatement.java +++ b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSExpressionStatement.java @@ -1,24 +1,24 @@ -/******************************************************************************* - * Copyright (c) 2015 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.qt.core.qmljs; - -/** - * A JavaScript expression statement from the - * ESTree Specification - */ -public interface IJSExpressionStatement extends IJSStatement { - @Override - default String getType() { - return "ExpressionStatement"; //$NON-NLS-1$ - } - - public IJSExpression getExpression(); -} +/******************************************************************************* + * Copyright (c) 2015 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.qt.core.qmljs; + +/** + * A JavaScript expression statement from the + * ESTree Specification + */ +public interface IJSExpressionStatement extends IJSStatement { + @Override + default String getType() { + return "ExpressionStatement"; //$NON-NLS-1$ + } + + public IJSExpression getExpression(); +} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSForInStatement.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSForInStatement.java index d113f2ae136..b2767bed6de 100644 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSForInStatement.java +++ b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSForInStatement.java @@ -1,31 +1,31 @@ -/******************************************************************************* - * Copyright (c) 2015 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.qt.core.qmljs; - -/** - * A JavaScript for in statement from the ESTree - * Specification - */ -public interface IJSForInStatement extends IJSStatement { - @Override - default String getType() { - return "ForInStatement"; //$NON-NLS-1$ - } - - /** - * @return {@link IJSVariableDeclaration}, or {@link IJSExpression} - */ - public IQmlASTNode getRight(); - - public IJSExpression getLeft(); - - public IJSStatement getBody(); -} +/******************************************************************************* + * Copyright (c) 2015 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.qt.core.qmljs; + +/** + * A JavaScript for in statement from the ESTree + * Specification + */ +public interface IJSForInStatement extends IJSStatement { + @Override + default String getType() { + return "ForInStatement"; //$NON-NLS-1$ + } + + /** + * @return {@link IJSVariableDeclaration}, or {@link IJSExpression} + */ + public IQmlASTNode getRight(); + + public IJSExpression getLeft(); + + public IJSStatement getBody(); +} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSForStatement.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSForStatement.java index 7686b10bf03..fe239336c83 100644 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSForStatement.java +++ b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSForStatement.java @@ -1,33 +1,33 @@ -/******************************************************************************* - * Copyright (c) 2015 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.qt.core.qmljs; - -/** - * A JavaScript for statement from the ESTree - * Specification - */ -public interface IJSForStatement extends IJSStatement { - @Override - default String getType() { - return "ForStatement"; //$NON-NLS-1$ - } - - /** - * @return {@link IJSVariableDeclaration}, {@link IJSExpression}, or null - */ - public IQmlASTNode getInit(); - - public IJSExpression getTest(); - - public IJSExpression getUpdate(); - - public IJSStatement getBody(); -} +/******************************************************************************* + * Copyright (c) 2015 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.qt.core.qmljs; + +/** + * A JavaScript for statement from the ESTree + * Specification + */ +public interface IJSForStatement extends IJSStatement { + @Override + default String getType() { + return "ForStatement"; //$NON-NLS-1$ + } + + /** + * @return {@link IJSVariableDeclaration}, {@link IJSExpression}, or null + */ + public IQmlASTNode getInit(); + + public IJSExpression getTest(); + + public IJSExpression getUpdate(); + + public IJSStatement getBody(); +} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSFunction.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSFunction.java index 3cd8224bead..6e2e7e0ec16 100644 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSFunction.java +++ b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSFunction.java @@ -1,24 +1,24 @@ -/******************************************************************************* - * Copyright (c) 2015 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.qt.core.qmljs; - -import java.util.List; - -/** - * A JavaScript function from the ESTree Specification - */ -public interface IJSFunction extends IQmlASTNode { - public IJSIdentifier getIdentifier(); - - public List getParams(); - - public IJSBlockStatement getBody(); -} +/******************************************************************************* + * Copyright (c) 2015 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.qt.core.qmljs; + +import java.util.List; + +/** + * A JavaScript function from the ESTree Specification + */ +public interface IJSFunction extends IQmlASTNode { + public IJSIdentifier getIdentifier(); + + public List getParams(); + + public IJSBlockStatement getBody(); +} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSFunctionDeclaration.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSFunctionDeclaration.java index e0dae44c456..a68d6d3c376 100644 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSFunctionDeclaration.java +++ b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSFunctionDeclaration.java @@ -1,25 +1,25 @@ -/******************************************************************************* - * Copyright (c) 2015 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.qt.core.qmljs; - -/** - * A JavaScript function declaration from the - * ESTree Specification - */ -public interface IJSFunctionDeclaration extends IJSFunction, IJSDeclaration, IQmlObjectMember { - @Override - default String getType() { - return "FunctionDeclaration"; //$NON-NLS-1$ - } - - @Override - public IJSIdentifier getIdentifier(); -} +/******************************************************************************* + * Copyright (c) 2015 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.qt.core.qmljs; + +/** + * A JavaScript function declaration from the + * ESTree Specification + */ +public interface IJSFunctionDeclaration extends IJSFunction, IJSDeclaration, IQmlObjectMember { + @Override + default String getType() { + return "FunctionDeclaration"; //$NON-NLS-1$ + } + + @Override + public IJSIdentifier getIdentifier(); +} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSFunctionExpression.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSFunctionExpression.java index 0d196f2bdf6..31a75072427 100644 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSFunctionExpression.java +++ b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSFunctionExpression.java @@ -1,22 +1,22 @@ -/******************************************************************************* - * Copyright (c) 2015 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.qt.core.qmljs; - -/** - * A JavaScript function expression from the - * ESTree Specification - */ -public interface IJSFunctionExpression extends IJSExpression { - @Override - default String getType() { - return "FunctionExpression"; //$NON-NLS-1$ - } -} +/******************************************************************************* + * Copyright (c) 2015 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.qt.core.qmljs; + +/** + * A JavaScript function expression from the + * ESTree Specification + */ +public interface IJSFunctionExpression extends IJSExpression { + @Override + default String getType() { + return "FunctionExpression"; //$NON-NLS-1$ + } +} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSIdentifier.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSIdentifier.java index 9549c22000e..1fb4c389b17 100644 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSIdentifier.java +++ b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSIdentifier.java @@ -1,24 +1,24 @@ -/******************************************************************************* - * Copyright (c) 2015 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.qt.core.qmljs; - -/** - * A JavaScript identifier from the ESTree - * Specification - */ -public interface IJSIdentifier extends IJSExpression, IJSPattern { - @Override - default public String getType() { - return "Identifier"; //$NON-NLS-1$ - }; - - public String getName(); -} +/******************************************************************************* + * Copyright (c) 2015 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.qt.core.qmljs; + +/** + * A JavaScript identifier from the ESTree + * Specification + */ +public interface IJSIdentifier extends IJSExpression, IJSPattern { + @Override + default public String getType() { + return "Identifier"; //$NON-NLS-1$ + }; + + public String getName(); +} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSIfStatement.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSIfStatement.java index a0b58d0dd29..ece38a0bc64 100644 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSIfStatement.java +++ b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSIfStatement.java @@ -1,28 +1,28 @@ -/******************************************************************************* - * Copyright (c) 2015 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.qt.core.qmljs; - -/** - * A JavaScript if statement from the - * ESTree Specification - */ -public interface IJSIfStatement extends IJSStatement { - @Override - default String getType() { - return "IfStatement"; //$NON-NLS-1$ - } - - public IJSExpression getTest(); - - public IJSStatement getConsequence(); - - public IJSStatement getAlternate(); -} +/******************************************************************************* + * Copyright (c) 2015 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.qt.core.qmljs; + +/** + * A JavaScript if statement from the + * ESTree Specification + */ +public interface IJSIfStatement extends IJSStatement { + @Override + default String getType() { + return "IfStatement"; //$NON-NLS-1$ + } + + public IJSExpression getTest(); + + public IJSStatement getConsequence(); + + public IJSStatement getAlternate(); +} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSLabeledStatement.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSLabeledStatement.java index ddde2ea014e..ca8a20c00ec 100644 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSLabeledStatement.java +++ b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSLabeledStatement.java @@ -1,26 +1,26 @@ -/******************************************************************************* - * Copyright (c) 2015 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.qt.core.qmljs; - -/** - * A JavaScript labeled statement from the ESTree - * Specification - */ -public interface IJSLabeledStatement extends IJSStatement { - @Override - default String getType() { - return "LabledStatement"; //$NON-NLS-1$ - } - - public IJSIdentifier getLabel(); - - public IJSStatement getBody(); -} +/******************************************************************************* + * Copyright (c) 2015 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.qt.core.qmljs; + +/** + * A JavaScript labeled statement from the ESTree + * Specification + */ +public interface IJSLabeledStatement extends IJSStatement { + @Override + default String getType() { + return "LabledStatement"; //$NON-NLS-1$ + } + + public IJSIdentifier getLabel(); + + public IJSStatement getBody(); +} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSLiteral.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSLiteral.java index 2e4e2fab37a..c68ab78e640 100644 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSLiteral.java +++ b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSLiteral.java @@ -1,28 +1,28 @@ -/******************************************************************************* - * Copyright (c) 2015 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.qt.core.qmljs; - -/** - * A JavaScript literal from the ESTree Specification - */ -public interface IJSLiteral extends IJSExpression { - @Override - default public String getType() { - return "Literal"; //$NON-NLS-1$ - }; - - /** - * @return String, Boolean, Integer, Double, or Regular Expression - */ - public Object getValue(); - - public String getRaw(); -} +/******************************************************************************* + * Copyright (c) 2015 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.qt.core.qmljs; + +/** + * A JavaScript literal from the ESTree Specification + */ +public interface IJSLiteral extends IJSExpression { + @Override + default public String getType() { + return "Literal"; //$NON-NLS-1$ + }; + + /** + * @return String, Boolean, Integer, Double, or Regular Expression + */ + public Object getValue(); + + public String getRaw(); +} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSLogicalExpression.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSLogicalExpression.java index b79c83caddf..4ed414706e3 100644 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSLogicalExpression.java +++ b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSLogicalExpression.java @@ -1,58 +1,58 @@ -/******************************************************************************* - * Copyright (c) 2015 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.qt.core.qmljs; - -/** - * A JavaScript logical expression from the ESTree - * Specification - */ -public interface IJSLogicalExpression extends IJSExpression { - /** - * An Enumeration covering the two logical operators in JavaScript - */ - enum LogicalOperator { - Or("||"), //$NON-NLS-1$ - And("&&"); //$NON-NLS-1$ - - public static LogicalOperator fromObject(Object obj) { - if (obj instanceof String) { - for (LogicalOperator op : LogicalOperator.values()) { - if (obj.equals(op.toString())) { - return op; - } - } - } - return null; - } - - private final String op; - - private LogicalOperator(String op) { - this.op = op; - } - - @Override - public String toString() { - return this.op; - } - } - - @Override - default String getType() { - return "LogicalExpression"; //$NON-NLS-1$ - } - - public LogicalOperator getOperator(); - - public IJSExpression getLeft(); - - public IJSExpression getRight(); -} +/******************************************************************************* + * Copyright (c) 2015 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.qt.core.qmljs; + +/** + * A JavaScript logical expression from the ESTree + * Specification + */ +public interface IJSLogicalExpression extends IJSExpression { + /** + * An Enumeration covering the two logical operators in JavaScript + */ + enum LogicalOperator { + Or("||"), //$NON-NLS-1$ + And("&&"); //$NON-NLS-1$ + + public static LogicalOperator fromObject(Object obj) { + if (obj instanceof String) { + for (LogicalOperator op : LogicalOperator.values()) { + if (obj.equals(op.toString())) { + return op; + } + } + } + return null; + } + + private final String op; + + private LogicalOperator(String op) { + this.op = op; + } + + @Override + public String toString() { + return this.op; + } + } + + @Override + default String getType() { + return "LogicalExpression"; //$NON-NLS-1$ + } + + public LogicalOperator getOperator(); + + public IJSExpression getLeft(); + + public IJSExpression getRight(); +} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSMemberExpression.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSMemberExpression.java index bc7b4d1d859..bc29a6c8e47 100644 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSMemberExpression.java +++ b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSMemberExpression.java @@ -1,28 +1,28 @@ -/******************************************************************************* - * Copyright (c) 2015 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.qt.core.qmljs; - -/** - * A JavaScript member expression from the ESTree - * Specification - */ -public interface IJSMemberExpression extends IJSExpression { - @Override - default String getType() { - return "MemberExpression"; //$NON-NLS-1$ - } - - public IJSExpression getOjbect(); - - public IJSExpression getProperty(); - - public boolean isComputed(); -} +/******************************************************************************* + * Copyright (c) 2015 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.qt.core.qmljs; + +/** + * A JavaScript member expression from the ESTree + * Specification + */ +public interface IJSMemberExpression extends IJSExpression { + @Override + default String getType() { + return "MemberExpression"; //$NON-NLS-1$ + } + + public IJSExpression getOjbect(); + + public IJSExpression getProperty(); + + public boolean isComputed(); +} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSNewExpression.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSNewExpression.java index b23f20cac0a..ea6c67a5649 100644 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSNewExpression.java +++ b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSNewExpression.java @@ -1,22 +1,22 @@ -/******************************************************************************* - * Copyright (c) 2015 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.qt.core.qmljs; - -/** - * A JavaScript new expression from the ESTree - * Specification - */ -public interface IJSNewExpression extends IJSCallExpression { - @Override - default String getType() { - return "NewExpression"; //$NON-NLS-1$ - } -} +/******************************************************************************* + * Copyright (c) 2015 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.qt.core.qmljs; + +/** + * A JavaScript new expression from the ESTree + * Specification + */ +public interface IJSNewExpression extends IJSCallExpression { + @Override + default String getType() { + return "NewExpression"; //$NON-NLS-1$ + } +} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSObjectExpression.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSObjectExpression.java index 997c437e87a..a481834ee36 100644 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSObjectExpression.java +++ b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSObjectExpression.java @@ -1,26 +1,26 @@ -/******************************************************************************* - * Copyright (c) 2015 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.qt.core.qmljs; - -import java.util.List; - -/** - * A JavaScript object expression from the ESTree - * Specification - */ -public interface IJSObjectExpression extends IJSExpression { - @Override - default String getType() { - return "ObjectExpression"; //$NON-NLS-1$ - } - - public List getProperties(); -} +/******************************************************************************* + * Copyright (c) 2015 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.qt.core.qmljs; + +import java.util.List; + +/** + * A JavaScript object expression from the ESTree + * Specification + */ +public interface IJSObjectExpression extends IJSExpression { + @Override + default String getType() { + return "ObjectExpression"; //$NON-NLS-1$ + } + + public List getProperties(); +} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSPattern.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSPattern.java index 83930954d54..9918113f17c 100644 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSPattern.java +++ b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSPattern.java @@ -1,17 +1,17 @@ -/******************************************************************************* - * Copyright (c) 2015 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.qt.core.qmljs; - -/** - * A JavaScript pattern from the ESTree Specification - */ -public interface IJSPattern extends IQmlASTNode { -} +/******************************************************************************* + * Copyright (c) 2015 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.qt.core.qmljs; + +/** + * A JavaScript pattern from the ESTree Specification + */ +public interface IJSPattern extends IQmlASTNode { +} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSProgram.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSProgram.java index 105e69d331a..a7a7fafdc4f 100644 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSProgram.java +++ b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSProgram.java @@ -1,25 +1,25 @@ -/******************************************************************************* - * Copyright (c) 2015 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.qt.core.qmljs; - -import java.util.List; - -/** - * A JavaScript program from the ESTree Specification - */ -public interface IJSProgram extends IQmlASTNode { - @Override - default String getType() { - return "Program"; //$NON-NLS-1$ - } - - public List getBody(); -} +/******************************************************************************* + * Copyright (c) 2015 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.qt.core.qmljs; + +import java.util.List; + +/** + * A JavaScript program from the ESTree Specification + */ +public interface IJSProgram extends IQmlASTNode { + @Override + default String getType() { + return "Program"; //$NON-NLS-1$ + } + + public List getBody(); +} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSProperty.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSProperty.java index d8d20ba0028..b5b1d8438ae 100644 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSProperty.java +++ b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSProperty.java @@ -1,31 +1,31 @@ -/******************************************************************************* - * Copyright (c) 2015 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.qt.core.qmljs; - -/** - * A JavaScript object property from the ESTree - * Specification - */ -public interface IJSProperty extends IQmlASTNode { - @Override - default String getType() { - return "Property"; //$NON-NLS-1$ - } - - /** - * @return {@link IJSLiteral}, or {@link IJSIdentifier} - */ - public IQmlASTNode getKey(); - - public IJSExpression getValue(); - - public String getKind(); -} +/******************************************************************************* + * Copyright (c) 2015 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.qt.core.qmljs; + +/** + * A JavaScript object property from the ESTree + * Specification + */ +public interface IJSProperty extends IQmlASTNode { + @Override + default String getType() { + return "Property"; //$NON-NLS-1$ + } + + /** + * @return {@link IJSLiteral}, or {@link IJSIdentifier} + */ + public IQmlASTNode getKey(); + + public IJSExpression getValue(); + + public String getKind(); +} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSRegExpLiteral.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSRegExpLiteral.java index 304d7e2bb46..942790564fe 100644 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSRegExpLiteral.java +++ b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSRegExpLiteral.java @@ -1,40 +1,40 @@ -/******************************************************************************* - * Copyright (c) 2015 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.qt.core.qmljs; - -/** - * A JavaScript regular expression literal from the - * ESTree Specification - */ -public interface IJSRegExpLiteral extends IJSLiteral { - /** - * A JavaScript regular expression that holds a pattern and a set of flags. Both are represented as plain Strings. - */ - public static class JSRegExp { - private final String pattern; - private final String flags; - - public JSRegExp(String pattern, String flags) { - this.pattern = pattern; - this.flags = flags; - } - - public String getPattern() { - return pattern; - } - - public String getFlags() { - return flags; - } - } - - public JSRegExp getRegex(); -} +/******************************************************************************* + * Copyright (c) 2015 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.qt.core.qmljs; + +/** + * A JavaScript regular expression literal from the + * ESTree Specification + */ +public interface IJSRegExpLiteral extends IJSLiteral { + /** + * A JavaScript regular expression that holds a pattern and a set of flags. Both are represented as plain Strings. + */ + public static class JSRegExp { + private final String pattern; + private final String flags; + + public JSRegExp(String pattern, String flags) { + this.pattern = pattern; + this.flags = flags; + } + + public String getPattern() { + return pattern; + } + + public String getFlags() { + return flags; + } + } + + public JSRegExp getRegex(); +} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSReturnStatement.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSReturnStatement.java index 6b6c58e553c..9276b25f418 100644 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSReturnStatement.java +++ b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSReturnStatement.java @@ -1,24 +1,24 @@ -/******************************************************************************* - * Copyright (c) 2015 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.qt.core.qmljs; - -/** - * A JavaScript return statement from the ESTree - * Specification - */ -public interface IJSReturnStatement extends IJSStatement { - @Override - default String getType() { - return "ReturnStatement"; //$NON-NLS-1$ - } - - public IJSExpression getArgument(); -} +/******************************************************************************* + * Copyright (c) 2015 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.qt.core.qmljs; + +/** + * A JavaScript return statement from the ESTree + * Specification + */ +public interface IJSReturnStatement extends IJSStatement { + @Override + default String getType() { + return "ReturnStatement"; //$NON-NLS-1$ + } + + public IJSExpression getArgument(); +} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSSequenceExpression.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSSequenceExpression.java index 4cdd2baa9e1..8241ace5970 100644 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSSequenceExpression.java +++ b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSSequenceExpression.java @@ -1,26 +1,26 @@ -/******************************************************************************* - * Copyright (c) 2015 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.qt.core.qmljs; - -import java.util.List; - -/** - * A JavaScript sequence expression from the - * ESTree Specification - */ -public interface IJSSequenceExpression extends IJSExpression { - @Override - default String getType() { - return "SequenceExpression"; //$NON-NLS-1$ - } - - public List getExpressions(); -} +/******************************************************************************* + * Copyright (c) 2015 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.qt.core.qmljs; + +import java.util.List; + +/** + * A JavaScript sequence expression from the + * ESTree Specification + */ +public interface IJSSequenceExpression extends IJSExpression { + @Override + default String getType() { + return "SequenceExpression"; //$NON-NLS-1$ + } + + public List getExpressions(); +} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSStatement.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSStatement.java index a2617e3c939..937c5335c77 100644 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSStatement.java +++ b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSStatement.java @@ -1,18 +1,18 @@ -/******************************************************************************* - * Copyright (c) 2015 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.qt.core.qmljs; - -/** - * A JavaScript statement from the ESTree - * Specification - */ -public interface IJSStatement extends IQmlASTNode { -} +/******************************************************************************* + * Copyright (c) 2015 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.qt.core.qmljs; + +/** + * A JavaScript statement from the ESTree + * Specification + */ +public interface IJSStatement extends IQmlASTNode { +} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSSwitchCase.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSSwitchCase.java index 6247a01d4e9..3fd8b5d2e36 100644 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSSwitchCase.java +++ b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSSwitchCase.java @@ -1,28 +1,28 @@ -/******************************************************************************* - * Copyright (c) 2015 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.qt.core.qmljs; - -import java.util.List; - -/** - * A JavaScript switch case from the ESTree - * Specification - */ -public interface IJSSwitchCase extends IQmlASTNode { - @Override - default String getType() { - return "SwitchCase"; //$NON-NLS-1$ - } - - public IJSExpression getTest(); - - public List getConsequent(); -} +/******************************************************************************* + * Copyright (c) 2015 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.qt.core.qmljs; + +import java.util.List; + +/** + * A JavaScript switch case from the ESTree + * Specification + */ +public interface IJSSwitchCase extends IQmlASTNode { + @Override + default String getType() { + return "SwitchCase"; //$NON-NLS-1$ + } + + public IJSExpression getTest(); + + public List getConsequent(); +} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSSwitchStatement.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSSwitchStatement.java index 9c0ca91a98f..024784b8a6e 100644 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSSwitchStatement.java +++ b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSSwitchStatement.java @@ -1,26 +1,26 @@ -/******************************************************************************* - * Copyright (c) 2015 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.qt.core.qmljs; - -/** - * A JavaScript switch statement from the ESTree - * Specification - */ -public interface IJSSwitchStatement extends IJSStatement { - @Override - default String getType() { - return "SwitchStatement"; //$NON-NLS-1$ - } - - public IJSExpression getDiscriminant(); - - public IJSSwitchCase getCases(); -} +/******************************************************************************* + * Copyright (c) 2015 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.qt.core.qmljs; + +/** + * A JavaScript switch statement from the ESTree + * Specification + */ +public interface IJSSwitchStatement extends IJSStatement { + @Override + default String getType() { + return "SwitchStatement"; //$NON-NLS-1$ + } + + public IJSExpression getDiscriminant(); + + public IJSSwitchCase getCases(); +} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSThisExpression.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSThisExpression.java index 1cc3fbe1b6c..3e6d4535630 100644 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSThisExpression.java +++ b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSThisExpression.java @@ -1,22 +1,22 @@ -/******************************************************************************* - * Copyright (c) 2015 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.qt.core.qmljs; - -/** - * A JavaScript this expression from the ESTree - * Specification - */ -public interface IJSThisExpression extends IJSExpression { - @Override - default String getType() { - return "ThisExpression"; //$NON-NLS-1$ - } -} +/******************************************************************************* + * Copyright (c) 2015 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.qt.core.qmljs; + +/** + * A JavaScript this expression from the ESTree + * Specification + */ +public interface IJSThisExpression extends IJSExpression { + @Override + default String getType() { + return "ThisExpression"; //$NON-NLS-1$ + } +} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSThrowStatement.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSThrowStatement.java index f3ddf6e1022..86489618d03 100644 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSThrowStatement.java +++ b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSThrowStatement.java @@ -1,24 +1,24 @@ -/******************************************************************************* - * Copyright (c) 2015 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.qt.core.qmljs; - -/** - * A JavaScript throw statement from the ESTree - * Specification - */ -public interface IJSThrowStatement extends IJSStatement { - @Override - default String getType() { - return "ThrowStatement"; //$NON-NLS-1$ - } - - public IJSExpression getArgument(); -} +/******************************************************************************* + * Copyright (c) 2015 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.qt.core.qmljs; + +/** + * A JavaScript throw statement from the ESTree + * Specification + */ +public interface IJSThrowStatement extends IJSStatement { + @Override + default String getType() { + return "ThrowStatement"; //$NON-NLS-1$ + } + + public IJSExpression getArgument(); +} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSTryStatement.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSTryStatement.java index a89fede7b49..0c10968bb59 100644 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSTryStatement.java +++ b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSTryStatement.java @@ -1,28 +1,28 @@ -/******************************************************************************* - * Copyright (c) 2015 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.qt.core.qmljs; - -/** - * A JavaScript try statement from the ESTree - * Specification - */ -public interface IJSTryStatement extends IJSStatement { - @Override - default String getType() { - return "TryStatement"; //$NON-NLS-1$ - } - - public IJSBlockStatement getBlock(); - - public IJSCatchClause getHandler(); - - public IJSBlockStatement getFinalizer(); -} +/******************************************************************************* + * Copyright (c) 2015 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.qt.core.qmljs; + +/** + * A JavaScript try statement from the ESTree + * Specification + */ +public interface IJSTryStatement extends IJSStatement { + @Override + default String getType() { + return "TryStatement"; //$NON-NLS-1$ + } + + public IJSBlockStatement getBlock(); + + public IJSCatchClause getHandler(); + + public IJSBlockStatement getFinalizer(); +} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSUnaryExpression.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSUnaryExpression.java index 389a2a7f8bc..87924083976 100644 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSUnaryExpression.java +++ b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSUnaryExpression.java @@ -1,63 +1,63 @@ -/******************************************************************************* - * Copyright (c) 2015 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.qt.core.qmljs; - -/** - * A JavaScript unary expression from the ESTree - * Specification - */ -public interface IJSUnaryExpression extends IJSExpression { - /** - * An Enumeration covering the 7 unary operators in JavaScript - */ - enum UnaryOperator { - Negation("-"), //$NON-NLS-1$ - Plus("+"), //$NON-NLS-1$ - Not("!"), //$NON-NLS-1$ - BitwiseNot("~"), //$NON-NLS-1$ - Typeof("typeof"), //$NON-NLS-1$ - Void("void"), //$NON-NLS-1$ - Delete("delete"); //$NON-NLS-1$ - - public static UnaryOperator fromObject(Object obj) { - if (obj instanceof String) { - for (UnaryOperator op : UnaryOperator.values()) { - if (obj.equals(op.toString())) { - return op; - } - } - } - return null; - } - - private final String op; - - private UnaryOperator(String op) { - this.op = op; - } - - @Override - public String toString() { - return this.op; - } - } - - @Override - default String getType() { - return "UnaryExpression"; //$NON-NLS-1$ - } - - public UnaryOperator getOperator(); - - public boolean isPrefix(); - - public IJSExpression getArgument(); -} +/******************************************************************************* + * Copyright (c) 2015 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.qt.core.qmljs; + +/** + * A JavaScript unary expression from the ESTree + * Specification + */ +public interface IJSUnaryExpression extends IJSExpression { + /** + * An Enumeration covering the 7 unary operators in JavaScript + */ + enum UnaryOperator { + Negation("-"), //$NON-NLS-1$ + Plus("+"), //$NON-NLS-1$ + Not("!"), //$NON-NLS-1$ + BitwiseNot("~"), //$NON-NLS-1$ + Typeof("typeof"), //$NON-NLS-1$ + Void("void"), //$NON-NLS-1$ + Delete("delete"); //$NON-NLS-1$ + + public static UnaryOperator fromObject(Object obj) { + if (obj instanceof String) { + for (UnaryOperator op : UnaryOperator.values()) { + if (obj.equals(op.toString())) { + return op; + } + } + } + return null; + } + + private final String op; + + private UnaryOperator(String op) { + this.op = op; + } + + @Override + public String toString() { + return this.op; + } + } + + @Override + default String getType() { + return "UnaryExpression"; //$NON-NLS-1$ + } + + public UnaryOperator getOperator(); + + public boolean isPrefix(); + + public IJSExpression getArgument(); +} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSUpdateExpression.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSUpdateExpression.java index 3a771f7fdc7..ca4c0aa4731 100644 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSUpdateExpression.java +++ b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSUpdateExpression.java @@ -1,58 +1,58 @@ -/******************************************************************************* - * Copyright (c) 2015 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.qt.core.qmljs; - -/** - * A JavaScript update expression from the ESTree - * Specification - */ -public interface IJSUpdateExpression extends IQmlASTNode { - /** - * An Enumeration covering the two update operators in JavaScript - */ - enum UpdateOperator { - Decrement("--"), //$NON-NLS-1$ - Increment("++"); //$NON-NLS-1$ - - public static UpdateOperator fromObject(Object obj) { - if (obj instanceof String) { - for (UpdateOperator op : UpdateOperator.values()) { - if (obj.equals(op.toString())) { - return op; - } - } - } - return null; - } - - private final String op; - - private UpdateOperator(String op) { - this.op = op; - } - - @Override - public String toString() { - return this.op; - } - } - - @Override - default String getType() { - return "UpdateExpression"; //$NON-NLS-1$ - } - - public UpdateOperator getOperator(); - - public IJSExpression getArgument(); - - public boolean isPrefix(); -} +/******************************************************************************* + * Copyright (c) 2015 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.qt.core.qmljs; + +/** + * A JavaScript update expression from the ESTree + * Specification + */ +public interface IJSUpdateExpression extends IQmlASTNode { + /** + * An Enumeration covering the two update operators in JavaScript + */ + enum UpdateOperator { + Decrement("--"), //$NON-NLS-1$ + Increment("++"); //$NON-NLS-1$ + + public static UpdateOperator fromObject(Object obj) { + if (obj instanceof String) { + for (UpdateOperator op : UpdateOperator.values()) { + if (obj.equals(op.toString())) { + return op; + } + } + } + return null; + } + + private final String op; + + private UpdateOperator(String op) { + this.op = op; + } + + @Override + public String toString() { + return this.op; + } + } + + @Override + default String getType() { + return "UpdateExpression"; //$NON-NLS-1$ + } + + public UpdateOperator getOperator(); + + public IJSExpression getArgument(); + + public boolean isPrefix(); +} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSVariableDeclaration.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSVariableDeclaration.java index ec35a257ce5..ab36873bfed 100644 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSVariableDeclaration.java +++ b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSVariableDeclaration.java @@ -1,30 +1,30 @@ -/******************************************************************************* - * Copyright (c) 2015 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.qt.core.qmljs; - -import java.util.List; - -/** - * A JavaScript variable declaration from the - * ESTree Specification - */ -public interface IJSVariableDeclaration extends IJSDeclaration { - @Override - default String getType() { - return "VariableDeclaration"; //$NON-NLS-1$ - } - - public List getDeclarations(); - - default public String getKind() { - return "var"; //$NON-NLS-1$ - } -} +/******************************************************************************* + * Copyright (c) 2015 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.qt.core.qmljs; + +import java.util.List; + +/** + * A JavaScript variable declaration from the + * ESTree Specification + */ +public interface IJSVariableDeclaration extends IJSDeclaration { + @Override + default String getType() { + return "VariableDeclaration"; //$NON-NLS-1$ + } + + public List getDeclarations(); + + default public String getKind() { + return "var"; //$NON-NLS-1$ + } +} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSVariableDeclarator.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSVariableDeclarator.java index 93b81adbbdd..711a8759ddd 100644 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSVariableDeclarator.java +++ b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSVariableDeclarator.java @@ -1,26 +1,26 @@ -/******************************************************************************* - * Copyright (c) 2015 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.qt.core.qmljs; - -/** - * A JavaScript variable declarator from the - * ESTree Specification - */ -public interface IJSVariableDeclarator extends IQmlASTNode { - @Override - default String getType() { - return "VariableDeclarator"; //$NON-NLS-1$ - } - - public IJSPattern getIdentifier(); - - public IJSExpression getInit(); -} +/******************************************************************************* + * Copyright (c) 2015 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.qt.core.qmljs; + +/** + * A JavaScript variable declarator from the + * ESTree Specification + */ +public interface IJSVariableDeclarator extends IQmlASTNode { + @Override + default String getType() { + return "VariableDeclarator"; //$NON-NLS-1$ + } + + public IJSPattern getIdentifier(); + + public IJSExpression getInit(); +} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSWhileStatement.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSWhileStatement.java index 4b1393aca3b..54b0fef967d 100644 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSWhileStatement.java +++ b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSWhileStatement.java @@ -1,26 +1,26 @@ -/******************************************************************************* - * Copyright (c) 2015 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.qt.core.qmljs; - -/** - * A JavaScript while statement from the ESTree - * Specification - */ -public interface IJSWhileStatement extends IJSStatement { - @Override - default String getType() { - return "WhileStatement"; //$NON-NLS-1$ - } - - public IJSExpression getTest(); - - public IJSStatement getBody(); -} +/******************************************************************************* + * Copyright (c) 2015 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.qt.core.qmljs; + +/** + * A JavaScript while statement from the ESTree + * Specification + */ +public interface IJSWhileStatement extends IJSStatement { + @Override + default String getType() { + return "WhileStatement"; //$NON-NLS-1$ + } + + public IJSExpression getTest(); + + public IJSStatement getBody(); +} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSWithStatement.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSWithStatement.java index 1e1586b7b2c..464f27f53cb 100644 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSWithStatement.java +++ b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IJSWithStatement.java @@ -1,26 +1,26 @@ -/******************************************************************************* - * Copyright (c) 2015 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.qt.core.qmljs; - -/** - * A JavaScript with statement from the ESTree - * Specification - */ -public interface IJSWithStatement extends IJSStatement { - @Override - default String getType() { - return "WithStatement"; //$NON-NLS-1$ - } - - public IJSExpression getObject(); - - public IJSStatement getBody(); -} +/******************************************************************************* + * Copyright (c) 2015 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.qt.core.qmljs; + +/** + * A JavaScript with statement from the ESTree + * Specification + */ +public interface IJSWithStatement extends IJSStatement { + @Override + default String getType() { + return "WithStatement"; //$NON-NLS-1$ + } + + public IJSExpression getObject(); + + public IJSStatement getBody(); +} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IQmlASTNode.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IQmlASTNode.java index 3e85efee2b2..e71869e4e04 100644 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IQmlASTNode.java +++ b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IQmlASTNode.java @@ -1,80 +1,80 @@ -/******************************************************************************* - * Copyright (c) 2015 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.qt.core.qmljs; - -import org.eclipse.cdt.qt.core.location.ISourceLocation; -import org.eclipse.cdt.qt.core.qmldir.IQDirASTNode; -import org.eclipse.cdt.qt.core.tern.ITernScope; - -/** - * The base node interface for all QML and JavaScript Abstract Syntax Tree elements. Conforms to the ESTree Specification as well as - * the extra features added by Acorn. - * - * @see ESTree Node Objects - */ -public interface IQmlASTNode { - - /** - * Gets the String representation of the type of AST node that this node represents. This is a bit redundant in Java with access - * to instanceof, but is provided for the sake of conforming to the ESTree Specification for node objects. - * - * @return the String representation of this node - */ - public String getType(); - - /** - * Gets a more detailed description of this node's location than {@link IQDirASTNode#getStart()} and - * {@link IQDirASTNode#getStart()}. This method allows the retrieval of line and column information in order to make output for - * syntax errors and the like more human-readable.
    - *
    - * Note: It is necessary to set the 'locations' option to true when parsing with acorn in order to use this - * method. - * - * @return the {@link ISourceLocation} representing this node's location in the source or null if not available - */ - public ISourceLocation getLocation(); - - /** - * Gets the range of this node if available. A range is an array of two integers containing the start and end offset of this - * node in that order. Like {@link IQmlASTNode#getStart()} and {@link IQmlASTNode#getEnd()}, this method returns zero-indexed - * offsets relative to the beginning of the source.
    - *
    - * Note: It is necessary to set the 'ranges' option to true when parsing with acorn in order to use this - * method. - * - * @return the range of this node or null if not available - */ - public int[] getRange(); - - /** - * Gets the zero-indexed offset indicating the start of this node relative to the beginning of the source. - * - * @return the node's start offset - */ - public int getStart(); - - /** - * Gets the zero-indexed offset indicating the end of this node relative to the beginning of the source. - * - * @return the node's end offset - */ - public int getEnd(); - - /** - * Gets the {@link ITernScope} attached to this node if one exists. This method will only return a non-null value if the AST was - * already processed by Tern. For example, if the AST was retrieved from Tern using the 'parseFile' query, then at least one of - * the AST nodes will contain a scope object. However, if the 'parseString' query was used, no static analysis will be performed - * on the parsed AST and there will be no scope objects attached to any of its nodes. - * - * @return the Tern scope or null if not available - */ - public ITernScope getScope(); -} +/******************************************************************************* + * Copyright (c) 2015 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.qt.core.qmljs; + +import org.eclipse.cdt.qt.core.location.ISourceLocation; +import org.eclipse.cdt.qt.core.qmldir.IQDirASTNode; +import org.eclipse.cdt.qt.core.tern.ITernScope; + +/** + * The base node interface for all QML and JavaScript Abstract Syntax Tree elements. Conforms to the ESTree Specification as well as + * the extra features added by Acorn. + * + * @see ESTree Node Objects + */ +public interface IQmlASTNode { + + /** + * Gets the String representation of the type of AST node that this node represents. This is a bit redundant in Java with access + * to instanceof, but is provided for the sake of conforming to the ESTree Specification for node objects. + * + * @return the String representation of this node + */ + public String getType(); + + /** + * Gets a more detailed description of this node's location than {@link IQDirASTNode#getStart()} and + * {@link IQDirASTNode#getStart()}. This method allows the retrieval of line and column information in order to make output for + * syntax errors and the like more human-readable.
    + *
    + * Note: It is necessary to set the 'locations' option to true when parsing with acorn in order to use this + * method. + * + * @return the {@link ISourceLocation} representing this node's location in the source or null if not available + */ + public ISourceLocation getLocation(); + + /** + * Gets the range of this node if available. A range is an array of two integers containing the start and end offset of this + * node in that order. Like {@link IQmlASTNode#getStart()} and {@link IQmlASTNode#getEnd()}, this method returns zero-indexed + * offsets relative to the beginning of the source.
    + *
    + * Note: It is necessary to set the 'ranges' option to true when parsing with acorn in order to use this + * method. + * + * @return the range of this node or null if not available + */ + public int[] getRange(); + + /** + * Gets the zero-indexed offset indicating the start of this node relative to the beginning of the source. + * + * @return the node's start offset + */ + public int getStart(); + + /** + * Gets the zero-indexed offset indicating the end of this node relative to the beginning of the source. + * + * @return the node's end offset + */ + public int getEnd(); + + /** + * Gets the {@link ITernScope} attached to this node if one exists. This method will only return a non-null value if the AST was + * already processed by Tern. For example, if the AST was retrieved from Tern using the 'parseFile' query, then at least one of + * the AST nodes will contain a scope object. However, if the 'parseString' query was used, no static analysis will be performed + * on the parsed AST and there will be no scope objects attached to any of its nodes. + * + * @return the Tern scope or null if not available + */ + public ITernScope getScope(); +} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IQmlArrayBinding.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IQmlArrayBinding.java index e37ddebd15e..76259e16b41 100644 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IQmlArrayBinding.java +++ b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IQmlArrayBinding.java @@ -1,22 +1,22 @@ -/******************************************************************************* - * Copyright (c) 2015 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.qt.core.qmljs; - -import java.util.List; - -public interface IQmlArrayBinding extends IQmlBinding { - @Override - default public String getType() { - return "QMLArrayBinding"; //$NON-NLS-1$ - }; - - public List getElements(); -} +/******************************************************************************* + * Copyright (c) 2015 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.qt.core.qmljs; + +import java.util.List; + +public interface IQmlArrayBinding extends IQmlBinding { + @Override + default public String getType() { + return "QMLArrayBinding"; //$NON-NLS-1$ + }; + + public List getElements(); +} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IQmlBinding.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IQmlBinding.java index a860c6994c7..e894ed4e466 100644 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IQmlBinding.java +++ b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IQmlBinding.java @@ -1,14 +1,14 @@ -/******************************************************************************* - * Copyright (c) 2015 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.qt.core.qmljs; - -public interface IQmlBinding extends IQmlASTNode { -} +/******************************************************************************* + * Copyright (c) 2015 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.qt.core.qmljs; + +public interface IQmlBinding extends IQmlASTNode { +} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IQmlHeaderItem.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IQmlHeaderItem.java index dc0c606eb32..62051007426 100644 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IQmlHeaderItem.java +++ b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IQmlHeaderItem.java @@ -1,14 +1,14 @@ -/******************************************************************************* - * Copyright (c) 2015 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.qt.core.qmljs; - -public interface IQmlHeaderItem extends IQmlASTNode { -} +/******************************************************************************* + * Copyright (c) 2015 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.qt.core.qmljs; + +public interface IQmlHeaderItem extends IQmlASTNode { +} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IQmlHeaderItemList.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IQmlHeaderItemList.java index 617b60388b2..873878fccfc 100644 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IQmlHeaderItemList.java +++ b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IQmlHeaderItemList.java @@ -1,17 +1,17 @@ -/******************************************************************************* - * Copyright (c) 2015 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.qt.core.qmljs; - -import java.util.List; - -public interface IQmlHeaderItemList extends IQmlASTNode { - public List getItems(); -} +/******************************************************************************* + * Copyright (c) 2015 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.qt.core.qmljs; + +import java.util.List; + +public interface IQmlHeaderItemList extends IQmlASTNode { + public List getItems(); +} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IQmlImport.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IQmlImport.java index cbbcc327b4f..2f6e5a7cc69 100644 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IQmlImport.java +++ b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IQmlImport.java @@ -1,24 +1,24 @@ -/******************************************************************************* - * Copyright (c) 2015 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.qt.core.qmljs; - -public interface IQmlImport extends IQmlHeaderItem { - @Override - default public String getType() { - return "QMLImport"; //$NON-NLS-1$ - }; - - public IQmlModule getModule(); - - public IJSLiteral getDirectory(); - - public IQmlQualifier getQualifier(); -} +/******************************************************************************* + * Copyright (c) 2015 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.qt.core.qmljs; + +public interface IQmlImport extends IQmlHeaderItem { + @Override + default public String getType() { + return "QMLImport"; //$NON-NLS-1$ + }; + + public IQmlModule getModule(); + + public IJSLiteral getDirectory(); + + public IQmlQualifier getQualifier(); +} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IQmlModule.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IQmlModule.java index 46b8dc05ee0..752270e27ef 100644 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IQmlModule.java +++ b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IQmlModule.java @@ -1,17 +1,17 @@ -/******************************************************************************* - * Copyright (c) 2015 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.qt.core.qmljs; - -public interface IQmlModule extends IQmlASTNode { - public IQmlQualifiedID getIdentifier(); - - public IQmlVersionLiteral getVersion(); -} +/******************************************************************************* + * Copyright (c) 2015 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.qt.core.qmljs; + +public interface IQmlModule extends IQmlASTNode { + public IQmlQualifiedID getIdentifier(); + + public IQmlVersionLiteral getVersion(); +} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IQmlObjectBinding.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IQmlObjectBinding.java index 61c51077248..80e325b4949 100644 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IQmlObjectBinding.java +++ b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IQmlObjectBinding.java @@ -1,22 +1,22 @@ -/******************************************************************************* - * Copyright (c) 2015 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.qt.core.qmljs; - -public interface IQmlObjectBinding extends IQmlBinding { - @Override - default public String getType() { - return "QMLObjectBinding"; //$NON-NLS-1$ - }; - - public IQmlQualifiedID getIdentifier(); - - public IQmlObjectInitializer getBody(); -} +/******************************************************************************* + * Copyright (c) 2015 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.qt.core.qmljs; + +public interface IQmlObjectBinding extends IQmlBinding { + @Override + default public String getType() { + return "QMLObjectBinding"; //$NON-NLS-1$ + }; + + public IQmlQualifiedID getIdentifier(); + + public IQmlObjectInitializer getBody(); +} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IQmlObjectDefinition.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IQmlObjectDefinition.java index 5af2289ed37..854b7bf6402 100644 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IQmlObjectDefinition.java +++ b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IQmlObjectDefinition.java @@ -1,22 +1,22 @@ -/******************************************************************************* - * Copyright (c) 2015 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.qt.core.qmljs; - -public interface IQmlObjectDefinition extends IQmlObjectMember { - @Override - default public String getType() { - return "QMLObjectDefinition"; //$NON-NLS-1$ - }; - - public IQmlQualifiedID getIdentifier(); - - public IQmlObjectInitializer getBody(); -} +/******************************************************************************* + * Copyright (c) 2015 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.qt.core.qmljs; + +public interface IQmlObjectDefinition extends IQmlObjectMember { + @Override + default public String getType() { + return "QMLObjectDefinition"; //$NON-NLS-1$ + }; + + public IQmlQualifiedID getIdentifier(); + + public IQmlObjectInitializer getBody(); +} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IQmlObjectInitializer.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IQmlObjectInitializer.java index 0ced8b072d6..70d2b338f7d 100644 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IQmlObjectInitializer.java +++ b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IQmlObjectInitializer.java @@ -1,22 +1,22 @@ -/******************************************************************************* - * Copyright (c) 2015 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.qt.core.qmljs; - -import java.util.List; - -public interface IQmlObjectInitializer extends IQmlASTNode { - @Override - default public String getType() { - return "QMLObjectInitializer"; //$NON-NLS-1$ - }; - - public List getMembers(); -} +/******************************************************************************* + * Copyright (c) 2015 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.qt.core.qmljs; + +import java.util.List; + +public interface IQmlObjectInitializer extends IQmlASTNode { + @Override + default public String getType() { + return "QMLObjectInitializer"; //$NON-NLS-1$ + }; + + public List getMembers(); +} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IQmlObjectMember.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IQmlObjectMember.java index f026675cfa4..bd824a8b577 100644 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IQmlObjectMember.java +++ b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IQmlObjectMember.java @@ -1,14 +1,14 @@ -/******************************************************************************* - * Copyright (c) 2015 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.qt.core.qmljs; - -public interface IQmlObjectMember extends IQmlASTNode { -} +/******************************************************************************* + * Copyright (c) 2015 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.qt.core.qmljs; + +public interface IQmlObjectMember extends IQmlASTNode { +} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IQmlParameter.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IQmlParameter.java index f1d413cc450..9c1318bd2d0 100644 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IQmlParameter.java +++ b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IQmlParameter.java @@ -1,22 +1,22 @@ -/******************************************************************************* - * Copyright (c) 2015 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.qt.core.qmljs; - -public interface IQmlParameter extends IQmlASTNode { - @Override - default public String getType() { - return "QMLParameter"; //$NON-NLS-1$ - }; - - public IQmlPropertyType getKind(); - - public IJSIdentifier getIdentifier(); -} +/******************************************************************************* + * Copyright (c) 2015 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.qt.core.qmljs; + +public interface IQmlParameter extends IQmlASTNode { + @Override + default public String getType() { + return "QMLParameter"; //$NON-NLS-1$ + }; + + public IQmlPropertyType getKind(); + + public IJSIdentifier getIdentifier(); +} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IQmlPragma.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IQmlPragma.java index 440a8818fad..4b969077525 100644 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IQmlPragma.java +++ b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IQmlPragma.java @@ -1,20 +1,20 @@ -/******************************************************************************* - * Copyright (c) 2015 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.qt.core.qmljs; - -public interface IQmlPragma extends IQmlHeaderItem { - @Override - default public String getType() { - return "QMLPragma"; //$NON-NLS-1$ - }; - - public IQmlQualifiedID getIdentifier(); -} +/******************************************************************************* + * Copyright (c) 2015 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.qt.core.qmljs; + +public interface IQmlPragma extends IQmlHeaderItem { + @Override + default public String getType() { + return "QMLPragma"; //$NON-NLS-1$ + }; + + public IQmlQualifiedID getIdentifier(); +} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IQmlProgram.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IQmlProgram.java index 75d7ac137ea..8bd87421386 100644 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IQmlProgram.java +++ b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IQmlProgram.java @@ -1,38 +1,38 @@ -/******************************************************************************* - * Copyright (c) 2015 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.qt.core.qmljs; - -public interface IQmlProgram extends IQmlASTNode { - public static enum Modes { - QML("qml"), QMLTypes("qmltypes"), JavaScript("js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - - private final String ident; - - private Modes(String s) { - this.ident = s; - } - - public String getModeIdentifier() { - return this.ident; - } - } - - @Override - default public String getType() { - return "QMLProgram"; //$NON-NLS-1$ - }; - - public Modes getMode(); - - public IQmlHeaderItemList getHeaderItemList(); - - public IQmlRootObject getRootObject(); -} +/******************************************************************************* + * Copyright (c) 2015 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.qt.core.qmljs; + +public interface IQmlProgram extends IQmlASTNode { + public static enum Modes { + QML("qml"), QMLTypes("qmltypes"), JavaScript("js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + + private final String ident; + + private Modes(String s) { + this.ident = s; + } + + public String getModeIdentifier() { + return this.ident; + } + } + + @Override + default public String getType() { + return "QMLProgram"; //$NON-NLS-1$ + }; + + public Modes getMode(); + + public IQmlHeaderItemList getHeaderItemList(); + + public IQmlRootObject getRootObject(); +} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IQmlPropertyBinding.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IQmlPropertyBinding.java index 58da5d517a3..ffd1d7e0fb4 100644 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IQmlPropertyBinding.java +++ b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IQmlPropertyBinding.java @@ -1,22 +1,22 @@ -/******************************************************************************* - * Copyright (c) 2015 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.qt.core.qmljs; - -public interface IQmlPropertyBinding extends IQmlObjectMember { - @Override - default public String getType() { - return "QMLPropertyBinding"; //$NON-NLS-1$ - }; - - public IQmlQualifiedID getIdentifier(); - - public IQmlBinding getBinding(); -} +/******************************************************************************* + * Copyright (c) 2015 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.qt.core.qmljs; + +public interface IQmlPropertyBinding extends IQmlObjectMember { + @Override + default public String getType() { + return "QMLPropertyBinding"; //$NON-NLS-1$ + }; + + public IQmlQualifiedID getIdentifier(); + + public IQmlBinding getBinding(); +} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IQmlPropertyDeclaration.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IQmlPropertyDeclaration.java index 5f5f1c17522..f4b8eef67e8 100644 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IQmlPropertyDeclaration.java +++ b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IQmlPropertyDeclaration.java @@ -1,30 +1,30 @@ -/******************************************************************************* - * Copyright (c) 2015 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.qt.core.qmljs; - -public interface IQmlPropertyDeclaration extends IQmlObjectMember { - @Override - default public String getType() { - return "QMLPropertyDeclaration"; //$NON-NLS-1$ - }; - - public boolean isReadonly(); - - public boolean isDefault(); - - public IQmlPropertyType getKind(); - - public IQmlPropertyType getModifier(); - - public IJSIdentifier getIdentifier(); - - public IQmlBinding getBinding(); -} +/******************************************************************************* + * Copyright (c) 2015 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.qt.core.qmljs; + +public interface IQmlPropertyDeclaration extends IQmlObjectMember { + @Override + default public String getType() { + return "QMLPropertyDeclaration"; //$NON-NLS-1$ + }; + + public boolean isReadonly(); + + public boolean isDefault(); + + public IQmlPropertyType getKind(); + + public IQmlPropertyType getModifier(); + + public IJSIdentifier getIdentifier(); + + public IQmlBinding getBinding(); +} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IQmlPropertyType.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IQmlPropertyType.java index 133dfa2f681..817c1bbf479 100644 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IQmlPropertyType.java +++ b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IQmlPropertyType.java @@ -1,22 +1,22 @@ -/******************************************************************************* - * Copyright (c) 2015 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.qt.core.qmljs; - -public interface IQmlPropertyType extends IQmlASTNode { - @Override - default public String getType() { - return "QMLPropertyType"; //$NON-NLS-1$ - }; - - public boolean isPrimitive(); - - public IJSIdentifier getIdentifier(); -} +/******************************************************************************* + * Copyright (c) 2015 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.qt.core.qmljs; + +public interface IQmlPropertyType extends IQmlASTNode { + @Override + default public String getType() { + return "QMLPropertyType"; //$NON-NLS-1$ + }; + + public boolean isPrimitive(); + + public IJSIdentifier getIdentifier(); +} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IQmlQualifiedID.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IQmlQualifiedID.java index 42d947e0a51..536eb5d2c72 100644 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IQmlQualifiedID.java +++ b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IQmlQualifiedID.java @@ -1,24 +1,24 @@ -/******************************************************************************* - * Copyright (c) 2015 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.qt.core.qmljs; - -import java.util.List; - -public interface IQmlQualifiedID extends IQmlASTNode { - @Override - default public String getType() { - return "QMLQualifiedID"; //$NON-NLS-1$ - }; - - public List getParts(); - - public String getName(); -} +/******************************************************************************* + * Copyright (c) 2015 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.qt.core.qmljs; + +import java.util.List; + +public interface IQmlQualifiedID extends IQmlASTNode { + @Override + default public String getType() { + return "QMLQualifiedID"; //$NON-NLS-1$ + }; + + public List getParts(); + + public String getName(); +} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IQmlQualifier.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IQmlQualifier.java index 7b3f01b3a9a..2302dc002a4 100644 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IQmlQualifier.java +++ b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IQmlQualifier.java @@ -1,20 +1,20 @@ -/******************************************************************************* - * Copyright (c) 2015 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.qt.core.qmljs; - -public interface IQmlQualifier extends IQmlASTNode { - @Override - default public String getType() { - return "QMLQualifier"; //$NON-NLS-1$ - }; - - public IJSIdentifier getIdentifier(); -} +/******************************************************************************* + * Copyright (c) 2015 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.qt.core.qmljs; + +public interface IQmlQualifier extends IQmlASTNode { + @Override + default public String getType() { + return "QMLQualifier"; //$NON-NLS-1$ + }; + + public IJSIdentifier getIdentifier(); +} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IQmlRootObject.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IQmlRootObject.java index e2fa2fcdc4c..3e20a82a201 100644 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IQmlRootObject.java +++ b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IQmlRootObject.java @@ -1,14 +1,14 @@ -/******************************************************************************* - * Copyright (c) 2015 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.qt.core.qmljs; - -public interface IQmlRootObject extends IQmlObjectDefinition { -} +/******************************************************************************* + * Copyright (c) 2015 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.qt.core.qmljs; + +public interface IQmlRootObject extends IQmlObjectDefinition { +} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IQmlScriptBinding.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IQmlScriptBinding.java index fb73eafde36..15b93d072d1 100644 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IQmlScriptBinding.java +++ b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IQmlScriptBinding.java @@ -1,25 +1,25 @@ -/******************************************************************************* - * Copyright (c) 2015 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.qt.core.qmljs; - -public interface IQmlScriptBinding extends IQmlBinding { - @Override - default public String getType() { - return "QMLScriptBinding"; //$NON-NLS-1$ - }; - - public boolean isBlock(); - - /** - * @return {@link IJSExpression}, or {@link IQmlStatementBlock} - */ - public IQmlASTNode getScript(); -} +/******************************************************************************* + * Copyright (c) 2015 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.qt.core.qmljs; + +public interface IQmlScriptBinding extends IQmlBinding { + @Override + default public String getType() { + return "QMLScriptBinding"; //$NON-NLS-1$ + }; + + public boolean isBlock(); + + /** + * @return {@link IJSExpression}, or {@link IQmlStatementBlock} + */ + public IQmlASTNode getScript(); +} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IQmlSignalDefinition.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IQmlSignalDefinition.java index 478beb3d499..33e3abb64db 100644 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IQmlSignalDefinition.java +++ b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IQmlSignalDefinition.java @@ -1,24 +1,24 @@ -/******************************************************************************* - * Copyright (c) 2015 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.qt.core.qmljs; - -import java.util.List; - -public interface IQmlSignalDefinition extends IQmlObjectMember { - @Override - default public String getType() { - return "QMLSignalDefinition"; //$NON-NLS-1$ - }; - - public IJSIdentifier getIdentifier(); - - public List getParams(); -} +/******************************************************************************* + * Copyright (c) 2015 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.qt.core.qmljs; + +import java.util.List; + +public interface IQmlSignalDefinition extends IQmlObjectMember { + @Override + default public String getType() { + return "QMLSignalDefinition"; //$NON-NLS-1$ + }; + + public IJSIdentifier getIdentifier(); + + public List getParams(); +} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IQmlStatementBlock.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IQmlStatementBlock.java index e575a115f14..f2b051be052 100644 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IQmlStatementBlock.java +++ b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IQmlStatementBlock.java @@ -1,22 +1,22 @@ -/******************************************************************************* - * Copyright (c) 2015 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.qt.core.qmljs; - -import java.util.List; - -public interface IQmlStatementBlock extends IQmlASTNode { - @Override - default public String getType() { - return "QMLStatementBlock"; //$NON-NLS-1$ - }; - - public List getBody(); -} +/******************************************************************************* + * Copyright (c) 2015 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.qt.core.qmljs; + +import java.util.List; + +public interface IQmlStatementBlock extends IQmlASTNode { + @Override + default public String getType() { + return "QMLStatementBlock"; //$NON-NLS-1$ + }; + + public List getBody(); +} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IQmlVersionLiteral.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IQmlVersionLiteral.java index 7ce574997f8..8fd74dc5857 100644 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IQmlVersionLiteral.java +++ b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/IQmlVersionLiteral.java @@ -1,22 +1,22 @@ -/******************************************************************************* - * Copyright (c) 2015 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.qt.core.qmljs; - -public interface IQmlVersionLiteral extends IQmlASTNode { - @Override - default public String getType() { - return "QMLVersionLiteral"; //$NON-NLS-1$ - }; - - public double getValue(); - - public String getRaw(); -} +/******************************************************************************* + * Copyright (c) 2015 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.qt.core.qmljs; + +public interface IQmlVersionLiteral extends IQmlASTNode { + @Override + default public String getType() { + return "QMLVersionLiteral"; //$NON-NLS-1$ + }; + + public double getValue(); + + public String getRaw(); +} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/QMLExpressionEvaluator.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/QMLExpressionEvaluator.java index 4a83edaeb5f..030ce91a50d 100644 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/QMLExpressionEvaluator.java +++ b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/qmljs/QMLExpressionEvaluator.java @@ -1,120 +1,120 @@ -/******************************************************************************* - * Copyright (c) 2015 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.qt.core.qmljs; - -public final class QMLExpressionEvaluator { - private QMLExpressionEvaluator() { - } - - public static class InvalidExpressionException extends Exception { - - private static final long serialVersionUID = 4803923632666457229L; - - private IJSExpression offendingExpression; - - public InvalidExpressionException(String msg, IJSExpression expr) { - super(msg); - this.offendingExpression = expr; - } - - public IJSExpression getOffendingExpression() { - return offendingExpression; - } - } - - /** - * Evaluates the given {@link IJSExpression} as a constant expression and returns the result. At the moment this only supports - * very simple expressions involving unary operators and literals alone. Support for more complex expressions will be added as - * needed. - * - * @param expr - * the expression to be evaluated - * - * @throws InvalidExpressionException - * if the given expression can't be reduced to a single constant - */ - public static Object evaluateConstExpr(IJSExpression expr) throws InvalidExpressionException { - if (expr instanceof IJSLiteral) { - return ((IJSLiteral) expr).getValue(); - } else if (expr instanceof IJSUnaryExpression) { - IJSUnaryExpression unary = (IJSUnaryExpression) expr; - Object arg = evaluateConstExpr(unary.getArgument()); - switch (unary.getOperator()) { - case Plus: - return unaryPlus(arg, unary.getArgument()); - case Negation: - return unaryNegate(arg, unary.getArgument()); - case BitwiseNot: - return unaryBitwiseNot(arg, unary.getArgument()); - case Not: - return unaryNot(arg, unary.getArgument()); - default: - } - } - throw new InvalidExpressionException("Cannot reduce '" + expr + "' to a constant", expr); //$NON-NLS-1$ //$NON-NLS-2$ - } - - private static Object unaryPlus(Object object, IJSExpression expr) throws InvalidExpressionException { - if (object instanceof Byte) { - return +((Byte) object); - } else if (object instanceof Short) { - return +((Short) object); - } else if (object instanceof Integer) { - return +((Integer) object); - } else if (object instanceof Long) { - return +((Long) object); - } else if (object instanceof Float) { - return +((Float) object); - } else if (object instanceof Double) { - return +((Double) object); - } - throw new InvalidExpressionException("Cannot perform unary plus operation on a non-number", expr); //$NON-NLS-1$ - } - - private static Object unaryNegate(Object object, IJSExpression expr) throws InvalidExpressionException { - if (object instanceof Byte) { - return -((Byte) object); - } else if (object instanceof Short) { - return -((Short) object); - } else if (object instanceof Integer) { - return -((Integer) object); - } else if (object instanceof Long) { - return -((Long) object); - } else if (object instanceof Float) { - return -((Float) object); - } else if (object instanceof Double) { - return -((Double) object); - } - throw new InvalidExpressionException("Cannot perform unary negation operation on a non-number", expr); //$NON-NLS-1$ - } - - private static Object unaryBitwiseNot(Object object, IJSExpression expr) throws InvalidExpressionException { - if (object instanceof Byte) { - return ~((Byte) object); - } else if (object instanceof Short) { - return ~((Short) object); - } else if (object instanceof Integer) { - return ~((Integer) object); - } else if (object instanceof Long) { - return ~((Long) object); - } else if (object instanceof Float || object instanceof Double) { - return ~((Number) object).longValue(); - } - throw new InvalidExpressionException("Cannot perform binary not operation on a non-number", expr); //$NON-NLS-1$ - } - - private static Object unaryNot(Object object, IJSExpression expr) throws InvalidExpressionException { - if (object instanceof Boolean) { - return !((Boolean) object); - } - throw new InvalidExpressionException("Cannot perform unary not operation on a non-boolean", expr); //$NON-NLS-1$ - } -} +/******************************************************************************* + * Copyright (c) 2015 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.qt.core.qmljs; + +public final class QMLExpressionEvaluator { + private QMLExpressionEvaluator() { + } + + public static class InvalidExpressionException extends Exception { + + private static final long serialVersionUID = 4803923632666457229L; + + private IJSExpression offendingExpression; + + public InvalidExpressionException(String msg, IJSExpression expr) { + super(msg); + this.offendingExpression = expr; + } + + public IJSExpression getOffendingExpression() { + return offendingExpression; + } + } + + /** + * Evaluates the given {@link IJSExpression} as a constant expression and returns the result. At the moment this only supports + * very simple expressions involving unary operators and literals alone. Support for more complex expressions will be added as + * needed. + * + * @param expr + * the expression to be evaluated + * + * @throws InvalidExpressionException + * if the given expression can't be reduced to a single constant + */ + public static Object evaluateConstExpr(IJSExpression expr) throws InvalidExpressionException { + if (expr instanceof IJSLiteral) { + return ((IJSLiteral) expr).getValue(); + } else if (expr instanceof IJSUnaryExpression) { + IJSUnaryExpression unary = (IJSUnaryExpression) expr; + Object arg = evaluateConstExpr(unary.getArgument()); + switch (unary.getOperator()) { + case Plus: + return unaryPlus(arg, unary.getArgument()); + case Negation: + return unaryNegate(arg, unary.getArgument()); + case BitwiseNot: + return unaryBitwiseNot(arg, unary.getArgument()); + case Not: + return unaryNot(arg, unary.getArgument()); + default: + } + } + throw new InvalidExpressionException("Cannot reduce '" + expr + "' to a constant", expr); //$NON-NLS-1$ //$NON-NLS-2$ + } + + private static Object unaryPlus(Object object, IJSExpression expr) throws InvalidExpressionException { + if (object instanceof Byte) { + return +((Byte) object); + } else if (object instanceof Short) { + return +((Short) object); + } else if (object instanceof Integer) { + return +((Integer) object); + } else if (object instanceof Long) { + return +((Long) object); + } else if (object instanceof Float) { + return +((Float) object); + } else if (object instanceof Double) { + return +((Double) object); + } + throw new InvalidExpressionException("Cannot perform unary plus operation on a non-number", expr); //$NON-NLS-1$ + } + + private static Object unaryNegate(Object object, IJSExpression expr) throws InvalidExpressionException { + if (object instanceof Byte) { + return -((Byte) object); + } else if (object instanceof Short) { + return -((Short) object); + } else if (object instanceof Integer) { + return -((Integer) object); + } else if (object instanceof Long) { + return -((Long) object); + } else if (object instanceof Float) { + return -((Float) object); + } else if (object instanceof Double) { + return -((Double) object); + } + throw new InvalidExpressionException("Cannot perform unary negation operation on a non-number", expr); //$NON-NLS-1$ + } + + private static Object unaryBitwiseNot(Object object, IJSExpression expr) throws InvalidExpressionException { + if (object instanceof Byte) { + return ~((Byte) object); + } else if (object instanceof Short) { + return ~((Short) object); + } else if (object instanceof Integer) { + return ~((Integer) object); + } else if (object instanceof Long) { + return ~((Long) object); + } else if (object instanceof Float || object instanceof Double) { + return ~((Number) object).longValue(); + } + throw new InvalidExpressionException("Cannot perform binary not operation on a non-number", expr); //$NON-NLS-1$ + } + + private static Object unaryNot(Object object, IJSExpression expr) throws InvalidExpressionException { + if (object instanceof Boolean) { + return !((Boolean) object); + } + throw new InvalidExpressionException("Cannot perform unary not operation on a non-boolean", expr); //$NON-NLS-1$ + } +} diff --git a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/tern/ITernScope.java b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/tern/ITernScope.java index 5463f4899ee..65972055a69 100644 --- a/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/tern/ITernScope.java +++ b/qt/org.eclipse.cdt.qt.core/src/org/eclipse/cdt/qt/core/tern/ITernScope.java @@ -1,15 +1,15 @@ -/******************************************************************************* - * Copyright (c) 2015 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.qt.core.tern; - -public interface ITernScope { - // TODO: Determine the necessary components of a Tern Scope -} +/******************************************************************************* + * Copyright (c) 2015 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.qt.core.tern; + +public interface ITernScope { + // TODO: Determine the necessary components of a Tern Scope +} diff --git a/qt/org.eclipse.cdt.qt.core/tern-qml/.npmignore b/qt/org.eclipse.cdt.qt.core/tern-qml/.npmignore index ebc5ac557a4..5ac75016525 100644 --- a/qt/org.eclipse.cdt.qt.core/tern-qml/.npmignore +++ b/qt/org.eclipse.cdt.qt.core/tern-qml/.npmignore @@ -1,5 +1,5 @@ -/test -/node_modules -/.settings -.project +/test +/node_modules +/.settings +.project .tern-project \ No newline at end of file diff --git a/qt/org.eclipse.cdt.qt.core/tern-qml/demo/defs/ecma5.json.js b/qt/org.eclipse.cdt.qt.core/tern-qml/demo/defs/ecma5.json.js index ed9f62e03de..41391c6ebcf 100644 --- a/qt/org.eclipse.cdt.qt.core/tern-qml/demo/defs/ecma5.json.js +++ b/qt/org.eclipse.cdt.qt.core/tern-qml/demo/defs/ecma5.json.js @@ -1,966 +1,966 @@ -var ecma5 = { - "!name": "ecma5", - "!define": {"Error.prototype": "Error.prototype"}, - "Infinity": { - "!type": "number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Infinity", - "!doc": "A numeric value representing infinity." - }, - "undefined": { - "!type": "?", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/undefined", - "!doc": "The value undefined." - }, - "NaN": { - "!type": "number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/NaN", - "!doc": "A value representing Not-A-Number." - }, - "Object": { - "!type": "fn()", - "getPrototypeOf": { - "!type": "fn(obj: ?) -> ?", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object/getPrototypeOf", - "!doc": "Returns the prototype (i.e. the internal prototype) of the specified object." - }, - "create": { - "!type": "fn(proto: ?) -> !custom:Object_create", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object/create", - "!doc": "Creates a new object with the specified prototype object and properties." - }, - "defineProperty": { - "!type": "fn(obj: ?, prop: string, desc: ?) -> !custom:Object_defineProperty", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object/defineProperty", - "!doc": "Defines a new property directly on an object, or modifies an existing property on an object, and returns the object. If you want to see how to use the Object.defineProperty method with a binary-flags-like syntax, see this article." - }, - "defineProperties": { - "!type": "fn(obj: ?, props: ?) -> !custom:Object_defineProperties", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object/defineProperty", - "!doc": "Defines a new property directly on an object, or modifies an existing property on an object, and returns the object. If you want to see how to use the Object.defineProperty method with a binary-flags-like syntax, see this article." - }, - "getOwnPropertyDescriptor": { - "!type": "fn(obj: ?, prop: string) -> ?", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object/getOwnPropertyDescriptor", - "!doc": "Returns a property descriptor for an own property (that is, one directly present on an object, not present by dint of being along an object's prototype chain) of a given object." - }, - "keys": { - "!type": "fn(obj: ?) -> [string]", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object/keys", - "!doc": "Returns an array of a given object's own enumerable properties, in the same order as that provided by a for-in loop (the difference being that a for-in loop enumerates properties in the prototype chain as well)." - }, - "getOwnPropertyNames": { - "!type": "fn(obj: ?) -> [string]", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object/getOwnPropertyNames", - "!doc": "Returns an array of all properties (enumerable or not) found directly upon a given object." - }, - "seal": { - "!type": "fn(obj: ?)", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object/seal", - "!doc": "Seals an object, preventing new properties from being added to it and marking all existing properties as non-configurable. Values of present properties can still be changed as long as they are writable." - }, - "isSealed": { - "!type": "fn(obj: ?) -> bool", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object/isSealed", - "!doc": "Determine if an object is sealed." - }, - "freeze": { - "!type": "fn(obj: ?) -> !0", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object/freeze", - "!doc": "Freezes an object: that is, prevents new properties from being added to it; prevents existing properties from being removed; and prevents existing properties, or their enumerability, configurability, or writability, from being changed. In essence the object is made effectively immutable. The method returns the object being frozen." - }, - "isFrozen": { - "!type": "fn(obj: ?) -> bool", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object/isFrozen", - "!doc": "Determine if an object is frozen." - }, - "preventExtensions": { - "!type": "fn(obj: ?)", - "!url": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/preventExtensions", - "!doc": "Prevents new properties from ever being added to an object." - }, - "isExtensible": { - "!type": "fn(obj: ?) -> bool", - "!url": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/isExtensible", - "!doc": "The Object.isExtensible() method determines if an object is extensible (whether it can have new properties added to it)." - }, - "prototype": { - "!stdProto": "Object", - "toString": { - "!type": "fn() -> string", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object/toString", - "!doc": "Returns a string representing the object." - }, - "toLocaleString": { - "!type": "fn() -> string", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object/toLocaleString", - "!doc": "Returns a string representing the object. This method is meant to be overriden by derived objects for locale-specific purposes." - }, - "valueOf": { - "!type": "fn() -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object/valueOf", - "!doc": "Returns the primitive value of the specified object" - }, - "hasOwnProperty": { - "!type": "fn(prop: string) -> bool", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object/hasOwnProperty", - "!doc": "Returns a boolean indicating whether the object has the specified property." - }, - "propertyIsEnumerable": { - "!type": "fn(prop: string) -> bool", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object/propertyIsEnumerable", - "!doc": "Returns a Boolean indicating whether the specified property is enumerable." - }, - "isPrototypeOf": { - "!type": "fn(obj: ?) -> bool", - "!url": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/isPrototypeOf", - "!doc": "Tests for an object in another object's prototype chain." - } - }, - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object", - "!doc": "Creates an object wrapper." - }, - "Function": { - "!type": "fn(body: string) -> fn()", - "prototype": { - "!stdProto": "Function", - "apply": { - "!type": "fn(this: ?, args: [?])", - "!effects": [ - "call and return !this this=!0 !1. !1. !1." - ], - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Function/apply", - "!doc": "Calls a function with a given this value and arguments provided as an array (or an array like object)." - }, - "call": { - "!type": "fn(this: ?, args?: ?) -> !this.!ret", - "!effects": [ - "call and return !this this=!0 !1 !2 !3 !4" - ], - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Function/call", - "!doc": "Calls a function with a given this value and arguments provided individually." - }, - "bind": { - "!type": "fn(this: ?, args?: ?) -> !custom:Function_bind", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Function/bind", - "!doc": "Creates a new function that, when called, has its this keyword set to the provided value, with a given sequence of arguments preceding any provided when the new function was called." - }, - "prototype": "?" - }, - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Function", - "!doc": "Every function in JavaScript is actually a Function object." - }, - "Array": { - "!type": "fn(size: number) -> !custom:Array_ctor", - "isArray": { - "!type": "fn(value: ?) -> bool", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/isArray", - "!doc": "Returns true if an object is an array, false if it is not." - }, - "prototype": { - "!stdProto": "Array", - "length": { - "!type": "number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/length", - "!doc": "An unsigned, 32-bit integer that specifies the number of elements in an array." - }, - "concat": { - "!type": "fn(other: [?]) -> !this", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/concat", - "!doc": "Returns a new array comprised of this array joined with other array(s) and/or value(s)." - }, - "join": { - "!type": "fn(separator?: string) -> string", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/join", - "!doc": "Joins all elements of an array into a string." - }, - "splice": { - "!type": "fn(pos: number, amount: number)", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/splice", - "!doc": "Changes the content of an array, adding new elements while removing old elements." - }, - "pop": { - "!type": "fn() -> !this.", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/pop", - "!doc": "Removes the last element from an array and returns that element." - }, - "push": { - "!type": "fn(newelt: ?) -> number", - "!effects": [ - "propagate !0 !this." - ], - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/push", - "!doc": "Mutates an array by appending the given elements and returning the new length of the array." - }, - "shift": { - "!type": "fn() -> !this.", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/shift", - "!doc": "Removes the first element from an array and returns that element. This method changes the length of the array." - }, - "unshift": { - "!type": "fn(newelt: ?) -> number", - "!effects": [ - "propagate !0 !this." - ], - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/unshift", - "!doc": "Adds one or more elements to the beginning of an array and returns the new length of the array." - }, - "slice": { - "!type": "fn(from: number, to?: number) -> !this", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/slice", - "!doc": "Returns a shallow copy of a portion of an array." - }, - "reverse": { - "!type": "fn()", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/reverse", - "!doc": "Reverses an array in place. The first array element becomes the last and the last becomes the first." - }, - "sort": { - "!type": "fn(compare?: fn(a: ?, b: ?) -> number)", - "!effects": [ - "call !0 !this. !this." - ], - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/sort", - "!doc": "Sorts the elements of an array in place and returns the array." - }, - "indexOf": { - "!type": "fn(elt: ?, from?: number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/indexOf", - "!doc": "Returns the first index at which a given element can be found in the array, or -1 if it is not present." - }, - "lastIndexOf": { - "!type": "fn(elt: ?, from?: number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/lastIndexOf", - "!doc": "Returns the last index at which a given element can be found in the array, or -1 if it is not present. The array is searched backwards, starting at fromIndex." - }, - "every": { - "!type": "fn(test: fn(elt: ?, i: number) -> bool, context?: ?) -> bool", - "!effects": [ - "call !0 this=!1 !this. number" - ], - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/every", - "!doc": "Tests whether all elements in the array pass the test implemented by the provided function." - }, - "some": { - "!type": "fn(test: fn(elt: ?, i: number) -> bool, context?: ?) -> bool", - "!effects": [ - "call !0 this=!1 !this. number" - ], - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/some", - "!doc": "Tests whether some element in the array passes the test implemented by the provided function." - }, - "filter": { - "!type": "fn(test: fn(elt: ?, i: number) -> bool, context?: ?) -> !this", - "!effects": [ - "call !0 this=!1 !this. number" - ], - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/filter", - "!doc": "Creates a new array with all elements that pass the test implemented by the provided function." - }, - "forEach": { - "!type": "fn(f: fn(elt: ?, i: number), context?: ?)", - "!effects": [ - "call !0 this=!1 !this. number" - ], - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/forEach", - "!doc": "Executes a provided function once per array element." - }, - "map": { - "!type": "fn(f: fn(elt: ?, i: number) -> ?, context?: ?) -> [!0.!ret]", - "!effects": [ - "call !0 this=!1 !this. number" - ], - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/map", - "!doc": "Creates a new array with the results of calling a provided function on every element in this array." - }, - "reduce": { - "!type": "fn(combine: fn(sum: ?, elt: ?, i: number) -> ?, init?: ?) -> !0.!ret", - "!effects": [ - "call !0 !1 !this. number" - ], - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/Reduce", - "!doc": "Apply a function against an accumulator and each value of the array (from left-to-right) as to reduce it to a single value." - }, - "reduceRight": { - "!type": "fn(combine: fn(sum: ?, elt: ?, i: number) -> ?, init?: ?) -> !0.!ret", - "!effects": [ - "call !0 !1 !this. number" - ], - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/ReduceRight", - "!doc": "Apply a function simultaneously against two values of the array (from right-to-left) as to reduce it to a single value." - } - }, - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array", - "!doc": "The JavaScript Array global object is a constructor for arrays, which are high-level, list-like objects." - }, - "String": { - "!type": "fn(value: ?) -> string", - "fromCharCode": { - "!type": "fn(code: number) -> string", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/fromCharCode", - "!doc": "Returns a string created by using the specified sequence of Unicode values." - }, - "prototype": { - "!stdProto": "String", - "length": { - "!type": "number", - "!url": "https://developer.mozilla.org/en/docs/JavaScript/Reference/Global_Objects/String/length", - "!doc": "Represents the length of a string." - }, - "": "string", - "charAt": { - "!type": "fn(i: number) -> string", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/charAt", - "!doc": "Returns the specified character from a string." - }, - "charCodeAt": { - "!type": "fn(i: number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/charCodeAt", - "!doc": "Returns the numeric Unicode value of the character at the given index (except for unicode codepoints > 0x10000)." - }, - "indexOf": { - "!type": "fn(char: string, from?: number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/indexOf", - "!doc": "Returns the index within the calling String object of the first occurrence of the specified value, starting the search at fromIndex,\nreturns -1 if the value is not found." - }, - "lastIndexOf": { - "!type": "fn(char: string, from?: number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/lastIndexOf", - "!doc": "Returns the index within the calling String object of the last occurrence of the specified value, or -1 if not found. The calling string is searched backward, starting at fromIndex." - }, - "substring": { - "!type": "fn(from: number, to?: number) -> string", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/substring", - "!doc": "Returns a subset of a string between one index and another, or through the end of the string." - }, - "substr": { - "!type": "fn(from: number, length?: number) -> string", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/substr", - "!doc": "Returns the characters in a string beginning at the specified location through the specified number of characters." - }, - "slice": { - "!type": "fn(from: number, to?: number) -> string", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/slice", - "!doc": "Extracts a section of a string and returns a new string." - }, - "trim": { - "!type": "fn() -> string", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/Trim", - "!doc": "Removes whitespace from both ends of the string." - }, - "toUpperCase": { - "!type": "fn() -> string", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/toUpperCase", - "!doc": "Returns the calling string value converted to uppercase." - }, - "toLowerCase": { - "!type": "fn() -> string", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/toLowerCase", - "!doc": "Returns the calling string value converted to lowercase." - }, - "toLocaleUpperCase": { - "!type": "fn() -> string", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/toLocaleUpperCase", - "!doc": "Returns the calling string value converted to upper case, according to any locale-specific case mappings." - }, - "toLocaleLowerCase": { - "!type": "fn() -> string", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/toLocaleLowerCase", - "!doc": "Returns the calling string value converted to lower case, according to any locale-specific case mappings." - }, - "split": { - "!type": "fn(pattern: string) -> [string]", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/split", - "!doc": "Splits a String object into an array of strings by separating the string into substrings." - }, - "concat": { - "!type": "fn(other: string) -> string", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/concat", - "!doc": "Combines the text of two or more strings and returns a new string." - }, - "localeCompare": { - "!type": "fn(other: string) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/localeCompare", - "!doc": "Returns a number indicating whether a reference string comes before or after or is the same as the given string in sort order." - }, - "match": { - "!type": "fn(pattern: +RegExp) -> [string]", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/match", - "!doc": "Used to retrieve the matches when matching a string against a regular expression." - }, - "replace": { - "!type": "fn(pattern: string|+RegExp, replacement: string) -> string", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/replace", - "!doc": "Returns a new string with some or all matches of a pattern replaced by a replacement. The pattern can be a string or a RegExp, and the replacement can be a string or a function to be called for each match." - }, - "search": { - "!type": "fn(pattern: +RegExp) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/search", - "!doc": "Executes the search for a match between a regular expression and this String object." - } - }, - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String", - "!doc": "The String global object is a constructor for strings, or a sequence of characters." - }, - "Number": { - "!type": "fn(value: ?) -> number", - "MAX_VALUE": { - "!type": "number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number/MAX_VALUE", - "!doc": "The maximum numeric value representable in JavaScript." - }, - "MIN_VALUE": { - "!type": "number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number/MIN_VALUE", - "!doc": "The smallest positive numeric value representable in JavaScript." - }, - "POSITIVE_INFINITY": { - "!type": "number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number/POSITIVE_INFINITY", - "!doc": "A value representing the positive Infinity value." - }, - "NEGATIVE_INFINITY": { - "!type": "number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number/NEGATIVE_INFINITY", - "!doc": "A value representing the negative Infinity value." - }, - "prototype": { - "!stdProto": "Number", - "toString": { - "!type": "fn(radix?: number) -> string", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number/toString", - "!doc": "Returns a string representing the specified Number object" - }, - "toFixed": { - "!type": "fn(digits: number) -> string", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number/toFixed", - "!doc": "Formats a number using fixed-point notation" - }, - "toExponential": { - "!type": "fn(digits: number) -> string", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number/toExponential", - "!doc": "Returns a string representing the Number object in exponential notation" - }, - "toPrecision": { - "!type": "fn(digits: number) -> string", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number/toPrecision", - "!doc": "The toPrecision() method returns a string representing the number to the specified precision." - } - }, - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number", - "!doc": "The Number JavaScript object is a wrapper object allowing you to work with numerical values. A Number object is created using the Number() constructor." - }, - "Boolean": { - "!type": "fn(value: ?) -> bool", - "prototype": { - "!stdProto": "Boolean" - }, - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Boolean", - "!doc": "The Boolean object is an object wrapper for a boolean value." - }, - "RegExp": { - "!type": "fn(source: string, flags?: string)", - "prototype": { - "!stdProto": "RegExp", - "exec": { - "!type": "fn(input: string) -> [string]", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/RegExp/exec", - "!doc": "Executes a search for a match in a specified string. Returns a result array, or null." - }, - "test": { - "!type": "fn(input: string) -> bool", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/RegExp/test", - "!doc": "Executes the search for a match between a regular expression and a specified string. Returns true or false." - }, - "global": { - "!type": "bool", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/RegExp", - "!doc": "Creates a regular expression object for matching text with a pattern." - }, - "ignoreCase": { - "!type": "bool", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/RegExp", - "!doc": "Creates a regular expression object for matching text with a pattern." - }, - "multiline": { - "!type": "bool", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/RegExp/multiline", - "!doc": "Reflects whether or not to search in strings across multiple lines.\n" - }, - "source": { - "!type": "string", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/RegExp/source", - "!doc": "A read-only property that contains the text of the pattern, excluding the forward slashes.\n" - }, - "lastIndex": { - "!type": "number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/RegExp/lastIndex", - "!doc": "A read/write integer property that specifies the index at which to start the next match." - } - }, - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/RegExp", - "!doc": "Creates a regular expression object for matching text with a pattern." - }, - "Date": { - "!type": "fn(ms: number)", - "parse": { - "!type": "fn(source: string) -> +Date", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/parse", - "!doc": "Parses a string representation of a date, and returns the number of milliseconds since January 1, 1970, 00:00:00 UTC." - }, - "UTC": { - "!type": "fn(year: number, month: number, date: number, hour?: number, min?: number, sec?: number, ms?: number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/UTC", - "!doc": "Accepts the same parameters as the longest form of the constructor, and returns the number of milliseconds in a Date object since January 1, 1970, 00:00:00, universal time." - }, - "now": { - "!type": "fn() -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/now", - "!doc": "Returns the number of milliseconds elapsed since 1 January 1970 00:00:00 UTC." - }, - "prototype": { - "toUTCString": { - "!type": "fn() -> string", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/toUTCString", - "!doc": "Converts a date to a string, using the universal time convention." - }, - "toISOString": { - "!type": "fn() -> string", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/toISOString", - "!doc": "JavaScript provides a direct way to convert a date object into a string in ISO format, the ISO 8601 Extended Format." - }, - "toDateString": { - "!type": "fn() -> string", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/toDateString", - "!doc": "Returns the date portion of a Date object in human readable form in American English." - }, - "toTimeString": { - "!type": "fn() -> string", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/toTimeString", - "!doc": "Returns the time portion of a Date object in human readable form in American English." - }, - "toLocaleDateString": { - "!type": "fn() -> string", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/toLocaleDateString", - "!doc": "Converts a date to a string, returning the \"date\" portion using the operating system's locale's conventions.\n" - }, - "toLocaleTimeString": { - "!type": "fn() -> string", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/toLocaleTimeString", - "!doc": "Converts a date to a string, returning the \"time\" portion using the current locale's conventions." - }, - "getTime": { - "!type": "fn() -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/getTime", - "!doc": "Returns the numeric value corresponding to the time for the specified date according to universal time." - }, - "getFullYear": { - "!type": "fn() -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/getFullYear", - "!doc": "Returns the year of the specified date according to local time." - }, - "getYear": { - "!type": "fn() -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/getYear", - "!doc": "Returns the year in the specified date according to local time." - }, - "getMonth": { - "!type": "fn() -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/getMonth", - "!doc": "Returns the month in the specified date according to local time." - }, - "getUTCMonth": { - "!type": "fn() -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/getUTCMonth", - "!doc": "Returns the month of the specified date according to universal time.\n" - }, - "getDate": { - "!type": "fn() -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/getDate", - "!doc": "Returns the day of the month for the specified date according to local time." - }, - "getUTCDate": { - "!type": "fn() -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/getUTCDate", - "!doc": "Returns the day (date) of the month in the specified date according to universal time.\n" - }, - "getDay": { - "!type": "fn() -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/getDay", - "!doc": "Returns the day of the week for the specified date according to local time." - }, - "getUTCDay": { - "!type": "fn() -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/getUTCDay", - "!doc": "Returns the day of the week in the specified date according to universal time.\n" - }, - "getHours": { - "!type": "fn() -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/getHours", - "!doc": "Returns the hour for the specified date according to local time." - }, - "getUTCHours": { - "!type": "fn() -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/getUTCHours", - "!doc": "Returns the hours in the specified date according to universal time.\n" - }, - "getMinutes": { - "!type": "fn() -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/getMinutes", - "!doc": "Returns the minutes in the specified date according to local time." - }, - "getUTCMinutes": { - "!type": "fn() -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date", - "!doc": "Creates JavaScript Date instances which let you work with dates and times." - }, - "getSeconds": { - "!type": "fn() -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/getSeconds", - "!doc": "Returns the seconds in the specified date according to local time." - }, - "getUTCSeconds": { - "!type": "fn() -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/getUTCSeconds", - "!doc": "Returns the seconds in the specified date according to universal time.\n" - }, - "getMilliseconds": { - "!type": "fn() -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/getMilliseconds", - "!doc": "Returns the milliseconds in the specified date according to local time." - }, - "getUTCMilliseconds": { - "!type": "fn() -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/getUTCMilliseconds", - "!doc": "Returns the milliseconds in the specified date according to universal time.\n" - }, - "getTimezoneOffset": { - "!type": "fn() -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/getTimezoneOffset", - "!doc": "Returns the time-zone offset from UTC, in minutes, for the current locale." - }, - "setTime": { - "!type": "fn(date: +Date) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/setTime", - "!doc": "Sets the Date object to the time represented by a number of milliseconds since January 1, 1970, 00:00:00 UTC.\n" - }, - "setFullYear": { - "!type": "fn(year: number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/setFullYear", - "!doc": "Sets the full year for a specified date according to local time.\n" - }, - "setUTCFullYear": { - "!type": "fn(year: number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/setUTCFullYear", - "!doc": "Sets the full year for a specified date according to universal time.\n" - }, - "setMonth": { - "!type": "fn(month: number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/setMonth", - "!doc": "Set the month for a specified date according to local time." - }, - "setUTCMonth": { - "!type": "fn(month: number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/setUTCMonth", - "!doc": "Sets the month for a specified date according to universal time.\n" - }, - "setDate": { - "!type": "fn(day: number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/setDate", - "!doc": "Sets the day of the month for a specified date according to local time." - }, - "setUTCDate": { - "!type": "fn(day: number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/setUTCDate", - "!doc": "Sets the day of the month for a specified date according to universal time.\n" - }, - "setHours": { - "!type": "fn(hour: number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/setHours", - "!doc": "Sets the hours for a specified date according to local time, and returns the number of milliseconds since 1 January 1970 00:00:00 UTC until the time represented by the updated Date instance." - }, - "setUTCHours": { - "!type": "fn(hour: number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/setUTCHours", - "!doc": "Sets the hour for a specified date according to universal time.\n" - }, - "setMinutes": { - "!type": "fn(min: number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/setMinutes", - "!doc": "Sets the minutes for a specified date according to local time." - }, - "setUTCMinutes": { - "!type": "fn(min: number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/setUTCMinutes", - "!doc": "Sets the minutes for a specified date according to universal time.\n" - }, - "setSeconds": { - "!type": "fn(sec: number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/setSeconds", - "!doc": "Sets the seconds for a specified date according to local time." - }, - "setUTCSeconds": { - "!type": "fn(sec: number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/setUTCSeconds", - "!doc": "Sets the seconds for a specified date according to universal time.\n" - }, - "setMilliseconds": { - "!type": "fn(ms: number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/setMilliseconds", - "!doc": "Sets the milliseconds for a specified date according to local time.\n" - }, - "setUTCMilliseconds": { - "!type": "fn(ms: number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/setUTCMilliseconds", - "!doc": "Sets the milliseconds for a specified date according to universal time.\n" - } - }, - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date", - "!doc": "Creates JavaScript Date instances which let you work with dates and times." - }, - "Error": { - "!type": "fn(message: string)", - "prototype": { - "name": { - "!type": "string", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Error/name", - "!doc": "A name for the type of error." - }, - "message": { - "!type": "string", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Error/message", - "!doc": "A human-readable description of the error." - } - }, - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Error", - "!doc": "Creates an error object." - }, - "SyntaxError": { - "!type": "fn(message: string)", - "prototype": "Error.prototype", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/SyntaxError", - "!doc": "Represents an error when trying to interpret syntactically invalid code." - }, - "ReferenceError": { - "!type": "fn(message: string)", - "prototype": "Error.prototype", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/ReferenceError", - "!doc": "Represents an error when a non-existent variable is referenced." - }, - "URIError": { - "!type": "fn(message: string)", - "prototype": "Error.prototype", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/URIError", - "!doc": "Represents an error when a malformed URI is encountered." - }, - "EvalError": { - "!type": "fn(message: string)", - "prototype": "Error.prototype", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/EvalError", - "!doc": "Represents an error regarding the eval function." - }, - "RangeError": { - "!type": "fn(message: string)", - "prototype": "Error.prototype", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/RangeError", - "!doc": "Represents an error when a number is not within the correct range allowed." - }, - "TypeError": { - "!type": "fn(message: string)", - "prototype": "Error.prototype", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/TypeError", - "!doc": "Represents an error an error when a value is not of the expected type." - }, - "parseInt": { - "!type": "fn(string: string, radix?: number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/parseInt", - "!doc": "Parses a string argument and returns an integer of the specified radix or base." - }, - "parseFloat": { - "!type": "fn(string: string) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/parseFloat", - "!doc": "Parses a string argument and returns a floating point number." - }, - "isNaN": { - "!type": "fn(value: number) -> bool", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/isNaN", - "!doc": "Determines whether a value is NaN or not. Be careful, this function is broken. You may be interested in ECMAScript 6 Number.isNaN." - }, - "isFinite": { - "!type": "fn(value: number) -> bool", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/isFinite", - "!doc": "Determines whether the passed value is a finite number." - }, - "eval": { - "!type": "fn(code: string) -> ?", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/eval", - "!doc": "Evaluates JavaScript code represented as a string." - }, - "encodeURI": { - "!type": "fn(uri: string) -> string", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/encodeURI", - "!doc": "Encodes a Uniform Resource Identifier (URI) by replacing each instance of certain characters by one, two, three, or four escape sequences representing the UTF-8 encoding of the character (will only be four escape sequences for characters composed of two \"surrogate\" characters)." - }, - "encodeURIComponent": { - "!type": "fn(uri: string) -> string", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/encodeURIComponent", - "!doc": "Encodes a Uniform Resource Identifier (URI) component by replacing each instance of certain characters by one, two, three, or four escape sequences representing the UTF-8 encoding of the character (will only be four escape sequences for characters composed of two \"surrogate\" characters)." - }, - "decodeURI": { - "!type": "fn(uri: string) -> string", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/decodeURI", - "!doc": "Decodes a Uniform Resource Identifier (URI) previously created by encodeURI or by a similar routine." - }, - "decodeURIComponent": { - "!type": "fn(uri: string) -> string", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/decodeURIComponent", - "!doc": "Decodes a Uniform Resource Identifier (URI) component previously created by encodeURIComponent or by a similar routine." - }, - "Math": { - "E": { - "!type": "number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/E", - "!doc": "The base of natural logarithms, e, approximately 2.718." - }, - "LN2": { - "!type": "number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/LN2", - "!doc": "The natural logarithm of 2, approximately 0.693." - }, - "LN10": { - "!type": "number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/LN10", - "!doc": "The natural logarithm of 10, approximately 2.302." - }, - "LOG2E": { - "!type": "number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/LOG2E", - "!doc": "The base 2 logarithm of E (approximately 1.442)." - }, - "LOG10E": { - "!type": "number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/LOG10E", - "!doc": "The base 10 logarithm of E (approximately 0.434)." - }, - "SQRT1_2": { - "!type": "number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/SQRT1_2", - "!doc": "The square root of 1/2; equivalently, 1 over the square root of 2, approximately 0.707." - }, - "SQRT2": { - "!type": "number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/SQRT2", - "!doc": "The square root of 2, approximately 1.414." - }, - "PI": { - "!type": "number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/PI", - "!doc": "The ratio of the circumference of a circle to its diameter, approximately 3.14159." - }, - "abs": { - "!type": "fn(number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/abs", - "!doc": "Returns the absolute value of a number." - }, - "cos": { - "!type": "fn(number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/cos", - "!doc": "Returns the cosine of a number." - }, - "sin": { - "!type": "fn(number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/sin", - "!doc": "Returns the sine of a number." - }, - "tan": { - "!type": "fn(number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/tan", - "!doc": "Returns the tangent of a number." - }, - "acos": { - "!type": "fn(number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/acos", - "!doc": "Returns the arccosine (in radians) of a number." - }, - "asin": { - "!type": "fn(number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/asin", - "!doc": "Returns the arcsine (in radians) of a number." - }, - "atan": { - "!type": "fn(number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/atan", - "!doc": "Returns the arctangent (in radians) of a number." - }, - "atan2": { - "!type": "fn(y: number, x: number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/atan2", - "!doc": "Returns the arctangent of the quotient of its arguments." - }, - "ceil": { - "!type": "fn(number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/ceil", - "!doc": "Returns the smallest integer greater than or equal to a number." - }, - "floor": { - "!type": "fn(number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/floor", - "!doc": "Returns the largest integer less than or equal to a number." - }, - "round": { - "!type": "fn(number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/round", - "!doc": "Returns the value of a number rounded to the nearest integer." - }, - "exp": { - "!type": "fn(number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/exp", - "!doc": "Returns Ex, where x is the argument, and E is Euler's constant, the base of the natural logarithms." - }, - "log": { - "!type": "fn(number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/log", - "!doc": "Returns the natural logarithm (base E) of a number." - }, - "sqrt": { - "!type": "fn(number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/sqrt", - "!doc": "Returns the square root of a number." - }, - "pow": { - "!type": "fn(number, number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/pow", - "!doc": "Returns base to the exponent power, that is, baseexponent." - }, - "max": { - "!type": "fn(number, number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/max", - "!doc": "Returns the largest of zero or more numbers." - }, - "min": { - "!type": "fn(number, number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/min", - "!doc": "Returns the smallest of zero or more numbers." - }, - "random": { - "!type": "fn() -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/random", - "!doc": "Returns a floating-point, pseudo-random number in the range [0, 1) that is, from 0 (inclusive) up to but not including 1 (exclusive), which you can then scale to your desired range." - }, - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math", - "!doc": "A built-in object that has properties and methods for mathematical constants and functions." - }, - "JSON": { - "parse": { - "!type": "fn(json: string) -> ?", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/JSON/parse", - "!doc": "Parse a string as JSON, optionally transforming the value produced by parsing." - }, - "stringify": { - "!type": "fn(value: ?) -> string", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/JSON/stringify", - "!doc": "Convert a value to JSON, optionally replacing values if a replacer function is specified, or optionally including only the specified properties if a replacer array is specified." - }, - "!url": "https://developer.mozilla.org/en-US/docs/JSON", - "!doc": "JSON (JavaScript Object Notation) is a data-interchange format. It closely resembles a subset of JavaScript syntax, although it is not a strict subset. (See JSON in the JavaScript Reference for full details.) It is useful when writing any kind of JavaScript-based application, including websites and browser extensions. For example, you might store user information in JSON format in a cookie, or you might store extension preferences in JSON in a string-valued browser preference." - } +var ecma5 = { + "!name": "ecma5", + "!define": {"Error.prototype": "Error.prototype"}, + "Infinity": { + "!type": "number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Infinity", + "!doc": "A numeric value representing infinity." + }, + "undefined": { + "!type": "?", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/undefined", + "!doc": "The value undefined." + }, + "NaN": { + "!type": "number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/NaN", + "!doc": "A value representing Not-A-Number." + }, + "Object": { + "!type": "fn()", + "getPrototypeOf": { + "!type": "fn(obj: ?) -> ?", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object/getPrototypeOf", + "!doc": "Returns the prototype (i.e. the internal prototype) of the specified object." + }, + "create": { + "!type": "fn(proto: ?) -> !custom:Object_create", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object/create", + "!doc": "Creates a new object with the specified prototype object and properties." + }, + "defineProperty": { + "!type": "fn(obj: ?, prop: string, desc: ?) -> !custom:Object_defineProperty", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object/defineProperty", + "!doc": "Defines a new property directly on an object, or modifies an existing property on an object, and returns the object. If you want to see how to use the Object.defineProperty method with a binary-flags-like syntax, see this article." + }, + "defineProperties": { + "!type": "fn(obj: ?, props: ?) -> !custom:Object_defineProperties", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object/defineProperty", + "!doc": "Defines a new property directly on an object, or modifies an existing property on an object, and returns the object. If you want to see how to use the Object.defineProperty method with a binary-flags-like syntax, see this article." + }, + "getOwnPropertyDescriptor": { + "!type": "fn(obj: ?, prop: string) -> ?", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object/getOwnPropertyDescriptor", + "!doc": "Returns a property descriptor for an own property (that is, one directly present on an object, not present by dint of being along an object's prototype chain) of a given object." + }, + "keys": { + "!type": "fn(obj: ?) -> [string]", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object/keys", + "!doc": "Returns an array of a given object's own enumerable properties, in the same order as that provided by a for-in loop (the difference being that a for-in loop enumerates properties in the prototype chain as well)." + }, + "getOwnPropertyNames": { + "!type": "fn(obj: ?) -> [string]", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object/getOwnPropertyNames", + "!doc": "Returns an array of all properties (enumerable or not) found directly upon a given object." + }, + "seal": { + "!type": "fn(obj: ?)", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object/seal", + "!doc": "Seals an object, preventing new properties from being added to it and marking all existing properties as non-configurable. Values of present properties can still be changed as long as they are writable." + }, + "isSealed": { + "!type": "fn(obj: ?) -> bool", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object/isSealed", + "!doc": "Determine if an object is sealed." + }, + "freeze": { + "!type": "fn(obj: ?) -> !0", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object/freeze", + "!doc": "Freezes an object: that is, prevents new properties from being added to it; prevents existing properties from being removed; and prevents existing properties, or their enumerability, configurability, or writability, from being changed. In essence the object is made effectively immutable. The method returns the object being frozen." + }, + "isFrozen": { + "!type": "fn(obj: ?) -> bool", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object/isFrozen", + "!doc": "Determine if an object is frozen." + }, + "preventExtensions": { + "!type": "fn(obj: ?)", + "!url": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/preventExtensions", + "!doc": "Prevents new properties from ever being added to an object." + }, + "isExtensible": { + "!type": "fn(obj: ?) -> bool", + "!url": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/isExtensible", + "!doc": "The Object.isExtensible() method determines if an object is extensible (whether it can have new properties added to it)." + }, + "prototype": { + "!stdProto": "Object", + "toString": { + "!type": "fn() -> string", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object/toString", + "!doc": "Returns a string representing the object." + }, + "toLocaleString": { + "!type": "fn() -> string", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object/toLocaleString", + "!doc": "Returns a string representing the object. This method is meant to be overriden by derived objects for locale-specific purposes." + }, + "valueOf": { + "!type": "fn() -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object/valueOf", + "!doc": "Returns the primitive value of the specified object" + }, + "hasOwnProperty": { + "!type": "fn(prop: string) -> bool", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object/hasOwnProperty", + "!doc": "Returns a boolean indicating whether the object has the specified property." + }, + "propertyIsEnumerable": { + "!type": "fn(prop: string) -> bool", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object/propertyIsEnumerable", + "!doc": "Returns a Boolean indicating whether the specified property is enumerable." + }, + "isPrototypeOf": { + "!type": "fn(obj: ?) -> bool", + "!url": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/isPrototypeOf", + "!doc": "Tests for an object in another object's prototype chain." + } + }, + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object", + "!doc": "Creates an object wrapper." + }, + "Function": { + "!type": "fn(body: string) -> fn()", + "prototype": { + "!stdProto": "Function", + "apply": { + "!type": "fn(this: ?, args: [?])", + "!effects": [ + "call and return !this this=!0 !1. !1. !1." + ], + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Function/apply", + "!doc": "Calls a function with a given this value and arguments provided as an array (or an array like object)." + }, + "call": { + "!type": "fn(this: ?, args?: ?) -> !this.!ret", + "!effects": [ + "call and return !this this=!0 !1 !2 !3 !4" + ], + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Function/call", + "!doc": "Calls a function with a given this value and arguments provided individually." + }, + "bind": { + "!type": "fn(this: ?, args?: ?) -> !custom:Function_bind", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Function/bind", + "!doc": "Creates a new function that, when called, has its this keyword set to the provided value, with a given sequence of arguments preceding any provided when the new function was called." + }, + "prototype": "?" + }, + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Function", + "!doc": "Every function in JavaScript is actually a Function object." + }, + "Array": { + "!type": "fn(size: number) -> !custom:Array_ctor", + "isArray": { + "!type": "fn(value: ?) -> bool", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/isArray", + "!doc": "Returns true if an object is an array, false if it is not." + }, + "prototype": { + "!stdProto": "Array", + "length": { + "!type": "number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/length", + "!doc": "An unsigned, 32-bit integer that specifies the number of elements in an array." + }, + "concat": { + "!type": "fn(other: [?]) -> !this", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/concat", + "!doc": "Returns a new array comprised of this array joined with other array(s) and/or value(s)." + }, + "join": { + "!type": "fn(separator?: string) -> string", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/join", + "!doc": "Joins all elements of an array into a string." + }, + "splice": { + "!type": "fn(pos: number, amount: number)", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/splice", + "!doc": "Changes the content of an array, adding new elements while removing old elements." + }, + "pop": { + "!type": "fn() -> !this.", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/pop", + "!doc": "Removes the last element from an array and returns that element." + }, + "push": { + "!type": "fn(newelt: ?) -> number", + "!effects": [ + "propagate !0 !this." + ], + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/push", + "!doc": "Mutates an array by appending the given elements and returning the new length of the array." + }, + "shift": { + "!type": "fn() -> !this.", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/shift", + "!doc": "Removes the first element from an array and returns that element. This method changes the length of the array." + }, + "unshift": { + "!type": "fn(newelt: ?) -> number", + "!effects": [ + "propagate !0 !this." + ], + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/unshift", + "!doc": "Adds one or more elements to the beginning of an array and returns the new length of the array." + }, + "slice": { + "!type": "fn(from: number, to?: number) -> !this", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/slice", + "!doc": "Returns a shallow copy of a portion of an array." + }, + "reverse": { + "!type": "fn()", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/reverse", + "!doc": "Reverses an array in place. The first array element becomes the last and the last becomes the first." + }, + "sort": { + "!type": "fn(compare?: fn(a: ?, b: ?) -> number)", + "!effects": [ + "call !0 !this. !this." + ], + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/sort", + "!doc": "Sorts the elements of an array in place and returns the array." + }, + "indexOf": { + "!type": "fn(elt: ?, from?: number) -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/indexOf", + "!doc": "Returns the first index at which a given element can be found in the array, or -1 if it is not present." + }, + "lastIndexOf": { + "!type": "fn(elt: ?, from?: number) -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/lastIndexOf", + "!doc": "Returns the last index at which a given element can be found in the array, or -1 if it is not present. The array is searched backwards, starting at fromIndex." + }, + "every": { + "!type": "fn(test: fn(elt: ?, i: number) -> bool, context?: ?) -> bool", + "!effects": [ + "call !0 this=!1 !this. number" + ], + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/every", + "!doc": "Tests whether all elements in the array pass the test implemented by the provided function." + }, + "some": { + "!type": "fn(test: fn(elt: ?, i: number) -> bool, context?: ?) -> bool", + "!effects": [ + "call !0 this=!1 !this. number" + ], + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/some", + "!doc": "Tests whether some element in the array passes the test implemented by the provided function." + }, + "filter": { + "!type": "fn(test: fn(elt: ?, i: number) -> bool, context?: ?) -> !this", + "!effects": [ + "call !0 this=!1 !this. number" + ], + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/filter", + "!doc": "Creates a new array with all elements that pass the test implemented by the provided function." + }, + "forEach": { + "!type": "fn(f: fn(elt: ?, i: number), context?: ?)", + "!effects": [ + "call !0 this=!1 !this. number" + ], + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/forEach", + "!doc": "Executes a provided function once per array element." + }, + "map": { + "!type": "fn(f: fn(elt: ?, i: number) -> ?, context?: ?) -> [!0.!ret]", + "!effects": [ + "call !0 this=!1 !this. number" + ], + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/map", + "!doc": "Creates a new array with the results of calling a provided function on every element in this array." + }, + "reduce": { + "!type": "fn(combine: fn(sum: ?, elt: ?, i: number) -> ?, init?: ?) -> !0.!ret", + "!effects": [ + "call !0 !1 !this. number" + ], + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/Reduce", + "!doc": "Apply a function against an accumulator and each value of the array (from left-to-right) as to reduce it to a single value." + }, + "reduceRight": { + "!type": "fn(combine: fn(sum: ?, elt: ?, i: number) -> ?, init?: ?) -> !0.!ret", + "!effects": [ + "call !0 !1 !this. number" + ], + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/ReduceRight", + "!doc": "Apply a function simultaneously against two values of the array (from right-to-left) as to reduce it to a single value." + } + }, + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array", + "!doc": "The JavaScript Array global object is a constructor for arrays, which are high-level, list-like objects." + }, + "String": { + "!type": "fn(value: ?) -> string", + "fromCharCode": { + "!type": "fn(code: number) -> string", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/fromCharCode", + "!doc": "Returns a string created by using the specified sequence of Unicode values." + }, + "prototype": { + "!stdProto": "String", + "length": { + "!type": "number", + "!url": "https://developer.mozilla.org/en/docs/JavaScript/Reference/Global_Objects/String/length", + "!doc": "Represents the length of a string." + }, + "": "string", + "charAt": { + "!type": "fn(i: number) -> string", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/charAt", + "!doc": "Returns the specified character from a string." + }, + "charCodeAt": { + "!type": "fn(i: number) -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/charCodeAt", + "!doc": "Returns the numeric Unicode value of the character at the given index (except for unicode codepoints > 0x10000)." + }, + "indexOf": { + "!type": "fn(char: string, from?: number) -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/indexOf", + "!doc": "Returns the index within the calling String object of the first occurrence of the specified value, starting the search at fromIndex,\nreturns -1 if the value is not found." + }, + "lastIndexOf": { + "!type": "fn(char: string, from?: number) -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/lastIndexOf", + "!doc": "Returns the index within the calling String object of the last occurrence of the specified value, or -1 if not found. The calling string is searched backward, starting at fromIndex." + }, + "substring": { + "!type": "fn(from: number, to?: number) -> string", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/substring", + "!doc": "Returns a subset of a string between one index and another, or through the end of the string." + }, + "substr": { + "!type": "fn(from: number, length?: number) -> string", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/substr", + "!doc": "Returns the characters in a string beginning at the specified location through the specified number of characters." + }, + "slice": { + "!type": "fn(from: number, to?: number) -> string", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/slice", + "!doc": "Extracts a section of a string and returns a new string." + }, + "trim": { + "!type": "fn() -> string", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/Trim", + "!doc": "Removes whitespace from both ends of the string." + }, + "toUpperCase": { + "!type": "fn() -> string", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/toUpperCase", + "!doc": "Returns the calling string value converted to uppercase." + }, + "toLowerCase": { + "!type": "fn() -> string", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/toLowerCase", + "!doc": "Returns the calling string value converted to lowercase." + }, + "toLocaleUpperCase": { + "!type": "fn() -> string", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/toLocaleUpperCase", + "!doc": "Returns the calling string value converted to upper case, according to any locale-specific case mappings." + }, + "toLocaleLowerCase": { + "!type": "fn() -> string", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/toLocaleLowerCase", + "!doc": "Returns the calling string value converted to lower case, according to any locale-specific case mappings." + }, + "split": { + "!type": "fn(pattern: string) -> [string]", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/split", + "!doc": "Splits a String object into an array of strings by separating the string into substrings." + }, + "concat": { + "!type": "fn(other: string) -> string", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/concat", + "!doc": "Combines the text of two or more strings and returns a new string." + }, + "localeCompare": { + "!type": "fn(other: string) -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/localeCompare", + "!doc": "Returns a number indicating whether a reference string comes before or after or is the same as the given string in sort order." + }, + "match": { + "!type": "fn(pattern: +RegExp) -> [string]", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/match", + "!doc": "Used to retrieve the matches when matching a string against a regular expression." + }, + "replace": { + "!type": "fn(pattern: string|+RegExp, replacement: string) -> string", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/replace", + "!doc": "Returns a new string with some or all matches of a pattern replaced by a replacement. The pattern can be a string or a RegExp, and the replacement can be a string or a function to be called for each match." + }, + "search": { + "!type": "fn(pattern: +RegExp) -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/search", + "!doc": "Executes the search for a match between a regular expression and this String object." + } + }, + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String", + "!doc": "The String global object is a constructor for strings, or a sequence of characters." + }, + "Number": { + "!type": "fn(value: ?) -> number", + "MAX_VALUE": { + "!type": "number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number/MAX_VALUE", + "!doc": "The maximum numeric value representable in JavaScript." + }, + "MIN_VALUE": { + "!type": "number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number/MIN_VALUE", + "!doc": "The smallest positive numeric value representable in JavaScript." + }, + "POSITIVE_INFINITY": { + "!type": "number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number/POSITIVE_INFINITY", + "!doc": "A value representing the positive Infinity value." + }, + "NEGATIVE_INFINITY": { + "!type": "number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number/NEGATIVE_INFINITY", + "!doc": "A value representing the negative Infinity value." + }, + "prototype": { + "!stdProto": "Number", + "toString": { + "!type": "fn(radix?: number) -> string", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number/toString", + "!doc": "Returns a string representing the specified Number object" + }, + "toFixed": { + "!type": "fn(digits: number) -> string", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number/toFixed", + "!doc": "Formats a number using fixed-point notation" + }, + "toExponential": { + "!type": "fn(digits: number) -> string", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number/toExponential", + "!doc": "Returns a string representing the Number object in exponential notation" + }, + "toPrecision": { + "!type": "fn(digits: number) -> string", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number/toPrecision", + "!doc": "The toPrecision() method returns a string representing the number to the specified precision." + } + }, + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number", + "!doc": "The Number JavaScript object is a wrapper object allowing you to work with numerical values. A Number object is created using the Number() constructor." + }, + "Boolean": { + "!type": "fn(value: ?) -> bool", + "prototype": { + "!stdProto": "Boolean" + }, + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Boolean", + "!doc": "The Boolean object is an object wrapper for a boolean value." + }, + "RegExp": { + "!type": "fn(source: string, flags?: string)", + "prototype": { + "!stdProto": "RegExp", + "exec": { + "!type": "fn(input: string) -> [string]", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/RegExp/exec", + "!doc": "Executes a search for a match in a specified string. Returns a result array, or null." + }, + "test": { + "!type": "fn(input: string) -> bool", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/RegExp/test", + "!doc": "Executes the search for a match between a regular expression and a specified string. Returns true or false." + }, + "global": { + "!type": "bool", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/RegExp", + "!doc": "Creates a regular expression object for matching text with a pattern." + }, + "ignoreCase": { + "!type": "bool", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/RegExp", + "!doc": "Creates a regular expression object for matching text with a pattern." + }, + "multiline": { + "!type": "bool", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/RegExp/multiline", + "!doc": "Reflects whether or not to search in strings across multiple lines.\n" + }, + "source": { + "!type": "string", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/RegExp/source", + "!doc": "A read-only property that contains the text of the pattern, excluding the forward slashes.\n" + }, + "lastIndex": { + "!type": "number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/RegExp/lastIndex", + "!doc": "A read/write integer property that specifies the index at which to start the next match." + } + }, + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/RegExp", + "!doc": "Creates a regular expression object for matching text with a pattern." + }, + "Date": { + "!type": "fn(ms: number)", + "parse": { + "!type": "fn(source: string) -> +Date", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/parse", + "!doc": "Parses a string representation of a date, and returns the number of milliseconds since January 1, 1970, 00:00:00 UTC." + }, + "UTC": { + "!type": "fn(year: number, month: number, date: number, hour?: number, min?: number, sec?: number, ms?: number) -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/UTC", + "!doc": "Accepts the same parameters as the longest form of the constructor, and returns the number of milliseconds in a Date object since January 1, 1970, 00:00:00, universal time." + }, + "now": { + "!type": "fn() -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/now", + "!doc": "Returns the number of milliseconds elapsed since 1 January 1970 00:00:00 UTC." + }, + "prototype": { + "toUTCString": { + "!type": "fn() -> string", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/toUTCString", + "!doc": "Converts a date to a string, using the universal time convention." + }, + "toISOString": { + "!type": "fn() -> string", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/toISOString", + "!doc": "JavaScript provides a direct way to convert a date object into a string in ISO format, the ISO 8601 Extended Format." + }, + "toDateString": { + "!type": "fn() -> string", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/toDateString", + "!doc": "Returns the date portion of a Date object in human readable form in American English." + }, + "toTimeString": { + "!type": "fn() -> string", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/toTimeString", + "!doc": "Returns the time portion of a Date object in human readable form in American English." + }, + "toLocaleDateString": { + "!type": "fn() -> string", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/toLocaleDateString", + "!doc": "Converts a date to a string, returning the \"date\" portion using the operating system's locale's conventions.\n" + }, + "toLocaleTimeString": { + "!type": "fn() -> string", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/toLocaleTimeString", + "!doc": "Converts a date to a string, returning the \"time\" portion using the current locale's conventions." + }, + "getTime": { + "!type": "fn() -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/getTime", + "!doc": "Returns the numeric value corresponding to the time for the specified date according to universal time." + }, + "getFullYear": { + "!type": "fn() -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/getFullYear", + "!doc": "Returns the year of the specified date according to local time." + }, + "getYear": { + "!type": "fn() -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/getYear", + "!doc": "Returns the year in the specified date according to local time." + }, + "getMonth": { + "!type": "fn() -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/getMonth", + "!doc": "Returns the month in the specified date according to local time." + }, + "getUTCMonth": { + "!type": "fn() -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/getUTCMonth", + "!doc": "Returns the month of the specified date according to universal time.\n" + }, + "getDate": { + "!type": "fn() -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/getDate", + "!doc": "Returns the day of the month for the specified date according to local time." + }, + "getUTCDate": { + "!type": "fn() -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/getUTCDate", + "!doc": "Returns the day (date) of the month in the specified date according to universal time.\n" + }, + "getDay": { + "!type": "fn() -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/getDay", + "!doc": "Returns the day of the week for the specified date according to local time." + }, + "getUTCDay": { + "!type": "fn() -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/getUTCDay", + "!doc": "Returns the day of the week in the specified date according to universal time.\n" + }, + "getHours": { + "!type": "fn() -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/getHours", + "!doc": "Returns the hour for the specified date according to local time." + }, + "getUTCHours": { + "!type": "fn() -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/getUTCHours", + "!doc": "Returns the hours in the specified date according to universal time.\n" + }, + "getMinutes": { + "!type": "fn() -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/getMinutes", + "!doc": "Returns the minutes in the specified date according to local time." + }, + "getUTCMinutes": { + "!type": "fn() -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date", + "!doc": "Creates JavaScript Date instances which let you work with dates and times." + }, + "getSeconds": { + "!type": "fn() -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/getSeconds", + "!doc": "Returns the seconds in the specified date according to local time." + }, + "getUTCSeconds": { + "!type": "fn() -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/getUTCSeconds", + "!doc": "Returns the seconds in the specified date according to universal time.\n" + }, + "getMilliseconds": { + "!type": "fn() -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/getMilliseconds", + "!doc": "Returns the milliseconds in the specified date according to local time." + }, + "getUTCMilliseconds": { + "!type": "fn() -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/getUTCMilliseconds", + "!doc": "Returns the milliseconds in the specified date according to universal time.\n" + }, + "getTimezoneOffset": { + "!type": "fn() -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/getTimezoneOffset", + "!doc": "Returns the time-zone offset from UTC, in minutes, for the current locale." + }, + "setTime": { + "!type": "fn(date: +Date) -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/setTime", + "!doc": "Sets the Date object to the time represented by a number of milliseconds since January 1, 1970, 00:00:00 UTC.\n" + }, + "setFullYear": { + "!type": "fn(year: number) -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/setFullYear", + "!doc": "Sets the full year for a specified date according to local time.\n" + }, + "setUTCFullYear": { + "!type": "fn(year: number) -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/setUTCFullYear", + "!doc": "Sets the full year for a specified date according to universal time.\n" + }, + "setMonth": { + "!type": "fn(month: number) -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/setMonth", + "!doc": "Set the month for a specified date according to local time." + }, + "setUTCMonth": { + "!type": "fn(month: number) -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/setUTCMonth", + "!doc": "Sets the month for a specified date according to universal time.\n" + }, + "setDate": { + "!type": "fn(day: number) -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/setDate", + "!doc": "Sets the day of the month for a specified date according to local time." + }, + "setUTCDate": { + "!type": "fn(day: number) -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/setUTCDate", + "!doc": "Sets the day of the month for a specified date according to universal time.\n" + }, + "setHours": { + "!type": "fn(hour: number) -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/setHours", + "!doc": "Sets the hours for a specified date according to local time, and returns the number of milliseconds since 1 January 1970 00:00:00 UTC until the time represented by the updated Date instance." + }, + "setUTCHours": { + "!type": "fn(hour: number) -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/setUTCHours", + "!doc": "Sets the hour for a specified date according to universal time.\n" + }, + "setMinutes": { + "!type": "fn(min: number) -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/setMinutes", + "!doc": "Sets the minutes for a specified date according to local time." + }, + "setUTCMinutes": { + "!type": "fn(min: number) -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/setUTCMinutes", + "!doc": "Sets the minutes for a specified date according to universal time.\n" + }, + "setSeconds": { + "!type": "fn(sec: number) -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/setSeconds", + "!doc": "Sets the seconds for a specified date according to local time." + }, + "setUTCSeconds": { + "!type": "fn(sec: number) -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/setUTCSeconds", + "!doc": "Sets the seconds for a specified date according to universal time.\n" + }, + "setMilliseconds": { + "!type": "fn(ms: number) -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/setMilliseconds", + "!doc": "Sets the milliseconds for a specified date according to local time.\n" + }, + "setUTCMilliseconds": { + "!type": "fn(ms: number) -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/setUTCMilliseconds", + "!doc": "Sets the milliseconds for a specified date according to universal time.\n" + } + }, + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date", + "!doc": "Creates JavaScript Date instances which let you work with dates and times." + }, + "Error": { + "!type": "fn(message: string)", + "prototype": { + "name": { + "!type": "string", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Error/name", + "!doc": "A name for the type of error." + }, + "message": { + "!type": "string", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Error/message", + "!doc": "A human-readable description of the error." + } + }, + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Error", + "!doc": "Creates an error object." + }, + "SyntaxError": { + "!type": "fn(message: string)", + "prototype": "Error.prototype", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/SyntaxError", + "!doc": "Represents an error when trying to interpret syntactically invalid code." + }, + "ReferenceError": { + "!type": "fn(message: string)", + "prototype": "Error.prototype", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/ReferenceError", + "!doc": "Represents an error when a non-existent variable is referenced." + }, + "URIError": { + "!type": "fn(message: string)", + "prototype": "Error.prototype", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/URIError", + "!doc": "Represents an error when a malformed URI is encountered." + }, + "EvalError": { + "!type": "fn(message: string)", + "prototype": "Error.prototype", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/EvalError", + "!doc": "Represents an error regarding the eval function." + }, + "RangeError": { + "!type": "fn(message: string)", + "prototype": "Error.prototype", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/RangeError", + "!doc": "Represents an error when a number is not within the correct range allowed." + }, + "TypeError": { + "!type": "fn(message: string)", + "prototype": "Error.prototype", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/TypeError", + "!doc": "Represents an error an error when a value is not of the expected type." + }, + "parseInt": { + "!type": "fn(string: string, radix?: number) -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/parseInt", + "!doc": "Parses a string argument and returns an integer of the specified radix or base." + }, + "parseFloat": { + "!type": "fn(string: string) -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/parseFloat", + "!doc": "Parses a string argument and returns a floating point number." + }, + "isNaN": { + "!type": "fn(value: number) -> bool", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/isNaN", + "!doc": "Determines whether a value is NaN or not. Be careful, this function is broken. You may be interested in ECMAScript 6 Number.isNaN." + }, + "isFinite": { + "!type": "fn(value: number) -> bool", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/isFinite", + "!doc": "Determines whether the passed value is a finite number." + }, + "eval": { + "!type": "fn(code: string) -> ?", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/eval", + "!doc": "Evaluates JavaScript code represented as a string." + }, + "encodeURI": { + "!type": "fn(uri: string) -> string", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/encodeURI", + "!doc": "Encodes a Uniform Resource Identifier (URI) by replacing each instance of certain characters by one, two, three, or four escape sequences representing the UTF-8 encoding of the character (will only be four escape sequences for characters composed of two \"surrogate\" characters)." + }, + "encodeURIComponent": { + "!type": "fn(uri: string) -> string", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/encodeURIComponent", + "!doc": "Encodes a Uniform Resource Identifier (URI) component by replacing each instance of certain characters by one, two, three, or four escape sequences representing the UTF-8 encoding of the character (will only be four escape sequences for characters composed of two \"surrogate\" characters)." + }, + "decodeURI": { + "!type": "fn(uri: string) -> string", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/decodeURI", + "!doc": "Decodes a Uniform Resource Identifier (URI) previously created by encodeURI or by a similar routine." + }, + "decodeURIComponent": { + "!type": "fn(uri: string) -> string", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/decodeURIComponent", + "!doc": "Decodes a Uniform Resource Identifier (URI) component previously created by encodeURIComponent or by a similar routine." + }, + "Math": { + "E": { + "!type": "number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/E", + "!doc": "The base of natural logarithms, e, approximately 2.718." + }, + "LN2": { + "!type": "number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/LN2", + "!doc": "The natural logarithm of 2, approximately 0.693." + }, + "LN10": { + "!type": "number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/LN10", + "!doc": "The natural logarithm of 10, approximately 2.302." + }, + "LOG2E": { + "!type": "number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/LOG2E", + "!doc": "The base 2 logarithm of E (approximately 1.442)." + }, + "LOG10E": { + "!type": "number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/LOG10E", + "!doc": "The base 10 logarithm of E (approximately 0.434)." + }, + "SQRT1_2": { + "!type": "number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/SQRT1_2", + "!doc": "The square root of 1/2; equivalently, 1 over the square root of 2, approximately 0.707." + }, + "SQRT2": { + "!type": "number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/SQRT2", + "!doc": "The square root of 2, approximately 1.414." + }, + "PI": { + "!type": "number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/PI", + "!doc": "The ratio of the circumference of a circle to its diameter, approximately 3.14159." + }, + "abs": { + "!type": "fn(number) -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/abs", + "!doc": "Returns the absolute value of a number." + }, + "cos": { + "!type": "fn(number) -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/cos", + "!doc": "Returns the cosine of a number." + }, + "sin": { + "!type": "fn(number) -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/sin", + "!doc": "Returns the sine of a number." + }, + "tan": { + "!type": "fn(number) -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/tan", + "!doc": "Returns the tangent of a number." + }, + "acos": { + "!type": "fn(number) -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/acos", + "!doc": "Returns the arccosine (in radians) of a number." + }, + "asin": { + "!type": "fn(number) -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/asin", + "!doc": "Returns the arcsine (in radians) of a number." + }, + "atan": { + "!type": "fn(number) -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/atan", + "!doc": "Returns the arctangent (in radians) of a number." + }, + "atan2": { + "!type": "fn(y: number, x: number) -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/atan2", + "!doc": "Returns the arctangent of the quotient of its arguments." + }, + "ceil": { + "!type": "fn(number) -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/ceil", + "!doc": "Returns the smallest integer greater than or equal to a number." + }, + "floor": { + "!type": "fn(number) -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/floor", + "!doc": "Returns the largest integer less than or equal to a number." + }, + "round": { + "!type": "fn(number) -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/round", + "!doc": "Returns the value of a number rounded to the nearest integer." + }, + "exp": { + "!type": "fn(number) -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/exp", + "!doc": "Returns Ex, where x is the argument, and E is Euler's constant, the base of the natural logarithms." + }, + "log": { + "!type": "fn(number) -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/log", + "!doc": "Returns the natural logarithm (base E) of a number." + }, + "sqrt": { + "!type": "fn(number) -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/sqrt", + "!doc": "Returns the square root of a number." + }, + "pow": { + "!type": "fn(number, number) -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/pow", + "!doc": "Returns base to the exponent power, that is, baseexponent." + }, + "max": { + "!type": "fn(number, number) -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/max", + "!doc": "Returns the largest of zero or more numbers." + }, + "min": { + "!type": "fn(number, number) -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/min", + "!doc": "Returns the smallest of zero or more numbers." + }, + "random": { + "!type": "fn() -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/random", + "!doc": "Returns a floating-point, pseudo-random number in the range [0, 1) that is, from 0 (inclusive) up to but not including 1 (exclusive), which you can then scale to your desired range." + }, + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math", + "!doc": "A built-in object that has properties and methods for mathematical constants and functions." + }, + "JSON": { + "parse": { + "!type": "fn(json: string) -> ?", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/JSON/parse", + "!doc": "Parse a string as JSON, optionally transforming the value produced by parsing." + }, + "stringify": { + "!type": "fn(value: ?) -> string", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/JSON/stringify", + "!doc": "Convert a value to JSON, optionally replacing values if a replacer function is specified, or optionally including only the specified properties if a replacer array is specified." + }, + "!url": "https://developer.mozilla.org/en-US/docs/JSON", + "!doc": "JSON (JavaScript Object Notation) is a data-interchange format. It closely resembles a subset of JavaScript syntax, although it is not a strict subset. (See JSON in the JavaScript Reference for full details.) It is useful when writing any kind of JavaScript-based application, including websites and browser extensions. For example, you might store user information in JSON format in a cookie, or you might store extension preferences in JSON in a string-valued browser preference." + } } \ No newline at end of file diff --git a/qt/org.eclipse.cdt.qt.core/tern-qml/demo/qml-demo.html b/qt/org.eclipse.cdt.qt.core/tern-qml/demo/qml-demo.html index 75be78a1bef..91c778754b0 100644 --- a/qt/org.eclipse.cdt.qt.core/tern-qml/demo/qml-demo.html +++ b/qt/org.eclipse.cdt.qt.core/tern-qml/demo/qml-demo.html @@ -1,254 +1,254 @@ - - - - - - Tern QML Demo - - - - - - - - - - - - - - - - - - - - - -

    Demo with QML Tern plugin

    - QML Tern Demo - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    - -
    -
      -
    • test
    • -
    -
    -
    - -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    ​x -
    -
    -
    -
    -
     
    -
    -
    -
    -
    -
    1
    -
    // Use ctrl-space to complete something
    -
    -
    -
    2
    -
    co
    -
    -
    -
    3
    -
    document.body.a
    -
    -
    -
    4
    -
    ​
    -
    -
    -
    5
    -
    // Put the cursor in or after an expression, press ctrl-i to
    -
    -
    -
    6
    -
    // find its type
    -
    -
    -
    7
    -
    ​
    -
    -
    -
    8
    -
    var foo = ["array", "of", "strings"]
    -
    -
    -
    9
    -
    var bar = foo.slice(0, 2).join("").split("a")[0]
    -
    -
    -
    10
    -
    ​
    -
    -
    -
    11
    -
    // Works for locally defined types too.
    -
    -
    -
    12
    -
    ​
    -
    -
    -
    13
    -
    function CTor() { this.size = 10 }
    -
    -
    -
    14
    -
    CTor.prototype.hallo = "hallo"
    -
    -
    -
    15
    -
    ​
    -
    -
    -
    16
    -
    var baz = new CTor
    -
    -
    -
    17
    -
    baz.
    -
    -
    -
    18
    -
    ​
    -
    -
    -
    19
    -
    // You can press ctrl-q when the cursor is on a variable
    -
    -
    -
    20
    -
    // name to rename it. Try it with CTor...
    -
    -
    -
    21
    -
    ​
    -
    -
    -
    22
    -
    // When the cursor is in an argument list, the arguments
    -
    -
    -
    23
    -
    // are shown below the editor.
    -
    -
    -
    24
    -
    ​
    -
    -
    -
    25
    -
    [1].reduce(  )
    -
    -
    -
    26
    -
    ​
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    -
    - - - - + + + + + + Tern QML Demo + + + + + + + + + + + + + + + + + + + + + +

    Demo with QML Tern plugin

    + QML Tern Demo + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + +
    +
      +
    • test
    • +
    +
    +
    + +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    ​x +
    +
    +
    +
    +
     
    +
    +
    +
    +
    +
    1
    +
    // Use ctrl-space to complete something
    +
    +
    +
    2
    +
    co
    +
    +
    +
    3
    +
    document.body.a
    +
    +
    +
    4
    +
    ​
    +
    +
    +
    5
    +
    // Put the cursor in or after an expression, press ctrl-i to
    +
    +
    +
    6
    +
    // find its type
    +
    +
    +
    7
    +
    ​
    +
    +
    +
    8
    +
    var foo = ["array", "of", "strings"]
    +
    +
    +
    9
    +
    var bar = foo.slice(0, 2).join("").split("a")[0]
    +
    +
    +
    10
    +
    ​
    +
    +
    +
    11
    +
    // Works for locally defined types too.
    +
    +
    +
    12
    +
    ​
    +
    +
    +
    13
    +
    function CTor() { this.size = 10 }
    +
    +
    +
    14
    +
    CTor.prototype.hallo = "hallo"
    +
    +
    +
    15
    +
    ​
    +
    +
    +
    16
    +
    var baz = new CTor
    +
    +
    +
    17
    +
    baz.
    +
    +
    +
    18
    +
    ​
    +
    +
    +
    19
    +
    // You can press ctrl-q when the cursor is on a variable
    +
    +
    +
    20
    +
    // name to rename it. Try it with CTor...
    +
    +
    +
    21
    +
    ​
    +
    +
    +
    22
    +
    // When the cursor is in an argument list, the arguments
    +
    +
    +
    23
    +
    // are shown below the editor.
    +
    +
    +
    24
    +
    ​
    +
    +
    +
    25
    +
    [1].reduce(  )
    +
    +
    +
    26
    +
    ​
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    +
    + + + + \ No newline at end of file diff --git a/qt/org.eclipse.cdt.qt.core/tern-qml/ecma5-defs.js b/qt/org.eclipse.cdt.qt.core/tern-qml/ecma5-defs.js index dae3e5eca43..216c7160a2e 100644 --- a/qt/org.eclipse.cdt.qt.core/tern-qml/ecma5-defs.js +++ b/qt/org.eclipse.cdt.qt.core/tern-qml/ecma5-defs.js @@ -1,975 +1,975 @@ -/******************************************************************************* - * Copyright (c) 2015 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 - *******************************************************************************/ -ecma5defs = { - "!name": "ecma5", - "!define": { - "Error.prototype": "Error.prototype" - }, - "Infinity": { - "!type": "number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Infinity", - "!doc": "A numeric value representing infinity." - }, - "undefined": { - "!type": "?", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/undefined", - "!doc": "The value undefined." - }, - "NaN": { - "!type": "number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/NaN", - "!doc": "A value representing Not-A-Number." - }, - "Object": { - "!type": "fn()", - "getPrototypeOf": { - "!type": "fn(obj: ?) -> ?", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object/getPrototypeOf", - "!doc": "Returns the prototype (i.e. the internal prototype) of the specified object." - }, - "create": { - "!type": "fn(proto: ?) -> !custom:Object_create", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object/create", - "!doc": "Creates a new object with the specified prototype object and properties." - }, - "defineProperty": { - "!type": "fn(obj: ?, prop: string, desc: ?) -> !custom:Object_defineProperty", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object/defineProperty", - "!doc": "Defines a new property directly on an object, or modifies an existing property on an object, and returns the object. If you want to see how to use the Object.defineProperty method with a binary-flags-like syntax, see this article." - }, - "defineProperties": { - "!type": "fn(obj: ?, props: ?) -> !custom:Object_defineProperties", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object/defineProperty", - "!doc": "Defines a new property directly on an object, or modifies an existing property on an object, and returns the object. If you want to see how to use the Object.defineProperty method with a binary-flags-like syntax, see this article." - }, - "getOwnPropertyDescriptor": { - "!type": "fn(obj: ?, prop: string) -> ?", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object/getOwnPropertyDescriptor", - "!doc": "Returns a property descriptor for an own property (that is, one directly present on an object, not present by dint of being along an object's prototype chain) of a given object." - }, - "keys": { - "!type": "fn(obj: ?) -> [string]", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object/keys", - "!doc": "Returns an array of a given object's own enumerable properties, in the same order as that provided by a for-in loop (the difference being that a for-in loop enumerates properties in the prototype chain as well)." - }, - "getOwnPropertyNames": { - "!type": "fn(obj: ?) -> [string]", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object/getOwnPropertyNames", - "!doc": "Returns an array of all properties (enumerable or not) found directly upon a given object." - }, - "seal": { - "!type": "fn(obj: ?)", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object/seal", - "!doc": "Seals an object, preventing new properties from being added to it and marking all existing properties as non-configurable. Values of present properties can still be changed as long as they are writable." - }, - "isSealed": { - "!type": "fn(obj: ?) -> bool", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object/isSealed", - "!doc": "Determine if an object is sealed." - }, - "freeze": { - "!type": "fn(obj: ?) -> !0", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object/freeze", - "!doc": "Freezes an object: that is, prevents new properties from being added to it; prevents existing properties from being removed; and prevents existing properties, or their enumerability, configurability, or writability, from being changed. In essence the object is made effectively immutable. The method returns the object being frozen." - }, - "isFrozen": { - "!type": "fn(obj: ?) -> bool", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object/isFrozen", - "!doc": "Determine if an object is frozen." - }, - "preventExtensions": { - "!type": "fn(obj: ?)", - "!url": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/preventExtensions", - "!doc": "Prevents new properties from ever being added to an object." - }, - "isExtensible": { - "!type": "fn(obj: ?) -> bool", - "!url": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/isExtensible", - "!doc": "The Object.isExtensible() method determines if an object is extensible (whether it can have new properties added to it)." - }, - "prototype": { - "!stdProto": "Object", - "toString": { - "!type": "fn() -> string", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object/toString", - "!doc": "Returns a string representing the object." - }, - "toLocaleString": { - "!type": "fn() -> string", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object/toLocaleString", - "!doc": "Returns a string representing the object. This method is meant to be overriden by derived objects for locale-specific purposes." - }, - "valueOf": { - "!type": "fn() -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object/valueOf", - "!doc": "Returns the primitive value of the specified object" - }, - "hasOwnProperty": { - "!type": "fn(prop: string) -> bool", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object/hasOwnProperty", - "!doc": "Returns a boolean indicating whether the object has the specified property." - }, - "propertyIsEnumerable": { - "!type": "fn(prop: string) -> bool", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object/propertyIsEnumerable", - "!doc": "Returns a Boolean indicating whether the specified property is enumerable." - }, - "isPrototypeOf": { - "!type": "fn(obj: ?) -> bool", - "!url": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/isPrototypeOf", - "!doc": "Tests for an object in another object's prototype chain." - } - }, - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object", - "!doc": "Creates an object wrapper." - }, - "Function": { - "!type": "fn(body: string) -> fn()", - "prototype": { - "!stdProto": "Function", - "apply": { - "!type": "fn(this: ?, args: [?])", - "!effects": [ - "call and return !this this=!0 !1. !1. !1." - ], - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Function/apply", - "!doc": "Calls a function with a given this value and arguments provided as an array (or an array like object)." - }, - "call": { - "!type": "fn(this: ?, args?: ?) -> !this.!ret", - "!effects": [ - "call and return !this this=!0 !1 !2 !3 !4" - ], - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Function/call", - "!doc": "Calls a function with a given this value and arguments provided individually." - }, - "bind": { - "!type": "fn(this: ?, args?: ?) -> !custom:Function_bind", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Function/bind", - "!doc": "Creates a new function that, when called, has its this keyword set to the provided value, with a given sequence of arguments preceding any provided when the new function was called." - }, - "prototype": "?" - }, - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Function", - "!doc": "Every function in JavaScript is actually a Function object." - }, - "Array": { - "!type": "fn(size: number) -> !custom:Array_ctor", - "isArray": { - "!type": "fn(value: ?) -> bool", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/isArray", - "!doc": "Returns true if an object is an array, false if it is not." - }, - "prototype": { - "!stdProto": "Array", - "length": { - "!type": "number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/length", - "!doc": "An unsigned, 32-bit integer that specifies the number of elements in an array." - }, - "concat": { - "!type": "fn(other: [?]) -> !this", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/concat", - "!doc": "Returns a new array comprised of this array joined with other array(s) and/or value(s)." - }, - "join": { - "!type": "fn(separator?: string) -> string", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/join", - "!doc": "Joins all elements of an array into a string." - }, - "splice": { - "!type": "fn(pos: number, amount: number)", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/splice", - "!doc": "Changes the content of an array, adding new elements while removing old elements." - }, - "pop": { - "!type": "fn() -> !this.", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/pop", - "!doc": "Removes the last element from an array and returns that element." - }, - "push": { - "!type": "fn(newelt: ?) -> number", - "!effects": [ - "propagate !0 !this." - ], - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/push", - "!doc": "Mutates an array by appending the given elements and returning the new length of the array." - }, - "shift": { - "!type": "fn() -> !this.", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/shift", - "!doc": "Removes the first element from an array and returns that element. This method changes the length of the array." - }, - "unshift": { - "!type": "fn(newelt: ?) -> number", - "!effects": [ - "propagate !0 !this." - ], - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/unshift", - "!doc": "Adds one or more elements to the beginning of an array and returns the new length of the array." - }, - "slice": { - "!type": "fn(from: number, to?: number) -> !this", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/slice", - "!doc": "Returns a shallow copy of a portion of an array." - }, - "reverse": { - "!type": "fn()", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/reverse", - "!doc": "Reverses an array in place. The first array element becomes the last and the last becomes the first." - }, - "sort": { - "!type": "fn(compare?: fn(a: ?, b: ?) -> number)", - "!effects": [ - "call !0 !this. !this." - ], - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/sort", - "!doc": "Sorts the elements of an array in place and returns the array." - }, - "indexOf": { - "!type": "fn(elt: ?, from?: number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/indexOf", - "!doc": "Returns the first index at which a given element can be found in the array, or -1 if it is not present." - }, - "lastIndexOf": { - "!type": "fn(elt: ?, from?: number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/lastIndexOf", - "!doc": "Returns the last index at which a given element can be found in the array, or -1 if it is not present. The array is searched backwards, starting at fromIndex." - }, - "every": { - "!type": "fn(test: fn(elt: ?, i: number) -> bool, context?: ?) -> bool", - "!effects": [ - "call !0 this=!1 !this. number" - ], - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/every", - "!doc": "Tests whether all elements in the array pass the test implemented by the provided function." - }, - "some": { - "!type": "fn(test: fn(elt: ?, i: number) -> bool, context?: ?) -> bool", - "!effects": [ - "call !0 this=!1 !this. number" - ], - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/some", - "!doc": "Tests whether some element in the array passes the test implemented by the provided function." - }, - "filter": { - "!type": "fn(test: fn(elt: ?, i: number) -> bool, context?: ?) -> !this", - "!effects": [ - "call !0 this=!1 !this. number" - ], - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/filter", - "!doc": "Creates a new array with all elements that pass the test implemented by the provided function." - }, - "forEach": { - "!type": "fn(f: fn(elt: ?, i: number), context?: ?)", - "!effects": [ - "call !0 this=!1 !this. number" - ], - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/forEach", - "!doc": "Executes a provided function once per array element." - }, - "map": { - "!type": "fn(f: fn(elt: ?, i: number) -> ?, context?: ?) -> [!0.!ret]", - "!effects": [ - "call !0 this=!1 !this. number" - ], - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/map", - "!doc": "Creates a new array with the results of calling a provided function on every element in this array." - }, - "reduce": { - "!type": "fn(combine: fn(sum: ?, elt: ?, i: number) -> ?, init?: ?) -> !0.!ret", - "!effects": [ - "call !0 !1 !this. number" - ], - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/Reduce", - "!doc": "Apply a function against an accumulator and each value of the array (from left-to-right) as to reduce it to a single value." - }, - "reduceRight": { - "!type": "fn(combine: fn(sum: ?, elt: ?, i: number) -> ?, init?: ?) -> !0.!ret", - "!effects": [ - "call !0 !1 !this. number" - ], - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/ReduceRight", - "!doc": "Apply a function simultaneously against two values of the array (from right-to-left) as to reduce it to a single value." - } - }, - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array", - "!doc": "The JavaScript Array global object is a constructor for arrays, which are high-level, list-like objects." - }, - "String": { - "!type": "fn(value: ?) -> string", - "fromCharCode": { - "!type": "fn(code: number) -> string", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/fromCharCode", - "!doc": "Returns a string created by using the specified sequence of Unicode values." - }, - "prototype": { - "!stdProto": "String", - "length": { - "!type": "number", - "!url": "https://developer.mozilla.org/en/docs/JavaScript/Reference/Global_Objects/String/length", - "!doc": "Represents the length of a string." - }, - "": "string", - "charAt": { - "!type": "fn(i: number) -> string", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/charAt", - "!doc": "Returns the specified character from a string." - }, - "charCodeAt": { - "!type": "fn(i: number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/charCodeAt", - "!doc": "Returns the numeric Unicode value of the character at the given index (except for unicode codepoints > 0x10000)." - }, - "indexOf": { - "!type": "fn(char: string, from?: number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/indexOf", - "!doc": "Returns the index within the calling String object of the first occurrence of the specified value, starting the search at fromIndex,\nreturns -1 if the value is not found." - }, - "lastIndexOf": { - "!type": "fn(char: string, from?: number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/lastIndexOf", - "!doc": "Returns the index within the calling String object of the last occurrence of the specified value, or -1 if not found. The calling string is searched backward, starting at fromIndex." - }, - "substring": { - "!type": "fn(from: number, to?: number) -> string", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/substring", - "!doc": "Returns a subset of a string between one index and another, or through the end of the string." - }, - "substr": { - "!type": "fn(from: number, length?: number) -> string", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/substr", - "!doc": "Returns the characters in a string beginning at the specified location through the specified number of characters." - }, - "slice": { - "!type": "fn(from: number, to?: number) -> string", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/slice", - "!doc": "Extracts a section of a string and returns a new string." - }, - "trim": { - "!type": "fn() -> string", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/Trim", - "!doc": "Removes whitespace from both ends of the string." - }, - "toUpperCase": { - "!type": "fn() -> string", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/toUpperCase", - "!doc": "Returns the calling string value converted to uppercase." - }, - "toLowerCase": { - "!type": "fn() -> string", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/toLowerCase", - "!doc": "Returns the calling string value converted to lowercase." - }, - "toLocaleUpperCase": { - "!type": "fn() -> string", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/toLocaleUpperCase", - "!doc": "Returns the calling string value converted to upper case, according to any locale-specific case mappings." - }, - "toLocaleLowerCase": { - "!type": "fn() -> string", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/toLocaleLowerCase", - "!doc": "Returns the calling string value converted to lower case, according to any locale-specific case mappings." - }, - "split": { - "!type": "fn(pattern: string) -> [string]", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/split", - "!doc": "Splits a String object into an array of strings by separating the string into substrings." - }, - "concat": { - "!type": "fn(other: string) -> string", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/concat", - "!doc": "Combines the text of two or more strings and returns a new string." - }, - "localeCompare": { - "!type": "fn(other: string) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/localeCompare", - "!doc": "Returns a number indicating whether a reference string comes before or after or is the same as the given string in sort order." - }, - "match": { - "!type": "fn(pattern: +RegExp) -> [string]", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/match", - "!doc": "Used to retrieve the matches when matching a string against a regular expression." - }, - "replace": { - "!type": "fn(pattern: string|+RegExp, replacement: string) -> string", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/replace", - "!doc": "Returns a new string with some or all matches of a pattern replaced by a replacement. The pattern can be a string or a RegExp, and the replacement can be a string or a function to be called for each match." - }, - "search": { - "!type": "fn(pattern: +RegExp) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/search", - "!doc": "Executes the search for a match between a regular expression and this String object." - } - }, - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String", - "!doc": "The String global object is a constructor for strings, or a sequence of characters." - }, - "Number": { - "!type": "fn(value: ?) -> number", - "MAX_VALUE": { - "!type": "number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number/MAX_VALUE", - "!doc": "The maximum numeric value representable in JavaScript." - }, - "MIN_VALUE": { - "!type": "number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number/MIN_VALUE", - "!doc": "The smallest positive numeric value representable in JavaScript." - }, - "POSITIVE_INFINITY": { - "!type": "number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number/POSITIVE_INFINITY", - "!doc": "A value representing the positive Infinity value." - }, - "NEGATIVE_INFINITY": { - "!type": "number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number/NEGATIVE_INFINITY", - "!doc": "A value representing the negative Infinity value." - }, - "prototype": { - "!stdProto": "Number", - "toString": { - "!type": "fn(radix?: number) -> string", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number/toString", - "!doc": "Returns a string representing the specified Number object" - }, - "toFixed": { - "!type": "fn(digits: number) -> string", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number/toFixed", - "!doc": "Formats a number using fixed-point notation" - }, - "toExponential": { - "!type": "fn(digits: number) -> string", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number/toExponential", - "!doc": "Returns a string representing the Number object in exponential notation" - }, - "toPrecision": { - "!type": "fn(digits: number) -> string", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number/toPrecision", - "!doc": "The toPrecision() method returns a string representing the number to the specified precision." - } - }, - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number", - "!doc": "The Number JavaScript object is a wrapper object allowing you to work with numerical values. A Number object is created using the Number() constructor." - }, - "Boolean": { - "!type": "fn(value: ?) -> bool", - "prototype": { - "!stdProto": "Boolean" - }, - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Boolean", - "!doc": "The Boolean object is an object wrapper for a boolean value." - }, - "RegExp": { - "!type": "fn(source: string, flags?: string)", - "prototype": { - "!stdProto": "RegExp", - "exec": { - "!type": "fn(input: string) -> [string]", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/RegExp/exec", - "!doc": "Executes a search for a match in a specified string. Returns a result array, or null." - }, - "test": { - "!type": "fn(input: string) -> bool", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/RegExp/test", - "!doc": "Executes the search for a match between a regular expression and a specified string. Returns true or false." - }, - "global": { - "!type": "bool", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/RegExp", - "!doc": "Creates a regular expression object for matching text with a pattern." - }, - "ignoreCase": { - "!type": "bool", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/RegExp", - "!doc": "Creates a regular expression object for matching text with a pattern." - }, - "multiline": { - "!type": "bool", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/RegExp/multiline", - "!doc": "Reflects whether or not to search in strings across multiple lines.\n" - }, - "source": { - "!type": "string", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/RegExp/source", - "!doc": "A read-only property that contains the text of the pattern, excluding the forward slashes.\n" - }, - "lastIndex": { - "!type": "number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/RegExp/lastIndex", - "!doc": "A read/write integer property that specifies the index at which to start the next match." - } - }, - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/RegExp", - "!doc": "Creates a regular expression object for matching text with a pattern." - }, - "Date": { - "!type": "fn(ms: number)", - "parse": { - "!type": "fn(source: string) -> +Date", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/parse", - "!doc": "Parses a string representation of a date, and returns the number of milliseconds since January 1, 1970, 00:00:00 UTC." - }, - "UTC": { - "!type": "fn(year: number, month: number, date: number, hour?: number, min?: number, sec?: number, ms?: number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/UTC", - "!doc": "Accepts the same parameters as the longest form of the constructor, and returns the number of milliseconds in a Date object since January 1, 1970, 00:00:00, universal time." - }, - "now": { - "!type": "fn() -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/now", - "!doc": "Returns the number of milliseconds elapsed since 1 January 1970 00:00:00 UTC." - }, - "prototype": { - "toUTCString": { - "!type": "fn() -> string", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/toUTCString", - "!doc": "Converts a date to a string, using the universal time convention." - }, - "toISOString": { - "!type": "fn() -> string", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/toISOString", - "!doc": "JavaScript provides a direct way to convert a date object into a string in ISO format, the ISO 8601 Extended Format." - }, - "toDateString": { - "!type": "fn() -> string", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/toDateString", - "!doc": "Returns the date portion of a Date object in human readable form in American English." - }, - "toTimeString": { - "!type": "fn() -> string", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/toTimeString", - "!doc": "Returns the time portion of a Date object in human readable form in American English." - }, - "toLocaleDateString": { - "!type": "fn() -> string", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/toLocaleDateString", - "!doc": "Converts a date to a string, returning the \"date\" portion using the operating system's locale's conventions.\n" - }, - "toLocaleTimeString": { - "!type": "fn() -> string", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/toLocaleTimeString", - "!doc": "Converts a date to a string, returning the \"time\" portion using the current locale's conventions." - }, - "getTime": { - "!type": "fn() -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/getTime", - "!doc": "Returns the numeric value corresponding to the time for the specified date according to universal time." - }, - "getFullYear": { - "!type": "fn() -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/getFullYear", - "!doc": "Returns the year of the specified date according to local time." - }, - "getYear": { - "!type": "fn() -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/getYear", - "!doc": "Returns the year in the specified date according to local time." - }, - "getMonth": { - "!type": "fn() -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/getMonth", - "!doc": "Returns the month in the specified date according to local time." - }, - "getUTCMonth": { - "!type": "fn() -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/getUTCMonth", - "!doc": "Returns the month of the specified date according to universal time.\n" - }, - "getDate": { - "!type": "fn() -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/getDate", - "!doc": "Returns the day of the month for the specified date according to local time." - }, - "getUTCDate": { - "!type": "fn() -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/getUTCDate", - "!doc": "Returns the day (date) of the month in the specified date according to universal time.\n" - }, - "getDay": { - "!type": "fn() -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/getDay", - "!doc": "Returns the day of the week for the specified date according to local time." - }, - "getUTCDay": { - "!type": "fn() -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/getUTCDay", - "!doc": "Returns the day of the week in the specified date according to universal time.\n" - }, - "getHours": { - "!type": "fn() -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/getHours", - "!doc": "Returns the hour for the specified date according to local time." - }, - "getUTCHours": { - "!type": "fn() -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/getUTCHours", - "!doc": "Returns the hours in the specified date according to universal time.\n" - }, - "getMinutes": { - "!type": "fn() -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/getMinutes", - "!doc": "Returns the minutes in the specified date according to local time." - }, - "getUTCMinutes": { - "!type": "fn() -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date", - "!doc": "Creates JavaScript Date instances which let you work with dates and times." - }, - "getSeconds": { - "!type": "fn() -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/getSeconds", - "!doc": "Returns the seconds in the specified date according to local time." - }, - "getUTCSeconds": { - "!type": "fn() -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/getUTCSeconds", - "!doc": "Returns the seconds in the specified date according to universal time.\n" - }, - "getMilliseconds": { - "!type": "fn() -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/getMilliseconds", - "!doc": "Returns the milliseconds in the specified date according to local time." - }, - "getUTCMilliseconds": { - "!type": "fn() -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/getUTCMilliseconds", - "!doc": "Returns the milliseconds in the specified date according to universal time.\n" - }, - "getTimezoneOffset": { - "!type": "fn() -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/getTimezoneOffset", - "!doc": "Returns the time-zone offset from UTC, in minutes, for the current locale." - }, - "setTime": { - "!type": "fn(date: +Date) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/setTime", - "!doc": "Sets the Date object to the time represented by a number of milliseconds since January 1, 1970, 00:00:00 UTC.\n" - }, - "setFullYear": { - "!type": "fn(year: number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/setFullYear", - "!doc": "Sets the full year for a specified date according to local time.\n" - }, - "setUTCFullYear": { - "!type": "fn(year: number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/setUTCFullYear", - "!doc": "Sets the full year for a specified date according to universal time.\n" - }, - "setMonth": { - "!type": "fn(month: number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/setMonth", - "!doc": "Set the month for a specified date according to local time." - }, - "setUTCMonth": { - "!type": "fn(month: number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/setUTCMonth", - "!doc": "Sets the month for a specified date according to universal time.\n" - }, - "setDate": { - "!type": "fn(day: number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/setDate", - "!doc": "Sets the day of the month for a specified date according to local time." - }, - "setUTCDate": { - "!type": "fn(day: number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/setUTCDate", - "!doc": "Sets the day of the month for a specified date according to universal time.\n" - }, - "setHours": { - "!type": "fn(hour: number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/setHours", - "!doc": "Sets the hours for a specified date according to local time, and returns the number of milliseconds since 1 January 1970 00:00:00 UTC until the time represented by the updated Date instance." - }, - "setUTCHours": { - "!type": "fn(hour: number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/setUTCHours", - "!doc": "Sets the hour for a specified date according to universal time.\n" - }, - "setMinutes": { - "!type": "fn(min: number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/setMinutes", - "!doc": "Sets the minutes for a specified date according to local time." - }, - "setUTCMinutes": { - "!type": "fn(min: number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/setUTCMinutes", - "!doc": "Sets the minutes for a specified date according to universal time.\n" - }, - "setSeconds": { - "!type": "fn(sec: number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/setSeconds", - "!doc": "Sets the seconds for a specified date according to local time." - }, - "setUTCSeconds": { - "!type": "fn(sec: number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/setUTCSeconds", - "!doc": "Sets the seconds for a specified date according to universal time.\n" - }, - "setMilliseconds": { - "!type": "fn(ms: number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/setMilliseconds", - "!doc": "Sets the milliseconds for a specified date according to local time.\n" - }, - "setUTCMilliseconds": { - "!type": "fn(ms: number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/setUTCMilliseconds", - "!doc": "Sets the milliseconds for a specified date according to universal time.\n" - } - }, - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date", - "!doc": "Creates JavaScript Date instances which let you work with dates and times." - }, - "Error": { - "!type": "fn(message: string)", - "prototype": { - "name": { - "!type": "string", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Error/name", - "!doc": "A name for the type of error." - }, - "message": { - "!type": "string", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Error/message", - "!doc": "A human-readable description of the error." - } - }, - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Error", - "!doc": "Creates an error object." - }, - "SyntaxError": { - "!type": "fn(message: string)", - "prototype": "Error.prototype", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/SyntaxError", - "!doc": "Represents an error when trying to interpret syntactically invalid code." - }, - "ReferenceError": { - "!type": "fn(message: string)", - "prototype": "Error.prototype", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/ReferenceError", - "!doc": "Represents an error when a non-existent variable is referenced." - }, - "URIError": { - "!type": "fn(message: string)", - "prototype": "Error.prototype", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/URIError", - "!doc": "Represents an error when a malformed URI is encountered." - }, - "EvalError": { - "!type": "fn(message: string)", - "prototype": "Error.prototype", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/EvalError", - "!doc": "Represents an error regarding the eval function." - }, - "RangeError": { - "!type": "fn(message: string)", - "prototype": "Error.prototype", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/RangeError", - "!doc": "Represents an error when a number is not within the correct range allowed." - }, - "TypeError": { - "!type": "fn(message: string)", - "prototype": "Error.prototype", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/TypeError", - "!doc": "Represents an error an error when a value is not of the expected type." - }, - "parseInt": { - "!type": "fn(string: string, radix?: number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/parseInt", - "!doc": "Parses a string argument and returns an integer of the specified radix or base." - }, - "parseFloat": { - "!type": "fn(string: string) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/parseFloat", - "!doc": "Parses a string argument and returns a floating point number." - }, - "isNaN": { - "!type": "fn(value: number) -> bool", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/isNaN", - "!doc": "Determines whether a value is NaN or not. Be careful, this function is broken. You may be interested in ECMAScript 6 Number.isNaN." - }, - "isFinite": { - "!type": "fn(value: number) -> bool", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/isFinite", - "!doc": "Determines whether the passed value is a finite number." - }, - "eval": { - "!type": "fn(code: string) -> ?", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/eval", - "!doc": "Evaluates JavaScript code represented as a string." - }, - "encodeURI": { - "!type": "fn(uri: string) -> string", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/encodeURI", - "!doc": "Encodes a Uniform Resource Identifier (URI) by replacing each instance of certain characters by one, two, three, or four escape sequences representing the UTF-8 encoding of the character (will only be four escape sequences for characters composed of two \"surrogate\" characters)." - }, - "encodeURIComponent": { - "!type": "fn(uri: string) -> string", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/encodeURIComponent", - "!doc": "Encodes a Uniform Resource Identifier (URI) component by replacing each instance of certain characters by one, two, three, or four escape sequences representing the UTF-8 encoding of the character (will only be four escape sequences for characters composed of two \"surrogate\" characters)." - }, - "decodeURI": { - "!type": "fn(uri: string) -> string", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/decodeURI", - "!doc": "Decodes a Uniform Resource Identifier (URI) previously created by encodeURI or by a similar routine." - }, - "decodeURIComponent": { - "!type": "fn(uri: string) -> string", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/decodeURIComponent", - "!doc": "Decodes a Uniform Resource Identifier (URI) component previously created by encodeURIComponent or by a similar routine." - }, - "Math": { - "E": { - "!type": "number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/E", - "!doc": "The base of natural logarithms, e, approximately 2.718." - }, - "LN2": { - "!type": "number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/LN2", - "!doc": "The natural logarithm of 2, approximately 0.693." - }, - "LN10": { - "!type": "number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/LN10", - "!doc": "The natural logarithm of 10, approximately 2.302." - }, - "LOG2E": { - "!type": "number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/LOG2E", - "!doc": "The base 2 logarithm of E (approximately 1.442)." - }, - "LOG10E": { - "!type": "number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/LOG10E", - "!doc": "The base 10 logarithm of E (approximately 0.434)." - }, - "SQRT1_2": { - "!type": "number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/SQRT1_2", - "!doc": "The square root of 1/2; equivalently, 1 over the square root of 2, approximately 0.707." - }, - "SQRT2": { - "!type": "number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/SQRT2", - "!doc": "The square root of 2, approximately 1.414." - }, - "PI": { - "!type": "number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/PI", - "!doc": "The ratio of the circumference of a circle to its diameter, approximately 3.14159." - }, - "abs": { - "!type": "fn(number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/abs", - "!doc": "Returns the absolute value of a number." - }, - "cos": { - "!type": "fn(number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/cos", - "!doc": "Returns the cosine of a number." - }, - "sin": { - "!type": "fn(number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/sin", - "!doc": "Returns the sine of a number." - }, - "tan": { - "!type": "fn(number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/tan", - "!doc": "Returns the tangent of a number." - }, - "acos": { - "!type": "fn(number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/acos", - "!doc": "Returns the arccosine (in radians) of a number." - }, - "asin": { - "!type": "fn(number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/asin", - "!doc": "Returns the arcsine (in radians) of a number." - }, - "atan": { - "!type": "fn(number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/atan", - "!doc": "Returns the arctangent (in radians) of a number." - }, - "atan2": { - "!type": "fn(y: number, x: number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/atan2", - "!doc": "Returns the arctangent of the quotient of its arguments." - }, - "ceil": { - "!type": "fn(number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/ceil", - "!doc": "Returns the smallest integer greater than or equal to a number." - }, - "floor": { - "!type": "fn(number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/floor", - "!doc": "Returns the largest integer less than or equal to a number." - }, - "round": { - "!type": "fn(number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/round", - "!doc": "Returns the value of a number rounded to the nearest integer." - }, - "exp": { - "!type": "fn(number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/exp", - "!doc": "Returns Ex, where x is the argument, and E is Euler's constant, the base of the natural logarithms." - }, - "log": { - "!type": "fn(number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/log", - "!doc": "Returns the natural logarithm (base E) of a number." - }, - "sqrt": { - "!type": "fn(number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/sqrt", - "!doc": "Returns the square root of a number." - }, - "pow": { - "!type": "fn(number, number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/pow", - "!doc": "Returns base to the exponent power, that is, baseexponent." - }, - "max": { - "!type": "fn(number, number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/max", - "!doc": "Returns the largest of zero or more numbers." - }, - "min": { - "!type": "fn(number, number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/min", - "!doc": "Returns the smallest of zero or more numbers." - }, - "random": { - "!type": "fn() -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/random", - "!doc": "Returns a floating-point, pseudo-random number in the range [0, 1) that is, from 0 (inclusive) up to but not including 1 (exclusive), which you can then scale to your desired range." - }, - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math", - "!doc": "A built-in object that has properties and methods for mathematical constants and functions." - }, - "JSON": { - "parse": { - "!type": "fn(json: string) -> ?", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/JSON/parse", - "!doc": "Parse a string as JSON, optionally transforming the value produced by parsing." - }, - "stringify": { - "!type": "fn(value: ?) -> string", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/JSON/stringify", - "!doc": "Convert a value to JSON, optionally replacing values if a replacer function is specified, or optionally including only the specified properties if a replacer array is specified." - }, - "!url": "https://developer.mozilla.org/en-US/docs/JSON", - "!doc": "JSON (JavaScript Object Notation) is a data-interchange format. It closely resembles a subset of JavaScript syntax, although it is not a strict subset. (See JSON in the JavaScript Reference for full details.) It is useful when writing any kind of JavaScript-based application, including websites and browser extensions. For example, you might store user information in JSON format in a cookie, or you might store extension preferences in JSON in a string-valued browser preference." - } -}; +/******************************************************************************* + * Copyright (c) 2015 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 + *******************************************************************************/ +ecma5defs = { + "!name": "ecma5", + "!define": { + "Error.prototype": "Error.prototype" + }, + "Infinity": { + "!type": "number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Infinity", + "!doc": "A numeric value representing infinity." + }, + "undefined": { + "!type": "?", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/undefined", + "!doc": "The value undefined." + }, + "NaN": { + "!type": "number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/NaN", + "!doc": "A value representing Not-A-Number." + }, + "Object": { + "!type": "fn()", + "getPrototypeOf": { + "!type": "fn(obj: ?) -> ?", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object/getPrototypeOf", + "!doc": "Returns the prototype (i.e. the internal prototype) of the specified object." + }, + "create": { + "!type": "fn(proto: ?) -> !custom:Object_create", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object/create", + "!doc": "Creates a new object with the specified prototype object and properties." + }, + "defineProperty": { + "!type": "fn(obj: ?, prop: string, desc: ?) -> !custom:Object_defineProperty", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object/defineProperty", + "!doc": "Defines a new property directly on an object, or modifies an existing property on an object, and returns the object. If you want to see how to use the Object.defineProperty method with a binary-flags-like syntax, see this article." + }, + "defineProperties": { + "!type": "fn(obj: ?, props: ?) -> !custom:Object_defineProperties", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object/defineProperty", + "!doc": "Defines a new property directly on an object, or modifies an existing property on an object, and returns the object. If you want to see how to use the Object.defineProperty method with a binary-flags-like syntax, see this article." + }, + "getOwnPropertyDescriptor": { + "!type": "fn(obj: ?, prop: string) -> ?", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object/getOwnPropertyDescriptor", + "!doc": "Returns a property descriptor for an own property (that is, one directly present on an object, not present by dint of being along an object's prototype chain) of a given object." + }, + "keys": { + "!type": "fn(obj: ?) -> [string]", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object/keys", + "!doc": "Returns an array of a given object's own enumerable properties, in the same order as that provided by a for-in loop (the difference being that a for-in loop enumerates properties in the prototype chain as well)." + }, + "getOwnPropertyNames": { + "!type": "fn(obj: ?) -> [string]", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object/getOwnPropertyNames", + "!doc": "Returns an array of all properties (enumerable or not) found directly upon a given object." + }, + "seal": { + "!type": "fn(obj: ?)", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object/seal", + "!doc": "Seals an object, preventing new properties from being added to it and marking all existing properties as non-configurable. Values of present properties can still be changed as long as they are writable." + }, + "isSealed": { + "!type": "fn(obj: ?) -> bool", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object/isSealed", + "!doc": "Determine if an object is sealed." + }, + "freeze": { + "!type": "fn(obj: ?) -> !0", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object/freeze", + "!doc": "Freezes an object: that is, prevents new properties from being added to it; prevents existing properties from being removed; and prevents existing properties, or their enumerability, configurability, or writability, from being changed. In essence the object is made effectively immutable. The method returns the object being frozen." + }, + "isFrozen": { + "!type": "fn(obj: ?) -> bool", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object/isFrozen", + "!doc": "Determine if an object is frozen." + }, + "preventExtensions": { + "!type": "fn(obj: ?)", + "!url": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/preventExtensions", + "!doc": "Prevents new properties from ever being added to an object." + }, + "isExtensible": { + "!type": "fn(obj: ?) -> bool", + "!url": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/isExtensible", + "!doc": "The Object.isExtensible() method determines if an object is extensible (whether it can have new properties added to it)." + }, + "prototype": { + "!stdProto": "Object", + "toString": { + "!type": "fn() -> string", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object/toString", + "!doc": "Returns a string representing the object." + }, + "toLocaleString": { + "!type": "fn() -> string", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object/toLocaleString", + "!doc": "Returns a string representing the object. This method is meant to be overriden by derived objects for locale-specific purposes." + }, + "valueOf": { + "!type": "fn() -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object/valueOf", + "!doc": "Returns the primitive value of the specified object" + }, + "hasOwnProperty": { + "!type": "fn(prop: string) -> bool", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object/hasOwnProperty", + "!doc": "Returns a boolean indicating whether the object has the specified property." + }, + "propertyIsEnumerable": { + "!type": "fn(prop: string) -> bool", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object/propertyIsEnumerable", + "!doc": "Returns a Boolean indicating whether the specified property is enumerable." + }, + "isPrototypeOf": { + "!type": "fn(obj: ?) -> bool", + "!url": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/isPrototypeOf", + "!doc": "Tests for an object in another object's prototype chain." + } + }, + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object", + "!doc": "Creates an object wrapper." + }, + "Function": { + "!type": "fn(body: string) -> fn()", + "prototype": { + "!stdProto": "Function", + "apply": { + "!type": "fn(this: ?, args: [?])", + "!effects": [ + "call and return !this this=!0 !1. !1. !1." + ], + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Function/apply", + "!doc": "Calls a function with a given this value and arguments provided as an array (or an array like object)." + }, + "call": { + "!type": "fn(this: ?, args?: ?) -> !this.!ret", + "!effects": [ + "call and return !this this=!0 !1 !2 !3 !4" + ], + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Function/call", + "!doc": "Calls a function with a given this value and arguments provided individually." + }, + "bind": { + "!type": "fn(this: ?, args?: ?) -> !custom:Function_bind", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Function/bind", + "!doc": "Creates a new function that, when called, has its this keyword set to the provided value, with a given sequence of arguments preceding any provided when the new function was called." + }, + "prototype": "?" + }, + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Function", + "!doc": "Every function in JavaScript is actually a Function object." + }, + "Array": { + "!type": "fn(size: number) -> !custom:Array_ctor", + "isArray": { + "!type": "fn(value: ?) -> bool", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/isArray", + "!doc": "Returns true if an object is an array, false if it is not." + }, + "prototype": { + "!stdProto": "Array", + "length": { + "!type": "number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/length", + "!doc": "An unsigned, 32-bit integer that specifies the number of elements in an array." + }, + "concat": { + "!type": "fn(other: [?]) -> !this", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/concat", + "!doc": "Returns a new array comprised of this array joined with other array(s) and/or value(s)." + }, + "join": { + "!type": "fn(separator?: string) -> string", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/join", + "!doc": "Joins all elements of an array into a string." + }, + "splice": { + "!type": "fn(pos: number, amount: number)", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/splice", + "!doc": "Changes the content of an array, adding new elements while removing old elements." + }, + "pop": { + "!type": "fn() -> !this.", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/pop", + "!doc": "Removes the last element from an array and returns that element." + }, + "push": { + "!type": "fn(newelt: ?) -> number", + "!effects": [ + "propagate !0 !this." + ], + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/push", + "!doc": "Mutates an array by appending the given elements and returning the new length of the array." + }, + "shift": { + "!type": "fn() -> !this.", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/shift", + "!doc": "Removes the first element from an array and returns that element. This method changes the length of the array." + }, + "unshift": { + "!type": "fn(newelt: ?) -> number", + "!effects": [ + "propagate !0 !this." + ], + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/unshift", + "!doc": "Adds one or more elements to the beginning of an array and returns the new length of the array." + }, + "slice": { + "!type": "fn(from: number, to?: number) -> !this", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/slice", + "!doc": "Returns a shallow copy of a portion of an array." + }, + "reverse": { + "!type": "fn()", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/reverse", + "!doc": "Reverses an array in place. The first array element becomes the last and the last becomes the first." + }, + "sort": { + "!type": "fn(compare?: fn(a: ?, b: ?) -> number)", + "!effects": [ + "call !0 !this. !this." + ], + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/sort", + "!doc": "Sorts the elements of an array in place and returns the array." + }, + "indexOf": { + "!type": "fn(elt: ?, from?: number) -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/indexOf", + "!doc": "Returns the first index at which a given element can be found in the array, or -1 if it is not present." + }, + "lastIndexOf": { + "!type": "fn(elt: ?, from?: number) -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/lastIndexOf", + "!doc": "Returns the last index at which a given element can be found in the array, or -1 if it is not present. The array is searched backwards, starting at fromIndex." + }, + "every": { + "!type": "fn(test: fn(elt: ?, i: number) -> bool, context?: ?) -> bool", + "!effects": [ + "call !0 this=!1 !this. number" + ], + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/every", + "!doc": "Tests whether all elements in the array pass the test implemented by the provided function." + }, + "some": { + "!type": "fn(test: fn(elt: ?, i: number) -> bool, context?: ?) -> bool", + "!effects": [ + "call !0 this=!1 !this. number" + ], + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/some", + "!doc": "Tests whether some element in the array passes the test implemented by the provided function." + }, + "filter": { + "!type": "fn(test: fn(elt: ?, i: number) -> bool, context?: ?) -> !this", + "!effects": [ + "call !0 this=!1 !this. number" + ], + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/filter", + "!doc": "Creates a new array with all elements that pass the test implemented by the provided function." + }, + "forEach": { + "!type": "fn(f: fn(elt: ?, i: number), context?: ?)", + "!effects": [ + "call !0 this=!1 !this. number" + ], + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/forEach", + "!doc": "Executes a provided function once per array element." + }, + "map": { + "!type": "fn(f: fn(elt: ?, i: number) -> ?, context?: ?) -> [!0.!ret]", + "!effects": [ + "call !0 this=!1 !this. number" + ], + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/map", + "!doc": "Creates a new array with the results of calling a provided function on every element in this array." + }, + "reduce": { + "!type": "fn(combine: fn(sum: ?, elt: ?, i: number) -> ?, init?: ?) -> !0.!ret", + "!effects": [ + "call !0 !1 !this. number" + ], + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/Reduce", + "!doc": "Apply a function against an accumulator and each value of the array (from left-to-right) as to reduce it to a single value." + }, + "reduceRight": { + "!type": "fn(combine: fn(sum: ?, elt: ?, i: number) -> ?, init?: ?) -> !0.!ret", + "!effects": [ + "call !0 !1 !this. number" + ], + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/ReduceRight", + "!doc": "Apply a function simultaneously against two values of the array (from right-to-left) as to reduce it to a single value." + } + }, + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array", + "!doc": "The JavaScript Array global object is a constructor for arrays, which are high-level, list-like objects." + }, + "String": { + "!type": "fn(value: ?) -> string", + "fromCharCode": { + "!type": "fn(code: number) -> string", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/fromCharCode", + "!doc": "Returns a string created by using the specified sequence of Unicode values." + }, + "prototype": { + "!stdProto": "String", + "length": { + "!type": "number", + "!url": "https://developer.mozilla.org/en/docs/JavaScript/Reference/Global_Objects/String/length", + "!doc": "Represents the length of a string." + }, + "": "string", + "charAt": { + "!type": "fn(i: number) -> string", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/charAt", + "!doc": "Returns the specified character from a string." + }, + "charCodeAt": { + "!type": "fn(i: number) -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/charCodeAt", + "!doc": "Returns the numeric Unicode value of the character at the given index (except for unicode codepoints > 0x10000)." + }, + "indexOf": { + "!type": "fn(char: string, from?: number) -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/indexOf", + "!doc": "Returns the index within the calling String object of the first occurrence of the specified value, starting the search at fromIndex,\nreturns -1 if the value is not found." + }, + "lastIndexOf": { + "!type": "fn(char: string, from?: number) -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/lastIndexOf", + "!doc": "Returns the index within the calling String object of the last occurrence of the specified value, or -1 if not found. The calling string is searched backward, starting at fromIndex." + }, + "substring": { + "!type": "fn(from: number, to?: number) -> string", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/substring", + "!doc": "Returns a subset of a string between one index and another, or through the end of the string." + }, + "substr": { + "!type": "fn(from: number, length?: number) -> string", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/substr", + "!doc": "Returns the characters in a string beginning at the specified location through the specified number of characters." + }, + "slice": { + "!type": "fn(from: number, to?: number) -> string", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/slice", + "!doc": "Extracts a section of a string and returns a new string." + }, + "trim": { + "!type": "fn() -> string", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/Trim", + "!doc": "Removes whitespace from both ends of the string." + }, + "toUpperCase": { + "!type": "fn() -> string", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/toUpperCase", + "!doc": "Returns the calling string value converted to uppercase." + }, + "toLowerCase": { + "!type": "fn() -> string", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/toLowerCase", + "!doc": "Returns the calling string value converted to lowercase." + }, + "toLocaleUpperCase": { + "!type": "fn() -> string", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/toLocaleUpperCase", + "!doc": "Returns the calling string value converted to upper case, according to any locale-specific case mappings." + }, + "toLocaleLowerCase": { + "!type": "fn() -> string", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/toLocaleLowerCase", + "!doc": "Returns the calling string value converted to lower case, according to any locale-specific case mappings." + }, + "split": { + "!type": "fn(pattern: string) -> [string]", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/split", + "!doc": "Splits a String object into an array of strings by separating the string into substrings." + }, + "concat": { + "!type": "fn(other: string) -> string", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/concat", + "!doc": "Combines the text of two or more strings and returns a new string." + }, + "localeCompare": { + "!type": "fn(other: string) -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/localeCompare", + "!doc": "Returns a number indicating whether a reference string comes before or after or is the same as the given string in sort order." + }, + "match": { + "!type": "fn(pattern: +RegExp) -> [string]", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/match", + "!doc": "Used to retrieve the matches when matching a string against a regular expression." + }, + "replace": { + "!type": "fn(pattern: string|+RegExp, replacement: string) -> string", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/replace", + "!doc": "Returns a new string with some or all matches of a pattern replaced by a replacement. The pattern can be a string or a RegExp, and the replacement can be a string or a function to be called for each match." + }, + "search": { + "!type": "fn(pattern: +RegExp) -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/search", + "!doc": "Executes the search for a match between a regular expression and this String object." + } + }, + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String", + "!doc": "The String global object is a constructor for strings, or a sequence of characters." + }, + "Number": { + "!type": "fn(value: ?) -> number", + "MAX_VALUE": { + "!type": "number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number/MAX_VALUE", + "!doc": "The maximum numeric value representable in JavaScript." + }, + "MIN_VALUE": { + "!type": "number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number/MIN_VALUE", + "!doc": "The smallest positive numeric value representable in JavaScript." + }, + "POSITIVE_INFINITY": { + "!type": "number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number/POSITIVE_INFINITY", + "!doc": "A value representing the positive Infinity value." + }, + "NEGATIVE_INFINITY": { + "!type": "number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number/NEGATIVE_INFINITY", + "!doc": "A value representing the negative Infinity value." + }, + "prototype": { + "!stdProto": "Number", + "toString": { + "!type": "fn(radix?: number) -> string", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number/toString", + "!doc": "Returns a string representing the specified Number object" + }, + "toFixed": { + "!type": "fn(digits: number) -> string", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number/toFixed", + "!doc": "Formats a number using fixed-point notation" + }, + "toExponential": { + "!type": "fn(digits: number) -> string", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number/toExponential", + "!doc": "Returns a string representing the Number object in exponential notation" + }, + "toPrecision": { + "!type": "fn(digits: number) -> string", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number/toPrecision", + "!doc": "The toPrecision() method returns a string representing the number to the specified precision." + } + }, + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number", + "!doc": "The Number JavaScript object is a wrapper object allowing you to work with numerical values. A Number object is created using the Number() constructor." + }, + "Boolean": { + "!type": "fn(value: ?) -> bool", + "prototype": { + "!stdProto": "Boolean" + }, + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Boolean", + "!doc": "The Boolean object is an object wrapper for a boolean value." + }, + "RegExp": { + "!type": "fn(source: string, flags?: string)", + "prototype": { + "!stdProto": "RegExp", + "exec": { + "!type": "fn(input: string) -> [string]", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/RegExp/exec", + "!doc": "Executes a search for a match in a specified string. Returns a result array, or null." + }, + "test": { + "!type": "fn(input: string) -> bool", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/RegExp/test", + "!doc": "Executes the search for a match between a regular expression and a specified string. Returns true or false." + }, + "global": { + "!type": "bool", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/RegExp", + "!doc": "Creates a regular expression object for matching text with a pattern." + }, + "ignoreCase": { + "!type": "bool", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/RegExp", + "!doc": "Creates a regular expression object for matching text with a pattern." + }, + "multiline": { + "!type": "bool", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/RegExp/multiline", + "!doc": "Reflects whether or not to search in strings across multiple lines.\n" + }, + "source": { + "!type": "string", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/RegExp/source", + "!doc": "A read-only property that contains the text of the pattern, excluding the forward slashes.\n" + }, + "lastIndex": { + "!type": "number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/RegExp/lastIndex", + "!doc": "A read/write integer property that specifies the index at which to start the next match." + } + }, + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/RegExp", + "!doc": "Creates a regular expression object for matching text with a pattern." + }, + "Date": { + "!type": "fn(ms: number)", + "parse": { + "!type": "fn(source: string) -> +Date", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/parse", + "!doc": "Parses a string representation of a date, and returns the number of milliseconds since January 1, 1970, 00:00:00 UTC." + }, + "UTC": { + "!type": "fn(year: number, month: number, date: number, hour?: number, min?: number, sec?: number, ms?: number) -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/UTC", + "!doc": "Accepts the same parameters as the longest form of the constructor, and returns the number of milliseconds in a Date object since January 1, 1970, 00:00:00, universal time." + }, + "now": { + "!type": "fn() -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/now", + "!doc": "Returns the number of milliseconds elapsed since 1 January 1970 00:00:00 UTC." + }, + "prototype": { + "toUTCString": { + "!type": "fn() -> string", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/toUTCString", + "!doc": "Converts a date to a string, using the universal time convention." + }, + "toISOString": { + "!type": "fn() -> string", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/toISOString", + "!doc": "JavaScript provides a direct way to convert a date object into a string in ISO format, the ISO 8601 Extended Format." + }, + "toDateString": { + "!type": "fn() -> string", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/toDateString", + "!doc": "Returns the date portion of a Date object in human readable form in American English." + }, + "toTimeString": { + "!type": "fn() -> string", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/toTimeString", + "!doc": "Returns the time portion of a Date object in human readable form in American English." + }, + "toLocaleDateString": { + "!type": "fn() -> string", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/toLocaleDateString", + "!doc": "Converts a date to a string, returning the \"date\" portion using the operating system's locale's conventions.\n" + }, + "toLocaleTimeString": { + "!type": "fn() -> string", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/toLocaleTimeString", + "!doc": "Converts a date to a string, returning the \"time\" portion using the current locale's conventions." + }, + "getTime": { + "!type": "fn() -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/getTime", + "!doc": "Returns the numeric value corresponding to the time for the specified date according to universal time." + }, + "getFullYear": { + "!type": "fn() -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/getFullYear", + "!doc": "Returns the year of the specified date according to local time." + }, + "getYear": { + "!type": "fn() -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/getYear", + "!doc": "Returns the year in the specified date according to local time." + }, + "getMonth": { + "!type": "fn() -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/getMonth", + "!doc": "Returns the month in the specified date according to local time." + }, + "getUTCMonth": { + "!type": "fn() -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/getUTCMonth", + "!doc": "Returns the month of the specified date according to universal time.\n" + }, + "getDate": { + "!type": "fn() -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/getDate", + "!doc": "Returns the day of the month for the specified date according to local time." + }, + "getUTCDate": { + "!type": "fn() -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/getUTCDate", + "!doc": "Returns the day (date) of the month in the specified date according to universal time.\n" + }, + "getDay": { + "!type": "fn() -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/getDay", + "!doc": "Returns the day of the week for the specified date according to local time." + }, + "getUTCDay": { + "!type": "fn() -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/getUTCDay", + "!doc": "Returns the day of the week in the specified date according to universal time.\n" + }, + "getHours": { + "!type": "fn() -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/getHours", + "!doc": "Returns the hour for the specified date according to local time." + }, + "getUTCHours": { + "!type": "fn() -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/getUTCHours", + "!doc": "Returns the hours in the specified date according to universal time.\n" + }, + "getMinutes": { + "!type": "fn() -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/getMinutes", + "!doc": "Returns the minutes in the specified date according to local time." + }, + "getUTCMinutes": { + "!type": "fn() -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date", + "!doc": "Creates JavaScript Date instances which let you work with dates and times." + }, + "getSeconds": { + "!type": "fn() -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/getSeconds", + "!doc": "Returns the seconds in the specified date according to local time." + }, + "getUTCSeconds": { + "!type": "fn() -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/getUTCSeconds", + "!doc": "Returns the seconds in the specified date according to universal time.\n" + }, + "getMilliseconds": { + "!type": "fn() -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/getMilliseconds", + "!doc": "Returns the milliseconds in the specified date according to local time." + }, + "getUTCMilliseconds": { + "!type": "fn() -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/getUTCMilliseconds", + "!doc": "Returns the milliseconds in the specified date according to universal time.\n" + }, + "getTimezoneOffset": { + "!type": "fn() -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/getTimezoneOffset", + "!doc": "Returns the time-zone offset from UTC, in minutes, for the current locale." + }, + "setTime": { + "!type": "fn(date: +Date) -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/setTime", + "!doc": "Sets the Date object to the time represented by a number of milliseconds since January 1, 1970, 00:00:00 UTC.\n" + }, + "setFullYear": { + "!type": "fn(year: number) -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/setFullYear", + "!doc": "Sets the full year for a specified date according to local time.\n" + }, + "setUTCFullYear": { + "!type": "fn(year: number) -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/setUTCFullYear", + "!doc": "Sets the full year for a specified date according to universal time.\n" + }, + "setMonth": { + "!type": "fn(month: number) -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/setMonth", + "!doc": "Set the month for a specified date according to local time." + }, + "setUTCMonth": { + "!type": "fn(month: number) -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/setUTCMonth", + "!doc": "Sets the month for a specified date according to universal time.\n" + }, + "setDate": { + "!type": "fn(day: number) -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/setDate", + "!doc": "Sets the day of the month for a specified date according to local time." + }, + "setUTCDate": { + "!type": "fn(day: number) -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/setUTCDate", + "!doc": "Sets the day of the month for a specified date according to universal time.\n" + }, + "setHours": { + "!type": "fn(hour: number) -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/setHours", + "!doc": "Sets the hours for a specified date according to local time, and returns the number of milliseconds since 1 January 1970 00:00:00 UTC until the time represented by the updated Date instance." + }, + "setUTCHours": { + "!type": "fn(hour: number) -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/setUTCHours", + "!doc": "Sets the hour for a specified date according to universal time.\n" + }, + "setMinutes": { + "!type": "fn(min: number) -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/setMinutes", + "!doc": "Sets the minutes for a specified date according to local time." + }, + "setUTCMinutes": { + "!type": "fn(min: number) -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/setUTCMinutes", + "!doc": "Sets the minutes for a specified date according to universal time.\n" + }, + "setSeconds": { + "!type": "fn(sec: number) -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/setSeconds", + "!doc": "Sets the seconds for a specified date according to local time." + }, + "setUTCSeconds": { + "!type": "fn(sec: number) -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/setUTCSeconds", + "!doc": "Sets the seconds for a specified date according to universal time.\n" + }, + "setMilliseconds": { + "!type": "fn(ms: number) -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/setMilliseconds", + "!doc": "Sets the milliseconds for a specified date according to local time.\n" + }, + "setUTCMilliseconds": { + "!type": "fn(ms: number) -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/setUTCMilliseconds", + "!doc": "Sets the milliseconds for a specified date according to universal time.\n" + } + }, + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date", + "!doc": "Creates JavaScript Date instances which let you work with dates and times." + }, + "Error": { + "!type": "fn(message: string)", + "prototype": { + "name": { + "!type": "string", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Error/name", + "!doc": "A name for the type of error." + }, + "message": { + "!type": "string", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Error/message", + "!doc": "A human-readable description of the error." + } + }, + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Error", + "!doc": "Creates an error object." + }, + "SyntaxError": { + "!type": "fn(message: string)", + "prototype": "Error.prototype", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/SyntaxError", + "!doc": "Represents an error when trying to interpret syntactically invalid code." + }, + "ReferenceError": { + "!type": "fn(message: string)", + "prototype": "Error.prototype", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/ReferenceError", + "!doc": "Represents an error when a non-existent variable is referenced." + }, + "URIError": { + "!type": "fn(message: string)", + "prototype": "Error.prototype", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/URIError", + "!doc": "Represents an error when a malformed URI is encountered." + }, + "EvalError": { + "!type": "fn(message: string)", + "prototype": "Error.prototype", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/EvalError", + "!doc": "Represents an error regarding the eval function." + }, + "RangeError": { + "!type": "fn(message: string)", + "prototype": "Error.prototype", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/RangeError", + "!doc": "Represents an error when a number is not within the correct range allowed." + }, + "TypeError": { + "!type": "fn(message: string)", + "prototype": "Error.prototype", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/TypeError", + "!doc": "Represents an error an error when a value is not of the expected type." + }, + "parseInt": { + "!type": "fn(string: string, radix?: number) -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/parseInt", + "!doc": "Parses a string argument and returns an integer of the specified radix or base." + }, + "parseFloat": { + "!type": "fn(string: string) -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/parseFloat", + "!doc": "Parses a string argument and returns a floating point number." + }, + "isNaN": { + "!type": "fn(value: number) -> bool", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/isNaN", + "!doc": "Determines whether a value is NaN or not. Be careful, this function is broken. You may be interested in ECMAScript 6 Number.isNaN." + }, + "isFinite": { + "!type": "fn(value: number) -> bool", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/isFinite", + "!doc": "Determines whether the passed value is a finite number." + }, + "eval": { + "!type": "fn(code: string) -> ?", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/eval", + "!doc": "Evaluates JavaScript code represented as a string." + }, + "encodeURI": { + "!type": "fn(uri: string) -> string", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/encodeURI", + "!doc": "Encodes a Uniform Resource Identifier (URI) by replacing each instance of certain characters by one, two, three, or four escape sequences representing the UTF-8 encoding of the character (will only be four escape sequences for characters composed of two \"surrogate\" characters)." + }, + "encodeURIComponent": { + "!type": "fn(uri: string) -> string", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/encodeURIComponent", + "!doc": "Encodes a Uniform Resource Identifier (URI) component by replacing each instance of certain characters by one, two, three, or four escape sequences representing the UTF-8 encoding of the character (will only be four escape sequences for characters composed of two \"surrogate\" characters)." + }, + "decodeURI": { + "!type": "fn(uri: string) -> string", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/decodeURI", + "!doc": "Decodes a Uniform Resource Identifier (URI) previously created by encodeURI or by a similar routine." + }, + "decodeURIComponent": { + "!type": "fn(uri: string) -> string", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/decodeURIComponent", + "!doc": "Decodes a Uniform Resource Identifier (URI) component previously created by encodeURIComponent or by a similar routine." + }, + "Math": { + "E": { + "!type": "number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/E", + "!doc": "The base of natural logarithms, e, approximately 2.718." + }, + "LN2": { + "!type": "number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/LN2", + "!doc": "The natural logarithm of 2, approximately 0.693." + }, + "LN10": { + "!type": "number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/LN10", + "!doc": "The natural logarithm of 10, approximately 2.302." + }, + "LOG2E": { + "!type": "number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/LOG2E", + "!doc": "The base 2 logarithm of E (approximately 1.442)." + }, + "LOG10E": { + "!type": "number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/LOG10E", + "!doc": "The base 10 logarithm of E (approximately 0.434)." + }, + "SQRT1_2": { + "!type": "number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/SQRT1_2", + "!doc": "The square root of 1/2; equivalently, 1 over the square root of 2, approximately 0.707." + }, + "SQRT2": { + "!type": "number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/SQRT2", + "!doc": "The square root of 2, approximately 1.414." + }, + "PI": { + "!type": "number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/PI", + "!doc": "The ratio of the circumference of a circle to its diameter, approximately 3.14159." + }, + "abs": { + "!type": "fn(number) -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/abs", + "!doc": "Returns the absolute value of a number." + }, + "cos": { + "!type": "fn(number) -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/cos", + "!doc": "Returns the cosine of a number." + }, + "sin": { + "!type": "fn(number) -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/sin", + "!doc": "Returns the sine of a number." + }, + "tan": { + "!type": "fn(number) -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/tan", + "!doc": "Returns the tangent of a number." + }, + "acos": { + "!type": "fn(number) -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/acos", + "!doc": "Returns the arccosine (in radians) of a number." + }, + "asin": { + "!type": "fn(number) -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/asin", + "!doc": "Returns the arcsine (in radians) of a number." + }, + "atan": { + "!type": "fn(number) -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/atan", + "!doc": "Returns the arctangent (in radians) of a number." + }, + "atan2": { + "!type": "fn(y: number, x: number) -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/atan2", + "!doc": "Returns the arctangent of the quotient of its arguments." + }, + "ceil": { + "!type": "fn(number) -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/ceil", + "!doc": "Returns the smallest integer greater than or equal to a number." + }, + "floor": { + "!type": "fn(number) -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/floor", + "!doc": "Returns the largest integer less than or equal to a number." + }, + "round": { + "!type": "fn(number) -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/round", + "!doc": "Returns the value of a number rounded to the nearest integer." + }, + "exp": { + "!type": "fn(number) -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/exp", + "!doc": "Returns Ex, where x is the argument, and E is Euler's constant, the base of the natural logarithms." + }, + "log": { + "!type": "fn(number) -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/log", + "!doc": "Returns the natural logarithm (base E) of a number." + }, + "sqrt": { + "!type": "fn(number) -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/sqrt", + "!doc": "Returns the square root of a number." + }, + "pow": { + "!type": "fn(number, number) -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/pow", + "!doc": "Returns base to the exponent power, that is, baseexponent." + }, + "max": { + "!type": "fn(number, number) -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/max", + "!doc": "Returns the largest of zero or more numbers." + }, + "min": { + "!type": "fn(number, number) -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/min", + "!doc": "Returns the smallest of zero or more numbers." + }, + "random": { + "!type": "fn() -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/random", + "!doc": "Returns a floating-point, pseudo-random number in the range [0, 1) that is, from 0 (inclusive) up to but not including 1 (exclusive), which you can then scale to your desired range." + }, + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math", + "!doc": "A built-in object that has properties and methods for mathematical constants and functions." + }, + "JSON": { + "parse": { + "!type": "fn(json: string) -> ?", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/JSON/parse", + "!doc": "Parse a string as JSON, optionally transforming the value produced by parsing." + }, + "stringify": { + "!type": "fn(value: ?) -> string", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/JSON/stringify", + "!doc": "Convert a value to JSON, optionally replacing values if a replacer function is specified, or optionally including only the specified properties if a replacer array is specified." + }, + "!url": "https://developer.mozilla.org/en-US/docs/JSON", + "!doc": "JSON (JavaScript Object Notation) is a data-interchange format. It closely resembles a subset of JavaScript syntax, although it is not a strict subset. (See JSON in the JavaScript Reference for full details.) It is useful when writing any kind of JavaScript-based application, including websites and browser extensions. For example, you might store user information in JSON format in a cookie, or you might store extension preferences in JSON in a string-valued browser preference." + } +}; diff --git a/qt/org.eclipse.cdt.qt.core/tern-qml/package.json b/qt/org.eclipse.cdt.qt.core/tern-qml/package.json index 785e0766026..a4009deafdb 100644 --- a/qt/org.eclipse.cdt.qt.core/tern-qml/package.json +++ b/qt/org.eclipse.cdt.qt.core/tern-qml/package.json @@ -1,20 +1,20 @@ -{ - "name": "tern-qt", - "description": "Tern Qt Plugin", - "version": "0.0.0", - "license": "EPL-1.0", - "scripts": { - "test": "node test/run.js" - }, - "dependencies": { - "tern": "^0.16.0", - "acorn": "^2.6.4", - "acorn-qml": "../acorn-qml" - }, - "devDependencies": { - "test": ">=0.0.5", - "codemirror": "^5.6.0", - "codemirror-extension": "^0.1.0", - "codemirror-javascript": "^0.1.0" - } +{ + "name": "tern-qt", + "description": "Tern Qt Plugin", + "version": "0.0.0", + "license": "EPL-1.0", + "scripts": { + "test": "node test/run.js" + }, + "dependencies": { + "tern": "^0.16.0", + "acorn": "^2.6.4", + "acorn-qml": "../acorn-qml" + }, + "devDependencies": { + "test": ">=0.0.5", + "codemirror": "^5.6.0", + "codemirror-extension": "^0.1.0", + "codemirror-javascript": "^0.1.0" + } } \ No newline at end of file diff --git a/qt/org.eclipse.cdt.qt.core/tern-qml/qml.js b/qt/org.eclipse.cdt.qt.core/tern-qml/qml.js index 9aaf81bcfd1..2706b63e281 100644 --- a/qt/org.eclipse.cdt.qt.core/tern-qml/qml.js +++ b/qt/org.eclipse.cdt.qt.core/tern-qml/qml.js @@ -1,1033 +1,1033 @@ -/******************************************************************************* - * Copyright (c) 2015 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 - *******************************************************************************/ -(function (root, mod) { - if (typeof exports === "object" && typeof module === "object") // CommonJS - return mod(exports, require("acorn"), require("acorn/dist/acorn_loose"), require("acorn/dist/walk"), - require("acorn-qml"), require("acorn-qml/loose"), require("acorn-qml/walk"), require("tern"), - require("tern/lib/infer"), require("tern/lib/signal")); - if (typeof define === "function" && define.amd) // AMD - return define(["exports", "acorn/dist/acorn", "acorn/dist/acorn_loose", "acorn/dist/walk", "acorn-qml", - "acorn-qml/loose", "acorn-qml/walk", "tern", "tern/lib/infer", "tern/lib/signal"], mod); - mod(root.ternQML || (root.ternQML = {}), acorn, acorn, acorn.walk, acorn, acorn, acorn.walk, tern, tern, tern.signal); // Plain browser env -})(this, function (exports, acorn, acornLoose, walk, acornQML, acornQMLLoose, acornQMLWalk, tern, infer, signal) { - 'use strict'; - - // Grab 'def' from 'infer' (used for jsDefs) - var def = infer.def; - - // 'extend' taken from infer.js - function extend(proto, props) { - var obj = Object.create(proto); - if (props) { - for (var prop in props) obj[prop] = props[prop]; - } - return obj; - } - - // QML Import Handler - var qmlImportHandler = exports.importHandler = null; - var ImportHandler = function (server) { - this.server = server; - this.imports = null; - }; - ImportHandler.prototype = { - reset: function () { - this.imports = null; - }, - resolveDirectory: function (file, path) { - var impl = this.server.options.resolveDirectory; - if (impl) { - return impl(file, path); - } - // Getting to this point means that we were unable to find an implementation of - // the 'resolveDirectory' method. The only time this should happen is during - // a test case which we expect to have an import of the style "./ ..." and nothing - // else. This method will simply remove the './', add the file's base, and return. - if (!path) { - // If no path was specified, return the base directory of the file - var dir = file.name; - dir = dir.substring(0, dir.lastIndexOf("/") + 1); - return dir; - } - if (path.substring(0, 2) === "./") { - path = file.directory + path.substring(2); - } - if (path.substr(path.length - 1, 1) !== "/") { - path = path + "/"; - } - return path; - }, - resolveModule: function (module) { - var impl = this.server.options.resolveModule; - if (impl) { - return impl(module); - } - }, - updateDirectoryImportList: function () { - if (!this.imports) { - this.imports = {}; - } - var dir, f; - var seenDirs = {}; - for (var i = 0; i < this.server.files.length; i++) { - var file = this.server.files[i]; - dir = file.directory; - f = file.nameExt; - if (!dir) { - // Resolve the directory name and file name/extension - dir = file.directory = this.resolveDirectory(file, null); - f = file.nameExt = this.getFileNameAndExtension(file); - } - seenDirs[dir] = true; - // No file scope means the file was recently added/changed and we should - // update its import reference - if (!file.scope) { - // Check for a valid QML Object Identifier - if (f.extension === "qml") { - var ch = f.name.charAt(0); - if (ch.toUpperCase() === ch && f.name.indexOf(".") === -1) { - // Create the array for this directory if necessary - if (!this.imports[dir]) { - this.imports[dir] = {}; - } - - // Create an Obj to represent this import - var obj = new infer.Obj(null, f.name); - obj.origin = file.name; - this.imports[dir][f.name] = obj; - } - } - } - } - for (dir in this.imports) { - if (!(dir in seenDirs)) { - this.imports[dir] = undefined; - } - } - }, - getFileNameAndExtension: function (file) { - var fileName = file.name.substring(file.name.lastIndexOf("/") + 1); - var dot = fileName.lastIndexOf("."); - return { - name: dot >= 0 ? fileName.substring(0, dot) : fileName, - extension: fileName.substring(dot + 1) - }; - }, - resolveObject: function (loc, name) { - return loc[name]; - }, - defineImport: function (scope, loc, name, obj) { - var prop = scope.defProp(name); - var objRef = new ObjRef(loc, name, this); - prop.objType = objRef; - objRef.propagate(prop); - }, - defineImports: function (file, scope) { - scope = scope || file.scope; - - // Add any imports from the current directory - var imports = this.imports[file.directory]; - var f = file.nameExt; - if (imports) { - for (var name in imports) { - if (f.name !== name) { - this.defineImport(scope, imports, name, imports[name]); - } - } - } - - // Walk the AST for any imports - var ih = this; - walk.simple(file.ast, { - QMLImport: function (node) { - var prop = null; - var scope = file.scope; - if (node.qualifier) { - prop = file.scope.defProp(node.qualifier.id.name, node.qualifier.id); - prop.origin = file.name; - var obj = new infer.Obj(null, node.qualifier.id.name); - obj.propagate(prop); - prop.objType = obj; - scope = obj; - } - if (node.directory) { - var dir = ih.resolveDirectory(file, node.directory.value); - var imports = ih.imports[dir]; - if (imports) { - for (var name in imports) { - ih.defineImport(scope, imports, name, imports[name]); - } - } - } - } - }); - }, - createQMLObjectType: function (file, node, isRoot) { - // Find the imported object - var obj = this.getQMLObjectType(file, node.id); - // If this is the root, connect the imported object to the root object - if (isRoot) { - var tmp = this.getRootQMLObjectType(file, node.id); - if (tmp) { - // Hook up the Obj Reference - tmp.proto = obj; - obj = tmp; - obj.originNode = node.id; - - // Break any cyclic dependencies - while ((tmp = tmp.proto)) { - if (tmp.resolve() == obj.resolve()) { - tmp.proto = null; - } - } - } - } - return obj; - }, - getQMLObjectType: function (file, qid) { - var prop = findProp(qid, file.scope); - if (prop) { - return prop.objType; - } - return new infer.Obj(null, qid.name); - }, - getRootQMLObjectType: function (file, qid) { - var f = file.nameExt; - var imports = this.imports[file.directory]; - if (imports && imports[f.name]) { - return imports[f.name]; - } - return new infer.Obj(null, qid.name); - } - }; - - // 'isInteger' taken from infer.js - function isInteger(str) { - var c0 = str.charCodeAt(0); - if (c0 >= 48 && c0 <= 57) return !/\D/.test(str); - else return false; - } - - /* - * We have to redefine 'hasProp' to make it work with our scoping. The original 'hasProp' - * function checked proto.props instead of using proto.hasProp. - */ - infer.Obj.prototype.hasProp = function (prop, searchProto) { - if (isInteger(prop)) prop = this.normalizeIntegerProp(prop); - var found = this.props[prop]; - if (searchProto !== false && this.proto && !found) - found = this.proto.hasProp(prop, true); - return found; - }; - - // Creating a resolve function on 'infer.Obj' so we can simplify some of our 'ObjRef' logic - infer.Obj.prototype.resolve = function () { - return this; - }; - - /* - * QML Object Reference - * - * An ObjRef behaves exactly the same as an ordinary 'infer.Obj' object, except that it - * mirrors its internal state to a referenced object. This object is resolved by the QML - * Import Handler each time the ObjRef is accessed (including getting and setting internal - * variables). In theory this means we don't have to know at runtime whether or not an - * object is an ObjRef or an infer.Obj. - */ - var ObjRef = function (loc, lookup, ih) { - // Using underscores for property names so we don't accidentally collide with any - // 'infer.Obj' property names (which would cause a stack overflow if we were to - // try to access them here). - this._loc = loc; - this._objLookup = lookup; - this._ih = ih; - var obj = this.resolve(); - // Use Object.defineProperty to setup getter and setter methods that delegate - // to the resolved object's properties. We only need to do this once since all - // 'infer.Obj' objects should have the same set of property names. - for (var propertyName in obj) { - if (!(obj[propertyName] instanceof Function)) { - (function () { - var prop = propertyName; - Object.defineProperty(this, prop, { - enumerable: true, - get: function () { - return this.resolve()[prop]; - }, - set: function (value) { - this.resolve()[prop] = value; - } - }); - }).call(this); - } - } - }; - ObjRef.prototype = extend(infer.Type.prototype, { - resolve: function () { - return this._ih.resolveObject(this._loc, this._objLookup); - } - }); - (function () { - // Wire up all base functions to use the resolved object's implementation - for (var _func in infer.Obj.prototype) { - if (_func !== "resolve") { - (function () { - var fn = _func; - ObjRef.prototype[fn] = function () { - return this.resolve()[fn](arguments[0], arguments[1], arguments[2], arguments[3]); - }; - })(); - } - } - })(); - - /* - * QML Object Scope (inherits methods from infer.Scope) - * - * A QML Object Scope does not contain its own properties. Instead, its properties - * are defined in its given Object Type and resolved from there. Any properties - * defined within the Object Type are visible without qualifier to any downstream - * scopes. - */ - var QMLObjScope = exports.QMLObjScope = function (prev, originNode, objType) { - infer.Scope.call(this, prev, originNode, false); - this.objType = objType; - }; - QMLObjScope.prototype = extend(infer.Scope.prototype, { - hasProp: function (prop, searchProto) { - // Search for a property in the Object type. - // Always search the Object Type's prototype as well - var found = this.objType.hasProp(prop, true); - if (found) { - return found; - } - - // Search for a property in the prototype (previous scope) - if (this.proto && searchProto !== false) { - return this.proto.hasProp(prop, searchProto); - } - }, - defProp: function (prop, originNode) { - return this.objType.defProp(prop, originNode); - }, - removeProp: function (prop) { - return this.objType.removeProp(prop); - }, - gatherProperties: function (f, depth) { - // Gather properties from the Object Type and its prototype(s) - var obj = this.objType; - var callback = function (prop, obj, d) { - f(prop, obj, depth); - }; - while (obj) { - obj.gatherProperties(callback, depth); - obj = obj.proto; - } - // gather properties from the prototype (previous scope) - if (this.proto) { - this.proto.gatherProperties(f, depth + 1); - } - } - }); - - /* - * QML Member Scope (inherits methods from infer.Scope) - * - * A QML Member Scope is a bit of a special case when it comes to QML scoping. Like - * the QML Object Scope, it does not contain any properties of its own. The reason - * that it is special is it only gathers properties from its immediate predecessor - * that aren't functions (i.e. They don't have the 'isFunction' flag set. The - * 'isFunction' flag is created by QML signal properties and JavaScript functions - * that are QML Members.) - */ - var QMLMemScope = exports.QMLMemScope = function (prev, originNode, fileScope) { - infer.Scope.call(this, prev, originNode, false); - this.fileScope = fileScope; - }; - QMLMemScope.prototype = extend(infer.Scope.prototype, { - hasProp: function (prop, searchProto) { - // Search for a property in the prototype - var found = null; - if (this.proto) { - // Don't continue searching after the previous scope - found = this.proto.hasProp(prop, false); - if (found && !found.isFunction) { - return found; - } - } - - // Search for a property in the file Scope - if (this.fileScope) { - return this.fileScope.hasProp(prop, searchProto); - } - }, - defProp: function (prop, originNode) { - return this.prev.defProp(prop, originNode); - }, - removeProp: function (prop) { - return this.prev.removeProp(prop); - }, - gatherProperties: function (f, depth) { - // Gather properties from the prototype (previous scope) - var found = null; - if (this.proto) { - this.proto.gatherProperties(function (prop, obj, d) { - // Don't continue passed the predecessor by checking depth - if (d === depth) { - var propObj = obj.hasProp(prop); - if (propObj && !propObj.isFunction) { - f(prop, obj, d); - } - } - }, depth); - } - // Gather properties from the file Scope - this.fileScope.gatherProperties(f, depth); - } - }); - - /* - * QML JavaScript Scope (inherits methods from infer.Scope) - * - * A QML JavaScript Scope also contains references to the file's ID Scope, the global - * JavaScript Scope, and a possible function parameter scope. Most likely, this - * scope will not contain its own properties. The resolution order for 'getProp' and - * 'hasProp' are: - * 1. The ID Scope - * 2. This Scope's properties - * 3. The Function Scope (if it exists) - * 4. The JavaScript Scope - * 5. The Previous Scope in the chain - */ - var QMLJSScope = exports.QMLJSScope = function (prev, originNode, idScope, jsScope, fnScope) { - infer.Scope.call(this, prev, originNode, false); - this.idScope = idScope; - this.jsScope = jsScope; - this.fnScope = fnScope; - }; - QMLJSScope.prototype = extend(infer.Scope.prototype, { - hasProp: function (prop, searchProto) { - if (isInteger(prop)) { - prop = this.normalizeIntegerProp(prop); - } - // Search the ID scope - var found = null; - if (this.idScope) { - found = this.idScope.hasProp(prop, searchProto); - } - // Search the current scope - if (!found) { - found = this.props[prop]; - } - // Search the Function Scope - if (!found && this.fnScope) { - found = this.fnScope.hasProp(prop, searchProto); - } - // Search the JavaScript Scope - if (!found && this.jsScope) { - found = this.jsScope.hasProp(prop, searchProto); - } - // Search the prototype (previous scope) - if (!found && this.proto && searchProto !== false) { - found = this.proto.hasProp(prop, searchProto); - } - return found; - }, - gatherProperties: function (f, depth) { - // Gather from the ID Scope - if (this.idScope) { - this.idScope.gatherProperties(f, depth); - } - // Gather from the current scope - for (var prop in this.props) { - f(prop, this, depth); - } - // Gather from the Function Scope - if (this.fnScope) { - this.fnScope.gatherProperties(f, depth); - } - // Gather from the JS Scope - if (this.jsScope) { - this.jsScope.gatherProperties(f, depth); - } - // Gather from the prototype (previous scope) - if (this.proto) { - this.proto.gatherProperties(f, depth + 1); - } - } - }); - - // QML Scope Builder - var ScopeBuilder = function (file, jsDefs) { - // File Scope - this.scope = file.scope; - this.file = file; - // ID Scope - this.idScope = new infer.Scope(); - this.idScope.name = ""; - // JavaScript Scope - this.jsScope = new infer.Scope(); - this.jsScope.name = ""; - var curOrigin = infer.cx().curOrigin; - for (var i = 0; i < jsDefs.length; ++i) { - def.load(jsDefs[i], this.jsScope); - } - infer.cx().curOrigin = curOrigin; - }; - ScopeBuilder.prototype = { - newObjScope: function (node) { - var obj = qmlImportHandler.createQMLObjectType(this.file, node, !this.rootScope); - var scope = new QMLObjScope(this.rootScope || this.scope, node, obj); - scope.name = ""; - if (!this.rootScope) { - this.rootScope = scope; - } - return scope; - }, - getIDScope: function () { - return this.idScope; - }, - newMemberScope: function (objScope, node) { - var memScope = new QMLMemScope(objScope, node, this.scope); - memScope.name = ""; - return memScope; - }, - newJSScope: function (scope, node, fnScope) { - var jsScope = new QMLJSScope(scope, node, this.idScope, this.jsScope, fnScope); - jsScope.name = ""; - return jsScope; - }, - }; - - // Helper for adding a variable to a scope. - function addVar(scope, node) { - return scope.defProp(node.name, node); - } - - // Helper for finding a property in a scope. - function findProp(node, scope, pos) { - if (pos === null || pos === undefined || pos < 0) { - pos = Number.MAX_VALUE; - } - if (node.type === "QMLQualifiedID") { - return (function recurse(i, prop) { - if (i >= node.parts.length || pos < node.parts[i].start) { - return prop; - } - if (!prop) { - prop = scope.hasProp(node.parts[i].name); - if (prop) { - return recurse(i + 1, prop); - } - } else { - var obj = prop.getType(); - if (obj) { - var p = obj.hasProp(node.parts[i].name); - if (p) { - return recurse(i + 1, p); - } - } - } - return null; - })(0, null); - } else if (node.type === "Identifier") { - return scope.hasProp(node.name); - } - return null; - } - - // Helper for getting the current context's scope builder - function getScopeBuilder() { - return infer.cx().qmlScopeBuilder; - } - - // 'infer' taken from infer.js - function inf(node, scope, out, name) { - var handler = infer.inferExprVisitor[node.type]; - return handler ? handler(node, scope, out, name) : infer.ANull; - } - - // Infers the property's type from its given primitive value - function infKind(kind, out) { - // TODO: infer list type - if (kind.primitive) { - switch (kind.id.name) { - case "int": - case "double": - case "real": - infer.cx().num.propagate(out); - break; - case "string": - case "color": - infer.cx().str.propagate(out); - break; - case "boolean": - infer.cx().bool.propagate(out); - break; - } - } - } - - // 'ret' taken from infer.js - function ret(f) { - return function (node, scope, out, name) { - var r = f(node, scope, name); - if (out) r.propagate(out); - return r; - }; - } - - // 'fill' taken from infer.js - function fill(f) { - return function (node, scope, out, name) { - if (!out) out = new infer.AVal(); - f(node, scope, out, name); - return out; - }; - } - - // Helper method to get the last index of an array - function getLastIndex(arr) { - return arr[arr.length - 1]; - } - - // Helper method to get the signal handler name of a signal function - function getSignalHandlerName(str) { - return "on" + str.charAt(0).toUpperCase() + str.slice(1); - } - - // Object which holds two scopes. Used to store both the Member Scope and Object - // Scope for QML Property Bindings and Declarations. - function Scopes(obj, mem) { - this.object = obj; - this.member = mem; - } - - // Helper to add functionality to a set of walk methods - function extendWalk(walker, funcs) { - for (var prop in funcs) { - walker[prop] = funcs[prop]; - } - } - - function extendTernScopeGatherer(scopeGatherer) { - // Extend the Tern scopeGatherer to build up our custom QML scoping - extendWalk(scopeGatherer, { - QMLObjectDefinition: function (node, scope, c) { - var inner = node.scope = getScopeBuilder().newObjScope(node); - c(node.body, inner); - }, - QMLObjectBinding: function (node, scope, c) { - var inner = node.scope = getScopeBuilder().newObjScope(node); - c(node.body, inner); - }, - QMLObjectInitializer: function (node, scope, c) { - var memScope = node.scope = getScopeBuilder().newMemberScope(scope, node); - for (var i = 0; i < node.members.length; i++) { - var member = node.members[i]; - if (member.type === "FunctionDeclaration") { - c(member, scope); - - // Insert the JavaScript scope after the Function has had a chance to build it's own scope - var jsScope = getScopeBuilder().newJSScope(scope, member, member.scope); - jsScope.fnType = member.scope.fnType; - member.scope.prev = member.scope.proto = null; - member.scope = jsScope; - - // Indicate that the property is a function - var prop = scope.hasProp(member.id.name); - if (prop) { - prop.isFunction = true; - } - } else if (member.type === "QMLPropertyDeclaration" || member.type === "QMLPropertyBinding") { - c(member, new Scopes(scope, memScope)); - } else { - c(member, scope); - } - } - }, - QMLPropertyDeclaration: function (node, scopes, c) { - var prop = addVar(scopes.member, node.id); - if (node.binding) { - c(node.binding, scopes.object); - } - }, - QMLPropertyBinding: function (node, scopes, c) { - // Check for the 'id' property being set - if (node.id.name == "id") { - if (node.binding.type === "QMLScriptBinding") { - var binding = node.binding; - if (!binding.block && binding.script.type === "Identifier") { - node.prop = addVar(getScopeBuilder().getIDScope(), binding.script); - } - } - } - // Delegate down to the expression - c(node.binding, scopes.object); - }, - QMLScriptBinding: function (node, scope, c) { - var inner = node.scope = getScopeBuilder().newJSScope(scope, node); - c(node.script, inner); - }, - QMLStatementBlock: function (node, scope, c) { - var inner = getScopeBuilder().newJSScope(scope, node); - node.scope = inner; - for (var i = 0; i < node.body.length; i++) { - c(node.body[i], inner, "Statement"); - } - }, - QMLSignalDefinition: function (node, scope, c) { - // Scope Builder - var sb = getScopeBuilder(); - - // Define the signal arguments in their own separate scope - var argNames = []; - var argVals = []; - var sigScope = new infer.Scope(null, node); - for (var i = 0; i < node.params.length; i++) { - var param = node.params[i]; - argNames.push(param.id.name); - argVals.push(addVar(sigScope, param.id)); - } - - // Define the signal function type which can be referenced from JavaScript - var sig = addVar(scope, node.id); - sig.isFunction = true; - sig.sigType = new infer.Fn(node.id.name, new infer.AVal(), argVals, argNames, infer.ANull); - sig.sigType.sigScope = sigScope; - - // Define the signal handler property - var handler = scope.defProp(getSignalHandlerName(node.id.name), node.id); - handler.sig = sig.sigType; - } - }); - } - - function extendTernInferExprVisitor(inferExprVisitor) { - // Extend the inferExprVisitor methods - extendWalk(inferExprVisitor, { - QMLStatementBlock: ret(function (node, scope, name) { - return infer.ANull; // TODO: check return statements - }), - QMLScriptBinding: fill(function (node, scope, out, name) { - return inf(node.script, node.scope, out, name); - }), - QMLObjectBinding: ret(function (node, scope, name) { - return node.scope.objType; - }), - QMLArrayBinding: ret(function (node, scope, name) { - return new infer.Arr(null); // TODO: populate with type of array contents - }) - }); - } - - function extendTernInferWrapper(inferWrapper) { - // Extend the inferWrapper methods - extendWalk(inferWrapper, { - QMLObjectDefinition: function (node, scope, c) { - c(node.body, node.scope); - }, - QMLObjectBinding: function (node, scope, c) { - c(node.body, node.scope); - }, - QMLObjectInitializer: function (node, scope, c) { - for (var i = 0; i < node.members.length; i++) { - var member = node.members[i]; - if (member.type === "QMLPropertyDeclaration" || member.type === "QMLPropertyBinding") { - c(member, new Scopes(scope, node.scope)); - } else { - c(member, scope); - } - } - }, - QMLPropertyDeclaration: function (node, scopes, c) { - var prop = findProp(node.id, scopes.member); - if (prop) { - infKind(node.kind, prop); - if (node.binding) { - c(node.binding, scopes.object); - inf(node.binding, scopes.object, prop, node.id.name); - } - } - }, - QMLPropertyBinding: function (node, scopes, c) { - c(node.binding, scopes.object); - // Check for the 'id' property being set - if (node.id.name === "id") { - if (node.binding.type === "QMLScriptBinding") { - var binding = node.binding; - if (binding.script.type === "Identifier") { - scopes.object.objType.propagate(node.prop); - } - } - } else { - var prop = findProp(node.id, scopes.member); - if (prop) { - if (prop.sig) { - // This is a signal handler - node.binding.scope.fnScope = prop.sig.sigScope; - } else { - inf(node.binding, scopes.object, prop, getLastIndex(node.id.parts)); - } - } - } - }, - QMLScriptBinding: function (node, scope, c) { - c(node.script, node.scope); - }, - QMLStatementBlock: function (node, scope, c) { - for (var i = 0; i < node.body.length; i++) { - c(node.body[i], node.scope, "Statement"); - } - }, - QMLSignalDefinition: function (node, scope, c) { - var sig = scope.getProp(node.id.name); - for (var i = 0; i < node.params.length; i++) { - var param = node.params[i]; - infKind(param.kind, sig.sigType.args[i]); - } - sig.sigType.retval = infer.ANull; - sig.sigType.propagate(sig); - - var handler = scope.getProp(getSignalHandlerName(node.id.name)); - var obj = new infer.Obj(true, "Signal Handler"); - obj.propagate(handler); - } - }); - } - - function extendTernTypeFinder(typeFinder) { - // Extend the type finder to return valid types for QML AST elements - extendWalk(typeFinder, { - QMLObjectDefinition: function (node, scope) { - return node.scope.objType; - }, - QMLObjectBinding: function (node, scope) { - return node.scope.objType; - }, - QMLObjectInitializer: function (node, scope) { - return infer.ANull; - }, - FunctionDeclaration: function (node, scope) { - // Quick little hack to get 'findExprAt' to find a Function Declaration which - // is a QML Object Member. All other Function Declarations are ignored. - return scope.name === "" ? infer.ANull : undefined; - }, - QMLScriptBinding: function (node, scope) { - // Trick Tern into thinking this node is a type so that it will use - // this node's scope when handling improperly written script bindings - return infer.ANull; - }, - QMLQualifiedID: function (node, scope) { - return findProp(node, scope) || infer.ANull; - }, - QML_ID: function (node, scope) { - // Reverse the hack from search visitor before finding the property in - // the id scope - node.type = "Identifier"; - return findProp(node, getScopeBuilder().getIDScope()); - } - }); - } - - function extendTernSearchVisitor(searchVisitor) { - // Extend the search visitor to traverse the scope properly - extendWalk(searchVisitor, { - QMLObjectDefinition: function (node, scope, c) { - c(node.body, node.scope); - }, - QMLObjectBinding: function (node, scope, c) { - c(node.body, node.scope); - }, - QMLObjectInitializer: function (node, scope, c) { - for (var i = 0; i < node.members.length; i++) { - var member = node.members[i]; - if (member.type === "QMLPropertyDeclaration" || member.type === "QMLPropertyBinding") { - c(member, new Scopes(scope, node.scope)); - } else { - c(member, scope); - } - } - }, - QMLSignalDefinition: function (node, scope, c) { - c(node.id, scope); - }, - QMLPropertyDeclaration: function (node, scopes, c) { - c(node.id, scopes.member); - if (node.binding) { - c(node.binding, scopes.object); - } - }, - QMLPropertyBinding: function (node, scopes, c) { - if (node.id.name === "id") { - if (node.binding.type === "QMLScriptBinding") { - var binding = node.binding; - if (binding.script.type === "Identifier") { - // Hack to bypass Tern's type finding algorithm which uses node.type instead - // of the overriden type. - binding.script.type = "QML_ID"; - c(binding.script, binding.scope, "QML_ID"); - binding.script.type = "Identifier"; - } - } - var prop = findProp(node.id, scopes.member); - if (!prop) { - return; - } - } - c(node.id, scopes.member); - c(node.binding, scopes.object); - }, - QMLScriptBinding: function (node, scope, c) { - c(node.script, node.scope); - }, - QML_ID: function (node, st, c) { - // Ignore - }, - QMLStatementBlock: function (node, scope, c) { - for (var i = 0; i < node.body.length; i++) { - c(node.body[i], node.scope, "Statement"); - } - } - }); - } - - /* - * Prepares acorn to consume QML syntax rather than standard JavaScript - */ - function preParse(text, options) { - // Force ECMA Version to 5 - options.ecmaVersion = 5; - - // Register qml plugin with main parser - var plugins = options.plugins; - if (!plugins) plugins = options.plugins = {}; - plugins.qml = true; - - // Register qml plugin with loose parser - var pluginsLoose = options.pluginsLoose; - if (!pluginsLoose) pluginsLoose = options.pluginsLoose = {}; - pluginsLoose.qml = true; - } - - /* - * Initializes the file's top level scope and creates a ScopeBuilder to facilitate - * the creation of QML scopes. - */ - function beforeLoad(file) { - // We dont care for the Context's top scope - file.scope = null; - - // Update the ImportHandler - qmlImportHandler.updateDirectoryImportList(); - - // Create the file's top scope - file.scope = new infer.Scope(infer.cx().topScope); - var name = file.name; - var end = file.name.lastIndexOf(".qml"); - file.scope.name = end > 0 ? name.substring(0, end) : name; - - // Get the ImportHandler to define imports for us - qmlImportHandler.defineImports(file, file.scope); - - // Create the ScopeBuilder - var sb = new ScopeBuilder(file, infer.cx().parent.jsDefs); - infer.cx().qmlScopeBuilder = sb; - } - - /* - * Helper to reset some of the internal state of the QML plugin when the server - * resets - */ - function reset() { - qmlImportHandler.reset(); - } - - /* - * Called when a completions query is made to the server - */ - function completions(file, query) { - // We can get relatively simple completions on QML Object Types for free if we - // update the Context.paths variable. Tern uses this variable to complete - // non Member Expressions that contain a '.' character. Will be much more - // accurate if we just roll our own completions for this in the future, but it - // works relatively well for now. - var cx = infer.cx(); - cx.paths = {}; - for (var prop in file.scope.props) { - cx.paths[prop] = file.scope[prop]; - } - } - - // Register the QML plugin in Tern - tern.registerPlugin("qml", function (server) { - // First we want to replace the top-level defs array with our own and save the - // JavaScript specific defs to a new array 'jsDefs'. In order to make sure no - // other plugins mess with the new defs after us, we override addDefs. - server.jsDefs = server.defs; - server.defs = []; - server.addDefs = function (defs, toFront) { - if (toFront) this.jsDefs.unshift(defs); - else this.jsDefs.push(defs); - if (this.cx) this.reset(); - }; - - // Create a method on the server object that parses a string. We can't make this - // a query due to the fact that tern always does its infer processing on every - // query regardless of its contents. - server.parseString = function (text, options, callback) { - try { - var opts = { - allowReturnOutsideFunction: true, - allowImportExportEverywhere: true, - ecmaVersion: this.options.ecmaVersion - }; - for (var opt in options) { - opts[opt] = options[opt]; - } - text = this.signalReturnFirst("preParse", text, opts) || text; - var ast = infer.parse(text, opts); - callback(null, { - ast: ast - }); - this.signal("postParse", ast, text); - } catch (err) { - callback(err, null); - } - }; - - // Create the QML Import Handler - qmlImportHandler = exports.importHandler = new ImportHandler(server); - - // Define the 'parseFile' query type. - tern.defineQueryType("parseFile", { - takesFile: true, - run: function (srv, query, file) { - return { - ast: file.ast - }; - } - }); - - // Hook into server signals - server.on("preParse", preParse); - server.on("beforeLoad", beforeLoad); - server.on("postReset", reset); - server.on("completion", completions); - - // Extend Tern's inferencing system to include QML syntax - extendTernScopeGatherer(infer.scopeGatherer); - extendTernInferExprVisitor(infer.inferExprVisitor); - extendTernInferWrapper(infer.inferWrapper); - extendTernTypeFinder(infer.typeFinder); - extendTernSearchVisitor(infer.searchVisitor); - }); +/******************************************************************************* + * Copyright (c) 2015 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 + *******************************************************************************/ +(function (root, mod) { + if (typeof exports === "object" && typeof module === "object") // CommonJS + return mod(exports, require("acorn"), require("acorn/dist/acorn_loose"), require("acorn/dist/walk"), + require("acorn-qml"), require("acorn-qml/loose"), require("acorn-qml/walk"), require("tern"), + require("tern/lib/infer"), require("tern/lib/signal")); + if (typeof define === "function" && define.amd) // AMD + return define(["exports", "acorn/dist/acorn", "acorn/dist/acorn_loose", "acorn/dist/walk", "acorn-qml", + "acorn-qml/loose", "acorn-qml/walk", "tern", "tern/lib/infer", "tern/lib/signal"], mod); + mod(root.ternQML || (root.ternQML = {}), acorn, acorn, acorn.walk, acorn, acorn, acorn.walk, tern, tern, tern.signal); // Plain browser env +})(this, function (exports, acorn, acornLoose, walk, acornQML, acornQMLLoose, acornQMLWalk, tern, infer, signal) { + 'use strict'; + + // Grab 'def' from 'infer' (used for jsDefs) + var def = infer.def; + + // 'extend' taken from infer.js + function extend(proto, props) { + var obj = Object.create(proto); + if (props) { + for (var prop in props) obj[prop] = props[prop]; + } + return obj; + } + + // QML Import Handler + var qmlImportHandler = exports.importHandler = null; + var ImportHandler = function (server) { + this.server = server; + this.imports = null; + }; + ImportHandler.prototype = { + reset: function () { + this.imports = null; + }, + resolveDirectory: function (file, path) { + var impl = this.server.options.resolveDirectory; + if (impl) { + return impl(file, path); + } + // Getting to this point means that we were unable to find an implementation of + // the 'resolveDirectory' method. The only time this should happen is during + // a test case which we expect to have an import of the style "./ ..." and nothing + // else. This method will simply remove the './', add the file's base, and return. + if (!path) { + // If no path was specified, return the base directory of the file + var dir = file.name; + dir = dir.substring(0, dir.lastIndexOf("/") + 1); + return dir; + } + if (path.substring(0, 2) === "./") { + path = file.directory + path.substring(2); + } + if (path.substr(path.length - 1, 1) !== "/") { + path = path + "/"; + } + return path; + }, + resolveModule: function (module) { + var impl = this.server.options.resolveModule; + if (impl) { + return impl(module); + } + }, + updateDirectoryImportList: function () { + if (!this.imports) { + this.imports = {}; + } + var dir, f; + var seenDirs = {}; + for (var i = 0; i < this.server.files.length; i++) { + var file = this.server.files[i]; + dir = file.directory; + f = file.nameExt; + if (!dir) { + // Resolve the directory name and file name/extension + dir = file.directory = this.resolveDirectory(file, null); + f = file.nameExt = this.getFileNameAndExtension(file); + } + seenDirs[dir] = true; + // No file scope means the file was recently added/changed and we should + // update its import reference + if (!file.scope) { + // Check for a valid QML Object Identifier + if (f.extension === "qml") { + var ch = f.name.charAt(0); + if (ch.toUpperCase() === ch && f.name.indexOf(".") === -1) { + // Create the array for this directory if necessary + if (!this.imports[dir]) { + this.imports[dir] = {}; + } + + // Create an Obj to represent this import + var obj = new infer.Obj(null, f.name); + obj.origin = file.name; + this.imports[dir][f.name] = obj; + } + } + } + } + for (dir in this.imports) { + if (!(dir in seenDirs)) { + this.imports[dir] = undefined; + } + } + }, + getFileNameAndExtension: function (file) { + var fileName = file.name.substring(file.name.lastIndexOf("/") + 1); + var dot = fileName.lastIndexOf("."); + return { + name: dot >= 0 ? fileName.substring(0, dot) : fileName, + extension: fileName.substring(dot + 1) + }; + }, + resolveObject: function (loc, name) { + return loc[name]; + }, + defineImport: function (scope, loc, name, obj) { + var prop = scope.defProp(name); + var objRef = new ObjRef(loc, name, this); + prop.objType = objRef; + objRef.propagate(prop); + }, + defineImports: function (file, scope) { + scope = scope || file.scope; + + // Add any imports from the current directory + var imports = this.imports[file.directory]; + var f = file.nameExt; + if (imports) { + for (var name in imports) { + if (f.name !== name) { + this.defineImport(scope, imports, name, imports[name]); + } + } + } + + // Walk the AST for any imports + var ih = this; + walk.simple(file.ast, { + QMLImport: function (node) { + var prop = null; + var scope = file.scope; + if (node.qualifier) { + prop = file.scope.defProp(node.qualifier.id.name, node.qualifier.id); + prop.origin = file.name; + var obj = new infer.Obj(null, node.qualifier.id.name); + obj.propagate(prop); + prop.objType = obj; + scope = obj; + } + if (node.directory) { + var dir = ih.resolveDirectory(file, node.directory.value); + var imports = ih.imports[dir]; + if (imports) { + for (var name in imports) { + ih.defineImport(scope, imports, name, imports[name]); + } + } + } + } + }); + }, + createQMLObjectType: function (file, node, isRoot) { + // Find the imported object + var obj = this.getQMLObjectType(file, node.id); + // If this is the root, connect the imported object to the root object + if (isRoot) { + var tmp = this.getRootQMLObjectType(file, node.id); + if (tmp) { + // Hook up the Obj Reference + tmp.proto = obj; + obj = tmp; + obj.originNode = node.id; + + // Break any cyclic dependencies + while ((tmp = tmp.proto)) { + if (tmp.resolve() == obj.resolve()) { + tmp.proto = null; + } + } + } + } + return obj; + }, + getQMLObjectType: function (file, qid) { + var prop = findProp(qid, file.scope); + if (prop) { + return prop.objType; + } + return new infer.Obj(null, qid.name); + }, + getRootQMLObjectType: function (file, qid) { + var f = file.nameExt; + var imports = this.imports[file.directory]; + if (imports && imports[f.name]) { + return imports[f.name]; + } + return new infer.Obj(null, qid.name); + } + }; + + // 'isInteger' taken from infer.js + function isInteger(str) { + var c0 = str.charCodeAt(0); + if (c0 >= 48 && c0 <= 57) return !/\D/.test(str); + else return false; + } + + /* + * We have to redefine 'hasProp' to make it work with our scoping. The original 'hasProp' + * function checked proto.props instead of using proto.hasProp. + */ + infer.Obj.prototype.hasProp = function (prop, searchProto) { + if (isInteger(prop)) prop = this.normalizeIntegerProp(prop); + var found = this.props[prop]; + if (searchProto !== false && this.proto && !found) + found = this.proto.hasProp(prop, true); + return found; + }; + + // Creating a resolve function on 'infer.Obj' so we can simplify some of our 'ObjRef' logic + infer.Obj.prototype.resolve = function () { + return this; + }; + + /* + * QML Object Reference + * + * An ObjRef behaves exactly the same as an ordinary 'infer.Obj' object, except that it + * mirrors its internal state to a referenced object. This object is resolved by the QML + * Import Handler each time the ObjRef is accessed (including getting and setting internal + * variables). In theory this means we don't have to know at runtime whether or not an + * object is an ObjRef or an infer.Obj. + */ + var ObjRef = function (loc, lookup, ih) { + // Using underscores for property names so we don't accidentally collide with any + // 'infer.Obj' property names (which would cause a stack overflow if we were to + // try to access them here). + this._loc = loc; + this._objLookup = lookup; + this._ih = ih; + var obj = this.resolve(); + // Use Object.defineProperty to setup getter and setter methods that delegate + // to the resolved object's properties. We only need to do this once since all + // 'infer.Obj' objects should have the same set of property names. + for (var propertyName in obj) { + if (!(obj[propertyName] instanceof Function)) { + (function () { + var prop = propertyName; + Object.defineProperty(this, prop, { + enumerable: true, + get: function () { + return this.resolve()[prop]; + }, + set: function (value) { + this.resolve()[prop] = value; + } + }); + }).call(this); + } + } + }; + ObjRef.prototype = extend(infer.Type.prototype, { + resolve: function () { + return this._ih.resolveObject(this._loc, this._objLookup); + } + }); + (function () { + // Wire up all base functions to use the resolved object's implementation + for (var _func in infer.Obj.prototype) { + if (_func !== "resolve") { + (function () { + var fn = _func; + ObjRef.prototype[fn] = function () { + return this.resolve()[fn](arguments[0], arguments[1], arguments[2], arguments[3]); + }; + })(); + } + } + })(); + + /* + * QML Object Scope (inherits methods from infer.Scope) + * + * A QML Object Scope does not contain its own properties. Instead, its properties + * are defined in its given Object Type and resolved from there. Any properties + * defined within the Object Type are visible without qualifier to any downstream + * scopes. + */ + var QMLObjScope = exports.QMLObjScope = function (prev, originNode, objType) { + infer.Scope.call(this, prev, originNode, false); + this.objType = objType; + }; + QMLObjScope.prototype = extend(infer.Scope.prototype, { + hasProp: function (prop, searchProto) { + // Search for a property in the Object type. + // Always search the Object Type's prototype as well + var found = this.objType.hasProp(prop, true); + if (found) { + return found; + } + + // Search for a property in the prototype (previous scope) + if (this.proto && searchProto !== false) { + return this.proto.hasProp(prop, searchProto); + } + }, + defProp: function (prop, originNode) { + return this.objType.defProp(prop, originNode); + }, + removeProp: function (prop) { + return this.objType.removeProp(prop); + }, + gatherProperties: function (f, depth) { + // Gather properties from the Object Type and its prototype(s) + var obj = this.objType; + var callback = function (prop, obj, d) { + f(prop, obj, depth); + }; + while (obj) { + obj.gatherProperties(callback, depth); + obj = obj.proto; + } + // gather properties from the prototype (previous scope) + if (this.proto) { + this.proto.gatherProperties(f, depth + 1); + } + } + }); + + /* + * QML Member Scope (inherits methods from infer.Scope) + * + * A QML Member Scope is a bit of a special case when it comes to QML scoping. Like + * the QML Object Scope, it does not contain any properties of its own. The reason + * that it is special is it only gathers properties from its immediate predecessor + * that aren't functions (i.e. They don't have the 'isFunction' flag set. The + * 'isFunction' flag is created by QML signal properties and JavaScript functions + * that are QML Members.) + */ + var QMLMemScope = exports.QMLMemScope = function (prev, originNode, fileScope) { + infer.Scope.call(this, prev, originNode, false); + this.fileScope = fileScope; + }; + QMLMemScope.prototype = extend(infer.Scope.prototype, { + hasProp: function (prop, searchProto) { + // Search for a property in the prototype + var found = null; + if (this.proto) { + // Don't continue searching after the previous scope + found = this.proto.hasProp(prop, false); + if (found && !found.isFunction) { + return found; + } + } + + // Search for a property in the file Scope + if (this.fileScope) { + return this.fileScope.hasProp(prop, searchProto); + } + }, + defProp: function (prop, originNode) { + return this.prev.defProp(prop, originNode); + }, + removeProp: function (prop) { + return this.prev.removeProp(prop); + }, + gatherProperties: function (f, depth) { + // Gather properties from the prototype (previous scope) + var found = null; + if (this.proto) { + this.proto.gatherProperties(function (prop, obj, d) { + // Don't continue passed the predecessor by checking depth + if (d === depth) { + var propObj = obj.hasProp(prop); + if (propObj && !propObj.isFunction) { + f(prop, obj, d); + } + } + }, depth); + } + // Gather properties from the file Scope + this.fileScope.gatherProperties(f, depth); + } + }); + + /* + * QML JavaScript Scope (inherits methods from infer.Scope) + * + * A QML JavaScript Scope also contains references to the file's ID Scope, the global + * JavaScript Scope, and a possible function parameter scope. Most likely, this + * scope will not contain its own properties. The resolution order for 'getProp' and + * 'hasProp' are: + * 1. The ID Scope + * 2. This Scope's properties + * 3. The Function Scope (if it exists) + * 4. The JavaScript Scope + * 5. The Previous Scope in the chain + */ + var QMLJSScope = exports.QMLJSScope = function (prev, originNode, idScope, jsScope, fnScope) { + infer.Scope.call(this, prev, originNode, false); + this.idScope = idScope; + this.jsScope = jsScope; + this.fnScope = fnScope; + }; + QMLJSScope.prototype = extend(infer.Scope.prototype, { + hasProp: function (prop, searchProto) { + if (isInteger(prop)) { + prop = this.normalizeIntegerProp(prop); + } + // Search the ID scope + var found = null; + if (this.idScope) { + found = this.idScope.hasProp(prop, searchProto); + } + // Search the current scope + if (!found) { + found = this.props[prop]; + } + // Search the Function Scope + if (!found && this.fnScope) { + found = this.fnScope.hasProp(prop, searchProto); + } + // Search the JavaScript Scope + if (!found && this.jsScope) { + found = this.jsScope.hasProp(prop, searchProto); + } + // Search the prototype (previous scope) + if (!found && this.proto && searchProto !== false) { + found = this.proto.hasProp(prop, searchProto); + } + return found; + }, + gatherProperties: function (f, depth) { + // Gather from the ID Scope + if (this.idScope) { + this.idScope.gatherProperties(f, depth); + } + // Gather from the current scope + for (var prop in this.props) { + f(prop, this, depth); + } + // Gather from the Function Scope + if (this.fnScope) { + this.fnScope.gatherProperties(f, depth); + } + // Gather from the JS Scope + if (this.jsScope) { + this.jsScope.gatherProperties(f, depth); + } + // Gather from the prototype (previous scope) + if (this.proto) { + this.proto.gatherProperties(f, depth + 1); + } + } + }); + + // QML Scope Builder + var ScopeBuilder = function (file, jsDefs) { + // File Scope + this.scope = file.scope; + this.file = file; + // ID Scope + this.idScope = new infer.Scope(); + this.idScope.name = ""; + // JavaScript Scope + this.jsScope = new infer.Scope(); + this.jsScope.name = ""; + var curOrigin = infer.cx().curOrigin; + for (var i = 0; i < jsDefs.length; ++i) { + def.load(jsDefs[i], this.jsScope); + } + infer.cx().curOrigin = curOrigin; + }; + ScopeBuilder.prototype = { + newObjScope: function (node) { + var obj = qmlImportHandler.createQMLObjectType(this.file, node, !this.rootScope); + var scope = new QMLObjScope(this.rootScope || this.scope, node, obj); + scope.name = ""; + if (!this.rootScope) { + this.rootScope = scope; + } + return scope; + }, + getIDScope: function () { + return this.idScope; + }, + newMemberScope: function (objScope, node) { + var memScope = new QMLMemScope(objScope, node, this.scope); + memScope.name = ""; + return memScope; + }, + newJSScope: function (scope, node, fnScope) { + var jsScope = new QMLJSScope(scope, node, this.idScope, this.jsScope, fnScope); + jsScope.name = ""; + return jsScope; + }, + }; + + // Helper for adding a variable to a scope. + function addVar(scope, node) { + return scope.defProp(node.name, node); + } + + // Helper for finding a property in a scope. + function findProp(node, scope, pos) { + if (pos === null || pos === undefined || pos < 0) { + pos = Number.MAX_VALUE; + } + if (node.type === "QMLQualifiedID") { + return (function recurse(i, prop) { + if (i >= node.parts.length || pos < node.parts[i].start) { + return prop; + } + if (!prop) { + prop = scope.hasProp(node.parts[i].name); + if (prop) { + return recurse(i + 1, prop); + } + } else { + var obj = prop.getType(); + if (obj) { + var p = obj.hasProp(node.parts[i].name); + if (p) { + return recurse(i + 1, p); + } + } + } + return null; + })(0, null); + } else if (node.type === "Identifier") { + return scope.hasProp(node.name); + } + return null; + } + + // Helper for getting the current context's scope builder + function getScopeBuilder() { + return infer.cx().qmlScopeBuilder; + } + + // 'infer' taken from infer.js + function inf(node, scope, out, name) { + var handler = infer.inferExprVisitor[node.type]; + return handler ? handler(node, scope, out, name) : infer.ANull; + } + + // Infers the property's type from its given primitive value + function infKind(kind, out) { + // TODO: infer list type + if (kind.primitive) { + switch (kind.id.name) { + case "int": + case "double": + case "real": + infer.cx().num.propagate(out); + break; + case "string": + case "color": + infer.cx().str.propagate(out); + break; + case "boolean": + infer.cx().bool.propagate(out); + break; + } + } + } + + // 'ret' taken from infer.js + function ret(f) { + return function (node, scope, out, name) { + var r = f(node, scope, name); + if (out) r.propagate(out); + return r; + }; + } + + // 'fill' taken from infer.js + function fill(f) { + return function (node, scope, out, name) { + if (!out) out = new infer.AVal(); + f(node, scope, out, name); + return out; + }; + } + + // Helper method to get the last index of an array + function getLastIndex(arr) { + return arr[arr.length - 1]; + } + + // Helper method to get the signal handler name of a signal function + function getSignalHandlerName(str) { + return "on" + str.charAt(0).toUpperCase() + str.slice(1); + } + + // Object which holds two scopes. Used to store both the Member Scope and Object + // Scope for QML Property Bindings and Declarations. + function Scopes(obj, mem) { + this.object = obj; + this.member = mem; + } + + // Helper to add functionality to a set of walk methods + function extendWalk(walker, funcs) { + for (var prop in funcs) { + walker[prop] = funcs[prop]; + } + } + + function extendTernScopeGatherer(scopeGatherer) { + // Extend the Tern scopeGatherer to build up our custom QML scoping + extendWalk(scopeGatherer, { + QMLObjectDefinition: function (node, scope, c) { + var inner = node.scope = getScopeBuilder().newObjScope(node); + c(node.body, inner); + }, + QMLObjectBinding: function (node, scope, c) { + var inner = node.scope = getScopeBuilder().newObjScope(node); + c(node.body, inner); + }, + QMLObjectInitializer: function (node, scope, c) { + var memScope = node.scope = getScopeBuilder().newMemberScope(scope, node); + for (var i = 0; i < node.members.length; i++) { + var member = node.members[i]; + if (member.type === "FunctionDeclaration") { + c(member, scope); + + // Insert the JavaScript scope after the Function has had a chance to build it's own scope + var jsScope = getScopeBuilder().newJSScope(scope, member, member.scope); + jsScope.fnType = member.scope.fnType; + member.scope.prev = member.scope.proto = null; + member.scope = jsScope; + + // Indicate that the property is a function + var prop = scope.hasProp(member.id.name); + if (prop) { + prop.isFunction = true; + } + } else if (member.type === "QMLPropertyDeclaration" || member.type === "QMLPropertyBinding") { + c(member, new Scopes(scope, memScope)); + } else { + c(member, scope); + } + } + }, + QMLPropertyDeclaration: function (node, scopes, c) { + var prop = addVar(scopes.member, node.id); + if (node.binding) { + c(node.binding, scopes.object); + } + }, + QMLPropertyBinding: function (node, scopes, c) { + // Check for the 'id' property being set + if (node.id.name == "id") { + if (node.binding.type === "QMLScriptBinding") { + var binding = node.binding; + if (!binding.block && binding.script.type === "Identifier") { + node.prop = addVar(getScopeBuilder().getIDScope(), binding.script); + } + } + } + // Delegate down to the expression + c(node.binding, scopes.object); + }, + QMLScriptBinding: function (node, scope, c) { + var inner = node.scope = getScopeBuilder().newJSScope(scope, node); + c(node.script, inner); + }, + QMLStatementBlock: function (node, scope, c) { + var inner = getScopeBuilder().newJSScope(scope, node); + node.scope = inner; + for (var i = 0; i < node.body.length; i++) { + c(node.body[i], inner, "Statement"); + } + }, + QMLSignalDefinition: function (node, scope, c) { + // Scope Builder + var sb = getScopeBuilder(); + + // Define the signal arguments in their own separate scope + var argNames = []; + var argVals = []; + var sigScope = new infer.Scope(null, node); + for (var i = 0; i < node.params.length; i++) { + var param = node.params[i]; + argNames.push(param.id.name); + argVals.push(addVar(sigScope, param.id)); + } + + // Define the signal function type which can be referenced from JavaScript + var sig = addVar(scope, node.id); + sig.isFunction = true; + sig.sigType = new infer.Fn(node.id.name, new infer.AVal(), argVals, argNames, infer.ANull); + sig.sigType.sigScope = sigScope; + + // Define the signal handler property + var handler = scope.defProp(getSignalHandlerName(node.id.name), node.id); + handler.sig = sig.sigType; + } + }); + } + + function extendTernInferExprVisitor(inferExprVisitor) { + // Extend the inferExprVisitor methods + extendWalk(inferExprVisitor, { + QMLStatementBlock: ret(function (node, scope, name) { + return infer.ANull; // TODO: check return statements + }), + QMLScriptBinding: fill(function (node, scope, out, name) { + return inf(node.script, node.scope, out, name); + }), + QMLObjectBinding: ret(function (node, scope, name) { + return node.scope.objType; + }), + QMLArrayBinding: ret(function (node, scope, name) { + return new infer.Arr(null); // TODO: populate with type of array contents + }) + }); + } + + function extendTernInferWrapper(inferWrapper) { + // Extend the inferWrapper methods + extendWalk(inferWrapper, { + QMLObjectDefinition: function (node, scope, c) { + c(node.body, node.scope); + }, + QMLObjectBinding: function (node, scope, c) { + c(node.body, node.scope); + }, + QMLObjectInitializer: function (node, scope, c) { + for (var i = 0; i < node.members.length; i++) { + var member = node.members[i]; + if (member.type === "QMLPropertyDeclaration" || member.type === "QMLPropertyBinding") { + c(member, new Scopes(scope, node.scope)); + } else { + c(member, scope); + } + } + }, + QMLPropertyDeclaration: function (node, scopes, c) { + var prop = findProp(node.id, scopes.member); + if (prop) { + infKind(node.kind, prop); + if (node.binding) { + c(node.binding, scopes.object); + inf(node.binding, scopes.object, prop, node.id.name); + } + } + }, + QMLPropertyBinding: function (node, scopes, c) { + c(node.binding, scopes.object); + // Check for the 'id' property being set + if (node.id.name === "id") { + if (node.binding.type === "QMLScriptBinding") { + var binding = node.binding; + if (binding.script.type === "Identifier") { + scopes.object.objType.propagate(node.prop); + } + } + } else { + var prop = findProp(node.id, scopes.member); + if (prop) { + if (prop.sig) { + // This is a signal handler + node.binding.scope.fnScope = prop.sig.sigScope; + } else { + inf(node.binding, scopes.object, prop, getLastIndex(node.id.parts)); + } + } + } + }, + QMLScriptBinding: function (node, scope, c) { + c(node.script, node.scope); + }, + QMLStatementBlock: function (node, scope, c) { + for (var i = 0; i < node.body.length; i++) { + c(node.body[i], node.scope, "Statement"); + } + }, + QMLSignalDefinition: function (node, scope, c) { + var sig = scope.getProp(node.id.name); + for (var i = 0; i < node.params.length; i++) { + var param = node.params[i]; + infKind(param.kind, sig.sigType.args[i]); + } + sig.sigType.retval = infer.ANull; + sig.sigType.propagate(sig); + + var handler = scope.getProp(getSignalHandlerName(node.id.name)); + var obj = new infer.Obj(true, "Signal Handler"); + obj.propagate(handler); + } + }); + } + + function extendTernTypeFinder(typeFinder) { + // Extend the type finder to return valid types for QML AST elements + extendWalk(typeFinder, { + QMLObjectDefinition: function (node, scope) { + return node.scope.objType; + }, + QMLObjectBinding: function (node, scope) { + return node.scope.objType; + }, + QMLObjectInitializer: function (node, scope) { + return infer.ANull; + }, + FunctionDeclaration: function (node, scope) { + // Quick little hack to get 'findExprAt' to find a Function Declaration which + // is a QML Object Member. All other Function Declarations are ignored. + return scope.name === "" ? infer.ANull : undefined; + }, + QMLScriptBinding: function (node, scope) { + // Trick Tern into thinking this node is a type so that it will use + // this node's scope when handling improperly written script bindings + return infer.ANull; + }, + QMLQualifiedID: function (node, scope) { + return findProp(node, scope) || infer.ANull; + }, + QML_ID: function (node, scope) { + // Reverse the hack from search visitor before finding the property in + // the id scope + node.type = "Identifier"; + return findProp(node, getScopeBuilder().getIDScope()); + } + }); + } + + function extendTernSearchVisitor(searchVisitor) { + // Extend the search visitor to traverse the scope properly + extendWalk(searchVisitor, { + QMLObjectDefinition: function (node, scope, c) { + c(node.body, node.scope); + }, + QMLObjectBinding: function (node, scope, c) { + c(node.body, node.scope); + }, + QMLObjectInitializer: function (node, scope, c) { + for (var i = 0; i < node.members.length; i++) { + var member = node.members[i]; + if (member.type === "QMLPropertyDeclaration" || member.type === "QMLPropertyBinding") { + c(member, new Scopes(scope, node.scope)); + } else { + c(member, scope); + } + } + }, + QMLSignalDefinition: function (node, scope, c) { + c(node.id, scope); + }, + QMLPropertyDeclaration: function (node, scopes, c) { + c(node.id, scopes.member); + if (node.binding) { + c(node.binding, scopes.object); + } + }, + QMLPropertyBinding: function (node, scopes, c) { + if (node.id.name === "id") { + if (node.binding.type === "QMLScriptBinding") { + var binding = node.binding; + if (binding.script.type === "Identifier") { + // Hack to bypass Tern's type finding algorithm which uses node.type instead + // of the overriden type. + binding.script.type = "QML_ID"; + c(binding.script, binding.scope, "QML_ID"); + binding.script.type = "Identifier"; + } + } + var prop = findProp(node.id, scopes.member); + if (!prop) { + return; + } + } + c(node.id, scopes.member); + c(node.binding, scopes.object); + }, + QMLScriptBinding: function (node, scope, c) { + c(node.script, node.scope); + }, + QML_ID: function (node, st, c) { + // Ignore + }, + QMLStatementBlock: function (node, scope, c) { + for (var i = 0; i < node.body.length; i++) { + c(node.body[i], node.scope, "Statement"); + } + } + }); + } + + /* + * Prepares acorn to consume QML syntax rather than standard JavaScript + */ + function preParse(text, options) { + // Force ECMA Version to 5 + options.ecmaVersion = 5; + + // Register qml plugin with main parser + var plugins = options.plugins; + if (!plugins) plugins = options.plugins = {}; + plugins.qml = true; + + // Register qml plugin with loose parser + var pluginsLoose = options.pluginsLoose; + if (!pluginsLoose) pluginsLoose = options.pluginsLoose = {}; + pluginsLoose.qml = true; + } + + /* + * Initializes the file's top level scope and creates a ScopeBuilder to facilitate + * the creation of QML scopes. + */ + function beforeLoad(file) { + // We dont care for the Context's top scope + file.scope = null; + + // Update the ImportHandler + qmlImportHandler.updateDirectoryImportList(); + + // Create the file's top scope + file.scope = new infer.Scope(infer.cx().topScope); + var name = file.name; + var end = file.name.lastIndexOf(".qml"); + file.scope.name = end > 0 ? name.substring(0, end) : name; + + // Get the ImportHandler to define imports for us + qmlImportHandler.defineImports(file, file.scope); + + // Create the ScopeBuilder + var sb = new ScopeBuilder(file, infer.cx().parent.jsDefs); + infer.cx().qmlScopeBuilder = sb; + } + + /* + * Helper to reset some of the internal state of the QML plugin when the server + * resets + */ + function reset() { + qmlImportHandler.reset(); + } + + /* + * Called when a completions query is made to the server + */ + function completions(file, query) { + // We can get relatively simple completions on QML Object Types for free if we + // update the Context.paths variable. Tern uses this variable to complete + // non Member Expressions that contain a '.' character. Will be much more + // accurate if we just roll our own completions for this in the future, but it + // works relatively well for now. + var cx = infer.cx(); + cx.paths = {}; + for (var prop in file.scope.props) { + cx.paths[prop] = file.scope[prop]; + } + } + + // Register the QML plugin in Tern + tern.registerPlugin("qml", function (server) { + // First we want to replace the top-level defs array with our own and save the + // JavaScript specific defs to a new array 'jsDefs'. In order to make sure no + // other plugins mess with the new defs after us, we override addDefs. + server.jsDefs = server.defs; + server.defs = []; + server.addDefs = function (defs, toFront) { + if (toFront) this.jsDefs.unshift(defs); + else this.jsDefs.push(defs); + if (this.cx) this.reset(); + }; + + // Create a method on the server object that parses a string. We can't make this + // a query due to the fact that tern always does its infer processing on every + // query regardless of its contents. + server.parseString = function (text, options, callback) { + try { + var opts = { + allowReturnOutsideFunction: true, + allowImportExportEverywhere: true, + ecmaVersion: this.options.ecmaVersion + }; + for (var opt in options) { + opts[opt] = options[opt]; + } + text = this.signalReturnFirst("preParse", text, opts) || text; + var ast = infer.parse(text, opts); + callback(null, { + ast: ast + }); + this.signal("postParse", ast, text); + } catch (err) { + callback(err, null); + } + }; + + // Create the QML Import Handler + qmlImportHandler = exports.importHandler = new ImportHandler(server); + + // Define the 'parseFile' query type. + tern.defineQueryType("parseFile", { + takesFile: true, + run: function (srv, query, file) { + return { + ast: file.ast + }; + } + }); + + // Hook into server signals + server.on("preParse", preParse); + server.on("beforeLoad", beforeLoad); + server.on("postReset", reset); + server.on("completion", completions); + + // Extend Tern's inferencing system to include QML syntax + extendTernScopeGatherer(infer.scopeGatherer); + extendTernInferExprVisitor(infer.inferExprVisitor); + extendTernInferWrapper(infer.inferWrapper); + extendTernTypeFinder(infer.typeFinder); + extendTernSearchVisitor(infer.searchVisitor); + }); }); \ No newline at end of file diff --git a/qt/org.eclipse.cdt.qt.core/tern-qml/test/driver.js b/qt/org.eclipse.cdt.qt.core/tern-qml/test/driver.js index 6abf37e0961..7a7736e8413 100644 --- a/qt/org.eclipse.cdt.qt.core/tern-qml/test/driver.js +++ b/qt/org.eclipse.cdt.qt.core/tern-qml/test/driver.js @@ -1,210 +1,210 @@ -/******************************************************************************* - * Copyright (c) 2015 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 - *******************************************************************************/ -"use strict"; - -var fs = require("fs"), path = require("path"); -var ternQML = require("../qml.js"); -var tern = require("tern"); - -var projectDir = path.resolve(__dirname, ".."); -var resolve = function (pth) { - return path.resolve(projectDir, pth); -}; -var testCases = []; -var groupName; - -function TestCase(group, code, run) { - this.code = code; - this.group = group; - this.runTest = run || function (server, callback, code) { - callback("fail", this.code, "runTest function was not provided."); - }; -} - -exports.isolate = function (code) { - for (var i = 0; i < testCases.length; i++) { - var test = testCases[i]; - if (test.group === groupName && test.code !== code) { - testCases.splice(i, 1); - i--; - } - } -}; - -exports.groupStart = function (group) { - groupName = group; -}; - -exports.groupEnd = function () { - groupName = undefined; -}; - -exports.test = function (code, runTest) { - testCases.push(new TestCase(groupName || "Default", code, runTest)); -}; - -exports.testCompletion = function (code, expected, beforeTest) { - testCases.push(new TestCase(groupName || "Default", code, function (server, callback) { - var trimmedCode = code; - // Extract the cursor position - var pos = code.indexOf("|"); - var split = code.split("|"); - trimmedCode = split[0] + split[1]; - - if (beforeTest) { - beforeTest(server); - } - assertCompletion(server, trimmedCode, expected, pos, function (mis) { - if (mis) { - callback("fail", code, mis); - } else { - callback("ok", code); - } - }); - }, beforeTest)); -}; - -exports.testDefinition = function (code, expected, beforeTest) { - testCases.push(new TestCase(groupName || "Default", code, function (server, callback) { - var trimmedCode = code; - // Extract the cursor position - var pos = code.indexOf("|"); - var split = code.split("|"); - trimmedCode = split[0] + split[1]; - - if (beforeTest) { - beforeTest(server); - } - assertDefinition(server, trimmedCode, expected, pos, function (mis) { - if (mis) { - callback("fail", code, mis); - } else { - callback("ok", code); - } - }); - }, beforeTest)); -}; - -exports.runTests = function (config, callback) { - for (var i = 0; i < testCases.length; ++i) { - var test = testCases[i]; - if (test.group === config.group) { - var server = createServer(); - test.runTest(server, callback, test.code); - } - } -}; - -function createServer(defs) { - var plugins = {}; - plugins.qml = true; - var server = new tern.Server({ - ecmaVersion: 5, - plugins: plugins, - defs: [ require("./ecma5-defs.js") ] - }); - return server; -} - -var assertCompletion = exports.assertCompletion = function (server, code, expected, pos, callback) { - server.addFile("main.qml", code); - server.request({ - files: [ - { - name: "main.qml", - text: code, - type: "full" - } - ], - query: { - type: "completions", - file: "main.qml", - end: pos, - types: true, - docs: false, - urls: false, - origins: true, - caseInsensitive: true, - lineCharPositions: true, - expandWordForward: false, - guess: false - } - }, function (err, resp) { - if (err) { - throw err; - } - var mis = misMatch(expected, resp); - callback(mis); - }); -}; - -var assertDefinition = exports.assertDefinition = function (server, code, expected, pos, callback) { - server.request({ - files: [ - { - name: "main.qml", - text: code, - type: "full" - } - ], - query: { - type: "definition", - file: "main.qml", - end: pos, - types: true, - docs: false, - urls: false, - origins: true, - caseInsensitive: true, - lineCharPositions: true, - expandWordForward: false, - guess: false - } - }, function (err, resp) { - if (err) { - throw err; - } - var mis = misMatch(expected, resp); - callback(mis); - }); -}; - -function ppJSON(v) { - return v instanceof RegExp ? v.toString() : JSON.stringify(v, null, 2); -} - -function addPath(str, pt) { - if (str.charAt(str.length - 1) == ")") - return str.slice(0, str.length - 1) + "/" + pt + ")"; - return str + " (" + pt + ")"; -} - -var misMatch = exports.misMatch = function (exp, act) { - var mis = null; - if (!exp || !act || (typeof exp != "object") || (typeof act != "object")) { - if (exp !== act) return ppJSON(exp) + " !== " + ppJSON(act); - } else if (exp instanceof RegExp || act instanceof RegExp) { - var left = ppJSON(exp), right = ppJSON(act); - if (left !== right) return left + " !== " + right; - } else if (exp.splice) { - if (!act.slice) return ppJSON(exp) + " != " + ppJSON(act); - if (act.length != exp.length) return "array length mismatch " + exp.length + " != " + act.length; - for (var i = 0; i < act.length; ++i) { - mis = misMatch(exp[i], act[i]); - if (mis) return addPath(mis, i); - } - } else { - for (var prop in exp) { - mis = misMatch(exp[prop], act[prop]); - if (mis) return addPath(mis, prop); - } - } +/******************************************************************************* + * Copyright (c) 2015 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 + *******************************************************************************/ +"use strict"; + +var fs = require("fs"), path = require("path"); +var ternQML = require("../qml.js"); +var tern = require("tern"); + +var projectDir = path.resolve(__dirname, ".."); +var resolve = function (pth) { + return path.resolve(projectDir, pth); +}; +var testCases = []; +var groupName; + +function TestCase(group, code, run) { + this.code = code; + this.group = group; + this.runTest = run || function (server, callback, code) { + callback("fail", this.code, "runTest function was not provided."); + }; +} + +exports.isolate = function (code) { + for (var i = 0; i < testCases.length; i++) { + var test = testCases[i]; + if (test.group === groupName && test.code !== code) { + testCases.splice(i, 1); + i--; + } + } +}; + +exports.groupStart = function (group) { + groupName = group; +}; + +exports.groupEnd = function () { + groupName = undefined; +}; + +exports.test = function (code, runTest) { + testCases.push(new TestCase(groupName || "Default", code, runTest)); +}; + +exports.testCompletion = function (code, expected, beforeTest) { + testCases.push(new TestCase(groupName || "Default", code, function (server, callback) { + var trimmedCode = code; + // Extract the cursor position + var pos = code.indexOf("|"); + var split = code.split("|"); + trimmedCode = split[0] + split[1]; + + if (beforeTest) { + beforeTest(server); + } + assertCompletion(server, trimmedCode, expected, pos, function (mis) { + if (mis) { + callback("fail", code, mis); + } else { + callback("ok", code); + } + }); + }, beforeTest)); +}; + +exports.testDefinition = function (code, expected, beforeTest) { + testCases.push(new TestCase(groupName || "Default", code, function (server, callback) { + var trimmedCode = code; + // Extract the cursor position + var pos = code.indexOf("|"); + var split = code.split("|"); + trimmedCode = split[0] + split[1]; + + if (beforeTest) { + beforeTest(server); + } + assertDefinition(server, trimmedCode, expected, pos, function (mis) { + if (mis) { + callback("fail", code, mis); + } else { + callback("ok", code); + } + }); + }, beforeTest)); +}; + +exports.runTests = function (config, callback) { + for (var i = 0; i < testCases.length; ++i) { + var test = testCases[i]; + if (test.group === config.group) { + var server = createServer(); + test.runTest(server, callback, test.code); + } + } +}; + +function createServer(defs) { + var plugins = {}; + plugins.qml = true; + var server = new tern.Server({ + ecmaVersion: 5, + plugins: plugins, + defs: [ require("./ecma5-defs.js") ] + }); + return server; +} + +var assertCompletion = exports.assertCompletion = function (server, code, expected, pos, callback) { + server.addFile("main.qml", code); + server.request({ + files: [ + { + name: "main.qml", + text: code, + type: "full" + } + ], + query: { + type: "completions", + file: "main.qml", + end: pos, + types: true, + docs: false, + urls: false, + origins: true, + caseInsensitive: true, + lineCharPositions: true, + expandWordForward: false, + guess: false + } + }, function (err, resp) { + if (err) { + throw err; + } + var mis = misMatch(expected, resp); + callback(mis); + }); +}; + +var assertDefinition = exports.assertDefinition = function (server, code, expected, pos, callback) { + server.request({ + files: [ + { + name: "main.qml", + text: code, + type: "full" + } + ], + query: { + type: "definition", + file: "main.qml", + end: pos, + types: true, + docs: false, + urls: false, + origins: true, + caseInsensitive: true, + lineCharPositions: true, + expandWordForward: false, + guess: false + } + }, function (err, resp) { + if (err) { + throw err; + } + var mis = misMatch(expected, resp); + callback(mis); + }); +}; + +function ppJSON(v) { + return v instanceof RegExp ? v.toString() : JSON.stringify(v, null, 2); +} + +function addPath(str, pt) { + if (str.charAt(str.length - 1) == ")") + return str.slice(0, str.length - 1) + "/" + pt + ")"; + return str + " (" + pt + ")"; +} + +var misMatch = exports.misMatch = function (exp, act) { + var mis = null; + if (!exp || !act || (typeof exp != "object") || (typeof act != "object")) { + if (exp !== act) return ppJSON(exp) + " !== " + ppJSON(act); + } else if (exp instanceof RegExp || act instanceof RegExp) { + var left = ppJSON(exp), right = ppJSON(act); + if (left !== right) return left + " !== " + right; + } else if (exp.splice) { + if (!act.slice) return ppJSON(exp) + " != " + ppJSON(act); + if (act.length != exp.length) return "array length mismatch " + exp.length + " != " + act.length; + for (var i = 0; i < act.length; ++i) { + mis = misMatch(exp[i], act[i]); + if (mis) return addPath(mis, i); + } + } else { + for (var prop in exp) { + mis = misMatch(exp[prop], act[prop]); + if (mis) return addPath(mis, prop); + } + } }; \ No newline at end of file diff --git a/qt/org.eclipse.cdt.qt.core/tern-qml/test/ecma5-defs.js b/qt/org.eclipse.cdt.qt.core/tern-qml/test/ecma5-defs.js index 58fb3b127f4..c307033fc5a 100644 --- a/qt/org.eclipse.cdt.qt.core/tern-qml/test/ecma5-defs.js +++ b/qt/org.eclipse.cdt.qt.core/tern-qml/test/ecma5-defs.js @@ -1,980 +1,980 @@ -/******************************************************************************* - * Copyright (c) 2015 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 - *******************************************************************************/ -"use strict"; - -module.exports = { - "!name": "ecma5", - "!define": { - "Error.prototype": "Error.prototype" - }, - "Infinity": { - "!type": "number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Infinity", - "!doc": "A numeric value representing infinity." - }, - "undefined": { - "!type": "?", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/undefined", - "!doc": "The value undefined." - }, - "NaN": { - "!type": "number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/NaN", - "!doc": "A value representing Not-A-Number." - }, - "Object": { - "!type": "fn()", - "getPrototypeOf": { - "!type": "fn(obj: ?) -> ?", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object/getPrototypeOf", - "!doc": "Returns the prototype (i.e. the internal prototype) of the specified object." - }, - "create": { - "!type": "fn(proto: ?) -> !custom:Object_create", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object/create", - "!doc": "Creates a new object with the specified prototype object and properties." - }, - "defineProperty": { - "!type": "fn(obj: ?, prop: string, desc: ?) -> !custom:Object_defineProperty", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object/defineProperty", - "!doc": "Defines a new property directly on an object, or modifies an existing property on an object, and returns the object. If you want to see how to use the Object.defineProperty method with a binary-flags-like syntax, see this article." - }, - "defineProperties": { - "!type": "fn(obj: ?, props: ?) -> !custom:Object_defineProperties", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object/defineProperty", - "!doc": "Defines a new property directly on an object, or modifies an existing property on an object, and returns the object. If you want to see how to use the Object.defineProperty method with a binary-flags-like syntax, see this article." - }, - "getOwnPropertyDescriptor": { - "!type": "fn(obj: ?, prop: string) -> ?", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object/getOwnPropertyDescriptor", - "!doc": "Returns a property descriptor for an own property (that is, one directly present on an object, not present by dint of being along an object's prototype chain) of a given object." - }, - "keys": { - "!type": "fn(obj: ?) -> [string]", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object/keys", - "!doc": "Returns an array of a given object's own enumerable properties, in the same order as that provided by a for-in loop (the difference being that a for-in loop enumerates properties in the prototype chain as well)." - }, - "getOwnPropertyNames": { - "!type": "fn(obj: ?) -> [string]", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object/getOwnPropertyNames", - "!doc": "Returns an array of all properties (enumerable or not) found directly upon a given object." - }, - "seal": { - "!type": "fn(obj: ?)", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object/seal", - "!doc": "Seals an object, preventing new properties from being added to it and marking all existing properties as non-configurable. Values of present properties can still be changed as long as they are writable." - }, - "isSealed": { - "!type": "fn(obj: ?) -> bool", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object/isSealed", - "!doc": "Determine if an object is sealed." - }, - "freeze": { - "!type": "fn(obj: ?) -> !0", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object/freeze", - "!doc": "Freezes an object: that is, prevents new properties from being added to it; prevents existing properties from being removed; and prevents existing properties, or their enumerability, configurability, or writability, from being changed. In essence the object is made effectively immutable. The method returns the object being frozen." - }, - "isFrozen": { - "!type": "fn(obj: ?) -> bool", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object/isFrozen", - "!doc": "Determine if an object is frozen." - }, - "preventExtensions": { - "!type": "fn(obj: ?)", - "!url": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/preventExtensions", - "!doc": "Prevents new properties from ever being added to an object." - }, - "isExtensible": { - "!type": "fn(obj: ?) -> bool", - "!url": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/isExtensible", - "!doc": "The Object.isExtensible() method determines if an object is extensible (whether it can have new properties added to it)." - }, - "prototype": { - "!stdProto": "Object", - "toString": { - "!type": "fn() -> string", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object/toString", - "!doc": "Returns a string representing the object." - }, - "toLocaleString": { - "!type": "fn() -> string", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object/toLocaleString", - "!doc": "Returns a string representing the object. This method is meant to be overriden by derived objects for locale-specific purposes." - }, - "valueOf": { - "!type": "fn() -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object/valueOf", - "!doc": "Returns the primitive value of the specified object" - }, - "hasOwnProperty": { - "!type": "fn(prop: string) -> bool", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object/hasOwnProperty", - "!doc": "Returns a boolean indicating whether the object has the specified property." - }, - "propertyIsEnumerable": { - "!type": "fn(prop: string) -> bool", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object/propertyIsEnumerable", - "!doc": "Returns a Boolean indicating whether the specified property is enumerable." - }, - "isPrototypeOf": { - "!type": "fn(obj: ?) -> bool", - "!url": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/isPrototypeOf", - "!doc": "Tests for an object in another object's prototype chain." - } - }, - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object", - "!doc": "Creates an object wrapper." - }, - "Function": { - "!type": "fn(body: string) -> fn()", - "prototype": { - "!stdProto": "Function", - "apply": { - "!type": "fn(this: ?, args: [?])", - "!effects": [ - "call and return !this this=!0 !1. !1. !1." - ], - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Function/apply", - "!doc": "Calls a function with a given this value and arguments provided as an array (or an array like object)." - }, - "call": { - "!type": "fn(this: ?, args?: ?) -> !this.!ret", - "!effects": [ - "call and return !this this=!0 !1 !2 !3 !4" - ], - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Function/call", - "!doc": "Calls a function with a given this value and arguments provided individually." - }, - "bind": { - "!type": "fn(this: ?, args?: ?) -> !custom:Function_bind", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Function/bind", - "!doc": "Creates a new function that, when called, has its this keyword set to the provided value, with a given sequence of arguments preceding any provided when the new function was called." - }, - "prototype": "?" - }, - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Function", - "!doc": "Every function in JavaScript is actually a Function object." - }, - "Array": { - "!type": "fn(size: number) -> !custom:Array_ctor", - "isArray": { - "!type": "fn(value: ?) -> bool", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/isArray", - "!doc": "Returns true if an object is an array, false if it is not." - }, - "prototype": { - "!stdProto": "Array", - "length": { - "!type": "number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/length", - "!doc": "An unsigned, 32-bit integer that specifies the number of elements in an array." - }, - "concat": { - "!type": "fn(other: [?]) -> !this", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/concat", - "!doc": "Returns a new array comprised of this array joined with other array(s) and/or value(s)." - }, - "join": { - "!type": "fn(separator?: string) -> string", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/join", - "!doc": "Joins all elements of an array into a string." - }, - "splice": { - "!type": "fn(pos: number, amount: number)", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/splice", - "!doc": "Changes the content of an array, adding new elements while removing old elements." - }, - "pop": { - "!type": "fn() -> !this.", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/pop", - "!doc": "Removes the last element from an array and returns that element." - }, - "push": { - "!type": "fn(newelt: ?) -> number", - "!effects": [ - "propagate !0 !this." - ], - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/push", - "!doc": "Mutates an array by appending the given elements and returning the new length of the array." - }, - "shift": { - "!type": "fn() -> !this.", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/shift", - "!doc": "Removes the first element from an array and returns that element. This method changes the length of the array." - }, - "unshift": { - "!type": "fn(newelt: ?) -> number", - "!effects": [ - "propagate !0 !this." - ], - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/unshift", - "!doc": "Adds one or more elements to the beginning of an array and returns the new length of the array." - }, - "slice": { - "!type": "fn(from: number, to?: number) -> !this", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/slice", - "!doc": "Returns a shallow copy of a portion of an array." - }, - "reverse": { - "!type": "fn()", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/reverse", - "!doc": "Reverses an array in place. The first array element becomes the last and the last becomes the first." - }, - "sort": { - "!type": "fn(compare?: fn(a: ?, b: ?) -> number)", - "!effects": [ - "call !0 !this. !this." - ], - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/sort", - "!doc": "Sorts the elements of an array in place and returns the array." - }, - "indexOf": { - "!type": "fn(elt: ?, from?: number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/indexOf", - "!doc": "Returns the first index at which a given element can be found in the array, or -1 if it is not present." - }, - "lastIndexOf": { - "!type": "fn(elt: ?, from?: number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/lastIndexOf", - "!doc": "Returns the last index at which a given element can be found in the array, or -1 if it is not present. The array is searched backwards, starting at fromIndex." - }, - "every": { - "!type": "fn(test: fn(elt: ?, i: number) -> bool, context?: ?) -> bool", - "!effects": [ - "call !0 this=!1 !this. number" - ], - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/every", - "!doc": "Tests whether all elements in the array pass the test implemented by the provided function." - }, - "some": { - "!type": "fn(test: fn(elt: ?, i: number) -> bool, context?: ?) -> bool", - "!effects": [ - "call !0 this=!1 !this. number" - ], - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/some", - "!doc": "Tests whether some element in the array passes the test implemented by the provided function." - }, - "filter": { - "!type": "fn(test: fn(elt: ?, i: number) -> bool, context?: ?) -> !this", - "!effects": [ - "call !0 this=!1 !this. number" - ], - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/filter", - "!doc": "Creates a new array with all elements that pass the test implemented by the provided function." - }, - "forEach": { - "!type": "fn(f: fn(elt: ?, i: number), context?: ?)", - "!effects": [ - "call !0 this=!1 !this. number" - ], - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/forEach", - "!doc": "Executes a provided function once per array element." - }, - "map": { - "!type": "fn(f: fn(elt: ?, i: number) -> ?, context?: ?) -> [!0.!ret]", - "!effects": [ - "call !0 this=!1 !this. number" - ], - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/map", - "!doc": "Creates a new array with the results of calling a provided function on every element in this array." - }, - "reduce": { - "!type": "fn(combine: fn(sum: ?, elt: ?, i: number) -> ?, init?: ?) -> !0.!ret", - "!effects": [ - "call !0 !1 !this. number" - ], - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/Reduce", - "!doc": "Apply a function against an accumulator and each value of the array (from left-to-right) as to reduce it to a single value." - }, - "reduceRight": { - "!type": "fn(combine: fn(sum: ?, elt: ?, i: number) -> ?, init?: ?) -> !0.!ret", - "!effects": [ - "call !0 !1 !this. number" - ], - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/ReduceRight", - "!doc": "Apply a function simultaneously against two values of the array (from right-to-left) as to reduce it to a single value." - } - }, - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array", - "!doc": "The JavaScript Array global object is a constructor for arrays, which are high-level, list-like objects." - }, - "String": { - "!type": "fn(value: ?) -> string", - "fromCharCode": { - "!type": "fn(code: number) -> string", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/fromCharCode", - "!doc": "Returns a string created by using the specified sequence of Unicode values." - }, - "prototype": { - "!stdProto": "String", - "length": { - "!type": "number", - "!url": "https://developer.mozilla.org/en/docs/JavaScript/Reference/Global_Objects/String/length", - "!doc": "Represents the length of a string." - }, - "": "string", - "charAt": { - "!type": "fn(i: number) -> string", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/charAt", - "!doc": "Returns the specified character from a string." - }, - "charCodeAt": { - "!type": "fn(i: number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/charCodeAt", - "!doc": "Returns the numeric Unicode value of the character at the given index (except for unicode codepoints > 0x10000)." - }, - "indexOf": { - "!type": "fn(char: string, from?: number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/indexOf", - "!doc": "Returns the index within the calling String object of the first occurrence of the specified value, starting the search at fromIndex,\nreturns -1 if the value is not found." - }, - "lastIndexOf": { - "!type": "fn(char: string, from?: number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/lastIndexOf", - "!doc": "Returns the index within the calling String object of the last occurrence of the specified value, or -1 if not found. The calling string is searched backward, starting at fromIndex." - }, - "substring": { - "!type": "fn(from: number, to?: number) -> string", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/substring", - "!doc": "Returns a subset of a string between one index and another, or through the end of the string." - }, - "substr": { - "!type": "fn(from: number, length?: number) -> string", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/substr", - "!doc": "Returns the characters in a string beginning at the specified location through the specified number of characters." - }, - "slice": { - "!type": "fn(from: number, to?: number) -> string", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/slice", - "!doc": "Extracts a section of a string and returns a new string." - }, - "trim": { - "!type": "fn() -> string", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/Trim", - "!doc": "Removes whitespace from both ends of the string." - }, - "toUpperCase": { - "!type": "fn() -> string", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/toUpperCase", - "!doc": "Returns the calling string value converted to uppercase." - }, - "toLowerCase": { - "!type": "fn() -> string", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/toLowerCase", - "!doc": "Returns the calling string value converted to lowercase." - }, - "toLocaleUpperCase": { - "!type": "fn() -> string", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/toLocaleUpperCase", - "!doc": "Returns the calling string value converted to upper case, according to any locale-specific case mappings." - }, - "toLocaleLowerCase": { - "!type": "fn() -> string", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/toLocaleLowerCase", - "!doc": "Returns the calling string value converted to lower case, according to any locale-specific case mappings." - }, - "split": { - "!type": "fn(pattern: string) -> [string]", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/split", - "!doc": "Splits a String object into an array of strings by separating the string into substrings." - }, - "concat": { - "!type": "fn(other: string) -> string", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/concat", - "!doc": "Combines the text of two or more strings and returns a new string." - }, - "localeCompare": { - "!type": "fn(other: string) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/localeCompare", - "!doc": "Returns a number indicating whether a reference string comes before or after or is the same as the given string in sort order." - }, - "match": { - "!type": "fn(pattern: +RegExp) -> [string]", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/match", - "!doc": "Used to retrieve the matches when matching a string against a regular expression." - }, - "replace": { - "!type": "fn(pattern: string|+RegExp, replacement: string) -> string", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/replace", - "!doc": "Returns a new string with some or all matches of a pattern replaced by a replacement. The pattern can be a string or a RegExp, and the replacement can be a string or a function to be called for each match." - }, - "search": { - "!type": "fn(pattern: +RegExp) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/search", - "!doc": "Executes the search for a match between a regular expression and this String object." - } - }, - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String", - "!doc": "The String global object is a constructor for strings, or a sequence of characters." - }, - "Number": { - "!type": "fn(value: ?) -> number", - "MAX_VALUE": { - "!type": "number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number/MAX_VALUE", - "!doc": "The maximum numeric value representable in JavaScript." - }, - "MIN_VALUE": { - "!type": "number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number/MIN_VALUE", - "!doc": "The smallest positive numeric value representable in JavaScript." - }, - "POSITIVE_INFINITY": { - "!type": "number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number/POSITIVE_INFINITY", - "!doc": "A value representing the positive Infinity value." - }, - "NEGATIVE_INFINITY": { - "!type": "number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number/NEGATIVE_INFINITY", - "!doc": "A value representing the negative Infinity value." - }, - "prototype": { - "!stdProto": "Number", - "toString": { - "!type": "fn(radix?: number) -> string", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number/toString", - "!doc": "Returns a string representing the specified Number object" - }, - "toFixed": { - "!type": "fn(digits: number) -> string", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number/toFixed", - "!doc": "Formats a number using fixed-point notation" - }, - "toExponential": { - "!type": "fn(digits: number) -> string", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number/toExponential", - "!doc": "Returns a string representing the Number object in exponential notation" - }, - "toPrecision": { - "!type": "fn(digits: number) -> string", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number/toPrecision", - "!doc": "The toPrecision() method returns a string representing the number to the specified precision." - } - }, - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number", - "!doc": "The Number JavaScript object is a wrapper object allowing you to work with numerical values. A Number object is created using the Number() constructor." - }, - "Boolean": { - "!type": "fn(value: ?) -> bool", - "prototype": { - "!stdProto": "Boolean" - }, - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Boolean", - "!doc": "The Boolean object is an object wrapper for a boolean value." - }, - "RegExp": { - "!type": "fn(source: string, flags?: string)", - "prototype": { - "!stdProto": "RegExp", - "exec": { - "!type": "fn(input: string) -> [string]", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/RegExp/exec", - "!doc": "Executes a search for a match in a specified string. Returns a result array, or null." - }, - "test": { - "!type": "fn(input: string) -> bool", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/RegExp/test", - "!doc": "Executes the search for a match between a regular expression and a specified string. Returns true or false." - }, - "global": { - "!type": "bool", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/RegExp", - "!doc": "Creates a regular expression object for matching text with a pattern." - }, - "ignoreCase": { - "!type": "bool", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/RegExp", - "!doc": "Creates a regular expression object for matching text with a pattern." - }, - "multiline": { - "!type": "bool", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/RegExp/multiline", - "!doc": "Reflects whether or not to search in strings across multiple lines.\n" - }, - "source": { - "!type": "string", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/RegExp/source", - "!doc": "A read-only property that contains the text of the pattern, excluding the forward slashes.\n" - }, - "lastIndex": { - "!type": "number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/RegExp/lastIndex", - "!doc": "A read/write integer property that specifies the index at which to start the next match." - } - }, - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/RegExp", - "!doc": "Creates a regular expression object for matching text with a pattern." - }, - "Date": { - "!type": "fn(ms: number)", - "parse": { - "!type": "fn(source: string) -> +Date", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/parse", - "!doc": "Parses a string representation of a date, and returns the number of milliseconds since January 1, 1970, 00:00:00 UTC." - }, - "UTC": { - "!type": "fn(year: number, month: number, date: number, hour?: number, min?: number, sec?: number, ms?: number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/UTC", - "!doc": "Accepts the same parameters as the longest form of the constructor, and returns the number of milliseconds in a Date object since January 1, 1970, 00:00:00, universal time." - }, - "now": { - "!type": "fn() -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/now", - "!doc": "Returns the number of milliseconds elapsed since 1 January 1970 00:00:00 UTC." - }, - "prototype": { - "toUTCString": { - "!type": "fn() -> string", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/toUTCString", - "!doc": "Converts a date to a string, using the universal time convention." - }, - "toISOString": { - "!type": "fn() -> string", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/toISOString", - "!doc": "JavaScript provides a direct way to convert a date object into a string in ISO format, the ISO 8601 Extended Format." - }, - "toDateString": { - "!type": "fn() -> string", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/toDateString", - "!doc": "Returns the date portion of a Date object in human readable form in American English." - }, - "toTimeString": { - "!type": "fn() -> string", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/toTimeString", - "!doc": "Returns the time portion of a Date object in human readable form in American English." - }, - "toLocaleDateString": { - "!type": "fn() -> string", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/toLocaleDateString", - "!doc": "Converts a date to a string, returning the \"date\" portion using the operating system's locale's conventions.\n" - }, - "toLocaleTimeString": { - "!type": "fn() -> string", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/toLocaleTimeString", - "!doc": "Converts a date to a string, returning the \"time\" portion using the current locale's conventions." - }, - "getTime": { - "!type": "fn() -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/getTime", - "!doc": "Returns the numeric value corresponding to the time for the specified date according to universal time." - }, - "getFullYear": { - "!type": "fn() -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/getFullYear", - "!doc": "Returns the year of the specified date according to local time." - }, - "getYear": { - "!type": "fn() -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/getYear", - "!doc": "Returns the year in the specified date according to local time." - }, - "getMonth": { - "!type": "fn() -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/getMonth", - "!doc": "Returns the month in the specified date according to local time." - }, - "getUTCMonth": { - "!type": "fn() -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/getUTCMonth", - "!doc": "Returns the month of the specified date according to universal time.\n" - }, - "getDate": { - "!type": "fn() -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/getDate", - "!doc": "Returns the day of the month for the specified date according to local time." - }, - "getUTCDate": { - "!type": "fn() -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/getUTCDate", - "!doc": "Returns the day (date) of the month in the specified date according to universal time.\n" - }, - "getDay": { - "!type": "fn() -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/getDay", - "!doc": "Returns the day of the week for the specified date according to local time." - }, - "getUTCDay": { - "!type": "fn() -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/getUTCDay", - "!doc": "Returns the day of the week in the specified date according to universal time.\n" - }, - "getHours": { - "!type": "fn() -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/getHours", - "!doc": "Returns the hour for the specified date according to local time." - }, - "getUTCHours": { - "!type": "fn() -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/getUTCHours", - "!doc": "Returns the hours in the specified date according to universal time.\n" - }, - "getMinutes": { - "!type": "fn() -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/getMinutes", - "!doc": "Returns the minutes in the specified date according to local time." - }, - "getUTCMinutes": { - "!type": "fn() -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date", - "!doc": "Creates JavaScript Date instances which let you work with dates and times." - }, - "getSeconds": { - "!type": "fn() -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/getSeconds", - "!doc": "Returns the seconds in the specified date according to local time." - }, - "getUTCSeconds": { - "!type": "fn() -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/getUTCSeconds", - "!doc": "Returns the seconds in the specified date according to universal time.\n" - }, - "getMilliseconds": { - "!type": "fn() -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/getMilliseconds", - "!doc": "Returns the milliseconds in the specified date according to local time." - }, - "getUTCMilliseconds": { - "!type": "fn() -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/getUTCMilliseconds", - "!doc": "Returns the milliseconds in the specified date according to universal time.\n" - }, - "getTimezoneOffset": { - "!type": "fn() -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/getTimezoneOffset", - "!doc": "Returns the time-zone offset from UTC, in minutes, for the current locale." - }, - "setTime": { - "!type": "fn(date: +Date) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/setTime", - "!doc": "Sets the Date object to the time represented by a number of milliseconds since January 1, 1970, 00:00:00 UTC.\n" - }, - "setFullYear": { - "!type": "fn(year: number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/setFullYear", - "!doc": "Sets the full year for a specified date according to local time.\n" - }, - "setUTCFullYear": { - "!type": "fn(year: number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/setUTCFullYear", - "!doc": "Sets the full year for a specified date according to universal time.\n" - }, - "setMonth": { - "!type": "fn(month: number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/setMonth", - "!doc": "Set the month for a specified date according to local time." - }, - "setUTCMonth": { - "!type": "fn(month: number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/setUTCMonth", - "!doc": "Sets the month for a specified date according to universal time.\n" - }, - "setDate": { - "!type": "fn(day: number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/setDate", - "!doc": "Sets the day of the month for a specified date according to local time." - }, - "setUTCDate": { - "!type": "fn(day: number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/setUTCDate", - "!doc": "Sets the day of the month for a specified date according to universal time.\n" - }, - "setHours": { - "!type": "fn(hour: number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/setHours", - "!doc": "Sets the hours for a specified date according to local time, and returns the number of milliseconds since 1 January 1970 00:00:00 UTC until the time represented by the updated Date instance." - }, - "setUTCHours": { - "!type": "fn(hour: number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/setUTCHours", - "!doc": "Sets the hour for a specified date according to universal time.\n" - }, - "setMinutes": { - "!type": "fn(min: number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/setMinutes", - "!doc": "Sets the minutes for a specified date according to local time." - }, - "setUTCMinutes": { - "!type": "fn(min: number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/setUTCMinutes", - "!doc": "Sets the minutes for a specified date according to universal time.\n" - }, - "setSeconds": { - "!type": "fn(sec: number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/setSeconds", - "!doc": "Sets the seconds for a specified date according to local time." - }, - "setUTCSeconds": { - "!type": "fn(sec: number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/setUTCSeconds", - "!doc": "Sets the seconds for a specified date according to universal time.\n" - }, - "setMilliseconds": { - "!type": "fn(ms: number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/setMilliseconds", - "!doc": "Sets the milliseconds for a specified date according to local time.\n" - }, - "setUTCMilliseconds": { - "!type": "fn(ms: number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/setUTCMilliseconds", - "!doc": "Sets the milliseconds for a specified date according to universal time.\n" - } - }, - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date", - "!doc": "Creates JavaScript Date instances which let you work with dates and times." - }, - "Error": { - "!type": "fn(message: string)", - "prototype": { - "name": { - "!type": "string", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Error/name", - "!doc": "A name for the type of error." - }, - "message": { - "!type": "string", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Error/message", - "!doc": "A human-readable description of the error." - } - }, - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Error", - "!doc": "Creates an error object." - }, - "SyntaxError": { - "!type": "fn(message: string)", - "prototype": "Error.prototype", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/SyntaxError", - "!doc": "Represents an error when trying to interpret syntactically invalid code." - }, - "ReferenceError": { - "!type": "fn(message: string)", - "prototype": "Error.prototype", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/ReferenceError", - "!doc": "Represents an error when a non-existent variable is referenced." - }, - "URIError": { - "!type": "fn(message: string)", - "prototype": "Error.prototype", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/URIError", - "!doc": "Represents an error when a malformed URI is encountered." - }, - "EvalError": { - "!type": "fn(message: string)", - "prototype": "Error.prototype", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/EvalError", - "!doc": "Represents an error regarding the eval function." - }, - "RangeError": { - "!type": "fn(message: string)", - "prototype": "Error.prototype", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/RangeError", - "!doc": "Represents an error when a number is not within the correct range allowed." - }, - "TypeError": { - "!type": "fn(message: string)", - "prototype": "Error.prototype", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/TypeError", - "!doc": "Represents an error an error when a value is not of the expected type." - }, - "parseInt": { - "!type": "fn(string: string, radix?: number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/parseInt", - "!doc": "Parses a string argument and returns an integer of the specified radix or base." - }, - "parseFloat": { - "!type": "fn(string: string) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/parseFloat", - "!doc": "Parses a string argument and returns a floating point number." - }, - "isNaN": { - "!type": "fn(value: number) -> bool", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/isNaN", - "!doc": "Determines whether a value is NaN or not. Be careful, this function is broken. You may be interested in ECMAScript 6 Number.isNaN." - }, - "isFinite": { - "!type": "fn(value: number) -> bool", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/isFinite", - "!doc": "Determines whether the passed value is a finite number." - }, - "eval": { - "!type": "fn(code: string) -> ?", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/eval", - "!doc": "Evaluates JavaScript code represented as a string." - }, - "encodeURI": { - "!type": "fn(uri: string) -> string", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/encodeURI", - "!doc": "Encodes a Uniform Resource Identifier (URI) by replacing each instance of certain characters by one, two, three, or four escape sequences representing the UTF-8 encoding of the character (will only be four escape sequences for characters composed of two \"surrogate\" characters)." - }, - "encodeURIComponent": { - "!type": "fn(uri: string) -> string", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/encodeURIComponent", - "!doc": "Encodes a Uniform Resource Identifier (URI) component by replacing each instance of certain characters by one, two, three, or four escape sequences representing the UTF-8 encoding of the character (will only be four escape sequences for characters composed of two \"surrogate\" characters)." - }, - "decodeURI": { - "!type": "fn(uri: string) -> string", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/decodeURI", - "!doc": "Decodes a Uniform Resource Identifier (URI) previously created by encodeURI or by a similar routine." - }, - "decodeURIComponent": { - "!type": "fn(uri: string) -> string", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/decodeURIComponent", - "!doc": "Decodes a Uniform Resource Identifier (URI) component previously created by encodeURIComponent or by a similar routine." - }, - "Math": { - "E": { - "!type": "number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/E", - "!doc": "The base of natural logarithms, e, approximately 2.718." - }, - "LN2": { - "!type": "number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/LN2", - "!doc": "The natural logarithm of 2, approximately 0.693." - }, - "LN10": { - "!type": "number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/LN10", - "!doc": "The natural logarithm of 10, approximately 2.302." - }, - "LOG2E": { - "!type": "number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/LOG2E", - "!doc": "The base 2 logarithm of E (approximately 1.442)." - }, - "LOG10E": { - "!type": "number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/LOG10E", - "!doc": "The base 10 logarithm of E (approximately 0.434)." - }, - "SQRT1_2": { - "!type": "number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/SQRT1_2", - "!doc": "The square root of 1/2; equivalently, 1 over the square root of 2, approximately 0.707." - }, - "SQRT2": { - "!type": "number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/SQRT2", - "!doc": "The square root of 2, approximately 1.414." - }, - "PI": { - "!type": "number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/PI", - "!doc": "The ratio of the circumference of a circle to its diameter, approximately 3.14159." - }, - "abs": { - "!type": "fn(number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/abs", - "!doc": "Returns the absolute value of a number." - }, - "cos": { - "!type": "fn(number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/cos", - "!doc": "Returns the cosine of a number." - }, - "sin": { - "!type": "fn(number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/sin", - "!doc": "Returns the sine of a number." - }, - "tan": { - "!type": "fn(number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/tan", - "!doc": "Returns the tangent of a number." - }, - "acos": { - "!type": "fn(number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/acos", - "!doc": "Returns the arccosine (in radians) of a number." - }, - "asin": { - "!type": "fn(number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/asin", - "!doc": "Returns the arcsine (in radians) of a number." - }, - "atan": { - "!type": "fn(number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/atan", - "!doc": "Returns the arctangent (in radians) of a number." - }, - "atan2": { - "!type": "fn(y: number, x: number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/atan2", - "!doc": "Returns the arctangent of the quotient of its arguments." - }, - "ceil": { - "!type": "fn(number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/ceil", - "!doc": "Returns the smallest integer greater than or equal to a number." - }, - "floor": { - "!type": "fn(number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/floor", - "!doc": "Returns the largest integer less than or equal to a number." - }, - "round": { - "!type": "fn(number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/round", - "!doc": "Returns the value of a number rounded to the nearest integer." - }, - "exp": { - "!type": "fn(number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/exp", - "!doc": "Returns Ex, where x is the argument, and E is Euler's constant, the base of the natural logarithms." - }, - "log": { - "!type": "fn(number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/log", - "!doc": "Returns the natural logarithm (base E) of a number." - }, - "sqrt": { - "!type": "fn(number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/sqrt", - "!doc": "Returns the square root of a number." - }, - "pow": { - "!type": "fn(number, number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/pow", - "!doc": "Returns base to the exponent power, that is, baseexponent." - }, - "max": { - "!type": "fn(number, number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/max", - "!doc": "Returns the largest of zero or more numbers." - }, - "min": { - "!type": "fn(number, number) -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/min", - "!doc": "Returns the smallest of zero or more numbers." - }, - "random": { - "!type": "fn() -> number", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/random", - "!doc": "Returns a floating-point, pseudo-random number in the range [0, 1) that is, from 0 (inclusive) up to but not including 1 (exclusive), which you can then scale to your desired range." - }, - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math", - "!doc": "A built-in object that has properties and methods for mathematical constants and functions." - }, - "JSON": { - "parse": { - "!type": "fn(json: string) -> ?", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/JSON/parse", - "!doc": "Parse a string as JSON, optionally transforming the value produced by parsing." - }, - "stringify": { - "!type": "fn(value: ?) -> string", - "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/JSON/stringify", - "!doc": "Convert a value to JSON, optionally replacing values if a replacer function is specified, or optionally including only the specified properties if a replacer array is specified." - }, - "!url": "https://developer.mozilla.org/en-US/docs/JSON", - "!doc": "JSON (JavaScript Object Notation) is a data-interchange format. It closely resembles a subset of JavaScript syntax, although it is not a strict subset. (See JSON in the JavaScript Reference for full details.) It is useful when writing any kind of JavaScript-based application, including websites and browser extensions. For example, you might store user information in JSON format in a cookie, or you might store extension preferences in JSON in a string-valued browser preference." - } +/******************************************************************************* + * Copyright (c) 2015 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 + *******************************************************************************/ +"use strict"; + +module.exports = { + "!name": "ecma5", + "!define": { + "Error.prototype": "Error.prototype" + }, + "Infinity": { + "!type": "number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Infinity", + "!doc": "A numeric value representing infinity." + }, + "undefined": { + "!type": "?", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/undefined", + "!doc": "The value undefined." + }, + "NaN": { + "!type": "number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/NaN", + "!doc": "A value representing Not-A-Number." + }, + "Object": { + "!type": "fn()", + "getPrototypeOf": { + "!type": "fn(obj: ?) -> ?", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object/getPrototypeOf", + "!doc": "Returns the prototype (i.e. the internal prototype) of the specified object." + }, + "create": { + "!type": "fn(proto: ?) -> !custom:Object_create", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object/create", + "!doc": "Creates a new object with the specified prototype object and properties." + }, + "defineProperty": { + "!type": "fn(obj: ?, prop: string, desc: ?) -> !custom:Object_defineProperty", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object/defineProperty", + "!doc": "Defines a new property directly on an object, or modifies an existing property on an object, and returns the object. If you want to see how to use the Object.defineProperty method with a binary-flags-like syntax, see this article." + }, + "defineProperties": { + "!type": "fn(obj: ?, props: ?) -> !custom:Object_defineProperties", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object/defineProperty", + "!doc": "Defines a new property directly on an object, or modifies an existing property on an object, and returns the object. If you want to see how to use the Object.defineProperty method with a binary-flags-like syntax, see this article." + }, + "getOwnPropertyDescriptor": { + "!type": "fn(obj: ?, prop: string) -> ?", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object/getOwnPropertyDescriptor", + "!doc": "Returns a property descriptor for an own property (that is, one directly present on an object, not present by dint of being along an object's prototype chain) of a given object." + }, + "keys": { + "!type": "fn(obj: ?) -> [string]", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object/keys", + "!doc": "Returns an array of a given object's own enumerable properties, in the same order as that provided by a for-in loop (the difference being that a for-in loop enumerates properties in the prototype chain as well)." + }, + "getOwnPropertyNames": { + "!type": "fn(obj: ?) -> [string]", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object/getOwnPropertyNames", + "!doc": "Returns an array of all properties (enumerable or not) found directly upon a given object." + }, + "seal": { + "!type": "fn(obj: ?)", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object/seal", + "!doc": "Seals an object, preventing new properties from being added to it and marking all existing properties as non-configurable. Values of present properties can still be changed as long as they are writable." + }, + "isSealed": { + "!type": "fn(obj: ?) -> bool", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object/isSealed", + "!doc": "Determine if an object is sealed." + }, + "freeze": { + "!type": "fn(obj: ?) -> !0", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object/freeze", + "!doc": "Freezes an object: that is, prevents new properties from being added to it; prevents existing properties from being removed; and prevents existing properties, or their enumerability, configurability, or writability, from being changed. In essence the object is made effectively immutable. The method returns the object being frozen." + }, + "isFrozen": { + "!type": "fn(obj: ?) -> bool", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object/isFrozen", + "!doc": "Determine if an object is frozen." + }, + "preventExtensions": { + "!type": "fn(obj: ?)", + "!url": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/preventExtensions", + "!doc": "Prevents new properties from ever being added to an object." + }, + "isExtensible": { + "!type": "fn(obj: ?) -> bool", + "!url": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/isExtensible", + "!doc": "The Object.isExtensible() method determines if an object is extensible (whether it can have new properties added to it)." + }, + "prototype": { + "!stdProto": "Object", + "toString": { + "!type": "fn() -> string", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object/toString", + "!doc": "Returns a string representing the object." + }, + "toLocaleString": { + "!type": "fn() -> string", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object/toLocaleString", + "!doc": "Returns a string representing the object. This method is meant to be overriden by derived objects for locale-specific purposes." + }, + "valueOf": { + "!type": "fn() -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object/valueOf", + "!doc": "Returns the primitive value of the specified object" + }, + "hasOwnProperty": { + "!type": "fn(prop: string) -> bool", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object/hasOwnProperty", + "!doc": "Returns a boolean indicating whether the object has the specified property." + }, + "propertyIsEnumerable": { + "!type": "fn(prop: string) -> bool", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object/propertyIsEnumerable", + "!doc": "Returns a Boolean indicating whether the specified property is enumerable." + }, + "isPrototypeOf": { + "!type": "fn(obj: ?) -> bool", + "!url": "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/isPrototypeOf", + "!doc": "Tests for an object in another object's prototype chain." + } + }, + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object", + "!doc": "Creates an object wrapper." + }, + "Function": { + "!type": "fn(body: string) -> fn()", + "prototype": { + "!stdProto": "Function", + "apply": { + "!type": "fn(this: ?, args: [?])", + "!effects": [ + "call and return !this this=!0 !1. !1. !1." + ], + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Function/apply", + "!doc": "Calls a function with a given this value and arguments provided as an array (or an array like object)." + }, + "call": { + "!type": "fn(this: ?, args?: ?) -> !this.!ret", + "!effects": [ + "call and return !this this=!0 !1 !2 !3 !4" + ], + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Function/call", + "!doc": "Calls a function with a given this value and arguments provided individually." + }, + "bind": { + "!type": "fn(this: ?, args?: ?) -> !custom:Function_bind", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Function/bind", + "!doc": "Creates a new function that, when called, has its this keyword set to the provided value, with a given sequence of arguments preceding any provided when the new function was called." + }, + "prototype": "?" + }, + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Function", + "!doc": "Every function in JavaScript is actually a Function object." + }, + "Array": { + "!type": "fn(size: number) -> !custom:Array_ctor", + "isArray": { + "!type": "fn(value: ?) -> bool", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/isArray", + "!doc": "Returns true if an object is an array, false if it is not." + }, + "prototype": { + "!stdProto": "Array", + "length": { + "!type": "number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/length", + "!doc": "An unsigned, 32-bit integer that specifies the number of elements in an array." + }, + "concat": { + "!type": "fn(other: [?]) -> !this", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/concat", + "!doc": "Returns a new array comprised of this array joined with other array(s) and/or value(s)." + }, + "join": { + "!type": "fn(separator?: string) -> string", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/join", + "!doc": "Joins all elements of an array into a string." + }, + "splice": { + "!type": "fn(pos: number, amount: number)", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/splice", + "!doc": "Changes the content of an array, adding new elements while removing old elements." + }, + "pop": { + "!type": "fn() -> !this.", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/pop", + "!doc": "Removes the last element from an array and returns that element." + }, + "push": { + "!type": "fn(newelt: ?) -> number", + "!effects": [ + "propagate !0 !this." + ], + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/push", + "!doc": "Mutates an array by appending the given elements and returning the new length of the array." + }, + "shift": { + "!type": "fn() -> !this.", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/shift", + "!doc": "Removes the first element from an array and returns that element. This method changes the length of the array." + }, + "unshift": { + "!type": "fn(newelt: ?) -> number", + "!effects": [ + "propagate !0 !this." + ], + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/unshift", + "!doc": "Adds one or more elements to the beginning of an array and returns the new length of the array." + }, + "slice": { + "!type": "fn(from: number, to?: number) -> !this", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/slice", + "!doc": "Returns a shallow copy of a portion of an array." + }, + "reverse": { + "!type": "fn()", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/reverse", + "!doc": "Reverses an array in place. The first array element becomes the last and the last becomes the first." + }, + "sort": { + "!type": "fn(compare?: fn(a: ?, b: ?) -> number)", + "!effects": [ + "call !0 !this. !this." + ], + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/sort", + "!doc": "Sorts the elements of an array in place and returns the array." + }, + "indexOf": { + "!type": "fn(elt: ?, from?: number) -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/indexOf", + "!doc": "Returns the first index at which a given element can be found in the array, or -1 if it is not present." + }, + "lastIndexOf": { + "!type": "fn(elt: ?, from?: number) -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/lastIndexOf", + "!doc": "Returns the last index at which a given element can be found in the array, or -1 if it is not present. The array is searched backwards, starting at fromIndex." + }, + "every": { + "!type": "fn(test: fn(elt: ?, i: number) -> bool, context?: ?) -> bool", + "!effects": [ + "call !0 this=!1 !this. number" + ], + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/every", + "!doc": "Tests whether all elements in the array pass the test implemented by the provided function." + }, + "some": { + "!type": "fn(test: fn(elt: ?, i: number) -> bool, context?: ?) -> bool", + "!effects": [ + "call !0 this=!1 !this. number" + ], + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/some", + "!doc": "Tests whether some element in the array passes the test implemented by the provided function." + }, + "filter": { + "!type": "fn(test: fn(elt: ?, i: number) -> bool, context?: ?) -> !this", + "!effects": [ + "call !0 this=!1 !this. number" + ], + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/filter", + "!doc": "Creates a new array with all elements that pass the test implemented by the provided function." + }, + "forEach": { + "!type": "fn(f: fn(elt: ?, i: number), context?: ?)", + "!effects": [ + "call !0 this=!1 !this. number" + ], + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/forEach", + "!doc": "Executes a provided function once per array element." + }, + "map": { + "!type": "fn(f: fn(elt: ?, i: number) -> ?, context?: ?) -> [!0.!ret]", + "!effects": [ + "call !0 this=!1 !this. number" + ], + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/map", + "!doc": "Creates a new array with the results of calling a provided function on every element in this array." + }, + "reduce": { + "!type": "fn(combine: fn(sum: ?, elt: ?, i: number) -> ?, init?: ?) -> !0.!ret", + "!effects": [ + "call !0 !1 !this. number" + ], + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/Reduce", + "!doc": "Apply a function against an accumulator and each value of the array (from left-to-right) as to reduce it to a single value." + }, + "reduceRight": { + "!type": "fn(combine: fn(sum: ?, elt: ?, i: number) -> ?, init?: ?) -> !0.!ret", + "!effects": [ + "call !0 !1 !this. number" + ], + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array/ReduceRight", + "!doc": "Apply a function simultaneously against two values of the array (from right-to-left) as to reduce it to a single value." + } + }, + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array", + "!doc": "The JavaScript Array global object is a constructor for arrays, which are high-level, list-like objects." + }, + "String": { + "!type": "fn(value: ?) -> string", + "fromCharCode": { + "!type": "fn(code: number) -> string", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/fromCharCode", + "!doc": "Returns a string created by using the specified sequence of Unicode values." + }, + "prototype": { + "!stdProto": "String", + "length": { + "!type": "number", + "!url": "https://developer.mozilla.org/en/docs/JavaScript/Reference/Global_Objects/String/length", + "!doc": "Represents the length of a string." + }, + "": "string", + "charAt": { + "!type": "fn(i: number) -> string", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/charAt", + "!doc": "Returns the specified character from a string." + }, + "charCodeAt": { + "!type": "fn(i: number) -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/charCodeAt", + "!doc": "Returns the numeric Unicode value of the character at the given index (except for unicode codepoints > 0x10000)." + }, + "indexOf": { + "!type": "fn(char: string, from?: number) -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/indexOf", + "!doc": "Returns the index within the calling String object of the first occurrence of the specified value, starting the search at fromIndex,\nreturns -1 if the value is not found." + }, + "lastIndexOf": { + "!type": "fn(char: string, from?: number) -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/lastIndexOf", + "!doc": "Returns the index within the calling String object of the last occurrence of the specified value, or -1 if not found. The calling string is searched backward, starting at fromIndex." + }, + "substring": { + "!type": "fn(from: number, to?: number) -> string", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/substring", + "!doc": "Returns a subset of a string between one index and another, or through the end of the string." + }, + "substr": { + "!type": "fn(from: number, length?: number) -> string", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/substr", + "!doc": "Returns the characters in a string beginning at the specified location through the specified number of characters." + }, + "slice": { + "!type": "fn(from: number, to?: number) -> string", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/slice", + "!doc": "Extracts a section of a string and returns a new string." + }, + "trim": { + "!type": "fn() -> string", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/Trim", + "!doc": "Removes whitespace from both ends of the string." + }, + "toUpperCase": { + "!type": "fn() -> string", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/toUpperCase", + "!doc": "Returns the calling string value converted to uppercase." + }, + "toLowerCase": { + "!type": "fn() -> string", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/toLowerCase", + "!doc": "Returns the calling string value converted to lowercase." + }, + "toLocaleUpperCase": { + "!type": "fn() -> string", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/toLocaleUpperCase", + "!doc": "Returns the calling string value converted to upper case, according to any locale-specific case mappings." + }, + "toLocaleLowerCase": { + "!type": "fn() -> string", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/toLocaleLowerCase", + "!doc": "Returns the calling string value converted to lower case, according to any locale-specific case mappings." + }, + "split": { + "!type": "fn(pattern: string) -> [string]", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/split", + "!doc": "Splits a String object into an array of strings by separating the string into substrings." + }, + "concat": { + "!type": "fn(other: string) -> string", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/concat", + "!doc": "Combines the text of two or more strings and returns a new string." + }, + "localeCompare": { + "!type": "fn(other: string) -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/localeCompare", + "!doc": "Returns a number indicating whether a reference string comes before or after or is the same as the given string in sort order." + }, + "match": { + "!type": "fn(pattern: +RegExp) -> [string]", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/match", + "!doc": "Used to retrieve the matches when matching a string against a regular expression." + }, + "replace": { + "!type": "fn(pattern: string|+RegExp, replacement: string) -> string", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/replace", + "!doc": "Returns a new string with some or all matches of a pattern replaced by a replacement. The pattern can be a string or a RegExp, and the replacement can be a string or a function to be called for each match." + }, + "search": { + "!type": "fn(pattern: +RegExp) -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/search", + "!doc": "Executes the search for a match between a regular expression and this String object." + } + }, + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String", + "!doc": "The String global object is a constructor for strings, or a sequence of characters." + }, + "Number": { + "!type": "fn(value: ?) -> number", + "MAX_VALUE": { + "!type": "number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number/MAX_VALUE", + "!doc": "The maximum numeric value representable in JavaScript." + }, + "MIN_VALUE": { + "!type": "number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number/MIN_VALUE", + "!doc": "The smallest positive numeric value representable in JavaScript." + }, + "POSITIVE_INFINITY": { + "!type": "number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number/POSITIVE_INFINITY", + "!doc": "A value representing the positive Infinity value." + }, + "NEGATIVE_INFINITY": { + "!type": "number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number/NEGATIVE_INFINITY", + "!doc": "A value representing the negative Infinity value." + }, + "prototype": { + "!stdProto": "Number", + "toString": { + "!type": "fn(radix?: number) -> string", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number/toString", + "!doc": "Returns a string representing the specified Number object" + }, + "toFixed": { + "!type": "fn(digits: number) -> string", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number/toFixed", + "!doc": "Formats a number using fixed-point notation" + }, + "toExponential": { + "!type": "fn(digits: number) -> string", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number/toExponential", + "!doc": "Returns a string representing the Number object in exponential notation" + }, + "toPrecision": { + "!type": "fn(digits: number) -> string", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number/toPrecision", + "!doc": "The toPrecision() method returns a string representing the number to the specified precision." + } + }, + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number", + "!doc": "The Number JavaScript object is a wrapper object allowing you to work with numerical values. A Number object is created using the Number() constructor." + }, + "Boolean": { + "!type": "fn(value: ?) -> bool", + "prototype": { + "!stdProto": "Boolean" + }, + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Boolean", + "!doc": "The Boolean object is an object wrapper for a boolean value." + }, + "RegExp": { + "!type": "fn(source: string, flags?: string)", + "prototype": { + "!stdProto": "RegExp", + "exec": { + "!type": "fn(input: string) -> [string]", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/RegExp/exec", + "!doc": "Executes a search for a match in a specified string. Returns a result array, or null." + }, + "test": { + "!type": "fn(input: string) -> bool", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/RegExp/test", + "!doc": "Executes the search for a match between a regular expression and a specified string. Returns true or false." + }, + "global": { + "!type": "bool", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/RegExp", + "!doc": "Creates a regular expression object for matching text with a pattern." + }, + "ignoreCase": { + "!type": "bool", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/RegExp", + "!doc": "Creates a regular expression object for matching text with a pattern." + }, + "multiline": { + "!type": "bool", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/RegExp/multiline", + "!doc": "Reflects whether or not to search in strings across multiple lines.\n" + }, + "source": { + "!type": "string", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/RegExp/source", + "!doc": "A read-only property that contains the text of the pattern, excluding the forward slashes.\n" + }, + "lastIndex": { + "!type": "number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/RegExp/lastIndex", + "!doc": "A read/write integer property that specifies the index at which to start the next match." + } + }, + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/RegExp", + "!doc": "Creates a regular expression object for matching text with a pattern." + }, + "Date": { + "!type": "fn(ms: number)", + "parse": { + "!type": "fn(source: string) -> +Date", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/parse", + "!doc": "Parses a string representation of a date, and returns the number of milliseconds since January 1, 1970, 00:00:00 UTC." + }, + "UTC": { + "!type": "fn(year: number, month: number, date: number, hour?: number, min?: number, sec?: number, ms?: number) -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/UTC", + "!doc": "Accepts the same parameters as the longest form of the constructor, and returns the number of milliseconds in a Date object since January 1, 1970, 00:00:00, universal time." + }, + "now": { + "!type": "fn() -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/now", + "!doc": "Returns the number of milliseconds elapsed since 1 January 1970 00:00:00 UTC." + }, + "prototype": { + "toUTCString": { + "!type": "fn() -> string", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/toUTCString", + "!doc": "Converts a date to a string, using the universal time convention." + }, + "toISOString": { + "!type": "fn() -> string", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/toISOString", + "!doc": "JavaScript provides a direct way to convert a date object into a string in ISO format, the ISO 8601 Extended Format." + }, + "toDateString": { + "!type": "fn() -> string", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/toDateString", + "!doc": "Returns the date portion of a Date object in human readable form in American English." + }, + "toTimeString": { + "!type": "fn() -> string", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/toTimeString", + "!doc": "Returns the time portion of a Date object in human readable form in American English." + }, + "toLocaleDateString": { + "!type": "fn() -> string", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/toLocaleDateString", + "!doc": "Converts a date to a string, returning the \"date\" portion using the operating system's locale's conventions.\n" + }, + "toLocaleTimeString": { + "!type": "fn() -> string", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/toLocaleTimeString", + "!doc": "Converts a date to a string, returning the \"time\" portion using the current locale's conventions." + }, + "getTime": { + "!type": "fn() -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/getTime", + "!doc": "Returns the numeric value corresponding to the time for the specified date according to universal time." + }, + "getFullYear": { + "!type": "fn() -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/getFullYear", + "!doc": "Returns the year of the specified date according to local time." + }, + "getYear": { + "!type": "fn() -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/getYear", + "!doc": "Returns the year in the specified date according to local time." + }, + "getMonth": { + "!type": "fn() -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/getMonth", + "!doc": "Returns the month in the specified date according to local time." + }, + "getUTCMonth": { + "!type": "fn() -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/getUTCMonth", + "!doc": "Returns the month of the specified date according to universal time.\n" + }, + "getDate": { + "!type": "fn() -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/getDate", + "!doc": "Returns the day of the month for the specified date according to local time." + }, + "getUTCDate": { + "!type": "fn() -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/getUTCDate", + "!doc": "Returns the day (date) of the month in the specified date according to universal time.\n" + }, + "getDay": { + "!type": "fn() -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/getDay", + "!doc": "Returns the day of the week for the specified date according to local time." + }, + "getUTCDay": { + "!type": "fn() -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/getUTCDay", + "!doc": "Returns the day of the week in the specified date according to universal time.\n" + }, + "getHours": { + "!type": "fn() -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/getHours", + "!doc": "Returns the hour for the specified date according to local time." + }, + "getUTCHours": { + "!type": "fn() -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/getUTCHours", + "!doc": "Returns the hours in the specified date according to universal time.\n" + }, + "getMinutes": { + "!type": "fn() -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/getMinutes", + "!doc": "Returns the minutes in the specified date according to local time." + }, + "getUTCMinutes": { + "!type": "fn() -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date", + "!doc": "Creates JavaScript Date instances which let you work with dates and times." + }, + "getSeconds": { + "!type": "fn() -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/getSeconds", + "!doc": "Returns the seconds in the specified date according to local time." + }, + "getUTCSeconds": { + "!type": "fn() -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/getUTCSeconds", + "!doc": "Returns the seconds in the specified date according to universal time.\n" + }, + "getMilliseconds": { + "!type": "fn() -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/getMilliseconds", + "!doc": "Returns the milliseconds in the specified date according to local time." + }, + "getUTCMilliseconds": { + "!type": "fn() -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/getUTCMilliseconds", + "!doc": "Returns the milliseconds in the specified date according to universal time.\n" + }, + "getTimezoneOffset": { + "!type": "fn() -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/getTimezoneOffset", + "!doc": "Returns the time-zone offset from UTC, in minutes, for the current locale." + }, + "setTime": { + "!type": "fn(date: +Date) -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/setTime", + "!doc": "Sets the Date object to the time represented by a number of milliseconds since January 1, 1970, 00:00:00 UTC.\n" + }, + "setFullYear": { + "!type": "fn(year: number) -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/setFullYear", + "!doc": "Sets the full year for a specified date according to local time.\n" + }, + "setUTCFullYear": { + "!type": "fn(year: number) -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/setUTCFullYear", + "!doc": "Sets the full year for a specified date according to universal time.\n" + }, + "setMonth": { + "!type": "fn(month: number) -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/setMonth", + "!doc": "Set the month for a specified date according to local time." + }, + "setUTCMonth": { + "!type": "fn(month: number) -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/setUTCMonth", + "!doc": "Sets the month for a specified date according to universal time.\n" + }, + "setDate": { + "!type": "fn(day: number) -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/setDate", + "!doc": "Sets the day of the month for a specified date according to local time." + }, + "setUTCDate": { + "!type": "fn(day: number) -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/setUTCDate", + "!doc": "Sets the day of the month for a specified date according to universal time.\n" + }, + "setHours": { + "!type": "fn(hour: number) -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/setHours", + "!doc": "Sets the hours for a specified date according to local time, and returns the number of milliseconds since 1 January 1970 00:00:00 UTC until the time represented by the updated Date instance." + }, + "setUTCHours": { + "!type": "fn(hour: number) -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/setUTCHours", + "!doc": "Sets the hour for a specified date according to universal time.\n" + }, + "setMinutes": { + "!type": "fn(min: number) -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/setMinutes", + "!doc": "Sets the minutes for a specified date according to local time." + }, + "setUTCMinutes": { + "!type": "fn(min: number) -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/setUTCMinutes", + "!doc": "Sets the minutes for a specified date according to universal time.\n" + }, + "setSeconds": { + "!type": "fn(sec: number) -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/setSeconds", + "!doc": "Sets the seconds for a specified date according to local time." + }, + "setUTCSeconds": { + "!type": "fn(sec: number) -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/setUTCSeconds", + "!doc": "Sets the seconds for a specified date according to universal time.\n" + }, + "setMilliseconds": { + "!type": "fn(ms: number) -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/setMilliseconds", + "!doc": "Sets the milliseconds for a specified date according to local time.\n" + }, + "setUTCMilliseconds": { + "!type": "fn(ms: number) -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date/setUTCMilliseconds", + "!doc": "Sets the milliseconds for a specified date according to universal time.\n" + } + }, + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date", + "!doc": "Creates JavaScript Date instances which let you work with dates and times." + }, + "Error": { + "!type": "fn(message: string)", + "prototype": { + "name": { + "!type": "string", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Error/name", + "!doc": "A name for the type of error." + }, + "message": { + "!type": "string", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Error/message", + "!doc": "A human-readable description of the error." + } + }, + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Error", + "!doc": "Creates an error object." + }, + "SyntaxError": { + "!type": "fn(message: string)", + "prototype": "Error.prototype", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/SyntaxError", + "!doc": "Represents an error when trying to interpret syntactically invalid code." + }, + "ReferenceError": { + "!type": "fn(message: string)", + "prototype": "Error.prototype", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/ReferenceError", + "!doc": "Represents an error when a non-existent variable is referenced." + }, + "URIError": { + "!type": "fn(message: string)", + "prototype": "Error.prototype", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/URIError", + "!doc": "Represents an error when a malformed URI is encountered." + }, + "EvalError": { + "!type": "fn(message: string)", + "prototype": "Error.prototype", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/EvalError", + "!doc": "Represents an error regarding the eval function." + }, + "RangeError": { + "!type": "fn(message: string)", + "prototype": "Error.prototype", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/RangeError", + "!doc": "Represents an error when a number is not within the correct range allowed." + }, + "TypeError": { + "!type": "fn(message: string)", + "prototype": "Error.prototype", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/TypeError", + "!doc": "Represents an error an error when a value is not of the expected type." + }, + "parseInt": { + "!type": "fn(string: string, radix?: number) -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/parseInt", + "!doc": "Parses a string argument and returns an integer of the specified radix or base." + }, + "parseFloat": { + "!type": "fn(string: string) -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/parseFloat", + "!doc": "Parses a string argument and returns a floating point number." + }, + "isNaN": { + "!type": "fn(value: number) -> bool", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/isNaN", + "!doc": "Determines whether a value is NaN or not. Be careful, this function is broken. You may be interested in ECMAScript 6 Number.isNaN." + }, + "isFinite": { + "!type": "fn(value: number) -> bool", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/isFinite", + "!doc": "Determines whether the passed value is a finite number." + }, + "eval": { + "!type": "fn(code: string) -> ?", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/eval", + "!doc": "Evaluates JavaScript code represented as a string." + }, + "encodeURI": { + "!type": "fn(uri: string) -> string", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/encodeURI", + "!doc": "Encodes a Uniform Resource Identifier (URI) by replacing each instance of certain characters by one, two, three, or four escape sequences representing the UTF-8 encoding of the character (will only be four escape sequences for characters composed of two \"surrogate\" characters)." + }, + "encodeURIComponent": { + "!type": "fn(uri: string) -> string", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/encodeURIComponent", + "!doc": "Encodes a Uniform Resource Identifier (URI) component by replacing each instance of certain characters by one, two, three, or four escape sequences representing the UTF-8 encoding of the character (will only be four escape sequences for characters composed of two \"surrogate\" characters)." + }, + "decodeURI": { + "!type": "fn(uri: string) -> string", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/decodeURI", + "!doc": "Decodes a Uniform Resource Identifier (URI) previously created by encodeURI or by a similar routine." + }, + "decodeURIComponent": { + "!type": "fn(uri: string) -> string", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/decodeURIComponent", + "!doc": "Decodes a Uniform Resource Identifier (URI) component previously created by encodeURIComponent or by a similar routine." + }, + "Math": { + "E": { + "!type": "number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/E", + "!doc": "The base of natural logarithms, e, approximately 2.718." + }, + "LN2": { + "!type": "number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/LN2", + "!doc": "The natural logarithm of 2, approximately 0.693." + }, + "LN10": { + "!type": "number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/LN10", + "!doc": "The natural logarithm of 10, approximately 2.302." + }, + "LOG2E": { + "!type": "number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/LOG2E", + "!doc": "The base 2 logarithm of E (approximately 1.442)." + }, + "LOG10E": { + "!type": "number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/LOG10E", + "!doc": "The base 10 logarithm of E (approximately 0.434)." + }, + "SQRT1_2": { + "!type": "number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/SQRT1_2", + "!doc": "The square root of 1/2; equivalently, 1 over the square root of 2, approximately 0.707." + }, + "SQRT2": { + "!type": "number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/SQRT2", + "!doc": "The square root of 2, approximately 1.414." + }, + "PI": { + "!type": "number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/PI", + "!doc": "The ratio of the circumference of a circle to its diameter, approximately 3.14159." + }, + "abs": { + "!type": "fn(number) -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/abs", + "!doc": "Returns the absolute value of a number." + }, + "cos": { + "!type": "fn(number) -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/cos", + "!doc": "Returns the cosine of a number." + }, + "sin": { + "!type": "fn(number) -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/sin", + "!doc": "Returns the sine of a number." + }, + "tan": { + "!type": "fn(number) -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/tan", + "!doc": "Returns the tangent of a number." + }, + "acos": { + "!type": "fn(number) -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/acos", + "!doc": "Returns the arccosine (in radians) of a number." + }, + "asin": { + "!type": "fn(number) -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/asin", + "!doc": "Returns the arcsine (in radians) of a number." + }, + "atan": { + "!type": "fn(number) -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/atan", + "!doc": "Returns the arctangent (in radians) of a number." + }, + "atan2": { + "!type": "fn(y: number, x: number) -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/atan2", + "!doc": "Returns the arctangent of the quotient of its arguments." + }, + "ceil": { + "!type": "fn(number) -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/ceil", + "!doc": "Returns the smallest integer greater than or equal to a number." + }, + "floor": { + "!type": "fn(number) -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/floor", + "!doc": "Returns the largest integer less than or equal to a number." + }, + "round": { + "!type": "fn(number) -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/round", + "!doc": "Returns the value of a number rounded to the nearest integer." + }, + "exp": { + "!type": "fn(number) -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/exp", + "!doc": "Returns Ex, where x is the argument, and E is Euler's constant, the base of the natural logarithms." + }, + "log": { + "!type": "fn(number) -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/log", + "!doc": "Returns the natural logarithm (base E) of a number." + }, + "sqrt": { + "!type": "fn(number) -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/sqrt", + "!doc": "Returns the square root of a number." + }, + "pow": { + "!type": "fn(number, number) -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/pow", + "!doc": "Returns base to the exponent power, that is, baseexponent." + }, + "max": { + "!type": "fn(number, number) -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/max", + "!doc": "Returns the largest of zero or more numbers." + }, + "min": { + "!type": "fn(number, number) -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/min", + "!doc": "Returns the smallest of zero or more numbers." + }, + "random": { + "!type": "fn() -> number", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/random", + "!doc": "Returns a floating-point, pseudo-random number in the range [0, 1) that is, from 0 (inclusive) up to but not including 1 (exclusive), which you can then scale to your desired range." + }, + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math", + "!doc": "A built-in object that has properties and methods for mathematical constants and functions." + }, + "JSON": { + "parse": { + "!type": "fn(json: string) -> ?", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/JSON/parse", + "!doc": "Parse a string as JSON, optionally transforming the value produced by parsing." + }, + "stringify": { + "!type": "fn(value: ?) -> string", + "!url": "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/JSON/stringify", + "!doc": "Convert a value to JSON, optionally replacing values if a replacer function is specified, or optionally including only the specified properties if a replacer array is specified." + }, + "!url": "https://developer.mozilla.org/en-US/docs/JSON", + "!doc": "JSON (JavaScript Object Notation) is a data-interchange format. It closely resembles a subset of JavaScript syntax, although it is not a strict subset. (See JSON in the JavaScript Reference for full details.) It is useful when writing any kind of JavaScript-based application, including websites and browser extensions. For example, you might store user information in JSON format in a cookie, or you might store extension preferences in JSON in a string-valued browser preference." + } }; \ No newline at end of file diff --git a/qt/org.eclipse.cdt.qt.core/tern-qml/test/run.js b/qt/org.eclipse.cdt.qt.core/tern-qml/test/run.js index 0ab69213c8d..9e07a017776 100644 --- a/qt/org.eclipse.cdt.qt.core/tern-qml/test/run.js +++ b/qt/org.eclipse.cdt.qt.core/tern-qml/test/run.js @@ -1,82 +1,82 @@ -/******************************************************************************* - * Copyright (c) 2015 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 - *******************************************************************************/ -"use strict"; - -var driver = require("./driver.js"); - -function group(name) { - if (typeof console === "object" && console.group) { - console.group(name); - } -} - -function groupEnd() { - if (typeof console === "object" && console.groupEnd) { - console.groupEnd(); - } -} - -function log(title, message) { - if (typeof console === "object") console.log(title, message); -} - -var stats, tests = []; -tests.push(require("./test-scoping.js")); -tests.push(require("./test-finddef.js")); -tests.push(require("./test-completions.js")); -tests.push(require("./test-parse.js")); - -function report(state, code, message) { - if (state != "ok") {++stats.failed; log(code, message);} - ++stats.testsRun; -} - -group("Errors"); - -for (var i = 0; i < tests.length; i++) { - var test = tests[i]; - group(test.group); - stats = test.stats = {testsRun: 0, failed: 0}; - var config = test.config || {}; - config.group = test.group; - var t0 = +new Date(); - driver.runTests(config, report); - test.stats.duration = +new Date() - t0; - groupEnd(); -} - -groupEnd(); - -function outputStats(name, stats) { - log(name + ":", stats.testsRun + " tests run in " + stats.duration + "ms; " + - (stats.failed ? stats.failed + " failures." : "all passed.")); -} - -var total = {testsRun: 0, failed: 0, duration: 0}; - -group("Stats"); - -for (var i = 0; i < tests.length; i++) { - var test = tests[i]; - var stats = test.stats; - outputStats(test.group, stats); - for (var key in stats) total[key] += stats[key]; -} - -outputStats("Total", total); - -groupEnd(); - -if (total.failed && typeof process === "object") { - process.stdout.write("", function () { - process.exit(1); - }); +/******************************************************************************* + * Copyright (c) 2015 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 + *******************************************************************************/ +"use strict"; + +var driver = require("./driver.js"); + +function group(name) { + if (typeof console === "object" && console.group) { + console.group(name); + } +} + +function groupEnd() { + if (typeof console === "object" && console.groupEnd) { + console.groupEnd(); + } +} + +function log(title, message) { + if (typeof console === "object") console.log(title, message); +} + +var stats, tests = []; +tests.push(require("./test-scoping.js")); +tests.push(require("./test-finddef.js")); +tests.push(require("./test-completions.js")); +tests.push(require("./test-parse.js")); + +function report(state, code, message) { + if (state != "ok") {++stats.failed; log(code, message);} + ++stats.testsRun; +} + +group("Errors"); + +for (var i = 0; i < tests.length; i++) { + var test = tests[i]; + group(test.group); + stats = test.stats = {testsRun: 0, failed: 0}; + var config = test.config || {}; + config.group = test.group; + var t0 = +new Date(); + driver.runTests(config, report); + test.stats.duration = +new Date() - t0; + groupEnd(); +} + +groupEnd(); + +function outputStats(name, stats) { + log(name + ":", stats.testsRun + " tests run in " + stats.duration + "ms; " + + (stats.failed ? stats.failed + " failures." : "all passed.")); +} + +var total = {testsRun: 0, failed: 0, duration: 0}; + +group("Stats"); + +for (var i = 0; i < tests.length; i++) { + var test = tests[i]; + var stats = test.stats; + outputStats(test.group, stats); + for (var key in stats) total[key] += stats[key]; +} + +outputStats("Total", total); + +groupEnd(); + +if (total.failed && typeof process === "object") { + process.stdout.write("", function () { + process.exit(1); + }); } \ No newline at end of file diff --git a/qt/org.eclipse.cdt.qt.core/tern-qml/test/test-completions.js b/qt/org.eclipse.cdt.qt.core/tern-qml/test/test-completions.js index 56be852048c..c0198a83392 100644 --- a/qt/org.eclipse.cdt.qt.core/tern-qml/test/test-completions.js +++ b/qt/org.eclipse.cdt.qt.core/tern-qml/test/test-completions.js @@ -1,711 +1,711 @@ -/******************************************************************************* - * Copyright (c) 2015 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 - *******************************************************************************/ -"use strict"; - -var driver = require("./driver.js"); -var test = driver.test; -var testCompletion = driver.testCompletion; -var assertCompletion = driver.assertCompletion; -var groupStart = driver.groupStart; -var groupEnd = driver.groupEnd; - -var group = exports.group = "Code Completion"; -groupStart(group); - -// Local Directory Completions -testCompletion('My|', { - start: { line: 0, ch: 0 }, - end: { line: 0, ch: 2 }, - isProperty: false, - isObjectKey: false, - completions: [{ name: "MyObject", type: "MyObject", origin: "MyObject.qml" }] -}, function (server) { - server.addFile("MyObject.qml", "Button {}"); -}); - -testCompletion('import "./subdir/"\nSameDirTest {\n\t|\n}', { - start: { line: 2, ch: 1 }, - end: { line: 2, ch: 1 }, - isProperty: false, - isObjectKey: false, - completions: [ - { name: "obj", type: "?", origin: "subdir/Button.qml" }, - { name: "Button", type: "Button", origin: "subdir/Button.qml" }, - { name: "SameDirTest", type: "SameDirTest", origin: "subdir/SameDirTest.qml" } - ] -}, function (server) { - server.addFile("subdir/SameDirTest.qml", "Button {}"); - server.addFile("subdir/Button.qml", "QtObject {property var obj}"); -}); - -testCompletion('MyObject {\n\t|\n}', { - start: { line: 1, ch: 1 }, - end: { line: 1, ch: 1 }, - isProperty: false, - isObjectKey: false, - completions: [ - { name: "width", type: "number", origin: "MyObject.qml" }, - { name: "MyObject", type: "MyObject", origin: "MyObject.qml" } - ] -}, function (server) { - server.addFile("MyObject.qml", "Button {\n\tproperty int width\n}"); -}); - -testCompletion('MyObject {\n\tid: obj\n\ts: obj.|\n}', { - start: { line: 2, ch: 8 }, - end: { line: 2, ch: 8 }, - isProperty: true, - isObjectKey: false, - completions: [{ name: "width", type: "number", origin: "MyObject.qml" }] -}, function (server) { - server.addFile("MyObject.qml", "Button {\n\tproperty int width\n}"); -}); - -testCompletion('Button {\n\t|\n}', { - start: { line: 1, ch: 1 }, - end: { line: 1, ch: 1 }, - isProperty: false, - isObjectKey: false, - completions: [ - { name: "onClicked", type: "Signal Handler", origin: "Button.qml" }, - { name: "Button", type: "Button", origin: "Button.qml" } - ] -}, function (server) { - server.addFile("Button.qml", "QtObject {\n\signal clicked(int mouseX, int mouseY)\n}"); -}); - -testCompletion('CButton {\n\t|\n}', { - start: { line: 1, ch: 1 }, - end: { line: 1, ch: 1 }, - isProperty: false, - isObjectKey: false, - completions: [ - { name: "height", type: "number", origin: "Button.qml" }, - { name: "numClicks", type: "number", origin: "CButton.qml" }, - { name: "text", type: "string", origin: "Button.qml" }, - { name: "width", type: "number", origin: "Button.qml" }, - { name: "Button", type: "Button", origin: "Button.qml" }, - { name: "CButton", type: "CButton", origin: "CButton.qml" } - ] -}, function (server) { - server.addFile("CButton.qml", "Button {\n\tproperty int numClicks\n}"); - server.addFile("Button.qml", "QtObject {\n\tproperty string text\n\tproperty int width\n\tproperty int height\n}"); -}); - -testCompletion('CButton {\n\tid:btn\n\ts: btn.|\n}', { - start: { line: 2, ch: 8 }, - end: { line: 2, ch: 8 }, - isProperty: true, - isObjectKey: false, - completions: [ - { name: "height", type: "number", origin: "Button.qml" }, - { name: "numClicks", type: "number", origin: "CButton.qml" }, - { name: "text", type: "string", origin: "Button.qml" }, - { name: "width", type: "number", origin: "Button.qml" } - ] -}, function (server) { - server.addFile("CButton.qml", "Button {\n\tproperty int numClicks\n}"); - server.addFile("Button.qml", "QtObject {\n\tproperty string text\n\tproperty int width\n\tproperty int height\n}"); -}); - -// Directory Import Completions -testCompletion('NotVisible {\n\t|\n}', { - start: { line: 1, ch: 1 }, - end: { line: 1, ch: 1 }, - isProperty: false, - isObjectKey: false, - completions: [] -}, function (server) { - server.addFile("subdir/NotVisible.qml", "QtObject {\n\signal clicked(int mouseX, int mouseY)\n}"); -}); - -testCompletion('import "./subdir/"\nButton {\n\t|\n}', { - start: { line: 2, ch: 1 }, - end: { line: 2, ch: 1 }, - isProperty: false, - isObjectKey: false, - completions: [ - { name: "onClicked", type: "Signal Handler", origin: "subdir/Button.qml" }, - { name: "Button", type: "Button", origin: "subdir/Button.qml" } - ] -}, function (server) { - server.addFile("subdir/Button.qml", "QtObject {\n\signal clicked(int mouseX, int mouseY)\n}"); -}); - -testCompletion('import "./subdir/" as Controls\nControls.Button {\n\t|\n}', { - start: { line: 2, ch: 1 }, - end: { line: 2, ch: 1 }, - isProperty: false, - isObjectKey: false, - completions: [ - { name: "onClicked", type: "Signal Handler", origin: "subdir/Button.qml" }, - { name: "Controls", type: "Controls", origin: "main.qml" } - ] -}, function (server) { - server.addFile("subdir/Button.qml", "QtObject {\n\signal clicked(int mouseX, int mouseY)\n}"); -}); - -testCompletion('import "./subdir/" as Controls\nControls.|', { - start: { line: 1, ch: 9 }, - end: { line: 1, ch: 9 }, - isProperty: false, - isObjectKey: false, - completions: [ - { name: "Button", type: "Button", origin: "subdir/Button.qml" } - ] -}, function (server) { - server.addFile("subdir/Button.qml", "QtObject {\n\signal clicked(int mouseX, int mouseY)\n}"); -}); - -testCompletion('import "./subdir/" as Controls\nControls.|.', { - start: { line: 1, ch: 9 }, - end: { line: 1, ch: 9 }, - isProperty: false, - isObjectKey: false, - completions: [ - { name: "Button", type: "Button", origin: "subdir/Button.qml" } - ] -}, function (server) { - server.addFile("subdir/Button.qml", "QtObject {\n\signal clicked(int mouseX, int mouseY)\n}"); -}); - -testCompletion('import "./subdir/" as Controls\nControls..|', { - start: { line: 1, ch: 10 }, - end: { line: 1, ch: 10 }, - isProperty: false, - isObjectKey: false, - completions: [] -}, function (server) { - server.addFile("subdir/Button.qml", "QtObject {\n\signal clicked(int mouseX, int mouseY)\n}"); -}); - -test("{Add File After Import}", function (server, callback, name) { - var failed; - assertCompletion(server, "", { - start: { line: 0, ch: 0 }, - end: { line: 0, ch: 0 }, - isProperty: false, - isObjectKey: false, - completions: [] - }, 0, function (mis) { - failed = mis; - }); - if (failed) { - return callback("fail", name, "- failed on initial file " + failed); - } - server.addFile("MyObject.qml", "QtObject {\n\tproperty var test\n}"); - assertCompletion(server, "", { - start: { line: 0, ch: 0 }, - end: { line: 0, ch: 0 }, - isProperty: false, - isObjectKey: false, - completions: [{ name: "MyObject", type: "MyObject", origin: "MyObject.qml" }] - }, 0, function (mis) { - failed = mis; - }); - if (failed) { - return callback("fail", name, "- failed after adding file " + failed); - } - return callback("ok", name); -}); - -// Cyclic Dependency Completions -testCompletion('Cyclic {\n\t|\n}', { - start: { line: 1, ch: 1 }, - end: { line: 1, ch: 1 }, - isProperty: false, - isObjectKey: false, - completions: [ - { name: "test", type: "?", origin: "Cyclic.qml" }, - { name: "Cyclic", type: "Cyclic", origin: "Cyclic.qml" } - ] -}, function (server) { - server.addFile("Cyclic.qml", "Cyclic {\n\property var test\n}"); -}); - -testCompletion('Cyclic2 {\n\t|\n}', { - start: { line: 1, ch: 1 }, - end: { line: 1, ch: 1 }, - isProperty: false, - isObjectKey: false, - completions: [ - { name: "test1", type: "?", origin: "Cyclic2.qml" }, - { name: "test2", type: "?", origin: "OtherCyclic.qml" }, - { name: "Cyclic2", type: "Cyclic2", origin: "Cyclic2.qml" }, - { name: "OtherCyclic", type: "OtherCyclic", origin: "OtherCyclic.qml" } - ] -}, function (server) { - server.addFile("Cyclic2.qml", "OtherCyclic {\n\property var test1\n}"); - server.addFile("OtherCyclic.qml", "Cyclic2 {\n\property var test2\n}"); -}); - -testCompletion('OtherCyclic {\n\t|\n}', { - start: { line: 1, ch: 1 }, - end: { line: 1, ch: 1 }, - isProperty: false, - isObjectKey: false, - completions: [ - { name: "test2", type: "?", origin: "OtherCyclic.qml" }, - { name: "Cyclic", type: "Cyclic", origin: "Cyclic.qml" }, - { name: "OtherCyclic", type: "OtherCyclic", origin: "OtherCyclic.qml" } - ] -}, function (server) { - server.addFile("Cyclic.qml", "OtherCyclic {\n\property var test1\n}"); - server.addFile("OtherCyclic.qml", "Cyclic {\n\property var test2\n}"); -}); - -// QML Object Property Completions -testCompletion("Window {\n\tproperty int height\n\the|\n}", { - start: { line: 2, ch: 1 }, - end: { line: 2, ch: 3 }, - isProperty: false, - isObjectKey: false, - completions: [{ name: "height", type: "number", origin: "main.qml" }] -}); - -testCompletion("Window {\n\tproperty int height\n\tproperty int width\n\tproperty string text\n\t|\n}", { - start: { line: 4, ch: 1 }, - end: { line: 4, ch: 1 }, - isProperty: false, - isObjectKey: false, - completions: [ - { name: "height", type: "number", origin: "main.qml" }, - { name: "text", type: "string", origin: "main.qml" }, - { name: "width", type: "number", origin: "main.qml" } - ] -}); - -testCompletion("Window {\n\tproperty int height\n\tObject {\n\t\t|\n\t}\n}", { - start: { line: 3, ch: 2 }, - end: { line: 3, ch: 2 }, - isProperty: false, - isObjectKey: false, - completions: [] -}); - -testCompletion("Window {\n\tproperty var prop\n\tfunction test() {\n\t\t|\n\t}\n}", { - start: { line: 3, ch: 2 }, - end: { line: 3, ch: 2 }, - isProperty: false, - isObjectKey: false, - completions: [ - { name: "prop", type: "?", origin: "main.qml" }, - { name: "test", type: "fn()", origin: "main.qml" } - ] -}, function (server) { server.jsDefs = []; }); - -// QML ID Property Completions -testCompletion("Window {\n\tid: btn\n\t|\n}", { - start: { line: 2, ch: 1 }, - end: { line: 2, ch: 1 }, - isProperty: false, - isObjectKey: false, - completions: [] -}); - -testCompletion("Window {\n\tButton {\n\t\tid: btn\n\t\tproperty int height\n\t}\n\ttest: btn.|\n}", { - start: { line: 5, ch: 11 }, - end: { line: 5, ch: 11 }, - isProperty: true, - isObjectKey: false, - completions: [{ name: "height", type: "number", origin: "main.qml" }] -}, function (server) { server.jsDefs = []; }); - -testCompletion("Window {\n\tproperty var btn\n\tButton {\n\t\tid: btn\n\t\tproperty int height\n\t}\n\ttest: btn.|\n}", { - start: { line: 6, ch: 11 }, - end: { line: 6, ch: 11 }, - isProperty: true, - isObjectKey: false, - completions: [{ name: "height", type: "number", origin: "main.qml" }] -}, function (server) { server.jsDefs = []; }); - -testCompletion("Window {\n\tButton {\n\t\tproperty var id\n\t\tid: btn\n\t}\n\ts: bt|\n}", { - start: { line: 5, ch: 4 }, - end: { line: 5, ch: 6 }, - isProperty: false, - isObjectKey: false, - completions: [{ name: "btn", type: "Button", origin: "main.qml" }] -}, function (server) { server.jsDefs = []; }); - -testCompletion("Window {\n\tButton {\n\t\tproperty var id\n\t\tid: btn\n\t\ts: i|\n\t}\n}", { - start: { line: 4, ch: 5 }, - end: { line: 4, ch: 6 }, - isProperty: false, - isObjectKey: false, - completions: [{ name: "id", type: "?", origin: "main.qml" }] -}, function (server) { server.jsDefs = []; }); - -testCompletion("Window {\n\tButton {\n\t\tproperty var id: 34\n\t\tid: btn\n\t\ts: i|\n\t}\n}", { - start: { line: 4, ch: 5 }, - end: { line: 4, ch: 6 }, - isProperty: false, - isObjectKey: false, - completions: [{ name: "id", type: "number", origin: "main.qml" }] -}, function (server) { server.jsDefs = []; }); - -testCompletion("Window {\n\tButton {\n\t\tproperty string id\n\t\tid: btn\n\t\ts: i|\n\t}\n}", { - start: { line: 4, ch: 5 }, - end: { line: 4, ch: 6 }, - isProperty: false, - isObjectKey: false, - completions: [{ name: "id", type: "string", origin: "main.qml" }] -}, function (server) { server.jsDefs = []; }); - -testCompletion("Window {\n\tButton {\n\t\tproperty var id\n\t\ts: i|\n\t}\n}", { - start: { line: 3, ch: 5 }, - end: { line: 3, ch: 6 }, - isProperty: false, - isObjectKey: false, - completions: [{ name: "id", type: "?", origin: "main.qml" }] -}, function (server) { server.jsDefs = []; }); - -testCompletion("Window {\n\tButton {\n\t\tproperty var id: 34\n\t\ts: i|\n\t}\n}", { - start: { line: 3, ch: 5 }, - end: { line: 3, ch: 6 }, - isProperty: false, - isObjectKey: false, - completions: [{ name: "id", type: "number", origin: "main.qml" }] -}, function (server) { server.jsDefs = []; }); - -testCompletion("Window {\n\tButton {\n\t\tproperty string id\n\t\ts: i|\n\t}\n}", { - start: { line: 3, ch: 5 }, - end: { line: 3, ch: 6 }, - isProperty: false, - isObjectKey: false, - completions: [{ name: "id", type: "string", origin: "main.qml" }] -}, function (server) { server.jsDefs = []; }); - -testCompletion("Window {\n\tid: wind\n\tfunction test() {\n\t\t|\n\t}\n}", { - start: { line: 3, ch: 2 }, - end: { line: 3, ch: 2 }, - isProperty: false, - isObjectKey: false, - completions: [ - { name: "test", type: "fn()", origin: "main.qml" }, - { name: "wind", type: "Window", origin: "main.qml" } - ] -}, function (server) { server.jsDefs = []; }); - -// JavaScript Completions -testCompletion("Window {\n\tproperty var test: |\n}", { - start: { line: 1, ch: 20 }, - end: { line: 1, ch: 20 }, - isProperty: false, - isObjectKey: false, - completions: [ - { name: "decodeURI", type: "fn(uri: string) -> string", origin: "ecma5" }, - { name: "decodeURIComponent", type: "fn(uri: string) -> string", origin: "ecma5" }, - { name: "encodeURI", type: "fn(uri: string) -> string", origin: "ecma5" }, - { name: "encodeURIComponent", type: "fn(uri: string) -> string", origin: "ecma5" }, - { name: "eval", type: "fn(code: string)", origin: "ecma5" }, - { name: "isFinite", type: "fn(value: number) -> bool", origin: "ecma5" }, - { name: "isNaN", type: "fn(value: number) -> bool", origin: "ecma5" }, - { name: "parseFloat", type: "fn(string: string) -> number", origin: "ecma5" }, - { name: "parseInt", type: "fn(string: string, radix?: number) -> number", origin: "ecma5" }, - { name: "test", type: "?", origin: "main.qml" }, - { name: "undefined", type: "?", origin: "ecma5" }, - { name: "Array", type: "fn(size: number)", origin: "ecma5" }, - { name: "Boolean", type: "fn(value: ?) -> bool", origin: "ecma5" }, - { name: "Date", type: "fn(ms: number)", origin: "ecma5" }, - { name: "Error", type: "fn(message: string)", origin: "ecma5" }, - { name: "EvalError", type: "fn(message: string)", origin: "ecma5" }, - { name: "Function", type: "fn(body: string) -> fn()", origin: "ecma5" }, - { name: "Infinity", type: "number", origin: "ecma5" }, - { name: "JSON", type: "JSON", origin: "ecma5" }, - { name: "Math", type: "Math", origin: "ecma5" }, - { name: "NaN", type: "number", origin: "ecma5" }, - { name: "Number", type: "fn(value: ?) -> number", origin: "ecma5" }, - { name: "Object", type: "fn()", origin: "ecma5" }, - { name: "RangeError", type: "fn(message: string)", origin: "ecma5" }, - { name: "ReferenceError", type: "fn(message: string)", origin: "ecma5" }, - { name: "RegExp", type: "fn(source: string, flags?: string)", origin: "ecma5" }, - { name: "String", type: "fn(value: ?) -> string", origin: "ecma5" }, - { name: "SyntaxError", type: "fn(message: string)", origin: "ecma5" }, - { name: "TypeError", type: "fn(message: string)", origin: "ecma5" }, - { name: "URIError", type: "fn(message: string)", origin: "ecma5" } - ] -}); - -testCompletion("Window {\n\ttest: |\n}", { - start: { line: 1, ch: 7 }, - end: { line: 1, ch: 7 }, - isProperty: false, - isObjectKey: false, - completions: [ - { name: "decodeURI", type: "fn(uri: string) -> string", origin: "ecma5" }, - { name: "decodeURIComponent", type: "fn(uri: string) -> string", origin: "ecma5" }, - { name: "encodeURI", type: "fn(uri: string) -> string", origin: "ecma5" }, - { name: "encodeURIComponent", type: "fn(uri: string) -> string", origin: "ecma5" }, - { name: "eval", type: "fn(code: string)", origin: "ecma5" }, - { name: "isFinite", type: "fn(value: number) -> bool", origin: "ecma5" }, - { name: "isNaN", type: "fn(value: number) -> bool", origin: "ecma5" }, - { name: "parseFloat", type: "fn(string: string) -> number", origin: "ecma5" }, - { name: "parseInt", type: "fn(string: string, radix?: number) -> number", origin: "ecma5" }, - { name: "undefined", type: "?", origin: "ecma5" }, - { name: "Array", type: "fn(size: number)", origin: "ecma5" }, - { name: "Boolean", type: "fn(value: ?) -> bool", origin: "ecma5" }, - { name: "Date", type: "fn(ms: number)", origin: "ecma5" }, - { name: "Error", type: "fn(message: string)", origin: "ecma5" }, - { name: "EvalError", type: "fn(message: string)", origin: "ecma5" }, - { name: "Function", type: "fn(body: string) -> fn()", origin: "ecma5" }, - { name: "Infinity", type: "number", origin: "ecma5" }, - { name: "JSON", type: "JSON", origin: "ecma5" }, - { name: "Math", type: "Math", origin: "ecma5" }, - { name: "NaN", type: "number", origin: "ecma5" }, - { name: "Number", type: "fn(value: ?) -> number", origin: "ecma5" }, - { name: "Object", type: "fn()", origin: "ecma5" }, - { name: "RangeError", type: "fn(message: string)", origin: "ecma5" }, - { name: "ReferenceError", type: "fn(message: string)", origin: "ecma5" }, - { name: "RegExp", type: "fn(source: string, flags?: string)", origin: "ecma5" }, - { name: "String", type: "fn(value: ?) -> string", origin: "ecma5" }, - { name: "SyntaxError", type: "fn(message: string)", origin: "ecma5" }, - { name: "TypeError", type: "fn(message: string)", origin: "ecma5" }, - { name: "URIError", type: "fn(message: string)", origin: "ecma5" } - ] -}); - -testCompletion("Window {\n\ttest: {\n\t\t|\n\t}\n}", { - start: { line: 2, ch: 2 }, - end: { line: 2, ch: 2 }, - isProperty: false, - isObjectKey: false, - completions: [ - { name: "decodeURI", type: "fn(uri: string) -> string", origin: "ecma5" }, - { name: "decodeURIComponent", type: "fn(uri: string) -> string", origin: "ecma5" }, - { name: "encodeURI", type: "fn(uri: string) -> string", origin: "ecma5" }, - { name: "encodeURIComponent", type: "fn(uri: string) -> string", origin: "ecma5" }, - { name: "eval", type: "fn(code: string)", origin: "ecma5" }, - { name: "isFinite", type: "fn(value: number) -> bool", origin: "ecma5" }, - { name: "isNaN", type: "fn(value: number) -> bool", origin: "ecma5" }, - { name: "parseFloat", type: "fn(string: string) -> number", origin: "ecma5" }, - { name: "parseInt", type: "fn(string: string, radix?: number) -> number", origin: "ecma5" }, - { name: "undefined", type: "?", origin: "ecma5" }, - { name: "Array", type: "fn(size: number)", origin: "ecma5" }, - { name: "Boolean", type: "fn(value: ?) -> bool", origin: "ecma5" }, - { name: "Date", type: "fn(ms: number)", origin: "ecma5" }, - { name: "Error", type: "fn(message: string)", origin: "ecma5" }, - { name: "EvalError", type: "fn(message: string)", origin: "ecma5" }, - { name: "Function", type: "fn(body: string) -> fn()", origin: "ecma5" }, - { name: "Infinity", type: "number", origin: "ecma5" }, - { name: "JSON", type: "JSON", origin: "ecma5" }, - { name: "Math", type: "Math", origin: "ecma5" }, - { name: "NaN", type: "number", origin: "ecma5" }, - { name: "Number", type: "fn(value: ?) -> number", origin: "ecma5" }, - { name: "Object", type: "fn()", origin: "ecma5" }, - { name: "RangeError", type: "fn(message: string)", origin: "ecma5" }, - { name: "ReferenceError", type: "fn(message: string)", origin: "ecma5" }, - { name: "RegExp", type: "fn(source: string, flags?: string)", origin: "ecma5" }, - { name: "String", type: "fn(value: ?) -> string", origin: "ecma5" }, - { name: "SyntaxError", type: "fn(message: string)", origin: "ecma5" }, - { name: "TypeError", type: "fn(message: string)", origin: "ecma5" }, - { name: "URIError", type: "fn(message: string)", origin: "ecma5" } - ] -}); - -testCompletion("Window {\n\tfunction test() {\n\t\t|\n\t}\n}", { - start: { line: 2, ch: 2 }, - end: { line: 2, ch: 2 }, - isProperty: false, - isObjectKey: false, - completions: [ - { name: "decodeURI", type: "fn(uri: string) -> string", origin: "ecma5" }, - { name: "decodeURIComponent", type: "fn(uri: string) -> string", origin: "ecma5" }, - { name: "encodeURI", type: "fn(uri: string) -> string", origin: "ecma5" }, - { name: "encodeURIComponent", type: "fn(uri: string) -> string", origin: "ecma5" }, - { name: "eval", type: "fn(code: string)", origin: "ecma5" }, - { name: "isFinite", type: "fn(value: number) -> bool", origin: "ecma5" }, - { name: "isNaN", type: "fn(value: number) -> bool", origin: "ecma5" }, - { name: "parseFloat", type: "fn(string: string) -> number", origin: "ecma5" }, - { name: "parseInt", type: "fn(string: string, radix?: number) -> number", origin: "ecma5" }, - { name: "test", type: "fn()", origin: "main.qml" }, - { name: "undefined", type: "?", origin: "ecma5" }, - { name: "Array", type: "fn(size: number)", origin: "ecma5" }, - { name: "Boolean", type: "fn(value: ?) -> bool", origin: "ecma5" }, - { name: "Date", type: "fn(ms: number)", origin: "ecma5" }, - { name: "Error", type: "fn(message: string)", origin: "ecma5" }, - { name: "EvalError", type: "fn(message: string)", origin: "ecma5" }, - { name: "Function", type: "fn(body: string) -> fn()", origin: "ecma5" }, - { name: "Infinity", type: "number", origin: "ecma5" }, - { name: "JSON", type: "JSON", origin: "ecma5" }, - { name: "Math", type: "Math", origin: "ecma5" }, - { name: "NaN", type: "number", origin: "ecma5" }, - { name: "Number", type: "fn(value: ?) -> number", origin: "ecma5" }, - { name: "Object", type: "fn()", origin: "ecma5" }, - { name: "RangeError", type: "fn(message: string)", origin: "ecma5" }, - { name: "ReferenceError", type: "fn(message: string)", origin: "ecma5" }, - { name: "RegExp", type: "fn(source: string, flags?: string)", origin: "ecma5" }, - { name: "String", type: "fn(value: ?) -> string", origin: "ecma5" }, - { name: "SyntaxError", type: "fn(message: string)", origin: "ecma5" }, - { name: "TypeError", type: "fn(message: string)", origin: "ecma5" }, - { name: "URIError", type: "fn(message: string)", origin: "ecma5" } - ] -}); - -// Signal and Signal Handler Completions -testCompletion("Window {\n\tsignal clicked(int mouseX, int mouseY)\n\t|\n}", { - start: { line: 2, ch: 1 }, - end: { line: 2, ch: 1 }, - isProperty: false, - isObjectKey: false, - completions: [ - { name: "onClicked", type: "Signal Handler", origin: "main.qml" } - ] -}); - -testCompletion("Window {\n\tsignal clicked(int mouseX, int mouseY)\n\tButton {\n\t\t|\n\t}\n}", { - start: { line: 3, ch: 2 }, - end: { line: 3, ch: 2 }, - isProperty: false, - isObjectKey: false, - completions: [] -}); - -testCompletion("Window {\n\tsignal clicked(int mouseX, int mouseY)\n\ts: |\n}", { - start: { line: 2, ch: 4 }, - end: { line: 2, ch: 4 }, - isProperty: false, - isObjectKey: false, - completions: [ - { name: "clicked", type: "fn(mouseX: number, mouseY: number)", origin: "main.qml" }, - { name: "onClicked", type: "Signal Handler", origin: "main.qml" } - ] -}, function (server) { server.jsDefs = []; }); - -testCompletion("Window {\n\tsignal error(string msg, boolean flag)\n\ts: |\n}", { - start: { line: 2, ch: 4 }, - end: { line: 2, ch: 4 }, - isProperty: false, - isObjectKey: false, - completions: [ - { name: "error", type: "fn(msg: string, flag: bool)", origin: "main.qml" }, - { name: "onError", type: "Signal Handler", origin: "main.qml" } - ] -}, function (server) { server.jsDefs = []; }); - -testCompletion("Window {\n\tid: wind\n\tsignal error(string msg, boolean flag)\n\ts: wind.|\n}", { - start: { line: 3, ch: 9 }, - end: { line: 3, ch: 9 }, - isProperty: true, - isObjectKey: false, - completions: [ - { name: "error", type: "fn(msg: string, flag: bool)", origin: "main.qml" }, - { name: "onError", type: "Signal Handler", origin: "main.qml" } - ] -}, function (server) { server.jsDefs = []; }); - -testCompletion("Window {\n\tsignal error(string msg, boolean flag)\n\tonError: |\n}", { - start: { line: 2, ch: 10 }, - end: { line: 2, ch: 10 }, - isProperty: false, - isObjectKey: false, - completions: [ - { name: "error", type: "fn(msg: string, flag: bool)", origin: "main.qml" }, - { name: "flag", type: "bool", origin: "main.qml" }, - { name: "msg", type: "string", origin: "main.qml" }, - { name: "onError", type: "Signal Handler", origin: "main.qml" } - ] -}, function (server) { server.jsDefs = []; }); - -testCompletion("Window {\n\tsignal error(string msg, boolean flag)\n\tonError: {\n\t\t|\n\t}\n}", { - start: { line: 3, ch: 2 }, - end: { line: 3, ch: 2 }, - isProperty: false, - isObjectKey: false, - completions: [ - { name: "error", type: "fn(msg: string, flag: bool)", origin: "main.qml" }, - { name: "flag", type: "bool", origin: "main.qml" }, - { name: "msg", type: "string", origin: "main.qml" }, - { name: "onError", type: "Signal Handler", origin: "main.qml" } - ] -}, function (server) { server.jsDefs = []; }); - -testCompletion("Window {\n\tproperty int msg\n\tsignal error(string msg, boolean flag)\n\tonError: {\n\t\t|\n\t}\n}", { - start: { line: 4, ch: 2 }, - end: { line: 4, ch: 2 }, - isProperty: false, - isObjectKey: false, - completions: [ - { name: "error", type: "fn(msg: string, flag: bool)", origin: "main.qml" }, - { name: "flag", type: "bool", origin: "main.qml" }, - { name: "msg", type: "string", origin: "main.qml" }, - { name: "onError", type: "Signal Handler", origin: "main.qml" } - ] -}, function (server) { server.jsDefs = []; }); - -// Function Declarations -testCompletion("Window {\n\tfunction test() {}\n\t|\n}", { - start: { line: 2, ch: 1 }, - end: { line: 2, ch: 1 }, - isProperty: false, - isObjectKey: false, - completions: [] -}); - -testCompletion("Window {\n\tfunction test(a, b, c) {\n\t\t|\n\t}\n}", { - start: { line: 2, ch: 2 }, - end: { line: 2, ch: 2 }, - isProperty: false, - isObjectKey: false, - completions: [ - { name: "a", type: "?", origin: "main.qml" }, - { name: "b", type: "?", origin: "main.qml" }, - { name: "c", type: "?", origin: "main.qml" }, - { name: "test", type: "fn(a: ?, b: ?, c: ?)", origin: "main.qml" } - ] -}, function (server) { server.jsDefs = []; }); - -testCompletion("Window {\n\tfunction test(a) {\n\t\ta = 3\n\t\t|\n\t}\n}", { - start: { line: 3, ch: 2 }, - end: { line: 3, ch: 2 }, - isProperty: false, - isObjectKey: false, - completions: [ - { name: "a", type: "number", origin: "main.qml" }, - { name: "test", type: "fn(a: number)", origin: "main.qml" } - ] -}, function (server) { server.jsDefs = []; }); - -testCompletion('Window {\n\tfunction test(a) {\n\t\ttest("something")\n\t\t|\n\t}\n}', { - start: { line: 3, ch: 2 }, - end: { line: 3, ch: 2 }, - isProperty: false, - isObjectKey: false, - completions: [ - { name: "a", type: "string", origin: "main.qml" }, - { name: "test", type: "fn(a: string)", origin: "main.qml" } - ] -}, function (server) { server.jsDefs = []; }); - -testCompletion('Window {\n\tfunction test(a) {\n\t\t|\n\t\treturn 7\n\t}\n}', { - start: { line: 2, ch: 2 }, - end: { line: 2, ch: 2 }, - isProperty: false, - isObjectKey: false, - completions: [ - { name: "a", type: "?", origin: "main.qml" }, - { name: "test", type: "fn(a: ?) -> number", origin: "main.qml" } - ] -}, function (server) { server.jsDefs = []; }); - -// TODO: Uncomment once this is fixed. The find defs version of this test does find the right definition -// so it seems the problem is related to Tern and not the QML plugin. -//testCompletion('Window {\n\tproperty int a\n\tfunction test(a) {\n\t\t|\n\t}\n}', { -// start: { line: 3, ch: 2 }, -// end: { line: 3, ch: 2 }, -// isProperty: false, -// isObjectKey: false, -// completions: [ -// { name: "a", type: "?", origin: "main.qml" }, -// { name: "test", type: "fn()", origin: "main.qml" } -// ] -//}, function (server) { server.jsDefs = []; }); - +/******************************************************************************* + * Copyright (c) 2015 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 + *******************************************************************************/ +"use strict"; + +var driver = require("./driver.js"); +var test = driver.test; +var testCompletion = driver.testCompletion; +var assertCompletion = driver.assertCompletion; +var groupStart = driver.groupStart; +var groupEnd = driver.groupEnd; + +var group = exports.group = "Code Completion"; +groupStart(group); + +// Local Directory Completions +testCompletion('My|', { + start: { line: 0, ch: 0 }, + end: { line: 0, ch: 2 }, + isProperty: false, + isObjectKey: false, + completions: [{ name: "MyObject", type: "MyObject", origin: "MyObject.qml" }] +}, function (server) { + server.addFile("MyObject.qml", "Button {}"); +}); + +testCompletion('import "./subdir/"\nSameDirTest {\n\t|\n}', { + start: { line: 2, ch: 1 }, + end: { line: 2, ch: 1 }, + isProperty: false, + isObjectKey: false, + completions: [ + { name: "obj", type: "?", origin: "subdir/Button.qml" }, + { name: "Button", type: "Button", origin: "subdir/Button.qml" }, + { name: "SameDirTest", type: "SameDirTest", origin: "subdir/SameDirTest.qml" } + ] +}, function (server) { + server.addFile("subdir/SameDirTest.qml", "Button {}"); + server.addFile("subdir/Button.qml", "QtObject {property var obj}"); +}); + +testCompletion('MyObject {\n\t|\n}', { + start: { line: 1, ch: 1 }, + end: { line: 1, ch: 1 }, + isProperty: false, + isObjectKey: false, + completions: [ + { name: "width", type: "number", origin: "MyObject.qml" }, + { name: "MyObject", type: "MyObject", origin: "MyObject.qml" } + ] +}, function (server) { + server.addFile("MyObject.qml", "Button {\n\tproperty int width\n}"); +}); + +testCompletion('MyObject {\n\tid: obj\n\ts: obj.|\n}', { + start: { line: 2, ch: 8 }, + end: { line: 2, ch: 8 }, + isProperty: true, + isObjectKey: false, + completions: [{ name: "width", type: "number", origin: "MyObject.qml" }] +}, function (server) { + server.addFile("MyObject.qml", "Button {\n\tproperty int width\n}"); +}); + +testCompletion('Button {\n\t|\n}', { + start: { line: 1, ch: 1 }, + end: { line: 1, ch: 1 }, + isProperty: false, + isObjectKey: false, + completions: [ + { name: "onClicked", type: "Signal Handler", origin: "Button.qml" }, + { name: "Button", type: "Button", origin: "Button.qml" } + ] +}, function (server) { + server.addFile("Button.qml", "QtObject {\n\signal clicked(int mouseX, int mouseY)\n}"); +}); + +testCompletion('CButton {\n\t|\n}', { + start: { line: 1, ch: 1 }, + end: { line: 1, ch: 1 }, + isProperty: false, + isObjectKey: false, + completions: [ + { name: "height", type: "number", origin: "Button.qml" }, + { name: "numClicks", type: "number", origin: "CButton.qml" }, + { name: "text", type: "string", origin: "Button.qml" }, + { name: "width", type: "number", origin: "Button.qml" }, + { name: "Button", type: "Button", origin: "Button.qml" }, + { name: "CButton", type: "CButton", origin: "CButton.qml" } + ] +}, function (server) { + server.addFile("CButton.qml", "Button {\n\tproperty int numClicks\n}"); + server.addFile("Button.qml", "QtObject {\n\tproperty string text\n\tproperty int width\n\tproperty int height\n}"); +}); + +testCompletion('CButton {\n\tid:btn\n\ts: btn.|\n}', { + start: { line: 2, ch: 8 }, + end: { line: 2, ch: 8 }, + isProperty: true, + isObjectKey: false, + completions: [ + { name: "height", type: "number", origin: "Button.qml" }, + { name: "numClicks", type: "number", origin: "CButton.qml" }, + { name: "text", type: "string", origin: "Button.qml" }, + { name: "width", type: "number", origin: "Button.qml" } + ] +}, function (server) { + server.addFile("CButton.qml", "Button {\n\tproperty int numClicks\n}"); + server.addFile("Button.qml", "QtObject {\n\tproperty string text\n\tproperty int width\n\tproperty int height\n}"); +}); + +// Directory Import Completions +testCompletion('NotVisible {\n\t|\n}', { + start: { line: 1, ch: 1 }, + end: { line: 1, ch: 1 }, + isProperty: false, + isObjectKey: false, + completions: [] +}, function (server) { + server.addFile("subdir/NotVisible.qml", "QtObject {\n\signal clicked(int mouseX, int mouseY)\n}"); +}); + +testCompletion('import "./subdir/"\nButton {\n\t|\n}', { + start: { line: 2, ch: 1 }, + end: { line: 2, ch: 1 }, + isProperty: false, + isObjectKey: false, + completions: [ + { name: "onClicked", type: "Signal Handler", origin: "subdir/Button.qml" }, + { name: "Button", type: "Button", origin: "subdir/Button.qml" } + ] +}, function (server) { + server.addFile("subdir/Button.qml", "QtObject {\n\signal clicked(int mouseX, int mouseY)\n}"); +}); + +testCompletion('import "./subdir/" as Controls\nControls.Button {\n\t|\n}', { + start: { line: 2, ch: 1 }, + end: { line: 2, ch: 1 }, + isProperty: false, + isObjectKey: false, + completions: [ + { name: "onClicked", type: "Signal Handler", origin: "subdir/Button.qml" }, + { name: "Controls", type: "Controls", origin: "main.qml" } + ] +}, function (server) { + server.addFile("subdir/Button.qml", "QtObject {\n\signal clicked(int mouseX, int mouseY)\n}"); +}); + +testCompletion('import "./subdir/" as Controls\nControls.|', { + start: { line: 1, ch: 9 }, + end: { line: 1, ch: 9 }, + isProperty: false, + isObjectKey: false, + completions: [ + { name: "Button", type: "Button", origin: "subdir/Button.qml" } + ] +}, function (server) { + server.addFile("subdir/Button.qml", "QtObject {\n\signal clicked(int mouseX, int mouseY)\n}"); +}); + +testCompletion('import "./subdir/" as Controls\nControls.|.', { + start: { line: 1, ch: 9 }, + end: { line: 1, ch: 9 }, + isProperty: false, + isObjectKey: false, + completions: [ + { name: "Button", type: "Button", origin: "subdir/Button.qml" } + ] +}, function (server) { + server.addFile("subdir/Button.qml", "QtObject {\n\signal clicked(int mouseX, int mouseY)\n}"); +}); + +testCompletion('import "./subdir/" as Controls\nControls..|', { + start: { line: 1, ch: 10 }, + end: { line: 1, ch: 10 }, + isProperty: false, + isObjectKey: false, + completions: [] +}, function (server) { + server.addFile("subdir/Button.qml", "QtObject {\n\signal clicked(int mouseX, int mouseY)\n}"); +}); + +test("{Add File After Import}", function (server, callback, name) { + var failed; + assertCompletion(server, "", { + start: { line: 0, ch: 0 }, + end: { line: 0, ch: 0 }, + isProperty: false, + isObjectKey: false, + completions: [] + }, 0, function (mis) { + failed = mis; + }); + if (failed) { + return callback("fail", name, "- failed on initial file " + failed); + } + server.addFile("MyObject.qml", "QtObject {\n\tproperty var test\n}"); + assertCompletion(server, "", { + start: { line: 0, ch: 0 }, + end: { line: 0, ch: 0 }, + isProperty: false, + isObjectKey: false, + completions: [{ name: "MyObject", type: "MyObject", origin: "MyObject.qml" }] + }, 0, function (mis) { + failed = mis; + }); + if (failed) { + return callback("fail", name, "- failed after adding file " + failed); + } + return callback("ok", name); +}); + +// Cyclic Dependency Completions +testCompletion('Cyclic {\n\t|\n}', { + start: { line: 1, ch: 1 }, + end: { line: 1, ch: 1 }, + isProperty: false, + isObjectKey: false, + completions: [ + { name: "test", type: "?", origin: "Cyclic.qml" }, + { name: "Cyclic", type: "Cyclic", origin: "Cyclic.qml" } + ] +}, function (server) { + server.addFile("Cyclic.qml", "Cyclic {\n\property var test\n}"); +}); + +testCompletion('Cyclic2 {\n\t|\n}', { + start: { line: 1, ch: 1 }, + end: { line: 1, ch: 1 }, + isProperty: false, + isObjectKey: false, + completions: [ + { name: "test1", type: "?", origin: "Cyclic2.qml" }, + { name: "test2", type: "?", origin: "OtherCyclic.qml" }, + { name: "Cyclic2", type: "Cyclic2", origin: "Cyclic2.qml" }, + { name: "OtherCyclic", type: "OtherCyclic", origin: "OtherCyclic.qml" } + ] +}, function (server) { + server.addFile("Cyclic2.qml", "OtherCyclic {\n\property var test1\n}"); + server.addFile("OtherCyclic.qml", "Cyclic2 {\n\property var test2\n}"); +}); + +testCompletion('OtherCyclic {\n\t|\n}', { + start: { line: 1, ch: 1 }, + end: { line: 1, ch: 1 }, + isProperty: false, + isObjectKey: false, + completions: [ + { name: "test2", type: "?", origin: "OtherCyclic.qml" }, + { name: "Cyclic", type: "Cyclic", origin: "Cyclic.qml" }, + { name: "OtherCyclic", type: "OtherCyclic", origin: "OtherCyclic.qml" } + ] +}, function (server) { + server.addFile("Cyclic.qml", "OtherCyclic {\n\property var test1\n}"); + server.addFile("OtherCyclic.qml", "Cyclic {\n\property var test2\n}"); +}); + +// QML Object Property Completions +testCompletion("Window {\n\tproperty int height\n\the|\n}", { + start: { line: 2, ch: 1 }, + end: { line: 2, ch: 3 }, + isProperty: false, + isObjectKey: false, + completions: [{ name: "height", type: "number", origin: "main.qml" }] +}); + +testCompletion("Window {\n\tproperty int height\n\tproperty int width\n\tproperty string text\n\t|\n}", { + start: { line: 4, ch: 1 }, + end: { line: 4, ch: 1 }, + isProperty: false, + isObjectKey: false, + completions: [ + { name: "height", type: "number", origin: "main.qml" }, + { name: "text", type: "string", origin: "main.qml" }, + { name: "width", type: "number", origin: "main.qml" } + ] +}); + +testCompletion("Window {\n\tproperty int height\n\tObject {\n\t\t|\n\t}\n}", { + start: { line: 3, ch: 2 }, + end: { line: 3, ch: 2 }, + isProperty: false, + isObjectKey: false, + completions: [] +}); + +testCompletion("Window {\n\tproperty var prop\n\tfunction test() {\n\t\t|\n\t}\n}", { + start: { line: 3, ch: 2 }, + end: { line: 3, ch: 2 }, + isProperty: false, + isObjectKey: false, + completions: [ + { name: "prop", type: "?", origin: "main.qml" }, + { name: "test", type: "fn()", origin: "main.qml" } + ] +}, function (server) { server.jsDefs = []; }); + +// QML ID Property Completions +testCompletion("Window {\n\tid: btn\n\t|\n}", { + start: { line: 2, ch: 1 }, + end: { line: 2, ch: 1 }, + isProperty: false, + isObjectKey: false, + completions: [] +}); + +testCompletion("Window {\n\tButton {\n\t\tid: btn\n\t\tproperty int height\n\t}\n\ttest: btn.|\n}", { + start: { line: 5, ch: 11 }, + end: { line: 5, ch: 11 }, + isProperty: true, + isObjectKey: false, + completions: [{ name: "height", type: "number", origin: "main.qml" }] +}, function (server) { server.jsDefs = []; }); + +testCompletion("Window {\n\tproperty var btn\n\tButton {\n\t\tid: btn\n\t\tproperty int height\n\t}\n\ttest: btn.|\n}", { + start: { line: 6, ch: 11 }, + end: { line: 6, ch: 11 }, + isProperty: true, + isObjectKey: false, + completions: [{ name: "height", type: "number", origin: "main.qml" }] +}, function (server) { server.jsDefs = []; }); + +testCompletion("Window {\n\tButton {\n\t\tproperty var id\n\t\tid: btn\n\t}\n\ts: bt|\n}", { + start: { line: 5, ch: 4 }, + end: { line: 5, ch: 6 }, + isProperty: false, + isObjectKey: false, + completions: [{ name: "btn", type: "Button", origin: "main.qml" }] +}, function (server) { server.jsDefs = []; }); + +testCompletion("Window {\n\tButton {\n\t\tproperty var id\n\t\tid: btn\n\t\ts: i|\n\t}\n}", { + start: { line: 4, ch: 5 }, + end: { line: 4, ch: 6 }, + isProperty: false, + isObjectKey: false, + completions: [{ name: "id", type: "?", origin: "main.qml" }] +}, function (server) { server.jsDefs = []; }); + +testCompletion("Window {\n\tButton {\n\t\tproperty var id: 34\n\t\tid: btn\n\t\ts: i|\n\t}\n}", { + start: { line: 4, ch: 5 }, + end: { line: 4, ch: 6 }, + isProperty: false, + isObjectKey: false, + completions: [{ name: "id", type: "number", origin: "main.qml" }] +}, function (server) { server.jsDefs = []; }); + +testCompletion("Window {\n\tButton {\n\t\tproperty string id\n\t\tid: btn\n\t\ts: i|\n\t}\n}", { + start: { line: 4, ch: 5 }, + end: { line: 4, ch: 6 }, + isProperty: false, + isObjectKey: false, + completions: [{ name: "id", type: "string", origin: "main.qml" }] +}, function (server) { server.jsDefs = []; }); + +testCompletion("Window {\n\tButton {\n\t\tproperty var id\n\t\ts: i|\n\t}\n}", { + start: { line: 3, ch: 5 }, + end: { line: 3, ch: 6 }, + isProperty: false, + isObjectKey: false, + completions: [{ name: "id", type: "?", origin: "main.qml" }] +}, function (server) { server.jsDefs = []; }); + +testCompletion("Window {\n\tButton {\n\t\tproperty var id: 34\n\t\ts: i|\n\t}\n}", { + start: { line: 3, ch: 5 }, + end: { line: 3, ch: 6 }, + isProperty: false, + isObjectKey: false, + completions: [{ name: "id", type: "number", origin: "main.qml" }] +}, function (server) { server.jsDefs = []; }); + +testCompletion("Window {\n\tButton {\n\t\tproperty string id\n\t\ts: i|\n\t}\n}", { + start: { line: 3, ch: 5 }, + end: { line: 3, ch: 6 }, + isProperty: false, + isObjectKey: false, + completions: [{ name: "id", type: "string", origin: "main.qml" }] +}, function (server) { server.jsDefs = []; }); + +testCompletion("Window {\n\tid: wind\n\tfunction test() {\n\t\t|\n\t}\n}", { + start: { line: 3, ch: 2 }, + end: { line: 3, ch: 2 }, + isProperty: false, + isObjectKey: false, + completions: [ + { name: "test", type: "fn()", origin: "main.qml" }, + { name: "wind", type: "Window", origin: "main.qml" } + ] +}, function (server) { server.jsDefs = []; }); + +// JavaScript Completions +testCompletion("Window {\n\tproperty var test: |\n}", { + start: { line: 1, ch: 20 }, + end: { line: 1, ch: 20 }, + isProperty: false, + isObjectKey: false, + completions: [ + { name: "decodeURI", type: "fn(uri: string) -> string", origin: "ecma5" }, + { name: "decodeURIComponent", type: "fn(uri: string) -> string", origin: "ecma5" }, + { name: "encodeURI", type: "fn(uri: string) -> string", origin: "ecma5" }, + { name: "encodeURIComponent", type: "fn(uri: string) -> string", origin: "ecma5" }, + { name: "eval", type: "fn(code: string)", origin: "ecma5" }, + { name: "isFinite", type: "fn(value: number) -> bool", origin: "ecma5" }, + { name: "isNaN", type: "fn(value: number) -> bool", origin: "ecma5" }, + { name: "parseFloat", type: "fn(string: string) -> number", origin: "ecma5" }, + { name: "parseInt", type: "fn(string: string, radix?: number) -> number", origin: "ecma5" }, + { name: "test", type: "?", origin: "main.qml" }, + { name: "undefined", type: "?", origin: "ecma5" }, + { name: "Array", type: "fn(size: number)", origin: "ecma5" }, + { name: "Boolean", type: "fn(value: ?) -> bool", origin: "ecma5" }, + { name: "Date", type: "fn(ms: number)", origin: "ecma5" }, + { name: "Error", type: "fn(message: string)", origin: "ecma5" }, + { name: "EvalError", type: "fn(message: string)", origin: "ecma5" }, + { name: "Function", type: "fn(body: string) -> fn()", origin: "ecma5" }, + { name: "Infinity", type: "number", origin: "ecma5" }, + { name: "JSON", type: "JSON", origin: "ecma5" }, + { name: "Math", type: "Math", origin: "ecma5" }, + { name: "NaN", type: "number", origin: "ecma5" }, + { name: "Number", type: "fn(value: ?) -> number", origin: "ecma5" }, + { name: "Object", type: "fn()", origin: "ecma5" }, + { name: "RangeError", type: "fn(message: string)", origin: "ecma5" }, + { name: "ReferenceError", type: "fn(message: string)", origin: "ecma5" }, + { name: "RegExp", type: "fn(source: string, flags?: string)", origin: "ecma5" }, + { name: "String", type: "fn(value: ?) -> string", origin: "ecma5" }, + { name: "SyntaxError", type: "fn(message: string)", origin: "ecma5" }, + { name: "TypeError", type: "fn(message: string)", origin: "ecma5" }, + { name: "URIError", type: "fn(message: string)", origin: "ecma5" } + ] +}); + +testCompletion("Window {\n\ttest: |\n}", { + start: { line: 1, ch: 7 }, + end: { line: 1, ch: 7 }, + isProperty: false, + isObjectKey: false, + completions: [ + { name: "decodeURI", type: "fn(uri: string) -> string", origin: "ecma5" }, + { name: "decodeURIComponent", type: "fn(uri: string) -> string", origin: "ecma5" }, + { name: "encodeURI", type: "fn(uri: string) -> string", origin: "ecma5" }, + { name: "encodeURIComponent", type: "fn(uri: string) -> string", origin: "ecma5" }, + { name: "eval", type: "fn(code: string)", origin: "ecma5" }, + { name: "isFinite", type: "fn(value: number) -> bool", origin: "ecma5" }, + { name: "isNaN", type: "fn(value: number) -> bool", origin: "ecma5" }, + { name: "parseFloat", type: "fn(string: string) -> number", origin: "ecma5" }, + { name: "parseInt", type: "fn(string: string, radix?: number) -> number", origin: "ecma5" }, + { name: "undefined", type: "?", origin: "ecma5" }, + { name: "Array", type: "fn(size: number)", origin: "ecma5" }, + { name: "Boolean", type: "fn(value: ?) -> bool", origin: "ecma5" }, + { name: "Date", type: "fn(ms: number)", origin: "ecma5" }, + { name: "Error", type: "fn(message: string)", origin: "ecma5" }, + { name: "EvalError", type: "fn(message: string)", origin: "ecma5" }, + { name: "Function", type: "fn(body: string) -> fn()", origin: "ecma5" }, + { name: "Infinity", type: "number", origin: "ecma5" }, + { name: "JSON", type: "JSON", origin: "ecma5" }, + { name: "Math", type: "Math", origin: "ecma5" }, + { name: "NaN", type: "number", origin: "ecma5" }, + { name: "Number", type: "fn(value: ?) -> number", origin: "ecma5" }, + { name: "Object", type: "fn()", origin: "ecma5" }, + { name: "RangeError", type: "fn(message: string)", origin: "ecma5" }, + { name: "ReferenceError", type: "fn(message: string)", origin: "ecma5" }, + { name: "RegExp", type: "fn(source: string, flags?: string)", origin: "ecma5" }, + { name: "String", type: "fn(value: ?) -> string", origin: "ecma5" }, + { name: "SyntaxError", type: "fn(message: string)", origin: "ecma5" }, + { name: "TypeError", type: "fn(message: string)", origin: "ecma5" }, + { name: "URIError", type: "fn(message: string)", origin: "ecma5" } + ] +}); + +testCompletion("Window {\n\ttest: {\n\t\t|\n\t}\n}", { + start: { line: 2, ch: 2 }, + end: { line: 2, ch: 2 }, + isProperty: false, + isObjectKey: false, + completions: [ + { name: "decodeURI", type: "fn(uri: string) -> string", origin: "ecma5" }, + { name: "decodeURIComponent", type: "fn(uri: string) -> string", origin: "ecma5" }, + { name: "encodeURI", type: "fn(uri: string) -> string", origin: "ecma5" }, + { name: "encodeURIComponent", type: "fn(uri: string) -> string", origin: "ecma5" }, + { name: "eval", type: "fn(code: string)", origin: "ecma5" }, + { name: "isFinite", type: "fn(value: number) -> bool", origin: "ecma5" }, + { name: "isNaN", type: "fn(value: number) -> bool", origin: "ecma5" }, + { name: "parseFloat", type: "fn(string: string) -> number", origin: "ecma5" }, + { name: "parseInt", type: "fn(string: string, radix?: number) -> number", origin: "ecma5" }, + { name: "undefined", type: "?", origin: "ecma5" }, + { name: "Array", type: "fn(size: number)", origin: "ecma5" }, + { name: "Boolean", type: "fn(value: ?) -> bool", origin: "ecma5" }, + { name: "Date", type: "fn(ms: number)", origin: "ecma5" }, + { name: "Error", type: "fn(message: string)", origin: "ecma5" }, + { name: "EvalError", type: "fn(message: string)", origin: "ecma5" }, + { name: "Function", type: "fn(body: string) -> fn()", origin: "ecma5" }, + { name: "Infinity", type: "number", origin: "ecma5" }, + { name: "JSON", type: "JSON", origin: "ecma5" }, + { name: "Math", type: "Math", origin: "ecma5" }, + { name: "NaN", type: "number", origin: "ecma5" }, + { name: "Number", type: "fn(value: ?) -> number", origin: "ecma5" }, + { name: "Object", type: "fn()", origin: "ecma5" }, + { name: "RangeError", type: "fn(message: string)", origin: "ecma5" }, + { name: "ReferenceError", type: "fn(message: string)", origin: "ecma5" }, + { name: "RegExp", type: "fn(source: string, flags?: string)", origin: "ecma5" }, + { name: "String", type: "fn(value: ?) -> string", origin: "ecma5" }, + { name: "SyntaxError", type: "fn(message: string)", origin: "ecma5" }, + { name: "TypeError", type: "fn(message: string)", origin: "ecma5" }, + { name: "URIError", type: "fn(message: string)", origin: "ecma5" } + ] +}); + +testCompletion("Window {\n\tfunction test() {\n\t\t|\n\t}\n}", { + start: { line: 2, ch: 2 }, + end: { line: 2, ch: 2 }, + isProperty: false, + isObjectKey: false, + completions: [ + { name: "decodeURI", type: "fn(uri: string) -> string", origin: "ecma5" }, + { name: "decodeURIComponent", type: "fn(uri: string) -> string", origin: "ecma5" }, + { name: "encodeURI", type: "fn(uri: string) -> string", origin: "ecma5" }, + { name: "encodeURIComponent", type: "fn(uri: string) -> string", origin: "ecma5" }, + { name: "eval", type: "fn(code: string)", origin: "ecma5" }, + { name: "isFinite", type: "fn(value: number) -> bool", origin: "ecma5" }, + { name: "isNaN", type: "fn(value: number) -> bool", origin: "ecma5" }, + { name: "parseFloat", type: "fn(string: string) -> number", origin: "ecma5" }, + { name: "parseInt", type: "fn(string: string, radix?: number) -> number", origin: "ecma5" }, + { name: "test", type: "fn()", origin: "main.qml" }, + { name: "undefined", type: "?", origin: "ecma5" }, + { name: "Array", type: "fn(size: number)", origin: "ecma5" }, + { name: "Boolean", type: "fn(value: ?) -> bool", origin: "ecma5" }, + { name: "Date", type: "fn(ms: number)", origin: "ecma5" }, + { name: "Error", type: "fn(message: string)", origin: "ecma5" }, + { name: "EvalError", type: "fn(message: string)", origin: "ecma5" }, + { name: "Function", type: "fn(body: string) -> fn()", origin: "ecma5" }, + { name: "Infinity", type: "number", origin: "ecma5" }, + { name: "JSON", type: "JSON", origin: "ecma5" }, + { name: "Math", type: "Math", origin: "ecma5" }, + { name: "NaN", type: "number", origin: "ecma5" }, + { name: "Number", type: "fn(value: ?) -> number", origin: "ecma5" }, + { name: "Object", type: "fn()", origin: "ecma5" }, + { name: "RangeError", type: "fn(message: string)", origin: "ecma5" }, + { name: "ReferenceError", type: "fn(message: string)", origin: "ecma5" }, + { name: "RegExp", type: "fn(source: string, flags?: string)", origin: "ecma5" }, + { name: "String", type: "fn(value: ?) -> string", origin: "ecma5" }, + { name: "SyntaxError", type: "fn(message: string)", origin: "ecma5" }, + { name: "TypeError", type: "fn(message: string)", origin: "ecma5" }, + { name: "URIError", type: "fn(message: string)", origin: "ecma5" } + ] +}); + +// Signal and Signal Handler Completions +testCompletion("Window {\n\tsignal clicked(int mouseX, int mouseY)\n\t|\n}", { + start: { line: 2, ch: 1 }, + end: { line: 2, ch: 1 }, + isProperty: false, + isObjectKey: false, + completions: [ + { name: "onClicked", type: "Signal Handler", origin: "main.qml" } + ] +}); + +testCompletion("Window {\n\tsignal clicked(int mouseX, int mouseY)\n\tButton {\n\t\t|\n\t}\n}", { + start: { line: 3, ch: 2 }, + end: { line: 3, ch: 2 }, + isProperty: false, + isObjectKey: false, + completions: [] +}); + +testCompletion("Window {\n\tsignal clicked(int mouseX, int mouseY)\n\ts: |\n}", { + start: { line: 2, ch: 4 }, + end: { line: 2, ch: 4 }, + isProperty: false, + isObjectKey: false, + completions: [ + { name: "clicked", type: "fn(mouseX: number, mouseY: number)", origin: "main.qml" }, + { name: "onClicked", type: "Signal Handler", origin: "main.qml" } + ] +}, function (server) { server.jsDefs = []; }); + +testCompletion("Window {\n\tsignal error(string msg, boolean flag)\n\ts: |\n}", { + start: { line: 2, ch: 4 }, + end: { line: 2, ch: 4 }, + isProperty: false, + isObjectKey: false, + completions: [ + { name: "error", type: "fn(msg: string, flag: bool)", origin: "main.qml" }, + { name: "onError", type: "Signal Handler", origin: "main.qml" } + ] +}, function (server) { server.jsDefs = []; }); + +testCompletion("Window {\n\tid: wind\n\tsignal error(string msg, boolean flag)\n\ts: wind.|\n}", { + start: { line: 3, ch: 9 }, + end: { line: 3, ch: 9 }, + isProperty: true, + isObjectKey: false, + completions: [ + { name: "error", type: "fn(msg: string, flag: bool)", origin: "main.qml" }, + { name: "onError", type: "Signal Handler", origin: "main.qml" } + ] +}, function (server) { server.jsDefs = []; }); + +testCompletion("Window {\n\tsignal error(string msg, boolean flag)\n\tonError: |\n}", { + start: { line: 2, ch: 10 }, + end: { line: 2, ch: 10 }, + isProperty: false, + isObjectKey: false, + completions: [ + { name: "error", type: "fn(msg: string, flag: bool)", origin: "main.qml" }, + { name: "flag", type: "bool", origin: "main.qml" }, + { name: "msg", type: "string", origin: "main.qml" }, + { name: "onError", type: "Signal Handler", origin: "main.qml" } + ] +}, function (server) { server.jsDefs = []; }); + +testCompletion("Window {\n\tsignal error(string msg, boolean flag)\n\tonError: {\n\t\t|\n\t}\n}", { + start: { line: 3, ch: 2 }, + end: { line: 3, ch: 2 }, + isProperty: false, + isObjectKey: false, + completions: [ + { name: "error", type: "fn(msg: string, flag: bool)", origin: "main.qml" }, + { name: "flag", type: "bool", origin: "main.qml" }, + { name: "msg", type: "string", origin: "main.qml" }, + { name: "onError", type: "Signal Handler", origin: "main.qml" } + ] +}, function (server) { server.jsDefs = []; }); + +testCompletion("Window {\n\tproperty int msg\n\tsignal error(string msg, boolean flag)\n\tonError: {\n\t\t|\n\t}\n}", { + start: { line: 4, ch: 2 }, + end: { line: 4, ch: 2 }, + isProperty: false, + isObjectKey: false, + completions: [ + { name: "error", type: "fn(msg: string, flag: bool)", origin: "main.qml" }, + { name: "flag", type: "bool", origin: "main.qml" }, + { name: "msg", type: "string", origin: "main.qml" }, + { name: "onError", type: "Signal Handler", origin: "main.qml" } + ] +}, function (server) { server.jsDefs = []; }); + +// Function Declarations +testCompletion("Window {\n\tfunction test() {}\n\t|\n}", { + start: { line: 2, ch: 1 }, + end: { line: 2, ch: 1 }, + isProperty: false, + isObjectKey: false, + completions: [] +}); + +testCompletion("Window {\n\tfunction test(a, b, c) {\n\t\t|\n\t}\n}", { + start: { line: 2, ch: 2 }, + end: { line: 2, ch: 2 }, + isProperty: false, + isObjectKey: false, + completions: [ + { name: "a", type: "?", origin: "main.qml" }, + { name: "b", type: "?", origin: "main.qml" }, + { name: "c", type: "?", origin: "main.qml" }, + { name: "test", type: "fn(a: ?, b: ?, c: ?)", origin: "main.qml" } + ] +}, function (server) { server.jsDefs = []; }); + +testCompletion("Window {\n\tfunction test(a) {\n\t\ta = 3\n\t\t|\n\t}\n}", { + start: { line: 3, ch: 2 }, + end: { line: 3, ch: 2 }, + isProperty: false, + isObjectKey: false, + completions: [ + { name: "a", type: "number", origin: "main.qml" }, + { name: "test", type: "fn(a: number)", origin: "main.qml" } + ] +}, function (server) { server.jsDefs = []; }); + +testCompletion('Window {\n\tfunction test(a) {\n\t\ttest("something")\n\t\t|\n\t}\n}', { + start: { line: 3, ch: 2 }, + end: { line: 3, ch: 2 }, + isProperty: false, + isObjectKey: false, + completions: [ + { name: "a", type: "string", origin: "main.qml" }, + { name: "test", type: "fn(a: string)", origin: "main.qml" } + ] +}, function (server) { server.jsDefs = []; }); + +testCompletion('Window {\n\tfunction test(a) {\n\t\t|\n\t\treturn 7\n\t}\n}', { + start: { line: 2, ch: 2 }, + end: { line: 2, ch: 2 }, + isProperty: false, + isObjectKey: false, + completions: [ + { name: "a", type: "?", origin: "main.qml" }, + { name: "test", type: "fn(a: ?) -> number", origin: "main.qml" } + ] +}, function (server) { server.jsDefs = []; }); + +// TODO: Uncomment once this is fixed. The find defs version of this test does find the right definition +// so it seems the problem is related to Tern and not the QML plugin. +//testCompletion('Window {\n\tproperty int a\n\tfunction test(a) {\n\t\t|\n\t}\n}', { +// start: { line: 3, ch: 2 }, +// end: { line: 3, ch: 2 }, +// isProperty: false, +// isObjectKey: false, +// completions: [ +// { name: "a", type: "?", origin: "main.qml" }, +// { name: "test", type: "fn()", origin: "main.qml" } +// ] +//}, function (server) { server.jsDefs = []; }); + groupEnd(); \ No newline at end of file diff --git a/qt/org.eclipse.cdt.qt.core/tern-qml/test/test-finddef.js b/qt/org.eclipse.cdt.qt.core/tern-qml/test/test-finddef.js index c6090d4f1b4..c5bb1d54275 100644 --- a/qt/org.eclipse.cdt.qt.core/tern-qml/test/test-finddef.js +++ b/qt/org.eclipse.cdt.qt.core/tern-qml/test/test-finddef.js @@ -1,309 +1,309 @@ -/******************************************************************************* - * Copyright (c) 2015 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 - *******************************************************************************/ -"use strict"; - -var driver = require("./driver.js"); -var test = driver.test; -var testDefinition = driver.testDefinition; -var assertDefinition = driver.assertDefintion; -var groupStart = driver.groupStart; -var groupEnd = driver.groupEnd; - -var group = exports.group = "Find Definition"; -groupStart(group); - -// Directory Imports -// TODO: Getting this test to pass breaks some of the type inferencing which is more important -//testDefinition('My|Object {}', { -// origin: "MyObject.qml", -// start: { line: 0, ch: 0 }, -// end: { line: 0, ch: 6 }, -// file: "MyObject.qml", -// contextOffset: 0 -//}, function (server) { -// server.addFile("MyObject.qml", "Button {}"); -//}); - -testDefinition("MyObject {\n\tte|stProp: ident\n}", { - origin: "MyObject.qml", - start: { line: 1, ch: 14 }, - end: { line: 1, ch: 22 }, - file: "MyObject.qml", - contextOffset: 23 -}, function (server) { - server.addFile("MyObject.qml", "Button {\n\tproperty var testProp\n}"); -}); - -testDefinition("MyObject {\n\ts: te|stSig()\n}", { - origin: "MyObject.qml", - start: { line: 1, ch: 8 }, - end: { line: 1, ch: 15 }, - file: "MyObject.qml", - contextOffset: 17 -}, function (server) { - server.addFile("MyObject.qml", "Button {\n\tsignal testSig()\n}"); -}); - -testDefinition("MyObject {\n\tonTe|stSig: ident\n}", { - origin: "MyObject.qml", - start: { line: 1, ch: 8 }, - end: { line: 1, ch: 15 }, - file: "MyObject.qml", - contextOffset: 17 -}, function (server) { - server.addFile("MyObject.qml", "Button {\n\tsignal testSig()\n}"); -}); - -testDefinition("MyObject {\n\tonTestSig: ar|g0\n}", { - origin: "MyObject.qml", - start: { line: 1, ch: 20 }, - end: { line: 1, ch: 24 }, - file: "MyObject.qml", - contextOffset: 29 -}, function (server) { - server.addFile("MyObject.qml", "Button {\n\tsignal testSig(int arg0)\n}"); -}); - -testDefinition("MyObject {\n\ts: te|stFn()\n}", { - origin: "MyObject.qml", - start: { line: 1, ch: 10 }, - end: { line: 1, ch: 16 }, - file: "MyObject.qml", - contextOffset: 19 -}, function (server) { - server.addFile("MyObject.qml", "Button {\n\tfunction testFn() {}\n}"); -}); - -testDefinition("MyObject {\n\ts: btn|Id\n}", { - origin: undefined, - start: undefined, - end: undefined, - file: undefined, - contextOffset: undefined -}, function (server) { - server.addFile("MyObject.qml", "Button {\n\tid: btnId\n}"); -}); - -testDefinition("MyObject {\n\tot|her: ident\n}", { - origin: undefined, - start: undefined, - end: undefined, - file: undefined, - contextOffset: undefined -}, function (server) { - server.addFile("MyObject.qml", "Button {\n\tSecondButton {\n\t\tjproperty var other\n\t}\n}"); -}); - -// ID Property -testDefinition("QtObject {\n\tid: obj\n\tproperty var prop: {\n\t\tob|j\n\t}\n}", { - origin: "main.qml", - start: { line: 1, ch: 5 }, - end: { line: 1, ch: 8 }, - file: "main.qml", - contextOffset: 16 -}); - -testDefinition("Window {\n\tButton {\n\t\tid: btn\n\t\tproperty int height\n\t}\n\ttest: bt|n\n}", { - origin: "main.qml", - start: { line: 2, ch: 6 }, - end: { line: 2, ch: 9 }, - file: "main.qml", - contextOffset: 25 -}); - -testDefinition("Window {\n\tproperty var btn\n\tButton {\n\t\tid: btn\n\t\tproperty int height\n\t}\n\ttest: bt|n\n}", { - origin: "main.qml", - start: { line: 3, ch: 6 }, - end: { line: 3, ch: 9 }, - file: "main.qml", - contextOffset: 43 -}); - -testDefinition("Window {\n\tproperty var btn\n\tButton {\n\t\tid: bt|n\n\t\tproperty int height\n\t}\n}", { - origin: "main.qml", - start: { line: 3, ch: 6 }, - end: { line: 3, ch: 9 }, - file: "main.qml", - contextOffset: 43 -}); - -// Property Declarations -testDefinition("QtObject {\n\tproperty var prop\n\tpr|op: 3\n}", { - origin: "main.qml", - start: { line: 1, ch: 14 }, - end: { line: 1, ch: 18 }, - file: "main.qml", - contextOffset: 25 -}); - -testDefinition("Window {\n\tproperty var btn\n\tButton {\n\t\tprop: b|tn\n\t}\n}", { - origin: "main.qml", - start: { line: 1, ch: 14 }, - end: { line: 1, ch: 17 }, - file: "main.qml", - contextOffset: 23 -}); - -testDefinition("Window {\n\tproperty var btn\n\tButton {\n\t\tButton {\n\t\t\tprop: b|tn\n\t\t}\n\t}\n}", { - origin: "main.qml", - start: { line: 1, ch: 14 }, - end: { line: 1, ch: 17 }, - file: "main.qml", - contextOffset: 23 -}); - -testDefinition("Window {\n\tButton {\n\t\tproperty var btn\n\t\tbt|n: 3\n\t}\n}", { - origin: "main.qml", - start: { line: 2, ch: 15 }, - end: { line: 2, ch: 18 }, - file: "main.qml", - contextOffset: 34 -}); - -testDefinition("Window {\n\tButton {\n\t\tproperty var btn\n\t\tButton {\n\t\t\tprop: b|tn\n\t\t}\n\t}\n}", { - origin: undefined, - start: undefined, - end: undefined, - file: undefined, - contextOffset: undefined -}); - -// Signals and Signal Handlers -testDefinition("Window {\n\tsignal clic|ked(int mouseX, int mouseY)\n}", { - origin: "main.qml", - start: { line: 1, ch: 8 }, - end: { line: 1, ch: 15 }, - file: "main.qml", - contextOffset: 17 -}); - -testDefinition("Window {\n\tsignal clicked(int mouseX, int mouseY)\n\tonCli|cked: 3\n}", { - origin: "main.qml", - start: { line: 1, ch: 8 }, - end: { line: 1, ch: 15 }, - file: "main.qml", - contextOffset: 17 -}); - -testDefinition("Window {\n\tsignal clicked(int mouseX, int mouseY)\n\tonClicked: mou|seX\n}", { - origin: "main.qml", - start: { line: 1, ch: 20 }, - end: { line: 1, ch: 26 }, - file: "main.qml", - contextOffset: 29 -}); - -testDefinition("Window {\n\tsignal clicked(int mouseX, int mouseY)\n\tonClicked: cli|cked(3,4)\n}", { - origin: "main.qml", - start: { line: 1, ch: 8 }, - end: { line: 1, ch: 15 }, - file: "main.qml", - contextOffset: 17 -}); - -testDefinition("Window {\n\tsignal clicked(int mouseX, int mouseY)\n\tonClicked: onCli|cked\n}", { - origin: "main.qml", - start: { line: 1, ch: 8 }, - end: { line: 1, ch: 15 }, - file: "main.qml", - contextOffset: 17 -}); - -testDefinition("Window {\n\tsignal clicked(int mouseX, int mouseY)\n\tid: wind\n\tonClicked: wind.onCli|cked\n}", { - origin: "main.qml", - start: { line: 1, ch: 8 }, - end: { line: 1, ch: 15 }, - file: "main.qml", - contextOffset: 17 -}); - -testDefinition("Window {\n\tsignal clicked(int mouseX, int mouseY)\n\tid: wind\n\tonClicked: wind.cli|cked(3,4)\n}", { - origin: "main.qml", - start: { line: 1, ch: 8 }, - end: { line: 1, ch: 15 }, - file: "main.qml", - contextOffset: 17 -}); - -testDefinition("Window {\n\tproperty int msg\n\tsignal error(string msg, boolean flag)\n\tonError: {\n\t\tms|g\n\t}\n}", { - origin: "main.qml", - start: { line: 2, ch: 21 }, - end: { line: 2, ch: 24 }, - file: "main.qml", - contextOffset: 48 -}, function (server) { server.jsDefs = []; }); - -// Function Declarations -testDefinition("Window {\n\tfunction te|st(a) {}\n}", { - origin: "main.qml", - start: { line: 1, ch: 10 }, - end: { line: 1, ch: 14 }, - file: "main.qml", - contextOffset: 19 -}); - -testDefinition("Window {\n\tfunction test(a) {\n\t\ta|\n\t}\n}", { - origin: "main.qml", - start: { line: 1, ch: 15 }, - end: { line: 1, ch: 16 }, - file: "main.qml", - contextOffset: 24 -}); - -testDefinition("Window {\n\tfunction test(a) {\n\t\tte|st(3)\n\t}\n}", { - origin: "main.qml", - start: { line: 1, ch: 10 }, - end: { line: 1, ch: 14 }, - file: "main.qml", - contextOffset: 19 -}); - -testDefinition("Window {\n\tfunction test(a) {}\n\ts: te|st(3)\n}", { - origin: "main.qml", - start: { line: 1, ch: 10 }, - end: { line: 1, ch: 14 }, - file: "main.qml", - contextOffset: 19 -}); - -testDefinition("Window {\n\tfunction test(a) {}\n\ts: {\n\t\tte|st(3)\n\t}\n}", { - origin: "main.qml", - start: { line: 1, ch: 10 }, - end: { line: 1, ch: 14 }, - file: "main.qml", - contextOffset: 19 -}); - -testDefinition("Window {\n\tfunction test(a) {}\n\tid: wind\n\ts: {\n\t\twind.te|st(3)\n\t}\n}", { - origin: "main.qml", - start: { line: 1, ch: 10 }, - end: { line: 1, ch: 14 }, - file: "main.qml", - contextOffset: 19 -}); - -testDefinition("Window {\n\tfunction test(a) {}\n\tte|st: 3;\n}", { - origin: undefined, - start: undefined, - end: undefined, - file: undefined, - contextOffset: undefined -}); - -testDefinition('Window {\n\tfunction test(a) {\n\t\ta|\n\t}\n}\n\tproperty int a', { - origin: "main.qml", - start: { line: 1, ch: 15 }, - end: { line: 1, ch: 16 }, - file: "main.qml", - contextOffset: 24 -}); - +/******************************************************************************* + * Copyright (c) 2015 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 + *******************************************************************************/ +"use strict"; + +var driver = require("./driver.js"); +var test = driver.test; +var testDefinition = driver.testDefinition; +var assertDefinition = driver.assertDefintion; +var groupStart = driver.groupStart; +var groupEnd = driver.groupEnd; + +var group = exports.group = "Find Definition"; +groupStart(group); + +// Directory Imports +// TODO: Getting this test to pass breaks some of the type inferencing which is more important +//testDefinition('My|Object {}', { +// origin: "MyObject.qml", +// start: { line: 0, ch: 0 }, +// end: { line: 0, ch: 6 }, +// file: "MyObject.qml", +// contextOffset: 0 +//}, function (server) { +// server.addFile("MyObject.qml", "Button {}"); +//}); + +testDefinition("MyObject {\n\tte|stProp: ident\n}", { + origin: "MyObject.qml", + start: { line: 1, ch: 14 }, + end: { line: 1, ch: 22 }, + file: "MyObject.qml", + contextOffset: 23 +}, function (server) { + server.addFile("MyObject.qml", "Button {\n\tproperty var testProp\n}"); +}); + +testDefinition("MyObject {\n\ts: te|stSig()\n}", { + origin: "MyObject.qml", + start: { line: 1, ch: 8 }, + end: { line: 1, ch: 15 }, + file: "MyObject.qml", + contextOffset: 17 +}, function (server) { + server.addFile("MyObject.qml", "Button {\n\tsignal testSig()\n}"); +}); + +testDefinition("MyObject {\n\tonTe|stSig: ident\n}", { + origin: "MyObject.qml", + start: { line: 1, ch: 8 }, + end: { line: 1, ch: 15 }, + file: "MyObject.qml", + contextOffset: 17 +}, function (server) { + server.addFile("MyObject.qml", "Button {\n\tsignal testSig()\n}"); +}); + +testDefinition("MyObject {\n\tonTestSig: ar|g0\n}", { + origin: "MyObject.qml", + start: { line: 1, ch: 20 }, + end: { line: 1, ch: 24 }, + file: "MyObject.qml", + contextOffset: 29 +}, function (server) { + server.addFile("MyObject.qml", "Button {\n\tsignal testSig(int arg0)\n}"); +}); + +testDefinition("MyObject {\n\ts: te|stFn()\n}", { + origin: "MyObject.qml", + start: { line: 1, ch: 10 }, + end: { line: 1, ch: 16 }, + file: "MyObject.qml", + contextOffset: 19 +}, function (server) { + server.addFile("MyObject.qml", "Button {\n\tfunction testFn() {}\n}"); +}); + +testDefinition("MyObject {\n\ts: btn|Id\n}", { + origin: undefined, + start: undefined, + end: undefined, + file: undefined, + contextOffset: undefined +}, function (server) { + server.addFile("MyObject.qml", "Button {\n\tid: btnId\n}"); +}); + +testDefinition("MyObject {\n\tot|her: ident\n}", { + origin: undefined, + start: undefined, + end: undefined, + file: undefined, + contextOffset: undefined +}, function (server) { + server.addFile("MyObject.qml", "Button {\n\tSecondButton {\n\t\tjproperty var other\n\t}\n}"); +}); + +// ID Property +testDefinition("QtObject {\n\tid: obj\n\tproperty var prop: {\n\t\tob|j\n\t}\n}", { + origin: "main.qml", + start: { line: 1, ch: 5 }, + end: { line: 1, ch: 8 }, + file: "main.qml", + contextOffset: 16 +}); + +testDefinition("Window {\n\tButton {\n\t\tid: btn\n\t\tproperty int height\n\t}\n\ttest: bt|n\n}", { + origin: "main.qml", + start: { line: 2, ch: 6 }, + end: { line: 2, ch: 9 }, + file: "main.qml", + contextOffset: 25 +}); + +testDefinition("Window {\n\tproperty var btn\n\tButton {\n\t\tid: btn\n\t\tproperty int height\n\t}\n\ttest: bt|n\n}", { + origin: "main.qml", + start: { line: 3, ch: 6 }, + end: { line: 3, ch: 9 }, + file: "main.qml", + contextOffset: 43 +}); + +testDefinition("Window {\n\tproperty var btn\n\tButton {\n\t\tid: bt|n\n\t\tproperty int height\n\t}\n}", { + origin: "main.qml", + start: { line: 3, ch: 6 }, + end: { line: 3, ch: 9 }, + file: "main.qml", + contextOffset: 43 +}); + +// Property Declarations +testDefinition("QtObject {\n\tproperty var prop\n\tpr|op: 3\n}", { + origin: "main.qml", + start: { line: 1, ch: 14 }, + end: { line: 1, ch: 18 }, + file: "main.qml", + contextOffset: 25 +}); + +testDefinition("Window {\n\tproperty var btn\n\tButton {\n\t\tprop: b|tn\n\t}\n}", { + origin: "main.qml", + start: { line: 1, ch: 14 }, + end: { line: 1, ch: 17 }, + file: "main.qml", + contextOffset: 23 +}); + +testDefinition("Window {\n\tproperty var btn\n\tButton {\n\t\tButton {\n\t\t\tprop: b|tn\n\t\t}\n\t}\n}", { + origin: "main.qml", + start: { line: 1, ch: 14 }, + end: { line: 1, ch: 17 }, + file: "main.qml", + contextOffset: 23 +}); + +testDefinition("Window {\n\tButton {\n\t\tproperty var btn\n\t\tbt|n: 3\n\t}\n}", { + origin: "main.qml", + start: { line: 2, ch: 15 }, + end: { line: 2, ch: 18 }, + file: "main.qml", + contextOffset: 34 +}); + +testDefinition("Window {\n\tButton {\n\t\tproperty var btn\n\t\tButton {\n\t\t\tprop: b|tn\n\t\t}\n\t}\n}", { + origin: undefined, + start: undefined, + end: undefined, + file: undefined, + contextOffset: undefined +}); + +// Signals and Signal Handlers +testDefinition("Window {\n\tsignal clic|ked(int mouseX, int mouseY)\n}", { + origin: "main.qml", + start: { line: 1, ch: 8 }, + end: { line: 1, ch: 15 }, + file: "main.qml", + contextOffset: 17 +}); + +testDefinition("Window {\n\tsignal clicked(int mouseX, int mouseY)\n\tonCli|cked: 3\n}", { + origin: "main.qml", + start: { line: 1, ch: 8 }, + end: { line: 1, ch: 15 }, + file: "main.qml", + contextOffset: 17 +}); + +testDefinition("Window {\n\tsignal clicked(int mouseX, int mouseY)\n\tonClicked: mou|seX\n}", { + origin: "main.qml", + start: { line: 1, ch: 20 }, + end: { line: 1, ch: 26 }, + file: "main.qml", + contextOffset: 29 +}); + +testDefinition("Window {\n\tsignal clicked(int mouseX, int mouseY)\n\tonClicked: cli|cked(3,4)\n}", { + origin: "main.qml", + start: { line: 1, ch: 8 }, + end: { line: 1, ch: 15 }, + file: "main.qml", + contextOffset: 17 +}); + +testDefinition("Window {\n\tsignal clicked(int mouseX, int mouseY)\n\tonClicked: onCli|cked\n}", { + origin: "main.qml", + start: { line: 1, ch: 8 }, + end: { line: 1, ch: 15 }, + file: "main.qml", + contextOffset: 17 +}); + +testDefinition("Window {\n\tsignal clicked(int mouseX, int mouseY)\n\tid: wind\n\tonClicked: wind.onCli|cked\n}", { + origin: "main.qml", + start: { line: 1, ch: 8 }, + end: { line: 1, ch: 15 }, + file: "main.qml", + contextOffset: 17 +}); + +testDefinition("Window {\n\tsignal clicked(int mouseX, int mouseY)\n\tid: wind\n\tonClicked: wind.cli|cked(3,4)\n}", { + origin: "main.qml", + start: { line: 1, ch: 8 }, + end: { line: 1, ch: 15 }, + file: "main.qml", + contextOffset: 17 +}); + +testDefinition("Window {\n\tproperty int msg\n\tsignal error(string msg, boolean flag)\n\tonError: {\n\t\tms|g\n\t}\n}", { + origin: "main.qml", + start: { line: 2, ch: 21 }, + end: { line: 2, ch: 24 }, + file: "main.qml", + contextOffset: 48 +}, function (server) { server.jsDefs = []; }); + +// Function Declarations +testDefinition("Window {\n\tfunction te|st(a) {}\n}", { + origin: "main.qml", + start: { line: 1, ch: 10 }, + end: { line: 1, ch: 14 }, + file: "main.qml", + contextOffset: 19 +}); + +testDefinition("Window {\n\tfunction test(a) {\n\t\ta|\n\t}\n}", { + origin: "main.qml", + start: { line: 1, ch: 15 }, + end: { line: 1, ch: 16 }, + file: "main.qml", + contextOffset: 24 +}); + +testDefinition("Window {\n\tfunction test(a) {\n\t\tte|st(3)\n\t}\n}", { + origin: "main.qml", + start: { line: 1, ch: 10 }, + end: { line: 1, ch: 14 }, + file: "main.qml", + contextOffset: 19 +}); + +testDefinition("Window {\n\tfunction test(a) {}\n\ts: te|st(3)\n}", { + origin: "main.qml", + start: { line: 1, ch: 10 }, + end: { line: 1, ch: 14 }, + file: "main.qml", + contextOffset: 19 +}); + +testDefinition("Window {\n\tfunction test(a) {}\n\ts: {\n\t\tte|st(3)\n\t}\n}", { + origin: "main.qml", + start: { line: 1, ch: 10 }, + end: { line: 1, ch: 14 }, + file: "main.qml", + contextOffset: 19 +}); + +testDefinition("Window {\n\tfunction test(a) {}\n\tid: wind\n\ts: {\n\t\twind.te|st(3)\n\t}\n}", { + origin: "main.qml", + start: { line: 1, ch: 10 }, + end: { line: 1, ch: 14 }, + file: "main.qml", + contextOffset: 19 +}); + +testDefinition("Window {\n\tfunction test(a) {}\n\tte|st: 3;\n}", { + origin: undefined, + start: undefined, + end: undefined, + file: undefined, + contextOffset: undefined +}); + +testDefinition('Window {\n\tfunction test(a) {\n\t\ta|\n\t}\n}\n\tproperty int a', { + origin: "main.qml", + start: { line: 1, ch: 15 }, + end: { line: 1, ch: 16 }, + file: "main.qml", + contextOffset: 24 +}); + groupEnd(); \ No newline at end of file diff --git a/qt/org.eclipse.cdt.qt.core/tern-qml/test/test-parse.js b/qt/org.eclipse.cdt.qt.core/tern-qml/test/test-parse.js index 489808f6865..833d7fac516 100644 --- a/qt/org.eclipse.cdt.qt.core/tern-qml/test/test-parse.js +++ b/qt/org.eclipse.cdt.qt.core/tern-qml/test/test-parse.js @@ -1,126 +1,126 @@ -/******************************************************************************* - * Copyright (c) 2015 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 - *******************************************************************************/ -"use strict"; - -var driver = require("./driver.js"); -var test = driver.test; -var groupStart = driver.groupStart; -var groupEnd = driver.groupEnd; - -var group = exports.group = "Parse Query"; -groupStart(group); - -test("{Parse existing file}", function (server, callback, name) { - server.addFile("main.qml", "import QtQuick 2.0\nModule {\n\tComponent {\n\t}\n}"); - server.request({ - query: { - type: "parseFile", - file: "main.qml" - } - }, function (err, resp) { - if (err) { - throw err; - } - if (!resp.ast || resp.ast.type !== "QMLProgram") { - return callback("fail", name, "AST could not be found in response"); - } - return callback("ok", name); - }); -}); - -test("{Parse given file}", function (server, callback, name) { - server.request({ - files: [ - { - name: "main.qml", - text: "import QtQuick 2.0\nModule {\n\tComponent {\n\t}\n}", - type: "full" - } - ], - query: { - type: "parseFile", - file: "main.qml" - } - }, function (err, resp) { - if (err) { - throw err; - } - if (!resp.ast || resp.ast.type !== "QMLProgram") { - return callback("fail", name, "AST could not be found in response"); - } - return callback("ok", name); - }); -}); - -test("{Parse empty text}", function (server, callback, name) { - server.parseString("", null, function (err, resp) { - if (err) { - throw err; - } - if (!resp.ast) { - return callback("fail", name, "AST could not be found in response"); - } else if (resp.ast.type !== "QMLProgram" || resp.ast.mode !== "qml") { - return callback("fail", name, "AST was not a QMLProgram with mode 'qml'"); - } - return callback("ok", name); - }); -}); - -test("{Parse text no mode}", function (server, callback, name) { - server.parseString("import QtQuick 2.0\nModule {\n\tComponent {\n\t}\n}", null, function (err, resp) { - if (err) { - throw err; - } - if (!resp.ast) { - return callback("fail", name, "AST could not be found in response"); - } else if (resp.ast.type !== "QMLProgram" || resp.ast.mode !== "qml") { - return callback("fail", name, "AST was not a QMLProgram with mode 'qml'"); - } - return callback("ok", name); - }); -}); - -test("{Parse text (mode: qmltypes)}", function (server, callback, name) { - server.parseString("QtObject {\n\tobj: {\n\t\tprop1: 1,\n\t\tprop2: 2\n\t}\n}", { - mode: "qmltypes" - }, function (err, resp) { - if (err) { - throw err; - } - if (!resp.ast) { - return callback("fail", name, "AST could not be found in response"); - } else if (resp.ast.type !== "QMLProgram" || resp.ast.mode !== "qmltypes") { - return callback("fail", name, "AST was not a QMLProgram with mode 'qmltypes'"); - } - return callback("ok", name); - }); -}); - -test("{Parse text with locations}", function (server, callback, name) { - server.parseString("var w = 3", { - mode: "js", - locations: true - }, function (err, resp) { - if (err) { - throw err; - } - if (!resp.ast) { - return callback("fail", name, "AST could not be found in response"); - } else if (resp.ast.type !== "Program") { - return callback("fail", name, "AST was not a JavaScript Program"); - } else if (!resp.ast.loc) { - return callback("fail", name, "AST had no loc object"); - } - return callback("ok", name); - }); -}); - +/******************************************************************************* + * Copyright (c) 2015 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 + *******************************************************************************/ +"use strict"; + +var driver = require("./driver.js"); +var test = driver.test; +var groupStart = driver.groupStart; +var groupEnd = driver.groupEnd; + +var group = exports.group = "Parse Query"; +groupStart(group); + +test("{Parse existing file}", function (server, callback, name) { + server.addFile("main.qml", "import QtQuick 2.0\nModule {\n\tComponent {\n\t}\n}"); + server.request({ + query: { + type: "parseFile", + file: "main.qml" + } + }, function (err, resp) { + if (err) { + throw err; + } + if (!resp.ast || resp.ast.type !== "QMLProgram") { + return callback("fail", name, "AST could not be found in response"); + } + return callback("ok", name); + }); +}); + +test("{Parse given file}", function (server, callback, name) { + server.request({ + files: [ + { + name: "main.qml", + text: "import QtQuick 2.0\nModule {\n\tComponent {\n\t}\n}", + type: "full" + } + ], + query: { + type: "parseFile", + file: "main.qml" + } + }, function (err, resp) { + if (err) { + throw err; + } + if (!resp.ast || resp.ast.type !== "QMLProgram") { + return callback("fail", name, "AST could not be found in response"); + } + return callback("ok", name); + }); +}); + +test("{Parse empty text}", function (server, callback, name) { + server.parseString("", null, function (err, resp) { + if (err) { + throw err; + } + if (!resp.ast) { + return callback("fail", name, "AST could not be found in response"); + } else if (resp.ast.type !== "QMLProgram" || resp.ast.mode !== "qml") { + return callback("fail", name, "AST was not a QMLProgram with mode 'qml'"); + } + return callback("ok", name); + }); +}); + +test("{Parse text no mode}", function (server, callback, name) { + server.parseString("import QtQuick 2.0\nModule {\n\tComponent {\n\t}\n}", null, function (err, resp) { + if (err) { + throw err; + } + if (!resp.ast) { + return callback("fail", name, "AST could not be found in response"); + } else if (resp.ast.type !== "QMLProgram" || resp.ast.mode !== "qml") { + return callback("fail", name, "AST was not a QMLProgram with mode 'qml'"); + } + return callback("ok", name); + }); +}); + +test("{Parse text (mode: qmltypes)}", function (server, callback, name) { + server.parseString("QtObject {\n\tobj: {\n\t\tprop1: 1,\n\t\tprop2: 2\n\t}\n}", { + mode: "qmltypes" + }, function (err, resp) { + if (err) { + throw err; + } + if (!resp.ast) { + return callback("fail", name, "AST could not be found in response"); + } else if (resp.ast.type !== "QMLProgram" || resp.ast.mode !== "qmltypes") { + return callback("fail", name, "AST was not a QMLProgram with mode 'qmltypes'"); + } + return callback("ok", name); + }); +}); + +test("{Parse text with locations}", function (server, callback, name) { + server.parseString("var w = 3", { + mode: "js", + locations: true + }, function (err, resp) { + if (err) { + throw err; + } + if (!resp.ast) { + return callback("fail", name, "AST could not be found in response"); + } else if (resp.ast.type !== "Program") { + return callback("fail", name, "AST was not a JavaScript Program"); + } else if (!resp.ast.loc) { + return callback("fail", name, "AST had no loc object"); + } + return callback("ok", name); + }); +}); + groupEnd(); \ No newline at end of file diff --git a/qt/org.eclipse.cdt.qt.core/tern-qml/test/test-scoping.js b/qt/org.eclipse.cdt.qt.core/tern-qml/test/test-scoping.js index c44f8b4104c..a46e0f6dd54 100644 --- a/qt/org.eclipse.cdt.qt.core/tern-qml/test/test-scoping.js +++ b/qt/org.eclipse.cdt.qt.core/tern-qml/test/test-scoping.js @@ -1,409 +1,409 @@ -/******************************************************************************* - * Copyright (c) 2015 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 - *******************************************************************************/ -"use strict"; - -var plugin = require("../qml.js"); -var infer = require("tern/lib/infer"); -var driver = require("./driver.js"); -var test = driver.test; -var groupStart = driver.groupStart; -var groupEnd = driver.groupEnd; - -var group = exports.group = "Custom Scoping"; -groupStart(group); - -test("QMLObjScope::defProp()", function (server, callback, name) { - infer.withContext(new infer.Context([], server), function () { - // Create the scope and objects to test - var fileScope = new infer.Scope(); - var obj = new infer.Obj(null, "MyObject"); - var scope = new plugin.QMLObjScope(fileScope, null, obj); - - // Define some properties - scope.defProp("first", null); - scope.defProp("second", null); - - // Make sure there are no properties in the scopes themselves - if (fileScope.props && fileScope.props.length > 0) { - return callback("fail", name, "- File scope contained properties (none expected)"); - } - if (scope.props && scope.props.length > 0) { - return callback("fail", name, "- QMLObjScope contained properties (none expected)"); - } - - // Check the Obj Type for the props we created - if (!obj.props.first) { - return callback("fail", name, "- Obj did not contain property 'first'"); - } - if (!obj.props.second) { - return callback("fail", name, "- Obj did not contain property 'second'"); - } - return callback("ok", name); - }); -}); - -test("QMLObjScope::hasProp()", function (server, callback, name) { - infer.withContext(new infer.Context([], server), function () { - // Create the scope and objects to test - var fileScope = new infer.Scope(); - var obj = new infer.Obj(null, "MyObject"); - var scope = new plugin.QMLObjScope(fileScope, null, obj); - - // Define a property on the Obj Type - obj.defProp("first", null); - - // Query the scope for the prop we created and make sure it returns the right one - var prop = scope.hasProp("first", true); - if (!prop) { - return callback("fail", name, "- hasProp('first') returned null"); - } else if (prop.propertyName !== "first") { - return callback("fail", name, "- hasProp('first') returned invalid property"); - } - return callback("ok", name); - }); -}); - -test("QMLObjScope::removeProp()", function (server, callback, name) { - infer.withContext(new infer.Context([], server), function () { - // Create the scope and objects to test - var fileScope = new infer.Scope(); - var obj = new infer.Obj(null, "MyObject"); - var scope = new plugin.QMLObjScope(fileScope, null, obj); - - // Define some properties - scope.defProp("first", null); - scope.defProp("second", null); - - // Remove the properties we defined - scope.removeProp("first"); - scope.removeProp("second"); - - // Check the Obj Type for the props we created - if (obj.props && obj.props.length > 0) { - return callback("fail", name, "- Obj contained properties (none expected)"); - } - return callback("ok", name); - }); -}); - -test("QMLObjScope::gatherProperties()", function (server, callback, name) { - infer.withContext(new infer.Context([], server), function () { - // Create the scope and objects to test - var fileScope = new infer.Scope(); - var obj = new infer.Obj(null, "MyObject"); - var scope = new plugin.QMLObjScope(fileScope, null, obj); - - // Define some properties - fileScope.defProp("third", null); - scope.defProp("first", null); - scope.defProp("second", null); - - // Gather the properties and store them in the order they were received - var props = []; - scope.gatherProperties(function (prop, obj, depth) { - props.push(prop); - }); - - // Check the gathered properties for correctness (order matters) - if (props.length !== 3) { - return callback("fail", name, "- Invalid number of properties gathered (" + props.length + ")"); - } - if (props[0] !== "first") { - return callback("fail", name, "- props[0] was not property 'first'"); - } - if (props[1] !== "second") { - return callback("fail", name, "- props[1] was not property 'second'"); - } - if (props[2] !== "third") { - return callback("fail", name, "- props[2] was not property 'third'"); - } - return callback("ok", name); - }); -}); - -test("QMLMemScope::defProp()", function (server, callback, name) { - infer.withContext(new infer.Context([], server), function () { - // Create the scope and objects to test - var fileScope = new infer.Scope(); - var obj = new infer.Obj(null, "MyObject"); - var objScope = new plugin.QMLObjScope(fileScope, null, obj); - var scope = new plugin.QMLMemScope(objScope, null, fileScope); - - // Define some properties - scope.defProp("first", null); - scope.defProp("second", null); - - // Make sure there are no properties in the scopes themselves - if (fileScope.props && fileScope.props.length > 0) { - return callback("fail", name, "- File scope contained properties (none expected)"); - } - if (scope.props && scope.props.length > 0) { - return callback("fail", name, "- QMLMemScope contained properties (none expected)"); - } - - // Check the Obj Type for the props we created - if (!obj.props.first) { - return callback("fail", name, "- Obj did not contain property 'first'"); - } - if (!obj.props.second) { - return callback("fail", name, "- Obj did not contain property 'second'"); - } - return callback("ok", name); - }); -}); - -test("QMLMemScope::hasProp()", function (server, callback, name) { - infer.withContext(new infer.Context([], server), function () { - // Create the scope and objects to test - var fileScope = new infer.Scope(); - var obj = new infer.Obj(null, "MyObject"); - var objScope = new plugin.QMLObjScope(fileScope, null, obj); - var scope = new plugin.QMLMemScope(objScope, null, fileScope); - - // Define a property on the Obj Type and File Scope - obj.defProp("first", null); - fileScope.defProp("second", null); - - // Query the scope for the prop we created and make sure it returns the right one - var prop = scope.hasProp("first", true); - if (!prop) { - return callback("fail", name, "- hasProp('first') returned null"); - } else if (prop.propertyName !== "first") { - return callback("fail", name, "- hasProp('first') returned invalid property"); - } - prop = scope.hasProp("second", true); - if (!prop) { - return callback("fail", name, "- hasProp('second') returned null"); - } else if (prop.propertyName !== "second") { - return callback("fail", name, "- hasProp('second') returned invalid property"); - } - return callback("ok", name); - }); -}); - -test("QMLMemScope::hasProp() [Multiple Parent Scopes]", function (server, callback, name) { - infer.withContext(new infer.Context([], server), function () { - // Create the scope and objects to test - var fileScope = new infer.Scope(); - var rootObj = new infer.Obj(null, "Root"); - var rootObjScope = new plugin.QMLObjScope(fileScope, null, rootObj); - var obj = new infer.Obj(null, "MyObject"); - var objScope = new plugin.QMLObjScope(rootObjScope, null, obj); - var scope = new plugin.QMLMemScope(objScope, null, fileScope); - - // Define a property on the Root Obj Type and Obj Type - rootObj.defProp("notVisible", null); - obj.defProp("visible", null); - - // Query the scope for the prop we created and make sure it returns the right one - var prop = scope.hasProp("notVisible", true); - if (prop) { - return callback("fail", name, "- found property 'notVisible'"); - } - prop = scope.hasProp("visible", true); - if (!prop) { - return callback("fail", name, "- hasProp('visible') returned null"); - } else if (prop.propertyName !== "visible") { - return callback("fail", name, "- hasProp('visible') returned invalid property"); - } - return callback("ok", name); - }); -}); - -test("QMLMemScope::removeProp()", function (server, callback, name) { - infer.withContext(new infer.Context([], server), function () { - // Create the scope and objects to test - var fileScope = new infer.Scope(); - var obj = new infer.Obj(null, "MyObject"); - var objScope = new plugin.QMLObjScope(fileScope, null, obj); - var scope = new plugin.QMLMemScope(objScope, null, fileScope); - - // Define some properties - scope.defProp("first", null); - scope.defProp("second", null); - - // Remove the properties we defined - scope.removeProp("first"); - scope.removeProp("second"); - - // Check the Obj Type for the props we created - if (obj.props && obj.props.length > 0) { - return callback("fail", name, "- Obj contained properties (none expected)"); - } - return callback("ok", name); - }); -}); - -test("QMLMemScope::gatherProperties()", function (server, callback, name) { - infer.withContext(new infer.Context([], server), function () { - // Create the scope and objects to test - var fileScope = new infer.Scope(); - var obj = new infer.Obj(null, "MyObject"); - var objScope = new plugin.QMLObjScope(fileScope, null, obj); - var scope = new plugin.QMLMemScope(objScope, null, fileScope); - - // Define some properties - fileScope.defProp("third", null); - scope.defProp("first", null); - scope.defProp("second", null); - - // Gather the properties and store them in the order they were received - var props = []; - scope.gatherProperties(function (prop, obj, depth) { - props.push(prop); - }); - - // Check the gathered properties for correctness (order matters) - if (props.length !== 3) { - return callback("fail", name, "- Invalid number of properties gathered (" + props.length + ")"); - } - if (props[0] !== "first") { - return callback("fail", name, "- props[0] was not property 'first'"); - } - if (props[1] !== "second") { - return callback("fail", name, "- props[1] was not property 'second'"); - } - if (props[2] !== "third") { - return callback("fail", name, "- props[2] was not property 'third'"); - } - return callback("ok", name); - }); -}); - -test("QMLMemScope::gatherProperties() [Multiple Parent Scopes]", function (server, callback, name) { - infer.withContext(new infer.Context([], server), function () { - // Create the scope and objects to test - var fileScope = new infer.Scope(); - var rootObj = new infer.Obj(null, "Root"); - var rootObjScope = new plugin.QMLObjScope(fileScope, null, rootObj); - var obj = new infer.Obj(null, "MyObject"); - var objScope = new plugin.QMLObjScope(rootObjScope, null, obj); - var scope = new plugin.QMLMemScope(objScope, null, fileScope); - - // Define a property on the Root Obj Type and Obj Type - rootObj.defProp("notVisible", null); - obj.defProp("visible", null); - - // Gather the properties and store them in the order they were received - var props = []; - scope.gatherProperties(function (prop, obj, depth) { - props.push(prop); - }); - - // Check the gathered properties for correctness (order matters) - if (props.length !== 1) { - return callback("fail", name, "- Invalid number of properties gathered (" + props.length + ")"); - } - if (props[0] !== "visible") { - return callback("fail", name, "- props[0] was not property 'visible'"); - } - return callback("ok", name); - }); -}); - -test("QMLJSScope::hasProp()", function (server, callback, name) { - infer.withContext(new infer.Context([], server), function () { - // Create the scope and objects to test - var fileScope = new infer.Scope(); - var idScope = new infer.Scope(null, ""); - var jsScope = new infer.Scope(null, ""); - var fnScope = new infer.Scope(null, ""); - var scope = new plugin.QMLJSScope(fileScope, null, idScope, jsScope, fnScope); - - // Define properties in each scope - fileScope.defProp("first", null); - idScope.defProp("second", null); - jsScope.defProp("third", null); - fnScope.defProp("fourth", null); - scope.defProp("fifth", null); - - // Query the scope for the prop we created and make sure it returns the right one - var prop = scope.hasProp("first", true); - if (!prop) { - return callback("fail", name, "- hasProp('first') returned null"); - } else if (prop.propertyName !== "first") { - return callback("fail", name, "- hasProp('first') returned invalid property"); - } - prop = scope.hasProp("second", true); - if (!prop) { - return callback("fail", name, "- hasProp('second') returned null"); - } else if (prop.propertyName !== "second") { - return callback("fail", name, "- hasProp('second') returned invalid property"); - } - prop = scope.hasProp("third", true); - if (!prop) { - return callback("fail", name, "- hasProp('third') returned null"); - } else if (prop.propertyName !== "third") { - return callback("fail", name, "- hasProp('third') returned invalid property"); - } - prop = scope.hasProp("fourth", true); - if (!prop) { - return callback("fail", name, "- hasProp('fourth') returned null"); - } else if (prop.propertyName !== "fourth") { - return callback("fail", name, "- hasProp('fourth') returned invalid property"); - } - prop = scope.hasProp("fifth", true); - if (!prop) { - return callback("fail", name, "- hasProp('fifth') returned null"); - } else if (prop.propertyName !== "fifth") { - return callback("fail", name, "- hasProp('fifth') returned invalid property"); - } - return callback("ok", name); - }); -}); - -test("QMLJSScope::gatherProperties()", function (server, callback, name) { - infer.withContext(new infer.Context([], server), function () { - // Create the scope and objects to test - // Create the scope and objects to test - var fileScope = new infer.Scope(); - var idScope = new infer.Scope(null, ""); - var jsScope = new infer.Scope(null, ""); - var fnScope = new infer.Scope(null, ""); - var scope = new plugin.QMLJSScope(fileScope, null, idScope, jsScope, fnScope); - - // Define properties in each scope - fileScope.defProp("fifth", null); - idScope.defProp("first", null); - jsScope.defProp("fourth", null); - fnScope.defProp("third", null); - scope.defProp("second", null); - - // Gather the properties and store them in the order they were received - var props = []; - scope.gatherProperties(function (prop, obj, depth) { - props.push(prop); - }); - - // Check the gathered properties for correctness (order matters) - if (props.length !== 5) { - return callback("fail", name, "- Invalid number of properties gathered (" + props.length + ")"); - } - if (props[0] !== "first") { - return callback("fail", name, "- props[0] was not property 'first'"); - } - if (props[1] !== "second") { - return callback("fail", name, "- props[1] was not property 'second'"); - } - if (props[2] !== "third") { - return callback("fail", name, "- props[2] was not property 'third'"); - } - if (props[3] !== "fourth") { - return callback("fail", name, "- props[3] was not property 'fourth'"); - } - if (props[4] !== "fifth") { - return callback("fail", name, "- props[4] was not property 'fifth'"); - } - return callback("ok", name); - }); -}); - +/******************************************************************************* + * Copyright (c) 2015 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 + *******************************************************************************/ +"use strict"; + +var plugin = require("../qml.js"); +var infer = require("tern/lib/infer"); +var driver = require("./driver.js"); +var test = driver.test; +var groupStart = driver.groupStart; +var groupEnd = driver.groupEnd; + +var group = exports.group = "Custom Scoping"; +groupStart(group); + +test("QMLObjScope::defProp()", function (server, callback, name) { + infer.withContext(new infer.Context([], server), function () { + // Create the scope and objects to test + var fileScope = new infer.Scope(); + var obj = new infer.Obj(null, "MyObject"); + var scope = new plugin.QMLObjScope(fileScope, null, obj); + + // Define some properties + scope.defProp("first", null); + scope.defProp("second", null); + + // Make sure there are no properties in the scopes themselves + if (fileScope.props && fileScope.props.length > 0) { + return callback("fail", name, "- File scope contained properties (none expected)"); + } + if (scope.props && scope.props.length > 0) { + return callback("fail", name, "- QMLObjScope contained properties (none expected)"); + } + + // Check the Obj Type for the props we created + if (!obj.props.first) { + return callback("fail", name, "- Obj did not contain property 'first'"); + } + if (!obj.props.second) { + return callback("fail", name, "- Obj did not contain property 'second'"); + } + return callback("ok", name); + }); +}); + +test("QMLObjScope::hasProp()", function (server, callback, name) { + infer.withContext(new infer.Context([], server), function () { + // Create the scope and objects to test + var fileScope = new infer.Scope(); + var obj = new infer.Obj(null, "MyObject"); + var scope = new plugin.QMLObjScope(fileScope, null, obj); + + // Define a property on the Obj Type + obj.defProp("first", null); + + // Query the scope for the prop we created and make sure it returns the right one + var prop = scope.hasProp("first", true); + if (!prop) { + return callback("fail", name, "- hasProp('first') returned null"); + } else if (prop.propertyName !== "first") { + return callback("fail", name, "- hasProp('first') returned invalid property"); + } + return callback("ok", name); + }); +}); + +test("QMLObjScope::removeProp()", function (server, callback, name) { + infer.withContext(new infer.Context([], server), function () { + // Create the scope and objects to test + var fileScope = new infer.Scope(); + var obj = new infer.Obj(null, "MyObject"); + var scope = new plugin.QMLObjScope(fileScope, null, obj); + + // Define some properties + scope.defProp("first", null); + scope.defProp("second", null); + + // Remove the properties we defined + scope.removeProp("first"); + scope.removeProp("second"); + + // Check the Obj Type for the props we created + if (obj.props && obj.props.length > 0) { + return callback("fail", name, "- Obj contained properties (none expected)"); + } + return callback("ok", name); + }); +}); + +test("QMLObjScope::gatherProperties()", function (server, callback, name) { + infer.withContext(new infer.Context([], server), function () { + // Create the scope and objects to test + var fileScope = new infer.Scope(); + var obj = new infer.Obj(null, "MyObject"); + var scope = new plugin.QMLObjScope(fileScope, null, obj); + + // Define some properties + fileScope.defProp("third", null); + scope.defProp("first", null); + scope.defProp("second", null); + + // Gather the properties and store them in the order they were received + var props = []; + scope.gatherProperties(function (prop, obj, depth) { + props.push(prop); + }); + + // Check the gathered properties for correctness (order matters) + if (props.length !== 3) { + return callback("fail", name, "- Invalid number of properties gathered (" + props.length + ")"); + } + if (props[0] !== "first") { + return callback("fail", name, "- props[0] was not property 'first'"); + } + if (props[1] !== "second") { + return callback("fail", name, "- props[1] was not property 'second'"); + } + if (props[2] !== "third") { + return callback("fail", name, "- props[2] was not property 'third'"); + } + return callback("ok", name); + }); +}); + +test("QMLMemScope::defProp()", function (server, callback, name) { + infer.withContext(new infer.Context([], server), function () { + // Create the scope and objects to test + var fileScope = new infer.Scope(); + var obj = new infer.Obj(null, "MyObject"); + var objScope = new plugin.QMLObjScope(fileScope, null, obj); + var scope = new plugin.QMLMemScope(objScope, null, fileScope); + + // Define some properties + scope.defProp("first", null); + scope.defProp("second", null); + + // Make sure there are no properties in the scopes themselves + if (fileScope.props && fileScope.props.length > 0) { + return callback("fail", name, "- File scope contained properties (none expected)"); + } + if (scope.props && scope.props.length > 0) { + return callback("fail", name, "- QMLMemScope contained properties (none expected)"); + } + + // Check the Obj Type for the props we created + if (!obj.props.first) { + return callback("fail", name, "- Obj did not contain property 'first'"); + } + if (!obj.props.second) { + return callback("fail", name, "- Obj did not contain property 'second'"); + } + return callback("ok", name); + }); +}); + +test("QMLMemScope::hasProp()", function (server, callback, name) { + infer.withContext(new infer.Context([], server), function () { + // Create the scope and objects to test + var fileScope = new infer.Scope(); + var obj = new infer.Obj(null, "MyObject"); + var objScope = new plugin.QMLObjScope(fileScope, null, obj); + var scope = new plugin.QMLMemScope(objScope, null, fileScope); + + // Define a property on the Obj Type and File Scope + obj.defProp("first", null); + fileScope.defProp("second", null); + + // Query the scope for the prop we created and make sure it returns the right one + var prop = scope.hasProp("first", true); + if (!prop) { + return callback("fail", name, "- hasProp('first') returned null"); + } else if (prop.propertyName !== "first") { + return callback("fail", name, "- hasProp('first') returned invalid property"); + } + prop = scope.hasProp("second", true); + if (!prop) { + return callback("fail", name, "- hasProp('second') returned null"); + } else if (prop.propertyName !== "second") { + return callback("fail", name, "- hasProp('second') returned invalid property"); + } + return callback("ok", name); + }); +}); + +test("QMLMemScope::hasProp() [Multiple Parent Scopes]", function (server, callback, name) { + infer.withContext(new infer.Context([], server), function () { + // Create the scope and objects to test + var fileScope = new infer.Scope(); + var rootObj = new infer.Obj(null, "Root"); + var rootObjScope = new plugin.QMLObjScope(fileScope, null, rootObj); + var obj = new infer.Obj(null, "MyObject"); + var objScope = new plugin.QMLObjScope(rootObjScope, null, obj); + var scope = new plugin.QMLMemScope(objScope, null, fileScope); + + // Define a property on the Root Obj Type and Obj Type + rootObj.defProp("notVisible", null); + obj.defProp("visible", null); + + // Query the scope for the prop we created and make sure it returns the right one + var prop = scope.hasProp("notVisible", true); + if (prop) { + return callback("fail", name, "- found property 'notVisible'"); + } + prop = scope.hasProp("visible", true); + if (!prop) { + return callback("fail", name, "- hasProp('visible') returned null"); + } else if (prop.propertyName !== "visible") { + return callback("fail", name, "- hasProp('visible') returned invalid property"); + } + return callback("ok", name); + }); +}); + +test("QMLMemScope::removeProp()", function (server, callback, name) { + infer.withContext(new infer.Context([], server), function () { + // Create the scope and objects to test + var fileScope = new infer.Scope(); + var obj = new infer.Obj(null, "MyObject"); + var objScope = new plugin.QMLObjScope(fileScope, null, obj); + var scope = new plugin.QMLMemScope(objScope, null, fileScope); + + // Define some properties + scope.defProp("first", null); + scope.defProp("second", null); + + // Remove the properties we defined + scope.removeProp("first"); + scope.removeProp("second"); + + // Check the Obj Type for the props we created + if (obj.props && obj.props.length > 0) { + return callback("fail", name, "- Obj contained properties (none expected)"); + } + return callback("ok", name); + }); +}); + +test("QMLMemScope::gatherProperties()", function (server, callback, name) { + infer.withContext(new infer.Context([], server), function () { + // Create the scope and objects to test + var fileScope = new infer.Scope(); + var obj = new infer.Obj(null, "MyObject"); + var objScope = new plugin.QMLObjScope(fileScope, null, obj); + var scope = new plugin.QMLMemScope(objScope, null, fileScope); + + // Define some properties + fileScope.defProp("third", null); + scope.defProp("first", null); + scope.defProp("second", null); + + // Gather the properties and store them in the order they were received + var props = []; + scope.gatherProperties(function (prop, obj, depth) { + props.push(prop); + }); + + // Check the gathered properties for correctness (order matters) + if (props.length !== 3) { + return callback("fail", name, "- Invalid number of properties gathered (" + props.length + ")"); + } + if (props[0] !== "first") { + return callback("fail", name, "- props[0] was not property 'first'"); + } + if (props[1] !== "second") { + return callback("fail", name, "- props[1] was not property 'second'"); + } + if (props[2] !== "third") { + return callback("fail", name, "- props[2] was not property 'third'"); + } + return callback("ok", name); + }); +}); + +test("QMLMemScope::gatherProperties() [Multiple Parent Scopes]", function (server, callback, name) { + infer.withContext(new infer.Context([], server), function () { + // Create the scope and objects to test + var fileScope = new infer.Scope(); + var rootObj = new infer.Obj(null, "Root"); + var rootObjScope = new plugin.QMLObjScope(fileScope, null, rootObj); + var obj = new infer.Obj(null, "MyObject"); + var objScope = new plugin.QMLObjScope(rootObjScope, null, obj); + var scope = new plugin.QMLMemScope(objScope, null, fileScope); + + // Define a property on the Root Obj Type and Obj Type + rootObj.defProp("notVisible", null); + obj.defProp("visible", null); + + // Gather the properties and store them in the order they were received + var props = []; + scope.gatherProperties(function (prop, obj, depth) { + props.push(prop); + }); + + // Check the gathered properties for correctness (order matters) + if (props.length !== 1) { + return callback("fail", name, "- Invalid number of properties gathered (" + props.length + ")"); + } + if (props[0] !== "visible") { + return callback("fail", name, "- props[0] was not property 'visible'"); + } + return callback("ok", name); + }); +}); + +test("QMLJSScope::hasProp()", function (server, callback, name) { + infer.withContext(new infer.Context([], server), function () { + // Create the scope and objects to test + var fileScope = new infer.Scope(); + var idScope = new infer.Scope(null, ""); + var jsScope = new infer.Scope(null, ""); + var fnScope = new infer.Scope(null, ""); + var scope = new plugin.QMLJSScope(fileScope, null, idScope, jsScope, fnScope); + + // Define properties in each scope + fileScope.defProp("first", null); + idScope.defProp("second", null); + jsScope.defProp("third", null); + fnScope.defProp("fourth", null); + scope.defProp("fifth", null); + + // Query the scope for the prop we created and make sure it returns the right one + var prop = scope.hasProp("first", true); + if (!prop) { + return callback("fail", name, "- hasProp('first') returned null"); + } else if (prop.propertyName !== "first") { + return callback("fail", name, "- hasProp('first') returned invalid property"); + } + prop = scope.hasProp("second", true); + if (!prop) { + return callback("fail", name, "- hasProp('second') returned null"); + } else if (prop.propertyName !== "second") { + return callback("fail", name, "- hasProp('second') returned invalid property"); + } + prop = scope.hasProp("third", true); + if (!prop) { + return callback("fail", name, "- hasProp('third') returned null"); + } else if (prop.propertyName !== "third") { + return callback("fail", name, "- hasProp('third') returned invalid property"); + } + prop = scope.hasProp("fourth", true); + if (!prop) { + return callback("fail", name, "- hasProp('fourth') returned null"); + } else if (prop.propertyName !== "fourth") { + return callback("fail", name, "- hasProp('fourth') returned invalid property"); + } + prop = scope.hasProp("fifth", true); + if (!prop) { + return callback("fail", name, "- hasProp('fifth') returned null"); + } else if (prop.propertyName !== "fifth") { + return callback("fail", name, "- hasProp('fifth') returned invalid property"); + } + return callback("ok", name); + }); +}); + +test("QMLJSScope::gatherProperties()", function (server, callback, name) { + infer.withContext(new infer.Context([], server), function () { + // Create the scope and objects to test + // Create the scope and objects to test + var fileScope = new infer.Scope(); + var idScope = new infer.Scope(null, ""); + var jsScope = new infer.Scope(null, ""); + var fnScope = new infer.Scope(null, ""); + var scope = new plugin.QMLJSScope(fileScope, null, idScope, jsScope, fnScope); + + // Define properties in each scope + fileScope.defProp("fifth", null); + idScope.defProp("first", null); + jsScope.defProp("fourth", null); + fnScope.defProp("third", null); + scope.defProp("second", null); + + // Gather the properties and store them in the order they were received + var props = []; + scope.gatherProperties(function (prop, obj, depth) { + props.push(prop); + }); + + // Check the gathered properties for correctness (order matters) + if (props.length !== 5) { + return callback("fail", name, "- Invalid number of properties gathered (" + props.length + ")"); + } + if (props[0] !== "first") { + return callback("fail", name, "- props[0] was not property 'first'"); + } + if (props[1] !== "second") { + return callback("fail", name, "- props[1] was not property 'second'"); + } + if (props[2] !== "third") { + return callback("fail", name, "- props[2] was not property 'third'"); + } + if (props[3] !== "fourth") { + return callback("fail", name, "- props[3] was not property 'fourth'"); + } + if (props[4] !== "fifth") { + return callback("fail", name, "- props[4] was not property 'fifth'"); + } + return callback("ok", name); + }); +}); + groupEnd(); \ No newline at end of file diff --git a/qt/org.eclipse.cdt.qt.ui.tests/src/org/eclipse/cdt/qt/pro/parser/tests/QtProjectFileModifierTest.java b/qt/org.eclipse.cdt.qt.ui.tests/src/org/eclipse/cdt/qt/pro/parser/tests/QtProjectFileModifierTest.java index 4880a08eed9..eac78a86fe4 100644 --- a/qt/org.eclipse.cdt.qt.ui.tests/src/org/eclipse/cdt/qt/pro/parser/tests/QtProjectFileModifierTest.java +++ b/qt/org.eclipse.cdt.qt.ui.tests/src/org/eclipse/cdt/qt/pro/parser/tests/QtProjectFileModifierTest.java @@ -1,340 +1,340 @@ -/******************************************************************************* - * Copyright (c) 2015 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.qt.pro.parser.tests; - -import org.eclipse.cdt.internal.qt.ui.pro.parser.QtProjectFileModifier; -import org.eclipse.jface.text.Document; -import org.eclipse.jface.text.IDocument; -import org.junit.Test; - -import junit.framework.TestCase; - -public class QtProjectFileModifierTest extends TestCase { - - @Test - public void test_ReplaceValue_SingleValue() { - IDocument document = new Document("SOURCES += main.cpp"); //$NON-NLS-1$ - - QtProjectFileModifier modifier = new QtProjectFileModifier(document); - - assertTrue(modifier.replaceVariableValue("SOURCES", "main.cpp", "main2.cpp")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - assertEquals("SOURCES += main2.cpp", //$NON-NLS-1$ - document.get()); - } - - @Test - public void test_ReplaceValue_HasCommentOnMainLine() { - IDocument document = new Document("SOURCES += main.cpp # This is a comment"); //$NON-NLS-1$ - - QtProjectFileModifier modifier = new QtProjectFileModifier(document); - - assertTrue(modifier.replaceVariableValue("SOURCES", "main.cpp", "main2.cpp")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - assertEquals("SOURCES += main2.cpp # This is a comment", //$NON-NLS-1$ - document.get()); - } - - @Test - public void test_ReplaceValue_HasCommentOnSubsequentLine() { - IDocument document = new Document( - "SOURCES += main.cpp \\ # This is a comment\n" //$NON-NLS-1$ - + " main2.cpp # This is a comment"); //$NON-NLS-1$ - - QtProjectFileModifier modifier = new QtProjectFileModifier(document); - - assertTrue(modifier.replaceVariableValue("SOURCES", "main2.cpp", "main3.cpp")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - assertEquals( - "SOURCES += main.cpp \\ # This is a comment\n" //$NON-NLS-1$ - + " main3.cpp # This is a comment", //$NON-NLS-1$ - document.get()); - } - - @Test - public void test_ReplaceValue_MatchWholeLineFalse() { - IDocument document = new Document("CONFIG = qt debug"); //$NON-NLS-1$ - - QtProjectFileModifier modifier = new QtProjectFileModifier(document); - - assertTrue(modifier.replaceVariableValue("CONFIG", "debug", "console", false)); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - assertEquals( - "CONFIG = qt console", //$NON-NLS-1$ - document.get()); - } - - @Test - public void test_ReplaceValue_DoesNotExist() { - IDocument document = new Document("CONFIG = qt debug"); //$NON-NLS-1$ - - QtProjectFileModifier modifier = new QtProjectFileModifier(document); - - assertFalse(modifier.replaceVariableValue("CONFIG", "console", "debug", false)); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - assertEquals( - "CONFIG = qt debug", //$NON-NLS-1$ - document.get()); - } - - @Test - public void test_ReplaceMultilineValue_MatchWholeLineFalse() { - IDocument document = new Document( - "CONFIG = qt \\\n" //$NON-NLS-1$ - + " debug"); //$NON-NLS-1$ - - QtProjectFileModifier modifier = new QtProjectFileModifier(document); - - assertTrue(modifier.replaceVariableValue("CONFIG", "debug", "console", false)); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - assertEquals( - "CONFIG = qt \\\n" //$NON-NLS-1$ - + " console", //$NON-NLS-1$ - document.get()); - } - - @Test - public void test_ReplaceMultilineValue() { - IDocument document = new Document( - "SOURCES += main.cpp \\\n" //$NON-NLS-1$ - + " main2.cpp"); //$NON-NLS-1$ - - QtProjectFileModifier modifier = new QtProjectFileModifier(document); - - assertTrue(modifier.replaceVariableValue("SOURCES", "main2.cpp", "main3.cpp")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - assertEquals( - "SOURCES += main.cpp \\\n" //$NON-NLS-1$ - + " main3.cpp", //$NON-NLS-1$ - document.get()); - } - - @Test - public void test_ReplaceMultilineValue_HasComment() { - IDocument document = new Document( - "SOURCES += main.cpp \\\n" //$NON-NLS-1$ - + " main2.cpp # This is a comment"); //$NON-NLS-1$ - - QtProjectFileModifier modifier = new QtProjectFileModifier(document); - - assertTrue(modifier.replaceVariableValue("SOURCES", "main2.cpp", "main3.cpp")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - assertEquals( - "SOURCES += main.cpp \\\n" //$NON-NLS-1$ - + " main3.cpp # This is a comment", //$NON-NLS-1$ - document.get()); - } - - @Test - public void test_AddValue() { - IDocument document = new Document("SOURCES += main.cpp"); //$NON-NLS-1$ - - QtProjectFileModifier modifier = new QtProjectFileModifier(document); - modifier.addVariableValue("SOURCES", "main2.cpp"); //$NON-NLS-1$ //$NON-NLS-2$ - - assertEquals( - "SOURCES += main.cpp \\\n" //$NON-NLS-1$ - + " main2.cpp", //$NON-NLS-1$ - document.get()); - } - - @Test - public void test_AddValue_NoIndentation() { - IDocument document = new Document( - "SOURCES += main.cpp \\\n" //$NON-NLS-1$ - + "noindent.cpp"); //$NON-NLS-1$ - - QtProjectFileModifier modifier = new QtProjectFileModifier(document); - modifier.addVariableValue("SOURCES", "main2.cpp"); //$NON-NLS-1$ //$NON-NLS-2$ - - assertEquals( - "SOURCES += main.cpp \\\n" //$NON-NLS-1$ - + "noindent.cpp \\\n" //$NON-NLS-1$ - + "main2.cpp", //$NON-NLS-1$ - document.get()); - } - - @Test - public void test_AddValue_AlreadyExists() { - IDocument document = new Document("SOURCES += main.cpp"); //$NON-NLS-1$ - - QtProjectFileModifier modifier = new QtProjectFileModifier(document); - modifier.addVariableValue("SOURCES", "main.cpp"); //$NON-NLS-1$ //$NON-NLS-2$ - - assertEquals("SOURCES += main.cpp", document.get()); //$NON-NLS-1$ - } - - @Test - public void test_AddValue_HasCommentOnMainLine() { - IDocument document = new Document("SOURCES += main.cpp # This is a comment"); //$NON-NLS-1$ - - QtProjectFileModifier modifier = new QtProjectFileModifier(document); - modifier.addVariableValue("SOURCES", "main2.cpp"); //$NON-NLS-1$ //$NON-NLS-2$ - - assertEquals( - "SOURCES += main.cpp \\ # This is a comment\n" //$NON-NLS-1$ - + " main2.cpp", //$NON-NLS-1$ - document.get()); - } - - @Test - public void test_AddValue_HasCommentOnSubsequentLine() { - IDocument document = new Document( - "SOURCES += main.cpp \\ # This is a comment \n" //$NON-NLS-1$ - + " main2.cpp # this is a comment\n\n"); //$NON-NLS-1$ - - QtProjectFileModifier modifier = new QtProjectFileModifier(document); - modifier.addVariableValue("SOURCES", "main3.cpp"); //$NON-NLS-1$ //$NON-NLS-2$ - - assertEquals( - "SOURCES += main.cpp \\ # This is a comment \n" //$NON-NLS-1$ - + " main2.cpp \\ # this is a comment\n" //$NON-NLS-1$ - + " main3.cpp\n\n", //$NON-NLS-1$ - document.get()); - } - - @Test - public void test_AddValue_CommentIndentation() { - IDocument document = new Document( - "SOURCES += main.cpp \\ # Test comment\n" //$NON-NLS-1$ - + " main2.cpp \\ # Test comment2\n" //$NON-NLS-1$ - + " main3.cpp # Test comment3"); //$NON-NLS-1$ - - QtProjectFileModifier modifier = new QtProjectFileModifier(document); - modifier.addVariableValue("SOURCES", "main4.cpp"); //$NON-NLS-1$ //$NON-NLS-2$ - - assertEquals( - "SOURCES += main.cpp \\ # Test comment\n" //$NON-NLS-1$ - + " main2.cpp \\ # Test comment2\n" //$NON-NLS-1$ - + " main3.cpp \\ # Test comment3\n" //$NON-NLS-1$ - + " main4.cpp", //$NON-NLS-1$ - document.get()); - } - - @Test - public void test_AddValue_MultipleVariables() { - IDocument document = new Document( - "SOURCES += main.cpp\n" //$NON-NLS-1$ - + "\n" //$NON-NLS-1$ - + "QT = app"); //$NON-NLS-1$ - - QtProjectFileModifier modifier = new QtProjectFileModifier(document); - modifier.addVariableValue("SOURCES", "main2.cpp"); //$NON-NLS-1$ //$NON-NLS-2$ - - assertEquals( - "SOURCES += main.cpp \\\n" + //$NON-NLS-1$ - " main2.cpp\n" + //$NON-NLS-1$ - "\n" + //$NON-NLS-1$ - "QT = app", //$NON-NLS-1$ - document.get()); - } - - @Test - public void test_AddValue_EmptyDocument() { - IDocument document = new Document("\t \n\n\t\n\n\n\n"); //$NON-NLS-1$ - - QtProjectFileModifier modifier = new QtProjectFileModifier(document); - modifier.addVariableValue("SOURCES", "main.cpp"); //$NON-NLS-1$ //$NON-NLS-2$ - - assertEquals( - "SOURCES += main.cpp\n", //$NON-NLS-1$ - document.get()); - } - - @Test - public void test_AddValue_VariableDoesNotExist() { - IDocument document = new Document("CONFIG += qt debug"); //$NON-NLS-1$ - - QtProjectFileModifier modifier = new QtProjectFileModifier(document); - modifier.addVariableValue("SOURCES", "main.cpp"); //$NON-NLS-1$ //$NON-NLS-2$ - - assertEquals( - "CONFIG += qt debug\n" //$NON-NLS-1$ - + "\n" //$NON-NLS-1$ - + "SOURCES += main.cpp\n", //$NON-NLS-1$ - document.get()); - } - - @Test - public void test_AddValue_VariableDoesNotExist2() { - IDocument document = new Document("CONFIG += qt debug\n"); //$NON-NLS-1$ - - QtProjectFileModifier modifier = new QtProjectFileModifier(document); - modifier.addVariableValue("SOURCES", "main.cpp"); //$NON-NLS-1$ //$NON-NLS-2$ - - assertEquals( - "CONFIG += qt debug\n" //$NON-NLS-1$ - + "\n" //$NON-NLS-1$ - + "SOURCES += main.cpp\n", //$NON-NLS-1$ - document.get()); - } - - @Test - public void test_AddValue_VariableDoesNotExist3() { - IDocument document = new Document("CONFIG += qt debug\n\n"); //$NON-NLS-1$ - - QtProjectFileModifier modifier = new QtProjectFileModifier(document); - modifier.addVariableValue("SOURCES", "main.cpp"); //$NON-NLS-1$ //$NON-NLS-2$ - - assertEquals( - "CONFIG += qt debug\n" //$NON-NLS-1$ - + "\n" //$NON-NLS-1$ - + "\n" //$NON-NLS-1$ - + "SOURCES += main.cpp\n", //$NON-NLS-1$ - document.get()); - } - - @Test - public void test_RemoveThenAddValue() { - IDocument document = new Document( - "SOURCES += main.cpp \\\n" //$NON-NLS-1$ - + " main2.cpp \\\n" //$NON-NLS-1$ - + " main3.cpp\n"); //$NON-NLS-1$ - - QtProjectFileModifier modifier = new QtProjectFileModifier(document); - modifier.removeVariableValue("SOURCES", "main3.cpp"); //$NON-NLS-1$ //$NON-NLS-2$ - modifier.addVariableValue("SOURCES", "main4.cpp"); //$NON-NLS-1$ //$NON-NLS-2$ - - assertEquals( - "SOURCES += main.cpp \\\n" //$NON-NLS-1$ - + " main2.cpp \\\n" //$NON-NLS-1$ - + " main4.cpp\n", //$NON-NLS-1$ - document.get()); - } - - @Test - public void test_RemoveValue_FirstLine() { - IDocument document = new Document( - "SOURCES += main.cpp \\ # Test comment\n" //$NON-NLS-1$ - + " main2.cpp \\ # Test comment2\n" //$NON-NLS-1$ - + " main3.cpp \\ # Test comment3\n" //$NON-NLS-1$ - + " main4.cpp # Test comment4"); //$NON-NLS-1$ - - QtProjectFileModifier modifier = new QtProjectFileModifier(document); - modifier.removeVariableValue("SOURCES", "main.cpp"); //$NON-NLS-1$ //$NON-NLS-2$ - - assertEquals( - "SOURCES += main2.cpp \\ # Test comment2\n" //$NON-NLS-1$ - + " main3.cpp \\ # Test comment3\n" //$NON-NLS-1$ - + " main4.cpp # Test comment4", //$NON-NLS-1$ - document.get()); - } - - @Test - public void test_RemoveValue_MiddleLine() { - IDocument document = new Document( - "SOURCES += main.cpp \\ # Test comment\n" //$NON-NLS-1$ - + " main2.cpp \\ # Test comment2\n" //$NON-NLS-1$ - + " main3.cpp \\ # Test comment3\n" //$NON-NLS-1$ - + " main4.cpp # Test comment4"); //$NON-NLS-1$ - - QtProjectFileModifier modifier = new QtProjectFileModifier(document); - modifier.removeVariableValue("SOURCES", "main2.cpp"); //$NON-NLS-1$ //$NON-NLS-2$ - - assertEquals( - "SOURCES += main.cpp \\ # Test comment\n" //$NON-NLS-1$ - + " main3.cpp \\ # Test comment3\n" //$NON-NLS-1$ - + " main4.cpp # Test comment4", //$NON-NLS-1$ - document.get()); - } -} +/******************************************************************************* + * Copyright (c) 2015 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.qt.pro.parser.tests; + +import org.eclipse.cdt.internal.qt.ui.pro.parser.QtProjectFileModifier; +import org.eclipse.jface.text.Document; +import org.eclipse.jface.text.IDocument; +import org.junit.Test; + +import junit.framework.TestCase; + +public class QtProjectFileModifierTest extends TestCase { + + @Test + public void test_ReplaceValue_SingleValue() { + IDocument document = new Document("SOURCES += main.cpp"); //$NON-NLS-1$ + + QtProjectFileModifier modifier = new QtProjectFileModifier(document); + + assertTrue(modifier.replaceVariableValue("SOURCES", "main.cpp", "main2.cpp")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + assertEquals("SOURCES += main2.cpp", //$NON-NLS-1$ + document.get()); + } + + @Test + public void test_ReplaceValue_HasCommentOnMainLine() { + IDocument document = new Document("SOURCES += main.cpp # This is a comment"); //$NON-NLS-1$ + + QtProjectFileModifier modifier = new QtProjectFileModifier(document); + + assertTrue(modifier.replaceVariableValue("SOURCES", "main.cpp", "main2.cpp")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + assertEquals("SOURCES += main2.cpp # This is a comment", //$NON-NLS-1$ + document.get()); + } + + @Test + public void test_ReplaceValue_HasCommentOnSubsequentLine() { + IDocument document = new Document( + "SOURCES += main.cpp \\ # This is a comment\n" //$NON-NLS-1$ + + " main2.cpp # This is a comment"); //$NON-NLS-1$ + + QtProjectFileModifier modifier = new QtProjectFileModifier(document); + + assertTrue(modifier.replaceVariableValue("SOURCES", "main2.cpp", "main3.cpp")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + assertEquals( + "SOURCES += main.cpp \\ # This is a comment\n" //$NON-NLS-1$ + + " main3.cpp # This is a comment", //$NON-NLS-1$ + document.get()); + } + + @Test + public void test_ReplaceValue_MatchWholeLineFalse() { + IDocument document = new Document("CONFIG = qt debug"); //$NON-NLS-1$ + + QtProjectFileModifier modifier = new QtProjectFileModifier(document); + + assertTrue(modifier.replaceVariableValue("CONFIG", "debug", "console", false)); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + assertEquals( + "CONFIG = qt console", //$NON-NLS-1$ + document.get()); + } + + @Test + public void test_ReplaceValue_DoesNotExist() { + IDocument document = new Document("CONFIG = qt debug"); //$NON-NLS-1$ + + QtProjectFileModifier modifier = new QtProjectFileModifier(document); + + assertFalse(modifier.replaceVariableValue("CONFIG", "console", "debug", false)); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + assertEquals( + "CONFIG = qt debug", //$NON-NLS-1$ + document.get()); + } + + @Test + public void test_ReplaceMultilineValue_MatchWholeLineFalse() { + IDocument document = new Document( + "CONFIG = qt \\\n" //$NON-NLS-1$ + + " debug"); //$NON-NLS-1$ + + QtProjectFileModifier modifier = new QtProjectFileModifier(document); + + assertTrue(modifier.replaceVariableValue("CONFIG", "debug", "console", false)); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + assertEquals( + "CONFIG = qt \\\n" //$NON-NLS-1$ + + " console", //$NON-NLS-1$ + document.get()); + } + + @Test + public void test_ReplaceMultilineValue() { + IDocument document = new Document( + "SOURCES += main.cpp \\\n" //$NON-NLS-1$ + + " main2.cpp"); //$NON-NLS-1$ + + QtProjectFileModifier modifier = new QtProjectFileModifier(document); + + assertTrue(modifier.replaceVariableValue("SOURCES", "main2.cpp", "main3.cpp")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + assertEquals( + "SOURCES += main.cpp \\\n" //$NON-NLS-1$ + + " main3.cpp", //$NON-NLS-1$ + document.get()); + } + + @Test + public void test_ReplaceMultilineValue_HasComment() { + IDocument document = new Document( + "SOURCES += main.cpp \\\n" //$NON-NLS-1$ + + " main2.cpp # This is a comment"); //$NON-NLS-1$ + + QtProjectFileModifier modifier = new QtProjectFileModifier(document); + + assertTrue(modifier.replaceVariableValue("SOURCES", "main2.cpp", "main3.cpp")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + assertEquals( + "SOURCES += main.cpp \\\n" //$NON-NLS-1$ + + " main3.cpp # This is a comment", //$NON-NLS-1$ + document.get()); + } + + @Test + public void test_AddValue() { + IDocument document = new Document("SOURCES += main.cpp"); //$NON-NLS-1$ + + QtProjectFileModifier modifier = new QtProjectFileModifier(document); + modifier.addVariableValue("SOURCES", "main2.cpp"); //$NON-NLS-1$ //$NON-NLS-2$ + + assertEquals( + "SOURCES += main.cpp \\\n" //$NON-NLS-1$ + + " main2.cpp", //$NON-NLS-1$ + document.get()); + } + + @Test + public void test_AddValue_NoIndentation() { + IDocument document = new Document( + "SOURCES += main.cpp \\\n" //$NON-NLS-1$ + + "noindent.cpp"); //$NON-NLS-1$ + + QtProjectFileModifier modifier = new QtProjectFileModifier(document); + modifier.addVariableValue("SOURCES", "main2.cpp"); //$NON-NLS-1$ //$NON-NLS-2$ + + assertEquals( + "SOURCES += main.cpp \\\n" //$NON-NLS-1$ + + "noindent.cpp \\\n" //$NON-NLS-1$ + + "main2.cpp", //$NON-NLS-1$ + document.get()); + } + + @Test + public void test_AddValue_AlreadyExists() { + IDocument document = new Document("SOURCES += main.cpp"); //$NON-NLS-1$ + + QtProjectFileModifier modifier = new QtProjectFileModifier(document); + modifier.addVariableValue("SOURCES", "main.cpp"); //$NON-NLS-1$ //$NON-NLS-2$ + + assertEquals("SOURCES += main.cpp", document.get()); //$NON-NLS-1$ + } + + @Test + public void test_AddValue_HasCommentOnMainLine() { + IDocument document = new Document("SOURCES += main.cpp # This is a comment"); //$NON-NLS-1$ + + QtProjectFileModifier modifier = new QtProjectFileModifier(document); + modifier.addVariableValue("SOURCES", "main2.cpp"); //$NON-NLS-1$ //$NON-NLS-2$ + + assertEquals( + "SOURCES += main.cpp \\ # This is a comment\n" //$NON-NLS-1$ + + " main2.cpp", //$NON-NLS-1$ + document.get()); + } + + @Test + public void test_AddValue_HasCommentOnSubsequentLine() { + IDocument document = new Document( + "SOURCES += main.cpp \\ # This is a comment \n" //$NON-NLS-1$ + + " main2.cpp # this is a comment\n\n"); //$NON-NLS-1$ + + QtProjectFileModifier modifier = new QtProjectFileModifier(document); + modifier.addVariableValue("SOURCES", "main3.cpp"); //$NON-NLS-1$ //$NON-NLS-2$ + + assertEquals( + "SOURCES += main.cpp \\ # This is a comment \n" //$NON-NLS-1$ + + " main2.cpp \\ # this is a comment\n" //$NON-NLS-1$ + + " main3.cpp\n\n", //$NON-NLS-1$ + document.get()); + } + + @Test + public void test_AddValue_CommentIndentation() { + IDocument document = new Document( + "SOURCES += main.cpp \\ # Test comment\n" //$NON-NLS-1$ + + " main2.cpp \\ # Test comment2\n" //$NON-NLS-1$ + + " main3.cpp # Test comment3"); //$NON-NLS-1$ + + QtProjectFileModifier modifier = new QtProjectFileModifier(document); + modifier.addVariableValue("SOURCES", "main4.cpp"); //$NON-NLS-1$ //$NON-NLS-2$ + + assertEquals( + "SOURCES += main.cpp \\ # Test comment\n" //$NON-NLS-1$ + + " main2.cpp \\ # Test comment2\n" //$NON-NLS-1$ + + " main3.cpp \\ # Test comment3\n" //$NON-NLS-1$ + + " main4.cpp", //$NON-NLS-1$ + document.get()); + } + + @Test + public void test_AddValue_MultipleVariables() { + IDocument document = new Document( + "SOURCES += main.cpp\n" //$NON-NLS-1$ + + "\n" //$NON-NLS-1$ + + "QT = app"); //$NON-NLS-1$ + + QtProjectFileModifier modifier = new QtProjectFileModifier(document); + modifier.addVariableValue("SOURCES", "main2.cpp"); //$NON-NLS-1$ //$NON-NLS-2$ + + assertEquals( + "SOURCES += main.cpp \\\n" + //$NON-NLS-1$ + " main2.cpp\n" + //$NON-NLS-1$ + "\n" + //$NON-NLS-1$ + "QT = app", //$NON-NLS-1$ + document.get()); + } + + @Test + public void test_AddValue_EmptyDocument() { + IDocument document = new Document("\t \n\n\t\n\n\n\n"); //$NON-NLS-1$ + + QtProjectFileModifier modifier = new QtProjectFileModifier(document); + modifier.addVariableValue("SOURCES", "main.cpp"); //$NON-NLS-1$ //$NON-NLS-2$ + + assertEquals( + "SOURCES += main.cpp\n", //$NON-NLS-1$ + document.get()); + } + + @Test + public void test_AddValue_VariableDoesNotExist() { + IDocument document = new Document("CONFIG += qt debug"); //$NON-NLS-1$ + + QtProjectFileModifier modifier = new QtProjectFileModifier(document); + modifier.addVariableValue("SOURCES", "main.cpp"); //$NON-NLS-1$ //$NON-NLS-2$ + + assertEquals( + "CONFIG += qt debug\n" //$NON-NLS-1$ + + "\n" //$NON-NLS-1$ + + "SOURCES += main.cpp\n", //$NON-NLS-1$ + document.get()); + } + + @Test + public void test_AddValue_VariableDoesNotExist2() { + IDocument document = new Document("CONFIG += qt debug\n"); //$NON-NLS-1$ + + QtProjectFileModifier modifier = new QtProjectFileModifier(document); + modifier.addVariableValue("SOURCES", "main.cpp"); //$NON-NLS-1$ //$NON-NLS-2$ + + assertEquals( + "CONFIG += qt debug\n" //$NON-NLS-1$ + + "\n" //$NON-NLS-1$ + + "SOURCES += main.cpp\n", //$NON-NLS-1$ + document.get()); + } + + @Test + public void test_AddValue_VariableDoesNotExist3() { + IDocument document = new Document("CONFIG += qt debug\n\n"); //$NON-NLS-1$ + + QtProjectFileModifier modifier = new QtProjectFileModifier(document); + modifier.addVariableValue("SOURCES", "main.cpp"); //$NON-NLS-1$ //$NON-NLS-2$ + + assertEquals( + "CONFIG += qt debug\n" //$NON-NLS-1$ + + "\n" //$NON-NLS-1$ + + "\n" //$NON-NLS-1$ + + "SOURCES += main.cpp\n", //$NON-NLS-1$ + document.get()); + } + + @Test + public void test_RemoveThenAddValue() { + IDocument document = new Document( + "SOURCES += main.cpp \\\n" //$NON-NLS-1$ + + " main2.cpp \\\n" //$NON-NLS-1$ + + " main3.cpp\n"); //$NON-NLS-1$ + + QtProjectFileModifier modifier = new QtProjectFileModifier(document); + modifier.removeVariableValue("SOURCES", "main3.cpp"); //$NON-NLS-1$ //$NON-NLS-2$ + modifier.addVariableValue("SOURCES", "main4.cpp"); //$NON-NLS-1$ //$NON-NLS-2$ + + assertEquals( + "SOURCES += main.cpp \\\n" //$NON-NLS-1$ + + " main2.cpp \\\n" //$NON-NLS-1$ + + " main4.cpp\n", //$NON-NLS-1$ + document.get()); + } + + @Test + public void test_RemoveValue_FirstLine() { + IDocument document = new Document( + "SOURCES += main.cpp \\ # Test comment\n" //$NON-NLS-1$ + + " main2.cpp \\ # Test comment2\n" //$NON-NLS-1$ + + " main3.cpp \\ # Test comment3\n" //$NON-NLS-1$ + + " main4.cpp # Test comment4"); //$NON-NLS-1$ + + QtProjectFileModifier modifier = new QtProjectFileModifier(document); + modifier.removeVariableValue("SOURCES", "main.cpp"); //$NON-NLS-1$ //$NON-NLS-2$ + + assertEquals( + "SOURCES += main2.cpp \\ # Test comment2\n" //$NON-NLS-1$ + + " main3.cpp \\ # Test comment3\n" //$NON-NLS-1$ + + " main4.cpp # Test comment4", //$NON-NLS-1$ + document.get()); + } + + @Test + public void test_RemoveValue_MiddleLine() { + IDocument document = new Document( + "SOURCES += main.cpp \\ # Test comment\n" //$NON-NLS-1$ + + " main2.cpp \\ # Test comment2\n" //$NON-NLS-1$ + + " main3.cpp \\ # Test comment3\n" //$NON-NLS-1$ + + " main4.cpp # Test comment4"); //$NON-NLS-1$ + + QtProjectFileModifier modifier = new QtProjectFileModifier(document); + modifier.removeVariableValue("SOURCES", "main2.cpp"); //$NON-NLS-1$ //$NON-NLS-2$ + + assertEquals( + "SOURCES += main.cpp \\ # Test comment\n" //$NON-NLS-1$ + + " main3.cpp \\ # Test comment3\n" //$NON-NLS-1$ + + " main4.cpp # Test comment4", //$NON-NLS-1$ + document.get()); + } +} diff --git a/qt/org.eclipse.cdt.qt.ui.tests/src/org/eclipse/cdt/qt/pro/parser/tests/QtProjectFileParserTest.java b/qt/org.eclipse.cdt.qt.ui.tests/src/org/eclipse/cdt/qt/pro/parser/tests/QtProjectFileParserTest.java index 0b2bca1b5ee..cf460b8df3c 100644 --- a/qt/org.eclipse.cdt.qt.ui.tests/src/org/eclipse/cdt/qt/pro/parser/tests/QtProjectFileParserTest.java +++ b/qt/org.eclipse.cdt.qt.ui.tests/src/org/eclipse/cdt/qt/pro/parser/tests/QtProjectFileParserTest.java @@ -1,181 +1,181 @@ -/******************************************************************************* - * Copyright (c) 2015 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.qt.pro.parser.tests; - -import java.util.List; - -import org.eclipse.cdt.internal.qt.ui.pro.parser.QtProjectFileParser; -import org.eclipse.cdt.internal.qt.ui.pro.parser.QtProjectVariable; -import org.eclipse.jface.text.Document; -import org.eclipse.jface.text.IDocument; -import org.junit.Test; - -import junit.framework.TestCase; - -public class QtProjectFileParserTest extends TestCase { - - @Test - public void test_AssignmentOperator_Equals() { - IDocument document = new Document("SOURCES = main.cpp"); //$NON-NLS-1$ - QtProjectFileParser parser = new QtProjectFileParser(document); - - List variables = parser.getAllVariables(); - assertFalse("Unable to parse variable", variables.isEmpty()); //$NON-NLS-1$ - assertEquals("Invalid assignment operator", "=", variables.get(0).getAssignmentOperator()); //$NON-NLS-1$ //$NON-NLS-2$ - } - - @Test - public void test_AssignmentOperator_PlusEquals() { - IDocument document = new Document("SOURCES += main.cpp"); //$NON-NLS-1$ - QtProjectFileParser parser = new QtProjectFileParser(document); - - List variables = parser.getAllVariables(); - assertFalse("Unable to parse variable", variables.isEmpty()); //$NON-NLS-1$ - assertEquals("Invalid assignment operator", "+=", variables.get(0).getAssignmentOperator()); //$NON-NLS-1$ //$NON-NLS-2$ - } - - @Test - public void test_AssignmentOperator_MinusEquals() { - IDocument document = new Document("SOURCES -= main.cpp"); //$NON-NLS-1$ - QtProjectFileParser parser = new QtProjectFileParser(document); - - List variables = parser.getAllVariables(); - assertFalse("Unable to parse variable", variables.isEmpty()); //$NON-NLS-1$ - assertEquals("Invalid assignment operator", "-=", variables.get(0).getAssignmentOperator()); //$NON-NLS-1$ //$NON-NLS-2$ - } - - @Test - public void test_AssignmentOperator_AsterixEquals() { - IDocument document = new Document("SOURCES *= main.cpp"); //$NON-NLS-1$ - QtProjectFileParser parser = new QtProjectFileParser(document); - - List variables = parser.getAllVariables(); - assertFalse("Unable to parse variable", variables.isEmpty()); //$NON-NLS-1$ - assertEquals("Invalid assignment operator", "*=", variables.get(0).getAssignmentOperator()); //$NON-NLS-1$ //$NON-NLS-2$ - } - - @Test - public void test_CommentedVariable() { - IDocument document = new Document("# SOURCES += main.cpp"); //$NON-NLS-1$ - QtProjectFileParser parser = new QtProjectFileParser(document); - assertTrue("Found variable even though it was commented", parser.getAllVariables().isEmpty()); //$NON-NLS-1$ - } - - @Test - public void test_CommentedVariable2() { - IDocument document = new Document("SOURCES # += main.cpp"); //$NON-NLS-1$ - QtProjectFileParser parser = new QtProjectFileParser(document); - assertTrue("Found variable even though it was commented", parser.getAllVariables().isEmpty()); //$NON-NLS-1$ - } - - @Test - public void test_MalformedVariable() { - IDocument document = new Document("MY VARIABLE # += main.cpp"); //$NON-NLS-1$ - QtProjectFileParser parser = new QtProjectFileParser(document); - assertTrue("Found variable even though it was malformed", parser.getAllVariables().isEmpty()); //$NON-NLS-1$ - } - - @Test - public void test_MalformedVariable2() { - IDocument document = new Document("\\SOURCES # += main.cpp"); //$NON-NLS-1$ - QtProjectFileParser parser = new QtProjectFileParser(document); - assertTrue("Found variable even though it was malformed", parser.getAllVariables().isEmpty()); //$NON-NLS-1$ - } - - @Test - public void test_FullyQualifiedName() { - IDocument document = new Document("fully.qualified.Name += main.cpp"); //$NON-NLS-1$ - QtProjectFileParser parser = new QtProjectFileParser(document); - - QtProjectVariable sources = parser.getVariable("fully.qualified.Name"); //$NON-NLS-1$ - assertNotNull("Unable to parse variable", sources); //$NON-NLS-1$ - } - - @Test - public void test_SingleLineVariable() { - IDocument document = new Document("SOURCES += main.cpp"); //$NON-NLS-1$ - QtProjectFileParser parser = new QtProjectFileParser(document); - - QtProjectVariable sources = parser.getVariable("SOURCES"); //$NON-NLS-1$ - assertNotNull("Unable to parse variable", sources); //$NON-NLS-1$ - assertTrue("Unable to parse \"main.cpp\" from SOURCES variable", sources.getValueIndex("main.cpp") == 0); //$NON-NLS-1$ //$NON-NLS-2$ - } - - @Test - public void test_SingleLineVariable_MultipleValues() { - IDocument document = new Document("CONFIG += qt debug"); //$NON-NLS-1$ - QtProjectFileParser parser = new QtProjectFileParser(document); - - QtProjectVariable sources = parser.getVariable("CONFIG"); //$NON-NLS-1$ - assertNotNull("Unable to parse variable", sources); //$NON-NLS-1$ - assertTrue("Unable to parse \"qt debug\" from SOURCES variable", sources.getValueIndex("qt debug") == 0); //$NON-NLS-1$ //$NON-NLS-2$ - } - - @Test - public void test_VariableWithComment() { - IDocument document = new Document("SOURCES += main.cpp # this is a comment\n"); //$NON-NLS-1$ - QtProjectFileParser parser = new QtProjectFileParser(document); - - QtProjectVariable sources = parser.getVariable("SOURCES"); //$NON-NLS-1$ - assertNotNull("Unable to parse variable", sources); //$NON-NLS-1$ - assertEquals("Unable to parse assignment from SOURCES variable", "+=", sources.getAssignmentOperator()); //$NON-NLS-1$ //$NON-NLS-2$ - assertTrue("Unable to parse \"main.cpp\" from SOURCES variable", sources.getValueIndex("main.cpp") == 0); //$NON-NLS-1$ //$NON-NLS-2$ - } - - @Test - public void test_MultilineVariable() { - IDocument document = new Document("SOURCES += main.cpp \\\n main2.cpp"); //$NON-NLS-1$ - QtProjectFileParser parser = new QtProjectFileParser(document); - - QtProjectVariable sources = parser.getVariable("SOURCES"); //$NON-NLS-1$ - assertNotNull("Unable to parse variable", sources); //$NON-NLS-1$ - assertEquals("Incorrect number of lines", sources.getNumberOfLines(), 2); //$NON-NLS-1$ - assertTrue("Unable to parse \"main.cpp\" from SOURCES variable", sources.getValueIndex("main.cpp") == 0); //$NON-NLS-1$ //$NON-NLS-2$ - assertTrue("Unable to parse \"main2.cpp\" from SOURCES variable", sources.getValueIndex("main2.cpp") == 1); //$NON-NLS-1$ //$NON-NLS-2$ - } - - @Test - public void test_MultilineVariable2() { - IDocument document = new Document("SOURCES += main.cpp \\\n main2.cpp \\\n main3.cpp"); //$NON-NLS-1$ - QtProjectFileParser parser = new QtProjectFileParser(document); - - QtProjectVariable sources = parser.getVariable("SOURCES"); //$NON-NLS-1$ - assertNotNull("Unable to parse variable", sources); //$NON-NLS-1$ - assertEquals("Incorrect number of lines", 3, sources.getNumberOfLines()); //$NON-NLS-1$ - assertTrue("Unable to parse \"main.cpp\" from SOURCES variable", sources.getValueIndex("main.cpp") == 0); //$NON-NLS-1$ //$NON-NLS-2$ - assertTrue("Unable to parse \"main2.cpp\" from SOURCES variable", sources.getValueIndex("main2.cpp") == 1); //$NON-NLS-1$ //$NON-NLS-2$ - assertTrue("Unable to parse \"main3.cpp\" from SOURCES variable", sources.getValueIndex("main3.cpp") == 2); //$NON-NLS-1$ //$NON-NLS-2$ - } - - @Test - public void test_MalformedMultilineVariable() { - IDocument document = new Document("SOURCES += main.cpp \\\n main2.cpp \\"); //$NON-NLS-1$ - QtProjectFileParser parser = new QtProjectFileParser(document); - - QtProjectVariable sources = parser.getVariable("SOURCES"); //$NON-NLS-1$ - assertNotNull("Unable to parse variable", sources); //$NON-NLS-1$ - assertEquals("Incorrect number of lines", 2, sources.getNumberOfLines()); //$NON-NLS-1$ - assertTrue("Unable to parse \"main.cpp\" from SOURCES variable", sources.getValueIndex("main.cpp") == 0); //$NON-NLS-1$ //$NON-NLS-2$ - assertTrue("Unable to parse \"main2.cpp\" from SOURCES variable", sources.getValueIndex("main2.cpp") == 1); //$NON-NLS-1$ //$NON-NLS-2$ - } - - @Test - public void test_MultilineVariable_WithComment() { - IDocument document = new Document("SOURCES += main.cpp \\ # this is a comment \n main2.cpp # this is a comment "); //$NON-NLS-1$ - QtProjectFileParser parser = new QtProjectFileParser(document); - - QtProjectVariable sources = parser.getVariable("SOURCES"); //$NON-NLS-1$ - assertNotNull("Unable to parse variable", sources); //$NON-NLS-1$ - assertEquals("Incorrect number of lines", 2, sources.getNumberOfLines()); //$NON-NLS-1$ - assertTrue("Unable to parse \"main.cpp\" from SOURCES variable", sources.getValueIndex("main.cpp") == 0); //$NON-NLS-1$ //$NON-NLS-2$ - assertTrue("Unable to parse \"main2.cpp\" from SOURCES variable", sources.getValueIndex("main2.cpp") == 1); //$NON-NLS-1$ //$NON-NLS-2$ - } -} +/******************************************************************************* + * Copyright (c) 2015 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.qt.pro.parser.tests; + +import java.util.List; + +import org.eclipse.cdt.internal.qt.ui.pro.parser.QtProjectFileParser; +import org.eclipse.cdt.internal.qt.ui.pro.parser.QtProjectVariable; +import org.eclipse.jface.text.Document; +import org.eclipse.jface.text.IDocument; +import org.junit.Test; + +import junit.framework.TestCase; + +public class QtProjectFileParserTest extends TestCase { + + @Test + public void test_AssignmentOperator_Equals() { + IDocument document = new Document("SOURCES = main.cpp"); //$NON-NLS-1$ + QtProjectFileParser parser = new QtProjectFileParser(document); + + List variables = parser.getAllVariables(); + assertFalse("Unable to parse variable", variables.isEmpty()); //$NON-NLS-1$ + assertEquals("Invalid assignment operator", "=", variables.get(0).getAssignmentOperator()); //$NON-NLS-1$ //$NON-NLS-2$ + } + + @Test + public void test_AssignmentOperator_PlusEquals() { + IDocument document = new Document("SOURCES += main.cpp"); //$NON-NLS-1$ + QtProjectFileParser parser = new QtProjectFileParser(document); + + List variables = parser.getAllVariables(); + assertFalse("Unable to parse variable", variables.isEmpty()); //$NON-NLS-1$ + assertEquals("Invalid assignment operator", "+=", variables.get(0).getAssignmentOperator()); //$NON-NLS-1$ //$NON-NLS-2$ + } + + @Test + public void test_AssignmentOperator_MinusEquals() { + IDocument document = new Document("SOURCES -= main.cpp"); //$NON-NLS-1$ + QtProjectFileParser parser = new QtProjectFileParser(document); + + List variables = parser.getAllVariables(); + assertFalse("Unable to parse variable", variables.isEmpty()); //$NON-NLS-1$ + assertEquals("Invalid assignment operator", "-=", variables.get(0).getAssignmentOperator()); //$NON-NLS-1$ //$NON-NLS-2$ + } + + @Test + public void test_AssignmentOperator_AsterixEquals() { + IDocument document = new Document("SOURCES *= main.cpp"); //$NON-NLS-1$ + QtProjectFileParser parser = new QtProjectFileParser(document); + + List variables = parser.getAllVariables(); + assertFalse("Unable to parse variable", variables.isEmpty()); //$NON-NLS-1$ + assertEquals("Invalid assignment operator", "*=", variables.get(0).getAssignmentOperator()); //$NON-NLS-1$ //$NON-NLS-2$ + } + + @Test + public void test_CommentedVariable() { + IDocument document = new Document("# SOURCES += main.cpp"); //$NON-NLS-1$ + QtProjectFileParser parser = new QtProjectFileParser(document); + assertTrue("Found variable even though it was commented", parser.getAllVariables().isEmpty()); //$NON-NLS-1$ + } + + @Test + public void test_CommentedVariable2() { + IDocument document = new Document("SOURCES # += main.cpp"); //$NON-NLS-1$ + QtProjectFileParser parser = new QtProjectFileParser(document); + assertTrue("Found variable even though it was commented", parser.getAllVariables().isEmpty()); //$NON-NLS-1$ + } + + @Test + public void test_MalformedVariable() { + IDocument document = new Document("MY VARIABLE # += main.cpp"); //$NON-NLS-1$ + QtProjectFileParser parser = new QtProjectFileParser(document); + assertTrue("Found variable even though it was malformed", parser.getAllVariables().isEmpty()); //$NON-NLS-1$ + } + + @Test + public void test_MalformedVariable2() { + IDocument document = new Document("\\SOURCES # += main.cpp"); //$NON-NLS-1$ + QtProjectFileParser parser = new QtProjectFileParser(document); + assertTrue("Found variable even though it was malformed", parser.getAllVariables().isEmpty()); //$NON-NLS-1$ + } + + @Test + public void test_FullyQualifiedName() { + IDocument document = new Document("fully.qualified.Name += main.cpp"); //$NON-NLS-1$ + QtProjectFileParser parser = new QtProjectFileParser(document); + + QtProjectVariable sources = parser.getVariable("fully.qualified.Name"); //$NON-NLS-1$ + assertNotNull("Unable to parse variable", sources); //$NON-NLS-1$ + } + + @Test + public void test_SingleLineVariable() { + IDocument document = new Document("SOURCES += main.cpp"); //$NON-NLS-1$ + QtProjectFileParser parser = new QtProjectFileParser(document); + + QtProjectVariable sources = parser.getVariable("SOURCES"); //$NON-NLS-1$ + assertNotNull("Unable to parse variable", sources); //$NON-NLS-1$ + assertTrue("Unable to parse \"main.cpp\" from SOURCES variable", sources.getValueIndex("main.cpp") == 0); //$NON-NLS-1$ //$NON-NLS-2$ + } + + @Test + public void test_SingleLineVariable_MultipleValues() { + IDocument document = new Document("CONFIG += qt debug"); //$NON-NLS-1$ + QtProjectFileParser parser = new QtProjectFileParser(document); + + QtProjectVariable sources = parser.getVariable("CONFIG"); //$NON-NLS-1$ + assertNotNull("Unable to parse variable", sources); //$NON-NLS-1$ + assertTrue("Unable to parse \"qt debug\" from SOURCES variable", sources.getValueIndex("qt debug") == 0); //$NON-NLS-1$ //$NON-NLS-2$ + } + + @Test + public void test_VariableWithComment() { + IDocument document = new Document("SOURCES += main.cpp # this is a comment\n"); //$NON-NLS-1$ + QtProjectFileParser parser = new QtProjectFileParser(document); + + QtProjectVariable sources = parser.getVariable("SOURCES"); //$NON-NLS-1$ + assertNotNull("Unable to parse variable", sources); //$NON-NLS-1$ + assertEquals("Unable to parse assignment from SOURCES variable", "+=", sources.getAssignmentOperator()); //$NON-NLS-1$ //$NON-NLS-2$ + assertTrue("Unable to parse \"main.cpp\" from SOURCES variable", sources.getValueIndex("main.cpp") == 0); //$NON-NLS-1$ //$NON-NLS-2$ + } + + @Test + public void test_MultilineVariable() { + IDocument document = new Document("SOURCES += main.cpp \\\n main2.cpp"); //$NON-NLS-1$ + QtProjectFileParser parser = new QtProjectFileParser(document); + + QtProjectVariable sources = parser.getVariable("SOURCES"); //$NON-NLS-1$ + assertNotNull("Unable to parse variable", sources); //$NON-NLS-1$ + assertEquals("Incorrect number of lines", sources.getNumberOfLines(), 2); //$NON-NLS-1$ + assertTrue("Unable to parse \"main.cpp\" from SOURCES variable", sources.getValueIndex("main.cpp") == 0); //$NON-NLS-1$ //$NON-NLS-2$ + assertTrue("Unable to parse \"main2.cpp\" from SOURCES variable", sources.getValueIndex("main2.cpp") == 1); //$NON-NLS-1$ //$NON-NLS-2$ + } + + @Test + public void test_MultilineVariable2() { + IDocument document = new Document("SOURCES += main.cpp \\\n main2.cpp \\\n main3.cpp"); //$NON-NLS-1$ + QtProjectFileParser parser = new QtProjectFileParser(document); + + QtProjectVariable sources = parser.getVariable("SOURCES"); //$NON-NLS-1$ + assertNotNull("Unable to parse variable", sources); //$NON-NLS-1$ + assertEquals("Incorrect number of lines", 3, sources.getNumberOfLines()); //$NON-NLS-1$ + assertTrue("Unable to parse \"main.cpp\" from SOURCES variable", sources.getValueIndex("main.cpp") == 0); //$NON-NLS-1$ //$NON-NLS-2$ + assertTrue("Unable to parse \"main2.cpp\" from SOURCES variable", sources.getValueIndex("main2.cpp") == 1); //$NON-NLS-1$ //$NON-NLS-2$ + assertTrue("Unable to parse \"main3.cpp\" from SOURCES variable", sources.getValueIndex("main3.cpp") == 2); //$NON-NLS-1$ //$NON-NLS-2$ + } + + @Test + public void test_MalformedMultilineVariable() { + IDocument document = new Document("SOURCES += main.cpp \\\n main2.cpp \\"); //$NON-NLS-1$ + QtProjectFileParser parser = new QtProjectFileParser(document); + + QtProjectVariable sources = parser.getVariable("SOURCES"); //$NON-NLS-1$ + assertNotNull("Unable to parse variable", sources); //$NON-NLS-1$ + assertEquals("Incorrect number of lines", 2, sources.getNumberOfLines()); //$NON-NLS-1$ + assertTrue("Unable to parse \"main.cpp\" from SOURCES variable", sources.getValueIndex("main.cpp") == 0); //$NON-NLS-1$ //$NON-NLS-2$ + assertTrue("Unable to parse \"main2.cpp\" from SOURCES variable", sources.getValueIndex("main2.cpp") == 1); //$NON-NLS-1$ //$NON-NLS-2$ + } + + @Test + public void test_MultilineVariable_WithComment() { + IDocument document = new Document("SOURCES += main.cpp \\ # this is a comment \n main2.cpp # this is a comment "); //$NON-NLS-1$ + QtProjectFileParser parser = new QtProjectFileParser(document); + + QtProjectVariable sources = parser.getVariable("SOURCES"); //$NON-NLS-1$ + assertNotNull("Unable to parse variable", sources); //$NON-NLS-1$ + assertEquals("Incorrect number of lines", 2, sources.getNumberOfLines()); //$NON-NLS-1$ + assertTrue("Unable to parse \"main.cpp\" from SOURCES variable", sources.getValueIndex("main.cpp") == 0); //$NON-NLS-1$ //$NON-NLS-2$ + assertTrue("Unable to parse \"main2.cpp\" from SOURCES variable", sources.getValueIndex("main2.cpp") == 1); //$NON-NLS-1$ //$NON-NLS-2$ + } +} diff --git a/qt/org.eclipse.cdt.qt.ui/src/org/eclipse/cdt/internal/qt/ui/editor/IQMLPartitions.java b/qt/org.eclipse.cdt.qt.ui/src/org/eclipse/cdt/internal/qt/ui/editor/IQMLPartitions.java index 38f5b975a2a..9d356abb3c0 100644 --- a/qt/org.eclipse.cdt.qt.ui/src/org/eclipse/cdt/internal/qt/ui/editor/IQMLPartitions.java +++ b/qt/org.eclipse.cdt.qt.ui/src/org/eclipse/cdt/internal/qt/ui/editor/IQMLPartitions.java @@ -1,27 +1,27 @@ -/******************************************************************************* - * Copyright (c) 2015 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.internal.qt.ui.editor; - -/** - * Constants for the various partitions created by {@link QMLPartitionScanner}. - */ -public interface IQMLPartitions { - final String QML_PARTITIONING = "___qml_partitioning"; //$NON-NLS-1$ - final String QML_SINGLE_LINE_COMMENT = "__qml_single_comment"; //$NON-NLS-1$ - final String QML_MULTI_LINE_COMMENT = "__qml_multiline_comment"; //$NON-NLS-1$ - final String QML_STRING = "__qml_string"; //$NON-NLS-1$ - - final String[] ALL_QMLPARTITIONS = { - IQMLPartitions.QML_SINGLE_LINE_COMMENT, - IQMLPartitions.QML_MULTI_LINE_COMMENT, - IQMLPartitions.QML_STRING - }; -} +/******************************************************************************* + * Copyright (c) 2015 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.internal.qt.ui.editor; + +/** + * Constants for the various partitions created by {@link QMLPartitionScanner}. + */ +public interface IQMLPartitions { + final String QML_PARTITIONING = "___qml_partitioning"; //$NON-NLS-1$ + final String QML_SINGLE_LINE_COMMENT = "__qml_single_comment"; //$NON-NLS-1$ + final String QML_MULTI_LINE_COMMENT = "__qml_multiline_comment"; //$NON-NLS-1$ + final String QML_STRING = "__qml_string"; //$NON-NLS-1$ + + final String[] ALL_QMLPARTITIONS = { + IQMLPartitions.QML_SINGLE_LINE_COMMENT, + IQMLPartitions.QML_MULTI_LINE_COMMENT, + IQMLPartitions.QML_STRING + }; +} diff --git a/qt/org.eclipse.cdt.qt.ui/src/org/eclipse/cdt/internal/qt/ui/editor/QMLDocumentSetupParticipant.java b/qt/org.eclipse.cdt.qt.ui/src/org/eclipse/cdt/internal/qt/ui/editor/QMLDocumentSetupParticipant.java index b63b62f6a3c..737d549df54 100644 --- a/qt/org.eclipse.cdt.qt.ui/src/org/eclipse/cdt/internal/qt/ui/editor/QMLDocumentSetupParticipant.java +++ b/qt/org.eclipse.cdt.qt.ui/src/org/eclipse/cdt/internal/qt/ui/editor/QMLDocumentSetupParticipant.java @@ -1,32 +1,32 @@ -/******************************************************************************* - * Copyright (c) 2015 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.internal.qt.ui.editor; - -import org.eclipse.core.filebuffers.IDocumentSetupParticipant; -import org.eclipse.jface.text.IDocument; -import org.eclipse.jface.text.IDocumentExtension3; -import org.eclipse.jface.text.IDocumentPartitioner; -import org.eclipse.jface.text.rules.FastPartitioner; - -public class QMLDocumentSetupParticipant implements IDocumentSetupParticipant, IQMLPartitions { - - @Override - public void setup(IDocument document) { - IDocumentPartitioner partitioner = new FastPartitioner(new QMLPartitionScanner(), IQMLPartitions.ALL_QMLPARTITIONS); - if (document instanceof IDocumentExtension3) { - IDocumentExtension3 ext = (IDocumentExtension3) document; - ext.setDocumentPartitioner(IQMLPartitions.QML_PARTITIONING, partitioner); - } else { - document.setDocumentPartitioner(partitioner); - } - partitioner.connect(document); - } -} +/******************************************************************************* + * Copyright (c) 2015 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.internal.qt.ui.editor; + +import org.eclipse.core.filebuffers.IDocumentSetupParticipant; +import org.eclipse.jface.text.IDocument; +import org.eclipse.jface.text.IDocumentExtension3; +import org.eclipse.jface.text.IDocumentPartitioner; +import org.eclipse.jface.text.rules.FastPartitioner; + +public class QMLDocumentSetupParticipant implements IDocumentSetupParticipant, IQMLPartitions { + + @Override + public void setup(IDocument document) { + IDocumentPartitioner partitioner = new FastPartitioner(new QMLPartitionScanner(), IQMLPartitions.ALL_QMLPARTITIONS); + if (document instanceof IDocumentExtension3) { + IDocumentExtension3 ext = (IDocumentExtension3) document; + ext.setDocumentPartitioner(IQMLPartitions.QML_PARTITIONING, partitioner); + } else { + document.setDocumentPartitioner(partitioner); + } + partitioner.connect(document); + } +} diff --git a/qt/org.eclipse.cdt.qt.ui/src/org/eclipse/cdt/internal/qt/ui/editor/QMLEditor.java b/qt/org.eclipse.cdt.qt.ui/src/org/eclipse/cdt/internal/qt/ui/editor/QMLEditor.java index e327f9733da..d21e7cf911f 100644 --- a/qt/org.eclipse.cdt.qt.ui/src/org/eclipse/cdt/internal/qt/ui/editor/QMLEditor.java +++ b/qt/org.eclipse.cdt.qt.ui/src/org/eclipse/cdt/internal/qt/ui/editor/QMLEditor.java @@ -1,163 +1,163 @@ -/******************************************************************************* - * Copyright (c) 2015 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.internal.qt.ui.editor; - -import java.io.File; - -import javax.script.ScriptException; - -import org.eclipse.cdt.internal.qt.ui.Activator; -import org.eclipse.cdt.internal.qt.ui.actions.OpenDeclarationsAction; -import org.eclipse.cdt.qt.core.IQMLAnalyzer; -import org.eclipse.cdt.ui.CUIPlugin; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.jface.action.IAction; -import org.eclipse.jface.preference.IPreferenceStore; -import org.eclipse.jface.text.BadLocationException; -import org.eclipse.jface.text.IDocument; -import org.eclipse.jface.text.IDocumentExtension3; -import org.eclipse.jface.text.IRegion; -import org.eclipse.jface.text.Region; -import org.eclipse.jface.text.source.DefaultCharacterPairMatcher; -import org.eclipse.jface.text.source.ICharacterPairMatcher; -import org.eclipse.jface.util.PropertyChangeEvent; -import org.eclipse.ui.IFileEditorInput; -import org.eclipse.ui.editors.text.EditorsUI; -import org.eclipse.ui.editors.text.TextEditor; -import org.eclipse.ui.texteditor.ChainedPreferenceStore; -import org.eclipse.ui.texteditor.SourceViewerDecorationSupport; - -/** - * Basic editor for QML. Thus far has only syntax highlighting capabilities. - */ -public class QMLEditor extends TextEditor { - public static final String EDITOR_ID = "org.eclipse.cdt.qt.ui.QMLEditor"; //$NON-NLS-1$ - - public static final String BRACKET_MATCHING_COLOR_PREFERENCE = "org.eclipse.cdt.qt.ui.qmlMatchingBracketsColor"; //$NON-NLS-1$ - private static final String BRACKET_MATCHING_PREFERENCE = "org.eclipse.cdt.qt.ui.qmlMatchingBrackets"; //$NON-NLS-1$ - private static final char[] BRACKETS = { '{', '}', '(', ')', '[', ']' }; - - private final IQMLAnalyzer analyzer = Activator.getService(IQMLAnalyzer.class); - - @Override - protected void initializeEditor() { - super.initializeEditor(); - IPreferenceStore prefStore = new ChainedPreferenceStore(new IPreferenceStore[] { - Activator.getDefault().getPreferenceStore(), - CUIPlugin.getDefault().getPreferenceStore(), - CUIPlugin.getDefault().getCorePreferenceStore(), - EditorsUI.getPreferenceStore() - }); - setPreferenceStore(prefStore); - setSourceViewerConfiguration(new QMLSourceViewerConfiguration(this, prefStore)); - } - - @Override - protected void handlePreferenceStoreChanged(PropertyChangeEvent event) { - ((QMLSourceViewerConfiguration) getSourceViewerConfiguration()).handlePreferenceStoreChanged(event); - super.handlePreferenceStoreChanged(event); - } - - @Override - protected boolean affectsTextPresentation(PropertyChangeEvent event) { - if (((QMLSourceViewerConfiguration) getSourceViewerConfiguration()).affectsTextPresentation(event)) { - return true; - } else { - return super.affectsTextPresentation(event); - } - } - - @Override - public void doSave(IProgressMonitor progressMonitor) { - IFileEditorInput fileInput = (IFileEditorInput) getEditorInput(); - String fileName = new File(fileInput.getFile().getLocationURI()).getAbsolutePath(); - IDocument document = getSourceViewer().getDocument(); - - try { - analyzer.deleteFile(fileName); - analyzer.addFile(fileName, document.get()); - } catch (NoSuchMethodException e) { - Activator.log(e); - } catch (ScriptException e) { - Activator.log(e); - } - super.doSave(progressMonitor); - } - - @Override - protected void configureSourceViewerDecorationSupport(SourceViewerDecorationSupport support) { - super.configureSourceViewerDecorationSupport(support); - - // Setup bracket matching with default color being gray - ICharacterPairMatcher matcher = new DefaultCharacterPairMatcher(BRACKETS, - IDocumentExtension3.DEFAULT_PARTITIONING); - support.setCharacterPairMatcher(matcher); - support.setMatchingCharacterPainterPreferenceKeys(BRACKET_MATCHING_PREFERENCE, - BRACKET_MATCHING_COLOR_PREFERENCE); - - IPreferenceStore store = Activator.getDefault().getPreferenceStore(); - store.setDefault(BRACKET_MATCHING_PREFERENCE, true); - store.setDefault(BRACKET_MATCHING_COLOR_PREFERENCE, "155,155,155"); //$NON-NLS-1$ - } - - @Override - protected void createActions() { - super.createActions(); - - IAction action = new OpenDeclarationsAction(); - action.setActionDefinitionId(IQMLEditorActionDefinitionIds.OPEN_DECLARATION); - setAction(OpenDeclarationsAction.ID, action); - } - - public static IRegion findWord(IDocument document, int offset) { - int start = -2; - int end = -1; - - try { - int pos = offset; - char c; - - while (--pos >= 0) { - c = document.getChar(pos); - if (!Character.isJavaIdentifierPart(c)) { - break; - } - } - - start = pos; - - pos = offset; - int length = document.getLength(); - - while (pos < length) { - c = document.getChar(pos); - if (!Character.isJavaIdentifierPart(c)) - break; - ++pos; - } - - end = pos; - } catch (BadLocationException x) { - } - - if (start >= -1 && end > -1) { - if (start == offset && end == offset) - return new Region(offset, 0); - else if (start == offset) - return new Region(start, end - start); - else - return new Region(start + 1, end - start - 1); - } - - return null; - } - -} +/******************************************************************************* + * Copyright (c) 2015 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.internal.qt.ui.editor; + +import java.io.File; + +import javax.script.ScriptException; + +import org.eclipse.cdt.internal.qt.ui.Activator; +import org.eclipse.cdt.internal.qt.ui.actions.OpenDeclarationsAction; +import org.eclipse.cdt.qt.core.IQMLAnalyzer; +import org.eclipse.cdt.ui.CUIPlugin; +import org.eclipse.core.runtime.IProgressMonitor; +import org.eclipse.jface.action.IAction; +import org.eclipse.jface.preference.IPreferenceStore; +import org.eclipse.jface.text.BadLocationException; +import org.eclipse.jface.text.IDocument; +import org.eclipse.jface.text.IDocumentExtension3; +import org.eclipse.jface.text.IRegion; +import org.eclipse.jface.text.Region; +import org.eclipse.jface.text.source.DefaultCharacterPairMatcher; +import org.eclipse.jface.text.source.ICharacterPairMatcher; +import org.eclipse.jface.util.PropertyChangeEvent; +import org.eclipse.ui.IFileEditorInput; +import org.eclipse.ui.editors.text.EditorsUI; +import org.eclipse.ui.editors.text.TextEditor; +import org.eclipse.ui.texteditor.ChainedPreferenceStore; +import org.eclipse.ui.texteditor.SourceViewerDecorationSupport; + +/** + * Basic editor for QML. Thus far has only syntax highlighting capabilities. + */ +public class QMLEditor extends TextEditor { + public static final String EDITOR_ID = "org.eclipse.cdt.qt.ui.QMLEditor"; //$NON-NLS-1$ + + public static final String BRACKET_MATCHING_COLOR_PREFERENCE = "org.eclipse.cdt.qt.ui.qmlMatchingBracketsColor"; //$NON-NLS-1$ + private static final String BRACKET_MATCHING_PREFERENCE = "org.eclipse.cdt.qt.ui.qmlMatchingBrackets"; //$NON-NLS-1$ + private static final char[] BRACKETS = { '{', '}', '(', ')', '[', ']' }; + + private final IQMLAnalyzer analyzer = Activator.getService(IQMLAnalyzer.class); + + @Override + protected void initializeEditor() { + super.initializeEditor(); + IPreferenceStore prefStore = new ChainedPreferenceStore(new IPreferenceStore[] { + Activator.getDefault().getPreferenceStore(), + CUIPlugin.getDefault().getPreferenceStore(), + CUIPlugin.getDefault().getCorePreferenceStore(), + EditorsUI.getPreferenceStore() + }); + setPreferenceStore(prefStore); + setSourceViewerConfiguration(new QMLSourceViewerConfiguration(this, prefStore)); + } + + @Override + protected void handlePreferenceStoreChanged(PropertyChangeEvent event) { + ((QMLSourceViewerConfiguration) getSourceViewerConfiguration()).handlePreferenceStoreChanged(event); + super.handlePreferenceStoreChanged(event); + } + + @Override + protected boolean affectsTextPresentation(PropertyChangeEvent event) { + if (((QMLSourceViewerConfiguration) getSourceViewerConfiguration()).affectsTextPresentation(event)) { + return true; + } else { + return super.affectsTextPresentation(event); + } + } + + @Override + public void doSave(IProgressMonitor progressMonitor) { + IFileEditorInput fileInput = (IFileEditorInput) getEditorInput(); + String fileName = new File(fileInput.getFile().getLocationURI()).getAbsolutePath(); + IDocument document = getSourceViewer().getDocument(); + + try { + analyzer.deleteFile(fileName); + analyzer.addFile(fileName, document.get()); + } catch (NoSuchMethodException e) { + Activator.log(e); + } catch (ScriptException e) { + Activator.log(e); + } + super.doSave(progressMonitor); + } + + @Override + protected void configureSourceViewerDecorationSupport(SourceViewerDecorationSupport support) { + super.configureSourceViewerDecorationSupport(support); + + // Setup bracket matching with default color being gray + ICharacterPairMatcher matcher = new DefaultCharacterPairMatcher(BRACKETS, + IDocumentExtension3.DEFAULT_PARTITIONING); + support.setCharacterPairMatcher(matcher); + support.setMatchingCharacterPainterPreferenceKeys(BRACKET_MATCHING_PREFERENCE, + BRACKET_MATCHING_COLOR_PREFERENCE); + + IPreferenceStore store = Activator.getDefault().getPreferenceStore(); + store.setDefault(BRACKET_MATCHING_PREFERENCE, true); + store.setDefault(BRACKET_MATCHING_COLOR_PREFERENCE, "155,155,155"); //$NON-NLS-1$ + } + + @Override + protected void createActions() { + super.createActions(); + + IAction action = new OpenDeclarationsAction(); + action.setActionDefinitionId(IQMLEditorActionDefinitionIds.OPEN_DECLARATION); + setAction(OpenDeclarationsAction.ID, action); + } + + public static IRegion findWord(IDocument document, int offset) { + int start = -2; + int end = -1; + + try { + int pos = offset; + char c; + + while (--pos >= 0) { + c = document.getChar(pos); + if (!Character.isJavaIdentifierPart(c)) { + break; + } + } + + start = pos; + + pos = offset; + int length = document.getLength(); + + while (pos < length) { + c = document.getChar(pos); + if (!Character.isJavaIdentifierPart(c)) + break; + ++pos; + } + + end = pos; + } catch (BadLocationException x) { + } + + if (start >= -1 && end > -1) { + if (start == offset && end == offset) + return new Region(offset, 0); + else if (start == offset) + return new Region(start, end - start); + else + return new Region(start + 1, end - start - 1); + } + + return null; + } + +} diff --git a/qt/org.eclipse.cdt.qt.ui/src/org/eclipse/cdt/internal/qt/ui/editor/QMLKeywords.java b/qt/org.eclipse.cdt.qt.ui/src/org/eclipse/cdt/internal/qt/ui/editor/QMLKeywords.java index 6e56891803c..b04c7669764 100644 --- a/qt/org.eclipse.cdt.qt.ui/src/org/eclipse/cdt/internal/qt/ui/editor/QMLKeywords.java +++ b/qt/org.eclipse.cdt.qt.ui/src/org/eclipse/cdt/internal/qt/ui/editor/QMLKeywords.java @@ -1,119 +1,119 @@ -/******************************************************************************* - * Copyright (c) 2015 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.internal.qt.ui.editor; - -/** - * Constants for the various keywords used by QML and ECMA Script - */ -public class QMLKeywords { - // QML reserved words - public static final String IMPORT = "import"; //$NON-NLS-1$ - public static final String CONST = "const"; //$NON-NLS-1$ - public static final String PROPERTY = "property"; //$NON-NLS-1$ - public static final String READONLY = "readonly"; //$NON-NLS-1$ - public static final String SIGNAL = "signal"; //$NON-NLS-1$ - public static final String AS = "as"; //$NON-NLS-1$ - public static final String ON = "on"; //$NON-NLS-1$ - public static final String TRUE = "true"; //$NON-NLS-1$ - public static final String FALSE = "false"; //$NON-NLS-1$ - - // QML future reserved words - public static final String TRANSIENT = "transient"; //$NON-NLS-1$ - public static final String SYNCHRONIZED = "synchronized"; //$NON-NLS-1$ - public static final String ABSTRACT = "abstract"; //$NON-NLS-1$ - public static final String VOLATILE = "volatile"; //$NON-NLS-1$ - public static final String NATIVE = "native"; //$NON-NLS-1$ - public static final String GOTO = "goto"; //$NON-NLS-1$ - public static final String BYTE = "byte"; //$NON-NLS-1$ - public static final String LONG = "long"; //$NON-NLS-1$ - public static final String CHAR = "char"; //$NON-NLS-1$ - public static final String SHORT = "short"; //$NON-NLS-1$ - public static final String FLOAT = "float"; //$NON-NLS-1$ - - // QML basic types - public static final String BOOLEAN = "boolean"; //$NON-NLS-1$ - public static final String DOUBLE = "double"; //$NON-NLS-1$ - public static final String INT = "int"; //$NON-NLS-1$ - public static final String LIST = "list"; //$NON-NLS-1$ - public static final String COLOR = "color"; //$NON-NLS-1$ - public static final String REAL = "real"; //$NON-NLS-1$ - public static final String STRING = "string"; //$NON-NLS-1$ - public static final String URL = "url"; //$NON-NLS-1$ - public static final String VAR = "var"; //$NON-NLS-1$ - - // ECMA Script reserved words - public static final String BREAK = "break"; //$NON-NLS-1$ - public static final String DO = "do"; //$NON-NLS-1$ - public static final String INSTANCEOF = "instanceof"; //$NON-NLS-1$ - public static final String TYPEOF = "typeof"; //$NON-NLS-1$ - public static final String CASE = "case"; //$NON-NLS-1$ - public static final String ELSE = "else"; //$NON-NLS-1$ - public static final String NEW = "new"; //$NON-NLS-1$ - public static final String CATCH = "catch"; //$NON-NLS-1$ - public static final String FINALLY = "finally"; //$NON-NLS-1$ - public static final String RETURN = "return"; //$NON-NLS-1$ - public static final String VOID = "void"; //$NON-NLS-1$ - public static final String CONTINUE = "continue"; //$NON-NLS-1$ - public static final String FOR = "for"; //$NON-NLS-1$ - public static final String SWITCH = "switch"; //$NON-NLS-1$ - public static final String WHILE = "while"; //$NON-NLS-1$ - public static final String DEBUGGER = "debugger"; //$NON-NLS-1$ - public static final String FUNCTION = "function"; //$NON-NLS-1$ - public static final String THIS = "this"; //$NON-NLS-1$ - public static final String WITH = "with"; //$NON-NLS-1$ - public static final String DEFAULT = "default"; //$NON-NLS-1$ - public static final String IF = "if"; //$NON-NLS-1$ - public static final String THROW = "throw"; //$NON-NLS-1$ - public static final String DELETE = "delete"; //$NON-NLS-1$ - public static final String IN = "in"; //$NON-NLS-1$ - public static final String TRY = "try"; //$NON-NLS-1$ - - // ECMAScript future reserved words - public static final String CLASS = "class"; //$NON-NLS-1$ - public static final String ENUM = "enum"; //$NON-NLS-1$ - public static final String EXTENDS = "extends"; //$NON-NLS-1$ - public static final String SUPER = "super"; //$NON-NLS-1$ - public static final String EXPORT = "export"; //$NON-NLS-1$ - - // ECMA Script strict-mode future reserved words - public static final String IMPLEMENTS = "implements"; //$NON-NLS-1$ - public static final String LET = "let"; //$NON-NLS-1$ - public static final String PRIVATE = "private"; //$NON-NLS-1$ - public static final String PUBLIC = "public"; //$NON-NLS-1$ - public static final String YIELD = "yield"; //$NON-NLS-1$ - public static final String INTERFACE = "interface"; //$NON-NLS-1$ - public static final String PACKAGE = "package"; //$NON-NLS-1$ - public static final String PROTECTED = "protected"; //$NON-NLS-1$ - public static final String STATIC = "static"; //$NON-NLS-1$ - - /** - * Gets an array containing all of the QML and ECMA Script keywords. - * - * @param strictMode - * Whether or not ECMA Script strict mode is enabled. If true, this adds several reserved keywords to - * the list. - * @return An array of keywords - */ - public static final String[] getKeywords(boolean strictMode) { - if (!strictMode) { - return new String[] { IMPORT, CONST, PROPERTY, READONLY, SIGNAL, AS, ON, TRUE, FALSE, TRANSIENT, SYNCHRONIZED, ABSTRACT, - VOLATILE, NATIVE, GOTO, BYTE, LONG, CHAR, SHORT, FLOAT, BOOLEAN, DOUBLE, INT, LIST, COLOR, REAL, STRING, URL, - VAR, BREAK, DO, INSTANCEOF, TYPEOF, CASE, ELSE, NEW, CATCH, FINALLY, RETURN, VOID, CONTINUE, FOR, SWITCH, WHILE, - DEBUGGER, FUNCTION, THIS, WITH, DEFAULT, IF, THROW, DELETE, IN, TRY, CLASS, ENUM, EXTENDS, SUPER, EXPORT }; - } else { - return new String[] { IMPORT, CONST, PROPERTY, READONLY, SIGNAL, AS, ON, TRUE, FALSE, TRANSIENT, SYNCHRONIZED, ABSTRACT, - VOLATILE, NATIVE, GOTO, BYTE, LONG, CHAR, SHORT, FLOAT, BOOLEAN, DOUBLE, INT, LIST, COLOR, REAL, STRING, URL, - VAR, BREAK, DO, INSTANCEOF, TYPEOF, CASE, ELSE, NEW, CATCH, FINALLY, RETURN, VOID, CONTINUE, FOR, SWITCH, WHILE, - DEBUGGER, FUNCTION, THIS, WITH, DEFAULT, IF, THROW, DELETE, IN, TRY, CLASS, ENUM, EXTENDS, SUPER, EXPORT, - IMPLEMENTS, LET, PRIVATE, PUBLIC, YIELD, INTERFACE, PACKAGE, PROTECTED, STATIC }; - } - } -} +/******************************************************************************* + * Copyright (c) 2015 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.internal.qt.ui.editor; + +/** + * Constants for the various keywords used by QML and ECMA Script + */ +public class QMLKeywords { + // QML reserved words + public static final String IMPORT = "import"; //$NON-NLS-1$ + public static final String CONST = "const"; //$NON-NLS-1$ + public static final String PROPERTY = "property"; //$NON-NLS-1$ + public static final String READONLY = "readonly"; //$NON-NLS-1$ + public static final String SIGNAL = "signal"; //$NON-NLS-1$ + public static final String AS = "as"; //$NON-NLS-1$ + public static final String ON = "on"; //$NON-NLS-1$ + public static final String TRUE = "true"; //$NON-NLS-1$ + public static final String FALSE = "false"; //$NON-NLS-1$ + + // QML future reserved words + public static final String TRANSIENT = "transient"; //$NON-NLS-1$ + public static final String SYNCHRONIZED = "synchronized"; //$NON-NLS-1$ + public static final String ABSTRACT = "abstract"; //$NON-NLS-1$ + public static final String VOLATILE = "volatile"; //$NON-NLS-1$ + public static final String NATIVE = "native"; //$NON-NLS-1$ + public static final String GOTO = "goto"; //$NON-NLS-1$ + public static final String BYTE = "byte"; //$NON-NLS-1$ + public static final String LONG = "long"; //$NON-NLS-1$ + public static final String CHAR = "char"; //$NON-NLS-1$ + public static final String SHORT = "short"; //$NON-NLS-1$ + public static final String FLOAT = "float"; //$NON-NLS-1$ + + // QML basic types + public static final String BOOLEAN = "boolean"; //$NON-NLS-1$ + public static final String DOUBLE = "double"; //$NON-NLS-1$ + public static final String INT = "int"; //$NON-NLS-1$ + public static final String LIST = "list"; //$NON-NLS-1$ + public static final String COLOR = "color"; //$NON-NLS-1$ + public static final String REAL = "real"; //$NON-NLS-1$ + public static final String STRING = "string"; //$NON-NLS-1$ + public static final String URL = "url"; //$NON-NLS-1$ + public static final String VAR = "var"; //$NON-NLS-1$ + + // ECMA Script reserved words + public static final String BREAK = "break"; //$NON-NLS-1$ + public static final String DO = "do"; //$NON-NLS-1$ + public static final String INSTANCEOF = "instanceof"; //$NON-NLS-1$ + public static final String TYPEOF = "typeof"; //$NON-NLS-1$ + public static final String CASE = "case"; //$NON-NLS-1$ + public static final String ELSE = "else"; //$NON-NLS-1$ + public static final String NEW = "new"; //$NON-NLS-1$ + public static final String CATCH = "catch"; //$NON-NLS-1$ + public static final String FINALLY = "finally"; //$NON-NLS-1$ + public static final String RETURN = "return"; //$NON-NLS-1$ + public static final String VOID = "void"; //$NON-NLS-1$ + public static final String CONTINUE = "continue"; //$NON-NLS-1$ + public static final String FOR = "for"; //$NON-NLS-1$ + public static final String SWITCH = "switch"; //$NON-NLS-1$ + public static final String WHILE = "while"; //$NON-NLS-1$ + public static final String DEBUGGER = "debugger"; //$NON-NLS-1$ + public static final String FUNCTION = "function"; //$NON-NLS-1$ + public static final String THIS = "this"; //$NON-NLS-1$ + public static final String WITH = "with"; //$NON-NLS-1$ + public static final String DEFAULT = "default"; //$NON-NLS-1$ + public static final String IF = "if"; //$NON-NLS-1$ + public static final String THROW = "throw"; //$NON-NLS-1$ + public static final String DELETE = "delete"; //$NON-NLS-1$ + public static final String IN = "in"; //$NON-NLS-1$ + public static final String TRY = "try"; //$NON-NLS-1$ + + // ECMAScript future reserved words + public static final String CLASS = "class"; //$NON-NLS-1$ + public static final String ENUM = "enum"; //$NON-NLS-1$ + public static final String EXTENDS = "extends"; //$NON-NLS-1$ + public static final String SUPER = "super"; //$NON-NLS-1$ + public static final String EXPORT = "export"; //$NON-NLS-1$ + + // ECMA Script strict-mode future reserved words + public static final String IMPLEMENTS = "implements"; //$NON-NLS-1$ + public static final String LET = "let"; //$NON-NLS-1$ + public static final String PRIVATE = "private"; //$NON-NLS-1$ + public static final String PUBLIC = "public"; //$NON-NLS-1$ + public static final String YIELD = "yield"; //$NON-NLS-1$ + public static final String INTERFACE = "interface"; //$NON-NLS-1$ + public static final String PACKAGE = "package"; //$NON-NLS-1$ + public static final String PROTECTED = "protected"; //$NON-NLS-1$ + public static final String STATIC = "static"; //$NON-NLS-1$ + + /** + * Gets an array containing all of the QML and ECMA Script keywords. + * + * @param strictMode + * Whether or not ECMA Script strict mode is enabled. If true, this adds several reserved keywords to + * the list. + * @return An array of keywords + */ + public static final String[] getKeywords(boolean strictMode) { + if (!strictMode) { + return new String[] { IMPORT, CONST, PROPERTY, READONLY, SIGNAL, AS, ON, TRUE, FALSE, TRANSIENT, SYNCHRONIZED, ABSTRACT, + VOLATILE, NATIVE, GOTO, BYTE, LONG, CHAR, SHORT, FLOAT, BOOLEAN, DOUBLE, INT, LIST, COLOR, REAL, STRING, URL, + VAR, BREAK, DO, INSTANCEOF, TYPEOF, CASE, ELSE, NEW, CATCH, FINALLY, RETURN, VOID, CONTINUE, FOR, SWITCH, WHILE, + DEBUGGER, FUNCTION, THIS, WITH, DEFAULT, IF, THROW, DELETE, IN, TRY, CLASS, ENUM, EXTENDS, SUPER, EXPORT }; + } else { + return new String[] { IMPORT, CONST, PROPERTY, READONLY, SIGNAL, AS, ON, TRUE, FALSE, TRANSIENT, SYNCHRONIZED, ABSTRACT, + VOLATILE, NATIVE, GOTO, BYTE, LONG, CHAR, SHORT, FLOAT, BOOLEAN, DOUBLE, INT, LIST, COLOR, REAL, STRING, URL, + VAR, BREAK, DO, INSTANCEOF, TYPEOF, CASE, ELSE, NEW, CATCH, FINALLY, RETURN, VOID, CONTINUE, FOR, SWITCH, WHILE, + DEBUGGER, FUNCTION, THIS, WITH, DEFAULT, IF, THROW, DELETE, IN, TRY, CLASS, ENUM, EXTENDS, SUPER, EXPORT, + IMPLEMENTS, LET, PRIVATE, PUBLIC, YIELD, INTERFACE, PACKAGE, PROTECTED, STATIC }; + } + } +} diff --git a/qt/org.eclipse.cdt.qt.ui/src/org/eclipse/cdt/internal/qt/ui/editor/QMLPartitionScanner.java b/qt/org.eclipse.cdt.qt.ui/src/org/eclipse/cdt/internal/qt/ui/editor/QMLPartitionScanner.java index 297d06b4590..efc0e585fc1 100644 --- a/qt/org.eclipse.cdt.qt.ui/src/org/eclipse/cdt/internal/qt/ui/editor/QMLPartitionScanner.java +++ b/qt/org.eclipse.cdt.qt.ui/src/org/eclipse/cdt/internal/qt/ui/editor/QMLPartitionScanner.java @@ -1,45 +1,45 @@ -/******************************************************************************* - * Copyright (c) 2015 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.internal.qt.ui.editor; - -import org.eclipse.jface.text.rules.EndOfLineRule; -import org.eclipse.jface.text.rules.IPredicateRule; -import org.eclipse.jface.text.rules.IToken; -import org.eclipse.jface.text.rules.MultiLineRule; -import org.eclipse.jface.text.rules.RuleBasedPartitionScanner; -import org.eclipse.jface.text.rules.SingleLineRule; -import org.eclipse.jface.text.rules.Token; - -/** - * Partitions a QML document into four distinct sections: - *
      - *
    1. multi-line comments
    2. - *
    3. single-line comments
    4. - *
    5. strings
    6. - *
    7. anything else that does not fall under the aforementioned categories
    8. - *
    - */ -public class QMLPartitionScanner extends RuleBasedPartitionScanner implements IQMLPartitions { - - public QMLPartitionScanner() { - super(); - - IToken multiLineComment= new Token(QML_MULTI_LINE_COMMENT); - IToken singleLineComment= new Token(QML_SINGLE_LINE_COMMENT); - IToken string= new Token(QML_STRING); - - setPredicateRules(new IPredicateRule[] { - new MultiLineRule("/*", "*/", multiLineComment, (char) 0, true), //$NON-NLS-1$ //$NON-NLS-2$ - new EndOfLineRule("//", singleLineComment), //$NON-NLS-1$ - new SingleLineRule("\"", "\"", string, '\\', true) //$NON-NLS-2$ //$NON-NLS-1$ - }); - } -} +/******************************************************************************* + * Copyright (c) 2015 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.internal.qt.ui.editor; + +import org.eclipse.jface.text.rules.EndOfLineRule; +import org.eclipse.jface.text.rules.IPredicateRule; +import org.eclipse.jface.text.rules.IToken; +import org.eclipse.jface.text.rules.MultiLineRule; +import org.eclipse.jface.text.rules.RuleBasedPartitionScanner; +import org.eclipse.jface.text.rules.SingleLineRule; +import org.eclipse.jface.text.rules.Token; + +/** + * Partitions a QML document into four distinct sections: + *
      + *
    1. multi-line comments
    2. + *
    3. single-line comments
    4. + *
    5. strings
    6. + *
    7. anything else that does not fall under the aforementioned categories
    8. + *
    + */ +public class QMLPartitionScanner extends RuleBasedPartitionScanner implements IQMLPartitions { + + public QMLPartitionScanner() { + super(); + + IToken multiLineComment= new Token(QML_MULTI_LINE_COMMENT); + IToken singleLineComment= new Token(QML_SINGLE_LINE_COMMENT); + IToken string= new Token(QML_STRING); + + setPredicateRules(new IPredicateRule[] { + new MultiLineRule("/*", "*/", multiLineComment, (char) 0, true), //$NON-NLS-1$ //$NON-NLS-2$ + new EndOfLineRule("//", singleLineComment), //$NON-NLS-1$ + new SingleLineRule("\"", "\"", string, '\\', true) //$NON-NLS-2$ //$NON-NLS-1$ + }); + } +} diff --git a/qt/org.eclipse.cdt.qt.ui/src/org/eclipse/cdt/internal/qt/ui/editor/QMLSourceViewerConfiguration.java b/qt/org.eclipse.cdt.qt.ui/src/org/eclipse/cdt/internal/qt/ui/editor/QMLSourceViewerConfiguration.java index 1786f2f5343..28a4ae0be70 100644 --- a/qt/org.eclipse.cdt.qt.ui/src/org/eclipse/cdt/internal/qt/ui/editor/QMLSourceViewerConfiguration.java +++ b/qt/org.eclipse.cdt.qt.ui/src/org/eclipse/cdt/internal/qt/ui/editor/QMLSourceViewerConfiguration.java @@ -1,236 +1,236 @@ -/******************************************************************************* - * Copyright (c) 2015 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.internal.qt.ui.editor; - -import java.util.Map; - -import org.eclipse.cdt.ui.CDTUITools; -import org.eclipse.cdt.ui.PreferenceConstants; -import org.eclipse.cdt.ui.text.ICColorConstants; -import org.eclipse.cdt.ui.text.IColorManager; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.jface.preference.IPreferenceStore; -import org.eclipse.jface.preference.PreferenceConverter; -import org.eclipse.jface.text.IDocument; -import org.eclipse.jface.text.TextAttribute; -import org.eclipse.jface.text.contentassist.ContentAssistant; -import org.eclipse.jface.text.contentassist.IContentAssistProcessor; -import org.eclipse.jface.text.contentassist.IContentAssistant; -import org.eclipse.jface.text.presentation.IPresentationReconciler; -import org.eclipse.jface.text.presentation.PresentationReconciler; -import org.eclipse.jface.text.rules.DefaultDamagerRepairer; -import org.eclipse.jface.text.rules.IRule; -import org.eclipse.jface.text.rules.IToken; -import org.eclipse.jface.text.rules.ITokenScanner; -import org.eclipse.jface.text.rules.IWordDetector; -import org.eclipse.jface.text.rules.RuleBasedScanner; -import org.eclipse.jface.text.rules.Token; -import org.eclipse.jface.text.rules.WordRule; -import org.eclipse.jface.text.source.ISourceViewer; -import org.eclipse.jface.util.PropertyChangeEvent; -import org.eclipse.swt.SWT; -import org.eclipse.swt.graphics.Color; -import org.eclipse.swt.graphics.RGB; -import org.eclipse.ui.editors.text.TextSourceViewerConfiguration; - -/** - * Performs syntax highlighting for the {@link QMLEditor}. - */ -public class QMLSourceViewerConfiguration extends TextSourceViewerConfiguration { - private Token defaultToken; - private Token multiLineCommentToken; - private Token singleLineCommentToken; - private Token keywordToken; - private Token stringToken; - private Token taskTagToken; - - private final QMLEditor editor; - - public QMLSourceViewerConfiguration(QMLEditor editor, IPreferenceStore prefs) { - super(prefs); - this.editor = editor; - initTokens(prefs); - } - - @Override - public IPresentationReconciler getPresentationReconciler(ISourceViewer viewer) { - PresentationReconciler reconciler = new PresentationReconciler(); - reconciler.setDocumentPartitioning(IQMLPartitions.QML_PARTITIONING); - - DefaultDamagerRepairer dr; - dr = new DefaultDamagerRepairer(createMultiLineCommentTokenScanner()); - reconciler.setDamager(dr, IQMLPartitions.QML_MULTI_LINE_COMMENT); - reconciler.setRepairer(dr, IQMLPartitions.QML_MULTI_LINE_COMMENT); - - dr = new DefaultDamagerRepairer(createSingleLineCommentTokenScanner()); - reconciler.setDamager(dr, IQMLPartitions.QML_SINGLE_LINE_COMMENT); - reconciler.setRepairer(dr, IQMLPartitions.QML_SINGLE_LINE_COMMENT); - - dr = new DefaultDamagerRepairer(createStringTokenScanner()); - reconciler.setDamager(dr, IQMLPartitions.QML_STRING); - reconciler.setRepairer(dr, IQMLPartitions.QML_STRING); - - dr = new DefaultDamagerRepairer(createDefaultTokenScanner()); - reconciler.setDamager(dr, IDocument.DEFAULT_CONTENT_TYPE); - reconciler.setRepairer(dr, IDocument.DEFAULT_CONTENT_TYPE); - return reconciler; - } - - private ITokenScanner createMultiLineCommentTokenScanner() { - RuleBasedScanner scanner = new RuleBasedScanner(); - scanner.setDefaultReturnToken(multiLineCommentToken); - scanner.setRules(new IRule[] { createTaskTagRule(multiLineCommentToken) }); - return scanner; - } - - private ITokenScanner createSingleLineCommentTokenScanner() { - RuleBasedScanner scanner = new RuleBasedScanner(); - scanner.setDefaultReturnToken(singleLineCommentToken); - scanner.setRules(new IRule[] { createTaskTagRule(singleLineCommentToken) }); - return scanner; - } - - private ITokenScanner createStringTokenScanner() { - RuleBasedScanner scanner = new RuleBasedScanner(); - scanner.setDefaultReturnToken(stringToken); - return scanner; - } - - private ITokenScanner createDefaultTokenScanner() { - RuleBasedScanner scanner = new RuleBasedScanner(); - - WordRule wordRule = new WordRule(new IWordDetector() { - @Override - public boolean isWordStart(char c) { - return Character.isJavaIdentifierStart(c); - } - - @Override - public boolean isWordPart(char c) { - return Character.isJavaIdentifierPart(c); - } - }, defaultToken); - - // Works decently well for now. However, some keywords like 'color' can - // also be used as identifiers. Can only fix this with - // semantic highlighting after the parser is completed. - for (String keyword : QMLKeywords.getKeywords(true)) { - wordRule.addWord(keyword, keywordToken); - } - - scanner.setRules(new IRule[] { wordRule }); - return scanner; - } - - private IRule createTaskTagRule(IToken defaultToken) { - WordRule wordRule = new WordRule(new IWordDetector() { - @Override - public boolean isWordStart(char c) { - return Character.isJavaIdentifierStart(c); - } - - @Override - public boolean isWordPart(char c) { - return Character.isJavaIdentifierPart(c); - } - }, defaultToken); - - // TODO: Add preference page for task tags - wordRule.addWord("TODO", taskTagToken); //$NON-NLS-1$ - wordRule.addWord("FIXME", taskTagToken); //$NON-NLS-1$ - wordRule.addWord("XXX", taskTagToken); //$NON-NLS-1$ - - return wordRule; - } - - @Override - public IContentAssistant getContentAssistant(ISourceViewer sourceViewer) { - ContentAssistant contentAssistant = new ContentAssistant(); - IContentAssistProcessor processor = new QMLContentAssistProcessor(editor); - contentAssistant.setContentAssistProcessor(processor, IDocument.DEFAULT_CONTENT_TYPE); - contentAssistant.setInformationControlCreator(getInformationControlCreator(sourceViewer)); - return contentAssistant; - } - - @Override - protected Map getHyperlinkDetectorTargets(ISourceViewer sourceViewer) { - Map targets = super.getHyperlinkDetectorTargets(sourceViewer); - targets.put("org.eclipse.cdt.qt.ui.qml", editor); //$NON-NLS-1$ - return targets; - } - - private void initTokens(IPreferenceStore prefStore) { - IColorManager colorManager = CDTUITools.getColorManager(); - defaultToken = new Token(null); - multiLineCommentToken = new Token(createTextAttribute(colorManager, ICColorConstants.C_MULTI_LINE_COMMENT)); - singleLineCommentToken = new Token(createTextAttribute(colorManager, ICColorConstants.C_SINGLE_LINE_COMMENT)); - keywordToken = new Token(createTextAttribute(colorManager, ICColorConstants.C_KEYWORD)); - stringToken = new Token(createTextAttribute(colorManager, ICColorConstants.C_STRING)); - taskTagToken = new Token(createTextAttribute(colorManager, ICColorConstants.TASK_TAG)); - } - - private TextAttribute createTextAttribute(IColorManager colorManager, String colorKey) { - Color color = colorManager.getColor(colorKey); - if (color == null) { - RGB rgb= PreferenceConverter.getColor(fPreferenceStore, colorKey); - colorManager.unbindColor(colorKey); - colorManager.bindColor(colorKey, rgb); - color = colorManager.getColor(colorKey); - } - - String boldKey= colorKey + PreferenceConstants.EDITOR_BOLD_SUFFIX; - String italicKey= colorKey + PreferenceConstants.EDITOR_ITALIC_SUFFIX; - String strikethroughKey= colorKey + PreferenceConstants.EDITOR_STRIKETHROUGH_SUFFIX; - String underlineKey= colorKey + PreferenceConstants.EDITOR_UNDERLINE_SUFFIX; - - int style= fPreferenceStore.getBoolean(boldKey) ? SWT.BOLD : SWT.NORMAL; - if (fPreferenceStore.getBoolean(italicKey)) - style |= SWT.ITALIC; - - if (fPreferenceStore.getBoolean(strikethroughKey)) - style |= TextAttribute.STRIKETHROUGH; - - if (fPreferenceStore.getBoolean(underlineKey)) - style |= TextAttribute.UNDERLINE; - - return new TextAttribute(color, null, style); - } - - public void handlePreferenceStoreChanged(PropertyChangeEvent event) { - IColorManager colorManager = CDTUITools.getColorManager(); - String property = event.getProperty(); - if (property.startsWith(ICColorConstants.C_MULTI_LINE_COMMENT)) { - multiLineCommentToken.setData(createTextAttribute(colorManager, ICColorConstants.C_MULTI_LINE_COMMENT)); - } - if (property.startsWith(ICColorConstants.C_SINGLE_LINE_COMMENT)) { - singleLineCommentToken.setData(createTextAttribute(colorManager, ICColorConstants.C_SINGLE_LINE_COMMENT)); - } - if (property.startsWith(ICColorConstants.C_KEYWORD)) { - keywordToken.setData(createTextAttribute(colorManager, ICColorConstants.C_KEYWORD)); - } - if (property.startsWith(ICColorConstants.C_STRING)) { - stringToken.setData(createTextAttribute(colorManager, ICColorConstants.C_STRING)); - } - if (property.startsWith(ICColorConstants.TASK_TAG)) { - taskTagToken.setData(createTextAttribute(colorManager, ICColorConstants.TASK_TAG)); - } - } - - protected boolean affectsTextPresentation(PropertyChangeEvent event) { - String property = event.getProperty(); - return property.startsWith(ICColorConstants.C_MULTI_LINE_COMMENT) - || property.startsWith(ICColorConstants.C_SINGLE_LINE_COMMENT) - || property.startsWith(ICColorConstants.C_KEYWORD) - || property.startsWith(ICColorConstants.C_STRING) - || property.startsWith(ICColorConstants.TASK_TAG); - } - -} +/******************************************************************************* + * Copyright (c) 2015 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.internal.qt.ui.editor; + +import java.util.Map; + +import org.eclipse.cdt.ui.CDTUITools; +import org.eclipse.cdt.ui.PreferenceConstants; +import org.eclipse.cdt.ui.text.ICColorConstants; +import org.eclipse.cdt.ui.text.IColorManager; +import org.eclipse.core.runtime.IAdaptable; +import org.eclipse.jface.preference.IPreferenceStore; +import org.eclipse.jface.preference.PreferenceConverter; +import org.eclipse.jface.text.IDocument; +import org.eclipse.jface.text.TextAttribute; +import org.eclipse.jface.text.contentassist.ContentAssistant; +import org.eclipse.jface.text.contentassist.IContentAssistProcessor; +import org.eclipse.jface.text.contentassist.IContentAssistant; +import org.eclipse.jface.text.presentation.IPresentationReconciler; +import org.eclipse.jface.text.presentation.PresentationReconciler; +import org.eclipse.jface.text.rules.DefaultDamagerRepairer; +import org.eclipse.jface.text.rules.IRule; +import org.eclipse.jface.text.rules.IToken; +import org.eclipse.jface.text.rules.ITokenScanner; +import org.eclipse.jface.text.rules.IWordDetector; +import org.eclipse.jface.text.rules.RuleBasedScanner; +import org.eclipse.jface.text.rules.Token; +import org.eclipse.jface.text.rules.WordRule; +import org.eclipse.jface.text.source.ISourceViewer; +import org.eclipse.jface.util.PropertyChangeEvent; +import org.eclipse.swt.SWT; +import org.eclipse.swt.graphics.Color; +import org.eclipse.swt.graphics.RGB; +import org.eclipse.ui.editors.text.TextSourceViewerConfiguration; + +/** + * Performs syntax highlighting for the {@link QMLEditor}. + */ +public class QMLSourceViewerConfiguration extends TextSourceViewerConfiguration { + private Token defaultToken; + private Token multiLineCommentToken; + private Token singleLineCommentToken; + private Token keywordToken; + private Token stringToken; + private Token taskTagToken; + + private final QMLEditor editor; + + public QMLSourceViewerConfiguration(QMLEditor editor, IPreferenceStore prefs) { + super(prefs); + this.editor = editor; + initTokens(prefs); + } + + @Override + public IPresentationReconciler getPresentationReconciler(ISourceViewer viewer) { + PresentationReconciler reconciler = new PresentationReconciler(); + reconciler.setDocumentPartitioning(IQMLPartitions.QML_PARTITIONING); + + DefaultDamagerRepairer dr; + dr = new DefaultDamagerRepairer(createMultiLineCommentTokenScanner()); + reconciler.setDamager(dr, IQMLPartitions.QML_MULTI_LINE_COMMENT); + reconciler.setRepairer(dr, IQMLPartitions.QML_MULTI_LINE_COMMENT); + + dr = new DefaultDamagerRepairer(createSingleLineCommentTokenScanner()); + reconciler.setDamager(dr, IQMLPartitions.QML_SINGLE_LINE_COMMENT); + reconciler.setRepairer(dr, IQMLPartitions.QML_SINGLE_LINE_COMMENT); + + dr = new DefaultDamagerRepairer(createStringTokenScanner()); + reconciler.setDamager(dr, IQMLPartitions.QML_STRING); + reconciler.setRepairer(dr, IQMLPartitions.QML_STRING); + + dr = new DefaultDamagerRepairer(createDefaultTokenScanner()); + reconciler.setDamager(dr, IDocument.DEFAULT_CONTENT_TYPE); + reconciler.setRepairer(dr, IDocument.DEFAULT_CONTENT_TYPE); + return reconciler; + } + + private ITokenScanner createMultiLineCommentTokenScanner() { + RuleBasedScanner scanner = new RuleBasedScanner(); + scanner.setDefaultReturnToken(multiLineCommentToken); + scanner.setRules(new IRule[] { createTaskTagRule(multiLineCommentToken) }); + return scanner; + } + + private ITokenScanner createSingleLineCommentTokenScanner() { + RuleBasedScanner scanner = new RuleBasedScanner(); + scanner.setDefaultReturnToken(singleLineCommentToken); + scanner.setRules(new IRule[] { createTaskTagRule(singleLineCommentToken) }); + return scanner; + } + + private ITokenScanner createStringTokenScanner() { + RuleBasedScanner scanner = new RuleBasedScanner(); + scanner.setDefaultReturnToken(stringToken); + return scanner; + } + + private ITokenScanner createDefaultTokenScanner() { + RuleBasedScanner scanner = new RuleBasedScanner(); + + WordRule wordRule = new WordRule(new IWordDetector() { + @Override + public boolean isWordStart(char c) { + return Character.isJavaIdentifierStart(c); + } + + @Override + public boolean isWordPart(char c) { + return Character.isJavaIdentifierPart(c); + } + }, defaultToken); + + // Works decently well for now. However, some keywords like 'color' can + // also be used as identifiers. Can only fix this with + // semantic highlighting after the parser is completed. + for (String keyword : QMLKeywords.getKeywords(true)) { + wordRule.addWord(keyword, keywordToken); + } + + scanner.setRules(new IRule[] { wordRule }); + return scanner; + } + + private IRule createTaskTagRule(IToken defaultToken) { + WordRule wordRule = new WordRule(new IWordDetector() { + @Override + public boolean isWordStart(char c) { + return Character.isJavaIdentifierStart(c); + } + + @Override + public boolean isWordPart(char c) { + return Character.isJavaIdentifierPart(c); + } + }, defaultToken); + + // TODO: Add preference page for task tags + wordRule.addWord("TODO", taskTagToken); //$NON-NLS-1$ + wordRule.addWord("FIXME", taskTagToken); //$NON-NLS-1$ + wordRule.addWord("XXX", taskTagToken); //$NON-NLS-1$ + + return wordRule; + } + + @Override + public IContentAssistant getContentAssistant(ISourceViewer sourceViewer) { + ContentAssistant contentAssistant = new ContentAssistant(); + IContentAssistProcessor processor = new QMLContentAssistProcessor(editor); + contentAssistant.setContentAssistProcessor(processor, IDocument.DEFAULT_CONTENT_TYPE); + contentAssistant.setInformationControlCreator(getInformationControlCreator(sourceViewer)); + return contentAssistant; + } + + @Override + protected Map getHyperlinkDetectorTargets(ISourceViewer sourceViewer) { + Map targets = super.getHyperlinkDetectorTargets(sourceViewer); + targets.put("org.eclipse.cdt.qt.ui.qml", editor); //$NON-NLS-1$ + return targets; + } + + private void initTokens(IPreferenceStore prefStore) { + IColorManager colorManager = CDTUITools.getColorManager(); + defaultToken = new Token(null); + multiLineCommentToken = new Token(createTextAttribute(colorManager, ICColorConstants.C_MULTI_LINE_COMMENT)); + singleLineCommentToken = new Token(createTextAttribute(colorManager, ICColorConstants.C_SINGLE_LINE_COMMENT)); + keywordToken = new Token(createTextAttribute(colorManager, ICColorConstants.C_KEYWORD)); + stringToken = new Token(createTextAttribute(colorManager, ICColorConstants.C_STRING)); + taskTagToken = new Token(createTextAttribute(colorManager, ICColorConstants.TASK_TAG)); + } + + private TextAttribute createTextAttribute(IColorManager colorManager, String colorKey) { + Color color = colorManager.getColor(colorKey); + if (color == null) { + RGB rgb= PreferenceConverter.getColor(fPreferenceStore, colorKey); + colorManager.unbindColor(colorKey); + colorManager.bindColor(colorKey, rgb); + color = colorManager.getColor(colorKey); + } + + String boldKey= colorKey + PreferenceConstants.EDITOR_BOLD_SUFFIX; + String italicKey= colorKey + PreferenceConstants.EDITOR_ITALIC_SUFFIX; + String strikethroughKey= colorKey + PreferenceConstants.EDITOR_STRIKETHROUGH_SUFFIX; + String underlineKey= colorKey + PreferenceConstants.EDITOR_UNDERLINE_SUFFIX; + + int style= fPreferenceStore.getBoolean(boldKey) ? SWT.BOLD : SWT.NORMAL; + if (fPreferenceStore.getBoolean(italicKey)) + style |= SWT.ITALIC; + + if (fPreferenceStore.getBoolean(strikethroughKey)) + style |= TextAttribute.STRIKETHROUGH; + + if (fPreferenceStore.getBoolean(underlineKey)) + style |= TextAttribute.UNDERLINE; + + return new TextAttribute(color, null, style); + } + + public void handlePreferenceStoreChanged(PropertyChangeEvent event) { + IColorManager colorManager = CDTUITools.getColorManager(); + String property = event.getProperty(); + if (property.startsWith(ICColorConstants.C_MULTI_LINE_COMMENT)) { + multiLineCommentToken.setData(createTextAttribute(colorManager, ICColorConstants.C_MULTI_LINE_COMMENT)); + } + if (property.startsWith(ICColorConstants.C_SINGLE_LINE_COMMENT)) { + singleLineCommentToken.setData(createTextAttribute(colorManager, ICColorConstants.C_SINGLE_LINE_COMMENT)); + } + if (property.startsWith(ICColorConstants.C_KEYWORD)) { + keywordToken.setData(createTextAttribute(colorManager, ICColorConstants.C_KEYWORD)); + } + if (property.startsWith(ICColorConstants.C_STRING)) { + stringToken.setData(createTextAttribute(colorManager, ICColorConstants.C_STRING)); + } + if (property.startsWith(ICColorConstants.TASK_TAG)) { + taskTagToken.setData(createTextAttribute(colorManager, ICColorConstants.TASK_TAG)); + } + } + + protected boolean affectsTextPresentation(PropertyChangeEvent event) { + String property = event.getProperty(); + return property.startsWith(ICColorConstants.C_MULTI_LINE_COMMENT) + || property.startsWith(ICColorConstants.C_SINGLE_LINE_COMMENT) + || property.startsWith(ICColorConstants.C_KEYWORD) + || property.startsWith(ICColorConstants.C_STRING) + || property.startsWith(ICColorConstants.TASK_TAG); + } + +} diff --git a/qt/org.eclipse.cdt.qt.ui/src/org/eclipse/cdt/internal/qt/ui/editor/QtProjectFileContentAssistProcessor.java b/qt/org.eclipse.cdt.qt.ui/src/org/eclipse/cdt/internal/qt/ui/editor/QtProjectFileContentAssistProcessor.java index d306d7ef29d..1dbfaad54ef 100644 --- a/qt/org.eclipse.cdt.qt.ui/src/org/eclipse/cdt/internal/qt/ui/editor/QtProjectFileContentAssistProcessor.java +++ b/qt/org.eclipse.cdt.qt.ui/src/org/eclipse/cdt/internal/qt/ui/editor/QtProjectFileContentAssistProcessor.java @@ -1,105 +1,105 @@ -/******************************************************************************* - * Copyright (c) 2015 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.internal.qt.ui.editor; - -import java.util.ArrayList; -import java.util.Locale; - -import org.eclipse.cdt.internal.qt.ui.Activator; -import org.eclipse.jface.text.BadLocationException; -import org.eclipse.jface.text.IDocument; -import org.eclipse.jface.text.ITextViewer; -import org.eclipse.jface.text.contentassist.CompletionProposal; -import org.eclipse.jface.text.contentassist.ICompletionProposal; -import org.eclipse.jface.text.contentassist.IContentAssistProcessor; -import org.eclipse.jface.text.contentassist.IContextInformation; -import org.eclipse.jface.text.contentassist.IContextInformationValidator; - -public class QtProjectFileContentAssistProcessor implements IContentAssistProcessor { - private final IContextInformation[] NO_CONTEXTS = {}; - private final ICompletionProposal[] NO_COMPLETIONS = {}; - - @Override - public ICompletionProposal[] computeCompletionProposals(ITextViewer viewer, int offset) { - try { - IDocument document = viewer.getDocument(); - ArrayList result = new ArrayList<>(); - - // Search the list of keywords (case-insensitive) - String prefix = lastWord(document, offset).toLowerCase(Locale.ROOT); - for (QtProjectFileKeyword keyword : QtProjectFileKeyword.values()) { - if (prefix.isEmpty() || keyword.getKeyword().toLowerCase(Locale.ROOT).startsWith(prefix)) { - result.add(new CompletionProposal(keyword.getKeyword(), offset - prefix.length(), prefix.length(), - keyword.getKeyword().length())); - } - } - return result.toArray(new ICompletionProposal[result.size()]); - } catch (Exception e) { - Activator.log(e); - return NO_COMPLETIONS; - } - } - - /** - * Returns the valid Java identifier in a document immediately before the - * given offset. - * - * @param document - * the document - * @param offset - * the offset at which to start looking - * @return the Java identifier preceding this location or a blank string if - * none - */ - private String lastWord(IDocument document, int offset) { - try { - for (int n = offset - 1; n >= 0; n--) { - char c = document.getChar(n); - if (!Character.isJavaIdentifierPart(c)) { - return document.get(n + 1, offset - n - 1); - } - } - return document.get(0, offset); - } catch (BadLocationException e) { - Activator.log(e); - } - return ""; //$NON-NLS-1$ - } - - @Override - public IContextInformation[] computeContextInformation(ITextViewer viewer, int offset) { - // No context information for now - return NO_CONTEXTS; - } - - @Override - public String getErrorMessage() { - return null; - } - - @Override - public IContextInformationValidator getContextInformationValidator() { - // No context information validator - return null; - } - - @Override - public char[] getCompletionProposalAutoActivationCharacters() { - // No auto activation - return null; - } - - @Override - public char[] getContextInformationAutoActivationCharacters() { - // No auto activation - return null; - } -} +/******************************************************************************* + * Copyright (c) 2015 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.internal.qt.ui.editor; + +import java.util.ArrayList; +import java.util.Locale; + +import org.eclipse.cdt.internal.qt.ui.Activator; +import org.eclipse.jface.text.BadLocationException; +import org.eclipse.jface.text.IDocument; +import org.eclipse.jface.text.ITextViewer; +import org.eclipse.jface.text.contentassist.CompletionProposal; +import org.eclipse.jface.text.contentassist.ICompletionProposal; +import org.eclipse.jface.text.contentassist.IContentAssistProcessor; +import org.eclipse.jface.text.contentassist.IContextInformation; +import org.eclipse.jface.text.contentassist.IContextInformationValidator; + +public class QtProjectFileContentAssistProcessor implements IContentAssistProcessor { + private final IContextInformation[] NO_CONTEXTS = {}; + private final ICompletionProposal[] NO_COMPLETIONS = {}; + + @Override + public ICompletionProposal[] computeCompletionProposals(ITextViewer viewer, int offset) { + try { + IDocument document = viewer.getDocument(); + ArrayList result = new ArrayList<>(); + + // Search the list of keywords (case-insensitive) + String prefix = lastWord(document, offset).toLowerCase(Locale.ROOT); + for (QtProjectFileKeyword keyword : QtProjectFileKeyword.values()) { + if (prefix.isEmpty() || keyword.getKeyword().toLowerCase(Locale.ROOT).startsWith(prefix)) { + result.add(new CompletionProposal(keyword.getKeyword(), offset - prefix.length(), prefix.length(), + keyword.getKeyword().length())); + } + } + return result.toArray(new ICompletionProposal[result.size()]); + } catch (Exception e) { + Activator.log(e); + return NO_COMPLETIONS; + } + } + + /** + * Returns the valid Java identifier in a document immediately before the + * given offset. + * + * @param document + * the document + * @param offset + * the offset at which to start looking + * @return the Java identifier preceding this location or a blank string if + * none + */ + private String lastWord(IDocument document, int offset) { + try { + for (int n = offset - 1; n >= 0; n--) { + char c = document.getChar(n); + if (!Character.isJavaIdentifierPart(c)) { + return document.get(n + 1, offset - n - 1); + } + } + return document.get(0, offset); + } catch (BadLocationException e) { + Activator.log(e); + } + return ""; //$NON-NLS-1$ + } + + @Override + public IContextInformation[] computeContextInformation(ITextViewer viewer, int offset) { + // No context information for now + return NO_CONTEXTS; + } + + @Override + public String getErrorMessage() { + return null; + } + + @Override + public IContextInformationValidator getContextInformationValidator() { + // No context information validator + return null; + } + + @Override + public char[] getCompletionProposalAutoActivationCharacters() { + // No auto activation + return null; + } + + @Override + public char[] getContextInformationAutoActivationCharacters() { + // No auto activation + return null; + } +} diff --git a/qt/org.eclipse.cdt.qt.ui/src/org/eclipse/cdt/internal/qt/ui/editor/QtProjectFileEditor.java b/qt/org.eclipse.cdt.qt.ui/src/org/eclipse/cdt/internal/qt/ui/editor/QtProjectFileEditor.java index 8d4443f7dfc..896adbf7cab 100644 --- a/qt/org.eclipse.cdt.qt.ui/src/org/eclipse/cdt/internal/qt/ui/editor/QtProjectFileEditor.java +++ b/qt/org.eclipse.cdt.qt.ui/src/org/eclipse/cdt/internal/qt/ui/editor/QtProjectFileEditor.java @@ -1,45 +1,45 @@ -/******************************************************************************* - * Copyright (c) 2015 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.internal.qt.ui.editor; - -import org.eclipse.jface.preference.IPreferenceStore; -import org.eclipse.jface.text.IDocumentExtension3; -import org.eclipse.jface.text.source.DefaultCharacterPairMatcher; -import org.eclipse.jface.text.source.ICharacterPairMatcher; -import org.eclipse.ui.editors.text.TextEditor; -import org.eclipse.ui.texteditor.SourceViewerDecorationSupport; - -public class QtProjectFileEditor extends TextEditor { - public static final String EDITOR_ID = "org.eclipse.cdt.qt.ui.QtProjectFileEditor"; //$NON-NLS-1$ - - public static final String BRACKET_MATCHING_COLOR_PREFERENCE = "org.eclipse.cdt.qt.ui.qtproMatchingBracketsColor"; //$NON-NLS-1$ - private static final String BRACKET_MATCHING_PREFERENCE = "org.eclipse.cdt.qt.ui.qtproMatchingBrackets"; //$NON-NLS-1$ - - private static final char[] BRACKETS = { '{', '}', '(', ')', '[', ']' }; - - public QtProjectFileEditor() { - setSourceViewerConfiguration(new QtProjectFileSourceViewerConfiguration()); - } - - @Override - protected void configureSourceViewerDecorationSupport(SourceViewerDecorationSupport support) { - super.configureSourceViewerDecorationSupport(support); - - // Setup bracket matching with default color being gray - ICharacterPairMatcher matcher = new DefaultCharacterPairMatcher(BRACKETS, IDocumentExtension3.DEFAULT_PARTITIONING); - support.setCharacterPairMatcher(matcher); - support.setMatchingCharacterPainterPreferenceKeys(BRACKET_MATCHING_PREFERENCE, BRACKET_MATCHING_COLOR_PREFERENCE); - - IPreferenceStore store = getPreferenceStore(); - store.setDefault(BRACKET_MATCHING_PREFERENCE, true); - store.setDefault(BRACKET_MATCHING_COLOR_PREFERENCE, "155,155,155"); //$NON-NLS-1$ - } -} +/******************************************************************************* + * Copyright (c) 2015 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.internal.qt.ui.editor; + +import org.eclipse.jface.preference.IPreferenceStore; +import org.eclipse.jface.text.IDocumentExtension3; +import org.eclipse.jface.text.source.DefaultCharacterPairMatcher; +import org.eclipse.jface.text.source.ICharacterPairMatcher; +import org.eclipse.ui.editors.text.TextEditor; +import org.eclipse.ui.texteditor.SourceViewerDecorationSupport; + +public class QtProjectFileEditor extends TextEditor { + public static final String EDITOR_ID = "org.eclipse.cdt.qt.ui.QtProjectFileEditor"; //$NON-NLS-1$ + + public static final String BRACKET_MATCHING_COLOR_PREFERENCE = "org.eclipse.cdt.qt.ui.qtproMatchingBracketsColor"; //$NON-NLS-1$ + private static final String BRACKET_MATCHING_PREFERENCE = "org.eclipse.cdt.qt.ui.qtproMatchingBrackets"; //$NON-NLS-1$ + + private static final char[] BRACKETS = { '{', '}', '(', ')', '[', ']' }; + + public QtProjectFileEditor() { + setSourceViewerConfiguration(new QtProjectFileSourceViewerConfiguration()); + } + + @Override + protected void configureSourceViewerDecorationSupport(SourceViewerDecorationSupport support) { + super.configureSourceViewerDecorationSupport(support); + + // Setup bracket matching with default color being gray + ICharacterPairMatcher matcher = new DefaultCharacterPairMatcher(BRACKETS, IDocumentExtension3.DEFAULT_PARTITIONING); + support.setCharacterPairMatcher(matcher); + support.setMatchingCharacterPainterPreferenceKeys(BRACKET_MATCHING_PREFERENCE, BRACKET_MATCHING_COLOR_PREFERENCE); + + IPreferenceStore store = getPreferenceStore(); + store.setDefault(BRACKET_MATCHING_PREFERENCE, true); + store.setDefault(BRACKET_MATCHING_COLOR_PREFERENCE, "155,155,155"); //$NON-NLS-1$ + } +} diff --git a/qt/org.eclipse.cdt.qt.ui/src/org/eclipse/cdt/internal/qt/ui/editor/QtProjectFileKeyword.java b/qt/org.eclipse.cdt.qt.ui/src/org/eclipse/cdt/internal/qt/ui/editor/QtProjectFileKeyword.java index 323a922f19b..4389ef2b72b 100644 --- a/qt/org.eclipse.cdt.qt.ui/src/org/eclipse/cdt/internal/qt/ui/editor/QtProjectFileKeyword.java +++ b/qt/org.eclipse.cdt.qt.ui/src/org/eclipse/cdt/internal/qt/ui/editor/QtProjectFileKeyword.java @@ -1,329 +1,329 @@ -/******************************************************************************* - * Copyright (c) 2015 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.internal.qt.ui.editor; - -import java.util.ArrayList; - -/** - * Various keywords associated with Qt Project Files. Namely, special function and variable names used by qmake. - */ -public enum QtProjectFileKeyword { - // QMake function keywords - FUNC_MEMBER("member"), //$NON-NLS-1$ - FUNC_FIRST("first"), //$NON-NLS-1$ - FUNC_LAST("last"), //$NON-NLS-1$ - FUNC_SIZE("size"), //$NON-NLS-1$ - FUNC_CAT("cat"), //$NON-NLS-1$ - FUNC_FROMFILE("fromfile"), //$NON-NLS-1$ - FUNC_EVAL("eval"), //$NON-NLS-1$ - FUNC_LIST("list"), //$NON-NLS-1$ - FUNC_SPRINTF("sprintf"), //$NON-NLS-1$ - FUNC_FORMAT_NUMBER("format_number"), //$NON-NLS-1$ - FUNC_JOIN("join"), //$NON-NLS-1$ - FUNC_SPLIT("split"), //$NON-NLS-1$ - FUNC_BASENAME("basename"), //$NON-NLS-1$ - FUNC_DIRNAME("dirname"), //$NON-NLS-1$ - FUNC_SECTION("section"), //$NON-NLS-1$ - FUNC_FIND("find"), //$NON-NLS-1$ - FUNC_SYSTEM("system"), //$NON-NLS-1$ - FUNC_UNIQUE("unique"), //$NON-NLS-1$ - FUNC_REVERSE("reverse"), //$NON-NLS-1$ - FUNC_QUOTE("quote"), //$NON-NLS-1$ - FUNC_ESCAPE_EXPAND("escape_expand"), //$NON-NLS-1$ - FUNC_UPPER("upper"), //$NON-NLS-1$ - FUNC_LOWER("lower"), //$NON-NLS-1$ - FUNC_TITLE("title"), //$NON-NLS-1$ - FUNC_RE_ESCAPE("re_escape"), //$NON-NLS-1$ - FUNC_VAL_ESCAPE("val_escape"), //$NON-NLS-1$ - FUNC_FILES("files"), //$NON-NLS-1$ - FUNC_PROMPT("prompt"), //$NON-NLS-1$ - FUNC_REPLACE("replace"), //$NON-NLS-1$ - FUNC_SORT_DEPENDS("sort_depends"), //$NON-NLS-1$ - FUNC_RESOLVE_DEPENDS("resolve_depends"), //$NON-NLS-1$ - FUNC_ENUMERATE_VARS("enumerate_vars"), //$NON-NLS-1$ - FUNC_SHADOWED("shadowed"), //$NON-NLS-1$ - FUNC_ABSOLUTE_PATH("absolute_path"), //$NON-NLS-1$ - FUNC_RELATIVE_PATH("relative_path"), //$NON-NLS-1$ - FUNC_CLEAN_PATH("clean_path"), //$NON-NLS-1$ - FUNC_SYSTEM_PATH("system_path"), //$NON-NLS-1$ - FUNC_SHELL_PATH("shell_path"), //$NON-NLS-1$ - FUNC_SYSTEM_QUOTE("system_quote"), //$NON-NLS-1$ - FUNC_SHELL_QUOTE("shell_quote"), //$NON-NLS-1$ - FUNC_REQUIRES("requires"), //$NON-NLS-1$ - FUNC_GREATERTHAN("greaterThan"), //$NON-NLS-1$ - FUNC_LESSTHAN("lessThan"), //$NON-NLS-1$ - FUNC_EQUALS("equals"), //$NON-NLS-1$ - FUNC_ISEQUAL("isEqual"), //$NON-NLS-1$ - FUNC_EXISTS("exists"), //$NON-NLS-1$ - FUNC_EXPORT("export"), //$NON-NLS-1$ - FUNC_CLEAR("clear"), //$NON-NLS-1$ - FUNC_UNSET("unset"), //$NON-NLS-1$ - FUNC_IF("if"), //$NON-NLS-1$ - FUNC_ISACTIVECONFIG("isActiveConfig"), //$NON-NLS-1$ - FUNC_DEFINED("defined"), //$NON-NLS-1$ - FUNC_CONTAINS("contains"), //$NON-NLS-1$ - FUNC_INFILE("infile"), //$NON-NLS-1$ - FUNC_COUNT("count"), //$NON-NLS-1$ - FUNC_ISEMPTY("isEmpty"), //$NON-NLS-1$ - FUNC_PARSEJSON("parseJson"), //$NON-NLS-1$ - FUNC_LOAD("load"), //$NON-NLS-1$ - FUNC_INCLUDE("include"), //$NON-NLS-1$ - FUNC_DEBUG("debug"), //$NON-NLS-1$ - FUNC_LOG("log"), //$NON-NLS-1$ - FUNC_MESSAGE("message"), //$NON-NLS-1$ - FUNC_WARNING("warning"), //$NON-NLS-1$ - FUNC_ERROR("error"), //$NON-NLS-1$ - FUNC_MKPATH("mkpath"), //$NON-NLS-1$ - FUNC_WRITE_FILE("write_file"), //$NON-NLS-1$ - FUNC_TOUCH("touch"), //$NON-NLS-1$ - FUNC_CACHE("cache"), //$NON-NLS-1$ - - // QMake variable keywords - VAR_CCFLAG("CCFLAG"), //$NON-NLS-1$ - VAR_CLEAN_DEPS("CLEAN_DEPS"), //$NON-NLS-1$ - VAR_CONFIG("CONFIG"), //$NON-NLS-1$ - VAR_DEFINES("DEFINES"), //$NON-NLS-1$ - VAR_DEF_FILE("DEF_FILE"), //$NON-NLS-1$ - VAR_DEPENDPATH("DEPENDPATH"), //$NON-NLS-1$ - VAR_DEPLOYMENT("DEPLOYMENT"), //$NON-NLS-1$ - VAR_DEPLOYMENT_PLUGIN("DEPLOYMENT_PLUGIN"), //$NON-NLS-1$ - VAR_DESTDIR("DESTDIR"), //$NON-NLS-1$ - VAR_DESTDIR_TARGET("DESTDIR_TARGET"), //$NON-NLS-1$ - VAR_DISTFILES("DISTFILES"), //$NON-NLS-1$ - VAR_DLLDESTDIR("DLLDESTDIR"), //$NON-NLS-1$ - VAR_DSP_TEMPLATE("DSP_TEMPLATE"), //$NON-NLS-1$ - VAR_FORMS("FORMS"), //$NON-NLS-1$ - VAR_FORMS3("FORMS3"), //$NON-NLS-1$ - VAR_GUID("GUID"), //$NON-NLS-1$ - VAR_HEADERS("HEADERS"), //$NON-NLS-1$ - VAR_ICON("ICON"), //$NON-NLS-1$ - VAR_INCLUDEPATH("INCLUDEPATH"), //$NON-NLS-1$ - VAR_INSTALLS("INSTALLS"), //$NON-NLS-1$ - VAR_LEXIMPLS("LEXIMPLS"), //$NON-NLS-1$ - VAR_LEXOBJECTS("LEXOBJECTS"), //$NON-NLS-1$ - VAR_LEXSOURCES("LEXSOURCES"), //$NON-NLS-1$ - VAR_LIBS("LIBS"), //$NON-NLS-1$ - VAR_LITERAL_HASH("LITERAL_HASH"), //$NON-NLS-1$ - VAR_MAKEFILE("MAKEFILE"), //$NON-NLS-1$ - VAR_MAKEFILE_GENERATOR("MAKEFILE_GENERATOR"), //$NON-NLS-1$ - VAR_MOBILITY("MOBILITY"), //$NON-NLS-1$ - VAR_MOC_DIR("MOC_DIR"), //$NON-NLS-1$ - VAR_OBJECTIVE_HEADERS("OBJECTIVE_HEADERS"), //$NON-NLS-1$ - VAR_OBJECTIVE_SOURCES("OBJECTIVE_SOURCES"), //$NON-NLS-1$ - VAR_OBJECTS("OBJECTS"), //$NON-NLS-1$ - VAR_OBJECTS_DIR("OBJECTS_DIR"), //$NON-NLS-1$ - VAR_OBJMOC("OBJMOC"), //$NON-NLS-1$ - VAR_OTHER_FILES("OTHER_FILES"), //$NON-NLS-1$ - VAR_OUT_PWD("OUT_PWD"), //$NON-NLS-1$ - VAR_PKGCONFIG("PKGCONFIG"), //$NON-NLS-1$ - VAR_POST_TARGETDEPS("POST_TARGETDEPS"), //$NON-NLS-1$ - VAR_PRECOMPILED_HEADER("PRECOMPILED_HEADER"), //$NON-NLS-1$ - VAR_PRE_TARGETDEPS("PRE_TARGETDEPS"), //$NON-NLS-1$ - VAR_PWD("PWD"), //$NON-NLS-1$ - VAR_QMAKE("QMAKE"), //$NON-NLS-1$ - VAR_QMAKESPEC("QMAKESPEC"), //$NON-NLS-1$ - VAR_QMAKE_APP_FLAG("QMAKE_APP_FLAG"), //$NON-NLS-1$ - VAR_QMAKE_APP_OR_DLL("QMAKE_APP_OR_DLL"), //$NON-NLS-1$ - VAR_QMAKE_AR_CMD("QMAKE_AR_CMD"), //$NON-NLS-1$ - VAR_QMAKE_BUNDLE_DATA("QMAKE_BUNDLE_DATA"), //$NON-NLS-1$ - VAR_QMAKE_BUNDLE_EXTENSION("QMAKE_BUNDLE_EXTENSION"), //$NON-NLS-1$ - VAR_QMAKE_CC("QMAKE_CC"), //$NON-NLS-1$ - VAR_QMAKE_CFLAGS("QMAKE_CFLAGS"), //$NON-NLS-1$ - VAR_QMAKE_CFLAGS_DEBUG("QMAKE_CFLAGS_DEBUG"), //$NON-NLS-1$ - VAR_QMAKE_CFLAGS_MT("QMAKE_CFLAGS_MT"), //$NON-NLS-1$ - VAR_QMAKE_CFLAGS_MT_DBG("QMAKE_CFLAGS_MT_DBG"), //$NON-NLS-1$ - VAR_QMAKE_CFLAGS_MT_DLL("QMAKE_CFLAGS_MT_DLL"), //$NON-NLS-1$ - VAR_QMAKE_CFLAGS_MT_DLLDBG("QMAKE_CFLAGS_MT_DLLDBG"), //$NON-NLS-1$ - VAR_QMAKE_CFLAGS_RELEASE("QMAKE_CFLAGS_RELEASE"), //$NON-NLS-1$ - VAR_QMAKE_CFLAGS_SHLIB("QMAKE_CFLAGS_SHLIB"), //$NON-NLS-1$ - VAR_QMAKE_CFLAGS_THREAD("QMAKE_CFLAGS_THREAD"), //$NON-NLS-1$ - VAR_QMAKE_CFLAGS_WARN_OFF("QMAKE_CFLAGS_WARN_OFF"), //$NON-NLS-1$ - VAR_QMAKE_CFLAGS_WARN_ON("QMAKE_CFLAGS_WARN_ON"), //$NON-NLS-1$ - VAR_QMAKE_CLEAN("QMAKE_CLEAN"), //$NON-NLS-1$ - VAR_QMAKE_CXX("QMAKE_CXX"), //$NON-NLS-1$ - VAR_QMAKE_CXXFLAGS("QMAKE_CXXFLAGS"), //$NON-NLS-1$ - VAR_QMAKE_CXXFLAGS_DEBUG("QMAKE_CXXFLAGS_DEBUG"), //$NON-NLS-1$ - VAR_QMAKE_CXXFLAGS_MT("QMAKE_CXXFLAGS_MT"), //$NON-NLS-1$ - VAR_QMAKE_CXXFLAGS_MT_DBG("QMAKE_CXXFLAGS_MT_DBG"), //$NON-NLS-1$ - VAR_QMAKE_CXXFLAGS_MT_DLL("QMAKE_CXXFLAGS_MT_DLL"), //$NON-NLS-1$ - VAR_QMAKE_CXXFLAGS_MT_DLLDBG("QMAKE_CXXFLAGS_MT_DLLDBG"), //$NON-NLS-1$ - VAR_QMAKE_CXXFLAGS_RELEASE("QMAKE_CXXFLAGS_RELEASE"), //$NON-NLS-1$ - VAR_QMAKE_CXXFLAGS_SHLIB("QMAKE_CXXFLAGS_SHLIB"), //$NON-NLS-1$ - VAR_QMAKE_CXXFLAGS_THREAD("QMAKE_CXXFLAGS_THREAD"), //$NON-NLS-1$ - VAR_QMAKE_CXXFLAGS_WARN_OFF("QMAKE_CXXFLAGS_WARN_OFF"), //$NON-NLS-1$ - VAR_QMAKE_CXXFLAGS_WARN_ON("QMAKE_CXXFLAGS_WARN_ON"), //$NON-NLS-1$ - VAR_QMAKE_DISTCLEAN("QMAKE_DISTCLEAN"), //$NON-NLS-1$ - VAR_QMAKE_EXTENSION_SHLIB("QMAKE_EXTENSION_SHLIB"), //$NON-NLS-1$ - VAR_QMAKE_EXTRA_COMPILERS("QMAKE_EXTRA_COMPILERS"), //$NON-NLS-1$ - VAR_QMAKE_EXTRA_TARGETS("QMAKE_EXTRA_TARGETS"), //$NON-NLS-1$ - VAR_QMAKE_EXT_CPP("QMAKE_EXT_CPP"), //$NON-NLS-1$ - VAR_QMAKE_EXT_H("QMAKE_EXT_H"), //$NON-NLS-1$ - VAR_QMAKE_EXT_LEX("QMAKE_EXT_LEX"), //$NON-NLS-1$ - VAR_QMAKE_EXT_MOC("QMAKE_EXT_MOC"), //$NON-NLS-1$ - VAR_QMAKE_EXT_OBJ("QMAKE_EXT_OBJ"), //$NON-NLS-1$ - VAR_QMAKE_EXT_PRL("QMAKE_EXT_PRL"), //$NON-NLS-1$ - VAR_QMAKE_EXT_UI("QMAKE_EXT_UI"), //$NON-NLS-1$ - VAR_QMAKE_EXT_YACC("QMAKE_EXT_YACC"), //$NON-NLS-1$ - VAR_QMAKE_FAILED_REQUIREMENTS("QMAKE_FAILED_REQUIREMENTS"), //$NON-NLS-1$ - VAR_QMAKE_FRAMEWORK_BUNDLE_NAME("QMAKE_FRAMEWORK_BUNDLE_NAME"), //$NON-NLS-1$ - VAR_QMAKE_FRAMEWORK_VERSION("QMAKE_FRAMEWORK_VERSION"), //$NON-NLS-1$ - VAR_QMAKE_INCDIR("QMAKE_INCDIR"), //$NON-NLS-1$ - VAR_QMAKE_INCDIR_EGL("QMAKE_INCDIR_EGL"), //$NON-NLS-1$ - VAR_QMAKE_INCDIR_OPENGL("QMAKE_INCDIR_OPENGL"), //$NON-NLS-1$ - VAR_QMAKE_INCDIR_OPENGL_ES1("QMAKE_INCDIR_OPENGL_ES1"), //$NON-NLS-1$ - VAR_QMAKE_INCDIR_OPENGL_ES2("QMAKE_INCDIR_OPENGL_ES2"), //$NON-NLS-1$ - VAR_QMAKE_INCDIR_OPENVG("QMAKE_INCDIR_OPENVG"), //$NON-NLS-1$ - VAR_QMAKE_INCDIR_QT("QMAKE_INCDIR_QT"), //$NON-NLS-1$ - VAR_QMAKE_INCDIR_THREAD("QMAKE_INCDIR_THREAD"), //$NON-NLS-1$ - VAR_QMAKE_INCDIR_X("QMAKE_INCDIR_X11"), //$NON-NLS-1$ - VAR_QMAKE_INFO_PLIST("QMAKE_INFO_PLIST"), //$NON-NLS-1$ - VAR_QMAKE_LFLAGS("QMAKE_LFLAGS"), //$NON-NLS-1$ - VAR_QMAKE_LFLAGS_CONSOLE("QMAKE_LFLAGS_CONSOLE"), //$NON-NLS-1$ - VAR_QMAKE_LFLAGS_CONSOLE_DLL("QMAKE_LFLAGS_CONSOLE_DLL"), //$NON-NLS-1$ - VAR_QMAKE_LFLAGS_DEBUG("QMAKE_LFLAGS_DEBUG"), //$NON-NLS-1$ - VAR_QMAKE_LFLAGS_PLUGIN("QMAKE_LFLAGS_PLUGIN"), //$NON-NLS-1$ - VAR_QMAKE_LFLAGS_QT_DLL("QMAKE_LFLAGS_QT_DLL"), //$NON-NLS-1$ - VAR_QMAKE_LFLAGS_RELEASE("QMAKE_LFLAGS_RELEASE"), //$NON-NLS-1$ - VAR_QMAKE_LFLAGS_RPATH("QMAKE_LFLAGS_RPATH"), //$NON-NLS-1$ - VAR_QMAKE_LFLAGS_SHAPP("QMAKE_LFLAGS_SHAPP"), //$NON-NLS-1$ - VAR_QMAKE_LFLAGS_SHLIB("QMAKE_LFLAGS_SHLIB"), //$NON-NLS-1$ - VAR_QMAKE_LFLAGS_SONAME("QMAKE_LFLAGS_SONAME"), //$NON-NLS-1$ - VAR_QMAKE_LFLAGS_THREAD("QMAKE_LFLAGS_THREAD"), //$NON-NLS-1$ - VAR_QMAKE_LFLAGS_WINDOWS("QMAKE_LFLAGS_WINDOWS"), //$NON-NLS-1$ - VAR_QMAKE_LFLAGS_WINDOWS_DLL("QMAKE_LFLAGS_WINDOWS_DLL"), //$NON-NLS-1$ - VAR_QMAKE_LIBDIR("QMAKE_LIBDIR"), //$NON-NLS-1$ - VAR_QMAKE_LIBDIR_EGL("QMAKE_LIBDIR_EGL"), //$NON-NLS-1$ - VAR_QMAKE_LIBDIR_FLAGS("QMAKE_LIBDIR_FLAGS"), //$NON-NLS-1$ - VAR_QMAKE_LIBDIR_OPENGL("QMAKE_LIBDIR_OPENGL"), //$NON-NLS-1$ - VAR_QMAKE_LIBDIR_OPENVG("QMAKE_LIBDIR_OPENVG"), //$NON-NLS-1$ - VAR_QMAKE_LIBDIR_QT("QMAKE_LIBDIR_QT"), //$NON-NLS-1$ - VAR_QMAKE_LIBDIR_X("QMAKE_LIBDIR_X11"), //$NON-NLS-1$ - VAR_QMAKE_LIBS("QMAKE_LIBS"), //$NON-NLS-1$ - VAR_QMAKE_LIBS_CONSOLE("QMAKE_LIBS_CONSOLE"), //$NON-NLS-1$ - VAR_QMAKE_LIBS_EGL("QMAKE_LIBS_EGL"), //$NON-NLS-1$ - VAR_QMAKE_LIBS_OPENGL("QMAKE_LIBS_OPENGL"), //$NON-NLS-1$ - VAR_QMAKE_LIBS_OPENGL_ES1("QMAKE_LIBS_OPENGL_ES1"), //$NON-NLS-1$ - VAR_QMAKE_LIBS_OPENGL_ES2("QMAKE_LIBS_OPENGL_ES2"), //$NON-NLS-1$ - VAR_QMAKE_LIBS_OPENGL_QT("QMAKE_LIBS_OPENGL_QT"), //$NON-NLS-1$ - VAR_QMAKE_LIBS_OPENVG("QMAKE_LIBS_OPENVG"), //$NON-NLS-1$ - VAR_QMAKE_LIBS_QT("QMAKE_LIBS_QT"), //$NON-NLS-1$ - VAR_QMAKE_LIBS_QT_DLL("QMAKE_LIBS_QT_DLL"), //$NON-NLS-1$ - VAR_QMAKE_LIBS_QT_OPENGL("QMAKE_LIBS_QT_OPENGL"), //$NON-NLS-1$ - VAR_QMAKE_LIBS_QT_THREAD("QMAKE_LIBS_QT_THREAD"), //$NON-NLS-1$ - VAR_QMAKE_LIBS_RT("QMAKE_LIBS_RT"), //$NON-NLS-1$ - VAR_QMAKE_LIBS_RTMT("QMAKE_LIBS_RTMT"), //$NON-NLS-1$ - VAR_QMAKE_LIBS_THREAD("QMAKE_LIBS_THREAD"), //$NON-NLS-1$ - VAR_QMAKE_LIBS_WINDOWS("QMAKE_LIBS_WINDOWS"), //$NON-NLS-1$ - VAR_QMAKE_LIBS_X11("QMAKE_LIBS_X11"), //$NON-NLS-1$ - VAR_QMAKE_LIBS_X11SM("QMAKE_LIBS_X11SM"), //$NON-NLS-1$ - VAR_QMAKE_LIB_FLAG("QMAKE_LIB_FLAG"), //$NON-NLS-1$ - VAR_QMAKE_LINK("QMAKE_LINK"), //$NON-NLS-1$ - VAR_QMAKE_LINK_SHLIB_CMD("QMAKE_LINK_SHLIB_CMD"), //$NON-NLS-1$ - VAR_QMAKE_LN_SHLIB("QMAKE_LN_SHLIB"), //$NON-NLS-1$ - VAR_QMAKE_MACOSX_DEPLOYMENT_TARGET("QMAKE_MACOSX_DEPLOYMENT_TARGET"), //$NON-NLS-1$ - VAR_QMAKE_MAC_SDK("QMAKE_MAC_SDK"), //$NON-NLS-1$ - VAR_QMAKE_MAKEFILE("QMAKE_MAKEFILE"), //$NON-NLS-1$ - VAR_QMAKE_MOC_SRC("QMAKE_MOC_SRC"), //$NON-NLS-1$ - VAR_QMAKE_POST_LINK("QMAKE_POST_LINK"), //$NON-NLS-1$ - VAR_QMAKE_PRE_LINK("QMAKE_PRE_LINK"), //$NON-NLS-1$ - VAR_QMAKE_PROJECT_NAME("QMAKE_PROJECT_NAME"), //$NON-NLS-1$ - VAR_QMAKE_QMAKE("QMAKE_QMAKE"), //$NON-NLS-1$ - VAR_QMAKE_QT_DLL("QMAKE_QT_DLL"), //$NON-NLS-1$ - VAR_QMAKE_RESOURCE_FLAGS("QMAKE_RESOURCE_FLAGS"), //$NON-NLS-1$ - VAR_QMAKE_RPATH("QMAKE_RPATH"), //$NON-NLS-1$ - VAR_QMAKE_RPATHDIR("QMAKE_RPATHDIR"), //$NON-NLS-1$ - VAR_QMAKE_RUN_CC("QMAKE_RUN_CC"), //$NON-NLS-1$ - VAR_QMAKE_RUN_CC_IMP("QMAKE_RUN_CC_IMP"), //$NON-NLS-1$ - VAR_QMAKE_RUN_CXX("QMAKE_RUN_CXX"), //$NON-NLS-1$ - VAR_QMAKE_RUN_CXX_IMP("QMAKE_RUN_CXX_IMP"), //$NON-NLS-1$ - VAR_QMAKE_TARGET("QMAKE_TARGET"), //$NON-NLS-1$ - VAR_QMAKE_UIC("QMAKE_UIC"), //$NON-NLS-1$ - VAR_QT("QT"), //$NON-NLS-1$ - VAR_QTPLUGIN("QTPLUGIN"), //$NON-NLS-1$ - VAR_QT_MAJOR_VERSION("QT_MAJOR_VERSION"), //$NON-NLS-1$ - VAR_QT_MINOR_VERSION("QT_MINOR_VERSION"), //$NON-NLS-1$ - VAR_QT_PATCH_VERSION("QT_PATCH_VERSION"), //$NON-NLS-1$ - VAR_QT_VERSION("QT_VERSION"), //$NON-NLS-1$ - VAR_RCC_DIR("RCC_DIR"), //$NON-NLS-1$ - VAR_RC_FILE("RC_FILE"), //$NON-NLS-1$ - VAR_REQUIRES("REQUIRES"), //$NON-NLS-1$ - VAR_RESOURCES("RESOURCES"), //$NON-NLS-1$ - VAR_RES_FILE("RES_FILE"), //$NON-NLS-1$ - VAR_RSS_RULES("RSS_RULES"), //$NON-NLS-1$ - VAR_SIGNATURE_FILE("SIGNATURE_FILE"), //$NON-NLS-1$ - VAR_SOURCES("SOURCES"), //$NON-NLS-1$ - VAR_SRCMOC("SRCMOC"), //$NON-NLS-1$ - VAR_STATECHARTS("STATECHARTS"), //$NON-NLS-1$ - VAR_SUBDIRS("SUBDIRS"), //$NON-NLS-1$ - VAR_TARGET("TARGET"), //$NON-NLS-1$ - VAR_TEMPLATE("TEMPLATE"), //$NON-NLS-1$ - VAR_TRANSLATIONS("TRANSLATIONS"), //$NON-NLS-1$ - VAR_UICIMPLS("UICIMPLS"), //$NON-NLS-1$ - VAR_UICOBJECTS("UICOBJECTS"), //$NON-NLS-1$ - VAR_UI_DIR("UI_DIR"), //$NON-NLS-1$ - VAR_UI_HEADERS_DIR("UI_HEADERS_DIR"), //$NON-NLS-1$ - VAR_UI_SOURCES_DIR("UI_SOURCES_DIR"), //$NON-NLS-1$ - VAR_VERSION("VERSION"), //$NON-NLS-1$ - VAR_VERSION_PE_HEADER("VERSION_PE_HEADER"), //$NON-NLS-1$ - VAR_VER_MAJ("VER_MAJ"), //$NON-NLS-1$ - VAR_VER_MIN("VER_MIN"), //$NON-NLS-1$ - VAR_VER_PAT("VER_PAT"), //$NON-NLS-1$ - VAR_VPATH("VPATH"), //$NON-NLS-1$ - VAR_YACCIMPLS("YACCIMPLS"), //$NON-NLS-1$ - VAR_YACCOBJECTS("YACCOBJECTS"), //$NON-NLS-1$ - VAR_YACCSOURCES("YACCSOURCES"), //$NON-NLS-1$ - VAR__PRO_FILE_("_PRO_FILE_"), //$NON-NLS-1$ - VAR__PRO_FILE_PWD_("_PRO_FILE_PWD_"); //$NON-NLS-1$ - - private final String keyword; - - QtProjectFileKeyword(String key) { - this.keyword = key; - } - - /** - * Returns a String containing this keyword's identifier. - * - * @return a string - */ - public String getKeyword() { - return keyword; - } - - private static QtProjectFileKeyword[] getKeywordsWithPrefix(String prefix) { - ArrayList list = new ArrayList<>(); - for (QtProjectFileKeyword word : QtProjectFileKeyword.values()) { - if (word.name().startsWith(prefix)) { - list.add(word); - } - } - QtProjectFileKeyword[] array = new QtProjectFileKeyword[list.size()]; - return list.toArray(array); - } - - /** - * Returns all keywords associated with functions in qmake. - * - * @return an array of keywords - */ - public static QtProjectFileKeyword[] getFunctionKeywords() { - return getKeywordsWithPrefix("FUNC_"); //$NON-NLS-1$ - } - - /** - * Returns all keywords associated with variables in qmake. - * - * @return an array of keywords - */ - public static QtProjectFileKeyword[] getVariableKeywords() { - return getKeywordsWithPrefix("VAR_"); //$NON-NLS-1$ - } -} +/******************************************************************************* + * Copyright (c) 2015 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.internal.qt.ui.editor; + +import java.util.ArrayList; + +/** + * Various keywords associated with Qt Project Files. Namely, special function and variable names used by qmake. + */ +public enum QtProjectFileKeyword { + // QMake function keywords + FUNC_MEMBER("member"), //$NON-NLS-1$ + FUNC_FIRST("first"), //$NON-NLS-1$ + FUNC_LAST("last"), //$NON-NLS-1$ + FUNC_SIZE("size"), //$NON-NLS-1$ + FUNC_CAT("cat"), //$NON-NLS-1$ + FUNC_FROMFILE("fromfile"), //$NON-NLS-1$ + FUNC_EVAL("eval"), //$NON-NLS-1$ + FUNC_LIST("list"), //$NON-NLS-1$ + FUNC_SPRINTF("sprintf"), //$NON-NLS-1$ + FUNC_FORMAT_NUMBER("format_number"), //$NON-NLS-1$ + FUNC_JOIN("join"), //$NON-NLS-1$ + FUNC_SPLIT("split"), //$NON-NLS-1$ + FUNC_BASENAME("basename"), //$NON-NLS-1$ + FUNC_DIRNAME("dirname"), //$NON-NLS-1$ + FUNC_SECTION("section"), //$NON-NLS-1$ + FUNC_FIND("find"), //$NON-NLS-1$ + FUNC_SYSTEM("system"), //$NON-NLS-1$ + FUNC_UNIQUE("unique"), //$NON-NLS-1$ + FUNC_REVERSE("reverse"), //$NON-NLS-1$ + FUNC_QUOTE("quote"), //$NON-NLS-1$ + FUNC_ESCAPE_EXPAND("escape_expand"), //$NON-NLS-1$ + FUNC_UPPER("upper"), //$NON-NLS-1$ + FUNC_LOWER("lower"), //$NON-NLS-1$ + FUNC_TITLE("title"), //$NON-NLS-1$ + FUNC_RE_ESCAPE("re_escape"), //$NON-NLS-1$ + FUNC_VAL_ESCAPE("val_escape"), //$NON-NLS-1$ + FUNC_FILES("files"), //$NON-NLS-1$ + FUNC_PROMPT("prompt"), //$NON-NLS-1$ + FUNC_REPLACE("replace"), //$NON-NLS-1$ + FUNC_SORT_DEPENDS("sort_depends"), //$NON-NLS-1$ + FUNC_RESOLVE_DEPENDS("resolve_depends"), //$NON-NLS-1$ + FUNC_ENUMERATE_VARS("enumerate_vars"), //$NON-NLS-1$ + FUNC_SHADOWED("shadowed"), //$NON-NLS-1$ + FUNC_ABSOLUTE_PATH("absolute_path"), //$NON-NLS-1$ + FUNC_RELATIVE_PATH("relative_path"), //$NON-NLS-1$ + FUNC_CLEAN_PATH("clean_path"), //$NON-NLS-1$ + FUNC_SYSTEM_PATH("system_path"), //$NON-NLS-1$ + FUNC_SHELL_PATH("shell_path"), //$NON-NLS-1$ + FUNC_SYSTEM_QUOTE("system_quote"), //$NON-NLS-1$ + FUNC_SHELL_QUOTE("shell_quote"), //$NON-NLS-1$ + FUNC_REQUIRES("requires"), //$NON-NLS-1$ + FUNC_GREATERTHAN("greaterThan"), //$NON-NLS-1$ + FUNC_LESSTHAN("lessThan"), //$NON-NLS-1$ + FUNC_EQUALS("equals"), //$NON-NLS-1$ + FUNC_ISEQUAL("isEqual"), //$NON-NLS-1$ + FUNC_EXISTS("exists"), //$NON-NLS-1$ + FUNC_EXPORT("export"), //$NON-NLS-1$ + FUNC_CLEAR("clear"), //$NON-NLS-1$ + FUNC_UNSET("unset"), //$NON-NLS-1$ + FUNC_IF("if"), //$NON-NLS-1$ + FUNC_ISACTIVECONFIG("isActiveConfig"), //$NON-NLS-1$ + FUNC_DEFINED("defined"), //$NON-NLS-1$ + FUNC_CONTAINS("contains"), //$NON-NLS-1$ + FUNC_INFILE("infile"), //$NON-NLS-1$ + FUNC_COUNT("count"), //$NON-NLS-1$ + FUNC_ISEMPTY("isEmpty"), //$NON-NLS-1$ + FUNC_PARSEJSON("parseJson"), //$NON-NLS-1$ + FUNC_LOAD("load"), //$NON-NLS-1$ + FUNC_INCLUDE("include"), //$NON-NLS-1$ + FUNC_DEBUG("debug"), //$NON-NLS-1$ + FUNC_LOG("log"), //$NON-NLS-1$ + FUNC_MESSAGE("message"), //$NON-NLS-1$ + FUNC_WARNING("warning"), //$NON-NLS-1$ + FUNC_ERROR("error"), //$NON-NLS-1$ + FUNC_MKPATH("mkpath"), //$NON-NLS-1$ + FUNC_WRITE_FILE("write_file"), //$NON-NLS-1$ + FUNC_TOUCH("touch"), //$NON-NLS-1$ + FUNC_CACHE("cache"), //$NON-NLS-1$ + + // QMake variable keywords + VAR_CCFLAG("CCFLAG"), //$NON-NLS-1$ + VAR_CLEAN_DEPS("CLEAN_DEPS"), //$NON-NLS-1$ + VAR_CONFIG("CONFIG"), //$NON-NLS-1$ + VAR_DEFINES("DEFINES"), //$NON-NLS-1$ + VAR_DEF_FILE("DEF_FILE"), //$NON-NLS-1$ + VAR_DEPENDPATH("DEPENDPATH"), //$NON-NLS-1$ + VAR_DEPLOYMENT("DEPLOYMENT"), //$NON-NLS-1$ + VAR_DEPLOYMENT_PLUGIN("DEPLOYMENT_PLUGIN"), //$NON-NLS-1$ + VAR_DESTDIR("DESTDIR"), //$NON-NLS-1$ + VAR_DESTDIR_TARGET("DESTDIR_TARGET"), //$NON-NLS-1$ + VAR_DISTFILES("DISTFILES"), //$NON-NLS-1$ + VAR_DLLDESTDIR("DLLDESTDIR"), //$NON-NLS-1$ + VAR_DSP_TEMPLATE("DSP_TEMPLATE"), //$NON-NLS-1$ + VAR_FORMS("FORMS"), //$NON-NLS-1$ + VAR_FORMS3("FORMS3"), //$NON-NLS-1$ + VAR_GUID("GUID"), //$NON-NLS-1$ + VAR_HEADERS("HEADERS"), //$NON-NLS-1$ + VAR_ICON("ICON"), //$NON-NLS-1$ + VAR_INCLUDEPATH("INCLUDEPATH"), //$NON-NLS-1$ + VAR_INSTALLS("INSTALLS"), //$NON-NLS-1$ + VAR_LEXIMPLS("LEXIMPLS"), //$NON-NLS-1$ + VAR_LEXOBJECTS("LEXOBJECTS"), //$NON-NLS-1$ + VAR_LEXSOURCES("LEXSOURCES"), //$NON-NLS-1$ + VAR_LIBS("LIBS"), //$NON-NLS-1$ + VAR_LITERAL_HASH("LITERAL_HASH"), //$NON-NLS-1$ + VAR_MAKEFILE("MAKEFILE"), //$NON-NLS-1$ + VAR_MAKEFILE_GENERATOR("MAKEFILE_GENERATOR"), //$NON-NLS-1$ + VAR_MOBILITY("MOBILITY"), //$NON-NLS-1$ + VAR_MOC_DIR("MOC_DIR"), //$NON-NLS-1$ + VAR_OBJECTIVE_HEADERS("OBJECTIVE_HEADERS"), //$NON-NLS-1$ + VAR_OBJECTIVE_SOURCES("OBJECTIVE_SOURCES"), //$NON-NLS-1$ + VAR_OBJECTS("OBJECTS"), //$NON-NLS-1$ + VAR_OBJECTS_DIR("OBJECTS_DIR"), //$NON-NLS-1$ + VAR_OBJMOC("OBJMOC"), //$NON-NLS-1$ + VAR_OTHER_FILES("OTHER_FILES"), //$NON-NLS-1$ + VAR_OUT_PWD("OUT_PWD"), //$NON-NLS-1$ + VAR_PKGCONFIG("PKGCONFIG"), //$NON-NLS-1$ + VAR_POST_TARGETDEPS("POST_TARGETDEPS"), //$NON-NLS-1$ + VAR_PRECOMPILED_HEADER("PRECOMPILED_HEADER"), //$NON-NLS-1$ + VAR_PRE_TARGETDEPS("PRE_TARGETDEPS"), //$NON-NLS-1$ + VAR_PWD("PWD"), //$NON-NLS-1$ + VAR_QMAKE("QMAKE"), //$NON-NLS-1$ + VAR_QMAKESPEC("QMAKESPEC"), //$NON-NLS-1$ + VAR_QMAKE_APP_FLAG("QMAKE_APP_FLAG"), //$NON-NLS-1$ + VAR_QMAKE_APP_OR_DLL("QMAKE_APP_OR_DLL"), //$NON-NLS-1$ + VAR_QMAKE_AR_CMD("QMAKE_AR_CMD"), //$NON-NLS-1$ + VAR_QMAKE_BUNDLE_DATA("QMAKE_BUNDLE_DATA"), //$NON-NLS-1$ + VAR_QMAKE_BUNDLE_EXTENSION("QMAKE_BUNDLE_EXTENSION"), //$NON-NLS-1$ + VAR_QMAKE_CC("QMAKE_CC"), //$NON-NLS-1$ + VAR_QMAKE_CFLAGS("QMAKE_CFLAGS"), //$NON-NLS-1$ + VAR_QMAKE_CFLAGS_DEBUG("QMAKE_CFLAGS_DEBUG"), //$NON-NLS-1$ + VAR_QMAKE_CFLAGS_MT("QMAKE_CFLAGS_MT"), //$NON-NLS-1$ + VAR_QMAKE_CFLAGS_MT_DBG("QMAKE_CFLAGS_MT_DBG"), //$NON-NLS-1$ + VAR_QMAKE_CFLAGS_MT_DLL("QMAKE_CFLAGS_MT_DLL"), //$NON-NLS-1$ + VAR_QMAKE_CFLAGS_MT_DLLDBG("QMAKE_CFLAGS_MT_DLLDBG"), //$NON-NLS-1$ + VAR_QMAKE_CFLAGS_RELEASE("QMAKE_CFLAGS_RELEASE"), //$NON-NLS-1$ + VAR_QMAKE_CFLAGS_SHLIB("QMAKE_CFLAGS_SHLIB"), //$NON-NLS-1$ + VAR_QMAKE_CFLAGS_THREAD("QMAKE_CFLAGS_THREAD"), //$NON-NLS-1$ + VAR_QMAKE_CFLAGS_WARN_OFF("QMAKE_CFLAGS_WARN_OFF"), //$NON-NLS-1$ + VAR_QMAKE_CFLAGS_WARN_ON("QMAKE_CFLAGS_WARN_ON"), //$NON-NLS-1$ + VAR_QMAKE_CLEAN("QMAKE_CLEAN"), //$NON-NLS-1$ + VAR_QMAKE_CXX("QMAKE_CXX"), //$NON-NLS-1$ + VAR_QMAKE_CXXFLAGS("QMAKE_CXXFLAGS"), //$NON-NLS-1$ + VAR_QMAKE_CXXFLAGS_DEBUG("QMAKE_CXXFLAGS_DEBUG"), //$NON-NLS-1$ + VAR_QMAKE_CXXFLAGS_MT("QMAKE_CXXFLAGS_MT"), //$NON-NLS-1$ + VAR_QMAKE_CXXFLAGS_MT_DBG("QMAKE_CXXFLAGS_MT_DBG"), //$NON-NLS-1$ + VAR_QMAKE_CXXFLAGS_MT_DLL("QMAKE_CXXFLAGS_MT_DLL"), //$NON-NLS-1$ + VAR_QMAKE_CXXFLAGS_MT_DLLDBG("QMAKE_CXXFLAGS_MT_DLLDBG"), //$NON-NLS-1$ + VAR_QMAKE_CXXFLAGS_RELEASE("QMAKE_CXXFLAGS_RELEASE"), //$NON-NLS-1$ + VAR_QMAKE_CXXFLAGS_SHLIB("QMAKE_CXXFLAGS_SHLIB"), //$NON-NLS-1$ + VAR_QMAKE_CXXFLAGS_THREAD("QMAKE_CXXFLAGS_THREAD"), //$NON-NLS-1$ + VAR_QMAKE_CXXFLAGS_WARN_OFF("QMAKE_CXXFLAGS_WARN_OFF"), //$NON-NLS-1$ + VAR_QMAKE_CXXFLAGS_WARN_ON("QMAKE_CXXFLAGS_WARN_ON"), //$NON-NLS-1$ + VAR_QMAKE_DISTCLEAN("QMAKE_DISTCLEAN"), //$NON-NLS-1$ + VAR_QMAKE_EXTENSION_SHLIB("QMAKE_EXTENSION_SHLIB"), //$NON-NLS-1$ + VAR_QMAKE_EXTRA_COMPILERS("QMAKE_EXTRA_COMPILERS"), //$NON-NLS-1$ + VAR_QMAKE_EXTRA_TARGETS("QMAKE_EXTRA_TARGETS"), //$NON-NLS-1$ + VAR_QMAKE_EXT_CPP("QMAKE_EXT_CPP"), //$NON-NLS-1$ + VAR_QMAKE_EXT_H("QMAKE_EXT_H"), //$NON-NLS-1$ + VAR_QMAKE_EXT_LEX("QMAKE_EXT_LEX"), //$NON-NLS-1$ + VAR_QMAKE_EXT_MOC("QMAKE_EXT_MOC"), //$NON-NLS-1$ + VAR_QMAKE_EXT_OBJ("QMAKE_EXT_OBJ"), //$NON-NLS-1$ + VAR_QMAKE_EXT_PRL("QMAKE_EXT_PRL"), //$NON-NLS-1$ + VAR_QMAKE_EXT_UI("QMAKE_EXT_UI"), //$NON-NLS-1$ + VAR_QMAKE_EXT_YACC("QMAKE_EXT_YACC"), //$NON-NLS-1$ + VAR_QMAKE_FAILED_REQUIREMENTS("QMAKE_FAILED_REQUIREMENTS"), //$NON-NLS-1$ + VAR_QMAKE_FRAMEWORK_BUNDLE_NAME("QMAKE_FRAMEWORK_BUNDLE_NAME"), //$NON-NLS-1$ + VAR_QMAKE_FRAMEWORK_VERSION("QMAKE_FRAMEWORK_VERSION"), //$NON-NLS-1$ + VAR_QMAKE_INCDIR("QMAKE_INCDIR"), //$NON-NLS-1$ + VAR_QMAKE_INCDIR_EGL("QMAKE_INCDIR_EGL"), //$NON-NLS-1$ + VAR_QMAKE_INCDIR_OPENGL("QMAKE_INCDIR_OPENGL"), //$NON-NLS-1$ + VAR_QMAKE_INCDIR_OPENGL_ES1("QMAKE_INCDIR_OPENGL_ES1"), //$NON-NLS-1$ + VAR_QMAKE_INCDIR_OPENGL_ES2("QMAKE_INCDIR_OPENGL_ES2"), //$NON-NLS-1$ + VAR_QMAKE_INCDIR_OPENVG("QMAKE_INCDIR_OPENVG"), //$NON-NLS-1$ + VAR_QMAKE_INCDIR_QT("QMAKE_INCDIR_QT"), //$NON-NLS-1$ + VAR_QMAKE_INCDIR_THREAD("QMAKE_INCDIR_THREAD"), //$NON-NLS-1$ + VAR_QMAKE_INCDIR_X("QMAKE_INCDIR_X11"), //$NON-NLS-1$ + VAR_QMAKE_INFO_PLIST("QMAKE_INFO_PLIST"), //$NON-NLS-1$ + VAR_QMAKE_LFLAGS("QMAKE_LFLAGS"), //$NON-NLS-1$ + VAR_QMAKE_LFLAGS_CONSOLE("QMAKE_LFLAGS_CONSOLE"), //$NON-NLS-1$ + VAR_QMAKE_LFLAGS_CONSOLE_DLL("QMAKE_LFLAGS_CONSOLE_DLL"), //$NON-NLS-1$ + VAR_QMAKE_LFLAGS_DEBUG("QMAKE_LFLAGS_DEBUG"), //$NON-NLS-1$ + VAR_QMAKE_LFLAGS_PLUGIN("QMAKE_LFLAGS_PLUGIN"), //$NON-NLS-1$ + VAR_QMAKE_LFLAGS_QT_DLL("QMAKE_LFLAGS_QT_DLL"), //$NON-NLS-1$ + VAR_QMAKE_LFLAGS_RELEASE("QMAKE_LFLAGS_RELEASE"), //$NON-NLS-1$ + VAR_QMAKE_LFLAGS_RPATH("QMAKE_LFLAGS_RPATH"), //$NON-NLS-1$ + VAR_QMAKE_LFLAGS_SHAPP("QMAKE_LFLAGS_SHAPP"), //$NON-NLS-1$ + VAR_QMAKE_LFLAGS_SHLIB("QMAKE_LFLAGS_SHLIB"), //$NON-NLS-1$ + VAR_QMAKE_LFLAGS_SONAME("QMAKE_LFLAGS_SONAME"), //$NON-NLS-1$ + VAR_QMAKE_LFLAGS_THREAD("QMAKE_LFLAGS_THREAD"), //$NON-NLS-1$ + VAR_QMAKE_LFLAGS_WINDOWS("QMAKE_LFLAGS_WINDOWS"), //$NON-NLS-1$ + VAR_QMAKE_LFLAGS_WINDOWS_DLL("QMAKE_LFLAGS_WINDOWS_DLL"), //$NON-NLS-1$ + VAR_QMAKE_LIBDIR("QMAKE_LIBDIR"), //$NON-NLS-1$ + VAR_QMAKE_LIBDIR_EGL("QMAKE_LIBDIR_EGL"), //$NON-NLS-1$ + VAR_QMAKE_LIBDIR_FLAGS("QMAKE_LIBDIR_FLAGS"), //$NON-NLS-1$ + VAR_QMAKE_LIBDIR_OPENGL("QMAKE_LIBDIR_OPENGL"), //$NON-NLS-1$ + VAR_QMAKE_LIBDIR_OPENVG("QMAKE_LIBDIR_OPENVG"), //$NON-NLS-1$ + VAR_QMAKE_LIBDIR_QT("QMAKE_LIBDIR_QT"), //$NON-NLS-1$ + VAR_QMAKE_LIBDIR_X("QMAKE_LIBDIR_X11"), //$NON-NLS-1$ + VAR_QMAKE_LIBS("QMAKE_LIBS"), //$NON-NLS-1$ + VAR_QMAKE_LIBS_CONSOLE("QMAKE_LIBS_CONSOLE"), //$NON-NLS-1$ + VAR_QMAKE_LIBS_EGL("QMAKE_LIBS_EGL"), //$NON-NLS-1$ + VAR_QMAKE_LIBS_OPENGL("QMAKE_LIBS_OPENGL"), //$NON-NLS-1$ + VAR_QMAKE_LIBS_OPENGL_ES1("QMAKE_LIBS_OPENGL_ES1"), //$NON-NLS-1$ + VAR_QMAKE_LIBS_OPENGL_ES2("QMAKE_LIBS_OPENGL_ES2"), //$NON-NLS-1$ + VAR_QMAKE_LIBS_OPENGL_QT("QMAKE_LIBS_OPENGL_QT"), //$NON-NLS-1$ + VAR_QMAKE_LIBS_OPENVG("QMAKE_LIBS_OPENVG"), //$NON-NLS-1$ + VAR_QMAKE_LIBS_QT("QMAKE_LIBS_QT"), //$NON-NLS-1$ + VAR_QMAKE_LIBS_QT_DLL("QMAKE_LIBS_QT_DLL"), //$NON-NLS-1$ + VAR_QMAKE_LIBS_QT_OPENGL("QMAKE_LIBS_QT_OPENGL"), //$NON-NLS-1$ + VAR_QMAKE_LIBS_QT_THREAD("QMAKE_LIBS_QT_THREAD"), //$NON-NLS-1$ + VAR_QMAKE_LIBS_RT("QMAKE_LIBS_RT"), //$NON-NLS-1$ + VAR_QMAKE_LIBS_RTMT("QMAKE_LIBS_RTMT"), //$NON-NLS-1$ + VAR_QMAKE_LIBS_THREAD("QMAKE_LIBS_THREAD"), //$NON-NLS-1$ + VAR_QMAKE_LIBS_WINDOWS("QMAKE_LIBS_WINDOWS"), //$NON-NLS-1$ + VAR_QMAKE_LIBS_X11("QMAKE_LIBS_X11"), //$NON-NLS-1$ + VAR_QMAKE_LIBS_X11SM("QMAKE_LIBS_X11SM"), //$NON-NLS-1$ + VAR_QMAKE_LIB_FLAG("QMAKE_LIB_FLAG"), //$NON-NLS-1$ + VAR_QMAKE_LINK("QMAKE_LINK"), //$NON-NLS-1$ + VAR_QMAKE_LINK_SHLIB_CMD("QMAKE_LINK_SHLIB_CMD"), //$NON-NLS-1$ + VAR_QMAKE_LN_SHLIB("QMAKE_LN_SHLIB"), //$NON-NLS-1$ + VAR_QMAKE_MACOSX_DEPLOYMENT_TARGET("QMAKE_MACOSX_DEPLOYMENT_TARGET"), //$NON-NLS-1$ + VAR_QMAKE_MAC_SDK("QMAKE_MAC_SDK"), //$NON-NLS-1$ + VAR_QMAKE_MAKEFILE("QMAKE_MAKEFILE"), //$NON-NLS-1$ + VAR_QMAKE_MOC_SRC("QMAKE_MOC_SRC"), //$NON-NLS-1$ + VAR_QMAKE_POST_LINK("QMAKE_POST_LINK"), //$NON-NLS-1$ + VAR_QMAKE_PRE_LINK("QMAKE_PRE_LINK"), //$NON-NLS-1$ + VAR_QMAKE_PROJECT_NAME("QMAKE_PROJECT_NAME"), //$NON-NLS-1$ + VAR_QMAKE_QMAKE("QMAKE_QMAKE"), //$NON-NLS-1$ + VAR_QMAKE_QT_DLL("QMAKE_QT_DLL"), //$NON-NLS-1$ + VAR_QMAKE_RESOURCE_FLAGS("QMAKE_RESOURCE_FLAGS"), //$NON-NLS-1$ + VAR_QMAKE_RPATH("QMAKE_RPATH"), //$NON-NLS-1$ + VAR_QMAKE_RPATHDIR("QMAKE_RPATHDIR"), //$NON-NLS-1$ + VAR_QMAKE_RUN_CC("QMAKE_RUN_CC"), //$NON-NLS-1$ + VAR_QMAKE_RUN_CC_IMP("QMAKE_RUN_CC_IMP"), //$NON-NLS-1$ + VAR_QMAKE_RUN_CXX("QMAKE_RUN_CXX"), //$NON-NLS-1$ + VAR_QMAKE_RUN_CXX_IMP("QMAKE_RUN_CXX_IMP"), //$NON-NLS-1$ + VAR_QMAKE_TARGET("QMAKE_TARGET"), //$NON-NLS-1$ + VAR_QMAKE_UIC("QMAKE_UIC"), //$NON-NLS-1$ + VAR_QT("QT"), //$NON-NLS-1$ + VAR_QTPLUGIN("QTPLUGIN"), //$NON-NLS-1$ + VAR_QT_MAJOR_VERSION("QT_MAJOR_VERSION"), //$NON-NLS-1$ + VAR_QT_MINOR_VERSION("QT_MINOR_VERSION"), //$NON-NLS-1$ + VAR_QT_PATCH_VERSION("QT_PATCH_VERSION"), //$NON-NLS-1$ + VAR_QT_VERSION("QT_VERSION"), //$NON-NLS-1$ + VAR_RCC_DIR("RCC_DIR"), //$NON-NLS-1$ + VAR_RC_FILE("RC_FILE"), //$NON-NLS-1$ + VAR_REQUIRES("REQUIRES"), //$NON-NLS-1$ + VAR_RESOURCES("RESOURCES"), //$NON-NLS-1$ + VAR_RES_FILE("RES_FILE"), //$NON-NLS-1$ + VAR_RSS_RULES("RSS_RULES"), //$NON-NLS-1$ + VAR_SIGNATURE_FILE("SIGNATURE_FILE"), //$NON-NLS-1$ + VAR_SOURCES("SOURCES"), //$NON-NLS-1$ + VAR_SRCMOC("SRCMOC"), //$NON-NLS-1$ + VAR_STATECHARTS("STATECHARTS"), //$NON-NLS-1$ + VAR_SUBDIRS("SUBDIRS"), //$NON-NLS-1$ + VAR_TARGET("TARGET"), //$NON-NLS-1$ + VAR_TEMPLATE("TEMPLATE"), //$NON-NLS-1$ + VAR_TRANSLATIONS("TRANSLATIONS"), //$NON-NLS-1$ + VAR_UICIMPLS("UICIMPLS"), //$NON-NLS-1$ + VAR_UICOBJECTS("UICOBJECTS"), //$NON-NLS-1$ + VAR_UI_DIR("UI_DIR"), //$NON-NLS-1$ + VAR_UI_HEADERS_DIR("UI_HEADERS_DIR"), //$NON-NLS-1$ + VAR_UI_SOURCES_DIR("UI_SOURCES_DIR"), //$NON-NLS-1$ + VAR_VERSION("VERSION"), //$NON-NLS-1$ + VAR_VERSION_PE_HEADER("VERSION_PE_HEADER"), //$NON-NLS-1$ + VAR_VER_MAJ("VER_MAJ"), //$NON-NLS-1$ + VAR_VER_MIN("VER_MIN"), //$NON-NLS-1$ + VAR_VER_PAT("VER_PAT"), //$NON-NLS-1$ + VAR_VPATH("VPATH"), //$NON-NLS-1$ + VAR_YACCIMPLS("YACCIMPLS"), //$NON-NLS-1$ + VAR_YACCOBJECTS("YACCOBJECTS"), //$NON-NLS-1$ + VAR_YACCSOURCES("YACCSOURCES"), //$NON-NLS-1$ + VAR__PRO_FILE_("_PRO_FILE_"), //$NON-NLS-1$ + VAR__PRO_FILE_PWD_("_PRO_FILE_PWD_"); //$NON-NLS-1$ + + private final String keyword; + + QtProjectFileKeyword(String key) { + this.keyword = key; + } + + /** + * Returns a String containing this keyword's identifier. + * + * @return a string + */ + public String getKeyword() { + return keyword; + } + + private static QtProjectFileKeyword[] getKeywordsWithPrefix(String prefix) { + ArrayList list = new ArrayList<>(); + for (QtProjectFileKeyword word : QtProjectFileKeyword.values()) { + if (word.name().startsWith(prefix)) { + list.add(word); + } + } + QtProjectFileKeyword[] array = new QtProjectFileKeyword[list.size()]; + return list.toArray(array); + } + + /** + * Returns all keywords associated with functions in qmake. + * + * @return an array of keywords + */ + public static QtProjectFileKeyword[] getFunctionKeywords() { + return getKeywordsWithPrefix("FUNC_"); //$NON-NLS-1$ + } + + /** + * Returns all keywords associated with variables in qmake. + * + * @return an array of keywords + */ + public static QtProjectFileKeyword[] getVariableKeywords() { + return getKeywordsWithPrefix("VAR_"); //$NON-NLS-1$ + } +} diff --git a/qt/org.eclipse.cdt.qt.ui/src/org/eclipse/cdt/internal/qt/ui/editor/QtProjectFileSourceViewerConfiguration.java b/qt/org.eclipse.cdt.qt.ui/src/org/eclipse/cdt/internal/qt/ui/editor/QtProjectFileSourceViewerConfiguration.java index b0485551aec..3e53a6e04fe 100644 --- a/qt/org.eclipse.cdt.qt.ui/src/org/eclipse/cdt/internal/qt/ui/editor/QtProjectFileSourceViewerConfiguration.java +++ b/qt/org.eclipse.cdt.qt.ui/src/org/eclipse/cdt/internal/qt/ui/editor/QtProjectFileSourceViewerConfiguration.java @@ -1,102 +1,102 @@ -/******************************************************************************* - * Copyright (c) 2015 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.internal.qt.ui.editor; - -import org.eclipse.jface.text.IDocument; -import org.eclipse.jface.text.IDocumentExtension3; -import org.eclipse.jface.text.TextAttribute; -import org.eclipse.jface.text.contentassist.ContentAssistant; -import org.eclipse.jface.text.contentassist.IContentAssistProcessor; -import org.eclipse.jface.text.contentassist.IContentAssistant; -import org.eclipse.jface.text.presentation.IPresentationReconciler; -import org.eclipse.jface.text.presentation.PresentationReconciler; -import org.eclipse.jface.text.rules.DefaultDamagerRepairer; -import org.eclipse.jface.text.rules.EndOfLineRule; -import org.eclipse.jface.text.rules.IRule; -import org.eclipse.jface.text.rules.IToken; -import org.eclipse.jface.text.rules.ITokenScanner; -import org.eclipse.jface.text.rules.IWordDetector; -import org.eclipse.jface.text.rules.RuleBasedScanner; -import org.eclipse.jface.text.rules.Token; -import org.eclipse.jface.text.rules.WordRule; -import org.eclipse.jface.text.source.ISourceViewer; -import org.eclipse.swt.graphics.Color; -import org.eclipse.swt.graphics.RGB; -import org.eclipse.swt.widgets.Display; -import org.eclipse.ui.editors.text.TextSourceViewerConfiguration; - -public class QtProjectFileSourceViewerConfiguration extends TextSourceViewerConfiguration { - private static int TOKEN_DEFAULT = 0; - private static int TOKEN_FUNCTION_KEYWORD = 1; - private static int TOKEN_VARIABLE_KEYWORD = 2; - private static int TOKEN_COMMENT = 3; - - // TODO: Add preference page for syntax highlighting - private static IToken[] allTokens = new IToken[] { - new Token(null), - new Token(new TextAttribute(new Color(Display.getCurrent(), new RGB(140, 140, 0)))), - new Token(new TextAttribute(new Color(Display.getCurrent(), new RGB(140, 0, 100)))), - new Token(new TextAttribute(new Color(Display.getCurrent(), new RGB(0, 140, 0)))) - }; - - @Override - public IPresentationReconciler getPresentationReconciler(ISourceViewer viewer) { - PresentationReconciler reconciler = new PresentationReconciler(); - reconciler.setDocumentPartitioning(IDocumentExtension3.DEFAULT_PARTITIONING); - - DefaultDamagerRepairer dr; - dr = new DefaultDamagerRepairer(createDefaultTokenScanner()); - reconciler.setDamager(dr, IDocument.DEFAULT_CONTENT_TYPE); - reconciler.setRepairer(dr, IDocument.DEFAULT_CONTENT_TYPE); - return reconciler; - } - - private ITokenScanner createDefaultTokenScanner() { - RuleBasedScanner scanner = new RuleBasedScanner(); - - WordRule wordRule = new WordRule(new IWordDetector() { - @Override - public boolean isWordStart(char c) { - return Character.isJavaIdentifierStart(c) && c != '$'; - } - - @Override - public boolean isWordPart(char c) { - return Character.isJavaIdentifierPart(c) && c != '$'; - } - }, allTokens[TOKEN_DEFAULT]); - - // QMake function keywords - for (QtProjectFileKeyword keyword : QtProjectFileKeyword.getFunctionKeywords()) { - wordRule.addWord(keyword.getKeyword(), allTokens[TOKEN_FUNCTION_KEYWORD]); - } - - // QMake variable keywords - for (QtProjectFileKeyword keyword : QtProjectFileKeyword.getVariableKeywords()) { - wordRule.addWord(keyword.getKeyword(), allTokens[TOKEN_VARIABLE_KEYWORD]); - } - - scanner.setRules(new IRule[] { - wordRule, - new EndOfLineRule("#", allTokens[TOKEN_COMMENT]) //$NON-NLS-1$ - }); - return scanner; - } - - @Override - public IContentAssistant getContentAssistant(ISourceViewer sourceViewer) { - ContentAssistant contentAssistant = new ContentAssistant(); - IContentAssistProcessor processor = new QtProjectFileContentAssistProcessor(); - contentAssistant.setContentAssistProcessor(processor, IDocument.DEFAULT_CONTENT_TYPE); - contentAssistant.setInformationControlCreator(getInformationControlCreator(sourceViewer)); - return contentAssistant; - } -} +/******************************************************************************* + * Copyright (c) 2015 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.internal.qt.ui.editor; + +import org.eclipse.jface.text.IDocument; +import org.eclipse.jface.text.IDocumentExtension3; +import org.eclipse.jface.text.TextAttribute; +import org.eclipse.jface.text.contentassist.ContentAssistant; +import org.eclipse.jface.text.contentassist.IContentAssistProcessor; +import org.eclipse.jface.text.contentassist.IContentAssistant; +import org.eclipse.jface.text.presentation.IPresentationReconciler; +import org.eclipse.jface.text.presentation.PresentationReconciler; +import org.eclipse.jface.text.rules.DefaultDamagerRepairer; +import org.eclipse.jface.text.rules.EndOfLineRule; +import org.eclipse.jface.text.rules.IRule; +import org.eclipse.jface.text.rules.IToken; +import org.eclipse.jface.text.rules.ITokenScanner; +import org.eclipse.jface.text.rules.IWordDetector; +import org.eclipse.jface.text.rules.RuleBasedScanner; +import org.eclipse.jface.text.rules.Token; +import org.eclipse.jface.text.rules.WordRule; +import org.eclipse.jface.text.source.ISourceViewer; +import org.eclipse.swt.graphics.Color; +import org.eclipse.swt.graphics.RGB; +import org.eclipse.swt.widgets.Display; +import org.eclipse.ui.editors.text.TextSourceViewerConfiguration; + +public class QtProjectFileSourceViewerConfiguration extends TextSourceViewerConfiguration { + private static int TOKEN_DEFAULT = 0; + private static int TOKEN_FUNCTION_KEYWORD = 1; + private static int TOKEN_VARIABLE_KEYWORD = 2; + private static int TOKEN_COMMENT = 3; + + // TODO: Add preference page for syntax highlighting + private static IToken[] allTokens = new IToken[] { + new Token(null), + new Token(new TextAttribute(new Color(Display.getCurrent(), new RGB(140, 140, 0)))), + new Token(new TextAttribute(new Color(Display.getCurrent(), new RGB(140, 0, 100)))), + new Token(new TextAttribute(new Color(Display.getCurrent(), new RGB(0, 140, 0)))) + }; + + @Override + public IPresentationReconciler getPresentationReconciler(ISourceViewer viewer) { + PresentationReconciler reconciler = new PresentationReconciler(); + reconciler.setDocumentPartitioning(IDocumentExtension3.DEFAULT_PARTITIONING); + + DefaultDamagerRepairer dr; + dr = new DefaultDamagerRepairer(createDefaultTokenScanner()); + reconciler.setDamager(dr, IDocument.DEFAULT_CONTENT_TYPE); + reconciler.setRepairer(dr, IDocument.DEFAULT_CONTENT_TYPE); + return reconciler; + } + + private ITokenScanner createDefaultTokenScanner() { + RuleBasedScanner scanner = new RuleBasedScanner(); + + WordRule wordRule = new WordRule(new IWordDetector() { + @Override + public boolean isWordStart(char c) { + return Character.isJavaIdentifierStart(c) && c != '$'; + } + + @Override + public boolean isWordPart(char c) { + return Character.isJavaIdentifierPart(c) && c != '$'; + } + }, allTokens[TOKEN_DEFAULT]); + + // QMake function keywords + for (QtProjectFileKeyword keyword : QtProjectFileKeyword.getFunctionKeywords()) { + wordRule.addWord(keyword.getKeyword(), allTokens[TOKEN_FUNCTION_KEYWORD]); + } + + // QMake variable keywords + for (QtProjectFileKeyword keyword : QtProjectFileKeyword.getVariableKeywords()) { + wordRule.addWord(keyword.getKeyword(), allTokens[TOKEN_VARIABLE_KEYWORD]); + } + + scanner.setRules(new IRule[] { + wordRule, + new EndOfLineRule("#", allTokens[TOKEN_COMMENT]) //$NON-NLS-1$ + }); + return scanner; + } + + @Override + public IContentAssistant getContentAssistant(ISourceViewer sourceViewer) { + ContentAssistant contentAssistant = new ContentAssistant(); + IContentAssistProcessor processor = new QtProjectFileContentAssistProcessor(); + contentAssistant.setContentAssistProcessor(processor, IDocument.DEFAULT_CONTENT_TYPE); + contentAssistant.setInformationControlCreator(getInformationControlCreator(sourceViewer)); + return contentAssistant; + } +} diff --git a/qt/org.eclipse.cdt.qt.ui/src/org/eclipse/cdt/internal/qt/ui/pro/parser/QtProjectFileModifier.java b/qt/org.eclipse.cdt.qt.ui/src/org/eclipse/cdt/internal/qt/ui/pro/parser/QtProjectFileModifier.java index dc72f331406..d415fe06450 100644 --- a/qt/org.eclipse.cdt.qt.ui/src/org/eclipse/cdt/internal/qt/ui/pro/parser/QtProjectFileModifier.java +++ b/qt/org.eclipse.cdt.qt.ui/src/org/eclipse/cdt/internal/qt/ui/pro/parser/QtProjectFileModifier.java @@ -1,286 +1,286 @@ -/******************************************************************************* - * Copyright (c) 2015 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.internal.qt.ui.pro.parser; - -import org.eclipse.cdt.internal.qt.core.Activator; -import org.eclipse.jface.text.BadLocationException; -import org.eclipse.jface.text.IDocument; - -/** - * Allows for the manipulation of information stored in a Qt Project File. At the moment the only modifiable information is that - * which is contained within variables such as the following: - * - *
    - * SOURCES += file.cpp \ # This is the first line with value "file.cpp"
    - *     file2.cpp # This is the second line with value "file2.cpp"
    - * 
    - * - * This class supports the following modifications to variables: - *
      - *
    • Add Value: If the specified String does not exist in the given variable then it is added as a new line at the end of - * the variable declaration. A line escape (\) is also inserted into the preceding line.
    • - *
    • Remove Value: If the specified String exists in the given variable then it is removed. The line escape character (\) - * is also removed from the preceding line if necessary.
    • - *
    • Replace Value: If the specified String exists as a line in the given variable, then it is replaced with another - * String. All spacing is preserved as only the value itself is modified.
    • - *
    - *

    - * Comments may appear after the line escape character (\) in a variable Declaration. For this case, replace and addition operations - * will preserve these comments. However, a comment will not be preserved if its line is deleted during a remove operation. - *

    - */ -public class QtProjectFileModifier { - - private QtProjectFileParser parser; - private IDocument document; - - public QtProjectFileModifier(IDocument doc) { - if (doc == null) { - throw new IllegalArgumentException("document cannot be null"); //$NON-NLS-1$ - } - - this.document = doc; - this.parser = new QtProjectFileParser(doc); - } - - public QtProjectFileModifier(QtProjectFileParser parser) { - if (parser == null) { - throw new IllegalArgumentException("parser cannot be null"); //$NON-NLS-1$ - } - - this.document = parser.getDocument(); - this.parser = parser; - } - - /** - * Attempts to replace the given value with a new value if it is found within the given variable name. This is a convenience - * method equivalent to replaceVariableValue(variable,oldValue,newValue,true) and will only match values that - * occupy an entire line within the variable declaration. - *

    - * This method does not create a new value if the specified oldValue was not found. If this behavior is - * desired, then check for a return of false from this method and then call the addVariableValue - * method. - *

    - *

    - * Note: The "entire line" refers to only the value as it appears in the variable declaration. That is, any whitespace - * before or after will not be included when matching a value to the "entire line". - *

    - * - * @param variable - * the name of the variable - * @param oldValue - * the value that will be replaced - * @param newValue - * the value to replace with - * @return whether or not the value was able to be replaced - */ - public boolean replaceVariableValue(String variable, String oldValue, String newValue) { - return replaceVariableValue(variable, oldValue, newValue, true); - } - - /** - * Attempts to replace the first instance of oldValue with newValue if it is found within the given - * variable name. If matchWholeLine is false, this method will try to match sections of each line with the value of - * oldValue. If a match is found, only that portion of the line will be replaced. If matchWholeLine is - * true, this method will try to match the entire line with the value of oldValue and will replace that. All other - * line spacing and comments are preserved as only the value itself is replaced. - *

    - * This method does not create a new value if oldValue was not found. If this behavior is desired, then - * check for a return of false from this method and then call the addVariableValue method. - *

    - *

    - * Note: The "entire line" refers to only the value as it appears in the variable declaration. That is, any whitespace - * before or after will not be included when matching a value to the "entire line". - *

    - * - * @param variable - * the name of the variable - * @param oldValue - * the value that will be replaced - * @param newValue - * the value to replace with - * @param matchWholeLine - * whether or not the value should match the entire line - * @return whether or not the value was able to be replaced - */ - public boolean replaceVariableValue(String variable, String oldValue, String newValue, boolean matchWholeLine) { - QtProjectVariable var = parser.getVariable(variable); - - if (var != null) { - if (matchWholeLine) { - int line = var.getValueIndex(oldValue); - if (line >= 0) { - return replaceVariableValue(var, line, newValue); - } - } else { - int line = 0; - for (String value : var.getValues()) { - int offset = value.indexOf(oldValue); - if (offset >= 0) { - return replaceVariableValue(var, - line, - var.getValueOffsetForLine(line) + offset, - oldValue.length(), - newValue); - } - line++; - } - } - } - return false; - } - - private boolean replaceVariableValue(QtProjectVariable var, int lineNo, String newValue) { - int offset = var.getValueOffsetForLine(lineNo); - String value = var.getValueForLine(lineNo); - int length = value.length(); - - return replaceVariableValue(var, lineNo, offset, length, newValue); - } - - private boolean replaceVariableValue(QtProjectVariable var, int lineNo, int offset, int length, String newValue) { - try { - document.replace(offset, length, newValue); - return true; - } catch (BadLocationException e) { - Activator.log(e); - } - return false; - } - - /** - * Adds value to the specified variable as a new line and escapes the previous line with a backslash. The escaping - * is done in such a way that comments and spacing are preserved on the previous line. If this variable does not exist, a new - * one is created at the bottom-most position of the document with the initial value specified by value. - * - * @param variable - * the name of the variable to add to - * @param value - * the value to add to the variable - */ - public void addVariableValue(String variable, String value) { - QtProjectVariable var = parser.getVariable(variable); - - if (var != null) { - if (var.getValueIndex(value) < 0) { - int line = var.getNumberOfLines() - 1; - String indent = var.getIndentString(line); - - int offset = var.getEndOffset(); - if (var.getLine(line).endsWith("\n")) { //$NON-NLS-1$ - offset--; - } - - try { - document.replace(offset, 0, "\n" + indent + value); //$NON-NLS-1$ - } catch (BadLocationException e) { - Activator.log(e); - } - - try { - offset = var.getLineEscapeReplacementOffset(line); - String lineEscape = var.getLineEscapeReplacementString(line); - - document.replace(offset, 0, lineEscape); - } catch (BadLocationException e) { - Activator.log(e); - } - } - } else { - // Variable does not exist, create it - String baseVariable = variable + " += " + value + "\n"; //$NON-NLS-1$ //$NON-NLS-2$ - - // Check the contents of the document and re-format accordingly - if (document.get().trim().isEmpty()) { - try { - document.replace(0, document.getLength(), baseVariable); - } catch (BadLocationException e) { - Activator.log(e); - } - } else if (document.get().endsWith("\n")) { //$NON-NLS-1$ - try { - document.replace(document.getLength(), 0, "\n" + baseVariable); //$NON-NLS-1$ - } catch (BadLocationException e) { - Activator.log(e); - } - } else { - try { - document.replace(document.getLength(), 0, "\n\n" + baseVariable); //$NON-NLS-1$ - } catch (BadLocationException e) { - Activator.log(e); - } - } - } - } - - /** - * Removes value from the specified variable and removes the previous line escape if necessary. The entire line is - * removed including any comments. If the value is not found, nothing happens. - * - * @param variable - * the name of the variable to remove from - * @param value - * the value to remove from the variable - */ - public void removeVariableValue(String variable, String value) { - QtProjectVariable var = parser.getVariable(variable); - - if (var != null) { - int line = var.getValueIndex(value); - if (line == 0 && var.getNumberOfLines() > 1) { - // Entering this block means we're removing the first line where more lines exist. - int offset = var.getValueOffsetForLine(line); - int end = var.getValueOffsetForLine(line + 1); - - try { - document.replace(offset, end - offset, ""); //$NON-NLS-1$ - } catch (BadLocationException e) { - Activator.log(e); - } - } else if (line >= 0) { - int offset = var.getLineOffset(line); - int length = var.getLine(line).length(); - if (line > 0) { - // Remove the previous line feed character - offset--; - length++; - } - - try { - document.replace(offset, length, ""); //$NON-NLS-1$ - } catch (BadLocationException e) { - Activator.log(e); - } - - // Remove the previous line's line escape character if necessary - if (line > 0 && line == var.getNumberOfLines() - 1) { - try { - offset = var.getLineEscapeOffset(line - 1); - length = var.getLineEscapeEnd(line - 1) - offset; - - document.replace(offset, length, ""); //$NON-NLS-1$ - } catch (BadLocationException e) { - Activator.log(e); - } - } - } - } - } - - /** - * Get the IDocument currently being modified by this class. - * - * @return the document being modified - */ - public IDocument getDocument() { - return document; - } -} +/******************************************************************************* + * Copyright (c) 2015 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.internal.qt.ui.pro.parser; + +import org.eclipse.cdt.internal.qt.core.Activator; +import org.eclipse.jface.text.BadLocationException; +import org.eclipse.jface.text.IDocument; + +/** + * Allows for the manipulation of information stored in a Qt Project File. At the moment the only modifiable information is that + * which is contained within variables such as the following: + * + *
    + * SOURCES += file.cpp \ # This is the first line with value "file.cpp"
    + *     file2.cpp # This is the second line with value "file2.cpp"
    + * 
    + * + * This class supports the following modifications to variables: + *
      + *
    • Add Value: If the specified String does not exist in the given variable then it is added as a new line at the end of + * the variable declaration. A line escape (\) is also inserted into the preceding line.
    • + *
    • Remove Value: If the specified String exists in the given variable then it is removed. The line escape character (\) + * is also removed from the preceding line if necessary.
    • + *
    • Replace Value: If the specified String exists as a line in the given variable, then it is replaced with another + * String. All spacing is preserved as only the value itself is modified.
    • + *
    + *

    + * Comments may appear after the line escape character (\) in a variable Declaration. For this case, replace and addition operations + * will preserve these comments. However, a comment will not be preserved if its line is deleted during a remove operation. + *

    + */ +public class QtProjectFileModifier { + + private QtProjectFileParser parser; + private IDocument document; + + public QtProjectFileModifier(IDocument doc) { + if (doc == null) { + throw new IllegalArgumentException("document cannot be null"); //$NON-NLS-1$ + } + + this.document = doc; + this.parser = new QtProjectFileParser(doc); + } + + public QtProjectFileModifier(QtProjectFileParser parser) { + if (parser == null) { + throw new IllegalArgumentException("parser cannot be null"); //$NON-NLS-1$ + } + + this.document = parser.getDocument(); + this.parser = parser; + } + + /** + * Attempts to replace the given value with a new value if it is found within the given variable name. This is a convenience + * method equivalent to replaceVariableValue(variable,oldValue,newValue,true) and will only match values that + * occupy an entire line within the variable declaration. + *

    + * This method does not create a new value if the specified oldValue was not found. If this behavior is + * desired, then check for a return of false from this method and then call the addVariableValue + * method. + *

    + *

    + * Note: The "entire line" refers to only the value as it appears in the variable declaration. That is, any whitespace + * before or after will not be included when matching a value to the "entire line". + *

    + * + * @param variable + * the name of the variable + * @param oldValue + * the value that will be replaced + * @param newValue + * the value to replace with + * @return whether or not the value was able to be replaced + */ + public boolean replaceVariableValue(String variable, String oldValue, String newValue) { + return replaceVariableValue(variable, oldValue, newValue, true); + } + + /** + * Attempts to replace the first instance of oldValue with newValue if it is found within the given + * variable name. If matchWholeLine is false, this method will try to match sections of each line with the value of + * oldValue. If a match is found, only that portion of the line will be replaced. If matchWholeLine is + * true, this method will try to match the entire line with the value of oldValue and will replace that. All other + * line spacing and comments are preserved as only the value itself is replaced. + *

    + * This method does not create a new value if oldValue was not found. If this behavior is desired, then + * check for a return of false from this method and then call the addVariableValue method. + *

    + *

    + * Note: The "entire line" refers to only the value as it appears in the variable declaration. That is, any whitespace + * before or after will not be included when matching a value to the "entire line". + *

    + * + * @param variable + * the name of the variable + * @param oldValue + * the value that will be replaced + * @param newValue + * the value to replace with + * @param matchWholeLine + * whether or not the value should match the entire line + * @return whether or not the value was able to be replaced + */ + public boolean replaceVariableValue(String variable, String oldValue, String newValue, boolean matchWholeLine) { + QtProjectVariable var = parser.getVariable(variable); + + if (var != null) { + if (matchWholeLine) { + int line = var.getValueIndex(oldValue); + if (line >= 0) { + return replaceVariableValue(var, line, newValue); + } + } else { + int line = 0; + for (String value : var.getValues()) { + int offset = value.indexOf(oldValue); + if (offset >= 0) { + return replaceVariableValue(var, + line, + var.getValueOffsetForLine(line) + offset, + oldValue.length(), + newValue); + } + line++; + } + } + } + return false; + } + + private boolean replaceVariableValue(QtProjectVariable var, int lineNo, String newValue) { + int offset = var.getValueOffsetForLine(lineNo); + String value = var.getValueForLine(lineNo); + int length = value.length(); + + return replaceVariableValue(var, lineNo, offset, length, newValue); + } + + private boolean replaceVariableValue(QtProjectVariable var, int lineNo, int offset, int length, String newValue) { + try { + document.replace(offset, length, newValue); + return true; + } catch (BadLocationException e) { + Activator.log(e); + } + return false; + } + + /** + * Adds value to the specified variable as a new line and escapes the previous line with a backslash. The escaping + * is done in such a way that comments and spacing are preserved on the previous line. If this variable does not exist, a new + * one is created at the bottom-most position of the document with the initial value specified by value. + * + * @param variable + * the name of the variable to add to + * @param value + * the value to add to the variable + */ + public void addVariableValue(String variable, String value) { + QtProjectVariable var = parser.getVariable(variable); + + if (var != null) { + if (var.getValueIndex(value) < 0) { + int line = var.getNumberOfLines() - 1; + String indent = var.getIndentString(line); + + int offset = var.getEndOffset(); + if (var.getLine(line).endsWith("\n")) { //$NON-NLS-1$ + offset--; + } + + try { + document.replace(offset, 0, "\n" + indent + value); //$NON-NLS-1$ + } catch (BadLocationException e) { + Activator.log(e); + } + + try { + offset = var.getLineEscapeReplacementOffset(line); + String lineEscape = var.getLineEscapeReplacementString(line); + + document.replace(offset, 0, lineEscape); + } catch (BadLocationException e) { + Activator.log(e); + } + } + } else { + // Variable does not exist, create it + String baseVariable = variable + " += " + value + "\n"; //$NON-NLS-1$ //$NON-NLS-2$ + + // Check the contents of the document and re-format accordingly + if (document.get().trim().isEmpty()) { + try { + document.replace(0, document.getLength(), baseVariable); + } catch (BadLocationException e) { + Activator.log(e); + } + } else if (document.get().endsWith("\n")) { //$NON-NLS-1$ + try { + document.replace(document.getLength(), 0, "\n" + baseVariable); //$NON-NLS-1$ + } catch (BadLocationException e) { + Activator.log(e); + } + } else { + try { + document.replace(document.getLength(), 0, "\n\n" + baseVariable); //$NON-NLS-1$ + } catch (BadLocationException e) { + Activator.log(e); + } + } + } + } + + /** + * Removes value from the specified variable and removes the previous line escape if necessary. The entire line is + * removed including any comments. If the value is not found, nothing happens. + * + * @param variable + * the name of the variable to remove from + * @param value + * the value to remove from the variable + */ + public void removeVariableValue(String variable, String value) { + QtProjectVariable var = parser.getVariable(variable); + + if (var != null) { + int line = var.getValueIndex(value); + if (line == 0 && var.getNumberOfLines() > 1) { + // Entering this block means we're removing the first line where more lines exist. + int offset = var.getValueOffsetForLine(line); + int end = var.getValueOffsetForLine(line + 1); + + try { + document.replace(offset, end - offset, ""); //$NON-NLS-1$ + } catch (BadLocationException e) { + Activator.log(e); + } + } else if (line >= 0) { + int offset = var.getLineOffset(line); + int length = var.getLine(line).length(); + if (line > 0) { + // Remove the previous line feed character + offset--; + length++; + } + + try { + document.replace(offset, length, ""); //$NON-NLS-1$ + } catch (BadLocationException e) { + Activator.log(e); + } + + // Remove the previous line's line escape character if necessary + if (line > 0 && line == var.getNumberOfLines() - 1) { + try { + offset = var.getLineEscapeOffset(line - 1); + length = var.getLineEscapeEnd(line - 1) - offset; + + document.replace(offset, length, ""); //$NON-NLS-1$ + } catch (BadLocationException e) { + Activator.log(e); + } + } + } + } + } + + /** + * Get the IDocument currently being modified by this class. + * + * @return the document being modified + */ + public IDocument getDocument() { + return document; + } +} diff --git a/qt/org.eclipse.cdt.qt.ui/src/org/eclipse/cdt/internal/qt/ui/pro/parser/QtProjectFileParser.java b/qt/org.eclipse.cdt.qt.ui/src/org/eclipse/cdt/internal/qt/ui/pro/parser/QtProjectFileParser.java index 3e9e3f075c5..308c64e0b8c 100644 --- a/qt/org.eclipse.cdt.qt.ui/src/org/eclipse/cdt/internal/qt/ui/pro/parser/QtProjectFileParser.java +++ b/qt/org.eclipse.cdt.qt.ui/src/org/eclipse/cdt/internal/qt/ui/pro/parser/QtProjectFileParser.java @@ -1,116 +1,116 @@ -/******************************************************************************* - * Copyright (c) 2015 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.internal.qt.ui.pro.parser; - -import java.util.ArrayList; -import java.util.List; -import java.util.Scanner; -import java.util.concurrent.CopyOnWriteArrayList; - -import org.eclipse.jface.text.DocumentEvent; -import org.eclipse.jface.text.IDocument; -import org.eclipse.jface.text.IDocumentListener; - -/** - * Very basic parser for Qt Project Files that uses regular expressions. For now, this class only supports finding variables within - * a Document that follow the syntax: - * - *
    - * VARIABLE_NAME += value1 \ # comment
    - *     value2 \ # comment
    - *     value3
    - * 
    - * - * The assignment operator may be one of =, +=, -=, or *= in accordance with qmake syntax. Variable names are not checked for - * semantic validity. That is, this class does not make sure the variable name is a registered qmake variable, nor that there are - * multiple instances of a variable in the document. - */ -public class QtProjectFileParser implements IDocumentListener { - - IDocument document; - List variables; - - public QtProjectFileParser(IDocument doc) { - if (doc == null) { - throw new IllegalArgumentException("document cannot be null"); //$NON-NLS-1$ - } - - document = doc; - variables = parse(); - document.addDocumentListener(this); - } - - public IDocument getDocument() { - return document; - } - - private List parse() { - // Just build the list from scratch - List variables = new CopyOnWriteArrayList<>(); - try (Scanner scanner = new Scanner(document.get())) { - QtProjectVariable next; - while ((next = QtProjectVariable.findNextVariable(scanner)) != null) { - variables.add(next); - } - } - return variables; - } - - /** - * Retrieves a specific Qt Project Variable from the provided IDocument. If the variable cannot be found, - * null is returned instead. - *

    - * Note: This method is greedy in the sense that it returns the first match it finds. If multiple variables exist with - * the same name in the IDocument, this method will only return the first match. - *

    - * - * @param name - * the name of the variable - * @return the QtProjectVariable or null if it couldn't be found - */ - public QtProjectVariable getVariable(String name) { - for (QtProjectVariable v : variables) { - if (v.getName().equals(name)) { - return v; - } - } - return null; - } - - /** - * Returns a list of all Qt Project Variables found within the provided IDocument. A fresh list is always returned - * with the internal list copied into it. As such, modifying this list does not modify the internal list of the parser. - * - * @return the list of all Qt Project Variables - */ - public List getAllVariables() { - return new ArrayList<>(variables); - } - - @Override - public void documentAboutToBeChanged(DocumentEvent event) { - // Nothing to do - } - - @Override - public void documentChanged(DocumentEvent event) { - // Re-parse the document every time it changes - variables = parse(); - } - - @Override - protected void finalize() throws Throwable { - // Make sure that we are removed from the document's listeners - if (document != null) { - document.removeDocumentListener(this); - } - } -} +/******************************************************************************* + * Copyright (c) 2015 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.internal.qt.ui.pro.parser; + +import java.util.ArrayList; +import java.util.List; +import java.util.Scanner; +import java.util.concurrent.CopyOnWriteArrayList; + +import org.eclipse.jface.text.DocumentEvent; +import org.eclipse.jface.text.IDocument; +import org.eclipse.jface.text.IDocumentListener; + +/** + * Very basic parser for Qt Project Files that uses regular expressions. For now, this class only supports finding variables within + * a Document that follow the syntax: + * + *
    + * VARIABLE_NAME += value1 \ # comment
    + *     value2 \ # comment
    + *     value3
    + * 
    + * + * The assignment operator may be one of =, +=, -=, or *= in accordance with qmake syntax. Variable names are not checked for + * semantic validity. That is, this class does not make sure the variable name is a registered qmake variable, nor that there are + * multiple instances of a variable in the document. + */ +public class QtProjectFileParser implements IDocumentListener { + + IDocument document; + List variables; + + public QtProjectFileParser(IDocument doc) { + if (doc == null) { + throw new IllegalArgumentException("document cannot be null"); //$NON-NLS-1$ + } + + document = doc; + variables = parse(); + document.addDocumentListener(this); + } + + public IDocument getDocument() { + return document; + } + + private List parse() { + // Just build the list from scratch + List variables = new CopyOnWriteArrayList<>(); + try (Scanner scanner = new Scanner(document.get())) { + QtProjectVariable next; + while ((next = QtProjectVariable.findNextVariable(scanner)) != null) { + variables.add(next); + } + } + return variables; + } + + /** + * Retrieves a specific Qt Project Variable from the provided IDocument. If the variable cannot be found, + * null is returned instead. + *

    + * Note: This method is greedy in the sense that it returns the first match it finds. If multiple variables exist with + * the same name in the IDocument, this method will only return the first match. + *

    + * + * @param name + * the name of the variable + * @return the QtProjectVariable or null if it couldn't be found + */ + public QtProjectVariable getVariable(String name) { + for (QtProjectVariable v : variables) { + if (v.getName().equals(name)) { + return v; + } + } + return null; + } + + /** + * Returns a list of all Qt Project Variables found within the provided IDocument. A fresh list is always returned + * with the internal list copied into it. As such, modifying this list does not modify the internal list of the parser. + * + * @return the list of all Qt Project Variables + */ + public List getAllVariables() { + return new ArrayList<>(variables); + } + + @Override + public void documentAboutToBeChanged(DocumentEvent event) { + // Nothing to do + } + + @Override + public void documentChanged(DocumentEvent event) { + // Re-parse the document every time it changes + variables = parse(); + } + + @Override + protected void finalize() throws Throwable { + // Make sure that we are removed from the document's listeners + if (document != null) { + document.removeDocumentListener(this); + } + } +} diff --git a/qt/org.eclipse.cdt.qt.ui/src/org/eclipse/cdt/internal/qt/ui/pro/parser/QtProjectVariable.java b/qt/org.eclipse.cdt.qt.ui/src/org/eclipse/cdt/internal/qt/ui/pro/parser/QtProjectVariable.java index 76d95919f0d..1eccce106f1 100644 --- a/qt/org.eclipse.cdt.qt.ui/src/org/eclipse/cdt/internal/qt/ui/pro/parser/QtProjectVariable.java +++ b/qt/org.eclipse.cdt.qt.ui/src/org/eclipse/cdt/internal/qt/ui/pro/parser/QtProjectVariable.java @@ -1,389 +1,389 @@ -/******************************************************************************* - * Copyright (c) 2015 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.internal.qt.ui.pro.parser; - -import java.util.ArrayList; -import java.util.List; -import java.util.Scanner; -import java.util.regex.MatchResult; -import java.util.regex.Pattern; - -/** - * Contains all information about a variable's representation in a Qt Project (.pro) File. This includes information about offsets, - * lengths, and textual representation of various components of a variable declaration such as its: - *
      - *
    • Name, such as "SOURCES"
    • - *
    • Assignment operator (= or +=)
    • - *
    • Values for a particular line
    • - *
    • Comments for a particular line
    • - *
    • Line feeds
    • - *
    • Line escapes (\)
    • - *
    - * Also contains the static method findNextVariable(Scanner) to perform the regular expressions lookup of the next - * variable in a document. - */ -public class QtProjectVariable { - private static final Pattern REGEX = Pattern.compile( - "(?m)^\\h*((?:[_a-zA-Z][_a-zA-Z0-9]*\\.)*[_a-zA-Z][_a-zA-Z0-9]*)\\h*(=|\\+=|-=|\\*=)\\h*([^#\\v]*?)\\h*((?:(\\\\)\\h*)?(#[^\\v]*)?$)"); //$NON-NLS-1$ - private static final Pattern LINE_ESCAPE_REGEX = Pattern.compile("(?m)^(\\h*)([^#\\v]*?)\\h*((?:(\\\\)\\h*)?(#[^\\v]*)?$)"); //$NON-NLS-1$ - - private static final int GROUP_VAR_NAME = 1; - private static final int GROUP_VAR_ASSIGNMENT = 2; - private static final int GROUP_VAR_CONTENTS = 3; - private static final int GROUP_VAR_TERMINATOR = 4; - private static final int GROUP_VAR_LINE_ESCAPE = 5; - private static final int GROUP_VAR_COMMENT = 6; - - private static final int GROUP_LINE_INDENT = 1; - private static final int GROUP_LINE_CONTENTS = 2; - private static final int GROUP_LINE_TERMINATOR = 3; - private static final int GROUP_LINE_LINE_ESCAPE = 4; - private static final int GROUP_LINE_COMMENT = 5; - - /** - * Finds the next Qt Project Variable within a String using the given Scanner. If there are no variables to be found, this - * method will return null. - * - * @param scanner - * the scanner to use for regular expressions matching - * @return the next variable or null if none - */ - public static QtProjectVariable findNextVariable(Scanner scanner) { - List matchResults = new ArrayList<>(); - - // Find the start of a variable declaration - String match = scanner.findWithinHorizon(REGEX, 0); - if (match == null) { - return null; - } - - // Get subsequent lines if the previous one ends with '\' - MatchResult matchResult = scanner.match(); - matchResults.add(matchResult); - if (matchResult.group(QtProjectVariable.GROUP_VAR_TERMINATOR).startsWith("\\")) { //$NON-NLS-1$ - do { - match = scanner.findWithinHorizon(LINE_ESCAPE_REGEX, 0); - if (match == null) { - // This means that we have a newline escape where another line doesn't exist - break; - } - - matchResult = scanner.match(); - matchResults.add(matchResult); - } while (matchResult.group(QtProjectVariable.GROUP_LINE_TERMINATOR).startsWith("\\")); //$NON-NLS-1$ - } - return new QtProjectVariable(matchResults); - } - - private final int startOffset; - private final int endOffset; - private final String text; - - private final List matchResults; - - /** - * Constructs a project file variable from a list of match results obtained from a Scanner. This constructor is - * only intended to be called from within the static method findNextVariable(Scanner). - * - * @param matches - * list of MatchResult - */ - private QtProjectVariable(List matches) { - this.startOffset = matches.get(0).start(); - this.endOffset = matches.get(matches.size() - 1).end(); - this.matchResults = matches; - - StringBuilder sb = new StringBuilder(); - for (MatchResult m : matches) { - sb.append(m.group()); - } - this.text = sb.toString(); - } - - /** - * Gets the offset of this variable relative to the start of its containing document. - * - * @return the offset of this variable - */ - public int getOffset() { - return startOffset; - } - - /** - * Gets the length of this variable as it appears in its containing document. - * - * @return the total length of this variable - */ - public int getLength() { - return endOffset - startOffset; - } - - /** - * Gets the name of this variable as it appears in the document. For example, the "SOURCES" variable. - * - * @return the name of this variable - */ - public String getName() { - return matchResults.get(0).group(GROUP_VAR_NAME); - } - - /** - * the assignment operator of this variable (+= or "=") - * - * @return the assignment operator - */ - public String getAssignmentOperator() { - return matchResults.get(0).group(GROUP_VAR_ASSIGNMENT); - } - - /** - * Returns a list of value(s) assigned to this variable. Each entry in the list represents a new line. - * - * @return a List containing all of the value(s) assigned to this variable - */ - public List getValues() { - List values = new ArrayList(); - values.add(matchResults.get(0).group(GROUP_VAR_CONTENTS)); - for (int i = 1; i < matchResults.size(); i++) { - values.add(matchResults.get(i).group(GROUP_LINE_CONTENTS)); - } - return values; - } - - /** - * Returns the indentation of the given line as a String. Mainly used by the QtProjectFileWriter to write back to the Document. - * - * @param line - * the line number to check - * @return a String representing the indentation of the given line - */ - public String getIndentString(int line) { - MatchResult match = matchResults.get(line); - if (line == 0) { - StringBuilder sb = new StringBuilder(); - for (int i = 0; i < match.start(GROUP_VAR_CONTENTS) - match.start(); i++) { - sb.append(' '); - } - return sb.toString(); - } - return match.group(GROUP_LINE_INDENT); - } - - /** - * Retrieves the offset of the value portion of a given line relative to the start of its containing document. - * - * @param line - * the line to check - * @return the offset of the value - */ - public int getValueOffsetForLine(int line) { - if (line == 0) { - return matchResults.get(line).start(GROUP_VAR_CONTENTS); - } - return matchResults.get(line).start(GROUP_LINE_CONTENTS); - } - - /** - * Retrieves a String representing the value at a specific line of this variable. - * - * @param line - * the line to check - * @return the value - */ - public String getValueForLine(int line) { - if (line == 0) { - return matchResults.get(line).group(GROUP_VAR_CONTENTS); - } - return matchResults.get(line).group(GROUP_LINE_CONTENTS); - } - - /** - * Returns the ideal offset in the containing document at which a line escape can be inserted. - * - * @param line - * the line to check - * @return the ideal location for a line escape - */ - public int getLineEscapeReplacementOffset(int line) { - if (line == 0) { - return matchResults.get(line).end(GROUP_VAR_CONTENTS); - } - return matchResults.get(line).end(GROUP_LINE_CONTENTS); - } - - /** - * Returns the ideal String for the line escape character. This is mostly for spacing requirements and should be used in tandem - * with the method getLineEscapeReplacementOffset. - * - * @param line - * the line to check - * @return the ideal String for the line escape character - */ - public String getLineEscapeReplacementString(int line) { - int commentOffset = -1; - int contentsOffset = -1; - if (line == 0) { - commentOffset = matchResults.get(line).start(GROUP_VAR_COMMENT); - contentsOffset = matchResults.get(line).end(GROUP_VAR_CONTENTS); - } else { - commentOffset = matchResults.get(line).start(GROUP_LINE_COMMENT); - contentsOffset = matchResults.get(line).end(GROUP_LINE_CONTENTS); - } - - if (commentOffset > 0) { - if (commentOffset - contentsOffset == 0) { - return " \\ "; //$NON-NLS-1$ - } - } - return " \\"; //$NON-NLS-1$ - } - - /** - * Retrieves the offset of the line escape for a given line relative to its containing document. This method takes into account - * spacing and should be used to determine how to best remove a line escape character from a given line. - * - * @param line - * the line to check - * @return the offset of the line escape character - */ - public int getLineEscapeOffset(int line) { - if (line == 0) { - return matchResults.get(line).end(GROUP_VAR_CONTENTS); - } - return matchResults.get(line).end(GROUP_LINE_CONTENTS); - } - - /** - * Get the end position relative to the start of the containing document that contains the line escape character of the given - * line. This is used for removal of the line escape character and takes into account the spacing of the line. - * - * @param line - * the line to check - * @return the end position of the line escape character - */ - public int getLineEscapeEnd(int line) { - int end = -1; - if (line == 0) { - end = matchResults.get(line).end(GROUP_VAR_LINE_ESCAPE); - } else { - end = matchResults.get(line).end(GROUP_LINE_LINE_ESCAPE); - } - - if (end > 0) { - return end; - } - - if (line == 0) { - return matchResults.get(line).end(GROUP_VAR_TERMINATOR); - } - return matchResults.get(line).end(GROUP_LINE_TERMINATOR); - } - - /** - * Gets the end position of this variable relative to the containing document. - * - * @return the end position of this variable - */ - public int getEndOffset() { - return matchResults.get(matchResults.size() - 1).end(); - } - - /** - * Retrieves the full text of this variable as it appears in the document. - * - * @return the full String of this variable as it appears in the document - */ - public String getText() { - return text; - } - - /** - * Gets the total number of lines in this variable declaration. - * - * @return the total number of lines - */ - public int getNumberOfLines() { - return matchResults.size(); - } - - /** - * Retrieves a String representing the given line as it appears in the document. - * - * @param line - * the line to retrieve - * @return a String representing the line - */ - public String getLine(int line) { - return matchResults.get(line).group(); - } - - /** - * Retrieves the offset of the given line relative to its containing document. - * - * @param line - * the line to retrieve - * @return the line's offset in the document - */ - public int getLineOffset(int line) { - return matchResults.get(line).start(); - } - - /** - * Returns the line at which the specified value appears. This method checks the whole line for the value and will not match a - * subset of that String. This is equivalent to calling getValueIndex(value,false). - * - * @param value - * the value to search for - * @return the line that the value appears on or -1 if it doesn't exist - */ - public int getValueIndex(String value) { - return getValueIndex(value, false); - } - - /** - * Returns the line at which the specified value appears. This method checks the whole line for the value and will not match a - * subset of that String. If ignoreCase is false, this method searches for the value using - * equalsIgnoreCase instead of equals. - * - * @param value - * the value to search for - * @param ignoreCase - * whether or not the value is case-sensitive - * @return the line that the value appears on or -1 if it doesn't exist - */ - public int getValueIndex(String value, boolean ignoreCase) { - int line = 0; - for (String val : getValues()) { - if (ignoreCase) { - if (val.equalsIgnoreCase(value)) { - return line; - } - } else { - if (val.equals(value)) { - return line; - } - } - line++; - } - return -1; - } - - /** - * Gets the offset of the end of a given line relative to its containing document. - * - * @param line - * the line to check - * @return the offset of the end of the line - */ - public int getLineEnd(int line) { - return matchResults.get(line).end(); - } +/******************************************************************************* + * Copyright (c) 2015 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.internal.qt.ui.pro.parser; + +import java.util.ArrayList; +import java.util.List; +import java.util.Scanner; +import java.util.regex.MatchResult; +import java.util.regex.Pattern; + +/** + * Contains all information about a variable's representation in a Qt Project (.pro) File. This includes information about offsets, + * lengths, and textual representation of various components of a variable declaration such as its: + *
      + *
    • Name, such as "SOURCES"
    • + *
    • Assignment operator (= or +=)
    • + *
    • Values for a particular line
    • + *
    • Comments for a particular line
    • + *
    • Line feeds
    • + *
    • Line escapes (\)
    • + *
    + * Also contains the static method findNextVariable(Scanner) to perform the regular expressions lookup of the next + * variable in a document. + */ +public class QtProjectVariable { + private static final Pattern REGEX = Pattern.compile( + "(?m)^\\h*((?:[_a-zA-Z][_a-zA-Z0-9]*\\.)*[_a-zA-Z][_a-zA-Z0-9]*)\\h*(=|\\+=|-=|\\*=)\\h*([^#\\v]*?)\\h*((?:(\\\\)\\h*)?(#[^\\v]*)?$)"); //$NON-NLS-1$ + private static final Pattern LINE_ESCAPE_REGEX = Pattern.compile("(?m)^(\\h*)([^#\\v]*?)\\h*((?:(\\\\)\\h*)?(#[^\\v]*)?$)"); //$NON-NLS-1$ + + private static final int GROUP_VAR_NAME = 1; + private static final int GROUP_VAR_ASSIGNMENT = 2; + private static final int GROUP_VAR_CONTENTS = 3; + private static final int GROUP_VAR_TERMINATOR = 4; + private static final int GROUP_VAR_LINE_ESCAPE = 5; + private static final int GROUP_VAR_COMMENT = 6; + + private static final int GROUP_LINE_INDENT = 1; + private static final int GROUP_LINE_CONTENTS = 2; + private static final int GROUP_LINE_TERMINATOR = 3; + private static final int GROUP_LINE_LINE_ESCAPE = 4; + private static final int GROUP_LINE_COMMENT = 5; + + /** + * Finds the next Qt Project Variable within a String using the given Scanner. If there are no variables to be found, this + * method will return null. + * + * @param scanner + * the scanner to use for regular expressions matching + * @return the next variable or null if none + */ + public static QtProjectVariable findNextVariable(Scanner scanner) { + List matchResults = new ArrayList<>(); + + // Find the start of a variable declaration + String match = scanner.findWithinHorizon(REGEX, 0); + if (match == null) { + return null; + } + + // Get subsequent lines if the previous one ends with '\' + MatchResult matchResult = scanner.match(); + matchResults.add(matchResult); + if (matchResult.group(QtProjectVariable.GROUP_VAR_TERMINATOR).startsWith("\\")) { //$NON-NLS-1$ + do { + match = scanner.findWithinHorizon(LINE_ESCAPE_REGEX, 0); + if (match == null) { + // This means that we have a newline escape where another line doesn't exist + break; + } + + matchResult = scanner.match(); + matchResults.add(matchResult); + } while (matchResult.group(QtProjectVariable.GROUP_LINE_TERMINATOR).startsWith("\\")); //$NON-NLS-1$ + } + return new QtProjectVariable(matchResults); + } + + private final int startOffset; + private final int endOffset; + private final String text; + + private final List matchResults; + + /** + * Constructs a project file variable from a list of match results obtained from a Scanner. This constructor is + * only intended to be called from within the static method findNextVariable(Scanner). + * + * @param matches + * list of MatchResult + */ + private QtProjectVariable(List matches) { + this.startOffset = matches.get(0).start(); + this.endOffset = matches.get(matches.size() - 1).end(); + this.matchResults = matches; + + StringBuilder sb = new StringBuilder(); + for (MatchResult m : matches) { + sb.append(m.group()); + } + this.text = sb.toString(); + } + + /** + * Gets the offset of this variable relative to the start of its containing document. + * + * @return the offset of this variable + */ + public int getOffset() { + return startOffset; + } + + /** + * Gets the length of this variable as it appears in its containing document. + * + * @return the total length of this variable + */ + public int getLength() { + return endOffset - startOffset; + } + + /** + * Gets the name of this variable as it appears in the document. For example, the "SOURCES" variable. + * + * @return the name of this variable + */ + public String getName() { + return matchResults.get(0).group(GROUP_VAR_NAME); + } + + /** + * the assignment operator of this variable (+= or "=") + * + * @return the assignment operator + */ + public String getAssignmentOperator() { + return matchResults.get(0).group(GROUP_VAR_ASSIGNMENT); + } + + /** + * Returns a list of value(s) assigned to this variable. Each entry in the list represents a new line. + * + * @return a List containing all of the value(s) assigned to this variable + */ + public List getValues() { + List values = new ArrayList(); + values.add(matchResults.get(0).group(GROUP_VAR_CONTENTS)); + for (int i = 1; i < matchResults.size(); i++) { + values.add(matchResults.get(i).group(GROUP_LINE_CONTENTS)); + } + return values; + } + + /** + * Returns the indentation of the given line as a String. Mainly used by the QtProjectFileWriter to write back to the Document. + * + * @param line + * the line number to check + * @return a String representing the indentation of the given line + */ + public String getIndentString(int line) { + MatchResult match = matchResults.get(line); + if (line == 0) { + StringBuilder sb = new StringBuilder(); + for (int i = 0; i < match.start(GROUP_VAR_CONTENTS) - match.start(); i++) { + sb.append(' '); + } + return sb.toString(); + } + return match.group(GROUP_LINE_INDENT); + } + + /** + * Retrieves the offset of the value portion of a given line relative to the start of its containing document. + * + * @param line + * the line to check + * @return the offset of the value + */ + public int getValueOffsetForLine(int line) { + if (line == 0) { + return matchResults.get(line).start(GROUP_VAR_CONTENTS); + } + return matchResults.get(line).start(GROUP_LINE_CONTENTS); + } + + /** + * Retrieves a String representing the value at a specific line of this variable. + * + * @param line + * the line to check + * @return the value + */ + public String getValueForLine(int line) { + if (line == 0) { + return matchResults.get(line).group(GROUP_VAR_CONTENTS); + } + return matchResults.get(line).group(GROUP_LINE_CONTENTS); + } + + /** + * Returns the ideal offset in the containing document at which a line escape can be inserted. + * + * @param line + * the line to check + * @return the ideal location for a line escape + */ + public int getLineEscapeReplacementOffset(int line) { + if (line == 0) { + return matchResults.get(line).end(GROUP_VAR_CONTENTS); + } + return matchResults.get(line).end(GROUP_LINE_CONTENTS); + } + + /** + * Returns the ideal String for the line escape character. This is mostly for spacing requirements and should be used in tandem + * with the method getLineEscapeReplacementOffset. + * + * @param line + * the line to check + * @return the ideal String for the line escape character + */ + public String getLineEscapeReplacementString(int line) { + int commentOffset = -1; + int contentsOffset = -1; + if (line == 0) { + commentOffset = matchResults.get(line).start(GROUP_VAR_COMMENT); + contentsOffset = matchResults.get(line).end(GROUP_VAR_CONTENTS); + } else { + commentOffset = matchResults.get(line).start(GROUP_LINE_COMMENT); + contentsOffset = matchResults.get(line).end(GROUP_LINE_CONTENTS); + } + + if (commentOffset > 0) { + if (commentOffset - contentsOffset == 0) { + return " \\ "; //$NON-NLS-1$ + } + } + return " \\"; //$NON-NLS-1$ + } + + /** + * Retrieves the offset of the line escape for a given line relative to its containing document. This method takes into account + * spacing and should be used to determine how to best remove a line escape character from a given line. + * + * @param line + * the line to check + * @return the offset of the line escape character + */ + public int getLineEscapeOffset(int line) { + if (line == 0) { + return matchResults.get(line).end(GROUP_VAR_CONTENTS); + } + return matchResults.get(line).end(GROUP_LINE_CONTENTS); + } + + /** + * Get the end position relative to the start of the containing document that contains the line escape character of the given + * line. This is used for removal of the line escape character and takes into account the spacing of the line. + * + * @param line + * the line to check + * @return the end position of the line escape character + */ + public int getLineEscapeEnd(int line) { + int end = -1; + if (line == 0) { + end = matchResults.get(line).end(GROUP_VAR_LINE_ESCAPE); + } else { + end = matchResults.get(line).end(GROUP_LINE_LINE_ESCAPE); + } + + if (end > 0) { + return end; + } + + if (line == 0) { + return matchResults.get(line).end(GROUP_VAR_TERMINATOR); + } + return matchResults.get(line).end(GROUP_LINE_TERMINATOR); + } + + /** + * Gets the end position of this variable relative to the containing document. + * + * @return the end position of this variable + */ + public int getEndOffset() { + return matchResults.get(matchResults.size() - 1).end(); + } + + /** + * Retrieves the full text of this variable as it appears in the document. + * + * @return the full String of this variable as it appears in the document + */ + public String getText() { + return text; + } + + /** + * Gets the total number of lines in this variable declaration. + * + * @return the total number of lines + */ + public int getNumberOfLines() { + return matchResults.size(); + } + + /** + * Retrieves a String representing the given line as it appears in the document. + * + * @param line + * the line to retrieve + * @return a String representing the line + */ + public String getLine(int line) { + return matchResults.get(line).group(); + } + + /** + * Retrieves the offset of the given line relative to its containing document. + * + * @param line + * the line to retrieve + * @return the line's offset in the document + */ + public int getLineOffset(int line) { + return matchResults.get(line).start(); + } + + /** + * Returns the line at which the specified value appears. This method checks the whole line for the value and will not match a + * subset of that String. This is equivalent to calling getValueIndex(value,false). + * + * @param value + * the value to search for + * @return the line that the value appears on or -1 if it doesn't exist + */ + public int getValueIndex(String value) { + return getValueIndex(value, false); + } + + /** + * Returns the line at which the specified value appears. This method checks the whole line for the value and will not match a + * subset of that String. If ignoreCase is false, this method searches for the value using + * equalsIgnoreCase instead of equals. + * + * @param value + * the value to search for + * @param ignoreCase + * whether or not the value is case-sensitive + * @return the line that the value appears on or -1 if it doesn't exist + */ + public int getValueIndex(String value, boolean ignoreCase) { + int line = 0; + for (String val : getValues()) { + if (ignoreCase) { + if (val.equalsIgnoreCase(value)) { + return line; + } + } else { + if (val.equals(value)) { + return line; + } + } + line++; + } + return -1; + } + + /** + * Gets the offset of the end of a given line relative to its containing document. + * + * @param line + * the line to check + * @return the offset of the end of the line + */ + public int getLineEnd(int line) { + return matchResults.get(line).end(); + } } \ No newline at end of file diff --git a/qt/org.eclipse.cdt.qt.ui/src/org/eclipse/cdt/internal/qt/ui/resources/QMLTernFileUpdateJob.java b/qt/org.eclipse.cdt.qt.ui/src/org/eclipse/cdt/internal/qt/ui/resources/QMLTernFileUpdateJob.java index 8c97f80dcc8..950cb962da6 100644 --- a/qt/org.eclipse.cdt.qt.ui/src/org/eclipse/cdt/internal/qt/ui/resources/QMLTernFileUpdateJob.java +++ b/qt/org.eclipse.cdt.qt.ui/src/org/eclipse/cdt/internal/qt/ui/resources/QMLTernFileUpdateJob.java @@ -1,76 +1,76 @@ -/******************************************************************************* - * Copyright (c) 2015 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.internal.qt.ui.resources; - -import java.io.IOException; -import java.io.InputStream; -import java.util.List; - -import javax.script.ScriptException; - -import org.eclipse.cdt.internal.qt.ui.Activator; -import org.eclipse.cdt.qt.core.IQMLAnalyzer; -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.resources.IResourceDelta; -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 QMLTernFileUpdateJob extends Job { - - private List deltaList; - private final IQMLAnalyzer analyzer = Activator.getService(IQMLAnalyzer.class); - - public QMLTernFileUpdateJob(List deltas) { - super("Add/Remove Files in Tern"); //$NON-NLS-1$ - this.deltaList = deltas; - } - - @Override - protected IStatus run(IProgressMonitor monitor) { - for (IResourceDelta delta : deltaList) { - IResource resource = delta.getResource(); - String fileName = resource.getFullPath().toString().substring(1); - - if (resource instanceof IFile) { - IFile file = (IFile) resource; - try { - if ((delta.getKind() & IResourceDelta.ADDED) > 0) { - analyzer.addFile(fileName, readFileContents(file.getContents())); - } else if ((delta.getKind() & IResourceDelta.REMOVED) > 0) { - analyzer.deleteFile(fileName); - } - } catch (NoSuchMethodException e) { - Activator.log(e); - } catch (ScriptException e) { - Activator.log(e); - } catch (IOException e) { - Activator.log(e); - } catch (CoreException e) { - Activator.log(e); - } - } - } - return Status.OK_STATUS; - } - - private String readFileContents(InputStream stream) throws IOException { - StringBuilder sb = new StringBuilder(); - int read; - while ((read = stream.read()) != -1) { - sb.append((char) read); - } - return sb.toString(); - } -} +/******************************************************************************* + * Copyright (c) 2015 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.internal.qt.ui.resources; + +import java.io.IOException; +import java.io.InputStream; +import java.util.List; + +import javax.script.ScriptException; + +import org.eclipse.cdt.internal.qt.ui.Activator; +import org.eclipse.cdt.qt.core.IQMLAnalyzer; +import org.eclipse.core.resources.IFile; +import org.eclipse.core.resources.IResource; +import org.eclipse.core.resources.IResourceDelta; +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 QMLTernFileUpdateJob extends Job { + + private List deltaList; + private final IQMLAnalyzer analyzer = Activator.getService(IQMLAnalyzer.class); + + public QMLTernFileUpdateJob(List deltas) { + super("Add/Remove Files in Tern"); //$NON-NLS-1$ + this.deltaList = deltas; + } + + @Override + protected IStatus run(IProgressMonitor monitor) { + for (IResourceDelta delta : deltaList) { + IResource resource = delta.getResource(); + String fileName = resource.getFullPath().toString().substring(1); + + if (resource instanceof IFile) { + IFile file = (IFile) resource; + try { + if ((delta.getKind() & IResourceDelta.ADDED) > 0) { + analyzer.addFile(fileName, readFileContents(file.getContents())); + } else if ((delta.getKind() & IResourceDelta.REMOVED) > 0) { + analyzer.deleteFile(fileName); + } + } catch (NoSuchMethodException e) { + Activator.log(e); + } catch (ScriptException e) { + Activator.log(e); + } catch (IOException e) { + Activator.log(e); + } catch (CoreException e) { + Activator.log(e); + } + } + } + return Status.OK_STATUS; + } + + private String readFileContents(InputStream stream) throws IOException { + StringBuilder sb = new StringBuilder(); + int read; + while ((read = stream.read()) != -1) { + sb.append((char) read); + } + return sb.toString(); + } +} diff --git a/qt/org.eclipse.cdt.qt.ui/src/org/eclipse/cdt/internal/qt/ui/resources/QtProjectFileUpdateJob.java b/qt/org.eclipse.cdt.qt.ui/src/org/eclipse/cdt/internal/qt/ui/resources/QtProjectFileUpdateJob.java index 260579a2cef..477dbe6b01d 100644 --- a/qt/org.eclipse.cdt.qt.ui/src/org/eclipse/cdt/internal/qt/ui/resources/QtProjectFileUpdateJob.java +++ b/qt/org.eclipse.cdt.qt.ui/src/org/eclipse/cdt/internal/qt/ui/resources/QtProjectFileUpdateJob.java @@ -1,157 +1,157 @@ -/******************************************************************************* - * Copyright (c) 2015 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.internal.qt.ui.resources; - -import java.io.ByteArrayInputStream; -import java.io.IOException; -import java.io.InputStream; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.eclipse.cdt.internal.qt.ui.Activator; -import org.eclipse.cdt.internal.qt.ui.editor.QtProjectFileKeyword; -import org.eclipse.cdt.internal.qt.ui.pro.parser.QtProjectFileModifier; -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.resources.IResourceDelta; -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; -import org.eclipse.jface.text.Document; -import org.eclipse.jface.text.IDocument; - -/** - * Job that calls the QtProjectFileModifier after changes to resources found in Qt Projects in order to update their - * SOURCES variable. - */ -public class QtProjectFileUpdateJob extends Job { - - private List deltaList; - - public QtProjectFileUpdateJob(List deltas) { - super("Update Qt Project File(s)"); //$NON-NLS-1$ - this.deltaList = deltas; - } - - private IFile findQtProjectFile(IProject project) throws CoreException { - for (IResource member : project.members()) { - if (member.getType() == IResource.FILE - && member.getFileExtension().equals("pro")) { //$NON-NLS-1$ - return (IFile) member; - } - } - return null; - } - - @Override - protected IStatus run(IProgressMonitor monitor) { - // Cache the project files so we don't continuously open them - Map modifierMap = new HashMap<>(); - Map projectFileMap = new HashMap<>(); - - for (IResourceDelta delta : deltaList) { - IResource resource = delta.getResource(); - IProject project = resource.getProject(); - QtProjectFileModifier modifier = modifierMap.get(project); - - if (modifier == null) { - IFile proFile = null; - try { - proFile = findQtProjectFile(project); - } catch (CoreException e) { - Activator.log("Unable to find Qt Project File", e); //$NON-NLS-1$ - } - - // We can't update a project file if it doesn't exist - if (proFile == null) { - continue; - } - - // Cache the project file under its containing project and read its contents into a Document. - projectFileMap.put(project, proFile); - StringBuilder sb = new StringBuilder(); - try (InputStream is = proFile.getContents()) { - int read = -1; - while ((read = is.read()) > 0) { - sb.append((char) read); - } - IDocument document = new Document(sb.toString()); - modifier = new QtProjectFileModifier(document); - modifierMap.put(project, modifier); - } catch (IOException e) { - Activator.log(e); - break; - } catch (CoreException e) { - Activator.log(e); - break; - } - } - - // Determine from the file extension where we should add this resource - String variableKeyword = null; - if ("cpp".equals(resource.getFileExtension())) { //$NON-NLS-1$ - variableKeyword = QtProjectFileKeyword.VAR_SOURCES.getKeyword(); - } else if ("h".equals(resource.getFileExtension())) { //$NON-NLS-1$ - variableKeyword = QtProjectFileKeyword.VAR_HEADERS.getKeyword(); - } - - if ((delta.getFlags() & IResourceDelta.MOVED_FROM) > 0) { - // Resource was moved from another location. - if (project.getFullPath().isPrefixOf(delta.getMovedFromPath())) { - String oldValue = delta.getMovedFromPath().makeRelativeTo(project.getFullPath()).toString(); - String newValue = resource.getProjectRelativePath().toString(); - - if (modifier.replaceVariableValue(variableKeyword, oldValue, newValue)) { - // If we successfully replaced the variable, continue. If this line is not executed it means we failed to - // replace and the file will be added in the subsequent code for the ADDED case. - continue; - } - } - } else if ((delta.getFlags() & IResourceDelta.MOVED_TO) > 0) { - // Somewhat edge-case where a file from one Qt Project was moved to a different Qt Project. - if (project.getFullPath().isPrefixOf(delta.getMovedToPath())) { - // Getting here means that the replace was taken care of by the previous code. Otherwise, it will be removed in - // the subsequent code for the REMOVED case. - continue; - } - } - - if ((delta.getKind() & IResourceDelta.ADDED) > 0) { - String value = resource.getProjectRelativePath().toString(); - if (value != null) { - modifier.addVariableValue(variableKeyword, value); - } - } else if ((delta.getKind() & IResourceDelta.REMOVED) > 0) { - String value = resource.getProjectRelativePath().toString(); - if (value != null) { - modifier.removeVariableValue(variableKeyword, value); - } - } - } - - // Write all documents to their respective files - for (IProject project : projectFileMap.keySet()) { - IFile file = projectFileMap.get(project); - IDocument document = modifierMap.get(project).getDocument(); - - try { - file.setContents(new ByteArrayInputStream(document.get().getBytes()), 0, null); - } catch (CoreException e) { - Activator.log(e); - } - } - return Status.OK_STATUS; - } -} +/******************************************************************************* + * Copyright (c) 2015 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.internal.qt.ui.resources; + +import java.io.ByteArrayInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.eclipse.cdt.internal.qt.ui.Activator; +import org.eclipse.cdt.internal.qt.ui.editor.QtProjectFileKeyword; +import org.eclipse.cdt.internal.qt.ui.pro.parser.QtProjectFileModifier; +import org.eclipse.core.resources.IFile; +import org.eclipse.core.resources.IProject; +import org.eclipse.core.resources.IResource; +import org.eclipse.core.resources.IResourceDelta; +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; +import org.eclipse.jface.text.Document; +import org.eclipse.jface.text.IDocument; + +/** + * Job that calls the QtProjectFileModifier after changes to resources found in Qt Projects in order to update their + * SOURCES variable. + */ +public class QtProjectFileUpdateJob extends Job { + + private List deltaList; + + public QtProjectFileUpdateJob(List deltas) { + super("Update Qt Project File(s)"); //$NON-NLS-1$ + this.deltaList = deltas; + } + + private IFile findQtProjectFile(IProject project) throws CoreException { + for (IResource member : project.members()) { + if (member.getType() == IResource.FILE + && member.getFileExtension().equals("pro")) { //$NON-NLS-1$ + return (IFile) member; + } + } + return null; + } + + @Override + protected IStatus run(IProgressMonitor monitor) { + // Cache the project files so we don't continuously open them + Map modifierMap = new HashMap<>(); + Map projectFileMap = new HashMap<>(); + + for (IResourceDelta delta : deltaList) { + IResource resource = delta.getResource(); + IProject project = resource.getProject(); + QtProjectFileModifier modifier = modifierMap.get(project); + + if (modifier == null) { + IFile proFile = null; + try { + proFile = findQtProjectFile(project); + } catch (CoreException e) { + Activator.log("Unable to find Qt Project File", e); //$NON-NLS-1$ + } + + // We can't update a project file if it doesn't exist + if (proFile == null) { + continue; + } + + // Cache the project file under its containing project and read its contents into a Document. + projectFileMap.put(project, proFile); + StringBuilder sb = new StringBuilder(); + try (InputStream is = proFile.getContents()) { + int read = -1; + while ((read = is.read()) > 0) { + sb.append((char) read); + } + IDocument document = new Document(sb.toString()); + modifier = new QtProjectFileModifier(document); + modifierMap.put(project, modifier); + } catch (IOException e) { + Activator.log(e); + break; + } catch (CoreException e) { + Activator.log(e); + break; + } + } + + // Determine from the file extension where we should add this resource + String variableKeyword = null; + if ("cpp".equals(resource.getFileExtension())) { //$NON-NLS-1$ + variableKeyword = QtProjectFileKeyword.VAR_SOURCES.getKeyword(); + } else if ("h".equals(resource.getFileExtension())) { //$NON-NLS-1$ + variableKeyword = QtProjectFileKeyword.VAR_HEADERS.getKeyword(); + } + + if ((delta.getFlags() & IResourceDelta.MOVED_FROM) > 0) { + // Resource was moved from another location. + if (project.getFullPath().isPrefixOf(delta.getMovedFromPath())) { + String oldValue = delta.getMovedFromPath().makeRelativeTo(project.getFullPath()).toString(); + String newValue = resource.getProjectRelativePath().toString(); + + if (modifier.replaceVariableValue(variableKeyword, oldValue, newValue)) { + // If we successfully replaced the variable, continue. If this line is not executed it means we failed to + // replace and the file will be added in the subsequent code for the ADDED case. + continue; + } + } + } else if ((delta.getFlags() & IResourceDelta.MOVED_TO) > 0) { + // Somewhat edge-case where a file from one Qt Project was moved to a different Qt Project. + if (project.getFullPath().isPrefixOf(delta.getMovedToPath())) { + // Getting here means that the replace was taken care of by the previous code. Otherwise, it will be removed in + // the subsequent code for the REMOVED case. + continue; + } + } + + if ((delta.getKind() & IResourceDelta.ADDED) > 0) { + String value = resource.getProjectRelativePath().toString(); + if (value != null) { + modifier.addVariableValue(variableKeyword, value); + } + } else if ((delta.getKind() & IResourceDelta.REMOVED) > 0) { + String value = resource.getProjectRelativePath().toString(); + if (value != null) { + modifier.removeVariableValue(variableKeyword, value); + } + } + } + + // Write all documents to their respective files + for (IProject project : projectFileMap.keySet()) { + IFile file = projectFileMap.get(project); + IDocument document = modifierMap.get(project).getDocument(); + + try { + file.setContents(new ByteArrayInputStream(document.get().getBytes()), 0, null); + } catch (CoreException e) { + Activator.log(e); + } + } + return Status.OK_STATUS; + } +} diff --git a/qt/org.eclipse.cdt.qt.ui/src/org/eclipse/cdt/internal/qt/ui/resources/QtResourceChangeListener.java b/qt/org.eclipse.cdt.qt.ui/src/org/eclipse/cdt/internal/qt/ui/resources/QtResourceChangeListener.java index dba67e56f31..e5620509080 100644 --- a/qt/org.eclipse.cdt.qt.ui/src/org/eclipse/cdt/internal/qt/ui/resources/QtResourceChangeListener.java +++ b/qt/org.eclipse.cdt.qt.ui/src/org/eclipse/cdt/internal/qt/ui/resources/QtResourceChangeListener.java @@ -1,128 +1,128 @@ -/******************************************************************************* - * Copyright (c) 2015 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.internal.qt.ui.resources; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.cdt.internal.qt.core.QtNature; -import org.eclipse.cdt.internal.qt.ui.Activator; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.resources.IResourceChangeEvent; -import org.eclipse.core.resources.IResourceChangeListener; -import org.eclipse.core.resources.IResourceDelta; -import org.eclipse.core.resources.IResourceDeltaVisitor; -import org.eclipse.core.runtime.CoreException; - -/** - * Detects the addition or removal of a file to a Qt project. If one of these - * resource changes is found, it triggers an update of the project's *.pro file - * to reflect the change. - */ -public class QtResourceChangeListener implements IResourceChangeListener { - - @Override - public void resourceChanged(IResourceChangeEvent event) { - // No need to check for any events other than POST_CHANGE - if ((event.getType() & (IResourceChangeEvent.POST_CHANGE | IResourceChangeEvent.POST_BUILD)) == 0) { - return; - } - - final List deltaList = new ArrayList<>(); - final List qmlDeltaList = new ArrayList<>(); - IResourceDeltaVisitor visitor = new IResourceDeltaVisitor() { - - @Override - public boolean visit(IResourceDelta delta) { - IResource resource = delta.getResource(); - - if (resource.getType() == IResource.ROOT) { - // Always traverse children of the workspace root - return true; - } else if (resource.getType() == IResource.PROJECT) { - // Only traverse children of Qt Projects - try { - IProject project = (IProject) resource; - if (project.exists() && project.isOpen() && project.hasNature(QtNature.ID)) { - return true; - } - } catch (CoreException e) { - Activator.log(e); - } - return false; - } else if (resource.getType() == IResource.FOLDER) { - // First, make sure this isn't the "build" folder - if (resource.getType() == IResource.FOLDER) { - if (resource.getName().equals("build")) { //$NON-NLS-1$ - return false; - } - } - - // Then check to make sure that the folder lies in a Qt - // Project - try { - IProject project = resource.getProject(); - if (project != null && project.hasNature(QtNature.ID)) { - return true; - } - } catch (CoreException e) { - Activator.log(e); - } - return false; - } - - // We don't care about resources that have simply been updated - if ((delta.getKind() & IResourceDelta.CHANGED) > 0) { - return false; - } - - // We only care about added and removed resources at this point - if ((delta.getKind() & IResourceDelta.ADDED | IResourceDelta.REMOVED) == 0) { - return false; - } - - if ("cpp".equals(resource.getFileExtension()) //$NON-NLS-1$ - || "h".equals(resource.getFileExtension())) { //$NON-NLS-1$ - // If we make it to this point, then we have a .cpp or .h - // file that's been added to or removed from a Qt - // Project. Add it to the list of deltas so we can update - // the project file later. - deltaList.add(delta); - } else if ("qml".equals(resource.getFileExtension())) { //$NON-NLS-1$ - qmlDeltaList.add(delta); - } - - // Doesn't really matter since this line can only be reached if - // we're dealing with a file that shouldn't have - // children anyway - return false; - } - }; - - try { - // Check all projects starting at the workspace root - event.getDelta().accept(visitor); - } catch (CoreException e) { - Activator.log(e); - } - - // Schedule the job to update the .pro files - if (!deltaList.isEmpty()) { - new QtProjectFileUpdateJob(deltaList).schedule(); - } - // Schedule the job to update the tern server with added/deleted qml - // files - if (!qmlDeltaList.isEmpty()) { - new QMLTernFileUpdateJob(qmlDeltaList).schedule(); - } - } -} +/******************************************************************************* + * Copyright (c) 2015 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.internal.qt.ui.resources; + +import java.util.ArrayList; +import java.util.List; + +import org.eclipse.cdt.internal.qt.core.QtNature; +import org.eclipse.cdt.internal.qt.ui.Activator; +import org.eclipse.core.resources.IProject; +import org.eclipse.core.resources.IResource; +import org.eclipse.core.resources.IResourceChangeEvent; +import org.eclipse.core.resources.IResourceChangeListener; +import org.eclipse.core.resources.IResourceDelta; +import org.eclipse.core.resources.IResourceDeltaVisitor; +import org.eclipse.core.runtime.CoreException; + +/** + * Detects the addition or removal of a file to a Qt project. If one of these + * resource changes is found, it triggers an update of the project's *.pro file + * to reflect the change. + */ +public class QtResourceChangeListener implements IResourceChangeListener { + + @Override + public void resourceChanged(IResourceChangeEvent event) { + // No need to check for any events other than POST_CHANGE + if ((event.getType() & (IResourceChangeEvent.POST_CHANGE | IResourceChangeEvent.POST_BUILD)) == 0) { + return; + } + + final List deltaList = new ArrayList<>(); + final List qmlDeltaList = new ArrayList<>(); + IResourceDeltaVisitor visitor = new IResourceDeltaVisitor() { + + @Override + public boolean visit(IResourceDelta delta) { + IResource resource = delta.getResource(); + + if (resource.getType() == IResource.ROOT) { + // Always traverse children of the workspace root + return true; + } else if (resource.getType() == IResource.PROJECT) { + // Only traverse children of Qt Projects + try { + IProject project = (IProject) resource; + if (project.exists() && project.isOpen() && project.hasNature(QtNature.ID)) { + return true; + } + } catch (CoreException e) { + Activator.log(e); + } + return false; + } else if (resource.getType() == IResource.FOLDER) { + // First, make sure this isn't the "build" folder + if (resource.getType() == IResource.FOLDER) { + if (resource.getName().equals("build")) { //$NON-NLS-1$ + return false; + } + } + + // Then check to make sure that the folder lies in a Qt + // Project + try { + IProject project = resource.getProject(); + if (project != null && project.hasNature(QtNature.ID)) { + return true; + } + } catch (CoreException e) { + Activator.log(e); + } + return false; + } + + // We don't care about resources that have simply been updated + if ((delta.getKind() & IResourceDelta.CHANGED) > 0) { + return false; + } + + // We only care about added and removed resources at this point + if ((delta.getKind() & IResourceDelta.ADDED | IResourceDelta.REMOVED) == 0) { + return false; + } + + if ("cpp".equals(resource.getFileExtension()) //$NON-NLS-1$ + || "h".equals(resource.getFileExtension())) { //$NON-NLS-1$ + // If we make it to this point, then we have a .cpp or .h + // file that's been added to or removed from a Qt + // Project. Add it to the list of deltas so we can update + // the project file later. + deltaList.add(delta); + } else if ("qml".equals(resource.getFileExtension())) { //$NON-NLS-1$ + qmlDeltaList.add(delta); + } + + // Doesn't really matter since this line can only be reached if + // we're dealing with a file that shouldn't have + // children anyway + return false; + } + }; + + try { + // Check all projects starting at the workspace root + event.getDelta().accept(visitor); + } catch (CoreException e) { + Activator.log(e); + } + + // Schedule the job to update the .pro files + if (!deltaList.isEmpty()) { + new QtProjectFileUpdateJob(deltaList).schedule(); + } + // Schedule the job to update the tern server with added/deleted qml + // files + if (!qmlDeltaList.isEmpty()) { + new QMLTernFileUpdateJob(qmlDeltaList).schedule(); + } + } +} diff --git a/qt/org.eclipse.cdt.qt.ui/src/org/eclipse/cdt/internal/qt/ui/resources/QtWorkspaceSaveParticipant.java b/qt/org.eclipse.cdt.qt.ui/src/org/eclipse/cdt/internal/qt/ui/resources/QtWorkspaceSaveParticipant.java index 726c064352c..57188762073 100644 --- a/qt/org.eclipse.cdt.qt.ui/src/org/eclipse/cdt/internal/qt/ui/resources/QtWorkspaceSaveParticipant.java +++ b/qt/org.eclipse.cdt.qt.ui/src/org/eclipse/cdt/internal/qt/ui/resources/QtWorkspaceSaveParticipant.java @@ -1,39 +1,39 @@ -/******************************************************************************* - * Copyright (c) 2015 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.internal.qt.ui.resources; - -import org.eclipse.core.resources.ISaveContext; -import org.eclipse.core.resources.ISaveParticipant; -import org.eclipse.core.runtime.CoreException; - -public class QtWorkspaceSaveParticipant implements ISaveParticipant { - - @Override - public void doneSaving(ISaveContext context) { - // Nothing to do - } - - @Override - public void prepareToSave(ISaveContext context) throws CoreException { - // Nothing to do - } - - @Override - public void rollback(ISaveContext context) { - // Nothing to do - } - - @Override - public void saving(ISaveContext context) throws CoreException { - context.needDelta(); - } - -} +/******************************************************************************* + * Copyright (c) 2015 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.internal.qt.ui.resources; + +import org.eclipse.core.resources.ISaveContext; +import org.eclipse.core.resources.ISaveParticipant; +import org.eclipse.core.runtime.CoreException; + +public class QtWorkspaceSaveParticipant implements ISaveParticipant { + + @Override + public void doneSaving(ISaveContext context) { + // Nothing to do + } + + @Override + public void prepareToSave(ISaveContext context) throws CoreException { + // Nothing to do + } + + @Override + public void rollback(ISaveContext context) { + // Nothing to do + } + + @Override + public void saving(ISaveContext context) throws CoreException { + context.needDelta(); + } + +} diff --git a/releng/org.eclipse.cdt.native-feature/.project b/releng/org.eclipse.cdt.native-feature/.project index a5e7312a076..446e1d4ca8f 100644 --- a/releng/org.eclipse.cdt.native-feature/.project +++ b/releng/org.eclipse.cdt.native-feature/.project @@ -1,17 +1,17 @@ - - - org.eclipse.cdt.native-feature - - - - - - org.eclipse.pde.FeatureBuilder - - - - - - org.eclipse.pde.FeatureNature - - + + + org.eclipse.cdt.native-feature + + + + + + org.eclipse.pde.FeatureBuilder + + + + + + org.eclipse.pde.FeatureNature + + diff --git a/releng/org.eclipse.cdt.sdk/about.ini b/releng/org.eclipse.cdt.sdk/about.ini index bd86cbf2103..656877d0afa 100644 --- a/releng/org.eclipse.cdt.sdk/about.ini +++ b/releng/org.eclipse.cdt.sdk/about.ini @@ -1,27 +1,27 @@ -# about.ini -# contains information about a feature -# java.io.Properties file (ISO 8859-1 with "\" escapes) -# "%key" are externalized strings defined in about.properties -# This file does not need to be translated. - -# Property "aboutText" contains blurb for "About" dialog (translated) -aboutText=%blurb - -# Property "windowImage" contains path to window icon (16x16) -# needed for primary features only - -# Property "featureImage" contains path to feature image (32x32) -featureImage=cdt_logo_icon32.png - -# Property "aboutImage" contains path to product image (500x330 or 115x164) -# needed for primary features only - -# Property "appName" contains name of the application (translated) -# needed for primary features only - -# Property "welcomePage" contains path to welcome page (special XML-based format) -welcomePage=$nl$/welcome.xml - -# Property "welcomePerspective" contains the id of the perspective in which the -# welcome page is to be opened. -# optional +# about.ini +# contains information about a feature +# java.io.Properties file (ISO 8859-1 with "\" escapes) +# "%key" are externalized strings defined in about.properties +# This file does not need to be translated. + +# Property "aboutText" contains blurb for "About" dialog (translated) +aboutText=%blurb + +# Property "windowImage" contains path to window icon (16x16) +# needed for primary features only + +# Property "featureImage" contains path to feature image (32x32) +featureImage=cdt_logo_icon32.png + +# Property "aboutImage" contains path to product image (500x330 or 115x164) +# needed for primary features only + +# Property "appName" contains name of the application (translated) +# needed for primary features only + +# Property "welcomePage" contains path to welcome page (special XML-based format) +welcomePage=$nl$/welcome.xml + +# Property "welcomePerspective" contains the id of the perspective in which the +# welcome page is to be opened. +# optional diff --git a/releng/org.eclipse.cdt.sdk/about.mappings b/releng/org.eclipse.cdt.sdk/about.mappings index c39de2d7fe5..0824105e69d 100644 --- a/releng/org.eclipse.cdt.sdk/about.mappings +++ b/releng/org.eclipse.cdt.sdk/about.mappings @@ -1,9 +1,9 @@ -# about.mappings -# contains fill-ins for about.properties -# java.io.Properties file (ISO 8859-1 with "\" escapes) -# This file does not need to be translated. - -# The following should contain the build version. -# e.g. "0=20020612" -# This value will be added automaticaly via the build scripts +# about.mappings +# contains fill-ins for about.properties +# java.io.Properties file (ISO 8859-1 with "\" escapes) +# This file does not need to be translated. + +# The following should contain the build version. +# e.g. "0=20020612" +# This value will be added automaticaly via the build scripts 0=@build@ \ No newline at end of file diff --git a/releng/org.eclipse.cdt.testing/about.ini b/releng/org.eclipse.cdt.testing/about.ini index bd86cbf2103..656877d0afa 100644 --- a/releng/org.eclipse.cdt.testing/about.ini +++ b/releng/org.eclipse.cdt.testing/about.ini @@ -1,27 +1,27 @@ -# about.ini -# contains information about a feature -# java.io.Properties file (ISO 8859-1 with "\" escapes) -# "%key" are externalized strings defined in about.properties -# This file does not need to be translated. - -# Property "aboutText" contains blurb for "About" dialog (translated) -aboutText=%blurb - -# Property "windowImage" contains path to window icon (16x16) -# needed for primary features only - -# Property "featureImage" contains path to feature image (32x32) -featureImage=cdt_logo_icon32.png - -# Property "aboutImage" contains path to product image (500x330 or 115x164) -# needed for primary features only - -# Property "appName" contains name of the application (translated) -# needed for primary features only - -# Property "welcomePage" contains path to welcome page (special XML-based format) -welcomePage=$nl$/welcome.xml - -# Property "welcomePerspective" contains the id of the perspective in which the -# welcome page is to be opened. -# optional +# about.ini +# contains information about a feature +# java.io.Properties file (ISO 8859-1 with "\" escapes) +# "%key" are externalized strings defined in about.properties +# This file does not need to be translated. + +# Property "aboutText" contains blurb for "About" dialog (translated) +aboutText=%blurb + +# Property "windowImage" contains path to window icon (16x16) +# needed for primary features only + +# Property "featureImage" contains path to feature image (32x32) +featureImage=cdt_logo_icon32.png + +# Property "aboutImage" contains path to product image (500x330 or 115x164) +# needed for primary features only + +# Property "appName" contains name of the application (translated) +# needed for primary features only + +# Property "welcomePage" contains path to welcome page (special XML-based format) +welcomePage=$nl$/welcome.xml + +# Property "welcomePerspective" contains the id of the perspective in which the +# welcome page is to be opened. +# optional diff --git a/releng/org.eclipse.cdt.testing/about.mappings b/releng/org.eclipse.cdt.testing/about.mappings index c39de2d7fe5..0824105e69d 100644 --- a/releng/org.eclipse.cdt.testing/about.mappings +++ b/releng/org.eclipse.cdt.testing/about.mappings @@ -1,9 +1,9 @@ -# about.mappings -# contains fill-ins for about.properties -# java.io.Properties file (ISO 8859-1 with "\" escapes) -# This file does not need to be translated. - -# The following should contain the build version. -# e.g. "0=20020612" -# This value will be added automaticaly via the build scripts +# about.mappings +# contains fill-ins for about.properties +# java.io.Properties file (ISO 8859-1 with "\" escapes) +# This file does not need to be translated. + +# The following should contain the build version. +# e.g. "0=20020612" +# This value will be added automaticaly via the build scripts 0=@build@ \ No newline at end of file diff --git a/releng/org.eclipse.cdt/.eclipseproduct b/releng/org.eclipse.cdt/.eclipseproduct index 1e73475d1ee..79e60ca28ac 100644 --- a/releng/org.eclipse.cdt/.eclipseproduct +++ b/releng/org.eclipse.cdt/.eclipseproduct @@ -1,4 +1,4 @@ -name=Eclipse C/C++ Development Tools -id=org.eclipse.cdt -version=1.0.0 +name=Eclipse C/C++ Development Tools +id=org.eclipse.cdt +version=1.0.0 feature.default.id=org.eclipse.cdt \ No newline at end of file diff --git a/releng/org.eclipse.cdt/about.ini b/releng/org.eclipse.cdt/about.ini index 2411cc21096..e07a7bb377e 100644 --- a/releng/org.eclipse.cdt/about.ini +++ b/releng/org.eclipse.cdt/about.ini @@ -1,24 +1,24 @@ -# about.ini -# contains information about a feature -# java.io.Properties file (ISO 8859-1 with "\" escapes) -# "%key" are externalized strings defined in about.properties -# This file does not need to be translated. - -# Property "aboutText" contains blurb for "About" dialog (translated) -aboutText=%blurb - -# Property "windowImage" contains path to window icon (16x16) -# needed for primary features only - -# Property "featureImage" contains path to feature image (32x32) -featureImage=cdt_logo_icon32.png - -# Property "aboutImage" contains path to product image (500x330 or 115x164) -# needed for primary features only - -# Property "appName" contains name of the application (translated) -# needed for primary features only - -# Property "welcomePerspective" contains the id of the perspective in which the -# welcome page is to be opened. -# optional +# about.ini +# contains information about a feature +# java.io.Properties file (ISO 8859-1 with "\" escapes) +# "%key" are externalized strings defined in about.properties +# This file does not need to be translated. + +# Property "aboutText" contains blurb for "About" dialog (translated) +aboutText=%blurb + +# Property "windowImage" contains path to window icon (16x16) +# needed for primary features only + +# Property "featureImage" contains path to feature image (32x32) +featureImage=cdt_logo_icon32.png + +# Property "aboutImage" contains path to product image (500x330 or 115x164) +# needed for primary features only + +# Property "appName" contains name of the application (translated) +# needed for primary features only + +# Property "welcomePerspective" contains the id of the perspective in which the +# welcome page is to be opened. +# optional diff --git a/releng/org.eclipse.cdt/about.mappings b/releng/org.eclipse.cdt/about.mappings index c39de2d7fe5..0824105e69d 100644 --- a/releng/org.eclipse.cdt/about.mappings +++ b/releng/org.eclipse.cdt/about.mappings @@ -1,9 +1,9 @@ -# about.mappings -# contains fill-ins for about.properties -# java.io.Properties file (ISO 8859-1 with "\" escapes) -# This file does not need to be translated. - -# The following should contain the build version. -# e.g. "0=20020612" -# This value will be added automaticaly via the build scripts +# about.mappings +# contains fill-ins for about.properties +# java.io.Properties file (ISO 8859-1 with "\" escapes) +# This file does not need to be translated. + +# The following should contain the build version. +# e.g. "0=20020612" +# This value will be added automaticaly via the build scripts 0=@build@ \ No newline at end of file diff --git a/releng/org.eclipse.cdt/css/overview.css b/releng/org.eclipse.cdt/css/overview.css index c2e11cc9b1b..d1f6b7680b0 100644 --- a/releng/org.eclipse.cdt/css/overview.css +++ b/releng/org.eclipse.cdt/css/overview.css @@ -1,9 +1,9 @@ -a#cdt img { background-image : url(graphics/obj_48/cdt_logo_icon.png); } -a#cdt:hover img { background-image : url(graphics/obj_48/cdt_logo_icon.png); } - -a#hello-world-cdt img { background-image : url(graphics/obj_48/cdt_logo_icon.png); } -a#hello-world-cdt:hover img { background-image : url(graphics/obj_48/cdt_logo_icon.png); } - -body { - background-image : url(../../org.eclipse.platform/css/graphics/contentpage/overview_wtr.jpg); -} +a#cdt img { background-image : url(graphics/obj_48/cdt_logo_icon.png); } +a#cdt:hover img { background-image : url(graphics/obj_48/cdt_logo_icon.png); } + +a#hello-world-cdt img { background-image : url(graphics/obj_48/cdt_logo_icon.png); } +a#hello-world-cdt:hover img { background-image : url(graphics/obj_48/cdt_logo_icon.png); } + +body { + background-image : url(../../org.eclipse.platform/css/graphics/contentpage/overview_wtr.jpg); +} diff --git a/releng/scripts/verify_gitattributes.sh b/releng/scripts/verify_gitattributes.sh new file mode 100755 index 00000000000..2f5a58c044a --- /dev/null +++ b/releng/scripts/verify_gitattributes.sh @@ -0,0 +1,22 @@ +#!/bin/bash + +# Print out how many of each file extension there is +# find . ! -path "./.git/*" -type f -printf "%f\n" | sed -E -e 's/.+\./\*./' | sort -u | while read i; do find . ! -path "./.git/*" -name $i | wc -l | tr -d '\n'; echo " : $i" ; done | sort -n + +# Print out all the unique file extensions, including unique names with no extension +# Each of these should be in .gitattributes +# find . ! -path "./.git/*" -type f -printf "%f\n" | sed -E -e 's/.+\./\*./' | sort -u + +find . ! -path "./.git/*" -type f -printf "%f\n" | sed -E -e 's/.+\./\\\*\\./' | sort -u | while read i +do + echo -n "Checking $i in .gitattributes: " + if grep "^$i " .gitattributes + then + echo "Found" + else + echo MISSING $i in .gitattributes. List of file: + find . ! -path "./.git/*" -type f -name "$i" + exit 1 + fi +done + diff --git a/testsrunner/org.eclipse.cdt.testsrunner.feature/.project b/testsrunner/org.eclipse.cdt.testsrunner.feature/.project index 0a31f3b573b..2d96c797b62 100644 --- a/testsrunner/org.eclipse.cdt.testsrunner.feature/.project +++ b/testsrunner/org.eclipse.cdt.testsrunner.feature/.project @@ -1,17 +1,17 @@ - - - org.eclipse.cdt.testsrunner.feature - - - - - - org.eclipse.pde.FeatureBuilder - - - - - - org.eclipse.pde.FeatureNature - - + + + org.eclipse.cdt.testsrunner.feature + + + + + + org.eclipse.pde.FeatureBuilder + + + + + + org.eclipse.pde.FeatureNature + + diff --git a/testsrunner/org.eclipse.cdt.testsrunner.feature/build.properties b/testsrunner/org.eclipse.cdt.testsrunner.feature/build.properties index 81f63024fcd..7278666f467 100644 --- a/testsrunner/org.eclipse.cdt.testsrunner.feature/build.properties +++ b/testsrunner/org.eclipse.cdt.testsrunner.feature/build.properties @@ -1,13 +1,13 @@ -############################################################################### -# Copyright (c) 2012 Marc-Andre Laperle 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: -# Marc-Andre Laperle - initial API and implementation -############################################################################### -bin.includes = feature.xml,\ - feature.properties - +############################################################################### +# Copyright (c) 2012 Marc-Andre Laperle 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: +# Marc-Andre Laperle - initial API and implementation +############################################################################### +bin.includes = feature.xml,\ + feature.properties + diff --git a/testsrunner/org.eclipse.cdt.testsrunner.tap/.project b/testsrunner/org.eclipse.cdt.testsrunner.tap/.project index 92a252fde38..d8f8f9a671d 100644 --- a/testsrunner/org.eclipse.cdt.testsrunner.tap/.project +++ b/testsrunner/org.eclipse.cdt.testsrunner.tap/.project @@ -1,34 +1,34 @@ - - - org.eclipse.cdt.testsrunner.tap - - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.pde.ManifestBuilder - - - - - org.eclipse.pde.SchemaBuilder - - - - - org.eclipse.pde.api.tools.apiAnalysisBuilder - - - - - - org.eclipse.jdt.core.javanature - org.eclipse.pde.PluginNature - org.eclipse.pde.api.tools.apiAnalysisNature - - + + + org.eclipse.cdt.testsrunner.tap + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + org.eclipse.pde.api.tools.apiAnalysisBuilder + + + + + + org.eclipse.jdt.core.javanature + org.eclipse.pde.PluginNature + org.eclipse.pde.api.tools.apiAnalysisNature + + diff --git a/testsrunner/org.eclipse.cdt.testsrunner.tests/src/org/eclipse/cdt/testsrunner/testsrunners/TAPTestCase.java b/testsrunner/org.eclipse.cdt.testsrunner.tests/src/org/eclipse/cdt/testsrunner/testsrunners/TAPTestCase.java index d977b378000..f1ffdace814 100644 --- a/testsrunner/org.eclipse.cdt.testsrunner.tests/src/org/eclipse/cdt/testsrunner/testsrunners/TAPTestCase.java +++ b/testsrunner/org.eclipse.cdt.testsrunner.tests/src/org/eclipse/cdt/testsrunner/testsrunners/TAPTestCase.java @@ -1,199 +1,199 @@ -/******************************************************************************* - * Copyright (c) 2015 Colin Leitner - * 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: - * Colin Leitner - initial implementation - *******************************************************************************/ -package org.eclipse.cdt.testsrunner.testsrunners; - -import org.eclipse.cdt.testsrunner.internal.tap.TAPTestsRunnerProvider; -import org.eclipse.cdt.testsrunner.launcher.ITestsRunnerProvider; -import org.eclipse.cdt.testsrunner.model.ITestItem.Status; -import org.eclipse.cdt.testsrunner.model.ITestMessage.Level; - -@SuppressWarnings("nls") -public class TAPTestCase extends BaseTestCase { - - @Override - protected ITestsRunnerProvider createTestsRunner() { - return new TAPTestsRunnerProvider(); - } - - // - public void testNoTestCases() { - } - - //TAP version 1 - public void testIgnoreVersion() { - } - - // - //TAP version 1 - public void testVersionMustBeOnFirstLine() { - expectTestingException(); - } - - //ok - //not ok - //ok # skip - //not ok # SKiPped - //ok # todo - //not ok # toDO - public void testBasicTestCases() { - mockModelUpdater.enterTestCase("1"); - mockModelUpdater.setTestStatus(Status.Passed); - mockModelUpdater.exitTestCase(); - mockModelUpdater.enterTestCase("2"); - mockModelUpdater.setTestStatus(Status.Failed); - mockModelUpdater.exitTestCase(); - mockModelUpdater.enterTestCase("3"); - mockModelUpdater.addTestMessage(null, 0, Level.Message, "skip"); - mockModelUpdater.setTestStatus(Status.Skipped); - mockModelUpdater.exitTestCase(); - mockModelUpdater.enterTestCase("4"); - mockModelUpdater.addTestMessage(null, 0, Level.Message, "SKiPped"); - mockModelUpdater.setTestStatus(Status.Skipped); - mockModelUpdater.exitTestCase(); - mockModelUpdater.enterTestCase("5"); - mockModelUpdater.addTestMessage(null, 0, Level.Message, "todo"); - mockModelUpdater.setTestStatus(Status.NotRun); - mockModelUpdater.exitTestCase(); - mockModelUpdater.enterTestCase("6"); - mockModelUpdater.addTestMessage(null, 0, Level.Message, "toDO"); - mockModelUpdater.setTestStatus(Status.NotRun); - mockModelUpdater.exitTestCase(); - } - - //1..3 - //ok - //not ok - public void testMorePlannedThanExecutedTestCases() { - mockModelUpdater.enterTestCase("1"); - mockModelUpdater.setTestStatus(Status.Passed); - mockModelUpdater.exitTestCase(); - mockModelUpdater.enterTestCase("2"); - mockModelUpdater.setTestStatus(Status.Failed); - mockModelUpdater.exitTestCase(); - mockModelUpdater.enterTestCase("3"); - mockModelUpdater.setTestStatus(Status.Skipped); - mockModelUpdater.exitTestCase(); - } - - //ok - //ok 4 - public void testForwardJump() { - mockModelUpdater.enterTestCase("1"); - mockModelUpdater.setTestStatus(Status.Passed); - mockModelUpdater.exitTestCase(); - mockModelUpdater.enterTestCase("2"); - mockModelUpdater.setTestStatus(Status.Skipped); - mockModelUpdater.exitTestCase(); - mockModelUpdater.enterTestCase("3"); - mockModelUpdater.setTestStatus(Status.Skipped); - mockModelUpdater.exitTestCase(); - mockModelUpdater.enterTestCase("4"); - mockModelUpdater.setTestStatus(Status.Passed); - mockModelUpdater.exitTestCase(); - } - - //ok - //ok 1 - public void testNoBackwardJump() { - mockModelUpdater.enterTestCase("1"); - mockModelUpdater.setTestStatus(Status.Passed); - mockModelUpdater.exitTestCase(); - expectTestingException(); - } - - //ok some test name - //not ok 3 other test name - public void testTestCaseName() { - mockModelUpdater.enterTestCase("some test name"); - mockModelUpdater.setTestStatus(Status.Passed); - mockModelUpdater.exitTestCase(); - mockModelUpdater.enterTestCase("2"); - mockModelUpdater.setTestStatus(Status.Skipped); - mockModelUpdater.exitTestCase(); - mockModelUpdater.enterTestCase("other test name"); - mockModelUpdater.setTestStatus(Status.Failed); - mockModelUpdater.exitTestCase(); - } - - //1..3 - //ok 1 - //Bail out! because I'm done with this testing - //Ignored trailing data - public void testBailOut() { - mockModelUpdater.enterTestCase("1"); - mockModelUpdater.setTestStatus(Status.Passed); - mockModelUpdater.exitTestCase(); - mockModelUpdater.enterTestCase("2"); - mockModelUpdater.addTestMessage(null, 0, Level.Message, "because I'm done with this testing"); - mockModelUpdater.setTestStatus(Status.Aborted); - mockModelUpdater.exitTestCase(); - mockModelUpdater.enterTestCase("3"); - mockModelUpdater.addTestMessage(null, 0, Level.Message, "because I'm done with this testing"); - mockModelUpdater.setTestStatus(Status.Aborted); - mockModelUpdater.exitTestCase(); - } - - //1..3 - //ok - //1..2 - public void testAtMostOnePlan() { - mockModelUpdater.enterTestCase("1"); - mockModelUpdater.setTestStatus(Status.Passed); - mockModelUpdater.exitTestCase(); - expectTestingException(); - } - - //1..2 # skipped for some reason - public void testSkippedAllTestsWithReason() { - mockModelUpdater.enterTestCase("1"); - mockModelUpdater.addTestMessage(null, 0, Level.Message, "skipped for some reason"); - mockModelUpdater.setTestStatus(Status.Skipped); - mockModelUpdater.exitTestCase(); - mockModelUpdater.enterTestCase("2"); - mockModelUpdater.addTestMessage(null, 0, Level.Message, "skipped for some reason"); - mockModelUpdater.setTestStatus(Status.Skipped); - mockModelUpdater.exitTestCase(); - } - - //output for 1 (1) - //output for 1 (2) - //ok - //output for 2 (1) - //output for 2 (2) - //not ok second test # skipped for some reason - //ignored output - public void testOutput() { - mockModelUpdater.enterTestCase("1"); - mockModelUpdater.addTestMessage(null, 0, Level.Message, "output for 1 (1)"); - mockModelUpdater.addTestMessage(null, 0, Level.Message, "output for 1 (2)"); - mockModelUpdater.setTestStatus(Status.Passed); - mockModelUpdater.exitTestCase(); - mockModelUpdater.enterTestCase("second test"); - mockModelUpdater.addTestMessage(null, 0, Level.Message, "skipped for some reason"); - mockModelUpdater.addTestMessage(null, 0, Level.Message, "output for 2 (1)"); - mockModelUpdater.addTestMessage(null, 0, Level.Message, "output for 2 (2)"); - mockModelUpdater.setTestStatus(Status.Skipped); - mockModelUpdater.exitTestCase(); - } - - //filenameA: info: info text - //filenameB: warning: warning text - //filenameC:17: error: error text - //ok - public void testGCCDiagnosticOutput() { - mockModelUpdater.enterTestCase("1"); - mockModelUpdater.addTestMessage("filenameA", 0, Level.Info, "info text"); - mockModelUpdater.addTestMessage("filenameB", 0, Level.Warning, "warning text"); - mockModelUpdater.addTestMessage("filenameC", 17, Level.Error, "error text"); - mockModelUpdater.setTestStatus(Status.Passed); - mockModelUpdater.exitTestCase(); - } -} +/******************************************************************************* + * Copyright (c) 2015 Colin Leitner + * 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: + * Colin Leitner - initial implementation + *******************************************************************************/ +package org.eclipse.cdt.testsrunner.testsrunners; + +import org.eclipse.cdt.testsrunner.internal.tap.TAPTestsRunnerProvider; +import org.eclipse.cdt.testsrunner.launcher.ITestsRunnerProvider; +import org.eclipse.cdt.testsrunner.model.ITestItem.Status; +import org.eclipse.cdt.testsrunner.model.ITestMessage.Level; + +@SuppressWarnings("nls") +public class TAPTestCase extends BaseTestCase { + + @Override + protected ITestsRunnerProvider createTestsRunner() { + return new TAPTestsRunnerProvider(); + } + + // + public void testNoTestCases() { + } + + //TAP version 1 + public void testIgnoreVersion() { + } + + // + //TAP version 1 + public void testVersionMustBeOnFirstLine() { + expectTestingException(); + } + + //ok + //not ok + //ok # skip + //not ok # SKiPped + //ok # todo + //not ok # toDO + public void testBasicTestCases() { + mockModelUpdater.enterTestCase("1"); + mockModelUpdater.setTestStatus(Status.Passed); + mockModelUpdater.exitTestCase(); + mockModelUpdater.enterTestCase("2"); + mockModelUpdater.setTestStatus(Status.Failed); + mockModelUpdater.exitTestCase(); + mockModelUpdater.enterTestCase("3"); + mockModelUpdater.addTestMessage(null, 0, Level.Message, "skip"); + mockModelUpdater.setTestStatus(Status.Skipped); + mockModelUpdater.exitTestCase(); + mockModelUpdater.enterTestCase("4"); + mockModelUpdater.addTestMessage(null, 0, Level.Message, "SKiPped"); + mockModelUpdater.setTestStatus(Status.Skipped); + mockModelUpdater.exitTestCase(); + mockModelUpdater.enterTestCase("5"); + mockModelUpdater.addTestMessage(null, 0, Level.Message, "todo"); + mockModelUpdater.setTestStatus(Status.NotRun); + mockModelUpdater.exitTestCase(); + mockModelUpdater.enterTestCase("6"); + mockModelUpdater.addTestMessage(null, 0, Level.Message, "toDO"); + mockModelUpdater.setTestStatus(Status.NotRun); + mockModelUpdater.exitTestCase(); + } + + //1..3 + //ok + //not ok + public void testMorePlannedThanExecutedTestCases() { + mockModelUpdater.enterTestCase("1"); + mockModelUpdater.setTestStatus(Status.Passed); + mockModelUpdater.exitTestCase(); + mockModelUpdater.enterTestCase("2"); + mockModelUpdater.setTestStatus(Status.Failed); + mockModelUpdater.exitTestCase(); + mockModelUpdater.enterTestCase("3"); + mockModelUpdater.setTestStatus(Status.Skipped); + mockModelUpdater.exitTestCase(); + } + + //ok + //ok 4 + public void testForwardJump() { + mockModelUpdater.enterTestCase("1"); + mockModelUpdater.setTestStatus(Status.Passed); + mockModelUpdater.exitTestCase(); + mockModelUpdater.enterTestCase("2"); + mockModelUpdater.setTestStatus(Status.Skipped); + mockModelUpdater.exitTestCase(); + mockModelUpdater.enterTestCase("3"); + mockModelUpdater.setTestStatus(Status.Skipped); + mockModelUpdater.exitTestCase(); + mockModelUpdater.enterTestCase("4"); + mockModelUpdater.setTestStatus(Status.Passed); + mockModelUpdater.exitTestCase(); + } + + //ok + //ok 1 + public void testNoBackwardJump() { + mockModelUpdater.enterTestCase("1"); + mockModelUpdater.setTestStatus(Status.Passed); + mockModelUpdater.exitTestCase(); + expectTestingException(); + } + + //ok some test name + //not ok 3 other test name + public void testTestCaseName() { + mockModelUpdater.enterTestCase("some test name"); + mockModelUpdater.setTestStatus(Status.Passed); + mockModelUpdater.exitTestCase(); + mockModelUpdater.enterTestCase("2"); + mockModelUpdater.setTestStatus(Status.Skipped); + mockModelUpdater.exitTestCase(); + mockModelUpdater.enterTestCase("other test name"); + mockModelUpdater.setTestStatus(Status.Failed); + mockModelUpdater.exitTestCase(); + } + + //1..3 + //ok 1 + //Bail out! because I'm done with this testing + //Ignored trailing data + public void testBailOut() { + mockModelUpdater.enterTestCase("1"); + mockModelUpdater.setTestStatus(Status.Passed); + mockModelUpdater.exitTestCase(); + mockModelUpdater.enterTestCase("2"); + mockModelUpdater.addTestMessage(null, 0, Level.Message, "because I'm done with this testing"); + mockModelUpdater.setTestStatus(Status.Aborted); + mockModelUpdater.exitTestCase(); + mockModelUpdater.enterTestCase("3"); + mockModelUpdater.addTestMessage(null, 0, Level.Message, "because I'm done with this testing"); + mockModelUpdater.setTestStatus(Status.Aborted); + mockModelUpdater.exitTestCase(); + } + + //1..3 + //ok + //1..2 + public void testAtMostOnePlan() { + mockModelUpdater.enterTestCase("1"); + mockModelUpdater.setTestStatus(Status.Passed); + mockModelUpdater.exitTestCase(); + expectTestingException(); + } + + //1..2 # skipped for some reason + public void testSkippedAllTestsWithReason() { + mockModelUpdater.enterTestCase("1"); + mockModelUpdater.addTestMessage(null, 0, Level.Message, "skipped for some reason"); + mockModelUpdater.setTestStatus(Status.Skipped); + mockModelUpdater.exitTestCase(); + mockModelUpdater.enterTestCase("2"); + mockModelUpdater.addTestMessage(null, 0, Level.Message, "skipped for some reason"); + mockModelUpdater.setTestStatus(Status.Skipped); + mockModelUpdater.exitTestCase(); + } + + //output for 1 (1) + //output for 1 (2) + //ok + //output for 2 (1) + //output for 2 (2) + //not ok second test # skipped for some reason + //ignored output + public void testOutput() { + mockModelUpdater.enterTestCase("1"); + mockModelUpdater.addTestMessage(null, 0, Level.Message, "output for 1 (1)"); + mockModelUpdater.addTestMessage(null, 0, Level.Message, "output for 1 (2)"); + mockModelUpdater.setTestStatus(Status.Passed); + mockModelUpdater.exitTestCase(); + mockModelUpdater.enterTestCase("second test"); + mockModelUpdater.addTestMessage(null, 0, Level.Message, "skipped for some reason"); + mockModelUpdater.addTestMessage(null, 0, Level.Message, "output for 2 (1)"); + mockModelUpdater.addTestMessage(null, 0, Level.Message, "output for 2 (2)"); + mockModelUpdater.setTestStatus(Status.Skipped); + mockModelUpdater.exitTestCase(); + } + + //filenameA: info: info text + //filenameB: warning: warning text + //filenameC:17: error: error text + //ok + public void testGCCDiagnosticOutput() { + mockModelUpdater.enterTestCase("1"); + mockModelUpdater.addTestMessage("filenameA", 0, Level.Info, "info text"); + mockModelUpdater.addTestMessage("filenameB", 0, Level.Warning, "warning text"); + mockModelUpdater.addTestMessage("filenameC", 17, Level.Error, "error text"); + mockModelUpdater.setTestStatus(Status.Passed); + mockModelUpdater.exitTestCase(); + } +} diff --git a/upc/org.eclipse.cdt.core.parser.upc/.classpath b/upc/org.eclipse.cdt.core.parser.upc/.classpath index b862a296d38..eca7bdba8f0 100644 --- a/upc/org.eclipse.cdt.core.parser.upc/.classpath +++ b/upc/org.eclipse.cdt.core.parser.upc/.classpath @@ -1,7 +1,7 @@ - - - - - - - + + + + + + + diff --git a/upc/org.eclipse.cdt.core.parser.upc/.settings/org.eclipse.jdt.core.prefs b/upc/org.eclipse.cdt.core.parser.upc/.settings/org.eclipse.jdt.core.prefs index 5d0c2b4c459..e4035c53318 100644 --- a/upc/org.eclipse.cdt.core.parser.upc/.settings/org.eclipse.jdt.core.prefs +++ b/upc/org.eclipse.cdt.core.parser.upc/.settings/org.eclipse.jdt.core.prefs @@ -1,70 +1,70 @@ -#Wed Nov 16 18:06:14 EST 2011 -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.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=ignore -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=warning -org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore -org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning -org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=warning -org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=warning -org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning -org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning -org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning -org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=warning -org.eclipse.jdt.core.compiler.problem.nullReference=warning -org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning -org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore -org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning -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=warning -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=warning -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=warning -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=enabled -org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=enabled -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 +#Wed Nov 16 18:06:14 EST 2011 +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.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=ignore +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=warning +org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore +org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning +org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=warning +org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=warning +org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning +org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning +org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning +org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=warning +org.eclipse.jdt.core.compiler.problem.nullReference=warning +org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning +org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore +org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning +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=warning +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=warning +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=warning +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=enabled +org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=enabled +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 diff --git a/upc/org.eclipse.cdt.managedbuilder.bupc.ui/.classpath b/upc/org.eclipse.cdt.managedbuilder.bupc.ui/.classpath index 0f14fdbe865..c4a519dc515 100644 --- a/upc/org.eclipse.cdt.managedbuilder.bupc.ui/.classpath +++ b/upc/org.eclipse.cdt.managedbuilder.bupc.ui/.classpath @@ -1,7 +1,7 @@ - - - - - - - + + + + + + + diff --git a/upc/org.eclipse.cdt.managedbuilder.bupc.ui/.settings/org.eclipse.jdt.core.prefs b/upc/org.eclipse.cdt.managedbuilder.bupc.ui/.settings/org.eclipse.jdt.core.prefs index 98fc855cc7f..0c215519200 100644 --- a/upc/org.eclipse.cdt.managedbuilder.bupc.ui/.settings/org.eclipse.jdt.core.prefs +++ b/upc/org.eclipse.cdt.managedbuilder.bupc.ui/.settings/org.eclipse.jdt.core.prefs @@ -1,12 +1,12 @@ -#Wed Nov 16 18:11:37 EST 2011 -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.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.8 +#Wed Nov 16 18:11:37 EST 2011 +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.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.8 diff --git a/visualizer/org.eclipse.cdt.visualizer.ui/src/org/eclipse/cdt/visualizer/ui/canvas/BufferedCanvas.java b/visualizer/org.eclipse.cdt.visualizer.ui/src/org/eclipse/cdt/visualizer/ui/canvas/BufferedCanvas.java index a232c29c6c2..2945c0fad97 100755 --- a/visualizer/org.eclipse.cdt.visualizer.ui/src/org/eclipse/cdt/visualizer/ui/canvas/BufferedCanvas.java +++ b/visualizer/org.eclipse.cdt.visualizer.ui/src/org/eclipse/cdt/visualizer/ui/canvas/BufferedCanvas.java @@ -164,15 +164,15 @@ public class BufferedCanvas extends Canvas bgc.setAlpha(255); // invoke paintCanvas() method to paint into the buffer - try { - paintCanvas(bgc); - } - catch (Throwable t) { - // Throwing an exception in painting code can hang Eclipse, - // so catch any exceptions here. - System.err.println("BufferedCanvas: Exception thrown in painting code: \n" + t); + try { + paintCanvas(bgc); } - + catch (Throwable t) { + // Throwing an exception in painting code can hang Eclipse, + // so catch any exceptions here. + System.err.println("BufferedCanvas: Exception thrown in painting code: \n" + t); + } + // then copy image buffer to actual canvas (reduces repaint flickering) gc.drawImage(m_doubleBuffer, 0,0); } diff --git a/visualizer/org.eclipse.cdt.visualizer.ui/src/org/eclipse/cdt/visualizer/ui/canvas/GraphicCanvas.java b/visualizer/org.eclipse.cdt.visualizer.ui/src/org/eclipse/cdt/visualizer/ui/canvas/GraphicCanvas.java index a249b52d83c..f1002ac0487 100755 --- a/visualizer/org.eclipse.cdt.visualizer.ui/src/org/eclipse/cdt/visualizer/ui/canvas/GraphicCanvas.java +++ b/visualizer/org.eclipse.cdt.visualizer.ui/src/org/eclipse/cdt/visualizer/ui/canvas/GraphicCanvas.java @@ -1,187 +1,187 @@ -/******************************************************************************* - * Copyright (c) 2012, 2014 Tilera 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: - * William R. Swanson (Tilera Corporation) - * Xavier Raynaud (Kalray) - Bug 430804 - *******************************************************************************/ - -package org.eclipse.cdt.visualizer.ui.canvas; - -import java.util.ArrayList; - -import org.eclipse.swt.SWT; -import org.eclipse.swt.graphics.GC; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Event; -import org.eclipse.swt.widgets.Listener; - - -// --------------------------------------------------------------------------- -// GraphicCanvas -// --------------------------------------------------------------------------- - -/** - * Viewer canvas -- base class for canvas that displays a collection - * of persistent, repositionable graphic objects. - * - * Note: painting is done in order objects were added, - * so objects added last are drawn "on top" of others. - * Use raise/lower methods to change the object z-ordering, if needed. - */ -public class GraphicCanvas extends BufferedCanvas -{ - // --- members --- - - /** Viewer elements. */ - protected ArrayList m_objects = null; - - - // --- constructors/destructors --- - - /** Constructor. */ - public GraphicCanvas(Composite parent) { - super(parent); - m_objects = new ArrayList(); - Listener mouseListener = new Listener() { - public void handleEvent(Event event) { - switch (event.type) { - case SWT.MouseEnter: - case SWT.MouseMove: - IGraphicObject obj = getGraphicObject(event.x, event.y); - if (obj instanceof ITooltipProvider) { - String tooltip = ((ITooltipProvider) obj).getTooltip(event.x, event.y); - setToolTipText(tooltip); - } - break; - } - } - }; - addListener(SWT.MouseMove, mouseListener); - addListener(SWT.MouseEnter, mouseListener); - } - - /** Dispose method. */ - public void dispose() { - if (m_objects != null) { - m_objects.clear(); - m_objects = null; - } - super.dispose(); - } - - - // --- object management methods --- - - /** Removes all elements */ - public void clear() { - m_objects.clear(); - } - - /** Adds an element */ - public IGraphicObject add(IGraphicObject element) { - if (! m_objects.contains(element)) { - m_objects.add(element); - } - return element; - } - - /** Removes an element */ - public void remove(IGraphicObject element) { - m_objects.remove(element); - } - - /** Raises an element to top of repaint z-ordering */ - public void raiseToFront(IGraphicObject element) { - if (m_objects.contains(element)) { - m_objects.remove(element); - m_objects.add(element); - } - } - - /** Lowers an element to bottom of repaint z-ordering */ - public void lowerToBack(IGraphicObject element) { - if (m_objects.contains(element)) { - m_objects.remove(element); - m_objects.add(0, element); - } - } - - - // --- painting methods --- - - /** Paints elements on canvas. */ - public void paintCanvas(GC gc) { - // paint background first - clearCanvas(gc); - - // we paint object list from start to end, - // so end of the list is "top" in z-ordering - - // allow objects to draw themselves - for (IGraphicObject gobj : m_objects) { - gobj.paint(gc, false); - } - - // allow objects to paint any "decorations" on top of other stuff - for (IGraphicObject gobj : m_objects) { - if (gobj.hasDecorations()) - gobj.paint(gc, true); - } - } - - - // --- point-to-object accessors --- - - /** Returns first graphic object found under specified point */ - public IGraphicObject getGraphicObject(int x, int y) { - return getGraphicObject(null, x, y); - } - - /** Returns first graphic object found under specified point. - * If type argument is non-null, returns first object assignable to specified type. - */ - public IGraphicObject getGraphicObject(Class type, int x, int y) { - IGraphicObject result = null; - - // note: have to search list in reverse order we draw it, - // so we hit items "on top" in the z-ordering first - int count = (m_objects == null) ? 0 : m_objects.size(); - for (int i=count-1; i>=0; i--) { - IGraphicObject gobj = m_objects.get(i); - if (gobj.contains(x, y)) { - if (type != null) { - Class objType = gobj.getClass(); - if (! type.isAssignableFrom(objType)) continue; - } - result = gobj; - break; - } - } - - return result; - } - - // --- model data accessors --- - - /** Returns graphic object (if any) that has specified data value. */ - public IGraphicObject getGraphicObjectFor(Object value) { - IGraphicObject result = null; - for (IGraphicObject gobj : m_objects) { - if (gobj.getData() == value) { - result = gobj; - break; - } - } - return result; - } - - /** Returns data value (if any) for the specified graphic element. */ - public Object getDataFor(IGraphicObject IGraphicObject) { - return (IGraphicObject == null) ? null : IGraphicObject.getData(); - } -} +/******************************************************************************* + * Copyright (c) 2012, 2014 Tilera 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: + * William R. Swanson (Tilera Corporation) + * Xavier Raynaud (Kalray) - Bug 430804 + *******************************************************************************/ + +package org.eclipse.cdt.visualizer.ui.canvas; + +import java.util.ArrayList; + +import org.eclipse.swt.SWT; +import org.eclipse.swt.graphics.GC; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Event; +import org.eclipse.swt.widgets.Listener; + + +// --------------------------------------------------------------------------- +// GraphicCanvas +// --------------------------------------------------------------------------- + +/** + * Viewer canvas -- base class for canvas that displays a collection + * of persistent, repositionable graphic objects. + * + * Note: painting is done in order objects were added, + * so objects added last are drawn "on top" of others. + * Use raise/lower methods to change the object z-ordering, if needed. + */ +public class GraphicCanvas extends BufferedCanvas +{ + // --- members --- + + /** Viewer elements. */ + protected ArrayList m_objects = null; + + + // --- constructors/destructors --- + + /** Constructor. */ + public GraphicCanvas(Composite parent) { + super(parent); + m_objects = new ArrayList(); + Listener mouseListener = new Listener() { + public void handleEvent(Event event) { + switch (event.type) { + case SWT.MouseEnter: + case SWT.MouseMove: + IGraphicObject obj = getGraphicObject(event.x, event.y); + if (obj instanceof ITooltipProvider) { + String tooltip = ((ITooltipProvider) obj).getTooltip(event.x, event.y); + setToolTipText(tooltip); + } + break; + } + } + }; + addListener(SWT.MouseMove, mouseListener); + addListener(SWT.MouseEnter, mouseListener); + } + + /** Dispose method. */ + public void dispose() { + if (m_objects != null) { + m_objects.clear(); + m_objects = null; + } + super.dispose(); + } + + + // --- object management methods --- + + /** Removes all elements */ + public void clear() { + m_objects.clear(); + } + + /** Adds an element */ + public IGraphicObject add(IGraphicObject element) { + if (! m_objects.contains(element)) { + m_objects.add(element); + } + return element; + } + + /** Removes an element */ + public void remove(IGraphicObject element) { + m_objects.remove(element); + } + + /** Raises an element to top of repaint z-ordering */ + public void raiseToFront(IGraphicObject element) { + if (m_objects.contains(element)) { + m_objects.remove(element); + m_objects.add(element); + } + } + + /** Lowers an element to bottom of repaint z-ordering */ + public void lowerToBack(IGraphicObject element) { + if (m_objects.contains(element)) { + m_objects.remove(element); + m_objects.add(0, element); + } + } + + + // --- painting methods --- + + /** Paints elements on canvas. */ + public void paintCanvas(GC gc) { + // paint background first + clearCanvas(gc); + + // we paint object list from start to end, + // so end of the list is "top" in z-ordering + + // allow objects to draw themselves + for (IGraphicObject gobj : m_objects) { + gobj.paint(gc, false); + } + + // allow objects to paint any "decorations" on top of other stuff + for (IGraphicObject gobj : m_objects) { + if (gobj.hasDecorations()) + gobj.paint(gc, true); + } + } + + + // --- point-to-object accessors --- + + /** Returns first graphic object found under specified point */ + public IGraphicObject getGraphicObject(int x, int y) { + return getGraphicObject(null, x, y); + } + + /** Returns first graphic object found under specified point. + * If type argument is non-null, returns first object assignable to specified type. + */ + public IGraphicObject getGraphicObject(Class type, int x, int y) { + IGraphicObject result = null; + + // note: have to search list in reverse order we draw it, + // so we hit items "on top" in the z-ordering first + int count = (m_objects == null) ? 0 : m_objects.size(); + for (int i=count-1; i>=0; i--) { + IGraphicObject gobj = m_objects.get(i); + if (gobj.contains(x, y)) { + if (type != null) { + Class objType = gobj.getClass(); + if (! type.isAssignableFrom(objType)) continue; + } + result = gobj; + break; + } + } + + return result; + } + + // --- model data accessors --- + + /** Returns graphic object (if any) that has specified data value. */ + public IGraphicObject getGraphicObjectFor(Object value) { + IGraphicObject result = null; + for (IGraphicObject gobj : m_objects) { + if (gobj.getData() == value) { + result = gobj; + break; + } + } + return result; + } + + /** Returns data value (if any) for the specified graphic element. */ + public Object getDataFor(IGraphicObject IGraphicObject) { + return (IGraphicObject == null) ? null : IGraphicObject.getData(); + } +} diff --git a/visualizer/org.eclipse.cdt.visualizer.ui/src/org/eclipse/cdt/visualizer/ui/canvas/GraphicObject.java b/visualizer/org.eclipse.cdt.visualizer.ui/src/org/eclipse/cdt/visualizer/ui/canvas/GraphicObject.java index c381197cfc9..a1a2d87510b 100755 --- a/visualizer/org.eclipse.cdt.visualizer.ui/src/org/eclipse/cdt/visualizer/ui/canvas/GraphicObject.java +++ b/visualizer/org.eclipse.cdt.visualizer.ui/src/org/eclipse/cdt/visualizer/ui/canvas/GraphicObject.java @@ -1,446 +1,446 @@ -/******************************************************************************* - * Copyright (c) 2012, 2015 Tilera 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: - * William R. Swanson (Tilera Corporation) - * Xavier Raynaud (Kalray) - Bug 430804 - * Marc Dumais (Ericsson) - Bug 458644 - *******************************************************************************/ - -package org.eclipse.cdt.visualizer.ui.canvas; - -import java.io.File; -import java.io.FileNotFoundException; - -import org.eclipse.swt.graphics.Color; -import org.eclipse.swt.graphics.GC; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.graphics.Rectangle; - - -// --------------------------------------------------------------------------- -// GraphicObject -// --------------------------------------------------------------------------- - -/** - * Graphic object base class. - * Base class for objects that can be displayed and manipulated on a GraphicCanvas. - */ -public class GraphicObject - implements IGraphicObject, ITooltipProvider -{ - // --- members --- - - /** Data object, if any, associated with this graphic object. */ - protected Object m_data = null; - - /** Bounding rectangle of this element. */ - protected Rectangle m_bounds = new Rectangle(0,0,0,0); - - /** Whether this element is visible. */ - protected boolean m_visible = true; - - /** Whether this element is selected. */ - protected boolean m_selected = false; - - /** Foreground color (null means inherit from canvas) */ - protected Color m_foreground = null; - - /** Background color (null means inherit from canvas) */ - protected Color m_background = null; - - - // --- enums --- - - /** - * Pre-defined sizes/positions for super-imposing images on graphic objects. - * @since 1.3 - */ - public enum ImageSizeAndPosition { - /** Image occupies upper-left quadrant of graphic object's area */ - UPPER_LEFT_QUADRANT(new Rectangle(0, 0, 50, 50)), - /** Image occupies upper-right quadrant of graphic object's area */ - UPPER_RIGHT_QUADRANT(new Rectangle(50, 0, 50, 50)), - /** Image occupies lower-left quadrant of graphic object's area */ - LOWER_LEFT_QUADRANT(new Rectangle(0, 50, 50, 50)), - /** Image occupies lower-right quadrant of graphic object's area */ - LOWER_RIGHT_QUADRANT(new Rectangle(50, 50, 50, 50)), - /** Image occupies lower-right 1/8 of graphic object's area */ - LOWER_RIGHT_HEIGHTH(new Rectangle(75, 75, 25, 25)), - /** Image occupies upper-left 7/8 of graphic object's area */ - UPPER_LEFT_SEVENTH_HEIGHTH(new Rectangle(0, 0, 75, 75)), - /** Image completely occupies the graphic object's area */ - MAXSIZE(new Rectangle(0, 0, 100, 100)); - - private Rectangle value; - private ImageSizeAndPosition(Rectangle sizeAndPos) { - value = sizeAndPos; - } - public Rectangle getValue() { - return value; - } - } - - - // --- constructors/destructors --- - - /** Constructor. */ - public GraphicObject() { - } - - /** Constructor. */ - public GraphicObject(int x, int y, int width, int height) { - m_bounds.x = x; - m_bounds.y = y; - m_bounds.width = width; - m_bounds.height = height; - } - - /** Constructor. */ - public GraphicObject(Rectangle bounds) { - m_bounds.x = bounds.x; - m_bounds.y = bounds.y; - m_bounds.width = bounds.width; - m_bounds.height = bounds.height; - } - - /** Constructor. */ - public GraphicObject(Object data) { - m_data = data; - } - - /** Constructor. */ - public GraphicObject(int x, int y, int width, int height, Object data) { - m_bounds.x = x; - m_bounds.y = y; - m_bounds.width = width; - m_bounds.height = height; - m_data = data; - } - - - /** Constructor. */ - public GraphicObject(Rectangle bounds, Object data) - { - m_bounds.x = bounds.x; - m_bounds.y = bounds.y; - m_bounds.width = bounds.width; - m_bounds.height = bounds.height; - m_data = data; - } - - /** Dispose method. */ - public void dispose() { - m_data = null; - } - - - // --- accessors --- - - /** Gets data object associated with this view element. */ - public Object getData() { - return m_data; - } - /** Sets data object associated with this view element. */ - public void setData(Object data) { - m_data = data; - } - - - /** Gets x location of this element */ - public int getX() { return m_bounds.x; } - /** Sets x location of this element */ - public void setX(int x) { - m_bounds.x = x; - } - - /** Gets y location of this element */ - public int getY() { return m_bounds.y; } - /** Sets y location of this element */ - public void setY(int y) { m_bounds.y = y; } - - /** Sets x/y position of this element */ - public void setPosition(int x, int y) { - m_bounds.x = x; m_bounds.y = y; - } - - - /** Gets width of this element */ - public int getWidth() { return m_bounds.width; } - /** Sets width of this element */ - public void setWidth(int w) { m_bounds.width = w; } - - /** Gets y location of this element */ - public int getHeight() { return m_bounds.height; } - /** Sets y location of this element */ - public void setHeight(int h) { m_bounds.height = h; } - - /** Sets width/height of this element */ - public void setSize(int w, int h) { - m_bounds.width = w; m_bounds.height = h; - } - - /** Gets bounding rectangle of this element. */ - public Rectangle getBounds() { - return m_bounds; - } - /** Sets bounding rectangle of this element. */ - public void setBounds(int x, int y, int w, int h) { - m_bounds.x = x; - m_bounds.y = y; - m_bounds.width = w; - m_bounds.height = h; - } - /** Sets bounding rectangle of this element. */ - public void setBounds(Rectangle bounds) { - m_bounds.x = bounds.x; - m_bounds.y = bounds.y; - m_bounds.width = bounds.width; - m_bounds.height = bounds.height; - } - - /** Returns true if element bounds contains point. */ - public boolean contains(int x, int y) { - return m_bounds.contains(x,y); - } - /** Returns true if element bounds are within specified rectangle. */ - public boolean isWithin(Rectangle region) { - return (region.x <= m_bounds.x && - region.y <= m_bounds.y && - region.x + region.width >= m_bounds.x + m_bounds.width && - region.y + region.height >= m_bounds.y + m_bounds.height); - } - - /** Gets whether this element is visible. */ - public boolean isVisible() { - return m_visible; - } - - /** Sets whether this element is visible. */ - public void setVisible(boolean visible) { - m_visible = visible; - } - - /** Gets whether this element is selected. */ - public boolean isSelected() { - return m_selected; - } - - /** Sets whether this element is selected. */ - public void setSelected(boolean selected) { - m_selected = selected; - } - - /** Sets foreground color (null means inherit from container) */ - public void setForeground(Color color) { - m_foreground = color; - } - /** Gets foreground color (null means inherit from container) */ - public Color getForeground() { - return m_foreground; - } - - /** Sets foreground color (null means inherit from container) */ - public void setBackground(Color color) { - m_background = color; - } - /** Gets background color (null means inherit from container) */ - public Color getBackground() { - return m_background; - } - - - // --- methods --- - - /** Invoked to allow element to paint itself on the viewer canvas */ - public void paint(GC gc, boolean decorations) { - if (isVisible()) { - // Set GC to reflect object properties, if set. - Color oldForeground = null; - Color oldBackground = null; - if (m_foreground != null) { - oldForeground = gc.getForeground(); - gc.setForeground(m_foreground); - } - if (m_background != null) { - oldBackground = gc.getBackground(); - gc.setBackground(m_background); - } - - // Paint the object. - if (! decorations) - paintContent(gc); - else - paintDecorations(gc); - - // Restore old state. - if (m_foreground != null) gc.setForeground(oldForeground); - if (m_background != null) gc.setBackground(oldBackground); - } - } - - /** - * Paints content of graphic object. - * GC has already been set to this object's - * current foreground/background colors. - * Default implementation draws object's bounding box. - */ - public void paintContent(GC gc) { - // Draw boundary rectangle of object. - gc.drawRectangle(m_bounds); - - // Display selection as thicker boundary. - if (isSelected()) { - int x = m_bounds.x + 1; - int y = m_bounds.y + 1; - int width = m_bounds.width - 2; if (width < 0) width = 0; - int height = m_bounds.height - 2; if (height < 0) height = 0; - gc.drawRectangle(x,y,width,height); - } - } - - /** Returns true if object has decorations to paint. */ - public boolean hasDecorations() { - return false; - } - - /** Invoked to allow element to paint decorations - * on top of other items drawn on top of it. - */ - public void paintDecorations(GC gc) { - } - - /** - * @since 1.1 - */ - @Override - public String getTooltip(int x, int y) { - return null; - } - - - /** - * Draws an image on the current canvas graphic element. Where the image is - * located, relative to the graphic object and it's horizontal and vertical - * scale is configurable. - * - * @param gc - * @param imgPath : Absolute path and name of image to display - * by this margin, in each dimension. - * @param imgRelPositionAndScale : Rectangle object, where x, y are in % and - * represent the relative position where the upper left corner of the image - * will be positioned, relative to the parent graphic object. - * The width and height are in % and represent the scale of the object relative - * to the parent object. For example. a relative width and height of 25 means - * that the image will be scaled to be 1/4 of the width and height of the parent - * graphic object. - * @throws FileNotFoundException - * @since 1.3 - */ - public void drawImage(GC gc, String imgPath, Rectangle imgRelPositionAndScale) - throws FileNotFoundException - { - // by default no margin - drawImageWithMargin(gc, imgPath, imgRelPositionAndScale, 0); - } - - /** - * Draws an image on the current canvas graphic element. Where the image is - * located, relative to the graphic object and it's horizontal and vertical - * scale is configurable. - * - * @param gc - * @param imgPath : Absolute path and name of image to draw - * @param sizeAndpos : ImageSizeAndPosition enum value - * represent the relative position where the upper left corner of the image - * will be positioned, relative to the parent graphic object. - * The width and height are in % and represent the scale of the object relative - * to the parent object. For example. a relative width and height of 25 means - * that the image will be scaled to be 1/4 of the width and height of the parent - * graphic object. - * @throws FileNotFoundException - * @since 1.3 - */ - public void drawImage(GC gc, String imgPath, ImageSizeAndPosition sizeAndpos) - throws FileNotFoundException - { - drawImageWithMargin(gc, imgPath, sizeAndpos.getValue(), 0); - } - - /** - * Draws an image on the current canvas graphic element. Where the image is - * located, relative to the graphic object and it's horizontal and vertical - * scale is configurable. This version of the method allows to specify a margin, - * in pixels, that is to be left, by reducing the size of the image - * - * @param gc - * @param imgPath : Absolute path and name of image to draw - * @param sizeAndpos : ImageSizeAndPosition enum value - * represent the relative position where the upper left corner of the image - * will be positioned, relative to the parent graphic object. - * The width and height are in % and represent the scale of the object relative - * to the parent object. For example. a relative width and height of 25 means - * that the image will be scaled to be 1/4 of the width and height of the parent - * graphic object. - * @param margin: margin in pixels: the image will be reduced in size - * by this margin, in each dimension. - * @throws FileNotFoundException - * @since 1.3 - */ - public void drawImageWithMargin(GC gc, String imgPath, ImageSizeAndPosition sizeAndpos, int margin) - throws FileNotFoundException - { - drawImageWithMargin(gc, imgPath, sizeAndpos.getValue(), margin); - } - - /** - * Draws an image on the current canvas graphic element. Where the image is - * located, relative to the graphic object and it's horizontal and vertical - * scale is configurable. This version of the method allows to specify a margin, - * in pixels, that is to be left, by reducing the size of the image - * - * @param gc - * @param imgPath : Absolute path and name of image to draw - * @param imgRelPositionAndScale : Rectangle object, where x, y are in % and - * represent the relative position where the upper left corner of the image - * will be positioned, relative to the parent graphic object. - * The width and height are in % and represent the scale of the object relative - * to the parent object. For example. a relative width and height of 25 means - * that the image will be scaled to be 1/4 of the width and height of the parent - * graphic object. - * @param margin: margin in pixels: the image will be reduced in size - * by this margin, in each dimension. - * @throws FileNotFoundException - * @since 1.3 - */ - public void drawImageWithMargin(GC gc, String imgPath, Rectangle imgRelPositionAndScale, int margin) - throws FileNotFoundException - { - File file = new File(imgPath); - if (!file.exists()) { - throw new FileNotFoundException(); - } - if (margin < 0) margin = 0; - - // extract params - int imgPosX = imgRelPositionAndScale.x; - int imgPosY = imgRelPositionAndScale.y; - int imgScaleW = imgRelPositionAndScale.width; - int imgScaleH = imgRelPositionAndScale.height; - - // compute wanted image pixel position and size - float posX = (m_bounds.x + (float) m_bounds.width * imgPosX / 100) + margin; - float posY = (m_bounds.y + (float) m_bounds.height * imgPosY / 100) + margin; - float width = ((float) m_bounds.width * imgScaleW / 100) - 2 * margin; - float height = ((float) m_bounds.height * imgScaleH / 100) - 2 * margin; - - Image img = new Image(gc.getDevice(),imgPath); - // draw image - gc.drawImage(img, 0, 0, img.getBounds().width, img.getBounds().height, - Math.round(posX), Math.round(posY), Math.round(width), Math.round(height)); - } -} +/******************************************************************************* + * Copyright (c) 2012, 2015 Tilera 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: + * William R. Swanson (Tilera Corporation) + * Xavier Raynaud (Kalray) - Bug 430804 + * Marc Dumais (Ericsson) - Bug 458644 + *******************************************************************************/ + +package org.eclipse.cdt.visualizer.ui.canvas; + +import java.io.File; +import java.io.FileNotFoundException; + +import org.eclipse.swt.graphics.Color; +import org.eclipse.swt.graphics.GC; +import org.eclipse.swt.graphics.Image; +import org.eclipse.swt.graphics.Rectangle; + + +// --------------------------------------------------------------------------- +// GraphicObject +// --------------------------------------------------------------------------- + +/** + * Graphic object base class. + * Base class for objects that can be displayed and manipulated on a GraphicCanvas. + */ +public class GraphicObject + implements IGraphicObject, ITooltipProvider +{ + // --- members --- + + /** Data object, if any, associated with this graphic object. */ + protected Object m_data = null; + + /** Bounding rectangle of this element. */ + protected Rectangle m_bounds = new Rectangle(0,0,0,0); + + /** Whether this element is visible. */ + protected boolean m_visible = true; + + /** Whether this element is selected. */ + protected boolean m_selected = false; + + /** Foreground color (null means inherit from canvas) */ + protected Color m_foreground = null; + + /** Background color (null means inherit from canvas) */ + protected Color m_background = null; + + + // --- enums --- + + /** + * Pre-defined sizes/positions for super-imposing images on graphic objects. + * @since 1.3 + */ + public enum ImageSizeAndPosition { + /** Image occupies upper-left quadrant of graphic object's area */ + UPPER_LEFT_QUADRANT(new Rectangle(0, 0, 50, 50)), + /** Image occupies upper-right quadrant of graphic object's area */ + UPPER_RIGHT_QUADRANT(new Rectangle(50, 0, 50, 50)), + /** Image occupies lower-left quadrant of graphic object's area */ + LOWER_LEFT_QUADRANT(new Rectangle(0, 50, 50, 50)), + /** Image occupies lower-right quadrant of graphic object's area */ + LOWER_RIGHT_QUADRANT(new Rectangle(50, 50, 50, 50)), + /** Image occupies lower-right 1/8 of graphic object's area */ + LOWER_RIGHT_HEIGHTH(new Rectangle(75, 75, 25, 25)), + /** Image occupies upper-left 7/8 of graphic object's area */ + UPPER_LEFT_SEVENTH_HEIGHTH(new Rectangle(0, 0, 75, 75)), + /** Image completely occupies the graphic object's area */ + MAXSIZE(new Rectangle(0, 0, 100, 100)); + + private Rectangle value; + private ImageSizeAndPosition(Rectangle sizeAndPos) { + value = sizeAndPos; + } + public Rectangle getValue() { + return value; + } + } + + + // --- constructors/destructors --- + + /** Constructor. */ + public GraphicObject() { + } + + /** Constructor. */ + public GraphicObject(int x, int y, int width, int height) { + m_bounds.x = x; + m_bounds.y = y; + m_bounds.width = width; + m_bounds.height = height; + } + + /** Constructor. */ + public GraphicObject(Rectangle bounds) { + m_bounds.x = bounds.x; + m_bounds.y = bounds.y; + m_bounds.width = bounds.width; + m_bounds.height = bounds.height; + } + + /** Constructor. */ + public GraphicObject(Object data) { + m_data = data; + } + + /** Constructor. */ + public GraphicObject(int x, int y, int width, int height, Object data) { + m_bounds.x = x; + m_bounds.y = y; + m_bounds.width = width; + m_bounds.height = height; + m_data = data; + } + + + /** Constructor. */ + public GraphicObject(Rectangle bounds, Object data) + { + m_bounds.x = bounds.x; + m_bounds.y = bounds.y; + m_bounds.width = bounds.width; + m_bounds.height = bounds.height; + m_data = data; + } + + /** Dispose method. */ + public void dispose() { + m_data = null; + } + + + // --- accessors --- + + /** Gets data object associated with this view element. */ + public Object getData() { + return m_data; + } + /** Sets data object associated with this view element. */ + public void setData(Object data) { + m_data = data; + } + + + /** Gets x location of this element */ + public int getX() { return m_bounds.x; } + /** Sets x location of this element */ + public void setX(int x) { + m_bounds.x = x; + } + + /** Gets y location of this element */ + public int getY() { return m_bounds.y; } + /** Sets y location of this element */ + public void setY(int y) { m_bounds.y = y; } + + /** Sets x/y position of this element */ + public void setPosition(int x, int y) { + m_bounds.x = x; m_bounds.y = y; + } + + + /** Gets width of this element */ + public int getWidth() { return m_bounds.width; } + /** Sets width of this element */ + public void setWidth(int w) { m_bounds.width = w; } + + /** Gets y location of this element */ + public int getHeight() { return m_bounds.height; } + /** Sets y location of this element */ + public void setHeight(int h) { m_bounds.height = h; } + + /** Sets width/height of this element */ + public void setSize(int w, int h) { + m_bounds.width = w; m_bounds.height = h; + } + + /** Gets bounding rectangle of this element. */ + public Rectangle getBounds() { + return m_bounds; + } + /** Sets bounding rectangle of this element. */ + public void setBounds(int x, int y, int w, int h) { + m_bounds.x = x; + m_bounds.y = y; + m_bounds.width = w; + m_bounds.height = h; + } + /** Sets bounding rectangle of this element. */ + public void setBounds(Rectangle bounds) { + m_bounds.x = bounds.x; + m_bounds.y = bounds.y; + m_bounds.width = bounds.width; + m_bounds.height = bounds.height; + } + + /** Returns true if element bounds contains point. */ + public boolean contains(int x, int y) { + return m_bounds.contains(x,y); + } + /** Returns true if element bounds are within specified rectangle. */ + public boolean isWithin(Rectangle region) { + return (region.x <= m_bounds.x && + region.y <= m_bounds.y && + region.x + region.width >= m_bounds.x + m_bounds.width && + region.y + region.height >= m_bounds.y + m_bounds.height); + } + + /** Gets whether this element is visible. */ + public boolean isVisible() { + return m_visible; + } + + /** Sets whether this element is visible. */ + public void setVisible(boolean visible) { + m_visible = visible; + } + + /** Gets whether this element is selected. */ + public boolean isSelected() { + return m_selected; + } + + /** Sets whether this element is selected. */ + public void setSelected(boolean selected) { + m_selected = selected; + } + + /** Sets foreground color (null means inherit from container) */ + public void setForeground(Color color) { + m_foreground = color; + } + /** Gets foreground color (null means inherit from container) */ + public Color getForeground() { + return m_foreground; + } + + /** Sets foreground color (null means inherit from container) */ + public void setBackground(Color color) { + m_background = color; + } + /** Gets background color (null means inherit from container) */ + public Color getBackground() { + return m_background; + } + + + // --- methods --- + + /** Invoked to allow element to paint itself on the viewer canvas */ + public void paint(GC gc, boolean decorations) { + if (isVisible()) { + // Set GC to reflect object properties, if set. + Color oldForeground = null; + Color oldBackground = null; + if (m_foreground != null) { + oldForeground = gc.getForeground(); + gc.setForeground(m_foreground); + } + if (m_background != null) { + oldBackground = gc.getBackground(); + gc.setBackground(m_background); + } + + // Paint the object. + if (! decorations) + paintContent(gc); + else + paintDecorations(gc); + + // Restore old state. + if (m_foreground != null) gc.setForeground(oldForeground); + if (m_background != null) gc.setBackground(oldBackground); + } + } + + /** + * Paints content of graphic object. + * GC has already been set to this object's + * current foreground/background colors. + * Default implementation draws object's bounding box. + */ + public void paintContent(GC gc) { + // Draw boundary rectangle of object. + gc.drawRectangle(m_bounds); + + // Display selection as thicker boundary. + if (isSelected()) { + int x = m_bounds.x + 1; + int y = m_bounds.y + 1; + int width = m_bounds.width - 2; if (width < 0) width = 0; + int height = m_bounds.height - 2; if (height < 0) height = 0; + gc.drawRectangle(x,y,width,height); + } + } + + /** Returns true if object has decorations to paint. */ + public boolean hasDecorations() { + return false; + } + + /** Invoked to allow element to paint decorations + * on top of other items drawn on top of it. + */ + public void paintDecorations(GC gc) { + } + + /** + * @since 1.1 + */ + @Override + public String getTooltip(int x, int y) { + return null; + } + + + /** + * Draws an image on the current canvas graphic element. Where the image is + * located, relative to the graphic object and it's horizontal and vertical + * scale is configurable. + * + * @param gc + * @param imgPath : Absolute path and name of image to display + * by this margin, in each dimension. + * @param imgRelPositionAndScale : Rectangle object, where x, y are in % and + * represent the relative position where the upper left corner of the image + * will be positioned, relative to the parent graphic object. + * The width and height are in % and represent the scale of the object relative + * to the parent object. For example. a relative width and height of 25 means + * that the image will be scaled to be 1/4 of the width and height of the parent + * graphic object. + * @throws FileNotFoundException + * @since 1.3 + */ + public void drawImage(GC gc, String imgPath, Rectangle imgRelPositionAndScale) + throws FileNotFoundException + { + // by default no margin + drawImageWithMargin(gc, imgPath, imgRelPositionAndScale, 0); + } + + /** + * Draws an image on the current canvas graphic element. Where the image is + * located, relative to the graphic object and it's horizontal and vertical + * scale is configurable. + * + * @param gc + * @param imgPath : Absolute path and name of image to draw + * @param sizeAndpos : ImageSizeAndPosition enum value + * represent the relative position where the upper left corner of the image + * will be positioned, relative to the parent graphic object. + * The width and height are in % and represent the scale of the object relative + * to the parent object. For example. a relative width and height of 25 means + * that the image will be scaled to be 1/4 of the width and height of the parent + * graphic object. + * @throws FileNotFoundException + * @since 1.3 + */ + public void drawImage(GC gc, String imgPath, ImageSizeAndPosition sizeAndpos) + throws FileNotFoundException + { + drawImageWithMargin(gc, imgPath, sizeAndpos.getValue(), 0); + } + + /** + * Draws an image on the current canvas graphic element. Where the image is + * located, relative to the graphic object and it's horizontal and vertical + * scale is configurable. This version of the method allows to specify a margin, + * in pixels, that is to be left, by reducing the size of the image + * + * @param gc + * @param imgPath : Absolute path and name of image to draw + * @param sizeAndpos : ImageSizeAndPosition enum value + * represent the relative position where the upper left corner of the image + * will be positioned, relative to the parent graphic object. + * The width and height are in % and represent the scale of the object relative + * to the parent object. For example. a relative width and height of 25 means + * that the image will be scaled to be 1/4 of the width and height of the parent + * graphic object. + * @param margin: margin in pixels: the image will be reduced in size + * by this margin, in each dimension. + * @throws FileNotFoundException + * @since 1.3 + */ + public void drawImageWithMargin(GC gc, String imgPath, ImageSizeAndPosition sizeAndpos, int margin) + throws FileNotFoundException + { + drawImageWithMargin(gc, imgPath, sizeAndpos.getValue(), margin); + } + + /** + * Draws an image on the current canvas graphic element. Where the image is + * located, relative to the graphic object and it's horizontal and vertical + * scale is configurable. This version of the method allows to specify a margin, + * in pixels, that is to be left, by reducing the size of the image + * + * @param gc + * @param imgPath : Absolute path and name of image to draw + * @param imgRelPositionAndScale : Rectangle object, where x, y are in % and + * represent the relative position where the upper left corner of the image + * will be positioned, relative to the parent graphic object. + * The width and height are in % and represent the scale of the object relative + * to the parent object. For example. a relative width and height of 25 means + * that the image will be scaled to be 1/4 of the width and height of the parent + * graphic object. + * @param margin: margin in pixels: the image will be reduced in size + * by this margin, in each dimension. + * @throws FileNotFoundException + * @since 1.3 + */ + public void drawImageWithMargin(GC gc, String imgPath, Rectangle imgRelPositionAndScale, int margin) + throws FileNotFoundException + { + File file = new File(imgPath); + if (!file.exists()) { + throw new FileNotFoundException(); + } + if (margin < 0) margin = 0; + + // extract params + int imgPosX = imgRelPositionAndScale.x; + int imgPosY = imgRelPositionAndScale.y; + int imgScaleW = imgRelPositionAndScale.width; + int imgScaleH = imgRelPositionAndScale.height; + + // compute wanted image pixel position and size + float posX = (m_bounds.x + (float) m_bounds.width * imgPosX / 100) + margin; + float posY = (m_bounds.y + (float) m_bounds.height * imgPosY / 100) + margin; + float width = ((float) m_bounds.width * imgScaleW / 100) - 2 * margin; + float height = ((float) m_bounds.height * imgScaleH / 100) - 2 * margin; + + Image img = new Image(gc.getDevice(),imgPath); + // draw image + gc.drawImage(img, 0, 0, img.getBounds().width, img.getBounds().height, + Math.round(posX), Math.round(posY), Math.round(width), Math.round(height)); + } +} diff --git a/windows/org.eclipse.cdt.msw.build/.classpath b/windows/org.eclipse.cdt.msw.build/.classpath index a0c6dd9cee8..22f30643cba 100644 --- a/windows/org.eclipse.cdt.msw.build/.classpath +++ b/windows/org.eclipse.cdt.msw.build/.classpath @@ -1,7 +1,7 @@ - - - - - - - + + + + + + + diff --git a/windows/org.eclipse.cdt.msw.build/.settings/org.eclipse.jdt.core.prefs b/windows/org.eclipse.cdt.msw.build/.settings/org.eclipse.jdt.core.prefs index ff348d0f7a5..597e42768b6 100644 --- a/windows/org.eclipse.cdt.msw.build/.settings/org.eclipse.jdt.core.prefs +++ b/windows/org.eclipse.cdt.msw.build/.settings/org.eclipse.jdt.core.prefs @@ -1,12 +1,12 @@ -#Wed Nov 16 18:13:49 EST 2011 -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.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.8 +#Wed Nov 16 18:13:49 EST 2011 +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.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.8 diff --git a/windows/org.eclipse.cdt.msw.build/src/org/eclipse/cdt/msw/build/core/MSVCToolChain.java b/windows/org.eclipse.cdt.msw.build/src/org/eclipse/cdt/msw/build/core/MSVCToolChain.java index 384d017e60a..0fd10bd3d40 100644 --- a/windows/org.eclipse.cdt.msw.build/src/org/eclipse/cdt/msw/build/core/MSVCToolChain.java +++ b/windows/org.eclipse.cdt.msw.build/src/org/eclipse/cdt/msw/build/core/MSVCToolChain.java @@ -1,281 +1,281 @@ -/******************************************************************************* - * 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.msw.build.core; - -import java.io.File; -import java.net.URI; -import java.nio.file.Path; -import java.nio.file.Paths; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.eclipse.cdt.core.CCorePlugin; -import org.eclipse.cdt.core.build.IToolChain; -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.core.model.ILanguage; -import org.eclipse.cdt.core.parser.ExtendedScannerInfo; -import org.eclipse.cdt.core.parser.IExtendedScannerInfo; -import org.eclipse.core.resources.IBuildConfiguration; -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.resources.IWorkspaceRoot; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.Platform; -import org.eclipse.core.runtime.PlatformObject; -import org.osgi.framework.Version; - -public class MSVCToolChain extends PlatformObject implements IToolChain { - - private final IToolChainProvider provider; - private final Path path; - private final Map properties = new HashMap<>(); - private final String id; - private final String arch; - private final String version; - private final IEnvironmentVariable pathVar; - private final IEnvironmentVariable includeVar; - private final IEnvironmentVariable libVar; - private final String[] includeDirs; - private final Map symbols; - - public MSVCToolChain(IToolChainProvider provider, Path path) { - this.provider = provider; - this.path = path; - - // path = /bin// - String targetArch = path.getFileName().toString(); - this.arch = targetArch.equalsIgnoreCase("x86") ? Platform.ARCH_X86 : Platform.ARCH_X86_64; //$NON-NLS-1$ - this.id = "msvc." + arch; //$NON-NLS-1$ - this.version = path.getParent().getParent().getParent().getFileName().toString(); - - Path kitRoot = Paths.get("C:", "Program Files (x86)", "Windows Kits", "10"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - List versions = Arrays.asList(kitRoot.resolve("lib").toFile().list()); //$NON-NLS-1$ - Collections.sort(versions, (v1, v2) -> { - Version ver1; - try { - ver1 = new Version(v1); - } catch (IllegalArgumentException e) { - return 1; - } - - Version ver2; - try { - ver2 = new Version(v2); - } catch (IllegalArgumentException e) { - return -1; - } - - return ver2.compareTo(ver1); - }); - String sdkVersion = versions.iterator().next(); - - pathVar = new EnvironmentVariable("Path", String.join(File.pathSeparator, //$NON-NLS-1$ - path.toString(), - kitRoot.resolve("bin").resolve(sdkVersion).resolve(targetArch).toString() //$NON-NLS-1$ - ), IEnvironmentVariable.ENVVAR_PREPEND, File.pathSeparator); - - this.includeDirs = new String[] { - path.getParent().getParent().getParent().resolve("include").toString(), //$NON-NLS-1$ - kitRoot.resolve("include").resolve(sdkVersion).resolve("ucrt").toString(), //$NON-NLS-1$ //$NON-NLS-2$ - kitRoot.resolve("include").resolve(sdkVersion).resolve("shared").toString(), //$NON-NLS-1$ //$NON-NLS-2$ - kitRoot.resolve("include").resolve(sdkVersion).resolve("um").toString(), //$NON-NLS-1$ //$NON-NLS-2$ - kitRoot.resolve("include").resolve(sdkVersion).resolve("winrt").toString() //$NON-NLS-1$ //$NON-NLS-2$ - }; - - includeVar = new EnvironmentVariable("INCLUDE", String.join(File.pathSeparator, this.includeDirs), //$NON-NLS-1$ - IEnvironmentVariable.ENVVAR_REPLACE, File.pathSeparator); - - libVar = new EnvironmentVariable("LIB", String.join(File.pathSeparator, //$NON-NLS-1$ - path.getParent().getParent().getParent().resolve("lib").resolve(targetArch).toString(), //$NON-NLS-1$ - kitRoot.resolve("lib").resolve(sdkVersion).resolve("ucrt").resolve(targetArch).toString(), //$NON-NLS-1$ //$NON-NLS-2$ - kitRoot.resolve("lib").resolve(sdkVersion).resolve("um").resolve(targetArch).toString() //$NON-NLS-1$ //$NON-NLS-2$ - ), IEnvironmentVariable.ENVVAR_REPLACE, File.pathSeparator); - - symbols = new HashMap<>(); - symbols.put("_WIN32", "1"); //$NON-NLS-1$ //$NON-NLS-2$ - if (this.arch.equals(Platform.ARCH_X86)) { - symbols.put("_M_IX86", "600"); //$NON-NLS-1$ //$NON-NLS-2$ - } else { - symbols.put("_WIN64", "1"); //$NON-NLS-1$ //$NON-NLS-2$ - symbols.put("_M_X64", "100"); //$NON-NLS-1$ //$NON-NLS-2$ - } - // TODO make this more dynamic to actual version - symbols.put("_MSC_VER", "1900"); //$NON-NLS-1$ //$NON-NLS-2$ - - // Microsoft specific modifiers that can be ignored - symbols.put("__cdecl", ""); //$NON-NLS-1$ //$NON-NLS-2$ - symbols.put("__fastcall", ""); //$NON-NLS-1$ //$NON-NLS-2$ - symbols.put("__restrict", ""); //$NON-NLS-1$ //$NON-NLS-2$ - symbols.put("__sptr", ""); //$NON-NLS-1$ //$NON-NLS-2$ - symbols.put("__stdcall", ""); //$NON-NLS-1$ //$NON-NLS-2$ - symbols.put("__unaligned", ""); //$NON-NLS-1$ //$NON-NLS-2$ - symbols.put("__uptr", ""); //$NON-NLS-1$ //$NON-NLS-2$ - symbols.put("__w64", ""); //$NON-NLS-1$ //$NON-NLS-2$ - - // Redefine some things so that the CDT parser can handle them, until there is a VC specific parser - symbols.put("__forceinline", "__inline"); //$NON-NLS-1$ //$NON-NLS-2$ - symbols.put("__int8", "char"); //$NON-NLS-1$ //$NON-NLS-2$ - symbols.put("__int16", "short"); //$NON-NLS-1$ //$NON-NLS-2$ - symbols.put("__int32", "int"); //$NON-NLS-1$ //$NON-NLS-2$ - symbols.put("__int64", "long long"); //$NON-NLS-1$ //$NON-NLS-2$ - } - - @Override - public IToolChainProvider getProvider() { - return provider; - } - - @Override - public String getId() { - return id; - } - - @Override - public String getVersion() { - return version; - } - - @Override - public String getName() { - return "Visual C++"; - } - - @Override - public String getProperty(String key) { - String value = properties.get(key); - if (value != null) { - return value; - } - - // By default, we're a local GCC - switch (key) { - case ATTR_OS: - return Platform.OS_WIN32; - case ATTR_ARCH: - return arch; - } - - return null; - } - - @Override - public void setProperty(String key, String value) { - properties.put(key, value); - } - - @Override - public IEnvironmentVariable[] getVariables() { - return new IEnvironmentVariable[] { pathVar, includeVar, libVar }; - } - - @Override - public IEnvironmentVariable getVariable(String name) { - switch (name) { - case "PATH": //$NON-NLS-1$ - case "Path": //$NON-NLS-1$ - return pathVar; - default: - return null; - } - } - - @Override - public String[] getErrorParserIds() { - return new String[] { CCorePlugin.PLUGIN_ID + ".VCErrorParser" //$NON-NLS-1$ - }; - } - - @Override - public String getBinaryParserId() { - return CCorePlugin.PLUGIN_ID + ".PE"; //$NON-NLS-1$ - } - - @Override - public Path getCommandPath(Path command) { - if (command.isAbsolute()) { - return command; - } else { - return this.path.resolve(command); - } - } - - @Override - public String[] getCompileCommands() { - return new String[] { "cl", "cl.exe" //$NON-NLS-1$ //$NON-NLS-2$ - }; - } - - @Override - public IExtendedScannerInfo getDefaultScannerInfo(IBuildConfiguration buildConfig, - IExtendedScannerInfo baseScannerInfo, ILanguage language, URI buildDirectoryURI) { - return new ExtendedScannerInfo(symbols, includeDirs); - } - - @Override - public IExtendedScannerInfo getScannerInfo(IBuildConfiguration buildConfig, List command, - IExtendedScannerInfo baseScannerInfo, IResource resource, URI buildDirectoryURI) { - Map symbols = new HashMap<>(this.symbols); - List includeDirs = new ArrayList<>(Arrays.asList(this.includeDirs)); - - for (String arg : command) { - if (arg.startsWith("-") || arg.startsWith("/")) { //$NON-NLS-1$ //$NON-NLS-2$ - if (arg.charAt(1) == 'I') { - includeDirs.add(arg.substring(2)); - } else if (arg.charAt(1) == 'D') { - String[] define = arg.substring(2).split("="); //$NON-NLS-1$ - if (define.length == 1) { - symbols.put(define[0], "1"); //$NON-NLS-1$ - } else { - symbols.put(define[0], define[1]); - } - } - } - } - - return new ExtendedScannerInfo(symbols, includeDirs.toArray(new String[includeDirs.size()])); - } - - @Override - public IResource[] getResourcesFromCommand(List command, URI buildDirectoryURI) { - // Start at the back looking for arguments - // TODO this was copied from the GCCToolChain, good candidate for the default implementation - List resources = new ArrayList<>(); - IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); - for (int i = command.size() - 1; i >= 0; --i) { - String arg = command.get(i); - if (arg.startsWith("-") || arg.startsWith("/")) { //$NON-NLS-1$ //$NON-NLS-2$ - // ran into an option, we're done. - break; - } - Path srcPath = Paths.get(arg); - URI uri; - if (srcPath.isAbsolute()) { - uri = srcPath.toUri(); - } else { - try { - uri = buildDirectoryURI.resolve(arg); - } catch (IllegalArgumentException e) { - // Bad URI - continue; - } - } - - for (IFile resource : root.findFilesForLocationURI(uri)) { - resources.add(resource); - } - } - - return resources.toArray(new IResource[resources.size()]); - } -} +/******************************************************************************* + * 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.msw.build.core; + +import java.io.File; +import java.net.URI; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.eclipse.cdt.core.CCorePlugin; +import org.eclipse.cdt.core.build.IToolChain; +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.core.model.ILanguage; +import org.eclipse.cdt.core.parser.ExtendedScannerInfo; +import org.eclipse.cdt.core.parser.IExtendedScannerInfo; +import org.eclipse.core.resources.IBuildConfiguration; +import org.eclipse.core.resources.IFile; +import org.eclipse.core.resources.IResource; +import org.eclipse.core.resources.IWorkspaceRoot; +import org.eclipse.core.resources.ResourcesPlugin; +import org.eclipse.core.runtime.Platform; +import org.eclipse.core.runtime.PlatformObject; +import org.osgi.framework.Version; + +public class MSVCToolChain extends PlatformObject implements IToolChain { + + private final IToolChainProvider provider; + private final Path path; + private final Map properties = new HashMap<>(); + private final String id; + private final String arch; + private final String version; + private final IEnvironmentVariable pathVar; + private final IEnvironmentVariable includeVar; + private final IEnvironmentVariable libVar; + private final String[] includeDirs; + private final Map symbols; + + public MSVCToolChain(IToolChainProvider provider, Path path) { + this.provider = provider; + this.path = path; + + // path = /bin// + String targetArch = path.getFileName().toString(); + this.arch = targetArch.equalsIgnoreCase("x86") ? Platform.ARCH_X86 : Platform.ARCH_X86_64; //$NON-NLS-1$ + this.id = "msvc." + arch; //$NON-NLS-1$ + this.version = path.getParent().getParent().getParent().getFileName().toString(); + + Path kitRoot = Paths.get("C:", "Program Files (x86)", "Windows Kits", "10"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ + List versions = Arrays.asList(kitRoot.resolve("lib").toFile().list()); //$NON-NLS-1$ + Collections.sort(versions, (v1, v2) -> { + Version ver1; + try { + ver1 = new Version(v1); + } catch (IllegalArgumentException e) { + return 1; + } + + Version ver2; + try { + ver2 = new Version(v2); + } catch (IllegalArgumentException e) { + return -1; + } + + return ver2.compareTo(ver1); + }); + String sdkVersion = versions.iterator().next(); + + pathVar = new EnvironmentVariable("Path", String.join(File.pathSeparator, //$NON-NLS-1$ + path.toString(), + kitRoot.resolve("bin").resolve(sdkVersion).resolve(targetArch).toString() //$NON-NLS-1$ + ), IEnvironmentVariable.ENVVAR_PREPEND, File.pathSeparator); + + this.includeDirs = new String[] { + path.getParent().getParent().getParent().resolve("include").toString(), //$NON-NLS-1$ + kitRoot.resolve("include").resolve(sdkVersion).resolve("ucrt").toString(), //$NON-NLS-1$ //$NON-NLS-2$ + kitRoot.resolve("include").resolve(sdkVersion).resolve("shared").toString(), //$NON-NLS-1$ //$NON-NLS-2$ + kitRoot.resolve("include").resolve(sdkVersion).resolve("um").toString(), //$NON-NLS-1$ //$NON-NLS-2$ + kitRoot.resolve("include").resolve(sdkVersion).resolve("winrt").toString() //$NON-NLS-1$ //$NON-NLS-2$ + }; + + includeVar = new EnvironmentVariable("INCLUDE", String.join(File.pathSeparator, this.includeDirs), //$NON-NLS-1$ + IEnvironmentVariable.ENVVAR_REPLACE, File.pathSeparator); + + libVar = new EnvironmentVariable("LIB", String.join(File.pathSeparator, //$NON-NLS-1$ + path.getParent().getParent().getParent().resolve("lib").resolve(targetArch).toString(), //$NON-NLS-1$ + kitRoot.resolve("lib").resolve(sdkVersion).resolve("ucrt").resolve(targetArch).toString(), //$NON-NLS-1$ //$NON-NLS-2$ + kitRoot.resolve("lib").resolve(sdkVersion).resolve("um").resolve(targetArch).toString() //$NON-NLS-1$ //$NON-NLS-2$ + ), IEnvironmentVariable.ENVVAR_REPLACE, File.pathSeparator); + + symbols = new HashMap<>(); + symbols.put("_WIN32", "1"); //$NON-NLS-1$ //$NON-NLS-2$ + if (this.arch.equals(Platform.ARCH_X86)) { + symbols.put("_M_IX86", "600"); //$NON-NLS-1$ //$NON-NLS-2$ + } else { + symbols.put("_WIN64", "1"); //$NON-NLS-1$ //$NON-NLS-2$ + symbols.put("_M_X64", "100"); //$NON-NLS-1$ //$NON-NLS-2$ + } + // TODO make this more dynamic to actual version + symbols.put("_MSC_VER", "1900"); //$NON-NLS-1$ //$NON-NLS-2$ + + // Microsoft specific modifiers that can be ignored + symbols.put("__cdecl", ""); //$NON-NLS-1$ //$NON-NLS-2$ + symbols.put("__fastcall", ""); //$NON-NLS-1$ //$NON-NLS-2$ + symbols.put("__restrict", ""); //$NON-NLS-1$ //$NON-NLS-2$ + symbols.put("__sptr", ""); //$NON-NLS-1$ //$NON-NLS-2$ + symbols.put("__stdcall", ""); //$NON-NLS-1$ //$NON-NLS-2$ + symbols.put("__unaligned", ""); //$NON-NLS-1$ //$NON-NLS-2$ + symbols.put("__uptr", ""); //$NON-NLS-1$ //$NON-NLS-2$ + symbols.put("__w64", ""); //$NON-NLS-1$ //$NON-NLS-2$ + + // Redefine some things so that the CDT parser can handle them, until there is a VC specific parser + symbols.put("__forceinline", "__inline"); //$NON-NLS-1$ //$NON-NLS-2$ + symbols.put("__int8", "char"); //$NON-NLS-1$ //$NON-NLS-2$ + symbols.put("__int16", "short"); //$NON-NLS-1$ //$NON-NLS-2$ + symbols.put("__int32", "int"); //$NON-NLS-1$ //$NON-NLS-2$ + symbols.put("__int64", "long long"); //$NON-NLS-1$ //$NON-NLS-2$ + } + + @Override + public IToolChainProvider getProvider() { + return provider; + } + + @Override + public String getId() { + return id; + } + + @Override + public String getVersion() { + return version; + } + + @Override + public String getName() { + return "Visual C++"; + } + + @Override + public String getProperty(String key) { + String value = properties.get(key); + if (value != null) { + return value; + } + + // By default, we're a local GCC + switch (key) { + case ATTR_OS: + return Platform.OS_WIN32; + case ATTR_ARCH: + return arch; + } + + return null; + } + + @Override + public void setProperty(String key, String value) { + properties.put(key, value); + } + + @Override + public IEnvironmentVariable[] getVariables() { + return new IEnvironmentVariable[] { pathVar, includeVar, libVar }; + } + + @Override + public IEnvironmentVariable getVariable(String name) { + switch (name) { + case "PATH": //$NON-NLS-1$ + case "Path": //$NON-NLS-1$ + return pathVar; + default: + return null; + } + } + + @Override + public String[] getErrorParserIds() { + return new String[] { CCorePlugin.PLUGIN_ID + ".VCErrorParser" //$NON-NLS-1$ + }; + } + + @Override + public String getBinaryParserId() { + return CCorePlugin.PLUGIN_ID + ".PE"; //$NON-NLS-1$ + } + + @Override + public Path getCommandPath(Path command) { + if (command.isAbsolute()) { + return command; + } else { + return this.path.resolve(command); + } + } + + @Override + public String[] getCompileCommands() { + return new String[] { "cl", "cl.exe" //$NON-NLS-1$ //$NON-NLS-2$ + }; + } + + @Override + public IExtendedScannerInfo getDefaultScannerInfo(IBuildConfiguration buildConfig, + IExtendedScannerInfo baseScannerInfo, ILanguage language, URI buildDirectoryURI) { + return new ExtendedScannerInfo(symbols, includeDirs); + } + + @Override + public IExtendedScannerInfo getScannerInfo(IBuildConfiguration buildConfig, List command, + IExtendedScannerInfo baseScannerInfo, IResource resource, URI buildDirectoryURI) { + Map symbols = new HashMap<>(this.symbols); + List includeDirs = new ArrayList<>(Arrays.asList(this.includeDirs)); + + for (String arg : command) { + if (arg.startsWith("-") || arg.startsWith("/")) { //$NON-NLS-1$ //$NON-NLS-2$ + if (arg.charAt(1) == 'I') { + includeDirs.add(arg.substring(2)); + } else if (arg.charAt(1) == 'D') { + String[] define = arg.substring(2).split("="); //$NON-NLS-1$ + if (define.length == 1) { + symbols.put(define[0], "1"); //$NON-NLS-1$ + } else { + symbols.put(define[0], define[1]); + } + } + } + } + + return new ExtendedScannerInfo(symbols, includeDirs.toArray(new String[includeDirs.size()])); + } + + @Override + public IResource[] getResourcesFromCommand(List command, URI buildDirectoryURI) { + // Start at the back looking for arguments + // TODO this was copied from the GCCToolChain, good candidate for the default implementation + List resources = new ArrayList<>(); + IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); + for (int i = command.size() - 1; i >= 0; --i) { + String arg = command.get(i); + if (arg.startsWith("-") || arg.startsWith("/")) { //$NON-NLS-1$ //$NON-NLS-2$ + // ran into an option, we're done. + break; + } + Path srcPath = Paths.get(arg); + URI uri; + if (srcPath.isAbsolute()) { + uri = srcPath.toUri(); + } else { + try { + uri = buildDirectoryURI.resolve(arg); + } catch (IllegalArgumentException e) { + // Bad URI + continue; + } + } + + for (IFile resource : root.findFilesForLocationURI(uri)) { + resources.add(resource); + } + } + + return resources.toArray(new IResource[resources.size()]); + } +} diff --git a/windows/org.eclipse.cdt.msw.build/src/org/eclipse/cdt/msw/build/core/MSVCToolChainProvider.java b/windows/org.eclipse.cdt.msw.build/src/org/eclipse/cdt/msw/build/core/MSVCToolChainProvider.java index fa1c8aa84b5..89ffb6e5265 100644 --- a/windows/org.eclipse.cdt.msw.build/src/org/eclipse/cdt/msw/build/core/MSVCToolChainProvider.java +++ b/windows/org.eclipse.cdt.msw.build/src/org/eclipse/cdt/msw/build/core/MSVCToolChainProvider.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.msw.build.core; - -import java.io.IOException; -import java.nio.file.Files; -import java.nio.file.Path; -import java.nio.file.Paths; - -import org.eclipse.cdt.core.build.IToolChainManager; -import org.eclipse.cdt.core.build.IToolChainProvider; -import org.eclipse.cdt.msw.build.Activator; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Platform; -import org.eclipse.core.runtime.Status; - -/** - * Toolchain provider for Microsoft's Visual C++ Compiler (MSVC). - * - * This implementation only supports Microsoft Build Tools 2017 and - * the Windows 10 SDK (Kit). - */ -public class MSVCToolChainProvider implements IToolChainProvider { - - public MSVCToolChainProvider() { - // TODO Auto-generated constructor stub - } - - @Override - public String getId() { - return "org.eclipse.cdt.msw.build"; //$NON-NLS-1$ - } - - @Override - public void init(IToolChainManager manager) throws CoreException { - // See if cl is installed - Path vsPath = Paths.get("C:", "Program Files (x86)", "Microsoft Visual Studio"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - if (!Files.exists(vsPath)) { - return; - } - - Path vs2017Path = vsPath.resolve("2017"); //$NON-NLS-1$ - if (!Files.exists(vs2017Path)) { - return; - } - - Path msvcPath = vs2017Path.resolve("BuildTools").resolve("VC").resolve("Tools").resolve("MSVC"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ - if (!Files.exists(msvcPath)) { - return; - } - - String hostPath = Platform.getOSArch().equals(Platform.ARCH_X86) ? "HostX86" : "HostX64"; //$NON-NLS-1$ //$NON-NLS-2$ - String archPath = Platform.getOSArch().equals(Platform.ARCH_X86) ? "x86" : "x64"; //$NON-NLS-1$ //$NON-NLS-2$ - - try { - Files.find(msvcPath, 6, (path, attr) -> { - return path.getFileName().toString().equalsIgnoreCase("cl.exe") //$NON-NLS-1$ - && path.getParent().getParent().getFileName().toString().equalsIgnoreCase(hostPath) - && path.getParent().getFileName().toString().equalsIgnoreCase(archPath); - }).forEach((path) -> { - manager.addToolChain(new MSVCToolChain(this, path.getParent())); - }); - } catch (IOException e) { - throw new CoreException(new Status(IStatus.ERROR, Activator.PLUGIN_ID, "Finding cl.exe", e)); //$NON-NLS-1$ - } - } - -} +/******************************************************************************* + * 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.msw.build.core; + +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; + +import org.eclipse.cdt.core.build.IToolChainManager; +import org.eclipse.cdt.core.build.IToolChainProvider; +import org.eclipse.cdt.msw.build.Activator; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Platform; +import org.eclipse.core.runtime.Status; + +/** + * Toolchain provider for Microsoft's Visual C++ Compiler (MSVC). + * + * This implementation only supports Microsoft Build Tools 2017 and + * the Windows 10 SDK (Kit). + */ +public class MSVCToolChainProvider implements IToolChainProvider { + + public MSVCToolChainProvider() { + // TODO Auto-generated constructor stub + } + + @Override + public String getId() { + return "org.eclipse.cdt.msw.build"; //$NON-NLS-1$ + } + + @Override + public void init(IToolChainManager manager) throws CoreException { + // See if cl is installed + Path vsPath = Paths.get("C:", "Program Files (x86)", "Microsoft Visual Studio"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + if (!Files.exists(vsPath)) { + return; + } + + Path vs2017Path = vsPath.resolve("2017"); //$NON-NLS-1$ + if (!Files.exists(vs2017Path)) { + return; + } + + Path msvcPath = vs2017Path.resolve("BuildTools").resolve("VC").resolve("Tools").resolve("MSVC"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ + if (!Files.exists(msvcPath)) { + return; + } + + String hostPath = Platform.getOSArch().equals(Platform.ARCH_X86) ? "HostX86" : "HostX64"; //$NON-NLS-1$ //$NON-NLS-2$ + String archPath = Platform.getOSArch().equals(Platform.ARCH_X86) ? "x86" : "x64"; //$NON-NLS-1$ //$NON-NLS-2$ + + try { + Files.find(msvcPath, 6, (path, attr) -> { + return path.getFileName().toString().equalsIgnoreCase("cl.exe") //$NON-NLS-1$ + && path.getParent().getParent().getFileName().toString().equalsIgnoreCase(hostPath) + && path.getParent().getFileName().toString().equalsIgnoreCase(archPath); + }).forEach((path) -> { + manager.addToolChain(new MSVCToolChain(this, path.getParent())); + }); + } catch (IOException e) { + throw new CoreException(new Status(IStatus.ERROR, Activator.PLUGIN_ID, "Finding cl.exe", e)); //$NON-NLS-1$ + } + } + +} diff --git a/xlc/org.eclipse.cdt.core.lrparser.xlc/.classpath b/xlc/org.eclipse.cdt.core.lrparser.xlc/.classpath index 89ba40a1740..a7e2cc574de 100644 --- a/xlc/org.eclipse.cdt.core.lrparser.xlc/.classpath +++ b/xlc/org.eclipse.cdt.core.lrparser.xlc/.classpath @@ -1,8 +1,8 @@ - - - - - - - - + + + + + + + + diff --git a/xlc/org.eclipse.cdt.core.lrparser.xlc/.settings/org.eclipse.jdt.core.prefs b/xlc/org.eclipse.cdt.core.lrparser.xlc/.settings/org.eclipse.jdt.core.prefs index 53a406efccb..bc676b7d3f9 100644 --- a/xlc/org.eclipse.cdt.core.lrparser.xlc/.settings/org.eclipse.jdt.core.prefs +++ b/xlc/org.eclipse.cdt.core.lrparser.xlc/.settings/org.eclipse.jdt.core.prefs @@ -1,12 +1,12 @@ -#Wed Nov 16 18:01:26 EST 2011 -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.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.8 +#Wed Nov 16 18:01:26 EST 2011 +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.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.8 diff --git a/xlc/org.eclipse.cdt.errorparsers.xlc.tests/.classpath b/xlc/org.eclipse.cdt.errorparsers.xlc.tests/.classpath index b862a296d38..eca7bdba8f0 100644 --- a/xlc/org.eclipse.cdt.errorparsers.xlc.tests/.classpath +++ b/xlc/org.eclipse.cdt.errorparsers.xlc.tests/.classpath @@ -1,7 +1,7 @@ - - - - - - - + + + + + + + diff --git a/xlc/org.eclipse.cdt.errorparsers.xlc.tests/.settings/org.eclipse.jdt.core.prefs b/xlc/org.eclipse.cdt.errorparsers.xlc.tests/.settings/org.eclipse.jdt.core.prefs index 9a55f1ec872..5ba0eb7e3b7 100644 --- a/xlc/org.eclipse.cdt.errorparsers.xlc.tests/.settings/org.eclipse.jdt.core.prefs +++ b/xlc/org.eclipse.cdt.errorparsers.xlc.tests/.settings/org.eclipse.jdt.core.prefs @@ -1,8 +1,8 @@ -#Wed Nov 16 18:10:00 EST 2011 -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.compliance=1.8 -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.8 +#Wed Nov 16 18:10:00 EST 2011 +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.compliance=1.8 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.8 diff --git a/xlc/org.eclipse.cdt.errorparsers.xlc/.classpath b/xlc/org.eclipse.cdt.errorparsers.xlc/.classpath index b862a296d38..eca7bdba8f0 100644 --- a/xlc/org.eclipse.cdt.errorparsers.xlc/.classpath +++ b/xlc/org.eclipse.cdt.errorparsers.xlc/.classpath @@ -1,7 +1,7 @@ - - - - - - - + + + + + + + diff --git a/xlc/org.eclipse.cdt.errorparsers.xlc/.settings/org.eclipse.jdt.core.prefs b/xlc/org.eclipse.cdt.errorparsers.xlc/.settings/org.eclipse.jdt.core.prefs index 39ad40d901e..82786dbf64f 100644 --- a/xlc/org.eclipse.cdt.errorparsers.xlc/.settings/org.eclipse.jdt.core.prefs +++ b/xlc/org.eclipse.cdt.errorparsers.xlc/.settings/org.eclipse.jdt.core.prefs @@ -1,12 +1,12 @@ -#Wed Nov 16 18:09:22 EST 2011 -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.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.8 +#Wed Nov 16 18:09:22 EST 2011 +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.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.8 diff --git a/xlc/org.eclipse.cdt.make.xlc.core/.classpath b/xlc/org.eclipse.cdt.make.xlc.core/.classpath index a0c6dd9cee8..22f30643cba 100644 --- a/xlc/org.eclipse.cdt.make.xlc.core/.classpath +++ b/xlc/org.eclipse.cdt.make.xlc.core/.classpath @@ -1,7 +1,7 @@ - - - - - - - + + + + + + + diff --git a/xlc/org.eclipse.cdt.make.xlc.core/.settings/org.eclipse.jdt.core.prefs b/xlc/org.eclipse.cdt.make.xlc.core/.settings/org.eclipse.jdt.core.prefs index 8b818564cde..3c3c769fe32 100644 --- a/xlc/org.eclipse.cdt.make.xlc.core/.settings/org.eclipse.jdt.core.prefs +++ b/xlc/org.eclipse.cdt.make.xlc.core/.settings/org.eclipse.jdt.core.prefs @@ -1,74 +1,74 @@ -#Wed Nov 16 18:10:51 EST 2011 -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.compliance=1.8 -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.deprecation=warning -org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled -org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled -org.eclipse.jdt.core.compiler.problem.discouragedReference=warning -org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore -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=ignore -org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore -org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore -org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning -org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore -org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore -org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning -org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning -org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning -org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=error -org.eclipse.jdt.core.compiler.problem.nullReference=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.rawTypeReference=warning -org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore -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=ignore -org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=ignore -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=warning -org.eclipse.jdt.core.compiler.problem.unusedLabel=warning -org.eclipse.jdt.core.compiler.problem.unusedLocal=warning -org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore -org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled -org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled -org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled -org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=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.comment.clear_blank_lines=false -org.eclipse.jdt.core.formatter.comment.format_comments=true -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=insert -org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert +#Wed Nov 16 18:10:51 EST 2011 +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.compliance=1.8 +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.deprecation=warning +org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled +org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled +org.eclipse.jdt.core.compiler.problem.discouragedReference=warning +org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore +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=ignore +org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore +org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore +org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning +org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore +org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore +org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning +org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning +org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning +org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=error +org.eclipse.jdt.core.compiler.problem.nullReference=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.rawTypeReference=warning +org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore +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=ignore +org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=ignore +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=warning +org.eclipse.jdt.core.compiler.problem.unusedLabel=warning +org.eclipse.jdt.core.compiler.problem.unusedLocal=warning +org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore +org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled +org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled +org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled +org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=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.comment.clear_blank_lines=false +org.eclipse.jdt.core.formatter.comment.format_comments=true +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=insert +org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert diff --git a/xlc/org.eclipse.cdt.managedbuilder.xlc.core/.classpath b/xlc/org.eclipse.cdt.managedbuilder.xlc.core/.classpath index b862a296d38..eca7bdba8f0 100644 --- a/xlc/org.eclipse.cdt.managedbuilder.xlc.core/.classpath +++ b/xlc/org.eclipse.cdt.managedbuilder.xlc.core/.classpath @@ -1,7 +1,7 @@ - - - - - - - + + + + + + + diff --git a/xlc/org.eclipse.cdt.managedbuilder.xlc.core/.settings/org.eclipse.jdt.core.prefs b/xlc/org.eclipse.cdt.managedbuilder.xlc.core/.settings/org.eclipse.jdt.core.prefs index 8faa3d43294..c78b10ec1bc 100644 --- a/xlc/org.eclipse.cdt.managedbuilder.xlc.core/.settings/org.eclipse.jdt.core.prefs +++ b/xlc/org.eclipse.cdt.managedbuilder.xlc.core/.settings/org.eclipse.jdt.core.prefs @@ -1,251 +1,251 @@ -#Wed Nov 16 18:12:11 EST 2011 -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.compliance=1.8 -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -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_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_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=1 -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=1 -org.eclipse.jdt.core.formatter.blank_lines_before_package=0 -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.format_header=false -org.eclipse.jdt.core.formatter.comment.format_html=true -org.eclipse.jdt.core.formatter.comment.format_source_code=true -org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true -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=insert -org.eclipse.jdt.core.formatter.comment.line_length=80 -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.format_guardian_clause_on_one_line=false -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=false -org.eclipse.jdt.core.formatter.indentation.size=4 -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_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.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=80 -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=1 -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_tabs_only_for_leading_indentations=false +#Wed Nov 16 18:12:11 EST 2011 +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.compliance=1.8 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +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_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_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=1 +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=1 +org.eclipse.jdt.core.formatter.blank_lines_before_package=0 +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.format_header=false +org.eclipse.jdt.core.formatter.comment.format_html=true +org.eclipse.jdt.core.formatter.comment.format_source_code=true +org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true +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=insert +org.eclipse.jdt.core.formatter.comment.line_length=80 +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.format_guardian_clause_on_one_line=false +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=false +org.eclipse.jdt.core.formatter.indentation.size=4 +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_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.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=80 +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=1 +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_tabs_only_for_leading_indentations=false diff --git a/xlc/org.eclipse.cdt.managedbuilder.xlc.ui/.classpath b/xlc/org.eclipse.cdt.managedbuilder.xlc.ui/.classpath index b862a296d38..eca7bdba8f0 100644 --- a/xlc/org.eclipse.cdt.managedbuilder.xlc.ui/.classpath +++ b/xlc/org.eclipse.cdt.managedbuilder.xlc.ui/.classpath @@ -1,7 +1,7 @@ - - - - - - - + + + + + + + diff --git a/xlc/org.eclipse.cdt.managedbuilder.xlc.ui/.settings/org.eclipse.jdt.core.prefs b/xlc/org.eclipse.cdt.managedbuilder.xlc.ui/.settings/org.eclipse.jdt.core.prefs index 452bc0e5de0..944617c5ca9 100644 --- a/xlc/org.eclipse.cdt.managedbuilder.xlc.ui/.settings/org.eclipse.jdt.core.prefs +++ b/xlc/org.eclipse.cdt.managedbuilder.xlc.ui/.settings/org.eclipse.jdt.core.prefs @@ -1,12 +1,12 @@ -#Wed Nov 16 18:12:43 EST 2011 -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.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.8 +#Wed Nov 16 18:12:43 EST 2011 +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.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.8 diff --git a/xlc/org.eclipse.cdt.managedbuilder.xlupc.ui/.classpath b/xlc/org.eclipse.cdt.managedbuilder.xlupc.ui/.classpath index e334ecd9727..4f83b2397ec 100644 --- a/xlc/org.eclipse.cdt.managedbuilder.xlupc.ui/.classpath +++ b/xlc/org.eclipse.cdt.managedbuilder.xlupc.ui/.classpath @@ -1,7 +1,7 @@ - - - - - - - + + + + + + + diff --git a/xlc/org.eclipse.cdt.managedbuilder.xlupc.ui/.settings/org.eclipse.jdt.core.prefs b/xlc/org.eclipse.cdt.managedbuilder.xlupc.ui/.settings/org.eclipse.jdt.core.prefs index 372b9c34c0c..d02ea4a603b 100644 --- a/xlc/org.eclipse.cdt.managedbuilder.xlupc.ui/.settings/org.eclipse.jdt.core.prefs +++ b/xlc/org.eclipse.cdt.managedbuilder.xlupc.ui/.settings/org.eclipse.jdt.core.prefs @@ -1,70 +1,70 @@ -#Wed Nov 16 18:13:11 EST 2011 -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.compliance=1.8 -org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.autoboxing=ignore -org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning -org.eclipse.jdt.core.compiler.problem.deadCode=warning -org.eclipse.jdt.core.compiler.problem.deprecation=warning -org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled -org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled -org.eclipse.jdt.core.compiler.problem.discouragedReference=warning -org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore -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=ignore -org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore -org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore -org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning -org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore -org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=ignore -org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore -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=warning -org.eclipse.jdt.core.compiler.problem.nullReference=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.rawTypeReference=warning -org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore -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=ignore -org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=ignore -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=warning -org.eclipse.jdt.core.compiler.problem.unusedLabel=warning -org.eclipse.jdt.core.compiler.problem.unusedLocal=warning -org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore -org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled -org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled -org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled -org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=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 +#Wed Nov 16 18:13:11 EST 2011 +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.compliance=1.8 +org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.autoboxing=ignore +org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning +org.eclipse.jdt.core.compiler.problem.deadCode=warning +org.eclipse.jdt.core.compiler.problem.deprecation=warning +org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled +org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled +org.eclipse.jdt.core.compiler.problem.discouragedReference=warning +org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore +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=ignore +org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore +org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore +org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning +org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore +org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=ignore +org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore +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=warning +org.eclipse.jdt.core.compiler.problem.nullReference=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.rawTypeReference=warning +org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore +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=ignore +org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=ignore +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=warning +org.eclipse.jdt.core.compiler.problem.unusedLabel=warning +org.eclipse.jdt.core.compiler.problem.unusedLocal=warning +org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore +org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled +org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled +org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled +org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=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