initial commit of org.eclipse.pde.runtime HEAD 2009-07-07 to incubator for GSOC OSGi Monitoring project
diff --git a/osgimonitoring/plugins/org.eclipse.pde.runtime/.classpath b/osgimonitoring/plugins/org.eclipse.pde.runtime/.classpath
new file mode 100644
index 0000000..2fbb7a2
--- /dev/null
+++ b/osgimonitoring/plugins/org.eclipse.pde.runtime/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.4"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/osgimonitoring/plugins/org.eclipse.pde.runtime/.cvsignore b/osgimonitoring/plugins/org.eclipse.pde.runtime/.cvsignore
new file mode 100644
index 0000000..c5e82d7
--- /dev/null
+++ b/osgimonitoring/plugins/org.eclipse.pde.runtime/.cvsignore
@@ -0,0 +1 @@
+bin
\ No newline at end of file
diff --git a/osgimonitoring/plugins/org.eclipse.pde.runtime/.project b/osgimonitoring/plugins/org.eclipse.pde.runtime/.project
new file mode 100644
index 0000000..26e0781
--- /dev/null
+++ b/osgimonitoring/plugins/org.eclipse.pde.runtime/.project
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.pde.runtime</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.api.tools.apiAnalysisBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.pde.api.tools.apiAnalysisNature</nature>
+ </natures>
+</projectDescription>
diff --git a/osgimonitoring/plugins/org.eclipse.pde.runtime/.settings/org.eclipse.core.resources.prefs b/osgimonitoring/plugins/org.eclipse.pde.runtime/.settings/org.eclipse.core.resources.prefs
new file mode 100644
index 0000000..1a4cdbd
--- /dev/null
+++ b/osgimonitoring/plugins/org.eclipse.pde.runtime/.settings/org.eclipse.core.resources.prefs
@@ -0,0 +1,7 @@
+#Fri Oct 20 13:22:13 EDT 2006
+eclipse.preferences.version=1
+encoding//core/framework/org/eclipse/osgi/framework/internal/core/default.permissions=UTF-8
+encoding//core/framework/org/eclipse/osgi/framework/internal/core/implied.permissions=UTF-8
+encoding//core/framework/org/eclipse/osgi/framework/internal/core/osname.aliases=UTF-8
+encoding//core/framework/org/eclipse/osgi/framework/internal/core/processor.aliases=UTF-8
+encoding/<project>=ISO-8859-1
diff --git a/osgimonitoring/plugins/org.eclipse.pde.runtime/.settings/org.eclipse.jdt.core.prefs b/osgimonitoring/plugins/org.eclipse.pde.runtime/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000..60af2c9
--- /dev/null
+++ b/osgimonitoring/plugins/org.eclipse.pde.runtime/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,352 @@
+#Mon Oct 13 14:57:59 CDT 2008
+eclipse.preferences.version=1
+org.eclipse.jdt.core.builder.cleanOutputFolder=clean
+org.eclipse.jdt.core.builder.duplicateResourceTask=warning
+org.eclipse.jdt.core.builder.invalidClasspath=abort
+org.eclipse.jdt.core.builder.recreateModifiedClassFileInOutputFolder=ignore
+org.eclipse.jdt.core.builder.resourceCopyExclusionFilter=*.launch
+org.eclipse.jdt.core.circularClasspath=error
+org.eclipse.jdt.core.classpath.exclusionPatterns=enabled
+org.eclipse.jdt.core.classpath.multipleOutputLocations=enabled
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=disabled
+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.doc.comment.support=enabled
+org.eclipse.jdt.core.compiler.maxProblemPerUnit=1000
+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.comparingIdentical=warning
+org.eclipse.jdt.core.compiler.problem.deprecation=warning
+org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
+org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=enabled
+org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
+org.eclipse.jdt.core.compiler.problem.emptyStatement=warning
+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=warning
+org.eclipse.jdt.core.compiler.problem.finalParameterBound=ignore
+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=warning
+org.eclipse.jdt.core.compiler.problem.invalidJavadoc=warning
+org.eclipse.jdt.core.compiler.problem.invalidJavadocTags=disabled
+org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsDeprecatedRef=disabled
+org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsNotVisibleRef=disabled
+org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility=private
+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.missingJavadocComments=ignore
+org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsOverriding=enabled
+org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility=public
+org.eclipse.jdt.core.compiler.problem.missingJavadocTagDescription=return_tag
+org.eclipse.jdt.core.compiler.problem.missingJavadocTags=ignore
+org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=enabled
+org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=public
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore
+org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
+org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore
+org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
+org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
+org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=warning
+org.eclipse.jdt.core.compiler.problem.nullReference=warning
+org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
+org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
+org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning
+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=warning
+org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
+org.eclipse.jdt.core.compiler.problem.unnecessaryElse=warning
+org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning
+org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=warning
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=enabled
+org.eclipse.jdt.core.compiler.problem.unusedImport=error
+org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
+org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
+org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore
+org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=enabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=enabled
+org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=error
+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=false
+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=false
+org.eclipse.jdt.core.formatter.comment.format_line_comments=false
+org.eclipse.jdt.core.formatter.comment.format_source_code=true
+org.eclipse.jdt.core.formatter.comment.indent_parameter_description=false
+org.eclipse.jdt.core.formatter.comment.indent_root_tags=false
+org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert
+org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=do not insert
+org.eclipse.jdt.core.formatter.comment.line_length=80
+org.eclipse.jdt.core.formatter.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=true
+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=do not 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=do not 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=do not 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=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=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=800
+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=true
+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=false
+org.eclipse.jdt.core.formatter.tabulation.char=tab
+org.eclipse.jdt.core.formatter.tabulation.size=4
+org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false
+org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true
+org.eclipse.jdt.core.incompatibleJDKLevel=ignore
+org.eclipse.jdt.core.incompleteClasspath=error
diff --git a/osgimonitoring/plugins/org.eclipse.pde.runtime/.settings/org.eclipse.jdt.launching.prefs b/osgimonitoring/plugins/org.eclipse.pde.runtime/.settings/org.eclipse.jdt.launching.prefs
new file mode 100644
index 0000000..08eb112
--- /dev/null
+++ b/osgimonitoring/plugins/org.eclipse.pde.runtime/.settings/org.eclipse.jdt.launching.prefs
@@ -0,0 +1,3 @@
+#Mon Oct 13 14:57:59 CDT 2008
+eclipse.preferences.version=1
+org.eclipse.jdt.launching.PREF_STRICTLY_COMPATIBLE_JRE_NOT_AVAILABLE=warning
diff --git a/osgimonitoring/plugins/org.eclipse.pde.runtime/.settings/org.eclipse.jdt.ui.prefs b/osgimonitoring/plugins/org.eclipse.pde.runtime/.settings/org.eclipse.jdt.ui.prefs
new file mode 100644
index 0000000..fd5da18
--- /dev/null
+++ b/osgimonitoring/plugins/org.eclipse.pde.runtime/.settings/org.eclipse.jdt.ui.prefs
@@ -0,0 +1,60 @@
+#Mon Oct 13 14:57:58 CDT 2008
+eclipse.preferences.version=1
+editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
+formatter_profile=_core
+formatter_settings_version=11
+org.eclipse.jdt.ui.ignorelowercasenames=true
+org.eclipse.jdt.ui.importorder=;
+org.eclipse.jdt.ui.ondemandthreshold=3
+org.eclipse.jdt.ui.staticondemandthreshold=99
+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/osgimonitoring/plugins/org.eclipse.pde.runtime/.settings/org.eclipse.pde.prefs b/osgimonitoring/plugins/org.eclipse.pde.runtime/.settings/org.eclipse.pde.prefs
new file mode 100644
index 0000000..113bccf
--- /dev/null
+++ b/osgimonitoring/plugins/org.eclipse.pde.runtime/.settings/org.eclipse.pde.prefs
@@ -0,0 +1,16 @@
+#Wed Jan 02 09:57:24 CST 2008
+compilers.incompatible-environment=1
+compilers.p.build=1
+compilers.p.deprecated=1
+compilers.p.missing-bundle-classpath-entries=0
+compilers.p.missing-packages=0
+compilers.p.no-required-att=0
+compilers.p.not-externalized-att=0
+compilers.p.unknown-attribute=1
+compilers.p.unknown-class=0
+compilers.p.unknown-element=1
+compilers.p.unknown-resource=0
+compilers.p.unresolved-ex-points=0
+compilers.p.unresolved-import=0
+compilers.use-project=true
+eclipse.preferences.version=1
diff --git a/osgimonitoring/plugins/org.eclipse.pde.runtime/META-INF/MANIFEST.MF b/osgimonitoring/plugins/org.eclipse.pde.runtime/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..af27b8d
--- /dev/null
+++ b/osgimonitoring/plugins/org.eclipse.pde.runtime/META-INF/MANIFEST.MF
@@ -0,0 +1,26 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %name
+Bundle-SymbolicName: org.eclipse.pde.runtime; singleton:=true
+Bundle-Version: 3.4.100.qualifier
+Bundle-Activator: org.eclipse.pde.internal.runtime.PDERuntimePlugin
+Bundle-Vendor: %provider-name
+Bundle-Localization: plugin
+Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.2.0,4.0.0)",
+ org.eclipse.ui;bundle-version="[3.3.0,4.0.0)",
+ org.eclipse.ui.forms;bundle-version="[3.3.0,4.0.0)",
+ org.eclipse.jdt.core;bundle-version="[3.3.0,4.0.0)";resolution:=optional,
+ org.eclipse.core.resources;bundle-version="[3.3.0,4.0.0)";resolution:=optional,
+ org.eclipse.jdt.ui;bundle-version="[3.3.0,4.0.0)";resolution:=optional,
+ org.eclipse.pde.ui;bundle-version="[3.3.0,4.0.0)";resolution:=optional,
+ org.eclipse.help;bundle-version="[3.3.0,4.0.0)";resolution:=optional
+Eclipse-LazyStart: true
+Export-Package: org.eclipse.pde.internal.runtime;x-internal:=true,
+ org.eclipse.pde.internal.runtime.registry;x-internal:=true,
+ org.eclipse.pde.internal.runtime.registry.model;x-internal:=true,
+ org.eclipse.pde.internal.runtime.spy;x-internal:=true,
+ org.eclipse.pde.internal.runtime.spy.dialogs;x-internal:=true,
+ org.eclipse.pde.internal.runtime.spy.handlers;x-internal:=true,
+ org.eclipse.pde.internal.runtime.spy.sections;x-internal:=true
+Bundle-RequiredExecutionEnvironment: J2SE-1.4
+Bundle-ActivationPolicy: lazy
diff --git a/osgimonitoring/plugins/org.eclipse.pde.runtime/about.html b/osgimonitoring/plugins/org.eclipse.pde.runtime/about.html
new file mode 100644
index 0000000..4602330
--- /dev/null
+++ b/osgimonitoring/plugins/org.eclipse.pde.runtime/about.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
+<title>About</title>
+</head>
+<body lang="EN-US">
+<h2>About This Content</h2>
+
+<p>June 2, 2006</p>
+<h3>License</h3>
+
+<p>The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise
+indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available
+at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+For purposes of the EPL, "Program" will mean the Content.</p>
+
+<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
+being redistributed by another party ("Redistributor") and different terms and conditions may
+apply to your use of any object code in the Content. Check the Redistributor's license that was
+provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
+indicated below, the terms and conditions of the EPL still apply to any source code in the Content
+and such source code may be obtained at <a href="http://www.eclipse.org">http://www.eclipse.org</a>.</p>
+
+</body>
+</html>
\ No newline at end of file
diff --git a/osgimonitoring/plugins/org.eclipse.pde.runtime/build.properties b/osgimonitoring/plugins/org.eclipse.pde.runtime/build.properties
new file mode 100644
index 0000000..add70b8
--- /dev/null
+++ b/osgimonitoring/plugins/org.eclipse.pde.runtime/build.properties
@@ -0,0 +1,19 @@
+###############################################################################
+# Copyright (c) 2000, 2007 IBM Corporation and others.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# IBM Corporation - initial API and implementation
+###############################################################################
+source.. = src/
+src.includes=about.html
+bin.includes = plugin.xml,\
+ plugin.properties,\
+ icons/,\
+ .,\
+ about.html,\
+ META-INF/
+
diff --git a/osgimonitoring/plugins/org.eclipse.pde.runtime/icons/dlcl16/refresh.gif b/osgimonitoring/plugins/org.eclipse.pde.runtime/icons/dlcl16/refresh.gif
new file mode 100644
index 0000000..6eafa48
--- /dev/null
+++ b/osgimonitoring/plugins/org.eclipse.pde.runtime/icons/dlcl16/refresh.gif
Binary files differ
diff --git a/osgimonitoring/plugins/org.eclipse.pde.runtime/icons/elcl16/collapseall.gif b/osgimonitoring/plugins/org.eclipse.pde.runtime/icons/elcl16/collapseall.gif
new file mode 100644
index 0000000..a2d80a9
--- /dev/null
+++ b/osgimonitoring/plugins/org.eclipse.pde.runtime/icons/elcl16/collapseall.gif
Binary files differ
diff --git a/osgimonitoring/plugins/org.eclipse.pde.runtime/icons/elcl16/cpyqual_menu.gif b/osgimonitoring/plugins/org.eclipse.pde.runtime/icons/elcl16/cpyqual_menu.gif
new file mode 100644
index 0000000..55e2d04
--- /dev/null
+++ b/osgimonitoring/plugins/org.eclipse.pde.runtime/icons/elcl16/cpyqual_menu.gif
Binary files differ
diff --git a/osgimonitoring/plugins/org.eclipse.pde.runtime/icons/elcl16/refresh.gif b/osgimonitoring/plugins/org.eclipse.pde.runtime/icons/elcl16/refresh.gif
new file mode 100644
index 0000000..e383147
--- /dev/null
+++ b/osgimonitoring/plugins/org.eclipse.pde.runtime/icons/elcl16/refresh.gif
Binary files differ
diff --git a/osgimonitoring/plugins/org.eclipse.pde.runtime/icons/eview16/horizontal_view.gif b/osgimonitoring/plugins/org.eclipse.pde.runtime/icons/eview16/horizontal_view.gif
new file mode 100644
index 0000000..86bfc48
--- /dev/null
+++ b/osgimonitoring/plugins/org.eclipse.pde.runtime/icons/eview16/horizontal_view.gif
Binary files differ
diff --git a/osgimonitoring/plugins/org.eclipse.pde.runtime/icons/eview16/registry.gif b/osgimonitoring/plugins/org.eclipse.pde.runtime/icons/eview16/registry.gif
new file mode 100644
index 0000000..c2d6375
--- /dev/null
+++ b/osgimonitoring/plugins/org.eclipse.pde.runtime/icons/eview16/registry.gif
Binary files differ
diff --git a/osgimonitoring/plugins/org.eclipse.pde.runtime/icons/eview16/vertical_view.gif b/osgimonitoring/plugins/org.eclipse.pde.runtime/icons/eview16/vertical_view.gif
new file mode 100644
index 0000000..493c2fb
--- /dev/null
+++ b/osgimonitoring/plugins/org.eclipse.pde.runtime/icons/eview16/vertical_view.gif
Binary files differ
diff --git a/osgimonitoring/plugins/org.eclipse.pde.runtime/icons/obj16/attr_xml_obj.gif b/osgimonitoring/plugins/org.eclipse.pde.runtime/icons/obj16/attr_xml_obj.gif
new file mode 100644
index 0000000..c4ad57c
--- /dev/null
+++ b/osgimonitoring/plugins/org.eclipse.pde.runtime/icons/obj16/attr_xml_obj.gif
Binary files differ
diff --git a/osgimonitoring/plugins/org.eclipse.pde.runtime/icons/obj16/bundle-exporter.gif b/osgimonitoring/plugins/org.eclipse.pde.runtime/icons/obj16/bundle-exporter.gif
new file mode 100644
index 0000000..f22da64
--- /dev/null
+++ b/osgimonitoring/plugins/org.eclipse.pde.runtime/icons/obj16/bundle-exporter.gif
Binary files differ
diff --git a/osgimonitoring/plugins/org.eclipse.pde.runtime/icons/obj16/bundle-importer-exporter.gif b/osgimonitoring/plugins/org.eclipse.pde.runtime/icons/obj16/bundle-importer-exporter.gif
new file mode 100644
index 0000000..e3c26cd
--- /dev/null
+++ b/osgimonitoring/plugins/org.eclipse.pde.runtime/icons/obj16/bundle-importer-exporter.gif
Binary files differ
diff --git a/osgimonitoring/plugins/org.eclipse.pde.runtime/icons/obj16/bundle-importer.gif b/osgimonitoring/plugins/org.eclipse.pde.runtime/icons/obj16/bundle-importer.gif
new file mode 100644
index 0000000..fab1e4a
--- /dev/null
+++ b/osgimonitoring/plugins/org.eclipse.pde.runtime/icons/obj16/bundle-importer.gif
Binary files differ
diff --git a/osgimonitoring/plugins/org.eclipse.pde.runtime/icons/obj16/class_obj.gif b/osgimonitoring/plugins/org.eclipse.pde.runtime/icons/obj16/class_obj.gif
new file mode 100644
index 0000000..e4c2a83
--- /dev/null
+++ b/osgimonitoring/plugins/org.eclipse.pde.runtime/icons/obj16/class_obj.gif
Binary files differ
diff --git a/osgimonitoring/plugins/org.eclipse.pde.runtime/icons/obj16/contextid_obj.gif b/osgimonitoring/plugins/org.eclipse.pde.runtime/icons/obj16/contextid_obj.gif
new file mode 100644
index 0000000..b616e85
--- /dev/null
+++ b/osgimonitoring/plugins/org.eclipse.pde.runtime/icons/obj16/contextid_obj.gif
Binary files differ
diff --git a/osgimonitoring/plugins/org.eclipse.pde.runtime/icons/obj16/error_st_obj.gif b/osgimonitoring/plugins/org.eclipse.pde.runtime/icons/obj16/error_st_obj.gif
new file mode 100644
index 0000000..0bc6068
--- /dev/null
+++ b/osgimonitoring/plugins/org.eclipse.pde.runtime/icons/obj16/error_st_obj.gif
Binary files differ
diff --git a/osgimonitoring/plugins/org.eclipse.pde.runtime/icons/obj16/error_stack.gif b/osgimonitoring/plugins/org.eclipse.pde.runtime/icons/obj16/error_stack.gif
new file mode 100644
index 0000000..e61fc24
--- /dev/null
+++ b/osgimonitoring/plugins/org.eclipse.pde.runtime/icons/obj16/error_stack.gif
Binary files differ
diff --git a/osgimonitoring/plugins/org.eclipse.pde.runtime/icons/obj16/ext_point_obj.gif b/osgimonitoring/plugins/org.eclipse.pde.runtime/icons/obj16/ext_point_obj.gif
new file mode 100644
index 0000000..17f771a
--- /dev/null
+++ b/osgimonitoring/plugins/org.eclipse.pde.runtime/icons/obj16/ext_point_obj.gif
Binary files differ
diff --git a/osgimonitoring/plugins/org.eclipse.pde.runtime/icons/obj16/ext_points_obj.gif b/osgimonitoring/plugins/org.eclipse.pde.runtime/icons/obj16/ext_points_obj.gif
new file mode 100644
index 0000000..52f4e5e
--- /dev/null
+++ b/osgimonitoring/plugins/org.eclipse.pde.runtime/icons/obj16/ext_points_obj.gif
Binary files differ
diff --git a/osgimonitoring/plugins/org.eclipse.pde.runtime/icons/obj16/extension_obj.gif b/osgimonitoring/plugins/org.eclipse.pde.runtime/icons/obj16/extension_obj.gif
new file mode 100644
index 0000000..7f3f595
--- /dev/null
+++ b/osgimonitoring/plugins/org.eclipse.pde.runtime/icons/obj16/extension_obj.gif
Binary files differ
diff --git a/osgimonitoring/plugins/org.eclipse.pde.runtime/icons/obj16/extensions_obj.gif b/osgimonitoring/plugins/org.eclipse.pde.runtime/icons/obj16/extensions_obj.gif
new file mode 100644
index 0000000..e8abf43
--- /dev/null
+++ b/osgimonitoring/plugins/org.eclipse.pde.runtime/icons/obj16/extensions_obj.gif
Binary files differ
diff --git a/osgimonitoring/plugins/org.eclipse.pde.runtime/icons/obj16/frgmt_obj.gif b/osgimonitoring/plugins/org.eclipse.pde.runtime/icons/obj16/frgmt_obj.gif
new file mode 100644
index 0000000..d55b09f
--- /dev/null
+++ b/osgimonitoring/plugins/org.eclipse.pde.runtime/icons/obj16/frgmt_obj.gif
Binary files differ
diff --git a/osgimonitoring/plugins/org.eclipse.pde.runtime/icons/obj16/generic_xml_obj.gif b/osgimonitoring/plugins/org.eclipse.pde.runtime/icons/obj16/generic_xml_obj.gif
new file mode 100644
index 0000000..4083e21
--- /dev/null
+++ b/osgimonitoring/plugins/org.eclipse.pde.runtime/icons/obj16/generic_xml_obj.gif
Binary files differ
diff --git a/osgimonitoring/plugins/org.eclipse.pde.runtime/icons/obj16/info_st_obj.gif b/osgimonitoring/plugins/org.eclipse.pde.runtime/icons/obj16/info_st_obj.gif
new file mode 100644
index 0000000..2da001e
--- /dev/null
+++ b/osgimonitoring/plugins/org.eclipse.pde.runtime/icons/obj16/info_st_obj.gif
Binary files differ
diff --git a/osgimonitoring/plugins/org.eclipse.pde.runtime/icons/obj16/int_obj.gif b/osgimonitoring/plugins/org.eclipse.pde.runtime/icons/obj16/int_obj.gif
new file mode 100644
index 0000000..2ebc46e
--- /dev/null
+++ b/osgimonitoring/plugins/org.eclipse.pde.runtime/icons/obj16/int_obj.gif
Binary files differ
diff --git a/osgimonitoring/plugins/org.eclipse.pde.runtime/icons/obj16/java_lib_obj.gif b/osgimonitoring/plugins/org.eclipse.pde.runtime/icons/obj16/java_lib_obj.gif
new file mode 100644
index 0000000..cb55e33
--- /dev/null
+++ b/osgimonitoring/plugins/org.eclipse.pde.runtime/icons/obj16/java_lib_obj.gif
Binary files differ
diff --git a/osgimonitoring/plugins/org.eclipse.pde.runtime/icons/obj16/location_obj.gif b/osgimonitoring/plugins/org.eclipse.pde.runtime/icons/obj16/location_obj.gif
new file mode 100644
index 0000000..c43c5d5
--- /dev/null
+++ b/osgimonitoring/plugins/org.eclipse.pde.runtime/icons/obj16/location_obj.gif
Binary files differ
diff --git a/osgimonitoring/plugins/org.eclipse.pde.runtime/icons/obj16/menu_obj.gif b/osgimonitoring/plugins/org.eclipse.pde.runtime/icons/obj16/menu_obj.gif
new file mode 100644
index 0000000..9235de5
--- /dev/null
+++ b/osgimonitoring/plugins/org.eclipse.pde.runtime/icons/obj16/menu_obj.gif
Binary files differ
diff --git a/osgimonitoring/plugins/org.eclipse.pde.runtime/icons/obj16/menuspy_obj.gif b/osgimonitoring/plugins/org.eclipse.pde.runtime/icons/obj16/menuspy_obj.gif
new file mode 100644
index 0000000..4c8d71c
--- /dev/null
+++ b/osgimonitoring/plugins/org.eclipse.pde.runtime/icons/obj16/menuspy_obj.gif
Binary files differ
diff --git a/osgimonitoring/plugins/org.eclipse.pde.runtime/icons/obj16/ok_st_obj.gif b/osgimonitoring/plugins/org.eclipse.pde.runtime/icons/obj16/ok_st_obj.gif
new file mode 100644
index 0000000..9cacb96
--- /dev/null
+++ b/osgimonitoring/plugins/org.eclipse.pde.runtime/icons/obj16/ok_st_obj.gif
Binary files differ
diff --git a/osgimonitoring/plugins/org.eclipse.pde.runtime/icons/obj16/package_obj.gif b/osgimonitoring/plugins/org.eclipse.pde.runtime/icons/obj16/package_obj.gif
new file mode 100644
index 0000000..131c28d
--- /dev/null
+++ b/osgimonitoring/plugins/org.eclipse.pde.runtime/icons/obj16/package_obj.gif
Binary files differ
diff --git a/osgimonitoring/plugins/org.eclipse.pde.runtime/icons/obj16/pdespy_obj.gif b/osgimonitoring/plugins/org.eclipse.pde.runtime/icons/obj16/pdespy_obj.gif
new file mode 100644
index 0000000..148f4d5
--- /dev/null
+++ b/osgimonitoring/plugins/org.eclipse.pde.runtime/icons/obj16/pdespy_obj.gif
Binary files differ
diff --git a/osgimonitoring/plugins/org.eclipse.pde.runtime/icons/obj16/plugin_obj.gif b/osgimonitoring/plugins/org.eclipse.pde.runtime/icons/obj16/plugin_obj.gif
new file mode 100644
index 0000000..8493df4
--- /dev/null
+++ b/osgimonitoring/plugins/org.eclipse.pde.runtime/icons/obj16/plugin_obj.gif
Binary files differ
diff --git a/osgimonitoring/plugins/org.eclipse.pde.runtime/icons/obj16/plugins_obj.gif b/osgimonitoring/plugins/org.eclipse.pde.runtime/icons/obj16/plugins_obj.gif
new file mode 100644
index 0000000..0fa090a
--- /dev/null
+++ b/osgimonitoring/plugins/org.eclipse.pde.runtime/icons/obj16/plugins_obj.gif
Binary files differ
diff --git a/osgimonitoring/plugins/org.eclipse.pde.runtime/icons/obj16/property_obj.gif b/osgimonitoring/plugins/org.eclipse.pde.runtime/icons/obj16/property_obj.gif
new file mode 100644
index 0000000..f8277cf
--- /dev/null
+++ b/osgimonitoring/plugins/org.eclipse.pde.runtime/icons/obj16/property_obj.gif
Binary files differ
diff --git a/osgimonitoring/plugins/org.eclipse.pde.runtime/icons/obj16/req_plugin_obj.gif b/osgimonitoring/plugins/org.eclipse.pde.runtime/icons/obj16/req_plugin_obj.gif
new file mode 100644
index 0000000..c54f2b3
--- /dev/null
+++ b/osgimonitoring/plugins/org.eclipse.pde.runtime/icons/obj16/req_plugin_obj.gif
Binary files differ
diff --git a/osgimonitoring/plugins/org.eclipse.pde.runtime/icons/obj16/req_plugins_obj.gif b/osgimonitoring/plugins/org.eclipse.pde.runtime/icons/obj16/req_plugins_obj.gif
new file mode 100644
index 0000000..7f135be
--- /dev/null
+++ b/osgimonitoring/plugins/org.eclipse.pde.runtime/icons/obj16/req_plugins_obj.gif
Binary files differ
diff --git a/osgimonitoring/plugins/org.eclipse.pde.runtime/icons/obj16/runtime_obj.gif b/osgimonitoring/plugins/org.eclipse.pde.runtime/icons/obj16/runtime_obj.gif
new file mode 100644
index 0000000..f159bcd
--- /dev/null
+++ b/osgimonitoring/plugins/org.eclipse.pde.runtime/icons/obj16/runtime_obj.gif
Binary files differ
diff --git a/osgimonitoring/plugins/org.eclipse.pde.runtime/icons/obj16/save_image_as_obj.gif b/osgimonitoring/plugins/org.eclipse.pde.runtime/icons/obj16/save_image_as_obj.gif
new file mode 100644
index 0000000..bafc136
--- /dev/null
+++ b/osgimonitoring/plugins/org.eclipse.pde.runtime/icons/obj16/save_image_as_obj.gif
Binary files differ
diff --git a/osgimonitoring/plugins/org.eclipse.pde.runtime/icons/obj16/warning_st_obj.gif b/osgimonitoring/plugins/org.eclipse.pde.runtime/icons/obj16/warning_st_obj.gif
new file mode 100644
index 0000000..2b2e50f
--- /dev/null
+++ b/osgimonitoring/plugins/org.eclipse.pde.runtime/icons/obj16/warning_st_obj.gif
Binary files differ
diff --git a/osgimonitoring/plugins/org.eclipse.pde.runtime/icons/ovr16/default_co.gif b/osgimonitoring/plugins/org.eclipse.pde.runtime/icons/ovr16/default_co.gif
new file mode 100644
index 0000000..8533e2e
--- /dev/null
+++ b/osgimonitoring/plugins/org.eclipse.pde.runtime/icons/ovr16/default_co.gif
Binary files differ
diff --git a/osgimonitoring/plugins/org.eclipse.pde.runtime/icons/ovr16/error_co.gif b/osgimonitoring/plugins/org.eclipse.pde.runtime/icons/ovr16/error_co.gif
new file mode 100644
index 0000000..119dccc
--- /dev/null
+++ b/osgimonitoring/plugins/org.eclipse.pde.runtime/icons/ovr16/error_co.gif
Binary files differ
diff --git a/osgimonitoring/plugins/org.eclipse.pde.runtime/icons/ovr16/export_co.gif b/osgimonitoring/plugins/org.eclipse.pde.runtime/icons/ovr16/export_co.gif
new file mode 100644
index 0000000..b18233d
--- /dev/null
+++ b/osgimonitoring/plugins/org.eclipse.pde.runtime/icons/ovr16/export_co.gif
Binary files differ
diff --git a/osgimonitoring/plugins/org.eclipse.pde.runtime/icons/ovr16/run_co.gif b/osgimonitoring/plugins/org.eclipse.pde.runtime/icons/ovr16/run_co.gif
new file mode 100644
index 0000000..13077f9
--- /dev/null
+++ b/osgimonitoring/plugins/org.eclipse.pde.runtime/icons/ovr16/run_co.gif
Binary files differ
diff --git a/osgimonitoring/plugins/org.eclipse.pde.runtime/plugin.properties b/osgimonitoring/plugins/org.eclipse.pde.runtime/plugin.properties
new file mode 100644
index 0000000..881738d
--- /dev/null
+++ b/osgimonitoring/plugins/org.eclipse.pde.runtime/plugin.properties
@@ -0,0 +1,22 @@
+###############################################################################
+# Copyright (c) 2000, 2009 IBM Corporation and others.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# IBM Corporation - initial API and implementation
+###############################################################################
+#
+# plugin.xml properties
+#
+
+name = PDE Runtime
+provider-name = Eclipse.org
+
+views.registry.name= Plug-in Registry
+
+spy-category.name = Spy
+spy-command.name = Plug-in Spy
+spy-command.description = Show the Plug-in Spy
diff --git a/osgimonitoring/plugins/org.eclipse.pde.runtime/plugin.xml b/osgimonitoring/plugins/org.eclipse.pde.runtime/plugin.xml
new file mode 100644
index 0000000..c08ee22
--- /dev/null
+++ b/osgimonitoring/plugins/org.eclipse.pde.runtime/plugin.xml
@@ -0,0 +1,98 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.0"?>
<!--
+ Copyright (c) 2005, 2009 IBM Corporation and others.
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+ IBM Corporation - initial API and implementation
+ -->
+
+<plugin>
+
+<!-- Extensions -->
+ <extension
+ point="org.eclipse.ui.views">
+ <view
+ name="%views.registry.name"
+ icon="$nl$/icons/eview16/registry.gif"
+ category="org.eclipse.pde.ui"
+ class="org.eclipse.pde.internal.runtime.registry.RegistryBrowser"
+ id="org.eclipse.pde.runtime.RegistryBrowser">
+ </view>
+ </extension>
+ <extension
+ point="org.eclipse.ui.commands">
+ <category
+ id="org.eclipse.pde.runtime.spy.commands.category"
+ name="%spy-category.name">
+ </category>
+ <command
+ categoryId="org.eclipse.pde.runtime.spy.commands.category"
+ description="%spy-command.description"
+ id="org.eclipse.pde.runtime.spy.commands.spyCommand"
+ name="%spy-command.name">
+ </command>
+ <command
+ categoryId="org.eclipse.pde.runtime.spy.commands.category"
+ description="%spy-command.description"
+ id="org.eclipse.pde.runtime.spy.commands.menuSpyCommand"
+ name="%spy-command.name">
+ </command>
+ </extension>
+ <extension
+ point="org.eclipse.ui.commandImages">
+ <image
+ commandId="org.eclipse.pde.runtime.spy.commands.spyCommand"
+ icon="$nl$/icons/obj16/pdespy_obj.gif">
+ </image>
+ <image
+ commandId="org.eclipse.pde.runtime.spy.commands.menuSpyCommand"
+ icon="$nl$/icons/obj16/menuspy_obj.gif">
+ </image>
+ </extension>
+ <extension
+ point="org.eclipse.ui.bindings">
+ <key
+ commandId="org.eclipse.pde.runtime.spy.commands.spyCommand"
+ contextId="org.eclipse.ui.contexts.dialogAndWindow"
+ schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
+ sequence="M3+M2+F1">
+ </key>
+ <key
+ contextId="org.eclipse.ui.contexts.dialogAndWindow"
+ locale="ja"
+ platform="carbon"
+ schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
+ sequence="M3+M2+F1">
+ </key>
+ <key
+ commandId="org.eclipse.pde.runtime.spy.commands.spyCommand"
+ contextId="org.eclipse.ui.contexts.dialogAndWindow"
+ locale="ja"
+ platform="carbon"
+ schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
+ sequence="M1+M3+F1">
+ </key>
+ <key
+ commandId="org.eclipse.pde.runtime.spy.commands.menuSpyCommand"
+ contextId="org.eclipse.ui.contexts.dialogAndWindow"
+ schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
+ sequence="M3+M2+F2">
+ </key>
+ </extension>
+ <extension
+ point="org.eclipse.ui.handlers">
+ <handler
+ class="org.eclipse.pde.internal.runtime.spy.handlers.SpyHandler"
+ commandId="org.eclipse.pde.runtime.spy.commands.spyCommand">
+ </handler>
+ <handler
+ class="org.eclipse.pde.internal.runtime.spy.handlers.MenuSpyHandler"
+ commandId="org.eclipse.pde.runtime.spy.commands.menuSpyCommand">
+ </handler>
+ </extension>
+
+</plugin>
diff --git a/osgimonitoring/plugins/org.eclipse.pde.runtime/src/org/eclipse/pde/internal/runtime/IHelpContextIds.java b/osgimonitoring/plugins/org.eclipse.pde.runtime/src/org/eclipse/pde/internal/runtime/IHelpContextIds.java
new file mode 100644
index 0000000..bdbdb9d
--- /dev/null
+++ b/osgimonitoring/plugins/org.eclipse.pde.runtime/src/org/eclipse/pde/internal/runtime/IHelpContextIds.java
@@ -0,0 +1,19 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2008 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.pde.internal.runtime;
+
+public interface IHelpContextIds {
+ public static final String PREFIX = "org.eclipse.pde.doc.user" + "."; //$NON-NLS-1$ //$NON-NLS-2$
+
+ public static final String REGISTRY_VIEW = PREFIX + "registry_view"; //$NON-NLS-1$
+ public static final String SPY_DIALOG = PREFIX + "spy_dialog"; //$NON-NLS-1$
+
+}
diff --git a/osgimonitoring/plugins/org.eclipse.pde.runtime/src/org/eclipse/pde/internal/runtime/MessageHelper.java b/osgimonitoring/plugins/org.eclipse.pde.runtime/src/org/eclipse/pde/internal/runtime/MessageHelper.java
new file mode 100644
index 0000000..19e5fca
--- /dev/null
+++ b/osgimonitoring/plugins/org.eclipse.pde.runtime/src/org/eclipse/pde/internal/runtime/MessageHelper.java
@@ -0,0 +1,39 @@
+/*******************************************************************************
+ * Copyright (c) 2007 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.pde.internal.runtime;
+
+import org.eclipse.osgi.service.resolver.BundleSpecification;
+import org.eclipse.osgi.service.resolver.ImportPackageSpecification;
+import org.eclipse.osgi.service.resolver.VersionConstraint;
+import org.eclipse.osgi.util.NLS;
+
+public class MessageHelper {
+ public static String getResolutionFailureMessage(VersionConstraint unsatisfied) {
+ if (unsatisfied.isResolved())
+ throw new IllegalArgumentException();
+ if (unsatisfied instanceof ImportPackageSpecification)
+ return NLS.bind(PDERuntimeMessages.MessageHelper_missing_imported_package, toString(unsatisfied));
+ else if (unsatisfied instanceof BundleSpecification) {
+ if (((BundleSpecification) unsatisfied).isOptional())
+ return NLS.bind(PDERuntimeMessages.MessageHelper_missing_optional_required_bundle, toString(unsatisfied));
+ return NLS.bind(PDERuntimeMessages.MessageHelper_missing_required_bundle, toString(unsatisfied));
+ } else
+ return NLS.bind(PDERuntimeMessages.MessageHelper_missing_host, toString(unsatisfied));
+ }
+
+ private static String toString(VersionConstraint constraint) {
+ org.eclipse.osgi.service.resolver.VersionRange versionRange = constraint.getVersionRange();
+ if (versionRange == null)
+ return constraint.getName();
+ return constraint.getName() + '_' + versionRange;
+ }
+
+}
diff --git a/osgimonitoring/plugins/org.eclipse.pde.runtime/src/org/eclipse/pde/internal/runtime/OverlayIcon.java b/osgimonitoring/plugins/org.eclipse.pde.runtime/src/org/eclipse/pde/internal/runtime/OverlayIcon.java
new file mode 100644
index 0000000..141aa21
--- /dev/null
+++ b/osgimonitoring/plugins/org.eclipse.pde.runtime/src/org/eclipse/pde/internal/runtime/OverlayIcon.java
@@ -0,0 +1,122 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2008 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.pde.internal.runtime;
+
+import org.eclipse.jface.resource.CompositeImageDescriptor;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.swt.graphics.ImageData;
+import org.eclipse.swt.graphics.Point;
+
+public class OverlayIcon extends CompositeImageDescriptor {
+
+ static final int DEFAULT_WIDTH = 16;
+ static final int DEFAULT_HEIGHT = 16;
+
+ private Point fSize = null;
+
+ private ImageDescriptor fBase;
+ private ImageDescriptor fOverlays[][];
+
+ public OverlayIcon(ImageDescriptor base, ImageDescriptor[][] overlays) {
+ fBase = base;
+ if (fBase == null)
+ fBase = ImageDescriptor.getMissingImageDescriptor();
+ fOverlays = overlays;
+ fSize = new Point(DEFAULT_WIDTH, DEFAULT_HEIGHT);
+ }
+
+ public OverlayIcon(ImageDescriptor base, ImageDescriptor[][] overlays, Point size) {
+ fBase = base;
+ if (fBase == null)
+ fBase = ImageDescriptor.getMissingImageDescriptor();
+ fOverlays = overlays;
+ fSize = size;
+ }
+
+ protected void drawBottomLeft(ImageDescriptor[] overlays) {
+ if (overlays == null)
+ return;
+ int length = overlays.length;
+ int x = 0;
+ for (int i = 0; i < 3; i++) {
+ if (i < length && overlays[i] != null) {
+ ImageData id = overlays[i].getImageData();
+ drawImage(id, x, getSize().y - id.height);
+ x += id.width;
+ }
+ }
+ }
+
+ protected void drawBottomRight(ImageDescriptor[] overlays) {
+ if (overlays == null)
+ return;
+ int length = overlays.length;
+ int x = getSize().x;
+ for (int i = 2; i >= 0; i--) {
+ if (i < length && overlays[i] != null) {
+ ImageData id = overlays[i].getImageData();
+ x -= id.width;
+ drawImage(id, x, getSize().y - id.height);
+ }
+ }
+ }
+
+ protected void drawCompositeImage(int width, int height) {
+ ImageData bg = fBase.getImageData();
+ drawImage(bg, 0, 0);
+
+ if (fOverlays != null) {
+ if (fOverlays.length > 0)
+ drawTopRight(fOverlays[0]);
+
+ if (fOverlays.length > 1)
+ drawBottomRight(fOverlays[1]);
+
+ if (fOverlays.length > 2)
+ drawBottomLeft(fOverlays[2]);
+
+ if (fOverlays.length > 3)
+ drawTopLeft(fOverlays[3]);
+ }
+ }
+
+ protected void drawTopLeft(ImageDescriptor[] overlays) {
+ if (overlays == null)
+ return;
+ int length = overlays.length;
+ int x = 0;
+ for (int i = 0; i < 3; i++) {
+ if (i < length && overlays[i] != null) {
+ ImageData id = overlays[i].getImageData();
+ drawImage(id, x, 0);
+ x += id.width;
+ }
+ }
+ }
+
+ protected void drawTopRight(ImageDescriptor[] overlays) {
+ if (overlays == null)
+ return;
+ int length = overlays.length;
+ int x = getSize().x;
+ for (int i = 2; i >= 0; i--) {
+ if (i < length && overlays[i] != null) {
+ ImageData id = overlays[i].getImageData();
+ x -= id.width;
+ drawImage(id, x, 0);
+ }
+ }
+ }
+
+ protected Point getSize() {
+ return fSize;
+ }
+}
diff --git a/osgimonitoring/plugins/org.eclipse.pde.runtime/src/org/eclipse/pde/internal/runtime/PDERuntimeMessages.java b/osgimonitoring/plugins/org.eclipse.pde.runtime/src/org/eclipse/pde/internal/runtime/PDERuntimeMessages.java
new file mode 100644
index 0000000..25d69b8
--- /dev/null
+++ b/osgimonitoring/plugins/org.eclipse.pde.runtime/src/org/eclipse/pde/internal/runtime/PDERuntimeMessages.java
@@ -0,0 +1,124 @@
+/*******************************************************************************
+ * Copyright (c) 2005, 2009 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM - Initial API and implementation
+ *******************************************************************************/
+package org.eclipse.pde.internal.runtime;
+
+import org.eclipse.osgi.util.NLS;
+
+public class PDERuntimeMessages extends NLS {
+ private static final String BUNDLE_NAME = "org.eclipse.pde.internal.runtime.pderuntimeresources";//$NON-NLS-1$
+
+ public static String ActiveFormEditorSection_Active_Form_Page;
+
+ public static String ActiveMenuSection_0;
+ public static String ActiveMenuSection_1;
+ public static String ActiveMenuSection_2;
+ public static String ActiveMenuSection_3;
+ public static String ActiveMenuSection_4;
+ public static String ActiveMenuSection_5;
+ public static String ActiveMenuSection_6;
+ public static String ActiveMenuSection_7;
+
+ public static String RegistryView_refresh_label;
+ public static String RegistryView_refresh_tooltip;
+ public static String RegistryView_collapseAll_label;
+ public static String RegistryView_collapseAll_tooltip;
+ public static String RegistryView_folders_imports;
+ public static String RegistryView_folders_libraries;
+ public static String RegistryView_folders_extensionPoints;
+ public static String RegistryView_folders_extensions;
+
+ public static String RegistryView_found_problems;
+ public static String RegistryView_showRunning_label;
+ public static String RegistryView_showDisabled_label;
+ public static String RegistryView_showAdvanced_label;
+ public static String RegistryView_titleSummary;
+ public static String RegistryView_startAction_label;
+ public static String RegistryView_stopAction_label;
+ public static String RegistryView_enableAction_label;
+ public static String RegistryView_diag_dialog_title;
+
+ public static String RegistryView_diagnoseAction_label;
+ public static String RegistryView_disableAction_label;
+ public static String RegistryView_no_unresolved_constraints;
+
+ public static String MessageHelper_missing_optional_required_bundle;
+ public static String MessageHelper_missing_required_bundle;
+ public static String MessageHelper_missing_imported_package;
+ public static String MessageHelper_missing_host;
+
+ public static String SpyDialog_title;
+ public static String SpyDialog_close;
+ public static String SpyDialog_activeShell_title;
+ public static String SpyDialog_activeShell_desc;
+ public static String SpyDialog_activePart_title;
+ public static String SpyDialog_activePart_desc;
+ public static String SpyDialog_activeWizard_title;
+ public static String SpyDialog_activeWizard_desc;
+ public static String SpyDialog_activeMenuIds;
+ public static String SpyDialog_contributingPluginId_title;
+ public static String SpyDialog_contributingPluginId_desc;
+ public static String SpyDialog_activeSelection_title;
+ public static String SpyDialog_activeSelection_desc;
+ public static String SpyDialog_activeSelectionInterfaces_desc;
+ public static String SpyDialog_activeSelectedElementsCount_desc;
+ public static String SpyDialog_activeSelectedElement_desc;
+ public static String SpyDialog_activeSelectedElementInterfaces_desc;
+ public static String SpyDialog_activeDialogPageSection_title;
+ public static String SpyDialog_activeDialogPageSection_title2;
+ public static String SpyDialog_activeDialogPageSection_desc;
+ public static String SpyDialog_activeHelpSection_title;
+ public static String SpyDialog_activeHelpSection_desc;
+ public static String SpyIDEUtil_noSourceFound_title;
+ public static String SpyIDEUtil_noSourceFound_message;
+ public static String SpyDialog_activePageBook_title;
+
+ public static String SpyFormToolkit_saveImageAs_title;
+ public static String SpyFormToolkit_copyQualifiedName;
+
+ public static String RegistryBrowser_Bundle;
+
+ public static String RegistryBrowser_copy_label;
+
+ public static String RegistryBrowser_ExtensionPoint;
+
+ public static String RegistryBrowser_extensionPoints;
+
+ public static String RegistryBrowser_GroupBy;
+
+ public static String RegistryBrowser_InitializingView;
+ public static String RegistryBrowser_plugins;
+
+ public static String RegistryBrowser_Service;
+
+ public static String RegistryBrowser_Services;
+
+ public static String RegistryBrowserLabelProvider_contributedBy;
+
+ public static String RegistryBrowserLabelProvider_ExportedPackages;
+
+ public static String RegistryBrowserLabelProvider_Fragments;
+
+ public static String RegistryBrowserLabelProvider_ImportedPackages;
+
+ public static String RegistryBrowserLabelProvider_Properties;
+
+ public static String RegistryBrowserLabelProvider_RegisteredBy;
+ public static String RegistryBrowserLabelProvider_usedServices;
+ public static String RegistryBrowserLabelProvider_registeredServices;
+
+ public static String RegistryBrowserLabelProvider_UsingBundles;
+
+ static {
+ // load message values from bundle file
+ NLS.initializeMessages(BUNDLE_NAME, PDERuntimeMessages.class);
+ }
+
+}
diff --git a/osgimonitoring/plugins/org.eclipse.pde.runtime/src/org/eclipse/pde/internal/runtime/PDERuntimePlugin.java b/osgimonitoring/plugins/org.eclipse.pde.runtime/src/org/eclipse/pde/internal/runtime/PDERuntimePlugin.java
new file mode 100644
index 0000000..d3d1abd
--- /dev/null
+++ b/osgimonitoring/plugins/org.eclipse.pde.runtime/src/org/eclipse/pde/internal/runtime/PDERuntimePlugin.java
@@ -0,0 +1,147 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2008 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.pde.internal.runtime;
+
+import java.lang.reflect.InvocationTargetException;
+import org.eclipse.core.runtime.*;
+import org.eclipse.osgi.service.resolver.PlatformAdmin;
+import org.eclipse.osgi.service.resolver.State;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.service.packageadmin.PackageAdmin;
+import org.osgi.util.tracker.ServiceTracker;
+
+public class PDERuntimePlugin extends AbstractUIPlugin {
+
+ public static final String ID = "org.eclipse.pde.runtime"; //$NON-NLS-1$
+
+ private static PDERuntimePlugin inst;
+ private BundleContext fContext;
+ private ServiceTracker packageAdminTracker;
+ private ServiceTracker platformAdminTracker;
+
+ public PDERuntimePlugin() {
+ inst = this;
+ }
+
+ private static boolean isBundleAvailable(String bundleID) {
+ Bundle bundle = Platform.getBundle(bundleID);
+ return bundle != null && (bundle.getState() & (Bundle.ACTIVE | Bundle.STARTING | Bundle.RESOLVED)) != 0;
+ }
+
+ public static final boolean HAS_IDE_BUNDLES;
+ static {
+ boolean result = false;
+ try {
+ result = isBundleAvailable("org.eclipse.core.resources") //$NON-NLS-1$
+ && isBundleAvailable("org.eclipse.pde.core") //$NON-NLS-1$
+ && isBundleAvailable("org.eclipse.jdt.core") //$NON-NLS-1$
+ && isBundleAvailable("org.eclipse.help") //$NON-NLS-1$
+ && isBundleAvailable("org.eclipse.pde.ui") //$NON-NLS-1$
+ && isBundleAvailable("org.eclipse.jdt.ui"); //$NON-NLS-1$
+ } catch (Throwable exception) { // do nothing
+ }
+ HAS_IDE_BUNDLES = result;
+ }
+
+ public static IWorkbenchPage getActivePage() {
+ return getDefault().internalGetActivePage();
+ }
+
+ public static Shell getActiveWorkbenchShell() {
+ return getActiveWorkbenchWindow().getShell();
+ }
+
+ public static IWorkbenchWindow getActiveWorkbenchWindow() {
+ return getDefault().getWorkbench().getActiveWorkbenchWindow();
+ }
+
+ public PackageAdmin getPackageAdmin() {
+ if (packageAdminTracker == null) {
+ return null;
+ }
+ return (PackageAdmin) packageAdminTracker.getService();
+ }
+
+ public PlatformAdmin getPlatformAdmin() {
+ if (platformAdminTracker == null) {
+ return null;
+ }
+ return (PlatformAdmin) platformAdminTracker.getService();
+ }
+
+ public static PDERuntimePlugin getDefault() {
+ return inst;
+ }
+
+ public static String getPluginId() {
+ return getDefault().getBundle().getSymbolicName();
+ }
+
+ private IWorkbenchPage internalGetActivePage() {
+ return getWorkbench().getActiveWorkbenchWindow().getActivePage();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.runtime.Plugin#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ this.fContext = context;
+
+ packageAdminTracker = new ServiceTracker(context, PackageAdmin.class.getName(), null);
+ packageAdminTracker.open();
+
+ platformAdminTracker = new ServiceTracker(context, PlatformAdmin.class.getName(), null);
+ platformAdminTracker.open();
+ }
+
+ public BundleContext getBundleContext() {
+ return this.fContext;
+ }
+
+ public State getState() {
+ return getPlatformAdmin().getState(false);
+ }
+
+ public static void log(Throwable e) {
+ if (e instanceof InvocationTargetException)
+ e = ((InvocationTargetException) e).getTargetException();
+ IStatus status = null;
+ if (e instanceof CoreException) {
+ status = ((CoreException) e).getStatus();
+ } else if (e.getMessage() != null) {
+ status = new Status(IStatus.ERROR, ID, IStatus.OK, e.getMessage(), e);
+ }
+ if (status != null)
+ getDefault().getLog().log(status);
+ }
+
+ /**
+ * This method is called when the plug-in is stopped
+ */
+ public void stop(BundleContext context) throws Exception {
+ super.stop(context);
+ if (packageAdminTracker != null) {
+ packageAdminTracker.close();
+ packageAdminTracker = null;
+ }
+ if (platformAdminTracker != null) {
+ platformAdminTracker.close();
+ platformAdminTracker = null;
+ }
+ }
+
+}
diff --git a/osgimonitoring/plugins/org.eclipse.pde.runtime/src/org/eclipse/pde/internal/runtime/PDERuntimePluginImages.java b/osgimonitoring/plugins/org.eclipse.pde.runtime/src/org/eclipse/pde/internal/runtime/PDERuntimePluginImages.java
new file mode 100644
index 0000000..62812c3
--- /dev/null
+++ b/osgimonitoring/plugins/org.eclipse.pde.runtime/src/org/eclipse/pde/internal/runtime/PDERuntimePluginImages.java
@@ -0,0 +1,126 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2009 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.pde.internal.runtime;
+
+import java.net.URL;
+import org.eclipse.core.runtime.FileLocator;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.resource.ImageRegistry;
+import org.eclipse.swt.graphics.Image;
+
+public class PDERuntimePluginImages {
+
+ private static ImageRegistry PLUGIN_REGISTRY;
+
+ public final static String ICONS_PATH = "icons/"; //$NON-NLS-1$
+
+ private static final String PATH_OBJ = ICONS_PATH + "obj16/"; //$NON-NLS-1$
+ private static final String PATH_DCL = ICONS_PATH + "dlcl16/"; //$NON-NLS-1$
+ private static final String PATH_LCL = ICONS_PATH + "elcl16/"; //$NON-NLS-1$
+ private static final String PATH_OVR = ICONS_PATH + "ovr16/"; //$NON-NLS-1$
+
+ // Plug-in Spy related images
+ public static final String IMG_CLASS_OBJ = "class_obj.gif"; //$NON-NLS-1$
+ public static final String IMG_INTERFACE_OBJ = "int_obj.gif"; //$NON-NLS-1$
+ public static final String IMG_PLUGIN_OBJ = "plugin_obj.gif"; //$NON-NLS-1$
+ public static final String IMG_SPY_OBJ = "pdespy_obj.gif"; //$NON-NLS-1$
+ public static final String IMG_MENU_OBJ = "menu_obj.gif"; //$NON-NLS-1$
+ public static final String IMG_ID_OBJ = "generic_xml_obj.gif"; //$NON-NLS-1$
+ public static final String IMG_MENUSPY_OBJ = "menuspy_obj.gif"; //$NON-NLS-1$
+ public static final String IMG_CONTEXTID_OBJ = "contextid_obj.gif"; //$NON-NLS-1$
+ public static final String IMG_SAVE_IMAGE_AS_OBJ = "save_image_as_obj.gif"; //$NON-NLS-1$
+ public static final String IMG_COPY_QNAME = "cpyqual_menu.gif"; //$NON-NLS-1$
+
+ public static final ImageDescriptor CLASS_OBJ = create(PATH_OBJ, IMG_CLASS_OBJ);
+ public static final ImageDescriptor INTERFACE_OBJ = create(PATH_OBJ, IMG_INTERFACE_OBJ);
+ public static final ImageDescriptor PLUGIN_OBJ = create(PATH_OBJ, IMG_PLUGIN_OBJ);
+ public static final ImageDescriptor SPY_OBJ = create(PATH_OBJ, IMG_SPY_OBJ);
+ public static final ImageDescriptor MENU_OBJ = create(PATH_OBJ, IMG_MENU_OBJ);
+ public static final ImageDescriptor ID_OBJ = create(PATH_OBJ, IMG_ID_OBJ);
+ public static final ImageDescriptor MENUSPY_OBJ = create(PATH_OBJ, IMG_MENUSPY_OBJ);
+ public static final ImageDescriptor CONTEXTID_OBJ = create(PATH_OBJ, IMG_CONTEXTID_OBJ);
+ public static final ImageDescriptor SAVE_IMAGE_AS_OBJ = create(PATH_OBJ, IMG_SAVE_IMAGE_AS_OBJ);
+ public static final ImageDescriptor COPY_QNAME = create(PATH_LCL, IMG_COPY_QNAME);
+
+ public static final ImageDescriptor DESC_REFRESH_DISABLED = create(PATH_DCL, "refresh.gif"); //$NON-NLS-1$
+ public static final ImageDescriptor DESC_REFRESH = create(PATH_LCL, "refresh.gif"); //$NON-NLS-1$
+ public static final ImageDescriptor DESC_COLLAPSE_ALL = create(PATH_LCL, "collapseall.gif"); //$NON-NLS-1$
+ public static final ImageDescriptor DESC_ERROR_ST_OBJ = create(PATH_OBJ, "error_st_obj.gif"); //$NON-NLS-1$
+ public static final ImageDescriptor DESC_ERROR_STACK_OBJ = create(PATH_OBJ, "error_stack.gif"); //$NON-NLS-1$
+ public static final ImageDescriptor DESC_EXT_POINT_OBJ = create(PATH_OBJ, "ext_point_obj.gif"); //$NON-NLS-1$
+ public static final ImageDescriptor DESC_EXT_POINTS_OBJ = create(PATH_OBJ, "ext_points_obj.gif"); //$NON-NLS-1$
+ public static final ImageDescriptor DESC_EXTENSION_OBJ = create(PATH_OBJ, "extension_obj.gif"); //$NON-NLS-1$
+ public static final ImageDescriptor DESC_EXTENSIONS_OBJ = create(PATH_OBJ, "extensions_obj.gif"); //$NON-NLS-1$
+ public static final ImageDescriptor DESC_GENERIC_XML_OBJ = create(PATH_OBJ, "generic_xml_obj.gif"); //$NON-NLS-1$
+ public static final ImageDescriptor DESC_ATTR_XML_OBJ = create(PATH_OBJ, "attr_xml_obj.gif"); //$NON-NLS-1$
+ public static final ImageDescriptor DESC_INFO_ST_OBJ = create(PATH_OBJ, "info_st_obj.gif"); //$NON-NLS-1$
+ public static final ImageDescriptor DESC_JAVA_LIB_OBJ = create(PATH_OBJ, "java_lib_obj.gif"); //$NON-NLS-1$
+ public static final ImageDescriptor DESC_NATIVE_LIB_OBJ = create(PATH_OBJ, "native_lib_obj.gif"); //$NON-NLS-1$
+ public static final ImageDescriptor DESC_OK_ST_OBJ = create(PATH_OBJ, "ok_st_obj.gif"); //$NON-NLS-1$
+ public static final ImageDescriptor DESC_PLUGIN_OBJ = create(PATH_OBJ, "plugin_obj.gif"); //$NON-NLS-1$
+ public static final ImageDescriptor DESC_REQ_PLUGIN_OBJ = create(PATH_OBJ, "req_plugin_obj.gif"); //$NON-NLS-1$
+ public static final ImageDescriptor DESC_REQ_PLUGINS_OBJ = create(PATH_OBJ, "req_plugins_obj.gif"); //$NON-NLS-1$
+ public static final ImageDescriptor DESC_RUNTIME_OBJ = create(PATH_OBJ, "runtime_obj.gif"); //$NON-NLS-1$
+ public static final ImageDescriptor DESC_WARNING_ST_OBJ = create(PATH_OBJ, "warning_st_obj.gif"); //$NON-NLS-1$
+ public static final ImageDescriptor DESC_LOCATION = create(PATH_OBJ, "location_obj.gif"); //$NON-NLS-1$
+ public static final ImageDescriptor DESC_IMP_OBJ = create(PATH_OBJ, "bundle-importer.gif"); //$NON-NLS-1$
+ public static final ImageDescriptor DESC_EXP_OBJ = create(PATH_OBJ, "bundle-exporter.gif"); //$NON-NLS-1$
+ public static final ImageDescriptor DESC_SERVICE_OBJ = create(PATH_OBJ, "int_obj.gif"); //$NON-NLS-1$
+ public static final ImageDescriptor DESC_PROPERTY_OBJ = create(PATH_OBJ, "property_obj.gif"); //$NON-NLS-1$
+ public static final ImageDescriptor DESC_PLUGINS_OBJ = create(PATH_OBJ, "plugins_obj.gif"); //$NON-NLS-1$
+ public static final ImageDescriptor DESC_FRAGMENT_OBJ = create(PATH_OBJ, "frgmt_obj.gif"); //$NON-NLS-1$
+ public static final ImageDescriptor DESC_PACKAGE_OBJ = create(PATH_OBJ, "package_obj.gif"); //$NON-NLS-1$
+
+ /*
+ * Overlays
+ */
+ public static final ImageDescriptor DESC_RUN_CO = create(PATH_OVR, "run_co.gif"); //$NON-NLS-1$
+ public static final ImageDescriptor DESC_EXPORT_CO = create(PATH_OVR, "export_co.gif"); //$NON-NLS-1$
+ public static final ImageDescriptor DESC_ERROR_CO = create(PATH_OVR, "error_co.gif"); //$NON-NLS-1$
+ public static final ImageDescriptor DESC_DEFAULT_CO = create(PATH_OVR, "default_co.gif"); //$NON-NLS-1$
+
+ private static final void initialize() {
+ PLUGIN_REGISTRY = PDERuntimePlugin.getDefault().getImageRegistry();
+ manage(IMG_CLASS_OBJ, CLASS_OBJ);
+ manage(IMG_INTERFACE_OBJ, INTERFACE_OBJ);
+ manage(IMG_PLUGIN_OBJ, PLUGIN_OBJ);
+ manage(IMG_SPY_OBJ, SPY_OBJ);
+ manage(IMG_MENU_OBJ, MENU_OBJ);
+ manage(IMG_ID_OBJ, ID_OBJ);
+ manage(IMG_MENUSPY_OBJ, MENUSPY_OBJ);
+ manage(IMG_CONTEXTID_OBJ, CONTEXTID_OBJ);
+ manage(IMG_SAVE_IMAGE_AS_OBJ, SAVE_IMAGE_AS_OBJ);
+ manage(IMG_COPY_QNAME, COPY_QNAME);
+ }
+
+ private static ImageDescriptor create(String prefix, String name) {
+ return ImageDescriptor.createFromURL(makeIconURL(prefix, name));
+ }
+
+ public static Image get(String key) {
+ if (PLUGIN_REGISTRY == null)
+ initialize();
+ return PLUGIN_REGISTRY.get(key);
+ }
+
+ private static URL makeIconURL(String prefix, String name) {
+ String path = "$nl$/" + prefix + name; //$NON-NLS-1$
+ return FileLocator.find(PDERuntimePlugin.getDefault().getBundle(), new Path(path), null);
+ }
+
+ public static Image manage(String key, ImageDescriptor desc) {
+ Image image = desc.createImage();
+ PLUGIN_REGISTRY.put(key, image);
+ return image;
+ }
+
+}
diff --git a/osgimonitoring/plugins/org.eclipse.pde.runtime/src/org/eclipse/pde/internal/runtime/pderuntimeresources.properties b/osgimonitoring/plugins/org.eclipse.pde.runtime/src/org/eclipse/pde/internal/runtime/pderuntimeresources.properties
new file mode 100644
index 0000000..1693287
--- /dev/null
+++ b/osgimonitoring/plugins/org.eclipse.pde.runtime/src/org/eclipse/pde/internal/runtime/pderuntimeresources.properties
@@ -0,0 +1,97 @@
+###############################################################################
+# Copyright (c) 2000, 2009 IBM Corporation and others.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# IBM Corporation - initial API and implementation
+###############################################################################
+#
+# PDE Runtime resources
+#
+
+ActiveFormEditorSection_Active_Form_Page=Active Form Page
+ActiveMenuSection_0=The active contribution item identifier:
+ActiveMenuSection_1=The active action set identifier:
+ActiveMenuSection_2=The active contribution item class:
+ActiveMenuSection_3=The active handler:
+ActiveMenuSection_4=The active action definition identifier:
+ActiveMenuSection_5=The active contribution item class:
+ActiveMenuSection_6=The active contribution item class:
+ActiveMenuSection_7=The active contribution location URI:
+RegistryView_refresh_label=&Refresh
+RegistryView_refresh_tooltip=Refresh
+RegistryView_collapseAll_label = &Collapse All
+RegistryView_collapseAll_tooltip = Collapse All
+RegistryView_folders_imports = Prerequisites
+RegistryView_folders_libraries = Run-time Libraries
+RegistryView_folders_extensionPoints = Extension Points
+RegistryView_folders_extensions = Extensions
+RegistryView_found_problems=The following problems were found:
+RegistryView_showRunning_label = &Show Active Plug-ins Only
+RegistryView_showDisabled_label = Show &Disabled Plug-ins Only
+RegistryView_showAdvanced_label = Show Advanced &Operations
+RegistryBrowser_Bundle=&Plug-in
+RegistryBrowser_copy_label=&Copy
+RegistryBrowser_ExtensionPoint=&Extension Point
+RegistryBrowser_extensionPoints=extension points
+RegistryBrowser_GroupBy=&Group By
+RegistryBrowser_InitializingView=Initializing the Plug-in Registry view
+RegistryBrowser_plugins=plug-ins
+RegistryBrowser_Service=&Service
+RegistryBrowser_Services=services
+RegistryBrowserLabelProvider_contributedBy=contributed by: {0}
+RegistryBrowserLabelProvider_ExportedPackages=Exported Packages
+RegistryBrowserLabelProvider_Fragments=Fragments
+RegistryBrowserLabelProvider_ImportedPackages=Imported Packages
+RegistryBrowserLabelProvider_Properties=Properties
+RegistryBrowserLabelProvider_RegisteredBy=Registered by
+RegistryBrowserLabelProvider_usedServices=Used Services
+RegistryBrowserLabelProvider_registeredServices=Registered Services
+RegistryBrowserLabelProvider_UsingBundles=Using bundles
+RegistryView_titleSummary = Filter matched {0} of {1} {2}.
+RegistryView_startAction_label = Start
+RegistryView_stopAction_label = Stop
+RegistryView_enableAction_label = Enable
+RegistryView_diag_dialog_title=Diagnosis
+RegistryView_diagnoseAction_label=Diagnose
+RegistryView_disableAction_label = Disable
+RegistryView_no_unresolved_constraints=No problems detected.
+
+MessageHelper_missing_optional_required_bundle=Missing optionally required bundle {0}
+MessageHelper_missing_required_bundle=Missing required bundle {0}
+MessageHelper_missing_imported_package=Missing imported package {0}
+MessageHelper_missing_host=Missing host {0}
+
+# Plug-in Spy
+SpyDialog_title = Plug-in Spy
+SpyDialog_close = &Close
+SpyDialog_activeShell_title = Active Shell
+SpyDialog_activeShell_desc = The active shell class:
+SpyDialog_activeWizard_title = Active Wizard ({0})
+SpyDialog_activeWizard_desc = The active wizard class:
+SpyDialog_activePart_title = Active Part ({0})
+SpyDialog_activePart_desc = The active {0} class:
+SpyDialog_activeMenuIds = The active menu contribution identifiers:
+SpyDialog_contributingPluginId_title = The contributing plug-in:
+SpyDialog_contributingPluginId_desc = The active {0} identifier:
+SpyDialog_activeSelection_title = Active Selection
+SpyDialog_activeSelection_desc = The selection class:
+SpyDialog_activeSelectionInterfaces_desc = The interfaces valid for the selection:
+SpyDialog_activeSelectedElement_desc = The type of the selected element:
+SpyDialog_activeSelectedElementInterfaces_desc = The interfaces valid for the selected element:
+SpyDialog_activeSelectedElementsCount_desc = {0} elements selected
+SpyDialog_activeDialogPageSection_title = Active Page ({0})
+SpyDialog_activeDialogPageSection_title2 = Active Page
+SpyDialog_activeDialogPageSection_desc = The active page class:
+SpyDialog_activeHelpSection_title = Active Help
+SpyDialog_activeHelpSection_desc = The active help context identifiers:
+SpyIDEUtil_noSourceFound_title = Source Lookup Error
+SpyIDEUtil_noSourceFound_message = Unable to find source for class ''{0}''
+
+SpyDialog_activePageBook_title=The active page:
+
+SpyFormToolkit_saveImageAs_title = Save Image As...
+SpyFormToolkit_copyQualifiedName = Copy Qualified Name
\ No newline at end of file
diff --git a/osgimonitoring/plugins/org.eclipse.pde.runtime/src/org/eclipse/pde/internal/runtime/registry/DiagnosticsDialog.java b/osgimonitoring/plugins/org.eclipse.pde.runtime/src/org/eclipse/pde/internal/runtime/registry/DiagnosticsDialog.java
new file mode 100644
index 0000000..cf6c78c
--- /dev/null
+++ b/osgimonitoring/plugins/org.eclipse.pde.runtime/src/org/eclipse/pde/internal/runtime/registry/DiagnosticsDialog.java
@@ -0,0 +1,42 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2008 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ * Benjamin Muskalla <b.muskalla@gmx.net> - bug 207831
+ *******************************************************************************/
+package org.eclipse.pde.internal.runtime.registry;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.jface.dialogs.ErrorDialog;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Shell;
+
+public class DiagnosticsDialog extends ErrorDialog {
+
+ public DiagnosticsDialog(Shell parentShell, String dialogTitle, String message, IStatus status, int displayMask) {
+ super(parentShell, dialogTitle, message, status, displayMask);
+ }
+
+ protected Control createDialogArea(Composite parent) {
+ Control area = super.createDialogArea(parent);
+ createDropDownList((Composite) area);
+ return area;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jface.dialogs.Dialog#createButtonsForButtonBar(org.eclipse.swt.widgets.Composite)
+ */
+ protected void createButtonsForButtonBar(Composite parent) {
+ createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);
+ }
+
+}
\ No newline at end of file
diff --git a/osgimonitoring/plugins/org.eclipse.pde.runtime/src/org/eclipse/pde/internal/runtime/registry/RegistryBrowser.java b/osgimonitoring/plugins/org.eclipse.pde.runtime/src/org/eclipse/pde/internal/runtime/registry/RegistryBrowser.java
new file mode 100644
index 0000000..cd5033e
--- /dev/null
+++ b/osgimonitoring/plugins/org.eclipse.pde.runtime/src/org/eclipse/pde/internal/runtime/registry/RegistryBrowser.java
@@ -0,0 +1,731 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2009 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ * Jacek Pospychala <jacek.pospychala@pl.ibm.com> - bug 211127
+ *******************************************************************************/
+package org.eclipse.pde.internal.runtime.registry;
+
+import java.util.*;
+import java.util.List;
+import org.eclipse.core.runtime.*;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.jface.action.*;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.viewers.*;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.pde.internal.runtime.*;
+import org.eclipse.pde.internal.runtime.registry.model.*;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.BusyIndicator;
+import org.eclipse.swt.dnd.*;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.*;
+import org.eclipse.ui.*;
+import org.eclipse.ui.actions.ActionFactory;
+import org.eclipse.ui.dialogs.FilteredTree;
+import org.eclipse.ui.dialogs.PatternFilter;
+import org.eclipse.ui.part.DrillDownAdapter;
+import org.eclipse.ui.part.ViewPart;
+import org.osgi.framework.BundleException;
+
+public class RegistryBrowser extends ViewPart {
+
+ private class GroupByAction extends Action {
+ private int actionGroupBy;
+
+ public GroupByAction(String name, int groupBy) {
+ super(name, AS_RADIO_BUTTON);
+ this.actionGroupBy = groupBy;
+ }
+
+ public void run() {
+ if (isChecked()) {
+ fMemento.putInteger(GROUP_BY, actionGroupBy);
+ // refreshAction takes into account checked state of fShowExtensionsOnlyAction
+ // (via updateItems(true)
+ fRefreshAction.run();
+ }
+ }
+ }
+
+ public static final String SHOW_RUNNING_PLUGINS = "RegistryView.showRunning.label"; //$NON-NLS-1$
+ public static final String SHOW_ADVANCED_MODE = "RegistryView.showAdvancedMode.label"; //$NON-NLS-1$
+ public static final String GROUP_BY = "RegistryView.groupBy"; //$NON-NLS-1$
+ public static final String SHOW_DISABLED_MODE = "RegistryView.showDisabledMode.label"; //$NON-NLS-1$
+
+ public static final int BUNDLES = 0;
+ public static final int EXTENSION_REGISTRY = 1;
+ public static final int SERVICES = 2;
+
+ private FilteredTree fFilteredTree;
+ private TreeViewer fTreeViewer;
+ private IMemento fMemento;
+
+ private RegistryModel model;
+ private ModelChangeListener listener;
+ private Job initializeModelJob;
+
+ private RegistryBrowserContentProvider fContentProvider;
+ private RegistryBrowserLabelProvider fLabelProvider;
+
+ private static final int REFRESH_DELAY = 50;
+ private long lastRefresh = 0;
+ private Thread refreshThread;
+
+ // menus and action items
+ private Action fRefreshAction;
+ private Action fShowPluginsAction;
+ private Action fCollapseAllAction;
+ private Action fShowAdvancedOperationsAction;
+ private Action fGroupByBundlesAction;
+ private Action fGroupByExtensionPointsAction;
+ private Action fGroupByServicesAction;
+ private Action fShowDisabledAction;
+ private Action fCopyAction;
+
+ // advanced actions
+ private Action fStartAction;
+ private Action fStopAction;
+ private Action fEnableAction;
+ private Action fDisableAction;
+ private Action fDiagnoseAction;
+
+ private Clipboard fClipboard;
+
+ private DrillDownAdapter fDrillDownAdapter;
+ private ViewerFilter fActiveFilter = new ViewerFilter() {
+ public boolean select(Viewer viewer, Object parentElement, Object element) {
+ if (element instanceof ExtensionPoint)
+ element = Platform.getBundle(((ExtensionPoint) element).getNamespaceIdentifier());
+ else if (element instanceof Extension)
+ element = Platform.getBundle(((Extension) element).getNamespaceIdentifier());
+ if (element instanceof Bundle)
+ return ((Bundle) element).getState() == Bundle.ACTIVE;
+ return true;
+ }
+ };
+
+ private ViewerFilter fDisabledFilter = new ViewerFilter() {
+ public boolean select(Viewer viewer, Object parentElement, Object element) {
+ if (element instanceof Bundle) {
+ return !((Bundle) element).isEnabled();
+ }
+ return false;
+ }
+ };
+
+ /*
+ * customized DrillDownAdapter which modifies enabled state of showing active/inactive
+ * plug-ins action - see Bug 58467
+ */
+ class RegistryDrillDownAdapter extends DrillDownAdapter {
+ public RegistryDrillDownAdapter(TreeViewer tree) {
+ super(tree);
+ }
+
+ public void goInto() {
+ super.goInto();
+ fShowPluginsAction.setEnabled(!canGoHome());
+ fShowDisabledAction.setEnabled(!canGoHome());
+ }
+
+ public void goBack() {
+ super.goBack();
+ fShowPluginsAction.setEnabled(!canGoHome());
+ fShowDisabledAction.setEnabled(!canGoHome());
+ }
+
+ public void goHome() {
+ super.goHome();
+ fShowPluginsAction.setEnabled(!canGoHome());
+ fShowDisabledAction.setEnabled(!canGoHome());
+ }
+
+ public void goInto(Object newInput) {
+ super.goInto(newInput);
+ fShowPluginsAction.setEnabled(!canGoHome());
+ fShowDisabledAction.setEnabled(!canGoHome());
+ }
+ }
+
+ private void initializeModel() {
+ model = RegistryModelFactory.getRegistryModel("local"); //$NON-NLS-1$
+ fTreeViewer.setInput(model);
+ listener = new RegistryBrowserModelChangeListener(RegistryBrowser.this);
+ model.addModelChangeListener(listener);
+
+ initializeModelJob = new Job(PDERuntimeMessages.RegistryBrowser_InitializingView) {
+ public IStatus run(IProgressMonitor monitor) {
+ model.connect(monitor, true);
+ initializeModelJob = null;
+ return monitor.isCanceled() ? Status.CANCEL_STATUS : Status.OK_STATUS;
+ }
+ };
+ initializeModelJob.schedule();
+ }
+
+ public void init(IViewSite site, IMemento memento) throws PartInitException {
+ super.init(site, memento);
+ if (memento == null)
+ this.fMemento = XMLMemento.createWriteRoot("REGISTRYVIEW"); //$NON-NLS-1$
+ else
+ this.fMemento = memento;
+ initializeMemento();
+ }
+
+ private void initializeMemento() {
+ // show all bundles by default (i.e. not just activated ones)
+ if (fMemento.getString(SHOW_RUNNING_PLUGINS) == null)
+ fMemento.putString(SHOW_RUNNING_PLUGINS, "false"); //$NON-NLS-1$
+ if (fMemento.getInteger(GROUP_BY) == null)
+ fMemento.putInteger(GROUP_BY, BUNDLES);
+ if (fMemento.getString(SHOW_DISABLED_MODE) == null)
+ fMemento.putString(SHOW_DISABLED_MODE, "false"); //$NON-NLS-1$
+
+ // default to not showing advanced options to users
+ if (fMemento.getString(SHOW_ADVANCED_MODE) == null)
+ fMemento.putString(SHOW_ADVANCED_MODE, "false"); //$NON-NLS-1$
+ }
+
+ public void dispose() {
+ if (initializeModelJob != null) {
+ initializeModelJob.cancel();
+ }
+
+ model.disconnect();
+ model.removeModelChangeListener(listener);
+ if (fClipboard != null) {
+ fClipboard.dispose();
+ }
+ super.dispose();
+ }
+
+ public void createPartControl(Composite parent) {
+ // create the sash form that will contain the tree viewer & text viewer
+ Composite composite = new Composite(parent, SWT.NONE);
+ GridLayout layout = new GridLayout();
+ layout.marginHeight = layout.marginWidth = 0;
+ composite.setLayout(layout);
+ composite.setLayoutData(new GridData(GridData.FILL_BOTH));
+ makeActions();
+ createTreeViewer(composite);
+ fClipboard = new Clipboard(fTreeViewer.getTree().getDisplay());
+ fillToolBar();
+ }
+
+ private void createTreeViewer(Composite parent) {
+ Composite composite = new Composite(parent, SWT.NONE);
+ GridLayout layout = new GridLayout();
+ layout.marginHeight = layout.marginWidth = 0;
+ composite.setLayout(layout);
+ composite.setLayoutData(new GridData(GridData.FILL_BOTH));
+
+ fFilteredTree = new RegistryFilteredTree(this, composite, SWT.MULTI, new PatternFilter());
+
+ fFilteredTree.setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_LIST_BACKGROUND));
+ Tree tree = fFilteredTree.getViewer().getTree();
+ GridData gd = new GridData(GridData.FILL_BOTH);
+ fFilteredTree.setLayoutData(gd);
+ fTreeViewer = fFilteredTree.getViewer();
+ fContentProvider = new RegistryBrowserContentProvider(this);
+ fTreeViewer.setContentProvider(fContentProvider);
+ fLabelProvider = new RegistryBrowserLabelProvider(this);
+ fTreeViewer.setLabelProvider(fLabelProvider);
+ fTreeViewer.setUseHashlookup(true);
+ fTreeViewer.setComparator(new ViewerComparator() {
+ public int compare(Viewer viewer, Object e1, Object e2) {
+ // let Comparables compare themselves
+ if (e1 instanceof Comparable && e2 instanceof Comparable && e1.getClass().equals(e2.getClass())) {
+ Comparable c1 = (Comparable) e1;
+ Comparable c2 = (Comparable) e2;
+
+ return c1.compareTo(c2);
+ }
+
+ if (e1 instanceof Folder && e2 instanceof Folder)
+ return ((Folder) e1).getId() - ((Folder) e2).getId();
+ if (e1 instanceof Bundle && e2 instanceof Bundle) {
+ e1 = ((Bundle) e1).getSymbolicName();
+ e2 = ((Bundle) e2).getSymbolicName();
+ }
+ return super.compare(viewer, e1, e2);
+ }
+ });
+ if (fShowPluginsAction.isChecked())
+ fTreeViewer.addFilter(fActiveFilter);
+
+ if (fShowDisabledAction.isChecked())
+ fTreeViewer.addFilter(fDisabledFilter);
+
+ initializeModel();
+
+ PlatformUI.getWorkbench().getHelpSystem().setHelp(fTreeViewer.getControl(), IHelpContextIds.REGISTRY_VIEW);
+
+ getViewSite().setSelectionProvider(fTreeViewer);
+
+ MenuManager popupMenuManager = new MenuManager();
+ IMenuListener listener = new IMenuListener() {
+ public void menuAboutToShow(IMenuManager mng) {
+ fillContextMenu(mng);
+ }
+ };
+ popupMenuManager.setRemoveAllWhenShown(true);
+ popupMenuManager.addMenuListener(listener);
+ Menu menu = popupMenuManager.createContextMenu(tree);
+ tree.setMenu(menu);
+ }
+
+ private void fillToolBar() {
+ fDrillDownAdapter = new RegistryDrillDownAdapter(fTreeViewer);
+ IActionBars bars = getViewSite().getActionBars();
+ bars.setGlobalActionHandler(ActionFactory.COPY.getId(), fCopyAction);
+ IToolBarManager mng = bars.getToolBarManager();
+ fDrillDownAdapter.addNavigationActions(mng);
+ mng.add(fRefreshAction);
+ mng.add(new Separator());
+ mng.add(fCollapseAllAction);
+ IMenuManager mgr = bars.getMenuManager();
+ IMenuManager manager = new MenuManager(PDERuntimeMessages.RegistryBrowser_GroupBy);
+ manager.add(fGroupByBundlesAction);
+ manager.add(fGroupByExtensionPointsAction);
+ manager.add(fGroupByServicesAction);
+ mgr.add(manager);
+ mgr.add(new Separator());
+ mgr.add(fShowPluginsAction);
+ mgr.add(fShowDisabledAction);
+ mgr.add(new Separator());
+ mgr.add(fShowAdvancedOperationsAction);
+
+ }
+
+ private void fillContextMenu(IMenuManager manager) {
+ manager.add(fRefreshAction);
+ manager.add(new Separator());
+ manager.add(fCopyAction);
+ manager.add(new Separator());
+ fDrillDownAdapter.addNavigationActions(manager);
+ manager.add(new Separator());
+ // check if we should enable advanced actions
+ if (fShowAdvancedOperationsAction.isChecked() && isBundleSelected()) {
+ // control bundle state actions
+ if (selectedBundlesStopped())
+ manager.add(fStartAction);
+ if (selectedBundlesStarted())
+ manager.add(fStopAction);
+
+ if (getSelectedBundles().size() == 1)
+ manager.add(fDiagnoseAction);
+
+ // security related actions
+ if (selectedBundlesDisabled())
+ manager.add(fEnableAction);
+ if (selectedBundlesEnabled())
+ manager.add(fDisableAction);
+ }
+
+ manager.add(new Separator());
+ manager.add(fShowPluginsAction);
+ manager.add(fShowDisabledAction);
+ manager.add(new Separator());
+ manager.add(fShowAdvancedOperationsAction);
+ }
+
+ public void saveState(IMemento memento) {
+ if (memento == null || fMemento == null || fTreeViewer == null)
+ return;
+ fMemento.putString(SHOW_RUNNING_PLUGINS, Boolean.toString(fShowPluginsAction.isChecked()));
+ fMemento.putString(SHOW_DISABLED_MODE, Boolean.toString(fShowDisabledAction.isChecked()));
+ fMemento.putBoolean(SHOW_ADVANCED_MODE, fShowAdvancedOperationsAction.isChecked());
+ memento.putMemento(fMemento);
+ }
+
+ public void setFocus() {
+ Text filterText = fFilteredTree.getFilterControl();
+ if (filterText != null) {
+ filterText.setFocus();
+ }
+ }
+
+ /*
+ * toolbar and context menu actions
+ */
+ private void makeActions() {
+ fRefreshAction = new Action("refresh") { //$NON-NLS-1$
+ public void run() {
+ BusyIndicator.showWhile(fTreeViewer.getTree().getDisplay(), new Runnable() {
+ public void run() {
+ refresh(fTreeViewer.getInput());
+ }
+ });
+ }
+ };
+ fRefreshAction.setText(PDERuntimeMessages.RegistryView_refresh_label);
+ fRefreshAction.setToolTipText(PDERuntimeMessages.RegistryView_refresh_tooltip);
+ fRefreshAction.setImageDescriptor(PDERuntimePluginImages.DESC_REFRESH);
+ fRefreshAction.setDisabledImageDescriptor(PDERuntimePluginImages.DESC_REFRESH_DISABLED);
+
+ fShowPluginsAction = new Action(PDERuntimeMessages.RegistryView_showRunning_label) {
+ public void run() {
+ if (fShowPluginsAction.isChecked()) {
+ fTreeViewer.addFilter(fActiveFilter);
+ } else {
+ fTreeViewer.removeFilter(fActiveFilter);
+ }
+ updateTitle();
+ }
+ };
+ fShowPluginsAction.setChecked(fMemento.getString(SHOW_RUNNING_PLUGINS).equals("true")); //$NON-NLS-1$
+
+ fShowDisabledAction = new Action(PDERuntimeMessages.RegistryView_showDisabled_label) {
+ public void run() {
+ if (fShowDisabledAction.isChecked()) {
+ fTreeViewer.addFilter(fDisabledFilter);
+ } else {
+ fTreeViewer.removeFilter(fDisabledFilter);
+ }
+ updateTitle();
+ }
+ };
+ fShowDisabledAction.setChecked(fMemento.getString(SHOW_DISABLED_MODE).equals("true")); //$NON-NLS-1$
+
+ fCopyAction = new Action(PDERuntimeMessages.RegistryBrowser_copy_label) {
+ public void run() {
+ ITreeSelection selection = (ITreeSelection) fFilteredTree.getViewer().getSelection();
+ if (selection.isEmpty()) {
+ return;
+ }
+
+ String textVersion = ((ILabelProvider) fTreeViewer.getLabelProvider()).getText(selection.getFirstElement());
+ if ((textVersion != null) && (textVersion.trim().length() > 0)) {
+ // set the clipboard contents
+ fClipboard.setContents(new Object[] {textVersion}, new Transfer[] {TextTransfer.getInstance()});
+ }
+ }
+ };
+ fCopyAction.setImageDescriptor(PDERuntimePluginImages.COPY_QNAME);
+
+ fGroupByBundlesAction = new GroupByAction(PDERuntimeMessages.RegistryBrowser_Bundle, BUNDLES);
+ int groupBy = getGroupBy();
+ fGroupByBundlesAction.setChecked(groupBy == BUNDLES);
+ fGroupByExtensionPointsAction = new GroupByAction(PDERuntimeMessages.RegistryBrowser_ExtensionPoint, EXTENSION_REGISTRY);
+ fGroupByExtensionPointsAction.setChecked(groupBy == EXTENSION_REGISTRY);
+ fGroupByServicesAction = new GroupByAction(PDERuntimeMessages.RegistryBrowser_Service, SERVICES);
+ fGroupByServicesAction.setChecked(groupBy == SERVICES);
+
+ fShowAdvancedOperationsAction = new Action(PDERuntimeMessages.RegistryView_showAdvanced_label) {
+ public void run() { // do nothing
+ }
+ };
+ fShowAdvancedOperationsAction.setChecked(fMemento.getString(SHOW_ADVANCED_MODE).equals("true")); //$NON-NLS-1$
+
+ fStartAction = new Action(PDERuntimeMessages.RegistryView_startAction_label) {
+ public void run() {
+ try {
+ List bundles = getSelectedBundles();
+ for (Iterator it = bundles.iterator(); it.hasNext();) {
+ Bundle bundle = (Bundle) it.next();
+ bundle.start();
+ }
+ } catch (BundleException e) {
+ PDERuntimePlugin.log(e);
+ }
+ }
+ };
+
+ fStopAction = new Action(PDERuntimeMessages.RegistryView_stopAction_label) {
+ public void run() {
+ try {
+ List bundles = getSelectedBundles();
+ for (Iterator it = bundles.iterator(); it.hasNext();) {
+ Bundle bundle = (Bundle) it.next();
+ bundle.stop();
+ }
+ } catch (BundleException e) {
+ PDERuntimePlugin.log(e);
+ }
+ }
+ };
+
+ fEnableAction = new Action(PDERuntimeMessages.RegistryView_enableAction_label) {
+ public void run() {
+ List bundles = getSelectedBundles();
+ for (Iterator it = bundles.iterator(); it.hasNext();) {
+ Bundle bundle = (Bundle) it.next();
+ bundle.enable();
+ }
+ }
+ };
+
+ fDisableAction = new Action(PDERuntimeMessages.RegistryView_disableAction_label) {
+ public void run() {
+ List bundles = getSelectedBundles();
+ for (Iterator it = bundles.iterator(); it.hasNext();) {
+ Bundle bundle = (Bundle) it.next();
+ bundle.disable();
+ }
+ }
+ };
+
+ fDiagnoseAction = new Action(PDERuntimeMessages.RegistryView_diagnoseAction_label) {
+ public void run() {
+ List bundles = getSelectedBundles();
+ for (Iterator it = bundles.iterator(); it.hasNext();) {
+ Bundle bundle = (Bundle) it.next();
+ MultiStatus problems = bundle.diagnose();
+
+ Dialog dialog;
+ if ((problems != null) && (problems.getChildren().length > 0)) {
+ dialog = new DiagnosticsDialog(getSite().getShell(), PDERuntimeMessages.RegistryView_diag_dialog_title, null, problems, IStatus.WARNING);
+ dialog.open();
+ } else {
+ MessageDialog.openInformation(getSite().getShell(), PDERuntimeMessages.RegistryView_diag_dialog_title, PDERuntimeMessages.RegistryView_no_unresolved_constraints);
+ }
+
+ }
+ }
+ };
+
+ fCollapseAllAction = new Action("collapseAll") { //$NON-NLS-1$
+ public void run() {
+ fTreeViewer.collapseAll();
+ }
+ };
+ fCollapseAllAction.setText(PDERuntimeMessages.RegistryView_collapseAll_label);
+ fCollapseAllAction.setImageDescriptor(PDERuntimePluginImages.DESC_COLLAPSE_ALL);
+ fCollapseAllAction.setToolTipText(PDERuntimeMessages.RegistryView_collapseAll_tooltip);
+ }
+
+ public int getGroupBy() {
+ return fMemento.getInteger(GROUP_BY).intValue();
+ }
+
+ public void updateTitle() {
+ setContentDescription(getTitleSummary());
+ }
+
+ protected Tree getUndisposedTree() {
+ if (fTreeViewer == null || fTreeViewer.getTree() == null || fTreeViewer.getTree().isDisposed())
+ return null;
+ return fTreeViewer.getTree();
+ }
+
+ public String getTitleSummary() {
+ Tree tree = getUndisposedTree();
+ String type;
+ int total = 0;
+ switch (getGroupBy()) {
+ default :
+ case BUNDLES :
+ type = PDERuntimeMessages.RegistryBrowser_plugins;
+ total = model.getBundles().length;
+ break;
+ case EXTENSION_REGISTRY :
+ type = PDERuntimeMessages.RegistryBrowser_extensionPoints;
+ total = model.getExtensionPoints().length;
+ break;
+ case SERVICES :
+ type = PDERuntimeMessages.RegistryBrowser_Services;
+ total = model.getServiceNames().length;
+ break;
+ }
+
+ if (tree == null)
+ return NLS.bind(PDERuntimeMessages.RegistryView_titleSummary, (new String[] {"0", "0", type})); //$NON-NLS-1$ //$NON-NLS-2$
+ return NLS.bind(PDERuntimeMessages.RegistryView_titleSummary, (new String[] {Integer.toString(tree.getItemCount()), Integer.toString(total), type}));
+ }
+
+ private boolean isBundleSelected() {
+ IStructuredSelection selection = (IStructuredSelection) fTreeViewer.getSelection();
+ if (selection != null) {
+ Object[] elements = selection.toArray();
+ for (int i = 0; i < elements.length; i++) {
+ if (!(elements[i] instanceof Bundle)) {
+ return false;
+ }
+ }
+ }
+
+ return true;
+ }
+
+ private List getSelectedBundles() {
+ List bundles = new ArrayList();
+ IStructuredSelection selection = (IStructuredSelection) fTreeViewer.getSelection();
+ if (selection != null) {
+ Object[] elements = selection.toArray();
+ for (int i = 0; i < elements.length; i++) {
+ if (elements[i] instanceof Bundle) {
+ bundles.add(elements[i]);
+ }
+ }
+ }
+ return bundles;
+ }
+
+ /**
+ * @return true if none is stopped, false if at least one is stopped
+ */
+ private boolean selectedBundlesStarted() {
+ List bundles = getSelectedBundles();
+ for (Iterator it = bundles.iterator(); it.hasNext();) {
+ Bundle bundle = (Bundle) it.next();
+ if (bundle.getState() != Bundle.ACTIVE)
+ return false;
+ }
+ return true;
+ }
+
+ /**
+ * @return true if none is active, false if at least one is active
+ */
+ private boolean selectedBundlesStopped() {
+ List bundles = getSelectedBundles();
+ for (Iterator it = bundles.iterator(); it.hasNext();) {
+ Bundle bundle = (Bundle) it.next();
+ if (bundle.getState() == Bundle.ACTIVE)
+ return false;
+ }
+ return true;
+ }
+
+ /**
+ * @return true if none is enabled, false if at least one is enabled
+ */
+ private boolean selectedBundlesDisabled() {
+ List bundles = getSelectedBundles();
+ for (Iterator it = bundles.iterator(); it.hasNext();) {
+ Bundle bundle = (Bundle) it.next();
+ if (bundle.isEnabled())
+ return false;
+ }
+ return true;
+ }
+
+ /**
+ * @return true if none is disabled, false if at least one is disabled
+ */
+ private boolean selectedBundlesEnabled() {
+ List bundles = getSelectedBundles();
+ for (Iterator it = bundles.iterator(); it.hasNext();) {
+ Bundle bundle = (Bundle) it.next();
+ if (!bundle.isEnabled())
+ return false;
+ }
+ return true;
+ }
+
+ public void add(Object object) {
+ Object parent = fContentProvider.getParent(object);
+ if (parent == null) {
+ add(fTreeViewer.getInput(), object);
+ } else {
+ refresh(parent);
+ }
+ }
+
+ protected void add(Object parent, Object object) {
+ if (fTreeViewer.getTree().isDisposed())
+ return;
+
+ if (fDrillDownAdapter.canGoHome())
+ return;
+ fTreeViewer.add(parent, object);
+ updateTitle();
+ }
+
+ public void remove(Object object) {
+ if (fTreeViewer.getTree().isDisposed())
+ return;
+
+ if (fDrillDownAdapter.canGoHome())
+ return;
+ fTreeViewer.remove(object);
+ updateTitle();
+ }
+
+ private boolean filtersEnabled() {
+ return fTreeViewer.getFilters().length > 0;
+ }
+
+ private void deferredRefresh() {
+ if (refreshThread != null)
+ return;
+
+ long now = System.currentTimeMillis();
+ if (now - lastRefresh > REFRESH_DELAY) {
+ fTreeViewer.refresh();
+ updateTitle();
+ lastRefresh = now;
+ } else {
+ Runnable runnable = new Runnable() {
+ public void run() {
+ try {
+ Thread.sleep(REFRESH_DELAY);
+ } catch (InterruptedException e) {
+ return;
+ }
+ refreshThread = null;
+ if (fTreeViewer.getTree().isDisposed())
+ return;
+
+ fTreeViewer.getTree().getDisplay().asyncExec(new Runnable() {
+ public void run() {
+ if (!fTreeViewer.getTree().isDisposed()) {
+ fTreeViewer.refresh();
+ updateTitle();
+ }
+ }
+ });
+ }
+ };
+ refreshThread = new Thread(runnable);
+ refreshThread.start();
+ }
+ }
+
+ void refresh(Object[] objects) {
+ if (fTreeViewer.getTree().isDisposed())
+ return;
+
+ if (filtersEnabled()) {
+ deferredRefresh();
+ } else {
+ for (int i = 0; i < objects.length; i++) {
+ fTreeViewer.refresh(objects[i]);
+ }
+ }
+ updateTitle();
+ }
+
+ void refresh(Object object) {
+ if (fTreeViewer.getTree().isDisposed())
+ return;
+
+ if (filtersEnabled()) {
+ deferredRefresh();
+ } else {
+ fTreeViewer.refresh(object);
+ updateTitle();
+ }
+ }
+
+ public Object getAdapter(Class clazz) {
+ if (ILabelProvider.class.equals(clazz)) {
+ return fLabelProvider;
+ }
+
+ if (IContentProvider.class.equals(clazz)) {
+ return fContentProvider;
+ }
+
+ return super.getAdapter(clazz);
+ }
+}
diff --git a/osgimonitoring/plugins/org.eclipse.pde.runtime/src/org/eclipse/pde/internal/runtime/registry/RegistryBrowserContentProvider.java b/osgimonitoring/plugins/org.eclipse.pde.runtime/src/org/eclipse/pde/internal/runtime/registry/RegistryBrowserContentProvider.java
new file mode 100644
index 0000000..8b1004d
--- /dev/null
+++ b/osgimonitoring/plugins/org.eclipse.pde.runtime/src/org/eclipse/pde/internal/runtime/registry/RegistryBrowserContentProvider.java
@@ -0,0 +1,171 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2009 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ * Wolfgang Schell <ws@jetztgrad.net> - bug 259348
+ *******************************************************************************/
+package org.eclipse.pde.internal.runtime.registry;
+
+import java.util.ArrayList;
+import java.util.List;
+import org.eclipse.jface.viewers.*;
+import org.eclipse.pde.internal.runtime.registry.model.*;
+
+public class RegistryBrowserContentProvider implements ITreeContentProvider {
+
+ public boolean isInExtensionSet;
+
+ private RegistryBrowser fRegistryBrowser;
+
+ public RegistryBrowserContentProvider(RegistryBrowser registryBrowser) {
+ fRegistryBrowser = registryBrowser;
+ }
+
+ public void dispose() { // nothing to dispose
+ }
+
+ public Object[] getElements(Object element) {
+ return getChildren(element);
+ }
+
+ public Object[] getChildren(Object element) {
+ if (element instanceof RegistryModel) {
+ RegistryModel model = (RegistryModel) element;
+
+ switch (fRegistryBrowser.getGroupBy()) {
+ case (RegistryBrowser.BUNDLES) :
+ return model.getBundles();
+ case (RegistryBrowser.EXTENSION_REGISTRY) :
+ return model.getExtensionPoints();
+ case (RegistryBrowser.SERVICES) :
+ return model.getServiceNames();
+ }
+
+ return null;
+ }
+
+ if (element instanceof Extension)
+ return ((Extension) element).getConfigurationElements();
+
+ isInExtensionSet = false;
+ if (element instanceof ExtensionPoint)
+ return ((ExtensionPoint) element).getExtensions().toArray();
+
+ if (element instanceof ConfigurationElement)
+ return ((ConfigurationElement) element).getElements();
+
+ if (element instanceof Bundle) {
+ if (fRegistryBrowser.getGroupBy() != RegistryBrowser.BUNDLES) // expands only in Bundles mode
+ return null;
+
+ Bundle bundle = (Bundle) element;
+
+ List folders = new ArrayList(9);
+
+ folders.add(new Attribute(Attribute.F_LOCATION, bundle.getLocation()));
+ if (bundle.getImports().length > 0)
+ folders.add(new Folder(Folder.F_IMPORTS, bundle));
+ if (bundle.getImportedPackages().length > 0)
+ folders.add(new Folder(Folder.F_IMPORTED_PACKAGES, bundle));
+ if (bundle.getExportedPackages().length > 0)
+ folders.add(new Folder(Folder.F_EXPORTED_PACKAGES, bundle));
+ if (bundle.getLibraries().length > 0)
+ folders.add(new Folder(Folder.F_LIBRARIES, bundle));
+ if (bundle.getExtensionPoints().length > 0)
+ folders.add(new Folder(Folder.F_EXTENSION_POINTS, bundle));
+ if (bundle.getExtensions().length > 0)
+ folders.add(new Folder(Folder.F_EXTENSIONS, bundle));
+ if (bundle.getRegisteredServices().length > 0)
+ folders.add(new Folder(Folder.F_REGISTERED_SERVICES, bundle));
+ if (bundle.getServicesInUse().length > 0)
+ folders.add(new Folder(Folder.F_SERVICES_IN_USE, bundle));
+ if (bundle.getFragments().length > 0)
+ folders.add(new Folder(Folder.F_FRAGMENTS, bundle));
+
+ return folders.toArray();
+ }
+
+ isInExtensionSet = false;
+
+ if (element instanceof Folder) {
+ Folder folder = (Folder) element;
+ isInExtensionSet = folder.getId() == Folder.F_EXTENSIONS;
+ ModelObject[] objs = folder.getChildren();
+ if (folder.getId() == Folder.F_USING_BUNDLES) {
+ ModelObject[] result = new ModelObject[objs.length];
+ ILabelProvider labelProvider = (ILabelProvider) fRegistryBrowser.getAdapter(ILabelProvider.class);
+
+ for (int i = 0; i < objs.length; i++) {
+ result[i] = new Attribute(Attribute.F_BUNDLE, labelProvider.getText(objs[i]));
+ }
+
+ objs = result;
+ }
+ return objs;
+ }
+ if (element instanceof ConfigurationElement) {
+ return ((ConfigurationElement) element).getElements();
+ }
+
+ if (element instanceof ExtensionPoint) {
+ ExtensionPoint extensionPoint = (ExtensionPoint) element;
+ Object[] objs = extensionPoint.getExtensions().toArray();
+ return objs;
+ }
+
+ if (element instanceof ServiceName) {
+ return ((ServiceName) element).getChildren();
+ }
+
+ if (element instanceof ServiceRegistration) {
+ ServiceRegistration service = (ServiceRegistration) element;
+
+ List folders = new ArrayList();
+
+ if (service.getProperties().length > 0)
+ folders.add(new Folder(Folder.F_PROPERTIES, service));
+ if (service.getUsingBundleIds().length > 0)
+ folders.add(new Folder(Folder.F_USING_BUNDLES, service));
+
+ return folders.toArray();
+ }
+
+ if (element instanceof Object[]) {
+ return (Object[]) element;
+ }
+
+ return null;
+ }
+
+ public Object getParent(Object element) {
+ if (!(element instanceof ModelObject)) {
+ return null;
+ }
+
+ if (element instanceof Folder) {
+ return ((Folder) element).getParent();
+ }
+
+ return null;
+ }
+
+ public boolean hasChildren(Object element) {
+ // Bundle and ServiceRegistration always have children
+ if (element instanceof Bundle)
+ return true;
+ if (element instanceof ServiceRegistration)
+ return true;
+
+ Object[] children = getChildren(element);
+ return children != null && children.length > 0;
+ }
+
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { // do nothing
+ }
+
+}
diff --git a/osgimonitoring/plugins/org.eclipse.pde.runtime/src/org/eclipse/pde/internal/runtime/registry/RegistryBrowserLabelProvider.java b/osgimonitoring/plugins/org.eclipse.pde.runtime/src/org/eclipse/pde/internal/runtime/registry/RegistryBrowserLabelProvider.java
new file mode 100644
index 0000000..5516caf
--- /dev/null
+++ b/osgimonitoring/plugins/org.eclipse.pde.runtime/src/org/eclipse/pde/internal/runtime/registry/RegistryBrowserLabelProvider.java
@@ -0,0 +1,392 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2009 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.pde.internal.runtime.registry;
+
+import org.eclipse.pde.internal.runtime.PDERuntimeMessages;
+
+import java.util.Arrays;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.viewers.*;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.pde.internal.runtime.*;
+import org.eclipse.pde.internal.runtime.registry.model.*;
+import org.eclipse.swt.graphics.Image;
+import org.osgi.framework.Constants;
+
+public class RegistryBrowserLabelProvider extends StyledCellLabelProvider implements ILabelProvider {
+
+ private Image fPluginImage;
+ private Image fActivePluginImage;
+ private Image fUnresolvedPluginImage;
+ private Image fLibraryImage;
+ private Image fRuntimeImage;
+ private Image fGenericTagImage;
+ private Image fGenericAttrImage;
+ private Image fExtensionImage;
+ private Image fExtensionsImage;
+ private Image fExtensionPointImage;
+ private Image fExtensionPointsImage;
+ private Image fRequiresImage;
+ private Image fExpReqPluginImage;
+ private Image fReqPluginImage;
+ private Image fPluginsImage;
+ private Image fLocationImage;
+ private Image fDisabledImage;
+ private Image fExporterImage;
+ private Image fImporterImage;
+ private Image fServiceImage;
+ private Image fPropertyImage;
+ private Image fServicePropertyImage;
+ private Image fFragmentImage;
+ private Image fPackageImage;
+ private RegistryBrowser fRegistryBrowser;
+
+ public RegistryBrowserLabelProvider(RegistryBrowser browser) {
+ fRegistryBrowser = browser;
+ fPluginImage = PDERuntimePluginImages.DESC_PLUGIN_OBJ.createImage();
+ fReqPluginImage = PDERuntimePluginImages.DESC_REQ_PLUGIN_OBJ.createImage();
+ fExtensionPointImage = PDERuntimePluginImages.DESC_EXT_POINT_OBJ.createImage();
+ fExtensionPointsImage = PDERuntimePluginImages.DESC_EXT_POINTS_OBJ.createImage();
+ fExtensionImage = PDERuntimePluginImages.DESC_EXTENSION_OBJ.createImage();
+ fExtensionsImage = PDERuntimePluginImages.DESC_EXTENSIONS_OBJ.createImage();
+ fRequiresImage = PDERuntimePluginImages.DESC_REQ_PLUGINS_OBJ.createImage();
+ fLibraryImage = PDERuntimePluginImages.DESC_JAVA_LIB_OBJ.createImage();
+ fGenericTagImage = PDERuntimePluginImages.DESC_GENERIC_XML_OBJ.createImage();
+ fGenericAttrImage = PDERuntimePluginImages.DESC_ATTR_XML_OBJ.createImage();
+ fRuntimeImage = PDERuntimePluginImages.DESC_RUNTIME_OBJ.createImage();
+ fLocationImage = PDERuntimePluginImages.DESC_LOCATION.createImage();
+ fExporterImage = PDERuntimePluginImages.DESC_EXP_OBJ.createImage();
+ fImporterImage = PDERuntimePluginImages.DESC_IMP_OBJ.createImage();
+ fServiceImage = PDERuntimePluginImages.DESC_SERVICE_OBJ.createImage();
+ fPropertyImage = PDERuntimePluginImages.DESC_PROPERTY_OBJ.createImage();
+ fPluginsImage = PDERuntimePluginImages.DESC_PLUGINS_OBJ.createImage();
+ fFragmentImage = PDERuntimePluginImages.DESC_FRAGMENT_OBJ.createImage();
+ fPackageImage = PDERuntimePluginImages.DESC_PACKAGE_OBJ.createImage();
+
+ ImageDescriptor activePluginDesc = new OverlayIcon(PDERuntimePluginImages.DESC_PLUGIN_OBJ, new ImageDescriptor[][] {{PDERuntimePluginImages.DESC_RUN_CO}});
+ fActivePluginImage = activePluginDesc.createImage();
+
+ ImageDescriptor disabledPluginDesc = new OverlayIcon(PDERuntimePluginImages.DESC_PLUGIN_OBJ, new ImageDescriptor[][] {{PDERuntimePluginImages.DESC_ERROR_CO}});
+ fDisabledImage = disabledPluginDesc.createImage();
+
+ ImageDescriptor unresolvedPluginDesc = new OverlayIcon(PDERuntimePluginImages.DESC_PLUGIN_OBJ, new ImageDescriptor[][] {{PDERuntimePluginImages.DESC_ERROR_CO}});
+ fUnresolvedPluginImage = unresolvedPluginDesc.createImage();
+
+ ImageDescriptor exportedRequiresDesc = new OverlayIcon(PDERuntimePluginImages.DESC_REQ_PLUGIN_OBJ, new ImageDescriptor[][] {{PDERuntimePluginImages.DESC_EXPORT_CO}});
+ fExpReqPluginImage = exportedRequiresDesc.createImage();
+
+ ImageDescriptor servicePropertyDesc = new OverlayIcon(PDERuntimePluginImages.DESC_PROPERTY_OBJ, new ImageDescriptor[][] {{PDERuntimePluginImages.DESC_DEFAULT_CO}});
+ fServicePropertyImage = servicePropertyDesc.createImage();
+
+ }
+
+ public void dispose() {
+ fPluginImage.dispose();
+ fActivePluginImage.dispose();
+ fUnresolvedPluginImage.dispose();
+ fReqPluginImage.dispose();
+ fExtensionPointImage.dispose();
+ fExtensionPointsImage.dispose();
+ fExtensionImage.dispose();
+ fExtensionsImage.dispose();
+ fRequiresImage.dispose();
+ fExpReqPluginImage.dispose();
+ fLibraryImage.dispose();
+ fGenericTagImage.dispose();
+ fGenericAttrImage.dispose();
+ fRuntimeImage.dispose();
+ fLocationImage.dispose();
+ fDisabledImage.dispose();
+ fImporterImage.dispose();
+ fExporterImage.dispose();
+ fServiceImage.dispose();
+ fPropertyImage.dispose();
+ fServicePropertyImage.dispose();
+ fPluginsImage.dispose();
+ fFragmentImage.dispose();
+ fPackageImage.dispose();
+ }
+
+ public Image getImage(Object element) {
+ if (element instanceof Bundle) {
+ Bundle bundle = (Bundle) element;
+
+ if (bundle.getFragmentHost() != null)
+ return fFragmentImage;
+
+ if (!bundle.isEnabled())
+ return fDisabledImage;
+
+ switch (bundle.getState()) {
+ case Bundle.ACTIVE :
+ return fActivePluginImage;
+ case Bundle.UNINSTALLED :
+ return fUnresolvedPluginImage;
+ case Bundle.INSTALLED :
+ if (!bundle.isEnabled())
+ return fUnresolvedPluginImage;
+ default :
+ return fPluginImage;
+ }
+ }
+
+ if (element instanceof ServiceName) {
+ return fServiceImage;
+ }
+
+ if (element instanceof ServiceRegistration) {
+ return fPluginImage;
+ }
+
+ if (element instanceof Property) {
+ Property property = (Property) element;
+ // special handling for property objectClass
+ if (property.getName().equals(Constants.OBJECTCLASS)) {
+ return PDERuntimePluginImages.get(PDERuntimePluginImages.IMG_CLASS_OBJ);
+ }
+ // special handling for builtin service properties
+ if (property.getName().startsWith("service.") || property.getName().startsWith("component.")) { //$NON-NLS-1$ //$NON-NLS-2$
+ return fServicePropertyImage;
+ }
+ return fPropertyImage;
+ }
+
+ if (element instanceof Folder) {
+ int id = ((Folder) element).getId();
+ switch (id) {
+ case Folder.F_EXTENSIONS :
+ return fExtensionsImage;
+ case Folder.F_EXTENSION_POINTS :
+ return fExtensionPointsImage;
+ case Folder.F_IMPORTS :
+ return fRequiresImage;
+ case Folder.F_LIBRARIES :
+ return fRuntimeImage;
+ case Folder.F_REGISTERED_SERVICES :
+ return fExporterImage;
+ case Folder.F_SERVICES_IN_USE :
+ return fImporterImage;
+ case Folder.F_PROPERTIES :
+ return fPropertyImage;
+ case Folder.F_USING_BUNDLES :
+ return fPluginsImage;
+ case Folder.F_FRAGMENTS :
+ return fPluginsImage;
+ case Folder.F_EXPORTED_PACKAGES :
+ case Folder.F_IMPORTED_PACKAGES :
+ return fPackageImage;
+ }
+ return null;
+ }
+
+ if (element instanceof Extension)
+ return fExtensionImage;
+
+ if (element instanceof ExtensionPoint)
+ return fExtensionPointImage;
+
+ if (element instanceof BundlePrerequisite) {
+ BundlePrerequisite prereq = (BundlePrerequisite) element;
+
+ if (prereq.isPackage())
+ return fPackageImage;
+
+ return prereq.isExported() ? fExpReqPluginImage : fReqPluginImage;
+ }
+
+ if (element instanceof BundleLibrary)
+ return fLibraryImage;
+
+ if (element instanceof ConfigurationElement)
+ return fGenericTagImage;
+
+ if (element instanceof Attribute) {
+ Attribute attr = (Attribute) element;
+ if (Attribute.F_LOCATION.equals(attr.getName())) {
+ return fLocationImage;
+ }
+ if (Attribute.F_BUNDLE.equals(attr.getName())) {
+ return fPluginImage;
+ }
+ return fGenericAttrImage;
+ }
+
+ return null;
+ }
+
+ protected StyledString getStyledText(Object element) {
+
+ if (element instanceof Bundle) {
+ Bundle bundle = ((Bundle) element);
+
+ StyledString sb = new StyledString(bundle.getSymbolicName());
+ String version = bundle.getVersion();
+ if (version != null) {
+ sb.append(" (", StyledString.DECORATIONS_STYLER); //$NON-NLS-1$
+ sb.append(version, StyledString.DECORATIONS_STYLER);
+ sb.append(")", StyledString.DECORATIONS_STYLER); //$NON-NLS-1$
+ }
+ String host = bundle.getFragmentHost();
+ if (host != null) {
+ sb.append(" [", StyledString.QUALIFIER_STYLER); //$NON-NLS-1$
+ sb.append(host, StyledString.QUALIFIER_STYLER);
+ sb.append("]", StyledString.QUALIFIER_STYLER); //$NON-NLS-1$
+ }
+ return sb;
+ }
+
+ if (element instanceof ServiceRegistration) {
+ ServiceRegistration ref = (ServiceRegistration) element;
+ String identifier = " (id=" + ref.getId() + ")"; //$NON-NLS-1$ //$NON-NLS-2$
+
+ StyledString ss = new StyledString();
+ if (fRegistryBrowser.getGroupBy() == RegistryBrowser.BUNDLES) {
+ String[] classes = ref.getName().getClasses();
+ ss.append(Arrays.asList(classes).toString());
+
+ } else {
+ ss.append(PDERuntimeMessages.RegistryBrowserLabelProvider_RegisteredBy);
+ ss.append(ref.getBundle());
+ }
+
+ ss.append(identifier, StyledString.DECORATIONS_STYLER);
+
+ return ss;
+ }
+
+ if (element instanceof ServiceName) {
+ return new StyledString(Arrays.asList(((ServiceName) element).getClasses()).toString());
+ }
+
+ if (element instanceof Folder) {
+ String text = null;
+ switch (((Folder) element).getId()) {
+ case Folder.F_IMPORTS :
+ text = PDERuntimeMessages.RegistryView_folders_imports;
+ break;
+ case Folder.F_IMPORTED_PACKAGES :
+ text = PDERuntimeMessages.RegistryBrowserLabelProvider_ImportedPackages;
+ break;
+ case Folder.F_EXPORTED_PACKAGES :
+ text = PDERuntimeMessages.RegistryBrowserLabelProvider_ExportedPackages;
+ break;
+ case Folder.F_LIBRARIES :
+ text = PDERuntimeMessages.RegistryView_folders_libraries;
+ break;
+ case Folder.F_EXTENSION_POINTS :
+ text = PDERuntimeMessages.RegistryView_folders_extensionPoints;
+ break;
+ case Folder.F_EXTENSIONS :
+ text = PDERuntimeMessages.RegistryView_folders_extensions;
+ break;
+ case Folder.F_REGISTERED_SERVICES :
+ text = PDERuntimeMessages.RegistryBrowserLabelProvider_registeredServices;
+ break;
+ case Folder.F_SERVICES_IN_USE :
+ text = PDERuntimeMessages.RegistryBrowserLabelProvider_usedServices;
+ break;
+ case Folder.F_PROPERTIES :
+ text = PDERuntimeMessages.RegistryBrowserLabelProvider_Properties;
+ break;
+ case Folder.F_USING_BUNDLES :
+ text = PDERuntimeMessages.RegistryBrowserLabelProvider_UsingBundles;
+ break;
+ case Folder.F_FRAGMENTS :
+ text = PDERuntimeMessages.RegistryBrowserLabelProvider_Fragments;
+ break;
+ }
+
+ if (text != null) {
+ return new StyledString(text);
+ }
+ }
+ if (element instanceof Extension) {
+ if (((RegistryBrowserContentProvider) fRegistryBrowser.getAdapter(IContentProvider.class)).isInExtensionSet) {
+ Extension extension = ((Extension) element);
+
+ StyledString ss = new StyledString(extension.getExtensionPointUniqueIdentifier());
+ String name = extension.getLabel();
+ if (name != null && name.length() > 0) {
+ ss.append("[ ", StyledString.QUALIFIER_STYLER); //$NON-NLS-1$
+ ss.append(name, StyledString.QUALIFIER_STYLER);
+ ss.append(']', StyledString.QUALIFIER_STYLER);
+ }
+
+ return ss;
+ }
+
+ String contributor = ((Extension) element).getNamespaceIdentifier();
+ return new StyledString(NLS.bind(PDERuntimeMessages.RegistryBrowserLabelProvider_contributedBy, contributor));
+
+ }
+ if (element instanceof ExtensionPoint) {
+ ExtensionPoint extPoint = (ExtensionPoint) element;
+
+ StyledString ss = new StyledString(extPoint.getUniqueIdentifier());
+ String name = extPoint.getLabel();
+ if (name != null && name.length() > 0) {
+ ss.append(" [", StyledString.QUALIFIER_STYLER); //$NON-NLS-1$
+ ss.append(name, StyledString.QUALIFIER_STYLER);
+ ss.append(']', StyledString.QUALIFIER_STYLER);
+ }
+
+ return ss;
+ }
+ if (element instanceof BundlePrerequisite) {
+ BundlePrerequisite prereq = (BundlePrerequisite) element;
+
+ StyledString ss = new StyledString(prereq.getName());
+
+ String version = prereq.getVersion();
+ if (version != null) {
+ if (Character.isDigit(version.charAt(0)))
+ version = '(' + version + ')';
+ ss.append(' ').append(version, StyledString.DECORATIONS_STYLER);
+ }
+
+ return ss;
+ }
+
+ if (element instanceof BundleLibrary) {
+ return new StyledString(((BundleLibrary) element).getLibrary());
+ }
+
+ if (element instanceof ConfigurationElement) {
+ return new StyledString(((ConfigurationElement) element).getName());
+ }
+ if (element instanceof Attribute) {
+ Attribute attribute = (Attribute) element;
+ if (Attribute.F_BUNDLE.equals(attribute.getName())) {
+ return new StyledString(attribute.getValue());
+ }
+
+ return new StyledString(attribute.getName() + " = " + attribute.getValue()); //$NON-NLS-1$
+ }
+ if (element instanceof Property) {
+ Property property = (Property) element;
+ return new StyledString(property.getName() + " = " + property.getValue()); //$NON-NLS-1$
+ }
+
+ return new StyledString(element == null ? "" : element.toString()); //$NON-NLS-1$
+ }
+
+ public void update(ViewerCell cell) {
+ StyledString string = getStyledText(cell.getElement());
+ cell.setText(string.getString());
+ cell.setStyleRanges(string.getStyleRanges());
+ cell.setImage(getImage(cell.getElement()));
+ super.update(cell);
+ }
+
+ public String getText(Object element) {
+ return getStyledText(element).getString();
+ }
+}
diff --git a/osgimonitoring/plugins/org.eclipse.pde.runtime/src/org/eclipse/pde/internal/runtime/registry/RegistryBrowserModelChangeListener.java b/osgimonitoring/plugins/org.eclipse.pde.runtime/src/org/eclipse/pde/internal/runtime/registry/RegistryBrowserModelChangeListener.java
new file mode 100644
index 0000000..214c96c
--- /dev/null
+++ b/osgimonitoring/plugins/org.eclipse.pde.runtime/src/org/eclipse/pde/internal/runtime/registry/RegistryBrowserModelChangeListener.java
@@ -0,0 +1,146 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2009 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.pde.internal.runtime.registry;
+
+import org.eclipse.pde.internal.runtime.registry.model.*;
+
+public class RegistryBrowserModelChangeListener implements ModelChangeListener {
+
+ private RegistryBrowser fRegistryBrowser;
+
+ public RegistryBrowserModelChangeListener(RegistryBrowser registryBrowser) {
+ fRegistryBrowser = registryBrowser;
+ }
+
+ public void modelChanged(final ModelChangeDelta[] delta) {
+ fRegistryBrowser.getSite().getWorkbenchWindow().getWorkbench().getDisplay().asyncExec(new Runnable() {
+ public void run() {
+ update(delta);
+ }
+ });
+ }
+
+ private boolean topLevelElement(Object object) {
+ switch (fRegistryBrowser.getGroupBy()) {
+ case (RegistryBrowser.BUNDLES) :
+ return object instanceof Bundle;
+ case (RegistryBrowser.EXTENSION_REGISTRY) :
+ return object instanceof ExtensionPoint;
+ case (RegistryBrowser.SERVICES) :
+ return object instanceof ServiceName;
+ }
+
+ return false;
+ }
+
+ /**
+ * TODO FIXME this should be moved to content provider getParent
+ *
+ * @param object
+ * @return if returns array, then appears under all top level elements of that array
+ */
+ private Object getTopLevelElement(Object object) {
+ if (fRegistryBrowser.getGroupBy() == RegistryBrowser.BUNDLES) {
+ if (object instanceof Bundle) {
+ return object;
+ } else if (object instanceof ExtensionPoint) {
+ ExtensionPoint ext = (ExtensionPoint) object;
+ return ext.getContributor();
+ } else if (object instanceof Extension) {
+ Extension ext = (Extension) object;
+ return ext.getContributor();
+ } else if (object instanceof ServiceRegistration) {
+ ServiceRegistration reg = (ServiceRegistration) object;
+
+ Bundle[] bundles = reg.getUsingBundles();
+ if (bundles.length == 0) {
+ return reg.getBundle();
+ }
+
+ Object[] result = new Object[bundles.length + 1];
+ result[0] = reg.getBundle();
+ System.arraycopy(bundles, 0, result, 1, bundles.length);
+
+ return result;
+ }
+ } else if (fRegistryBrowser.getGroupBy() == RegistryBrowser.EXTENSION_REGISTRY) {
+ if (object instanceof ExtensionPoint) {
+ return object;
+ } else if (object instanceof Extension) {
+ Extension ext = (Extension) object;
+ return ext.getExtensionPoint();
+ }
+ } else if (fRegistryBrowser.getGroupBy() == RegistryBrowser.SERVICES) {
+ if (object instanceof ServiceRegistration) {
+ ServiceRegistration service = (ServiceRegistration) object;
+ return service.getName();
+ } else if (object instanceof Bundle) {
+ Object[] services = ((Bundle) object).getServicesInUse();
+ for (int i = 0; i < services.length; i++) {
+ ServiceRegistration service = ((ServiceRegistration) services[i]);
+ services[i] = service.getName();
+ }
+ return services;
+ }
+ }
+
+ return null;
+ }
+
+ private void refreshTopLevelElements(Object object) {
+ Object topLevelElement = getTopLevelElement(object);
+
+ if (topLevelElement == null)
+ return;
+
+ if (topLevelElement.getClass().isArray()) {
+ Object[] array = (Object[]) topLevelElement;
+ fRegistryBrowser.refresh(array);
+ } else {
+ fRegistryBrowser.refresh(topLevelElement);
+ }
+ }
+
+ protected void update(ModelChangeDelta[] deltas) {
+ for (int i = 0; i < deltas.length; i++) {
+ ModelObject object = deltas[i].getModelObject();
+ int flag = deltas[i].getFlag();
+
+ switch (flag) {
+ case ModelChangeDelta.ADDED :
+ if (topLevelElement(object)) {
+ fRegistryBrowser.add(object);
+ } else {
+ refreshTopLevelElements(object);
+ }
+ break;
+ case ModelChangeDelta.REMOVED :
+ if (topLevelElement(object)) {
+ fRegistryBrowser.remove(object);
+ } else {
+ refreshTopLevelElements(object);
+ }
+ break;
+ case ModelChangeDelta.STARTED :
+ case ModelChangeDelta.STOPPED :
+ case ModelChangeDelta.RESOLVED :
+ case ModelChangeDelta.UNRESOLVED :
+ case ModelChangeDelta.UPDATED :
+ if (topLevelElement(object)) {
+ fRegistryBrowser.refresh(object);
+ } else {
+ refreshTopLevelElements(object);
+ }
+ break;
+ }
+ }
+ }
+}
diff --git a/osgimonitoring/plugins/org.eclipse.pde.runtime/src/org/eclipse/pde/internal/runtime/registry/RegistryFilteredTree.java b/osgimonitoring/plugins/org.eclipse.pde.runtime/src/org/eclipse/pde/internal/runtime/registry/RegistryFilteredTree.java
new file mode 100644
index 0000000..a96ab8d
--- /dev/null
+++ b/osgimonitoring/plugins/org.eclipse.pde.runtime/src/org/eclipse/pde/internal/runtime/registry/RegistryFilteredTree.java
@@ -0,0 +1,57 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2008 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.pde.internal.runtime.registry;
+
+import org.eclipse.swt.layout.*;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.dialogs.FilteredTree;
+import org.eclipse.ui.dialogs.PatternFilter;
+
+public class RegistryFilteredTree extends FilteredTree {
+
+ private RegistryBrowser browser;
+
+ public RegistryFilteredTree(RegistryBrowser browser, Composite parent, int treeStyle, PatternFilter filter) {
+ super(parent, treeStyle, filter, true);
+ this.browser = browser;
+ }
+
+ protected void createControl(Composite parent, int treeStyle) {
+ super.createControl(parent, treeStyle);
+
+ // add 2px margin around filter text
+
+ FormLayout layout = new FormLayout();
+ layout.marginHeight = 0;
+ layout.marginWidth = 0;
+ setLayout(layout);
+
+ FormData data = new FormData();
+ data.top = new FormAttachment(0, 2);
+ data.left = new FormAttachment(0, 2);
+ data.right = new FormAttachment(100, -2);
+ filterComposite.setLayoutData(data);
+
+ data = new FormData();
+ data.top = new FormAttachment(filterComposite, 2);
+ data.left = new FormAttachment(0, 0);
+ data.right = new FormAttachment(100, 0);
+ data.bottom = new FormAttachment(100, 0);
+ treeComposite.setLayoutData(data);
+ }
+
+ protected void updateToolbar(boolean visible) {
+ super.updateToolbar(visible);
+
+ // update view title on viewer's toolbar update
+ browser.updateTitle();
+ }
+}
diff --git a/osgimonitoring/plugins/org.eclipse.pde.runtime/src/org/eclipse/pde/internal/runtime/registry/model/Attribute.java b/osgimonitoring/plugins/org.eclipse.pde.runtime/src/org/eclipse/pde/internal/runtime/registry/model/Attribute.java
new file mode 100644
index 0000000..cc153d1
--- /dev/null
+++ b/osgimonitoring/plugins/org.eclipse.pde.runtime/src/org/eclipse/pde/internal/runtime/registry/model/Attribute.java
@@ -0,0 +1,45 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2009 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.pde.internal.runtime.registry.model;
+
+public class Attribute extends ModelObject {
+ public static final String F_LOCATION = "Location"; //$NON-NLS-1$
+
+ public static final String F_BUNDLE = "Bundle"; //$NON-NLS-1$
+
+ private String name;
+ private String value;
+
+ public Attribute() {
+ // empty
+ }
+
+ public Attribute(String name, String value) {
+ this.name = name;
+ this.value = value;
+ }
+
+ public String getValue() {
+ return value;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public void setValue(String value) {
+ this.value = value;
+ }
+}
diff --git a/osgimonitoring/plugins/org.eclipse.pde.runtime/src/org/eclipse/pde/internal/runtime/registry/model/BackendChangeListener.java b/osgimonitoring/plugins/org.eclipse.pde.runtime/src/org/eclipse/pde/internal/runtime/registry/model/BackendChangeListener.java
new file mode 100644
index 0000000..91fcb86
--- /dev/null
+++ b/osgimonitoring/plugins/org.eclipse.pde.runtime/src/org/eclipse/pde/internal/runtime/registry/model/BackendChangeListener.java
@@ -0,0 +1,39 @@
+/*******************************************************************************
+ * Copyright (c) 2009 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.pde.internal.runtime.registry.model;
+
+/**
+ * Notifies on any changes coming from backend. Usually RegistryModel is only interested in receiving
+ * news about that.
+ *
+ */
+public interface BackendChangeListener {
+
+ void addBundle(Bundle adapter);
+
+ void removeBundle(Bundle adapter);
+
+ void updateBundle(Bundle adapter, int updated);
+
+ void addService(ServiceRegistration adapter);
+
+ void removeService(ServiceRegistration adapter);
+
+ void updateService(ServiceRegistration adapter);
+
+ void addExtensions(Extension[] extensions);
+
+ void removeExtensions(Extension[] extensions);
+
+ void addExtensionPoints(ExtensionPoint[] extensionPoints);
+
+ void removeExtensionPoints(ExtensionPoint[] extensionPoints);
+}
diff --git a/osgimonitoring/plugins/org.eclipse.pde.runtime/src/org/eclipse/pde/internal/runtime/registry/model/Bundle.java b/osgimonitoring/plugins/org.eclipse.pde.runtime/src/org/eclipse/pde/internal/runtime/registry/model/Bundle.java
new file mode 100644
index 0000000..e409b2b
--- /dev/null
+++ b/osgimonitoring/plugins/org.eclipse.pde.runtime/src/org/eclipse/pde/internal/runtime/registry/model/Bundle.java
@@ -0,0 +1,242 @@
+/*******************************************************************************
+ * Copyright (c) 2009 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.pde.internal.runtime.registry.model;
+
+import java.util.*;
+import org.eclipse.core.runtime.MultiStatus;
+import org.osgi.framework.BundleException;
+
+public class Bundle extends ModelObject {
+
+ public static final int ACTIVE = org.osgi.framework.Bundle.ACTIVE;
+ public static final int UNINSTALLED = org.osgi.framework.Bundle.UNINSTALLED;
+ public static final int INSTALLED = org.osgi.framework.Bundle.INSTALLED;
+
+ private String symbolicName;
+ private String location;
+ private boolean isEnabled;
+ private BundlePrerequisite[] imports = new BundlePrerequisite[0];
+ private String version;
+ private int state;
+ private long id;
+ private BundleLibrary[] libraries = new BundleLibrary[0];
+ private BundlePrerequisite[] importedPackages = new BundlePrerequisite[0];
+ private BundlePrerequisite[] exportedPackages = new BundlePrerequisite[0];
+
+ private String fragmentHost;
+ private String fragmentHostVersion;
+
+ public void setFragmentHost(String fragmentHost) {
+ this.fragmentHost = fragmentHost;
+ }
+
+ public String getFragmentHost() {
+ return fragmentHost;
+ }
+
+ public String getFragmentHostVersion() {
+ return fragmentHostVersion;
+ }
+
+ public void setFragmentHostVersion(String fragmentHostVersion) {
+ this.fragmentHostVersion = fragmentHostVersion;
+ }
+
+ public void setSymbolicName(String symbolicName) {
+ this.symbolicName = symbolicName;
+ }
+
+ public void setLocation(String location) {
+ this.location = location;
+ }
+
+ public void setImports(BundlePrerequisite[] imports) {
+ if (imports == null)
+ throw new IllegalArgumentException();
+
+ this.imports = imports;
+ }
+
+ public void setVersion(String version) {
+ this.version = version;
+ }
+
+ public void setState(int state) {
+ this.state = state;
+ }
+
+ public void setId(long id) {
+ this.id = id;
+ }
+
+ public void setEnabled(boolean enabled) {
+ isEnabled = enabled;
+ }
+
+ public void setLibraries(BundleLibrary[] libraries) {
+ if (libraries == null)
+ throw new IllegalArgumentException();
+
+ this.libraries = libraries;
+ }
+
+ public String getSymbolicName() {
+ return symbolicName;
+ }
+
+ public boolean isEnabled() {
+ return isEnabled;
+ }
+
+ public BundlePrerequisite[] getImports() {
+ return imports;
+ }
+
+ public BundleLibrary[] getLibraries() {
+ return libraries;
+ }
+
+ public String getLocation() {
+ return location;
+ }
+
+ public String getVersion() {
+ return version;
+ }
+
+ public int getState() {
+ return state;
+ }
+
+ public long getId() {
+ return id;
+ }
+
+ public void start() throws BundleException {
+ if (model == null)
+ return;
+ model.backend.start(id);
+ }
+
+ public void stop() throws BundleException {
+ if (model == null)
+ return;
+ model.backend.stop(id);
+ }
+
+ public void enable() {
+ if (model == null)
+ return;
+ model.backend.setEnabled(id, true);
+ }
+
+ public void disable() {
+ if (model == null)
+ return;
+ model.backend.setEnabled(id, false);
+ }
+
+ public MultiStatus diagnose() {
+ if (model == null)
+ return null;
+ return model.backend.diagnose(id);
+ }
+
+ public ExtensionPoint[] getExtensionPoints() {
+ if (model == null)
+ return new ExtensionPoint[0];
+ ExtensionPoint[] extPoints = model.getExtensionPoints();
+ List result = new ArrayList();
+
+ for (int i = 0; i < extPoints.length; i++) {
+ if (extPoints[i].getContributorId().longValue() == id)
+ result.add(extPoints[i]);
+ }
+ return (ExtensionPoint[]) result.toArray(new ExtensionPoint[result.size()]);
+ }
+
+ public Extension[] getExtensions() {
+ if (model == null)
+ return new Extension[0];
+ ExtensionPoint[] extPoints = model.getExtensionPoints();
+ List result = new ArrayList();
+
+ for (int i = 0; i < extPoints.length; i++) {
+ for (Iterator it = extPoints[i].getExtensions().iterator(); it.hasNext();) {
+ Extension a = (Extension) it.next();
+ if (a.getContributorId().longValue() == id)
+ result.add(a);
+ }
+
+ }
+ return (Extension[]) result.toArray(new Extension[result.size()]);
+ }
+
+ public ServiceRegistration[] getRegisteredServices() {
+ if (model == null)
+ return new ServiceRegistration[0];
+ ServiceRegistration[] services = model.getServices();
+ List result = new ArrayList();
+
+ for (int i = 0; i < services.length; i++) {
+ if (symbolicName.equals(services[i].getBundle()))
+ result.add(services[i]);
+ }
+ return (ServiceRegistration[]) result.toArray(new ServiceRegistration[result.size()]);
+ }
+
+ public ServiceRegistration[] getServicesInUse() {
+ if (model == null)
+ return new ServiceRegistration[0];
+ ServiceRegistration[] services = model.getServices();
+ List result = new ArrayList();
+
+ for (int i = 0; i < services.length; i++) {
+ long[] usingBundles = services[i].getUsingBundleIds();
+ if (usingBundles != null) {
+ for (int j = 0; j < usingBundles.length; j++)
+ if (id == usingBundles[j])
+ result.add(services[i]);
+ }
+ }
+ return (ServiceRegistration[]) result.toArray(new ServiceRegistration[result.size()]);
+ }
+
+ public boolean equals(Object obj) {
+ return (obj instanceof Bundle) && (id == ((Bundle) obj).id);
+ }
+
+ public int hashCode() {
+ return (int) id;
+ }
+
+ public Bundle[] getFragments() {
+ if (model == null)
+ return new Bundle[0];
+ return model.getFragments(this);
+ }
+
+ public void setImportedPackages(BundlePrerequisite[] importedPackages) {
+ this.importedPackages = importedPackages;
+ }
+
+ public BundlePrerequisite[] getImportedPackages() {
+ return importedPackages;
+ }
+
+ public void setExportedPackages(BundlePrerequisite[] exportedPackages) {
+ this.exportedPackages = exportedPackages;
+ }
+
+ public BundlePrerequisite[] getExportedPackages() {
+ return exportedPackages;
+ }
+}
diff --git a/osgimonitoring/plugins/org.eclipse.pde.runtime/src/org/eclipse/pde/internal/runtime/registry/model/BundleLibrary.java b/osgimonitoring/plugins/org.eclipse.pde.runtime/src/org/eclipse/pde/internal/runtime/registry/model/BundleLibrary.java
new file mode 100644
index 0000000..ee7d719
--- /dev/null
+++ b/osgimonitoring/plugins/org.eclipse.pde.runtime/src/org/eclipse/pde/internal/runtime/registry/model/BundleLibrary.java
@@ -0,0 +1,24 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2008 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.pde.internal.runtime.registry.model;
+
+public class BundleLibrary extends ModelObject {
+
+ private String library;
+
+ public String getLibrary() {
+ return library;
+ }
+
+ public void setLibrary(String name) {
+ library = name;
+ }
+}
diff --git a/osgimonitoring/plugins/org.eclipse.pde.runtime/src/org/eclipse/pde/internal/runtime/registry/model/BundlePrerequisite.java b/osgimonitoring/plugins/org.eclipse.pde.runtime/src/org/eclipse/pde/internal/runtime/registry/model/BundlePrerequisite.java
new file mode 100644
index 0000000..9bc623f
--- /dev/null
+++ b/osgimonitoring/plugins/org.eclipse.pde.runtime/src/org/eclipse/pde/internal/runtime/registry/model/BundlePrerequisite.java
@@ -0,0 +1,51 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2009 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.pde.internal.runtime.registry.model;
+
+public class BundlePrerequisite extends ModelObject {
+
+ private boolean isExported;
+ private String name;
+ private String version;
+ private boolean isPackage;
+
+ public void setPackage(boolean isPackage) {
+ this.isPackage = isPackage;
+ }
+
+ public boolean isPackage() {
+ return isPackage;
+ }
+
+ public void setExported(boolean isExported) {
+ this.isExported = isExported;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public void setVersion(String version) {
+ this.version = version;
+ }
+
+ public boolean isExported() {
+ return isExported;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public String getVersion() {
+ return version;
+ }
+}
diff --git a/osgimonitoring/plugins/org.eclipse.pde.runtime/src/org/eclipse/pde/internal/runtime/registry/model/ConfigurationElement.java b/osgimonitoring/plugins/org.eclipse.pde.runtime/src/org/eclipse/pde/internal/runtime/registry/model/ConfigurationElement.java
new file mode 100644
index 0000000..aa416eb
--- /dev/null
+++ b/osgimonitoring/plugins/org.eclipse.pde.runtime/src/org/eclipse/pde/internal/runtime/registry/model/ConfigurationElement.java
@@ -0,0 +1,27 @@
+/*******************************************************************************
+ * Copyright (c) 2009 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.pde.internal.runtime.registry.model;
+
+public class ConfigurationElement extends Attribute {
+
+ private Attribute[] elements = new Attribute[0];
+
+ public void setElements(Attribute[] elements) {
+ if (elements == null)
+ throw new IllegalArgumentException();
+
+ this.elements = elements;
+ }
+
+ public Attribute[] getElements() {
+ return elements;
+ }
+}
diff --git a/osgimonitoring/plugins/org.eclipse.pde.runtime/src/org/eclipse/pde/internal/runtime/registry/model/Extension.java b/osgimonitoring/plugins/org.eclipse.pde.runtime/src/org/eclipse/pde/internal/runtime/registry/model/Extension.java
new file mode 100644
index 0000000..fd01c7c
--- /dev/null
+++ b/osgimonitoring/plugins/org.eclipse.pde.runtime/src/org/eclipse/pde/internal/runtime/registry/model/Extension.java
@@ -0,0 +1,122 @@
+/*******************************************************************************
+ * Copyright (c) 2009 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.pde.internal.runtime.registry.model;
+
+public class Extension extends ModelObject {
+
+ private String namespaceIdentifier;
+ private String label;
+ private String extensionPointUniqueIdentifier;
+ private ConfigurationElement[] configurationElements = new ConfigurationElement[0];
+ private Long contributor;
+
+ public void setNamespaceIdentifier(String namespaceIdentifier) {
+ this.namespaceIdentifier = namespaceIdentifier;
+ }
+
+ public void setLabel(String label) {
+ this.label = label;
+ }
+
+ public void setExtensionPointUniqueIdentifier(String extensionPointUniqueIdentifier) {
+ this.extensionPointUniqueIdentifier = extensionPointUniqueIdentifier;
+ }
+
+ public void setConfigurationElements(ConfigurationElement[] configurationElements) {
+ if (configurationElements == null)
+ throw new IllegalArgumentException();
+
+ this.configurationElements = configurationElements;
+ }
+
+ public void setContributor(Long contributor) {
+ this.contributor = contributor;
+ }
+
+ public ConfigurationElement[] getConfigurationElements() {
+ return configurationElements;
+ }
+
+ public String getExtensionPointUniqueIdentifier() {
+ return extensionPointUniqueIdentifier;
+ }
+
+ public String getLabel() {
+ return label;
+ }
+
+ public String getNamespaceIdentifier() {
+ return namespaceIdentifier;
+ }
+
+ /**
+ * @return contributor id or <code>null</code> if contributor not present
+ */
+ public Long getContributorId() {
+ return contributor;
+ }
+
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ Extension other = (Extension) obj;
+ if (contributor == null) {
+ if (other.contributor != null)
+ return false;
+ } else if (!contributor.equals(other.contributor))
+ return false;
+ if (extensionPointUniqueIdentifier == null) {
+ if (other.extensionPointUniqueIdentifier != null)
+ return false;
+ } else if (!extensionPointUniqueIdentifier.equals(other.extensionPointUniqueIdentifier))
+ return false;
+ if (label == null) {
+ if (other.label != null)
+ return false;
+ } else if (!label.equals(other.label))
+ return false;
+ if (namespaceIdentifier == null) {
+ if (other.namespaceIdentifier != null)
+ return false;
+ } else if (!namespaceIdentifier.equals(other.namespaceIdentifier))
+ return false;
+ return true;
+ }
+
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((contributor == null) ? 0 : contributor.hashCode());
+ result = prime * result + ((extensionPointUniqueIdentifier == null) ? 0 : extensionPointUniqueIdentifier.hashCode());
+ result = prime * result + ((label == null) ? 0 : label.hashCode());
+ result = prime * result + ((namespaceIdentifier == null) ? 0 : namespaceIdentifier.hashCode());
+ return result;
+ }
+
+ public ExtensionPoint getExtensionPoint() {
+ if (model == null)
+ return null;
+ return model.getExtensionPoint(extensionPointUniqueIdentifier);
+ }
+
+ /**
+ * @return contributor or <code>null</code> if contributor not present
+ */
+ public Bundle getContributor() {
+ if (model == null || contributor == null)
+ return null;
+ return model.getBundle(contributor);
+ }
+}
diff --git a/osgimonitoring/plugins/org.eclipse.pde.runtime/src/org/eclipse/pde/internal/runtime/registry/model/ExtensionPoint.java b/osgimonitoring/plugins/org.eclipse.pde.runtime/src/org/eclipse/pde/internal/runtime/registry/model/ExtensionPoint.java
new file mode 100644
index 0000000..3a8ecaf
--- /dev/null
+++ b/osgimonitoring/plugins/org.eclipse.pde.runtime/src/org/eclipse/pde/internal/runtime/registry/model/ExtensionPoint.java
@@ -0,0 +1,98 @@
+/*******************************************************************************
+ * Copyright (c) 2009 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.pde.internal.runtime.registry.model;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class ExtensionPoint extends ModelObject {
+
+ private String label;
+ private String uniqueIdentifier;
+ private String namespaceIdentifier;
+ private Long contributor;
+ private List extensions = new ArrayList();
+
+ public void setLabel(String label) {
+ this.label = label;
+ }
+
+ public void setUniqueIdentifier(String uniqueIdentifier) {
+ this.uniqueIdentifier = uniqueIdentifier;
+ }
+
+ public void setNamespaceIdentifier(String namespaceIdentifier) {
+ this.namespaceIdentifier = namespaceIdentifier;
+ }
+
+ public void setContributor(Long contributor) {
+ this.contributor = contributor;
+ }
+
+ public void setExtensions(List extensions) {
+ this.extensions = extensions;
+ }
+
+ public List getExtensions() {
+ return extensions;
+ }
+
+ public String getLabel() {
+ return label;
+ }
+
+ public String getUniqueIdentifier() {
+ return uniqueIdentifier;
+ }
+
+ public String getNamespaceIdentifier() {
+ return namespaceIdentifier;
+ }
+
+ /**
+ * @return contributor id or <code>null</code> if contributor not present
+ */
+ public Long getContributorId() {
+ return contributor;
+ }
+
+ /**
+ * @return contributor or <code>null</code> if contributor not present
+ */
+ public Bundle getContributor() {
+ if (model == null || contributor == null)
+ return null;
+ return model.getBundle(contributor);
+ }
+
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((uniqueIdentifier == null) ? 0 : uniqueIdentifier.hashCode());
+ return result;
+ }
+
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ ExtensionPoint other = (ExtensionPoint) obj;
+ if (uniqueIdentifier == null) {
+ if (other.uniqueIdentifier != null)
+ return false;
+ } else if (!uniqueIdentifier.equals(other.uniqueIdentifier))
+ return false;
+ return true;
+ }
+}
diff --git a/osgimonitoring/plugins/org.eclipse.pde.runtime/src/org/eclipse/pde/internal/runtime/registry/model/Folder.java b/osgimonitoring/plugins/org.eclipse.pde.runtime/src/org/eclipse/pde/internal/runtime/registry/model/Folder.java
new file mode 100644
index 0000000..db8bd37
--- /dev/null
+++ b/osgimonitoring/plugins/org.eclipse.pde.runtime/src/org/eclipse/pde/internal/runtime/registry/model/Folder.java
@@ -0,0 +1,83 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2009 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.pde.internal.runtime.registry.model;
+
+public class Folder {
+
+ public static final int F_EXTENSIONS = 1;
+ public static final int F_EXTENSION_POINTS = 2;
+ public static final int F_IMPORTS = 3;
+ public static final int F_LIBRARIES = 4;
+ public static final int F_REGISTERED_SERVICES = 5;
+ public static final int F_SERVICES_IN_USE = 6;
+ public static final int F_PROPERTIES = 7;
+ public static final int F_USING_BUNDLES = 8;
+ public static final int F_FRAGMENTS = 9;
+ public static final int F_IMPORTED_PACKAGES = 10;
+ public static final int F_EXPORTED_PACKAGES = 11;
+
+ private int id;
+ private Object parent;
+
+ public Folder(int id, Object parent) {
+ this.id = id;
+ this.parent = parent;
+ }
+
+ public int getId() {
+ return id;
+ }
+
+ public Object getParent() {
+ return parent;
+ }
+
+ public ModelObject[] getChildren() {
+ switch (id) {
+ case F_EXTENSION_POINTS :
+ return ((Bundle) parent).getExtensionPoints();
+ case F_EXTENSIONS :
+ return ((Bundle) parent).getExtensions();
+ case F_IMPORTS :
+ return ((Bundle) parent).getImports();
+ case F_LIBRARIES :
+ return ((Bundle) parent).getLibraries();
+ case F_REGISTERED_SERVICES :
+ return ((Bundle) parent).getRegisteredServices();
+ case F_SERVICES_IN_USE :
+ return ((Bundle) parent).getServicesInUse();
+ case F_PROPERTIES :
+ return ((ServiceRegistration) parent).getProperties();
+ case F_USING_BUNDLES :
+ return ((ServiceRegistration) parent).getUsingBundles();
+ case F_FRAGMENTS :
+ return ((Bundle) parent).getFragments();
+ case F_IMPORTED_PACKAGES :
+ return ((Bundle) parent).getImportedPackages();
+ case F_EXPORTED_PACKAGES :
+ return ((Bundle) parent).getExportedPackages();
+ }
+
+ return null;
+ }
+
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + id;
+ result = prime * result + ((parent == null) ? 0 : parent.hashCode());
+ return result;
+ }
+
+ public boolean equals(Object obj) {
+ return ((obj instanceof Folder) && (((Folder) obj).id == id) && (((Folder) obj).parent.equals(parent)));
+ }
+}
diff --git a/osgimonitoring/plugins/org.eclipse.pde.runtime/src/org/eclipse/pde/internal/runtime/registry/model/LocalRegistryBackend.java b/osgimonitoring/plugins/org.eclipse.pde.runtime/src/org/eclipse/pde/internal/runtime/registry/model/LocalRegistryBackend.java
new file mode 100644
index 0000000..eb2078d
--- /dev/null
+++ b/osgimonitoring/plugins/org.eclipse.pde.runtime/src/org/eclipse/pde/internal/runtime/registry/model/LocalRegistryBackend.java
@@ -0,0 +1,495 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2009 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ * Wolfgang Schell <ws@jetztgrad.net> - bug 259348
+ *******************************************************************************/
+package org.eclipse.pde.internal.runtime.registry.model;
+
+import java.io.IOException;
+import java.net.URL;
+import java.util.Arrays;
+import org.eclipse.core.runtime.*;
+import org.eclipse.osgi.service.resolver.*;
+import org.eclipse.osgi.util.ManifestElement;
+import org.eclipse.pde.internal.runtime.*;
+import org.osgi.framework.*;
+import org.osgi.service.packageadmin.PackageAdmin;
+
+public class LocalRegistryBackend implements IRegistryEventListener, BundleListener, ServiceListener, RegistryBackend {
+
+ private BackendChangeListener listener;
+
+ public void setRegistryListener(BackendChangeListener listener) {
+ this.listener = listener;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.pde.internal.runtime.registry.model.local.RegistryBackend#connect()
+ */
+ public void connect(IProgressMonitor monitor) {
+ if (monitor.isCanceled())
+ return;
+
+ PDERuntimePlugin.getDefault().getBundleContext().addBundleListener(this);
+ Platform.getExtensionRegistry().addListener(this);
+ PDERuntimePlugin.getDefault().getBundleContext().addServiceListener(this);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.pde.internal.runtime.registry.model.local.RegistryBackend#disconnect()
+ */
+ public void disconnect() {
+ Platform.getExtensionRegistry().removeListener(this);
+ PDERuntimePlugin.getDefault().getBundleContext().removeBundleListener(this);
+ PDERuntimePlugin.getDefault().getBundleContext().removeServiceListener(this);
+ }
+
+ protected static boolean isRegisteredService(org.osgi.framework.Bundle bundle, ServiceReference ref) {
+ return bundle.equals(ref.getBundle());
+ }
+
+ protected static boolean isServiceInUse(org.osgi.framework.Bundle bundle, ServiceReference ref) {
+ org.osgi.framework.Bundle[] usingBundles = ref.getUsingBundles();
+ return (usingBundles != null && Arrays.asList(usingBundles).contains(bundle));
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.pde.internal.runtime.registry.model.local.RegistryBackend#start(org.osgi.framework.Bundle)
+ */
+ public void start(long id) throws BundleException {
+ PDERuntimePlugin.getDefault().getBundleContext().getBundle(id).start();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.pde.internal.runtime.registry.model.local.RegistryBackend#stop(org.osgi.framework.Bundle)
+ */
+ public void stop(long id) throws BundleException {
+ PDERuntimePlugin.getDefault().getBundleContext().getBundle(id).stop();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.pde.internal.runtime.registry.model.local.RegistryBackend#diagnose(org.osgi.framework.Bundle)
+ */
+ public MultiStatus diagnose(long id) {
+ PlatformAdmin plaformAdmin = PDERuntimePlugin.getDefault().getPlatformAdmin();
+ State state = plaformAdmin.getState(false);
+
+ BundleDescription desc = state.getBundle(id);
+
+ PlatformAdmin platformAdmin = PDERuntimePlugin.getDefault().getPlatformAdmin();
+ VersionConstraint[] unsatisfied = platformAdmin.getStateHelper().getUnsatisfiedConstraints(desc);
+ ResolverError[] resolverErrors = platformAdmin.getState(false).getResolverErrors(desc);
+
+ MultiStatus problems = new MultiStatus(PDERuntimePlugin.ID, IStatus.INFO, PDERuntimeMessages.RegistryView_found_problems, null);
+ for (int i = 0; i < resolverErrors.length; i++) {
+ if ((resolverErrors[i].getType() & (ResolverError.MISSING_FRAGMENT_HOST | ResolverError.MISSING_GENERIC_CAPABILITY | ResolverError.MISSING_IMPORT_PACKAGE | ResolverError.MISSING_REQUIRE_BUNDLE)) != 0)
+ continue;
+ IStatus status = new Status(IStatus.WARNING, PDERuntimePlugin.ID, resolverErrors[i].toString());
+ problems.add(status);
+ }
+
+ for (int i = 0; i < unsatisfied.length; i++) {
+ IStatus status = new Status(IStatus.WARNING, PDERuntimePlugin.ID, MessageHelper.getResolutionFailureMessage(unsatisfied[i]));
+ problems.add(status);
+ }
+
+ return problems;
+ }
+
+ public void initializeBundles(IProgressMonitor monitor) {
+ if (monitor.isCanceled())
+ return;
+
+ org.osgi.framework.Bundle[] newBundles = PDERuntimePlugin.getDefault().getBundleContext().getBundles();
+ for (int i = 0; i < newBundles.length; i++) {
+ if (monitor.isCanceled())
+ return;
+
+ Bundle ba = createBundleAdapter(newBundles[i]);
+ listener.addBundle(ba);
+ }
+ }
+
+ public void initializeExtensionPoints(IProgressMonitor monitor) {
+ if (monitor.isCanceled())
+ return;
+
+ IExtensionPoint[] extPoints = Platform.getExtensionRegistry().getExtensionPoints();
+ ExtensionPoint[] extPts = new ExtensionPoint[extPoints.length];
+ for (int i = 0; i < extPoints.length; i++) {
+ if (monitor.isCanceled())
+ return;
+
+ extPts[i] = createExtensionPointAdapter(extPoints[i]);
+ }
+ listener.addExtensionPoints(extPts);
+ }
+
+ public void initializeServices(IProgressMonitor monitor) {
+ if (monitor.isCanceled())
+ return;
+
+ ServiceReference[] references = null;
+ try {
+ references = PDERuntimePlugin.getDefault().getBundleContext().getAllServiceReferences(null, null);
+ } catch (InvalidSyntaxException e) { // nothing
+ }
+
+ if (references == null) {
+ return;
+ }
+
+ for (int i = 0; i < references.length; i++) {
+ if (monitor.isCanceled())
+ return;
+
+ ServiceRegistration service = createServiceReferenceAdapter(references[i]);
+ listener.addService(service);
+ }
+ }
+
+ private Bundle createBundleAdapter(org.osgi.framework.Bundle bundle) {
+ Bundle adapter = new Bundle();
+ adapter.setSymbolicName(bundle.getSymbolicName());
+ adapter.setVersion((String) bundle.getHeaders().get(org.osgi.framework.Constants.BUNDLE_VERSION));
+ adapter.setState(bundle.getState());
+ adapter.setId(bundle.getBundleId());
+ adapter.setEnabled(getIsEnabled(bundle));
+ adapter.setLocation(createLocation(bundle));
+
+ String fragmentHost = (String) bundle.getHeaders().get(Constants.FRAGMENT_HOST);
+ if (fragmentHost != null) {
+ ManifestElement[] header;
+ try {
+ header = ManifestElement.parseHeader(Constants.FRAGMENT_HOST, fragmentHost);
+
+ if (header.length > 0) {
+ ManifestElement host = header[0];
+ adapter.setFragmentHost(host.getValue());
+ String version = host.getAttribute(Constants.BUNDLE_VERSION_ATTRIBUTE);
+ if (version != null) {
+ adapter.setFragmentHostVersion(version);
+ }
+ }
+ } catch (BundleException e) {
+ PDERuntimePlugin.log(e);
+ }
+ }
+
+ BundlePrerequisite[] imports = (BundlePrerequisite[]) getManifestHeaderArray(bundle, Constants.REQUIRE_BUNDLE);
+ if (imports != null)
+ adapter.setImports(imports);
+
+ BundleLibrary[] libraries = (BundleLibrary[]) getManifestHeaderArray(bundle, Constants.BUNDLE_CLASSPATH);
+ if (libraries != null)
+ adapter.setLibraries(libraries);
+
+ BundlePrerequisite[] importPackages = (BundlePrerequisite[]) getManifestHeaderArray(bundle, Constants.IMPORT_PACKAGE);
+ if (importPackages != null)
+ adapter.setImportedPackages(importPackages);
+
+ BundlePrerequisite[] exportPackages = (BundlePrerequisite[]) getManifestHeaderArray(bundle, Constants.EXPORT_PACKAGE);
+ if (exportPackages != null)
+ adapter.setExportedPackages(exportPackages);
+
+ return adapter;
+ }
+
+ private Extension createExtensionAdapter(IExtension extension) {
+ Extension adapter = new Extension();
+ adapter.setNamespaceIdentifier(extension.getNamespaceIdentifier());
+ adapter.setLabel(extension.getLabel());
+ adapter.setExtensionPointUniqueIdentifier(extension.getExtensionPointUniqueIdentifier());
+ adapter.setContributor(getBundleId(extension.getContributor().getName()));
+
+ IConfigurationElement[] elements = extension.getConfigurationElements();
+ if (elements.length > 0) {
+ ConfigurationElement[] configurationElements = new ConfigurationElement[elements.length];
+ for (int i = 0; i < elements.length; i++) {
+ configurationElements[i] = createConfigurationElement(elements[i]);
+ }
+ adapter.setConfigurationElements(configurationElements);
+ }
+
+ return adapter;
+ }
+
+ private ConfigurationElement createConfigurationElement(IConfigurationElement config) {
+ ConfigurationElement element = new ConfigurationElement();
+ element.setName(createName(config));
+ Attribute[] attributes = createConfigurationElementAttributes(config);
+ if (attributes != null)
+ element.setElements(attributes);
+ return element;
+ }
+
+ private static Long getBundleId(String name) {
+ BundleDescription descr = PDERuntimePlugin.getDefault().getPlatformAdmin().getState().getBundle(name, null);
+ return descr == null ? null : new Long(descr.getBundleId());
+ }
+
+ private ExtensionPoint createExtensionPointAdapter(IExtensionPoint extensionPoint) {
+ ExtensionPoint adapter = new ExtensionPoint();
+ adapter.setLabel(extensionPoint.getLabel());
+ adapter.setUniqueIdentifier(extensionPoint.getUniqueIdentifier());
+ adapter.setNamespaceIdentifier(extensionPoint.getNamespaceIdentifier());
+ adapter.setContributor(getBundleId(extensionPoint.getContributor().getName()));
+
+ Extension[] extensions = createExtensionAdapters(extensionPoint.getExtensions());
+ adapter.getExtensions().addAll(Arrays.asList(extensions));
+ return adapter;
+ }
+
+ private ServiceRegistration createServiceReferenceAdapter(ServiceReference ref) {
+ ServiceRegistration service = new ServiceRegistration();
+ service.setId(((Long) ref.getProperty(org.osgi.framework.Constants.SERVICE_ID)).longValue());
+ service.setBundle(ref.getBundle().getSymbolicName());
+
+ org.osgi.framework.Bundle[] usingBundles = ref.getUsingBundles();
+ long[] usingBundlesIds = null;
+ if (usingBundles != null) {
+ usingBundlesIds = new long[usingBundles.length];
+ for (int i = 0; i < usingBundles.length; i++) {
+ usingBundlesIds[i] = usingBundles[i].getBundleId();
+ }
+ }
+ if (usingBundlesIds != null)
+ service.setUsingBundles(usingBundlesIds);
+
+ String[] classes = (String[]) ref.getProperty(org.osgi.framework.Constants.OBJECTCLASS);
+ String[] propertyKeys = ref.getPropertyKeys();
+ Property[] properties = null;
+ if (propertyKeys != null) {
+ properties = new Property[propertyKeys.length];
+ for (int p = 0; p < propertyKeys.length; p++) {
+ String key = propertyKeys[p];
+ Object value = ref.getProperty(key);
+ properties[p] = new Property(key, ServiceRegistration.toString(value));
+ }
+ }
+
+ if (classes != null) {
+ Arrays.sort(classes);
+ service.setName(new ServiceName(classes));
+ service.setProperties(properties);
+ }
+ return service;
+ }
+
+ private static boolean getIsEnabled(org.osgi.framework.Bundle bundle) {
+ PlatformAdmin plaformAdmin = PDERuntimePlugin.getDefault().getPlatformAdmin();
+ State state = plaformAdmin.getState(false);
+
+ BundleDescription description = state.getBundle(bundle.getBundleId());
+ return (state.getDisabledInfos(description)).length == 0;
+ }
+
+ private static String createLocation(org.osgi.framework.Bundle bundle) {
+ URL bundleEntry = null;
+
+ try {
+ bundleEntry = bundle.getEntry("/"); //$NON-NLS-1$
+ } catch (IllegalStateException e) {
+ return null;
+ }
+
+ try {
+ bundleEntry = FileLocator.resolve(bundleEntry);
+ } catch (IOException e) { // do nothing
+ }
+ IPath path = new Path(bundleEntry.getFile());
+ String pathString = path.removeTrailingSeparator().toOSString();
+ if (pathString.startsWith("file:")) //$NON-NLS-1$
+ pathString = pathString.substring(5);
+ if (pathString.endsWith("!")) //$NON-NLS-1$
+ pathString = pathString.substring(0, pathString.length() - 1);
+ return pathString;
+ }
+
+ private Object[] getManifestHeaderArray(org.osgi.framework.Bundle bundle, String headerKey) {
+ String libraries = (String) bundle.getHeaders().get(headerKey);
+ try {
+ ManifestElement[] elements = ManifestElement.parseHeader(headerKey, libraries);
+ if (elements == null)
+ return null;
+ if (headerKey.equals(Constants.BUNDLE_CLASSPATH)) {
+ BundleLibrary[] array = new BundleLibrary[elements.length];
+ for (int i = 0; i < elements.length; i++) {
+ BundleLibrary library = new BundleLibrary();
+ library.setLibrary(elements[i].getValue());
+ array[i] = library;
+ }
+ return array;
+ } else if (headerKey.equals(Constants.REQUIRE_BUNDLE) || headerKey.equals(Constants.IMPORT_PACKAGE) || headerKey.equals(Constants.EXPORT_PACKAGE)) {
+ BundlePrerequisite[] array = new BundlePrerequisite[elements.length];
+ for (int i = 0; i < elements.length; i++) {
+ ManifestElement element = elements[i];
+
+ BundlePrerequisite prereq = new BundlePrerequisite();
+ prereq.setName(element.getValue());
+ if (headerKey.equals(Constants.REQUIRE_BUNDLE)) {
+ prereq.setVersion(element.getAttribute(Constants.BUNDLE_VERSION_ATTRIBUTE));
+ String visibility = element.getDirective(Constants.VISIBILITY_DIRECTIVE);
+ prereq.setExported(Constants.VISIBILITY_REEXPORT.equals(visibility));
+ } else {
+ prereq.setVersion(element.getAttribute(Constants.VERSION_ATTRIBUTE));
+ prereq.setPackage(true);
+ }
+
+ array[i] = prereq;
+ }
+ return array;
+ }
+ } catch (BundleException e) { // do nothing
+ }
+ return null;
+ }
+
+ private Attribute[] createConfigurationElementAttributes(IConfigurationElement config) {
+ String[] atts = config.getAttributeNames();
+
+ Attribute[] catts = new Attribute[atts.length];
+ for (int i = 0; i < atts.length; i++)
+ catts[i] = new Attribute(atts[i], config.getAttribute(atts[i]));
+
+ IConfigurationElement[] children = config.getChildren();
+ Attribute[] result = new Attribute[children.length + catts.length];
+ for (int i = 0; i < children.length; i++) {
+ IConfigurationElement child = children[i];
+ result[i] = createConfigurationElement(child);
+ }
+ for (int i = 0; i < catts.length; i++) {
+ result[children.length + i] = catts[i];
+ }
+ return result;
+ }
+
+ private static String createName(IConfigurationElement config) {
+ String label = config.getAttribute("label"); //$NON-NLS-1$
+ if (label == null)
+ label = config.getName();
+
+ if (label == null)
+ label = config.getAttribute("name"); //$NON-NLS-1$
+
+ if (label == null && config.getAttribute("id") != null) { //$NON-NLS-1$
+ String[] labelSplit = config.getAttribute("id").split("\\."); //$NON-NLS-1$ //$NON-NLS-2$
+ label = labelSplit.length == 0 ? null : labelSplit[labelSplit.length - 1];
+ }
+
+ return label;
+ }
+
+ private Extension[] createExtensionAdapters(IExtension[] extensions) {
+ Extension[] extensionAdapters = new Extension[extensions.length];
+ for (int i = 0; i < extensions.length; i++) {
+ extensionAdapters[i] = createExtensionAdapter(extensions[i]);
+ }
+ return extensionAdapters;
+ }
+
+ public void bundleChanged(BundleEvent event) {
+ Bundle adapter = createBundleAdapter(event.getBundle());
+
+ switch (event.getType()) {
+ case BundleEvent.INSTALLED :
+ listener.addBundle(adapter);
+ break;
+ case BundleEvent.UNINSTALLED :
+ listener.removeBundle(adapter);
+ break;
+ case BundleEvent.UPDATED :
+ listener.updateBundle(adapter, ModelChangeDelta.UPDATED);
+ break;
+ case BundleEvent.RESOLVED :
+ listener.updateBundle(adapter, ModelChangeDelta.RESOLVED);
+ break;
+ case BundleEvent.UNRESOLVED :
+ listener.updateBundle(adapter, ModelChangeDelta.UNRESOLVED);
+ break;
+ case BundleEvent.STARTING :
+ listener.updateBundle(adapter, ModelChangeDelta.STARTING);
+ break;
+ case BundleEvent.STARTED :
+ listener.updateBundle(adapter, ModelChangeDelta.STARTED);
+ break;
+ case BundleEvent.STOPPING :
+ listener.updateBundle(adapter, ModelChangeDelta.STOPPING);
+ break;
+ case BundleEvent.STOPPED :
+ listener.updateBundle(adapter, ModelChangeDelta.STOPPED);
+ break;
+ default :
+ listener.updateBundle(adapter, ModelChangeDelta.UPDATED);
+ }
+ }
+
+ public void serviceChanged(ServiceEvent event) {
+ ServiceReference ref = event.getServiceReference();
+ ServiceRegistration adapter = createServiceReferenceAdapter(ref);
+
+ switch (event.getType()) {
+ case ServiceEvent.REGISTERED :
+ listener.addService(adapter);
+ break;
+ case ServiceEvent.UNREGISTERING :
+ listener.removeService(adapter);
+ break;
+ case ServiceEvent.MODIFIED :
+ default :
+ listener.updateService(adapter);
+ break;
+ }
+ }
+
+ private ExtensionPoint[] createExtensionPointAdapters(IExtensionPoint[] extensionPoints) {
+ ExtensionPoint[] result = new ExtensionPoint[extensionPoints.length];
+ for (int i = 0; i < extensionPoints.length; i++) {
+ result[i] = createExtensionPointAdapter(extensionPoints[i]);
+ }
+ return result;
+ }
+
+ public void added(IExtension[] extensions) {
+ listener.addExtensions(createExtensionAdapters(extensions));
+ }
+
+ public void removed(IExtension[] extensions) {
+ listener.removeExtensions(createExtensionAdapters(extensions));
+ }
+
+ public void added(IExtensionPoint[] extensionPoints) {
+ listener.addExtensionPoints(createExtensionPointAdapters(extensionPoints));
+ }
+
+ public void removed(IExtensionPoint[] extensionPoints) {
+ listener.removeExtensionPoints(createExtensionPointAdapters(extensionPoints));
+ }
+
+ public void setEnabled(long id, boolean enabled) {
+ State state = PDERuntimePlugin.getDefault().getState();
+ BundleDescription desc = state.getBundle(id);
+
+ if (enabled) {
+ DisabledInfo[] infos = state.getDisabledInfos(desc);
+ for (int i = 0; i < infos.length; i++) {
+ PlatformAdmin platformAdmin = PDERuntimePlugin.getDefault().getPlatformAdmin();
+ platformAdmin.removeDisabledInfo(infos[i]);
+ }
+ } else {
+ DisabledInfo info = new DisabledInfo("org.eclipse.pde.ui", "Disabled via PDE", desc); //$NON-NLS-1$ //$NON-NLS-2$
+ PlatformAdmin platformAdmin = PDERuntimePlugin.getDefault().getPlatformAdmin();
+ platformAdmin.addDisabledInfo(info);
+ }
+
+ org.osgi.framework.Bundle b = PDERuntimePlugin.getDefault().getBundleContext().getBundle(id);
+ PackageAdmin packageAdmin = PDERuntimePlugin.getDefault().getPackageAdmin();
+ packageAdmin.refreshPackages(new org.osgi.framework.Bundle[] {b});
+ }
+}
diff --git a/osgimonitoring/plugins/org.eclipse.pde.runtime/src/org/eclipse/pde/internal/runtime/registry/model/ModelChangeDelta.java b/osgimonitoring/plugins/org.eclipse.pde.runtime/src/org/eclipse/pde/internal/runtime/registry/model/ModelChangeDelta.java
new file mode 100644
index 0000000..2156b91
--- /dev/null
+++ b/osgimonitoring/plugins/org.eclipse.pde.runtime/src/org/eclipse/pde/internal/runtime/registry/model/ModelChangeDelta.java
@@ -0,0 +1,43 @@
+/*******************************************************************************
+ * Copyright (c) 2008 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.pde.internal.runtime.registry.model;
+
+/**
+ * Delta model objects are of type IBundle, IService, IExtension, IExtensionPoint
+ */
+public class ModelChangeDelta {
+
+ public static final int ADDED = 0;
+ public static final int UPDATED = 1;
+ public static final int REMOVED = 2;
+ public static final int STARTING = 3;
+ public static final int STARTED = 4;
+ public static final int STOPPING = 5;
+ public static final int STOPPED = 6;
+ public static final int RESOLVED = 7;
+ public static final int UNRESOLVED = 8;
+
+ private ModelObject fObject;
+ private int fFlag;
+
+ public ModelChangeDelta(ModelObject object, int flag) {
+ fObject = object;
+ fFlag = flag;
+ }
+
+ public ModelObject getModelObject() {
+ return fObject;
+ }
+
+ public int getFlag() {
+ return fFlag;
+ }
+}
diff --git a/osgimonitoring/plugins/org.eclipse.pde.runtime/src/org/eclipse/pde/internal/runtime/registry/model/ModelChangeListener.java b/osgimonitoring/plugins/org.eclipse.pde.runtime/src/org/eclipse/pde/internal/runtime/registry/model/ModelChangeListener.java
new file mode 100644
index 0000000..b02cf81
--- /dev/null
+++ b/osgimonitoring/plugins/org.eclipse.pde.runtime/src/org/eclipse/pde/internal/runtime/registry/model/ModelChangeListener.java
@@ -0,0 +1,22 @@
+/*******************************************************************************
+ * Copyright (c) 2008 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.pde.internal.runtime.registry.model;
+
+/**
+ * Event provides a list of objects that have changed.
+ * Possible objects on the list are IBundle, IService, IExtension, IExtensionPoint.
+ *
+ * This is temporary solution and is subject to future changes.
+ */
+public interface ModelChangeListener {
+
+ void modelChanged(ModelChangeDelta[] deltas);
+}
diff --git a/osgimonitoring/plugins/org.eclipse.pde.runtime/src/org/eclipse/pde/internal/runtime/registry/model/ModelObject.java b/osgimonitoring/plugins/org.eclipse.pde.runtime/src/org/eclipse/pde/internal/runtime/registry/model/ModelObject.java
new file mode 100644
index 0000000..22c0ad2
--- /dev/null
+++ b/osgimonitoring/plugins/org.eclipse.pde.runtime/src/org/eclipse/pde/internal/runtime/registry/model/ModelObject.java
@@ -0,0 +1,20 @@
+/*******************************************************************************
+ * Copyright (c) 2008 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.pde.internal.runtime.registry.model;
+
+public abstract class ModelObject {
+
+ protected RegistryModel model;
+
+ public void setModel(RegistryModel model) {
+ this.model = model;
+ }
+}
diff --git a/osgimonitoring/plugins/org.eclipse.pde.runtime/src/org/eclipse/pde/internal/runtime/registry/model/Property.java b/osgimonitoring/plugins/org.eclipse.pde.runtime/src/org/eclipse/pde/internal/runtime/registry/model/Property.java
new file mode 100644
index 0000000..d0d999c
--- /dev/null
+++ b/osgimonitoring/plugins/org.eclipse.pde.runtime/src/org/eclipse/pde/internal/runtime/registry/model/Property.java
@@ -0,0 +1,134 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2009 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ * Wolfgang Schell <ws@jetztgrad.net> - bug 260055
+ *******************************************************************************/
+package org.eclipse.pde.internal.runtime.registry.model;
+
+import org.osgi.framework.Constants;
+
+public class Property extends ModelObject implements Comparable {
+ public static final String PREFIX_SERVICE = "service."; //$NON-NLS-1$
+ public static final String PREFIX_COMPONENT = "component."; //$NON-NLS-1$
+
+ private String name;
+ private String value;
+
+ public Property() {
+ // empty
+ }
+
+ // TODO should we merge this with Attribute somehow?
+ public Property(String name, String value) {
+ this.name = name;
+ this.value = value;
+ }
+
+ public String getValue() {
+ return value;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public void setValue(String value) {
+ this.value = value;
+ }
+
+ /**
+ * Compare properties for order. Returns a negative integer, zero, or a positive
+ * integer as the first argument is less than, equal to, or greater than the second.
+ *
+ * <p>
+ * The {@link Property}s are compared according to the following rules:
+ * <ul>
+ * <li>objectClass is always less than everything else</li>
+ * <li>properties with names starting with "service." are considered "less"
+ * than other properties.</li>
+ * <li>regular properties are considered "more" than other properties</li>
+ * </ul>
+ * </p>
+ *
+ * <p>
+ * When sorting an array of properties with the following code:
+ *
+ * <pre>
+ * Property[] properties = ...;
+ * Arrays.sort(properties, PropertyComparator.INSTANCE);
+ * </pre>
+ *
+ * the result is something like this:
+ * <ul>
+ * <li>objectClass</li>
+ * <li>service.id</li>
+ * <li>service.id</li>
+ * </ul>
+ * </p>
+ *
+ * @param obj other property to be compared against
+ *
+ * @return a negative integer, zero, or a positive integer as the first
+ * argument is less than, equal to, or greater than the second.
+ */
+ public int compareTo(Object obj) {
+ if (!(obj instanceof Property)) {
+ return 0;
+ }
+
+ Property other = (Property) obj;
+
+ String name0 = getName();
+ String name1 = other.getName();
+
+ if (Constants.OBJECTCLASS.equals(name0)) {
+ return -1;
+ }
+
+ if (Constants.OBJECTCLASS.equals(name1)) {
+ return 1;
+ }
+
+ if (name0.startsWith(PREFIX_COMPONENT) && name1.startsWith(PREFIX_COMPONENT)) {
+ // both are service properties
+ // simply compare them
+ return name0.compareTo(name1);
+ }
+
+ if (name0.startsWith(PREFIX_COMPONENT)) {
+ return -1;
+ }
+
+ if (name1.startsWith(PREFIX_COMPONENT)) {
+ return 1;
+ }
+
+ if (name0.startsWith(PREFIX_SERVICE) && name1.startsWith(PREFIX_SERVICE)) {
+ // both are service properties
+ // simply compare them
+ return name0.compareTo(name1);
+ }
+
+ if (name0.startsWith(PREFIX_SERVICE)) {
+ return -1;
+ }
+
+ if (name1.startsWith(PREFIX_SERVICE)) {
+ return 1;
+ }
+
+ // simply compare strings
+ return name0.compareTo(name1);
+ }
+
+}
diff --git a/osgimonitoring/plugins/org.eclipse.pde.runtime/src/org/eclipse/pde/internal/runtime/registry/model/RegistryBackend.java b/osgimonitoring/plugins/org.eclipse.pde.runtime/src/org/eclipse/pde/internal/runtime/registry/model/RegistryBackend.java
new file mode 100644
index 0000000..552da20
--- /dev/null
+++ b/osgimonitoring/plugins/org.eclipse.pde.runtime/src/org/eclipse/pde/internal/runtime/registry/model/RegistryBackend.java
@@ -0,0 +1,39 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2009 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.pde.internal.runtime.registry.model;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.MultiStatus;
+import org.osgi.framework.BundleException;
+
+public interface RegistryBackend {
+
+ public void connect(IProgressMonitor monitor);
+
+ public void disconnect();
+
+ public void setEnabled(long id, boolean enabled);
+
+ public void start(long id) throws BundleException;
+
+ public void stop(long id) throws BundleException;
+
+ public MultiStatus diagnose(long id);
+
+ public void initializeBundles(IProgressMonitor monitor);
+
+ public void initializeExtensionPoints(IProgressMonitor monitor);
+
+ public void setRegistryListener(BackendChangeListener listener);
+
+ public void initializeServices(IProgressMonitor monitor);
+
+}
\ No newline at end of file
diff --git a/osgimonitoring/plugins/org.eclipse.pde.runtime/src/org/eclipse/pde/internal/runtime/registry/model/RegistryModel.java b/osgimonitoring/plugins/org.eclipse.pde.runtime/src/org/eclipse/pde/internal/runtime/registry/model/RegistryModel.java
new file mode 100644
index 0000000..75688dd
--- /dev/null
+++ b/osgimonitoring/plugins/org.eclipse.pde.runtime/src/org/eclipse/pde/internal/runtime/registry/model/RegistryModel.java
@@ -0,0 +1,394 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2009 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.pde.internal.runtime.registry.model;
+
+import java.util.*;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.osgi.service.resolver.VersionRange;
+import org.osgi.framework.Version;
+
+/**
+ * Model entry point for Eclipse runtime. Provides information about runtime bundles, services and extension points.
+ */
+public class RegistryModel {
+
+ private BackendChangeListener backendListener = new BackendChangeListener() {
+ public void addBundle(Bundle adapter) {
+ adapter.setModel(RegistryModel.this);
+ ModelChangeDelta delta = new ModelChangeDelta(adapter, ModelChangeDelta.ADDED);
+
+ bundles.put(new Long(adapter.getId()), adapter);
+
+ if (adapter.getFragmentHost() != null) {
+ addFragment(adapter);
+
+ Bundle host = getBundle(adapter.getFragmentHost(), adapter.getFragmentHostVersion());
+ if (host != null) {
+ ModelChangeDelta d2 = new ModelChangeDelta(host, ModelChangeDelta.UPDATED);
+ fireModelChangeEvent(new ModelChangeDelta[] {delta, d2});
+ return;
+ }
+ }
+
+ fireModelChangeEvent(new ModelChangeDelta[] {delta});
+ }
+
+ public void removeBundle(Bundle adapter) {
+ ModelChangeDelta delta = new ModelChangeDelta(adapter, ModelChangeDelta.REMOVED);
+
+ bundles.remove(new Long(adapter.getId()));
+
+ if (adapter.getFragmentHost() != null) {
+ removeFragment(adapter);
+
+ Bundle host = getBundle(adapter.getFragmentHost(), adapter.getFragmentHostVersion());
+ if (host != null) {
+ ModelChangeDelta d2 = new ModelChangeDelta(host, ModelChangeDelta.UPDATED);
+ fireModelChangeEvent(new ModelChangeDelta[] {delta, d2});
+ return;
+ }
+ }
+
+ fireModelChangeEvent(new ModelChangeDelta[] {delta});
+ adapter.setModel(null);
+ }
+
+ public void updateBundle(Bundle adapter, int updated) {
+ adapter.setModel(RegistryModel.this);
+ ModelChangeDelta delta = new ModelChangeDelta(adapter, updated);
+
+ bundles.put(new Long(adapter.getId()), adapter); // replace old with new one
+
+ if (adapter.getFragmentHost() != null) {
+ addFragment(adapter);
+ }
+
+ fireModelChangeEvent(new ModelChangeDelta[] {delta});
+ }
+
+ public void addService(ServiceRegistration adapter) {
+ ModelChangeDelta serviceNameDelta = null;
+ if (!serviceNames.contains(adapter.getName())) {
+ ServiceName name = adapter.getName();
+ name.setModel(RegistryModel.this);
+
+ serviceNames.add(name);
+
+ serviceNameDelta = new ModelChangeDelta(name, ModelChangeDelta.ADDED);
+ }
+
+ adapter.setModel(RegistryModel.this);
+ services.put(new Long(adapter.getId()), adapter);
+
+ ModelChangeDelta delta = new ModelChangeDelta(adapter, ModelChangeDelta.ADDED);
+
+ if (serviceNameDelta != null) {
+ fireModelChangeEvent(new ModelChangeDelta[] {serviceNameDelta, delta});
+ } else {
+ fireModelChangeEvent(new ModelChangeDelta[] {delta});
+ }
+ }
+
+ public void removeService(ServiceRegistration adapter) {
+ ModelChangeDelta serviceNameDelta = null;
+ if (getServices(adapter.getName().getClasses()).length == 0) {
+ serviceNames.remove(adapter.getName());
+ serviceNameDelta = new ModelChangeDelta(adapter.getName(), ModelChangeDelta.REMOVED);
+ }
+
+ services.remove(new Long(adapter.getId()));
+
+ ModelChangeDelta delta = new ModelChangeDelta(adapter, ModelChangeDelta.REMOVED);
+
+ if (serviceNameDelta != null) {
+ fireModelChangeEvent(new ModelChangeDelta[] {serviceNameDelta, delta});
+ adapter.getName().setModel(null);
+ adapter.setModel(null);
+ } else {
+ fireModelChangeEvent(new ModelChangeDelta[] {delta});
+ adapter.setModel(null);
+ }
+ }
+
+ public void updateService(ServiceRegistration adapter) {
+ adapter.setModel(RegistryModel.this);
+ services.put(new Long(adapter.getId()), adapter);
+
+ ModelChangeDelta delta = new ModelChangeDelta(adapter, ModelChangeDelta.UPDATED);
+
+ fireModelChangeEvent(new ModelChangeDelta[] {delta});
+ }
+
+ public void addExtensions(Extension[] extensionAdapters) {
+ for (int i = 0; i < extensionAdapters.length; i++) {
+ extensionAdapters[i].setModel(RegistryModel.this);
+ String id = extensionAdapters[i].getExtensionPointUniqueIdentifier();
+ ExtensionPoint extPoint = (ExtensionPoint) extensionPoints.get(id);
+ extPoint.getExtensions().add(extensionAdapters[i]);
+ }
+
+ ModelChangeDelta[] delta = new ModelChangeDelta[extensionAdapters.length];
+ for (int i = 0; i < delta.length; i++) {
+ delta[i] = new ModelChangeDelta(extensionAdapters[i], ModelChangeDelta.ADDED);
+ }
+ fireModelChangeEvent(delta);
+ }
+
+ public void removeExtensions(Extension[] extensionAdapters) {
+ for (int i = 0; i < extensionAdapters.length; i++) {
+ String id = extensionAdapters[i].getExtensionPointUniqueIdentifier();
+ ExtensionPoint extPoint = (ExtensionPoint) extensionPoints.get(id);
+ extPoint.getExtensions().remove(extensionAdapters[i]);
+ }
+
+ ModelChangeDelta[] delta = new ModelChangeDelta[extensionAdapters.length];
+ for (int i = 0; i < delta.length; i++) {
+ delta[i] = new ModelChangeDelta(extensionAdapters[i], ModelChangeDelta.REMOVED);
+ }
+ fireModelChangeEvent(delta);
+
+ for (int i = 0; i < extensionAdapters.length; i++) {
+ extensionAdapters[i].setModel(null);
+ }
+ }
+
+ public void addExtensionPoints(ExtensionPoint[] extensionPointAdapters) {
+ for (int i = 0; i < extensionPointAdapters.length; i++) {
+ extensionPointAdapters[i].setModel(RegistryModel.this);
+ extensionPoints.put(extensionPointAdapters[i].getUniqueIdentifier(), extensionPointAdapters[i]);
+ }
+
+ ModelChangeDelta[] delta = new ModelChangeDelta[extensionPointAdapters.length];
+ for (int i = 0; i < delta.length; i++) {
+ delta[i] = new ModelChangeDelta(extensionPointAdapters[i], ModelChangeDelta.ADDED);
+ }
+ fireModelChangeEvent(delta);
+ }
+
+ public void removeExtensionPoints(ExtensionPoint[] extensionPointAdapters) {
+ for (int i = 0; i < extensionPointAdapters.length; i++) {
+ extensionPoints.remove(extensionPointAdapters[i].getUniqueIdentifier());
+ }
+
+ ModelChangeDelta[] delta = new ModelChangeDelta[extensionPointAdapters.length];
+ for (int i = 0; i < delta.length; i++) {
+ delta[i] = new ModelChangeDelta(extensionPointAdapters[i], ModelChangeDelta.REMOVED);
+ }
+ fireModelChangeEvent(delta);
+
+ for (int i = 0; i < extensionPointAdapters.length; i++) {
+ extensionPointAdapters[i].setModel(null);
+ }
+ }
+ };
+
+ private List listeners = new ArrayList();
+ private Map bundles;
+ private Map services;
+ private Map extensionPoints;
+ private Set serviceNames;
+ private Map fragments;
+
+ protected RegistryBackend backend;
+
+ public RegistryModel(RegistryBackend backend) {
+ bundles = Collections.synchronizedMap(new HashMap());
+ services = Collections.synchronizedMap(new HashMap());
+ extensionPoints = Collections.synchronizedMap(new HashMap());
+ serviceNames = Collections.synchronizedSet(new HashSet());
+ fragments = Collections.synchronizedMap(new HashMap());
+
+ this.backend = backend;
+ backend.setRegistryListener(backendListener);
+ }
+
+ protected void addFragment(Bundle fragment) {
+ Set hostFragments = (Set) fragments.get(fragment.getFragmentHost());
+ if (hostFragments == null) {
+ hostFragments = Collections.synchronizedSet(new HashSet());
+ fragments.put(fragment.getFragmentHost(), hostFragments);
+ }
+
+ if (!hostFragments.add(fragment)) {
+ // not added if element already exists. So remove old and add it again.
+ hostFragments.remove(fragment);
+ hostFragments.add(fragment);
+ }
+ }
+
+ protected void removeFragment(Bundle fragment) {
+ Set hostFragments = (Set) fragments.get(fragment.getFragmentHost());
+ if (hostFragments == null) {
+ return;
+ }
+
+ hostFragments.remove(fragment);
+ }
+
+ public void connect(IProgressMonitor monitor, boolean forceInit) {
+ backend.connect(monitor);
+
+ if (forceInit) {
+ initialize(monitor);
+ }
+ }
+
+ public void initialize(IProgressMonitor monitor) {
+ backend.initializeBundles(monitor);
+ backend.initializeServices(monitor);
+ backend.initializeExtensionPoints(monitor);
+ }
+
+ public void disconnect() {
+ backend.disconnect();
+ }
+
+ public Bundle[] getBundles() {
+ return (Bundle[]) bundles.values().toArray(new Bundle[bundles.values().size()]);
+ }
+
+ public ExtensionPoint[] getExtensionPoints() {
+ return (ExtensionPoint[]) extensionPoints.values().toArray(new ExtensionPoint[extensionPoints.values().size()]);
+ }
+
+ public ServiceRegistration[] getServices() {
+ return (ServiceRegistration[]) services.values().toArray(new ServiceRegistration[services.values().size()]);
+ }
+
+ public ServiceName[] getServiceNames() {
+ return (ServiceName[]) serviceNames.toArray(new ServiceName[serviceNames.size()]);
+ }
+
+ public ServiceRegistration[] getServices(String[] classes) {
+ List result = new ArrayList();
+
+ for (Iterator i = services.values().iterator(); i.hasNext();) {
+ ServiceRegistration sr = (ServiceRegistration) i.next();
+ if (Arrays.equals(classes, sr.getName().getClasses()))
+ result.add(sr);
+ }
+
+ return (ServiceRegistration[]) result.toArray(new ServiceRegistration[result.size()]);
+ }
+
+ public void addModelChangeListener(ModelChangeListener listener) {
+ listeners.add(listener);
+ }
+
+ public void removeModelChangeListener(ModelChangeListener listener) {
+ listeners.remove(listener);
+ }
+
+ /**
+ * For received domain types: Bundle, IExtension, IExtensionPoint, ServiceReference,
+ * generates delta with model types: IBundle, IExtensionAdapter, IExtensionPointAdapter, IService
+ *
+ * @param objects
+ */
+ protected void fireModelChangeEvent(ModelChangeDelta[] delta) {
+ for (Iterator i = listeners.iterator(); i.hasNext();) {
+ ModelChangeListener listener = (ModelChangeListener) i.next();
+ listener.modelChanged(delta);
+ }
+ }
+
+ public Bundle getBundle(Long id) {
+ return (Bundle) bundles.get(id);
+ }
+
+ public Bundle getBundle(String symbolicName, String versionRange) {
+ for (Iterator i = bundles.values().iterator(); i.hasNext();) {
+ Bundle bundle = (Bundle) i.next();
+
+ if (bundle.getSymbolicName().equals(symbolicName)) {
+ if (versionMatches(bundle.getVersion(), versionRange))
+ return bundle;
+ }
+ }
+
+ return null;
+ }
+
+ public ExtensionPoint getExtensionPoint(String extensionPointUniqueIdentifier) {
+ return (ExtensionPoint) extensionPoints.get(extensionPointUniqueIdentifier);
+ }
+
+ public Bundle[] getFragments(Bundle bundle) {
+ Set set = (Set) fragments.get(bundle.getSymbolicName());
+ if (set == null)
+ return new Bundle[0];
+
+ List result = new ArrayList(set.size());
+ Version hostVersion = Version.parseVersion(bundle.getVersion());
+ for (Iterator i = set.iterator(); i.hasNext();) {
+ Bundle fragment = (Bundle) i.next();
+ String fragmentVersionOrRange = fragment.getFragmentHostVersion();
+
+ if (versionMatches(hostVersion, fragmentVersionOrRange))
+ result.add(fragment);
+ }
+
+ return (Bundle[]) result.toArray(new Bundle[result.size()]);
+ }
+
+ private boolean versionMatches(String hostVersion, String versionOrRange) {
+ try {
+ Version version = Version.parseVersion(hostVersion);
+ return versionMatches(version, versionOrRange);
+
+ } catch (IllegalArgumentException e) {
+ // ignore
+ }
+
+ return false;
+ }
+
+ /**
+ * Check if hostVersion is greater or equal fragmentVersion, or is included in fragment version range
+ * @param hostVersion Version
+ * @param versionOrRange Version or VersionRange
+ * @return true if matches, false otherwise
+ */
+ private boolean versionMatches(Version hostVersion, String versionOrRange) {
+ if (versionOrRange == null) {
+ return true;
+ }
+
+ try {
+ Version version = Version.parseVersion(versionOrRange);
+ if (hostVersion.compareTo(version) >= 0)
+ return true;
+
+ } catch (IllegalArgumentException e) {
+ // wrong formatting, try VersionRange
+ }
+
+ try {
+ VersionRange range = new VersionRange(versionOrRange);
+ if (range.isIncluded(hostVersion))
+ return true;
+
+ } catch (IllegalArgumentException e2) {
+ // wrong range formatting
+ }
+
+ return false;
+ }
+
+ /* void setEnabled(Bundle bundle, boolean enabled);
+
+ void start(Bundle bundle) throws BundleException; // XXX Create custom Exception
+
+ void stop(Bundle bundle) throws BundleException;
+
+ MultiStatus diagnose(Bundle bundle);*/
+
+}
diff --git a/osgimonitoring/plugins/org.eclipse.pde.runtime/src/org/eclipse/pde/internal/runtime/registry/model/RegistryModelFactory.java b/osgimonitoring/plugins/org.eclipse.pde.runtime/src/org/eclipse/pde/internal/runtime/registry/model/RegistryModelFactory.java
new file mode 100644
index 0000000..b1d454c
--- /dev/null
+++ b/osgimonitoring/plugins/org.eclipse.pde.runtime/src/org/eclipse/pde/internal/runtime/registry/model/RegistryModelFactory.java
@@ -0,0 +1,31 @@
+/*******************************************************************************
+ * Copyright (c) 2008 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.pde.internal.runtime.registry.model;
+
+
+/**
+ * Produces RegistryModels for URLs. Valid URLs:
+ * local
+ * target
+ * remote://host:port
+ *
+ */
+public class RegistryModelFactory {
+
+ /**
+ *
+ * @param uri
+ * @return never returns null
+ */
+ public static RegistryModel getRegistryModel(String uri) {
+ return new RegistryModel(new LocalRegistryBackend());
+ }
+}
diff --git a/osgimonitoring/plugins/org.eclipse.pde.runtime/src/org/eclipse/pde/internal/runtime/registry/model/ServiceName.java b/osgimonitoring/plugins/org.eclipse.pde.runtime/src/org/eclipse/pde/internal/runtime/registry/model/ServiceName.java
new file mode 100644
index 0000000..098adda
--- /dev/null
+++ b/osgimonitoring/plugins/org.eclipse.pde.runtime/src/org/eclipse/pde/internal/runtime/registry/model/ServiceName.java
@@ -0,0 +1,69 @@
+/*******************************************************************************
+ * Copyright (c) 2009 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ * Wolfgang Schell <ws@jetztgrad.net> - bug 260055
+ *******************************************************************************/
+package org.eclipse.pde.internal.runtime.registry.model;
+
+import java.util.Arrays;
+
+public class ServiceName extends ModelObject implements Comparable {
+
+ private String[] classes;
+
+ public ServiceName(String[] classes) {
+ this.classes = classes;
+ }
+
+ public String[] getClasses() {
+ return classes;
+ }
+
+ public ModelObject[] getChildren() {
+ return model.getServices(classes);
+ }
+
+ private static int hashCode(Object[] array) {
+ int prime = 31;
+ if (array == null)
+ return 0;
+ int result = 1;
+ for (int index = 0; index < array.length; index++) {
+ result = prime * result + (array[index] == null ? 0 : array[index].hashCode());
+ }
+ return result;
+ }
+
+ public int hashCode() {
+ final int prime = 31;
+ return prime * ServiceName.hashCode(classes);
+ }
+
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (getClass() != obj.getClass())
+ return false;
+ ServiceName other = (ServiceName) obj;
+ return Arrays.equals(classes, other.classes);
+ }
+
+ public int compareTo(Object obj) {
+ if (obj instanceof ServiceName) {
+ // compare first class
+ ServiceName other = (ServiceName) obj;
+ String myClass = classes[0];
+ String otherClass = other.getClasses()[0];
+
+ return myClass.compareTo(otherClass);
+ }
+ return 0;
+
+ }
+}
diff --git a/osgimonitoring/plugins/org.eclipse.pde.runtime/src/org/eclipse/pde/internal/runtime/registry/model/ServiceRegistration.java b/osgimonitoring/plugins/org.eclipse.pde.runtime/src/org/eclipse/pde/internal/runtime/registry/model/ServiceRegistration.java
new file mode 100644
index 0000000..ef2c1dc
--- /dev/null
+++ b/osgimonitoring/plugins/org.eclipse.pde.runtime/src/org/eclipse/pde/internal/runtime/registry/model/ServiceRegistration.java
@@ -0,0 +1,146 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2009 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ * Wolfgang Schell <ws@jetztgrad.net> - bug 259348, 260055
+ *******************************************************************************/
+package org.eclipse.pde.internal.runtime.registry.model;
+
+import java.util.HashSet;
+import java.util.Set;
+
+public class ServiceRegistration extends ModelObject implements Comparable {
+
+ private long id;
+ private String bundle;
+ private long[] usingBundles = new long[0];
+ private ServiceName name;
+ private Property[] properties = new Property[0];
+
+ public void setId(long id) {
+ this.id = id;
+ }
+
+ public void setBundle(String bundle) {
+ this.bundle = bundle;
+ }
+
+ public void setUsingBundles(long[] usingBundles) {
+ if (usingBundles == null)
+ throw new IllegalArgumentException();
+
+ this.usingBundles = usingBundles;
+ }
+
+ public void setName(ServiceName name) {
+ if (name == null)
+ throw new IllegalArgumentException();
+
+ this.name = name;
+ }
+
+ public void setProperties(Property[] properties) {
+ if (properties == null)
+ throw new IllegalArgumentException();
+
+ this.properties = properties;
+ }
+
+ public long getId() {
+ return id;
+ }
+
+ public ServiceName getName() {
+ return name;
+ }
+
+ public String getBundle() {
+ return bundle;
+ }
+
+ public long[] getUsingBundleIds() {
+ return usingBundles;
+ }
+
+ public Bundle[] getUsingBundles() {
+ if (usingBundles.length == 0)
+ return new Bundle[0];
+
+ Set bundles = new HashSet();
+ for (int i = 0; i < usingBundles.length; i++) {
+ Bundle bundle = model.getBundle(new Long(usingBundles[i]));
+ if (bundle != null)
+ bundles.add(bundle);
+ }
+ return (Bundle[]) bundles.toArray(new Bundle[bundles.size()]);
+ }
+
+ public Property[] getProperties() {
+ return properties;
+ }
+
+ public Property getProperty(String name) {
+ for (int p = 0; p < properties.length; p++) {
+ Property property = properties[p];
+ if (name.equals(property.getName())) {
+ return property;
+ }
+ }
+ return null;
+ }
+
+ public static String toString(Object value) {
+ if (value == null) {
+ return ""; //$NON-NLS-1$
+ } else if (value instanceof CharSequence) {
+ CharSequence charSequence = (CharSequence) value;
+ return charSequence.toString();
+ } else if (value instanceof Object[]) {
+ StringBuffer buff = new StringBuffer();
+ appendString(buff, value);
+
+ return buff.toString();
+ } else {
+ return value.toString();
+ }
+ }
+
+ public static void appendString(StringBuffer buff, Object value) {
+ if (value == null) {
+ // ignore
+ } else if (value instanceof Object[]) {
+ Object[] objects = (Object[]) value;
+ buff.append("["); //$NON-NLS-1$
+ for (int o = 0; o < objects.length; o++) {
+ Object object = objects[o];
+ if (o > 0)
+ buff.append(", "); //$NON-NLS-1$
+ appendString(buff, object);
+ }
+ buff.append("]"); //$NON-NLS-1$
+ } else {
+ buff.append(value.toString());
+ }
+ }
+
+ public boolean equals(Object obj) {
+ return (obj instanceof ServiceRegistration) && (id == (((ServiceRegistration) obj).id));
+ }
+
+ public int hashCode() {
+ return (int) id;
+ }
+
+ public int compareTo(Object obj) {
+ if (obj instanceof ServiceRegistration) {
+ ServiceRegistration other = (ServiceRegistration) obj;
+ return name.compareTo(other.getName());
+ }
+ return 0;
+ }
+}
diff --git a/osgimonitoring/plugins/org.eclipse.pde.runtime/src/org/eclipse/pde/internal/runtime/spy/SpyFormToolkit.java b/osgimonitoring/plugins/org.eclipse.pde.runtime/src/org/eclipse/pde/internal/runtime/spy/SpyFormToolkit.java
new file mode 100644
index 0000000..38da77c
--- /dev/null
+++ b/osgimonitoring/plugins/org.eclipse.pde.runtime/src/org/eclipse/pde/internal/runtime/spy/SpyFormToolkit.java
@@ -0,0 +1,316 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2009 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Chris Aniszczyk <zx@us.ibm.com> - initial API and implementation
+ * Willian Mitsuda <wmitsuda@gmail.com> - bug 209841
+ * Benjamin Cabe <benjamin.cabe@anyware-tech.com> - bug 209487
+ *******************************************************************************/
+package org.eclipse.pde.internal.runtime.spy;
+
+import java.util.HashMap;
+import java.util.Map;
+import org.eclipse.help.IContext;
+import org.eclipse.help.internal.context.Context;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.ToolBarManager;
+import org.eclipse.jface.dialogs.PopupDialog;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.pde.internal.runtime.*;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.dnd.*;
+import org.eclipse.swt.events.*;
+import org.eclipse.swt.graphics.*;
+import org.eclipse.swt.widgets.*;
+import org.eclipse.ui.forms.events.HyperlinkAdapter;
+import org.eclipse.ui.forms.events.HyperlinkEvent;
+import org.eclipse.ui.forms.widgets.*;
+import org.osgi.framework.Bundle;
+
+/**
+ * @since 3.4
+ */
+public class SpyFormToolkit extends FormToolkit {
+
+ private static final String CLASS_PROTOCOL_PREFIX = "class://"; //$NON-NLS-1$
+
+ private static final String BUNDLE_PROTOCOL_PREFIX = "bundle://"; //$NON-NLS-1$
+
+ private class SpyHyperlinkAdapter extends HyperlinkAdapter {
+
+ private PopupDialog fDialog;
+
+ public SpyHyperlinkAdapter(PopupDialog dialog) {
+ this.fDialog = dialog;
+ }
+
+ public void linkActivated(HyperlinkEvent e) {
+ String href = (String) e.getHref();
+ if (href.startsWith(CLASS_PROTOCOL_PREFIX)) {
+ String clazz = href.substring(CLASS_PROTOCOL_PREFIX.length());
+ Bundle bundle = (Bundle) bundleClassByName.get(clazz);
+ SpyIDEUtil.openClass(bundle.getSymbolicName(), clazz);
+ fDialog.close();
+ } else if (href.startsWith(BUNDLE_PROTOCOL_PREFIX)) {
+ String bundle = href.substring(BUNDLE_PROTOCOL_PREFIX.length());
+ SpyIDEUtil.openBundleManifest(bundle);
+ fDialog.close();
+ }
+ }
+ }
+
+ private class SaveImageAction extends Action {
+
+ private Image image;
+
+ public SaveImageAction(Image image) {
+ this.image = image;
+ }
+
+ public void run() {
+ FileDialog fileChooser = new FileDialog(PDERuntimePlugin.getActiveWorkbenchShell(), SWT.SAVE);
+ fileChooser.setFileName("image"); //$NON-NLS-1$
+ fileChooser.setFilterExtensions(new String[] {"*.png"}); //$NON-NLS-1$
+ fileChooser.setFilterNames(new String[] {"PNG (*.png)"}); //$NON-NLS-1$
+ String filename = fileChooser.open();
+ if (filename == null)
+ return;
+
+ int filetype = determineFileType(filename);
+ if (filetype == SWT.IMAGE_UNDEFINED) {
+ return;
+ }
+ ImageLoader loader = new ImageLoader();
+ loader.data = new ImageData[] {image.getImageData()};
+ loader.save(filename, filetype);
+ }
+
+ private int determineFileType(String filename) {
+ String ext = filename.substring(filename.lastIndexOf('.') + 1);
+ if (ext.equalsIgnoreCase("gif")) //$NON-NLS-1$
+ return SWT.IMAGE_GIF;
+ if (ext.equalsIgnoreCase("ico")) //$NON-NLS-1$
+ return SWT.IMAGE_ICO;
+ if (ext.equalsIgnoreCase("jpg") || ext.equalsIgnoreCase("jpeg")) //$NON-NLS-1$//$NON-NLS-2$
+ return SWT.IMAGE_JPEG;
+ if (ext.equalsIgnoreCase("png")) //$NON-NLS-1$
+ return SWT.IMAGE_PNG;
+ return SWT.IMAGE_UNDEFINED;
+ }
+ }
+
+ private Map bundleClassByName = new HashMap();
+ private PopupDialog dialog;
+ private static String HELP_KEY = "org.eclipse.ui.help"; //$NON-NLS-1$
+
+ public SpyFormToolkit(PopupDialog dialog) {
+ super(Display.getDefault());
+ this.dialog = dialog;
+ }
+
+ public FormText createFormText(Composite parent, boolean trackFocus) {
+ FormText text = super.createFormText(parent, trackFocus);
+ if (PDERuntimePlugin.HAS_IDE_BUNDLES) {
+ text.addHyperlinkListener(new SpyHyperlinkAdapter(dialog));
+ addCopyQNameMenuItem(text);
+ }
+ return text;
+ }
+
+ private void addCopyQNameMenuItem(final FormText formText) {
+ Menu menu = formText.getMenu();
+ final MenuItem copyQNameItem = new MenuItem(menu, SWT.PUSH);
+ copyQNameItem.setImage(PDERuntimePluginImages.get(PDERuntimePluginImages.IMG_COPY_QNAME));
+ copyQNameItem.setText(PDERuntimeMessages.SpyFormToolkit_copyQualifiedName);
+
+ SelectionListener listener = new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent e) {
+ if (e.widget == copyQNameItem) {
+ Clipboard clipboard = null;
+ try {
+ clipboard = new Clipboard(formText.getDisplay());
+ clipboard.setContents(new Object[] {((String) formText.getSelectedLinkHref()).substring(CLASS_PROTOCOL_PREFIX.length())}, new Transfer[] {TextTransfer.getInstance()});
+ } finally {
+ if (clipboard != null)
+ clipboard.dispose();
+ }
+ }
+ }
+ };
+ copyQNameItem.addSelectionListener(listener);
+ menu.addMenuListener(new MenuAdapter() {
+ public void menuShown(MenuEvent e) {
+ String href = (String) formText.getSelectedLinkHref();
+ copyQNameItem.setEnabled(href != null && href.startsWith(CLASS_PROTOCOL_PREFIX));
+ }
+ });
+ }
+
+ public String createInterfaceSection(FormText text, String title, Class[] clazzes) {
+ StringBuffer buffer = new StringBuffer();
+ if (clazzes.length > 0) {
+ buffer.append("<p>"); //$NON-NLS-1$
+ buffer.append(title);
+ buffer.append("</p>"); //$NON-NLS-1$
+ for (int i = 0; i < clazzes.length; i++) {
+ buffer.append("<li bindent=\"20\" style=\"image\" value=\"interface\">"); //$NON-NLS-1$
+ createClassReference(buffer, clazzes[i]);
+ buffer.append("</li>"); //$NON-NLS-1$
+ }
+ Image image = PDERuntimePluginImages.get(PDERuntimePluginImages.IMG_INTERFACE_OBJ);
+ text.setImage("interface", image); //$NON-NLS-1$
+ }
+ return buffer.toString();
+ }
+
+ public String createClassSection(FormText text, String title, Class[] clazzes) {
+ StringBuffer buffer = new StringBuffer();
+ if (clazzes.length > 0) {
+ buffer.append("<p>"); //$NON-NLS-1$
+ buffer.append(title);
+ buffer.append("</p>"); //$NON-NLS-1$
+ for (int i = 0; i < clazzes.length; i++) {
+ buffer.append("<li bindent=\"20\" style=\"image\" value=\"class\">"); //$NON-NLS-1$
+ createClassReference(buffer, clazzes[i]);
+ buffer.append("</li>"); //$NON-NLS-1$
+ }
+ Image image = PDERuntimePluginImages.get(PDERuntimePluginImages.IMG_CLASS_OBJ);
+ text.setImage("class", image); //$NON-NLS-1$
+ }
+ return buffer.toString();
+ }
+
+ public String createIdentifierSection(FormText text, String title, String[] ids) {
+ StringBuffer buffer = new StringBuffer();
+ if (ids.length > 0) {
+ buffer.append("<p>"); //$NON-NLS-1$
+ buffer.append(title);
+ buffer.append("</p>"); //$NON-NLS-1$
+ for (int i = 0; i < ids.length; i++) {
+ buffer.append("<li bindent=\"20\" style=\"image\" value=\"id\">"); //$NON-NLS-1$
+ buffer.append(ids[i]);
+ buffer.append("</li>"); //$NON-NLS-1$
+ }
+ Image image = PDERuntimePluginImages.get(PDERuntimePluginImages.IMG_ID_OBJ);
+ text.setImage("id", image); //$NON-NLS-1$
+ }
+ return buffer.toString();
+ }
+
+ public String createHelpIdentifierSection(Widget widget) {
+ return createHelpIdentifierSection(widget.getData(HELP_KEY));
+ }
+
+ public String createHelpIdentifierSection(IContext context) {
+ if (context instanceof Context)
+ return createHelpIdentifierSection(((Context) context).getId());
+ return new String();
+ }
+
+ private String createHelpIdentifierSection(Object help) {
+ StringBuffer buffer = new StringBuffer();
+ if (help != null) {
+ buffer.append("<li bindent=\"20\" style=\"image\" value=\"contextid\">"); //$NON-NLS-1$
+ buffer.append(help);
+ buffer.append("</li>"); //$NON-NLS-1$
+ }
+ return buffer.toString();
+ }
+
+ private void createClassReference(StringBuffer buffer, Class clazz) {
+ Bundle bundle = PDERuntimePlugin.HAS_IDE_BUNDLES ? PDERuntimePlugin.getDefault().getPackageAdmin().getBundle(clazz) : null;
+ if (bundle != null) {
+ bundleClassByName.put(clazz.getName(), bundle);
+ buffer.append("<a href=\"").append(CLASS_PROTOCOL_PREFIX).append( //$NON-NLS-1$
+ clazz.getName()).append("\">") //$NON-NLS-1$
+ .append(getSimpleName(clazz)).append("</a>"); //$NON-NLS-1$
+ } else {
+ buffer.append(clazz.getName());
+ }
+ }
+
+ // TODO refactor me, I'm ugly
+ public void generatePluginDetailsText(Bundle bundle, String objectId, String objectType, StringBuffer buffer, FormText text) {
+ if (bundle != null) {
+ String version = (String) (bundle.getHeaders().get(org.osgi.framework.Constants.BUNDLE_VERSION));
+
+ buffer.append("<p>"); //$NON-NLS-1$
+ buffer.append(PDERuntimeMessages.SpyDialog_contributingPluginId_title);
+ buffer.append("</p>"); //$NON-NLS-1$
+ buffer.append("<li bindent=\"20\" style=\"image\" value=\"plugin\">"); //$NON-NLS-1$
+ if (PDERuntimePlugin.HAS_IDE_BUNDLES) {
+ buffer.append("<a href=\""); //$NON-NLS-1$
+ buffer.append(BUNDLE_PROTOCOL_PREFIX);
+ buffer.append(bundle.getSymbolicName());
+ buffer.append("\">"); //$NON-NLS-1$
+ }
+ buffer.append(bundle.getSymbolicName());
+ buffer.append(" ("); //$NON-NLS-1$
+ buffer.append(version);
+ buffer.append(")"); //$NON-NLS-1$
+ if (PDERuntimePlugin.HAS_IDE_BUNDLES) {
+ buffer.append("</a>"); //$NON-NLS-1$
+ }
+ buffer.append("</li>"); //$NON-NLS-1$
+
+ Image pluginImage = PDERuntimePluginImages.get(PDERuntimePluginImages.IMG_PLUGIN_OBJ);
+ text.setImage("plugin", pluginImage); //$NON-NLS-1$
+
+ if (objectId != null) {
+ buffer.append("<p>"); //$NON-NLS-1$
+ buffer.append(NLS.bind(PDERuntimeMessages.SpyDialog_contributingPluginId_desc, objectType));
+ buffer.append("</p>"); //$NON-NLS-1$
+ buffer.append("<li bindent=\"20\" style=\"image\" value=\"id\">"); //$NON-NLS-1$
+ buffer.append(objectId);
+ buffer.append("</li>"); //$NON-NLS-1$
+ }
+ }
+ }
+
+ private String getSimpleName(Class clazz) {
+ String fullName = clazz.getName();
+ int index = fullName.lastIndexOf('.');
+ String name = fullName.substring(index + 1, fullName.length());
+ if (name != null)
+ return name;
+ return fullName;
+ }
+
+ private ToolBarManager createSectionToolbar(Section section) {
+ Object object = section.getData("toolbarmanager"); //$NON-NLS-1$
+ if (object instanceof ToolBarManager) {
+ return (ToolBarManager) object;
+ }
+ ToolBarManager manager = new ToolBarManager(SWT.FLAT);
+ ToolBar toolbar = manager.createControl(section);
+ final Cursor handCursor = new Cursor(Display.getCurrent(), SWT.CURSOR_HAND);
+ toolbar.setCursor(handCursor);
+ // Cursor needs to be explicitly disposed
+ toolbar.addDisposeListener(new DisposeListener() {
+ public void widgetDisposed(DisposeEvent e) {
+ if ((handCursor != null) && (handCursor.isDisposed() == false)) {
+ handCursor.dispose();
+ }
+ }
+ });
+ section.setTextClient(toolbar);
+ section.setData("toolbarmanager", manager); //$NON-NLS-1$
+ return manager;
+ }
+
+ public void createImageAction(Section section, Image image) {
+ if (image == null)
+ return;
+ ToolBarManager manager = createSectionToolbar(section);
+ SaveImageAction action = new SaveImageAction(image);
+ action.setText(PDERuntimeMessages.SpyFormToolkit_saveImageAs_title);
+ action.setImageDescriptor(PDERuntimePluginImages.SAVE_IMAGE_AS_OBJ);
+ manager.add(action);
+ manager.update(true);
+ }
+
+}
diff --git a/osgimonitoring/plugins/org.eclipse.pde.runtime/src/org/eclipse/pde/internal/runtime/spy/SpyIDEUtil.java b/osgimonitoring/plugins/org.eclipse.pde.runtime/src/org/eclipse/pde/internal/runtime/spy/SpyIDEUtil.java
new file mode 100644
index 0000000..7087a95
--- /dev/null
+++ b/osgimonitoring/plugins/org.eclipse.pde.runtime/src/org/eclipse/pde/internal/runtime/spy/SpyIDEUtil.java
@@ -0,0 +1,79 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2008 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Chris Aniszczyk <zx@us.ibm.com> - initial API and implementation
+ * Marcelo Paternostro <marcelop@ca.ibm.com> - bug 201105
+ * Kevin Doyle <kjdoyle@ca.ibm.com> - bug 208137
+ * Willian Mitsuda <wmitsuda@gmail.com> - bug 209841
+ *******************************************************************************/
+
+package org.eclipse.pde.internal.runtime.spy;
+
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.jdt.core.*;
+import org.eclipse.jdt.ui.JavaUI;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.pde.core.plugin.IPluginModelBase;
+import org.eclipse.pde.core.plugin.PluginRegistry;
+import org.eclipse.pde.internal.core.PDECore;
+import org.eclipse.pde.internal.core.SearchablePluginsManager;
+import org.eclipse.pde.internal.runtime.PDERuntimeMessages;
+import org.eclipse.pde.internal.runtime.PDERuntimePlugin;
+import org.eclipse.pde.internal.ui.editor.plugin.ManifestEditor;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.PartInitException;
+
+/**
+ * @since 3.4
+ */
+public class SpyIDEUtil {
+ public static void openClass(String pluginId, String clazz) {
+ IPluginModelBase model = PluginRegistry.findModel(pluginId);
+ IResource resource = model != null ? model.getUnderlyingResource() : null;
+ IJavaProject project = null;
+
+ // if we don't find a model
+ if (model == null) {
+ MessageDialog.openError(Display.getCurrent().getActiveShell(), PDERuntimeMessages.SpyIDEUtil_noSourceFound_title, NLS.bind(PDERuntimeMessages.SpyIDEUtil_noSourceFound_message, new Object[] {clazz}));
+ return;
+ }
+
+ if (resource != null) { // project is open in workspace
+ project = JavaCore.create(resource.getProject());
+ } else {
+ SearchablePluginsManager manager = PDECore.getDefault().getSearchablePluginsManager();
+ try {
+ manager.createProxyProject(new NullProgressMonitor());
+ manager.addToJavaSearch(new IPluginModelBase[] {model});
+ project = manager.getProxyProject();
+ } catch (CoreException e) {
+ }
+ }
+ if (project != null)
+ openInEditor(project, clazz);
+ }
+
+ public static void openInEditor(IJavaProject project, String clazz) {
+ try {
+ IType type = project.findType(clazz);
+ JavaUI.openInEditor(type, false, true);
+ } catch (JavaModelException e) {
+ PDERuntimePlugin.log(e);
+ } catch (PartInitException e) {
+ PDERuntimePlugin.log(e);
+ }
+ }
+
+ public static void openBundleManifest(String bundleID) {
+ ManifestEditor.openPluginEditor(bundleID);
+ }
+
+}
diff --git a/osgimonitoring/plugins/org.eclipse.pde.runtime/src/org/eclipse/pde/internal/runtime/spy/dialogs/MenuSpyDialog.java b/osgimonitoring/plugins/org.eclipse.pde.runtime/src/org/eclipse/pde/internal/runtime/spy/dialogs/MenuSpyDialog.java
new file mode 100644
index 0000000..9ba96a2
--- /dev/null
+++ b/osgimonitoring/plugins/org.eclipse.pde.runtime/src/org/eclipse/pde/internal/runtime/spy/dialogs/MenuSpyDialog.java
@@ -0,0 +1,128 @@
+/*******************************************************************************
+ * Copyright (c) 2009 EclipseSource Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * EclipseSource - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.pde.internal.runtime.spy.dialogs;
+
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.dialogs.PopupDialog;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.pde.internal.runtime.*;
+import org.eclipse.pde.internal.runtime.spy.SpyFormToolkit;
+import org.eclipse.pde.internal.runtime.spy.sections.ActiveMenuSection;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.*;
+import org.eclipse.swt.widgets.*;
+import org.eclipse.ui.ISharedImages;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.forms.widgets.ScrolledForm;
+import org.eclipse.ui.forms.widgets.TableWrapLayout;
+
+/**
+ * @since 3.5
+ */
+public class MenuSpyDialog extends PopupDialog {
+
+ private Event event;
+ private Point fAnchor;
+ private Composite composite;
+ private SpyFormToolkit toolkit;
+
+ private class CloseAction extends Action {
+ public ImageDescriptor getImageDescriptor() {
+ return PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_TOOL_DELETE);
+ }
+
+ public String getToolTipText() {
+ return PDERuntimeMessages.SpyDialog_close;
+ }
+
+ public void run() {
+ close();
+ }
+ }
+
+ public MenuSpyDialog(Shell parent, Event event, Point point) {
+ super(parent, SWT.NONE, true, true, false, false, false, null, null);
+ this.event = event;
+ this.fAnchor = point;
+ this.toolkit = new SpyFormToolkit(this);
+ }
+
+ /*
+ * @see org.eclipse.jface.window.Window#configureShell(Shell)
+ */
+ protected void configureShell(Shell shell) {
+ super.configureShell(shell);
+ PlatformUI.getWorkbench().getHelpSystem().setHelp(shell, IHelpContextIds.SPY_DIALOG);
+ }
+
+ protected Control createContents(Composite parent) {
+ getShell().setBackground(getShell().getDisplay().getSystemColor(SWT.COLOR_DARK_GRAY));
+ initializeBounds();
+ return createDialogArea(parent);
+ }
+
+ protected Control createDialogArea(Composite parent) {
+ this.composite = (Composite) super.createDialogArea(parent);
+
+ ScrolledForm form = toolkit.createScrolledForm(composite);
+ toolkit.decorateFormHeading(form.getForm());
+
+ // set title and image
+ form.setText(PDERuntimeMessages.SpyDialog_title);
+ Image image = PDERuntimePluginImages.get(PDERuntimePluginImages.IMG_SPY_OBJ);
+ form.setImage(image);
+
+ // add a Close button to the toolbar
+ form.getToolBarManager().add(new CloseAction());
+ form.getToolBarManager().update(true);
+
+ TableWrapLayout layout = new TableWrapLayout();
+ layout.leftMargin = 10;
+ layout.rightMargin = 10;
+ layout.topMargin = 10;
+ layout.verticalSpacing = 10;
+ form.getBody().setLayout(layout);
+
+ // TODO, make this so we use an extension point.
+ ActiveMenuSection section = new ActiveMenuSection();
+ section.build(form, toolkit, event);
+
+ parent.pack();
+ return composite;
+ }
+
+ protected Point getInitialLocation(Point size) {
+ if (fAnchor == null) {
+ return super.getInitialLocation(size);
+ }
+ Point point = fAnchor;
+ Rectangle monitor = getShell().getMonitor().getClientArea();
+ if (monitor.width < point.x + size.x) {
+ point.x = Math.max(0, point.x - size.x);
+ }
+ if (monitor.height < point.y + size.y) {
+ point.y = Math.max(0, point.y - size.y);
+ }
+ return point;
+ }
+
+ public boolean close() {
+ if (toolkit != null)
+ toolkit.dispose();
+ toolkit = null;
+ return super.close();
+ }
+
+ protected Control getFocusControl() {
+ return this.composite;
+ }
+
+}
diff --git a/osgimonitoring/plugins/org.eclipse.pde.runtime/src/org/eclipse/pde/internal/runtime/spy/dialogs/SpyDialog.java b/osgimonitoring/plugins/org.eclipse.pde.runtime/src/org/eclipse/pde/internal/runtime/spy/dialogs/SpyDialog.java
new file mode 100644
index 0000000..574bc90
--- /dev/null
+++ b/osgimonitoring/plugins/org.eclipse.pde.runtime/src/org/eclipse/pde/internal/runtime/spy/dialogs/SpyDialog.java
@@ -0,0 +1,148 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2008 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Chris Aniszczyk <zx@us.ibm.com> - initial API and implementation
+ * Benjamin Cabe <benjamin.cabe@anyware-tech.com> - bug 211580
+ *******************************************************************************/
+package org.eclipse.pde.internal.runtime.spy.dialogs;
+
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.dialogs.PopupDialog;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.pde.internal.runtime.*;
+import org.eclipse.pde.internal.runtime.spy.SpyFormToolkit;
+import org.eclipse.pde.internal.runtime.spy.sections.*;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.*;
+import org.eclipse.swt.widgets.*;
+import org.eclipse.ui.ISharedImages;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.forms.widgets.ScrolledForm;
+import org.eclipse.ui.forms.widgets.TableWrapLayout;
+
+/**
+ * @since 3.4
+ */
+public class SpyDialog extends PopupDialog {
+
+ private ExecutionEvent event;
+ private Point fAnchor;
+ private Composite composite;
+ private SpyFormToolkit toolkit;
+
+ private class CloseAction extends Action {
+ public ImageDescriptor getImageDescriptor() {
+ return PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_TOOL_DELETE);
+ }
+
+ public String getToolTipText() {
+ return PDERuntimeMessages.SpyDialog_close;
+ }
+
+ public void run() {
+ close();
+ }
+ }
+
+ public SpyDialog(Shell parent, ExecutionEvent event, Point point) {
+ super(parent, SWT.NONE, true, true, false, false, false, null, null);
+ this.event = event;
+ this.fAnchor = point;
+ this.toolkit = new SpyFormToolkit(this);
+ }
+
+ /*
+ * @see org.eclipse.jface.window.Window#configureShell(Shell)
+ */
+ protected void configureShell(Shell shell) {
+ super.configureShell(shell);
+ PlatformUI.getWorkbench().getHelpSystem().setHelp(shell, IHelpContextIds.SPY_DIALOG);
+ }
+
+ protected Control createContents(Composite parent) {
+ getShell().setBackground(getShell().getDisplay().getSystemColor(SWT.COLOR_DARK_GRAY));
+ initializeBounds();
+ return createDialogArea(parent);
+ }
+
+ protected Control createDialogArea(Composite parent) {
+ this.composite = (Composite) super.createDialogArea(parent);
+
+ ScrolledForm form = toolkit.createScrolledForm(composite);
+ toolkit.decorateFormHeading(form.getForm());
+
+ // set title and image
+ form.setText(PDERuntimeMessages.SpyDialog_title);
+ Image image = PDERuntimePluginImages.get(PDERuntimePluginImages.IMG_SPY_OBJ);
+ form.setImage(image);
+
+ // add a Close button to the toolbar
+ form.getToolBarManager().add(new CloseAction());
+ form.getToolBarManager().update(true);
+
+ TableWrapLayout layout = new TableWrapLayout();
+ layout.leftMargin = 10;
+ layout.rightMargin = 10;
+ layout.topMargin = 10;
+ layout.verticalSpacing = 10;
+ form.getBody().setLayout(layout);
+
+ // TODO, make this so we use an extension point.
+ ISpySection section = new ActiveShellSection();
+ section.build(form, toolkit, event);
+
+ section = new ActivePartSection();
+ section.build(form, toolkit, event);
+
+ section = new ActiveFormEditorSection();
+ section.build(form, toolkit, event);
+
+ section = new ActiveSelectionSection();
+ section.build(form, toolkit, event);
+
+ section = new ActiveWizardSection();
+ section.build(form, toolkit, event);
+
+ section = new ActiveDialogPageSection();
+ section.build(form, toolkit, event);
+
+ section = new ActiveHelpSection();
+ section.build(form, toolkit, event);
+
+ parent.pack();
+ return composite;
+ }
+
+ protected Point getInitialLocation(Point size) {
+ if (fAnchor == null) {
+ return super.getInitialLocation(size);
+ }
+ Point point = fAnchor;
+ Rectangle monitor = getShell().getMonitor().getClientArea();
+ if (monitor.width < point.x + size.x) {
+ point.x = Math.max(0, point.x - size.x);
+ }
+ if (monitor.height < point.y + size.y) {
+ point.y = Math.max(0, point.y - size.y);
+ }
+ return point;
+ }
+
+ public boolean close() {
+ if (toolkit != null)
+ toolkit.dispose();
+ toolkit = null;
+ return super.close();
+ }
+
+ protected Control getFocusControl() {
+ return this.composite;
+ }
+
+}
diff --git a/osgimonitoring/plugins/org.eclipse.pde.runtime/src/org/eclipse/pde/internal/runtime/spy/handlers/MenuSpyHandler.java b/osgimonitoring/plugins/org.eclipse.pde.runtime/src/org/eclipse/pde/internal/runtime/spy/handlers/MenuSpyHandler.java
new file mode 100644
index 0000000..ef5e4f9
--- /dev/null
+++ b/osgimonitoring/plugins/org.eclipse.pde.runtime/src/org/eclipse/pde/internal/runtime/spy/handlers/MenuSpyHandler.java
@@ -0,0 +1,97 @@
+/*******************************************************************************
+ * Copyright (c) 2009 EclipseSource Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * EclipseSource Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.pde.internal.runtime.spy.handlers;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.jface.dialogs.PopupDialog;
+import org.eclipse.pde.internal.runtime.PDERuntimePluginImages;
+import org.eclipse.pde.internal.runtime.spy.dialogs.MenuSpyDialog;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Cursor;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.*;
+import org.eclipse.ui.handlers.HandlerUtil;
+
+/**
+ * @since 3.5
+ */
+public class MenuSpyHandler extends AbstractHandler implements Listener {
+
+ private PopupDialog INSTANCE = null;
+ private Cursor defaultCursor;
+ private Cursor spyCursor;
+
+ public MenuSpyHandler() {
+ // do nothing
+ }
+
+ public Object execute(ExecutionEvent event) {
+ if (event != null) {
+ if (INSTANCE != null && INSTANCE.getShell() != null && !INSTANCE.getShell().isDisposed()) {
+ INSTANCE.close();
+ }
+
+ Shell shell = HandlerUtil.getActiveShell(event);
+ if (shell != null) {
+ Display display = shell.getDisplay();
+ display.addFilter(SWT.Selection, this);
+ display.addFilter(SWT.KeyDown, this);
+ display.addFilter(SWT.Show, this);
+ if (display.getActiveShell() != null) {
+ defaultCursor = display.getActiveShell().getCursor();
+ Image image = PDERuntimePluginImages.get(PDERuntimePluginImages.IMG_MENUSPY_OBJ);
+ spyCursor = new Cursor(display, image.getImageData(), 7, 7);
+ display.getActiveShell().setCursor(spyCursor);
+ }
+ }
+ }
+ return null;
+ }
+
+ // TODO clean up this code
+ public void handleEvent(Event event) {
+ switch (event.type) {
+ case SWT.KeyDown :
+ if (event.keyCode == SWT.ESC)
+ break;
+ case SWT.Show :
+ if (spyCursor != null) {
+ Shell shell = event.display.getActiveShell();
+ if (shell != null) {
+ shell.setCursor(spyCursor);
+ }
+ }
+ return;
+ }
+ event.display.removeFilter(SWT.Selection, this);
+ event.display.removeFilter(SWT.KeyDown, this);
+ event.display.removeFilter(SWT.Show, this);
+ if (spyCursor != null) {
+ if (event.display.getActiveShell() != null) {
+ event.display.getActiveShell().setCursor(defaultCursor);
+ defaultCursor = null;
+ spyCursor.dispose();
+ spyCursor = null;
+ }
+ }
+
+ if (event.type == SWT.Selection) {
+ Shell shell = event.display.getActiveShell();
+ MenuSpyDialog dialog = new MenuSpyDialog(shell, event, shell.getDisplay().getCursorLocation());
+ INSTANCE = dialog;
+ dialog.create();
+ dialog.open();
+ event.doit = false;
+ event.type = SWT.None;
+ }
+ }
+}
diff --git a/osgimonitoring/plugins/org.eclipse.pde.runtime/src/org/eclipse/pde/internal/runtime/spy/handlers/SpyHandler.java b/osgimonitoring/plugins/org.eclipse.pde.runtime/src/org/eclipse/pde/internal/runtime/spy/handlers/SpyHandler.java
new file mode 100644
index 0000000..3babb1f
--- /dev/null
+++ b/osgimonitoring/plugins/org.eclipse.pde.runtime/src/org/eclipse/pde/internal/runtime/spy/handlers/SpyHandler.java
@@ -0,0 +1,44 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2008 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Chris Aniszczyk <zx@us.ibm.com> - initial API and implementation
+ * Kevin Doyle <kjdoyle@ca.ibm.com> - bug 200727
+ *******************************************************************************/
+package org.eclipse.pde.internal.runtime.spy.handlers;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.pde.internal.runtime.spy.dialogs.SpyDialog;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.handlers.HandlerUtil;
+
+/**
+ * @since 3.4
+ */
+public class SpyHandler extends AbstractHandler {
+
+ private SpyDialog INSTANCE = null;
+
+ public SpyHandler() { // do nothing
+ }
+
+ public Object execute(ExecutionEvent event) {
+ if (event != null) {
+ if (INSTANCE != null && INSTANCE.getShell() != null && !INSTANCE.getShell().isDisposed()) {
+ INSTANCE.close();
+ }
+ Shell shell = HandlerUtil.getActiveShell(event);
+ SpyDialog dialog = new SpyDialog(shell, event, shell.getDisplay().getCursorLocation());
+ INSTANCE = dialog;
+ dialog.create();
+ dialog.open();
+ }
+ return null;
+ }
+
+}
diff --git a/osgimonitoring/plugins/org.eclipse.pde.runtime/src/org/eclipse/pde/internal/runtime/spy/sections/ActiveDialogPageSection.java b/osgimonitoring/plugins/org.eclipse.pde.runtime/src/org/eclipse/pde/internal/runtime/spy/sections/ActiveDialogPageSection.java
new file mode 100644
index 0000000..3a88455
--- /dev/null
+++ b/osgimonitoring/plugins/org.eclipse.pde.runtime/src/org/eclipse/pde/internal/runtime/spy/sections/ActiveDialogPageSection.java
@@ -0,0 +1,81 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2008 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Chris Aniszczyk <zx@us.ibm.com> - initial API and implementation
+ * Kevin Doyle <kjdoyle@ca.ibm.com> - bug 207868, 207904
+ *******************************************************************************/
+package org.eclipse.pde.internal.runtime.spy.sections;
+
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.jface.dialogs.IDialogPage;
+import org.eclipse.jface.dialogs.IPageChangeProvider;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.pde.internal.runtime.PDERuntimeMessages;
+import org.eclipse.pde.internal.runtime.PDERuntimePlugin;
+import org.eclipse.pde.internal.runtime.spy.SpyFormToolkit;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.forms.widgets.ExpandableComposite;
+import org.eclipse.ui.forms.widgets.FormText;
+import org.eclipse.ui.forms.widgets.ScrolledForm;
+import org.eclipse.ui.forms.widgets.Section;
+import org.eclipse.ui.forms.widgets.TableWrapData;
+import org.eclipse.ui.handlers.HandlerUtil;
+import org.osgi.framework.Bundle;
+import org.osgi.service.packageadmin.PackageAdmin;
+
+/**
+ * @since 3.4
+ */
+public class ActiveDialogPageSection implements ISpySection {
+
+ public void build(ScrolledForm form, SpyFormToolkit toolkit, ExecutionEvent event) {
+ final Shell shell = HandlerUtil.getActiveShell(event);
+ Object object = shell.getData();
+ if (object == null)
+ return;
+ Class clazz = object.getClass();
+
+ if (object instanceof IPageChangeProvider) {
+ IPageChangeProvider pageChangeProvider = (IPageChangeProvider) object;
+ Object selectedPage = pageChangeProvider.getSelectedPage();
+ if (selectedPage != null) {
+ Section section = toolkit.createSection(form.getBody(), ExpandableComposite.TITLE_BAR);
+ section.clientVerticalSpacing = 9;
+ if (selectedPage instanceof IDialogPage) {
+ IDialogPage page = (IDialogPage) selectedPage;
+ clazz = page.getClass();
+ section.setText(NLS.bind(PDERuntimeMessages.SpyDialog_activeDialogPageSection_title, page.getTitle()));
+
+ } else {
+ clazz = selectedPage.getClass();
+ section.setText(PDERuntimeMessages.SpyDialog_activeDialogPageSection_title2);
+ }
+ // the active page
+ FormText text = toolkit.createFormText(section, true);
+ section.setClient(text);
+ TableWrapData td = new TableWrapData();
+ td.align = TableWrapData.FILL;
+ td.grabHorizontal = true;
+ section.setLayoutData(td);
+
+ StringBuffer buffer = new StringBuffer();
+ buffer.append("<form>"); //$NON-NLS-1$
+
+ buffer.append(toolkit.createClassSection(text, PDERuntimeMessages.SpyDialog_activeDialogPageSection_desc, new Class[] {clazz}));
+
+ PackageAdmin admin = PDERuntimePlugin.getDefault().getPackageAdmin();
+ Bundle bundle = admin.getBundle(clazz);
+ toolkit.generatePluginDetailsText(bundle, null, "dialog page", buffer, text); //$NON-NLS-1$
+
+ buffer.append("</form>"); //$NON-NLS-1$
+ text.setText(buffer.toString(), true, false);
+ }
+ }
+ }
+
+}
diff --git a/osgimonitoring/plugins/org.eclipse.pde.runtime/src/org/eclipse/pde/internal/runtime/spy/sections/ActiveFormEditorSection.java b/osgimonitoring/plugins/org.eclipse.pde.runtime/src/org/eclipse/pde/internal/runtime/spy/sections/ActiveFormEditorSection.java
new file mode 100644
index 0000000..0d27ea9
--- /dev/null
+++ b/osgimonitoring/plugins/org.eclipse.pde.runtime/src/org/eclipse/pde/internal/runtime/spy/sections/ActiveFormEditorSection.java
@@ -0,0 +1,60 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Code 9 Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Code 9 Corporation - initial API and implementation
+ * Ketan Padegaonkar <KetanPadegaonkar@gmail.com> - bug 241912
+ *******************************************************************************/
+package org.eclipse.pde.internal.runtime.spy.sections;
+
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.pde.internal.runtime.PDERuntimeMessages;
+import org.eclipse.pde.internal.runtime.spy.SpyFormToolkit;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.forms.editor.FormEditor;
+import org.eclipse.ui.forms.editor.IFormPage;
+import org.eclipse.ui.forms.widgets.*;
+import org.eclipse.ui.handlers.HandlerUtil;
+
+public class ActiveFormEditorSection implements ISpySection {
+
+ public void build(ScrolledForm form, SpyFormToolkit toolkit, ExecutionEvent event) {
+ final IWorkbenchPart part = HandlerUtil.getActivePart(event);
+ if (!(part instanceof FormEditor))
+ return;
+ FormEditor multiEditor = (FormEditor) part;
+
+ Shell shell = HandlerUtil.getActiveShell(event);
+ Object object = shell.getData();
+ if (object == null)
+ return;
+
+ IFormPage activePage = multiEditor.getActivePageInstance();
+
+ Section section = toolkit.createSection(form.getBody(), ExpandableComposite.TITLE_BAR);
+ section.setText(PDERuntimeMessages.ActiveFormEditorSection_Active_Form_Page);
+
+ FormText text = toolkit.createFormText(section, true);
+
+ section.setClient(text);
+ TableWrapData td = new TableWrapData();
+ td.align = TableWrapData.FILL;
+ td.grabHorizontal = true;
+ section.setLayoutData(td);
+
+ StringBuffer buffer = new StringBuffer();
+ buffer.append("<form>"); //$NON-NLS-1$
+ buffer.append(toolkit.createClassSection(text, NLS.bind(PDERuntimeMessages.SpyDialog_activePart_desc, "editor tab"), new Class[] {activePage.getClass()})); //$NON-NLS-1$
+ buffer.append("</form>"); //$NON-NLS-1$
+
+ text.setText(buffer.toString(), true, false);
+ text.layout();
+
+ }
+}
diff --git a/osgimonitoring/plugins/org.eclipse.pde.runtime/src/org/eclipse/pde/internal/runtime/spy/sections/ActiveHelpSection.java b/osgimonitoring/plugins/org.eclipse.pde.runtime/src/org/eclipse/pde/internal/runtime/spy/sections/ActiveHelpSection.java
new file mode 100644
index 0000000..c688d7a
--- /dev/null
+++ b/osgimonitoring/plugins/org.eclipse.pde.runtime/src/org/eclipse/pde/internal/runtime/spy/sections/ActiveHelpSection.java
@@ -0,0 +1,186 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2008 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Chris Aniszczyk <zx@us.ibm.com> - initial API and implementation
+ * Remy Suen <remy.suen@gmail.com> - bug 203451
+ *******************************************************************************/
+package org.eclipse.pde.internal.runtime.spy.sections;
+
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.help.IContext;
+import org.eclipse.help.IContextProvider;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.preference.IPreferencePage;
+import org.eclipse.jface.preference.PreferenceDialog;
+import org.eclipse.pde.internal.runtime.PDERuntimeMessages;
+import org.eclipse.pde.internal.runtime.PDERuntimePlugin;
+import org.eclipse.pde.internal.runtime.PDERuntimePluginImages;
+import org.eclipse.pde.internal.runtime.spy.SpyFormToolkit;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Widget;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IEditorReference;
+import org.eclipse.ui.IViewReference;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.forms.widgets.ExpandableComposite;
+import org.eclipse.ui.forms.widgets.FormText;
+import org.eclipse.ui.forms.widgets.ScrolledForm;
+import org.eclipse.ui.forms.widgets.Section;
+import org.eclipse.ui.forms.widgets.TableWrapData;
+import org.eclipse.ui.handlers.HandlerUtil;
+import org.eclipse.ui.internal.WorkbenchPartReference;
+import org.eclipse.ui.part.ViewPart;
+
+/**
+ * @since 3.4
+ */
+public class ActiveHelpSection implements ISpySection {
+
+ private SpyFormToolkit toolkit;
+
+ public void build(ScrolledForm form, SpyFormToolkit toolkit, ExecutionEvent event) {
+ this.toolkit = toolkit;
+ final Shell shell = HandlerUtil.getActiveShell(event);
+ Object object = shell.getData();
+ if (object == null)
+ return;
+
+ StringBuffer helpBuffer = new StringBuffer();
+ // process help
+ // TODO we need to make this cleaner... help processing is complicated atm
+ if (object instanceof PreferenceDialog) {
+ PreferenceDialog dialog = (PreferenceDialog) object;
+ IPreferencePage page = (IPreferencePage) dialog.getSelectedPage();
+ processHelp(page.getControl().getShell(), helpBuffer);
+ processChildren(page.getControl(), helpBuffer);
+ } else if (object instanceof Dialog) {
+ Dialog dialog = (Dialog) object;
+ processChildren(dialog.getShell(), helpBuffer);
+ } else {
+ helpBuffer.append(processControlHelp(event, toolkit));
+ }
+
+ if (helpBuffer != null && helpBuffer.length() > 0) {
+ Section section = toolkit.createSection(form.getBody(), ExpandableComposite.TITLE_BAR);
+ section.setText(PDERuntimeMessages.SpyDialog_activeHelpSection_title);
+ section.clientVerticalSpacing = 9;
+
+ FormText text = toolkit.createFormText(section, true);
+ section.setClient(text);
+ TableWrapData td = new TableWrapData();
+ td.align = TableWrapData.FILL;
+ td.grabHorizontal = true;
+ section.setLayoutData(td);
+
+ Image image = PDERuntimePluginImages.get(PDERuntimePluginImages.IMG_CONTEXTID_OBJ);
+ text.setImage("contextid", image); //$NON-NLS-1$
+
+ StringBuffer buffer = new StringBuffer();
+ buffer.append("<form>"); //$NON-NLS-1$
+ buffer.append("<p>"); //$NON-NLS-1$
+ buffer.append(PDERuntimeMessages.SpyDialog_activeHelpSection_desc);
+ buffer.append("</p>"); //$NON-NLS-1$
+ buffer.append(helpBuffer.toString());
+ buffer.append("</form>"); //$NON-NLS-1$
+ String content = buffer.toString().replaceAll("&", "&"); //$NON-NLS-1$ //$NON-NLS-2$
+ text.setText(content, true, false);
+ }
+
+ }
+
+ private void processHelp(Widget widget, StringBuffer buffer) {
+ buffer.append(toolkit.createHelpIdentifierSection(widget));
+ }
+
+ private void processChildren(Control control, StringBuffer buffer) {
+ processHelp(control, buffer);
+ if (control instanceof Composite) {
+ Composite composite = (Composite) control;
+ Control[] controls = composite.getChildren();
+ for (int i = 0; i < controls.length; i++) {
+ processChildren(controls[i], buffer);
+ }
+ }
+ }
+
+ private String processControlHelp(ExecutionEvent event, SpyFormToolkit toolkit) {
+ IWorkbenchPart part = HandlerUtil.getActivePart(event);
+ if (part == null)
+ return null;
+
+ IWorkbenchWindow window = part.getSite().getWorkbenchWindow();
+ if (window == null)
+ return null;
+
+ StringBuffer buffer = new StringBuffer();
+
+ Shell shell = null;
+ Control control = null;
+
+ if (part instanceof IEditorPart) {
+ IEditorPart editorPart = (IEditorPart) part;
+ shell = editorPart.getSite().getShell();
+
+ for (int j = 0; j < window.getActivePage().getEditorReferences().length; j++) {
+ IEditorReference er = window.getActivePage().getEditorReferences()[j];
+ if (er.getId().equals(editorPart.getEditorSite().getId()))
+ if (er instanceof WorkbenchPartReference) {
+ WorkbenchPartReference wpr = (WorkbenchPartReference) er;
+ control = wpr.getPane().getControl();
+ shell = null;
+ break;
+ }
+ }
+ } else if (part instanceof ViewPart) {
+ ViewPart viewPart = (ViewPart) part;
+ shell = viewPart.getSite().getShell();
+ for (int j = 0; j < window.getActivePage().getViewReferences().length; j++) {
+ IViewReference vr = window.getActivePage().getViewReferences()[j];
+ if (vr.getId().equals(viewPart.getViewSite().getId()))
+ if (vr instanceof WorkbenchPartReference) {
+ WorkbenchPartReference wpr = (WorkbenchPartReference) vr;
+ control = wpr.getPane().getControl();
+ shell = null;
+ break;
+ }
+ }
+
+ }
+ if (shell != null) {
+ buffer.append(toolkit.createHelpIdentifierSection(shell));
+ for (int i = 0; i < shell.getChildren().length; i++) {
+ processChildren(shell.getChildren()[i], buffer);
+ }
+ } else if (control != null) {
+ // if we don't have org.eclipse.help, we will have problems when trying to load IContextProvider
+ if (!PDERuntimePlugin.HAS_IDE_BUNDLES)
+ processChildren(control, buffer);
+ else {
+ IContextProvider provider = (IContextProvider) part.getAdapter(IContextProvider.class);
+ IContext context = (provider != null) ? provider.getContext(control) : null;
+ if (context != null) {
+ buffer.append(toolkit.createHelpIdentifierSection(context));
+ } else {
+ buffer.append(toolkit.createHelpIdentifierSection(control));
+ }
+ if (control instanceof Composite) {
+ Composite parent = (Composite) control;
+ for (int i = 0; i < parent.getChildren().length; i++) {
+ processChildren(parent.getChildren()[i], buffer);
+ }
+ }
+ }
+ }
+ return buffer.toString();
+ }
+
+}
diff --git a/osgimonitoring/plugins/org.eclipse.pde.runtime/src/org/eclipse/pde/internal/runtime/spy/sections/ActiveMenuSection.java b/osgimonitoring/plugins/org.eclipse.pde.runtime/src/org/eclipse/pde/internal/runtime/spy/sections/ActiveMenuSection.java
new file mode 100644
index 0000000..2e208b8
--- /dev/null
+++ b/osgimonitoring/plugins/org.eclipse.pde.runtime/src/org/eclipse/pde/internal/runtime/spy/sections/ActiveMenuSection.java
@@ -0,0 +1,177 @@
+/*******************************************************************************
+ * Copyright (c) 2009 EclipseSource Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * EclipseSource Corporation - initial API and implementation
+ * Anyware Technologies - ongoing enhancements
+ *******************************************************************************/
+package org.eclipse.pde.internal.runtime.spy.sections;
+
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import org.eclipse.core.commands.Command;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.jface.action.*;
+import org.eclipse.pde.internal.runtime.PDERuntimeMessages;
+import org.eclipse.pde.internal.runtime.PDERuntimePlugin;
+import org.eclipse.pde.internal.runtime.spy.SpyFormToolkit;
+import org.eclipse.swt.widgets.*;
+import org.eclipse.ui.IActionDelegate;
+import org.eclipse.ui.actions.RetargetAction;
+import org.eclipse.ui.forms.widgets.*;
+import org.eclipse.ui.internal.*;
+import org.eclipse.ui.menus.CommandContributionItem;
+import org.osgi.framework.Bundle;
+import org.osgi.service.packageadmin.PackageAdmin;
+
+/**
+ * @since 3.5
+ */
+public class ActiveMenuSection implements ISpySection {
+
+ public void build(ScrolledForm form, SpyFormToolkit toolkit, Event event) {
+
+ Object object = event.widget.getData();
+ if (object != null) {
+ Section section = toolkit.createSection(form.getBody(), ExpandableComposite.TITLE_BAR);
+ section.clientVerticalSpacing = 9;
+ section.setText(PDERuntimeMessages.SpyDialog_activeSelection_title);
+ FormText text = toolkit.createFormText(section, true);
+ section.setClient(text);
+
+ TableWrapData td = new TableWrapData();
+ td.align = TableWrapData.FILL;
+ td.grabHorizontal = true;
+ section.setLayoutData(td);
+
+ StringBuffer buffer = new StringBuffer();
+ buffer.append("<form>"); //$NON-NLS-1$
+ if (object instanceof IContributionItem) {
+ IContributionItem item = (IContributionItem) object;
+ String id = item.getId();
+ if (id != null) {
+ buffer.append(toolkit.createIdentifierSection(text, PDERuntimeMessages.ActiveMenuSection_0, new String[] {id}));
+ }
+ if (object instanceof ContributionItem) {
+ createLocationURI(toolkit, object, text, buffer, id);
+ }
+ scan(item, buffer, toolkit, text);
+ }
+
+ buffer.append("</form>"); //$NON-NLS-1$
+ text.setText(buffer.toString(), true, false);
+ }
+ }
+
+ private void createLocationURI(SpyFormToolkit toolkit, Object object, FormText text, StringBuffer buffer, String id) {
+ IContributionManager parent = ((ContributionItem) object).getParent();
+ if (parent instanceof IMenuManager) {
+ String parentId = ((IMenuManager) parent).getId();
+ String locationURI = "menu:" + parentId + (id == null ? "?after=additions" : "?after=" + id); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ buffer.append(toolkit.createIdentifierSection(text, PDERuntimeMessages.ActiveMenuSection_7, new String[] {locationURI}));
+ } else if (parent instanceof ToolBarManager) {
+ ToolBar bar = ((ToolBarManager) parent).getControl();
+ if (bar.getParent() instanceof CoolBar) {
+ CoolItem[] items = ((CoolBar) bar.getParent()).getItems();
+ for (int i = 0; i < items.length; i++) {
+ CoolItem coolItem = items[i];
+ if (coolItem.getControl() == bar) {
+ Object o = coolItem.getData();
+ if (o instanceof ToolBarContributionItem) {
+ String parentId = ((ToolBarContributionItem) o).getId();
+ String locationURI = "toolbar:" + parentId + (id == null ? "?after=additions" : "?after=" + id); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ buffer.append(toolkit.createIdentifierSection(text, PDERuntimeMessages.ActiveMenuSection_7, new String[] {locationURI}));
+ }
+ continue;
+ }
+ }
+ }
+ }
+ }
+
+ // FIXME this is a bit hackish but works... need to redo
+ private void scan(IContributionItem item, StringBuffer buffer, SpyFormToolkit toolkit, FormText text) {
+ // check for action set information
+ if (item instanceof IActionSetContributionItem) {
+ IActionSetContributionItem actionItem = (IActionSetContributionItem) item;
+ buffer.append(toolkit.createIdentifierSection(text, PDERuntimeMessages.ActiveMenuSection_1, new String[] {actionItem.getActionSetId()}));
+ }
+ if (item instanceof ActionContributionItem) {
+ createActionContributionItemText(item, buffer, toolkit, text);
+ } else if (item instanceof SubContributionItem) {
+ SubContributionItem subItem = (SubContributionItem) item;
+ scan(subItem.getInnerItem(), buffer, toolkit, text); // recurse
+ } else if (item instanceof CommandContributionItem) { // TODO... this is hard...
+ CommandContributionItem contributionItem = (CommandContributionItem) item;
+ Command command = contributionItem.getCommand().getCommand();
+ buffer.append(toolkit.createClassSection(text, PDERuntimeMessages.ActiveMenuSection_2, new Class[] {command.getClass()}));
+ buffer.append(toolkit.createClassSection(text, PDERuntimeMessages.ActiveMenuSection_3, new Class[] {command.getHandler().getClass()}));
+ }
+ }
+
+ private void createActionContributionItemText(Object object, StringBuffer buffer, SpyFormToolkit toolkit, FormText text) {
+ ActionContributionItem actionItem = (ActionContributionItem) object;
+ IAction action = actionItem.getAction();
+
+ String id = action.getActionDefinitionId();
+ if (id != null) {
+ buffer.append(toolkit.createIdentifierSection(text, PDERuntimeMessages.ActiveMenuSection_4, new String[] {action.getActionDefinitionId()}));
+ }
+
+ if (action instanceof PluginAction) {
+ PluginAction pluginAction = (PluginAction) action;
+ Class clazz = pluginAction.getClass();
+ createActionContributionItemText(object, buffer, toolkit, text, clazz, pluginAction);
+
+ } else {
+ // normal JFace Actions
+ Class clazz = action.getClass();
+ buffer.append(toolkit.createClassSection(text, PDERuntimeMessages.ActiveMenuSection_5, new Class[] {clazz}));
+ PackageAdmin admin = PDERuntimePlugin.getDefault().getPackageAdmin();
+ Bundle bundle = admin.getBundle(clazz);
+ toolkit.generatePluginDetailsText(bundle, null, "meow", buffer, text); //$NON-NLS-1$
+ }
+
+ }
+
+ private void createActionContributionItemText(Object object, StringBuffer buffer, SpyFormToolkit toolkit, FormText text, Class clazz, PluginAction pluginAction) {
+ try {
+ RetargetAction retargetAction = null;
+ IActionDelegate delegate = null;
+ if (pluginAction instanceof WWinPluginAction) {
+ // such an action *may* have a retarget action
+ Field field = clazz.getDeclaredField("retargetAction"); //$NON-NLS-1$
+ field.setAccessible(true);
+ retargetAction = (RetargetAction) field.get(pluginAction);
+ }
+ // if there's no retarget action OR if the pluginAction is not a WWinPluginAction, let's try to find the action delegate
+ if (retargetAction == null) {
+ Field field = clazz.getDeclaredField("delegate"); //$NON-NLS-1$
+ field.setAccessible(true);
+ delegate = (IActionDelegate) field.get(pluginAction);
+ if (delegate == null) { // have to invoke createDelegate if we don't have one yet...
+ Method method = clazz.getDeclaredMethod("createDelegate", null); //$NON-NLS-1$
+ method.setAccessible(true);
+ method.invoke(pluginAction, null);
+ delegate = (IActionDelegate) field.get(pluginAction);
+ }
+ }
+ buffer.append(toolkit.createClassSection(text, PDERuntimeMessages.ActiveMenuSection_6, new Class[] {(retargetAction == null) ? delegate.getClass() : retargetAction.getActionHandler().getClass()}));
+ PackageAdmin admin = PDERuntimePlugin.getDefault().getPackageAdmin();
+ Bundle bundle = admin.getBundle(clazz);
+ toolkit.generatePluginDetailsText(bundle, null, "menu item", buffer, text); //$NON-NLS-1$
+
+ } catch (Exception e) {
+ createActionContributionItemText(object, buffer, toolkit, text, clazz.getSuperclass(), pluginAction);
+ }
+ }
+
+ public void build(ScrolledForm form, SpyFormToolkit toolkit, ExecutionEvent event) {
+ // do nothing
+ }
+
+}
diff --git a/osgimonitoring/plugins/org.eclipse.pde.runtime/src/org/eclipse/pde/internal/runtime/spy/sections/ActivePartSection.java b/osgimonitoring/plugins/org.eclipse.pde.runtime/src/org/eclipse/pde/internal/runtime/spy/sections/ActivePartSection.java
new file mode 100644
index 0000000..eab9dda
--- /dev/null
+++ b/osgimonitoring/plugins/org.eclipse.pde.runtime/src/org/eclipse/pde/internal/runtime/spy/sections/ActivePartSection.java
@@ -0,0 +1,120 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2009 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Chris Aniszczyk <zx@us.ibm.com> - initial API and implementation
+ * Heiko Seeberger - changes for bug 237764
+ *******************************************************************************/
+package org.eclipse.pde.internal.runtime.spy.sections;
+
+import java.lang.reflect.Field;
+import java.util.*;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.pde.internal.runtime.*;
+import org.eclipse.pde.internal.runtime.spy.SpyFormToolkit;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.ui.*;
+import org.eclipse.ui.forms.widgets.*;
+import org.eclipse.ui.handlers.HandlerUtil;
+import org.eclipse.ui.internal.PartSite;
+import org.eclipse.ui.internal.PopupMenuExtender;
+import org.eclipse.ui.part.IPage;
+import org.eclipse.ui.part.PageBookView;
+import org.osgi.framework.Bundle;
+
+/**
+ * @since 3.4
+ */
+public class ActivePartSection implements ISpySection {
+
+ public void build(ScrolledForm form, SpyFormToolkit toolkit, ExecutionEvent event) {
+ IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindow(event);
+ if (window == null) // if we don't have an active workbench, we don't have a valid selection to analyze
+ return;
+
+ final IWorkbenchPart part = HandlerUtil.getActivePart(event);
+ if (part == null)
+ return; // (Bug 237764) if no active part let's do nothing ...
+
+ String partType = part instanceof IEditorPart ? "editor" : "view"; //$NON-NLS-1$ //$NON-NLS-2$
+ Section section = toolkit.createSection(form.getBody(), ExpandableComposite.TITLE_BAR);
+
+ section.setText(NLS.bind(PDERuntimeMessages.SpyDialog_activePart_title, part.getSite().getRegisteredName()));
+
+ FormText text = toolkit.createFormText(section, true);
+ section.setClient(text);
+ TableWrapData td = new TableWrapData();
+ td.align = TableWrapData.FILL;
+ td.grabHorizontal = true;
+ section.setLayoutData(td);
+
+ //toolkit.createImageAction(section, part.getTitleImage());
+
+ StringBuffer buffer = new StringBuffer();
+ buffer.append("<form>"); //$NON-NLS-1$
+
+ // time to analyze the active part
+ buffer.append(toolkit.createClassSection(text, NLS.bind(PDERuntimeMessages.SpyDialog_activePart_desc, partType), new Class[] {part.getClass()}));
+ if (part instanceof PageBookView) {
+ PageBookView outline = (PageBookView) part;
+ IPage currentPage = outline.getCurrentPage();
+ if (currentPage != null) {
+ buffer.append(toolkit.createClassSection(text, PDERuntimeMessages.SpyDialog_activePageBook_title, new Class[] {currentPage.getClass()}));
+ }
+ }
+
+ // time to analyze the contributing plug-in
+ final Bundle bundle = Platform.getBundle(part.getSite().getPluginId());
+
+ toolkit.generatePluginDetailsText(bundle, part.getSite().getId(), partType, buffer, text);
+
+ // get menu information using reflection
+ try {
+ PartSite site = (PartSite) part.getSite();
+ Class clazz = site.getClass().getSuperclass();
+ Field field = clazz.getDeclaredField("menuExtenders"); //$NON-NLS-1$
+ field.setAccessible(true);
+ List list = (List) field.get(site);
+ if (list != null && list.size() > 0) {
+ Set menuIds = new LinkedHashSet();
+ for (int i = 0; i < list.size(); i++) {
+ PopupMenuExtender extender = (PopupMenuExtender) list.get(i);
+ menuIds.addAll(extender.getMenuIds());
+ }
+ buffer.append("<p>"); //$NON-NLS-1$
+ buffer.append(PDERuntimeMessages.SpyDialog_activeMenuIds);
+ buffer.append("</p>"); //$NON-NLS-1$
+ for (Iterator it = menuIds.iterator(); it.hasNext();) {
+ buffer.append("<li bindent=\"20\" style=\"image\" value=\"menu\">"); //$NON-NLS-1$
+ buffer.append(it.next().toString());
+ buffer.append("</li>"); //$NON-NLS-1$
+ }
+ Image menuImage = PDERuntimePluginImages.get(PDERuntimePluginImages.IMG_MENU_OBJ);
+ text.setImage("menu", menuImage); //$NON-NLS-1$
+ }
+ } catch (SecurityException e) {
+ PDERuntimePlugin.log(e);
+ } catch (NoSuchFieldException e) {
+ PDERuntimePlugin.log(e);
+ } catch (IllegalArgumentException e) {
+ PDERuntimePlugin.log(e);
+ } catch (IllegalAccessException e) {
+ PDERuntimePlugin.log(e);
+ }
+
+ buffer.append("</form>"); //$NON-NLS-1$
+
+ Image idImage = PDERuntimePluginImages.get(PDERuntimePluginImages.IMG_ID_OBJ);
+ text.setImage("id", idImage); //$NON-NLS-1$
+
+ text.setText(buffer.toString(), true, false);
+ text.layout();
+ }
+
+}
diff --git a/osgimonitoring/plugins/org.eclipse.pde.runtime/src/org/eclipse/pde/internal/runtime/spy/sections/ActiveSelectionSection.java b/osgimonitoring/plugins/org.eclipse.pde.runtime/src/org/eclipse/pde/internal/runtime/spy/sections/ActiveSelectionSection.java
new file mode 100644
index 0000000..e8319aa
--- /dev/null
+++ b/osgimonitoring/plugins/org.eclipse.pde.runtime/src/org/eclipse/pde/internal/runtime/spy/sections/ActiveSelectionSection.java
@@ -0,0 +1,80 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2009 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Chris Aniszczyk <zx@us.ibm.com> - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.pde.internal.runtime.spy.sections;
+
+import org.eclipse.osgi.util.NLS;
+
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.pde.internal.runtime.PDERuntimeMessages;
+import org.eclipse.pde.internal.runtime.spy.SpyFormToolkit;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.forms.widgets.ExpandableComposite;
+import org.eclipse.ui.forms.widgets.FormText;
+import org.eclipse.ui.forms.widgets.ScrolledForm;
+import org.eclipse.ui.forms.widgets.Section;
+import org.eclipse.ui.forms.widgets.TableWrapData;
+import org.eclipse.ui.handlers.HandlerUtil;
+
+/**
+ * @since 3.4
+ */
+public class ActiveSelectionSection implements ISpySection {
+
+ public void build(ScrolledForm form, SpyFormToolkit toolkit, ExecutionEvent event) {
+ IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindow(event);
+ if (window == null) // if we don't have an active workbench, we don't have a valid selection to analyze
+ return;
+
+ // analyze the selection
+ ISelection selection = HandlerUtil.getCurrentSelection(event);
+ if (selection != null) {
+ Section section = toolkit.createSection(form.getBody(), ExpandableComposite.TITLE_BAR);
+ section.clientVerticalSpacing = 9;
+ section.setText(PDERuntimeMessages.SpyDialog_activeSelection_title);
+ FormText text = toolkit.createFormText(section, true);
+ section.setClient(text);
+
+ TableWrapData td = new TableWrapData();
+ td.align = TableWrapData.FILL;
+ td.grabHorizontal = true;
+ section.setLayoutData(td);
+
+ // time to analyze the selection
+ Class clazz = selection.getClass();
+ StringBuffer buffer = new StringBuffer();
+ buffer.append("<form>"); //$NON-NLS-1$
+ buffer.append(toolkit.createClassSection(text, PDERuntimeMessages.SpyDialog_activeSelection_desc, new Class[] {clazz}));
+
+ Class[] interfaces = clazz.getInterfaces();
+ buffer.append(toolkit.createInterfaceSection(text, PDERuntimeMessages.SpyDialog_activeSelectionInterfaces_desc, interfaces));
+
+ if (selection instanceof IStructuredSelection) {
+ IStructuredSelection ss = (IStructuredSelection) selection;
+ int size = ss.size();
+ if (size == 1) {
+ clazz = ss.getFirstElement().getClass();
+ buffer.append(toolkit.createClassSection(text, PDERuntimeMessages.SpyDialog_activeSelectedElement_desc, new Class[] {clazz}));
+
+ interfaces = clazz.getInterfaces();
+ buffer.append(toolkit.createInterfaceSection(text, PDERuntimeMessages.SpyDialog_activeSelectedElementInterfaces_desc, interfaces));
+ } else if (size > 1) {
+ buffer.append(NLS.bind(PDERuntimeMessages.SpyDialog_activeSelectedElementsCount_desc, new Integer(size)));
+ }
+ }
+
+ buffer.append("</form>"); //$NON-NLS-1$
+ text.setText(buffer.toString(), true, false);
+ }
+ }
+
+}
diff --git a/osgimonitoring/plugins/org.eclipse.pde.runtime/src/org/eclipse/pde/internal/runtime/spy/sections/ActiveShellSection.java b/osgimonitoring/plugins/org.eclipse.pde.runtime/src/org/eclipse/pde/internal/runtime/spy/sections/ActiveShellSection.java
new file mode 100644
index 0000000..7948493
--- /dev/null
+++ b/osgimonitoring/plugins/org.eclipse.pde.runtime/src/org/eclipse/pde/internal/runtime/spy/sections/ActiveShellSection.java
@@ -0,0 +1,57 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2008 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Chris Aniszczyk <zx@us.ibm.com> - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.pde.internal.runtime.spy.sections;
+
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.pde.internal.runtime.PDERuntimeMessages;
+import org.eclipse.pde.internal.runtime.spy.SpyFormToolkit;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.forms.widgets.ExpandableComposite;
+import org.eclipse.ui.forms.widgets.FormText;
+import org.eclipse.ui.forms.widgets.ScrolledForm;
+import org.eclipse.ui.forms.widgets.Section;
+import org.eclipse.ui.forms.widgets.TableWrapData;
+import org.eclipse.ui.handlers.HandlerUtil;
+
+/**
+ * @since 3.4
+ */
+public class ActiveShellSection implements ISpySection {
+
+ public void build(ScrolledForm form, SpyFormToolkit toolkit, ExecutionEvent event) {
+ final Shell shell = HandlerUtil.getActiveShell(event);
+ Object object = shell.getData();
+ if (object == null)
+ return;
+ Class clazz = object.getClass();
+
+ Section section = toolkit.createSection(form.getBody(), ExpandableComposite.TITLE_BAR);
+ section.clientVerticalSpacing = 9;
+
+ section.setText(PDERuntimeMessages.SpyDialog_activeShell_title);
+
+ FormText text = toolkit.createFormText(section, true);
+ section.setClient(text);
+ TableWrapData td = new TableWrapData();
+ td.align = TableWrapData.FILL;
+ td.grabHorizontal = true;
+ section.setLayoutData(td);
+
+ StringBuffer buffer = new StringBuffer();
+ buffer.append("<form>"); //$NON-NLS-1$
+
+ buffer.append(toolkit.createClassSection(text, PDERuntimeMessages.SpyDialog_activeShell_desc, new Class[] {clazz}));
+
+ buffer.append("</form>"); //$NON-NLS-1$
+ text.setText(buffer.toString(), true, false);
+ }
+
+}
diff --git a/osgimonitoring/plugins/org.eclipse.pde.runtime/src/org/eclipse/pde/internal/runtime/spy/sections/ActiveWizardSection.java b/osgimonitoring/plugins/org.eclipse.pde.runtime/src/org/eclipse/pde/internal/runtime/spy/sections/ActiveWizardSection.java
new file mode 100644
index 0000000..5fc3b50
--- /dev/null
+++ b/osgimonitoring/plugins/org.eclipse.pde.runtime/src/org/eclipse/pde/internal/runtime/spy/sections/ActiveWizardSection.java
@@ -0,0 +1,75 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2008 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Chris Aniszczyk <zx@us.ibm.com> - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.pde.internal.runtime.spy.sections;
+
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.jface.wizard.IWizard;
+import org.eclipse.jface.wizard.IWizardPage;
+import org.eclipse.jface.wizard.WizardDialog;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.pde.internal.runtime.PDERuntimeMessages;
+import org.eclipse.pde.internal.runtime.PDERuntimePlugin;
+import org.eclipse.pde.internal.runtime.spy.SpyFormToolkit;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.forms.widgets.ExpandableComposite;
+import org.eclipse.ui.forms.widgets.FormText;
+import org.eclipse.ui.forms.widgets.ScrolledForm;
+import org.eclipse.ui.forms.widgets.Section;
+import org.eclipse.ui.forms.widgets.TableWrapData;
+import org.eclipse.ui.handlers.HandlerUtil;
+import org.osgi.framework.Bundle;
+import org.osgi.service.packageadmin.PackageAdmin;
+
+/**
+ * @since 3.4
+ */
+public class ActiveWizardSection implements ISpySection {
+
+ public void build(ScrolledForm form, SpyFormToolkit toolkit, ExecutionEvent event) {
+ final Shell shell = HandlerUtil.getActiveShell(event);
+ Object object = shell.getData();
+ if (object == null)
+ return;
+ Class clazz = object.getClass();
+
+ if (object instanceof WizardDialog) {
+ WizardDialog dialog = (WizardDialog) object;
+ IWizardPage page = dialog.getCurrentPage();
+ IWizard wizard = page.getWizard();
+ clazz = wizard.getClass();
+
+ Section section = toolkit.createSection(form.getBody(), ExpandableComposite.TITLE_BAR);
+ section.clientVerticalSpacing = 9;
+
+ // the active wizard
+ FormText text = toolkit.createFormText(section, true);
+ section.setClient(text);
+ TableWrapData td = new TableWrapData();
+ td.align = TableWrapData.FILL;
+ td.grabHorizontal = true;
+ section.setLayoutData(td);
+
+ StringBuffer buffer = new StringBuffer();
+ buffer.append("<form>"); //$NON-NLS-1$
+ section.setText(NLS.bind(PDERuntimeMessages.SpyDialog_activeWizard_title, wizard.getWindowTitle()));
+
+ buffer.append(toolkit.createClassSection(text, PDERuntimeMessages.SpyDialog_activeWizard_desc, new Class[] {clazz}));
+
+ PackageAdmin admin = PDERuntimePlugin.getDefault().getPackageAdmin();
+ Bundle bundle = admin.getBundle(clazz);
+ toolkit.generatePluginDetailsText(bundle, null, "wizard", buffer, text); //$NON-NLS-1$
+ buffer.append("</form>"); //$NON-NLS-1$
+
+ text.setText(buffer.toString(), true, false);
+ }
+ }
+
+}
diff --git a/osgimonitoring/plugins/org.eclipse.pde.runtime/src/org/eclipse/pde/internal/runtime/spy/sections/ISpySection.java b/osgimonitoring/plugins/org.eclipse.pde.runtime/src/org/eclipse/pde/internal/runtime/spy/sections/ISpySection.java
new file mode 100644
index 0000000..7eb7761
--- /dev/null
+++ b/osgimonitoring/plugins/org.eclipse.pde.runtime/src/org/eclipse/pde/internal/runtime/spy/sections/ISpySection.java
@@ -0,0 +1,24 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2008 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Chris Aniszczyk <zx@us.ibm.com> - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.pde.internal.runtime.spy.sections;
+
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.pde.internal.runtime.spy.SpyFormToolkit;
+import org.eclipse.ui.forms.widgets.ScrolledForm;
+
+/**
+ * @since 3.4
+ */
+public interface ISpySection {
+
+ public void build(ScrolledForm form, SpyFormToolkit toolkit, ExecutionEvent event);
+
+}