Plugin that allows users to see emoticons in comments as images This plugin uses a new extension point in Gerrit core that is added by Ia4f689b0. Emoticons are only rendered in expanded comments. Collapsed comments only show a one-line summary and we do not do any replacements in there. Change-Id: Ic1994e75c07c1a95cf84d20e93ddf0402d312d0d Signed-off-by: Edwin Kempin <ekempin@google.com>
diff --git a/.buckconfig b/.buckconfig new file mode 100644 index 0000000..ed0f6fe --- /dev/null +++ b/.buckconfig
@@ -0,0 +1,14 @@ +[alias] + emoticons = //:emoticons + plugin = //:emoticons + +[java] + src_roots = java, resources + +[project] + ignore = .git + +[cache] + mode = dir + dir = buck-out/cache +
diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..d9511b2 --- /dev/null +++ b/.gitignore
@@ -0,0 +1,9 @@ +/.buckversion +/.buckd +/.watchmanconfig +/buck-out +/bucklets +/.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..5a0ad22 --- /dev/null +++ b/.settings/org.eclipse.core.runtime.prefs
@@ -0,0 +1,2 @@ +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..c6dd34f --- /dev/null +++ b/.settings/org.eclipse.jdt.ui.prefs
@@ -0,0 +1,60 @@ +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/BUCK b/BUCK new file mode 100644 index 0000000..e2e5702 --- /dev/null +++ b/BUCK
@@ -0,0 +1,23 @@ +include_defs('//bucklets/gerrit_plugin.bucklet') + +MODULE = 'com.googlesource.gerrit.plugins.emoticons.Emoticons' + +gerrit_plugin( + name = 'emoticons', + srcs = glob(['src/main/java/**/*.java']), + resources = glob(['src/main/**/*'], excludes = ['**/*.java']), + gwt_module = MODULE, + manifest_entries = [ + 'Gerrit-PluginName: emoticons', + 'Gerrit-Module: com.googlesource.gerrit.plugins.emoticons.Module', + 'Gerrit-HttpModule: com.googlesource.gerrit.plugins.emoticons.HttpModule', + ], +) + +java_library( + name = 'classpath', + deps = GERRIT_GWT_API + GERRIT_PLUGIN_API + [ + ':emoticons__plugin', + '//lib/gwt:user', + ], +)
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/lib/gerrit/BUCK b/lib/gerrit/BUCK new file mode 100644 index 0000000..acb4718 --- /dev/null +++ b/lib/gerrit/BUCK
@@ -0,0 +1,20 @@ +include_defs('//bucklets/maven_jar.bucklet') + +VER = '2.13-SNAPSHOT' +REPO = MAVEN_LOCAL + +maven_jar( + name = 'plugin-api', + id = 'com.google.gerrit:gerrit-plugin-api:' + VER, + license = 'Apache2.0', + attach_source = False, + repository = REPO, +) + +maven_jar( + name = 'gwtui-api', + id = 'com.google.gerrit:gerrit-plugin-gwtui:' + VER, + license = 'Apache2.0', + attach_source = False, + repository = REPO, +)
diff --git a/lib/gwt/BUCK b/lib/gwt/BUCK new file mode 100644 index 0000000..b8d9491 --- /dev/null +++ b/lib/gwt/BUCK
@@ -0,0 +1,34 @@ +include_defs('//bucklets/maven_jar.bucklet') + +VERSION = '2.7.0' + +maven_jar( + name = 'user', + id = 'com.google.gwt:gwt-user:' + VERSION, + sha1 = 'bdc7af42581745d3d79c2efe0b514f432b998a5b', + license = 'Apache2.0', + attach_source = False, +) + +maven_jar( + name = 'dev', + id = 'com.google.gwt:gwt-dev:' + VERSION, + sha1 = 'c2c3dd5baf648a0bb199047a818be5e560f48982', + license = 'Apache2.0', + deps = [ + ':javax-validation', + ':javax-validation_src', + ], + attach_source = False, + exclude = ['org/eclipse/jetty/*'], +) + +maven_jar( + name = 'javax-validation', + id = 'javax.validation:validation-api:1.0.0.GA', + bin_sha1 = 'b6bd7f9d78f6fdaa3c37dae18a4bd298915f328e', + src_sha1 = '7a561191db2203550fbfa40d534d4997624cd369', + license = 'Apache2.0', + visibility = [], +) +
diff --git a/lib/ow2/BUCK b/lib/ow2/BUCK new file mode 100644 index 0000000..db6c76c --- /dev/null +++ b/lib/ow2/BUCK
@@ -0,0 +1,32 @@ +include_defs('//bucklets/maven_jar.bucklet') + +VERSION = '5.0.3' + +maven_jar( + name = 'ow2-asm', + id = 'org.ow2.asm:asm:' + VERSION, + sha1 = 'dcc2193db20e19e1feca8b1240dbbc4e190824fa', + license = 'ow2', +) + +maven_jar( + name = 'ow2-asm-analysis', + id = 'org.ow2.asm:asm-analysis:' + VERSION, + sha1 = 'c7126aded0e8e13fed5f913559a0dd7b770a10f3', + license = 'ow2', +) + +maven_jar( + name = 'ow2-asm-tree', + id = 'org.ow2.asm:asm-tree:' + VERSION, + sha1 = '287749b48ba7162fb67c93a026d690b29f410bed', + license = 'ow2', +) + +maven_jar( + name = 'ow2-asm-util', + id = 'org.ow2.asm:asm-util:' + VERSION, + sha1 = '1512e5571325854b05fb1efce1db75fcced54389', + license = 'ow2', +) +
diff --git a/src/main/java/com/googlesource/gerrit/plugins/emoticons/Emoticons.gwt.xml b/src/main/java/com/googlesource/gerrit/plugins/emoticons/Emoticons.gwt.xml new file mode 100644 index 0000000..4160909 --- /dev/null +++ b/src/main/java/com/googlesource/gerrit/plugins/emoticons/Emoticons.gwt.xml
@@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + Copyright (C) 2015 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="emoticons"> + <!-- 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"/> + <!-- Specify the app entry point class. --> + <entry-point class="com.googlesource.gerrit.plugins.emoticons.client.EmoticonsPlugin"/> + <stylesheet src="emoticons"/> +</module>
diff --git a/src/main/java/com/googlesource/gerrit/plugins/emoticons/GetConfig.java b/src/main/java/com/googlesource/gerrit/plugins/emoticons/GetConfig.java new file mode 100644 index 0000000..7fff131 --- /dev/null +++ b/src/main/java/com/googlesource/gerrit/plugins/emoticons/GetConfig.java
@@ -0,0 +1,47 @@ +// Copyright (C) 2015 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.emoticons; + +import com.google.gerrit.extensions.annotations.PluginName; +import com.google.gerrit.extensions.restapi.RestReadView; +import com.google.gerrit.server.config.ConfigResource; +import com.google.gerrit.server.config.PluginConfig; +import com.google.gerrit.server.config.PluginConfigFactory; +import com.google.inject.Inject; + +public class GetConfig implements RestReadView<ConfigResource> { + + private final PluginConfig cfg; + + @Inject + public GetConfig(PluginConfigFactory cfgFactory, + @PluginName String pluginName) { + this.cfg = cfgFactory.getFromGerritConfig(pluginName); + } + + @Override + public ConfigInfo apply(ConfigResource resource) { + ConfigInfo info = new ConfigInfo(); + info.showEmoticons = cfg.getBoolean("showEmoticons", true); + if (!info.showEmoticons) { + info.showEmoticons = null; + } + return info; + } + + public static class ConfigInfo { + Boolean showEmoticons; + } +}
diff --git a/src/main/java/com/googlesource/gerrit/plugins/emoticons/GetPreference.java b/src/main/java/com/googlesource/gerrit/plugins/emoticons/GetPreference.java new file mode 100644 index 0000000..2e26bfe --- /dev/null +++ b/src/main/java/com/googlesource/gerrit/plugins/emoticons/GetPreference.java
@@ -0,0 +1,70 @@ +// Copyright (C) 2015 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.emoticons; + +import com.google.gerrit.extensions.annotations.PluginName; +import com.google.gerrit.extensions.restapi.AuthException; +import com.google.gerrit.extensions.restapi.RestReadView; +import com.google.gerrit.server.IdentifiedUser; +import com.google.gerrit.server.account.AccountResource; +import com.google.gerrit.server.config.ConfigResource; +import com.google.gerrit.server.project.ProjectCache; +import com.google.inject.Inject; +import com.google.inject.Provider; + +import com.googlesource.gerrit.plugins.emoticons.GetConfig.ConfigInfo; + +import org.eclipse.jgit.lib.Config; + +public class GetPreference implements RestReadView<AccountResource> { + public static final String PREFERENCE = "preference"; + public static final String KEY_SHOW_EMOTICONS = "showEmoticons"; + + private final Provider<IdentifiedUser> self; + private final ProjectCache projectCache; + private final String pluginName; + private final Provider<GetConfig> getConfig; + + @Inject + GetPreference(Provider<IdentifiedUser> self, + ProjectCache projectCache, + @PluginName String pluginName, + Provider<GetConfig> getConfig) { + this.self = self; + this.projectCache = projectCache; + this.pluginName = pluginName; + this.getConfig = getConfig; + } + + @Override + public ConfigInfo apply(AccountResource rsrc) throws AuthException { + if (self.get() != rsrc.getUser() + && !self.get().getCapabilities().canAdministrateServer()) { + throw new AuthException("not allowed to get preference"); + } + + ConfigInfo globalCfg = getConfig.get().apply(new ConfigResource()); + Config db = + projectCache.getAllProjects().getConfig(pluginName + ".config").get(); + ConfigInfo info = new ConfigInfo(); + info.showEmoticons = + db.getBoolean(PREFERENCE, self.get().getUserName(), KEY_SHOW_EMOTICONS, + (globalCfg.showEmoticons != null ? globalCfg.showEmoticons : true)); + if (!info.showEmoticons) { + info.showEmoticons = null; + } + return info; + } +}
diff --git a/src/main/java/com/googlesource/gerrit/plugins/emoticons/HttpModule.java b/src/main/java/com/googlesource/gerrit/plugins/emoticons/HttpModule.java new file mode 100644 index 0000000..a02c286 --- /dev/null +++ b/src/main/java/com/googlesource/gerrit/plugins/emoticons/HttpModule.java
@@ -0,0 +1,31 @@ +// Copyright (C) 2015 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.emoticons; + +import com.google.gerrit.extensions.registration.DynamicSet; +import com.google.gerrit.extensions.webui.GwtPlugin; +import com.google.gerrit.extensions.webui.JavaScriptPlugin; +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("emoticons")); + DynamicSet.bind(binder(), WebUiPlugin.class) + .toInstance(new JavaScriptPlugin("emoticons.js")); + } +}
diff --git a/src/main/java/com/googlesource/gerrit/plugins/emoticons/Module.java b/src/main/java/com/googlesource/gerrit/plugins/emoticons/Module.java new file mode 100644 index 0000000..a2a11c5 --- /dev/null +++ b/src/main/java/com/googlesource/gerrit/plugins/emoticons/Module.java
@@ -0,0 +1,36 @@ +// Copyright (C) 2015 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.emoticons; + +import static com.google.gerrit.server.account.AccountResource.ACCOUNT_KIND; +import static com.google.gerrit.server.config.ConfigResource.CONFIG_KIND; + +import com.google.gerrit.extensions.restapi.RestApiModule; +import com.google.inject.AbstractModule; + +public class Module extends AbstractModule { + @Override + protected void configure() { + install(new RestApiModule() { + @Override + protected void configure() { + get(CONFIG_KIND, "config").to(GetConfig.class); + put(CONFIG_KIND, "config").to(PutConfig.class); + get(ACCOUNT_KIND, "preference").to(GetPreference.class); + put(ACCOUNT_KIND, "preference").to(PutPreference.class); + } + }); + } +}
diff --git a/src/main/java/com/googlesource/gerrit/plugins/emoticons/PutConfig.java b/src/main/java/com/googlesource/gerrit/plugins/emoticons/PutConfig.java new file mode 100644 index 0000000..af6d22c --- /dev/null +++ b/src/main/java/com/googlesource/gerrit/plugins/emoticons/PutConfig.java
@@ -0,0 +1,78 @@ +// Copyright (C) 2015 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.emoticons; + +import com.google.gerrit.common.data.GlobalCapability; +import com.google.gerrit.extensions.annotations.CapabilityScope; +import com.google.gerrit.extensions.annotations.PluginName; +import com.google.gerrit.extensions.annotations.RequiresCapability; +import com.google.gerrit.extensions.restapi.Response; +import com.google.gerrit.extensions.restapi.RestModifyView; +import com.google.gerrit.extensions.restapi.UnprocessableEntityException; +import com.google.gerrit.server.config.ConfigResource; +import com.google.gerrit.server.config.PluginConfigFactory; +import com.google.gerrit.server.config.SitePaths; +import com.google.inject.Inject; + +import com.googlesource.gerrit.plugins.emoticons.PutConfig.Input; + +import org.eclipse.jgit.errors.ConfigInvalidException; +import org.eclipse.jgit.storage.file.FileBasedConfig; +import org.eclipse.jgit.util.FS; + +import java.io.IOException; + +@RequiresCapability(value = GlobalCapability.ADMINISTRATE_SERVER, scope = CapabilityScope.CORE) +public class PutConfig implements RestModifyView<ConfigResource, Input>{ + public static class Input { + public Boolean showEmoticons; + } + + private final PluginConfigFactory cfgFactory; + private final SitePaths sitePaths; + private final String pluginName; + + @Inject + PutConfig(PluginConfigFactory cfgFactory, + SitePaths sitePaths, + @PluginName String pluginName) { + this.cfgFactory = cfgFactory; + this.sitePaths = sitePaths; + this.pluginName = pluginName; + } + + @Override + public Response<?> apply(ConfigResource rsrc, Input input) + throws IOException, ConfigInvalidException, UnprocessableEntityException { + if (input == null) { + input = new Input(); + } + FileBasedConfig cfg = + new FileBasedConfig(sitePaths.gerrit_config.toFile(), FS.DETECTED); + cfg.load(); + + if (input.showEmoticons != null) { + if (input.showEmoticons) { + cfg.setBoolean("plugin", pluginName, "showEmoticons", input.showEmoticons); + } else { + cfg.unset("plugin", pluginName, "stage"); + } + } + + cfg.save(); + cfgFactory.getFromGerritConfig(pluginName, true); + return Response.none(); + } +}
diff --git a/src/main/java/com/googlesource/gerrit/plugins/emoticons/PutPreference.java b/src/main/java/com/googlesource/gerrit/plugins/emoticons/PutPreference.java new file mode 100644 index 0000000..8d24990 --- /dev/null +++ b/src/main/java/com/googlesource/gerrit/plugins/emoticons/PutPreference.java
@@ -0,0 +1,100 @@ +// Copyright (C) 2015 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.emoticons; + +import static com.googlesource.gerrit.plugins.emoticons.GetPreference.KEY_SHOW_EMOTICONS; +import static com.googlesource.gerrit.plugins.emoticons.GetPreference.PREFERENCE; + +import com.google.gerrit.extensions.annotations.PluginName; +import com.google.gerrit.extensions.restapi.AuthException; +import com.google.gerrit.extensions.restapi.Response; +import com.google.gerrit.extensions.restapi.RestModifyView; +import com.google.gerrit.extensions.restapi.UnprocessableEntityException; +import com.google.gerrit.server.IdentifiedUser; +import com.google.gerrit.server.account.AccountResource; +import com.google.gerrit.server.git.MetaDataUpdate; +import com.google.gerrit.server.git.ProjectLevelConfig; +import com.google.gerrit.server.project.ProjectCache; +import com.google.inject.Inject; +import com.google.inject.Provider; + +import com.googlesource.gerrit.plugins.emoticons.PutConfig.Input; + +import org.eclipse.jgit.errors.RepositoryNotFoundException; +import org.eclipse.jgit.lib.Config; + +import java.io.IOException; + +public class PutPreference implements RestModifyView<AccountResource, Input> { + private final Provider<IdentifiedUser> self; + private final ProjectCache projectCache; + private final MetaDataUpdate.User metaDataUpdateFactory; + private final String pluginName; + + @Inject + PutPreference(Provider<IdentifiedUser> self, + ProjectCache projectCache, + MetaDataUpdate.User metaDataUpdateFactory, + @PluginName String pluginName) { + this.self = self; + this.projectCache = projectCache; + this.metaDataUpdateFactory = metaDataUpdateFactory; + this.pluginName = pluginName; + } + + @Override + public Response<String> apply(AccountResource rsrc, Input input) + throws AuthException, RepositoryNotFoundException, IOException, + UnprocessableEntityException { + if (self.get() != rsrc.getUser() + && !self.get().getCapabilities().canAdministrateServer()) { + throw new AuthException("not allowed to change preference"); + } + if (input == null) { + input = new Input(); + } + + String username = self.get().getUserName(); + + ProjectLevelConfig storage = + projectCache.getAllProjects().getConfig(pluginName + ".config"); + Config db = storage.get(); + boolean modified = false; + + boolean showEmoticons = + db.getBoolean(PREFERENCE, username, KEY_SHOW_EMOTICONS, true); + if (input.showEmoticons != null) { + if (input.showEmoticons != showEmoticons) { + db.setBoolean(PREFERENCE, username, KEY_SHOW_EMOTICONS, input.showEmoticons); + modified = true; + } + } else { + if (!showEmoticons) { + db.unset(PREFERENCE, username, KEY_SHOW_EMOTICONS); + modified = true; + } + } + + if (modified) { + MetaDataUpdate md = metaDataUpdateFactory.create( + projectCache.getAllProjects().getProject().getNameKey()); + md.setMessage("Update " + pluginName + " Preferences for '" + + username + "'\n"); + storage.commit(md); + } + + return Response.<String> ok("OK"); + } +}
diff --git a/src/main/java/com/googlesource/gerrit/plugins/emoticons/client/ConfigInfo.java b/src/main/java/com/googlesource/gerrit/plugins/emoticons/client/ConfigInfo.java new file mode 100644 index 0000000..9573b43 --- /dev/null +++ b/src/main/java/com/googlesource/gerrit/plugins/emoticons/client/ConfigInfo.java
@@ -0,0 +1,31 @@ +// Copyright (C) 2015 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.emoticons.client; + +import com.google.gwt.core.client.JavaScriptObject; + +public class ConfigInfo extends JavaScriptObject { + final native boolean showEmoticons() /*-{ return this.show_emoticons ? true : false; }-*/; + + final native void setShowEmoticons(boolean s) /*-{ this.show_emoticons = s; }-*/; + + static ConfigInfo create() { + ConfigInfo g = (ConfigInfo) createObject(); + return g; + } + + protected ConfigInfo() { + } +}
diff --git a/src/main/java/com/googlesource/gerrit/plugins/emoticons/client/EmoticonsAdminScreen.java b/src/main/java/com/googlesource/gerrit/plugins/emoticons/client/EmoticonsAdminScreen.java new file mode 100644 index 0000000..049f40e --- /dev/null +++ b/src/main/java/com/googlesource/gerrit/plugins/emoticons/client/EmoticonsAdminScreen.java
@@ -0,0 +1,35 @@ +// Copyright (C) 2015 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.emoticons.client; + +import com.google.gerrit.plugin.client.Plugin; +import com.google.gerrit.plugin.client.rpc.RestApi; +import com.google.gerrit.plugin.client.screen.Screen; + +public class EmoticonsAdminScreen extends EmoticonsConfigScreen { + + static class Factory implements Screen.EntryPoint { + @Override + public void onLoad(Screen screen) { + screen.setPageTitle(Plugin.get().getPluginName() + "Admin"); + screen.show(new EmoticonsAdminScreen()); + } + } + + EmoticonsAdminScreen() { + super(new RestApi("config").id("server").view( + Plugin.get().getPluginName(), "config")); + } +}
diff --git a/src/main/java/com/googlesource/gerrit/plugins/emoticons/client/EmoticonsConfigScreen.java b/src/main/java/com/googlesource/gerrit/plugins/emoticons/client/EmoticonsConfigScreen.java new file mode 100644 index 0000000..879f46c --- /dev/null +++ b/src/main/java/com/googlesource/gerrit/plugins/emoticons/client/EmoticonsConfigScreen.java
@@ -0,0 +1,99 @@ +// Copyright (C) 2015 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.emoticons.client; + +import com.google.gerrit.plugin.client.rpc.RestApi; +import com.google.gwt.core.client.JavaScriptObject; +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.CheckBox; +import com.google.gwt.user.client.ui.HorizontalPanel; +import com.google.gwt.user.client.ui.Image; +import com.google.gwt.user.client.ui.VerticalPanel; + +public abstract class EmoticonsConfigScreen extends VerticalPanel { + private final RestApi restApi; + + private CheckBox showEmoticonsBox; + private Button saveButton; + + protected EmoticonsConfigScreen(RestApi restApi) { + this.restApi = restApi; + setStyleName("emoticons-config-screen"); + restApi.get(new AsyncCallback<ConfigInfo>() { + @Override + public void onSuccess(ConfigInfo info) { + display(info); + } + + @Override + public void onFailure(Throwable caught) { + // never invoked + } + }); + } + + protected void display(ConfigInfo info) { + HorizontalPanel p = new HorizontalPanel(); + p.setStyleName("emoticons-label-panel"); + showEmoticonsBox = new CheckBox("Show emoticons as images"); + showEmoticonsBox.setValue(info.showEmoticons()); + p.add(showEmoticonsBox); + Image stageInfo = new Image(EmoticonsPlugin.RESOURCES.lightbulb()); + stageInfo.setTitle("Emoticons in comments are replaced by images."); + p.add(stageInfo); + add(p); + + HorizontalPanel buttons = new HorizontalPanel(); + add(buttons); + + saveButton = new Button("Save"); + saveButton.setStyleName("emoticons-save-button"); + saveButton.addClickHandler(new ClickHandler() { + @Override + public void onClick(final ClickEvent event) { + doSave(); + } + }); + buttons.add(saveButton); + saveButton.setEnabled(false); + new OnEditEnabler(saveButton, showEmoticonsBox); + + showEmoticonsBox.setFocus(true); + saveButton.setEnabled(false); + } + + private void doSave() { + ConfigInfo in = ConfigInfo.create(); + in.setShowEmoticons(showEmoticonsBox.getValue()); + restApi.put(in, new AsyncCallback<JavaScriptObject>() { + @Override + public void onSuccess(JavaScriptObject result) { + saveButton.setEnabled(false); + onSave(); + } + + @Override + public void onFailure(Throwable caught) { + // never invoked + } + }); + } + + protected void onSave() { + } +}
diff --git a/src/main/java/com/googlesource/gerrit/plugins/emoticons/client/EmoticonsPlugin.java b/src/main/java/com/googlesource/gerrit/plugins/emoticons/client/EmoticonsPlugin.java new file mode 100644 index 0000000..00c5c44 --- /dev/null +++ b/src/main/java/com/googlesource/gerrit/plugins/emoticons/client/EmoticonsPlugin.java
@@ -0,0 +1,32 @@ +// Copyright (C) 2015 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.emoticons.client; + +import com.google.gerrit.plugin.client.Plugin; +import com.google.gerrit.plugin.client.PluginEntryPoint; +import com.google.gwt.core.client.GWT; + +public class EmoticonsPlugin extends PluginEntryPoint { + public static final Resources RESOURCES = GWT.create(Resources.class); + + @Override + public void onPluginLoad() { + Plugin.get().screen("settings", + new EmoticonsAdminScreen.Factory()); + Plugin.get().settingsScreen("preferences", + Plugin.get().getName() + " Preferences", + new EmoticonsPreferenceScreen.Factory()); + } +}
diff --git a/src/main/java/com/googlesource/gerrit/plugins/emoticons/client/EmoticonsPreferenceScreen.java b/src/main/java/com/googlesource/gerrit/plugins/emoticons/client/EmoticonsPreferenceScreen.java new file mode 100644 index 0000000..a2e113c --- /dev/null +++ b/src/main/java/com/googlesource/gerrit/plugins/emoticons/client/EmoticonsPreferenceScreen.java
@@ -0,0 +1,42 @@ +// Copyright (C) 2015 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.emoticons.client; + +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.user.client.Cookies; + +public class EmoticonsPreferenceScreen extends EmoticonsConfigScreen { + + static class Factory implements Screen.EntryPoint { + @Override + public void onLoad(Screen screen) { + screen.setPageTitle(Plugin.get().getPluginName() + "Preferences"); + screen.show(new EmoticonsPreferenceScreen()); + } + } + + EmoticonsPreferenceScreen() { + super(new RestApi("accounts").id("self").view( + Plugin.get().getPluginName(), "preference")); + } + + @Override + protected void onSave() { + super.onSave(); + Cookies.removeCookie(Plugin.get().getPluginName() + "~prefs"); + } +}
diff --git a/src/main/java/com/googlesource/gerrit/plugins/emoticons/client/OnEditEnabler.java b/src/main/java/com/googlesource/gerrit/plugins/emoticons/client/OnEditEnabler.java new file mode 100644 index 0000000..624473b --- /dev/null +++ b/src/main/java/com/googlesource/gerrit/plugins/emoticons/client/OnEditEnabler.java
@@ -0,0 +1,181 @@ +// 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.emoticons.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<>(); + private String originalValue; + + + // The first parameter to the constructors must be the FocusWidget to enable, + // subsequent parameters are widgets to listenTo. + + public OnEditEnabler(FocusWidget w, TextBoxBase tb) { + this(w); + originalValue = tb.getValue().trim(); + listenTo(tb); + } + + public OnEditEnabler(FocusWidget w, ListBox lb) { + this(w); + listenTo(lb); + } + + public OnEditEnabler(FocusWidget w, CheckBox cb) { + this(w); + listenTo(cb); + } + + public OnEditEnabler(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(ListBox lb) { + lb.addChangeHandler(this); + } + + @SuppressWarnings({"unchecked", "rawtypes"}) + public void listenTo(CheckBox cb) { + cb.addValueChangeHandler((ValueChangeHandler) this); + } + + // Handlers + + @Override + public void onKeyPress(KeyPressEvent e) { + on(e); + } + + @Override + public void onKeyDown(KeyDownEvent e) { + on(e); + } + + @Override + public void onMouseUp(MouseUpEvent e) { + on(e); + } + + @Override + public void onChange(ChangeEvent e) { + on(e); + } + + @SuppressWarnings("rawtypes") + @Override + public void onValueChange(ValueChangeEvent e) { + on(e); + } + + private void on(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/emoticons/client/Resources.java b/src/main/java/com/googlesource/gerrit/plugins/emoticons/client/Resources.java new file mode 100644 index 0000000..bab6f39 --- /dev/null +++ b/src/main/java/com/googlesource/gerrit/plugins/emoticons/client/Resources.java
@@ -0,0 +1,24 @@ +// Copyright (C) 2015 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.emoticons.client; + +import com.google.gwt.resources.client.ClientBundle; +import com.google.gwt.resources.client.ImageResource; + +public interface Resources extends ClientBundle { + + @Source("lightbulb.png") + public ImageResource lightbulb(); +}
diff --git a/src/main/java/com/googlesource/gerrit/plugins/emoticons/client/information.png b/src/main/java/com/googlesource/gerrit/plugins/emoticons/client/information.png new file mode 100644 index 0000000..12cd1ae --- /dev/null +++ b/src/main/java/com/googlesource/gerrit/plugins/emoticons/client/information.png Binary files differ
diff --git a/src/main/java/com/googlesource/gerrit/plugins/emoticons/client/lightbulb.png b/src/main/java/com/googlesource/gerrit/plugins/emoticons/client/lightbulb.png new file mode 100644 index 0000000..d22fde8 --- /dev/null +++ b/src/main/java/com/googlesource/gerrit/plugins/emoticons/client/lightbulb.png Binary files differ
diff --git a/src/main/java/com/googlesource/gerrit/plugins/emoticons/public/emoticons.css b/src/main/java/com/googlesource/gerrit/plugins/emoticons/public/emoticons.css new file mode 100644 index 0000000..0f32867 --- /dev/null +++ b/src/main/java/com/googlesource/gerrit/plugins/emoticons/public/emoticons.css
@@ -0,0 +1,20 @@ +.emoticons-config-screen { + width: 100%; + border-spacing: 0px 5px; +} + +.emoticons-label-panel { + margin-bottom: 10px; +} + +.emoticons-label-panel td { + vertical-align: middle !important; +} + +.emoticons-label-panel td div { + margin-right: 5px; +} + +.emoticons-save-button { + margin-bottom: 10px; +}
diff --git a/src/main/resources/Documentation/about.md b/src/main/resources/Documentation/about.md new file mode 100644 index 0000000..589d0e4 --- /dev/null +++ b/src/main/resources/Documentation/about.md
@@ -0,0 +1,17 @@ +The @PLUGIN@ plugin allows users to see emoticons in comments as +images. + +Emoticons are only rendered in expanded comments. Collapsed comments +only show a one-line summary and for this summary no replacements are +done. + +Licenses +-------- + +The @PLUGIN@ plugin is availalble under the +[Apache2.0](../../../Documentation/licenses.html#Apache2_0) license. + +All icons used in this plugin are taken from the +[SILK ICONS](http://famfamfam.com/lab/icons/silk/) library by Mark +James. They are used under the +[CC-BY3.0](../../../Documentation/licenses.html#CC-BY3_0) license.
diff --git a/src/main/resources/Documentation/build.md b/src/main/resources/Documentation/build.md new file mode 100644 index 0000000..6831ffe --- /dev/null +++ b/src/main/resources/Documentation/build.md
@@ -0,0 +1,68 @@ +Build +===== + +This plugin can be built with Buck. + + +Two build modes are supported: Standalone and in Gerrit tree. +The standalone build mode is recommended, as this mode doesn't require +the Gerrit tree to exist locally. + + +Build standalone +---------------- + +Clone bucklets library: + +``` + git clone https://gerrit.googlesource.com/bucklets + +``` +and link it to reviewers plugin directory: + +``` + cd reviewers && ln -s ../bucklets . +``` + +Add link to the .buckversion file: + +``` + cd reviewers && ln -s bucklets/buckversion .buckversion +``` + +To build the plugin, issue the following command: + + +``` + buck build plugin +``` + +The output is created in + +``` + buck-out/gen/imagare.jar +``` + +Build in Gerrit tree +-------------------- + +Clone or link this plugin to the plugins directory of Gerrit tree +and issue the command: + +``` + buck build plugins/imagare +``` + +The output is created in + +``` + buck-out/gen/plugins/imagare/imagare.jar +``` + +This project can be imported into the Eclipse IDE: + +``` + ./tools/eclipse/project.py +``` + +
diff --git a/src/main/resources/Documentation/config.md b/src/main/resources/Documentation/config.md new file mode 100644 index 0000000..5e7ba92 --- /dev/null +++ b/src/main/resources/Documentation/config.md
@@ -0,0 +1,16 @@ +Configuration +============= + +The configuration of the @PLUGIN@ plugin is done in the `gerrit.config` +file. + +``` + [plugin "@PLUGIN@"] + showEmoticons = true +``` + +<a id="show-emoticons"> +`plugin.@PLUGIN@.showEmoticons` +: Whether emoticons in comments should be displayed as images. + By default `true`. +
diff --git a/src/main/resources/Documentation/rest-api-accounts.md b/src/main/resources/Documentation/rest-api-accounts.md new file mode 100644 index 0000000..8686513 --- /dev/null +++ b/src/main/resources/Documentation/rest-api-accounts.md
@@ -0,0 +1,79 @@ +@PLUGIN@ - /accounts/ REST API +============================== + +This page describes the '/accounts/' 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="project-endpoints"> @PLUGIN@ Endpoints +-------------------------------------------- + +### <a id="get-config"> Get Preferences +_GET /accounts/[\{account-id\}](../../../Documentation/rest-api-accounts.html#account-id)/@PLUGIN@~preference_ + +Gets the preferences of a user for the @PLUGIN@ plugin. + +#### Request + +``` + GET /accounts/self/@PLUGIN@~preference HTTP/1.0 +``` + +As response a [PreferenceInfo](#preference-info) entity is returned +that contains the preferences of a user for the @PLUGIN@ plugin. + +#### Response + +``` + HTTP/1.1 200 OK + Content-Disposition: attachment + Content-Type: application/json;charset=UTF-8 + + )]}' + { + "show_emoticons": true + } +``` + +### <a id="put-config"> Put Preferences +_PUT /accounts/[\{account-id\}](../../../Documentation/rest-api-accounts.html#account-id)/@PLUGIN@~preference_ + +Sets the configuration of the @PLUGIN@ plugin. + +The new preferences must be specified as a [PreferenceInfo](#preference-info) +entity in the request body. Not setting a parameter means that the +parameter is unset and that the global setting for this parameter +applies again. + +#### Request + +``` + PUT /accounts/self/@PLUGIN@~preference HTTP/1.0 + Content-Type: application/json;charset=UTF-8 + + { + "show_emoticons": true + } +``` + +<a id="json-entities">JSON Entities +----------------------------------- + +### <a id="preference-info"></a>PreferenceInfo + +The `PreferenceInfo` entity contains the configuration of the +@PLUGIN@ plugin. + +* _show\_emoticons_: Whether emoticons in comments should be displayed + as images. + +SEE ALSO +-------- + +* [Account related REST endpoints](../../../Documentation/rest-api-accounts.html) + +GERRIT +------ +Part of [Gerrit Code Review](../../../Documentation/index.html)
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..4935347 --- /dev/null +++ b/src/main/resources/Documentation/rest-api-config.md
@@ -0,0 +1,78 @@ +@PLUGIN@ - /config/ REST API +============================ + +This page describes the '/config/' 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="project-endpoints"> @PLUGIN@ Endpoints +-------------------------------------------- + +### <a id="get-config"> Get Config +_GET /config/server/@PLUGIN@~config_ + +Gets the configuration of the @PLUGIN@ plugin. + +#### Request + +``` + GET /config/server/@PLUGIN@~config HTTP/1.0 +``` + +As response a [ConfigInfo](#config-info) entity is returned that +contains the configuration of the @PLUGIN@ plugin. + +#### Response + +``` + HTTP/1.1 200 OK + Content-Disposition: attachment + Content-Type: application/json;charset=UTF-8 + + )]}' + { + "show_emoticons": true + } +``` + +### <a id="put-config"> Put Config +_PUT /config/server/@PLUGIN@~config_ + +Sets the configuration of the @PLUGIN@ plugin. + +The new configuration must be specified as a [ConfigInfo](#config-info) +entity in the request body. Not setting a parameter leaves the +parameter unchanged. + +#### Request + +``` + PUT /config/server/@PLUGIN@~config HTTP/1.0 + Content-Type: application/json;charset=UTF-8 + + { + "show_emoticons": true + } +``` + +<a id="json-entities">JSON Entities +----------------------------------- + +### <a id="config-info"></a>ConfigInfo + +The `ConfigInfo` entity contains the configuration of the @PLUGIN@ +plugin. + +* _show\_emoticons_: Whether emoticons in comments should be displayed + as images. + +SEE ALSO +-------- + +* [Config related REST endpoints](../../../Documentation/rest-api-config.html) + +GERRIT +------ +Part of [Gerrit Code Review](../../../Documentation/index.html)
diff --git a/src/main/resources/LICENSE-CC-BY3.0 b/src/main/resources/LICENSE-CC-BY3.0 new file mode 100644 index 0000000..39dbc91 --- /dev/null +++ b/src/main/resources/LICENSE-CC-BY3.0
@@ -0,0 +1,333 @@ +link:http://creativecommons.org/licenses/by/3.0/us/[CC-BY 3.0] + +THE WORK (AS DEFINED BELOW) IS PROVIDED UNDER THE TERMS OF THIS +CREATIVE COMMONS PUBLIC LICENSE ("CCPL" OR "LICENSE"). THE WORK IS +PROTECTED BY COPYRIGHT AND/OR OTHER APPLICABLE LAW. ANY USE OF THE +WORK OTHER THAN AS AUTHORIZED UNDER THIS LICENSE OR COPYRIGHT LAW IS +PROHIBITED. + +BY EXERCISING ANY RIGHTS TO THE WORK PROVIDED HERE, YOU ACCEPT AND +AGREE TO BE BOUND BY THE TERMS OF THIS LICENSE. TO THE EXTENT THIS +LICENSE MAY BE CONSIDERED TO BE A CONTRACT, THE LICENSOR GRANTS YOU +THE RIGHTS CONTAINED HERE IN CONSIDERATION OF YOUR ACCEPTANCE OF SUCH +TERMS AND CONDITIONS. + +1. Definitions + + a. "Adaptation" means a work based upon the Work, or upon the Work + and other pre-existing works, such as a translation, adaptation, + derivative work, arrangement of music or other alterations of a + literary or artistic work, or phonogram or performance and + includes cinematographic adaptations or any other form in which + the Work may be recast, transformed, or adapted including in any + form recognizably derived from the original, except that a work + that constitutes a Collection will not be considered an + Adaptation for the purpose of this License. For the avoidance + of doubt, where the Work is a musical work, performance or + phonogram, the synchronization of the Work in timed-relation + with a moving image ("synching") will be considered an + Adaptation for the purpose of this License. + + b. "Collection" means a collection of literary or artistic works, + such as encyclopedias and anthologies, or performances, + phonograms or broadcasts, or other works or subject matter other + than works listed in Section 1(f) below, which, by reason of the + selection and arrangement of their contents, constitute + intellectual creations, in which the Work is included in its + entirety in unmodified form along with one or more other + contributions, each constituting separate and independent works + in themselves, which together are assembled into a collective + whole. A work that constitutes a Collection will not be + considered an Adaptation (as defined above) for the purposes of + this License. + + c. "Distribute" means to make available to the public the original + and copies of the Work or Adaptation, as appropriate, through + sale or other transfer of ownership. + + d. "Licensor" means the individual, individuals, entity or entities + that offer(s) the Work under the terms of this License. + + e. "Original Author" means, in the case of a literary or artistic + work, the individual, individuals, entity or entities who + created the Work or if no individual or entity can be + identified, the publisher; and in addition (i) in the case of a + performance the actors, singers, musicians, dancers, and other + persons who act, sing, deliver, declaim, play in, interpret or + otherwise perform literary or artistic works or expressions of + folklore; (ii) in the case of a phonogram the producer being the + person or legal entity who first fixes the sounds of a + performance or other sounds; and, (iii) in the case of + broadcasts, the organization that transmits the broadcast. + + f. "Work" means the literary and/or artistic work offered under the + terms of this License including without limitation any + production in the literary, scientific and artistic domain, + whatever may be the mode or form of its expression including + digital form, such as a book, pamphlet and other writing; a + lecture, address, sermon or other work of the same nature; a + dramatic or dramatico-musical work; a choreographic work or + entertainment in dumb show; a musical composition with or + without words; a cinematographic work to which are assimilated + works expressed by a process analogous to cinematography; a work + of drawing, painting, architecture, sculpture, engraving or + lithography; a photographic work to which are assimilated works + expressed by a process analogous to photography; a work of + applied art; an illustration, map, plan, sketch or + three-dimensional work relative to geography, topography, + architecture or science; a performance; a broadcast; a + phonogram; a compilation of data to the extent it is protected + as a copyrightable work; or a work performed by a variety or + circus performer to the extent it is not otherwise considered a + literary or artistic work. + + g. "You" means an individual or entity exercising rights under this + License who has not previously violated the terms of this + License with respect to the Work, or who has received express + permission from the Licensor to exercise rights under this + License despite a previous violation. + + h. "Publicly Perform" means to perform public recitations of the + Work and to communicate to the public those public recitations, + by any means or process, including by wire or wireless means or + public digital performances; to make available to the public + Works in such a way that members of the public may access these + Works from a place and at a place individually chosen by them; + to perform the Work to the public by any means or process and + the communication to the public of the performances of the Work, + including by public digital performance; to broadcast and + rebroadcast the Work by any means including signs, sounds or + images. + + i. "Reproduce" means to make copies of the Work by any means + including without limitation by sound or visual recordings and + the right of fixation and reproducing fixations of the Work, + including storage of a protected performance or phonogram in + digital form or other electronic medium. + +2. Fair Dealing Rights. Nothing in this License is intended to + reduce, limit, or restrict any uses free from copyright or rights + arising from limitations or exceptions that are provided for in + connection with the copyright protection under copyright law or + other applicable laws. + +3. License Grant. Subject to the terms and conditions of this + License, Licensor hereby grants You a worldwide, royalty-free, + non-exclusive, perpetual (for the duration of the applicable + copyright) license to exercise the rights in the Work as stated + below: + + a. to Reproduce the Work, to incorporate the Work into one or more + Collections, and to Reproduce the Work as incorporated in the + Collections; + + b. to create and Reproduce Adaptations provided that any such + Adaptation, including any translation in any medium, takes + reasonable steps to clearly label, demarcate or otherwise + identify that changes were made to the original Work. For + example, a translation could be marked "The original work was + translated from English to Spanish," or a modification could + indicate "The original work has been modified."; + + c. to Distribute and Publicly Perform the Work including as + incorporated in Collections; and, + + d. to Distribute and Publicly Perform Adaptations. + + e. For the avoidance of doubt: + + i. Non-waivable Compulsory License Schemes. In those + jurisdictions in which the right to collect royalties + through any statutory or compulsory licensing scheme + cannot be waived, the Licensor reserves the exclusive + right to collect such royalties for any exercise by You + of the rights granted under this License; + + ii. Waivable Compulsory License Schemes. In those jurisdictions + in which the right to collect royalties through any + statutory or compulsory licensing scheme can be waived, + the Licensor waives the exclusive right to collect such + royalties for any exercise by You of the rights granted + under this License; and, + + iii. Voluntary License Schemes. The Licensor waives the right to + collect royalties, whether individually or, in the event + that the Licensor is a member of a collecting society + that administers voluntary licensing schemes, via that + society, from any exercise by You of the rights granted + under this License. + +The above rights may be exercised in all media and formats whether now +known or hereafter devised. The above rights include the right to +make such modifications as are technically necessary to exercise the +rights in other media and formats. Subject to Section 8(f), all +rights not expressly granted by Licensor are hereby reserved. + +4. Restrictions. The license granted in Section 3 above is expressly + made subject to and limited by the following restrictions: + + a. You may Distribute or Publicly Perform the Work only under the + terms of this License. You must include a copy of, or the + Uniform Resource Identifier (URI) for, this License with every + copy of the Work You Distribute or Publicly Perform. You may + not offer or impose any terms on the Work that restrict the + terms of this License or the ability of the recipient of the + Work to exercise the rights granted to that recipient under the + terms of the License. You may not sublicense the Work. You + must keep intact all notices that refer to this License and to + the disclaimer of warranties with every copy of the Work You + Distribute or Publicly Perform. When You Distribute or Publicly + Perform the Work, You may not impose any effective technological + measures on the Work that restrict the ability of a recipient of + the Work from You to exercise the rights granted to that + recipient under the terms of the License. This Section 4(a) + applies to the Work as incorporated in a Collection, but this + does not require the Collection apart from the Work itself to be + made subject to the terms of this License. If You create a + Collection, upon notice from any Licensor You must, to the + extent practicable, remove from the Collection any credit as + required by Section 4(b), as requested. If You create an + Adaptation, upon notice from any Licensor You must, to the + extent practicable, remove from the Adaptation any credit as + required by Section 4(b), as requested. + + b. If You Distribute, or Publicly Perform the Work or any + Adaptations or Collections, You must, unless a request has been + made pursuant to Section 4(a), keep intact all copyright notices + for the Work and provide, reasonable to the medium or means You + are utilizing: (i) the name of the Original Author (or + pseudonym, if applicable) if supplied, and/or if the Original + Author and/or Licensor designate another party or parties (e.g., + a sponsor institute, publishing entity, journal) for attribution + ("Attribution Parties") in Licensor's copyright notice, terms of + service or by other reasonable means, the name of such party or + parties; (ii) the title of the Work if supplied; (iii) to the + extent reasonably practicable, the URI, if any, that Licensor + specifies to be associated with the Work, unless such URI does + not refer to the copyright notice or licensing information for + the Work; and (iv) , consistent with Section 3(b), in the case + of an Adaptation, a credit identifying the use of the Work in + the Adaptation (e.g., "French translation of the Work by + Original Author," or "Screenplay based on original Work by + Original Author"). The credit required by this Section 4 (b) + may be implemented in any reasonable manner; provided, however, + that in the case of a Adaptation or Collection, at a minimum + such credit will appear, if a credit for all contributing + authors of the Adaptation or Collection appears, then as part of + these credits and in a manner at least as prominent as the + credits for the other contributing authors. For the avoidance + of doubt, You may only use the credit required by this Section + for the purpose of attribution in the manner set out above and, + by exercising Your rights under this License, You may not + implicitly or explicitly assert or imply any connection with, + sponsorship or endorsement by the Original Author, Licensor + and/or Attribution Parties, as appropriate, of You or Your use + of the Work, without the separate, express prior written + permission of the Original Author, Licensor and/or Attribution + Parties. + + c. Except as otherwise agreed in writing by the Licensor or as may + be otherwise permitted by applicable law, if You Reproduce, + Distribute or Publicly Perform the Work either by itself or as + part of any Adaptations or Collections, You must not distort, + mutilate, modify or take other derogatory action in relation to + the Work which would be prejudicial to the Original Author's + honor or reputation. Licensor agrees that in those + jurisdictions (e.g. Japan), in which any exercise of the right + granted in Section 3(b) of this License (the right to make + Adaptations) would be deemed to be a distortion, mutilation, + modification or other derogatory action prejudicial to the + Original Author's honor and reputation, the Licensor will waive + or not assert, as appropriate, this Section, to the fullest + extent permitted by the applicable national law, to enable You + to reasonably exercise Your right under Section 3(b) of this + License (right to make Adaptations) but not otherwise. + +5. Representations, Warranties and Disclaimer + +UNLESS OTHERWISE MUTUALLY AGREED TO BY THE PARTIES IN WRITING, +LICENSOR OFFERS THE WORK AS-IS AND MAKES NO REPRESENTATIONS OR +WARRANTIES OF ANY KIND CONCERNING THE WORK, EXPRESS, IMPLIED, +STATUTORY OR OTHERWISE, INCLUDING, WITHOUT LIMITATION, WARRANTIES OF +TITLE, MERCHANTIBILITY, FITNESS FOR A PARTICULAR PURPOSE, +NONINFRINGEMENT, OR THE ABSENCE OF LATENT OR OTHER DEFECTS, ACCURACY, +OR THE PRESENCE OF ABSENCE OF ERRORS, WHETHER OR NOT DISCOVERABLE. +SOME JURISDICTIONS DO NOT ALLOW THE EXCLUSION OF IMPLIED WARRANTIES, +SO SUCH EXCLUSION MAY NOT APPLY TO YOU. + +6. Limitation on Liability. EXCEPT TO THE EXTENT REQUIRED BY + APPLICABLE LAW, IN NO EVENT WILL LICENSOR BE LIABLE TO YOU ON ANY + LEGAL THEORY FOR ANY SPECIAL, INCIDENTAL, CONSEQUENTIAL, PUNITIVE + OR EXEMPLARY DAMAGES ARISING OUT OF THIS LICENSE OR THE USE OF THE + WORK, EVEN IF LICENSOR HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH + DAMAGES. + +7. Termination + + a. This License and the rights granted hereunder will terminate + automatically upon any breach by You of the terms of this + License. Individuals or entities who have received Adaptations + or Collections from You under this License, however, will not + have their licenses terminated provided such individuals or + entities remain in full compliance with those licenses. + Sections 1, 2, 5, 6, 7, and 8 will survive any termination of + this License. + + b. Subject to the above terms and conditions, the license granted + here is perpetual (for the duration of the applicable copyright + in the Work). Notwithstanding the above, Licensor reserves the + right to release the Work under different license terms or to + stop distributing the Work at any time; provided, however that + any such election will not serve to withdraw this License (or + any other license that has been, or is required to be, granted + under the terms of this License), and this License will continue + in full force and effect unless terminated as stated above. + +8. Miscellaneous + + a. Each time You Distribute or Publicly Perform the Work or a + Collection, the Licensor offers to the recipient a license to + the Work on the same terms and conditions as the license granted + to You under this License. + + b. Each time You Distribute or Publicly Perform an Adaptation, + Licensor offers to the recipient a license to the original Work + on the same terms and conditions as the license granted to You + under this License. + + c. If any provision of this License is invalid or unenforceable + under applicable law, it shall not affect the validity or + enforceability of the remainder of the terms of this License, + and without further action by the parties to this agreement, + such provision shall be reformed to the minimum extent necessary + to make such provision valid and enforceable. + + d. No term or provision of this License shall be deemed waived and + no breach consented to unless such waiver or consent shall be in + writing and signed by the party to be charged with such waiver + or consent. + + e. This License constitutes the entire agreement between the + parties with respect to the Work licensed here. There are no + understandings, agreements or representations with respect to + the Work not specified here. Licensor shall not be bound by any + additional provisions that may appear in any communication from + You. This License may not be modified without the mutual + written agreement of the Licensor and You. + + f. The rights granted under, and the subject matter referenced, in + this License were drafted utilizing the terminology of the Berne + Convention for the Protection of Literary and Artistic Works (as + amended on September 28, 1979), the Rome Convention of 1961, the + WIPO Copyright Treaty of 1996, the WIPO Performances and + Phonograms Treaty of 1996 and the Universal Copyright Convention + (as revised on July 24, 1971). These rights and subject matter + take effect in the relevant jurisdiction in which the License + terms are sought to be enforced according to the corresponding + provisions of the implementation of those treaty provisions in + the applicable national law. If the standard suite of rights + granted under applicable copyright law includes additional + rights not granted under this License, such additional rights + are deemed to be included in the License; this License is not + intended to restrict the license of any rights under applicable + law.
diff --git a/src/main/resources/LICENSE-silk-icons b/src/main/resources/LICENSE-silk-icons new file mode 100644 index 0000000..2b10dde --- /dev/null +++ b/src/main/resources/LICENSE-silk-icons
@@ -0,0 +1 @@ +link:http://creativecommons.org/licenses/by/3.0/us/[CC-BY 3.0] (c) Mark James, link:http://famfamfam.com/lab/icons/silk/[SILK ICONS]
diff --git a/src/main/resources/static/emoticons.js b/src/main/resources/static/emoticons.js new file mode 100644 index 0000000..f761810 --- /dev/null +++ b/src/main/resources/static/emoticons.js
@@ -0,0 +1,101 @@ +// Copyright (C) 2015 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. + +Gerrit.install(function(self) { + function onComment(e) { + var prefs = getPrefsFromCookie(); + if (prefs !== null) { + insertEmoticons(e, prefs) + } else { + Gerrit.get('/accounts/self/' + self.getPluginName() + + '~preference', function(prefs) { + storePrefsInCookie(prefs); + insertEmoticons(e, prefs) + }); + } + } + + function storePrefsInCookie(prefs) { + var date = new Date(); + date.setTime(date.getTime() + (1 * 24 * 60 * 60 * 1000)); // 1 day + document.cookie = getCookieName() + + "=" + + JSON.stringify(prefs) + + "; expires=" + date.toGMTString() + + "; path=/"; + } + + function getPrefsFromCookie() { + var cookie = document.cookie; + if (cookie.length > 0) { + var cookieName = getCookieName(); + var start = cookie.indexOf(cookieName + "="); + if (start != -1) { + start = start + cookieName.length + 1; + var end = document.cookie.indexOf(";", start); + if (end == -1) { + end = document.cookie.length; + } + return JSON.parse(unescape(document.cookie.substring(start, end))); + } + } + return null; + } + + function getCookieName() { + return self.getPluginName() + "~prefs"; + } + + function insertEmoticons(e, prefs) { + if (!prefs.show_emoticons) { + return; + } + + e.innerHTML = replaceEmoticons(e.innerHTML); + } + + function replaceEmoticons(text) { + var emoticons = { + '>:)' : 'emoticon_evilgrin.png', + '>:-)': 'emoticon_evilgrin.png', + ':-D' : 'emoticon_grin.png', + ':D' : 'emoticon_grin.png', + '^o^' : 'emoticon_happy.png', + ':-)' : 'emoticon_smile.png', + ':)' : 'emoticon_smile.png', + ':-o' : 'emoticon_surprised.png', + ':o' : 'emoticon_surprised.png', + ':-p' : 'emoticon_tongue.png', + ':p' : 'emoticon_tongue.png', + ':-(' : 'emoticon_unhappy.png', + ':(' : 'emoticon_unhappy.png', + ':-3' : 'emoticon_waii.png', + ':3' : 'emoticon_waii.png', + ';-D' : 'emoticon_wink.png', + ';D' : 'emoticon_wink.png', + ';-)' : 'emoticon_wink.png', + ';)' : 'emoticon_wink.png' + }; + var url = "plugins/" + self.getPluginName() + "/static/silk_icons/"; + return text.replace(/[>:;\^\-)Dop(3]+/g, function (match) { + return typeof emoticons[match] != 'undefined' + ? '<img src="' + url + emoticons[match] + + '" style="position: relative; top: 3px;"' + + ' alt="' + match + '"/>' + : match; + }); + } + + Gerrit.on('comment', onComment); + });
diff --git a/src/main/resources/static/silk_icons/emoticon_evilgrin.png b/src/main/resources/static/silk_icons/emoticon_evilgrin.png new file mode 100644 index 0000000..817bd50 --- /dev/null +++ b/src/main/resources/static/silk_icons/emoticon_evilgrin.png Binary files differ
diff --git a/src/main/resources/static/silk_icons/emoticon_grin.png b/src/main/resources/static/silk_icons/emoticon_grin.png new file mode 100644 index 0000000..fc60c5e --- /dev/null +++ b/src/main/resources/static/silk_icons/emoticon_grin.png Binary files differ
diff --git a/src/main/resources/static/silk_icons/emoticon_happy.png b/src/main/resources/static/silk_icons/emoticon_happy.png new file mode 100644 index 0000000..6b7336e --- /dev/null +++ b/src/main/resources/static/silk_icons/emoticon_happy.png Binary files differ
diff --git a/src/main/resources/static/silk_icons/emoticon_smile.png b/src/main/resources/static/silk_icons/emoticon_smile.png new file mode 100644 index 0000000..ade4318 --- /dev/null +++ b/src/main/resources/static/silk_icons/emoticon_smile.png Binary files differ
diff --git a/src/main/resources/static/silk_icons/emoticon_surprised.png b/src/main/resources/static/silk_icons/emoticon_surprised.png new file mode 100644 index 0000000..4520cfc --- /dev/null +++ b/src/main/resources/static/silk_icons/emoticon_surprised.png Binary files differ
diff --git a/src/main/resources/static/silk_icons/emoticon_tongue.png b/src/main/resources/static/silk_icons/emoticon_tongue.png new file mode 100644 index 0000000..ecafd2f --- /dev/null +++ b/src/main/resources/static/silk_icons/emoticon_tongue.png Binary files differ
diff --git a/src/main/resources/static/silk_icons/emoticon_unhappy.png b/src/main/resources/static/silk_icons/emoticon_unhappy.png new file mode 100644 index 0000000..fd5d030 --- /dev/null +++ b/src/main/resources/static/silk_icons/emoticon_unhappy.png Binary files differ
diff --git a/src/main/resources/static/silk_icons/emoticon_waii.png b/src/main/resources/static/silk_icons/emoticon_waii.png new file mode 100644 index 0000000..458f936 --- /dev/null +++ b/src/main/resources/static/silk_icons/emoticon_waii.png Binary files differ
diff --git a/src/main/resources/static/silk_icons/emoticon_wink.png b/src/main/resources/static/silk_icons/emoticon_wink.png new file mode 100644 index 0000000..a631949 --- /dev/null +++ b/src/main/resources/static/silk_icons/emoticon_wink.png Binary files differ