Author: adietish
Date: 2010-09-02 11:03:44 -0400 (Thu, 02 Sep 2010)
New Revision: 24654
Added:
branches/jbosstools-3.2.0.M2/usage/plugins/.classpath
branches/jbosstools-3.2.0.M2/usage/plugins/.project
branches/jbosstools-3.2.0.M2/usage/plugins/.settings/
branches/jbosstools-3.2.0.M2/usage/plugins/.settings/net.sf.jautodoc.prefs
branches/jbosstools-3.2.0.M2/usage/plugins/.settings/org.eclipse.jdt.core.prefs
branches/jbosstools-3.2.0.M2/usage/plugins/.settings/org.eclipse.jdt.ui.prefs
branches/jbosstools-3.2.0.M2/usage/plugins/JBoss Usage Reporter.launch
branches/jbosstools-3.2.0.M2/usage/plugins/META-INF/
branches/jbosstools-3.2.0.M2/usage/plugins/META-INF/MANIFEST.MF
branches/jbosstools-3.2.0.M2/usage/plugins/about.html
branches/jbosstools-3.2.0.M2/usage/plugins/build.properties
branches/jbosstools-3.2.0.M2/usage/plugins/config.ini
branches/jbosstools-3.2.0.M2/usage/plugins/plugin.properties
branches/jbosstools-3.2.0.M2/usage/plugins/plugin.xml
branches/jbosstools-3.2.0.M2/usage/plugins/src/
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/FocusPoint.java
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/HttpGetRequest.java
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/HttpResourceMap.java
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/IHttpGetRequest.java
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/ILoggingAdapter.java
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/ITracker.java
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/IURLBuildingStrategy.java
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/PluginLogger.java
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/Tracker.java
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/UsageMessages.java
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/googleanalytics/
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/googleanalytics/AbstractGoogleAnalyticsParameters.java
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/googleanalytics/GoogleAnalyticsCookie.java
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/googleanalytics/GoogleAnalyticsMessages.java
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/googleanalytics/GoogleAnalyticsUrlStrategy.java
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/googleanalytics/IGoogleAnalyticsParameters.java
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/googleanalytics/messages.properties
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/internal/
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/internal/JBossToolsUsageActivator.java
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/messages.properties
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/preferences/
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/preferences/GlobalUsageReportingSettings.java
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/preferences/IUsageReportPreferenceConstants.java
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/preferences/PreferencesMessages.java
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/preferences/UsageReportPreferenceInitializer.java
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/preferences/UsageReportPreferencePage.java
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/preferences/UsageReportPreferences.java
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/preferences/messages.properties
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/reporting/
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/reporting/EclipseEnvironment.java
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/reporting/JBossBundleGroups.java
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/reporting/ReportingMessages.java
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/reporting/UsageReport.java
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/reporting/UsageReportDispatcher.java
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/reporting/UsageReportEnablementDialog.java
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/reporting/messages.properties
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/util/
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/util/BrowserUtil.java
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/util/BundleUtils.java
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/util/HttpEncodingUtils.java
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/util/PreferencesUtils.java
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/util/StatusUtils.java
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/util/reader/
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/util/reader/AppendUntilAlternativeImpl.java
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/util/reader/AppendUntilImpl.java
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/util/reader/ReadUntilAlternativesImpl.java
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/util/reader/ReadUntilImpl.java
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/util/reader/ReaderUtils.java
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/util/reader/ReaderVisitor.java
Modified:
branches/jbosstools-3.2.0.M2/usage/plugins/pom.xml
Log:
bringing trunk changes to M2
Added: branches/jbosstools-3.2.0.M2/usage/plugins/.classpath
===================================================================
--- branches/jbosstools-3.2.0.M2/usage/plugins/.classpath (rev 0)
+++ branches/jbosstools-3.2.0.M2/usage/plugins/.classpath 2010-09-02 15:03:44 UTC (rev
24654)
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con"
path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="con"
path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
Property changes on: branches/jbosstools-3.2.0.M2/usage/plugins/.classpath
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: branches/jbosstools-3.2.0.M2/usage/plugins/.project
===================================================================
--- branches/jbosstools-3.2.0.M2/usage/plugins/.project (rev 0)
+++ branches/jbosstools-3.2.0.M2/usage/plugins/.project 2010-09-02 15:03:44 UTC (rev
24654)
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.jboss.tools.usage</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.api.tools.apiAnalysisBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ <nature>org.eclipse.pde.api.tools.apiAnalysisNature</nature>
+ </natures>
+</projectDescription>
Property changes on: branches/jbosstools-3.2.0.M2/usage/plugins/.project
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: branches/jbosstools-3.2.0.M2/usage/plugins/.settings/net.sf.jautodoc.prefs
===================================================================
--- branches/jbosstools-3.2.0.M2/usage/plugins/.settings/net.sf.jautodoc.prefs
(rev 0)
+++ branches/jbosstools-3.2.0.M2/usage/plugins/.settings/net.sf.jautodoc.prefs 2010-09-02
15:03:44 UTC (rev 24654)
@@ -0,0 +1,7 @@
+#Thu Aug 12 14:50:29 CEST 2010
+add_header=true
+eclipse.preferences.version=1
+header_text=/*******************************************************************************\n
* Copyright (c) 2010 Red Hat, Inc.\n * Distributed under license by Red Hat, Inc. All
rights reserved.\n * This program is made available under the terms of the\n * Eclipse
Public License v1.0 which accompanies this distribution,\n * and is available at
http\://www.eclipse.org/legal/epl-v10.html\n *\n * Contributors\:\n * Red Hat, Inc. -
initial API and implementation\n
******************************************************************************/
+project_specific_settings=true
+replace_header=true
+replacements=<?xml version\="1.0"
standalone\="yes"?>\n\n<replacements>\n<replacement
key\="get" scope\="1" mode\="0">Gets
the</replacement>\n<replacement key\="set" scope\="1"
mode\="0">Sets the</replacement>\n<replacement key\="add"
scope\="1" mode\="0">Adds the</replacement>\n<replacement
key\="edit" scope\="1" mode\="0">Edits
the</replacement>\n<replacement key\="remove" scope\="1"
mode\="0">Removes the</replacement>\n<replacement
key\="init" scope\="1" mode\="0">Inits
the</replacement>\n<replacement key\="parse" scope\="1"
mode\="0">Parses the</replacement>\n<replacement
key\="create" scope\="1" mode\="0">Creates
the</replacement>\n<replacement key\="build" scope\="1"
mode\="0">Builds the</replacement>\n<replacement key\="is"
scope\="1" mode\="0">Checks if
is</replacement>\n<replacement key\="print" scope\="1"
mode\="0">Prints the</replacement>\n<replacement
key\="has" scope\="1" mode\="0">Checks
for</replacement>\n</replacements>\n\n
Property changes on:
branches/jbosstools-3.2.0.M2/usage/plugins/.settings/net.sf.jautodoc.prefs
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: branches/jbosstools-3.2.0.M2/usage/plugins/.settings/org.eclipse.jdt.core.prefs
===================================================================
--- branches/jbosstools-3.2.0.M2/usage/plugins/.settings/org.eclipse.jdt.core.prefs
(rev 0)
+++
branches/jbosstools-3.2.0.M2/usage/plugins/.settings/org.eclipse.jdt.core.prefs 2010-09-02
15:03:44 UTC (rev 24654)
@@ -0,0 +1,260 @@
+#Fri Aug 06 17:57:19 CEST 2010
+eclipse.preferences.version=1
+org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_assignment=0
+org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16
+org.eclipse.jdt.core.formatter.alignment_for_compact_if=16
+org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80
+org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0
+org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16
+org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16
+org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16
+org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16
+org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16
+org.eclipse.jdt.core.formatter.blank_lines_after_imports=1
+org.eclipse.jdt.core.formatter.blank_lines_after_package=1
+org.eclipse.jdt.core.formatter.blank_lines_before_field=0
+org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0
+org.eclipse.jdt.core.formatter.blank_lines_before_imports=1
+org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1
+org.eclipse.jdt.core.formatter.blank_lines_before_method=1
+org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1
+org.eclipse.jdt.core.formatter.blank_lines_before_package=0
+org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1
+org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1
+org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false
+org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false
+org.eclipse.jdt.core.formatter.comment.format_block_comments=false
+org.eclipse.jdt.core.formatter.comment.format_header=false
+org.eclipse.jdt.core.formatter.comment.format_html=true
+org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true
+org.eclipse.jdt.core.formatter.comment.format_line_comments=true
+org.eclipse.jdt.core.formatter.comment.format_source_code=true
+org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true
+org.eclipse.jdt.core.formatter.comment.indent_root_tags=true
+org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert
+org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=insert
+org.eclipse.jdt.core.formatter.comment.line_length=80
+org.eclipse.jdt.core.formatter.compact_else_if=true
+org.eclipse.jdt.core.formatter.continuation_indentation=2
+org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2
+org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true
+org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true
+org.eclipse.jdt.core.formatter.indent_empty_lines=false
+org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true
+org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true
+org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true
+org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=false
+org.eclipse.jdt.core.formatter.indentation.size=4
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_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=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not
insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do
not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not
insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not
insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert
+org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do
not insert
+org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do
not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do
not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do
not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do
not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do
not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not
insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do
not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not
insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do
not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do
not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do
not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not
insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert
+org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do
not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do
not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do
not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do
not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do
not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not
insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do
not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not
insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do
not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do
not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do
not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not
insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not
insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not
insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not
insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do
not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do
not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do
not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not
insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do
not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do
not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do
not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do
not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do
not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do
not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do
not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not
insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not
insert
+org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do
not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do
not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do
not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do
not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do
not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do
not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not
insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do
not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do
not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not
insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do
not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do
not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do
not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert
+org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert
+org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert
+org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do
not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do
not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do
not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do
not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do
not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not
insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do
not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do
not insert
+org.eclipse.jdt.core.formatter.join_lines_in_comments=true
+org.eclipse.jdt.core.formatter.join_wrapped_lines=false
+org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false
+org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false
+org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false
+org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false
+org.eclipse.jdt.core.formatter.lineSplit=120
+org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false
+org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false
+org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0
+org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1
+org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true
+org.eclipse.jdt.core.formatter.tabulation.char=tab
+org.eclipse.jdt.core.formatter.tabulation.size=4
+org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false
+org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true
Property changes on:
branches/jbosstools-3.2.0.M2/usage/plugins/.settings/org.eclipse.jdt.core.prefs
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: branches/jbosstools-3.2.0.M2/usage/plugins/.settings/org.eclipse.jdt.ui.prefs
===================================================================
--- branches/jbosstools-3.2.0.M2/usage/plugins/.settings/org.eclipse.jdt.ui.prefs
(rev 0)
+++
branches/jbosstools-3.2.0.M2/usage/plugins/.settings/org.eclipse.jdt.ui.prefs 2010-09-02
15:03:44 UTC (rev 24654)
@@ -0,0 +1,6 @@
+#Wed Jul 28 11:02:07 CEST 2010
+eclipse.preferences.version=1
+formatter_profile=_Eclipse [built-in] extended
+formatter_settings_version=11
+org.eclipse.jdt.ui.javadoc=false
+org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0"
encoding\="UTF-8" standalone\="no"?><templates><template
autoinsert\="true" context\="gettercomment_context"
deleted\="false" description\="Comment for getter method"
enabled\="true"
id\="org.eclipse.jdt.ui.text.codetemplates.gettercomment"
name\="gettercomment">/**\n * @return the ${bare_field_name}\n
*/</template><template autoinsert\="true"
context\="settercomment_context" deleted\="false"
description\="Comment for setter method" enabled\="true"
id\="org.eclipse.jdt.ui.text.codetemplates.settercomment"
name\="settercomment">/**\n * @param ${param} the ${bare_field_name} to set\n
*/</template><template autoinsert\="true"
context\="constructorcomment_context" deleted\="false"
description\="Comment for created constructors" enabled\="true"
id\="org.eclipse.jdt.ui.text.codetemplates.constructorcomment"
name\="constructorcomment">/**\n * ${tags}\n */</template><template
autoinsert\="false" context\="filecommen!
t_context" deleted\="false" description\="Comment for created Java
files" enabled\="true"
id\="org.eclipse.jdt.ui.text.codetemplates.filecomment"
name\="filecomment">/*******************************************************************************\n
* Copyright (c) 2010 Red Hat, Inc.\n * Distributed under license by Red Hat, Inc. All
rights reserved.\n * This program is made available under the terms of the\n * Eclipse
Public License v1.0 which accompanies this distribution,\n * and is available at
http\://www.eclipse.org/legal/epl-v10.html\n *\n * Contributors\:\n * Red Hat, Inc. -
initial API and implementation\n
******************************************************************************/</template><template
autoinsert\="true" context\="typecomment_context"
deleted\="false" description\="Comment for created types"
enabled\="true"
id\="org.eclipse.jdt.ui.text.codetemplates.typecomment"
name\="typecomment">/**\n * @author ${user}\n *\n * ${tags}\n
*/</template><templa!
te autoinsert\="true" context\="fieldcomment_context" deleted\!
="false"
description\="Comment for fields" enabled\="true"
id\="org.eclipse.jdt.ui.text.codetemplates.fieldcomment"
name\="fieldcomment">/**\n * \n */</template><template
autoinsert\="true" context\="methodcomment_context"
deleted\="false" description\="Comment for non-overriding methods"
enabled\="true"
id\="org.eclipse.jdt.ui.text.codetemplates.methodcomment"
name\="methodcomment">/**\n * ${tags}\n */</template><template
autoinsert\="true" context\="overridecomment_context"
deleted\="false" description\="Comment for overriding methods"
enabled\="true"
id\="org.eclipse.jdt.ui.text.codetemplates.overridecomment"
name\="overridecomment">/* (non-Javadoc)\n * ${see_to_overridden}\n
*/</template><template autoinsert\="true"
context\="delegatecomment_context" deleted\="false"
description\="Comment for delegate methods" enabled\="true"
id\="org.eclipse.jdt.ui.text.codetemplates.delegatecomment"
name\="delegatecomment">/**\n * ${tags}\n * ${see_to_target}\n
*/</template><template autoinser!
t\="true" context\="newtype_context" deleted\="false"
description\="Newly created files" enabled\="true"
id\="org.eclipse.jdt.ui.text.codetemplates.newtype"
name\="newtype">${filecomment}\n${package_declaration}\n\n${typecomment}\n${type_declaration}</template><template
autoinsert\="true" context\="classbody_context"
deleted\="false" description\="Code in new class type bodies"
enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.classbody"
name\="classbody">\n</template><template
autoinsert\="true" context\="interfacebody_context"
deleted\="false" description\="Code in new interface type bodies"
enabled\="true"
id\="org.eclipse.jdt.ui.text.codetemplates.interfacebody"
name\="interfacebody">\n</template><template
autoinsert\="true" context\="enumbody_context"
deleted\="false" description\="Code in new enum type bodies"
enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.enumbody"
name\="enumbody">\n</template><template autoinsert\="true"
context\="annotationbod!
y_context" deleted\="false" description\="Code in new annotati!
on type
bodies" enabled\="true"
id\="org.eclipse.jdt.ui.text.codetemplates.annotationbody"
name\="annotationbody">\n</template><template
autoinsert\="true" context\="catchblock_context"
deleted\="false" description\="Code in new catch blocks"
enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.catchblock"
name\="catchblock">// ${todo} Auto-generated catch
block\n${exception_var}.printStackTrace();</template><template
autoinsert\="true" context\="methodbody_context"
deleted\="false" description\="Code in created method stubs"
enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodbody"
name\="methodbody">// ${todo} Auto-generated method
stub\n${body_statement}</template><template autoinsert\="true"
context\="constructorbody_context" deleted\="false"
description\="Code in created constructor stubs" enabled\="true"
id\="org.eclipse.jdt.ui.text.codetemplates.constructorbody"
name\="constructorbody">${body_statement}\n// ${todo} Auto-generated
constructor stub</template>!
<template autoinsert\="true" context\="getterbody_context"
deleted\="false" description\="Code in created getters"
enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.getterbody"
name\="getterbody">return ${field};</template><template
autoinsert\="true" context\="setterbody_context"
deleted\="false" description\="Code in created setters"
enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.setterbody"
name\="setterbody">${field} \= ${param};</template><template
autoinsert\="true" context\="gettercomment_context"
deleted\="false" description\="Comment for getter function"
enabled\="true"
id\="org.eclipse.wst.jsdt.ui.text.codetemplates.gettercomment"
name\="gettercomment">/**\n * @return the ${bare_field_name}\n
*/</template><template autoinsert\="true"
context\="settercomment_context" deleted\="false"
description\="Comment for setter function" enabled\="true"
id\="org.eclipse.wst.jsdt.ui.text.codetemplates.settercomment"
name\="settercomment">/**\n * @param ${pa!
ram} the ${bare_field_name} to set\n */</template><template au!
toinsert
\="true" context\="constructorcomment_context"
deleted\="false" description\="Comment for created constructors"
enabled\="true"
id\="org.eclipse.wst.jsdt.ui.text.codetemplates.constructorcomment"
name\="constructorcomment">/**\n * ${tags}\n */</template><template
autoinsert\="true" context\="filecomment_context"
deleted\="false" description\="Comment for created JavaScript files"
enabled\="true"
id\="org.eclipse.wst.jsdt.ui.text.codetemplates.filecomment"
name\="filecomment">/**\n * \n */</template><template
autoinsert\="true" context\="typecomment_context"
deleted\="false" description\="Comment for created types"
enabled\="true"
id\="org.eclipse.wst.jsdt.ui.text.codetemplates.typecomment"
name\="typecomment">/**\n * @author ${user}\n *\n * ${tags}\n
*/</template><template autoinsert\="true"
context\="fieldcomment_context" deleted\="false"
description\="Comment for vars" enabled\="true"
id\="org.eclipse.wst.jsdt.ui.text.codetemplates.fieldcomment"
name\="fieldcomment">/**\n !
* \n */</template><template autoinsert\="true"
context\="methodcomment_context" deleted\="false"
description\="Comment for non-overriding function" enabled\="true"
id\="org.eclipse.wst.jsdt.ui.text.codetemplates.methodcomment"
name\="methodcomment">/**\n * ${tags}\n */</template><template
autoinsert\="true" context\="overridecomment_context"
deleted\="false" description\="Comment for overriding functions"
enabled\="true"
id\="org.eclipse.wst.jsdt.ui.text.codetemplates.overridecomment"
name\="overridecomment">/* (non-JSDoc)\n * ${see_to_overridden}\n
*/</template><template autoinsert\="true"
context\="delegatecomment_context" deleted\="false"
description\="Comment for delegate functions" enabled\="true"
id\="org.eclipse.wst.jsdt.ui.text.codetemplates.delegatecomment"
name\="delegatecomment">/**\n * ${tags}\n * ${see_to_target}\n
*/</template><template autoinsert\="true"
context\="newtype_context" deleted\="false" description\="Newly
created files" enabled\="true" id\="org.ec!
lipse.wst.jsdt.ui.text.codetemplates.newtype" name\="newtype">!
${fileco
mment}\n${package_declaration}\n\n${typecomment}\n${type_declaration}</template><template
autoinsert\="true" context\="classbody_context"
deleted\="false" description\="Code in new class type bodies"
enabled\="true"
id\="org.eclipse.wst.jsdt.ui.text.codetemplates.classbody"
name\="classbody">\n</template><template
autoinsert\="true" context\="catchblock_context"
deleted\="false" description\="Code in new catch blocks"
enabled\="true"
id\="org.eclipse.wst.jsdt.ui.text.codetemplates.catchblock"
name\="catchblock">// ${todo} Auto-generated catch
block\n${exception_var}.printStackTrace();</template><template
autoinsert\="true" context\="methodbody_context"
deleted\="false" description\="Code in created function stubs"
enabled\="true"
id\="org.eclipse.wst.jsdt.ui.text.codetemplates.methodbody"
name\="methodbody">// ${todo} Auto-generated function
stub\n${body_statement}</template><template autoinsert\="true"
context\="constructorbody_context" deleted\="false"
description\="Code i!
n created constructor stubs" enabled\="true"
id\="org.eclipse.wst.jsdt.ui.text.codetemplates.constructorbody"
name\="constructorbody">${body_statement}\n// ${todo} Auto-generated
constructor stub</template><template autoinsert\="true"
context\="getterbody_context" deleted\="false" description\="Code
in created getters" enabled\="true"
id\="org.eclipse.wst.jsdt.ui.text.codetemplates.getterbody"
name\="getterbody">return ${field};</template><template
autoinsert\="true" context\="setterbody_context"
deleted\="false" description\="Code in created setters"
enabled\="true"
id\="org.eclipse.wst.jsdt.ui.text.codetemplates.setterbody"
name\="setterbody">${field} \= ${param};</template></templates>
Property changes on:
branches/jbosstools-3.2.0.M2/usage/plugins/.settings/org.eclipse.jdt.ui.prefs
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: branches/jbosstools-3.2.0.M2/usage/plugins/JBoss Usage Reporter.launch
===================================================================
--- branches/jbosstools-3.2.0.M2/usage/plugins/JBoss Usage Reporter.launch
(rev 0)
+++ branches/jbosstools-3.2.0.M2/usage/plugins/JBoss Usage Reporter.launch 2010-09-02
15:03:44 UTC (rev 24654)
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"
standalone="no"?>
+<launchConfiguration type="org.eclipse.pde.ui.RuntimeWorkbench">
+<booleanAttribute key="append.args" value="true"/>
+<booleanAttribute key="askclear" value="false"/>
+<booleanAttribute key="automaticAdd" value="true"/>
+<booleanAttribute key="automaticValidate" value="false"/>
+<stringAttribute key="bootstrap" value=""/>
+<stringAttribute key="checked" value="[NONE]"/>
+<booleanAttribute key="clearConfig" value="true"/>
+<booleanAttribute key="clearws" value="true"/>
+<booleanAttribute key="clearwslog" value="false"/>
+<stringAttribute key="configLocation"
value="${workspace_loc}/.metadata/.plugins/org.eclipse.pde.core/JBoss Usage
Reporter"/>
+<booleanAttribute key="default" value="true"/>
+<stringAttribute key="deselected_workspace_plugins"
value="org.jboss.tools.common.text.xml,org.jboss.tools.common.meta.ui,org.jboss.tools.ui.bot.ext,org.jboss.tools.common,org.jboss.tools.common.verification.ui.test,org.jboss.tools.common.projecttemplates,org.jboss.tools.common.el.core,org.jboss.tools.common.verification.ui,org.jboss.tools.common.gef,org.jboss.tools.common.test,org.jboss.tools.common.verification.test,org.jboss.tools.common.verification,org.jboss.tools.common.model,org.jboss.tools.gwt.ui,org.jboss.tools.common.model.ui.capabilities,org.jboss.tools.common.resref.core,org.jboss.tools.common.ui,org.jboss.tools.common.el.ui,org.jboss.tools.usage.test,org.jboss.tools.common.text.ext,org.jboss.tools.gwt.core,org.jboss.tools.common.resref.ui,org.jboss.tools.ui.bot.ext.test,org.jboss.tools.common.model.ui.test,org.jboss.tools.common.el.core.test,org.jboss.tools.common.model.ui,org.jboss.tools.tests,org.jboss.tools.common.model.test"/>
+<booleanAttribute key="includeOptional" value="true"/>
+<stringAttribute key="location"
value="${workspace_loc}/../runtime-EclipseApplication2"/>
+<listAttribute key="org.eclipse.debug.ui.favoriteGroups">
+<listEntry value="org.eclipse.debug.ui.launchGroup.debug"/>
+<listEntry value="org.eclipse.debug.ui.launchGroup.run"/>
+</listAttribute>
+<stringAttribute key="org.eclipse.jdt.launching.JAVA_COMMAND"
value="java"/>
+<stringAttribute key="org.eclipse.jdt.launching.JRE_CONTAINER"
value="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS"
value="-os ${target.os} -ws ${target.ws} -arch ${target.arch} -nl ${target.nl}
-console -consolelog -pluginCustomization
${workspace_loc}/../runtime-EclipseApplication/usage.properties"/>
+<stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER"
value="org.eclipse.pde.ui.workbenchClasspathProvider"/>
+<booleanAttribute key="pde.generated.config" value="false"/>
+<stringAttribute key="pde.version" value="3.3"/>
+<stringAttribute key="product"
value="org.eclipse.platform.ide"/>
+<stringAttribute key="selected_target_plugins"
value="org.eclipse.jface.text@default:default,org.eclipse.core.contenttype@default:default,org.eclipse.help@default:default,org.eclipse.equinox.concurrent@default:default,com.ibm.icu@default:default,ch.qos.logback.classic@default:default,org.eclipse.swt.cocoa.macosx.x86_64@default:false,org.junit4@default:default,javax.mail@default:default,org.eclipse.core.filesystem.macosx@default:false,org.eclipse.ui.intro@default:default,org.eclipse.core.databinding.observable@default:default,org.eclipse.ecf.provider.filetransfer.ssl@default:false,org.eclipse.core.runtime@default:true,org.eclipse.help.base@default:default,org.eclipse.swtbot.ant.optional.junit4@default:false,org.eclipse.swt@default:default,org.eclipse.equinox.common@2:true,org.eclipse.net4j.jms.api@default:default,org.eclipse.equinox.security@default:default,org.eclipse.core.resources@default:default,org.eclipse.core.expressions@default:default,org.apache.lucene.analysis@defa!
ult:default,org.eclipse.jface@default:default,org.eclipse.ecf.filetransfer@default:default,org.eclipse.ecf@default:default,org.eclipse.update.configurator@3:true,org.eclipse.equinox.p2.repository@default:default,org.apache.jasper@default:default,org.eclipse.equinox.registry@default:default,org.eclipse.equinox.http.jetty@default:default,org.eclipse.equinox.preferences@default:default,org.eclipse.equinox.p2.metadata@default:default,org.mortbay.jetty.server@default:default,javax.servlet.jsp@default:default,org.eclipse.core.runtime.compatibility@default:default,org.eclipse.core.variables@default:default,org.eclipse.help.ui@default:default,org.eclipse.equinox.http.servlet@default:default,org.eclipse.core.filesystem@default:default,org.mortbay.jetty.util@default:default,org.eclipse.ui.ide@default:default,org.eclipse.jface.databinding@default:default,org.apache.commons.el@default:default,org.eclipse.equinox.app@default:default,org.eclipse.osgi@-1:true,org.eclipse.ui.views@default:!
default,javax.activation@default:default,org.apache.commons.lo!
gging*1.
0.4.v201005080501@default:default,javax.servlet@default:default,org.eclipse.core.databinding@default:default,org.eclipse.core.commands@default:default,org.eclipse.core.runtime.compatibility.registry@default:false,org.eclipse.equinox.p2.engine@default:default,org.slf4j.api@default:default,org.eclipse.ant.core@default:default,org.hamcrest.core@default:default,org.eclipse.core.runtime.compatibility.auth@default:default,ch.qos.logback.slf4j@default:false,org.eclipse.equinox.security.macosx@default:false,org.eclipse.ecf.identity@default:default,org.eclipse.ui.workbench@default:default,org.eclipse.ecf.ssl@default:false,org.junit*4.8.1.v4_8_1_v20100427-1100@default:default,org.eclipse.equinox.p2.core@default:default,org.eclipse.ui.cheatsheets@default:default,org.eclipse.ui.cocoa@default:false,org.eclipse.osgi.services@default:default,org.eclipse.ui@default:default,org.eclipse.ui.forms@default:default,org.eclipse.equinox.p2.metadata.repository@default:default,org.eclipse.text@defaul!
t:default,org.eclipse.core.databinding.property@default:default,org.eclipse.platform@default:default,ch.qos.logback.core@default:default,org.eclipse.core.net@default:default,org.apache.lucene@default:default,org.apache.ant@default:default,org.eclipse.core.jobs@default:default,org.eclipse.ecf.provider.filetransfer@default:default"/>
+<stringAttribute key="selected_workspace_plugins"
value="org.jboss.tools.usage@default:default"/>
+<booleanAttribute key="show_selected_only" value="false"/>
+<stringAttribute key="templateConfig"
value="${workspace_loc:org.jboss.tools.usage/config.ini}"/>
+<booleanAttribute key="tracing" value="false"/>
+<booleanAttribute key="useCustomFeatures" value="false"/>
+<booleanAttribute key="useDefaultConfig" value="false"/>
+<booleanAttribute key="useDefaultConfigArea" value="true"/>
+<booleanAttribute key="useProduct" value="true"/>
+<booleanAttribute key="usefeatures" value="false"/>
+</launchConfiguration>
Property changes on: branches/jbosstools-3.2.0.M2/usage/plugins/JBoss Usage
Reporter.launch
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: branches/jbosstools-3.2.0.M2/usage/plugins/META-INF/MANIFEST.MF
===================================================================
--- branches/jbosstools-3.2.0.M2/usage/plugins/META-INF/MANIFEST.MF
(rev 0)
+++ branches/jbosstools-3.2.0.M2/usage/plugins/META-INF/MANIFEST.MF 2010-09-02 15:03:44
UTC (rev 24654)
@@ -0,0 +1,17 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %BundleName
+Bundle-SymbolicName: org.jboss.tools.usage;singleton:=true
+Bundle-Version: 1.0.0.qualifier
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Export-Package: org.jboss.tools.usage,
+ org.jboss.tools.usage.googleanalytics,
+ org.jboss.tools.usage.preferences; x-friends:="org.jboss.tools.usage.test",
+ org.jboss.tools.usage.reporting;x-friends:="org.jboss.tools.usage.test",
+ org.jboss.tools.usage.util
+Require-Bundle: org.eclipse.osgi;bundle-version="3.5.0",
+ org.eclipse.core.runtime;bundle-version="[3.5.0,4.0.0)",
+ org.eclipse.ui;bundle-version="3.5.0"
+Bundle-Activator: org.jboss.tools.usage.internal.JBossToolsUsageActivator
+Bundle-Vendor: %BundleVendor
+Bundle-ActivationPolicy: lazy
Property changes on: branches/jbosstools-3.2.0.M2/usage/plugins/META-INF/MANIFEST.MF
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: branches/jbosstools-3.2.0.M2/usage/plugins/about.html
===================================================================
--- branches/jbosstools-3.2.0.M2/usage/plugins/about.html (rev 0)
+++ branches/jbosstools-3.2.0.M2/usage/plugins/about.html 2010-09-02 15:03:44 UTC (rev
24654)
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html
xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html;
charset=ISO-8859-1" />
+<title>Smooks Core</title>
+<style type="text/css" media="screen">
+<!--
+ body {
+ font-family: Sans-serif, Arial, Helvetica;
+ }
+
+-->
+</style>
+</head>
+<body>
+<h1>JBoss Usage Reporting</h1>
+
+<p>
+This plugin is part of the JBoss Tools developed by the <a
href="http://www.jboss.com">JBoss Inc.</a>
+</p>
+
+<p>Information about this plugin is available at <a
href="http://www.jboss.org/tools">JBoss Tools project
page</a></p>
+
+<p>
+This software is distributed under the terms of the Eclipse Public License - v 1.0
+(see <a
href="www.eclipse.org/legal/epl-v10.html">Eclipse Public License
- Version 1.0</a>).
+</p>
+</body>
+</html>
\ No newline at end of file
Property changes on: branches/jbosstools-3.2.0.M2/usage/plugins/about.html
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: branches/jbosstools-3.2.0.M2/usage/plugins/build.properties
===================================================================
--- branches/jbosstools-3.2.0.M2/usage/plugins/build.properties
(rev 0)
+++ branches/jbosstools-3.2.0.M2/usage/plugins/build.properties 2010-09-02 15:03:44 UTC
(rev 24654)
@@ -0,0 +1,16 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.xml,\
+ about.html,\
+ bin/
+src.includes = .classpath,\
+ .project,\
+ .settings/,\
+ JBoss Usage Reporter.launch,\
+ META-INF/,\
+ about.html,\
+ build.properties,\
+ plugin.xml,\
+ src/
Property changes on: branches/jbosstools-3.2.0.M2/usage/plugins/build.properties
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: branches/jbosstools-3.2.0.M2/usage/plugins/config.ini
===================================================================
--- branches/jbosstools-3.2.0.M2/usage/plugins/config.ini (rev 0)
+++ branches/jbosstools-3.2.0.M2/usage/plugins/config.ini 2010-09-02 15:03:44 UTC (rev
24654)
@@ -0,0 +1,20 @@
+org.jboss.tools.usage/ask_user_for_usage_report_preference=false
+org.jboss.tools.usage.configuration.ask_user_for_usage_report_preference=false
+configuration/org.jboss.tools.usage.ask_user_for_usage_report_preference=false
+eclipse.ask_user_for_usage_report_preference=false
+org.eclipse.pde.core.ask_user_for_usage_report_preference=false
+org.eclipse.core.runtime.ask_user_for_usage_report_preference=false
+ask_user_for_usage_report_preference=false
+
+org.eclipse.update.reconcile=false
+eclipse.p2.profile=SDKProfile
+osgi.instance.area.default=(a)user.home/Documents/workspace
+osgi.framework=file\:/Applications/jbdevstudio/eclipse/plugins/org.eclipse.osgi_3.5.2.R35x_v20100126.jar
+eclipse.buildId=M20100211-1343
+org.eclipse.equinox.simpleconfigurator.configUrl=file\:/Users/admin/workspaces/jboss-tools-usage/.metadata/.plugins/org.eclipse.pde.core/JBoss
Usage Reporter/org.eclipse.equinox.simpleconfigurator/bundles.info
+osgi.configuration.cascaded=true
+eclipse.product=com.jboss.jbds.product.product
+eclipse.application=org.eclipse.ui.ide.workbench
+eclipse.p2.data.area=(a)config.dir/.p2
+osgi.bundles.defaultStartLevel=4
+osgi.framework.extensions=reference\:file\:org.eclipse.equinox.transforms.hook_1.0.100.v20100119-2308.jar,reference\:file\:javax.transaction_1.1.1.v201002111330.jar
Property changes on: branches/jbosstools-3.2.0.M2/usage/plugins/config.ini
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: branches/jbosstools-3.2.0.M2/usage/plugins/plugin.properties
===================================================================
--- branches/jbosstools-3.2.0.M2/usage/plugins/plugin.properties
(rev 0)
+++ branches/jbosstools-3.2.0.M2/usage/plugins/plugin.properties 2010-09-02 15:03:44 UTC
(rev 24654)
@@ -0,0 +1,2 @@
+BundleName=JBoss Tools Usage Reporting
+BundleVendor=JBoss by Red Hat
\ No newline at end of file
Property changes on: branches/jbosstools-3.2.0.M2/usage/plugins/plugin.properties
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:mime-type
+ text/plain
Added: branches/jbosstools-3.2.0.M2/usage/plugins/plugin.xml
===================================================================
--- branches/jbosstools-3.2.0.M2/usage/plugins/plugin.xml (rev 0)
+++ branches/jbosstools-3.2.0.M2/usage/plugins/plugin.xml 2010-09-02 15:03:44 UTC (rev
24654)
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<plugin>
+ <extension
+ point="org.eclipse.ui.startup">
+ <startup
+ class="org.jboss.tools.usage.reporting.UsageReportDispatcher">
+ </startup>
+ </extension>
+ <extension
+ point="org.eclipse.ui.preferencePages">
+ <page
+
class="org.jboss.tools.usage.preferences.UsageReportPreferencePage"
+
id="org.jboss.tools.usage.analytics.preferences.UsageAnalyticsPreferencePage"
+ name="Usage Reporting Preferences"
+ category="org.jboss.tools.common.model.ui.MainPreferencePage">
+ </page>
+ </extension>
+ <extension
+ point="org.eclipse.core.runtime.preferences">
+ <initializer
+
class="org.jboss.tools.usage.preferences.UsageReportPreferenceInitializer">
+ </initializer>
+ </extension>
+</plugin>
Property changes on: branches/jbosstools-3.2.0.M2/usage/plugins/plugin.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: branches/jbosstools-3.2.0.M2/usage/plugins/pom.xml
===================================================================
--- branches/jbosstools-3.2.0.M2/usage/plugins/pom.xml 2010-09-02 14:59:54 UTC (rev
24653)
+++ branches/jbosstools-3.2.0.M2/usage/plugins/pom.xml 2010-09-02 15:03:44 UTC (rev
24654)
@@ -1,13 +1,13 @@
<project
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <modelVersion>4.0.0</modelVersion>
- <groupId>org.jboss.tools.usage</groupId>
- <artifactId>plugins</artifactId>
- <name>usage.plugins</name>
- <version>0.0.1-SNAPSHOT</version>
- <packaging>pom</packaging>
- <modules>
- <module>org.jboss.tools.usage</module>
- </modules>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.jboss.tools</groupId>
+ <artifactId>org.jboss.tools.parent.pom</artifactId>
+ <version>0.0.1-SNAPSHOT</version>
+ </parent>
+ <groupId>org.jboss.tools.usage.plugins</groupId>
+ <artifactId>org.jboss.tools.usage</artifactId>
+ <version>1.0.0-SNAPSHOT</version>
+ <packaging>eclipse-plugin</packaging>
</project>
-
Added:
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/FocusPoint.java
===================================================================
--- branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/FocusPoint.java
(rev 0)
+++
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/FocusPoint.java 2010-09-02
15:03:44 UTC (rev 24654)
@@ -0,0 +1,72 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.usage;
+
+import org.jboss.tools.usage.util.HttpEncodingUtils;
+
+/**
+ * Focus point of the application. It can represent data points like application
+ * load, application module load, user actions, error events etc.
+ */
+public class FocusPoint {
+
+ private String name;
+ private FocusPoint childFocusPoint;
+ public static final String URI_SEPARATOR = "/";
+ public static final String TITLE_SEPARATOR = "-";
+
+ public FocusPoint(String name) {
+ this.name = name;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public FocusPoint setChild(FocusPoint childFocusPoint) {
+ this.childFocusPoint = childFocusPoint;
+ return this;
+ }
+
+ public FocusPoint getChild() {
+ return childFocusPoint;
+ }
+
+ public String getContentURI() {
+ StringBuilder builder = new StringBuilder();
+ appendContentURI(builder, this);
+ return HttpEncodingUtils.checkedEncodeUtf8(builder.toString());
+ }
+
+ private void appendContentURI(StringBuilder builder, FocusPoint focusPoint) {
+ FocusPoint parentFocuPoint = focusPoint.getChild();
+ builder.append(URI_SEPARATOR);
+ builder.append(focusPoint.getName());
+ if (parentFocuPoint != null) {
+ appendContentURI(builder, parentFocuPoint);
+ }
+ }
+
+ public String getContentTitle() {
+ StringBuilder builder = new StringBuilder();
+ appendContentTitle(builder, this);
+ return HttpEncodingUtils.checkedEncodeUtf8(builder.toString());
+ }
+
+ private void appendContentTitle(StringBuilder builder, FocusPoint focusPoint) {
+ FocusPoint childFocusPoint = focusPoint.getChild();
+ builder.append(focusPoint.getName());
+ if (childFocusPoint != null) {
+ builder.append(TITLE_SEPARATOR);
+ appendContentTitle(builder, childFocusPoint);
+ }
+ }
+}
Property changes on:
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/FocusPoint.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/HttpGetRequest.java
===================================================================
---
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/HttpGetRequest.java
(rev 0)
+++
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/HttpGetRequest.java 2010-09-02
15:03:44 UTC (rev 24654)
@@ -0,0 +1,100 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.usage;
+
+import java.io.IOException;
+import java.net.HttpURLConnection;
+import java.net.URL;
+import java.text.MessageFormat;
+
+
+/**
+ * Class that executes a HTTP Get request to the given url.
+ *
+ * @author Andre Dietisheim
+ */
+public class HttpGetRequest implements IHttpGetRequest {
+
+ private static final String USER_AGENT = "User-Agent"; //$NON-NLS-1$
+
+ private static final String GET_METHOD_NAME = "GET"; //$NON-NLS-1$
+
+ private ILoggingAdapter loggingAdapter = null;
+
+// private CookieHandler cookieHandler;
+
+ private String userAgent;
+
+ public HttpGetRequest(String userAgent, ILoggingAdapter loggingAdapter) {
+ this.userAgent = userAgent;
+ this.loggingAdapter = loggingAdapter;
+// this.cookieHandler = new CookieHandler();
+// this.cookieHandler = CookieHandler.getDefault();
+// cookieHandler.setCookiePolicy(CookiePolicy.ACCEPT_ALL);
+ }
+
+ /* (non-Javadoc)
+ * @see org.jboss.tools.usage.IHttpGetRequest#request(java.lang.String)
+ */
+ public void request(String urlString) {
+
+// CookieHandler currentCookieHandler = setCookieHandler(cookieHandler);
+ try {
+ HttpURLConnection urlConnection = createURLConnection(urlString, userAgent);
+ urlConnection.connect();
+ int responseCode = getResponseCode(urlConnection);
+ if (responseCode == HttpURLConnection.HTTP_OK) {
+ loggingAdapter.logMessage(MessageFormat.format(UsageMessages.HttpGetMethod_Success,
urlString, responseCode));
+ } else {
+ loggingAdapter.logError(MessageFormat.format(UsageMessages.HttpGetMethod_Error_Http,
urlString));
+ }
+ } catch (Exception e) {
+ loggingAdapter.logMessage(MessageFormat.format(UsageMessages.HttpGetMethod_Error_Io,
urlString, e.toString()));
+ } finally {
+// setCookieHandler(currentCookieHandler);
+ }
+ }
+
+ /**
+ * Returns the return code from the given {@link HttpURLConnection}.
+ * Provided to be called by test cases so that they can retrieve the return code.
+ *
+ * @param urlConnection to get the response code from
+ * @return the return code the HttpUrlConnection received
+ * @throws IOException Signals that an I/O exception has occurred.
+ */
+ protected int getResponseCode(HttpURLConnection urlConnection) throws IOException {
+ return urlConnection.getResponseCode();
+ }
+
+// private CookieHandler setCookieHandler(CookieHandler cookieHandler) {
+// CookieHandler currentCookieHandler = CookieHandler.getDefault();
+// CookieHandler.setDefault(cookieHandler);
+// return currentCookieHandler;
+// }
+
+ /**
+ * Creates a new url connection.
+ *
+ * @param urlString the url string
+ * @param userAgent the user agent
+ * @return the http url connection
+ * @throws IOException Signals that an I/O exception has occurred.
+ */
+ protected HttpURLConnection createURLConnection(String urlString, String userAgent)
throws IOException {
+ URL url = new URL(urlString);
+ HttpURLConnection urlConnection = (HttpURLConnection) url.openConnection();
+ urlConnection.setInstanceFollowRedirects(true);
+ urlConnection.setRequestMethod(GET_METHOD_NAME);
+ urlConnection.setRequestProperty(USER_AGENT, userAgent);
+ return urlConnection;
+ }
+}
Property changes on:
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/HttpGetRequest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/HttpResourceMap.java
===================================================================
---
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/HttpResourceMap.java
(rev 0)
+++
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/HttpResourceMap.java 2010-09-02
15:03:44 UTC (rev 24654)
@@ -0,0 +1,150 @@
+package org.jboss.tools.usage;
+
+import java.io.BufferedInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.UnsupportedEncodingException;
+import java.net.HttpURLConnection;
+import java.net.URL;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Plugin;
+import org.jboss.tools.usage.util.HttpEncodingUtils;
+import org.jboss.tools.usage.util.StatusUtils;
+import org.jboss.tools.usage.util.reader.ReaderUtils;
+
+public abstract class HttpResourceMap {
+
+ static final String GET_METHOD_NAME = "GET"; //$NON-NLS-1$
+
+ protected Plugin plugin;
+ private Map<String, String> valuesMap;
+
+ private String[] keys;
+
+ private String url;
+
+ private char valueDelimiter;
+
+ public HttpResourceMap(String url, char valueDelimiter, Plugin plugin, String... keys)
{
+ this.url = url;
+ this.keys = keys;
+ this.valueDelimiter = valueDelimiter;
+ this.plugin = plugin;
+ }
+
+ protected Map<String, String> getValueMap() throws IOException {
+ if (valuesMap == null) {
+ HttpURLConnection urlConnection = createURLConnection(url);
+ InputStreamReader reader = request(urlConnection);
+ this.valuesMap = parse(keys, valueDelimiter, reader, new HashMap<String,
String>());
+ }
+ return valuesMap;
+ }
+
+ /**
+ * Sends a http GET request to the given URL. Returns the response string or
+ * <tt>null</tt> if an error occurred. The errors catched are Exceptions or
+ * HTTP error codes.
+ *
+ * @param url
+ * the url to send the GET request to
+ * @return the response or <tt>null</tt> if an error occured.
+ * @throws UnsupportedEncodingException
+ *
+ * @see HttpURLConnection
+ */
+ protected InputStreamReader request(HttpURLConnection urlConnection) throws IOException
{
+ InputStreamReader responseReader = null;
+ try {
+ urlConnection.connect();
+ int responseCode = getResponseCode(urlConnection);
+ if (responseCode == HttpURLConnection.HTTP_OK) {
+ IStatus status = StatusUtils.getDebugStatus(
+ plugin.getBundle().getSymbolicName()
+ , UsageMessages.KillSwitchPreference_Info_HttpQuery
+ , url);
+ plugin.getLog().log(status);
+ responseReader = getInputStreamReader(urlConnection.getInputStream(),
urlConnection.getContentType());
+ } else {
+ IStatus status = StatusUtils.getErrorStatus(
+ plugin.getBundle().getSymbolicName()
+ , UsageMessages.KillSwitchPreference_Error_Http, null, url);
+ plugin.getLog().log(status);
+ }
+ return responseReader;
+ } catch (IOException e) {
+ IStatus status = StatusUtils.getErrorStatus(
+ plugin.getBundle().getSymbolicName()
+ , UsageMessages.KillSwitchPreference_Error_Http, e, url);
+ plugin.getLog().log(status);
+ throw e;
+ }
+ }
+
+ private InputStreamReader getInputStreamReader(InputStream inputStream, String
contentType) throws UnsupportedEncodingException, IOException {
+ String contentTypeCharset = HttpEncodingUtils.getContentTypeCharset(contentType);
+ if (contentTypeCharset != null && contentTypeCharset.length() > 0) {
+ return new InputStreamReader(new BufferedInputStream(inputStream),
+ contentTypeCharset);
+ } else {
+ return new InputStreamReader(new BufferedInputStream(inputStream));
+ }
+ }
+
+ /**
+ * Parses the given string and extracts the enablement value.
+ *
+ * @param valueDelimiter
+ *
+ * @param input
+ * stream that holds
+ * @return
+ * @return true, if successful
+ */
+ private Map<String, String> parse(String[] keys, char valueDelimiter,
InputStreamReader reader,
+ Map<String, String> valuesMap) throws IOException {
+ for (String key = null; (key = ReaderUtils.skipUntil(reader, keys)) != null;) {
+ String value = ReaderUtils.readStringUntil(reader, valueDelimiter);
+ valuesMap.put(key, value);
+ }
+ return valuesMap;
+ }
+
+ /**
+ * Creates a new url connection.
+ *
+ * @param urlString
+ * the url string
+ * @return the http url connection
+ * @throws IOException
+ * @throws IOException
+ * Signals that an I/O exception has occurred.
+ */
+ protected HttpURLConnection createURLConnection(String urlString) throws IOException {
+ URL url = new URL(urlString);
+ HttpURLConnection urlConnection = (HttpURLConnection) url.openConnection();
+ urlConnection.setInstanceFollowRedirects(true);
+ urlConnection.setRequestMethod(GET_METHOD_NAME);
+ return urlConnection;
+ }
+
+ /**
+ * Returns the return code from the given {@link HttpURLConnection}.
+ * Provided to be called by test cases so that they can retrieve the return
+ * code.
+ *
+ * @param urlConnection
+ * to get the response code from
+ * @return the return code the HttpUrlConnection received
+ * @throws IOException
+ * Signals that an I/O exception has occurred.
+ */
+ protected int getResponseCode(HttpURLConnection urlConnection) throws IOException {
+ return urlConnection.getResponseCode();
+ }
+
+}
\ No newline at end of file
Property changes on:
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/HttpResourceMap.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/IHttpGetRequest.java
===================================================================
---
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/IHttpGetRequest.java
(rev 0)
+++
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/IHttpGetRequest.java 2010-09-02
15:03:44 UTC (rev 24654)
@@ -0,0 +1,22 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.usage;
+
+/**
+ * A interface that represents a HTTP Get Request.
+ *
+ * @author Andre Dietisheim
+ */
+public interface IHttpGetRequest {
+
+ public abstract void request(String urlString);
+
+}
\ No newline at end of file
Property changes on:
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/IHttpGetRequest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/ILoggingAdapter.java
===================================================================
---
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/ILoggingAdapter.java
(rev 0)
+++
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/ILoggingAdapter.java 2010-09-02
15:03:44 UTC (rev 24654)
@@ -0,0 +1,22 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.usage;
+
+/**
+ * @author Andre Dietisheim
+ */
+public interface ILoggingAdapter {
+
+ public void logError(String errorMessage);
+
+ public void logMessage(String message);
+
+}
Property changes on:
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/ILoggingAdapter.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/ITracker.java
===================================================================
--- branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/ITracker.java
(rev 0)
+++
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/ITracker.java 2010-09-02
15:03:44 UTC (rev 24654)
@@ -0,0 +1,35 @@
+package org.jboss.tools.usage;
+
+import java.io.UnsupportedEncodingException;
+
+
+/**
+ * @author Andre Dietisheim
+ */
+public interface ITracker {
+
+ /**
+ * Track the focusPoint in the application synchronously. <br/>
+ * <red><b>Please be cognizant while using this method. Since, it would
have
+ * a peformance hit on the actual application. Use it unless it's really
+ * needed</b></red>
+ *
+ * @param focusPoint
+ * Focus point of the application like application load,
+ * application module load, user actions, error events etc.
+ * @throws UnsupportedEncodingException
+ */
+
+ public abstract void trackSynchronously(FocusPoint focusPoint);
+
+ /**
+ * Track the focusPoint in the application asynchronously. <br/>
+ *
+ * @param focusPoint
+ * Focus point of the application like application load,
+ * application module load, user actions, error events etc.
+ */
+
+ public abstract void trackAsynchronously(FocusPoint focusPoint);
+
+}
\ No newline at end of file
Property changes on:
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/ITracker.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/IURLBuildingStrategy.java
===================================================================
---
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/IURLBuildingStrategy.java
(rev 0)
+++
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/IURLBuildingStrategy.java 2010-09-02
15:03:44 UTC (rev 24654)
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.usage;
+
+import java.io.UnsupportedEncodingException;
+
+
+/**
+ * Interface for the URL building strategy
+ *
+ * @author Andre Dietisheim
+ *
+ */
+public interface IURLBuildingStrategy {
+
+ public String build(FocusPoint focusPoint) throws UnsupportedEncodingException;
+
+}
Property changes on:
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/IURLBuildingStrategy.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/PluginLogger.java
===================================================================
---
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/PluginLogger.java
(rev 0)
+++
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/PluginLogger.java 2010-09-02
15:03:44 UTC (rev 24654)
@@ -0,0 +1,42 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.usage;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Plugin;
+import org.eclipse.core.runtime.Status;
+
+/**
+ * @author Andre Dietisheim
+ */
+public class PluginLogger implements ILoggingAdapter {
+
+ private Plugin plugin;
+
+ public PluginLogger(Plugin plugin) {
+ this.plugin = plugin;
+ }
+
+ public void logError(String message) {
+ log(IStatus.ERROR, message);
+ }
+
+ public void logMessage(String message) {
+ log(IStatus.INFO, message);
+ }
+
+ private void log(int severity, String message) {
+ if (plugin != null) {
+ IStatus status = new Status(severity, plugin.getBundle().getSymbolicName(), message);
+ plugin.getLog().log(status);
+ }
+ }
+}
Property changes on:
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/PluginLogger.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/Tracker.java
===================================================================
--- branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/Tracker.java
(rev 0)
+++
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/Tracker.java 2010-09-02
15:03:44 UTC (rev 24654)
@@ -0,0 +1,71 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.usage;
+
+import java.io.UnsupportedEncodingException;
+import java.text.MessageFormat;
+
+/**
+ * Reports (tracks) usage
+ *
+ * @author Andre Dietisheim
+ * @see based on <a
+ *
href="http://jgoogleAnalytics.googlecode.com">http://jgoogleAnalytics
+ * .googlecode.com</a>
+ */
+public class Tracker implements ITracker {
+
+ private IURLBuildingStrategy urlBuildingStrategy = null;
+ private IHttpGetRequest httpRequest;
+ private ILoggingAdapter loggingAdapter;
+
+ public Tracker(IURLBuildingStrategy urlBuildingStrategy, IHttpGetRequest httpGetRequest,
ILoggingAdapter loggingAdapter) {
+ this.httpRequest = httpGetRequest;
+ this.loggingAdapter = loggingAdapter;
+ this.urlBuildingStrategy = urlBuildingStrategy;
+ }
+
+ public void trackSynchronously(FocusPoint focusPoint) {
+ loggingAdapter
+ .logMessage(MessageFormat.format(UsageMessages.Tracker_Synchronous,
focusPoint.getContentTitle()));
+ try {
+ httpRequest.request(getTrackingUrl(focusPoint));
+ } catch (Exception e) {
+ loggingAdapter.logMessage(MessageFormat.format(UsageMessages.Tracker_Error,
e.getMessage()));
+ }
+ }
+
+ protected String getTrackingUrl(FocusPoint focusPoint) throws
UnsupportedEncodingException {
+ return urlBuildingStrategy.build(focusPoint);
+ }
+
+ public void trackAsynchronously(FocusPoint focusPoint) {
+ loggingAdapter.logMessage(MessageFormat
+ .format(UsageMessages.Tracker_Asynchronous, focusPoint.getContentTitle()));
+ new Thread(new TrackingRunnable(focusPoint)).start();
+ }
+
+ private class TrackingRunnable implements Runnable {
+ private FocusPoint focusPoint;
+
+ private TrackingRunnable(FocusPoint focusPoint) {
+ this.focusPoint = focusPoint;
+ }
+
+ public void run() {
+ try {
+ httpRequest.request(getTrackingUrl(focusPoint));
+ } catch (Exception e) {
+ loggingAdapter.logMessage(MessageFormat.format(UsageMessages.Tracker_Error,
e.getMessage()));
+ }
+ }
+ }
+}
Property changes on:
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/Tracker.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/UsageMessages.java
===================================================================
---
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/UsageMessages.java
(rev 0)
+++
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/UsageMessages.java 2010-09-02
15:03:44 UTC (rev 24654)
@@ -0,0 +1,36 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.usage;
+
+import org.eclipse.osgi.util.NLS;
+
+public class UsageMessages extends NLS {
+ private static final String BUNDLE_NAME = "org.jboss.tools.usage.messages";
//$NON-NLS-1$
+ public static String Tracker_Synchronous;
+ public static String Tracker_Asynchronous;
+ public static String Tracker_Error;
+
+ public static String HttpGetMethod_Error_Http;
+ public static String HttpGetMethod_Error_Io;
+ public static String HttpGetMethod_Success;
+
+ public static String KillSwitchPreference_Error_Exception;
+ public static String KillSwitchPreference_Error_Http;
+ public static String KillSwitchPreference_Info_HttpQuery;
+
+ static {
+ // initialize resource bundle
+ NLS.initializeMessages(BUNDLE_NAME, UsageMessages.class);
+ }
+
+ private UsageMessages() {
+ }
+}
Property changes on:
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/UsageMessages.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/googleanalytics/AbstractGoogleAnalyticsParameters.java
===================================================================
---
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/googleanalytics/AbstractGoogleAnalyticsParameters.java
(rev 0)
+++
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/googleanalytics/AbstractGoogleAnalyticsParameters.java 2010-09-02
15:03:44 UTC (rev 24654)
@@ -0,0 +1,40 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.usage.googleanalytics;
+
+
+/**
+ * @author Andre Dietisheim
+ */
+public abstract class AbstractGoogleAnalyticsParameters implements
IGoogleAnalyticsParameters {
+
+ private String accountName;
+ private String referral;
+ private String hostName;
+
+ public AbstractGoogleAnalyticsParameters(String accountName, String hostName, String
referral) {
+ this.accountName = accountName;
+ this.hostName = hostName;
+ this.referral = referral;
+ }
+
+ public String getAccountName() {
+ return accountName;
+ }
+
+ public String getHostname() {
+ return hostName;
+ }
+
+ public String getReferral() {
+ return referral;
+ }
+}
Property changes on:
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/googleanalytics/AbstractGoogleAnalyticsParameters.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/googleanalytics/GoogleAnalyticsCookie.java
===================================================================
---
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/googleanalytics/GoogleAnalyticsCookie.java
(rev 0)
+++
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/googleanalytics/GoogleAnalyticsCookie.java 2010-09-02
15:03:44 UTC (rev 24654)
@@ -0,0 +1,42 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.usage.googleanalytics;
+
+import org.eclipse.core.runtime.Assert;
+
+public class GoogleAnalyticsCookie {
+
+ private CharSequence value;
+ private String identifier;
+ private char[] delimiters;
+
+ public GoogleAnalyticsCookie(String identifier, CharSequence value, char... delimiters)
{
+ Assert.isTrue(identifier != null && identifier.length() > 0);
+ Assert.isTrue(value != null && value.length() > 0);
+
+ this.identifier = identifier;
+ this.value = value;
+ this.delimiters = delimiters;
+ }
+
+ public GoogleAnalyticsCookie(String identifier, CharSequence value) {
+ this(identifier, value, (char) -1);
+ }
+
+ public void appendTo(StringBuilder builder) {
+ builder.append(identifier)
+ .append(IGoogleAnalyticsParameters.EQUALS_SIGN)
+ .append(value);
+ for (char delimiter : delimiters) {
+ builder.append(delimiter);
+ }
+ }
+}
Property changes on:
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/googleanalytics/GoogleAnalyticsCookie.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/googleanalytics/GoogleAnalyticsMessages.java
===================================================================
---
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/googleanalytics/GoogleAnalyticsMessages.java
(rev 0)
+++
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/googleanalytics/GoogleAnalyticsMessages.java 2010-09-02
15:03:44 UTC (rev 24654)
@@ -0,0 +1,25 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.usage.googleanalytics;
+
+import org.eclipse.osgi.util.NLS;
+
+public class GoogleAnalyticsMessages extends NLS {
+
+ private static final String BUNDLE_NAME =
"org.jboss.tools.usage.googleanalytics.messages"; //$NON-NLS-1$
+ static {
+ // initialize resource bundle
+ NLS.initializeMessages(BUNDLE_NAME, GoogleAnalyticsMessages.class);
+ }
+
+ private GoogleAnalyticsMessages() {
+ }
+}
Property changes on:
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/googleanalytics/GoogleAnalyticsMessages.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/googleanalytics/GoogleAnalyticsUrlStrategy.java
===================================================================
---
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/googleanalytics/GoogleAnalyticsUrlStrategy.java
(rev 0)
+++
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/googleanalytics/GoogleAnalyticsUrlStrategy.java 2010-09-02
15:03:44 UTC (rev 24654)
@@ -0,0 +1,218 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.usage.googleanalytics;
+
+import java.io.UnsupportedEncodingException;
+
+import org.jboss.tools.usage.FocusPoint;
+import org.jboss.tools.usage.IURLBuildingStrategy;
+import org.jboss.tools.usage.util.HttpEncodingUtils;
+
+/**
+ * Class that builds an URL that passes given parameters to google analytics
+ *
+ * @author Andre Dietisheim
+ *
+ * @see <a
+ *
href="http://code.google.com/apis/analytics/docs/tracking/gaTracking...
+ * Request Parameters</a>
+ * @see <a
+ *
href="http://code.google.com/apis/analytics/docs/concepts/gaConcepts...
+ * Set By Google Analytics</a>
+ *
+ * @see <a
+ *
href="http://www.morevisibility.com/analyticsblog/from-__utma-to-__u...
+ * __utma to __utmz (Google Analytics Cookies)</a>
+ */
+public class GoogleAnalyticsUrlStrategy implements IURLBuildingStrategy {
+
+ private static final String TRACKING_URL =
"http://www.google-analytics.com/__utm.gif";
+
+ // private static final int VISITS = -1;
+
+ private IGoogleAnalyticsParameters googleParameters;
+
+ public GoogleAnalyticsUrlStrategy(IGoogleAnalyticsParameters googleAnalyticsParameters)
{
+ this.googleParameters = googleAnalyticsParameters;
+ }
+
+ public String build(FocusPoint focusPoint) throws UnsupportedEncodingException {
+ /*
+ * Google Analytics for Android:
+ *
+ String str = "";
+ if (paramEvent.action != null)
+ str = paramEvent.action;
+ if (!(str.startsWith("/")))
+ str = "/" + str;
+ str = encode(str);
+ Locale localLocale = Locale.getDefault();
+ StringBuilder localStringBuilder = new StringBuilder();
+ localStringBuilder.append("/__utm.gif");
+ localStringBuilder.append("?utmwv=4.3");
+ localStringBuilder.append("&utmn=").append(paramEvent.randomVal);
+ localStringBuilder.append("&utmcs=UTF-8");
+ localStringBuilder.append(String.format("&utmsr=%dx%d", new Object[] {
+ Integer.valueOf(paramEvent.screenWidth)
+ , Integer.valueOf(paramEvent.screenHeight) }));
+ localStringBuilder.append(String.format("&utmul=%s-%s", new Object[] {
+ localLocale.getLanguage()
+ , localLocale.getCountry() }));
+ localStringBuilder.append("&utmp=").append(str);
+ localStringBuilder.append("&utmac=").append(paramEvent.accountId);
+ localStringBuilder.append("&utmcc=").append(
+ getEscapedCookieString(paramEvent, paramString));
+ return localStringBuilder.toString();
+
+ *
+ * getEscapedCookieString:
+ *
+ StringBuilder localStringBuilder = new StringBuilder();
+ localStringBuilder.append("__utma=");
+ localStringBuilder.append("999").append(".");
+ localStringBuilder.append(paramEvent.userId).append(".");
+ localStringBuilder.append(paramEvent.timestampFirst).append(".");
+ localStringBuilder.append(paramEvent.timestampPrevious).append(".");
+ localStringBuilder.append(paramEvent.timestampCurrent).append(".");
+ localStringBuilder.append(paramEvent.visits);
+ if (paramString != null)
+ {
+ localStringBuilder.append("+__utmz=");
+ localStringBuilder.append("999").append(".");
+ localStringBuilder.append(paramEvent.timestampFirst).append(".");
+ localStringBuilder.append("1.1.");
+ localStringBuilder.append(paramString);
+ }
+ return encode(localStringBuilder.toString());
+
+ */
+
+ StringBuilder builder = new StringBuilder(TRACKING_URL)
+ .append(IGoogleAnalyticsParameters.URL_PARAM_DELIMITER);
+ appendParameter(IGoogleAnalyticsParameters.PARAM_TRACKING_CODE_VERSION,
+ IGoogleAnalyticsParameters.VALUE_TRACKING_CODE_VERSION, builder);
+ appendParameter(IGoogleAnalyticsParameters.PARAM_UNIQUE_TRACKING_NUMBER,
getRandomNumber(), builder);
+ appendParameter(IGoogleAnalyticsParameters.PARAM_HOST_NAME,
googleParameters.getHostname(), builder);
+ appendParameter(IGoogleAnalyticsParameters.PARAM_LANGUAGE_ENCODING,
+ IGoogleAnalyticsParameters.VALUE_ENCODING_UTF8, builder);
+ appendParameter(IGoogleAnalyticsParameters.PARAM_SCREEN_RESOLUTION,
googleParameters.getScreenResolution(),
+ builder);
+ appendParameter(IGoogleAnalyticsParameters.PARAM_SCREEN_COLOR_DEPTH,
googleParameters.getScreenColorDepth(),
+ builder);
+ appendParameter(IGoogleAnalyticsParameters.PARAM_BROWSER_LANGUAGE,
googleParameters.getBrowserLanguage(),
+ builder);
+ appendParameter(IGoogleAnalyticsParameters.PARAM_PAGE_TITLE,
focusPoint.getContentTitle(), builder);
+ // appendParameter(IGoogleAnalyticsParameters.PARAM_HID,
+ // getRandomNumber(), builder);
+ appendParameter(IGoogleAnalyticsParameters.PARAM_REFERRAL,
googleParameters.getReferral(), builder);
+ appendParameter(IGoogleAnalyticsParameters.PARAM_PAGE_REQUEST,
focusPoint.getContentURI(), builder);
+
+ appendParameter(IGoogleAnalyticsParameters.PARAM_ACCOUNT_NAME,
googleParameters.getAccountName(), builder);
+ appendParameter(IGoogleAnalyticsParameters.PARAM_COOKIES, getCookies(), builder);
+ appendParameter(IGoogleAnalyticsParameters.PARAM_GAQ, "1", false, builder);
+
+ googleParameters.visit();
+
+ return builder.toString();
+ }
+
+ /**
+ * Returns the google analytics cookies. These cookies determines user
+ * identity, session identity etc.
+ *
+ * @return the cookies
+ *
+ * @see <a
+ *
href="http://www.analyticsexperts.com/google-analytics/information-a...
+ * about the utmLinker and the __utma, __utmb and __utmc cookies</a>
+ */
+ private String getCookies() {
+ StringBuilder builder = new StringBuilder();
+
+ /**
+ * unique visitor id cookie has to be unique per eclipse installation
+ */
+ // String timeStamp = "-1";
+ // //String.valueOf(System.currentTimeMillis());
+ new GoogleAnalyticsCookie(IGoogleAnalyticsParameters.PARAM_COOKIES_UNIQUE_VISITOR_ID,
+ new StringBuilder().append("999.")
+ .append(googleParameters.getUserId()).append(IGoogleAnalyticsParameters.DOT)
+ .append(googleParameters.getFirstVisit()).append(IGoogleAnalyticsParameters.DOT)
+ .append(googleParameters.getLastVisit()).append(IGoogleAnalyticsParameters.DOT)
+ .append(googleParameters.getCurrentVisit()).append(IGoogleAnalyticsParameters.DOT)
+ .append(googleParameters.getVisitCount())
+ .append(IGoogleAnalyticsParameters.SEMICOLON),
+ IGoogleAnalyticsParameters.PLUS_SIGN)
+ .appendTo(builder);
+
+ new GoogleAnalyticsCookie(IGoogleAnalyticsParameters.PARAM_COOKIES_REFERRAL_TYPE,
+ new StringBuilder()
+ .append("999.")
+ .append(googleParameters.getFirstVisit())
+ .append(IGoogleAnalyticsParameters.DOT)
+ .append("1.1."))
+ .appendTo(builder);
+
+// new GoogleAnalyticsCookie(IGoogleAnalyticsParameters.PARAM_COOKIES_SESSION,
+// new StringBuilder()
+// .append("1"),
+// IGoogleAnalyticsParameters.SEMICOLON
+// , IGoogleAnalyticsParameters.PLUS_SIGN)
+// .appendTo(builder);
+//
+// new GoogleAnalyticsCookie(IGoogleAnalyticsParameters.PARAM_COOKIES_BROWSERSESSION,
+// new StringBuilder()
+// .append("1"),
+// IGoogleAnalyticsParameters.SEMICOLON
+// , IGoogleAnalyticsParameters.PLUS_SIGN)
+// .appendTo(builder);
+
+ new GoogleAnalyticsCookie(IGoogleAnalyticsParameters.PARAM_COOKIES_UTMCSR,
+ "(direct)",
+ IGoogleAnalyticsParameters.PIPE)
+ .appendTo(builder);
+
+ new GoogleAnalyticsCookie(IGoogleAnalyticsParameters.PARAM_COOKIES_UTMCCN,
+ "(direct)",
+ IGoogleAnalyticsParameters.PIPE)
+ .appendTo(builder);
+
+ new GoogleAnalyticsCookie(IGoogleAnalyticsParameters.PARAM_COOKIES_UTMCMD,
+ "(none)",
+ IGoogleAnalyticsParameters.PIPE)
+ .appendTo(builder);
+
+ new GoogleAnalyticsCookie(IGoogleAnalyticsParameters.PARAM_COOKIES_KEYWORD,
+ googleParameters.getKeyword())
+ .appendTo(builder);
+
+ builder.append(IGoogleAnalyticsParameters.SEMICOLON);
+
+ return HttpEncodingUtils.checkedEncodeUtf8(builder.toString());
+ }
+
+ private String getRandomNumber() {
+ return Integer.toString((int) (Math.random() * 0x7fffffff));
+ }
+
+ private void appendParameter(String name, String value, StringBuilder builder) {
+ appendParameter(name, value, true, builder);
+ }
+
+ private void appendParameter(String name, String value, boolean appendAmpersand,
StringBuilder builder) {
+ builder.append(name)
+ .append(IGoogleAnalyticsParameters.EQUALS_SIGN)
+ .append(value);
+ if (appendAmpersand) {
+ builder.append(IGoogleAnalyticsParameters.AMPERSAND);
+ }
+ }
+}
Property changes on:
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/googleanalytics/GoogleAnalyticsUrlStrategy.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/googleanalytics/IGoogleAnalyticsParameters.java
===================================================================
---
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/googleanalytics/IGoogleAnalyticsParameters.java
(rev 0)
+++
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/googleanalytics/IGoogleAnalyticsParameters.java 2010-09-02
15:03:44 UTC (rev 24654)
@@ -0,0 +1,95 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.usage.googleanalytics;
+
+/**
+ * An interface that provides methods for all parameters that google analytics
+ * needs to know about.
+ *
+ * @author Andre Dietisheim
+ * @see <a
+ *
href="http://code.google.com/apis/analytics/docs/tracking/gaTracking...
Request Parameters</a>
+ */
+public interface IGoogleAnalyticsParameters {
+
+ public static final char AMPERSAND = '&';
+ public static final char EQUALS_SIGN = '=';
+ public static final char URL_PARAM_DELIMITER = '?';
+ public static final char PLUS_SIGN = '+';
+ public static final char DOT = '.';
+ public static final char SEMICOLON = ';';
+ public static final char JAVA_LOCALE_DELIMITER = '_';
+ public static final char BROWSER_LOCALE_DELIMITER = '-';
+ public static final char PIPE = '|';
+ public static final char VERSION_DELIMITER = '.';
+
+ public static final String PARAM_HID = "utmhid";
+ public static final String PARAM_PAGE_REQUEST = "utmp";
+ public static final String PARAM_ACCOUNT_NAME = "utmac";
+ public static final String PARAM_HOST_NAME = "utmhn";
+ public static final String PARAM_COOKIES = "utmcc";
+ public static final String PARAM_COOKIES_UNIQUE_VISITOR_ID = "__utma";
+ public static final String PARAM_COOKIES_SESSION = "__utmb";
+ public static final String PARAM_COOKIES_BROWSERSESSION = "__utmc";
+ public static final String PARAM_COOKIES_REFERRAL_TYPE = "__utmz";
+
+ public static final String PARAM_REFERRAL = "utmr";
+ public static final String PARAM_TRACKING_CODE_VERSION = "utmwv";
+ public static final String PARAM_UNIQUE_TRACKING_NUMBER = "utmn";
+ public static final String PARAM_LANGUAGE_ENCODING = "utmcs";
+ public static final String PARAM_SCREEN_RESOLUTION = "utmsr";
+ public static final String PARAM_SCREEN_COLOR_DEPTH = "utmsc";
+ public static final String PARAM_PRODUCT_NAME = "utmipn";
+ public static final String PARAM_PRODUCT_CODE = "utmipc";
+ public static final String PARAM_BROWSER_LANGUAGE = "utmul";
+ public static final String PARAM_REPEAT_CAMPAIGN_VISIT = "utmcr";
+ public static final String PARAM_PAGE_TITLE = "utmdt";
+ public static final String PARAM_GAQ = "gaq";
+ public static final String PARAM_COOKIES_UTMCSR = "utmcsr";
+ public static final String PARAM_COOKIES_UTMCCN = "utmccn";
+ public static final String PARAM_COOKIES_UTMCMD = "utmcmd";
+ public static final String PARAM_COOKIES_KEYWORD = "utmctr";
+
+ public static final String VALUE_TRACKING_CODE_VERSION = "4.7.2";
+ public static final String VALUE_NO_REFERRAL = "0";
+ public static final String VALUE_ENCODING_UTF8 = "UTF-8";
+
+ public static final String SCREERESOLUTION_DELIMITER = "x";
+ public static final String SCREENCOLORDEPTH_POSTFIX = "-bit";
+
+ public String getAccountName();
+
+ public String getReferral();
+
+ public String getScreenResolution();
+
+ public String getScreenColorDepth();
+
+ public String getBrowserLanguage();
+
+ public String getHostname();
+
+ public String getUserAgent();
+
+ public String getUserId();
+
+ public String getKeyword();
+
+ public String getFirstVisit();
+
+ public String getLastVisit();
+
+ public String getCurrentVisit();
+
+ public long getVisitCount();
+
+ public void visit();
+}
Property changes on:
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/googleanalytics/IGoogleAnalyticsParameters.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/googleanalytics/messages.properties
===================================================================
Property changes on:
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/googleanalytics/messages.properties
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/internal/JBossToolsUsageActivator.java
===================================================================
---
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/internal/JBossToolsUsageActivator.java
(rev 0)
+++
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/internal/JBossToolsUsageActivator.java 2010-09-02
15:03:44 UTC (rev 24654)
@@ -0,0 +1,47 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.usage.internal;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * @author Andre Dietisheim
+ */
+public class JBossToolsUsageActivator extends AbstractUIPlugin {
+
+ public static final String PLUGIN_ID = "org.jboss.tools.usage"; //$NON-NLS-1$
+
+ private static JBossToolsUsageActivator plugin;
+
+ public JBossToolsUsageActivator() {
+ plugin = this;
+ }
+
+ @Override
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ public static JBossToolsUsageActivator getDefault() {
+ return plugin;
+ }
+
+ public static ImageDescriptor getImageDescriptor(String path) {
+ return imageDescriptorFromPlugin(PLUGIN_ID, path);
+ }
+
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ }
+}
Property changes on:
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/internal/JBossToolsUsageActivator.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/messages.properties
===================================================================
---
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/messages.properties
(rev 0)
+++
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/messages.properties 2010-09-02
15:03:44 UTC (rev 24654)
@@ -0,0 +1,11 @@
+HttpGetMethod_Error_Http=HTTP GET to \"{0}\" failed, response code received
\"{1}\"
+HttpGetMethod_Error_Io=HTTP GET to \"{0}\" failed, exception occured:
\"{1}\"
+HttpGetMethod_Success=HTTP GET to url \"{0}\" successfull\!
+
+Tracker_Asynchronous=Tracking asynchronously focusPoint \"{0}\"
+Tracker_Error=Tracking failed, exception thrown: \"{0}\"
+Tracker_Synchronous=Tracking synchronously focusPoint \"{0}\"
+
+KillSwitchPreference_Error_Exception=Could not query kill switch preference at
\"{0}\"
+KillSwitchPreference_Error_Http=Could not query kill switch preference at \"{0}\,
response code was \"{1}\""
+KillSwitchPreference_Info_HttpQuery=Queried kill switch preference at \"{0}\"
Property changes on:
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/messages.properties
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/preferences/GlobalUsageReportingSettings.java
===================================================================
---
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/preferences/GlobalUsageReportingSettings.java
(rev 0)
+++
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/preferences/GlobalUsageReportingSettings.java 2010-09-02
15:03:44 UTC (rev 24654)
@@ -0,0 +1,51 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.usage.preferences;
+
+import java.util.Map;
+
+import org.eclipse.core.runtime.Plugin;
+import org.jboss.tools.usage.HttpResourceMap;
+
+/**
+ * A class that implements a global reporting enablement setting. The current
+ * implementation queries a given url and extracts the enablement value out of
+ * the response.
+ */
+public class GlobalUsageReportingSettings extends HttpResourceMap {
+
+ private static final String REPORTING_ENABLEMENT_URL =
"http://anonsvn.jboss.org/repos/jbosstools/workspace/usage/usage.properties";
//$NON-NLS-1$
+
+ public static final String REPORT_ENABLEMENT_KEY = "usage_reporting_enabled=";
//$NON-NLS-1$
+ private static final boolean REPORT_ENABLEMENT_DEFAULT = false;
+
+ /* the delimiter that delimits the value */
+ private static final char VALUE_DELIMITER = '\n';
+
+ public GlobalUsageReportingSettings(Plugin plugin) {
+ super(REPORTING_ENABLEMENT_URL
+ , VALUE_DELIMITER
+ , plugin
+ , REPORT_ENABLEMENT_KEY);
+
+ this.plugin = plugin;
+ }
+
+ public boolean isEnabled() {
+ try {
+ Map<String, String> valueMap = getValueMap();
+ String isEnabled = valueMap.get(REPORT_ENABLEMENT_KEY);
+ return Boolean.valueOf(isEnabled);
+ } catch (Exception e) {
+ return REPORT_ENABLEMENT_DEFAULT;
+ }
+ }
+}
Property changes on:
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/preferences/GlobalUsageReportingSettings.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/preferences/IUsageReportPreferenceConstants.java
===================================================================
---
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/preferences/IUsageReportPreferenceConstants.java
(rev 0)
+++
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/preferences/IUsageReportPreferenceConstants.java 2010-09-02
15:03:44 UTC (rev 24654)
@@ -0,0 +1,46 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.usage.preferences;
+
+/**
+ * @author Andre Dietisheim
+ */
+public interface IUsageReportPreferenceConstants {
+
+ /** The value that determines if usage shall be reported if there's no user set
setting. */
+ public static final boolean USAGEREPORT_ENABLED_DEFAULTVALUE = false;
+
+ /**
+ * The identifier to be used to identify the value that determines if usage
+ * shall be reported.
+ */
+ public static final String USAGEREPORT_ENABLED_ID =
"allow_usage_report_preference"; //$NON-NLS-1$
+
+ /**
+ * The identifier to be used for the value that determines if the user shall
+ * be asked for reporting.
+ */
+ public static final String ASK_USER_USAGEREPORT_ID =
"ask_user_for_usage_report_preference"; //$NON-NLS-1$
+
+ /**
+ * The identifier to be used for the value that determines this eclipse
+ * instance.
+ */
+ public static final String ECLIPSE_INSTANCE_ID = "eclipse_instance_id";
//$NON-NLS-1$
+
+ public static final String FIRST_VISIT = "first_visit";
+
+ public static final String LAST_VISIT = "last_visit";
+
+ public static final String VISIT_COUNT = "visit_count";
+
+ public static final boolean ASK_USER_USAGEREPORT_DEFAULTVALUE = true;
+}
Property changes on:
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/preferences/IUsageReportPreferenceConstants.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/preferences/PreferencesMessages.java
===================================================================
---
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/preferences/PreferencesMessages.java
(rev 0)
+++
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/preferences/PreferencesMessages.java 2010-09-02
15:03:44 UTC (rev 24654)
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.usage.preferences;
+
+import org.eclipse.osgi.util.NLS;
+
+public class PreferencesMessages extends NLS {
+ private static final String BUNDLE_NAME =
"org.jboss.tools.usage.preferences.messages"; //$NON-NLS-1$
+
+ public static String UsageReportPreferencePage_Description;
+ public static String UsageReportPreferencePage_AllowReporting;
+ public static String UsageReportPreferencePage_Error_Saving;
+
+ static {
+ // initialize resource bundle
+ NLS.initializeMessages(BUNDLE_NAME, PreferencesMessages.class);
+ }
+
+ private PreferencesMessages() {
+ }
+}
Property changes on:
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/preferences/PreferencesMessages.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/preferences/UsageReportPreferenceInitializer.java
===================================================================
---
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/preferences/UsageReportPreferenceInitializer.java
(rev 0)
+++
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/preferences/UsageReportPreferenceInitializer.java 2010-09-02
15:03:44 UTC (rev 24654)
@@ -0,0 +1,31 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.usage.preferences;
+
+import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;
+import org.jboss.tools.usage.util.PreferencesUtils;
+
+/**
+ * @author Andre Dietisheim
+ */
+public class UsageReportPreferenceInitializer extends
+ AbstractPreferenceInitializer {
+
+ public void initializeDefaultPreferences() {
+ PreferencesUtils.getStore().setDefault(
+ IUsageReportPreferenceConstants.ASK_USER_USAGEREPORT_ID,
+ IUsageReportPreferenceConstants.ASK_USER_USAGEREPORT_DEFAULTVALUE);
+
+ PreferencesUtils.getStore().setDefault(
+ IUsageReportPreferenceConstants.USAGEREPORT_ENABLED_ID,
+ IUsageReportPreferenceConstants.USAGEREPORT_ENABLED_DEFAULTVALUE);
+ }
+}
Property changes on:
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/preferences/UsageReportPreferenceInitializer.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/preferences/UsageReportPreferencePage.java
===================================================================
---
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/preferences/UsageReportPreferencePage.java
(rev 0)
+++
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/preferences/UsageReportPreferencePage.java 2010-09-02
15:03:44 UTC (rev 24654)
@@ -0,0 +1,54 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.usage.preferences;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.jface.preference.BooleanFieldEditor;
+import org.eclipse.jface.preference.FieldEditorPreferencePage;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPreferencePage;
+import org.jboss.tools.usage.internal.JBossToolsUsageActivator;
+import org.jboss.tools.usage.util.StatusUtils;
+import org.osgi.service.prefs.BackingStoreException;
+
+/**
+ * @author Andre Dietisheim
+ */
+public class UsageReportPreferencePage extends FieldEditorPreferencePage implements
IWorkbenchPreferencePage {
+
+ public UsageReportPreferencePage() {
+ super(GRID);
+ }
+
+ public void createFieldEditors() {
+ addField(new BooleanFieldEditor(
+ IUsageReportPreferenceConstants.USAGEREPORT_ENABLED_ID
+ , PreferencesMessages.UsageReportPreferencePage_AllowReporting
+ , getFieldEditorParent()));
+ }
+
+ public void init(IWorkbench workbench) {
+ setPreferenceStore(UsageReportPreferences.createPreferenceStore());
+ setDescription(PreferencesMessages.UsageReportPreferencePage_Description);
+ }
+
+ @Override
+ public boolean performOk() {
+ try {
+ UsageReportPreferences.flush();
+ } catch (BackingStoreException e) {
+ IStatus status = StatusUtils.getErrorStatus(JBossToolsUsageActivator.PLUGIN_ID,
+ PreferencesMessages.UsageReportPreferencePage_Error_Saving, e);
+ JBossToolsUsageActivator.getDefault().getLog().log(status);
+ }
+ return super.performOk();
+ }
+}
\ No newline at end of file
Property changes on:
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/preferences/UsageReportPreferencePage.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/preferences/UsageReportPreferences.java
===================================================================
---
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/preferences/UsageReportPreferences.java
(rev 0)
+++
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/preferences/UsageReportPreferences.java 2010-09-02
15:03:44 UTC (rev 24654)
@@ -0,0 +1,60 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.usage.preferences;
+
+import org.eclipse.core.runtime.preferences.IEclipsePreferences;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.jboss.tools.usage.internal.JBossToolsUsageActivator;
+import org.jboss.tools.usage.reporting.ReportingMessages;
+import org.jboss.tools.usage.util.PreferencesUtils;
+import org.jboss.tools.usage.util.StatusUtils;
+import org.osgi.service.prefs.BackingStoreException;
+
+public class UsageReportPreferences {
+
+ public static void setEnabled(boolean enabled) {
+ PreferencesUtils.getStore().putValue(
+ IUsageReportPreferenceConstants.USAGEREPORT_ENABLED_ID, String.valueOf(enabled));
+ }
+
+ public static boolean isEnabled() {
+ return PreferencesUtils.getPreferences().getBoolean(
+ IUsageReportPreferenceConstants.USAGEREPORT_ENABLED_ID,
+ IUsageReportPreferenceConstants.USAGEREPORT_ENABLED_DEFAULTVALUE);
+ }
+
+ public static boolean isAskUser() {
+ return PreferencesUtils.getPreferences().getBoolean(
+ IUsageReportPreferenceConstants.ASK_USER_USAGEREPORT_ID,
+ IUsageReportPreferenceConstants.ASK_USER_USAGEREPORT_DEFAULTVALUE);
+ }
+
+ public static void setAskUser(boolean askUser) {
+ try {
+ IEclipsePreferences preferences = PreferencesUtils.getPreferences();
+ preferences.putBoolean(IUsageReportPreferenceConstants.ASK_USER_USAGEREPORT_ID,
askUser);
+ preferences.flush();
+ } catch (BackingStoreException e) {
+ JBossToolsUsageActivator.getDefault().getLog().log(
+ StatusUtils.getErrorStatus(JBossToolsUsageActivator.PLUGIN_ID,
+ ReportingMessages.UsageReport_Error_SavePreferences, e,
+ IUsageReportPreferenceConstants.ASK_USER_USAGEREPORT_ID));
+ }
+ }
+
+ public static void flush() throws BackingStoreException {
+ PreferencesUtils.getPreferences().flush();
+ }
+
+ public static IPreferenceStore createPreferenceStore() {
+ return PreferencesUtils.getStore();
+ }
+}
Property changes on:
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/preferences/UsageReportPreferences.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/preferences/messages.properties
===================================================================
---
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/preferences/messages.properties
(rev 0)
+++
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/preferences/messages.properties 2010-09-02
15:03:44 UTC (rev 24654)
@@ -0,0 +1,3 @@
+UsageReportPreferencePage_Description=Preference page with options for anonymous usage
data reporting. Usage data is used for statistical matters only.
+UsageReportPreferencePage_AllowReporting=&Allow Red Hat Inc. to report usage
anonymously.
+UsageReportPreferencePage_Error_Saving=Could not save the preferences.
Property changes on:
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/preferences/messages.properties
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/reporting/EclipseEnvironment.java
===================================================================
---
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/reporting/EclipseEnvironment.java
(rev 0)
+++
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/reporting/EclipseEnvironment.java 2010-09-02
15:03:44 UTC (rev 24654)
@@ -0,0 +1,270 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.usage.reporting;
+
+import java.text.MessageFormat;
+import java.util.Random;
+
+import org.eclipse.core.runtime.IProduct;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.preferences.IEclipsePreferences;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.PlatformUI;
+import org.jboss.tools.usage.googleanalytics.AbstractGoogleAnalyticsParameters;
+import org.jboss.tools.usage.googleanalytics.IGoogleAnalyticsParameters;
+import org.jboss.tools.usage.internal.JBossToolsUsageActivator;
+import org.jboss.tools.usage.preferences.IUsageReportPreferenceConstants;
+import org.jboss.tools.usage.util.BundleUtils;
+import org.jboss.tools.usage.util.PreferencesUtils;
+import org.jboss.tools.usage.util.BundleUtils.IBundleEntryFilter;
+import org.osgi.framework.Bundle;
+
+/**
+ * @author Andre Dietisheim
+ */
+public class EclipseEnvironment extends AbstractGoogleAnalyticsParameters implements
IGoogleAnalyticsParameters {
+
+ private static final String USERAGENT_WIN = "{0}/{1} (Windows; U; Windows NT 6.1;
{2})"; //$NON-NLS-1$
+ private static final String USERAGENT_MAC = "{0}/{1} (Macintosh; U; Intel Mac OS X
10.5; {2})"; //$NON-NLS-1$
+ private static final String USERAGENT_LINUX = "{0}/{1} (X11; U; Linux i686;
{2})"; //$NON-NLS-1$
+ private static final char BUNDLE_GROUP_DELIMITER = '-';
+ private static final String JBOSS_TOOLS_BUNDLES_PREFIX =
"org\\.jboss\\.tools.+"; //$NON-NLS-1$
+ private static final String ECLIPSE_RUNTIME_BULDEID =
"org.eclipse.core.runtime"; //$NON-NLS-1$
+
+ private String screenResolution;
+ private String screenColorDepth;
+ private Random random;
+ private IEclipsePreferences preferences;
+ private String firstVisit;
+ private String lastVisit;
+ private String currentVisit;
+ private long visitCount;
+
+ public EclipseEnvironment(String accountName, String hostName, String referral,
IEclipsePreferences preferences) {
+ super(accountName, hostName, referral);
+ this.random = new Random();
+ this.preferences = preferences;
+ initScreenSettings();
+ initVisits();
+ }
+
+ protected void initScreenSettings() {
+ final Display display = getDisplay();
+ display.syncExec(new Runnable() {
+
+ public void run() {
+ screenColorDepth = display.getDepth() + SCREENCOLORDEPTH_POSTFIX;
+
+ Rectangle bounds = display.getBounds();
+ screenResolution = bounds.width + SCREERESOLUTION_DELIMITER + bounds.height;
+ }
+ });
+ }
+
+ private void initVisits() {
+ String currentTime = String.valueOf(System.currentTimeMillis());
+ this.currentVisit = currentTime;
+ this.firstVisit = preferences.get(IUsageReportPreferenceConstants.FIRST_VISIT, null);
+ if (firstVisit == null) {
+ this.firstVisit = currentTime;
+ preferences.put(IUsageReportPreferenceConstants.FIRST_VISIT, firstVisit);
+ }
+ lastVisit = preferences.get(IUsageReportPreferenceConstants.LAST_VISIT, currentTime);
+ visitCount = preferences.getLong(IUsageReportPreferenceConstants.VISIT_COUNT, 1);
+ }
+
+ public String getBrowserLanguage() {
+ String nl = getNL();
+ if (nl == null) {
+ return ""; //$NON-NLS-1$
+ }
+
+ int indexOf = nl.indexOf(JAVA_LOCALE_DELIMITER); //$NON-NLS-1$
+ if (indexOf <= 0) {
+ return nl;
+ }
+
+ StringBuilder builder = new StringBuilder();
+ builder.append(nl.substring(0, indexOf));
+ builder.append(BROWSER_LOCALE_DELIMITER);
+ builder.append(nl.substring(indexOf + 1));
+ return builder.toString();
+ }
+
+ protected String getNL() {
+ return Platform.getNL(); //$NON-NLS-1$
+ }
+
+ public String getScreenResolution() {
+ return screenResolution;
+ }
+
+ public String getScreenColorDepth() {
+ return screenColorDepth;
+ }
+
+ protected Display getDisplay() {
+ if (PlatformUI.isWorkbenchRunning()) {
+ return PlatformUI.getWorkbench().getDisplay();
+ }
+
+ Display display = Display.getCurrent();
+ if (display == null) {
+ display = Display.getDefault();
+ }
+ return display;
+ }
+
+ public String getUserAgent() {
+
+ String productId = getApplicationName();
+ String productVersion = getApplicationVersion();
+ String browserLanguage = getBrowserLanguage();
+
+ /**
+ * Google API for android: this.userAgent = String.format(
+ * "GoogleAnalytics/%s (Linux; U; Android %s; %s-%s; %s; Build/%s)" ,
+ * new Object[] { "1.0" , Build.VERSION.RELEASE ,
+ * (localLocale.getLanguage() != null) ?
+ * localLocale.getLanguage().toLowerCase() : "en" ,
+ * (localLocale.getCountry() != null) ?
+ * localLocale.getCountry().toLowerCase() : "" , Build.MODEL, Build.ID
+ * });
+ */
+
+ return MessageFormat.format(
+ getUserAgentPattern(getOS())
+ , productId
+ , productVersion
+ , browserLanguage
+ );
+ }
+
+ private String getUserAgentPattern(String os) {
+ String userAgentPattern = ""; //$NON-NLS-1$
+ /*
+ * TODO: implement architecture (i686, x86_64 etc.), Windows version, MacOS version
etc.
+ */
+ if (Platform.OS_LINUX.equals(os)) {
+ return USERAGENT_LINUX; //$NON-NLS-1$
+ } else if (Platform.OS_MACOSX.equals(os)) {
+ return USERAGENT_MAC; //$NON-NLS-1$
+ } else if (Platform.OS_WIN32.equals(os)) {
+ return USERAGENT_WIN; //$NON-NLS-1$
+ }
+ return userAgentPattern;
+ }
+
+ protected String getOS() {
+ return Platform.getOS();
+ }
+
+ protected String getApplicationName() {
+ return getApplicationBundle().getSymbolicName();
+ }
+
+ protected String getApplicationVersion() {
+ String fullVersion = getApplicationBundle().getVersion().toString();
+ int productVersionStart = fullVersion.lastIndexOf(VERSION_DELIMITER);
+ if (productVersionStart > 0) {
+ return fullVersion.substring(0, productVersionStart);
+ } else {
+ return fullVersion;
+ }
+ }
+
+ /**
+ * Returns the bundle that launched the application that this class runs in.
+ *
+ * @return the defining bundle
+ */
+ private Bundle getApplicationBundle() {
+ IProduct product = Platform.getProduct();
+ if (product != null) {
+ return product.getDefiningBundle();
+ } else {
+ return Platform.getBundle(ECLIPSE_RUNTIME_BULDEID);
+ }
+ }
+
+ public String getUserId() {
+ String userId = preferences.get(IUsageReportPreferenceConstants.ECLIPSE_INSTANCE_ID,
null);
+ if (userId == null) {
+ userId = createIdentifier();
+ preferences.put(IUsageReportPreferenceConstants.ECLIPSE_INSTANCE_ID, userId);
+ PreferencesUtils.checkedSavePreferences(preferences,
JBossToolsUsageActivator.getDefault(),
ReportingMessages.EclipseEnvironment_Error_SavePreferences);
+ }
+ return userId;
+ }
+
+ /**
+ * Creates an unique identifier.
+ *
+ * @return the identifier
+ */
+ private String createIdentifier() {
+ StringBuilder builder = new StringBuilder();
+ builder.append(Math.abs(random.nextLong()));
+ builder.append(System.currentTimeMillis());
+ return builder.toString();
+ }
+
+ public String getKeyword() {
+ JBossBundleGroups jbossBundleGroups = new JBossBundleGroups();
+ IBundleEntryFilter jbossToolsFilter = new
BundleUtils.BundleSymbolicNameFilter(JBOSS_TOOLS_BUNDLES_PREFIX);
+ IBundleEntryFilter compositeFilter = new BundleUtils.CompositeFilter(
+ jbossToolsFilter
+ , jbossBundleGroups);
+ BundleUtils.getBundles(compositeFilter, getBundles());
+
+ return bundleGroupsToKeywordString(jbossBundleGroups);
+ }
+
+ protected Bundle[] getBundles() {
+ return
JBossToolsUsageActivator.getDefault().getBundle().getBundleContext().getBundles();
+ }
+
+ private String bundleGroupsToKeywordString(JBossBundleGroups jbossBundleGroups) {
+ char delimiter = BUNDLE_GROUP_DELIMITER;
+ StringBuilder builder = new StringBuilder();
+ for (String bundleGroupId : jbossBundleGroups.getBundleGroupIds()) {
+ builder.append(bundleGroupId)
+ .append(delimiter);
+ }
+ return builder.toString();
+ }
+
+ public String getCurrentVisit() {
+ return currentVisit;
+ }
+
+ public String getFirstVisit() {
+ return firstVisit;
+ }
+
+ public String getLastVisit() {
+ return lastVisit;
+ }
+
+ public long getVisitCount() {
+ return visitCount;
+ }
+
+ public void visit() {
+ lastVisit = currentVisit;
+ preferences.put(IUsageReportPreferenceConstants.LAST_VISIT, lastVisit);
+ currentVisit = String.valueOf(System.currentTimeMillis());
+ visitCount++;
+ preferences.putLong(IUsageReportPreferenceConstants.VISIT_COUNT, visitCount);
+ PreferencesUtils.checkedSavePreferences(preferences,
JBossToolsUsageActivator.getDefault(),
ReportingMessages.EclipseEnvironment_Error_SavePreferences);
+ }
+}
Property changes on:
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/reporting/EclipseEnvironment.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/reporting/JBossBundleGroups.java
===================================================================
---
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/reporting/JBossBundleGroups.java
(rev 0)
+++
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/reporting/JBossBundleGroups.java 2010-09-02
15:03:44 UTC (rev 24654)
@@ -0,0 +1,223 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.usage.reporting;
+
+import java.util.Collection;
+import java.util.Set;
+import java.util.TreeSet;
+
+import org.jboss.tools.usage.util.BundleUtils.IBundleEntryFilter;
+import org.osgi.framework.Bundle;
+
+/**
+ * @author Andre Dietisheim
+ */
+public class JBossBundleGroups implements IBundleEntryFilter {
+
+ public enum BundleGroup {
+ ARCHIVES("org.jboss.ide.eclipse.archives.core",
+ "org.jboss.ide.eclipse.archives.jdt.integration",
+ "org.jboss.ide.eclipse.archives.ui"
+ )
+ , AS("org.jboss.ide.eclipse.archives.webtools",
+ "org.jboss.ide.eclipse.as.classpath.core",
+ "org.jboss.ide.eclipse.as.classpath.ui",
+ "org.jboss.ide.eclipse.as.core",
+ "org.jboss.ide.eclipse.as.doc.user",
+ "org.jboss.ide.eclipse.as.ssh",
+ "org.jboss.ide.eclipse.as.ui",
+ "org.jboss.ide.eclipse.as.ui.mbeans",
+ "org.jboss.ide.eclipse.as.wtp.core",
+ "org.jboss.ide.eclipse.as.wtp.ui")
+ , BIRT("org.jboss.tools.birt.core",
+ "org.jboss.tools.birt.oda",
+ "org.jboss.tools.birt.oda.ui")
+ , BPEL("org.eclipse.bpel.apache.ode.deploy.model",
+ "org.eclipse.bpel.apache.ode.deploy.ui",
+ "org.eclipse.bpel.common.model",
+ "org.eclipse.bpel.common.ui",
+ "org.eclipse.bpel.model",
+ "org.eclipse.bpel.ui",
+ "org.eclipse.bpel.validator",
+ "org.eclipse.bpel.wsil.model",
+ "org.eclipse.bpel.xpath10",
+ "org.jboss.tools.bpel.cheatsheet",
+ "org.jboss.tools.bpel.runtimes")
+ , CDI("org.jboss.tools.cdi.core",
+ "org.jboss.tools.cdi.text.ext",
+ "org.jboss.tools.cdi.ui",
+ "org.jboss.tools.cdi.xml",
+ "org.jboss.tools.cdi.xml.ui")
+ , DELTACLOUD("org.jboss.tools.deltacloud.core",
+ "org.jboss.tools.deltacloud.ui")
+ , DROOLS("org.drools.eclipse",
+ "org.drools.eclipse.task",
+ "org.eclipse.webdav",
+ "org.guvnor.tools",
+ "org.jboss.tools.flow.ruleflow")
+ , ESB("org.jboss.tools.esb.core",
+ "org.jboss.tools.esb.project.core",
+ "org.jboss.tools.esb.project.ui",
+ "org.jboss.tools.esb.ui",
+ "org.jboss.tools.esb.validator")
+ , FLOW("org.jboss.tools.flow.common")
+ , FREEMARKER("org.jboss.ide.eclipse.freemarker")
+ , GWT("org.jboss.tools.gwt.core",
+ "org.jboss.tools.gwt.ui")
+ , HIBERNATETOOLS("org.hibernate.eclipse",
+ "org.hibernate.eclipse.console",
+ "org.hibernate.eclipse.help",
+ "org.hibernate.eclipse.jdt.apt.ui",
+ "org.hibernate.eclipse.jdt.ui",
+ "org.hibernate.eclipse.mapper",
+ "org.jboss.tools.hibernate.jpt.core",
+ "org.jboss.tools.hibernate.jpt.ui",
+ "org.jboss.tools.hibernate.ui",
+ "org.jboss.tools.hibernate.xml",
+ "org.jboss.tools.hibernate.xml.ui")
+ , JBPM("org.jboss.tools.flow.jpdl4",
+ "org.jboss.tools.flow.jpdl4.multipage",
+ "org.jboss.tools.jbpm.common",
+ "org.jboss.tools.jbpm.convert",
+ "org.jbpm.gd.jpdl")
+ , JMX("org.jboss.tools.jmx.core",
+ "org.jboss.tools.jmx.ui")
+ , JSF("org.jboss.tools.jsf",
+ "org.jboss.tools.jsf.doc.user",
+ "org.jboss.tools.jsf.text.ext",
+ "org.jboss.tools.jsf.text.ext.facelets",
+ "org.jboss.tools.jsf.text.ext.richfaces",
+ "org.jboss.tools.jsf.ui",
+ "org.jboss.tools.jsf.verification",
+ "org.jboss.tools.jsf.vpe.ajax4jsf",
+ "org.jboss.tools.jsf.vpe.facelets",
+ "org.jboss.tools.jsf.vpe.jbpm",
+ "org.jboss.tools.jsf.vpe.jsf",
+ "org.jboss.tools.jsf.vpe.jstl",
+ "org.jboss.tools.jsf.vpe.myfaces",
+ "org.jboss.tools.jsf.vpe.richfaces",
+ "org.jboss.tools.jsf.vpe.seam")
+ , JST("org.jboss.tools.jst.css",
+ "org.jboss.tools.jst.firstrun",
+ "org.jboss.tools.jst.jsp",
+ "org.jboss.tools.jst.text.ext",
+ "org.jboss.tools.jst.web",
+ "org.jboss.tools.jst.web.kb",
+ "org.jboss.tools.jst.web.tiles",
+ "org.jboss.tools.jst.web.tiles.ui",
+ "org.jboss.tools.jst.web.ui",
+ "org.jboss.tools.jst.web.verification")
+ , LABS("org.jboss.tools.labs.pde.sourceprovider")
+ , MAVEN("org.jboss.tools.maven.cdi",
+ "org.jboss.tools.maven.core",
+ "org.jboss.tools.maven.hibernate",
+ "org.jboss.tools.maven.jsf",
+ "org.jboss.tools.maven.portlet",
+ "org.jboss.tools.maven.seam",
+ "org.jboss.tools.maven.ui")
+ , MODESHAPE("org.jboss.tools.modeshape.rest")
+ , PORTLET("org.jboss.tools.portlet.core",
+ "org.jboss.tools.portlet.ui")
+ , PROFILER("org.jboss.tools.profiler.ui")
+ , RUNTIME("org.jboss.tools.runtime")
+ , SEAM("org.jboss.tools.seam.core",
+ "org.jboss.tools.seam.doc.user",
+ "org.jboss.tools.seam.pages.xml",
+ "org.jboss.tools.seam.text.ext",
+ "org.jboss.tools.seam.ui",
+ "org.jboss.tools.seam.ui.pages",
+ "org.jboss.tools.seam.xml",
+ "org.jboss.tools.seam.xml.ui")
+ , SMOOKS("org.jboss.tools.smooks.core",
+ "org.jboss.tools.smooks.runtime",
+ "org.jboss.tools.smooks.templating",
+ "org.jboss.tools.smooks.ui")
+ , STRUTS("org.jboss.tools.struts",
+ "org.jboss.tools.struts.text.ext",
+ "org.jboss.tools.struts.ui",
+ "org.jboss.tools.struts.validator.ui",
+ "org.jboss.tools.struts.verification",
+ "org.jboss.tools.struts.vpe.struts")
+ , TPTP("org.jboss.tools.eclipse.as.tptp")
+ , VPE("org.jboss.tools.vpe",
+ "org.jboss.tools.vpe.docbook",
+ "org.jboss.tools.vpe.html",
+ "org.jboss.tools.vpe.jsp",
+ "org.jboss.tools.vpe.resref",
+ "org.jboss.tools.vpe.spring",
+ "org.jboss.tools.vpe.ui.palette",
+ "org.jboss.tools.vpe.xulrunner",
+ "org.jboss.tools.xulrunner",
+ "org.jboss.tools.xulrunner.initializer")
+ , WORKINGSET("org.jboss.tools.workingset.core",
+ "org.jboss.tools.workingset.ui")
+ , WS("rg.jboss.tools.ws.core",
+ "org.jboss.tools.ws.creation.core",
+ "org.jboss.tools.ws.creation.ui",
+ "org.jboss.tools.ws.ui")
+ , XULRUNNER("org.mozilla.xpcom",
+ "org.mozilla.xulrunner.carbon.macosx",
+ "org.mozilla.xulrunner.cocoa.macosx",
+ "org.mozilla.xulrunner.gtk.linux.x86",
+ "org.mozilla.xulrunner.gtk.linux.x86_64",
+ "org.mozilla.xulrunner.win32.win32.x86");
+
+ private String[] bundleNames;
+
+ BundleGroup(String... bundleNames) {
+ this.bundleNames = bundleNames;
+ }
+
+ /**
+ * Returns <tt>true</tt> if the given bundle name is a member of this
+ * bundle group.
+ *
+ * @param bundleName
+ * the bundle name to check whether it's a member of this
+ * group of bundles.
+ * @return <tt>true</tt>, if the given bundle
+ */
+ public boolean isMember(String bundleName) {
+ boolean isMember = false;
+ for (String name : bundleNames) {
+ if (name.equals(bundleName)) {
+ return true;
+ }
+ }
+ return isMember;
+ }
+
+ public void addGroupIdTo(Collection<String> bundleGroupIds) {
+ bundleGroupIds.add(name());
+ }
+ }
+
+ private Set<String> jbossBundleGroups = new TreeSet<String>();
+
+ /**
+ * Collects the bundle groups the bundles it gets belong
+ * to. Always returns <tt>true</tt> (does match) while collecting
+ */
+ public boolean matches(Bundle bundle) {
+ String bundleName = bundle.getSymbolicName();
+ for (BundleGroup bundleGroup : BundleGroup.values()) {
+ if (bundleGroup.isMember(bundleName)) {
+ jbossBundleGroups.add(bundleGroup.name());
+ break;
+ }
+ }
+ return true;
+ }
+
+ public Collection<String> getBundleGroupIds() {
+ return jbossBundleGroups;
+ }
+}
\ No newline at end of file
Property changes on:
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/reporting/JBossBundleGroups.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/reporting/ReportingMessages.java
===================================================================
---
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/reporting/ReportingMessages.java
(rev 0)
+++
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/reporting/ReportingMessages.java 2010-09-02
15:03:44 UTC (rev 24654)
@@ -0,0 +1,36 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.usage.reporting;
+
+import org.eclipse.osgi.util.NLS;
+
+public class ReportingMessages extends NLS {
+ private static final String BUNDLE_NAME =
"org.jboss.tools.usage.reporting.messages"; //$NON-NLS-1$
+ public static String EclipseEnvironment_Error_SavePreferences;
+
+ public static String UsageReport_Reporting_Usage;
+ public static String UsageReport_Querying_Enablement;
+ public static String UsageReport_Asking_User;
+ public static String UsageReport_Checkbox_Text;
+ public static String UsageReport_DialogMessage;
+ public static String UsageReport_DialogTitle;
+
+ public static String UsageReport_Error_SavePreferences;
+ public static String UsageReport_GoogleAnalyticsAccount;
+ public static String UsageReport_HostName;
+ static {
+ // initialize resource bundle
+ NLS.initializeMessages(BUNDLE_NAME, ReportingMessages.class);
+ }
+
+ private ReportingMessages() {
+ }
+}
Property changes on:
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/reporting/ReportingMessages.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/reporting/UsageReport.java
===================================================================
---
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/reporting/UsageReport.java
(rev 0)
+++
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/reporting/UsageReport.java 2010-09-02
15:03:44 UTC (rev 24654)
@@ -0,0 +1,177 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.usage.reporting;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.IJobChangeEvent;
+import org.eclipse.core.runtime.jobs.IJobChangeListener;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.jface.window.Window;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.progress.UIJob;
+import org.jboss.tools.usage.FocusPoint;
+import org.jboss.tools.usage.HttpGetRequest;
+import org.jboss.tools.usage.IHttpGetRequest;
+import org.jboss.tools.usage.ILoggingAdapter;
+import org.jboss.tools.usage.ITracker;
+import org.jboss.tools.usage.IURLBuildingStrategy;
+import org.jboss.tools.usage.PluginLogger;
+import org.jboss.tools.usage.Tracker;
+import org.jboss.tools.usage.googleanalytics.GoogleAnalyticsUrlStrategy;
+import org.jboss.tools.usage.googleanalytics.IGoogleAnalyticsParameters;
+import org.jboss.tools.usage.internal.JBossToolsUsageActivator;
+import org.jboss.tools.usage.preferences.GlobalUsageReportingSettings;
+import org.jboss.tools.usage.preferences.UsageReportPreferences;
+import org.jboss.tools.usage.util.PreferencesUtils;
+import org.jboss.tools.usage.util.StatusUtils;
+import org.osgi.service.prefs.BackingStoreException;
+
+/**
+ * @author Andre Dietisheim
+ */
+public class UsageReport {
+
+ private static final String GANALYTICS_ACCOUNTNAME =
ReportingMessages.UsageReport_GoogleAnalyticsAccount;
+
+ private static final String HOST_NAME = ReportingMessages.UsageReport_HostName;
+
+ private FocusPoint focusPoint = new FocusPoint("tools") //$NON-NLS-1$
+ .setChild(new FocusPoint("usage") //$NON-NLS-1$
+ .setChild(new FocusPoint("action") //$NON-NLS-1$
+ .setChild(new FocusPoint("wsstartup")))); //$NON-NLS-1$
+
+ private GlobalUsageReportingSettings globalSettings = new
GlobalUsageReportingSettings(JBossToolsUsageActivator
+ .getDefault());
+
+ public void report() {
+ new ReportingJob().schedule();
+ }
+
+ private void askUser() {
+ UsageReportEnablementDialog dialog = new UsageReportEnablementDialog(
+ true,
+ PlatformUI.getWorkbench().getActiveWorkbenchWindow());
+ if (dialog.open() == Window.OK) {
+ UsageReportPreferences.setEnabled(dialog.isReportEnabled());
+ UsageReportPreferences.setAskUser(false);
+ flushPreferences();
+ }
+ }
+
+ private void flushPreferences() {
+ try {
+ UsageReportPreferences.flush();
+ } catch (BackingStoreException e) {
+ IStatus status = StatusUtils.getErrorStatus(JBossToolsUsageActivator.PLUGIN_ID,
+ ReportingMessages.UsageReport_Error_SavePreferences, e);
+ JBossToolsUsageActivator.getDefault().getLog().log(status);
+ }
+ }
+
+ private void doReport() {
+ if (UsageReportPreferences.isEnabled()) {
+ getTracker().trackAsynchronously(focusPoint);
+ }
+ }
+
+ private ITracker getTracker() {
+ IGoogleAnalyticsParameters eclipseEnvironment = new EclipseEnvironment(
+ GANALYTICS_ACCOUNTNAME
+ , HOST_NAME
+ , IGoogleAnalyticsParameters.VALUE_NO_REFERRAL
+ , PreferencesUtils.getPreferences());
+ ILoggingAdapter loggingAdapter = new
PluginLogger(JBossToolsUsageActivator.getDefault());
+ IURLBuildingStrategy urlStrategy = new GoogleAnalyticsUrlStrategy(eclipseEnvironment);
+ IHttpGetRequest httpGetRequest = new HttpGetRequest(eclipseEnvironment.getUserAgent(),
loggingAdapter);
+ return new Tracker(urlStrategy, httpGetRequest, loggingAdapter);
+ }
+
+ private class ReportingJob extends Job {
+ private ReportingJob() {
+ super(ReportingMessages.UsageReport_Reporting_Usage);
+ }
+
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ if (monitor.isCanceled()) {
+ return Status.CANCEL_STATUS;
+ }
+ monitor.beginTask(ReportingMessages.UsageReport_Querying_Enablement, 2);
+ if (globalSettings.isEnabled()) {
+ if (monitor.isCanceled()) {
+ return Status.CANCEL_STATUS;
+ }
+ monitor.worked(1);
+ if (UsageReportPreferences.isAskUser()) {
+ if (monitor.isCanceled()) {
+ return Status.CANCEL_STATUS;
+ }
+ askUserAndReport();
+ } else {
+ if (monitor.isCanceled()) {
+ return Status.CANCEL_STATUS;
+ }
+ doReport();
+ }
+ monitor.worked(2);
+ monitor.done();
+ }
+ return Status.OK_STATUS;
+ }
+
+ private void askUserAndReport() {
+ Job askUserJob = new AskUserJob();
+ askUserJob.addJobChangeListener(new IJobChangeListener() {
+
+ public void sleeping(IJobChangeEvent event) {
+ // ignore
+ }
+
+ public void scheduled(IJobChangeEvent event) {
+ // ignore
+ }
+
+ public void running(IJobChangeEvent event) {
+ // ignore
+ }
+
+ public void done(IJobChangeEvent event) {
+ doReport();
+ }
+
+ public void awake(IJobChangeEvent event) {
+ // ignore
+ }
+
+ public void aboutToRun(IJobChangeEvent event) {
+ // ignore
+ }
+ });
+ askUserJob.setUser(true);
+ askUserJob.setPriority(Job.SHORT);
+ askUserJob.schedule();
+ }
+ }
+
+ private class AskUserJob extends UIJob {
+ private AskUserJob() {
+ super(ReportingMessages.UsageReport_Asking_User);
+ }
+
+ @Override
+ public IStatus runInUIThread(IProgressMonitor monitor) {
+ askUser();
+ return Status.OK_STATUS;
+ }
+ }
+}
Property changes on:
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/reporting/UsageReport.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/reporting/UsageReportDispatcher.java
===================================================================
---
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/reporting/UsageReportDispatcher.java
(rev 0)
+++
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/reporting/UsageReportDispatcher.java 2010-09-02
15:03:44 UTC (rev 24654)
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.usage.reporting;
+
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.IStartup;
+
+/**
+ * @author Andre Dieitsheim
+ */
+public class UsageReportDispatcher implements IStartup {
+
+ public void earlyStartup() {
+ Display.getDefault().asyncExec(new Runnable() {
+
+ public void run() {
+ new UsageReport().report();
+ }
+ });
+ }
+}
Property changes on:
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/reporting/UsageReportDispatcher.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/reporting/UsageReportEnablementDialog.java
===================================================================
---
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/reporting/UsageReportEnablementDialog.java
(rev 0)
+++
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/reporting/UsageReportEnablementDialog.java 2010-09-02
15:03:44 UTC (rev 24654)
@@ -0,0 +1,95 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.usage.reporting;
+
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.layout.GridDataFactory;
+import org.eclipse.jface.window.IShellProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Link;
+import org.eclipse.swt.widgets.Shell;
+import org.jboss.tools.usage.internal.JBossToolsUsageActivator;
+import org.jboss.tools.usage.util.BrowserUtil;
+
+/**
+ * @author Andre Dietisheim
+ */
+public class UsageReportEnablementDialog extends Dialog {
+
+ protected static final String USAGE_URL = "http://jboss.org/tools/usage"; //
$NON
+ private Button checkBox;
+ private boolean reportEnabled;
+
+ public UsageReportEnablementDialog(boolean reportEnabled, IShellProvider parentShell) {
+ super(parentShell);
+ this.reportEnabled = reportEnabled;
+ }
+
+ protected void buttonPressed(int buttonId) {
+ if (buttonId == IDialogConstants.OK_ID) {
+ this.reportEnabled = checkBox.getSelection();
+ } else if (buttonId == IDialogConstants.CANCEL_ID) {
+ this.reportEnabled = false;
+ }
+ super.buttonPressed(buttonId);
+ }
+
+ protected void configureShell(Shell shell) {
+ super.configureShell(shell);
+ shell.setText(ReportingMessages.UsageReport_DialogTitle);
+ }
+
+ protected void createButtonsForButtonBar(Composite parent) {
+ createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);
+ createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL,
false);
+ checkBox.setFocus();
+ checkBox.setSelection(reportEnabled);
+ }
+
+ protected Control createDialogArea(Composite parent) {
+ Composite composite = (Composite) super.createDialogArea(parent);
+
+ // message
+ Link link = new Link(composite, SWT.WRAP);
+ link.setFont(parent.getFont());
+ link.setText(ReportingMessages.UsageReport_DialogMessage);
+ link.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ BrowserUtil.checkedCreateExternalBrowser(USAGE_URL,
JBossToolsUsageActivator.PLUGIN_ID, JBossToolsUsageActivator.getDefault().getLog());
+ }
+ });
+ GridDataFactory.fillDefaults()
+ .align(SWT.FILL, SWT.CENTER)
+ .grab(true, false)
+ .hint(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH, SWT.DEFAULT)
+ .applyTo(link);
+
+ // checkbox
+ checkBox = new Button(composite, SWT.CHECK);
+ checkBox.setText(ReportingMessages.UsageReport_Checkbox_Text);
+ GridDataFactory.fillDefaults().grab(true, false).align(SWT.LEFT,
SWT.CENTER).applyTo(checkBox);
+
+ applyDialogFont(composite);
+
+ return composite;
+ }
+
+ public boolean isReportEnabled() {
+ return reportEnabled;
+ }
+}
Property changes on:
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/reporting/UsageReportEnablementDialog.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/reporting/messages.properties
===================================================================
---
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/reporting/messages.properties
(rev 0)
+++
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/reporting/messages.properties 2010-09-02
15:03:44 UTC (rev 24654)
@@ -0,0 +1,10 @@
+EclipseEnvironment_Error_SavePreferences=Could not sage {0} to preferences.
+UsageReport_Reporting_Usage=Reporting JBoss Tools usage
+UsageReport_Querying_Enablement=Querying whether reporting is globally enabled
+UsageReport_Asking_User=Asking User to allow reporting
+UsageReport_Checkbox_Text=Report usage of JBoss Tools to JBoss Tools team.
+UsageReport_DialogMessage=Please allow the JBoss Tools team to receive anonymous usage
statistics for this Eclipse installation with JBoss tools (<a>info</a>).
+UsageReport_DialogTitle=JBoss Tools Usage
+UsageReport_Error_SavePreferences=Could not save preferences {0}
+UsageReport_GoogleAnalyticsAccount=UA-17645367-1
+UsageReport_HostName=jboss.org
Property changes on:
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/reporting/messages.properties
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/util/BrowserUtil.java
===================================================================
---
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/util/BrowserUtil.java
(rev 0)
+++
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/util/BrowserUtil.java 2010-09-02
15:03:44 UTC (rev 24654)
@@ -0,0 +1,71 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.usage.util;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+
+import org.eclipse.core.runtime.ILog;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.browser.IWebBrowser;
+
+public class BrowserUtil {
+
+ /**
+ * Opens a browser for the given url with the given id. If an error occurs
+ * it will be reported to the given log provider with the given plugin id.
+ *
+ * @param url
+ * the url to open a browser for.
+ * @param browserId
+ * the id for the new browser.
+ * @param pluginId
+ * the plugin id to log for.
+ * @param log
+ * the log provider to log against if an error occurred.
+ */
+ public static void checkedCreateInternalBrowser(String url, String browserId, String
pluginId, ILog log) {
+ try {
+ openUrl(url, PlatformUI.getWorkbench().getBrowserSupport().createBrowser(browserId),
pluginId, log);
+ } catch (PartInitException e) {
+ IStatus errorStatus = StatusUtils.getErrorStatus(pluginId, "Could not open
browser for url \"{0}\".", e,
+ url);
+ log.log(errorStatus);
+ }
+ }
+
+
+ public static void checkedCreateExternalBrowser(String url, String pluginId, ILog log)
{
+ try {
+ openUrl(url, PlatformUI.getWorkbench().getBrowserSupport().getExternalBrowser(),
pluginId, log);
+ } catch (PartInitException e) {
+ IStatus errorStatus = StatusUtils.getErrorStatus(pluginId, "Could not open
browser for url \"{0}\".", e,
+ url);
+ log.log(errorStatus);
+ }
+ }
+
+ public static void openUrl(String url, IWebBrowser browser, String pluginId, ILog log)
{
+ try {
+ browser.openURL(new URL(url));
+ } catch (PartInitException e) {
+ IStatus errorStatus = StatusUtils.getErrorStatus(pluginId, "Could not open
browser for url \"{0}\".", e,
+ url);
+ log.log(errorStatus);
+ } catch (MalformedURLException e) {
+ IStatus errorStatus = StatusUtils.getErrorStatus(pluginId, "Could not display
malformed url \"{0}\".", e,
+ url);
+ log.log(errorStatus);
+ }
+ }
+}
Property changes on:
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/util/BrowserUtil.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/util/BundleUtils.java
===================================================================
---
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/util/BundleUtils.java
(rev 0)
+++
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/util/BundleUtils.java 2010-09-02
15:03:44 UTC (rev 24654)
@@ -0,0 +1,118 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.usage.util;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.regex.Pattern;
+
+import org.eclipse.core.runtime.Assert;
+import org.osgi.framework.Bundle;
+
+/**
+ * @author Andre Dietisheim
+ */
+public class BundleUtils {
+
+ /**
+ * Returns the bundles among the available ones that match the given filter.
+ *
+ * @param filter the filter to match the available bundles against
+ * @param bundles the bundles
+ * @return the bundles that match the given filter
+ */
+ public static List<Bundle> getBundles(IBundleEntryFilter filter, Bundle[] bundles)
{
+ List<Bundle> bundleList = new ArrayList<Bundle>();
+ for (Bundle bundle : bundles) {
+ if (filter.matches(bundle)) {
+ bundleList.add(bundle);
+ }
+ }
+ return bundleList;
+ }
+
+ /**
+ * Returns the bundles that have a symbolic name that match the given regex.
+ *
+ * @param bundleSymbolicNameRegex the symbolic name regex to match.
+ * @param bundles the bundles
+ * @return the bundles
+ */
+ public static List<Bundle> getBundles(String bundleSymbolicNameRegex, Bundle[]
bundles) {
+ return getBundles(new BundleSymbolicNameFilter(bundleSymbolicNameRegex), bundles);
+ }
+
+ /**
+ * A filter that matches bundles against a given symbolic name regex.
+ */
+ public static class BundleSymbolicNameFilter implements IBundleEntryFilter {
+
+ private Pattern pattern;
+
+ public BundleSymbolicNameFilter(String symbolicNameRegex) {
+ this.pattern = Pattern.compile(symbolicNameRegex);
+ }
+
+ public boolean matches(Bundle bundle) {
+ Assert.isTrue(bundle != null);
+
+ return pattern.matcher(bundle.getSymbolicName()).matches();
+ }
+
+ }
+
+ /**
+ * A filter that applies several given filters
+ */
+ public static class CompositeFilter implements IBundleEntryFilter {
+
+ private IBundleEntryFilter filters[];
+
+ /**
+ * Instantiates a new composite filter that applies several given
+ * filters.
+ *
+ * @param filters
+ * the filters
+ */
+ public CompositeFilter(IBundleEntryFilter... filters) {
+ this.filters = filters;
+ }
+
+ /**
+ * Applies the filters this composite filter has. All filters have to
+ * match so that the filter says the given bundle matches.
+ */
+ public boolean matches(Bundle bundle) {
+ for (IBundleEntryFilter filter : filters) {
+ if (!filter.matches(bundle)) {
+ return false;
+ }
+ }
+ return true;
+ }
+ }
+
+ /**
+ * The Interface IBundleEntryFilter.
+ */
+ public static interface IBundleEntryFilter {
+
+ /**
+ * Matches.
+ *
+ * @param bundle
+ * the bundle
+ * @return true, if successful
+ */
+ public boolean matches(Bundle bundle);
+ }
+}
Property changes on:
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/util/BundleUtils.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/util/HttpEncodingUtils.java
===================================================================
---
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/util/HttpEncodingUtils.java
(rev 0)
+++
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/util/HttpEncodingUtils.java 2010-09-02
15:03:44 UTC (rev 24654)
@@ -0,0 +1,61 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.usage.util;
+
+import java.io.UnsupportedEncodingException;
+import java.net.URLEncoder;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+/**
+ * @author Andre Dietisheim
+ */
+public class HttpEncodingUtils {
+
+ private static final String ENCODING_UTF8 = "UTF-8";
+
+ private static Pattern CHARSET_ENCODING_PATTERN =
Pattern.compile("charset=(.+)");
+
+ /**
+ * Encodes the given string in utf8 while catching exceptions that may
+ * occur. If an encoding exception occurs, <tt>null</tt> is returned
+ *
+ * @param aString
+ * the a string to be encoded
+ * @return the encoded string or <tt>null</tt> if an error occured while
+ * encoding
+ */
+ public static String checkedEncodeUtf8(String aString) {
+ try {
+ return URLEncoder.encode(aString, ENCODING_UTF8);
+ } catch (UnsupportedEncodingException e) {
+ return aString;
+ }
+ }
+
+ /**
+ * Returns the charset indicated in the content-type field of the http
+ * header. Returns <tt>null</tt> if none is indicated.
+ *
+ * @param contentType
+ * the content type
+ * @return the content type charset or <tt>null</tt>
+ */
+ public static String getContentTypeCharset(String contentType) {
+ Matcher matcher = CHARSET_ENCODING_PATTERN.matcher(contentType);
+ if (!matcher.find()) {
+ return null;
+ }
+
+ return matcher.group(1);
+ }
+
+}
Property changes on:
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/util/HttpEncodingUtils.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/util/PreferencesUtils.java
===================================================================
---
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/util/PreferencesUtils.java
(rev 0)
+++
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/util/PreferencesUtils.java 2010-09-02
15:03:44 UTC (rev 24654)
@@ -0,0 +1,48 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.usage.util;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Plugin;
+import org.eclipse.core.runtime.preferences.ConfigurationScope;
+import org.eclipse.core.runtime.preferences.IEclipsePreferences;
+import org.eclipse.jface.preference.IPersistentPreferenceStore;
+import org.eclipse.ui.preferences.ScopedPreferenceStore;
+import org.jboss.tools.usage.internal.JBossToolsUsageActivator;
+import org.jboss.tools.usage.reporting.ReportingMessages;
+import org.osgi.service.prefs.BackingStoreException;
+
+public class PreferencesUtils {
+
+ private PreferencesUtils() {
+ // inhibit instantiation
+ }
+
+ public static IEclipsePreferences getPreferences() {
+ return new ConfigurationScope().getNode(JBossToolsUsageActivator.PLUGIN_ID);
+ }
+
+ public static IPersistentPreferenceStore getStore() {
+ return new ScopedPreferenceStore(new ConfigurationScope(),
JBossToolsUsageActivator.PLUGIN_ID);
+ }
+
+ public static void checkedSavePreferences(IEclipsePreferences preferences, Plugin
plugin, String message) {
+ try {
+ preferences.flush();
+ } catch (BackingStoreException e) {
+ IStatus status = StatusUtils.getErrorStatus(plugin.getBundle().getSymbolicName(),
+ ReportingMessages.EclipseEnvironment_Error_SavePreferences,
+ e, message);
+ plugin.getLog().log(status);
+ }
+
+ }
+}
Property changes on:
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/util/PreferencesUtils.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/util/StatusUtils.java
===================================================================
---
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/util/StatusUtils.java
(rev 0)
+++
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/util/StatusUtils.java 2010-09-02
15:03:44 UTC (rev 24654)
@@ -0,0 +1,84 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.usage.util;
+
+import java.text.MessageFormat;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+
+/**
+ * @author Andre Dietisheim
+ */
+public class StatusUtils {
+
+ private StatusUtils() {
+ // inhibit instantiation
+ }
+
+ /**
+ * Returns an error status for a given plugin id, message and arguments.
+ *
+ * @param pluginId
+ * the plugin id
+ * @param message
+ * the message
+ * @param throwable
+ * the throwable
+ * @param messageArguments
+ * the message arguments
+ * @return the error status
+ */
+ public static IStatus getErrorStatus(String pluginId, String message, Throwable
throwable,
+ Object... messageArguments) {
+ String formattedMessage = null;
+ if (message != null) {
+ formattedMessage = MessageFormat.format(message, messageArguments);
+ }
+ return new Status(Status.ERROR, pluginId, Status.ERROR, formattedMessage,
+ throwable);
+ }
+
+ /**
+ * Returns an debug status for a given plugin id, message and arguments.
+ *
+ * @param pluginId
+ * the plugin id
+ * @param message
+ * the message
+ * @param messageArguments
+ * the message arguments
+ *
+ * @return the debug status
+ */
+ public static IStatus getDebugStatus(String pluginId, String message, Object...
messageArguments) {
+ return new Status(Status.INFO, pluginId, Status.INFO, MessageFormat.format(message,
messageArguments), null);
+ }
+
+ /**
+ * Clones a given status.
+ *
+ * @param status
+ * the status
+ *
+ * @return the i status
+ */
+ public static IStatus clone(IStatus status) {
+ switch (status.getSeverity()) {
+ case IStatus.INFO:
+ return getDebugStatus(status.getPlugin(), status.getMessage());
+ case IStatus.ERROR:
+ return getErrorStatus(status.getPlugin(), status.getMessage(),
status.getException());
+ default:
+ throw new UnsupportedOperationException("noy implemented yet!");
+ }
+ }
+}
Property changes on:
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/util/StatusUtils.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/util/reader/AppendUntilAlternativeImpl.java
===================================================================
---
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/util/reader/AppendUntilAlternativeImpl.java
(rev 0)
+++
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/util/reader/AppendUntilAlternativeImpl.java 2010-09-02
15:03:44 UTC (rev 24654)
@@ -0,0 +1,47 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.usage.util.reader;
+
+import java.io.IOException;
+import java.io.Reader;
+import java.io.Writer;
+
+/**
+ * @author Andre Dietisheim
+ */
+public class AppendUntilAlternativeImpl extends ReadUntilAlternativesImpl {
+
+ private Writer writer;
+ private int numOfWrittenCharacters;
+
+ public AppendUntilAlternativeImpl(Reader reader, Writer writer, String... alternatives)
{
+ super(reader, alternatives);
+ this.writer = writer;
+ }
+
+ @Override
+ protected boolean doContinueRead(char character, int numberOfCharactersRead) throws
IOException {
+ if (super.doContinueRead(character, numberOfCharactersRead)) {
+ if (!isMatching()) {
+ // don't append matching characters
+ writer.write(character);
+ numOfWrittenCharacters++;
+ }
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ public int getNumOfWrittenCharacters() {
+ return numOfWrittenCharacters;
+ }
+}
\ No newline at end of file
Property changes on:
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/util/reader/AppendUntilAlternativeImpl.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/util/reader/AppendUntilImpl.java
===================================================================
---
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/util/reader/AppendUntilImpl.java
(rev 0)
+++
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/util/reader/AppendUntilImpl.java 2010-09-02
15:03:44 UTC (rev 24654)
@@ -0,0 +1,48 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+package org.jboss.tools.usage.util.reader;
+
+import java.io.IOException;
+import java.io.Reader;
+import java.io.Writer;
+
+/**
+ * @author Andre Dietisheim
+ */
+public class AppendUntilImpl extends ReadUntilImpl {
+
+ private Writer writer;
+ private int numOfWrittenCharacters;
+
+ public AppendUntilImpl(Reader reader, Writer writer, char... character) {
+ super(reader, character);
+ this.writer = writer;
+ }
+
+ @Override
+ protected boolean doContinueRead(char character, int numberOfCharactersRead) throws
IOException {
+ if (super.doContinueRead(character, numberOfCharactersRead)) {
+ if (!isMatching()) {
+ // don't append matching characters
+ writer.write(character);
+ numOfWrittenCharacters++;
+ }
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ public int getNumOfWrittenCharacters() {
+ return numOfWrittenCharacters;
+ }
+}
\ No newline at end of file
Property changes on:
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/util/reader/AppendUntilImpl.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/util/reader/ReadUntilAlternativesImpl.java
===================================================================
---
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/util/reader/ReadUntilAlternativesImpl.java
(rev 0)
+++
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/util/reader/ReadUntilAlternativesImpl.java 2010-09-02
15:03:44 UTC (rev 24654)
@@ -0,0 +1,116 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.usage.util.reader;
+
+import java.io.Reader;
+
+/**
+ * @author Andre Dietisheim
+ */
+public class ReadUntilAlternativesImpl extends ReadUntilImpl {
+
+ private char[][] allAlternatives;
+ private char[] currentAlternative;
+ private int alternativesIndex = -1;
+
+ public ReadUntilAlternativesImpl(Reader reader, String... stringAlternatives) {
+ super(reader);
+ initAlternativesCharSequences(stringAlternatives);
+ }
+
+ private void initAlternativesCharSequences(String... stringAlternatives) {
+ this.allAlternatives = new char[stringAlternatives.length][];
+ for (int i = 0; i < stringAlternatives.length; i++) {
+ this.allAlternatives[i] = stringAlternatives[i].toCharArray();
+ }
+ }
+
+ @Override
+ protected int getNumberOfCharactersToMatch() {
+ if (currentAlternative != null) {
+ return currentAlternative.length;
+ } else {
+ return 0;
+ }
+ }
+
+ @Override
+ protected boolean doesMatch(char character) {
+ if (currentAlternative == null || currentAlternative[getMatchingIndex()] != character)
{
+ // current alternative does not match new character, select a new
+ // alternative
+ boolean newAlternativeSelected = matchAlternative(character);
+ if (!newAlternativeSelected) {
+ // no alternative matches current character + new one
+ setMatchingIndex(0);
+ }
+ return newAlternativeSelected;
+ } else {
+ return true;
+ }
+ }
+
+ /**
+ * Returns whether the given character matches an alternative (in other
+ * words the given character matches an alternative at the current matching
+ * index).
+ *
+ * @param character
+ * the character
+ * @return true, if successful
+ */
+ private boolean matchAlternative(char character) {
+ for (int i = alternativesIndex + 1; i < allAlternatives.length; i++) {
+ char[] alternative = allAlternatives[i];
+ if (doesMatch(character, alternative)) {
+ this.currentAlternative = alternative;
+ this.alternativesIndex = i;
+ return true;
+ }
+
+ }
+ this.currentAlternative = null;
+ this.alternativesIndex = -1;
+ return false;
+ }
+
+ /**
+ * Returns whether the given potentially matching alternative (String)
+ * matches the currently selected alternative and the additional character.
+ *
+ * @param character
+ * @param potentiallyMatchingAlternative
+ * the new alternative that could match
+ * @return
+ */
+ private boolean doesMatch(char character, char[] potentiallyMatchingAlternative) {
+ int currentMatchingIndex = getMatchingIndex();
+ for (int j = 0; j < currentMatchingIndex; j++) {
+ if (potentiallyMatchingAlternative[j] != currentAlternative[j]) {
+ return false;
+ }
+ }
+ return potentiallyMatchingAlternative[currentMatchingIndex] == character;
+ }
+
+ @Override
+ protected char[] getCharactersToMatch() {
+ return currentAlternative;
+ }
+
+ public String getAlternative() {
+ if (alternativesIndex >= 0) {
+ return new String(allAlternatives[alternativesIndex]);
+ } else {
+ return null;
+ }
+ }
+}
\ No newline at end of file
Property changes on:
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/util/reader/ReadUntilAlternativesImpl.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/util/reader/ReadUntilImpl.java
===================================================================
---
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/util/reader/ReadUntilImpl.java
(rev 0)
+++
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/util/reader/ReadUntilImpl.java 2010-09-02
15:03:44 UTC (rev 24654)
@@ -0,0 +1,97 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.usage.util.reader;
+
+import java.io.IOException;
+import java.io.Reader;
+
+/**
+ * @author Andre Dietisheim
+ */
+public class ReadUntilImpl implements ReaderVisitor {
+
+ /** returned by a stream if the end of the stream is reached. */
+ private static final char EOS = (char) -1;
+
+ private Reader reader;
+ private boolean matched = false;
+ private int numberOfCharactersRead;
+ private char[] characters;
+ private int matchingCharactersIndex = 0;
+
+ public ReadUntilImpl(Reader reader, char... characters) {
+ this.reader = reader;
+ this.numberOfCharactersRead = 0;
+ this.characters = characters;
+ }
+
+ public final boolean continueRead(char character, int numberOfCharactersRead) throws
IOException {
+ this.numberOfCharactersRead = numberOfCharactersRead;
+ return doContinueRead(character, numberOfCharactersRead);
+ }
+
+ protected boolean doContinueRead(char character, int numberOfCharactersRead) throws
IOException {
+ boolean continueRead = false;
+ boolean matches = doesMatch(character);
+ if (!matches) {
+ continueRead = !matches;
+ } else {
+ int matchingIndex = getMatchingIndex() + 1;
+ setMatchingIndex(matchingIndex);
+ continueRead = matches
+ && matchingIndex < getNumberOfCharactersToMatch();
+ }
+
+ setMatches(matches);
+ return continueRead;
+ }
+
+ public boolean isMatching() {
+ return matched;
+ }
+
+ public int getNumberOfCharactersRead() {
+ return this.numberOfCharactersRead;
+ }
+
+ public void read() throws IOException {
+ char character = 0;
+ while ((character = (char) reader.read()) != EOS) {
+ if (!continueRead(character, ++numberOfCharactersRead)) {
+ return;
+ }
+ }
+ }
+
+ protected void setMatchingIndex(int index) {
+ this.matchingCharactersIndex = index;
+ }
+
+ protected int getMatchingIndex() {
+ return matchingCharactersIndex;
+ }
+
+ protected boolean doesMatch(char character) {
+ return characters[matchingCharactersIndex] == character;
+ }
+
+ protected int getNumberOfCharactersToMatch() {
+ return characters.length;
+ }
+
+ protected char[] getCharactersToMatch() {
+ return characters;
+ }
+
+ protected void setMatches(boolean matches) {
+ matched = matches;
+ }
+}
\ No newline at end of file
Property changes on:
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/util/reader/ReadUntilImpl.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/util/reader/ReaderUtils.java
===================================================================
---
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/util/reader/ReaderUtils.java
(rev 0)
+++
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/util/reader/ReaderUtils.java 2010-09-02
15:03:44 UTC (rev 24654)
@@ -0,0 +1,96 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.usage.util.reader;
+
+import java.io.CharArrayWriter;
+import java.io.IOException;
+import java.io.Reader;
+import java.io.Writer;
+
+/**
+ * @author Andre Dietisheim
+ */
+public class ReaderUtils {
+
+ /**
+ * Reads from the given input stream until a signal is found. The signal
+ * itself is not appended to the string that is returned.
+ * <p>
+ * This method does not read any further as the maximum number of bytes
+ * given and the end of the stream is reached. If the signal's not found
+ * <tt>null</tt> is returned.
+ *
+ * @param signal
+ * the signal
+ * @param maxRead
+ * the max number of bytes to read
+ * @param reader
+ * the reader
+ * @return the string that holds the bytes read
+ * @throws Exception
+ */
+ public static String readStringUntil(Reader reader, char... signal) throws IOException
{
+ Writer writer = new CharArrayWriter();
+ AppendUntilImpl visitor = new AppendUntilImpl(reader, writer, signal);
+ try {
+ visitor.read();
+ if (!visitor.isMatching()
+ || visitor.getNumOfWrittenCharacters() == 0) {
+ return null;
+ }
+ writer.flush();
+ return writer.toString();
+ } finally {
+ writer.close();
+ }
+ }
+
+ public static String readStringUntil(Reader reader, String signal) throws IOException {
+ return readStringUntil(reader, signal.toCharArray());
+ }
+
+ public static String readStringUntil(Reader reader, String... alternatives) throws
IOException {
+ Writer writer = new CharArrayWriter();
+ AppendUntilAlternativeImpl visitor = new AppendUntilAlternativeImpl(reader, writer,
alternatives);
+ try {
+ visitor.read();
+ if (!visitor.isMatching()
+ || visitor.getNumOfWrittenCharacters() == 0) {
+ return null;
+ }
+ writer.flush();
+ return writer.toString();
+ } finally {
+ writer.close();
+ }
+ }
+
+ /**
+ * Skips the characters in the given reader until one of the given
+ * alternatives is found.
+ *
+ * @param maxRead
+ * the max number of characters to read
+ * @param reader
+ * the reader to read from
+ * @param alternatives
+ * the strings to find (alternatively) in the reader
+ * @return the index of the alternative that was found or <tt>-1</tt> if
+ * none was found
+ * @throws IOException
+ * Signals that an I/O exception has occurred.
+ */
+ public static String skipUntil(Reader reader, String... alternatives) throws IOException
{
+ ReadUntilAlternativesImpl visitor = new ReadUntilAlternativesImpl(reader,
alternatives);
+ visitor.read();
+ return visitor.getAlternative();
+ }
+}
Property changes on:
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/util/reader/ReaderUtils.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/util/reader/ReaderVisitor.java
===================================================================
---
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/util/reader/ReaderVisitor.java
(rev 0)
+++
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/util/reader/ReaderVisitor.java 2010-09-02
15:03:44 UTC (rev 24654)
@@ -0,0 +1,19 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.usage.util.reader;
+
+/**
+ * @author Andre Dietisheim
+ */
+public interface ReaderVisitor {
+ public boolean continueRead(char character, int numberOfCharactersRead) throws
Exception;
+ public int getNumberOfCharactersRead();
+}
Property changes on:
branches/jbosstools-3.2.0.M2/usage/plugins/src/org/jboss/tools/usage/util/reader/ReaderVisitor.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain