diff options
Diffstat (limited to 'plugins/org.eclipse.emf.cdo.dawn.ui')
30 files changed, 1881 insertions, 1881 deletions
diff --git a/plugins/org.eclipse.emf.cdo.dawn.ui/.settings/org.eclipse.jdt.ui.prefs b/plugins/org.eclipse.emf.cdo.dawn.ui/.settings/org.eclipse.jdt.ui.prefs index 1c6d0e8a2d..9720d04dde 100644 --- a/plugins/org.eclipse.emf.cdo.dawn.ui/.settings/org.eclipse.jdt.ui.prefs +++ b/plugins/org.eclipse.emf.cdo.dawn.ui/.settings/org.eclipse.jdt.ui.prefs @@ -1,120 +1,120 @@ -#Thu Feb 04 09:44:24 CET 2010 -cleanup.add_default_serial_version_id=true -cleanup.add_generated_serial_version_id=false -cleanup.add_missing_annotations=true -cleanup.add_missing_deprecated_annotations=true -cleanup.add_missing_methods=false -cleanup.add_missing_nls_tags=false -cleanup.add_missing_override_annotations=true -cleanup.add_missing_override_annotations_interface_methods=true -cleanup.add_serial_version_id=true -cleanup.always_use_blocks=true -cleanup.always_use_parentheses_in_expressions=false -cleanup.always_use_this_for_non_static_field_access=false -cleanup.always_use_this_for_non_static_method_access=false -cleanup.convert_to_enhanced_for_loop=false -cleanup.correct_indentation=true -cleanup.format_source_code=true -cleanup.format_source_code_changes_only=false -cleanup.make_local_variable_final=true -cleanup.make_parameters_final=false -cleanup.make_private_fields_final=true -cleanup.make_type_abstract_if_missing_method=false -cleanup.make_variable_declarations_final=false -cleanup.never_use_blocks=false -cleanup.never_use_parentheses_in_expressions=true -cleanup.organize_imports=true -cleanup.qualify_static_field_accesses_with_declaring_class=false -cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true -cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true -cleanup.qualify_static_member_accesses_with_declaring_class=false -cleanup.qualify_static_method_accesses_with_declaring_class=false -cleanup.remove_private_constructors=true -cleanup.remove_trailing_whitespaces=true -cleanup.remove_trailing_whitespaces_all=true -cleanup.remove_trailing_whitespaces_ignore_empty=false -cleanup.remove_unnecessary_casts=true -cleanup.remove_unnecessary_nls_tags=true -cleanup.remove_unused_imports=true -cleanup.remove_unused_local_variables=false -cleanup.remove_unused_private_fields=true -cleanup.remove_unused_private_members=false -cleanup.remove_unused_private_methods=true -cleanup.remove_unused_private_types=true -cleanup.sort_members=false -cleanup.sort_members_all=false -cleanup.use_blocks=true -cleanup.use_blocks_only_for_return_and_throw=false -cleanup.use_parentheses_in_expressions=true -cleanup.use_this_for_non_static_field_access=true -cleanup.use_this_for_non_static_field_access_only_if_necessary=true -cleanup.use_this_for_non_static_method_access=true -cleanup.use_this_for_non_static_method_access_only_if_necessary=true -cleanup_profile=_EMFT -cleanup_settings_version=2 -eclipse.preferences.version=1 -editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true -formatter_profile=_EMFT -formatter_settings_version=11 -org.eclipse.jdt.ui.exception.name=ex -org.eclipse.jdt.ui.gettersetter.use.is=true -org.eclipse.jdt.ui.ignorelowercasenames=true -org.eclipse.jdt.ui.importorder=org.eclipse.emf.cdo;org.eclipse.emf.internal.cdo;org.eclipse.net4j;org.eclipse.internal.net4j;org.eclipse.emf;org.eclipse;com;org;javax;java; -org.eclipse.jdt.ui.javadoc=true -org.eclipse.jdt.ui.keywordthis=false -org.eclipse.jdt.ui.ondemandthreshold=99 -org.eclipse.jdt.ui.overrideannotation=true -org.eclipse.jdt.ui.staticondemandthreshold=99 -org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8" standalone\="no"?><templates><template autoinsert\="false" context\="gettercomment_context" deleted\="false" description\="Comment for getter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.gettercomment" name\="gettercomment"/><template autoinsert\="false" context\="settercomment_context" deleted\="false" description\="Comment for setter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.settercomment" name\="settercomment"/><template autoinsert\="false" context\="constructorcomment_context" deleted\="false" description\="Comment for created constructors" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorcomment" name\="constructorcomment"/><template autoinsert\="false" context\="filecomment_context" deleted\="false" description\="Comment for created Java files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.filecomment" name\="filecomment">/*\r\n * Copyright (c) 2004 - 2011 Eike Stepper (Berlin, Germany) and others.\r\n * All rights reserved. This program and the accompanying materials\r\n * are made available under the terms of the Eclipse Public License v1.0\r\n * which accompanies this distribution, and is available at\r\n * http\://www.eclipse.org/legal/epl-v10.html\r\n * \r\n * Contributors\:\r\n * Martin Fluegge - initial API and implementation\r\n */</template><template autoinsert\="false" context\="typecomment_context" deleted\="false" description\="Comment for created types" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.typecomment" name\="typecomment">/**\r\n * @author Martin Fluegge\r\n */</template><template autoinsert\="false" context\="fieldcomment_context" deleted\="false" description\="Comment for fields" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.fieldcomment" name\="fieldcomment"/><template autoinsert\="false" context\="methodcomment_context" deleted\="false" description\="Comment for non-overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodcomment" name\="methodcomment"/><template autoinsert\="false" context\="overridecomment_context" deleted\="false" description\="Comment for overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.overridecomment" name\="overridecomment"/><template autoinsert\="false" context\="delegatecomment_context" deleted\="false" description\="Comment for delegate methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.delegatecomment" name\="delegatecomment"/><template autoinsert\="true" context\="newtype_context" deleted\="false" description\="Newly created files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.newtype" name\="newtype">${filecomment}\r\n${package_declaration}\r\n\r\n${typecomment}\r\n${type_declaration}</template><template autoinsert\="true" context\="classbody_context" deleted\="false" description\="Code in new class type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.classbody" name\="classbody">\r\n</template><template autoinsert\="true" context\="interfacebody_context" deleted\="false" description\="Code in new interface type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.interfacebody" name\="interfacebody">\r\n</template><template autoinsert\="true" context\="enumbody_context" deleted\="false" description\="Code in new enum type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.enumbody" name\="enumbody">\r\n</template><template autoinsert\="true" context\="annotationbody_context" deleted\="false" description\="Code in new annotation type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.annotationbody" name\="annotationbody">\r\n</template><template autoinsert\="false" context\="catchblock_context" deleted\="false" description\="Code in new catch blocks" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.catchblock" name\="catchblock">${exception_var}.printStackTrace();</template><template autoinsert\="false" context\="methodbody_context" deleted\="false" description\="Code in created method stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodbody" name\="methodbody">${body_statement}</template><template autoinsert\="false" context\="constructorbody_context" deleted\="false" description\="Code in created constructor stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorbody" name\="constructorbody">${body_statement}</template><template autoinsert\="true" context\="getterbody_context" deleted\="false" description\="Code in created getters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.getterbody" name\="getterbody">return ${field};</template><template autoinsert\="true" context\="setterbody_context" deleted\="false" description\="Code in created setters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.setterbody" name\="setterbody">${field} \= ${param};</template></templates> -sp_cleanup.add_default_serial_version_id=true -sp_cleanup.add_generated_serial_version_id=false -sp_cleanup.add_missing_annotations=true -sp_cleanup.add_missing_deprecated_annotations=true -sp_cleanup.add_missing_methods=false -sp_cleanup.add_missing_nls_tags=false -sp_cleanup.add_missing_override_annotations=true -sp_cleanup.add_missing_override_annotations_interface_methods=false -sp_cleanup.add_serial_version_id=false -sp_cleanup.always_use_blocks=true -sp_cleanup.always_use_parentheses_in_expressions=false -sp_cleanup.always_use_this_for_non_static_field_access=false -sp_cleanup.always_use_this_for_non_static_method_access=false -sp_cleanup.convert_to_enhanced_for_loop=false -sp_cleanup.correct_indentation=true -sp_cleanup.format_source_code=true -sp_cleanup.format_source_code_changes_only=false -sp_cleanup.make_local_variable_final=false -sp_cleanup.make_parameters_final=false -sp_cleanup.make_private_fields_final=true -sp_cleanup.make_type_abstract_if_missing_method=false -sp_cleanup.make_variable_declarations_final=false -sp_cleanup.never_use_blocks=false -sp_cleanup.never_use_parentheses_in_expressions=true -sp_cleanup.on_save_use_additional_actions=true -sp_cleanup.organize_imports=true -sp_cleanup.qualify_static_field_accesses_with_declaring_class=false -sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true -sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true -sp_cleanup.qualify_static_member_accesses_with_declaring_class=false -sp_cleanup.qualify_static_method_accesses_with_declaring_class=false -sp_cleanup.remove_private_constructors=true -sp_cleanup.remove_trailing_whitespaces=true -sp_cleanup.remove_trailing_whitespaces_all=true -sp_cleanup.remove_trailing_whitespaces_ignore_empty=false -sp_cleanup.remove_unnecessary_casts=true -sp_cleanup.remove_unnecessary_nls_tags=true -sp_cleanup.remove_unused_imports=true -sp_cleanup.remove_unused_local_variables=false -sp_cleanup.remove_unused_private_fields=true -sp_cleanup.remove_unused_private_members=false -sp_cleanup.remove_unused_private_methods=true -sp_cleanup.remove_unused_private_types=true -sp_cleanup.sort_members=false -sp_cleanup.sort_members_all=false -sp_cleanup.use_blocks=true -sp_cleanup.use_blocks_only_for_return_and_throw=false -sp_cleanup.use_parentheses_in_expressions=true -sp_cleanup.use_this_for_non_static_field_access=true -sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true -sp_cleanup.use_this_for_non_static_method_access=true -sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true +#Thu Feb 04 09:44:24 CET 2010
+cleanup.add_default_serial_version_id=true
+cleanup.add_generated_serial_version_id=false
+cleanup.add_missing_annotations=true
+cleanup.add_missing_deprecated_annotations=true
+cleanup.add_missing_methods=false
+cleanup.add_missing_nls_tags=false
+cleanup.add_missing_override_annotations=true
+cleanup.add_missing_override_annotations_interface_methods=true
+cleanup.add_serial_version_id=true
+cleanup.always_use_blocks=true
+cleanup.always_use_parentheses_in_expressions=false
+cleanup.always_use_this_for_non_static_field_access=false
+cleanup.always_use_this_for_non_static_method_access=false
+cleanup.convert_to_enhanced_for_loop=false
+cleanup.correct_indentation=true
+cleanup.format_source_code=true
+cleanup.format_source_code_changes_only=false
+cleanup.make_local_variable_final=true
+cleanup.make_parameters_final=false
+cleanup.make_private_fields_final=true
+cleanup.make_type_abstract_if_missing_method=false
+cleanup.make_variable_declarations_final=false
+cleanup.never_use_blocks=false
+cleanup.never_use_parentheses_in_expressions=true
+cleanup.organize_imports=true
+cleanup.qualify_static_field_accesses_with_declaring_class=false
+cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
+cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
+cleanup.qualify_static_member_accesses_with_declaring_class=false
+cleanup.qualify_static_method_accesses_with_declaring_class=false
+cleanup.remove_private_constructors=true
+cleanup.remove_trailing_whitespaces=true
+cleanup.remove_trailing_whitespaces_all=true
+cleanup.remove_trailing_whitespaces_ignore_empty=false
+cleanup.remove_unnecessary_casts=true
+cleanup.remove_unnecessary_nls_tags=true
+cleanup.remove_unused_imports=true
+cleanup.remove_unused_local_variables=false
+cleanup.remove_unused_private_fields=true
+cleanup.remove_unused_private_members=false
+cleanup.remove_unused_private_methods=true
+cleanup.remove_unused_private_types=true
+cleanup.sort_members=false
+cleanup.sort_members_all=false
+cleanup.use_blocks=true
+cleanup.use_blocks_only_for_return_and_throw=false
+cleanup.use_parentheses_in_expressions=true
+cleanup.use_this_for_non_static_field_access=true
+cleanup.use_this_for_non_static_field_access_only_if_necessary=true
+cleanup.use_this_for_non_static_method_access=true
+cleanup.use_this_for_non_static_method_access_only_if_necessary=true
+cleanup_profile=_EMFT
+cleanup_settings_version=2
+eclipse.preferences.version=1
+editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
+formatter_profile=_EMFT
+formatter_settings_version=11
+org.eclipse.jdt.ui.exception.name=ex
+org.eclipse.jdt.ui.gettersetter.use.is=true
+org.eclipse.jdt.ui.ignorelowercasenames=true
+org.eclipse.jdt.ui.importorder=org.eclipse.emf.cdo;org.eclipse.emf.internal.cdo;org.eclipse.net4j;org.eclipse.internal.net4j;org.eclipse.emf;org.eclipse;com;org;javax;java;
+org.eclipse.jdt.ui.javadoc=true
+org.eclipse.jdt.ui.keywordthis=false
+org.eclipse.jdt.ui.ondemandthreshold=99
+org.eclipse.jdt.ui.overrideannotation=true
+org.eclipse.jdt.ui.staticondemandthreshold=99
+org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8" standalone\="no"?><templates><template autoinsert\="false" context\="gettercomment_context" deleted\="false" description\="Comment for getter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.gettercomment" name\="gettercomment"/><template autoinsert\="false" context\="settercomment_context" deleted\="false" description\="Comment for setter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.settercomment" name\="settercomment"/><template autoinsert\="false" context\="constructorcomment_context" deleted\="false" description\="Comment for created constructors" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorcomment" name\="constructorcomment"/><template autoinsert\="false" context\="filecomment_context" deleted\="false" description\="Comment for created Java files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.filecomment" name\="filecomment">/*\r\n * Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.\r\n * All rights reserved. This program and the accompanying materials\r\n * are made available under the terms of the Eclipse Public License v1.0\r\n * which accompanies this distribution, and is available at\r\n * http\://www.eclipse.org/legal/epl-v10.html\r\n * \r\n * Contributors\:\r\n * Martin Fluegge - initial API and implementation\r\n */</template><template autoinsert\="false" context\="typecomment_context" deleted\="false" description\="Comment for created types" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.typecomment" name\="typecomment">/**\r\n * @author Martin Fluegge\r\n */</template><template autoinsert\="false" context\="fieldcomment_context" deleted\="false" description\="Comment for fields" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.fieldcomment" name\="fieldcomment"/><template autoinsert\="false" context\="methodcomment_context" deleted\="false" description\="Comment for non-overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodcomment" name\="methodcomment"/><template autoinsert\="false" context\="overridecomment_context" deleted\="false" description\="Comment for overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.overridecomment" name\="overridecomment"/><template autoinsert\="false" context\="delegatecomment_context" deleted\="false" description\="Comment for delegate methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.delegatecomment" name\="delegatecomment"/><template autoinsert\="true" context\="newtype_context" deleted\="false" description\="Newly created files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.newtype" name\="newtype">${filecomment}\r\n${package_declaration}\r\n\r\n${typecomment}\r\n${type_declaration}</template><template autoinsert\="true" context\="classbody_context" deleted\="false" description\="Code in new class type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.classbody" name\="classbody">\r\n</template><template autoinsert\="true" context\="interfacebody_context" deleted\="false" description\="Code in new interface type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.interfacebody" name\="interfacebody">\r\n</template><template autoinsert\="true" context\="enumbody_context" deleted\="false" description\="Code in new enum type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.enumbody" name\="enumbody">\r\n</template><template autoinsert\="true" context\="annotationbody_context" deleted\="false" description\="Code in new annotation type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.annotationbody" name\="annotationbody">\r\n</template><template autoinsert\="false" context\="catchblock_context" deleted\="false" description\="Code in new catch blocks" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.catchblock" name\="catchblock">${exception_var}.printStackTrace();</template><template autoinsert\="false" context\="methodbody_context" deleted\="false" description\="Code in created method stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodbody" name\="methodbody">${body_statement}</template><template autoinsert\="false" context\="constructorbody_context" deleted\="false" description\="Code in created constructor stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorbody" name\="constructorbody">${body_statement}</template><template autoinsert\="true" context\="getterbody_context" deleted\="false" description\="Code in created getters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.getterbody" name\="getterbody">return ${field};</template><template autoinsert\="true" context\="setterbody_context" deleted\="false" description\="Code in created setters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.setterbody" name\="setterbody">${field} \= ${param};</template></templates>
+sp_cleanup.add_default_serial_version_id=true
+sp_cleanup.add_generated_serial_version_id=false
+sp_cleanup.add_missing_annotations=true
+sp_cleanup.add_missing_deprecated_annotations=true
+sp_cleanup.add_missing_methods=false
+sp_cleanup.add_missing_nls_tags=false
+sp_cleanup.add_missing_override_annotations=true
+sp_cleanup.add_missing_override_annotations_interface_methods=false
+sp_cleanup.add_serial_version_id=false
+sp_cleanup.always_use_blocks=true
+sp_cleanup.always_use_parentheses_in_expressions=false
+sp_cleanup.always_use_this_for_non_static_field_access=false
+sp_cleanup.always_use_this_for_non_static_method_access=false
+sp_cleanup.convert_to_enhanced_for_loop=false
+sp_cleanup.correct_indentation=true
+sp_cleanup.format_source_code=true
+sp_cleanup.format_source_code_changes_only=false
+sp_cleanup.make_local_variable_final=false
+sp_cleanup.make_parameters_final=false
+sp_cleanup.make_private_fields_final=true
+sp_cleanup.make_type_abstract_if_missing_method=false
+sp_cleanup.make_variable_declarations_final=false
+sp_cleanup.never_use_blocks=false
+sp_cleanup.never_use_parentheses_in_expressions=true
+sp_cleanup.on_save_use_additional_actions=true
+sp_cleanup.organize_imports=true
+sp_cleanup.qualify_static_field_accesses_with_declaring_class=false
+sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
+sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
+sp_cleanup.qualify_static_member_accesses_with_declaring_class=false
+sp_cleanup.qualify_static_method_accesses_with_declaring_class=false
+sp_cleanup.remove_private_constructors=true
+sp_cleanup.remove_trailing_whitespaces=true
+sp_cleanup.remove_trailing_whitespaces_all=true
+sp_cleanup.remove_trailing_whitespaces_ignore_empty=false
+sp_cleanup.remove_unnecessary_casts=true
+sp_cleanup.remove_unnecessary_nls_tags=true
+sp_cleanup.remove_unused_imports=true
+sp_cleanup.remove_unused_local_variables=false
+sp_cleanup.remove_unused_private_fields=true
+sp_cleanup.remove_unused_private_members=false
+sp_cleanup.remove_unused_private_methods=true
+sp_cleanup.remove_unused_private_types=true
+sp_cleanup.sort_members=false
+sp_cleanup.sort_members_all=false
+sp_cleanup.use_blocks=true
+sp_cleanup.use_blocks_only_for_return_and_throw=false
+sp_cleanup.use_parentheses_in_expressions=true
+sp_cleanup.use_this_for_non_static_field_access=true
+sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true
+sp_cleanup.use_this_for_non_static_method_access=true
+sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true
diff --git a/plugins/org.eclipse.emf.cdo.dawn.ui/build.properties b/plugins/org.eclipse.emf.cdo.dawn.ui/build.properties index 312771cc7c..85b7c6f774 100644 --- a/plugins/org.eclipse.emf.cdo.dawn.ui/build.properties +++ b/plugins/org.eclipse.emf.cdo.dawn.ui/build.properties @@ -1,23 +1,23 @@ -# Copyright (c) 2004 - 2011 Eike Stepper (Berlin, Germany) and others. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 -# which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/epl-v10.html -# -# Contributors: -# Martin Fluegge - initial API and implementation - -# NLS_MESSAGEFORMAT_VAR -source.. = src/ -output.. = bin/ -bin.includes = META-INF/,\ - .,\ - plugin.xml,\ - plugin.properties,\ - about.html,\ - copyright.txt,\ - .options,\ - icons/,\ - contexts.xml -src.includes = about.html,\ - copyright.txt +# Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+# Martin Fluegge - initial API and implementation
+
+# NLS_MESSAGEFORMAT_VAR
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.xml,\
+ plugin.properties,\
+ about.html,\
+ copyright.txt,\
+ .options,\
+ icons/,\
+ contexts.xml
+src.includes = about.html,\
+ copyright.txt
diff --git a/plugins/org.eclipse.emf.cdo.dawn.ui/contexts.xml b/plugins/org.eclipse.emf.cdo.dawn.ui/contexts.xml index c02c82859e..73d56a9429 100644 --- a/plugins/org.eclipse.emf.cdo.dawn.ui/contexts.xml +++ b/plugins/org.eclipse.emf.cdo.dawn.ui/contexts.xml @@ -1,22 +1,22 @@ -<!-- - 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 ---> -<contexts> - <context id="viewer" title="Sample View"> - <description>This is the context help for the sample view with a tree viewer. It was generated by a PDE template.</description> - <topic href="/PLUGINS_ROOT/org.eclipse.platform.doc.isv/guide/ua_help_context.htm" label="Context-sensitive help"> - <enablement> - <with variable="platform"> - <test property="org.eclipse.core.runtime.isBundleInstalled" args="org.eclipse.platform.doc.isv"/> - </with> - </enablement> - </topic> - </context> -</contexts> +<!--
+ 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
+-->
+<contexts>
+ <context id="viewer" title="Sample View">
+ <description>This is the context help for the sample view with a tree viewer. It was generated by a PDE template.</description>
+ <topic href="/PLUGINS_ROOT/org.eclipse.platform.doc.isv/guide/ua_help_context.htm" label="Context-sensitive help">
+ <enablement>
+ <with variable="platform">
+ <test property="org.eclipse.core.runtime.isBundleInstalled" args="org.eclipse.platform.doc.isv"/>
+ </with>
+ </enablement>
+ </topic>
+ </context>
+</contexts>
diff --git a/plugins/org.eclipse.emf.cdo.dawn.ui/copyright.txt b/plugins/org.eclipse.emf.cdo.dawn.ui/copyright.txt index a5ec07f141..9cbb3ba084 100644 --- a/plugins/org.eclipse.emf.cdo.dawn.ui/copyright.txt +++ b/plugins/org.eclipse.emf.cdo.dawn.ui/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.ui/plugin.properties b/plugins/org.eclipse.emf.cdo.dawn.ui/plugin.properties index cabfb39c84..acd46c75ba 100644 --- a/plugins/org.eclipse.emf.cdo.dawn.ui/plugin.properties +++ b/plugins/org.eclipse.emf.cdo.dawn.ui/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 UI -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 UI
+providerName = Eclipse Modeling Project
diff --git a/plugins/org.eclipse.emf.cdo.dawn.ui/plugin.xml b/plugins/org.eclipse.emf.cdo.dawn.ui/plugin.xml index b60aab9f69..058568fb25 100644 --- a/plugins/org.eclipse.emf.cdo.dawn.ui/plugin.xml +++ b/plugins/org.eclipse.emf.cdo.dawn.ui/plugin.xml @@ -1,125 +1,125 @@ -<?xml version="1.0" encoding="UTF-8"?> -<?eclipse version="3.4"?> -<!-- - Copyright (c) 2004 - 2011 Eike Stepper (Berlin, Germany) and others. - All rights reserved. This program and the accompanying materials - are made available under the terms of the Eclipse Public License v1.0 - which accompanies this distribution, and is available at - http://www.eclipse.org/legal/epl-v10.html - - Contributors: - Martin Fluegge - initial API and implementation ---> -<plugin> - <extension - point="org.eclipse.ui.views"> - <category - id="org.eclipse.emf.cdo.dawn.ui" - name="Dawn Category"> - </category> - <view - category="org.eclipse.emf.cdo.dawn.ui" - class="org.eclipse.emf.cdo.dawn.ui.views.DawnExplorer" - icon="icons/dawn_16x16.gif" - id="org.eclipse.emf.cdo.dawn.ui.views.DawnExplorer" - name="Dawn Explorer"> - </view> - </extension> - <extension - point="org.eclipse.help.contexts"> - <contexts - file="contexts.xml"> - </contexts> - </extension> - <extension - point="org.eclipse.ui.newWizards"> - <category - id="org.eclipse.emf.cdo.dawn.ui.category.examples" - name="Dawn Examples"> - </category> - <category - id="org.eclipse.emf.cdo.dawn.ui.category.dawn" - name="Dawn"> - </category> - </extension> - <extension - point="org.eclipse.ui.commands"> - <command - defaultHandler="org.eclipse.emf.cdo.dawn.ui.handlers.LockObjectsHandler" - id="org.eclipse.emf.cdo.dawn.ui.lockobjects" - name="Lock objects"> - </command> - <command - defaultHandler="org.eclipse.emf.cdo.dawn.ui.handlers.UnLockObjectsHandler" - id="org.eclipse.emf.cdo.dawn.ui.unlockobjects" - name="Unlock objects"> - </command> - </extension> - <extension - point="org.eclipse.ui.menus"> - <menuContribution - locationURI="popup:org.eclipse.ui.popup.any?after=additions"> - <menu - label="Locking"> - <visibleWhen - checkEnabled="false"> - <with - variable="activePart"> - <instanceof - value="org.eclipse.emf.cdo.dawn.editors.IDawnEditor"> - </instanceof> - </with> - </visibleWhen> - <command - commandId="org.eclipse.emf.cdo.dawn.ui.lockobjects" - label="Lock" - mnemonic="%contributions.view.refresh.mnemonic"> - </command> - <command - commandId="org.eclipse.emf.cdo.dawn.ui.unlockobjects" - label="Unlock" - mnemonic="%contributions.view.refresh.mnemonic"> - </command> - </menu> - </menuContribution> - - </extension> - <extension - point="org.eclipse.ui.menus"> - <menuContribution - locationURI="popup:org.eclipse.ui.popup.any?after=additions"> - <menu - label="Conflict"> - <visibleWhen - checkEnabled="false"> - <with - variable="activePart"> - <instanceof - value="org.eclipse.emf.cdo.dawn.editors.IDawnEditor"> - </instanceof> - </with> - </visibleWhen> - <command - commandId="org.eclipse.emf.cdo.dawn.commands.solveconflict" - label="Solve Conflict" - mnemonic="%contributions.view.refresh.mnemonic"> - </command> - </menu> - </menuContribution> - - </extension> - <extension - point="org.eclipse.ui.commands"> - <command - id="org.eclipse.emf.cdo.dawn.commands.solveconflict" - name="Solve Confilct"> - </command> - </extension> - <extension - point="org.eclipse.ui.handlers"> - <handler - class="org.eclipse.emf.cdo.dawn.ui.handlers.SolveConflictHandler" - commandId="org.eclipse.emf.cdo.dawn.commands.solveconflict"> - </handler> - </extension> -</plugin> +<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<!--
+ Copyright (c) 2004 - 2012 Eike Stepper (Berlin, Germany) and others.
+ All rights reserved. This program and the accompanying materials
+ are made available under the terms of the Eclipse Public License v1.0
+ which accompanies this distribution, and is available at
+ http://www.eclipse.org/legal/epl-v10.html
+
+ Contributors:
+ Martin Fluegge - initial API and implementation
+-->
+<plugin>
+ <extension
+ point="org.eclipse.ui.views">
+ <category
+ id="org.eclipse.emf.cdo.dawn.ui"
+ name="Dawn Category">
+ </category>
+ <view
+ category="org.eclipse.emf.cdo.dawn.ui"
+ class="org.eclipse.emf.cdo.dawn.ui.views.DawnExplorer"
+ icon="icons/dawn_16x16.gif"
+ id="org.eclipse.emf.cdo.dawn.ui.views.DawnExplorer"
+ name="Dawn Explorer">
+ </view>
+ </extension>
+ <extension
+ point="org.eclipse.help.contexts">
+ <contexts
+ file="contexts.xml">
+ </contexts>
+ </extension>
+ <extension
+ point="org.eclipse.ui.newWizards">
+ <category
+ id="org.eclipse.emf.cdo.dawn.ui.category.examples"
+ name="Dawn Examples">
+ </category>
+ <category
+ id="org.eclipse.emf.cdo.dawn.ui.category.dawn"
+ name="Dawn">
+ </category>
+ </extension>
+ <extension
+ point="org.eclipse.ui.commands">
+ <command
+ defaultHandler="org.eclipse.emf.cdo.dawn.ui.handlers.LockObjectsHandler"
+ id="org.eclipse.emf.cdo.dawn.ui.lockobjects"
+ name="Lock objects">
+ </command>
+ <command
+ defaultHandler="org.eclipse.emf.cdo.dawn.ui.handlers.UnLockObjectsHandler"
+ id="org.eclipse.emf.cdo.dawn.ui.unlockobjects"
+ name="Unlock objects">
+ </command>
+ </extension>
+ <extension
+ point="org.eclipse.ui.menus">
+ <menuContribution
+ locationURI="popup:org.eclipse.ui.popup.any?after=additions">
+ <menu
+ label="Locking">
+ <visibleWhen
+ checkEnabled="false">
+ <with
+ variable="activePart">
+ <instanceof
+ value="org.eclipse.emf.cdo.dawn.editors.IDawnEditor">
+ </instanceof>
+ </with>
+ </visibleWhen>
+ <command
+ commandId="org.eclipse.emf.cdo.dawn.ui.lockobjects"
+ label="Lock"
+ mnemonic="%contributions.view.refresh.mnemonic">
+ </command>
+ <command
+ commandId="org.eclipse.emf.cdo.dawn.ui.unlockobjects"
+ label="Unlock"
+ mnemonic="%contributions.view.refresh.mnemonic">
+ </command>
+ </menu>
+ </menuContribution>
+
+ </extension>
+ <extension
+ point="org.eclipse.ui.menus">
+ <menuContribution
+ locationURI="popup:org.eclipse.ui.popup.any?after=additions">
+ <menu
+ label="Conflict">
+ <visibleWhen
+ checkEnabled="false">
+ <with
+ variable="activePart">
+ <instanceof
+ value="org.eclipse.emf.cdo.dawn.editors.IDawnEditor">
+ </instanceof>
+ </with>
+ </visibleWhen>
+ <command
+ commandId="org.eclipse.emf.cdo.dawn.commands.solveconflict"
+ label="Solve Conflict"
+ mnemonic="%contributions.view.refresh.mnemonic">
+ </command>
+ </menu>
+ </menuContribution>
+
+ </extension>
+ <extension
+ point="org.eclipse.ui.commands">
+ <command
+ id="org.eclipse.emf.cdo.dawn.commands.solveconflict"
+ name="Solve Confilct">
+ </command>
+ </extension>
+ <extension
+ point="org.eclipse.ui.handlers">
+ <handler
+ class="org.eclipse.emf.cdo.dawn.ui.handlers.SolveConflictHandler"
+ commandId="org.eclipse.emf.cdo.dawn.commands.solveconflict">
+ </handler>
+ </extension>
+</plugin>
diff --git a/plugins/org.eclipse.emf.cdo.dawn.ui/src/org/eclipse/emf/cdo/dawn/internal/ui/bundle/OM.java b/plugins/org.eclipse.emf.cdo.dawn.ui/src/org/eclipse/emf/cdo/dawn/internal/ui/bundle/OM.java index dc5bb2acc2..5d5215c458 100644 --- a/plugins/org.eclipse.emf.cdo.dawn.ui/src/org/eclipse/emf/cdo/dawn/internal/ui/bundle/OM.java +++ b/plugins/org.eclipse.emf.cdo.dawn.ui/src/org/eclipse/emf/cdo/dawn/internal/ui/bundle/OM.java @@ -1,45 +1,45 @@ -/* - * 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.internal.ui.bundle; - -import org.eclipse.net4j.util.om.OMBundle; -import org.eclipse.net4j.util.om.OMPlatform; -import org.eclipse.net4j.util.om.OSGiActivator; -import org.eclipse.net4j.util.om.log.OMLogger; -import org.eclipse.net4j.util.om.trace.OMTracer; - -/** - * @author Martin Fluegge - */ -public abstract class OM -{ - public static final String BUNDLE_ID = "org.eclipse.emf.cdo.dawn.ui"; //$NON-NLS-1$ - - public static final OMBundle BUNDLE = OMPlatform.INSTANCE.bundle(BUNDLE_ID, OM.class); - - public static final OMTracer DEBUG = BUNDLE.tracer("debug"); //$NON-NLS-1$ - - public static final OMTracer DEBUG_OBJECT = DEBUG.tracer("object"); //$NON-NLS-1$ - - public static final OMLogger LOG = BUNDLE.logger(); - - /** - * @author Martin Fluegge - * @since 1.0 - */ - public static final class Activator extends OSGiActivator - { - public Activator() - { - super(BUNDLE); - } - } -} +/*
+ * 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.internal.ui.bundle;
+
+import org.eclipse.net4j.util.om.OMBundle;
+import org.eclipse.net4j.util.om.OMPlatform;
+import org.eclipse.net4j.util.om.OSGiActivator;
+import org.eclipse.net4j.util.om.log.OMLogger;
+import org.eclipse.net4j.util.om.trace.OMTracer;
+
+/**
+ * @author Martin Fluegge
+ */
+public abstract class OM
+{
+ public static final String BUNDLE_ID = "org.eclipse.emf.cdo.dawn.ui"; //$NON-NLS-1$
+
+ public static final OMBundle BUNDLE = OMPlatform.INSTANCE.bundle(BUNDLE_ID, OM.class);
+
+ public static final OMTracer DEBUG = BUNDLE.tracer("debug"); //$NON-NLS-1$
+
+ public static final OMTracer DEBUG_OBJECT = DEBUG.tracer("object"); //$NON-NLS-1$
+
+ public static final OMLogger LOG = BUNDLE.logger();
+
+ /**
+ * @author Martin Fluegge
+ * @since 1.0
+ */
+ public static final class Activator extends OSGiActivator
+ {
+ public Activator()
+ {
+ super(BUNDLE);
+ }
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.dawn.ui/src/org/eclipse/emf/cdo/dawn/ui/DawnColorConstants.java b/plugins/org.eclipse.emf.cdo.dawn.ui/src/org/eclipse/emf/cdo/dawn/ui/DawnColorConstants.java index bcffd7b11b..d8a82e937e 100644 --- a/plugins/org.eclipse.emf.cdo.dawn.ui/src/org/eclipse/emf/cdo/dawn/ui/DawnColorConstants.java +++ b/plugins/org.eclipse.emf.cdo.dawn.ui/src/org/eclipse/emf/cdo/dawn/ui/DawnColorConstants.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.ui/src/org/eclipse/emf/cdo/dawn/ui/DawnEditorInput.java b/plugins/org.eclipse.emf.cdo.dawn.ui/src/org/eclipse/emf/cdo/dawn/ui/DawnEditorInput.java index bdc78c4bbe..91f9780794 100644 --- a/plugins/org.eclipse.emf.cdo.dawn.ui/src/org/eclipse/emf/cdo/dawn/ui/DawnEditorInput.java +++ b/plugins/org.eclipse.emf.cdo.dawn.ui/src/org/eclipse/emf/cdo/dawn/ui/DawnEditorInput.java @@ -1,55 +1,55 @@ -/* - * 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.ui; - -import org.eclipse.emf.cdo.eresource.CDOResource; -import org.eclipse.emf.cdo.view.CDOView; - -import org.eclipse.emf.common.ui.URIEditorInput; -import org.eclipse.emf.common.util.URI; - -/** - * @author Martin Fluegge - */ -public class DawnEditorInput extends URIEditorInput implements IDawnEditorInput -{ - private CDOResource resource = null; - - public DawnEditorInput(URI uri) - { - super(uri); - } - - public CDOView getView() - { - return getResource().cdoView(); - } - - public boolean isViewOwned() - { - return false; - } - - public String getResourcePath() - { - return getResource().getPath(); - } - - public void setResource(CDOResource resource) - { - this.resource = resource; - } - - public CDOResource getResource() - { - return resource; - } -} +/*
+ * 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.ui;
+
+import org.eclipse.emf.cdo.eresource.CDOResource;
+import org.eclipse.emf.cdo.view.CDOView;
+
+import org.eclipse.emf.common.ui.URIEditorInput;
+import org.eclipse.emf.common.util.URI;
+
+/**
+ * @author Martin Fluegge
+ */
+public class DawnEditorInput extends URIEditorInput implements IDawnEditorInput
+{
+ private CDOResource resource = null;
+
+ public DawnEditorInput(URI uri)
+ {
+ super(uri);
+ }
+
+ public CDOView getView()
+ {
+ return getResource().cdoView();
+ }
+
+ public boolean isViewOwned()
+ {
+ return false;
+ }
+
+ public String getResourcePath()
+ {
+ return getResource().getPath();
+ }
+
+ public void setResource(CDOResource resource)
+ {
+ this.resource = resource;
+ }
+
+ public CDOResource getResource()
+ {
+ return resource;
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.dawn.ui/src/org/eclipse/emf/cdo/dawn/ui/DawnLabelProvider.java b/plugins/org.eclipse.emf.cdo.dawn.ui/src/org/eclipse/emf/cdo/dawn/ui/DawnLabelProvider.java index 56a86a7082..caea4198b3 100644 --- a/plugins/org.eclipse.emf.cdo.dawn.ui/src/org/eclipse/emf/cdo/dawn/ui/DawnLabelProvider.java +++ b/plugins/org.eclipse.emf.cdo.dawn.ui/src/org/eclipse/emf/cdo/dawn/ui/DawnLabelProvider.java @@ -1,98 +1,98 @@ -/* - * 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.ui; - -import org.eclipse.emf.cdo.CDOObject; -import org.eclipse.emf.cdo.dawn.appearance.DawnElementStylizer; -import org.eclipse.emf.cdo.dawn.spi.DawnState; -import org.eclipse.emf.cdo.dawn.ui.stylizer.DawnElementStylizerRegistry; -import org.eclipse.emf.cdo.ui.CDOLabelProvider; -import org.eclipse.emf.cdo.util.CDOUtil; -import org.eclipse.emf.cdo.view.CDOView; - -import org.eclipse.emf.common.notify.AdapterFactory; -import org.eclipse.emf.ecore.EObject; - -import org.eclipse.jface.viewers.TreeViewer; -import org.eclipse.swt.graphics.Color; -import org.eclipse.swt.graphics.Image; - -/** - * @author Martin Fluegge - * @since 1.0 - */ -public class DawnLabelProvider extends CDOLabelProvider -{ - public DawnLabelProvider(AdapterFactory adapterFactory, CDOView view, TreeViewer viewer) - { - super(adapterFactory, view, viewer); - } - - @Override - public Color getForeground(Object object) - { - // makes sure that the object is adapted - Color foreground = super.getForeground(object); - - DawnElementStylizer stylizer = DawnElementStylizerRegistry.instance.getStylizer(object); - - CDOObject cdoObject = CDOUtil.getCDOObject((EObject)object); - if (cdoObject.cdoWriteLock().isLocked()) - { - return stylizer.getForegroundColor(cdoObject, DawnState.LOCKED_LOCALLY); - } - else if (CDOUtil.getCDOObject((EObject)object).cdoWriteLock().isLockedByOthers()) - { - return stylizer.getForegroundColor(cdoObject, DawnState.LOCKED_REMOTELY); - } - // Use default - return foreground; - } - - @Override - public Color getBackground(Object object) - { - // makes sure that the object is adapted - Color background = super.getBackground(object); - - DawnElementStylizer stylizer = DawnElementStylizerRegistry.instance.getStylizer(object); - - CDOObject cdoObject = CDOUtil.getCDOObject((EObject)object); - if (cdoObject.cdoWriteLock().isLocked()) - { - return stylizer.getBackgroundColor(cdoObject, DawnState.LOCKED_LOCALLY); - } - else if (CDOUtil.getCDOObject((EObject)object).cdoWriteLock().isLockedByOthers()) - { - return stylizer.getBackgroundColor(cdoObject, DawnState.LOCKED_REMOTELY); - } - // Use default - return background; - } - - @Override - public Image getImage(Object object) - { - DawnElementStylizer stylizer = DawnElementStylizerRegistry.instance.getStylizer(object); - - CDOObject cdoObject = CDOUtil.getCDOObject((EObject)object); - if (cdoObject.cdoWriteLock().isLocked()) - { - return stylizer.getImage(cdoObject, DawnState.LOCKED_LOCALLY); - } - else if (CDOUtil.getCDOObject((EObject)object).cdoWriteLock().isLockedByOthers()) - { - return stylizer.getImage(cdoObject, DawnState.LOCKED_REMOTELY); - } - - return super.getImage(object); - } -} +/*
+ * 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.ui;
+
+import org.eclipse.emf.cdo.CDOObject;
+import org.eclipse.emf.cdo.dawn.appearance.DawnElementStylizer;
+import org.eclipse.emf.cdo.dawn.spi.DawnState;
+import org.eclipse.emf.cdo.dawn.ui.stylizer.DawnElementStylizerRegistry;
+import org.eclipse.emf.cdo.ui.CDOLabelProvider;
+import org.eclipse.emf.cdo.util.CDOUtil;
+import org.eclipse.emf.cdo.view.CDOView;
+
+import org.eclipse.emf.common.notify.AdapterFactory;
+import org.eclipse.emf.ecore.EObject;
+
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * @author Martin Fluegge
+ * @since 1.0
+ */
+public class DawnLabelProvider extends CDOLabelProvider
+{
+ public DawnLabelProvider(AdapterFactory adapterFactory, CDOView view, TreeViewer viewer)
+ {
+ super(adapterFactory, view, viewer);
+ }
+
+ @Override
+ public Color getForeground(Object object)
+ {
+ // makes sure that the object is adapted
+ Color foreground = super.getForeground(object);
+
+ DawnElementStylizer stylizer = DawnElementStylizerRegistry.instance.getStylizer(object);
+
+ CDOObject cdoObject = CDOUtil.getCDOObject((EObject)object);
+ if (cdoObject.cdoWriteLock().isLocked())
+ {
+ return stylizer.getForegroundColor(cdoObject, DawnState.LOCKED_LOCALLY);
+ }
+ else if (CDOUtil.getCDOObject((EObject)object).cdoWriteLock().isLockedByOthers())
+ {
+ return stylizer.getForegroundColor(cdoObject, DawnState.LOCKED_REMOTELY);
+ }
+ // Use default
+ return foreground;
+ }
+
+ @Override
+ public Color getBackground(Object object)
+ {
+ // makes sure that the object is adapted
+ Color background = super.getBackground(object);
+
+ DawnElementStylizer stylizer = DawnElementStylizerRegistry.instance.getStylizer(object);
+
+ CDOObject cdoObject = CDOUtil.getCDOObject((EObject)object);
+ if (cdoObject.cdoWriteLock().isLocked())
+ {
+ return stylizer.getBackgroundColor(cdoObject, DawnState.LOCKED_LOCALLY);
+ }
+ else if (CDOUtil.getCDOObject((EObject)object).cdoWriteLock().isLockedByOthers())
+ {
+ return stylizer.getBackgroundColor(cdoObject, DawnState.LOCKED_REMOTELY);
+ }
+ // Use default
+ return background;
+ }
+
+ @Override
+ public Image getImage(Object object)
+ {
+ DawnElementStylizer stylizer = DawnElementStylizerRegistry.instance.getStylizer(object);
+
+ CDOObject cdoObject = CDOUtil.getCDOObject((EObject)object);
+ if (cdoObject.cdoWriteLock().isLocked())
+ {
+ return stylizer.getImage(cdoObject, DawnState.LOCKED_LOCALLY);
+ }
+ else if (CDOUtil.getCDOObject((EObject)object).cdoWriteLock().isLockedByOthers())
+ {
+ return stylizer.getImage(cdoObject, DawnState.LOCKED_REMOTELY);
+ }
+
+ return super.getImage(object);
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.dawn.ui/src/org/eclipse/emf/cdo/dawn/ui/DawnSelectionViewerAdapterFactoryContentProvider.java b/plugins/org.eclipse.emf.cdo.dawn.ui/src/org/eclipse/emf/cdo/dawn/ui/DawnSelectionViewerAdapterFactoryContentProvider.java index 96827f284e..0e7293e5fe 100644 --- a/plugins/org.eclipse.emf.cdo.dawn.ui/src/org/eclipse/emf/cdo/dawn/ui/DawnSelectionViewerAdapterFactoryContentProvider.java +++ b/plugins/org.eclipse.emf.cdo.dawn.ui/src/org/eclipse/emf/cdo/dawn/ui/DawnSelectionViewerAdapterFactoryContentProvider.java @@ -1,39 +1,39 @@ -/* - * 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.ui; - -import org.eclipse.emf.cdo.eresource.CDOResource; - -import org.eclipse.emf.common.notify.AdapterFactory; -import org.eclipse.emf.edit.ui.provider.AdapterFactoryContentProvider; - -/** - * @author Martin Fluegge - * @since 1.0 - */ -public class DawnSelectionViewerAdapterFactoryContentProvider extends AdapterFactoryContentProvider -{ - private final CDOResource cdoResource; - - public DawnSelectionViewerAdapterFactoryContentProvider(AdapterFactory adapterFactory, CDOResource cdoResource) - { - super(adapterFactory); - this.cdoResource = cdoResource; - } - - @Override - public Object[] getElements(Object object) - { - Object[] ret = new Object[1]; - ret[0] = cdoResource; - return ret; - } -} +/*
+ * 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.ui;
+
+import org.eclipse.emf.cdo.eresource.CDOResource;
+
+import org.eclipse.emf.common.notify.AdapterFactory;
+import org.eclipse.emf.edit.ui.provider.AdapterFactoryContentProvider;
+
+/**
+ * @author Martin Fluegge
+ * @since 1.0
+ */
+public class DawnSelectionViewerAdapterFactoryContentProvider extends AdapterFactoryContentProvider
+{
+ private final CDOResource cdoResource;
+
+ public DawnSelectionViewerAdapterFactoryContentProvider(AdapterFactory adapterFactory, CDOResource cdoResource)
+ {
+ super(adapterFactory);
+ this.cdoResource = cdoResource;
+ }
+
+ @Override
+ public Object[] getElements(Object object)
+ {
+ Object[] ret = new Object[1];
+ ret[0] = cdoResource;
+ return ret;
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.dawn.ui/src/org/eclipse/emf/cdo/dawn/ui/IDawnEditorInput.java b/plugins/org.eclipse.emf.cdo.dawn.ui/src/org/eclipse/emf/cdo/dawn/ui/IDawnEditorInput.java index 3bdd292118..bc1a7f34e6 100644 --- a/plugins/org.eclipse.emf.cdo.dawn.ui/src/org/eclipse/emf/cdo/dawn/ui/IDawnEditorInput.java +++ b/plugins/org.eclipse.emf.cdo.dawn.ui/src/org/eclipse/emf/cdo/dawn/ui/IDawnEditorInput.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.ui/src/org/eclipse/emf/cdo/dawn/ui/composites/CDOResourceNodeChooserComposite.java b/plugins/org.eclipse.emf.cdo.dawn.ui/src/org/eclipse/emf/cdo/dawn/ui/composites/CDOResourceNodeChooserComposite.java index 9e1fcd5043..6cb176bff0 100644 --- a/plugins/org.eclipse.emf.cdo.dawn.ui/src/org/eclipse/emf/cdo/dawn/ui/composites/CDOResourceNodeChooserComposite.java +++ b/plugins/org.eclipse.emf.cdo.dawn.ui/src/org/eclipse/emf/cdo/dawn/ui/composites/CDOResourceNodeChooserComposite.java @@ -1,416 +1,416 @@ -/* - * 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.ui.composites; - -import org.eclipse.emf.cdo.dawn.preferences.PreferenceConstants; -import org.eclipse.emf.cdo.dawn.ui.messages.Messages; -import org.eclipse.emf.cdo.eresource.CDOResource; -import org.eclipse.emf.cdo.eresource.CDOResourceNode; -import org.eclipse.emf.cdo.view.CDOView; - -import org.eclipse.emf.common.util.URI; - -import org.eclipse.jface.dialogs.IMessageProvider; -import org.eclipse.jface.viewers.ISelectionChangedListener; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.SelectionChangedEvent; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.KeyEvent; -import org.eclipse.swt.events.KeyListener; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Text; - -import java.util.Date; - -/** - * @author Martin Fluegge - * @since 1.0 - */ -public class CDOResourceNodeChooserComposite extends Composite -{ - private final String fileExtension; - - protected Text resourcePathComposite; - - protected Text resourceNameComposite; - - private String resourceNamePrefix = "default"; //$NON-NLS-1$ - - protected CDOResourceNodeSelectionWidget selectCDOResourceNodeComposite; - - private final CDOView view; - - private ResourceChooserValidator validator; - - public CDOResourceNodeChooserComposite(Composite parent, int style, String fileExtension, CDOView view) - { - super(parent, style); - this.fileExtension = fileExtension; - this.view = view; - init(); - setValidator(new ResourceChooserValidator()); - } - - private void createLayout() - { - GridLayout layout = new GridLayout(); - layout.numColumns = 1; - layout.marginWidth = 0; - setLayout(layout); - } - - public void setResourcePath(String resourcePath) - { - resourcePathComposite.setText(resourcePath); - } - - public void setResourceName(String resourceNamePrefix) - { - resourceNameComposite.setText(resourceNamePrefix); - } - - protected void init() - { - createLayout(); - createResourcePathInput(); - - createResourceSelectionComposite(); - - createResourceInput(); - } - - public String getResourceName() - { - return resourceNameComposite.getText(); - } - - public String getResourcePath() - { - return resourcePathComposite.getText(); - } - - private void createResourceSelectionComposite() - { - selectCDOResourceNodeComposite = new CDOResourceNodeSelectionWidget(this, SWT.NONE); - - GridData gd = new GridData(GridData.FILL_BOTH); - - selectCDOResourceNodeComposite.setLayoutData(gd); - - selectCDOResourceNodeComposite.addSelectionChangedListener(new ISelectionChangedListener() - { - public void selectionChanged(SelectionChangedEvent event) - { - if (event.getSelection().isEmpty()) - { - resourceNameComposite.setText(""); //$NON-NLS-1$ - return; - } - - if (event.getSelection() instanceof IStructuredSelection) - { - IStructuredSelection selection = (IStructuredSelection)event.getSelection(); - Object element = selection.getFirstElement(); - if (element instanceof CDOResource) - { - String resourceName = ((CDOResource)element).getName(); - resourcePathComposite.setText(((CDOResource)element).getPath().replace(resourceName, "")); //$NON-NLS-1$ - resourceNameComposite.setText(resourceName); - } - else if (element instanceof CDOResourceNode) - { - resourcePathComposite.setText(((CDOResourceNode)element).getPath()); - } - } - - getValidator().validate(); - } - }); - } - - private void createResourceInput() - { - Composite nameGroup = new Composite(this, SWT.NONE); - GridLayout layout = new GridLayout(); - layout.numColumns = 2; - layout.marginWidth = 0; - nameGroup.setLayout(layout); - nameGroup.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL)); - - Label label1 = new Label(nameGroup, SWT.NONE); - label1.setText(Messages.DawnCreateNewResourceWizardPage_6); - - resourceNameComposite = new Text(nameGroup, SWT.BORDER | SWT.SINGLE); - resourceNameComposite.setText(getDefaultName() + "." + fileExtension); //$NON-NLS-1$ - resourceNameComposite.addKeyListener(new KeyListener() - { - public void keyPressed(KeyEvent e) - { - } - - public void keyReleased(KeyEvent e) - { - getValidator().validate(); - } - }); - - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - resourceNameComposite.setLayoutData(gd); - } - - private GridData createResourcePathInput() - { - Label resourcePathLabel = new Label(this, SWT.NULL); - resourcePathLabel.setText(Messages.DawnCreateNewResourceWizardPage_8); - - resourcePathComposite = new Text(this, SWT.BORDER | SWT.SINGLE); - resourcePathComposite.setText(""); //$NON-NLS-1$ - resourcePathComposite.addKeyListener(new KeyListener() - { - public void keyPressed(KeyEvent e) - { - } - - public void keyReleased(KeyEvent e) - { - getValidator().validate(); - } - - }); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - resourcePathComposite.setLayoutData(gd); - return gd; - } - - public void createAutomaticResourceName() - { - int i = 2; - while (i < 30 && view.hasResource(getURI().path())) - { - resourceNameComposite.setText(getResourceNamePrefix() + i + "." + fileExtension); //$NON-NLS-1$ - i++; - } - - if (i < 30) - { - return; - } - // if we have tried 30 times to find a new resource name and still not succeeded just add a timestamp to the name - resourceNameComposite.setText(getResourceNamePrefix() + new Date().getTime() + "." + fileExtension); //$NON-NLS-1$ - } - - public URI getURI() - { - String resourcePath = getResourcePath(); - if (resourcePath.length() > 0) - { - if (resourcePath.startsWith("/")) //$NON-NLS-1$ - { - resourcePath = resourcePath.substring(1, resourcePath.length()); - } - if (!resourcePath.endsWith("/")) //$NON-NLS-1$ - { - resourcePath = resourcePath + "/"; //$NON-NLS-1$ - } - } - - String resourceName = getResourceName(); - String authority = PreferenceConstants.getRepositoryName(); - URI uri = URI.createURI("cdo://" + authority + "/" + resourcePath + resourceName); //$NON-NLS-1$ //$NON-NLS-2$ - - return uri; - } - - public String getDefaultName() - { - return getResourceNamePrefix(); - } - - public void showResources(boolean showResources) - { - selectCDOResourceNodeComposite.setShowResources(showResources); - } - - public void setResourceNamePrefix(String resourceNamePrefix) - { - this.resourceNamePrefix = resourceNamePrefix; - } - - public String getResourceNamePrefix() - { - return resourceNamePrefix; - } - - public void setValidator(ResourceChooserValidator validator) - { - this.validator = validator; - } - - public ResourceChooserValidator getValidator() - { - return validator; - } - - /** - * @author Martin Fluegge - */ - public class ResourceChooserValidator - { - public static final int VALIDATION_NONE = 0; - - public static final int VALIDATION_WARN = 1; - - public static final int VALIDATION_ERROR = 2; - - private int resourceValidationType = VALIDATION_ERROR; - - private boolean valid; - - private int messageType = IMessageProvider.NONE; - - private String message; - - private ValidationListener validationListener; - - public ResourceChooserValidator() - { - } - - public void validate() - { - internalValidate(); - if (validationListener != null) - { - validationListener.validationFinished(); - } - } - - private void internalValidate() - { - setValid(true); - - if (getResourceName().length() == 0) - { - setMessage(Messages.DawnCreateNewResourceWizardPage_10, IMessageProvider.ERROR); - setValid(false); - return; - } - - if (!getResourceName().endsWith("." + fileExtension)) - { - setValid(false); - setMessage(Messages.CDOResourceNodeChooserComposite_1 + fileExtension, IMessageProvider.ERROR); - return; - } - - if (view != null && getResourceValidationType() != VALIDATION_NONE) - { - try - { - if (view.hasResource(getURI().path())) - { - if (getResourceValidationType() == VALIDATION_WARN) - { - setMessage(Messages.DawnCreateNewResourceWizardPage_11, IMessageProvider.WARNING); - setMessageType(IMessageProvider.WARNING); - setValid(true); - return; - } - else if (getResourceValidationType() == VALIDATION_ERROR) - { - setMessage(Messages.DawnCreateNewResourceWizardPage_12, IMessageProvider.ERROR); - setValid(false); - setMessageType(IMessageProvider.ERROR); - return; - } - } - } - catch (Exception e) - { - setMessage(e.getMessage()); - setMessageType(IMessageProvider.ERROR); - } - } - if (isValid()) - { - setMessage(null); - setMessageType(IMessageProvider.NONE); - } - } - - private void setMessage(String message, int type) - { - setMessage(message); - setMessageType(type); - } - - public void setValid(boolean valid) - { - this.valid = valid; - } - - public boolean isValid() - { - return valid; - } - - public void setMessage(String message) - { - this.message = message; - } - - public String getMessage() - { - return message; - } - - public void setMessageType(int messageType) - { - this.messageType = messageType; - } - - public int getMessageType() - { - return messageType; - } - - public void setResourceValidationType(int resourceValidationType) - { - this.resourceValidationType = resourceValidationType; - } - - public int getResourceValidationType() - { - return resourceValidationType; - } - - public void setValidationListener(ValidationListener validationListener) - { - this.validationListener = validationListener; - } - - public ValidationListener getValidationListener() - { - return validationListener; - } - } - - /** - * @author Martin Fluegge - */ - public static interface ValidationListener - { - public void validationFinished(); - } -} +/*
+ * 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.ui.composites;
+
+import org.eclipse.emf.cdo.dawn.preferences.PreferenceConstants;
+import org.eclipse.emf.cdo.dawn.ui.messages.Messages;
+import org.eclipse.emf.cdo.eresource.CDOResource;
+import org.eclipse.emf.cdo.eresource.CDOResourceNode;
+import org.eclipse.emf.cdo.view.CDOView;
+
+import org.eclipse.emf.common.util.URI;
+
+import org.eclipse.jface.dialogs.IMessageProvider;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.KeyEvent;
+import org.eclipse.swt.events.KeyListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Text;
+
+import java.util.Date;
+
+/**
+ * @author Martin Fluegge
+ * @since 1.0
+ */
+public class CDOResourceNodeChooserComposite extends Composite
+{
+ private final String fileExtension;
+
+ protected Text resourcePathComposite;
+
+ protected Text resourceNameComposite;
+
+ private String resourceNamePrefix = "default"; //$NON-NLS-1$
+
+ protected CDOResourceNodeSelectionWidget selectCDOResourceNodeComposite;
+
+ private final CDOView view;
+
+ private ResourceChooserValidator validator;
+
+ public CDOResourceNodeChooserComposite(Composite parent, int style, String fileExtension, CDOView view)
+ {
+ super(parent, style);
+ this.fileExtension = fileExtension;
+ this.view = view;
+ init();
+ setValidator(new ResourceChooserValidator());
+ }
+
+ private void createLayout()
+ {
+ GridLayout layout = new GridLayout();
+ layout.numColumns = 1;
+ layout.marginWidth = 0;
+ setLayout(layout);
+ }
+
+ public void setResourcePath(String resourcePath)
+ {
+ resourcePathComposite.setText(resourcePath);
+ }
+
+ public void setResourceName(String resourceNamePrefix)
+ {
+ resourceNameComposite.setText(resourceNamePrefix);
+ }
+
+ protected void init()
+ {
+ createLayout();
+ createResourcePathInput();
+
+ createResourceSelectionComposite();
+
+ createResourceInput();
+ }
+
+ public String getResourceName()
+ {
+ return resourceNameComposite.getText();
+ }
+
+ public String getResourcePath()
+ {
+ return resourcePathComposite.getText();
+ }
+
+ private void createResourceSelectionComposite()
+ {
+ selectCDOResourceNodeComposite = new CDOResourceNodeSelectionWidget(this, SWT.NONE);
+
+ GridData gd = new GridData(GridData.FILL_BOTH);
+
+ selectCDOResourceNodeComposite.setLayoutData(gd);
+
+ selectCDOResourceNodeComposite.addSelectionChangedListener(new ISelectionChangedListener()
+ {
+ public void selectionChanged(SelectionChangedEvent event)
+ {
+ if (event.getSelection().isEmpty())
+ {
+ resourceNameComposite.setText(""); //$NON-NLS-1$
+ return;
+ }
+
+ if (event.getSelection() instanceof IStructuredSelection)
+ {
+ IStructuredSelection selection = (IStructuredSelection)event.getSelection();
+ Object element = selection.getFirstElement();
+ if (element instanceof CDOResource)
+ {
+ String resourceName = ((CDOResource)element).getName();
+ resourcePathComposite.setText(((CDOResource)element).getPath().replace(resourceName, "")); //$NON-NLS-1$
+ resourceNameComposite.setText(resourceName);
+ }
+ else if (element instanceof CDOResourceNode)
+ {
+ resourcePathComposite.setText(((CDOResourceNode)element).getPath());
+ }
+ }
+
+ getValidator().validate();
+ }
+ });
+ }
+
+ private void createResourceInput()
+ {
+ Composite nameGroup = new Composite(this, SWT.NONE);
+ GridLayout layout = new GridLayout();
+ layout.numColumns = 2;
+ layout.marginWidth = 0;
+ nameGroup.setLayout(layout);
+ nameGroup.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL));
+
+ Label label1 = new Label(nameGroup, SWT.NONE);
+ label1.setText(Messages.DawnCreateNewResourceWizardPage_6);
+
+ resourceNameComposite = new Text(nameGroup, SWT.BORDER | SWT.SINGLE);
+ resourceNameComposite.setText(getDefaultName() + "." + fileExtension); //$NON-NLS-1$
+ resourceNameComposite.addKeyListener(new KeyListener()
+ {
+ public void keyPressed(KeyEvent e)
+ {
+ }
+
+ public void keyReleased(KeyEvent e)
+ {
+ getValidator().validate();
+ }
+ });
+
+ GridData gd = new GridData(GridData.FILL_HORIZONTAL);
+ resourceNameComposite.setLayoutData(gd);
+ }
+
+ private GridData createResourcePathInput()
+ {
+ Label resourcePathLabel = new Label(this, SWT.NULL);
+ resourcePathLabel.setText(Messages.DawnCreateNewResourceWizardPage_8);
+
+ resourcePathComposite = new Text(this, SWT.BORDER | SWT.SINGLE);
+ resourcePathComposite.setText(""); //$NON-NLS-1$
+ resourcePathComposite.addKeyListener(new KeyListener()
+ {
+ public void keyPressed(KeyEvent e)
+ {
+ }
+
+ public void keyReleased(KeyEvent e)
+ {
+ getValidator().validate();
+ }
+
+ });
+ GridData gd = new GridData(GridData.FILL_HORIZONTAL);
+ resourcePathComposite.setLayoutData(gd);
+ return gd;
+ }
+
+ public void createAutomaticResourceName()
+ {
+ int i = 2;
+ while (i < 30 && view.hasResource(getURI().path()))
+ {
+ resourceNameComposite.setText(getResourceNamePrefix() + i + "." + fileExtension); //$NON-NLS-1$
+ i++;
+ }
+
+ if (i < 30)
+ {
+ return;
+ }
+ // if we have tried 30 times to find a new resource name and still not succeeded just add a timestamp to the name
+ resourceNameComposite.setText(getResourceNamePrefix() + new Date().getTime() + "." + fileExtension); //$NON-NLS-1$
+ }
+
+ public URI getURI()
+ {
+ String resourcePath = getResourcePath();
+ if (resourcePath.length() > 0)
+ {
+ if (resourcePath.startsWith("/")) //$NON-NLS-1$
+ {
+ resourcePath = resourcePath.substring(1, resourcePath.length());
+ }
+ if (!resourcePath.endsWith("/")) //$NON-NLS-1$
+ {
+ resourcePath = resourcePath + "/"; //$NON-NLS-1$
+ }
+ }
+
+ String resourceName = getResourceName();
+ String authority = PreferenceConstants.getRepositoryName();
+ URI uri = URI.createURI("cdo://" + authority + "/" + resourcePath + resourceName); //$NON-NLS-1$ //$NON-NLS-2$
+
+ return uri;
+ }
+
+ public String getDefaultName()
+ {
+ return getResourceNamePrefix();
+ }
+
+ public void showResources(boolean showResources)
+ {
+ selectCDOResourceNodeComposite.setShowResources(showResources);
+ }
+
+ public void setResourceNamePrefix(String resourceNamePrefix)
+ {
+ this.resourceNamePrefix = resourceNamePrefix;
+ }
+
+ public String getResourceNamePrefix()
+ {
+ return resourceNamePrefix;
+ }
+
+ public void setValidator(ResourceChooserValidator validator)
+ {
+ this.validator = validator;
+ }
+
+ public ResourceChooserValidator getValidator()
+ {
+ return validator;
+ }
+
+ /**
+ * @author Martin Fluegge
+ */
+ public class ResourceChooserValidator
+ {
+ public static final int VALIDATION_NONE = 0;
+
+ public static final int VALIDATION_WARN = 1;
+
+ public static final int VALIDATION_ERROR = 2;
+
+ private int resourceValidationType = VALIDATION_ERROR;
+
+ private boolean valid;
+
+ private int messageType = IMessageProvider.NONE;
+
+ private String message;
+
+ private ValidationListener validationListener;
+
+ public ResourceChooserValidator()
+ {
+ }
+
+ public void validate()
+ {
+ internalValidate();
+ if (validationListener != null)
+ {
+ validationListener.validationFinished();
+ }
+ }
+
+ private void internalValidate()
+ {
+ setValid(true);
+
+ if (getResourceName().length() == 0)
+ {
+ setMessage(Messages.DawnCreateNewResourceWizardPage_10, IMessageProvider.ERROR);
+ setValid(false);
+ return;
+ }
+
+ if (!getResourceName().endsWith("." + fileExtension))
+ {
+ setValid(false);
+ setMessage(Messages.CDOResourceNodeChooserComposite_1 + fileExtension, IMessageProvider.ERROR);
+ return;
+ }
+
+ if (view != null && getResourceValidationType() != VALIDATION_NONE)
+ {
+ try
+ {
+ if (view.hasResource(getURI().path()))
+ {
+ if (getResourceValidationType() == VALIDATION_WARN)
+ {
+ setMessage(Messages.DawnCreateNewResourceWizardPage_11, IMessageProvider.WARNING);
+ setMessageType(IMessageProvider.WARNING);
+ setValid(true);
+ return;
+ }
+ else if (getResourceValidationType() == VALIDATION_ERROR)
+ {
+ setMessage(Messages.DawnCreateNewResourceWizardPage_12, IMessageProvider.ERROR);
+ setValid(false);
+ setMessageType(IMessageProvider.ERROR);
+ return;
+ }
+ }
+ }
+ catch (Exception e)
+ {
+ setMessage(e.getMessage());
+ setMessageType(IMessageProvider.ERROR);
+ }
+ }
+ if (isValid())
+ {
+ setMessage(null);
+ setMessageType(IMessageProvider.NONE);
+ }
+ }
+
+ private void setMessage(String message, int type)
+ {
+ setMessage(message);
+ setMessageType(type);
+ }
+
+ public void setValid(boolean valid)
+ {
+ this.valid = valid;
+ }
+
+ public boolean isValid()
+ {
+ return valid;
+ }
+
+ public void setMessage(String message)
+ {
+ this.message = message;
+ }
+
+ public String getMessage()
+ {
+ return message;
+ }
+
+ public void setMessageType(int messageType)
+ {
+ this.messageType = messageType;
+ }
+
+ public int getMessageType()
+ {
+ return messageType;
+ }
+
+ public void setResourceValidationType(int resourceValidationType)
+ {
+ this.resourceValidationType = resourceValidationType;
+ }
+
+ public int getResourceValidationType()
+ {
+ return resourceValidationType;
+ }
+
+ public void setValidationListener(ValidationListener validationListener)
+ {
+ this.validationListener = validationListener;
+ }
+
+ public ValidationListener getValidationListener()
+ {
+ return validationListener;
+ }
+ }
+
+ /**
+ * @author Martin Fluegge
+ */
+ public static interface ValidationListener
+ {
+ public void validationFinished();
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.dawn.ui/src/org/eclipse/emf/cdo/dawn/ui/composites/CDOResourceNodeSelectionWidget.java b/plugins/org.eclipse.emf.cdo.dawn.ui/src/org/eclipse/emf/cdo/dawn/ui/composites/CDOResourceNodeSelectionWidget.java index d6897b2089..59201394cc 100644 --- a/plugins/org.eclipse.emf.cdo.dawn.ui/src/org/eclipse/emf/cdo/dawn/ui/composites/CDOResourceNodeSelectionWidget.java +++ b/plugins/org.eclipse.emf.cdo.dawn.ui/src/org/eclipse/emf/cdo/dawn/ui/composites/CDOResourceNodeSelectionWidget.java @@ -1,147 +1,147 @@ -/* - * 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.ui.composites; - -import org.eclipse.emf.cdo.dawn.ui.views.DawnWizardPageItemProvider; -import org.eclipse.emf.cdo.eresource.CDOResource; -import org.eclipse.emf.cdo.session.CDOSession; - -import org.eclipse.net4j.util.container.IContainer; -import org.eclipse.net4j.util.container.IManagedContainer; -import org.eclipse.net4j.util.container.IPluginContainer; -import org.eclipse.net4j.util.ui.views.ContainerItemProvider; -import org.eclipse.net4j.util.ui.views.IElementFilter; - -import org.eclipse.jface.viewers.DecoratingLabelProvider; -import org.eclipse.jface.viewers.IBaseLabelProvider; -import org.eclipse.jface.viewers.IContentProvider; -import org.eclipse.jface.viewers.ILabelDecorator; -import org.eclipse.jface.viewers.ISelectionChangedListener; -import org.eclipse.jface.viewers.TreeViewer; -import org.eclipse.jface.viewers.Viewer; -import org.eclipse.jface.viewers.ViewerFilter; -import org.eclipse.swt.SWT; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.ui.PlatformUI; - -/** - * @author Martin Fluegge - * @since 1.0 - */ -public class CDOResourceNodeSelectionWidget extends Composite -{ - private ContainerItemProvider<IContainer<Object>> itemProvider; - - private ShowResourcesViewFilter viewFilter; - - private TreeViewer viewer; - - public CDOResourceNodeSelectionWidget(Composite parent, int style) - { - super(parent, style); - GridLayout layout = new GridLayout(); - layout.numColumns = 1; - layout.marginWidth = 0; - setLayout(layout); - init(); - } - - public void setShowResources(boolean showResources) - { - viewFilter.setShowResources(showResources); - } - - protected void init() - { - viewer = new TreeViewer(this, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER); - itemProvider = createContainerItemProvider(); - viewer.setContentProvider(createContentProvider()); - viewer.setLabelProvider(createLabelProvider()); - viewer.getTree().setLayoutData(new GridData(GridData.FILL_BOTH)); - viewer.setInput(getManagedContainer()); - - viewFilter = new ShowResourcesViewFilter(); - viewer.addFilter(viewFilter); - } - - public void addSelectionChangedListener(ISelectionChangedListener listener) - { - viewer.addSelectionChangedListener(listener); - } - - public void removeSelectionChangedListener(ISelectionChangedListener listener) - { - viewer.removeSelectionChangedListener(listener); - } - - protected IManagedContainer getManagedContainer() - { - return IPluginContainer.INSTANCE; - } - - protected IContentProvider createContentProvider() - { - return itemProvider; - } - - protected IBaseLabelProvider createLabelProvider() - { - ILabelDecorator labelDecorator = createLabelDecorator(); - return new DecoratingLabelProvider(itemProvider, labelDecorator); - } - - protected ILabelDecorator createLabelDecorator() - { - return PlatformUI.getWorkbench().getDecoratorManager().getLabelDecorator(); - } - - protected ContainerItemProvider<IContainer<Object>> createContainerItemProvider() - { - return new DawnWizardPageItemProvider<IContainer<Object>>(new IElementFilter() - { - public boolean filter(Object element) - { - return element instanceof CDOSession; - } - }); - } - - /** - * @author Martin Fluegge - */ - protected class ShowResourcesViewFilter extends ViewerFilter - { - private boolean showResources; - - @Override - public boolean select(Viewer viewer, Object parentElement, Object element) - { - if (element instanceof CDOResource) - { - return isShowResources(); - } - - return true; - } - - public void setShowResources(boolean showResources) - { - this.showResources = showResources; - } - - public boolean isShowResources() - { - return showResources; - } - } -} +/*
+ * 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.ui.composites;
+
+import org.eclipse.emf.cdo.dawn.ui.views.DawnWizardPageItemProvider;
+import org.eclipse.emf.cdo.eresource.CDOResource;
+import org.eclipse.emf.cdo.session.CDOSession;
+
+import org.eclipse.net4j.util.container.IContainer;
+import org.eclipse.net4j.util.container.IManagedContainer;
+import org.eclipse.net4j.util.container.IPluginContainer;
+import org.eclipse.net4j.util.ui.views.ContainerItemProvider;
+import org.eclipse.net4j.util.ui.views.IElementFilter;
+
+import org.eclipse.jface.viewers.DecoratingLabelProvider;
+import org.eclipse.jface.viewers.IBaseLabelProvider;
+import org.eclipse.jface.viewers.IContentProvider;
+import org.eclipse.jface.viewers.ILabelDecorator;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.viewers.ViewerFilter;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.PlatformUI;
+
+/**
+ * @author Martin Fluegge
+ * @since 1.0
+ */
+public class CDOResourceNodeSelectionWidget extends Composite
+{
+ private ContainerItemProvider<IContainer<Object>> itemProvider;
+
+ private ShowResourcesViewFilter viewFilter;
+
+ private TreeViewer viewer;
+
+ public CDOResourceNodeSelectionWidget(Composite parent, int style)
+ {
+ super(parent, style);
+ GridLayout layout = new GridLayout();
+ layout.numColumns = 1;
+ layout.marginWidth = 0;
+ setLayout(layout);
+ init();
+ }
+
+ public void setShowResources(boolean showResources)
+ {
+ viewFilter.setShowResources(showResources);
+ }
+
+ protected void init()
+ {
+ viewer = new TreeViewer(this, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
+ itemProvider = createContainerItemProvider();
+ viewer.setContentProvider(createContentProvider());
+ viewer.setLabelProvider(createLabelProvider());
+ viewer.getTree().setLayoutData(new GridData(GridData.FILL_BOTH));
+ viewer.setInput(getManagedContainer());
+
+ viewFilter = new ShowResourcesViewFilter();
+ viewer.addFilter(viewFilter);
+ }
+
+ public void addSelectionChangedListener(ISelectionChangedListener listener)
+ {
+ viewer.addSelectionChangedListener(listener);
+ }
+
+ public void removeSelectionChangedListener(ISelectionChangedListener listener)
+ {
+ viewer.removeSelectionChangedListener(listener);
+ }
+
+ protected IManagedContainer getManagedContainer()
+ {
+ return IPluginContainer.INSTANCE;
+ }
+
+ protected IContentProvider createContentProvider()
+ {
+ return itemProvider;
+ }
+
+ protected IBaseLabelProvider createLabelProvider()
+ {
+ ILabelDecorator labelDecorator = createLabelDecorator();
+ return new DecoratingLabelProvider(itemProvider, labelDecorator);
+ }
+
+ protected ILabelDecorator createLabelDecorator()
+ {
+ return PlatformUI.getWorkbench().getDecoratorManager().getLabelDecorator();
+ }
+
+ protected ContainerItemProvider<IContainer<Object>> createContainerItemProvider()
+ {
+ return new DawnWizardPageItemProvider<IContainer<Object>>(new IElementFilter()
+ {
+ public boolean filter(Object element)
+ {
+ return element instanceof CDOSession;
+ }
+ });
+ }
+
+ /**
+ * @author Martin Fluegge
+ */
+ protected class ShowResourcesViewFilter extends ViewerFilter
+ {
+ private boolean showResources;
+
+ @Override
+ public boolean select(Viewer viewer, Object parentElement, Object element)
+ {
+ if (element instanceof CDOResource)
+ {
+ return isShowResources();
+ }
+
+ return true;
+ }
+
+ public void setShowResources(boolean showResources)
+ {
+ this.showResources = showResources;
+ }
+
+ public boolean isShowResources()
+ {
+ return showResources;
+ }
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.dawn.ui/src/org/eclipse/emf/cdo/dawn/ui/handlers/LockObjectsHandler.java b/plugins/org.eclipse.emf.cdo.dawn.ui/src/org/eclipse/emf/cdo/dawn/ui/handlers/LockObjectsHandler.java index 0d0a724496..a9b80eb746 100644 --- a/plugins/org.eclipse.emf.cdo.dawn.ui/src/org/eclipse/emf/cdo/dawn/ui/handlers/LockObjectsHandler.java +++ b/plugins/org.eclipse.emf.cdo.dawn.ui/src/org/eclipse/emf/cdo/dawn/ui/handlers/LockObjectsHandler.java @@ -1,31 +1,31 @@ -/* - * Copyright (c) 2004 - 2011 Eike Stepper (Berlin, Germany) and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Eike Stepper - initial API and implementation - */ -package org.eclipse.emf.cdo.dawn.ui.handlers; - -import org.eclipse.emf.cdo.dawn.editors.IDawnEditor; -import org.eclipse.emf.cdo.dawn.helper.DawnEditorHelper; - -import org.eclipse.core.commands.ExecutionEvent; -import org.eclipse.core.commands.ExecutionException; - -/** - * @author Martin Fluegge - * @since 2.0 - */ -public class LockObjectsHandler extends SelectionHandler -{ - public Object execute(ExecutionEvent event) throws ExecutionException - { - ((IDawnEditor)DawnEditorHelper.getActiveEditor()).getDawnEditorSupport().lockObjects(getSelectedObjects(event)); - - 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:
+ * Eike Stepper - initial API and implementation
+ */
+package org.eclipse.emf.cdo.dawn.ui.handlers;
+
+import org.eclipse.emf.cdo.dawn.editors.IDawnEditor;
+import org.eclipse.emf.cdo.dawn.helper.DawnEditorHelper;
+
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+
+/**
+ * @author Martin Fluegge
+ * @since 2.0
+ */
+public class LockObjectsHandler extends SelectionHandler
+{
+ public Object execute(ExecutionEvent event) throws ExecutionException
+ {
+ ((IDawnEditor)DawnEditorHelper.getActiveEditor()).getDawnEditorSupport().lockObjects(getSelectedObjects(event));
+
+ return null;
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.dawn.ui/src/org/eclipse/emf/cdo/dawn/ui/handlers/SelectionHandler.java b/plugins/org.eclipse.emf.cdo.dawn.ui/src/org/eclipse/emf/cdo/dawn/ui/handlers/SelectionHandler.java index 286777b1a7..112f15a92b 100644 --- a/plugins/org.eclipse.emf.cdo.dawn.ui/src/org/eclipse/emf/cdo/dawn/ui/handlers/SelectionHandler.java +++ b/plugins/org.eclipse.emf.cdo.dawn.ui/src/org/eclipse/emf/cdo/dawn/ui/handlers/SelectionHandler.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.ui/src/org/eclipse/emf/cdo/dawn/ui/handlers/SolveConflictHandler.java b/plugins/org.eclipse.emf.cdo.dawn.ui/src/org/eclipse/emf/cdo/dawn/ui/handlers/SolveConflictHandler.java index 351dcd76ac..88f82791c2 100644 --- a/plugins/org.eclipse.emf.cdo.dawn.ui/src/org/eclipse/emf/cdo/dawn/ui/handlers/SolveConflictHandler.java +++ b/plugins/org.eclipse.emf.cdo.dawn.ui/src/org/eclipse/emf/cdo/dawn/ui/handlers/SolveConflictHandler.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: - * Eike Stepper - initial API and implementation - */ -package org.eclipse.emf.cdo.dawn.ui.handlers; - -import org.eclipse.emf.cdo.dawn.editors.IDawnEditor; -import org.eclipse.emf.cdo.dawn.helper.DawnEditorHelper; -import org.eclipse.emf.cdo.dawn.internal.ui.bundle.OM; - -import org.eclipse.net4j.util.om.trace.ContextTracer; - -import org.eclipse.core.commands.AbstractHandler; -import org.eclipse.core.commands.ExecutionEvent; -import org.eclipse.core.commands.ExecutionException; -import org.eclipse.jface.dialogs.MessageDialog; -import org.eclipse.ui.IEditorPart; - -/** - * @author Martin Fluegge - */ -public class SolveConflictHandler extends AbstractHandler -{ - private static final ContextTracer TRACER = new ContextTracer(OM.DEBUG, SolveConflictHandler.class); - - public Object execute(ExecutionEvent event) throws ExecutionException - { - IEditorPart activeEditor = DawnEditorHelper.getActiveEditor(); - - if (TRACER.isEnabled()) - { - TRACER.format("Start solving conflicts for {0}", activeEditor); //$NON-NLS-1$ - } - - if (activeEditor instanceof IDawnEditor) - { - MessageDialog dialog = new MessageDialog(DawnEditorHelper.getActiveShell(), "Conflict", null, - "There are conflicts in your diagram. Would you like to rollback your current transaction?", - MessageDialog.QUESTION, new String[] { "yes", "no", "Cancel" }, 1); - - switch (dialog.open()) - { - case 0: // yes - ((IDawnEditor)activeEditor).getDawnEditorSupport().rollback(); - break; - case 1: // no - break; - default: // cancel - break; - } - } - 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:
+ * Eike Stepper - initial API and implementation
+ */
+package org.eclipse.emf.cdo.dawn.ui.handlers;
+
+import org.eclipse.emf.cdo.dawn.editors.IDawnEditor;
+import org.eclipse.emf.cdo.dawn.helper.DawnEditorHelper;
+import org.eclipse.emf.cdo.dawn.internal.ui.bundle.OM;
+
+import org.eclipse.net4j.util.om.trace.ContextTracer;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.ui.IEditorPart;
+
+/**
+ * @author Martin Fluegge
+ */
+public class SolveConflictHandler extends AbstractHandler
+{
+ private static final ContextTracer TRACER = new ContextTracer(OM.DEBUG, SolveConflictHandler.class);
+
+ public Object execute(ExecutionEvent event) throws ExecutionException
+ {
+ IEditorPart activeEditor = DawnEditorHelper.getActiveEditor();
+
+ if (TRACER.isEnabled())
+ {
+ TRACER.format("Start solving conflicts for {0}", activeEditor); //$NON-NLS-1$
+ }
+
+ if (activeEditor instanceof IDawnEditor)
+ {
+ MessageDialog dialog = new MessageDialog(DawnEditorHelper.getActiveShell(), "Conflict", null,
+ "There are conflicts in your diagram. Would you like to rollback your current transaction?",
+ MessageDialog.QUESTION, new String[] { "yes", "no", "Cancel" }, 1);
+
+ switch (dialog.open())
+ {
+ case 0: // yes
+ ((IDawnEditor)activeEditor).getDawnEditorSupport().rollback();
+ break;
+ case 1: // no
+ break;
+ default: // cancel
+ break;
+ }
+ }
+ return null;
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.dawn.ui/src/org/eclipse/emf/cdo/dawn/ui/handlers/UnLockObjectsHandler.java b/plugins/org.eclipse.emf.cdo.dawn.ui/src/org/eclipse/emf/cdo/dawn/ui/handlers/UnLockObjectsHandler.java index 5c9ad2ac8c..4c0898a82e 100644 --- a/plugins/org.eclipse.emf.cdo.dawn.ui/src/org/eclipse/emf/cdo/dawn/ui/handlers/UnLockObjectsHandler.java +++ b/plugins/org.eclipse.emf.cdo.dawn.ui/src/org/eclipse/emf/cdo/dawn/ui/handlers/UnLockObjectsHandler.java @@ -1,31 +1,31 @@ -/* - * Copyright (c) 2004 - 2011 Eike Stepper (Berlin, Germany) and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Eike Stepper - initial API and implementation - */ -package org.eclipse.emf.cdo.dawn.ui.handlers; - -import org.eclipse.emf.cdo.dawn.editors.IDawnEditor; -import org.eclipse.emf.cdo.dawn.helper.DawnEditorHelper; - -import org.eclipse.core.commands.ExecutionEvent; -import org.eclipse.core.commands.ExecutionException; - -/** - * @author Martin Fluegge - * @since 2.0 - */ -public class UnLockObjectsHandler extends SelectionHandler -{ - public Object execute(ExecutionEvent event) throws ExecutionException - { - ((IDawnEditor)DawnEditorHelper.getActiveEditor()).getDawnEditorSupport().unlockObjects(getSelectedObjects(event)); - - 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:
+ * Eike Stepper - initial API and implementation
+ */
+package org.eclipse.emf.cdo.dawn.ui.handlers;
+
+import org.eclipse.emf.cdo.dawn.editors.IDawnEditor;
+import org.eclipse.emf.cdo.dawn.helper.DawnEditorHelper;
+
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+
+/**
+ * @author Martin Fluegge
+ * @since 2.0
+ */
+public class UnLockObjectsHandler extends SelectionHandler
+{
+ public Object execute(ExecutionEvent event) throws ExecutionException
+ {
+ ((IDawnEditor)DawnEditorHelper.getActiveEditor()).getDawnEditorSupport().unlockObjects(getSelectedObjects(event));
+
+ return null;
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.dawn.ui/src/org/eclipse/emf/cdo/dawn/ui/helper/EditorDescriptionHelper.java b/plugins/org.eclipse.emf.cdo.dawn.ui/src/org/eclipse/emf/cdo/dawn/ui/helper/EditorDescriptionHelper.java index 014a68a223..5e583a086e 100644 --- a/plugins/org.eclipse.emf.cdo.dawn.ui/src/org/eclipse/emf/cdo/dawn/ui/helper/EditorDescriptionHelper.java +++ b/plugins/org.eclipse.emf.cdo.dawn.ui/src/org/eclipse/emf/cdo/dawn/ui/helper/EditorDescriptionHelper.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.ui/src/org/eclipse/emf/cdo/dawn/ui/icons/DawnIconRegistry.java b/plugins/org.eclipse.emf.cdo.dawn.ui/src/org/eclipse/emf/cdo/dawn/ui/icons/DawnIconRegistry.java index 535c83ecbe..8b79eccae4 100644 --- a/plugins/org.eclipse.emf.cdo.dawn.ui/src/org/eclipse/emf/cdo/dawn/ui/icons/DawnIconRegistry.java +++ b/plugins/org.eclipse.emf.cdo.dawn.ui/src/org/eclipse/emf/cdo/dawn/ui/icons/DawnIconRegistry.java @@ -1,103 +1,103 @@ -/* - * 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 - * Victor Roldan Betancort - maintenance - */ -package org.eclipse.emf.cdo.dawn.ui.icons; - -import org.eclipse.emf.cdo.dawn.internal.ui.bundle.OM; - -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.jface.resource.ImageRegistry; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.widgets.Display; -import org.eclipse.ui.plugin.AbstractUIPlugin; - -/** - * Based on the implementation from org.eclipse.emf.cdo.ui.shared.SharedIcons. TODO clarify with Eike whether we could - * provide a better extensibility. - * - * @author Martin Fluegge - * @since 2.0 - */ -public class DawnIconRegistry -{ - private static final String GIF = ".gif"; //$NON-NLS-1$ - - private static final String PNG = ".png"; //$NON-NLS-1$ - - private static final ImageRegistry REGISTRY = new ImageRegistry(getDisplay()); - - private static final String ICONS_FOLDER = "icons/"; //$NON-NLS-1$ - - public static final String LOCKED = ICONS_FOLDER + "dawn_locked_16x16" + GIF; //$NON-NLS-1$ - - public static final String DAWN_LIGHT = ICONS_FOLDER + "dawn_16x16" + PNG; //$NON-NLS-1$ - - public static final String DAWN_DARK = ICONS_FOLDER + "dawn_16x16" + GIF; //$NON-NLS-1$ - - public static Image getImage(String key) - { - Image image = REGISTRY.get(key); - if (image == null) - { - createDescriptor(key); - image = REGISTRY.get(key); - } - - // For some reason, sometimes images get disposed. - // In that case, create and put in registry again. - if (image.isDisposed()) - { - REGISTRY.remove(key); - createDescriptor(key); - image = REGISTRY.get(key); - } - - return image; - } - - public static ImageDescriptor getDescriptor(String key) - { - ImageDescriptor descriptor = REGISTRY.getDescriptor(key); - if (descriptor == null) - { - descriptor = createDescriptor(key); - } - - return descriptor; - } - - private static ImageDescriptor createDescriptor(String key) - { - ImageDescriptor descriptor = AbstractUIPlugin.imageDescriptorFromPlugin(OM.BUNDLE_ID, key); - if (descriptor != null) - { - REGISTRY.put(key, descriptor); - } - - return descriptor; - } - - private static Display getDisplay() - { - Display display = Display.getCurrent(); - if (display == null) - { - display = Display.getDefault(); - } - - if (display == null) - { - throw new IllegalStateException("display == null"); //$NON-NLS-1$ - } - - return display; - } -} +/*
+ * 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
+ * Victor Roldan Betancort - maintenance
+ */
+package org.eclipse.emf.cdo.dawn.ui.icons;
+
+import org.eclipse.emf.cdo.dawn.internal.ui.bundle.OM;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.resource.ImageRegistry;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+
+/**
+ * Based on the implementation from org.eclipse.emf.cdo.ui.shared.SharedIcons. TODO clarify with Eike whether we could
+ * provide a better extensibility.
+ *
+ * @author Martin Fluegge
+ * @since 2.0
+ */
+public class DawnIconRegistry
+{
+ private static final String GIF = ".gif"; //$NON-NLS-1$
+
+ private static final String PNG = ".png"; //$NON-NLS-1$
+
+ private static final ImageRegistry REGISTRY = new ImageRegistry(getDisplay());
+
+ private static final String ICONS_FOLDER = "icons/"; //$NON-NLS-1$
+
+ public static final String LOCKED = ICONS_FOLDER + "dawn_locked_16x16" + GIF; //$NON-NLS-1$
+
+ public static final String DAWN_LIGHT = ICONS_FOLDER + "dawn_16x16" + PNG; //$NON-NLS-1$
+
+ public static final String DAWN_DARK = ICONS_FOLDER + "dawn_16x16" + GIF; //$NON-NLS-1$
+
+ public static Image getImage(String key)
+ {
+ Image image = REGISTRY.get(key);
+ if (image == null)
+ {
+ createDescriptor(key);
+ image = REGISTRY.get(key);
+ }
+
+ // For some reason, sometimes images get disposed.
+ // In that case, create and put in registry again.
+ if (image.isDisposed())
+ {
+ REGISTRY.remove(key);
+ createDescriptor(key);
+ image = REGISTRY.get(key);
+ }
+
+ return image;
+ }
+
+ public static ImageDescriptor getDescriptor(String key)
+ {
+ ImageDescriptor descriptor = REGISTRY.getDescriptor(key);
+ if (descriptor == null)
+ {
+ descriptor = createDescriptor(key);
+ }
+
+ return descriptor;
+ }
+
+ private static ImageDescriptor createDescriptor(String key)
+ {
+ ImageDescriptor descriptor = AbstractUIPlugin.imageDescriptorFromPlugin(OM.BUNDLE_ID, key);
+ if (descriptor != null)
+ {
+ REGISTRY.put(key, descriptor);
+ }
+
+ return descriptor;
+ }
+
+ private static Display getDisplay()
+ {
+ Display display = Display.getCurrent();
+ if (display == null)
+ {
+ display = Display.getDefault();
+ }
+
+ if (display == null)
+ {
+ throw new IllegalStateException("display == null"); //$NON-NLS-1$
+ }
+
+ return display;
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.dawn.ui/src/org/eclipse/emf/cdo/dawn/ui/messages/Messages.java b/plugins/org.eclipse.emf.cdo.dawn.ui/src/org/eclipse/emf/cdo/dawn/ui/messages/Messages.java index 3c09bbfae5..a89d8c1ac6 100644 --- a/plugins/org.eclipse.emf.cdo.dawn.ui/src/org/eclipse/emf/cdo/dawn/ui/messages/Messages.java +++ b/plugins/org.eclipse.emf.cdo.dawn.ui/src/org/eclipse/emf/cdo/dawn/ui/messages/Messages.java @@ -1,49 +1,49 @@ -/* - * 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.ui.messages; - -import org.eclipse.osgi.util.NLS; - -/** - * @author Martin Fluegge - * @since 2.0 - */ -public class Messages extends NLS -{ - private static final String BUNDLE_NAME = "org.eclipse.emf.cdo.dawn.ui.messages.messages"; //$NON-NLS-1$ - - public static String CDOResourceNodeChooserComposite_1; - - public static String DawnCreateNewResourceWizardPage_0; - - public static String DawnCreateNewResourceWizardPage_10; - - public static String DawnCreateNewResourceWizardPage_11; - - public static String DawnCreateNewResourceWizardPage_12; - - public static String DawnCreateNewResourceWizardPage_2; - - public static String DawnCreateNewResourceWizardPage_3; - - public static String DawnCreateNewResourceWizardPage_6; - - public static String DawnCreateNewResourceWizardPage_8; - static - { - // initialize resource bundle - NLS.initializeMessages(BUNDLE_NAME, Messages.class); - } - - private Messages() - { - } -} +/*
+ * 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.ui.messages;
+
+import org.eclipse.osgi.util.NLS;
+
+/**
+ * @author Martin Fluegge
+ * @since 2.0
+ */
+public class Messages extends NLS
+{
+ private static final String BUNDLE_NAME = "org.eclipse.emf.cdo.dawn.ui.messages.messages"; //$NON-NLS-1$
+
+ public static String CDOResourceNodeChooserComposite_1;
+
+ public static String DawnCreateNewResourceWizardPage_0;
+
+ public static String DawnCreateNewResourceWizardPage_10;
+
+ public static String DawnCreateNewResourceWizardPage_11;
+
+ public static String DawnCreateNewResourceWizardPage_12;
+
+ public static String DawnCreateNewResourceWizardPage_2;
+
+ public static String DawnCreateNewResourceWizardPage_3;
+
+ public static String DawnCreateNewResourceWizardPage_6;
+
+ public static String DawnCreateNewResourceWizardPage_8;
+ static
+ {
+ // initialize resource bundle
+ NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+ }
+
+ private Messages()
+ {
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.dawn.ui/src/org/eclipse/emf/cdo/dawn/ui/messages/messages.properties b/plugins/org.eclipse.emf.cdo.dawn.ui/src/org/eclipse/emf/cdo/dawn/ui/messages/messages.properties index 94a8e680ad..3bbb83376b 100644 --- a/plugins/org.eclipse.emf.cdo.dawn.ui/src/org/eclipse/emf/cdo/dawn/ui/messages/messages.properties +++ b/plugins/org.eclipse.emf.cdo.dawn.ui/src/org/eclipse/emf/cdo/dawn/ui/messages/messages.properties @@ -1,18 +1,18 @@ -# 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 - -CDOResourceNodeChooserComposite_1=Resource name must have the suffix -DawnCreateNewResourceWizardPage_0=First Page -DawnCreateNewResourceWizardPage_10=Please insert a name for the resource -DawnCreateNewResourceWizardPage_11=A resource with the same name already exists\! -DawnCreateNewResourceWizardPage_12=A resource with the same name already exists\! -DawnCreateNewResourceWizardPage_2=Create a Dawn Resource -DawnCreateNewResourceWizardPage_3=Creates Dawn Resource -DawnCreateNewResourceWizardPage_6=Resource name: -DawnCreateNewResourceWizardPage_8=Enter or select the parent folder: +# 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
+
+CDOResourceNodeChooserComposite_1=Resource name must have the suffix
+DawnCreateNewResourceWizardPage_0=First Page
+DawnCreateNewResourceWizardPage_10=Please insert a name for the resource
+DawnCreateNewResourceWizardPage_11=A resource with the same name already exists\!
+DawnCreateNewResourceWizardPage_12=A resource with the same name already exists\!
+DawnCreateNewResourceWizardPage_2=Create a Dawn Resource
+DawnCreateNewResourceWizardPage_3=Creates Dawn Resource
+DawnCreateNewResourceWizardPage_6=Resource name:
+DawnCreateNewResourceWizardPage_8=Enter or select the parent folder:
diff --git a/plugins/org.eclipse.emf.cdo.dawn.ui/src/org/eclipse/emf/cdo/dawn/ui/stylizer/DawnDefaultElementStylizer.java b/plugins/org.eclipse.emf.cdo.dawn.ui/src/org/eclipse/emf/cdo/dawn/ui/stylizer/DawnDefaultElementStylizer.java index 20cbcd3e07..94124ed169 100644 --- a/plugins/org.eclipse.emf.cdo.dawn.ui/src/org/eclipse/emf/cdo/dawn/ui/stylizer/DawnDefaultElementStylizer.java +++ b/plugins/org.eclipse.emf.cdo.dawn.ui/src/org/eclipse/emf/cdo/dawn/ui/stylizer/DawnDefaultElementStylizer.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.ui/src/org/eclipse/emf/cdo/dawn/ui/stylizer/DawnElementStylizerRegistry.java b/plugins/org.eclipse.emf.cdo.dawn.ui/src/org/eclipse/emf/cdo/dawn/ui/stylizer/DawnElementStylizerRegistry.java index 81c93b4bb2..182a84a73c 100644 --- a/plugins/org.eclipse.emf.cdo.dawn.ui/src/org/eclipse/emf/cdo/dawn/ui/stylizer/DawnElementStylizerRegistry.java +++ b/plugins/org.eclipse.emf.cdo.dawn.ui/src/org/eclipse/emf/cdo/dawn/ui/stylizer/DawnElementStylizerRegistry.java @@ -1,162 +1,162 @@ -/* - * 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.ui.stylizer; - -import org.eclipse.emf.cdo.dawn.appearance.DawnElementStylizer; -import org.eclipse.emf.cdo.dawn.appearance.IDawnElementStylizerFactory; -import org.eclipse.emf.cdo.dawn.internal.ui.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 java.util.HashMap; -import java.util.Map; - -/** - * This registry provides the DawnElementStylizer implementation for a given object. - * - * @see org.eclipse.emf.cdo.dawn.appearance.DawnElementStylizer - * @author Martin Fluegge - * @since 2.0 - */ -public class DawnElementStylizerRegistry -{ - private static final String ATTRIBUTE_PRIORITY = "priority"; - - private static final String ATTRIIBUTE_FACTORY = "factory"; - - private static final ContextTracer TRACER = new ContextTracer(OM.DEBUG, DawnElementStylizerRegistry.class); - - private static final String DAWN_STYLIZER_FACTORY_EXTENSION_POINT_ID = "org.eclipse.emf.cdo.dawn.elementstylizerfactory"; - - public static DawnElementStylizerRegistry instance = new DawnElementStylizerRegistry(); - - private Map<String, DawnElementStylizer> registeredStylizers = new HashMap<String, DawnElementStylizer>(); - - private Map<String, FactoryContainer> stylizerFactories = new HashMap<String, FactoryContainer>(); - - private DawnDefaultElementStylizer dawnDefaultElementStylizer; - - /** - * @since 2.0 - */ - public DawnElementStylizer getStylizer(Object object) - { - DawnElementStylizer stylizer = registeredStylizers.get(object.getClass().getCanonicalName()); - - if (stylizer == null) - { - stylizer = getStylizerFromExtensionPoint(object); - registeredStylizers.put(object.getClass().getCanonicalName(), stylizer); - } - - if (stylizer == null) - { - stylizer = getDefaultStylizer(object); - } - - return stylizer; - } - - private DawnElementStylizer getDefaultStylizer(Object object) - { - dawnDefaultElementStylizer = new DawnDefaultElementStylizer(); - return dawnDefaultElementStylizer; - } - - private DawnElementStylizer getStylizerFromExtensionPoint(Object object) - { - Map<String, FactoryContainer> factories = getFactories(); - DawnElementStylizer elementStylizer = null; - int lastPriority = -1; - - for (FactoryContainer factoryContainer : factories.values()) - { - DawnElementStylizer currentElementStylizer = factoryContainer.getFactory().getElementStylizer(object); - if (currentElementStylizer != null) - { - int priority = factoryContainer.getPriority(); - if (priority > lastPriority) - { - elementStylizer = currentElementStylizer; - lastPriority = priority; - } - } - } - - return elementStylizer; - } - - private Map<String, FactoryContainer> getFactories() - { - try - { - IConfigurationElement[] config = Platform.getExtensionRegistry().getConfigurationElementsFor( - DAWN_STYLIZER_FACTORY_EXTENSION_POINT_ID); - for (IConfigurationElement e : config) - { - String factoryClassName = e.getAttribute(ATTRIIBUTE_FACTORY); - if (!stylizerFactories.containsKey(factoryClassName)) - { - IDawnElementStylizerFactory stylizer = (IDawnElementStylizerFactory)e - .createExecutableExtension(ATTRIIBUTE_FACTORY); - - int priority = Integer.parseInt(e.getAttribute(ATTRIBUTE_PRIORITY).substring(0, 1)); - - FactoryContainer container = new FactoryContainer(priority, stylizer); - - stylizerFactories.put(factoryClassName, container); - if (TRACER.isEnabled()) - { - TRACER.format("Registered IDawnElementStylizerFactory {0} ", stylizer); //$NON-NLS-1$ - } - } - } - } - catch (InvalidRegistryObjectException e) - { - e.printStackTrace(); - } - catch (CoreException e) - { - e.printStackTrace(); - } - - return stylizerFactories; - } - - private class FactoryContainer - { - private int priority; - - private IDawnElementStylizerFactory factory; - - public FactoryContainer(int priority, IDawnElementStylizerFactory factory) - { - this.priority = priority; - this.factory = factory; - } - - public IDawnElementStylizerFactory getFactory() - { - return factory; - } - - public int getPriority() - { - return priority; - } - } -} +/*
+ * 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.ui.stylizer;
+
+import org.eclipse.emf.cdo.dawn.appearance.DawnElementStylizer;
+import org.eclipse.emf.cdo.dawn.appearance.IDawnElementStylizerFactory;
+import org.eclipse.emf.cdo.dawn.internal.ui.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 java.util.HashMap;
+import java.util.Map;
+
+/**
+ * This registry provides the DawnElementStylizer implementation for a given object.
+ *
+ * @see org.eclipse.emf.cdo.dawn.appearance.DawnElementStylizer
+ * @author Martin Fluegge
+ * @since 2.0
+ */
+public class DawnElementStylizerRegistry
+{
+ private static final String ATTRIBUTE_PRIORITY = "priority";
+
+ private static final String ATTRIIBUTE_FACTORY = "factory";
+
+ private static final ContextTracer TRACER = new ContextTracer(OM.DEBUG, DawnElementStylizerRegistry.class);
+
+ private static final String DAWN_STYLIZER_FACTORY_EXTENSION_POINT_ID = "org.eclipse.emf.cdo.dawn.elementstylizerfactory";
+
+ public static DawnElementStylizerRegistry instance = new DawnElementStylizerRegistry();
+
+ private Map<String, DawnElementStylizer> registeredStylizers = new HashMap<String, DawnElementStylizer>();
+
+ private Map<String, FactoryContainer> stylizerFactories = new HashMap<String, FactoryContainer>();
+
+ private DawnDefaultElementStylizer dawnDefaultElementStylizer;
+
+ /**
+ * @since 2.0
+ */
+ public DawnElementStylizer getStylizer(Object object)
+ {
+ DawnElementStylizer stylizer = registeredStylizers.get(object.getClass().getCanonicalName());
+
+ if (stylizer == null)
+ {
+ stylizer = getStylizerFromExtensionPoint(object);
+ registeredStylizers.put(object.getClass().getCanonicalName(), stylizer);
+ }
+
+ if (stylizer == null)
+ {
+ stylizer = getDefaultStylizer(object);
+ }
+
+ return stylizer;
+ }
+
+ private DawnElementStylizer getDefaultStylizer(Object object)
+ {
+ dawnDefaultElementStylizer = new DawnDefaultElementStylizer();
+ return dawnDefaultElementStylizer;
+ }
+
+ private DawnElementStylizer getStylizerFromExtensionPoint(Object object)
+ {
+ Map<String, FactoryContainer> factories = getFactories();
+ DawnElementStylizer elementStylizer = null;
+ int lastPriority = -1;
+
+ for (FactoryContainer factoryContainer : factories.values())
+ {
+ DawnElementStylizer currentElementStylizer = factoryContainer.getFactory().getElementStylizer(object);
+ if (currentElementStylizer != null)
+ {
+ int priority = factoryContainer.getPriority();
+ if (priority > lastPriority)
+ {
+ elementStylizer = currentElementStylizer;
+ lastPriority = priority;
+ }
+ }
+ }
+
+ return elementStylizer;
+ }
+
+ private Map<String, FactoryContainer> getFactories()
+ {
+ try
+ {
+ IConfigurationElement[] config = Platform.getExtensionRegistry().getConfigurationElementsFor(
+ DAWN_STYLIZER_FACTORY_EXTENSION_POINT_ID);
+ for (IConfigurationElement e : config)
+ {
+ String factoryClassName = e.getAttribute(ATTRIIBUTE_FACTORY);
+ if (!stylizerFactories.containsKey(factoryClassName))
+ {
+ IDawnElementStylizerFactory stylizer = (IDawnElementStylizerFactory)e
+ .createExecutableExtension(ATTRIIBUTE_FACTORY);
+
+ int priority = Integer.parseInt(e.getAttribute(ATTRIBUTE_PRIORITY).substring(0, 1));
+
+ FactoryContainer container = new FactoryContainer(priority, stylizer);
+
+ stylizerFactories.put(factoryClassName, container);
+ if (TRACER.isEnabled())
+ {
+ TRACER.format("Registered IDawnElementStylizerFactory {0} ", stylizer); //$NON-NLS-1$
+ }
+ }
+ }
+ }
+ catch (InvalidRegistryObjectException e)
+ {
+ e.printStackTrace();
+ }
+ catch (CoreException e)
+ {
+ e.printStackTrace();
+ }
+
+ return stylizerFactories;
+ }
+
+ private class FactoryContainer
+ {
+ private int priority;
+
+ private IDawnElementStylizerFactory factory;
+
+ public FactoryContainer(int priority, IDawnElementStylizerFactory factory)
+ {
+ this.priority = priority;
+ this.factory = factory;
+ }
+
+ public IDawnElementStylizerFactory getFactory()
+ {
+ return factory;
+ }
+
+ public int getPriority()
+ {
+ return priority;
+ }
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.dawn.ui/src/org/eclipse/emf/cdo/dawn/ui/views/DawnExplorer.java b/plugins/org.eclipse.emf.cdo.dawn.ui/src/org/eclipse/emf/cdo/dawn/ui/views/DawnExplorer.java index 76c85e0df3..983b024c29 100644 --- a/plugins/org.eclipse.emf.cdo.dawn.ui/src/org/eclipse/emf/cdo/dawn/ui/views/DawnExplorer.java +++ b/plugins/org.eclipse.emf.cdo.dawn.ui/src/org/eclipse/emf/cdo/dawn/ui/views/DawnExplorer.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.ui/src/org/eclipse/emf/cdo/dawn/ui/views/DawnItemProvider.java b/plugins/org.eclipse.emf.cdo.dawn.ui/src/org/eclipse/emf/cdo/dawn/ui/views/DawnItemProvider.java index 4230539e68..de9dbb8061 100644 --- a/plugins/org.eclipse.emf.cdo.dawn.ui/src/org/eclipse/emf/cdo/dawn/ui/views/DawnItemProvider.java +++ b/plugins/org.eclipse.emf.cdo.dawn.ui/src/org/eclipse/emf/cdo/dawn/ui/views/DawnItemProvider.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.ui/src/org/eclipse/emf/cdo/dawn/ui/views/DawnWizardPageItemProvider.java b/plugins/org.eclipse.emf.cdo.dawn.ui/src/org/eclipse/emf/cdo/dawn/ui/views/DawnWizardPageItemProvider.java index 88f33b9777..b11bc27f83 100644 --- a/plugins/org.eclipse.emf.cdo.dawn.ui/src/org/eclipse/emf/cdo/dawn/ui/views/DawnWizardPageItemProvider.java +++ b/plugins/org.eclipse.emf.cdo.dawn.ui/src/org/eclipse/emf/cdo/dawn/ui/views/DawnWizardPageItemProvider.java @@ -1,86 +1,86 @@ -/* - * 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.ui.views; - -import org.eclipse.emf.cdo.eresource.CDOResourceFolder; -import org.eclipse.emf.cdo.eresource.CDOResourceNode; -import org.eclipse.emf.cdo.session.CDOSession; -import org.eclipse.emf.cdo.ui.CDOItemProvider; -import org.eclipse.emf.cdo.view.CDOView; - -import org.eclipse.net4j.util.container.IContainer; -import org.eclipse.net4j.util.ui.views.IElementFilter; - -/** - * @author Martin Fluegge - * @param <CONTAINER> - */ -public class DawnWizardPageItemProvider<CONTAINER extends IContainer<Object>> extends CDOItemProvider -{ - - public DawnWizardPageItemProvider(IElementFilter iElementFilter) - { - super(null, iElementFilter); - } - - @Override - public Object[] getChildren(Object element) - { - if (element instanceof CDOResourceFolder) - { - return ((CDOResourceFolder)element).getNodes().toArray(); - } - - if (element instanceof CDOSession) - { - CDOSession session = (CDOSession)element; - Object[] child = new Object[1]; - child[0] = session.getViews()[0];// .getView(dawnExplorer.getView().getViewID()); - return child; - } - - return super.getChildren(element); - } - - @Override - public boolean hasChildren(Object element) - { - if (element instanceof CDOView) - { - return ((CDOView)element).getRootResource().getContents().size() > 0; - } - - if (element instanceof CDOResourceFolder) - { - return ((CDOResourceFolder)element).getNodes().size() > 0; - } - - return super.hasChildren(element); - } - - @Override - public Object getParent(Object element) - { - if (element instanceof CDOResourceNode) - { - CDOResourceNode node = (CDOResourceNode)element; - CDOResourceNode parent = (CDOResourceNode)node.eContainer(); - if (parent.isRoot()) - { - return parent.cdoView(); - } - - return parent; - } - - return super.getParent(element); - } -} +/*
+ * 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.ui.views;
+
+import org.eclipse.emf.cdo.eresource.CDOResourceFolder;
+import org.eclipse.emf.cdo.eresource.CDOResourceNode;
+import org.eclipse.emf.cdo.session.CDOSession;
+import org.eclipse.emf.cdo.ui.CDOItemProvider;
+import org.eclipse.emf.cdo.view.CDOView;
+
+import org.eclipse.net4j.util.container.IContainer;
+import org.eclipse.net4j.util.ui.views.IElementFilter;
+
+/**
+ * @author Martin Fluegge
+ * @param <CONTAINER>
+ */
+public class DawnWizardPageItemProvider<CONTAINER extends IContainer<Object>> extends CDOItemProvider
+{
+
+ public DawnWizardPageItemProvider(IElementFilter iElementFilter)
+ {
+ super(null, iElementFilter);
+ }
+
+ @Override
+ public Object[] getChildren(Object element)
+ {
+ if (element instanceof CDOResourceFolder)
+ {
+ return ((CDOResourceFolder)element).getNodes().toArray();
+ }
+
+ if (element instanceof CDOSession)
+ {
+ CDOSession session = (CDOSession)element;
+ Object[] child = new Object[1];
+ child[0] = session.getViews()[0];// .getView(dawnExplorer.getView().getViewID());
+ return child;
+ }
+
+ return super.getChildren(element);
+ }
+
+ @Override
+ public boolean hasChildren(Object element)
+ {
+ if (element instanceof CDOView)
+ {
+ return ((CDOView)element).getRootResource().getContents().size() > 0;
+ }
+
+ if (element instanceof CDOResourceFolder)
+ {
+ return ((CDOResourceFolder)element).getNodes().size() > 0;
+ }
+
+ return super.hasChildren(element);
+ }
+
+ @Override
+ public Object getParent(Object element)
+ {
+ if (element instanceof CDOResourceNode)
+ {
+ CDOResourceNode node = (CDOResourceNode)element;
+ CDOResourceNode parent = (CDOResourceNode)node.eContainer();
+ if (parent.isRoot())
+ {
+ return parent.cdoView();
+ }
+
+ return parent;
+ }
+
+ return super.getParent(element);
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.dawn.ui/src/org/eclipse/emf/cdo/dawn/ui/wizards/DawnCreateNewDiagramResourceWizardPage.java b/plugins/org.eclipse.emf.cdo.dawn.ui/src/org/eclipse/emf/cdo/dawn/ui/wizards/DawnCreateNewDiagramResourceWizardPage.java index 3515f7e5c4..2171c2ba34 100644 --- a/plugins/org.eclipse.emf.cdo.dawn.ui/src/org/eclipse/emf/cdo/dawn/ui/wizards/DawnCreateNewDiagramResourceWizardPage.java +++ b/plugins/org.eclipse.emf.cdo.dawn.ui/src/org/eclipse/emf/cdo/dawn/ui/wizards/DawnCreateNewDiagramResourceWizardPage.java @@ -1,40 +1,40 @@ -/* - * 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.ui.wizards; - -import org.eclipse.emf.cdo.dawn.preferences.PreferenceConstants; -import org.eclipse.emf.cdo.view.CDOView; - -import org.eclipse.emf.common.util.URI; - -/** - * @author Martin Fluegge - */ -public class DawnCreateNewDiagramResourceWizardPage extends DawnCreateNewResourceWizardPage -{ - public DawnCreateNewDiagramResourceWizardPage(String fileExtension) - { - super(fileExtension); - } - - public DawnCreateNewDiagramResourceWizardPage(String fileExtension, boolean showResources, CDOView view) - { - super(fileExtension, showResources, view); - } - - @Override - public URI getURI() - { - // TODO check why the dawn resource must be connected this way - return URI.createURI("dawn://" + PreferenceConstants.getRepositoryName() + "/" + chooserComposite.getResourcePath() - + "/" + chooserComposite.getResourceName()); - } -} +/*
+ * 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.ui.wizards;
+
+import org.eclipse.emf.cdo.dawn.preferences.PreferenceConstants;
+import org.eclipse.emf.cdo.view.CDOView;
+
+import org.eclipse.emf.common.util.URI;
+
+/**
+ * @author Martin Fluegge
+ */
+public class DawnCreateNewDiagramResourceWizardPage extends DawnCreateNewResourceWizardPage
+{
+ public DawnCreateNewDiagramResourceWizardPage(String fileExtension)
+ {
+ super(fileExtension);
+ }
+
+ public DawnCreateNewDiagramResourceWizardPage(String fileExtension, boolean showResources, CDOView view)
+ {
+ super(fileExtension, showResources, view);
+ }
+
+ @Override
+ public URI getURI()
+ {
+ // TODO check why the dawn resource must be connected this way
+ return URI.createURI("dawn://" + PreferenceConstants.getRepositoryName() + "/" + chooserComposite.getResourcePath()
+ + "/" + chooserComposite.getResourceName());
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.dawn.ui/src/org/eclipse/emf/cdo/dawn/ui/wizards/DawnCreateNewResourceWizardPage.java b/plugins/org.eclipse.emf.cdo.dawn.ui/src/org/eclipse/emf/cdo/dawn/ui/wizards/DawnCreateNewResourceWizardPage.java index de58db9aa5..ee58242659 100644 --- a/plugins/org.eclipse.emf.cdo.dawn.ui/src/org/eclipse/emf/cdo/dawn/ui/wizards/DawnCreateNewResourceWizardPage.java +++ b/plugins/org.eclipse.emf.cdo.dawn.ui/src/org/eclipse/emf/cdo/dawn/ui/wizards/DawnCreateNewResourceWizardPage.java @@ -1,185 +1,185 @@ -/* - * 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.ui.wizards; - -import org.eclipse.emf.cdo.dawn.ui.composites.CDOResourceNodeChooserComposite; -import org.eclipse.emf.cdo.dawn.ui.composites.CDOResourceNodeChooserComposite.ResourceChooserValidator; -import org.eclipse.emf.cdo.dawn.ui.composites.CDOResourceNodeChooserComposite.ValidationListener; -import org.eclipse.emf.cdo.dawn.ui.messages.Messages; -import org.eclipse.emf.cdo.view.CDOView; - -import org.eclipse.emf.common.util.URI; - -import org.eclipse.jface.wizard.WizardPage; -import org.eclipse.swt.SWT; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Composite; - -/** - * @author Martin Fluegge - */ -public class DawnCreateNewResourceWizardPage extends WizardPage -{ - private Composite container; - - private boolean showResources; - - private final String fileExtension; - - private int resourceValidationType = ResourceChooserValidator.VALIDATION_ERROR; - - /** - * left for backward compatibility with the generated editors. This field might soon be removed. Use - * <b>org.eclipse.emf.cdo.dawn.ui.composites.ResourceChooserValidator.VALIDATION_WARN</b> instead. - */ - @Deprecated - public static final int VALIDATION_WARN = ResourceChooserValidator.VALIDATION_WARN; - - private final CDOView view; - - //private String resourceNamePrefix = "default"; //$NON-NLS-1$ - - private boolean createAutomaticResourceName; - - /** - * @since 1.0 - */ - protected CDOResourceNodeChooserComposite chooserComposite; - - public DawnCreateNewResourceWizardPage(String fileExtension) - { - this(fileExtension, true, null); - } - - public DawnCreateNewResourceWizardPage(String fileExtension, boolean showResources, CDOView view) - { - super(Messages.DawnCreateNewResourceWizardPage_0); - this.view = view; - setTitle(Messages.DawnCreateNewResourceWizardPage_2); - setDescription(Messages.DawnCreateNewResourceWizardPage_3); - this.showResources = showResources; - this.fileExtension = fileExtension; - } - - public void createControl(Composite parent) - { - container = new Composite(parent, SWT.NULL); - GridLayout layout = new GridLayout(); - container.setLayout(layout); - layout.numColumns = 1; - chooserComposite = new CDOResourceNodeChooserComposite(container, SWT.NONE, fileExtension, view); - chooserComposite.showResources(showResources); - ResourceChooserValidator validator = chooserComposite.getValidator(); - validator.setResourceValidationType(resourceValidationType); - validator.setValidationListener(new ValidationListener() - { - public void validationFinished() - { - validatePage(); - } - }); - - if (createAutomaticResourceName) - { - chooserComposite.createAutomaticResourceName(); - } - - GridData gd = new GridData(GridData.FILL_BOTH); - chooserComposite.setLayoutData(gd); - - setControl(container); - validator.validate(); - } - - private void validatePage() - { - ResourceChooserValidator validator = chooserComposite.getValidator(); - boolean valid = validator.isValid(); - - if (!valid) - { - int type = validator.getMessageType(); - setMessage(validator.getMessage(), type); - } - else - { - setMessage(""); - } - setPageComplete(valid); - } - - public URI getURI() - { - return chooserComposite.getURI(); - } - - public void setShowResources(boolean showResources) - { - this.showResources = showResources; - } - - public boolean isShowResources() - { - return showResources; - } - - public void setResourceNamePrefix(String resourceNamePrefix) - { - // this.resourceNamePrefix = resourceNamePrefix; - chooserComposite.setResourceNamePrefix(resourceNamePrefix); - chooserComposite.setResourceName(resourceNamePrefix); - } - - public String getResourceNamePrefix() - { - return chooserComposite.getResourceNamePrefix(); - } - - public void setResourcePath(String text) - { - if (!text.endsWith("/") || !!text.endsWith("\\")) //$NON-NLS-1$ //$NON-NLS-2$ - { - text += "/"; //$NON-NLS-1$ - } - chooserComposite.setResourcePath(text); - } - - public String getResourcePath() - { - return chooserComposite.getResourcePath(); - } - - public void setCreateAutomaticResourceName(boolean createAutomaticResourceName) - { - this.createAutomaticResourceName = createAutomaticResourceName; - } - - public boolean isCreateAutomaticResourceName() - { - return createAutomaticResourceName; - } - - public void setResourceValidationType(int resourceValidationType) - { - this.resourceValidationType = resourceValidationType; - } - - public int getResourceValidationType() - { - return resourceValidationType; - } - - public String getDefaultName() - { - return chooserComposite.getDefaultName(); - } -} +/*
+ * 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.ui.wizards;
+
+import org.eclipse.emf.cdo.dawn.ui.composites.CDOResourceNodeChooserComposite;
+import org.eclipse.emf.cdo.dawn.ui.composites.CDOResourceNodeChooserComposite.ResourceChooserValidator;
+import org.eclipse.emf.cdo.dawn.ui.composites.CDOResourceNodeChooserComposite.ValidationListener;
+import org.eclipse.emf.cdo.dawn.ui.messages.Messages;
+import org.eclipse.emf.cdo.view.CDOView;
+
+import org.eclipse.emf.common.util.URI;
+
+import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+
+/**
+ * @author Martin Fluegge
+ */
+public class DawnCreateNewResourceWizardPage extends WizardPage
+{
+ private Composite container;
+
+ private boolean showResources;
+
+ private final String fileExtension;
+
+ private int resourceValidationType = ResourceChooserValidator.VALIDATION_ERROR;
+
+ /**
+ * left for backward compatibility with the generated editors. This field might soon be removed. Use
+ * <b>org.eclipse.emf.cdo.dawn.ui.composites.ResourceChooserValidator.VALIDATION_WARN</b> instead.
+ */
+ @Deprecated
+ public static final int VALIDATION_WARN = ResourceChooserValidator.VALIDATION_WARN;
+
+ private final CDOView view;
+
+ //private String resourceNamePrefix = "default"; //$NON-NLS-1$
+
+ private boolean createAutomaticResourceName;
+
+ /**
+ * @since 1.0
+ */
+ protected CDOResourceNodeChooserComposite chooserComposite;
+
+ public DawnCreateNewResourceWizardPage(String fileExtension)
+ {
+ this(fileExtension, true, null);
+ }
+
+ public DawnCreateNewResourceWizardPage(String fileExtension, boolean showResources, CDOView view)
+ {
+ super(Messages.DawnCreateNewResourceWizardPage_0);
+ this.view = view;
+ setTitle(Messages.DawnCreateNewResourceWizardPage_2);
+ setDescription(Messages.DawnCreateNewResourceWizardPage_3);
+ this.showResources = showResources;
+ this.fileExtension = fileExtension;
+ }
+
+ public void createControl(Composite parent)
+ {
+ container = new Composite(parent, SWT.NULL);
+ GridLayout layout = new GridLayout();
+ container.setLayout(layout);
+ layout.numColumns = 1;
+ chooserComposite = new CDOResourceNodeChooserComposite(container, SWT.NONE, fileExtension, view);
+ chooserComposite.showResources(showResources);
+ ResourceChooserValidator validator = chooserComposite.getValidator();
+ validator.setResourceValidationType(resourceValidationType);
+ validator.setValidationListener(new ValidationListener()
+ {
+ public void validationFinished()
+ {
+ validatePage();
+ }
+ });
+
+ if (createAutomaticResourceName)
+ {
+ chooserComposite.createAutomaticResourceName();
+ }
+
+ GridData gd = new GridData(GridData.FILL_BOTH);
+ chooserComposite.setLayoutData(gd);
+
+ setControl(container);
+ validator.validate();
+ }
+
+ private void validatePage()
+ {
+ ResourceChooserValidator validator = chooserComposite.getValidator();
+ boolean valid = validator.isValid();
+
+ if (!valid)
+ {
+ int type = validator.getMessageType();
+ setMessage(validator.getMessage(), type);
+ }
+ else
+ {
+ setMessage("");
+ }
+ setPageComplete(valid);
+ }
+
+ public URI getURI()
+ {
+ return chooserComposite.getURI();
+ }
+
+ public void setShowResources(boolean showResources)
+ {
+ this.showResources = showResources;
+ }
+
+ public boolean isShowResources()
+ {
+ return showResources;
+ }
+
+ public void setResourceNamePrefix(String resourceNamePrefix)
+ {
+ // this.resourceNamePrefix = resourceNamePrefix;
+ chooserComposite.setResourceNamePrefix(resourceNamePrefix);
+ chooserComposite.setResourceName(resourceNamePrefix);
+ }
+
+ public String getResourceNamePrefix()
+ {
+ return chooserComposite.getResourceNamePrefix();
+ }
+
+ public void setResourcePath(String text)
+ {
+ if (!text.endsWith("/") || !!text.endsWith("\\")) //$NON-NLS-1$ //$NON-NLS-2$
+ {
+ text += "/"; //$NON-NLS-1$
+ }
+ chooserComposite.setResourcePath(text);
+ }
+
+ public String getResourcePath()
+ {
+ return chooserComposite.getResourcePath();
+ }
+
+ public void setCreateAutomaticResourceName(boolean createAutomaticResourceName)
+ {
+ this.createAutomaticResourceName = createAutomaticResourceName;
+ }
+
+ public boolean isCreateAutomaticResourceName()
+ {
+ return createAutomaticResourceName;
+ }
+
+ public void setResourceValidationType(int resourceValidationType)
+ {
+ this.resourceValidationType = resourceValidationType;
+ }
+
+ public int getResourceValidationType()
+ {
+ return resourceValidationType;
+ }
+
+ public String getDefaultName()
+ {
+ return chooserComposite.getDefaultName();
+ }
+}
diff --git a/plugins/org.eclipse.emf.cdo.dawn.ui/src/org/eclipse/emf/cdo/dawn/ui/wizards/dialogs/CDOResourceNodeSelectionDialog.java b/plugins/org.eclipse.emf.cdo.dawn.ui/src/org/eclipse/emf/cdo/dawn/ui/wizards/dialogs/CDOResourceNodeSelectionDialog.java index 990cd3cea2..a32d247bef 100644 --- a/plugins/org.eclipse.emf.cdo.dawn.ui/src/org/eclipse/emf/cdo/dawn/ui/wizards/dialogs/CDOResourceNodeSelectionDialog.java +++ b/plugins/org.eclipse.emf.cdo.dawn.ui/src/org/eclipse/emf/cdo/dawn/ui/wizards/dialogs/CDOResourceNodeSelectionDialog.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
|