diff options
Diffstat (limited to 'plugins/org.eclipse.emf.cdo.dawn.ecoretools.diagram.dawn')
16 files changed, 1533 insertions, 1533 deletions
diff --git a/plugins/org.eclipse.emf.cdo.dawn.ecoretools.diagram.dawn/.settings/org.eclipse.jdt.ui.prefs b/plugins/org.eclipse.emf.cdo.dawn.ecoretools.diagram.dawn/.settings/org.eclipse.jdt.ui.prefs index 1c6d0e8a2d..9720d04dde 100644 --- a/plugins/org.eclipse.emf.cdo.dawn.ecoretools.diagram.dawn/.settings/org.eclipse.jdt.ui.prefs +++ b/plugins/org.eclipse.emf.cdo.dawn.ecoretools.diagram.dawn/.settings/org.eclipse.jdt.ui.prefs @@ -1,120 +1,120 @@ -#Thu Feb 04 09:44:24 CET 2010 -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=true -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_to_enhanced_for_loop=false -cleanup.correct_indentation=true -cleanup.format_source_code=true -cleanup.format_source_code_changes_only=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=true -cleanup.qualify_static_field_accesses_with_declaring_class=false -cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true -cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true -cleanup.qualify_static_member_accesses_with_declaring_class=false -cleanup.qualify_static_method_accesses_with_declaring_class=false -cleanup.remove_private_constructors=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_blocks=true -cleanup.use_blocks_only_for_return_and_throw=false -cleanup.use_parentheses_in_expressions=true -cleanup.use_this_for_non_static_field_access=true -cleanup.use_this_for_non_static_field_access_only_if_necessary=true -cleanup.use_this_for_non_static_method_access=true -cleanup.use_this_for_non_static_method_access_only_if_necessary=true -cleanup_profile=_EMFT -cleanup_settings_version=2 -eclipse.preferences.version=1 -editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true -formatter_profile=_EMFT -formatter_settings_version=11 -org.eclipse.jdt.ui.exception.name=ex -org.eclipse.jdt.ui.gettersetter.use.is=true -org.eclipse.jdt.ui.ignorelowercasenames=true -org.eclipse.jdt.ui.importorder=org.eclipse.emf.cdo;org.eclipse.emf.internal.cdo;org.eclipse.net4j;org.eclipse.internal.net4j;org.eclipse.emf;org.eclipse;com;org;javax;java; -org.eclipse.jdt.ui.javadoc=true -org.eclipse.jdt.ui.keywordthis=false -org.eclipse.jdt.ui.ondemandthreshold=99 -org.eclipse.jdt.ui.overrideannotation=true -org.eclipse.jdt.ui.staticondemandthreshold=99 -org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8" standalone\="no"?><templates><template autoinsert\="false" context\="gettercomment_context" deleted\="false" description\="Comment for getter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.gettercomment" name\="gettercomment"/><template autoinsert\="false" context\="settercomment_context" deleted\="false" description\="Comment for setter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.settercomment" name\="settercomment"/><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"/><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">/*\r\n * Copyright (c) 2004 - 2011 Eike Stepper (Berlin, Germany) and others.\r\n * All rights reserved. This program and the accompanying materials\r\n * are made available under the terms of the Eclipse Public License v1.0\r\n * which accompanies this distribution, and is available at\r\n * http\://www.eclipse.org/legal/epl-v10.html\r\n * \r\n * Contributors\:\r\n * Martin Fluegge - initial API and implementation\r\n */</template><template autoinsert\="false" context\="typecomment_context" deleted\="false" description\="Comment for created types" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.typecomment" name\="typecomment">/**\r\n * @author Martin Fluegge\r\n */</template><template autoinsert\="false" context\="fieldcomment_context" deleted\="false" description\="Comment for fields" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.fieldcomment" name\="fieldcomment"/><template autoinsert\="false" context\="methodcomment_context" deleted\="false" description\="Comment for non-overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodcomment" name\="methodcomment"/><template autoinsert\="false" context\="overridecomment_context" deleted\="false" description\="Comment for overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.overridecomment" name\="overridecomment"/><template autoinsert\="false" context\="delegatecomment_context" deleted\="false" description\="Comment for delegate methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.delegatecomment" name\="delegatecomment"/><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}\r\n${package_declaration}\r\n\r\n${typecomment}\r\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">\r\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">\r\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">\r\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">\r\n</template><template autoinsert\="false" context\="catchblock_context" deleted\="false" description\="Code in new catch blocks" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.catchblock" name\="catchblock">${exception_var}.printStackTrace();</template><template autoinsert\="false" context\="methodbody_context" deleted\="false" description\="Code in created method stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodbody" name\="methodbody">${body_statement}</template><template autoinsert\="false" 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}</template><template autoinsert\="true" context\="getterbody_context" deleted\="false" description\="Code in created getters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.getterbody" name\="getterbody">return ${field};</template><template autoinsert\="true" context\="setterbody_context" deleted\="false" description\="Code in created setters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.setterbody" name\="setterbody">${field} \= ${param};</template></templates> -sp_cleanup.add_default_serial_version_id=true -sp_cleanup.add_generated_serial_version_id=false -sp_cleanup.add_missing_annotations=true -sp_cleanup.add_missing_deprecated_annotations=true -sp_cleanup.add_missing_methods=false -sp_cleanup.add_missing_nls_tags=false -sp_cleanup.add_missing_override_annotations=true -sp_cleanup.add_missing_override_annotations_interface_methods=false -sp_cleanup.add_serial_version_id=false -sp_cleanup.always_use_blocks=true -sp_cleanup.always_use_parentheses_in_expressions=false -sp_cleanup.always_use_this_for_non_static_field_access=false -sp_cleanup.always_use_this_for_non_static_method_access=false -sp_cleanup.convert_to_enhanced_for_loop=false -sp_cleanup.correct_indentation=true -sp_cleanup.format_source_code=true -sp_cleanup.format_source_code_changes_only=false -sp_cleanup.make_local_variable_final=false -sp_cleanup.make_parameters_final=false -sp_cleanup.make_private_fields_final=true -sp_cleanup.make_type_abstract_if_missing_method=false -sp_cleanup.make_variable_declarations_final=false -sp_cleanup.never_use_blocks=false -sp_cleanup.never_use_parentheses_in_expressions=true -sp_cleanup.on_save_use_additional_actions=true -sp_cleanup.organize_imports=true -sp_cleanup.qualify_static_field_accesses_with_declaring_class=false -sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true -sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true -sp_cleanup.qualify_static_member_accesses_with_declaring_class=false -sp_cleanup.qualify_static_method_accesses_with_declaring_class=false -sp_cleanup.remove_private_constructors=true -sp_cleanup.remove_trailing_whitespaces=true -sp_cleanup.remove_trailing_whitespaces_all=true -sp_cleanup.remove_trailing_whitespaces_ignore_empty=false -sp_cleanup.remove_unnecessary_casts=true -sp_cleanup.remove_unnecessary_nls_tags=true -sp_cleanup.remove_unused_imports=true -sp_cleanup.remove_unused_local_variables=false -sp_cleanup.remove_unused_private_fields=true -sp_cleanup.remove_unused_private_members=false -sp_cleanup.remove_unused_private_methods=true -sp_cleanup.remove_unused_private_types=true -sp_cleanup.sort_members=false -sp_cleanup.sort_members_all=false -sp_cleanup.use_blocks=true -sp_cleanup.use_blocks_only_for_return_and_throw=false -sp_cleanup.use_parentheses_in_expressions=true -sp_cleanup.use_this_for_non_static_field_access=true -sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true -sp_cleanup.use_this_for_non_static_method_access=true -sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true +#Thu Feb 04 09:44:24 CET 2010
+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=true
+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_to_enhanced_for_loop=false
+cleanup.correct_indentation=true
+cleanup.format_source_code=true
+cleanup.format_source_code_changes_only=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=true
+cleanup.qualify_static_field_accesses_with_declaring_class=false
+cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
+cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
+cleanup.qualify_static_member_accesses_with_declaring_class=false
+cleanup.qualify_static_method_accesses_with_declaring_class=false
+cleanup.remove_private_constructors=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_blocks=true
+cleanup.use_blocks_only_for_return_and_throw=false
+cleanup.use_parentheses_in_expressions=true
+cleanup.use_this_for_non_static_field_access=true
+cleanup.use_this_for_non_static_field_access_only_if_necessary=true
+cleanup.use_this_for_non_static_method_access=true
+cleanup.use_this_for_non_static_method_access_only_if_necessary=true
+cleanup_profile=_EMFT
+cleanup_settings_version=2
+eclipse.preferences.version=1
+editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
+formatter_profile=_EMFT
+formatter_settings_version=11
+org.eclipse.jdt.ui.exception.name=ex
+org.eclipse.jdt.ui.gettersetter.use.is=true
+org.eclipse.jdt.ui.ignorelowercasenames=true
+org.eclipse.jdt.ui.importorder=org.eclipse.emf.cdo;org.eclipse.emf.internal.cdo;org.eclipse.net4j;org.eclipse.internal.net4j;org.eclipse.emf;org.eclipse;com;org;javax;java;
+org.eclipse.jdt.ui.javadoc=true
+org.eclipse.jdt.ui.keywordthis=false
+org.eclipse.jdt.ui.ondemandthreshold=99
+org.eclipse.jdt.ui.overrideannotation=true
+org.eclipse.jdt.ui.staticondemandthreshold=99
+org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8" standalone\="no"?><templates><template autoinsert\="false" context\="gettercomment_context" deleted\="false" description\="Comment for getter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.gettercomment" name\="gettercomment"/><template autoinsert\="false" context\="settercomment_context" deleted\="false" description\="Comment for setter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.settercomment" name\="settercomment"/><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"/><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">/*\r\n * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.\r\n * All rights reserved. This program and the accompanying materials\r\n * are made available under the terms of the Eclipse Public License v1.0\r\n * which accompanies this distribution, and is available at\r\n * http\://www.eclipse.org/legal/epl-v10.html\r\n * \r\n * Contributors\:\r\n * Martin Fluegge - initial API and implementation\r\n */</template><template autoinsert\="false" context\="typecomment_context" deleted\="false" description\="Comment for created types" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.typecomment" name\="typecomment">/**\r\n * @author Martin Fluegge\r\n */</template><template autoinsert\="false" context\="fieldcomment_context" deleted\="false" description\="Comment for fields" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.fieldcomment" name\="fieldcomment"/><template autoinsert\="false" context\="methodcomment_context" deleted\="false" description\="Comment for non-overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodcomment" name\="methodcomment"/><template autoinsert\="false" context\="overridecomment_context" deleted\="false" description\="Comment for overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.overridecomment" name\="overridecomment"/><template autoinsert\="false" context\="delegatecomment_context" deleted\="false" description\="Comment for delegate methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.delegatecomment" name\="delegatecomment"/><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}\r\n${package_declaration}\r\n\r\n${typecomment}\r\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">\r\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">\r\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">\r\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">\r\n</template><template autoinsert\="false" context\="catchblock_context" deleted\="false" description\="Code in new catch blocks" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.catchblock" name\="catchblock">${exception_var}.printStackTrace();</template><template autoinsert\="false" context\="methodbody_context" deleted\="false" description\="Code in created method stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodbody" name\="methodbody">${body_statement}</template><template autoinsert\="false" 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}</template><template autoinsert\="true" context\="getterbody_context" deleted\="false" description\="Code in created getters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.getterbody" name\="getterbody">return ${field};</template><template autoinsert\="true" context\="setterbody_context" deleted\="false" description\="Code in created setters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.setterbody" name\="setterbody">${field} \= ${param};</template></templates>
+sp_cleanup.add_default_serial_version_id=true
+sp_cleanup.add_generated_serial_version_id=false
+sp_cleanup.add_missing_annotations=true
+sp_cleanup.add_missing_deprecated_annotations=true
+sp_cleanup.add_missing_methods=false
+sp_cleanup.add_missing_nls_tags=false
+sp_cleanup.add_missing_override_annotations=true
+sp_cleanup.add_missing_override_annotations_interface_methods=false
+sp_cleanup.add_serial_version_id=false
+sp_cleanup.always_use_blocks=true
+sp_cleanup.always_use_parentheses_in_expressions=false
+sp_cleanup.always_use_this_for_non_static_field_access=false
+sp_cleanup.always_use_this_for_non_static_method_access=false
+sp_cleanup.convert_to_enhanced_for_loop=false
+sp_cleanup.correct_indentation=true
+sp_cleanup.format_source_code=true
+sp_cleanup.format_source_code_changes_only=false
+sp_cleanup.make_local_variable_final=false
+sp_cleanup.make_parameters_final=false
+sp_cleanup.make_private_fields_final=true
+sp_cleanup.make_type_abstract_if_missing_method=false
+sp_cleanup.make_variable_declarations_final=false
+sp_cleanup.never_use_blocks=false
+sp_cleanup.never_use_parentheses_in_expressions=true
+sp_cleanup.on_save_use_additional_actions=true
+sp_cleanup.organize_imports=true
+sp_cleanup.qualify_static_field_accesses_with_declaring_class=false
+sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
+sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
+sp_cleanup.qualify_static_member_accesses_with_declaring_class=false
+sp_cleanup.qualify_static_method_accesses_with_declaring_class=false
+sp_cleanup.remove_private_constructors=true
+sp_cleanup.remove_trailing_whitespaces=true
+sp_cleanup.remove_trailing_whitespaces_all=true
+sp_cleanup.remove_trailing_whitespaces_ignore_empty=false
+sp_cleanup.remove_unnecessary_casts=true
+sp_cleanup.remove_unnecessary_nls_tags=true
+sp_cleanup.remove_unused_imports=true
+sp_cleanup.remove_unused_local_variables=false
+sp_cleanup.remove_unused_private_fields=true
+sp_cleanup.remove_unused_private_members=false
+sp_cleanup.remove_unused_private_methods=true
+sp_cleanup.remove_unused_private_types=true
+sp_cleanup.sort_members=false
+sp_cleanup.sort_members_all=false
+sp_cleanup.use_blocks=true
+sp_cleanup.use_blocks_only_for_return_and_throw=false
+sp_cleanup.use_parentheses_in_expressions=true
+sp_cleanup.use_this_for_non_static_field_access=true
+sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true
+sp_cleanup.use_this_for_non_static_method_access=true
+sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true
diff --git a/plugins/org.eclipse.emf.cdo.dawn.ecoretools.diagram.dawn/about.properties b/plugins/org.eclipse.emf.cdo.dawn.ecoretools.diagram.dawn/about.properties index 1f04c456ff..96bfbbd148 100644 --- a/plugins/org.eclipse.emf.cdo.dawn.ecoretools.diagram.dawn/about.properties +++ b/plugins/org.eclipse.emf.cdo.dawn.ecoretools.diagram.dawn/about.properties @@ -1,31 +1,31 @@ -# Copyright (c) 2004 - 2011 Eike Stepper (Berlin, Germany) and others. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 -# which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/epl-v10.html -# -# Contributors: -# Eike Stepper - initial API and implementation - -# NLS_MESSAGEFORMAT_VAR - -# ============================================================================== -# Do not change the properties between this line and the last line containing: -# %%% END OF TRANSLATED PROPERTIES %%% -# Instead, either redefine an existing property, or create a new property, -# append it to the end of the file, and change the code to use the new name. -# ============================================================================== - -featureName = CDO Dawn EcoreTools Diagram Extension -featureText = CDO Dawn EcoreTools Diagram Extension\n\ -Version: {featureVersion}\n\ -Build id: {0}\n\ -\n\ -Copyright (c) 2004 - 2011 Eike Stepper (Berlin, Germany) and others. All rights reserved.\n\ -\n\ -Visit http://www.eclipse.org/cdo - -# ============================================================================== -# %%% END OF TRANSLATED PROPERTIES %%% -# The above properties have been shipped for translation. -# ============================================================================== +# Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# Eike Stepper - initial API and implementation
+
+# NLS_MESSAGEFORMAT_VAR
+
+# ==============================================================================
+# Do not change the properties between this line and the last line containing:
+# %%% END OF TRANSLATED PROPERTIES %%%
+# Instead, either redefine an existing property, or create a new property,
+# append it to the end of the file, and change the code to use the new name.
+# ==============================================================================
+
+featureName = CDO Dawn EcoreTools Diagram Extension
+featureText = CDO Dawn EcoreTools Diagram Extension\n\
+Version: {featureVersion}\n\
+Build id: {0}\n\
+\n\
+Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others. All rights reserved.\n\
+\n\
+Visit http://www.eclipse.org/cdo
+
+# ==============================================================================
+# %%% END OF TRANSLATED PROPERTIES %%%
+# The above properties have been shipped for translation.
+# ==============================================================================
diff --git a/plugins/org.eclipse.emf.cdo.dawn.ecoretools.diagram.dawn/build.properties b/plugins/org.eclipse.emf.cdo.dawn.ecoretools.diagram.dawn/build.properties index c787519990..ec8f858ecf 100644 --- a/plugins/org.eclipse.emf.cdo.dawn.ecoretools.diagram.dawn/build.properties +++ b/plugins/org.eclipse.emf.cdo.dawn.ecoretools.diagram.dawn/build.properties @@ -1,25 +1,25 @@ -# Copyright (c) 2004 - 2011 Eike Stepper (Berlin, Germany) and others. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 -# which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/epl-v10.html -# -# Contributors: -# Martin Fluegge - initial API and implementation - -# NLS_MESSAGEFORMAT_VAR -source.. = src/ -output.. = bin/ -bin.includes = META-INF/,\ - .,\ - fragment.properties,\ - about.html,\ - copyright.txt,\ - .options,\ - about.ini,\ - about.mappings,\ - about.properties,\ - fragment.xml,\ - modeling32.png -src.includes = about.html,\ - copyright.txt +# Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# Martin Fluegge - initial API and implementation
+
+# NLS_MESSAGEFORMAT_VAR
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ fragment.properties,\
+ about.html,\
+ copyright.txt,\
+ .options,\
+ about.ini,\
+ about.mappings,\
+ about.properties,\
+ fragment.xml,\
+ modeling32.png
+src.includes = about.html,\
+ copyright.txt
diff --git a/plugins/org.eclipse.emf.cdo.dawn.ecoretools.diagram.dawn/copyright.txt b/plugins/org.eclipse.emf.cdo.dawn.ecoretools.diagram.dawn/copyright.txt index 3a0863e096..9cbb3ba084 100644 --- a/plugins/org.eclipse.emf.cdo.dawn.ecoretools.diagram.dawn/copyright.txt +++ b/plugins/org.eclipse.emf.cdo.dawn.ecoretools.diagram.dawn/copyright.txt @@ -1,8 +1,8 @@ -Copyright (c) 2004 - 2011 Eike Stepper(Berlin, Germany) and others. -All rights reserved. This program and the accompanying materials -are made available under the terms of the Eclipse Public License v1.0 -which accompanies this distribution, and is available at -http://www.eclipse.org/legal/epl-v10.html - -Contributors: +Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+All rights reserved. This program and the accompanying materials
+are made available under the terms of the Eclipse Public License v1.0
+which accompanies this distribution, and is available at
+http://www.eclipse.org/legal/epl-v10.html
+
+Contributors:
Martin Fluegge - initial API and implementation
\ No newline at end of file diff --git a/plugins/org.eclipse.emf.cdo.dawn.ecoretools.diagram.dawn/fragment.properties b/plugins/org.eclipse.emf.cdo.dawn.ecoretools.diagram.dawn/fragment.properties index ff0ff4d83f..faaefe4644 100644 --- a/plugins/org.eclipse.emf.cdo.dawn.ecoretools.diagram.dawn/fragment.properties +++ b/plugins/org.eclipse.emf.cdo.dawn.ecoretools.diagram.dawn/fragment.properties @@ -1,11 +1,11 @@ -# Copyright (c) 2004 - 2011 Eike Stepper (Berlin, Germany) and others. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 -# which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/epl-v10.html -# -# Contributors: -# Martin Fluegge - initial API and implementation - -pluginName = CDO Dawn EcoreTools Diagram Extension -providerName = Eclipse Modeling Project +# Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# Martin Fluegge - initial API and implementation
+
+pluginName = CDO Dawn EcoreTools Diagram Extension
+providerName = Eclipse Modeling Project
diff --git a/plugins/org.eclipse.emf.cdo.dawn.ecoretools.diagram.dawn/fragment.xml b/plugins/org.eclipse.emf.cdo.dawn.ecoretools.diagram.dawn/fragment.xml index f723a2ccda..cc2c525c38 100644 --- a/plugins/org.eclipse.emf.cdo.dawn.ecoretools.diagram.dawn/fragment.xml +++ b/plugins/org.eclipse.emf.cdo.dawn.ecoretools.diagram.dawn/fragment.xml @@ -1,81 +1,81 @@ -<?xml version="1.0" encoding="UTF-8"?> -<?eclipse version="3.4"?> -<!-- - Copyright (c) 2004 - 2011 Eike Stepper (Berlin, Germany) and others. - All rights reserved. This program and the accompanying materials - are made available under the terms of the Eclipse Public License v1.0 - which accompanies this distribution, and is available at - http://www.eclipse.org/legal/epl-v10.html - - Contributors: - Martin Fluegge - initial API and implementation ---> -<fragment> -<extension - point="org.eclipse.ui.editors"> - <editor - class="org.eclipse.emf.cdo.dawn.ecoretools.diagram.part.DawnEcoreDiagramEditor" - contributorClass="org.eclipse.emf.ecoretools.diagram.part.EcoreDiagramActionBarContributor" - default="true" - extensions="ecorediag" - icon="platform:/plugin/org.eclipse.emf.ecoretools.diagram/icons/obj16/EcoreDiagramFile.gif" - id="org.eclipse.emf.cdo.dawn.ecoretools.diagram.part.DawnEcoreDiagramEditor" - matchingStrategy="org.eclipse.emf.ecoretools.diagram.part.EcoreMatchingStrategy" - name="Dawn Ecore Diagram"> - </editor> - </extension> - <extension - point="org.eclipse.ui.newWizards"> - <wizard - category="org.eclipse.emf.cdo.dawn.ui.category.examples" - class="org.eclipse.emf.cdo.dawn.ecoretools.diagram.part.DawnEcoreCreationWizard" - icon="platform:/plugin/org.eclipse.emf.ecoretools.diagram/icons/obj16/EcoreDiagramFile.gif" - id="org.eclipse.emf.cdo.dawn.ecoretools.diagram.dawn.part.EcoreCreationWizardID" - name="Dawn Ecore Diagram"> - <description> - description body text - </description> - </wizard> - - </extension> - <extension - point="org.eclipse.gmf.runtime.diagram.ui.resources.editor.documentProviders"> - <provider - class="org.eclipse.emf.cdo.dawn.ecoretools.diagram.part.DawnEcoreDocumentProvider" - documentType="org.eclipse.gmf.runtime.diagram.ui.editor.IDocument" - id="org.eclipse.emf.ecoretools.diagram.part" - inputTypes="org.eclipse.emf.common.ui .URIEditorInput"> - </provider> - </extension> - <extension - point="org.eclipse.gmf.runtime.diagram.ui.editpolicyProviders"> - <editpolicyProvider - class="org.eclipse.emf.cdo.dawn.ecoretools.diagram.providers.DawnEcoreEditPolicyProvider"> - <Priority - name="Low"> - </Priority> - </editpolicyProvider> - </extension> - <extension point="org.eclipse.gmf.runtime.diagram.ui.editpartProviders" id="ep-provider"> - <?gmfgen generated="true"?> - <editpartProvider class="org.eclipse.emf.cdo.dawn.ecoretools.diagram.providers.DawnEcoreEditPartProvider"> - <Priority name="Medium"/> - <object class="org.eclipse.gmf.runtime.notation.Diagram" id="generated-diagram"> - <method name="getType()" value="EcoreTools"/> - </object> - <object class="org.eclipse.gmf.runtime.notation.Node" id="generated-nodes"> - <method name="getType()" value="1001,1002,1003,1004,1005,2001,2002,2003,2004,2005,2006,2007"/> - </object> - <object class="org.eclipse.gmf.runtime.notation.Edge" id="generated-links"> - <method name="getType()" value="3001,3002,3003"/> - </object> - <object class="org.eclipse.gmf.runtime.notation.Node" id="generated-labels"> - <method name="getType()" value="4001,4006,4007,4008,4009,4010,4002,4003,4004,4005"/> - </object> - <object class="org.eclipse.gmf.runtime.notation.Node" id="generated-compartments"> - <method name="getType()" value="5001,5002,5003,5004,5005,5006,5007,5008"/> - </object> - <context views="generated-diagram,generated-nodes,generated-links,generated-labels,generated-compartments"/> - </editpartProvider> - </extension> -</fragment> +<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<!--
+ Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+ Martin Fluegge - initial API and implementation
+-->
+<fragment>
+<extension
+ point="org.eclipse.ui.editors">
+ <editor
+ class="org.eclipse.emf.cdo.dawn.ecoretools.diagram.part.DawnEcoreDiagramEditor"
+ contributorClass="org.eclipse.emf.ecoretools.diagram.part.EcoreDiagramActionBarContributor"
+ default="true"
+ extensions="ecorediag"
+ icon="platform:/plugin/org.eclipse.emf.ecoretools.diagram/icons/obj16/EcoreDiagramFile.gif"
+ id="org.eclipse.emf.cdo.dawn.ecoretools.diagram.part.DawnEcoreDiagramEditor"
+ matchingStrategy="org.eclipse.emf.ecoretools.diagram.part.EcoreMatchingStrategy"
+ name="Dawn Ecore Diagram">
+ </editor>
+ </extension>
+ <extension
+ point="org.eclipse.ui.newWizards">
+ <wizard
+ category="org.eclipse.emf.cdo.dawn.ui.category.examples"
+ class="org.eclipse.emf.cdo.dawn.ecoretools.diagram.part.DawnEcoreCreationWizard"
+ icon="platform:/plugin/org.eclipse.emf.ecoretools.diagram/icons/obj16/EcoreDiagramFile.gif"
+ id="org.eclipse.emf.cdo.dawn.ecoretools.diagram.dawn.part.EcoreCreationWizardID"
+ name="Dawn Ecore Diagram">
+ <description>
+ description body text
+ </description>
+ </wizard>
+
+ </extension>
+ <extension
+ point="org.eclipse.gmf.runtime.diagram.ui.resources.editor.documentProviders">
+ <provider
+ class="org.eclipse.emf.cdo.dawn.ecoretools.diagram.part.DawnEcoreDocumentProvider"
+ documentType="org.eclipse.gmf.runtime.diagram.ui.editor.IDocument"
+ id="org.eclipse.emf.ecoretools.diagram.part"
+ inputTypes="org.eclipse.emf.common.ui .URIEditorInput">
+ </provider>
+ </extension>
+ <extension
+ point="org.eclipse.gmf.runtime.diagram.ui.editpolicyProviders">
+ <editpolicyProvider
+ class="org.eclipse.emf.cdo.dawn.ecoretools.diagram.providers.DawnEcoreEditPolicyProvider">
+ <Priority
+ name="Low">
+ </Priority>
+ </editpolicyProvider>
+ </extension>
+ <extension point="org.eclipse.gmf.runtime.diagram.ui.editpartProviders" id="ep-provider">
+ <?gmfgen generated="true"?>
+ <editpartProvider class="org.eclipse.emf.cdo.dawn.ecoretools.diagram.providers.DawnEcoreEditPartProvider">
+ <Priority name="Medium"/>
+ <object class="org.eclipse.gmf.runtime.notation.Diagram" id="generated-diagram">
+ <method name="getType()" value="EcoreTools"/>
+ </object>
+ <object class="org.eclipse.gmf.runtime.notation.Node" id="generated-nodes">
+ <method name="getType()" value="1001,1002,1003,1004,1005,2001,2002,2003,2004,2005,2006,2007"/>
+ </object>
+ <object class="org.eclipse.gmf.runtime.notation.Edge" id="generated-links">
+ <method name="getType()" value="3001,3002,3003"/>
+ </object>
+ <object class="org.eclipse.gmf.runtime.notation.Node" id="generated-labels">
+ <method name="getType()" value="4001,4006,4007,4008,4009,4010,4002,4003,4004,4005"/>
+ </object>
+ <object class="org.eclipse.gmf.runtime.notation.Node" id="generated-compartments">
+ <method name="getType()" value="5001,5002,5003,5004,5005,5006,5007,5008"/>
+ </object>
+ <context views="generated-diagram,generated-nodes,generated-links,generated-labels,generated-compartments"/>
+ </editpartProvider>
+ </extension>
+</fragment>
diff --git a/plugins/org.eclipse.emf.cdo.dawn.ecoretools.diagram.dawn/src/org/eclipse/emf/cdo/dawn/ecoretools/diagram/edit/parts/DawnECoreRootEditPart.java b/plugins/org.eclipse.emf.cdo.dawn.ecoretools.diagram.dawn/src/org/eclipse/emf/cdo/dawn/ecoretools/diagram/edit/parts/DawnECoreRootEditPart.java index a40ce81f09..c6776214c0 100644 --- a/plugins/org.eclipse.emf.cdo.dawn.ecoretools.diagram.dawn/src/org/eclipse/emf/cdo/dawn/ecoretools/diagram/edit/parts/DawnECoreRootEditPart.java +++ b/plugins/org.eclipse.emf.cdo.dawn.ecoretools.diagram.dawn/src/org/eclipse/emf/cdo/dawn/ecoretools/diagram/edit/parts/DawnECoreRootEditPart.java @@ -1,45 +1,45 @@ -/* - * Copyright (c) 2004 - 2011 Eike Stepper (Berlin, Germany). - * 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: - * Martin Fluegge - initial API and implementation - */ -package org.eclipse.emf.cdo.dawn.ecoretools.diagram.edit.parts; - -import org.eclipse.emf.cdo.dawn.gmf.synchronize.DawnConflictHelper; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecoretools.diagram.edit.parts.EPackageEditPart; -import org.eclipse.emf.ecoretools.diagram.part.EcoreDiagramEditorPlugin; - -import org.eclipse.gef.EditPart; -import org.eclipse.gmf.runtime.notation.View; - -/** - * @author Martin Fluegge - */ -public class DawnECoreRootEditPart extends EPackageEditPart -{ - /** - * @generated - */ - public DawnECoreRootEditPart(View view) - { - super(view); - EcoreDiagramEditorPlugin.getInstance().logInfo("Using DawnEcoreRootEditPart instead of the original one"); - } - - @Override - protected void removeChild(EditPart child) - { - if (DawnConflictHelper.isConflicted((EObject)child.getModel())) - { - return; - } - super.removeChild(child); - } -} +/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Martin Fluegge - initial API and implementation
+ */
+package org.eclipse.emf.cdo.dawn.ecoretools.diagram.edit.parts;
+
+import org.eclipse.emf.cdo.dawn.gmf.synchronize.DawnConflictHelper;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EPackageEditPart;
+import org.eclipse.emf.ecoretools.diagram.part.EcoreDiagramEditorPlugin;
+
+import org.eclipse.gef.EditPart;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * @author Martin Fluegge
+ */
+public class DawnECoreRootEditPart extends EPackageEditPart
+{
+ /**
+ * @generated
+ */
+ public DawnECoreRootEditPart(View view)
+ {
+ super(view);
+ EcoreDiagramEditorPlugin.getInstance().logInfo("Using DawnEcoreRootEditPart instead of the original one");
+ }
+
+ @Override
+ protected void removeChild(EditPart child)
+ {
+ if (DawnConflictHelper.isConflicted((EObject)child.getModel()))
+ {
+ return;
+ }
+ super.removeChild(child);
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.dawn.ecoretools.diagram.dawn/src/org/eclipse/emf/cdo/dawn/ecoretools/diagram/edit/parts/DawnEcoreEditPartFactory.java b/plugins/org.eclipse.emf.cdo.dawn.ecoretools.diagram.dawn/src/org/eclipse/emf/cdo/dawn/ecoretools/diagram/edit/parts/DawnEcoreEditPartFactory.java index 6edbebdfa9..42e81d967c 100644 --- a/plugins/org.eclipse.emf.cdo.dawn.ecoretools.diagram.dawn/src/org/eclipse/emf/cdo/dawn/ecoretools/diagram/edit/parts/DawnEcoreEditPartFactory.java +++ b/plugins/org.eclipse.emf.cdo.dawn.ecoretools.diagram.dawn/src/org/eclipse/emf/cdo/dawn/ecoretools/diagram/edit/parts/DawnEcoreEditPartFactory.java @@ -1,43 +1,43 @@ -/* - * Copyright (c) 2004 - 2011 Eike Stepper (Berlin, Germany). - * 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: - * Martin Fluegge - initial API and implementation - */ -package org.eclipse.emf.cdo.dawn.ecoretools.diagram.edit.parts; - -import org.eclipse.emf.ecoretools.diagram.edit.parts.EcoreEditPartFactory; -import org.eclipse.emf.ecoretools.diagram.part.EcoreDiagramEditorPlugin; -import org.eclipse.emf.ecoretools.diagram.part.EcoreVisualIDRegistry; - -import org.eclipse.gef.EditPart; -import org.eclipse.gmf.runtime.notation.View; - -public class DawnEcoreEditPartFactory extends EcoreEditPartFactory -{ - public DawnEcoreEditPartFactory() - { - super(); - EcoreDiagramEditorPlugin.getInstance().logInfo("Using DawnEcoreEditPartFactory instead of the original one"); - } - - @Override - public EditPart createEditPart(EditPart context, Object model) - { - if (model instanceof View) - { - View view = (View)model; - switch (EcoreVisualIDRegistry.getVisualID(view)) - { - case DawnECoreRootEditPart.VISUAL_ID: - return new DawnECoreRootEditPart(view); - } - } - - return super.createEditPart(context, model); - } -} +/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Martin Fluegge - initial API and implementation
+ */
+package org.eclipse.emf.cdo.dawn.ecoretools.diagram.edit.parts;
+
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EcoreEditPartFactory;
+import org.eclipse.emf.ecoretools.diagram.part.EcoreDiagramEditorPlugin;
+import org.eclipse.emf.ecoretools.diagram.part.EcoreVisualIDRegistry;
+
+import org.eclipse.gef.EditPart;
+import org.eclipse.gmf.runtime.notation.View;
+
+public class DawnEcoreEditPartFactory extends EcoreEditPartFactory
+{
+ public DawnEcoreEditPartFactory()
+ {
+ super();
+ EcoreDiagramEditorPlugin.getInstance().logInfo("Using DawnEcoreEditPartFactory instead of the original one");
+ }
+
+ @Override
+ public EditPart createEditPart(EditPart context, Object model)
+ {
+ if (model instanceof View)
+ {
+ View view = (View)model;
+ switch (EcoreVisualIDRegistry.getVisualID(view))
+ {
+ case DawnECoreRootEditPart.VISUAL_ID:
+ return new DawnECoreRootEditPart(view);
+ }
+ }
+
+ return super.createEditPart(context, model);
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.dawn.ecoretools.diagram.dawn/src/org/eclipse/emf/cdo/dawn/ecoretools/diagram/edit/policies/DawnECoreRootCanonicalEditPolicy.java b/plugins/org.eclipse.emf.cdo.dawn.ecoretools.diagram.dawn/src/org/eclipse/emf/cdo/dawn/ecoretools/diagram/edit/policies/DawnECoreRootCanonicalEditPolicy.java index 21c2893fd1..d5ca110e3a 100644 --- a/plugins/org.eclipse.emf.cdo.dawn.ecoretools.diagram.dawn/src/org/eclipse/emf/cdo/dawn/ecoretools/diagram/edit/policies/DawnECoreRootCanonicalEditPolicy.java +++ b/plugins/org.eclipse.emf.cdo.dawn.ecoretools.diagram.dawn/src/org/eclipse/emf/cdo/dawn/ecoretools/diagram/edit/policies/DawnECoreRootCanonicalEditPolicy.java @@ -1,80 +1,80 @@ -/* - * Copyright (c) 2004 - 2011 Eike Stepper (Berlin, Germany). - * 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: - * Martin Fluegge - initial API and implementation - */ -package org.eclipse.emf.cdo.dawn.ecoretools.diagram.edit.policies; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecoretools.diagram.edit.policies.EPackageCanonicalEditPolicy; -import org.eclipse.emf.ecoretools.diagram.part.EcoreDiagramEditorPlugin; - -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequest; -import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequest.ViewDescriptor; -import org.eclipse.gmf.runtime.notation.View; - -import java.util.ArrayList; -import java.util.LinkedList; -import java.util.List; - -/** - * @author Martin Fluegge - */ -public class DawnECoreRootCanonicalEditPolicy extends EPackageCanonicalEditPolicy -{ - - public DawnECoreRootCanonicalEditPolicy() - { - super(); - EcoreDiagramEditorPlugin.getInstance().logInfo("Running DawnEcoreCanonicalEditPolicy instead of original one"); - } - - @Override - protected CreateViewRequest getCreateViewRequest(List<ViewDescriptor> descriptors) - { - List<View> viewChildren = getViewChildren(); - - List<ViewDescriptor> tbr = new ArrayList<CreateViewRequest.ViewDescriptor>(); - - for (ViewDescriptor desc : descriptors) - { - EObject obj = (EObject)((CanonicalElementAdapter)desc.getElementAdapter()).getRealObject(); - - boolean found = false; - - for (View view : viewChildren) - { - if (view.getElement().equals(obj)) - { - found = true; - break; - } - } - if (!found) - { - tbr.add(desc); - } - } - - descriptors.removeAll(tbr); - - return new CreateViewRequest(descriptors); - } - - @Override - protected void refreshSemantic() - { - deleteOrphanedViews(); - List<IAdaptable> createdConnectionViews = new LinkedList<IAdaptable>(); - createdConnectionViews.addAll(refreshSemanticConnections()); - // createdConnectionViews.addAll(refreshConnections()); - - makeViewsImmutable(createdConnectionViews); - } -} +/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Martin Fluegge - initial API and implementation
+ */
+package org.eclipse.emf.cdo.dawn.ecoretools.diagram.edit.policies;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecoretools.diagram.edit.policies.EPackageCanonicalEditPolicy;
+import org.eclipse.emf.ecoretools.diagram.part.EcoreDiagramEditorPlugin;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequest;
+import org.eclipse.gmf.runtime.diagram.ui.requests.CreateViewRequest.ViewDescriptor;
+import org.eclipse.gmf.runtime.notation.View;
+
+import java.util.ArrayList;
+import java.util.LinkedList;
+import java.util.List;
+
+/**
+ * @author Martin Fluegge
+ */
+public class DawnECoreRootCanonicalEditPolicy extends EPackageCanonicalEditPolicy
+{
+
+ public DawnECoreRootCanonicalEditPolicy()
+ {
+ super();
+ EcoreDiagramEditorPlugin.getInstance().logInfo("Running DawnEcoreCanonicalEditPolicy instead of original one");
+ }
+
+ @Override
+ protected CreateViewRequest getCreateViewRequest(List<ViewDescriptor> descriptors)
+ {
+ List<View> viewChildren = getViewChildren();
+
+ List<ViewDescriptor> tbr = new ArrayList<CreateViewRequest.ViewDescriptor>();
+
+ for (ViewDescriptor desc : descriptors)
+ {
+ EObject obj = (EObject)((CanonicalElementAdapter)desc.getElementAdapter()).getRealObject();
+
+ boolean found = false;
+
+ for (View view : viewChildren)
+ {
+ if (view.getElement().equals(obj))
+ {
+ found = true;
+ break;
+ }
+ }
+ if (!found)
+ {
+ tbr.add(desc);
+ }
+ }
+
+ descriptors.removeAll(tbr);
+
+ return new CreateViewRequest(descriptors);
+ }
+
+ @Override
+ protected void refreshSemantic()
+ {
+ deleteOrphanedViews();
+ List<IAdaptable> createdConnectionViews = new LinkedList<IAdaptable>();
+ createdConnectionViews.addAll(refreshSemanticConnections());
+ // createdConnectionViews.addAll(refreshConnections());
+
+ makeViewsImmutable(createdConnectionViews);
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.dawn.ecoretools.diagram.dawn/src/org/eclipse/emf/cdo/dawn/ecoretools/diagram/part/DawnEcoreCreationWizard.java b/plugins/org.eclipse.emf.cdo.dawn.ecoretools.diagram.dawn/src/org/eclipse/emf/cdo/dawn/ecoretools/diagram/part/DawnEcoreCreationWizard.java index d5e1d96c66..07a2663f97 100644 --- a/plugins/org.eclipse.emf.cdo.dawn.ecoretools.diagram.dawn/src/org/eclipse/emf/cdo/dawn/ecoretools/diagram/part/DawnEcoreCreationWizard.java +++ b/plugins/org.eclipse.emf.cdo.dawn.ecoretools.diagram.dawn/src/org/eclipse/emf/cdo/dawn/ecoretools/diagram/part/DawnEcoreCreationWizard.java @@ -1,147 +1,147 @@ -/* - * Copyright (c) 2004 - 2011 Eike Stepper (Berlin, Germany). - * 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: - * Martin Fluegge - initial API and implementation - */ -package org.eclipse.emf.cdo.dawn.ecoretools.diagram.part; - -import org.eclipse.emf.cdo.dawn.preferences.PreferenceConstants; -import org.eclipse.emf.cdo.dawn.util.connection.CDOConnectionUtil; -import org.eclipse.emf.cdo.session.CDOSession; -import org.eclipse.emf.cdo.view.CDOView; - -import org.eclipse.emf.ecore.resource.Resource; -import org.eclipse.emf.ecoretools.diagram.part.EcoreCreationWizard; -import org.eclipse.emf.ecoretools.diagram.part.EcoreDiagramEditor; -import org.eclipse.emf.ecoretools.diagram.part.EcoreDiagramEditorPlugin; -import org.eclipse.emf.ecoretools.diagram.part.EcoreDiagramEditorUtil; -import org.eclipse.emf.ecoretools.diagram.part.Messages; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.Path; -import org.eclipse.jface.dialogs.ErrorDialog; -import org.eclipse.jface.operation.IRunnableWithProgress; -import org.eclipse.ui.IWorkbenchPage; -import org.eclipse.ui.PartInitException; -import org.eclipse.ui.PlatformUI; -import org.eclipse.ui.actions.WorkspaceModifyOperation; -import org.eclipse.ui.part.FileEditorInput; - -import java.lang.reflect.InvocationTargetException; - -/** - * @author Martin Fluegge - */ -public class DawnEcoreCreationWizard extends EcoreCreationWizard -{ - private CDOView view; - - private DawnEcoreCreationWizardPage diagPage; - - public DawnEcoreCreationWizard() - { - super(); - CDOConnectionUtil.instance.init(PreferenceConstants.getRepositoryName(), PreferenceConstants.getProtocol(), - PreferenceConstants.getServerName()); - CDOSession session = CDOConnectionUtil.instance.openSession(); - view = session.openTransaction(); - } - - @Override - public boolean performFinish() - { - IRunnableWithProgress op = new WorkspaceModifyOperation(null) - { - @Override - protected void execute(IProgressMonitor monitor) throws CoreException, InterruptedException - { - if (diagPage.isNewModel()) - { - diagram = EcoreDiagramEditorUtil.createDiagram(diagPage.getDiagramModelURI(), diagPage.getDomainModelURI(), - monitor); - } - else - { - diagram = DawnEcoreDiagramEditorUtil.createDiagramOnly(diagPage.getDiagramModelURI(), - diagPage.getDomainModelURI(), diagPage.getDiagramEObject(), diagPage.isInitialized(), monitor); - } - if (diagram != null) - { - try - { - DawnEcoreDiagramEditorUtil.openDiagram(diagram); - } - catch (PartInitException e) - { - ErrorDialog.openError(getContainer().getShell(), Messages.EcoreCreationWizardOpenEditorError, null, - e.getStatus()); - } - } - } - }; - try - { - getContainer().run(false, true, op); - } - catch (InterruptedException e) - { - return false; - } - catch (InvocationTargetException e) - { - if (e.getTargetException() instanceof CoreException) - { - ErrorDialog.openError(getContainer().getShell(), Messages.EcoreCreationWizardCreationError, null, - ((CoreException)e.getTargetException()).getStatus()); - } - else - { - EcoreDiagramEditorPlugin.getInstance().logError("Error creating diagram", e.getTargetException()); //$NON-NLS-1$ - } - return false; - } - return diagram != null; - } - - @Override - public void addPages() - { - diagPage = new DawnEcoreCreationWizardPage("NewEcoreToolsDiagram", getSelection(), view); //$NON-NLS-1$ - diagPage.setTitle(Messages.EcoreCreationWizard_DiagramModelFilePageTitle); - diagPage.setDescription(Messages.EcoreCreationWizard_DiagramModelFilePageDescription); - addPage(diagPage); - } - - @Override - public void dispose() - { - view.close(); - } - - @Override - public boolean canFinish() - { - return true; - } - - public static boolean openDiagram(Resource diagram) throws PartInitException - { - String path = diagram.getURI().toPlatformString(true); - IResource workspaceResource = ResourcesPlugin.getWorkspace().getRoot().findMember(new Path(path)); - if (workspaceResource instanceof IFile) - { - IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(); - return null != page.openEditor(new FileEditorInput((IFile)workspaceResource), EcoreDiagramEditor.ID); - } - return false; - } -} +/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Martin Fluegge - initial API and implementation
+ */
+package org.eclipse.emf.cdo.dawn.ecoretools.diagram.part;
+
+import org.eclipse.emf.cdo.dawn.preferences.PreferenceConstants;
+import org.eclipse.emf.cdo.dawn.util.connection.CDOConnectionUtil;
+import org.eclipse.emf.cdo.session.CDOSession;
+import org.eclipse.emf.cdo.view.CDOView;
+
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecoretools.diagram.part.EcoreCreationWizard;
+import org.eclipse.emf.ecoretools.diagram.part.EcoreDiagramEditor;
+import org.eclipse.emf.ecoretools.diagram.part.EcoreDiagramEditorPlugin;
+import org.eclipse.emf.ecoretools.diagram.part.EcoreDiagramEditorUtil;
+import org.eclipse.emf.ecoretools.diagram.part.Messages;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.jface.dialogs.ErrorDialog;
+import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.actions.WorkspaceModifyOperation;
+import org.eclipse.ui.part.FileEditorInput;
+
+import java.lang.reflect.InvocationTargetException;
+
+/**
+ * @author Martin Fluegge
+ */
+public class DawnEcoreCreationWizard extends EcoreCreationWizard
+{
+ private CDOView view;
+
+ private DawnEcoreCreationWizardPage diagPage;
+
+ public DawnEcoreCreationWizard()
+ {
+ super();
+ CDOConnectionUtil.instance.init(PreferenceConstants.getRepositoryName(), PreferenceConstants.getProtocol(),
+ PreferenceConstants.getServerName());
+ CDOSession session = CDOConnectionUtil.instance.openSession();
+ view = session.openTransaction();
+ }
+
+ @Override
+ public boolean performFinish()
+ {
+ IRunnableWithProgress op = new WorkspaceModifyOperation(null)
+ {
+ @Override
+ protected void execute(IProgressMonitor monitor) throws CoreException, InterruptedException
+ {
+ if (diagPage.isNewModel())
+ {
+ diagram = EcoreDiagramEditorUtil.createDiagram(diagPage.getDiagramModelURI(), diagPage.getDomainModelURI(),
+ monitor);
+ }
+ else
+ {
+ diagram = DawnEcoreDiagramEditorUtil.createDiagramOnly(diagPage.getDiagramModelURI(),
+ diagPage.getDomainModelURI(), diagPage.getDiagramEObject(), diagPage.isInitialized(), monitor);
+ }
+ if (diagram != null)
+ {
+ try
+ {
+ DawnEcoreDiagramEditorUtil.openDiagram(diagram);
+ }
+ catch (PartInitException e)
+ {
+ ErrorDialog.openError(getContainer().getShell(), Messages.EcoreCreationWizardOpenEditorError, null,
+ e.getStatus());
+ }
+ }
+ }
+ };
+ try
+ {
+ getContainer().run(false, true, op);
+ }
+ catch (InterruptedException e)
+ {
+ return false;
+ }
+ catch (InvocationTargetException e)
+ {
+ if (e.getTargetException() instanceof CoreException)
+ {
+ ErrorDialog.openError(getContainer().getShell(), Messages.EcoreCreationWizardCreationError, null,
+ ((CoreException)e.getTargetException()).getStatus());
+ }
+ else
+ {
+ EcoreDiagramEditorPlugin.getInstance().logError("Error creating diagram", e.getTargetException()); //$NON-NLS-1$
+ }
+ return false;
+ }
+ return diagram != null;
+ }
+
+ @Override
+ public void addPages()
+ {
+ diagPage = new DawnEcoreCreationWizardPage("NewEcoreToolsDiagram", getSelection(), view); //$NON-NLS-1$
+ diagPage.setTitle(Messages.EcoreCreationWizard_DiagramModelFilePageTitle);
+ diagPage.setDescription(Messages.EcoreCreationWizard_DiagramModelFilePageDescription);
+ addPage(diagPage);
+ }
+
+ @Override
+ public void dispose()
+ {
+ view.close();
+ }
+
+ @Override
+ public boolean canFinish()
+ {
+ return true;
+ }
+
+ public static boolean openDiagram(Resource diagram) throws PartInitException
+ {
+ String path = diagram.getURI().toPlatformString(true);
+ IResource workspaceResource = ResourcesPlugin.getWorkspace().getRoot().findMember(new Path(path));
+ if (workspaceResource instanceof IFile)
+ {
+ IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
+ return null != page.openEditor(new FileEditorInput((IFile)workspaceResource), EcoreDiagramEditor.ID);
+ }
+ return false;
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.dawn.ecoretools.diagram.dawn/src/org/eclipse/emf/cdo/dawn/ecoretools/diagram/part/DawnEcoreCreationWizardPage.java b/plugins/org.eclipse.emf.cdo.dawn.ecoretools.diagram.dawn/src/org/eclipse/emf/cdo/dawn/ecoretools/diagram/part/DawnEcoreCreationWizardPage.java index 17ba8bb28d..d8e9f0ef1c 100644 --- a/plugins/org.eclipse.emf.cdo.dawn.ecoretools.diagram.dawn/src/org/eclipse/emf/cdo/dawn/ecoretools/diagram/part/DawnEcoreCreationWizardPage.java +++ b/plugins/org.eclipse.emf.cdo.dawn.ecoretools.diagram.dawn/src/org/eclipse/emf/cdo/dawn/ecoretools/diagram/part/DawnEcoreCreationWizardPage.java @@ -1,5 +1,5 @@ /*
- * Copyright (c) 2004 - 2011 Eike Stepper (Berlin, Germany).
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
diff --git a/plugins/org.eclipse.emf.cdo.dawn.ecoretools.diagram.dawn/src/org/eclipse/emf/cdo/dawn/ecoretools/diagram/part/DawnEcoreDiagramEditor.java b/plugins/org.eclipse.emf.cdo.dawn.ecoretools.diagram.dawn/src/org/eclipse/emf/cdo/dawn/ecoretools/diagram/part/DawnEcoreDiagramEditor.java index 798c75acd5..97d59b16a6 100644 --- a/plugins/org.eclipse.emf.cdo.dawn.ecoretools.diagram.dawn/src/org/eclipse/emf/cdo/dawn/ecoretools/diagram/part/DawnEcoreDiagramEditor.java +++ b/plugins/org.eclipse.emf.cdo.dawn.ecoretools.diagram.dawn/src/org/eclipse/emf/cdo/dawn/ecoretools/diagram/part/DawnEcoreDiagramEditor.java @@ -1,172 +1,172 @@ -/* - * Copyright (c) 2004 - 2011 Eike Stepper (Berlin, Germany). - * 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: - * Martin Fluegge - initial API and implementation - */ -package org.eclipse.emf.cdo.dawn.ecoretools.diagram.part; - -import org.eclipse.emf.cdo.dawn.editors.IDawnEditor; -import org.eclipse.emf.cdo.dawn.editors.IDawnEditorSupport; -import org.eclipse.emf.cdo.dawn.gmf.editors.impl.DawnGMFEditorSupport; -import org.eclipse.emf.cdo.dawn.ui.DawnEditorInput; -import org.eclipse.emf.cdo.ui.CDOEditorInput; -import org.eclipse.emf.cdo.view.CDOView; - -import org.eclipse.net4j.util.transaction.TransactionException; - -import org.eclipse.emf.common.ui.URIEditorInput; -import org.eclipse.emf.ecoretools.diagram.part.EcoreDiagramEditor; -import org.eclipse.emf.ecoretools.diagram.part.EcoreDiagramEditorPlugin; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.AbstractDocumentProvider; -import org.eclipse.jface.dialogs.ErrorDialog; -import org.eclipse.jface.dialogs.MessageDialog; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.ui.IEditorInput; -import org.eclipse.ui.IFileEditorInput; - -/** - * @author Martin Fluegge - */ -public class DawnEcoreDiagramEditor extends EcoreDiagramEditor implements IDawnEditor -{ - public static String ID = "org.eclipse.emf.cdo.dawn.ecoretools.diagram.part.DawnEcoreDiagramEditor"; - - private IDawnEditorSupport dawnEditorSupport; - - public DawnEcoreDiagramEditor() - { - super(); - EcoreDiagramEditorPlugin.getInstance().logInfo("CDO Editor ist starting"); - setDocumentProvider(new DawnEcoreDocumentProvider()); - setDawnEditorSupport(new DawnGMFEditorSupport(this)); - } - - @Override - public void setInput(IEditorInput input) - { - EcoreDiagramEditorPlugin.getInstance().logInfo("Setting input for DawnEcoreDiagramEditor (" + input + ")"); - - try - { - doSetInput(input, true); - } - catch (CoreException x) - { - x.printStackTrace(System.err); - String title = x.getMessage(); - String msg = x.getMessage(); - Shell shell = getSite().getShell(); - ErrorDialog.openError(shell, title, msg, x.getStatus()); - } - - dawnEditorSupport.setView(((DawnEditorInput)input).getView()); - } - - @Override - protected void initializeGraphicalViewer() - { - super.initializeGraphicalViewer(); - dawnEditorSupport.registerListeners(); - } - - @Override - public void doSave(IProgressMonitor monitor) - { - try - { - dawnEditorSupport.setDirty(false); - updateState(getEditorInput()); - validateState(getEditorInput()); - performSave(false, monitor); - } - catch (TransactionException e) - { - if (e.getMessage().contains("conflict")) - { - MessageDialog.openError(Display.getDefault().getActiveShell(), "conflict", - "Your Resource is in conflict and cannot be committed"); - } - else - { - throw e; - } - } - } - - @Override - public boolean isDirty() - { - return dawnEditorSupport.isDirty(); - } - - public String getContributorID() - { - return ID; - } - - /** - * Have to override this method to change the the DocuemtnProvider behavior. - */ - @Override - protected void setDocumentProvider(IEditorInput input) - { - if (input instanceof IFileEditorInput || input instanceof URIEditorInput || input instanceof CDOEditorInput) - { - setDocumentProvider(getDocumentProvider()); - } - else - { - super.setDocumentProvider(input); - } - } - - @Override - public void dispose() - { - try - { - super.dispose(); - } - finally - { - dawnEditorSupport.close(); - } - } - - /** - * @since 1.0 - */ - public CDOView getView() - { - return dawnEditorSupport.getView(); - } - - public void setDirty() - { - dawnEditorSupport.setDirty(true); - ((AbstractDocumentProvider)getDocumentProvider()).changed(getEditorInput()); - } - - public void setDawnEditorSupport(IDawnEditorSupport dawnEditorSupport) - { - this.dawnEditorSupport = dawnEditorSupport; - } - - public IDawnEditorSupport getDawnEditorSupport() - { - return dawnEditorSupport; - } - - protected void updateCache(Object element) throws CoreException - { - } -} +/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Martin Fluegge - initial API and implementation
+ */
+package org.eclipse.emf.cdo.dawn.ecoretools.diagram.part;
+
+import org.eclipse.emf.cdo.dawn.editors.IDawnEditor;
+import org.eclipse.emf.cdo.dawn.editors.IDawnEditorSupport;
+import org.eclipse.emf.cdo.dawn.gmf.editors.impl.DawnGMFEditorSupport;
+import org.eclipse.emf.cdo.dawn.ui.DawnEditorInput;
+import org.eclipse.emf.cdo.ui.CDOEditorInput;
+import org.eclipse.emf.cdo.view.CDOView;
+
+import org.eclipse.net4j.util.transaction.TransactionException;
+
+import org.eclipse.emf.common.ui.URIEditorInput;
+import org.eclipse.emf.ecoretools.diagram.part.EcoreDiagramEditor;
+import org.eclipse.emf.ecoretools.diagram.part.EcoreDiagramEditorPlugin;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.AbstractDocumentProvider;
+import org.eclipse.jface.dialogs.ErrorDialog;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IFileEditorInput;
+
+/**
+ * @author Martin Fluegge
+ */
+public class DawnEcoreDiagramEditor extends EcoreDiagramEditor implements IDawnEditor
+{
+ public static String ID = "org.eclipse.emf.cdo.dawn.ecoretools.diagram.part.DawnEcoreDiagramEditor";
+
+ private IDawnEditorSupport dawnEditorSupport;
+
+ public DawnEcoreDiagramEditor()
+ {
+ super();
+ EcoreDiagramEditorPlugin.getInstance().logInfo("CDO Editor ist starting");
+ setDocumentProvider(new DawnEcoreDocumentProvider());
+ setDawnEditorSupport(new DawnGMFEditorSupport(this));
+ }
+
+ @Override
+ public void setInput(IEditorInput input)
+ {
+ EcoreDiagramEditorPlugin.getInstance().logInfo("Setting input for DawnEcoreDiagramEditor (" + input + ")");
+
+ try
+ {
+ doSetInput(input, true);
+ }
+ catch (CoreException x)
+ {
+ x.printStackTrace(System.err);
+ String title = x.getMessage();
+ String msg = x.getMessage();
+ Shell shell = getSite().getShell();
+ ErrorDialog.openError(shell, title, msg, x.getStatus());
+ }
+
+ dawnEditorSupport.setView(((DawnEditorInput)input).getView());
+ }
+
+ @Override
+ protected void initializeGraphicalViewer()
+ {
+ super.initializeGraphicalViewer();
+ dawnEditorSupport.registerListeners();
+ }
+
+ @Override
+ public void doSave(IProgressMonitor monitor)
+ {
+ try
+ {
+ dawnEditorSupport.setDirty(false);
+ updateState(getEditorInput());
+ validateState(getEditorInput());
+ performSave(false, monitor);
+ }
+ catch (TransactionException e)
+ {
+ if (e.getMessage().contains("conflict"))
+ {
+ MessageDialog.openError(Display.getDefault().getActiveShell(), "conflict",
+ "Your Resource is in conflict and cannot be committed");
+ }
+ else
+ {
+ throw e;
+ }
+ }
+ }
+
+ @Override
+ public boolean isDirty()
+ {
+ return dawnEditorSupport.isDirty();
+ }
+
+ public String getContributorID()
+ {
+ return ID;
+ }
+
+ /**
+ * Have to override this method to change the the DocuemtnProvider behavior.
+ */
+ @Override
+ protected void setDocumentProvider(IEditorInput input)
+ {
+ if (input instanceof IFileEditorInput || input instanceof URIEditorInput || input instanceof CDOEditorInput)
+ {
+ setDocumentProvider(getDocumentProvider());
+ }
+ else
+ {
+ super.setDocumentProvider(input);
+ }
+ }
+
+ @Override
+ public void dispose()
+ {
+ try
+ {
+ super.dispose();
+ }
+ finally
+ {
+ dawnEditorSupport.close();
+ }
+ }
+
+ /**
+ * @since 1.0
+ */
+ public CDOView getView()
+ {
+ return dawnEditorSupport.getView();
+ }
+
+ public void setDirty()
+ {
+ dawnEditorSupport.setDirty(true);
+ ((AbstractDocumentProvider)getDocumentProvider()).changed(getEditorInput());
+ }
+
+ public void setDawnEditorSupport(IDawnEditorSupport dawnEditorSupport)
+ {
+ this.dawnEditorSupport = dawnEditorSupport;
+ }
+
+ public IDawnEditorSupport getDawnEditorSupport()
+ {
+ return dawnEditorSupport;
+ }
+
+ protected void updateCache(Object element) throws CoreException
+ {
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.dawn.ecoretools.diagram.dawn/src/org/eclipse/emf/cdo/dawn/ecoretools/diagram/part/DawnEcoreDiagramEditorUtil.java b/plugins/org.eclipse.emf.cdo.dawn.ecoretools.diagram.dawn/src/org/eclipse/emf/cdo/dawn/ecoretools/diagram/part/DawnEcoreDiagramEditorUtil.java index 0dba026759..752b3e0b19 100644 --- a/plugins/org.eclipse.emf.cdo.dawn.ecoretools.diagram.dawn/src/org/eclipse/emf/cdo/dawn/ecoretools/diagram/part/DawnEcoreDiagramEditorUtil.java +++ b/plugins/org.eclipse.emf.cdo.dawn.ecoretools.diagram.dawn/src/org/eclipse/emf/cdo/dawn/ecoretools/diagram/part/DawnEcoreDiagramEditorUtil.java @@ -1,451 +1,451 @@ -/* - * Copyright (c) 2004 - 2011 Eike Stepper (Berlin, Germany). - * 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: - * Martin Fluegge - initial API and implementation - */ -package org.eclipse.emf.cdo.dawn.ecoretools.diagram.part; - -import org.eclipse.emf.cdo.dawn.commands.CreateSemanticResourceRecordingCommand; -import org.eclipse.emf.cdo.dawn.ecoretools.diagram.edit.parts.DawnECoreRootEditPart; -import org.eclipse.emf.cdo.dawn.preferences.PreferenceConstants; -import org.eclipse.emf.cdo.dawn.transaction.DawnGMFEditingDomainFactory; -import org.eclipse.emf.cdo.dawn.ui.DawnEditorInput; -import org.eclipse.emf.cdo.dawn.util.connection.CDOConnectionUtil; -import org.eclipse.emf.cdo.transaction.CDOTransaction; - -import org.eclipse.emf.common.util.URI; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EcoreFactory; -import org.eclipse.emf.ecore.resource.Resource; -import org.eclipse.emf.ecore.resource.ResourceSet; -import org.eclipse.emf.ecoretools.diagram.edit.commands.InitializeAndLayoutDiagramCommand; -import org.eclipse.emf.ecoretools.diagram.edit.parts.EPackageEditPart; -import org.eclipse.emf.ecoretools.diagram.part.EcoreDiagramEditorPlugin; -import org.eclipse.emf.ecoretools.diagram.part.EcoreDiagramEditorUtil; -import org.eclipse.emf.ecoretools.diagram.part.Messages; -import org.eclipse.emf.transaction.TransactionalEditingDomain; -import org.eclipse.emf.workspace.WorkspaceEditingDomainFactory; -import org.eclipse.emf.workspace.util.WorkspaceSynchronizer; - -import org.eclipse.core.commands.ExecutionException; -import org.eclipse.core.commands.operations.OperationHistoryFactory; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.NullProgressMonitor; -import org.eclipse.core.runtime.SubProgressMonitor; -import org.eclipse.gmf.runtime.common.core.command.CommandResult; -import org.eclipse.gmf.runtime.diagram.core.services.ViewService; -import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand; -import org.eclipse.gmf.runtime.notation.Diagram; -import org.eclipse.jface.dialogs.IDialogSettings; -import org.eclipse.jface.wizard.Wizard; -import org.eclipse.jface.wizard.WizardDialog; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.ui.IWorkbenchPage; -import org.eclipse.ui.PartInitException; -import org.eclipse.ui.PlatformUI; - -import java.io.IOException; -import java.util.Collections; - -/** - * @author Martin Fluegge - */ -public class DawnEcoreDiagramEditorUtil extends EcoreDiagramEditorUtil -{ - - /** - * @generated - */ - public static boolean openDiagram(Resource diagram) throws PartInitException - { - IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(); - return null != page.openEditor(new DawnEditorInput(diagram.getURI()), DawnEcoreDiagramEditor.ID); - } - - /** - * Runs the wizard in a dialog. - * - * @generated - */ - public static void runWizard(Shell shell, Wizard wizard, String settingsKey) - { - IDialogSettings pluginDialogSettings = EcoreDiagramEditorPlugin.getInstance().getDialogSettings(); - IDialogSettings wizardDialogSettings = pluginDialogSettings.getSection(settingsKey); - if (wizardDialogSettings == null) - { - wizardDialogSettings = pluginDialogSettings.addNewSection(settingsKey); - } - wizard.setDialogSettings(wizardDialogSettings); - WizardDialog dialog = new WizardDialog(shell, wizard); - dialog.create(); - dialog.getShell().setSize(Math.max(500, dialog.getShell().getSize().x), 500); - dialog.open(); - } - - public static Resource createDiagram(URI diagramURI, URI modelURI, IProgressMonitor progressMonitor) - { - TransactionalEditingDomain editingDomain = DawnGMFEditingDomainFactory.getInstance().createEditingDomain(); - - progressMonitor.beginTask(Messages.EcoreDiagramEditorUtil_CreateDiagramProgressTask, 3); - - CDOConnectionUtil.instance.init(PreferenceConstants.getRepositoryName(), PreferenceConstants.getProtocol(), - PreferenceConstants.getServerName()); - CDOConnectionUtil.instance.openSession(); - ResourceSet resourceSet = editingDomain.getResourceSet(); - - EcoreDiagramEditorPlugin.getInstance().logInfo("URI toString: " + diagramURI.toString()); - EcoreDiagramEditorPlugin.getInstance().logInfo("URI authority: " + diagramURI.authority()); - - CDOTransaction transaction = CDOConnectionUtil.instance.openCurrentTransaction(resourceSet, diagramURI.toString()); - - final Resource diagramResource = resourceSet.createResource(diagramURI); - - EcoreDiagramEditorPlugin.getInstance().logInfo("Diagram URI: " + diagramURI); - EcoreDiagramEditorPlugin.getInstance().logInfo("Diagram Resource: " + diagramResource); - - CreateSemanticResourceRecordingCommand createSemanticResourceCommand = new CreateSemanticResourceRecordingCommand( - editingDomain, transaction, modelURI.path()); - - editingDomain.getCommandStack().execute(createSemanticResourceCommand); - final Resource modelResource = createSemanticResourceCommand.getResource(); - EcoreDiagramEditorPlugin.getInstance().logInfo("Model URI: " + modelURI); - EcoreDiagramEditorPlugin.getInstance().logInfo("Model Resource: " + modelResource); - - final String diagramName = diagramURI.lastSegment(); - AbstractTransactionalCommand command = new AbstractTransactionalCommand(editingDomain, - Messages.EcoreDiagramEditorUtil_CreateDiagramCommandLabel, Collections.EMPTY_LIST) - { - @Override - protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException - { - EObject model = null; - if (modelResource.getContents().size() > 0) - { - model = modelResource.getContents().get(0); - } - else - { - model = createInitialModel(); - attachModelToResource(model, modelResource); - } - - Diagram diagram = ViewService.createDiagram(model, DawnECoreRootEditPart.MODEL_ID, - EcoreDiagramEditorPlugin.DIAGRAM_PREFERENCES_HINT); - if (diagram != null) - { - diagramResource.getContents().add(diagram); - diagram.setName(diagramName); - diagram.setElement(model); - } - - try - { - modelResource.save(Collections.EMPTY_MAP); - diagramResource.save(Collections.EMPTY_MAP); - } - catch (IOException e) - { - EcoreDiagramEditorPlugin.getInstance().logError("Unable to store model and diagram resources", e); //$NON-NLS-1$ - } - - return CommandResult.newOKCommandResult(); - } - }; - try - { - OperationHistoryFactory.getOperationHistory().execute(command, new SubProgressMonitor(progressMonitor, 1), null); - } - catch (ExecutionException e) - { - EcoreDiagramEditorPlugin.getInstance().logError("Unable to create model and diagram", e); //$NON-NLS-1$ - } - setCharset(WorkspaceSynchronizer.getFile(modelResource)); - setCharset(WorkspaceSynchronizer.getFile(diagramResource)); - return diagramResource; - } - - /** - * Create a new instance of domain element associated with canvas. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - private static EObject createInitialModel() - { - return EcoreFactory.eINSTANCE.createEPackage(); - } - - /** - * Store model element in the resource. <!-- begin-user-doc --> <!-- end-user-doc --> - * - * @generated - */ - private static void attachModelToResource(EObject model, Resource resource) - { - resource.getContents().add(model); - } - - public static Resource createDiagramOnly(URI diagramURI, URI modelURI, EObject domainElement, - final boolean initializeDiagram, IProgressMonitor progressMonitor) - { - final TransactionalEditingDomain editingDomain = WorkspaceEditingDomainFactory.INSTANCE.createEditingDomain(); - progressMonitor.beginTask("", 3); //$NON-NLS-1$ - final Resource diagramResource = editingDomain.getResourceSet().createResource(diagramURI); - final EObject model = domainElement; - final String diagramName = diagramURI.lastSegment(); - AbstractTransactionalCommand command = new AbstractTransactionalCommand(editingDomain, "", Collections.EMPTY_LIST) { //$NON-NLS-1$ - - @Override - protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException - { - Diagram diagram = ViewService.createDiagram(model, EPackageEditPart.MODEL_ID, - EcoreDiagramEditorPlugin.DIAGRAM_PREFERENCES_HINT); - if (diagram != null) - { - diagramResource.getContents().add(diagram); - diagram.setName(diagramName); - diagram.setElement(model); - } - - try - { - diagramResource.save(Collections.EMPTY_MAP); - - // Initialize and Layout Diagram - if (initializeDiagram && diagramResource.getContents().get(0) instanceof Diagram) - { - InitializeAndLayoutDiagramCommand initializeAndLayoutDiagram = new InitializeAndLayoutDiagramCommand( - editingDomain, (Diagram)diagramResource.getContents().get(0), false); - OperationHistoryFactory.getOperationHistory().execute(initializeAndLayoutDiagram, - new NullProgressMonitor(), null); - diagramResource.save(EcoreDiagramEditorUtil.getSaveOptions()); - } - - } - catch (IOException e) - { - - EcoreDiagramEditorPlugin.getInstance().logError("Unable to store diagram resources", e); //$NON-NLS-1$ - } - return CommandResult.newOKCommandResult(); - } - }; - try - { - OperationHistoryFactory.getOperationHistory().execute(command, new SubProgressMonitor(progressMonitor, 1), null); - } - catch (ExecutionException e) - { - EcoreDiagramEditorPlugin.getInstance().logError("Unable to create diagram", e); //$NON-NLS-1$ - } - return diagramResource; - } - - // /** - // * @generated - // */ - // public static void selectElementsInDiagram(IDiagramWorkbenchPart diagramPart, List/* EditPart */editParts) - // { - // diagramPart.getDiagramGraphicalViewer().deselectAll(); - // - // EditPart firstPrimary = null; - // for (Iterator it = editParts.iterator(); it.hasNext();) - // { - // EditPart nextPart = (EditPart)it.next(); - // diagramPart.getDiagramGraphicalViewer().appendSelection(nextPart); - // if (firstPrimary == null && nextPart instanceof IPrimaryEditPart) - // { - // firstPrimary = nextPart; - // } - // } - // - // if (!editParts.isEmpty()) - // { - // diagramPart.getDiagramGraphicalViewer().reveal(firstPrimary != null ? firstPrimary : (EditPart)editParts.get(0)); - // } - // } - - // /** - // * @generated - // */ - // private static int findElementsInDiagramByID(DiagramEditPart diagramPart, EObject element, List editPartCollector) - // { - // IDiagramGraphicalViewer viewer = (IDiagramGraphicalViewer)diagramPart.getViewer(); - // final int intialNumOfEditParts = editPartCollector.size(); - // - // if (element instanceof View) - // { // support notation element lookup - // EditPart editPart = (EditPart)viewer.getEditPartRegistry().get(element); - // if (editPart != null) - // { - // editPartCollector.add(editPart); - // return 1; - // } - // } - // - // String elementID = EMFCoreUtil.getProxyID(element); - // List associatedParts = viewer.findEditPartsForElement(elementID, IGraphicalEditPart.class); - // // perform the possible hierarchy disjoint -> take the top-most parts only - // for (Iterator editPartIt = associatedParts.iterator(); editPartIt.hasNext();) - // { - // EditPart nextPart = (EditPart)editPartIt.next(); - // EditPart parentPart = nextPart.getParent(); - // while (parentPart != null && !associatedParts.contains(parentPart)) - // { - // parentPart = parentPart.getParent(); - // } - // if (parentPart == null) - // { - // editPartCollector.add(nextPart); - // } - // } - // - // if (intialNumOfEditParts == editPartCollector.size()) - // { - // if (!associatedParts.isEmpty()) - // { - // editPartCollector.add(associatedParts.iterator().next()); - // } - // else - // { - // if (element.eContainer() != null) - // { - // return findElementsInDiagramByID(diagramPart, element.eContainer(), editPartCollector); - // } - // } - // } - // return editPartCollector.size() - intialNumOfEditParts; - // } - - // /** - // * @generated - // */ - // public static View findView(DiagramEditPart diagramEditPart, EObject targetElement, - // LazyElement2ViewMap lazyElement2ViewMap) - // { - // boolean hasStructuralURI = false; - // if (targetElement.eResource() instanceof XMLResource) - // { - // hasStructuralURI = ((XMLResource)targetElement.eResource()).getID(targetElement) == null; - // } - // - // View view = null; - // if (hasStructuralURI && !lazyElement2ViewMap.getElement2ViewMap().isEmpty()) - // { - // view = (View)lazyElement2ViewMap.getElement2ViewMap().get(targetElement); - // } - // else if (findElementsInDiagramByID(diagramEditPart, targetElement, lazyElement2ViewMap.editPartTmpHolder) > 0) - // { - // EditPart editPart = (EditPart)lazyElement2ViewMap.editPartTmpHolder.get(0); - // lazyElement2ViewMap.editPartTmpHolder.clear(); - // view = editPart.getModel() instanceof View ? (View)editPart.getModel() : null; - // } - // - // return (view == null) ? diagramEditPart.getDiagramView() : view; - // } - - // /** - // * @generated - // */ - // public static class LazyElement2ViewMap - // { - // /** - // * @generated - // */ - // private Map element2ViewMap; - // - // /** - // * @generated - // */ - // private View scope; - // - // /** - // * @generated - // */ - // private Set elementSet; - // - // /** - // * @generated - // */ - // public final List editPartTmpHolder = new ArrayList(); - // - // /** - // * @generated - // */ - // public LazyElement2ViewMap(View scope, Set elements) - // { - // this.scope = scope; - // this.elementSet = elements; - // } - // - // /** - // * @generated - // */ - // public final Map getElement2ViewMap() - // { - // if (element2ViewMap == null) - // { - // element2ViewMap = new HashMap(); - // // map possible notation elements to itself as these can't be found by view.getElement() - // for (Iterator it = elementSet.iterator(); it.hasNext();) - // { - // EObject element = (EObject)it.next(); - // if (element instanceof View) - // { - // View view = (View)element; - // if (view.getDiagram() == scope.getDiagram()) - // { - // element2ViewMap.put(element, element); // take only those that part of our diagram - // } - // } - // } - // - // buildElement2ViewMap(scope, element2ViewMap, elementSet); - // } - // return element2ViewMap; - // } - // - // /** - // * @generated - // */ - // static Map buildElement2ViewMap(View parentView, Map element2ViewMap, Set elements) - // { - // if (elements.size() == element2ViewMap.size()) - // return element2ViewMap; - // - // if (parentView.isSetElement() && !element2ViewMap.containsKey(parentView.getElement()) - // && elements.contains(parentView.getElement())) - // { - // element2ViewMap.put(parentView.getElement(), parentView); - // if (elements.size() == element2ViewMap.size()) - // return element2ViewMap; - // } - // - // for (Iterator it = parentView.getChildren().iterator(); it.hasNext();) - // { - // buildElement2ViewMap((View)it.next(), element2ViewMap, elements); - // if (elements.size() == element2ViewMap.size()) - // return element2ViewMap; - // } - // for (Iterator it = parentView.getSourceEdges().iterator(); it.hasNext();) - // { - // buildElement2ViewMap((View)it.next(), element2ViewMap, elements); - // if (elements.size() == element2ViewMap.size()) - // return element2ViewMap; - // } - // for (Iterator it = parentView.getSourceEdges().iterator(); it.hasNext();) - // { - // buildElement2ViewMap((View)it.next(), element2ViewMap, elements); - // if (elements.size() == element2ViewMap.size()) - // return element2ViewMap; - // } - // return element2ViewMap; - // } - // } // LazyElement2ViewMap - -} +/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Martin Fluegge - initial API and implementation
+ */
+package org.eclipse.emf.cdo.dawn.ecoretools.diagram.part;
+
+import org.eclipse.emf.cdo.dawn.commands.CreateSemanticResourceRecordingCommand;
+import org.eclipse.emf.cdo.dawn.ecoretools.diagram.edit.parts.DawnECoreRootEditPart;
+import org.eclipse.emf.cdo.dawn.preferences.PreferenceConstants;
+import org.eclipse.emf.cdo.dawn.transaction.DawnGMFEditingDomainFactory;
+import org.eclipse.emf.cdo.dawn.ui.DawnEditorInput;
+import org.eclipse.emf.cdo.dawn.util.connection.CDOConnectionUtil;
+import org.eclipse.emf.cdo.transaction.CDOTransaction;
+
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EcoreFactory;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecore.resource.ResourceSet;
+import org.eclipse.emf.ecoretools.diagram.edit.commands.InitializeAndLayoutDiagramCommand;
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EPackageEditPart;
+import org.eclipse.emf.ecoretools.diagram.part.EcoreDiagramEditorPlugin;
+import org.eclipse.emf.ecoretools.diagram.part.EcoreDiagramEditorUtil;
+import org.eclipse.emf.ecoretools.diagram.part.Messages;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.emf.workspace.WorkspaceEditingDomainFactory;
+import org.eclipse.emf.workspace.util.WorkspaceSynchronizer;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.commands.operations.OperationHistoryFactory;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.SubProgressMonitor;
+import org.eclipse.gmf.runtime.common.core.command.CommandResult;
+import org.eclipse.gmf.runtime.diagram.core.services.ViewService;
+import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand;
+import org.eclipse.gmf.runtime.notation.Diagram;
+import org.eclipse.jface.dialogs.IDialogSettings;
+import org.eclipse.jface.wizard.Wizard;
+import org.eclipse.jface.wizard.WizardDialog;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.PlatformUI;
+
+import java.io.IOException;
+import java.util.Collections;
+
+/**
+ * @author Martin Fluegge
+ */
+public class DawnEcoreDiagramEditorUtil extends EcoreDiagramEditorUtil
+{
+
+ /**
+ * @generated
+ */
+ public static boolean openDiagram(Resource diagram) throws PartInitException
+ {
+ IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
+ return null != page.openEditor(new DawnEditorInput(diagram.getURI()), DawnEcoreDiagramEditor.ID);
+ }
+
+ /**
+ * Runs the wizard in a dialog.
+ *
+ * @generated
+ */
+ public static void runWizard(Shell shell, Wizard wizard, String settingsKey)
+ {
+ IDialogSettings pluginDialogSettings = EcoreDiagramEditorPlugin.getInstance().getDialogSettings();
+ IDialogSettings wizardDialogSettings = pluginDialogSettings.getSection(settingsKey);
+ if (wizardDialogSettings == null)
+ {
+ wizardDialogSettings = pluginDialogSettings.addNewSection(settingsKey);
+ }
+ wizard.setDialogSettings(wizardDialogSettings);
+ WizardDialog dialog = new WizardDialog(shell, wizard);
+ dialog.create();
+ dialog.getShell().setSize(Math.max(500, dialog.getShell().getSize().x), 500);
+ dialog.open();
+ }
+
+ public static Resource createDiagram(URI diagramURI, URI modelURI, IProgressMonitor progressMonitor)
+ {
+ TransactionalEditingDomain editingDomain = DawnGMFEditingDomainFactory.getInstance().createEditingDomain();
+
+ progressMonitor.beginTask(Messages.EcoreDiagramEditorUtil_CreateDiagramProgressTask, 3);
+
+ CDOConnectionUtil.instance.init(PreferenceConstants.getRepositoryName(), PreferenceConstants.getProtocol(),
+ PreferenceConstants.getServerName());
+ CDOConnectionUtil.instance.openSession();
+ ResourceSet resourceSet = editingDomain.getResourceSet();
+
+ EcoreDiagramEditorPlugin.getInstance().logInfo("URI toString: " + diagramURI.toString());
+ EcoreDiagramEditorPlugin.getInstance().logInfo("URI authority: " + diagramURI.authority());
+
+ CDOTransaction transaction = CDOConnectionUtil.instance.openCurrentTransaction(resourceSet, diagramURI.toString());
+
+ final Resource diagramResource = resourceSet.createResource(diagramURI);
+
+ EcoreDiagramEditorPlugin.getInstance().logInfo("Diagram URI: " + diagramURI);
+ EcoreDiagramEditorPlugin.getInstance().logInfo("Diagram Resource: " + diagramResource);
+
+ CreateSemanticResourceRecordingCommand createSemanticResourceCommand = new CreateSemanticResourceRecordingCommand(
+ editingDomain, transaction, modelURI.path());
+
+ editingDomain.getCommandStack().execute(createSemanticResourceCommand);
+ final Resource modelResource = createSemanticResourceCommand.getResource();
+ EcoreDiagramEditorPlugin.getInstance().logInfo("Model URI: " + modelURI);
+ EcoreDiagramEditorPlugin.getInstance().logInfo("Model Resource: " + modelResource);
+
+ final String diagramName = diagramURI.lastSegment();
+ AbstractTransactionalCommand command = new AbstractTransactionalCommand(editingDomain,
+ Messages.EcoreDiagramEditorUtil_CreateDiagramCommandLabel, Collections.EMPTY_LIST)
+ {
+ @Override
+ protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException
+ {
+ EObject model = null;
+ if (modelResource.getContents().size() > 0)
+ {
+ model = modelResource.getContents().get(0);
+ }
+ else
+ {
+ model = createInitialModel();
+ attachModelToResource(model, modelResource);
+ }
+
+ Diagram diagram = ViewService.createDiagram(model, DawnECoreRootEditPart.MODEL_ID,
+ EcoreDiagramEditorPlugin.DIAGRAM_PREFERENCES_HINT);
+ if (diagram != null)
+ {
+ diagramResource.getContents().add(diagram);
+ diagram.setName(diagramName);
+ diagram.setElement(model);
+ }
+
+ try
+ {
+ modelResource.save(Collections.EMPTY_MAP);
+ diagramResource.save(Collections.EMPTY_MAP);
+ }
+ catch (IOException e)
+ {
+ EcoreDiagramEditorPlugin.getInstance().logError("Unable to store model and diagram resources", e); //$NON-NLS-1$
+ }
+
+ return CommandResult.newOKCommandResult();
+ }
+ };
+ try
+ {
+ OperationHistoryFactory.getOperationHistory().execute(command, new SubProgressMonitor(progressMonitor, 1), null);
+ }
+ catch (ExecutionException e)
+ {
+ EcoreDiagramEditorPlugin.getInstance().logError("Unable to create model and diagram", e); //$NON-NLS-1$
+ }
+ setCharset(WorkspaceSynchronizer.getFile(modelResource));
+ setCharset(WorkspaceSynchronizer.getFile(diagramResource));
+ return diagramResource;
+ }
+
+ /**
+ * Create a new instance of domain element associated with canvas. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ private static EObject createInitialModel()
+ {
+ return EcoreFactory.eINSTANCE.createEPackage();
+ }
+
+ /**
+ * Store model element in the resource. <!-- begin-user-doc --> <!-- end-user-doc -->
+ *
+ * @generated
+ */
+ private static void attachModelToResource(EObject model, Resource resource)
+ {
+ resource.getContents().add(model);
+ }
+
+ public static Resource createDiagramOnly(URI diagramURI, URI modelURI, EObject domainElement,
+ final boolean initializeDiagram, IProgressMonitor progressMonitor)
+ {
+ final TransactionalEditingDomain editingDomain = WorkspaceEditingDomainFactory.INSTANCE.createEditingDomain();
+ progressMonitor.beginTask("", 3); //$NON-NLS-1$
+ final Resource diagramResource = editingDomain.getResourceSet().createResource(diagramURI);
+ final EObject model = domainElement;
+ final String diagramName = diagramURI.lastSegment();
+ AbstractTransactionalCommand command = new AbstractTransactionalCommand(editingDomain, "", Collections.EMPTY_LIST) { //$NON-NLS-1$
+
+ @Override
+ protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException
+ {
+ Diagram diagram = ViewService.createDiagram(model, EPackageEditPart.MODEL_ID,
+ EcoreDiagramEditorPlugin.DIAGRAM_PREFERENCES_HINT);
+ if (diagram != null)
+ {
+ diagramResource.getContents().add(diagram);
+ diagram.setName(diagramName);
+ diagram.setElement(model);
+ }
+
+ try
+ {
+ diagramResource.save(Collections.EMPTY_MAP);
+
+ // Initialize and Layout Diagram
+ if (initializeDiagram && diagramResource.getContents().get(0) instanceof Diagram)
+ {
+ InitializeAndLayoutDiagramCommand initializeAndLayoutDiagram = new InitializeAndLayoutDiagramCommand(
+ editingDomain, (Diagram)diagramResource.getContents().get(0), false);
+ OperationHistoryFactory.getOperationHistory().execute(initializeAndLayoutDiagram,
+ new NullProgressMonitor(), null);
+ diagramResource.save(EcoreDiagramEditorUtil.getSaveOptions());
+ }
+
+ }
+ catch (IOException e)
+ {
+
+ EcoreDiagramEditorPlugin.getInstance().logError("Unable to store diagram resources", e); //$NON-NLS-1$
+ }
+ return CommandResult.newOKCommandResult();
+ }
+ };
+ try
+ {
+ OperationHistoryFactory.getOperationHistory().execute(command, new SubProgressMonitor(progressMonitor, 1), null);
+ }
+ catch (ExecutionException e)
+ {
+ EcoreDiagramEditorPlugin.getInstance().logError("Unable to create diagram", e); //$NON-NLS-1$
+ }
+ return diagramResource;
+ }
+
+ // /**
+ // * @generated
+ // */
+ // public static void selectElementsInDiagram(IDiagramWorkbenchPart diagramPart, List/* EditPart */editParts)
+ // {
+ // diagramPart.getDiagramGraphicalViewer().deselectAll();
+ //
+ // EditPart firstPrimary = null;
+ // for (Iterator it = editParts.iterator(); it.hasNext();)
+ // {
+ // EditPart nextPart = (EditPart)it.next();
+ // diagramPart.getDiagramGraphicalViewer().appendSelection(nextPart);
+ // if (firstPrimary == null && nextPart instanceof IPrimaryEditPart)
+ // {
+ // firstPrimary = nextPart;
+ // }
+ // }
+ //
+ // if (!editParts.isEmpty())
+ // {
+ // diagramPart.getDiagramGraphicalViewer().reveal(firstPrimary != null ? firstPrimary : (EditPart)editParts.get(0));
+ // }
+ // }
+
+ // /**
+ // * @generated
+ // */
+ // private static int findElementsInDiagramByID(DiagramEditPart diagramPart, EObject element, List editPartCollector)
+ // {
+ // IDiagramGraphicalViewer viewer = (IDiagramGraphicalViewer)diagramPart.getViewer();
+ // final int intialNumOfEditParts = editPartCollector.size();
+ //
+ // if (element instanceof View)
+ // { // support notation element lookup
+ // EditPart editPart = (EditPart)viewer.getEditPartRegistry().get(element);
+ // if (editPart != null)
+ // {
+ // editPartCollector.add(editPart);
+ // return 1;
+ // }
+ // }
+ //
+ // String elementID = EMFCoreUtil.getProxyID(element);
+ // List associatedParts = viewer.findEditPartsForElement(elementID, IGraphicalEditPart.class);
+ // // perform the possible hierarchy disjoint -> take the top-most parts only
+ // for (Iterator editPartIt = associatedParts.iterator(); editPartIt.hasNext();)
+ // {
+ // EditPart nextPart = (EditPart)editPartIt.next();
+ // EditPart parentPart = nextPart.getParent();
+ // while (parentPart != null && !associatedParts.contains(parentPart))
+ // {
+ // parentPart = parentPart.getParent();
+ // }
+ // if (parentPart == null)
+ // {
+ // editPartCollector.add(nextPart);
+ // }
+ // }
+ //
+ // if (intialNumOfEditParts == editPartCollector.size())
+ // {
+ // if (!associatedParts.isEmpty())
+ // {
+ // editPartCollector.add(associatedParts.iterator().next());
+ // }
+ // else
+ // {
+ // if (element.eContainer() != null)
+ // {
+ // return findElementsInDiagramByID(diagramPart, element.eContainer(), editPartCollector);
+ // }
+ // }
+ // }
+ // return editPartCollector.size() - intialNumOfEditParts;
+ // }
+
+ // /**
+ // * @generated
+ // */
+ // public static View findView(DiagramEditPart diagramEditPart, EObject targetElement,
+ // LazyElement2ViewMap lazyElement2ViewMap)
+ // {
+ // boolean hasStructuralURI = false;
+ // if (targetElement.eResource() instanceof XMLResource)
+ // {
+ // hasStructuralURI = ((XMLResource)targetElement.eResource()).getID(targetElement) == null;
+ // }
+ //
+ // View view = null;
+ // if (hasStructuralURI && !lazyElement2ViewMap.getElement2ViewMap().isEmpty())
+ // {
+ // view = (View)lazyElement2ViewMap.getElement2ViewMap().get(targetElement);
+ // }
+ // else if (findElementsInDiagramByID(diagramEditPart, targetElement, lazyElement2ViewMap.editPartTmpHolder) > 0)
+ // {
+ // EditPart editPart = (EditPart)lazyElement2ViewMap.editPartTmpHolder.get(0);
+ // lazyElement2ViewMap.editPartTmpHolder.clear();
+ // view = editPart.getModel() instanceof View ? (View)editPart.getModel() : null;
+ // }
+ //
+ // return (view == null) ? diagramEditPart.getDiagramView() : view;
+ // }
+
+ // /**
+ // * @generated
+ // */
+ // public static class LazyElement2ViewMap
+ // {
+ // /**
+ // * @generated
+ // */
+ // private Map element2ViewMap;
+ //
+ // /**
+ // * @generated
+ // */
+ // private View scope;
+ //
+ // /**
+ // * @generated
+ // */
+ // private Set elementSet;
+ //
+ // /**
+ // * @generated
+ // */
+ // public final List editPartTmpHolder = new ArrayList();
+ //
+ // /**
+ // * @generated
+ // */
+ // public LazyElement2ViewMap(View scope, Set elements)
+ // {
+ // this.scope = scope;
+ // this.elementSet = elements;
+ // }
+ //
+ // /**
+ // * @generated
+ // */
+ // public final Map getElement2ViewMap()
+ // {
+ // if (element2ViewMap == null)
+ // {
+ // element2ViewMap = new HashMap();
+ // // map possible notation elements to itself as these can't be found by view.getElement()
+ // for (Iterator it = elementSet.iterator(); it.hasNext();)
+ // {
+ // EObject element = (EObject)it.next();
+ // if (element instanceof View)
+ // {
+ // View view = (View)element;
+ // if (view.getDiagram() == scope.getDiagram())
+ // {
+ // element2ViewMap.put(element, element); // take only those that part of our diagram
+ // }
+ // }
+ // }
+ //
+ // buildElement2ViewMap(scope, element2ViewMap, elementSet);
+ // }
+ // return element2ViewMap;
+ // }
+ //
+ // /**
+ // * @generated
+ // */
+ // static Map buildElement2ViewMap(View parentView, Map element2ViewMap, Set elements)
+ // {
+ // if (elements.size() == element2ViewMap.size())
+ // return element2ViewMap;
+ //
+ // if (parentView.isSetElement() && !element2ViewMap.containsKey(parentView.getElement())
+ // && elements.contains(parentView.getElement()))
+ // {
+ // element2ViewMap.put(parentView.getElement(), parentView);
+ // if (elements.size() == element2ViewMap.size())
+ // return element2ViewMap;
+ // }
+ //
+ // for (Iterator it = parentView.getChildren().iterator(); it.hasNext();)
+ // {
+ // buildElement2ViewMap((View)it.next(), element2ViewMap, elements);
+ // if (elements.size() == element2ViewMap.size())
+ // return element2ViewMap;
+ // }
+ // for (Iterator it = parentView.getSourceEdges().iterator(); it.hasNext();)
+ // {
+ // buildElement2ViewMap((View)it.next(), element2ViewMap, elements);
+ // if (elements.size() == element2ViewMap.size())
+ // return element2ViewMap;
+ // }
+ // for (Iterator it = parentView.getSourceEdges().iterator(); it.hasNext();)
+ // {
+ // buildElement2ViewMap((View)it.next(), element2ViewMap, elements);
+ // if (elements.size() == element2ViewMap.size())
+ // return element2ViewMap;
+ // }
+ // return element2ViewMap;
+ // }
+ // } // LazyElement2ViewMap
+
+}
diff --git a/plugins/org.eclipse.emf.cdo.dawn.ecoretools.diagram.dawn/src/org/eclipse/emf/cdo/dawn/ecoretools/diagram/part/DawnEcoreDocumentProvider.java b/plugins/org.eclipse.emf.cdo.dawn.ecoretools.diagram.dawn/src/org/eclipse/emf/cdo/dawn/ecoretools/diagram/part/DawnEcoreDocumentProvider.java index 1f910ff31a..9c9d61412b 100644 --- a/plugins/org.eclipse.emf.cdo.dawn.ecoretools.diagram.dawn/src/org/eclipse/emf/cdo/dawn/ecoretools/diagram/part/DawnEcoreDocumentProvider.java +++ b/plugins/org.eclipse.emf.cdo.dawn.ecoretools.diagram.dawn/src/org/eclipse/emf/cdo/dawn/ecoretools/diagram/part/DawnEcoreDocumentProvider.java @@ -1,229 +1,229 @@ -/* - * Copyright (c) 2004 - 2011 Eike Stepper (Berlin, Germany). - * 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: - * Martin Fluegge - initial API and implementation - */ -package org.eclipse.emf.cdo.dawn.ecoretools.diagram.part; - -import org.eclipse.emf.cdo.dawn.gmf.util.DawnDiagramUpdater; -import org.eclipse.emf.cdo.dawn.transaction.DawnDiagramEditingDomainFactory; -import org.eclipse.emf.cdo.dawn.ui.DawnEditorInput; -import org.eclipse.emf.cdo.eresource.CDOResource; - -import org.eclipse.emf.common.notify.Adapter; -import org.eclipse.emf.common.notify.Notification; -import org.eclipse.emf.common.notify.Notifier; -import org.eclipse.emf.common.ui.URIEditorInput; -import org.eclipse.emf.common.util.URI; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.resource.Resource; -import org.eclipse.emf.ecore.resource.ResourceSet; -import org.eclipse.emf.ecoretools.diagram.part.EcoreDiagramEditorPlugin; -import org.eclipse.emf.ecoretools.diagram.part.EcoreDocumentProvider; -import org.eclipse.emf.ecoretools.diagram.part.Messages; -import org.eclipse.emf.transaction.NotificationFilter; -import org.eclipse.emf.transaction.TransactionalEditingDomain; - -import org.eclipse.core.resources.IStorage; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.DiagramDocument; -import org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.IDiagramDocument; -import org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.IDocument; -import org.eclipse.gmf.runtime.diagram.ui.resources.editor.internal.util.DiagramIOUtil; -import org.eclipse.gmf.runtime.emf.core.resources.GMFResourceFactory; -import org.eclipse.gmf.runtime.notation.Diagram; -import org.eclipse.osgi.util.NLS; -import org.eclipse.ui.IEditorInput; -import org.eclipse.ui.part.FileEditorInput; - -import java.io.IOException; -import java.util.HashMap; -import java.util.Iterator; -import java.util.Map; - -/** - * @author Martin Fluegge - */ -@SuppressWarnings("restriction") -public class DawnEcoreDocumentProvider extends EcoreDocumentProvider -{ - - public DawnEcoreDocumentProvider() - { - super(); - EcoreDiagramEditorPlugin.getInstance().logInfo("Using DawnEcoreDocumentProvider instead of the original one"); - } - - /** - * override to change creation of editingdomain - */ - @Override - protected IDocument createEmptyDocument() - { - DiagramDocument document = new DiagramDocument(); - document.setEditingDomain(createEditingDomain()); - return document; - } - - /** - * override to change the EditingDomain - */ - private TransactionalEditingDomain createEditingDomain() - { - TransactionalEditingDomain editingDomain = DawnDiagramEditingDomainFactory.getInstance().createEditingDomain(); - editingDomain.setID("org.eclipse.emf.cdo.dawn.ecoretools.diagram.EditingDomain"); //$NON-NLS-1$ - final NotificationFilter diagramResourceModifiedFilter = NotificationFilter - .createNotifierFilter(editingDomain.getResourceSet()) - .and(NotificationFilter.createEventTypeFilter(Notification.ADD)) - .and(NotificationFilter.createFeatureFilter(ResourceSet.class, ResourceSet.RESOURCE_SET__RESOURCES)); - editingDomain.getResourceSet().eAdapters().add(new Adapter() - { - private Notifier myTarger; - - public Notifier getTarget() - { - return myTarger; - } - - public boolean isAdapterForType(Object type) - { - return false; - } - - public void notifyChanged(Notification notification) - { - if (diagramResourceModifiedFilter.matches(notification)) - { - Object value = notification.getNewValue(); - if (value instanceof Resource) - { - ((Resource)value).setTrackingModification(true); - } - } - } - - public void setTarget(Notifier newTarget) - { - myTarger = newTarget; - } - }); - - return editingDomain; - } - - @SuppressWarnings({ "rawtypes", "unchecked" }) - @Override - protected void setDocumentContent(IDocument document, IEditorInput element) throws CoreException - { - EcoreDiagramEditorPlugin.getInstance().logInfo("Editor Input: " + element.getName()); - - IDiagramDocument diagramDocument = (IDiagramDocument)document; - TransactionalEditingDomain domain = diagramDocument.getEditingDomain(); - if (element instanceof FileEditorInput) - { - IStorage storage = ((FileEditorInput)element).getStorage(); - Diagram diagram = DiagramIOUtil.load(domain, storage, true, getProgressMonitor()); - document.setContent(diagram); - } - else if (element instanceof URIEditorInput) - { - URIEditorInput editorInput = (URIEditorInput)element; - - URI uri = editorInput.getURI(); - Resource resource = null; - try - { - URI dawnURI = URI.createURI(uri.toString().replace("cdo", "dawn")); - resource = domain.getResourceSet().getResource(dawnURI, false); - if (resource == null) - { - resource = domain.getResourceSet().getResource(dawnURI, true); - } - - if (editorInput instanceof DawnEditorInput) - { - ((DawnEditorInput)editorInput).setResource((CDOResource)resource); - } - if (!resource.isLoaded()) - { - try - { - Map options = new HashMap(GMFResourceFactory.getDefaultLoadOptions()); - resource.load(options); - } - catch (IOException e) - { - resource.unload(); - throw e; - } - } - if (uri.fragment() != null) - { - EObject rootElement = resource.getEObject(uri.fragment()); - if (rootElement instanceof Diagram) - { - Diagram diagram = (Diagram)rootElement; - DawnDiagramUpdater.initializeElement(diagram); - document.setContent(diagram); - - return; - } - } - else - { - for (Iterator<?> it = resource.getContents().iterator(); it.hasNext();) - { - Object rootElement = it.next(); - if (rootElement instanceof Diagram) - { - Diagram diagram = (Diagram)rootElement; - DawnDiagramUpdater.initializeElement(diagram); - document.setContent(diagram); - - return; - } - } - } - throw new RuntimeException(Messages.EcoreDocumentProvider_NoDiagramInResourceError); - } - catch (Exception e) - { - CoreException thrownExcp = null; - if (e instanceof CoreException) - { - thrownExcp = (CoreException)e; - } - else - { - String msg = e.getLocalizedMessage(); - thrownExcp = new CoreException(new Status(IStatus.ERROR, EcoreDiagramEditorPlugin.ID, 0, msg != null ? msg - : Messages.EcoreDocumentProvider_DiagramLoadingError, e)); - } - throw thrownExcp; - } - } - else - { - throw new CoreException(new Status(IStatus.ERROR, EcoreDiagramEditorPlugin.ID, 0, NLS.bind( - Messages.EcoreDocumentProvider_IncorrectInputError, new Object[] { element, - "org.eclipse.ui.part.FileEditorInput", "org.eclipse.emf.common.ui.URIEditorInput" }), //$NON-NLS-1$ //$NON-NLS-2$ - null)); - } - } - - @Override - public void changed(Object element) - { - if (element instanceof IEditorInput) - { - fireElementDirtyStateChanged(element, true); - } - } -} +/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Martin Fluegge - initial API and implementation
+ */
+package org.eclipse.emf.cdo.dawn.ecoretools.diagram.part;
+
+import org.eclipse.emf.cdo.dawn.gmf.util.DawnDiagramUpdater;
+import org.eclipse.emf.cdo.dawn.transaction.DawnDiagramEditingDomainFactory;
+import org.eclipse.emf.cdo.dawn.ui.DawnEditorInput;
+import org.eclipse.emf.cdo.eresource.CDOResource;
+
+import org.eclipse.emf.common.notify.Adapter;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.common.notify.Notifier;
+import org.eclipse.emf.common.ui.URIEditorInput;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecore.resource.ResourceSet;
+import org.eclipse.emf.ecoretools.diagram.part.EcoreDiagramEditorPlugin;
+import org.eclipse.emf.ecoretools.diagram.part.EcoreDocumentProvider;
+import org.eclipse.emf.ecoretools.diagram.part.Messages;
+import org.eclipse.emf.transaction.NotificationFilter;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+
+import org.eclipse.core.resources.IStorage;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.DiagramDocument;
+import org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.IDiagramDocument;
+import org.eclipse.gmf.runtime.diagram.ui.resources.editor.document.IDocument;
+import org.eclipse.gmf.runtime.diagram.ui.resources.editor.internal.util.DiagramIOUtil;
+import org.eclipse.gmf.runtime.emf.core.resources.GMFResourceFactory;
+import org.eclipse.gmf.runtime.notation.Diagram;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.part.FileEditorInput;
+
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+/**
+ * @author Martin Fluegge
+ */
+@SuppressWarnings("restriction")
+public class DawnEcoreDocumentProvider extends EcoreDocumentProvider
+{
+
+ public DawnEcoreDocumentProvider()
+ {
+ super();
+ EcoreDiagramEditorPlugin.getInstance().logInfo("Using DawnEcoreDocumentProvider instead of the original one");
+ }
+
+ /**
+ * override to change creation of editingdomain
+ */
+ @Override
+ protected IDocument createEmptyDocument()
+ {
+ DiagramDocument document = new DiagramDocument();
+ document.setEditingDomain(createEditingDomain());
+ return document;
+ }
+
+ /**
+ * override to change the EditingDomain
+ */
+ private TransactionalEditingDomain createEditingDomain()
+ {
+ TransactionalEditingDomain editingDomain = DawnDiagramEditingDomainFactory.getInstance().createEditingDomain();
+ editingDomain.setID("org.eclipse.emf.cdo.dawn.ecoretools.diagram.EditingDomain"); //$NON-NLS-1$
+ final NotificationFilter diagramResourceModifiedFilter = NotificationFilter
+ .createNotifierFilter(editingDomain.getResourceSet())
+ .and(NotificationFilter.createEventTypeFilter(Notification.ADD))
+ .and(NotificationFilter.createFeatureFilter(ResourceSet.class, ResourceSet.RESOURCE_SET__RESOURCES));
+ editingDomain.getResourceSet().eAdapters().add(new Adapter()
+ {
+ private Notifier myTarger;
+
+ public Notifier getTarget()
+ {
+ return myTarger;
+ }
+
+ public boolean isAdapterForType(Object type)
+ {
+ return false;
+ }
+
+ public void notifyChanged(Notification notification)
+ {
+ if (diagramResourceModifiedFilter.matches(notification))
+ {
+ Object value = notification.getNewValue();
+ if (value instanceof Resource)
+ {
+ ((Resource)value).setTrackingModification(true);
+ }
+ }
+ }
+
+ public void setTarget(Notifier newTarget)
+ {
+ myTarger = newTarget;
+ }
+ });
+
+ return editingDomain;
+ }
+
+ @SuppressWarnings({ "rawtypes", "unchecked" })
+ @Override
+ protected void setDocumentContent(IDocument document, IEditorInput element) throws CoreException
+ {
+ EcoreDiagramEditorPlugin.getInstance().logInfo("Editor Input: " + element.getName());
+
+ IDiagramDocument diagramDocument = (IDiagramDocument)document;
+ TransactionalEditingDomain domain = diagramDocument.getEditingDomain();
+ if (element instanceof FileEditorInput)
+ {
+ IStorage storage = ((FileEditorInput)element).getStorage();
+ Diagram diagram = DiagramIOUtil.load(domain, storage, true, getProgressMonitor());
+ document.setContent(diagram);
+ }
+ else if (element instanceof URIEditorInput)
+ {
+ URIEditorInput editorInput = (URIEditorInput)element;
+
+ URI uri = editorInput.getURI();
+ Resource resource = null;
+ try
+ {
+ URI dawnURI = URI.createURI(uri.toString().replace("cdo", "dawn"));
+ resource = domain.getResourceSet().getResource(dawnURI, false);
+ if (resource == null)
+ {
+ resource = domain.getResourceSet().getResource(dawnURI, true);
+ }
+
+ if (editorInput instanceof DawnEditorInput)
+ {
+ ((DawnEditorInput)editorInput).setResource((CDOResource)resource);
+ }
+ if (!resource.isLoaded())
+ {
+ try
+ {
+ Map options = new HashMap(GMFResourceFactory.getDefaultLoadOptions());
+ resource.load(options);
+ }
+ catch (IOException e)
+ {
+ resource.unload();
+ throw e;
+ }
+ }
+ if (uri.fragment() != null)
+ {
+ EObject rootElement = resource.getEObject(uri.fragment());
+ if (rootElement instanceof Diagram)
+ {
+ Diagram diagram = (Diagram)rootElement;
+ DawnDiagramUpdater.initializeElement(diagram);
+ document.setContent(diagram);
+
+ return;
+ }
+ }
+ else
+ {
+ for (Iterator<?> it = resource.getContents().iterator(); it.hasNext();)
+ {
+ Object rootElement = it.next();
+ if (rootElement instanceof Diagram)
+ {
+ Diagram diagram = (Diagram)rootElement;
+ DawnDiagramUpdater.initializeElement(diagram);
+ document.setContent(diagram);
+
+ return;
+ }
+ }
+ }
+ throw new RuntimeException(Messages.EcoreDocumentProvider_NoDiagramInResourceError);
+ }
+ catch (Exception e)
+ {
+ CoreException thrownExcp = null;
+ if (e instanceof CoreException)
+ {
+ thrownExcp = (CoreException)e;
+ }
+ else
+ {
+ String msg = e.getLocalizedMessage();
+ thrownExcp = new CoreException(new Status(IStatus.ERROR, EcoreDiagramEditorPlugin.ID, 0, msg != null ? msg
+ : Messages.EcoreDocumentProvider_DiagramLoadingError, e));
+ }
+ throw thrownExcp;
+ }
+ }
+ else
+ {
+ throw new CoreException(new Status(IStatus.ERROR, EcoreDiagramEditorPlugin.ID, 0, NLS.bind(
+ Messages.EcoreDocumentProvider_IncorrectInputError, new Object[] { element,
+ "org.eclipse.ui.part.FileEditorInput", "org.eclipse.emf.common.ui.URIEditorInput" }), //$NON-NLS-1$ //$NON-NLS-2$
+ null));
+ }
+ }
+
+ @Override
+ public void changed(Object element)
+ {
+ if (element instanceof IEditorInput)
+ {
+ fireElementDirtyStateChanged(element, true);
+ }
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.dawn.ecoretools.diagram.dawn/src/org/eclipse/emf/cdo/dawn/ecoretools/diagram/providers/DawnEcoreEditPartProvider.java b/plugins/org.eclipse.emf.cdo.dawn.ecoretools.diagram.dawn/src/org/eclipse/emf/cdo/dawn/ecoretools/diagram/providers/DawnEcoreEditPartProvider.java index 0621ea75cd..e9b2a03fa9 100644 --- a/plugins/org.eclipse.emf.cdo.dawn.ecoretools.diagram.dawn/src/org/eclipse/emf/cdo/dawn/ecoretools/diagram/providers/DawnEcoreEditPartProvider.java +++ b/plugins/org.eclipse.emf.cdo.dawn.ecoretools.diagram.dawn/src/org/eclipse/emf/cdo/dawn/ecoretools/diagram/providers/DawnEcoreEditPartProvider.java @@ -1,34 +1,34 @@ -/* - * Copyright (c) 2004 - 2011 Eike Stepper (Berlin, Germany). - * 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: - * Martin Fluegge - initial API and implementation - */ -package org.eclipse.emf.cdo.dawn.ecoretools.diagram.providers; - -import org.eclipse.emf.cdo.dawn.ecoretools.diagram.edit.parts.DawnEcoreEditPartFactory; - -import org.eclipse.emf.ecoretools.diagram.part.EcoreDiagramEditorPlugin; -import org.eclipse.emf.ecoretools.diagram.providers.EcoreEditPartProvider; - -/** - * @author Martin Fluegge - */ -public class DawnEcoreEditPartProvider extends EcoreEditPartProvider -{ - /** - * This class is currently not needed because the change of the EditPolicy is done by changing the EditPart but by - * using an own EditPartPolicyProvider. The class is left to have the chance to influence the behavior of the - * EditParts from the generated fragment. - */ - public DawnEcoreEditPartProvider() - { - super(); - EcoreDiagramEditorPlugin.getInstance().logInfo("Using DawnEcoreEditPartProvider instead of the original one."); - setFactory(new DawnEcoreEditPartFactory()); - } -} +/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Martin Fluegge - initial API and implementation
+ */
+package org.eclipse.emf.cdo.dawn.ecoretools.diagram.providers;
+
+import org.eclipse.emf.cdo.dawn.ecoretools.diagram.edit.parts.DawnEcoreEditPartFactory;
+
+import org.eclipse.emf.ecoretools.diagram.part.EcoreDiagramEditorPlugin;
+import org.eclipse.emf.ecoretools.diagram.providers.EcoreEditPartProvider;
+
+/**
+ * @author Martin Fluegge
+ */
+public class DawnEcoreEditPartProvider extends EcoreEditPartProvider
+{
+ /**
+ * This class is currently not needed because the change of the EditPolicy is done by changing the EditPart but by
+ * using an own EditPartPolicyProvider. The class is left to have the chance to influence the behavior of the
+ * EditParts from the generated fragment.
+ */
+ public DawnEcoreEditPartProvider()
+ {
+ super();
+ EcoreDiagramEditorPlugin.getInstance().logInfo("Using DawnEcoreEditPartProvider instead of the original one.");
+ setFactory(new DawnEcoreEditPartFactory());
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.dawn.ecoretools.diagram.dawn/src/org/eclipse/emf/cdo/dawn/ecoretools/diagram/providers/DawnEcoreEditPolicyProvider.java b/plugins/org.eclipse.emf.cdo.dawn.ecoretools.diagram.dawn/src/org/eclipse/emf/cdo/dawn/ecoretools/diagram/providers/DawnEcoreEditPolicyProvider.java index 9391607765..057af16f38 100644 --- a/plugins/org.eclipse.emf.cdo.dawn.ecoretools.diagram.dawn/src/org/eclipse/emf/cdo/dawn/ecoretools/diagram/providers/DawnEcoreEditPolicyProvider.java +++ b/plugins/org.eclipse.emf.cdo.dawn.ecoretools.diagram.dawn/src/org/eclipse/emf/cdo/dawn/ecoretools/diagram/providers/DawnEcoreEditPolicyProvider.java @@ -1,56 +1,56 @@ -/* - * Copyright (c) 2004 - 2011 Eike Stepper (Berlin, Germany). - * 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: - * Martin Fluegge - initial API and implementation - */ -package org.eclipse.emf.cdo.dawn.ecoretools.diagram.providers; - -import org.eclipse.emf.cdo.dawn.ecoretools.diagram.edit.policies.DawnECoreRootCanonicalEditPolicy; - -import org.eclipse.emf.ecoretools.diagram.edit.parts.EPackageEditPart; -import org.eclipse.emf.ecoretools.diagram.part.EcoreDiagramEditorPlugin; - -import org.eclipse.gef.EditPart; -import org.eclipse.gmf.runtime.common.core.service.AbstractProvider; -import org.eclipse.gmf.runtime.common.core.service.IOperation; -import org.eclipse.gmf.runtime.diagram.ui.services.editpolicy.CreateEditPoliciesOperation; -import org.eclipse.gmf.runtime.diagram.ui.services.editpolicy.IEditPolicyProvider; - -/** - * @author Martin Fluegge - */ -public class DawnEcoreEditPolicyProvider extends AbstractProvider implements IEditPolicyProvider -{ - public static String ID = "org.eclipse.emf.cdo.dawn.ecoretools.diagram.providers.DawnEcoreEditPolicyProvider"; - - public boolean provides(IOperation operation) - { - if (operation instanceof CreateEditPoliciesOperation) - { - CreateEditPoliciesOperation editPoliciesOperation = (CreateEditPoliciesOperation)operation; - if (editPoliciesOperation.getEditPart() instanceof EPackageEditPart) - { - return true; - } - } - return false; - } - - public void createEditPolicies(EditPart editPart) - { - if (editPart instanceof EPackageEditPart) - { - EcoreDiagramEditorPlugin.getInstance().logInfo("Overwriting CANONICAL EDITING POLICY in " + editPart); - - // The EcoreTools implementation overwrites the generated canonical editing policy. But it does not register it a - // "canonical" but as "pseudocanonical". So we need to do the same to overwrite the behavior. - editPart.installEditPolicy("PseudoCanonical", new DawnECoreRootCanonicalEditPolicy()); - // editPart.installEditPolicy(EditPolicyRoles.CANONICAL_ROLE, new DawnECoreRootCanonicalEditPolicy()); - } - } -} +/*
+ * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Martin Fluegge - initial API and implementation
+ */
+package org.eclipse.emf.cdo.dawn.ecoretools.diagram.providers;
+
+import org.eclipse.emf.cdo.dawn.ecoretools.diagram.edit.policies.DawnECoreRootCanonicalEditPolicy;
+
+import org.eclipse.emf.ecoretools.diagram.edit.parts.EPackageEditPart;
+import org.eclipse.emf.ecoretools.diagram.part.EcoreDiagramEditorPlugin;
+
+import org.eclipse.gef.EditPart;
+import org.eclipse.gmf.runtime.common.core.service.AbstractProvider;
+import org.eclipse.gmf.runtime.common.core.service.IOperation;
+import org.eclipse.gmf.runtime.diagram.ui.services.editpolicy.CreateEditPoliciesOperation;
+import org.eclipse.gmf.runtime.diagram.ui.services.editpolicy.IEditPolicyProvider;
+
+/**
+ * @author Martin Fluegge
+ */
+public class DawnEcoreEditPolicyProvider extends AbstractProvider implements IEditPolicyProvider
+{
+ public static String ID = "org.eclipse.emf.cdo.dawn.ecoretools.diagram.providers.DawnEcoreEditPolicyProvider";
+
+ public boolean provides(IOperation operation)
+ {
+ if (operation instanceof CreateEditPoliciesOperation)
+ {
+ CreateEditPoliciesOperation editPoliciesOperation = (CreateEditPoliciesOperation)operation;
+ if (editPoliciesOperation.getEditPart() instanceof EPackageEditPart)
+ {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public void createEditPolicies(EditPart editPart)
+ {
+ if (editPart instanceof EPackageEditPart)
+ {
+ EcoreDiagramEditorPlugin.getInstance().logInfo("Overwriting CANONICAL EDITING POLICY in " + editPart);
+
+ // The EcoreTools implementation overwrites the generated canonical editing policy. But it does not register it a
+ // "canonical" but as "pseudocanonical". So we need to do the same to overwrite the behavior.
+ editPart.installEditPolicy("PseudoCanonical", new DawnECoreRootCanonicalEditPolicy());
+ // editPart.installEditPolicy(EditPolicyRoles.CANONICAL_ROLE, new DawnECoreRootCanonicalEditPolicy());
+ }
+ }
+}
|