Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrelves2006-12-14 07:02:14 +0000
committerrelves2006-12-14 07:02:14 +0000
commitc122a32b4c83e91622582c5b5d7d71726b4f8864 (patch)
treef3f394e7ac609721427038078f066f85f44beeea
parentb25fa0914f904e1c9e41be0e35c09d5fe6db6261 (diff)
downloadorg.eclipse.mylyn.tasks-c122a32b4c83e91622582c5b5d7d71726b4f8864.tar.gz
org.eclipse.mylyn.tasks-c122a32b4c83e91622582c5b5d7d71726b4f8864.tar.xz
org.eclipse.mylyn.tasks-c122a32b4c83e91622582c5b5d7d71726b4f8864.zip
NEW - bug 167785: Description wrapping problems upon submit
https://bugs.eclipse.org/bugs/show_bug.cgi?id=167785
-rw-r--r--org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaClient.java44
-rw-r--r--org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/NewBugzillaTaskEditor.java79
2 files changed, 68 insertions, 55 deletions
diff --git a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaClient.java b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaClient.java
index 3fc2f604e..8f81a4cac 100644
--- a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaClient.java
+++ b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaClient.java
@@ -811,8 +811,7 @@ public class BugzillaClient {
fields.put(BugzillaReportElement.SHORT_DESC.getKeyString(), new NameValuePair(BugzillaReportElement.SHORT_DESC
.getKeyString(), taskData.getSummary()));
- String formattedDescription = formatTextToLineWrap(taskData.getDescription(), true);
- taskData.setDescription(formattedDescription);
+ taskData.setDescription(taskData.getDescription());
if (taskData.getDescription().length() != 0) {
// add the new comment to the bug post if there
@@ -889,46 +888,6 @@ public class BugzillaClient {
}
- /**
- * Break text up into lines of about 80 characters so that it is displayed
- * properly in bugzilla
- */
- private static String formatTextToLineWrap(String origText, boolean hardWrap) {
- // BugzillaServerVersion bugzillaServerVersion =
- // IBugzillaConstants.BugzillaServerVersion.fromString(repository
- // .getVersion());
- // if (bugzillaServerVersion != null &&
- // bugzillaServerVersion.compareTo(BugzillaServerVersion.SERVER_220) >=
- // 0) {
- // return origText;
- if (!hardWrap) {
- return origText;
- } else {
- String[] textArray = new String[(origText.length() / WRAP_LENGTH + 1) * 2];
- for (int i = 0; i < textArray.length; i++)
- textArray[i] = null;
- int j = 0;
- while (true) {
- int spaceIndex = origText.indexOf(" ", WRAP_LENGTH - 5);
- if (spaceIndex == origText.length() || spaceIndex == -1) {
- textArray[j] = origText;
- break;
- }
- textArray[j] = origText.substring(0, spaceIndex);
- origText = origText.substring(spaceIndex + 1, origText.length());
- j++;
- }
-
- String newText = "";
-
- for (int i = 0; i < textArray.length; i++) {
- if (textArray[i] == null)
- break;
- newText += textArray[i] + "\n";
- }
- return newText;
- }
- }
public static String stripTimeZone(String longTime) {
String result = longTime;
@@ -1011,6 +970,7 @@ public class BugzillaClient {
}
}
+
}
// /**
diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/NewBugzillaTaskEditor.java b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/NewBugzillaTaskEditor.java
index 315b556cf..fcffe5e2f 100644
--- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/NewBugzillaTaskEditor.java
+++ b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/NewBugzillaTaskEditor.java
@@ -31,6 +31,8 @@ import org.eclipse.ui.forms.editor.FormEditor;
*/
public class NewBugzillaTaskEditor extends AbstractNewRepositoryTaskEditor {
+ private static final int WRAP_LENGTH = 90;
+
public NewBugzillaTaskEditor(FormEditor editor) {
super(editor);
}
@@ -41,6 +43,16 @@ public class NewBugzillaTaskEditor extends AbstractNewRepositoryTaskEditor {
expandedStateAttributes = true;
}
+ @Override
+ protected void updateTask() {
+ String text = descriptionTextViewer.getTextWidget().getText();
+ if (repository.getVersion().startsWith("2.18")) {
+ text = formatTextToLineWrap(text, true);
+ descriptionTextViewer.getTextWidget().setText(text);
+ }
+ super.updateTask();
+ }
+
// @Override
// protected void submitToRepository() {
// if (!prepareSubmit()) {
@@ -95,7 +107,7 @@ public class NewBugzillaTaskEditor extends AbstractNewRepositoryTaskEditor {
// TasksUiPlugin.getSynchronizationScheduler().synchNow(0,
// Collections.singletonList(repository));
//
- // }
+ // }
// protected void addActionButtons(Composite buttonComposite) {
//
@@ -140,17 +152,58 @@ public class NewBugzillaTaskEditor extends AbstractNewRepositoryTaskEditor {
return BugzillaUiPlugin.PLUGIN_ID;
}
-// @Override
-// protected void handleErrorStatus(IJobChangeEvent event) {
-// if (event.getJob().getResult().getCode() == Status.INFO) {
-// WebBrowserDialog.openAcceptAgreement(NewBugzillaTaskEditor.this.getSite().getShell(),
-// IBugzillaConstants.REPORT_SUBMIT_ERROR, event.getJob().getResult().getMessage(), event.getJob()
-// .getResult().getException().getMessage());
-// } else if (event.getJob().getResult().getCode() == Status.ERROR) {
-// MessageDialog.openError(NewBugzillaTaskEditor.this.getSite().getShell(),
-// IBugzillaConstants.REPORT_SUBMIT_ERROR, event.getResult().getMessage());
-// }
-// super.handleErrorStatus(event);
-// }
+ // @Override
+ // protected void handleErrorStatus(IJobChangeEvent event) {
+ // if (event.getJob().getResult().getCode() == Status.INFO) {
+ // WebBrowserDialog.openAcceptAgreement(NewBugzillaTaskEditor.this.getSite().getShell(),
+ // IBugzillaConstants.REPORT_SUBMIT_ERROR,
+ // event.getJob().getResult().getMessage(), event.getJob()
+ // .getResult().getException().getMessage());
+ // } else if (event.getJob().getResult().getCode() == Status.ERROR) {
+ // MessageDialog.openError(NewBugzillaTaskEditor.this.getSite().getShell(),
+ // IBugzillaConstants.REPORT_SUBMIT_ERROR, event.getResult().getMessage());
+ // }
+ // super.handleErrorStatus(event);
+ // }
+
+ /**
+ * Break text up into lines so that it is displayed properly in bugzilla
+ */
+ private static String formatTextToLineWrap(String origText, boolean hardWrap) {
+ // BugzillaServerVersion bugzillaServerVersion =
+ // IBugzillaConstants.BugzillaServerVersion.fromString(repository
+ // .getVersion());
+ // if (bugzillaServerVersion != null &&
+ // bugzillaServerVersion.compareTo(BugzillaServerVersion.SERVER_220) >=
+ // 0) {
+ // return origText;
+ if (!hardWrap) {
+ return origText;
+ } else {
+ String[] textArray = new String[(origText.length() / WRAP_LENGTH + 1) * 2];
+ for (int i = 0; i < textArray.length; i++)
+ textArray[i] = null;
+ int j = 0;
+ while (true) {
+ int spaceIndex = origText.indexOf(" ", WRAP_LENGTH - 5);
+ if (spaceIndex == origText.length() || spaceIndex == -1) {
+ textArray[j] = origText;
+ break;
+ }
+ textArray[j] = origText.substring(0, spaceIndex);
+ origText = origText.substring(spaceIndex + 1, origText.length());
+ j++;
+ }
+
+ String newText = "";
+
+ for (int i = 0; i < textArray.length; i++) {
+ if (textArray[i] == null)
+ break;
+ newText += textArray[i] + "\n";
+ }
+ return newText;
+ }
+ }
}

Back to the top