Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/org.eclipse.emf.cdo.dawn.gmf')
-rw-r--r--plugins/org.eclipse.emf.cdo.dawn.gmf/.settings/org.eclipse.jdt.ui.prefs240
-rw-r--r--plugins/org.eclipse.emf.cdo.dawn.gmf/build.properties11
-rw-r--r--plugins/org.eclipse.emf.cdo.dawn.gmf/copyright.txt14
-rw-r--r--plugins/org.eclipse.emf.cdo.dawn.gmf/plugin.properties22
-rw-r--r--plugins/org.eclipse.emf.cdo.dawn.gmf/plugin.xml12
-rw-r--r--plugins/org.eclipse.emf.cdo.dawn.gmf/src/org/eclipse/emf/cdo/dawn/gmf/Activator.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.dawn.gmf/src/org/eclipse/emf/cdo/dawn/gmf/appearance/DawnAppearancer.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.dawn.gmf/src/org/eclipse/emf/cdo/dawn/gmf/appearance/DawnEditPartStylizer.java120
-rw-r--r--plugins/org.eclipse.emf.cdo.dawn.gmf/src/org/eclipse/emf/cdo/dawn/gmf/appearance/DawnEditPartStylizerRegistry.java260
-rw-r--r--plugins/org.eclipse.emf.cdo.dawn.gmf/src/org/eclipse/emf/cdo/dawn/gmf/appearance/impl/DawnBasicConnectionEditPartStylizerImpl.java246
-rw-r--r--plugins/org.eclipse.emf.cdo.dawn.gmf/src/org/eclipse/emf/cdo/dawn/gmf/appearance/impl/DawnBasicDiagramStylizerImpl.java92
-rw-r--r--plugins/org.eclipse.emf.cdo.dawn.gmf/src/org/eclipse/emf/cdo/dawn/gmf/appearance/impl/DawnBasicGraphicalEditPartStylizerImpl.java158
-rw-r--r--plugins/org.eclipse.emf.cdo.dawn.gmf/src/org/eclipse/emf/cdo/dawn/gmf/appearance/impl/DawnBasicNodeEditPartStylizerImpl.java112
-rw-r--r--plugins/org.eclipse.emf.cdo.dawn.gmf/src/org/eclipse/emf/cdo/dawn/gmf/appearance/impl/DawnBasicTextAwareEditPartStylizerImpl.java130
-rw-r--r--plugins/org.eclipse.emf.cdo.dawn.gmf/src/org/eclipse/emf/cdo/dawn/gmf/appearance/impl/DawnBlinkingNodeEditPartStylizerImpl.java210
-rw-r--r--plugins/org.eclipse.emf.cdo.dawn.gmf/src/org/eclipse/emf/cdo/dawn/gmf/editors/impl/DawnGMFEditorSupport.java396
-rw-r--r--plugins/org.eclipse.emf.cdo.dawn.gmf/src/org/eclipse/emf/cdo/dawn/gmf/elementtypes/DawnElementTypeHelper.java60
-rw-r--r--plugins/org.eclipse.emf.cdo.dawn.gmf/src/org/eclipse/emf/cdo/dawn/gmf/elementtypes/DawnElementTypeHelperFactory.java38
-rw-r--r--plugins/org.eclipse.emf.cdo.dawn.gmf/src/org/eclipse/emf/cdo/dawn/gmf/notifications/impl/DawnGMFHandler.java574
-rw-r--r--plugins/org.eclipse.emf.cdo.dawn.gmf/src/org/eclipse/emf/cdo/dawn/gmf/notifications/impl/DawnGMFLockingHandler.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.dawn.gmf/src/org/eclipse/emf/cdo/dawn/gmf/resources/DawnPathmapManager.java128
-rw-r--r--plugins/org.eclipse.emf.cdo.dawn.gmf/src/org/eclipse/emf/cdo/dawn/gmf/stylizer/DawnGMFElementStylizerFactory.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.dawn.gmf/src/org/eclipse/emf/cdo/dawn/gmf/synchronize/DawnChangeHelper.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.dawn.gmf/src/org/eclipse/emf/cdo/dawn/gmf/synchronize/DawnConflictHelper.java2
-rw-r--r--plugins/org.eclipse.emf.cdo.dawn.gmf/src/org/eclipse/emf/cdo/dawn/gmf/util/DawnDiagramUpdater.java794
-rw-r--r--plugins/org.eclipse.emf.cdo.dawn.gmf/src/org/eclipse/emf/cdo/dawn/gmf/util/DawnResourceHelper.java1968
-rw-r--r--plugins/org.eclipse.emf.cdo.dawn.gmf/src/org/eclipse/emf/cdo/dawn/transaction/DawnDiagramEditingDomainFactory.java228
-rw-r--r--plugins/org.eclipse.emf.cdo.dawn.gmf/src/org/eclipse/emf/cdo/dawn/transaction/DawnGMFEditingDomainFactory.java212
28 files changed, 3030 insertions, 3007 deletions
diff --git a/plugins/org.eclipse.emf.cdo.dawn.gmf/.settings/org.eclipse.jdt.ui.prefs b/plugins/org.eclipse.emf.cdo.dawn.gmf/.settings/org.eclipse.jdt.ui.prefs
index aaef0ccba1..6726e7034a 100644
--- a/plugins/org.eclipse.emf.cdo.dawn.gmf/.settings/org.eclipse.jdt.ui.prefs
+++ b/plugins/org.eclipse.emf.cdo.dawn.gmf/.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 * Eike Stepper - 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 Eike Stepper\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 * Eike Stepper - 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 Eike Stepper\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.gmf/build.properties b/plugins/org.eclipse.emf.cdo.dawn.gmf/build.properties
index 60f663427c..a98b4b81ce 100644
--- a/plugins/org.eclipse.emf.cdo.dawn.gmf/build.properties
+++ b/plugins/org.eclipse.emf.cdo.dawn.gmf/build.properties
@@ -1,3 +1,14 @@
+# 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
+
source.. = src/
output.. = bin/
bin.includes = META-INF/,\
diff --git a/plugins/org.eclipse.emf.cdo.dawn.gmf/copyright.txt b/plugins/org.eclipse.emf.cdo.dawn.gmf/copyright.txt
index a5ec07f141..9cbb3ba084 100644
--- a/plugins/org.eclipse.emf.cdo.dawn.gmf/copyright.txt
+++ b/plugins/org.eclipse.emf.cdo.dawn.gmf/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.gmf/plugin.properties b/plugins/org.eclipse.emf.cdo.dawn.gmf/plugin.properties
index 220ac78a75..8e9e89b94c 100644
--- a/plugins/org.eclipse.emf.cdo.dawn.gmf/plugin.properties
+++ b/plugins/org.eclipse.emf.cdo.dawn.gmf/plugin.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 Runtime GMF
-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 Runtime GMF
+providerName = Eclipse Modeling Project
diff --git a/plugins/org.eclipse.emf.cdo.dawn.gmf/plugin.xml b/plugins/org.eclipse.emf.cdo.dawn.gmf/plugin.xml
index ea27d6e262..4aed344219 100644
--- a/plugins/org.eclipse.emf.cdo.dawn.gmf/plugin.xml
+++ b/plugins/org.eclipse.emf.cdo.dawn.gmf/plugin.xml
@@ -1,6 +1,18 @@
<?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:
+ Eike Stepper - initial API and implementation
+-->
+
<plugin>
+
<extension
point="org.eclipse.emf.cdo.dawn.elementstylizerfactory">
<DawnElementStylizerFactory
diff --git a/plugins/org.eclipse.emf.cdo.dawn.gmf/src/org/eclipse/emf/cdo/dawn/gmf/Activator.java b/plugins/org.eclipse.emf.cdo.dawn.gmf/src/org/eclipse/emf/cdo/dawn/gmf/Activator.java
index af3b36caad..47bfe130b5 100644
--- a/plugins/org.eclipse.emf.cdo.dawn.gmf/src/org/eclipse/emf/cdo/dawn/gmf/Activator.java
+++ b/plugins/org.eclipse.emf.cdo.dawn.gmf/src/org/eclipse/emf/cdo/dawn/gmf/Activator.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2004 - 2011 Eike Stepper (Berlin, Germany) and others.
+ * 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.gmf/src/org/eclipse/emf/cdo/dawn/gmf/appearance/DawnAppearancer.java b/plugins/org.eclipse.emf.cdo.dawn.gmf/src/org/eclipse/emf/cdo/dawn/gmf/appearance/DawnAppearancer.java
index dc9c0c6c38..e0bb80736e 100644
--- a/plugins/org.eclipse.emf.cdo.dawn.gmf/src/org/eclipse/emf/cdo/dawn/gmf/appearance/DawnAppearancer.java
+++ b/plugins/org.eclipse.emf.cdo.dawn.gmf/src/org/eclipse/emf/cdo/dawn/gmf/appearance/DawnAppearancer.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2004 - 2011 Eike Stepper (Berlin, Germany) and others.
+ * 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.gmf/src/org/eclipse/emf/cdo/dawn/gmf/appearance/DawnEditPartStylizer.java b/plugins/org.eclipse.emf.cdo.dawn.gmf/src/org/eclipse/emf/cdo/dawn/gmf/appearance/DawnEditPartStylizer.java
index 0b7ee013a4..fae55d139c 100644
--- a/plugins/org.eclipse.emf.cdo.dawn.gmf/src/org/eclipse/emf/cdo/dawn/gmf/appearance/DawnEditPartStylizer.java
+++ b/plugins/org.eclipse.emf.cdo.dawn.gmf/src/org/eclipse/emf/cdo/dawn/gmf/appearance/DawnEditPartStylizer.java
@@ -1,60 +1,60 @@
-/*
- * 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
- */
-package org.eclipse.emf.cdo.dawn.gmf.appearance;
-
-import org.eclipse.emf.cdo.dawn.ui.stylizer.DawnDefaultElementStylizer;
-
-import org.eclipse.gef.EditPart;
-
-/**
- * An EditPartStylizer can influence the visual representation of the models state. Dawn knows three states - default,
- * conflicted and locked. By implementing an own DawnStylizer you can influence the appearance of the three states for
- * your EditPart and it's related models. New stylizer can be registered to Dawn using the
- * <b>org.eclipse.emf.cdo.dawn.editpartstylizers</b> extension point.
- *
- * @author Martin Fluegge
- * @since 2.0
- */
-public abstract class DawnEditPartStylizer extends DawnDefaultElementStylizer
-{
- /**
- * @since 2.0
- */
- public abstract void setDefault(EditPart editPart);
-
- /**
- * @since 2.0
- */
- public abstract void setConflicted(EditPart editPart, int type);
-
- /**
- * @since 2.0
- */
- public abstract void setLocked(EditPart editPart, int type);
-
- @Override
- public void setDefault(Object element)
- {
- setDefault((EditPart)element);
- }
-
- @Override
- public void setConflicted(Object element, int type)
- {
- setConflicted((EditPart)element, type);
- }
-
- @Override
- public void setLocked(Object element, int type)
- {
- setLocked((EditPart)element, type);
- }
-}
+/*
+ * 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.gmf.appearance;
+
+import org.eclipse.emf.cdo.dawn.ui.stylizer.DawnDefaultElementStylizer;
+
+import org.eclipse.gef.EditPart;
+
+/**
+ * An EditPartStylizer can influence the visual representation of the models state. Dawn knows three states - default,
+ * conflicted and locked. By implementing an own DawnStylizer you can influence the appearance of the three states for
+ * your EditPart and it's related models. New stylizer can be registered to Dawn using the
+ * <b>org.eclipse.emf.cdo.dawn.editpartstylizers</b> extension point.
+ *
+ * @author Martin Fluegge
+ * @since 2.0
+ */
+public abstract class DawnEditPartStylizer extends DawnDefaultElementStylizer
+{
+ /**
+ * @since 2.0
+ */
+ public abstract void setDefault(EditPart editPart);
+
+ /**
+ * @since 2.0
+ */
+ public abstract void setConflicted(EditPart editPart, int type);
+
+ /**
+ * @since 2.0
+ */
+ public abstract void setLocked(EditPart editPart, int type);
+
+ @Override
+ public void setDefault(Object element)
+ {
+ setDefault((EditPart)element);
+ }
+
+ @Override
+ public void setConflicted(Object element, int type)
+ {
+ setConflicted((EditPart)element, type);
+ }
+
+ @Override
+ public void setLocked(Object element, int type)
+ {
+ setLocked((EditPart)element, type);
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.dawn.gmf/src/org/eclipse/emf/cdo/dawn/gmf/appearance/DawnEditPartStylizerRegistry.java b/plugins/org.eclipse.emf.cdo.dawn.gmf/src/org/eclipse/emf/cdo/dawn/gmf/appearance/DawnEditPartStylizerRegistry.java
index ffefd74d41..07aa4295d0 100644
--- a/plugins/org.eclipse.emf.cdo.dawn.gmf/src/org/eclipse/emf/cdo/dawn/gmf/appearance/DawnEditPartStylizerRegistry.java
+++ b/plugins/org.eclipse.emf.cdo.dawn.gmf/src/org/eclipse/emf/cdo/dawn/gmf/appearance/DawnEditPartStylizerRegistry.java
@@ -1,130 +1,130 @@
-/*
- * 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
- */
-package org.eclipse.emf.cdo.dawn.gmf.appearance;
-
-import org.eclipse.emf.cdo.dawn.gmf.appearance.impl.DawnBasicConnectionEditPartStylizerImpl;
-import org.eclipse.emf.cdo.dawn.gmf.appearance.impl.DawnBasicGraphicalEditPartStylizerImpl;
-import org.eclipse.emf.cdo.dawn.gmf.appearance.impl.DawnBasicNodeEditPartStylizerImpl;
-import org.eclipse.emf.cdo.dawn.gmf.appearance.impl.DawnBasicTextAwareEditPartStylizerImpl;
-import org.eclipse.emf.cdo.internal.dawn.bundle.OM;
-
-import org.eclipse.net4j.util.om.trace.ContextTracer;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.InvalidRegistryObjectException;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.gef.ConnectionEditPart;
-import org.eclipse.gef.EditPart;
-import org.eclipse.gef.NodeEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
-
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * @author Martin Fluegge
- * @since 2.0
- * @deprecated
- */
-@Deprecated
-public class DawnEditPartStylizerRegistry
-{
- private static final ContextTracer TRACER = new ContextTracer(OM.DEBUG, DawnEditPartStylizerRegistry.class);
-
- private static final String DAWN_STYLIZER_EXTENSION_POINT_ID = "org.eclipse.emf.cdo.dawn.editpartstylizers";
-
- public static DawnEditPartStylizerRegistry instance = new DawnEditPartStylizerRegistry();
-
- private Map<String, DawnEditPartStylizer> registeredStylizers = new HashMap<String, DawnEditPartStylizer>();
-
- /**
- * @since 2.0
- */
- public DawnEditPartStylizer getStylizer(EditPart editPart)
- {
- DawnEditPartStylizer stylizer = registeredStylizers.get(editPart.getClass().getCanonicalName());
-
- if (stylizer == null)
- {
- stylizer = getStylizerFromExtensionPoint(editPart);
- }
-
- if (stylizer == null)
- {
- stylizer = getDefaultStylizer(editPart);
- }
-
- return stylizer;
- }
-
- private DawnEditPartStylizer getDefaultStylizer(EditPart editPart)
- {
- DawnEditPartStylizer stylizer = null;
- if (editPart instanceof ConnectionEditPart)
- {
- stylizer = new DawnBasicConnectionEditPartStylizerImpl();
- }
- else if (editPart instanceof NodeEditPart)
- {
- stylizer = new DawnBasicNodeEditPartStylizerImpl();
- }
- else if (editPart instanceof DiagramEditPart)
- {
- stylizer = new DawnBasicNodeEditPartStylizerImpl();
- }
- else if (editPart instanceof ITextAwareEditPart)
- {
- stylizer = new DawnBasicTextAwareEditPartStylizerImpl();
- }
- else
- {
- // In the case that there is no match we use a simple border styled stylizer.
- stylizer = new DawnBasicGraphicalEditPartStylizerImpl();
- }
-
- return stylizer;
- }
-
- private DawnEditPartStylizer getStylizerFromExtensionPoint(EditPart editPart)
- {
- try
- {
- IConfigurationElement[] config = Platform.getExtensionRegistry().getConfigurationElementsFor(
- DAWN_STYLIZER_EXTENSION_POINT_ID);
- for (IConfigurationElement e : config)
- {
- if (editPart.getClass().getCanonicalName().equals(e.getAttribute("editpart")))
- {
- DawnEditPartStylizer stylizer = (DawnEditPartStylizer)e.createExecutableExtension("stylizer");
- registeredStylizers.put(editPart.getClass().getCanonicalName(), stylizer);
- if (TRACER.isEnabled())
- {
- TRACER.format("Registered DawnEditPartStylizer {0} ", stylizer); //$NON-NLS-1$
- }
-
- return stylizer;
- }
- }
- }
- catch (InvalidRegistryObjectException e1)
- {
- e1.printStackTrace();
- }
- catch (CoreException e)
- {
- e.printStackTrace();
- }
-
- return null;
- }
-}
+/*
+ * 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.gmf.appearance;
+
+import org.eclipse.emf.cdo.dawn.gmf.appearance.impl.DawnBasicConnectionEditPartStylizerImpl;
+import org.eclipse.emf.cdo.dawn.gmf.appearance.impl.DawnBasicGraphicalEditPartStylizerImpl;
+import org.eclipse.emf.cdo.dawn.gmf.appearance.impl.DawnBasicNodeEditPartStylizerImpl;
+import org.eclipse.emf.cdo.dawn.gmf.appearance.impl.DawnBasicTextAwareEditPartStylizerImpl;
+import org.eclipse.emf.cdo.internal.dawn.bundle.OM;
+
+import org.eclipse.net4j.util.om.trace.ContextTracer;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.InvalidRegistryObjectException;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.gef.ConnectionEditPart;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.NodeEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * @author Martin Fluegge
+ * @since 2.0
+ * @deprecated
+ */
+@Deprecated
+public class DawnEditPartStylizerRegistry
+{
+ private static final ContextTracer TRACER = new ContextTracer(OM.DEBUG, DawnEditPartStylizerRegistry.class);
+
+ private static final String DAWN_STYLIZER_EXTENSION_POINT_ID = "org.eclipse.emf.cdo.dawn.editpartstylizers";
+
+ public static DawnEditPartStylizerRegistry instance = new DawnEditPartStylizerRegistry();
+
+ private Map<String, DawnEditPartStylizer> registeredStylizers = new HashMap<String, DawnEditPartStylizer>();
+
+ /**
+ * @since 2.0
+ */
+ public DawnEditPartStylizer getStylizer(EditPart editPart)
+ {
+ DawnEditPartStylizer stylizer = registeredStylizers.get(editPart.getClass().getCanonicalName());
+
+ if (stylizer == null)
+ {
+ stylizer = getStylizerFromExtensionPoint(editPart);
+ }
+
+ if (stylizer == null)
+ {
+ stylizer = getDefaultStylizer(editPart);
+ }
+
+ return stylizer;
+ }
+
+ private DawnEditPartStylizer getDefaultStylizer(EditPart editPart)
+ {
+ DawnEditPartStylizer stylizer = null;
+ if (editPart instanceof ConnectionEditPart)
+ {
+ stylizer = new DawnBasicConnectionEditPartStylizerImpl();
+ }
+ else if (editPart instanceof NodeEditPart)
+ {
+ stylizer = new DawnBasicNodeEditPartStylizerImpl();
+ }
+ else if (editPart instanceof DiagramEditPart)
+ {
+ stylizer = new DawnBasicNodeEditPartStylizerImpl();
+ }
+ else if (editPart instanceof ITextAwareEditPart)
+ {
+ stylizer = new DawnBasicTextAwareEditPartStylizerImpl();
+ }
+ else
+ {
+ // In the case that there is no match we use a simple border styled stylizer.
+ stylizer = new DawnBasicGraphicalEditPartStylizerImpl();
+ }
+
+ return stylizer;
+ }
+
+ private DawnEditPartStylizer getStylizerFromExtensionPoint(EditPart editPart)
+ {
+ try
+ {
+ IConfigurationElement[] config = Platform.getExtensionRegistry().getConfigurationElementsFor(
+ DAWN_STYLIZER_EXTENSION_POINT_ID);
+ for (IConfigurationElement e : config)
+ {
+ if (editPart.getClass().getCanonicalName().equals(e.getAttribute("editpart")))
+ {
+ DawnEditPartStylizer stylizer = (DawnEditPartStylizer)e.createExecutableExtension("stylizer");
+ registeredStylizers.put(editPart.getClass().getCanonicalName(), stylizer);
+ if (TRACER.isEnabled())
+ {
+ TRACER.format("Registered DawnEditPartStylizer {0} ", stylizer); //$NON-NLS-1$
+ }
+
+ return stylizer;
+ }
+ }
+ }
+ catch (InvalidRegistryObjectException e1)
+ {
+ e1.printStackTrace();
+ }
+ catch (CoreException e)
+ {
+ e.printStackTrace();
+ }
+
+ return null;
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.dawn.gmf/src/org/eclipse/emf/cdo/dawn/gmf/appearance/impl/DawnBasicConnectionEditPartStylizerImpl.java b/plugins/org.eclipse.emf.cdo.dawn.gmf/src/org/eclipse/emf/cdo/dawn/gmf/appearance/impl/DawnBasicConnectionEditPartStylizerImpl.java
index 076a56af67..9a230fd0be 100644
--- a/plugins/org.eclipse.emf.cdo.dawn.gmf/src/org/eclipse/emf/cdo/dawn/gmf/appearance/impl/DawnBasicConnectionEditPartStylizerImpl.java
+++ b/plugins/org.eclipse.emf.cdo.dawn.gmf/src/org/eclipse/emf/cdo/dawn/gmf/appearance/impl/DawnBasicConnectionEditPartStylizerImpl.java
@@ -1,123 +1,123 @@
-/*
- * 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
- */
-package org.eclipse.emf.cdo.dawn.gmf.appearance.impl;
-
-import org.eclipse.emf.cdo.dawn.gmf.appearance.DawnAppearancer;
-import org.eclipse.emf.cdo.dawn.gmf.appearance.DawnEditPartStylizer;
-import org.eclipse.emf.cdo.dawn.spi.DawnState;
-import org.eclipse.emf.cdo.dawn.ui.DawnColorConstants;
-
-import org.eclipse.emf.workspace.AbstractEMFOperation;
-
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.gef.EditPart;
-import org.eclipse.gef.commands.Command;
-import org.eclipse.gmf.runtime.common.core.util.StringStatics;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.requests.ChangePropertyValueRequest;
-import org.eclipse.gmf.runtime.draw2d.ui.figures.FigureUtilities;
-import org.eclipse.gmf.runtime.emf.core.util.PackageUtil;
-import org.eclipse.gmf.runtime.notation.NotationPackage;
-import org.eclipse.swt.graphics.Color;
-
-/**
- * @author Martin Fluegge
- * @since 2.0
- */
-public class DawnBasicConnectionEditPartStylizerImpl extends DawnEditPartStylizer
-{
-
- /**
- * @since 2.0
- */
- @Override
- public void setDefault(EditPart editPart)
- {
- setEdge(editPart, DawnColorConstants.COLOR_NO_CONFLICT);
- }
-
- /**
- * @since 2.0
- */
- @Override
- public void setConflicted(EditPart editPart, int type)
- {
- // Color color = DawnColorConstants.COLOR_DELETE_CONFLICT;
- Color color = getForegroundColor(editPart, DawnState.CONFLICT);
- setEdge(editPart, color);
- }
-
- /**
- * @since 2.0
- */
- private void setEdge(EditPart editPart, Color color)
- {
- ChangePropertyValueRequest request = new ChangePropertyValueRequest(StringStatics.BLANK,
- PackageUtil.getID(NotationPackage.eINSTANCE.getLineStyle_LineColor()), FigureUtilities.colorToInteger(color));
- final Command command = editPart.getCommand(request);
-
- AbstractEMFOperation operation = new AbstractEMFOperation(((IGraphicalEditPart)editPart).getEditingDomain(),
- StringStatics.BLANK, null)
- {
- @Override
- protected IStatus doExecute(IProgressMonitor monitor, IAdaptable info) throws ExecutionException
- {
- command.execute();
- return Status.OK_STATUS;
- }
- };
-
- try
- {
- operation.execute(new NullProgressMonitor(), null);
- }
- catch (ExecutionException e)
- {
- }
-
- editPart.refresh();
- editPart.getRoot().refresh();
- }
-
- /**
- * @since 2.0
- */
- @Override
- public void setLocked(EditPart editPart, int type)
- {
- Color color = null;
- switch (type)
- {
- case DawnAppearancer.TYPE_LOCKED_LOCALLY:
- {
- color = getBackgroundColor(editPart, DawnState.LOCKED_LOCALLY);
- break;
- }
- case DawnAppearancer.TYPE_LOCKED_GLOBALLY:
- {
- color = getBackgroundColor(editPart, DawnState.LOCKED_REMOTELY);
- break;
- }
-
- default:
- break;
- }
- if (color != null)
- {
- setEdge(editPart, color);
- }
- }
-}
+/*
+ * 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.gmf.appearance.impl;
+
+import org.eclipse.emf.cdo.dawn.gmf.appearance.DawnAppearancer;
+import org.eclipse.emf.cdo.dawn.gmf.appearance.DawnEditPartStylizer;
+import org.eclipse.emf.cdo.dawn.spi.DawnState;
+import org.eclipse.emf.cdo.dawn.ui.DawnColorConstants;
+
+import org.eclipse.emf.workspace.AbstractEMFOperation;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gmf.runtime.common.core.util.StringStatics;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.requests.ChangePropertyValueRequest;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.FigureUtilities;
+import org.eclipse.gmf.runtime.emf.core.util.PackageUtil;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.swt.graphics.Color;
+
+/**
+ * @author Martin Fluegge
+ * @since 2.0
+ */
+public class DawnBasicConnectionEditPartStylizerImpl extends DawnEditPartStylizer
+{
+
+ /**
+ * @since 2.0
+ */
+ @Override
+ public void setDefault(EditPart editPart)
+ {
+ setEdge(editPart, DawnColorConstants.COLOR_NO_CONFLICT);
+ }
+
+ /**
+ * @since 2.0
+ */
+ @Override
+ public void setConflicted(EditPart editPart, int type)
+ {
+ // Color color = DawnColorConstants.COLOR_DELETE_CONFLICT;
+ Color color = getForegroundColor(editPart, DawnState.CONFLICT);
+ setEdge(editPart, color);
+ }
+
+ /**
+ * @since 2.0
+ */
+ private void setEdge(EditPart editPart, Color color)
+ {
+ ChangePropertyValueRequest request = new ChangePropertyValueRequest(StringStatics.BLANK,
+ PackageUtil.getID(NotationPackage.eINSTANCE.getLineStyle_LineColor()), FigureUtilities.colorToInteger(color));
+ final Command command = editPart.getCommand(request);
+
+ AbstractEMFOperation operation = new AbstractEMFOperation(((IGraphicalEditPart)editPart).getEditingDomain(),
+ StringStatics.BLANK, null)
+ {
+ @Override
+ protected IStatus doExecute(IProgressMonitor monitor, IAdaptable info) throws ExecutionException
+ {
+ command.execute();
+ return Status.OK_STATUS;
+ }
+ };
+
+ try
+ {
+ operation.execute(new NullProgressMonitor(), null);
+ }
+ catch (ExecutionException e)
+ {
+ }
+
+ editPart.refresh();
+ editPart.getRoot().refresh();
+ }
+
+ /**
+ * @since 2.0
+ */
+ @Override
+ public void setLocked(EditPart editPart, int type)
+ {
+ Color color = null;
+ switch (type)
+ {
+ case DawnAppearancer.TYPE_LOCKED_LOCALLY:
+ {
+ color = getBackgroundColor(editPart, DawnState.LOCKED_LOCALLY);
+ break;
+ }
+ case DawnAppearancer.TYPE_LOCKED_GLOBALLY:
+ {
+ color = getBackgroundColor(editPart, DawnState.LOCKED_REMOTELY);
+ break;
+ }
+
+ default:
+ break;
+ }
+ if (color != null)
+ {
+ setEdge(editPart, color);
+ }
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.dawn.gmf/src/org/eclipse/emf/cdo/dawn/gmf/appearance/impl/DawnBasicDiagramStylizerImpl.java b/plugins/org.eclipse.emf.cdo.dawn.gmf/src/org/eclipse/emf/cdo/dawn/gmf/appearance/impl/DawnBasicDiagramStylizerImpl.java
index 0f7f7f1989..0661e9fb80 100644
--- a/plugins/org.eclipse.emf.cdo.dawn.gmf/src/org/eclipse/emf/cdo/dawn/gmf/appearance/impl/DawnBasicDiagramStylizerImpl.java
+++ b/plugins/org.eclipse.emf.cdo.dawn.gmf/src/org/eclipse/emf/cdo/dawn/gmf/appearance/impl/DawnBasicDiagramStylizerImpl.java
@@ -1,46 +1,46 @@
-/*
- * 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
- */
-package org.eclipse.emf.cdo.dawn.gmf.appearance.impl;
-
-import org.eclipse.emf.cdo.dawn.gmf.appearance.DawnEditPartStylizer;
-
-import org.eclipse.gef.EditPart;
-
-/**
- * @author Martin Fluegge
- * @since 2.0
- */
-public class DawnBasicDiagramStylizerImpl extends DawnEditPartStylizer
-{
- /**
- * @since 2.0
- */
- @Override
- public void setDefault(EditPart editpart)
- {
- }
-
- /**
- * @since 2.0
- */
- @Override
- public void setConflicted(EditPart editpart, int type)
- {
- }
-
- /**
- * @since 2.0
- */
- @Override
- public void setLocked(EditPart editpart, int type)
- {
- }
-}
+/*
+ * 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.gmf.appearance.impl;
+
+import org.eclipse.emf.cdo.dawn.gmf.appearance.DawnEditPartStylizer;
+
+import org.eclipse.gef.EditPart;
+
+/**
+ * @author Martin Fluegge
+ * @since 2.0
+ */
+public class DawnBasicDiagramStylizerImpl extends DawnEditPartStylizer
+{
+ /**
+ * @since 2.0
+ */
+ @Override
+ public void setDefault(EditPart editpart)
+ {
+ }
+
+ /**
+ * @since 2.0
+ */
+ @Override
+ public void setConflicted(EditPart editpart, int type)
+ {
+ }
+
+ /**
+ * @since 2.0
+ */
+ @Override
+ public void setLocked(EditPart editpart, int type)
+ {
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.dawn.gmf/src/org/eclipse/emf/cdo/dawn/gmf/appearance/impl/DawnBasicGraphicalEditPartStylizerImpl.java b/plugins/org.eclipse.emf.cdo.dawn.gmf/src/org/eclipse/emf/cdo/dawn/gmf/appearance/impl/DawnBasicGraphicalEditPartStylizerImpl.java
index 0c47203800..c64f62c1d6 100644
--- a/plugins/org.eclipse.emf.cdo.dawn.gmf/src/org/eclipse/emf/cdo/dawn/gmf/appearance/impl/DawnBasicGraphicalEditPartStylizerImpl.java
+++ b/plugins/org.eclipse.emf.cdo.dawn.gmf/src/org/eclipse/emf/cdo/dawn/gmf/appearance/impl/DawnBasicGraphicalEditPartStylizerImpl.java
@@ -1,79 +1,79 @@
-/*
- * 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
- */
-package org.eclipse.emf.cdo.dawn.gmf.appearance.impl;
-
-import org.eclipse.emf.cdo.dawn.gmf.appearance.DawnAppearancer;
-import org.eclipse.emf.cdo.dawn.gmf.appearance.DawnEditPartStylizer;
-import org.eclipse.emf.cdo.dawn.spi.DawnState;
-
-import org.eclipse.draw2d.Border;
-import org.eclipse.draw2d.IFigure;
-import org.eclipse.draw2d.LineBorder;
-import org.eclipse.gef.EditPart;
-import org.eclipse.gef.GraphicalEditPart;
-import org.eclipse.swt.graphics.Color;
-
-/**
- * @author Martin Fluegge
- * @since 2.0
- */
-
-public class DawnBasicGraphicalEditPartStylizerImpl extends DawnEditPartStylizer
-{
- /**
- * @since 2.0
- */
- @Override
- public void setDefault(EditPart editPart)
- {
- setBorder(editPart, null);
- }
-
- /**
- * @since 2.0
- */
- @Override
- public void setConflicted(EditPart editPart, int type)
- {
- setBorder(editPart, getForegroundColor(editPart, DawnState.CONFLICT), DawnAppearancer.DEFAULT_BORDER_THICKNESS);
- }
-
- /**
- * @since 2.0
- */
- @Override
- public void setLocked(EditPart editPart, int type)
- {
- setBorder(editPart, getBackgroundColor(editPart, DawnState.LOCKED_REMOTELY),
- DawnAppearancer.DEFAULT_BORDER_THICKNESS);
- }
-
- /**
- * @since 2.0
- */
- protected void setBorder(EditPart editPart, Color color, int thickness)
- {
- Border thickBorder = new LineBorder(color, thickness);
- setBorder(editPart, thickBorder);
- }
-
- /**
- * @since 2.0
- */
- protected void setBorder(EditPart editPart, Border border)
- {
- GraphicalEditPart e = (GraphicalEditPart)editPart;
-
- IFigure figure = e.getFigure();
- figure.setBorder(border);
- editPart.refresh();
- }
-}
+/*
+ * 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.gmf.appearance.impl;
+
+import org.eclipse.emf.cdo.dawn.gmf.appearance.DawnAppearancer;
+import org.eclipse.emf.cdo.dawn.gmf.appearance.DawnEditPartStylizer;
+import org.eclipse.emf.cdo.dawn.spi.DawnState;
+
+import org.eclipse.draw2d.Border;
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.LineBorder;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.GraphicalEditPart;
+import org.eclipse.swt.graphics.Color;
+
+/**
+ * @author Martin Fluegge
+ * @since 2.0
+ */
+
+public class DawnBasicGraphicalEditPartStylizerImpl extends DawnEditPartStylizer
+{
+ /**
+ * @since 2.0
+ */
+ @Override
+ public void setDefault(EditPart editPart)
+ {
+ setBorder(editPart, null);
+ }
+
+ /**
+ * @since 2.0
+ */
+ @Override
+ public void setConflicted(EditPart editPart, int type)
+ {
+ setBorder(editPart, getForegroundColor(editPart, DawnState.CONFLICT), DawnAppearancer.DEFAULT_BORDER_THICKNESS);
+ }
+
+ /**
+ * @since 2.0
+ */
+ @Override
+ public void setLocked(EditPart editPart, int type)
+ {
+ setBorder(editPart, getBackgroundColor(editPart, DawnState.LOCKED_REMOTELY),
+ DawnAppearancer.DEFAULT_BORDER_THICKNESS);
+ }
+
+ /**
+ * @since 2.0
+ */
+ protected void setBorder(EditPart editPart, Color color, int thickness)
+ {
+ Border thickBorder = new LineBorder(color, thickness);
+ setBorder(editPart, thickBorder);
+ }
+
+ /**
+ * @since 2.0
+ */
+ protected void setBorder(EditPart editPart, Border border)
+ {
+ GraphicalEditPart e = (GraphicalEditPart)editPart;
+
+ IFigure figure = e.getFigure();
+ figure.setBorder(border);
+ editPart.refresh();
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.dawn.gmf/src/org/eclipse/emf/cdo/dawn/gmf/appearance/impl/DawnBasicNodeEditPartStylizerImpl.java b/plugins/org.eclipse.emf.cdo.dawn.gmf/src/org/eclipse/emf/cdo/dawn/gmf/appearance/impl/DawnBasicNodeEditPartStylizerImpl.java
index 1a29bcea34..e317cd13fd 100644
--- a/plugins/org.eclipse.emf.cdo.dawn.gmf/src/org/eclipse/emf/cdo/dawn/gmf/appearance/impl/DawnBasicNodeEditPartStylizerImpl.java
+++ b/plugins/org.eclipse.emf.cdo.dawn.gmf/src/org/eclipse/emf/cdo/dawn/gmf/appearance/impl/DawnBasicNodeEditPartStylizerImpl.java
@@ -1,56 +1,56 @@
-/*
- * 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
- */
-package org.eclipse.emf.cdo.dawn.gmf.appearance.impl;
-
-import org.eclipse.emf.cdo.dawn.gmf.appearance.DawnAppearancer;
-import org.eclipse.emf.cdo.dawn.spi.DawnState;
-import org.eclipse.emf.cdo.dawn.ui.DawnColorConstants;
-
-import org.eclipse.gef.EditPart;
-
-/**
- * @author Martin Fluegge
- */
-public class DawnBasicNodeEditPartStylizerImpl extends DawnBasicGraphicalEditPartStylizerImpl
-{
-
- @Override
- public void setDefault(EditPart editPart)
- {
- setBorder(editPart, DawnColorConstants.COLOR_NO_CONFLICT, 0);
- }
-
- // @Override
- // public void setConflicted(EditPart editPart, int type)
- // {
- // setBorder(editPart, DawnColorConstants.COLOR_DELETE_CONFLICT, DawnAppearancer.DEFAULT_BORDER_THICKNESS);
- // }
-
- @Override
- public void setLocked(EditPart editPart, int type)
- {
- switch (type)
- {
- case DawnAppearancer.TYPE_LOCKED_GLOBALLY:
- {
- setBorder(editPart, getBackgroundColor(editPart, DawnState.LOCKED_REMOTELY),
- DawnAppearancer.DEFAULT_BORDER_THICKNESS);
- break;
- }
- case DawnAppearancer.TYPE_LOCKED_LOCALLY:
- {
- setBorder(editPart, getBackgroundColor(editPart, DawnState.LOCKED_LOCALLY),
- DawnAppearancer.DEFAULT_BORDER_THICKNESS);
- break;
- }
- }
- }
-}
+/*
+ * 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.gmf.appearance.impl;
+
+import org.eclipse.emf.cdo.dawn.gmf.appearance.DawnAppearancer;
+import org.eclipse.emf.cdo.dawn.spi.DawnState;
+import org.eclipse.emf.cdo.dawn.ui.DawnColorConstants;
+
+import org.eclipse.gef.EditPart;
+
+/**
+ * @author Martin Fluegge
+ */
+public class DawnBasicNodeEditPartStylizerImpl extends DawnBasicGraphicalEditPartStylizerImpl
+{
+
+ @Override
+ public void setDefault(EditPart editPart)
+ {
+ setBorder(editPart, DawnColorConstants.COLOR_NO_CONFLICT, 0);
+ }
+
+ // @Override
+ // public void setConflicted(EditPart editPart, int type)
+ // {
+ // setBorder(editPart, DawnColorConstants.COLOR_DELETE_CONFLICT, DawnAppearancer.DEFAULT_BORDER_THICKNESS);
+ // }
+
+ @Override
+ public void setLocked(EditPart editPart, int type)
+ {
+ switch (type)
+ {
+ case DawnAppearancer.TYPE_LOCKED_GLOBALLY:
+ {
+ setBorder(editPart, getBackgroundColor(editPart, DawnState.LOCKED_REMOTELY),
+ DawnAppearancer.DEFAULT_BORDER_THICKNESS);
+ break;
+ }
+ case DawnAppearancer.TYPE_LOCKED_LOCALLY:
+ {
+ setBorder(editPart, getBackgroundColor(editPart, DawnState.LOCKED_LOCALLY),
+ DawnAppearancer.DEFAULT_BORDER_THICKNESS);
+ break;
+ }
+ }
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.dawn.gmf/src/org/eclipse/emf/cdo/dawn/gmf/appearance/impl/DawnBasicTextAwareEditPartStylizerImpl.java b/plugins/org.eclipse.emf.cdo.dawn.gmf/src/org/eclipse/emf/cdo/dawn/gmf/appearance/impl/DawnBasicTextAwareEditPartStylizerImpl.java
index 7323bb38b4..6a807a6ff8 100644
--- a/plugins/org.eclipse.emf.cdo.dawn.gmf/src/org/eclipse/emf/cdo/dawn/gmf/appearance/impl/DawnBasicTextAwareEditPartStylizerImpl.java
+++ b/plugins/org.eclipse.emf.cdo.dawn.gmf/src/org/eclipse/emf/cdo/dawn/gmf/appearance/impl/DawnBasicTextAwareEditPartStylizerImpl.java
@@ -1,65 +1,65 @@
-/*
- * 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
- */
-package org.eclipse.emf.cdo.dawn.gmf.appearance.impl;
-
-import org.eclipse.emf.cdo.dawn.gmf.appearance.DawnAppearancer;
-import org.eclipse.emf.cdo.dawn.ui.DawnColorConstants;
-
-import org.eclipse.draw2d.Border;
-import org.eclipse.gef.EditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
-
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * @author Martin Fluegge
- */
-public class DawnBasicTextAwareEditPartStylizerImpl extends DawnBasicGraphicalEditPartStylizerImpl
-{
-
- Map<EditPart, Border> oldValues = new HashMap<EditPart, Border>();
-
- @Override
- public void setDefault(EditPart editPart)
- {
- setBorder(editPart, oldValues.get(editPart));
- }
-
- @Override
- public void setConflicted(EditPart editPart, int type)
- {
- final IGraphicalEditPart e = (IGraphicalEditPart)editPart;
-
- // TODO Setting the foreground color just works until the EditPart is refreshed and the default color is used again.
- // Find a better way to handle this.
- // e.getFigure().setForegroundColor(DawnAppearancer.COLOR_DELETE_CONFLICT);
- oldValues.put(e, e.getFigure().getBorder());
-
- setBorder(editPart, DawnColorConstants.COLOR_DELETE_CONFLICT, DawnAppearancer.DEFAULT_BORDER_THICKNESS);
- // View view = (View)e.getModel();
- // FontStyle style = (FontStyle)view.getStyle(NotationPackage.eINSTANCE.getFontStyle());
- // if (style == null)
- // {
- // style = NotationFactory.eINSTANCE.createFontStyle();
- // style.setFontColor(FigureUtilities.colorToInteger(DiagramColorConstants.red));
- // style.setBold(true);
- //
- // view.getStyles().add(style);
- // }
- }
-
- @Override
- public void setLocked(EditPart editPart, int type)
- {
- setBorder(editPart, DawnColorConstants.COLOR_LOCKED_REMOTELY, DawnAppearancer.DEFAULT_BORDER_THICKNESS);
- }
-}
+/*
+ * 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.gmf.appearance.impl;
+
+import org.eclipse.emf.cdo.dawn.gmf.appearance.DawnAppearancer;
+import org.eclipse.emf.cdo.dawn.ui.DawnColorConstants;
+
+import org.eclipse.draw2d.Border;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * @author Martin Fluegge
+ */
+public class DawnBasicTextAwareEditPartStylizerImpl extends DawnBasicGraphicalEditPartStylizerImpl
+{
+
+ Map<EditPart, Border> oldValues = new HashMap<EditPart, Border>();
+
+ @Override
+ public void setDefault(EditPart editPart)
+ {
+ setBorder(editPart, oldValues.get(editPart));
+ }
+
+ @Override
+ public void setConflicted(EditPart editPart, int type)
+ {
+ final IGraphicalEditPart e = (IGraphicalEditPart)editPart;
+
+ // TODO Setting the foreground color just works until the EditPart is refreshed and the default color is used again.
+ // Find a better way to handle this.
+ // e.getFigure().setForegroundColor(DawnAppearancer.COLOR_DELETE_CONFLICT);
+ oldValues.put(e, e.getFigure().getBorder());
+
+ setBorder(editPart, DawnColorConstants.COLOR_DELETE_CONFLICT, DawnAppearancer.DEFAULT_BORDER_THICKNESS);
+ // View view = (View)e.getModel();
+ // FontStyle style = (FontStyle)view.getStyle(NotationPackage.eINSTANCE.getFontStyle());
+ // if (style == null)
+ // {
+ // style = NotationFactory.eINSTANCE.createFontStyle();
+ // style.setFontColor(FigureUtilities.colorToInteger(DiagramColorConstants.red));
+ // style.setBold(true);
+ //
+ // view.getStyles().add(style);
+ // }
+ }
+
+ @Override
+ public void setLocked(EditPart editPart, int type)
+ {
+ setBorder(editPart, DawnColorConstants.COLOR_LOCKED_REMOTELY, DawnAppearancer.DEFAULT_BORDER_THICKNESS);
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.dawn.gmf/src/org/eclipse/emf/cdo/dawn/gmf/appearance/impl/DawnBlinkingNodeEditPartStylizerImpl.java b/plugins/org.eclipse.emf.cdo.dawn.gmf/src/org/eclipse/emf/cdo/dawn/gmf/appearance/impl/DawnBlinkingNodeEditPartStylizerImpl.java
index 39c47118dd..40152b9548 100644
--- a/plugins/org.eclipse.emf.cdo.dawn.gmf/src/org/eclipse/emf/cdo/dawn/gmf/appearance/impl/DawnBlinkingNodeEditPartStylizerImpl.java
+++ b/plugins/org.eclipse.emf.cdo.dawn.gmf/src/org/eclipse/emf/cdo/dawn/gmf/appearance/impl/DawnBlinkingNodeEditPartStylizerImpl.java
@@ -1,105 +1,105 @@
-/*
- * 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
- */
-package org.eclipse.emf.cdo.dawn.gmf.appearance.impl;
-
-import org.eclipse.emf.cdo.dawn.gmf.appearance.DawnAppearancer;
-import org.eclipse.emf.cdo.dawn.ui.DawnColorConstants;
-
-import org.eclipse.gef.EditPart;
-
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * @author Martin Fluegge
- * @since 2.0
- */
-public class DawnBlinkingNodeEditPartStylizerImpl extends DawnBasicGraphicalEditPartStylizerImpl
-{
- BlinkingThread blinkingThread;
-
- public DawnBlinkingNodeEditPartStylizerImpl()
- {
- blinkingThread = new BlinkingThread();
- blinkingThread.start();
- }
-
- @Override
- public void setDefault(EditPart editPart)
- {
- blinkingThread.stop(editPart);
- setBorder(editPart, DawnColorConstants.COLOR_NO_CONFLICT, 0);
- }
-
- @Override
- public void setConflicted(EditPart editPart, int type)
- {
- blinkingThread.start(editPart);
- }
-
- @Override
- public void setLocked(EditPart editPart, int type)
- {
- setBorder(editPart, DawnColorConstants.COLOR_LOCKED_REMOTELY, DawnAppearancer.DEFAULT_BORDER_THICKNESS);
- }
-
- /**
- * @author Martin Fluegge
- * @since 2.0
- */
- protected class BlinkingThread extends Thread
- {
-
- Map<EditPart, Boolean> editParts = new HashMap<EditPart, Boolean>();
-
- @Override
- public void run()
- {
- while (true)
- {
- for (EditPart e : editParts.keySet())
- {
- if (editParts.get(e))
- {
- setBorder(e, DawnColorConstants.COLOR_NO_CONFLICT, DawnAppearancer.DEFAULT_BORDER_THICKNESS);
- }
- else
- {
- setBorder(e, DawnColorConstants.COLOR_DELETE_CONFLICT, DawnAppearancer.DEFAULT_BORDER_THICKNESS);
- }
-
- editParts.put(e, !editParts.get(e));
- }
- try
- {
- Thread.sleep(500);
- }
- catch (InterruptedException e1)
- {
- e1.printStackTrace();
- }
- }
- }
-
- /**
- * @since 2.0
- */
- public void start(EditPart editPart)
- {
- editParts.put(editPart, true);
- }
-
- public void stop(EditPart editPart)
- {
- editParts.remove(editPart);
- }
- }
-}
+/*
+ * 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.gmf.appearance.impl;
+
+import org.eclipse.emf.cdo.dawn.gmf.appearance.DawnAppearancer;
+import org.eclipse.emf.cdo.dawn.ui.DawnColorConstants;
+
+import org.eclipse.gef.EditPart;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * @author Martin Fluegge
+ * @since 2.0
+ */
+public class DawnBlinkingNodeEditPartStylizerImpl extends DawnBasicGraphicalEditPartStylizerImpl
+{
+ BlinkingThread blinkingThread;
+
+ public DawnBlinkingNodeEditPartStylizerImpl()
+ {
+ blinkingThread = new BlinkingThread();
+ blinkingThread.start();
+ }
+
+ @Override
+ public void setDefault(EditPart editPart)
+ {
+ blinkingThread.stop(editPart);
+ setBorder(editPart, DawnColorConstants.COLOR_NO_CONFLICT, 0);
+ }
+
+ @Override
+ public void setConflicted(EditPart editPart, int type)
+ {
+ blinkingThread.start(editPart);
+ }
+
+ @Override
+ public void setLocked(EditPart editPart, int type)
+ {
+ setBorder(editPart, DawnColorConstants.COLOR_LOCKED_REMOTELY, DawnAppearancer.DEFAULT_BORDER_THICKNESS);
+ }
+
+ /**
+ * @author Martin Fluegge
+ * @since 2.0
+ */
+ protected class BlinkingThread extends Thread
+ {
+
+ Map<EditPart, Boolean> editParts = new HashMap<EditPart, Boolean>();
+
+ @Override
+ public void run()
+ {
+ while (true)
+ {
+ for (EditPart e : editParts.keySet())
+ {
+ if (editParts.get(e))
+ {
+ setBorder(e, DawnColorConstants.COLOR_NO_CONFLICT, DawnAppearancer.DEFAULT_BORDER_THICKNESS);
+ }
+ else
+ {
+ setBorder(e, DawnColorConstants.COLOR_DELETE_CONFLICT, DawnAppearancer.DEFAULT_BORDER_THICKNESS);
+ }
+
+ editParts.put(e, !editParts.get(e));
+ }
+ try
+ {
+ Thread.sleep(500);
+ }
+ catch (InterruptedException e1)
+ {
+ e1.printStackTrace();
+ }
+ }
+ }
+
+ /**
+ * @since 2.0
+ */
+ public void start(EditPart editPart)
+ {
+ editParts.put(editPart, true);
+ }
+
+ public void stop(EditPart editPart)
+ {
+ editParts.remove(editPart);
+ }
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.dawn.gmf/src/org/eclipse/emf/cdo/dawn/gmf/editors/impl/DawnGMFEditorSupport.java b/plugins/org.eclipse.emf.cdo.dawn.gmf/src/org/eclipse/emf/cdo/dawn/gmf/editors/impl/DawnGMFEditorSupport.java
index 4ece40f8ef..3e44d0bdbd 100644
--- a/plugins/org.eclipse.emf.cdo.dawn.gmf/src/org/eclipse/emf/cdo/dawn/gmf/editors/impl/DawnGMFEditorSupport.java
+++ b/plugins/org.eclipse.emf.cdo.dawn.gmf/src/org/eclipse/emf/cdo/dawn/gmf/editors/impl/DawnGMFEditorSupport.java
@@ -1,198 +1,198 @@
-/*
- * 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
- */
-package org.eclipse.emf.cdo.dawn.gmf.editors.impl;
-
-import org.eclipse.emf.cdo.CDOObject;
-import org.eclipse.emf.cdo.dawn.appearance.DawnElementStylizer;
-import org.eclipse.emf.cdo.dawn.editors.IDawnEditor;
-import org.eclipse.emf.cdo.dawn.editors.impl.DawnAbstractEditorSupport;
-import org.eclipse.emf.cdo.dawn.gmf.appearance.DawnAppearancer;
-import org.eclipse.emf.cdo.dawn.gmf.notifications.impl.DawnGMFHandler;
-import org.eclipse.emf.cdo.dawn.gmf.notifications.impl.DawnGMFLockingHandler;
-import org.eclipse.emf.cdo.dawn.gmf.synchronize.DawnChangeHelper;
-import org.eclipse.emf.cdo.dawn.gmf.util.DawnDiagramUpdater;
-import org.eclipse.emf.cdo.dawn.notifications.BasicDawnListener;
-import org.eclipse.emf.cdo.dawn.spi.DawnState;
-import org.eclipse.emf.cdo.dawn.ui.stylizer.DawnElementStylizerRegistry;
-import org.eclipse.emf.cdo.transaction.CDOTransactionHandlerBase;
-import org.eclipse.emf.cdo.util.CDOUtil;
-import org.eclipse.emf.cdo.view.CDOView;
-
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.transaction.RecordingCommand;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-
-import org.eclipse.gef.EditPart;
-import org.eclipse.gmf.runtime.diagram.ui.resources.editor.parts.DiagramDocumentEditor;
-import org.eclipse.gmf.runtime.notation.View;
-
-import java.util.Map;
-
-/**
- * @author Martin Fluegge
- */
-public class DawnGMFEditorSupport extends DawnAbstractEditorSupport
-{
- private DawnGMFHandler dawnGMFHandler;
-
- public DawnGMFEditorSupport(IDawnEditor editor)
- {
- super(editor);
- dawnGMFHandler = new DawnGMFHandler(editor);
- }
-
- public void close()
- {
- CDOView view = getView();
- if (view != null && !view.isClosed())
- {
- view.close();
- }
- }
-
- @Override
- protected BasicDawnListener getBasicHandler()
- {
- return dawnGMFHandler;
- }
-
- @Override
- protected BasicDawnListener getLockingHandler()
- {
- return new DawnGMFLockingHandler(getEditor());
- }
-
- @Override
- protected CDOTransactionHandlerBase getTransactionHandler()
- {
- return dawnGMFHandler;
- }
-
- /**
- * @since 1.0
- */
- @Override
- public void rollback()
- {
- super.rollback();
- final DiagramDocumentEditor diagramDocumentEditor = (DiagramDocumentEditor)getEditor();
- TransactionalEditingDomain editingDomain = diagramDocumentEditor.getEditingDomain();
- editingDomain.getCommandStack().execute(new RecordingCommand(editingDomain)
- {
- @Override
- public void doExecute()
- {
- DawnAppearancer.setEditPartDefaultAllChildren(diagramDocumentEditor.getDiagramEditPart());
- DawnDiagramUpdater.refreshEditPart(diagramDocumentEditor.getDiagramEditPart());
- }
- });
- }
-
- public void refresh()
- {
- final DiagramDocumentEditor diagramDocumentEditor = (DiagramDocumentEditor)getEditor();
- TransactionalEditingDomain editingDomain = diagramDocumentEditor.getEditingDomain();
- editingDomain.getCommandStack().execute(new RecordingCommand(editingDomain)
- {
- @Override
- public void doExecute()
- {
- DawnDiagramUpdater.refreshEditPart(diagramDocumentEditor.getDiagramEditPart());
- }
- });
- }
-
- public void lockObject(Object objectToBeLocked)
- {
- if (objectToBeLocked instanceof EditPart)
- {
- EditPart editPart = (EditPart)objectToBeLocked;
- Object model = editPart.getModel();
-
- if (model instanceof EObject)
- {
- CDOUtil.getCDOObject((EObject)model).cdoWriteLock().lock();
- if (model instanceof View)
- {
- EObject element = ((View)model).getElement();
- CDOUtil.getCDOObject(element).cdoWriteLock().lock();
- }
- }
- DawnElementStylizer stylizer = DawnElementStylizerRegistry.instance.getStylizer(editPart);
- if (stylizer != null)
- {
- stylizer.setLocked(editPart, DawnAppearancer.TYPE_LOCKED_LOCALLY);
- }
- }
- refresh();
- }
-
- public void unlockObject(Object objectToBeUnlocked)
- {
- if (objectToBeUnlocked instanceof EditPart)
- {
- EditPart editPart = (EditPart)objectToBeUnlocked;
-
- Object model = editPart.getModel();
-
- if (model instanceof EObject)
- {
- CDOUtil.getCDOObject((EObject)model).cdoWriteLock().unlock();
- if (model instanceof View)
- {
- EObject element = ((View)model).getElement();
- CDOUtil.getCDOObject(element).cdoWriteLock().unlock();
- }
- }
- DawnElementStylizer stylizer = DawnElementStylizerRegistry.instance.getStylizer(editPart);
- if (stylizer != null)
- {
- stylizer.setDefault(editPart);
- }
- }
- refresh();
- }
-
- public void handleRemoteLockChanges(Map<Object, DawnState> changedObjects)
- {
- for (Object o : changedObjects.keySet())
- {
- handleLock((CDOObject)o, getView());
- }
- refresh();
- }
-
- private void handleLock(CDOObject object, CDOView cdoView)
- {
- EObject element = CDOUtil.getEObject(object); // either semantic object or notational
- View view = DawnDiagramUpdater.findView(element);
- if (view != null)
- {
- // if there is no view, the semantic object is not displayed.
- EditPart editPart = DawnDiagramUpdater.createOrFindEditPartIfViewExists(view, (DiagramDocumentEditor)getEditor());
-
- if (object.cdoWriteLock().isLocked())
- {
- DawnAppearancer.setEditPartLocked(editPart, DawnAppearancer.TYPE_LOCKED_LOCALLY);
- }
- else if (object.cdoWriteLock().isLockedByOthers())
- {
- DawnAppearancer.setEditPartLocked(editPart, DawnAppearancer.TYPE_LOCKED_GLOBALLY);
- DawnChangeHelper.deactivateEditPart(editPart);
- }
- else
- {
- DawnAppearancer.setEditPartDefault(editPart);
- DawnChangeHelper.activateEditPart(editPart);
- }
- }
- }
-}
+/*
+ * 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.gmf.editors.impl;
+
+import org.eclipse.emf.cdo.CDOObject;
+import org.eclipse.emf.cdo.dawn.appearance.DawnElementStylizer;
+import org.eclipse.emf.cdo.dawn.editors.IDawnEditor;
+import org.eclipse.emf.cdo.dawn.editors.impl.DawnAbstractEditorSupport;
+import org.eclipse.emf.cdo.dawn.gmf.appearance.DawnAppearancer;
+import org.eclipse.emf.cdo.dawn.gmf.notifications.impl.DawnGMFHandler;
+import org.eclipse.emf.cdo.dawn.gmf.notifications.impl.DawnGMFLockingHandler;
+import org.eclipse.emf.cdo.dawn.gmf.synchronize.DawnChangeHelper;
+import org.eclipse.emf.cdo.dawn.gmf.util.DawnDiagramUpdater;
+import org.eclipse.emf.cdo.dawn.notifications.BasicDawnListener;
+import org.eclipse.emf.cdo.dawn.spi.DawnState;
+import org.eclipse.emf.cdo.dawn.ui.stylizer.DawnElementStylizerRegistry;
+import org.eclipse.emf.cdo.transaction.CDOTransactionHandlerBase;
+import org.eclipse.emf.cdo.util.CDOUtil;
+import org.eclipse.emf.cdo.view.CDOView;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.transaction.RecordingCommand;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+
+import org.eclipse.gef.EditPart;
+import org.eclipse.gmf.runtime.diagram.ui.resources.editor.parts.DiagramDocumentEditor;
+import org.eclipse.gmf.runtime.notation.View;
+
+import java.util.Map;
+
+/**
+ * @author Martin Fluegge
+ */
+public class DawnGMFEditorSupport extends DawnAbstractEditorSupport
+{
+ private DawnGMFHandler dawnGMFHandler;
+
+ public DawnGMFEditorSupport(IDawnEditor editor)
+ {
+ super(editor);
+ dawnGMFHandler = new DawnGMFHandler(editor);
+ }
+
+ public void close()
+ {
+ CDOView view = getView();
+ if (view != null && !view.isClosed())
+ {
+ view.close();
+ }
+ }
+
+ @Override
+ protected BasicDawnListener getBasicHandler()
+ {
+ return dawnGMFHandler;
+ }
+
+ @Override
+ protected BasicDawnListener getLockingHandler()
+ {
+ return new DawnGMFLockingHandler(getEditor());
+ }
+
+ @Override
+ protected CDOTransactionHandlerBase getTransactionHandler()
+ {
+ return dawnGMFHandler;
+ }
+
+ /**
+ * @since 1.0
+ */
+ @Override
+ public void rollback()
+ {
+ super.rollback();
+ final DiagramDocumentEditor diagramDocumentEditor = (DiagramDocumentEditor)getEditor();
+ TransactionalEditingDomain editingDomain = diagramDocumentEditor.getEditingDomain();
+ editingDomain.getCommandStack().execute(new RecordingCommand(editingDomain)
+ {
+ @Override
+ public void doExecute()
+ {
+ DawnAppearancer.setEditPartDefaultAllChildren(diagramDocumentEditor.getDiagramEditPart());
+ DawnDiagramUpdater.refreshEditPart(diagramDocumentEditor.getDiagramEditPart());
+ }
+ });
+ }
+
+ public void refresh()
+ {
+ final DiagramDocumentEditor diagramDocumentEditor = (DiagramDocumentEditor)getEditor();
+ TransactionalEditingDomain editingDomain = diagramDocumentEditor.getEditingDomain();
+ editingDomain.getCommandStack().execute(new RecordingCommand(editingDomain)
+ {
+ @Override
+ public void doExecute()
+ {
+ DawnDiagramUpdater.refreshEditPart(diagramDocumentEditor.getDiagramEditPart());
+ }
+ });
+ }
+
+ public void lockObject(Object objectToBeLocked)
+ {
+ if (objectToBeLocked instanceof EditPart)
+ {
+ EditPart editPart = (EditPart)objectToBeLocked;
+ Object model = editPart.getModel();
+
+ if (model instanceof EObject)
+ {
+ CDOUtil.getCDOObject((EObject)model).cdoWriteLock().lock();
+ if (model instanceof View)
+ {
+ EObject element = ((View)model).getElement();
+ CDOUtil.getCDOObject(element).cdoWriteLock().lock();
+ }
+ }
+ DawnElementStylizer stylizer = DawnElementStylizerRegistry.instance.getStylizer(editPart);
+ if (stylizer != null)
+ {
+ stylizer.setLocked(editPart, DawnAppearancer.TYPE_LOCKED_LOCALLY);
+ }
+ }
+ refresh();
+ }
+
+ public void unlockObject(Object objectToBeUnlocked)
+ {
+ if (objectToBeUnlocked instanceof EditPart)
+ {
+ EditPart editPart = (EditPart)objectToBeUnlocked;
+
+ Object model = editPart.getModel();
+
+ if (model instanceof EObject)
+ {
+ CDOUtil.getCDOObject((EObject)model).cdoWriteLock().unlock();
+ if (model instanceof View)
+ {
+ EObject element = ((View)model).getElement();
+ CDOUtil.getCDOObject(element).cdoWriteLock().unlock();
+ }
+ }
+ DawnElementStylizer stylizer = DawnElementStylizerRegistry.instance.getStylizer(editPart);
+ if (stylizer != null)
+ {
+ stylizer.setDefault(editPart);
+ }
+ }
+ refresh();
+ }
+
+ public void handleRemoteLockChanges(Map<Object, DawnState> changedObjects)
+ {
+ for (Object o : changedObjects.keySet())
+ {
+ handleLock((CDOObject)o, getView());
+ }
+ refresh();
+ }
+
+ private void handleLock(CDOObject object, CDOView cdoView)
+ {
+ EObject element = CDOUtil.getEObject(object); // either semantic object or notational
+ View view = DawnDiagramUpdater.findView(element);
+ if (view != null)
+ {
+ // if there is no view, the semantic object is not displayed.
+ EditPart editPart = DawnDiagramUpdater.createOrFindEditPartIfViewExists(view, (DiagramDocumentEditor)getEditor());
+
+ if (object.cdoWriteLock().isLocked())
+ {
+ DawnAppearancer.setEditPartLocked(editPart, DawnAppearancer.TYPE_LOCKED_LOCALLY);
+ }
+ else if (object.cdoWriteLock().isLockedByOthers())
+ {
+ DawnAppearancer.setEditPartLocked(editPart, DawnAppearancer.TYPE_LOCKED_GLOBALLY);
+ DawnChangeHelper.deactivateEditPart(editPart);
+ }
+ else
+ {
+ DawnAppearancer.setEditPartDefault(editPart);
+ DawnChangeHelper.activateEditPart(editPart);
+ }
+ }
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.dawn.gmf/src/org/eclipse/emf/cdo/dawn/gmf/elementtypes/DawnElementTypeHelper.java b/plugins/org.eclipse.emf.cdo.dawn.gmf/src/org/eclipse/emf/cdo/dawn/gmf/elementtypes/DawnElementTypeHelper.java
index 41372c2aeb..42adec1815 100644
--- a/plugins/org.eclipse.emf.cdo.dawn.gmf/src/org/eclipse/emf/cdo/dawn/gmf/elementtypes/DawnElementTypeHelper.java
+++ b/plugins/org.eclipse.emf.cdo.dawn.gmf/src/org/eclipse/emf/cdo/dawn/gmf/elementtypes/DawnElementTypeHelper.java
@@ -1,30 +1,30 @@
-/*
- * 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
- */
-package org.eclipse.emf.cdo.dawn.gmf.elementtypes;
-
-/**
- *
- * @author Martin Fluegge
- * @since 2.0
- */
-import org.eclipse.gmf.runtime.emf.type.core.IElementType;
-import org.eclipse.gmf.runtime.notation.View;
-
-/**
- * @since 2.0
- */
-public interface DawnElementTypeHelper
-{
- /**
- * @since 2.0
- */
- IElementType getElementType(View view);
-}
+/*
+ * 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.gmf.elementtypes;
+
+/**
+ *
+ * @author Martin Fluegge
+ * @since 2.0
+ */
+import org.eclipse.gmf.runtime.emf.type.core.IElementType;
+import org.eclipse.gmf.runtime.notation.View;
+
+/**
+ * @since 2.0
+ */
+public interface DawnElementTypeHelper
+{
+ /**
+ * @since 2.0
+ */
+ IElementType getElementType(View view);
+}
diff --git a/plugins/org.eclipse.emf.cdo.dawn.gmf/src/org/eclipse/emf/cdo/dawn/gmf/elementtypes/DawnElementTypeHelperFactory.java b/plugins/org.eclipse.emf.cdo.dawn.gmf/src/org/eclipse/emf/cdo/dawn/gmf/elementtypes/DawnElementTypeHelperFactory.java
index c110ce6c03..27973ed403 100644
--- a/plugins/org.eclipse.emf.cdo.dawn.gmf/src/org/eclipse/emf/cdo/dawn/gmf/elementtypes/DawnElementTypeHelperFactory.java
+++ b/plugins/org.eclipse.emf.cdo.dawn.gmf/src/org/eclipse/emf/cdo/dawn/gmf/elementtypes/DawnElementTypeHelperFactory.java
@@ -1,19 +1,19 @@
-/*
- * 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
- */
-package org.eclipse.emf.cdo.dawn.gmf.elementtypes;
-
-/**
- * @author Martin Fluegge
- */
-public interface DawnElementTypeHelperFactory
-{
- DawnElementTypeHelper create();
-}
+/*
+ * 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.gmf.elementtypes;
+
+/**
+ * @author Martin Fluegge
+ */
+public interface DawnElementTypeHelperFactory
+{
+ DawnElementTypeHelper create();
+}
diff --git a/plugins/org.eclipse.emf.cdo.dawn.gmf/src/org/eclipse/emf/cdo/dawn/gmf/notifications/impl/DawnGMFHandler.java b/plugins/org.eclipse.emf.cdo.dawn.gmf/src/org/eclipse/emf/cdo/dawn/gmf/notifications/impl/DawnGMFHandler.java
index 9ce8de2ea5..f00242bfe4 100644
--- a/plugins/org.eclipse.emf.cdo.dawn.gmf/src/org/eclipse/emf/cdo/dawn/gmf/notifications/impl/DawnGMFHandler.java
+++ b/plugins/org.eclipse.emf.cdo.dawn.gmf/src/org/eclipse/emf/cdo/dawn/gmf/notifications/impl/DawnGMFHandler.java
@@ -1,287 +1,287 @@
-/*
- * 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
- */
-package org.eclipse.emf.cdo.dawn.gmf.notifications.impl;
-
-import org.eclipse.emf.cdo.CDOObject;
-import org.eclipse.emf.cdo.common.revision.delta.CDOFeatureDelta;
-import org.eclipse.emf.cdo.dawn.editors.IDawnEditor;
-import org.eclipse.emf.cdo.dawn.gmf.synchronize.DawnConflictHelper;
-import org.eclipse.emf.cdo.dawn.gmf.util.DawnDiagramUpdater;
-import org.eclipse.emf.cdo.dawn.notifications.BasicDawnTransactionHandler;
-import org.eclipse.emf.cdo.internal.dawn.bundle.OM;
-import org.eclipse.emf.cdo.transaction.CDOTransaction;
-import org.eclipse.emf.cdo.transaction.CDOTransactionConflictEvent;
-import org.eclipse.emf.cdo.util.CDOUtil;
-import org.eclipse.emf.cdo.util.InvalidObjectException;
-import org.eclipse.emf.cdo.view.CDOViewInvalidationEvent;
-
-import org.eclipse.net4j.util.om.trace.ContextTracer;
-
-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.ecore.EObject;
-import org.eclipse.emf.edit.domain.EditingDomain;
-import org.eclipse.emf.edit.domain.IEditingDomainProvider;
-import org.eclipse.emf.transaction.RecordingCommand;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-
-import org.eclipse.gef.EditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.parts.DiagramEditor;
-import org.eclipse.gmf.runtime.diagram.ui.resources.editor.parts.DiagramDocumentEditor;
-import org.eclipse.gmf.runtime.notation.Edge;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.swt.widgets.Display;
-
-/**
- * @author Martin Fluegge
- */
-public class DawnGMFHandler extends BasicDawnTransactionHandler
-{
-
- private static final ContextTracer TRACER = new ContextTracer(OM.DEBUG, DawnGMFHandler.class);
-
- /**
- * @since 1.0
- */
- public DawnGMFHandler(IDawnEditor editor)
- {
- super(editor);
- }
-
- /**
- * @since 1.0
- */
- @Override
- public void handleViewInvalidationEvent(CDOViewInvalidationEvent event)
- {
- CDOViewInvalidationEvent e = event;
-
- if (TRACER.isEnabled())
- {
- TRACER.format("Detached Objects {0} ", e.getDetachedObjects()); //$NON-NLS-1$
- TRACER.format("Dirty Objects {0} ", e.getDirtyObjects()); //$NON-NLS-1$
- }
- adjustDeletedEdges(e);
-
- for (CDOObject dirtyObject : e.getDirtyObjects())
- {
- handleObject(dirtyObject);
- }
-
- for (CDOObject detachedObject : e.getDetachedObjects())
- {
- handleObject(detachedObject);
- }
- }
-
- /**
- * @since 1.0
- */
- @Override
- public void handleTransactionConflictEvent(CDOTransactionConflictEvent event)
- {
- CDOTransactionConflictEvent cdoTransactionConflictEvent = event;
-
- CDOObject cdoObject = cdoTransactionConflictEvent.getConflictingObject();
-
- EObject element = CDOUtil.getEObject(cdoObject); // either semantic object or notational
- View view = DawnDiagramUpdater.findView(element);
-
- if (DawnConflictHelper.isConflicted(cdoObject))
- {
- DawnConflictHelper.handleConflictedView(cdoObject, view, (DiagramDocumentEditor)editor);
- return;
- }
- }
-
- @Override
- public void modifyingObject(CDOTransaction transaction, final CDOObject object, CDOFeatureDelta featureDelta)
- {
- if (TRACER.isEnabled())
- {
- TRACER.format("modifyingObject {0}", object); //$NON-NLS-1$
- }
-
- refresh(object);
- editor.setDirty();
- object.eAdapters().add(new Adapter()
- {
- public void setTarget(Notifier newTarget)
- {
- }
-
- public void notifyChanged(Notification notification)
- {
- DawnDiagramUpdater.refreshEditPart(((DiagramDocumentEditor)editor).getDiagramEditPart(),
- (DiagramDocumentEditor)editor);
- object.eAdapters().remove(this);
- }
-
- public boolean isAdapterForType(Object type)
- {
- return false;
- }
-
- public Notifier getTarget()
- {
- return null;
- }
- });
- }
-
- /**
- * @since 1.0
- */
- @Override
- public void attachingObject(CDOTransaction transaction, CDOObject object)
- {
- super.attachingObject(transaction, object);
- refresh(object);
- }
-
- /**
- * Edges must be adjusted because of the transience of the Node source/targetEdges CDO cannot see this because
- * removing an edges just removes the edge from the diagram. CDO just notices the change in the diagram but not in the
- * (detached) edge. The other site (node) is transient and will not be part of the notification. So I must adjust this
- * later. CDOLEgacy Wrapper breakes because it only adjusts the changes in the diagram and not the removed edge. So I
- * cannot adjust this in the Wrapper. Maybe there is another more generic way.
- */
- public void adjustDeletedEdges(final CDOViewInvalidationEvent e)
- {
- Display.getDefault().asyncExec(new Runnable()
- {
- public void run()
- {
- for (CDOObject obj : e.getDetachedObjects())
- {
- final EObject view = CDOUtil.getEObject(obj);
- if (view instanceof Edge)
- {
- EditingDomain editingDomain = ((IEditingDomainProvider)view.eResource().getResourceSet())
- .getEditingDomain();
- editingDomain.getCommandStack().execute(new RecordingCommand((TransactionalEditingDomain)editingDomain)
- {
- @Override
- protected void doExecute()
- {
- try
- {
- ((Edge)view).setTarget(null);
- }
- catch (InvalidObjectException ignore)
- {
- }
-
- try
- {
- ((Edge)view).setSource(null);
- }
- catch (InvalidObjectException ignore)
- {
- }
- }
- });
- }
- }
- }
- });
- }
-
- protected void handleConflicts(CDOViewInvalidationEvent e)
- {
- for (CDOObject obj : e.getDetachedObjects())
- {
- EObject element = CDOUtil.getEObject(obj);
- View view = DawnDiagramUpdater.findViewByContainer(element);
- DawnConflictHelper.handleConflictedView(CDOUtil.getCDOObject(element), view, (DiagramDocumentEditor)editor);
- }
- }
-
- private void handleObject(CDOObject dirtyObject)
- {
- if (dirtyObject.cdoInvalid())
- {
- return;
- }
- EObject element = CDOUtil.getEObject(dirtyObject); // either sementic object or notational
-
- View view = DawnDiagramUpdater.findView(element);
-
- if (DawnConflictHelper.isConflicted(dirtyObject))
- {
- // DawnConflictHelper.handleConflictedView(dirtyObject, view, editor);
- return;
- }
-
- EditPart relatedEditPart = DawnDiagramUpdater.findEditPart(view, ((DiagramEditor)editor).getDiagramEditPart()
- .getViewer());
- if (relatedEditPart != null)
- {
- if (TRACER.isEnabled())
- {
- TRACER.format("Updating EditPart {0} ", relatedEditPart); //$NON-NLS-1$
- }
- DawnDiagramUpdater.refreshEditPart(relatedEditPart.getParent(), (DiagramDocumentEditor)editor);
- }
- else
- {
- if (TRACER.isEnabled())
- {
- TRACER.format("Updating DiagramEditPart {0} ", ((DiagramEditor)editor).getDiagramEditPart()); //$NON-NLS-1$
- }
- DawnDiagramUpdater.refreshEditPart(((DiagramEditor)editor).getDiagramEditPart(), (DiagramDocumentEditor)editor);
- }
- }
-
- protected void refresh(CDOObject object)
- {
- View view = DawnDiagramUpdater.findViewByContainer(object);
- if (view == null)
- {
- view = DawnDiagramUpdater.findViewForModel(object, (DiagramDocumentEditor)editor);
- }
- if (view == null)
- {
- DawnDiagramUpdater.findViewFromCrossReferences(object);
- }
-
- EditPart relatedEditPart = DawnDiagramUpdater.findEditPart(view, ((DiagramDocumentEditor)editor)
- .getDiagramEditPart().getViewer());
-
- if (relatedEditPart != null)
- {
- if (TRACER.isEnabled())
- {
- TRACER.format("Updating EditPart {0} ", relatedEditPart); //$NON-NLS-1$
- }
- EditPart parent = relatedEditPart.getParent();
- if (parent instanceof IGraphicalEditPart)
- {
- DawnDiagramUpdater.refresh((IGraphicalEditPart)parent);
- }
- else
- {
- DawnDiagramUpdater.refreshEditPart(parent, (DiagramDocumentEditor)editor);
- }
- }
- else
- {
- if (TRACER.isEnabled())
- {
- TRACER.format("Updating DiagramEditPart {0} ", ((DiagramDocumentEditor)editor).getDiagramEditPart()); //$NON-NLS-1$
- }
-
- DawnDiagramUpdater.refresh(((DiagramDocumentEditor)editor).getDiagramEditPart());
- }
- }
-}
+/*
+ * 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.gmf.notifications.impl;
+
+import org.eclipse.emf.cdo.CDOObject;
+import org.eclipse.emf.cdo.common.revision.delta.CDOFeatureDelta;
+import org.eclipse.emf.cdo.dawn.editors.IDawnEditor;
+import org.eclipse.emf.cdo.dawn.gmf.synchronize.DawnConflictHelper;
+import org.eclipse.emf.cdo.dawn.gmf.util.DawnDiagramUpdater;
+import org.eclipse.emf.cdo.dawn.notifications.BasicDawnTransactionHandler;
+import org.eclipse.emf.cdo.internal.dawn.bundle.OM;
+import org.eclipse.emf.cdo.transaction.CDOTransaction;
+import org.eclipse.emf.cdo.transaction.CDOTransactionConflictEvent;
+import org.eclipse.emf.cdo.util.CDOUtil;
+import org.eclipse.emf.cdo.util.InvalidObjectException;
+import org.eclipse.emf.cdo.view.CDOViewInvalidationEvent;
+
+import org.eclipse.net4j.util.om.trace.ContextTracer;
+
+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.ecore.EObject;
+import org.eclipse.emf.edit.domain.EditingDomain;
+import org.eclipse.emf.edit.domain.IEditingDomainProvider;
+import org.eclipse.emf.transaction.RecordingCommand;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+
+import org.eclipse.gef.EditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.parts.DiagramEditor;
+import org.eclipse.gmf.runtime.diagram.ui.resources.editor.parts.DiagramDocumentEditor;
+import org.eclipse.gmf.runtime.notation.Edge;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.swt.widgets.Display;
+
+/**
+ * @author Martin Fluegge
+ */
+public class DawnGMFHandler extends BasicDawnTransactionHandler
+{
+
+ private static final ContextTracer TRACER = new ContextTracer(OM.DEBUG, DawnGMFHandler.class);
+
+ /**
+ * @since 1.0
+ */
+ public DawnGMFHandler(IDawnEditor editor)
+ {
+ super(editor);
+ }
+
+ /**
+ * @since 1.0
+ */
+ @Override
+ public void handleViewInvalidationEvent(CDOViewInvalidationEvent event)
+ {
+ CDOViewInvalidationEvent e = event;
+
+ if (TRACER.isEnabled())
+ {
+ TRACER.format("Detached Objects {0} ", e.getDetachedObjects()); //$NON-NLS-1$
+ TRACER.format("Dirty Objects {0} ", e.getDirtyObjects()); //$NON-NLS-1$
+ }
+ adjustDeletedEdges(e);
+
+ for (CDOObject dirtyObject : e.getDirtyObjects())
+ {
+ handleObject(dirtyObject);
+ }
+
+ for (CDOObject detachedObject : e.getDetachedObjects())
+ {
+ handleObject(detachedObject);
+ }
+ }
+
+ /**
+ * @since 1.0
+ */
+ @Override
+ public void handleTransactionConflictEvent(CDOTransactionConflictEvent event)
+ {
+ CDOTransactionConflictEvent cdoTransactionConflictEvent = event;
+
+ CDOObject cdoObject = cdoTransactionConflictEvent.getConflictingObject();
+
+ EObject element = CDOUtil.getEObject(cdoObject); // either semantic object or notational
+ View view = DawnDiagramUpdater.findView(element);
+
+ if (DawnConflictHelper.isConflicted(cdoObject))
+ {
+ DawnConflictHelper.handleConflictedView(cdoObject, view, (DiagramDocumentEditor)editor);
+ return;
+ }
+ }
+
+ @Override
+ public void modifyingObject(CDOTransaction transaction, final CDOObject object, CDOFeatureDelta featureDelta)
+ {
+ if (TRACER.isEnabled())
+ {
+ TRACER.format("modifyingObject {0}", object); //$NON-NLS-1$
+ }
+
+ refresh(object);
+ editor.setDirty();
+ object.eAdapters().add(new Adapter()
+ {
+ public void setTarget(Notifier newTarget)
+ {
+ }
+
+ public void notifyChanged(Notification notification)
+ {
+ DawnDiagramUpdater.refreshEditPart(((DiagramDocumentEditor)editor).getDiagramEditPart(),
+ (DiagramDocumentEditor)editor);
+ object.eAdapters().remove(this);
+ }
+
+ public boolean isAdapterForType(Object type)
+ {
+ return false;
+ }
+
+ public Notifier getTarget()
+ {
+ return null;
+ }
+ });
+ }
+
+ /**
+ * @since 1.0
+ */
+ @Override
+ public void attachingObject(CDOTransaction transaction, CDOObject object)
+ {
+ super.attachingObject(transaction, object);
+ refresh(object);
+ }
+
+ /**
+ * Edges must be adjusted because of the transience of the Node source/targetEdges CDO cannot see this because
+ * removing an edges just removes the edge from the diagram. CDO just notices the change in the diagram but not in the
+ * (detached) edge. The other site (node) is transient and will not be part of the notification. So I must adjust this
+ * later. CDOLEgacy Wrapper breakes because it only adjusts the changes in the diagram and not the removed edge. So I
+ * cannot adjust this in the Wrapper. Maybe there is another more generic way.
+ */
+ public void adjustDeletedEdges(final CDOViewInvalidationEvent e)
+ {
+ Display.getDefault().asyncExec(new Runnable()
+ {
+ public void run()
+ {
+ for (CDOObject obj : e.getDetachedObjects())
+ {
+ final EObject view = CDOUtil.getEObject(obj);
+ if (view instanceof Edge)
+ {
+ EditingDomain editingDomain = ((IEditingDomainProvider)view.eResource().getResourceSet())
+ .getEditingDomain();
+ editingDomain.getCommandStack().execute(new RecordingCommand((TransactionalEditingDomain)editingDomain)
+ {
+ @Override
+ protected void doExecute()
+ {
+ try
+ {
+ ((Edge)view).setTarget(null);
+ }
+ catch (InvalidObjectException ignore)
+ {
+ }
+
+ try
+ {
+ ((Edge)view).setSource(null);
+ }
+ catch (InvalidObjectException ignore)
+ {
+ }
+ }
+ });
+ }
+ }
+ }
+ });
+ }
+
+ protected void handleConflicts(CDOViewInvalidationEvent e)
+ {
+ for (CDOObject obj : e.getDetachedObjects())
+ {
+ EObject element = CDOUtil.getEObject(obj);
+ View view = DawnDiagramUpdater.findViewByContainer(element);
+ DawnConflictHelper.handleConflictedView(CDOUtil.getCDOObject(element), view, (DiagramDocumentEditor)editor);
+ }
+ }
+
+ private void handleObject(CDOObject dirtyObject)
+ {
+ if (dirtyObject.cdoInvalid())
+ {
+ return;
+ }
+ EObject element = CDOUtil.getEObject(dirtyObject); // either sementic object or notational
+
+ View view = DawnDiagramUpdater.findView(element);
+
+ if (DawnConflictHelper.isConflicted(dirtyObject))
+ {
+ // DawnConflictHelper.handleConflictedView(dirtyObject, view, editor);
+ return;
+ }
+
+ EditPart relatedEditPart = DawnDiagramUpdater.findEditPart(view, ((DiagramEditor)editor).getDiagramEditPart()
+ .getViewer());
+ if (relatedEditPart != null)
+ {
+ if (TRACER.isEnabled())
+ {
+ TRACER.format("Updating EditPart {0} ", relatedEditPart); //$NON-NLS-1$
+ }
+ DawnDiagramUpdater.refreshEditPart(relatedEditPart.getParent(), (DiagramDocumentEditor)editor);
+ }
+ else
+ {
+ if (TRACER.isEnabled())
+ {
+ TRACER.format("Updating DiagramEditPart {0} ", ((DiagramEditor)editor).getDiagramEditPart()); //$NON-NLS-1$
+ }
+ DawnDiagramUpdater.refreshEditPart(((DiagramEditor)editor).getDiagramEditPart(), (DiagramDocumentEditor)editor);
+ }
+ }
+
+ protected void refresh(CDOObject object)
+ {
+ View view = DawnDiagramUpdater.findViewByContainer(object);
+ if (view == null)
+ {
+ view = DawnDiagramUpdater.findViewForModel(object, (DiagramDocumentEditor)editor);
+ }
+ if (view == null)
+ {
+ DawnDiagramUpdater.findViewFromCrossReferences(object);
+ }
+
+ EditPart relatedEditPart = DawnDiagramUpdater.findEditPart(view, ((DiagramDocumentEditor)editor)
+ .getDiagramEditPart().getViewer());
+
+ if (relatedEditPart != null)
+ {
+ if (TRACER.isEnabled())
+ {
+ TRACER.format("Updating EditPart {0} ", relatedEditPart); //$NON-NLS-1$
+ }
+ EditPart parent = relatedEditPart.getParent();
+ if (parent instanceof IGraphicalEditPart)
+ {
+ DawnDiagramUpdater.refresh((IGraphicalEditPart)parent);
+ }
+ else
+ {
+ DawnDiagramUpdater.refreshEditPart(parent, (DiagramDocumentEditor)editor);
+ }
+ }
+ else
+ {
+ if (TRACER.isEnabled())
+ {
+ TRACER.format("Updating DiagramEditPart {0} ", ((DiagramDocumentEditor)editor).getDiagramEditPart()); //$NON-NLS-1$
+ }
+
+ DawnDiagramUpdater.refresh(((DiagramDocumentEditor)editor).getDiagramEditPart());
+ }
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.dawn.gmf/src/org/eclipse/emf/cdo/dawn/gmf/notifications/impl/DawnGMFLockingHandler.java b/plugins/org.eclipse.emf.cdo.dawn.gmf/src/org/eclipse/emf/cdo/dawn/gmf/notifications/impl/DawnGMFLockingHandler.java
index ae5262146d..6a5706c569 100644
--- a/plugins/org.eclipse.emf.cdo.dawn.gmf/src/org/eclipse/emf/cdo/dawn/gmf/notifications/impl/DawnGMFLockingHandler.java
+++ b/plugins/org.eclipse.emf.cdo.dawn.gmf/src/org/eclipse/emf/cdo/dawn/gmf/notifications/impl/DawnGMFLockingHandler.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2004 - 2011 Eike Stepper (Berlin, Germany) and others.
+ * 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.gmf/src/org/eclipse/emf/cdo/dawn/gmf/resources/DawnPathmapManager.java b/plugins/org.eclipse.emf.cdo.dawn.gmf/src/org/eclipse/emf/cdo/dawn/gmf/resources/DawnPathmapManager.java
index b82ff00dfb..79edd01b3f 100644
--- a/plugins/org.eclipse.emf.cdo.dawn.gmf/src/org/eclipse/emf/cdo/dawn/gmf/resources/DawnPathmapManager.java
+++ b/plugins/org.eclipse.emf.cdo.dawn.gmf/src/org/eclipse/emf/cdo/dawn/gmf/resources/DawnPathmapManager.java
@@ -1,64 +1,64 @@
-/*
- * 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
- */
-package org.eclipse.emf.cdo.dawn.gmf.resources;
-
-import org.eclipse.emf.common.notify.Adapter;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.emf.ecore.resource.ResourceSet;
-
-import org.eclipse.gmf.runtime.emf.core.internal.resources.PathmapManager;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * @author Martin Fluegge
- */
-@SuppressWarnings("restriction")
-public class DawnPathmapManager extends PathmapManager
-{
- // TODO remove this as soon as the PathmapManager problem is solved!
- @Override
- public void notifyChanged(Notification msg)
- {
- if (msg.getFeatureID(ResourceSet.class) == ResourceSet.RESOURCE_SET__RESOURCES)
- {
- switch (msg.getEventType())
- {
- case Notification.REMOVE_MANY:
- {
- if (msg.getNewValue() instanceof int[])
- {
- return;
- }
- break;
- }
- }
- }
-
- super.notifyChanged(msg);
- }
-
- public static void removePathMapMananger(EList<Adapter> eAdapters)
- {
- List<Adapter> toBeRemoved = new ArrayList<Adapter>();
- for (Adapter a : eAdapters)
- {
- if (a instanceof PathmapManager)
- {
- toBeRemoved.add(a);
- }
- }
- eAdapters.removeAll(toBeRemoved);
- }
-
-}
+/*
+ * 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.gmf.resources;
+
+import org.eclipse.emf.common.notify.Adapter;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.emf.ecore.resource.ResourceSet;
+
+import org.eclipse.gmf.runtime.emf.core.internal.resources.PathmapManager;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author Martin Fluegge
+ */
+@SuppressWarnings("restriction")
+public class DawnPathmapManager extends PathmapManager
+{
+ // TODO remove this as soon as the PathmapManager problem is solved!
+ @Override
+ public void notifyChanged(Notification msg)
+ {
+ if (msg.getFeatureID(ResourceSet.class) == ResourceSet.RESOURCE_SET__RESOURCES)
+ {
+ switch (msg.getEventType())
+ {
+ case Notification.REMOVE_MANY:
+ {
+ if (msg.getNewValue() instanceof int[])
+ {
+ return;
+ }
+ break;
+ }
+ }
+ }
+
+ super.notifyChanged(msg);
+ }
+
+ public static void removePathMapMananger(EList<Adapter> eAdapters)
+ {
+ List<Adapter> toBeRemoved = new ArrayList<Adapter>();
+ for (Adapter a : eAdapters)
+ {
+ if (a instanceof PathmapManager)
+ {
+ toBeRemoved.add(a);
+ }
+ }
+ eAdapters.removeAll(toBeRemoved);
+ }
+
+}
diff --git a/plugins/org.eclipse.emf.cdo.dawn.gmf/src/org/eclipse/emf/cdo/dawn/gmf/stylizer/DawnGMFElementStylizerFactory.java b/plugins/org.eclipse.emf.cdo.dawn.gmf/src/org/eclipse/emf/cdo/dawn/gmf/stylizer/DawnGMFElementStylizerFactory.java
index c5777b678c..25f6b8e568 100644
--- a/plugins/org.eclipse.emf.cdo.dawn.gmf/src/org/eclipse/emf/cdo/dawn/gmf/stylizer/DawnGMFElementStylizerFactory.java
+++ b/plugins/org.eclipse.emf.cdo.dawn.gmf/src/org/eclipse/emf/cdo/dawn/gmf/stylizer/DawnGMFElementStylizerFactory.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2004 - 2011 Eike Stepper (Berlin, Germany) and others.
+ * 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.gmf/src/org/eclipse/emf/cdo/dawn/gmf/synchronize/DawnChangeHelper.java b/plugins/org.eclipse.emf.cdo.dawn.gmf/src/org/eclipse/emf/cdo/dawn/gmf/synchronize/DawnChangeHelper.java
index 8478665b42..57f5ffdc94 100644
--- a/plugins/org.eclipse.emf.cdo.dawn.gmf/src/org/eclipse/emf/cdo/dawn/gmf/synchronize/DawnChangeHelper.java
+++ b/plugins/org.eclipse.emf.cdo.dawn.gmf/src/org/eclipse/emf/cdo/dawn/gmf/synchronize/DawnChangeHelper.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2004 - 2011 Eike Stepper (Berlin, Germany) and others.
+ * 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.gmf/src/org/eclipse/emf/cdo/dawn/gmf/synchronize/DawnConflictHelper.java b/plugins/org.eclipse.emf.cdo.dawn.gmf/src/org/eclipse/emf/cdo/dawn/gmf/synchronize/DawnConflictHelper.java
index 0210b0dea3..de9c97920c 100644
--- a/plugins/org.eclipse.emf.cdo.dawn.gmf/src/org/eclipse/emf/cdo/dawn/gmf/synchronize/DawnConflictHelper.java
+++ b/plugins/org.eclipse.emf.cdo.dawn.gmf/src/org/eclipse/emf/cdo/dawn/gmf/synchronize/DawnConflictHelper.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2004 - 2011 Eike Stepper (Berlin, Germany) and others.
+ * 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.gmf/src/org/eclipse/emf/cdo/dawn/gmf/util/DawnDiagramUpdater.java b/plugins/org.eclipse.emf.cdo.dawn.gmf/src/org/eclipse/emf/cdo/dawn/gmf/util/DawnDiagramUpdater.java
index 9dbba73c0f..cf41dedab1 100644
--- a/plugins/org.eclipse.emf.cdo.dawn.gmf/src/org/eclipse/emf/cdo/dawn/gmf/util/DawnDiagramUpdater.java
+++ b/plugins/org.eclipse.emf.cdo.dawn.gmf/src/org/eclipse/emf/cdo/dawn/gmf/util/DawnDiagramUpdater.java
@@ -1,397 +1,397 @@
-/*
- * 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
- */
-package org.eclipse.emf.cdo.dawn.gmf.util;
-
-import org.eclipse.emf.cdo.dawn.internal.util.bundle.OM;
-
-import org.eclipse.net4j.util.om.trace.ContextTracer;
-
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.util.ECrossReferenceAdapter;
-import org.eclipse.emf.transaction.RecordingCommand;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-
-import org.eclipse.gef.EditPart;
-import org.eclipse.gef.EditPartViewer;
-import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.ConnectionEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CanonicalEditPolicy;
-import org.eclipse.gmf.runtime.diagram.ui.resources.editor.parts.DiagramDocumentEditor;
-import org.eclipse.gmf.runtime.diagram.ui.services.editpart.EditPartService;
-import org.eclipse.gmf.runtime.emf.core.util.CrossReferenceAdapter;
-import org.eclipse.gmf.runtime.notation.Diagram;
-import org.eclipse.gmf.runtime.notation.Edge;
-import org.eclipse.gmf.runtime.notation.NotationPackage;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.ui.PlatformUI;
-
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.List;
-
-/**
- * @author Martin Fluegge
- */
-public class DawnDiagramUpdater
-{
- private static final ContextTracer TRACER = new ContextTracer(OM.DEBUG, DawnDiagramUpdater.class);
-
- public static void refresh(final IGraphicalEditPart editPart)
- {
- TransactionalEditingDomain editingDomain = editPart.getEditingDomain();
- editingDomain.getCommandStack().execute(new RecordingCommand(editingDomain)
- {
- @Override
- public void doExecute()
- {
- editPart.refresh();
-
- if (editPart instanceof ConnectionEditPart)
- {
- DawnDiagramUpdater.refresh((IGraphicalEditPart)((ConnectionEditPart)editPart).getTarget());
- DawnDiagramUpdater.refresh((IGraphicalEditPart)((ConnectionEditPart)editPart).getSource());
- }
- }
- });
- }
-
- public static void refreshEditPart(EditPart editPart)
- {
- refeshEditpartInternal(editPart);
- }
-
- public static void refreshEditPart(final EditPart editPart, DiagramDocumentEditor editor)
- {
- try
- {
- editor.getEditingDomain().runExclusive(new Runnable()
- {
- public void run()
- {
- DawnDiagramUpdater.refreshEditPart(editPart);
- }
- });
- }
- catch (InterruptedException ex)
- {
- throw new RuntimeException(ex);
- }
- }
-
- public static void refreshEditCurrentSelected(TransactionalEditingDomain editingDomain)
- {
- editingDomain.getCommandStack().execute(new RecordingCommand(editingDomain)
- {
-
- @Override
- protected void doExecute()
- {
- // ((ExamplediagramDocumentProvider)getDocumentProvider()).changed(getEditorInput());
- ISelection selection = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getSelectionService()
- .getSelection();
- if (selection instanceof IStructuredSelection)
- {
- IStructuredSelection structuredSelection = (IStructuredSelection)selection;
- if (structuredSelection.size() != 1)
- {
- return;
- }
- if (structuredSelection.getFirstElement() instanceof EditPart
- && ((EditPart)structuredSelection.getFirstElement()).getModel() instanceof View)
- {
- EObject modelElement = ((View)((EditPart)structuredSelection.getFirstElement()).getModel()).getElement();
- List<?> editPolicies = CanonicalEditPolicy.getRegisteredEditPolicies(modelElement);
- for (Iterator<?> it = editPolicies.iterator(); it.hasNext();)
- {
- CanonicalEditPolicy nextEditPolicy = (CanonicalEditPolicy)it.next();
- nextEditPolicy.refresh();
- }
- }
- }
- }
- });
- }
-
- private static void refeshEditpartInternal(EditPart editPart)
- {
- if (editPart != null)
- {
- try
- {
-
- // EObject modelElement = ((View)(editPart).getModel()).getElement();
- // List editPolicies = CanonicalEditPolicy.getRegisteredEditPolicies(modelElement);
- // for (Iterator it = editPolicies.iterator(); it.hasNext();)
- // {
- // CanonicalEditPolicy nextEditPolicy = (CanonicalEditPolicy)it.next();
- // nextEditPolicy.refresh();
- // }
-
- editPart.refresh();
- }
- catch (Exception e)
- {
- e.printStackTrace();
- }
-
- if (editPart instanceof DiagramEditPart)
- {
- for (Object connectionEditPart : ((DiagramEditPart)editPart).getConnections())
- {
- if (connectionEditPart instanceof EditPart)
- {
- if (((Edge)((EditPart)connectionEditPart).getModel()).getBendpoints() != null)
- {
- refeshEditpartInternal((EditPart)connectionEditPart);
- }
- }
- }
- }
-
- for (Object childEditPart : editPart.getChildren())
- {
- if (childEditPart instanceof EditPart)
- {
- refeshEditpartInternal((EditPart)childEditPart);
- }
- }
- }
- }
-
- public static View findViewByContainer(EObject element)
- {
- if (element instanceof View)
- {
- return (View)element;
- }
-
- if (element.eContainer() == null)
- {
- return null;
- }
-
- if (element.eContainer() instanceof View)
- {
- return (View)element.eContainer();
- }
-
- return findViewByContainer(element.eContainer());
- }
-
- public static View findViewForModel(EObject object, DiagramDocumentEditor editor)
- {
- if (object == null)
- {
- return null;
- }
- for (EObject e : editor.getDiagram().eContents())
- {
- if (e instanceof View)
- {
- View view = (View)e;
- if (object.equals(view.getElement()))
- {
- if (TRACER.isEnabled())
- {
- TRACER.format("FOUND View: {0} for view obj: {1} ", e, object); //$NON-NLS-1$
- }
- }
- return (View)e;
- }
- }
- return null;
- }
-
- public static View getViewFromObject(EObject element, DiagramDocumentEditor editor)
- {
- View view;
-
- if (element instanceof Diagram)
- {
- view = ViewUtil.getViewContainer(element);
- return view;
- }
-
- if (element instanceof View)
- {
- view = (View)element;
- }
- else
- {
- view = DawnDiagramUpdater.findViewByContainer(element); // something which is not view (Edge or Node)
- if (view == null)
- {
- view = DawnDiagramUpdater.findViewForModel(element, editor);
- }
- }
- return view;
- }
-
- public static EditPart createOrFindEditPartIfViewExists(View view, DiagramDocumentEditor editor)
- {
- EditPart editPart = findEditPart(view, editor.getDiagramEditPart());
-
- if (view != null)
- {
- if (editPart == null) // does not exist?
- {
- if (TRACER.isEnabled())
- {
- TRACER.format("EditPart does not exist for view {0} ", view); //$NON-NLS-1$
- }
- editPart = EditPartService.getInstance().createGraphicEditPart(view);
- setParentEditPart(editor, view, editPart);
- }
- }
- if (TRACER.isEnabled())
- {
- TRACER.format("Found EditPart: {0} ", editPart); //$NON-NLS-1$
- }
- return editPart;
- }
-
- public static void setParentEditPart(final DiagramDocumentEditor editor, View view, EditPart editPart)
- {
- View viewParent = (View)view.eContainer();
- EditPart parentEditPart = findEditPart(viewParent, editor);
- if (parentEditPart == null)
- {
- parentEditPart = editor.getDiagramEditPart();
- }
- editPart.setParent(parentEditPart);
- }
-
- public static EditPart findEditPart(View view, DiagramDocumentEditor dawnDiagramEditor)
- {
- DiagramEditPart diagramEditPart = dawnDiagramEditor.getDiagramEditPart();
-
- for (Object e : diagramEditPart.getChildren())
- {
- EditPart ep = (EditPart)e;
- if (ep.getModel().equals(view))
- {
- return ep;
- }
- }
-
- for (Object e : diagramEditPart.getConnections())
- {
- EditPart ep = (EditPart)e;
- if (ep.getModel().equals(view))
- {
- return ep;
- }
- }
- return null;
- }
-
- public static EditPart findEditPart(View view, EditPart editPart)
- {
- EditPart ret;
-
- if (editPart.getModel().equals(view))
- {
- return editPart;
- }
-
- for (Object o : editPart.getChildren())
- {
- EditPart child = (EditPart)o;
- ret = findEditPart(view, child);
- if (ret != null)
- {
- return ret;
- }
- }
-
- if (editPart instanceof DiagramEditPart)
- {
- for (Object o : ((DiagramEditPart)editPart).getConnections())
- {
- EditPart child = (EditPart)o;
- ret = findEditPart(view, child);
- if (ret != null)
- {
- return ret;
- }
- }
- }
- return null;
- }
-
- public static EditPart findEditPart(View view, EditPartViewer viewer)
- {
- return (EditPart)viewer.getEditPartRegistry().get(view);
- }
-
- /**
- * In a normal GMF environment the diagram is loaded from a xml resource. In this scenario the XMLHelper sets "null"
- * to the element of edge. Thus the value is 'set' with a null value. We do not have this in our case because the
- * element is carefully loaded from the CDO repository. But if the value is not set a getElement() call fills the
- * element with the eContainer. See <b>org.eclipse.gmf.runtime.notation.impl.ViewImpl.isSetElement()</b>. This happens
- * when the ConnectionEditPart is activated and the model registered. See
- * <b>org.eclipse.gmf.runtime.diagram.ui.editparts.ConnectionEditPart.registerModel()</b>
- * <p>
- * In our scenario the Edges will be wrongly connected to the diagram itself, which makes the CanonicalEditingPolicy
- * to remove and restore the edge. Long, short story, we must 'touch' the elements here to have the element set.
- *
- * @param diagram
- */
- public static void initializeElement(Diagram diagram)
- {
- for (Object obj : diagram.getEdges())
- {
- Edge edge = (Edge)obj;
- if (!edge.isSetElement())
- {
- boolean eDeliver = edge.eDeliver();
- edge.eSetDeliver(false);
- edge.setElement(null);
- edge.eSetDeliver(eDeliver);
- }
- }
- }
-
- public static View findViewFromCrossReferences(EObject element)
- {
- CrossReferenceAdapter crossreferenceAdapter = (CrossReferenceAdapter)ECrossReferenceAdapter
- .getCrossReferenceAdapter(element);// getCrossReferenceAdapter(element);
- if (crossreferenceAdapter != null)
- {
- Collection<?> iinverseReferences = crossreferenceAdapter.getInverseReferencers(element,
- NotationPackage.eINSTANCE.getView_Element(), null);
-
- for (Object f : iinverseReferences)
- {
- if (f instanceof View)
- {
- return (View)f;
- }
- }
- }
- return null;
- }
-
- public static View findView(EObject element)
- {
- View view = DawnDiagramUpdater.findViewByContainer(element);
-
- if (view == null)
- {
- view = DawnDiagramUpdater.findViewFromCrossReferences(element);
- }
- return view;
- }
-}
+/*
+ * 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.gmf.util;
+
+import org.eclipse.emf.cdo.dawn.internal.util.bundle.OM;
+
+import org.eclipse.net4j.util.om.trace.ContextTracer;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.util.ECrossReferenceAdapter;
+import org.eclipse.emf.transaction.RecordingCommand;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.EditPartViewer;
+import org.eclipse.gmf.runtime.diagram.core.util.ViewUtil;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ConnectionEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editpolicies.CanonicalEditPolicy;
+import org.eclipse.gmf.runtime.diagram.ui.resources.editor.parts.DiagramDocumentEditor;
+import org.eclipse.gmf.runtime.diagram.ui.services.editpart.EditPartService;
+import org.eclipse.gmf.runtime.emf.core.util.CrossReferenceAdapter;
+import org.eclipse.gmf.runtime.notation.Diagram;
+import org.eclipse.gmf.runtime.notation.Edge;
+import org.eclipse.gmf.runtime.notation.NotationPackage;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.ui.PlatformUI;
+
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+
+/**
+ * @author Martin Fluegge
+ */
+public class DawnDiagramUpdater
+{
+ private static final ContextTracer TRACER = new ContextTracer(OM.DEBUG, DawnDiagramUpdater.class);
+
+ public static void refresh(final IGraphicalEditPart editPart)
+ {
+ TransactionalEditingDomain editingDomain = editPart.getEditingDomain();
+ editingDomain.getCommandStack().execute(new RecordingCommand(editingDomain)
+ {
+ @Override
+ public void doExecute()
+ {
+ editPart.refresh();
+
+ if (editPart instanceof ConnectionEditPart)
+ {
+ DawnDiagramUpdater.refresh((IGraphicalEditPart)((ConnectionEditPart)editPart).getTarget());
+ DawnDiagramUpdater.refresh((IGraphicalEditPart)((ConnectionEditPart)editPart).getSource());
+ }
+ }
+ });
+ }
+
+ public static void refreshEditPart(EditPart editPart)
+ {
+ refeshEditpartInternal(editPart);
+ }
+
+ public static void refreshEditPart(final EditPart editPart, DiagramDocumentEditor editor)
+ {
+ try
+ {
+ editor.getEditingDomain().runExclusive(new Runnable()
+ {
+ public void run()
+ {
+ DawnDiagramUpdater.refreshEditPart(editPart);
+ }
+ });
+ }
+ catch (InterruptedException ex)
+ {
+ throw new RuntimeException(ex);
+ }
+ }
+
+ public static void refreshEditCurrentSelected(TransactionalEditingDomain editingDomain)
+ {
+ editingDomain.getCommandStack().execute(new RecordingCommand(editingDomain)
+ {
+
+ @Override
+ protected void doExecute()
+ {
+ // ((ExamplediagramDocumentProvider)getDocumentProvider()).changed(getEditorInput());
+ ISelection selection = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getSelectionService()
+ .getSelection();
+ if (selection instanceof IStructuredSelection)
+ {
+ IStructuredSelection structuredSelection = (IStructuredSelection)selection;
+ if (structuredSelection.size() != 1)
+ {
+ return;
+ }
+ if (structuredSelection.getFirstElement() instanceof EditPart
+ && ((EditPart)structuredSelection.getFirstElement()).getModel() instanceof View)
+ {
+ EObject modelElement = ((View)((EditPart)structuredSelection.getFirstElement()).getModel()).getElement();
+ List<?> editPolicies = CanonicalEditPolicy.getRegisteredEditPolicies(modelElement);
+ for (Iterator<?> it = editPolicies.iterator(); it.hasNext();)
+ {
+ CanonicalEditPolicy nextEditPolicy = (CanonicalEditPolicy)it.next();
+ nextEditPolicy.refresh();
+ }
+ }
+ }
+ }
+ });
+ }
+
+ private static void refeshEditpartInternal(EditPart editPart)
+ {
+ if (editPart != null)
+ {
+ try
+ {
+
+ // EObject modelElement = ((View)(editPart).getModel()).getElement();
+ // List editPolicies = CanonicalEditPolicy.getRegisteredEditPolicies(modelElement);
+ // for (Iterator it = editPolicies.iterator(); it.hasNext();)
+ // {
+ // CanonicalEditPolicy nextEditPolicy = (CanonicalEditPolicy)it.next();
+ // nextEditPolicy.refresh();
+ // }
+
+ editPart.refresh();
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ }
+
+ if (editPart instanceof DiagramEditPart)
+ {
+ for (Object connectionEditPart : ((DiagramEditPart)editPart).getConnections())
+ {
+ if (connectionEditPart instanceof EditPart)
+ {
+ if (((Edge)((EditPart)connectionEditPart).getModel()).getBendpoints() != null)
+ {
+ refeshEditpartInternal((EditPart)connectionEditPart);
+ }
+ }
+ }
+ }
+
+ for (Object childEditPart : editPart.getChildren())
+ {
+ if (childEditPart instanceof EditPart)
+ {
+ refeshEditpartInternal((EditPart)childEditPart);
+ }
+ }
+ }
+ }
+
+ public static View findViewByContainer(EObject element)
+ {
+ if (element instanceof View)
+ {
+ return (View)element;
+ }
+
+ if (element.eContainer() == null)
+ {
+ return null;
+ }
+
+ if (element.eContainer() instanceof View)
+ {
+ return (View)element.eContainer();
+ }
+
+ return findViewByContainer(element.eContainer());
+ }
+
+ public static View findViewForModel(EObject object, DiagramDocumentEditor editor)
+ {
+ if (object == null)
+ {
+ return null;
+ }
+ for (EObject e : editor.getDiagram().eContents())
+ {
+ if (e instanceof View)
+ {
+ View view = (View)e;
+ if (object.equals(view.getElement()))
+ {
+ if (TRACER.isEnabled())
+ {
+ TRACER.format("FOUND View: {0} for view obj: {1} ", e, object); //$NON-NLS-1$
+ }
+ }
+ return (View)e;
+ }
+ }
+ return null;
+ }
+
+ public static View getViewFromObject(EObject element, DiagramDocumentEditor editor)
+ {
+ View view;
+
+ if (element instanceof Diagram)
+ {
+ view = ViewUtil.getViewContainer(element);
+ return view;
+ }
+
+ if (element instanceof View)
+ {
+ view = (View)element;
+ }
+ else
+ {
+ view = DawnDiagramUpdater.findViewByContainer(element); // something which is not view (Edge or Node)
+ if (view == null)
+ {
+ view = DawnDiagramUpdater.findViewForModel(element, editor);
+ }
+ }
+ return view;
+ }
+
+ public static EditPart createOrFindEditPartIfViewExists(View view, DiagramDocumentEditor editor)
+ {
+ EditPart editPart = findEditPart(view, editor.getDiagramEditPart());
+
+ if (view != null)
+ {
+ if (editPart == null) // does not exist?
+ {
+ if (TRACER.isEnabled())
+ {
+ TRACER.format("EditPart does not exist for view {0} ", view); //$NON-NLS-1$
+ }
+ editPart = EditPartService.getInstance().createGraphicEditPart(view);
+ setParentEditPart(editor, view, editPart);
+ }
+ }
+ if (TRACER.isEnabled())
+ {
+ TRACER.format("Found EditPart: {0} ", editPart); //$NON-NLS-1$
+ }
+ return editPart;
+ }
+
+ public static void setParentEditPart(final DiagramDocumentEditor editor, View view, EditPart editPart)
+ {
+ View viewParent = (View)view.eContainer();
+ EditPart parentEditPart = findEditPart(viewParent, editor);
+ if (parentEditPart == null)
+ {
+ parentEditPart = editor.getDiagramEditPart();
+ }
+ editPart.setParent(parentEditPart);
+ }
+
+ public static EditPart findEditPart(View view, DiagramDocumentEditor dawnDiagramEditor)
+ {
+ DiagramEditPart diagramEditPart = dawnDiagramEditor.getDiagramEditPart();
+
+ for (Object e : diagramEditPart.getChildren())
+ {
+ EditPart ep = (EditPart)e;
+ if (ep.getModel().equals(view))
+ {
+ return ep;
+ }
+ }
+
+ for (Object e : diagramEditPart.getConnections())
+ {
+ EditPart ep = (EditPart)e;
+ if (ep.getModel().equals(view))
+ {
+ return ep;
+ }
+ }
+ return null;
+ }
+
+ public static EditPart findEditPart(View view, EditPart editPart)
+ {
+ EditPart ret;
+
+ if (editPart.getModel().equals(view))
+ {
+ return editPart;
+ }
+
+ for (Object o : editPart.getChildren())
+ {
+ EditPart child = (EditPart)o;
+ ret = findEditPart(view, child);
+ if (ret != null)
+ {
+ return ret;
+ }
+ }
+
+ if (editPart instanceof DiagramEditPart)
+ {
+ for (Object o : ((DiagramEditPart)editPart).getConnections())
+ {
+ EditPart child = (EditPart)o;
+ ret = findEditPart(view, child);
+ if (ret != null)
+ {
+ return ret;
+ }
+ }
+ }
+ return null;
+ }
+
+ public static EditPart findEditPart(View view, EditPartViewer viewer)
+ {
+ return (EditPart)viewer.getEditPartRegistry().get(view);
+ }
+
+ /**
+ * In a normal GMF environment the diagram is loaded from a xml resource. In this scenario the XMLHelper sets "null"
+ * to the element of edge. Thus the value is 'set' with a null value. We do not have this in our case because the
+ * element is carefully loaded from the CDO repository. But if the value is not set a getElement() call fills the
+ * element with the eContainer. See <b>org.eclipse.gmf.runtime.notation.impl.ViewImpl.isSetElement()</b>. This happens
+ * when the ConnectionEditPart is activated and the model registered. See
+ * <b>org.eclipse.gmf.runtime.diagram.ui.editparts.ConnectionEditPart.registerModel()</b>
+ * <p>
+ * In our scenario the Edges will be wrongly connected to the diagram itself, which makes the CanonicalEditingPolicy
+ * to remove and restore the edge. Long, short story, we must 'touch' the elements here to have the element set.
+ *
+ * @param diagram
+ */
+ public static void initializeElement(Diagram diagram)
+ {
+ for (Object obj : diagram.getEdges())
+ {
+ Edge edge = (Edge)obj;
+ if (!edge.isSetElement())
+ {
+ boolean eDeliver = edge.eDeliver();
+ edge.eSetDeliver(false);
+ edge.setElement(null);
+ edge.eSetDeliver(eDeliver);
+ }
+ }
+ }
+
+ public static View findViewFromCrossReferences(EObject element)
+ {
+ CrossReferenceAdapter crossreferenceAdapter = (CrossReferenceAdapter)ECrossReferenceAdapter
+ .getCrossReferenceAdapter(element);// getCrossReferenceAdapter(element);
+ if (crossreferenceAdapter != null)
+ {
+ Collection<?> iinverseReferences = crossreferenceAdapter.getInverseReferencers(element,
+ NotationPackage.eINSTANCE.getView_Element(), null);
+
+ for (Object f : iinverseReferences)
+ {
+ if (f instanceof View)
+ {
+ return (View)f;
+ }
+ }
+ }
+ return null;
+ }
+
+ public static View findView(EObject element)
+ {
+ View view = DawnDiagramUpdater.findViewByContainer(element);
+
+ if (view == null)
+ {
+ view = DawnDiagramUpdater.findViewFromCrossReferences(element);
+ }
+ return view;
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.dawn.gmf/src/org/eclipse/emf/cdo/dawn/gmf/util/DawnResourceHelper.java b/plugins/org.eclipse.emf.cdo.dawn.gmf/src/org/eclipse/emf/cdo/dawn/gmf/util/DawnResourceHelper.java
index 5e8ec538ef..329c85b144 100644
--- a/plugins/org.eclipse.emf.cdo.dawn.gmf/src/org/eclipse/emf/cdo/dawn/gmf/util/DawnResourceHelper.java
+++ b/plugins/org.eclipse.emf.cdo.dawn.gmf/src/org/eclipse/emf/cdo/dawn/gmf/util/DawnResourceHelper.java
@@ -1,984 +1,984 @@
-/*
- * 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
- */
-package org.eclipse.emf.cdo.dawn.gmf.util;
-
-/**
- *
- * @author Martin Fluegge
- */
-
-//import org.eclipse.emf.cdo.internal.dawn.bundle.OM;
-
-import org.eclipse.emf.cdo.dawn.internal.util.bundle.OM;
-import org.eclipse.emf.cdo.dawn.util.exceptions.EClassIncompatibleException;
-
-import org.eclipse.net4j.util.om.trace.ContextTracer;
-
-import org.eclipse.emf.common.notify.Adapter;
-import org.eclipse.emf.common.util.URI;
-import org.eclipse.emf.ecore.EAnnotation;
-import org.eclipse.emf.ecore.EAttribute;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.EGenericType;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EOperation;
-import org.eclipse.emf.ecore.EReference;
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.emf.ecore.resource.Resource;
-import org.eclipse.emf.ecore.resource.ResourceSet;
-import org.eclipse.emf.ecore.util.EcoreUtil;
-import org.eclipse.emf.ecore.xmi.XMIResource;
-import org.eclipse.emf.ecore.xmi.XMLHelper;
-import org.eclipse.emf.ecore.xmi.XMLResource;
-import org.eclipse.emf.ecore.xmi.impl.XMIHelperImpl;
-import org.eclipse.emf.ecore.xmi.impl.XMILoadImpl;
-import org.eclipse.emf.ecore.xmi.impl.XMIResourceImpl;
-import org.eclipse.emf.ecore.xmi.impl.XMISaveImpl;
-import org.eclipse.emf.ecore.xmi.impl.XMLHelperImpl;
-
-import org.eclipse.core.runtime.FileLocator;
-import org.eclipse.gef.EditPart;
-import org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramEditPart;
-import org.eclipse.gmf.runtime.diagram.ui.resources.editor.parts.DiagramDocumentEditor;
-import org.eclipse.gmf.runtime.notation.Bounds;
-import org.eclipse.gmf.runtime.notation.Diagram;
-import org.eclipse.gmf.runtime.notation.Edge;
-import org.eclipse.gmf.runtime.notation.Node;
-import org.eclipse.gmf.runtime.notation.RelativeBendpoints;
-import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.gmf.runtime.notation.datatype.RelativeBendpoint;
-
-import java.io.BufferedReader;
-import java.io.ByteArrayInputStream;
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.FileReader;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.io.StringWriter;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-/**
- * @since 1.0
- */
-public class DawnResourceHelper
-{
- private static final ContextTracer TRACER = new ContextTracer(OM.DEBUG, DawnResourceHelper.class);
-
- public static String getXmiId(EObject eObject)
- {
- Resource xmiResource = eObject.eResource();
- if (xmiResource == null)
- {
- return null;
- }
-
- return ((XMLResource)xmiResource).getID(eObject);
- }
-
- public static String getXmiId(EObject eObject, Resource xmiResource)
- {
- if (xmiResource == null)
- {
- return null;
- }
-
- return ((XMLResource)xmiResource).getID(eObject);
- }
-
- public static void setXmiId(EObject eObject, String id)
- {
- Resource xmiResource = eObject.eResource();
- if (xmiResource != null)
- {
- ((XMLResource)xmiResource).setID(eObject, id);
- }
- else
- {
- if (TRACER.isEnabled())
- {
- TRACER.trace("Could set xmi id, because object is not attached to a resource!"); //$NON-NLS-1$
- }
- }
- }
-
- // public static String resourceToString(Resource res)
- // {
- //
- // StringBuffer s = new StringBuffer();
- // Diagram dia = null;
- // for (Object o : res.getContents())
- // {
- // LOG.info(o);
- // if (o instanceof Diagram)
- // {
- // dia = (Diagram)o;
- // break;
- // }
- // }
- //
- // LOG.info("-----------------------------------------------------");
- //
- // LOG.info("Diagram" + dia + "");
- // if (dia != null)
- // {
- // try
- // {
- // for (Object o : dia.getChildren())
- // {
- // Node n = (Node)o;
- // EObject element = n.getElement();
- //
- // LOG.info(o + " (" + ResourceHelper.getXmiId((EObject)o) + ")");
- //
- // for (EAttribute attribute : element.eClass().getEAllAttributes())
- // {
- // LOG.info("\t" + attribute.getName() + ": " + element.eGet(attribute));
- // }
- //
- // LOG.info("- LayoutContraint: " + n.getLayoutConstraint() + "");
- // }
- //
- // EObject semanticConainer = dia.getElement();
- // LOG.info("SemanticConatiner" + semanticConainer + "");
- //
- // for (EObject k : semanticConainer.eContents())
- // {
- // LOG.info("Semantic Container Element: " + k + " (" + ResourceHelper.getXmiId(k) + ")" + "");
- // }
- // }
- // catch (Exception e)
- // {
- // e.printStackTrace();
- // }
- //
- // }
- // LOG.info("-----------------------------------------------------");
- // return s.toString();
- // }
-
- public static Resource loadFromFile(String file, ResourceSet rsSet)
- {
- URI uri = URI.createURI("file:/" + file);
-
- Resource res = rsSet.getResource(uri, true);
- return res;
- }
-
- public static void writeToFile(String path, String xml) throws IOException
- {
- File file = new File(path);
- FileWriter writer = new FileWriter(file);
- writer.write(xml);
- writer.close();
- }
-
- public static String saveToXML(XMLResource resource) throws IOException
- {
-
- resource.setXMLVersion("1.0");
-
- Map<Object, Object> saveOptions = new HashMap<Object, Object>();
- // options.put(XMLResource.OPTION_EXTENDED_META_DATA, Boolean.TRUE);
- // options.put(XMLResource.OPTION_SCHEMA_LOCATION, Boolean.TRUE);
- // options.put(XMLResource.OPTION_USE_ENCODED_ATTRIBUTE_STYLE, Boolean.TRUE);
- saveOptions.putAll(resource.getDefaultSaveOptions());
- saveOptions.put(XMIResource.OPTION_DECLARE_XML, Boolean.TRUE);
- saveOptions.put(XMIResource.OPTION_PROCESS_DANGLING_HREF, XMIResource.OPTION_PROCESS_DANGLING_HREF_DISCARD);
- saveOptions.put(XMIResource.OPTION_SCHEMA_LOCATION, Boolean.TRUE);
- saveOptions.put(XMIResource.OPTION_USE_XMI_TYPE, Boolean.TRUE);
- saveOptions.put(XMIResource.OPTION_SAVE_TYPE_INFORMATION, Boolean.TRUE);
- saveOptions.put(XMIResource.OPTION_SKIP_ESCAPE_URI, Boolean.FALSE);
- saveOptions.put(XMIResource.OPTION_ENCODING, "UTF-8");
-
- final XMLHelper xmlHelper = new XMIHelperImpl(resource);
-
- XMISaveImpl x = new XMISaveImpl(xmlHelper);
-
- StringWriter sw = new StringWriter();
- x.save(resource, sw, saveOptions);
- return sw.toString();
- }
-
- public static Resource loadFromXML(String xml, ResourceSet rsSet) throws IOException
- {
- final Resource res;
-
- res = new XMIResourceImpl();
- final XMLHelper xmlHelper = new XMLHelperImpl();
- ByteArrayInputStream stringreader = new ByteArrayInputStream(xml.getBytes());
- XMILoadImpl xmiload = new XMILoadImpl(xmlHelper);
- xmiload.load((XMLResource)res, stringreader, Collections.EMPTY_MAP);
-
- /* setdummy URI */
- if (res.getURI() == null)
- {
- res.setURI(URI.createURI(""));
- }
- return res;
- }
-
- /**
- * returns the diagram from the resource if no diagram can be found it returns null.
- *
- * @param res
- * @return if it exists the diagram otherwise null
- */
- public static Diagram getDiagramFromResource(Resource res)
- {
- for (Object o : res.getContents())
- {
- if (o instanceof Diagram)
- {
- return (Diagram)o;
- }
- }
- return null;
- }
-
- /**
- * compares two eObjects by there xmi-id whether the are equal or not
- *
- * @param oldNode
- * @param newNode
- * @return true if xmi-id equal, else otherwise
- */
- public static boolean areSameObjects(EObject oldNode, EObject newNode)
- {
- String newXMI = getXmiId(newNode);
- String oldXMI = getXmiId(oldNode);
-
- if (newXMI.equals(oldXMI))
- {
- return true;
- }
- return false;
- }
-
- /**
- * returns the same Object in the other resource. The Object is identified by the xmi ID
- *
- * @param e
- * @param resource
- * @return an object in the given resource with the same xmi Id
- */
- public static EObject getSameEObjectFromOtherResource(EObject e, XMLResource resource)
- {
- String xmiId = DawnResourceHelper.getXmiId(e);
- // EObject ret = resource.getIDToEObjectMap().get(xmiId);
- EObject ret = resource.getEObject(xmiId);
- return ret;
- }
-
- /**
- * finds changed objects
- *
- * @param serverO
- * @param clientO
- * @return true if the obejcts are different
- */
- public static boolean objectsHaveChanged(Object serverO, Object clientO)
- {
- if (serverO instanceof Node && clientO instanceof Node)
- {
- Node s = (Node)serverO;
- Node c = (Node)clientO;
-
- if (objectsHaveChanged(s.getLayoutConstraint(), c.getLayoutConstraint()))
- {
- return true;
- }
- if (objectsHaveChanged(s.getElement(), c.getElement()))
- {
- return true;
- }
-
- }
- else if (serverO instanceof Edge && clientO instanceof Edge) // compare edges
- {
- Edge s = (Edge)serverO;
- Edge c = (Edge)clientO;
- RelativeBendpoints sr = (RelativeBendpoints)s.getBendpoints();
- RelativeBendpoints cr = (RelativeBendpoints)c.getBendpoints();
- if (sr.getPoints().size() != cr.getPoints().size())
- {
- return true;
- }
- int i = 0;
- for (Object o : sr.getPoints())
- {
- RelativeBendpoint sb = (RelativeBendpoint)o;
- RelativeBendpoint cb = (RelativeBendpoint)cr.getPoints().get(i);
- if (objectsHaveChanged(sb, cb))
- {
- return true;
- }
- i++;
- }
- }
- else if (serverO instanceof RelativeBendpoint && clientO instanceof RelativeBendpoint)
- {
- RelativeBendpoint sb = (RelativeBendpoint)serverO;
- RelativeBendpoint cb = (RelativeBendpoint)clientO;
- if (sb.getSourceX() != cb.getSourceX())
- {
- return true;
- }
- if (sb.getSourceY() != cb.getSourceY())
- {
- return true;
- }
- if (sb.getTargetX() != cb.getTargetX())
- {
- return true;
- }
- if (sb.getTargetY() != cb.getTargetY())
- {
- return true;
- }
- }
- else if (serverO instanceof Bounds && clientO instanceof Bounds)
- {
- if (((Bounds)serverO).getX() != ((Bounds)clientO).getX())
- {
- return true;
- }
- if (((Bounds)serverO).getY() != ((Bounds)clientO).getY())
- {
- return true;
- }
- if (((Bounds)serverO).getWidth() != ((Bounds)clientO).getWidth())
- {
- return true;
- }
- if (((Bounds)serverO).getHeight() != ((Bounds)clientO).getHeight())
- {
- return true;
- }
- }
- else if (serverO instanceof EObject && clientO instanceof EObject)
- {
- EObject s = (EObject)serverO;
- EObject c = (EObject)clientO;
-
- for (EAttribute attribute : s.eClass().getEAllAttributes())
- {
- Object co = c.eGet(attribute);
- Object so = s.eGet(attribute);
- if (co == null || so == null)
- {
- return false;
- }
- if (!co.equals(so))
- {
- return true;
- }
- }
-
- // checking size of chidlren
- if (s.eContents().size() != c.eContents().size())
- {
- return true;
- }
- int i = 0;
- // chekcing every child
- for (EObject sChild : s.eContents())
- {
- EObject cChild = c.eContents().get(i);
- if (objectsHaveChanged(sChild, cChild))
- {
- return true;
- }
- i++;
- }
- }
- else
- {
- if (TRACER.isEnabled())
- {
- TRACER.format("classes are not identical...no match {0} / {1}", serverO, clientO); //$NON-NLS-1$
- }
- }
- return false;
- }
-
- public static Resource loadResourceFromFileString(String filePath, ResourceSet rsSet) throws IOException
- {
- try
- {
- File file = new File(filePath);
- FileReader reader = new FileReader(file);
- BufferedReader Ein = new BufferedReader(reader);
- String s;
- StringBuffer buff = new StringBuffer();
- while ((s = Ein.readLine()) != null) // Null-Referenz
- {
- buff.append(s + System.getProperty("line.separator"));
- }
- Ein.close();
- Resource resource = DawnResourceHelper.loadFromXML(buff.toString(), rsSet);
- return resource;
- }
- catch (FileNotFoundException e)
- {
- e.printStackTrace();
- }
- return null;
- }
-
- public static String readFromFile(String filePath) throws IOException
- {
- try
- {
- File file = new File(filePath);
- FileReader reader = new FileReader(file);
- BufferedReader Ein = new BufferedReader(reader);
- String s;
- StringBuffer buff = new StringBuffer();
- while ((s = Ein.readLine()) != null) // Null-Referenz
- {
- buff.append(s + System.getProperty("line.separator"));
- }
- Ein.close();
- return buff.toString();
-
- }
- catch (FileNotFoundException e)
- {
- e.printStackTrace();
- }
- return null;
- }
-
- /**
- * copies the XMI-id from oldElement to new Element
- *
- * @param newElement
- * @param oldElement
- */
- public static void copyXmiId(EObject oldElement, EObject newElement)
- {
- DawnResourceHelper.setXmiId(newElement, DawnResourceHelper.getXmiId(oldElement));
- }
-
- /**
- * sets the objects id in the old resource to the new resource
- *
- * @param v
- * @param oldResource
- */
- public static void setXmiId(EObject v, XMLResource oldResource)
- {
- DawnResourceHelper.setXmiId(v, getXmiId(v, oldResource));
- }
-
- /**
- * creates a deep Copy and also copies xmi ids This method can be used if the copy should be insertet into newParent
- *
- * @param oldObject
- * @param newParent
- * @return the copy of the oldObject
- */
- @SuppressWarnings("unchecked")
- public static EObject createCopyAndInsert(EObject oldObject, EObject newParent)
- {
- EObject ret = EcoreUtil.copy(oldObject);
-
- EStructuralFeature containingFeature = oldObject.eContainingFeature();
-
- Object get = newParent.eGet(containingFeature);
- if (get instanceof Collection<?>)
- {
- Collection<EObject> list = (Collection<EObject>)get;
- list.add(ret);
- }
- else
- {
- newParent.eSet(containingFeature, ret);
- }
-
- setXmiIdForChildren(oldObject, ret);
-
- return ret;
- }
-
- public static EObject createCopy(EObject v)
- {
- EObject ret = EcoreUtil.copy(v);
- return ret;
- }
-
- private static int setXmiIdForChildren(EObject oldChild, EObject newChild)
- {
- DawnResourceHelper.setXmiId(newChild, DawnResourceHelper.getXmiId(oldChild));
- int i = 0;
- for (EObject oldC : oldChild.eContents())
- {
- EObject newC = newChild.eContents().get(i);
- setXmiIdForChildren(oldC, newC);
- i++;
- }
- return i;
- }
-
- /**
- * This method provides deep copying of all childrens xmi ids from oldObject to newObject
- *
- * @param oldObject
- * @param newObject
- */
- public static void copyXmiIds(EObject oldObject, EObject newObject)
- {
- setXmiIdForChildren(oldObject, newObject);
- }
-
- /**
- * this Method copies the values from one Element to the other curretnly only for attributes and not for references
- */
- @Deprecated
- public static void updateElement(EObject oldElement, EObject newElement)
- {
- if (oldElement == null)
- {
- newElement = oldElement;
- return;
- }
-
- for (EAttribute attribute : oldElement.eClass().getEAllAttributes())
- {
- newElement.eSet(attribute, oldElement.eGet(attribute));
- }
- }
-
- /**
- * @param leftObject
- * @param rightObject
- * @throws EClassIncompatibleException
- */
- // TODO delte removed references
- public static void updateEObject(EObject leftObject, EObject rightObject) throws EClassIncompatibleException
- {
- if (rightObject == null) // remove left Object
- {
- removeEObjectFromParent(leftObject);
- return;
- }
-
- if (!leftObject.eClass().equals(rightObject.eClass()))
- {
- throw new EClassIncompatibleException(leftObject.eClass().getName() + "("
- + DawnResourceHelper.getXmiId(leftObject) + ")" + "/" + rightObject.eClass().getName() + "("
- + DawnResourceHelper.getXmiId(leftObject) + ")");
- }
-
- updateEAttributes(leftObject, rightObject);
- updateEReferences(leftObject, rightObject);
-
- for (Object o : rightObject.eContents())
- {
- EObject rightChild = (EObject)o;
- EObject leftChild = getSameEObjectFromOtherResource(rightChild, (XMLResource)leftObject.eResource());
- if (leftChild != null)// child exists
- {
- updateEObject(leftChild, rightChild); // removes it
- }
- else
- // child must be created
- {
- if (o instanceof View)
- {
- View childView = (View)o;
- EObject childViewElement = childView.getElement();
- View childViewCopy = (View)createCopyAndInsert(rightChild, leftObject);
- if (childViewElement != null)
- {
- EObject childElementCopy = getSameEObjectFromOtherResource(childViewElement,
- (XMLResource)leftObject.eResource());
-
- updateEObject(childElementCopy, childViewElement);// not shure whether this is needed here
- childViewCopy.setElement(childElementCopy);
- }
-
- updateEObject(childViewCopy, childView);// not shure whether this is needed here
- }
- else
- {
- EObject childCopy = createCopyAndInsert(rightChild, leftObject);
- updateEObject(childCopy, rightChild); // not shure whether this is needed here
- }
- }
- }
-
- ArrayList<EObject> tempDeletionList = new ArrayList<EObject>();
-
- for (Object leftChild : leftObject.eContents())
- {
- tempDeletionList.add((EObject)leftChild);
- }
-
- // here delete all which are not in the right object
- for (EObject leftChild : tempDeletionList)
- {
- EObject rightChild = getSameEObjectFromOtherResource(leftChild, (XMLResource)rightObject.eResource());
- updateEObject(leftChild, rightChild);
- }
- }
-
- private static void removeEObjectFromParent(EObject leftObject)
- {
- if (leftObject instanceof View)
- {
- View view = (View)leftObject;
- if (view.getElement() != null)
- {
- removeEObjectFromParent(view.getElement());
- }
- }
-
- EObject parent = leftObject.eContainer();
- EStructuralFeature containingFeature = leftObject.eContainingFeature();
- if (parent != null)
- {
- Object container = parent.eGet(containingFeature);
-
- if (container instanceof Collection<?>)
- {
- Collection<?> collection = (Collection<?>)container;
- collection.remove(leftObject);
- }
- else
- {
- parent.eSet(containingFeature, null);
- }
- }
- else
- {
- if (TRACER.isEnabled())
- {
- TRACER.format("arent is null, object ist still removed from parent : {0} ", leftObject); //$NON-NLS-1$
- }
- }
- }
-
- private static void updateEReferences(EObject leftObject, EObject rightObject) throws EClassIncompatibleException
- {
- for (EReference reference : rightObject.eClass().getEReferences())
- {
- updateReference(leftObject, rightObject, reference);
- }
- }
-
- @SuppressWarnings("unchecked")
- public static void updateReference(EObject leftParent, EObject rightParent, EReference reference)
- throws EClassIncompatibleException
- {
-
- if (reference.getName().equals("element"))
- {
- return;
- }
- Object leftReferenceObject = leftParent.eGet(reference);
- Object rightReferenceObject = rightParent.eGet(reference);
-
- if (leftReferenceObject != null)
- {
-
- if (leftReferenceObject instanceof Collection<?>)
- {
- Collection<EObject> leftCollection = (Collection<EObject>)leftReferenceObject;
- Collection<?> rightCollection = (Collection<?>)rightReferenceObject;
- for (Object o : rightCollection)
- {
- EObject rightCollectionChild = (EObject)o;
- EObject leftCollectionChild = getSameEObjectFromOtherResource(rightCollectionChild,
- (XMLResource)leftParent.eResource());
-
- if (leftCollectionChild == null)// create
- {
- leftCollectionChild = DawnResourceHelper.createCopy(rightCollectionChild);
- leftCollection.add(leftCollectionChild);
- }
- else
- {
- if (!rightCollectionChild.eResource().equals(leftParent.eResource())) // reference to another resource
- {
- leftCollection.remove(rightCollectionChild);
- leftCollection.add(leftCollectionChild);
- }
-
- updateEObject(leftCollectionChild, rightCollectionChild);
- }
- }
- }
- else
- {
- updateEObject((EObject)leftParent.eGet(reference), (EObject)rightParent.eGet(reference));
- }
- }
- else
- // create
- {
- if (rightReferenceObject != null)
- {
- leftParent.eSet(reference, EcoreUtil.copy((EObject)rightReferenceObject));
- }
- }
- }
-
- private static void updateEAttributes(EObject leftObject, EObject rightObject)
- {
- for (EAttribute attribute : rightObject.eClass().getEAllAttributes())
- {
- leftObject.eSet(attribute, rightObject.eGet(attribute));
- }
- }
-
- /**
- * @since 1.0
- */
- public static void deleteViewInResource(Resource resource, EObject e)
- {
- Diagram diagram = DawnResourceHelper.getDiagramFromResource(resource);
- EObject element = ((View)e).getElement();
-
- if (element != null)
- {
- removeElementFromContainer(element);
- }
-
- if (e instanceof Node)
- {
- View node = (View)e;
- diagram.removeChild(node);// ..getChildren().add(v);
- @SuppressWarnings("unchecked")
- List<Edge> toBeDeleted = new ArrayList<Edge>(node.getSourceEdges());
- for (Object obj : toBeDeleted)
- {
- Edge edge = (Edge)obj;
- deleteViewInResource(resource, edge);
- }
- }
- else if (e instanceof Edge)
- {
- Edge edge = (Edge)e;
- diagram.removeEdge(edge);// ..getChildren().add(v);
- edge.setSource(null);
- edge.setTarget(null);
- }
- }
-
- private static void removeElementFromContainer(EObject element)
- {
- EStructuralFeature containingFeature = element.eContainingFeature();
- EObject container = element.eContainer();
- if (container != null)
- {
- Object get = container.eGet(containingFeature);
- if (get instanceof Collection<?>)
- {
- Collection<?> list = (Collection<?>)get;
- list.remove(element);
- }
- else
- {
- container.eSet(containingFeature, null);
- }
- }
- }
-
- @SuppressWarnings("unchecked")
- public static void addElementToContainer(EObject element, EObject container, EStructuralFeature containingFeature)
- {
- // EStructuralFeature containingFeature = element.eContainingFeature();
- Object get = container.eGet(containingFeature);
- if (get instanceof Collection<?>)
- {
- Collection<EObject> list = (Collection<EObject>)get;
- list.add(element);
- }
- else
- {
- container.eSet(containingFeature, element);
- }
- }
-
- /**
- * checks if an element with element's id exists in the give resource
- *
- * @param res
- * @param element
- * @return true is the object with the same xmi id as element is contained in the given resource
- */
- public static boolean isObjectInResource(Resource res, EObject element)
- {
- EObject object = res.getEObject(DawnResourceHelper.getXmiId(element));
- if (object == null)
- {
- return false;
- }
-
- return true;
- }
-
- public static void printResource(Resource r)
- {
- for (EObject o : r.getContents())
- {
- printEObjectFull(o, 0);
- }
- }
-
- public static void printEObject(EObject o, int level)
- {
- for (Object child : o.eContents())
- {
- printEObject((EObject)child, level + 1);
- }
- }
-
- public static void printEObjectFull(EObject o, int level)
- {
- print(tabs(level) + "--------------------------------------------");
- print(tabs(level) + "Object: " + o);
- print(tabs(level) + "o.eContainer: " + o.eContainer());
- print(tabs(level) + "o.eContainingFeature: " + o.eContainingFeature());
- print(tabs(level) + "o.eContainmentFeature: " + o.eContainmentFeature());
- print(tabs(level) + "o.eIsProxy: " + o.eIsProxy());
- print(tabs(level) + "o.eResource: " + o.eResource());
- print(tabs(level) + "o.getClass: " + o.getClass());
- print(tabs(level) + "o.eClass: " + o.eClass());
- print(tabs(level) + "o.eCrossReferences: " + o.eCrossReferences());
-
- print(tabs(level) + "o.eClass.getClassifierID: " + o.eClass().getClassifierID());
- print(tabs(level) + "o.eClass.getFeatureCount: " + o.eClass().getFeatureCount());
- print(tabs(level) + "o.eClass.getInstanceClassName: " + o.eClass().getInstanceClassName());
- print(tabs(level) + "o.eClass.getInstanceTypeName: " + o.eClass().getInstanceTypeName());
- print(tabs(level) + "o.eClass.getName: " + o.eClass().getName());
- print(tabs(level) + "o.eClass.getDefaultValue: " + o.eClass().getDefaultValue());
- print(tabs(level) + "o.eClass.getEPackage: " + o.eClass().getEPackage());
- print(tabs(level) + "o.eClass.getEIDAttribute: " + o.eClass().getEIDAttribute());
- print(tabs(level) + "o.eClass.getInstanceClass: " + o.eClass().getInstanceClass());
-
- for (EAttribute attribute : o.eClass().getEAllAttributes())
- {
- print(tabs(level + 1) + "o.eClass.getEAllAttributes.attribute: '" + attribute.getName() + "': "
- + o.eGet(attribute));
- }
- for (EAnnotation annotation : o.eClass().getEAnnotations())
- {
- print(tabs(level + 1) + "o.eClass().getEAnnotations().annotation: '" + annotation);
- }
- for (EReference containment : o.eClass().getEAllContainments())
- {
- print(tabs(level + 1) + "o.eClass().getEAllContainments().containment: '" + containment);
- }
- for (EGenericType genericSupertype : o.eClass().getEAllGenericSuperTypes())
- {
- print(tabs(level + 1) + "o.eClass().getEAllGenericSuperTypes().genericSupertype: '" + genericSupertype);
- }
- for (EOperation operation : o.eClass().getEAllOperations())
- {
- print(tabs(level + 1) + "o.eClass().getEAllOperations().operation: '" + operation);
- }
-
- for (EReference reference : o.eClass().getEAllReferences())
- {
- print(tabs(level + 1) + "o.eClass().getEAllReferences().reference: '" + reference);
- }
- for (EClass supertype : o.eClass().getEAllSuperTypes())
- {
- print(tabs(level + 1) + "o.eClass().getEAllSuperTypes().supertype: '" + supertype);
- }
- for (EStructuralFeature structuralFeature : o.eClass().getEAllStructuralFeatures())
- {
- print(tabs(level + 1) + "o.eClass().getEAllStructuralFeatures().structuralFeature: '" + structuralFeature);
- }
- for (EAnnotation annotation : o.eClass().getEAnnotations())
- {
- print(tabs(level + 1) + "o.eClass().getEAnnotations().annotation: '" + annotation);
- }
- for (EAttribute attribute : o.eClass().getEAttributes())
- {
- print(tabs(level + 1) + "o.eClass().getEAttributes().annotation: '" + attribute);
- }
- for (Adapter adapter : o.eClass().eAdapters())
- {
- print(tabs(level + 1) + "o.eClass().eAdapters().adapter: '" + adapter);
- }
-
- for (Object child : o.eContents())
- {
- printEObjectFull((EObject)child, level + 2);
- }
- }
-
- private static String tabs(int level)
- {
- String s = "";
- for (int i = 0; i < level; i++)
- {
- s += "\t";
- }
- return s;
- }
-
- public static String getLocationFromResource(Resource r) throws MalformedURLException, IOException
- {
- return FileLocator.resolve(new URL(r.getURI().toString())).toString().replace("file:", "");
- }
-
- /**********************
- * finds EditPart from a View
- *
- * @param view
- * @param dawnDiagramEditor
- * @return find an Editpart for a view with the same xmi id
- ***************************************************************************************************/
- @Deprecated
- public static EditPart findEditPartByXMIId(View view, DiagramDocumentEditor dawnDiagramEditor)
- {
- DiagramEditPart diagramEditPart = dawnDiagramEditor.getDiagramEditPart();
-
- for (Object e : diagramEditPart.getChildren())
- {
- EditPart ep = (EditPart)e;
- if (DawnResourceHelper.getXmiId((EObject)ep.getModel()).equals(DawnResourceHelper.getXmiId(view)))
- {
- return ep;
- }
- }
-
- for (Object e : diagramEditPart.getConnections())
- {
- EditPart ep = (EditPart)e;
- if (DawnResourceHelper.getXmiId((EObject)ep.getModel()).equals(DawnResourceHelper.getXmiId(view)))
- {
- return ep;
- }
- }
- return null;
- }
-
- protected static void print(String s)
- {
- if (TRACER.isEnabled())
- {
- TRACER.trace(s);
- }
- }
-}
+/*
+ * 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.gmf.util;
+
+/**
+ *
+ * @author Martin Fluegge
+ */
+
+//import org.eclipse.emf.cdo.internal.dawn.bundle.OM;
+
+import org.eclipse.emf.cdo.dawn.internal.util.bundle.OM;
+import org.eclipse.emf.cdo.dawn.util.exceptions.EClassIncompatibleException;
+
+import org.eclipse.net4j.util.om.trace.ContextTracer;
+
+import org.eclipse.emf.common.notify.Adapter;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.EAnnotation;
+import org.eclipse.emf.ecore.EAttribute;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EGenericType;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EOperation;
+import org.eclipse.emf.ecore.EReference;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecore.resource.ResourceSet;
+import org.eclipse.emf.ecore.util.EcoreUtil;
+import org.eclipse.emf.ecore.xmi.XMIResource;
+import org.eclipse.emf.ecore.xmi.XMLHelper;
+import org.eclipse.emf.ecore.xmi.XMLResource;
+import org.eclipse.emf.ecore.xmi.impl.XMIHelperImpl;
+import org.eclipse.emf.ecore.xmi.impl.XMILoadImpl;
+import org.eclipse.emf.ecore.xmi.impl.XMIResourceImpl;
+import org.eclipse.emf.ecore.xmi.impl.XMISaveImpl;
+import org.eclipse.emf.ecore.xmi.impl.XMLHelperImpl;
+
+import org.eclipse.core.runtime.FileLocator;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramEditPart;
+import org.eclipse.gmf.runtime.diagram.ui.resources.editor.parts.DiagramDocumentEditor;
+import org.eclipse.gmf.runtime.notation.Bounds;
+import org.eclipse.gmf.runtime.notation.Diagram;
+import org.eclipse.gmf.runtime.notation.Edge;
+import org.eclipse.gmf.runtime.notation.Node;
+import org.eclipse.gmf.runtime.notation.RelativeBendpoints;
+import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.gmf.runtime.notation.datatype.RelativeBendpoint;
+
+import java.io.BufferedReader;
+import java.io.ByteArrayInputStream;
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileReader;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.StringWriter;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @since 1.0
+ */
+public class DawnResourceHelper
+{
+ private static final ContextTracer TRACER = new ContextTracer(OM.DEBUG, DawnResourceHelper.class);
+
+ public static String getXmiId(EObject eObject)
+ {
+ Resource xmiResource = eObject.eResource();
+ if (xmiResource == null)
+ {
+ return null;
+ }
+
+ return ((XMLResource)xmiResource).getID(eObject);
+ }
+
+ public static String getXmiId(EObject eObject, Resource xmiResource)
+ {
+ if (xmiResource == null)
+ {
+ return null;
+ }
+
+ return ((XMLResource)xmiResource).getID(eObject);
+ }
+
+ public static void setXmiId(EObject eObject, String id)
+ {
+ Resource xmiResource = eObject.eResource();
+ if (xmiResource != null)
+ {
+ ((XMLResource)xmiResource).setID(eObject, id);
+ }
+ else
+ {
+ if (TRACER.isEnabled())
+ {
+ TRACER.trace("Could set xmi id, because object is not attached to a resource!"); //$NON-NLS-1$
+ }
+ }
+ }
+
+ // public static String resourceToString(Resource res)
+ // {
+ //
+ // StringBuffer s = new StringBuffer();
+ // Diagram dia = null;
+ // for (Object o : res.getContents())
+ // {
+ // LOG.info(o);
+ // if (o instanceof Diagram)
+ // {
+ // dia = (Diagram)o;
+ // break;
+ // }
+ // }
+ //
+ // LOG.info("-----------------------------------------------------");
+ //
+ // LOG.info("Diagram" + dia + "");
+ // if (dia != null)
+ // {
+ // try
+ // {
+ // for (Object o : dia.getChildren())
+ // {
+ // Node n = (Node)o;
+ // EObject element = n.getElement();
+ //
+ // LOG.info(o + " (" + ResourceHelper.getXmiId((EObject)o) + ")");
+ //
+ // for (EAttribute attribute : element.eClass().getEAllAttributes())
+ // {
+ // LOG.info("\t" + attribute.getName() + ": " + element.eGet(attribute));
+ // }
+ //
+ // LOG.info("- LayoutContraint: " + n.getLayoutConstraint() + "");
+ // }
+ //
+ // EObject semanticConainer = dia.getElement();
+ // LOG.info("SemanticConatiner" + semanticConainer + "");
+ //
+ // for (EObject k : semanticConainer.eContents())
+ // {
+ // LOG.info("Semantic Container Element: " + k + " (" + ResourceHelper.getXmiId(k) + ")" + "");
+ // }
+ // }
+ // catch (Exception e)
+ // {
+ // e.printStackTrace();
+ // }
+ //
+ // }
+ // LOG.info("-----------------------------------------------------");
+ // return s.toString();
+ // }
+
+ public static Resource loadFromFile(String file, ResourceSet rsSet)
+ {
+ URI uri = URI.createURI("file:/" + file);
+
+ Resource res = rsSet.getResource(uri, true);
+ return res;
+ }
+
+ public static void writeToFile(String path, String xml) throws IOException
+ {
+ File file = new File(path);
+ FileWriter writer = new FileWriter(file);
+ writer.write(xml);
+ writer.close();
+ }
+
+ public static String saveToXML(XMLResource resource) throws IOException
+ {
+
+ resource.setXMLVersion("1.0");
+
+ Map<Object, Object> saveOptions = new HashMap<Object, Object>();
+ // options.put(XMLResource.OPTION_EXTENDED_META_DATA, Boolean.TRUE);
+ // options.put(XMLResource.OPTION_SCHEMA_LOCATION, Boolean.TRUE);
+ // options.put(XMLResource.OPTION_USE_ENCODED_ATTRIBUTE_STYLE, Boolean.TRUE);
+ saveOptions.putAll(resource.getDefaultSaveOptions());
+ saveOptions.put(XMIResource.OPTION_DECLARE_XML, Boolean.TRUE);
+ saveOptions.put(XMIResource.OPTION_PROCESS_DANGLING_HREF, XMIResource.OPTION_PROCESS_DANGLING_HREF_DISCARD);
+ saveOptions.put(XMIResource.OPTION_SCHEMA_LOCATION, Boolean.TRUE);
+ saveOptions.put(XMIResource.OPTION_USE_XMI_TYPE, Boolean.TRUE);
+ saveOptions.put(XMIResource.OPTION_SAVE_TYPE_INFORMATION, Boolean.TRUE);
+ saveOptions.put(XMIResource.OPTION_SKIP_ESCAPE_URI, Boolean.FALSE);
+ saveOptions.put(XMIResource.OPTION_ENCODING, "UTF-8");
+
+ final XMLHelper xmlHelper = new XMIHelperImpl(resource);
+
+ XMISaveImpl x = new XMISaveImpl(xmlHelper);
+
+ StringWriter sw = new StringWriter();
+ x.save(resource, sw, saveOptions);
+ return sw.toString();
+ }
+
+ public static Resource loadFromXML(String xml, ResourceSet rsSet) throws IOException
+ {
+ final Resource res;
+
+ res = new XMIResourceImpl();
+ final XMLHelper xmlHelper = new XMLHelperImpl();
+ ByteArrayInputStream stringreader = new ByteArrayInputStream(xml.getBytes());
+ XMILoadImpl xmiload = new XMILoadImpl(xmlHelper);
+ xmiload.load((XMLResource)res, stringreader, Collections.EMPTY_MAP);
+
+ /* setdummy URI */
+ if (res.getURI() == null)
+ {
+ res.setURI(URI.createURI(""));
+ }
+ return res;
+ }
+
+ /**
+ * returns the diagram from the resource if no diagram can be found it returns null.
+ *
+ * @param res
+ * @return if it exists the diagram otherwise null
+ */
+ public static Diagram getDiagramFromResource(Resource res)
+ {
+ for (Object o : res.getContents())
+ {
+ if (o instanceof Diagram)
+ {
+ return (Diagram)o;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * compares two eObjects by there xmi-id whether the are equal or not
+ *
+ * @param oldNode
+ * @param newNode
+ * @return true if xmi-id equal, else otherwise
+ */
+ public static boolean areSameObjects(EObject oldNode, EObject newNode)
+ {
+ String newXMI = getXmiId(newNode);
+ String oldXMI = getXmiId(oldNode);
+
+ if (newXMI.equals(oldXMI))
+ {
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * returns the same Object in the other resource. The Object is identified by the xmi ID
+ *
+ * @param e
+ * @param resource
+ * @return an object in the given resource with the same xmi Id
+ */
+ public static EObject getSameEObjectFromOtherResource(EObject e, XMLResource resource)
+ {
+ String xmiId = DawnResourceHelper.getXmiId(e);
+ // EObject ret = resource.getIDToEObjectMap().get(xmiId);
+ EObject ret = resource.getEObject(xmiId);
+ return ret;
+ }
+
+ /**
+ * finds changed objects
+ *
+ * @param serverO
+ * @param clientO
+ * @return true if the obejcts are different
+ */
+ public static boolean objectsHaveChanged(Object serverO, Object clientO)
+ {
+ if (serverO instanceof Node && clientO instanceof Node)
+ {
+ Node s = (Node)serverO;
+ Node c = (Node)clientO;
+
+ if (objectsHaveChanged(s.getLayoutConstraint(), c.getLayoutConstraint()))
+ {
+ return true;
+ }
+ if (objectsHaveChanged(s.getElement(), c.getElement()))
+ {
+ return true;
+ }
+
+ }
+ else if (serverO instanceof Edge && clientO instanceof Edge) // compare edges
+ {
+ Edge s = (Edge)serverO;
+ Edge c = (Edge)clientO;
+ RelativeBendpoints sr = (RelativeBendpoints)s.getBendpoints();
+ RelativeBendpoints cr = (RelativeBendpoints)c.getBendpoints();
+ if (sr.getPoints().size() != cr.getPoints().size())
+ {
+ return true;
+ }
+ int i = 0;
+ for (Object o : sr.getPoints())
+ {
+ RelativeBendpoint sb = (RelativeBendpoint)o;
+ RelativeBendpoint cb = (RelativeBendpoint)cr.getPoints().get(i);
+ if (objectsHaveChanged(sb, cb))
+ {
+ return true;
+ }
+ i++;
+ }
+ }
+ else if (serverO instanceof RelativeBendpoint && clientO instanceof RelativeBendpoint)
+ {
+ RelativeBendpoint sb = (RelativeBendpoint)serverO;
+ RelativeBendpoint cb = (RelativeBendpoint)clientO;
+ if (sb.getSourceX() != cb.getSourceX())
+ {
+ return true;
+ }
+ if (sb.getSourceY() != cb.getSourceY())
+ {
+ return true;
+ }
+ if (sb.getTargetX() != cb.getTargetX())
+ {
+ return true;
+ }
+ if (sb.getTargetY() != cb.getTargetY())
+ {
+ return true;
+ }
+ }
+ else if (serverO instanceof Bounds && clientO instanceof Bounds)
+ {
+ if (((Bounds)serverO).getX() != ((Bounds)clientO).getX())
+ {
+ return true;
+ }
+ if (((Bounds)serverO).getY() != ((Bounds)clientO).getY())
+ {
+ return true;
+ }
+ if (((Bounds)serverO).getWidth() != ((Bounds)clientO).getWidth())
+ {
+ return true;
+ }
+ if (((Bounds)serverO).getHeight() != ((Bounds)clientO).getHeight())
+ {
+ return true;
+ }
+ }
+ else if (serverO instanceof EObject && clientO instanceof EObject)
+ {
+ EObject s = (EObject)serverO;
+ EObject c = (EObject)clientO;
+
+ for (EAttribute attribute : s.eClass().getEAllAttributes())
+ {
+ Object co = c.eGet(attribute);
+ Object so = s.eGet(attribute);
+ if (co == null || so == null)
+ {
+ return false;
+ }
+ if (!co.equals(so))
+ {
+ return true;
+ }
+ }
+
+ // checking size of chidlren
+ if (s.eContents().size() != c.eContents().size())
+ {
+ return true;
+ }
+ int i = 0;
+ // chekcing every child
+ for (EObject sChild : s.eContents())
+ {
+ EObject cChild = c.eContents().get(i);
+ if (objectsHaveChanged(sChild, cChild))
+ {
+ return true;
+ }
+ i++;
+ }
+ }
+ else
+ {
+ if (TRACER.isEnabled())
+ {
+ TRACER.format("classes are not identical...no match {0} / {1}", serverO, clientO); //$NON-NLS-1$
+ }
+ }
+ return false;
+ }
+
+ public static Resource loadResourceFromFileString(String filePath, ResourceSet rsSet) throws IOException
+ {
+ try
+ {
+ File file = new File(filePath);
+ FileReader reader = new FileReader(file);
+ BufferedReader Ein = new BufferedReader(reader);
+ String s;
+ StringBuffer buff = new StringBuffer();
+ while ((s = Ein.readLine()) != null) // Null-Referenz
+ {
+ buff.append(s + System.getProperty("line.separator"));
+ }
+ Ein.close();
+ Resource resource = DawnResourceHelper.loadFromXML(buff.toString(), rsSet);
+ return resource;
+ }
+ catch (FileNotFoundException e)
+ {
+ e.printStackTrace();
+ }
+ return null;
+ }
+
+ public static String readFromFile(String filePath) throws IOException
+ {
+ try
+ {
+ File file = new File(filePath);
+ FileReader reader = new FileReader(file);
+ BufferedReader Ein = new BufferedReader(reader);
+ String s;
+ StringBuffer buff = new StringBuffer();
+ while ((s = Ein.readLine()) != null) // Null-Referenz
+ {
+ buff.append(s + System.getProperty("line.separator"));
+ }
+ Ein.close();
+ return buff.toString();
+
+ }
+ catch (FileNotFoundException e)
+ {
+ e.printStackTrace();
+ }
+ return null;
+ }
+
+ /**
+ * copies the XMI-id from oldElement to new Element
+ *
+ * @param newElement
+ * @param oldElement
+ */
+ public static void copyXmiId(EObject oldElement, EObject newElement)
+ {
+ DawnResourceHelper.setXmiId(newElement, DawnResourceHelper.getXmiId(oldElement));
+ }
+
+ /**
+ * sets the objects id in the old resource to the new resource
+ *
+ * @param v
+ * @param oldResource
+ */
+ public static void setXmiId(EObject v, XMLResource oldResource)
+ {
+ DawnResourceHelper.setXmiId(v, getXmiId(v, oldResource));
+ }
+
+ /**
+ * creates a deep Copy and also copies xmi ids This method can be used if the copy should be insertet into newParent
+ *
+ * @param oldObject
+ * @param newParent
+ * @return the copy of the oldObject
+ */
+ @SuppressWarnings("unchecked")
+ public static EObject createCopyAndInsert(EObject oldObject, EObject newParent)
+ {
+ EObject ret = EcoreUtil.copy(oldObject);
+
+ EStructuralFeature containingFeature = oldObject.eContainingFeature();
+
+ Object get = newParent.eGet(containingFeature);
+ if (get instanceof Collection<?>)
+ {
+ Collection<EObject> list = (Collection<EObject>)get;
+ list.add(ret);
+ }
+ else
+ {
+ newParent.eSet(containingFeature, ret);
+ }
+
+ setXmiIdForChildren(oldObject, ret);
+
+ return ret;
+ }
+
+ public static EObject createCopy(EObject v)
+ {
+ EObject ret = EcoreUtil.copy(v);
+ return ret;
+ }
+
+ private static int setXmiIdForChildren(EObject oldChild, EObject newChild)
+ {
+ DawnResourceHelper.setXmiId(newChild, DawnResourceHelper.getXmiId(oldChild));
+ int i = 0;
+ for (EObject oldC : oldChild.eContents())
+ {
+ EObject newC = newChild.eContents().get(i);
+ setXmiIdForChildren(oldC, newC);
+ i++;
+ }
+ return i;
+ }
+
+ /**
+ * This method provides deep copying of all childrens xmi ids from oldObject to newObject
+ *
+ * @param oldObject
+ * @param newObject
+ */
+ public static void copyXmiIds(EObject oldObject, EObject newObject)
+ {
+ setXmiIdForChildren(oldObject, newObject);
+ }
+
+ /**
+ * this Method copies the values from one Element to the other curretnly only for attributes and not for references
+ */
+ @Deprecated
+ public static void updateElement(EObject oldElement, EObject newElement)
+ {
+ if (oldElement == null)
+ {
+ newElement = oldElement;
+ return;
+ }
+
+ for (EAttribute attribute : oldElement.eClass().getEAllAttributes())
+ {
+ newElement.eSet(attribute, oldElement.eGet(attribute));
+ }
+ }
+
+ /**
+ * @param leftObject
+ * @param rightObject
+ * @throws EClassIncompatibleException
+ */
+ // TODO delte removed references
+ public static void updateEObject(EObject leftObject, EObject rightObject) throws EClassIncompatibleException
+ {
+ if (rightObject == null) // remove left Object
+ {
+ removeEObjectFromParent(leftObject);
+ return;
+ }
+
+ if (!leftObject.eClass().equals(rightObject.eClass()))
+ {
+ throw new EClassIncompatibleException(leftObject.eClass().getName() + "("
+ + DawnResourceHelper.getXmiId(leftObject) + ")" + "/" + rightObject.eClass().getName() + "("
+ + DawnResourceHelper.getXmiId(leftObject) + ")");
+ }
+
+ updateEAttributes(leftObject, rightObject);
+ updateEReferences(leftObject, rightObject);
+
+ for (Object o : rightObject.eContents())
+ {
+ EObject rightChild = (EObject)o;
+ EObject leftChild = getSameEObjectFromOtherResource(rightChild, (XMLResource)leftObject.eResource());
+ if (leftChild != null)// child exists
+ {
+ updateEObject(leftChild, rightChild); // removes it
+ }
+ else
+ // child must be created
+ {
+ if (o instanceof View)
+ {
+ View childView = (View)o;
+ EObject childViewElement = childView.getElement();
+ View childViewCopy = (View)createCopyAndInsert(rightChild, leftObject);
+ if (childViewElement != null)
+ {
+ EObject childElementCopy = getSameEObjectFromOtherResource(childViewElement,
+ (XMLResource)leftObject.eResource());
+
+ updateEObject(childElementCopy, childViewElement);// not shure whether this is needed here
+ childViewCopy.setElement(childElementCopy);
+ }
+
+ updateEObject(childViewCopy, childView);// not shure whether this is needed here
+ }
+ else
+ {
+ EObject childCopy = createCopyAndInsert(rightChild, leftObject);
+ updateEObject(childCopy, rightChild); // not shure whether this is needed here
+ }
+ }
+ }
+
+ ArrayList<EObject> tempDeletionList = new ArrayList<EObject>();
+
+ for (Object leftChild : leftObject.eContents())
+ {
+ tempDeletionList.add((EObject)leftChild);
+ }
+
+ // here delete all which are not in the right object
+ for (EObject leftChild : tempDeletionList)
+ {
+ EObject rightChild = getSameEObjectFromOtherResource(leftChild, (XMLResource)rightObject.eResource());
+ updateEObject(leftChild, rightChild);
+ }
+ }
+
+ private static void removeEObjectFromParent(EObject leftObject)
+ {
+ if (leftObject instanceof View)
+ {
+ View view = (View)leftObject;
+ if (view.getElement() != null)
+ {
+ removeEObjectFromParent(view.getElement());
+ }
+ }
+
+ EObject parent = leftObject.eContainer();
+ EStructuralFeature containingFeature = leftObject.eContainingFeature();
+ if (parent != null)
+ {
+ Object container = parent.eGet(containingFeature);
+
+ if (container instanceof Collection<?>)
+ {
+ Collection<?> collection = (Collection<?>)container;
+ collection.remove(leftObject);
+ }
+ else
+ {
+ parent.eSet(containingFeature, null);
+ }
+ }
+ else
+ {
+ if (TRACER.isEnabled())
+ {
+ TRACER.format("arent is null, object ist still removed from parent : {0} ", leftObject); //$NON-NLS-1$
+ }
+ }
+ }
+
+ private static void updateEReferences(EObject leftObject, EObject rightObject) throws EClassIncompatibleException
+ {
+ for (EReference reference : rightObject.eClass().getEReferences())
+ {
+ updateReference(leftObject, rightObject, reference);
+ }
+ }
+
+ @SuppressWarnings("unchecked")
+ public static void updateReference(EObject leftParent, EObject rightParent, EReference reference)
+ throws EClassIncompatibleException
+ {
+
+ if (reference.getName().equals("element"))
+ {
+ return;
+ }
+ Object leftReferenceObject = leftParent.eGet(reference);
+ Object rightReferenceObject = rightParent.eGet(reference);
+
+ if (leftReferenceObject != null)
+ {
+
+ if (leftReferenceObject instanceof Collection<?>)
+ {
+ Collection<EObject> leftCollection = (Collection<EObject>)leftReferenceObject;
+ Collection<?> rightCollection = (Collection<?>)rightReferenceObject;
+ for (Object o : rightCollection)
+ {
+ EObject rightCollectionChild = (EObject)o;
+ EObject leftCollectionChild = getSameEObjectFromOtherResource(rightCollectionChild,
+ (XMLResource)leftParent.eResource());
+
+ if (leftCollectionChild == null)// create
+ {
+ leftCollectionChild = DawnResourceHelper.createCopy(rightCollectionChild);
+ leftCollection.add(leftCollectionChild);
+ }
+ else
+ {
+ if (!rightCollectionChild.eResource().equals(leftParent.eResource())) // reference to another resource
+ {
+ leftCollection.remove(rightCollectionChild);
+ leftCollection.add(leftCollectionChild);
+ }
+
+ updateEObject(leftCollectionChild, rightCollectionChild);
+ }
+ }
+ }
+ else
+ {
+ updateEObject((EObject)leftParent.eGet(reference), (EObject)rightParent.eGet(reference));
+ }
+ }
+ else
+ // create
+ {
+ if (rightReferenceObject != null)
+ {
+ leftParent.eSet(reference, EcoreUtil.copy((EObject)rightReferenceObject));
+ }
+ }
+ }
+
+ private static void updateEAttributes(EObject leftObject, EObject rightObject)
+ {
+ for (EAttribute attribute : rightObject.eClass().getEAllAttributes())
+ {
+ leftObject.eSet(attribute, rightObject.eGet(attribute));
+ }
+ }
+
+ /**
+ * @since 1.0
+ */
+ public static void deleteViewInResource(Resource resource, EObject e)
+ {
+ Diagram diagram = DawnResourceHelper.getDiagramFromResource(resource);
+ EObject element = ((View)e).getElement();
+
+ if (element != null)
+ {
+ removeElementFromContainer(element);
+ }
+
+ if (e instanceof Node)
+ {
+ View node = (View)e;
+ diagram.removeChild(node);// ..getChildren().add(v);
+ @SuppressWarnings("unchecked")
+ List<Edge> toBeDeleted = new ArrayList<Edge>(node.getSourceEdges());
+ for (Object obj : toBeDeleted)
+ {
+ Edge edge = (Edge)obj;
+ deleteViewInResource(resource, edge);
+ }
+ }
+ else if (e instanceof Edge)
+ {
+ Edge edge = (Edge)e;
+ diagram.removeEdge(edge);// ..getChildren().add(v);
+ edge.setSource(null);
+ edge.setTarget(null);
+ }
+ }
+
+ private static void removeElementFromContainer(EObject element)
+ {
+ EStructuralFeature containingFeature = element.eContainingFeature();
+ EObject container = element.eContainer();
+ if (container != null)
+ {
+ Object get = container.eGet(containingFeature);
+ if (get instanceof Collection<?>)
+ {
+ Collection<?> list = (Collection<?>)get;
+ list.remove(element);
+ }
+ else
+ {
+ container.eSet(containingFeature, null);
+ }
+ }
+ }
+
+ @SuppressWarnings("unchecked")
+ public static void addElementToContainer(EObject element, EObject container, EStructuralFeature containingFeature)
+ {
+ // EStructuralFeature containingFeature = element.eContainingFeature();
+ Object get = container.eGet(containingFeature);
+ if (get instanceof Collection<?>)
+ {
+ Collection<EObject> list = (Collection<EObject>)get;
+ list.add(element);
+ }
+ else
+ {
+ container.eSet(containingFeature, element);
+ }
+ }
+
+ /**
+ * checks if an element with element's id exists in the give resource
+ *
+ * @param res
+ * @param element
+ * @return true is the object with the same xmi id as element is contained in the given resource
+ */
+ public static boolean isObjectInResource(Resource res, EObject element)
+ {
+ EObject object = res.getEObject(DawnResourceHelper.getXmiId(element));
+ if (object == null)
+ {
+ return false;
+ }
+
+ return true;
+ }
+
+ public static void printResource(Resource r)
+ {
+ for (EObject o : r.getContents())
+ {
+ printEObjectFull(o, 0);
+ }
+ }
+
+ public static void printEObject(EObject o, int level)
+ {
+ for (Object child : o.eContents())
+ {
+ printEObject((EObject)child, level + 1);
+ }
+ }
+
+ public static void printEObjectFull(EObject o, int level)
+ {
+ print(tabs(level) + "--------------------------------------------");
+ print(tabs(level) + "Object: " + o);
+ print(tabs(level) + "o.eContainer: " + o.eContainer());
+ print(tabs(level) + "o.eContainingFeature: " + o.eContainingFeature());
+ print(tabs(level) + "o.eContainmentFeature: " + o.eContainmentFeature());
+ print(tabs(level) + "o.eIsProxy: " + o.eIsProxy());
+ print(tabs(level) + "o.eResource: " + o.eResource());
+ print(tabs(level) + "o.getClass: " + o.getClass());
+ print(tabs(level) + "o.eClass: " + o.eClass());
+ print(tabs(level) + "o.eCrossReferences: " + o.eCrossReferences());
+
+ print(tabs(level) + "o.eClass.getClassifierID: " + o.eClass().getClassifierID());
+ print(tabs(level) + "o.eClass.getFeatureCount: " + o.eClass().getFeatureCount());
+ print(tabs(level) + "o.eClass.getInstanceClassName: " + o.eClass().getInstanceClassName());
+ print(tabs(level) + "o.eClass.getInstanceTypeName: " + o.eClass().getInstanceTypeName());
+ print(tabs(level) + "o.eClass.getName: " + o.eClass().getName());
+ print(tabs(level) + "o.eClass.getDefaultValue: " + o.eClass().getDefaultValue());
+ print(tabs(level) + "o.eClass.getEPackage: " + o.eClass().getEPackage());
+ print(tabs(level) + "o.eClass.getEIDAttribute: " + o.eClass().getEIDAttribute());
+ print(tabs(level) + "o.eClass.getInstanceClass: " + o.eClass().getInstanceClass());
+
+ for (EAttribute attribute : o.eClass().getEAllAttributes())
+ {
+ print(tabs(level + 1) + "o.eClass.getEAllAttributes.attribute: '" + attribute.getName() + "': "
+ + o.eGet(attribute));
+ }
+ for (EAnnotation annotation : o.eClass().getEAnnotations())
+ {
+ print(tabs(level + 1) + "o.eClass().getEAnnotations().annotation: '" + annotation);
+ }
+ for (EReference containment : o.eClass().getEAllContainments())
+ {
+ print(tabs(level + 1) + "o.eClass().getEAllContainments().containment: '" + containment);
+ }
+ for (EGenericType genericSupertype : o.eClass().getEAllGenericSuperTypes())
+ {
+ print(tabs(level + 1) + "o.eClass().getEAllGenericSuperTypes().genericSupertype: '" + genericSupertype);
+ }
+ for (EOperation operation : o.eClass().getEAllOperations())
+ {
+ print(tabs(level + 1) + "o.eClass().getEAllOperations().operation: '" + operation);
+ }
+
+ for (EReference reference : o.eClass().getEAllReferences())
+ {
+ print(tabs(level + 1) + "o.eClass().getEAllReferences().reference: '" + reference);
+ }
+ for (EClass supertype : o.eClass().getEAllSuperTypes())
+ {
+ print(tabs(level + 1) + "o.eClass().getEAllSuperTypes().supertype: '" + supertype);
+ }
+ for (EStructuralFeature structuralFeature : o.eClass().getEAllStructuralFeatures())
+ {
+ print(tabs(level + 1) + "o.eClass().getEAllStructuralFeatures().structuralFeature: '" + structuralFeature);
+ }
+ for (EAnnotation annotation : o.eClass().getEAnnotations())
+ {
+ print(tabs(level + 1) + "o.eClass().getEAnnotations().annotation: '" + annotation);
+ }
+ for (EAttribute attribute : o.eClass().getEAttributes())
+ {
+ print(tabs(level + 1) + "o.eClass().getEAttributes().annotation: '" + attribute);
+ }
+ for (Adapter adapter : o.eClass().eAdapters())
+ {
+ print(tabs(level + 1) + "o.eClass().eAdapters().adapter: '" + adapter);
+ }
+
+ for (Object child : o.eContents())
+ {
+ printEObjectFull((EObject)child, level + 2);
+ }
+ }
+
+ private static String tabs(int level)
+ {
+ String s = "";
+ for (int i = 0; i < level; i++)
+ {
+ s += "\t";
+ }
+ return s;
+ }
+
+ public static String getLocationFromResource(Resource r) throws MalformedURLException, IOException
+ {
+ return FileLocator.resolve(new URL(r.getURI().toString())).toString().replace("file:", "");
+ }
+
+ /**********************
+ * finds EditPart from a View
+ *
+ * @param view
+ * @param dawnDiagramEditor
+ * @return find an Editpart for a view with the same xmi id
+ ***************************************************************************************************/
+ @Deprecated
+ public static EditPart findEditPartByXMIId(View view, DiagramDocumentEditor dawnDiagramEditor)
+ {
+ DiagramEditPart diagramEditPart = dawnDiagramEditor.getDiagramEditPart();
+
+ for (Object e : diagramEditPart.getChildren())
+ {
+ EditPart ep = (EditPart)e;
+ if (DawnResourceHelper.getXmiId((EObject)ep.getModel()).equals(DawnResourceHelper.getXmiId(view)))
+ {
+ return ep;
+ }
+ }
+
+ for (Object e : diagramEditPart.getConnections())
+ {
+ EditPart ep = (EditPart)e;
+ if (DawnResourceHelper.getXmiId((EObject)ep.getModel()).equals(DawnResourceHelper.getXmiId(view)))
+ {
+ return ep;
+ }
+ }
+ return null;
+ }
+
+ protected static void print(String s)
+ {
+ if (TRACER.isEnabled())
+ {
+ TRACER.trace(s);
+ }
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.dawn.gmf/src/org/eclipse/emf/cdo/dawn/transaction/DawnDiagramEditingDomainFactory.java b/plugins/org.eclipse.emf.cdo.dawn.gmf/src/org/eclipse/emf/cdo/dawn/transaction/DawnDiagramEditingDomainFactory.java
index a34cd531fe..227fbb0313 100644
--- a/plugins/org.eclipse.emf.cdo.dawn.gmf/src/org/eclipse/emf/cdo/dawn/transaction/DawnDiagramEditingDomainFactory.java
+++ b/plugins/org.eclipse.emf.cdo.dawn.gmf/src/org/eclipse/emf/cdo/dawn/transaction/DawnDiagramEditingDomainFactory.java
@@ -1,114 +1,114 @@
-/*
- * 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
- */
-package org.eclipse.emf.cdo.dawn.transaction;
-
-import org.eclipse.emf.cdo.dawn.gmf.resources.DawnPathmapManager;
-import org.eclipse.emf.cdo.internal.dawn.bundle.OM;
-
-import org.eclipse.net4j.util.om.trace.ContextTracer;
-
-import org.eclipse.emf.common.notify.AdapterFactory;
-import org.eclipse.emf.ecore.resource.ResourceSet;
-import org.eclipse.emf.edit.provider.ComposedAdapterFactory;
-import org.eclipse.emf.transaction.TransactionalCommandStack;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.emf.transaction.impl.TransactionChangeRecorder;
-import org.eclipse.emf.workspace.WorkspaceEditingDomainFactory;
-import org.eclipse.emf.workspace.impl.WorkspaceCommandStackImpl;
-
-import org.eclipse.core.commands.operations.IOperationHistory;
-import org.eclipse.gmf.runtime.diagram.core.DiagramEditingDomainFactory;
-
-public class DawnDiagramEditingDomainFactory extends DiagramEditingDomainFactory
-{
- private static final ContextTracer TRACER = new ContextTracer(OM.DEBUG, DawnDiagramEditingDomainFactory.class);
-
- private static DawnDiagramEditingDomainFactory instance = new DawnDiagramEditingDomainFactory();
-
- protected static class DawnDiagramEditingDomain extends DiagramEditingDomain
- {
- public DawnDiagramEditingDomain(AdapterFactory adapterFactory, ResourceSet resourceSet)
- {
- super(adapterFactory, resourceSet);
- }
-
- public DawnDiagramEditingDomain(AdapterFactory adapterFactory, TransactionalCommandStack stack,
- ResourceSet resourceSet)
- {
- super(adapterFactory, stack, resourceSet);
- }
-
- public DawnDiagramEditingDomain(AdapterFactory adapterFactory, TransactionalCommandStack stack)
- {
- super(adapterFactory, stack);
- }
-
- public DawnDiagramEditingDomain(AdapterFactory adapterFactory)
- {
- super(adapterFactory);
- }
-
- /**
- * override the TransactionChangeRecorder to suppress the write asserts which are not need with CDO
- */
- @Override
- protected TransactionChangeRecorder createChangeRecorder(ResourceSet rset)
- {
- return new DawnTransactionChangeRecorder(this, rset);
- }
- }
-
- @Override
- public TransactionalEditingDomain createEditingDomain(IOperationHistory history)
- {
- if (TRACER.isEnabled())
- {
- TRACER.trace("Creating DawnTransactionalEditingDomain using DawnDiagramEditingDomainFactory"); //$NON-NLS-1$
- }
- WorkspaceCommandStackImpl stack = new WorkspaceCommandStackImpl(history);
-
- TransactionalEditingDomain result = new DawnDiagramEditingDomain(new ComposedAdapterFactory(
- ComposedAdapterFactory.Descriptor.Registry.INSTANCE), stack);
-
- mapResourceSet(result);
-
- configure(result);
- return result;
- }
-
- @Override
- public TransactionalEditingDomain createEditingDomain(ResourceSet rset, IOperationHistory history)
- {
- WorkspaceCommandStackImpl stack = new WorkspaceCommandStackImpl(history);
-
- TransactionalEditingDomain result = new DawnDiagramEditingDomain(new ComposedAdapterFactory(
- ComposedAdapterFactory.Descriptor.Registry.INSTANCE), stack, rset);
-
- mapResourceSet(result);
- configure(result);
- return result;
- }
-
- @Override
- protected void configure(final TransactionalEditingDomain domain)
- {
- super.configure(domain);
-
- final ResourceSet rset = domain.getResourceSet();
- DawnPathmapManager.removePathMapMananger(rset.eAdapters());
- rset.eAdapters().add(new DawnPathmapManager());
- }
-
- public static WorkspaceEditingDomainFactory getInstance()
- {
- return instance;
- }
-}
+/*
+ * 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
+ */
+package org.eclipse.emf.cdo.dawn.transaction;
+
+import org.eclipse.emf.cdo.dawn.gmf.resources.DawnPathmapManager;
+import org.eclipse.emf.cdo.internal.dawn.bundle.OM;
+
+import org.eclipse.net4j.util.om.trace.ContextTracer;
+
+import org.eclipse.emf.common.notify.AdapterFactory;
+import org.eclipse.emf.ecore.resource.ResourceSet;
+import org.eclipse.emf.edit.provider.ComposedAdapterFactory;
+import org.eclipse.emf.transaction.TransactionalCommandStack;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.emf.transaction.impl.TransactionChangeRecorder;
+import org.eclipse.emf.workspace.WorkspaceEditingDomainFactory;
+import org.eclipse.emf.workspace.impl.WorkspaceCommandStackImpl;
+
+import org.eclipse.core.commands.operations.IOperationHistory;
+import org.eclipse.gmf.runtime.diagram.core.DiagramEditingDomainFactory;
+
+public class DawnDiagramEditingDomainFactory extends DiagramEditingDomainFactory
+{
+ private static final ContextTracer TRACER = new ContextTracer(OM.DEBUG, DawnDiagramEditingDomainFactory.class);
+
+ private static DawnDiagramEditingDomainFactory instance = new DawnDiagramEditingDomainFactory();
+
+ protected static class DawnDiagramEditingDomain extends DiagramEditingDomain
+ {
+ public DawnDiagramEditingDomain(AdapterFactory adapterFactory, ResourceSet resourceSet)
+ {
+ super(adapterFactory, resourceSet);
+ }
+
+ public DawnDiagramEditingDomain(AdapterFactory adapterFactory, TransactionalCommandStack stack,
+ ResourceSet resourceSet)
+ {
+ super(adapterFactory, stack, resourceSet);
+ }
+
+ public DawnDiagramEditingDomain(AdapterFactory adapterFactory, TransactionalCommandStack stack)
+ {
+ super(adapterFactory, stack);
+ }
+
+ public DawnDiagramEditingDomain(AdapterFactory adapterFactory)
+ {
+ super(adapterFactory);
+ }
+
+ /**
+ * override the TransactionChangeRecorder to suppress the write asserts which are not need with CDO
+ */
+ @Override
+ protected TransactionChangeRecorder createChangeRecorder(ResourceSet rset)
+ {
+ return new DawnTransactionChangeRecorder(this, rset);
+ }
+ }
+
+ @Override
+ public TransactionalEditingDomain createEditingDomain(IOperationHistory history)
+ {
+ if (TRACER.isEnabled())
+ {
+ TRACER.trace("Creating DawnTransactionalEditingDomain using DawnDiagramEditingDomainFactory"); //$NON-NLS-1$
+ }
+ WorkspaceCommandStackImpl stack = new WorkspaceCommandStackImpl(history);
+
+ TransactionalEditingDomain result = new DawnDiagramEditingDomain(new ComposedAdapterFactory(
+ ComposedAdapterFactory.Descriptor.Registry.INSTANCE), stack);
+
+ mapResourceSet(result);
+
+ configure(result);
+ return result;
+ }
+
+ @Override
+ public TransactionalEditingDomain createEditingDomain(ResourceSet rset, IOperationHistory history)
+ {
+ WorkspaceCommandStackImpl stack = new WorkspaceCommandStackImpl(history);
+
+ TransactionalEditingDomain result = new DawnDiagramEditingDomain(new ComposedAdapterFactory(
+ ComposedAdapterFactory.Descriptor.Registry.INSTANCE), stack, rset);
+
+ mapResourceSet(result);
+ configure(result);
+ return result;
+ }
+
+ @Override
+ protected void configure(final TransactionalEditingDomain domain)
+ {
+ super.configure(domain);
+
+ final ResourceSet rset = domain.getResourceSet();
+ DawnPathmapManager.removePathMapMananger(rset.eAdapters());
+ rset.eAdapters().add(new DawnPathmapManager());
+ }
+
+ public static WorkspaceEditingDomainFactory getInstance()
+ {
+ return instance;
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.dawn.gmf/src/org/eclipse/emf/cdo/dawn/transaction/DawnGMFEditingDomainFactory.java b/plugins/org.eclipse.emf.cdo.dawn.gmf/src/org/eclipse/emf/cdo/dawn/transaction/DawnGMFEditingDomainFactory.java
index a6687677b1..4823e63839 100644
--- a/plugins/org.eclipse.emf.cdo.dawn.gmf/src/org/eclipse/emf/cdo/dawn/transaction/DawnGMFEditingDomainFactory.java
+++ b/plugins/org.eclipse.emf.cdo.dawn.gmf/src/org/eclipse/emf/cdo/dawn/transaction/DawnGMFEditingDomainFactory.java
@@ -1,106 +1,106 @@
-/*
- * 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
- */
-package org.eclipse.emf.cdo.dawn.transaction;
-
-import org.eclipse.emf.cdo.dawn.gmf.resources.DawnPathmapManager;
-import org.eclipse.emf.cdo.internal.dawn.bundle.OM;
-
-import org.eclipse.net4j.util.om.trace.ContextTracer;
-
-import org.eclipse.emf.ecore.resource.ResourceSet;
-import org.eclipse.emf.edit.provider.ComposedAdapterFactory;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.emf.workspace.WorkspaceEditingDomainFactory;
-import org.eclipse.emf.workspace.impl.WorkspaceCommandStackImpl;
-
-import org.eclipse.core.commands.operations.IOperationHistory;
-import org.eclipse.gmf.runtime.emf.core.GMFEditingDomainFactory;
-
-public class DawnGMFEditingDomainFactory extends GMFEditingDomainFactory
-{
- private static final ContextTracer TRACER = new ContextTracer(OM.DEBUG, DawnGMFEditingDomainFactory.class);
-
- private static DawnGMFEditingDomainFactory instance = new DawnGMFEditingDomainFactory();
-
- @Override
- public TransactionalEditingDomain createEditingDomain()
- {
- TransactionalEditingDomain result = super.createEditingDomain();
- configure(result);
- return result;
- }
-
- @Override
- public TransactionalEditingDomain createEditingDomain(ResourceSet rset)
- {
- TransactionalEditingDomain result = super.createEditingDomain(rset);
- configure(result);
- return result;
- }
-
- /**
- * overrides WorkspaceEditingDomainFactory method
- */
- @Override
- public synchronized TransactionalEditingDomain createEditingDomain(IOperationHistory history)
- {
- WorkspaceCommandStackImpl stack = new WorkspaceCommandStackImpl(history);
- stack.setResourceUndoContextPolicy(getResourceUndoContextPolicy());
-
- TransactionalEditingDomain result = new DawnTransactionalEditingDomainImpl(new ComposedAdapterFactory(
- ComposedAdapterFactory.Descriptor.Registry.INSTANCE), stack);
-
- mapResourceSet(result);
- // configures as the GMFEditingDomainFactory would do
- configure(result);
-
- return result;
- }
-
- /**
- * overrides WorkspaceEditingDomainFactory method
- */
- @Override
- public synchronized TransactionalEditingDomain createEditingDomain(ResourceSet rset, IOperationHistory history)
- {
- if (TRACER.isEnabled())
- {
- TRACER.trace("Creating DawnTransactionalEditingDomain using DawnDiagramEditingDomainFactory"); //$NON-NLS-1$
- }
- WorkspaceCommandStackImpl stack = new WorkspaceCommandStackImpl(history);
- stack.setResourceUndoContextPolicy(getResourceUndoContextPolicy());
-
- TransactionalEditingDomain result = new DawnTransactionalEditingDomainImpl(new ComposedAdapterFactory(
- ComposedAdapterFactory.Descriptor.Registry.INSTANCE), stack, rset);
-
- mapResourceSet(result);
-
- // configures as the GMFEditingDomainFactory would do
- configure(result);
-
- return result;
- }
-
- public static WorkspaceEditingDomainFactory getInstance()
- {
- return instance;
- }
-
- @Override
- protected void configure(final TransactionalEditingDomain domain)
- {
- super.configure(domain);
-
- final ResourceSet rset = domain.getResourceSet();
- DawnPathmapManager.removePathMapMananger(rset.eAdapters());
- rset.eAdapters().add(new DawnPathmapManager());
- }
-}
+/*
+ * 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
+ */
+package org.eclipse.emf.cdo.dawn.transaction;
+
+import org.eclipse.emf.cdo.dawn.gmf.resources.DawnPathmapManager;
+import org.eclipse.emf.cdo.internal.dawn.bundle.OM;
+
+import org.eclipse.net4j.util.om.trace.ContextTracer;
+
+import org.eclipse.emf.ecore.resource.ResourceSet;
+import org.eclipse.emf.edit.provider.ComposedAdapterFactory;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.emf.workspace.WorkspaceEditingDomainFactory;
+import org.eclipse.emf.workspace.impl.WorkspaceCommandStackImpl;
+
+import org.eclipse.core.commands.operations.IOperationHistory;
+import org.eclipse.gmf.runtime.emf.core.GMFEditingDomainFactory;
+
+public class DawnGMFEditingDomainFactory extends GMFEditingDomainFactory
+{
+ private static final ContextTracer TRACER = new ContextTracer(OM.DEBUG, DawnGMFEditingDomainFactory.class);
+
+ private static DawnGMFEditingDomainFactory instance = new DawnGMFEditingDomainFactory();
+
+ @Override
+ public TransactionalEditingDomain createEditingDomain()
+ {
+ TransactionalEditingDomain result = super.createEditingDomain();
+ configure(result);
+ return result;
+ }
+
+ @Override
+ public TransactionalEditingDomain createEditingDomain(ResourceSet rset)
+ {
+ TransactionalEditingDomain result = super.createEditingDomain(rset);
+ configure(result);
+ return result;
+ }
+
+ /**
+ * overrides WorkspaceEditingDomainFactory method
+ */
+ @Override
+ public synchronized TransactionalEditingDomain createEditingDomain(IOperationHistory history)
+ {
+ WorkspaceCommandStackImpl stack = new WorkspaceCommandStackImpl(history);
+ stack.setResourceUndoContextPolicy(getResourceUndoContextPolicy());
+
+ TransactionalEditingDomain result = new DawnTransactionalEditingDomainImpl(new ComposedAdapterFactory(
+ ComposedAdapterFactory.Descriptor.Registry.INSTANCE), stack);
+
+ mapResourceSet(result);
+ // configures as the GMFEditingDomainFactory would do
+ configure(result);
+
+ return result;
+ }
+
+ /**
+ * overrides WorkspaceEditingDomainFactory method
+ */
+ @Override
+ public synchronized TransactionalEditingDomain createEditingDomain(ResourceSet rset, IOperationHistory history)
+ {
+ if (TRACER.isEnabled())
+ {
+ TRACER.trace("Creating DawnTransactionalEditingDomain using DawnDiagramEditingDomainFactory"); //$NON-NLS-1$
+ }
+ WorkspaceCommandStackImpl stack = new WorkspaceCommandStackImpl(history);
+ stack.setResourceUndoContextPolicy(getResourceUndoContextPolicy());
+
+ TransactionalEditingDomain result = new DawnTransactionalEditingDomainImpl(new ComposedAdapterFactory(
+ ComposedAdapterFactory.Descriptor.Registry.INSTANCE), stack, rset);
+
+ mapResourceSet(result);
+
+ // configures as the GMFEditingDomainFactory would do
+ configure(result);
+
+ return result;
+ }
+
+ public static WorkspaceEditingDomainFactory getInstance()
+ {
+ return instance;
+ }
+
+ @Override
+ protected void configure(final TransactionalEditingDomain domain)
+ {
+ super.configure(domain);
+
+ final ResourceSet rset = domain.getResourceSet();
+ DawnPathmapManager.removePathMapMananger(rset.eAdapters());
+ rset.eAdapters().add(new DawnPathmapManager());
+ }
+}

Back to the top