Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfbecker2009-12-12 16:09:58 -0500
committerfbecker2009-12-12 16:09:58 -0500
commit6a1432bd4f7f932b161febedc32a0d31366e290c (patch)
tree0670acc55bfa70c42f8e0451f26a50629bbfa884
parentd3a634c8563bd719aaee4b031f5d0e983ff4abf3 (diff)
downloadorg.eclipse.mylyn.tasks-6a1432bd4f7f932b161febedc32a0d31366e290c.tar.gz
org.eclipse.mylyn.tasks-6a1432bd4f7f932b161febedc32a0d31366e290c.tar.xz
org.eclipse.mylyn.tasks-6a1432bd4f7f932b161febedc32a0d31366e290c.zip
ASSIGNED - bug 297450: People are listed several times in Changes Submitted dialog
https://bugs.eclipse.org/bugs/show_bug.cgi?id=297450
-rw-r--r--org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaClient.java92
-rw-r--r--org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaRepositoryResponse.java20
-rw-r--r--org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/BugzillaTaskEditorPage.java22
-rw-r--r--org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/Messages.java2
-rw-r--r--org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/messages.properties5
5 files changed, 83 insertions, 58 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 a241e6001..f46194235 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
@@ -1975,56 +1975,63 @@ public class BugzillaClient {
private void parseResultOK(BufferedReader in, BugzillaRepositoryResponse response) throws IOException,
CoreException {
HtmlStreamTokenizer tokenizer = new HtmlStreamTokenizer(in, null);
-
- boolean isDT = false;
- String dtString = ""; //$NON-NLS-1$
- String body = ""; //$NON-NLS-1$
- String lastDTValue = ""; //$NON-NLS-1$
- boolean isCode = false;
String codeString = ""; //$NON-NLS-1$
+ boolean inBugzillaBody = false;
+ int dlLevel = 0;
+ boolean isDT = false;
+ boolean isCODE = false;
+ String dt1 = ""; //$NON-NLS-1$
+ String dt2 = ""; //$NON-NLS-1$
try {
for (Token token = tokenizer.nextToken(); token.getType() != Token.EOF; token = tokenizer.nextToken()) {
- body += token.toString();
- if (token.getType() == Token.TAG && ((HtmlTag) (token.getValue())).getTagType() == Tag.DT
- && ((HtmlTag) (token.getValue())).isEndTag()) {
- isDT = false;
- if (!dtString.equals("")) { //$NON-NLS-1$
- lastDTValue = dtString;
- }
- dtString = ""; //$NON-NLS-1$
- continue;
- }
- if (token.getType() == Token.TAG && ((HtmlTag) (token.getValue())).getTagType() == Tag.CODE
- && ((HtmlTag) (token.getValue())).isEndTag()) {
- isCode = false;
- if (codeString.length() > 0) {
- codeString = codeString.replace("@", "@"); //$NON-NLS-1$ //$NON-NLS-2$
- response.addResponseData(lastDTValue, codeString);
+
+ if (token.getType() == Token.TAG && ((HtmlTag) (token.getValue())).getTagType() == Tag.DIV) {
+ String idValue = ((HtmlTag) (token.getValue())).getAttribute(KEY_ID);
+ if (idValue != null) {
+ inBugzillaBody = idValue.equals("bugzilla-body"); //$NON-NLS-1$
+ } else {
+ inBugzillaBody = false;
}
- dtString = ""; //$NON-NLS-1$
- codeString = ""; //$NON-NLS-1$
- continue;
- }
- if (isCode) {
- codeString += (" " + token.getValue()); //$NON-NLS-1$
- }
- if (token.getType() == Token.TAG && ((HtmlTag) (token.getValue())).getTagType() == Tag.CODE
- && !((HtmlTag) (token.getValue())).isEndTag()) {
- isCode = true;
- codeString = ""; //$NON-NLS-1$
}
- if (isDT) {
- if (dtString.length() > 0) {
- dtString += (" " + token.getValue()); //$NON-NLS-1$
+ if (inBugzillaBody) {
+ if (token.getType() == Token.TAG) {
+ if (((HtmlTag) (token.getValue())).getTagType() == Tag.DL) {
+ if (((HtmlTag) (token.getValue())).isEndTag()) {
+ dlLevel--;
+ } else {
+ dlLevel++;
+ }
+ } else if (((HtmlTag) (token.getValue())).getTagType() == Tag.DT) {
+ isDT = !((HtmlTag) (token.getValue())).isEndTag();
+ if (isDT) {
+ if (dlLevel == 1) {
+ dt1 = " "; //$NON-NLS-1$
+ } else if (dlLevel == 2) {
+ dt2 = " "; //$NON-NLS-1$
+ }
+ }
+ } else if (((HtmlTag) (token.getValue())).getTagType() == Tag.CODE) {
+ if (isCODE) {
+ if (codeString.length() > 0) {
+ codeString = codeString.replace("@", "@"); //$NON-NLS-1$ //$NON-NLS-2$
+ response.addResponseData(dt1, dt2, codeString);
+ }
+ codeString = ""; //$NON-NLS-1$
+ }
+ isCODE = !((HtmlTag) (token.getValue())).isEndTag();
+ }
} else {
- dtString += token.getValue();
+ if (isDT) {
+ if (dlLevel == 1) {
+ dt1 += (" " + token.getValue()); //$NON-NLS-1$
+ } else if (dlLevel == 2) {
+ dt2 += (" " + token.getValue()); //$NON-NLS-1$
+ }
+ } else if (isCODE) {
+ codeString += ("" + token.getValue()); //$NON-NLS-1$
+ }
}
}
- if (token.getType() == Token.TAG && ((HtmlTag) (token.getValue())).getTagType() == Tag.DT
- && !((HtmlTag) (token.getValue())).isEndTag()) {
- isDT = true;
- continue;
- }
}
} catch (ParseException e) {
throw new CoreException(new BugzillaStatus(IStatus.ERROR, BugzillaCorePlugin.ID_PLUGIN,
@@ -2034,5 +2041,4 @@ public class BugzillaClient {
in.read();
}
}
-
}
diff --git a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaRepositoryResponse.java b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaRepositoryResponse.java
index 583626b80..ccc0abc8a 100644
--- a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaRepositoryResponse.java
+++ b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaRepositoryResponse.java
@@ -23,7 +23,7 @@ import org.eclipse.mylyn.tasks.core.RepositoryResponse;
*/
public class BugzillaRepositoryResponse extends RepositoryResponse {
- private Map<String, List<String>> responseData = new LinkedHashMap<String, List<String>>();
+ private Map<String, Map<String, List<String>>> responseData = new LinkedHashMap<String, Map<String, List<String>>>();
public BugzillaRepositoryResponse(ResponseKind reposonseKind, String taskId) {
super(reposonseKind, taskId);
@@ -33,20 +33,28 @@ public class BugzillaRepositoryResponse extends RepositoryResponse {
// ignore
}
- public Map<String, List<String>> getResponseData() {
+ public Map<String, Map<String, List<String>>> getResponseData() {
return responseData;
}
- public void setResponseData(Map<String, List<String>> responseData) {
+ public void setResponseData(Map<String, Map<String, List<String>>> responseData) {
this.responseData = responseData;
}
- public void addResponseData(String name, String response) {
- List<String> responseList = responseData.get(name);
+ public void addResponseData(String dt1, String dt2, String response) {
+
+ Map<String, List<String>> responseMap = responseData.get(dt1);
+
+ if (responseMap == null) {
+ responseMap = new LinkedHashMap<String, List<String>>();
+ responseData.put(dt1, responseMap);
+ }
+ List<String> responseList = responseMap.get(dt2);
if (responseList == null) {
responseList = new LinkedList<String>();
- responseData.put(name, responseList);
+ responseMap.put(dt2, responseList);
}
+
responseList.add(response);
}
diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/BugzillaTaskEditorPage.java b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/BugzillaTaskEditorPage.java
index b2e972423..48181251e 100644
--- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/BugzillaTaskEditorPage.java
+++ b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/BugzillaTaskEditorPage.java
@@ -390,15 +390,23 @@ public class BugzillaTaskEditorPage extends AbstractTaskEditorPage {
@Override
public void linkActivated(HyperlinkEvent event) {
String mes = ""; //$NON-NLS-1$
- for (String iterable_element : bugzillaResponse.getResponseData().keySet()) {
- mes += NLS.bind(Messages.BugzillaTaskEditorPage_Changes_Submitted_Action_Line,
- iterable_element);
- List<String> o = bugzillaResponse.getResponseData().get(iterable_element);
- for (String string : o) {
+ for (String iterable_map : bugzillaResponse.getResponseData().keySet()) {
+ mes += NLS.bind(Messages.BugzillaTaskEditorPage_Changes_Submitted_Bug_Line,
+ iterable_map);
+ Map<String, List<String>> responseMap = bugzillaResponse.getResponseData().get(
+ iterable_map);
+ for (String iterable_list : responseMap.keySet()) {
mes += NLS.bind(
- Messages.BugzillaTaskEditorPage_Changes_Submitted_Email_Line,
- string);
+ Messages.BugzillaTaskEditorPage_Changes_Submitted_Action_Line,
+ iterable_list);
+ List<String> responseList = responseMap.get(iterable_list);
+ for (String string : responseList) {
+ mes += NLS.bind(
+ Messages.BugzillaTaskEditorPage_Changes_Submitted_Email_Line,
+ string);
+ }
}
+
}
new MessageDialog(WorkbenchUtil.getShell(),
Messages.BugzillaTaskEditorPage_Changes_Submitted_Titel, null, mes,
diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/Messages.java b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/Messages.java
index f7de5c092..4829f7c23 100644
--- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/Messages.java
+++ b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/Messages.java
@@ -33,6 +33,8 @@ public class Messages extends NLS {
public static String BugzillaPlanningEditorPart_Team_Planning;
+ public static String BugzillaTaskEditorPage_Changes_Submitted_Bug_Line;
+
public static String BugzillaTaskEditorPage_Changes_Submitted_Action_Line;
public static String BugzillaTaskEditorPage_Changes_Submitted_Email_Line;
diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/messages.properties b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/messages.properties
index 62dc6ef40..a7d20bfda 100644
--- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/messages.properties
+++ b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/messages.properties
@@ -14,8 +14,9 @@ BugzillaPeoplePart__Select_to_remove_=(Select to remove)
BugzillaPlanningEditorPart_Current_Estimate=Current Estimate:
BugzillaPlanningEditorPart_Team_Planning=Team Planning
-BugzillaTaskEditorPage_Changes_Submitted_Action_Line={0}\n
-BugzillaTaskEditorPage_Changes_Submitted_Email_Line=\ \ \ \ \ \ \ \ {0}\n
+BugzillaTaskEditorPage_Changes_Submitted_Bug_Line=\n{0}\n
+BugzillaTaskEditorPage_Changes_Submitted_Action_Line=\ \ \ \ \ \ \ \ {0}\n
+BugzillaTaskEditorPage_Changes_Submitted_Email_Line=\ \ \ \ \ \ \ \ \ \ \ \ {0}\n
BugzillaTaskEditorPage_Changes_Submitted_Message=Changes submitted
BugzillaTaskEditorPage_Changes_Submitted_Titel=Changes submitted
BugzillaTaskEditorPage_Please_enter_a_description_before_submitting=Please enter a description before submitting

Back to the top