moved additional email body text into default config provider
diff --git a/org.eclipse.emf.emfstore.client.ui.errorreporting/src/org/eclipse/emf/emfstore/client/ui/errorreporting/DefaultMailBugConfigurationProvider.java b/org.eclipse.emf.emfstore.client.ui.errorreporting/src/org/eclipse/emf/emfstore/client/ui/errorreporting/DefaultMailBugConfigurationProvider.java
index 8486608..71954ce 100644
--- a/org.eclipse.emf.emfstore.client.ui.errorreporting/src/org/eclipse/emf/emfstore/client/ui/errorreporting/DefaultMailBugConfigurationProvider.java
+++ b/org.eclipse.emf.emfstore.client.ui.errorreporting/src/org/eclipse/emf/emfstore/client/ui/errorreporting/DefaultMailBugConfigurationProvider.java
@@ -10,6 +10,11 @@
******************************************************************************/
package org.eclipse.emf.emfstore.client.ui.errorreporting;
+import java.io.UnsupportedEncodingException;
+import java.net.URLEncoder;
+
+import org.eclipse.emf.emfstore.common.CommonUtil;
+
/**
* Error reporting configuration provider with default values.<br/>
* Only the E-Mail address must be configured.
@@ -18,19 +23,42 @@
*
*/
public abstract class DefaultMailBugConfigurationProvider implements IMailBugConfigurationProvider {
+
+ private static final String EMAIL_BODY = "Thank you for reporting this bug. Please help us to fix the problem by following these steps:\n\n"
+ + "1. Give a summary\n"
+ + "<Description>\n\n"
+ + "2. Describe steps to reproduce the error\n"
+ + "\t1. <Step 1>\n"
+ + "\t2. <Step 2>\n\n";
+
+
+ private static final String EMAIL_BODY_ADDITIONAL_TEXT =
+ "3. Paste (Ctrl+v) the content of the clipboard below (parts of the log file have been copied to it)\n"
+ + "\t<Content from Log File>";
/**
* {@inheritDoc}
*/
public String getEmailSubject() {
- return ErrorReportingPreferences.EMAIL_SUBJECT_DEFAULT;
+ return "EMFStore Error Report";
}
/**
* {@inheritDoc}
*/
- public String getEmailBody() {
- return ErrorReportingPreferences.EMAIL_BODY_DEFAULT;
+ public String getEmailBody(boolean errorDiagnosisCaptured) {
+
+ StringBuffer body = new StringBuffer(EMAIL_BODY);
+
+ if (errorDiagnosisCaptured) {
+ try {
+ body.append(URLEncoder.encode(EMAIL_BODY_ADDITIONAL_TEXT, CommonUtil.getEncoding()));
+ } catch (UnsupportedEncodingException e) {
+ // ignore
+ }
+ }
+
+ return body.toString();
}
}
diff --git a/org.eclipse.emf.emfstore.client.ui.errorreporting/src/org/eclipse/emf/emfstore/client/ui/errorreporting/ErrorReportingPreferences.java b/org.eclipse.emf.emfstore.client.ui.errorreporting/src/org/eclipse/emf/emfstore/client/ui/errorreporting/ErrorReportingPreferences.java
index d30a3f7..6deab48 100644
--- a/org.eclipse.emf.emfstore.client.ui.errorreporting/src/org/eclipse/emf/emfstore/client/ui/errorreporting/ErrorReportingPreferences.java
+++ b/org.eclipse.emf.emfstore.client.ui.errorreporting/src/org/eclipse/emf/emfstore/client/ui/errorreporting/ErrorReportingPreferences.java
@@ -43,41 +43,4 @@
public static final String ZIP_PATH_DEFAULT = StringUtils.join(
Arrays.asList(System.getProperty("user.home"), "Desktop"),
File.separatorChar);
-
- /**
- * Preference key for the E-Mail address.
- */
- public static final String EMAIL_ADDRESS_KEY = "email";
-
- /**
- * Preference key for the E-Mail subject.
- */
- public static final String EMAIL_SUBJECT_KEY = "subject";
-
- /**
- * Default value for the E-Mail subject.
- */
- public static final String EMAIL_SUBJECT_DEFAULT = "EMFStore Error Report";
-
- /**
- * Preference key for the E-Mail body.
- */
- public static final String EMAIL_BODY_KEY = "body";
-
- /**
- * Default value for the E-Mail body.
- */
- public static final String EMAIL_BODY_DEFAULT = "Thank you for reporting this bug. Please help us to fix the problem by following these steps:\n\n"
- + "1. Give a summary\n"
- + "<Description>\n\n"
- + "2. Describe steps to reproduce the error\n"
- + "\t1. <Step 1>\n"
- + "\t2. <Step 2>\n\n";
-
- /**
- * Additional text for the E-Mail body in case the clipboard contains the current log.
- */
- public static final String EMAIL_BODY_ADDITIONAL_TEXT =
- "3. Paste (Ctrl+v) the content of the clipboard below (parts of the log file have been copied to it)\n"
- + "\t<Content from Log File>";
}
diff --git a/org.eclipse.emf.emfstore.client.ui.errorreporting/src/org/eclipse/emf/emfstore/client/ui/errorreporting/IMailBugConfigurationProvider.java b/org.eclipse.emf.emfstore.client.ui.errorreporting/src/org/eclipse/emf/emfstore/client/ui/errorreporting/IMailBugConfigurationProvider.java
index 9c6af2c..0fe2ca7 100644
--- a/org.eclipse.emf.emfstore.client.ui.errorreporting/src/org/eclipse/emf/emfstore/client/ui/errorreporting/IMailBugConfigurationProvider.java
+++ b/org.eclipse.emf.emfstore.client.ui.errorreporting/src/org/eclipse/emf/emfstore/client/ui/errorreporting/IMailBugConfigurationProvider.java
@@ -35,8 +35,11 @@
/**
* Returns the E-Mail body text used within the error reporting feature.
*
+ * @param errorDiagnosisCaptured
+ * whether error diagnosis information has been captured
+ *
* @return the E-Mail message body
*/
- String getEmailBody();
+ String getEmailBody(boolean errorDiagnosisCaptured);
}
diff --git a/org.eclipse.emf.emfstore.client.ui.errorreporting/src/org/eclipse/emf/emfstore/client/ui/errorreporting/MailBugHandler.java b/org.eclipse.emf.emfstore.client.ui.errorreporting/src/org/eclipse/emf/emfstore/client/ui/errorreporting/MailBugHandler.java
index b9cbc8c..f60b027 100644
--- a/org.eclipse.emf.emfstore.client.ui.errorreporting/src/org/eclipse/emf/emfstore/client/ui/errorreporting/MailBugHandler.java
+++ b/org.eclipse.emf.emfstore.client.ui.errorreporting/src/org/eclipse/emf/emfstore/client/ui/errorreporting/MailBugHandler.java
@@ -227,19 +227,12 @@
StringBuffer url = new StringBuffer("mailto:");
String email = configurationProvider.getEmailAddress();
String subject = configurationProvider.getEmailSubject();
- String body = configurationProvider.getEmailBody();
+ String body = configurationProvider.getEmailBody(shouldCaptureErrorDiagnosis);
url.append(email + "?");
url.append("subject=" + URLEncoder.encode(subject, CommonUtil.getEncoding()) + "&");
url.append("body=" + URLEncoder.encode(body.toString(), CommonUtil.getEncoding()));
-
- if (shouldCaptureErrorDiagnosis) {
- url.append(URLEncoder.encode(
- Platform.getPreferencesService().getString(ErrorReportingPreferences.QUALIFIER,
- ErrorReportingPreferences.EMAIL_BODY_ADDITIONAL_TEXT, StringUtils.EMPTY, null),
- CommonUtil.getEncoding()));
- }
-
+
return url.toString();
}