Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEugene Tarassov2011-11-11 18:51:51 +0000
committerEugene Tarassov2011-11-11 18:51:51 +0000
commit9587c5ddf0b78aa00883d5cac15ce23dd116df9e (patch)
treed1f1e47b0fb5950ba40881d82f2c4a5f3bb1cfca /plugins/org.eclipse.tm.tcf.cdt.ui
parentf8bdfbc8174a8255d41b8e03183aab2205304243 (diff)
downloadorg.eclipse.tcf-9587c5ddf0b78aa00883d5cac15ce23dd116df9e.tar.gz
org.eclipse.tcf-9587c5ddf0b78aa00883d5cac15ce23dd116df9e.tar.xz
org.eclipse.tcf-9587c5ddf0b78aa00883d5cac15ce23dd116df9e.zip
TCF Java package names changed: org.eclipse.tm.tcf.* -> org.eclipse.tcf.*
Diffstat (limited to 'plugins/org.eclipse.tm.tcf.cdt.ui')
-rw-r--r--plugins/org.eclipse.tm.tcf.cdt.ui/.classpath7
-rw-r--r--plugins/org.eclipse.tm.tcf.cdt.ui/.project39
-rw-r--r--plugins/org.eclipse.tm.tcf.cdt.ui/.settings/org.eclipse.jdt.core.prefs299
-rw-r--r--plugins/org.eclipse.tm.tcf.cdt.ui/.settings/org.eclipse.jdt.ui.prefs4
-rw-r--r--plugins/org.eclipse.tm.tcf.cdt.ui/META-INF/MANIFEST.MF27
-rw-r--r--plugins/org.eclipse.tm.tcf.cdt.ui/about.html28
-rw-r--r--plugins/org.eclipse.tm.tcf.cdt.ui/build.properties19
-rw-r--r--plugins/org.eclipse.tm.tcf.cdt.ui/icons/obj16/c_app.gifbin606 -> 0 bytes
-rw-r--r--plugins/org.eclipse.tm.tcf.cdt.ui/plugin.properties44
-rw-r--r--plugins/org.eclipse.tm.tcf.cdt.ui/plugin.xml361
-rw-r--r--plugins/org.eclipse.tm.tcf.cdt.ui/pom.xml17
-rw-r--r--plugins/org.eclipse.tm.tcf.cdt.ui/src/org/eclipse/tm/internal/tcf/cdt/launch/ContextSelection.java25
-rw-r--r--plugins/org.eclipse.tm.tcf.cdt.ui/src/org/eclipse/tm/internal/tcf/cdt/launch/TCFCDTLaunchDelegate.java144
-rw-r--r--plugins/org.eclipse.tm.tcf.cdt.ui/src/org/eclipse/tm/internal/tcf/cdt/ui/Activator.java104
-rw-r--r--plugins/org.eclipse.tm.tcf.cdt.ui/src/org/eclipse/tm/internal/tcf/cdt/ui/EvaluationContextManager.java196
-rw-r--r--plugins/org.eclipse.tm.tcf.cdt.ui/src/org/eclipse/tm/internal/tcf/cdt/ui/ImageCache.java68
-rw-r--r--plugins/org.eclipse.tm.tcf.cdt.ui/src/org/eclipse/tm/internal/tcf/cdt/ui/TCFBreakpointActions.java297
-rw-r--r--plugins/org.eclipse.tm.tcf.cdt.ui/src/org/eclipse/tm/internal/tcf/cdt/ui/TCFBreakpointStatusListener.java362
-rw-r--r--plugins/org.eclipse.tm.tcf.cdt.ui/src/org/eclipse/tm/internal/tcf/cdt/ui/TCFLaunchContext.java328
-rw-r--r--plugins/org.eclipse.tm.tcf.cdt.ui/src/org/eclipse/tm/internal/tcf/cdt/ui/TCFNodeAdapterFactory.java135
-rw-r--r--plugins/org.eclipse.tm.tcf.cdt.ui/src/org/eclipse/tm/internal/tcf/cdt/ui/TCFSteppingModeTarget.java76
-rw-r--r--plugins/org.eclipse.tm.tcf.cdt.ui/src/org/eclipse/tm/internal/tcf/cdt/ui/TCFSuspendResumeAdapter.java555
-rw-r--r--plugins/org.eclipse.tm.tcf.cdt.ui/src/org/eclipse/tm/internal/tcf/cdt/ui/breakpoints/TCFBreakpointScopeExtension.java74
-rw-r--r--plugins/org.eclipse.tm.tcf.cdt.ui/src/org/eclipse/tm/internal/tcf/cdt/ui/breakpoints/TCFBreakpointStatusPage.java329
-rw-r--r--plugins/org.eclipse.tm.tcf.cdt.ui/src/org/eclipse/tm/internal/tcf/cdt/ui/breakpoints/TCFBreakpointThreadFilterPage.java83
-rw-r--r--plugins/org.eclipse.tm.tcf.cdt.ui/src/org/eclipse/tm/internal/tcf/cdt/ui/breakpoints/TCFThreadFilterEditor.java466
-rw-r--r--plugins/org.eclipse.tm.tcf.cdt.ui/src/org/eclipse/tm/internal/tcf/cdt/ui/breakpoints/TCFWatchpointTarget.java59
-rw-r--r--plugins/org.eclipse.tm.tcf.cdt.ui/src/org/eclipse/tm/internal/tcf/cdt/ui/commands/AddFunctionBreakointHandler.java73
-rw-r--r--plugins/org.eclipse.tm.tcf.cdt.ui/src/org/eclipse/tm/internal/tcf/cdt/ui/commands/AddWatchpointHandler.java55
-rw-r--r--plugins/org.eclipse.tm.tcf.cdt.ui/src/org/eclipse/tm/internal/tcf/cdt/ui/commands/TCFPinViewCommand.java274
-rw-r--r--plugins/org.eclipse.tm.tcf.cdt.ui/src/org/eclipse/tm/internal/tcf/cdt/ui/commands/TCFReverseDebuggingPropertyTester.java27
-rw-r--r--plugins/org.eclipse.tm.tcf.cdt.ui/src/org/eclipse/tm/internal/tcf/cdt/ui/commands/TCFReverseResumeCommand.java26
-rw-r--r--plugins/org.eclipse.tm.tcf.cdt.ui/src/org/eclipse/tm/internal/tcf/cdt/ui/commands/TCFReverseStepIntoCommand.java26
-rw-r--r--plugins/org.eclipse.tm.tcf.cdt.ui/src/org/eclipse/tm/internal/tcf/cdt/ui/commands/TCFReverseStepOverCommand.java26
-rw-r--r--plugins/org.eclipse.tm.tcf.cdt.ui/src/org/eclipse/tm/internal/tcf/cdt/ui/commands/TCFReverseStepReturnCommand.java26
-rw-r--r--plugins/org.eclipse.tm.tcf.cdt.ui/src/org/eclipse/tm/internal/tcf/cdt/ui/commands/TCFReverseToggleCommand.java40
-rw-r--r--plugins/org.eclipse.tm.tcf.cdt.ui/src/org/eclipse/tm/internal/tcf/cdt/ui/disassembly/TCFDisassemblyBackend.java985
-rw-r--r--plugins/org.eclipse.tm.tcf.cdt.ui/src/org/eclipse/tm/internal/tcf/cdt/ui/disassembly/TCFDisassemblyBackendFactory.java36
-rw-r--r--plugins/org.eclipse.tm.tcf.cdt.ui/src/org/eclipse/tm/internal/tcf/cdt/ui/hover/ExpressionInformationControlCreator.java471
-rw-r--r--plugins/org.eclipse.tm.tcf.cdt.ui/src/org/eclipse/tm/internal/tcf/cdt/ui/hover/TCFDebugTextHover.java211
-rw-r--r--plugins/org.eclipse.tm.tcf.cdt.ui/src/org/eclipse/tm/internal/tcf/cdt/ui/launch/FileSystemBrowserControl.java515
-rw-r--r--plugins/org.eclipse.tm.tcf.cdt.ui/src/org/eclipse/tm/internal/tcf/cdt/ui/launch/PeerListControl.java639
-rw-r--r--plugins/org.eclipse.tm.tcf.cdt.ui/src/org/eclipse/tm/internal/tcf/cdt/ui/launch/ProcessListControl.java505
-rw-r--r--plugins/org.eclipse.tm.tcf.cdt.ui/src/org/eclipse/tm/internal/tcf/cdt/ui/launch/ProcessPrompter.java39
-rw-r--r--plugins/org.eclipse.tm.tcf.cdt.ui/src/org/eclipse/tm/internal/tcf/cdt/ui/launch/ProcessSelectionDialog.java120
-rw-r--r--plugins/org.eclipse.tm.tcf.cdt.ui/src/org/eclipse/tm/internal/tcf/cdt/ui/launch/RemoteCMainTab.java437
-rw-r--r--plugins/org.eclipse.tm.tcf.cdt.ui/src/org/eclipse/tm/internal/tcf/cdt/ui/launch/RemoteFileSelectionDialog.java170
-rw-r--r--plugins/org.eclipse.tm.tcf.cdt.ui/src/org/eclipse/tm/internal/tcf/cdt/ui/sourcelookup/TCFCSourceNotFoundEditor.java93
-rw-r--r--plugins/org.eclipse.tm.tcf.cdt.ui/src/org/eclipse/tm/internal/tcf/cdt/ui/sourcelookup/TCFSourceNotFoundPresentation.java79
49 files changed, 0 insertions, 9019 deletions
diff --git a/plugins/org.eclipse.tm.tcf.cdt.ui/.classpath b/plugins/org.eclipse.tm.tcf.cdt.ui/.classpath
deleted file mode 100644
index 01a008e0d..000000000
--- a/plugins/org.eclipse.tm.tcf.cdt.ui/.classpath
+++ /dev/null
@@ -1,7 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry excluding="**/.svn/**" kind="src" path="src"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
- <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
- <classpathentry kind="output" path="bin"/>
-</classpath>
diff --git a/plugins/org.eclipse.tm.tcf.cdt.ui/.project b/plugins/org.eclipse.tm.tcf.cdt.ui/.project
deleted file mode 100644
index f00ffd323..000000000
--- a/plugins/org.eclipse.tm.tcf.cdt.ui/.project
+++ /dev/null
@@ -1,39 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.tm.tcf.cdt.ui</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>
- </buildSpec>
- <natures>
- <nature>org.eclipse.pde.PluginNature</nature>
- <nature>org.eclipse.jdt.core.javanature</nature>
- </natures>
- <filteredResources>
- <filter>
- <id>1311579657663</id>
- <name></name>
- <type>10</type>
- <matcher>
- <id>org.eclipse.ui.ide.multiFilter</id>
- <arguments>1.0-name-matches-false-false-target</arguments>
- </matcher>
- </filter>
- </filteredResources>
-</projectDescription>
diff --git a/plugins/org.eclipse.tm.tcf.cdt.ui/.settings/org.eclipse.jdt.core.prefs b/plugins/org.eclipse.tm.tcf.cdt.ui/.settings/org.eclipse.jdt.core.prefs
deleted file mode 100644
index 2532d5d37..000000000
--- a/plugins/org.eclipse.tm.tcf.cdt.ui/.settings/org.eclipse.jdt.core.prefs
+++ /dev/null
@@ -1,299 +0,0 @@
-#Wed Oct 05 10:00:20 PDT 2011
-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,.svn/
-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.targetPlatform=1.5
-org.eclipse.jdt.core.compiler.compliance=1.5
-org.eclipse.jdt.core.compiler.maxProblemPerUnit=100
-org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
-org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
-org.eclipse.jdt.core.compiler.source=1.5
-org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
-org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
-org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0
-org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16
-org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16
-org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16
-org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16
-org.eclipse.jdt.core.formatter.alignment_for_assignment=0
-org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16
-org.eclipse.jdt.core.formatter.alignment_for_compact_if=16
-org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80
-org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0
-org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16
-org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0
-org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16
-org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16
-org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16
-org.eclipse.jdt.core.formatter.alignment_for_resources_in_try=80
-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.alignment_for_union_type_in_multicatch=16
-org.eclipse.jdt.core.formatter.blank_lines_after_imports=1
-org.eclipse.jdt.core.formatter.blank_lines_after_package=1
-org.eclipse.jdt.core.formatter.blank_lines_before_field=1
-org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0
-org.eclipse.jdt.core.formatter.blank_lines_before_imports=1
-org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1
-org.eclipse.jdt.core.formatter.blank_lines_before_method=1
-org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1
-org.eclipse.jdt.core.formatter.blank_lines_before_package=0
-org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1
-org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1
-org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line
-org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false
-org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false
-org.eclipse.jdt.core.formatter.comment.format_block_comments=true
-org.eclipse.jdt.core.formatter.comment.format_header=false
-org.eclipse.jdt.core.formatter.comment.format_html=true
-org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true
-org.eclipse.jdt.core.formatter.comment.format_line_comments=true
-org.eclipse.jdt.core.formatter.comment.format_source_code=true
-org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true
-org.eclipse.jdt.core.formatter.comment.indent_root_tags=true
-org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert
-org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=insert
-org.eclipse.jdt.core.formatter.comment.line_length=80
-org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true
-org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true
-org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments=false
-org.eclipse.jdt.core.formatter.compact_else_if=true
-org.eclipse.jdt.core.formatter.continuation_indentation=2
-org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2
-org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off
-org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on
-org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false
-org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=true
-org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true
-org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true
-org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true
-org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true
-org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true
-org.eclipse.jdt.core.formatter.indent_empty_lines=false
-org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true
-org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true
-org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true
-org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=false
-org.eclipse.jdt.core.formatter.indentation.size=8
-org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field=insert
-org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert
-org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_member=insert
-org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method=insert
-org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package=insert
-org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert
-org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=insert
-org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=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=insert
-org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=insert
-org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=insert
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=insert
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert
-org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert
-org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert
-org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert
-org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert
-org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert
-org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert
-org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert
-org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert
-org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert
-org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert
-org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_try=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_semicolon_in_try_resources=insert
-org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert
-org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert
-org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_try=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert
-org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert
-org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert
-org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_try=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_semicolon_in_try_resources=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert
-org.eclipse.jdt.core.formatter.join_lines_in_comments=true
-org.eclipse.jdt.core.formatter.join_wrapped_lines=true
-org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=true
-org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false
-org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=true
-org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=true
-org.eclipse.jdt.core.formatter.lineSplit=180
-org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false
-org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false
-org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0
-org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1
-org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true
-org.eclipse.jdt.core.formatter.tabulation.char=space
-org.eclipse.jdt.core.formatter.tabulation.size=4
-org.eclipse.jdt.core.formatter.use_on_off_tags=false
-org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false
-org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true
-org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch=true
-org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true
-org.eclipse.jdt.core.incompatibleJDKLevel=ignore
-org.eclipse.jdt.core.incompleteClasspath=error
diff --git a/plugins/org.eclipse.tm.tcf.cdt.ui/.settings/org.eclipse.jdt.ui.prefs b/plugins/org.eclipse.tm.tcf.cdt.ui/.settings/org.eclipse.jdt.ui.prefs
deleted file mode 100644
index 07018402e..000000000
--- a/plugins/org.eclipse.tm.tcf.cdt.ui/.settings/org.eclipse.jdt.ui.prefs
+++ /dev/null
@@ -1,4 +0,0 @@
-#Wed Oct 05 09:55:19 PDT 2011
-eclipse.preferences.version=1
-formatter_profile=_Java STD
-formatter_settings_version=12
diff --git a/plugins/org.eclipse.tm.tcf.cdt.ui/META-INF/MANIFEST.MF b/plugins/org.eclipse.tm.tcf.cdt.ui/META-INF/MANIFEST.MF
deleted file mode 100644
index fca221a7a..000000000
--- a/plugins/org.eclipse.tm.tcf.cdt.ui/META-INF/MANIFEST.MF
+++ /dev/null
@@ -1,27 +0,0 @@
-Manifest-Version: 1.0
-Bundle-ManifestVersion: 2
-Bundle-Name: %pluginName
-Bundle-SymbolicName: org.eclipse.tm.tcf.cdt.ui;singleton:=true
-Bundle-Version: 0.5.0.qualifier
-Bundle-Localization: plugin
-Bundle-Activator: org.eclipse.tm.internal.tcf.cdt.ui.Activator
-Require-Bundle: org.eclipse.core.runtime,
- org.eclipse.core.resources,
- org.eclipse.text;bundle-version="3.5.0",
- org.eclipse.ui,
- org.eclipse.debug.core,
- org.eclipse.debug.ui,
- org.eclipse.cdt.core,
- org.eclipse.cdt.ui,
- org.eclipse.cdt.debug.core,
- org.eclipse.cdt.debug.ui;bundle-version="7.0.0",
- org.eclipse.tm.tcf.core,
- org.eclipse.tm.tcf.debug,
- org.eclipse.tm.tcf.debug.ui,
- org.eclipse.jface.text;bundle-version="3.5.0",
- org.eclipse.core.expressions,
- org.eclipse.cdt.launch;bundle-version="6.1.0"
-Bundle-ActivationPolicy: lazy
-Eclipse-LazyStart: true
-Bundle-RequiredExecutionEnvironment: J2SE-1.5
-Bundle-Vendor: %providerName
diff --git a/plugins/org.eclipse.tm.tcf.cdt.ui/about.html b/plugins/org.eclipse.tm.tcf.cdt.ui/about.html
deleted file mode 100644
index 6c5b3615b..000000000
--- a/plugins/org.eclipse.tm.tcf.cdt.ui/about.html
+++ /dev/null
@@ -1,28 +0,0 @@
-<!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>January 10, 2008</p>
-<h3>License</h3>
-
-<p>The Eclipse Foundation makes available all content in this plug-in (&quot;Content&quot;). Unless otherwise
-indicated below, the Content is provided to you under the terms and conditions of the
-Eclipse Public License Version 1.0 (&quot;EPL&quot;). 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, &quot;Program&quot; 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 (&quot;Redistributor&quot;) 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/plugins/org.eclipse.tm.tcf.cdt.ui/build.properties b/plugins/org.eclipse.tm.tcf.cdt.ui/build.properties
deleted file mode 100644
index 9593b304f..000000000
--- a/plugins/org.eclipse.tm.tcf.cdt.ui/build.properties
+++ /dev/null
@@ -1,19 +0,0 @@
-###############################################################################
-# Copyright (c) 2010, 2011 Wind River Systems, Inc. and others.
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Eclipse Public License v1.0
-# which accompanies this distribution, and is available at
-# http://www.eclipse.org/legal/epl-v10.html
-#
-# Contributors:
-# Wind River Systems - initial API and implementation
-###############################################################################
-source.. = src/
-output.. = bin/
-bin.includes = META-INF/,\
- .,\
- plugin.xml,\
- about.html,\
- plugin.properties,\
- icons/
-src.includes = about.html
diff --git a/plugins/org.eclipse.tm.tcf.cdt.ui/icons/obj16/c_app.gif b/plugins/org.eclipse.tm.tcf.cdt.ui/icons/obj16/c_app.gif
deleted file mode 100644
index 504ef509f..000000000
--- a/plugins/org.eclipse.tm.tcf.cdt.ui/icons/obj16/c_app.gif
+++ /dev/null
Binary files differ
diff --git a/plugins/org.eclipse.tm.tcf.cdt.ui/plugin.properties b/plugins/org.eclipse.tm.tcf.cdt.ui/plugin.properties
deleted file mode 100644
index 9539ca4ca..000000000
--- a/plugins/org.eclipse.tm.tcf.cdt.ui/plugin.properties
+++ /dev/null
@@ -1,44 +0,0 @@
-###############################################################################
-# Copyright (c) 2007, 2010 Wind River Systems, Inc. and others.
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Eclipse Public License v1.0
-# which accompanies this distribution, and is available at
-# http://www.eclipse.org/legal/epl-v10.html
-#
-# Contributors:
-# Wind River Systems - initial implementation
-###############################################################################
-pluginName = TCF/CDT Integration UI (Incubation)
-providerName = Eclipse CDT
-
-breakpoints.filterPage.name = Scope
-breakpoints.statusPage.name = Status
-launchConfigType.remoteApplication.name=TCF Remote Application
-
-launchTab.main.name=Main
-launchTab.arguments.name=Arguments
-launchTab.debugger.name=Debugger
-launchTab.target.name=Target
-launchTab.sourceLookup.name=Source
-launchTab.pathMap.name=Path Map
-launchTab.common.name=Common
-launchTab.environment.name=Environment
-
-launchDelegate.localApplication.name=TCF Create Process
-launchDelegate.localApplication.description=Start new application under control of a local TCF agent.
-launchDelegate.remoteApplication.name=TCF Remote Process
-launchDelegate.remoteApplication.description=Start new application on a remote system under control of a remote TCF agent.
-launchDelegate.attach.name=TCF Attach to Process
-launchDelegate.attach.description=Attach to a running local or remote program.
-
-action.addWatchpoint.label=Add Watchpoint (C/C++)...
-
-command.addFunctionBreakpoint.name=Add Function Breakpoint (C/C++)
-command.addFunctionBreakpoint.desc=Allows to add a new function breakpoint on an arbitrary symbol
-command.addWatchpoint.name=Add Watchpoint (C/C++)
-command.addWatchpoint.desc=Allows to add a new watchpoint on an arbitrary symbol
-
-item.addFunctionBreakpoint.name=Add Function Breakpoint (C/C++)...
-item.addWatchpoint.name=Add Watchpoint...
-
-editor.sourceNotFound.name=Source Not Found
diff --git a/plugins/org.eclipse.tm.tcf.cdt.ui/plugin.xml b/plugins/org.eclipse.tm.tcf.cdt.ui/plugin.xml
deleted file mode 100644
index d62278837..000000000
--- a/plugins/org.eclipse.tm.tcf.cdt.ui/plugin.xml
+++ /dev/null
@@ -1,361 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.2"?><!--
- Copyright (c) 2010 Wind River Systems, Inc. and others.
- All rights reserved. This program and the accompanying materials
- are made available under the terms of the Eclipse Public License v1.0
- which accompanies this distribution, and is available at
- http://www.eclipse.org/legal/epl-v10.html
-
- Contributors:
- Wind River Systems - initial API and implementation
- -->
-
-<plugin>
-
- <extension point="org.eclipse.tm.tcf.debug.ui.launch_context">
- <class name="org.eclipse.tm.internal.tcf.cdt.ui.TCFLaunchContext" />
- </extension>
-
- <extension
- point="org.eclipse.core.runtime.adapters">
- <factory
- adaptableType="org.eclipse.tm.internal.tcf.debug.ui.model.TCFNode"
- class="org.eclipse.tm.internal.tcf.cdt.ui.TCFNodeAdapterFactory">
- <adapter type="org.eclipse.cdt.debug.internal.ui.disassembly.dsf.IDisassemblyBackend"/>
- <adapter type="org.eclipse.cdt.debug.core.model.ISteppingModeTarget"/>
- <adapter type="org.eclipse.debug.core.model.ISuspendResume"/>
- <adapter type="org.eclipse.cdt.ui.text.c.hover.ICEditorTextHover"/>
- <adapter type="org.eclipse.cdt.debug.core.model.IReverseToggleHandler"/>
- <adapter type="org.eclipse.cdt.debug.core.model.IReverseStepIntoHandler"/>
- <adapter type="org.eclipse.cdt.debug.core.model.IReverseStepOverHandler"/>
- <adapter type="org.eclipse.cdt.debug.core.model.IReverseResumeHandler"/>
- <adapter type="org.eclipse.cdt.debug.core.model.IUncallHandler"/>
- <adapter type="org.eclipse.cdt.debug.ui.IPinProvider"/>
- <adapter type="org.eclipse.cdt.debug.internal.core.ICWatchpointTarget"/>
- <adapter type="org.eclipse.tm.internal.tcf.debug.ui.model.ISourceNotFoundPresentation"/>
- </factory>
- </extension>
-
- <extension
- point="org.eclipse.core.expressions.propertyTesters">
- <propertyTester
- class="org.eclipse.tm.internal.tcf.cdt.ui.commands.TCFReverseDebuggingPropertyTester"
- id="org.eclipse.tcf.cdt.ui.ReverseDebuggingTester"
- namespace="org.eclipse.cdt.debug.ui"
- properties="isReverseDebuggingEnabled"
- type="org.eclipse.tm.internal.tcf.debug.ui.model.TCFNode">
- </propertyTester>
- </extension>
-
- <extension
- point="org.eclipse.debug.ui.debugModelContextBindings">
- <modelContextBinding
- contextId="org.eclipse.cdt.debug.ui.debugging"
- debugModelId="org.eclipse.tm.tcf.debug">
- </modelContextBinding>
- <modelContextBinding
- contextId="org.eclipse.cdt.debug.ui.reverseDebuggingActionSet"
- debugModelId="org.eclipse.tm.tcf.debug">
- </modelContextBinding>
- </extension>
-
- <extension
- point="org.eclipse.cdt.debug.core.BreakpointExtension">
- <breakpointExtension
- class="org.eclipse.tm.internal.tcf.cdt.ui.breakpoints.TCFBreakpointScopeExtension"
- debugModelId="org.eclipse.tm.tcf.debug"
- id="org.eclipse.tm.tcf.cdt.ui.breakpointExtension"
- markerType="org.eclipse.cdt.debug.core.cBreakpointMarker">
- </breakpointExtension>
- </extension>
-
- <extension point="org.eclipse.ui.propertyPages">
- <page class="org.eclipse.tm.internal.tcf.cdt.ui.breakpoints.TCFBreakpointThreadFilterPage"
- id="org.eclipse.tm.tcf.breakpoint.filtering"
- name="%breakpoints.filterPage.name">
- <filter name="debugModelId" value="org.eclipse.tm.tcf.debug"/>
- <enabledWhen>
- <and>
- <adapt type="org.eclipse.cdt.debug.core.model.ICBreakpoint"/>
- <not>
- <adapt type="org.eclipse.cdt.debug.core.model.ICTracepoint"/>
- </not>
- </and>
- </enabledWhen>
- </page>
- <page class="org.eclipse.tm.internal.tcf.cdt.ui.breakpoints.TCFBreakpointStatusPage"
- id="org.eclipse.tm.tcf.breakpoint.status"
- name="%breakpoints.statusPage.name">
- <filter name="debugModelId" value="org.eclipse.tm.tcf.debug"/>
- <enabledWhen>
- <and>
- <adapt type="org.eclipse.cdt.debug.core.model.ICBreakpoint"/>
- <not>
- <adapt type="org.eclipse.cdt.debug.core.model.ICTracepoint"/>
- </not>
- </and>
- </enabledWhen>
- </page>
- </extension>
-
- <!-- Remote Application Launch config type -->
- <!-- TODO: Move to common CDT plugin? -->
- <extension
- point="org.eclipse.debug.core.launchConfigurationTypes">
- <launchConfigurationType
- public="true"
- sourcePathComputerId="org.eclipse.cdt.debug.core.sourcePathComputer"
- name="%launchConfigType.remoteApplication.name"
- id="org.eclipse.tcf.cdt.launch.remoteApplicationLaunchType"
- modes="debug,run">
- </launchConfigurationType>
- </extension>
-
- <extension point="org.eclipse.debug.core.launchDelegates">
- <launchDelegate
- id="org.eclipse.tcf.cdt.launch.localCLaunch"
- type="org.eclipse.cdt.launch.applicationLaunchType"
- modes="debug"
- delegate="org.eclipse.tm.internal.tcf.cdt.launch.TCFCDTLaunchDelegate"
- name="%launchDelegate.localApplication.name"
- delegateDescription="%launchDelegate.localApplication.description"
- sourceLocatorId="org.eclipse.tm.tcf.debug.SourceLocator"
- sourcePathComputerId="org.eclipse.cdt.debug.core.sourcePathComputer">
- </launchDelegate>
- <launchDelegate
- id="org.eclipse.tcf.cdt.launch.attachCLaunch"
- type="org.eclipse.cdt.launch.attachLaunchType"
- modes="debug"
- delegate="org.eclipse.tm.internal.tcf.cdt.launch.TCFCDTLaunchDelegate"
- name="%launchDelegate.attach.name"
- delegateDescription="%launchDelegate.attach.description"
- sourceLocatorId="org.eclipse.tm.tcf.debug.SourceLocator"
- sourcePathComputerId="org.eclipse.cdt.debug.core.sourcePathComputer">
- </launchDelegate>
- <launchDelegate
- id="org.eclipse.tcf.cdt.launch.remoteCLaunch"
- type="org.eclipse.tcf.cdt.launch.remoteApplicationLaunchType"
- modes="debug"
- delegate="org.eclipse.tm.internal.tcf.cdt.launch.TCFCDTLaunchDelegate"
- name="%launchDelegate.remoteApplication.name"
- delegateDescription="%launchDelegate.remoteApplication.description"
- sourceLocatorId="org.eclipse.tm.tcf.debug.SourceLocator"
- sourcePathComputerId="org.eclipse.cdt.debug.core.sourcePathComputer">
- </launchDelegate>
- </extension>
-
- <extension
- point="org.eclipse.debug.ui.launchConfigurationTabs">
- <!-- Local application launch tabs-->
- <tab id="org.eclipse.tcf.cdt.launch.mainTab"
- group="org.eclipse.cdt.launch.applicationLaunchTabGroup"
- name="%launchTab.main.name"
- class="org.eclipse.cdt.launch.ui.CMainTab">
- <associatedDelegate delegate="org.eclipse.tcf.cdt.launch.localCLaunch"/>
- </tab>
- <tab id="org.eclipse.tcf.cdt.launch.argumentsTab"
- group="org.eclipse.cdt.launch.applicationLaunchTabGroup"
- name="%launchTab.arguments.name"
- class="org.eclipse.cdt.launch.ui.CArgumentsTab">
- <associatedDelegate delegate="org.eclipse.tcf.cdt.launch.localCLaunch"/>
- <placement after="org.eclipse.cdt.cdi.launch.mainTab"/>
- </tab>
- <tab id="org.eclipse.tcf.cdt.launch.environmentTab"
- group="org.eclipse.cdt.launch.applicationLaunchTabGroup"
- name="%launchTab.environment.name"
- class="org.eclipse.debug.ui.EnvironmentTab">
- <associatedDelegate delegate="org.eclipse.tcf.cdt.launch.localCLaunch"/>
- <placement after="org.eclipse.cdt.cdi.launch.argumentsTab"/>
- </tab>
- <tab id="org.eclipse.tcf.cdt.launch.pathMapTab"
- group="org.eclipse.cdt.launch.applicationLaunchTabGroup"
- name="%launchTab.pathMap.name"
- class="org.eclipse.tm.internal.tcf.debug.ui.launch.TCFPathMapTab">
- <associatedDelegate delegate="org.eclipse.tcf.cdt.launch.localCLaunch"/>
- <placement after="org.eclipse.debug.ui.environmentTab"/>
- </tab>
- <tab id="org.eclipse.tcf.cdt.launch.sourceLookupTab"
- group="org.eclipse.cdt.launch.applicationLaunchTabGroup"
- name="%launchTab.sourceLookup.name"
- class="org.eclipse.debug.ui.sourcelookup.SourceLookupTab">
- <associatedDelegate delegate="org.eclipse.tcf.cdt.launch.localCLaunch"/>
- <placement after="org.eclipse.tm.tcf.launch.pathMapTab"/>
- </tab>
- <tab id="org.eclipse.tcf.cdt.launch.commonTab"
- group="org.eclipse.cdt.launch.applicationLaunchTabGroup"
- name="%launchTab.common.name"
- class="org.eclipse.debug.ui.CommonTab">
- <associatedDelegate delegate="org.eclipse.tcf.cdt.launch.localCLaunch"/>
- <placement after="org.eclipse.debug.ui.sourceLookupTab"/>
- </tab>
-
- <!-- Attach launch tabs-->
- <tab id="org.eclipse.tcf.cdt.launch.attach.pathMapTab"
- group="org.eclipse.cdt.launch.attachLaunchTabGroup"
- name="%launchTab.pathMap.name"
- class="org.eclipse.tm.internal.tcf.debug.ui.launch.TCFPathMapTab">
- <associatedDelegate delegate="org.eclipse.tcf.cdt.launch.attachCLaunch"/>
- </tab>
- <tab id="org.eclipse.tcf.cdt.launch.attach.sourceLookupTab"
- group="org.eclipse.cdt.launch.attachLaunchTabGroup"
- name="%launchTab.sourceLookup.name"
- class="org.eclipse.debug.ui.sourcelookup.SourceLookupTab">
- <associatedDelegate delegate="org.eclipse.tcf.cdt.launch.attachCLaunch"/>
- <placement after="org.eclipse.tm.tcf.launch.pathMapTab"/>
- </tab>
- <tab id="org.eclipse.tcf.cdt.launch.attach.commonTab"
- group="org.eclipse.cdt.launch.attachLaunchTabGroup"
- name="%launchTab.common.name"
- class="org.eclipse.debug.ui.CommonTab">
- <associatedDelegate delegate="org.eclipse.tcf.cdt.launch.attachCLaunch"/>
- <placement after="org.eclipse.debug.ui.sourceLookupTab"/>
- </tab>
-
- <!-- Remote application launch tabs -->
- <tab id="org.eclipse.tcf.cdt.launch.remote.mainTab"
- group="org.eclipse.tm.tcf.cdt.ui.remoteApplicationLaunchTabGroup"
- name="%launchTab.main.name"
- class="org.eclipse.tm.internal.tcf.cdt.ui.launch.RemoteCMainTab">
- <associatedDelegate delegate="org.eclipse.tcf.cdt.launch.remoteCLaunch"/>
- </tab>
- <tab id="org.eclipse.tcf.cdt.launch.remote.argumentsTab"
- group="org.eclipse.tm.tcf.cdt.ui.remoteApplicationLaunchTabGroup"
- name="%launchTab.arguments.name"
- class="org.eclipse.cdt.launch.ui.CArgumentsTab">
- <associatedDelegate delegate="org.eclipse.tcf.cdt.launch.remoteCLaunch"/>
- <placement after="org.eclipse.cdt.cdi.launch.mainTab"/>
- </tab>
- <tab id="org.eclipse.tcf.cdt.launch.remote.environmentTab"
- group="org.eclipse.tm.tcf.cdt.ui.remoteApplicationLaunchTabGroup"
- name="%launchTab.environment.name"
- class="org.eclipse.debug.ui.EnvironmentTab">
- <associatedDelegate delegate="org.eclipse.tcf.cdt.launch.remoteCLaunch"/>
- <placement after="org.eclipse.cdt.cdi.launch.argumentsTab"/>
- </tab>
- <tab id="org.eclipse.tcf.cdt.launch.remote.pathMapTab"
- group="org.eclipse.tm.tcf.cdt.ui.remoteApplicationLaunchTabGroup"
- name="%launchTab.pathMap.name"
- class="org.eclipse.tm.internal.tcf.debug.ui.launch.TCFPathMapTab">
- <associatedDelegate delegate="org.eclipse.tcf.cdt.launch.remoteCLaunch"/>
- <placement after="org.eclipse.cdt.cdi.launch.argumentsTab"/>
- </tab>
- <tab id="org.eclipse.tcf.cdt.launch.remote.sourceLookupTab"
- group="org.eclipse.tm.tcf.cdt.ui.remoteApplicationLaunchTabGroup"
- name="%launchTab.sourceLookup.name"
- class="org.eclipse.debug.ui.sourcelookup.SourceLookupTab">
- <associatedDelegate delegate="org.eclipse.tcf.cdt.launch.remoteCLaunch"/>
- <placement after="org.eclipse.tm.tcf.launch.pathMapTab"/>
- </tab>
- <tab id="org.eclipse.tcf.cdt.launch.remote.commonTab"
- group="org.eclipse.tm.tcf.cdt.ui.remoteApplicationLaunchTabGroup"
- name="%launchTab.common.name"
- class="org.eclipse.debug.ui.CommonTab">
- <associatedDelegate delegate="org.eclipse.tcf.cdt.launch.remoteCLaunch"/>
- <placement after="org.eclipse.debug.ui.sourceLookupTab"/>
- </tab>
- </extension>
-
- <extension
- point="org.eclipse.debug.ui.launchConfigurationTabGroups">
- <launchConfigurationTabGroup
- class="org.eclipse.cdt.debug.internal.ui.launch.PlaceHolderLaunchConfigurationTabGroup"
- id="org.eclipse.tm.tcf.cdt.ui.remoteApplicationLaunchTabGroup"
- type="org.eclipse.tcf.cdt.launch.remoteApplicationLaunchType">
- </launchConfigurationTabGroup>
- </extension>
-
- <extension
- point="org.eclipse.debug.ui.launchConfigurationTypeImages">
- <launchConfigurationTypeImage
- icon="icons/obj16/c_app.gif"
- configTypeID="org.eclipse.tcf.cdt.launch.remoteApplicationLaunchType"
- id="org.eclipse.tcf.cdt.ui.remoteApplicationLaunchType.image">
- </launchConfigurationTypeImage>
- </extension>
-
- <extension
- point="org.eclipse.debug.core.statusHandlers">
- <statusHandler
- class="org.eclipse.tm.internal.tcf.cdt.ui.launch.ProcessPrompter"
- code="100"
- id="org.eclipse.tm.tcf.cdt.ui.processPrompter"
- plugin="org.eclipse.tm.tcf.cdt.core">
- </statusHandler>
- </extension>
-
- <extension
- point="org.eclipse.ui.commands">
- <command
- categoryId="org.eclipse.debug.ui.category.run"
- defaultHandler="org.eclipse.tm.internal.tcf.cdt.ui.commands.AddFunctionBreakointHandler"
- description="%command.addFunctionBreakpoint.desc"
- id="org.eclipse.tm.tcf.cdt.ui.add_function_breakpoint"
- name="%command.addFunctionBreakpoint.name">
- </command>
- <command
- categoryId="org.eclipse.debug.ui.category.run"
- defaultHandler="org.eclipse.tm.internal.tcf.cdt.ui.commands.AddWatchpointHandler"
- description="%command.addWatchpoint.desc"
- id="org.eclipse.tm.tcf.cdt.ui.add_watchpoint"
- name="%command.addWatchpoint.name">
- </command>
- </extension>
-
- <extension
- point="org.eclipse.ui.menus">
- <menuContribution
- allPopups="false"
- locationURI="menu:org.eclipse.debug.ui.BreakpointView?after=additions">
- <command
- commandId="org.eclipse.tm.tcf.cdt.ui.add_function_breakpoint"
- icon="platform:/plugin/org.eclipse.cdt.debug.ui/icons/obj16/funbrkp_obj.gif"
- id="org.eclipse.tm.tcf.cdt.ui.add_function_breakpoint"
- label="%item.addFunctionBreakpoint.name"
- style="push">
- </command>
- </menuContribution>
- <menuContribution
- allPopups="false"
- locationURI="popup:#CEditorContext?after=group.debug">
- <command
- commandId="org.eclipse.tm.tcf.cdt.ui.add_watchpoint"
- icon="platform:/plugin/org.eclipse.cdt.debug.ui/icons/elcl16/watchpoint_co.gif"
- id="org.eclipse.tm.tcf.cdt.ui.add_watchpoint.editor"
- label="%item.addWatchpoint.name"
- style="push">
- <visibleWhen checkEnabled="false">
- <with variable="activeContexts">
- <iterate ifEmpty="false" operator="or">
- <equals value="org.eclipse.tm.tcf.debug.ui.debugging"/>
- </iterate>
- </with>
- </visibleWhen>
- </command>
- </menuContribution>
- </extension>
-
- <extension point="org.eclipse.ui.popupMenus">
- <objectContribution
- objectClass="org.eclipse.tm.internal.tcf.debug.ui.model.TCFNodeExpression"
- id="org.eclipse.tcf.cdt.ui.WatchpointActions">
- <action
- class="org.eclipse.cdt.debug.internal.ui.actions.AddWatchpointOnVariableActionDelegate"
- enablesFor="1"
- icon="platform:/plugin/org.eclipse.cdt.debug.ui/icons/elcl16/watchpoint_co.gif"
- id="org.eclipse.tcf.cdt.ui.actions.AddWatchpointOnVariable"
- label="%action.addWatchpoint.label"
- menubarPath="additions"/>
- </objectContribution>
- </extension>
-
- <extension
- point="org.eclipse.ui.editors">
- <editor
- class="org.eclipse.tm.internal.tcf.cdt.ui.sourcelookup.TCFCSourceNotFoundEditor"
- default="false"
- icon="icons/obj16/c_app.gif"
- id="org.eclipse.tm.tcf.cdt.ui.source_not_found_editor"
- name="%editor.sourceNotFound.name">
- </editor>
- </extension>
-</plugin>
diff --git a/plugins/org.eclipse.tm.tcf.cdt.ui/pom.xml b/plugins/org.eclipse.tm.tcf.cdt.ui/pom.xml
deleted file mode 100644
index 26334d8c3..000000000
--- a/plugins/org.eclipse.tm.tcf.cdt.ui/pom.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
- xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <modelVersion>4.0.0</modelVersion>
-
- <parent>
- <groupId>org.eclipse.tcf</groupId>
- <artifactId>tcf-parent</artifactId>
- <version>0.5.0-SNAPSHOT</version>
- <relativePath>../../pom.xml</relativePath>
- </parent>
-
- <version>0.5.0-SNAPSHOT</version>
- <artifactId>org.eclipse.tm.tcf.cdt.ui</artifactId>
- <packaging>eclipse-plugin</packaging>
-</project>
diff --git a/plugins/org.eclipse.tm.tcf.cdt.ui/src/org/eclipse/tm/internal/tcf/cdt/launch/ContextSelection.java b/plugins/org.eclipse.tm.tcf.cdt.ui/src/org/eclipse/tm/internal/tcf/cdt/launch/ContextSelection.java
deleted file mode 100644
index 62bb56f52..000000000
--- a/plugins/org.eclipse.tm.tcf.cdt.ui/src/org/eclipse/tm/internal/tcf/cdt/launch/ContextSelection.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Wind River Systems, Inc. and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipse.tm.internal.tcf.cdt.launch;
-
-public class ContextSelection {
- public String fPeerId;
- public String fContextId;
- public boolean fIsAttached;
- public ContextSelection(String peerId, String contextId) {
- this(peerId, contextId, true);
- }
- public ContextSelection(String peerId, String contextId, boolean isAttached) {
- fPeerId = peerId;
- fContextId = contextId;
- fIsAttached = isAttached;
- }
-}
diff --git a/plugins/org.eclipse.tm.tcf.cdt.ui/src/org/eclipse/tm/internal/tcf/cdt/launch/TCFCDTLaunchDelegate.java b/plugins/org.eclipse.tm.tcf.cdt.ui/src/org/eclipse/tm/internal/tcf/cdt/launch/TCFCDTLaunchDelegate.java
deleted file mode 100644
index 15797358c..000000000
--- a/plugins/org.eclipse.tm.tcf.cdt.ui/src/org/eclipse/tm/internal/tcf/cdt/launch/TCFCDTLaunchDelegate.java
+++ /dev/null
@@ -1,144 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Wind River Systems, Inc. and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipse.tm.internal.tcf.cdt.launch;
-
-import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.debug.core.DebugPlugin;
-import org.eclipse.debug.core.ILaunch;
-import org.eclipse.debug.core.ILaunchConfiguration;
-import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
-import org.eclipse.debug.core.IStatusHandler;
-import org.eclipse.tm.internal.tcf.debug.launch.TCFLaunchDelegate;
-import org.eclipse.tm.internal.tcf.debug.model.TCFLaunch;
-import org.eclipse.tm.tcf.protocol.Protocol;
-
-/**
- * TCF launch delegate for CDT based launch configuration types.
- * The launch configuration is converted on the fly to be compatible
- * with the TCFLaunch.
- */
-public class TCFCDTLaunchDelegate extends TCFLaunchDelegate {
-
- @Override
- public ILaunch getLaunch(ILaunchConfiguration configuration, final String mode) throws CoreException {
- final ILaunchConfiguration tcfLaunchConfig = convertToTcfConfig(configuration);
- return super.getLaunch(tcfLaunchConfig, mode);
- }
-
- public void launch(ILaunchConfiguration configuration, final String mode,
- final ILaunch launch, final IProgressMonitor monitor) throws CoreException {
-
- ILaunchConfiguration tcfLaunchConfig = convertToTcfConfig(configuration);
- final String peerId;
- if (isAttachLaunch(tcfLaunchConfig)) {
- ContextSelection selection = promptForContext(tcfLaunchConfig);
- if (selection == null) {
- // canceled
- throw new CoreException(Status.OK_STATUS);
- }
- launch.setAttribute("attach_to_context", selection.fContextId);
- if (!selection.fIsAttached) {
- launch.setAttribute("attach_to_process", selection.fContextId);
- }
- peerId = selection.fPeerId;
- } else if (isRemoteLaunch(tcfLaunchConfig)) {
- peerId = tcfLaunchConfig.getAttribute(TCFLaunchDelegate.ATTR_PEER_ID, (String) null);
- } else {
- peerId = null;
- }
- if (peerId == null) {
- super.launch(tcfLaunchConfig, mode, launch, monitor);
- } else {
- if (monitor != null) monitor.beginTask("Launching TCF debugger session", 1); //$NON-NLS-1$
- Protocol.invokeLater(new Runnable() {
- public void run() {
- ((TCFLaunch)launch).launchTCF(mode, peerId);
- if (monitor != null) monitor.done();
- }
- });
- }
- }
-
- private boolean isAttachLaunch(ILaunchConfiguration config) throws CoreException {
- String configTypeName = config.getType().getIdentifier();
- return ICDTLaunchConfigurationConstants.ID_LAUNCH_C_ATTACH.equals(configTypeName);
- }
-
- private boolean isRemoteLaunch(ILaunchConfiguration config) throws CoreException {
- String configTypeName = config.getType().getIdentifier();
- return "org.eclipse.tcf.cdt.launch.remoteApplicationLaunchType".equals(configTypeName);
- }
-
- private ContextSelection promptForContext(ILaunchConfiguration config) throws CoreException {
- IStatus promptStatus = new Status(IStatus.INFO, "org.eclipse.debug.ui", 200, "", null); //$NON-NLS-1$//$NON-NLS-2$
- IStatus contextPrompt = new Status(IStatus.INFO, "org.eclipse.tm.tcf.cdt.core", 100, "", null); //$NON-NLS-1$//$NON-NLS-2$
- // consult a status handler
- IStatusHandler prompter = DebugPlugin.getDefault().getStatusHandler(promptStatus);
- if (prompter != null) {
- Object result = prompter.handleStatus(contextPrompt, config);
- if (result instanceof ContextSelection) {
- return (ContextSelection) result;
- }
- }
- return null;
- }
-
- protected ILaunchConfiguration convertToTcfConfig(ILaunchConfiguration orig) throws CoreException {
- ILaunchConfigurationWorkingCopy copy = orig.copy(orig.getName());
- boolean changed = copyStringAttribute(orig, copy, ICDTLaunchConfigurationConstants.ATTR_PROJECT_NAME,
- TCFLaunchDelegate.ATTR_PROJECT_NAME);
- if (isAttachLaunch(orig)) {
- changed = setStringAttribute(copy, TCFLaunchDelegate.ATTR_LOCAL_PROGRAM_FILE, null) || changed;
- changed = setStringAttribute(copy, TCFLaunchDelegate.ATTR_REMOTE_PROGRAM_FILE, null) || changed;
- } else {
- changed = copyStringAttribute(orig, copy, ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME,
- TCFLaunchDelegate.ATTR_LOCAL_PROGRAM_FILE) || changed;
- changed = copyStringAttribute(orig, copy, ICDTLaunchConfigurationConstants.ATTR_PROGRAM_ARGUMENTS,
- TCFLaunchDelegate.ATTR_PROGRAM_ARGUMENTS) || changed;
- changed = copyStringAttribute(orig, copy, ICDTLaunchConfigurationConstants.ATTR_PROGRAM_ARGUMENTS,
- TCFLaunchDelegate.ATTR_WORKING_DIRECTORY) || changed;
- changed = copyBooleanAttribute(orig, copy, ICDTLaunchConfigurationConstants.ATTR_USE_TERMINAL,
- TCFLaunchDelegate.ATTR_USE_TERMINAL) || changed;
- }
- return changed ? copy.doSave() : orig;
- }
-
- private boolean copyStringAttribute(ILaunchConfiguration orig, ILaunchConfigurationWorkingCopy copy, String origAttr,
- String newAttr) throws CoreException {
- String newValue = orig.getAttribute(newAttr, (String) null);
- return setStringAttribute(copy, newAttr, newValue);
- }
-
- private boolean setStringAttribute(ILaunchConfigurationWorkingCopy copy, String attr, String newValue) throws CoreException {
- String origValue = copy.getAttribute(attr, (String) null);
- if (origValue == newValue || origValue != null && origValue.equals(newValue)) {
- return false;
- }
- copy.setAttribute(attr, newValue);
- return true;
- }
-
- private boolean copyBooleanAttribute(ILaunchConfiguration orig, ILaunchConfigurationWorkingCopy copy, String origAttr,
- String newAttr) throws CoreException {
- boolean origValue = orig.getAttribute(origAttr, false);
- boolean newValue = orig.getAttribute(newAttr, false);
- if (origValue == newValue) {
- return false;
- }
- copy.setAttribute(newAttr, origValue);
- return true;
- }
-
-}
diff --git a/plugins/org.eclipse.tm.tcf.cdt.ui/src/org/eclipse/tm/internal/tcf/cdt/ui/Activator.java b/plugins/org.eclipse.tm.tcf.cdt.ui/src/org/eclipse/tm/internal/tcf/cdt/ui/Activator.java
deleted file mode 100644
index 229fcb7de..000000000
--- a/plugins/org.eclipse.tm.tcf.cdt.ui/src/org/eclipse/tm/internal/tcf/cdt/ui/Activator.java
+++ /dev/null
@@ -1,104 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2011 Wind River Systems, Inc. and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipse.tm.internal.tcf.cdt.ui;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jface.dialogs.ErrorDialog;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.tm.tcf.protocol.Protocol;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.plugin.AbstractUIPlugin;
-import org.osgi.framework.BundleContext;
-
-/**
- * The activator class controls the plug-in life cycle
- */
-public class Activator extends AbstractUIPlugin {
-
- public static final String PLUGIN_ID = "org.eclipse.tm.tcf.cdt.ui";
- private static Activator plugin;
- private static TCFBreakpointStatusListener bp_status_listener;
- private static TCFBreakpointActions bp_actions;
-
- public void start(BundleContext context) throws Exception {
- super.start(context);
- plugin = this;
- EvaluationContextManager.startup();
- Protocol.invokeLater(new Runnable() {
- public void run() {
- if (bp_status_listener == null) bp_status_listener = new TCFBreakpointStatusListener();
- if (bp_actions == null) bp_actions = new TCFBreakpointActions();
- }
- });
- }
-
- public void stop(BundleContext context) throws Exception {
- Protocol.invokeAndWait(new Runnable() {
- public void run() {
- if (bp_status_listener != null) {
- bp_status_listener.dispose();
- bp_status_listener = null;
- }
- if (bp_actions != null) {
- bp_actions.dispose();
- bp_actions = null;
- }
- }
- });
- plugin = null;
- super.stop(context);
- }
-
- public static Activator getDefault() {
- return plugin;
- }
-
- public static void log(IStatus status) {
- getDefault().getLog().log(status);
- }
-
- public static void log(Throwable e) {
- log(new Status(IStatus.ERROR, PLUGIN_ID, IStatus.ERROR, e.getMessage(), e));
- }
-
- public static IWorkbenchWindow getActiveWorkbenchWindow() {
- return getDefault().getWorkbench().getActiveWorkbenchWindow();
- }
-
- public static IWorkbenchPage getActivePage() {
- IWorkbenchWindow w = getActiveWorkbenchWindow();
- if (w != null) return w.getActivePage();
- return null;
- }
-
- public static Shell getActiveWorkbenchShell() {
- IWorkbenchWindow window = getActiveWorkbenchWindow();
- if (window != null) return window.getShell();
- return null;
- }
-
- public static void errorDialog(String message, IStatus status) {
- log(status);
- Shell shell = getActiveWorkbenchShell();
- if (shell == null) return;
- ErrorDialog.openError(shell, "Error", message, status);
- }
-
- public static void errorDialog(String message, Throwable t) {
- log(t);
- Shell shell = getActiveWorkbenchShell();
- if (shell == null) return;
- IStatus status = new Status(IStatus.ERROR, PLUGIN_ID, 1, t.getMessage(), null);
- ErrorDialog.openError(shell, "Error", message, status);
- }
-}
diff --git a/plugins/org.eclipse.tm.tcf.cdt.ui/src/org/eclipse/tm/internal/tcf/cdt/ui/EvaluationContextManager.java b/plugins/org.eclipse.tm.tcf.cdt.ui/src/org/eclipse/tm/internal/tcf/cdt/ui/EvaluationContextManager.java
deleted file mode 100644
index 2ca62c65f..000000000
--- a/plugins/org.eclipse.tm.tcf.cdt.ui/src/org/eclipse/tm/internal/tcf/cdt/ui/EvaluationContextManager.java
+++ /dev/null
@@ -1,196 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2010 QNX Software Systems and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * QNX Software Systems - Initial API and implementation
- * Ericsson - DSF-GDB version
- * Nokia - Made generic to DSF
- * Wind River Systems - Adapted to TCF Debug
- *******************************************************************************/
-package org.eclipse.tm.internal.tcf.cdt.ui;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.debug.ui.IDebugUIConstants;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.tm.internal.tcf.debug.ui.model.TCFNode;
-import org.eclipse.tm.internal.tcf.debug.ui.model.TCFNodeExecContext;
-import org.eclipse.tm.internal.tcf.debug.ui.model.TCFNodeStackFrame;
-import org.eclipse.ui.IPageListener;
-import org.eclipse.ui.IPartListener2;
-import org.eclipse.ui.ISelectionListener;
-import org.eclipse.ui.IWindowListener;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.IWorkbenchPartReference;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.progress.WorkbenchJob;
-
-/**
- * Manages the current evaluation context (stack frame) for evaluation actions.
- * In each page, the selection is tracked in each debug view (if any). When a
- * debug target selection exists, the "debuggerActive" System property is set to
- * true. This property is used to make the "Run To Line", "Resume At Line",
- * "Move To Line" and "Add Watch Expression" actions visible in editors only if
- * there is a running debug session.
- */
-public class EvaluationContextManager implements IWindowListener,
- IPageListener, ISelectionListener, IPartListener2 {
-
- // Must use the same ID as the base CDT since we want to enable
- // actions that are registered by base CDT.
- private final static String DEBUGGER_ACTIVE = CDebugUIPlugin.PLUGIN_ID + ".debuggerActive"; //$NON-NLS-1$
-
- protected static EvaluationContextManager fgManager;
-
- private Map<IWorkbenchPage, TCFNode> fContextsByPage = null;
-
- protected EvaluationContextManager() {
- }
-
- public static void startup() {
- WorkbenchJob job = new WorkbenchJob("") {
- @Override
- public IStatus runInUIThread(IProgressMonitor monitor) {
- if (fgManager == null) {
- fgManager = new EvaluationContextManager();
- IWorkbench workbench = PlatformUI.getWorkbench();
- IWorkbenchWindow[] windows = workbench.getWorkbenchWindows();
- for (int i = 0; i < windows.length; i++) {
- fgManager.windowOpened(windows[i]);
- }
- workbench.addWindowListener(fgManager);
- }
- return Status.OK_STATUS;
- }
- };
- job.setPriority(Job.SHORT);
- job.setSystem(true);
- job.schedule();
- }
-
- public void windowActivated(IWorkbenchWindow window) {
- windowOpened(window);
- }
-
- public void windowDeactivated(IWorkbenchWindow window) {
- }
-
- public void windowClosed(IWorkbenchWindow window) {
- window.removePageListener(this);
- }
-
- public void windowOpened(IWorkbenchWindow window) {
- IWorkbenchPage[] pages = window.getPages();
- for (int i = 0; i < pages.length; i++) {
- window.addPageListener(this);
- pageOpened(pages[i]);
- }
- }
-
- public void pageActivated(IWorkbenchPage page) {
- pageOpened(page);
- }
-
- public void pageClosed(IWorkbenchPage page) {
- page.removeSelectionListener(IDebugUIConstants.ID_DEBUG_VIEW, this);
- page.removePartListener(this);
- }
-
- public void pageOpened(IWorkbenchPage page) {
- page.addSelectionListener(IDebugUIConstants.ID_DEBUG_VIEW, this);
- page.addPartListener(this);
- IWorkbenchPartReference ref = page.getActivePartReference();
- if (ref != null) {
- partActivated(ref);
- }
- }
-
- public void selectionChanged(IWorkbenchPart part, ISelection selection) {
- IWorkbenchPage page = part.getSite().getPage();
- if (selection instanceof IStructuredSelection) {
- IStructuredSelection ss = (IStructuredSelection) selection;
- if (ss.size() == 1) {
- Object element = ss.getFirstElement();
- if (element instanceof TCFNodeExecContext
- || element instanceof TCFNodeStackFrame) {
- setContext(page, (TCFNode) element);
- return;
- }
- }
- }
- // no context in the given view
- removeContext(page);
- }
-
- public void partActivated(IWorkbenchPartReference partRef) {
- }
-
- public void partBroughtToTop(IWorkbenchPartReference partRef) {
- }
-
- public void partClosed(IWorkbenchPartReference partRef) {
- if (IDebugUIConstants.ID_DEBUG_VIEW.equals(partRef.getId())) {
- removeContext(partRef.getPage());
- }
- }
-
- public void partDeactivated(IWorkbenchPartReference partRef) {
- }
-
- public void partOpened(IWorkbenchPartReference partRef) {
- }
-
- public void partHidden(IWorkbenchPartReference partRef) {
- }
-
- public void partVisible(IWorkbenchPartReference partRef) {
- }
-
- public void partInputChanged(IWorkbenchPartReference partRef) {
- }
-
- /**
- * Sets the evaluation context for the given page, and notes that a valid
- * execution context exists.
- *
- * @param page
- * @param target
- */
- private void setContext(IWorkbenchPage page, TCFNode target) {
- if (fContextsByPage == null) {
- fContextsByPage = new HashMap<IWorkbenchPage, TCFNode>();
- }
- fContextsByPage.put(page, target);
- System.setProperty(DEBUGGER_ACTIVE, Boolean.TRUE.toString());
- }
-
- /**
- * Removes an evaluation context for the given page, and determines if any
- * valid execution context remain.
- *
- * @param page
- */
- private void removeContext(IWorkbenchPage page) {
- if (fContextsByPage != null) {
- fContextsByPage.remove(page);
- if (fContextsByPage.isEmpty()) {
- System.setProperty(DEBUGGER_ACTIVE, Boolean.FALSE.toString());
- fContextsByPage = null;
- }
- }
- }
-}
diff --git a/plugins/org.eclipse.tm.tcf.cdt.ui/src/org/eclipse/tm/internal/tcf/cdt/ui/ImageCache.java b/plugins/org.eclipse.tm.tcf.cdt.ui/src/org/eclipse/tm/internal/tcf/cdt/ui/ImageCache.java
deleted file mode 100644
index bcf6fa62c..000000000
--- a/plugins/org.eclipse.tm.tcf.cdt.ui/src/org/eclipse/tm/internal/tcf/cdt/ui/ImageCache.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2011 Wind River Systems, Inc. and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipse.tm.internal.tcf.cdt.ui;
-
-import java.net.URL;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.eclipse.core.runtime.FileLocator;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.swt.graphics.Image;
-import org.osgi.framework.Bundle;
-
-public class ImageCache {
-
- public static final String
- IMG_TARGET_TAB = "icons/target_tab.gif";
-
- private static final Map<String,ImageDescriptor> desc_cache = new HashMap<String,ImageDescriptor>();
- private static final Map<ImageDescriptor,Image> image_cache = new HashMap<ImageDescriptor,Image>();
-
- public static synchronized ImageDescriptor getImageDescriptor(String name) {
- if (name == null) return null;
- ImageDescriptor descriptor = desc_cache.get(name);
- if (descriptor == null) {
- Bundle bundle = Platform.getBundle("org.eclipse.tm.tcf.debug.ui");
- if (bundle != null){
- URL url = FileLocator.find(bundle, new Path(name), null);
- if (url != null) descriptor = ImageDescriptor.createFromURL(url);
- }
- if (descriptor == null) {
- bundle = Platform.getBundle("org.eclipse.debug.ui");
- if (bundle != null){
- URL url = FileLocator.find(bundle, new Path(name), null);
- if (url != null) descriptor = ImageDescriptor.createFromURL(url);
- }
- }
- if (descriptor == null) {
- descriptor = ImageDescriptor.getMissingImageDescriptor();
- }
- desc_cache.put(name, descriptor);
- }
- return descriptor;
- }
-
- public static synchronized Image getImage(ImageDescriptor desc) {
- Image image = image_cache.get(desc);
- if (image == null) {
- image = desc.createImage();
- image_cache.put(desc, image);
- }
- return image;
- }
-
- public static synchronized Image getImage(String name) {
- return getImage(getImageDescriptor(name));
- }
-}
diff --git a/plugins/org.eclipse.tm.tcf.cdt.ui/src/org/eclipse/tm/internal/tcf/cdt/ui/TCFBreakpointActions.java b/plugins/org.eclipse.tm.tcf.cdt.ui/src/org/eclipse/tm/internal/tcf/cdt/ui/TCFBreakpointActions.java
deleted file mode 100644
index eba6e3f35..000000000
--- a/plugins/org.eclipse.tm.tcf.cdt.ui/src/org/eclipse/tm/internal/tcf/cdt/ui/TCFBreakpointActions.java
+++ /dev/null
@@ -1,297 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Wind River Systems, Inc. and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipse.tm.internal.tcf.cdt.ui;
-
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.eclipse.cdt.debug.core.CDebugCorePlugin;
-import org.eclipse.cdt.debug.core.breakpointactions.BreakpointActionManager;
-import org.eclipse.cdt.debug.core.breakpointactions.IBreakpointAction;
-import org.eclipse.cdt.debug.core.breakpointactions.ILogActionEnabler;
-import org.eclipse.cdt.debug.core.breakpointactions.IResumeActionEnabler;
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.debug.core.DebugPlugin;
-import org.eclipse.debug.core.ILaunch;
-import org.eclipse.debug.core.model.IBreakpoint;
-import org.eclipse.tm.internal.tcf.debug.actions.TCFAction;
-import org.eclipse.tm.internal.tcf.debug.model.TCFBreakpointsModel;
-import org.eclipse.tm.internal.tcf.debug.model.TCFContextState;
-import org.eclipse.tm.internal.tcf.debug.model.TCFLaunch;
-import org.eclipse.tm.internal.tcf.debug.ui.model.TCFChildrenLogExpressions;
-import org.eclipse.tm.internal.tcf.debug.ui.model.TCFModel;
-import org.eclipse.tm.internal.tcf.debug.ui.model.TCFModelManager;
-import org.eclipse.tm.internal.tcf.debug.ui.model.TCFNodeExecContext;
-import org.eclipse.tm.internal.tcf.debug.ui.model.TCFNodeExpression;
-import org.eclipse.tm.tcf.protocol.IToken;
-import org.eclipse.tm.tcf.protocol.Protocol;
-import org.eclipse.tm.tcf.services.IRunControl;
-import org.eclipse.tm.tcf.services.IRunControl.RunControlContext;
-import org.eclipse.tm.tcf.util.TCFDataCache;
-import org.eclipse.tm.tcf.util.TCFTask;
-
-public class TCFBreakpointActions {
-
- private class BreakpointActionAdapter extends TCFAction implements IAdaptable, ILogActionEnabler, IResumeActionEnabler {
-
- private final HashMap<String,BreakpointActionAdapter> active_actions;
- private final TCFNodeExecContext node;
- private final Job job;
-
- private boolean started;
- private boolean resumed;
-
- BreakpointActionAdapter(final HashMap<String,BreakpointActionAdapter> actions,
- final IBreakpoint breakpoint, TCFNodeExecContext node) {
- super(node.getModel().getLaunch(), node.getID());
- this.active_actions = actions;
- this.node = node;
- job = new Job("Breakpoint actions") { //$NON-NLS-1$
- @Override
- protected IStatus run(IProgressMonitor monitor) {
- IStatus status = Status.OK_STATUS;
- try {
- IMarker marker = breakpoint.getMarker();
- String names = marker.getAttribute(BreakpointActionManager.BREAKPOINT_ACTION_ATTRIBUTE, "");
- final String[] actions = names.split(","); //$NON-NLS-1$
- for (int i = 0; i < actions.length && !monitor.isCanceled(); i++) {
- String name = actions[i];
- IBreakpointAction action = bp_action_manager.findBreakpointAction(name);
- if (action != null) {
- monitor.setTaskName(action.getSummary());
- status = action.execute(breakpoint, BreakpointActionAdapter.this, monitor);
- if (status.getCode() != IStatus.OK) break;
- }
- monitor.worked(1);
- }
- }
- catch (Exception e) {
- status = new Status(
- IStatus.ERROR, Activator.PLUGIN_ID, IStatus.ERROR,
- "Cannot execute breakpoint action", e);
- }
- if (!monitor.isCanceled() && status.getCode() != IStatus.OK) Activator.log(status);
- Protocol.invokeAndWait(new Runnable() {
- public void run() {
- assert aborted == (actions.get(ctx_id) != BreakpointActionAdapter.this);
- if (!aborted) actions.remove(ctx_id);
- BreakpointActionAdapter.this.done();
- }
- });
- return status;
- };
- };
- BreakpointActionAdapter a = actions.get(ctx_id);
- if (a != null) a.abort();
- assert actions.get(ctx_id) == null;
- actions.put(ctx_id, this);
- }
-
- @SuppressWarnings("rawtypes")
- public Object getAdapter(Class adapter) {
- if (adapter.isInstance(this)) return this;
- return Platform.getAdapterManager().loadAdapter(this, adapter.getName());
- }
-
- public void resume() throws Exception {
- new TCFTask<Boolean>(node.getChannel()) {
- public void run() {
- if (aborted || resumed || node.isDisposed()) {
- done(false);
- return;
- }
- TCFDataCache<TCFContextState> state_cache = node.getState();
- if (!state_cache.validate(this)) return;
- TCFContextState state_data = state_cache.getData();
- if (state_data == null || !state_data.is_suspended) {
- done(false);
- return;
- }
- TCFDataCache<IRunControl.RunControlContext> ctx_cache = node.getRunContext();
- if (!ctx_cache.validate(this)) return;
- IRunControl.RunControlContext ctx_data = ctx_cache.getData();
- if (ctx_data == null) {
- done(false);
- return;
- }
- resumed = true;
- ctx_data.resume(IRunControl.RM_RESUME, 1, new IRunControl.DoneCommand() {
- public void doneCommand(IToken token, Exception error) {
- if (error != null && !aborted) error(error);
- else done(true);
- }
- });
- }
- }.get();
- }
-
- public String evaluateExpression(final String expression) throws Exception {
- return new TCFTask<String>(node.getChannel()) {
- public void run() {
- if (aborted || node.isDisposed()) {
- done("");
- return;
- }
- TCFChildrenLogExpressions cache = node.getLogExpressionCache();
- cache.addScript(expression);
- if (!cache.validate(this)) return;
- TCFNodeExpression expr = cache.findScript(expression);
- String s = expr.getValueText(true, this);
- if (s != null) done(expression + " = " + s);
- }
- }.get();
- }
-
- public void run() {
- if (aborted) {
- done();
- }
- else {
- // Post delta to update commands UI state.
- node.postStateChangedDelta();
- job.schedule();
- started = true;
- }
- }
-
- @Override
- public int getPriority() {
- return 100;
- }
-
- @Override
- public void abort() {
- assert aborted == (active_actions.get(ctx_id) != this);
- if (aborted) return;
- super.abort();
- active_actions.remove(ctx_id);
- if (started && job.cancel()) done();
- }
- }
-
- private class RunControlListener implements IRunControl.RunControlListener {
-
- private final IRunControl rc;
- private final TCFModel model;
- private final HashMap<String,BreakpointActionAdapter> active_actions;
-
- RunControlListener(TCFModel model) {
- this.model = model;
- active_actions = new HashMap<String,BreakpointActionAdapter>();
- rc = model.getLaunch().getService(IRunControl.class);
- if (rc != null) rc.addListener(this);
- }
-
- void dispose() {
- if (rc != null) rc.removeListener(this);
- BreakpointActionAdapter[] arr = active_actions.values().toArray(new BreakpointActionAdapter[active_actions.size()]);
- for (BreakpointActionAdapter a : arr) a.abort();
- }
-
- public void contextAdded(RunControlContext[] contexts) {
- }
-
- public void contextChanged(RunControlContext[] contexts) {
- }
-
- public void contextRemoved(String[] context_ids) {
- for (String id : context_ids) {
- BreakpointActionAdapter a = active_actions.get(id);
- if (a != null) a.abort();
- }
- }
-
- public void contextSuspended(String context, String pc, String reason, Map<String,Object> params) {
- if (params == null) return;
- Object ids = params.get(IRunControl.STATE_BREAKPOINT_IDS);
- if (ids == null) return;
- TCFNodeExecContext node = (TCFNodeExecContext)model.getNode(context);
- if (node == null) return;
- @SuppressWarnings("unchecked")
- Collection<String> c = (Collection<String>)ids;
- for (String bp_id : c) {
- IBreakpoint bp = bp_model.getBreakpoint(bp_id);
- if (!bp_action_manager.breakpointHasActions(bp)) continue;
- new BreakpointActionAdapter(active_actions, bp, node);
- }
- }
-
- public void contextResumed(String context) {
- BreakpointActionAdapter a = active_actions.get(context);
- if (a != null && !a.resumed) a.abort();
- }
-
- public void containerSuspended(String context, String pc,
- String reason, Map<String, Object> params,
- String[] suspended_ids) {
- contextSuspended(context, pc, reason, params);
- }
-
- public void containerResumed(String[] context_ids) {
- for (String id : context_ids) {
- contextResumed(id);
- }
- }
-
- public void contextException(String context, String msg) {
- }
- }
-
- private final TCFModelManager.ModelManagerListener launch_listener = new TCFModelManager.ModelManagerListener() {
-
- public void onConnected(TCFLaunch launch, TCFModel model) {
- assert rc_listeners.get(launch) == null;
- new RunControlListener(model);
- }
-
- public void onDisconnected(TCFLaunch launch, TCFModel model) {
- RunControlListener l = rc_listeners.remove(launch);
- if (l != null) l.dispose();
- }
- };
-
- private final TCFBreakpointsModel bp_model;
- private final TCFModelManager model_manager;
- private final BreakpointActionManager bp_action_manager;
- private final Map<TCFLaunch,RunControlListener> rc_listeners;;
-
- TCFBreakpointActions() {
- assert Protocol.isDispatchThread();
- bp_action_manager = CDebugCorePlugin.getDefault().getBreakpointActionManager();
- bp_model = TCFBreakpointsModel.getBreakpointsModel();
- model_manager = TCFModelManager.getModelManager();
- model_manager.addListener(launch_listener);
- rc_listeners = new HashMap<TCFLaunch,RunControlListener>();
- // handle already connected launches
- for (ILaunch launch : DebugPlugin.getDefault().getLaunchManager().getLaunches()) {
- if (launch instanceof TCFLaunch) {
- TCFLaunch tcf_launch = (TCFLaunch)launch;
- if (!tcf_launch.isDisconnected() && !tcf_launch.isConnecting()) {
- launch_listener.onConnected(tcf_launch, model_manager.getModel(tcf_launch));
- }
- }
- }
- }
-
- void dispose() {
- assert Protocol.isDispatchThread();
- model_manager.removeListener(launch_listener);
- for (RunControlListener l : rc_listeners.values()) l.dispose();
- rc_listeners.clear();
- }
-}
diff --git a/plugins/org.eclipse.tm.tcf.cdt.ui/src/org/eclipse/tm/internal/tcf/cdt/ui/TCFBreakpointStatusListener.java b/plugins/org.eclipse.tm.tcf.cdt.ui/src/org/eclipse/tm/internal/tcf/cdt/ui/TCFBreakpointStatusListener.java
deleted file mode 100644
index 0105afc25..000000000
--- a/plugins/org.eclipse.tm.tcf.cdt.ui/src/org/eclipse/tm/internal/tcf/cdt/ui/TCFBreakpointStatusListener.java
+++ /dev/null
@@ -1,362 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010, 2011 Wind River Systems, Inc. and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipse.tm.internal.tcf.cdt.ui;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import org.eclipse.cdt.debug.core.model.ICBreakpoint;
-import org.eclipse.cdt.debug.core.model.ICLineBreakpoint;
-import org.eclipse.cdt.debug.core.model.ICWatchpoint;
-import org.eclipse.cdt.debug.internal.core.breakpoints.CAddressBreakpoint;
-import org.eclipse.cdt.debug.internal.core.breakpoints.CFunctionBreakpoint;
-import org.eclipse.cdt.debug.internal.core.breakpoints.CLineBreakpoint;
-import org.eclipse.cdt.debug.internal.core.breakpoints.CWatchpoint;
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.resources.WorkspaceJob;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.jobs.ISchedulingRule;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.debug.core.DebugPlugin;
-import org.eclipse.debug.core.ILaunch;
-import org.eclipse.debug.core.model.IBreakpoint;
-import org.eclipse.tm.internal.tcf.debug.model.ITCFBreakpointListener;
-import org.eclipse.tm.internal.tcf.debug.model.ITCFConstants;
-import org.eclipse.tm.internal.tcf.debug.model.TCFBreakpoint;
-import org.eclipse.tm.internal.tcf.debug.model.TCFBreakpointsModel;
-import org.eclipse.tm.internal.tcf.debug.model.TCFBreakpointsStatus;
-import org.eclipse.tm.internal.tcf.debug.model.TCFLaunch;
-import org.eclipse.tm.internal.tcf.debug.ui.model.TCFModel;
-import org.eclipse.tm.internal.tcf.debug.ui.model.TCFModelManager;
-import org.eclipse.tm.tcf.protocol.Protocol;
-import org.eclipse.tm.tcf.services.IBreakpoints;
-
-/**
- * This class monitors breakpoints status on TCF debug targets and calls ICBreakpoint.incrementInstallCount() or
- * ICBreakpoint.decrementInstallCount() when breakpoint status changes.
- */
-@SuppressWarnings("restriction")
-class TCFBreakpointStatusListener {
-
- /** Ref count attribute for foreign breakpoints */
- private static final String ATTR_REFCOUNT = "org.eclipse.tm.tcf.cdt.refcount";
- /** TCF breakpoint ID attribute */
- private static final String ATTR_TCF_ID = ITCFConstants.ID_TCF_DEBUG_MODEL + '.' + IBreakpoints.PROP_ID;
-
- private class BreakpointListener implements ITCFBreakpointListener {
-
- private final TCFBreakpointsStatus status;
- private final Map<String,ICBreakpoint> installed = new HashMap<String,ICBreakpoint>();
- private final Set<String> foreign = new HashSet<String>();
- private final Set<String> deleted = new HashSet<String>();
-
- BreakpointListener(TCFLaunch launch) {
- status = launch.getBreakpointsStatus();
- status.addListener(this);
- bp_listeners.put(launch, this);
- for (String id : status.getStatusIDs()) breakpointStatusChanged(id);
- }
-
- public void breakpointStatusChanged(String id) {
- IBreakpoint bp = bp_model.getBreakpoint(id);
- updateStatus(id, bp);
- if (bp == null) createOrUpdateBreakpoint(id);
- }
-
- private void updateStatus(String id, IBreakpoint bp) {
- if (bp instanceof ICBreakpoint) {
- boolean ok = false;
- ICBreakpoint cbp = (ICBreakpoint)bp;
- Map<String,Object> map = status.getStatus(id);
- if (map != null) {
- @SuppressWarnings("unchecked")
- Collection<Map<String,Object>> list = (Collection<Map<String,Object>>)map.get(IBreakpoints.STATUS_INSTANCES);
- if (list != null) {
- for (Map<String,Object> m : list) {
- if (m.get(IBreakpoints.INSTANCE_ERROR) == null) ok = true;
- }
- }
- }
- if (ok && installed.get(id) == null) {
- installed.put(id, cbp);
- incrementInstallCount(cbp);
- }
- if (!ok && installed.get(id) == cbp) {
- installed.remove(id);
- decrementInstallCount(cbp);
- }
- }
- else if (bp instanceof TCFBreakpoint) {
- updateStatus((TCFBreakpoint)bp);
- }
- }
-
- public void breakpointRemoved(String id) {
- ICBreakpoint cbp = installed.remove(id);
- if (cbp != null) {
- decrementInstallCount(cbp);
- }
- if (foreign.remove(id)) {
- deleteTransientBreakpoint(id);
- }
- }
-
- public void breakpointChanged(String id) {
- createOrUpdateBreakpoint(id);
- }
-
- void dispose() {
- for (ICBreakpoint cbp : installed.values()) {
- decrementInstallCount(cbp);
- }
- installed.clear();
- for (String id : foreign) {
- deleteTransientBreakpoint(id);
- }
- foreign.clear();
- }
-
- private void incrementInstallCount(final ICBreakpoint cbp) {
- Job job = new WorkspaceJob("Increment Breakpoint Install Count") {
- @Override
- public IStatus runInWorkspace(IProgressMonitor monitor) throws CoreException {
- try {
- cbp.incrementInstallCount();
- }
- catch (CoreException e) {
- // ignore expected race condition with marker deletion
- }
- return Status.OK_STATUS;
- }
- };
- job.setRule(cbp.getMarker().getResource());
- job.setPriority(Job.SHORT);
- job.setSystem(true);
- job.schedule();
- }
-
- private void decrementInstallCount(final ICBreakpoint cbp) {
- Job job = new WorkspaceJob("Decrement Breakpoint Install Count") {
- @Override
- public IStatus runInWorkspace(IProgressMonitor monitor) throws CoreException {
- try {
- cbp.decrementInstallCount();
- }
- catch (CoreException e) {
- // ignore expected race condition with marker deletion
- }
- return Status.OK_STATUS;
- }
- };
- job.setRule(cbp.getMarker().getResource());
- job.setPriority(Job.SHORT);
- job.setSystem(true);
- job.schedule();
- }
-
- private void updateStatus(final TCFBreakpoint tbp) {
- Job job = new WorkspaceJob("Update Breakpoint Status") {
- @Override
- public IStatus runInWorkspace(IProgressMonitor monitor) throws CoreException {
- try {
- tbp.notifyStatusChaged();
- }
- catch (CoreException e) {
- // ignore expected race condition with marker deletion
- }
- return Status.OK_STATUS;
- }
- };
- job.setRule(tbp.getMarker().getResource());
- job.setPriority(Job.SHORT);
- job.setSystem(true);
- job.schedule();
- }
-
- private void createOrUpdateBreakpoint(final String id) {
- Map<String,Object> properties = status.getProperties(id);
- if (properties == null) return;
- if (bp_model.isLocal(properties)) return;
- final boolean create = foreign.add(id);
- final Map<String, Object> markerAttrs = bp_model.toMarkerAttributes(properties);
- markerAttrs.put(IBreakpoint.PERSISTED, Boolean.FALSE);
- markerAttrs.put(IMarker.TRANSIENT, Boolean.TRUE);
- Job job = new WorkspaceJob("Create Breakpoint Marker") {
- @Override
- public IStatus runInWorkspace(IProgressMonitor monitor) throws CoreException {
- if (deleted.remove(id)) return Status.OK_STATUS;
- IBreakpoint[] bps = DebugPlugin.getDefault().getBreakpointManager().getBreakpoints();
- for (IBreakpoint bp : bps) {
- IMarker marker = bp.getMarker();
- if (marker == null) continue;
- if (id.equals(TCFBreakpointsModel.getBreakpointID(bp))) {
- if (create) {
- int cnt = marker.getAttribute(ATTR_REFCOUNT, 0) + 1;
- marker.setAttribute(ATTR_REFCOUNT, cnt);
- }
- else {
- // source handle should not change
- markerAttrs.remove(ICBreakpoint.SOURCE_HANDLE);
- updateMarkerAttributes(markerAttrs, marker);
- }
- return Status.OK_STATUS;
- }
- }
- if (!create) return Status.OK_STATUS;
- markerAttrs.put(ATTR_REFCOUNT, 1);
- final IBreakpoint bp;
- IResource resource = ResourcesPlugin.getWorkspace().getRoot();
- if (markerAttrs.get(ICWatchpoint.EXPRESSION) != null) {
- bp = new CWatchpoint(resource, markerAttrs, true);
- }
- else if (markerAttrs.get(ICLineBreakpoint.ADDRESS) != null) {
- bp = new CAddressBreakpoint(resource, markerAttrs, true);
- }
- else if (markerAttrs.get(ICLineBreakpoint.FUNCTION) != null) {
- bp = new CFunctionBreakpoint(resource, markerAttrs, true);
- }
- else if (markerAttrs.get(ICBreakpoint.SOURCE_HANDLE) != null &&
- markerAttrs.get(IMarker.LINE_NUMBER) != null) {
- bp = new CLineBreakpoint(resource, markerAttrs, true);
- }
- else {
- /* An "exotic" breakpoint - cannot be represented by one of CDT breakpoint classes */
- bp = TCFBreakpoint.createFromMarkerAttributes(markerAttrs);
- }
- Protocol.invokeLater(new Runnable() {
- public void run() {
- updateStatus(id, bp);
- }
- });
- return Status.OK_STATUS;
- }
-
- private void updateMarkerAttributes(Map<String, Object> markerAttrs, IMarker marker) throws CoreException {
- List<String> keys = new ArrayList<String>(markerAttrs.size());
- List<Object> values = new ArrayList<Object>(markerAttrs.size());
- Map<?,?> oldAttrs = marker.getAttributes();
- for (Map.Entry<?,?> entry : markerAttrs.entrySet()) {
- String key = (String) entry.getKey();
- Object newVal = entry.getValue();
- Object oldVal = oldAttrs.remove(key);
- if (oldVal == null || !oldVal.equals(newVal)) {
- keys.add(key);
- values.add(newVal);
- }
- }
- if (keys.size() != 0) {
- String[] keyArr = (String[]) keys.toArray(new String[keys.size()]);
- Object[] valueArr = (Object[]) values.toArray(new Object[values.size()]);
- marker.setAttributes(keyArr, valueArr);
- }
- }
- };
- job.setRule(getBreakpointAccessRule());
- job.setPriority(Job.SHORT);
- job.setSystem(true);
- job.schedule();
- }
-
- private void deleteTransientBreakpoint(final String id) {
- Job job = new WorkspaceJob("Destroy Breakpoint Marker") {
- @Override
- public IStatus runInWorkspace(IProgressMonitor monitor) throws CoreException {
- IBreakpoint[] bps = DebugPlugin.getDefault().getBreakpointManager().getBreakpoints();
- for (IBreakpoint bp : bps) {
- if (bp.isPersisted()) continue;
- IMarker marker = bp.getMarker();
- if (marker == null) continue;
- if (id.equals(marker.getAttribute(ATTR_TCF_ID, null))) {
- int cnt = marker.getAttribute(ATTR_REFCOUNT, 0) - 1;
- if (cnt > 0) {
- marker.setAttribute(ATTR_REFCOUNT, cnt);
- }
- else {
- bp.delete();
- }
- return Status.OK_STATUS;
- }
- }
- // Since breakpoint object is created by a another background job after reading data from remote peer,
- // this job can be running before the job that creates the object.
- // We need to remember ID of the breakpoint that became obsolete before it was fully created.
- deleted.add(id);
- return Status.OK_STATUS;
- }
- };
- job.setRule(getBreakpointAccessRule());
- job.setPriority(Job.SHORT);
- job.setSystem(true);
- job.schedule();
- }
-
- private ISchedulingRule getBreakpointAccessRule() {
- IResource resource = ResourcesPlugin.getWorkspace().getRoot();
- ISchedulingRule rule = ResourcesPlugin.getWorkspace().getRuleFactory().markerRule(resource);
- if (rule == null) {
- // In Eclipse 3.6.2, markerRule() always returns null,
- // causing race condition, a lot of crashes and corrupted data.
- // Using modifyRule() instead.
- rule = ResourcesPlugin.getWorkspace().getRuleFactory().modifyRule(resource);
- }
- return rule;
- }
- }
-
- private final TCFModelManager.ModelManagerListener launch_listener = new TCFModelManager.ModelManagerListener() {
-
- public void onConnected(TCFLaunch launch, TCFModel model) {
- assert bp_listeners.get(launch) == null;
- if (launch.getBreakpointsStatus() != null) new BreakpointListener(launch);
- }
-
- public void onDisconnected(TCFLaunch launch, TCFModel model) {
- BreakpointListener l = bp_listeners.remove(launch);
- if (l != null) l.dispose();
- }
- };
-
- private final TCFModelManager model_manager;
- private final TCFBreakpointsModel bp_model;
- private final Map<TCFLaunch,BreakpointListener> bp_listeners;;
-
- TCFBreakpointStatusListener() {
- bp_model = TCFBreakpointsModel.getBreakpointsModel();
- model_manager = TCFModelManager.getModelManager();
- model_manager.addListener(launch_listener);
- bp_listeners = new HashMap<TCFLaunch,BreakpointListener>();
- // handle already connected launches
- for (ILaunch launch : DebugPlugin.getDefault().getLaunchManager().getLaunches()) {
- if (launch instanceof TCFLaunch) {
- TCFLaunch tcfLaunch = (TCFLaunch) launch;
- if (!tcfLaunch.isDisconnected() && !tcfLaunch.isConnecting()) {
- launch_listener.onConnected(tcfLaunch, model_manager.getModel(tcfLaunch));
- }
- }
- }
- }
-
- void dispose() {
- model_manager.removeListener(launch_listener);
- for (BreakpointListener l : bp_listeners.values()) l.dispose();
- bp_listeners.clear();
- }
-}
diff --git a/plugins/org.eclipse.tm.tcf.cdt.ui/src/org/eclipse/tm/internal/tcf/cdt/ui/TCFLaunchContext.java b/plugins/org.eclipse.tm.tcf.cdt.ui/src/org/eclipse/tm/internal/tcf/cdt/ui/TCFLaunchContext.java
deleted file mode 100644
index 7f31ce1a7..000000000
--- a/plugins/org.eclipse.tm.tcf.cdt.ui/src/org/eclipse/tm/internal/tcf/cdt/ui/TCFLaunchContext.java
+++ /dev/null
@@ -1,328 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2011 Wind River Systems, Inc. and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipse.tm.internal.tcf.cdt.ui;
-
-import org.eclipse.cdt.core.CCorePlugin;
-import org.eclipse.cdt.core.model.CModelException;
-import org.eclipse.cdt.core.model.CoreModel;
-import org.eclipse.cdt.core.model.IBinary;
-import org.eclipse.cdt.core.model.ICElement;
-import org.eclipse.cdt.core.model.ICProject;
-import org.eclipse.cdt.core.settings.model.ICProjectDescription;
-import org.eclipse.cdt.launch.LaunchUtils;
-import org.eclipse.cdt.ui.CElementLabelProvider;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.debug.core.ILaunchConfiguration;
-import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
-import org.eclipse.debug.ui.DebugUITools;
-import org.eclipse.debug.ui.IDebugUIConstants;
-import org.eclipse.debug.ui.ILaunchConfigurationDialog;
-import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.window.Window;
-import org.eclipse.swt.custom.BusyIndicator;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.tm.internal.tcf.debug.launch.TCFLaunchDelegate;
-import org.eclipse.tm.internal.tcf.debug.ui.launch.ITCFLaunchContext;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.dialogs.TwoPaneElementSelector;
-
-public class TCFLaunchContext implements ITCFLaunchContext {
-
- public boolean isActive() {
- return getContext(null) != null;
- }
-
- public boolean isSupportedSelection(Object selection) {
- if (selection instanceof IProject) {
- return CoreModel.getDefault().getCModel().getCProject(((IProject)selection).getName()) != null;
- }
- return selection instanceof ICElement;
- }
-
- public IPath getPath(Object selection) {
- if (selection instanceof IResource) {
- return ((IResource)selection).getLocation();
- }
- if (selection instanceof ICElement) {
- return ((ICElement)selection).getResource().getLocation();
- }
- return null;
- }
-
- public IProject getProject(Object selection) {
- if (selection instanceof IProject) return (IProject)selection;
- if (selection instanceof ICElement) return ((ICElement)selection).getCProject().getProject();
- return null;
- }
-
- public void setDefaults(ILaunchConfigurationDialog dlg, ILaunchConfigurationWorkingCopy config) {
- ICElement element = getContext(config);
- if (element != null) {
- initializeCProject(element, config);
- initializeProgramName(element, dlg, config);
- }
- }
-
- /**
- * Returns the current C element context from which to initialize default
- * settings, or <code>null</code> if none. Note, if possible we will
- * return the IBinary based on configuration entry as this may be more useful then
- * just the project.
- *
- * @return C element context.
- */
- private ICElement getContext(ILaunchConfiguration config) {
- String projectName = null;
- String programName = null;
- if (config != null) {
- try {
- projectName = config.getAttribute(TCFLaunchDelegate.ATTR_PROJECT_NAME, (String)null);
- programName = config.getAttribute(TCFLaunchDelegate.ATTR_LOCAL_PROGRAM_FILE, (String)null);
- }
- catch (CoreException e) {
- Activator.log(e);
- }
- }
- Object obj = null;
- IWorkbenchPage page = Activator.getActivePage();
- if (projectName != null && !projectName.equals("")) { //$NON-NLS-1$
- IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);
- ICProject cProject = CCorePlugin.getDefault().getCoreModel().create(project);
- if (cProject != null && cProject.exists()) obj = cProject;
- }
- else {
- if (page != null) {
- ISelection selection = page.getSelection();
- if (selection instanceof IStructuredSelection) {
- IStructuredSelection ss = (IStructuredSelection)selection;
- if (!ss.isEmpty()) obj = ss.getFirstElement();
- }
- }
- }
- if (obj instanceof IResource) {
- ICElement ce = CoreModel.getDefault().create((IResource)obj);
- if (ce == null) {
- IProject pro = ((IResource)obj).getProject();
- ce = CoreModel.getDefault().create(pro);
- }
- obj = ce;
- }
- if (obj instanceof ICElement) {
- if (programName == null || programName.equals("")) { //$NON-NLS-1$
- return (ICElement)obj;
- }
- ICElement ce = (ICElement)obj;
- IProject project;
- project = (IProject)ce.getCProject().getResource();
- IPath programFile = project.getFile(programName).getLocation();
- ce = CCorePlugin.getDefault().getCoreModel().create(programFile);
- if (ce != null && ce.exists()) return ce;
- return (ICElement)obj;
- }
- IEditorPart part = page.getActiveEditor();
- if (part != null) {
- IEditorInput input = part.getEditorInput();
- return (ICElement)input.getAdapter(ICElement.class);
- }
- return null;
- }
-
- /**
- * Set the C project attribute based on the ICElement.
- */
- private void initializeCProject(ICElement cElement, ILaunchConfigurationWorkingCopy config) {
- ICProject cProject = cElement.getCProject();
- String name = null;
- if (cProject != null && cProject.exists()) {
- name = cProject.getElementName();
- config.setMappedResources(new IResource[] {cProject.getProject()});
- }
- config.setAttribute(TCFLaunchDelegate.ATTR_PROJECT_NAME, name);
- }
-
- /**
- * Set the program name attributes on the working copy based on the ICElement
- */
- private void initializeProgramName(ICElement cElement, ILaunchConfigurationDialog dlg, ILaunchConfigurationWorkingCopy config) {
-
- boolean renamed = false;
-
- if (!(cElement instanceof IBinary)) {
- cElement = cElement.getCProject();
- }
-
- if (cElement instanceof ICProject) {
-
- IProject project = cElement.getCProject().getProject();
- String name = project.getName();
- ICProjectDescription projDes = CCorePlugin.getDefault().getProjectDescription(project);
- if (projDes != null) {
- String buildConfigName = projDes.getActiveConfiguration().getName();
- name = name + " " + buildConfigName; //$NON-NLS-1$
- }
- name = dlg.generateName(name);
- config.rename(name);
- renamed = true;
- }
-
- IBinary binary = null;
- if (cElement instanceof ICProject) {
- IBinary[] bins = getBinaryFiles((ICProject)cElement);
- if (bins != null && bins.length == 1) {
- binary = bins[0];
- }
- }
- else if (cElement instanceof IBinary) {
- binary = (IBinary)cElement;
- }
-
- if (binary != null) {
- String path;
- path = binary.getResource().getProjectRelativePath().toOSString();
- config.setAttribute(TCFLaunchDelegate.ATTR_LOCAL_PROGRAM_FILE, path);
- if (!renamed)
- {
- String name = binary.getElementName();
- int index = name.lastIndexOf('.');
- if (index > 0) {
- name = name.substring(0, index);
- }
- name = dlg.generateName(name);
- config.rename(name);
- renamed = true;
- }
- }
-
- if (!renamed) {
- String name = dlg.generateName(cElement.getCProject().getElementName());
- config.rename(name);
- }
- }
-
- public String getBuildConfigID(IProject project) {
- ICProjectDescription projDes = CCorePlugin.getDefault().getProjectDescription(project);
- if (projDes == null) return null;
- return projDes.getActiveConfiguration().getId();
- }
-
- /**
- * Iterate through and suck up all of the executable files that we can find.
- */
- private IBinary[] getBinaryFiles(final ICProject cproject) {
- if (cproject == null || !cproject.exists()) return null;
- final Display display = Display.getCurrent();
- final Object[] ret = new Object[1];
- BusyIndicator.showWhile(display, new Runnable() {
-
- public void run() {
- try {
- ret[0] = cproject.getBinaryContainer().getBinaries();
- }
- catch (CModelException e) {
- Activator.errorDialog("Launch UI internal error", e);
- }
- }
- });
- return (IBinary[])ret[0];
- }
-
- /**
- * Return true if given file path names a binary file.
- * @param project
- * @param path
- * @return true if binary file.
- * @throws CoreException
- */
- public boolean isBinary(IProject project, IPath path) throws CoreException {
- return LaunchUtils.getBinary(project, path) != null;
- }
-
- public String chooseBinary(Shell shell, IProject project) {
- ILabelProvider programLabelProvider = new CElementLabelProvider() {
-
- @Override
- public String getText(Object element) {
- if (element instanceof IBinary) {
- IBinary bin = (IBinary)element;
- StringBuffer name = new StringBuffer();
- name.append(bin.getPath().lastSegment());
- return name.toString();
- }
- return super.getText(element);
- }
-
- @Override
- public Image getImage(Object element) {
- if (! (element instanceof ICElement)) {
- return super.getImage(element);
- }
- ICElement celement = (ICElement)element;
-
- if (celement.getElementType() == ICElement.C_BINARY) {
- IBinary belement = (IBinary)celement;
- if (belement.isExecutable()) {
- return DebugUITools.getImage(IDebugUIConstants.IMG_ACT_RUN);
- }
- }
-
- return super.getImage(element);
- }
- };
-
- ILabelProvider qualifierLabelProvider = new CElementLabelProvider() {
-
- @Override
- public String getText(Object element) {
- if (element instanceof IBinary) {
- IBinary bin = (IBinary)element;
- StringBuffer name = new StringBuffer();
- name.append(bin.getCPU() + (bin.isLittleEndian() ? "le" : "be")); //$NON-NLS-1$ //$NON-NLS-2$
- name.append(" - "); //$NON-NLS-1$
- name.append(bin.getPath().toString());
- return name.toString();
- }
- return super.getText(element);
- }
- };
-
- TwoPaneElementSelector dialog = new TwoPaneElementSelector(shell, programLabelProvider, qualifierLabelProvider);
- dialog.setElements(getBinaryFiles(getCProject(project.getName())));
- dialog.setMessage("Choose program to run");
- dialog.setTitle("Program Selection");
- dialog.setUpperListLabel("Binaries:");
- dialog.setLowerListLabel("Qualifier:");
- dialog.setMultipleSelection(false);
- // dialog.set
- if (dialog.open() != Window.OK) return null;
- IBinary binary = (IBinary)dialog.getFirstResult();
- return binary.getResource().getProjectRelativePath().toString();
- }
-
- /**
- * Return the ICProject corresponding to the project name in the project name text field, or
- * null if the text does not match a project name.
- */
- private ICProject getCProject(String name) {
- String projectName = name.trim();
- if (projectName.length() < 1) return null;
- return CoreModel.getDefault().getCModel().getCProject(projectName);
- }
-}
diff --git a/plugins/org.eclipse.tm.tcf.cdt.ui/src/org/eclipse/tm/internal/tcf/cdt/ui/TCFNodeAdapterFactory.java b/plugins/org.eclipse.tm.tcf.cdt.ui/src/org/eclipse/tm/internal/tcf/cdt/ui/TCFNodeAdapterFactory.java
deleted file mode 100644
index 7dcc42b2c..000000000
--- a/plugins/org.eclipse.tm.tcf.cdt.ui/src/org/eclipse/tm/internal/tcf/cdt/ui/TCFNodeAdapterFactory.java
+++ /dev/null
@@ -1,135 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010, 2011 Wind River Systems, Inc. and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipse.tm.internal.tcf.cdt.ui;
-
-import org.eclipse.cdt.debug.core.model.IReverseResumeHandler;
-import org.eclipse.cdt.debug.core.model.IReverseStepIntoHandler;
-import org.eclipse.cdt.debug.core.model.IReverseStepOverHandler;
-import org.eclipse.cdt.debug.core.model.IReverseToggleHandler;
-import org.eclipse.cdt.debug.core.model.ISteppingModeTarget;
-import org.eclipse.cdt.debug.core.model.IUncallHandler;
-import org.eclipse.cdt.debug.internal.core.ICWatchpointTarget;
-import org.eclipse.cdt.debug.internal.ui.disassembly.dsf.IDisassemblyBackend;
-import org.eclipse.cdt.debug.ui.IPinProvider;
-import org.eclipse.cdt.ui.text.c.hover.ICEditorTextHover;
-import org.eclipse.core.runtime.IAdapterFactory;
-import org.eclipse.debug.core.model.ISuspendResume;
-import org.eclipse.tm.internal.tcf.cdt.ui.breakpoints.TCFWatchpointTarget;
-import org.eclipse.tm.internal.tcf.cdt.ui.commands.TCFPinViewCommand;
-import org.eclipse.tm.internal.tcf.cdt.ui.commands.TCFReverseResumeCommand;
-import org.eclipse.tm.internal.tcf.cdt.ui.commands.TCFReverseStepIntoCommand;
-import org.eclipse.tm.internal.tcf.cdt.ui.commands.TCFReverseStepOverCommand;
-import org.eclipse.tm.internal.tcf.cdt.ui.commands.TCFReverseStepReturnCommand;
-import org.eclipse.tm.internal.tcf.cdt.ui.commands.TCFReverseToggleCommand;
-import org.eclipse.tm.internal.tcf.cdt.ui.disassembly.TCFDisassemblyBackend;
-import org.eclipse.tm.internal.tcf.cdt.ui.hover.TCFDebugTextHover;
-import org.eclipse.tm.internal.tcf.cdt.ui.sourcelookup.TCFSourceNotFoundPresentation;
-import org.eclipse.tm.internal.tcf.debug.ui.model.ISourceNotFoundPresentation;
-import org.eclipse.tm.internal.tcf.debug.ui.model.TCFModel;
-import org.eclipse.tm.internal.tcf.debug.ui.model.TCFNode;
-import org.eclipse.tm.internal.tcf.debug.ui.model.TCFNodeExecContext;
-import org.eclipse.tm.internal.tcf.debug.ui.model.TCFNodeExpression;
-import org.eclipse.tm.internal.tcf.debug.ui.model.TCFNodeStackFrame;
-
-@SuppressWarnings({ "rawtypes", "restriction" })
-public class TCFNodeAdapterFactory implements IAdapterFactory {
-
- private static final Class<?>[] CLASSES = {
- IDisassemblyBackend.class,
- ISteppingModeTarget.class,
- ISuspendResume.class,
- ICEditorTextHover.class,
- IReverseToggleHandler.class,
- IReverseStepIntoHandler.class,
- IReverseStepOverHandler.class,
- IReverseResumeHandler.class,
- IUncallHandler.class,
- IPinProvider.class,
- ICWatchpointTarget.class,
- ISourceNotFoundPresentation.class
- };
-
- private static final TCFSourceNotFoundPresentation fgSourceNotFoundPresentation = new TCFSourceNotFoundPresentation();
-
- public Object getAdapter(Object obj, Class type) {
- if (obj instanceof TCFNode) {
- final TCFNode node = (TCFNode)obj;
- TCFModel model = node.getModel();
- if (IDisassemblyBackend.class == type) {
- TCFDisassemblyBackend backend = new TCFDisassemblyBackend();
- if (backend.supportsDebugContext((TCFNode)obj)) return backend;
- }
- else if (ISteppingModeTarget.class == type) {
- ISteppingModeTarget target = (ISteppingModeTarget)model.getAdapter(type, node);
- if (target == null) model.setAdapter(type, target = new TCFSteppingModeTarget(model));
- return target;
- }
- else if (ISuspendResume.class == type) {
- TCFNodeExecContext exec = null;
- if (node instanceof TCFNodeExecContext) {
- exec = (TCFNodeExecContext)node;
- }
- else if (node instanceof TCFNodeStackFrame) {
- exec = (TCFNodeExecContext)node.getParent();
- }
- if (exec != null) {
- return new TCFSuspendResumeAdapter(exec);
- }
- }
- else if (ICEditorTextHover.class == type) {
- ICEditorTextHover hover = (ICEditorTextHover)model.getAdapter(type, node);
- if (hover == null) model.setAdapter(type, hover = new TCFDebugTextHover());
- return hover;
- }
- else if (IReverseToggleHandler.class == type) {
- IReverseToggleHandler handler = (IReverseToggleHandler)model.getAdapter(type, node);
- if (handler == null) model.setAdapter(type, handler = new TCFReverseToggleCommand());
- return handler;
- }
- else if (IReverseStepIntoHandler.class == type) {
- IReverseStepIntoHandler handler = (IReverseStepIntoHandler)model.getAdapter(type, node);
- if (handler == null) model.setAdapter(type, handler = new TCFReverseStepIntoCommand(model));
- return handler;
- }
- else if (IReverseStepOverHandler.class == type) {
- IReverseStepOverHandler handler = (IReverseStepOverHandler)model.getAdapter(type, node);
- if (handler == null) model.setAdapter(type, handler = new TCFReverseStepOverCommand(model));
- return handler;
- }
- else if (IUncallHandler.class == type) {
- IUncallHandler handler = (IUncallHandler)model.getAdapter(type, node);
- if (handler == null) model.setAdapter(type, handler = new TCFReverseStepReturnCommand(model));
- return handler;
- }
- else if (IReverseResumeHandler.class == type) {
- IReverseResumeHandler handler = (IReverseResumeHandler)model.getAdapter(type, node);
- if (handler == null) model.setAdapter(type, handler = new TCFReverseResumeCommand(model));
- return handler;
- }
- else if (IPinProvider.class == type) {
- IPinProvider handler = (IPinProvider)model.getAdapter(type, node);
- if (handler == null) model.setAdapter(type, handler = new TCFPinViewCommand(model));
- return handler;
- }
- else if (ICWatchpointTarget.class == type) {
- if (node instanceof TCFNodeExpression) return new TCFWatchpointTarget((TCFNodeExpression)node);
- }
- else if (ISourceNotFoundPresentation.class == type) {
- return fgSourceNotFoundPresentation;
- }
- }
- return null;
- }
-
- public Class[] getAdapterList() {
- return CLASSES;
- }
-}
diff --git a/plugins/org.eclipse.tm.tcf.cdt.ui/src/org/eclipse/tm/internal/tcf/cdt/ui/TCFSteppingModeTarget.java b/plugins/org.eclipse.tm.tcf.cdt.ui/src/org/eclipse/tm/internal/tcf/cdt/ui/TCFSteppingModeTarget.java
deleted file mode 100644
index d36b71a20..000000000
--- a/plugins/org.eclipse.tm.tcf.cdt.ui/src/org/eclipse/tm/internal/tcf/cdt/ui/TCFSteppingModeTarget.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 Wind River Systems, Inc. and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipse.tm.internal.tcf.cdt.ui;
-
-import org.eclipse.cdt.debug.core.model.ISteppingModeTarget;
-import org.eclipse.cdt.debug.core.model.ITargetProperties;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.Preferences;
-import org.eclipse.core.runtime.Preferences.IPropertyChangeListener;
-import org.eclipse.debug.ui.DebugUITools;
-import org.eclipse.debug.ui.sourcelookup.ISourceDisplay;
-import org.eclipse.tm.internal.tcf.debug.ui.model.TCFModel;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.PlatformUI;
-
-/**
- * Integrates the TCF model with the "Instruction Stepping Mode" button from CDT.
- */
-@SuppressWarnings("deprecation")
-public class TCFSteppingModeTarget implements ISteppingModeTarget, ITargetProperties {
-
- private final Preferences fPreferences;
- private final TCFModel fModel;
-
- public TCFSteppingModeTarget(TCFModel model) {
- fPreferences= new Preferences();
- fPreferences.setDefault(PREF_INSTRUCTION_STEPPING_MODE, model.isInstructionSteppingEnabled());
- fModel = model;
- }
-
- public void addPropertyChangeListener(IPropertyChangeListener listener) {
- fPreferences.addPropertyChangeListener(listener);
- }
-
- public void removePropertyChangeListener(IPropertyChangeListener listener) {
- fPreferences.removePropertyChangeListener(listener);
- }
-
- public boolean supportsInstructionStepping() {
- return true;
- }
-
- public void enableInstructionStepping(boolean enabled) {
- fPreferences.setValue(PREF_INSTRUCTION_STEPPING_MODE, enabled);
- fModel.setInstructionSteppingEnabled(enabled);
- // switch to disassembly or source
- forceSourceDisplay(DebugUITools.getDebugContext());
- }
-
- private void forceSourceDisplay(IAdaptable debugContext) {
- ISourceDisplay sourceDisplay = (ISourceDisplay) debugContext.getAdapter(ISourceDisplay.class);
- if (sourceDisplay != null) {
- IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
- if (window != null) {
- IWorkbenchPage page = window.getActivePage();
- if (page != null) {
- sourceDisplay.displaySource(debugContext, page, true);
- }
- }
- }
- }
-
- public boolean isInstructionSteppingEnabled() {
- return fPreferences.getBoolean(PREF_INSTRUCTION_STEPPING_MODE);
- }
-
-}
diff --git a/plugins/org.eclipse.tm.tcf.cdt.ui/src/org/eclipse/tm/internal/tcf/cdt/ui/TCFSuspendResumeAdapter.java b/plugins/org.eclipse.tm.tcf.cdt.ui/src/org/eclipse/tm/internal/tcf/cdt/ui/TCFSuspendResumeAdapter.java
deleted file mode 100644
index 124c8ac16..000000000
--- a/plugins/org.eclipse.tm.tcf.cdt.ui/src/org/eclipse/tm/internal/tcf/cdt/ui/TCFSuspendResumeAdapter.java
+++ /dev/null
@@ -1,555 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 Wind River Systems, Inc. and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipse.tm.internal.tcf.cdt.ui;
-
-import java.util.HashMap;
-import java.util.LinkedList;
-import java.util.Map;
-
-import org.eclipse.cdt.core.IAddress;
-import org.eclipse.cdt.debug.core.model.IMoveToAddress;
-import org.eclipse.cdt.debug.core.model.IMoveToLine;
-import org.eclipse.cdt.debug.core.model.IResumeAtAddress;
-import org.eclipse.cdt.debug.core.model.IResumeAtLine;
-import org.eclipse.cdt.debug.core.model.IRunToAddress;
-import org.eclipse.cdt.debug.core.model.IRunToLine;
-import org.eclipse.cdt.debug.internal.core.sourcelookup.CSourceLookupDirector;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.debug.core.DebugException;
-import org.eclipse.debug.core.model.ISourceLocator;
-import org.eclipse.debug.core.model.ISuspendResume;
-import org.eclipse.tm.internal.tcf.debug.model.TCFContextState;
-import org.eclipse.tm.internal.tcf.debug.ui.model.TCFChildren;
-import org.eclipse.tm.internal.tcf.debug.ui.model.TCFDebugTask;
-import org.eclipse.tm.internal.tcf.debug.ui.model.TCFNode;
-import org.eclipse.tm.internal.tcf.debug.ui.model.TCFNodeExecContext;
-import org.eclipse.tm.internal.tcf.debug.ui.model.TCFNodeRegister;
-import org.eclipse.tm.tcf.protocol.IChannel;
-import org.eclipse.tm.tcf.protocol.IToken;
-import org.eclipse.tm.tcf.protocol.JSON;
-import org.eclipse.tm.tcf.services.IBreakpoints;
-import org.eclipse.tm.tcf.services.ILineNumbers;
-import org.eclipse.tm.tcf.services.ILineNumbers.CodeArea;
-import org.eclipse.tm.tcf.services.IMemory;
-import org.eclipse.tm.tcf.services.IRegisters;
-import org.eclipse.tm.tcf.services.IRegisters.RegistersContext;
-import org.eclipse.tm.tcf.services.IRunControl;
-import org.eclipse.tm.tcf.services.IRunControl.RunControlContext;
-import org.eclipse.tm.tcf.services.IRunControl.RunControlListener;
-import org.eclipse.tm.tcf.util.TCFDataCache;
-import org.eclipse.tm.tcf.util.TCFTask;
-
-/**
- * A {@link ISuspendResume} adapter for TCF execution contexts enabling special
- * run control actions run-to-line, move-to-line and resume-at-line.
- */
-@SuppressWarnings("restriction")
-public class TCFSuspendResumeAdapter implements ISuspendResume, IRunToLine,
- IRunToAddress, IMoveToLine, IMoveToAddress, IResumeAtLine,
- IResumeAtAddress, IAdaptable {
-
- private static class Location {
- String fFile;
- int fLine;
- Number fAddress;
- Location(String file, int line) {
- fFile = file;
- fLine = line;
- }
- Location(Number address) {
- fAddress = address;
- }
- }
-
- private final TCFNodeExecContext fExecCtx;
-
- public TCFSuspendResumeAdapter(TCFNodeExecContext execCtx) {
- fExecCtx = execCtx;
- }
-
- @SuppressWarnings("rawtypes")
- public Object getAdapter(Class adapter) {
- if (adapter.isInstance(this)) {
- return this;
- }
- return null;
- }
-
- public boolean canResume() {
- return isSuspended();
- }
-
- public boolean canSuspend() {
- return !isSuspended();
- }
-
- public boolean isSuspended() {
- try {
- Boolean result = new TCFTask<Boolean>() {
- public void run() {
- if (fExecCtx.isDisposed()) {
- done(Boolean.FALSE);
- return;
- }
- TCFDataCache<TCFContextState> state = fExecCtx.getState();
- if (!state.validate(this)) {
- return;
- }
- if (state.getError() == null && state.getData() != null) {
- done(state.getData().is_suspended);
- return;
- }
- done(Boolean.FALSE);
- }
- }.get();
- return result != null ? result : false;
- }
- catch (Exception e) {
- // ignored
- }
- return false;
- }
-
- public void resume() throws DebugException {
- new TCFDebugTask<Object>() {
- public void run() {
- if (fExecCtx.isDisposed()) {
- // ignore silently
- done(null);
- return;
- }
- TCFDataCache<IRunControl.RunControlContext> cache = fExecCtx.getRunContext();
- if (!cache.validate(this)) {
- return;
- }
- IRunControl.RunControlContext runCtx = cache.getData();
- if (runCtx.canResume(IRunControl.RM_RESUME)) {
- runCtx.resume(IRunControl.RM_RESUME, 1, new IRunControl.DoneCommand() {
- public void doneCommand(IToken token, Exception error) {
- if (error != null) {
- error(error);
- } else {
- done(null);
- }
- }
- });
- }
- }
- }.getD();
- }
-
- public void suspend() throws DebugException {
- new TCFDebugTask<Object>() {
- public void run() {
- if (fExecCtx.isDisposed()) {
- // ignore silently
- done(null);
- return;
- }
- TCFDataCache<IRunControl.RunControlContext> cache = fExecCtx.getRunContext();
- if (!cache.validate(this)) {
- return;
- }
- IRunControl.RunControlContext runCtx = cache.getData();
- if (runCtx.canSuspend()) {
- runCtx.suspend(new IRunControl.DoneCommand() {
- public void doneCommand(IToken token, Exception error) {
- if (error != null) {
- error(error);
- } else {
- done(null);
- }
- }
- });
- }
- }
- }.getD();
- }
-
- public boolean canResumeAtAddress(IAddress address) {
- return true;
- }
-
- public void resumeAtAddress(IAddress address) throws DebugException {
- moveToLocation(new Location(address.getValue()), true);
- }
-
- public boolean canResumeAtLine(IFile file, int lineNumber) {
- return true;
- }
-
- public void resumeAtLine(IFile file, int lineNumber) throws DebugException {
- IPath location = file.getLocation();
- if (location == null) {
- throw new DebugException(new Status(IStatus.ERROR, Activator.PLUGIN_ID, "Cannot resume at line: Not a local file."));
- }
- resumeAtLine(location.toOSString(), lineNumber);
- }
-
- public boolean canResumeAtLine(String fileName, int lineNumber) {
- return true;
- }
-
- public void resumeAtLine(String fileName, int lineNumber) throws DebugException {
- String debuggerPath = mapToDebuggerPath(fileName);
- moveToLocation(new Location(debuggerPath, lineNumber), true);
- }
-
- public boolean canMoveToAddress(IAddress address) {
- return true;
- }
-
- public void moveToAddress(IAddress address) throws DebugException {
- moveToLocation(new Location(address.getValue()), false);
- }
-
- public boolean canMoveToLine(String fileName, int lineNumber) {
- return true;
- }
-
- public void moveToLine(String fileName, int lineNumber) throws DebugException {
- String debuggerPath = mapToDebuggerPath(fileName);
- moveToLocation(new Location(debuggerPath, lineNumber), false);
- }
-
- public boolean canRunToAddress(IAddress address) {
- return canResume();
- }
-
- public void runToAddress(IAddress address, boolean skipBreakpoints) throws DebugException {
- runToLocation(new Location(address.getValue()), skipBreakpoints);
- }
-
- public boolean canRunToLine(IFile file, int lineNumber) {
- return canResume();
- }
-
- public void runToLine(IFile file, int lineNumber, boolean skipBreakpoints) throws DebugException {
- IPath location = file.getLocation();
- if (location == null) {
- throw new DebugException(new Status(IStatus.ERROR, Activator.PLUGIN_ID, "Cannot run to line: Not a local file."));
- }
- runToLine(location.toOSString(), lineNumber, skipBreakpoints);
- }
-
- public boolean canRunToLine(String fileName, int lineNumber) {
- return canResume();
- }
-
- public void runToLine(String fileName, final int lineNumber, final boolean skipBreakpoints) throws DebugException {
- String debuggerPath = mapToDebuggerPath(fileName);
- runToLocation(new Location(debuggerPath, lineNumber), skipBreakpoints);
- }
-
- private String mapToDebuggerPath(String fileName) {
- ISourceLocator locator = fExecCtx.getModel().getLaunch().getSourceLocator();
- if (locator instanceof CSourceLookupDirector) {
- IPath compilationPath = ((CSourceLookupDirector) locator).getCompilationPath(fileName);
- if (compilationPath != null) {
- return compilationPath.toString();
- }
- }
- // fallback: use basename
- return new Path(fileName).lastSegment();
- }
-
- private void runToLocation(final Location location, final boolean skipBreakpoints) throws DebugException {
- new TCFDebugTask<Object>() {
- public void run() {
- if (fExecCtx.isDisposed()) {
- // ignore silently
- done(null);
- return;
- }
- final TCFDataCache<IRunControl.RunControlContext> cache = fExecCtx.getRunContext();
- if (!cache.validate(this)) {
- return;
- }
- final IChannel channel = fExecCtx.getChannel();
- final IBreakpoints breakpoints = channel.getRemoteService(IBreakpoints.class);
- if (breakpoints == null) {
- error("Cannot set breakpoint.");
- return;
- }
- final String contextId = fExecCtx.getID();
- Map<String, Object> properties = new HashMap<String, Object>();
- if (location.fFile != null) {
- properties.put(IBreakpoints.PROP_FILE, location.fFile);
- properties.put(IBreakpoints.PROP_LINE, location.fLine);
- } else {
- properties.put(IBreakpoints.PROP_LOCATION, location.fAddress.toString());
- }
-// properties.put(IBreakpoints.PROP_CONTEXTIDS, new String[] { contextId });
- properties.put(IBreakpoints.PROP_ENABLED, Boolean.TRUE);
-// properties.put(IBreakpoints.PROP_TEMPORARY, Boolean.TRUE);
- final String breakpointId = "runtoline"+location.hashCode();
- properties.put(IBreakpoints.PROP_ID, breakpointId);
- breakpoints.add(properties, new IBreakpoints.DoneCommand() {
- public void doneCommand(IToken token, Exception error) {
- if (error != null) {
- error(error);
- return;
- }
- final Runnable removeBreakpoint = new Runnable() {
- public void run() {
- breakpoints.remove(new String[] { breakpointId }, new IBreakpoints.DoneCommand() {
- public void doneCommand(IToken token, Exception error) {
- // ignore errors?
- }
- });
- }
- };
- Runnable resume = new Runnable() {
- public void run() {
- final IRunControl runControl = channel.getRemoteService(IRunControl.class);
- if (runControl == null) {
- error("Cannot resume.");
- removeBreakpoint.run();
- return;
- }
- if (!cache.validate(this)) {
- removeBreakpoint.run();
- return;
- }
- if (cache.getError() != null) {
- error(cache.getError());
- removeBreakpoint.run();
- return;
- }
- runControl.addListener(new RunControlListener() {
- boolean fRunning;
- public void contextSuspended(String context, String pc, String reason,
- Map<String, Object> params) {
- if (contextId.equals(context) && fRunning) {
- finished();
- }
- }
- private void finished() {
- runControl.removeListener(this);
- removeBreakpoint.run();
- }
- public void contextResumed(String context) {
- if (contextId.equals(context) && !fRunning) {
- fRunning = true;
- }
- }
- public void contextRemoved(String[] context_ids) {
- for (String context : context_ids) {
- if (contextId.equals(context)) {
- finished();
- return;
- }
- }
- }
- public void contextException(String context, String msg) {
- }
- public void contextChanged(RunControlContext[] contexts) {
- }
- public void contextAdded(RunControlContext[] contexts) {
- }
- public void containerSuspended(String context, String pc, String reason,
- Map<String, Object> params, String[] suspended_ids) {
- if (fRunning) {
- for (String context2 : suspended_ids) {
- if (contextId.equals(context2)) {
- finished();
- }
- }
- }
- }
- public void containerResumed(String[] context_ids) {
- if (!fRunning) {
- for (String context2 : context_ids) {
- if (contextId.equals(context2)) {
- fRunning = true;
- return;
- }
- }
- }
- }
- });
- IRunControl.RunControlContext runCtx = cache.getData();
- if (runCtx.canResume(IRunControl.RM_RESUME)) {
- runCtx.resume(IRunControl.RM_RESUME, 1, new IRunControl.DoneCommand() {
- public void doneCommand(IToken token, Exception error) {
- if (error != null) {
- error(error);
- } else {
- done(null);
- }
- }
- });
- }
- }
- };
- if (cache.validate(resume)) {
- resume.run();
- }
- }
- });
- }
- }.getD();
- }
-
- private void moveToLocation(final Location location, final boolean resume) throws DebugException {
- new TCFDebugTask<Object>() {
- private RegistersContext fPCReg;
- public void run() {
- if (fExecCtx.isDisposed()) {
- // ignore silently
- done(null);
- return;
- }
-
- LinkedList<TCFChildren> queue = new LinkedList<TCFChildren>();
- queue.add(fExecCtx.getRegisters());
- while (fPCReg == null && !queue.isEmpty()) {
- TCFChildren regNodesCache = queue.removeFirst();
- if (!regNodesCache.validate(this)) return;
- Map<String,TCFNode> regNodes = regNodesCache.getData();
- if (regNodes == null || regNodes.size() == 0) {
- if (regNodesCache.getError() != null) error(regNodesCache.getError());
- else error("Cannot retrive registers info");
- return;
- }
-
- for (TCFNode node : regNodes.values()) {
- TCFNodeRegister regNode = (TCFNodeRegister)node;
- TCFDataCache<IRegisters.RegistersContext> regCtxCache = regNode.getContext();
- if (!regCtxCache.validate(this)) return;
- IRegisters.RegistersContext context = regCtxCache.getData();
- if (context != null && IRegisters.ROLE_PC.equals(context.getRole())) {
- fPCReg = context;
- break;
- }
- queue.add(regNode.getChildren());
- }
- }
-
- if (fPCReg == null) {
- error("Cannot determine PC register.");
- return;
- }
-
- if (location.fAddress == null) {
- final IChannel channel = fExecCtx.getChannel();
- final ILineNumbers lineNumbers = channel.getRemoteService(ILineNumbers.class);
- if (lineNumbers == null) {
- error("No line numbers service.");
- return;
- }
- TCFDataCache<TCFNodeExecContext> memNodeCache = fExecCtx.getMemoryNode();
- if (!memNodeCache.validate(this)) return;
- TCFNodeExecContext memNode = memNodeCache.getData();
- if (memNode == null) {
- if (memNodeCache.getError() != null) error(memNodeCache.getError());
- else error("Cannot determine memory context.");
- return;
- }
- TCFDataCache<IMemory.MemoryContext> memCtxCache = memNode.getMemoryContext();
- if (!memCtxCache.validate(this)) return;
- final IMemory.MemoryContext memCtx = memCtxCache.getData();
- if (memCtx == null) {
- if (memNodeCache.getError() != null) error(memNodeCache.getError());
- else error("Cannot determine memory context.");
- return;
- }
- lineNumbers.mapToMemory(memCtx.getID(), location.fFile, location.fLine, 0, new ILineNumbers.DoneMapToMemory() {
- public void doneMapToMemory(IToken token, Exception error, CodeArea[] areas) {
- if (error != null) {
- error(error);
- return;
- }
- if (areas == null || areas.length == 0) {
- error("Cannot map source location to address.");
- return;
- }
- doneGetLocationAddress(areas[0].start_address);
- }
- });
- }
- else {
- doneGetLocationAddress(location.fAddress);
- }
- }
- private void doneGetLocationAddress(Number address) {
- if (address == null) {
- error("Cannot map source location to address.");
- return;
- }
- byte[] value = addressToByteArray(address, fPCReg.getSize(), fPCReg.isBigEndian());
- fPCReg.set(value, new IRegisters.DoneSet() {
- public void doneSet(IToken token, Exception error) {
- if (error != null) {
- error(error);
- return;
- }
- fExecCtx.getModel().setDebugViewSelection(fExecCtx, "Move");
- if (resume) {
- final TCFDataCache<IRunControl.RunControlContext> cache = fExecCtx.getRunContext();
- final IChannel channel = fExecCtx.getChannel();
- Runnable resume = new Runnable() {
- public void run() {
- final IRunControl runControl = channel.getRemoteService(IRunControl.class);
- if (runControl == null) {
- error("Cannot resume.");
- return;
- }
- if (!cache.validate(this)) {
- return;
- }
- if (cache.getError() != null) {
- error(cache.getError());
- return;
- }
- IRunControl.RunControlContext runCtx = cache.getData();
- if (runCtx.canResume(IRunControl.RM_RESUME)) {
- runCtx.resume(IRunControl.RM_RESUME, 1, new IRunControl.DoneCommand() {
- public void doneCommand(IToken token, Exception error) {
- if (error != null) {
- error(error);
- } else {
- done(null);
- }
- }
- });
- }
- }
- };
- if (cache.validate(resume)) {
- resume.run();
- }
- } else {
- done(null);
- }
- }
- });
- }
- private byte[] addressToByteArray(Number address, int size, boolean bigEndian) {
- byte[] bytes = new byte[size];
- byte[] addrBytes = JSON.toBigInteger(address).toByteArray();
- for (int i=0; i < bytes.length; ++i) {
- byte b = 0;
- if (i < addrBytes.length) {
- b = addrBytes[addrBytes.length - i - 1];
- }
- bytes[bigEndian ? size -i - 1 : i] = b;
- }
- return bytes;
- }
- }.getD();
- }
-}
diff --git a/plugins/org.eclipse.tm.tcf.cdt.ui/src/org/eclipse/tm/internal/tcf/cdt/ui/breakpoints/TCFBreakpointScopeExtension.java b/plugins/org.eclipse.tm.tcf.cdt.ui/src/org/eclipse/tm/internal/tcf/cdt/ui/breakpoints/TCFBreakpointScopeExtension.java
deleted file mode 100644
index b9536af71..000000000
--- a/plugins/org.eclipse.tm.tcf.cdt.ui/src/org/eclipse/tm/internal/tcf/cdt/ui/breakpoints/TCFBreakpointScopeExtension.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Wind River Systems, Inc. and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipse.tm.internal.tcf.cdt.ui.breakpoints;
-
-import org.eclipse.cdt.debug.core.model.ICBreakpoint;
-import org.eclipse.cdt.debug.core.model.ICBreakpointExtension;
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.tm.internal.tcf.cdt.ui.Activator;
-import org.eclipse.tm.internal.tcf.debug.model.ITCFConstants;
-import org.eclipse.tm.tcf.services.IBreakpoints;
-
-public class TCFBreakpointScopeExtension implements ICBreakpointExtension {
-
- static final String ATTR_CONTEXT_IDS = ITCFConstants.ID_TCF_DEBUG_MODEL + '.' + IBreakpoints.PROP_CONTEXTIDS;
-
- private String[] fContextIds;
- private ICBreakpoint fBreakpoint;
-
- public void initialize(ICBreakpoint breakpoint) throws CoreException {
- fBreakpoint = breakpoint;
- IMarker m = breakpoint.getMarker();
- if (m != null && m.exists()) {
- String contextIdAttr = m.getAttribute(ATTR_CONTEXT_IDS, null);
- if (contextIdAttr != null) {
- fContextIds = contextIdAttr.split(",\\s*");
- }
- }
- }
-
- public void setThreadFilter(String[] threadIds) {
- fContextIds = threadIds;
- if (fBreakpoint == null) {
- return;
- }
- IMarker m = fBreakpoint.getMarker();
- if (m == null || !m.exists()) {
- return;
- }
- String contextIdAttr = null;
- if (threadIds != null) {
- if (threadIds.length == 0) {
- // empty string is filtered out in TCFBreakpointsModel
- contextIdAttr = " ";
- } else {
- StringBuilder buf = new StringBuilder();
- for (int i=0; i < threadIds.length - 1; ++i) {
- buf.append(threadIds[i]).append(',');
- }
- buf.append(threadIds[threadIds.length - 1]);
- contextIdAttr = buf.toString();
- }
- }
- try {
- m.setAttribute(ATTR_CONTEXT_IDS, contextIdAttr);
- }
- catch (CoreException e) {
- Activator.log(e);
- }
- }
-
- public String[] getThreadFilters() {
- return fContextIds;
- }
-
-}
diff --git a/plugins/org.eclipse.tm.tcf.cdt.ui/src/org/eclipse/tm/internal/tcf/cdt/ui/breakpoints/TCFBreakpointStatusPage.java b/plugins/org.eclipse.tm.tcf.cdt.ui/src/org/eclipse/tm/internal/tcf/cdt/ui/breakpoints/TCFBreakpointStatusPage.java
deleted file mode 100644
index 3a07b9949..000000000
--- a/plugins/org.eclipse.tm.tcf.cdt.ui/src/org/eclipse/tm/internal/tcf/cdt/ui/breakpoints/TCFBreakpointStatusPage.java
+++ /dev/null
@@ -1,329 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Wind River Systems, Inc. and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipse.tm.internal.tcf.cdt.ui.breakpoints;
-
-import java.math.BigInteger;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import org.eclipse.cdt.debug.core.model.ICBreakpoint;
-import org.eclipse.debug.core.DebugPlugin;
-import org.eclipse.debug.core.ILaunch;
-import org.eclipse.debug.core.ILaunchConfiguration;
-import org.eclipse.debug.ui.DebugUITools;
-import org.eclipse.debug.ui.IDebugUIConstants;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.ITreeContentProvider;
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.jface.viewers.TreeViewer;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.tm.internal.tcf.cdt.ui.ImageCache;
-import org.eclipse.tm.internal.tcf.debug.model.TCFBreakpointsStatus;
-import org.eclipse.tm.internal.tcf.debug.model.TCFLaunch;
-import org.eclipse.tm.internal.tcf.debug.ui.model.TCFModel;
-import org.eclipse.tm.internal.tcf.debug.ui.model.TCFModelManager;
-import org.eclipse.tm.internal.tcf.debug.ui.model.TCFNode;
-import org.eclipse.tm.internal.tcf.debug.ui.model.TCFNodeExecContext;
-import org.eclipse.tm.internal.tcf.debug.ui.model.TCFNodeLaunch;
-import org.eclipse.tm.tcf.protocol.JSON;
-import org.eclipse.tm.tcf.services.IBreakpoints;
-import org.eclipse.tm.tcf.services.IRunControl;
-import org.eclipse.tm.tcf.util.TCFDataCache;
-import org.eclipse.tm.tcf.util.TCFTask;
-import org.eclipse.ui.dialogs.PropertyPage;
-
-public class TCFBreakpointStatusPage extends PropertyPage {
-
- private TreeViewer viewer;
- private List<StatusItem> status;
-
- private static class StatusItem implements Comparable<StatusItem> {
- Object object;
- String text;
- boolean has_state;
- boolean planted_ok;
- List<StatusItem> children;
- StatusItem parent;
-
- @SuppressWarnings({ "rawtypes", "unchecked" })
- public int compareTo(StatusItem n) {
- if (object instanceof TCFNode) {
- if (n.object instanceof TCFNode) {
- return ((Comparable)object).compareTo(n.object);
- }
- return 1;
- }
- if (n.object instanceof TCFNode) return -1;
- return 0;
- }
- }
-
- private class StatusCache extends TCFDataCache<StatusItem> {
-
- final TCFLaunch launch;
-
- TCFDataCache<?> pending;
-
- public StatusCache(TCFLaunch launch) {
- super(launch.getChannel());
- this.launch = launch;
- }
-
- @Override
- protected boolean startDataRetrieval() {
- pending = null;
- TCFBreakpointsStatus status = launch.getBreakpointsStatus();
- if (status == null) {
- set(null, null, null);
- return true;
- }
- Map<String,Object> map = status.getStatus(getBreakpoint());
- if (map == null || map.size() == 0) {
- set(null, null, null);
- return true;
- }
- StatusItem x = new StatusItem();
- x.object = launch;
- Object planted = map.get(IBreakpoints.STATUS_INSTANCES);
- if (planted != null) {
- TCFModel model = TCFModelManager.getModelManager().getModel(launch);
- for (Object o : toObjectArray(planted)) {
- Map<String,Object> m = toObjectMap(o);
- String ctx_id = (String)m.get(IBreakpoints.INSTANCE_CONTEXT);
- if (!model.createNode(ctx_id, this)) return false;
- if (isValid()) {
- reset();
- }
- else {
- StatusItem y = getNodeItem(x, model.getNode(ctx_id));
- if (y != null) {
- StatusItem z = new StatusItem();
- z.text = (String)m.get(IBreakpoints.INSTANCE_ERROR);
- if (z.text == null) {
- Number addr = (Number)m.get(IBreakpoints.INSTANCE_ADDRESS);
- if (addr != null) {
- BigInteger i = JSON.toBigInteger(addr);
- z.text = "Planted at 0x" + i.toString(16);
- z.planted_ok = true;
- Number size = (Number)m.get(IBreakpoints.INSTANCE_SIZE);
- if (size != null) z.text += "; Size " + size;
- String type = (String)m.get(IBreakpoints.INSTANCE_TYPE);
- if (type != null) z.text += "; Type: " + type;
- }
- }
- z.parent = y;
- if (y.children == null) y.children = new ArrayList<StatusItem>();
- y.children.add(z);
- }
- }
- }
- }
- if (pending != null) {
- pending.wait(this);
- return false;
- }
- String error = (String)map.get(IBreakpoints.STATUS_ERROR);
- if (error != null) {
- StatusItem y = new StatusItem();
- y.text = error;
- y.parent = x;
- x.children = new ArrayList<StatusItem>();
- x.children.add(y);
- }
- set(null, null, x);
- return true;
- }
-
- private StatusItem getNodeItem(StatusItem root, TCFNode node) {
- TCFNode parent = node.getParent();
- if (parent == null) return root;
- StatusItem x = null; // parent status item
- Set<String> filter = launch.getContextFilter();
- if (filter != null) {
- if (filter.contains(node.getID())) x = root;
- else if (parent instanceof TCFNodeLaunch) return null;
- }
- if (x == null) x = getNodeItem(root, parent);
- if (x == null) return null;
- if (x.children == null) x.children = new ArrayList<StatusItem>();
- for (StatusItem y : x.children) {
- if (y.object == node) return y;
- }
- StatusItem y = new StatusItem();
- y.object = node;
- TCFDataCache<IRunControl.RunControlContext> cache = ((TCFNodeExecContext)node).getRunContext();
- if (!cache.validate()) {
- pending = cache;
- }
- else {
- IRunControl.RunControlContext ctx = cache.getData();
- if (ctx != null) {
- y.text = ctx.getName();
- y.has_state = ctx.hasState();
- }
- if (y.text == null) y.text = node.getID();
- }
- y.parent = x;
- x.children.add(y);
- return y;
- }
- }
-
- private final ITreeContentProvider content_provider = new ITreeContentProvider() {
-
- public void dispose() {
- }
-
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- }
-
- public Object[] getElements(Object input) {
- return status.toArray(new StatusItem[status.size()]);
- }
-
- public Object[] getChildren(Object parent) {
- StatusItem x = (StatusItem)parent;
- if (x.children == null) return null;
- Object[] arr = x.children.toArray(new StatusItem[x.children.size()]);
- Arrays.sort(arr);
- return arr;
- }
-
- public Object getParent(Object element) {
- StatusItem x = (StatusItem)element;
- return x.parent;
- }
-
- public boolean hasChildren(Object element) {
- StatusItem x = (StatusItem)element;
- return x.children != null && x.children.size() > 0;
- }
- };
-
- private final LabelProvider label_provider = new LabelProvider() {
-
- @Override
- public Image getImage(Object element) {
- StatusItem x = (StatusItem)element;
- if (x.object instanceof ILaunch) {
- ImageDescriptor desc = DebugUITools.getDefaultImageDescriptor(x.object);
- if (desc != null) return ImageCache.getImage(desc);
- }
- if (x.has_state) return DebugUITools.getImage(IDebugUIConstants.IMG_OBJS_THREAD_RUNNING);
- if (x.object != null) return DebugUITools.getImage(IDebugUIConstants.IMG_OBJS_DEBUG_TARGET);
- if (x.planted_ok) return DebugUITools.getImage(IDebugUIConstants.IMG_OBJS_BREAKPOINT);
- return DebugUITools.getImage(IDebugUIConstants.IMG_OBJS_BREAKPOINT_DISABLED);
- }
-
- @Override
- public String getText(Object element) {
- StatusItem x = (StatusItem)element;
- if (x.object instanceof ILaunch) {
- ILaunchConfiguration cfg = ((ILaunch)x.object).getLaunchConfiguration();
- if (cfg != null) return cfg.getName();
- }
- return x.text;
- }
- };
-
- @Override
- protected Control createContents(Composite parent) {
- noDefaultAndApplyButton();
- Composite composite = new Composite(parent, SWT.NONE);
- composite.setFont(parent.getFont());
- composite.setLayout(new GridLayout());
- composite.setLayoutData(new GridData(GridData.FILL_BOTH));
- status = getCurrentStatus();
- createStatusViewer(composite);
- setValid(true);
- return composite;
- }
-
- private void createStatusViewer(Composite parent) {
- Label label = new Label(parent, SWT.NONE);
- label.setText("Breakpoint planting status:");
- label.setFont(parent.getFont());
- label.setLayoutData(new GridData());
- GridData data = new GridData(GridData.FILL_BOTH);
- data.heightHint = 100;
- viewer = new TreeViewer(parent, SWT.BORDER);
- viewer.getTree().setLayoutData(data);
- viewer.getTree().setFont(parent.getFont());
- viewer.setContentProvider(content_provider);
- viewer.setLabelProvider(label_provider);
- viewer.setInput(this);
- viewer.expandAll();
- }
-
- private ICBreakpoint getBreakpoint() {
- return (ICBreakpoint)getElement().getAdapter(ICBreakpoint.class);
- }
-
- private List<StatusItem> getCurrentStatus() {
- final List<StatusCache> caches = new ArrayList<StatusCache>();
- final ILaunch[] launches = DebugPlugin.getDefault().getLaunchManager().getLaunches();
- for (ILaunch launch : launches) {
- if (!(launch instanceof TCFLaunch)) continue;
- TCFLaunch tcf_launch = (TCFLaunch)launch;
- if (tcf_launch.isConnecting()) continue;
- if (tcf_launch.isDisconnected()) continue;
- caches.add(new StatusCache(tcf_launch));
- }
- List<StatusItem> status = new TCFTask<List<StatusItem>>(10000) {
- public void run() {
- StatusCache pending = null;
- for (StatusCache cache : caches) {
- if (!cache.validate()) pending = cache;
- }
- if (pending != null) {
- pending.wait(this);
- return;
- }
- List<StatusItem> roots = new ArrayList<StatusItem>();
- for (StatusCache cache : caches) {
- StatusItem x = cache.getData();
- if (x != null) roots.add(x);
- }
- for (StatusCache cache : caches) cache.dispose();
- if (roots.size() == 0) {
- StatusItem x = new StatusItem();
- x.text = "Not planted";
- roots.add(x);
- }
- done(roots);
- }
- }.getE();
- return status;
- }
-
- @SuppressWarnings("unchecked")
- private Object[] toObjectArray(Object o) {
- if (o == null) return null;
- Collection<Object> c = (Collection<Object>)o;
- return (Object[])c.toArray(new Object[c.size()]);
- }
-
- @SuppressWarnings("unchecked")
- private Map<String,Object> toObjectMap(Object o) {
- return (Map<String,Object>)o;
- }
-}
diff --git a/plugins/org.eclipse.tm.tcf.cdt.ui/src/org/eclipse/tm/internal/tcf/cdt/ui/breakpoints/TCFBreakpointThreadFilterPage.java b/plugins/org.eclipse.tm.tcf.cdt.ui/src/org/eclipse/tm/internal/tcf/cdt/ui/breakpoints/TCFBreakpointThreadFilterPage.java
deleted file mode 100644
index d5274096e..000000000
--- a/plugins/org.eclipse.tm.tcf.cdt.ui/src/org/eclipse/tm/internal/tcf/cdt/ui/breakpoints/TCFBreakpointThreadFilterPage.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2011 QNX Software Systems and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * QNX Software Systems - Initial API and implementation
- * Wind River Systems - Adapted to TCF
- *******************************************************************************/
-package org.eclipse.tm.internal.tcf.cdt.ui.breakpoints;
-
-import org.eclipse.cdt.debug.core.model.ICBreakpoint;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.tm.internal.tcf.debug.model.ITCFConstants;
-import org.eclipse.ui.dialogs.PropertyPage;
-
-/**
- * Property page to define the scope of a breakpoint.
- */
-public class TCFBreakpointThreadFilterPage extends PropertyPage {
-
- private TCFThreadFilterEditor fThreadFilterEditor;
-
- @Override
- protected Control createContents(Composite parent) {
- noDefaultAndApplyButton();
- Composite mainComposite = new Composite(parent, SWT.NONE);
- mainComposite.setFont(parent.getFont());
- mainComposite.setLayout(new GridLayout());
- mainComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
- createThreadFilterEditor(mainComposite);
- setValid(true);
- return mainComposite;
- }
-
- protected ICBreakpoint getBreakpoint() {
- return (ICBreakpoint) getElement().getAdapter(ICBreakpoint.class);
- }
-
- protected TCFBreakpointScopeExtension getFilterExtension() {
- ICBreakpoint bp = getBreakpoint();
- if (bp != null) {
- try {
- TCFBreakpointScopeExtension filter =
- (TCFBreakpointScopeExtension) bp.getExtension(
- ITCFConstants.ID_TCF_DEBUG_MODEL, TCFBreakpointScopeExtension.class);
- filter.initialize(bp);
- return filter;
- } catch (CoreException e) {
- // potential race condition: ignore
- }
- }
- return null;
- }
-
- protected void createThreadFilterEditor(Composite parent) {
- fThreadFilterEditor = new TCFThreadFilterEditor(parent, this);
- }
-
- protected TCFThreadFilterEditor getThreadFilterEditor() {
- return fThreadFilterEditor;
- }
-
- @Override
- public boolean performOk() {
- doStore();
- return super.performOk();
- }
-
- /**
- * Stores the values configured in this page.
- */
- protected void doStore() {
- fThreadFilterEditor.doStore();
- }
-}
diff --git a/plugins/org.eclipse.tm.tcf.cdt.ui/src/org/eclipse/tm/internal/tcf/cdt/ui/breakpoints/TCFThreadFilterEditor.java b/plugins/org.eclipse.tm.tcf.cdt.ui/src/org/eclipse/tm/internal/tcf/cdt/ui/breakpoints/TCFThreadFilterEditor.java
deleted file mode 100644
index e48fb7ca3..000000000
--- a/plugins/org.eclipse.tm.tcf.cdt.ui/src/org/eclipse/tm/internal/tcf/cdt/ui/breakpoints/TCFThreadFilterEditor.java
+++ /dev/null
@@ -1,466 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2011 QNX Software Systems and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * QNX Software Systems - Initial API and implementation
- * Wind River Systems - Adapted to TCF
- *******************************************************************************/
-package org.eclipse.tm.internal.tcf.cdt.ui.breakpoints;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.debug.core.DebugPlugin;
-import org.eclipse.debug.core.ILaunch;
-import org.eclipse.debug.core.ILaunchConfiguration;
-import org.eclipse.debug.core.ILaunchManager;
-import org.eclipse.debug.ui.DebugUITools;
-import org.eclipse.debug.ui.IDebugUIConstants;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.CheckStateChangedEvent;
-import org.eclipse.jface.viewers.CheckboxTreeViewer;
-import org.eclipse.jface.viewers.ICheckStateListener;
-import org.eclipse.jface.viewers.ITreeContentProvider;
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.tm.internal.tcf.cdt.ui.ImageCache;
-import org.eclipse.tm.internal.tcf.debug.model.TCFLaunch;
-import org.eclipse.tm.internal.tcf.debug.ui.model.TCFChildren;
-import org.eclipse.tm.internal.tcf.debug.ui.model.TCFModel;
-import org.eclipse.tm.internal.tcf.debug.ui.model.TCFModelManager;
-import org.eclipse.tm.internal.tcf.debug.ui.model.TCFNode;
-import org.eclipse.tm.internal.tcf.debug.ui.model.TCFNodeExecContext;
-import org.eclipse.tm.tcf.services.IRunControl;
-import org.eclipse.tm.tcf.util.TCFDataCache;
-import org.eclipse.tm.tcf.util.TCFTask;
-
-public class TCFThreadFilterEditor {
-
- private static class Context {
- private final String fName;
- private final String fId;
- private final String fParentId;
- private final boolean fIsContainer;
- private final String fScopeId;
- private final String fSessionId;
-
- Context(IRunControl.RunControlContext ctx, Context parent) {
- this(ctx, parent.fSessionId);
- }
- Context(IRunControl.RunControlContext ctx, String sessionId) {
- String name = ctx.getName() != null ? ctx.getName() : ctx.getID();
- fName = name;
- fSessionId = sessionId;
- fScopeId = sessionId != null ? sessionId + '/' + ctx.getID() : ctx.getID();
- fId = ctx.getID();
- fParentId = ctx.getParentID();
- fIsContainer = ctx.isContainer();
- }
- }
-
- public class CheckHandler implements ICheckStateListener {
- public void checkStateChanged(CheckStateChangedEvent event) {
- Object element = event.getElement();
- boolean checked = event.getChecked();
- if (checked) {
- getThreadViewer().expandToLevel(element, 1);
- }
- if (element instanceof Context) {
- Context ctx = (Context) element;
- checkContext(ctx, checked);
- updateParentCheckState(ctx);
- } else if (element instanceof ILaunch) {
- checkLaunch((ILaunch) element, checked);
- }
- }
-
- private void checkLaunch(ILaunch launch, boolean checked) {
- getThreadViewer().setChecked(launch, checked);
- getThreadViewer().setGrayed(launch, false);
- Context[] threads = syncGetContainers((TCFLaunch) launch);
- for (int i = 0; i < threads.length; i++) {
- checkContext(threads[i], checked);
- }
- }
-
- /**
- * Check or uncheck a context in the tree viewer. When a container
- * is checked, attempt to check all of the containers threads by
- * default. When a container is unchecked, uncheck all its threads.
- */
- private void checkContext(Context ctx, boolean checked) {
- if (ctx.fIsContainer) {
- Context[] threads = syncGetThreads(ctx);
- for (int i = 0; i < threads.length; i++) {
- checkContext(threads[i], checked);
- }
- }
- checkThread(ctx, checked);
- }
-
- /**
- * Check or uncheck a thread.
- */
- private void checkThread(Context thread, boolean checked) {
- getThreadViewer().setChecked(thread, checked);
- getThreadViewer().setGrayed(thread, false);
- }
-
- private void updateParentCheckState(Context thread) {
- Context[] threads;
- Object parent = getContainer(thread);
- if (parent == null) {
- parent = getLaunch(thread);
- if (parent == null) return;
- threads = syncGetContainers((TCFLaunch) parent);
- } else {
- threads = syncGetThreads((Context) parent);
- }
- int checkedNumber = 0;
- int grayedNumber = 0;
- for (int i = 0; i < threads.length; i++) {
- if (getThreadViewer().getGrayed(threads[i])) {
- ++grayedNumber;
- } else if (getThreadViewer().getChecked(threads[i])) {
- ++checkedNumber;
- }
- }
- if (checkedNumber + grayedNumber == 0) {
- getThreadViewer().setChecked(parent, false);
- getThreadViewer().setGrayed(parent, false);
- } else if (checkedNumber == threads.length) {
- getThreadViewer().setChecked(parent, true);
- getThreadViewer().setGrayed(parent, false);
- } else {
- getThreadViewer().setGrayChecked(parent, true);
- }
- if (parent instanceof Context) {
- updateParentCheckState((Context) parent);
- }
- }
- }
-
- public class ThreadFilterContentProvider implements ITreeContentProvider {
-
- public Object[] getChildren(Object parent) {
- if (parent instanceof Context) {
- return syncGetThreads((Context) parent);
- }
- if (parent instanceof ILaunch) {
- return syncGetContainers((TCFLaunch) parent);
- }
- if (parent instanceof ILaunchManager) {
- return getLaunches();
- }
- return new Object[0];
- }
-
- public Object getParent(Object element) {
- if (element instanceof Context) {
- Context ctx = (Context) element;
- if (ctx.fParentId == null) {
- return DebugPlugin.getDefault().getLaunchManager();
- } else {
- return getContainer(ctx);
- }
- }
- return null;
- }
-
- public boolean hasChildren(Object element) {
- return getChildren(element).length > 0;
- }
-
- public Object[] getElements(Object inputElement) {
- return getChildren(inputElement);
- }
-
- public void dispose() {
- }
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- }
- }
-
- public class ThreadFilterLabelProvider extends LabelProvider {
-
- @Override
- public Image getImage(Object element) {
- if (element instanceof Context) {
- Context ctx = (Context) element;
- if (ctx.fIsContainer) {
- return DebugUITools.getImage(IDebugUIConstants.IMG_OBJS_DEBUG_TARGET);
- } else {
- return DebugUITools.getImage(IDebugUIConstants.IMG_OBJS_THREAD_RUNNING);
- }
- }
- if (element instanceof ILaunch) {
- ImageDescriptor desc = DebugUITools.getDefaultImageDescriptor(element);
- if (desc != null) return ImageCache.getImage(desc);
- }
- return null;
- }
-
- @Override
- public String getText(Object element) {
- if (element instanceof Context) {
- Context ctx = (Context) element;
- return ctx.fName;
- }
- if (element instanceof ILaunch) {
- ILaunchConfiguration config = ((ILaunch) element).getLaunchConfiguration();
- if (config != null) return config.getName();
- }
- return "?";
- }
- }
-
-
- private TCFBreakpointThreadFilterPage fPage;
- private CheckboxTreeViewer fThreadViewer;
- private final ThreadFilterContentProvider fContentProvider;
- private final CheckHandler fCheckHandler;
- private final List<Context> fContexts = new ArrayList<Context>();
- private final Map<TCFLaunch, Context[]> fContainersPerLaunch = new HashMap<TCFLaunch, Context[]>();
- private final Map<Context, Context[]> fContextsPerContainer = new HashMap<Context, Context[]>();
-
- public TCFThreadFilterEditor(Composite parent, TCFBreakpointThreadFilterPage page) {
- fPage = page;
- fContentProvider = new ThreadFilterContentProvider();
- fCheckHandler = new CheckHandler();
- createThreadViewer(parent);
- }
-
- protected TCFBreakpointThreadFilterPage getPage() {
- return fPage;
- }
-
- private void createThreadViewer(Composite parent) {
- Label label = new Label(parent, SWT.NONE);
- label.setText("Restrict to Selected Contexts:"); //$NON-NLS-1$
- label.setFont(parent.getFont());
- label.setLayoutData(new GridData());
- GridData data = new GridData(GridData.FILL_BOTH);
- data.heightHint = 100;
- fThreadViewer = new CheckboxTreeViewer(parent, SWT.BORDER);
- fThreadViewer.addCheckStateListener(fCheckHandler);
- fThreadViewer.getTree().setLayoutData(data);
- fThreadViewer.getTree().setFont(parent.getFont());
- fThreadViewer.setContentProvider(fContentProvider);
- fThreadViewer.setLabelProvider(new ThreadFilterLabelProvider());
- fThreadViewer.setInput(DebugPlugin.getDefault().getLaunchManager());
- setInitialCheckedState();
- }
-
- protected ILaunch[] getLaunches() {
- Object input = fThreadViewer.getInput();
- if (!(input instanceof ILaunchManager)) {
- return new ILaunch[0];
- }
- List<ILaunch> tcfLaunches = new ArrayList<ILaunch>();
- ILaunch[] launches = ((ILaunchManager) input).getLaunches();
- for (int i = 0; i < launches.length; i++) {
- ILaunch launch = launches[i];
- if (launch instanceof TCFLaunch && !launch.isTerminated()) {
- tcfLaunches.add(launch);
- }
- }
- return tcfLaunches.toArray(new ILaunch[tcfLaunches.size()]);
- }
-
- /**
- * Returns the root contexts that appear in the tree
- */
- protected Context[] getRootContexts() {
- Object input = fThreadViewer.getInput();
- if (!(input instanceof ILaunchManager)) {
- return new Context[0];
- }
- List<Object> targets = new ArrayList<Object>();
- ILaunch[] launches = ((ILaunchManager) input).getLaunches();
- for (int i = 0; i < launches.length; i++) {
- ILaunch launch = launches[i];
- if (launch instanceof TCFLaunch && !launch.isTerminated()) {
- Context[] targetArray = syncGetContainers((TCFLaunch) launch);
- targets.addAll(Arrays.asList(targetArray));
- }
- }
- return targets.toArray(new Context[targets.size()]);
- }
-
- protected final CheckboxTreeViewer getThreadViewer() {
- return fThreadViewer;
- }
-
- /**
- * Sets the initial checked state of the tree viewer. The initial state
- * should reflect the current state of the breakpoint. If the breakpoint has
- * a thread filter in a given thread, that thread should be checked.
- */
- protected void setInitialCheckedState() {
- TCFBreakpointScopeExtension filterExtension = fPage.getFilterExtension();
- if (filterExtension == null) {
- return;
- }
- String[] ctxIds = filterExtension.getThreadFilters();
-
- // expand all to realize tree items
- getThreadViewer().expandAll();
-
- if (ctxIds == null) {
- ILaunch[] launches = getLaunches();
- for (ILaunch launch : launches) {
- fCheckHandler.checkLaunch(launch, true);
- }
- } else if (ctxIds.length != 0) {
- for (int i = 0; i < ctxIds.length; i++) {
- String id = ctxIds[i];
- Context ctx = getContext(id);
- if (ctx != null) {
- fCheckHandler.checkContext(ctx, true);
- fCheckHandler.updateParentCheckState(ctx);
- } else if (id.indexOf('/') < 0) {
- for (Context context : fContexts) {
- if (id.equals(context.fId)) {
- fCheckHandler.checkContext(context, true);
- fCheckHandler.updateParentCheckState(context);
- }
- }
- }
- }
- }
- // expand checked items only
- getThreadViewer().setExpandedElements(getThreadViewer().getCheckedElements());
- }
-
- private Context getContainer(Context child) {
- String parentId = child.fSessionId != null ? child.fSessionId + '/' + child.fParentId : child.fParentId;
- return getContext(parentId);
- }
-
- private Context getContext(String id) {
- for (Context ctx : fContexts) {
- if (ctx.fScopeId.equals(id))
- return ctx;
- }
- return null;
- }
-
- protected void doStore() {
- CheckboxTreeViewer viewer = getThreadViewer();
- Object[] elements = viewer.getCheckedElements();
- String[] threadIds;
- List<String> checkedIds = new ArrayList<String>();
- for (int i = 0; i < elements.length; ++i) {
- if (elements[i] instanceof Context) {
- Context ctx = (Context) elements[i];
- if (!viewer.getGrayed(ctx)) {
- checkedIds.add(ctx.fScopeId);
- }
- }
- }
- if (checkedIds.size() == fContexts.size()) {
- threadIds = null;
- } else {
- threadIds = checkedIds.toArray(new String[checkedIds.size()]);
- }
- TCFBreakpointScopeExtension filterExtension = fPage.getFilterExtension();
- if (filterExtension == null) {
- return;
- }
- filterExtension.setThreadFilter(threadIds);
- DebugPlugin.getDefault().getBreakpointManager().fireBreakpointChanged(fPage.getBreakpoint());
- }
-
- private Context[] syncGetContainers(final TCFLaunch launch) {
- Context[] result = fContainersPerLaunch.get(launch);
- if (result != null) {
- return result;
- }
- final String launchCfgName = launch.getLaunchConfiguration().getName();
- result = new TCFTask<Context[]>(launch.getChannel()) {
- public void run() {
- List<Context> containers = new ArrayList<Context>();
- TCFModel model = TCFModelManager.getModelManager().getModel(launch);
- TCFChildren children = model.getRootNode().getChildren();
- if (!children.validate(this)) return;
- Map<String, TCFNode> childMap = children.getData();
- for (TCFNode node : childMap.values()) {
- if (node instanceof TCFNodeExecContext) {
- TCFNodeExecContext exeCtx = (TCFNodeExecContext) node;
- TCFDataCache<IRunControl.RunControlContext> runCtxCache = exeCtx.getRunContext();
- if (!runCtxCache.validate(this)) return;
- IRunControl.RunControlContext runCtx = runCtxCache.getData();
- containers.add(new Context(runCtx, launchCfgName));
- }
- }
- done(containers.toArray(new Context[containers.size()]));
- }
- }.getE();
- fContexts.addAll(Arrays.asList(result));
- fContainersPerLaunch.put(launch, result);
- return result;
- }
-
- private Context[] syncGetThreads(final Context container) {
- Context[] result = fContextsPerContainer.get(container);
- if (result != null) {
- return result;
- }
- final TCFLaunch launch = getLaunch(container);
- result = new TCFTask<Context[]>(launch.getChannel()) {
- public void run() {
- List<Context> contexts = new ArrayList<Context>();
- TCFModel model = TCFModelManager.getModelManager().getModel(launch);
- TCFChildren children = ((TCFNodeExecContext) model.getNode(container.fId)).getChildren();
- if (!children.validate(this)) return;
- Collection<TCFNode> childNodes = children.getData().values();
- TCFNode[] nodes = childNodes.toArray(new TCFNode[childNodes.size()]);
- Arrays.sort(nodes);
- for (TCFNode node : nodes) {
- if (node instanceof TCFNodeExecContext) {
- TCFNodeExecContext exeCtx = (TCFNodeExecContext) node;
- TCFDataCache<IRunControl.RunControlContext> runCtxCache = exeCtx.getRunContext();
- if (!runCtxCache.validate(this)) return;
- IRunControl.RunControlContext runCtx = runCtxCache.getData();
- contexts.add(new Context(runCtx, container));
- }
- }
- done(contexts.toArray(new Context[contexts.size()]));
- }
- }.getE();
- fContextsPerContainer.put(container, result);
- fContexts.addAll(Arrays.asList(result));
- return result;
- }
-
- private TCFLaunch getLaunch(Context container) {
- Context parent = getContainer(container);
- while (parent != null) {
- container = parent;
- parent = getContainer(container);
- }
- for (TCFLaunch launch : fContainersPerLaunch.keySet()) {
- Context[] containers = fContainersPerLaunch.get(launch);
- for (Context context : containers) {
- if (context.fScopeId.equals(container.fScopeId)) {
- return launch;
- }
- }
- }
- return null;
- }
-
-}
diff --git a/plugins/org.eclipse.tm.tcf.cdt.ui/src/org/eclipse/tm/internal/tcf/cdt/ui/breakpoints/TCFWatchpointTarget.java b/plugins/org.eclipse.tm.tcf.cdt.ui/src/org/eclipse/tm/internal/tcf/cdt/ui/breakpoints/TCFWatchpointTarget.java
deleted file mode 100644
index 2807f3611..000000000
--- a/plugins/org.eclipse.tm.tcf.cdt.ui/src/org/eclipse/tm/internal/tcf/cdt/ui/breakpoints/TCFWatchpointTarget.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Wind River Systems, Inc. and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipse.tm.internal.tcf.cdt.ui.breakpoints;
-
-import org.eclipse.cdt.debug.internal.core.ICWatchpointTarget;
-import org.eclipse.tm.internal.tcf.debug.ui.model.TCFNodeExpression;
-import org.eclipse.tm.tcf.protocol.Protocol;
-import org.eclipse.tm.tcf.services.ISymbols;
-import org.eclipse.tm.tcf.util.TCFDataCache;
-import org.eclipse.tm.tcf.util.TCFTask;
-
-/**
- * TCF "Add Watchpoint" target implementation.
- */
-@SuppressWarnings("restriction")
-public class TCFWatchpointTarget implements ICWatchpointTarget {
-
- private final TCFNodeExpression fNode;
-
- public TCFWatchpointTarget(TCFNodeExpression node) {
- fNode = node;
- }
-
- public void canSetWatchpoint(CanCreateWatchpointRequest request) {
- request.setCanCreate(true);
- request.done();
- }
-
- public String getExpression() {
- final TCFDataCache<String> expressionText = fNode.getExpressionText();
- String expr = new TCFTask<String>(fNode.getChannel()) {
- public void run() {
- if (!expressionText.validate(this)) return;
- done(expressionText.getData());
- }
- }.getE();
- return expr != null ? expr : "";
- }
-
- public void getSize(final GetSizeRequest request) {
- final TCFDataCache<ISymbols.Symbol> expressionType = fNode.getType();
- Protocol.invokeLater(new Runnable() {
- public void run() {
- if (!expressionType.validate(this)) return;
- ISymbols.Symbol type = expressionType.getData();
- request.setSize(type != null ? type.getSize() : 1);
- request.done();
- }
- });
- }
-}
diff --git a/plugins/org.eclipse.tm.tcf.cdt.ui/src/org/eclipse/tm/internal/tcf/cdt/ui/commands/AddFunctionBreakointHandler.java b/plugins/org.eclipse.tm.tcf.cdt.ui/src/org/eclipse/tm/internal/tcf/cdt/ui/commands/AddFunctionBreakointHandler.java
deleted file mode 100644
index 5b8375455..000000000
--- a/plugins/org.eclipse.tm.tcf.cdt.ui/src/org/eclipse/tm/internal/tcf/cdt/ui/commands/AddFunctionBreakointHandler.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Wind River Systems, Inc. and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipse.tm.internal.tcf.cdt.ui.commands;
-
-import org.eclipse.cdt.debug.core.CDIDebugModel;
-import org.eclipse.cdt.debug.core.model.ICBreakpointType;
-import org.eclipse.core.commands.AbstractHandler;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.resources.WorkspaceJob;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.jface.dialogs.InputDialog;
-import org.eclipse.jface.window.Window;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.handlers.HandlerUtil;
-
-/**
- * Command handler to add a CDT function breakpoint on an arbitrary symbol.
- */
-public class AddFunctionBreakointHandler extends AbstractHandler {
-
- private static class AddFunctionBreakpointDialog extends InputDialog {
- public AddFunctionBreakpointDialog(Shell parentShell, String initialValue) {
- super(parentShell, "Add Function Breakpoint", "Enter symbol:", initialValue, null);
- }
- }
-
- public Object execute(ExecutionEvent event) throws ExecutionException {
- Shell shell = HandlerUtil.getActiveShell(event);
- AddFunctionBreakpointDialog dialog = new AddFunctionBreakpointDialog(shell, "");
- if (dialog.open() == Window.OK) {
- final String symbol = dialog.getValue();
- Job job = new WorkspaceJob("Create Function Breakpoint") {
- @Override
- public IStatus runInWorkspace(IProgressMonitor monitor) throws CoreException {
- IResource resource = ResourcesPlugin.getWorkspace().getRoot();
- CDIDebugModel.createFunctionBreakpoint(
- null,
- resource,
- ICBreakpointType.REGULAR,
- symbol,
- -1,
- -1,
- -1,
- true,
- -1,
- null,
- true);
- return Status.OK_STATUS;
- }
- };
- job.setSystem(true);
- job.setPriority(Job.SHORT);
- job.schedule();
- }
- return null;
- }
-
-}
diff --git a/plugins/org.eclipse.tm.tcf.cdt.ui/src/org/eclipse/tm/internal/tcf/cdt/ui/commands/AddWatchpointHandler.java b/plugins/org.eclipse.tm.tcf.cdt.ui/src/org/eclipse/tm/internal/tcf/cdt/ui/commands/AddWatchpointHandler.java
deleted file mode 100644
index 827923ddd..000000000
--- a/plugins/org.eclipse.tm.tcf.cdt.ui/src/org/eclipse/tm/internal/tcf/cdt/ui/commands/AddWatchpointHandler.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Wind River Systems, Inc. and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.tm.internal.tcf.cdt.ui.commands;
-
-import java.math.BigInteger;
-
-import org.eclipse.cdt.debug.core.CDIDebugModel;
-import org.eclipse.cdt.debug.internal.ui.actions.AddWatchpointDialog;
-import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
-import org.eclipse.core.commands.AbstractHandler;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jface.text.ITextSelection;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.window.Window;
-import org.eclipse.ui.handlers.HandlerUtil;
-
-@SuppressWarnings("restriction")
-public class AddWatchpointHandler extends AbstractHandler {
- public Object execute(ExecutionEvent event) throws ExecutionException {
- ISelection selection = HandlerUtil.getCurrentSelection(event);
- String expr = null;
- if (selection instanceof ITextSelection) {
- expr = ((ITextSelection) selection).getText();
- }
- AddWatchpointDialog dlg = new AddWatchpointDialog(HandlerUtil.getActiveShell(event), null);
- dlg.setExpression(expr);
- if (dlg.open() == Window.OK) {
- addWatchpoint(dlg.getWriteAccess(), dlg.getReadAccess(), dlg.getExpression(), dlg.getMemorySpace(), dlg.getRange());
- }
- return null;
- }
-
- private void addWatchpoint(boolean write, boolean read, String expression, String memorySpace, BigInteger range) {
- IResource resource = ResourcesPlugin.getWorkspace().getRoot();
- try {
- CDIDebugModel.createWatchpoint("", resource, write, read, expression, memorySpace, range, true, 0, "", true); //$NON-NLS-1$
- }
- catch(CoreException ce) {
- CDebugUIPlugin.errorDialog("Cannot add watchpoint.", ce);
- }
- }
-}
diff --git a/plugins/org.eclipse.tm.tcf.cdt.ui/src/org/eclipse/tm/internal/tcf/cdt/ui/commands/TCFPinViewCommand.java b/plugins/org.eclipse.tm.tcf.cdt.ui/src/org/eclipse/tm/internal/tcf/cdt/ui/commands/TCFPinViewCommand.java
deleted file mode 100644
index 24f72e72f..000000000
--- a/plugins/org.eclipse.tm.tcf.cdt.ui/src/org/eclipse/tm/internal/tcf/cdt/ui/commands/TCFPinViewCommand.java
+++ /dev/null
@@ -1,274 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Wind River Systems, Inc. and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.tm.internal.tcf.cdt.ui.commands;
-
-import java.util.ArrayList;
-import java.util.Map;
-
-import org.eclipse.cdt.debug.ui.IPinProvider;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext;
-import org.eclipse.debug.internal.ui.viewers.model.provisional.ILabelUpdate;
-import org.eclipse.debug.internal.ui.viewers.model.provisional.PresentationContext;
-import org.eclipse.debug.ui.IDebugUIConstants;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.TreePath;
-import org.eclipse.swt.graphics.FontData;
-import org.eclipse.swt.graphics.RGB;
-import org.eclipse.tm.internal.tcf.debug.ui.model.TCFModel;
-import org.eclipse.tm.internal.tcf.debug.ui.model.TCFNode;
-import org.eclipse.tm.internal.tcf.debug.ui.model.TCFNodeExecContext;
-import org.eclipse.tm.internal.tcf.debug.ui.model.TCFNodeStackFrame;
-import org.eclipse.tm.tcf.services.IRunControl;
-import org.eclipse.tm.tcf.util.TCFDataCache;
-import org.eclipse.tm.tcf.util.TCFTask;
-import org.eclipse.ui.IWorkbenchPart;
-
-@SuppressWarnings("restriction")
-public class TCFPinViewCommand implements IPinProvider {
-
- private final TCFModel model;
- private final ArrayList<PinnedView> list = new ArrayList<PinnedView>();
-
- private class PinnedView implements IPinElementHandle {
-
- @SuppressWarnings("unused")
- private final IPinModelListener listener;
- @SuppressWarnings("unused")
- private final IWorkbenchPart part;
- private final TCFNode node;
- private final IPresentationContext ctx;
-
- final IRunControl.RunControlListener rc_listener = new IRunControl.RunControlListener() {
-
- public void contextAdded(IRunControl.RunControlContext[] contexts) {
- }
-
- public void contextChanged(IRunControl.RunControlContext[] contexts) {
- for (IRunControl.RunControlContext ctx : contexts) {
- if (node.getID().equals(ctx.getID())) updateLabel();
- }
- }
-
- public void contextRemoved(String[] context_ids) {
- for (String id : context_ids) {
- if (node.getID().equals(id)) updateLabel();
- }
- }
-
- public void contextSuspended(String id, String pc, String reason, Map<String, Object> params) {
- if (node.getID().equals(id)) updateLabel();
- }
-
- public void contextResumed(String id) {
- if (node.getID().equals(id)) updateLabel();
- }
-
- public void containerSuspended(String context, String pc, String reason, Map<String, Object> params, String[] suspended_ids) {
- for (String id : suspended_ids) {
- if (node.getID().equals(id)) updateLabel();
- }
- }
-
- public void containerResumed(String[] context_ids) {
- for (String id : context_ids) {
- if (node.getID().equals(id)) updateLabel();
- }
- }
-
- public void contextException(String id, String msg) {
- if (node.getID().equals(id)) updateLabel();
- }
- };
-
- PinnedView(IWorkbenchPart part, TCFNode node, IPinModelListener listener) {
- this.part = part;
- this.node = node;
- this.listener = listener;
- ctx = new PresentationContext(TCFModel.ID_PINNED_VIEW, part);
- IRunControl rc = model.getChannel().getRemoteService(IRunControl.class);
- if (rc != null) rc.addListener(rc_listener);
- }
-
- void updateLabel() {
- // TODO: CDT does not support label update
- /*
- model.getDisplay().asyncExec(new Runnable() {
- public void run() {
- listener.modelChanged(new StructuredSelection(node));
- }
- });
- */
- }
-
- void dispose() {
- IRunControl rc = model.getChannel().getRemoteService(IRunControl.class);
- if (rc != null) rc.removeListener(rc_listener);
- }
-
- public Object getDebugContext() {
- return node;
- }
-
- public String getLabel() {
- return new TCFTask<String>() {
- public void run() {
- model.update(new ILabelUpdate[]{ new ILabelUpdate() {
-
- String text;
-
- public IPresentationContext getPresentationContext() {
- return ctx;
- }
-
- public Object getElement() {
- return node;
- }
-
- public TreePath getElementPath() {
- return null;
- }
-
- public Object getViewerInput() {
- return null;
- }
-
- public void setStatus(IStatus status) {
- }
-
- public IStatus getStatus() {
- return null;
- }
-
- public void done() {
- done_update(text);
- }
-
- public void cancel() {
- }
-
- public boolean isCanceled() {
- return false;
- }
-
- public String[] getColumnIds() {
- return null;
- }
-
- public void setLabel(String text, int columnIndex) {
- if (columnIndex == 0) this.text = text;
- }
-
- public void setFontData(FontData fontData, int columnIndex) {
- }
-
- public void setImageDescriptor(ImageDescriptor image, int columnIndex) {
- }
-
- public void setForeground(RGB foreground, int columnIndex) {
- }
-
- public void setBackground(RGB background, int columnIndex) {
- }
- }});
- }
-
- private void done_update(String text) {
- if (text == null) text = node.getID();
- done(text);
- }
- }.getE();
- }
-
- public IPinElementColorDescriptor getPinElementColorDescriptor() {
- return null;
- }
- }
-
- public TCFPinViewCommand(TCFModel model) {
- this.model = model;
- }
-
- public boolean isPinnable(IWorkbenchPart part, final Object obj) {
- if (obj instanceof TCFNode) {
- try {
- final String id = part.getSite().getId();
- return new TCFTask<Boolean>(model.getChannel()) {
- public void run() {
- boolean mem = false;
- boolean vars = false;
- if (obj instanceof TCFNodeExecContext) {
- TCFNodeExecContext node = (TCFNodeExecContext)obj;
- TCFDataCache<IRunControl.RunControlContext> ctx_cache = node.getRunContext();
- if (!ctx_cache.validate(this)) return;
- IRunControl.RunControlContext ctx_data = ctx_cache.getData();
- if (ctx_data != null) {
- vars = ctx_data.hasState();
- mem = vars || ctx_data.getProcessID() != null;
- }
- }
- if (obj instanceof TCFNodeStackFrame) {
- vars = true;
- mem = true;
- }
- if (IDebugUIConstants.ID_REGISTER_VIEW.equals(id)) done(vars);
- else if (IDebugUIConstants.ID_VARIABLE_VIEW.equals(id)) done(vars);
- else if (IDebugUIConstants.ID_EXPRESSION_VIEW.equals(id)) done(mem);
- else done(false);
- }
- }.getE();
- }
- catch (Throwable x) {
- return false;
- }
- }
- return false;
- }
-
- public IPinElementHandle pin(final IWorkbenchPart part, Object obj, final IPinModelListener listener) {
- if (obj instanceof TCFNode) {
- final TCFNode node = (TCFNode)obj;
- return new TCFTask<IPinElementHandle>() {
- public void run() {
- PinnedView p = new PinnedView(part, node, listener);
- model.setPin(part, node);
- list.add(p);
- done(p);
- }
- }.getE();
- }
- return null;
- }
-
- public void unpin(final IWorkbenchPart part, final IPinElementHandle handle) {
- new TCFTask<Object>() {
- public void run() {
- model.setPin(part, null);
- if (list.remove(handle)) {
- ((PinnedView)handle).dispose();
- }
- done(null);
- }
- };
- }
-
- public boolean isPinnedTo(Object obj, final IPinElementHandle handle) {
- if (obj instanceof TCFNode) {
- return new TCFTask<Boolean>() {
- public void run() {
- done(list.contains(handle));
- }
- }.getE();
- }
- return false;
- }
-}
diff --git a/plugins/org.eclipse.tm.tcf.cdt.ui/src/org/eclipse/tm/internal/tcf/cdt/ui/commands/TCFReverseDebuggingPropertyTester.java b/plugins/org.eclipse.tm.tcf.cdt.ui/src/org/eclipse/tm/internal/tcf/cdt/ui/commands/TCFReverseDebuggingPropertyTester.java
deleted file mode 100644
index 9d8b079a3..000000000
--- a/plugins/org.eclipse.tm.tcf.cdt.ui/src/org/eclipse/tm/internal/tcf/cdt/ui/commands/TCFReverseDebuggingPropertyTester.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 Wind River Systems, Inc. and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipse.tm.internal.tcf.cdt.ui.commands;
-
-import org.eclipse.core.expressions.PropertyTester;
-
-
-/**
- * Tester for property "org.eclipse.cdt.debug.ui.isReverseDebuggingEnabled"
- * to enable reverse run control actions.
- */
-public class TCFReverseDebuggingPropertyTester extends PropertyTester {
-
- public boolean test(Object receiver, String property, Object[] args, Object expectedValue) {
- // TODO should be queried from target
- return true;
- }
-
-}
diff --git a/plugins/org.eclipse.tm.tcf.cdt.ui/src/org/eclipse/tm/internal/tcf/cdt/ui/commands/TCFReverseResumeCommand.java b/plugins/org.eclipse.tm.tcf.cdt.ui/src/org/eclipse/tm/internal/tcf/cdt/ui/commands/TCFReverseResumeCommand.java
deleted file mode 100644
index 232f44515..000000000
--- a/plugins/org.eclipse.tm.tcf.cdt.ui/src/org/eclipse/tm/internal/tcf/cdt/ui/commands/TCFReverseResumeCommand.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 Wind River Systems, Inc. and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipse.tm.internal.tcf.cdt.ui.commands;
-
-import org.eclipse.cdt.debug.core.model.IReverseResumeHandler;
-import org.eclipse.tm.internal.tcf.debug.ui.commands.BackResumeCommand;
-import org.eclipse.tm.internal.tcf.debug.ui.model.TCFModel;
-
-/**
- * Debug command handler for reverse resume.
- */
-public class TCFReverseResumeCommand extends BackResumeCommand
- implements IReverseResumeHandler {
-
- public TCFReverseResumeCommand(TCFModel model) {
- super(model);
- }
-}
diff --git a/plugins/org.eclipse.tm.tcf.cdt.ui/src/org/eclipse/tm/internal/tcf/cdt/ui/commands/TCFReverseStepIntoCommand.java b/plugins/org.eclipse.tm.tcf.cdt.ui/src/org/eclipse/tm/internal/tcf/cdt/ui/commands/TCFReverseStepIntoCommand.java
deleted file mode 100644
index bdf1affea..000000000
--- a/plugins/org.eclipse.tm.tcf.cdt.ui/src/org/eclipse/tm/internal/tcf/cdt/ui/commands/TCFReverseStepIntoCommand.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 Wind River Systems, Inc. and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipse.tm.internal.tcf.cdt.ui.commands;
-
-import org.eclipse.cdt.debug.core.model.IReverseStepIntoHandler;
-import org.eclipse.tm.internal.tcf.debug.ui.commands.BackIntoCommand;
-import org.eclipse.tm.internal.tcf.debug.ui.model.TCFModel;
-
-/**
- * Debug command handler for reverse step into.
- */
-public class TCFReverseStepIntoCommand extends BackIntoCommand
- implements IReverseStepIntoHandler {
-
- public TCFReverseStepIntoCommand(TCFModel model) {
- super(model);
- }
-}
diff --git a/plugins/org.eclipse.tm.tcf.cdt.ui/src/org/eclipse/tm/internal/tcf/cdt/ui/commands/TCFReverseStepOverCommand.java b/plugins/org.eclipse.tm.tcf.cdt.ui/src/org/eclipse/tm/internal/tcf/cdt/ui/commands/TCFReverseStepOverCommand.java
deleted file mode 100644
index e15c81544..000000000
--- a/plugins/org.eclipse.tm.tcf.cdt.ui/src/org/eclipse/tm/internal/tcf/cdt/ui/commands/TCFReverseStepOverCommand.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 Wind River Systems, Inc. and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipse.tm.internal.tcf.cdt.ui.commands;
-
-import org.eclipse.cdt.debug.core.model.IReverseStepOverHandler;
-import org.eclipse.tm.internal.tcf.debug.ui.commands.BackOverCommand;
-import org.eclipse.tm.internal.tcf.debug.ui.model.TCFModel;
-
-/**
- * Debug command handler for reverse step over.
- */
-public class TCFReverseStepOverCommand extends BackOverCommand
- implements IReverseStepOverHandler {
-
- public TCFReverseStepOverCommand(TCFModel model) {
- super(model);
- }
-}
diff --git a/plugins/org.eclipse.tm.tcf.cdt.ui/src/org/eclipse/tm/internal/tcf/cdt/ui/commands/TCFReverseStepReturnCommand.java b/plugins/org.eclipse.tm.tcf.cdt.ui/src/org/eclipse/tm/internal/tcf/cdt/ui/commands/TCFReverseStepReturnCommand.java
deleted file mode 100644
index 93358ad31..000000000
--- a/plugins/org.eclipse.tm.tcf.cdt.ui/src/org/eclipse/tm/internal/tcf/cdt/ui/commands/TCFReverseStepReturnCommand.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 Wind River Systems, Inc. and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipse.tm.internal.tcf.cdt.ui.commands;
-
-import org.eclipse.cdt.debug.core.model.IUncallHandler;
-import org.eclipse.tm.internal.tcf.debug.ui.commands.BackReturnCommand;
-import org.eclipse.tm.internal.tcf.debug.ui.model.TCFModel;
-
-/**
- * Debug command handler for reverse step return.
- */
-public class TCFReverseStepReturnCommand extends BackReturnCommand
- implements IUncallHandler {
-
- public TCFReverseStepReturnCommand(TCFModel model) {
- super(model);
- }
-}
diff --git a/plugins/org.eclipse.tm.tcf.cdt.ui/src/org/eclipse/tm/internal/tcf/cdt/ui/commands/TCFReverseToggleCommand.java b/plugins/org.eclipse.tm.tcf.cdt.ui/src/org/eclipse/tm/internal/tcf/cdt/ui/commands/TCFReverseToggleCommand.java
deleted file mode 100644
index 6823e8273..000000000
--- a/plugins/org.eclipse.tm.tcf.cdt.ui/src/org/eclipse/tm/internal/tcf/cdt/ui/commands/TCFReverseToggleCommand.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 Wind River Systems, Inc. and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipse.tm.internal.tcf.cdt.ui.commands;
-
-import org.eclipse.cdt.debug.core.model.IReverseToggleHandler;
-import org.eclipse.debug.core.commands.IDebugCommandRequest;
-import org.eclipse.debug.core.commands.IEnabledStateRequest;
-
-/**
- * Toggles enablement for reverse run control support.
- */
-public class TCFReverseToggleCommand implements IReverseToggleHandler {
-
- public void canExecute(IEnabledStateRequest request) {
- request.setEnabled(false);
- request.done();
- }
-
- public boolean execute(IDebugCommandRequest request) {
- return false;
- }
-
- public boolean toggleNeedsUpdating() {
- return true;
- }
-
- public boolean isReverseToggled(Object context) {
- // TODO should be queried from target
- return true;
- }
-
-}
diff --git a/plugins/org.eclipse.tm.tcf.cdt.ui/src/org/eclipse/tm/internal/tcf/cdt/ui/disassembly/TCFDisassemblyBackend.java b/plugins/org.eclipse.tm.tcf.cdt.ui/src/org/eclipse/tm/internal/tcf/cdt/ui/disassembly/TCFDisassemblyBackend.java
deleted file mode 100644
index efcc2812c..000000000
--- a/plugins/org.eclipse.tm.tcf.cdt.ui/src/org/eclipse/tm/internal/tcf/cdt/ui/disassembly/TCFDisassemblyBackend.java
+++ /dev/null
@@ -1,985 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010, 2011 Wind River Systems, Inc. and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipse.tm.internal.tcf.cdt.ui.disassembly;
-
-import static org.eclipse.cdt.debug.internal.ui.disassembly.dsf.DisassemblyUtils.DEBUG;
-
-import java.math.BigInteger;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.eclipse.cdt.debug.internal.ui.disassembly.dsf.AbstractDisassemblyBackend;
-import org.eclipse.cdt.debug.internal.ui.disassembly.dsf.AddressRangePosition;
-import org.eclipse.cdt.debug.internal.ui.disassembly.dsf.DisassemblyUtils;
-import org.eclipse.cdt.debug.internal.ui.disassembly.dsf.ErrorPosition;
-import org.eclipse.cdt.debug.internal.ui.disassembly.dsf.IDisassemblyPartCallback;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.debug.core.DebugPlugin;
-import org.eclipse.debug.core.ILaunch;
-import org.eclipse.debug.core.ILaunchesListener;
-import org.eclipse.jface.dialogs.ErrorDialog;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.text.BadLocationException;
-import org.eclipse.jface.text.IDocumentExtension4;
-import org.eclipse.jface.text.Position;
-import org.eclipse.tm.internal.tcf.cdt.ui.Activator;
-import org.eclipse.tm.internal.tcf.debug.launch.TCFSourceLookupDirector;
-import org.eclipse.tm.internal.tcf.debug.model.TCFContextState;
-import org.eclipse.tm.internal.tcf.debug.model.TCFSourceRef;
-import org.eclipse.tm.internal.tcf.debug.ui.model.TCFChildrenStackTrace;
-import org.eclipse.tm.internal.tcf.debug.ui.model.TCFModel;
-import org.eclipse.tm.internal.tcf.debug.ui.model.TCFNode;
-import org.eclipse.tm.internal.tcf.debug.ui.model.TCFNodeExecContext;
-import org.eclipse.tm.internal.tcf.debug.ui.model.TCFNodeStackFrame;
-import org.eclipse.tm.tcf.protocol.IChannel;
-import org.eclipse.tm.tcf.protocol.IChannel.IChannelListener;
-import org.eclipse.tm.tcf.protocol.IToken;
-import org.eclipse.tm.tcf.protocol.JSON;
-import org.eclipse.tm.tcf.protocol.Protocol;
-import org.eclipse.tm.tcf.services.IDisassembly;
-import org.eclipse.tm.tcf.services.IDisassembly.DoneDisassemble;
-import org.eclipse.tm.tcf.services.IDisassembly.IDisassemblyLine;
-import org.eclipse.tm.tcf.services.IExpressions;
-import org.eclipse.tm.tcf.services.IExpressions.DoneCreate;
-import org.eclipse.tm.tcf.services.IExpressions.DoneDispose;
-import org.eclipse.tm.tcf.services.IExpressions.DoneEvaluate;
-import org.eclipse.tm.tcf.services.IExpressions.Expression;
-import org.eclipse.tm.tcf.services.IExpressions.Value;
-import org.eclipse.tm.tcf.services.ILineNumbers;
-import org.eclipse.tm.tcf.services.ILineNumbers.CodeArea;
-import org.eclipse.tm.tcf.services.ILineNumbers.DoneMapToSource;
-import org.eclipse.tm.tcf.services.IMemory;
-import org.eclipse.tm.tcf.services.IRunControl;
-import org.eclipse.tm.tcf.services.IRunControl.RunControlContext;
-import org.eclipse.tm.tcf.services.IRunControl.RunControlListener;
-import org.eclipse.tm.tcf.services.ISymbols;
-import org.eclipse.tm.tcf.util.TCFDataCache;
-import org.eclipse.tm.tcf.util.TCFTask;
-import org.eclipse.ui.PlatformUI;
-
-@SuppressWarnings("restriction")
-public class TCFDisassemblyBackend extends AbstractDisassemblyBackend {
-
- private static class AddressRange {
- BigInteger start;
- BigInteger end;
- }
- private static class FunctionOffset {
- static final FunctionOffset NONE = new FunctionOffset(null, null);
- String name;
- BigInteger offset;
- FunctionOffset(String name, BigInteger offset) {
- this.name = name;
- this.offset = offset;
- }
- @Override
- public String toString() {
- if (name == null || name.length() == 0) {
- return "";
- }
- if (isZeroOffset()) {
- return name;
- }
- return name + '+' + offset.toString();
- }
- boolean isZeroOffset() {
- return offset == null || offset.compareTo(BigInteger.ZERO) == 0;
- }
- }
- private class TCFLaunchListener implements ILaunchesListener {
-
- public void launchesRemoved(ILaunch[] launches) {
- }
-
- public void launchesAdded(ILaunch[] launches) {
- }
-
- public void launchesChanged(ILaunch[] launches) {
- if(fExecContext == null) {
- return;
- }
- for (ILaunch launch : launches) {
- if (launch == fExecContext.getModel().getLaunch()) {
- if (launch.isTerminated()) {
- handleSessionEnded();
- }
- break;
- }
- }
- }
- }
-
- private class TCFChannelListener implements IChannelListener {
-
- public void onChannelOpened() {
- }
-
- public void onChannelClosed(Throwable error) {
- handleSessionEnded();
- }
-
- public void congestionLevel(int level) {
- }
- }
-
- private class TCFRunControlListener implements RunControlListener {
-
- public void contextAdded(RunControlContext[] contexts) {
- }
-
- public void contextChanged(RunControlContext[] contexts) {
- }
-
- public void contextRemoved(String[] context_ids) {
- String id = fExecContext.getID();
- for (String contextId : context_ids) {
- if (id.equals(contextId)) {
- fCallback.handleTargetEnded();
- return;
- }
- }
- }
-
- public void contextSuspended(String context, String pc, String reason,
- Map<String, Object> params) {
- if (fExecContext.getID().equals(context)) {
- handleContextSuspended(pc != null ? new BigInteger(pc) : null);
- }
- }
-
- public void contextResumed(String context) {
- if (fExecContext.getID().equals(context)) {
- fCallback.handleTargetResumed();
- }
- }
-
- public void containerSuspended(String context, String pc,
- String reason, Map<String, Object> params,
- String[] suspended_ids) {
- String id = fExecContext.getID();
- if (id.equals(context)) {
- handleContextSuspended(pc != null ? new BigInteger(pc) : null);
- return;
- }
- for (String contextId : suspended_ids) {
- if (id.equals(contextId)) {
- handleContextSuspended(null);
- return;
- }
- }
- }
-
- public void containerResumed(String[] context_ids) {
- String id = fExecContext.getID();
- for (String contextId : context_ids) {
- if (id.equals(contextId)) {
- fCallback.handleTargetResumed();
- return;
- }
- }
- }
-
- public void contextException(String context, String msg) {
- }
-
- }
-
- private IDisassemblyPartCallback fCallback;
- private volatile TCFNodeExecContext fExecContext;
- private volatile TCFNodeStackFrame fActiveFrame;
- private volatile BigInteger fSuspendAddress;
- private volatile int fSuspendCount;
-
- private final IRunControl.RunControlListener fRunControlListener = new TCFRunControlListener();
- private final IChannelListener fChannelListener = new TCFChannelListener();
- private final ILaunchesListener fLaunchesListener = new TCFLaunchListener();
-
- @Override
- public void init(IDisassemblyPartCallback callback) {
- fCallback = callback;
- }
-
- public boolean supportsDebugContext(IAdaptable context) {
- return (context instanceof TCFNodeExecContext || context instanceof TCFNodeStackFrame)
- && hasDisassemblyService((TCFNode) context);
- }
-
- private boolean hasDisassemblyService(final TCFNode context) {
- Boolean hasService = new TCFTask<Boolean>() {
- public void run() {
- IDisassembly disass = null;
- IChannel channel = context.getChannel();
- if (channel != null && channel.getState() != IChannel.STATE_CLOSED) {
- disass = channel.getRemoteService(IDisassembly.class);
- }
- done(disass != null);
- }
- }.getE();
- return hasService != null && hasService.booleanValue();
- }
-
- public boolean hasDebugContext() {
- return fExecContext != null;
- }
-
- public SetDebugContextResult setDebugContext(IAdaptable context) {
- TCFNodeExecContext newContext = null;
- TCFNodeStackFrame frame = null;
- SetDebugContextResult result = new SetDebugContextResult();
- if (context instanceof TCFNodeExecContext) {
- newContext = (TCFNodeExecContext) context;
- final TCFNodeExecContext _execContext = newContext;
- frame = new TCFTask<TCFNodeStackFrame>(_execContext.getChannel()) {
- public void run() {
- TCFChildrenStackTrace stack = _execContext.getStackTrace();
- if (!stack.validate(this)) {
- return;
- }
- done(stack.getTopFrame());
- }
- }.getE();
- if (frame == null) {
- newContext = null;
- }
- } else if (context instanceof TCFNodeStackFrame) {
- final TCFNodeStackFrame _frame = frame = (TCFNodeStackFrame) context;
- newContext = new TCFTask<TCFNodeExecContext>(_frame.getChannel()) {
- public void run() {
- TCFNode parent = _frame.getParent();
- if (parent instanceof TCFNodeExecContext) {
- done((TCFNodeExecContext) parent);
- } else {
- done(null);
- }
- }
- }.getE();
- }
- TCFNodeExecContext oldContext = fExecContext;
- if (oldContext == null || newContext == null || oldContext.compareTo(newContext) != 0) {
- result.contextChanged = true;
- fSuspendCount++;
- if (oldContext != null) {
- removeListeners(oldContext);
- }
- }
- fExecContext = newContext;
- if (newContext != null && result.contextChanged) {
- addListeners(newContext);
- }
- fActiveFrame = frame;
- result.sessionId = newContext != null ? newContext.getID() : null;
-
- if (!result.contextChanged && fActiveFrame != null) {
- fCallback.asyncExec(new Runnable() {
- public void run() {
- fCallback.gotoFrameIfActive(getFrameLevel());
- }
- });
- }
-
- return result;
- }
-
- private void addListeners(final TCFNodeExecContext context) {
- assert context != null;
- Protocol.invokeAndWait(new Runnable() {
- public void run() {
- IChannel channel = context.getChannel();
- IRunControl rctl = channel.getRemoteService(IRunControl.class);
- if (rctl != null) {
- rctl.addListener(fRunControlListener);
- }
- channel.addChannelListener(fChannelListener);
- }
- });
- DebugPlugin.getDefault().getLaunchManager().addLaunchListener(fLaunchesListener );
- }
-
- private void removeListeners(final TCFNodeExecContext context) {
- assert context != null;
- DebugPlugin.getDefault().getLaunchManager().removeLaunchListener(fLaunchesListener);
- Protocol.invokeAndWait(new Runnable() {
- public void run() {
- IChannel channel = context.getChannel();
- IRunControl rctl = channel.getRemoteService(IRunControl.class);
- if (rctl != null) {
- rctl.removeListener(fRunControlListener);
- }
- channel.removeChannelListener(fChannelListener);
- }
- });
- }
-
- private void handleContextSuspended(BigInteger pc) {
- ++fSuspendCount;
- fSuspendAddress = pc;
- fCallback.handleTargetSuspended();
- }
- private void handleSessionEnded() {
- clearDebugContext();
- fCallback.handleTargetEnded();
- }
-
- public void clearDebugContext() {
- if (fExecContext != null) {
- removeListeners(fExecContext);
- }
- fExecContext = null;
- fActiveFrame = null;
- }
-
- public void retrieveFrameAddress(final int targetFrame) {
- final TCFNodeExecContext execContext = fExecContext;
- if (execContext == null) {
- fCallback.setUpdatePending(false);
- return;
- }
- BigInteger address;
- if (targetFrame == 0 && fSuspendAddress != null) {
- // shortcut for goto frame on suspend
- address = fSuspendAddress;
- fSuspendAddress = null;
- } else {
- final int suspendCount = fSuspendCount;
- final TCFChildrenStackTrace stack = execContext.getStackTrace();
- address = new TCFTask<BigInteger>(execContext.getChannel()) {
- public void run() {
- if (suspendCount != fSuspendCount || execContext != fExecContext) {
- done(null);
- return;
- }
- if (!stack.validate(this)) {
- return;
- }
- TCFNodeStackFrame frame = null;
- if (targetFrame == 0) {
- frame = stack.getTopFrame();
- } else {
- Map<String,TCFNode> frameData = stack.getData();
- for (TCFNode node : frameData.values()) {
- if (node instanceof TCFNodeStackFrame) {
- TCFNodeStackFrame cand = (TCFNodeStackFrame) node;
- if (cand.getFrameNo() == targetFrame) {
- frame = cand;
- break;
- }
- }
- }
- }
- if (frame != null) {
- TCFDataCache<BigInteger> addressCache = frame.getAddress();
- if (!addressCache.validate(this)) {
- return;
- }
- done(addressCache.getData());
- return;
- }
- done(null);
- }
- }.getE();
- }
-
- if (execContext == fExecContext) {
- fCallback.setUpdatePending(false);
- if (address == null) address = BigInteger.valueOf(-2);
- if (targetFrame == 0) {
- fCallback.updatePC(address);
- }
- else {
- fCallback.gotoFrame(targetFrame, address);
- }
- }
- }
-
- public int getFrameLevel() {
- if (fActiveFrame == null) {
- return -1;
- }
- Integer level = new TCFTask<Integer>() {
- public void run() {
- done(fActiveFrame != null ? fActiveFrame.getFrameNo() : -1);
- }
- }.getE();
- return level != null ? level.intValue() : -1;
- }
-
- public boolean isSuspended() {
- if (fExecContext == null) {
- return false;
- }
- Boolean suspended = new TCFTask<Boolean>(fExecContext.getChannel()) {
- public void run() {
- if (fExecContext == null) {
- done(null);
- return;
- }
- TCFDataCache<TCFContextState> stateCache = fExecContext.getState();
- if (!stateCache.validate(this)) {
- return;
- }
- TCFContextState state = stateCache.getData();
- if (state != null) {
- done(state.is_suspended);
- return;
- }
- done(null);
- }
- }.getE();
- return suspended != null ? suspended.booleanValue() : false;
- }
-
- public boolean hasFrameContext() {
- return fActiveFrame != null;
- }
-
- public String getFrameFile() {
- final TCFNodeStackFrame frame = fActiveFrame;
- if (frame == null) {
- return null;
- }
- String file = new TCFTask<String>(frame.getChannel()) {
- public void run() {
- if (frame != fActiveFrame) {
- done(null);
- return;
- }
- TCFDataCache<TCFSourceRef> sourceRefCache = frame.getLineInfo();
- if (!sourceRefCache.validate(this)) {
- return;
- }
- TCFSourceRef sourceRef = sourceRefCache.getData();
- String file = sourceRef.area.file;
- if (file != null) {
- IPath filePath = new Path(file);
- if (!filePath.isAbsolute()) {
- String dir = sourceRef.area.directory;
- if (dir != null) {
- filePath = new Path(dir).append(filePath);
- }
- }
- done(filePath.toString());
- }
- done(null);
- }
- }.getE();
- return file;
- }
-
- public int getFrameLine() {
- final TCFNodeStackFrame frame = fActiveFrame;
- if (frame == null) {
- return -1;
- }
- Integer line = new TCFTask<Integer>(frame.getChannel()) {
- public void run() {
- if (frame != fActiveFrame) {
- done(null);
- return;
- }
- TCFDataCache<TCFSourceRef> sourceRefCache = frame.getLineInfo();
- if (!sourceRefCache.validate(this)) {
- return;
- }
- TCFSourceRef sourceRef = sourceRefCache.getData();
- done(sourceRef.area.start_line);
- }
- }.getE();
- return line != null ? line.intValue() : -1;
- }
-
- public void retrieveDisassembly(final BigInteger startAddress,
- BigInteger endAddress, String file, int lineNumber, int lines,
- final boolean mixed, final boolean showSymbols, boolean showDisassembly,
- final int linesHint) {
- final TCFNodeExecContext execContext = fExecContext;
- if (execContext == null || execContext.isDisposed()) {
- fCallback.setUpdatePending(false);
- return;
- }
- final int suspendCount = fSuspendCount;
- final long modCount = getModCount();
- Protocol.invokeLater(new Runnable() {
- public void run() {
- if (execContext != fExecContext) {
- return;
- }
- if (suspendCount != fSuspendCount) {
- fCallback.setUpdatePending(false);
- return;
- }
- final IChannel channel = execContext.getChannel();
- IDisassembly disass = channel.getRemoteService(IDisassembly.class);
- if (disass == null) {
- fCallback.setUpdatePending(false);
- return;
- }
- TCFDataCache<TCFNodeExecContext> mem_node_cache = execContext.getModel().searchMemoryContext(execContext);
- if (!mem_node_cache.validate(this)) return;
- TCFNodeExecContext memContext = mem_node_cache.getData();
- if (memContext == null) {
- fCallback.setUpdatePending(false);
- return;
- }
- TCFDataCache<IMemory.MemoryContext> cache = memContext.getMemoryContext();
- if (!cache.validate(this)) return;
- final IMemory.MemoryContext mem = cache.getData();
- if (mem == null) {
- fCallback.setUpdatePending(false);
- return;
- }
- final String contextId = mem.getID();
- Map<String, Object> params = new HashMap<String, Object>();
- disass.disassemble(contextId, startAddress, linesHint*4, params, new DoneDisassemble() {
- public void doneDisassemble(IToken token, final Throwable error,
- final IDisassemblyLine[] disassembly) {
- if (execContext != fExecContext) {
- return;
- }
- if (error != null) {
- fCallback.asyncExec(new Runnable() {
- public void run() {
- if (execContext != fExecContext) {
- return;
- }
- if (modCount == getModCount()) {
- fCallback.insertError(startAddress, TCFModel.getErrorMessage(error, false));
- fCallback.setUpdatePending(false);
- int addr_bits = mem.getAddressSize() * 8;
- if (fCallback.getAddressSize() < addr_bits) fCallback.addressSizeChanged(addr_bits);
- }
- }
- });
- return;
- }
- doneGetDisassembly(disassembly);
- }
-
- private void doneGetDisassembly(final IDisassemblyLine[] disassembly) {
- if (!showSymbols) {
- doneGetSymbols(disassembly, null);
- return;
- }
- final ISymbols symbols = channel.getRemoteService(ISymbols.class);
- if (symbols == null) {
- doneGetSymbols(disassembly, null);
- return;
- }
- final ArrayList<ISymbols.Symbol> symbolList = new ArrayList<ISymbols.Symbol>();
- final int[] idx = { 0 };
- IDisassemblyLine line = disassembly[idx[0]];
- Number address = line.getAddress();
- symbols.findByAddr(contextId, address, new ISymbols.DoneFind() {
- ISymbols.DoneFind doneFind = this;
- public void doneFind(IToken token, Exception error, String symbol_id) {
- if (error == null && symbol_id != null) {
- symbols.getContext(symbol_id, new ISymbols.DoneGetContext() {
- public void doneGetContext(IToken token, Exception error, ISymbols.Symbol context) {
- BigInteger nextAddress = null;
- if (error == null && context != null) {
- if (context.getTypeClass().equals(ISymbols.TypeClass.function)) {
- symbolList.add(context);
- nextAddress = JSON.toBigInteger(context.getAddress()).add(BigInteger.valueOf(context.getSize()));
- }
- }
- findNextSymbol(nextAddress);
- }
- });
- return;
- }
- findNextSymbol(null);
- }
- private void findNextSymbol(BigInteger nextAddress) {
- while (++idx[0] < disassembly.length) {
- BigInteger instrAddress = JSON.toBigInteger(disassembly[idx[0]].getAddress());
- if (nextAddress == null) {
- nextAddress = instrAddress;
- } else if (instrAddress.compareTo(nextAddress) < 0) {
- continue;
- }
- symbols.findByAddr(contextId, instrAddress, doneFind);
- return;
- }
- ISymbols.Symbol[] functionSymbols =
- symbolList.toArray(new ISymbols.Symbol[symbolList.size()]);
- doneGetSymbols(disassembly, functionSymbols);
- }
- });
- }
-
- private void doneGetSymbols(final IDisassemblyLine[] disassembly, final ISymbols.Symbol[] symbols) {
- ILineNumbers lineNumbers = null;
- if (mixed) {
- lineNumbers = channel.getRemoteService(ILineNumbers.class);
- }
- if (lineNumbers == null) {
- doneGetLineNumbers(disassembly, symbols, null);
- } else {
- AddressRange range = getAddressRange(disassembly);
- lineNumbers.mapToSource(contextId, range.start, range.end, new DoneMapToSource() {
- public void doneMapToSource(IToken token, Exception error, final CodeArea[] areas) {
- if (error != null) {
- Activator.log(error);
- doneGetLineNumbers(disassembly, symbols, null);
- } else {
- doneGetLineNumbers(disassembly, symbols, areas);
- }
- }
- });
- }
- }
-
- private void doneGetLineNumbers( final IDisassemblyLine[] disassembly, final ISymbols.Symbol[] symbols, final CodeArea[] areas) {
- fCallback.asyncExec(new Runnable() {
- public void run() {
- insertDisassembly(modCount, startAddress, disassembly, symbols, areas);
- int addr_bits = mem.getAddressSize() * 8;
- if (fCallback.getAddressSize() < addr_bits) fCallback.addressSizeChanged(addr_bits);
- }
- });
- }
-
- private AddressRange getAddressRange(IDisassemblyLine[] lines) {
- AddressRange range = new AddressRange();
- range.start = JSON.toBigInteger(lines[0].getAddress());
- IDisassemblyLine lastLine = lines[lines.length-1];
- range.end = JSON.toBigInteger(lastLine.getAddress()).add(BigInteger.valueOf(lastLine.getSize()));
- return range;
- }
- });
- }
- });
- }
-
- private long getModCount() {
- return ((IDocumentExtension4) fCallback.getDocument()).getModificationStamp();
- }
-
- protected final void insertDisassembly(long modCount, BigInteger startAddress, IDisassemblyLine[] instructions, ISymbols.Symbol[] symbols, CodeArea[] codeAreas) {
- if (!fCallback.hasViewer() || fExecContext == null) {
- return;
- }
- if (modCount != getModCount()) {
- return;
- }
- if (DEBUG) System.out.println("insertDisassembly "+ DisassemblyUtils.getAddressText(startAddress)); //$NON-NLS-1$
- boolean updatePending = fCallback.getUpdatePending();
- assert updatePending;
- if (!updatePending) {
- // safe-guard in case something weird is going on
- return;
- }
-
- boolean insertedAnyAddress = false;
- try {
- fCallback.lockScroller();
-
- AddressRangePosition p= null;
- for (IDisassemblyLine instruction : instructions) {
- BigInteger address = JSON.toBigInteger(instruction.getAddress());
- if (startAddress == null) {
- startAddress = address;
- fCallback.setGotoAddressPending(address);
- }
- if (p == null || !p.containsAddress(address)) {
- p = fCallback.getPositionOfAddress(address);
- }
- if (p instanceof ErrorPosition && p.fValid) {
- p.fValid = false;
- fCallback.getDocument().addInvalidAddressRange(p);
- } else if (p == null /* || address.compareTo(endAddress) > 0 */) {
- if (DEBUG) System.out.println("Excess disassembly lines at " + DisassemblyUtils.getAddressText(address)); //$NON-NLS-1$
- return;
- } else if (p.fValid) {
- if (DEBUG) System.out.println("Excess disassembly lines at " + DisassemblyUtils.getAddressText(address)); //$NON-NLS-1$
-// if (!p.fAddressOffset.equals(address)) {
-// // override probably unaligned disassembly
-// p.fValid = false;
-// fCallback.getDocument().addInvalidAddressRange(p);
-// } else {
- continue;
-// }
- }
-
- // insert source
- String sourceFile = null;
- int firstLine = -1;
- int lastLine = -1;
- CodeArea area = findCodeArea(address, codeAreas);
- if (area != null) {
- if (area.file != null) {
- IPath filePath = new Path(area.file);
- if (!filePath.isAbsolute() && area.directory != null) {
- filePath = new Path(area.directory).append(filePath);
- }
- sourceFile = filePath.toString();
- firstLine = area.start_line - 1;
- lastLine = area.end_line - 2;
- }
- }
- if (sourceFile != null && firstLine >= 0) {
- try {
- p = fCallback.insertSource(p, address, sourceFile, firstLine, lastLine);
- } catch (NoSuchMethodError nsme) {
- // use fallback
- p = fCallback.insertSource(p, address, sourceFile, firstLine);
- }
- }
-
- // insert symbol label
- FunctionOffset functionOffset = getFunctionOffset(address, symbols);
- if (functionOffset.name != null && functionOffset.isZeroOffset()) {
- p = fCallback.getDocument().insertLabel(p, address, functionOffset.name, true);
- }
-
- // insert instruction
- int instrLength= instruction.getSize();
- Map<String, Object>[] instrAttrs = instruction.getInstruction();
- String instr = formatInstruction(instrAttrs);
-
- p = fCallback.getDocument().insertDisassemblyLine(p, address, instrLength, functionOffset.toString(), instr, sourceFile, firstLine);
- if (p == null) {
- break;
- }
- insertedAnyAddress = true;
- }
- } catch (BadLocationException e) {
- // should not happen
- DisassemblyUtils.internalError(e);
- } finally {
- fCallback.setUpdatePending(false);
- if (insertedAnyAddress) {
- fCallback.updateInvalidSource();
- fCallback.unlockScroller();
- fCallback.doPending();
- fCallback.updateVisibleArea();
- } else {
- fCallback.unlockScroller();
- }
- }
- }
-
- private FunctionOffset getFunctionOffset(BigInteger address, ISymbols.Symbol[] symbols) {
- if (symbols != null) {
- for (ISymbols.Symbol symbol : symbols) {
- BigInteger symbolAddress = JSON.toBigInteger(symbol.getAddress());
- BigInteger offset = address.subtract(symbolAddress);
- switch (offset.compareTo(BigInteger.ZERO)) {
- case 0:
- return new FunctionOffset(symbol.getName(), BigInteger.ZERO);
- case 1:
- if (offset.compareTo(BigInteger.valueOf(symbol.getSize())) < 0) {
- return new FunctionOffset(symbol.getName(), offset);
- }
- break;
- default:
- break;
- }
- }
- }
- return FunctionOffset.NONE;
- }
-
- private CodeArea findCodeArea(BigInteger address, CodeArea[] codeAreas) {
- if (codeAreas != null) {
- for (CodeArea codeArea : codeAreas) {
- if (address.equals(JSON.toBigInteger(codeArea.start_address))) {
- return codeArea;
- }
- }
- }
- return null;
- }
-
- /**
- * Format an instruction.
- *
- * @param instrAttrs
- * @return string representation
- */
- private String formatInstruction(Map<String, Object>[] instrAttrs) {
- StringBuilder buf = new StringBuilder(20);
- for (Map<String, Object> attrs : instrAttrs) {
- Object type = attrs.get(IDisassembly.FIELD_TYPE);
- if (IDisassembly.FTYPE_STRING.equals(type) || IDisassembly.FTYPE_Register.equals(type)) {
- Object text = attrs.get(IDisassembly.FIELD_TEXT);
- buf.append(text);
- }
- else {
- Object value = attrs.get(IDisassembly.FIELD_VALUE);
- BigInteger bigValue = new BigInteger(value.toString());
- // TODO number format
- buf.append("0x").append(bigValue.toString(16)).append(' ');
- }
- }
- return buf.toString();
- }
-
- public void gotoSymbol(final String symbol) {
- final TCFNodeStackFrame activeFrame = fActiveFrame;
- if (activeFrame == null) {
- return;
- }
- Protocol.invokeLater(new Runnable() {
- public void run() {
- if (activeFrame != fActiveFrame) {
- return;
- }
- IChannel channel = activeFrame.getChannel();
- final IExpressions exprSvc = channel.getRemoteService(IExpressions.class);
- if (exprSvc != null) {
- TCFNode evalContext = activeFrame.isEmulated() ? activeFrame.getParent() : activeFrame;
- exprSvc.create(evalContext.getID(), null, symbol, new DoneCreate() {
- public void doneCreate(IToken token, Exception error, final Expression context) {
- if (error == null) {
- exprSvc.evaluate(context.getID(), new DoneEvaluate() {
- public void doneEvaluate(IToken token, Exception error, Value value) {
- if (error == null) {
- final BigInteger address = toBigInteger(value.getValue(), value.isBigEndian(), false);
- fCallback.asyncExec(new Runnable() {
- public void run() {
- fCallback.gotoAddress(address);
- }
- });
- } else {
- handleError(error);
- }
- exprSvc.dispose(context.getID(), new DoneDispose() {
- public void doneDispose(IToken token, Exception error) {
- // no-op
- }
- });
- }
- });
- } else {
- handleError(error);
- }
- }
- });
- }
- }
- protected void handleError(final Exception error) {
- fCallback.asyncExec(new Runnable() {
- public void run() {
- Status status = new Status(IStatus.ERROR, Activator.PLUGIN_ID, error.getLocalizedMessage(), error);
- ErrorDialog.openError(fCallback.getSite().getShell(), "Error", null, status); //$NON-NLS-1$
- }
- });
- }
- });
- }
-
- public void retrieveDisassembly(String file, int lines,
- BigInteger endAddress, boolean mixed, boolean showSymbols,
- boolean showDisassembly) {
- // TODO disassembly for source file
- fCallback.setUpdatePending(false);
- }
-
- public String evaluateExpression(final String expression) {
- final TCFNodeStackFrame activeFrame = fActiveFrame;
- if (activeFrame == null) {
- return null;
- }
- String value = new TCFTask<String>(activeFrame.getChannel()) {
- public void run() {
- if (activeFrame != fActiveFrame) {
- done(null);
- return;
- }
- IChannel channel = activeFrame.getChannel();
- final IExpressions exprSvc = channel.getRemoteService(IExpressions.class);
- if (exprSvc != null) {
- TCFNode evalContext = activeFrame.isEmulated() ? activeFrame.getParent() : activeFrame;
- exprSvc.create(evalContext.getID(), null, expression, new DoneCreate() {
- public void doneCreate(IToken token, Exception error, final Expression context) {
- if (error == null) {
- exprSvc.evaluate(context.getID(), new DoneEvaluate() {
- public void doneEvaluate(IToken token, Exception error, Value value) {
- if (error == null) {
- final BigInteger address = toBigInteger(value.getValue(), value.isBigEndian(), false);
- done("0x" + address.toString(16));
- }
- else {
- done(null);
- }
- exprSvc.dispose(context.getID(), new DoneDispose() {
- public void doneDispose(IToken token, Exception error) {
- // no-op
- }
- });
- }
- });
- }
- else {
- done(null);
- }
- }
- });
- } else {
- done(null);
- }
- }
- }.getE();
- return value;
- }
-
- public void dispose() {
- }
-
- public Object insertSource(Position pos, BigInteger address, String file, int lineNumber) {
- TCFNodeExecContext execContext = fExecContext;
- if (execContext == null) return null;
- return TCFSourceLookupDirector.lookup(execContext.getModel().getLaunch().getSourceLocator(), file);
- }
-
- private static BigInteger toBigInteger(byte[] data, boolean big_endian, boolean sign_extension) {
- byte[] temp = null;
- if (sign_extension) {
- temp = new byte[data.length];
- }
- else {
- temp = new byte[data.length + 1];
- temp[0] = 0; // Extra byte to avoid sign extension by BigInteger
- }
- if (big_endian) {
- System.arraycopy(data, 0, temp, sign_extension ? 0 : 1, data.length);
- }
- else {
- for (int i = 0; i < data.length; i++) {
- temp[temp.length - i - 1] = data[i];
- }
- }
- return new BigInteger(temp);
- }
- /*
- * @see org.eclipse.cdt.debug.internal.ui.disassembly.dsf.AbstractDisassemblyBackend#evaluateAddressExpression(java.lang.String, boolean)
- */
- @Override
- public BigInteger evaluateAddressExpression(String expression, boolean suppressError) {
- String value = evaluateExpression(expression);
- if (value != null) {
- try {
- return DisassemblyUtils.decodeAddress(value);
- } catch (NumberFormatException e) {
- if (!suppressError) {
- MessageDialog.openError(PlatformUI.getWorkbench().getDisplay().getActiveShell(), "Error", "Expression does not evaluate to an address");
- }
- }
- }
- return null;
- }
-
-}
diff --git a/plugins/org.eclipse.tm.tcf.cdt.ui/src/org/eclipse/tm/internal/tcf/cdt/ui/disassembly/TCFDisassemblyBackendFactory.java b/plugins/org.eclipse.tm.tcf.cdt.ui/src/org/eclipse/tm/internal/tcf/cdt/ui/disassembly/TCFDisassemblyBackendFactory.java
deleted file mode 100644
index d052b3d2f..000000000
--- a/plugins/org.eclipse.tm.tcf.cdt.ui/src/org/eclipse/tm/internal/tcf/cdt/ui/disassembly/TCFDisassemblyBackendFactory.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 Wind River Systems, Inc. and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipse.tm.internal.tcf.cdt.ui.disassembly;
-
-import org.eclipse.cdt.debug.internal.ui.disassembly.dsf.IDisassemblyBackend;
-import org.eclipse.core.runtime.IAdapterFactory;
-import org.eclipse.tm.internal.tcf.debug.ui.model.TCFNode;
-
-@SuppressWarnings({"restriction", "rawtypes"})
-public class TCFDisassemblyBackendFactory implements IAdapterFactory {
-
- private static final Class<?>[] CLASSES = { IDisassemblyBackend.class };
-
- public Object getAdapter(Object adaptableObject, Class adapterType) {
- if (adaptableObject instanceof TCFNode) {
- TCFDisassemblyBackend backend = new TCFDisassemblyBackend();
- if (backend.supportsDebugContext((TCFNode) adaptableObject)) {
- return backend;
- }
- }
- return null;
- }
-
- public Class[] getAdapterList() {
- return CLASSES;
- }
-
-}
diff --git a/plugins/org.eclipse.tm.tcf.cdt.ui/src/org/eclipse/tm/internal/tcf/cdt/ui/hover/ExpressionInformationControlCreator.java b/plugins/org.eclipse.tm.tcf.cdt.ui/src/org/eclipse/tm/internal/tcf/cdt/ui/hover/ExpressionInformationControlCreator.java
deleted file mode 100644
index 8dec7a92f..000000000
--- a/plugins/org.eclipse.tm.tcf.cdt.ui/src/org/eclipse/tm/internal/tcf/cdt/ui/hover/ExpressionInformationControlCreator.java
+++ /dev/null
@@ -1,471 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2011 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * Wind River Systems - adapted for DSF
- * Wind River Systems - adapted for TCF
- *******************************************************************************/
-package org.eclipse.tm.internal.tcf.cdt.ui.hover;
-
-import org.eclipse.debug.internal.ui.SWTFactory;
-import org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext;
-import org.eclipse.debug.internal.ui.viewers.model.provisional.IViewerInputRequestor;
-import org.eclipse.debug.internal.ui.viewers.model.provisional.IViewerInputUpdate;
-import org.eclipse.debug.internal.ui.viewers.model.provisional.IViewerUpdate;
-import org.eclipse.debug.internal.ui.viewers.model.provisional.IViewerUpdateListener;
-import org.eclipse.debug.internal.ui.viewers.model.provisional.PresentationContext;
-import org.eclipse.debug.internal.ui.viewers.model.provisional.TreeModelViewer;
-import org.eclipse.debug.internal.ui.viewers.model.provisional.ViewerInputService;
-import org.eclipse.debug.internal.ui.views.variables.details.DefaultDetailPane;
-import org.eclipse.debug.internal.ui.views.variables.details.DetailPaneProxy;
-import org.eclipse.debug.internal.ui.views.variables.details.IDetailPaneContainer;
-import org.eclipse.debug.ui.AbstractDebugView;
-import org.eclipse.debug.ui.IDebugUIConstants;
-import org.eclipse.jface.dialogs.IDialogSettings;
-import org.eclipse.jface.text.AbstractInformationControl;
-import org.eclipse.jface.text.IInformationControl;
-import org.eclipse.jface.text.IInformationControlCreator;
-import org.eclipse.jface.text.IInformationControlExtension2;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.StructuredViewer;
-import org.eclipse.jface.viewers.TreeSelection;
-import org.eclipse.jface.viewers.ViewerFilter;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.SashForm;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Layout;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Tree;
-import org.eclipse.tm.internal.tcf.cdt.ui.Activator;
-import org.eclipse.tm.internal.tcf.debug.ui.model.TCFModel;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchPartSite;
-
-/**
- * Creates an information control to display an expression in a hover control. <br/>
- * This class is derivative work from JDT's
- * <code>ExpressionInformationControlCreator</code>.
- *
- * @noextend This class is not intended to be subclassed by clients.
- */
-@SuppressWarnings("restriction")
-public class ExpressionInformationControlCreator implements
- IInformationControlCreator {
-
- class ExpressionInformationControl extends AbstractInformationControl
- implements IInformationControlExtension2, IViewerInputRequestor {
-
- /**
- * Dialog setting key for height
- */
- private static final String HEIGHT = "HEIGHT"; //$NON-NLS-1$
-
- /**
- * Dialog setting key for width.
- */
- private static final String WIDTH = "WIDTH"; //$NON-NLS-1$
-
- /**
- * Dialog setting key for tree sash weight
- */
- private static final String SASH_WEIGHT_TREE = "SashWeightTree"; //$NON-NLS-1$
-
- /**
- * Dialog setting key for details sash weight
- */
- private static final String SASH_WEIGHT_DETAILS = "SashWeightDetails"; //$NON-NLS-1$
-
- /**
- * Variable or expression to display.
- */
- private Object fVariable;
-
- private TreeModelViewer fViewer;
- private IPresentationContext fContext;
- private SashForm fSashForm;
- private Composite fDetailPaneComposite;
- private DetailPaneProxy fDetailPane;
- private Tree fTree;
- private ViewerInputService fInputService;
- private IInformationControlCreator fInformationControlCreator;
-
- /**
- * Inner class implementing IDetailPaneContainer methods. Handles
- * changes to detail pane and provides limited access to the detail pane
- * proxy.
- */
- private class DetailPaneContainer implements IDetailPaneContainer {
- public String getCurrentPaneID() {
- return fDetailPane.getCurrentPaneID();
- }
- public IStructuredSelection getCurrentSelection() {
- return (IStructuredSelection) fViewer.getSelection();
- }
- public void refreshDetailPaneContents() {
- fDetailPane.display(getCurrentSelection());
- }
- public Composite getParentComposite() {
- return fDetailPaneComposite;
- }
- public IWorkbenchPartSite getWorkbenchPartSite() {
- return null;
- }
- public void paneChanged(String newPaneID) {
- if (DefaultDetailPane.ID.equals(newPaneID)) {
- fDetailPane.getCurrentControl().setBackground(
- getShell().getDisplay().getSystemColor(
- SWT.COLOR_INFO_BACKGROUND));
- }
- }
-
- }
-
- /**
- * Constructs a new control in the given shell.
- *
- * @param parentShell
- * shell
- * @param resize
- * whether resize is supported
- */
- ExpressionInformationControl(Shell parentShell, boolean resize) {
- super(parentShell, resize);
- create();
- }
-
- @Override
- public Point computeSizeHint() {
- IDialogSettings settings = getDialogSettings(false);
- if (settings != null) {
- int x = getIntSetting(settings, WIDTH);
- if (x > 0) {
- int y = getIntSetting(settings, HEIGHT);
- if (y > 0) {
- return new Point(x, y);
- }
- }
- }
- return super.computeSizeHint();
- }
-
- @Override
- public void setSize(int width, int height) {
- if (!isResizable() && fDetailPaneComposite != null) {
- // add height of details pane
- height += fDetailPaneComposite.computeSize(SWT.DEFAULT,
- SWT.DEFAULT).y;
- }
- super.setSize(width, height);
- }
-
- /**
- * Returns the dialog settings for this hover or <code>null</code> if
- * none
- *
- * @param create
- * whether to create the settings
- */
- private IDialogSettings getDialogSettings(boolean create) {
- IDialogSettings settings = Activator.getDefault()
- .getDialogSettings();
- IDialogSettings section = settings.getSection(this.getClass()
- .getName());
- if (section == null & create) {
- section = settings.addNewSection(this.getClass().getName());
- }
- return section;
- }
-
- /**
- * Returns an integer value in the given dialog settings or -1 if none.
- *
- * @param settings
- * dialog settings
- * @param key
- * key
- * @return value or -1 if not present
- */
- private int getIntSetting(IDialogSettings settings, String key) {
- try {
- return settings.getInt(key);
- }
- catch (NumberFormatException e) {
- return -1;
- }
- }
-
- @Override
- public void dispose() {
- persistSettings(getShell());
- fContext.dispose();
- super.dispose();
- }
-
- /**
- * Persists dialog settings.
- *
- * @param shell
- */
- private void persistSettings(Shell shell) {
- if (shell != null && !shell.isDisposed()) {
- if (isResizable()) {
- IDialogSettings settings = getDialogSettings(true);
- Point size = shell.getSize();
- settings.put(WIDTH, size.x);
- settings.put(HEIGHT, size.y);
- int[] weights = fSashForm.getWeights();
- if (weights.length == 1) {
- settings.put(SASH_WEIGHT_TREE, weights[0]);
- }
- else if (weights.length == 2) {
- settings.put(SASH_WEIGHT_TREE, weights[0]);
- settings.put(SASH_WEIGHT_DETAILS, weights[1]);
- }
- }
- }
- }
-
- @Override
- public void setVisible(boolean visible) {
- if (!visible) {
- persistSettings(getShell());
- }
- super.setVisible(visible);
- }
-
- @Override
- protected void createContent(Composite parent) {
- fSashForm = new SashForm(parent, parent.getStyle());
- fSashForm.setOrientation(SWT.VERTICAL);
-
- // update presentation context
- AbstractDebugView view = getViewToEmulate();
- fContext = new PresentationContext(TCFModel.ID_EXPRESSION_HOVER);
- if (view != null) {
- // copy over properties
- IPresentationContext copy = ((TreeModelViewer) view.getViewer())
- .getPresentationContext();
- try {
- String[] properties = copy.getProperties();
- for (int i = 0; i < properties.length; i++) {
- String key = properties[i];
- fContext.setProperty(key, copy.getProperty(key));
- }
- }
- catch (NoSuchMethodError e) {
- // ignore
- }
- }
-
- fViewer = new TreeModelViewer(fSashForm, SWT.MULTI | SWT.VIRTUAL
- | SWT.FULL_SELECTION, fContext);
- fViewer.setAutoExpandLevel(fExpansionLevel);
-
- if (view != null) {
- // copy over filters
- StructuredViewer structuredViewer = (StructuredViewer) view
- .getViewer();
- if (structuredViewer != null) {
- ViewerFilter[] filters = structuredViewer.getFilters();
- for (int i = 0; i < filters.length; i++) {
- fViewer.addFilter(filters[i]);
- }
- }
- }
- fInputService = new ViewerInputService(fViewer, this);
- fTree = fViewer.getTree();
-
- if (fShowDetailPane) {
- fDetailPaneComposite = SWTFactory.createComposite(fSashForm, 1,
- 1, GridData.FILL_BOTH);
- Layout layout = fDetailPaneComposite.getLayout();
- if (layout instanceof GridLayout) {
- GridLayout gl = (GridLayout) layout;
- gl.marginHeight = 0;
- gl.marginWidth = 0;
- }
-
- fDetailPane = new DetailPaneProxy(new DetailPaneContainer());
- fDetailPane.display(null); // Bring up the default pane so the
- // user doesn't see an empty
- // composite
-
- fTree.addSelectionListener(new SelectionListener() {
- public void widgetSelected(SelectionEvent e) {
- fDetailPane.display((IStructuredSelection) fViewer
- .getSelection());
- }
-
- public void widgetDefaultSelected(SelectionEvent e) {
- }
- });
- }
-
- initSashWeights();
-
- // add update listener to auto-select and display details of root
- // expression
- fViewer.addViewerUpdateListener(new IViewerUpdateListener() {
- public void viewerUpdatesComplete() {
- fViewer.getDisplay().timerExec(100, new Runnable() {
- public void run() {
- if (fViewer.getControl().isDisposed()) return;
- TreeSelection selection = (TreeSelection) fViewer.getSelection();
- if (selection.isEmpty()) selection = new TreeSelection(fViewer.getTopElementPath());
- fViewer.setSelection(selection);
- if (fDetailPane != null) fDetailPane.display(selection);
- }
- });
- }
-
- public void viewerUpdatesBegin() {
- }
-
- public void updateStarted(IViewerUpdate update) {
- }
-
- public void updateComplete(IViewerUpdate update) {
- }
- });
-
- setBackgroundColor(getShell().getDisplay().getSystemColor(
- SWT.COLOR_INFO_BACKGROUND));
- }
-
- /**
- * Attempts to find an appropriate view to emulate, this will either be
- * the variables view or the expressions view.
- *
- * @return a view to emulate or <code>null</code>
- */
- private AbstractDebugView getViewToEmulate() {
- IWorkbenchPage page = Activator.getDefault().getWorkbench()
- .getActiveWorkbenchWindow().getActivePage();
- AbstractDebugView expressionsView = (AbstractDebugView) page
- .findView(IDebugUIConstants.ID_EXPRESSION_VIEW);
- if (expressionsView != null && expressionsView.isVisible()) {
- return expressionsView;
- }
- AbstractDebugView variablesView = (AbstractDebugView) page
- .findView(IDebugUIConstants.ID_VARIABLE_VIEW);
- if (variablesView != null && variablesView.isVisible()) {
- return variablesView;
- }
- if (expressionsView != null) {
- return expressionsView;
- }
- return variablesView;
- }
-
- /**
- * Initializes the sash form weights from the preference store (using
- * default values if no sash weights were stored previously).
- */
- protected void initSashWeights() {
- IDialogSettings settings = getDialogSettings(false);
- if (settings != null) {
- int tree = getIntSetting(settings, SASH_WEIGHT_TREE);
- if (tree > 0) {
- if (fDetailPane != null) {
- int details = getIntSetting(settings,
- SASH_WEIGHT_DETAILS);
- if (details <= 0) {
- details = tree / 2;
- }
- fSashForm.setWeights(new int[] { tree, details });
- }
- else {
- fSashForm.setWeights(new int[] { tree });
- }
- }
- }
- }
-
- @Override
- public void setBackgroundColor(Color background) {
- super.setBackgroundColor(background);
- if (fDetailPaneComposite != null) {
- fDetailPaneComposite.setBackground(background);
- }
- fTree.setBackground(background);
- }
-
- @Override
- public void setFocus() {
- super.setFocus();
- fTree.setFocus();
- }
-
- public boolean hasContents() {
- return fVariable != null;
- }
-
- public void setInput(Object input) {
- fVariable = input;
- fInputService.resolveViewerInput(input);
- }
-
- public void viewerInputComplete(IViewerInputUpdate update) {
- fViewer.setInput(fVariable = update.getInputElement());
- }
-
- @Override
- public IInformationControlCreator getInformationPresenterControlCreator() {
- if (fInformationControlCreator == null) {
- fInformationControlCreator = new ExpressionInformationControlCreator(
- fShowDetailPane, fExpansionLevel) {
- @Override
- public IInformationControl createInformationControl(Shell shell) {
- return new ExpressionInformationControl(shell, true);
- }
- };
- }
- return fInformationControlCreator;
- }
- }
-
- protected final boolean fShowDetailPane;
-
- protected final int fExpansionLevel;
-
- /**
- * Create default expression information control creator.
- * <p>
- * Same as {@code ExpressionInformationControlCreator(true, 1)}.
- * </p>
- */
- public ExpressionInformationControlCreator() {
- this(true, 1);
- }
-
- /**
- * Create expression information control creator with customization options.
- *
- * @param showDetailPane
- * if <code>true</code> the detail pane will be shown
- * @param expansionLevel
- * tree level to which the expression should be expanded by
- * default
- */
- public ExpressionInformationControlCreator(boolean showDetailPane,
- int expansionLevel) {
- fShowDetailPane = showDetailPane;
- fExpansionLevel = expansionLevel;
- }
-
- public IInformationControl createInformationControl(Shell parent) {
- return new ExpressionInformationControl(parent, false);
- }
-
-}
diff --git a/plugins/org.eclipse.tm.tcf.cdt.ui/src/org/eclipse/tm/internal/tcf/cdt/ui/hover/TCFDebugTextHover.java b/plugins/org.eclipse.tm.tcf.cdt.ui/src/org/eclipse/tm/internal/tcf/cdt/ui/hover/TCFDebugTextHover.java
deleted file mode 100644
index 7ffb5c80b..000000000
--- a/plugins/org.eclipse.tm.tcf.cdt.ui/src/org/eclipse/tm/internal/tcf/cdt/ui/hover/TCFDebugTextHover.java
+++ /dev/null
@@ -1,211 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 Wind River Systems, Inc. and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipse.tm.internal.tcf.cdt.ui.hover;
-
-import java.math.BigInteger;
-import java.util.Map;
-
-import org.eclipse.cdt.debug.ui.editors.AbstractDebugTextHover;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.jface.text.DefaultInformationControl;
-import org.eclipse.jface.text.IInformationControl;
-import org.eclipse.jface.text.IInformationControlCreator;
-import org.eclipse.jface.text.IRegion;
-import org.eclipse.jface.text.ITextHoverExtension2;
-import org.eclipse.jface.text.ITextViewer;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.tm.internal.tcf.debug.ui.model.TCFChildren;
-import org.eclipse.tm.internal.tcf.debug.ui.model.TCFChildrenStackTrace;
-import org.eclipse.tm.internal.tcf.debug.ui.model.TCFNode;
-import org.eclipse.tm.internal.tcf.debug.ui.model.TCFNodeExecContext;
-import org.eclipse.tm.internal.tcf.debug.ui.model.TCFNodeExpression;
-import org.eclipse.tm.internal.tcf.debug.ui.model.TCFNodeStackFrame;
-import org.eclipse.tm.tcf.protocol.IChannel;
-import org.eclipse.tm.tcf.protocol.IToken;
-import org.eclipse.tm.tcf.services.IExpressions;
-import org.eclipse.tm.tcf.services.IExpressions.DoneCreate;
-import org.eclipse.tm.tcf.services.IExpressions.DoneDispose;
-import org.eclipse.tm.tcf.services.IExpressions.DoneEvaluate;
-import org.eclipse.tm.tcf.services.IExpressions.Expression;
-import org.eclipse.tm.tcf.services.IExpressions.Value;
-import org.eclipse.tm.tcf.util.TCFDataCache;
-import org.eclipse.tm.tcf.util.TCFTask;
-
-/**
- * TCF implementation of debug expression hover for the C/C++ Editor.
- */
-public class TCFDebugTextHover extends AbstractDebugTextHover implements ITextHoverExtension2 {
-
- @Override
- public IInformationControlCreator getHoverControlCreator() {
- if (useExpressionExplorer()) {
- return createExpressionInformationControlCreator();
- }
- else {
- return new IInformationControlCreator() {
- public IInformationControl createInformationControl(Shell parent) {
- return new DefaultInformationControl(parent, false);
- }
- };
- }
- }
-
- private IInformationControlCreator createExpressionInformationControlCreator() {
- return new ExpressionInformationControlCreator();
- }
-
- protected boolean useExpressionExplorer() {
- return true;
- }
-
- public Object getHoverInfo2(ITextViewer textViewer, IRegion hoverRegion) {
- if (!useExpressionExplorer()) return getHoverInfo(textViewer, hoverRegion);
- final TCFNodeStackFrame activeFrame = getActiveFrame();
- if (activeFrame == null) return null;
- final String text = getExpressionText(textViewer, hoverRegion);
- if (text == null || text.length() == 0) return null;
- try {
- return new TCFTask<TCFNode>(activeFrame.getChannel()) {
- public void run() {
- TCFNode evalContext = activeFrame.isEmulated() ? activeFrame.getParent() : activeFrame;
- TCFChildren cache = evalContext.getModel().getHoverExpressionCache(evalContext, text);
- if (!cache.validate(this)) return;
- Map<String,TCFNode> nodes = cache.getData();
- if (nodes != null) {
- for (TCFNode node : nodes.values()) {
- TCFDataCache<IExpressions.Value> value = ((TCFNodeExpression)node).getValue();
- if (!value.validate(this)) return;
- if (value.getData() != null) {
- done(node.getParent());
- return;
- }
- }
- }
- done(null);
- }
- }.get();
- }
- catch (Exception x) {
- // Problem in Eclipse 3.7:
- // TextViewerHoverManager calls Thread.interrupt(),
- // but it fails to handle InterruptedException.
- // We have to catch and ignore the exception.
- return null;
- }
- }
-
- @Override
- protected boolean canEvaluate() {
- return getActiveFrame() != null;
- }
-
- private TCFNodeStackFrame getActiveFrame() {
- IAdaptable context = getSelectionAdaptable();
- if (context instanceof TCFNodeStackFrame) return (TCFNodeStackFrame) context;
- if (context instanceof TCFNodeExecContext) {
- try {
- final TCFNodeExecContext exe = (TCFNodeExecContext) context;
- return new TCFTask<TCFNodeStackFrame>(exe.getChannel()) {
- public void run() {
- TCFChildrenStackTrace stack = exe.getStackTrace();
- if (!stack.validate(this)) return;
- done(stack.getTopFrame());
- }
- }.get();
- }
- catch (Exception x) {
- // Problem in Eclipse 3.7:
- // TextViewerHoverManager calls Thread.interrupt(),
- // but it fails to handle InterruptedException.
- // We have to catch and ignore the exception.
- return null;
- }
- }
- return null;
- }
-
- @Override
- protected String evaluateExpression(final String expression) {
- final TCFNodeStackFrame activeFrame = getActiveFrame();
- if (activeFrame == null) return null;
- final IChannel channel = activeFrame.getChannel();
- return new TCFTask<String>(channel) {
- public void run() {
- final IExpressions exprSvc = channel.getRemoteService(IExpressions.class);
- if (exprSvc != null) {
- TCFNode evalContext = activeFrame.isEmulated() ? activeFrame.getParent() : activeFrame;
- exprSvc.create(evalContext.getID(), null, expression, new DoneCreate() {
- public void doneCreate(IToken token, Exception error, final Expression context) {
- if (error == null) {
- exprSvc.evaluate(context.getID(), new DoneEvaluate() {
- public void doneEvaluate(IToken token, Exception error, Value value) {
- if (error == null) {
- done(getValueText(value));
- } else {
- done(null);
- }
- exprSvc.dispose(context.getID(), new DoneDispose() {
- public void doneDispose(IToken token, Exception error) {
- // no-op
- }
- });
- }
- });
- } else {
- done(null);
- }
- }
- });
- } else {
- done(null);
- }
- }
- }.getE();
- }
-
- private static String getValueText(Value value) {
- BigInteger bigInteger = toBigInteger(value.getValue(), value.isBigEndian(), true);
- switch(value.getTypeClass()) {
- case integer:
- return bigInteger.toString();
- case real:
- if (value.getValue().length <= 4) {
- return String.valueOf(Float.intBitsToFloat(bigInteger.intValue()));
- } else if (value.getValue().length <= 8) {
- return String.valueOf(Double.longBitsToDouble(bigInteger.longValue()));
- } else {
- return "N/A";
- }
- default:
- return "0x"+bigInteger.toString(16);
- }
- }
-
- private static BigInteger toBigInteger(byte[] data, boolean big_endian, boolean sign_extension) {
- byte[] temp = null;
- if (sign_extension) {
- temp = new byte[data.length];
- }
- else {
- temp = new byte[data.length + 1];
- temp[0] = 0; // Extra byte to avoid sign extension by BigInteger
- }
- if (big_endian) {
- System.arraycopy(data, 0, temp, sign_extension ? 0 : 1, data.length);
- }
- else {
- for (int i = 0; i < data.length; i++) {
- temp[temp.length - i - 1] = data[i];
- }
- }
- return new BigInteger(temp);
- }
-}
diff --git a/plugins/org.eclipse.tm.tcf.cdt.ui/src/org/eclipse/tm/internal/tcf/cdt/ui/launch/FileSystemBrowserControl.java b/plugins/org.eclipse.tm.tcf.cdt.ui/src/org/eclipse/tm/internal/tcf/cdt/ui/launch/FileSystemBrowserControl.java
deleted file mode 100644
index 24c06293a..000000000
--- a/plugins/org.eclipse.tm.tcf.cdt.ui/src/org/eclipse/tm/internal/tcf/cdt/ui/launch/FileSystemBrowserControl.java
+++ /dev/null
@@ -1,515 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Wind River Systems, Inc. and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipse.tm.internal.tcf.cdt.ui.launch;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Comparator;
-import java.util.LinkedList;
-import java.util.List;
-
-import org.eclipse.core.runtime.Path;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.DisposeEvent;
-import org.eclipse.swt.events.DisposeListener;
-import org.eclipse.swt.graphics.Font;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Listener;
-import org.eclipse.swt.widgets.Tree;
-import org.eclipse.swt.widgets.TreeItem;
-import org.eclipse.tm.tcf.protocol.IChannel;
-import org.eclipse.tm.tcf.protocol.IChannel.IChannelListener;
-import org.eclipse.tm.tcf.protocol.IPeer;
-import org.eclipse.tm.tcf.protocol.IToken;
-import org.eclipse.tm.tcf.protocol.Protocol;
-import org.eclipse.tm.tcf.services.IFileSystem;
-import org.eclipse.tm.tcf.services.IFileSystem.DirEntry;
-import org.eclipse.tm.tcf.services.IFileSystem.FileSystemException;
-import org.eclipse.tm.tcf.services.IFileSystem.IFileHandle;
-import org.eclipse.ui.ISharedImages;
-import org.eclipse.ui.PlatformUI;
-
-public class FileSystemBrowserControl {
-
- static class FileInfo {
- String name;
- String fullname;
- boolean isDir;
- FileInfo[] children;
- Throwable children_error;
- int index;
- boolean children_pending;
- FileInfo parent;
- }
-
- private Tree fileTree;
- private Display fDisplay;
- private IPeer fPeer;
- private final FileInfo fRootInfo = new FileInfo();
- private IChannel fChannel;
- private IFileSystem fFileSystem;
- private String fFileToSelect;
- private LinkedList<String> fPathToSelect;
- private FileInfo fLastSelectedFileInfo;
- private final boolean fDirectoriesOnly;
-
- public FileSystemBrowserControl(Composite parent, boolean directoriesOnly) {
- fDirectoriesOnly = directoriesOnly;
- fDisplay = parent.getDisplay();
- parent.addDisposeListener(new DisposeListener() {
- public void widgetDisposed(DisposeEvent e) {
- handleDispose();
- }
- });
- createFileListArea(parent);
- }
-
- public void setInput(IPeer peer) {
- if (peer == fPeer) {
- return;
- }
- if (fPeer != null) {
- Protocol.invokeAndWait(new Runnable() {
- public void run() {
- disconnectPeer();
- }
- });
- }
- fileTree.setItemCount(0);
- fRootInfo.children = null;
- fPeer = peer;
- if (fPeer != null) {
- Protocol.invokeAndWait(new Runnable() {
- public void run() {
- connectPeer();
- }
- });
- }
- }
-
- public Tree getTree() {
- return fileTree;
- }
-
- private void createFileListArea(Composite parent) {
- Font font = parent.getFont();
- Composite composite = new Composite(parent, SWT.NONE);
- composite.setFont(font);
- GridLayout layout = new GridLayout(1, false);
- layout.marginWidth = 0;
- layout.marginHeight = 0;
- composite.setLayout(layout);
- composite.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true));
-
- fileTree = new Tree(composite, SWT.VIRTUAL | SWT.BORDER | SWT.SINGLE);
- GridData gd = new GridData(GridData.FILL_BOTH);
- gd.minimumHeight = 300;
- gd.minimumWidth = 350;
- fileTree.setLayoutData(gd);
- fileTree.setFont(font);
- fileTree.addListener(SWT.SetData, new Listener() {
- public void handleEvent(Event event) {
- TreeItem item = (TreeItem)event.item;
- FileInfo info = findFileInfo(item);
- if (info == null) {
- updateItems(item.getParentItem(), false);
- }
- else {
- fillItem(item, info);
- }
- }
- });
- }
-
- private void handleDispose() {
- Protocol.invokeAndWait(new Runnable() {
- public void run() {
- disconnectPeer();
- fFileSystem = null;
- fDisplay = null;
- }
- });
- }
-
- protected void disconnectPeer() {
- if (fChannel != null && fChannel.getState() != IChannel.STATE_CLOSED) {
- fChannel.close();
- }
- }
-
- protected void connectPeer() {
- final IChannel channel = fPeer.openChannel();
- fChannel = channel;
- fFileSystem = null;
- channel.addChannelListener(new IChannelListener() {
- public void congestionLevel(int level) {
- }
- public void onChannelClosed(final Throwable error) {
- if (fChannel != channel) return;
- fChannel = null;
- if (fDisplay != null) {
- fDisplay.asyncExec(new Runnable() {
- public void run() {
- if (fRootInfo.children_pending) return;
- fRootInfo.children = null;
- fRootInfo.children_error = error;
- updateItems(fRootInfo);
- }
- });
- }
- }
- public void onChannelOpened() {
- if (fChannel != channel) return;
- fFileSystem = fChannel.getRemoteService(IFileSystem.class);
- if (fFileSystem != null) {
- if (fFileToSelect != null && fFileToSelect.length() > 0) {
- final LinkedList<String> filePath = new LinkedList<String>();
- filePath.addAll(Arrays.asList(fFileToSelect.split("[/\\\\]", -1)));
- if (fFileToSelect.charAt(0) == '/') {
- filePath.set(0, "/");
- }
- fPathToSelect = filePath;
- fLastSelectedFileInfo = fRootInfo;
- }
- }
- if (fDisplay != null) {
- fDisplay.asyncExec(new Runnable() {
- public void run() {
- if (fRootInfo.children_pending) return;
- fRootInfo.children = null;
- fRootInfo.children_error = null;
- updateItems(fRootInfo);
- }
- });
- }
- }
- });
- }
-
- private void updateItems(TreeItem parent_item, boolean reload) {
- final FileInfo parent_info = findFileInfo(parent_item);
- if (parent_info == null) {
- parent_item.setText("Invalid");
- }
- else {
- if (reload && parent_info.children_error != null) {
- loadChildren(parent_info);
- }
- fDisplay.asyncExec(new Runnable() {
- public void run() {
- updateItems(parent_info);
- }
- });
- }
- }
-
- private void updateItems(final FileInfo parent) {
- if (fDisplay == null) return;
- assert Thread.currentThread() == fDisplay.getThread();
- TreeItem[] items = null;
- boolean expanded = true;
- if (parent.children == null || parent.children_error != null) {
- if (parent == fRootInfo) {
- fileTree.setItemCount(1);
- items = fileTree.getItems();
- }
- else {
- TreeItem item = findItem(parent);
- if (item == null) return;
- expanded = item.getExpanded();
- item.setItemCount(1);
- items = item.getItems();
- }
- assert items.length == 1;
- items[0].removeAll();
- if (parent.children_pending) {
- items[0].setForeground(fDisplay.getSystemColor(SWT.COLOR_LIST_FOREGROUND));
- items[0].setText("Pending...");
- }
- else if (parent.children_error != null) {
- String msg = parent.children_error.getMessage();
- if (msg == null) msg = parent.children_error.getClass().getName();
- else msg = msg.replace('\n', ' ');
- items[0].setForeground(fDisplay.getSystemColor(SWT.COLOR_RED));
- items[0].setText(msg);
- items[0].setImage((Image) null);
- }
- else if (expanded) {
- loadChildren(parent);
- items[0].setForeground(fDisplay.getSystemColor(SWT.COLOR_LIST_FOREGROUND));
- items[0].setText("Pending...");
- }
- else {
- items[0].setText("");
- }
- }
- else {
- FileInfo[] arr = parent.children;
- if (parent == fRootInfo) {
- fileTree.setItemCount(arr.length);
- items = fileTree.getItems();
- }
- else {
- TreeItem item = findItem(parent);
- if (item == null) return;
- expanded = item.getExpanded();
- item.setItemCount(expanded ? arr.length : 1);
- items = item.getItems();
- }
- if (expanded) {
- assert items.length == arr.length;
- for (int i = 0; i < items.length; i++) fillItem(items[i], arr[i]);
- expandSelect();
- }
- else {
- items[0].setText("");
- }
- }
- }
-
- private void expandSelect() {
- if (fPathToSelect == null) return;
- if (fPathToSelect.isEmpty()) {
- fPathToSelect = null;
- fFileToSelect = null;
- return;
- }
- do {
- String name = fPathToSelect.getFirst();
- if (name.length() == 0) {
- fPathToSelect.removeFirst();
- continue;
- }
- FileInfo info = findFileInfo(fLastSelectedFileInfo, name);
- if (info == null) break;
- TreeItem item = findItem(info);
- if (item == null) break;
- fPathToSelect.removeFirst();
- if (fPathToSelect.isEmpty()) {
- fileTree.setSelection(item);
- fileTree.showItem(item);
- } else {
- item.setExpanded(true);
- fileTree.showItem(item);
- }
- fLastSelectedFileInfo = info;
- } while (!fPathToSelect.isEmpty());
- }
-
- private void loadChildren(final FileInfo parent) {
- assert Thread.currentThread() == fDisplay.getThread();
- if (parent.children_pending) return;
- assert parent.children == null;
- parent.children_pending = true;
- parent.children_error = null;
- Protocol.invokeLater(new Runnable() {
- public void run() {
- final IFileSystem fs = fFileSystem;
- if (fs == null || !canHaveChildren(parent)) {
- doneLoadChildren(parent, null, new FileInfo[0]);
- return;
- }
- if (parent.fullname == null) {
- fs.roots(new IFileSystem.DoneRoots() {
- public void doneRoots(IToken token, FileSystemException error, DirEntry[] entries) {
- if (error != null) {
- doneLoadChildren(parent, error, null);
- } else {
- final List<FileInfo> fileInfos = new ArrayList<FileInfo>(entries.length);
- for (DirEntry entry : entries) {
- FileInfo info = new FileInfo();
- info.parent = parent;
- String name = entry.filename;
- int length = name.length();
- if (length > 1 && (name.endsWith("\\") || name.endsWith("/"))) {
- name = name.substring(0, length - 1);
- }
- info.name = name;
- info.fullname = entry.longname != null ? entry.longname : entry.filename;
- info.isDir = entry.attrs != null ? entry.attrs.isDirectory() : false;
- if (!fDirectoriesOnly || info.isDir) {
- fileInfos.add(info);
- }
- }
- doneLoadChildren(parent, null, fileInfos.toArray(new FileInfo[fileInfos.size()]));
- }
- }
- });
- return;
- }
- fs.opendir(parent.fullname, new IFileSystem.DoneOpen() {
- final List<FileInfo> fileInfos = new ArrayList<FileInfo>();
- public void doneOpen(IToken token, FileSystemException error, final IFileHandle handle) {
- if (error != null) {
- doneLoadChildren(parent, error, null);
- return;
- }
- fs.readdir(handle, new IFileSystem.DoneReadDir() {
- public void doneReadDir(IToken token, FileSystemException error, DirEntry[] entries, boolean eof) {
- if (entries != null) {
- for (DirEntry entry : entries) {
- FileInfo info = new FileInfo();
- info.parent = parent;
- info.name = entry.filename;
- info.fullname = entry.longname != null ? entry.longname : (new Path(parent.fullname).append(info.name).toString());
- info.isDir = entry.attrs != null ? entry.attrs.isDirectory() : false;
- if (!fDirectoriesOnly || info.isDir) {
- fileInfos.add(info);
- }
- }
- }
- if (error != null || eof) {
- fs.close(handle, new IFileSystem.DoneClose() {
- public void doneClose(IToken token, FileSystemException error) {
- // ignore error
- }
- });
- int size = fileInfos.size();
- if (size == 0 && error != null) {
- doneLoadChildren(parent, error, null);
- } else {
- doneLoadChildren(parent, null, fileInfos.toArray(new FileInfo[size]));
- }
- } else {
- fs.readdir(handle, this);
- }
- }
- });
- }
- });
- }
- });
- }
-
- private void doneLoadChildren(final FileInfo parent, final Throwable error, final FileInfo[] children) {
- assert Protocol.isDispatchThread();
- assert error == null || children == null;
- if (fDisplay == null) return;
- Arrays.sort(children, new Comparator<FileInfo>() {
- public int compare(FileInfo o1, FileInfo o2) {
- if (o1.isDir == o2.isDir)
- return o1.name.compareTo(o2.name);
- if (o1.isDir) return 1;
- return -1;
- }});
- int i = 0;
- for (FileInfo fileInfo : children) {
- fileInfo.index = i++;
- }
- fDisplay.asyncExec(new Runnable() {
- public void run() {
- assert parent.children_pending;
- assert parent.children == null;
- parent.children_pending = false;
- parent.children = children;
- parent.children_error = error;
- updateItems(parent);
- }
- });
- }
-
- public FileInfo findFileInfo(TreeItem item) {
- assert Thread.currentThread() == fDisplay.getThread();
- if (item == null) return fRootInfo ;
- TreeItem parent = item.getParentItem();
- FileInfo info = findFileInfo(parent);
- if (info == null) return null;
- if (info.children == null) return null;
- if (info.children_error != null) return null;
- int i = parent == null ? fileTree.indexOf(item) : parent.indexOf(item);
- if (i < 0 || i >= info.children.length) return null;
- assert info.children[i].index == i;
- return info.children[i];
- }
-
- private FileInfo findFileInfo(FileInfo parent, String name) {
- assert Thread.currentThread() == fDisplay.getThread();
- if (name == null) return fRootInfo;
- if (name.equals(parent.name)) return parent;
- FileInfo[] childInfos = parent.children;
- if (childInfos != null) {
- for (FileInfo fileInfo : childInfos) {
- FileInfo found = findFileInfo(fileInfo, name);
- if (found != null) {
- return found;
- }
- }
- }
- return null;
- }
-
- private TreeItem findItem(FileInfo info) {
- if (info == null) return null;
- assert info.parent != null;
- if (info.parent == fRootInfo) {
- int n = fileTree.getItemCount();
- if (info.index >= n) return null;
- return fileTree.getItem(info.index);
- }
- TreeItem i = findItem(info.parent);
- if (i == null) return null;
- int n = i.getItemCount();
- if (info.index >= n) return null;
- return i.getItem(info.index);
- }
-
- private void fillItem(TreeItem item, FileInfo info) {
- assert Thread.currentThread() == fDisplay.getThread();
- Object data = item.getData("TCFContextInfo");
- if (data != null && data != info) item.removeAll();
- item.setData("TCFContextInfo", info);
- String text = info.name != null ? info.name : info.fullname;
- item.setText(text);
- item.setForeground(fDisplay.getSystemColor(SWT.COLOR_LIST_FOREGROUND));
- item.setImage(getImage(info));
- if (!canHaveChildren(info)) item.setItemCount(0);
- else if (info.children == null || info.children_error != null) item.setItemCount(1);
- else item.setItemCount(info.children.length);
- }
-
- private boolean canHaveChildren(FileInfo info) {
- return info.isDir || info == fRootInfo;
- }
-
- private Image getImage(FileInfo info) {
- if (info.isDir) {
- return PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJ_FOLDER);
- } else {
- return PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJ_FILE);
- }
- }
-
- public void setInitialSelection(final String filename) {
- fPathToSelect = null;
- Protocol.invokeLater(new Runnable() {
- public void run() {
- fFileToSelect = filename;
- }
- });
- }
-
- public FileInfo getSelection() {
- if (fileTree != null) {
- TreeItem[] items = fileTree.getSelection();
- if (items.length > 0) {
- FileInfo info = findFileInfo(items[0]);
- return info;
- }
- }
- return null;
- }
-
-}
diff --git a/plugins/org.eclipse.tm.tcf.cdt.ui/src/org/eclipse/tm/internal/tcf/cdt/ui/launch/PeerListControl.java b/plugins/org.eclipse.tm.tcf.cdt.ui/src/org/eclipse/tm/internal/tcf/cdt/ui/launch/PeerListControl.java
deleted file mode 100644
index 3b5bf6e67..000000000
--- a/plugins/org.eclipse.tm.tcf.cdt.ui/src/org/eclipse/tm/internal/tcf/cdt/ui/launch/PeerListControl.java
+++ /dev/null
@@ -1,639 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Wind River Systems, Inc. and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipse.tm.internal.tcf.cdt.ui.launch;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import org.eclipse.core.runtime.ListenerList;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.ISelectionProvider;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.DisposeEvent;
-import org.eclipse.swt.events.DisposeListener;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.TreeEvent;
-import org.eclipse.swt.events.TreeListener;
-import org.eclipse.swt.graphics.Font;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Listener;
-import org.eclipse.swt.widgets.Tree;
-import org.eclipse.swt.widgets.TreeColumn;
-import org.eclipse.swt.widgets.TreeItem;
-import org.eclipse.tm.internal.tcf.cdt.ui.Activator;
-import org.eclipse.tm.internal.tcf.cdt.ui.ImageCache;
-import org.eclipse.tm.tcf.protocol.IChannel;
-import org.eclipse.tm.tcf.protocol.IChannel.IChannelListener;
-import org.eclipse.tm.tcf.protocol.IPeer;
-import org.eclipse.tm.tcf.protocol.Protocol;
-import org.eclipse.tm.tcf.services.ILocator;
-
-// Cloned from TCFTargetTab
-public class PeerListControl implements ISelectionProvider {
-
- private Tree peer_tree;
- private final PeerInfo peer_info = new PeerInfo();
- private Display display;
- private final ListenerList fSelectionListeners = new ListenerList(ListenerList.IDENTITY);
- private String fInitialPeerId = "*";
-
- static class PeerInfo {
- PeerInfo parent;
- int index;
- String id;
- Map<String,String> attrs;
- PeerInfo[] children;
- boolean children_pending;
- Throwable children_error;
- IPeer peer;
- IChannel channel;
- ILocator locator;
- LocatorListener listener;
- }
-
- private class LocatorListener implements ILocator.LocatorListener {
-
- private final PeerInfo parent;
-
- LocatorListener(PeerInfo parent) {
- this.parent = parent;
- }
-
- public void peerAdded(final IPeer peer) {
- if (display == null) return;
- final String id = peer.getID();
- final HashMap<String,String> attrs = new HashMap<String,String>(peer.getAttributes());
- display.asyncExec(new Runnable() {
- public void run() {
- if (parent.children_error != null) return;
- PeerInfo[] arr = parent.children;
- String agentId = attrs.get(IPeer.ATTR_AGENT_ID);
- for (PeerInfo p : arr) {
- assert !p.id.equals(id);
- if (agentId != null && agentId.equals(p.attrs.get(IPeer.ATTR_AGENT_ID)))
- return;
- }
- PeerInfo[] buf = new PeerInfo[arr.length + 1];
- System.arraycopy(arr, 0, buf, 0, arr.length);
- PeerInfo info = new PeerInfo();
- info.parent = parent;
- info.index = arr.length;
- info.id = id;
- info.attrs = attrs;
- info.peer = peer;
- buf[arr.length] = info;
- parent.children = buf;
- updateItems(parent);
- }
- });
- }
-
- public void peerChanged(final IPeer peer) {
- if (display == null) return;
- final String id = peer.getID();
- final HashMap<String,String> attrs = new HashMap<String,String>(peer.getAttributes());
- display.asyncExec(new Runnable() {
- public void run() {
- if (parent.children_error != null) return;
- PeerInfo[] arr = parent.children;
- for (int i = 0; i < arr.length; i++) {
- if (arr[i].id.equals(id)) {
- arr[i].attrs = attrs;
- arr[i].peer = peer;
- updateItems(parent);
- }
- }
- }
- });
- }
-
- public void peerRemoved(final String id) {
- if (display == null) return;
- display.asyncExec(new Runnable() {
- public void run() {
- if (parent.children_error != null) return;
- PeerInfo[] arr = parent.children;
- PeerInfo[] buf = new PeerInfo[arr.length - 1];
- int j = 0;
- for (int i = 0; i < arr.length; i++) {
- if (arr[i].id.equals(id)) {
- final PeerInfo info = arr[i];
- Protocol.invokeLater(new Runnable() {
- public void run() {
- disconnectPeer(info);
- }
- });
- }
- else {
- arr[i].index = j;
- buf[j++] = arr[i];
- }
- }
- parent.children = buf;
- updateItems(parent);
- }
- });
- }
-
- public void peerHeartBeat(final String id) {
- if (display == null) return;
- display.asyncExec(new Runnable() {
- public void run() {
- if (parent.children_error != null) return;
- PeerInfo[] arr = parent.children;
- for (int i = 0; i < arr.length; i++) {
- if (arr[i].id.equals(id)) {
- if (arr[i].children_error != null) {
- TreeItem item = findItem(arr[i]);
- boolean visible = item != null;
- while (visible && item != null) {
- if (!item.getExpanded()) visible = false;
- item = item.getParentItem();
- }
- if (visible) loadChildren(arr[i]);
- }
- break;
- }
- }
- }
- });
- }
- }
-
- public PeerListControl(Composite parent) {
- display = parent.getDisplay();
- parent.addDisposeListener(new DisposeListener() {
- public void widgetDisposed(DisposeEvent e) {
- handleDispose();
- }
- });
- loadChildren(peer_info);
- createPeerListArea(parent);
- }
-
- public void setInitialSelectedPeerId(String peerId) {
- fInitialPeerId = peerId;
- }
-
- public Tree getTree() {
- return peer_tree;
- }
-
- private void createPeerListArea(Composite parent) {
- Font font = parent.getFont();
- Composite composite = new Composite(parent, SWT.NONE);
- composite.setFont(font);
- GridLayout layout = new GridLayout(1, false);
- layout.marginWidth = 0;
- layout.marginHeight = 0;
- composite.setLayout(layout);
- composite.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true));
-
- peer_tree = new Tree(composite, SWT.VIRTUAL | SWT.BORDER | SWT.SINGLE);
- GridData gd = new GridData(GridData.FILL_BOTH);
- gd.heightHint = 80;
- gd.minimumWidth = 400;
- peer_tree.setLayoutData(gd);
-
- for (int i = 0; i < 5; i++) {
- TreeColumn column = new TreeColumn(peer_tree, SWT.LEAD, i);
- column.setMoveable(true);
- switch (i) {
- case 0:
- column.setText("Name");
- column.setWidth(160);
- break;
- case 1:
- column.setText("OS");
- column.setWidth(100);
- break;
- case 2:
- column.setText("Transport");
- column.setWidth(60);
- break;
- case 3:
- column.setText("Host");
- column.setWidth(100);
- break;
- case 4:
- column.setText("Port");
- column.setWidth(40);
- break;
- }
- }
-
- peer_tree.setHeaderVisible(true);
- peer_tree.setFont(font);
- peer_tree.addListener(SWT.SetData, new Listener() {
- public void handleEvent(Event event) {
- TreeItem item = (TreeItem)event.item;
- PeerInfo info = findPeerInfo(item);
- if (info == null) {
- updateItems(item.getParentItem(), false);
- }
- else {
- fillItem(item, info);
- }
- }
- });
- peer_tree.addTreeListener(new TreeListener() {
- public void treeCollapsed(TreeEvent e) {
- updateItems((TreeItem)e.item, false);
- }
- public void treeExpanded(TreeEvent e) {
- updateItems((TreeItem)e.item, true);
- }
- });
- peer_tree.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- fireSelectionChangedEvent();
- }
- });
- }
-
- private void handleDispose() {
- Protocol.invokeAndWait(new Runnable() {
- public void run() {
- disconnectPeer(peer_info);
- display = null;
- }
- });
- }
-
- private void disconnectPeer(final PeerInfo info) {
- assert Protocol.isDispatchThread();
- if (info.children != null) {
- for (PeerInfo p : info.children) disconnectPeer(p);
- }
- if (info.listener != null) {
- info.locator.removeListener(info.listener);
- info.listener = null;
- info.locator = null;
- }
- if (info.channel != null) {
- info.channel.close();
- }
- }
-
- private boolean canHaveChildren(PeerInfo parent) {
- return parent == peer_info || parent.attrs.get(IPeer.ATTR_PROXY) != null;
- }
-
- private void loadChildren(final PeerInfo parent) {
- assert Thread.currentThread() == display.getThread();
- if (parent.children_pending) return;
- assert parent.children == null;
- parent.children_pending = true;
- parent.children_error = null;
- Protocol.invokeAndWait(new Runnable() {
- public void run() {
- assert parent.listener == null;
- assert parent.channel == null;
- if (!canHaveChildren(parent)) {
- doneLoadChildren(parent, null, new PeerInfo[0]);
- }
- else if (parent == peer_info) {
- peer_info.locator = Protocol.getLocator();
- doneLoadChildren(parent, null, createLocatorListener(peer_info));
- }
- else {
- final IChannel channel = parent.peer.openChannel();
- parent.channel = channel;
- parent.channel.addChannelListener(new IChannelListener() {
- boolean opened = false;
- boolean closed = false;
- public void congestionLevel(int level) {
- }
- public void onChannelClosed(final Throwable error) {
- assert !closed;
- if (parent.channel != channel) return;
- if (!opened) {
- doneLoadChildren(parent, error, null);
- }
- else {
- if (display != null) {
- display.asyncExec(new Runnable() {
- public void run() {
- if (parent.children_pending) return;
- parent.children = null;
- parent.children_error = error;
- updateItems(parent);
- }
- });
- }
- }
- closed = true;
- parent.channel = null;
- parent.locator = null;
- parent.listener = null;
- }
- public void onChannelOpened() {
- assert !opened;
- assert !closed;
- if (parent.channel != channel) return;
- opened = true;
- parent.locator = parent.channel.getRemoteService(ILocator.class);
- if (parent.locator == null) {
- doneLoadChildren(parent, new Exception("Service not supported: " + ILocator.NAME), null);
- parent.channel.close();
- }
- else {
- doneLoadChildren(parent, null, createLocatorListener(parent));
- }
- }
- });
- }
- }
- });
- }
-
- private PeerInfo[] createLocatorListener(PeerInfo peer) {
- assert Protocol.isDispatchThread();
- Map<String,IPeer> map = peer.locator.getPeers();
- List<PeerInfo> filteredPeers = new ArrayList<PeerInfo>();
- Set<String> agentIds = new HashSet<String>();
- for (IPeer p : map.values()) {
- String agentID = p.getAgentID();
- if (agentID != null && agentIds.add(agentID)) {
- PeerInfo info = new PeerInfo();
- info.parent = peer;
- info.index = filteredPeers.size();
- info.id = p.getID();
- info.attrs = new HashMap<String,String>(p.getAttributes());
- info.peer = p;
- filteredPeers.add(info);
- }
- }
- PeerInfo[] buf = filteredPeers.toArray(new PeerInfo[filteredPeers.size()]);
- peer.listener = new LocatorListener(peer);
- peer.locator.addListener(peer.listener);
- return buf;
- }
-
- private void doneLoadChildren(final PeerInfo parent, final Throwable error, final PeerInfo[] children) {
- assert Protocol.isDispatchThread();
- assert error == null || children == null;
- if (display == null) return;
- display.asyncExec(new Runnable() {
- public void run() {
- assert parent.children_pending;
- assert parent.children == null;
- parent.children_pending = false;
- parent.children = children;
- parent.children_error = error;
- updateItems(parent);
- }
- });
- }
-
- private void updateItems(TreeItem parent_item, boolean reload) {
- final PeerInfo parent_info = findPeerInfo(parent_item);
- if (parent_info == null) {
- parent_item.setText("Invalid");
- }
- else {
- if (reload && parent_info.children_error != null) {
- loadChildren(parent_info);
- }
- display.asyncExec(new Runnable() {
- public void run() {
- updateItems(parent_info);
- }
- });
- }
- }
-
- private void updateItems(final PeerInfo parent) {
- if (display == null) return;
- assert Thread.currentThread() == display.getThread();
- TreeItem[] items = null;
- boolean expanded = true;
- if (parent.children == null || parent.children_error != null) {
- if (parent == peer_info) {
- peer_tree.setItemCount(1);
- items = peer_tree.getItems();
- }
- else {
- TreeItem item = findItem(parent);
- if (item == null) return;
- expanded = item.getExpanded();
- item.setItemCount(1);
- items = item.getItems();
- }
- assert items.length == 1;
- items[0].removeAll();
- if (parent.children_pending) {
- items[0].setForeground(display.getSystemColor(SWT.COLOR_LIST_FOREGROUND));
- items[0].setText("Connecting...");
- }
- else if (parent.children_error != null) {
- String msg = parent.children_error.getMessage();
- if (msg == null) msg = parent.children_error.getClass().getName();
- else msg = msg.replace('\n', ' ');
- items[0].setForeground(display.getSystemColor(SWT.COLOR_RED));
- items[0].setText(msg);
- }
- else if (expanded) {
- loadChildren(parent);
- items[0].setForeground(display.getSystemColor(SWT.COLOR_LIST_FOREGROUND));
- items[0].setText("Connecting...");
- }
- else {
- Protocol.invokeAndWait(new Runnable() {
- public void run() {
- disconnectPeer(parent);
- }
- });
- items[0].setText("");
- }
- int n = peer_tree.getColumnCount();
- for (int i = 1; i < n; i++) items[0].setText(i, "");
- items[0].setImage((Image)null);
- }
- else {
- PeerInfo[] arr = parent.children;
- if (parent == peer_info) {
- peer_tree.setItemCount(arr.length);
- items = peer_tree.getItems();
- }
- else {
- TreeItem item = findItem(parent);
- if (item == null) return;
- expanded = item.getExpanded();
- item.setItemCount(expanded ? arr.length : 1);
- items = item.getItems();
- }
- if (expanded) {
- assert items.length == arr.length;
- for (int i = 0; i < items.length; i++) fillItem(items[i], arr[i]);
- if (fInitialPeerId != null && items.length > 0) {
- if ("*".equals(fInitialPeerId)) {
- fInitialPeerId = null;
- peer_tree.setSelection(items[0]);
- fireSelectionChangedEvent();
- } else {
- int i = 0;
- for (PeerInfo peerInfo : arr) {
- if (fInitialPeerId.equals(peerInfo.id)) {
- fInitialPeerId = null;
- peer_tree.setSelection(items[i]);
- fireSelectionChangedEvent();
- break;
- }
- i++;
- }
- }
- }
- }
- else {
- Protocol.invokeAndWait(new Runnable() {
- public void run() {
- disconnectPeer(parent);
- }
- });
- items[0].setText("");
- int n = peer_tree.getColumnCount();
- for (int i = 1; i < n; i++) items[0].setText(i, "");
- }
- }
- }
-
- public PeerInfo findPeerInfo(String peerId) {
- return findPeerInfo(peer_info, peerId);
- }
-
- private PeerInfo findPeerInfo(PeerInfo parent, String peerId) {
- if (peerId.equals(parent.id)) return parent;
- PeerInfo[] children = parent.children;
- if (children == null) return null;
- for (PeerInfo child : children) {
- PeerInfo info = findPeerInfo(child, peerId);
- if (info != null) return info;
- }
- return null;
- }
-
- public PeerInfo findPeerInfo(TreeItem item) {
- assert Thread.currentThread() == display.getThread();
- if (item == null) return peer_info;
- TreeItem parent = item.getParentItem();
- PeerInfo info = findPeerInfo(parent);
- if (info == null) return null;
- if (info.children == null) return null;
- if (info.children_error != null) return null;
- int i = parent == null ? peer_tree.indexOf(item) : parent.indexOf(item);
- if (i < 0 || i >= info.children.length) return null;
- assert info.children[i].index == i;
- return info.children[i];
- }
-
- private TreeItem findItem(PeerInfo info) {
- if (info == null) return null;
- assert info.parent != null;
- if (info.parent == peer_info) {
- int n = peer_tree.getItemCount();
- if (info.index >= n) return null;
- return peer_tree.getItem(info.index);
- }
- TreeItem i = findItem(info.parent);
- if (i == null) return null;
- int n = i.getItemCount();
- if (info.index >= n) return null;
- return i.getItem(info.index);
- }
-
- private void fillItem(TreeItem item, PeerInfo info) {
- assert Thread.currentThread() == display.getThread();
- Object data = item.getData("TCFPeerInfo");
- if (data != null && data != info) item.removeAll();
- item.setData("TCFPeerInfo", info);
- String text[] = new String[5];
- text[0] = info.attrs.get(IPeer.ATTR_NAME);
- text[1] = info.attrs.get(IPeer.ATTR_OS_NAME);
- text[2] = info.attrs.get(IPeer.ATTR_TRANSPORT_NAME);
- text[3] = info.attrs.get(IPeer.ATTR_IP_HOST);
- text[4] = info.attrs.get(IPeer.ATTR_IP_PORT);
- for (int i = 0; i < text.length; i++) {
- if (text[i] == null) text[i] = "";
- }
- item.setText(text);
- item.setForeground(display.getSystemColor(SWT.COLOR_LIST_FOREGROUND));
- item.setImage(ImageCache.getImage(getImageName(info)));
- if (!canHaveChildren(info)) item.setItemCount(0);
- else if (info.children == null || info.children_error != null) item.setItemCount(1);
- else item.setItemCount(info.children.length);
- }
-
- private String getImageName(PeerInfo info) {
- return ImageCache.IMG_TARGET_TAB;
- }
-
- public void addSelectionChangedListener(ISelectionChangedListener listener) {
- fSelectionListeners .add(listener);
- }
-
- public ISelection getSelection() {
- TreeItem[] items = peer_tree.getSelection();
- PeerInfo[] peers = new PeerInfo[items.length];
- int i = 0;
- for (TreeItem item : items) {
- peers[i++] = findPeerInfo(item);
- }
- return new StructuredSelection(peers);
- }
-
- public void removeSelectionChangedListener(ISelectionChangedListener listener) {
- fSelectionListeners.remove(listener);
- }
-
- public void setSelection(ISelection selection) {
- peer_tree.deselectAll();
- if (selection instanceof IStructuredSelection) {
- Object[] elements = ((IStructuredSelection) selection).toArray();
- for (Object object : elements) {
- if (object instanceof PeerInfo) {
- TreeItem item = findItem((PeerInfo) object);
- if (item != null) {
- peer_tree.select(item);
- }
- }
- }
- }
- }
-
- private void fireSelectionChangedEvent() {
- SelectionChangedEvent event = new SelectionChangedEvent(this, getSelection());
- Object[] listeners = fSelectionListeners.getListeners();
- for (Object listener : listeners) {
- try {
- ((ISelectionChangedListener) listener).selectionChanged(event);
- } catch (Exception e) {
- Activator.log(e);
- }
- }
- }
-
-}
diff --git a/plugins/org.eclipse.tm.tcf.cdt.ui/src/org/eclipse/tm/internal/tcf/cdt/ui/launch/ProcessListControl.java b/plugins/org.eclipse.tm.tcf.cdt.ui/src/org/eclipse/tm/internal/tcf/cdt/ui/launch/ProcessListControl.java
deleted file mode 100644
index c452c31b9..000000000
--- a/plugins/org.eclipse.tm.tcf.cdt.ui/src/org/eclipse/tm/internal/tcf/cdt/ui/launch/ProcessListControl.java
+++ /dev/null
@@ -1,505 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Wind River Systems, Inc. and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipse.tm.internal.tcf.cdt.ui.launch;
-
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Set;
-
-import org.eclipse.debug.ui.DebugUITools;
-import org.eclipse.debug.ui.IDebugUIConstants;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.DisposeEvent;
-import org.eclipse.swt.events.DisposeListener;
-import org.eclipse.swt.graphics.Font;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Listener;
-import org.eclipse.swt.widgets.Tree;
-import org.eclipse.swt.widgets.TreeItem;
-import org.eclipse.tm.tcf.protocol.IChannel;
-import org.eclipse.tm.tcf.protocol.IChannel.IChannelListener;
-import org.eclipse.tm.tcf.protocol.IPeer;
-import org.eclipse.tm.tcf.protocol.IToken;
-import org.eclipse.tm.tcf.protocol.Protocol;
-import org.eclipse.tm.tcf.services.IProcesses;
-import org.eclipse.tm.tcf.services.IProcesses.ProcessContext;
-
-public class ProcessListControl {
-
- private final class ProcessListener implements IProcesses.ProcessesListener {
- public void exited(final String process_id, int exit_code) {
- if (display != null) {
- display.asyncExec(new Runnable() {
- public void run() {
- ProcessInfo info = findProcessInfo(root_info, process_id);
- if (info != null && info.parent != null && info.parent.children != null) {
- info.parent.children = null;
- loadChildren(info.parent);
- }
- }
- });
- }
- }
- }
-
- static class ProcessInfo {
- String name;
- String id;
- boolean isContainer;
- ProcessInfo[] children;
- Throwable children_error;
- int index;
- boolean children_pending;
- ProcessInfo parent;
- protected boolean isAttached;
- }
-
- private Tree fProcessTree;
- private Display display;
- private IPeer fPeer;
- private final ProcessInfo root_info = new ProcessInfo();
- private IChannel fChannel;
- private IProcesses fProcesses;
- protected final ProcessListener fProcessListener = new ProcessListener();
- private String fContextToSelect;
- private LinkedList<String> fPathToSelect;
- private Composite fComposite;
-
- public ProcessListControl(Composite parent) {
- display = parent.getDisplay();
- parent.addDisposeListener(new DisposeListener() {
- public void widgetDisposed(DisposeEvent e) {
- handleDispose();
- }
- });
- createProcessListArea(parent);
- }
-
- public void setInput(IPeer peer) {
- if (peer == fPeer) {
- return;
- }
- if (fPeer != null) {
- Protocol.invokeAndWait(new Runnable() {
- public void run() {
- disconnectPeer();
- }
- });
- }
- fProcessTree.setItemCount(0);
- root_info.children = null;
- fPeer = peer;
- if (fPeer != null) {
- Protocol.invokeAndWait(new Runnable() {
- public void run() {
- connectPeer();
- }
- });
- }
- }
-
- public Control getControl() {
- return fComposite;
- }
-
- public Tree getTree() {
- return fProcessTree;
- }
-
- public ProcessInfo getSelection() {
- if (fProcessTree != null) {
- TreeItem[] items = fProcessTree.getSelection();
- if (items.length > 0) {
- ProcessInfo info = findProcessInfo(items[0]);
- return info;
- }
- }
- return null;
- }
-
- private void createProcessListArea(Composite parent) {
- Font font = parent.getFont();
- Composite composite = new Composite(parent, SWT.NONE);
- composite.setFont(font);
- GridLayout layout = new GridLayout(1, false);
- layout.marginWidth = 0;
- layout.marginHeight = 0;
- composite.setLayout(layout);
- composite.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true));
- fComposite = composite;
-
- fProcessTree = new Tree(composite, SWT.VIRTUAL | SWT.BORDER | SWT.SINGLE);
- GridData gd = new GridData(GridData.FILL_BOTH);
- gd.minimumHeight = 150;
- gd.minimumWidth = 470;
- fProcessTree.setLayoutData(gd);
- fProcessTree.setFont(font);
- fProcessTree.addListener(SWT.SetData, new Listener() {
- public void handleEvent(Event event) {
- TreeItem item = (TreeItem)event.item;
- ProcessInfo info = findProcessInfo(item);
- if (info == null) {
- updateItems(item.getParentItem(), false);
- }
- else {
- fillItem(item, info);
- }
- }
- });
- }
-
- private void handleDispose() {
- Protocol.invokeAndWait(new Runnable() {
- public void run() {
- disconnectPeer();
- if (fProcesses != null) {
- fProcesses.removeListener(fProcessListener);
- fProcesses = null;
- }
- display = null;
- }
- });
- }
-
- protected void disconnectPeer() {
- if (fChannel != null && fChannel.getState() != IChannel.STATE_CLOSED) {
- fChannel.close();
- }
- }
-
- protected void connectPeer() {
- final IChannel channel = fPeer.openChannel();
- fChannel = channel;
- fProcesses = null;
- channel.addChannelListener(new IChannelListener() {
- public void congestionLevel(int level) {
- }
- public void onChannelClosed(final Throwable error) {
- if (fChannel != channel) return;
- fChannel = null;
- if (display != null) {
- display.asyncExec(new Runnable() {
- public void run() {
- if (root_info.children_pending) return;
- root_info.children = null;
- root_info.children_error = error;
- updateItems(root_info);
- }
- });
- }
- }
- public void onChannelOpened() {
- if (fChannel != channel) return;
- fProcesses = fChannel.getRemoteService(IProcesses.class);
- if (fProcesses != null) {
- fProcesses.addListener(fProcessListener);
- if (fContextToSelect != null) {
- final LinkedList<String> contextPath = new LinkedList<String>();
- contextPath.addFirst(fContextToSelect);
- fProcesses.getContext(fContextToSelect, new IProcesses.DoneGetContext() {
- public void doneGetContext(IToken token, Exception error, ProcessContext context) {
- if (error == null) {
- String parentId = context.getParentID();
- if (parentId != null) {
- contextPath.addFirst(parentId);
- fProcesses.getContext(parentId, this);
- return;
- }
- if (display != null) {
- display.asyncExec(new Runnable() {
- public void run() {
- fPathToSelect = contextPath;
- expandSelect();
- }
- });
- }
- }
- }
- });
- }
- }
- if (display != null) {
- display.asyncExec(new Runnable() {
- public void run() {
- if (root_info.children_pending) return;
- root_info.children = null;
- root_info.children_error = null;
- updateItems(root_info);
- }
- });
- }
- }
- });
- }
-
- private void updateItems(TreeItem parent_item, boolean reload) {
- final ProcessInfo parent_info = findProcessInfo(parent_item);
- if (parent_info == null) {
- parent_item.setText("Invalid");
- }
- else {
- if (reload && parent_info.children_error != null) {
- loadChildren(parent_info);
- }
- display.asyncExec(new Runnable() {
- public void run() {
- updateItems(parent_info);
- }
- });
- }
- }
-
- private void updateItems(final ProcessInfo parent) {
- if (display == null) return;
- assert Thread.currentThread() == display.getThread();
- TreeItem[] items = null;
- boolean expanded = true;
- if (parent.children == null || parent.children_error != null) {
- if (parent == root_info) {
- fProcessTree.setItemCount(1);
- items = fProcessTree.getItems();
- }
- else {
- TreeItem item = findItem(parent);
- if (item == null) return;
- expanded = item.getExpanded();
- item.setItemCount(1);
- items = item.getItems();
- }
- assert items.length == 1;
- items[0].removeAll();
- if (parent.children_pending) {
- items[0].setForeground(display.getSystemColor(SWT.COLOR_LIST_FOREGROUND));
- items[0].setText("Pending...");
- }
- else if (parent.children_error != null) {
- String msg = parent.children_error.getMessage();
- if (msg == null) msg = parent.children_error.getClass().getName();
- else msg = msg.replace('\n', ' ');
- items[0].setForeground(display.getSystemColor(SWT.COLOR_RED));
- items[0].setText(msg);
- items[0].setImage((Image) null);
- }
- else if (expanded) {
- loadChildren(parent);
- items[0].setForeground(display.getSystemColor(SWT.COLOR_LIST_FOREGROUND));
- items[0].setText("Pending...");
- }
- else {
- items[0].setText("");
- }
- }
- else {
- ProcessInfo[] arr = parent.children;
- if (parent == root_info) {
- fProcessTree.setItemCount(arr.length);
- items = fProcessTree.getItems();
- }
- else {
- TreeItem item = findItem(parent);
- if (item == null) return;
- expanded = item.getExpanded();
- item.setItemCount(expanded ? arr.length : 1);
- items = item.getItems();
- }
- if (expanded) {
- assert items.length == arr.length;
- for (int i = 0; i < items.length; i++) fillItem(items[i], arr[i]);
- // auto-expand single children
- if (items.length == 1 && !items[0].getExpanded()) {
- items[0].setExpanded(true);
- }
- expandSelect();
- }
- else {
- items[0].setText("");
- }
- }
- }
-
- private void expandSelect() {
- if (fPathToSelect == null) return;
- if (fPathToSelect.isEmpty()) {
- fPathToSelect = null;
- fContextToSelect = null;
- return;
- }
- do {
- String id = fPathToSelect.get(0);
- ProcessInfo info = findProcessInfo(root_info, id);
- if (info == null) break;
- TreeItem item = findItem(info);
- if (item == null) break;
- fPathToSelect.removeFirst();
- if (fPathToSelect.isEmpty()) {
- fProcessTree.setSelection(item);
- } else {
- item.setExpanded(true);
- }
- } while (!fPathToSelect.isEmpty());
- }
-
- private void loadChildren(final ProcessInfo parent) {
- assert Thread.currentThread() == display.getThread();
- if (parent.children_pending) return;
- assert parent.children == null;
- parent.children_pending = true;
- parent.children_error = null;
- Protocol.invokeLater(new Runnable() {
- public void run() {
- final IProcesses proc = fProcesses;
- if (proc == null || !canHaveChildren(parent)) {
- doneLoadChildren(parent, null, new ProcessInfo[0]);
- }
- else {
- proc.getChildren(parent.id, false, new IProcesses.DoneGetChildren() {
- public void doneGetChildren(IToken token, Exception error, String[] context_ids) {
- if (error != null) {
- doneLoadChildren(parent, error, null);
- } else if (context_ids.length > 0){
- final List<ProcessInfo> contextInfos = new ArrayList<ProcessInfo>(context_ids.length);
- final Set<IToken> pending = new HashSet<IToken>();
- for (String id : context_ids) {
- pending.add(proc.getContext(id, new IProcesses.DoneGetContext() {
- public void doneGetContext(IToken token, Exception error, ProcessContext context) {
- if (context != null) {
- ProcessInfo info = new ProcessInfo();
- info.parent = parent;
- info.id = context.getID();
- info.name = context.getName();
- if (info.name == null || info.name.length() == 0) {
- info.name = info.id;
- } else {
- info.name += " [" + info.id + ']';
- }
- info.isContainer = false;
- info.isAttached = context.isAttached();
- info.index = contextInfos.size();
- contextInfos.add(info);
- }
- pending.remove(token);
- if (pending.isEmpty()) {
- doneLoadChildren(parent, null, contextInfos.toArray(new ProcessInfo[contextInfos.size()]));
- }
- }
- }));
- }
- } else {
- doneLoadChildren(parent, null, new ProcessInfo[0]);
- }
- }
- });
- }
- }
- });
- }
-
- private void doneLoadChildren(final ProcessInfo parent, final Throwable error, final ProcessInfo[] children) {
- assert Protocol.isDispatchThread();
- assert error == null || children == null;
- if (display == null) return;
- display.asyncExec(new Runnable() {
- public void run() {
- assert parent.children_pending;
- assert parent.children == null;
- parent.children_pending = false;
- parent.children = children;
- parent.children_error = error;
- updateItems(parent);
- }
- });
- }
-
- public ProcessInfo findProcessInfo(TreeItem item) {
- assert Thread.currentThread() == display.getThread();
- if (item == null) return root_info ;
- TreeItem parent = item.getParentItem();
- ProcessInfo info = findProcessInfo(parent);
- if (info == null) return null;
- if (info.children == null) return null;
- if (info.children_error != null) return null;
- int i = parent == null ? fProcessTree.indexOf(item) : parent.indexOf(item);
- if (i < 0 || i >= info.children.length) return null;
- assert info.children[i].index == i;
- return info.children[i];
- }
-
- public ProcessInfo findProcessInfo(ProcessInfo parent, String id) {
- assert Thread.currentThread() == display.getThread();
- if (id == null) return root_info;
- if (id.equals(parent.id)) return parent;
- ProcessInfo[] childInfos = parent.children;
- if (childInfos != null) {
- for (ProcessInfo contextInfo : childInfos) {
- ProcessInfo found = findProcessInfo(contextInfo, id);
- if (found != null) {
- return found;
- }
- }
- }
- return null;
- }
-
- private TreeItem findItem(ProcessInfo info) {
- if (info == null) return null;
- assert info.parent != null;
- if (info.parent == root_info) {
- int n = fProcessTree.getItemCount();
- if (info.index >= n) return null;
- return fProcessTree.getItem(info.index);
- }
- TreeItem i = findItem(info.parent);
- if (i == null) return null;
- int n = i.getItemCount();
- if (info.index >= n) return null;
- return i.getItem(info.index);
- }
-
- private void fillItem(TreeItem item, ProcessInfo info) {
- assert Thread.currentThread() == display.getThread();
- Object data = item.getData("TCFContextInfo");
- if (data != null && data != info) item.removeAll();
- item.setData("TCFContextInfo", info);
- String text = info.name != null ? info.name : info.id;
- item.setText(text);
- item.setForeground(display.getSystemColor(SWT.COLOR_LIST_FOREGROUND));
- item.setImage(getImage(info));
- if (!canHaveChildren(info)) item.setItemCount(0);
- else if (info.children == null || info.children_error != null) item.setItemCount(1);
- else item.setItemCount(info.children.length);
- }
-
- private boolean canHaveChildren(ProcessInfo info) {
- return info.isContainer || info == root_info;
- }
-
- private Image getImage(ProcessInfo info) {
- return DebugUITools.getImage(IDebugUIConstants.IMG_OBJS_OS_PROCESS);
- }
-
- public void selectContext(final String contextId) {
- fPathToSelect = null;
- Protocol.invokeLater(new Runnable() {
- public void run() {
- fContextToSelect = contextId;
- }
- });
- }
-
-}
diff --git a/plugins/org.eclipse.tm.tcf.cdt.ui/src/org/eclipse/tm/internal/tcf/cdt/ui/launch/ProcessPrompter.java b/plugins/org.eclipse.tm.tcf.cdt.ui/src/org/eclipse/tm/internal/tcf/cdt/ui/launch/ProcessPrompter.java
deleted file mode 100644
index c31fda488..000000000
--- a/plugins/org.eclipse.tm.tcf.cdt.ui/src/org/eclipse/tm/internal/tcf/cdt/ui/launch/ProcessPrompter.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Wind River Systems, Inc. and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipse.tm.internal.tcf.cdt.ui.launch;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.debug.core.ILaunchConfiguration;
-import org.eclipse.debug.core.IStatusHandler;
-import org.eclipse.jface.window.Window;
-import org.eclipse.tm.internal.tcf.cdt.launch.ContextSelection;
-import org.eclipse.tm.internal.tcf.debug.launch.TCFLaunchDelegate;
-import org.eclipse.ui.PlatformUI;
-
-public class ProcessPrompter implements IStatusHandler {
-
- public Object handleStatus(IStatus status, Object source) throws CoreException {
- ILaunchConfiguration config = (ILaunchConfiguration) source;
- String peerId = config.getAttribute(TCFLaunchDelegate.ATTR_PEER_ID, (String) null);
- String contextId = config.getAttribute("attach_to_process", (String) null);
- if (peerId == null || contextId == null) {
- ContextSelection selection = new ContextSelection(peerId, contextId);
- ProcessSelectionDialog diag = new ProcessSelectionDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow());
- diag.setSelection(selection);
- if (diag.open() == Window.OK) {
- return diag.getSelection();
- }
- }
- return null;
- }
-
-}
diff --git a/plugins/org.eclipse.tm.tcf.cdt.ui/src/org/eclipse/tm/internal/tcf/cdt/ui/launch/ProcessSelectionDialog.java b/plugins/org.eclipse.tm.tcf.cdt.ui/src/org/eclipse/tm/internal/tcf/cdt/ui/launch/ProcessSelectionDialog.java
deleted file mode 100644
index 3dfe739f6..000000000
--- a/plugins/org.eclipse.tm.tcf.cdt.ui/src/org/eclipse/tm/internal/tcf/cdt/ui/launch/ProcessSelectionDialog.java
+++ /dev/null
@@ -1,120 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Wind River Systems, Inc. and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipse.tm.internal.tcf.cdt.ui.launch;
-
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.window.IShellProvider;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.TreeItem;
-import org.eclipse.tm.internal.tcf.cdt.launch.ContextSelection;
-import org.eclipse.tm.internal.tcf.cdt.ui.launch.PeerListControl.PeerInfo;
-import org.eclipse.tm.internal.tcf.cdt.ui.launch.ProcessListControl.ProcessInfo;
-
-/**
- * Dialog to select a peer and context.
- */
-public class ProcessSelectionDialog extends Dialog {
-
- private ContextSelection fSelection;
- private ProcessListControl fContextList;
-
- protected ProcessSelectionDialog(IShellProvider parentShell) {
- super(parentShell);
- }
-
- public void setSelection(ContextSelection selection) {
- fSelection = selection;
- }
-
- public ContextSelection getSelection() {
- return fSelection;
- }
-
- @Override
- protected void configureShell(Shell newShell) {
- newShell.setText("Select Peer and Context");
- super.configureShell(newShell);
- }
-
- @Override
- protected Control createContents(Composite parent) {
- Control control = super.createContents(parent);
- updateButtonState();
- return control;
- }
-
- @Override
- protected Control createDialogArea(Composite parent) {
- Composite composite = (Composite) super.createDialogArea(parent);
- new Label(composite, SWT.NONE).setText("TCF Peers:");
- final PeerListControl peerList = new PeerListControl(composite);
- new Label(composite, SWT.NONE).setText("Contexts:");
- fContextList = new ProcessListControl(composite);
- peerList.addSelectionChangedListener(new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- ISelection selection = event.getSelection();
- if (selection instanceof IStructuredSelection) {
- IStructuredSelection ss = (IStructuredSelection) selection;
- Object element = ss.getFirstElement();
- if (element instanceof PeerInfo) {
- handlePeerSelected((PeerInfo) element);
- }
- }
- }
- });
- fContextList.getTree().addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- ProcessInfo contextInfo = fContextList.findProcessInfo((TreeItem) e.item);
- if (contextInfo != null) {
- handleContextSelected(contextInfo);
- }
- }
- @Override
- public void widgetDefaultSelected(SelectionEvent e) {
- widgetSelected(e);
- if (getButton(IDialogConstants.OK_ID).isEnabled()) {
- buttonPressed(IDialogConstants.OK_ID);
- }
- }
- });
- if (fSelection.fContextId != null) {
- fContextList.selectContext(fSelection.fContextId);
- }
- return composite;
- }
-
- private void updateButtonState() {
- getButton(IDialogConstants.OK_ID).setEnabled(fSelection.fContextId != null);
- }
-
- protected void handleContextSelected(ProcessInfo contextInfo) {
- fSelection.fContextId = contextInfo.id;
- updateButtonState();
- }
-
- protected void handlePeerSelected(PeerInfo peerInfo) {
- fSelection.fPeerId = peerInfo.id;
- fContextList.setInput(peerInfo.peer);
- }
-
-}
diff --git a/plugins/org.eclipse.tm.tcf.cdt.ui/src/org/eclipse/tm/internal/tcf/cdt/ui/launch/RemoteCMainTab.java b/plugins/org.eclipse.tm.tcf.cdt.ui/src/org/eclipse/tm/internal/tcf/cdt/ui/launch/RemoteCMainTab.java
deleted file mode 100644
index 85c1509a6..000000000
--- a/plugins/org.eclipse.tm.tcf.cdt.ui/src/org/eclipse/tm/internal/tcf/cdt/ui/launch/RemoteCMainTab.java
+++ /dev/null
@@ -1,437 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Wind River Systems, Inc. and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipse.tm.internal.tcf.cdt.ui.launch;
-
-import org.eclipse.cdt.launch.ui.CMainTab;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.debug.core.ILaunchConfiguration;
-import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jface.window.IShellProvider;
-import org.eclipse.jface.window.Window;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.tm.internal.tcf.cdt.ui.launch.PeerListControl.PeerInfo;
-import org.eclipse.tm.internal.tcf.debug.launch.TCFLaunchDelegate;
-import org.eclipse.tm.tcf.protocol.IChannel;
-import org.eclipse.tm.tcf.protocol.IChannel.IChannelListener;
-import org.eclipse.tm.tcf.services.IFileSystem;
-import org.eclipse.tm.tcf.services.IProcesses;
-import org.eclipse.tm.tcf.util.TCFTask;
-import org.eclipse.ui.PlatformUI;
-
-public class RemoteCMainTab extends CMainTab implements IShellProvider {
-
- private static final String REMOTE_PATH_DEFAULT = EMPTY_STRING;
- private static final boolean SKIP_DOWNLOAD_TO_REMOTE_DEFAULT = false;
-
- private PeerListControl fPeerList;
- private Text fRemoteProgText;
- private Button fRemoteBrowseButton;
- private Button fSkipDownloadButton;
-// private Text fPreRunText;
- private boolean fIsInitializing = false;
- private PeerInfo fSelectedPeer;
- private boolean fPeerHasFileSystemService;
- private boolean fPeerHasProcessesService;
-
- public RemoteCMainTab() {
- super(false);
- }
-
- @Override
- public Shell getShell() {
- return super.getShell();
- }
-
- public void createControl(Composite parent) {
- Composite comp = new Composite(parent, SWT.NONE);
- GridLayout topLayout = new GridLayout();
- setControl(comp);
- comp.setLayout(topLayout);
-
- /* TCF peer selection control */
- createPeerListGroup(comp);
-
- /* The Project and local binary location */
- createVerticalSpacer(comp, 1);
- createProjectGroup(comp, 1);
- createBuildConfigCombo(comp, 1);
- createExeFileGroup(comp, 1);
-
- /* The remote binary location and skip download option */
- createVerticalSpacer(comp, 1);
- createTargetExePathGroup(comp);
- createDownloadOption(comp);
-
- /* If the local binary path changes, modify the remote binary location */
- fProgText.addModifyListener(new ModifyListener() {
- public void modifyText(ModifyEvent evt) {
- setLocalPathForRemotePath();
- }
- });
-
- PlatformUI
- .getWorkbench()
- .getHelpSystem()
- .setHelp(getControl(),
- "org.eclipse.tm.tcf.cdt.ui.remoteApplicationLaunchGroup"); //$NON-NLS-1$
- }
-
- private void createPeerListGroup(Composite comp) {
- new Label(comp, SWT.NONE).setText("Targets:");
- fPeerList = new PeerListControl(comp);
- fPeerList.addSelectionChangedListener(new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- handlePeerSelectionChanged();
- useDefaultsFromConnection();
- updateLaunchConfigurationDialog();
- }
- });
- }
-
- public boolean isValid(ILaunchConfiguration config) {
- boolean valid = super.isValid(config);
- if (valid) {
- if (fSelectedPeer == null) {
- setErrorMessage("No target selected.");
- valid = false;
- } else if (!fPeerHasProcessesService) {
- setErrorMessage("Selected target does not support 'Processes' service");
- valid = false;
- }
- if (valid) {
- String name = fRemoteProgText.getText().trim();
- if (name.length() == 0) {
- setErrorMessage("Remote executable path is not specified.");
- valid = false;
- }
- }
- }
- return valid;
- }
-
- protected void createTargetExePathGroup(Composite parent) {
- Composite mainComp = new Composite(parent, SWT.NONE);
- GridLayout mainLayout = new GridLayout();
- mainLayout.numColumns = 2;
- mainLayout.marginHeight = 0;
- mainLayout.marginWidth = 0;
- mainComp.setLayout(mainLayout);
- GridData gd = new GridData(GridData.FILL_HORIZONTAL);
- mainComp.setLayoutData(gd);
-
- Label remoteProgLabel = new Label(mainComp, SWT.NONE);
- remoteProgLabel.setText("Remote Absolute File Path for C/C++ Application:");
- gd = new GridData();
- gd.horizontalSpan = 2;
- remoteProgLabel.setLayoutData(gd);
-
- fRemoteProgText = new Text(mainComp, SWT.SINGLE | SWT.BORDER);
- gd = new GridData(GridData.FILL_HORIZONTAL);
- gd.horizontalSpan = 1;
- fRemoteProgText.setLayoutData(gd);
- fRemoteProgText.addModifyListener(new ModifyListener() {
- public void modifyText(ModifyEvent evt) {
- updateLaunchConfigurationDialog();
- }
- });
-
- fRemoteBrowseButton = createPushButton(mainComp, "Browse...", null);
- fRemoteBrowseButton.setEnabled(fPeerHasFileSystemService);
- fRemoteBrowseButton.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent evt) {
- handleRemoteBrowseSelected();
- updateLaunchConfigurationDialog();
- }
- });
-
- // Commands to run before execution
- /*
- Label preRunLabel = new Label(mainComp, SWT.NONE);
- preRunLabel.setText("Commands to execute before application");
- gd = new GridData();
- gd.horizontalSpan = 2;
- preRunLabel.setLayoutData(gd);
-
- fPreRunText = new Text(mainComp, SWT.MULTI | SWT.BORDER);
- gd = new GridData(GridData.FILL_HORIZONTAL);
- gd.horizontalSpan = 2;
- fPreRunText.setLayoutData(gd);
- fPreRunText.addModifyListener(new ModifyListener() {
- public void modifyText(ModifyEvent evt) {
- updateLaunchConfigurationDialog();
- }
- });
- */
- }
-
- protected void createDownloadOption(Composite parent) {
- Composite mainComp = new Composite(parent, SWT.NONE);
- GridLayout mainLayout = new GridLayout();
- mainLayout.marginHeight = 0;
- mainLayout.marginWidth = 0;
- mainComp.setLayout(mainLayout);
- GridData gd = new GridData(GridData.FILL_HORIZONTAL);
- mainComp.setLayoutData(gd);
-
- fSkipDownloadButton = createCheckButton(mainComp, "Skip download to target path.");
- fSkipDownloadButton.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent evt) {
- updateLaunchConfigurationDialog();
- }
- });
- fSkipDownloadButton.setEnabled(fPeerHasFileSystemService);
- }
-
- @Override
- public void setDefaults(ILaunchConfigurationWorkingCopy config) {
- super.setDefaults(config);
- config.setAttribute(TCFLaunchDelegate.ATTR_RUN_LOCAL_AGENT, false);
- config.setAttribute(TCFLaunchDelegate.ATTR_USE_LOCAL_AGENT, false);
- }
-
- public void performApply(ILaunchConfigurationWorkingCopy config) {
- String peerId = getSelectedPeerId();
- if (peerId != null) {
- config.setAttribute(TCFLaunchDelegate.ATTR_PEER_ID, peerId);
- }
- config.setAttribute(TCFLaunchDelegate.ATTR_RUN_LOCAL_AGENT, false);
- config.setAttribute(TCFLaunchDelegate.ATTR_USE_LOCAL_AGENT, false);
- config.setAttribute(TCFLaunchDelegate.ATTR_REMOTE_PROGRAM_FILE, fRemoteProgText.getText());
- config.setAttribute(TCFLaunchDelegate.ATTR_COPY_TO_REMOTE_FILE, !fSkipDownloadButton.getSelection());
-// config.setAttribute(TCFLaunchDelegate.ATTR_PRERUN_COMMANDS, fPreRunText.getText());
- super.performApply(config);
- }
-
- public void initializeFrom(ILaunchConfiguration config) {
- fIsInitializing = true;
- super.initializeFrom(config);
- updatePeerFromConfig(config);
- updateTargetProgFromConfig(config);
- updateSkipDownloadFromConfig(config);
- fIsInitializing = false;
- }
-
- protected void updatePeerFromConfig(ILaunchConfiguration config) {
- try {
- String peerId = config.getAttribute(TCFLaunchDelegate.ATTR_PEER_ID, (String) null);
- if (peerId != null) {
- PeerInfo info = fPeerList.findPeerInfo(peerId);
- if (info != null) {
- fPeerList.setSelection(new StructuredSelection(info));
- handlePeerSelectionChanged();
- } else {
- fPeerList.setInitialSelectedPeerId(peerId);
- }
- }
- }
- catch (CoreException e) {
- // Ignore
- }
- }
-
- protected void handleRemoteBrowseSelected() {
- RemoteFileSelectionDialog dialog = new RemoteFileSelectionDialog(this, SWT.SAVE);
- dialog.setSelection(fRemoteProgText.getText().trim());
- dialog.setPeer(fSelectedPeer.peer);
- if (dialog.open() == Window.OK) {
- String file = dialog.getSelection();
- if (file != null) {
- fRemoteProgText.setText(file);
- }
- }
- }
-
- protected void updateTargetProgFromConfig(ILaunchConfiguration config) {
- String targetPath = REMOTE_PATH_DEFAULT;
- try {
- targetPath = config.getAttribute(TCFLaunchDelegate.ATTR_REMOTE_PROGRAM_FILE, REMOTE_PATH_DEFAULT);
- }
- catch (CoreException e) {
- // Ignore
- }
- fRemoteProgText.setText(targetPath);
-
-// String prelaunchCmd = null;
-// try {
-// prelaunchCmd = config.getAttribute(TCFLaunchDelegate.ATTR_PRERUN_COMMANDS, ""); //$NON-NLS-1$
-// }
-// catch (CoreException e) {
-// // Ignore
-// }
-// fPreRunText.setText(prelaunchCmd);
- }
-
- protected void updateSkipDownloadFromConfig(ILaunchConfiguration config) {
- boolean doDownload = !SKIP_DOWNLOAD_TO_REMOTE_DEFAULT;
- try {
- doDownload = config.getAttribute(TCFLaunchDelegate.ATTR_COPY_TO_REMOTE_FILE, doDownload);
- }
- catch (CoreException e) {
- // Ignore for now
- }
- fSkipDownloadButton.setSelection(!doDownload);
- }
-
- /*
- * setLocalPathForRemotePath This function sets the remote path text field
- * with the value of the local executable path.
- */
- private void setLocalPathForRemotePath() {
- String programName = fProgText.getText().trim();
- boolean bUpdateRemote = false;
-
- String remoteName = fRemoteProgText.getText().trim();
- String remoteWsRoot = getRemoteWSRoot();
- if (remoteName.length() == 0) {
- bUpdateRemote = true;
- }
- else if (remoteWsRoot.length() != 0) {
- bUpdateRemote = remoteName.equals(remoteWsRoot);
- }
-
- if (programName.length() != 0 && bUpdateRemote && getCProject() != null) {
- IProject project = getCProject().getProject();
- IPath exePath = new Path(programName);
- if (!exePath.isAbsolute()) {
- exePath = project.getFile(programName).getLocation();
-
- IPath wsRoot = project.getWorkspace().getRoot().getLocation();
- exePath = makeRelativeToWSRootLocation(exePath, remoteWsRoot,
- wsRoot);
- }
- String path = exePath.toString();
- fRemoteProgText.setText(path);
- }
- }
-
- private void useDefaultsFromConnection() {
- // During initialization, we don't want to use the default
- // values of the connection, but we want to use the ones
- // that are part of the configuration
- if (fIsInitializing) return;
-
- if ((fRemoteProgText != null) && !fRemoteProgText.isDisposed()) {
- String remoteName = fRemoteProgText.getText().trim();
- String remoteWsRoot = getRemoteWSRoot();
- if (remoteName.length() == 0) {
- fRemoteProgText.setText(remoteWsRoot);
- }
- else {
- // try to use remote path
- IPath wsRoot = ResourcesPlugin.getWorkspace().getRoot().getLocation();
- IPath remotePath = makeRelativeToWSRootLocation(new Path(remoteName), remoteWsRoot, wsRoot);
- fRemoteProgText.setText(remotePath.toString());
- }
- }
- boolean hasFileSystemService = hasFileSystemService();
- if (fSkipDownloadButton != null && !fSkipDownloadButton.isDisposed()) {
- fSkipDownloadButton.setEnabled(hasFileSystemService);
- }
- if (fRemoteBrowseButton != null && !fRemoteBrowseButton.isDisposed()) {
- fRemoteBrowseButton.setEnabled(hasFileSystemService);
- }
- }
-
- private boolean hasFileSystemService() {
- return fPeerHasFileSystemService;
- }
-
- private void handlePeerSelectionChanged() {
- final PeerInfo info;
- ISelection selection = fPeerList.getSelection();
- if (selection instanceof IStructuredSelection) {
- info = (PeerInfo) ((IStructuredSelection) selection).getFirstElement();
- } else {
- info = null;
- }
- fSelectedPeer = info;
- fPeerHasFileSystemService = false;
- fPeerHasProcessesService = false;
- if (info != null) {
- Boolean[] available = new TCFTask<Boolean[]>() {
- public void run() {
- final IChannel channel = info.peer.openChannel();
- channel.addChannelListener(new IChannelListener() {
- boolean opened;
- public void congestionLevel(int level) {
- }
- public void onChannelClosed(final Throwable error) {
- if (!opened) {
- // TODO report error?
- done(new Boolean[] { false, false });
- }
- }
- public void onChannelOpened() {
- opened = true;
- Boolean hasFileSystemService = channel.getRemoteService(IFileSystem.class) != null;
- Boolean hasProcessesService = channel.getRemoteService(IProcesses.class) != null;
- channel.close();
- done(new Boolean[] { hasFileSystemService, hasProcessesService });
- }
- });
- }
- }.getE();
- fPeerHasFileSystemService = available[0];
- fPeerHasProcessesService = available[1];
- }
- return;
- }
-
- private PeerInfo getSelectedPeer() {
- return fSelectedPeer;
- }
-
- private String getSelectedPeerId() {
- PeerInfo info = getSelectedPeer();
- if (info != null) {
- return info.id;
- }
- return null;
- }
-
- private IPath makeRelativeToWSRootLocation(IPath exePath,
- String remoteWsRoot, IPath wsRoot) {
- if (remoteWsRoot.length() != 0) {
- // use remoteWSRoot instead of Workspace Root
- if (wsRoot.isPrefixOf(exePath)) {
- return new Path(remoteWsRoot).append(exePath
- .removeFirstSegments(wsRoot.segmentCount()).setDevice(
- null));
- }
- }
- return exePath;
- }
-
- private String getRemoteWSRoot() {
- // TODO remoteWSRoot?
- return ""; //$NON-NLS-1$
- }
-}
diff --git a/plugins/org.eclipse.tm.tcf.cdt.ui/src/org/eclipse/tm/internal/tcf/cdt/ui/launch/RemoteFileSelectionDialog.java b/plugins/org.eclipse.tm.tcf.cdt.ui/src/org/eclipse/tm/internal/tcf/cdt/ui/launch/RemoteFileSelectionDialog.java
deleted file mode 100644
index 72ef8e338..000000000
--- a/plugins/org.eclipse.tm.tcf.cdt.ui/src/org/eclipse/tm/internal/tcf/cdt/ui/launch/RemoteFileSelectionDialog.java
+++ /dev/null
@@ -1,170 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Wind River Systems, Inc. and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipse.tm.internal.tcf.cdt.ui.launch;
-
-import org.eclipse.core.runtime.Path;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.window.IShellProvider;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.FocusAdapter;
-import org.eclipse.swt.events.FocusEvent;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.swt.widgets.TreeItem;
-import org.eclipse.tm.internal.tcf.cdt.ui.launch.FileSystemBrowserControl.FileInfo;
-import org.eclipse.tm.tcf.protocol.IPeer;
-
-/**
- * Dialog to select a remote file.
- */
-public class RemoteFileSelectionDialog extends Dialog {
-
- private String fSelection;
- private FileSystemBrowserControl fFileList;
- private IPeer fPeer;
- private boolean fForSave;
- private Text fFileNameText;
-
- protected RemoteFileSelectionDialog(IShellProvider parentShell, int style) {
- super(parentShell);
- setShellStyle(getShellStyle() | SWT.RESIZE);
- fForSave = (style & SWT.SAVE) != 0;
- }
-
- public void setPeer(IPeer peer) {
- fPeer = peer;
- if (fFileList != null) {
- fFileList.setInput(peer);
- }
- }
-
- public void setSelection(String fileSelection) {
- fSelection = fileSelection;
- }
-
- public String getSelection() {
- return fSelection;
- }
-
- @Override
- protected void configureShell(Shell newShell) {
- newShell.setText("Select File");
- super.configureShell(newShell);
- }
-
- @Override
- protected Control createContents(Composite parent) {
- Control control = super.createContents(parent);
- updateButtonState();
- return control;
- }
-
- @Override
- protected Control createDialogArea(Composite parent) {
- Composite composite = (Composite) super.createDialogArea(parent);
- fFileList = new FileSystemBrowserControl(composite, false);
- fFileList.getTree().addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- FileInfo contextInfo = fFileList.findFileInfo((TreeItem) e.item);
- if (contextInfo != null) {
- handleFileSelected(contextInfo);
- }
- }
- @Override
- public void widgetDefaultSelected(SelectionEvent e) {
- widgetSelected(e);
- if (getButton(IDialogConstants.OK_ID).isEnabled()) {
- buttonPressed(IDialogConstants.OK_ID);
- }
- }
- });
-
- if (fForSave) {
- Composite fileNameComp = new Composite(composite, SWT.NONE);
- fileNameComp.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
- GridLayout layout = new GridLayout(2, false);
- layout.marginWidth = 0;
- fileNameComp.setLayout(layout);
- new Label(fileNameComp, SWT.NONE).setText("File Name:");
- fFileNameText = new Text(fileNameComp, SWT.BORDER);
- fFileNameText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
- fFileNameText.addFocusListener(new FocusAdapter() {
- @Override
- public void focusLost(FocusEvent e) {
- handleFileNameChanged();
- }
- });
- }
-
- if (fSelection != null) {
- fFileList.setInitialSelection(fSelection);
- if (fFileNameText != null) {
- String basename = new Path(fSelection).lastSegment();
- if (basename != null) {
- fFileNameText.setText(basename);
- }
- }
- }
- if (fPeer != null) {
- fFileList.setInput(fPeer);
- }
- return composite;
- }
-
- private void updateButtonState() {
- boolean enabled = fSelection != null;
- if (enabled && fForSave) {
- enabled = fFileNameText.getText().trim().length() > 0;
- }
- getButton(IDialogConstants.OK_ID).setEnabled(enabled);
- }
-
- protected void handleFileNameChanged() {
- if (fSelection != null) {
- fSelection = new Path(fSelection).removeLastSegments(1).append(fFileNameText.getText().trim()).toString();
- updateButtonState();
- }
- }
-
- protected void handleFileSelected(FileInfo fileInfo) {
- if (fileInfo.isDir) {
- if (fForSave) {
- String basename = fFileNameText.getText().trim();
- if (basename.length() > 0) {
- fSelection = new Path(fileInfo.fullname).append(basename).toString();
- } else {
- fSelection = fileInfo.fullname;
- }
- } else {
- fSelection = null;
- }
- } else {
- fSelection = fileInfo.fullname;
- if (fFileNameText != null) {
- String basename = new Path(fSelection).lastSegment();
- if (basename != null) {
- fFileNameText.setText(basename);
- }
- }
- }
- updateButtonState();
- }
-
-}
diff --git a/plugins/org.eclipse.tm.tcf.cdt.ui/src/org/eclipse/tm/internal/tcf/cdt/ui/sourcelookup/TCFCSourceNotFoundEditor.java b/plugins/org.eclipse.tm.tcf.cdt.ui/src/org/eclipse/tm/internal/tcf/cdt/ui/sourcelookup/TCFCSourceNotFoundEditor.java
deleted file mode 100644
index c287029a5..000000000
--- a/plugins/org.eclipse.tm.tcf.cdt.ui/src/org/eclipse/tm/internal/tcf/cdt/ui/sourcelookup/TCFCSourceNotFoundEditor.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Wind River Systems, Inc. and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipse.tm.internal.tcf.cdt.ui.sourcelookup;
-
-import org.eclipse.cdt.debug.core.model.ISteppingModeTarget;
-import org.eclipse.cdt.debug.internal.ui.sourcelookup.CSourceNotFoundEditor;
-import org.eclipse.debug.core.DebugPlugin;
-import org.eclipse.debug.core.ILaunch;
-import org.eclipse.debug.core.ILaunchesListener2;
-import org.eclipse.tm.internal.tcf.cdt.ui.sourcelookup.TCFSourceNotFoundPresentation.TCFCSourceNotFoundEditorInput;
-import org.eclipse.tm.internal.tcf.cdt.ui.sourcelookup.TCFSourceNotFoundPresentation.TCFCSourceNotFoundElement;
-import org.eclipse.tm.internal.tcf.debug.ui.model.TCFModel;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IWorkbenchPage;
-
-/**
- * Customized source-not-found editor
- */
-@SuppressWarnings("restriction")
-public class TCFCSourceNotFoundEditor extends CSourceNotFoundEditor {
-
- static final String ID = "org.eclipse.tm.tcf.cdt.ui.source_not_found_editor";
-
- private class LaunchListener implements ILaunchesListener2 {
- public void launchesRemoved(ILaunch[] launches) {
- }
- public void launchesAdded(ILaunch[] launches) {
- }
- public void launchesChanged(ILaunch[] launches) {
- }
- public void launchesTerminated(ILaunch[] launches) {
- for (ILaunch launch : launches) {
- if (launch == fLaunch) {
- closeEditor();
- break;
- }
- }
- }
- }
-
- private ILaunch fLaunch;
- private LaunchListener fLaunchListener;
-
- @Override
- public void setInput(IEditorInput input) {
- if (input instanceof TCFCSourceNotFoundEditorInput) {
- TCFCSourceNotFoundElement element = (TCFCSourceNotFoundElement) ((TCFCSourceNotFoundEditorInput) input).getArtifact();
- TCFModel model = element.getModel();
- if (model != null) {
- fLaunch = model.getLaunch();
- DebugPlugin.getDefault().getLaunchManager().addLaunchListener(fLaunchListener = new LaunchListener());
- }
- }
- super.setInput(input);
- }
-
- @Override
- protected void viewDisassembly() {
- Object artifact = getArtifact();
- ISteppingModeTarget target = (ISteppingModeTarget) DebugPlugin.getAdapter(artifact, ISteppingModeTarget.class);
- if (target != null) {
- target.enableInstructionStepping(true);
- closeEditor();
- }
- }
-
- @Override
- public void dispose() {
- if (fLaunchListener != null) {
- DebugPlugin.getDefault().getLaunchManager().removeLaunchListener(fLaunchListener);
- }
- super.dispose();
- }
-
- protected void closeEditor() {
- final IEditorPart editor = this;
- editor.getSite().getShell().getDisplay().asyncExec(new Runnable() {
- public void run() {
- IWorkbenchPage page = editor.getSite().getPage();
- if (page != null) page.closeEditor(editor, false);
- }
- });
- }
-}
diff --git a/plugins/org.eclipse.tm.tcf.cdt.ui/src/org/eclipse/tm/internal/tcf/cdt/ui/sourcelookup/TCFSourceNotFoundPresentation.java b/plugins/org.eclipse.tm.tcf.cdt.ui/src/org/eclipse/tm/internal/tcf/cdt/ui/sourcelookup/TCFSourceNotFoundPresentation.java
deleted file mode 100644
index bd8dfaa29..000000000
--- a/plugins/org.eclipse.tm.tcf.cdt.ui/src/org/eclipse/tm/internal/tcf/cdt/ui/sourcelookup/TCFSourceNotFoundPresentation.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Wind River Systems, Inc. and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Wind River Systems - initial API and implementation
- *******************************************************************************/
-package org.eclipse.tm.internal.tcf.cdt.ui.sourcelookup;
-
-import org.eclipse.cdt.debug.internal.core.sourcelookup.CSourceNotFoundElement;
-import org.eclipse.cdt.debug.internal.ui.sourcelookup.CSourceNotFoundEditorInput;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.debug.core.ILaunchConfiguration;
-import org.eclipse.tm.internal.tcf.debug.ui.model.ISourceNotFoundPresentation;
-import org.eclipse.tm.internal.tcf.debug.ui.model.TCFModel;
-import org.eclipse.ui.IEditorInput;
-
-/**
- * Reuse CDT's source-not-found editor for TCF.
- */
-@SuppressWarnings("restriction")
-public class TCFSourceNotFoundPresentation implements ISourceNotFoundPresentation {
-
- final static class TCFCSourceNotFoundElement extends CSourceNotFoundElement {
- private final TCFModel fModel;
-
- private TCFCSourceNotFoundElement(IAdaptable element, ILaunchConfiguration cfg, String file) {
- super(element, cfg, file);
- fModel = (TCFModel) element.getAdapter(TCFModel.class);
- }
-
- TCFModel getModel() {
- return fModel;
- }
-
- @Override
- public String getDescription() {
- return getFile();
- }
-
- @Override
- public boolean equals(Object other) {
- if (!(other instanceof TCFCSourceNotFoundElement)) return false;
- TCFCSourceNotFoundElement otherElement = (TCFCSourceNotFoundElement) other;
- return getFile().equals(otherElement.getFile()) && getModel() == otherElement.getModel();
- }
- }
-
- final static class TCFCSourceNotFoundEditorInput extends CSourceNotFoundEditorInput {
- public TCFCSourceNotFoundEditorInput(CSourceNotFoundElement element) {
- super(element);
- }
-
- @Override
- public boolean equals(Object other) {
- if (!(other instanceof TCFCSourceNotFoundEditorInput)) return false;
- return getArtifact().equals(((TCFCSourceNotFoundEditorInput) other).getArtifact());
- }
- }
-
- public IEditorInput getEditorInput(Object element, ILaunchConfiguration cfg, String file) {
- if (element instanceof IAdaptable) {
- return new TCFCSourceNotFoundEditorInput(
- new TCFCSourceNotFoundElement((IAdaptable) element, cfg, file));
- }
- return null;
- }
-
- public String getEditorId(IEditorInput input, Object element) {
- if (input instanceof CSourceNotFoundEditorInput) {
- return TCFCSourceNotFoundEditor.ID;
- }
- return null;
- }
-
-}

Back to the top