1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-05 16:56:04 +02:00

Add Docker launching support

- use the new docker tooling plug-ins to launch and debug
  CDT C/C++ applications in docker containers

Change-Id: I30689255a3443ce6d49f937f5e2506d86452915b
This commit is contained in:
Jeff Johnston 2015-04-24 19:38:08 -04:00 committed by Gerrit Code Review @ Eclipse.org
parent e2ca94284e
commit 56032058d2
42 changed files with 3617 additions and 3 deletions

View file

@ -28,12 +28,12 @@ Require-Bundle: org.eclipse.ui,
org.eclipse.core.resources
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
Export-Package: org.eclipse.cdt.dsf.gdb.internal.ui;x-internal:=true,
Export-Package: org.eclipse.cdt.dsf.gdb.internal.ui;x-friends:="org.eclipse.cdt.docker.launcher",
org.eclipse.cdt.dsf.gdb.internal.ui.actions;x-friends:="org.eclipse.cdt.examples.dsf.gdb",
org.eclipse.cdt.dsf.gdb.internal.ui.breakpoints;x-internal:=true,
org.eclipse.cdt.dsf.gdb.internal.ui.commands;x-internal:=true,
org.eclipse.cdt.dsf.gdb.internal.ui.console;x-internal:=true,
org.eclipse.cdt.dsf.gdb.internal.ui.launching;x-friends:="org.eclipse.cdt.debug.gdbjtag.ui,org.eclipse.cdt.examples.dsf.gdb",
org.eclipse.cdt.dsf.gdb.internal.ui.launching;x-friends:="org.eclipse.cdt.debug.gdbjtag.ui,org.eclipse.cdt.examples.dsf.gdb,org.eclipse.cdt.docker.launcher",
org.eclipse.cdt.dsf.gdb.internal.ui.osview;x-internal:=true,
org.eclipse.cdt.dsf.gdb.internal.ui.preferences;x-internal:=true,
org.eclipse.cdt.dsf.gdb.internal.ui.tracepointactions;x-internal:=true,

View file

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>org.eclipse.cdt.docker.launcher-feature</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.pde.FeatureBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.pde.FeatureNature</nature>
</natures>
</projectDescription>

View file

@ -0,0 +1,12 @@
###############################################################################
# Copyright (c) 2015 Red Hat 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:
# Red Hat Inc. - initial API and implementation
###############################################################################
bin.includes = feature.xml,\
feature.properties

View file

@ -0,0 +1,14 @@
#################################################################################
# Copyright (c) 2015 Red Hat, Inc.
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Eclipse Public License v1.0
# which accompanies this distribution, and is available at
# http://www.eclipse.org/legal/epl-v10.html
#
# Contributors:
# Red Hat Incorporated - initial API and implementation
#################################################################################
featureName=C/C++ Docker Container Launch Support
description=Plugins for launching C/C++ applications in Containers.
provider=Eclipse CDT
copyright=Copyright (c) 2015 Red Hat, Inc.\n\ All rights reserved. This program and the accompanying materials\n\ are made available under the terms of the Eclipse Public License v1.0\n\ which accompanies this distribution, and is available at\n\ http://www.eclipse.org/legal/epl-v10.html

View file

@ -0,0 +1,34 @@
<?xml version="1.0" encoding="UTF-8"?>
<feature
id="org.eclipse.cdt.docker.launcher"
label="%featureName"
version="8.7.0.qualifier"
provider-name="%provider"
license-feature="org.eclipse.license"
license-feature-version="0.0.0">
<description>
%description
</description>
<copyright>
%copyright
</copyright>
<license url="%licenseURL">
%license
</license>
<requires>
<import plugin="org.eclipse.linuxtools.docker.core"/>
<import plugin="org.eclipse.linuxtools.docker.ui"/>
</requires>
<plugin
id="org.eclipse.cdt.docker.launcher"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
</feature>

View file

@ -0,0 +1,18 @@
<?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.cdt</groupId>
<artifactId>cdt-parent</artifactId>
<version>8.7.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<groupId>org.eclipse.cdt.features</groupId>
<version>8.7.0-SNAPSHOT</version>
<artifactId>org.eclipse.cdt.docker.launcher</artifactId>
<packaging>eclipse-feature</packaging>
</project>

View file

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>org.eclipse.cdt.docker.launcher.source-feature</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.pde.FeatureBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.pde.FeatureNature</nature>
</natures>
</projectDescription>

View file

@ -0,0 +1,12 @@
###############################################################################
# Copyright (c) 2015 Red Hat 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:
# Red Hat Inc. - initial API and implementation
###############################################################################
bin.includes = feature.xml,\
feature.properties

View file

@ -0,0 +1,14 @@
#################################################################################
# Copyright (c) 2015 Red Hat, Inc.
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Eclipse Public License v1.0
# which accompanies this distribution, and is available at
# http://www.eclipse.org/legal/epl-v10.html
#
# Contributors:
# Red Hat Incorporated - initial API and implementation
#################################################################################
featureName=C/C++ Docker Container Launch Support Source
description=Plugins for launching C/C++ applications in Containers. Source code.
provider=Eclipse CDT
copyright=\ Copyright (c) 2015 Red Hat, Inc.\n\ All rights reserved. This program and the accompanying materials\n\ are made available under the terms of the Eclipse Public License v1.0\n\ which accompanies this distribution, and is available at\n\ http://www.eclipse.org/legal/epl-v10.html

View file

@ -0,0 +1,29 @@
<?xml version="1.0" encoding="UTF-8"?>
<feature
id="org.eclipse.cdt.docker.launcher.source"
label="%featureName"
version="8.7.0.qualifier"
provider-name="%provider"
license-feature="org.eclipse.license"
license-feature-version="0.0.0">
<description>
%description
</description>
<copyright>
%copyright
</copyright>
<license url="%licenseURL">
%license
</license>
<plugin
id="org.eclipse.cdt.docker.launcher.source"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
</feature>

View file

@ -0,0 +1,18 @@
<?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.cdt</groupId>
<artifactId>cdt-parent</artifactId>
<version>8.7.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<groupId>org.eclipse.cdt.features</groupId>
<version>8.7.0-SNAPSHOT</version>
<artifactId>org.eclipse.cdt.docker.launcher.source</artifactId>
<packaging>eclipse-feature</packaging>
</project>

View file

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="output" path="bin"/>
</classpath>

View file

@ -0,0 +1 @@
/bin/

View file

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>org.eclipse.cdt.docker.launcher</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>
</projectDescription>

View file

@ -0,0 +1,291 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
org.eclipse.jdt.core.compiler.compliance=1.7
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.7
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=0
org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0
org.eclipse.jdt.core.formatter.blank_lines_before_imports=1
org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1
org.eclipse.jdt.core.formatter.blank_lines_before_method=1
org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1
org.eclipse.jdt.core.formatter.blank_lines_before_package=0
org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1
org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1
org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line
org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line
org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line
org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line
org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line
org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line
org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line
org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line
org.eclipse.jdt.core.formatter.brace_position_for_lambda_body=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=4
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field=insert
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method=insert
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package=insert
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert
org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_after_type_annotation=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=insert
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert
org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert
org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert
org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert
org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert
org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert
org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert
org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert
org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert
org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert
org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert
org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert
org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert
org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert
org.eclipse.jdt.core.formatter.insert_space_after_lambda_arrow=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_lambda_arrow=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=false
org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false
org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false
org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false
org.eclipse.jdt.core.formatter.lineSplit=80
org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false
org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false
org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0
org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1
org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true
org.eclipse.jdt.core.formatter.tabulation.char=tab
org.eclipse.jdt.core.formatter.tabulation.size=4
org.eclipse.jdt.core.formatter.use_on_off_tags=false
org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false
org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true
org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch=true
org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true

View file

@ -0,0 +1,62 @@
eclipse.preferences.version=1
editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
formatter_profile=org.eclipse.jdt.ui.default.eclipse_profile
formatter_settings_version=12
sp_cleanup.add_default_serial_version_id=true
sp_cleanup.add_generated_serial_version_id=false
sp_cleanup.add_missing_annotations=true
sp_cleanup.add_missing_deprecated_annotations=true
sp_cleanup.add_missing_methods=false
sp_cleanup.add_missing_nls_tags=false
sp_cleanup.add_missing_override_annotations=true
sp_cleanup.add_missing_override_annotations_interface_methods=true
sp_cleanup.add_serial_version_id=false
sp_cleanup.always_use_blocks=true
sp_cleanup.always_use_parentheses_in_expressions=false
sp_cleanup.always_use_this_for_non_static_field_access=false
sp_cleanup.always_use_this_for_non_static_method_access=false
sp_cleanup.convert_functional_interfaces=false
sp_cleanup.convert_to_enhanced_for_loop=false
sp_cleanup.correct_indentation=false
sp_cleanup.format_source_code=true
sp_cleanup.format_source_code_changes_only=true
sp_cleanup.insert_inferred_type_arguments=false
sp_cleanup.make_local_variable_final=true
sp_cleanup.make_parameters_final=false
sp_cleanup.make_private_fields_final=true
sp_cleanup.make_type_abstract_if_missing_method=false
sp_cleanup.make_variable_declarations_final=false
sp_cleanup.never_use_blocks=false
sp_cleanup.never_use_parentheses_in_expressions=true
sp_cleanup.on_save_use_additional_actions=false
sp_cleanup.organize_imports=true
sp_cleanup.qualify_static_field_accesses_with_declaring_class=false
sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
sp_cleanup.qualify_static_member_accesses_with_declaring_class=false
sp_cleanup.qualify_static_method_accesses_with_declaring_class=false
sp_cleanup.remove_private_constructors=true
sp_cleanup.remove_redundant_type_arguments=true
sp_cleanup.remove_trailing_whitespaces=false
sp_cleanup.remove_trailing_whitespaces_all=true
sp_cleanup.remove_trailing_whitespaces_ignore_empty=false
sp_cleanup.remove_unnecessary_casts=true
sp_cleanup.remove_unnecessary_nls_tags=false
sp_cleanup.remove_unused_imports=false
sp_cleanup.remove_unused_local_variables=false
sp_cleanup.remove_unused_private_fields=true
sp_cleanup.remove_unused_private_members=false
sp_cleanup.remove_unused_private_methods=true
sp_cleanup.remove_unused_private_types=true
sp_cleanup.sort_members=false
sp_cleanup.sort_members_all=false
sp_cleanup.use_anonymous_class_creation=false
sp_cleanup.use_blocks=false
sp_cleanup.use_blocks_only_for_return_and_throw=false
sp_cleanup.use_lambda=true
sp_cleanup.use_parentheses_in_expressions=false
sp_cleanup.use_this_for_non_static_field_access=false
sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true
sp_cleanup.use_this_for_non_static_method_access=false
sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true
sp_cleanup.use_type_arguments=false

View file

@ -0,0 +1,30 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %Plugin.name
Bundle-SymbolicName: org.eclipse.cdt.docker.launcher;singleton:=true
Bundle-Version: 1.0.0.qualifier
Bundle-Activator: org.eclipse.cdt.docker.launcher.DockerLaunchUIPlugin
Bundle-Vendor: %Plugin.vendor
Bundle-Localization: plugin
Require-Bundle: org.eclipse.ui,
org.eclipse.core.runtime,
org.eclipse.linuxtools.docker.core;bundle-version="1.0.0",
org.eclipse.linuxtools.docker.ui;bundle-version="1.0.0",
org.eclipse.cdt.launch;bundle-version="7.1.0",
org.eclipse.debug.core;bundle-version="3.9.1",
org.eclipse.debug.ui;bundle-version="3.10.1",
org.eclipse.cdt.core;bundle-version="5.7.0",
org.eclipse.cdt.debug.core;bundle-version="7.5.0",
org.eclipse.cdt.ui;bundle-version="5.8.0",
org.eclipse.ui.ide;bundle-version="3.10.1",
org.eclipse.cdt.debug.mi.ui;bundle-version="6.2.0",
org.eclipse.cdt.debug.mi.core;bundle-version="7.3.0",
org.eclipse.cdt.debug.ui;bundle-version="7.5.0",
org.eclipse.cdt.dsf.gdb;bundle-version="4.6.0",
org.eclipse.cdt.dsf.gdb.ui;bundle-version="2.4.0",
org.eclipse.core.variables
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
Bundle-ActivationPolicy: lazy
Export-Package: org.eclipse.cdt.docker.launcher;x-internal:=true,
org.eclipse.cdt.internal.docker.launcher;x-internal:=true,
org.eclipse.cdt.internal.docker.launcher.ui.preferences;x-internal:=true

View file

@ -0,0 +1,28 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
<title>About</title>
</head>
<body lang="EN-US">
<h2>About This Content</h2>
<p>June 5, 2006</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>

View file

@ -0,0 +1,18 @@
###############################################################################
# Copyright (c) 2015 Red Hat 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:
# Red Hat Inc. - initial API and implementation
###############################################################################
source.. = src/
output.. = bin/
bin.includes = plugin.xml,\
META-INF/,\
.,\
plugin.properties,\
about.html,\
icons/

Binary file not shown.

After

Width:  |  Height:  |  Size: 606 B

View file

@ -0,0 +1,18 @@
###############################################################################
# Copyright (c) 2015 Red Hat 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:
# Red Hat Inc. - initial API and implementation
###############################################################################
Plugin.name=C/C++ Container Launch Plug-in
Plugin.vendor=Eclipse CDT
Delegate.name=C/C++ Container Launcher
Delegate.desc=This launcher runs C/C++ applications in a specified Docker Container. The Container \
must be set-up to supply the C/C++ application what it needs to run.
LaunchConfigurationType.name=C/C++ Container Launcher
Shortcut.label=C/C++ Container Application
DockerLaunchPreferencePage.name=Docker Container Launch

View file

@ -0,0 +1,92 @@
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.0"?>
<plugin
>
<extension
point="org.eclipse.debug.core.launchConfigurationTypes">
<launchConfigurationType
id="org.eclipse.cdt.docker.launcher.launchConfigurationType"
name="%LaunchConfigurationType.name"
public="true">
</launchConfigurationType>
</extension>
<extension point="org.eclipse.debug.core.launchDelegates">
<launchDelegate
id="org.eclipse.cdt.docker.launcher.launchConfigurationType"
type="org.eclipse.cdt.docker.launcher.launchConfigurationType"
modes="run,debug"
name="%LaunchConfigurationType.name"
delegate="org.eclipse.cdt.internal.docker.launcher.ContainerLaunchConfigurationDelegate"
delegateDescription="%Delegate.desc"
sourceLocatorId="org.eclipse.cdt.debug.core.sourceLocator"
sourcePathComputerId="org.eclipse.cdt.debug.core.sourcePathComputer">
</launchDelegate>
</extension>
<extension
point="org.eclipse.debug.ui.launchShortcuts">
<shortcut
class="org.eclipse.cdt.internal.docker.launcher.LaunchShortcut"
icon="icons/c_app.gif"
id="org.eclipse.cdt.docker.launcher.run.shortcut"
label="%Shortcut.label"
modes="run, debug">
<contextualLaunch>
<enablement>
<with variable="selection">
<count value="1"/>
<iterate>
<or>
<instanceof value="org.eclipse.cdt.core.model.IBinary"/>
<instanceof value="org.eclipse.cdt.core.model.ICProject"/>
<test
forcePluginActivation="true"
property="org.eclipse.cdt.launch.isExecutable"/>
<test
forcePluginActivation="true"
property="org.eclipse.cdt.launch.isCProject"/>
<and>
<instanceof value="org.eclipse.ui.IFileEditorInput"/>
<adapt type="org.eclipse.core.resources.IResource">
<adapt type="org.eclipse.cdt.core.model.ICElement"/>
</adapt>
</and>
</or>
</iterate>
</with>
</enablement>
</contextualLaunch>
</shortcut>
</extension>
<extension
point="org.eclipse.ui.preferencePages">
<page
category="org.eclipse.cdt.ui.preferences.CPluginPreferencePage"
class="org.eclipse.cdt.internal.docker.launcher.ui.preferences.DockerLaunchPreferencePage"
id="org.eclipse.cdt.docker.launcher.page1"
name="%DockerLaunchPreferencePage.name">
</page>
</extension>
<extension
point="org.eclipse.debug.ui.launchConfigurationTabGroups">
<launchConfigurationTabGroup
class="org.eclipse.cdt.internal.docker.launcher.ContainerLaunchConfigurationTabGroup"
id="org.eclipse.cdt.docker.launcher.launchConfigurationTabGroup"
type="org.eclipse.cdt.docker.launcher.launchConfigurationType">
</launchConfigurationTabGroup>
</extension>
<extension
point="org.eclipse.core.runtime.preferences">
<initializer
class="org.eclipse.cdt.internal.docker.launcher.ui.preferences.PreferenceInitializer">
</initializer>
</extension>
<extension
point="org.eclipse.debug.ui.launchConfigurationTypeImages">
<launchConfigurationTypeImage
configTypeID="org.eclipse.cdt.docker.launcher.launchConfigurationType"
icon="icons/c_app.gif"
id="org.eclipse.cdt.docker.launcher.launchConfigurationTypeImage1">
</launchConfigurationTypeImage>
</extension>
</plugin>

View file

@ -0,0 +1,17 @@
<?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.cdt</groupId>
<artifactId>cdt-parent</artifactId>
<version>8.7.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<version>1.0.0-SNAPSHOT</version>
<artifactId>org.eclipse.cdt.docker.launcher</artifactId>
<packaging>eclipse-plugin</packaging>
</project>

View file

@ -0,0 +1,159 @@
/*******************************************************************************
* Copyright (c) 2015 Red Hat.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Red Hat - Initial Contribution
*******************************************************************************/
package org.eclipse.cdt.docker.launcher;
import org.eclipse.cdt.internal.docker.launcher.ConnectionListener;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.swt.widgets.Shell;
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 DockerLaunchUIPlugin extends AbstractUIPlugin {
// The plug-in ID
public static final String PLUGIN_ID = "org.eclipse.cdt.docker.launcher"; //$NON-NLS-1$
// The shared instance
private static DockerLaunchUIPlugin plugin;
/**
* The constructor
*/
public DockerLaunchUIPlugin() {
}
/*
* (non-Javadoc)
*
* @see
* org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext
* )
*/
public void start(BundleContext context) throws Exception {
super.start(context);
plugin = this;
ConnectionListener.getInstance().init();
}
/*
* (non-Javadoc)
*
* @see
* org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext
* )
*/
public void stop(BundleContext context) throws Exception {
plugin = null;
super.stop(context);
}
/**
* Returns the shared instance
*
* @return the shared instance
*/
public static DockerLaunchUIPlugin getDefault() {
return plugin;
}
public static Shell getActiveWorkbenchShell() {
IWorkbenchWindow window = getDefault().getWorkbench()
.getActiveWorkbenchWindow();
if (window != null) {
return window.getShell();
}
return null;
}
public static Shell getShell() {
if (getActiveWorkbenchShell() != null) {
return getActiveWorkbenchShell();
}
IWorkbenchWindow[] windows = getDefault().getWorkbench()
.getWorkbenchWindows();
return windows[0].getShell();
}
/**
* Convenience method which returns the unique identifier of this plugin.
*
* @return The identifier.
*/
public static String getUniqueIdentifier() {
if (getDefault() == null) {
// If the default instance is not yet initialized,
// return a static identifier. This identifier must
// match the plugin id defined in plugin.xml
return PLUGIN_ID;
}
return getDefault().getBundle().getSymbolicName();
}
/**
* Logs the specified status with this plug-in's log.
*
* @param status
* status to log
* @since 1.1
*/
public static void log(IStatus status) {
getDefault().getLog().log(status);
}
/**
* Logs an internal error with the specified message.
*
* @param message
* the error message to log
* @since 1.1
*/
public static void logErrorMessage(String message) {
log(new Status(IStatus.ERROR, getUniqueIdentifier(), IStatus.ERROR,
message, null));
}
/**
* Logs an internal error with the specified throwable
*
* @param e
* the exception to be logged
*/
public static void log(Throwable e) {
log(new Status(IStatus.ERROR, getUniqueIdentifier(), IStatus.ERROR,
e.getMessage(), e));
}
public static void log(int status, String msg, Throwable e) {
plugin.getLog().log(new Status(status, PLUGIN_ID, IStatus.OK, msg, e));
}
public static void log(int status, String msg) {
log(status, msg, null);
}
/**
* Returns an image descriptor for the image file at the given plug-in
* relative path
*
* @param path
* the path
* @return the image descriptor
*/
public static ImageDescriptor getImageDescriptor(String path) {
return imageDescriptorFromPlugin(PLUGIN_ID, path);
}
}

View file

@ -0,0 +1,50 @@
package org.eclipse.cdt.internal.docker.launcher;
import org.eclipse.cdt.docker.launcher.DockerLaunchUIPlugin;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.ITreeSelection;
import org.eclipse.linuxtools.docker.core.IDockerConnection;
import org.eclipse.ui.ISelectionListener;
import org.eclipse.ui.IWorkbenchPart;
public class ConnectionListener implements ISelectionListener {
private static ConnectionListener instance;
private IDockerConnection currentConnection;
private ConnectionListener() {
}
public static ConnectionListener getInstance() {
if (instance == null)
instance = new ConnectionListener();
return instance;
}
public void init() {
DockerLaunchUIPlugin.getDefault().getWorkbench()
.getActiveWorkbenchWindow().getSelectionService()
.addSelectionListener(
"org.eclipse.linuxtools.docker.ui.dockerExplorerView", //$NON-NLS-1$
this);
}
public IDockerConnection getCurrentConnection() {
return currentConnection;
}
@Override
public void selectionChanged(IWorkbenchPart part, ISelection selection) {
final ITreeSelection treeSelection = (ITreeSelection) selection;
if (treeSelection.isEmpty()) {
return;
}
final Object firstSegment = treeSelection.getPaths()[0]
.getFirstSegment();
if (firstSegment instanceof IDockerConnection) {
currentConnection = (IDockerConnection) firstSegment;
}
}
}

View file

@ -0,0 +1,361 @@
/*******************************************************************************
* Copyright (c) 2015 Red Hat.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Red Hat - Initial Contribution
*******************************************************************************/
package org.eclipse.cdt.internal.docker.launcher;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants;
import org.eclipse.cdt.docker.launcher.DockerLaunchUIPlugin;
import org.eclipse.cdt.dsf.gdb.IGDBLaunchConfigurationConstants;
import org.eclipse.cdt.dsf.gdb.launching.GdbLaunchDelegate;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.core.variables.VariablesPlugin;
import org.eclipse.debug.core.ILaunch;
import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
import org.eclipse.debug.core.ILaunchManager;
import org.eclipse.debug.core.model.ILaunchConfigurationDelegate;
import org.eclipse.linuxtools.docker.core.IDockerContainerInfo;
import org.eclipse.linuxtools.docker.core.IDockerNetworkSettings;
import org.eclipse.linuxtools.docker.ui.launch.ContainerLauncher;
import org.eclipse.linuxtools.docker.ui.launch.IContainerLaunchListener;
public class ContainerLaunchConfigurationDelegate extends GdbLaunchDelegate
implements ILaunchConfigurationDelegate {
private ContainerLauncher launcher;
private class StartGdbServerJob extends Job implements
IContainerLaunchListener {
private boolean started;
private boolean done;
private IDockerContainerInfo info;
public StartGdbServerJob(String name) {
super(name);
}
@Override
protected IStatus run(IProgressMonitor monitor) {
monitor.beginTask(getName(), IProgressMonitor.UNKNOWN);
while (!done) {
if (monitor.isCanceled()) {
return Status.CANCEL_STATUS;
}
if (started && getIpAddress() != null)
done = true;
try {
Thread.sleep(500);
} catch (InterruptedException e) {
monitor.done();
return Status.CANCEL_STATUS;
}
}
monitor.done();
return Status.OK_STATUS;
}
@Override
public void newOutput(String output) {
if (output.contains(Messages.Gdbserver_up)) {
started = true;
}
}
public String getIpAddress() {
IDockerNetworkSettings networkSettings = info.networkSettings();
return networkSettings.ipAddress();
}
public IDockerContainerInfo getContainerInfo() {
return info;
}
@Override
public void done() {
done = true;
}
@Override
public void containerInfo(IDockerContainerInfo info) {
this.info = info;
}
}
public ContainerLaunchConfigurationDelegate() {
super();
launcher = new ContainerLauncher();
}
@Override
public void launch(ILaunchConfiguration configuration, String mode,
ILaunch launch, IProgressMonitor monitor) throws CoreException {
IPath commandPath = getCommandPath(configuration);
if (commandPath != null) {
if (mode.equals(ILaunchManager.RUN_MODE)) {
String commandDir = commandPath.removeLastSegments(1)
.toString();
StringBuffer b = new StringBuffer();
b.append(commandPath.toString().trim());
String arguments = getProgramArguments(configuration);
if (arguments.trim().length() > 0) {
b.append(" "); //$NON-NLS-1$
b.append(arguments);
}
String command = b.toString();
String workingDir = configuration
.getAttribute(
ICDTLaunchConfigurationConstants.ATTR_WORKING_DIRECTORY,
(String) null);
Map<String, String> envMap = configuration.getAttribute(
ILaunchManager.ATTR_ENVIRONMENT_VARIABLES,
(Map<String, String>) null);
Map<String, String> origEnv = null;
boolean appendEnv = configuration
.getAttribute(
ILaunchManager.ATTR_APPEND_ENVIRONMENT_VARIABLES,
false);
if (appendEnv) {
origEnv = System.getenv();
}
List<String> additionalDirs = configuration.getAttribute(
ILaunchConstants.ATTR_ADDITIONAL_DIRS,
(List<String>) null);
String image = configuration.getAttribute(
ILaunchConstants.ATTR_IMAGE, (String) null);
String connectionUri = configuration.getAttribute(
ILaunchConstants.ATTR_CONNECTION_URI, (String) "");
boolean keepContainer = configuration.getAttribute(
ILaunchConstants.ATTR_KEEP_AFTER_LAUNCH, false);
boolean supportStdin = configuration.getAttribute(
ILaunchConstants.ATTR_STDIN_SUPPORT, false);
launcher.launch(DockerLaunchUIPlugin.PLUGIN_ID, null,
connectionUri,
image, command,
commandDir, workingDir, additionalDirs, origEnv,
envMap, null, keepContainer, supportStdin);
} else if (mode.equals(ILaunchManager.DEBUG_MODE)) {
String gdbserverPortNumber = configuration.getAttribute(
ILaunchConstants.ATTR_GDBSERVER_PORT,
ILaunchConstants.ATTR_GDBSERVER_PORT_DEFAULT);
List<String> ports = Arrays
.asList(gdbserverPortNumber + "/tcp"); //$NON-NLS-1$
String gdbserverCommand = configuration.getAttribute(
ILaunchConstants.ATTR_GDBSERVER_COMMAND,
ILaunchConstants.ATTR_GDBSERVER_COMMAND_DEFAULT);
String commandArguments = ":" + gdbserverPortNumber + " " //$NON-NLS-1$ //$NON-NLS-2$
+ spaceEscapify(commandPath.toString());
String commandDir = commandPath.removeLastSegments(1)
.toString();
StringBuffer b = new StringBuffer();
b.append(gdbserverCommand + " " + commandArguments); //$NON-NLS-1$
String arguments = getProgramArguments(configuration);
if (arguments.trim().length() > 0) {
b.append(" "); //$NON-NLS-1$
b.append(arguments);
}
String command = b.toString();
String workingDir = configuration
.getAttribute(
ICDTLaunchConfigurationConstants.ATTR_WORKING_DIRECTORY,
(String) null);
Map<String, String> envMap = configuration.getAttribute(
ILaunchManager.ATTR_ENVIRONMENT_VARIABLES,
(Map<String, String>) null);
Map<String, String> origEnv = null;
boolean appendEnv = configuration
.getAttribute(
ILaunchManager.ATTR_APPEND_ENVIRONMENT_VARIABLES,
false);
if (appendEnv) {
origEnv = System.getenv();
}
List<String> additionalDirs = configuration.getAttribute(
ILaunchConstants.ATTR_ADDITIONAL_DIRS,
(List<String>) null);
String image = configuration.getAttribute(
ILaunchConstants.ATTR_IMAGE, (String) null);
String connectionUri = configuration.getAttribute(
ILaunchConstants.ATTR_CONNECTION_URI, (String) "");
boolean keepContainer = configuration.getAttribute(
ILaunchConstants.ATTR_KEEP_AFTER_LAUNCH, false);
boolean supportStdin = configuration.getAttribute(
ILaunchConstants.ATTR_STDIN_SUPPORT, false);
StartGdbServerJob job = new StartGdbServerJob(
Messages.Gdbserver_start);
job.schedule();
launcher.launch(DockerLaunchUIPlugin.PLUGIN_ID, job,
connectionUri,
image, command,
commandDir, workingDir, additionalDirs, origEnv,
envMap, ports, keepContainer, supportStdin);
// wait until gdbserver is started successfully and we have its
// ip address or
// gdbserver has failed
try {
job.join();
} catch (InterruptedException e) {
// ignore
}
// if gdbserver started successfully and we have its ip address,
// launch the debugger
if (job.getResult() == Status.OK_STATUS
&& job.getIpAddress() != null) {
// Let debugger know how gdbserver was started on the remote
// container
ILaunchConfigurationWorkingCopy wc = configuration
.getWorkingCopy();
wc.setAttribute(
IGDBLaunchConfigurationConstants.ATTR_REMOTE_TCP,
true);
wc.setAttribute(IGDBLaunchConfigurationConstants.ATTR_HOST,
job.getIpAddress());
wc.setAttribute(IGDBLaunchConfigurationConstants.ATTR_PORT,
gdbserverPortNumber);
wc.doSave();
try {
super.launch(configuration, mode, launch, monitor);
} catch (CoreException ex) {
// launch failed, need to cleanup any container we
// created for the gdbserver
launcher.cleanup(connectionUri, job.getContainerInfo());
throw ex;
} finally {
monitor.done();
}
}
}
}
}
/**
* Get the program arguments and perform substitution.
*
* @param config
* launch configuration
* @return argument String
* @throws CoreException
*/
private String getProgramArguments(ILaunchConfiguration config)
throws CoreException {
String args = config.getAttribute(
ICDTLaunchConfigurationConstants.ATTR_PROGRAM_ARGUMENTS,
(String) "");
if (args != null && args.length() > 0) {
args = VariablesPlugin.getDefault().getStringVariableManager()
.performStringSubstitution(args);
}
return args;
}
/**
* Form command path using the project and program name.
*
* @param configuration
* @return command path
* @throws CoreException
*/
private IPath getCommandPath(ILaunchConfiguration configuration)
throws CoreException {
String projectName = configuration.getAttribute(
ICDTLaunchConfigurationConstants.ATTR_PROJECT_NAME, "");
if (projectName.length() > 0) {
IProject project = CCorePlugin.getWorkspace().getRoot()
.getProject(projectName);
if (project == null)
return null;
String name = configuration.getAttribute(
ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME, "");
if (name.length() == 0)
return null;
IPath exePath = new Path(name);
if (!exePath.isAbsolute()) {
IPath location = project.getLocation();
if (location == null) {
return null;
}
exePath = location.append(name);
if (!exePath.toFile().exists()) {
// Try the old way, which is required to support linked
// resources.
IFile projFile = null;
try {
projFile = project.getFile(name);
} catch (IllegalArgumentException e) {
// thrown if relative path that resolves to a root file
// ("..\somefile")
}
if (projFile == null || !projFile.exists()) {
return null;
} else {
exePath = projFile.getLocation();
}
}
}
if (!exePath.toFile().exists()) {
return null;
}
if (!exePath.toFile().isFile()) {
return null;
}
return exePath;
} else {
return null;
}
}
private String spaceEscapify(String inputString) {
if (inputString == null)
return null;
return inputString.replaceAll(" ", "\\\\ "); //$NON-NLS-1$ //$NON-NLS-2$
}
@Override
protected String getPluginID() {
return DockerLaunchUIPlugin.PLUGIN_ID;
}
}

View file

@ -0,0 +1,47 @@
/*******************************************************************************
* Copyright (c) 2008, 2015 Red Hat, Inc.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Elliott Baron <ebaron@redhat.com> - initial API and implementation
* Red Hat Inc. - modified for use in container launching
*******************************************************************************/
package org.eclipse.cdt.internal.docker.launcher;
import java.util.ArrayList;
import org.eclipse.cdt.launch.ui.CArgumentsTab;
import org.eclipse.cdt.launch.ui.CMainTab2;
import org.eclipse.debug.core.ILaunchManager;
import org.eclipse.debug.ui.AbstractLaunchConfigurationTab;
import org.eclipse.debug.ui.AbstractLaunchConfigurationTabGroup;
import org.eclipse.debug.ui.CommonTab;
import org.eclipse.debug.ui.EnvironmentTab;
import org.eclipse.debug.ui.ILaunchConfigurationDialog;
import org.eclipse.debug.ui.sourcelookup.SourceLookupTab;
public class ContainerLaunchConfigurationTabGroup extends
AbstractLaunchConfigurationTabGroup {
@Override
public void createTabs(ILaunchConfigurationDialog dialog, String mode) {
ArrayList<AbstractLaunchConfigurationTab> tabs = new ArrayList<>();
tabs.add(new CMainTab2());
tabs.add(new CArgumentsTab());
tabs.add(new ContainerTab());
tabs.add(new EnvironmentTab());
if (mode.equals(ILaunchManager.DEBUG_MODE))
tabs.add(new RemoteDebuggerTab());
tabs.add(new SourceLookupTab());
tabs.add(new CommonTab());
setTabs(tabs.toArray(new AbstractLaunchConfigurationTab[tabs.size()]));
}
}

View file

@ -0,0 +1,530 @@
/*******************************************************************************
* Copyright (c) 2015 Red Hat.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Red Hat - Initial Contribution
*******************************************************************************/
package org.eclipse.cdt.internal.docker.launcher;
import java.util.ArrayList;
import java.util.Arrays;
import org.eclipse.cdt.docker.launcher.DockerLaunchUIPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.preferences.InstanceScope;
import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
import org.eclipse.debug.ui.AbstractLaunchConfigurationTab;
import org.eclipse.linuxtools.docker.core.DockerConnectionManager;
import org.eclipse.linuxtools.docker.core.IDockerConnection;
import org.eclipse.linuxtools.docker.core.IDockerConnectionManagerListener;
import org.eclipse.linuxtools.docker.core.IDockerImage;
import org.eclipse.linuxtools.docker.core.IDockerImageListener;
import org.eclipse.swt.SWT;
import org.eclipse.swt.accessibility.AccessibleAdapter;
import org.eclipse.swt.accessibility.AccessibleEvent;
import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.events.VerifyEvent;
import org.eclipse.swt.events.VerifyListener;
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.Button;
import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.DirectoryDialog;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.List;
import org.osgi.service.prefs.Preferences;
public class ContainerTab extends AbstractLaunchConfigurationTab implements
IDockerConnectionManagerListener, IDockerImageListener {
private List directoriesList;
private String imageName;
private String connectionName;
private String connectionUri;
private Boolean keepValue;
private Boolean stdinValue;
private IDockerConnection connection;
private IDockerConnection[] connections;
private IDockerImageListener containerTab;
private Button newButton;
private Button removeButton;
private Button keepButton;
private Button stdinButton;
private Combo imageCombo;
private Combo connectionSelector;
private ModifyListener connectionModifyListener = new ModifyListener() {
@Override
public void modifyText(ModifyEvent e) {
int index = connectionSelector.getSelectionIndex();
if (connection != null)
connection.removeImageListener(containerTab);
connection = connections[index];
if (!connectionName.equals(connection.getName()))
updateLaunchConfigurationDialog();
connectionName = connection.getName();
connectionUri = connection.getUri();
connection.addImageListener(containerTab);
}
};
public ContainerTab() {
super();
containerTab = this;
}
@Override
public void createControl(Composite parent) {
Font font = parent.getFont();
Composite mainComposite = createComposite(parent, 3, 1,
GridData.FILL_HORIZONTAL);
mainComposite.setFont(font);
setControl(mainComposite);
Label connectionSelectorLabel = new Label(mainComposite, SWT.NULL);
connectionSelectorLabel
.setText(Messages.ContainerTab_Connection_Selector_Label);
connectionSelector = new Combo(mainComposite, SWT.BORDER
| SWT.READ_ONLY);
initializeConnectionSelector();
connectionSelector.addModifyListener(connectionModifyListener);
// Following is a kludge so that on Linux the Combo is read-only but
// has a white background.
connectionSelector.addVerifyListener(new VerifyListener() {
@Override
public void verifyText(VerifyEvent e) {
e.doit = false;
}
});
GridData gd = new GridData();
gd.horizontalSpan = 2;
connectionSelector.setLayoutData(gd);
Label imageSelectorLabel = new Label(mainComposite, SWT.NULL);
imageSelectorLabel.setText(Messages.ContainerTab_Image_Selector_Label);
imageCombo = new Combo(mainComposite, SWT.DROP_DOWN);
imageCombo.setLayoutData(gd);
initializeImageCombo();
imageCombo.addSelectionListener(new SelectionListener() {
@Override
public void widgetSelected(SelectionEvent e) {
if (!imageName.equals(imageCombo.getText()))
updateLaunchConfigurationDialog();
imageName = imageCombo.getText();
}
@Override
public void widgetDefaultSelected(SelectionEvent e) {
}
});
createDirectoryList(mainComposite);
createButtons(mainComposite);
createOptions(mainComposite);
}
private void createDirectoryList(Composite parent) {
Composite comp = createComposite(parent, 1, 2, GridData.FILL_BOTH);
Group group = new Group(comp, SWT.NONE);
Font font = parent.getFont();
group.setFont(font);
group.setText(Messages.ContainerTab_Group_Name);
GridData gd2 = new GridData(GridData.FILL_BOTH);
group.setLayoutData(gd2);
group.setLayout(new GridLayout());
directoriesList = new List(group, SWT.SINGLE | SWT.V_SCROLL);
GridData gd3 = new GridData(GridData.FILL_BOTH);
directoriesList.setLayoutData(gd3);
directoriesList.setFont(font);
directoriesList.addSelectionListener(new SelectionListener() {
@Override
public void widgetSelected(SelectionEvent e) {
removeButton.setEnabled(true);
}
@Override
public void widgetDefaultSelected(SelectionEvent e) {
// TODO Auto-generated method stub
}
});
}
private void createButtons(Composite parent) {
Font font = parent.getFont();
Composite composite = createComposite(parent, 1, 1,
GridData.VERTICAL_ALIGN_BEGINNING
| GridData.HORIZONTAL_ALIGN_END);
composite.setFont(font);
newButton = createPushButton(composite,
Messages.ContainerTab_New_Button, null); //$NON-NLS-1$
newButton.setLayoutData(new GridData(GridData.FILL_BOTH));
GridData gdb = new GridData(GridData.VERTICAL_ALIGN_CENTER);
gdb.grabExcessHorizontalSpace = false;
gdb.horizontalAlignment = SWT.FILL;
gdb.minimumWidth = 120;
newButton.setLayoutData(gdb);
newButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent arg0) {
handleNewButtonSelected(directoriesList);
}
});
removeButton = createPushButton(composite,
Messages.ContainerTab_Remove_Button, null); //$NON-NLS-1$
removeButton.setLayoutData(new GridData(GridData.FILL_BOTH));
removeButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent arg0) {
handleRemoveButtonSelected(directoriesList);
}
});
removeButton.setEnabled(false);
}
private void createOptions(Composite parent) {
Font font = parent.getFont();
Composite comp = createComposite(parent, 1, 3, GridData.FILL_BOTH);
Group group = new Group(comp, SWT.NONE);
group.setFont(font);
group.setText(Messages.ContainerTab_Option_Group_Name);
GridData gd2 = new GridData(GridData.FILL_BOTH);
group.setLayoutData(gd2);
group.setLayout(new GridLayout());
Preferences prefs = InstanceScope.INSTANCE.getNode(DockerLaunchUIPlugin.PLUGIN_ID);
keepButton = createCheckButton(group, Messages.ContainerTab_Keep_Label);
keepButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
Boolean keepPref = prefs.getBoolean(
PreferenceConstants.KEEP_CONTAINER_AFTER_LAUNCH, false);
keepButton.setSelection(keepPref);
keepValue = keepPref;
keepButton.addSelectionListener(new SelectionListener() {
@Override
public void widgetSelected(SelectionEvent e) {
if (!keepValue.equals(keepButton.getSelection()))
updateLaunchConfigurationDialog();
keepValue = keepButton.getSelection();
}
@Override
public void widgetDefaultSelected(SelectionEvent e) {
}
});
stdinButton = createCheckButton(group,
Messages.ContainerTab_Stdin_Support_Label);
stdinButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
stdinValue = false;
stdinButton.addSelectionListener(new SelectionListener() {
@Override
public void widgetSelected(SelectionEvent e) {
if (!stdinValue.equals(stdinButton.getSelection()))
updateLaunchConfigurationDialog();
stdinValue = stdinButton.getSelection();
}
@Override
public void widgetDefaultSelected(SelectionEvent e) {
}
});
}
private Composite createComposite(Composite parent, int columns, int hspan,
int fill) {
Composite g = new Composite(parent, SWT.NONE);
g.setLayout(new GridLayout(columns, false));
g.setFont(parent.getFont());
GridData gd = new GridData(fill);
gd.horizontalSpan = hspan;
g.setLayoutData(gd);
return g;
}
/**
* A New entry button has been pressed for the given text field. Prompt the
* user for a directory to add and enter the result in the given field.
*/
protected void handleNewButtonSelected(List list) {
String directory = getDirectory();
if (directory != null) {
list.add(directory);
updateLaunchConfigurationDialog();
}
}
/**
* Prompts the user to choose and configure a variable and returns the
* resulting string, suitable to be used as an attribute.
*/
private String getDirectory() {
DirectoryDialog dialog = new DirectoryDialog(getShell());
return dialog.open();
}
/**
* The remove entry button has been pressed for the given text field. Remove
* the currently selected directory.
*/
protected void handleRemoveButtonSelected(List list) {
int index = list.getSelectionIndex();
list.remove(index);
updateLaunchConfigurationDialog();
removeButton.setEnabled(false);
}
private void initializeConnectionSelector() {
int defaultIndex = -1;
connections = DockerConnectionManager.getInstance().getConnections();
if (connections.length == 0) {
setErrorMessage(Messages.ContainerTab_Error_No_Connections);
return;
}
String[] connectionNames = new String[connections.length];
for (int i = 0; i < connections.length; ++i) {
connectionNames[i] = connections[i].getName();
if (connections[i].getUri().equals(connectionUri))
defaultIndex = i;
}
if (defaultIndex < 0) {
setWarningMessage(Messages.bind(
Messages.ContainerTab_Warning_Connection_Not_Found,
connectionUri, connections[0].getName()));
defaultIndex = 0;
}
connectionSelector.setItems(connectionNames);
if (connections.length > 0) {
connectionSelector.setText(connectionNames[defaultIndex]);
connection = connections[defaultIndex];
connectionUri = connection.getUri();
}
}
private void initializeImageCombo() {
if (connection != null) {
java.util.List<IDockerImage> images = connection.getImages();
if (images == null || images.size() == 0) {
setErrorMessage(Messages.ContainerTab_Error_No_Images);
return;
}
connection.removeImageListener(containerTab);
ArrayList<String> imageNames = new ArrayList<String>();
for (IDockerImage image : images) {
java.util.List<String> tags = image.repoTags();
if (tags != null) {
for (String tag : tags) {
if (!tag.equals("<none>:<none>")) //$NON-NLS-1$
imageNames.add(tag);
}
}
}
imageCombo.setItems(imageNames.toArray(new String[0]));
if (imageName != null)
imageCombo.setText(imageName);
connection.addImageListener(containerTab);
}
}
public void addControlAccessibleListener(Control control, String controlName) {
// Strip mnemonic (&)
String[] strs = controlName.split("&"); //$NON-NLS-1$
StringBuffer stripped = new StringBuffer();
for (int i = 0; i < strs.length; i++) {
stripped.append(strs[i]);
}
control.getAccessible().addAccessibleListener(
new ControlAccessibleListener(stripped.toString()));
}
private class ControlAccessibleListener extends AccessibleAdapter {
private String controlName;
ControlAccessibleListener(String name) {
controlName = name;
}
@Override
public void getName(AccessibleEvent e) {
e.result = controlName;
}
}
@Override
public void setDefaults(ILaunchConfigurationWorkingCopy configuration) {
configuration.setAttribute(ILaunchConstants.ATTR_ADDITIONAL_DIRS,
(String) null);
configuration.setAttribute(ILaunchConstants.ATTR_CONNECTION_URI, ""); //$NON-NLS-1$
Preferences prefs = InstanceScope.INSTANCE
.getNode(DockerLaunchUIPlugin.PLUGIN_ID);
String image = prefs.get(PreferenceConstants.DEFAULT_IMAGE, ""); //$NON-NLS-1$
configuration.setAttribute(ILaunchConstants.ATTR_IMAGE, image);
Boolean keepContainer = prefs.getBoolean(
PreferenceConstants.KEEP_CONTAINER_AFTER_LAUNCH, false);
configuration.setAttribute(ILaunchConstants.ATTR_KEEP_AFTER_LAUNCH,
keepContainer);
configuration.setAttribute(ILaunchConstants.ATTR_STDIN_SUPPORT, false);
}
@Override
public void initializeFrom(ILaunchConfiguration configuration) {
try {
java.util.List<String> additionalDirs = configuration.getAttribute(
ILaunchConstants.ATTR_ADDITIONAL_DIRS,
(java.util.List<String>) null);
if (additionalDirs != null)
directoriesList.setItems(additionalDirs.toArray(new String[0]));
connectionUri = configuration.getAttribute(
ILaunchConstants.ATTR_CONNECTION_URI, (String) "");
imageName = configuration.getAttribute(ILaunchConstants.ATTR_IMAGE,
"");
imageCombo.setText(imageName);
keepValue = configuration.getAttribute(
ILaunchConstants.ATTR_KEEP_AFTER_LAUNCH, false);
keepButton.setSelection(keepValue);
stdinValue = configuration.getAttribute(
ILaunchConstants.ATTR_STDIN_SUPPORT, false);
stdinButton.setSelection(stdinValue);
} catch (CoreException e) {
setErrorMessage(Messages.bind(
Messages.ContainerTab_Error_Reading_Configuration, e
.getStatus().getMessage())); //$NON-NLS-1$
DockerLaunchUIPlugin.log(e);
}
}
@Override
public void performApply(ILaunchConfigurationWorkingCopy configuration) {
String[] dirs = directoriesList.getItems();
configuration.setAttribute(ILaunchConstants.ATTR_ADDITIONAL_DIRS,
Arrays.asList(dirs));
String image = imageCombo.getText();
configuration.setAttribute(ILaunchConstants.ATTR_IMAGE, image);
configuration.setAttribute(ILaunchConstants.ATTR_CONNECTION_URI,
connectionUri);
configuration.setAttribute(ILaunchConstants.ATTR_KEEP_AFTER_LAUNCH,
keepButton.getSelection());
configuration.setAttribute(ILaunchConstants.ATTR_STDIN_SUPPORT,
stdinButton.getSelection());
}
@Override
public boolean isValid(ILaunchConfiguration launchConfig) {
try {
return launchConfig.getAttribute(ILaunchConstants.ATTR_IMAGE,
(String) null) != null;
} catch (CoreException e) {
return false;
}
}
@Override
public String getName() {
return Messages.ContainerTab_Name;
}
@Override
public Image getImage() {
return SWTImagesFactory.get(SWTImagesFactory.IMG_DOCKER_SMALL);
}
@Override
public void changeEvent(int type) {
String currUri = null;
int currIndex = 0;
connections = DockerConnectionManager.getInstance().getConnections();
if (connection != null) {
currUri = connection.getUri();
currIndex = connectionSelector.getSelectionIndex();
}
String[] connectionNames = new String[connections.length];
int index = 0;
for (int i = 0; i < connections.length; ++i) {
connectionNames[i] = connections[i].getName();
if (connections[i].getUri().equals(currUri))
index = i;
}
if (type == IDockerConnectionManagerListener.RENAME_EVENT) {
index = currIndex; // no change in connection displayed
}
connectionSelector.removeModifyListener(connectionModifyListener);
connectionSelector.setItems(connectionNames);
if (connectionNames.length > 0) {
connectionSelector.setText(connectionNames[index]);
connection = connections[index];
connectionUri = connection.getUri();
} else {
connection = null;
connectionUri = "";
connectionSelector.setText("");
}
connectionSelector.addModifyListener(connectionModifyListener);
}
public void listChanged(IDockerConnection c,
java.util.List<IDockerImage> list) {
final IDockerImage[] finalList = list.toArray(new IDockerImage[0]);
if (c.getName().equals(connection.getName())) {
Display.getDefault().syncExec(new Runnable() {
@Override
public void run() {
connection.removeImageListener(containerTab);
ArrayList<String> imageNames = new ArrayList<String>();
for (IDockerImage image : finalList) {
java.util.List<String> tags = image.repoTags();
if (tags != null) {
for (String tag : tags) {
imageNames.add(tag);
}
}
}
if (!imageCombo.isDisposed())
imageCombo.setItems(imageNames.toArray(new String[0]));
connection.addImageListener(containerTab);
}
});
}
}
@Override
public void dispose() {
if (connection != null)
connection.removeImageListener(containerTab);
super.dispose();
}
}

View file

@ -0,0 +1,522 @@
/*******************************************************************************
* Copyright (c) 2000, 2015 QNX Software Systems and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* QNX Software Systems - Initial API and implementation
* Red Hat Inc. - adapted for use in CDT docker launcher
*******************************************************************************/
package org.eclipse.cdt.internal.docker.launcher;
import java.io.File;
import java.util.Observable;
import java.util.Observer;
import org.eclipse.cdt.debug.ui.AbstractCDebuggerPage;
import org.eclipse.cdt.dsf.gdb.IGDBLaunchConfigurationConstants;
import org.eclipse.cdt.dsf.gdb.IGdbDebugPreferenceConstants;
import org.eclipse.cdt.dsf.gdb.internal.ui.GdbUIPlugin;
import org.eclipse.cdt.dsf.gdb.internal.ui.launching.GDBSolibBlock;
import org.eclipse.cdt.dsf.gdb.internal.ui.launching.IMILaunchConfigurationComponent;
import org.eclipse.cdt.dsf.gdb.internal.ui.launching.SolibSearchPathBlock;
import org.eclipse.cdt.utils.ui.controls.ControlFactory;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
import org.eclipse.jface.preference.IPreferenceStore;
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.events.SelectionListener;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.FileDialog;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.TabFolder;
import org.eclipse.swt.widgets.TabItem;
import org.eclipse.swt.widgets.Text;
import org.eclipse.ui.PlatformUI;
/**
* The dynamic tab for gdb-based debugger implementations.
*/
public class GdbDebuggerPage extends AbstractCDebuggerPage implements Observer {
protected TabFolder fTabFolder;
protected Text fGDBCommandText;
protected Text fGDBInitText;
protected Button fNonStopCheckBox;
protected Button fReverseCheckBox;
protected Button fUpdateThreadlistOnSuspend;
protected Button fDebugOnFork;
/**
* A combo box to let the user choose if fast tracepoints should be used or not.
*/
protected Combo fTracepointModeCombo;
protected static final String TP_FAST_ONLY = Messages.GDBDebuggerPage_tracepoint_mode_fast;
protected static final String TP_NORMAL_ONLY = Messages.GDBDebuggerPage_tracepoint_mode_normal;
protected static final String TP_AUTOMATIC = Messages.GDBDebuggerPage_tracepoint_mode_auto;
private IMILaunchConfigurationComponent fSolibBlock;
private boolean fIsInitializing = false;
@Override
public void createControl(Composite parent) {
Composite comp = new Composite(parent, SWT.NONE);
comp.setLayout(new GridLayout());
comp.setLayoutData(new GridData(GridData.FILL_BOTH));
fTabFolder = new TabFolder(comp, SWT.NONE);
fTabFolder.setLayoutData(
new GridData(GridData.FILL_BOTH | GridData.GRAB_VERTICAL));
createTabs(fTabFolder);
fTabFolder.setSelection(0);
setControl(parent);
}
@Override
public void setDefaults(ILaunchConfigurationWorkingCopy configuration) {
IPreferenceStore preferenceStore = GdbUIPlugin.getDefault()
.getPreferenceStore();
configuration.setAttribute(
IGDBLaunchConfigurationConstants.ATTR_DEBUG_NAME,
preferenceStore.getString(
IGdbDebugPreferenceConstants.PREF_DEFAULT_GDB_COMMAND));
configuration.setAttribute(
IGDBLaunchConfigurationConstants.ATTR_GDB_INIT,
preferenceStore.getString(
IGdbDebugPreferenceConstants.PREF_DEFAULT_GDB_INIT));
configuration.setAttribute(
IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_NON_STOP,
preferenceStore.getBoolean(
IGdbDebugPreferenceConstants.PREF_DEFAULT_NON_STOP));
configuration.setAttribute(
IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_REVERSE,
IGDBLaunchConfigurationConstants.DEBUGGER_REVERSE_DEFAULT);
configuration.setAttribute(
IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_UPDATE_THREADLIST_ON_SUSPEND,
IGDBLaunchConfigurationConstants.DEBUGGER_UPDATE_THREADLIST_ON_SUSPEND_DEFAULT);
configuration.setAttribute(
IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_DEBUG_ON_FORK,
IGDBLaunchConfigurationConstants.DEBUGGER_DEBUG_ON_FORK_DEFAULT);
configuration.setAttribute(
IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_TRACEPOINT_MODE,
IGDBLaunchConfigurationConstants.DEBUGGER_TRACEPOINT_MODE_DEFAULT);
if (fSolibBlock != null)
fSolibBlock.setDefaults(configuration);
}
@Override
public boolean isValid(ILaunchConfiguration launchConfig) {
boolean valid = fGDBCommandText.getText().length() != 0;
if (valid) {
setErrorMessage(null);
setMessage(null);
} else {
setErrorMessage(Messages.GDBDebuggerPage0); // $NON-NLS-1$
setMessage(null);
}
return valid;
}
/** utility method to cut down on clutter */
private String getStringAttr(ILaunchConfiguration config,
String attributeName, String defaultValue) {
try {
return config.getAttribute(attributeName, defaultValue);
} catch (CoreException e) {
return defaultValue;
}
}
/** utility method to cut down on clutter */
private boolean getBooleanAttr(ILaunchConfiguration config,
String attributeName, boolean defaultValue) {
try {
return config.getAttribute(attributeName, defaultValue);
} catch (CoreException e) {
return defaultValue;
}
}
@Override
public void initializeFrom(ILaunchConfiguration configuration) {
setInitializing(true);
IPreferenceStore preferenceStore = GdbUIPlugin.getDefault()
.getPreferenceStore();
String gdbCommand = getStringAttr(configuration,
IGDBLaunchConfigurationConstants.ATTR_DEBUG_NAME,
preferenceStore.getString(
IGdbDebugPreferenceConstants.PREF_DEFAULT_GDB_COMMAND));
String gdbInit = getStringAttr(configuration,
IGDBLaunchConfigurationConstants.ATTR_GDB_INIT,
preferenceStore.getString(
IGdbDebugPreferenceConstants.PREF_DEFAULT_GDB_INIT));
boolean nonStopMode = getBooleanAttr(configuration,
IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_NON_STOP,
preferenceStore.getBoolean(
IGdbDebugPreferenceConstants.PREF_DEFAULT_NON_STOP));
boolean reverseEnabled = getBooleanAttr(configuration,
IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_REVERSE,
IGDBLaunchConfigurationConstants.DEBUGGER_REVERSE_DEFAULT);
boolean updateThreadsOnSuspend = getBooleanAttr(configuration,
IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_UPDATE_THREADLIST_ON_SUSPEND,
IGDBLaunchConfigurationConstants.DEBUGGER_UPDATE_THREADLIST_ON_SUSPEND_DEFAULT);
boolean debugOnFork = getBooleanAttr(configuration,
IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_DEBUG_ON_FORK,
IGDBLaunchConfigurationConstants.DEBUGGER_DEBUG_ON_FORK_DEFAULT);
if (fSolibBlock != null)
fSolibBlock.initializeFrom(configuration);
fGDBCommandText.setText(gdbCommand);
fGDBInitText.setText(gdbInit);
fNonStopCheckBox.setSelection(nonStopMode);
fReverseCheckBox.setSelection(reverseEnabled);
fUpdateThreadlistOnSuspend.setSelection(updateThreadsOnSuspend);
fDebugOnFork.setSelection(debugOnFork);
updateTracepointModeFromConfig(configuration);
setInitializing(false);
}
protected void updateTracepointModeFromConfig(ILaunchConfiguration config) {
if (fTracepointModeCombo != null) {
String tracepointMode = getStringAttr(config,
IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_TRACEPOINT_MODE,
IGDBLaunchConfigurationConstants.DEBUGGER_TRACEPOINT_MODE_DEFAULT);
if (tracepointMode.equals(
IGDBLaunchConfigurationConstants.DEBUGGER_TRACEPOINT_NORMAL_ONLY)) {
fTracepointModeCombo.setText(TP_NORMAL_ONLY);
} else if (tracepointMode.equals(
IGDBLaunchConfigurationConstants.DEBUGGER_TRACEPOINT_FAST_ONLY)) {
fTracepointModeCombo.setText(TP_FAST_ONLY);
} else if (tracepointMode.equals(
IGDBLaunchConfigurationConstants.DEBUGGER_TRACEPOINT_FAST_THEN_NORMAL)) {
fTracepointModeCombo.setText(TP_AUTOMATIC);
} else {
assert false : "Unknown Tracepoint Mode: " + tracepointMode; // //$NON-NLS-1$
fTracepointModeCombo.setText(TP_NORMAL_ONLY);
}
}
}
protected String getSelectedTracepointMode() {
if (fTracepointModeCombo != null) {
int selectedIndex = fTracepointModeCombo.getSelectionIndex();
if (fTracepointModeCombo.getItem(selectedIndex)
.equals(TP_NORMAL_ONLY)) {
return IGDBLaunchConfigurationConstants.DEBUGGER_TRACEPOINT_NORMAL_ONLY;
} else if (fTracepointModeCombo.getItem(selectedIndex)
.equals(TP_FAST_ONLY)) {
return IGDBLaunchConfigurationConstants.DEBUGGER_TRACEPOINT_FAST_ONLY;
} else if (fTracepointModeCombo.getItem(selectedIndex)
.equals(TP_AUTOMATIC)) {
return IGDBLaunchConfigurationConstants.DEBUGGER_TRACEPOINT_FAST_THEN_NORMAL;
} else {
assert false : "Unknown Tracepoint mode: " //$NON-NLS-1$
+ fTracepointModeCombo.getItem(selectedIndex);
}
}
return IGDBLaunchConfigurationConstants.DEBUGGER_TRACEPOINT_MODE_DEFAULT;
}
@Override
public void performApply(ILaunchConfigurationWorkingCopy configuration) {
configuration.setAttribute(
IGDBLaunchConfigurationConstants.ATTR_DEBUG_NAME,
fGDBCommandText.getText().trim());
configuration.setAttribute(
IGDBLaunchConfigurationConstants.ATTR_GDB_INIT,
fGDBInitText.getText().trim());
configuration.setAttribute(
IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_NON_STOP,
fNonStopCheckBox.getSelection());
configuration.setAttribute(
IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_REVERSE,
fReverseCheckBox.getSelection());
configuration.setAttribute(
IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_UPDATE_THREADLIST_ON_SUSPEND,
fUpdateThreadlistOnSuspend.getSelection());
configuration.setAttribute(
IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_DEBUG_ON_FORK,
fDebugOnFork.getSelection());
if (fTracepointModeCombo != null) {
configuration.setAttribute(
IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_TRACEPOINT_MODE,
getSelectedTracepointMode());
}
if (fSolibBlock != null)
fSolibBlock.performApply(configuration);
}
@Override
public String getName() {
return Messages.GDBDebuggerPage1;
}
/**
* @see org.eclipse.debug.ui.AbstractLaunchConfigurationTab#getShell()
*/
@Override
protected Shell getShell() {
return super.getShell();
}
/**
* @see org.eclipse.debug.ui.AbstractLaunchConfigurationTab#updateLaunchConfigurationDialog()
*/
@Override
protected void updateLaunchConfigurationDialog() {
super.updateLaunchConfigurationDialog();
}
/*
* (non-Javadoc)
*
* @see java.util.Observer#update(java.util.Observable, java.lang.Object)
*/
@Override
public void update(Observable o, Object arg) {
if (!isInitializing())
updateLaunchConfigurationDialog();
}
public IMILaunchConfigurationComponent createSolibBlock(Composite parent) {
IMILaunchConfigurationComponent block = new GDBSolibBlock(
new SolibSearchPathBlock(), true, true);
block.createControl(parent);
return block;
}
public void createTabs(TabFolder tabFolder) {
createMainTab(tabFolder);
createSolibTab(tabFolder);
}
public void createMainTab(TabFolder tabFolder) {
TabItem tabItem = new TabItem(tabFolder, SWT.NONE);
tabItem.setText(Messages.GDBDebuggerPage_main_tab_name);
Composite comp = ControlFactory.createCompositeEx(tabFolder, 1,
GridData.FILL_BOTH);
((GridLayout) comp.getLayout()).makeColumnsEqualWidth = false;
comp.setFont(tabFolder.getFont());
tabItem.setControl(comp);
Composite subComp = ControlFactory.createCompositeEx(comp, 3,
GridData.FILL_HORIZONTAL);
((GridLayout) subComp.getLayout()).makeColumnsEqualWidth = false;
subComp.setFont(tabFolder.getFont());
Label label = ControlFactory.createLabel(subComp,
Messages.GDBDebuggerPage_gdb_debugger);
GridData gd = new GridData();
// gd.horizontalSpan = 2;
label.setLayoutData(gd);
fGDBCommandText = ControlFactory.createTextField(subComp,
SWT.SINGLE | SWT.BORDER);
fGDBCommandText.addModifyListener(new ModifyListener() {
@Override
public void modifyText(ModifyEvent evt) {
if (!isInitializing())
updateLaunchConfigurationDialog();
}
});
Button button = createPushButton(subComp,
Messages.GDBDebuggerPage_gdb_browse, null);
button.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent evt) {
handleGDBButtonSelected();
updateLaunchConfigurationDialog();
}
private void handleGDBButtonSelected() {
FileDialog dialog = new FileDialog(getShell(), SWT.NONE);
dialog.setText(Messages.GDBDebuggerPage_gdb_browse_dlg_title);
String gdbCommand = fGDBCommandText.getText().trim();
int lastSeparatorIndex = gdbCommand.lastIndexOf(File.separator);
if (lastSeparatorIndex != -1) {
dialog.setFilterPath(
gdbCommand.substring(0, lastSeparatorIndex));
}
String res = dialog.open();
if (res == null) {
return;
}
fGDBCommandText.setText(res);
}
});
label = ControlFactory.createLabel(subComp,
Messages.GDBDebuggerPage_gdb_command_file);
gd = new GridData();
// gd.horizontalSpan = 2;
label.setLayoutData(gd);
fGDBInitText = ControlFactory.createTextField(subComp,
SWT.SINGLE | SWT.BORDER);
gd = new GridData(GridData.FILL_HORIZONTAL);
fGDBInitText.setLayoutData(gd);
fGDBInitText.addModifyListener(new ModifyListener() {
@Override
public void modifyText(ModifyEvent evt) {
if (!isInitializing())
updateLaunchConfigurationDialog();
}
});
button = createPushButton(subComp,
Messages.GDBDebuggerPage_gdb_cmdfile_browse, null);
button.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent evt) {
handleGDBInitButtonSelected();
updateLaunchConfigurationDialog();
}
private void handleGDBInitButtonSelected() {
FileDialog dialog = new FileDialog(getShell(), SWT.NONE);
dialog.setText(Messages.GDBDebuggerPage_gdb_cmdfile_dlg_title);
String gdbCommand = fGDBInitText.getText().trim();
int lastSeparatorIndex = gdbCommand.lastIndexOf(File.separator);
if (lastSeparatorIndex != -1) {
dialog.setFilterPath(
gdbCommand.substring(0, lastSeparatorIndex));
}
String res = dialog.open();
if (res == null) {
return;
}
fGDBInitText.setText(res);
}
});
label = ControlFactory.createLabel(subComp,
Messages.GDBDebuggerPage_cmdfile_warning,
200, SWT.DEFAULT, SWT.WRAP);
gd = new GridData(GridData.FILL_HORIZONTAL);
gd.horizontalSpan = 3;
gd.widthHint = 200;
label.setLayoutData(gd);
// TODO: Ideally, this field should be disabled if the back-end doesn't support non-stop debugging
// TODO: Find a way to determine if non-stop is supported (i.e. find the GDB version) then grey out the check box if necessary
fNonStopCheckBox = addCheckbox(subComp,
Messages.GDBDebuggerPage_nonstop_mode);
// TODO: Ideally, this field should be disabled if the back-end doesn't support reverse debugging
// TODO: Find a way to determine if reverse is supported (i.e. find the GDB version) then grey out the check box if necessary
fReverseCheckBox = addCheckbox(subComp,
Messages.GDBDebuggerPage_reverse_Debugging);
fUpdateThreadlistOnSuspend = addCheckbox(subComp,
Messages.GDBDebuggerPage_update_thread_list_on_suspend);
// This checkbox needs an explanation. Attach context help to it.
PlatformUI.getWorkbench().getHelpSystem().setHelp(
fUpdateThreadlistOnSuspend,
GdbUIPlugin.PLUGIN_ID
+ ".update_threadlist_button_context"); //$NON-NLS-1$
fDebugOnFork = addCheckbox(subComp,
Messages.GDBDebuggerPage_Automatically_debug_forked_processes);
createTracepointModeCombo(subComp);
}
/** Used to add a checkbox to the tab. Each checkbox has its own line. */
private Button addCheckbox(Composite parent, String label) {
Button button = ControlFactory.createCheckBox(parent, label);
button.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
updateLaunchConfigurationDialog();
}
});
GridData gd = new GridData();
gd.horizontalSpan = 3;
button.setLayoutData(gd);
return button;
}
protected void createTracepointModeCombo(Composite parent) {
// Add a combo to choose the type of tracepoint mode to use
Label label = ControlFactory.createLabel(parent,
Messages.GDBDebuggerPage_tracepoint_mode_label);
label.setLayoutData(new GridData());
fTracepointModeCombo = new Combo(parent, SWT.READ_ONLY | SWT.DROP_DOWN);
fTracepointModeCombo.setLayoutData(
new GridData(SWT.LEFT, SWT.CENTER, true, false, 2, 1));
fTracepointModeCombo.add(TP_NORMAL_ONLY);
fTracepointModeCombo.add(TP_FAST_ONLY);
fTracepointModeCombo.add(TP_AUTOMATIC);
fTracepointModeCombo.addSelectionListener(new SelectionListener() {
@Override
public void widgetSelected(SelectionEvent e) {
updateLaunchConfigurationDialog();
}
@Override
public void widgetDefaultSelected(SelectionEvent e) {
}
});
fTracepointModeCombo.select(0);
}
public void createSolibTab(TabFolder tabFolder) {
TabItem tabItem = new TabItem(tabFolder, SWT.NONE);
tabItem.setText(Messages.GDBDebuggerPage10);
Composite comp = ControlFactory.createCompositeEx(fTabFolder, 1,
GridData.FILL_BOTH);
comp.setFont(tabFolder.getFont());
tabItem.setControl(comp);
fSolibBlock = createSolibBlock(comp);
if (fSolibBlock instanceof Observable)
((Observable) fSolibBlock).addObserver(this);
}
/*
* (non-Javadoc)
*
* @see org.eclipse.debug.ui.ILaunchConfigurationTab#dispose()
*/
@Override
public void dispose() {
if (fSolibBlock != null) {
if (fSolibBlock instanceof Observable)
((Observable) fSolibBlock).deleteObserver(this);
fSolibBlock.dispose();
}
super.dispose();
}
/*
* (non-Javadoc)
*
* @see
* org.eclipse.debug.ui.ILaunchConfigurationTab#activated(org.eclipse.debug
* .core.ILaunchConfigurationWorkingCopy)
*/
@Override
public void activated(ILaunchConfigurationWorkingCopy workingCopy) {
// Override the default behavior
}
protected boolean isInitializing() {
return fIsInitializing;
}
private void setInitializing(boolean isInitializing) {
fIsInitializing = isInitializing;
}
}

View file

@ -0,0 +1,45 @@
/*******************************************************************************
* Copyright (c) 2015 Red Hat.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Red Hat - Initial Contribution
*******************************************************************************/
package org.eclipse.cdt.internal.docker.launcher;
import org.eclipse.cdt.docker.launcher.DockerLaunchUIPlugin;
import org.eclipse.debug.core.DebugPlugin;
public interface ILaunchConstants {
public final static String LAUNCH_ID = DockerLaunchUIPlugin
.getUniqueIdentifier() + ".launchConfigurationType"; //$NON-NLS-1$
public final static String ATTR_ADDITIONAL_DIRS = DockerLaunchUIPlugin
.getUniqueIdentifier() + ".additional_dirs"; //$NON-NLS-1$
public final static String ATTR_IMAGE = DockerLaunchUIPlugin.getUniqueIdentifier()
+ ".image"; //$NON-NLS-1$
public final static String ATTR_CONNECTION_URI = DockerLaunchUIPlugin
.getUniqueIdentifier() + ".connection_uri"; //$NON-NLS-1$
public final static String ATTR_KEEP_AFTER_LAUNCH = DockerLaunchUIPlugin
.getUniqueIdentifier() + ".keep_after_launch"; //$NON-NLS-1$
public final static String ATTR_STDIN_SUPPORT = DockerLaunchUIPlugin
.getUniqueIdentifier() + ".support_std_input"; //$NON-NLS-1$
// Attributes that need to match CDT attribute names
public static final String ATTR_GDBSERVER_PORT = DebugPlugin
.getUniqueIdentifier() + ".ATTR_GDBSERVER_PORT"; //$NON-NLS-1$
public static final String ATTR_GDBSERVER_COMMAND = DebugPlugin
.getUniqueIdentifier() + ".ATTR_GDBSERVER_COMMAND"; //$NON-NLS-1$
public static final String ATTR_GDBSERVER_PORT_DEFAULT = "2345"; //$NON-NLS-1$
public static final String ATTR_GDBSERVER_COMMAND_DEFAULT = "gdbserver"; //$NON-NLS-1$
}

View file

@ -0,0 +1,478 @@
/*******************************************************************************
* Copyright (c) 2015 Red Hat.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Red Hat - Initial Contribution
*******************************************************************************/
package org.eclipse.cdt.internal.docker.launcher;
import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
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.ICProject;
import org.eclipse.cdt.debug.core.CDebugUtils;
import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants;
import org.eclipse.cdt.docker.launcher.DockerLaunchUIPlugin;
import org.eclipse.cdt.dsf.gdb.IGDBLaunchConfigurationConstants;
import org.eclipse.cdt.dsf.gdb.IGdbDebugPreferenceConstants;
import org.eclipse.cdt.dsf.gdb.internal.ui.GdbUIPlugin;
import org.eclipse.cdt.ui.CElementLabelProvider;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.SubProgressMonitor;
import org.eclipse.core.runtime.preferences.InstanceScope;
import org.eclipse.debug.core.DebugPlugin;
import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.debug.core.ILaunchConfigurationType;
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
import org.eclipse.debug.core.ILaunchManager;
import org.eclipse.debug.ui.DebugUITools;
import org.eclipse.debug.ui.IDebugModelPresentation;
import org.eclipse.debug.ui.ILaunchShortcut;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.dialogs.ProgressMonitorDialog;
import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.jface.preference.IPreferenceStore;
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.linuxtools.docker.core.DockerConnectionManager;
import org.eclipse.linuxtools.docker.core.IDockerConnection;
import org.eclipse.linuxtools.docker.core.IDockerImage;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.dialogs.ElementListSelectionDialog;
import org.eclipse.ui.dialogs.TwoPaneElementSelector;
import org.osgi.service.prefs.Preferences;
public class LaunchShortcut implements ILaunchShortcut {
@Override
public void launch(IEditorPart editor, String mode) {
searchAndLaunch(new Object[] { editor.getEditorInput() }, mode);
}
@Override
public void launch(ISelection selection, String mode) {
if (selection instanceof IStructuredSelection) {
searchAndLaunch(((IStructuredSelection) selection).toArray(), mode);
}
}
public void launch(IBinary bin, String mode) {
ILaunchConfiguration config = findLaunchConfiguration(bin, mode);
if (config != null) {
DebugUITools.launch(config, mode);
}
}
/**
* Method getLaunchConfigType.
*
* @return ILaunchConfigurationType
*/
protected ILaunchConfigurationType getLaunchConfigType() {
return getLaunchManager()
.getLaunchConfigurationType(ILaunchConstants.LAUNCH_ID);
}
/**
* Search and launch binary.
*
* @param elements
* Binaries to search.
* @param mode
* Launch mode.
*/
private void searchAndLaunch(final Object[] elements, String mode) {
if (elements != null && elements.length > 0) {
IBinary bin = null;
if (elements.length == 1 && elements[0] instanceof IBinary) {
bin = (IBinary) elements[0];
} else {
final List<IBinary> results = new ArrayList<>();
ProgressMonitorDialog dialog = new ProgressMonitorDialog(
getActiveWorkbenchShell());
IRunnableWithProgress runnable = new IRunnableWithProgress() {
@Override
public void run(IProgressMonitor pm)
throws InterruptedException {
int nElements = elements.length;
pm.beginTask(
Messages.LaunchShortcut_Looking_for_executables,
nElements);
try {
IProgressMonitor sub = new SubProgressMonitor(pm, 1);
for (int i = 0; i < nElements; i++) {
if (elements[i] instanceof IAdaptable) {
IResource r = (IResource) ((IAdaptable) elements[i])
.getAdapter(IResource.class);
if (r != null) {
ICProject cproject = CoreModel
.getDefault().create(
r.getProject());
if (cproject != null) {
try {
IBinary[] bins = cproject
.getBinaryContainer()
.getBinaries();
for (IBinary bin : bins) {
if (bin.isExecutable()) {
results.add(bin);
}
}
} catch (CModelException e) {
// TODO should this be simply
// ignored ?
}
}
}
}
if (pm.isCanceled()) {
throw new InterruptedException();
}
sub.done();
}
} finally {
pm.done();
}
}
};
try {
dialog.run(true, true, runnable);
} catch (InterruptedException e) {
return;
} catch (InvocationTargetException e) {
handleFail(e.getMessage());
return;
}
int count = results.size();
if (count == 0) {
handleFail(Messages.LaunchShortcut_Binary_not_found);
} else if (count > 1) {
bin = chooseBinary(results, mode);
} else {
bin = results.get(0);
}
}
if (bin != null) {
launch(bin, mode);
}
} else {
handleFail(Messages.LaunchShortcut_no_project_selected);
}
}
/**
* Prompts the user to select a binary
*
* @param binList
* The list of binaries.
* @param mode
* launch mode.
*
* @return the selected binary or <code>null</code> if none.
*/
protected IBinary chooseBinary(List<IBinary> binList, String mode) {
ILabelProvider programLabelProvider = new CElementLabelProvider() {
@Override
public String getText(Object element) {
if (element instanceof IBinary) {
return ((IBinary) element).getPath().lastSegment();
}
return super.getText(element);
}
};
ILabelProvider qualifierLabelProvider = new CElementLabelProvider() {
@Override
public String getText(Object element) {
if (element instanceof IBinary) {
IBinary bin = (IBinary) element;
StringBuilder name = new StringBuilder();
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(
getActiveWorkbenchShell(), programLabelProvider,
qualifierLabelProvider);
dialog.setElements(binList.toArray());
dialog.setTitle(Messages.LaunchShortcut_Launcher);
dialog.setMessage(Messages.LaunchShortcut_Choose_a_local_application);
dialog.setUpperListLabel(Messages.LaunchShortcut_Binaries);
dialog.setLowerListLabel(Messages.LaunchShortcut_Qualifier);
dialog.setMultipleSelection(false);
if (dialog.open() == Window.OK) {
return (IBinary) dialog.getFirstResult();
}
return null;
}
protected void handleFail(String message) {
MessageDialog.openError(getActiveWorkbenchShell(),
Messages.LaunchShortcut_Launcher, message);
}
/**
* Locate a configuration to launch for the given type. If one cannot be
* found, create one.
*
* @param bin
* The binary to look launch for.
* @param mode
* Launch mode.
*
* @return A re-useable config or <code>null</code> if none.
*/
protected ILaunchConfiguration findLaunchConfiguration(IBinary bin,
String mode) {
ILaunchConfiguration configuration = null;
ILaunchConfigurationType configType = getLaunchConfigType();
List<ILaunchConfiguration> candidateConfigs = Collections.emptyList();
try {
ILaunchConfiguration[] configs = DebugPlugin.getDefault()
.getLaunchManager().getLaunchConfigurations(configType);
candidateConfigs = new ArrayList<>(configs.length);
for (ILaunchConfiguration config : configs) {
IPath programPath = CDebugUtils.getProgramPath(config);
String projectName = CDebugUtils.getProjectName(config);
IPath binPath = bin.getResource().getProjectRelativePath();
if (programPath != null && programPath.equals(binPath)) {
if (projectName != null
&& projectName.equals(bin.getCProject()
.getProject().getName())) {
candidateConfigs.add(config);
}
}
}
} catch (CoreException e) {
DockerLaunchUIPlugin.log(e);
}
// If there are no existing configurations associated with the IBinary,
// create one. If there is exactly one configuration associated with the
// IBinary, return it. Otherwise, if there is more than one
// configuration associated with the IBinary, prompt the user to choose
// one.
int candidateCount = candidateConfigs.size();
if (candidateCount < 1) {
configuration = createConfiguration(bin, mode, true);
} else if (candidateCount == 1) {
configuration = candidateConfigs.get(0);
} else {
// Prompt the user to choose a configuration. A null result means
// the user
// cancelled the dialog, in which case this method returns null,
// since canceling the dialog should also cancel launching
// anything.
configuration = chooseConfiguration(candidateConfigs, mode);
}
return configuration;
}
/**
* Create a launch configuration based on a binary, and optionally save it
* to the underlying resource.
*
* @param bin
* a representation of a binary
* @param save
* true if the configuration should be saved to the underlying
* resource, and false if it should not be saved.
* @return a launch configuration generated for the binary.
*/
protected ILaunchConfiguration createConfiguration(IBinary bin,
String mode, boolean save) {
ILaunchConfiguration config = null;
try {
String binaryPath = bin.getResource().getProjectRelativePath()
.toString();
ILaunchConfigurationType configType = getLaunchConfigType();
ILaunchConfigurationWorkingCopy wc = configType.newInstance(
null,
getLaunchManager().generateLaunchConfigurationName(
bin.getElementName()));
// DSF settings...use GdbUIPlugin preference store for defaults
IPreferenceStore preferenceStore = GdbUIPlugin.getDefault()
.getPreferenceStore();
wc.setAttribute(IGDBLaunchConfigurationConstants.ATTR_DEBUG_NAME,
preferenceStore.getString(
IGdbDebugPreferenceConstants.PREF_DEFAULT_GDB_COMMAND));
wc.setAttribute(IGDBLaunchConfigurationConstants.ATTR_GDB_INIT,
preferenceStore.getString(
IGdbDebugPreferenceConstants.PREF_DEFAULT_GDB_INIT));
wc.setAttribute(
IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_NON_STOP,
preferenceStore.getBoolean(
IGdbDebugPreferenceConstants.PREF_DEFAULT_NON_STOP));
wc.setAttribute(
IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_REVERSE,
IGDBLaunchConfigurationConstants.DEBUGGER_REVERSE_DEFAULT);
wc.setAttribute(
IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_UPDATE_THREADLIST_ON_SUSPEND,
IGDBLaunchConfigurationConstants.DEBUGGER_UPDATE_THREADLIST_ON_SUSPEND_DEFAULT);
wc.setAttribute(
IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_DEBUG_ON_FORK,
IGDBLaunchConfigurationConstants.DEBUGGER_DEBUG_ON_FORK_DEFAULT);
wc.setAttribute(
IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_TRACEPOINT_MODE,
IGDBLaunchConfigurationConstants.DEBUGGER_TRACEPOINT_MODE_DEFAULT);
wc.setAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME,
binaryPath);
wc.setAttribute(ICDTLaunchConfigurationConstants.ATTR_PROJECT_NAME,
bin.getCProject().getElementName());
wc.setMappedResources(new IResource[] { bin.getResource(),
bin.getResource().getProject() });
wc.setAttribute(
ICDTLaunchConfigurationConstants.ATTR_WORKING_DIRECTORY,
(String) null);
Preferences prefs = InstanceScope.INSTANCE
.getNode(DockerLaunchUIPlugin.PLUGIN_ID);
// get the connection from the ConnectionListener which waits for
// any activity
// from the DockerExplorerView
IDockerConnection connection = ConnectionListener.getInstance()
.getCurrentConnection();
if (connection == null) {
IDockerConnection[] connections = DockerConnectionManager
.getInstance().getConnections();
if (connections != null && connections.length > 0)
connection = DockerConnectionManager.getInstance()
.getConnections()[0];
}
// issue error message if no connections exist
if (connection == null) {
Display.getDefault().syncExec(new Runnable() {
@Override
public void run() {
MessageDialog.openError(
Display.getCurrent().getActiveShell(),
Messages.LaunchShortcut_Error_Launching,
Messages.LaunchShortcut_No_Connections);
}
});
return null;
}
wc.setAttribute(ILaunchConstants.ATTR_CONNECTION_URI,
connection.getUri());
// get any default image if specified, otherwise use first
// image in image list for connection
String image = prefs.get(PreferenceConstants.DEFAULT_IMAGE, null);
if (image == null) {
List<IDockerImage> images = connection.getImages();
if (images != null && images.size() > 0)
image = images.get(0).repoTags().get(0);
}
// issue error msg if no images exist
if (image == null) {
Display.getDefault().syncExec(new Runnable() {
@Override
public void run() {
MessageDialog.openError(
Display.getCurrent().getActiveShell(),
Messages.LaunchShortcut_Error_Launching,
Messages.LaunchShortcut_No_Images);
}
});
return null;
}
wc.setAttribute(ILaunchConstants.ATTR_IMAGE, (String) image);
Boolean keepPref = prefs.getBoolean(
PreferenceConstants.KEEP_CONTAINER_AFTER_LAUNCH, false);
wc.setAttribute(ILaunchConstants.ATTR_KEEP_AFTER_LAUNCH, keepPref);
// For Debug mode we need to set gdbserver info as well
if (mode.equals(ILaunchManager.DEBUG_MODE)) {
wc.setAttribute(ILaunchConstants.ATTR_GDBSERVER_COMMAND,
"gdbserver"); //$NON-NLS-1$
wc.setAttribute(ILaunchConstants.ATTR_GDBSERVER_PORT, "2345"); //$NON-NLS-1$
}
if (save) {
config = wc.doSave();
} else {
config = wc;
}
} catch (CoreException e) {
e.printStackTrace();
}
return config;
}
protected ILaunchManager getLaunchManager() {
return DebugPlugin.getDefault().getLaunchManager();
}
/**
* Show a selection dialog that allows the user to choose one of the
* specified launch configurations.
*
* @param configList
* The list of launch configurations to choose from.
* @param mode
* Currently unused.
* @return The chosen config, or <code>null</code> if the user cancelled the
* dialog.
*/
protected ILaunchConfiguration chooseConfiguration(
List<ILaunchConfiguration> configList, String mode) {
IDebugModelPresentation labelProvider = DebugUITools
.newDebugModelPresentation();
ElementListSelectionDialog dialog = new ElementListSelectionDialog(
getActiveWorkbenchShell(), labelProvider);
dialog.setElements(configList.toArray());
dialog.setTitle(Messages.LaunchShortcut_Launch_Configuration_Selection);
dialog.setMessage(Messages.LaunchShortcut_Choose_a_launch_configuration);
dialog.setMultipleSelection(false);
int result = dialog.open();
labelProvider.dispose();
if (result == IStatus.OK) {
return (ILaunchConfiguration) dialog.getFirstResult();
}
return null;
}
protected Shell getActiveWorkbenchShell() {
return DockerLaunchUIPlugin.getActiveWorkbenchShell();
}
}

View file

@ -0,0 +1,98 @@
/*******************************************************************************
* Copyright (c) 2012, 2013, 2015 Red Hat, Inc.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Red Hat initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.internal.docker.launcher;
import org.eclipse.osgi.util.NLS;
public class Messages extends NLS {
private static final String BUNDLE_NAME = "org.eclipse.cdt.internal.docker.launcher.messages"; //$NON-NLS-1$
public static String LaunchShortcut_Binaries;
public static String LaunchShortcut_Binary_not_found;
public static String LaunchShortcut_Choose_a_launch_configuration;
public static String LaunchShortcut_Choose_a_local_application;
public static String LaunchShortcut_Launch_Configuration_Selection;
public static String LaunchShortcut_Looking_for_executables;
public static String LaunchShortcut_no_project_selected;
public static String LaunchShortcut_Error_Launching;
public static String LaunchShortcut_No_Connections;
public static String LaunchShortcut_No_Images;
public static String LaunchShortcut_Qualifier;
public static String LaunchShortcut_Launcher;
public static String Default_Image;
public static String Keep_Container_After_Launch;
public static String ContainerTab_Name;
public static String ContainerTab_Group_Name;
public static String ContainerTab_Option_Group_Name;
public static String ContainerTab_New_Button;
public static String ContainerTab_Remove_Button;
public static String ContainerTab_Keep_Label;
public static String ContainerTab_Stdin_Support_Label;
public static String ContainerTab_Error_Reading_Configuration;
public static String ContainerTab_Connection_Selector_Label;
public static String ContainerTab_Image_Selector_Label;
public static String ContainerTab_Error_No_Connections;
public static String ContainerTab_Error_No_Images;
public static String ContainerTab_Warning_Connection_Not_Found;
public static String Remote_GDB_Debugger_Options;
public static String Gdbserver_Settings_Tab_Name;
public static String Gdbserver_name_textfield_label;
public static String Port_number_textfield_label;
public static String Gdbserver_start;
public static String Gdbserver_up;
public static String GDBDebuggerPage0;
public static String GDBDebuggerPage1;
public static String GDBDebuggerPage2;
public static String GDBDebuggerPage3;
public static String GDBDebuggerPage4;
public static String GDBDebuggerPage5;
public static String GDBDebuggerPage6;
public static String GDBDebuggerPage7;
public static String GDBDebuggerPage8;
public static String GDBDebuggerPage9;
public static String GDBDebuggerPage10;
public static String GDBDebuggerPage11;
public static String GDBDebuggerPage12;
public static String GDBDebuggerPage_gdb_executable_not_specified;
public static String GDBDebuggerPage_tab_name;
public static String GDBDebuggerPage_main_tab_name;
public static String GDBDebuggerPage_gdb_debugger;
public static String GDBDebuggerPage_gdb_browse;
public static String GDBDebuggerPage_gdb_browse_dlg_title;
public static String GDBDebuggerPage_gdb_command_file;
public static String GDBDebuggerPage_gdb_cmdfile_browse;
public static String GDBDebuggerPage_gdb_cmdfile_dlg_title;
public static String GDBDebuggerPage_cmdfile_warning;
public static String GDBDebuggerPage_shared_libraries;
public static String GDBDebuggerPage_nonstop_mode;
public static String GDBDebuggerPage_reverse_Debugging;
public static String GDBDebuggerPage_update_thread_list_on_suspend;
public static String GDBDebuggerPage_Automatically_debug_forked_processes;
public static String GDBDebuggerPage_tracepoint_mode_label;
public static String GDBDebuggerPage_tracepoint_mode_fast;
public static String GDBDebuggerPage_tracepoint_mode_normal;
public static String GDBDebuggerPage_tracepoint_mode_auto;
public static String StandardGDBDebuggerPage14;
static {
// initialize resource bundle
NLS.initializeMessages(BUNDLE_NAME, Messages.class);
}
private Messages() {
}
}

View file

@ -0,0 +1,21 @@
/*******************************************************************************
* Copyright (c) 2015 Red Hat.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Red Hat - Initial Contribution
*******************************************************************************/
package org.eclipse.cdt.internal.docker.launcher;
/**
* Constant definitions for plug-in preferences
*/
public class PreferenceConstants {
public static final String DEFAULT_IMAGE = "defaultImageForLaunch"; //$NON-NLS-1$
public static final String KEEP_CONTAINER_AFTER_LAUNCH = "keepContainerAfterLaunch"; //$NON-NLS-1$
}

View file

@ -0,0 +1,149 @@
/*******************************************************************************
* Copyright (c) 2006, 2010, 2015 PalmSource, 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:
* Ewa Matejska (PalmSource)
*
* Referenced GDBDebuggerPage code to write this.
* Anna Dushistova (Mentor Graphics) - moved to org.eclipse.cdt.launch.remote.tabs
* Red Hat Inc. - modified to work with CDT Container Launcher
*******************************************************************************/
package org.eclipse.cdt.internal.docker.launcher;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.TabFolder;
import org.eclipse.swt.widgets.TabItem;
import org.eclipse.swt.widgets.Text;
/**
* The dynamic debugger tab for Docker Container launches using gdb server. The
* gdbserver settings are used to start a gdbserver session in the Docker
* Container and then to connect to it from the host.
*/
public class RemoteDebuggerPage extends GdbDebuggerPage {
protected Text fGDBServerCommandText;
protected Text fGDBServerPortNumberText;
@Override
public String getName() {
return Messages.Remote_GDB_Debugger_Options;
}
@Override
public void setDefaults(ILaunchConfigurationWorkingCopy configuration) {
super.setDefaults(configuration);
configuration.setAttribute(ILaunchConstants.ATTR_GDBSERVER_COMMAND,
ILaunchConstants.ATTR_GDBSERVER_COMMAND_DEFAULT);
configuration.setAttribute(ILaunchConstants.ATTR_GDBSERVER_PORT,
ILaunchConstants.ATTR_GDBSERVER_PORT_DEFAULT);
}
@Override
public void initializeFrom(ILaunchConfiguration configuration) {
super.initializeFrom(configuration);
String gdbserverCommand = null;
String gdbserverPortNumber = null;
try {
gdbserverCommand = configuration.getAttribute(
ILaunchConstants.ATTR_GDBSERVER_COMMAND,
ILaunchConstants.ATTR_GDBSERVER_COMMAND_DEFAULT);
} catch (CoreException e) {
}
try {
gdbserverPortNumber = configuration.getAttribute(
ILaunchConstants.ATTR_GDBSERVER_PORT,
ILaunchConstants.ATTR_GDBSERVER_PORT_DEFAULT);
} catch (CoreException e) {
}
fGDBServerCommandText.setText(gdbserverCommand);
fGDBServerPortNumberText.setText(gdbserverPortNumber);
}
@Override
public void performApply(ILaunchConfigurationWorkingCopy configuration) {
super.performApply(configuration);
String str = fGDBServerCommandText.getText();
str.trim();
configuration
.setAttribute(ILaunchConstants.ATTR_GDBSERVER_COMMAND, str);
str = fGDBServerPortNumberText.getText();
str.trim();
configuration.setAttribute(ILaunchConstants.ATTR_GDBSERVER_PORT, str);
}
protected void createGdbserverSettingsTab(TabFolder tabFolder) {
TabItem tabItem = new TabItem(tabFolder, SWT.NONE);
tabItem.setText(Messages.Gdbserver_Settings_Tab_Name);
Composite comp = new Composite(tabFolder, SWT.NULL);
comp.setLayout(new GridLayout(1, true));
comp.setLayoutData(new GridData(GridData.FILL_BOTH));
((GridLayout) comp.getLayout()).makeColumnsEqualWidth = false;
comp.setFont(tabFolder.getFont());
tabItem.setControl(comp);
Composite subComp = new Composite(comp, SWT.NULL);
subComp.setLayout(new GridLayout(2, true));
subComp.setLayoutData(new GridData(GridData.FILL_BOTH));
((GridLayout) subComp.getLayout()).makeColumnsEqualWidth = false;
subComp.setFont(tabFolder.getFont());
Label label = new Label(subComp, SWT.LEFT);
label.setText(Messages.Gdbserver_name_textfield_label);
GridData gd = new GridData();
label.setLayoutData(gd);
fGDBServerCommandText = new Text(subComp, SWT.SINGLE | SWT.BORDER);
GridData data = new GridData();
fGDBServerCommandText.setLayoutData(data);
fGDBServerCommandText.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent evt) {
updateLaunchConfigurationDialog();
}
});
label = new Label(subComp, SWT.LEFT);
label.setText(Messages.Port_number_textfield_label);
gd = new GridData();
label.setLayoutData(gd);
fGDBServerPortNumberText = new Text(subComp, SWT.SINGLE | SWT.BORDER);
data = new GridData();
fGDBServerPortNumberText.setLayoutData(data);
fGDBServerPortNumberText.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent evt) {
updateLaunchConfigurationDialog();
}
});
}
/*
* (non-Javadoc)
*
* @see
* org.eclipse.cdt.debug.mi.internal.ui.GDBDebuggerPage#createTabs(org.eclipse
* .swt.widgets.TabFolder)
*/
@Override
public void createTabs(TabFolder tabFolder) {
super.createTabs(tabFolder);
createGdbserverSettingsTab(tabFolder);
}
}

View file

@ -0,0 +1,91 @@
/*******************************************************************************
* Copyright (c) 2010, 2015 Mentor Graphics 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:
* Anna Dushistova (Mentor Graphics) - initial API and implementation
* Anna Dushistova (Mentor Graphics) - moved to org.eclipse.cdt.launch.remote.tabs
* Red Hat Inc. - modified to use in CDT Docker Launcher
*******************************************************************************/
package org.eclipse.cdt.internal.docker.launcher;
import org.eclipse.cdt.debug.ui.ICDebuggerPage;
import org.eclipse.cdt.dsf.gdb.internal.ui.launching.CDebuggerTab;
import org.eclipse.cdt.dsf.gdb.service.SessionType;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
public class RemoteDebuggerTab extends CDebuggerTab {
private final static String DEFAULTS_SET = "org.eclipse.cdt.docker.launcher.RemoteDebuggerTab.DEFAULTS_SET"; //$NON-NLS-1$
public RemoteDebuggerTab() {
super(SessionType.REMOTE, false);
}
/*
* When the launch configuration is created for Run mode, this Debugger tab
* is not created because it is not used for Run mode but only for Debug
* mode. When we then open the same configuration in Debug mode, the launch
* configuration already exists and initializeFrom() is called instead of
* setDefaults(). We therefore call setDefaults() ourselves and update the
* configuration. If we don't then the user will be required to press Apply
* to get the default settings saved. Bug 281970
*/
@Override
public void setDefaults(ILaunchConfigurationWorkingCopy config) {
config.setAttribute(DEFAULTS_SET, true);
super.setDefaults(config);
}
@Override
public void initializeFrom(ILaunchConfiguration config) {
try {
if (config.hasAttribute(DEFAULTS_SET) == false) {
ILaunchConfigurationWorkingCopy wc;
wc = config.getWorkingCopy();
setDefaults(wc);
wc.doSave();
}
} catch (CoreException e) {
}
super.initializeFrom(config);
}
@Override
protected void loadDynamicDebugArea() {
Composite dynamicTabHolder = getDynamicTabHolder();
// Dispose of any current child widgets in the tab holder area
Control[] children = dynamicTabHolder.getChildren();
for (int i = 0; i < children.length; i++) {
children[i].dispose();
}
setDynamicTab(new RemoteDebuggerPage());
ICDebuggerPage debuggerPage = getDynamicTab();
if (debuggerPage == null) {
return;
}
// Ask the dynamic UI to create its Control
debuggerPage
.setLaunchConfigurationDialog(getLaunchConfigurationDialog());
debuggerPage.createControl(dynamicTabHolder);
debuggerPage.getControl().setVisible(true);
dynamicTabHolder.layout(true);
contentsChanged();
}
@Override
public String getId() {
return "org.eclipse.cdt.docker.launch.debug.RemoteCDSFDebuggerTab"; //$NON-NLS-1$
}
}

View file

@ -0,0 +1,103 @@
/*******************************************************************************
* Copyright (c) 2014, 2015 Red Hat.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Red Hat - Initial Contribution
*******************************************************************************/
package org.eclipse.cdt.internal.docker.launcher;
import java.net.MalformedURLException;
import java.net.URL;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.resource.ImageRegistry;
import org.eclipse.linuxtools.docker.ui.Activator;
import org.eclipse.swt.graphics.Image;
public class SWTImagesFactory {
// The plug-in registry
private static ImageRegistry imageRegistry = Activator.getDefault()
.getImageRegistry();
// Sub-directory (under the package containing this class) where 16 color
// images are
private static URL fgIconBaseURL;
static {
try {
fgIconBaseURL = new URL(Activator.getDefault().getBundle()
.getEntry("/"), "icons/"); //$NON-NLS-1$ //$NON-NLS-2$
} catch (MalformedURLException e) {
Activator.log(e);
}
}
private static final String NAME_PREFIX = Activator.PLUGIN_ID + '.';
private static final int NAME_PREFIX_LENGTH = NAME_PREFIX.length();
public static final String IMG_DOCKER_SMALL = NAME_PREFIX
+ "docker_small.gif"; //$NON-NLS-1$
public static final ImageDescriptor DESC_DOCKER_SMALL = createManaged("",
IMG_DOCKER_SMALL);
private static ImageDescriptor createManaged(String prefix, String name) {
return createManaged(imageRegistry, prefix, name);
}
private static ImageDescriptor createManaged(ImageRegistry registry,
String prefix, String name) {
ImageDescriptor result = ImageDescriptor.createFromURL(makeIconFileURL(
prefix, name.substring(NAME_PREFIX_LENGTH)));
registry.put(name, result);
return result;
}
public static Image get(String key) {
return imageRegistry.get(key);
}
private static ImageDescriptor create(String prefix, String name) {
return ImageDescriptor.createFromURL(makeIconFileURL(prefix, name));
}
private static URL makeIconFileURL(String prefix, String name) {
StringBuffer buffer = new StringBuffer(prefix);
buffer.append(name);
try {
return new URL(fgIconBaseURL, buffer.toString());
} catch (MalformedURLException e) {
Activator.log(e);
return null;
}
}
/**
* Sets all available image descriptors for the given action.
*
* @param action
* to set descriptor for
* @param type
* of image descriptor
* @param relPath
* relative path
*/
public static void setImageDescriptors(IAction action, String type,
String relPath) {
if (relPath.startsWith(NAME_PREFIX))
relPath = relPath.substring(NAME_PREFIX_LENGTH);
action.setDisabledImageDescriptor(create("d" + type, relPath)); //$NON-NLS-1$
action.setImageDescriptor(create("e" + type, relPath)); //$NON-NLS-1$
}
/**
* Helper method to access the image registry from the CUIPlugin class.
*/
static ImageRegistry getImageRegistry() {
return imageRegistry;
}
}

View file

@ -0,0 +1,83 @@
#*******************************************************************************
# Copyright (c) 2015 Red Hat.
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Eclipse Public License v1.0
# which accompanies this distribution, and is available at
# http://www.eclipse.org/legal/epl-v10.html
#
# Contributors:
# Red Hat - Initial Contribution
#*****************************************************************************/
LaunchShortcut_Binaries=Binaries:
LaunchShortcut_Binary_not_found=Launch failed. Binary not found.
LaunchShortcut_Choose_a_launch_configuration=Choose a launch configuration to run
LaunchShortcut_Choose_a_local_application=Choose a local application to run in Container
LaunchShortcut_Launch_Configuration_Selection=Launch Configuration Selection
LaunchShortcut_Looking_for_executables=Looking for executables
LaunchShortcut_no_project_selected=Launch failed no project selected
LaunchShortcut_No_Connections=No Docker Connections exist. Use Docker Explorer View to open one.
LaunchShortcut_No_Images=Current Docker Connection has no images, Use Docker Images View to pull or build an image.
LaunchShortcut_Error_Launching=Launch Error
LaunchShortcut_Qualifier=Qualifier:
LaunchShortcut_Launcher=C/C++ Container Launcher
Default_Image=Default Image for launch
Keep_Container_After_Launch=Keep Container after launch
ContainerTab_Name=Container
ContainerTab_New_Button=New...
ContainerTab_Remove_Button=Remove
ContainerTab_Keep_Label=Keep Container after launch
ContainerTab_Stdin_Support_Label=Support stdin input
ContainerTab_Group_Name=Required host directories
ContainerTab_Option_Group_Name=Additional Options
ContainerTab_Connection_Selector_Label=Connection:
ContainerTab_Image_Selector_Label=Image:
ContainerTab_Error_Reading_Configuration=Error occurred reading the launch configuration: {0}
ContainerTab_Error_No_Connections=No Docker Connections exist
ContainerTab_Error_No_Images=No Docker Images exist
ContainerTab_Warning_Connection_Not_Found=Docker Connection: {0} for Launch Configuration not found: defaulting to {1}
Remote_GDB_Debugger_Options=Docker Container GDB Debugger Options
Gdbserver_Settings_Tab_Name=Gdbserver Settings
Gdbserver_name_textfield_label=Gdbserver path:
Port_number_textfield_label=Port number:
Gdbserver_start=Starting gdbserver
Gdbserver_up=Listening on port
GDBDebuggerPage0=Debugger executable must be specified.
GDBDebuggerPage1=GDB Debugger Options
GDBDebuggerPage2=Main
GDBDebuggerPage3=GDB debugger:
GDBDebuggerPage4=&Browse...
GDBDebuggerPage5=GDB Debugger
GDBDebuggerPage6=GDB command file:
GDBDebuggerPage7=B&rowse...
GDBDebuggerPage8=GDB Command File
GDBDebuggerPage9=(Warning: Some commands in this file may interfere with the startup operation of the debugger, for example "run".)
GDBDebuggerPage10=Shared Libraries
GDBDebuggerPage11=Protocol:
GDBDebuggerPage12=Default
GDBDebuggerPage_gdb_executable_not_specified=Debugger executable must be specified.
GDBDebuggerPage_tab_name=GDB Debugger Options
GDBDebuggerPage_main_tab_name=Main
GDBDebuggerPage_gdb_debugger=GDB debugger:
GDBDebuggerPage_gdb_browse=&Browse...
GDBDebuggerPage_gdb_browse_dlg_title=GDB Debugger
GDBDebuggerPage_gdb_command_file=GDB command file:
GDBDebuggerPage_gdb_cmdfile_browse=B&rowse...
GDBDebuggerPage_gdb_cmdfile_dlg_title=GDB Command File
GDBDebuggerPage_cmdfile_warning=(Warning: Some commands in this file may interfere with the startup operation of the debugger, for example "run".)
GDBDebuggerPage_shared_libraries=Shared Libraries
GDBDebuggerPage_nonstop_mode=Non-stop mode (Note: Requires non-stop GDB)
GDBDebuggerPage_reverse_Debugging=Enable Reverse Debugging at startup (Note: Requires Reverse GDB)
GDBDebuggerPage_update_thread_list_on_suspend=Force thread list update on suspend
GDBDebuggerPage_Automatically_debug_forked_processes=Automatically debug forked processes (Note: Requires Multi Process GDB)
GDBDebuggerPage_tracepoint_mode_label=Tracepoint mode:
GDBDebuggerPage_tracepoint_mode_fast=Fast
GDBDebuggerPage_tracepoint_mode_normal=Normal
GDBDebuggerPage_tracepoint_mode_auto=Automatic
StandardGDBDebuggerPage14=Use full file path to set breakpoints

View file

@ -0,0 +1,59 @@
/*******************************************************************************
* Copyright (c) 2015 Red Hat.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Red Hat - Initial Contribution
*******************************************************************************/
package org.eclipse.cdt.internal.docker.launcher.ui.preferences;
import org.eclipse.cdt.docker.launcher.DockerLaunchUIPlugin;
import org.eclipse.cdt.internal.docker.launcher.Messages;
import org.eclipse.cdt.internal.docker.launcher.PreferenceConstants;
import org.eclipse.jface.preference.BooleanFieldEditor;
import org.eclipse.jface.preference.FieldEditorPreferencePage;
import org.eclipse.jface.preference.StringFieldEditor;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPreferencePage;
public class DockerLaunchPreferencePage extends FieldEditorPreferencePage
implements IWorkbenchPreferencePage {
private StringFieldEditor defaultImage;
private BooleanFieldEditor keepContainerAfterLaunch;
public DockerLaunchPreferencePage() {
super(GRID);
setPreferenceStore(DockerLaunchUIPlugin.getDefault().getPreferenceStore());
}
/**
* Creates the field editors. Field editors are abstractions of the common
* GUI blocks needed to manipulate various types of preferences. Each field
* editor knows how to save and restore itself.
*/
public void createFieldEditors() {
defaultImage = new StringFieldEditor(PreferenceConstants.DEFAULT_IMAGE,
Messages.Default_Image, getFieldEditorParent());
addField(defaultImage);
keepContainerAfterLaunch = new BooleanFieldEditor(
PreferenceConstants.KEEP_CONTAINER_AFTER_LAUNCH,
Messages.Keep_Container_After_Launch, getFieldEditorParent());
addField(keepContainerAfterLaunch);
}
/*
* (non-Javadoc)
*
* @see
* org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench)
*/
public void init(IWorkbench workbench) {
}
}

View file

@ -0,0 +1,27 @@
/*******************************************************************************
* Copyright (c) 2015 Red Hat.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Red Hat - Initial Contribution
*******************************************************************************/
package org.eclipse.cdt.internal.docker.launcher.ui.preferences;
import org.eclipse.cdt.docker.launcher.DockerLaunchUIPlugin;
import org.eclipse.cdt.internal.docker.launcher.PreferenceConstants;
import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;
import org.eclipse.jface.preference.IPreferenceStore;
public class PreferenceInitializer extends AbstractPreferenceInitializer {
@Override
public void initializeDefaultPreferences() {
IPreferenceStore store = DockerLaunchUIPlugin.getDefault().getPreferenceStore();
store.setDefault(PreferenceConstants.DEFAULT_IMAGE, "");
store.setDefault(PreferenceConstants.KEEP_CONTAINER_AFTER_LAUNCH, false);
}
}

View file

@ -195,6 +195,10 @@
<module>build/org.eclipse.cdt.autotools.source-feature</module>
<module>build/org.eclipse.linuxtools.cdt.autotools.core</module>
<module>launch/org.eclipse.cdt.docker.launcher</module>
<module>launch/org.eclipse.cdt.docker.launcher-feature</module>
<module>launch/org.eclipse.cdt.docker.launcher.source-feature</module>
<module>testsrunner/org.eclipse.cdt.testsrunner</module>
<module>testsrunner/org.eclipse.cdt.testsrunner.boost</module>
<module>testsrunner/org.eclipse.cdt.testsrunner.gtest</module>

View file

@ -65,6 +65,12 @@
<feature url="features/org.eclipse.cdt.autotools.source_0.0.0.qualifier.jar" id="org.eclipse.cdt.autotools.source" version="0.0.0">
<category name="extra"/>
</feature>
<feature url="features/org.eclipse.cdt.docker.launcher_0.0.0.qualifier.jar" id="org.eclipse.cdt.docker.launcher" version="0.0.0">
<category name="extra"/>
</feature>
<feature url="features/org.eclipse.cdt.docker.launcher.source_0.0.0.qualifier.jar" id="org.eclipse.cdt.docker.launcher.source" version="0.0.0">
<category name="extra"/>
</feature>
<feature url="features/org.eclipse.cdt.testsrunner.feature_0.0.0.qualifier.jar" id="org.eclipse.cdt.testsrunner.feature" version="0.0.0">
<category name="extra"/>
</feature>

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?pde version="3.8"?><target name="cdt_e4.5" sequenceNumber="25">
<?pde version="3.8"?><target name="cdt_e4.5" sequenceNumber="30">
<locations>
<location includeAllPlatforms="false" includeConfigurePhase="false" includeMode="planner" includeSource="true" type="InstallableUnit">
<unit id="org.apache.commons.compress" version="0.0.0"/>
@ -44,6 +44,10 @@
<unit id="org.eclipse.cdt.native.feature.group" version="0.0.0"/>
<repository location="https://hudson.eclipse.org/cdt/job/cdt-master/lastSuccessfulBuild/artifact/releng/org.eclipse.cdt.repo/target/repository/"/>
</location>
<location includeAllPlatforms="false" includeConfigurePhase="false" includeMode="planner" includeSource="true" type="InstallableUnit">
<unit id="org.eclipse.linuxtools.docker.feature.feature.group" version="0.0.0"/>
<repository location="http://download.eclipse.org/linuxtools/updates-docker-nightly/"/>
</location>
</locations>
<targetJRE path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
<launcherArgs>