Initial contribution to Eclipse.org
diff --git a/.project b/.project
new file mode 100644
index 0000000..962b9c1
--- /dev/null
+++ b/.project
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.statet-eutils</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ </buildSpec>
+ <natures>
+ </natures>
+</projectDescription>
diff --git a/.settings/org.eclipse.core.resources.prefs b/.settings/org.eclipse.core.resources.prefs
new file mode 100644
index 0000000..99f26c0
--- /dev/null
+++ b/.settings/org.eclipse.core.resources.prefs
@@ -0,0 +1,2 @@
+eclipse.preferences.version=1
+encoding/<project>=UTF-8
diff --git a/.settings/org.eclipse.core.runtime.prefs b/.settings/org.eclipse.core.runtime.prefs
new file mode 100644
index 0000000..5a0ad22
--- /dev/null
+++ b/.settings/org.eclipse.core.runtime.prefs
@@ -0,0 +1,2 @@
+eclipse.preferences.version=1
+line.separator=\n
diff --git a/autonature/_build/org.eclipse.statet.eutils.autonature-feature/.project b/autonature/_build/org.eclipse.statet.eutils.autonature-feature/.project
new file mode 100644
index 0000000..122bb5b
--- /dev/null
+++ b/autonature/_build/org.eclipse.statet.eutils.autonature-feature/.project
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.statet.eutils.autonature-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>
diff --git a/autonature/_build/org.eclipse.statet.eutils.autonature-feature/build.properties b/autonature/_build/org.eclipse.statet.eutils.autonature-feature/build.properties
new file mode 100644
index 0000000..4fc35c8
--- /dev/null
+++ b/autonature/_build/org.eclipse.statet.eutils.autonature-feature/build.properties
@@ -0,0 +1,2 @@
+bin.includes= feature.xml,\
+ feature.properties
diff --git a/autonature/_build/org.eclipse.statet.eutils.autonature-feature/feature.properties b/autonature/_build/org.eclipse.statet.eutils.autonature-feature/feature.properties
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/autonature/_build/org.eclipse.statet.eutils.autonature-feature/feature.properties
diff --git a/autonature/_build/org.eclipse.statet.eutils.autonature-feature/feature.xml b/autonature/_build/org.eclipse.statet.eutils.autonature-feature/feature.xml
new file mode 100644
index 0000000..ec925fe
--- /dev/null
+++ b/autonature/_build/org.eclipse.statet.eutils.autonature-feature/feature.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<feature
+ id="org.eclipse.statet.eutils.autonature"
+ version="0.2.0.qualifier"
+ label="Auto Project Configuration"
+ provider-name="Eclipse.org"
+ license-feature="org.eclipse.license"
+ license-feature-version="1.0.1">
+
+ <description url="https://www.eclipse.org/statet">
+ Utility to configure projects (natures) automatically dependent on content types of files.
+ </description>
+
+ <copyright>
+ Copyright (c) 2014, 2017 Stephan Wahlbrink and others. All rights reserved.
+ </copyright>
+
+ <license url="%license_url">
+ %license_text
+ </license>
+
+ <plugin
+ id="org.eclipse.statet.eutils.autonature"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+</feature>
diff --git a/autonature/_build/repo/category.xml b/autonature/_build/repo/category.xml
new file mode 100644
index 0000000..cd5fc27
--- /dev/null
+++ b/autonature/_build/repo/category.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<site>
+ <category-def name="org.eclipse.statet.utils" label="StatET - Utilities"/>
+
+ <feature id="org.eclipse.statet.eutils.autonature" version="0.0.0">
+ <category name="org.eclipse.statet.utils"/>
+ </feature>
+
+</site>
diff --git a/autonature/org.eclipse.statet.eutils.autonature/.classpath b/autonature/org.eclipse.statet.eutils.autonature/.classpath
new file mode 100644
index 0000000..eca7bdb
--- /dev/null
+++ b/autonature/org.eclipse.statet.eutils.autonature/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/autonature/org.eclipse.statet.eutils.autonature/.gitignore b/autonature/org.eclipse.statet.eutils.autonature/.gitignore
new file mode 100644
index 0000000..7447f89
--- /dev/null
+++ b/autonature/org.eclipse.statet.eutils.autonature/.gitignore
@@ -0,0 +1 @@
+/bin
\ No newline at end of file
diff --git a/autonature/org.eclipse.statet.eutils.autonature/.project b/autonature/org.eclipse.statet.eutils.autonature/.project
new file mode 100644
index 0000000..a961502
--- /dev/null
+++ b/autonature/org.eclipse.statet.eutils.autonature/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.statet.eutils.autonature</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>
diff --git a/autonature/org.eclipse.statet.eutils.autonature/.settings/org.eclipse.core.resources.prefs b/autonature/org.eclipse.statet.eutils.autonature/.settings/org.eclipse.core.resources.prefs
new file mode 100644
index 0000000..99f26c0
--- /dev/null
+++ b/autonature/org.eclipse.statet.eutils.autonature/.settings/org.eclipse.core.resources.prefs
@@ -0,0 +1,2 @@
+eclipse.preferences.version=1
+encoding/<project>=UTF-8
diff --git a/autonature/org.eclipse.statet.eutils.autonature/.settings/org.eclipse.core.runtime.prefs b/autonature/org.eclipse.statet.eutils.autonature/.settings/org.eclipse.core.runtime.prefs
new file mode 100644
index 0000000..5a0ad22
--- /dev/null
+++ b/autonature/org.eclipse.statet.eutils.autonature/.settings/org.eclipse.core.runtime.prefs
@@ -0,0 +1,2 @@
+eclipse.preferences.version=1
+line.separator=\n
diff --git a/autonature/org.eclipse.statet.eutils.autonature/.settings/org.eclipse.jdt.core.prefs b/autonature/org.eclipse.statet.eutils.autonature/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000..ccb1eaa
--- /dev/null
+++ b/autonature/org.eclipse.statet.eutils.autonature/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,325 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.codeComplete.argumentPrefixes=
+org.eclipse.jdt.core.codeComplete.argumentSuffixes=
+org.eclipse.jdt.core.codeComplete.fieldPrefixes=
+org.eclipse.jdt.core.codeComplete.fieldSuffixes=
+org.eclipse.jdt.core.codeComplete.localPrefixes=
+org.eclipse.jdt.core.codeComplete.localSuffixes=
+org.eclipse.jdt.core.codeComplete.staticFieldPrefixes=
+org.eclipse.jdt.core.codeComplete.staticFieldSuffixes=
+org.eclipse.jdt.core.codeComplete.staticFinalFieldPrefixes=
+org.eclipse.jdt.core.codeComplete.staticFinalFieldSuffixes=
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.8
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.8
+org.eclipse.jdt.core.formatter.align_fields_grouping_blank_lines=2147483647
+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_expressions_in_for_loop_header=0
+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_parameterized_type_references=0
+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=85
+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_type_arguments=0
+org.eclipse.jdt.core.formatter.alignment_for_type_parameters=0
+org.eclipse.jdt.core.formatter.alignment_for_union_type_in_multicatch=16
+org.eclipse.jdt.core.formatter.blank_lines_after_imports=2
+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=1
+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=2
+org.eclipse.jdt.core.formatter.blank_lines_before_package=1
+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=false
+org.eclipse.jdt.core.formatter.comment.indent_root_tags=true
+org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert
+org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=do not insert
+org.eclipse.jdt.core.formatter.comment.line_length=100
+org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=false
+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=true
+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_enum_constant=insert
+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=insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=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=do not 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=100
+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.parentheses_positions_in_annotation=common_lines
+org.eclipse.jdt.core.formatter.parentheses_positions_in_catch_clause=common_lines
+org.eclipse.jdt.core.formatter.parentheses_positions_in_enum_constant_declaration=common_lines
+org.eclipse.jdt.core.formatter.parentheses_positions_in_for_statment=common_lines
+org.eclipse.jdt.core.formatter.parentheses_positions_in_if_while_statement=common_lines
+org.eclipse.jdt.core.formatter.parentheses_positions_in_lambda_declaration=common_lines
+org.eclipse.jdt.core.formatter.parentheses_positions_in_method_delcaration=common_lines
+org.eclipse.jdt.core.formatter.parentheses_positions_in_method_invocation=common_lines
+org.eclipse.jdt.core.formatter.parentheses_positions_in_switch_statement=common_lines
+org.eclipse.jdt.core.formatter.parentheses_positions_in_try_clause=common_lines
+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_assignment_operator=false
+org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true
+org.eclipse.jdt.core.formatter.wrap_before_conditional_operator=false
+org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch=true
+org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true
+org.eclipse.jdt.core.javaFormatter=org.eclipse.jdt.core.defaultJavaFormatter
diff --git a/autonature/org.eclipse.statet.eutils.autonature/.settings/org.eclipse.jdt.ui.prefs b/autonature/org.eclipse.statet.eutils.autonature/.settings/org.eclipse.jdt.ui.prefs
new file mode 100644
index 0000000..abdf3e0
--- /dev/null
+++ b/autonature/org.eclipse.statet.eutils.autonature/.settings/org.eclipse.jdt.ui.prefs
@@ -0,0 +1,131 @@
+cleanup.add_default_serial_version_id=true
+cleanup.add_generated_serial_version_id=false
+cleanup.add_missing_annotations=true
+cleanup.add_missing_deprecated_annotations=true
+cleanup.add_missing_methods=false
+cleanup.add_missing_nls_tags=false
+cleanup.add_missing_override_annotations=true
+cleanup.add_missing_override_annotations_interface_methods=true
+cleanup.add_serial_version_id=false
+cleanup.always_use_blocks=true
+cleanup.always_use_parentheses_in_expressions=true
+cleanup.always_use_this_for_non_static_field_access=true
+cleanup.always_use_this_for_non_static_method_access=false
+cleanup.convert_functional_interfaces=false
+cleanup.convert_to_enhanced_for_loop=false
+cleanup.correct_indentation=false
+cleanup.format_source_code=false
+cleanup.format_source_code_changes_only=false
+cleanup.insert_inferred_type_arguments=false
+cleanup.make_local_variable_final=true
+cleanup.make_parameters_final=true
+cleanup.make_private_fields_final=true
+cleanup.make_type_abstract_if_missing_method=false
+cleanup.make_variable_declarations_final=true
+cleanup.never_use_blocks=false
+cleanup.never_use_parentheses_in_expressions=false
+cleanup.organize_imports=true
+cleanup.qualify_static_field_accesses_with_declaring_class=false
+cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
+cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=false
+cleanup.qualify_static_member_accesses_with_declaring_class=true
+cleanup.qualify_static_method_accesses_with_declaring_class=false
+cleanup.remove_private_constructors=true
+cleanup.remove_redundant_type_arguments=true
+cleanup.remove_trailing_whitespaces=false
+cleanup.remove_trailing_whitespaces_all=true
+cleanup.remove_trailing_whitespaces_ignore_empty=false
+cleanup.remove_unnecessary_casts=true
+cleanup.remove_unnecessary_nls_tags=true
+cleanup.remove_unused_imports=true
+cleanup.remove_unused_local_variables=false
+cleanup.remove_unused_private_fields=true
+cleanup.remove_unused_private_members=false
+cleanup.remove_unused_private_methods=true
+cleanup.remove_unused_private_types=true
+cleanup.sort_members=false
+cleanup.sort_members_all=false
+cleanup.use_anonymous_class_creation=false
+cleanup.use_blocks=true
+cleanup.use_blocks_only_for_return_and_throw=false
+cleanup.use_lambda=true
+cleanup.use_parentheses_in_expressions=false
+cleanup.use_this_for_non_static_field_access=true
+cleanup.use_this_for_non_static_field_access_only_if_necessary=false
+cleanup.use_this_for_non_static_method_access=true
+cleanup.use_this_for_non_static_method_access_only_if_necessary=true
+cleanup.use_type_arguments=false
+cleanup_profile=_StatET
+cleanup_settings_version=2
+eclipse.preferences.version=1
+editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
+formatter_profile=_StatET
+formatter_settings_version=12
+org.eclipse.jdt.ui.exception.name=e
+org.eclipse.jdt.ui.gettersetter.use.is=true
+org.eclipse.jdt.ui.ignorelowercasenames=true
+org.eclipse.jdt.ui.importorder=\#;java;javax;com.ibm.icu;org.osgi;org.eclipse;;org.eclipse.statet;
+org.eclipse.jdt.ui.javadoc=true
+org.eclipse.jdt.ui.keywordthis=true
+org.eclipse.jdt.ui.ondemandthreshold=99
+org.eclipse.jdt.ui.overrideannotation=true
+org.eclipse.jdt.ui.staticondemandthreshold=99
+org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8" standalone\="no"?><templates><template autoinsert\="true" context\="gettercomment_context" deleted\="false" description\="Comment for getter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.gettercomment" name\="gettercomment">/**\n * @return the ${bare_field_name}\n */</template><template autoinsert\="true" context\="settercomment_context" deleted\="false" description\="Comment for setter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.settercomment" name\="settercomment">/**\n * @param ${param} the ${bare_field_name} to set\n */</template><template autoinsert\="true" context\="constructorcomment_context" deleted\="false" description\="Comment for created constructors" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorcomment" name\="constructorcomment">/**\n * ${tags}\n */</template><template autoinsert\="false" context\="filecomment_context" deleted\="false" description\="Comment for created Java files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.filecomment" name\="filecomment">/*\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\#\n \# Copyright (c) ${year} ${user} and others.\n # \n # This program and the accompanying materials are made available under the\n # terms of the Eclipse Public License 2.0 which is available at\n # https://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0\n # which is available at https://www.apache.org/licenses/LICENSE-2.0.\n # \n # SPDX-License-Identifier: EPL-2.0 OR Apache-2.0\n # \n \# Contributors\:\n \# ${user} - initial API and implementation\n \#\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=*/</template><template autoinsert\="false" context\="typecomment_context" deleted\="false" description\="Comment for created types" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.typecomment" name\="typecomment">/**\n * \n * ${tags}\n */</template><template autoinsert\="true" context\="fieldcomment_context" deleted\="false" description\="Comment for fields" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.fieldcomment" name\="fieldcomment">/**\n * \n */</template><template autoinsert\="true" context\="methodcomment_context" deleted\="false" description\="Comment for non-overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodcomment" name\="methodcomment">/**\n * ${tags}\n */</template><template autoinsert\="false" context\="overridecomment_context" deleted\="false" description\="Comment for overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.overridecomment" name\="overridecomment"/><template autoinsert\="true" context\="delegatecomment_context" deleted\="false" description\="Comment for delegate methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.delegatecomment" name\="delegatecomment">/**\n * ${tags}\n * ${see_to_target}\n */</template><template autoinsert\="false" context\="newtype_context" deleted\="false" description\="Newly created files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.newtype" name\="newtype">${filecomment}\n\n${package_declaration}\n\n${typecomment}\n${type_declaration}</template><template autoinsert\="true" context\="classbody_context" deleted\="false" description\="Code in new class type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.classbody" name\="classbody">\n</template><template autoinsert\="true" context\="interfacebody_context" deleted\="false" description\="Code in new interface type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.interfacebody" name\="interfacebody">\n</template><template autoinsert\="true" context\="enumbody_context" deleted\="false" description\="Code in new enum type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.enumbody" name\="enumbody">\n</template><template autoinsert\="true" context\="annotationbody_context" deleted\="false" description\="Code in new annotation type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.annotationbody" name\="annotationbody">\n</template><template autoinsert\="true" context\="catchblock_context" deleted\="false" description\="Code in new catch blocks" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.catchblock" name\="catchblock">// ${todo} Auto-generated catch block\n${exception_var}.printStackTrace();</template><template autoinsert\="true" context\="methodbody_context" deleted\="false" description\="Code in created method stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodbody" name\="methodbody">// ${todo} Auto-generated method stub\n${body_statement}</template><template autoinsert\="true" context\="constructorbody_context" deleted\="false" description\="Code in created constructor stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorbody" name\="constructorbody">${body_statement}\n// ${todo} Auto-generated constructor stub</template><template autoinsert\="true" context\="getterbody_context" deleted\="false" description\="Code in created getters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.getterbody" name\="getterbody">return ${field};</template><template autoinsert\="true" context\="setterbody_context" deleted\="false" description\="Code in created setters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.setterbody" name\="setterbody">${field} \= ${param};</template></templates>
+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=true
+sp_cleanup.always_use_this_for_non_static_field_access=true
+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=false
+sp_cleanup.format_source_code_changes_only=false
+sp_cleanup.insert_inferred_type_arguments=false
+sp_cleanup.make_local_variable_final=true
+sp_cleanup.make_parameters_final=true
+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=false
+sp_cleanup.on_save_use_additional_actions=true
+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=false
+sp_cleanup.qualify_static_member_accesses_with_declaring_class=true
+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=false
+sp_cleanup.remove_trailing_whitespaces_ignore_empty=true
+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=false
+sp_cleanup.remove_unused_private_members=false
+sp_cleanup.remove_unused_private_methods=false
+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=true
+sp_cleanup.use_blocks_only_for_return_and_throw=false
+sp_cleanup.use_lambda=false
+sp_cleanup.use_parentheses_in_expressions=false
+sp_cleanup.use_this_for_non_static_field_access=true
+sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=false
+sp_cleanup.use_this_for_non_static_method_access=true
+sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true
+sp_cleanup.use_type_arguments=false
diff --git a/autonature/org.eclipse.statet.eutils.autonature/META-INF/MANIFEST.MF b/autonature/org.eclipse.statet.eutils.autonature/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..fff6a85
--- /dev/null
+++ b/autonature/org.eclipse.statet.eutils.autonature/META-INF/MANIFEST.MF
@@ -0,0 +1,20 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-SymbolicName: org.eclipse.statet.eutils.autonature;singleton:=true
+Bundle-Version: 0.2.0.qualifier
+Bundle-Vendor: Eclipse.org
+Bundle-Name: StatET EUtils - Auto-Nature
+Bundle-ActivationPolicy: lazy;exclude:="org.eclipse.statet.eutils.autonature.internal.nostart"
+Bundle-Activator: org.eclipse.statet.internal.eutils.autonature.Activator
+Bundle-Localization: plugin
+Bundle-RequiredExecutionEnvironment: JavaSE-1.8
+Require-Bundle: org.eclipse.core.runtime;bundle-version="3.10.0",
+ org.eclipse.ui,
+ org.eclipse.core.resources
+Import-Package: com.ibm.icu.text,
+ org.eclipse.statet.ecommons.ui.dialogs,
+ org.eclipse.statet.ecommons.ui.util,
+ org.eclipse.statet.ecommons.ui.viewers,
+ org.eclipse.statet.ecommons.ui.workbench,
+ org.eclipse.statet.jcommons.collections
+Export-Package: org.eclipse.statet.eutils.autonature.core
diff --git a/autonature/org.eclipse.statet.eutils.autonature/about.html b/autonature/org.eclipse.statet.eutils.autonature/about.html
new file mode 100644
index 0000000..7206cec
--- /dev/null
+++ b/autonature/org.eclipse.statet.eutils.autonature/about.html
@@ -0,0 +1,36 @@
+<!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=UTF-8"/>
+<title>About</title>
+</head>
+<body lang="EN-US">
+<h2>About This Content</h2>
+
+<p>December 1, 2017</p>
+<h3>License</h3>
+
+<p>
+ The Eclipse Foundation makes available all content in this plug-in
+ ("Content"). Unless otherwise indicated below, the Content
+ is provided to you under the terms and conditions of the Eclipse
+ Public License Version 2.0 ("EPL"). A copy of the EPL is
+ available at <a href="https://www.eclipse.org/legal/epl-2.0">https://www.eclipse.org/legal/epl-2.0</a>.
+ For purposes of the EPL, "Program" will mean the Content.
+</p>
+
+<p>
+ If you did not receive this Content directly from the Eclipse
+ Foundation, the Content is being redistributed by another party
+ ("Redistributor") and different terms and conditions may
+ apply to your use of any object code in the Content. Check the
+ Redistributor's license that was provided with the Content. If no such
+ license exists, contact the Redistributor. Unless otherwise indicated
+ below, the terms and conditions of the EPL still apply to any source
+ code in the Content and such source code may be obtained at <a
+ href="https://www.eclipse.org/">https://www.eclipse.org</a>.
+</p>
+
+</body>
+</html>
diff --git a/autonature/org.eclipse.statet.eutils.autonature/build.properties b/autonature/org.eclipse.statet.eutils.autonature/build.properties
new file mode 100644
index 0000000..0dd195d
--- /dev/null
+++ b/autonature/org.eclipse.statet.eutils.autonature/build.properties
@@ -0,0 +1,10 @@
+source..= src/
+output..= bin/
+javacDefaultEncoding..= UTF-8
+
+bin.includes= META-INF/,\
+ plugin.xml,\
+ plugin.properties,\
+ .,\
+ about.html
+src.includes= .settings/org.eclipse.core.resources.prefs
diff --git a/autonature/org.eclipse.statet.eutils.autonature/plugin.properties b/autonature/org.eclipse.statet.eutils.autonature/plugin.properties
new file mode 100644
index 0000000..ab51679
--- /dev/null
+++ b/autonature/org.eclipse.statet.eutils.autonature/plugin.properties
@@ -0,0 +1,17 @@
+ #=============================================================================#
+ # Copyright (c) 2007, 2017 Stephan Wahlbrink and others.
+ #
+ # This program and the accompanying materials are made available under the
+ # terms of the Eclipse Public License 2.0 which is available at
+ # https://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0
+ # which is available at https://www.apache.org/licenses/LICENSE-2.0.
+ #
+ # SPDX-License-Identifier: EPL-2.0 OR Apache-2.0
+ #
+ # Contributors:
+ # Stephan Wahlbrink <sw@wahlbrink.eu> - initial API and implementation
+ #=============================================================================#
+
+preferencePages_name= Auto Project Configuration
+
+commands_DetectAndConfigureProject_name= Detect and Configure Project...
diff --git a/autonature/org.eclipse.statet.eutils.autonature/plugin.xml b/autonature/org.eclipse.statet.eutils.autonature/plugin.xml
new file mode 100644
index 0000000..978c2b2
--- /dev/null
+++ b/autonature/org.eclipse.statet.eutils.autonature/plugin.xml
@@ -0,0 +1,107 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<!--
+ #=============================================================================#
+ # Copyright (c) 2007, 2017 Stephan Wahlbrink and others.
+ #
+ # This program and the accompanying materials are made available under the
+ # terms of the Eclipse Public License 2.0 which is available at
+ # https://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0
+ # which is available at https://www.apache.org/licenses/LICENSE-2.0.
+ #
+ # SPDX-License-Identifier: EPL-2.0 OR Apache-2.0
+ #
+ # Contributors:
+ # Stephan Wahlbrink <sw@wahlbrink.eu> - initial API and implementation
+ #=============================================================================#
+-->
+
+<plugin>
+
+ <extension-point id="org.eclipse.statet.autonature.AutoConfigurations"
+ name="Auto Project Configurations"
+ schema="schema/AutoConfigurations.exsd"/>
+
+ <extension
+ point="org.eclipse.ui.startup">
+ <startup
+ class="org.eclipse.statet.internal.eutils.autonature.nostart.AutoNatureStartup">
+ </startup>
+ </extension>
+
+ <extension
+ point="org.eclipse.ui.keywords">
+ <keyword
+ id="org.eclipse.statet.autonature.keywords.project"
+ label="project nature">
+ </keyword>
+ </extension>
+ <extension
+ point="org.eclipse.ui.preferencePages">
+ <page
+ id="org.eclipse.statet.autonature.preferencePages.Config"
+ category="org.eclipse.ui.preferencePages.Workspace"
+ class="org.eclipse.statet.internal.eutils.autonature.AutoNaturePreferencePage"
+ name="%preferencePages_name">
+ <keywordReference
+ id="org.eclipse.statet.autonature.keywords.project">
+ </keywordReference>
+ </page>
+ </extension>
+
+ <extension
+ point="org.eclipse.ui.commands">
+ <command
+ id="org.eclipse.statet.autonature.commands.DetectAndConfigureProject"
+ categoryId="org.eclipse.ui.category.project"
+ name="%commands_DetectAndConfigureProject_name">
+ </command>
+ </extension>
+ <extension
+ point="org.eclipse.ui.handlers">
+ <handler
+ commandId="org.eclipse.statet.autonature.commands.DetectAndConfigureProject"
+ class="org.eclipse.statet.internal.eutils.autonature.wizards.ConfigureProjectHandler">
+ <activeWhen>
+ <with
+ variable="activeMenuSelection">
+ <or>
+ <and>
+ <count
+ value="1"/>
+ <iterate>
+ <adapt
+ type="org.eclipse.core.resources.IProject"/>
+ </iterate>
+ </and>
+ <and>
+ <count
+ value="!"/>
+ <with
+ variable="activeSelection">
+ <count
+ value="1"/>
+ <iterate>
+ <adapt
+ type="org.eclipse.core.resources.IProject"/>
+ </iterate>
+ </with>
+ </and>
+ </or>
+ </with>
+ </activeWhen>
+ </handler>
+ </extension>
+
+ <extension
+ point="org.eclipse.ui.menus">
+ <menuContribution
+ locationURI="popup:org.eclipse.ui.projectConfigure">
+ <command
+ commandId="org.eclipse.statet.autonature.commands.DetectAndConfigureProject"
+ style="push">
+ </command>
+ </menuContribution>
+ </extension>
+
+</plugin>
diff --git a/autonature/org.eclipse.statet.eutils.autonature/schema/AutoConfigurations.exsd b/autonature/org.eclipse.statet.eutils.autonature/schema/AutoConfigurations.exsd
new file mode 100644
index 0000000..94d6b36
--- /dev/null
+++ b/autonature/org.eclipse.statet.eutils.autonature/schema/AutoConfigurations.exsd
@@ -0,0 +1,154 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<schema targetNamespace="org.eclipse.statet.autonature" xmlns="http://www.w3.org/2001/XMLSchema">
+<annotation>
+ <appinfo>
+ <meta.schema id="AutoConfigurations"
+ plugin="org.eclipse.statet.eutils.autonature"
+ name="Auto Project Configurations"/>
+ </appinfo>
+ <documentation>
+ This extension-point allows to define project configurations automatically performed
+ on the specified events.
+ </documentation>
+ </annotation>
+
+ <element name="extension">
+ <annotation>
+ <appinfo>
+ <meta.element />
+ </appinfo>
+ </annotation>
+ <complexType>
+ <choice minOccurs="1" maxOccurs="unbounded">
+ <element ref="onFileContent"/>
+ </choice>
+ <attribute name="point" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="onFileContent">
+ <annotation>
+ <documentation>
+ Performed if a file with the specified content type is changed.
+ </documentation>
+ </annotation>
+ <complexType>
+ <choice>
+ <element ref="ensureProjectNature" minOccurs="0" maxOccurs="unbounded"/>
+ <element ref="runProjectConfigurator" minOccurs="0" maxOccurs="unbounded"/>
+ </choice>
+ <attribute name="contentTypeId" type="string" use="required">
+ <annotation>
+ <documentation>
+ The id of the content type to handle.
+ </documentation>
+ <appinfo>
+ <meta.attribute kind="identifier" basedOn="org.eclipse.core.contenttype.contentTypes/content-type/@id"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ <attribute name="enable" type="boolean">
+ <annotation>
+ <documentation>
+ If the it should be enabled by default.
+ </documentation>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="ensureProjectNature">
+ <annotation>
+ <documentation>
+ Installs the specified project nature, if it is missing.
+ </documentation>
+ </annotation>
+ <complexType>
+ <attribute name="natureId" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appinfo>
+ <meta.attribute kind="identifier" basedOn="org.eclipse.core.resources.natures/@id"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="runProjectConfigurator">
+ <annotation>
+ <documentation>
+ Asks the specified project configurator whether/to configure the project.
+ </documentation>
+ </annotation>
+ <complexType>
+ <attribute name="label" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appinfo>
+ <meta.attribute translatable="true"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ <attribute name="class" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appinfo>
+ <meta.attribute kind="java" basedOn=":org.eclipse.statet.eutils.autonature.IProjectConfigurator"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ <attribute name="natureId" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appinfo>
+ <meta.attribute kind="identifier" basedOn="org.eclipse.core.resources.natures/@id"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="since"/>
+ </appinfo>
+ <documentation>
+ 0.1
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="copyright"/>
+ </appinfo>
+ <documentation>
+ Copyright (c) 2014, 2017 Stephan Wahlbrink and others.
+
+This program and the accompanying materials are made available under the
+terms of the Eclipse Public License 2.0 which is available at
+https://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0
+which is available at https://www.apache.org/licenses/LICENSE-2.0.
+
+SPDX-License-Identifier: EPL-2.0 OR Apache-2.0
+
+Contributors:
+ Stephan Wahlbrink <sw@wahlbrink.eu> - initial API and implementation
+ </documentation>
+ </annotation>
+
+</schema>
diff --git a/autonature/org.eclipse.statet.eutils.autonature/src/org/eclipse/statet/eutils/autonature/core/ProjectConfigurator.java b/autonature/org.eclipse.statet.eutils.autonature/src/org/eclipse/statet/eutils/autonature/core/ProjectConfigurator.java
new file mode 100644
index 0000000..f843966
--- /dev/null
+++ b/autonature/org.eclipse.statet.eutils.autonature/src/org/eclipse/statet/eutils/autonature/core/ProjectConfigurator.java
@@ -0,0 +1,33 @@
+/*=============================================================================#
+ # Copyright (c) 2016, 2017 Stephan Wahlbrink and others.
+ #
+ # This program and the accompanying materials are made available under the
+ # terms of the Eclipse Public License 2.0 which is available at
+ # https://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0
+ # which is available at https://www.apache.org/licenses/LICENSE-2.0.
+ #
+ # SPDX-License-Identifier: EPL-2.0 OR Apache-2.0
+ #
+ # Contributors:
+ # Stephan Wahlbrink <sw@wahlbrink.eu> - initial API and implementation
+ #=============================================================================*/
+
+package org.eclipse.statet.eutils.autonature.core;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.IProgressMonitor;
+
+
+public interface ProjectConfigurator {
+
+
+ byte NOT_CONFIGURABLE= 0;
+ byte ALREADY_CONFIGURED= 1;
+ byte CONFIGURABLE= 2;
+
+
+ byte check(IProject project, IProgressMonitor monitor);
+
+ void configure(IProject project, IProgressMonitor monitor);
+
+}
diff --git a/autonature/org.eclipse.statet.eutils.autonature/src/org/eclipse/statet/internal/eutils/autonature/Activator.java b/autonature/org.eclipse.statet.eutils.autonature/src/org/eclipse/statet/internal/eutils/autonature/Activator.java
new file mode 100644
index 0000000..d60f617
--- /dev/null
+++ b/autonature/org.eclipse.statet.eutils.autonature/src/org/eclipse/statet/internal/eutils/autonature/Activator.java
@@ -0,0 +1,124 @@
+/*=============================================================================#
+ # Copyright (c) 2014, 2017 Stephan Wahlbrink and others.
+ #
+ # This program and the accompanying materials are made available under the
+ # terms of the Eclipse Public License 2.0 which is available at
+ # https://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0
+ # which is available at https://www.apache.org/licenses/LICENSE-2.0.
+ #
+ # SPDX-License-Identifier: EPL-2.0 OR Apache-2.0
+ #
+ # Contributors:
+ # Stephan Wahlbrink <sw@wahlbrink.eu> - initial API and implementation
+ #=============================================================================*/
+
+package org.eclipse.statet.internal.eutils.autonature;
+
+import org.osgi.framework.BundleContext;
+
+import org.eclipse.core.resources.IResourceChangeEvent;
+import org.eclipse.core.resources.IWorkspace;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.ILog;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.preferences.IEclipsePreferences.IPreferenceChangeListener;
+import org.eclipse.core.runtime.preferences.IEclipsePreferences.PreferenceChangeEvent;
+import org.eclipse.core.runtime.preferences.InstanceScope;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class Activator extends AbstractUIPlugin implements IPreferenceChangeListener {
+
+
+ public static final String BUNDLE_ID= "org.eclipse.statet.eutils.autonature"; //$NON-NLS-1$
+
+ public static final String ENABLED_PREF_KEY= "enabled"; //$NON-NLS-1$
+
+
+ private static Activator instance;
+
+ /**
+ * Returns the shared plug-in instance
+ *
+ * @return the shared instance
+ */
+ public static Activator getInstance() {
+ return instance;
+ }
+
+ public static void log(final IStatus status) {
+ final Activator plugin= getInstance();
+ if (plugin != null) {
+ final ILog log= plugin.getLog();
+ if (log != null) {
+ log.log(status);
+ }
+ }
+ }
+
+
+ private ConfigManager configManager;
+ private ResourceListener listener;
+
+
+ public Activator() {
+ }
+
+
+ @Override
+ public void start(final BundleContext context) throws Exception {
+ super.start(context);
+ instance= this;
+
+ this.configManager= new ConfigManager();
+
+ InstanceScope.INSTANCE.getNode(BUNDLE_ID).addPreferenceChangeListener(this);
+ }
+
+ @Override
+ public void stop(final BundleContext context) throws Exception {
+ instance= null;
+ super.stop(context);
+ }
+
+
+ public void runStartup() {
+ updateMonitor(true);
+ }
+
+ @Override
+ public void preferenceChange(final PreferenceChangeEvent event) {
+ if (event.getKey().equals(ENABLED_PREF_KEY)) {
+ updateMonitor(false);
+ }
+ }
+
+ public ConfigManager getConfigManager() {
+ return this.configManager;
+ }
+
+ private void updateMonitor(final boolean startup) {
+ final IWorkspace workspace= ResourcesPlugin.getWorkspace();
+ final boolean enabled= Platform.getPreferencesService().getBoolean(BUNDLE_ID, ENABLED_PREF_KEY, true, null);
+ synchronized (this) {
+ if (enabled) {
+ if (this.listener == null) {
+ this.listener= new ResourceListener(this.configManager);
+ }
+ workspace.addResourceChangeListener(this.listener, IResourceChangeEvent.POST_CHANGE);
+ // TODO use save participant
+ // if (startup) {
+ // }
+ }
+ else {
+ if (this.listener != null) {
+ workspace.removeResourceChangeListener(this.listener);
+ }
+ }
+ }
+ }
+}
diff --git a/autonature/org.eclipse.statet.eutils.autonature/src/org/eclipse/statet/internal/eutils/autonature/AutoConfig.java b/autonature/org.eclipse.statet.eutils.autonature/src/org/eclipse/statet/internal/eutils/autonature/AutoConfig.java
new file mode 100644
index 0000000..44b0b6e
--- /dev/null
+++ b/autonature/org.eclipse.statet.eutils.autonature/src/org/eclipse/statet/internal/eutils/autonature/AutoConfig.java
@@ -0,0 +1,93 @@
+/*=============================================================================#
+ # Copyright (c) 2014, 2017 Stephan Wahlbrink and others.
+ #
+ # This program and the accompanying materials are made available under the
+ # terms of the Eclipse Public License 2.0 which is available at
+ # https://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0
+ # which is available at https://www.apache.org/licenses/LICENSE-2.0.
+ #
+ # SPDX-License-Identifier: EPL-2.0 OR Apache-2.0
+ #
+ # Contributors:
+ # Stephan Wahlbrink <sw@wahlbrink.eu> - initial API and implementation
+ #=============================================================================*/
+
+package org.eclipse.statet.internal.eutils.autonature;
+
+import java.util.Collections;
+import java.util.List;
+
+
+public abstract class AutoConfig {
+
+
+ static class Dummy extends AutoConfig {
+
+ public Dummy(final String id) {
+ super(id, Collections.<Task>emptyList());
+ }
+
+ @Override
+ public String getLabel() {
+ return null;
+ }
+
+ }
+
+
+ private final String id;
+
+ private final String enabledPrefKey;
+
+ private final List<Task> tasks;
+
+
+ public AutoConfig(final String id, final List<Task> tasks) {
+ this.id= id;
+ this.enabledPrefKey= id + ".enabled";
+ this.tasks= tasks;
+ }
+
+
+ public String getId() {
+ return this.id;
+ }
+
+ public String getEnabledPrefKey() {
+ return this.enabledPrefKey;
+ }
+
+ public boolean isAvailable() {
+ if (getLabel() == null) {
+ return false;
+ }
+ for (final Task task : this.tasks) {
+ if (!task.isAvailable()) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ public boolean isSupported(final byte mode) {
+ for (final Task task : this.tasks) {
+ if (!task.isSupported(mode)) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ public abstract String getLabel();
+
+ public List<Task> getTasks() {
+ return this.tasks;
+ }
+
+
+ @Override
+ public String toString() {
+ return this.id;
+ }
+
+}
diff --git a/autonature/org.eclipse.statet.eutils.autonature/src/org/eclipse/statet/internal/eutils/autonature/AutoNaturePreferencePage.java b/autonature/org.eclipse.statet.eutils.autonature/src/org/eclipse/statet/internal/eutils/autonature/AutoNaturePreferencePage.java
new file mode 100644
index 0000000..e93d4e5
--- /dev/null
+++ b/autonature/org.eclipse.statet.eutils.autonature/src/org/eclipse/statet/internal/eutils/autonature/AutoNaturePreferencePage.java
@@ -0,0 +1,164 @@
+/*=============================================================================#
+ # Copyright (c) 2014, 2017 Stephan Wahlbrink and others.
+ #
+ # This program and the accompanying materials are made available under the
+ # terms of the Eclipse Public License 2.0 which is available at
+ # https://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0
+ # which is available at https://www.apache.org/licenses/LICENSE-2.0.
+ #
+ # SPDX-License-Identifier: EPL-2.0 OR Apache-2.0
+ #
+ # Contributors:
+ # Stephan Wahlbrink <sw@wahlbrink.eu> - initial API and implementation
+ #=============================================================================*/
+
+package org.eclipse.statet.internal.eutils.autonature;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import org.osgi.service.prefs.BackingStoreException;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.preferences.DefaultScope;
+import org.eclipse.core.runtime.preferences.IEclipsePreferences;
+import org.eclipse.core.runtime.preferences.IPreferencesService;
+import org.eclipse.core.runtime.preferences.InstanceScope;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.preference.PreferencePage;
+import org.eclipse.jface.viewers.CheckboxTableViewer;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPreferencePage;
+import org.eclipse.ui.statushandlers.StatusManager;
+
+import org.eclipse.statet.ecommons.ui.util.LayoutUtil;
+import org.eclipse.statet.ecommons.ui.viewers.ViewerUtils.CheckboxTableComposite;
+
+
+public class AutoNaturePreferencePage extends PreferencePage implements IWorkbenchPreferencePage {
+
+
+ private Button enableButton;
+
+ private CheckboxTableViewer entryViewer;
+
+ private List<AutoConfig> configs;
+
+
+ public AutoNaturePreferencePage() {
+ }
+
+
+ @Override
+ public void init(final IWorkbench workbench) {
+ }
+
+ @Override
+ protected Control createContents(final Composite parent) {
+ final Composite composite= new Composite(parent, SWT.NONE);
+ composite.setLayout(LayoutUtil.createCompositeGrid(1));
+
+ { this.enableButton= new Button(composite, SWT.CHECK);
+ this.enableButton.setText("Enable automatic project &configuration.");
+ this.enableButton.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
+ }
+
+ LayoutUtil.addSmallFiller(composite, false);
+
+ { final Label label= new Label(composite, SWT.NONE);
+ label.setText("Enable project configuration for:");
+ label.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
+
+ final CheckboxTableComposite tableComposite= UIUtils.createContentTypeTable(composite, 1);
+ this.entryViewer= tableComposite.viewer;
+ }
+
+ Dialog.applyDialogFont(composite);
+
+ loadConfigs();
+ loadPrefs();
+
+ return composite;
+ }
+
+ private void loadConfigs() {
+ final ConfigManager configManager= Activator.getInstance().getConfigManager();
+ this.configs= configManager.getConfigs(ConfigManager.AUTO_MODE);
+ UIUtils.sortConfigs(this.configs);
+ this.entryViewer.setInput(this.configs);
+ }
+
+ private void loadPrefs() {
+ final IPreferencesService preferences= Platform.getPreferencesService();
+
+ this.enableButton.setSelection(preferences.getBoolean(
+ Activator.BUNDLE_ID, Activator.ENABLED_PREF_KEY, true, null ));
+
+ final List<AutoConfig> checked= new ArrayList<>();
+ for (final AutoConfig config : this.configs) {
+ if (preferences.getBoolean(
+ ConfigManager.PREF_QUALIFIER, config.getEnabledPrefKey(), false, null )) {
+ checked.add(config);
+ }
+ }
+ this.entryViewer.setCheckedElements(checked.toArray());
+ }
+
+ private void savePrefs(final boolean flush) {
+ final IEclipsePreferences node= InstanceScope.INSTANCE.getNode(Activator.BUNDLE_ID);
+
+ node.putBoolean(Activator.ENABLED_PREF_KEY, this.enableButton.getSelection());
+
+ final IEclipsePreferences configsNode= InstanceScope.INSTANCE.getNode(ConfigManager.PREF_QUALIFIER);
+ final List<Object> enabled= Arrays.asList(this.entryViewer.getCheckedElements());
+ for (final AutoConfig config : this.configs) {
+ configsNode.putBoolean(config.getEnabledPrefKey(), enabled.contains(config));
+ }
+
+ if (flush) {
+ try {
+ node.flush();
+ }
+ catch (final BackingStoreException e) {
+ StatusManager.getManager().handle(new Status(IStatus.ERROR, Activator.BUNDLE_ID, -1,
+ "An error occured when saving the autorun launch configuration.", e));
+ }
+ }
+ }
+
+
+ @Override
+ protected void performDefaults() {
+ this.enableButton.setSelection(true);
+
+ final IEclipsePreferences configsNode= DefaultScope.INSTANCE.getNode(ConfigManager.PREF_QUALIFIER);
+ final List<AutoConfig> checked= new ArrayList<>();
+ for (final AutoConfig config : this.configs) {
+ if (configsNode.getBoolean(config.getEnabledPrefKey(), false)) {
+ checked.add(config);
+ }
+ }
+ this.entryViewer.setCheckedElements(checked.toArray());
+ }
+
+ @Override
+ protected void performApply() {
+ savePrefs(true);
+ }
+
+ @Override
+ public boolean performOk() {
+ savePrefs(false);
+ return true;
+ }
+
+}
diff --git a/autonature/org.eclipse.statet.eutils.autonature/src/org/eclipse/statet/internal/eutils/autonature/ConfigManager.java b/autonature/org.eclipse.statet.eutils.autonature/src/org/eclipse/statet/internal/eutils/autonature/ConfigManager.java
new file mode 100644
index 0000000..d9eb780
--- /dev/null
+++ b/autonature/org.eclipse.statet.eutils.autonature/src/org/eclipse/statet/internal/eutils/autonature/ConfigManager.java
@@ -0,0 +1,320 @@
+/*=============================================================================#
+ # Copyright (c) 2014, 2017 Stephan Wahlbrink and others.
+ #
+ # This program and the accompanying materials are made available under the
+ # terms of the Eclipse Public License 2.0 which is available at
+ # https://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0
+ # which is available at https://www.apache.org/licenses/LICENSE-2.0.
+ #
+ # SPDX-License-Identifier: EPL-2.0 OR Apache-2.0
+ #
+ # Contributors:
+ # Stephan Wahlbrink <sw@wahlbrink.eu> - initial API and implementation
+ #=============================================================================*/
+
+package org.eclipse.statet.internal.eutils.autonature;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.locks.ReentrantReadWriteLock;
+
+import org.eclipse.core.resources.IProjectNatureDescriptor;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.content.IContentType;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.core.runtime.preferences.DefaultScope;
+import org.eclipse.core.runtime.preferences.IEclipsePreferences;
+import org.eclipse.core.runtime.preferences.IEclipsePreferences.IPreferenceChangeListener;
+import org.eclipse.core.runtime.preferences.IEclipsePreferences.PreferenceChangeEvent;
+import org.eclipse.core.runtime.preferences.IPreferencesService;
+import org.eclipse.core.runtime.preferences.InstanceScope;
+
+
+public class ConfigManager implements IPreferenceChangeListener {
+
+
+ private static final String EXTENSION_POINT_ID= "org.eclipse.statet.autonature.AutoConfigurations"; //$NON-NLS-1$
+
+ static final String ON_FILE_CONTENT_CONTRIB= "onFileContent"; //$NON-NLS-1$
+
+ private static final String LABEL_ATTR_NAME= "label"; //$NON-NLS-1$
+ static final String CLASS_ATTR_NAME= "class"; //$NON-NLS-1$
+
+ private static final String CONTENT_TYPE_ID_ATTR_NAME= "contentTypeId"; //$NON-NLS-1$
+ private static final String ENABLE_ATTR_NAME= "enable"; //$NON-NLS-1$
+
+ private static final String ENSURE_PROJECT_NATURE_ELEMENT_NAME= "ensureProjectNature"; //$NON-NLS-1$
+ private static final String RUN_PROJECT_CONFIGURATOR_ELEMENT_NAME= "runProjectConfigurator"; //$NON-NLS-1$
+ private static final String NATURE_ID_ATTR_NAME= "natureId"; //$NON-NLS-1$
+
+ static final String PREF_QUALIFIER= Activator.BUNDLE_ID + "/configurations"; //$NON-NLS-1$
+
+ public static final byte AUTO_MODE= 1;
+ public static final byte MANUAL_MODE= 2;
+
+
+ private static final AutoConfig DISABLED= new AutoConfig.Dummy("disabled");
+
+
+ private class UpdateJob extends Job {
+
+ public UpdateJob() {
+ super("Update Auto Project Configuration");
+ setUser(false);
+ setSystem(true);
+ setPriority(Job.SHORT);
+ }
+
+ @Override
+ protected IStatus run(final IProgressMonitor monitor) {
+ ConfigManager.this.lock.writeLock().lock();
+ try {
+ updateActiveTasks();
+ }
+ finally {
+ ConfigManager.this.lock.writeLock().unlock();
+ }
+ return Status.OK_STATUS;
+ }
+
+ }
+
+
+ private final Map<String, AutoConfig> contentConfigs= new HashMap<>();
+
+ private final Map<String, AutoConfig> activeContentTasks= new HashMap<>();
+
+ private final HashMap<String, NatureTask> natureTasks= new HashMap<>();
+
+ private final ReentrantReadWriteLock lock= new ReentrantReadWriteLock();
+
+ private Job updateJob;
+
+
+ public ConfigManager() {
+ loadContributions();
+ updateActiveTasks();
+
+ InstanceScope.INSTANCE.getNode(PREF_QUALIFIER).addPreferenceChangeListener(this);
+ }
+
+
+ private void loadContributions() {
+ final IConfigurationElement[] contributions= Platform.getExtensionRegistry().getConfigurationElementsFor(EXTENSION_POINT_ID);
+ final IEclipsePreferences defaultsNode= DefaultScope.INSTANCE.getNode(PREF_QUALIFIER);
+ for (final IConfigurationElement contribution : contributions) {
+ final String name= contribution.getName();
+ if (name.equals(ON_FILE_CONTENT_CONTRIB)) {
+ String contentTypeId= contribution.getAttribute(CONTENT_TYPE_ID_ATTR_NAME);
+ if (contentTypeId == null || contentTypeId.isEmpty()) {
+ continue;
+ }
+ contentTypeId= contentTypeId.intern();
+ final List<Task> tasks= loadTasks(contribution.getChildren());
+ if (tasks.isEmpty()) {
+ continue;
+ }
+ final ContentTypeConfig config= new ContentTypeConfig(contentTypeId, tasks);
+ defaultsNode.putBoolean(config.getEnabledPrefKey(), Boolean.parseBoolean(
+ contribution.getAttribute(ENABLE_ATTR_NAME) ));
+ this.contentConfigs.put(contentTypeId, config);
+ }
+ }
+
+ for (final NatureTask task : this.natureTasks.values()) {
+ task.finish();
+ }
+ }
+
+ private List<Task> loadTasks(final IConfigurationElement[] tasksElements) {
+ final List<Task> tasks= new ArrayList<>(tasksElements.length);
+ for (int i= 0; i < tasksElements.length; i++) {
+ final IConfigurationElement taskElement= tasksElements[i];
+ switch (taskElement.getName()) {
+ case ENSURE_PROJECT_NATURE_ELEMENT_NAME: {
+ final String natureId= taskElement.getAttribute(NATURE_ID_ATTR_NAME);
+ if (natureId == null || natureId.isEmpty()) {
+ continue;
+ }
+ tasks.add(getNatureTask(natureId));
+ continue;
+ }
+ case RUN_PROJECT_CONFIGURATOR_ELEMENT_NAME: {
+ final String label= taskElement.getAttribute(LABEL_ATTR_NAME);
+ if (label == null || label.isEmpty()) {
+ continue;
+ }
+ final String className= taskElement.getAttribute(CLASS_ATTR_NAME);
+ if (className == null || className.isEmpty()) {
+ continue;
+ }
+ tasks.add(getConfiguratorTask(label, taskElement));
+ continue;
+ }
+ default:
+ continue;
+ }
+ }
+ checkTasks(tasks);
+ return tasks;
+ }
+
+ private void checkTasks(final List<Task> tasks) {
+ if (tasks.size() <= 1) {
+ return;
+ }
+ NatureTask prev= null;
+ for (final Task task : tasks) {
+ if (task instanceof NatureTask) {
+ final NatureTask current= (NatureTask) task;
+ if (prev != null) {
+ current.addPrev(prev);
+ }
+ prev= current;
+ }
+ }
+ }
+
+ private NatureTask getNatureTask(String natureId) {
+ NatureTask task= this.natureTasks.get(natureId);
+ if (task == null) {
+ natureId= natureId.intern();
+ final IProjectNatureDescriptor nature= ResourcesPlugin.getWorkspace().getNatureDescriptor(natureId);
+ task= (nature != null) ? new NatureTask(natureId, nature.getLabel(),
+ Arrays.asList(nature.getRequiredNatureIds()) ) :
+ new NatureTask(natureId, null, Collections.<String>emptyList());
+ this.natureTasks.put(natureId, task);
+ for (final String requiredId : task.getRequiredNatureIds()) {
+ task.addPrev(getNatureTask(requiredId));
+ }
+ }
+ return task;
+ }
+
+ private ConfiguratorTask getConfiguratorTask(final String label, final IConfigurationElement taskElement) {
+ return new ConfiguratorTask(label, taskElement.getAttribute(NATURE_ID_ATTR_NAME),
+ taskElement );
+ }
+
+ @Override
+ public synchronized void preferenceChange(final PreferenceChangeEvent event) {
+ if (this.updateJob == null) {
+ this.updateJob= new UpdateJob();
+ }
+ this.updateJob.schedule(100);
+ }
+
+ private void updateActiveTasks() {
+ final IPreferencesService preferences= Platform.getPreferencesService();
+ for (final Map.Entry<String, AutoConfig> entry : this.contentConfigs.entrySet()) {
+ final AutoConfig config= entry.getValue();
+ this.activeContentTasks.put(entry.getKey(),
+ (preferences.getBoolean(PREF_QUALIFIER, config.getEnabledPrefKey(), false, null)) ?
+ config : DISABLED );
+ }
+ }
+
+
+ public List<AutoConfig> getConfigs(final byte mode) {
+ ArrayList<AutoConfig> list;
+ this.lock.readLock().lock();
+ try {
+ list= new ArrayList<>(this.contentConfigs.values());
+ }
+ finally {
+ this.lock.readLock().unlock();
+ }
+ for (final Iterator<AutoConfig> iter= list.iterator(); iter.hasNext();) {
+ final AutoConfig config= iter.next();
+ if (!(config.isAvailable() && config.isSupported(mode))) {
+ iter.remove();
+ }
+ }
+ return list;
+ }
+
+ public boolean hasActiveConfigs() {
+ this.lock.readLock().lock();
+ try {
+ return !this.activeContentTasks.isEmpty();
+ }
+ finally {
+ this.lock.readLock().unlock();
+ }
+ }
+
+ public AutoConfig getConfig(IContentType contentType, final byte mode) {
+ this.lock.readLock().lock();
+ try {
+ while (contentType != null) {
+ final AutoConfig config= this.activeContentTasks.get(contentType.getId());
+ if (config != null && config.isSupported(mode)) {
+ return (config != DISABLED) ? config : null;
+ }
+ contentType= contentType.getBaseType();
+ }
+ return null;
+ }
+ finally {
+ this.lock.readLock().unlock();
+ }
+ }
+
+
+ public List<String> arrangeNatures(final List<String> natureIds, final int newIdx) {
+ this.lock.readLock().lock();
+ try {
+ Collections.sort(natureIds.subList(newIdx, natureIds.size()));
+
+ // Insert required
+ ITER_I: for (int i= 0; i < natureIds.size(); i++) {
+ CHECK_I: while(true) {
+ final NatureTask task= this.natureTasks.get(natureIds.get(i));
+ if (task != null) {
+ for (final String requiredId : task.getRequiredNatureIds()) {
+ if (!natureIds.contains(requiredId)) {
+ natureIds.add(i, requiredId);
+ continue CHECK_I;
+ }
+ }
+ }
+ continue ITER_I;
+ }
+ }
+
+ final int n= natureIds.size();
+ ITER_I: for (int i= 0; i < n; i++) {
+ CHECK_I: for (int counter= n - i; counter > 0; counter--) {
+ final String natureId= natureIds.get(i);
+ final NatureTask task= this.natureTasks.get(natureId);
+ if (task != null) {
+ for (int j= n - 1; j > i; j--) {
+ if (task.isSubsequentTo(natureIds.get(j))) {
+ // move i -> j
+ natureIds.remove(i);
+ natureIds.add(j, natureId);
+ continue CHECK_I; // check new i
+ }
+ }
+ }
+ continue ITER_I; // OK, check i + 1
+ }
+ }
+ return natureIds;
+ }
+ finally {
+ this.lock.readLock().unlock();
+ }
+ }
+
+}
diff --git a/autonature/org.eclipse.statet.eutils.autonature/src/org/eclipse/statet/internal/eutils/autonature/ConfiguratorTask.java b/autonature/org.eclipse.statet.eutils.autonature/src/org/eclipse/statet/internal/eutils/autonature/ConfiguratorTask.java
new file mode 100644
index 0000000..65b2d78
--- /dev/null
+++ b/autonature/org.eclipse.statet.eutils.autonature/src/org/eclipse/statet/internal/eutils/autonature/ConfiguratorTask.java
@@ -0,0 +1,103 @@
+/*=============================================================================#
+ # Copyright (c) 2016, 2017 Stephan Wahlbrink and others.
+ #
+ # This program and the accompanying materials are made available under the
+ # terms of the Eclipse Public License 2.0 which is available at
+ # https://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0
+ # which is available at https://www.apache.org/licenses/LICENSE-2.0.
+ #
+ # SPDX-License-Identifier: EPL-2.0 OR Apache-2.0
+ #
+ # Contributors:
+ # Stephan Wahlbrink <sw@wahlbrink.eu> - initial API and implementation
+ #=============================================================================*/
+
+package org.eclipse.statet.internal.eutils.autonature;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.SubMonitor;
+
+import org.eclipse.statet.eutils.autonature.core.ProjectConfigurator;
+
+
+public class ConfiguratorTask extends Task {
+
+
+ private final String label;
+
+ private final String natureId;
+
+ private IConfigurationElement configElement;
+
+ private ProjectConfigurator configurator;
+
+
+ public ConfiguratorTask(final String label, final String natureId,
+ final IConfigurationElement configElement) {
+ this.label= label;
+ this.natureId= natureId;
+ this.configElement= configElement;
+ }
+
+
+ private synchronized ProjectConfigurator getProjectConfigurator() throws CoreException {
+ if (this.configElement != null) {
+ try {
+ this.configurator= (ProjectConfigurator) this.configElement
+ .createExecutableExtension(ConfigManager.CLASS_ATTR_NAME);
+ }
+ finally {
+ this.configElement= null;
+ }
+ }
+ return this.configurator;
+ }
+
+ @Override
+ public String getLabel() {
+ return this.label;
+ }
+
+ @Override
+ public boolean isAvailable() {
+ return (this.label != null);
+ }
+
+ @Override
+ public boolean isSupported(final byte mode) {
+ return (mode == ConfigManager.MANUAL_MODE);
+ }
+
+ @Override
+ public byte check(final IProject project, final int flags, final SubMonitor m) throws CoreException {
+ if (this.natureId != null) {
+ try {
+ if (project.hasNature(this.natureId)) {
+ return ProjectConfigurator.ALREADY_CONFIGURED;
+ }
+ }
+ catch (final CoreException e) {}
+ }
+ if ((flags & CONTENT_MATCH) == 0) {
+ return ProjectConfigurator.NOT_CONFIGURABLE;
+ }
+ final ProjectConfigurator configurator= getProjectConfigurator();
+ if (configurator == null) {
+ return 0;
+ }
+ return configurator.check(project, m);
+ }
+
+ public void configure(final IProject project, final SubMonitor m) {
+ this.configurator.configure(project, m);
+ }
+
+
+ @Override
+ public String toString() {
+ return "ConfiguratorTask '" + this.label + "'"; //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+}
diff --git a/autonature/org.eclipse.statet.eutils.autonature/src/org/eclipse/statet/internal/eutils/autonature/ContentFinder.java b/autonature/org.eclipse.statet.eutils.autonature/src/org/eclipse/statet/internal/eutils/autonature/ContentFinder.java
new file mode 100644
index 0000000..c9c41a0
--- /dev/null
+++ b/autonature/org.eclipse.statet.eutils.autonature/src/org/eclipse/statet/internal/eutils/autonature/ContentFinder.java
@@ -0,0 +1,117 @@
+/*=============================================================================#
+ # Copyright (c) 2016, 2017 Stephan Wahlbrink and others.
+ #
+ # This program and the accompanying materials are made available under the
+ # terms of the Eclipse Public License 2.0 which is available at
+ # https://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0
+ # which is available at https://www.apache.org/licenses/LICENSE-2.0.
+ #
+ # SPDX-License-Identifier: EPL-2.0 OR Apache-2.0
+ #
+ # Contributors:
+ # Stephan Wahlbrink <sw@wahlbrink.eu> - initial API and implementation
+ #=============================================================================*/
+
+package org.eclipse.statet.internal.eutils.autonature;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Set;
+
+import org.eclipse.core.resources.IContainer;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IResourceVisitor;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.OperationCanceledException;
+import org.eclipse.core.runtime.content.IContentDescription;
+import org.eclipse.core.runtime.content.IContentType;
+
+
+public class ContentFinder implements IResourceVisitor {
+
+
+ private final IContainer root;
+ private final Set<IPath> ignoredPaths;
+
+ private final ConfigManager configManager;
+ private final byte mode;
+
+ private final List<AutoConfig> configs= new ArrayList<>();
+
+ private final IProgressMonitor monitor;
+
+
+ public ContentFinder(final IContainer root, final Set<IPath> ignoredPaths,
+ final ConfigManager configManager, final byte mode,
+ final IProgressMonitor monitor) {
+ this.root= root;
+ this.ignoredPaths= ignoredPaths;
+ this.configManager= configManager;
+ this.mode= mode;
+ this.monitor= monitor;
+ }
+
+ @Override
+ public boolean visit(final IResource resource) throws CoreException {
+ if (this.monitor.isCanceled()) {
+ throw new OperationCanceledException();
+ }
+
+ if (resource != this.root && this.ignoredPaths != null) {
+ for (final IPath ignoredDirectory : this.ignoredPaths) {
+ if (ignoredDirectory.equals(resource.getLocation())) {
+ return false;
+ }
+ }
+ }
+
+ switch (resource.getType()) {
+ case IResource.PROJECT:
+ case IResource.FOLDER:
+ return true;
+ case IResource.FILE:
+ checkFile((IFile) resource);
+ return false;
+ default:
+ return false;
+ }
+
+ }
+
+ private void checkFile(final IFile file) {
+ try {
+ final IContentDescription description= file.getContentDescription();
+ if (description == null) {
+ return;
+ }
+ final IContentType contentType= description.getContentType();
+ if (contentType == null) {
+ return;
+ }
+ final AutoConfig config= this.configManager.getConfig(contentType, this.mode);
+ if (config != null) {
+ addTasks(config);
+ }
+ }
+ catch (final CoreException e) {
+ }
+ }
+
+ protected void addTasks(final AutoConfig config) {
+ if (!this.configs.contains(config)) {
+ this.configs.add(config);
+ }
+ }
+
+ public boolean hasTasks() {
+ return (!this.configs.isEmpty());
+ }
+
+ public List<AutoConfig> getConfigs() {
+ return this.configs;
+ }
+
+}
diff --git a/autonature/org.eclipse.statet.eutils.autonature/src/org/eclipse/statet/internal/eutils/autonature/ContentTypeConfig.java b/autonature/org.eclipse.statet.eutils.autonature/src/org/eclipse/statet/internal/eutils/autonature/ContentTypeConfig.java
new file mode 100644
index 0000000..b4a97cb
--- /dev/null
+++ b/autonature/org.eclipse.statet.eutils.autonature/src/org/eclipse/statet/internal/eutils/autonature/ContentTypeConfig.java
@@ -0,0 +1,53 @@
+/*=============================================================================#
+ # Copyright (c) 2014, 2017 Stephan Wahlbrink and others.
+ #
+ # This program and the accompanying materials are made available under the
+ # terms of the Eclipse Public License 2.0 which is available at
+ # https://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0
+ # which is available at https://www.apache.org/licenses/LICENSE-2.0.
+ #
+ # SPDX-License-Identifier: EPL-2.0 OR Apache-2.0
+ #
+ # Contributors:
+ # Stephan Wahlbrink <sw@wahlbrink.eu> - initial API and implementation
+ #=============================================================================*/
+
+package org.eclipse.statet.internal.eutils.autonature;
+
+import java.util.List;
+
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.content.IContentType;
+
+
+public class ContentTypeConfig extends AutoConfig {
+
+
+ private final String contentTypeId;
+
+ private String label;
+
+
+ public ContentTypeConfig(final String contentTypeId, final List<Task> tasks) {
+ super(ConfigManager.ON_FILE_CONTENT_CONTRIB + ':' + contentTypeId, tasks);
+ this.contentTypeId= contentTypeId;
+ }
+
+
+ public String getContentTypeId() {
+ return this.contentTypeId;
+ }
+
+
+ @Override
+ public String getLabel() {
+ if (this.label == null) {
+ final IContentType contentType= Platform.getContentTypeManager().getContentType(this.contentTypeId);
+ if (contentType != null) {
+ this.label= contentType.getName();
+ }
+ }
+ return this.label;
+ }
+
+}
diff --git a/autonature/org.eclipse.statet.eutils.autonature/src/org/eclipse/statet/internal/eutils/autonature/NatureTask.java b/autonature/org.eclipse.statet.eutils.autonature/src/org/eclipse/statet/internal/eutils/autonature/NatureTask.java
new file mode 100644
index 0000000..1e43c63
--- /dev/null
+++ b/autonature/org.eclipse.statet.eutils.autonature/src/org/eclipse/statet/internal/eutils/autonature/NatureTask.java
@@ -0,0 +1,118 @@
+/*=============================================================================#
+ # Copyright (c) 2014, 2017 Stephan Wahlbrink and others.
+ #
+ # This program and the accompanying materials are made available under the
+ # terms of the Eclipse Public License 2.0 which is available at
+ # https://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0
+ # which is available at https://www.apache.org/licenses/LICENSE-2.0.
+ #
+ # SPDX-License-Identifier: EPL-2.0 OR Apache-2.0
+ #
+ # Contributors:
+ # Stephan Wahlbrink <sw@wahlbrink.eu> - initial API and implementation
+ #=============================================================================*/
+
+package org.eclipse.statet.internal.eutils.autonature;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.SubMonitor;
+
+import org.eclipse.statet.eutils.autonature.core.ProjectConfigurator;
+
+
+public class NatureTask extends Task {
+
+
+ private static NatureTask get(final List<NatureTask> tasks, final String natureId) {
+ final int size= tasks.size();
+ for (int i= 0; i < size; i++) {
+ final NatureTask task= tasks.get(i);
+ if (task.getNatureId() == natureId) {
+ return task;
+ }
+ }
+ return null;
+ }
+
+
+ private final String natureId;
+
+ private final String label;
+
+ private final List<String> required;
+
+ private final List<NatureTask> prev= new ArrayList<>(4);
+ private final List<NatureTask> prevFlat= new ArrayList<>(8);
+
+
+ public NatureTask(final String natureId, final String label, final List<String> required) {
+ this.natureId= natureId;
+ this.label= label;
+ this.required= required;
+ }
+
+
+ public String getNatureId() {
+ return this.natureId;
+ }
+
+ @Override
+ public String getLabel() {
+ return this.label;
+ }
+
+ @Override
+ public boolean isAvailable() {
+ return (this.label != null);
+ }
+
+
+ public List<String> getRequiredNatureIds() {
+ return this.required;
+ }
+
+ void addPrev(final NatureTask task) {
+ if (!this.prev.contains(task)) {
+ this.prev.add(task);
+ }
+ }
+
+ void finish() {
+ this.prevFlat.clear();
+ for (int i= 0; i < this.prev.size(); i++) {
+ this.prevFlat.add(this.prev.get(i));
+ }
+ for (int i= 0; i < this.prevFlat.size(); i++) {
+ final List<NatureTask> tasks= this.prevFlat.get(i).prev;
+ for (int j= 0; j < tasks.size(); j++) {
+ final NatureTask task= tasks.get(j);
+ if (task != this && !this.prevFlat.contains(task)) {
+ this.prevFlat.add(task);
+ }
+ }
+ }
+ }
+
+ boolean isSubsequentTo(final String natureId) {
+ final NatureTask task= get(this.prevFlat, natureId);
+ return (task != null && get(task.prevFlat, this.natureId) == null);
+ }
+
+ @Override
+ public byte check(final IProject project, final int flags, final SubMonitor m) throws CoreException {
+ return (project.hasNature(this.natureId)) ?
+ ProjectConfigurator.ALREADY_CONFIGURED :
+ ProjectConfigurator.CONFIGURABLE;
+ }
+
+
+ @Override
+ public String toString() {
+ return "NatureTask '" + this.natureId + "'"; //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+}
diff --git a/autonature/org.eclipse.statet.eutils.autonature/src/org/eclipse/statet/internal/eutils/autonature/ResourceListener.java b/autonature/org.eclipse.statet.eutils.autonature/src/org/eclipse/statet/internal/eutils/autonature/ResourceListener.java
new file mode 100644
index 0000000..3b9cdf0
--- /dev/null
+++ b/autonature/org.eclipse.statet.eutils.autonature/src/org/eclipse/statet/internal/eutils/autonature/ResourceListener.java
@@ -0,0 +1,155 @@
+/*=============================================================================#
+ # Copyright (c) 2014, 2017 Stephan Wahlbrink and others.
+ #
+ # This program and the accompanying materials are made available under the
+ # terms of the Eclipse Public License 2.0 which is available at
+ # https://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0
+ # which is available at https://www.apache.org/licenses/LICENSE-2.0.
+ #
+ # SPDX-License-Identifier: EPL-2.0 OR Apache-2.0
+ #
+ # Contributors:
+ # Stephan Wahlbrink <sw@wahlbrink.eu> - initial API and implementation
+ #=============================================================================*/
+
+package org.eclipse.statet.internal.eutils.autonature;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.concurrent.atomic.AtomicInteger;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IResourceChangeEvent;
+import org.eclipse.core.resources.IResourceChangeListener;
+import org.eclipse.core.resources.IResourceDelta;
+import org.eclipse.core.resources.IResourceDeltaVisitor;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.SubMonitor;
+import org.eclipse.core.runtime.content.IContentDescription;
+import org.eclipse.core.runtime.content.IContentType;
+import org.eclipse.osgi.util.NLS;
+
+
+public class ResourceListener implements IResourceChangeListener, IResourceDeltaVisitor {
+
+
+ private final ConfigManager configManager;
+
+ private final Map<IProject, List<AutoConfig>> projectConfigs;
+
+ private final AtomicInteger counter= new AtomicInteger();
+
+ private final TaskProcessor taskProcessor= new TaskProcessor();
+
+
+ public ResourceListener(final ConfigManager configManager) {
+ this.configManager= configManager;
+ this.projectConfigs= new HashMap<>();
+ }
+
+
+ @Override
+ public void resourceChanged(final IResourceChangeEvent event) {
+ if (event.getType() == IResourceChangeEvent.POST_CHANGE
+ && this.configManager.hasActiveConfigs() ) {
+ this.counter.incrementAndGet();
+ try {
+ event.getDelta().accept(this);
+ }
+ catch (final CoreException e) {
+ Activator.log(new Status(IStatus.ERROR, Activator.BUNDLE_ID, 0,
+ "An error occurred when checking for auto configuration tasks for changed resources.",
+ e ));
+ }
+ finally {
+ if (this.counter.decrementAndGet() == 0) {
+ scheduleTasks();
+ }
+ }
+ }
+ }
+
+ @Override
+ public boolean visit(final IResourceDelta delta) throws CoreException {
+ IResource resource;
+ switch (delta.getKind()) {
+ case IResourceDelta.ADDED:
+ case IResourceDelta.CHANGED:
+ resource= delta.getResource();
+ if (resource.getType() == IResource.FILE) {
+ checkFile((IFile) resource);
+ }
+ return true;
+ default:
+ return false;
+ }
+ }
+
+ private void checkFile(final IFile file) {
+ try {
+ final IContentDescription description= file.getContentDescription();
+ if (description == null) {
+ return;
+ }
+ final IContentType contentType= description.getContentType();
+ if (contentType == null) {
+ return;
+ }
+ final AutoConfig config= this.configManager.getConfig(contentType, ConfigManager.AUTO_MODE);
+ if (config != null) {
+ addTasks(file.getProject(), config);
+ }
+ }
+ catch (final CoreException e) {
+ }
+ }
+
+ private synchronized void addTasks(final IProject project, final AutoConfig config) {
+ List<AutoConfig> configs= this.projectConfigs.get(project);
+ if (configs == null) {
+ configs= new ArrayList<>(8);
+ this.projectConfigs.put(project, configs);
+ }
+ if (!configs.contains(config)) {
+ configs.add(config);
+ }
+ }
+
+ private synchronized void scheduleTasks() {
+ if (this.projectConfigs.isEmpty()) {
+ return;
+ }
+ final List<Task> tasks= new ArrayList<>();
+ for (final Entry<IProject, List<AutoConfig>> entry : this.projectConfigs.entrySet()) {
+ final IProject project= entry.getKey();
+ try {
+ TaskProcessor.aggregateTasks(project, entry.getValue(), Task.CONTENT_MATCH,
+ tasks, null, null,
+ SubMonitor.convert(null) );
+
+ if (!tasks.isEmpty()) {
+ this.taskProcessor.add(project, tasks);
+ }
+ }
+ catch (final CoreException e) {
+ Activator.log(new Status(IStatus.ERROR, Activator.BUNDLE_ID, 0,
+ NLS.bind("An error occurred when aggregating auto configuration tasks for project ''{0}''", project),
+ e ));
+ }
+ finally {
+ tasks.clear();
+ }
+ }
+ this.projectConfigs.clear();
+
+ this.taskProcessor.schedule();
+ }
+
+}
diff --git a/autonature/org.eclipse.statet.eutils.autonature/src/org/eclipse/statet/internal/eutils/autonature/Task.java b/autonature/org.eclipse.statet.eutils.autonature/src/org/eclipse/statet/internal/eutils/autonature/Task.java
new file mode 100644
index 0000000..65fbb6a
--- /dev/null
+++ b/autonature/org.eclipse.statet.eutils.autonature/src/org/eclipse/statet/internal/eutils/autonature/Task.java
@@ -0,0 +1,58 @@
+/*=============================================================================#
+ # Copyright (c) 2014, 2017 Stephan Wahlbrink and others.
+ #
+ # This program and the accompanying materials are made available under the
+ # terms of the Eclipse Public License 2.0 which is available at
+ # https://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0
+ # which is available at https://www.apache.org/licenses/LICENSE-2.0.
+ #
+ # SPDX-License-Identifier: EPL-2.0 OR Apache-2.0
+ #
+ # Contributors:
+ # Stephan Wahlbrink <sw@wahlbrink.eu> - initial API and implementation
+ #=============================================================================*/
+
+package org.eclipse.statet.internal.eutils.autonature;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.SubMonitor;
+
+
+public abstract class Task {
+
+
+ public static final int CONTENT_MATCH= 1;
+
+
+ /**
+ * Returns the label of the task (appears in UI).
+ *
+ * @return the label
+ */
+ public abstract String getLabel();
+
+ /**
+ * Returns if all requirements (like dependencies, project natures, ...) are available.
+ *
+ * @return if available
+ */
+ public abstract boolean isAvailable();
+
+ public boolean isSupported(final byte mode) {
+ return true;
+ }
+
+ /**
+ * Validates if task is required for the specified project.
+ *
+ * @param project
+ * @param flags TODO
+ * @param m progress monitor
+ * @return
+ * @throws CoreException
+ */
+ public abstract byte check(IProject project,
+ int flags, SubMonitor m) throws CoreException;
+
+}
diff --git a/autonature/org.eclipse.statet.eutils.autonature/src/org/eclipse/statet/internal/eutils/autonature/TaskProcessor.java b/autonature/org.eclipse.statet.eutils.autonature/src/org/eclipse/statet/internal/eutils/autonature/TaskProcessor.java
new file mode 100644
index 0000000..0ae5d05
--- /dev/null
+++ b/autonature/org.eclipse.statet.eutils.autonature/src/org/eclipse/statet/internal/eutils/autonature/TaskProcessor.java
@@ -0,0 +1,234 @@
+/*=============================================================================#
+ # Copyright (c) 2014, 2017 Stephan Wahlbrink and others.
+ #
+ # This program and the accompanying materials are made available under the
+ # terms of the Eclipse Public License 2.0 which is available at
+ # https://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0
+ # which is available at https://www.apache.org/licenses/LICENSE-2.0.
+ #
+ # SPDX-License-Identifier: EPL-2.0 OR Apache-2.0
+ #
+ # Contributors:
+ # Stephan Wahlbrink <sw@wahlbrink.eu> - initial API and implementation
+ #=============================================================================*/
+
+package org.eclipse.statet.internal.eutils.autonature;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IProjectDescription;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.resources.WorkspaceJob;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.MultiStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.SubMonitor;
+import org.eclipse.osgi.util.NLS;
+
+import org.eclipse.statet.eutils.autonature.core.ProjectConfigurator;
+
+
+public class TaskProcessor {
+
+
+ private class ConfigJob extends WorkspaceJob {
+
+
+ public ConfigJob() {
+ super("Auto Project Configuration");
+ setUser(false);
+ setRule(ResourcesPlugin.getWorkspace().getRoot());
+ }
+
+
+ @Override
+ public IStatus runInWorkspace(final IProgressMonitor monitor) throws CoreException {
+ return TaskProcessor.this.process(monitor);
+ }
+
+ }
+
+
+ public static void aggregateTasks(final IProject project, final List<AutoConfig> configs,
+ final int flags,
+ List<Task> configurableTasks, List<Task> alreadyConfigTasks, List<Task> notConfigTasks,
+ final SubMonitor m) throws CoreException {
+ final int l= configs.size();
+
+ if (configurableTasks == null) {
+ configurableTasks= new ArrayList<>(l);
+ }
+ if (alreadyConfigTasks == null) {
+ alreadyConfigTasks= new ArrayList<>(l);
+ }
+ if (notConfigTasks == null) {
+ notConfigTasks= new ArrayList<>();
+ }
+
+ for (int i= 0; i < l; i++) {
+ m.setWorkRemaining(l - i);
+
+ final AutoConfig config= configs.get(i);
+ if (config.isAvailable()) {
+ for (final Task task : config.getTasks()) {
+ if (!(configurableTasks.contains(task)
+ || alreadyConfigTasks.contains(task)
+ || notConfigTasks.contains(task) )) {
+ switch (task.check(project, flags, m.newChild(1))) {
+ case ProjectConfigurator.CONFIGURABLE:
+ configurableTasks.add(task);
+ break;
+ case ProjectConfigurator.ALREADY_CONFIGURED:
+ alreadyConfigTasks.add(task);
+ break;
+ default:
+ notConfigTasks.add(task);
+ break;
+ }
+ }
+ }
+ }
+ }
+ }
+
+ public static IStatus process(final IProject project, final Collection<Task> tasks,
+ final SubMonitor m) {
+ try {
+ int taskCount= 0;
+ for (final Task task : tasks) {
+ if (task instanceof ConfiguratorTask) {
+ taskCount++;
+ }
+ }
+
+ m.beginTask(NLS.bind("Configuring project ''{0}''", project.getName()), 3 + taskCount);
+ final IProjectDescription description= project.getDescription();
+ boolean descriptionChanged= false;
+
+ final String[] existingNatureIds= description.getNatureIds();
+ final List<String> natureIds= new ArrayList<>(existingNatureIds.length + tasks.size());
+ for (int i= 0; i < existingNatureIds.length; i++) {
+ natureIds.add(existingNatureIds[i]= existingNatureIds[i].intern());
+ }
+ for (final Task task : tasks) {
+ if (task instanceof NatureTask) {
+ final String natureId= ((NatureTask) task).getNatureId();
+ if (!contains(existingNatureIds, natureId)) {
+ natureIds.add(natureId);
+ }
+ }
+ }
+ m.worked(1);
+
+ if (natureIds.size() > existingNatureIds.length) {
+ final ConfigManager configManager= Activator.getInstance().getConfigManager();
+ configManager.arrangeNatures(natureIds, existingNatureIds.length);
+ description.setNatureIds(natureIds.toArray(new String[natureIds.size()]));
+ descriptionChanged= true;
+ }
+
+ if (descriptionChanged) {
+ project.setDescription(description, m.newChild(1));
+ }
+
+ m.setWorkRemaining(taskCount);
+ for (final Task task : tasks) {
+ if (task instanceof ConfiguratorTask) {
+ ((ConfiguratorTask) task).configure(project, m.newChild(1));
+ }
+ }
+
+ return Status.OK_STATUS;
+ }
+ catch (final CoreException e) {
+ return new Status(IStatus.ERROR, Activator.BUNDLE_ID,
+ NLS.bind("An error occurred when configuring project ''{0}''.", project.getName()),
+ e );
+ }
+ }
+
+
+ private Map<IProject, List<Task>> projectTasks;
+
+ private ConfigJob job;
+
+
+ public TaskProcessor() {
+ this.projectTasks= new HashMap<>();
+ }
+
+
+ public synchronized void add(final IProject project, final List<Task> tasks) {
+ final List<Task> allTasks= this.projectTasks.get(project);
+ if (allTasks == null) {
+ this.projectTasks.put(project, new ArrayList<>(tasks));
+ return;
+ }
+ for (final Task task : tasks) {
+ if (!allTasks.contains(task)) {
+ allTasks.add(task);
+ }
+ }
+ }
+
+ public synchronized void schedule() {
+ if (this.projectTasks.isEmpty()) {
+ return;
+ }
+ if (this.job == null) {
+ this.job= new ConfigJob();
+ }
+ this.job.schedule();
+ }
+
+
+ private IStatus process(final IProgressMonitor monitor) {
+ final Map<IProject, List<Task>> tasks;
+ synchronized (this) {
+ tasks= this.projectTasks;
+ if (tasks.isEmpty()) {
+ return Status.OK_STATUS;
+ }
+ this.projectTasks= new HashMap<>();
+ }
+
+ final SubMonitor m= SubMonitor.convert(monitor, tasks.size());
+ List<IStatus> status= null;
+ for (final Map.Entry<IProject, List<Task>> entry : tasks.entrySet()) {
+ final IStatus projectStatus= process(entry.getKey(), entry.getValue(),
+ m.newChild(1, SubMonitor.SUPPRESS_NONE) );
+ if (!projectStatus.isOK()) {
+ if (status == null) {
+ status= new ArrayList<>(tasks.size());
+ }
+ status.add(projectStatus);
+ }
+ }
+
+ if (status != null) {
+ return new MultiStatus(Activator.BUNDLE_ID, 0, status.toArray(new IStatus[status.size()]),
+ (status.size() == 1) ?
+ "The auto project configuration failed for 1 project." :
+ NLS.bind("The auto project configuration failed for {0} projects.", status.size()),
+ null );
+ }
+ return Status.OK_STATUS;
+ }
+
+ private static boolean contains(final String[] array, final String s) {
+ for (int i= 0; i < array.length; i++) {
+ if (array[i] == s) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+}
diff --git a/autonature/org.eclipse.statet.eutils.autonature/src/org/eclipse/statet/internal/eutils/autonature/UIUtils.java b/autonature/org.eclipse.statet.eutils.autonature/src/org/eclipse/statet/internal/eutils/autonature/UIUtils.java
new file mode 100644
index 0000000..99a2d2b
--- /dev/null
+++ b/autonature/org.eclipse.statet.eutils.autonature/src/org/eclipse/statet/internal/eutils/autonature/UIUtils.java
@@ -0,0 +1,117 @@
+/*=============================================================================#
+ # Copyright (c) 2016, 2017 Stephan Wahlbrink and others.
+ #
+ # This program and the accompanying materials are made available under the
+ # terms of the Eclipse Public License 2.0 which is available at
+ # https://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0
+ # which is available at https://www.apache.org/licenses/LICENSE-2.0.
+ #
+ # SPDX-License-Identifier: EPL-2.0 OR Apache-2.0
+ #
+ # Contributors:
+ # Stephan Wahlbrink <sw@wahlbrink.eu> - initial API and implementation
+ #=============================================================================*/
+
+package org.eclipse.statet.internal.eutils.autonature;
+
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.List;
+
+import com.ibm.icu.text.Collator;
+
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.viewers.ArrayContentProvider;
+import org.eclipse.jface.viewers.CellLabelProvider;
+import org.eclipse.jface.viewers.ColumnWeightData;
+import org.eclipse.jface.viewers.TableViewerColumn;
+import org.eclipse.jface.viewers.ViewerCell;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Composite;
+
+import org.eclipse.statet.ecommons.ui.viewers.ViewerUtils.CheckboxTableComposite;
+
+public class UIUtils {
+
+
+ private static class AutoConfigComparator implements Comparator<AutoConfig> {
+
+ private final Collator collator= Collator.getInstance();
+
+ @Override
+ public int compare(final AutoConfig o1, final AutoConfig o2) {
+ return this.collator.compare(o1.getLabel(), o2.getLabel());
+ }
+
+ }
+
+ private static class TaskComparator implements Comparator<Task> {
+
+ private final Collator collator= Collator.getInstance();
+
+ @Override
+ public int compare(final Task o1, final Task o2) {
+ return this.collator.compare(o1.getLabel(), o2.getLabel());
+ }
+
+ }
+
+
+ public static void sortConfigs(final List<AutoConfig> configs) {
+ Collections.sort(configs, new AutoConfigComparator());
+ }
+
+ public static void sortTasks(final List<Task> configs) {
+ Collections.sort(configs, new TaskComparator());
+ }
+
+ public static CheckboxTableComposite createContentTypeTable(final Composite parent, final int hSpan) {
+ final CheckboxTableComposite tableComposite= new CheckboxTableComposite(parent,
+ SWT.CHECK | SWT.BORDER | SWT.FULL_SELECTION );
+
+ final GridData gd= new GridData(SWT.FILL, SWT.FILL, true, true, hSpan, 1);
+ Dialog.applyDialogFont(tableComposite);
+ gd.heightHint= tableComposite.table.getHeaderHeight() + tableComposite.table.getItemHeight() * 10;
+ tableComposite.setLayoutData(gd);
+
+ tableComposite.viewer.setContentProvider(new ArrayContentProvider());
+
+ tableComposite.viewer.getTable().setHeaderVisible(true);
+ { final TableViewerColumn column= tableComposite.addColumn("Content Type",
+ SWT.LEFT, new ColumnWeightData(5, true) );
+ column.setLabelProvider(new CellLabelProvider() {
+ @Override
+ public void update(final ViewerCell cell) {
+ final AutoConfig config= (AutoConfig) cell.getElement();
+ cell.setText(config.getLabel());
+ }
+ });
+ }
+ { final TableViewerColumn column= tableComposite.addColumn("Project Configuration",
+ SWT.LEFT, new ColumnWeightData(5, true) );
+ column.setLabelProvider(new CellLabelProvider() {
+ @Override
+ public void update(final ViewerCell cell) {
+ final AutoConfig config= (AutoConfig) cell.getElement();
+ final List<Task> tasks= config.getTasks();
+ if (tasks.size() == 1) {
+ cell.setText(tasks.get(0).getLabel());
+ }
+ else {
+ final StringBuilder sb= new StringBuilder();
+ sb.append(tasks.get(0).getLabel());
+ for (int i= 1; i < tasks.size(); i++) {
+ sb.append(" + ");
+ sb.append(tasks.get(i).getLabel());
+ }
+ cell.setText(sb.toString());
+ }
+ }
+ });
+ }
+
+ return tableComposite;
+ }
+
+}
diff --git a/autonature/org.eclipse.statet.eutils.autonature/src/org/eclipse/statet/internal/eutils/autonature/nostart/AutoNatureStartup.java b/autonature/org.eclipse.statet.eutils.autonature/src/org/eclipse/statet/internal/eutils/autonature/nostart/AutoNatureStartup.java
new file mode 100644
index 0000000..b763406
--- /dev/null
+++ b/autonature/org.eclipse.statet.eutils.autonature/src/org/eclipse/statet/internal/eutils/autonature/nostart/AutoNatureStartup.java
@@ -0,0 +1,39 @@
+/*=============================================================================#
+ # Copyright (c) 2014, 2017 Stephan Wahlbrink and others.
+ #
+ # This program and the accompanying materials are made available under the
+ # terms of the Eclipse Public License 2.0 which is available at
+ # https://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0
+ # which is available at https://www.apache.org/licenses/LICENSE-2.0.
+ #
+ # SPDX-License-Identifier: EPL-2.0 OR Apache-2.0
+ #
+ # Contributors:
+ # Stephan Wahlbrink <sw@wahlbrink.eu> - initial API and implementation
+ #=============================================================================*/
+
+package org.eclipse.statet.internal.eutils.autonature.nostart;
+
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.preferences.IPreferencesService;
+import org.eclipse.ui.IStartup;
+
+import org.eclipse.statet.internal.eutils.autonature.Activator;
+
+
+public class AutoNatureStartup implements IStartup {
+
+
+ public AutoNatureStartup() {
+ }
+
+
+ @Override
+ public void earlyStartup() {
+ final IPreferencesService preferences= Platform.getPreferencesService();
+ if (preferences.getBoolean(Activator.BUNDLE_ID, Activator.ENABLED_PREF_KEY, true, null)) {
+ Activator.getInstance().runStartup();
+ }
+ }
+
+}
diff --git a/autonature/org.eclipse.statet.eutils.autonature/src/org/eclipse/statet/internal/eutils/autonature/wizards/ConfigureProjectHandler.java b/autonature/org.eclipse.statet.eutils.autonature/src/org/eclipse/statet/internal/eutils/autonature/wizards/ConfigureProjectHandler.java
new file mode 100644
index 0000000..5621f04
--- /dev/null
+++ b/autonature/org.eclipse.statet.eutils.autonature/src/org/eclipse/statet/internal/eutils/autonature/wizards/ConfigureProjectHandler.java
@@ -0,0 +1,69 @@
+/*=============================================================================#
+ # Copyright (c) 2016, 2017 Stephan Wahlbrink and others.
+ #
+ # This program and the accompanying materials are made available under the
+ # terms of the Eclipse Public License 2.0 which is available at
+ # https://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0
+ # which is available at https://www.apache.org/licenses/LICENSE-2.0.
+ #
+ # SPDX-License-Identifier: EPL-2.0 OR Apache-2.0
+ #
+ # Contributors:
+ # Stephan Wahlbrink <sw@wahlbrink.eu> - initial API and implementation
+ #=============================================================================*/
+
+package org.eclipse.statet.internal.eutils.autonature.wizards;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.wizard.WizardDialog;
+import org.eclipse.ui.IWorkbenchPart;
+
+import org.eclipse.statet.ecommons.ui.util.UIAccess;
+import org.eclipse.statet.ecommons.ui.workbench.WorkbenchUIUtils;
+
+
+public class ConfigureProjectHandler extends AbstractHandler {
+
+
+ public ConfigureProjectHandler() {
+ }
+
+
+ private IProject getProject(final Object element) {
+ if (element instanceof IProject) {
+ return (IProject) element;
+ }
+ if (element instanceof IAdaptable) {
+ return ((IAdaptable) element).getAdapter(IProject.class);
+ }
+ return null;
+ }
+
+ @Override
+ public Object execute(final ExecutionEvent event) throws ExecutionException {
+ final ISelection selection= WorkbenchUIUtils.getCurrentSelection(event.getApplicationContext());
+ if (selection instanceof IStructuredSelection) {
+ final IStructuredSelection structuredSelection= (IStructuredSelection) selection;
+ if (structuredSelection.size() == 1) {
+ final IProject project= getProject(structuredSelection.getFirstElement());
+ if (project != null) {
+ final IWorkbenchPart activePart= WorkbenchUIUtils.getActivePart(event.getApplicationContext());
+
+ final ConfigureProjectWizard wizard= new ConfigureProjectWizard(project);
+ final WizardDialog dialog= new WizardDialog(
+ (activePart != null) ? activePart.getSite().getShell() : UIAccess.getActiveWorkbenchShell(true),
+ wizard );
+ dialog.open();
+ }
+ }
+ }
+ return null;
+ }
+
+}
diff --git a/autonature/org.eclipse.statet.eutils.autonature/src/org/eclipse/statet/internal/eutils/autonature/wizards/ConfigureProjectWizard.java b/autonature/org.eclipse.statet.eutils.autonature/src/org/eclipse/statet/internal/eutils/autonature/wizards/ConfigureProjectWizard.java
new file mode 100644
index 0000000..7b86fe2
--- /dev/null
+++ b/autonature/org.eclipse.statet.eutils.autonature/src/org/eclipse/statet/internal/eutils/autonature/wizards/ConfigureProjectWizard.java
@@ -0,0 +1,215 @@
+/*=============================================================================#
+ # Copyright (c) 2016, 2017 Stephan Wahlbrink and others.
+ #
+ # This program and the accompanying materials are made available under the
+ # terms of the Eclipse Public License 2.0 which is available at
+ # https://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0
+ # which is available at https://www.apache.org/licenses/LICENSE-2.0.
+ #
+ # SPDX-License-Identifier: EPL-2.0 OR Apache-2.0
+ #
+ # Contributors:
+ # Stephan Wahlbrink <sw@wahlbrink.eu> - initial API and implementation
+ #=============================================================================*/
+
+package org.eclipse.statet.internal.eutils.autonature.wizards;
+
+import java.lang.reflect.InvocationTargetException;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.OperationCanceledException;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.SubMonitor;
+import org.eclipse.core.runtime.jobs.IJobManager;
+import org.eclipse.core.runtime.jobs.ISchedulingRule;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.eclipse.jface.wizard.Wizard;
+import org.eclipse.ui.statushandlers.StatusManager;
+
+import org.eclipse.statet.ecommons.ui.dialogs.DialogUtils;
+import org.eclipse.statet.internal.eutils.autonature.Activator;
+import org.eclipse.statet.internal.eutils.autonature.AutoConfig;
+import org.eclipse.statet.internal.eutils.autonature.ConfigManager;
+import org.eclipse.statet.internal.eutils.autonature.ContentFinder;
+import org.eclipse.statet.internal.eutils.autonature.Task;
+import org.eclipse.statet.internal.eutils.autonature.TaskProcessor;
+
+
+public class ConfigureProjectWizard extends Wizard {
+
+
+ private final IProject project;
+
+ private final ConfigManager configManager;
+
+ private ConfigureProjectWizardPage configPage;
+
+ private List<Task> allTasks;
+
+
+ public ConfigureProjectWizard(final IProject project) {
+ this.project= project;
+ this.configManager= Activator.getInstance().getConfigManager();
+
+ setDialogSettings(DialogUtils.getDialogSettings(Activator.getInstance(), "ConfigureProjectWizard")); //$NON-NLS-1$
+ setWindowTitle("Detect and Add Project Natures");
+ setNeedsProgressMonitor(true);
+ }
+
+
+ @Override
+ public void addPages() {
+ this.configPage= new ConfigureProjectWizardPage(this.project);
+ addPage(this.configPage);
+ }
+
+
+ void runInit() {
+ if (this.allTasks != null) {
+ return;
+ }
+ try {
+ final List<Task> allTasks= new ArrayList<>();
+ final List<Task> notConfigTasks= new ArrayList<>();
+ final List<Task> alreadyConfigTasks= new ArrayList<>();
+ final List<Task> selectedTasks= new ArrayList<>();
+
+ getContainer().run(true, true, new IRunnableWithProgress() {
+ @Override
+ public void run(final IProgressMonitor monitor) throws InvocationTargetException {
+ final SubMonitor m= SubMonitor.convert(monitor, 3 + 2);
+
+ try {
+ if (monitor.isCanceled()) {
+ throw new OperationCanceledException();
+ }
+
+ final ContentFinder contentFinder= new ContentFinder(
+ ConfigureProjectWizard.this.project, null,
+ ConfigureProjectWizard.this.configManager, ConfigManager.MANUAL_MODE,
+ m.newChild(3) );
+ ConfigureProjectWizard.this.project.accept(contentFinder);
+
+ if (monitor.isCanceled()) {
+ throw new OperationCanceledException();
+ }
+
+ final List<AutoConfig> recommendConfigs= contentFinder.getConfigs();
+ final List<AutoConfig> otherConfigs= new ArrayList<>();
+ for (final AutoConfig config : ConfigureProjectWizard.this.configManager.getConfigs(ConfigManager.MANUAL_MODE)) {
+ if (!recommendConfigs.contains(config)) {
+ otherConfigs.add(config);
+ }
+ }
+
+ TaskProcessor.aggregateTasks(ConfigureProjectWizard.this.project,
+ recommendConfigs, Task.CONTENT_MATCH,
+ selectedTasks, alreadyConfigTasks, notConfigTasks,
+ m.newChild(1) );
+
+ allTasks.addAll(selectedTasks);
+ TaskProcessor.aggregateTasks(ConfigureProjectWizard.this.project,
+ otherConfigs, 0,
+ allTasks, alreadyConfigTasks, notConfigTasks,
+ m.newChild(1) );
+ allTasks.addAll(alreadyConfigTasks);
+ notConfigTasks.addAll(alreadyConfigTasks);
+ }
+ catch (final CoreException e) {
+ if (e.getStatus().getSeverity() == IStatus.CANCEL) {
+ throw new InvocationTargetException(new OperationCanceledException());
+ }
+ throw new InvocationTargetException(e);
+ }
+ }
+ });
+
+ this.allTasks= allTasks;
+
+ this.configPage.setInput(allTasks, alreadyConfigTasks, selectedTasks);
+ }
+ catch (final InterruptedException e) {
+ return;
+ }
+ catch (final InvocationTargetException e) {
+ final Throwable cause= e.getCause();
+ if (cause instanceof InterruptedException) {
+ return;
+ }
+
+ StatusManager.getManager().handle(new Status(IStatus.ERROR, Activator.BUNDLE_ID, 0,
+ "An error occurred when detecting the project configuration proposal.", e ),
+ StatusManager.SHOW | StatusManager.LOG );
+ return;
+ }
+ }
+
+ void reset() {
+ this.allTasks= null;
+ this.configPage.resetInput();
+
+ runInit();
+ }
+
+
+ @Override
+ public boolean canFinish() {
+ return (this.configPage != null && this.configPage.isPageComplete());
+ }
+
+ @Override
+ public boolean performFinish() {
+ final Collection<Task> configTasks= this.configPage.getConfigTasks();
+ try {
+ getContainer().run(true, true, new IRunnableWithProgress() {
+ @Override
+ public void run(final IProgressMonitor monitor) throws InvocationTargetException {
+ final SubMonitor m= SubMonitor.convert(monitor, "Configure projects...", 1);
+
+ final IJobManager jobManager= Job.getJobManager();
+ final ISchedulingRule rule= ConfigureProjectWizard.this.project.getWorkspace().getRoot();
+ try {
+ jobManager.beginRule(rule, m);
+
+ final IStatus projectStatus= TaskProcessor.process(ConfigureProjectWizard.this.project, configTasks,
+ m.newChild(1) );
+ if (!projectStatus.isOK()) {
+ throw new InvocationTargetException(new CoreException(projectStatus));
+ }
+ }
+ catch (final OperationCanceledException e) {
+ throw new InvocationTargetException(e);
+ }
+ finally {
+ jobManager.endRule(rule);
+ }
+ }
+ });
+ }
+ catch (final InterruptedException e) {
+ reset();
+ return false;
+ }
+ catch (final InvocationTargetException e) {
+ final Throwable cause= e.getCause();
+ if (cause instanceof InterruptedException || cause instanceof OperationCanceledException) {
+ reset();
+ return false;
+ }
+
+ StatusManager.getManager().handle(new Status(IStatus.ERROR, Activator.BUNDLE_ID, 0,
+ "The project configuration failed for 1 project.", cause ),
+ StatusManager.SHOW | StatusManager.LOG );
+ return false;
+ }
+ return true;
+ }
+
+}
diff --git a/autonature/org.eclipse.statet.eutils.autonature/src/org/eclipse/statet/internal/eutils/autonature/wizards/ConfigureProjectWizardPage.java b/autonature/org.eclipse.statet.eutils.autonature/src/org/eclipse/statet/internal/eutils/autonature/wizards/ConfigureProjectWizardPage.java
new file mode 100644
index 0000000..b606981
--- /dev/null
+++ b/autonature/org.eclipse.statet.eutils.autonature/src/org/eclipse/statet/internal/eutils/autonature/wizards/ConfigureProjectWizardPage.java
@@ -0,0 +1,198 @@
+/*=============================================================================#
+ # Copyright (c) 2016, 2017 Stephan Wahlbrink and others.
+ #
+ # This program and the accompanying materials are made available under the
+ # terms of the Eclipse Public License 2.0 which is available at
+ # https://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0
+ # which is available at https://www.apache.org/licenses/LICENSE-2.0.
+ #
+ # SPDX-License-Identifier: EPL-2.0 OR Apache-2.0
+ #
+ # Contributors:
+ # Stephan Wahlbrink <sw@wahlbrink.eu> - initial API and implementation
+ #=============================================================================*/
+
+package org.eclipse.statet.internal.eutils.autonature.wizards;
+
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.List;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.viewers.ArrayContentProvider;
+import org.eclipse.jface.viewers.CellLabelProvider;
+import org.eclipse.jface.viewers.CheckStateChangedEvent;
+import org.eclipse.jface.viewers.ColumnPixelData;
+import org.eclipse.jface.viewers.ColumnWeightData;
+import org.eclipse.jface.viewers.ICheckStateListener;
+import org.eclipse.jface.viewers.TableViewerColumn;
+import org.eclipse.jface.viewers.ViewerCell;
+import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+
+import org.eclipse.statet.ecommons.ui.util.LayoutUtil;
+import org.eclipse.statet.ecommons.ui.viewers.ViewerUtils;
+import org.eclipse.statet.ecommons.ui.viewers.ViewerUtils.CheckboxColumnControl;
+import org.eclipse.statet.ecommons.ui.viewers.ViewerUtils.TableComposite;
+import org.eclipse.statet.internal.eutils.autonature.Task;
+
+
+public class ConfigureProjectWizardPage extends WizardPage implements ICheckStateListener {
+
+
+ private final IProject project;
+
+ private TableComposite configTable;
+ private CheckboxColumnControl<Task> configTableEnabledColumn;
+
+ private Button deselectButton;
+
+ private final Collection<Task> editableTasks= new HashSet<>();
+
+ private final HashSet<Task> alreadyConfigTasks= new HashSet<>();
+ private final HashSet<Task> toConfigTasks= new HashSet<>();
+
+
+ public ConfigureProjectWizardPage(final IProject project) {
+ super("AutoConfigureProject");
+
+ this.project= project;
+
+ setTitle(NLS.bind("Configure project ''{0}''", project.getName()));
+ setDescription("Select the project configurations to apply.");
+ }
+
+
+ @Override
+ public void createControl(final Composite parent) {
+ initializeDialogUnits(parent);
+
+ final Composite composite = new Composite(parent, SWT.NONE);
+ composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+ composite.setLayout(LayoutUtil.createContentGrid(2));
+
+ { final TableComposite tableComposite= new TableComposite(composite,
+ SWT.BORDER | SWT.FULL_SELECTION | SWT.V_SCROLL );
+ this.configTable= tableComposite;
+
+ final GridData gd= new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1);
+ Dialog.applyDialogFont(tableComposite);
+ gd.heightHint= tableComposite.table.getItemHeight() * 10;
+ tableComposite.setLayoutData(gd);
+
+ tableComposite.viewer.setContentProvider(new ArrayContentProvider());
+
+ { final TableViewerColumn column= new TableViewerColumn(tableComposite.viewer,
+ SWT.CENTER );
+ this.configTableEnabledColumn= new ViewerUtils.CheckboxColumnControl<Task>(
+ tableComposite.viewer, this.toConfigTasks, this.editableTasks ) {
+ @Override
+ public boolean getChecked(final Object element) {
+ return (ConfigureProjectWizardPage.this.alreadyConfigTasks.contains(element)
+ || super.getChecked(element) );
+ }
+ };
+ column.setLabelProvider(this.configTableEnabledColumn);
+ this.configTableEnabledColumn.configureAsMainColumn();
+ tableComposite.layout.setColumnData(column.getColumn(), new ColumnPixelData(
+ this.configTableEnabledColumn.hintColumnWidth(), false, true ));
+ this.configTableEnabledColumn.addCheckStateListener(this);
+ }
+ { final TableViewerColumn column= tableComposite.addColumn("Project Configuration",
+ SWT.LEFT, new ColumnWeightData(5, true) );
+ column.setLabelProvider(new CellLabelProvider() {
+ @Override
+ public void update(final ViewerCell cell) {
+ final Task task= (Task) cell.getElement();
+ cell.setText(task.getLabel());
+ }
+ });
+ }
+ }
+ { final Button button= new Button(composite, SWT.PUSH);
+ button.setText("&Deselect All");
+
+ final GridData gd= new GridData(SWT.FILL, SWT.TOP, false, false);
+ gd.widthHint= LayoutUtil.hintWidth(button);
+ button.setLayoutData(gd);
+
+ button.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(final SelectionEvent e) {
+ ConfigureProjectWizardPage.this.toConfigTasks.clear();
+ ConfigureProjectWizardPage.this.configTable.viewer.update(ConfigureProjectWizardPage.this.editableTasks.toArray(), null);
+ updateState();
+ }
+ });
+ this.deselectButton= button;
+ }
+
+ setControl(composite);
+
+ resetInput();
+ }
+
+ @Override
+ public void setVisible(final boolean visible) {
+ super.setVisible(visible);
+
+ this.configTable.getDisplay().asyncExec(new Runnable() {
+ @Override
+ public void run() {
+ ((ConfigureProjectWizard) getWizard()).runInit();
+ }
+ });
+ }
+
+ public void resetInput() {
+ this.configTable.table.setEnabled(false);
+ this.configTable.viewer.setInput(Collections.EMPTY_LIST);
+ this.deselectButton.setEnabled(false);
+
+ this.editableTasks.clear();
+ this.toConfigTasks.clear();
+ updateState();
+ }
+
+ public void setInput(final List<Task> allTasks, final List<Task> alreadyConfigTasks,
+ final List<Task> recommendTasks) {
+ for (final Task task : allTasks) {
+ if (!alreadyConfigTasks.contains(task)) {
+ this.editableTasks.add(task);
+ }
+ }
+ this.alreadyConfigTasks.addAll(alreadyConfigTasks);
+ this.toConfigTasks.addAll(recommendTasks);
+ this.configTable.viewer.setInput(allTasks);
+ this.configTable.table.setEnabled(true);
+ updateState();
+ }
+
+ @Override
+ public void checkStateChanged(final CheckStateChangedEvent event) {
+ updateState();
+ }
+
+ private void updateState() {
+ this.deselectButton.setEnabled(!this.toConfigTasks.isEmpty());
+ getContainer().updateButtons();
+ }
+
+ @Override
+ public boolean isPageComplete() {
+ return (!this.toConfigTasks.isEmpty());
+ }
+
+ public Collection<Task> getConfigTasks() {
+ return this.toConfigTasks;
+ }
+
+}
diff --git a/autorun/_build/org.eclipse.statet.eutils.autorun-feature/.project b/autorun/_build/org.eclipse.statet.eutils.autorun-feature/.project
new file mode 100644
index 0000000..82280a5
--- /dev/null
+++ b/autorun/_build/org.eclipse.statet.eutils.autorun-feature/.project
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.statet.eutils.autorun-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>
diff --git a/autorun/_build/org.eclipse.statet.eutils.autorun-feature/build.properties b/autorun/_build/org.eclipse.statet.eutils.autorun-feature/build.properties
new file mode 100644
index 0000000..4fc35c8
--- /dev/null
+++ b/autorun/_build/org.eclipse.statet.eutils.autorun-feature/build.properties
@@ -0,0 +1,2 @@
+bin.includes= feature.xml,\
+ feature.properties
diff --git a/autorun/_build/org.eclipse.statet.eutils.autorun-feature/feature.properties b/autorun/_build/org.eclipse.statet.eutils.autorun-feature/feature.properties
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/autorun/_build/org.eclipse.statet.eutils.autorun-feature/feature.properties
diff --git a/autorun/_build/org.eclipse.statet.eutils.autorun-feature/feature.xml b/autorun/_build/org.eclipse.statet.eutils.autorun-feature/feature.xml
new file mode 100644
index 0000000..43f19e9
--- /dev/null
+++ b/autorun/_build/org.eclipse.statet.eutils.autorun-feature/feature.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<feature
+ id="org.eclipse.statet.eutils.autorun"
+ version="1.0.1.qualifier"
+ label="Auto Run"
+ provider-name="Eclipse.org"
+ license-feature="org.eclipse.license"
+ license-feature-version="1.0.1">
+
+ <description url="https://www.eclipse.org/statet">
+ Utility to run a launch configuration at startup of Eclipse automatically.
+ </description>
+
+ <copyright>
+ Copyright (c) 2003, 2017 Stephan Wahlbrink and others. All rights reserved.
+ </copyright>
+
+ <license url="%license_url">
+ %license_text
+ </license>
+
+ <plugin
+ id="org.eclipse.statet.eutils.autorun"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"
+ unpack="false"/>
+
+</feature>
diff --git a/autorun/_build/repo/category.xml b/autorun/_build/repo/category.xml
new file mode 100644
index 0000000..159caa5
--- /dev/null
+++ b/autorun/_build/repo/category.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<site>
+ <category-def name="org.eclipse.statet.utils" label="StatET - Utilities"/>
+
+ <feature id="org.eclipse.statet.eutils.autorun" version="0.0.0">
+ <category name="org.eclipse.statet.utils"/>
+ </feature>
+
+</site>
diff --git a/autorun/org.eclipse.statet.eutils.autorun/.classpath b/autorun/org.eclipse.statet.eutils.autorun/.classpath
new file mode 100644
index 0000000..22f3064
--- /dev/null
+++ b/autorun/org.eclipse.statet.eutils.autorun/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/autorun/org.eclipse.statet.eutils.autorun/.gitignore b/autorun/org.eclipse.statet.eutils.autorun/.gitignore
new file mode 100644
index 0000000..7447f89
--- /dev/null
+++ b/autorun/org.eclipse.statet.eutils.autorun/.gitignore
@@ -0,0 +1 @@
+/bin
\ No newline at end of file
diff --git a/autorun/org.eclipse.statet.eutils.autorun/.project b/autorun/org.eclipse.statet.eutils.autorun/.project
new file mode 100644
index 0000000..2ed33ea
--- /dev/null
+++ b/autorun/org.eclipse.statet.eutils.autorun/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.statet.eutils.autorun</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>
diff --git a/autorun/org.eclipse.statet.eutils.autorun/.settings/org.eclipse.core.resources.prefs b/autorun/org.eclipse.statet.eutils.autorun/.settings/org.eclipse.core.resources.prefs
new file mode 100644
index 0000000..99f26c0
--- /dev/null
+++ b/autorun/org.eclipse.statet.eutils.autorun/.settings/org.eclipse.core.resources.prefs
@@ -0,0 +1,2 @@
+eclipse.preferences.version=1
+encoding/<project>=UTF-8
diff --git a/autorun/org.eclipse.statet.eutils.autorun/.settings/org.eclipse.core.runtime.prefs b/autorun/org.eclipse.statet.eutils.autorun/.settings/org.eclipse.core.runtime.prefs
new file mode 100644
index 0000000..5a0ad22
--- /dev/null
+++ b/autorun/org.eclipse.statet.eutils.autorun/.settings/org.eclipse.core.runtime.prefs
@@ -0,0 +1,2 @@
+eclipse.preferences.version=1
+line.separator=\n
diff --git a/autorun/org.eclipse.statet.eutils.autorun/.settings/org.eclipse.jdt.core.prefs b/autorun/org.eclipse.statet.eutils.autorun/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000..ccb1eaa
--- /dev/null
+++ b/autorun/org.eclipse.statet.eutils.autorun/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,325 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.codeComplete.argumentPrefixes=
+org.eclipse.jdt.core.codeComplete.argumentSuffixes=
+org.eclipse.jdt.core.codeComplete.fieldPrefixes=
+org.eclipse.jdt.core.codeComplete.fieldSuffixes=
+org.eclipse.jdt.core.codeComplete.localPrefixes=
+org.eclipse.jdt.core.codeComplete.localSuffixes=
+org.eclipse.jdt.core.codeComplete.staticFieldPrefixes=
+org.eclipse.jdt.core.codeComplete.staticFieldSuffixes=
+org.eclipse.jdt.core.codeComplete.staticFinalFieldPrefixes=
+org.eclipse.jdt.core.codeComplete.staticFinalFieldSuffixes=
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.8
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.8
+org.eclipse.jdt.core.formatter.align_fields_grouping_blank_lines=2147483647
+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_expressions_in_for_loop_header=0
+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_parameterized_type_references=0
+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=85
+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_type_arguments=0
+org.eclipse.jdt.core.formatter.alignment_for_type_parameters=0
+org.eclipse.jdt.core.formatter.alignment_for_union_type_in_multicatch=16
+org.eclipse.jdt.core.formatter.blank_lines_after_imports=2
+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=1
+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=2
+org.eclipse.jdt.core.formatter.blank_lines_before_package=1
+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=false
+org.eclipse.jdt.core.formatter.comment.indent_root_tags=true
+org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert
+org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=do not insert
+org.eclipse.jdt.core.formatter.comment.line_length=100
+org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=false
+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=true
+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_enum_constant=insert
+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=insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=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=do not 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=100
+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.parentheses_positions_in_annotation=common_lines
+org.eclipse.jdt.core.formatter.parentheses_positions_in_catch_clause=common_lines
+org.eclipse.jdt.core.formatter.parentheses_positions_in_enum_constant_declaration=common_lines
+org.eclipse.jdt.core.formatter.parentheses_positions_in_for_statment=common_lines
+org.eclipse.jdt.core.formatter.parentheses_positions_in_if_while_statement=common_lines
+org.eclipse.jdt.core.formatter.parentheses_positions_in_lambda_declaration=common_lines
+org.eclipse.jdt.core.formatter.parentheses_positions_in_method_delcaration=common_lines
+org.eclipse.jdt.core.formatter.parentheses_positions_in_method_invocation=common_lines
+org.eclipse.jdt.core.formatter.parentheses_positions_in_switch_statement=common_lines
+org.eclipse.jdt.core.formatter.parentheses_positions_in_try_clause=common_lines
+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_assignment_operator=false
+org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true
+org.eclipse.jdt.core.formatter.wrap_before_conditional_operator=false
+org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch=true
+org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true
+org.eclipse.jdt.core.javaFormatter=org.eclipse.jdt.core.defaultJavaFormatter
diff --git a/autorun/org.eclipse.statet.eutils.autorun/.settings/org.eclipse.jdt.ui.prefs b/autorun/org.eclipse.statet.eutils.autorun/.settings/org.eclipse.jdt.ui.prefs
new file mode 100644
index 0000000..abdf3e0
--- /dev/null
+++ b/autorun/org.eclipse.statet.eutils.autorun/.settings/org.eclipse.jdt.ui.prefs
@@ -0,0 +1,131 @@
+cleanup.add_default_serial_version_id=true
+cleanup.add_generated_serial_version_id=false
+cleanup.add_missing_annotations=true
+cleanup.add_missing_deprecated_annotations=true
+cleanup.add_missing_methods=false
+cleanup.add_missing_nls_tags=false
+cleanup.add_missing_override_annotations=true
+cleanup.add_missing_override_annotations_interface_methods=true
+cleanup.add_serial_version_id=false
+cleanup.always_use_blocks=true
+cleanup.always_use_parentheses_in_expressions=true
+cleanup.always_use_this_for_non_static_field_access=true
+cleanup.always_use_this_for_non_static_method_access=false
+cleanup.convert_functional_interfaces=false
+cleanup.convert_to_enhanced_for_loop=false
+cleanup.correct_indentation=false
+cleanup.format_source_code=false
+cleanup.format_source_code_changes_only=false
+cleanup.insert_inferred_type_arguments=false
+cleanup.make_local_variable_final=true
+cleanup.make_parameters_final=true
+cleanup.make_private_fields_final=true
+cleanup.make_type_abstract_if_missing_method=false
+cleanup.make_variable_declarations_final=true
+cleanup.never_use_blocks=false
+cleanup.never_use_parentheses_in_expressions=false
+cleanup.organize_imports=true
+cleanup.qualify_static_field_accesses_with_declaring_class=false
+cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
+cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=false
+cleanup.qualify_static_member_accesses_with_declaring_class=true
+cleanup.qualify_static_method_accesses_with_declaring_class=false
+cleanup.remove_private_constructors=true
+cleanup.remove_redundant_type_arguments=true
+cleanup.remove_trailing_whitespaces=false
+cleanup.remove_trailing_whitespaces_all=true
+cleanup.remove_trailing_whitespaces_ignore_empty=false
+cleanup.remove_unnecessary_casts=true
+cleanup.remove_unnecessary_nls_tags=true
+cleanup.remove_unused_imports=true
+cleanup.remove_unused_local_variables=false
+cleanup.remove_unused_private_fields=true
+cleanup.remove_unused_private_members=false
+cleanup.remove_unused_private_methods=true
+cleanup.remove_unused_private_types=true
+cleanup.sort_members=false
+cleanup.sort_members_all=false
+cleanup.use_anonymous_class_creation=false
+cleanup.use_blocks=true
+cleanup.use_blocks_only_for_return_and_throw=false
+cleanup.use_lambda=true
+cleanup.use_parentheses_in_expressions=false
+cleanup.use_this_for_non_static_field_access=true
+cleanup.use_this_for_non_static_field_access_only_if_necessary=false
+cleanup.use_this_for_non_static_method_access=true
+cleanup.use_this_for_non_static_method_access_only_if_necessary=true
+cleanup.use_type_arguments=false
+cleanup_profile=_StatET
+cleanup_settings_version=2
+eclipse.preferences.version=1
+editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
+formatter_profile=_StatET
+formatter_settings_version=12
+org.eclipse.jdt.ui.exception.name=e
+org.eclipse.jdt.ui.gettersetter.use.is=true
+org.eclipse.jdt.ui.ignorelowercasenames=true
+org.eclipse.jdt.ui.importorder=\#;java;javax;com.ibm.icu;org.osgi;org.eclipse;;org.eclipse.statet;
+org.eclipse.jdt.ui.javadoc=true
+org.eclipse.jdt.ui.keywordthis=true
+org.eclipse.jdt.ui.ondemandthreshold=99
+org.eclipse.jdt.ui.overrideannotation=true
+org.eclipse.jdt.ui.staticondemandthreshold=99
+org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8" standalone\="no"?><templates><template autoinsert\="true" context\="gettercomment_context" deleted\="false" description\="Comment for getter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.gettercomment" name\="gettercomment">/**\n * @return the ${bare_field_name}\n */</template><template autoinsert\="true" context\="settercomment_context" deleted\="false" description\="Comment for setter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.settercomment" name\="settercomment">/**\n * @param ${param} the ${bare_field_name} to set\n */</template><template autoinsert\="true" context\="constructorcomment_context" deleted\="false" description\="Comment for created constructors" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorcomment" name\="constructorcomment">/**\n * ${tags}\n */</template><template autoinsert\="false" context\="filecomment_context" deleted\="false" description\="Comment for created Java files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.filecomment" name\="filecomment">/*\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\#\n \# Copyright (c) ${year} ${user} and others.\n # \n # This program and the accompanying materials are made available under the\n # terms of the Eclipse Public License 2.0 which is available at\n # https://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0\n # which is available at https://www.apache.org/licenses/LICENSE-2.0.\n # \n # SPDX-License-Identifier: EPL-2.0 OR Apache-2.0\n # \n \# Contributors\:\n \# ${user} - initial API and implementation\n \#\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=\=*/</template><template autoinsert\="false" context\="typecomment_context" deleted\="false" description\="Comment for created types" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.typecomment" name\="typecomment">/**\n * \n * ${tags}\n */</template><template autoinsert\="true" context\="fieldcomment_context" deleted\="false" description\="Comment for fields" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.fieldcomment" name\="fieldcomment">/**\n * \n */</template><template autoinsert\="true" context\="methodcomment_context" deleted\="false" description\="Comment for non-overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodcomment" name\="methodcomment">/**\n * ${tags}\n */</template><template autoinsert\="false" context\="overridecomment_context" deleted\="false" description\="Comment for overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.overridecomment" name\="overridecomment"/><template autoinsert\="true" context\="delegatecomment_context" deleted\="false" description\="Comment for delegate methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.delegatecomment" name\="delegatecomment">/**\n * ${tags}\n * ${see_to_target}\n */</template><template autoinsert\="false" context\="newtype_context" deleted\="false" description\="Newly created files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.newtype" name\="newtype">${filecomment}\n\n${package_declaration}\n\n${typecomment}\n${type_declaration}</template><template autoinsert\="true" context\="classbody_context" deleted\="false" description\="Code in new class type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.classbody" name\="classbody">\n</template><template autoinsert\="true" context\="interfacebody_context" deleted\="false" description\="Code in new interface type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.interfacebody" name\="interfacebody">\n</template><template autoinsert\="true" context\="enumbody_context" deleted\="false" description\="Code in new enum type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.enumbody" name\="enumbody">\n</template><template autoinsert\="true" context\="annotationbody_context" deleted\="false" description\="Code in new annotation type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.annotationbody" name\="annotationbody">\n</template><template autoinsert\="true" context\="catchblock_context" deleted\="false" description\="Code in new catch blocks" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.catchblock" name\="catchblock">// ${todo} Auto-generated catch block\n${exception_var}.printStackTrace();</template><template autoinsert\="true" context\="methodbody_context" deleted\="false" description\="Code in created method stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodbody" name\="methodbody">// ${todo} Auto-generated method stub\n${body_statement}</template><template autoinsert\="true" context\="constructorbody_context" deleted\="false" description\="Code in created constructor stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorbody" name\="constructorbody">${body_statement}\n// ${todo} Auto-generated constructor stub</template><template autoinsert\="true" context\="getterbody_context" deleted\="false" description\="Code in created getters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.getterbody" name\="getterbody">return ${field};</template><template autoinsert\="true" context\="setterbody_context" deleted\="false" description\="Code in created setters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.setterbody" name\="setterbody">${field} \= ${param};</template></templates>
+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=true
+sp_cleanup.always_use_this_for_non_static_field_access=true
+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=false
+sp_cleanup.format_source_code_changes_only=false
+sp_cleanup.insert_inferred_type_arguments=false
+sp_cleanup.make_local_variable_final=true
+sp_cleanup.make_parameters_final=true
+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=false
+sp_cleanup.on_save_use_additional_actions=true
+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=false
+sp_cleanup.qualify_static_member_accesses_with_declaring_class=true
+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=false
+sp_cleanup.remove_trailing_whitespaces_ignore_empty=true
+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=false
+sp_cleanup.remove_unused_private_members=false
+sp_cleanup.remove_unused_private_methods=false
+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=true
+sp_cleanup.use_blocks_only_for_return_and_throw=false
+sp_cleanup.use_lambda=false
+sp_cleanup.use_parentheses_in_expressions=false
+sp_cleanup.use_this_for_non_static_field_access=true
+sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=false
+sp_cleanup.use_this_for_non_static_method_access=true
+sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true
+sp_cleanup.use_type_arguments=false
diff --git a/autorun/org.eclipse.statet.eutils.autorun/META-INF/MANIFEST.MF b/autorun/org.eclipse.statet.eutils.autorun/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..43a52e3
--- /dev/null
+++ b/autorun/org.eclipse.statet.eutils.autorun/META-INF/MANIFEST.MF
@@ -0,0 +1,14 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-SymbolicName: org.eclipse.statet.eutils.autorun;singleton:=true
+Bundle-Version: 1.0.0.qualifier
+Bundle-Vendor: Eclipse.org
+Bundle-Name: StatET EUtils - Auto Run
+Bundle-ActivationPolicy: lazy;exclude:="org.eclipse.statet.eutils.autorun.internal.nostart"
+Bundle-Activator: org.eclipse.statet.internal.eutils.autorun.Activator
+Bundle-RequiredExecutionEnvironment: JavaSE-1.8
+Require-Bundle: org.eclipse.core.runtime;bundle-version="3.10.0",
+ org.eclipse.ui,
+ org.eclipse.debug.core,
+ org.eclipse.debug.ui
+Import-Package: com.ibm.icu.text
diff --git a/autorun/org.eclipse.statet.eutils.autorun/about.html b/autorun/org.eclipse.statet.eutils.autorun/about.html
new file mode 100644
index 0000000..7206cec
--- /dev/null
+++ b/autorun/org.eclipse.statet.eutils.autorun/about.html
@@ -0,0 +1,36 @@
+<!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=UTF-8"/>
+<title>About</title>
+</head>
+<body lang="EN-US">
+<h2>About This Content</h2>
+
+<p>December 1, 2017</p>
+<h3>License</h3>
+
+<p>
+ The Eclipse Foundation makes available all content in this plug-in
+ ("Content"). Unless otherwise indicated below, the Content
+ is provided to you under the terms and conditions of the Eclipse
+ Public License Version 2.0 ("EPL"). A copy of the EPL is
+ available at <a href="https://www.eclipse.org/legal/epl-2.0">https://www.eclipse.org/legal/epl-2.0</a>.
+ For purposes of the EPL, "Program" will mean the Content.
+</p>
+
+<p>
+ If you did not receive this Content directly from the Eclipse
+ Foundation, the Content is being redistributed by another party
+ ("Redistributor") and different terms and conditions may
+ apply to your use of any object code in the Content. Check the
+ Redistributor's license that was provided with the Content. If no such
+ license exists, contact the Redistributor. Unless otherwise indicated
+ below, the terms and conditions of the EPL still apply to any source
+ code in the Content and such source code may be obtained at <a
+ href="https://www.eclipse.org/">https://www.eclipse.org</a>.
+</p>
+
+</body>
+</html>
diff --git a/autorun/org.eclipse.statet.eutils.autorun/build.properties b/autorun/org.eclipse.statet.eutils.autorun/build.properties
new file mode 100644
index 0000000..e50f254
--- /dev/null
+++ b/autorun/org.eclipse.statet.eutils.autorun/build.properties
@@ -0,0 +1,9 @@
+source..= src/
+output..= bin/
+javacDefaultEncoding..= UTF-8
+
+bin.includes= META-INF/,\
+ plugin.xml,\
+ .,\
+ about.html
+src.includes= .settings/org.eclipse.core.resources.prefs
diff --git a/autorun/org.eclipse.statet.eutils.autorun/plugin.xml b/autorun/org.eclipse.statet.eutils.autorun/plugin.xml
new file mode 100644
index 0000000..7c09b20
--- /dev/null
+++ b/autorun/org.eclipse.statet.eutils.autorun/plugin.xml
@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<!--
+ #=============================================================================#
+ # Copyright (c) 2007, 2017 Stephan Wahlbrink and others.
+ #
+ # This program and the accompanying materials are made available under the
+ # terms of the Eclipse Public License 2.0 which is available at
+ # https://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0
+ # which is available at https://www.apache.org/licenses/LICENSE-2.0.
+ #
+ # SPDX-License-Identifier: EPL-2.0 OR Apache-2.0
+ #
+ # Contributors:
+ # Stephan Wahlbrink <sw@wahlbrink.eu> - initial API and implementation
+ #=============================================================================#
+-->
+
+<plugin>
+
+ <extension
+ point="org.eclipse.ui.startup">
+ <startup
+ class="org.eclipse.statet.internal.eutils.autorun.nostart.AutoRunStartup">
+ </startup>
+ </extension>
+
+ <extension
+ point="org.eclipse.ui.keywords">
+ <keyword
+ id="org.eclipse.statet.autorun.keywords.startup"
+ label="startup run autostart launch">
+ </keyword>
+ </extension>
+ <extension
+ point="org.eclipse.ui.preferencePages">
+ <page
+ id="org.eclipse.statet.autorun.preferencePages.Config"
+ category="org.eclipse.debug.ui.DebugPreferencePage"
+ class="org.eclipse.statet.internal.eutils.autorun.AutoRunPreferencePage"
+ name="Auto Run">
+ <keywordReference
+ id="org.eclipse.statet.autorun.keywords.startup">
+ </keywordReference>
+ </page>
+ </extension>
+
+</plugin>
diff --git a/autorun/org.eclipse.statet.eutils.autorun/src/org/eclipse/statet/internal/eutils/autorun/Activator.java b/autorun/org.eclipse.statet.eutils.autorun/src/org/eclipse/statet/internal/eutils/autorun/Activator.java
new file mode 100644
index 0000000..64c7424
--- /dev/null
+++ b/autorun/org.eclipse.statet.eutils.autorun/src/org/eclipse/statet/internal/eutils/autorun/Activator.java
@@ -0,0 +1,63 @@
+/*=============================================================================#
+ # Copyright (c) 2007, 2017 Stephan Wahlbrink and others.
+ #
+ # This program and the accompanying materials are made available under the
+ # terms of the Eclipse Public License 2.0 which is available at
+ # https://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0
+ # which is available at https://www.apache.org/licenses/LICENSE-2.0.
+ #
+ # SPDX-License-Identifier: EPL-2.0 OR Apache-2.0
+ #
+ # Contributors:
+ # Stephan Wahlbrink <sw@wahlbrink.eu> - initial API and implementation
+ #=============================================================================*/
+
+package org.eclipse.statet.internal.eutils.autorun;
+
+import org.osgi.framework.BundleContext;
+
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class Activator extends AbstractUIPlugin {
+
+
+ public static final String BUNDLE_ID= "org.eclipse.statet.eutils.autorun"; //$NON-NLS-1$
+
+ public static final String ENABLED_PREF_KEY= "enabled"; //$NON-NLS-1$
+ public static final String LAUNCH_CONFIG_ID_PREF_KEY= "config.id"; //$NON-NLS-1$
+ public static final String LAUNCH_MODE_ID_PREF_KEY= "mode.id"; //$NON-NLS-1$
+
+
+ private static Activator instance;
+
+ /**
+ * Returns the shared plug-in instance
+ *
+ * @return the shared instance
+ */
+ public static Activator getInstance() {
+ return instance;
+ }
+
+
+ public Activator() {
+ }
+
+
+ @Override
+ public void start(final BundleContext context) throws Exception {
+ super.start(context);
+ instance= this;
+ }
+
+ @Override
+ public void stop(final BundleContext context) throws Exception {
+ instance= null;
+ super.stop(context);
+ }
+
+}
diff --git a/autorun/org.eclipse.statet.eutils.autorun/src/org/eclipse/statet/internal/eutils/autorun/AutoRunPreferencePage.java b/autorun/org.eclipse.statet.eutils.autorun/src/org/eclipse/statet/internal/eutils/autorun/AutoRunPreferencePage.java
new file mode 100644
index 0000000..763c347
--- /dev/null
+++ b/autorun/org.eclipse.statet.eutils.autorun/src/org/eclipse/statet/internal/eutils/autorun/AutoRunPreferencePage.java
@@ -0,0 +1,350 @@
+/*=============================================================================#
+ # Copyright (c) 2007, 2017 Stephan Wahlbrink and others.
+ #
+ # This program and the accompanying materials are made available under the
+ # terms of the Eclipse Public License 2.0 which is available at
+ # https://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0
+ # which is available at https://www.apache.org/licenses/LICENSE-2.0.
+ #
+ # SPDX-License-Identifier: EPL-2.0 OR Apache-2.0
+ #
+ # Contributors:
+ # Stephan Wahlbrink <sw@wahlbrink.eu> - initial API and implementation
+ #=============================================================================*/
+
+package org.eclipse.statet.internal.eutils.autorun;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+
+import org.osgi.service.prefs.BackingStoreException;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.preferences.IEclipsePreferences;
+import org.eclipse.core.runtime.preferences.IPreferencesService;
+import org.eclipse.core.runtime.preferences.InstanceScope;
+import org.eclipse.debug.core.DebugPlugin;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.debug.core.ILaunchManager;
+import org.eclipse.debug.core.ILaunchMode;
+import org.eclipse.debug.internal.ui.launchConfigurations.LaunchConfigurationComparator;
+import org.eclipse.debug.internal.ui.launchConfigurations.LaunchConfigurationTreeContentProvider;
+import org.eclipse.debug.ui.DebugUITools;
+import org.eclipse.debug.ui.IDebugUIConstants;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.preference.PreferencePage;
+import org.eclipse.jface.viewers.ArrayContentProvider;
+import org.eclipse.jface.viewers.ComboViewer;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Tree;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPreferencePage;
+import org.eclipse.ui.statushandlers.StatusManager;
+
+
+public class AutoRunPreferencePage extends PreferencePage implements IWorkbenchPreferencePage {
+
+
+ private ILaunchManager launchManager;
+
+ private Button enableButton;
+
+ private TreeViewer entryViewer;
+ private Button viewButton;
+
+ private Label modeLabel;
+ private ComboViewer modeViewer;
+
+ private Set<String> lastMode;
+
+
+ public AutoRunPreferencePage() {
+ }
+
+
+ @Override
+ public void init(final IWorkbench workbench) {
+ }
+
+ @Override
+ protected Control createContents(final Composite parent) {
+ this.launchManager= DebugPlugin.getDefault().getLaunchManager();
+
+ final Composite composite= new Composite(parent, SWT.NONE);
+ { final GridLayout gd= new GridLayout();
+ gd.marginWidth= 0;
+ gd.marginHeight= 0;
+ gd.numColumns= 3;
+ composite.setLayout(gd);
+ }
+ { this.enableButton= new Button(composite, SWT.CHECK);
+ this.enableButton.setText("Enable &launch at startup of:");
+ this.enableButton.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 3, 1));
+ }
+ { this.entryViewer= new TreeViewer(composite, SWT.BORDER | SWT.FULL_SELECTION);
+ final Tree tree= this.entryViewer.getTree();
+ final GridData gd= new GridData(SWT.FILL, SWT.FILL, true, true, 2, 1);
+ Dialog.applyDialogFont(this.entryViewer.getControl());
+ gd.heightHint= tree.getItemHeight() * 10;
+ this.entryViewer.getControl().setLayoutData(gd);
+
+ this.entryViewer.setLabelProvider(DebugUITools.newDebugModelPresentation());
+ this.entryViewer.setContentProvider(new LaunchConfigurationTreeContentProvider(ILaunchManager.RUN_MODE, getShell()) {
+ @Override
+ public Object[] getElements(final Object parentElement) {
+ final Object[] children= super.getChildren(parentElement);
+ final List<Object> filtered= new ArrayList<>(children.length);
+ for (int i= 0; i < children.length; i++) {
+ if (super.hasChildren(children[i])) {
+ filtered.add(children[i]);
+ }
+ }
+ return filtered.toArray();
+ }
+ });
+ this.entryViewer.setComparator(new LaunchConfigurationComparator());
+ }
+ { this.viewButton= new Button(composite, SWT.PUSH);
+ this.viewButton.setText("View/&Edit...");
+ final GridData gd= new GridData(SWT.FILL, SWT.TOP, false, false, 1, 1);
+ Dialog.applyDialogFont(this.viewButton);
+ gd.widthHint= Math.max(this.viewButton.computeSize(SWT.DEFAULT, SWT.DEFAULT).x,
+ convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH) );
+ this.viewButton.setLayoutData(gd);
+ this.viewButton.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(final SelectionEvent e) {
+ final Object element= ((IStructuredSelection) AutoRunPreferencePage.this.entryViewer.getSelection()).getFirstElement();
+ if (element instanceof ILaunchConfiguration) {
+ DebugUITools.openLaunchConfigurationPropertiesDialog(getShell(), (ILaunchConfiguration) element, IDebugUIConstants.ID_RUN_LAUNCH_GROUP);
+ }
+ }
+ });
+ }
+ { this.modeLabel= new Label(composite, SWT.NONE);
+ this.modeLabel.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1));
+ this.modeLabel.setText("Launch &Mode:");
+
+ this.modeViewer= new ComboViewer(composite, SWT.DROP_DOWN | SWT.READ_ONLY);
+ this.modeViewer.getControl().setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
+ this.modeViewer.setContentProvider(new ArrayContentProvider());
+ this.modeViewer.setLabelProvider(new LabelProvider() {
+
+ private final StringBuilder fStringBuilder= new StringBuilder();
+
+ @Override
+ public String getText(final Object element) {
+ this.fStringBuilder.setLength(0);
+ final Iterator<String> iter= ((Set<String>) element).iterator();
+ if (iter.hasNext()) {
+ append(AutoRunPreferencePage.this.launchManager.getLaunchMode(iter.next()));
+ while (iter.hasNext()) {
+ this.fStringBuilder.append("+");
+ append(AutoRunPreferencePage.this.launchManager.getLaunchMode(iter.next()));
+ }
+ }
+ return this.fStringBuilder.toString();
+ }
+
+ private void append(final ILaunchMode mode) {
+ final String s= mode.getLabel();
+ for (int i= 0; i < s.length(); i++) {
+ final char c= s.charAt(i);
+ if (c == '&') {
+ i++;
+ if (i < s.length()) {
+ this.fStringBuilder.append(s.charAt(i));
+ }
+ }
+ else {
+ this.fStringBuilder.append(c);
+ }
+ }
+ }
+ });
+
+ this.entryViewer.addSelectionChangedListener(new ISelectionChangedListener() {
+ @Override
+ public void selectionChanged(final SelectionChangedEvent event) {
+ updateModes();
+ }
+ });
+ this.modeViewer.addSelectionChangedListener(new ISelectionChangedListener() {
+ @Override
+ public void selectionChanged(final SelectionChangedEvent event) {
+ final Object element= ((IStructuredSelection) event.getSelection()).getFirstElement();
+ if (element != null) {
+ AutoRunPreferencePage.this.lastMode= (Set<String>) element;
+ }
+ }
+ });
+ }
+
+ Dialog.applyDialogFont(composite);
+
+ loadConfigs();
+ loadPrefs();
+
+ return composite;
+ }
+
+ private void updateModes() {
+ final Object element= ((IStructuredSelection) this.entryViewer.getSelection()).getFirstElement();
+ if (element instanceof ILaunchConfiguration) {
+ try {
+ final Set<Set<String>> combinations= ((ILaunchConfiguration) element).getType()
+ .getSupportedModeCombinations();
+ { // mixed not yet supported
+ final Iterator<Set<String>> iter= combinations.iterator();
+ while (iter.hasNext()) {
+ if (iter.next().size() != 1) {
+ iter.remove();
+ }
+ }
+ }
+ final Set<String>[] array= combinations.toArray(new Set[combinations.size()]);
+ if (array.length > 0) {
+ this.modeViewer.setInput(array);
+ if (this.lastMode != null && combinations.contains(this.lastMode)) {
+ this.modeViewer.setSelection(new StructuredSelection(this.lastMode));
+ }
+ else {
+ this.modeViewer.setSelection(new StructuredSelection(array[0]));
+ }
+ this.modeLabel.setEnabled(true);
+ this.modeViewer.getControl().setEnabled(true);
+ return;
+ }
+ }
+ catch (final CoreException e) {
+ StatusManager.getManager().handle(new Status(IStatus.ERROR, Activator.BUNDLE_ID, -1,
+ "An error occured when loading supported modes for the launch configuration.", e));
+ }
+ }
+ this.modeViewer.setInput(new Set[0]);
+ this.modeLabel.setEnabled(false);
+ this.modeViewer.getControl().setEnabled(false);
+ }
+
+ private void loadConfigs() {
+ final ILaunchConfiguration[] launchConfigurations;
+ try {
+ launchConfigurations= this.launchManager.getLaunchConfigurations();
+ this.entryViewer.setInput(launchConfigurations);
+ }
+ catch (final CoreException e) {
+ Activator.getInstance().getLog().log(new Status(IStatus.ERROR, Activator.BUNDLE_ID, -1,
+ "Error occured when loading available launch configurations.", e)); //$NON-NLS-1$
+ this.enableButton.setSelection(false);
+ this.enableButton.setEnabled(false);
+
+ updateModes();
+ return;
+ }
+ }
+
+ private void loadPrefs() {
+ final IPreferencesService preferences= Platform.getPreferencesService();
+ this.enableButton.setSelection(preferences.getBoolean(
+ Activator.BUNDLE_ID, Activator.ENABLED_PREF_KEY, true, null ));
+ try {
+ final String key= preferences.getString(
+ Activator.BUNDLE_ID, Activator.LAUNCH_CONFIG_ID_PREF_KEY, null, null );
+ final ILaunchConfiguration config= (key != null && key.length() > 0) ?
+ this.launchManager.getLaunchConfiguration(key) : null;
+ this.entryViewer.setSelection((config != null) ? new StructuredSelection(config) : new StructuredSelection());
+ }
+ catch (final CoreException e) {
+ }
+
+ { final String mode= preferences.getString(
+ Activator.BUNDLE_ID, Activator.LAUNCH_MODE_ID_PREF_KEY, null, null );
+ if (mode != null) {
+ this.lastMode= new HashSet<>(1);
+ this.lastMode.add(mode);
+ }
+ }
+
+ updateModes();
+ }
+
+ private void savePrefs(final boolean flush) {
+ final IEclipsePreferences node= InstanceScope.INSTANCE.getNode(Activator.BUNDLE_ID);
+
+ node.putBoolean(Activator.ENABLED_PREF_KEY, this.enableButton.getSelection());
+
+ final Object element= ((IStructuredSelection) this.entryViewer.getSelection()).getFirstElement();
+ String key= null;
+ if (element instanceof ILaunchConfiguration) {
+ try {
+ key= ((ILaunchConfiguration) element).getMemento();
+ }
+ catch (final CoreException e) {
+ StatusManager.getManager().handle(new Status(IStatus.ERROR, Activator.BUNDLE_ID, -1,
+ "An error occured when saving the autorun launch configuration.", e));
+ return;
+ }
+ }
+ if (key != null) {
+ node.put(Activator.LAUNCH_CONFIG_ID_PREF_KEY, key);
+
+ final Set<String> modes= (Set<String>) ((IStructuredSelection) this.modeViewer.getSelection()).getFirstElement();
+ if (modes != null && modes.size() == 1) {
+ node.put(Activator.LAUNCH_MODE_ID_PREF_KEY, modes.iterator().next());
+ }
+ }
+ else {
+ node.remove(Activator.LAUNCH_CONFIG_ID_PREF_KEY);
+ }
+
+ if (flush) {
+ try {
+ node.flush();
+ }
+ catch (final BackingStoreException e) {
+ StatusManager.getManager().handle(new Status(IStatus.ERROR, Activator.BUNDLE_ID, -1,
+ "An error occured when saving the autorun launch configuration.", e));
+ }
+ }
+ }
+
+
+ @Override
+ protected void performDefaults() {
+ this.enableButton.setSelection(true);
+ this.entryViewer.setSelection(new StructuredSelection());
+ }
+
+ @Override
+ protected void performApply() {
+ savePrefs(true);
+ }
+
+ @Override
+ public boolean performOk() {
+ savePrefs(false);
+ return true;
+ }
+
+}
diff --git a/autorun/org.eclipse.statet.eutils.autorun/src/org/eclipse/statet/internal/eutils/autorun/AutoRunner.java b/autorun/org.eclipse.statet.eutils.autorun/src/org/eclipse/statet/internal/eutils/autorun/AutoRunner.java
new file mode 100644
index 0000000..4711d4b
--- /dev/null
+++ b/autorun/org.eclipse.statet.eutils.autorun/src/org/eclipse/statet/internal/eutils/autorun/AutoRunner.java
@@ -0,0 +1,68 @@
+/*=============================================================================#
+ # Copyright (c) 2007, 2017 Stephan Wahlbrink and others.
+ #
+ # This program and the accompanying materials are made available under the
+ # terms of the Eclipse Public License 2.0 which is available at
+ # https://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0
+ # which is available at https://www.apache.org/licenses/LICENSE-2.0.
+ #
+ # SPDX-License-Identifier: EPL-2.0 OR Apache-2.0
+ #
+ # Contributors:
+ # Stephan Wahlbrink <sw@wahlbrink.eu> - initial API and implementation
+ #=============================================================================*/
+
+package org.eclipse.statet.internal.eutils.autorun;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.debug.core.DebugPlugin;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.ui.statushandlers.StatusManager;
+
+public class AutoRunner extends Job {
+
+
+ private final String key;
+
+ private final String mode;
+
+
+ public AutoRunner(final String key, final String mode) {
+ super("Auto Run");
+ if (key == null) {
+ throw new NullPointerException("key");
+ }
+ if (mode == null) {
+ throw new NullPointerException("mode");
+ }
+ this.key= key;
+ this.mode= mode;
+ }
+
+
+ @Override
+ protected IStatus run(final IProgressMonitor monitor) {
+ try {
+ final ILaunchConfiguration config= DebugPlugin.getDefault().getLaunchManager().getLaunchConfiguration(this.key);
+ if (config == null) {
+ final IStatus status= new Status(IStatus.WARNING, Activator.BUNDLE_ID, 101,
+ "The configured launch configuration for Auto Run could not be loaded.", null);
+ StatusManager.getManager().handle(status);
+ return Status.OK_STATUS;
+ }
+
+ config.launch(this.mode, monitor, false, true);
+ }
+ catch (final CoreException e) {
+ final IStatus status= new Status(IStatus.ERROR, Activator.BUNDLE_ID, 102,
+ "An error occured when starting the launch configuration by Auto Run.", e);
+ return status;
+ }
+ return Status.OK_STATUS;
+ }
+
+}
diff --git a/autorun/org.eclipse.statet.eutils.autorun/src/org/eclipse/statet/internal/eutils/autorun/nostart/AutoRunStartup.java b/autorun/org.eclipse.statet.eutils.autorun/src/org/eclipse/statet/internal/eutils/autorun/nostart/AutoRunStartup.java
new file mode 100644
index 0000000..d6e1647
--- /dev/null
+++ b/autorun/org.eclipse.statet.eutils.autorun/src/org/eclipse/statet/internal/eutils/autorun/nostart/AutoRunStartup.java
@@ -0,0 +1,48 @@
+/*=============================================================================#
+ # Copyright (c) 2007, 2017 Stephan Wahlbrink and others.
+ #
+ # This program and the accompanying materials are made available under the
+ # terms of the Eclipse Public License 2.0 which is available at
+ # https://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0
+ # which is available at https://www.apache.org/licenses/LICENSE-2.0.
+ #
+ # SPDX-License-Identifier: EPL-2.0 OR Apache-2.0
+ #
+ # Contributors:
+ # Stephan Wahlbrink <sw@wahlbrink.eu> - initial API and implementation
+ #=============================================================================*/
+
+package org.eclipse.statet.internal.eutils.autorun.nostart;
+
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.preferences.IPreferencesService;
+import org.eclipse.debug.core.ILaunchManager;
+import org.eclipse.ui.IStartup;
+
+import org.eclipse.statet.internal.eutils.autorun.Activator;
+import org.eclipse.statet.internal.eutils.autorun.AutoRunner;
+
+
+public class AutoRunStartup implements IStartup {
+
+
+ public AutoRunStartup() {
+ }
+
+
+ @Override
+ public void earlyStartup() {
+ if (Boolean.parseBoolean(System.getProperty("org.eclipse.statet.eutils.autorun.disable"))) { //$NON-NLS-1$
+ return;
+ }
+ final IPreferencesService preferences= Platform.getPreferencesService();
+ if (preferences.getBoolean(Activator.BUNDLE_ID, Activator.ENABLED_PREF_KEY, true, null)) {
+ final String key= preferences.getString(Activator.BUNDLE_ID, Activator.LAUNCH_CONFIG_ID_PREF_KEY, null, null);
+ if (key != null) {
+ final String mode= preferences.getString(Activator.BUNDLE_ID, Activator.LAUNCH_MODE_ID_PREF_KEY, ILaunchManager.RUN_MODE, null);
+ new AutoRunner(key, mode).schedule(500);
+ }
+ }
+ }
+
+}