diff --git a/ReadMe.textile b/ReadMe.textile index d386ee1..4e4e12b 100644 --- a/ReadMe.textile +++ b/ReadMe.textile @@ -1,10 +1,15 @@ h1. Main Projects -* org.intrace - InTrace Agent and CUI/GUI -* org.intrace.agentloader - Command line agent loader for loading an agent into a running JVM process - -h2. Scratch Projects - +* org.intrace - InTrace Agent and GUI +* intrace.ecl.plugin - InTrace Eclipse Plugin +* intrace.ecl.feature - InTrace Eclipse Feature +* intrace.ecl.site - InTrace Eclipse Update Site +* intrace.appengine - InTrace AppEngine Update Site Hosting * binaries - images and jars used by wiki pages + +h2. Work in progress + +* InTrace-VisualVM - VisualVM integration * org.intrace.agentbug - Project containing simple Agent used to illustrate bug report to Sun +* org.intrace.agentloader - Command line agent loader for loading an agent into a running JVM process * org.intrace.test - Dumping ground for toy classes used in manual testing diff --git a/com.mountainminds.eclemma.core/.classpath b/com.mountainminds.eclemma.core/.classpath deleted file mode 100644 index 250d197..0000000 --- a/com.mountainminds.eclemma.core/.classpath +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - diff --git a/com.mountainminds.eclemma.core/.options b/com.mountainminds.eclemma.core/.options deleted file mode 100644 index 4eda5d0..0000000 --- a/com.mountainminds.eclemma.core/.options +++ /dev/null @@ -1,14 +0,0 @@ -# Verbosity level for Emma -com.mountainminds.eclemma.core/debug/emmaVerbosityLevel=info - -# Enable trace output for performance (time/memory) -com.mountainminds.eclemma.core/debug/performance=true - -# Enable trace output for instrumentation -com.mountainminds.eclemma.core/debug/instrumentation=true - -# Enable trace output for coverage launching -com.mountainminds.eclemma.core/debug/launching=true - -# Enable trace output for coverage analysis -com.mountainminds.eclemma.core/debug/analysis=true \ No newline at end of file diff --git a/com.mountainminds.eclemma.core/.project b/com.mountainminds.eclemma.core/.project deleted file mode 100644 index 8ca8a04..0000000 --- a/com.mountainminds.eclemma.core/.project +++ /dev/null @@ -1,28 +0,0 @@ - - - com.mountainminds.eclemma.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/com.mountainminds.eclemma.core/.settings/org.eclipse.jdt.core.prefs b/com.mountainminds.eclemma.core/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index fcc517d..0000000 --- a/com.mountainminds.eclemma.core/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,326 +0,0 @@ -#Thu Jan 29 21:39:30 CET 2009 -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.2 -org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=1.4 -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=warning -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=warning -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=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.3 -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=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=1 -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=true -org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true -org.eclipse.jdt.core.formatter.comment.format_line_comments=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_annotation_on_local_variable=insert -org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_member=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_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.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.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=1 -org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true -org.eclipse.jdt.core.formatter.tabulation.char=space -org.eclipse.jdt.core.formatter.tabulation.size=2 -org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false -org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true diff --git a/com.mountainminds.eclemma.core/.settings/org.eclipse.jdt.ui.prefs b/com.mountainminds.eclemma.core/.settings/org.eclipse.jdt.ui.prefs deleted file mode 100644 index ec350bc..0000000 --- a/com.mountainminds.eclemma.core/.settings/org.eclipse.jdt.ui.prefs +++ /dev/null @@ -1,56 +0,0 @@ -#Sat Jan 24 15:41:03 CET 2009 -eclipse.preferences.version=1 -editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true -formatter_profile=_EclEmma -formatter_settings_version=11 -sp_cleanup.add_default_serial_version_id=true -sp_cleanup.add_generated_serial_version_id=false -sp_cleanup.add_missing_annotations=true -sp_cleanup.add_missing_deprecated_annotations=true -sp_cleanup.add_missing_methods=false -sp_cleanup.add_missing_nls_tags=false -sp_cleanup.add_missing_override_annotations=true -sp_cleanup.add_serial_version_id=false -sp_cleanup.always_use_blocks=true -sp_cleanup.always_use_parentheses_in_expressions=false -sp_cleanup.always_use_this_for_non_static_field_access=false -sp_cleanup.always_use_this_for_non_static_method_access=false -sp_cleanup.convert_to_enhanced_for_loop=false -sp_cleanup.correct_indentation=false -sp_cleanup.format_source_code=true -sp_cleanup.format_source_code_changes_only=false -sp_cleanup.make_local_variable_final=false -sp_cleanup.make_parameters_final=false -sp_cleanup.make_private_fields_final=true -sp_cleanup.make_type_abstract_if_missing_method=false -sp_cleanup.make_variable_declarations_final=true -sp_cleanup.never_use_blocks=false -sp_cleanup.never_use_parentheses_in_expressions=true -sp_cleanup.on_save_use_additional_actions=false -sp_cleanup.organize_imports=true -sp_cleanup.qualify_static_field_accesses_with_declaring_class=false -sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true -sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true -sp_cleanup.qualify_static_member_accesses_with_declaring_class=false -sp_cleanup.qualify_static_method_accesses_with_declaring_class=false -sp_cleanup.remove_private_constructors=true -sp_cleanup.remove_trailing_whitespaces=false -sp_cleanup.remove_trailing_whitespaces_all=true -sp_cleanup.remove_trailing_whitespaces_ignore_empty=false -sp_cleanup.remove_unnecessary_casts=true -sp_cleanup.remove_unnecessary_nls_tags=false -sp_cleanup.remove_unused_imports=false -sp_cleanup.remove_unused_local_variables=false -sp_cleanup.remove_unused_private_fields=true -sp_cleanup.remove_unused_private_members=false -sp_cleanup.remove_unused_private_methods=true -sp_cleanup.remove_unused_private_types=true -sp_cleanup.sort_members=false -sp_cleanup.sort_members_all=false -sp_cleanup.use_blocks=false -sp_cleanup.use_blocks_only_for_return_and_throw=false -sp_cleanup.use_parentheses_in_expressions=false -sp_cleanup.use_this_for_non_static_field_access=false -sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true -sp_cleanup.use_this_for_non_static_method_access=false -sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true diff --git a/com.mountainminds.eclemma.core/META-INF/MANIFEST.MF b/com.mountainminds.eclemma.core/META-INF/MANIFEST.MF deleted file mode 100644 index 7eb6c11..0000000 --- a/com.mountainminds.eclemma.core/META-INF/MANIFEST.MF +++ /dev/null @@ -1,21 +0,0 @@ -Manifest-Version: 1.0 -Bundle-ManifestVersion: 2 -Bundle-Name: %pluginName -Bundle-SymbolicName: com.mountainminds.eclemma.core; singleton:=true -Bundle-Version: 1.5.2 -Bundle-Vendor: %providerName -Bundle-Localization: plugin -Export-Package: com.mountainminds.eclemma.core, - com.mountainminds.eclemma.core.analysis, - com.mountainminds.eclemma.core.launching -Require-Bundle: org.eclipse.core.runtime, - org.eclipse.core.resources, - org.eclipse.debug.core, - org.eclipse.jdt.core, - org.eclipse.jdt.launching -Bundle-ClassPath: ., - emma.jar -Bundle-Activator: com.mountainminds.eclemma.internal.core.EclEmmaCorePlugin -Eclipse-AutoStart: true - - diff --git a/com.mountainminds.eclemma.core/about.html b/com.mountainminds.eclemma.core/about.html deleted file mode 100644 index 386a740..0000000 --- a/com.mountainminds.eclemma.core/about.html +++ /dev/null @@ -1,35 +0,0 @@ - - - -About - - - -

About This Content

- -

- EclEmma is a free Java code coverage tool for Eclipse implemented by Marc R. - Hoffmann. It is based on EMMA - by Vlad Roubtsov. Check http://www.eclemma.org/ - for updates, documentation and support. -

- -

License

- -

- The Content in this plug-in is Contributed by Mountainminds GmbH & Co. KG, - Munich. Except 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. -

- -

- The plug-in includes EMMA by Vlad - Roubtsov which is distributed under the terms of the Common Public License - Version 1.0 ("CPL"). A copy of the CPL is available at - http://www.eclipse.org/legal/cpl-v10.html. -

- - - \ No newline at end of file diff --git a/com.mountainminds.eclemma.core/build.properties b/com.mountainminds.eclemma.core/build.properties deleted file mode 100644 index 31894e6..0000000 --- a/com.mountainminds.eclemma.core/build.properties +++ /dev/null @@ -1,13 +0,0 @@ -source.. = src/ -output.. = bin/ -bin.includes = META-INF/,\ - .,\ - plugin.xml,\ - .options,\ - plugin.properties,\ - emma.jar,\ - about.html -src.includes = src/,\ - build.properties -javacSource = 1.3 -javacTarget = 1.2 diff --git a/com.mountainminds.eclemma.core/emma.jar b/com.mountainminds.eclemma.core/emma.jar deleted file mode 100644 index c70f677..0000000 Binary files a/com.mountainminds.eclemma.core/emma.jar and /dev/null differ diff --git a/com.mountainminds.eclemma.core/plugin.properties b/com.mountainminds.eclemma.core/plugin.properties deleted file mode 100644 index 94adc5b..0000000 --- a/com.mountainminds.eclemma.core/plugin.properties +++ /dev/null @@ -1,21 +0,0 @@ -#******************************************************************************* -# Copyright (c) 2006 Mountainminds GmbH & Co. KG -# This software is provided under the terms of the Eclipse Public License v1.0 -# See http://www.eclipse.org/legal/epl-v10.html. -# -# $Id$ -#******************************************************************************* - -providerName = Mountainminds GmbH & Co. KG -pluginName = EclEmma Core - -coverage = Coverage - -javaDelegateName=EclEmma Java -junitDelegateName=EclEmma JUnit Test -eclipseApplicationDelegateName=EclEmma Eclipse Application -junitPluginDelegateName=EclEmma JUnit Plugin Test -osgiDelegateName=EclEmma OSGi Framework -testNgDelegateName=EclEmma TestNG -junitRAPDelegateName=EclEmma RAP JUnit Test -swtBotJunitDelegateName=EclEmma SWTBot Test \ No newline at end of file diff --git a/com.mountainminds.eclemma.core/plugin.xml b/com.mountainminds.eclemma.core/plugin.xml deleted file mode 100644 index 9493fcb..0000000 --- a/com.mountainminds.eclemma.core/plugin.xml +++ /dev/null @@ -1,83 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/com.mountainminds.eclemma.core/src/com/mountainminds/eclemma/core/CoverageTools.java b/com.mountainminds.eclemma.core/src/com/mountainminds/eclemma/core/CoverageTools.java deleted file mode 100644 index e5f7c86..0000000 --- a/com.mountainminds.eclemma.core/src/com/mountainminds/eclemma/core/CoverageTools.java +++ /dev/null @@ -1,251 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2009 Mountainminds GmbH & Co. KG - * This software is provided under the terms of the Eclipse Public License v1.0 - * See http://www.eclipse.org/legal/epl-v10.html. - * - * $Id$ - ******************************************************************************/ -package com.mountainminds.eclemma.core; - -import java.io.IOException; -import java.net.URL; -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.Path; -import org.eclipse.core.runtime.Platform; -import org.eclipse.debug.core.ILaunch; -import org.eclipse.debug.core.ILaunchConfiguration; - -import com.mountainminds.eclemma.core.analysis.IJavaCoverageListener; -import com.mountainminds.eclemma.core.analysis.IJavaElementCoverage; -import com.mountainminds.eclemma.core.analysis.IJavaModelCoverage; -import com.mountainminds.eclemma.core.analysis.ILineCoverage; -import com.mountainminds.eclemma.core.launching.ICoverageLaunchConfigurationConstants; -import com.mountainminds.eclemma.core.launching.ICoverageLaunchInfo; -import com.mountainminds.eclemma.core.launching.ICoverageLauncher; -import com.mountainminds.eclemma.internal.core.CoverageSession; -import com.mountainminds.eclemma.internal.core.EclEmmaCorePlugin; -import com.mountainminds.eclemma.internal.core.SessionExporter; -import com.mountainminds.eclemma.internal.core.SessionImporter; -import com.mountainminds.eclemma.internal.core.instr.DefaultInstrumentationFilter; -import com.mountainminds.eclemma.internal.core.launching.CoverageLaunchInfo; - -/** - * For central access to the tools provided by the coverage core plugin this - * class offers several static methods. - * - * @author Marc R. Hoffmann - * @version $Revision$ - */ -public final class CoverageTools { - - /** - * The launch mode used for coverage sessions. - */ - public static final String LAUNCH_MODE = "coverage"; //$NON-NLS-1$ - - public static final int EXPORT_HTML = 0; - public static final int EXPORT_XML = 1; - public static final int EXPORT_TEXT = 2; - public static final int EXPORT_ES = 3; - - /** - * Returns the global session manager. - * - * @return global session manager - */ - public static ISessionManager getSessionManager() { - return EclEmmaCorePlugin.getInstance().getSessionManager(); - } - - /** - * Convenience method that tries to adapt the given object to - * IJavaElementCoverage, i.e. find coverage information from the active - * session. - * - * @param object - * Object to adapt - * @return adapter or null - */ - public static IJavaElementCoverage getCoverageInfo(Object object) { - if (object instanceof IAdaptable) { - return (IJavaElementCoverage) ((IAdaptable) object) - .getAdapter(IJavaElementCoverage.class); - } else { - return null; - } - } - - /** - * Convenience method that tries to adapt the given object to ILineCoverage, - * i.e. find line coverage information from the active session. - * - * @param object - * Object to adapt - * @return adapter or null - */ - public static ILineCoverage getLineCoverage(Object object) { - if (object instanceof IAdaptable) { - return (ILineCoverage) ((IAdaptable) object) - .getAdapter(ILineCoverage.class); - } else { - return null; - } - } - - /** - * Returns the coverage launch info that is assoziated with the given launch. - * If no info object is assoziated with the given launch null is - * returned, i.e. the launch was probably not in coverage mode. - * - * @param launch - * the launch object we need coverage data for - * @return the info object or null - */ - public static ICoverageLaunchInfo getLaunchInfo(ILaunch launch) { - return CoverageLaunchInfo.getInfo(launch); - } - - /** - * Returns a local path to the emma.jar runtime archive. - * - * @return local path to emma.jar - * @throws CoreException - * if no local version can be created - */ - public static IPath getEmmaJar() throws CoreException { - URL url = EclEmmaCorePlugin.getInstance().find(EclEmmaCorePlugin.EMMA_JAR); - try { - url = Platform.asLocalURL(url); - } catch (IOException e) { - throw new CoreException(EclEmmaStatus.NO_LOCAL_EMMAJAR_ERROR.getStatus(e)); - } - return new Path(url.getPath()); - } - - /** - * Returns descriptors for all class files in the workspace. - * - * @return descriptors for all class files in the workspace - * @throws CoreException - */ - public static IClassFiles[] getClassFiles() throws CoreException { - return EclEmmaCorePlugin.getInstance().getAllClassFiles().getClassFiles(); - } - - /** - * Returns descriptors the location at the given absolute location on the - * local system. - * - * @return {@link IClassFiles} at the given location or null if - * not found - * @throws CoreException - */ - public static IClassFiles getClassFilesAtAbsoluteLocation(String location) - throws CoreException { - return EclEmmaCorePlugin.getInstance().getAllClassFiles() - .getAtAbsoluteLocation(location); - } - - /** - * Returns descriptors for class files for the given launch configuration. - * - * @param configuration - * launch configuration to look for class files - * @param includebinaries - * flag whether binary classpath entries should be included - * - * @return descriptors for all class files - * - * @throws CoreException - */ - public static IClassFiles[] getClassFiles(ILaunchConfiguration configuration, - boolean includebinaries) throws CoreException { - ICoverageLauncher launcher = (ICoverageLauncher) configuration.getType() - .getDelegate(LAUNCH_MODE); - return launcher.getClassFiles(configuration, includebinaries); - } - - /** - * Returns descriptors for class files for instrumentation as configured by - * the given launch configuration. - * - * @param configuration - * launch configuration to look for class files - * @param inplace - * flag whether instrumentation will happen inplace. In this case - * binary libraries will be excluded - * - * @return descriptors for all class for instrumentation - * - * @throws CoreException - */ - public static IClassFiles[] getClassFilesForInstrumentation( - final ILaunchConfiguration configuration, final boolean inplace) - throws CoreException { - final IClassFiles[] all = getClassFiles(configuration, !inplace); - final List selection = configuration.getAttribute( - ICoverageLaunchConfigurationConstants.ATTR_INSTRUMENTATION_PATHS, - (List) null); - if (selection != null && selection.size() > 0) { - // Classes for instrumentation are already configured: - final List filtered = new ArrayList(); - for (int i = 0; i < all.length; i++) { - if (selection.contains(all[i].getLocation().toString())) { - filtered.add(all[i]); - } - } - return (IClassFiles[]) filtered.toArray(new IClassFiles[filtered.size()]); - } - // Otherwise we use a default selection: - final DefaultInstrumentationFilter filter = EclEmmaCorePlugin.getInstance() - .createDefaultIntrumentationFilter(); - return filter.filter(all, configuration); - } - - public static ICoverageSession createCoverageSession(String description, - IInstrumentation[] instrumentations, IPath[] coveragedatafiles, - ILaunchConfiguration launchconfiguration) { - return new CoverageSession(description, instrumentations, - coveragedatafiles, launchconfiguration); - } - - public static IJavaModelCoverage getJavaModelCoverage() { - return EclEmmaCorePlugin.getInstance().getJavaCoverageLoader() - .getJavaModelCoverage(); - } - - public static void addJavaCoverageListener(IJavaCoverageListener l) { - EclEmmaCorePlugin.getInstance().getJavaCoverageLoader() - .addJavaCoverageListener(l); - } - - public static void removeJavaCoverageListener(IJavaCoverageListener l) { - EclEmmaCorePlugin.getInstance().getJavaCoverageLoader() - .removeJavaCoverageListener(l); - } - - public static ISessionExporter getExporter(ICoverageSession session) { - return new SessionExporter(session); - } - - public static ISessionImporter getImporter() { - return new SessionImporter(); - } - - /** - * Sets a {@link ICorePreferences} instance which will be used by the EclEmma - * core to query preference settings if required. - * - * @param preferences - * callback object for preference settings - */ - public static void setPreferences(ICorePreferences preferences) { - EclEmmaCorePlugin.getInstance().setPreferences(preferences); - } - -} diff --git a/com.mountainminds.eclemma.core/src/com/mountainminds/eclemma/core/EclEmmaStatus.java b/com.mountainminds.eclemma.core/src/com/mountainminds/eclemma/core/EclEmmaStatus.java deleted file mode 100644 index 8ff5d49..0000000 --- a/com.mountainminds.eclemma.core/src/com/mountainminds/eclemma/core/EclEmmaStatus.java +++ /dev/null @@ -1,158 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Mountainminds GmbH & Co. KG - * This software is provided under the terms of the Eclipse Public License v1.0 - * See http://www.eclipse.org/legal/epl-v10.html. - * - * $Id$ - ******************************************************************************/ -package com.mountainminds.eclemma.core; - -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.osgi.util.NLS; - -import com.mountainminds.eclemma.internal.core.CoreMessages; -import com.mountainminds.eclemma.internal.core.EclEmmaCorePlugin; - -/** - * Status objects used by the core plugin. - * - * @author Marc R. Hoffmann - * @version $Revision$ - */ -public final class EclEmmaStatus { - - public final int code; - - public final int severity; - - public final String message; - - private EclEmmaStatus(int code, int severity, String message) { - this.code = code; - this.severity = severity; - this.message = message; - } - - public IStatus getStatus() { - String m = NLS.bind(message, new Integer(code)); - return new Status(severity, EclEmmaCorePlugin.ID, code, m, null); - } - - public IStatus getStatus(Throwable t) { - String m = NLS.bind(message, new Integer(code)); - return new Status(severity, EclEmmaCorePlugin.ID, code, m, t); - } - - public IStatus getStatus(Object param1, Throwable t) { - String m = NLS.bind(message, new Integer(code), param1); - return new Status(severity, EclEmmaCorePlugin.ID, code, m, t); - } - - public IStatus getStatus(Object param1) { - String m = NLS.bind(message, new Integer(code), param1); - return new Status(severity, EclEmmaCorePlugin.ID, code, m, null); - } - - /** - * Info before inplace instrumentation happens. - */ - public static final EclEmmaStatus INPLACE_INSTRUMENTATION_INFO = new EclEmmaStatus( - 2000, IStatus.INFO, - CoreMessages.StatusINPLACE_INSTRUMENTATION_INFO_message); - - /** - * Status indicating that it was not possible to obtain a local version of the - * emma.jar file. - */ - public static final EclEmmaStatus NO_LOCAL_EMMAJAR_ERROR = new EclEmmaStatus( - 5000, IStatus.ERROR, CoreMessages.StatusNO_LOCAL_EMMAJAR_ERROR_message); - - /** - * Status indication that it was not possible to generate a internal id for a - * resource. - */ - public static final EclEmmaStatus ID_CREATION_ERROR = new EclEmmaStatus( - 5001, IStatus.ERROR, CoreMessages.StatusID_CREATION_ERROR_message); - - /** - * The requested launch type is not known. - */ - public static final EclEmmaStatus UNKOWN_LAUNCH_TYPE_ERROR = new EclEmmaStatus( - 5002, IStatus.ERROR, CoreMessages.StatusUNKOWN_LAUNCH_TYPE_ERROR_message); - - /** - * The coverage runtime classpath provider has been called in an invalid - * execution context, i.e. outside of CoverageLauncher.launch(). - */ - public static final EclEmmaStatus INVALID_CLASSPATH_PROVIDER_CONTEXT_ERROR = new EclEmmaStatus( - 5003, IStatus.ERROR, - CoreMessages.StatusINVALID_CLASSPATH_PROVIDER_CONTEXT_ERROR_message); - - /** - * The coverage launch info object is missing unexpectedly. - */ - public static final EclEmmaStatus MISSING_LAUNCH_INFO_ERROR = new EclEmmaStatus( - 5004, IStatus.ERROR, CoreMessages.StatusMISSING_LAUNCH_INFO_ERROR_message); - - /** - * Error while creating the JAR containing emma runtime properties. - */ - public static final EclEmmaStatus EMMA_PROPERTIES_CREATION_ERROR = new EclEmmaStatus( - 5005, IStatus.ERROR, - CoreMessages.StatusEMMA_PROPERTIES_CREATION_ERROR_message); - - /** - * Error while reading coverage data file. - */ - public static final EclEmmaStatus COVERAGEDATA_FILE_READ_ERROR = new EclEmmaStatus( - 5006, IStatus.ERROR, - CoreMessages.StatusCOVERAGEDATA_FILE_READ_ERROR_message); - - /** - * Error while reading meta data file. - */ - public static final EclEmmaStatus METADATA_FILE_READ_ERROR = new EclEmmaStatus( - 5007, IStatus.ERROR, CoreMessages.StatusMETADATA_FILE_READ_ERROR_message); - - /** - * Error while extracting source files. - */ - public static final EclEmmaStatus SOURCE_EXTRACTION_ERROR = new EclEmmaStatus( - 5008, IStatus.ERROR, CoreMessages.StatusSOURCE_EXTRACTION_ERROR_message); - - /** - * Error while importing external coverage session. - */ - public static final EclEmmaStatus IMPORT_ERROR = new EclEmmaStatus( - 5009, IStatus.ERROR, CoreMessages.StatusIMPORT_ERROR_message); - - /** - * Error while importing external coverage session. - */ - public static final EclEmmaStatus FILE_CONTAINS_NO_METADATA = new EclEmmaStatus( - 5010, IStatus.ERROR, CoreMessages.StatusFILE_CONTAINS_NO_METADATA_message); - - /** - * Trying to instrument instrumented class files. This status is used to issue - * an error prompt during launching. - */ - public static final EclEmmaStatus ALREADY_INSTRUMENTED_ERROR = new EclEmmaStatus( - 5100, IStatus.ERROR, CoreMessages.StatusALREADY_INSTRUMENTED_ERROR_message); - - /** - * No coverage data file has been created during a coverage launch. This - * status is used to issue an error prompt. - */ - public static final EclEmmaStatus NO_COVERAGE_DATA_ERROR = new EclEmmaStatus( - 5101, IStatus.ERROR, CoreMessages.StatusNO_COVERAGE_DATA_ERROR_message); - - /** - * No classes are selected for instrumentation. This status is used to issue - * an error prompt during launching. - */ - public static final EclEmmaStatus NO_INSTRUMENTED_CLASSES = new EclEmmaStatus( - 5102, IStatus.ERROR, CoreMessages.StatusNO_INSTRUMENTED_CLASSES_message); - - -} diff --git a/com.mountainminds.eclemma.core/src/com/mountainminds/eclemma/core/IClassFiles.java b/com.mountainminds.eclemma.core/src/com/mountainminds/eclemma/core/IClassFiles.java deleted file mode 100644 index 7ec282d..0000000 --- a/com.mountainminds.eclemma.core/src/com/mountainminds/eclemma/core/IClassFiles.java +++ /dev/null @@ -1,79 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2009 Mountainminds GmbH & Co. KG - * This software is provided under the terms of the Eclipse Public License v1.0 - * See http://www.eclipse.org/legal/epl-v10.html. - * - * $Id$ - ******************************************************************************/ -package com.mountainminds.eclemma.core; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.jdt.core.IPackageFragmentRoot; -import org.eclipse.jdt.core.JavaModelException; - -/** - * Instances of {@link IClassFiles} describe a folder or archive containing - * class files. Class files can be binary libraries or the compilation output of - * source folders. These class file may be instrumented for coverage analysis. - * - * @author Marc R. Hoffmann - * @version $Revision$ - */ -public interface IClassFiles { - - /** - * This method returns true if the class files described by this - * instance are not compiled from a source folder. - * - * @return true if the class files are a binary resource only - */ - public boolean isBinary(); - - /** - * Returns the list of package fragment roots that belong to the class files. - * The list may have more than one entry, if several source folders share the - * same output location or if multiple library classpath entries point to the - * same location. - * - * @return list of package fragment roots - */ - public IPackageFragmentRoot[] getPackageFragmentRoots(); - - /** - * Returns the workspace relative path to of the class files, either a - * directory or a JAR file. - * - * @return location of the class files - */ - public IPath getLocation(); - - /** - * Determines the source locations that belong to the class files. If no - * source is known for this class files a empty list is returned. - * - * @return List of {@link ISourceLocation} objects - * @throws JavaModelException - * May be thrown while querying the Java model - */ - public ISourceLocation[] getSourceLocations() throws JavaModelException; - - /** - * Instruments the class files contained in the folder or archive returned by - * {@link #getLocation()}. If in-place mode is enabled, the original class - * files or archives will be replaced. - * - * @param inplace - * if true the original class files will be overwritten - * @param monitor - * optional progress monitor - * @return {@link IInstrumentation} object describing the instrumentation - * result - * @throws CoreException - * thrown if the instrumentation process fails - */ - public IInstrumentation instrument(boolean inplace, IProgressMonitor monitor) - throws CoreException; - -} diff --git a/com.mountainminds.eclemma.core/src/com/mountainminds/eclemma/core/ICorePreferences.java b/com.mountainminds.eclemma.core/src/com/mountainminds/eclemma/core/ICorePreferences.java deleted file mode 100644 index 00b2b83..0000000 --- a/com.mountainminds.eclemma.core/src/com/mountainminds/eclemma/core/ICorePreferences.java +++ /dev/null @@ -1,88 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2009 Mountainminds GmbH & Co. KG - * This software is provided under the terms of the Eclipse Public License v1.0 - * See http://www.eclipse.org/legal/epl-v10.html. - * - * $Id: $ - ******************************************************************************/ -package com.mountainminds.eclemma.core; - -/** - * Clients may implement this interface to customize the behavior of the EclEmma - * core plug-in and pass a instance to - * {@link CoverageTools#setPreferences(ICorePreferences)}. This interface - * decouples the core e.g. from the UI preferences. - * - * @author Marc R. Hoffmann - * @version $Revision: $ - */ -public interface ICorePreferences { - - /** - * Default behavior if no customization is set. - */ - public static final ICorePreferences DEFAULT = new ICorePreferences() { - public boolean getActivateNewSessions() { - return true; - } - - public boolean getAutoRemoveSessions() { - return false; - } - - public boolean getDefaultInstrumentationSourceFoldersOnly() { - return true; - } - - public boolean getDefaultInstrumentationSameProjectOnly() { - return false; - } - - public String getDefaultInstrumentationFilter() { - return "";//$NON-NLS-1$ - } - }; - - /** - * Determines whether new sessions should automatically be activated. - * - * @return true, if sessions should be activated - */ - public boolean getActivateNewSessions(); - - /** - * Determines whether sessions should automatically be removed when their - * respective launch is removed from the debug environment. - * - * @return true, if sessions should be removed - */ - public boolean getAutoRemoveSessions(); - - /** - * Specification of the default instrumentation behavior: Instrument source - * folders only. - * - * @return true, if source folders only should be instrumented by - * default - */ - public boolean getDefaultInstrumentationSourceFoldersOnly(); - - /** - * Specification of the default instrumentation behavior: Instrument code in - * the same project only. This filter works only for launch configuration - * types that have a reference to a project. - * - * @return true, if code in the same project should be - * instrumented only - */ - public boolean getDefaultInstrumentationSameProjectOnly(); - - /** - * Returns a comma separated list of match strings that specifies patterns for - * class path entries to be instrumented by default. - * - * @return List of match strings - */ - public String getDefaultInstrumentationFilter(); - -} diff --git a/com.mountainminds.eclemma.core/src/com/mountainminds/eclemma/core/ICoverageSession.java b/com.mountainminds.eclemma.core/src/com/mountainminds/eclemma/core/ICoverageSession.java deleted file mode 100644 index d9ec9cc..0000000 --- a/com.mountainminds.eclemma.core/src/com/mountainminds/eclemma/core/ICoverageSession.java +++ /dev/null @@ -1,78 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Mountainminds GmbH & Co. KG - * This software is provided under the terms of the Eclipse Public License v1.0 - * See http://www.eclipse.org/legal/epl-v10.html. - * - * $Id$ - ******************************************************************************/ -package com.mountainminds.eclemma.core; - -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.IPath; -import org.eclipse.debug.core.ILaunchConfiguration; - -/** - * A coverage session is the result of a coverage run (or multiple merged runs) - * or coverage data imported from an external source. It is an immutable - * container for all data necessary to - * - * - * - * This interface is not intended to be implemented by clients. - * - * @see CoverageTools#createCoverageSession(String, IInstrumentation[], - * IPath[], ILaunchConfiguration) - * - * @author Marc R. Hoffmann - * @version $Revision$ - */ -public interface ICoverageSession extends IAdaptable { - - /** - * Returns a readable description for this coverage session. - * - * @return readable description - */ - public String getDescription(); - - /** - * Returns the array of instrumentation information objects for this session. - * - * @return array of {@link IInstrumentation} used for this session - */ - public IInstrumentation[] getInstrumentations(); - - /** - * Returns a list of absolute paths to the Emma coverage data files that - * belong to this session. - * - * @return list of absolute paths to the Emma coverage data files - */ - public IPath[] getCoverageDataFiles(); - - /** - * If this session was the result of a Eclipse launch this method returns the - * respective launch configutation. Otherwise null is returned. - * - * @return launch configutation or null - */ - public ILaunchConfiguration getLaunchConfiguration(); - - /** - * Merges this session with the given session creating a new session with the - * given description. - * - * @param other - * Session to merge with - * @param description - * Name of the new session - * @return - * New session object merged from this and the given session - */ - public ICoverageSession merge(ICoverageSession other, String description); - -} \ No newline at end of file diff --git a/com.mountainminds.eclemma.core/src/com/mountainminds/eclemma/core/IInstrumentation.java b/com.mountainminds.eclemma.core/src/com/mountainminds/eclemma/core/IInstrumentation.java deleted file mode 100644 index f4fac07..0000000 --- a/com.mountainminds.eclemma.core/src/com/mountainminds/eclemma/core/IInstrumentation.java +++ /dev/null @@ -1,57 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Mountainminds GmbH & Co. KG - * This software is provided under the terms of the Eclipse Public License v1.0 - * See http://www.eclipse.org/legal/epl-v10.html. - * - * $Id$ - ******************************************************************************/ -package com.mountainminds.eclemma.core; - -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.IProgressMonitor; - -/** - * Instances of {@link IInstrumentation} describe a set of instrumented Java - * classes. This interface is not intended to be implemented by clients, - * instances are returned by - * {@link IClassFiles#instrument(boolean, IProgressMonitor)}. - * - * @author Marc R. Hoffmann - * @version $Revision$ - */ -public interface IInstrumentation { - - /** - * Returns the {@link IClassFiles} object that describe the source of this - * instrumentation. - * - * @return {@link IClassFiles} object - */ - public IClassFiles getClassFiles(); - - /** - * Returns true if this instrumentation has been performed - * in-place. - * - * @return true if this instrumentation was in-place - */ - public boolean isInplace(); - - /** - * Returns the absolute path to the instrumented class files. If in-place - * instrumentation was performed, this corresponds to the location of the - * original class files. - * - * @return absolute path to the instrumented class files - */ - public IPath getOutputLocation(); - - /** - * Returns the absolute path to the Emma meta data file that has been written - * during instrumentation. - * - * @return absolute path to the meta data file - */ - public IPath getMetaDataFile(); - -} diff --git a/com.mountainminds.eclemma.core/src/com/mountainminds/eclemma/core/ISessionExporter.java b/com.mountainminds.eclemma.core/src/com/mountainminds/eclemma/core/ISessionExporter.java deleted file mode 100644 index c9d0638..0000000 --- a/com.mountainminds.eclemma.core/src/com/mountainminds/eclemma/core/ISessionExporter.java +++ /dev/null @@ -1,79 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Mountainminds GmbH & Co. KG - * This software is provided under the terms of the Eclipse Public License v1.0 - * See http://www.eclipse.org/legal/epl-v10.html. - * - * $Id: $ - ******************************************************************************/ -package com.mountainminds.eclemma.core; - -import java.util.Properties; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IProgressMonitor; - -/** - * API for exporting sessions. This interface is not intended to be implemented - * by clients. Use {@link CoverageTools#getExporter(ICoverageSession)} to get an - * instance. - * - * @author Marc R. Hoffmann - * @version $Revision: $ - */ -public interface ISessionExporter { - - /** Constant for export as HTML files (value is 0). */ - public static final int HTML_FORMAT = 0; - - /** Constant for XML file export (value is 1). */ - public static final int XML_FORMAT = 1; - - /** Constant for plain text export (value is 2). */ - public static final int TXT_FORMAT = 2; - - /** Constant for EMMA session file export (value is 3). */ - public static final int EMMA_FORMAT = 3; - - /** - * Default file extensions for the different file formats. The array index - * corresponds to the format constant. - */ - public static final String[] DEFAULT_EXTENSIONS = new String[] { "html", //$NON-NLS-1$ - "xml", "txt", "es" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - - /** - * Sets the export format. - * - * @param format - * export format constant - */ - public void setFormat(int format); - - /** - * Sets the export file name. Note that in case of HTML export this is only - * the main file, while more files are created as siblings. - * - * @param filename - * file name of export destination - */ - public void setDestination(String filename); - - /** - * Sets EMMA specific report options that overwrite the default setting. - * - * @param options - * EMMA specific report options - */ - public void setReportOptions(Properties options); - - /** - * A call to this method triggers the actual export process. - * - * @param monitor - * progress monitor - * @throws CoreException - * if something goes wrong during export - */ - public void export(IProgressMonitor monitor) throws CoreException; - -} diff --git a/com.mountainminds.eclemma.core/src/com/mountainminds/eclemma/core/ISessionImporter.java b/com.mountainminds.eclemma.core/src/com/mountainminds/eclemma/core/ISessionImporter.java deleted file mode 100644 index 70cf9ca..0000000 --- a/com.mountainminds.eclemma.core/src/com/mountainminds/eclemma/core/ISessionImporter.java +++ /dev/null @@ -1,76 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Mountainminds GmbH & Co. KG - * This software is provided under the terms of the Eclipse Public License v1.0 - * See http://www.eclipse.org/legal/epl-v10.html. - * - * $Id$ - ******************************************************************************/ -package com.mountainminds.eclemma.core; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IProgressMonitor; - -/** - * API for importing sessions. This interface is not intended to be implemented - * by clients. Use {@link CoverageTools#getImporter()} to get an instance. - * - * @author Marc R. Hoffmann - * @version $Revision$ - */ -public interface ISessionImporter { - - /** - * Sets the description for the imported session. - * - * @param description - * textual description of the session - */ - public void setDescription(String description); - - /** - * Sets the path to the coverage file to import. - * - * @param file - * coverage file to import - */ - public void setCoverageFile(String file); - - /** - * Sets the list of class files that should be considered for coverage - * analysis. - * - * @param classfiles - * class files for analysis - */ - public void setClassFiles(IClassFiles[] classfiles); - - /** - * Specifies whether the original file should be copied while importing. - * Otherwise the coverage file a referenced only. - * - * @param copy - * flag, whether the coverage file should be copied - */ - public void setCopy(boolean copy); - - /** - * Imported session files might come with their own meta data. Here we can set - * whether this data should be used. Otherwise Meta data is extracted from the - * local class files. - * - * @param flag - * true, if external Meta data should be used - */ - public void setUseImportedMetaData(boolean flag); - - /** - * A call to this method triggers the actual import process. - * - * @param monitor - * progress monitor - * @throws CoreException - * if something goes wrong during export - */ - public void importSession(IProgressMonitor monitor) throws CoreException; - -} diff --git a/com.mountainminds.eclemma.core/src/com/mountainminds/eclemma/core/ISessionListener.java b/com.mountainminds.eclemma.core/src/com/mountainminds/eclemma/core/ISessionListener.java deleted file mode 100644 index 46bb6d6..0000000 --- a/com.mountainminds.eclemma.core/src/com/mountainminds/eclemma/core/ISessionListener.java +++ /dev/null @@ -1,48 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Mountainminds GmbH & Co. KG - * This software is provided under the terms of the Eclipse Public License v1.0 - * See http://www.eclipse.org/legal/epl-v10.html. - * - * $Id$ - ******************************************************************************/ -package com.mountainminds.eclemma.core; - - -/** - * Callback interface for changes of the session manager. This interface is - * intended to be implemented by clients that want to get notifications. - * - * @see ISessionManager#addSessionListener(ISessionListener) - * @see ISessionManager#removeSessionListener(ISessionListener) - * - * @author Marc R. Hoffmann - * @version $Revision$ - */ -public interface ISessionListener { - - /** - * Called when a session has been added. - * - * @param addedSession - * added session - */ - public void sessionAdded(ICoverageSession addedSession); - - /** - * Called when a session has been removed. - * - * @param removedSession - * removes session - */ - public void sessionRemoved(ICoverageSession removedSession); - - /** - * Called when a new session has been activated or the last session has been - * removed. In this case null is passed as a parameter. - * - * @param session - * activated session or null - */ - public void sessionActivated(ICoverageSession session); - -} diff --git a/com.mountainminds.eclemma.core/src/com/mountainminds/eclemma/core/ISessionManager.java b/com.mountainminds.eclemma.core/src/com/mountainminds/eclemma/core/ISessionManager.java deleted file mode 100644 index 76c4d9d..0000000 --- a/com.mountainminds.eclemma.core/src/com/mountainminds/eclemma/core/ISessionManager.java +++ /dev/null @@ -1,134 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Mountainminds GmbH & Co. KG - * This software is provided under the terms of the Eclipse Public License v1.0 - * See http://www.eclipse.org/legal/epl-v10.html. - * - * $Id$ - ******************************************************************************/ -package com.mountainminds.eclemma.core; - - -/** - * The session manager holds a list of currently available sessions. One of the - * sessions in the list may be the active session, which is the one that is used - * to attach coverage information to Java elements. - * - * This interface is not intended to be implemented or extended by clients. - * - * @see com.mountainminds.eclemma.core.CoverageTools#getSessionManager() - * - * @author Marc R. Hoffmann - * @version $Revision$ - */ -public interface ISessionManager { - - /** - * Adds the given session to this session manager. If the session is already - * part of this session manager the method has no effect. If the key parameter - * is not null the key is internally assigned to this session - * for later access. - * - * @param session - * the new session - * @param activate - * if true the session will also be activated - * @param key - * key object this session will be assigned to - */ - public void addSession(ICoverageSession session, boolean activate, Object key); - - /** - * Removes the given session. If the session is not in included in this - * session manager this method has no effect. If the removed session was the - * active session, the most recently added session becomes active. - * - * @param session - * session to remove - */ - public void removeSession(ICoverageSession session); - - /** - * Removes the session that has been assigned to the given key. If there is no - * session for the key this method has no effect. If the removed session was - * the active session, the most recently added session becomes active. - * - * @see #addSession(ICoverageSession, boolean, Object) - * @param key - * key object for the session to remove - */ - public void removeSession(Object key); - - /** - * Removes all registered sessions. - */ - public void removeAllSessions(); - - /** - * Returns all sessions that have been registered with this session manager. - * - * @see #addSession(ICoverageSession, boolean, Object) - * @return list of registered session - */ - public ICoverageSession[] getSessions(); - - /** - * Returns the session that has been assigned to the given key. If there is no - * session for the key this method returns null. - * - * @see #addSession(ICoverageSession, boolean, Object) - * @param key - * key object for the session - * @return session object or null - */ - public ICoverageSession getSession(Object key); - - /** - * Activates the given session. If the session is not in included in this - * session manager this method has no effect. - * - * @param session - * session to activate - */ - public void activateSession(ICoverageSession session); - - /** - * Activates the session that has been assigned to the given key. If there is - * no session for the key this method has no effect. - * - * @see #addSession(ICoverageSession, boolean, Object) - * @param key - * key object for the session to activate - */ - public void activateSession(Object key); - - /** - * Returns the active session or null if there is no session. - * - * @return active session or null - */ - public ICoverageSession getActiveSession(); - - /** - * Triggers a reload of the active session. If there is no active session - * this method has no effect. - */ - public void refreshActiveSession(); - - /** - * Adds the given session listener unless it has been added before. - * - * @param listener - * session listener to add - */ - public void addSessionListener(ISessionListener listener); - - /** - * Removes the given session listener. If the listener has not been added - * before this method has no effect. - * - * @param listener - * session listener to remove - */ - public void removeSessionListener(ISessionListener listener); - -} diff --git a/com.mountainminds.eclemma.core/src/com/mountainminds/eclemma/core/ISourceLocation.java b/com.mountainminds.eclemma.core/src/com/mountainminds/eclemma/core/ISourceLocation.java deleted file mode 100644 index 0d3ef26..0000000 --- a/com.mountainminds.eclemma.core/src/com/mountainminds/eclemma/core/ISourceLocation.java +++ /dev/null @@ -1,61 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Mountainminds GmbH & Co. KG - * This software is provided under the terms of the Eclipse Public License v1.0 - * See http://www.eclipse.org/legal/epl-v10.html. - * - * $Id$ - ******************************************************************************/ -package com.mountainminds.eclemma.core; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.IProgressMonitor; - -/** - * Reference to a location where Java source code is stored. This information - * is used for Emma report generation. - * - * @author Marc R. Hoffmann - * @version $Revision$ - */ -public interface ISourceLocation { - - /** - * Returns the absolute path to the source folder or archive. - * - * @return absolute path to the source folder or archive - */ - public IPath getPath(); - - /** - * Determines whether this source location points to an archive. - * - * @return true if this source location is an archive - */ - public boolean isArchive(); - - /** - * Returns the path within the source archive where package fragments are - * located. An empty path indicates that packages are located at the root of - * the source archive or folder. Returns a non-null value if - * and only if {@link #isArchive()} returns true. - * - * @return the path within the source archive, or null if not - * applicable - */ - public IPath getRootPath(); - - /** - * If this source location points to an archive, calling this method will - * extract the source files to an temporary local folder. The properties of - * this descriptor object will be updated to the new location. If the source - * files are already extracted this method does nothing. - * - * @param monitor - * progress monitor or null - * @throws CoreException - * Thrown if the archive content can't be extracted. - */ - public void extract(IProgressMonitor monitor) throws CoreException; - -} diff --git a/com.mountainminds.eclemma.core/src/com/mountainminds/eclemma/core/analysis/ICounter.java b/com.mountainminds.eclemma.core/src/com/mountainminds/eclemma/core/analysis/ICounter.java deleted file mode 100644 index 7da5398..0000000 --- a/com.mountainminds.eclemma.core/src/com/mountainminds/eclemma/core/analysis/ICounter.java +++ /dev/null @@ -1,54 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Mountainminds GmbH & Co. KG - * This software is provided under the terms of the Eclipse Public License v1.0 - * See http://www.eclipse.org/legal/epl-v10.html. - * - * $Id$ - ******************************************************************************/ -package com.mountainminds.eclemma.core.analysis; - -/** - * A counter holds the total and the covered number of particular items like - * classes, methods, blocks or instructions. Counters provide canonical - * comparison of their covered/total ratios. This interface is not intended to - * be implemented or extended by clients. - * - * @see IJavaElementCoverage#getLineCounter() - * @see IJavaElementCoverage#getBlockCounter() - * @see IJavaElementCoverage#getInstructionCounter() - * - * @author Marc R. Hoffmann - * @version $Revision$ - */ -public interface ICounter extends Comparable { - - /** - * Returns the total count number of instrumented items. - * - * @return total count of instrumented items - */ - public long getTotalCount(); - - /** - * Returns the total count number of covered items. - * - * @return total count of covered items - */ - public long getCoveredCount(); - - /** - * Returns the total count number of missed items. - * - * @return total count of missed items - */ - public long getMissedCount(); - - /** - * Calculates the ratio of covered to total count items. If total count items - * is 0 this method returns NaN. - * - * @return ratio of covered to total count items - */ - public double getRatio(); - -} diff --git a/com.mountainminds.eclemma.core/src/com/mountainminds/eclemma/core/analysis/IJavaCoverageListener.java b/com.mountainminds.eclemma.core/src/com/mountainminds/eclemma/core/analysis/IJavaCoverageListener.java deleted file mode 100644 index 9ec9f94..0000000 --- a/com.mountainminds.eclemma.core/src/com/mountainminds/eclemma/core/analysis/IJavaCoverageListener.java +++ /dev/null @@ -1,24 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Mountainminds GmbH & Co. KG - * This software is provided under the terms of the Eclipse Public License v1.0 - * See http://www.eclipse.org/legal/epl-v10.html. - * - * $Id$ - ******************************************************************************/ -package com.mountainminds.eclemma.core.analysis; - -/** - * Callback interface implemented by clients that want to be informed, when the - * current Java model coverage has changes. - * - * @author Marc R. Hoffmann - * @version $Revision$ - */ -public interface IJavaCoverageListener { - - /** - * Called when the current coverage data has changed. - */ - public void coverageChanged(); - -} diff --git a/com.mountainminds.eclemma.core/src/com/mountainminds/eclemma/core/analysis/IJavaElementCoverage.java b/com.mountainminds.eclemma.core/src/com/mountainminds/eclemma/core/analysis/IJavaElementCoverage.java deleted file mode 100644 index 4eb21aa..0000000 --- a/com.mountainminds.eclemma.core/src/com/mountainminds/eclemma/core/analysis/IJavaElementCoverage.java +++ /dev/null @@ -1,71 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Mountainminds GmbH & Co. KG - * This software is provided under the terms of the Eclipse Public License v1.0 - * See http://www.eclipse.org/legal/epl-v10.html. - * - * $Id$ - ******************************************************************************/ -package com.mountainminds.eclemma.core.analysis; - -/** - * Coverage data for a Java model element. This interface is not intended to be - * implemented or extended by clients. - * - * @author Marc R. Hoffmann - * @version $Revision$ - */ -public interface IJavaElementCoverage { - - /** - * Returns line coverage details if the corresponding Java element is a - * compilation unit, type or method. - * - * @return {@link ILineCoverage} object or null - */ - public ILineCoverage getLineCoverage(); - - /** - * Returns the counter for blocks. - * - * @return counter for blocks - */ - public ICounter getBlockCounter(); - - /** - * Returns the counter for lines. - * - * @return counter for lines - */ - public ICounter getLineCounter(); - - /** - * Returns the counter for methods. - * - * @return counter for methods - */ - public ICounter getMethodCounter(); - - /** - * Returns the counter for types. - * - * @return counter for types - */ - public ICounter getTypeCounter(); - - /** - * Returns the counter for instructions. - * - * @return counter for instructions - */ - public ICounter getInstructionCounter(); - - /** - * Returns the modification stamp of the underlying resource. This can be used - * by clients to check whether the current version of the respective resource - * is identical to the version that was used for the coverage session. - * - * @return modification stamp of the underlying resource - */ - public long getResourceModificationStamp(); - -} diff --git a/com.mountainminds.eclemma.core/src/com/mountainminds/eclemma/core/analysis/IJavaModelCoverage.java b/com.mountainminds.eclemma.core/src/com/mountainminds/eclemma/core/analysis/IJavaModelCoverage.java deleted file mode 100644 index ebe6ff5..0000000 --- a/com.mountainminds.eclemma.core/src/com/mountainminds/eclemma/core/analysis/IJavaModelCoverage.java +++ /dev/null @@ -1,122 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Mountainminds GmbH & Co. KG - * This software is provided under the terms of the Eclipse Public License v1.0 - * See http://www.eclipse.org/legal/epl-v10.html. - * - * $Id$ - ******************************************************************************/ -package com.mountainminds.eclemma.core.analysis; - -import org.eclipse.jdt.core.IJavaElement; -import org.eclipse.jdt.core.IJavaProject; -import org.eclipse.jdt.core.IPackageFragment; -import org.eclipse.jdt.core.IPackageFragmentRoot; -import org.eclipse.jdt.core.IType; - -import com.mountainminds.eclemma.internal.core.analysis.Counter; - -/** - * The interface for coverage information attached to the Java model. It allows - * to retrieve coverage information for any Java model element and holds lists - * of entry points. - * - * @author Marc R. Hoffmann - * @version $Revision$ - */ -public interface IJavaModelCoverage extends IJavaElementCoverage { - - /** - * This instance is used to indicate that a coverage session is currently - * loading. - */ - public static final IJavaModelCoverage LOADING = new IJavaModelCoverage() { - - public ILineCoverage getLineCoverage() { - return null; - } - - public ICounter getBlockCounter() { - return Counter.COUNTER_0_0; - } - - public ICounter getLineCounter() { - return Counter.COUNTER_0_0; - } - - public ICounter getInstructionCounter() { - return Counter.COUNTER_0_0; - } - - public ICounter getMethodCounter() { - return Counter.COUNTER_0_0; - } - - public ICounter getTypeCounter() { - return Counter.COUNTER_0_0; - } - - public long getResourceModificationStamp() { - return 0; - } - - public IJavaProject[] getInstrumentedProjects() { - return new IJavaProject[0]; - } - - public IPackageFragmentRoot[] getInstrumentedPackageFragmentRoots() { - return new IPackageFragmentRoot[0]; - } - - public IPackageFragment[] getInstrumentedPackageFragments() { - return new IPackageFragment[0]; - } - - public IType[] getInstrumentedTypes() { - return new IType[0]; - } - - public IJavaElementCoverage getCoverageFor(IJavaElement element) { - return null; - } - - }; - - /** - * Returns all Java projects where coverage information is available for. - * - * @return list of Java projects - */ - public IJavaProject[] getInstrumentedProjects(); - - /** - * Returns all package fragment roots where coverage information is available - * for. - * - * @return list of package fragment roots. - */ - public IPackageFragmentRoot[] getInstrumentedPackageFragmentRoots(); - - /** - * Returns all package fragments where coverage information is available for. - * - * @return list of package fragments - */ - public IPackageFragment[] getInstrumentedPackageFragments(); - - /** - * Returns all Java types where coverage information is available for. - * - * @return list of Java types - */ - public IType[] getInstrumentedTypes(); - - /** - * Returns the coverage information associated with the given Java element. If - * no information is available null is returned. - * - * @param element Java element to look for coverage information - * @return associated coverage information of null - */ - public IJavaElementCoverage getCoverageFor(IJavaElement element); - -} diff --git a/com.mountainminds.eclemma.core/src/com/mountainminds/eclemma/core/analysis/ILineCoverage.java b/com.mountainminds.eclemma.core/src/com/mountainminds/eclemma/core/analysis/ILineCoverage.java deleted file mode 100644 index 190f274..0000000 --- a/com.mountainminds.eclemma.core/src/com/mountainminds/eclemma/core/analysis/ILineCoverage.java +++ /dev/null @@ -1,90 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Mountainminds GmbH & Co. KG - * This software is provided under the terms of the Eclipse Public License v1.0 - * See http://www.eclipse.org/legal/epl-v10.html. - * - * $Id$ - ******************************************************************************/ -package com.mountainminds.eclemma.core.analysis; - -/** - * For all elements that sit in a compilation unit and for compilation units - * itself individual line coverage may be described by this interface. This - * interface is not intended to be implemented or extended by clients. - * - * @see IJavaElementCoverage#getLineCoverage() - * - * @author Marc R. Hoffmann - * @version $Revision$ - */ -public interface ILineCoverage extends ICounter { - - /** Flag for lines that do not contain code (value is 0x00). */ - public static final byte NO_CODE = 0x00; - - /** Flag for lines that are not covered (value is 0x01). */ - public static final byte NOT_COVERED = 0x01; - - /** Flag for lines that are fully covered (value is 0x02). */ - public static final byte FULLY_COVERED = 0x02; - - /** Flag for lines that are partly covered (value is 0x03). */ - public static final byte PARTLY_COVERED = NOT_COVERED | FULLY_COVERED; - - /** - * The number of the first line coverage information is available for. - * - * @return number of the first line - */ - public int getFirstLine(); - - /** - * The number of the last line coverage information is available for. - * - * @return number of the last line - */ - public int getLastLine(); - - /** - * Returns the line number of the first entry in the array returned by - * {@link #getCoverage()}. - * - * @deprecated use {@link #getCoverage(int)} instead - * - * @return offset of the coverage data array - */ - public int getOffset(); - - /** - * Returns an array of coverage flags defined as constants in this interface. - * The first item of the returned array corresponds to the line returned by - * {@link #getOffset()}. Note that the length of the array may supersede the - * actual source file length. If the no line information is available the - * method returns null. - * - * @see #NO_CODE - * @see #NOT_COVERED - * @see #PARTLY_COVERED - * @see #FULLY_COVERED - * @deprecated use {@link #getCoverage(int)} instead - * - * @return array of coverage flags or null - */ - public byte[] getCoverage(); - - /** - * Returns the coverage flag defined as constants in this interface for the - * given line. - * - * @see #NO_CODE - * @see #NOT_COVERED - * @see #PARTLY_COVERED - * @see #FULLY_COVERED - * - * @param line - * line number - * @return status flag - */ - public byte getCoverage(int line); - -} diff --git a/com.mountainminds.eclemma.core/src/com/mountainminds/eclemma/core/launching/CoverageLauncher.java b/com.mountainminds.eclemma.core/src/com/mountainminds/eclemma/core/launching/CoverageLauncher.java deleted file mode 100644 index c79b762..0000000 --- a/com.mountainminds.eclemma.core/src/com/mountainminds/eclemma/core/launching/CoverageLauncher.java +++ /dev/null @@ -1,313 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2009 Mountainminds GmbH & Co. KG - * This software is provided under the terms of the Eclipse Public License v1.0 - * See http://www.eclipse.org/legal/epl-v10.html. - * - * $Id$ - ******************************************************************************/ -package com.mountainminds.eclemma.core.launching; - -import java.io.FileOutputStream; -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; -import java.util.Properties; -import java.util.jar.JarOutputStream; -import java.util.jar.Manifest; -import java.util.zip.ZipEntry; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IConfigurationElement; -import org.eclipse.core.runtime.IExecutableExtension; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.SubProgressMonitor; -import org.eclipse.debug.core.DebugPlugin; -import org.eclipse.debug.core.ILaunch; -import org.eclipse.debug.core.ILaunchConfiguration; -import org.eclipse.debug.core.ILaunchConfigurationType; -import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; -import org.eclipse.debug.core.ILaunchManager; -import org.eclipse.debug.core.Launch; -import org.eclipse.debug.core.model.ILaunchConfigurationDelegate; -import org.eclipse.debug.core.model.ILaunchConfigurationDelegate2; -import org.eclipse.jdt.launching.IRuntimeClasspathEntry; -import org.eclipse.jdt.launching.IRuntimeClasspathProvider; -import org.eclipse.jdt.launching.JavaRuntime; -import org.eclipse.osgi.util.NLS; - -import com.mountainminds.eclemma.core.CoverageTools; -import com.mountainminds.eclemma.core.EclEmmaStatus; -import com.mountainminds.eclemma.core.IClassFiles; -import com.mountainminds.eclemma.internal.core.CoreMessages; -import com.mountainminds.eclemma.internal.core.DebugOptions; -import com.mountainminds.eclemma.internal.core.EclEmmaCorePlugin; -import com.mountainminds.eclemma.internal.core.instr.InstrMarker; -import com.mountainminds.eclemma.internal.core.launching.CoverageLaunchInfo; -import com.mountainminds.eclemma.internal.core.launching.InstrumentedClasspathProvider; -import com.vladium.emma.AppLoggers; -import com.vladium.emma.EMMAProperties; - -/** - * Abstract base class for coverage mode launchers. Coverage launchers perform - * class instrumentation and then delegate to the corresponding launcher - * responsible for the "run" mode. - * - * @author Marc R. Hoffmann - * @version $Revision$ - */ -public abstract class CoverageLauncher implements ICoverageLauncher, - IExecutableExtension { - - /** - * Name of the file that will EMMA pick from the classpath to reads its - * properties. - */ - protected static final String EMMA_PROPERTIES_FILE = "emma.properties"; //$NON-NLS-1$ - - /** Launch mode for the launch delegates used internally. */ - public static final String DELEGATELAUNCHMODE = ILaunchManager.RUN_MODE; - - protected String launchtype; - - protected ILaunchConfigurationDelegate launchdelegate; - - protected ILaunchConfigurationDelegate2 launchdelegate2; - - /** - * Hook method to modify the launch configuration before it is passed on to - * the delegate launcher. - * - * @param workingcopy - * Configuration to modify - * @param info - * Info object of this launch - * @throws CoreException - * may be thrown by implementations - */ - protected void modifyConfiguration( - ILaunchConfigurationWorkingCopy workingcopy, ICoverageLaunchInfo info) - throws CoreException { - // Does nothing by default - } - - /** - * Returns whether in-place instrumentation should be performed. The default - * implementation looks-up the corresponding entry in the passed launch - * configuration. Specific launchers may modify this behavior. - * - * @param configuration - * launch configuration for coverage run - * @return true, if instrumentation should be performed in-place - * @throws CoreException - * May be thrown when accessing the launch configuration - */ - protected boolean hasInplaceInstrumentation(ILaunchConfiguration configuration) - throws CoreException { - return configuration.getAttribute( - ICoverageLaunchConfigurationConstants.ATTR_INPLACE_INSTRUMENTATION, - false); - } - - /** - * Creates the a JAR file including the emma.properties file that - * will be injected in the class path. - * - * @param configuration - * Configuration object for this launch - * @param info - * Launch Info object of this launch - * @throws CoreException - * Thrown when the JAR file cannot be created - */ - private void createPropertiesJAR(ILaunchConfiguration configuration, - ICoverageLaunchInfo info) throws CoreException { - Properties properties = new Properties(); - properties.put(EMMAProperties.PROPERTY_COVERAGE_DATA_OUT_FILE, info - .getCoverageFile().toOSString()); - properties.put(AppLoggers.PROPERTY_VERBOSITY_LEVEL, - DebugOptions.EMMAVERBOSITYLEVEL); - IPath jarfile = info.getPropertiesJARFile(); - Manifest mf = new Manifest(); - try { - JarOutputStream jar = new JarOutputStream(new FileOutputStream(jarfile - .toFile()), mf); - jar.putNextEntry(new ZipEntry(EMMA_PROPERTIES_FILE)); - properties.store(jar, - "Created for launch configuration " + configuration.getName()); //$NON-NLS-1$ - jar.close(); - } catch (IOException e) { - throw new CoreException(EclEmmaStatus.EMMA_PROPERTIES_CREATION_ERROR - .getStatus(jarfile, e)); - } - } - - // IExecutableExtension interface: - - public void setInitializationData(IConfigurationElement config, - String propertyName, Object data) throws CoreException { - launchtype = config.getAttribute("type"); //$NON-NLS-1$ - launchdelegate = getLaunchDelegate(launchtype); - if (launchdelegate instanceof ILaunchConfigurationDelegate2) { - launchdelegate2 = (ILaunchConfigurationDelegate2) launchdelegate; - } - } - - private ILaunchConfigurationDelegate getLaunchDelegate(String launchtype) - throws CoreException { - ILaunchConfigurationType type = DebugPlugin.getDefault().getLaunchManager() - .getLaunchConfigurationType(launchtype); - if (type == null) { - throw new CoreException(EclEmmaStatus.UNKOWN_LAUNCH_TYPE_ERROR - .getStatus(launchtype)); - } - return type.getDelegate(DELEGATELAUNCHMODE); - } - - // ILaunchConfigurationDelegate interface: - - public void launch(ILaunchConfiguration configuration, String mode, - ILaunch launch, IProgressMonitor monitor) throws CoreException { - monitor.beginTask(NLS.bind(CoreMessages.Launching_task, configuration - .getName()), 2); - IRuntimeClasspathProvider provider = JavaRuntime - .getClasspathProvider(configuration); - ICoverageLaunchInfo info = CoverageTools.getLaunchInfo(launch); - if (info == null) { - // Must not happen as we should have created the launch - throw new CoreException(EclEmmaStatus.MISSING_LAUNCH_INFO_ERROR - .getStatus(null)); - } - info.instrument(new SubProgressMonitor(monitor, 1), - hasInplaceInstrumentation(configuration)); - if (monitor.isCanceled()) { - return; - } - createPropertiesJAR(configuration, info); - ILaunchConfigurationWorkingCopy wc = configuration.getWorkingCopy(); - modifyConfiguration(wc, info); - InstrumentedClasspathProvider.enable(provider, info); - try { - launchdelegate.launch(wc, DELEGATELAUNCHMODE, launch, - new SubProgressMonitor(monitor, 1)); - } finally { - InstrumentedClasspathProvider.disable(); - } - monitor.done(); - } - - // ILaunchConfigurationDelegate2 interface: - - public ILaunch getLaunch(ILaunchConfiguration configuration, String mode) - throws CoreException { - ILaunch launch = new Launch(configuration, CoverageTools.LAUNCH_MODE, null); - new CoverageLaunchInfo(launch); - return launch; - } - - public boolean buildForLaunch(ILaunchConfiguration configuration, - String mode, IProgressMonitor monitor) throws CoreException { - if (launchdelegate2 == null) { - return true; - } else { - return launchdelegate2.buildForLaunch(configuration, DELEGATELAUNCHMODE, - monitor); - } - } - - public boolean preLaunchCheck(ILaunchConfiguration configuration, - String mode, IProgressMonitor monitor) throws CoreException { - boolean inplace = hasInplaceInstrumentation(configuration); - if (CoverageTools.getClassFilesForInstrumentation(configuration, inplace).length == 0) { - IStatus status = EclEmmaStatus.NO_INSTRUMENTED_CLASSES.getStatus(); - EclEmmaCorePlugin.getInstance().showPrompt(status, configuration); - return false; - } - if (inplace) { - // Issue an inplace instrumentation warning: - IStatus status = EclEmmaStatus.INPLACE_INSTRUMENTATION_INFO.getStatus(); - if (!EclEmmaCorePlugin.getInstance().showPrompt(status, configuration)) { - return false; - } - } else { - // check whether inpace instrumentation has been performed before - if (checkForPreviousInplace(configuration)) { - IStatus status = EclEmmaStatus.ALREADY_INSTRUMENTED_ERROR.getStatus(); - EclEmmaCorePlugin.getInstance().showPrompt(status, configuration); - return false; - } - } - // Then allow the delegate's veto: - if (launchdelegate2 == null) { - return true; - } else { - return launchdelegate2.preLaunchCheck(configuration, DELEGATELAUNCHMODE, - monitor); - } - } - - private boolean checkForPreviousInplace(ILaunchConfiguration config) - throws CoreException { - IClassFiles[] classfiles = CoverageTools.getClassFilesForInstrumentation( - config, false); - for (int i = 0; i < classfiles.length; i++) { - if (InstrMarker.isMarked(classfiles[i].getLocation())) { - return true; - } - } - return false; - } - - public boolean finalLaunchCheck(ILaunchConfiguration configuration, - String mode, IProgressMonitor monitor) throws CoreException { - if (launchdelegate2 == null) { - return true; - } else { - return launchdelegate2.finalLaunchCheck(configuration, - DELEGATELAUNCHMODE, monitor); - } - } - - // ICoverageLauncher interface: - - /* - * The default implemenation delegates to the classpath provider. - */ - public IClassFiles[] getClassFiles(ILaunchConfiguration configuration, - boolean includebinaries) throws CoreException { - List l = new ArrayList(); - IRuntimeClasspathEntry[] entries = JavaRuntime - .computeUnresolvedRuntimeClasspath(configuration); - entries = JavaRuntime.resolveRuntimeClasspath(entries, configuration); - for (int i = 0; i < entries.length; i++) { - if (entries[i].getClasspathProperty() == IRuntimeClasspathEntry.USER_CLASSES) { - IClassFiles ic = CoverageTools - .getClassFilesAtAbsoluteLocation(entries[i].getLocation()); - if (ic != null && (includebinaries || !ic.isBinary())) { - l.add(ic); - } - } - } - IClassFiles[] arr = new IClassFiles[l.size()]; - return (IClassFiles[]) l.toArray(arr); - } - - /** - * Internal utility to find the {@link IClassFiles} descriptor for the given - * class path location. - * - * @param location - * class path location - * @return descriptor or null - * @throws CoreException - * in case of internal inconsistencies - * @deprecated please user - * {@link CoverageTools#getClassFilesAtAbsoluteLocation(String)} - * instead - */ - protected IClassFiles findClassFiles(String location) throws CoreException { - return CoverageTools.getClassFilesAtAbsoluteLocation(location); - } - -} diff --git a/com.mountainminds.eclemma.core/src/com/mountainminds/eclemma/core/launching/EclipseLauncher.java b/com.mountainminds.eclemma.core/src/com/mountainminds/eclemma/core/launching/EclipseLauncher.java deleted file mode 100644 index 16f35db..0000000 --- a/com.mountainminds.eclemma.core/src/com/mountainminds/eclemma/core/launching/EclipseLauncher.java +++ /dev/null @@ -1,108 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2009 Mountainminds GmbH & Co. KG - * This software is provided under the terms of the Eclipse Public License v1.0 - * See http://www.eclipse.org/legal/epl-v10.html. - * - * $Id$ - ******************************************************************************/ -package com.mountainminds.eclemma.core.launching; - -import java.io.File; -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.debug.core.ILaunchConfiguration; -import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; -import org.eclipse.jdt.core.IJavaModel; -import org.eclipse.jdt.core.IJavaProject; -import org.eclipse.jdt.core.JavaCore; -import org.eclipse.jdt.launching.IJavaLaunchConfigurationConstants; - -import com.mountainminds.eclemma.core.CoverageTools; -import com.mountainminds.eclemma.core.IClassFiles; -import com.mountainminds.eclemma.internal.core.EclEmmaCorePlugin; -import com.mountainminds.eclemma.internal.core.EclipseVersion; - -/** - * Laucher for the Eclipse runtime workbench. - * - * @author Marc R. Hoffmann - * @version $Revision$ - */ -public class EclipseLauncher extends CoverageLauncher { - - protected static final String PLUGIN_NATURE = "org.eclipse.pde.PluginNature"; //$NON-NLS-1$ - - /** Pre-Eclipse 3.2.0 VM arguments key */ - protected static final String PRE320VMARGS = "vmargs"; //$NON-NLS-1$ - protected static final String VMARGS = IJavaLaunchConfigurationConstants.ATTR_VM_ARGUMENTS; - - public static final String BOOTPATHARG = "-Xbootclasspath/a:"; //$NON-NLS-1$ - - /** - * Returns the proper key for VM arguments depending on the Eclipse version - * - * @return launch configuration key for VM arguments - */ - protected String getVMArgsKey() { - boolean is320 = EclipseVersion.isGreaterOrEqualTo(EclipseVersion.V320); - return is320 ? VMARGS : PRE320VMARGS; - } - - /** - * Adds the given single argument to the VM arguments. If it contains white - * spaces the argument is included in double quotes. - * - * @param workingcopy configuration to modify - * @param arg additional VM argument - * @throws CoreException may be thrown by the launch configuration - */ - protected void addVMArgument(ILaunchConfigurationWorkingCopy workingcopy, String arg) throws CoreException { - String vmargskey = getVMArgsKey(); - StringBuffer sb = new StringBuffer(workingcopy.getAttribute(vmargskey, "")); //$NON-NLS-1$ - if (sb.length() > 0) { - sb.append(' '); - } - if (arg.indexOf(' ') == -1) { - sb.append(arg); - } else { - sb.append('"').append(arg).append('"'); - } - workingcopy.setAttribute(vmargskey, sb.toString()); - } - - protected boolean hasInplaceInstrumentation(ILaunchConfiguration configuration) { - // Inplace instrumentation is required for plugin launches, as we can't - // modify the classpath - return true; - } - - protected void modifyConfiguration(ILaunchConfigurationWorkingCopy workingcopy, - ICoverageLaunchInfo info) throws CoreException { - StringBuffer sb = new StringBuffer(BOOTPATHARG); - sb.append(info.getPropertiesJARFile()); - sb.append(File.pathSeparatorChar).append(CoverageTools.getEmmaJar().toOSString()); - addVMArgument(workingcopy, sb.toString()); - } - - /* - * We list all source based class files of all plugins in the workspace. - */ - public IClassFiles[] getClassFiles(ILaunchConfiguration configuration, boolean includebinaries) throws CoreException { - IJavaModel model = JavaCore.create(ResourcesPlugin.getWorkspace().getRoot()); - IJavaProject[] projects = model.getJavaProjects(); - List l = new ArrayList(); - for (int i = 0; i < projects.length; i++) { - if (projects[i].getProject().hasNature(PLUGIN_NATURE)) { - IClassFiles[] cf = EclEmmaCorePlugin.getClassFiles(projects[i]); - for (int j = 0; j < cf.length; j++) { - if (!cf[j].isBinary()) l.add(cf[j]); - } - } - } - return (IClassFiles[]) l.toArray(new IClassFiles[0]); - } - -} diff --git a/com.mountainminds.eclemma.core/src/com/mountainminds/eclemma/core/launching/ICoverageLaunchConfigurationConstants.java b/com.mountainminds.eclemma.core/src/com/mountainminds/eclemma/core/launching/ICoverageLaunchConfigurationConstants.java deleted file mode 100644 index 044dd12..0000000 --- a/com.mountainminds.eclemma.core/src/com/mountainminds/eclemma/core/launching/ICoverageLaunchConfigurationConstants.java +++ /dev/null @@ -1,35 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Mountainminds GmbH & Co. KG - * This software is provided under the terms of the Eclipse Public License v1.0 - * See http://www.eclipse.org/legal/epl-v10.html. - * - * $Id$ - ******************************************************************************/ -package com.mountainminds.eclemma.core.launching; - -import com.mountainminds.eclemma.internal.core.EclEmmaCorePlugin; - -/** - * Constants for coverage specific launch configuration entries. - * - * @author Marc R. Hoffmann - * @version $Revision$ - */ -public interface ICoverageLaunchConfigurationConstants { - - /** - * This boolean attribute specifies, whether class files should be - * instrumented in-place. If unspecified inplace instrumentation is not - * performed. - */ - public static final String ATTR_INPLACE_INSTRUMENTATION = EclEmmaCorePlugin.ID - + ".INPLACE_INSTRUMENTATION"; //$NON-NLS-1$ - - /** - * List of workspace relative paths for instrumentation. If unspecified all - * output locations of source folders will be instrumented. - */ - public static final String ATTR_INSTRUMENTATION_PATHS = EclEmmaCorePlugin.ID - + ".INSTRUMENTATION_PATHS"; //$NON-NLS-1$ - -} diff --git a/com.mountainminds.eclemma.core/src/com/mountainminds/eclemma/core/launching/ICoverageLaunchInfo.java b/com.mountainminds.eclemma.core/src/com/mountainminds/eclemma/core/launching/ICoverageLaunchInfo.java deleted file mode 100644 index 3309baf..0000000 --- a/com.mountainminds.eclemma.core/src/com/mountainminds/eclemma/core/launching/ICoverageLaunchInfo.java +++ /dev/null @@ -1,74 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Mountainminds GmbH & Co. KG - * This software is provided under the terms of the Eclipse Public License v1.0 - * See http://www.eclipse.org/legal/epl-v10.html. - * - * $Id$ - ******************************************************************************/ -package com.mountainminds.eclemma.core.launching; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.IProgressMonitor; - -import com.mountainminds.eclemma.core.IInstrumentation; - -/** - * Descriptor how a particular launch was instrumented. To every launch in - * "Coverage" mode an instance is attached. - * - * @author Marc R. Hoffmann - * @version $Revision$ - */ -public interface ICoverageLaunchInfo { - - /** - * Returns the location of the coverage data file (*.ec) for this - * launch. - * - * @return absolute path of the coverage data file - */ - public IPath getCoverageFile(); - - /** - * Instruments the selected class path entries. - * - * @param monitor monitor for progress feedback and cancelation - * @param inplace if true, class files will be directly modified - * @throws CoreException in case of internal inconsistencies - */ - public void instrument(IProgressMonitor monitor, boolean inplace) throws CoreException; - - /** - * Returns the list of locations with instrumented class path entries along - * with instumentation meta data. - * - * @return intrumentaion data for class path entries - */ - public IInstrumentation[] getInstrumentations(); - - /** - * Returns the instrumentation information for the class path with the given - * original path. If this class path entry has not been instrumented - * null is returned. - * - * @param originalpath original class path location - * @return instrumentation information or null - */ - public IInstrumentation getInstrumentation(String originalpath); - - /** - * Return the absolute location of the JAR file that will be created to - * inject EMMA properties into the target application. - * - * @return absolute path of the EMMA properties JAR file - */ - public IPath getPropertiesJARFile(); - - /** - * Allow the implementation to perform internal cleanup when this info object - * is no longer required. - */ - public void dispose(); - -} diff --git a/com.mountainminds.eclemma.core/src/com/mountainminds/eclemma/core/launching/ICoverageLauncher.java b/com.mountainminds.eclemma.core/src/com/mountainminds/eclemma/core/launching/ICoverageLauncher.java deleted file mode 100644 index aca47e6..0000000 --- a/com.mountainminds.eclemma.core/src/com/mountainminds/eclemma/core/launching/ICoverageLauncher.java +++ /dev/null @@ -1,39 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Mountainminds GmbH & Co. KG - * This software is provided under the terms of the Eclipse Public License v1.0 - * See http://www.eclipse.org/legal/epl-v10.html. - * - * $Id: $ - ******************************************************************************/ -package com.mountainminds.eclemma.core.launching; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.debug.core.ILaunchConfiguration; -import org.eclipse.debug.core.model.ILaunchConfigurationDelegate2; - -import com.mountainminds.eclemma.core.IClassFiles; - -/** - * The launch delegate for coverage configurations. - * - * @author Marc R. Hoffmann - * @version $Revision: $ - */ -public interface ICoverageLauncher extends ILaunchConfigurationDelegate2 { - - /** - * Returns all class file descriptors for the given launch configuration. - * - * @param configuration - * launch configuration to look for class files - * @param includebinaries - * flag whether binary classpath entries should be included - * - * @return descriptors for all class for instrumentation - * - * @throws CoreException - */ - public IClassFiles[] getClassFiles(ILaunchConfiguration configuration, boolean includebinaries) throws CoreException; - - -} diff --git a/com.mountainminds.eclemma.core/src/com/mountainminds/eclemma/core/launching/JavaApplicationLauncher.java b/com.mountainminds.eclemma.core/src/com/mountainminds/eclemma/core/launching/JavaApplicationLauncher.java deleted file mode 100644 index f6efc21..0000000 --- a/com.mountainminds.eclemma.core/src/com/mountainminds/eclemma/core/launching/JavaApplicationLauncher.java +++ /dev/null @@ -1,30 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Mountainminds GmbH & Co. KG - * This software is provided under the terms of the Eclipse Public License v1.0 - * See http://www.eclipse.org/legal/epl-v10.html. - * - * $Id$ - ******************************************************************************/ -package com.mountainminds.eclemma.core.launching; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; -import org.eclipse.jdt.launching.IJavaLaunchConfigurationConstants; - -import com.mountainminds.eclemma.internal.core.launching.InstrumentedClasspathProvider; - -/** - * Launcher for local Java applications. - * - * @author Marc R. Hoffmann - * @version $Revision$ - */ -public class JavaApplicationLauncher extends CoverageLauncher { - - protected void modifyConfiguration(ILaunchConfigurationWorkingCopy workingcopy, - ICoverageLaunchInfo info) throws CoreException { - workingcopy.setAttribute(IJavaLaunchConfigurationConstants.ATTR_CLASSPATH_PROVIDER, - InstrumentedClasspathProvider.ID); - } - -} diff --git a/com.mountainminds.eclemma.core/src/com/mountainminds/eclemma/internal/core/CoreMessages.java b/com.mountainminds.eclemma.core/src/com/mountainminds/eclemma/internal/core/CoreMessages.java deleted file mode 100644 index 286b77b..0000000 --- a/com.mountainminds.eclemma.core/src/com/mountainminds/eclemma/internal/core/CoreMessages.java +++ /dev/null @@ -1,52 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Mountainminds GmbH & Co. KG - * This software is provided under the terms of the Eclipse Public License v1.0 - * See http://www.eclipse.org/legal/epl-v10.html. - * - * $Id$ - ******************************************************************************/ -package com.mountainminds.eclemma.internal.core; - -import org.eclipse.osgi.util.NLS; - -/** - * Text messages for the core plugin. - * - * @author Marc R. Hoffmann - * @version $Revision$ - */ -public class CoreMessages extends NLS { - - private static final String BUNDLE_NAME = "com.mountainminds.eclemma.internal.core.coremessages";//$NON-NLS-1$ - - public static String LaunchSessionDescription_value; - - public static String InstrumentingClasses_task; - public static String InstrumentingClassesIn_task; - public static String Launching_task; - public static String AnalyzingCoverageSession_task; - public static String ExportingSession_task; - public static String ImportingSession_task; - public static String ExtractingSourceArchive_task; - - public static String StatusINPLACE_INSTRUMENTATION_INFO_message; - public static String StatusNO_LOCAL_EMMAJAR_ERROR_message; - public static String StatusID_CREATION_ERROR_message; - public static String StatusUNKOWN_LAUNCH_TYPE_ERROR_message; - public static String StatusINVALID_CLASSPATH_PROVIDER_CONTEXT_ERROR_message; - public static String StatusMISSING_LAUNCH_INFO_ERROR_message; - public static String StatusEMMA_PROPERTIES_CREATION_ERROR_message; - public static String StatusCOVERAGEDATA_FILE_READ_ERROR_message; - public static String StatusMETADATA_FILE_READ_ERROR_message; - public static String StatusSOURCE_EXTRACTION_ERROR_message; - public static String StatusIMPORT_ERROR_message; - public static String StatusFILE_CONTAINS_NO_METADATA_message; - public static String StatusALREADY_INSTRUMENTED_ERROR_message; - public static String StatusNO_COVERAGE_DATA_ERROR_message; - public static String StatusNO_INSTRUMENTED_CLASSES_message; - - static { - NLS.initializeMessages(BUNDLE_NAME, CoreMessages.class); - } - -} diff --git a/com.mountainminds.eclemma.core/src/com/mountainminds/eclemma/internal/core/CoverageSession.java b/com.mountainminds.eclemma.core/src/com/mountainminds/eclemma/internal/core/CoverageSession.java deleted file mode 100644 index 860b63e..0000000 --- a/com.mountainminds.eclemma.core/src/com/mountainminds/eclemma/internal/core/CoverageSession.java +++ /dev/null @@ -1,82 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Mountainminds GmbH & Co. KG - * This software is provided under the terms of the Eclipse Public License v1.0 - * See http://www.eclipse.org/legal/epl-v10.html. - * - * $Id$ - ******************************************************************************/ -package com.mountainminds.eclemma.internal.core; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.PlatformObject; -import org.eclipse.debug.core.ILaunchConfiguration; - -import com.mountainminds.eclemma.core.ICoverageSession; -import com.mountainminds.eclemma.core.IInstrumentation; - -/** - * A {@link com.mountainminds.eclemma.core.ICoverageSession} implementation. - * - * @author Marc R. Hoffmann - * @version $Revision$ - */ -public class CoverageSession extends PlatformObject implements ICoverageSession { - - private final String description; - - private final IInstrumentation[] instrumentations; - - private final IPath[] coveragedatafiles; - - private final ILaunchConfiguration launchconfiguration; - - public CoverageSession(String description, - IInstrumentation[] instrumentations, IPath[] coveragedatafiles, - ILaunchConfiguration launchconfiguration) { - this.description = description; - this.instrumentations = instrumentations; - this.coveragedatafiles = coveragedatafiles; - this.launchconfiguration = launchconfiguration; - } - - // ICoverageSession implementation - - public String getDescription() { - return description; - } - - public IInstrumentation[] getInstrumentations() { - return instrumentations; - } - - public IPath[] getCoverageDataFiles() { - return this.coveragedatafiles; - } - - public ILaunchConfiguration getLaunchConfiguration() { - return launchconfiguration; - } - - public ICoverageSession merge(ICoverageSession other, String description) { - List i = merge(instrumentations, other.getInstrumentations()); - List c = merge(coveragedatafiles, other.getCoverageDataFiles()); - return new CoverageSession(description, - (IInstrumentation[]) i.toArray(new IInstrumentation[i.size()]), - (IPath[]) c.toArray(new IPath[c.size()]), launchconfiguration); - } - - private List merge(Object[] arr1, Object[] arr2) { - List l = new ArrayList(Arrays.asList(arr1)); - for (int i = 0; i < arr2.length; i++) { - if (!l.contains(arr2[i])) { - l.add(arr2[i]); - } - } - return l; - } - -} diff --git a/com.mountainminds.eclemma.core/src/com/mountainminds/eclemma/internal/core/DebugOptions.java b/com.mountainminds.eclemma.core/src/com/mountainminds/eclemma/internal/core/DebugOptions.java deleted file mode 100644 index 06734a7..0000000 --- a/com.mountainminds.eclemma.core/src/com/mountainminds/eclemma/internal/core/DebugOptions.java +++ /dev/null @@ -1,252 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Mountainminds GmbH & Co. KG - * This software is provided under the terms of the Eclipse Public License v1.0 - * See http://www.eclipse.org/legal/epl-v10.html. - * - * $Id$ - ******************************************************************************/ -package com.mountainminds.eclemma.internal.core; - -import java.io.PrintStream; -import java.text.MessageFormat; - -import org.eclipse.core.runtime.Platform; - -/** - * Access to debug options and tracing facilities for this plugin. - * - * @author Marc R. Hoffmann - * @version $Revision$ - */ -public final class DebugOptions { - - /** - * Interface for optional trace output. - */ - public interface ITracer { - - /** - * Determines whether this tracer is enabled. Clients may use this method to - * avoid expensive calculation for debug output. - * - * @return true if the tracer is enabled - */ - public boolean isEnabled(); - - /** - * Prints the given debug message if the tracer is enabled. - * - * @param message - * text message for trace output - */ - public void trace(String message); - - /** - * Prints the given debug message if the tracer is enabled. The parameter - * object will be inserted for the {x} placeholder. - * - * @param message - * text message for trace output - * @param param1 - * parameter object for inserting - */ - public void trace(String message, Object param1); - - /** - * Prints the given debug message if the tracer is enabled. The parameter - * object wills be inserted for the {x} placeholder. - * - * @param message - * text message for trace output - * @param param1 - * first parameter object for inserting - * @param param2 - * first parameter object for inserting - */ - public void trace(String message, Object param1, Object param2); - - /** - * Prints the given debug message if the tracer is enabled. The parameter - * object wills be inserted for the {x} placeholder. - * - * @param message - * text message for trace output - * @param param1 - * first parameter object for inserting - * @param param2 - * first parameter object for inserting - * @param param3 - * third parameter object for inserting - */ - public void trace(String message, Object param1, Object param2, - Object param3); - - /** - * Starts a timer for the calling thread. - */ - public void startTimer(); - - /** - * Prints out the elapsed time since starting the timer. - * - * @param message - * identification for the timed period - */ - public void stopTimer(String message); - - /** - * Start measuring heap memory usage. - */ - public void startMemoryUsage(); - - /** - * Print out heap memory usage since starting measurement. - * - * @param message - * identification for this memory usage output - */ - public void stopMemoryUsage(String message); - - } - - private static final ITracer NUL_TRACER = new ITracer() { - - public boolean isEnabled() { - return false; - } - - public void trace(String message) { - } - - public void trace(String message, Object param1) { - } - - public void trace(String message, Object param1, Object param2) { - } - - public void trace(String message, Object param1, Object param2, - Object param3) { - } - - public void startTimer() { - } - - public void stopTimer(String message) { - } - - public void startMemoryUsage() { - } - - public void stopMemoryUsage(String message) { - } - }; - - private static class PrintStreamTracer implements ITracer { - - private final PrintStream out; - - private final String channel; - - private final ThreadLocal starttime = new ThreadLocal(); - - private final ThreadLocal heapsize = new ThreadLocal(); - - PrintStreamTracer(String channel) { - this(channel, System.out); - } - - PrintStreamTracer(String channel, PrintStream out) { - this.channel = channel; - this.out = out; - } - - public boolean isEnabled() { - return true; - } - - public void trace(String message) { - StringBuffer sb = new StringBuffer(); - sb.append('[').append(channel).append("] ").append(message); //$NON-NLS-1$ - out.println(sb); - } - - private void trace(String message, Object[] params) { - trace(MessageFormat.format(message, params)); - } - - public void trace(String message, Object param1) { - trace(message, new Object[] { param1 }); - } - - public void trace(String message, Object param1, Object param2) { - trace(message, new Object[] { param1, param2 }); - } - - public void trace(String message, Object param1, Object param2, - Object param3) { - trace(message, new Object[] { param1, param2, param3 }); - } - - public void startTimer() { - starttime.set(new Long(System.currentTimeMillis())); - } - - public void stopTimer(String message) { - Long start = (Long) starttime.get(); - if (start == null) { - trace("Timer {0} not startet.", message); //$NON-NLS-1$ - } else { - long time = System.currentTimeMillis() - start.longValue(); - trace("{0} ms for {1}", new Object[] { new Long(time), message }); //$NON-NLS-1$ - } - } - - public void startMemoryUsage() { - Runtime rt = Runtime.getRuntime(); - heapsize.set(new Long(rt.totalMemory() - rt.freeMemory())); - } - - public void stopMemoryUsage(String message) { - Long start = (Long) heapsize.get(); - if (start == null) { - trace("Memory usage for {0} not started.", message); //$NON-NLS-1$ - } else { - Runtime rt = Runtime.getRuntime(); - long bytes = rt.totalMemory() - rt.freeMemory() - start.longValue(); - trace("{0} bytes for {1}", new Object[] { new Long(bytes), message }); //$NON-NLS-1$ - } - } - } - - private static final String KEYPREFIX_DEBUG = EclEmmaCorePlugin.ID - + "/debug/"; //$NON-NLS-1$ - - private static final String KEY_EMMAVERBOSITYLEVEL = KEYPREFIX_DEBUG - + "emmaVerbosityLevel"; //$NON-NLS-1$ - - private static String getOption(String key, String defaultvalue) { - String value = Platform.getDebugOption(key); - return value == null ? defaultvalue : value; - } - - private static ITracer getTracer(String channel) { - String key = KEYPREFIX_DEBUG + channel; - if (Boolean.valueOf(Platform.getDebugOption(key)).booleanValue()) { - return new PrintStreamTracer(channel); - } else { - return NUL_TRACER; - } - } - - public static final String EMMAVERBOSITYLEVEL = getOption( - KEY_EMMAVERBOSITYLEVEL, "silent"); //$NON-NLS-1$ - - public static final ITracer PERFORMANCETRACER = getTracer("performance"); //$NON-NLS-1$ - - public static final ITracer INSTRUMENTATIONTRACER = getTracer("instrumentation"); //$NON-NLS-1$ - - public static final ITracer LAUNCHINGTRACER = getTracer("launching"); //$NON-NLS-1$ - - public static final ITracer ANALYSISTRACER = getTracer("analysis"); //$NON-NLS-1$ - -} diff --git a/com.mountainminds.eclemma.core/src/com/mountainminds/eclemma/internal/core/EclEmmaCorePlugin.java b/com.mountainminds.eclemma.core/src/com/mountainminds/eclemma/internal/core/EclEmmaCorePlugin.java deleted file mode 100644 index 8ac4b81..0000000 --- a/com.mountainminds.eclemma.core/src/com/mountainminds/eclemma/internal/core/EclEmmaCorePlugin.java +++ /dev/null @@ -1,263 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2009 Mountainminds GmbH & Co. KG - * This software is provided under the terms of the Eclipse Public License v1.0 - * See http://www.eclipse.org/legal/epl-v10.html. - * - * $Id$ - ******************************************************************************/ -package com.mountainminds.eclemma.internal.core; - -import java.text.MessageFormat; -import java.util.Date; - -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.IStatus; -import org.eclipse.core.runtime.Path; -import org.eclipse.core.runtime.Plugin; -import org.eclipse.core.runtime.Status; -import org.eclipse.debug.core.DebugEvent; -import org.eclipse.debug.core.DebugPlugin; -import org.eclipse.debug.core.IDebugEventSetListener; -import org.eclipse.debug.core.ILaunch; -import org.eclipse.debug.core.ILaunchListener; -import org.eclipse.debug.core.IStatusHandler; -import org.eclipse.debug.core.model.IProcess; -import org.eclipse.jdt.core.ElementChangedEvent; -import org.eclipse.jdt.core.IElementChangedListener; -import org.eclipse.jdt.core.IJavaProject; -import org.eclipse.jdt.core.JavaCore; -import org.eclipse.jdt.core.JavaModelException; -import org.osgi.framework.BundleContext; - -import com.mountainminds.eclemma.core.CoverageTools; -import com.mountainminds.eclemma.core.EclEmmaStatus; -import com.mountainminds.eclemma.core.IClassFiles; -import com.mountainminds.eclemma.core.ICorePreferences; -import com.mountainminds.eclemma.core.ICoverageSession; -import com.mountainminds.eclemma.core.ISessionManager; -import com.mountainminds.eclemma.core.launching.ICoverageLaunchInfo; -import com.mountainminds.eclemma.internal.core.instr.ClassFilesStore; -import com.mountainminds.eclemma.internal.core.instr.DefaultInstrumentationFilter; - -/** - * Bundle activator for the EclEmma core. - * - * @author Marc R. Hoffmann - * @version $Revision$ - */ -public class EclEmmaCorePlugin extends Plugin { - - public static final String ID = "com.mountainminds.eclemma.core"; //$NON-NLS-1$ - - /** Status used to trigger user prompts */ - private static final IStatus PROMPT_STATUS = new Status(IStatus.INFO, - "org.eclipse.debug.ui", 200, "", null); //$NON-NLS-1$//$NON-NLS-2$ - - public static final IPath EMMA_JAR = new Path("/emma.jar"); //$NON-NLS-1$ - - private static EclEmmaCorePlugin instance; - - private ICorePreferences preferences = ICorePreferences.DEFAULT; - - private ISessionManager sessionManager; - - private JavaCoverageLoader coverageLoader; - - private StateFiles stateFiles; - - private ClassFilesStore allClassFiles = null; - - private ILaunchListener launchListener = new ILaunchListener() { - public void launchRemoved(ILaunch launch) { - if (preferences.getAutoRemoveSessions()) { - sessionManager.removeSession(launch); - } - } - - public void launchAdded(ILaunch launch) { - } - - public void launchChanged(ILaunch launch) { - } - }; - - private IDebugEventSetListener debugListener = new IDebugEventSetListener() { - public void handleDebugEvents(DebugEvent[] events) { - for (int i = 0; i < events.length; i++) { - DebugEvent e = events[i]; - if (e.getSource() instanceof IProcess - && e.getKind() == DebugEvent.TERMINATE) { - IProcess proc = (IProcess) e.getSource(); - final ILaunch launch = proc.getLaunch(); - ICoverageLaunchInfo info = CoverageTools.getLaunchInfo(launch); - if (info != null) { - IPath coveragedatafile = info.getCoverageFile(); - if (checkCoverageDataFile(coveragedatafile)) { - Object[] args = new Object[] { - launch.getLaunchConfiguration().getName(), new Date() }; - String description = MessageFormat.format( - CoreMessages.LaunchSessionDescription_value, args); - ICoverageSession session = new CoverageSession(description, info - .getInstrumentations(), new IPath[] { coveragedatafile }, - launch.getLaunchConfiguration()); - sessionManager.addSession(session, preferences - .getActivateNewSessions(), launch); - } - info.dispose(); - } - } - } - } - - private boolean checkCoverageDataFile(IPath path) { - boolean ok = path.toFile().exists(); - if (!ok) { - try { - showPrompt(EclEmmaStatus.NO_COVERAGE_DATA_ERROR.getStatus(), path); - } catch (CoreException e) { - getLog().log(e.getStatus()); - } - } - return ok; - } - }; - - private IElementChangedListener elementListener = new IElementChangedListener() { - public void elementChanged(ElementChangedEvent event) { - synchronized (EclEmmaCorePlugin.this) { - allClassFiles = null; - } - } - }; - - public void start(BundleContext context) throws Exception { - super.start(context); - sessionManager = new SessionManager(); - coverageLoader = new JavaCoverageLoader(sessionManager); - stateFiles = new StateFiles(getStateLocation()); - stateFiles.deleteTemporaryFiles(); - DebugPlugin.getDefault().getLaunchManager().addLaunchListener( - launchListener); - DebugPlugin.getDefault().addDebugEventListener(debugListener); - JavaCore.addElementChangedListener(elementListener); - instance = this; - } - - public void stop(BundleContext context) throws Exception { - instance = null; - stateFiles.deleteTemporaryFiles(); - JavaCore.removeElementChangedListener(elementListener); - DebugPlugin.getDefault().removeDebugEventListener(debugListener); - DebugPlugin.getDefault().getLaunchManager().removeLaunchListener( - launchListener); - stateFiles = null; - coverageLoader.dispose(); - coverageLoader = null; - sessionManager = null; - super.stop(context); - } - - public static EclEmmaCorePlugin getInstance() { - return instance; - } - - public void setPreferences(ICorePreferences preferences) { - this.preferences = preferences; - } - - /** - * Returns a new filter instance for default selection of instrumemted - * classes. - * - * @return new filter - */ - public DefaultInstrumentationFilter createDefaultIntrumentationFilter() { - return new DefaultInstrumentationFilter(this.preferences); - } - - public ISessionManager getSessionManager() { - return sessionManager; - } - - public JavaCoverageLoader getJavaCoverageLoader() { - return coverageLoader; - } - - public StateFiles getStateFiles() { - return stateFiles; - } - - /** - * Issues an user prompt using the statis handler registered for the given - * status. - * - * @param status - * IStatus object to find prompter for - * @param info - * addional information passed to the handler - * @return boolean result returned by the status handler - * @throws CoreException - * if the status has severity error and no handler is available - */ - public boolean showPrompt(IStatus status, Object info) throws CoreException { - IStatusHandler prompter = DebugPlugin.getDefault().getStatusHandler( - PROMPT_STATUS); - if (prompter == null) { - if (status.getSeverity() == IStatus.ERROR) { - throw new CoreException(status); - } else { - return true; - } - } else { - return ((Boolean) prompter.handleStatus(status, info)).booleanValue(); - } - } - - /** - * Tries to find the absolute path for the given workspace relative path. - * - * @param path - * workspace relative path to resolve - * @return absolute path - */ - public static IPath getAbsolutePath(IPath path) { - if (path.getDevice() == null) { - IResource res = ResourcesPlugin.getWorkspace().getRoot().findMember(path); - if (res != null) { - return res.getLocation(); - } - } - return path; - } - - /** - * Calculates the list of IClassFiles for the given Java project. Basically - * for every separate output location a entry will be returned. - * - * @param project - * Java project to calculate IClassFiles for - * @return aArray of IClassFiles objects - * @throws JavaModelException - * thrown when a problem with the underlying Java model occures - */ - public static IClassFiles[] getClassFiles(IJavaProject project) - throws JavaModelException { - final ClassFilesStore store = new ClassFilesStore(); - store.add(project); - return store.getClassFiles(); - } - - public ClassFilesStore getAllClassFiles() throws CoreException { - ClassFilesStore store = allClassFiles; - if (store == null) { - store = new ClassFilesStore(); - store.add(JavaCore.create(ResourcesPlugin.getWorkspace().getRoot())); - allClassFiles = store; - } - return store; - } - -} diff --git a/com.mountainminds.eclemma.core/src/com/mountainminds/eclemma/internal/core/EclipseVersion.java b/com.mountainminds.eclemma.core/src/com/mountainminds/eclemma/internal/core/EclipseVersion.java deleted file mode 100644 index 80fdd83..0000000 --- a/com.mountainminds.eclemma.core/src/com/mountainminds/eclemma/internal/core/EclipseVersion.java +++ /dev/null @@ -1,45 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Mountainminds GmbH & Co. KG - * This software is provided under the terms of the Eclipse Public License v1.0 - * See http://www.eclipse.org/legal/epl-v10.html. - * - * $Id$ - ******************************************************************************/ -package com.mountainminds.eclemma.internal.core; - -import org.eclipse.core.runtime.Platform; -import org.osgi.framework.Bundle; -import org.osgi.framework.Version; - -/** - * Some constants to behave version specific in some situations. Unfortunately - * this is necessary as EclEmma works on multiple Eclipse versions and relies on - * internal implementation details. - * - * @author Marc R. Hoffmann - * @version $Revision$ - */ -public class EclipseVersion { - - public static final Version CURRENT; - - public static final Version V320 = new Version("3.2.0"); //$NON-NLS-1$ - - /** - * Checks whether the current platform version is greater or equal than the - * given version. - * - * @param version version to compare to - * @return true, if the current version is greater or equal than the given one - */ - public static boolean isGreaterOrEqualTo(Version version) { - return CURRENT.compareTo(version) >= 0; - } - - static { - Bundle rt = Platform.getBundle(Platform.PI_RUNTIME); - String version = (String) rt.getHeaders().get(org.osgi.framework.Constants.BUNDLE_VERSION); - CURRENT = new Version(version); - } - -} diff --git a/com.mountainminds.eclemma.core/src/com/mountainminds/eclemma/internal/core/JavaCoverageLoader.java b/com.mountainminds.eclemma.core/src/com/mountainminds/eclemma/internal/core/JavaCoverageLoader.java deleted file mode 100644 index 6a92576..0000000 --- a/com.mountainminds.eclemma.core/src/com/mountainminds/eclemma/internal/core/JavaCoverageLoader.java +++ /dev/null @@ -1,133 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Mountainminds GmbH & Co. KG - * This software is provided under the terms of the Eclipse Public License v1.0 - * See http://www.eclipse.org/legal/epl-v10.html. - * - * $Id$ - ******************************************************************************/ -package com.mountainminds.eclemma.internal.core; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Platform; -import org.eclipse.core.runtime.Status; -import org.eclipse.core.runtime.jobs.Job; -import org.eclipse.osgi.util.NLS; - -import com.mountainminds.eclemma.core.ICoverageSession; -import com.mountainminds.eclemma.core.ISessionListener; -import com.mountainminds.eclemma.core.ISessionManager; -import com.mountainminds.eclemma.core.analysis.IJavaCoverageListener; -import com.mountainminds.eclemma.core.analysis.IJavaModelCoverage; -import com.mountainminds.eclemma.internal.core.analysis.SessionAnalyzer; - -/** - * Internal utility class that loads the coverage data asynchronously, holds the - * current {@link IJavaModelCoverage} object and sends out events in case of - * changed coverage information. - * - * @author Marc R. Hoffmann - * @version $Revision$ - */ -public class JavaCoverageLoader { - - private final ISessionManager sessionManager; - - private ICoverageSession activeSession; - - private IJavaModelCoverage coverage; - - private final List listeners = new ArrayList(); - - private ISessionListener sessionListener = new ISessionListener() { - - public void sessionActivated(ICoverageSession session) { - activeSession = session; - // TODO Looks like this has no effect - Platform.getJobManager().cancel(LOADJOB); - if (session == null) { - coverage = null; - fireCoverageChanged(); - } else { - coverage = IJavaModelCoverage.LOADING; - fireCoverageChanged(); - new LoadSessionJob(activeSession).schedule(); - } - } - - public void sessionAdded(ICoverageSession addedSession) { - } - - public void sessionRemoved(ICoverageSession removedSession) { - } - - }; - - private static final Object LOADJOB = new Object(); - - private class LoadSessionJob extends Job { - - private final ICoverageSession session; - - public LoadSessionJob(ICoverageSession session) { - super(NLS.bind(CoreMessages.AnalyzingCoverageSession_task, session.getDescription())); - this.session = session; - } - - protected IStatus run(IProgressMonitor monitor) { - IJavaModelCoverage c; - try { - c = new SessionAnalyzer().processSession(session, monitor); - } catch (CoreException e) { - return e.getStatus(); - } - coverage = monitor.isCanceled() ? null : c; - fireCoverageChanged(); - return Status.OK_STATUS; - } - - public boolean belongsTo(Object family) { - return family == LOADJOB; - } - - }; - - public JavaCoverageLoader(ISessionManager sessionManager) { - this.sessionManager = sessionManager; - sessionManager.addSessionListener(sessionListener); - } - - public void addJavaCoverageListener(IJavaCoverageListener l) { - if (l == null) - throw new NullPointerException(); - if (!listeners.contains(l)) { - listeners.add(l); - } - } - - public void removeJavaCoverageListener(IJavaCoverageListener l) { - listeners.remove(l); - } - - protected void fireCoverageChanged() { - // avoid concurrent modification issues - Iterator i = new ArrayList(listeners).iterator(); - while (i.hasNext()) { - ((IJavaCoverageListener) i.next()).coverageChanged(); - } - } - - public IJavaModelCoverage getJavaModelCoverage() { - return coverage; - } - - public void dispose() { - sessionManager.removeSessionListener(sessionListener); - } - -} diff --git a/com.mountainminds.eclemma.core/src/com/mountainminds/eclemma/internal/core/SessionExporter.java b/com.mountainminds.eclemma.core/src/com/mountainminds/eclemma/internal/core/SessionExporter.java deleted file mode 100644 index 165b232..0000000 --- a/com.mountainminds.eclemma.core/src/com/mountainminds/eclemma/internal/core/SessionExporter.java +++ /dev/null @@ -1,165 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Mountainminds GmbH & Co. KG - * This software is provided under the terms of the Eclipse Public License v1.0 - * See http://www.eclipse.org/legal/epl-v10.html. - * - * $Id$ - ******************************************************************************/ -package com.mountainminds.eclemma.internal.core; - -import java.io.File; -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; -import java.util.Properties; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.SubProgressMonitor; -import org.eclipse.osgi.util.NLS; - -import com.mountainminds.eclemma.core.EclEmmaStatus; -import com.mountainminds.eclemma.core.ICoverageSession; -import com.mountainminds.eclemma.core.IInstrumentation; -import com.mountainminds.eclemma.core.ISessionExporter; -import com.mountainminds.eclemma.core.ISourceLocation; -import com.vladium.emma.data.DataFactory; -import com.vladium.emma.data.ICoverageData; -import com.vladium.emma.data.IMergeable; -import com.vladium.emma.data.IMetaData; -import com.vladium.emma.data.ISessionData; -import com.vladium.emma.data.SessionData; -import com.vladium.emma.report.IReportProperties; -import com.vladium.emma.report.ReportProcessor; - -/** - * Implementation of ISessionExporter. - * - * @author Marc R. Hoffmann - * @version $Revision$ - */ -public class SessionExporter implements ISessionExporter { - - private static final String PROP_OUT_FILE = IReportProperties.PREFIX + IReportProperties.OUT_FILE; - private static final String PROP_OUT_ENCODING = IReportProperties.PREFIX + IReportProperties.OUT_ENCODING; - - private static final String OUTPUT_ENCODING = "UTF-8"; //$NON-NLS-1$ - - private final ICoverageSession session; - private int format; - private String destination; - private Properties options; - - public SessionExporter(ICoverageSession session) { - this.session = session; - } - - public void setFormat(int format) { - this.format = format; - } - - public void setDestination(String filename) { - this.destination = filename; - } - - public void setReportOptions(Properties options) { - this.options = options; - } - - public void export(IProgressMonitor monitor) throws CoreException { - if (format == EMMA_FORMAT) { - createSessionFile(monitor); - } else { - createReport(monitor); - } - } - - private void createReport(IProgressMonitor monitor) throws CoreException { - IInstrumentation[] instrs = session.getInstrumentations(); - IPath[] coveragefiles = session.getCoverageDataFiles(); - monitor.beginTask(NLS.bind(CoreMessages.ExportingSession_task, session.getDescription()), - instrs.length + coveragefiles.length + 1); - List datapath = new ArrayList(); - List sourcepath = new ArrayList(); - for (int i = 0; i < instrs.length; i++) { - if (instrs[i].getMetaDataFile().toFile().exists()) { - datapath.add(instrs[i].getMetaDataFile().toOSString()); - if (format == HTML_FORMAT) { - ISourceLocation[] srcs = instrs[i].getClassFiles().getSourceLocations(); - IProgressMonitor srcmonitor = new SubProgressMonitor(monitor, 1); - srcmonitor.beginTask("", srcs.length); //$NON-NLS-1$ - for (int j = 0; j < srcs.length; j++) { - srcs[j].extract(new SubProgressMonitor(srcmonitor, 1)); - sourcepath.add(srcs[j].getPath().toOSString()); - } - srcmonitor.done(); - } else { - monitor.worked(1); - } - } else { - monitor.worked(1); - } - } - for (int i = 0; i < coveragefiles.length; i++) { - datapath.add(coveragefiles[i].toOSString()); - monitor.worked(1); - } - ReportProcessor processor = ReportProcessor.create(); - processor.setDataPath((String[]) datapath.toArray(new String[0])); - processor.setSourcePath((String[]) sourcepath.toArray(new String[0])); - processor.setReportTypes(new String[] { DEFAULT_EXTENSIONS[format] }); - Properties props = new Properties(options); - props.setProperty(PROP_OUT_FILE, destination); - props.setProperty(PROP_OUT_ENCODING, OUTPUT_ENCODING); - processor.setPropertyOverrides(props); - processor.run(); - monitor.done(); - } - - private void createSessionFile(IProgressMonitor monitor) throws CoreException { - IInstrumentation[] instrs = session.getInstrumentations(); - IPath[] coveragefiles = session.getCoverageDataFiles(); - monitor.beginTask(NLS.bind(CoreMessages.ExportingSession_task, session.getDescription()), - instrs.length + coveragefiles.length + 1); - IMergeable metadata = null; - for (int i = 0; i < instrs.length; i++) { - metadata = loadDataFile(metadata, DataFactory.TYPE_METADATA, instrs[i].getMetaDataFile()); - monitor.worked(1); - } - IMergeable coveragedata = null; - for (int i = 0; i < coveragefiles.length; i++) { - coveragedata = loadDataFile(coveragedata, DataFactory.TYPE_COVERAGEDATA, coveragefiles[i]); - monitor.worked(1); - } - ISessionData sessiondata = new SessionData((IMetaData) metadata, (ICoverageData) coveragedata); - try { - DataFactory.persist(sessiondata, new File(destination), false); - } catch (IOException e) { - throw new CoreException(EclEmmaStatus.COVERAGEDATA_FILE_READ_ERROR - .getStatus(destination, e)); - } - monitor.done(); - } - - private IMergeable loadDataFile(IMergeable data, int type, IPath path) - throws CoreException { - try { - File f = path.toFile(); - if (f.exists()) { - IMergeable newdata = DataFactory.load(f)[type]; - data = data == null ? newdata : data.merge(newdata); - } - return data; - } catch (IOException e) { - if (type == DataFactory.TYPE_COVERAGEDATA) { - throw new CoreException(EclEmmaStatus.COVERAGEDATA_FILE_READ_ERROR - .getStatus(path, e)); - } else { - throw new CoreException(EclEmmaStatus.METADATA_FILE_READ_ERROR - .getStatus(path, e)); - } - } - } - -} diff --git a/com.mountainminds.eclemma.core/src/com/mountainminds/eclemma/internal/core/SessionImporter.java b/com.mountainminds.eclemma.core/src/com/mountainminds/eclemma/internal/core/SessionImporter.java deleted file mode 100644 index 8e030c6..0000000 --- a/com.mountainminds.eclemma.core/src/com/mountainminds/eclemma/internal/core/SessionImporter.java +++ /dev/null @@ -1,142 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Mountainminds GmbH & Co. KG - * This software is provided under the terms of the Eclipse Public License v1.0 - * See http://www.eclipse.org/legal/epl-v10.html. - * - * $Id$ - ******************************************************************************/ -package com.mountainminds.eclemma.internal.core; - -import java.io.File; -import java.io.FileInputStream; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.Path; -import org.eclipse.core.runtime.SubProgressMonitor; - -import com.mountainminds.eclemma.core.CoverageTools; -import com.mountainminds.eclemma.core.EclEmmaStatus; -import com.mountainminds.eclemma.core.IClassFiles; -import com.mountainminds.eclemma.core.ICoverageSession; -import com.mountainminds.eclemma.core.IInstrumentation; -import com.mountainminds.eclemma.core.ISessionImporter; - -/** - * Implementation of ISessionImporter. - * - * @author Marc R. Hoffmann - * @version $Revision$ - */ -public class SessionImporter implements ISessionImporter { - - private String description; - private String coveragefile; - private IClassFiles[] classfiles; - private boolean copy; - private boolean useImportedMetaData; - - public void setDescription(String description) { - this.description = description; - } - - public void setCoverageFile(String file) { - this.coveragefile = file; - } - - public void setClassFiles(IClassFiles[] classfiles) { - this.classfiles = classfiles; - } - - public void setCopy(boolean copy) { - this.copy = copy; - } - - public void setUseImportedMetaData(boolean flag) { - this.useImportedMetaData = flag; - } - - public void importSession(IProgressMonitor monitor) throws CoreException { - monitor.beginTask(CoreMessages.ImportingSession_task, 2); - IInstrumentation[] instr = instrument(new SubProgressMonitor(monitor, 1)); - IPath[] cfiles = new IPath[1]; - cfiles[0] = createCopy(new SubProgressMonitor(monitor, 1)); - ICoverageSession s = CoverageTools.createCoverageSession(description, instr, cfiles, null); - CoverageTools.getSessionManager().addSession(s, true, null); - monitor.done(); - } - - private IInstrumentation[] instrument(IProgressMonitor monitor) throws CoreException { - monitor.beginTask("", classfiles.length); //$NON-NLS-1$ - IInstrumentation[] instr = new IInstrumentation[classfiles.length]; - for (int i = 0; i < classfiles.length; i++) { - if (useImportedMetaData) { - instr[i] = new ExternalInstrumentation(classfiles[i], coveragefile); - monitor.worked(1); - } else { - instr[i] = classfiles[i].instrument(false, new SubProgressMonitor(monitor, 1)); - } - } - monitor.done(); - return instr; - } - - private IPath createCopy(IProgressMonitor monitor) throws CoreException { - IPath file = Path.fromOSString(coveragefile); - if (copy) { - file = EclEmmaCorePlugin.getInstance().getStateFiles().getImportSessionFile(file); - File source = new File(coveragefile); - monitor.beginTask("", (int) source.length()); //$NON-NLS-1$ - byte[] buffer = new byte[0x1000]; - try { - InputStream in = new FileInputStream(source); - OutputStream out = new FileOutputStream(file.toFile()); - int l; - while ((l = in.read(buffer)) != -1) { - out.write(buffer, 0, l); - monitor.worked(l); - } - in.close(); - out.close(); - } catch (IOException e) { - throw new CoreException(EclEmmaStatus.IMPORT_ERROR.getStatus(e)); - } - } - monitor.done(); - return file; - } - - private static class ExternalInstrumentation implements IInstrumentation { - - private final IClassFiles classfiles; - private final IPath metaDataFile; - - ExternalInstrumentation(IClassFiles classfiles, String metaDataFile) { - this.classfiles = classfiles; - this.metaDataFile = Path.fromOSString(metaDataFile); - } - - public IClassFiles getClassFiles() { - return classfiles; - } - - public IPath getMetaDataFile() { - return metaDataFile; - } - - public IPath getOutputLocation() { - throw new UnsupportedOperationException("Unsupported for imported sessions."); //$NON-NLS-1$ - } - - public boolean isInplace() { - throw new UnsupportedOperationException("Unsupported for imported sessions."); //$NON-NLS-1$ - } - - } - -} diff --git a/com.mountainminds.eclemma.core/src/com/mountainminds/eclemma/internal/core/SessionManager.java b/com.mountainminds.eclemma.core/src/com/mountainminds/eclemma/internal/core/SessionManager.java deleted file mode 100644 index 9b1b0e7..0000000 --- a/com.mountainminds.eclemma.core/src/com/mountainminds/eclemma/internal/core/SessionManager.java +++ /dev/null @@ -1,150 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Mountainminds GmbH & Co. KG - * This software is provided under the terms of the Eclipse Public License v1.0 - * See http://www.eclipse.org/legal/epl-v10.html. - * - * $Id$ - ******************************************************************************/ -package com.mountainminds.eclemma.internal.core; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map; - -import com.mountainminds.eclemma.core.ICoverageSession; -import com.mountainminds.eclemma.core.ISessionListener; -import com.mountainminds.eclemma.core.ISessionManager; - -/** - * ISessionManager implementation. - * - * @author Marc R. Hoffmann - * @version $Revision$ - */ -public class SessionManager implements ISessionManager { - - private List sessions = new ArrayList(); - private Map keymap = new HashMap(); - private ICoverageSession activeSession = null; - private List listeners = new ArrayList(); - - public void addSession(ICoverageSession session, boolean activate, Object key) { - if (session == null) throw new NullPointerException(); - if (!sessions.contains(session)) { - sessions.add(session); - if (key != null) { - keymap.put(key, session); - } - fireSessionAdded(session); - if (activate) { - activeSession = session; - fireSessionActivated(session); - } - } - } - - public void removeSession(ICoverageSession session) { - if (sessions.contains(session)) { - boolean sessionActivated = false; - if (session.equals(activeSession)) { - activeSession = null; - for (int i = sessions.size(); --i >= 0;) { - if (!session.equals(sessions.get(i))) { - activeSession = (ICoverageSession) sessions.get(i); - break; - } - } - sessionActivated = true; - } - sessions.remove(session); - keymap.values().remove(session); - fireSessionRemoved(session); - if (sessionActivated) { - fireSessionActivated(activeSession); - } - } - } - - public void removeSession(Object key) { - removeSession(getSession(key)); - } - - public void removeAllSessions() { - while (!sessions.isEmpty()) { - ICoverageSession session = (ICoverageSession) sessions.remove(0); - keymap.values().remove(session); - fireSessionRemoved(session); - } - if (activeSession != null) { - activeSession = null; - fireSessionActivated(null); - } - } - - public ICoverageSession[] getSessions() { - return (ICoverageSession[]) sessions.toArray(new ICoverageSession[sessions.size()]); - } - - public ICoverageSession getSession(Object key) { - return (ICoverageSession) keymap.get(key); - } - - public void activateSession(ICoverageSession session) { - if (sessions.contains(session) && !session.equals(activeSession)) { - activeSession = session; - fireSessionActivated(session); - } - } - - public void activateSession(Object key) { - activateSession(getSession(key)); - } - - public ICoverageSession getActiveSession() { - return activeSession; - } - - public void refreshActiveSession() { - if (activeSession != null) { - fireSessionActivated(activeSession); - } - } - - public void addSessionListener(ISessionListener listener) { - if (listener == null) throw new NullPointerException(); - if (!listeners.contains(listener)) { - listeners.add(listener); - } - } - - public void removeSessionListener(ISessionListener listener) { - listeners.remove(listener); - } - - protected void fireSessionAdded(ICoverageSession session) { - // avoid concurrent modification issues - Iterator i = new ArrayList(listeners).iterator(); - while (i.hasNext()) { - ((ISessionListener) i.next()).sessionAdded(session); - } - } - - protected void fireSessionRemoved(ICoverageSession session) { - // avoid concurrent modification issues - Iterator i = new ArrayList(listeners).iterator(); - while (i.hasNext()) { - ((ISessionListener) i.next()).sessionRemoved(session); - } - } - - private void fireSessionActivated(ICoverageSession session) { - // avoid concurrent modification issues - Iterator i = new ArrayList(listeners).iterator(); - while (i.hasNext()) { - ((ISessionListener) i.next()).sessionActivated(session); - } - } - -} diff --git a/com.mountainminds.eclemma.core/src/com/mountainminds/eclemma/internal/core/StateFiles.java b/com.mountainminds.eclemma.core/src/com/mountainminds/eclemma/internal/core/StateFiles.java deleted file mode 100644 index de7444a..0000000 --- a/com.mountainminds.eclemma.core/src/com/mountainminds/eclemma/internal/core/StateFiles.java +++ /dev/null @@ -1,169 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Mountainminds GmbH & Co. KG - * This software is provided under the terms of the Eclipse Public License v1.0 - * See http://www.eclipse.org/legal/epl-v10.html. - * - * $Id$ - ******************************************************************************/ -package com.mountainminds.eclemma.internal.core; - -import java.io.File; -import java.io.UnsupportedEncodingException; -import java.lang.ref.PhantomReference; -import java.lang.ref.ReferenceQueue; -import java.security.MessageDigest; -import java.security.NoSuchAlgorithmException; -import java.util.HashSet; -import java.util.Set; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IPath; - -import com.mountainminds.eclemma.core.EclEmmaStatus; - -/** - * Internal utility to manage files in the plugin's state locations. - * - * @author Marc R. Hoffmann - * @version $Revision$ - */ -public class StateFiles { - - private static final String LAUNCHDATA_FOLDER = ".launch/"; //$NON-NLS-1$ - - private static final String INSTRDATA_FOLDER = ".instr/"; //$NON-NLS-1$ - - private static final String IMPORTDATA_FOLDER = ".import/"; //$NON-NLS-1$ - - private static final String SOURCE_FOLDER = ".src/"; //$NON-NLS-1$ - - private static final ReferenceQueue CLEANUPQUEUE = new ReferenceQueue(); - - private static final Set CLEANUPFILES = new HashSet(); - - - private final IPath stateLocation; - - public StateFiles(IPath stateLocation) { - this.stateLocation = stateLocation; - this.stateLocation.toFile().mkdirs(); - getLaunchDataFolder().toFile().mkdirs(); - getInstrDataFolder().toFile().mkdirs(); - getSourceDataFolder().toFile().mkdirs(); - getImportDataFolder().toFile().mkdirs(); - } - - public void deleteTemporaryFiles() { - deleteFiles(getLaunchDataFolder().toFile(), false); - deleteFiles(getInstrDataFolder().toFile(), false); - deleteFiles(getSourceDataFolder().toFile(), false); - deleteFiles(getImportDataFolder().toFile(), false); - } - - private static void deleteFiles(File file, boolean deleteparent) { - if (file.isDirectory()) { - File[] files = file.listFiles(); - for (int i = 0; files != null && i < files.length; i++) { - deleteFiles(files[i], true); - } - } - if (deleteparent) file.delete(); - } - - public IPath getLaunchDataFolder() { - return stateLocation.append(LAUNCHDATA_FOLDER); - } - - private IPath getInstrDataFolder() { - return stateLocation.append(INSTRDATA_FOLDER); - } - - public IPath getInstrDataFolder(IPath location) throws CoreException { - return getInstrDataFolder().append(getInternalId(location, false)); - } - - private IPath getSourceDataFolder() { - return stateLocation.append(SOURCE_FOLDER); - } - - public IPath getSourceFolder(IPath location) throws CoreException { - return getSourceDataFolder().append(getInternalId(location, true)); - } - - private IPath getImportDataFolder() { - return stateLocation.append(IMPORTDATA_FOLDER); - } - - public IPath getImportSessionFile(IPath original) throws CoreException { - IPath p = getImportDataFolder().append(getInternalId(original, true)); - registerForCleanup(p); - return p; - } - - private static String getInternalId(IPath location, boolean withtimestamp) throws CoreException { - long timestamp = 0; - if (withtimestamp) { - File f = location.toFile(); - if (f.exists()) { - timestamp = f.lastModified(); - } - } - StringBuffer sb = new StringBuffer(); - try { - MessageDigest md = MessageDigest.getInstance("MD5"); //$NON-NLS-1$ - md.update(location.toString().getBytes("UTF8")); //$NON-NLS-1$ - md.update(Long.toHexString(timestamp).getBytes("UTF8")); //$NON-NLS-1$ - byte[] sig = md.digest(); - for (int i = 0; i < sig.length; i++) { - sb.append(Character.forDigit((sig[i] >> 4) & 0xf, 0x10)); - sb.append(Character.forDigit(sig[i] & 0xf, 0x10)); - } - } catch (NoSuchAlgorithmException e) { - throw new CoreException(EclEmmaStatus.ID_CREATION_ERROR.getStatus(e)); - } catch (UnsupportedEncodingException e) { - throw new CoreException(EclEmmaStatus.ID_CREATION_ERROR.getStatus(e)); - } - return sb.toString(); - } - - /** - * Registers the file the given path points to for deletion as soon as the - * reference to the path objects gets garbage collected. The caller must - * ensure to hold a reference to the given path object as long as the file - * is required. The file is not required to (jet) actually exist. - * - * @param file path object that points to the file - */ - public void registerForCleanup(IPath file) { - cleanupObsoleteFiles(); - CLEANUPFILES.add(new CleanupFile(file)); - } - - private void cleanupObsoleteFiles() { - while (true) { - CleanupFile f = (CleanupFile) CLEANUPQUEUE.poll(); - if (f == null) { - break; - } - CLEANUPFILES.remove(f); - f.delete(); - } - } - - private static class CleanupFile extends PhantomReference { - - private final File file; - - public CleanupFile(IPath path) { - super(path, CLEANUPQUEUE); - this.file = path.toFile(); - } - - public void delete() { - deleteFiles(file, true); - clear(); - } - - } - -} diff --git a/com.mountainminds.eclemma.core/src/com/mountainminds/eclemma/internal/core/analysis/Counter.java b/com.mountainminds.eclemma.core/src/com/mountainminds/eclemma/internal/core/analysis/Counter.java deleted file mode 100644 index 8e74ec6..0000000 --- a/com.mountainminds.eclemma.core/src/com/mountainminds/eclemma/internal/core/analysis/Counter.java +++ /dev/null @@ -1,149 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Mountainminds GmbH & Co. KG - * This software is provided under the terms of the Eclipse Public License v1.0 - * See http://www.eclipse.org/legal/epl-v10.html. - * - * $Id$ - ******************************************************************************/ -package com.mountainminds.eclemma.internal.core.analysis; - -import com.mountainminds.eclemma.core.analysis.ICounter; - -/** - * ICounter implementations. Implementing a factory pattern allows to share - * counter instances. - * - * @author Marc R. Hoffmann - * @version $Revision$ - */ -public abstract class Counter implements ICounter { - - /** Max counter value for which singletons are created */ - private static final int SINGLETON_LIMIT = 10; - - private static final Counter[][] SINGLETONS = new Counter[SINGLETON_LIMIT + 1][]; - - static { - for (int i = 0; i <= SINGLETON_LIMIT; i++) { - SINGLETONS[i] = new Counter[i + 1]; - for (int j = 0; j <= i; j++) - SINGLETONS[i][j] = new Fix(i, j); - } - } - - /** Constant for Counter with 0/0 values. */ - public static final Counter COUNTER_0_0 = SINGLETONS[0][0]; - - /** - * Mutable version of the counter. - */ - private static class Var extends Counter { - public Var(long total, long covered) { - super(total, covered); - } - - public Counter increment(int total, int covered) { - this.total += total; - this.covered += covered; - return this; - } - } - - /** - * Immutable version of the counter. - */ - private static class Fix extends Counter { - public Fix(long total, long covered) { - super(total, covered); - } - - public Counter increment(int total, int covered) { - return getInstance(this.total + total, this.covered + covered); - } - } - - /** - * Factory method to retrieve a counter with the given number of items. - * - * @param total - * total number of items - * @param covered - * covered number of items - * @return counter instance - */ - public static Counter getInstance(long total, long covered) { - if (total <= SINGLETON_LIMIT && covered <= total) { - return SINGLETONS[(int) total][(int) covered]; - } else { - return new Var(total, covered); - } - } - - protected long total; - protected long covered; - - protected Counter(long total, long covered) { - this.total = total; - this.covered = covered; - } - - /** - * Returns a counter with incremented values. It is up to the implementation - * whether this conter instance is modified or a new instance is returned. - * - * @param total - * number of additional total items - * @param covered - * number of additional covered items - * @return counter instance with incremented values - */ - public abstract Counter increment(int total, int covered); - - // ICounter implementation - - public long getTotalCount() { - return total; - } - - public long getCoveredCount() { - return covered; - } - - public long getMissedCount() { - return total - covered; - } - - public double getRatio() { - return (double) covered / (double) total; - } - - public int compareTo(Object obj) { - ICounter counter = (ICounter) obj; - return Double.compare(getRatio(), counter.getRatio()); - } - - public boolean equals(Object obj) { - if (obj instanceof ICounter) { - ICounter counter = (ICounter) obj; - return getTotalCount() == counter.getTotalCount() - && getCoveredCount() == counter.getCoveredCount(); - } else { - return false; - } - } - - public int hashCode() { - long t = getTotalCount(); - long c = 17 * getCoveredCount(); - return (int) (t ^ (t >>> 32) ^ c ^ (c >>> 32)); - } - - public String toString() { - StringBuffer b = new StringBuffer("Counter["); //$NON-NLS-1$ - b.append(getCoveredCount()); - b.append('/').append(getTotalCount()); - b.append(']'); - return b.toString(); - } - -} diff --git a/com.mountainminds.eclemma.core/src/com/mountainminds/eclemma/internal/core/analysis/ILazyBinding.java b/com.mountainminds.eclemma.core/src/com/mountainminds/eclemma/internal/core/analysis/ILazyBinding.java deleted file mode 100644 index ae4cd46..0000000 --- a/com.mountainminds.eclemma.core/src/com/mountainminds/eclemma/internal/core/analysis/ILazyBinding.java +++ /dev/null @@ -1,31 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Mountainminds GmbH & Co. KG - * This software is provided under the terms of the Eclipse Public License v1.0 - * See http://www.eclipse.org/legal/epl-v10.html. - * - * $Id$ - ******************************************************************************/ -package com.mountainminds.eclemma.internal.core.analysis; - -import org.eclipse.jdt.core.IJavaElement; - -/** - * This internal interface may be implemented by coverage objects. It allows - * binding its children lazily to the corresponding Java model elements. - * - * children lazily to t - * @author Marc R. Hoffmann - * @version $Revision$ - */ -public interface ILazyBinding { - - /** - * Called to bind the children of this coverage object lazily to the - * corresponding Java model elements. - * - * @param element the Java element corresponding to this coverage object - * @param modelcoverage the coverage object for the Java model itself - */ - public void resolve(IJavaElement element, JavaModelCoverage modelcoverage); - -} diff --git a/com.mountainminds.eclemma.core/src/com/mountainminds/eclemma/internal/core/analysis/ITypeVisitor.java b/com.mountainminds.eclemma.core/src/com/mountainminds/eclemma/internal/core/analysis/ITypeVisitor.java deleted file mode 100644 index 96d7039..0000000 --- a/com.mountainminds.eclemma.core/src/com/mountainminds/eclemma/internal/core/analysis/ITypeVisitor.java +++ /dev/null @@ -1,35 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Mountainminds GmbH & Co. KG - * This software is provided under the terms of the Eclipse Public License v1.0 - * See http://www.eclipse.org/legal/epl-v10.html. - * - * $Id$ - ******************************************************************************/ -package com.mountainminds.eclemma.internal.core.analysis; - -import org.eclipse.jdt.core.IType; - -/** - * Callback used by {@link TypeTraverser} to report traversed types. - * - * @author Marc R. Hoffmann - * @version $Revision$ - */ -public interface ITypeVisitor { - - /** - * Called for every type. - * - * @param type - * Java model handle - * @param binaryname - * VM name of the type (e.g. java/util/Map$Entry) - */ - public void visit(IType type, String binaryname); - - /** - * Called after all types have been visited. - */ - public void done(); - -} diff --git a/com.mountainminds.eclemma.core/src/com/mountainminds/eclemma/internal/core/analysis/JavaElementCoverage.java b/com.mountainminds.eclemma.core/src/com/mountainminds/eclemma/internal/core/analysis/JavaElementCoverage.java deleted file mode 100644 index fd3ce4b..0000000 --- a/com.mountainminds.eclemma.core/src/com/mountainminds/eclemma/internal/core/analysis/JavaElementCoverage.java +++ /dev/null @@ -1,130 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Mountainminds GmbH & Co. KG - * This software is provided under the terms of the Eclipse Public License v1.0 - * See http://www.eclipse.org/legal/epl-v10.html. - * - * $Id$ - ******************************************************************************/ -package com.mountainminds.eclemma.internal.core.analysis; - -import org.eclipse.core.resources.IResource; - -import com.mountainminds.eclemma.core.analysis.ICounter; -import com.mountainminds.eclemma.core.analysis.IJavaElementCoverage; -import com.mountainminds.eclemma.core.analysis.ILineCoverage; - -/** - * IJavaElementCoverage implementation. - * - * @author Marc R. Hoffmann - * @version $Revision$ - */ -public class JavaElementCoverage implements IJavaElementCoverage { - - private Counter typeCounter; - private Counter methodCounter; - private Counter blockCounter; - private Counter lineCounter; - private Counter instructionsCounter; - - private final JavaElementCoverage parent; - private final Lines lines; - private final long modificationStamp; - - public JavaElementCoverage(JavaElementCoverage parent, boolean haslines, - long stamp) { - this.parent = parent; - typeCounter = Counter.COUNTER_0_0; - methodCounter = Counter.COUNTER_0_0; - blockCounter = Counter.COUNTER_0_0; - instructionsCounter = Counter.COUNTER_0_0; - lineCounter = haslines ? null : Counter.COUNTER_0_0; - modificationStamp = stamp; - this.lines = haslines ? new Lines() : null; - } - - public JavaElementCoverage(JavaElementCoverage parent, boolean haslines, - IResource resource) { - this(parent, haslines, resource == null ? 0 : resource - .getModificationStamp()); - } - - public void addBlock(int instructions, int[] lines, boolean covered) { - addBlock(instructions, lines, covered, 0, 0); - } - - private void addBlock(int instructions, int[] lines, boolean covered, - int totalLineDelta, int coveredLineDelta) { - blockCounter = blockCounter.increment(1, covered ? 1 : 0); - instructionsCounter = instructionsCounter.increment(instructions, - covered ? instructions : 0); - if (this.lines == null || lines == null) { - if (lineCounter != null) { - lineCounter = lineCounter.increment(totalLineDelta, coveredLineDelta); - } - if (parent != null) { - parent.addBlock(instructions, lines, covered, totalLineDelta, - coveredLineDelta); - } - } else { - long totalDelta = this.lines.getTotalCount(); - long coveredDelta = this.lines.getCoveredCount(); - this.lines.addLines(lines, covered); - if (parent != null) { - totalDelta = this.lines.getTotalCount() - totalDelta; - coveredDelta = this.lines.getCoveredCount() - coveredDelta; - parent.addBlock(instructions, lines, covered, (int) totalDelta, - (int) coveredDelta); - } - } - } - - public void addMethod(boolean covered) { - methodCounter = methodCounter.increment(1, covered ? 1 : 0); - if (parent != null) { - parent.addMethod(covered); - } - } - - public void addType(boolean covered) { - typeCounter = typeCounter.increment(1, covered ? 1 : 0); - if (parent != null) { - parent.addType(covered); - } - } - - // IJavaElementCoverage implementation: - - public ICounter getBlockCounter() { - return blockCounter; - } - - public ICounter getLineCounter() { - if (lines == null) { - return lineCounter; - } else { - return lines; - } - } - - public ICounter getInstructionCounter() { - return instructionsCounter; - } - - public ILineCoverage getLineCoverage() { - return lines; - } - - public ICounter getMethodCounter() { - return methodCounter; - } - - public ICounter getTypeCounter() { - return typeCounter; - } - - public long getResourceModificationStamp() { - return modificationStamp; - } - -} diff --git a/com.mountainminds.eclemma.core/src/com/mountainminds/eclemma/internal/core/analysis/JavaElementCoverageAdapterFactory.java b/com.mountainminds.eclemma.core/src/com/mountainminds/eclemma/internal/core/analysis/JavaElementCoverageAdapterFactory.java deleted file mode 100644 index 88c1944..0000000 --- a/com.mountainminds.eclemma.core/src/com/mountainminds/eclemma/internal/core/analysis/JavaElementCoverageAdapterFactory.java +++ /dev/null @@ -1,56 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Mountainminds GmbH & Co. KG - * This software is provided under the terms of the Eclipse Public License v1.0 - * See http://www.eclipse.org/legal/epl-v10.html. - * - * $Id$ - ******************************************************************************/ -package com.mountainminds.eclemma.internal.core.analysis; - -import org.eclipse.core.resources.IResource; -import org.eclipse.core.runtime.IAdapterFactory; -import org.eclipse.jdt.core.IJavaElement; - -import com.mountainminds.eclemma.core.CoverageTools; -import com.mountainminds.eclemma.core.analysis.IJavaElementCoverage; -import com.mountainminds.eclemma.core.analysis.IJavaModelCoverage; -import com.mountainminds.eclemma.core.analysis.ILineCoverage; - -/** - * This factory adapts IResource and IJavaElement objects to the corresponding - * coverage information of the current session. The factory is hooked into the - * workbench through the extension point - * org.eclipse.core.runtime.adapters. - * - * @author Marc R. Hoffmann - * @version $Revision$ - */ -public class JavaElementCoverageAdapterFactory implements IAdapterFactory { - - public Object getAdapter(Object object, Class adapterType) { - // if the object is a IResource find the corresponding IJavaElement - if (object instanceof IResource) { - object = ((IResource) object).getAdapter(IJavaElement.class); - if (object == null) { - return null; - } - } - // then find the coverage information from the current session - IJavaModelCoverage mc = CoverageTools.getJavaModelCoverage(); - if (mc == null) { - return null; - } else { - IJavaElementCoverage coverage = mc.getCoverageFor((IJavaElement) object); - if (coverage != null && ILineCoverage.class.equals(adapterType)) { - return coverage.getLineCoverage(); - } else { - return coverage; - } - } - } - - public Class[] getAdapterList() { - return new Class[] { IJavaElementCoverage.class, ILineCoverage.class }; - } - -} diff --git a/com.mountainminds.eclemma.core/src/com/mountainminds/eclemma/internal/core/analysis/JavaModelCoverage.java b/com.mountainminds.eclemma.core/src/com/mountainminds/eclemma/internal/core/analysis/JavaModelCoverage.java deleted file mode 100644 index 7cea42a..0000000 --- a/com.mountainminds.eclemma.core/src/com/mountainminds/eclemma/internal/core/analysis/JavaModelCoverage.java +++ /dev/null @@ -1,107 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Mountainminds GmbH & Co. KG - * This software is provided under the terms of the Eclipse Public License v1.0 - * See http://www.eclipse.org/legal/epl-v10.html. - * - * $Id$ - ******************************************************************************/ -package com.mountainminds.eclemma.internal.core.analysis; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.eclipse.jdt.core.IJavaElement; -import org.eclipse.jdt.core.IJavaProject; -import org.eclipse.jdt.core.IPackageFragment; -import org.eclipse.jdt.core.IPackageFragmentRoot; -import org.eclipse.jdt.core.IType; - -import com.mountainminds.eclemma.core.analysis.IJavaElementCoverage; -import com.mountainminds.eclemma.core.analysis.IJavaModelCoverage; - -/** - * The IJavaModelCoverage implementation maps Java elements to its corresponding - * coverage data objects. - * - * @author Marc R. Hoffmann - * @version $Revision$ - */ -public class JavaModelCoverage extends JavaElementCoverage implements - IJavaModelCoverage { - - /** Maps Java elements to coverage objects */ - private final Map coveragemap = new HashMap(); - - /** List of all IJavaProject objects with coverage information attached */ - private final List projects = new ArrayList(); - - /** List of all IPackageFragmentRoot objects with coverage information attached */ - private final List fragmentroots = new ArrayList(); - - /** List of all IPackageFragment objects with coverage information attached */ - private final List fragments = new ArrayList(); - - /** List of all IType objects with coverage information attached */ - private final List types = new ArrayList(); - - public JavaModelCoverage() { - super(null, false, 0); - } - - public void put(IJavaElement element, IJavaElementCoverage coverage) { - coveragemap.put(element, coverage); - switch (element.getElementType()) { - case IJavaElement.JAVA_PROJECT: - projects.add(element); - break; - case IJavaElement.PACKAGE_FRAGMENT_ROOT: - fragmentroots.add(element); - break; - case IJavaElement.PACKAGE_FRAGMENT: - fragments.add(element); - break; - case IJavaElement.TYPE: - types.add(element); - break; - } - } - - // IJavaModelCoverage interface - - public IJavaProject[] getInstrumentedProjects() { - IJavaProject[] arr = new IJavaProject[projects.size()]; - return (IJavaProject[]) projects.toArray(arr); - } - - public IPackageFragmentRoot[] getInstrumentedPackageFragmentRoots() { - IPackageFragmentRoot[] arr = new IPackageFragmentRoot[fragmentroots.size()]; - return (IPackageFragmentRoot[]) fragmentroots.toArray(arr); - } - - public IPackageFragment[] getInstrumentedPackageFragments() { - IPackageFragment[] arr = new IPackageFragment[fragments.size()]; - return (IPackageFragment[]) fragments.toArray(arr); - } - - public IType[] getInstrumentedTypes() { - IType[] arr = new IType[types.size()]; - return (IType[]) types.toArray(arr); - } - - public IJavaElementCoverage getCoverageFor(IJavaElement element) { - IJavaElementCoverage c = (IJavaElementCoverage) coveragemap.get(element); - // Currently lazy binding is for methods only: - if (c == null && element.getElementType() == IJavaElement.METHOD) { - IJavaElement parent = element.getParent(); - Object parentcoverage = getCoverageFor(parent); - if (parentcoverage instanceof ILazyBinding) { - ((ILazyBinding) parentcoverage).resolve(parent, this); - } - c = (IJavaElementCoverage) coveragemap.get(element); - } - return c; - } - -} diff --git a/com.mountainminds.eclemma.core/src/com/mountainminds/eclemma/internal/core/analysis/Lines.java b/com.mountainminds.eclemma.core/src/com/mountainminds/eclemma/internal/core/analysis/Lines.java deleted file mode 100644 index d2a10e5..0000000 --- a/com.mountainminds.eclemma.core/src/com/mountainminds/eclemma/internal/core/analysis/Lines.java +++ /dev/null @@ -1,134 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Mountainminds GmbH & Co. KG - * This software is provided under the terms of the Eclipse Public License v1.0 - * See http://www.eclipse.org/legal/epl-v10.html. - * - * $Id$ - ******************************************************************************/ -package com.mountainminds.eclemma.internal.core.analysis; - -import com.mountainminds.eclemma.core.analysis.ILineCoverage; - -/** - * ILineCoverage implementation. - * - * @author Marc R. Hoffmann - * @version $Revision$ - */ -public class Lines extends Counter implements ILineCoverage { - - /** - * We always increase the size of the coverage array by multiples of this - * constant. Larger values will require more memory, a lower value will lead - * to repeated memory allocation and copy operations. - */ - private static final int BLOCK_INCREMENT = 64; - - /** Array of flags for each line */ - private byte[] coverage = null; - - private int firstline = 0; - - private int lastline = 0; - - private int offset = 0; - - protected Lines() { - super(0, 0); - } - - private int getBlockAlignedOffset(int line) { - return line - (line % BLOCK_INCREMENT); - } - - private int getBlockAlignedSize(int size) { - return size + BLOCK_INCREMENT - (size % BLOCK_INCREMENT); - } - - /** - * Updates the firstline and lastline property. If the given line falls - * outside the coverage array the array is increased accordingly. - * - * @param line - * line number to check - */ - private void ensureCapacity(int line) { - if (coverage == null) { - firstline = line; - lastline = line; - offset = getBlockAlignedOffset(line); - coverage = new byte[BLOCK_INCREMENT]; - return; - } - if (firstline > line) { - firstline = line; - if (offset > line) { - int newoffset = getBlockAlignedOffset(line); - byte[] newcoverage = new byte[coverage.length + offset - newoffset]; - System.arraycopy(coverage, 0, newcoverage, offset - newoffset, - coverage.length); - offset = newoffset; - coverage = newcoverage; - } - return; - } - if (lastline < line) { - lastline = line; - if (line - offset >= coverage.length) { - byte[] newcoverage = new byte[getBlockAlignedSize(line - offset)]; - System.arraycopy(coverage, 0, newcoverage, 0, coverage.length); - coverage = newcoverage; - } - } - } - - public void addLines(int lines[], boolean isCovered) { - for (int i = 0; i < lines.length; i++) { - int line = lines[i]; - ensureCapacity(line); - int idx = line - offset; - switch (coverage[idx]) { - case NO_CODE: - total++; - if (isCovered) - covered++; - break; - case NOT_COVERED: - if (isCovered) - covered++; - break; - } - coverage[idx] |= isCovered ? FULLY_COVERED : NOT_COVERED; - } - } - - public Counter increment(int total, int covered) { - throw new UnsupportedOperationException(); - } - - // ILineCoverage interface: - - public byte[] getCoverage() { - return coverage; - } - - public int getFirstLine() { - return firstline; - } - - public int getLastLine() { - return lastline; - } - - public int getOffset() { - return offset; - } - - public byte getCoverage(int line) { - if (coverage == null || line < firstline || line > lastline) { - return NO_CODE; - } - return coverage[line - offset]; - } - -} diff --git a/com.mountainminds.eclemma.core/src/com/mountainminds/eclemma/internal/core/analysis/MethodLocator.java b/com.mountainminds.eclemma.core/src/com/mountainminds/eclemma/internal/core/analysis/MethodLocator.java deleted file mode 100644 index 6d7acad..0000000 --- a/com.mountainminds.eclemma.core/src/com/mountainminds/eclemma/internal/core/analysis/MethodLocator.java +++ /dev/null @@ -1,113 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2009 Mountainminds GmbH & Co. KG - * This software is provided under the terms of the Eclipse Public License v1.0 - * See http://www.eclipse.org/legal/epl-v10.html. - * - * $Id: $ - ******************************************************************************/ -package com.mountainminds.eclemma.internal.core.analysis; - -import java.util.HashMap; -import java.util.Map; - -import org.eclipse.jdt.core.IMethod; -import org.eclipse.jdt.core.IType; -import org.eclipse.jdt.core.JavaModelException; -import org.eclipse.jdt.core.Signature; - -/** - * Internal utility to select methods by their binary signature. For performance - * optimization matching is performed in two steps, where the first step should - * quickly identify methods in most situations: Identification by name and - * parameter count. Only if the first step does fails to identify a method - * unambiguously the parameter types are resolved in a second step. - * - * @author Marc R. Hoffmann - * @version $Revision: $ - */ -public class MethodLocator { - - /** Special value to identify ambiguous entries in {@link #indexParamCount} */ - private static final Object AMBIGUOUS = new Object(); - - /** Index on methods by name and parameter count. */ - private final Map indexParamCount = new HashMap(); - - /** Index on methods by name and parameter signature. */ - private final Map indexParamSignature = new HashMap(); - - private final IType type; - - /** - * Initializes a new locator for method search within the given type. - * - * @param type - * type to search methods in - * @throws JavaModelException - */ - public MethodLocator(final IType type) throws JavaModelException { - this.type = type; - final IMethod[] methods = type.getMethods(); - for (int i = 0; i < methods.length; i++) { - addToIndex(methods[i]); - } - } - - /** - * Searches for the method with the given binary name. - * - * @param name - * binary method name - * @param signature - * binary method signature - * @return method or null - */ - public IMethod findMethod(String name, String signature) { - if (name.equals("")) { //$NON-NLS-1$ - name = type.getElementName(); - } - final Object value = indexParamCount.get(createParamCountKey(name, - signature)); - if (value == AMBIGUOUS) { - return (IMethod) indexParamSignature.get(createParamSignatureKey(name, - signature)); - } - return (IMethod) value; - } - - private void addToIndex(final IMethod method) throws JavaModelException { - final String paramCountKey = createParamCountKey(method); - final Object existing = indexParamCount.get(paramCountKey); - if (existing == null) { - indexParamCount.put(paramCountKey, method); - return; - } - if (existing != AMBIGUOUS) { - indexParamCount.put(paramCountKey, AMBIGUOUS); - final IMethod m = (IMethod) existing; - indexParamSignature.put(createParamSignatureKey(m), m); - } - indexParamSignature.put(createParamSignatureKey(method), method); - } - - private String createParamCountKey(final IMethod method) { - return method.getElementName() + "@" + method.getParameterTypes().length; //$NON-NLS-1$ - } - - private String createParamCountKey(final String name, - final String fullSignature) { - return name + "@" + Signature.getParameterCount(fullSignature); //$NON-NLS-1$ - } - - private String createParamSignatureKey(final IMethod method) - throws JavaModelException { - return method.getElementName() + "#" //$NON-NLS-1$ - + SignatureResolver.getParameters(method); - } - - private String createParamSignatureKey(final String name, - final String fullSignature) { - return name + "#" + SignatureResolver.getParameters(fullSignature); //$NON-NLS-1$ - } - -} diff --git a/com.mountainminds.eclemma.core/src/com/mountainminds/eclemma/internal/core/analysis/SessionAnalyzer.java b/com.mountainminds.eclemma.core/src/com/mountainminds/eclemma/internal/core/analysis/SessionAnalyzer.java deleted file mode 100644 index 9529886..0000000 --- a/com.mountainminds.eclemma.core/src/com/mountainminds/eclemma/internal/core/analysis/SessionAnalyzer.java +++ /dev/null @@ -1,210 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Mountainminds GmbH & Co. KG - * This software is provided under the terms of the Eclipse Public License v1.0 - * See http://www.eclipse.org/legal/epl-v10.html. - * - * $Id$ - ******************************************************************************/ -package com.mountainminds.eclemma.internal.core.analysis; - -import java.io.File; -import java.io.IOException; -import java.util.HashMap; -import java.util.Iterator; -import java.util.Map; - -import org.eclipse.core.resources.IResource; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.SubProgressMonitor; -import org.eclipse.jdt.core.IJavaElement; -import org.eclipse.jdt.core.IPackageFragmentRoot; -import org.eclipse.jdt.core.IType; -import org.eclipse.osgi.util.NLS; - -import com.mountainminds.eclemma.core.EclEmmaStatus; -import com.mountainminds.eclemma.core.ICoverageSession; -import com.mountainminds.eclemma.core.IInstrumentation; -import com.mountainminds.eclemma.core.analysis.IJavaModelCoverage; -import com.mountainminds.eclemma.internal.core.CoreMessages; -import com.mountainminds.eclemma.internal.core.DebugOptions; -import com.mountainminds.eclemma.internal.core.DebugOptions.ITracer; -import com.mountainminds.eclemma.internal.core.analysis.TypeCoverage.UnboundMethodCoverage; -import com.vladium.emma.data.ClassDescriptor; -import com.vladium.emma.data.DataFactory; -import com.vladium.emma.data.ICoverageData; -import com.vladium.emma.data.IMergeable; -import com.vladium.emma.data.IMetaData; -import com.vladium.emma.data.MethodDescriptor; -import com.vladium.emma.data.ICoverageData.DataHolder; - -/** - * @author Marc R. Hoffmann - * @version $Revision$ - */ -public class SessionAnalyzer { - - private static final ITracer TRACER = DebugOptions.ANALYSISTRACER; - private static final ITracer PERFORMANCE = DebugOptions.PERFORMANCETRACER; - - private JavaModelCoverage modelcoverage; - - public IJavaModelCoverage processSession(ICoverageSession session, IProgressMonitor monitor) - throws CoreException { - PERFORMANCE.startTimer(); - PERFORMANCE.startMemoryUsage(); - modelcoverage = new JavaModelCoverage(); - IPath[] coveragefiles = session.getCoverageDataFiles(); - IInstrumentation[] instrumentations = session.getInstrumentations(); - monitor.beginTask(NLS.bind(CoreMessages.AnalyzingCoverageSession_task, session.getDescription()), - coveragefiles.length + instrumentations.length); - ICoverageData coveragedata = null; - for (int i = 0; i < coveragefiles.length && !monitor.isCanceled(); i++) { - coveragedata = processCoveragedataFile(coveragedata, coveragefiles[i]); - monitor.worked(1); - } - for (int i = 0; i < instrumentations.length && !monitor.isCanceled(); i++) { - processMetadataFile(coveragedata, instrumentations[i], - new SubProgressMonitor(monitor, 1)); - } - monitor.done(); - PERFORMANCE.stopTimer("loading " + session.getDescription()); //$NON-NLS-1$ - PERFORMANCE.stopMemoryUsage("loading " + session.getDescription()); //$NON-NLS-1$ - return modelcoverage; - } - - private ICoverageData processCoveragedataFile(ICoverageData coveragedata, - IPath path) throws CoreException { - try { - File f = path.toFile(); - if (f.exists()) { - IMergeable data = DataFactory.load(f)[DataFactory.TYPE_COVERAGEDATA]; - if (coveragedata == null) { - coveragedata = (ICoverageData) data; - } else { - coveragedata = (ICoverageData) coveragedata.merge(data); - } - } - return coveragedata; - } catch (IOException e) { - throw new CoreException(EclEmmaStatus.COVERAGEDATA_FILE_READ_ERROR - .getStatus(path, e)); - } - } - - private void processMetadataFile(ICoverageData coveragedata, IInstrumentation instrumentation, - IProgressMonitor monitor) throws CoreException { - IPath metadatafile = instrumentation.getMetaDataFile(); - File f = metadatafile.toFile(); - if (f.exists()) { - IMetaData metadata; - try { - metadata = (IMetaData) DataFactory.load(f)[DataFactory.TYPE_METADATA]; - } catch (IOException e) { - throw new CoreException(EclEmmaStatus.METADATA_FILE_READ_ERROR.getStatus( - metadatafile, e)); - } - if (metadata == null) { - throw new CoreException(EclEmmaStatus.FILE_CONTAINS_NO_METADATA.getStatus( - metadatafile)); - } - IPackageFragmentRoot[] roots = instrumentation.getClassFiles().getPackageFragmentRoots(); - TypeTraverser jep = new TypeTraverser(roots); - jep.process(new TypeVisitor(metadata, coveragedata), monitor); - } - } - - private class TypeVisitor implements ITypeVisitor { - - private final ICoverageData coveragedata; - private final Map descriptors; - - TypeVisitor(IMetaData metadata, ICoverageData coveragedata) { - this.coveragedata = coveragedata; - this.descriptors = new HashMap(); - for (Iterator i = metadata.iterator(); i.hasNext(); ) { - ClassDescriptor cd = (ClassDescriptor) i.next(); - descriptors.put(cd.getClassVMName(), cd); - } - } - - public void visit(IType type, String vmname) { - ClassDescriptor descriptor = (ClassDescriptor) descriptors.remove(vmname); - if (descriptor != null) { - DataHolder data = coveragedata == null ? null : coveragedata.getCoverage(descriptor); - if (data != null && data.m_stamp != descriptor.getStamp()) { - TRACER.trace("Invalid meta data signature for {0}.", descriptor.getClassVMName()); //$NON-NLS-1$ - } else { - TypeCoverage typecoverage = (TypeCoverage) getCoverage(type, true); - IResource resource = type.getResource(); - typecoverage.addType(data != null); - MethodDescriptor[] methods = descriptor.getMethods(); - UnboundMethodCoverage[] ubcoverage = new UnboundMethodCoverage[methods.length]; - boolean[][] covered = data == null ? null : data.m_coverage; - for (int i = 0; i < methods.length; i++) { - ubcoverage[i] = processMethodCoverage(methods[i], covered == null ? null : covered[i], typecoverage, resource); - } - typecoverage.setUnboundMethods(ubcoverage); - } - } - } - - public void done() { - // dump what's left - for (Iterator i = descriptors.keySet().iterator(); i.hasNext(); ) { - TRACER.trace("Instrumented type {0} has not been processed.", i.next()); //$NON-NLS-1$ - } - } - - } - - private boolean isMethodCovered(boolean[] blocks) { - for (int i = 0; blocks != null && i < blocks.length; i++) { - if (blocks[i]) return true; - } - return false; - } - - private UnboundMethodCoverage processMethodCoverage(MethodDescriptor descriptor, boolean[] covered, JavaElementCoverage parentcoverage, IResource resource) { - JavaElementCoverage coverage = new JavaElementCoverage(parentcoverage, descriptor.hasLineNumberInfo(), resource); - coverage.addMethod(isMethodCovered(covered)); - int[] blocksizes = descriptor.getBlockSizes(); - if (blocksizes != null) { - int blockcount = blocksizes.length; - int[][] blocklines = descriptor.getBlockMap(); - for (int i = 0; i < blockcount; i++) { - coverage.addBlock(blocksizes[i], blocklines == null ? null : blocklines[i], - covered == null ? false : covered[i]); - } - } - return new UnboundMethodCoverage(descriptor.getName(), descriptor.getDescriptor(), coverage); - } - - private JavaElementCoverage getCoverage(IJavaElement element, boolean haslines) { - if (element == null) - return null; - JavaElementCoverage c = (JavaElementCoverage) modelcoverage.getCoverageFor(element); - if (c == null) { - switch (element.getElementType()) { - case IJavaElement.JAVA_MODEL: - c = modelcoverage; - break; - case IJavaElement.JAVA_PROJECT: - case IJavaElement.PACKAGE_FRAGMENT_ROOT: - case IJavaElement.PACKAGE_FRAGMENT: - c = new JavaElementCoverage(getCoverage(element.getParent(), false), false, element.getResource()); - break; - case IJavaElement.TYPE: - c = new TypeCoverage(getCoverage(element.getParent(), haslines), haslines, element.getResource()); - break; - default: - c = new JavaElementCoverage(getCoverage(element.getParent(), haslines), haslines, element.getResource()); - break; - } - modelcoverage.put(element, c); - } - return c; - } - -} diff --git a/com.mountainminds.eclemma.core/src/com/mountainminds/eclemma/internal/core/analysis/SignatureResolver.java b/com.mountainminds.eclemma.core/src/com/mountainminds/eclemma/internal/core/analysis/SignatureResolver.java deleted file mode 100644 index 717990a..0000000 --- a/com.mountainminds.eclemma.core/src/com/mountainminds/eclemma/internal/core/analysis/SignatureResolver.java +++ /dev/null @@ -1,157 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2009 Mountainminds GmbH & Co. KG - * This software is provided under the terms of the Eclipse Public License v1.0 - * See http://www.eclipse.org/legal/epl-v10.html. - * - * $Id: $ - ******************************************************************************/ -package com.mountainminds.eclemma.internal.core.analysis; - -import org.eclipse.jdt.core.IMethod; -import org.eclipse.jdt.core.IType; -import org.eclipse.jdt.core.ITypeParameter; -import org.eclipse.jdt.core.JavaModelException; -import org.eclipse.jdt.core.Signature; - -/** - * Utility to get a resolved binary signature from a given method. - * - * @author Marc R. Hoffmann - * @version $Revision: $ - */ -public final class SignatureResolver { - - private static final String EMPTY = ""; //$NON-NLS-1$ - - private static final String OBJECT = "Ljava/lang/Object;"; //$NON-NLS-1$ - - private static final char SLASH = '/'; - - /** - * Extracts the parameter part from the given signature, i.e. the substring - * contained in braces. - * - * @param signature - * method signature - * @return parameter part only - */ - public static String getParameters(final String signature) { - final int pos = signature.lastIndexOf(')'); - // avoid String instances for methods without parameters - return pos == 1 ? EMPTY : signature.substring(1, pos); - } - - /** - * Extracts the resolved binary parameters from the given method - * - * @param method - * method to resolve - * @return binary parameter specification - */ - public static String getParameters(final IMethod method) - throws JavaModelException { - if (method.isBinary()) { - return getParameters(method.getSignature()); - } - final StringBuffer buffer = new StringBuffer(); - final String[] parameterTypes = method.getParameterTypes(); - for (int i = 0; i < parameterTypes.length; i++) { - resolveArrayParameterType(method, parameterTypes[i], buffer); - } - return buffer.toString(); - } - - private static final void resolveArrayParameterType(final IMethod method, - final String parameterType, final StringBuffer result) - throws JavaModelException { - final int arrayCount = Signature.getArrayCount(parameterType); - for (int i = 0; i < arrayCount; i++) { - result.append(Signature.C_ARRAY); - } - resolveParameterType(method, parameterType.substring(arrayCount), result); - } - - private static final void resolveParameterType(final IMethod method, - final String parameterType, final StringBuffer result) - throws JavaModelException { - final char kind = parameterType.charAt(0); - switch (kind) { - case Signature.C_UNRESOLVED: - final String identifier = parameterType.substring(1, parameterType - .length() - 1); - if (resolveType(method.getDeclaringType(), identifier, result)) { - return; - } - if (resolveTypeParameter(method, identifier, result)) { - return; - } - break; - } - result.append(parameterType); - } - - private static final boolean resolveType(final IType scope, - final String identifier, final StringBuffer result) - throws JavaModelException { - final String[][] types = scope.resolveType(Signature - .getTypeErasure(identifier)); - if (types == null || types.length != 1) { - return false; - } - result.append(Signature.C_RESOLVED); - final String qualifier = types[0][0]; - if (qualifier.length() > 0) { - replace(qualifier, Signature.C_DOT, SLASH, result); - result.append(SLASH); - } - replace(types[0][1], Signature.C_DOT, Signature.C_DOLLAR, result); - result.append(Signature.C_SEMICOLON); - return true; - } - - private static final boolean resolveTypeParameter(final IMethod method, - final String identifier, final StringBuffer result) - throws JavaModelException { - IType type = method.getDeclaringType(); - if (resolveTypeParameter(type, method.getTypeParameters(), identifier, - result)) { - return true; - } - while (type != null) { - if (resolveTypeParameter(type, type.getTypeParameters(), identifier, - result)) { - return true; - } - type = type.getDeclaringType(); - } - return false; - } - - private static final boolean resolveTypeParameter(final IType context, - final ITypeParameter[] typeParameters, final String identifier, - final StringBuffer result) throws JavaModelException { - for (int i = 0; i < typeParameters.length; i++) { - final ITypeParameter p = typeParameters[i]; - if (identifier.equals(p.getElementName())) { - final String[] bounds = p.getBounds(); - if (bounds.length == 0) { - result.append(OBJECT); - return true; - } else { - return resolveType(context, bounds[0], result); - } - } - } - return false; - } - - private static final void replace(final String source, final char oldChar, - final char newChar, final StringBuffer result) { - final int len = source.length(); - for (int i = 0; i < len; i++) { - final char c = source.charAt(i); - result.append(c == oldChar ? newChar : c); - } - } - -} diff --git a/com.mountainminds.eclemma.core/src/com/mountainminds/eclemma/internal/core/analysis/TypeCoverage.java b/com.mountainminds.eclemma.core/src/com/mountainminds/eclemma/internal/core/analysis/TypeCoverage.java deleted file mode 100644 index eff4221..0000000 --- a/com.mountainminds.eclemma.core/src/com/mountainminds/eclemma/internal/core/analysis/TypeCoverage.java +++ /dev/null @@ -1,86 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2009 Mountainminds GmbH & Co. KG - * This software is provided under the terms of the Eclipse Public License v1.0 - * See http://www.eclipse.org/legal/epl-v10.html. - * - * $Id$ - ******************************************************************************/ -package com.mountainminds.eclemma.internal.core.analysis; - -import org.eclipse.core.resources.IResource; -import org.eclipse.jdt.core.IJavaElement; -import org.eclipse.jdt.core.IMethod; -import org.eclipse.jdt.core.IType; -import org.eclipse.jdt.core.JavaModelException; - -import com.mountainminds.eclemma.core.analysis.IJavaElementCoverage; -import com.mountainminds.eclemma.internal.core.DebugOptions; -import com.mountainminds.eclemma.internal.core.DebugOptions.ITracer; - -/** - * Coverage for types elements. - * - * @author Marc R. Hoffmann - * @version $Revision$ - */ -public class TypeCoverage extends JavaElementCoverage implements ILazyBinding { - - private static final ITracer TRACER = DebugOptions.ANALYSISTRACER; - - public static class UnboundMethodCoverage { - final String name; - final String signature; - final IJavaElementCoverage coverage; - - UnboundMethodCoverage(String name, String signature, - IJavaElementCoverage coverage) { - this.name = name; - this.signature = signature; - this.coverage = coverage; - } - } - - private UnboundMethodCoverage[] ubmethods; - - public TypeCoverage(JavaElementCoverage parent, boolean haslines, long stamp) { - super(parent, haslines, stamp); - ubmethods = null; - } - - public TypeCoverage(JavaElementCoverage parent, boolean haslines, - IResource resource) { - super(parent, haslines, resource); - ubmethods = null; - } - - public void setUnboundMethods(UnboundMethodCoverage[] ubmethods) { - this.ubmethods = ubmethods; - } - - public void resolve(IJavaElement element, JavaModelCoverage modelcoverage) { - if (ubmethods != null) { - final IType type = (IType) element; - final MethodLocator locator; - try { - locator = new MethodLocator(type); - for (int i = 0; i < ubmethods.length; i++) { - final String name = ubmethods[i].name; - final String signature = ubmethods[i].signature; - final IMethod method = locator.findMethod(name, signature); - if (method != null) { - modelcoverage.put(method, ubmethods[i].coverage); - } else { - TRACER - .trace( - "Method not found in Java model: {0}.{1}{2}", type.getFullyQualifiedName(), name, signature); //$NON-NLS-1$ - } - } - } catch (JavaModelException e) { - TRACER.trace("Error while creating method locator for {0}: {1}", type //$NON-NLS-1$ - .getFullyQualifiedName(), e); - } - ubmethods = null; - } - } - -} diff --git a/com.mountainminds.eclemma.core/src/com/mountainminds/eclemma/internal/core/analysis/TypeTraverser.java b/com.mountainminds.eclemma.core/src/com/mountainminds/eclemma/internal/core/analysis/TypeTraverser.java deleted file mode 100644 index bf84794..0000000 --- a/com.mountainminds.eclemma.core/src/com/mountainminds/eclemma/internal/core/analysis/TypeTraverser.java +++ /dev/null @@ -1,219 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Mountainminds GmbH & Co. KG - * This software is provided under the terms of the Eclipse Public License v1.0 - * See http://www.eclipse.org/legal/epl-v10.html. - * - * $Id$ - ******************************************************************************/ -package com.mountainminds.eclemma.internal.core.analysis; - -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.SubProgressMonitor; -import org.eclipse.jdt.core.IClassFile; -import org.eclipse.jdt.core.ICompilationUnit; -import org.eclipse.jdt.core.IJavaElement; -import org.eclipse.jdt.core.IJavaProject; -import org.eclipse.jdt.core.IMember; -import org.eclipse.jdt.core.IPackageFragment; -import org.eclipse.jdt.core.IPackageFragmentRoot; -import org.eclipse.jdt.core.IType; -import org.eclipse.jdt.core.JavaModelException; - -import com.mountainminds.eclemma.internal.core.DebugOptions; -import com.mountainminds.eclemma.internal.core.DebugOptions.ITracer; - -/** - * Internal utility class for traversal of all types within a list of package - * fragment roots. - * - * @author Marc R. Hoffmann - * @version $Revision$ - */ -public class TypeTraverser { - - private static final ITracer TRACER = DebugOptions.ANALYSISTRACER; - - private final IPackageFragmentRoot[] roots; - - /** - * Creates a traverser for the given list of package fragment roots. - * - * @param roots - * list of package fragment roots for traversal - */ - public TypeTraverser(IPackageFragmentRoot[] roots) { - this.roots = roots; - } - - /** - * Processes all types and methods reporting all types found to the given - * {@link ITypeVisitor} instance. - * - * @param visitor - * type visitor - * @param monitor - * progress monitor to report progress and allow cancelation - * @throws JavaModelException - * thrown by the underlying Java model - */ - public void process(ITypeVisitor visitor, IProgressMonitor monitor) - throws JavaModelException { - monitor.beginTask("", roots.length); //$NON-NLS-1$ - for (int i = 0; i < roots.length && !monitor.isCanceled(); i++) { - processPackageFragmentRoot(visitor, roots[i], new SubProgressMonitor( - monitor, 1)); - } - visitor.done(); - monitor.done(); - } - - private void processPackageFragmentRoot(ITypeVisitor visitor, - IPackageFragmentRoot root, IProgressMonitor monitor) - throws JavaModelException { - if (isOnClasspath(root)) { - IJavaElement[] fragments = root.getChildren(); - monitor.beginTask("", fragments.length); //$NON-NLS-1$ - for (int i = 0; i < fragments.length && !monitor.isCanceled(); i++) { - IPackageFragment fragment = (IPackageFragment) fragments[i]; - IProgressMonitor submonitor = new SubProgressMonitor(monitor, 1); - processPackageFragment(visitor, fragment, submonitor); - } - } else { - TRACER.trace("Package fragment root {0} not on classpath.", //$NON-NLS-1$ - root.getPath()); - } - monitor.done(); - } - - /** - * This methods checks whether the given package fragment root is still on the - * classpath. This check is required as the user might change the classpath - * and old coverage sessions afterwards (SF #1836551). - * - * @param root package fragment root - * @return true, if the classpath entry still exists - * @throws JavaModelException - */ - private boolean isOnClasspath(IPackageFragmentRoot root) - throws JavaModelException { - IPath path = root.getPath(); - IJavaProject project = root.getJavaProject(); - return project.findPackageFragmentRoot(path) != null; - } - - private void processPackageFragment(ITypeVisitor visitor, - IPackageFragment fragment, IProgressMonitor monitor) - throws JavaModelException { - switch (fragment.getKind()) { - case IPackageFragmentRoot.K_SOURCE: - ICompilationUnit[] units = fragment.getCompilationUnits(); - monitor.beginTask("", units.length); //$NON-NLS-1$ - for (int i = 0; i < units.length && !monitor.isCanceled(); i++) { - processCompilationUnit(visitor, units[i], monitor); - monitor.worked(1); - } - break; - case IPackageFragmentRoot.K_BINARY: - IClassFile[] classfiles = fragment.getClassFiles(); - monitor.beginTask("", classfiles.length); //$NON-NLS-1$ - for (int i = 0; i < classfiles.length && !monitor.isCanceled(); i++) { - processClassFile(visitor, classfiles[i], monitor); - monitor.worked(1); - } - break; - } - monitor.done(); - } - - private void processCompilationUnit(ITypeVisitor visitor, - ICompilationUnit unit, IProgressMonitor monitor) - throws JavaModelException { - IType[] types = unit.getTypes(); - for (int i = 0; i < types.length && !monitor.isCanceled(); i++) { - IType type = types[i]; - processType(visitor, new BinaryTypeName(type), type, monitor); - } - } - - private void processClassFile(ITypeVisitor visitor, IClassFile file, - IProgressMonitor monitor) throws JavaModelException { - IType type = file.getType(); - processType(visitor, new BinaryTypeName(type), type, monitor); - } - - private void processType(ITypeVisitor visitor, BinaryTypeName btn, - IType type, IProgressMonitor monitor) throws JavaModelException { - String binaryname = btn.toString(); - monitor.subTask(binaryname); - visitor.visit(type, binaryname); - IJavaElement[] children = type.getChildren(); - for (int i = 0; i < children.length && !monitor.isCanceled(); i++) { - IJavaElement child = children[i]; - switch (child.getElementType()) { - case IJavaElement.TYPE: - IType nestedtype = (IType) child; - processType(visitor, btn.nest(nestedtype), nestedtype, monitor); - break; - case IJavaElement.METHOD: - case IJavaElement.INITIALIZER: - case IJavaElement.FIELD: - processAnonymousInnerTypes(visitor, btn, (IMember) child, monitor); - break; - } - } - } - - private void processAnonymousInnerTypes(ITypeVisitor visitor, - BinaryTypeName btn, IMember member, IProgressMonitor monitor) - throws JavaModelException { - IJavaElement[] types = member.getChildren(); - for (int i = 0; i < types.length && !monitor.isCanceled(); i++) { - IType type = (IType) types[i]; - processType(visitor, btn.nest(type), type, monitor); - } - } - - /** - * Internal utility to calculate binary names of nested classes. - */ - private static class BinaryTypeName { - - private static class Ctr { - private int i = 0; - public int inc() { - return ++i; - } - } - - private final String rootname; - private final String typename; - private final Ctr ctr; - - private BinaryTypeName(String rootname, String typename, Ctr ctr) { - this.rootname = rootname; - this.typename = typename; - this.ctr = ctr; - } - - public BinaryTypeName(IType roottype) { - this.rootname = roottype.getFullyQualifiedName().replace('.', '/'); - this.typename = this.rootname; - this.ctr = new Ctr(); - } - - public BinaryTypeName nest(IType type) throws JavaModelException { - if (type.isAnonymous()) { - return new BinaryTypeName(rootname, rootname + '$' + ctr.inc(), ctr); - } else { - return new BinaryTypeName(rootname, typename + '$' + type.getElementName(), ctr); - } - } - - public String toString() { - return typename; - } - - } - -} diff --git a/com.mountainminds.eclemma.core/src/com/mountainminds/eclemma/internal/core/coremessages.properties b/com.mountainminds.eclemma.core/src/com/mountainminds/eclemma/internal/core/coremessages.properties deleted file mode 100644 index b0d23a0..0000000 --- a/com.mountainminds.eclemma.core/src/com/mountainminds/eclemma/internal/core/coremessages.properties +++ /dev/null @@ -1,33 +0,0 @@ -#******************************************************************************* -# Copyright (c) 2006 Mountainminds GmbH & Co. KG -# This software is provided under the terms of the Eclipse Public License v1.0 -# See http://www.eclipse.org/legal/epl-v10.html. -# -# $Id$ -#******************************************************************************* - -# English messages for the core plug-in. - -LaunchSessionDescription_value={0} ({1,date,medium} {1,time,medium}) -InstrumentingClasses_task=Instrumenting classes -InstrumentingClassesIn_task=Instrumenting classes in {0} -Launching_task=Launching {0} -AnalyzingCoverageSession_task=Analyzing coverage session {0} -ExportingSession_task=Exporting coverage session {0} -ImportingSession_task=Importing coverage session -ExtractingSourceArchive_task=Extracting source archive {0} -StatusINPLACE_INSTRUMENTATION_INFO_message=Code will be instrumented inplace. (code {0}) -StatusNO_LOCAL_EMMAJAR_ERROR_message=No local emma.jar available (code {0}). -StatusID_CREATION_ERROR_message=Error while creating internal id (code {0}). -StatusUNKOWN_LAUNCH_TYPE_ERROR_message=Unknown launch type {1} (code {0}). -StatusINVALID_CLASSPATH_PROVIDER_CONTEXT_ERROR_message=Invalid execution context for coverage runtime classpath provider (code {0}). -StatusMISSING_LAUNCH_INFO_ERROR_message=Coverage launch info object is missing (code {0}). -StatusEMMA_PROPERTIES_CREATION_ERROR_message=Error while creating emma properties archive at {1} (code {0}). -StatusCOVERAGEDATA_FILE_READ_ERROR_message=Error while reading coverage data file {1} (code {0}). -StatusMETADATA_FILE_READ_ERROR_message=Error while reading meta data file {1} (code {0}). -StatusSOURCE_EXTRACTION_ERROR_message=Error while extracting source archive {1} (code {0}). -StatusIMPORT_ERROR_message=Error while importing coverage session (code {0}). -StatusFILE_CONTAINS_NO_METADATA_message=File {1} does not contain meta data (code {0}). -StatusALREADY_INSTRUMENTED_ERROR_message=Trying to instrument instrumented class files (code {0}). -StatusNO_COVERAGE_DATA_ERROR_message=No coverage file has been created during coverage launch. Make sure that EMMA is not already configured within your project (code {0}). -StatusNO_INSTRUMENTED_CLASSES_message=No classes are selected for instrumentation (code {0}). \ No newline at end of file diff --git a/com.mountainminds.eclemma.core/src/com/mountainminds/eclemma/internal/core/instr/ClassFiles.java b/com.mountainminds.eclemma.core/src/com/mountainminds/eclemma/internal/core/instr/ClassFiles.java deleted file mode 100644 index f266d66..0000000 --- a/com.mountainminds.eclemma.core/src/com/mountainminds/eclemma/internal/core/instr/ClassFiles.java +++ /dev/null @@ -1,157 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2009 Mountainminds GmbH & Co. KG - * This software is provided under the terms of the Eclipse Public License v1.0 - * See http://www.eclipse.org/legal/epl-v10.html. - * - * $Id$ - ******************************************************************************/ -package com.mountainminds.eclemma.internal.core.instr; - -import java.util.ArrayList; -import java.util.List; -import java.util.Properties; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.jdt.core.IPackageFragmentRoot; -import org.eclipse.jdt.core.JavaModelException; -import org.eclipse.osgi.util.NLS; - -import com.mountainminds.eclemma.core.IClassFiles; -import com.mountainminds.eclemma.core.IInstrumentation; -import com.mountainminds.eclemma.core.ISourceLocation; -import com.mountainminds.eclemma.internal.core.CoreMessages; -import com.mountainminds.eclemma.internal.core.DebugOptions; -import com.mountainminds.eclemma.internal.core.EclEmmaCorePlugin; -import com.mountainminds.eclemma.internal.core.DebugOptions.ITracer; -import com.vladium.emma.AppLoggers; -import com.vladium.emma.instr.InstrProcessor; -import com.vladium.emma.instr.InstrProcessor.OutMode; - -/** - * Implementation of IClassFiles. - * - * @author Marc R. Hoffmann - * @version $Revision$ - */ -public class ClassFiles implements IClassFiles { - - private static final ITracer PERFORMANCE = DebugOptions.PERFORMANCETRACER; - - private static final String METADATAFILE_EXT = "em"; //$NON-NLS-1$ - - private final IPackageFragmentRoot[] roots; - - private final IPath location; - - private final boolean binary; - - /** - * Create a new instance containing a single package fragment root with the - * given class file location. - * - * @param root - * package fragment root - * @param location - * location of the class files - * @throws JavaModelException - * thrown when a problem with the underlying Java model occures - */ - public ClassFiles(IPackageFragmentRoot root, IPath location) - throws JavaModelException { - this(new IPackageFragmentRoot[] { root }, location, - root.getKind() == IPackageFragmentRoot.K_BINARY); - } - - private ClassFiles(IPackageFragmentRoot[] roots, IPath location, - boolean binary) { - this.roots = roots; - this.location = location; - this.binary = binary; - } - - /** - * Creates a new ClassFiles instance with the given package fragment root - * added. Mixing source and binary package fragment roots will result in an - * exception. - * - * @param root - * the package fragment root to add - * @return new instance - * @throws JavaModelException - * thrown when a problem with the underlying Java model occures - */ - public ClassFiles addRoot(IPackageFragmentRoot root) - throws JavaModelException { - IPackageFragmentRoot[] newroots = new IPackageFragmentRoot[roots.length + 1]; - System.arraycopy(roots, 0, newroots, 0, roots.length); - newroots[roots.length] = root; - return new ClassFiles(newroots, location, binary - && root.getKind() == IPackageFragmentRoot.K_BINARY); - } - - public String toString() { - final StringBuffer sb = new StringBuffer(getClass().getName()); - sb.append("[").append(location).append("]"); //$NON-NLS-1$//$NON-NLS-2$ - return sb.toString(); - } - - // IClassFiles implementation - - public boolean isBinary() { - return binary; - } - - public IPackageFragmentRoot[] getPackageFragmentRoots() { - return roots; - } - - public IPath getLocation() { - return location; - } - - public ISourceLocation[] getSourceLocations() throws JavaModelException { - List l = new ArrayList(); - for (int i = 0; i < roots.length; i++) { - ISourceLocation location = SourceLocation.findLocation(roots[i]); - if (location != null) { - l.add(location); - } - } - ISourceLocation[] array = new ISourceLocation[l.size()]; - return (ISourceLocation[]) l.toArray(array); - } - - public IInstrumentation instrument(boolean inplace, IProgressMonitor monitor) - throws CoreException { - PERFORMANCE.startTimer(); - monitor.beginTask(NLS.bind(CoreMessages.InstrumentingClassesIn_task, - location), 1); - IPath outputlocation = EclEmmaCorePlugin.getInstance().getStateFiles() - .getInstrDataFolder(location); - outputlocation.toFile().mkdirs(); - IPath metadatafile = outputlocation.addFileExtension(METADATAFILE_EXT); - if (inplace) { - InstrMarker.mark(location); - outputlocation = EclEmmaCorePlugin.getAbsolutePath(location); - } - InstrProcessor processor = InstrProcessor.create(); - processor.setInstrPath(new String[] { EclEmmaCorePlugin.getAbsolutePath( - location).toOSString() }, true); - processor.setInstrOutDir(outputlocation.toOSString()); - processor.setMetaOutFile(metadatafile.toOSString()); - processor.setMetaOutMerge(Boolean.TRUE); - processor.setOutMode(inplace ? OutMode.OUT_MODE_OVERWRITE - : OutMode.OUT_MODE_COPY); - Properties props = new Properties(); - props.put(AppLoggers.PROPERTY_VERBOSITY_LEVEL, - DebugOptions.EMMAVERBOSITYLEVEL); - processor.setPropertyOverrides(props); - processor.run(); - monitor.done(); - PERFORMANCE.stopTimer("instrumenting " + location); //$NON-NLS-1$ - return new Instrumentation(this, inplace, outputlocation, metadatafile); - } - -} diff --git a/com.mountainminds.eclemma.core/src/com/mountainminds/eclemma/internal/core/instr/ClassFilesStore.java b/com.mountainminds.eclemma.core/src/com/mountainminds/eclemma/internal/core/instr/ClassFilesStore.java deleted file mode 100644 index 2ff9b6a..0000000 --- a/com.mountainminds.eclemma.core/src/com/mountainminds/eclemma/internal/core/instr/ClassFilesStore.java +++ /dev/null @@ -1,124 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2009 Mountainminds GmbH & Co. KG - * This software is provided under the terms of the Eclipse Public License v1.0 - * See http://www.eclipse.org/legal/epl-v10.html. - * - * $Id: ClassFiles.java 519 2009-01-28 20:09:45Z mtnminds $ - ******************************************************************************/ -package com.mountainminds.eclemma.internal.core.instr; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.eclipse.core.runtime.IPath; -import org.eclipse.jdt.core.IClasspathEntry; -import org.eclipse.jdt.core.IJavaModel; -import org.eclipse.jdt.core.IJavaProject; -import org.eclipse.jdt.core.IPackageFragmentRoot; -import org.eclipse.jdt.core.JavaModelException; - -import com.mountainminds.eclemma.core.IClassFiles; -import com.mountainminds.eclemma.internal.core.EclEmmaCorePlugin; - -/** - * Support for creation and access for {@link IClassFiles} objects. - * - * @author Marc R. Hoffmann - * @version $Revision: $ - */ -public class ClassFilesStore { - - private final Map locationIndex = new HashMap(); - - /** - * Adds the given package fragment root. - * - * @param root - * package fragment root to add - * @throws JavaModelException - * might be thrown by the underlying Java model - */ - public void add(IPackageFragmentRoot root) throws JavaModelException { - final IPath location = getClassFileLocation(root); - final String absolute = EclEmmaCorePlugin.getAbsolutePath(location) - .toOSString(); - ClassFiles classfiles = (ClassFiles) locationIndex.get(absolute); - if (classfiles == null) { - classfiles = new ClassFiles(root, location); - } else { - classfiles = classfiles.addRoot(root); - } - locationIndex.put(absolute, classfiles); - } - - /** - * Adds all class files of the given Java project. - * - * @param javaProject - * Java project to add - * @throws JavaModelException - * might be thrown by the underlying Java model - */ - public void add(IJavaProject javaProject) throws JavaModelException { - final IPackageFragmentRoot[] roots = javaProject.getPackageFragmentRoots(); - for (int i = 0; i < roots.length; i++) { - add(roots[i]); - } - } - - /** - * Adds all class files of all projects of the Java model. - * - * @param javaModel - * Java model to add - * @throws JavaModelException - * might be thrown by the underlying Java model - */ - public void add(IJavaModel javaModel) throws JavaModelException { - final IJavaProject[] javaProjects = javaModel.getJavaProjects(); - for (int i = 0; i < javaProjects.length; i++) { - add(javaProjects[i]); - } - } - - /** - * Returns all contained {@link IClassFiles} objects. - * - * @return - */ - public IClassFiles[] getClassFiles() { - final List l = new ArrayList(locationIndex.values()); - return (IClassFiles[]) l.toArray(new IClassFiles[l.size()]); - } - - /** - * Returns the {@link IClassFiles} object with the given absolute location on - * the local file system. - * - * @param location - * absolute location - * @return {@link IClassFiles} object or null - * - */ - public IClassFiles getAtAbsoluteLocation(String location) { - return (IClassFiles) locationIndex.get(location); - } - - private static IPath getClassFileLocation(IPackageFragmentRoot root) - throws JavaModelException { - IPath path; - if (root.getKind() == IPackageFragmentRoot.K_SOURCE) { - IClasspathEntry entry = root.getRawClasspathEntry(); - path = entry.getOutputLocation(); - if (path == null) { - path = root.getJavaProject().getOutputLocation(); - } - } else { - path = root.getPath(); - } - return path; - } - -} diff --git a/com.mountainminds.eclemma.core/src/com/mountainminds/eclemma/internal/core/instr/DefaultInstrumentationFilter.java b/com.mountainminds.eclemma.core/src/com/mountainminds/eclemma/internal/core/instr/DefaultInstrumentationFilter.java deleted file mode 100644 index b856e13..0000000 --- a/com.mountainminds.eclemma.core/src/com/mountainminds/eclemma/internal/core/instr/DefaultInstrumentationFilter.java +++ /dev/null @@ -1,127 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 ,2009 Mountainminds GmbH & Co. KG - * This software is provided under the terms of the Eclipse Public License v1.0 - * See http://www.eclipse.org/legal/epl-v10.html. - * - * $Id: $ - ******************************************************************************/ -package com.mountainminds.eclemma.internal.core.instr; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Iterator; -import java.util.List; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.debug.core.ILaunchConfiguration; -import org.eclipse.jdt.core.IJavaProject; -import org.eclipse.jdt.core.IPackageFragmentRoot; -import org.eclipse.jdt.launching.JavaRuntime; - -import com.mountainminds.eclemma.core.IClassFiles; -import com.mountainminds.eclemma.core.ICorePreferences; - -/** - * Utility to retrieve the list of {@link IClassFiles} that will be instrumented - * by default. - * - * @author Marc R. Hoffmann - * @version $Revision: $ - */ -public class DefaultInstrumentationFilter { - - private final ICorePreferences preferences; - - /** - * Creates a new filter based on the given preferences. - * - * @param preferences - * call-back to retrieve current settings from. - */ - public DefaultInstrumentationFilter(final ICorePreferences preferences) { - this.preferences = preferences; - } - - /** - * Returns a filtered copy of the given {@link IClassFiles} array. - * - * @param classfiles - * {@link IClassFiles} to filter - * @param configuration - * context information - * @return filtered list - * @throws CoreException - * may occur when accessing the Java model - */ - public IClassFiles[] filter(final IClassFiles[] classfiles, - final ILaunchConfiguration configuration) throws CoreException { - final List list = new ArrayList(Arrays.asList(classfiles)); - if (preferences.getDefaultInstrumentationSourceFoldersOnly()) { - sourceFoldersOnly(list); - } - if (preferences.getDefaultInstrumentationSameProjectOnly()) { - sameProjectOnly(list, configuration); - } - String filter = preferences.getDefaultInstrumentationFilter(); - if (filter != null && filter.length() > 0) { - matchingPathsOnly(list, filter); - } - return (IClassFiles[]) list.toArray(new IClassFiles[list.size()]); - } - - private void sourceFoldersOnly(final List list) { - for (final Iterator i = list.iterator(); i.hasNext();) { - final IClassFiles c = (IClassFiles) i.next(); - if (c.isBinary()) { - i.remove(); - } - } - } - - private void sameProjectOnly(final List list, - final ILaunchConfiguration configuration) throws CoreException { - final IJavaProject javaProject = JavaRuntime.getJavaProject(configuration); - if (javaProject != null) { - for (final Iterator i = list.iterator(); i.hasNext();) { - if (!isSameProject((IClassFiles) i.next(), javaProject)) { - i.remove(); - } - } - } - } - - private boolean isSameProject(final IClassFiles classfiles, - final IJavaProject javaProject) { - final IPackageFragmentRoot[] roots = classfiles.getPackageFragmentRoots(); - for (int i = 0; i < roots.length; i++) { - if (javaProject.equals(roots[i].getJavaProject())) { - return true; - } - } - return false; - } - - private void matchingPathsOnly(final List list, final String filter) { - final String[] matchStrings = filter.split(","); //$NON-NLS-1$ - for (final Iterator i = list.iterator(); i.hasNext();) { - if (!isPathMatch((IClassFiles) i.next(), matchStrings)) { - i.remove(); - } - } - } - - private boolean isPathMatch(final IClassFiles classfiles, - final String[] matchStrings) { - final IPackageFragmentRoot[] roots = classfiles.getPackageFragmentRoots(); - for (int i = 0; i < roots.length; i++) { - final String path = roots[i].getPath().toString(); - for (int j = 0; j < matchStrings.length; j++) { - if (path.indexOf(matchStrings[j]) != -1) { - return true; - } - } - } - return false; - } - -} diff --git a/com.mountainminds.eclemma.core/src/com/mountainminds/eclemma/internal/core/instr/InstrMarker.java b/com.mountainminds.eclemma.core/src/com/mountainminds/eclemma/internal/core/instr/InstrMarker.java deleted file mode 100644 index ffdaead..0000000 --- a/com.mountainminds.eclemma.core/src/com/mountainminds/eclemma/internal/core/instr/InstrMarker.java +++ /dev/null @@ -1,76 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Mountainminds GmbH & Co. KG - * This software is provided under the terms of the Eclipse Public License v1.0 - * See http://www.eclipse.org/legal/epl-v10.html. - * - * $Id: $ - ******************************************************************************/ -package com.mountainminds.eclemma.internal.core.instr; - -import java.io.ByteArrayInputStream; -import java.io.InputStream; -import java.util.Date; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IFolder; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.resources.IWorkspaceRoot; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IPath; - -/** - * Static utilities to mark instrumented output folders. The mark created as a - * special file in the output directory, which will be deleted during a clean - * build. - * - * @author Marc R. Hoffmann - * @version $Revision: $ - */ -public class InstrMarker { - - private static final String MARKERFILE = ".emma_instrumented"; //$NON-NLS-1$ - - /** - * Sets a mark on the given output folder. - * - * @param path - * workspace relative path of the output folder - * @throws CoreException - * Thrown when creating the marker file fails - */ - public static void mark(IPath path) throws CoreException { - IFolder folder = getFolder(path); - if (folder != null) { - IFile marker = folder.getFile(MARKERFILE); - if (!marker.exists()) { - marker.create(getMarkerContent(), true, null); - marker.setDerived(true); - } - } - } - - /** - * Checks whether the given output folder has an instrumentation mark. - * - * @param path - * workspace relative path of the output folder - * @return true if the mark exists - */ - public static boolean isMarked(IPath path) { - IFolder folder = getFolder(path); - return folder == null ? false : folder.getFile(MARKERFILE).exists(); - } - - private static IFolder getFolder(IPath path) { - IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); - IResource res = root.findMember(path); - return res instanceof IFolder ? (IFolder) res : null; - } - - private static InputStream getMarkerContent() { - String text = "Class files instrumented at " + new Date(); //$NON-NLS-1$ - return new ByteArrayInputStream(text.getBytes()); - } - -} diff --git a/com.mountainminds.eclemma.core/src/com/mountainminds/eclemma/internal/core/instr/Instrumentation.java b/com.mountainminds.eclemma.core/src/com/mountainminds/eclemma/internal/core/instr/Instrumentation.java deleted file mode 100644 index 1e749fc..0000000 --- a/com.mountainminds.eclemma.core/src/com/mountainminds/eclemma/internal/core/instr/Instrumentation.java +++ /dev/null @@ -1,64 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Mountainminds GmbH & Co. KG - * This software is provided under the terms of the Eclipse Public License v1.0 - * See http://www.eclipse.org/legal/epl-v10.html. - * - * $Id$ - ******************************************************************************/ -package com.mountainminds.eclemma.internal.core.instr; - -import org.eclipse.core.runtime.IPath; - -import com.mountainminds.eclemma.core.IClassFiles; -import com.mountainminds.eclemma.core.IInstrumentation; - -/** - * Implementation of {@link IInstrumentation}. - * - * @author Marc R. Hoffmann - * @version $Revision$ - */ -public class Instrumentation implements IInstrumentation { - - private final IClassFiles classfiles; - private final boolean inplace; - private final IPath outputlocation; - private final IPath metadatafile; - - public Instrumentation(IClassFiles classfiles, boolean inplace, - IPath outputlocation, IPath metadatafile) { - this.classfiles = classfiles; - this.inplace = inplace; - this.outputlocation = outputlocation; - this.metadatafile = metadatafile; - } - - public boolean isInplace() { - return inplace; - } - - public IClassFiles getClassFiles() { - return classfiles; - } - - public IPath getOutputLocation() { - return outputlocation; - } - - public IPath getMetaDataFile() { - return metadatafile; - } - - public boolean equals(Object obj) { - if (obj instanceof IInstrumentation) { - return metadatafile.equals(((IInstrumentation) obj).getMetaDataFile()); - } else { - return false; - } - } - - public int hashCode() { - return metadatafile.hashCode(); - } - -} diff --git a/com.mountainminds.eclemma.core/src/com/mountainminds/eclemma/internal/core/instr/SourceLocation.java b/com.mountainminds.eclemma.core/src/com/mountainminds/eclemma/internal/core/instr/SourceLocation.java deleted file mode 100644 index 1bb9ae9..0000000 --- a/com.mountainminds.eclemma.core/src/com/mountainminds/eclemma/internal/core/instr/SourceLocation.java +++ /dev/null @@ -1,132 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Mountainminds GmbH & Co. KG - * This software is provided under the terms of the Eclipse Public License v1.0 - * See http://www.eclipse.org/legal/epl-v10.html. - * - * $Id$ - ******************************************************************************/ -package com.mountainminds.eclemma.internal.core.instr; - -import java.io.FileInputStream; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.OutputStream; -import java.util.ArrayList; -import java.util.List; -import java.util.zip.ZipEntry; -import java.util.zip.ZipInputStream; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.Path; -import org.eclipse.jdt.core.IPackageFragmentRoot; -import org.eclipse.jdt.core.JavaModelException; -import org.eclipse.osgi.util.NLS; - -import com.mountainminds.eclemma.core.EclEmmaStatus; -import com.mountainminds.eclemma.core.ISourceLocation; -import com.mountainminds.eclemma.internal.core.CoreMessages; -import com.mountainminds.eclemma.internal.core.EclEmmaCorePlugin; - -/** - * Implementation of {@link ISourceLocation}. - * - * @author Marc R. Hoffmann - * @version $Revision$ - */ -public class SourceLocation implements ISourceLocation { - - private static final String JAVA_EXT = ".java"; //$NON-NLS-1$ - - public static ISourceLocation findLocation(IPackageFragmentRoot root) - throws JavaModelException { - if (root.getKind() == IPackageFragmentRoot.K_SOURCE) { - IPath path = EclEmmaCorePlugin.getAbsolutePath(root.getPath()); - return new SourceLocation(path, new Path( - IPackageFragmentRoot.DEFAULT_PACKAGEROOT_PATH)); - } else { - IPath path = root.getSourceAttachmentPath(); - if (path != null) { - path = EclEmmaCorePlugin.getAbsolutePath(path); - return new SourceLocation(path, root.getSourceAttachmentRootPath()); - } else { - return null; - } - } - } - - public static ISourceLocation[] findLocations(IPackageFragmentRoot[] roots) - throws JavaModelException { - List l = new ArrayList(); - for (int i = 0; i < roots.length; i++) { - ISourceLocation loc = findLocation(roots[i]); - if (loc != null) { - l.add(loc); - } - } - return (ISourceLocation[]) l.toArray(new ISourceLocation[l.size()]); - } - - private IPath path; - private IPath rootpath; - - /** - * Creates a source location for the given path and root path. - * - * @param path - * @param rootpath - */ - public SourceLocation(IPath path, IPath rootpath) { - this.path = path; - this.rootpath = rootpath; - } - - public IPath getPath() { - return path; - } - - public IPath getRootPath() { - return rootpath; - } - - public boolean isArchive() { - return path.toFile().isFile(); - } - - public void extract(IProgressMonitor monitor) throws CoreException { - if (isArchive()) { - monitor.beginTask(NLS.bind(CoreMessages.ExtractingSourceArchive_task, path), 1); - String prefix = rootpath == null ? "" : rootpath.toString(); //$NON-NLS-1$ - byte[] buffer = new byte[0x1000]; - IPath srcfolder = EclEmmaCorePlugin.getInstance().getStateFiles().getSourceFolder(path); - if (!srcfolder.toFile().exists()) { - try { - ZipInputStream zip = new ZipInputStream(new FileInputStream(path.toFile())); - while (true) { - ZipEntry entry = zip.getNextEntry(); - if (entry == null) break; - if (!entry.isDirectory() && entry.getName().startsWith(prefix) && entry.getName().endsWith(JAVA_EXT)) { - IPath path = srcfolder.append(entry.getName().substring(prefix.length())); - path.removeLastSegments(1).toFile().mkdirs(); - OutputStream out = new FileOutputStream(path.toFile()); - int len; - while ((len = zip.read(buffer)) != -1) { - out.write(buffer, 0, len); - } - out.close(); - } - zip.closeEntry(); - } - zip.close(); - } catch (IOException e) { - throw new CoreException(EclEmmaStatus.SOURCE_EXTRACTION_ERROR.getStatus(path, e)); - } - } - path = srcfolder; - rootpath = null; - } - monitor.done(); - } - -} diff --git a/com.mountainminds.eclemma.core/src/com/mountainminds/eclemma/internal/core/launching/CoverageLaunchInfo.java b/com.mountainminds.eclemma.core/src/com/mountainminds/eclemma/internal/core/launching/CoverageLaunchInfo.java deleted file mode 100644 index e6ad7ce..0000000 --- a/com.mountainminds.eclemma.core/src/com/mountainminds/eclemma/internal/core/launching/CoverageLaunchInfo.java +++ /dev/null @@ -1,127 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Mountainminds GmbH & Co. KG - * This software is provided under the terms of the Eclipse Public License v1.0 - * See http://www.eclipse.org/legal/epl-v10.html. - * - * $Id$ - ******************************************************************************/ -package com.mountainminds.eclemma.internal.core.launching; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.WeakHashMap; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.SubProgressMonitor; -import org.eclipse.debug.core.ILaunch; -import org.eclipse.debug.core.ILaunchConfiguration; -import org.eclipse.osgi.util.NLS; - -import com.mountainminds.eclemma.core.CoverageTools; -import com.mountainminds.eclemma.core.IClassFiles; -import com.mountainminds.eclemma.core.IInstrumentation; -import com.mountainminds.eclemma.core.launching.ICoverageLaunchInfo; -import com.mountainminds.eclemma.internal.core.CoreMessages; -import com.mountainminds.eclemma.internal.core.EclEmmaCorePlugin; -import com.mountainminds.eclemma.internal.core.StateFiles; - -/** - * Implementation of {@link ICoverageLaunchInfo}. - * - * @author Marc R. Hoffmann - * @version $Revision$ - */ -public class CoverageLaunchInfo implements ICoverageLaunchInfo { - - private static int idcounter = (int) System.currentTimeMillis(); - private static final Map instances = new WeakHashMap(); - - private final String id; - private final ILaunchConfiguration configuration; - private IPath coveragefile; - private IPath propertiesjarfile; - private final List instrumentations; - private final Map instrumentationpaths; - - public CoverageLaunchInfo(ILaunch launch) { - id = Integer.toHexString(idcounter++); - instances.put(id, this); - configuration = launch.getLaunchConfiguration(); - StateFiles statefiles = EclEmmaCorePlugin.getInstance().getStateFiles(); - IPath base = statefiles.getLaunchDataFolder().append(id); - coveragefile = base.addFileExtension("ec"); //$NON-NLS-1$ - statefiles.registerForCleanup(coveragefile); - propertiesjarfile = base.addFileExtension("jar"); //$NON-NLS-1$ - statefiles.registerForCleanup(propertiesjarfile); - instrumentations = new ArrayList(); - instrumentationpaths = new HashMap(); - instances.put(launch, this); - } - - /** - * Returns the coverage launch info that is assoziated with the given launch. - * If no info object is assoziated with the given launch null - * is returned. - * - * @param launch - * the launch object we need coverage data for - * @return the info data object or null - */ - public static ICoverageLaunchInfo getInfo(ILaunch launch) { - return (ICoverageLaunchInfo) instances.get(launch); - } - - // ICoverageLaunchInfo interface - - public IPath getCoverageFile() { - return coveragefile; - } - - public IPath getPropertiesJARFile() { - return propertiesjarfile; - } - - public void instrument(IProgressMonitor monitor, boolean inplace) throws CoreException { - instrumentations.clear(); - instrumentationpaths.clear(); - IClassFiles[] classfiles = CoverageTools.getClassFilesForInstrumentation( - configuration, inplace); - monitor.beginTask(CoreMessages.InstrumentingClasses_task, - classfiles.length); - for (int i = 0; i < classfiles.length; i++) { - if (monitor.isCanceled()) { - return; - } - monitor.subTask(NLS.bind(CoreMessages.InstrumentingClassesIn_task, classfiles[i].getLocation())); - addInstrumentation(classfiles[i].instrument(inplace, new SubProgressMonitor(monitor, 1))); - } - monitor.done(); - } - - private void addInstrumentation(IInstrumentation instrumentation) { - instrumentations.add(instrumentation); - IPath orig = EclEmmaCorePlugin.getAbsolutePath(instrumentation.getClassFiles().getLocation()); - instrumentationpaths.put(orig.toOSString(), instrumentation); - } - - public IInstrumentation[] getInstrumentations() { - IInstrumentation[] a = new IInstrumentation[instrumentations.size()]; - return (IInstrumentation[]) instrumentations.toArray(a); - } - - public IInstrumentation getInstrumentation(String originalpath) { - return (IInstrumentation) instrumentationpaths.get(originalpath); - } - - public void dispose() { - // TODO check why this is still necessary, someone seems to hold a reference - // to the launch objects. - coveragefile = null; - propertiesjarfile = null; - } - -} diff --git a/com.mountainminds.eclemma.core/src/com/mountainminds/eclemma/internal/core/launching/InstrumentedClasspathProvider.java b/com.mountainminds.eclemma.core/src/com/mountainminds/eclemma/internal/core/launching/InstrumentedClasspathProvider.java deleted file mode 100644 index 4487981..0000000 --- a/com.mountainminds.eclemma.core/src/com/mountainminds/eclemma/internal/core/launching/InstrumentedClasspathProvider.java +++ /dev/null @@ -1,119 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Mountainminds GmbH & Co. KG - * This software is provided under the terms of the Eclipse Public License v1.0 - * See http://www.eclipse.org/legal/epl-v10.html. - * - * $Id$ - ******************************************************************************/ -package com.mountainminds.eclemma.internal.core.launching; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IPath; -import org.eclipse.debug.core.ILaunchConfiguration; -import org.eclipse.jdt.launching.IRuntimeClasspathEntry; -import org.eclipse.jdt.launching.IRuntimeClasspathProvider; -import org.eclipse.jdt.launching.JavaRuntime; - -import com.mountainminds.eclemma.core.CoverageTools; -import com.mountainminds.eclemma.core.EclEmmaStatus; -import com.mountainminds.eclemma.core.IInstrumentation; -import com.mountainminds.eclemma.core.launching.ICoverageLaunchInfo; -import com.mountainminds.eclemma.internal.core.DebugOptions; -import com.mountainminds.eclemma.internal.core.DebugOptions.ITracer; - -/** - * Class path provider used internally to inject instrumented classes and the - * Emma runtime. - * - * @author Marc R. Hoffmann - * @version $Revision$ - */ -public class InstrumentedClasspathProvider implements IRuntimeClasspathProvider { - - public static final String ID = "com.mountainminds.eclemma.core.instrumentedClasspathProvider"; //$NON-NLS-1$ - - private static final ITracer TRACER = DebugOptions.LAUNCHINGTRACER; - - private static final ThreadLocal originalClasspathProvider = new ThreadLocal(); - - private static final ThreadLocal launchInfo = new ThreadLocal(); - - public static void enable( - IRuntimeClasspathProvider originalClasspathProvider, - ICoverageLaunchInfo launchInfo) { - InstrumentedClasspathProvider.originalClasspathProvider.set(originalClasspathProvider); - InstrumentedClasspathProvider.launchInfo.set(launchInfo); - } - - public static void disable() { - InstrumentedClasspathProvider.originalClasspathProvider.set(null); - InstrumentedClasspathProvider.launchInfo.set(null); - } - - private static IRuntimeClasspathProvider getOriginalClasspathProvider() - throws CoreException { - Object obj = originalClasspathProvider.get(); - if (obj == null) { - throw new CoreException(EclEmmaStatus.INVALID_CLASSPATH_PROVIDER_CONTEXT_ERROR.getStatus(null)); - } - return (IRuntimeClasspathProvider) obj; - } - - private static ICoverageLaunchInfo getLaunchInfo() throws CoreException { - Object obj = launchInfo.get(); - if (obj == null) { - throw new CoreException(EclEmmaStatus.INVALID_CLASSPATH_PROVIDER_CONTEXT_ERROR.getStatus(null)); - } - return (ICoverageLaunchInfo) obj; - } - - // IRuntimeClasspathProvider implementation - - public IRuntimeClasspathEntry[] computeUnresolvedClasspath( - ILaunchConfiguration configuration) throws CoreException { - IRuntimeClasspathEntry[] entries = getOriginalClasspathProvider().computeUnresolvedClasspath( - configuration); - TRACER.trace("computeUnresolvedClasspath() -> {0}", Arrays.asList(entries)); //$NON-NLS-1$ - return entries; - } - - public IRuntimeClasspathEntry[] resolveClasspath( - IRuntimeClasspathEntry[] entries, ILaunchConfiguration configuration) - throws CoreException { - TRACER.trace("resolveClasspath()"); //$NON-NLS-1$ - ICoverageLaunchInfo info = getLaunchInfo(); - entries = getOriginalClasspathProvider().resolveClasspath(entries, configuration); - List newentries = new ArrayList(); - boolean emmartinserted = false; - for (int i = 0; i < entries.length; i++) { - if (entries[i].getClasspathProperty() == IRuntimeClasspathEntry.USER_CLASSES) { - TRACER.trace("Resolved classpath entry: {0}", entries[i].getLocation()); //$NON-NLS-1$ - IInstrumentation instr = info.getInstrumentation(entries[i].getLocation()); - if (instr != null) { - TRACER.trace("Found instrumented classes for {0}", entries[i].getLocation()); //$NON-NLS-1$ - if (!emmartinserted) { - addEmmaRuntime(info, newentries); - emmartinserted = true; - } - if (!instr.isInplace()) { - newentries.add(JavaRuntime.newArchiveRuntimeClasspathEntry(instr.getOutputLocation())); - } - } - } - newentries.add(entries[i]); - } - IRuntimeClasspathEntry[] arr = new IRuntimeClasspathEntry[newentries.size()]; - return (IRuntimeClasspathEntry[]) newentries.toArray(arr); - } - - protected void addEmmaRuntime(ICoverageLaunchInfo info, List entries) throws CoreException { - IPath propertiesjarpath = info.getPropertiesJARFile(); - entries.add(0, JavaRuntime.newArchiveRuntimeClasspathEntry(propertiesjarpath)); - entries.add(0, JavaRuntime.newArchiveRuntimeClasspathEntry(CoverageTools.getEmmaJar())); - } - -} diff --git a/com.mountainminds.eclemma.ui/.classpath b/com.mountainminds.eclemma.ui/.classpath deleted file mode 100644 index 2fbb7a2..0000000 --- a/com.mountainminds.eclemma.ui/.classpath +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/com.mountainminds.eclemma.ui/.project b/com.mountainminds.eclemma.ui/.project deleted file mode 100644 index f866df3..0000000 --- a/com.mountainminds.eclemma.ui/.project +++ /dev/null @@ -1,28 +0,0 @@ - - - com.mountainminds.eclemma.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/com.mountainminds.eclemma.ui/.settings/org.eclipse.jdt.core.prefs b/com.mountainminds.eclemma.ui/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 1898baa..0000000 --- a/com.mountainminds.eclemma.ui/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,326 +0,0 @@ -#Thu Jan 29 21:39:08 CET 2009 -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.2 -org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=1.4 -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=warning -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=warning -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=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.3 -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=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=1 -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=true -org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true -org.eclipse.jdt.core.formatter.comment.format_line_comments=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_annotation_on_local_variable=insert -org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_member=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_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.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.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=1 -org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true -org.eclipse.jdt.core.formatter.tabulation.char=space -org.eclipse.jdt.core.formatter.tabulation.size=2 -org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false -org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true diff --git a/com.mountainminds.eclemma.ui/.settings/org.eclipse.jdt.ui.prefs b/com.mountainminds.eclemma.ui/.settings/org.eclipse.jdt.ui.prefs deleted file mode 100644 index ec350bc..0000000 --- a/com.mountainminds.eclemma.ui/.settings/org.eclipse.jdt.ui.prefs +++ /dev/null @@ -1,56 +0,0 @@ -#Sat Jan 24 15:41:03 CET 2009 -eclipse.preferences.version=1 -editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true -formatter_profile=_EclEmma -formatter_settings_version=11 -sp_cleanup.add_default_serial_version_id=true -sp_cleanup.add_generated_serial_version_id=false -sp_cleanup.add_missing_annotations=true -sp_cleanup.add_missing_deprecated_annotations=true -sp_cleanup.add_missing_methods=false -sp_cleanup.add_missing_nls_tags=false -sp_cleanup.add_missing_override_annotations=true -sp_cleanup.add_serial_version_id=false -sp_cleanup.always_use_blocks=true -sp_cleanup.always_use_parentheses_in_expressions=false -sp_cleanup.always_use_this_for_non_static_field_access=false -sp_cleanup.always_use_this_for_non_static_method_access=false -sp_cleanup.convert_to_enhanced_for_loop=false -sp_cleanup.correct_indentation=false -sp_cleanup.format_source_code=true -sp_cleanup.format_source_code_changes_only=false -sp_cleanup.make_local_variable_final=false -sp_cleanup.make_parameters_final=false -sp_cleanup.make_private_fields_final=true -sp_cleanup.make_type_abstract_if_missing_method=false -sp_cleanup.make_variable_declarations_final=true -sp_cleanup.never_use_blocks=false -sp_cleanup.never_use_parentheses_in_expressions=true -sp_cleanup.on_save_use_additional_actions=false -sp_cleanup.organize_imports=true -sp_cleanup.qualify_static_field_accesses_with_declaring_class=false -sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true -sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true -sp_cleanup.qualify_static_member_accesses_with_declaring_class=false -sp_cleanup.qualify_static_method_accesses_with_declaring_class=false -sp_cleanup.remove_private_constructors=true -sp_cleanup.remove_trailing_whitespaces=false -sp_cleanup.remove_trailing_whitespaces_all=true -sp_cleanup.remove_trailing_whitespaces_ignore_empty=false -sp_cleanup.remove_unnecessary_casts=true -sp_cleanup.remove_unnecessary_nls_tags=false -sp_cleanup.remove_unused_imports=false -sp_cleanup.remove_unused_local_variables=false -sp_cleanup.remove_unused_private_fields=true -sp_cleanup.remove_unused_private_members=false -sp_cleanup.remove_unused_private_methods=true -sp_cleanup.remove_unused_private_types=true -sp_cleanup.sort_members=false -sp_cleanup.sort_members_all=false -sp_cleanup.use_blocks=false -sp_cleanup.use_blocks_only_for_return_and_throw=false -sp_cleanup.use_parentheses_in_expressions=false -sp_cleanup.use_this_for_non_static_field_access=false -sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true -sp_cleanup.use_this_for_non_static_method_access=false -sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true diff --git a/com.mountainminds.eclemma.ui/META-INF/MANIFEST.MF b/com.mountainminds.eclemma.ui/META-INF/MANIFEST.MF deleted file mode 100644 index c7235d0..0000000 --- a/com.mountainminds.eclemma.ui/META-INF/MANIFEST.MF +++ /dev/null @@ -1,25 +0,0 @@ -Manifest-Version: 1.0 -Bundle-ManifestVersion: 2 -Bundle-Name: %pluginName -Bundle-SymbolicName: com.mountainminds.eclemma.ui; singleton:=true -Bundle-Version: 1.5.2 -Bundle-Vendor: %providerName -Bundle-Localization: plugin -Require-Bundle: com.mountainminds.eclemma.core, - org.eclipse.core.runtime, - org.eclipse.core.expressions, - org.eclipse.core.resources, - org.eclipse.debug.core, - org.eclipse.debug.ui, - org.eclipse.jdt.core, - org.eclipse.jdt.launching, - org.eclipse.jdt.ui, - org.eclipse.ui, - org.eclipse.ui.ide, - org.eclipse.jface.text, - org.eclipse.ui.workbench.texteditor, - org.eclipse.ui.editors -Bundle-Activator: com.mountainminds.eclemma.internal.ui.EclEmmaUIPlugin -Eclipse-AutoStart: true -Export-Package: com.mountainminds.eclemma.ui.launching - diff --git a/com.mountainminds.eclemma.ui/about.html b/com.mountainminds.eclemma.ui/about.html deleted file mode 100644 index d7ca144..0000000 --- a/com.mountainminds.eclemma.ui/about.html +++ /dev/null @@ -1,28 +0,0 @@ - - - -About - - - -

About This Content

- -

- EclEmma is a free Java code coverage tool for Eclipse implemented by Marc R. - Hoffmann. It is based on EMMA - by Vlad Roubtsov. Check http://www.eclemma.org/ - for updates, documentation and support. -

- -

License

- -

- The Content in this plug-in is Contributed by Mountainminds GmbH & Co. KG, - Munich. Except 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. -

- - - \ No newline at end of file diff --git a/com.mountainminds.eclemma.ui/about.ini b/com.mountainminds.eclemma.ui/about.ini deleted file mode 100644 index b28cb66..0000000 --- a/com.mountainminds.eclemma.ui/about.ini +++ /dev/null @@ -1,10 +0,0 @@ -#******************************************************************************* -# Copyright (c) 2006 Mountainminds GmbH & Co. KG -# This software is provided under the terms of the Eclipse Public License v1.0 -# See http://www.eclipse.org/legal/epl-v10.html. -# -# $Id$ -#******************************************************************************* - -aboutText=%aboutText -featureImage=eclemma32.gif diff --git a/com.mountainminds.eclemma.ui/about.properties b/com.mountainminds.eclemma.ui/about.properties deleted file mode 100644 index 8b55c60..0000000 --- a/com.mountainminds.eclemma.ui/about.properties +++ /dev/null @@ -1,19 +0,0 @@ -#******************************************************************************* -# Copyright (c) 2006, 2011 Mountainminds GmbH & Co. KG -# This software is provided under the terms of the Eclipse Public License v1.0 -# See http://www.eclipse.org/legal/epl-v10.html. -# -# $Id$ -#******************************************************************************* - -aboutText=EclEmma {featureVersion}\n\ -\n\ -Free Java code coverage for Eclipse implemented by Marc R. Hoffmann,\n\ -distributed under the terms of the Eclipse Public License 1.0\n\ -\n\ -(c) Copyright Mountainminds GmbH & Co. KG 2006, 2011\n\ -\n\ -This software includes EMMA by Vlad Roubtsov which is distributed under the\n\ -terms of the Common Public License Version 1.0, http://emma.sourceforge.net/\n\ -\n\ -Check http://www.eclemma.org/ for updates, documentation and support. diff --git a/com.mountainminds.eclemma.ui/build.properties b/com.mountainminds.eclemma.ui/build.properties deleted file mode 100644 index 0f83770..0000000 --- a/com.mountainminds.eclemma.ui/build.properties +++ /dev/null @@ -1,15 +0,0 @@ -source.. = src/ -output.. = bin/ -bin.includes = META-INF/,\ - .,\ - plugin.xml,\ - icons/,\ - plugin.properties,\ - about.html,\ - about.ini,\ - about.properties,\ - eclemma32.gif -src.includes = src/,\ - build.properties -javacSource = 1.3 -javacTarget = 1.2 diff --git a/com.mountainminds.eclemma.ui/eclemma32.gif b/com.mountainminds.eclemma.ui/eclemma32.gif deleted file mode 100644 index 1d79366..0000000 Binary files a/com.mountainminds.eclemma.ui/eclemma32.gif and /dev/null differ diff --git a/com.mountainminds.eclemma.ui/icons/full/dlcl16/export.gif b/com.mountainminds.eclemma.ui/icons/full/dlcl16/export.gif deleted file mode 100644 index 3f89cd9..0000000 Binary files a/com.mountainminds.eclemma.ui/icons/full/dlcl16/export.gif and /dev/null differ diff --git a/com.mountainminds.eclemma.ui/icons/full/dlcl16/import.gif b/com.mountainminds.eclemma.ui/icons/full/dlcl16/import.gif deleted file mode 100644 index cd44741..0000000 Binary files a/com.mountainminds.eclemma.ui/icons/full/dlcl16/import.gif and /dev/null differ diff --git a/com.mountainminds.eclemma.ui/icons/full/dlcl16/mergesessions.gif b/com.mountainminds.eclemma.ui/icons/full/dlcl16/mergesessions.gif deleted file mode 100644 index 22fe372..0000000 Binary files a/com.mountainminds.eclemma.ui/icons/full/dlcl16/mergesessions.gif and /dev/null differ diff --git a/com.mountainminds.eclemma.ui/icons/full/dlcl16/refresh.gif b/com.mountainminds.eclemma.ui/icons/full/dlcl16/refresh.gif deleted file mode 100644 index 478cff5..0000000 Binary files a/com.mountainminds.eclemma.ui/icons/full/dlcl16/refresh.gif and /dev/null differ diff --git a/com.mountainminds.eclemma.ui/icons/full/dlcl16/relaunch.gif b/com.mountainminds.eclemma.ui/icons/full/dlcl16/relaunch.gif deleted file mode 100644 index ff20043..0000000 Binary files a/com.mountainminds.eclemma.ui/icons/full/dlcl16/relaunch.gif and /dev/null differ diff --git a/com.mountainminds.eclemma.ui/icons/full/dlcl16/remove.gif b/com.mountainminds.eclemma.ui/icons/full/dlcl16/remove.gif deleted file mode 100644 index 559e462..0000000 Binary files a/com.mountainminds.eclemma.ui/icons/full/dlcl16/remove.gif and /dev/null differ diff --git a/com.mountainminds.eclemma.ui/icons/full/dlcl16/removeall.gif b/com.mountainminds.eclemma.ui/icons/full/dlcl16/removeall.gif deleted file mode 100644 index ecd1be5..0000000 Binary files a/com.mountainminds.eclemma.ui/icons/full/dlcl16/removeall.gif and /dev/null differ diff --git a/com.mountainminds.eclemma.ui/icons/full/dlcl16/runcoverage.gif b/com.mountainminds.eclemma.ui/icons/full/dlcl16/runcoverage.gif deleted file mode 100644 index b4f2903..0000000 Binary files a/com.mountainminds.eclemma.ui/icons/full/dlcl16/runcoverage.gif and /dev/null differ diff --git a/com.mountainminds.eclemma.ui/icons/full/dlcl16/session.gif b/com.mountainminds.eclemma.ui/icons/full/dlcl16/session.gif deleted file mode 100644 index 6996daa..0000000 Binary files a/com.mountainminds.eclemma.ui/icons/full/dlcl16/session.gif and /dev/null differ diff --git a/com.mountainminds.eclemma.ui/icons/full/elcl16/collapseall.gif b/com.mountainminds.eclemma.ui/icons/full/elcl16/collapseall.gif deleted file mode 100644 index dc923f5..0000000 Binary files a/com.mountainminds.eclemma.ui/icons/full/elcl16/collapseall.gif and /dev/null differ diff --git a/com.mountainminds.eclemma.ui/icons/full/elcl16/export.gif b/com.mountainminds.eclemma.ui/icons/full/elcl16/export.gif deleted file mode 100644 index 5a0837d..0000000 Binary files a/com.mountainminds.eclemma.ui/icons/full/elcl16/export.gif and /dev/null differ diff --git a/com.mountainminds.eclemma.ui/icons/full/elcl16/import.gif b/com.mountainminds.eclemma.ui/icons/full/elcl16/import.gif deleted file mode 100644 index d38085a..0000000 Binary files a/com.mountainminds.eclemma.ui/icons/full/elcl16/import.gif and /dev/null differ diff --git a/com.mountainminds.eclemma.ui/icons/full/elcl16/java_ovr.gif b/com.mountainminds.eclemma.ui/icons/full/elcl16/java_ovr.gif deleted file mode 100644 index 564bb12..0000000 Binary files a/com.mountainminds.eclemma.ui/icons/full/elcl16/java_ovr.gif and /dev/null differ diff --git a/com.mountainminds.eclemma.ui/icons/full/elcl16/linked.gif b/com.mountainminds.eclemma.ui/icons/full/elcl16/linked.gif deleted file mode 100644 index 870934b..0000000 Binary files a/com.mountainminds.eclemma.ui/icons/full/elcl16/linked.gif and /dev/null differ diff --git a/com.mountainminds.eclemma.ui/icons/full/elcl16/mergesessions.gif b/com.mountainminds.eclemma.ui/icons/full/elcl16/mergesessions.gif deleted file mode 100644 index f025229..0000000 Binary files a/com.mountainminds.eclemma.ui/icons/full/elcl16/mergesessions.gif and /dev/null differ diff --git a/com.mountainminds.eclemma.ui/icons/full/elcl16/refresh.gif b/com.mountainminds.eclemma.ui/icons/full/elcl16/refresh.gif deleted file mode 100644 index 3ca04d0..0000000 Binary files a/com.mountainminds.eclemma.ui/icons/full/elcl16/refresh.gif and /dev/null differ diff --git a/com.mountainminds.eclemma.ui/icons/full/elcl16/relaunch.gif b/com.mountainminds.eclemma.ui/icons/full/elcl16/relaunch.gif deleted file mode 100644 index d8eeeaf..0000000 Binary files a/com.mountainminds.eclemma.ui/icons/full/elcl16/relaunch.gif and /dev/null differ diff --git a/com.mountainminds.eclemma.ui/icons/full/elcl16/remove.gif b/com.mountainminds.eclemma.ui/icons/full/elcl16/remove.gif deleted file mode 100644 index 2cd9c54..0000000 Binary files a/com.mountainminds.eclemma.ui/icons/full/elcl16/remove.gif and /dev/null differ diff --git a/com.mountainminds.eclemma.ui/icons/full/elcl16/removeall.gif b/com.mountainminds.eclemma.ui/icons/full/elcl16/removeall.gif deleted file mode 100644 index 28a3785..0000000 Binary files a/com.mountainminds.eclemma.ui/icons/full/elcl16/removeall.gif and /dev/null differ diff --git a/com.mountainminds.eclemma.ui/icons/full/elcl16/runcoverage.gif b/com.mountainminds.eclemma.ui/icons/full/elcl16/runcoverage.gif deleted file mode 100644 index 8f141a2..0000000 Binary files a/com.mountainminds.eclemma.ui/icons/full/elcl16/runcoverage.gif and /dev/null differ diff --git a/com.mountainminds.eclemma.ui/icons/full/elcl16/session.gif b/com.mountainminds.eclemma.ui/icons/full/elcl16/session.gif deleted file mode 100644 index 6354062..0000000 Binary files a/com.mountainminds.eclemma.ui/icons/full/elcl16/session.gif and /dev/null differ diff --git a/com.mountainminds.eclemma.ui/icons/full/elcl16/showpackageroots.gif b/com.mountainminds.eclemma.ui/icons/full/elcl16/showpackageroots.gif deleted file mode 100644 index fca9c53..0000000 Binary files a/com.mountainminds.eclemma.ui/icons/full/elcl16/showpackageroots.gif and /dev/null differ diff --git a/com.mountainminds.eclemma.ui/icons/full/elcl16/showpackages.gif b/com.mountainminds.eclemma.ui/icons/full/elcl16/showpackages.gif deleted file mode 100644 index 131c28d..0000000 Binary files a/com.mountainminds.eclemma.ui/icons/full/elcl16/showpackages.gif and /dev/null differ diff --git a/com.mountainminds.eclemma.ui/icons/full/elcl16/showprojects.gif b/com.mountainminds.eclemma.ui/icons/full/elcl16/showprojects.gif deleted file mode 100644 index 9e2d3d1..0000000 Binary files a/com.mountainminds.eclemma.ui/icons/full/elcl16/showprojects.gif and /dev/null differ diff --git a/com.mountainminds.eclemma.ui/icons/full/elcl16/showtypes.gif b/com.mountainminds.eclemma.ui/icons/full/elcl16/showtypes.gif deleted file mode 100644 index 5ba5b91..0000000 Binary files a/com.mountainminds.eclemma.ui/icons/full/elcl16/showtypes.gif and /dev/null differ diff --git a/com.mountainminds.eclemma.ui/icons/full/etool16/eclipse_launch.gif b/com.mountainminds.eclemma.ui/icons/full/etool16/eclipse_launch.gif deleted file mode 100644 index eb7b90c..0000000 Binary files a/com.mountainminds.eclemma.ui/icons/full/etool16/eclipse_launch.gif and /dev/null differ diff --git a/com.mountainminds.eclemma.ui/icons/full/etool16/java_launch.gif b/com.mountainminds.eclemma.ui/icons/full/etool16/java_launch.gif deleted file mode 100644 index a42a7c8..0000000 Binary files a/com.mountainminds.eclemma.ui/icons/full/etool16/java_launch.gif and /dev/null differ diff --git a/com.mountainminds.eclemma.ui/icons/full/etool16/junit_launch.gif b/com.mountainminds.eclemma.ui/icons/full/etool16/junit_launch.gif deleted file mode 100644 index ec4885d..0000000 Binary files a/com.mountainminds.eclemma.ui/icons/full/etool16/junit_launch.gif and /dev/null differ diff --git a/com.mountainminds.eclemma.ui/icons/full/etool16/junitplugin_launch.gif b/com.mountainminds.eclemma.ui/icons/full/etool16/junitplugin_launch.gif deleted file mode 100644 index 6e4ff2c..0000000 Binary files a/com.mountainminds.eclemma.ui/icons/full/etool16/junitplugin_launch.gif and /dev/null differ diff --git a/com.mountainminds.eclemma.ui/icons/full/etool16/session_export.gif b/com.mountainminds.eclemma.ui/icons/full/etool16/session_export.gif deleted file mode 100644 index ede6d4c..0000000 Binary files a/com.mountainminds.eclemma.ui/icons/full/etool16/session_export.gif and /dev/null differ diff --git a/com.mountainminds.eclemma.ui/icons/full/etool16/session_import.gif b/com.mountainminds.eclemma.ui/icons/full/etool16/session_import.gif deleted file mode 100644 index 112b9e6..0000000 Binary files a/com.mountainminds.eclemma.ui/icons/full/etool16/session_import.gif and /dev/null differ diff --git a/com.mountainminds.eclemma.ui/icons/full/etool16/swtbot_launch.gif b/com.mountainminds.eclemma.ui/icons/full/etool16/swtbot_launch.gif deleted file mode 100644 index 8a43c77..0000000 Binary files a/com.mountainminds.eclemma.ui/icons/full/etool16/swtbot_launch.gif and /dev/null differ diff --git a/com.mountainminds.eclemma.ui/icons/full/eview16/coverage.gif b/com.mountainminds.eclemma.ui/icons/full/eview16/coverage.gif deleted file mode 100644 index 8547be5..0000000 Binary files a/com.mountainminds.eclemma.ui/icons/full/eview16/coverage.gif and /dev/null differ diff --git a/com.mountainminds.eclemma.ui/icons/full/obj16/coverage00.gif b/com.mountainminds.eclemma.ui/icons/full/obj16/coverage00.gif deleted file mode 100644 index 29c0b57..0000000 Binary files a/com.mountainminds.eclemma.ui/icons/full/obj16/coverage00.gif and /dev/null differ diff --git a/com.mountainminds.eclemma.ui/icons/full/obj16/coverage01.gif b/com.mountainminds.eclemma.ui/icons/full/obj16/coverage01.gif deleted file mode 100644 index 2c1b506..0000000 Binary files a/com.mountainminds.eclemma.ui/icons/full/obj16/coverage01.gif and /dev/null differ diff --git a/com.mountainminds.eclemma.ui/icons/full/obj16/coverage02.gif b/com.mountainminds.eclemma.ui/icons/full/obj16/coverage02.gif deleted file mode 100644 index b7b3a97..0000000 Binary files a/com.mountainminds.eclemma.ui/icons/full/obj16/coverage02.gif and /dev/null differ diff --git a/com.mountainminds.eclemma.ui/icons/full/obj16/coverage03.gif b/com.mountainminds.eclemma.ui/icons/full/obj16/coverage03.gif deleted file mode 100644 index b934ab2..0000000 Binary files a/com.mountainminds.eclemma.ui/icons/full/obj16/coverage03.gif and /dev/null differ diff --git a/com.mountainminds.eclemma.ui/icons/full/obj16/coverage04.gif b/com.mountainminds.eclemma.ui/icons/full/obj16/coverage04.gif deleted file mode 100644 index 3f103de..0000000 Binary files a/com.mountainminds.eclemma.ui/icons/full/obj16/coverage04.gif and /dev/null differ diff --git a/com.mountainminds.eclemma.ui/icons/full/obj16/coverage05.gif b/com.mountainminds.eclemma.ui/icons/full/obj16/coverage05.gif deleted file mode 100644 index f2d2583..0000000 Binary files a/com.mountainminds.eclemma.ui/icons/full/obj16/coverage05.gif and /dev/null differ diff --git a/com.mountainminds.eclemma.ui/icons/full/obj16/coverage06.gif b/com.mountainminds.eclemma.ui/icons/full/obj16/coverage06.gif deleted file mode 100644 index 7ef9df8..0000000 Binary files a/com.mountainminds.eclemma.ui/icons/full/obj16/coverage06.gif and /dev/null differ diff --git a/com.mountainminds.eclemma.ui/icons/full/obj16/coverage07.gif b/com.mountainminds.eclemma.ui/icons/full/obj16/coverage07.gif deleted file mode 100644 index 188784b..0000000 Binary files a/com.mountainminds.eclemma.ui/icons/full/obj16/coverage07.gif and /dev/null differ diff --git a/com.mountainminds.eclemma.ui/icons/full/obj16/coverage08.gif b/com.mountainminds.eclemma.ui/icons/full/obj16/coverage08.gif deleted file mode 100644 index c054650..0000000 Binary files a/com.mountainminds.eclemma.ui/icons/full/obj16/coverage08.gif and /dev/null differ diff --git a/com.mountainminds.eclemma.ui/icons/full/obj16/coverage09.gif b/com.mountainminds.eclemma.ui/icons/full/obj16/coverage09.gif deleted file mode 100644 index 62bfe33..0000000 Binary files a/com.mountainminds.eclemma.ui/icons/full/obj16/coverage09.gif and /dev/null differ diff --git a/com.mountainminds.eclemma.ui/icons/full/obj16/coverage10.gif b/com.mountainminds.eclemma.ui/icons/full/obj16/coverage10.gif deleted file mode 100644 index d11b519..0000000 Binary files a/com.mountainminds.eclemma.ui/icons/full/obj16/coverage10.gif and /dev/null differ diff --git a/com.mountainminds.eclemma.ui/icons/full/obj16/coverage11.gif b/com.mountainminds.eclemma.ui/icons/full/obj16/coverage11.gif deleted file mode 100644 index b49eefd..0000000 Binary files a/com.mountainminds.eclemma.ui/icons/full/obj16/coverage11.gif and /dev/null differ diff --git a/com.mountainminds.eclemma.ui/icons/full/obj16/coverage12.gif b/com.mountainminds.eclemma.ui/icons/full/obj16/coverage12.gif deleted file mode 100644 index 6b9cecb..0000000 Binary files a/com.mountainminds.eclemma.ui/icons/full/obj16/coverage12.gif and /dev/null differ diff --git a/com.mountainminds.eclemma.ui/icons/full/obj16/markerfull.gif b/com.mountainminds.eclemma.ui/icons/full/obj16/markerfull.gif deleted file mode 100644 index f761fcb..0000000 Binary files a/com.mountainminds.eclemma.ui/icons/full/obj16/markerfull.gif and /dev/null differ diff --git a/com.mountainminds.eclemma.ui/icons/full/obj16/markerno.gif b/com.mountainminds.eclemma.ui/icons/full/obj16/markerno.gif deleted file mode 100644 index 164b941..0000000 Binary files a/com.mountainminds.eclemma.ui/icons/full/obj16/markerno.gif and /dev/null differ diff --git a/com.mountainminds.eclemma.ui/icons/full/obj16/markerpartial.gif b/com.mountainminds.eclemma.ui/icons/full/obj16/markerpartial.gif deleted file mode 100644 index 787d1d6..0000000 Binary files a/com.mountainminds.eclemma.ui/icons/full/obj16/markerpartial.gif and /dev/null differ diff --git a/com.mountainminds.eclemma.ui/icons/full/obj16/session.gif b/com.mountainminds.eclemma.ui/icons/full/obj16/session.gif deleted file mode 100644 index 6354062..0000000 Binary files a/com.mountainminds.eclemma.ui/icons/full/obj16/session.gif and /dev/null differ diff --git a/com.mountainminds.eclemma.ui/icons/full/ovr16/coverage00.gif b/com.mountainminds.eclemma.ui/icons/full/ovr16/coverage00.gif deleted file mode 100644 index dff1380..0000000 Binary files a/com.mountainminds.eclemma.ui/icons/full/ovr16/coverage00.gif and /dev/null differ diff --git a/com.mountainminds.eclemma.ui/icons/full/ovr16/coverage01.gif b/com.mountainminds.eclemma.ui/icons/full/ovr16/coverage01.gif deleted file mode 100644 index 9893c25..0000000 Binary files a/com.mountainminds.eclemma.ui/icons/full/ovr16/coverage01.gif and /dev/null differ diff --git a/com.mountainminds.eclemma.ui/icons/full/ovr16/coverage02.gif b/com.mountainminds.eclemma.ui/icons/full/ovr16/coverage02.gif deleted file mode 100644 index 5d9295e..0000000 Binary files a/com.mountainminds.eclemma.ui/icons/full/ovr16/coverage02.gif and /dev/null differ diff --git a/com.mountainminds.eclemma.ui/icons/full/ovr16/coverage03.gif b/com.mountainminds.eclemma.ui/icons/full/ovr16/coverage03.gif deleted file mode 100644 index afb2da3..0000000 Binary files a/com.mountainminds.eclemma.ui/icons/full/ovr16/coverage03.gif and /dev/null differ diff --git a/com.mountainminds.eclemma.ui/icons/full/ovr16/coverage04.gif b/com.mountainminds.eclemma.ui/icons/full/ovr16/coverage04.gif deleted file mode 100644 index dc46fee..0000000 Binary files a/com.mountainminds.eclemma.ui/icons/full/ovr16/coverage04.gif and /dev/null differ diff --git a/com.mountainminds.eclemma.ui/icons/full/ovr16/coverage05.gif b/com.mountainminds.eclemma.ui/icons/full/ovr16/coverage05.gif deleted file mode 100644 index 4f5d1fa..0000000 Binary files a/com.mountainminds.eclemma.ui/icons/full/ovr16/coverage05.gif and /dev/null differ diff --git a/com.mountainminds.eclemma.ui/icons/full/ovr16/coverage06.gif b/com.mountainminds.eclemma.ui/icons/full/ovr16/coverage06.gif deleted file mode 100644 index aafe1a5..0000000 Binary files a/com.mountainminds.eclemma.ui/icons/full/ovr16/coverage06.gif and /dev/null differ diff --git a/com.mountainminds.eclemma.ui/icons/full/ovr16/coverage07.gif b/com.mountainminds.eclemma.ui/icons/full/ovr16/coverage07.gif deleted file mode 100644 index 0c81240..0000000 Binary files a/com.mountainminds.eclemma.ui/icons/full/ovr16/coverage07.gif and /dev/null differ diff --git a/com.mountainminds.eclemma.ui/icons/full/wizban/export_session.gif b/com.mountainminds.eclemma.ui/icons/full/wizban/export_session.gif deleted file mode 100644 index de98440..0000000 Binary files a/com.mountainminds.eclemma.ui/icons/full/wizban/export_session.gif and /dev/null differ diff --git a/com.mountainminds.eclemma.ui/icons/full/wizban/import_session.gif b/com.mountainminds.eclemma.ui/icons/full/wizban/import_session.gif deleted file mode 100644 index 9280485..0000000 Binary files a/com.mountainminds.eclemma.ui/icons/full/wizban/import_session.gif and /dev/null differ diff --git a/com.mountainminds.eclemma.ui/icons/full/wizban/run_coverage.gif b/com.mountainminds.eclemma.ui/icons/full/wizban/run_coverage.gif deleted file mode 100644 index e9a481d..0000000 Binary files a/com.mountainminds.eclemma.ui/icons/full/wizban/run_coverage.gif and /dev/null differ diff --git a/com.mountainminds.eclemma.ui/plugin.properties b/com.mountainminds.eclemma.ui/plugin.properties deleted file mode 100644 index 320ec4f..0000000 --- a/com.mountainminds.eclemma.ui/plugin.properties +++ /dev/null @@ -1,75 +0,0 @@ -#******************************************************************************* -# Copyright (c) 2006 Mountainminds GmbH & Co. KG -# This software is provided under the terms of the Eclipse Public License v1.0 -# See http://www.eclipse.org/legal/epl-v10.html. -# -# $Id$ -#******************************************************************************* - -providerName = Mountainminds GmbH & Co. KG -pluginName = EclEmma UI - -JavaApplicationShortcut.label = Java Application -JUnitTestShortcut.label = JUnit Test -EclipseApplicationShortcut.label = Eclipse Application -JUnitPluginTestShortcut.label = JUnit Plug-in Test -JUnitRAPTestShortcut.label = RAP JUnit Test -SWTBotJUnitShortcut.label = SWTBot Test - -CoverageLastCommand.name = Coverage Last Launched -CoverageLastCommand.description = Coverage Last Launched -OpenCoverageConfigurationsCommand.name = Coverage... -OpenCoverageConfigurationsCommand.description = Coverage... -CoverageJavaApplicationCommand.name = Coverage Java Application -CoverageJavaApplicationCommand.description = Coverage Java Application -CoverageJUnitTestCommand.name = Coverage JUnit Test -CoverageJUnitTestCommand.description = Coverage JUnit Test -CoverageEclipseApplicationCommand.name = Coverage Eclipse Application -CoverageEclipseApplicationCommand.description = Coverage Eclipse Application -CoverageJUnitPluginTestCommand.name = Coverage JUnit Plug-in Test -CoverageJUnitPluginTestCommand.description = Coverage JUnit Plug-in Test -CoverageJUnitRAPTestCommand.name = Coverage RAP JUnit Test -CoverageJUnitRAPTestCommand.description = Coverage RAP JUnit Test -CoverageSWTBotJUnitCommand.name = Coverage SWTBot Test -CoverageSWTBotJUnitCommand.description = Coverage SWTBot Test - -RunMenu.label = &Run -CoverageActionSet.label = Coverage -CoverageDropDownAction.label = Coverage -OpenCoverageConfigurationsAction.label = Coverage... -CoverageLastAction.label = Coverage Last Launched -CoverageAsAction.label = Coverage As -CoverageHistoryAction.label = Coverage History - -CoverageLaunchGroup.label = Coverage -CoverageLaunchGroup.title = Select or configure an application for coverage -localJavaApplicationTabGroupDescription.coverage = Coverage of a Java application. -junitTabGroupDescription.coverage = Coverage of a JUnit test run. -eclipseAppTabGroupDescription.coverage = Coverage of a Eclipse application. -junitPluginTabGroupDescription.coverage = Coverage of a JUnit plug-in test run. -equinoxTabGroupDescription.coverage = Coverage of a Equinox OSGi framework launch. -testNGTabGroupDescription.coverage = Coverage of a TestNG test run. -junitRAPTabGroupDescription.coverage = Coverage of a RAP JUnit test run. -swtBotJUnitTabGroupDescription.coverage = Coverage of a SWTBot test run. - -CoverageContextMenu.label = Co&verage As - -coverageView.title = Coverage -fullCoverageAnnotation.label = Full Coverage -partialCoverageAnnotation.label = Partial Coverage -noCoverageAnnotation.label = No Coverage - -exportReport.title = Coverage Report -exportReport.description = Export a coverage report from a Java coverage session. - -importReport.title = Coverage Session -importReport.description = Import a Java coverage session from an external program run. - -coveragePropertyPage.title = Coverage - -coverageDecorator.label = Java Code Coverage -coverageDecorator.description = Adds Java code coverage information to Java elements show in the package explorer. - -coveragePreferences.title = Code Coverage - -keywords.coveragePreferences = code coverage eclemma test diff --git a/com.mountainminds.eclemma.ui/plugin.xml b/com.mountainminds.eclemma.ui/plugin.xml deleted file mode 100644 index a4fa648..0000000 --- a/com.mountainminds.eclemma.ui/plugin.xml +++ /dev/null @@ -1,579 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - %importReport.description - - - - - %exportReport.description - - - - - - - - - - - %coverageDecorator.description - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/com.mountainminds.eclemma.ui/src/com/mountainminds/eclemma/internal/ui/ContextHelp.java b/com.mountainminds.eclemma.ui/src/com/mountainminds/eclemma/internal/ui/ContextHelp.java deleted file mode 100644 index 8790263..0000000 --- a/com.mountainminds.eclemma.ui/src/com/mountainminds/eclemma/internal/ui/ContextHelp.java +++ /dev/null @@ -1,49 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2007 Mountainminds GmbH & Co. KG - * This software is provided under the terms of the Eclipse Public License v1.0 - * See http://www.eclipse.org/legal/epl-v10.html. - * - * $Id: $ - ******************************************************************************/ -package com.mountainminds.eclemma.internal.ui; - -import org.eclipse.swt.widgets.Control; -import org.eclipse.ui.PlatformUI; - -/** - * Constants and utility methods for context help. - * - * @author Marc R. Hoffmann - * @version $Revision: $ - */ -public class ContextHelp { - - private static final String PREFIX = EclEmmaUIPlugin.ID + "."; //$NON-NLS-1$ - - public static final String COVERAGE_VIEW = PREFIX + "coverage_view_context"; //$NON-NLS-1$ - - public static final String COVERAGE_PROPERTIES = PREFIX + "coverage_properties_context"; //$NON-NLS-1$ - - public static final String COVERAGE_PREFERENCES = PREFIX + "coverage_preferences_context"; //$NON-NLS-1$ - - public static final String COVERAGE_LAUNCH = PREFIX + "coverage_launch_context"; //$NON-NLS-1$ - - public static final String COVERAGE_LAUNCH_TAB = PREFIX + "coverage_launch_tab_context"; //$NON-NLS-1$ - - public static final String MERGE_SESSIONS = PREFIX + "merge_sessions_context"; //$NON-NLS-1$ - - public static final String SESSION_EXPORT = PREFIX + "session_export_context"; //$NON-NLS-1$ - - public static final String SESSION_IMPORT = PREFIX + "session_import_context"; //$NON-NLS-1$ - - /** - * Assigns the given context help id to a SWT control. - * - * @param control control for this help context - * @param id context help id - */ - public static void setHelp(Control control, String id) { - PlatformUI.getWorkbench().getHelpSystem().setHelp(control, id); - } - -} diff --git a/com.mountainminds.eclemma.ui/src/com/mountainminds/eclemma/internal/ui/EclEmmaUIPlugin.java b/com.mountainminds.eclemma.ui/src/com/mountainminds/eclemma/internal/ui/EclEmmaUIPlugin.java deleted file mode 100644 index 8653052..0000000 --- a/com.mountainminds.eclemma.ui/src/com/mountainminds/eclemma/internal/ui/EclEmmaUIPlugin.java +++ /dev/null @@ -1,209 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Mountainminds GmbH & Co. KG - * This software is provided under the terms of the Eclipse Public License v1.0 - * See http://www.eclipse.org/legal/epl-v10.html. - * - * $Id$ - ******************************************************************************/ -package com.mountainminds.eclemma.internal.ui; - -import java.net.URL; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.jface.resource.ImageRegistry; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.ui.IViewPart; -import org.eclipse.ui.IWorkbenchPage; -import org.eclipse.ui.IWorkbenchWindow; -import org.eclipse.ui.PartInitException; -import org.eclipse.ui.plugin.AbstractUIPlugin; -import org.osgi.framework.BundleContext; - -import com.mountainminds.eclemma.core.CoverageTools; -import com.mountainminds.eclemma.core.ICoverageSession; -import com.mountainminds.eclemma.core.ISessionListener; -import com.mountainminds.eclemma.internal.ui.annotation.EditorTracker; -import com.mountainminds.eclemma.internal.ui.coverageview.CoverageView; - -/** - * - * @author Marc R. Hoffmann - * @version $Revision$ - */ -public class EclEmmaUIPlugin extends AbstractUIPlugin { - - public static final String ID = "com.mountainminds.eclemma.ui"; //$NON-NLS-1$ - - /** Identifier for the 'coverage' launch group. */ - public static final String ID_COVERAGE_LAUNCH_GROUP = ID + ".launchGroup.coverage"; //$NON-NLS-1$ - - - // Icons used by the Plugin - - public static final String ELCL_REFRESH = "icons/full/elcl16/refresh.gif"; //$NON-NLS-1$ - public static final String DLCL_REFRESH = "icons/full/dlcl16/refresh.gif"; //$NON-NLS-1$ - public static final String ELCL_IMPORT = "icons/full/elcl16/import.gif"; //$NON-NLS-1$ - public static final String DLCL_IMPORT = "icons/full/dlcl16/import.gif"; //$NON-NLS-1$ - public static final String ELCL_EXPORT = "icons/full/elcl16/export.gif"; //$NON-NLS-1$ - public static final String DLCL_EXPORT = "icons/full/dlcl16/export.gif"; //$NON-NLS-1$ - public static final String ELCL_REMOVE = "icons/full/elcl16/remove.gif"; //$NON-NLS-1$ - public static final String DLCL_REMOVE = "icons/full/dlcl16/remove.gif"; //$NON-NLS-1$ - public static final String ELCL_REMOVEALL = "icons/full/elcl16/removeall.gif"; //$NON-NLS-1$ - public static final String DLCL_REMOVEALL = "icons/full/dlcl16/removeall.gif"; //$NON-NLS-1$ - public static final String ELCL_MERGESESSIONS = "icons/full/elcl16/mergesessions.gif"; //$NON-NLS-1$ - public static final String DLCL_MERGESESSIONS = "icons/full/dlcl16/mergesessions.gif"; //$NON-NLS-1$ - public static final String ELCL_RELAUNCH = "icons/full/elcl16/relaunch.gif"; //$NON-NLS-1$ - public static final String DLCL_RELAUNCH = "icons/full/dlcl16/relaunch.gif"; //$NON-NLS-1$ - public static final String ELCL_SESSION = "icons/full/elcl16/session.gif"; //$NON-NLS-1$ - public static final String DLCL_SESSION = "icons/full/dlcl16/session.gif"; //$NON-NLS-1$ - public static final String ELCL_SHOWPROJECTS = "icons/full/elcl16/showprojects.gif"; //$NON-NLS-1$ - public static final String ELCL_SHOWPACKAGEROOTS = "icons/full/elcl16/showpackageroots.gif"; //$NON-NLS-1$ - public static final String ELCL_SHOWPACKAGES = "icons/full/elcl16/showpackages.gif"; //$NON-NLS-1$ - public static final String ELCL_SHOWTYPES = "icons/full/elcl16/showtypes.gif"; //$NON-NLS-1$ - public static final String ELCL_COLLAPSEALL = "icons/full/elcl16/collapseall.gif"; //$NON-NLS-1$ - public static final String ELCL_LINKED = "icons/full/elcl16/linked.gif"; //$NON-NLS-1$ - - public static final String EVIEW_COVERAGE = "icons/full/eview16/coverage.gif"; //$NON-NLS-1$ - - public static final String OBJ_SESSION = "icons/full/obj16/session.gif"; //$NON-NLS-1$ - - private static final String[] OBJ_COVERAGE = new String[] { - "icons/full/obj16/coverage00.gif", //$NON-NLS-1$ - "icons/full/obj16/coverage01.gif", //$NON-NLS-1$ - "icons/full/obj16/coverage02.gif", //$NON-NLS-1$ - "icons/full/obj16/coverage03.gif", //$NON-NLS-1$ - "icons/full/obj16/coverage04.gif", //$NON-NLS-1$ - "icons/full/obj16/coverage05.gif", //$NON-NLS-1$ - "icons/full/obj16/coverage06.gif", //$NON-NLS-1$ - "icons/full/obj16/coverage07.gif", //$NON-NLS-1$ - "icons/full/obj16/coverage08.gif", //$NON-NLS-1$ - "icons/full/obj16/coverage09.gif", //$NON-NLS-1$ - "icons/full/obj16/coverage10.gif", //$NON-NLS-1$ - "icons/full/obj16/coverage11.gif", //$NON-NLS-1$ - "icons/full/obj16/coverage12.gif" //$NON-NLS-1$ - }; - - private static final String[] OBJ_COVERAGE_OVERLAY = new String[] { - "icons/full/ovr16/coverage00.gif", //$NON-NLS-1$ - "icons/full/ovr16/coverage01.gif", //$NON-NLS-1$ - "icons/full/ovr16/coverage02.gif", //$NON-NLS-1$ - "icons/full/ovr16/coverage03.gif", //$NON-NLS-1$ - "icons/full/ovr16/coverage04.gif", //$NON-NLS-1$ - "icons/full/ovr16/coverage05.gif", //$NON-NLS-1$ - "icons/full/ovr16/coverage06.gif", //$NON-NLS-1$ - "icons/full/ovr16/coverage07.gif" //$NON-NLS-1$ - }; - - public static final String WIZBAN_EXPORT_SESSION = "icons/full/wizban/export_session.gif"; //$NON-NLS-1$ - public static final String WIZBAN_IMPORT_SESSION = "icons/full/wizban/import_session.gif"; //$NON-NLS-1$ - - - private static EclEmmaUIPlugin instance; - - private EditorTracker editorTracker; - - private ISessionListener sessionListener = new ISessionListener() { - public void sessionAdded(ICoverageSession addedSession) { - if (getPreferenceStore().getBoolean(UIPreferences.PREF_SHOW_COVERAGE_VIEW)) { - getWorkbench().getDisplay().asyncExec(new Runnable() { - public void run() { - showCoverageView(); - } - }); - } - } - public void sessionRemoved(ICoverageSession removedSession) { - } - public void sessionActivated(ICoverageSession session) { - } - }; - - public void start(BundleContext context) throws Exception { - super.start(context); - CoverageTools.setPreferences(UIPreferences.CORE_PREFERENCES); - CoverageTools.getSessionManager().addSessionListener(sessionListener); - editorTracker = new EditorTracker(getWorkbench()); - instance = this; - } - - public void stop(BundleContext context) throws Exception { - instance = null; - editorTracker.dispose(); - CoverageTools.getSessionManager().removeSessionListener(sessionListener); - super.stop(context); - } - - public static EclEmmaUIPlugin getInstance() { - return instance; - } - - private void showCoverageView() { - IWorkbenchWindow window = getWorkbench().getActiveWorkbenchWindow(); - if (window == null) return; - IWorkbenchPage page = window.getActivePage(); - if (page != null) { - try { - IViewPart view = page.showView(CoverageView.ID, null, IWorkbenchPage.VIEW_CREATE); - page.bringToTop(view); - } catch (PartInitException e) { - log(e); - } - } - } - - public Shell getShell() { - return getWorkbench().getActiveWorkbenchWindow().getShell(); - } - - public static IStatus errorStatus(String message, Throwable t) { - return new Status(IStatus.ERROR, ID, IStatus.ERROR, message, t); - } - - public static void log(Throwable t) { - String message = t.getMessage(); - if (message == null) { - message = "Internal Error"; //$NON-NLS-1$ - } - instance.getLog().log(errorStatus(message, t)); - } - - public static void log(CoreException t) { - instance.getLog().log(t.getStatus()); - } - - public static ImageDescriptor getImageDescriptor(String key) { - return loadImage(key).getDescriptor(key); - } - - public static Image getImage(String key) { - return loadImage(key).get(key); - } - - public static Image getCoverageImage(double ratio) { - int idx = (int) Math.round(ratio * OBJ_COVERAGE.length); - if (idx < 0) idx = 0; - if (idx >= OBJ_COVERAGE.length) idx = OBJ_COVERAGE.length - 1; - return getImage(OBJ_COVERAGE[idx]); - } - - public static ImageDescriptor getCoverageOverlay(double ratio) { - int idx = (int) Math.round(ratio * OBJ_COVERAGE_OVERLAY.length); - if (idx < 0) idx = 0; - if (idx >= OBJ_COVERAGE_OVERLAY.length) idx = OBJ_COVERAGE_OVERLAY.length - 1; - return getImageDescriptor(OBJ_COVERAGE_OVERLAY[idx]); - } - - private static ImageRegistry loadImage(String path) { - ImageRegistry reg = getInstance().getImageRegistry(); - if (reg.getDescriptor(path) == null) { - URL url = instance.getBundle().getEntry(path); - reg.put(path, ImageDescriptor.createFromURL(url)); - } - return reg; - } - -} diff --git a/com.mountainminds.eclemma.ui/src/com/mountainminds/eclemma/internal/ui/UIMessages.java b/com.mountainminds.eclemma.ui/src/com/mountainminds/eclemma/internal/ui/UIMessages.java deleted file mode 100644 index ccb736d..0000000 --- a/com.mountainminds.eclemma.ui/src/com/mountainminds/eclemma/internal/ui/UIMessages.java +++ /dev/null @@ -1,176 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2009 Mountainminds GmbH & Co. KG - * This software is provided under the terms of the Eclipse Public License v1.0 - * See http://www.eclipse.org/legal/epl-v10.html. - * - * $Id$ - ******************************************************************************/ -package com.mountainminds.eclemma.internal.ui; - -import org.eclipse.osgi.util.NLS; - -/** - * Text messages for the UI plugin. - * - * @author Marc R. Hoffmann - * @version $Revision$ - */ -public class UIMessages extends NLS { - - private static final String BUNDLE_NAME = "com.mountainminds.eclemma.internal.ui.uimessages";//$NON-NLS-1$ - - public static String RemoveActiveSessionAction_label; - public static String RemoveActiveSessionAction_tooltip; - public static String RemoveAllSessionsAction_label; - public static String RemoveAllSessionsAction_tooltip; - public static String RefreshSessionAction_label; - public static String RefreshSessionAction_tooltip; - public static String MergeSessionsAction_label; - public static String MergeSessionsAction_tooltip; - public static String ImportSessionAction_label; - public static String ImportSessionAction_tooltip; - public static String ExportSessionAction_label; - public static String ExportSessionAction_tooltip; - public static String CopyAction_label; - public static String BrowseAction_label; - public static String SelectAllAction_label; - public static String DeselectAllAction_label; - public static String CoverageLastAction_label; - - public static String CoverageViewRelaunchAction_label; - public static String CoverageViewRelaunchAction_tooltip; - public static String CoverageViewSelectSessionAction_label; - public static String CoverageViewSelectSessionAction_looltip; - public static String CoverageViewSelectSessionActionEntry_label; - public static String CoverageViewCounterModeInstructionsAction_label; - public static String CoverageViewCounterModeBlocksAction_label; - public static String CoverageViewCounterModeLinesAction_label; - public static String CoverageViewCounterModeMethodsAction_label; - public static String CoverageViewCounterModeTypesAction_label; - public static String CoverageViewShowProjectsAction_label; - public static String CoverageViewShowProjectsAction_tooltip; - public static String CoverageViewShowPackageRootsAction_label; - public static String CoverageViewShowPackageRootsAction_tooltip; - public static String CoverageViewShowPackagesAction_label; - public static String CoverageViewShowPackagesAction_tooltip; - public static String CoverageViewShowTypesAction_label; - public static String CoverageViewShowTypesAction_tooltip; - public static String CoverageViewHideUnusedTypesAction_label; - public static String CoverageViewCollapseAllAction_label; - public static String CoverageViewCollapseAllAction_tooltip; - public static String CoverageViewLinkWithSelectionAction_label; - public static String CoverageViewLinkWithSelectionAction_tooltip; - public static String CoverageViewColumnElement_label; - public static String CoverageViewColumnCoverage_label; - public static String CoverageViewColumnCoveredInstructions_label; - public static String CoverageViewColumnCoveredBlocks_label; - public static String CoverageViewColumnCoveredLines_label; - public static String CoverageViewColumnCoveredMethods_label; - public static String CoverageViewColumnCoveredTypes_label; - public static String CoverageViewColumnMissedInstructions_label; - public static String CoverageViewColumnMissedBlocks_label; - public static String CoverageViewColumnMissedLines_label; - public static String CoverageViewColumnMissedMethods_label; - public static String CoverageViewColumnMissedTypes_label; - public static String CoverageViewColumnTotalInstructions_label; - public static String CoverageViewColumnTotalBlocks_label; - public static String CoverageViewColumnTotalLines_label; - public static String CoverageViewColumnTotalMethods_label; - public static String CoverageViewColumnTotalTypes_label; - public static String CoverageView_columnCoverageValue; - public static String CoverageView_loadingMessage; - - public static String MergeSessionsDialog_title; - public static String MergeSessionsDialogDescription_label; - public static String MergeSessionsDialogDescriptionDefault_value; - public static String MergeSessionsDialogSelection_label; - - public static String CoverageTab_title; - public static String CoverageTabInstrumentedClassesGroup_label; - public static String CoverageTabInplaceInstrumentation_label; - public static String CoverageTabNoClassesSelected_message; - - public static String InstrumentationWarning_title; - public static String InstrumentationWarning_message; - public static String AlreadyInstrumentedError_title; - public static String AlreadyInstrumentedError_message; - public static String NoCoverageDataError_title; - public static String NoCoverageDataError_message; - public static String NoInstrumentedClassesError_title; - public static String NoInstrumentedClassesError_message; - - public static String ExportReport_title; - public static String ExportReportErrorDialog_title; - public static String ExportReportErrorDialog_message; - public static String ExportReportPage1_title; - public static String ExportReportPage1_description; - public static String ExportReportPage1NoSession_message; - public static String ExportReportPage1MissingDestination_message; - public static String ExportReportPage1InvalidDestination_message; - public static String ExportReportPage1WrongExtension_message; - public static String ExportReportPage1Sessions_label; - public static String ExportReportPage1DestinationGroup_label; - public static String ExportReportPage1Format_label; - public static String ExportReportPage1Destination_label; - public static String ExportReportPage1BrowseDialog_title; - public static String ExportReportPage1HTMLFormat_value; - public static String ExportReportPage1XMLFormat_value; - public static String ExportReportPage1TextFormat_value; - public static String ExportReportPage1EMMAFormat_value; - public static String ExportReportOpenReport_label; - - public static String ImportSession_title; - public static String ImportSessionPage1_title; - public static String ImportReportErrorDialog_title; - public static String ImportReportErrorDialog_message; - public static String ImportSessionPage1_description; - public static String ImportReportPage1NoDescription_message; - public static String ImportReportPage1NoCoverageFile_message; - public static String ImportReportPage1NoClassFiles_message; - public static String ImportSessionPage1Description_label; - public static String ImportSessionPage1Description_value; - public static String ImportSessionPage1CoverageFile_label; - public static String ImportSessionPage1BrowseDialog_title; - public static String ImportSessionPage1Binaries_label; - public static String ImportSessionPage1ModeGroup_label; - public static String ImportSessionPage1Reference_label; - public static String ImportSessionPage1Copy_label; - public static String ImportSessionPage1MetadataGroup_label; - public static String ImportSessionPage1IDEClasses_label; - public static String ImportSessionPage1ImportMetaData_label; - - public static String CoveragePropertyPageSession_label; - public static String CoveragePropertyPageNoSession_value; - public static String CoveragePropertyPageColumnCounter_label; - public static String CoveragePropertyPageColumnCoverage_label; - public static String CoveragePropertyPageColumnCoverage_value; - public static String CoveragePropertyPageColumnCovered_label; - public static String CoveragePropertyPageColumnMissed_label; - public static String CoveragePropertyPageColumnTotal_label; - public static String CoveragePropertyPageInstructions_label; - public static String CoveragePropertyPageBlocks_label; - public static String CoveragePropertyPageLines_label; - public static String CoveragePropertyPageMethods_label; - public static String CoveragePropertyPageTypes_label; - - public static String CoverageDecoratorSuffix_label; - - public static String CoveragePreferences_description; - public static String CoveragePreferencesShowCoverageView_label; - public static String CoveragePreferencesActivateNewSessions_label; - public static String CoveragePreferencesAutoRemoveSessions_label; - public static String CoveragePreferencesShowInplaceWarning_label; - public static String CoveragePreferencesDefaultInstrumentation_title; - public static String CoveragePreferencesSourceFoldersOnly_label; - public static String CoveragePreferencesSameProjectOnly_label; - public static String CoveragePreferencesClasspathFilter_label; - public static String CoveragePreferencesDecoratorsLink_label; - public static String CoveragePreferencesAnnotationsLink_label; - - public static String ClassesViewerEntry_label; - - static { - NLS.initializeMessages(BUNDLE_NAME, UIMessages.class); - } - -} diff --git a/com.mountainminds.eclemma.ui/src/com/mountainminds/eclemma/internal/ui/UIPreferences.java b/com.mountainminds.eclemma.ui/src/com/mountainminds/eclemma/internal/ui/UIPreferences.java deleted file mode 100644 index 26771f7..0000000 --- a/com.mountainminds.eclemma.ui/src/com/mountainminds/eclemma/internal/ui/UIPreferences.java +++ /dev/null @@ -1,91 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2009 Mountainminds GmbH & Co. KG - * This software is provided under the terms of the Eclipse Public License v1.0 - * See http://www.eclipse.org/legal/epl-v10.html. - * - * $Id$ - ******************************************************************************/ -package com.mountainminds.eclemma.internal.ui; - -import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer; -import org.eclipse.jface.dialogs.MessageDialogWithToggle; -import org.eclipse.jface.preference.IPreferenceStore; - -import com.mountainminds.eclemma.core.ICorePreferences; - -/** - * Constants and initializer for the preference store. - * - * @author Marc R. Hoffmann - * @version $Revision$ - */ -public class UIPreferences extends AbstractPreferenceInitializer { - - public static final String PREF_SHOW_COVERAGE_VIEW = EclEmmaUIPlugin.ID - + ".show_coverage_view"; //$NON-NLS-1$ - - public static final String PREF_ACTICATE_NEW_SESSIONS = EclEmmaUIPlugin.ID - + ".activate_new_sessions"; //$NON-NLS-1$ - - public static final String PREF_DEFAULT_INSTRUMENTATION_SOURCE_FOLDERS_ONLY = EclEmmaUIPlugin.ID - + ".default_instrumentation_source_folders_only"; //$NON-NLS-1$ - - public static final String PREF_DEFAULT_INSTRUMENTATION_SAME_PROJECT_ONLY = EclEmmaUIPlugin.ID - + ".default_instrumentation_same_project_only"; //$NON-NLS-1$ - - public static final String PREF_DEFAULT_INSTRUMENTATION_FILTER = EclEmmaUIPlugin.ID - + ".default_instrumentation_filter"; //$NON-NLS-1$ - - public static final String PREF_AUTO_REMOVE_SESSIONS = EclEmmaUIPlugin.ID - + ".auto_remove_sessions"; //$NON-NLS-1$ - - public static final String PREF_ALLOW_INPLACE_INSTRUMENTATION = EclEmmaUIPlugin.ID - + ".allow_inplace_instrumentation"; //$NON-NLS-1$ - - public static final ICorePreferences CORE_PREFERENCES = new ICorePreferences() { - public boolean getActivateNewSessions() { - return getPreferenceStore().getBoolean(PREF_ACTICATE_NEW_SESSIONS); - } - - public boolean getAutoRemoveSessions() { - return getPreferenceStore().getBoolean(PREF_AUTO_REMOVE_SESSIONS); - } - - public boolean getDefaultInstrumentationSourceFoldersOnly() { - return getPreferenceStore().getBoolean( - PREF_DEFAULT_INSTRUMENTATION_SOURCE_FOLDERS_ONLY); - } - - public boolean getDefaultInstrumentationSameProjectOnly() { - return getPreferenceStore().getBoolean( - PREF_DEFAULT_INSTRUMENTATION_SAME_PROJECT_ONLY); - } - - public String getDefaultInstrumentationFilter() { - return getPreferenceStore() - .getString(PREF_DEFAULT_INSTRUMENTATION_FILTER); - } - }; - - public void initializeDefaultPreferences() { - IPreferenceStore pref = getPreferenceStore(); - pref.setDefault(PREF_SHOW_COVERAGE_VIEW, true); - pref.setDefault(PREF_ACTICATE_NEW_SESSIONS, ICorePreferences.DEFAULT - .getActivateNewSessions()); - pref.setDefault(PREF_AUTO_REMOVE_SESSIONS, ICorePreferences.DEFAULT - .getAutoRemoveSessions()); - pref.setDefault(PREF_DEFAULT_INSTRUMENTATION_SOURCE_FOLDERS_ONLY, - ICorePreferences.DEFAULT.getDefaultInstrumentationSourceFoldersOnly()); - pref.setDefault(PREF_DEFAULT_INSTRUMENTATION_SAME_PROJECT_ONLY, - ICorePreferences.DEFAULT.getDefaultInstrumentationSameProjectOnly()); - pref.setDefault(PREF_DEFAULT_INSTRUMENTATION_FILTER, - ICorePreferences.DEFAULT.getDefaultInstrumentationFilter()); - pref.setDefault(PREF_ALLOW_INPLACE_INSTRUMENTATION, - MessageDialogWithToggle.PROMPT); - } - - private static IPreferenceStore getPreferenceStore() { - return EclEmmaUIPlugin.getInstance().getPreferenceStore(); - } - -} diff --git a/com.mountainminds.eclemma.ui/src/com/mountainminds/eclemma/internal/ui/WorkbenchAdapterFactory.java b/com.mountainminds.eclemma.ui/src/com/mountainminds/eclemma/internal/ui/WorkbenchAdapterFactory.java deleted file mode 100644 index d0ba440..0000000 --- a/com.mountainminds.eclemma.ui/src/com/mountainminds/eclemma/internal/ui/WorkbenchAdapterFactory.java +++ /dev/null @@ -1,56 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Mountainminds GmbH & Co. KG - * This software is provided under the terms of the Eclipse Public License v1.0 - * See http://www.eclipse.org/legal/epl-v10.html. - * - * $Id$ - ******************************************************************************/ -package com.mountainminds.eclemma.internal.ui; - -import org.eclipse.core.runtime.IAdapterFactory; -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.ui.model.IWorkbenchAdapter; - -import com.mountainminds.eclemma.core.ICoverageSession; - -/** - * Factory for IWorkbenchAdapters for coverage model - * elements. - * - * @author Marc R. Hoffmann - * @version $Revision$ - */ -public class WorkbenchAdapterFactory implements IAdapterFactory { - - private static final IWorkbenchAdapter SESSIONADAPTER = new IWorkbenchAdapter() { - - public ImageDescriptor getImageDescriptor(Object object) { - return EclEmmaUIPlugin.getImageDescriptor(EclEmmaUIPlugin.OBJ_SESSION); - } - - public String getLabel(Object o) { - return ((ICoverageSession) o).getDescription(); - } - - public Object[] getChildren(Object o) { - return new Object[0]; - } - - public Object getParent(Object o) { - return null; - } - - }; - - public Object getAdapter(Object adaptableObject, Class adapterType) { - if (adaptableObject instanceof ICoverageSession) { - return SESSIONADAPTER; - } - return null; - } - - public Class[] getAdapterList() { - return new Class[] { IWorkbenchAdapter.class }; - } - -} diff --git a/com.mountainminds.eclemma.ui/src/com/mountainminds/eclemma/internal/ui/actions/ContextualLaunchableTester.java b/com.mountainminds.eclemma.ui/src/com/mountainminds/eclemma/internal/ui/actions/ContextualLaunchableTester.java deleted file mode 100644 index f139805..0000000 --- a/com.mountainminds.eclemma.ui/src/com/mountainminds/eclemma/internal/ui/actions/ContextualLaunchableTester.java +++ /dev/null @@ -1,93 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Mountainminds GmbH & Co. KG - * This software is provided under the terms of the Eclipse Public License v1.0 - * See http://www.eclipse.org/legal/epl-v10.html. - * - * $Id$ - ******************************************************************************/ -package com.mountainminds.eclemma.internal.ui.actions; - -import java.util.Arrays; -import java.util.HashMap; -import java.util.Map; - -import org.eclipse.core.expressions.EvaluationContext; -import org.eclipse.core.expressions.EvaluationResult; -import org.eclipse.core.expressions.Expression; -import org.eclipse.core.expressions.ExpressionConverter; -import org.eclipse.core.expressions.ExpressionTagNames; -import org.eclipse.core.expressions.IEvaluationContext; -import org.eclipse.core.expressions.PropertyTester; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IConfigurationElement; -import org.eclipse.core.runtime.Platform; -import org.eclipse.debug.core.ILaunchManager; - -import com.mountainminds.eclemma.internal.ui.EclEmmaUIPlugin; - -/** - * This property tester checks whether the "coverage" launch mode is possible - * for the current selection. The expression defined for the shortcut enablement - * has changed for different Eclipse versions. Therefore the implementation of - * the property tester delegates to the expression defined for the corresponding - * launch shortcut expression for the "run" mode. - * - * @author Marc R. Hoffmann - * @version $Revision$ - */ -public class ContextualLaunchableTester extends PropertyTester { - - /** Cache for expressions maps launch shortcut ids to Expression objects. */ - private Map expressions = new HashMap(); - - public boolean test(Object receiver, String property, Object[] args, Object expectedValue) { - String delegateShortcutID = (String) args[0]; - Expression expr = (Expression) expressions.get(delegateShortcutID); - if (expr == null) { - expr = createEnablementExpression(delegateShortcutID); - expressions.put(delegateShortcutID, expr); - } - try { - return expr.evaluate(createContext(receiver)) != EvaluationResult.FALSE; - } catch (CoreException ce) { - EclEmmaUIPlugin.log(ce); - return false; - } - } - - private IEvaluationContext createContext(Object selection) { - IEvaluationContext context = new EvaluationContext(null, selection); - context.addVariable("selection", selection); //$NON-NLS-1$ - return context; - } - - - private Expression createEnablementExpression(String delegateShortcutID) { - IConfigurationElement element = findEnablementConfiguration(delegateShortcutID); - if (element != null) { - try { - return ExpressionConverter.getDefault().perform(element); - } catch (CoreException ce) { - EclEmmaUIPlugin.log(ce); - } - } - return Expression.FALSE; - } - - private IConfigurationElement findEnablementConfiguration(String delegateShortcutID) { - IConfigurationElement[] configs = - Platform.getExtensionRegistry().getConfigurationElementsFor("org.eclipse.debug.ui.launchShortcuts"); //$NON-NLS-1$ - for (int i = 0; i < configs.length; i++) { - if (!delegateShortcutID.equals(configs[i].getAttribute("id"))) continue; //$NON-NLS-1$ - String modes = configs[i].getAttribute("modes"); //$NON-NLS-1$ - if (modes == null) continue; - if (!Arrays.asList(modes.split("\\W")).contains(ILaunchManager.RUN_MODE)) continue; //$NON-NLS-1$ - IConfigurationElement[] launch = configs[i].getChildren("contextualLaunch"); //$NON-NLS-1$ - if (launch.length != 1) continue; - IConfigurationElement[] enablement = launch[0].getChildren(ExpressionTagNames.ENABLEMENT); - if (enablement.length == 1) return enablement[0]; - } - return null; - } - -} diff --git a/com.mountainminds.eclemma.ui/src/com/mountainminds/eclemma/internal/ui/actions/CoverageAsAction.java b/com.mountainminds.eclemma.ui/src/com/mountainminds/eclemma/internal/ui/actions/CoverageAsAction.java deleted file mode 100644 index 3839f67..0000000 --- a/com.mountainminds.eclemma.ui/src/com/mountainminds/eclemma/internal/ui/actions/CoverageAsAction.java +++ /dev/null @@ -1,25 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Mountainminds GmbH & Co. KG - * This software is provided under the terms of the Eclipse Public License v1.0 - * See http://www.eclipse.org/legal/epl-v10.html. - * - * $Id$ - ******************************************************************************/ -package com.mountainminds.eclemma.internal.ui.actions; - -import org.eclipse.debug.ui.actions.LaunchShortcutsAction; - -import com.mountainminds.eclemma.internal.ui.EclEmmaUIPlugin; - -/** - * - * @author Marc R. Hoffmann - * @version $Revision$ - */ -public class CoverageAsAction extends LaunchShortcutsAction { - - public CoverageAsAction() { - super(EclEmmaUIPlugin.ID_COVERAGE_LAUNCH_GROUP); - } - -} diff --git a/com.mountainminds.eclemma.ui/src/com/mountainminds/eclemma/internal/ui/actions/CoverageContextualLaunchAction.java b/com.mountainminds.eclemma.ui/src/com/mountainminds/eclemma/internal/ui/actions/CoverageContextualLaunchAction.java deleted file mode 100644 index 91e8c16..0000000 --- a/com.mountainminds.eclemma.ui/src/com/mountainminds/eclemma/internal/ui/actions/CoverageContextualLaunchAction.java +++ /dev/null @@ -1,26 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Mountainminds GmbH & Co. KG - * This software is provided under the terms of the Eclipse Public License v1.0 - * See http://www.eclipse.org/legal/epl-v10.html. - * - * $Id$ - ******************************************************************************/ -package com.mountainminds.eclemma.internal.ui.actions; - -import org.eclipse.debug.ui.actions.ContextualLaunchAction; - -import com.mountainminds.eclemma.core.CoverageTools; - -/** - * An action delegate for the "Coverage As" context menu entry. - * - * @author Brock Janiczak - * @version $Revision$ - */ -public class CoverageContextualLaunchAction extends ContextualLaunchAction { - - public CoverageContextualLaunchAction() { - super(CoverageTools.LAUNCH_MODE); - } - -} diff --git a/com.mountainminds.eclemma.ui/src/com/mountainminds/eclemma/internal/ui/actions/CoverageHistoryAction.java b/com.mountainminds.eclemma.ui/src/com/mountainminds/eclemma/internal/ui/actions/CoverageHistoryAction.java deleted file mode 100644 index 47a71b9..0000000 --- a/com.mountainminds.eclemma.ui/src/com/mountainminds/eclemma/internal/ui/actions/CoverageHistoryAction.java +++ /dev/null @@ -1,25 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Mountainminds GmbH & Co. KG - * This software is provided under the terms of the Eclipse Public License v1.0 - * See http://www.eclipse.org/legal/epl-v10.html. - * - * $Id$ - ******************************************************************************/ -package com.mountainminds.eclemma.internal.ui.actions; - -import org.eclipse.debug.ui.actions.AbstractLaunchHistoryAction; - -import com.mountainminds.eclemma.internal.ui.EclEmmaUIPlugin; - -/** - * - * @author Marc R. Hoffmann - * @version $Revision$ - */ -public class CoverageHistoryAction extends AbstractLaunchHistoryAction { - - public CoverageHistoryAction() { - super(EclEmmaUIPlugin.ID_COVERAGE_LAUNCH_GROUP); - } - -} diff --git a/com.mountainminds.eclemma.ui/src/com/mountainminds/eclemma/internal/ui/actions/CoverageLastAction.java b/com.mountainminds.eclemma.ui/src/com/mountainminds/eclemma/internal/ui/actions/CoverageLastAction.java deleted file mode 100644 index 6695e4e..0000000 --- a/com.mountainminds.eclemma.ui/src/com/mountainminds/eclemma/internal/ui/actions/CoverageLastAction.java +++ /dev/null @@ -1,59 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Mountainminds GmbH & Co. KG - * This software is provided under the terms of the Eclipse Public License v1.0 - * See http://www.eclipse.org/legal/epl-v10.html. - * - * $Id$ - ******************************************************************************/ -package com.mountainminds.eclemma.internal.ui.actions; - -import org.eclipse.debug.internal.ui.actions.RelaunchLastAction; - -import com.mountainminds.eclemma.core.CoverageTools; -import com.mountainminds.eclemma.internal.ui.EclEmmaUIPlugin; -import com.mountainminds.eclemma.internal.ui.UIMessages; - -/** - * - * @author Marc R. Hoffmann - * @version $Revision$ - */ -public class CoverageLastAction extends RelaunchLastAction { - - public String getMode() { - return CoverageTools.LAUNCH_MODE; - } - - public String getLaunchGroupId() { - return EclEmmaUIPlugin.ID_COVERAGE_LAUNCH_GROUP; - } - - /* - * Implements abstract method defined in superclass since Eclipse 3.3 - */ - protected String getText() { - return UIMessages.CoverageLastAction_label; - } - - /* - * Implements abstract method defined in superclass since Eclipse 3.3 - */ - protected String getTooltipText() { - return UIMessages.CoverageLastAction_label; - } - - /* - * Implements abstract method defined in superclass since Eclipse 3.3 - */ - protected String getDescription() { - return UIMessages.CoverageLastAction_label; - } - - /* - * Implements abstract method defined in superclass since Eclipse 3.3 - */ - protected String getCommandId() { - return "com.mountainminds.eclemma.ui.commands.CoverageLast"; //$NON-NLS-1$ - } - -} diff --git a/com.mountainminds.eclemma.ui/src/com/mountainminds/eclemma/internal/ui/actions/CoverageToolbarAction.java b/com.mountainminds.eclemma.ui/src/com/mountainminds/eclemma/internal/ui/actions/CoverageToolbarAction.java deleted file mode 100644 index 08b611e..0000000 --- a/com.mountainminds.eclemma.ui/src/com/mountainminds/eclemma/internal/ui/actions/CoverageToolbarAction.java +++ /dev/null @@ -1,25 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Mountainminds GmbH & Co. KG - * This software is provided under the terms of the Eclipse Public License v1.0 - * See http://www.eclipse.org/legal/epl-v10.html. - * - * $Id$ - ******************************************************************************/ -package com.mountainminds.eclemma.internal.ui.actions; - -import org.eclipse.debug.ui.actions.AbstractLaunchToolbarAction; - -import com.mountainminds.eclemma.internal.ui.EclEmmaUIPlugin; - -/** - * - * @author Marc R. Hoffmann - * @version $Revision$ - */ -public class CoverageToolbarAction extends AbstractLaunchToolbarAction { - - public CoverageToolbarAction() { - super(EclEmmaUIPlugin.ID_COVERAGE_LAUNCH_GROUP); - } - -} diff --git a/com.mountainminds.eclemma.ui/src/com/mountainminds/eclemma/internal/ui/actions/ExportSessionAction.java b/com.mountainminds.eclemma.ui/src/com/mountainminds/eclemma/internal/ui/actions/ExportSessionAction.java deleted file mode 100644 index 023a9a5..0000000 --- a/com.mountainminds.eclemma.ui/src/com/mountainminds/eclemma/internal/ui/actions/ExportSessionAction.java +++ /dev/null @@ -1,45 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Mountainminds GmbH & Co. KG - * This software is provided under the terms of the Eclipse Public License v1.0 - * See http://www.eclipse.org/legal/epl-v10.html. - * - * $Id$ - ******************************************************************************/ -package com.mountainminds.eclemma.internal.ui.actions; - -import org.eclipse.jface.action.Action; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.jface.wizard.WizardDialog; -import org.eclipse.ui.IWorkbenchWindow; -import org.eclipse.ui.IWorkbenchWizard; - -import com.mountainminds.eclemma.internal.ui.EclEmmaUIPlugin; -import com.mountainminds.eclemma.internal.ui.UIMessages; -import com.mountainminds.eclemma.internal.ui.wizards.SessionExportWizard; - -/** - * This action launches the export session wizard. - * - * @author Marc R. Hoffmann - * @version $Revision: $ - */ -public class ExportSessionAction extends Action { - - private final IWorkbenchWindow window; - - public ExportSessionAction(IWorkbenchWindow window) { - this.window = window; - setText(UIMessages.ExportSessionAction_label); - setToolTipText(UIMessages.ExportSessionAction_tooltip); - setImageDescriptor(EclEmmaUIPlugin.getImageDescriptor(EclEmmaUIPlugin.ELCL_EXPORT)); - setDisabledImageDescriptor(EclEmmaUIPlugin.getImageDescriptor(EclEmmaUIPlugin.DLCL_EXPORT)); - } - - public void run() { - IWorkbenchWizard wizard = new SessionExportWizard(); - wizard.init(window.getWorkbench(), StructuredSelection.EMPTY); - WizardDialog dialog = new WizardDialog(window.getShell(), wizard); - dialog.open(); - } - -} diff --git a/com.mountainminds.eclemma.ui/src/com/mountainminds/eclemma/internal/ui/actions/ImportSessionAction.java b/com.mountainminds.eclemma.ui/src/com/mountainminds/eclemma/internal/ui/actions/ImportSessionAction.java deleted file mode 100644 index f781590..0000000 --- a/com.mountainminds.eclemma.ui/src/com/mountainminds/eclemma/internal/ui/actions/ImportSessionAction.java +++ /dev/null @@ -1,45 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Mountainminds GmbH & Co. KG - * This software is provided under the terms of the Eclipse Public License v1.0 - * See http://www.eclipse.org/legal/epl-v10.html. - * - * $Id$ - ******************************************************************************/ -package com.mountainminds.eclemma.internal.ui.actions; - -import org.eclipse.jface.action.Action; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.jface.wizard.WizardDialog; -import org.eclipse.ui.IWorkbenchWindow; -import org.eclipse.ui.IWorkbenchWizard; - -import com.mountainminds.eclemma.internal.ui.EclEmmaUIPlugin; -import com.mountainminds.eclemma.internal.ui.UIMessages; -import com.mountainminds.eclemma.internal.ui.wizards.SessionImportWizard; - -/** - * This action launches the import session wizard. - * - * @author Marc R. Hoffmann - * @version $Revision: $ - */ -public class ImportSessionAction extends Action { - - private final IWorkbenchWindow window; - - public ImportSessionAction(IWorkbenchWindow window) { - this.window = window; - setText(UIMessages.ImportSessionAction_label); - setToolTipText(UIMessages.ImportSessionAction_tooltip); - setImageDescriptor(EclEmmaUIPlugin.getImageDescriptor(EclEmmaUIPlugin.ELCL_IMPORT)); - setDisabledImageDescriptor(EclEmmaUIPlugin.getImageDescriptor(EclEmmaUIPlugin.DLCL_IMPORT)); - } - - public void run() { - IWorkbenchWizard wizard = new SessionImportWizard(); - wizard.init(window.getWorkbench(), StructuredSelection.EMPTY); - WizardDialog dialog = new WizardDialog(window.getShell(), wizard); - dialog.open(); - } - -} diff --git a/com.mountainminds.eclemma.ui/src/com/mountainminds/eclemma/internal/ui/actions/MergeSessionsAction.java b/com.mountainminds.eclemma.ui/src/com/mountainminds/eclemma/internal/ui/actions/MergeSessionsAction.java deleted file mode 100644 index 80d382a..0000000 --- a/com.mountainminds.eclemma.ui/src/com/mountainminds/eclemma/internal/ui/actions/MergeSessionsAction.java +++ /dev/null @@ -1,61 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Mountainminds GmbH & Co. KG - * This software is provided under the terms of the Eclipse Public License v1.0 - * See http://www.eclipse.org/legal/epl-v10.html. - * - * $Id$ - ******************************************************************************/ -package com.mountainminds.eclemma.internal.ui.actions; - -import java.text.MessageFormat; -import java.util.Date; - -import org.eclipse.jface.action.Action; -import org.eclipse.jface.dialogs.IDialogConstants; -import org.eclipse.ui.IWorkbenchWindow; - -import com.mountainminds.eclemma.core.CoverageTools; -import com.mountainminds.eclemma.core.ICoverageSession; -import com.mountainminds.eclemma.core.ISessionManager; -import com.mountainminds.eclemma.internal.ui.EclEmmaUIPlugin; -import com.mountainminds.eclemma.internal.ui.UIMessages; -import com.mountainminds.eclemma.internal.ui.dialogs.MergeSessionsDialog; - -/** - * This action launches the merge sessions dialog. - * - * @author Marc R. Hoffmann - * @version $Revision$ - */ -public class MergeSessionsAction extends Action { - - private final IWorkbenchWindow window; - - public MergeSessionsAction(IWorkbenchWindow window) { - this.window = window; - setText(UIMessages.MergeSessionsAction_label); - setToolTipText(UIMessages.MergeSessionsAction_tooltip); - setImageDescriptor(EclEmmaUIPlugin.getImageDescriptor(EclEmmaUIPlugin.ELCL_MERGESESSIONS)); - setDisabledImageDescriptor(EclEmmaUIPlugin.getImageDescriptor(EclEmmaUIPlugin.DLCL_MERGESESSIONS)); - } - - public void run() { - ISessionManager sm = CoverageTools.getSessionManager(); - ICoverageSession[] sessions = sm.getSessions(); - String descr = UIMessages.MergeSessionsDialogDescriptionDefault_value; - descr = MessageFormat.format(descr, new Object[] { new Date() }); - MergeSessionsDialog d = new MergeSessionsDialog(window.getShell(), sessions, descr); - if (d.open() == IDialogConstants.OK_ID) { - Object[] result = d.getResult(); - ICoverageSession merged = (ICoverageSession) result[0]; - for (int i = 1; i < result.length; i++) { - merged = merged.merge((ICoverageSession) result[i], d.getDescription()); - } - sm.addSession(merged, true, null); - for (int i = 0; i < result.length; i++) { - sm.removeSession((ICoverageSession) result[i]); - } - } - } - -} diff --git a/com.mountainminds.eclemma.ui/src/com/mountainminds/eclemma/internal/ui/actions/OpenCoverageConfigurations.java b/com.mountainminds.eclemma.ui/src/com/mountainminds/eclemma/internal/ui/actions/OpenCoverageConfigurations.java deleted file mode 100644 index 72a5dce..0000000 --- a/com.mountainminds.eclemma.ui/src/com/mountainminds/eclemma/internal/ui/actions/OpenCoverageConfigurations.java +++ /dev/null @@ -1,25 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Mountainminds GmbH & Co. KG - * This software is provided under the terms of the Eclipse Public License v1.0 - * See http://www.eclipse.org/legal/epl-v10.html. - * - * $Id$ - ******************************************************************************/ -package com.mountainminds.eclemma.internal.ui.actions; - -import org.eclipse.debug.ui.actions.OpenLaunchDialogAction; - -import com.mountainminds.eclemma.internal.ui.EclEmmaUIPlugin; - -/** - * - * @author Marc R. Hoffmann - * @version $Revision$ - */ -public class OpenCoverageConfigurations extends OpenLaunchDialogAction { - - public OpenCoverageConfigurations() { - super(EclEmmaUIPlugin.ID_COVERAGE_LAUNCH_GROUP); - } - -} diff --git a/com.mountainminds.eclemma.ui/src/com/mountainminds/eclemma/internal/ui/actions/RefreshSessionAction.java b/com.mountainminds.eclemma.ui/src/com/mountainminds/eclemma/internal/ui/actions/RefreshSessionAction.java deleted file mode 100644 index 5fde808..0000000 --- a/com.mountainminds.eclemma.ui/src/com/mountainminds/eclemma/internal/ui/actions/RefreshSessionAction.java +++ /dev/null @@ -1,37 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Mountainminds GmbH & Co. KG - * This software is provided under the terms of the Eclipse Public License v1.0 - * See http://www.eclipse.org/legal/epl-v10.html. - * - * $Id: $ - ******************************************************************************/ -package com.mountainminds.eclemma.internal.ui.actions; - -import org.eclipse.jface.action.Action; - -import com.mountainminds.eclemma.core.CoverageTools; -import com.mountainminds.eclemma.internal.ui.EclEmmaUIPlugin; -import com.mountainminds.eclemma.internal.ui.UIMessages; - -/** - * This action reloads the active coverage session. - * - * @author Marc R. Hoffmann - * @version $Revision: $ - */ -public class RefreshSessionAction extends Action { - - public RefreshSessionAction() { - setText(UIMessages.RefreshSessionAction_label); - setToolTipText(UIMessages.RefreshSessionAction_tooltip); - setImageDescriptor(EclEmmaUIPlugin.getImageDescriptor(EclEmmaUIPlugin.ELCL_REFRESH)); - setDisabledImageDescriptor(EclEmmaUIPlugin.getImageDescriptor(EclEmmaUIPlugin.DLCL_REFRESH)); - setActionDefinitionId("org.eclipse.ui.file.refresh"); //$NON-NLS-1$ - setEnabled(false); - } - - public void run() { - CoverageTools.getSessionManager().refreshActiveSession(); - } - -} diff --git a/com.mountainminds.eclemma.ui/src/com/mountainminds/eclemma/internal/ui/actions/RemoveActiveSessionAction.java b/com.mountainminds.eclemma.ui/src/com/mountainminds/eclemma/internal/ui/actions/RemoveActiveSessionAction.java deleted file mode 100644 index 1bcf6f9..0000000 --- a/com.mountainminds.eclemma.ui/src/com/mountainminds/eclemma/internal/ui/actions/RemoveActiveSessionAction.java +++ /dev/null @@ -1,42 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Mountainminds GmbH & Co. KG - * This software is provided under the terms of the Eclipse Public License v1.0 - * See http://www.eclipse.org/legal/epl-v10.html. - * - * $Id$ - ******************************************************************************/ -package com.mountainminds.eclemma.internal.ui.actions; - -import org.eclipse.jface.action.Action; - -import com.mountainminds.eclemma.core.CoverageTools; -import com.mountainminds.eclemma.core.ICoverageSession; -import com.mountainminds.eclemma.core.ISessionManager; -import com.mountainminds.eclemma.internal.ui.EclEmmaUIPlugin; -import com.mountainminds.eclemma.internal.ui.UIMessages; - -/** - * This action removes the active coverage session. - * - * @author Marc R. Hoffmann - * @version $Revision$ - */ -public class RemoveActiveSessionAction extends Action { - - public RemoveActiveSessionAction() { - setText(UIMessages.RemoveActiveSessionAction_label); - setToolTipText(UIMessages.RemoveActiveSessionAction_tooltip); - setImageDescriptor(EclEmmaUIPlugin.getImageDescriptor(EclEmmaUIPlugin.ELCL_REMOVE)); - setDisabledImageDescriptor(EclEmmaUIPlugin.getImageDescriptor(EclEmmaUIPlugin.DLCL_REMOVE)); - setActionDefinitionId("org.eclipse.ui.edit.delete"); //$NON-NLS-1$ - } - - public void run() { - ISessionManager manager = CoverageTools.getSessionManager(); - ICoverageSession session = manager.getActiveSession(); - if (session != null) { - manager.removeSession(session); - } - } - -} diff --git a/com.mountainminds.eclemma.ui/src/com/mountainminds/eclemma/internal/ui/actions/RemoveAllSessionsAction.java b/com.mountainminds.eclemma.ui/src/com/mountainminds/eclemma/internal/ui/actions/RemoveAllSessionsAction.java deleted file mode 100644 index e125ccc..0000000 --- a/com.mountainminds.eclemma.ui/src/com/mountainminds/eclemma/internal/ui/actions/RemoveAllSessionsAction.java +++ /dev/null @@ -1,37 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Mountainminds GmbH & Co. KG - * This software is provided under the terms of the Eclipse Public License v1.0 - * See http://www.eclipse.org/legal/epl-v10.html. - * - * $Id$ - ******************************************************************************/ -package com.mountainminds.eclemma.internal.ui.actions; - -import org.eclipse.jface.action.Action; - -import com.mountainminds.eclemma.core.CoverageTools; -import com.mountainminds.eclemma.core.ISessionManager; -import com.mountainminds.eclemma.internal.ui.EclEmmaUIPlugin; -import com.mountainminds.eclemma.internal.ui.UIMessages; - -/** - * This action removes all coverage sessions. - * - * @author Marc R. Hoffmann - * @version $Revision$ - */ -public class RemoveAllSessionsAction extends Action { - - public RemoveAllSessionsAction() { - setText(UIMessages.RemoveAllSessionsAction_label); - setToolTipText(UIMessages.RemoveAllSessionsAction_tooltip); - setImageDescriptor(EclEmmaUIPlugin.getImageDescriptor(EclEmmaUIPlugin.ELCL_REMOVEALL)); - setDisabledImageDescriptor(EclEmmaUIPlugin.getImageDescriptor(EclEmmaUIPlugin.DLCL_REMOVEALL)); - } - - public void run() { - ISessionManager manager = CoverageTools.getSessionManager(); - manager.removeAllSessions(); - } - -} diff --git a/com.mountainminds.eclemma.ui/src/com/mountainminds/eclemma/internal/ui/annotation/CoverageAnnotation.java b/com.mountainminds.eclemma.ui/src/com/mountainminds/eclemma/internal/ui/annotation/CoverageAnnotation.java deleted file mode 100644 index 46246a2..0000000 --- a/com.mountainminds.eclemma.ui/src/com/mountainminds/eclemma/internal/ui/annotation/CoverageAnnotation.java +++ /dev/null @@ -1,48 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Mountainminds GmbH & Co. KG - * This software is provided under the terms of the Eclipse Public License v1.0 - * See http://www.eclipse.org/legal/epl-v10.html. - * - * $Id$ - ******************************************************************************/ -package com.mountainminds.eclemma.internal.ui.annotation; - -import org.eclipse.jface.text.Position; -import org.eclipse.jface.text.source.Annotation; - -import com.mountainminds.eclemma.core.analysis.ILineCoverage; - -/** - * Annotation object that includes its position information to avoid internal - * mappings. - * - * @author Marc R. Hoffmann - * @version $Revision$ - */ -public class CoverageAnnotation extends Annotation { - - private static final String FULL_COVERAGE = "com.mountainminds.eclemma.ui.fullCoverageAnnotation"; //$NON-NLS-1$ - private static final String PARTIAL_COVERAGE = "com.mountainminds.eclemma.ui.partialCoverageAnnotation"; //$NON-NLS-1$ - private static final String NO_COVERAGE = "com.mountainminds.eclemma.ui.noCoverageAnnotation"; //$NON-NLS-1$ - - private final Position position; - - public CoverageAnnotation(int offset, int length, int status) { - super(getAnnotationID(status), false, null); - position = new Position(offset, length); - } - - public Position getPosition() { - return position; - } - - private static String getAnnotationID(int status) { - switch (status) { - case ILineCoverage.FULLY_COVERED: return FULL_COVERAGE; - case ILineCoverage.PARTLY_COVERED: return PARTIAL_COVERAGE; - case ILineCoverage.NOT_COVERED: return NO_COVERAGE; - } - throw new RuntimeException("Invalid status: " + status); //$NON-NLS-1$ - } - -} diff --git a/com.mountainminds.eclemma.ui/src/com/mountainminds/eclemma/internal/ui/annotation/CoverageAnnotationModel.java b/com.mountainminds.eclemma.ui/src/com/mountainminds/eclemma/internal/ui/annotation/CoverageAnnotationModel.java deleted file mode 100644 index ea86797..0000000 --- a/com.mountainminds.eclemma.ui/src/com/mountainminds/eclemma/internal/ui/annotation/CoverageAnnotationModel.java +++ /dev/null @@ -1,314 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Mountainminds GmbH & Co. KG - * This software is provided under the terms of the Eclipse Public License v1.0 - * See http://www.eclipse.org/legal/epl-v10.html. - * - * $Id$ - ******************************************************************************/ -package com.mountainminds.eclemma.internal.ui.annotation; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -import org.eclipse.core.resources.IResource; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.jdt.core.IJavaElement; -import org.eclipse.jdt.core.ISourceReference; -import org.eclipse.jdt.core.JavaModelException; -import org.eclipse.jface.text.BadLocationException; -import org.eclipse.jface.text.DocumentEvent; -import org.eclipse.jface.text.IDocument; -import org.eclipse.jface.text.IDocumentListener; -import org.eclipse.jface.text.IRegion; -import org.eclipse.jface.text.Position; -import org.eclipse.jface.text.source.Annotation; -import org.eclipse.jface.text.source.AnnotationModelEvent; -import org.eclipse.jface.text.source.IAnnotationModel; -import org.eclipse.jface.text.source.IAnnotationModelExtension; -import org.eclipse.jface.text.source.IAnnotationModelListener; -import org.eclipse.jface.text.source.IAnnotationModelListenerExtension; -import org.eclipse.ui.IEditorInput; -import org.eclipse.ui.texteditor.IDocumentProvider; -import org.eclipse.ui.texteditor.ITextEditor; - -import com.mountainminds.eclemma.core.CoverageTools; -import com.mountainminds.eclemma.core.analysis.IJavaCoverageListener; -import com.mountainminds.eclemma.core.analysis.IJavaElementCoverage; -import com.mountainminds.eclemma.core.analysis.ILineCoverage; -import com.mountainminds.eclemma.internal.ui.EclEmmaUIPlugin; - -/** - * IAnnotationModel implementation for efficient coverage highlighting. - * - * @author Marc R. Hoffmann - * @version $Revision$ - */ -public class CoverageAnnotationModel implements IAnnotationModel { - - /** Key used to piggyback our model to the editor's model. */ - private static final Object KEY = new Object(); - - /** List of current CoverageAnnotation objects */ - private List annotations = new ArrayList(32); - - /** List of registered IAnnotationModelListener */ - private List annotationModelListeners = new ArrayList(2); - - private final ITextEditor editor; - private final IDocument document; - private int openConnections = 0; - private boolean annotated = false; - - private IJavaCoverageListener coverageListener = new IJavaCoverageListener() { - public void coverageChanged() { - updateAnnotations(true); - } - }; - - private IDocumentListener documentListener = new IDocumentListener() { - public void documentChanged(DocumentEvent event) { - updateAnnotations(false); - } - - public void documentAboutToBeChanged(DocumentEvent event) { - } - }; - - private CoverageAnnotationModel(ITextEditor editor, IDocument document) { - this.editor = editor; - this.document = document; - updateAnnotations(true); - } - - /** - * Attaches a coverage annotation model for the given editor if the editor can - * be annotated. Does nothing if the model is already attached. - * - * @param editor - * Editor to attach a annotation model to - */ - public static void attach(ITextEditor editor) { - IDocumentProvider provider = editor.getDocumentProvider(); - // there may be text editors without document providers (SF #1725100) - if (provider == null) - return; - IAnnotationModel model = provider.getAnnotationModel(editor - .getEditorInput()); - if (!(model instanceof IAnnotationModelExtension)) - return; - IAnnotationModelExtension modelex = (IAnnotationModelExtension) model; - - IDocument document = provider.getDocument(editor.getEditorInput()); - - CoverageAnnotationModel coveragemodel = (CoverageAnnotationModel) modelex - .getAnnotationModel(KEY); - if (coveragemodel == null) { - coveragemodel = new CoverageAnnotationModel(editor, document); - modelex.addAnnotationModel(KEY, coveragemodel); - } - } - - /** - * Detaches the coverage annotation model from the given editor. If the editor - * does not have a model attached, this method does nothing. - * - * @param editor - * Editor to detach the annotation model from - */ - public static void detach(ITextEditor editor) { - IDocumentProvider provider = editor.getDocumentProvider(); - // there may be text editors without document providers (SF #1725100) - if (provider == null) - return; - IAnnotationModel model = provider.getAnnotationModel(editor - .getEditorInput()); - if (!(model instanceof IAnnotationModelExtension)) - return; - IAnnotationModelExtension modelex = (IAnnotationModelExtension) model; - modelex.removeAnnotationModel(KEY); - } - - protected void updateAnnotations(boolean force) { - ILineCoverage lineCoverage = null; - boolean annotate = false; - preconditions: { - if (editor.isDirty()) - break preconditions; - IEditorInput input = editor.getEditorInput(); - if (input == null) - break preconditions; - Object element = input.getAdapter(IJavaElement.class); - lineCoverage = findLineCoverage(element); - if (lineCoverage == null || !hasSource((IJavaElement) element)) - break preconditions; - annotate = true; - } - if (annotate) { - if (!annotated || force) { - createAnnotations(lineCoverage); - annotated = true; - } - } else { - if (annotated) { - clear(); - annotated = false; - } - } - } - - protected boolean hasSource(IJavaElement element) { - if (element instanceof ISourceReference) { - try { - return ((ISourceReference) element).getSourceRange() != null; - } catch (JavaModelException ex) { - // we ignore this, the resource seems to have problems - } - } - return false; - } - - protected ILineCoverage findLineCoverage(Object element) { - // Do we have a coverage info for the editor input? - IJavaElementCoverage coverage = CoverageTools.getCoverageInfo(element); - if (coverage == null) - return null; - - // Does the resource version (if any) corresponds to the coverage data? - IResource resource = (IResource) ((IAdaptable) element) - .getAdapter(IResource.class); - if (resource != null) { - if (resource.getModificationStamp() != coverage - .getResourceModificationStamp()) - return null; - } - - return coverage.getLineCoverage(); - } - - protected void clear() { - AnnotationModelEvent event = new AnnotationModelEvent(this); - clear(event); - fireModelChanged(event); - } - - protected void clear(AnnotationModelEvent event) { - for (Iterator i = annotations.iterator(); i.hasNext();) { - CoverageAnnotation ca = (CoverageAnnotation) i.next(); - event.annotationRemoved(ca, ca.getPosition()); - } - annotations.clear(); - } - - protected void createAnnotations(ILineCoverage linecoverage) { - AnnotationModelEvent event = new AnnotationModelEvent(this); - clear(event); - int firstline = linecoverage.getFirstLine(); - int lastline = linecoverage.getLastLine(); - try { - for (int l = firstline; l <= lastline; l++) { - int status = linecoverage.getCoverage(l); - if (status != ILineCoverage.NO_CODE) { - IRegion region = document.getLineInformation(l - 1); - int docoffset = region.getOffset(); - int doclength = region.getLength(); - // Extend annotation for subsequent lines with same status: - while (l < lastline && linecoverage.getCoverage(l + 1) == status) { - l++; - region = document.getLineInformation(l - 1); - doclength = region.getOffset() - docoffset + region.getLength(); - } - CoverageAnnotation ca = new CoverageAnnotation(docoffset, doclength, - status); - annotations.add(ca); - event.annotationAdded(ca); - } - } - } catch (BadLocationException ex) { - EclEmmaUIPlugin.log(ex); - } - fireModelChanged(event); - } - - public void addAnnotationModelListener(IAnnotationModelListener listener) { - if (!annotationModelListeners.contains(listener)) { - annotationModelListeners.add(listener); - fireModelChanged(new AnnotationModelEvent(this, true)); - } - } - - public void removeAnnotationModelListener(IAnnotationModelListener listener) { - annotationModelListeners.remove(listener); - } - - protected void fireModelChanged(AnnotationModelEvent event) { - event.markSealed(); - if (!event.isEmpty()) { - for (Iterator i = annotationModelListeners.iterator(); i.hasNext();) { - IAnnotationModelListener l = (IAnnotationModelListener) i.next(); - if (l instanceof IAnnotationModelListenerExtension) { - ((IAnnotationModelListenerExtension) l).modelChanged(event); - } else { - l.modelChanged(this); - } - } - } - } - - public void connect(IDocument document) { - if (this.document != document) - throw new RuntimeException("Can't connect to different document."); //$NON-NLS-1$ - for (Iterator i = annotations.iterator(); i.hasNext();) { - CoverageAnnotation ca = (CoverageAnnotation) i.next(); - try { - document.addPosition(ca.getPosition()); - } catch (BadLocationException ex) { - EclEmmaUIPlugin.log(ex); - } - } - if (openConnections++ == 0) { - CoverageTools.addJavaCoverageListener(coverageListener); - document.addDocumentListener(documentListener); - } - } - - public void disconnect(IDocument document) { - if (this.document != document) - throw new RuntimeException("Can't disconnect from different document."); //$NON-NLS-1$ - for (Iterator i = annotations.iterator(); i.hasNext();) { - CoverageAnnotation ca = (CoverageAnnotation) i.next(); - document.removePosition(ca.getPosition()); - } - if (--openConnections == 0) { - CoverageTools.removeJavaCoverageListener(coverageListener); - document.removeDocumentListener(documentListener); - } - } - - /** - * External modification is not supported. - */ - public void addAnnotation(Annotation annotation, Position position) { - throw new UnsupportedOperationException(); - } - - /** - * External modification is not supported. - */ - public void removeAnnotation(Annotation annotation) { - throw new UnsupportedOperationException(); - } - - public Iterator getAnnotationIterator() { - return annotations.iterator(); - } - - public Position getPosition(Annotation annotation) { - if (annotation instanceof CoverageAnnotation) { - return ((CoverageAnnotation) annotation).getPosition(); - } else { - return null; - } - } - -} diff --git a/com.mountainminds.eclemma.ui/src/com/mountainminds/eclemma/internal/ui/annotation/EditorTracker.java b/com.mountainminds.eclemma.ui/src/com/mountainminds/eclemma/internal/ui/annotation/EditorTracker.java deleted file mode 100644 index 2b4abee..0000000 --- a/com.mountainminds.eclemma.ui/src/com/mountainminds/eclemma/internal/ui/annotation/EditorTracker.java +++ /dev/null @@ -1,92 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Mountainminds GmbH & Co. KG - * This software is provided under the terms of the Eclipse Public License v1.0 - * See http://www.eclipse.org/legal/epl-v10.html. - * - * $Id$ - ******************************************************************************/ -package com.mountainminds.eclemma.internal.ui.annotation; - -import org.eclipse.ui.IEditorReference; -import org.eclipse.ui.IPartListener2; -import org.eclipse.ui.IWindowListener; -import org.eclipse.ui.IWorkbench; -import org.eclipse.ui.IWorkbenchPage; -import org.eclipse.ui.IWorkbenchPart; -import org.eclipse.ui.IWorkbenchPartReference; -import org.eclipse.ui.IWorkbenchWindow; -import org.eclipse.ui.texteditor.ITextEditor; - -/** - * Tracks the workbench editors and to attach coverage annotation models. - * - * @author Marc R. Hoffmann - * @version $Revision$ - */ -public class EditorTracker { - - private final IWorkbench workbench; - - private IWindowListener windowListener = new IWindowListener() { - public void windowOpened(IWorkbenchWindow window) { - window.getPartService().addPartListener(partListener); - } - public void windowClosed(IWorkbenchWindow window) { - window.getPartService().removePartListener(partListener); - } - public void windowActivated(IWorkbenchWindow window) { } - public void windowDeactivated(IWorkbenchWindow window) { } - }; - - private IPartListener2 partListener = new IPartListener2() { - public void partOpened(IWorkbenchPartReference partref) { - annotateEditor(partref); - } - public void partActivated(IWorkbenchPartReference partref) { } - public void partBroughtToTop(IWorkbenchPartReference partref) { } - public void partVisible(IWorkbenchPartReference partref) { } - public void partInputChanged(IWorkbenchPartReference partref) { } - public void partClosed(IWorkbenchPartReference partref) { } - public void partDeactivated(IWorkbenchPartReference partref) { } - public void partHidden(IWorkbenchPartReference partref) { } - }; - - public EditorTracker(IWorkbench workbench) { - this.workbench = workbench; - IWorkbenchWindow[] windows = workbench.getWorkbenchWindows(); - for (int i = 0; i < windows.length; i++) { - windows[i].getPartService().addPartListener(partListener); - } - workbench.addWindowListener(windowListener); - annotateAllEditors(); - } - - public void dispose() { - workbench.removeWindowListener(windowListener); - IWorkbenchWindow[] windows = workbench.getWorkbenchWindows(); - for (int i = 0; i < windows.length; i++) { - windows[i].getPartService().removePartListener(partListener); - } - } - - private void annotateAllEditors() { - IWorkbenchWindow[] windows = workbench.getWorkbenchWindows(); - for (int i = 0; i < windows.length; i++) { - IWorkbenchPage[] pages = windows[i].getPages(); - for (int j = 0; j < pages.length; j++) { - IEditorReference[] editors = pages[j].getEditorReferences(); - for (int k = 0; k < editors.length; k++) { - annotateEditor(editors[k]); - } - } - } - } - - private void annotateEditor(IWorkbenchPartReference partref) { - IWorkbenchPart part = partref.getPart(false); - if (part instanceof ITextEditor) { - CoverageAnnotationModel.attach((ITextEditor) part); - } - } - -} diff --git a/com.mountainminds.eclemma.ui/src/com/mountainminds/eclemma/internal/ui/coverageview/CollapseAllAction.java b/com.mountainminds.eclemma.ui/src/com/mountainminds/eclemma/internal/ui/coverageview/CollapseAllAction.java deleted file mode 100644 index 026fc8b..0000000 --- a/com.mountainminds.eclemma.ui/src/com/mountainminds/eclemma/internal/ui/coverageview/CollapseAllAction.java +++ /dev/null @@ -1,37 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2007 Mountainminds GmbH & Co. KG - * This software is provided under the terms of the Eclipse Public License v1.0 - * See http://www.eclipse.org/legal/epl-v10.html. - * - * $Id$ - ******************************************************************************/ -package com.mountainminds.eclemma.internal.ui.coverageview; - -import org.eclipse.jface.action.Action; -import org.eclipse.jface.viewers.TreeViewer; - -import com.mountainminds.eclemma.internal.ui.EclEmmaUIPlugin; -import com.mountainminds.eclemma.internal.ui.UIMessages; - -/** - * This action will collapse all node in the given tree. - * - * @author Marc R. Hoffmann - * @version $Revision$ - */ -class CollapseAllAction extends Action { - - private final TreeViewer viewer; - - CollapseAllAction(TreeViewer viewer) { - super(UIMessages.CoverageViewCollapseAllAction_label, AS_PUSH_BUTTON); - setToolTipText(UIMessages.CoverageViewCollapseAllAction_tooltip); - setImageDescriptor(EclEmmaUIPlugin.getImageDescriptor(EclEmmaUIPlugin.ELCL_COLLAPSEALL)); - this.viewer = viewer; - } - - public void run() { - viewer.collapseAll(); - } - -} diff --git a/com.mountainminds.eclemma.ui/src/com/mountainminds/eclemma/internal/ui/coverageview/CopyAction.java b/com.mountainminds.eclemma.ui/src/com/mountainminds/eclemma/internal/ui/coverageview/CopyAction.java deleted file mode 100644 index b6fd443..0000000 --- a/com.mountainminds.eclemma.ui/src/com/mountainminds/eclemma/internal/ui/coverageview/CopyAction.java +++ /dev/null @@ -1,103 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2009 Mountainminds GmbH & Co. KG - * This software is provided under the terms of the Eclipse Public License v1.0 - * See http://www.eclipse.org/legal/epl-v10.html. - * - * $Id: RemoveActiveSessionAction.java 96 2006-09-18 16:50:45Z mho $ - ******************************************************************************/ -package com.mountainminds.eclemma.internal.ui.coverageview; - -import java.util.Iterator; - -import org.eclipse.jface.viewers.ISelectionProvider; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.ITableLabelProvider; -import org.eclipse.swt.SWT; -import org.eclipse.swt.dnd.Clipboard; -import org.eclipse.swt.dnd.TextTransfer; -import org.eclipse.swt.dnd.Transfer; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Text; -import org.eclipse.ui.ISharedImages; -import org.eclipse.ui.PlatformUI; -import org.eclipse.ui.actions.SelectionProviderAction; - -import com.mountainminds.eclemma.internal.ui.UIMessages; - -/** - * This action copies a textual representation of the current selection to the - * clipboard. - * - * @author Marc R. Hoffmann - * @version $Revision: 96 $ - */ -class CopyAction extends SelectionProviderAction { - - private final Display display; - - private final ViewSettings settings; - - private final ITableLabelProvider labelprovider; - - private final ISelectionProvider selectionSource; - - public CopyAction(Display display, ViewSettings settings, - ITableLabelProvider labelprovider, ISelectionProvider selectionSource) { - super(selectionSource, UIMessages.CopyAction_label); - this.display = display; - this.settings = settings; - this.labelprovider = labelprovider; - this.selectionSource = selectionSource; - ISharedImages sharedImages = PlatformUI.getWorkbench().getSharedImages(); - setImageDescriptor(sharedImages - .getImageDescriptor(ISharedImages.IMG_TOOL_COPY)); - setDisabledImageDescriptor(sharedImages - .getImageDescriptor(ISharedImages.IMG_TOOL_COPY_DISABLED)); - setActionDefinitionId("org.eclipse.ui.edit.copy"); //$NON-NLS-1$ - } - - public void selectionChanged(IStructuredSelection selection) { - setEnabled(!selection.isEmpty()); - } - - public void run() { - final StringBuffer sb = new StringBuffer(); - - // Header - final String[] headers = settings.getCounterMode().getColumnHeaders(); - sb.append(headers[CoverageView.COLUMN_ELEMENT]).append(SWT.TAB); - sb.append(headers[CoverageView.COLUMN_RATIO]).append(SWT.TAB); - sb.append(headers[CoverageView.COLUMN_COVERED]).append(SWT.TAB); - sb.append(headers[CoverageView.COLUMN_MISSED]).append(SWT.TAB); - sb.append(headers[CoverageView.COLUMN_TOTAL]).append(Text.DELIMITER); - - // Rows: - final Iterator i = ((IStructuredSelection) selectionSource.getSelection()) - .iterator(); - while (i.hasNext()) { - final Object element = i.next(); - appendColumn(sb, element, CoverageView.COLUMN_ELEMENT).append(SWT.TAB); - appendColumn(sb, element, CoverageView.COLUMN_RATIO).append(SWT.TAB); - appendColumn(sb, element, CoverageView.COLUMN_COVERED).append(SWT.TAB); - appendColumn(sb, element, CoverageView.COLUMN_MISSED).append(SWT.TAB); - appendColumn(sb, element, CoverageView.COLUMN_TOTAL).append( - Text.DELIMITER); - } - - copy(sb.toString()); - } - - private final StringBuffer appendColumn(StringBuffer sb, Object element, - int column) { - sb.append(labelprovider.getColumnText(element, column)); - return sb; - } - - private void copy(String text) { - final Clipboard cb = new Clipboard(display); - final TextTransfer transfer = TextTransfer.getInstance(); - cb.setContents(new Object[] { text }, new Transfer[] { transfer }); - cb.dispose(); - } - -} diff --git a/com.mountainminds.eclemma.ui/src/com/mountainminds/eclemma/internal/ui/coverageview/CoverageView.java b/com.mountainminds.eclemma.ui/src/com/mountainminds/eclemma/internal/ui/coverageview/CoverageView.java deleted file mode 100644 index 8c8c910..0000000 --- a/com.mountainminds.eclemma.ui/src/com/mountainminds/eclemma/internal/ui/coverageview/CoverageView.java +++ /dev/null @@ -1,503 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2009 Mountainminds GmbH & Co. KG - * This software is provided under the terms of the Eclipse Public License v1.0 - * See http://www.eclipse.org/legal/epl-v10.html. - * - * $Id$ - * - * Contributors: - * Brock Janiczak - link with selection option (SF #1774547) - ******************************************************************************/ -package com.mountainminds.eclemma.internal.ui.coverageview; - -import java.text.DecimalFormat; - -import org.eclipse.jdt.core.IPackageFragmentRoot; -import org.eclipse.jdt.ui.IContextMenuConstants; -import org.eclipse.jdt.ui.actions.IJavaEditorActionDefinitionIds; -import org.eclipse.jdt.ui.actions.JdtActionConstants; -import org.eclipse.jdt.ui.actions.OpenAction; -import org.eclipse.jface.action.IAction; -import org.eclipse.jface.action.IMenuListener; -import org.eclipse.jface.action.IMenuManager; -import org.eclipse.jface.action.IToolBarManager; -import org.eclipse.jface.action.MenuManager; -import org.eclipse.jface.action.Separator; -import org.eclipse.jface.viewers.ILabelProvider; -import org.eclipse.jface.viewers.ILabelProviderListener; -import org.eclipse.jface.viewers.IOpenListener; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.ISelectionChangedListener; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.ITableLabelProvider; -import org.eclipse.jface.viewers.OpenEvent; -import org.eclipse.jface.viewers.SelectionChangedEvent; -import org.eclipse.jface.viewers.TreeViewer; -import org.eclipse.jface.viewers.Viewer; -import org.eclipse.jface.viewers.ViewerFilter; -import org.eclipse.swt.SWT; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Tree; -import org.eclipse.swt.widgets.TreeColumn; -import org.eclipse.ui.IActionBars; -import org.eclipse.ui.IKeyBindingService; -import org.eclipse.ui.IMemento; -import org.eclipse.ui.IViewSite; -import org.eclipse.ui.IWorkbenchActionConstants; -import org.eclipse.ui.PartInitException; -import org.eclipse.ui.actions.ActionFactory; -import org.eclipse.ui.dialogs.PropertyDialogAction; -import org.eclipse.ui.model.WorkbenchLabelProvider; -import org.eclipse.ui.part.IShowInTarget; -import org.eclipse.ui.part.ShowInContext; -import org.eclipse.ui.part.ViewPart; -import org.eclipse.ui.texteditor.IWorkbenchActionDefinitionIds; - -import com.mountainminds.eclemma.core.CoverageTools; -import com.mountainminds.eclemma.core.ICoverageSession; -import com.mountainminds.eclemma.core.ISessionListener; -import com.mountainminds.eclemma.core.analysis.ICounter; -import com.mountainminds.eclemma.core.analysis.IJavaCoverageListener; -import com.mountainminds.eclemma.core.analysis.IJavaElementCoverage; -import com.mountainminds.eclemma.internal.ui.ContextHelp; -import com.mountainminds.eclemma.internal.ui.EclEmmaUIPlugin; -import com.mountainminds.eclemma.internal.ui.UIMessages; -import com.mountainminds.eclemma.internal.ui.actions.ExportSessionAction; -import com.mountainminds.eclemma.internal.ui.actions.ImportSessionAction; -import com.mountainminds.eclemma.internal.ui.actions.MergeSessionsAction; -import com.mountainminds.eclemma.internal.ui.actions.RefreshSessionAction; -import com.mountainminds.eclemma.internal.ui.actions.RemoveActiveSessionAction; -import com.mountainminds.eclemma.internal.ui.actions.RemoveAllSessionsAction; - -/** - * Implementation of the coverage view. - * - * @author Marc R. Hoffmann - * @version $Revision$ - */ -public class CoverageView extends ViewPart implements IShowInTarget { - - public static final String ID = "com.mountainminds.eclemma.ui.CoverageView"; //$NON-NLS-1$ - - /** - * Placeholder element for displaying "Loading..." in the coverage view. - */ - public static final Object LOADING_ELEMENT = new Object(); - - private static final DecimalFormat COVERAGE_VALUE = new DecimalFormat( - UIMessages.CoverageView_columnCoverageValue); - - private ViewSettings settings = new ViewSettings(); - - protected static final int COLUMN_ELEMENT = 0; - protected static final int COLUMN_RATIO = 1; - protected static final int COLUMN_COVERED = 2; - protected static final int COLUMN_MISSED = 3; - protected static final int COLUMN_TOTAL = 4; - - private Tree tree; - private TreeColumn column0; - private TreeColumn column1; - private TreeColumn column2; - private TreeColumn column3; - private TreeColumn column4; - private TreeViewer viewer; - - // Actions - private OpenAction openAction; - private IAction copyAction; - private IAction relaunchSessionAction; - private IAction removeActiveSessionAction; - private IAction removeAllSessionsAction; - private IAction mergeSessionsAction; - private IAction selectSessionAction; - private IAction importAction; - private IAction exportAction; - private IAction refreshAction; - private PropertyDialogAction propertiesAction; - - private SelectionTracker selectiontracker; - private CoverageViewSorter sorter = new CoverageViewSorter(settings, this); - - private ISessionListener listener = new ISessionListener() { - public void sessionAdded(ICoverageSession newSession) { - updateActions(); - } - - public void sessionRemoved(ICoverageSession oldSession) { - updateActions(); - } - - public void sessionActivated(ICoverageSession session) { - updateActions(); - } - }; - - private IJavaCoverageListener coverageListener = new IJavaCoverageListener() { - public void coverageChanged() { - tree.getDisplay().asyncExec(new Runnable() { - public void run() { - viewer.setInput(CoverageTools.getJavaModelCoverage()); - } - }); - } - }; - - private ITableLabelProvider labelprovider = new ITableLabelProvider() { - - private ILabelProvider delegate = new WorkbenchLabelProvider(); - - public Image getColumnImage(Object element, int columnIndex) { - if (element == LOADING_ELEMENT) { - return null; - } - switch (columnIndex) { - case COLUMN_ELEMENT: - return delegate.getImage(element); - case COLUMN_RATIO: - ICounter counter = settings.getCounterMode().getCounter( - CoverageTools.getCoverageInfo(element)); - if (counter.getTotalCount() == 0) { - return null; - } else { - return EclEmmaUIPlugin.getCoverageImage(counter.getRatio()); - } - } - return null; - } - - private String getSimpleTextForJavaElement(Object element) { - if (element instanceof IPackageFragmentRoot) { - // tweak label if the package fragment root is the project itself: - IPackageFragmentRoot root = (IPackageFragmentRoot) element; - if (root.getElementName().length() == 0) { - element = root.getJavaProject(); - } - } - return delegate.getText(element); - } - - private String getTextForJavaElement(Object element) { - String text = getSimpleTextForJavaElement(element); - switch (settings.getEntryMode()) { - case ViewSettings.ENTRYMODE_PACKAGEROOTS: - if (element instanceof IPackageFragmentRoot) { - text += " - " + getTextForJavaElement(((IPackageFragmentRoot) element).getJavaProject()); //$NON-NLS-1$ - } - break; - } - return text; - } - - public String getColumnText(Object element, int columnIndex) { - if (element == LOADING_ELEMENT) { - return columnIndex == COLUMN_ELEMENT ? UIMessages.CoverageView_loadingMessage - : ""; //$NON-NLS-1$ - } - ICounter counter = settings.getCounterMode().getCounter( - CoverageTools.getCoverageInfo(element)); - switch (columnIndex) { - case COLUMN_ELEMENT: - return getTextForJavaElement(element); - case COLUMN_RATIO: - if (counter.getTotalCount() == 0) { - return ""; //$NON-NLS-1$ - } else { - return COVERAGE_VALUE.format(new Double(counter.getRatio())); - } - case COLUMN_COVERED: - return String.valueOf(counter.getCoveredCount()); - case COLUMN_MISSED: - return String.valueOf(counter.getMissedCount()); - case COLUMN_TOTAL: - return String.valueOf(counter.getTotalCount()); - } - return ""; //$NON-NLS-1$ - } - - public boolean isLabelProperty(Object element, String property) { - return delegate.isLabelProperty(element, property); - } - - public void addListener(ILabelProviderListener listener) { - delegate.addListener(listener); - } - - public void removeListener(ILabelProviderListener listener) { - delegate.removeListener(listener); - } - - public void dispose() { - delegate.dispose(); - } - }; - - public void init(IViewSite site, IMemento memento) throws PartInitException { - super.init(site, memento); - settings.init(memento); - } - - public void saveState(IMemento memento) { - int[] widths = settings.getColumnWidths(); - widths[0] = column0.getWidth(); - widths[1] = column1.getWidth(); - widths[2] = column2.getWidth(); - widths[3] = column3.getWidth(); - widths[4] = column4.getWidth(); - settings.save(memento); - super.saveState(memento); - } - - public void createPartControl(Composite parent) { - ContextHelp.setHelp(parent, ContextHelp.COVERAGE_VIEW); - tree = new Tree(parent, SWT.MULTI); - tree.setHeaderVisible(true); - tree.setLinesVisible(true); - int[] widths = settings.getColumnWidths(); - column0 = new TreeColumn(tree, SWT.NONE); - column0.setWidth(widths[0]); - sorter.addColumn(column0, COLUMN_ELEMENT); - column1 = new TreeColumn(tree, SWT.RIGHT); - column1.setWidth(widths[1]); - sorter.addColumn(column1, COLUMN_RATIO); - column2 = new TreeColumn(tree, SWT.RIGHT); - column2.setWidth(widths[2]); - sorter.addColumn(column2, COLUMN_COVERED); - column3 = new TreeColumn(tree, SWT.RIGHT); - column3.setWidth(widths[3]); - sorter.addColumn(column3, COLUMN_MISSED); - column4 = new TreeColumn(tree, SWT.RIGHT); - column4.setWidth(widths[4]); - sorter.addColumn(column4, COLUMN_TOTAL); - updateColumnHeaders(); - - TreeColumn sortColumn = null; - switch (settings.getSortColumn()) { - case COLUMN_ELEMENT: - sortColumn = column0; - break; - case COLUMN_RATIO: - sortColumn = column1; - break; - case COLUMN_COVERED: - sortColumn = column2; - break; - case COLUMN_MISSED: - sortColumn = column3; - break; - case COLUMN_TOTAL: - sortColumn = column4; - break; - } - - TreeSortCompatibility.setTreeSortColumnAndDirection(sortColumn, settings - .isReverseSort() ? SWT.DOWN : SWT.UP); - - viewer = new TreeViewer(tree); - viewer.addFilter(new ViewerFilter() { - public boolean select(Viewer viewer, Object parentElement, Object element) { - if (element == LOADING_ELEMENT) { - return true; - } else { - IJavaElementCoverage c = CoverageTools.getCoverageInfo(element); - if (c == null || c.getInstructionCounter().getTotalCount() == 0) { - return false; - } - if (settings.getHideUnusedTypes()) { - ICounter cnt = c.getTypeCounter(); - return cnt.getTotalCount() == 0 || cnt.getCoveredCount() != 0; - } - return true; - } - } - }); - viewer.setSorter(sorter); - viewer.setContentProvider(new CoveredElementsContentProvider(settings)); - viewer.setLabelProvider(labelprovider); - viewer.setInput(CoverageTools.getJavaModelCoverage()); - viewer.addSelectionChangedListener(new ISelectionChangedListener() { - public void selectionChanged(SelectionChangedEvent event) { - openAction - .selectionChanged((IStructuredSelection) event.getSelection()); - propertiesAction.selectionChanged(event); - } - }); - getSite().setSelectionProvider(viewer); - - selectiontracker = new SelectionTracker(this, viewer); - - createActions(); - updateActions(); - configureToolbar(); - - viewer.addOpenListener(new IOpenListener() { - public void open(OpenEvent event) { - openAction.run((IStructuredSelection) event.getSelection()); - } - }); - - MenuManager menuMgr = new MenuManager("#PopupMenu"); //$NON-NLS-1$ - menuMgr.setRemoveAllWhenShown(true); - tree.setMenu(menuMgr.createContextMenu(tree)); - menuMgr.addMenuListener(new IMenuListener() { - public void menuAboutToShow(IMenuManager menuMgr) { - configureContextMenu(menuMgr); - } - }); - - CoverageTools.getSessionManager().addSessionListener(listener); - CoverageTools.addJavaCoverageListener(coverageListener); - } - - protected void createActions() { - final IKeyBindingService kb = getSite().getKeyBindingService(); - final IActionBars ab = getViewSite().getActionBars(); - - openAction = new OpenAction(getSite()); - openAction - .setActionDefinitionId(IJavaEditorActionDefinitionIds.OPEN_EDITOR); - ab.setGlobalActionHandler(JdtActionConstants.OPEN, openAction); - openAction.setEnabled(false); - - copyAction = new CopyAction(tree.getDisplay(), settings, labelprovider, - viewer); - ab.setGlobalActionHandler(ActionFactory.COPY.getId(), copyAction); - - relaunchSessionAction = new RelaunchSessionAction(); - kb.registerAction(relaunchSessionAction); - - removeActiveSessionAction = new RemoveActiveSessionAction(); - ab.setGlobalActionHandler(ActionFactory.DELETE.getId(), - removeActiveSessionAction); - - removeAllSessionsAction = new RemoveAllSessionsAction(); - kb.registerAction(removeAllSessionsAction); - - mergeSessionsAction = new MergeSessionsAction(getSite() - .getWorkbenchWindow()); - kb.registerAction(mergeSessionsAction); - - selectSessionAction = new SelectSessionAction(); - kb.registerAction(selectSessionAction); - - importAction = new ImportSessionAction(getSite().getWorkbenchWindow()); - kb.registerAction(importAction); - - exportAction = new ExportSessionAction(getSite().getWorkbenchWindow()); - kb.registerAction(exportAction); - - refreshAction = new RefreshSessionAction(); - ab.setGlobalActionHandler(ActionFactory.REFRESH.getId(), refreshAction); - - propertiesAction = new PropertyDialogAction(getSite(), viewer); - propertiesAction - .setActionDefinitionId(IWorkbenchActionDefinitionIds.PROPERTIES); - ab.setGlobalActionHandler(ActionFactory.PROPERTIES.getId(), - propertiesAction); - } - - protected void configureToolbar() { - IToolBarManager tbm = getViewSite().getActionBars().getToolBarManager(); - tbm.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS)); - tbm.add(new Separator()); - tbm.add(relaunchSessionAction); - tbm.add(new Separator()); - tbm.add(removeActiveSessionAction); - tbm.add(removeAllSessionsAction); - tbm.add(mergeSessionsAction); - tbm.add(selectSessionAction); - tbm.add(new Separator()); - tbm.add(new CollapseAllAction(viewer)); - tbm.add(new LinkWithSelectionAction(settings, selectiontracker)); - - IMenuManager mm = getViewSite().getActionBars().getMenuManager(); - mm.add(new SelectEntryModeAction(ViewSettings.ENTRYMODE_PROJECTS, settings, - this)); - mm.add(new SelectEntryModeAction(ViewSettings.ENTRYMODE_PACKAGEROOTS, - settings, this)); - mm.add(new SelectEntryModeAction(ViewSettings.ENTRYMODE_PACKAGES, settings, - this)); - mm.add(new SelectEntryModeAction(ViewSettings.ENTRYMODE_TYPES, settings, - this)); - mm.add(new Separator()); - mm.add(new SelectCounterModeAction(0, settings, this)); - mm.add(new SelectCounterModeAction(1, settings, this)); - mm.add(new SelectCounterModeAction(2, settings, this)); - mm.add(new SelectCounterModeAction(3, settings, this)); - mm.add(new SelectCounterModeAction(4, settings, this)); - mm.add(new Separator()); - mm.add(new HideUnusedTypesAction(settings, this)); - mm.add(new Separator()); - mm.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS)); - } - - public void configureContextMenu(IMenuManager mm) { - mm.add(openAction); - mm.add(new Separator()); - mm.add(copyAction); - mm.add(new Separator()); - mm.add(importAction); - mm.add(exportAction); - mm.add(new Separator()); - mm.add(refreshAction); - mm.add(new Separator(IContextMenuConstants.GROUP_ADDITIONS)); - mm.add(propertiesAction); - } - - public void setFocus() { - tree.setFocus(); - } - - public void dispose() { - CoverageTools.removeJavaCoverageListener(coverageListener); - CoverageTools.getSessionManager().removeSessionListener(listener); - selectiontracker.dispose(); - super.dispose(); - } - - protected void updateColumnHeaders() { - String[] columns = settings.getCounterMode().getColumnHeaders(); - column0.setText(columns[0]); - column1.setText(columns[1]); - column2.setText(columns[2]); - column3.setText(columns[3]); - column4.setText(columns[4]); - } - - protected void updateActions() { - tree.getDisplay().asyncExec(new Runnable() { - public void run() { - ICoverageSession active = CoverageTools.getSessionManager() - .getActiveSession(); - setContentDescription(active == null ? "" : active.getDescription()); //$NON-NLS-1$ - relaunchSessionAction.setEnabled(active != null - && active.getLaunchConfiguration() != null); - ICoverageSession[] sessions = CoverageTools.getSessionManager() - .getSessions(); - boolean atLeastOne = sessions.length >= 1; - removeActiveSessionAction.setEnabled(atLeastOne); - removeAllSessionsAction.setEnabled(atLeastOne); - exportAction.setEnabled(atLeastOne); - refreshAction.setEnabled(atLeastOne); - selectSessionAction.setEnabled(atLeastOne); - boolean atLeastTwo = sessions.length >= 2; - mergeSessionsAction.setEnabled(atLeastTwo); - } - }); - } - - protected void refreshViewer() { - viewer.refresh(); - } - - public boolean show(ShowInContext context) { - final ISelection selection = context.getSelection(); - if (selection instanceof IStructuredSelection) { - viewer.setSelection(selection); - return true; - } - return false; - } - -} diff --git a/com.mountainminds.eclemma.ui/src/com/mountainminds/eclemma/internal/ui/coverageview/CoverageViewSorter.java b/com.mountainminds.eclemma.ui/src/com/mountainminds/eclemma/internal/ui/coverageview/CoverageViewSorter.java deleted file mode 100644 index 64cdaa5..0000000 --- a/com.mountainminds.eclemma.ui/src/com/mountainminds/eclemma/internal/ui/coverageview/CoverageViewSorter.java +++ /dev/null @@ -1,83 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Mountainminds GmbH & Co. KG - * This software is provided under the terms of the Eclipse Public License v1.0 - * See http://www.eclipse.org/legal/epl-v10.html. - * - * $Id$ - ******************************************************************************/ -package com.mountainminds.eclemma.internal.ui.coverageview; - -import org.eclipse.jdt.ui.JavaElementSorter; -import org.eclipse.jface.viewers.Viewer; -import org.eclipse.jface.viewers.ViewerSorter; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.events.SelectionListener; -import org.eclipse.swt.widgets.TreeColumn; - -import com.mountainminds.eclemma.core.CoverageTools; -import com.mountainminds.eclemma.core.analysis.ICounter; -import com.mountainminds.eclemma.internal.ui.coverageview.ViewSettings.ICounterMode; - -/** - * Internal sorter for the coverage view. - * - * @author Marc R. Hoffmann - * @version $Revision$ - */ -class CoverageViewSorter extends ViewerSorter { - - private final ViewSettings settings; - private final CoverageView view; - private final ViewerSorter elementsorter = new JavaElementSorter(); - - public CoverageViewSorter(ViewSettings settings, CoverageView view) { - this.settings = settings; - this.view = view; - } - - void addColumn(final TreeColumn column, final int columnidx) { - column.addSelectionListener(new SelectionListener() { - public void widgetSelected(SelectionEvent e) { - settings.toggleSortColumn(columnidx); - TreeSortCompatibility.setTreeSortColumnAndDirection(column, settings - .isReverseSort() ? SWT.DOWN : SWT.UP); - view.refreshViewer(); - } - - public void widgetDefaultSelected(SelectionEvent e) { - } - }); - } - - public int compare(Viewer viewer, Object e1, Object e2) { - ICounterMode mode = settings.getCounterMode(); - ICounter c1 = mode.getCounter(CoverageTools.getCoverageInfo(e1)); - ICounter c2 = mode.getCounter(CoverageTools.getCoverageInfo(e2)); - int res = 0; - switch (settings.getSortColumn()) { - case CoverageView.COLUMN_ELEMENT: - res = elementsorter.compare(viewer, e1, e2); - break; - case CoverageView.COLUMN_RATIO: - res = Double.compare(c1.getRatio(), c2.getRatio()); - break; - case CoverageView.COLUMN_COVERED: - res = (int) (c1.getCoveredCount() - c2.getCoveredCount()); - break; - case CoverageView.COLUMN_MISSED: - res = (int) (c1.getMissedCount() - c2.getMissedCount()); - break; - case CoverageView.COLUMN_TOTAL: - res = (int) (c1.getTotalCount() - c2.getTotalCount()); - break; - } - if (res == 0) { - res = elementsorter.compare(viewer, e1, e2); - } else { - res = settings.isReverseSort() ? -res : res; - } - return res; - } - -} diff --git a/com.mountainminds.eclemma.ui/src/com/mountainminds/eclemma/internal/ui/coverageview/CoveredElementsContentProvider.java b/com.mountainminds.eclemma.ui/src/com/mountainminds/eclemma/internal/ui/coverageview/CoveredElementsContentProvider.java deleted file mode 100644 index 0725ac3..0000000 --- a/com.mountainminds.eclemma.ui/src/com/mountainminds/eclemma/internal/ui/coverageview/CoveredElementsContentProvider.java +++ /dev/null @@ -1,49 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Mountainminds GmbH & Co. KG - * This software is provided under the terms of the Eclipse Public License v1.0 - * See http://www.eclipse.org/legal/epl-v10.html. - * - * $Id$ - ******************************************************************************/ -package com.mountainminds.eclemma.internal.ui.coverageview; - -import org.eclipse.ui.model.WorkbenchContentProvider; - -import com.mountainminds.eclemma.core.analysis.IJavaModelCoverage; - -/** - * Specialized workbench content provider that selects entry elements depending - * on the view setting (projects, package roots, packages or types). - * - * @author Marc R. Hoffmann - * @version $Revision$ - */ -class CoveredElementsContentProvider extends WorkbenchContentProvider { - - private final ViewSettings settings; - - public CoveredElementsContentProvider(ViewSettings settings) { - this.settings = settings; - } - - public Object[] getElements(Object element) { - IJavaModelCoverage coverage = (IJavaModelCoverage) element; - if (coverage == IJavaModelCoverage.LOADING) { - return new Object[] { CoverageView.LOADING_ELEMENT }; - } - if (coverage != null) { - switch (settings.getEntryMode()) { - case ViewSettings.ENTRYMODE_PROJECTS: - return coverage.getInstrumentedProjects(); - case ViewSettings.ENTRYMODE_PACKAGEROOTS: - return coverage.getInstrumentedPackageFragmentRoots(); - case ViewSettings.ENTRYMODE_PACKAGES: - return coverage.getInstrumentedPackageFragments(); - case ViewSettings.ENTRYMODE_TYPES: - return coverage.getInstrumentedTypes(); - } - } - return new Object[0]; - } - -} diff --git a/com.mountainminds.eclemma.ui/src/com/mountainminds/eclemma/internal/ui/coverageview/HideUnusedTypesAction.java b/com.mountainminds.eclemma.ui/src/com/mountainminds/eclemma/internal/ui/coverageview/HideUnusedTypesAction.java deleted file mode 100644 index f9d736d..0000000 --- a/com.mountainminds.eclemma.ui/src/com/mountainminds/eclemma/internal/ui/coverageview/HideUnusedTypesAction.java +++ /dev/null @@ -1,37 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2007 Mountainminds GmbH & Co. KG - * This software is provided under the terms of the Eclipse Public License v1.0 - * See http://www.eclipse.org/legal/epl-v10.html. - * - * $Id$ - ******************************************************************************/ -package com.mountainminds.eclemma.internal.ui.coverageview; - -import org.eclipse.jface.action.Action; - -import com.mountainminds.eclemma.internal.ui.UIMessages; - -/** - * Action to hide types not loaded at all. Internally used by the coverage view. - * - * @author Marc R. Hoffmann - * @version $Revision$ - */ -class HideUnusedTypesAction extends Action { - - private final ViewSettings settings; - private final CoverageView view; - - HideUnusedTypesAction(ViewSettings settings, CoverageView view) { - super(UIMessages.CoverageViewHideUnusedTypesAction_label, AS_CHECK_BOX); - this.settings = settings; - this.view = view; - setChecked(settings.getHideUnusedTypes()); - } - - public void run() { - settings.setHideUnusedTypes(isChecked()); - view.refreshViewer(); - } - -} diff --git a/com.mountainminds.eclemma.ui/src/com/mountainminds/eclemma/internal/ui/coverageview/LinkWithSelectionAction.java b/com.mountainminds.eclemma.ui/src/com/mountainminds/eclemma/internal/ui/coverageview/LinkWithSelectionAction.java deleted file mode 100644 index b357de0..0000000 --- a/com.mountainminds.eclemma.ui/src/com/mountainminds/eclemma/internal/ui/coverageview/LinkWithSelectionAction.java +++ /dev/null @@ -1,45 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2007 Mountainminds GmbH & Co. KG - * This software is provided under the terms of the Eclipse Public License v1.0 - * See http://www.eclipse.org/legal/epl-v10.html. - * - * $Id$ - * - * Contributors: - * Brock Janiczak - link with selection option (SF #1774547) - ******************************************************************************/ -package com.mountainminds.eclemma.internal.ui.coverageview; - -import org.eclipse.jface.action.Action; - -import com.mountainminds.eclemma.internal.ui.EclEmmaUIPlugin; -import com.mountainminds.eclemma.internal.ui.UIMessages; - -/** - * Action to enable linking of the coverage view's selection with the current - * selection in the workbench. Internally used by the coverage view. - * - * @author Marc R. Hoffmann - * @version $Revision$ - */ -class LinkWithSelectionAction extends Action { - - private final ViewSettings settings; - private final SelectionTracker tracker; - - LinkWithSelectionAction(ViewSettings settings, SelectionTracker tracker) { - super(UIMessages.CoverageViewLinkWithSelectionAction_label, AS_CHECK_BOX); - setToolTipText(UIMessages.CoverageViewLinkWithSelectionAction_tooltip); - setImageDescriptor(EclEmmaUIPlugin.getImageDescriptor(EclEmmaUIPlugin.ELCL_LINKED)); - this.settings = settings; - this.tracker = tracker; - setChecked(settings.getLinked()); - } - - public void run() { - boolean flag = isChecked(); - settings.setLinked(flag); - tracker.setEnabled(flag); - } - -} diff --git a/com.mountainminds.eclemma.ui/src/com/mountainminds/eclemma/internal/ui/coverageview/RelaunchSessionAction.java b/com.mountainminds.eclemma.ui/src/com/mountainminds/eclemma/internal/ui/coverageview/RelaunchSessionAction.java deleted file mode 100644 index d836aa8..0000000 --- a/com.mountainminds.eclemma.ui/src/com/mountainminds/eclemma/internal/ui/coverageview/RelaunchSessionAction.java +++ /dev/null @@ -1,48 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Mountainminds GmbH & Co. KG - * This software is provided under the terms of the Eclipse Public License v1.0 - * See http://www.eclipse.org/legal/epl-v10.html. - * - * $Id$ - ******************************************************************************/ -package com.mountainminds.eclemma.internal.ui.coverageview; - -import org.eclipse.debug.core.ILaunchConfiguration; -import org.eclipse.debug.ui.DebugUITools; -import org.eclipse.jface.action.Action; - -import com.mountainminds.eclemma.core.CoverageTools; -import com.mountainminds.eclemma.core.ICoverageSession; -import com.mountainminds.eclemma.core.ISessionManager; -import com.mountainminds.eclemma.internal.ui.EclEmmaUIPlugin; -import com.mountainminds.eclemma.internal.ui.UIMessages; - -/** - * This action removes the active coverage session. Internally used by the - * coverage view. - * - * @author Marc R. Hoffmann - * @version $Revision$ - */ -class RelaunchSessionAction extends Action { - - RelaunchSessionAction() { - setText(UIMessages.CoverageViewRelaunchAction_label); - setToolTipText(UIMessages.CoverageViewRelaunchAction_tooltip); - setImageDescriptor(EclEmmaUIPlugin.getImageDescriptor(EclEmmaUIPlugin.ELCL_RELAUNCH)); - setDisabledImageDescriptor(EclEmmaUIPlugin.getImageDescriptor(EclEmmaUIPlugin.DLCL_RELAUNCH)); - setEnabled(false); - } - - public void run() { - ISessionManager manager = CoverageTools.getSessionManager(); - ICoverageSession session = manager.getActiveSession(); - if (session != null) { - ILaunchConfiguration config = session.getLaunchConfiguration(); - if (config != null) { - DebugUITools.launch(config, CoverageTools.LAUNCH_MODE); - } - } - } - -} diff --git a/com.mountainminds.eclemma.ui/src/com/mountainminds/eclemma/internal/ui/coverageview/SelectCounterModeAction.java b/com.mountainminds.eclemma.ui/src/com/mountainminds/eclemma/internal/ui/coverageview/SelectCounterModeAction.java deleted file mode 100644 index f1cb7ba..0000000 --- a/com.mountainminds.eclemma.ui/src/com/mountainminds/eclemma/internal/ui/coverageview/SelectCounterModeAction.java +++ /dev/null @@ -1,38 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Mountainminds GmbH & Co. KG - * This software is provided under the terms of the Eclipse Public License v1.0 - * See http://www.eclipse.org/legal/epl-v10.html. - * - * $Id$ - ******************************************************************************/ -package com.mountainminds.eclemma.internal.ui.coverageview; - -import org.eclipse.jface.action.Action; - -/** - * Action to select the counter mode. Internally used by the coverage view. - * - * @author Marc R. Hoffmann - * @version $Revision$ - */ -class SelectCounterModeAction extends Action { - - private final int modeidx; - private final ViewSettings settings; - private final CoverageView view; - - SelectCounterModeAction(int modeidx, ViewSettings settings, CoverageView view) { - super(ViewSettings.COUNTERMODES[modeidx].getActionLabel(), AS_RADIO_BUTTON); - this.modeidx = modeidx; - this.settings = settings; - this.view = view; - setChecked(modeidx == settings.getCounterMode().getIdx()); - } - - public void run() { - settings.setCounterMode(modeidx); - view.updateColumnHeaders(); - view.refreshViewer(); - } - -} diff --git a/com.mountainminds.eclemma.ui/src/com/mountainminds/eclemma/internal/ui/coverageview/SelectEntryModeAction.java b/com.mountainminds.eclemma.ui/src/com/mountainminds/eclemma/internal/ui/coverageview/SelectEntryModeAction.java deleted file mode 100644 index d56998d..0000000 --- a/com.mountainminds.eclemma.ui/src/com/mountainminds/eclemma/internal/ui/coverageview/SelectEntryModeAction.java +++ /dev/null @@ -1,67 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Mountainminds GmbH & Co. KG - * This software is provided under the terms of the Eclipse Public License v1.0 - * See http://www.eclipse.org/legal/epl-v10.html. - * - * $Id$ - ******************************************************************************/ -package com.mountainminds.eclemma.internal.ui.coverageview; - -import org.eclipse.jface.action.Action; -import org.eclipse.jface.action.IAction; - -import com.mountainminds.eclemma.internal.ui.EclEmmaUIPlugin; -import com.mountainminds.eclemma.internal.ui.UIMessages; - -/** - * This action selects one of the counter modes. Internally used by the - * coverage view. - * - * @author Marc R. Hoffmann - * @version $Revision$ - */ -class SelectEntryModeAction extends Action { - - private final ViewSettings settings; - private final int mode; - private final CoverageView view; - - - SelectEntryModeAction(int mode, ViewSettings settings, CoverageView view) { - super(null, IAction.AS_RADIO_BUTTON); - this.mode = mode; - this.settings = settings; - this.view = view; - setChecked(mode == settings.getEntryMode()); - String iconkey = null; - switch (mode) { - case ViewSettings.ENTRYMODE_PROJECTS: - setText(UIMessages.CoverageViewShowProjectsAction_label); - setToolTipText(UIMessages.CoverageViewShowProjectsAction_tooltip); - iconkey = EclEmmaUIPlugin.ELCL_SHOWPROJECTS; - break; - case ViewSettings.ENTRYMODE_PACKAGEROOTS: - setText(UIMessages.CoverageViewShowPackageRootsAction_label); - setToolTipText(UIMessages.CoverageViewShowPackageRootsAction_tooltip); - iconkey = EclEmmaUIPlugin.ELCL_SHOWPACKAGEROOTS; - break; - case ViewSettings.ENTRYMODE_PACKAGES: - setText(UIMessages.CoverageViewShowPackagesAction_label); - setToolTipText(UIMessages.CoverageViewShowPackagesAction_tooltip); - iconkey = EclEmmaUIPlugin.ELCL_SHOWPACKAGES; - break; - case ViewSettings.ENTRYMODE_TYPES: - setText(UIMessages.CoverageViewShowTypesAction_label); - setToolTipText(UIMessages.CoverageViewShowTypesAction_tooltip); - iconkey = EclEmmaUIPlugin.ELCL_SHOWTYPES; - break; - } - setImageDescriptor(EclEmmaUIPlugin.getImageDescriptor(iconkey)); - } - - public void run() { - settings.setEntryMode(mode); - view.refreshViewer(); - } - -} diff --git a/com.mountainminds.eclemma.ui/src/com/mountainminds/eclemma/internal/ui/coverageview/SelectSessionAction.java b/com.mountainminds.eclemma.ui/src/com/mountainminds/eclemma/internal/ui/coverageview/SelectSessionAction.java deleted file mode 100644 index 785315c..0000000 --- a/com.mountainminds.eclemma.ui/src/com/mountainminds/eclemma/internal/ui/coverageview/SelectSessionAction.java +++ /dev/null @@ -1,85 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Mountainminds GmbH & Co. KG - * This software is provided under the terms of the Eclipse Public License v1.0 - * See http://www.eclipse.org/legal/epl-v10.html. - * - * $Id$ - ******************************************************************************/ -package com.mountainminds.eclemma.internal.ui.coverageview; - -import org.eclipse.jface.action.Action; -import org.eclipse.jface.action.IMenuCreator; -import org.eclipse.jface.viewers.ILabelProvider; -import org.eclipse.osgi.util.NLS; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Menu; -import org.eclipse.swt.widgets.MenuItem; -import org.eclipse.ui.model.WorkbenchLabelProvider; - -import com.mountainminds.eclemma.core.CoverageTools; -import com.mountainminds.eclemma.core.ICoverageSession; -import com.mountainminds.eclemma.core.ISessionManager; -import com.mountainminds.eclemma.internal.ui.EclEmmaUIPlugin; -import com.mountainminds.eclemma.internal.ui.UIMessages; - -/** - * Drop-down action to select the active session. Internally used by the - * coverage view. - * - * @author Marc R. Hoffmann - * @version $Revision$ - */ -class SelectSessionAction extends Action implements IMenuCreator { - - private Menu menu; - - SelectSessionAction() { - setText(UIMessages.CoverageViewSelectSessionAction_label); - setToolTipText(UIMessages.CoverageViewSelectSessionAction_looltip); - setImageDescriptor(EclEmmaUIPlugin - .getImageDescriptor(EclEmmaUIPlugin.ELCL_SESSION)); - setDisabledImageDescriptor(EclEmmaUIPlugin - .getImageDescriptor(EclEmmaUIPlugin.DLCL_SESSION)); - setMenuCreator(this); - setEnabled(false); - } - - public Menu getMenu(Control parent) { - if (menu != null) { - menu.dispose(); - } - menu = new Menu(parent); - - ILabelProvider labelprovider = new WorkbenchLabelProvider(); - final ISessionManager manager = CoverageTools.getSessionManager(); - ICoverageSession[] sessions = manager.getSessions(); - ICoverageSession active = manager.getActiveSession(); - for (int i = 0; i < sessions.length; i++) { - final ICoverageSession session = sessions[i]; - MenuItem item = new MenuItem(menu, SWT.RADIO); - Object[] labelparams = new Object[] { new Integer(i + 1), - labelprovider.getText(session) }; - item.setText(NLS.bind(UIMessages.CoverageViewSelectSessionActionEntry_label, - labelparams)); - item.setImage(labelprovider.getImage(session)); - item.setSelection(session == active); - item.addSelectionListener(new SelectionAdapter() { - public void widgetSelected(SelectionEvent e) { - manager.activateSession(session); - } - }); - } - return menu; - } - - public Menu getMenu(Menu parent) { - return null; - } - - public void dispose() { - } - -} diff --git a/com.mountainminds.eclemma.ui/src/com/mountainminds/eclemma/internal/ui/coverageview/SelectionTracker.java b/com.mountainminds.eclemma.ui/src/com/mountainminds/eclemma/internal/ui/coverageview/SelectionTracker.java deleted file mode 100644 index b7df294..0000000 --- a/com.mountainminds.eclemma.ui/src/com/mountainminds/eclemma/internal/ui/coverageview/SelectionTracker.java +++ /dev/null @@ -1,168 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2007 Mountainminds GmbH & Co. KG - * This software is provided under the terms of the Eclipse Public License v1.0 - * See http://www.eclipse.org/legal/epl-v10.html. - * - * $Id$ - * - * Contributors: - * Brock Janiczak - link with selection option (SF #1774547) - ******************************************************************************/ -package com.mountainminds.eclemma.internal.ui.coverageview; - -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.jdt.core.IClassFile; -import org.eclipse.jdt.core.ICompilationUnit; -import org.eclipse.jdt.core.IJavaElement; -import org.eclipse.jdt.core.JavaModelException; -import org.eclipse.jface.text.IMarkSelection; -import org.eclipse.jface.text.ITextSelection; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.jface.viewers.StructuredViewer; -import org.eclipse.ui.IEditorPart; -import org.eclipse.ui.ISelectionListener; -import org.eclipse.ui.IViewPart; -import org.eclipse.ui.IWorkbenchPart; - -/** - * Tracks the current selection of Java elements in a workbench page and - * synchronizes the selection of a target view. The selection is either taken - * from a structured viewer of from an editor input. - * - * @author Marc R. Hoffmann - * @version $Revision$ - */ -class SelectionTracker { - - private final IViewPart targetview; - private final StructuredViewer target; - - private boolean enabled = false; - private IJavaElement currentSelection = null; - - private final ISelectionListener listener = new ISelectionListener() { - public void selectionChanged(IWorkbenchPart part, ISelection selection) { - if (part != targetview) { - if (selection instanceof IStructuredSelection) { - IStructuredSelection ssel = (IStructuredSelection) selection; - if (ssel.size() == 1) { - IJavaElement element = getJavaElement(ssel.getFirstElement()); - if (element != null) applySelection(element, false); - } - return; - } - if (part instanceof IEditorPart) { - IJavaElement element = getJavaElement(((IEditorPart) part).getEditorInput()); - if (element != null) { - element = findElementAtCursor(element, selection); - applySelection(element, false); - } - } - } - } - }; - - /** - * Try to derive a java element handle from the given object. - * - * @param object base object - * @return java element handle or null - */ - private IJavaElement getJavaElement(Object object) { - if (object instanceof IJavaElement) { - return (IJavaElement) object; - } - if (object instanceof IAdaptable) { - IAdaptable a = (IAdaptable) object; - return (IJavaElement) a.getAdapter(IJavaElement.class); - } - return null; - } - - /** - * Try to identify a nested java element of the given element from a textual - * selection in its source code. This might be possible if the given element - * is a compilation unit or class file. - * - * @param unit unit to search - * @param selection selection within this unit - * @return nested element or the unit itself - */ - private IJavaElement findElementAtCursor(IJavaElement unit, ISelection selection) { - int pos = -1; - if (selection instanceof ITextSelection) { - pos = ((ITextSelection) selection).getOffset(); - } - if (selection instanceof IMarkSelection) { - pos = ((IMarkSelection) selection).getOffset(); - } - if (pos == -1) return unit; - IJavaElement element = null; - try { - switch (unit.getElementType()) { - case IJavaElement.COMPILATION_UNIT: - element = ((ICompilationUnit) unit).getElementAt(pos); - break; - case IJavaElement.CLASS_FILE: - element = ((IClassFile) unit).getElementAt(pos); - break; - } - } catch (JavaModelException e) { - // we ignore this - } - return element == null ? unit : element; - } - - /** - * Selects the given element in the taget viewer when the tracker is enabled - * and the target view is not active. This conditions can be overruled by the - * force parameter. - * - * @param element element to select - * @param force if true the selection is applied in any case - */ - private void applySelection(IJavaElement element, boolean force) { - currentSelection = element; - if (force || (enabled && targetview != targetview.getSite().getPage().getActivePart())) { - target.setSelection(new StructuredSelection(element), true); - } - } - - /** - * Creates a new tracker for the given target view and viewer. The tracker - * registers itself with the workbench and must be {@link #dispose()}d when it - * is no longer used. - * - * @param targetview view to wich the workbench selections are applied - * @param target viewer to wich the workbench selections are applied - */ - public SelectionTracker(IViewPart targetview, StructuredViewer target) { - this.targetview = targetview; - this.target = target; - targetview.getSite().getPage().addPostSelectionListener(listener); - } - - /** - * Enables or disables the tracker. If the tracker becomes enabled the last - * workbench selection is immediately applied. - * - * @param enabled flag whether the tracker should become enabled - */ - public void setEnabled(boolean enabled) { - this.enabled = enabled; - if (enabled && currentSelection != null) { - applySelection(currentSelection, true); - } - } - - /** - * Disposes the tracking functionality. This must be called before the target - * view and viewer get destroyed. - */ - public void dispose() { - targetview.getSite().getPage().removePostSelectionListener(listener); - } - -} diff --git a/com.mountainminds.eclemma.ui/src/com/mountainminds/eclemma/internal/ui/coverageview/TreeSortCompatibility.java b/com.mountainminds.eclemma.ui/src/com/mountainminds/eclemma/internal/ui/coverageview/TreeSortCompatibility.java deleted file mode 100644 index c98fc8f..0000000 --- a/com.mountainminds.eclemma.ui/src/com/mountainminds/eclemma/internal/ui/coverageview/TreeSortCompatibility.java +++ /dev/null @@ -1,42 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2007 Mountainminds GmbH & Co. KG - * This software is provided under the terms of the Eclipse Public License v1.0 - * See http://www.eclipse.org/legal/epl-v10.html. - * - * $Id$ - ******************************************************************************/ -package com.mountainminds.eclemma.internal.ui.coverageview; - -import java.lang.reflect.Method; - -import org.eclipse.swt.widgets.Tree; -import org.eclipse.swt.widgets.TreeColumn; - -/** - * Attempts to set the sort order/direction of a tree using reflection to - * maintain compatibility with older versions of SWT - * - * @author Brock Janiczak - * @version $Revision$ - */ -public final class TreeSortCompatibility { - private TreeSortCompatibility() { - } - - private static boolean sortingAvailable = true; - - public static void setTreeSortColumnAndDirection(TreeColumn sortColumn, int direction) { - if (sortingAvailable) { - try { - Method setSortColumn = Tree.class.getMethod("setSortColumn", new Class[] {TreeColumn.class}); //$NON-NLS-1$ - setSortColumn.invoke(sortColumn.getParent(), new Object[] {sortColumn}); - - Method setSortDirection = Tree.class.getMethod("setSortDirection", new Class[] {int.class}); //$NON-NLS-1$ - setSortDirection.invoke(sortColumn.getParent(), new Object[] {new Integer(direction)}); - - } catch (Exception e) { - sortingAvailable = false; - } - } - } -} diff --git a/com.mountainminds.eclemma.ui/src/com/mountainminds/eclemma/internal/ui/coverageview/ViewSettings.java b/com.mountainminds.eclemma.ui/src/com/mountainminds/eclemma/internal/ui/coverageview/ViewSettings.java deleted file mode 100644 index 7825710..0000000 --- a/com.mountainminds.eclemma.ui/src/com/mountainminds/eclemma/internal/ui/coverageview/ViewSettings.java +++ /dev/null @@ -1,263 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2007 Mountainminds GmbH & Co. KG - * This software is provided under the terms of the Eclipse Public License v1.0 - * See http://www.eclipse.org/legal/epl-v10.html. - * - * $Id$ - * - * Contributors: - * Brock Janiczak - link with selection option (SF #1774547) - ******************************************************************************/ -package com.mountainminds.eclemma.internal.ui.coverageview; - -import org.eclipse.ui.IMemento; - -import com.mountainminds.eclemma.core.analysis.ICounter; -import com.mountainminds.eclemma.core.analysis.IJavaElementCoverage; -import com.mountainminds.eclemma.internal.ui.UIMessages; - -/** - * All setting for the coverage view that will become persisted in the view's - * memento. - * - * @author Marc R. Hoffmann - * @version $Revision$ - */ -public class ViewSettings { - - public static final int ENTRYMODE_PROJECTS = 1; - public static final int ENTRYMODE_PACKAGEROOTS = 2; - public static final int ENTRYMODE_PACKAGES = 3; - public static final int ENTRYMODE_TYPES = 4; - - private static final String KEY_SORTCOLUMN = "sortcolumn"; //$NON-NLS-1$ - private static final String KEY_REVERSESORT = "reversesort"; //$NON-NLS-1$ - private static final String KEY_COUNTERMODE = "countermode"; //$NON-NLS-1$ - private static final String KEY_HIDEUNUSEDTYPES = "hideunusedtypes"; //$NON-NLS-1$ - private static final String KEY_ENTRYMODE = "entrymode"; //$NON-NLS-1$ - private static final String KEY_COLUMN0 = "column0"; //$NON-NLS-1$ - private static final String KEY_COLUMN1 = "column1"; //$NON-NLS-1$ - private static final String KEY_COLUMN2 = "column2"; //$NON-NLS-1$ - private static final String KEY_COLUMN3 = "column3"; //$NON-NLS-1$ - private static final String KEY_COLUMN4 = "column4"; //$NON-NLS-1$ - private static final String KEY_LINKED = "linked"; //$NON-NLS-1$ - - public interface ICounterMode { - public int getIdx(); - - public String[] getColumnHeaders(); - - public String getActionLabel(); - - public ICounter getCounter(IJavaElementCoverage coverage); - } - - public static final ICounterMode[] COUNTERMODES = new ICounterMode[] { - new ICounterMode() { - public int getIdx() { - return 0; - } - - public String getActionLabel() { - return UIMessages.CoverageViewCounterModeInstructionsAction_label; - } - - public ICounter getCounter(IJavaElementCoverage coverage) { - return coverage.getInstructionCounter(); - } - - public String[] getColumnHeaders() { - return new String[] { UIMessages.CoverageViewColumnElement_label, - UIMessages.CoverageViewColumnCoverage_label, - UIMessages.CoverageViewColumnCoveredInstructions_label, - UIMessages.CoverageViewColumnMissedInstructions_label, - UIMessages.CoverageViewColumnTotalInstructions_label }; - } - }, new ICounterMode() { - public int getIdx() { - return 1; - } - - public String getActionLabel() { - return UIMessages.CoverageViewCounterModeBlocksAction_label; - } - - public ICounter getCounter(IJavaElementCoverage coverage) { - return coverage.getBlockCounter(); - } - - public String[] getColumnHeaders() { - return new String[] { UIMessages.CoverageViewColumnElement_label, - UIMessages.CoverageViewColumnCoverage_label, - UIMessages.CoverageViewColumnCoveredBlocks_label, - UIMessages.CoverageViewColumnMissedBlocks_label, - UIMessages.CoverageViewColumnTotalBlocks_label }; - } - }, new ICounterMode() { - public int getIdx() { - return 2; - } - - public String getActionLabel() { - return UIMessages.CoverageViewCounterModeLinesAction_label; - } - - public ICounter getCounter(IJavaElementCoverage coverage) { - return coverage.getLineCounter(); - } - - public String[] getColumnHeaders() { - return new String[] { UIMessages.CoverageViewColumnElement_label, - UIMessages.CoverageViewColumnCoverage_label, - UIMessages.CoverageViewColumnCoveredLines_label, - UIMessages.CoverageViewColumnMissedLines_label, - UIMessages.CoverageViewColumnTotalLines_label }; - } - }, new ICounterMode() { - public int getIdx() { - return 3; - } - - public String getActionLabel() { - return UIMessages.CoverageViewCounterModeMethodsAction_label; - } - - public ICounter getCounter(IJavaElementCoverage coverage) { - return coverage.getMethodCounter(); - } - - public String[] getColumnHeaders() { - return new String[] { UIMessages.CoverageViewColumnElement_label, - UIMessages.CoverageViewColumnCoverage_label, - UIMessages.CoverageViewColumnCoveredMethods_label, - UIMessages.CoverageViewColumnMissedMethods_label, - UIMessages.CoverageViewColumnTotalMethods_label }; - } - }, new ICounterMode() { - public int getIdx() { - return 4; - } - - public String getActionLabel() { - return UIMessages.CoverageViewCounterModeTypesAction_label; - } - - public ICounter getCounter(IJavaElementCoverage coverage) { - return coverage.getTypeCounter(); - } - - public String[] getColumnHeaders() { - return new String[] { UIMessages.CoverageViewColumnElement_label, - UIMessages.CoverageViewColumnCoverage_label, - UIMessages.CoverageViewColumnCoveredTypes_label, - UIMessages.CoverageViewColumnMissedTypes_label, - UIMessages.CoverageViewColumnTotalTypes_label }; - } - } }; - - private static final int[] DEFAULT_COLUMNWIDTH = new int[] { 300, 80, 120, - 120, 120 }; - - private int sortcolumn; - private boolean reversesort; - private int countermode; - private int entrymode; - private boolean hideunusedtypes; - private int[] columnwidths = new int[5]; - private boolean linked; - - public int getSortColumn() { - return sortcolumn; - } - - public boolean isReverseSort() { - return reversesort; - } - - public void toggleSortColumn(int column) { - if (sortcolumn == column) { - reversesort = !reversesort; - } else { - reversesort = false; - sortcolumn = column; - } - } - - public ICounterMode getCounterMode() { - return COUNTERMODES[countermode]; - } - - public void setCounterMode(int idx) { - countermode = idx; - } - - public int getEntryMode() { - return entrymode; - } - - public void setEntryMode(int mode) { - entrymode = mode; - } - - public boolean getHideUnusedTypes() { - return hideunusedtypes; - } - - public void setHideUnusedTypes(boolean flag) { - hideunusedtypes = flag; - } - - public int[] getColumnWidths() { - return columnwidths; - } - - public boolean getLinked() { - return linked; - } - - public void setLinked(boolean linked) { - this.linked = linked; - } - - public void init(IMemento memento) { - sortcolumn = getInt(memento, KEY_SORTCOLUMN, CoverageView.COLUMN_MISSED); - reversesort = getBoolean(memento, KEY_REVERSESORT, true); - countermode = getInt(memento, KEY_COUNTERMODE, 0); - entrymode = getInt(memento, KEY_ENTRYMODE, ENTRYMODE_PROJECTS); - hideunusedtypes = getBoolean(memento, KEY_HIDEUNUSEDTYPES, false); - columnwidths[0] = getInt(memento, KEY_COLUMN0, DEFAULT_COLUMNWIDTH[0]); - columnwidths[1] = getInt(memento, KEY_COLUMN1, DEFAULT_COLUMNWIDTH[1]); - columnwidths[2] = getInt(memento, KEY_COLUMN2, DEFAULT_COLUMNWIDTH[2]); - columnwidths[3] = getInt(memento, KEY_COLUMN3, DEFAULT_COLUMNWIDTH[3]); - columnwidths[4] = getInt(memento, KEY_COLUMN4, DEFAULT_COLUMNWIDTH[4]); - linked = getBoolean(memento, KEY_LINKED, false); - } - - public void save(IMemento memento) { - memento.putInteger(KEY_SORTCOLUMN, sortcolumn); - memento.putInteger(KEY_REVERSESORT, reversesort ? 1 : 0); - memento.putInteger(KEY_COUNTERMODE, countermode); - memento.putInteger(KEY_ENTRYMODE, entrymode); - memento.putInteger(KEY_HIDEUNUSEDTYPES, hideunusedtypes ? 1 : 0); - memento.putInteger(KEY_COLUMN0, columnwidths[0]); - memento.putInteger(KEY_COLUMN1, columnwidths[1]); - memento.putInteger(KEY_COLUMN2, columnwidths[2]); - memento.putInteger(KEY_COLUMN3, columnwidths[3]); - memento.putInteger(KEY_COLUMN4, columnwidths[4]); - memento.putInteger(KEY_LINKED, linked ? 1 : 0); - } - - private int getInt(IMemento memento, String key, int preset) { - if (memento == null) { - return preset; - } else { - Integer i = memento.getInteger(key); - return i == null ? preset : i.intValue(); - } - } - - private boolean getBoolean(IMemento memento, String key, boolean preset) { - return getInt(memento, key, preset ? 1 : 0) == 1; - } - -} diff --git a/com.mountainminds.eclemma.ui/src/com/mountainminds/eclemma/internal/ui/decorators/CoverageDecorator.java b/com.mountainminds.eclemma.ui/src/com/mountainminds/eclemma/internal/ui/decorators/CoverageDecorator.java deleted file mode 100644 index 4b7cd3b..0000000 --- a/com.mountainminds.eclemma.ui/src/com/mountainminds/eclemma/internal/ui/decorators/CoverageDecorator.java +++ /dev/null @@ -1,108 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Mountainminds GmbH & Co. KG - * This software is provided under the terms of the Eclipse Public License v1.0 - * See http://www.eclipse.org/legal/epl-v10.html. - * - * $Id$ - * - * Contributors: - * Benjamin Muskalla - coverage decorators (SF #1659429) - ******************************************************************************/ -package com.mountainminds.eclemma.internal.ui.decorators; - -import java.text.DecimalFormat; -import java.text.Format; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.jface.viewers.IDecoration; -import org.eclipse.jface.viewers.ILabelProviderListener; -import org.eclipse.jface.viewers.ILightweightLabelDecorator; -import org.eclipse.jface.viewers.LabelProviderChangedEvent; -import org.eclipse.ui.IWorkbench; - -import com.mountainminds.eclemma.core.CoverageTools; -import com.mountainminds.eclemma.core.analysis.ICounter; -import com.mountainminds.eclemma.core.analysis.IJavaCoverageListener; -import com.mountainminds.eclemma.core.analysis.IJavaElementCoverage; -import com.mountainminds.eclemma.internal.ui.EclEmmaUIPlugin; -import com.mountainminds.eclemma.internal.ui.UIMessages; - -/** - * Decorator to show code coverage for Java elements. - * - * @author Benjamin Muskalla, Marc R. Hoffmann - * @version $Revision$ - */ -public class CoverageDecorator implements ILightweightLabelDecorator { - - private static final Format SUFFIX_FORMAT = - new DecimalFormat(UIMessages.CoverageDecoratorSuffix_label); - - private List listeners = new ArrayList(); - private IJavaCoverageListener coverageListener = null; - - public CoverageDecorator() { - super(); - } - - public void decorate(Object element, IDecoration decoration) { - IJavaElementCoverage coverage = CoverageTools.getCoverageInfo(element); - if (coverage == null) { - // no coverage data - return; - } - // TODO obtain counter from preferences - ICounter counter = coverage.getInstructionCounter(); - ImageDescriptor overlay = EclEmmaUIPlugin.getCoverageOverlay(counter.getRatio()); - decoration.addOverlay(overlay, IDecoration.TOP_LEFT); - decoration.addSuffix(SUFFIX_FORMAT.format(new Double(counter.getRatio()))); - } - - protected void fireEvent() { - final IWorkbench workbench = EclEmmaUIPlugin.getInstance().getWorkbench(); - if(workbench == null) return; - final LabelProviderChangedEvent event = new LabelProviderChangedEvent(this); - workbench.getDisplay().asyncExec(new Runnable() { - public void run() { - Iterator i = listeners.iterator(); - while (i.hasNext()) { - ((ILabelProviderListener) i.next()).labelProviderChanged(event); - } - } - }); - } - - public void addListener(ILabelProviderListener listener) { - if (!listeners.contains(listener)) { - listeners.add(listener); - } - if (coverageListener == null) { - coverageListener = new IJavaCoverageListener() { - public void coverageChanged() { - fireEvent(); - } - }; - CoverageTools.addJavaCoverageListener(coverageListener); - } - } - - public void removeListener(ILabelProviderListener listener) { - listeners.remove(listener); - } - - public boolean isLabelProperty(Object element, String property) { - // coverage does not depend on IJavaElement properties - return false; - } - - public void dispose() { - if (coverageListener != null) { - CoverageTools.removeJavaCoverageListener(coverageListener); - coverageListener = null; - } - } - -} diff --git a/com.mountainminds.eclemma.ui/src/com/mountainminds/eclemma/internal/ui/dialogs/CoveragePreferencePage.java b/com.mountainminds.eclemma.ui/src/com/mountainminds/eclemma/internal/ui/dialogs/CoveragePreferencePage.java deleted file mode 100644 index 03b52e2..0000000 --- a/com.mountainminds.eclemma.ui/src/com/mountainminds/eclemma/internal/ui/dialogs/CoveragePreferencePage.java +++ /dev/null @@ -1,108 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2009 Mountainminds GmbH & Co. KG - * This software is provided under the terms of the Eclipse Public License v1.0 - * See http://www.eclipse.org/legal/epl-v10.html. - * - * $Id$ - ******************************************************************************/ -package com.mountainminds.eclemma.internal.ui.dialogs; - -import org.eclipse.jface.dialogs.MessageDialogWithToggle; -import org.eclipse.jface.preference.BooleanFieldEditor; -import org.eclipse.jface.preference.FieldEditorPreferencePage; -import org.eclipse.jface.preference.StringFieldEditor; -import org.eclipse.swt.SWT; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Label; -import org.eclipse.ui.IWorkbench; -import org.eclipse.ui.IWorkbenchPreferencePage; -import org.eclipse.ui.dialogs.PreferenceLinkArea; -import org.eclipse.ui.preferences.IWorkbenchPreferenceContainer; - -import com.mountainminds.eclemma.internal.ui.ContextHelp; -import com.mountainminds.eclemma.internal.ui.EclEmmaUIPlugin; -import com.mountainminds.eclemma.internal.ui.UIMessages; -import com.mountainminds.eclemma.internal.ui.UIPreferences; - -/** - * Implementation of the "Code Coverage" preferences page. - * - * @author Marc R. Hoffmann - * @version $Revision$ - */ -public class CoveragePreferencePage extends FieldEditorPreferencePage implements - IWorkbenchPreferencePage { - - private static final String DECORATORS_PAGE = "org.eclipse.ui.preferencePages.Decorators"; //$NON-NLS-1$ - private static final String ANNOTATIONS_PAGE = "org.eclipse.ui.editors.preferencePages.Annotations"; //$NON-NLS-1$ - - public CoveragePreferencePage() { - super(GRID); - setDescription(UIMessages.CoveragePreferences_description); - setPreferenceStore(EclEmmaUIPlugin.getInstance().getPreferenceStore()); - } - - protected void createFieldEditors() { - ContextHelp.setHelp(getControl(), ContextHelp.COVERAGE_PREFERENCES); - - final Composite parent = getFieldEditorParent(); - addField(new BooleanFieldEditor(UIPreferences.PREF_SHOW_COVERAGE_VIEW, - UIMessages.CoveragePreferencesShowCoverageView_label, parent)); - addField(new BooleanFieldEditor(UIPreferences.PREF_ACTICATE_NEW_SESSIONS, - UIMessages.CoveragePreferencesActivateNewSessions_label, parent)); - addField(new BooleanFieldEditor(UIPreferences.PREF_AUTO_REMOVE_SESSIONS, - UIMessages.CoveragePreferencesAutoRemoveSessions_label, parent)); - addField(new ToggleValueFieldEditor( - UIPreferences.PREF_ALLOW_INPLACE_INSTRUMENTATION, - UIMessages.CoveragePreferencesShowInplaceWarning_label, parent, - MessageDialogWithToggle.PROMPT, MessageDialogWithToggle.ALWAYS)); - - // Default instrumentation: - createSpacer(parent); - createLabel(parent, - UIMessages.CoveragePreferencesDefaultInstrumentation_title); - addField(new BooleanFieldEditor( - UIPreferences.PREF_DEFAULT_INSTRUMENTATION_SOURCE_FOLDERS_ONLY, - UIMessages.CoveragePreferencesSourceFoldersOnly_label, parent)); - addField(new BooleanFieldEditor( - UIPreferences.PREF_DEFAULT_INSTRUMENTATION_SAME_PROJECT_ONLY, - UIMessages.CoveragePreferencesSameProjectOnly_label, parent)); - addField(new StringFieldEditor( - UIPreferences.PREF_DEFAULT_INSTRUMENTATION_FILTER, - UIMessages.CoveragePreferencesClasspathFilter_label, parent)); - - // Links: - createSpacer(parent); - createLink(parent, UIMessages.CoveragePreferencesDecoratorsLink_label, - DECORATORS_PAGE); - createLink(parent, UIMessages.CoveragePreferencesAnnotationsLink_label, - ANNOTATIONS_PAGE); - } - - private void createSpacer(final Composite parent) { - createLabel(parent, ""); //$NON-NLS-1$ - } - - private void createLabel(final Composite parent, final String text) { - final Label label = new Label(parent, SWT.NONE); - label.setText(text); - final GridData gd = new GridData(); - gd.horizontalSpan = 2; - label.setLayoutData(gd); - } - - private void createLink(final Composite parent, final String text, - String target) { - final PreferenceLinkArea link = new PreferenceLinkArea(parent, SWT.NONE, - target, text, (IWorkbenchPreferenceContainer) getContainer(), null); - final GridData gd = new GridData(); - gd.horizontalSpan = 2; - link.getControl().setLayoutData(gd); - } - - public void init(IWorkbench workbench) { - // nothing to do here - } - -} diff --git a/com.mountainminds.eclemma.ui/src/com/mountainminds/eclemma/internal/ui/dialogs/CoveragePropertyPage.java b/com.mountainminds.eclemma.ui/src/com/mountainminds/eclemma/internal/ui/dialogs/CoveragePropertyPage.java deleted file mode 100644 index 60962c0..0000000 --- a/com.mountainminds.eclemma.ui/src/com/mountainminds/eclemma/internal/ui/dialogs/CoveragePropertyPage.java +++ /dev/null @@ -1,182 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2007 Mountainminds GmbH & Co. KG - * This software is provided under the terms of the Eclipse Public License v1.0 - * See http://www.eclipse.org/legal/epl-v10.html. - * - * $Id$ - ******************************************************************************/ -package com.mountainminds.eclemma.internal.ui.dialogs; - -import java.text.DecimalFormat; - -import org.eclipse.jface.viewers.ArrayContentProvider; -import org.eclipse.jface.viewers.ITableLabelProvider; -import org.eclipse.jface.viewers.LabelProvider; -import org.eclipse.jface.viewers.TableViewer; -import org.eclipse.jface.viewers.Viewer; -import org.eclipse.jface.viewers.ViewerFilter; -import org.eclipse.swt.SWT; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Table; -import org.eclipse.swt.widgets.TableColumn; -import org.eclipse.swt.widgets.Text; -import org.eclipse.ui.dialogs.PropertyPage; - -import com.mountainminds.eclemma.core.CoverageTools; -import com.mountainminds.eclemma.core.ICoverageSession; -import com.mountainminds.eclemma.core.analysis.ICounter; -import com.mountainminds.eclemma.core.analysis.IJavaElementCoverage; -import com.mountainminds.eclemma.internal.ui.ContextHelp; -import com.mountainminds.eclemma.internal.ui.EclEmmaUIPlugin; -import com.mountainminds.eclemma.internal.ui.UIMessages; - -/** - * Property page for coverage details of a Java element. - * - * @author Marc R. Hoffmann - * @version $Revision$ - */ -public class CoveragePropertyPage extends PropertyPage { - - private static final int COLUMN_COUNTER = 0; - private static final int COLUMN_COVERAGE = 1; - private static final int COLUMN_COVERED = 2; - private static final int COLUMN_MISSED = 3; - private static final int COLUMN_TOTAL = 4; - - private static final DecimalFormat COVERAGE_VALUE = new DecimalFormat( - UIMessages.CoveragePropertyPageColumnCoverage_value); - - protected Control createContents(Composite parent) { - ContextHelp.setHelp(parent, ContextHelp.COVERAGE_PROPERTIES); - noDefaultAndApplyButton(); - parent = new Composite(parent, SWT.NONE); - GridLayout layout = new GridLayout(); - layout.numColumns = 2; - layout.marginWidth = 0; - layout.marginHeight = 0; - parent.setLayout(layout); - - Label l1 = new Label(parent, SWT.NONE); - l1.setText(UIMessages.CoveragePropertyPageSession_label); - l1.setLayoutData(new GridData(SWT.LEFT, SWT.TOP, false, false)); - - Text t1 = new Text(parent, SWT.READ_ONLY | SWT.WRAP); - t1.setText(getSessionDescription()); - t1.setLayoutData(new GridData(SWT.LEFT, SWT.TOP, true, false)); - - Control table = createTable(parent); - GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true); - gd.horizontalSpan = 2; - table.setLayoutData(gd); - - return parent; - } - - private String getSessionDescription() { - ICoverageSession session = CoverageTools.getSessionManager() - .getActiveSession(); - return session == null ? UIMessages.CoveragePropertyPageNoSession_value - : session.getDescription(); - } - - private Control createTable(Composite parent) { - Table table = new Table(parent, SWT.BORDER); - initializeDialogUnits(table); - table.setHeaderVisible(true); - table.setLinesVisible(true); - createColumn(table, SWT.LEFT, 24, - UIMessages.CoveragePropertyPageColumnCounter_label); - createColumn(table, SWT.RIGHT, 16, - UIMessages.CoveragePropertyPageColumnCoverage_label); - createColumn(table, SWT.RIGHT, 16, - UIMessages.CoveragePropertyPageColumnCovered_label); - createColumn(table, SWT.RIGHT, 16, - UIMessages.CoveragePropertyPageColumnMissed_label); - createColumn(table, SWT.RIGHT, 16, - UIMessages.CoveragePropertyPageColumnTotal_label); - TableViewer viewer = new TableViewer(table); - viewer.setContentProvider(new ArrayContentProvider()); - viewer.addFilter(new ViewerFilter() { - public boolean select(Viewer viewer, Object parentElement, Object element) { - return ((Line) element).counter.getTotalCount() != 0; - } - }); - viewer.setInput(getLines()); - viewer.setLabelProvider(new CounterLabelProvider()); - return table; - } - - private void createColumn(Table table, int align, int width, String caption) { - TableColumn column = new TableColumn(table, align); - column.setText(caption); - column.setWidth(convertWidthInCharsToPixels(width)); - } - - private Line[] getLines() { - IJavaElementCoverage c = CoverageTools.getCoverageInfo(getElement()); - if (c == null) { - return new Line[0]; - } else { - return new Line[] { - new Line(UIMessages.CoveragePropertyPageInstructions_label, c - .getInstructionCounter()), - new Line(UIMessages.CoveragePropertyPageBlocks_label, c - .getBlockCounter()), - new Line(UIMessages.CoveragePropertyPageLines_label, c - .getLineCounter()), - new Line(UIMessages.CoveragePropertyPageMethods_label, c - .getMethodCounter()), - new Line(UIMessages.CoveragePropertyPageTypes_label, c - .getTypeCounter()) }; - } - } - - private static class Line { - public final String label; - public final ICounter counter; - - public Line(String label, ICounter counter) { - this.label = label; - this.counter = counter; - } - } - - private static class CounterLabelProvider extends LabelProvider implements - ITableLabelProvider { - - public Image getColumnImage(Object element, int columnIndex) { - if (columnIndex == COLUMN_COUNTER) { - Line l = (Line) element; - return EclEmmaUIPlugin.getCoverageImage(l.counter.getRatio()); - } else { - return null; - } - } - - public String getColumnText(Object element, int columnIndex) { - Line l = (Line) element; - switch (columnIndex) { - case COLUMN_COUNTER: - return l.label; - case COLUMN_COVERAGE: - return COVERAGE_VALUE.format(l.counter.getRatio()); - case COLUMN_COVERED: - return String.valueOf(l.counter.getCoveredCount()); - case COLUMN_MISSED: - return String.valueOf(l.counter.getMissedCount()); - case COLUMN_TOTAL: - return String.valueOf(l.counter.getTotalCount()); - default: - return ""; //$NON-NLS-1$ - } - } - - } - -} diff --git a/com.mountainminds.eclemma.ui/src/com/mountainminds/eclemma/internal/ui/dialogs/MergeSessionsDialog.java b/com.mountainminds.eclemma.ui/src/com/mountainminds/eclemma/internal/ui/dialogs/MergeSessionsDialog.java deleted file mode 100644 index 9f90c93..0000000 --- a/com.mountainminds.eclemma.ui/src/com/mountainminds/eclemma/internal/ui/dialogs/MergeSessionsDialog.java +++ /dev/null @@ -1,132 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Mountainminds GmbH & Co. KG - * This software is provided under the terms of the Eclipse Public License v1.0 - * See http://www.eclipse.org/legal/epl-v10.html. - * - * $Id$ - ******************************************************************************/ -package com.mountainminds.eclemma.internal.ui.dialogs; - -import org.eclipse.jface.dialogs.IDialogConstants; -import org.eclipse.jface.viewers.ArrayContentProvider; -import org.eclipse.jface.viewers.CheckStateChangedEvent; -import org.eclipse.jface.viewers.ICheckStateListener; -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.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.swt.widgets.Text; -import org.eclipse.ui.dialogs.ListSelectionDialog; -import org.eclipse.ui.model.WorkbenchLabelProvider; - -import com.mountainminds.eclemma.core.ICoverageSession; -import com.mountainminds.eclemma.internal.ui.ContextHelp; -import com.mountainminds.eclemma.internal.ui.UIMessages; - -/** - * Dialog to select session to merge and enter a description for the result. - * - * @author Marc R. Hoffmann - * @version $Revision$ - */ -public class MergeSessionsDialog extends ListSelectionDialog { - - private String description; - - private Text textdescr; - - /** - * Creates a new dialog with the given session list and description preset. - * - * @param parent - * parent shell - * @param sessions - * List of session the user can select from - * @param description - * Preset value for the description - */ - public MergeSessionsDialog(Shell parent, ICoverageSession[] sessions, - String description) { - super(parent, sessions, new ArrayContentProvider(), - new WorkbenchLabelProvider(), - UIMessages.MergeSessionsDialogSelection_label); - setTitle(UIMessages.MergeSessionsDialog_title); - setInitialSelections(sessions); - this.description = description; - } - - /** - * Returns the session description entered by the user. - * - * @return session description - */ - public String getDescription() { - return description; - } - - protected void configureShell(Shell shell) { - super.configureShell(shell); - ContextHelp.setHelp(shell, ContextHelp.MERGE_SESSIONS); - } - - protected Label createMessageArea(Composite composite) { - Label l = new Label(composite, SWT.NONE); - l.setFont(composite.getFont()); - l.setText(UIMessages.MergeSessionsDialogDescription_label); - - textdescr = new Text(composite, SWT.BORDER); - textdescr.setFont(composite.getFont()); - textdescr.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - textdescr.setText(description); - textdescr.addModifyListener(new ModifyListener() { - public void modifyText(ModifyEvent e) { - updateButtonsEnableState(); - } - }); - - return super.createMessageArea(composite); - } - - protected Control createDialogArea(Composite parent) { - Control c = super.createDialogArea(parent); - getViewer().addCheckStateListener(new ICheckStateListener() { - public void checkStateChanged(CheckStateChangedEvent event) { - updateButtonsEnableState(); - } - }); - Button b1 = getButton(IDialogConstants.SELECT_ALL_ID); - b1.addSelectionListener(new SelectionAdapter() { - public void widgetSelected(SelectionEvent e) { - updateButtonsEnableState(); - } - }); - Button b2 = getButton(IDialogConstants.DESELECT_ALL_ID); - b2.addSelectionListener(new SelectionAdapter() { - public void widgetSelected(SelectionEvent e) { - updateButtonsEnableState(); - } - }); - return c; - } - - protected void okPressed() { - description = textdescr.getText().trim(); - super.okPressed(); - } - - protected void updateButtonsEnableState() { - Button okButton = getOkButton(); - if (okButton != null && !okButton.isDisposed()) { - okButton.setEnabled(getViewer().getCheckedElements().length > 1 - && textdescr.getText().trim().length() > 0); - } - } - -} diff --git a/com.mountainminds.eclemma.ui/src/com/mountainminds/eclemma/internal/ui/dialogs/ToggleValueFieldEditor.java b/com.mountainminds.eclemma.ui/src/com/mountainminds/eclemma/internal/ui/dialogs/ToggleValueFieldEditor.java deleted file mode 100644 index 725f0a5..0000000 --- a/com.mountainminds.eclemma.ui/src/com/mountainminds/eclemma/internal/ui/dialogs/ToggleValueFieldEditor.java +++ /dev/null @@ -1,59 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2007 Mountainminds GmbH & Co. KG - * This software is provided under the terms of the Eclipse Public License v1.0 - * See http://www.eclipse.org/legal/epl-v10.html. - * - * $Id$ - ******************************************************************************/ -package com.mountainminds.eclemma.internal.ui.dialogs; - -import org.eclipse.jface.preference.BooleanFieldEditor; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; - -/** - * Modified BooleanFieldEditor to toggle between two given string values. - * - * @author Marc R. Hoffmann - * @version $Revision$ - */ -class ToggleValueFieldEditor extends BooleanFieldEditor { - - private final String onvalue; - private final String offvalue; - private Button checkbox; - - public ToggleValueFieldEditor(String name, String label, Composite parent, - String onvalue, String offvalue) { - super(name, label, parent); - this.onvalue = onvalue; - this.offvalue = offvalue; - } - - public Button getChangeControl(Composite parent) { - // we need to grap the control here, as the superclass declares it private - return checkbox = super.getChangeControl(parent); - } - - protected void doLoad() { - if (checkbox != null) { - String value = getPreferenceStore().getString(getPreferenceName()); - checkbox.setSelection(onvalue.equals(value)); - } - } - - protected void doLoadDefault() { - String value = getPreferenceStore().getDefaultString(getPreferenceName()); - checkbox.setSelection(onvalue.equals(value)); - } - - protected void doStore() { - if (checkbox != null) { - String value = checkbox.getSelection() ? onvalue : offvalue; - getPreferenceStore().setValue(getPreferenceName(), value); - } - } - -} - - diff --git a/com.mountainminds.eclemma.ui/src/com/mountainminds/eclemma/internal/ui/launching/AlreadyInstrumentedHandler.java b/com.mountainminds.eclemma.ui/src/com/mountainminds/eclemma/internal/ui/launching/AlreadyInstrumentedHandler.java deleted file mode 100644 index 2aadcd0..0000000 --- a/com.mountainminds.eclemma.ui/src/com/mountainminds/eclemma/internal/ui/launching/AlreadyInstrumentedHandler.java +++ /dev/null @@ -1,39 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Mountainminds GmbH & Co. KG - * This software is provided under the terms of the Eclipse Public License v1.0 - * See http://www.eclipse.org/legal/epl-v10.html. - * - * $Id$ - ******************************************************************************/ -package com.mountainminds.eclemma.internal.ui.launching; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.debug.core.IStatusHandler; -import org.eclipse.jface.dialogs.MessageDialog; -import org.eclipse.swt.widgets.Shell; - -import com.mountainminds.eclemma.internal.ui.EclEmmaUIPlugin; -import com.mountainminds.eclemma.internal.ui.UIMessages; - -/** - * Status handler that issues an error message when trying to instrument classes - * that are already instrumented. - * - * @author Marc R. Hoffmann - * @version $Revision$ - */ -public class AlreadyInstrumentedHandler implements IStatusHandler { - - public Object handleStatus(IStatus status, Object source) - throws CoreException { - - Shell parent = EclEmmaUIPlugin.getInstance().getShell(); - String title = UIMessages.AlreadyInstrumentedError_title; - String message = UIMessages.AlreadyInstrumentedError_message; - - MessageDialog.openError(parent, title, message); - return Boolean.FALSE; - } - -} diff --git a/com.mountainminds.eclemma.ui/src/com/mountainminds/eclemma/internal/ui/launching/InplaceInstrumentationHandler.java b/com.mountainminds.eclemma.ui/src/com/mountainminds/eclemma/internal/ui/launching/InplaceInstrumentationHandler.java deleted file mode 100644 index 6a5b786..0000000 --- a/com.mountainminds.eclemma.ui/src/com/mountainminds/eclemma/internal/ui/launching/InplaceInstrumentationHandler.java +++ /dev/null @@ -1,60 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Mountainminds GmbH & Co. KG - * This software is provided under the terms of the Eclipse Public License v1.0 - * See http://www.eclipse.org/legal/epl-v10.html. - * - * $Id$ - ******************************************************************************/ -package com.mountainminds.eclemma.internal.ui.launching; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.debug.core.ILaunchConfiguration; -import org.eclipse.debug.core.IStatusHandler; -import org.eclipse.jface.dialogs.IDialogConstants; -import org.eclipse.jface.dialogs.MessageDialog; -import org.eclipse.jface.dialogs.MessageDialogWithToggle; -import org.eclipse.jface.preference.IPreferenceStore; -import org.eclipse.osgi.util.NLS; -import org.eclipse.swt.widgets.Shell; - -import com.mountainminds.eclemma.internal.ui.EclEmmaUIPlugin; -import com.mountainminds.eclemma.internal.ui.UIMessages; -import com.mountainminds.eclemma.internal.ui.UIPreferences; - -/** - * Status handler that issues a warning for in place instrumentation. - * - * @author Marc R. Hoffmann - * @version $Revision$ - */ -public class InplaceInstrumentationHandler implements IStatusHandler { - - public Object handleStatus(IStatus status, Object source) - throws CoreException { - - ILaunchConfiguration config = (ILaunchConfiguration) source; - Shell parent = EclEmmaUIPlugin.getInstance().getShell(); - String title = UIMessages.InstrumentationWarning_title; - String message = NLS.bind(UIMessages.InstrumentationWarning_message, config - .getName()); - - IPreferenceStore store = EclEmmaUIPlugin.getInstance().getPreferenceStore(); - - if (MessageDialogWithToggle.ALWAYS.equals(store - .getString(UIPreferences.PREF_ALLOW_INPLACE_INSTRUMENTATION))) { - return Boolean.TRUE; - } - - MessageDialogWithToggle dialog = new MessageDialogWithToggle(parent, title, - null, message, MessageDialog.WARNING, new String[] { - IDialogConstants.OK_LABEL, IDialogConstants.CANCEL_LABEL }, 0, - null, false); - dialog.setPrefKey(UIPreferences.PREF_ALLOW_INPLACE_INSTRUMENTATION); - dialog.setPrefStore(store); - dialog.open(); - - return Boolean.valueOf(dialog.getReturnCode() == IDialogConstants.OK_ID); - } - -} diff --git a/com.mountainminds.eclemma.ui/src/com/mountainminds/eclemma/internal/ui/launching/NoCoverageDataHandler.java b/com.mountainminds.eclemma.ui/src/com/mountainminds/eclemma/internal/ui/launching/NoCoverageDataHandler.java deleted file mode 100644 index bc0b941..0000000 --- a/com.mountainminds.eclemma.ui/src/com/mountainminds/eclemma/internal/ui/launching/NoCoverageDataHandler.java +++ /dev/null @@ -1,39 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Mountainminds GmbH & Co. KG - * This software is provided under the terms of the Eclipse Public License v1.0 - * See http://www.eclipse.org/legal/epl-v10.html. - * - * $Id$ - ******************************************************************************/ -package com.mountainminds.eclemma.internal.ui.launching; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.debug.core.IStatusHandler; -import org.eclipse.jface.dialogs.MessageDialog; -import org.eclipse.swt.widgets.Shell; - -import com.mountainminds.eclemma.internal.ui.EclEmmaUIPlugin; -import com.mountainminds.eclemma.internal.ui.UIMessages; - -/** - * Status handler that issues an error message when no coverage data has been - * found. - * - * @author Marc R. Hoffmann - * @version $Revision$ - */ -public class NoCoverageDataHandler implements IStatusHandler { - - public Object handleStatus(IStatus status, Object source) - throws CoreException { - - Shell parent = EclEmmaUIPlugin.getInstance().getShell(); - String title = UIMessages.NoCoverageDataError_title; - String message = UIMessages.NoCoverageDataError_message; - - MessageDialog.openError(parent, title, message); - return Boolean.FALSE; - } - -} diff --git a/com.mountainminds.eclemma.ui/src/com/mountainminds/eclemma/internal/ui/launching/NoInstrumentedClassesHandler.java b/com.mountainminds.eclemma.ui/src/com/mountainminds/eclemma/internal/ui/launching/NoInstrumentedClassesHandler.java deleted file mode 100644 index 273cca8..0000000 --- a/com.mountainminds.eclemma.ui/src/com/mountainminds/eclemma/internal/ui/launching/NoInstrumentedClassesHandler.java +++ /dev/null @@ -1,52 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Mountainminds GmbH & Co. KG - * This software is provided under the terms of the Eclipse Public License v1.0 - * See http://www.eclipse.org/legal/epl-v10.html. - * - * $Id: $ - ******************************************************************************/ -package com.mountainminds.eclemma.internal.ui.launching; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.debug.core.IStatusHandler; -import org.eclipse.debug.ui.DebugUITools; -import org.eclipse.jface.dialogs.IDialogConstants; -import org.eclipse.jface.dialogs.MessageDialog; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.swt.widgets.Shell; - -import com.mountainminds.eclemma.internal.ui.EclEmmaUIPlugin; -import com.mountainminds.eclemma.internal.ui.UIMessages; - -/** - * Status handler that issues an error message when to launch a configuration - * that does not specify any classes for instrumentation. The used may decide - * to open the launch dialog directly. - * - * @author Marc R. Hoffmann - * @version $Revision: $ - */ -public class NoInstrumentedClassesHandler implements IStatusHandler { - - public Object handleStatus(IStatus status, final Object source) - throws CoreException { - - final Shell parent = EclEmmaUIPlugin.getInstance().getShell(); - String title = UIMessages.NoInstrumentedClassesError_title; - String message = UIMessages.NoInstrumentedClassesError_message; - - MessageDialog d = new MessageDialog(parent, title, null, message, MessageDialog.ERROR, - new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL }, 0); - if (d.open() == 0) { - parent.getDisplay().asyncExec(new Runnable() { - public void run() { - DebugUITools.openLaunchConfigurationDialogOnGroup(parent, - new StructuredSelection(source), EclEmmaUIPlugin.ID_COVERAGE_LAUNCH_GROUP); - } - }); - } - return Boolean.FALSE; - } - -} diff --git a/com.mountainminds.eclemma.ui/src/com/mountainminds/eclemma/internal/ui/uimessages.properties b/com.mountainminds.eclemma.ui/src/com/mountainminds/eclemma/internal/ui/uimessages.properties deleted file mode 100644 index c147f88..0000000 --- a/com.mountainminds.eclemma.ui/src/com/mountainminds/eclemma/internal/ui/uimessages.properties +++ /dev/null @@ -1,170 +0,0 @@ -#******************************************************************************* -# Copyright (c) 2006, 2007 Mountainminds GmbH & Co. KG -# This software is provided under the terms of the Eclipse Public License v1.0 -# See http://www.eclipse.org/legal/epl-v10.html. -# -# $Id$ -#******************************************************************************* - -# English messages for the UI plug-in - -RemoveActiveSessionAction_label=Remove Active Session -RemoveActiveSessionAction_tooltip=Remove Active Session -RemoveAllSessionsAction_label=Remove All Sessions -RemoveAllSessionsAction_tooltip=Remove All Sessions -RefreshSessionAction_label=Refresh -RefreshSessionAction_tooltip=Refresh Active Session -MergeSessionsAction_label=Merge Sessions -MergeSessionsAction_tooltip=Merge Sessions -ImportSessionAction_label=Import Session... -ImportSessionAction_tooltip=Import Coverage Session -ExportSessionAction_label=Export Report... -ExportSessionAction_tooltip=Export Coverage Report -CopyAction_label=Copy -BrowseAction_label=Browse... -SelectAllAction_label=Select All -DeselectAllAction_label=Deselect All -CoverageLastAction_label=Coverage Last Launched - -CoverageViewRelaunchAction_label=Relaunch Coverage Session -CoverageViewRelaunchAction_tooltip=Relaunch Coverage Session -CoverageViewSelectSessionAction_label=Select Session -CoverageViewSelectSessionAction_looltip=Select Session -CoverageViewSelectSessionActionEntry_label={0} {1} -CoverageViewShowProjectsAction_label=Show Projects -CoverageViewShowProjectsAction_tooltip=Show Projects -CoverageViewShowPackageRootsAction_label=Show Package Roots -CoverageViewShowPackageRootsAction_tooltip=Show Package Roots -CoverageViewShowPackagesAction_label=Show Packages -CoverageViewShowPackagesAction_tooltip=Show Packages -CoverageViewShowTypesAction_label=Show Types -CoverageViewShowTypesAction_tooltip=Show Types -CoverageViewCounterModeInstructionsAction_label=Instruction Counters -CoverageViewCounterModeBlocksAction_label=Block Counters -CoverageViewCounterModeLinesAction_label=Line Counters -CoverageViewCounterModeMethodsAction_label=Method Counters -CoverageViewCounterModeTypesAction_label=Type Counters -CoverageViewHideUnusedTypesAction_label=Hide Unused Types -CoverageViewCollapseAllAction_label=Collapse All -CoverageViewCollapseAllAction_tooltip=Collapse All -CoverageViewLinkWithSelectionAction_label=Link with Current Selection -CoverageViewLinkWithSelectionAction_tooltip=Link with Current Selection -CoverageViewColumnElement_label=Element -CoverageViewColumnCoverage_label=Coverage -CoverageViewColumnCoveredInstructions_label=Covered Instructions -CoverageViewColumnCoveredBlocks_label=Covered Blocks -CoverageViewColumnCoveredLines_label=Covered Lines -CoverageViewColumnCoveredMethods_label=Covered Methods -CoverageViewColumnCoveredTypes_label=Covered Types -CoverageViewColumnMissedInstructions_label=Missed Instructions -CoverageViewColumnMissedBlocks_label=Missed Blocks -CoverageViewColumnMissedLines_label=Missed Lines -CoverageViewColumnMissedMethods_label=Missed Methods -CoverageViewColumnMissedTypes_label=Missed Types -CoverageViewColumnTotalInstructions_label=Total Instructions -CoverageViewColumnTotalBlocks_label=Total Blocks -CoverageViewColumnTotalLines_label=Total Lines -CoverageViewColumnTotalMethods_label=Total Methods -CoverageViewColumnTotalTypes_label=Total Types -CoverageView_columnCoverageValue=0.0 % -CoverageView_loadingMessage=Loading... - -MergeSessionsDialog_title=Merge Sessions -MergeSessionsDialogDescription_label=Description: -MergeSessionsDialogDescriptionDefault_value=Merged ({0,date,medium} {0,time,medium}) -MergeSessionsDialogSelection_label=Select at least two sessions to merge: - -CoverageTab_title=Coverage -CoverageTabInstrumentedClassesGroup_label=Instrumented classes: -CoverageTabInplaceInstrumentation_label=In-place instrumentation -CoverageTabNoClassesSelected_message=No classes selected for instrumentation. - -InstrumentationWarning_title=In-Place Instrumentation -InstrumentationWarning_message={0} will be instrumented in-place for coverage \ - analysis. The next normal launch requires a clean build to remove the \ - instrumented class files again. -AlreadyInstrumentedError_title=Already Instrumented -AlreadyInstrumentedError_message=Some class files of this launch are \ - already instrumented in-place. Please perform a clean build to remove \ - all in-place instrumented class files. -NoCoverageDataError_title=No Coverage Data -NoCoverageDataError_message=No coverage data file has been written during this \ - coverage session.\n\n\ - Please make sure that your project does NOT include EMMA runtime libraries \ - or EMMA configuration settings. Do not terminate the Java process manually \ - from Eclipse. -NoInstrumentedClassesError_title=No Instrumented Classes -NoInstrumentedClassesError_message=No classes are selected for instrumentation. \ - Do you want to open the coverage launch dialog to specify classes for \ - coverage analysis? - -ExportReport_title=Export -ExportReportErrorDialog_title=Export Error -ExportReportErrorDialog_message=Error while exporting {0}. -ExportReportPage1_title=Coverage Report -ExportReportPage1_description=Export a coverage report from a Java coverage session. -ExportReportPage1NoSession_message=No coverage session available for export. -ExportReportPage1MissingDestination_message=Select destination file for report output. -ExportReportPage1InvalidDestination_message=The destination must point to a file in an existing folder. -ExportReportPage1WrongExtension_message=The recommended file extension for the selected report format is ''.{0}''. -ExportReportPage1Sessions_label=Available sessions: -ExportReportPage1DestinationGroup_label=Export format and destination -ExportReportPage1Format_label=Format: -ExportReportPage1Destination_label=Destination: -ExportReportPage1BrowseDialog_title=Select Destination -ExportReportPage1HTMLFormat_value=HTML files -ExportReportPage1XMLFormat_value=XML file -ExportReportPage1TextFormat_value=Text file -ExportReportPage1EMMAFormat_value=EMMA session file -ExportReportOpenReport_label=Open exported report - -ImportSession_title=Import -ImportSessionPage1_title=Coverage Session -ImportReportErrorDialog_title=Import Error -ImportReportErrorDialog_message=Error while importing coverage session. -ImportSessionPage1_description=Import a Java coverage session from an external program run. -ImportReportPage1NoDescription_message=Please enter a description for the imported session. -ImportReportPage1NoCoverageFile_message=Please select an existing coverage file. -ImportReportPage1NoClassFiles_message=Please select class files that should be considered for coverage. -ImportSessionPage1Description_label=Description: -ImportSessionPage1Description_value=Imported ({0,date,medium} {0,time,medium}) -ImportSessionPage1CoverageFile_label=Coverage file: -ImportSessionPage1BrowseDialog_title=Select Coverage File -ImportSessionPage1Binaries_label=Include binary libraries -ImportSessionPage1ModeGroup_label=Import mode -ImportSessionPage1Reference_label=Reference to original file -ImportSessionPage1Copy_label=Create copy -ImportSessionPage1MetadataGroup_label=Meta data source -ImportSessionPage1IDEClasses_label=IDE classes -ImportSessionPage1ImportMetaData_label=Import data - -CoveragePropertyPageSession_label=Session: -CoveragePropertyPageNoSession_value= -CoveragePropertyPageColumnCounter_label=Counter -CoveragePropertyPageColumnCoverage_label=Coverage -CoveragePropertyPageColumnCoverage_value=0.0 % -CoveragePropertyPageColumnCovered_label=Covered -CoveragePropertyPageColumnMissed_label=Missed -CoveragePropertyPageColumnTotal_label=Total -CoveragePropertyPageInstructions_label=Instructions -CoveragePropertyPageBlocks_label=Basic Blocks -CoveragePropertyPageLines_label=Lines -CoveragePropertyPageMethods_label=Methods -CoveragePropertyPageTypes_label=Types - -CoverageDecoratorSuffix_label=\u0020(0.0 %) - -CoveragePreferences_description=Settings for EclEmma Java code coverage. -CoveragePreferencesShowCoverageView_label=Open coverage view automatically -CoveragePreferencesActivateNewSessions_label=Activate new coverage sessions -CoveragePreferencesAutoRemoveSessions_label=Remove coverage sessions for removed launches -CoveragePreferencesShowInplaceWarning_label=Show in-place instrumentation warning -CoveragePreferencesDefaultInstrumentation_title=Default instrumentation: -CoveragePreferencesSourceFoldersOnly_label=Source folders only -CoveragePreferencesSameProjectOnly_label=Same project only -CoveragePreferencesClasspathFilter_label=Only path entries matching: -CoveragePreferencesDecoratorsLink_label=See Label Decorators for coverage decorators. -CoveragePreferencesAnnotationsLink_label=See Annotations for editor highlighing style. - -ClassesViewerEntry_label={0} - {1} - diff --git a/com.mountainminds.eclemma.ui/src/com/mountainminds/eclemma/internal/ui/viewers/ClassesViewer.java b/com.mountainminds.eclemma.ui/src/com/mountainminds/eclemma/internal/ui/viewers/ClassesViewer.java deleted file mode 100644 index 8d8803e..0000000 --- a/com.mountainminds.eclemma.ui/src/com/mountainminds/eclemma/internal/ui/viewers/ClassesViewer.java +++ /dev/null @@ -1,332 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Mountainminds GmbH & Co. KG - * This software is provided under the terms of the Eclipse Public License v1.0 - * See http://www.eclipse.org/legal/epl-v10.html. - * - * $Id$ - ******************************************************************************/ -package com.mountainminds.eclemma.internal.ui.viewers; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashSet; -import java.util.Iterator; -import java.util.List; -import java.util.Set; - -import org.eclipse.core.runtime.IPath; -import org.eclipse.jdt.core.IPackageFragmentRoot; -import org.eclipse.jface.viewers.ArrayContentProvider; -import org.eclipse.jface.viewers.CheckStateChangedEvent; -import org.eclipse.jface.viewers.CheckboxTableViewer; -import org.eclipse.jface.viewers.ICheckStateListener; -import org.eclipse.jface.viewers.ILabelProvider; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.ISelectionChangedListener; -import org.eclipse.jface.viewers.ISelectionProvider; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.LabelProvider; -import org.eclipse.jface.viewers.SelectionChangedEvent; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.jface.viewers.Viewer; -import org.eclipse.jface.viewers.ViewerSorter; -import org.eclipse.osgi.util.NLS; -import org.eclipse.swt.SWT; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Table; -import org.eclipse.ui.model.WorkbenchLabelProvider; - -import com.mountainminds.eclemma.core.IClassFiles; -import com.mountainminds.eclemma.internal.ui.UIMessages; - -/** - * Viewer for selecting IClassFiles objects from a given list. - * The viewer lists the corresponding IPackageFragmentRoots. Source based class - * files may have multiple corresponding roots, their selection status is - * connected. - * - * @author Marc R. Hoffmann - * @version $Revision$ - */ -public class ClassesViewer implements ISelectionProvider { - - private static class PackageFragmentRootLabelProvider extends LabelProvider { - - private ILabelProvider delegate = new WorkbenchLabelProvider(); - - public Image getImage(Object element) { - return delegate.getImage(element); - } - - public String getText(Object element) { - IPackageFragmentRoot root = (IPackageFragmentRoot) element; - String projectname = root.getJavaProject().getElementName(); - String path = getPathLabel(root); - if (path.length() > 0) { - String fmt = UIMessages.ClassesViewerEntry_label; - return NLS.bind(fmt, projectname, getPathLabel(root)); - } else { - return projectname; - } - } - - public void dispose() { - delegate.dispose(); - } - - } - - /** - * The entries will be sorted by project name, type and path name. - */ - private static class PackageFragmentRootSorter extends ViewerSorter { - - public int compare(Viewer viewer, Object e1, Object e2) { - IPackageFragmentRoot root1 = (IPackageFragmentRoot) e1; - IPackageFragmentRoot root2 = (IPackageFragmentRoot) e2; - int result = getCollator().compare(root1.getJavaProject().getElementName(), - root2.getJavaProject().getElementName()); - if (result != 0) return result; - if (root1.isExternal() != root2.isExternal()) { - return root1.isExternal() ? 1 : -1; - } - return getCollator().compare(getPathLabel(root1), getPathLabel(root2)); - } - - }; - - /** - * Calculates a label for the class path of the given package fragment root. - * For external entries this is the full path, otherwise it is the project - * relative path. - * - * @param root package fragement root - * @return label for the class path entry - */ - private static String getPathLabel(IPackageFragmentRoot root) { - IPath path = root.getPath(); - if (!root.isExternal()) { - path = path.removeFirstSegments(1); - } - return path.toString(); - } - - private final Table table; - private final CheckboxTableViewer viewer; - private final List listeners = new ArrayList(); - - private IClassFiles[] input; - private boolean includebinaries; - private final Set selectedclasses = new HashSet(); - - /** - * Creates a new viewer within the given parent. - * - * @param parent - * composite to create the viewer's table in - * @param style - * flags specifying the table's style - */ - public ClassesViewer(Composite parent, int style) { - this(new Table(parent, SWT.CHECK | style)); - } - - /** - * Attaches the viewer to the given table. - * - * @param table - * view table - */ - public ClassesViewer(Table table) { - this.table = table; - viewer = new CheckboxTableViewer(table); - viewer.setContentProvider(new ArrayContentProvider()); - viewer.setLabelProvider(new PackageFragmentRootLabelProvider()); - viewer.setSorter(new PackageFragmentRootSorter()); - viewer.addCheckStateListener(new ICheckStateListener() { - public void checkStateChanged(CheckStateChangedEvent event) { - updateCheckedStatus(event.getElement(), event.getChecked()); - } - }); - } - - /** - * Returns the table used by the viewer. - * - * @return table used by the viewer - */ - public Table getTable() { - return table; - } - - /** - * Sets the input for this viewer. - * - * @param input - * list of classfiles objects the user can select from - */ - public void setInput(IClassFiles[] input) { - this.input = input; - viewer.setInput(getPackageFragmentRoots(input)); - } - - /** - * Specifies whether binary classpath entries should also be listed. - * - * @param includebinaries - * true if binary entries should be listed - */ - public void setIncludeBinaries(boolean includebinaries) { - this.includebinaries = includebinaries; - if (!includebinaries) { - for (Iterator i = selectedclasses.iterator(); i.hasNext();) { - if (((IClassFiles) i.next()).isBinary()) { - i.remove(); - } - } - } - if (input != null) { - viewer.setInput(getPackageFragmentRoots(input)); - } - } - - /** - * Sets the initially checked classes. - * - * @param classfiles - * list of classfiles that should be checked - */ - public void setSelectedClasses(IClassFiles[] classfiles) { - selectedclasses.clear(); - selectedclasses.addAll(Arrays.asList(classfiles)); - viewer.setCheckedElements(getPackageFragmentRoots(classfiles)); - } - - /** - * Sets the initially checked classes from the given locations. - * - * @param locations - * location strings of the classes to select - */ - public void setSelectedClasses(String[] locations) { - Set lset = new HashSet(Arrays.asList(locations)); - selectedclasses.clear(); - for (int i = 0; i < input.length; i++) { - if (lset.contains(input[i].getLocation().toString())) { - selectedclasses.add(input[i]); - } - } - viewer.setCheckedElements(getPackageFragmentRoots(selectedclasses.toArray())); - } - - public void selectAll() { - selectedclasses.clear(); - for (int i = 0; i < input.length; i++) { - if (includebinaries || !input[i].isBinary()) { - selectedclasses.add(input[i]); - } - } - viewer.setCheckedElements(getPackageFragmentRoots(selectedclasses.toArray())); - } - - public void deselectAll() { - selectedclasses.clear(); - viewer.setCheckedElements(new Object[0]); - } - - /** - * Returns the currently checked classes. - * - * @return list of class files that are currently checked - */ - public IClassFiles[] getSelectedClasses() { - return (IClassFiles[]) selectedclasses.toArray(new IClassFiles[0]); - } - - /** - * Returns the locations of the currently checked classes. - * - * @return list of locations of class files that are currently checked - */ - public String[] getSelectedClassesLocations() { - String[] locs = new String[selectedclasses.size()]; - int idx = 0; - for (Iterator i = selectedclasses.iterator(); i.hasNext();) { - locs[idx++] = ((IClassFiles) i.next()).getLocation().toString(); - } - return locs; - } - - /** - * Registers the given selection listener if not already registered. - * - * @param listener - * listener to add - */ - public void addSelectionChangedListener(ISelectionChangedListener listener) { - if (!listeners.contains(listener)) { - listeners.add(listener); - } - } - - /** - * Removes the given selection listener. - * - * @param listener - * listener to remove - */ - public void removeSelectionChangedListener(ISelectionChangedListener listener) { - listeners.remove(listener); - } - - private IPackageFragmentRoot[] getPackageFragmentRoots(Object[] classfiles) { - Set roots = new HashSet(); - for (int i = 0; i < classfiles.length; i++) { - IClassFiles cf = (IClassFiles) classfiles[i]; - if (includebinaries || !cf.isBinary()) { - roots.addAll(Arrays.asList(cf.getPackageFragmentRoots())); - } - } - return (IPackageFragmentRoot[]) roots - .toArray(new IPackageFragmentRoot[roots.size()]); - } - - private void updateCheckedStatus(Object root, boolean checked) { - for (int i = 0; i < input.length; i++) { - IClassFiles cf = input[i]; - if (Arrays.asList(cf.getPackageFragmentRoots()).contains(root)) { - if (checked) { - selectedclasses.add(cf); - } else { - selectedclasses.remove(cf); - } - break; - } - } - viewer.setCheckedElements(getPackageFragmentRoots(selectedclasses.toArray())); - fireSelectionEvent(); - } - - private void fireSelectionEvent() { - SelectionChangedEvent evt = new SelectionChangedEvent(this, getSelection()); - for (Iterator i = listeners.iterator(); i.hasNext();) { - ISelectionChangedListener l = (ISelectionChangedListener) i.next(); - l.selectionChanged(evt); - } - } - - // ISelectionProvider interface - - public ISelection getSelection() { - return new StructuredSelection(getSelectedClasses()); - } - - public void setSelection(ISelection selection) { - Object[] classfiles = ((IStructuredSelection) selection).toArray(); - selectedclasses.clear(); - selectedclasses.addAll(Arrays.asList(classfiles)); - viewer.setCheckedElements(getPackageFragmentRoots(classfiles)); - } - -} diff --git a/com.mountainminds.eclemma.ui/src/com/mountainminds/eclemma/internal/ui/wizards/ComboHistory.java b/com.mountainminds.eclemma.ui/src/com/mountainminds/eclemma/internal/ui/wizards/ComboHistory.java deleted file mode 100644 index 74db0ce..0000000 --- a/com.mountainminds.eclemma.ui/src/com/mountainminds/eclemma/internal/ui/wizards/ComboHistory.java +++ /dev/null @@ -1,73 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Mountainminds GmbH & Co. KG - * This software is provided under the terms of the Eclipse Public License v1.0 - * See http://www.eclipse.org/legal/epl-v10.html. - * - * $Id$ - ******************************************************************************/ -package com.mountainminds.eclemma.internal.ui.wizards; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -import org.eclipse.jface.dialogs.IDialogSettings; -import org.eclipse.swt.widgets.Combo; - -/** - * Utility class for saving/restoring the history of entered text strings in a - * combo box widget. - * - * @author Marc R. Hoffmann - * @version $Revision$ - */ -public class ComboHistory { - - /** - * Maximum number of history items. - */ - public static final int HISTORY_LIMIT = 10; - - /** - * Restores the items of a combo box. - * - * @param settings - * dialog setting used to persist the history - * @param key - * key used for this combo box - * @param combo - * the combo box - */ - public static void restore(IDialogSettings settings, String key, Combo combo) { - String[] destinations = settings.getArray(key); - if (destinations != null) { - combo.setItems(destinations); - if (destinations.length > 0) { - combo.setText(destinations[0]); - } - } - } - - /** - * Saves the items of the given combo box as its history. The current text - * value is added as the most recent history item. The numer of history items - * is limited. - * - * @param settings - * dialog setting used to persist the history - * @param key - * key used for this combo box - * @param combo - * the combo box - */ - public static void save(IDialogSettings settings, String key, Combo combo) { - List history = new ArrayList(Arrays.asList(combo.getItems())); - history.remove(combo.getText()); - history.add(0, combo.getText()); - if (history.size() > HISTORY_LIMIT) { - history = history.subList(0, HISTORY_LIMIT); - } - settings.put(key, (String[]) history.toArray(new String[0])); - } - -} diff --git a/com.mountainminds.eclemma.ui/src/com/mountainminds/eclemma/internal/ui/wizards/ExternalFileEditorInput.java b/com.mountainminds.eclemma.ui/src/com/mountainminds/eclemma/internal/ui/wizards/ExternalFileEditorInput.java deleted file mode 100644 index d347d4c..0000000 --- a/com.mountainminds.eclemma.ui/src/com/mountainminds/eclemma/internal/ui/wizards/ExternalFileEditorInput.java +++ /dev/null @@ -1,85 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Mountainminds GmbH & Co. KG - * This software is provided under the terms of the Eclipse Public License v1.0 - * See http://www.eclipse.org/legal/epl-v10.html. - * - * $Id: $ - ******************************************************************************/ -package com.mountainminds.eclemma.internal.ui.wizards; - -import java.io.File; - -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.Path; -import org.eclipse.core.runtime.PlatformObject; -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.ui.IPathEditorInput; -import org.eclipse.ui.IPersistableElement; -import org.eclipse.ui.editors.text.ILocationProvider; - -/** - * Editor input for external files. - * - * @author Marc R. Hoffmann - * @version $Revision: $ - */ -public class ExternalFileEditorInput extends PlatformObject implements - IPathEditorInput, ILocationProvider { - - private File file; - - public ExternalFileEditorInput(File file) { - this.file = file; - } - - public boolean equals(Object o) { - if (o instanceof IPathEditorInput) { - IPathEditorInput input = (IPathEditorInput) o; - return getPath().equals(input.getPath()); - } - return false; - } - - public int hashCode() { - return file.hashCode(); - } - - // IEditorInput implementation - - public boolean exists() { - return file.exists(); - } - - public ImageDescriptor getImageDescriptor() { - return null; - } - - public String getName() { - return file.getName(); - } - - public IPersistableElement getPersistable() { - return null; - } - - public String getToolTipText() { - return file.getAbsolutePath(); - } - - // IPathEditorInput implementation - - public IPath getPath() { - return Path.fromOSString(file.getAbsolutePath()); - } - - // ILocationProvider implementation - - public IPath getPath(Object element) { - if (element instanceof ExternalFileEditorInput) { - return ((ExternalFileEditorInput) element).getPath(); - } else { - return null; - } - } - -} diff --git a/com.mountainminds.eclemma.ui/src/com/mountainminds/eclemma/internal/ui/wizards/SessionExportPage1.java b/com.mountainminds.eclemma.ui/src/com/mountainminds/eclemma/internal/ui/wizards/SessionExportPage1.java deleted file mode 100644 index 8870fd5..0000000 --- a/com.mountainminds.eclemma.ui/src/com/mountainminds/eclemma/internal/ui/wizards/SessionExportPage1.java +++ /dev/null @@ -1,219 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Mountainminds GmbH & Co. KG - * This software is provided under the terms of the Eclipse Public License v1.0 - * See http://www.eclipse.org/legal/epl-v10.html. - * - * $Id$ - ******************************************************************************/ -package com.mountainminds.eclemma.internal.ui.wizards; - -import java.io.File; - -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.Path; -import org.eclipse.jface.dialogs.IDialogSettings; -import org.eclipse.jface.viewers.ArrayContentProvider; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.jface.viewers.TableViewer; -import org.eclipse.jface.wizard.WizardPage; -import org.eclipse.osgi.util.NLS; -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.Group; -import org.eclipse.swt.widgets.Label; -import org.eclipse.ui.model.WorkbenchLabelProvider; - -import com.mountainminds.eclemma.core.CoverageTools; -import com.mountainminds.eclemma.core.ICoverageSession; -import com.mountainminds.eclemma.core.ISessionExporter; -import com.mountainminds.eclemma.internal.ui.ContextHelp; -import com.mountainminds.eclemma.internal.ui.UIMessages; - -/** - * This wizard page allows selecting a coverage session, the output format and - * destination. - * - * @author Marc R. Hoffmann - * @version $Revision$ - */ -public class SessionExportPage1 extends WizardPage { - - private static final String ID = "SessionExportPage1"; //$NON-NLS-1$ - - private static final String STORE_PREFIX = ID + "."; //$NON-NLS-1$ - private static final String STORE_FORMAT = STORE_PREFIX + "format"; //$NON-NLS-1$ - private static final String STORE_DESTINATIONS = STORE_PREFIX + "destinations"; //$NON-NLS-1$ - private static final String STORE_OPENREPORT = STORE_PREFIX + "openreport"; //$NON-NLS-1$ - - private TableViewer sessionstable; - private Combo formatcombo; - private Combo destinationcombo; - private Button opencheckbox; - - public SessionExportPage1() { - super(ID); - setTitle(UIMessages.ExportReportPage1_title); - setDescription(UIMessages.ExportReportPage1_description); - } - - public void createControl(Composite parent) { - initializeDialogUnits(parent); - parent = new Composite(parent, SWT.NONE); - parent.setLayout(new GridLayout()); - new Label(parent, SWT.NONE).setText(UIMessages.ExportReportPage1Sessions_label); - sessionstable = new TableViewer(parent, SWT.BORDER); - sessionstable.setLabelProvider(new WorkbenchLabelProvider()); - sessionstable.setContentProvider(new ArrayContentProvider()); - sessionstable.setInput(CoverageTools.getSessionManager().getSessions()); - ICoverageSession active = CoverageTools.getSessionManager().getActiveSession(); - if (active != null) { - sessionstable.setSelection(new StructuredSelection(active)); - } - GridData gd = new GridData(GridData.FILL_BOTH); - gd.heightHint = convertHeightInCharsToPixels(8); - sessionstable.getControl().setLayoutData(gd); - Group group = new Group(parent, SWT.NONE); - group.setText(UIMessages.ExportReportPage1DestinationGroup_label); - group.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - createExportOptionsGroup(group); - opencheckbox = new Button(parent, SWT.CHECK); - opencheckbox.setText(UIMessages.ExportReportOpenReport_label); - setControl(parent); - ContextHelp.setHelp(parent, ContextHelp.SESSION_EXPORT); - restoreWidgetValues(); - } - - private void createExportOptionsGroup(Composite parent) { - parent.setLayout(new GridLayout(3, false)); - new Label(parent, SWT.NONE).setText(UIMessages.ExportReportPage1Format_label); - formatcombo = new Combo(parent, SWT.READ_ONLY); - formatcombo.add(UIMessages.ExportReportPage1HTMLFormat_value); - formatcombo.add(UIMessages.ExportReportPage1XMLFormat_value); - formatcombo.add(UIMessages.ExportReportPage1TextFormat_value); - formatcombo.add(UIMessages.ExportReportPage1EMMAFormat_value); - formatcombo.addSelectionListener(new SelectionAdapter() { - public void widgetSelected(SelectionEvent e) { - // Adjust the extension to the new format - IPath path = Path.fromOSString(destinationcombo.getText()); - path = path.removeFileExtension(); - String ext = ISessionExporter.DEFAULT_EXTENSIONS[formatcombo.getSelectionIndex()]; - path = path.addFileExtension(ext); - destinationcombo.setText(path.toOSString()); - } - }); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan = 2; - formatcombo.setLayoutData(gd); - new Label(parent, SWT.NONE).setText(UIMessages.ExportReportPage1Destination_label); - destinationcombo = new Combo(parent, SWT.BORDER); - destinationcombo.addModifyListener(new ModifyListener() { - public void modifyText(ModifyEvent e) { - update(); - } - }); - gd = new GridData(GridData.FILL_HORIZONTAL); - gd.widthHint = convertHorizontalDLUsToPixels(120); - destinationcombo.setLayoutData(gd); - Button browsebutton = new Button(parent, SWT.NONE); - browsebutton.setText(UIMessages.BrowseAction_label); - setButtonLayoutData(browsebutton); - browsebutton.addSelectionListener(new SelectionAdapter() { - public void widgetSelected(SelectionEvent e) { - openBrowseDialog(); - } - }); - update(); - } - - private void openBrowseDialog() { - FileDialog fd = new FileDialog(getShell(), SWT.SAVE); - fd.setText(UIMessages.ExportReportPage1BrowseDialog_title); - fd.setFileName(destinationcombo.getText()); - String ext = ISessionExporter.DEFAULT_EXTENSIONS[formatcombo.getSelectionIndex()]; - fd.setFilterExtensions(new String[] { "*." + ext, "*.*"} ); //$NON-NLS-1$ //$NON-NLS-2$ - String file = fd.open(); - if (file != null) { - destinationcombo.setText(file); - } - } - - private void update() { - // make sure we have a session to export - if (getSelectedSession() == null) { - setErrorMessage(UIMessages.ExportReportPage1NoSession_message); - setPageComplete(false); - return; - } - // a destination file must be spezified - if (getDestination().length() == 0) { - setMessage(UIMessages.ExportReportPage1MissingDestination_message); - setPageComplete(false); - return; - } - // the destination must be a file and must be in a existing directory - File f = new File(getDestination()); - File p = f.getParentFile(); - if (f.isDirectory() || (p != null && !p.isDirectory())) { - setErrorMessage(UIMessages.ExportReportPage1InvalidDestination_message); - setPageComplete(false); - return; - } - // the extension should correspond to the report type - String exta = Path.fromOSString(getDestination()).getFileExtension(); - String exte = ISessionExporter.DEFAULT_EXTENSIONS[getReportFormat()]; - if (!exte.equalsIgnoreCase(exta)) { - setMessage(NLS.bind(UIMessages.ExportReportPage1WrongExtension_message, exte), WARNING); - setPageComplete(true); - return; - } - setErrorMessage(null); - setMessage(null); - setPageComplete(true); - } - - protected void restoreWidgetValues() { - IDialogSettings settings = getDialogSettings(); - try { - formatcombo.select(settings.getInt(STORE_FORMAT)); - } catch (NumberFormatException nfe) { - formatcombo.select(0); - } - ComboHistory.restore(settings, STORE_DESTINATIONS, destinationcombo); - opencheckbox.setSelection(settings.getBoolean(STORE_OPENREPORT)); - } - - public void saveWidgetValues() { - IDialogSettings settings = getDialogSettings(); - settings.put(STORE_FORMAT, formatcombo.getSelectionIndex()); - ComboHistory.save(settings, STORE_DESTINATIONS, destinationcombo); - settings.put(STORE_OPENREPORT, opencheckbox.getSelection()); - } - - public ICoverageSession getSelectedSession() { - IStructuredSelection sel = (IStructuredSelection) sessionstable.getSelection(); - return (ICoverageSession) sel.getFirstElement(); - } - - public int getReportFormat() { - return formatcombo.getSelectionIndex(); - } - - public String getDestination() { - return destinationcombo.getText().trim(); - } - - public boolean getOpenReport() { - return opencheckbox.getSelection(); - } - -} diff --git a/com.mountainminds.eclemma.ui/src/com/mountainminds/eclemma/internal/ui/wizards/SessionExportWizard.java b/com.mountainminds.eclemma.ui/src/com/mountainminds/eclemma/internal/ui/wizards/SessionExportWizard.java deleted file mode 100644 index 5ec6e0b..0000000 --- a/com.mountainminds.eclemma.ui/src/com/mountainminds/eclemma/internal/ui/wizards/SessionExportWizard.java +++ /dev/null @@ -1,137 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Mountainminds GmbH & Co. KG - * This software is provided under the terms of the Eclipse Public License v1.0 - * See http://www.eclipse.org/legal/epl-v10.html. - * - * $Id$ - ******************************************************************************/ -package com.mountainminds.eclemma.internal.ui.wizards; - -import java.io.File; -import java.lang.reflect.InvocationTargetException; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.jface.dialogs.ErrorDialog; -import org.eclipse.jface.dialogs.IDialogSettings; -import org.eclipse.jface.operation.IRunnableWithProgress; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.wizard.Wizard; -import org.eclipse.osgi.util.NLS; -import org.eclipse.ui.IEditorDescriptor; -import org.eclipse.ui.IEditorRegistry; -import org.eclipse.ui.IExportWizard; -import org.eclipse.ui.IWorkbench; -import org.eclipse.ui.IWorkbenchPage; -import org.eclipse.ui.PartInitException; -import org.eclipse.ui.ide.IDE; - -import com.mountainminds.eclemma.core.CoverageTools; -import com.mountainminds.eclemma.core.ICoverageSession; -import com.mountainminds.eclemma.core.ISessionExporter; -import com.mountainminds.eclemma.internal.ui.EclEmmaUIPlugin; -import com.mountainminds.eclemma.internal.ui.UIMessages; - -/** - * The export wizard for coverage sessions. - * - * @author Marc R. Hoffmann - * @version $Revision$ - */ -public class SessionExportWizard extends Wizard implements IExportWizard { - - private static final String SETTINGSID = "SessionExportWizard"; //$NON-NLS-1$ - - private IWorkbench workbench; - - private SessionExportPage1 page1; - - public SessionExportWizard() { - IDialogSettings pluginsettings = EclEmmaUIPlugin.getInstance() - .getDialogSettings(); - IDialogSettings wizardsettings = pluginsettings.getSection(SETTINGSID); - if (wizardsettings == null) { - wizardsettings = pluginsettings.addNewSection(SETTINGSID); - } - setDialogSettings(wizardsettings); - setWindowTitle(UIMessages.ExportReport_title); - setDefaultPageImageDescriptor( - EclEmmaUIPlugin.getImageDescriptor(EclEmmaUIPlugin.WIZBAN_EXPORT_SESSION)); - setNeedsProgressMonitor(true); - } - - public void init(IWorkbench workbench, IStructuredSelection selection) { - this.workbench = workbench; - } - - public void addPages() { - addPage(page1 = new SessionExportPage1()); - } - - public boolean performFinish() { - page1.saveWidgetValues(); - boolean result = createReport(); - if (result && page1.getOpenReport()) { - openReport(); - } - return result; - } - - private boolean createReport() { - ICoverageSession session = page1.getSelectedSession(); - final ISessionExporter exporter = CoverageTools.getExporter(session); - exporter.setFormat(page1.getReportFormat()); - exporter.setDestination(page1.getDestination()); - IRunnableWithProgress op = new IRunnableWithProgress() { - public void run(IProgressMonitor monitor) - throws InvocationTargetException, InterruptedException { - try { - exporter.export(monitor); - } catch (Exception e) { - throw new InvocationTargetException(e); - } - } - }; - try { - getContainer().run(true, true, op); - } catch (InterruptedException e) { - return false; - } catch (InvocationTargetException ite) { - Throwable ex = ite.getTargetException(); - EclEmmaUIPlugin.log(ex); - String title = UIMessages.ExportReportErrorDialog_title; - String msg = UIMessages.ExportReportErrorDialog_message; - msg = NLS.bind(msg, session.getDescription()); - IStatus status; - if (ex instanceof CoreException) { - status = ((CoreException) ex).getStatus(); - } else { - status = EclEmmaUIPlugin.errorStatus(String.valueOf(ex.getMessage()), ex); - } - ErrorDialog.openError(getShell(), title, msg, status); - return false; - } - return true; - } - - private void openReport() { - IWorkbenchPage page = workbench.getActiveWorkbenchWindow().getActivePage(); - File f = new File(page1.getDestination()); - String editorid = getEditorId(f); - if (editorid != null) { - try { - IDE.openEditor(page, new ExternalFileEditorInput(f), editorid); - } catch (PartInitException e) { - EclEmmaUIPlugin.log(e); - } - } - } - - private String getEditorId(File file) { - IEditorRegistry editorRegistry= workbench.getEditorRegistry(); - IEditorDescriptor descriptor = editorRegistry.getDefaultEditor(file.getName()); - return descriptor == null ? null : descriptor.getId(); - } - -} diff --git a/com.mountainminds.eclemma.ui/src/com/mountainminds/eclemma/internal/ui/wizards/SessionImportPage1.java b/com.mountainminds.eclemma.ui/src/com/mountainminds/eclemma/internal/ui/wizards/SessionImportPage1.java deleted file mode 100644 index 116dcd2..0000000 --- a/com.mountainminds.eclemma.ui/src/com/mountainminds/eclemma/internal/ui/wizards/SessionImportPage1.java +++ /dev/null @@ -1,288 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Mountainminds GmbH & Co. KG - * This software is provided under the terms of the Eclipse Public License v1.0 - * See http://www.eclipse.org/legal/epl-v10.html. - * - * $Id$ - ******************************************************************************/ -package com.mountainminds.eclemma.internal.ui.wizards; - -import java.io.File; -import java.text.MessageFormat; -import java.util.Date; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.jface.dialogs.IDialogSettings; -import org.eclipse.jface.viewers.ISelectionChangedListener; -import org.eclipse.jface.viewers.SelectionChangedEvent; -import org.eclipse.jface.wizard.WizardPage; -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.Group; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Text; - -import com.mountainminds.eclemma.core.CoverageTools; -import com.mountainminds.eclemma.core.IClassFiles; -import com.mountainminds.eclemma.internal.ui.ContextHelp; -import com.mountainminds.eclemma.internal.ui.EclEmmaUIPlugin; -import com.mountainminds.eclemma.internal.ui.UIMessages; -import com.mountainminds.eclemma.internal.ui.viewers.ClassesViewer; - -/** - * This wizard page allows selecting a coverage file and class path entries - * for import. - * - * @author Marc R. Hoffmann - * @version $Revision$ - */ -public class SessionImportPage1 extends WizardPage { - - private static final String ID = "SessionImportPage1"; //$NON-NLS-1$ - - private static final String STORE_PREFIX = ID + "."; //$NON-NLS-1$ - private static final String STORE_FILES = STORE_PREFIX + "files"; //$NON-NLS-1$ - private static final String STORE_CLASSES = STORE_PREFIX + "classes"; //$NON-NLS-1$ - private static final String STORE_BINARIES = STORE_PREFIX + "binaries"; //$NON-NLS-1$ - private static final String STORE_COPY = STORE_PREFIX + "copy"; //$NON-NLS-1$ - private static final String STORE_IMPORTMETADATA = STORE_PREFIX + "importmetadata"; //$NON-NLS-1$ - - private Text descriptiontext; - private Combo filecombo; - private ClassesViewer classesviewer; - private Button binariescheck; - private Button referenceradio; - private Button copyradio; - private Button ideclassesradio; - private Button importmetadataradio; - - protected SessionImportPage1() { - super(ID); - setTitle(UIMessages.ImportSessionPage1_title); - setDescription(UIMessages.ImportSessionPage1_description); - } - - public void createControl(Composite parent) { - initializeDialogUnits(parent); - parent = new Composite(parent, SWT.NONE); - GridLayout layout = new GridLayout(1, false); - parent.setLayout(layout); - createNameAndFileBlock(parent); - createClassPathsBlock(parent); - createButtonsBlock(parent); - createOptionsBlock(parent); - setControl(parent); - ContextHelp.setHelp(parent, ContextHelp.SESSION_IMPORT); - restoreWidgetValues(); - update(); - } - - private void createNameAndFileBlock(Composite parent) { - parent = new Composite(parent, SWT.NONE); - GridLayout layout = new GridLayout(3, false); - layout.marginWidth = 0; - layout.marginHeight = 0; - parent.setLayout(layout); - parent.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - new Label(parent, SWT.NONE).setText(UIMessages.ImportSessionPage1Description_label); - descriptiontext = new Text(parent, SWT.BORDER); - descriptiontext.addModifyListener(new ModifyListener() { - public void modifyText(ModifyEvent e) { - update(); - } - }); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan = 2; - descriptiontext.setLayoutData(gd); - new Label(parent, SWT.NONE).setText(UIMessages.ImportSessionPage1CoverageFile_label); - filecombo = new Combo(parent, SWT.BORDER); - filecombo.addModifyListener(new ModifyListener() { - public void modifyText(ModifyEvent e) { - update(); - } - }); - gd = new GridData(GridData.FILL_HORIZONTAL); - gd.widthHint = convertHorizontalDLUsToPixels(100); - filecombo.setLayoutData(gd); - Button browsebutton = new Button(parent, SWT.NONE); - browsebutton.setText(UIMessages.BrowseAction_label); - setButtonLayoutData(browsebutton); - browsebutton.addSelectionListener(new SelectionAdapter() { - public void widgetSelected(SelectionEvent e) { - openBrowseDialog(); - } - }); - } - - private void createClassPathsBlock(Composite parent) { - classesviewer = new ClassesViewer(parent, SWT.BORDER); - try { - classesviewer.setInput(CoverageTools.getClassFiles()); - } catch (CoreException e) { - EclEmmaUIPlugin.log(e); - } - classesviewer.addSelectionChangedListener(new ISelectionChangedListener() { - public void selectionChanged(SelectionChangedEvent event) { - update(); - } - }); - GridData gd = new GridData(GridData.FILL_BOTH); - gd.widthHint = convertHorizontalDLUsToPixels(120); - gd.heightHint = convertHeightInCharsToPixels(8); - classesviewer.getTable().setLayoutData(gd); - } - - private void createButtonsBlock(Composite parent) { - parent = new Composite(parent, SWT.NONE); - GridLayout layout = new GridLayout(3, false); - layout.marginWidth = 0; - layout.marginHeight = 0; - parent.setLayout(layout); - parent.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - binariescheck = new Button(parent, SWT.CHECK); - binariescheck.setText(UIMessages.ImportSessionPage1Binaries_label); - binariescheck.addSelectionListener(new SelectionAdapter() { - public void widgetSelected(SelectionEvent e) { - classesviewer.setIncludeBinaries(binariescheck.getSelection()); - update(); - } - }); - binariescheck.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL)); - Button buttonSelectAll = new Button(parent, SWT.PUSH); - buttonSelectAll.setText(UIMessages.SelectAllAction_label); - buttonSelectAll.addSelectionListener(new SelectionAdapter() { - public void widgetSelected(SelectionEvent e) { - classesviewer.selectAll(); - update(); - } - }); - setButtonLayoutData(buttonSelectAll); - Button buttonDeselectAll = new Button(parent, SWT.PUSH); - buttonDeselectAll.setText(UIMessages.DeselectAllAction_label); - buttonDeselectAll.addSelectionListener(new SelectionAdapter() { - public void widgetSelected(SelectionEvent e) { - classesviewer.deselectAll(); - update(); - } - }); - setButtonLayoutData(buttonDeselectAll); - } - - private void createOptionsBlock(Composite parent) { - parent = new Composite(parent, SWT.NONE); - GridLayout layout = new GridLayout(2, true); - layout.marginWidth = 0; - layout.marginHeight = 0; - parent.setLayout(layout); - parent.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - Group group = new Group(parent, SWT.NONE); - group.setText(UIMessages.ImportSessionPage1ModeGroup_label); - group.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - group.setLayout(new GridLayout()); - referenceradio = new Button(group, SWT.RADIO); - referenceradio.setText(UIMessages.ImportSessionPage1Reference_label); - copyradio = new Button(group, SWT.RADIO); - copyradio.setText(UIMessages.ImportSessionPage1Copy_label); - group = new Group(parent, SWT.NONE); - group.setText(UIMessages.ImportSessionPage1MetadataGroup_label); - group.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - group.setLayout(new GridLayout()); - ideclassesradio = new Button(group, SWT.RADIO); - ideclassesradio.setText(UIMessages.ImportSessionPage1IDEClasses_label); - importmetadataradio = new Button(group, SWT.RADIO); - importmetadataradio.setText(UIMessages.ImportSessionPage1ImportMetaData_label); - } - - private void openBrowseDialog() { - FileDialog fd = new FileDialog(getShell(), SWT.OPEN); - fd.setText(UIMessages.ImportSessionPage1BrowseDialog_title); - fd.setFileName(filecombo.getText()); - fd.setFilterExtensions(new String[] { "*.ec;*.es", "*.*"} ); //$NON-NLS-1$ //$NON-NLS-2$ - String file = fd.open(); - if (file != null) { - filecombo.setText(file); - } - } - - private void update() { - if (getSessionDescription().length() == 0) { - setMessage(UIMessages.ImportReportPage1NoDescription_message); - setPageComplete(false); - return; - } - File cf = new File(getCoverageFile()); - if (!cf.exists() || !cf.isFile()) { - setMessage(UIMessages.ImportReportPage1NoCoverageFile_message); - setPageComplete(false); - return; - } - if (getClassFiles().length == 0) { - setMessage(UIMessages.ImportReportPage1NoClassFiles_message); - setPageComplete(false); - return; - } - setErrorMessage(null); - setMessage(null); - setPageComplete(true); - } - - protected void restoreWidgetValues() { - String descr = UIMessages.ImportSessionPage1Description_value; - Object[] arg = new Object[] { new Date() }; - descriptiontext.setText(MessageFormat.format(descr, arg)); - IDialogSettings settings = getDialogSettings(); - ComboHistory.restore(settings, STORE_FILES, filecombo); - boolean binaries = settings.getBoolean(STORE_BINARIES); - classesviewer.setIncludeBinaries(binaries); - binariescheck.setSelection(binaries); - String[] classes = settings.getArray(STORE_CLASSES); - if (classes != null) { - classesviewer.setSelectedClasses(classes); - } - boolean copy = settings.getBoolean(STORE_COPY); - referenceradio.setSelection(!copy); - copyradio.setSelection(copy); - boolean importmetadata = settings.getBoolean(STORE_IMPORTMETADATA); - ideclassesradio.setSelection(!importmetadata); - importmetadataradio.setSelection(importmetadata); - } - - public void saveWidgetValues() { - IDialogSettings settings = getDialogSettings(); - ComboHistory.save(settings, STORE_FILES, filecombo); - settings.put(STORE_CLASSES, classesviewer.getSelectedClassesLocations()); - settings.put(STORE_BINARIES, binariescheck.getSelection()); - settings.put(STORE_COPY, copyradio.getSelection()); - settings.put(STORE_IMPORTMETADATA, importmetadataradio.getSelection()); - } - - public String getSessionDescription() { - return descriptiontext.getText().trim(); - } - - public String getCoverageFile() { - return filecombo.getText(); - } - - public IClassFiles[] getClassFiles() { - return classesviewer.getSelectedClasses(); - } - - public boolean getCreateCopy() { - return copyradio.getSelection(); - } - - public boolean getUseImportedMetaData() { - return importmetadataradio.getSelection(); - } - -} diff --git a/com.mountainminds.eclemma.ui/src/com/mountainminds/eclemma/internal/ui/wizards/SessionImportWizard.java b/com.mountainminds.eclemma.ui/src/com/mountainminds/eclemma/internal/ui/wizards/SessionImportWizard.java deleted file mode 100644 index 436bc22..0000000 --- a/com.mountainminds.eclemma.ui/src/com/mountainminds/eclemma/internal/ui/wizards/SessionImportWizard.java +++ /dev/null @@ -1,106 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Mountainminds GmbH & Co. KG - * This software is provided under the terms of the Eclipse Public License v1.0 - * See http://www.eclipse.org/legal/epl-v10.html. - * - * $Id$ - ******************************************************************************/ -package com.mountainminds.eclemma.internal.ui.wizards; - -import java.lang.reflect.InvocationTargetException; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.jface.dialogs.ErrorDialog; -import org.eclipse.jface.dialogs.IDialogSettings; -import org.eclipse.jface.operation.IRunnableWithProgress; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.wizard.Wizard; -import org.eclipse.ui.IImportWizard; -import org.eclipse.ui.IWorkbench; - -import com.mountainminds.eclemma.core.CoverageTools; -import com.mountainminds.eclemma.core.ISessionImporter; -import com.mountainminds.eclemma.internal.ui.EclEmmaUIPlugin; -import com.mountainminds.eclemma.internal.ui.UIMessages; - -/** - * The import wizard for coverage sessions. - * - * @author Marc R. Hoffmann - * @version $Revision$ - */ -public class SessionImportWizard extends Wizard implements IImportWizard { - - private static final String SETTINGSID = "SessionImportWizard"; //$NON-NLS-1$ - - private SessionImportPage1 page1; - - public SessionImportWizard() { - IDialogSettings pluginsettings = EclEmmaUIPlugin.getInstance() - .getDialogSettings(); - IDialogSettings wizardsettings = pluginsettings.getSection(SETTINGSID); - if (wizardsettings == null) { - wizardsettings = pluginsettings.addNewSection(SETTINGSID); - } - setDialogSettings(wizardsettings); - setWindowTitle(UIMessages.ImportSession_title); - setDefaultPageImageDescriptor(EclEmmaUIPlugin - .getImageDescriptor(EclEmmaUIPlugin.WIZBAN_IMPORT_SESSION)); - setNeedsProgressMonitor(true); - } - - public void init(IWorkbench workbench, IStructuredSelection selection) { - // nothing to initialize - } - - public void addPages() { - addPage(page1 = new SessionImportPage1()); - super.addPages(); - } - - public boolean performFinish() { - page1.saveWidgetValues(); - return importSession(); - } - - private boolean importSession() { - final ISessionImporter importer = CoverageTools.getImporter(); - importer.setDescription(page1.getSessionDescription()); - importer.setCoverageFile(page1.getCoverageFile()); - importer.setClassFiles(page1.getClassFiles()); - importer.setCopy(page1.getCreateCopy()); - importer.setUseImportedMetaData(page1.getUseImportedMetaData()); - IRunnableWithProgress op = new IRunnableWithProgress() { - public void run(IProgressMonitor monitor) - throws InvocationTargetException, InterruptedException { - try { - importer.importSession(monitor); - } catch (Exception e) { - throw new InvocationTargetException(e); - } - } - }; - try { - getContainer().run(true, true, op); - } catch (InterruptedException e) { - return false; - } catch (InvocationTargetException ite) { - Throwable ex = ite.getTargetException(); - EclEmmaUIPlugin.log(ex); - String title = UIMessages.ImportReportErrorDialog_title; - String msg = UIMessages.ImportReportErrorDialog_message; - IStatus status; - if (ex instanceof CoreException) { - status = ((CoreException) ex).getStatus(); - } else { - status = EclEmmaUIPlugin.errorStatus(String.valueOf(ex.getMessage()), ex); - } - ErrorDialog.openError(getShell(), title, msg, status); - return false; - } - return true; - } - -} diff --git a/com.mountainminds.eclemma.ui/src/com/mountainminds/eclemma/ui/launching/CoverageLaunchShortcut.java b/com.mountainminds.eclemma.ui/src/com/mountainminds/eclemma/ui/launching/CoverageLaunchShortcut.java deleted file mode 100644 index 626dc61..0000000 --- a/com.mountainminds.eclemma.ui/src/com/mountainminds/eclemma/ui/launching/CoverageLaunchShortcut.java +++ /dev/null @@ -1,84 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Mountainminds GmbH & Co. KG - * This software is provided under the terms of the Eclipse Public License v1.0 - * See http://www.eclipse.org/legal/epl-v10.html. - * - * $Id$ - ******************************************************************************/ -package com.mountainminds.eclemma.ui.launching; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IConfigurationElement; -import org.eclipse.core.runtime.IExecutableExtension; -import org.eclipse.core.runtime.IExtensionPoint; -import org.eclipse.core.runtime.Platform; -import org.eclipse.debug.ui.IDebugUIConstants; -import org.eclipse.debug.ui.ILaunchShortcut; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.ui.IEditorPart; - -import com.mountainminds.eclemma.core.CoverageTools; -import com.mountainminds.eclemma.internal.ui.EclEmmaUIPlugin; - -/** - * Generic ILaunchShortcut implementation that delegates to another - * ILaunchShortcut with a given id. The id is specified via the executable - * extension attribute "class": - * - *
- *   class="com.mountainminds.eclemma.internal.ui.launching.CoverageLaunchShortcut:org.eclipse.jdt.debug.ui.localJavaShortcut"
- * 
- * - * @author Marc R. Hoffmann - * @version $Revision$ - */ -public class CoverageLaunchShortcut implements ILaunchShortcut, IExecutableExtension { - - private String delegateId; - private ILaunchShortcut delegate; - - private ILaunchShortcut getDelegate() { - if (delegate == null) { - IExtensionPoint extensionPoint = Platform.getExtensionRegistry().getExtensionPoint(IDebugUIConstants.PLUGIN_ID, IDebugUIConstants.EXTENSION_POINT_LAUNCH_SHORTCUTS); - IConfigurationElement[] configs = extensionPoint.getConfigurationElements(); - for (int i = 0; i < configs.length; i++) { - if (delegateId.equals(configs[i].getAttribute("id"))) { //$NON-NLS-1$ - try { - delegate = (ILaunchShortcut) configs[i].createExecutableExtension("class"); //$NON-NLS-1$ - } catch (CoreException e) { - EclEmmaUIPlugin.log(e); - } - break; - } - } - if (delegate == null) { - String msg = "ILaunchShortcut declaration not found: " + delegateId; //$NON-NLS-1$ - EclEmmaUIPlugin.getInstance().getLog().log(EclEmmaUIPlugin.errorStatus(msg, null)); - } - } - return delegate; - } - - // IExecutableExtension interface: - - public void setInitializationData(IConfigurationElement config, String propertyName, Object data) throws CoreException { - delegateId = String.valueOf(data); - } - - // ILaunchShortcut interface: - - public void launch(ISelection selection, String mode) { - ILaunchShortcut delegate = getDelegate(); - if (delegate != null) { - delegate.launch(selection, CoverageTools.LAUNCH_MODE); - } - } - - public void launch(IEditorPart editor, String mode) { - ILaunchShortcut delegate = getDelegate(); - if (delegate != null) { - delegate.launch(editor, CoverageTools.LAUNCH_MODE); - } - } - -} diff --git a/com.mountainminds.eclemma.ui/src/com/mountainminds/eclemma/ui/launching/CoverageTab.java b/com.mountainminds.eclemma.ui/src/com/mountainminds/eclemma/ui/launching/CoverageTab.java deleted file mode 100644 index 466dbd7..0000000 --- a/com.mountainminds.eclemma.ui/src/com/mountainminds/eclemma/ui/launching/CoverageTab.java +++ /dev/null @@ -1,166 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Mountainminds GmbH & Co. KG - * This software is provided under the terms of the Eclipse Public License v1.0 - * See http://www.eclipse.org/legal/epl-v10.html. - * - * $Id$ - ******************************************************************************/ -package com.mountainminds.eclemma.ui.launching; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.debug.core.ILaunchConfiguration; -import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; -import org.eclipse.debug.ui.AbstractLaunchConfigurationTab; -import org.eclipse.jface.viewers.ISelectionChangedListener; -import org.eclipse.jface.viewers.SelectionChangedEvent; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -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.Group; - -import com.mountainminds.eclemma.core.CoverageTools; -import com.mountainminds.eclemma.core.IClassFiles; -import com.mountainminds.eclemma.core.launching.ICoverageLaunchConfigurationConstants; -import com.mountainminds.eclemma.internal.ui.ContextHelp; -import com.mountainminds.eclemma.internal.ui.EclEmmaUIPlugin; -import com.mountainminds.eclemma.internal.ui.UIMessages; -import com.mountainminds.eclemma.internal.ui.viewers.ClassesViewer; - -/** - * The "Coverage" tab of the launch configuration dialog. - * - * @author Marc R. Hoffmann - * @version $Revision$ - */ -public class CoverageTab extends AbstractLaunchConfigurationTab { - - private final boolean inplaceonly; - private ClassesViewer classesviewer; - private Button buttonInplaceInstrumentation; - - public CoverageTab(boolean inplaceonly) { - this.inplaceonly = inplaceonly; - } - - public void createControl(Composite parent) { - parent = new Composite(parent, SWT.NONE); - ContextHelp.setHelp(parent, ContextHelp.COVERAGE_LAUNCH_TAB); - GridLayout layout = new GridLayout(); - layout.verticalSpacing = 0; - parent.setLayout(layout); - setControl(parent); - createInstrumentedClasses(parent); - } - - private void createInstrumentedClasses(Composite parent) { - Group group = new Group(parent, SWT.NONE); - group.setLayoutData(new GridData(GridData.FILL_BOTH)); - group.setText(UIMessages.CoverageTabInstrumentedClassesGroup_label); - GridLayout layout = new GridLayout(); - layout.numColumns = 3; - group.setLayout(layout); - classesviewer = new ClassesViewer(group, SWT.BORDER); - GridData gd = new GridData(GridData.FILL_BOTH); - gd.horizontalSpan = 3; - classesviewer.getTable().setLayoutData(gd); - classesviewer.addSelectionChangedListener(new ISelectionChangedListener() { - public void selectionChanged(SelectionChangedEvent event) { - setDirty(true); - updateErrorStatus(); - updateLaunchConfigurationDialog(); - } - }); - - buttonInplaceInstrumentation = new Button(group, SWT.CHECK); - buttonInplaceInstrumentation.setText(UIMessages.CoverageTabInplaceInstrumentation_label); - buttonInplaceInstrumentation.setEnabled(!inplaceonly); - buttonInplaceInstrumentation.addSelectionListener(new SelectionAdapter() { - public void widgetSelected(SelectionEvent e) { - classesviewer.setIncludeBinaries(!buttonInplaceInstrumentation.getSelection()); - setDirty(true); - updateLaunchConfigurationDialog(); - } - }); - buttonInplaceInstrumentation.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL)); - Button buttonSelectAll = createPushButton(group, UIMessages.SelectAllAction_label, null); - buttonSelectAll.addSelectionListener(new SelectionAdapter() { - public void widgetSelected(SelectionEvent e) { - classesviewer.selectAll(); - setDirty(true); - updateLaunchConfigurationDialog(); - } - }); - Button buttonDeselectAll = createPushButton(group, UIMessages.DeselectAllAction_label, null); - buttonDeselectAll.addSelectionListener(new SelectionAdapter() { - public void widgetSelected(SelectionEvent e) { - classesviewer.deselectAll(); - setDirty(true); - updateLaunchConfigurationDialog(); - } - }); - } - - public void setDefaults(ILaunchConfigurationWorkingCopy configuration) { - // nothing to do - } - - public void initializeFrom(ILaunchConfiguration configuration) { - try { - boolean inplace = inplaceonly || configuration.getAttribute( - ICoverageLaunchConfigurationConstants.ATTR_INPLACE_INSTRUMENTATION, false); - buttonInplaceInstrumentation.setSelection(inplace); - classesviewer.setIncludeBinaries(!inplace); - classesviewer.setInput(CoverageTools.getClassFiles(configuration, true)); - classesviewer.setSelectedClasses( - CoverageTools.getClassFilesForInstrumentation(configuration, inplace)); - } catch (CoreException e) { - EclEmmaUIPlugin.log(e); - } - updateErrorStatus(); - setDirty(false); - } - - public void performApply(ILaunchConfigurationWorkingCopy configuration) { - if (isDirty()) { - configuration.setAttribute( - ICoverageLaunchConfigurationConstants.ATTR_INPLACE_INSTRUMENTATION, - buttonInplaceInstrumentation.getSelection()); - IClassFiles[] classes = classesviewer.getSelectedClasses(); - List l = new ArrayList(); - for (int i = 0; i < classes.length; i++) { - l.add(classes[i].getLocation().toString()); - } - configuration.setAttribute( - ICoverageLaunchConfigurationConstants.ATTR_INSTRUMENTATION_PATHS, l); - } - } - - public boolean isValid(ILaunchConfiguration launchConfig) { - return !classesviewer.getSelection().isEmpty(); - } - - public String getName() { - return UIMessages.CoverageTab_title; - } - - public Image getImage() { - return EclEmmaUIPlugin.getImage(EclEmmaUIPlugin.EVIEW_COVERAGE); - } - - private void updateErrorStatus() { - if (classesviewer.getSelection().isEmpty()) { - setErrorMessage(UIMessages.CoverageTabNoClassesSelected_message); - } else { - setErrorMessage(null); - } - } - -} diff --git a/com.mountainminds.eclemma.ui/src/com/mountainminds/eclemma/ui/launching/CoverageTabGroup.java b/com.mountainminds.eclemma.ui/src/com/mountainminds/eclemma/ui/launching/CoverageTabGroup.java deleted file mode 100644 index cdb4fac..0000000 --- a/com.mountainminds.eclemma.ui/src/com/mountainminds/eclemma/ui/launching/CoverageTabGroup.java +++ /dev/null @@ -1,124 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006 Mountainminds GmbH & Co. KG - * This software is provided under the terms of the Eclipse Public License v1.0 - * See http://www.eclipse.org/legal/epl-v10.html. - * - * $Id$ - ******************************************************************************/ -package com.mountainminds.eclemma.ui.launching; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IConfigurationElement; -import org.eclipse.core.runtime.IExecutableExtension; -import org.eclipse.core.runtime.IExtensionPoint; -import org.eclipse.core.runtime.Platform; -import org.eclipse.debug.core.ILaunch; -import org.eclipse.debug.core.ILaunchConfiguration; -import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; -import org.eclipse.debug.core.ILaunchManager; -import org.eclipse.debug.ui.ILaunchConfigurationDialog; -import org.eclipse.debug.ui.ILaunchConfigurationTab; -import org.eclipse.debug.ui.ILaunchConfigurationTabGroup; - -import com.mountainminds.eclemma.internal.ui.EclEmmaUIPlugin; - -/** - * The coverage tab group simply uses the tab group for the launch type "run" - * and inserts the "Coverage" tab at the second position. - * - * @author Marc R. Hoffmann - * @version $Revision$ - */ -public class CoverageTabGroup implements ILaunchConfigurationTabGroup, IExecutableExtension { - - private static final String DELEGATE_LAUNCHMODE = ILaunchManager.RUN_MODE; - private static final String EXPOINT_TABGROUP = "org.eclipse.debug.ui.launchConfigurationTabGroups"; //$NON-NLS-1$ - private static final String CONFIGATTR_TYPE = "type"; //$NON-NLS-1$ - private static final String INPLACEONLY_FLAG = "inplaceonly"; //$NON-NLS-1$ - - private ILaunchConfigurationTabGroup tabGroupDelegate; - private ILaunchConfigurationTab coverageTab; - private boolean inplaceonly; - - // IExecutableExtension interface - - public void setInitializationData(IConfigurationElement config, String propertyName, Object data) throws CoreException { - tabGroupDelegate = createDelegate(config.getAttribute(CONFIGATTR_TYPE)); - inplaceonly = String.valueOf(data).indexOf(INPLACEONLY_FLAG) != -1; - } - - protected ILaunchConfigurationTabGroup createDelegate(String type) throws CoreException { - IExtensionPoint extensionpoint = Platform.getExtensionRegistry().getExtensionPoint(EXPOINT_TABGROUP); - IConfigurationElement[] tabGroupConfigs = extensionpoint.getConfigurationElements(); - IConfigurationElement element = null; - findloop: for (int i = 0; i < tabGroupConfigs.length; i++) { - IConfigurationElement tabGroupConfig = tabGroupConfigs[i]; - if (type.equals(tabGroupConfig.getAttribute(CONFIGATTR_TYPE))) { - IConfigurationElement[] modeConfigs = tabGroupConfig.getChildren("launchMode"); //$NON-NLS-1$ - if (modeConfigs.length == 0) { - element = tabGroupConfig; - } - for (int j = 0; j < modeConfigs.length; j++) { - if (DELEGATE_LAUNCHMODE.equals(modeConfigs[j].getAttribute("mode"))) { //$NON-NLS-1$ - element = tabGroupConfig; - break findloop; - } - } - } - } - if (element == null) { - String msg = "No tab group registered to run " + type; //$NON-NLS-1$; - throw new CoreException(EclEmmaUIPlugin.errorStatus(msg, null)); - } else { - return (ILaunchConfigurationTabGroup) element.createExecutableExtension("class"); //$NON-NLS-1$ - } - } - - // ILaunchConfigurationTabGroup interface - - public void createTabs(ILaunchConfigurationDialog dialog, String mode) { - tabGroupDelegate.createTabs(dialog, mode); - coverageTab = createCoverageTab(dialog, mode); - } - - protected ILaunchConfigurationTab createCoverageTab(ILaunchConfigurationDialog dialog, String mode) { - return new CoverageTab(inplaceonly); - } - - public ILaunchConfigurationTab[] getTabs() { - return insertCoverageTab(tabGroupDelegate.getTabs(), coverageTab); - } - - protected ILaunchConfigurationTab[] insertCoverageTab(ILaunchConfigurationTab[] delegateTabs, ILaunchConfigurationTab coverageTab) { - ILaunchConfigurationTab[] tabs = new ILaunchConfigurationTab[delegateTabs.length + 1]; - tabs[0] = delegateTabs[0]; - tabs[1] = coverageTab; - System.arraycopy(delegateTabs, 1, tabs, 2, delegateTabs.length - 1); - return tabs; - } - - public void dispose() { - tabGroupDelegate.dispose(); - coverageTab.dispose(); - } - - public void setDefaults(ILaunchConfigurationWorkingCopy configuration) { - tabGroupDelegate.setDefaults(configuration); - coverageTab.setDefaults(configuration); - } - - public void initializeFrom(ILaunchConfiguration configuration) { - tabGroupDelegate.initializeFrom(configuration); - coverageTab.initializeFrom(configuration); - } - - public void performApply(ILaunchConfigurationWorkingCopy configuration) { - tabGroupDelegate.performApply(configuration); - coverageTab.performApply(configuration); - } - - public void launched(ILaunch launch) { - // deprecated method will not be called - } - -}