Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian W. Damus2016-02-11 02:48:20 +0000
committerGerrit Code Review @ Eclipse.org2016-02-12 15:31:41 +0000
commitecd4928b327f5561364c5068c9ff5f1668e92d13 (patch)
tree7c34f46cf82a1d65ac753fa92c2a5d55371b8dba /plugins/editor/org.eclipse.papyrus.eclipse.project.editors
parent751a204d74e15eb2db6b41c937691fc56dcc1252 (diff)
downloadorg.eclipse.papyrus-ecd4928b327f5561364c5068c9ff5f1668e92d13.tar.gz
org.eclipse.papyrus-ecd4928b327f5561364c5068c9ff5f1668e92d13.tar.xz
org.eclipse.papyrus-ecd4928b327f5561364c5068c9ff5f1668e92d13.zip
Bug 485220: [Architecture] Provide a more modular architecture
https://bugs.eclipse.org/bugs/show_bug.cgi?id=485220 Factor UI dependencies out of the UML Element Types bundle. This includes moving some advices that interact with the user into a new org.eclipse.papyrus.uml.service.types.ui bundle. Pull up the PasteCommandService and IPasteCommandProvider API into the Infra Diagram layer where the extension point is defined. Deprecate the old API in the UML layer. Introduce a service for participation of languages in CSS styling: * styling reset actions in the Reset Style command * access to semantic model classes and properties to make available to CSS Factor PapyrusObservableValue and cohorts out of the UML Tools bundle into the Infra Layer for more general reuse and to relieve the Diagram Infrastructure layer of UML dependencies. The old API remains as deprecated. Remove the Infra Diagram Layer dependency on UML Layer for property testers governing deletion in the diagram. Includes introduction of a new IGraphicalDeletionHelper OSGi service for delegation of the determination of whether an element can be deleted from the diagram and replacement of the XML expression properties * org.eclipse.papyrus.uml.diagram.common.isSemanticDeletion * org.eclipse.papyrus.uml.diagram.common.isReadOnly by * org.eclipse.papyrus.infra.gmfdiag.common.isSemanticDeletion * org.eclipse.papyrus.infra.gmfdiag.common.canDelete (where the latter is the negation of the property that it supersedes) Extract UML dependencies from the Diagram Outline and CSS Editor bundles. Remove unused MDTUtil APIs that referenced a UML-specific annotation. Move the Diagram Infrastructure CSS Palette bundle into the UML layer because it serves to provide extensions on the Palette Service, which is an overtly UML-specific capability. All client APIs for the Properties View are moved from org.eclipse.papyrus.views.properties bundle to a new org.eclipse.papyrus.infra.properties.ui bundle. This includes renaming of: * extension points * label-provider contexts * XWT namespaces Add an "all UI tests" suite. Define a componentized hierarchical build layout of the main plug-ins Change-Id: I43f8f3644857a18b69715f5a2f1da9b1cf286d67
Diffstat (limited to 'plugins/editor/org.eclipse.papyrus.eclipse.project.editors')
-rw-r--r--plugins/editor/org.eclipse.papyrus.eclipse.project.editors/.classpath7
-rw-r--r--plugins/editor/org.eclipse.papyrus.eclipse.project.editors/.project28
-rw-r--r--plugins/editor/org.eclipse.papyrus.eclipse.project.editors/.settings/org.eclipse.jdt.core.prefs291
-rw-r--r--plugins/editor/org.eclipse.papyrus.eclipse.project.editors/.settings/org.eclipse.jdt.ui.prefs68
-rw-r--r--plugins/editor/org.eclipse.papyrus.eclipse.project.editors/META-INF/MANIFEST.MF21
-rw-r--r--plugins/editor/org.eclipse.papyrus.eclipse.project.editors/about.html28
-rw-r--r--plugins/editor/org.eclipse.papyrus.eclipse.project.editors/build.properties7
-rw-r--r--plugins/editor/org.eclipse.papyrus.eclipse.project.editors/plugin.properties3
-rw-r--r--plugins/editor/org.eclipse.papyrus.eclipse.project.editors/pom.xml12
-rw-r--r--plugins/editor/org.eclipse.papyrus.eclipse.project.editors/src/org/eclipse/papyrus/eclipse/project/editors/Activator.java75
-rw-r--r--plugins/editor/org.eclipse.papyrus.eclipse.project.editors/src/org/eclipse/papyrus/eclipse/project/editors/file/AbstractFileEditor.java122
-rw-r--r--plugins/editor/org.eclipse.papyrus.eclipse.project.editors/src/org/eclipse/papyrus/eclipse/project/editors/file/BuildEditor.java290
-rw-r--r--plugins/editor/org.eclipse.papyrus.eclipse.project.editors/src/org/eclipse/papyrus/eclipse/project/editors/file/BundlePropertiesEditor.java67
-rw-r--r--plugins/editor/org.eclipse.papyrus.eclipse.project.editors/src/org/eclipse/papyrus/eclipse/project/editors/file/ClasspathEditor.java261
-rw-r--r--plugins/editor/org.eclipse.papyrus.eclipse.project.editors/src/org/eclipse/papyrus/eclipse/project/editors/file/ManifestEditor.java594
-rw-r--r--plugins/editor/org.eclipse.papyrus.eclipse.project.editors/src/org/eclipse/papyrus/eclipse/project/editors/interfaces/IBuildEditor.java98
-rw-r--r--plugins/editor/org.eclipse.papyrus.eclipse.project.editors/src/org/eclipse/papyrus/eclipse/project/editors/interfaces/IClasspathEditor.java56
-rw-r--r--plugins/editor/org.eclipse.papyrus.eclipse.project.editors/src/org/eclipse/papyrus/eclipse/project/editors/interfaces/IFeatureProjectEditor.java106
-rw-r--r--plugins/editor/org.eclipse.papyrus.eclipse.project.editors/src/org/eclipse/papyrus/eclipse/project/editors/interfaces/IFileEditor.java66
-rw-r--r--plugins/editor/org.eclipse.papyrus.eclipse.project.editors/src/org/eclipse/papyrus/eclipse/project/editors/interfaces/IJavaProjectEditor.java52
-rw-r--r--plugins/editor/org.eclipse.papyrus.eclipse.project.editors/src/org/eclipse/papyrus/eclipse/project/editors/interfaces/IManifestEditor.java229
-rw-r--r--plugins/editor/org.eclipse.papyrus.eclipse.project.editors/src/org/eclipse/papyrus/eclipse/project/editors/interfaces/IPluginProjectEditor.java58
-rw-r--r--plugins/editor/org.eclipse.papyrus.eclipse.project.editors/src/org/eclipse/papyrus/eclipse/project/editors/interfaces/IProjectEditor.java93
-rw-r--r--plugins/editor/org.eclipse.papyrus.eclipse.project.editors/src/org/eclipse/papyrus/eclipse/project/editors/project/AbstractProjectEditor.java195
-rw-r--r--plugins/editor/org.eclipse.papyrus.eclipse.project.editors/src/org/eclipse/papyrus/eclipse/project/editors/project/FeatureProjectEditor.java552
-rw-r--r--plugins/editor/org.eclipse.papyrus.eclipse.project.editors/src/org/eclipse/papyrus/eclipse/project/editors/project/JavaProjectEditor.java272
-rw-r--r--plugins/editor/org.eclipse.papyrus.eclipse.project.editors/src/org/eclipse/papyrus/eclipse/project/editors/project/PluginProjectEditor.java307
-rw-r--r--plugins/editor/org.eclipse.papyrus.eclipse.project.editors/src/org/eclipse/papyrus/eclipse/project/editors/project/ProjectEditor.java151
28 files changed, 4109 insertions, 0 deletions
diff --git a/plugins/editor/org.eclipse.papyrus.eclipse.project.editors/.classpath b/plugins/editor/org.eclipse.papyrus.eclipse.project.editors/.classpath
new file mode 100644
index 00000000000..49a283a34c3
--- /dev/null
+++ b/plugins/editor/org.eclipse.papyrus.eclipse.project.editors/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="output" path="bin"/>
+ <classpathentry kind="src" path="src"/>
+</classpath> \ No newline at end of file
diff --git a/plugins/editor/org.eclipse.papyrus.eclipse.project.editors/.project b/plugins/editor/org.eclipse.papyrus.eclipse.project.editors/.project
new file mode 100644
index 00000000000..a37a2764ede
--- /dev/null
+++ b/plugins/editor/org.eclipse.papyrus.eclipse.project.editors/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.papyrus.eclipse.project.editors</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/plugins/editor/org.eclipse.papyrus.eclipse.project.editors/.settings/org.eclipse.jdt.core.prefs b/plugins/editor/org.eclipse.papyrus.eclipse.project.editors/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 00000000000..c585cc455ae
--- /dev/null
+++ b/plugins/editor/org.eclipse.papyrus.eclipse.project.editors/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,291 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.5
+org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_assignment=0
+org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_compact_if=16
+org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80
+org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0
+org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16
+org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0
+org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16
+org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_resources_in_try=80
+org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16
+org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_union_type_in_multicatch=16
+org.eclipse.jdt.core.formatter.blank_lines_after_imports=1
+org.eclipse.jdt.core.formatter.blank_lines_after_package=1
+org.eclipse.jdt.core.formatter.blank_lines_before_field=0
+org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0
+org.eclipse.jdt.core.formatter.blank_lines_before_imports=1
+org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1
+org.eclipse.jdt.core.formatter.blank_lines_before_method=1
+org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1
+org.eclipse.jdt.core.formatter.blank_lines_before_package=0
+org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1
+org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1
+org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_lambda_body=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false
+org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false
+org.eclipse.jdt.core.formatter.comment.format_block_comments=true
+org.eclipse.jdt.core.formatter.comment.format_header=false
+org.eclipse.jdt.core.formatter.comment.format_html=true
+org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true
+org.eclipse.jdt.core.formatter.comment.format_line_comments=true
+org.eclipse.jdt.core.formatter.comment.format_source_code=true
+org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true
+org.eclipse.jdt.core.formatter.comment.indent_root_tags=true
+org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert
+org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=insert
+org.eclipse.jdt.core.formatter.comment.line_length=260
+org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true
+org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true
+org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments=false
+org.eclipse.jdt.core.formatter.compact_else_if=true
+org.eclipse.jdt.core.formatter.continuation_indentation=2
+org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2
+org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off
+org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on
+org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false
+org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true
+org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true
+org.eclipse.jdt.core.formatter.indent_empty_lines=false
+org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true
+org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true
+org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true
+org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=false
+org.eclipse.jdt.core.formatter.indentation.size=4
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_type_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert
+org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert
+org.eclipse.jdt.core.formatter.insert_space_after_lambda_arrow=insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_try=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources=insert
+org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert
+org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_try=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_lambda_arrow=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_try=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert
+org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert
+org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert
+org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_try_resources=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.join_lines_in_comments=false
+org.eclipse.jdt.core.formatter.join_wrapped_lines=false
+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=260
+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=5
+org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true
+org.eclipse.jdt.core.formatter.tabulation.char=tab
+org.eclipse.jdt.core.formatter.tabulation.size=4
+org.eclipse.jdt.core.formatter.use_on_off_tags=false
+org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false
+org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true
+org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch=true
+org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true
diff --git a/plugins/editor/org.eclipse.papyrus.eclipse.project.editors/.settings/org.eclipse.jdt.ui.prefs b/plugins/editor/org.eclipse.papyrus.eclipse.project.editors/.settings/org.eclipse.jdt.ui.prefs
new file mode 100644
index 00000000000..954281dbc31
--- /dev/null
+++ b/plugins/editor/org.eclipse.papyrus.eclipse.project.editors/.settings/org.eclipse.jdt.ui.prefs
@@ -0,0 +1,68 @@
+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=false
+cleanup.always_use_this_for_non_static_field_access=false
+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=false
+cleanup.make_private_fields_final=true
+cleanup.make_type_abstract_if_missing_method=false
+cleanup.make_variable_declarations_final=false
+cleanup.never_use_blocks=false
+cleanup.never_use_parentheses_in_expressions=true
+cleanup.organize_imports=false
+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=true
+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=true
+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=false
+cleanup.use_this_for_non_static_field_access_only_if_necessary=true
+cleanup.use_this_for_non_static_method_access=false
+cleanup.use_this_for_non_static_method_access_only_if_necessary=true
+cleanup.use_type_arguments=false
+cleanup_profile=_Papyrus
+cleanup_settings_version=2
+eclipse.preferences.version=1
+formatter_profile=_Papyrus
+formatter_settings_version=12
+org.eclipse.jdt.ui.ignorelowercasenames=true
+org.eclipse.jdt.ui.importorder=java;javax;org;com;
+org.eclipse.jdt.ui.javadoc=true
+org.eclipse.jdt.ui.ondemandthreshold=99
+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\="false" context\="constructorcomment_context" deleted\="false" description\="Comment for created constructors" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorcomment" name\="constructorcomment">/**\n * Constructor.\n *\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} CEA LIST and others.\n * \n * All rights reserved. This program and the accompanying materials\n * are made available under the terms of the Eclipse Public License v1.0\n * which accompanies this distribution, and is available at\n * http\://www.eclipse.org/legal/epl-v10.html\n *\n * Contributors\:\n * CEA LIST - Initial API and implementation\n * \n *****************************************************************************/\n</template><template autoinsert\="true" context\="typecomment_context" deleted\="false" description\="Comment for created types" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.typecomment" name\="typecomment">/**\n * @author ${user}\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">/**\n * ${see_to_overridden}\n *\n * ${tags}\n */</template><template autoinsert\="false" context\="delegatecomment_context" deleted\="false" description\="Comment for delegate methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.delegatecomment" name\="delegatecomment">/**\n * ${see_to_target}\n *\n * ${tags}\n */</template><template autoinsert\="true" context\="newtype_context" deleted\="false" description\="Newly created files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.newtype" name\="newtype">${filecomment}\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>
diff --git a/plugins/editor/org.eclipse.papyrus.eclipse.project.editors/META-INF/MANIFEST.MF b/plugins/editor/org.eclipse.papyrus.eclipse.project.editors/META-INF/MANIFEST.MF
new file mode 100644
index 00000000000..ccac5349524
--- /dev/null
+++ b/plugins/editor/org.eclipse.papyrus.eclipse.project.editors/META-INF/MANIFEST.MF
@@ -0,0 +1,21 @@
+Manifest-Version: 1.0
+Export-Package: org.eclipse.papyrus.eclipse.project.editors.file,
+ org.eclipse.papyrus.eclipse.project.editors.interfaces,
+ org.eclipse.papyrus.eclipse.project.editors.project
+Require-Bundle: org.eclipse.ui,
+ org.eclipse.core.runtime,
+ org.eclipse.papyrus.infra.core.log;bundle-version="1.2.0",
+ org.eclipse.core.resources,
+ org.eclipse.jdt.core,
+ org.eclipse.papyrus.infra.widgets;bundle-version="1.2.0",
+ org.eclipse.pde.ui;bundle-version="3.6.100",
+ org.eclipse.emf.ecore;bundle-version="2.10.0"
+Bundle-Vendor: %providerName
+Bundle-ActivationPolicy: lazy
+Bundle-Version: 1.2.0.qualifier
+Bundle-Localization: plugin
+Bundle-Name: %pluginName
+Bundle-Activator: org.eclipse.papyrus.eclipse.project.editors.Activator
+Bundle-ManifestVersion: 2
+Bundle-SymbolicName: org.eclipse.papyrus.eclipse.project.editors
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
diff --git a/plugins/editor/org.eclipse.papyrus.eclipse.project.editors/about.html b/plugins/editor/org.eclipse.papyrus.eclipse.project.editors/about.html
new file mode 100644
index 00000000000..d35d5aed64c
--- /dev/null
+++ b/plugins/editor/org.eclipse.papyrus.eclipse.project.editors/about.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
+<title>About</title>
+</head>
+<body lang="EN-US">
+<h2>About This Content</h2>
+
+<p>June 5, 2007</p>
+<h3>License</h3>
+
+<p>The Eclipse Foundation makes available all content in this plug-in (&quot;Content&quot;). Unless otherwise
+indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 (&quot;EPL&quot;). A copy of the EPL is available
+at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+For purposes of the EPL, &quot;Program&quot; will mean the Content.</p>
+
+<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
+being redistributed by another party (&quot;Redistributor&quot;) and different terms and conditions may
+apply to your use of any object code in the Content. Check the Redistributor's license that was
+provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
+indicated below, the terms and conditions of the EPL still apply to any source code in the Content
+and such source code may be obtained at <a href="http://www.eclipse.org/">http://www.eclipse.org</a>.</p>
+
+</body>
+</html>
diff --git a/plugins/editor/org.eclipse.papyrus.eclipse.project.editors/build.properties b/plugins/editor/org.eclipse.papyrus.eclipse.project.editors/build.properties
new file mode 100644
index 00000000000..cdd2db7f1f5
--- /dev/null
+++ b/plugins/editor/org.eclipse.papyrus.eclipse.project.editors/build.properties
@@ -0,0 +1,7 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ about.html,\
+ plugin.properties
+src.includes = about.html
diff --git a/plugins/editor/org.eclipse.papyrus.eclipse.project.editors/plugin.properties b/plugins/editor/org.eclipse.papyrus.eclipse.project.editors/plugin.properties
new file mode 100644
index 00000000000..60775cd95e5
--- /dev/null
+++ b/plugins/editor/org.eclipse.papyrus.eclipse.project.editors/plugin.properties
@@ -0,0 +1,3 @@
+#Properties file for org.eclipse.papyrus.eclipse.project.editors
+providerName = Eclipse Modeling Project
+pluginName = Editors for the Eclipse Project \ No newline at end of file
diff --git a/plugins/editor/org.eclipse.papyrus.eclipse.project.editors/pom.xml b/plugins/editor/org.eclipse.papyrus.eclipse.project.editors/pom.xml
new file mode 100644
index 00000000000..872d5ce559d
--- /dev/null
+++ b/plugins/editor/org.eclipse.papyrus.eclipse.project.editors/pom.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.eclipse.papyrus</groupId>
+ <artifactId>org.eclipse.papyrus.editor</artifactId>
+ <version>0.0.1-SNAPSHOT</version>
+ </parent>
+ <artifactId>org.eclipse.papyrus.eclipse.project.editors</artifactId>
+ <version>1.2.0-SNAPSHOT</version>
+ <packaging>eclipse-plugin</packaging>
+</project>
diff --git a/plugins/editor/org.eclipse.papyrus.eclipse.project.editors/src/org/eclipse/papyrus/eclipse/project/editors/Activator.java b/plugins/editor/org.eclipse.papyrus.eclipse.project.editors/src/org/eclipse/papyrus/eclipse/project/editors/Activator.java
new file mode 100644
index 00000000000..db1f9227ddb
--- /dev/null
+++ b/plugins/editor/org.eclipse.papyrus.eclipse.project.editors/src/org/eclipse/papyrus/eclipse/project/editors/Activator.java
@@ -0,0 +1,75 @@
+/*****************************************************************************
+ * Copyright (c) 2011 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.eclipse.project.editors;
+
+import org.eclipse.papyrus.infra.core.log.LogHelper;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class Activator extends AbstractUIPlugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.eclipse.papyrus.eclipse.project.editors"; //$NON-NLS-1$
+
+ // The shared instance
+ private static Activator plugin;
+
+ public static LogHelper log;
+
+ /**
+ * The constructor
+ */
+ public Activator() {
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext
+ * )
+ */
+ @Override
+ public void start(final BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ log = new LogHelper(this);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext
+ * )
+ */
+ @Override
+ public void stop(final BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static Activator getDefault() {
+ return plugin;
+ }
+
+}
diff --git a/plugins/editor/org.eclipse.papyrus.eclipse.project.editors/src/org/eclipse/papyrus/eclipse/project/editors/file/AbstractFileEditor.java b/plugins/editor/org.eclipse.papyrus.eclipse.project.editors/src/org/eclipse/papyrus/eclipse/project/editors/file/AbstractFileEditor.java
new file mode 100644
index 00000000000..2fbe4dd44a1
--- /dev/null
+++ b/plugins/editor/org.eclipse.papyrus.eclipse.project.editors/src/org/eclipse/papyrus/eclipse/project/editors/file/AbstractFileEditor.java
@@ -0,0 +1,122 @@
+/*****************************************************************************
+ * Copyright (c) 2011 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.eclipse.project.editors.file;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.StringReader;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.papyrus.eclipse.project.editors.Activator;
+import org.eclipse.papyrus.eclipse.project.editors.interfaces.IFileEditor;
+
+/**
+ *
+ * An abstract class for File Editor
+ *
+ */
+public abstract class AbstractFileEditor implements IFileEditor {
+
+ /** the Eclipse Project */
+ private final IProject project;
+
+
+ /**
+ *
+ * Constructor.
+ *
+ * @param project
+ * the eclipse project
+ */
+ public AbstractFileEditor(final IProject project) {
+ this.project = project;
+ }
+
+ /**
+ *
+ * @return
+ * the eclipse project
+ */
+ public IProject getProject() {
+ return this.project;
+ }
+
+ /**
+ *
+ * @see org.eclipse.papyrus.eclipse.project.editors.project.AbstractProjectEditor#init()
+ *
+ * {@inheritDoc}
+ */
+ public void init() {
+
+ }
+
+ /**
+ *
+ * @see org.eclipse.papyrus.eclipse.project.editors.interfaces.IProjectEditor#getMissingFiles()
+ *
+ * {@inheritDoc}
+ */
+ public Set<String> getMissingFiles() {
+ return new HashSet<String>();
+ }
+
+ /**
+ *
+ * @param text
+ * the initial text
+ * @return
+ * an input stream
+ */
+ protected InputStream getInputStream(final String text) {
+ if (text == null) {
+ Activator.log.warn("Cannot open an input stream for a null text"); //$NON-NLS-1$
+ return null;
+ }
+
+ final StringReader sr = new StringReader(text);
+ InputStream is = new InputStream() {
+
+ @Override
+ public int read() throws IOException {
+ return sr.read();
+ }
+
+ };
+ return is;
+ }
+
+ /**
+ *
+ * @see org.eclipse.papyrus.eclipse.project.editors.project.AbstractProjectEditor.plugin.AbstractEditor#exists()
+ *
+ * {@inheritDoc}
+ */
+ public boolean exists() {
+ return getMissingFiles().size() == 0;
+ }
+
+ /**
+ *
+ * @see org.eclipse.papyrus.eclipse.project.editors.interfaces.IFileEditor#create()
+ *
+ * {@inheritDoc}
+ */
+ public void create() {
+ createFiles(getMissingFiles());
+ init();
+ }
+}
diff --git a/plugins/editor/org.eclipse.papyrus.eclipse.project.editors/src/org/eclipse/papyrus/eclipse/project/editors/file/BuildEditor.java b/plugins/editor/org.eclipse.papyrus.eclipse.project.editors/src/org/eclipse/papyrus/eclipse/project/editors/file/BuildEditor.java
new file mode 100644
index 00000000000..cfb832ef2d3
--- /dev/null
+++ b/plugins/editor/org.eclipse.papyrus.eclipse.project.editors/src/org/eclipse/papyrus/eclipse/project/editors/file/BuildEditor.java
@@ -0,0 +1,290 @@
+/*****************************************************************************
+ * Copyright (c) 2011 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
+ * Vincent Lorenzo (CEA-LIST) vincent.lorenzo@cea.fr
+ *****************************************************************************/
+package org.eclipse.papyrus.eclipse.project.editors.file;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Properties;
+import java.util.Set;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.papyrus.eclipse.project.editors.Activator;
+import org.eclipse.papyrus.eclipse.project.editors.interfaces.IBuildEditor;
+import org.eclipse.papyrus.infra.widgets.util.FileUtil;
+
+public class BuildEditor extends AbstractFileEditor implements IBuildEditor {
+
+ /** the build config */
+ private Properties buildConfig;
+
+ /** the buidl file */
+ private File buildFile;
+
+ /**
+ * The build key to edit
+ * Defaults to "bin.includes" (The eclipse standard binary build)
+ */
+ private String buildKey = "bin.includes"; //$NON-NLS-1$
+
+
+ /**
+ *
+ * Constructor.
+ *
+ * @param project
+ * the eclipse project
+ */
+ public BuildEditor(final IProject project) {
+ super(project);
+ }
+
+ /**
+ *
+ * Constructor.
+ *
+ * @param project
+ * the eclipse project
+ * @param buildKey
+ * the build key to edit. If null, the "bin.includes" key will be used
+ *
+ * @see IBuildEditor#BINARY_BUILD
+ * @see IBuildEditor#SOURCE_BUILD
+ */
+ public BuildEditor(final IProject project, String buildKey) {
+ super(project);
+ if (buildKey != null) {
+ this.buildKey = buildKey;
+ }
+ }
+
+ /**
+ *
+ * @see org.eclipse.papyrus.eclipse.project.editors.project.ProjectEditor#init()
+ *
+ * {@inheritDoc}
+ */
+ @Override
+ public void init() {
+ this.buildConfig = new Properties();
+ this.buildFile = getBuildProperties();
+ if (this.buildFile != null && this.buildFile.exists()) {
+ try {
+ this.buildConfig.load(new FileInputStream(this.buildFile));
+ } catch (FileNotFoundException e) {
+ Activator.log.error(e);
+ } catch (IOException e) {
+ Activator.log.error(e);
+ }
+ }
+ }
+
+
+ private File getBuildProperties() {
+ return this.buildFile = FileUtil.getWorkspaceFile("/" + getProject().getName() + "/" + BUILD_PROPERTIES_FILE); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ /**
+ *
+ * @see org.eclipse.papyrus.eclipse.project.editors.interfaces.IBuildEditor#addToBuild(java.lang.String)
+ *
+ * {@inheritDoc}
+ */
+ public void addToBuild(final String path) {
+ if (exists()) {
+ String currentValue = this.buildConfig.getProperty(buildKey);
+ if (Arrays.asList(getElementsInBuild()).contains(path)) {
+ return;
+ }
+ if (currentValue == null || currentValue.trim().equals("")) { //$NON-NLS-1$
+ this.buildConfig.setProperty(buildKey, path);
+ } else {
+ this.buildConfig.setProperty(buildKey, currentValue + "," + path); //$NON-NLS-1$
+ }
+ }
+ }
+
+ /**
+ *
+ * @see org.eclipse.papyrus.eclipse.project.editors.interfaces.IBuildEditor#removeFromBuild(java.lang.String)
+ *
+ * {@inheritDoc}
+ */
+ public void removeFromBuild(String path) {
+ if (isRegisteredSourceFolder(path)) {
+ // Get the files from the build
+ List<String> allFiles = Arrays.asList(getElementsInBuild());
+
+ // Clear the build
+ this.buildConfig.setProperty(buildKey, "");
+
+ // Recreate the build without the removed files
+ for (String filePath : allFiles) {
+ if (!filePath.equals(path)) {
+ addToBuild(filePath);
+ }
+ }
+ }
+ }
+
+ /**
+ *
+ * @throws Throwable
+ * @see org.eclipse.papyrus.eclipse.project.editors.project.ProjectEditor#save()
+ *
+ * {@inheritDoc}
+ */
+ public void save() {
+ if (exists()) {
+ try {
+ this.buildConfig.store(new FileOutputStream(this.buildFile), "");
+ } catch (FileNotFoundException ex) {
+ Activator.log.error(ex);
+ } catch (IOException ex) {
+ Activator.log.error(ex);
+ }
+ }
+ }
+
+
+ /**
+ *
+ * @see org.eclipse.papyrus.eclipse.project.editors.interfaces.IBuildEditor#registerSourceFolder(java.lang.String)
+ *
+ * {@inheritDoc}
+ */
+ public void registerSourceFolder(final String path) {
+ if (exists() && !isRegisteredSourceFolder(path)) {
+ String currentValue = this.buildConfig.getProperty(SOURCE_FOLDER_KEY);
+ if (currentValue == null || currentValue.trim().equals("")) { //$NON-NLS-1$
+ this.buildConfig.setProperty(SOURCE_FOLDER_KEY, path);
+ } else {
+ this.buildConfig.setProperty(SOURCE_FOLDER_KEY, currentValue + "," + path); //$NON-NLS-1$
+ }
+ }
+ }
+
+ /**
+ *
+ * @see org.eclipse.papyrus.eclipse.project.editors.interfaces.IBuildEditor#isRegistred(java.lang.String)
+ *
+ * {@inheritDoc}
+ */
+ public boolean isRegisteredSourceFolder(final String path) {
+ return Arrays.asList(getSourceFolders()).contains(path);
+ }
+
+ /**
+ *
+ * @see org.eclipse.papyrus.eclipse.project.editors.file.AbstractFileEditor#getMissingFiles()
+ *
+ * {@inheritDoc}
+ */
+ @Override
+ public Set<String> getMissingFiles() {
+ Set<String> files = super.getMissingFiles();
+ if (!getBuildProperties().exists()) {
+ files.add(BUILD_PROPERTIES_FILE);
+ }
+ return files;
+ }
+
+ /**
+ *
+ * @see org.eclipse.papyrus.eclipse.project.editors.interfaces.IBuildEditor#getSourceFolders()
+ *
+ * {@inheritDoc}
+ */
+ public String[] getSourceFolders() {
+ if (exists()) {
+ String currentValue = this.buildConfig.getProperty(SOURCE_FOLDER_KEY, "").replaceAll("\t|\r|\n", "").trim();
+ String[] values = currentValue.split(","); //$NON-NLS-1$
+ return values;
+ }
+ return new String[0];
+ }
+
+ /**
+ *
+ * @see org.eclipse.papyrus.eclipse.project.editors.project.AbstractProjectEditor#exists()
+ *
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean exists() {
+ return this.buildFile.getParentFile().exists() && this.buildFile.exists() && super.exists();
+ }
+
+ /**
+ *
+ * @see org.eclipse.papyrus.eclipse.project.editors.project.ProjectEditor#createFiles(Set)
+ *
+ * {@inheritDoc}
+ */
+ public void createFiles(final Set<String> files) {
+ if (files.contains(BUILD_PROPERTIES_FILE)) {
+ if (!this.buildFile.exists()) {
+ if (!this.buildFile.getParentFile().exists()) {
+ this.buildFile.getParentFile().mkdirs();
+ }
+ try {
+ this.buildFile.createNewFile();
+ init();
+ } catch (IOException e) {
+ Activator.log.error(e);
+ }
+ }
+ }
+ }
+
+ /**
+ *
+ * @see org.eclipse.papyrus.eclipse.project.editors.interfaces.IBuildEditor#getElementsInBuild()
+ *
+ * {@inheritDoc}
+ */
+ public String[] getElementsInBuild() {
+ String value = this.buildConfig.getProperty(buildKey);
+ return splitValues(value);
+ }
+
+ private String[] splitValues(String value) {
+ if (value == null) {
+ return new String[0];
+ }
+ return value.replace("\t|\r|\n", "").split(","); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ public void registerBinFolder(String binFolder) {
+ if (isRegisteredBinFolder(binFolder)) {
+ return;
+ }
+
+ String value = this.buildConfig.getProperty(BIN_KEY, ""); //$NON-NLS-1$
+ if (value.trim().equals("")) { //$NON-NLS-1$
+ value = binFolder;
+ } else {
+ value = value + "," + binFolder;
+ }
+ this.buildConfig.setProperty(BIN_KEY, value);
+ }
+
+ public boolean isRegisteredBinFolder(String binFolder) {
+ List<String> folders = Arrays.asList(splitValues(this.buildConfig.getProperty(BIN_KEY, ""))); //$NON-NLS-1$
+ return folders.contains(binFolder);
+ }
+}
diff --git a/plugins/editor/org.eclipse.papyrus.eclipse.project.editors/src/org/eclipse/papyrus/eclipse/project/editors/file/BundlePropertiesEditor.java b/plugins/editor/org.eclipse.papyrus.eclipse.project.editors/src/org/eclipse/papyrus/eclipse/project/editors/file/BundlePropertiesEditor.java
new file mode 100644
index 00000000000..ba870790e50
--- /dev/null
+++ b/plugins/editor/org.eclipse.papyrus.eclipse.project.editors/src/org/eclipse/papyrus/eclipse/project/editors/file/BundlePropertiesEditor.java
@@ -0,0 +1,67 @@
+package org.eclipse.papyrus.eclipse.project.editors.file;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.util.Properties;
+import java.util.Set;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.papyrus.eclipse.project.editors.Activator;
+import org.eclipse.papyrus.infra.widgets.util.FileUtil;
+
+
+public class BundlePropertiesEditor extends AbstractFileEditor {
+
+ /** the build config */
+ private Properties bundleConfig;
+
+ /** the buidl file */
+ private File bundleFile;
+
+ private String filePath;
+
+ public BundlePropertiesEditor(IProject project, String filePath) {
+ super(project);
+ this.filePath = filePath;
+
+ }
+
+ @Override
+ public void init() {
+ this.bundleFile = getBundleProperties();
+ // if(this.bundleFile != null && this.bundleFile.exists()) {
+ try {
+ this.bundleConfig.load(new FileInputStream(this.bundleFile));
+ } catch (FileNotFoundException e) {
+ Activator.log.error(e);
+ } catch (IOException e) {
+ Activator.log.error(e);
+ }
+ // }
+ }
+
+ public void createFiles(Set<String> files) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public void save() {
+ // TODO Auto-generated method stub
+
+ }
+
+ public String getValue(String propertyName) {
+ return this.bundleConfig.getProperty(propertyName);
+
+ }
+
+
+
+
+
+ private File getBundleProperties() {
+ return this.bundleFile = FileUtil.getWorkspaceFile("/" + getProject().getName() + "/" + filePath + ".properties"); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+}
diff --git a/plugins/editor/org.eclipse.papyrus.eclipse.project.editors/src/org/eclipse/papyrus/eclipse/project/editors/file/ClasspathEditor.java b/plugins/editor/org.eclipse.papyrus.eclipse.project.editors/src/org/eclipse/papyrus/eclipse/project/editors/file/ClasspathEditor.java
new file mode 100644
index 00000000000..e16d91c449f
--- /dev/null
+++ b/plugins/editor/org.eclipse.papyrus.eclipse.project.editors/src/org/eclipse/papyrus/eclipse/project/editors/file/ClasspathEditor.java
@@ -0,0 +1,261 @@
+/*****************************************************************************
+ * Copyright (c) 2011 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.eclipse.project.editors.file;
+
+
+import java.io.InputStream;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Set;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.AssertionFailedException;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.jdt.core.IAccessRule;
+import org.eclipse.jdt.core.IClasspathAttribute;
+import org.eclipse.jdt.core.IClasspathEntry;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.IPackageFragmentRoot;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jdt.internal.core.ClasspathEntry;
+import org.eclipse.papyrus.eclipse.project.editors.Activator;
+import org.eclipse.papyrus.eclipse.project.editors.interfaces.IClasspathEditor;
+
+/**
+ *
+ * The editor for the classpath file
+ *
+ */
+public class ClasspathEditor extends AbstractFileEditor implements IClasspathEditor {
+
+ /**
+ * the edited java project
+ */
+ private final IJavaProject javaProject;
+
+
+ /**
+ *
+ * Constructor.
+ *
+ * @param project
+ */
+ public ClasspathEditor(final IProject project) throws AssertionFailedException {
+ super(project);
+ this.javaProject = JavaCore.create(project);
+ }
+
+ /**
+ *
+ * Constructor.
+ *
+ * @param javaProject
+ * a java project
+ */
+ public ClasspathEditor(final IJavaProject javaProject) {
+ super(javaProject.getProject());
+ this.javaProject = javaProject;
+ }
+
+ @Override
+ public void init() {
+ // nothing to do here
+ }
+
+ /**
+ * save the modification
+ *
+ * @throws Throwable
+ */
+ public void save() {
+ try {
+ this.javaProject.save(new NullProgressMonitor(), true);
+ } catch (JavaModelException ex) {
+ Activator.log.error(ex);
+ }
+ }
+
+ /**
+ *
+ * @see org.eclipse.papyrus.eclipse.project.editors.interfaces.IClasspathEditor#addSourceFolderToClasspath(java.lang.String)
+ *
+ * {@inheritDoc}
+ */
+ public void addSourceFolderToClasspath(final String folderPath) {
+
+ if (exists() && !isSourceFolderRegistered(folderPath)) {
+
+ // parameters for the new ClasspathEntry
+ boolean isExported = false;
+ IPath[] exclusionPatterns = new IPath[0];
+ IPath sourceAttachmentPath = null;
+ IPath specificOutputLocation = null;
+ boolean combineAccessRules = false;
+ IClasspathAttribute[] extraAttributes = new IClasspathAttribute[0];
+ IPath sourceAttachmentRootPath = null;
+ IAccessRule[] accessRules = null;
+ int contentKind = IPackageFragmentRoot.K_SOURCE;
+ IPath[] inclusionPatterns = new IPath[0];
+ int entryKind = IClasspathEntry.CPE_SOURCE;
+ IPath path2 = new Path(folderPath);
+
+ IClasspathEntry[] classpathes = null;
+ try {
+ classpathes = this.javaProject.getRawClasspath();
+ } catch (JavaModelException e) {
+ e.printStackTrace();
+ }
+
+ IClasspathEntry[] entries = new IClasspathEntry[classpathes.length + 1];
+ for (int i = 0; i < classpathes.length; i++) {
+ entries[i] = classpathes[i];
+ }
+ entries[classpathes.length] = new ClasspathEntry(contentKind, entryKind, path2, inclusionPatterns, exclusionPatterns, sourceAttachmentPath, sourceAttachmentRootPath, specificOutputLocation, isExported, accessRules, combineAccessRules,
+ extraAttributes);
+ try {
+ this.javaProject.setRawClasspath(entries, new NullProgressMonitor());
+ } catch (JavaModelException e) {
+ Activator.log.error(e);
+ }
+ }
+ }
+
+ /**
+ *
+ * @see org.eclipse.papyrus.eclipse.project.editors.interfaces.IClasspathEditor#isSourceFolderRegistered(java.lang.String)
+ *
+ * {@inheritDoc}
+ */
+ public boolean isSourceFolderRegistered(final String folderPath) {
+ IClasspathEntry[] entries = null;
+ try {
+ entries = this.javaProject.getRawClasspath();
+ } catch (JavaModelException e) {
+ Activator.log.error(e);
+ }
+
+ for (int i = 0; i < entries.length; i++) {
+ IClasspathEntry entry = entries[i];
+ if (entry.getEntryKind() == IClasspathEntry.CPE_SOURCE) {
+ if (entry.getPath().equals(new Path(folderPath))) {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Tests if the classpath file exists
+ *
+ * @see org.eclipse.papyrus.eclipse.project.editors.project.AbstractProjectEditor.plugin.AbstractEditor#exists()
+ *
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean exists() {
+ IFile classpath = getProject().getFile(CLASSPATH_FILE);
+ return classpath.exists();
+ }
+
+ /**
+ *
+ * @see org.eclipse.papyrus.eclipse.project.editors.project.ProjectEditor#getMissingFiles()
+ *
+ * {@inheritDoc}
+ */
+ @Override
+ public Set<String> getMissingFiles() {
+ Set<String> files = super.getMissingFiles();
+ IFile classpath = getProject().getFile(CLASSPATH_FILE);
+ if (!classpath.exists()) {
+ files.add(CLASSPATH_FILE);
+ }
+ return files;
+ }
+
+ /**
+ *
+ * @see org.eclipse.papyrus.eclipse.project.editors.project.ProjectEditor#createFiles(Set)
+ *
+ * {@inheritDoc}
+ */
+ public void createFiles(final Set<String> files) {
+ if (files.contains(CLASSPATH_FILE)) {
+ IFile classpath = getProject().getFile(CLASSPATH_FILE);
+ if (!classpath.exists()) {
+ InputStream is = getInputStream("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + "<?eclipse version=\"3.4\"?>\n" + "<classpath>\n" + "</classpath>\n"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+
+ try {
+ classpath.create(is, true, null);
+ } catch (CoreException ex) {
+ Activator.log.error(ex);
+ }
+ }
+ }
+ }
+
+ public String[] getSourceFolders() {
+ List<String> sourceFolders = new LinkedList<String>();
+ IClasspathEntry[] entries = null;
+ try {
+ entries = this.javaProject.getRawClasspath();
+ } catch (JavaModelException e) {
+ Activator.log.error(e);
+ }
+
+ for (int i = 0; i < entries.length; i++) {
+ IClasspathEntry entry = entries[i];
+ if (entry.getEntryKind() == IClasspathEntry.CPE_SOURCE) {
+ sourceFolders.add(entry.getPath().makeRelativeTo(javaProject.getPath()).toString());
+ }
+ }
+
+ return sourceFolders.toArray(new String[sourceFolders.size()]);
+ }
+
+ public String[] getBinFolders() {
+ List<String> binFolders = new LinkedList<String>();
+ try {
+ // General bin folder
+ binFolders.add(javaProject.getOutputLocation().makeRelativeTo(javaProject.getPath()).toString());
+ } catch (JavaModelException ex) {
+ Activator.log.error(ex);
+ }
+ IClasspathEntry[] entries = null;
+ try {
+ entries = this.javaProject.getRawClasspath();
+ } catch (JavaModelException e) {
+ Activator.log.error(e);
+ }
+
+ for (int i = 0; i < entries.length; i++) {
+ IClasspathEntry entry = entries[i];
+ if (entry.getEntryKind() == IClasspathEntry.CPE_SOURCE) {
+ if (entry.getOutputLocation() != null) {
+ // Bin folder associated to each source folder
+ binFolders.add(entry.getOutputLocation().makeRelativeTo(javaProject.getPath()).toString());
+ }
+ }
+ }
+
+ return binFolders.toArray(new String[binFolders.size()]);
+ }
+}
diff --git a/plugins/editor/org.eclipse.papyrus.eclipse.project.editors/src/org/eclipse/papyrus/eclipse/project/editors/file/ManifestEditor.java b/plugins/editor/org.eclipse.papyrus.eclipse.project.editors/src/org/eclipse/papyrus/eclipse/project/editors/file/ManifestEditor.java
new file mode 100644
index 00000000000..91767d21074
--- /dev/null
+++ b/plugins/editor/org.eclipse.papyrus.eclipse.project.editors/src/org/eclipse/papyrus/eclipse/project/editors/file/ManifestEditor.java
@@ -0,0 +1,594 @@
+/*****************************************************************************
+ * Copyright (c) 2011 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.eclipse.project.editors.file;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.StringReader;
+import java.util.Set;
+import java.util.jar.Attributes;
+import java.util.jar.Attributes.Name;
+import java.util.jar.Manifest;
+
+import org.eclipse.core.resources.IContainer;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IFolder;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.papyrus.eclipse.project.editors.Activator;
+import org.eclipse.papyrus.eclipse.project.editors.interfaces.IManifestEditor;
+import org.eclipse.papyrus.eclipse.project.editors.project.ProjectEditor;
+
+public class ManifestEditor extends ProjectEditor implements IManifestEditor {
+
+ // string constants
+ private static final String CRNL = "\r\n"; //$NON-NLS-1$
+
+ private static final String CRNLSP = "\r\n "; //$NON-NLS-1$
+
+ private static final String SEMICOLON = ";"; //$NON-NLS-1$
+
+ private static final String COMMA = ","; //$NON-NLS-1$
+
+ private static final String ASSIGN = "="; //$NON-NLS-1$
+
+ private static final String BUNDLE_SYMBOLIC_NAME = "Bundle-SymbolicName"; //$NON-NLS-1$
+
+ private static final String IMPORT_PACKAGE = "Import-Package";
+
+ private static final String EXPORT_PACKAGE = "Export-Package";
+
+ private static final String SINGLETON = "singleton:="; //$NON-NLS-1$
+
+ /** the manifest file */
+ private IFile manifestFile;
+
+ /** the manifest itself */
+ private Manifest manifest;
+
+ /**
+ *
+ * Constructor.
+ *
+ * @param project
+ * @throws IOException
+ * @throws CoreException
+ */
+ public ManifestEditor(final IProject project) throws IOException, CoreException {
+ super(project);
+ }
+
+ /**
+ *
+ * @see org.eclipse.papyrus.eclipse.project.editors.interfaces.IManifestEditor#initOk()
+ *
+ * {@inheritDoc}
+ */
+ public boolean initOk() {
+ return manifest != null && manifestFile != null;
+ }
+
+ /**
+ *
+ * @see org.eclipse.papyrus.eclipse.project.editors.interfaces.IManifestEditor#addDependency(java.lang.String)
+ *
+ * {@inheritDoc}
+ */
+ public void addDependency(final String dependency) {
+ addDependency(dependency, null);
+ }
+
+ /**
+ *
+ * @see org.eclipse.papyrus.eclipse.project.editors.project.ProjectEditor#init()
+ *
+ * {@inheritDoc}
+ */
+ @Override
+ public void init() {
+ super.init();
+ if (manifest != null && manifestFile != null) {
+ return;
+ }
+ if (manifestFile == null) {
+ manifestFile = getManifestFile();
+ }
+ if (manifestFile != null) {
+ try {
+ manifest = new Manifest(manifestFile.getContents());
+ } catch (final IOException e) {
+ Activator.log.error(e);
+ // assure that exception is not silently captured (for users not examining the error log)
+ throw new RuntimeException(e);
+ } catch (final CoreException e) {
+ Activator.log.error(e);
+ // assure that exception is not silently captured (for users not examining the error log)
+ throw new RuntimeException(e);
+ }
+ }
+
+ }
+
+ /**
+ *
+ * @see org.eclipse.papyrus.eclipse.project.editors.interfaces.IManifestEditor#addDependency(java.lang.String, java.lang.String)
+ *
+ * {@inheritDoc}
+ */
+ public void addDependency(final String dependency, final String version) {
+ final Name rqBundle = new Name(REQUIRED_BUNDLE);
+ String requireBundle = manifest.getMainAttributes().getValue(rqBundle);
+
+ // TODO : Improve the detection of existing dependency
+ // If a.b.c exists, then a.b cannot be added (Because it is already contained)
+ // Moreover, the Manifest allows newlines anywhere (Including in the
+ // middle of a word) : check if these newlines appear in this map,
+ // or if they have already been parsed. If the manifest value is copied as-is in the map,
+ // then we need to take care of newlines when parsing it
+
+ if (requireBundle == null) {
+ requireBundle = dependency;
+
+ if (version != null) {
+ requireBundle += SEMICOLON + "bundle-version=\"" + version + "\"";
+ }
+ } else if (!requireBundle.contains(dependency)) {
+ requireBundle += COMMA + dependency;
+ // TODO: Update version
+ }
+
+ manifest.getMainAttributes().put(rqBundle, requireBundle);
+ }
+
+ /**
+ *
+ * @see org.eclipse.papyrus.eclipse.project.editors.interfaces.IManifestEditor#hasDependency(java.lang.String)
+ *
+ * {@inheritDoc}
+ */
+ public boolean hasDependency(final String dependency) {
+ final Name rqBundle = new Name(REQUIRED_BUNDLE);
+ String requireBundle = manifest.getMainAttributes().getValue(rqBundle);
+ return requireBundle != null && requireBundle.contains(dependency);
+ }
+
+ public void setDependenciesVersion(final String dependencyPattern, final String newVersion) {
+ final Name rqBundle = new Name(REQUIRED_BUNDLE);
+ final String requireBundles = manifest.getMainAttributes().getValue(rqBundle);
+ final String[] bundles = requireBundles.split(COMMA);
+ String newRequiredBundles = ""; //$NON-NLS-1$
+ for (int ii = 0; ii < bundles.length; ii++) {// we iterate on the declared dependencies
+ final String currentDependency = bundles[ii];
+ final String[] dependencyValue = currentDependency.split(SEMICOLON);
+ if (dependencyValue[0].contains(dependencyPattern)) {
+ final String newBundleVersion = BUNDLE_VERSION + ASSIGN + '"' + newVersion + '"';
+ newRequiredBundles += dependencyValue[0] + SEMICOLON + newBundleVersion;
+ for (int i = 1; i < dependencyValue.length; i++) {
+ final String declaration = dependencyValue[i];
+ if (declaration.contains(BUNDLE_VERSION + ASSIGN)) {
+ // we ignore it
+ } else {
+ newRequiredBundles += SEMICOLON + dependencyValue[i];// we add the others declaration
+ }
+ }
+ } else {
+ newRequiredBundles += currentDependency;// we copy the existing declaration
+ }
+ if (ii < bundles.length - 1) {
+ newRequiredBundles += COMMA;
+ }
+ }
+ setValue(REQUIRED_BUNDLE, newRequiredBundles);
+
+ }
+
+ /**
+ *
+ * @see org.eclipse.papyrus.eclipse.project.editors.interfaces.IManifestEditor#setValue(java.lang.String, java.lang.String)
+ *
+ * {@inheritDoc}
+ */
+ public void setValue(final String key, final String value) {
+ setValue(key, "", value); //$NON-NLS-1$
+ }
+
+ /**
+ *
+ * @see org.eclipse.papyrus.eclipse.project.editors.interfaces.IManifestEditor#setValue(java.lang.String, java.lang.String, java.lang.String)
+ *
+ * {@inheritDoc}
+ */
+ public void setValue(final String key, final String name, final String value) {
+ manifest.getMainAttributes().putValue(key, value);
+ // this.manifest.getAttributes(key).put(name, value);
+ }
+
+ /**
+ *
+ * @see org.eclipse.papyrus.eclipse.project.editors.interfaces.IManifestEditor#removeValue(java.lang.String, java.lang.String)
+ *
+ * {@inheritDoc}
+ */
+ public void removeValue(final String key, final String value) {
+
+ }
+
+ /**
+ *
+ * @see org.eclipse.papyrus.eclipse.project.editors.interfaces.IManifestEditor#removeValue(java.lang.String)
+ *
+ * {@inheritDoc}
+ */
+ public void removeValue(final String key) {
+ manifest.getAttributes(key).remove(key);
+ }
+
+ /**
+ *
+ * @return
+ */
+ private IFile getManifestFile() {
+ final IFile manifest = getProject().getFile("META-INF/MANIFEST.MF"); //$NON-NLS-1$
+ if (manifest.exists()) {
+ return manifest;
+ }
+ return null;
+ }
+
+ /**
+ *
+ * @see org.eclipse.papyrus.eclipse.project.editors.project.AbstractProjectEditor#exists()
+ *
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean exists() {
+ return super.exists() && getManifestFile() != null && getSymbolicBundleName() != null && getBundleVersion() != null;
+ }
+
+ /**
+ *
+ * @see org.eclipse.papyrus.eclipse.project.editors.project.ProjectEditor#save()
+ *
+ * {@inheritDoc}
+ */
+ @Override
+ public void save() {
+
+ final ByteArrayOutputStream os = new ByteArrayOutputStream();
+
+ try {
+ manifest.write(os);
+
+ final StringReader reader = new StringReader(format(os.toString("UTF-8"))); //$NON-NLS-1$
+ manifestFile.setContents(new InputStream() {
+
+ @Override
+ public int read() throws IOException {
+ return reader.read();
+ }
+ }, true, true, null);
+
+ } catch (final IOException ex) {
+ Activator.log.error(ex);
+ } catch (final CoreException ex) {
+ Activator.log.error(ex);
+ }
+ }
+
+ /**
+ * Simple formatting of the MANIFEST. Do not use the PDE formatter, since this makes an already opened
+ * MANIFEST editor dirty (see bug 447548 [OCL for Papyrus] Buggy DSML plugin generator)
+ */
+ protected String format(String text) {
+ // 1. undo 72safe formatting
+ String[] lines = text.split(CRNLSP);
+ String non72safe = ""; //$NON-NLS-1$
+ for (String line : lines) {
+ non72safe += line;
+ }
+ // 2. split lines on comma
+ lines = non72safe.split(COMMA);
+ String newText = ""; //$NON-NLS-1$
+ for (int i = 0; i < lines.length; i++) {
+ newText += lines[i].trim();
+ if (i < lines.length - 1) {
+ newText += COMMA + CRNLSP;
+ }
+ }
+ return newText + CRNL;
+ }
+
+ @Override
+ public Set<String> getMissingFiles() {
+ final Set<String> files = super.getMissingFiles();
+ final IFile classpath = getProject().getFile(MANIFEST_PATH);
+ if (!classpath.exists()) {
+ files.add(MANIFEST_PATH);
+ }
+ return files;
+ }
+
+ /**
+ *
+ * @see org.eclipse.papyrus.eclipse.project.editors.project.ProjectEditor#createFiles(java.util.Set)
+ *
+ * {@inheritDoc}
+ */
+ @Override
+ public void createFiles(final Set<String> files) {
+ if (files.contains(MANIFEST_PATH)) {
+ manifestFile = getProject().getFile(MANIFEST_PATH);
+ if (!manifestFile.exists()) {
+ try {
+ final String input = "Manifest-Version: 1.0\n"; //without the "/n", it doesn't work!!!!! //$NON-NLS-1$
+ if (!manifestFile.getParent().exists()) {
+ final IContainer parent = manifestFile.getParent();
+ if (parent instanceof IFolder) {
+ if (!parent.exists()) {
+ ((IFolder) parent).create(true, false, null);
+ }
+ }
+ }
+ manifestFile.create(getInputStream(input), true, null);
+ manifestFile = getProject().getFile(MANIFEST_PATH);
+
+ // final int i;
+ // InputStream is = this.manifestFile.getContents();
+ // while((i = is.read()) > 0) {
+ // System.out.println(i);
+ // }
+ // this.manifest = new Manifest(this.manifestFile.getContents());
+
+ } catch (final CoreException ex) {
+ Activator.log.error(ex);
+ }
+ }
+ }
+
+ try {
+ manifest = new Manifest(manifestFile.getContents());
+ } catch (IOException e) {
+ Activator.log.error(e);
+ } catch (CoreException e) {
+ Activator.log.error(e);
+ }
+
+ if (getSymbolicBundleName() == null) {
+ setSymbolicBundleName(getProject().getName());
+ }
+
+ if (getBundleVersion() == null) {
+ setBundleVersion("0.0.1"); //$NON-NLS-1$
+ }
+ }
+
+ /**
+ *
+ * @see org.eclipse.papyrus.eclipse.project.editors.interfaces.IManifestEditor#setSymbolicBundleName(java.lang.String)
+ *
+ * {@inheritDoc}
+ */
+ public void setSymbolicBundleName(String newName) {
+ if (newName == null) {
+ newName = "noName"; //$NON-NLS-1$
+ }
+ final Name symbolicName = new Name(BUNDLE_SYMBOLIC_NAME);
+ manifest.getMainAttributes().put(symbolicName, newName);
+ }
+
+ /**
+ *
+ * @see org.eclipse.papyrus.eclipse.project.editors.interfaces.IManifestEditor#getSymbolicBundleName()
+ *
+ * {@inheritDoc}
+ */
+ public String getSymbolicBundleName() {
+ if (manifest != null) {
+ final Name symbolicName = new Name(BUNDLE_SYMBOLIC_NAME);
+ final String name = manifest.getMainAttributes().getValue(symbolicName);
+
+ if (name != null) {
+ int semiColon = name.indexOf(SEMICOLON);
+ return semiColon != -1 ? name.substring(0, semiColon) : name;
+ }
+ }
+
+ return null;
+ }
+
+ /**
+ *
+ * @see org.eclipse.papyrus.eclipse.project.editors.interfaces.IManifestEditor#getBundleVersion()
+ *
+ * {@inheritDoc}
+ */
+ public String getBundleVersion() {
+ if (manifest != null) {
+ final Name symbolicName = new Name(BUNDLE_VERSION);
+ final String version = manifest.getMainAttributes().getValue(symbolicName);
+ return version;
+ }
+ return null;
+ }
+
+ /**
+ * @see org.eclipse.papyrus.eclipse.project.editors.interfaces.IManifestEditor#setBundleVersion(java.lang.String)
+ *
+ * {@inheritDoc}
+ */
+ public void setBundleVersion(final String version) {
+ if (manifest != null) {
+ final Name bundleVersion = new Name(BUNDLE_VERSION);
+ if (version == null) {
+ manifest.getMainAttributes().remove(bundleVersion);
+ } else {
+ manifest.getMainAttributes().put(bundleVersion, version);
+ }
+ }
+ }
+
+ /**
+ * @see org.eclipse.papyrus.eclipse.project.editors.interfaces.IManifestEditor#getBundleVendor()
+ *
+ * {@inheritDoc}
+ */
+ public String getBundleVendor() {
+ if (manifest != null) {
+ final Name bundleVendor = new Name(BUNDLE_VENDOR);
+ return manifest.getMainAttributes().getValue(bundleVendor);
+ }
+ return null;
+ }
+
+ /**
+ * @see org.eclipse.papyrus.eclipse.project.editors.interfaces.IManifestEditor#setBundleVendor(java.lang.String)
+ *
+ * {@inheritDoc}
+ */
+ public void setBundleVendor(final String vendor) {
+ if (manifest != null) {
+ final Name bundleVendor = new Name(BUNDLE_VENDOR);
+ if (vendor == null) {
+ manifest.getMainAttributes().remove(bundleVendor);
+ } else {
+ manifest.getMainAttributes().put(bundleVendor, vendor);
+ }
+ }
+ }
+
+ public String getValue(final String key) {
+ if (manifest != null) {
+ String value = manifest.getMainAttributes().getValue(key);
+ if (value == null) {
+ final Attributes attributes = manifest.getAttributes(key);
+ if (attributes != null) {
+ value = attributes.getValue(key);
+ }
+ }
+ return value;
+ }
+ return null;
+ }
+
+ public String getBundleName() {
+ if (manifest != null) {
+ final Name bundleName = new Name(BUNDLE_NAME);
+ final String name = manifest.getMainAttributes().getValue(bundleName);
+ return name;
+ }
+ return null;
+ }
+
+ public void setBundleName(String newName) {
+ if (newName == null) {
+ newName = "noName"; //$NON-NLS-1$
+ }
+ final Name bundleNameName = new Name(BUNDLE_NAME);
+ manifest.getMainAttributes().put(bundleNameName, newName);
+ }
+
+ public String getBundleLocalization() {
+ if (manifest != null) {
+ final Name bundleLocalization = new Name(BUNDLE_LOCALIZATION);
+ final String name = manifest.getMainAttributes().getValue(bundleLocalization);
+ return name;
+ }
+ return null;
+ }
+
+ public void setSingleton(final boolean singleton) {
+ String value = manifest.getMainAttributes().getValue(BUNDLE_SYMBOLIC_NAME);
+ final String[] directives = value.split(SEMICOLON);
+
+ if (directives.length == 0) {
+ return; // This should not happen if the Manifest is well-formed
+ } else {
+ value = directives[0];
+ boolean isDefined = false;
+ for (int i = 1; i < directives.length; i++) {
+ String directive = directives[i];
+ if (directive.startsWith(SINGLETON)) {
+ directive = SINGLETON + singleton;
+ isDefined = true;
+ }
+ value += SEMICOLON + directive;
+ }
+ if (!isDefined) {
+ value += SEMICOLON + SINGLETON + singleton;
+ }
+ }
+
+ manifest.getMainAttributes().putValue(BUNDLE_SYMBOLIC_NAME, value);
+ }
+
+ /**
+ * @see org.eclipse.papyrus.eclipse.project.editors.interfaces.IManifestEditor#addImportPackage(java.lang.String)
+ *
+ * @param packageName
+ */
+ public void addImportPackage(String packageName) {
+ addImportPackage(packageName, null);
+ }
+
+ public void addImportPackage(String packageName, String version) {
+ addPackage(packageName, IMPORT_PACKAGE, version);
+ }
+
+ /**
+ * @see org.eclipse.papyrus.eclipse.project.editors.interfaces.IManifestEditor#addExportPackage(java.lang.String)
+ *
+ * @param packageName
+ */
+ public void addExportPackage(String packageName) {
+ addExportPackage(packageName, null);
+ }
+
+ /**
+ *
+ * @see org.eclipse.papyrus.eclipse.project.editors.interfaces.IManifestEditor#addExportPackage(java.lang.String, java.lang.String)
+ *
+ * @param packageName
+ * @param version
+ */
+ public void addExportPackage(String packageName, String version) {
+ addPackage(packageName, EXPORT_PACKAGE, version);
+ }
+
+ /**
+ * Adds a package name in a manifest header type.
+ *
+ * @param packageName the package name to add
+ * @param type IMPORT_PACKAGE or EXPORT_PACKAGE
+ */
+ private void addPackage(String packageName, String type, String version) {
+ final Name manifestHeader = new Name(type);
+ String manifestHeaderValue = manifest.getMainAttributes().getValue(manifestHeader);
+
+ // TODO: Same as addDependency(final String, final String) : Improve the detection of existing packages
+
+ if (manifestHeaderValue == null) {
+ manifestHeaderValue = packageName;
+
+ if (version != null) {
+ manifestHeaderValue += SEMICOLON + "version=\"" + version + "\"";
+ }
+ } else if (!manifestHeaderValue.contains(packageName)) {
+ manifestHeaderValue += COMMA + packageName;
+
+ // TODO: Update version
+ }
+
+ manifest.getMainAttributes().put(manifestHeader, manifestHeaderValue);
+ }
+}
diff --git a/plugins/editor/org.eclipse.papyrus.eclipse.project.editors/src/org/eclipse/papyrus/eclipse/project/editors/interfaces/IBuildEditor.java b/plugins/editor/org.eclipse.papyrus.eclipse.project.editors/src/org/eclipse/papyrus/eclipse/project/editors/interfaces/IBuildEditor.java
new file mode 100644
index 00000000000..960e018af6e
--- /dev/null
+++ b/plugins/editor/org.eclipse.papyrus.eclipse.project.editors/src/org/eclipse/papyrus/eclipse/project/editors/interfaces/IBuildEditor.java
@@ -0,0 +1,98 @@
+/*****************************************************************************
+ * Copyright (c) 2011 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.eclipse.project.editors.interfaces;
+
+/**
+ *
+ * Editor for the build.properties
+ *
+ */
+public interface IBuildEditor extends IFileEditor {
+
+ /**
+ * key for the bin
+ *
+ * @Deprecated The build key should be specified for each IBuildEditor instance
+ */
+ @Deprecated
+ public final static String BUILD_KEY = "bin.includes"; //$NON-NLS-1$
+
+ /** key for the source folders */
+ public final static String SOURCE_FOLDER_KEY = "source.."; //$NON-NLS-1$
+
+ /** key for the bin folders */
+ public static final String BIN_KEY = "bin.."; //$NON-NLS-1$
+
+ /** name of the file build.properties */
+ public static final String BUILD_PROPERTIES_FILE = "build.properties"; //$NON-NLS-1$
+
+ /**
+ * The build key for the Eclipse Binary Build
+ */
+ public static final String BINARY_BUILD = "bin.includes";
+
+ /**
+ * The build key for the Eclipse Source Build
+ */
+ public static final String SOURCE_BUILD = "src.includes";
+
+ /** the method to register a new source folder */
+ public void registerSourceFolder(String string);
+
+ /** registers a new bin folder */
+ public void registerBinFolder(String binFolder);
+
+ /** the method to add an element to the build */
+ public void addToBuild(final String path);
+
+ /** removes the given path from the build */
+ public void removeFromBuild(final String path);
+
+ /**
+ * Returns <code>true</code> if the folder is registered as a Source Folder
+ *
+ * @param path
+ * the path of a source folder
+ * @return
+ * <code>true</code> if the folder is registered
+ */
+ public boolean isRegisteredSourceFolder(final String path);
+
+ /**
+ * Returns <code>true</code> if the folder is registered as a Bin Folder
+ *
+ * @param path
+ * the path of a bin folder
+ * @return
+ * <code>true</code> if the folder is registered
+ */
+ public boolean isRegisteredBinFolder(final String binFolder);
+
+ /**
+ * Returns all the registered source folders
+ *
+ * @return
+ * all the registered source folders
+ */
+ public String[] getSourceFolders();
+
+ /**
+ * Returns all the files added to the build
+ *
+ * @return
+ * all the files added to the build
+ */
+ public String[] getElementsInBuild();
+}
diff --git a/plugins/editor/org.eclipse.papyrus.eclipse.project.editors/src/org/eclipse/papyrus/eclipse/project/editors/interfaces/IClasspathEditor.java b/plugins/editor/org.eclipse.papyrus.eclipse.project.editors/src/org/eclipse/papyrus/eclipse/project/editors/interfaces/IClasspathEditor.java
new file mode 100644
index 00000000000..e8921a045a1
--- /dev/null
+++ b/plugins/editor/org.eclipse.papyrus.eclipse.project.editors/src/org/eclipse/papyrus/eclipse/project/editors/interfaces/IClasspathEditor.java
@@ -0,0 +1,56 @@
+/*****************************************************************************
+ * Copyright (c) 2011 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.eclipse.project.editors.interfaces;
+
+
+/**
+ *
+ * This interface for the file .classpath
+ *
+ */
+public interface IClasspathEditor extends IFileEditor {
+
+ /** the classpath file */
+ public static final String CLASSPATH_FILE = ".classpath"; //$NON-NLS-1$
+
+ /**
+ * add a source folder to the class path
+ *
+ * @param folderPath
+ */
+ public void addSourceFolderToClasspath(final String folderPath);
+
+ /**
+ * Tests if a folder is already registered in the classpath
+ *
+ * @param folderPath
+ * a folder path
+ * @return
+ * <code>true</code> if the folderPath is already registered
+ */
+ public boolean isSourceFolderRegistered(final String folderPath);
+
+ /**
+ *
+ * @return the source folders for this classpath
+ */
+ public String[] getSourceFolders();
+
+ /**
+ *
+ * @return the bin folders for this classpath
+ */
+ public String[] getBinFolders();
+}
diff --git a/plugins/editor/org.eclipse.papyrus.eclipse.project.editors/src/org/eclipse/papyrus/eclipse/project/editors/interfaces/IFeatureProjectEditor.java b/plugins/editor/org.eclipse.papyrus.eclipse.project.editors/src/org/eclipse/papyrus/eclipse/project/editors/interfaces/IFeatureProjectEditor.java
new file mode 100644
index 00000000000..f3ebd669f0e
--- /dev/null
+++ b/plugins/editor/org.eclipse.papyrus.eclipse.project.editors/src/org/eclipse/papyrus/eclipse/project/editors/interfaces/IFeatureProjectEditor.java
@@ -0,0 +1,106 @@
+package org.eclipse.papyrus.eclipse.project.editors.interfaces;
+
+import java.util.Set;
+
+import org.w3c.dom.Document;
+
+public interface IFeatureProjectEditor {
+
+ void init();
+
+ void save();
+
+ void createFiles(final Set<String> files);
+
+ /**
+ * Retrieves the feature.xml XML Document associated to this project.
+ *
+ * @return The XML Document associated to this feature.xml file
+ */
+ Document getDocument();
+
+ /**
+ * Gets the feature's id.
+ *
+ * @return the feature's id
+ */
+ String getId();
+
+ /**
+ * Gets the feature's label.
+ *
+ * @return the feature's label
+ */
+ String getLabel();
+
+ /**
+ * Gets the feature's version.
+ *
+ * @return the feature's version
+ */
+ String getVersion();
+
+ /**
+ * Gets the feature's provider name.
+ *
+ * @return the feature's provider name
+ */
+ String getProviderName();
+
+ /**
+ * Gets the operating system of the feature
+ * @return
+ */
+ String getOS();
+
+ String getWS();
+
+ String getNL();
+
+ String getArch();
+
+ String getDescriptionText();
+
+ String getDescriptionURL();
+
+ String getCopyrightText();
+
+ String getCopyrightURL();
+
+ String getLicenseText();
+
+ String getLicenceURL();
+
+ void setId(final String id);
+
+ void setLabel(final String label);
+
+ void setVersion(final String version);
+
+ void setProviderName(final String providerName);
+
+ void setOS(final String os);
+
+ void setWS(final String ws);
+
+ void setNL(final String nl);
+
+ void setArch(final String arch);
+
+ void setDescription(final String descriptionURL, final String descriptionDesc);
+
+ void setCopyright(final String copyrightURL, final String copyrightDesc);
+
+ void setLicense(final String licenseURL, final String licenseDesc);
+
+ void setUpdateURL(final String urlLabel, final String url);
+
+ void addPlugin(final String pluginName);
+
+ void addRequiredFeature(final String featureName, final String version);
+
+ void addRequiredPlugin(String pluginName);
+
+ void addInclude(String featureName, String version);
+
+}
diff --git a/plugins/editor/org.eclipse.papyrus.eclipse.project.editors/src/org/eclipse/papyrus/eclipse/project/editors/interfaces/IFileEditor.java b/plugins/editor/org.eclipse.papyrus.eclipse.project.editors/src/org/eclipse/papyrus/eclipse/project/editors/interfaces/IFileEditor.java
new file mode 100644
index 00000000000..89879fcba2f
--- /dev/null
+++ b/plugins/editor/org.eclipse.papyrus.eclipse.project.editors/src/org/eclipse/papyrus/eclipse/project/editors/interfaces/IFileEditor.java
@@ -0,0 +1,66 @@
+/*****************************************************************************
+ * Copyright (c) 2011 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.eclipse.project.editors.interfaces;
+
+import java.util.Set;
+
+import org.eclipse.core.resources.IProject;
+
+/**
+ *
+ * Interface to edit file
+ *
+ */
+public interface IFileEditor {
+
+ /** test if all the required elements exist for the editor */
+ public boolean exists();
+
+
+ /** create the required elements for the editor */
+ public abstract void create();
+
+ /**
+ * a method to initialize the field of the editors
+ * This method should be called by the programmer AFTER the construciton of the element
+ */
+ public abstract void init();
+
+ /**
+ *
+ * @return
+ * the missing files for the project
+ */
+ public Set<String> getMissingFiles();
+
+ /**
+ *
+ * @param files
+ * create the required files
+ */
+ public void createFiles(final Set<String> files);
+
+
+ // TODO : Remove that "Throwable" exception...
+ /** save the modification on the editor */
+ public void save();
+
+ /**
+ *
+ * @return
+ * the eclipse project
+ */
+ public IProject getProject();
+
+}
diff --git a/plugins/editor/org.eclipse.papyrus.eclipse.project.editors/src/org/eclipse/papyrus/eclipse/project/editors/interfaces/IJavaProjectEditor.java b/plugins/editor/org.eclipse.papyrus.eclipse.project.editors/src/org/eclipse/papyrus/eclipse/project/editors/interfaces/IJavaProjectEditor.java
new file mode 100644
index 00000000000..6a470f16208
--- /dev/null
+++ b/plugins/editor/org.eclipse.papyrus.eclipse.project.editors/src/org/eclipse/papyrus/eclipse/project/editors/interfaces/IJavaProjectEditor.java
@@ -0,0 +1,52 @@
+/*****************************************************************************
+ * Copyright (c) 2011 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.eclipse.project.editors.interfaces;
+
+/**
+ *
+ * Editor for the java project
+ *
+ */
+public interface IJavaProjectEditor extends IBuildEditor {
+
+ /** The java nature */
+ public static final String JAVA_NATURE = "org.eclipse.jdt.core.javanature"; //$NON-NLS-1$
+
+ /** the build command for the java project */
+ public static final String JAVA_BUILD_COMMAND = "org.eclipse.jdt.core.javabuilder"; //$NON-NLS-1$
+
+ /**
+ * Add a new java source folder in the .classpath and in the build.properties
+ *
+ * @param path
+ * the path of the java source folder
+ */
+ public void addJavaSourceFolder(final String path);
+
+ /**
+ * Gets the classpath editor.
+ *
+ * @return the classpath editor
+ */
+ public IClasspathEditor getClasspathEditor();
+
+
+ /**
+ * Gets the builds the editor.
+ *
+ * @return the builds the editor
+ */
+ public IBuildEditor getBuildEditor();
+
+}
diff --git a/plugins/editor/org.eclipse.papyrus.eclipse.project.editors/src/org/eclipse/papyrus/eclipse/project/editors/interfaces/IManifestEditor.java b/plugins/editor/org.eclipse.papyrus.eclipse.project.editors/src/org/eclipse/papyrus/eclipse/project/editors/interfaces/IManifestEditor.java
new file mode 100644
index 00000000000..7ffb9f48d01
--- /dev/null
+++ b/plugins/editor/org.eclipse.papyrus.eclipse.project.editors/src/org/eclipse/papyrus/eclipse/project/editors/interfaces/IManifestEditor.java
@@ -0,0 +1,229 @@
+/*****************************************************************************
+ * Copyright (c) 2011 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.eclipse.project.editors.interfaces;
+
+
+
+/**
+ *
+ * Editor for the Manifest
+ *
+ */
+public interface IManifestEditor extends IProjectEditor, IFileEditor {
+
+ /** the path for the manifest file */
+ public static final String MANIFEST_PATH = "META-INF/MANIFEST.MF"; //$NON-NLS-1$
+
+ /** the path for the META-INF folder */
+ public static final String META_INF_PATH = "META-INF/"; //$NON-NLS-1$
+
+ /** the key for the bundle symbolic name */
+ public static final String BUNDLE_SYMBOLIC_NAME = "Bundle-SymbolicName"; //$NON-NLS-1$
+
+ /** the key for the bundle name */
+ public static final String BUNDLE_NAME = "Bundle-Name";//$NON-NLS-1$
+
+ /** the key for the required bundle */
+ public static final String REQUIRED_BUNDLE = "Require-Bundle"; //$NON-NLS-1$
+
+ /** the key for the bundle version */
+ public static final String BUNDLE_VERSION = "Bundle-Version"; //$NON-NLS-1$
+
+ /** the key for the bundle vendor */
+ public static final String BUNDLE_VENDOR = "Bundle-Vendor"; //$NON-NLS-1$
+
+ /** the build command for the manifest */
+ public static final String MANIFEST_BUILD_COMMAND = "org.eclipse.pde.ManifestBuilder"; //$NON-NLS-1$
+
+ /** the key for the bundle localization */
+ public static final String BUNDLE_LOCALIZATION = "Bundle-Localization"; //$NON-NLS-1$
+
+ /**
+ * Add a dependency to the MANIFEST
+ * @param dependency
+ * the dependency to add
+ */
+ public void addDependency(final String dependency);
+
+ /**
+ * Add a specific version of a dependency to the MANIFEST
+ *
+ * @param dependency
+ * the dependency to add
+ * @param version
+ * the version of the dependency
+ */
+ public void addDependency(final String dependency, final String version);
+
+ /**
+ * Check whether a dependency is already present in the MANIFEST
+ *
+ * @param dependency
+ * the dependency to check
+ */
+ public boolean hasDependency(final String dependency);
+
+ /**
+ *
+ * @param key
+ * the key
+ * @param value
+ * the new value for the key
+ */
+ public void setValue(final String key, final String value);
+
+ public String getValue(final String key);
+
+ /**
+ *
+ * @param key
+ * the key
+ * @param name
+ * the name
+ * @param value
+ * the new value for the key
+ */
+ public void setValue(final String key, final String name, final String value);
+
+ /**
+ *
+ * @param key
+ * the key
+ * @param value
+ * the value to remove for this key
+ */
+ public void removeValue(final String key, final String value);
+
+ /**
+ *
+ * @param key
+ * a key to remove from the manifest
+ *
+ */
+ public void removeValue(final String key);
+
+ /**
+ *
+ * @param name
+ * the symbolic name for the bundle
+ */
+ public void setSymbolicBundleName(final String name);
+
+
+ /**
+ *
+ * @return
+ * the bundle name for the project
+ */
+ public String getSymbolicBundleName();
+
+ /**
+ *
+ * @return
+ * the symbolic bundle name for the project
+ */
+ public String getBundleName();
+
+ /**
+ *
+ * @param name
+ * the bundle name for the bundle
+ */
+ public void setBundleName(final String name);
+
+ /**
+ *
+ * @return
+ * the version of the bundle
+ */
+ public String getBundleVersion();
+
+ /**
+ * Set the version of the bundle
+ */
+ public void setBundleVersion(final String version);
+
+ /**
+ * Gets this plug-in's provider
+ *
+ * @return
+ * this plug-in's provider
+ */
+ public String getBundleVendor();
+
+ /**
+ * Sets this plug-in's provider
+ *
+ * @param vendor
+ * this plug-in's provider
+ */
+ public void setBundleVendor(final String vendor);
+
+ /**
+ * Get the bundle localization
+ *
+ * @return
+ * the bundle localization
+ */
+ public String getBundleLocalization();
+
+ /**
+ * Sets the Manifest's singleton directive
+ *
+ * @param singleton
+ * Whether this plug-in should be a singleton
+ */
+ public void setSingleton(boolean singleton);
+
+ /**
+ *
+ * @param dependencyPattern
+ * the pattern for the dependency to update
+ * @param newVersion
+ * the version for the dependency
+ */
+ public void setDependenciesVersion(final String dependencyPattern, final String newVersion);
+
+ /**
+ * Adds an import package to the MANIFEST.
+ *
+ * @param packageName the package name to add
+ */
+ public void addImportPackage(String packageName);
+
+ /**
+ * Adds an import package and its version to the MANIFEST.
+ *
+ * @param packageName the package name to add
+ * @param version the package version
+ */
+ public void addImportPackage(String packageName, String version);
+
+ /**
+ * Adds an export package to the MANFIEST.
+ *
+ * @param packageName the package name to add
+ */
+ public void addExportPackage(String packageName);
+
+ /**
+ * Adds an export package and its version to the MANIFEST.
+ *
+ * @param packageName the package name to add
+ * @param version the package version
+ */
+ public void addExportPackage(String packageName, String version);
+
+}
diff --git a/plugins/editor/org.eclipse.papyrus.eclipse.project.editors/src/org/eclipse/papyrus/eclipse/project/editors/interfaces/IPluginProjectEditor.java b/plugins/editor/org.eclipse.papyrus.eclipse.project.editors/src/org/eclipse/papyrus/eclipse/project/editors/interfaces/IPluginProjectEditor.java
new file mode 100644
index 00000000000..085ad042945
--- /dev/null
+++ b/plugins/editor/org.eclipse.papyrus.eclipse.project.editors/src/org/eclipse/papyrus/eclipse/project/editors/interfaces/IPluginProjectEditor.java
@@ -0,0 +1,58 @@
+/*****************************************************************************
+ * Copyright (c) 2011 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.eclipse.project.editors.interfaces;
+
+import java.util.List;
+
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+
+/**
+ *
+ * Editor for the file plugin.xml
+ *
+ */
+public interface IPluginProjectEditor extends IProjectEditor, IFileEditor {
+
+ /** the node extension */
+ public static final String EXTENSION = "extension"; //$NON-NLS-1$
+
+ /** the attribute point */
+ public static final String POINT = "point"; //$NON-NLS-1$
+
+ /** the name of the file plugin.xml */
+ public static final String PLUGIN_XML_FILE = "plugin.xml"; //$NON-NLS-1$
+
+ /** the plugin nature */
+ public static final String PLUGIN_NATURE = "org.eclipse.pde.PluginNature"; //$NON-NLS-1$
+
+ /** the plugin build command */
+ public static final String PLUGIN_BUILD_COMMAND = "org.eclipse.pde.SchemaBuilder"; //$NON-NLS-1$
+
+ /** the method to add an extension to the plugin */
+ public Element addExtension(final String extensionPoint);
+
+ /** the method to get all the extensions of the type extensionPoint */
+ public List<Node> getExtensions(final String extensionPoint);
+
+ /** the method to set an attribute to an element */
+ public void setAttribute(final Element element, final String attributeName, final String attributeValue);
+
+ /** the method to add a child to an element */
+ public Element addChild(final Element element, final String childName);
+
+ /** the method to retrieve the plugin.xml XML Document associated to this project */
+ public Document getDocument();
+}
diff --git a/plugins/editor/org.eclipse.papyrus.eclipse.project.editors/src/org/eclipse/papyrus/eclipse/project/editors/interfaces/IProjectEditor.java b/plugins/editor/org.eclipse.papyrus.eclipse.project.editors/src/org/eclipse/papyrus/eclipse/project/editors/interfaces/IProjectEditor.java
new file mode 100644
index 00000000000..233c679d40a
--- /dev/null
+++ b/plugins/editor/org.eclipse.papyrus.eclipse.project.editors/src/org/eclipse/papyrus/eclipse/project/editors/interfaces/IProjectEditor.java
@@ -0,0 +1,93 @@
+/*****************************************************************************
+ * Copyright (c) 2011 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.eclipse.project.editors.interfaces;
+
+import java.net.URL;
+import java.util.Set;
+
+/**
+ *
+ * This interface defines the methods for the ProjectEditor
+ *
+ */
+public interface IProjectEditor extends IFileEditor {
+
+ /** the node buildSpec */
+ public static final String BUILD_SPEC = "buildSpec"; //$NON-NLS-1$
+
+ /** the node comment */
+ public static final String COMMENT = "comment"; //$NON-NLS-1$
+
+ /** the node name */
+ public static final String NAME = "name"; //$NON-NLS-1$
+
+ /** the node nature */
+ public static final String NATURE = "nature"; //$NON-NLS-1$
+
+ /** the node project description */
+ public static final String PROJECT_DESCRIPTION = "projectDescription"; //$NON-NLS-1$
+
+ /** the name of the project file */
+ public static final String PROJECT_FILE = ".project"; //$NON-NLS-1$
+
+
+
+ /**
+ *
+ * @return
+ * the missing nature for the project
+ */
+ public Set<String> getMissingNature();
+
+ /**
+ *
+ * @param nature
+ * a nature
+ * @return
+ * <code>true</code> if the project has this nature
+ */
+ public boolean hasNature(final String nature);
+
+ /**
+ *
+ * @return
+ * the missing build command
+ */
+ public Set<String> getMissingBuildCommand();
+
+ /**
+ *
+ * @param commands
+ * the command to add
+ */
+ public void addBuildCommands(Set<String> commands);
+
+ /**
+ *
+ * @param command
+ * a build command
+ * @return
+ * <code>true</code> if the project has the build command
+ */
+ public boolean hasBuildCommand(String command);
+
+ /**
+ *
+ * @param url
+ * the url of the file to copy
+ * @param fileDestinationPath
+ * the destination path for the added file
+ */
+ public void addFile(final URL url, final String fileDestinationPath, final boolean eraseExistingFile);
+}
diff --git a/plugins/editor/org.eclipse.papyrus.eclipse.project.editors/src/org/eclipse/papyrus/eclipse/project/editors/project/AbstractProjectEditor.java b/plugins/editor/org.eclipse.papyrus.eclipse.project.editors/src/org/eclipse/papyrus/eclipse/project/editors/project/AbstractProjectEditor.java
new file mode 100644
index 00000000000..e01a43355b0
--- /dev/null
+++ b/plugins/editor/org.eclipse.papyrus.eclipse.project.editors/src/org/eclipse/papyrus/eclipse/project/editors/project/AbstractProjectEditor.java
@@ -0,0 +1,195 @@
+/*****************************************************************************
+ * Copyright (c) 2011 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.eclipse.project.editors.project;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Set;
+
+import org.eclipse.core.internal.events.BuildCommand;
+import org.eclipse.core.resources.ICommand;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IProjectDescription;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.papyrus.eclipse.project.editors.Activator;
+import org.eclipse.papyrus.eclipse.project.editors.file.AbstractFileEditor;
+import org.eclipse.papyrus.eclipse.project.editors.interfaces.IProjectEditor;
+
+/**
+ *
+ * This class provides useful method for project editor
+ *
+ */
+public abstract class AbstractProjectEditor extends AbstractFileEditor implements IProjectEditor {
+
+
+ /** the header for XML files */
+ public static final String XML_HEADER = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"; //$NON-NLS-1$
+
+ /**
+ * the project description
+ */
+ private final IProjectDescription description;
+
+ /**
+ *
+ * Constructor.
+ *
+ * @param project
+ * the eclipse project
+ * @throws CoreException
+ */
+ public AbstractProjectEditor(final IProject project) throws CoreException {
+ super(project);
+ this.description = getProject().getDescription();
+ }
+
+
+ /**
+ *
+ * @see org.eclipse.papyrus.eclipse.project.editors.project.AbstractProjectEditor.plugin.AbstractEditor#exists()
+ *
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean exists() {
+ return super.exists() && getMissingNature().size() == 0 && getMissingBuildCommand().size() == 0;
+ }
+
+ /**
+ *
+ * @see org.eclipse.papyrus.eclipse.project.editors.file.AbstractFileEditor#create()
+ *
+ * {@inheritDoc}
+ */
+ @Override
+ public void create() {
+ createFiles(getMissingFiles());
+ addNatures(getMissingNature());
+ addBuildCommands(getMissingBuildCommand());
+ init();
+ }
+
+ /**
+ *
+ * @param nature
+ * a nature
+ * @return
+ * <code>true</code> if the project has the wanted nature
+ */
+ public boolean hasNature(final String nature) {
+ List<String> natures = new LinkedList<String>(Arrays.asList(this.description.getNatureIds()));
+ return natures.contains(nature);
+ }
+
+ /**
+ *
+ * @see org.eclipse.papyrus.eclipse.project.editors.interfaces.IProjectEditor#getMissingNature()
+ *
+ * {@inheritDoc}
+ */
+ public Set<String> getMissingNature() {
+ return new HashSet<String>();
+ }
+
+ /**
+ *
+ * @see org.eclipse.papyrus.eclipse.project.editors.interfaces.IProjectEditor#addNatures(java.util.List)
+ *
+ * {@inheritDoc}
+ */
+ public void addNatures(final Set<String> natures) {
+ List<String> existingNatures = new LinkedList<String>(Arrays.asList(this.description.getNatureIds()));
+ Iterator<String> iter = natures.iterator();
+ while (iter.hasNext()) {
+ String nature = iter.next();
+ if (!existingNatures.contains(nature)) {
+ existingNatures.add(nature);
+ }
+ }
+ this.description.setNatureIds(existingNatures.toArray(new String[existingNatures.size()]));
+ }
+
+ /**
+ *
+ * @see org.eclipse.papyrus.eclipse.project.editors.project.AbstractProjectEditor#hasBuildCommand(java.lang.String)
+ *
+ * {@inheritDoc}
+ */
+ public boolean hasBuildCommand(final String command) {
+ ICommand[] buildSpec = this.description.getBuildSpec();
+ for (int i = 0; i < buildSpec.length; i++) {
+ if (buildSpec[i].getBuilderName().equals(command)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ *
+ * @see org.eclipse.papyrus.eclipse.project.editors.project.AbstractProjectEditor#addBuildCommands(java.util.Set)
+ *
+ * {@inheritDoc}
+ */
+ public void addBuildCommands(final Set<String> commands) {
+ ICommand[] buildSpec = this.description.getBuildSpec();
+
+ List<ICommand> buildSpecList = new ArrayList<ICommand>();
+ buildSpecList.addAll(Arrays.asList(buildSpec));
+
+ Iterator<String> iter = commands.iterator();
+ while (iter.hasNext()) {
+ String name = iter.next();
+ if (!hasBuildCommand(name)) {
+ ICommand cmd = new BuildCommand();
+ cmd.setBuilderName(name);
+ buildSpecList.add(cmd);
+ }
+ }
+ this.description.setBuildSpec(buildSpecList.toArray(new ICommand[buildSpecList.size()]));
+ }
+
+ /**
+ *
+ * @throws Throwable
+ * @see org.eclipse.papyrus.eclipse.project.editors.interfaces.IProjectEditor#save()
+ *
+ * {@inheritDoc}
+ */
+ public void save() {
+ if (this.description != null) {
+ try {
+ getProject().setDescription(this.description, null);
+ } catch (CoreException e) {
+ Activator.log.error(e);
+ }
+ }
+ }
+
+ /**
+ *
+ * @see org.eclipse.papyrus.eclipse.project.editors.interfaces.IProjectEditor#getMissingBuildCommand()
+ *
+ * {@inheritDoc}
+ */
+ public Set<String> getMissingBuildCommand() {
+ return new HashSet<String>();
+ }
+
+}
diff --git a/plugins/editor/org.eclipse.papyrus.eclipse.project.editors/src/org/eclipse/papyrus/eclipse/project/editors/project/FeatureProjectEditor.java b/plugins/editor/org.eclipse.papyrus.eclipse.project.editors/src/org/eclipse/papyrus/eclipse/project/editors/project/FeatureProjectEditor.java
new file mode 100644
index 00000000000..9a828ba2622
--- /dev/null
+++ b/plugins/editor/org.eclipse.papyrus.eclipse.project.editors/src/org/eclipse/papyrus/eclipse/project/editors/project/FeatureProjectEditor.java
@@ -0,0 +1,552 @@
+/*****************************************************************************
+ * Copyright (c) 2011 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.eclipse.project.editors.project;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.StringWriter;
+import java.util.Collections;
+import java.util.Properties;
+import java.util.Set;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.transform.OutputKeys;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerException;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.stream.StreamResult;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.papyrus.eclipse.project.editors.Activator;
+import org.eclipse.papyrus.eclipse.project.editors.interfaces.IFeatureProjectEditor;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+import org.xml.sax.SAXException;
+
+public class FeatureProjectEditor extends ProjectEditor implements IFeatureProjectEditor {
+
+ /** the name of the file feature.xml */
+ public static final String FRAGMENT_XML_FILE = "feature.xml"; //$NON-NLS-1$
+
+ private static final String ID = "id"; //$NON-NLS-1$
+ private static final String LABEL = "label"; //$NON-NLS-1$
+ private static final String VERSION = "version"; //$NON-NLS-1$
+ private static final String PROVIDER = "provider-name"; //$NON-NLS-1$
+
+ private static final String URL = "url"; //$NON-NLS-1$
+ private static final String COPYRIGHT = "copyright"; //$NON-NLS-1$
+ private static final String LICENSE = "license"; //$NON-NLS-1$
+ private static final String DESCRIPTION = "description"; //$NON-NLS-1$
+
+ private static final String OS = "os"; //$NON-NLS-1$
+ private static final String WS = "ws"; //$NON-NLS-1$
+ private static final String NL = "nl"; //$NON-NLS-1$
+ private static final String ARCH = "arch"; //$NON-NLS-1$
+ private static final String UPDATE = "update"; //$NON-NLS-1$
+
+ private static final String PLUGIN = "plugin"; //$NON-NLS-1$
+ private static final String IMPORT = "import"; //$NON-NLS-1$
+ private static final String INCLUDES = "includes"; //$NON-NLS-1$
+ private static final String REQUIRES = "requires"; //$NON-NLS-1$
+ private static final String FEATURE = "feature"; //$NON-NLS-1$
+
+ // TODO pour l'externalization : utiliser l'Úditeur de Properties! dans java Utils
+
+ private Document fragmentXML;
+
+ private IFile fragmentFile;
+
+ private Element fragmentRoot;
+
+ /**
+ * Constructor.
+ *
+ * @param project the eclipse project
+ * @throws ParserConfigurationException
+ * @throws SAXException
+ * @throws IOException
+ * @throws CoreException
+ */
+ public FeatureProjectEditor(final IProject project) throws ParserConfigurationException, SAXException, IOException, CoreException {
+ super(project);
+ }
+
+ @Override
+ public void init() {
+ fragmentFile = getFeature();
+ if (fragmentFile != null && fragmentFile.exists()) {
+ final DocumentBuilderFactory documentFactory = DocumentBuilderFactory.newInstance();
+ try {
+ DocumentBuilder documentBuilder = documentFactory.newDocumentBuilder();
+ fragmentXML = documentBuilder.parse(fragmentFile.getLocation().toOSString());
+ fragmentRoot = fragmentXML.getDocumentElement();
+ } catch (final ParserConfigurationException e) {
+ Activator.log.error(e);
+ } catch (final SAXException e) {
+ Activator.log.error(e);
+ } catch (final IOException e) {
+ Activator.log.error(e);
+ }
+ }
+ }
+
+ @Override
+ public void createFiles(final Set<String> files) {
+ if (files.contains(FRAGMENT_XML_FILE)) {
+ fragmentFile = getProject().getFile(FRAGMENT_XML_FILE);
+ if (!fragmentFile.exists()) {
+ InputStream content = getInputStream("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<feature>\n</feature>\n\n"); //$NON-NLS-1$
+
+ try {
+ fragmentFile.create(content, true, null);
+ } catch (CoreException e) {
+ Activator.log.error(e);
+ }
+ }
+ }
+ }
+
+ @Override
+ public boolean exists() {
+ return getFeature().exists() && super.exists();
+ }
+
+ public void setAttribute(final Element element, final String attributeName, final String attributeValue) {
+ element.setAttribute(attributeName, attributeValue);
+ }
+
+ /**
+ * @return the feature.xml file if it exists
+ */
+ private IFile getFeature() {
+ final IFile fragment = getProject().getFile(FRAGMENT_XML_FILE);
+
+ if (fragment.exists()) {
+ return fragment;
+ }
+
+ return null;
+ }
+
+ @Override
+ public void save() {
+ if (exists()) {
+ try {
+ final TransformerFactory transformerFactory = TransformerFactory.newInstance();
+ final Transformer transformer = transformerFactory.newTransformer();
+ transformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8"); //$NON-NLS-1$
+ final StreamResult result = new StreamResult(new StringWriter());
+ final DOMSource source = new DOMSource(fragmentXML);
+ transformer.transform(source, result);
+
+ final InputStream inputStream = getInputStream(result.getWriter().toString());
+ fragmentFile.setContents(inputStream, true, true, null);
+ } catch (final TransformerException ex) {
+ Activator.log.error(ex);
+ } catch (final CoreException ex) {
+ Activator.log.error(ex);
+ }
+ }
+ super.save();
+ }
+
+ @Override
+ public Set<String> getMissingNature() {
+ // TODO
+ return Collections.emptySet();
+ }
+
+ @Override
+ public Set<String> getMissingFiles() {
+ // TODO
+ return Collections.emptySet();
+ }
+
+ @Override
+ public Set<String> getMissingBuildCommand() {
+ // TODO
+ return Collections.emptySet();
+ }
+
+ public Document getDocument() {
+ return fragmentXML;
+ }
+
+ public String getId() {
+ return fragmentRoot.getAttribute(ID);
+ }
+
+ public String getLabel() {
+ return fragmentRoot.getAttribute(LABEL);
+ }
+
+ public String getVersion() {
+ return fragmentRoot.getAttribute(VERSION);
+ }
+
+ public String getProviderName() {
+ return fragmentRoot.getAttribute(PROVIDER);
+ }
+
+ public String getDescriptionText() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public String getDescriptionURL() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public String getCopyrightURL() {
+ final Element copyrightNode = getNode(COPYRIGHT);
+ if (copyrightNode != null) {
+ final String value = copyrightNode.getAttribute("url");
+ if (value != null && value.startsWith("%")) {
+ final IFile file = getProject().getFile("feature.properties");
+ final Properties prop = new Properties(); // TODO create a method to use Properties for others fields too
+ try {
+ prop.load(file.getContents());
+ } catch (final IOException e) {
+ Activator.log.error(e);
+ } catch (final CoreException e) {
+ Activator.log.error(e);
+ }
+ final Object val = prop.get("url");
+ if (val != null) {
+ return (String) val;
+ }
+ }
+ return copyrightNode.getAttribute("url");
+ }
+ return null;
+ }
+
+ public String getCopyrightText() {
+ final Element copyrightNode = getNode(COPYRIGHT);
+
+ return copyrightNode != null ? copyrightNode.getTextContent() : null;
+ }
+
+ public String getLicenseText() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public String getLicenceURL() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public String getOS() {
+ return fragmentRoot.getAttribute(OS);
+ }
+
+ public String getWS() {
+ return fragmentRoot.getAttribute(WS);
+ }
+
+ public String getNL() {
+ return fragmentRoot.getAttribute(NL);
+ }
+
+ public String getArch() {
+ return fragmentRoot.getAttribute(ARCH);
+ }
+
+ public void setId(final String id) {
+ fragmentRoot.setAttribute(ID, id);
+ }
+
+ public void setLabel(final String label) {
+ fragmentRoot.setAttribute(LABEL, label);
+ }
+
+ public void setVersion(final String version) {
+ fragmentRoot.setAttribute(VERSION, version);
+ }
+
+ public void setProviderName(final String providerName) {
+ fragmentRoot.setAttribute(PROVIDER, providerName);
+ }
+
+ public void setDescription(final String descriptionURL, final String description) {
+ if (exists()) {
+ Element extension = getNode(DESCRIPTION);
+
+ if (extension == null) {
+ extension = fragmentXML.createElement(DESCRIPTION);
+ fragmentRoot.appendChild(extension);
+ }
+
+ extension.setAttribute(URL, descriptionURL);
+ extension.setTextContent(description);
+ }
+ }
+
+ public void setCopyright(final String copyrightURL, final String copyrightDesc) {
+ setURLNode(COPYRIGHT, copyrightURL, copyrightDesc);
+ }
+
+ public void setLicense(final String licenseURL, final String licenseDesc) {
+ setURLNode(LICENSE, licenseURL, licenseDesc);
+ }
+
+ public void setOS(final String os) {
+ fragmentRoot.setAttribute(OS, os);
+ }
+
+ public void setWS(final String ws) {
+ fragmentRoot.setAttribute(WS, ws);
+ }
+
+ public void setNL(final String nl) {
+ fragmentRoot.setAttribute(NL, nl);
+ }
+
+ public void setArch(final String architecture) {
+ fragmentRoot.setAttribute(ARCH, architecture);
+ }
+
+ public void setUpdateURL(final String urlLabel, final String url) {
+ Element urlNode = getNode(URL);
+
+ if (urlNode == null) {
+ urlNode = createElement(URL);
+ fragmentRoot.appendChild(urlNode);
+ }
+
+ Element updateNode = getNodeChild(UPDATE, urlNode);
+ if (updateNode == null) {
+ updateNode = createElement(UPDATE);
+ urlNode.appendChild(updateNode);
+ }
+
+ updateNode.setAttribute(LABEL, urlLabel);
+ updateNode.setAttribute(URL, url);
+ }
+
+ public void addPlugin(final String pluginName) {
+ // Get the plug-in element or create it if it does not exist
+ Element pluginNode = getPlugin(pluginName);
+
+ if (pluginNode == null) {
+ pluginNode = createElement(PLUGIN);
+ fragmentRoot.appendChild(pluginNode);
+ }
+
+ // Set the id on the element
+ pluginNode.setAttribute(ID, pluginName);
+ }
+
+ public void addRequiredFeature(final String featureName, final String version) {
+ // Make sure the "requires" element exists
+ Element requires = getNode(REQUIRES);
+
+ if (requires == null) {
+ requires = createElement(REQUIRES);
+ fragmentRoot.appendChild(requires);
+ }
+
+ // Get or create the required feature element
+ Element feature = getRequiredFeature(featureName);
+
+ if (feature == null) {
+ feature = createElement(IMPORT);
+ requires.appendChild(feature);
+ }
+
+ // Set the element values
+ feature.setAttribute(FEATURE, featureName);
+ feature.setAttribute(VERSION, version);
+ }
+
+ public void addRequiredPlugin(final String pluginName) {
+ // Make sure the "requires" element exists
+ Element requires = getNode(REQUIRES);
+
+ if (requires == null) {
+ requires = createElement(REQUIRES);
+ fragmentRoot.appendChild(requires);
+ }
+
+ // Get or create the plug-in element
+ Element plugin = getRequiredPlugin(pluginName);
+
+ if (plugin == null) {
+ plugin = createElement(IMPORT);
+ requires.appendChild(plugin);
+ }
+
+ plugin.setAttribute(PLUGIN, pluginName);
+ }
+
+ public void addInclude(final String featureName, final String version) {
+ Element includeNode = getInclude(featureName);
+
+ if (includeNode == null) {
+ includeNode = createElement(INCLUDES);
+ fragmentRoot.appendChild(includeNode);
+ }
+
+ includeNode.setAttribute(ID, featureName);
+ includeNode.setAttribute(VERSION, version);
+ }
+
+ /**
+ * Creates an element and returns it.
+ *
+ * @param elementName the name of the element to create
+ * @return the created element
+ */
+ private Element createElement(String elementName) {
+ return fragmentXML.createElement(elementName);
+ }
+
+ protected void setURLNode(final String nodeName, final String url, final String description) {
+ if (exists()) {
+ Element extension = getNode(nodeName);
+ if (extension == null) {
+ extension = fragmentXML.createElement(nodeName);
+ if (url != null) {
+ extension.setAttribute(URL, url);
+ }
+ extension.setTextContent(description);
+ fragmentRoot.appendChild(extension);
+ } else {
+ if (url != null) {
+ extension.setAttribute(URL, url);
+ }
+ extension.setTextContent(description);
+ }
+ }
+ }
+
+ /**
+ * Gets an element inside a parent element.
+ *
+ * @param parentElement
+ * @param nodeName the node name of the element
+ * @param attributeValue the value of the element's attribute to retrieve
+ * @return the element or null if it does not exist
+ */
+ private Element getElement(final Element parentElement, final String nodeName, final String attributeName, final String attributeValue) {
+ NodeList childNodes = parentElement.getChildNodes();
+
+ for (int i = 0; i < childNodes.getLength(); i++) {
+ Node item = childNodes.item(i);
+
+ if (nodeName.equals(item.getNodeName())) {
+ if (attributeValue.equals(getNodeAttribute(item, attributeName))) {
+ if (item instanceof Element) {
+ return (Element) item;
+ }
+ }
+ }
+ }
+
+ return null;
+ }
+
+ private Element getNodeChild(final String childName, final Element node) {
+ NodeList childNodes = node.getChildNodes();
+
+ if (childNodes == null) {
+ return null;
+ }
+
+ for (int i = 0; i < childNodes.getLength(); i++) {
+ Node item = childNodes.item(i);
+
+ if (item.getNodeName().equals(childName)) {
+ if (item instanceof Element) {
+ return (Element) item;
+ }
+ }
+ }
+
+ return null;
+ }
+
+ /**
+ * Gets a node element inside the root element.
+ *
+ * @param nodeName the node name
+ * @return the node element or null if it does not exist.
+ */
+ private Element getNode(final String nodeName) {
+ if (exists()) {
+ final NodeList nodes = fragmentRoot.getChildNodes();
+ for (int i = 0; i < nodes.getLength(); i++) {
+ final Node item = nodes.item(i);
+ if (item instanceof NodeList) {
+ final String name = item.getNodeName();
+ if (name.equals(nodeName)) {
+ if (item instanceof Element) {
+ return (Element) item;
+ }
+ }
+ }
+ }
+ }
+
+ return null;
+ }
+
+ private Element getPlugin(String pluginName) {
+ return getElement(fragmentRoot, PLUGIN, ID, pluginName);
+ }
+
+ private Element getInclude(String featureName) {
+ return getElement(fragmentRoot, INCLUDES, ID, featureName);
+ }
+
+ /**
+ * @param pluginName
+ * @return
+ */
+ private Element getRequiredPlugin(String pluginName) {
+ Element requires = getNode(REQUIRES);
+
+ if (requires != null) {
+ return getElement(requires, IMPORT, PLUGIN, pluginName);
+ }
+
+ return null;
+ }
+
+ private String getNodeAttribute(Node node, String name) {
+ Node attribute = node.getAttributes().getNamedItem(name);
+
+ return attribute != null ? attribute.getNodeValue() : null;
+ }
+
+ private Element getRequiredFeature(String featureName) {
+ Element requires = getNode(REQUIRES);
+
+ if (requires != null) {
+ return getElement(requires, IMPORT, FEATURE, featureName);
+ }
+
+ return null;
+ }
+
+}
diff --git a/plugins/editor/org.eclipse.papyrus.eclipse.project.editors/src/org/eclipse/papyrus/eclipse/project/editors/project/JavaProjectEditor.java b/plugins/editor/org.eclipse.papyrus.eclipse.project.editors/src/org/eclipse/papyrus/eclipse/project/editors/project/JavaProjectEditor.java
new file mode 100644
index 00000000000..e53e0677537
--- /dev/null
+++ b/plugins/editor/org.eclipse.papyrus.eclipse.project.editors/src/org/eclipse/papyrus/eclipse/project/editors/project/JavaProjectEditor.java
@@ -0,0 +1,272 @@
+/*****************************************************************************
+ * Copyright (c) 2011 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.eclipse.project.editors.project;
+
+import java.util.Set;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.papyrus.eclipse.project.editors.Activator;
+import org.eclipse.papyrus.eclipse.project.editors.file.BuildEditor;
+import org.eclipse.papyrus.eclipse.project.editors.file.ClasspathEditor;
+import org.eclipse.papyrus.eclipse.project.editors.interfaces.IBuildEditor;
+import org.eclipse.papyrus.eclipse.project.editors.interfaces.IClasspathEditor;
+import org.eclipse.papyrus.eclipse.project.editors.interfaces.IJavaProjectEditor;
+
+/**
+ *
+ * This editor allows to manage a JavaProject
+ *
+ */
+public class JavaProjectEditor extends ProjectEditor implements IJavaProjectEditor {
+
+
+ /** the java project */
+ private final IJavaProject javaProject;
+
+
+
+ /**
+ * Gets the classpath editor.
+ *
+ * @return the classpath editor
+ */
+ public IClasspathEditor getClasspathEditor() {
+ return classpathEditor;
+ }
+
+
+ /**
+ * Gets the builds the editor.
+ *
+ * @return the builds the editor
+ */
+ public IBuildEditor getBuildEditor() {
+ return buildEditor;
+ }
+
+ /** the classpath editor */
+ private final IClasspathEditor classpathEditor;
+
+ /** the build editor */
+ private final IBuildEditor buildEditor;
+
+ /**
+ *
+ * Constructor.
+ *
+ * @param project
+ * the eclipse project
+ * @throws CoreException
+ */
+ public JavaProjectEditor(final IProject project) throws CoreException {
+ super(project);
+ this.javaProject = JavaCore.create(project);
+ this.buildEditor = new BuildEditor(project);
+ this.classpathEditor = new ClasspathEditor(this.javaProject);
+ }
+
+ /**
+ *
+ * @return
+ * <code>true</code> if the project is a java project :
+ *
+ */
+ @Override
+ public boolean exists() {
+ return super.exists() && this.javaProject.exists();
+ }
+
+ /**
+ *
+ * @see org.eclipse.papyrus.eclipse.project.editors.project.ProjectEditor#getMissingFiles()
+ *
+ * {@inheritDoc}
+ */
+ @Override
+ public Set<String> getMissingFiles() {
+ Set<String> files = super.getMissingFiles();
+ files.addAll(this.classpathEditor.getMissingFiles());
+ files.addAll(this.buildEditor.getMissingFiles());
+ return files;
+ }
+
+ /**
+ *
+ * @see org.eclipse.papyrus.eclipse.project.editors.project.AbstractProjectEditor#getMissingNature()
+ *
+ * {@inheritDoc}
+ */
+ @Override
+ public Set<String> getMissingNature() {
+ Set<String> natures = super.getMissingNature();
+ if (!hasNature(JAVA_NATURE)) {
+ natures.add(JAVA_NATURE);
+ }
+ return natures;
+ }
+
+ @Override
+ public void init() {
+ // TODO Auto-generated method stub
+ super.init();
+ this.classpathEditor.init();
+ this.buildEditor.init();
+ }
+
+ @Override
+ public void createFiles(final Set<String> files) {
+ super.createFiles(files);
+ this.classpathEditor.createFiles(files);
+ this.buildEditor.createFiles(files);
+ }
+
+
+
+ /**
+ * save the modification
+ *
+ * @throws Throwable
+ */
+ @Override
+ public void save() {
+ super.save();
+ try {
+ this.javaProject.save(new NullProgressMonitor(), true);
+ } catch (JavaModelException ex) {
+ Activator.log.error(ex);
+ }
+ this.classpathEditor.save();
+ this.buildEditor.save();
+ }
+
+ /**
+ *
+ * @see org.eclipse.papyrus.eclipse.project.editors.interfaces.IJavaProjectEditor#addJavaSourceFolder(java.lang.String)
+ *
+ * {@inheritDoc}
+ */
+ public void addJavaSourceFolder(final String path) {
+ if (exists()) {
+ // we add this source folder to the class path
+ // String classPath = "/" + this.project.getName()+"/" + path;
+ String classPath = path;
+ this.classpathEditor.addSourceFolderToClasspath(classPath);
+
+ // we add this source folder in the build file
+ this.buildEditor.registerSourceFolder(path + "/"); //$NON-NLS-1$
+ }
+ }
+
+ /**
+ *
+ * @see org.eclipse.papyrus.eclipse.project.editors.interfaces.IBuildEditor#registerSourceFolder(java.lang.String)
+ *
+ * {@inheritDoc}
+ */
+ public void registerSourceFolder(final String string) {
+ this.buildEditor.registerSourceFolder(string);
+
+ }
+
+ /**
+ *
+ * @see org.eclipse.papyrus.eclipse.project.editors.interfaces.IBuildEditor#addToBuild(java.lang.String)
+ *
+ * {@inheritDoc}
+ */
+ public void addToBuild(final String path) {
+ this.buildEditor.addToBuild(path);
+
+ }
+
+ /**
+ *
+ * @see org.eclipse.papyrus.eclipse.project.editors.interfaces.IBuildEditor#isRegistred(java.lang.String)
+ *
+ * {@inheritDoc}
+ */
+ public boolean isRegisteredSourceFolder(final String path) {
+ return this.buildEditor.isRegisteredSourceFolder(path);
+ }
+
+ /**
+ *
+ * @see org.eclipse.papyrus.eclipse.project.editors.interfaces.IBuildEditor#getSourceFolders()
+ *
+ * {@inheritDoc}
+ */
+ public String[] getSourceFolders() {
+ return this.buildEditor.getSourceFolders();
+ }
+
+ /**
+ *
+ * @see org.eclipse.papyrus.eclipse.project.editors.file.AbstractFileEditor#getMissingBuildCommand()
+ *
+ * {@inheritDoc}
+ */
+ @Override
+ public Set<String> getMissingBuildCommand() {
+ Set<String> buildCommand = super.getMissingBuildCommand();
+ if (!hasBuildCommand(IJavaProjectEditor.JAVA_BUILD_COMMAND)) {
+ buildCommand.add(IJavaProjectEditor.JAVA_BUILD_COMMAND);
+ }
+ return buildCommand;
+ }
+
+ /**
+ *
+ * @see org.eclipse.papyrus.eclipse.project.editors.interfaces.IBuildEditor#removeFromBuild(java.lang.String)
+ *
+ * {@inheritDoc}
+ */
+ public void removeFromBuild(String path) {
+ buildEditor.removeFromBuild(path);
+ }
+
+ /**
+ *
+ * @see org.eclipse.papyrus.eclipse.project.editors.interfaces.IBuildEditor#getElementsInBuild()
+ *
+ * {@inheritDoc}
+ */
+ public String[] getElementsInBuild() {
+ return buildEditor.getElementsInBuild();
+ }
+
+ /**
+ *
+ * @see org.eclipse.papyrus.eclipse.project.editors.interfaces.IBuildEditor#registerBinFolder(java.lang.String)
+ *
+ * {@inheritDoc}
+ */
+ public void registerBinFolder(String binFolder) {
+ buildEditor.registerBinFolder(binFolder);
+ }
+
+ /**
+ *
+ * @see org.eclipse.papyrus.eclipse.project.editors.interfaces.IBuildEditor#isRegisteredBinFolder(java.lang.String)
+ *
+ * {@inheritDoc}
+ */
+ public boolean isRegisteredBinFolder(String binFolder) {
+ return buildEditor.isRegisteredBinFolder(binFolder);
+ }
+}
diff --git a/plugins/editor/org.eclipse.papyrus.eclipse.project.editors/src/org/eclipse/papyrus/eclipse/project/editors/project/PluginProjectEditor.java b/plugins/editor/org.eclipse.papyrus.eclipse.project.editors/src/org/eclipse/papyrus/eclipse/project/editors/project/PluginProjectEditor.java
new file mode 100644
index 00000000000..fd9563ad056
--- /dev/null
+++ b/plugins/editor/org.eclipse.papyrus.eclipse.project.editors/src/org/eclipse/papyrus/eclipse/project/editors/project/PluginProjectEditor.java
@@ -0,0 +1,307 @@
+/*****************************************************************************
+ * Copyright (c) 2011 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
+ * Vincent Lorenzot (CEA-LIST) vincent.lorenzo@cea.fr
+ *****************************************************************************/
+package org.eclipse.papyrus.eclipse.project.editors.project;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.StringWriter;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Set;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.transform.OutputKeys;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerException;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.stream.StreamResult;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.papyrus.eclipse.project.editors.Activator;
+import org.eclipse.papyrus.eclipse.project.editors.interfaces.IPluginProjectEditor;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+import org.xml.sax.SAXException;
+
+/**
+ *
+ * This editor allows to edit the plugin file
+ *
+ */
+public class PluginProjectEditor extends ProjectEditor implements IPluginProjectEditor {
+
+ private Document pluginXML;
+
+ private IFile pluginFile;
+
+ private Element pluginRoot;
+
+ /**
+ *
+ * Constructor.
+ *
+ * @param project
+ * the eclipse project
+ * @throws ParserConfigurationException
+ * @throws SAXException
+ * @throws IOException
+ * @throws CoreException
+ */
+ public PluginProjectEditor(final IProject project) throws ParserConfigurationException, SAXException, IOException, CoreException {
+ super(project);
+ }
+
+ /**
+ *
+ * @see org.eclipse.papyrus.eclipse.project.editors.project.ProjectEditor#init()
+ *
+ * {@inheritDoc}
+ */
+ @Override
+ public void init() {
+ this.pluginFile = getPlugin();
+ if (this.pluginFile != null && this.pluginFile.exists()) {
+ DocumentBuilderFactory documentFactory = DocumentBuilderFactory.newInstance();
+ DocumentBuilder documentBuilder;
+ try {
+ documentBuilder = documentFactory.newDocumentBuilder();
+ this.pluginXML = documentBuilder.parse(this.pluginFile.getLocation().toOSString());
+ this.pluginRoot = this.pluginXML.getDocumentElement();
+ } catch (ParserConfigurationException e) {
+ Activator.log.error(e);
+ } catch (SAXException e) {
+ Activator.log.error(e);
+ } catch (IOException e) {
+ Activator.log.error(e);
+ }
+ }
+ }
+
+ /**
+ * Create the file plugin.xml
+ *
+ * @see org.eclipse.papyrus.eclipse.project.editors.project.ProjectEditor#createFiles(Set)
+ *
+ * {@inheritDoc}
+ */
+ @Override
+ public void createFiles(final Set<String> files) {
+ if (files.contains(PLUGIN_XML_FILE)) {
+ IFile plugin = getProject().getFile(PLUGIN_XML_FILE);
+ if (!plugin.exists()) {
+ InputStream is = getInputStream("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + "<?eclipse version=\"3.4\"?>\n" + "<plugin>\n" + "</plugin>\n"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
+ try {
+ plugin.create(is, true, null);
+ } catch (CoreException e) {
+ Activator.log.error(e);
+ }
+ }
+ }
+ super.createFiles(files);
+ }
+
+ /**
+ *
+ * @see org.eclipse.papyrus.eclipse.project.editors.project.AbstractProjectEditor.plugin.AbstractEditor#exists()
+ *
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean exists() {
+ IFile plugin = getProject().getFile(PLUGIN_XML_FILE);
+ return plugin.exists() && super.exists();
+ }
+
+ /**
+ *
+ * @see org.eclipse.papyrus.eclipse.project.editors.interfaces.IPluginProjectEditor#addExtension(java.lang.String)
+ *
+ * {@inheritDoc}
+ */
+ public Element addExtension(final String extensionPoint) {
+ if (exists()) {
+ Element extension = this.pluginXML.createElement(EXTENSION);
+ extension.setAttribute(POINT, extensionPoint);
+ this.pluginRoot.appendChild(extension);
+ return extension;
+ }
+ return null;
+ }
+
+ /**
+ * Returns the list of the registered extension with this extension point
+ *
+ * @param extensionPoint
+ * the name of an extension point
+ * @return
+ * the list of the registered extension with this extension point
+ */
+ public List<Node> getExtensions(final String extensionPoint) {
+ if (exists()) {
+ NodeList nodes = this.pluginRoot.getChildNodes();
+ List<Node> extensions = new ArrayList<Node>();
+ for (int i = 0; i < nodes.getLength(); i++) {
+ Node item = nodes.item(i);
+ if (item instanceof NodeList) {
+ String name = item.getNodeName();
+ if (name.equals(EXTENSION)) {
+ NamedNodeMap attributes = item.getAttributes();
+ Node point = attributes.getNamedItem(POINT);
+ if (extensionPoint.equals(point.getNodeValue())) {
+ if (item instanceof Node) {
+ extensions.add(item);
+ }
+ }
+ }
+ }
+ }
+ return extensions;
+ }
+ return null;
+ }
+
+
+ /**
+ *
+ * @see org.eclipse.papyrus.eclipse.project.editors.interfaces.IPluginProjectEditor#setAttribute(org.w3c.dom.Element, java.lang.String, java.lang.String)
+ *
+ * {@inheritDoc}
+ */
+ public void setAttribute(final Element element, final String attributeName, final String attributeValue) {
+ element.setAttribute(attributeName, attributeValue);
+ }
+
+ /**
+ *
+ * @see org.eclipse.papyrus.eclipse.project.editors.interfaces.IPluginProjectEditor#addChild(org.w3c.dom.Element, java.lang.String)
+ *
+ * {@inheritDoc}
+ */
+ public Element addChild(final Element element, final String childName) {
+ Element child = this.pluginXML.createElement(childName);
+ element.appendChild(child);
+ return child;
+ }
+
+ /**
+ *
+ * @return
+ * the plugin file if it exists
+ */
+ private IFile getPlugin() {
+ IFile plugin = getProject().getFile(PLUGIN_XML_FILE);
+ if (plugin.exists()) {
+ return plugin;
+ }
+ return null;
+ }
+
+
+ /**
+ *
+ * @see org.eclipse.papyrus.eclipse.project.editors.project.ProjectEditor#save()
+ *
+ * {@inheritDoc}
+ */
+ @Override
+ public void save() {
+ if (exists()) {
+ try {
+ TransformerFactory transformerFactory = TransformerFactory.newInstance();
+ Transformer transformer = transformerFactory.newTransformer();
+ transformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8"); //$NON-NLS-1$
+ transformer.setOutputProperty(OutputKeys.INDENT, "yes"); //$NON-NLS-1$
+ transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", //$NON-NLS-1$
+ "3"); //$NON-NLS-1$
+ StreamResult result = new StreamResult(new StringWriter());
+ DOMSource source = new DOMSource(this.pluginXML);
+ transformer.transform(source, result);
+
+ String resultAsString = result.getWriter().toString();
+ if (!resultAsString.endsWith("\n")) { //$NON-NLS-1$
+ resultAsString += "\n"; //$NON-NLS-1$
+ }
+ InputStream inputStream = getInputStream(resultAsString);
+ this.pluginFile.setContents(inputStream, true, true, null);
+ } catch (TransformerException ex) {
+ Activator.log.error(ex);
+ } catch (CoreException ex) {
+ Activator.log.error(ex);
+ }
+ }
+ super.save();
+ }
+
+ /**
+ *
+ * @see org.eclipse.papyrus.eclipse.project.editors.project.ProjectEditor#getMissingNature()
+ *
+ * {@inheritDoc}
+ */
+ @Override
+ public Set<String> getMissingNature() {
+ Set<String> natures = super.getMissingNature();
+ if (!hasNature(PLUGIN_NATURE)) {
+ natures.add(PLUGIN_NATURE);
+ }
+ return natures;
+ }
+
+ /**
+ *
+ * @see org.eclipse.papyrus.eclipse.project.editors.project.ProjectEditor#getMissingFiles()
+ *
+ * {@inheritDoc}
+ */
+ @Override
+ public Set<String> getMissingFiles() {
+ Set<String> files = super.getMissingFiles();
+ IFile plugin = getProject().getFile(PLUGIN_XML_FILE);
+ if (!plugin.exists()) {
+ files.add(PLUGIN_XML_FILE);
+ }
+ return files;
+ }
+
+ /**
+ *
+ * @see org.eclipse.papyrus.eclipse.project.editors.file.AbstractFileEditor#getMissingBuildCommand()
+ *
+ * {@inheritDoc}
+ */
+ @Override
+ public Set<String> getMissingBuildCommand() {
+ Set<String> commands = super.getMissingBuildCommand();
+ if (!hasBuildCommand(PLUGIN_BUILD_COMMAND)) {
+ commands.add(PLUGIN_BUILD_COMMAND);
+ }
+ return commands;
+ }
+
+ /**
+ * @return The XML Document associated to this plugin.xml file
+ * @see PluginProjectEditor#init()
+ * @see PluginProjectEditor#create()
+ */
+ public Document getDocument() {
+ return pluginXML;
+ }
+}
diff --git a/plugins/editor/org.eclipse.papyrus.eclipse.project.editors/src/org/eclipse/papyrus/eclipse/project/editors/project/ProjectEditor.java b/plugins/editor/org.eclipse.papyrus.eclipse.project.editors/src/org/eclipse/papyrus/eclipse/project/editors/project/ProjectEditor.java
new file mode 100644
index 00000000000..253339a1b4f
--- /dev/null
+++ b/plugins/editor/org.eclipse.papyrus.eclipse.project.editors/src/org/eclipse/papyrus/eclipse/project/editors/project/ProjectEditor.java
@@ -0,0 +1,151 @@
+/*****************************************************************************
+ * Copyright (c) 2011 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Camille Letavernier (CEA LIST) camille.letavernier@cea.fr - Initial API and implementation
+ *****************************************************************************/
+package org.eclipse.papyrus.eclipse.project.editors.project;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+import java.util.Set;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IFolder;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.papyrus.eclipse.project.editors.Activator;
+import org.eclipse.papyrus.eclipse.project.editors.interfaces.IProjectEditor;
+
+/**
+ *
+ * This class allows to manage the eclipse project
+ *
+ */
+public class ProjectEditor extends AbstractProjectEditor implements IProjectEditor {
+
+
+ /**
+ *
+ * Constructor.
+ *
+ * @param project
+ * the eclipse project
+ * @throws CoreException
+ */
+ public ProjectEditor(final IProject project) throws CoreException {
+ super(project);
+ }
+
+ /**
+ *
+ * Constructor.
+ *
+ * @param folder
+ * a folder
+ * @throws CoreException
+ */
+ public ProjectEditor(final IFolder folder) throws CoreException {
+ super(null);
+ // TODO : create an action to import a folder as a project!
+ // this will allow to test the create method
+ throw new UnsupportedOperationException();
+ }
+
+
+
+ /**
+ * Create the project file
+ * TODO NOT TESTED
+ *
+ * @see org.eclipse.papyrus.eclipse.project.editors.interfaces.IProjectEditor#createFiles(Set)
+ *
+ * {@inheritDoc}
+ */
+ public void createFiles(final Set<String> files) {
+ if (files.contains(PROJECT_FILE)) {
+ final IFile file = getProject().getFile(PROJECT_FILE);
+ if (!file.exists()) {
+ String input = ""; //$NON-NLS-1$
+ input += AbstractProjectEditor.XML_HEADER;
+ input += "<" + NAME + ">"; //$NON-NLS-1$ //$NON-NLS-2$
+ input += getProject().getName();
+ input += "</" + NAME + ">"; //$NON-NLS-1$ //$NON-NLS-2$
+ input += "<" + COMMENT + ">"; //$NON-NLS-1$ //$NON-NLS-2$
+ input += "</" + COMMENT + ">"; //$NON-NLS-1$ //$NON-NLS-2$
+ input += "<" + BUILD_SPEC + ">"; //$NON-NLS-1$ //$NON-NLS-2$
+ input += "</" + BUILD_SPEC + ">"; //$NON-NLS-1$ //$NON-NLS-2$
+ input += "<" + NATURE + ">"; //$NON-NLS-1$ //$NON-NLS-2$
+ input += "</" + NATURE + ">"; //$NON-NLS-1$ //$NON-NLS-2$
+
+ try {
+ file.create(getInputStream(input), true, null);
+ } catch (final CoreException e) {
+ Activator.log.error(e);
+ }
+ }
+ }
+ }
+
+
+ /**
+ *
+ * @see org.eclipse.papyrus.eclipse.project.editors.interfaces.IProjectEditor#getMissingFiles()
+ *
+ * {@inheritDoc}
+ */
+ @Override
+ public Set<String> getMissingFiles() {
+ final Set<String> missingFile = super.getMissingFiles();
+ final IFile projectFile = getProject().getFile(PROJECT_FILE);
+ if (!projectFile.exists()) {
+ missingFile.add(IProjectEditor.PROJECT_FILE);
+ }
+ return missingFile;
+ }
+
+ /**
+ *
+ * @see org.eclipse.papyrus.eclipse.project.editors.interfaces.IProjectEditor#addFile(java.net.URL, java.lang.String)
+ *
+ * @param url
+ * @param fileDestinationPath
+ * @param eraseExitingFile
+ */
+ public void addFile(final URL url, final String fileDestinationPath, final boolean eraseExitingFile) {
+ final IFile targetFile = getProject().getFile(new Path(fileDestinationPath));
+ if (targetFile.exists()) {
+ if (eraseExitingFile) {
+ try {
+ targetFile.delete(true, new NullProgressMonitor());
+ } catch (final CoreException e) {
+ Activator.log.error(e);
+ }
+ } else {
+ return;
+ }
+ }
+ try {
+ final InputStream is = url.openStream();
+ ;
+ targetFile.create(is, false, new NullProgressMonitor());
+ is.close();
+ targetFile.refreshLocal(IResource.DEPTH_ZERO, new NullProgressMonitor());
+ } catch (final CoreException e) {
+ Activator.log.error(e);
+ } catch (final IOException e) {
+ Activator.log.error(e);
+ }
+
+
+ }
+}

Back to the top