initial commit for new UMLGraph settings mechanism

This commit is contained in:
Rafael Chaves 2007-12-29 02:04:57 +00:00
parent f74dbe01e7
commit a133341bd7
23 changed files with 1638 additions and 0 deletions

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="output" path="bin"/>
</classpath>

View File

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>org.umlgraph.engine.tests</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.ManifestBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.SchemaBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.pde.PluginNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>

View File

@ -0,0 +1,256 @@
#Thu Dec 13 22:43:12 PST 2007
eclipse.preferences.version=1
org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16
org.eclipse.jdt.core.formatter.alignment_for_assignment=0
org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16
org.eclipse.jdt.core.formatter.alignment_for_compact_if=16
org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80
org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0
org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16
org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16
org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16
org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16
org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16
org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16
org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16
org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16
org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16
org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16
org.eclipse.jdt.core.formatter.blank_lines_after_imports=1
org.eclipse.jdt.core.formatter.blank_lines_after_package=1
org.eclipse.jdt.core.formatter.blank_lines_before_field=0
org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0
org.eclipse.jdt.core.formatter.blank_lines_before_imports=1
org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1
org.eclipse.jdt.core.formatter.blank_lines_before_method=1
org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1
org.eclipse.jdt.core.formatter.blank_lines_before_package=0
org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1
org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1
org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line
org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line
org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line
org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line
org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line
org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line
org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line
org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line
org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line
org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line
org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line
org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false
org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false
org.eclipse.jdt.core.formatter.comment.format_block_comments=true
org.eclipse.jdt.core.formatter.comment.format_header=false
org.eclipse.jdt.core.formatter.comment.format_html=true
org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true
org.eclipse.jdt.core.formatter.comment.format_line_comments=true
org.eclipse.jdt.core.formatter.comment.format_source_code=true
org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true
org.eclipse.jdt.core.formatter.comment.indent_root_tags=true
org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert
org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=insert
org.eclipse.jdt.core.formatter.comment.line_length=80
org.eclipse.jdt.core.formatter.compact_else_if=true
org.eclipse.jdt.core.formatter.continuation_indentation=2
org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2
org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false
org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true
org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true
org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true
org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true
org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true
org.eclipse.jdt.core.formatter.indent_empty_lines=false
org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true
org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true
org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true
org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=false
org.eclipse.jdt.core.formatter.indentation.size=4
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation=insert
org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=insert
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert
org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert
org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert
org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert
org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert
org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert
org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert
org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert
org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert
org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert
org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert
org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert
org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert
org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert
org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert
org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert
org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert
org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert
org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert
org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert
org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert
org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert
org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert
org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert
org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert
org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert
org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert
org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert
org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert
org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert
org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert
org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert
org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert
org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert
org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false
org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false
org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false
org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false
org.eclipse.jdt.core.formatter.lineSplit=80
org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false
org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false
org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0
org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1
org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true
org.eclipse.jdt.core.formatter.tabulation.char=mixed
org.eclipse.jdt.core.formatter.tabulation.size=8
org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false
org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true

View File

@ -0,0 +1,4 @@
#Thu Dec 13 22:43:12 PST 2007
eclipse.preferences.version=1
formatter_profile=org.eclipse.jdt.ui.default.sun_profile
formatter_settings_version=11

View File

@ -0,0 +1,7 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Tests Plug-in
Bundle-SymbolicName: org.umlgraph.engine.tests
Bundle-Version: 1.0.0
Require-Bundle: org.junit,
org.umlgraph.engine

View File

@ -0,0 +1,4 @@
source.. = src/
output.. = bin/
bin.includes = META-INF/,\
.

View File

@ -0,0 +1,13 @@
package org.umlgraph.engine.tests;
import junit.framework.Test;
import junit.framework.TestSuite;
public class AllTests {
public static Test suite() {
TestSuite allTests = new TestSuite(AllTests.class.getName());
allTests.addTest(SettingKeyTests.suite());
allTests.addTest(SettingTests.suite());
return allTests;
}
}

View File

@ -0,0 +1,72 @@
package org.umlgraph.engine.tests;
import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
import org.umlgraph.engine.options.SettingKey;
public class SettingKeyTests extends TestCase {
public SettingKeyTests(String name) {
super(name);
}
public void testRoot() {
SettingKey key = new SettingKey("/");
assertNull(key.getKey());
assertNotNull(key.getNodePath());
assertEquals(0, key.getNodePath().length);
}
public void testRootOption() {
SettingKey key = new SettingKey("@option1");
assertEquals("option1", key.getKey());
assertNotNull(key.getNodePath());
assertEquals(0, key.getNodePath().length);
}
public void testFirstLevel() {
SettingKey key = new SettingKey("context1");
assertNull(key.getKey());
assertEquals(1, key.getNodePath().length);
assertEquals("context1", key.getNodePath()[0]);
}
public void testFirstLevelOption() {
SettingKey key = new SettingKey("context1/@option1");
assertEquals("option1", key.getKey());
assertEquals(1, key.getNodePath().length);
assertEquals("context1", key.getNodePath()[0]);
}
public void testSecondLevel() {
SettingKey key = new SettingKey("context1/context2");
assertNull(key.getKey());
assertEquals(2, key.getNodePath().length);
assertEquals("context1", key.getNodePath()[0]);
assertEquals("context2", key.getNodePath()[1]);
}
public void testSecondLevelOption() {
SettingKey key = new SettingKey("context1/context2/@option1");
assertEquals("option1", key.getKey());
assertEquals(2, key.getNodePath().length);
assertEquals("context1", key.getNodePath()[0]);
assertEquals("context2", key.getNodePath()[1]);
}
public void testVariations() {
assertEquals(new SettingKey(""),new SettingKey("/"));
assertEquals(new SettingKey("context1"),new SettingKey("/context1"));
assertEquals(new SettingKey("context1@option1"),new SettingKey("/context1/@option1"));
assertEquals(new SettingKey("context1@option1"),new SettingKey("context1/@option1"));
assertEquals(new SettingKey("context1@option1"),new SettingKey("/context1@option1"));
assertEquals(new SettingKey("context1@option1"),new SettingKey("/context1/@option1"));
assertFalse(new SettingKey("context1").equals(new SettingKey("context2")));
}
public static Test suite() {
return new TestSuite(SettingKeyTests.class);
}
}

View File

@ -0,0 +1,247 @@
package org.umlgraph.engine.tests;
import java.util.Collection;
import org.umlgraph.engine.options.Settings;
import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
public class SettingTests extends TestCase {
public void testBasic() {
Settings root = new Settings();
root.set("@option2", "foo");
root.set("@option3", Boolean.TRUE);
assertNull(root.get("@option1"));
assertEquals("foo", root.get("@option2"));
assertTrue(root.<Boolean> get("@option3"));
}
public void testDefault() {
Settings root = new Settings();
root.set("@option1", "foo");
root.setDefault("@option2", Boolean.TRUE);
root.set("@option3", 42);
root.setDefault("@option3", 52);
assertEquals("foo", root.get("@option1"));
assertEquals(Boolean.TRUE, root.get("@option2"));
assertEquals(42, root.get("@option3"));
}
public void testRemoval() {
Settings root = new Settings();
root.set("@option1", "foo");
root.setDefault("@option1", "bar");
assertEquals("foo", root.get("@option1"));
root.set("@option1", null);
assertEquals("bar", root.get("@option1"));
root.setDefault("@option1", null);
assertNull(root.get("@option1"));
}
public void testDefaultFirstLevel() {
Settings root = new Settings();
root.set("context1@option1", "foo");
root.setDefault("context1@option2", Boolean.TRUE);
root.set("context1@option3", 42);
root.setDefault("context1@option3", 52);
assertEquals("foo", root.get("context1@option1"));
assertEquals(Boolean.TRUE, root.get("context1@option2"));
assertEquals(42, root.get("context1@option3"));
}
public void testDefaultSecondLevel() {
Settings root = new Settings();
root.set("context1/context2@option1", "foo");
root.setDefault("context1/context2@option2", Boolean.TRUE);
root.set("context1/context2@option3", 42);
root.setDefault("context1/context2@option3", 52);
assertEquals("foo", root.get("context1/context2@option1"));
assertEquals(Boolean.TRUE, root.get("context1/context2@option2"));
assertEquals(42, root.get("context1/context2@option3"));
}
public void testFirstLevel() {
Settings root = new Settings();
root.set("context1@option2", "foo");
root.set("context1@option3", Boolean.TRUE);
assertNull(root.get("context1@option1"));
assertEquals("foo", root.get("context1@option2"));
assertTrue(root.<Boolean> get("context1@option3"));
}
public void testSecondLevel() {
Settings root = new Settings();
root.set("context1/context2/@option2", "foo");
root.set("context1/context2/@option3", Boolean.TRUE);
assertNull(root.get("context1/context2/@option1"));
assertEquals("foo", root.get("context1/context2/@option2"));
assertTrue(root.<Boolean> get("context1/context2/@option3"));
}
public void testBasicFallback() {
Settings root = new Settings();
root.set("@option2", "foo");
root.set("@option3", Boolean.TRUE);
root.set("context1/@option3", Boolean.FALSE);
root.set("context1/@option4", 42);
root.set("context1/context2/@option1", "zoo");
root.set("context1/context2/@option2", "bar");
root.set("context1/context2/@option3", Boolean.TRUE);
assertNull(root.get("@option1"));
assertNull(root.get("context1/@option1"));
assertEquals("zoo", root.get("context1/context2/@option1"));
assertEquals("foo", root.get("@option2"));
assertEquals("foo", root.get("context1/@option2"));
assertEquals("bar", root.get("context1/context2@option2"));
assertEquals(Boolean.TRUE, root.get("@option3"));
assertEquals(Boolean.FALSE, root.get("context1/@option3"));
assertEquals(Boolean.TRUE, root.get("context1/context2@option3"));
assertEquals(null, root.get("@option4"));
assertEquals(42, root.get("context1/@option4"));
assertEquals(42, root.get("context1/context2@option4"));
}
public void testFallbackWithDefaults() {
Settings root = new Settings();
root.set("@option1", "foo");
root.setDefault("@option2", Boolean.TRUE);
root.setDefault("context1/@option1", "zoo");
root.setDefault("context1/context2/@option1", null);
assertEquals("zoo", root.get("context1@option1"));
assertEquals(Boolean.TRUE, root.get("context1@option2"));
assertNull(root.get("context1@option1", false));
assertEquals("zoo", root.get("context1/context2@option1"));
assertEquals(Boolean.TRUE, root.get("context1/context@option2"));
}
public void testSetToDefault() {
Settings root = new Settings();
root.set("@option1", "foo");
root.setDefault("@option1", "bar");
root.set("context1/@option1", "zoo");
root.set("context1/@option2", Boolean.TRUE);
assertEquals("zoo", root.get("context1/context2@option1"));
root.setToDefault("context1/context2@option1");
assertEquals("bar", root.get("context1/context2@option1"));
assertEquals(true, root.get("context1/context2@option2"));
try {
root.setToDefault("context1/context2@option2");
fail("should have failed");
} catch (IllegalStateException ise) {
// expected
}
}
public void testDefaultCancellation() {
Settings root = new Settings();
root.set("@option2", "foo");
root.setDefault("@option3", Boolean.TRUE);
root.set("context1/@option3", Boolean.FALSE);
root.set("context1/@option4", 42);
root.set("context1/context2/@option1", "zoo");
root.set("context1/context2/@option2", "bar");
root.set("context1/context2/@option3", Boolean.TRUE);
assertNull(root.get("@option1"));
assertNull(root.get("context1/@option1"));
assertEquals("zoo", root.get("context1/context2/@option1"));
assertEquals("foo", root.get("@option2"));
assertEquals("foo", root.get("context1/@option2"));
assertEquals("bar", root.get("context1/context2@option2"));
assertEquals(Boolean.TRUE, root.get("@option3"));
assertEquals(Boolean.FALSE, root.get("context1/@option3"));
assertEquals(Boolean.TRUE, root.get("context1/context2@option3"));
assertEquals(null, root.get("@option4"));
assertEquals(42, root.get("context1/@option4"));
assertEquals(42, root.get("context1/context2@option4"));
}
public void testOptionKeys() {
Settings root = new Settings();
root.set("@option2", "foo");
root.set("@option3", Boolean.TRUE);
root.setDefault("@option4", 42);
Collection<String> keys = root.getOptionKeys();
assertEquals(2, keys.size());
assertFalse(keys.contains("option1"));
assertTrue(keys.contains("option2"));
assertTrue(keys.contains("option3"));
assertFalse(keys.contains("option4"));
}
public void testContextCreation() {
Settings root = new Settings();
Settings context1 = root.node("context1");
assertNotNull(context1);
Settings context2 = root.node("context1/context2");
assertNotNull(context2);
Settings context3 = root.node("context1/context3");
assertNotNull(context3);
assertTrue(root.nodeExists(""));
assertTrue(root.nodeExists("/"));
assertTrue(root.nodeExists("context1"));
assertTrue(root.nodeExists("context1/context2"));
assertFalse(root.nodeExists("context2"));
assertTrue(root.nodeExists("context1/context3"));
}
public void testParenting() {
Settings root = new Settings();
Settings context1 = root.node("context1");
Settings context2 = root.node("context1/context2");
Settings context3 = root.node("context1/context3");
assertNull(root.getParent());
assertSame(root, context1.getParent());
assertSame(context1, context2.getParent());
assertSame(context1, context3.getParent());
}
public void testContextCreationByOption() {
Settings root = new Settings();
root.set("@option1", "foo");
root.set("context1@option2", "bar");
root.set("context1/context2@option3", "zoo");
assertTrue(root.nodeExists(""));
assertTrue(root.nodeExists("/"));
assertTrue(root.nodeExists("context1"));
assertTrue(root.nodeExists("context1/context2"));
assertFalse(root.nodeExists("context2"));
}
public SettingTests(String name) {
super(name);
}
public static Test suite() {
return new TestSuite(SettingTests.class);
}
}

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="output" path="bin"/>
</classpath>

View File

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>org.umlgraph.engine</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.ManifestBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.SchemaBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.pde.PluginNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>

View File

@ -0,0 +1,256 @@
#Thu Dec 13 19:54:43 PST 2007
eclipse.preferences.version=1
org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16
org.eclipse.jdt.core.formatter.alignment_for_assignment=0
org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16
org.eclipse.jdt.core.formatter.alignment_for_compact_if=16
org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80
org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0
org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16
org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16
org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16
org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16
org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16
org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16
org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16
org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16
org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16
org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16
org.eclipse.jdt.core.formatter.blank_lines_after_imports=1
org.eclipse.jdt.core.formatter.blank_lines_after_package=1
org.eclipse.jdt.core.formatter.blank_lines_before_field=0
org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0
org.eclipse.jdt.core.formatter.blank_lines_before_imports=1
org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1
org.eclipse.jdt.core.formatter.blank_lines_before_method=1
org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1
org.eclipse.jdt.core.formatter.blank_lines_before_package=0
org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1
org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1
org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line
org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line
org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line
org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line
org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line
org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line
org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line
org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line
org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line
org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line
org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line
org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false
org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false
org.eclipse.jdt.core.formatter.comment.format_block_comments=true
org.eclipse.jdt.core.formatter.comment.format_header=false
org.eclipse.jdt.core.formatter.comment.format_html=true
org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true
org.eclipse.jdt.core.formatter.comment.format_line_comments=true
org.eclipse.jdt.core.formatter.comment.format_source_code=true
org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true
org.eclipse.jdt.core.formatter.comment.indent_root_tags=true
org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert
org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=insert
org.eclipse.jdt.core.formatter.comment.line_length=80
org.eclipse.jdt.core.formatter.compact_else_if=true
org.eclipse.jdt.core.formatter.continuation_indentation=2
org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2
org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false
org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true
org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true
org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true
org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true
org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true
org.eclipse.jdt.core.formatter.indent_empty_lines=false
org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true
org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true
org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true
org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=false
org.eclipse.jdt.core.formatter.indentation.size=4
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation=insert
org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=insert
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert
org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert
org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert
org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert
org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert
org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert
org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert
org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert
org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert
org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert
org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert
org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert
org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert
org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert
org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert
org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert
org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert
org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert
org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert
org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert
org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert
org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert
org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert
org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert
org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert
org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert
org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert
org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert
org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert
org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert
org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert
org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert
org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert
org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert
org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert
org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert
org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false
org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false
org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false
org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false
org.eclipse.jdt.core.formatter.lineSplit=80
org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false
org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false
org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0
org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1
org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true
org.eclipse.jdt.core.formatter.tabulation.char=space
org.eclipse.jdt.core.formatter.tabulation.size=4
org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false
org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true

View File

@ -0,0 +1,4 @@
#Thu Dec 13 19:54:43 PST 2007
eclipse.preferences.version=1
formatter_profile=_umlgraph
formatter_settings_version=11

View File

@ -0,0 +1,8 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: UMLGraph
Bundle-SymbolicName: org.umlgraph.engine
Bundle-Version: 5.0.0.qualifier
Bundle-Vendor: umlgraph.org
Require-Bundle: org.eclipse.equinox.preferences
Export-Package: org.umlgraph.engine.options

View File

@ -0,0 +1,4 @@
source.. = src/
output.. = bin/
bin.includes = META-INF/,\
.

View File

@ -0,0 +1,53 @@
/*
* (C) Copyright 2002-2008 Diomidis Spinellis
* (C) Copyright 2008 Abstratt Technologies
*
* Permission to use, copy, and distribute this software and its
* documentation for any purpose and without fee is hereby granted,
* provided that the above copyright notice appear in all copies and that
* both that copyright notice and this permission notice appear in
* supporting documentation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
* MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
* $Id$
*
*/
package org.umlgraph.engine.options;
/**
* Constants for class diagram options.
*/
public interface ClassDiagramOptions {
/**
* Produce fully-qualified class names (boolean).
*/
String QUALIFIED_NAMES = "classDiagramQualifiedNames";
/**
* When using qualified class names, put the package name in the line after the class name, in order to reduce the width of class nodes.
*/
String POSTFIX_QUALIFIED_NAMES = "classDiagramPostfixQualifiedNames";
/**
* Try to automatically infer dependencies between classes by inspecting operation and attribute types. See the class diagram inference chapter for more details. Disabled by default. (boolean)
*/
String INFER_DEPENDENCY = "classDiagramInferDependency";
/**
* Try to automatically infer association relationships between classes by inspecting attribute types. See the class diagram inference chapter for further details. Disabled by default. (boolean)
*/
String INFER_ASSOCIATIONS = "classDiagramInferUsage";
/**
* The type of relationship inferred when -inferrel is activated. Defaults to "navassoc" (see the class modelling chapter for a list of relationship types). (String)
*/
String INFER_ASSOCIATION_TYPE = "classDiagramInferAssociationType";
/**
* Specifies the lowest visibility level of elements used to infer dependencies among classes. Possible values are private, package, protected, public, in this order. The default value is private. Use higher levels to limit the number of inferred dependencies. (String)
*/
String INFER_DEPENDENCY_VISIBILITY = "classDiagramInferDependencyVisibility";
}

View File

@ -0,0 +1,70 @@
/*
* (C) Copyright 2002-2008 Diomidis Spinellis
* (C) Copyright 2008 Abstratt Technologies
*
* Permission to use, copy, and distribute this software and its
* documentation for any purpose and without fee is hereby granted,
* provided that the above copyright notice appear in all copies and that
* both that copyright notice and this permission notice appear in
* supporting documentation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
* MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
* $Id$
*
*/
package org.umlgraph.engine.options;
/**
* Constants for class options.
*/
public interface ClassOptions {
/**
* Specify the font name to use inside abstract class nodes (String).
*/
String FONT_NAME_ABSTRACT_CLASS = "classAbstractFontName";
/**
* Specify the font name to use for the class names (String).
*/
String FONT_NAME_CLASS_NAME = "classNameFontName";
/**
* Specify the font name use for the class name of abstract classes
* (String).
*/
String FONT_NAME_ABSTRACT_CLASS_NAME = "classAbstractNameFontName";
/**
* Specify the font size to use for the class names (int).
*/
String FONT_SIZE_CLASS_NAME = "classNameFontSize";
/**
* Show class attributes (boolean).
*/
String SHOW_ATTRIBUTES = "classShowAttributes";
/**
* Show class operations (Java methods)
*/
String SHOW_OPERATIONS = "classShowOperations";
/**
* Adorn class elements according to their visibility (private, public, protected, package) (boolean).
*/
String SHOW_VISIBILITY = "classShowVisibility";
/**
* Add type information to attributes and operations (boolean)
*/
String SHOW_TYPES = "classFeatureTypes";
/**
* For enumerations, also show the values they can take. (boolean)
*/
String SHOW_ENUM_VALUES = "classShowEnumValues";
}

View File

@ -0,0 +1,39 @@
/*
* (C) Copyright 2002-2008 Diomidis Spinellis
* (C) Copyright 2008 Abstratt Technologies
*
* Permission to use, copy, and distribute this software and its
* documentation for any purpose and without fee is hereby granted,
* provided that the above copyright notice appear in all copies and that
* both that copyright notice and this permission notice appear in
* supporting documentation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
* MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
* $Id$
*
*/
package org.umlgraph.engine.options;
/**
* Generic constants for options applicable to all types of UML diagrams.
*/
public interface DiagramOptions {
/**
* Layout the graph in the horizontal direction (boolean).
*/
String HORIZONTAL = "diagramHorizontal";
/**
* Specify the graph's background color.
*/
String BACKGROUND_COLOR = "diagramBackgroundColor";
/**
* Specify entities to hide from the graph. Matching is done using a non-anchored regular match. For instance, "-hide (Big|\.)Widget" would hide "com.foo.widgets.Widget" and "com.foo.widgets.BigWidget". Can also be used without arguments, in this case it will hide everything (useful in the context of views to selectively unhide some portions of the graph, see the view chapter for further details). */
String hide();
}

View File

@ -0,0 +1,41 @@
/*
* (C) Copyright 2002-2008 Diomidis Spinellis
* (C) Copyright 2008 Abstratt Technologies
*
* Permission to use, copy, and distribute this software and its
* documentation for any purpose and without fee is hereby granted,
* provided that the above copyright notice appear in all copies and that
* both that copyright notice and this permission notice appear in
* supporting documentation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
* MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
* $Id$
*
*/
package org.umlgraph.engine.options;
/**
* Constants for edge options.
*/
public interface EdgeOptions {
/**
* Specify the font name to use for edge labels (String).
*/
public String FONT_NAME = "edgeFontName";
/**
* Specify the font size to use for edge labels (int).
*/
public String FONT_SIZE = "edgeFontSize";
/**
* Specify the font color to use for edge labels (String).
*/
public String FONT_COLOR = "edgeFontColor";
/**
* Specify the color for drawing edges.
*/
public String COLOR = "edgeColor";
}

View File

@ -0,0 +1,54 @@
/*
* (C) Copyright 2002-2008 Diomidis Spinellis
* (C) Copyright 2008 Abstratt Technologies
*
* Permission to use, copy, and distribute this software and its
* documentation for any purpose and without fee is hereby granted,
* provided that the above copyright notice appear in all copies and that
* both that copyright notice and this permission notice appear in
* supporting documentation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
* MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
* $Id$
*
*/
package org.umlgraph.engine.options;
/**
* Constants for node options.
*/
public interface NodeOptions {
/**
* Specify the color to use to fill the shapes (String).
*/
public String FILL_COLOR = "nodeFillColor";
/**
* Specify the font name to use inside nodes (String).
*/
public String FONT_NAME = "nodeFontName";
/**
* Specify the font size to use inside nodes (int).
*/
public String FONT_SIZE = "nodeFontSize";
/**
* Specify the font name to use for the tags (String).
*/
public String FONT_NAME_TAG = "nodeTagFontName";
/**
* Specify the font size to use for the tags (int).
*/
public String FONT_SIZE_TAG = "nodeTagFontSize";
/**
* Specify the font color to use inside nodes (String).
*/
public String FONT_COLOR = "nodeFontColor";
}

View File

@ -0,0 +1,37 @@
/*
* (C) Copyright 2002-2008 Diomidis Spinellis
* (C) Copyright 2008 Abstratt Technologies
*
* Permission to use, copy, and distribute this software and its
* documentation for any purpose and without fee is hereby granted,
* provided that the above copyright notice appear in all copies and that
* both that copyright notice and this permission notice appear in
* supporting documentation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
* MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
* $Id$
*
*/
package org.umlgraph.engine.options;
/**
* Constants for package options.
*/
public interface PackageOptions {
/**
* Specify the font name to use for the package names (used only when the
* package name is postfixed, see -postfixpackage).
*/
String FONT_NAME_PACKAGE_NAME = "packageNameFontName";
/**
* Specify the font size to use for the package names (used only when it
* package name is postfixed, see -postfixpackage).
*/
String FONT_SIZE_PACKAGE_NAME = "packageNameFontSize";
}

View File

@ -0,0 +1,117 @@
/*
* (C) Copyright 2007-2008 Abstratt Technologies
*
* Permission to use, copy, and distribute this software and its
* documentation for any purpose and without fee is hereby granted,
* provided that the above copyright notice appear in all copies and that
* both that copyright notice and this permission notice appear in
* supporting documentation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
* MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
* $Id$
*
*/
package org.umlgraph.engine.options;
import java.util.Arrays;
import java.util.StringTokenizer;
/**
* A key for accessing a specific setting.
*/
public class SettingKey {
private static final String PATH_DELIMITER = "/";
private static final String OPTION_DELIMITER = "@";
private static final String[] EMPTY_CONTEXT_PATH = {};
private String[] nodePath;
private String key;
public SettingKey(String[] nodePath, String key) {
this.nodePath = nodePath;
this.key = key;
}
public SettingKey(String stringKey) {
int atIndex = stringKey.indexOf(OPTION_DELIMITER);
if (atIndex >= 0) {
if (atIndex == stringKey.length() - 1)
throw new IllegalArgumentException("argument: " + stringKey);
key = stringKey.substring(atIndex + 1);
if (atIndex == 0) {
nodePath = EMPTY_CONTEXT_PATH;
return;
}
}
String nodePathStr = atIndex < 0 ? stringKey : stringKey.substring(0,
atIndex);
StringTokenizer pathSegmenter = new StringTokenizer(nodePathStr,
PATH_DELIMITER);
nodePath = new String[pathSegmenter.countTokens()];
int i = 0;
while (pathSegmenter.hasMoreTokens())
nodePath[i++] = pathSegmenter.nextToken();
}
public String[] getNodePath() {
return nodePath;
}
public boolean isRoot() {
return nodePath.length == 0;
}
public boolean hasKey() {
return key != null;
}
public String getKey() {
return key;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((key == null) ? 0 : key.hashCode());
result = prime * result + Arrays.hashCode(nodePath);
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
final SettingKey other = (SettingKey) obj;
if (key == null) {
if (other.key != null)
return false;
} else if (!key.equals(other.key))
return false;
if (!Arrays.equals(nodePath, other.nodePath))
return false;
return true;
}
@Override
public String toString() {
StringBuffer result = new StringBuffer(PATH_DELIMITER);
for (int i = 0; i < nodePath.length; i++) {
result.append(nodePath[i]);
result.append(PATH_DELIMITER);
}
if (hasKey()) {
result.append(OPTION_DELIMITER);
result.append(key);
}
return result.toString();
}
}

View File

@ -0,0 +1,282 @@
/*
* (C) Copyright 2007-2008 Abstratt Technologies
*
* Permission to use, copy, and distribute this software and its
* documentation for any purpose and without fee is hereby granted,
* provided that the above copyright notice appear in all copies and that
* both that copyright notice and this permission notice appear in
* supporting documentation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
* MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
* $Id$
*
*/
package org.umlgraph.engine.options;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
/**
* A typed hierarchic preferences mechanism that takes advantage of
* generics for providing a simpler protocol.
*
* Features:
* <ul>
* <li>default values</li>
* <li>contexts are hierarchic, option value lookup falls back to parent
* if option is not found at the current level</li>
* <li>
* options are typed, so an attempt at setting them with the wrong value
* type causes an exception
* </li>
* <li>
* option contexts are statically typed, meaning that set of
* available options for a context is defined at compile time
* and trying to set an unexpected option value causes an
* exception.
* </li>
* </ul>
* Non-features:
* <ul>
* <li>
* persistence
* </li>
* </ul>
*/
public class Settings {
/*
* The child setting nodes.
*/
private Map<String, Settings> children = new HashMap<String, Settings>();
/*
* The setting values defined for this setting node.
*/
private Map<String, Object> values = new HashMap<String, Object>();
/*
* The default values defined for this setting node.
*/
private Map<String, Object> defaultValues = new HashMap<String, Object>();
private Settings parent;
public Settings() {
}
private Settings(Settings parent) {
this.parent = parent;
}
/**
* Returns the setting node corresponding to the given path. If the node
* does not exist, returns a new empty node.
*
* @param path
* the setting node path
* @return the setting node corresponding to the given path
*/
public Settings node(String[] path) {
return createNode(path, 0);
}
public Settings node(String path) {
return node(new SettingKey(path).getNodePath());
}
/**
* Creates a setting node under the given path, or returns the existing one.
*/
private Settings createNode(String[] path, int start) {
if (path.length == start)
return this;
Settings found = children.get(path[start]);
if (found == null)
children.put(path[start], found = new Settings(this));
if (start == path.length - 1)
return found;
return found.createNode(path, start + 1);
}
/**
* Returns whether the given node exists.
*/
public boolean nodeExists(String[] path) {
return existingNode(path) != null;
}
public boolean nodeExists(String path) {
return nodeExists(new SettingKey(path).getNodePath());
}
/**
* Returns an existing setting node corresponding to the given path.
*
* @param path
* the setting path
* @return the settings object, or <code>null</code>
*/
public Settings existingNode(String[] segments) {
Settings current = this;
for (String segment : segments) {
current = current.children.get(segment);
if (current == null)
return null;
}
return current;
}
public Settings existingNode(String path) {
return existingNode(new SettingKey(path).getNodePath());
}
/**
* Returns the value of the option corresponding to the given key. If
* acceptDefault is <code>true</code> and a value for the option does not
* exist, returns the default value. Otherwise, returns <code>null</code>.
*
* @param key
* the option key
* @param acceptDefault
* whether a default value should be returned
* @return the value for the given key, or <code>null</code>
*/
public <T> T get(SettingKey key, boolean acceptDefault) {
if (!acceptDefault) {
Settings node = existingNode(key.getNodePath());
return node == null ? null : (T) node.values.get(key.getKey());
}
Settings node = lastExistingNode(key.getNodePath(), 0);
return node.searchValue(key.getKey());
}
private <T> T searchValue(String key) {
T ownValue = (T) values.get(key);
if (ownValue != null)
return ownValue;
T ownDefaultValue = (T) defaultValues.get(key);
if (ownDefaultValue != null)
return ownDefaultValue;
return (T) (parent == null ? null : parent.searchValue(key));
}
private <T> T searchDefaultValue(String key) {
T ownDefaultValue = (T) defaultValues.get(key);
if (ownDefaultValue != null)
return ownDefaultValue;
return (T) (parent == null ? null : parent.searchDefaultValue(key));
}
private Settings lastExistingNode(String[] nodePath, int start) {
if (start == nodePath.length)
return this;
Settings immediateChild = children.get(nodePath[start]);
return immediateChild == null ? this : immediateChild.lastExistingNode(nodePath, start+1);
}
/**
* Returns the value of the option corresponding to the given path. If
* acceptDefault is <code>true</code> and a value for the option does not
* exist, returns the default value. Otherwise, returns <code>null</code>.
* This is just a convenience method for {@link #get(SettingKey, boolean)}.
*
* @param path
* the option path
* @param acceptDefault
* whether a default value should be returned
* @return the value for the given path, or <code>null</code>
*/
public <T> T get(String path, boolean acceptDefault) {
return get(new SettingKey(path), acceptDefault);
}
public <T> T get(String path) {
return get(new SettingKey(path), true);
}
/**
* Sets the value for the given option.
*
* @param key
* the option key
* @param value
* the new value, or <code>null</code>
*/
public <T> void set(SettingKey key, T value) {
if (value == null) {
Settings node = existingNode(key.getNodePath());
if (node != null)
node.values.remove(key.getKey());
} else {
Settings node = createNode(key.getNodePath(), 0);
node.values.put(key.getKey(), value);
}
}
public <T> void set(String path, T value) {
set(new SettingKey(path), value);
}
public <T> void setToDefault(String path) {
setToDefault(new SettingKey(path));
}
/**
* Sets the given option to its current default value.
*
* @param settingKey the key to set to default
*/
public <T> void setToDefault(SettingKey settingKey) {
T defaultValue = node(settingKey.getNodePath()).searchDefaultValue(settingKey.getKey());
if (defaultValue == null)
throw new IllegalStateException();
set(settingKey, defaultValue);
}
/**
* Sets the default value for the given option.
*
* @param key
* the option key
* @param value
* the new value, or <code>null</code>
*/
public <T> void setDefault(SettingKey key, T defaultValue) {
if (defaultValue == null) {
Settings node = existingNode(key.getNodePath());
if (node != null)
node.defaultValues.remove(key.getKey());
} else {
Settings node = createNode(key.getNodePath(), 0);
node.defaultValues.put(key.getKey(), defaultValue);
}
}
public <T> void setDefault(String path, T defaultValue) {
setDefault(new SettingKey(path), defaultValue);
}
/**
* Returns all options set for this context.
*
* @return
*/
public Collection<String> getOptionKeys() {
return this.values.keySet();
}
/**
* Returns the parent settings, or <code>null</code> if this is a root setting.
*
* @return the parent settings, or <code>null</code>
*/
public Settings getParent() {
return parent;
}
}