Initial commit: Allow admins to configure menus from WebUI
The icons are taken from the Tango Icon Library [1].
[1] http://tango.freedesktop.org/Tango_Icon_Library
Change-Id: Idb13ff0e048bfa117fc0118c3a82348316164945
Signed-off-by: Edwin Kempin <edwin.kempin@sap.com>
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..80d6257
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,5 @@
+/target
+/.classpath
+/.project
+/.settings/org.maven.ide.eclipse.prefs
+/.settings/org.eclipse.m2e.core.prefs
diff --git a/.settings/org.eclipse.core.resources.prefs b/.settings/org.eclipse.core.resources.prefs
new file mode 100644
index 0000000..0285a1b
--- /dev/null
+++ b/.settings/org.eclipse.core.resources.prefs
@@ -0,0 +1,4 @@
+eclipse.preferences.version=1
+encoding//src/main/java=UTF-8
+encoding//src/test/java=UTF-8
+encoding//src/test/resources=UTF-8
diff --git a/.settings/org.eclipse.core.runtime.prefs b/.settings/org.eclipse.core.runtime.prefs
new file mode 100644
index 0000000..8667cfd
--- /dev/null
+++ b/.settings/org.eclipse.core.runtime.prefs
@@ -0,0 +1,3 @@
+#Tue Sep 02 16:59:24 PDT 2008
+eclipse.preferences.version=1
+line.separator=\n
diff --git a/.settings/org.eclipse.jdt.core.prefs b/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 0000000..2a585e4
--- /dev/null
+++ b/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,346 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.annotation.missingNonNullByDefaultAnnotation=ignore
+org.eclipse.jdt.core.compiler.annotation.nonnull=org.eclipse.jdt.annotation.NonNull
+org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=org.eclipse.jdt.annotation.NonNullByDefault
+org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nullable
+org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
+org.eclipse.jdt.core.compiler.compliance=1.7
+org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=ignore
+org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
+org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning
+org.eclipse.jdt.core.compiler.problem.deadCode=warning
+org.eclipse.jdt.core.compiler.problem.deprecation=warning
+org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
+org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled
+org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
+org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore
+org.eclipse.jdt.core.compiler.problem.explicitlyClosedAutoCloseable=ignore
+org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
+org.eclipse.jdt.core.compiler.problem.fatalOptionalError=disabled
+org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore
+org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
+org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
+org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
+org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
+org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=disabled
+org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
+org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=warning
+org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore
+org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore
+org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
+org.eclipse.jdt.core.compiler.problem.missingDefaultCase=ignore
+org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore
+org.eclipse.jdt.core.compiler.problem.missingEnumCaseDespiteDefault=disabled
+org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=ignore
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled
+org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
+org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore
+org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
+org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
+org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore
+org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=error
+org.eclipse.jdt.core.compiler.problem.nullReference=warning
+org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error
+org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning
+org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
+org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
+org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=ignore
+org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore
+org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=ignore
+org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning
+org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=warning
+org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore
+org.eclipse.jdt.core.compiler.problem.redundantSpecificationOfTypeArguments=ignore
+org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore
+org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore
+org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore
+org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
+org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
+org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled
+org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
+org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
+org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
+org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=enabled
+org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
+org.eclipse.jdt.core.compiler.problem.unclosedCloseable=warning
+org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
+org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
+org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
+org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=ignore
+org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
+org.eclipse.jdt.core.compiler.problem.unusedImport=warning
+org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
+org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
+org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=ignore
+org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore
+org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
+org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
+org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
+org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
+org.eclipse.jdt.core.compiler.source=1.7
+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=16
+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=16
+org.eclipse.jdt.core.formatter.alignment_for_enum_constants=16
+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=0
+org.eclipse.jdt.core.formatter.blank_lines_before_member_type=0
+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=2
+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=true
+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=false
+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=do not 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=true
+org.eclipse.jdt.core.formatter.indentation.size=4
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_member=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=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=do not 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=do not 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=do not 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=do not 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.join_lines_in_comments=true
+org.eclipse.jdt.core.formatter.join_wrapped_lines=true
+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=true
+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=3
+org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=false
+org.eclipse.jdt.core.formatter.tabulation.char=space
+org.eclipse.jdt.core.formatter.tabulation.size=2
+org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false
+org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true
diff --git a/.settings/org.eclipse.jdt.ui.prefs b/.settings/org.eclipse.jdt.ui.prefs
new file mode 100644
index 0000000..d4218a5
--- /dev/null
+++ b/.settings/org.eclipse.jdt.ui.prefs
@@ -0,0 +1,61 @@
+#Wed Jul 29 11:31:38 PDT 2009
+eclipse.preferences.version=1
+editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
+formatter_profile=_Google Format
+formatter_settings_version=11
+org.eclipse.jdt.ui.ignorelowercasenames=true
+org.eclipse.jdt.ui.importorder=com.google;com;junit;net;org;java;javax;
+org.eclipse.jdt.ui.ondemandthreshold=99
+org.eclipse.jdt.ui.staticondemandthreshold=99
+org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8" standalone\="no"?><templates/>
+sp_cleanup.add_default_serial_version_id=true
+sp_cleanup.add_generated_serial_version_id=false
+sp_cleanup.add_missing_annotations=false
+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_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=false
+sp_cleanup.format_source_code=false
+sp_cleanup.format_source_code_changes_only=false
+sp_cleanup.make_local_variable_final=true
+sp_cleanup.make_parameters_final=true
+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=false
+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=false
+sp_cleanup.remove_unnecessary_nls_tags=false
+sp_cleanup.remove_unused_imports=false
+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=false
+sp_cleanup.use_blocks_only_for_return_and_throw=false
+sp_cleanup.use_parentheses_in_expressions=false
+sp_cleanup.use_this_for_non_static_field_access=false
+sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true
+sp_cleanup.use_this_for_non_static_method_access=false
+sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..11069ed
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,201 @@
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+END OF TERMS AND CONDITIONS
+
+APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+Copyright [yyyy] [name of copyright owner]
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
diff --git a/pom.xml b/pom.xml
new file mode 100644
index 0000000..c3bb7be
--- /dev/null
+++ b/pom.xml
@@ -0,0 +1,133 @@
+<!--
+Copyright (C) 2014 The Android Open Source Project
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>com.googlesource.gerrit.plugins.menuextender</groupId>
+ <artifactId>menuextender</artifactId>
+ <packaging>jar</packaging>
+ <version>1.0-SNAPSHOT</version>
+ <name>menuextender</name>
+
+ <properties>
+ <Gerrit-ApiType>plugin</Gerrit-ApiType>
+ <Gerrit-ApiVersion>2.9-SNAPSHOT</Gerrit-ApiVersion>
+ </properties>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <version>2.4</version>
+ <configuration>
+ <includes>
+ <include>**/*.*</include>
+ </includes>
+ <archive>
+ <manifestEntries>
+ <Gerrit-PluginName>menuextender</Gerrit-PluginName>
+ <Gerrit-Module>com.googlesource.gerrit.plugins.menuextender.Module</Gerrit-Module>
+ <Gerrit-HttpModule>com.googlesource.gerrit.plugins.menuextender.HttpModule</Gerrit-HttpModule>
+ <Implementation-Vendor>Gerrit Code Review</Implementation-Vendor>
+ <Implementation-URL>http://code.google.com/p/gerrit/</Implementation-URL>
+
+ <Implementation-Title>${Gerrit-ApiType} ${project.artifactId}</Implementation-Title>
+ <Implementation-Version>${project.version}</Implementation-Version>
+
+ <Gerrit-ApiType>${Gerrit-ApiType}</Gerrit-ApiType>
+ <Gerrit-ApiVersion>${Gerrit-ApiVersion}</Gerrit-ApiVersion>
+ </manifestEntries>
+ </archive>
+ </configuration>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>2.3.2</version>
+ <configuration>
+ <source>1.7</source>
+ <target>1.7</target>
+ <encoding>UTF-8</encoding>
+ </configuration>
+ </plugin>
+
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>gwt-maven-plugin</artifactId>
+ <version>2.6.0</version>
+ <configuration>
+ <module>com.googlesource.gerrit.plugins.menuextender.MenuExtenderPlugin</module>
+ <disableClassMetadata>true</disableClassMetadata>
+ <disableCastChecking>true</disableCastChecking>
+ <webappDirectory>${project.build.directory}/classes/static</webappDirectory>
+ </configuration>
+ <executions>
+ <execution>
+ <goals>
+ <goal>compile</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+
+ </plugins>
+ </build>
+
+ <dependencies>
+ <dependency>
+ <groupId>com.google.gerrit</groupId>
+ <artifactId>gerrit-${Gerrit-ApiType}-api</artifactId>
+ <version>${Gerrit-ApiVersion}</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>com.google.gerrit</groupId>
+ <artifactId>gerrit-plugin-gwtui</artifactId>
+ <version>${Gerrit-ApiVersion}</version>
+ </dependency>
+ <dependency>
+ <groupId>com.google.gwt</groupId>
+ <artifactId>gwt-user</artifactId>
+ <version>2.6.0</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>gwtexpui</groupId>
+ <artifactId>gwtexpui</artifactId>
+ <version>1.3.4</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>gwtexpui</groupId>
+ <artifactId>gwtexpui</artifactId>
+ <version>1.3.4</version>
+ <classifier>sources</classifier>
+ </dependency>
+ </dependencies>
+
+ <repositories>
+ <repository>
+ <id>gerrit-maven-repository</id>
+ <url>https://gerrit-maven.storage.googleapis.com/</url>
+ </repository>
+ </repositories>
+</project>
diff --git a/src/main/java/com/googlesource/gerrit/plugins/menuextender/GetMenus.java b/src/main/java/com/googlesource/gerrit/plugins/menuextender/GetMenus.java
new file mode 100644
index 0000000..83badb8
--- /dev/null
+++ b/src/main/java/com/googlesource/gerrit/plugins/menuextender/GetMenus.java
@@ -0,0 +1,95 @@
+// Copyright (C) 2014 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package com.googlesource.gerrit.plugins.menuextender;
+
+import com.google.common.base.Strings;
+import com.google.gerrit.common.data.GlobalCapability;
+import com.google.gerrit.extensions.annotations.PluginName;
+import com.google.gerrit.extensions.annotations.RequiresCapability;
+import com.google.gerrit.extensions.restapi.RestReadView;
+import com.google.gerrit.extensions.webui.TopMenu;
+import com.google.gerrit.server.config.ConfigResource;
+import com.google.gerrit.server.config.SitePaths;
+import com.google.inject.Inject;
+
+import org.eclipse.jgit.errors.ConfigInvalidException;
+import org.eclipse.jgit.internal.storage.file.FileSnapshot;
+import org.eclipse.jgit.storage.file.FileBasedConfig;
+import org.eclipse.jgit.util.FS;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+@RequiresCapability(GlobalCapability.ADMINISTRATE_SERVER)
+public class GetMenus implements RestReadView<ConfigResource>, TopMenu {
+ public final static String SECTION_MENU_ITEM = "menuItem";
+ public final static String KEY_TOP_MENU = "topMenu";
+ public final static String KEY_NAME = "name";
+ public final static String KEY_TARGET = "target";
+ public final static String KEY_ID = "id";
+
+ private final static String DEFAULT_TOP_MENU = "Extensions";
+
+ private final File cfgFile;
+
+ private volatile FileSnapshot cfgSnapshot;
+ private volatile FileBasedConfig cfg;
+
+ @Inject
+ public GetMenus(@PluginName String pluginName, SitePaths sitePaths) {
+ this.cfgFile = new File(sitePaths.etc_dir, pluginName + ".config");
+ }
+
+ @Override
+ public List<TopMenu.MenuEntry> apply(ConfigResource rsrc) {
+ return getEntries();
+ }
+
+ @Override
+ public List<MenuEntry> getEntries() {
+ if (cfg == null || cfgSnapshot.isModified(cfgFile)) {
+ cfgSnapshot = FileSnapshot.save(cfgFile);
+ cfg = new FileBasedConfig(cfgFile, FS.DETECTED);
+ try {
+ cfg.load();
+ } catch (ConfigInvalidException | IOException e) {
+ return Collections.emptyList();
+ }
+ }
+
+ List<MenuEntry> menuEntries = new ArrayList<>();
+ for (String url : cfg.getSubsections(SECTION_MENU_ITEM)) {
+ String name = cfg.getString(SECTION_MENU_ITEM, url, KEY_NAME);
+ if (Strings.isNullOrEmpty(name)) {
+ continue;
+ }
+
+ String topMenu = cfg.getString(SECTION_MENU_ITEM, url, KEY_TOP_MENU);
+ if (topMenu == null) {
+ topMenu = DEFAULT_TOP_MENU;
+ }
+
+ String target = cfg.getString(SECTION_MENU_ITEM, url, KEY_TARGET);
+ String id = cfg.getString(SECTION_MENU_ITEM, url, KEY_ID);
+
+ menuEntries.add(new MenuEntry(topMenu,
+ Collections.singletonList(new MenuItem(name, url, target, id))));
+ }
+ return menuEntries;
+ }
+}
diff --git a/src/main/java/com/googlesource/gerrit/plugins/menuextender/HttpModule.java b/src/main/java/com/googlesource/gerrit/plugins/menuextender/HttpModule.java
new file mode 100644
index 0000000..5abb283
--- /dev/null
+++ b/src/main/java/com/googlesource/gerrit/plugins/menuextender/HttpModule.java
@@ -0,0 +1,29 @@
+// Copyright (C) 2014 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package com.googlesource.gerrit.plugins.menuextender;
+
+import com.google.gerrit.extensions.registration.DynamicSet;
+import com.google.gerrit.extensions.webui.GwtPlugin;
+import com.google.gerrit.extensions.webui.WebUiPlugin;
+import com.google.gerrit.httpd.plugins.HttpPluginModule;
+
+public class HttpModule extends HttpPluginModule {
+
+ @Override
+ protected void configureServlets() {
+ DynamicSet.bind(binder(), WebUiPlugin.class)
+ .toInstance(new GwtPlugin("menuextender_plugin"));
+ }
+}
diff --git a/src/main/java/com/googlesource/gerrit/plugins/menuextender/MenuExtenderPlugin.gwt.xml b/src/main/java/com/googlesource/gerrit/plugins/menuextender/MenuExtenderPlugin.gwt.xml
new file mode 100644
index 0000000..fa082cc
--- /dev/null
+++ b/src/main/java/com/googlesource/gerrit/plugins/menuextender/MenuExtenderPlugin.gwt.xml
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright (C) 2014 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<module rename-to="menuextender_plugin">
+ <!-- Inherit the core Web Toolkit stuff. -->
+ <inherits name="com.google.gwt.user.User"/>
+ <!-- Other module inherits -->
+ <inherits name="com.google.gerrit.Plugin"/>
+ <inherits name="com.google.gwt.http.HTTP"/>
+ <inherits name="com.google.gwt.json.JSON"/>
+ <inherits name='com.google.gwtexpui.clippy.Clippy'/>
+ <inherits name='com.google.gwtexpui.globalkey.GlobalKey'/>
+ <!-- Using GWT built-in themes adds a number of static -->
+ <!-- resources to the plugin. No theme inherits lines were -->
+ <!-- added in order to make this plugin as simple as possible -->
+ <!-- Specify the app entry point class. -->
+ <entry-point class="com.googlesource.gerrit.plugins.menuextender.client.MenuExtenderPlugin"/>
+ <stylesheet src="menuextender.css"/>
+</module>
diff --git a/src/main/java/com/googlesource/gerrit/plugins/menuextender/Module.java b/src/main/java/com/googlesource/gerrit/plugins/menuextender/Module.java
new file mode 100644
index 0000000..e8c17d9
--- /dev/null
+++ b/src/main/java/com/googlesource/gerrit/plugins/menuextender/Module.java
@@ -0,0 +1,38 @@
+// Copyright (C) 2014 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package com.googlesource.gerrit.plugins.menuextender;
+
+import static com.google.gerrit.server.config.ConfigResource.CONFIG_KIND;
+
+import com.google.gerrit.extensions.registration.DynamicSet;
+import com.google.gerrit.extensions.restapi.RestApiModule;
+import com.google.gerrit.extensions.webui.TopMenu;
+import com.google.inject.AbstractModule;
+
+public class Module extends AbstractModule {
+
+ @Override
+ protected void configure() {
+ DynamicSet.bind(binder(), TopMenu.class).to(GetMenus.class);
+
+ install(new RestApiModule() {
+ @Override
+ protected void configure() {
+ get(CONFIG_KIND, "menus").to(GetMenus.class);
+ put(CONFIG_KIND, "menus").to(PutMenus.class);
+ }
+ });
+ }
+}
diff --git a/src/main/java/com/googlesource/gerrit/plugins/menuextender/PutMenus.java b/src/main/java/com/googlesource/gerrit/plugins/menuextender/PutMenus.java
new file mode 100644
index 0000000..fa58db8
--- /dev/null
+++ b/src/main/java/com/googlesource/gerrit/plugins/menuextender/PutMenus.java
@@ -0,0 +1,91 @@
+// Copyright (C) 2014 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package com.googlesource.gerrit.plugins.menuextender;
+
+import static com.googlesource.gerrit.plugins.menuextender.GetMenus.KEY_ID;
+import static com.googlesource.gerrit.plugins.menuextender.GetMenus.KEY_NAME;
+import static com.googlesource.gerrit.plugins.menuextender.GetMenus.KEY_TARGET;
+import static com.googlesource.gerrit.plugins.menuextender.GetMenus.KEY_TOP_MENU;
+import static com.googlesource.gerrit.plugins.menuextender.GetMenus.SECTION_MENU_ITEM;
+
+import com.google.common.base.Strings;
+import com.google.gerrit.common.data.GlobalCapability;
+import com.google.gerrit.extensions.annotations.PluginName;
+import com.google.gerrit.extensions.annotations.RequiresCapability;
+import com.google.gerrit.extensions.restapi.RestModifyView;
+import com.google.gerrit.extensions.webui.TopMenu;
+import com.google.gerrit.server.config.ConfigResource;
+import com.google.gerrit.server.config.SitePaths;
+import com.google.inject.Inject;
+
+import com.googlesource.gerrit.plugins.menuextender.PutMenus.Input;
+
+import org.eclipse.jgit.errors.ConfigInvalidException;
+import org.eclipse.jgit.storage.file.FileBasedConfig;
+import org.eclipse.jgit.util.FS;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.List;
+
+@RequiresCapability(GlobalCapability.ADMINISTRATE_SERVER)
+public class PutMenus implements RestModifyView<ConfigResource, Input> {
+ public static class Input {
+ List<TopMenu.MenuEntry> menus;
+ }
+
+ private final String pluginName;
+ private final SitePaths sitePaths;
+ private final GetMenus getMenus;
+
+ @Inject
+ public PutMenus(@PluginName String pluginName, SitePaths sitePaths,
+ GetMenus getMenus) {
+ this.pluginName = pluginName;
+ this.sitePaths = sitePaths;
+ this.getMenus = getMenus;
+ }
+
+ @Override
+ public List<TopMenu.MenuEntry> apply(ConfigResource rsrc, Input input)
+ throws IOException, ConfigInvalidException {
+ FileBasedConfig cfg =
+ new FileBasedConfig(
+ new File(sitePaths.etc_dir, pluginName + ".config"), FS.DETECTED);
+ cfg.load();
+ cfg.clear();
+ if (input.menus != null) {
+ for (TopMenu.MenuEntry menuEntry : input.menus) {
+ for (TopMenu.MenuItem menuItem : menuEntry.items) {
+ if (menuItem.name == null) {
+ continue;
+ }
+ cfg.setString(SECTION_MENU_ITEM, menuItem.url, KEY_NAME, menuItem.name);
+ cfg.setString(SECTION_MENU_ITEM, menuItem.url, KEY_TOP_MENU, menuEntry.name);
+
+ if (!Strings.isNullOrEmpty(menuItem.target)) {
+ cfg.setString(SECTION_MENU_ITEM, menuItem.url, KEY_TARGET, menuItem.target);
+ }
+
+ if (!Strings.isNullOrEmpty(menuItem.id)) {
+ cfg.setString(SECTION_MENU_ITEM, menuItem.url, KEY_ID, menuItem.id);
+ }
+ }
+ }
+ }
+ cfg.save();
+ return getMenus.getEntries();
+ }
+}
diff --git a/src/main/java/com/googlesource/gerrit/plugins/menuextender/client/MenuConfigurationScreen.java b/src/main/java/com/googlesource/gerrit/plugins/menuextender/client/MenuConfigurationScreen.java
new file mode 100644
index 0000000..c5b601e
--- /dev/null
+++ b/src/main/java/com/googlesource/gerrit/plugins/menuextender/client/MenuConfigurationScreen.java
@@ -0,0 +1,114 @@
+// Copyright (C) 2014 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package com.googlesource.gerrit.plugins.menuextender.client;
+
+import com.google.gerrit.client.rpc.Natives;
+import com.google.gerrit.plugin.client.Plugin;
+import com.google.gerrit.plugin.client.rpc.RestApi;
+import com.google.gerrit.plugin.client.screen.Screen;
+import com.google.gwt.event.dom.client.ClickEvent;
+import com.google.gwt.event.dom.client.ClickHandler;
+import com.google.gwt.user.client.rpc.AsyncCallback;
+import com.google.gwt.user.client.ui.Button;
+import com.google.gwt.user.client.ui.VerticalPanel;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+public class MenuConfigurationScreen extends VerticalPanel {
+
+ static class Factory implements Screen.EntryPoint {
+ @Override
+ public void onLoad(Screen screen) {
+ screen.setPageTitle("Menu Configuration");
+ screen.show(new MenuConfigurationScreen());
+ }
+ }
+
+ private final StringListPanel menusPanel;
+
+ MenuConfigurationScreen() {
+ setStyleName("menuextender-panel");
+
+ Button save = new Button("Save");
+ menusPanel = new StringListPanel("Menu Extensions", Arrays.asList(
+ "Top Menu*", "Menu Item*", "URL*", "Target", "ID Tag"), save, false);
+ add(menusPanel);
+ add(save);
+
+ save.setEnabled(false);
+ save.addClickHandler(new ClickHandler() {
+ @Override
+ public void onClick(ClickEvent event) {
+ doSave();
+ }
+ });
+
+ new RestApi("config").id("server")
+ .view(Plugin.get().getPluginName(), "menus")
+ .get(new AsyncCallback<TopMenuList>() {
+ @Override
+ public void onSuccess(TopMenuList menuList) {
+ Plugin.get().refreshMenuBar();
+ display(menuList);
+ }
+
+ @Override
+ public void onFailure(Throwable caught) {
+ // never invoked
+ }
+ });
+ }
+
+ private void display(TopMenuList menuList) {
+ List<List<String>> valueList = new ArrayList<>();
+ for (TopMenu menu : Natives.asList(menuList)) {
+ for (TopMenuItem item : Natives.asList(menu.getItems())) {
+ List<String> values = new ArrayList<>();
+ values.add(menu.getName());
+ values.add(item.getName());
+ values.add(item.getUrl());
+ values.add(item.getTarget());
+ values.add(item.getId());
+ valueList.add(values);
+ }
+ }
+
+ menusPanel.display(valueList);
+ }
+
+ private void doSave() {
+ List<TopMenu> menus = new ArrayList<>();
+ for (List<String> v : menusPanel.getValues()) {
+ TopMenuItem item = TopMenuItem.create(v.get(1), v.get(2), v.get(3), v.get(4));
+ menus.add(TopMenu.create(v.get(0), Arrays.asList(item)));
+ }
+ MenusInput input = MenusInput.create(menus);
+ new RestApi("config").id("server")
+ .view(Plugin.get().getPluginName(), "menus")
+ .put(input, new AsyncCallback<TopMenuList>() {
+ @Override
+ public void onSuccess(TopMenuList menuList) {
+ Plugin.get().refresh();
+ }
+
+ @Override
+ public void onFailure(Throwable caught) {
+ // never invoked
+ }
+ });
+ }
+}
diff --git a/src/main/java/com/googlesource/gerrit/plugins/menuextender/client/MenuExtenderPlugin.java b/src/main/java/com/googlesource/gerrit/plugins/menuextender/client/MenuExtenderPlugin.java
new file mode 100644
index 0000000..be80617
--- /dev/null
+++ b/src/main/java/com/googlesource/gerrit/plugins/menuextender/client/MenuExtenderPlugin.java
@@ -0,0 +1,28 @@
+// Copyright (C) 2014 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package com.googlesource.gerrit.plugins.menuextender.client;
+
+import com.google.gerrit.plugin.client.Plugin;
+import com.google.gerrit.plugin.client.PluginEntryPoint;
+import com.google.gwt.core.client.GWT;
+
+public class MenuExtenderPlugin extends PluginEntryPoint {
+ public static final Resources RESOURCES = GWT.create(Resources.class);
+
+ @Override
+ public void onPluginLoad() {
+ Plugin.get().screen("settings", new MenuConfigurationScreen.Factory());
+ }
+}
diff --git a/src/main/java/com/googlesource/gerrit/plugins/menuextender/client/MenusInput.java b/src/main/java/com/googlesource/gerrit/plugins/menuextender/client/MenusInput.java
new file mode 100644
index 0000000..6ffe23f
--- /dev/null
+++ b/src/main/java/com/googlesource/gerrit/plugins/menuextender/client/MenusInput.java
@@ -0,0 +1,40 @@
+// Copyright (C) 2014 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package com.googlesource.gerrit.plugins.menuextender.client;
+
+import com.google.gwt.core.client.JavaScriptObject;
+
+import java.util.List;
+
+public class MenusInput extends JavaScriptObject {
+ public static MenusInput create(List<TopMenu> menus) {
+ MenusInput i = createObject().cast();
+ i.setMenus(menus);
+ return i;
+ }
+
+ protected MenusInput() {
+ }
+
+ final void setMenus(List<TopMenu> menus) {
+ initMenus();
+ for (TopMenu m : menus) {
+ addMenu(m);
+ }
+
+ }
+ final native void initMenus() /*-{ this.menus = []; }-*/;
+ final native void addMenu(TopMenu m) /*-{ this.menus.push(m); }-*/;
+}
diff --git a/src/main/java/com/googlesource/gerrit/plugins/menuextender/client/OnEditEnabler.java b/src/main/java/com/googlesource/gerrit/plugins/menuextender/client/OnEditEnabler.java
new file mode 100644
index 0000000..96a8603
--- /dev/null
+++ b/src/main/java/com/googlesource/gerrit/plugins/menuextender/client/OnEditEnabler.java
@@ -0,0 +1,184 @@
+// Copyright (C) 2010 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package com.googlesource.gerrit.plugins.menuextender.client;
+
+import com.google.gwt.core.client.Scheduler;
+import com.google.gwt.core.client.Scheduler.ScheduledCommand;
+import com.google.gwt.event.dom.client.ChangeEvent;
+import com.google.gwt.event.dom.client.ChangeHandler;
+import com.google.gwt.event.dom.client.FocusEvent;
+import com.google.gwt.event.dom.client.FocusHandler;
+import com.google.gwt.event.dom.client.KeyDownEvent;
+import com.google.gwt.event.dom.client.KeyDownHandler;
+import com.google.gwt.event.dom.client.KeyPressEvent;
+import com.google.gwt.event.dom.client.KeyPressHandler;
+import com.google.gwt.event.dom.client.MouseUpEvent;
+import com.google.gwt.event.dom.client.MouseUpHandler;
+import com.google.gwt.event.logical.shared.ValueChangeEvent;
+import com.google.gwt.event.logical.shared.ValueChangeHandler;
+import com.google.gwt.event.shared.GwtEvent;
+import com.google.gwt.user.client.ui.CheckBox;
+import com.google.gwt.user.client.ui.FocusWidget;
+import com.google.gwt.user.client.ui.ListBox;
+import com.google.gwt.user.client.ui.TextBoxBase;
+import com.google.gwt.user.client.ui.ValueBoxBase;
+
+import java.util.HashMap;
+import java.util.Map;
+
+
+/** Enables a FocusWidget (e.g. a Button) if an edit is detected from any
+ * registered input widget.
+ */
+public class OnEditEnabler implements KeyPressHandler, KeyDownHandler,
+ MouseUpHandler, ChangeHandler, ValueChangeHandler<Object> {
+
+ private final FocusWidget widget;
+ private Map<TextBoxBase, String> strings = new HashMap<TextBoxBase, String>();
+ private String originalValue;
+
+
+ // The first parameter to the contructors must be the FocusWidget to enable,
+ // subsequent parameters are widgets to listenTo.
+
+ public OnEditEnabler(final FocusWidget w, final TextBoxBase tb) {
+ this(w);
+ originalValue = tb.getValue().trim();
+ listenTo(tb);
+ }
+
+ public OnEditEnabler(final FocusWidget w, final ListBox lb) {
+ this(w);
+ listenTo(lb);
+ }
+
+ public OnEditEnabler(final FocusWidget w, final CheckBox cb) {
+ this(w);
+ listenTo(cb);
+ }
+
+ public OnEditEnabler(final FocusWidget w) {
+ widget = w;
+ }
+
+
+ // Register input widgets to be listened to
+
+ public void listenTo(final TextBoxBase tb) {
+ strings.put(tb, tb.getText().trim());
+ tb.addKeyPressHandler(this);
+
+ // Is there another way to capture middle button X11 pastes in browsers
+ // which do not yet support ONPASTE events (Firefox)?
+ tb.addMouseUpHandler(this);
+
+ // Resetting the "original text" on focus ensures that we are
+ // up to date with non-user updates of the text (calls to
+ // setText()...) and also up to date with user changes which
+ // occured after enabling "widget".
+ tb.addFocusHandler(new FocusHandler() {
+ @Override
+ public void onFocus(FocusEvent event) {
+ strings.put(tb, tb.getText().trim());
+ }
+ });
+
+ // CTRL-V Pastes in Chrome seem only detectable via BrowserEvents or
+ // KeyDownEvents, the latter is better.
+ tb.addKeyDownHandler(this);
+ }
+
+ public void listenTo(final ListBox lb) {
+ lb.addChangeHandler(this);
+ }
+
+ @SuppressWarnings({"unchecked", "rawtypes"})
+ public void listenTo(final CheckBox cb) {
+ cb.addValueChangeHandler((ValueChangeHandler) this);
+ }
+
+
+ // Handlers
+
+ @Override
+ public void onKeyPress(final KeyPressEvent e) {
+ on(e);
+ }
+
+ @Override
+ public void onKeyDown(final KeyDownEvent e) {
+ on(e);
+ }
+
+ @Override
+ public void onMouseUp(final MouseUpEvent e) {
+ on(e);
+ }
+
+ @Override
+ public void onChange(final ChangeEvent e) {
+ on(e);
+ }
+
+ @SuppressWarnings("rawtypes")
+ @Override
+ public void onValueChange(final ValueChangeEvent e) {
+ on(e);
+ }
+
+ private void on(final GwtEvent<?> e) {
+ if (widget.isEnabled() ||
+ ! (e.getSource() instanceof FocusWidget) ||
+ ! ((FocusWidget) e.getSource()).isEnabled() ) {
+ if (e.getSource() instanceof ValueBoxBase) {
+ final TextBoxBase box = ((TextBoxBase) e.getSource());
+ Scheduler.get().scheduleDeferred(new ScheduledCommand() {
+ @Override
+ public void execute() {
+ if (box.getValue().trim().equals(originalValue)) {
+ widget.setEnabled(false);
+ }
+ }
+ });
+ }
+ return;
+ }
+
+ if (e.getSource() instanceof TextBoxBase) {
+ onTextBoxBase((TextBoxBase) e.getSource());
+ } else {
+ // For many widgets, we can assume that a change is an edit. If
+ // a widget does not work that way, it should be special cased
+ // above.
+ widget.setEnabled(true);
+ }
+ }
+
+ private void onTextBoxBase(final TextBoxBase tb) {
+ // The text appears to not get updated until the handlers complete.
+ Scheduler.get().scheduleDeferred(new ScheduledCommand() {
+ @Override
+ public void execute() {
+ String orig = strings.get(tb);
+ if (orig == null) {
+ orig = "";
+ }
+ if (! orig.equals(tb.getText().trim())) {
+ widget.setEnabled(true);
+ }
+ }
+ });
+ }
+}
diff --git a/src/main/java/com/googlesource/gerrit/plugins/menuextender/client/Resources.java b/src/main/java/com/googlesource/gerrit/plugins/menuextender/client/Resources.java
new file mode 100644
index 0000000..dd9a4ee
--- /dev/null
+++ b/src/main/java/com/googlesource/gerrit/plugins/menuextender/client/Resources.java
@@ -0,0 +1,33 @@
+// Copyright (C) 2014 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package com.googlesource.gerrit.plugins.menuextender.client;
+
+import com.google.gwt.resources.client.ClientBundle;
+import com.google.gwt.resources.client.ImageResource;
+
+public interface Resources extends ClientBundle {
+
+ @Source("arrowUp.png")
+ public ImageResource arrowUp();
+
+ @Source("arrowDown.png")
+ public ImageResource arrowDown();
+
+ @Source("info.png")
+ public ImageResource info();
+
+ @Source("listAdd.png")
+ public ImageResource listAdd();
+}
diff --git a/src/main/java/com/googlesource/gerrit/plugins/menuextender/client/StringListPanel.java b/src/main/java/com/googlesource/gerrit/plugins/menuextender/client/StringListPanel.java
new file mode 100644
index 0000000..174adc2
--- /dev/null
+++ b/src/main/java/com/googlesource/gerrit/plugins/menuextender/client/StringListPanel.java
@@ -0,0 +1,295 @@
+// Copyright (C) 2014 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package com.googlesource.gerrit.plugins.menuextender.client;
+
+import com.google.gwt.event.dom.client.ClickEvent;
+import com.google.gwt.event.dom.client.ClickHandler;
+import com.google.gwt.event.dom.client.KeyCodes;
+import com.google.gwt.event.dom.client.KeyPressEvent;
+import com.google.gwt.event.dom.client.KeyPressHandler;
+import com.google.gwt.event.logical.shared.ValueChangeEvent;
+import com.google.gwt.event.logical.shared.ValueChangeHandler;
+import com.google.gwt.user.client.ui.Button;
+import com.google.gwt.user.client.ui.CheckBox;
+import com.google.gwt.user.client.ui.FlexTable;
+import com.google.gwt.user.client.ui.FlowPanel;
+import com.google.gwt.user.client.ui.FocusWidget;
+import com.google.gwt.user.client.ui.HorizontalPanel;
+import com.google.gwt.user.client.ui.Image;
+import com.google.gwt.user.client.ui.ImageResourceRenderer;
+import com.google.gwt.user.client.ui.Label;
+import com.google.gwtexpui.globalkey.client.NpTextBox;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class StringListPanel extends FlowPanel {
+ private final StringListTable t;
+ private final HorizontalPanel titlePanel;
+ protected final HorizontalPanel buttonPanel;
+ private final Button deleteButton;
+ private Image info;
+ protected FocusWidget widget;
+
+ public StringListPanel(String title, List<String> fieldNames, FocusWidget w,
+ boolean autoSort) {
+ widget = w;
+ titlePanel = new HorizontalPanel();
+ Label titleLabel = new Label(title);
+ titleLabel.setStyleName("menuextender-smallHeading");
+ titlePanel.add(titleLabel);
+ add(titlePanel);
+
+ t = new StringListTable(fieldNames, autoSort);
+ add(t);
+
+ buttonPanel = new HorizontalPanel();
+ buttonPanel.setStyleName("menuextender-stringListPanelButtons");
+ deleteButton = new Button("Delete");
+ deleteButton.setEnabled(false);
+ deleteButton.addClickHandler(new ClickHandler() {
+ @Override
+ public void onClick(ClickEvent event) {
+ widget.setEnabled(true);
+ t.deleteChecked();
+ }
+ });
+ buttonPanel.add(deleteButton);
+ add(buttonPanel);
+ }
+
+ public void display(List<List<String>> values) {
+ t.display(values);
+ }
+
+ public void setInfo(String msg) {
+ if (info == null) {
+ info = new Image(MenuExtenderPlugin.RESOURCES.info());
+ titlePanel.add(info);
+ }
+ info.setTitle(msg);
+ }
+
+ public List<List<String>> getValues() {
+ return t.getValues();
+ }
+
+ private class StringListTable extends FlexTable {
+ private final List<NpTextBox> inputs;
+ private final boolean autoSort;
+
+ StringListTable(List<String> names, boolean autoSort) {
+ this.autoSort = autoSort;
+
+ Button addButton =
+ new Button(new ImageResourceRenderer().render(MenuExtenderPlugin.RESOURCES.listAdd()));
+ addButton.setTitle("Add");
+ OnEditEnabler e = new OnEditEnabler(addButton);
+ inputs = new ArrayList<>();
+
+ setStyleName("menuextender-stringListTable");
+ FlexCellFormatter fmt = getFlexCellFormatter();
+ fmt.addStyleName(0, 0, "iconHeader");
+ fmt.addStyleName(0, 0, "leftMostCell");
+ for (int i = 0; i < names.size(); i++) {
+ fmt.addStyleName(0, i + 1, "dataHeader");
+ setText(0, i + 1, names.get(i));
+
+ NpTextBox input = new NpTextBox();
+ input.setVisibleLength(35);
+ input.addKeyPressHandler(new KeyPressHandler() {
+ @Override
+ public void onKeyPress(KeyPressEvent event) {
+ if (event.getNativeEvent().getKeyCode() == KeyCodes.KEY_ENTER) {
+ widget.setEnabled(true);
+ add();
+ }
+ }
+ });
+ inputs.add(input);
+ fmt.addStyleName(1, i + 1, "dataHeader");
+ setWidget(1, i + 1, input);
+ e.listenTo(input);
+ }
+ addButton.setEnabled(false);
+
+ addButton.addClickHandler(new ClickHandler() {
+ @Override
+ public void onClick(ClickEvent event) {
+ widget.setEnabled(true);
+ add();
+ }
+ });
+ fmt.addStyleName(1, 0, "iconHeader");
+ fmt.addStyleName(1, 0, "leftMostCell");
+ setWidget(1, 0, addButton);
+
+ if (!autoSort) {
+ fmt.addStyleName(0, names.size() + 1, "iconHeader");
+ fmt.addStyleName(0, names.size() + 2, "iconHeader");
+ fmt.addStyleName(1, names.size() + 1, "iconHeader");
+ fmt.addStyleName(1, names.size() + 2, "iconHeader");
+ }
+ }
+
+ void display(List<List<String>> values) {
+ for (int row = 2; row < getRowCount(); row++) {
+ removeRow(row--);
+ }
+ int row = 2;
+ for (List<String> v : values) {
+ populate(row, v);
+ row++;
+ }
+ updateNavigationLinks();
+ }
+
+ List<List<String>> getValues() {
+ List<List<String>> values = new ArrayList<>();
+ for (int row = 2; row < getRowCount(); row++) {
+ values.add(getRowItem(row));
+ }
+ return values;
+ }
+
+ protected List<String> getRowItem(int row) {
+ List<String> v = new ArrayList<>();
+ for (int i = 0; i < inputs.size(); i++) {
+ v.add(getText(row, i + 1));
+ }
+ return v;
+ }
+
+ private void populate(final int row, List<String> values) {
+ FlexCellFormatter fmt = getFlexCellFormatter();
+ fmt.addStyleName(row, 0, "leftMostCell");
+ fmt.addStyleName(row, 0, "iconCell");
+ CheckBox checkBox = new CheckBox();
+ checkBox.addValueChangeHandler(new ValueChangeHandler<Boolean>() {
+ @Override
+ public void onValueChange(ValueChangeEvent<Boolean> event) {
+ enableDelete();
+ }
+ });
+ setWidget(row, 0, checkBox);
+ for (int i = 0; i < values.size(); i++) {
+ fmt.addStyleName(row, i + 1, "dataCell");
+ setText(row, i + 1, values.get(i));
+ }
+ if (!autoSort) {
+ fmt.addStyleName(row, values.size() + 1, "iconCell");
+ fmt.addStyleName(row, values.size() + 2, "dataCell");
+
+ Image down = new Image(MenuExtenderPlugin.RESOURCES.arrowDown());
+ down.setTitle("Down");
+ down.addClickHandler(new ClickHandler() {
+ @Override
+ public void onClick(ClickEvent event) {
+ moveDown(row);
+ }
+ });
+ setWidget(row, values.size() + 1, down);
+
+ Image up = new Image(MenuExtenderPlugin.RESOURCES.arrowUp());
+ up.setTitle("Up");
+ up.addClickHandler(new ClickHandler() {
+ @Override
+ public void onClick(ClickEvent event) {
+ moveUp(row);
+ }
+ });
+ setWidget(row, values.size() + 2, up);
+ }
+ }
+
+ void moveDown(int row) {
+ if (row < getRowCount() - 1) {
+ swap(row, row + 1);
+ }
+ }
+
+ void moveUp(int row) {
+ if (row > 2) {
+ swap(row - 1, row);
+ }
+ }
+
+ void swap(int row1, int row2) {
+ List<String> value = getRowItem(row1);
+ List<String> nextValue = getRowItem(row2);
+ populate(row1, nextValue);
+ populate(row2, value);
+ updateNavigationLinks();
+ widget.setEnabled(true);
+ }
+
+ private void updateNavigationLinks() {
+ if (!autoSort) {
+ for (int row = 2; row < getRowCount(); row++) {
+ getWidget(row, inputs.size() + 1).setVisible(
+ row < getRowCount() - 1);
+ getWidget(row, inputs.size() + 2).setVisible(row > 2);
+ }
+ }
+ }
+
+ void add() {
+ List<String> values = new ArrayList<>();
+ for (NpTextBox input : inputs) {
+ values.add(input.getValue().trim());
+ input.setValue("");
+ }
+ insert(values);
+ }
+
+ void insert(List<String> v) {
+ int insertPos = getRowCount();
+ if (autoSort) {
+ for (int row = 1; row < getRowCount(); row++) {
+ int compareResult = v.get(0).compareTo(getText(row, 1));
+ if (compareResult < 0) {
+ insertPos = row;
+ break;
+ } else if (compareResult == 0) {
+ return;
+ }
+ }
+ }
+ insertRow(insertPos);
+ populate(insertPos, v);
+ updateNavigationLinks();
+ }
+
+ void enableDelete() {
+ for (int row = 2; row < getRowCount(); row++) {
+ if (((CheckBox) getWidget(row, 0)).getValue()) {
+ deleteButton.setEnabled(true);
+ return;
+ }
+ }
+ deleteButton.setEnabled(false);
+ }
+
+ void deleteChecked() {
+ deleteButton.setEnabled(false);
+ for (int row = 2; row < getRowCount(); row++) {
+ if (((CheckBox) getWidget(row, 0)).getValue()) {
+ removeRow(row--);
+ }
+ }
+ updateNavigationLinks();
+ }
+ }
+}
diff --git a/src/main/java/com/googlesource/gerrit/plugins/menuextender/client/TopMenu.java b/src/main/java/com/googlesource/gerrit/plugins/menuextender/client/TopMenu.java
new file mode 100644
index 0000000..d686cfd
--- /dev/null
+++ b/src/main/java/com/googlesource/gerrit/plugins/menuextender/client/TopMenu.java
@@ -0,0 +1,47 @@
+// Copyright (C) 2014 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package com.googlesource.gerrit.plugins.menuextender.client;
+
+import com.google.gwt.core.client.JavaScriptObject;
+import com.google.gwt.core.client.JsArray;
+
+import java.util.List;
+
+public class TopMenu extends JavaScriptObject {
+ public static TopMenu create(String name, List<TopMenuItem> items) {
+ TopMenu m = createObject().cast();
+ m.name(name);
+ m.setItems(items);
+ return m;
+ }
+
+ protected TopMenu() {
+ }
+
+ public final native String getName() /*-{ return this.name; }-*/;
+ public final native JsArray<TopMenuItem> getItems() /*-{ return this.items; }-*/;
+
+ public final native void name(String n) /*-{ this.name = n }-*/;
+
+ final void setItems(List<TopMenuItem> items) {
+ initItems();
+ for (TopMenuItem i : items) {
+ addItem(i);
+ }
+
+ }
+ final native void initItems() /*-{ this.items = []; }-*/;
+ final native void addItem(TopMenuItem i) /*-{ this.items.push(i); }-*/;
+}
diff --git a/src/main/java/com/googlesource/gerrit/plugins/menuextender/client/TopMenuItem.java b/src/main/java/com/googlesource/gerrit/plugins/menuextender/client/TopMenuItem.java
new file mode 100644
index 0000000..4e90572
--- /dev/null
+++ b/src/main/java/com/googlesource/gerrit/plugins/menuextender/client/TopMenuItem.java
@@ -0,0 +1,42 @@
+// Copyright (C) 2014 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package com.googlesource.gerrit.plugins.menuextender.client;
+
+import com.google.gwt.core.client.JavaScriptObject;
+
+public class TopMenuItem extends JavaScriptObject {
+ public static TopMenuItem create(String name, String url, String target,
+ String id) {
+ TopMenuItem i = createObject().cast();
+ i.name(name);
+ i.url(url);
+ i.target(target);
+ i.id(id);
+ return i;
+ }
+
+ public final native String getName() /*-{ return this.name; }-*/;
+ public final native String getUrl() /*-{ return this.url; }-*/;
+ public final native String getTarget() /*-{ return this.target; }-*/;
+ public final native String getId() /*-{ return this.id; }-*/;
+
+ public final native void name(String n) /*-{ this.name = n }-*/;
+ public final native void url(String u) /*-{ this.url = u }-*/;
+ public final native void target(String t) /*-{ this.target = t }-*/;
+ public final native void id(String i) /*-{ this.id = i }-*/;
+
+ protected TopMenuItem() {
+ }
+}
diff --git a/src/main/java/com/googlesource/gerrit/plugins/menuextender/client/TopMenuList.java b/src/main/java/com/googlesource/gerrit/plugins/menuextender/client/TopMenuList.java
new file mode 100644
index 0000000..7d46c98
--- /dev/null
+++ b/src/main/java/com/googlesource/gerrit/plugins/menuextender/client/TopMenuList.java
@@ -0,0 +1,23 @@
+// Copyright (C) 2014 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package com.googlesource.gerrit.plugins.menuextender.client;
+
+import com.google.gwt.core.client.JsArray;
+
+public class TopMenuList extends JsArray<TopMenu> {
+
+ protected TopMenuList() {
+ }
+}
diff --git a/src/main/java/com/googlesource/gerrit/plugins/menuextender/client/arrowDown.png b/src/main/java/com/googlesource/gerrit/plugins/menuextender/client/arrowDown.png
new file mode 100644
index 0000000..ba67de7
--- /dev/null
+++ b/src/main/java/com/googlesource/gerrit/plugins/menuextender/client/arrowDown.png
Binary files differ
diff --git a/src/main/java/com/googlesource/gerrit/plugins/menuextender/client/arrowUp.png b/src/main/java/com/googlesource/gerrit/plugins/menuextender/client/arrowUp.png
new file mode 100644
index 0000000..5674d6c
--- /dev/null
+++ b/src/main/java/com/googlesource/gerrit/plugins/menuextender/client/arrowUp.png
Binary files differ
diff --git a/src/main/java/com/googlesource/gerrit/plugins/menuextender/client/info.png b/src/main/java/com/googlesource/gerrit/plugins/menuextender/client/info.png
new file mode 100644
index 0000000..8851b99
--- /dev/null
+++ b/src/main/java/com/googlesource/gerrit/plugins/menuextender/client/info.png
Binary files differ
diff --git a/src/main/java/com/googlesource/gerrit/plugins/menuextender/client/listAdd.png b/src/main/java/com/googlesource/gerrit/plugins/menuextender/client/listAdd.png
new file mode 100644
index 0000000..1aa7f09
--- /dev/null
+++ b/src/main/java/com/googlesource/gerrit/plugins/menuextender/client/listAdd.png
Binary files differ
diff --git a/src/main/java/com/googlesource/gerrit/plugins/menuextender/public/menuextender.css b/src/main/java/com/googlesource/gerrit/plugins/menuextender/public/menuextender.css
new file mode 100644
index 0000000..bcdd84f
--- /dev/null
+++ b/src/main/java/com/googlesource/gerrit/plugins/menuextender/public/menuextender.css
@@ -0,0 +1,61 @@
+.menuextender-panel {
+ border-spacing: 0px 5px;
+}
+
+.menuextender-stringListTable {
+ border-collapse: separate;
+ border-spacing: 0;
+}
+
+.menuextender-stringListTable .leftMostCell {
+ border-left: 1px solid #EEE;
+}
+
+.menuextender-stringListTable .topMostCell {
+ border-top: 1px solid #EEE;
+}
+
+.menuextender-stringListTable .dataHeader {
+ border: 1px solid #FFF;
+ padding: 2px 6px 1px;
+ background-color: #EEE;
+ font-style: italic;
+ white-space: nowrap;
+ color: textColor;
+}
+
+.menuextender-stringListTable .iconHeader {
+ border-top: 1px solid #FFF;
+ border-bottom: 1px solid #FFF;
+ background-color: #EEE;
+}
+
+.menuextender-stringListTable .dataCell {
+ padding-left: 5px;
+ padding-right: 5px;
+ border-right: 1px solid #EEE;
+ border-bottom: 1px solid #EEE;
+ vertical-align: middle;
+ height: 20px;
+}
+
+.menuextender-stringListTable .iconCell {
+ width: 1px;
+ padding: 0px;
+ vertical-align: middle;
+ border-bottom: 1px solid #EEE;
+}
+
+.menuextender-smallHeading {
+ margin-top: 5px;
+ font-weight: bold;
+}
+
+.menuextender-stringListPanelButtons {
+ margin-left: 0.5em;
+}
+.menuextender-stringListPanelButtons .gwt-Button {
+ margin-right: 2em;
+ font-size: 7pt;
+ padding: 1px;
+}
\ No newline at end of file
diff --git a/src/main/resources/Documentation/about.md b/src/main/resources/Documentation/about.md
new file mode 100644
index 0000000..fdeb461
--- /dev/null
+++ b/src/main/resources/Documentation/about.md
@@ -0,0 +1,2 @@
+The @PLUGIN@ plugin allows Gerrit administrators to configure
+additional menu entries from the WebUI.
diff --git a/src/main/resources/Documentation/config.md b/src/main/resources/Documentation/config.md
new file mode 100644
index 0000000..12723a3
--- /dev/null
+++ b/src/main/resources/Documentation/config.md
@@ -0,0 +1,33 @@
+@PLUGIN@ Configuration
+======================
+
+The menu entries configured by the @PLUGIN@ plugin are stored in
+`$site_path/etc/@PLUGIN@.config` which is a Git-style config file.
+
+```
+ [menuItem "http://code.google.com/p/gerrit/"]
+ topMenu = Gerrit
+ name = Homepage
+```
+
+Each menu item is stored in a `menuItem` section where the menu item
+URL is used as subsection name.
+
+<a id="topMenu">
+`menuItem.<url>.topMenu`
+: The name of the top menu under which this menu item should be
+ shown.
+
+ Default is `Extensions`.
+
+<a id="name">
+`menuItem.<url>.name`
+: The name of menu item.
+
+<a id="target">
+`menuItem.<url>.target`
+: The target of the menu item link.
+
+<a id="id">
+`menuItem.<url>.id`
+: The ID of the menu item link.
diff --git a/src/main/resources/Documentation/rest-api-config.md b/src/main/resources/Documentation/rest-api-config.md
new file mode 100644
index 0000000..78802f7
--- /dev/null
+++ b/src/main/resources/Documentation/rest-api-config.md
@@ -0,0 +1,109 @@
+@PLUGIN@ - /config/ REST API
+============================
+
+This page describes the REST endpoints that are added by the @PLUGIN@
+plugin.
+
+Please also take note of the general information on the
+[REST API](../../../Documentation/rest-api.html).
+
+<a id="config-endpoints"> Config Endpoints
+------------------------------------------
+
+### <a id="get-menus"> Get Menus
+_GET /config/\{server\}/@PLUGIN@~menus/_
+
+Gets the additional menus entries.
+
+#### Request
+
+```
+ GET /config/server/@PLUGIN@~menus/ HTTP/1.0
+```
+
+As response a list of [TopMenuEntryInfo](../../../Documentation/rest-api-config.html#top-menu-entry-info)
+entities is returned that describe the additional menu entries.
+
+#### Response
+
+```
+ HTTP/1.1 200 OK
+ Content-Disposition: attachment
+ Content-Type: application/json;charset=UTF-8
+
+ )]}'
+ [
+ {
+ "name": "Gerrit",
+ "items": [
+ {
+ "url": "http://code.google.com/p/gerrit/",
+ "name": "Homepage"
+ }
+ ]
+ }
+ ]
+```
+
+### <a id="set-menus"> Set Menus
+_PUT /config/\{server\}/@PLUGIN@~menus/_
+
+Sets the additional menus entries. Any additional menu entries which
+have been set before are overwritten.
+
+The additional menu entries must be provided in the request body as a
+[MenusInput](#menus-input) entity.
+
+#### Request
+
+```
+ PUT /config/server/@PLUGIN@~menus/ HTTP/1.0
+ Content-Type: application/json;charset=UTF-8
+
+ {
+ "menus": [
+ {
+ "name": "Gerrit",
+ "items": [
+ {
+ "url": "http://code.google.com/p/gerrit/",
+ "name": "Homepage"
+ }
+ ]
+ }
+ ]
+ }
+```
+
+As response a list of [TopMenuEntryInfo](../../../Documentation/rest-api-config.html#top-menu-entry-info)
+entities is returned that describe the additional menu entries.
+
+#### Response
+
+```
+ HTTP/1.1 200 OK
+ Content-Disposition: attachment
+ Content-Type: application/json;charset=UTF-8
+
+ )]}'
+ [
+ {
+ "name": "Gerrit",
+ "items": [
+ {
+ "url": "http://code.google.com/p/gerrit/",
+ "name": "Homepage"
+ }
+ ]
+ }
+ ]
+```
+
+<a id="json-entities">JSON Entities
+-----------------------------------
+
+### <a id="menus-input"></a>MenusInput
+
+The `MenusInput` entity contains information about additional menu entries.
+
+* _menus_: List of [TopMenuEntryInfo](../../../Documentation/rest-api-config.html#top-menu-entry-info) entities.