Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrank Becker2015-02-02 08:33:13 -0500
committerGerrit Code Review @ Eclipse.org2015-02-03 14:05:06 -0500
commitd09b0012bb7d7665367fd51a0f1bb65c19c644c0 (patch)
tree2435bf4c4a2d1e588bccd88ca616e18e5652fee0 /org.eclipse.mylyn.bugzilla.core/src
parente671ccca5330361bfd0026b86fc380ce8cea19bd (diff)
downloadorg.eclipse.mylyn.tasks-d09b0012bb7d7665367fd51a0f1bb65c19c644c0.tar.gz
org.eclipse.mylyn.tasks-d09b0012bb7d7665367fd51a0f1bb65c19c644c0.tar.xz
org.eclipse.mylyn.tasks-d09b0012bb7d7665367fd51a0f1bb65c19c644c0.zip
307729: [upstream] support reading and updating the See Also field
Change-Id: I5a85c736f1455314275524260f4d140178c9c4bd Task-Url: https://bugs.eclipse.org/bugs/show_bug.cgi?id=307729
Diffstat (limited to 'org.eclipse.mylyn.bugzilla.core/src')
-rw-r--r--org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaAttribute.java16
-rw-r--r--org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaClient.java60
-rw-r--r--org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/IBugzillaConstants.java2
-rw-r--r--org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/Messages.java2
-rw-r--r--org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/SaxMultiBugReportContentHandler.java18
-rw-r--r--org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/messages.properties1
6 files changed, 68 insertions, 31 deletions
diff --git a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaAttribute.java b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaAttribute.java
index e89e71366..c66c6b0d7 100644
--- a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaAttribute.java
+++ b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaAttribute.java
@@ -129,18 +129,22 @@ public enum BugzillaAttribute {
REPORTER_NAME(Messages.BugzillaAttribute_REPORT_NAME, "reporter_name", TaskAttribute.TYPE_PERSON, Flag.READ_ONLY), //$NON-NLS-1$
- REPORTER_ACCESSIBLE(Messages.BugzillaAttribute_REPORT_ACCESSIBLE, "reporter_accessible", //$NON-NLS-1$
- TaskAttribute.TYPE_BOOLEAN),
+ REPORTER_ACCESSIBLE(Messages.BugzillaAttribute_REPORT_ACCESSIBLE, "reporter_accessible", TaskAttribute.TYPE_BOOLEAN), //$NON-NLS-1$
RESOLUTION(Messages.BugzillaAttribute_Resolution,
"resolution", TaskAttribute.TYPE_SHORT_TEXT, Flag.ATTRIBUTE, Flag.READ_ONLY), //$NON-NLS-1$
REMAINING_TIME(Messages.BugzillaAttribute_Remaining, "remaining_time", TaskAttribute.TYPE_SHORT_TEXT), //$NON-NLS-1$
- SEE_ALSO(Messages.BugzillaAttribute_See_Also, "see_also", TaskAttribute.TYPE_SHORT_TEXT), //$NON-NLS-1$
+ REMOVE_SEE_ALSO(Messages.BugzillaAttribute_See_Also, "remove_see_also", IBugzillaConstants.EDITOR_TYPE_SEEALSO), //$NON-NLS-1$
- SET_DEFAULT_ASSIGNEE(Messages.BugzillaAttribute_Reassign_to_default_assignee, "set_default_assignee", //$NON-NLS-1$
- TaskAttribute.TYPE_BOOLEAN),
+ SEE_ALSO(Messages.BugzillaAttribute_AddSeeAlso, "see_also", TaskAttribute.TYPE_URL, Flag.ATTRIBUTE), //$NON-NLS-1$
+
+ SEE_ALSO_READ(Messages.BugzillaAttribute_See_Also,
+ "read_see_also", IBugzillaConstants.EDITOR_TYPE_SEEALSO, Flag.ATTRIBUTE), //$NON-NLS-1$
+
+ SET_DEFAULT_ASSIGNEE(Messages.BugzillaAttribute_Reassign_to_default_assignee,
+ "set_default_assignee", TaskAttribute.TYPE_BOOLEAN), //$NON-NLS-1$
SHORT_DESC(Messages.BugzillaAttribute_Summary, "short_desc", TaskAttribute.TYPE_SHORT_RICH_TEXT), //$NON-NLS-1$
@@ -263,4 +267,4 @@ public enum BugzillaAttribute {
return type;
}
-}
+} \ No newline at end of file
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 2f8c8e83d..639815424 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
@@ -165,7 +165,7 @@ public class BugzillaClient {
private static final String CONTENT_TYPE_TEXT_XML = "text/xml"; //$NON-NLS-1$
private static final String[] VALID_CONFIG_CONTENT_TYPES = { CONTENT_TYPE_APP_RDF_XML, CONTENT_TYPE_APP_XML,
- CONTENT_TYPE_TEXT_XML };
+ CONTENT_TYPE_TEXT_XML };
private static final String ATTR_CHARSET = "charset"; //$NON-NLS-1$
@@ -197,7 +197,7 @@ public class BugzillaClient {
public BugzillaClient(AbstractWebLocation location, String characterEncoding, Map<String, String> configParameters,
BugzillaLanguageSettings languageSettings, BugzillaRepositoryConnector connector)
- throws MalformedURLException {
+ throws MalformedURLException {
this.repositoryUrl = new URL(location.getUrl());
this.location = location;
this.characterEncoding = characterEncoding;
@@ -278,7 +278,7 @@ public class BugzillaClient {
}
protected GzipGetMethod getConnectGzip(String serverURL, IProgressMonitor monitor) throws IOException,
- CoreException {
+ CoreException {
return getConnectGzip(serverURL, monitor, null);
}
@@ -376,7 +376,7 @@ public class BugzillaClient {
throw new CoreException(new BugzillaStatus(IStatus.ERROR, BugzillaCorePlugin.ID_PLUGIN,
RepositoryStatus.ERROR_REPOSITORY_LOGIN, "All connection attempts to " + repositoryUrl.toString() //$NON-NLS-1$
- + " failed. Please verify connection and authentication information.")); //$NON-NLS-1$
+ + " failed. Please verify connection and authentication information.")); //$NON-NLS-1$
}
public void logout(IProgressMonitor monitor) throws IOException, CoreException {
@@ -409,8 +409,8 @@ public class BugzillaClient {
||
// content-type: application/x-gzip can be set by any apache after 302 redirect, based on .gz suffix
(null != method.getResponseHeader("Content-Type") && method.getResponseHeader("Content-Type") //$NON-NLS-1$ //$NON-NLS-2$
- .getValue()
- .equals("application/x-gzip")); //$NON-NLS-1$
+ .getValue()
+ .equals("application/x-gzip")); //$NON-NLS-1$
return zipped;
}
@@ -630,7 +630,7 @@ public class BugzillaClient {
}
private static String computeErrorMessage(HtmlStreamTokenizer tokenizer, Token token) throws IOException,
- ParseException {
+ ParseException {
int tagDepth = 0;
String errorMessage = ""; //$NON-NLS-1$
for (token = tokenizer.nextToken(); token.getType() != Token.EOF; token = tokenizer.nextToken()) {
@@ -774,6 +774,10 @@ public class BugzillaClient {
IBugzillaConstants.BUGZILLA_PARAM_USECLASSIFICATION, taskRepository, existingReport, false);
BugzillaUtil.addAttributeIfUsed(BugzillaAttribute.SEE_ALSO, IBugzillaConstants.BUGZILLA_PARAM_USE_SEE_ALSO,
taskRepository, existingReport, false);
+ BugzillaUtil.addAttributeIfUsed(BugzillaAttribute.REMOVE_SEE_ALSO,
+ IBugzillaConstants.BUGZILLA_PARAM_USE_SEE_ALSO, taskRepository, existingReport, false);
+ BugzillaUtil.addAttributeIfUsed(BugzillaAttribute.SEE_ALSO_READ,
+ IBugzillaConstants.BUGZILLA_PARAM_USE_SEE_ALSO, taskRepository, existingReport, false);
if (repositoryConfiguration == null) {
repositoryConfiguration = connector.getRepositoryConfiguration(serverUrl);
}
@@ -810,7 +814,7 @@ public class BugzillaClient {
@Deprecated
public RepositoryConfiguration getRepositoryConfiguration(IProgressMonitor monitor) throws IOException,
- CoreException {
+ CoreException {
return getRepositoryConfiguration(monitor, null);
}
@@ -902,7 +906,7 @@ public class BugzillaClient {
}
public InputStream getAttachmentData(String attachmentId, IProgressMonitor monitor) throws IOException,
- CoreException {
+ CoreException {
String url = repositoryUrl + IBugzillaConstants.URL_GET_ATTACHMENT_DOWNLOAD + attachmentId;
GetMethod method = getConnect(url, monitor);
Status status = null;
@@ -1083,7 +1087,7 @@ public class BugzillaClient {
WebUtil.releaseConnection(postMethod, monitor);
throw new CoreException(new BugzillaStatus(IStatus.ERROR, BugzillaCorePlugin.ID_PLUGIN,
RepositoryStatus.ERROR_NETWORK, repositoryUrl.toString(), "Http error: " //$NON-NLS-1$
- + HttpStatus.getStatusText(status)));
+ + HttpStatus.getStatusText(status)));
// throw new IOException("Communication error occurred during
// upload. \n\n"
// + HttpStatus.getStatusText(status));
@@ -1276,7 +1280,7 @@ public class BugzillaClient {
}
public RepositoryResponse postTaskData(TaskData taskData, IProgressMonitor monitor) throws IOException,
- CoreException {
+ CoreException {
try {
return postTaskDataInternal(taskData, monitor);
} catch (CoreException e) {
@@ -1365,7 +1369,7 @@ public class BugzillaClient {
}
public RepositoryResponse postTaskDataInternal(TaskData taskData, IProgressMonitor monitor) throws IOException,
- CoreException {
+ CoreException {
NameValuePair[] formData = null;
monitor = Policy.monitorFor(monitor);
BugzillaRepositoryResponse response;
@@ -1390,7 +1394,7 @@ public class BugzillaClient {
token = getTokenInternal(
taskData.getRepositoryUrl() + ENTER_BUG_PRODUCT_CGI
- + URLEncoder.encode(productAttribute.getValue(), IBugzillaConstants.ENCODING_UTF_8),
+ + URLEncoder.encode(productAttribute.getValue(), IBugzillaConstants.ENCODING_UTF_8),
monitor);
}
formData = getPairsForNew(taskData, token);
@@ -1472,11 +1476,11 @@ public class BugzillaClient {
if (id.equals(BugzillaAttribute.NEWCC.getKey())) {
TaskAttribute b = taskData.getRoot().createAttribute(BugzillaAttribute.CC.getKey());
b.getMetaData()
- .defaults()
- .setReadOnly(BugzillaAttribute.CC.isReadOnly())
- .setKind(BugzillaAttribute.CC.getKind())
- .setLabel(BugzillaAttribute.CC.toString())
- .setType(BugzillaAttribute.CC.getType());
+ .defaults()
+ .setReadOnly(BugzillaAttribute.CC.isReadOnly())
+ .setKind(BugzillaAttribute.CC.getKind())
+ .setLabel(BugzillaAttribute.CC.toString())
+ .setType(BugzillaAttribute.CC.getType());
for (String val : a.getValues()) {
if (val != null) {
b.addValue(val);
@@ -1563,6 +1567,8 @@ public class BugzillaClient {
cleanIfShortLogin(a);
} else if (id.equals(BugzillaAttribute.REPORTER.getKey()) || id.equals(BugzillaAttribute.CC.getKey())
|| id.equals(BugzillaAttribute.REMOVECC.getKey())
+ || id.equals(BugzillaAttribute.REMOVE_SEE_ALSO.getKey())
+ || id.equals(BugzillaAttribute.SEE_ALSO_READ.getKey())
|| id.equals(BugzillaAttribute.CREATION_TS.getKey())
|| id.equals(BugzillaAttribute.BUG_STATUS.getKey())
|| id.equals(BugzillaAttribute.VOTES.getKey())) {
@@ -1834,6 +1840,16 @@ public class BugzillaClient {
VAL_TRUE));
}
}
+ TaskAttribute attributeRemoveSeeAlso = model.getRoot().getMappedAttribute(
+ BugzillaAttribute.REMOVE_SEE_ALSO.getKey());
+ if (attributeRemoveSeeAlso != null) {
+ List<String> removeSeeAlso = attributeRemoveSeeAlso.getValues();
+ int idx = 0;
+ for (String string : removeSeeAlso) {
+ fields.put(BugzillaAttribute.REMOVE_SEE_ALSO.getKey() + idx++, new NameValuePair(
+ BugzillaAttribute.REMOVE_SEE_ALSO.getKey(), string));
+ }
+ }
// check for security token (required for successful submit on Bugzilla 3.2.1 and greater but not in xml until Bugzilla 3.2.3 bug#263318)
@@ -1966,14 +1982,14 @@ public class BugzillaClient {
}
private BugzillaRepositoryResponse parsePostResponse(String taskId, InputStream inputStream) throws IOException,
- CoreException {
+ CoreException {
BufferedReader in = new BufferedReader(new InputStreamReader(inputStream, getCharacterEncoding()));
return parseRepositoryResponse(taskId, in);
}
private BugzillaRepositoryResponse parseRepositoryResponse(String taskId, BufferedReader in) throws IOException,
- CoreException {
+ CoreException {
HtmlStreamTokenizer tokenizer = new HtmlStreamTokenizer(in, null);
BugzillaRepositoryResponse response;
@@ -2392,7 +2408,7 @@ public class BugzillaClient {
throw new CoreException(new BugzillaStatus(IStatus.ERROR, BugzillaCorePlugin.ID_PLUGIN,
RepositoryStatus.ERROR_REPOSITORY_LOGIN, "All connection attempts to " + repositoryUrl.toString() //$NON-NLS-1$
- + " failed. Please verify connection and authentication information.")); //$NON-NLS-1$
+ + " failed. Please verify connection and authentication information.")); //$NON-NLS-1$
}
public void setRepositoryConfiguration(RepositoryConfiguration repositoryConfiguration) {
@@ -2466,7 +2482,7 @@ public class BugzillaClient {
}
private void parseResultOK(HtmlStreamTokenizer tokenizer, BugzillaRepositoryResponse response) throws IOException,
- CoreException {
+ CoreException {
String codeString = ""; //$NON-NLS-1$
boolean inBugzillaBody = false;
int dlLevel = 0;
diff --git a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/IBugzillaConstants.java b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/IBugzillaConstants.java
index 8111dff97..f3cc6b01b 100644
--- a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/IBugzillaConstants.java
+++ b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/IBugzillaConstants.java
@@ -284,6 +284,8 @@ public interface IBugzillaConstants {
public static final String EDITOR_TYPE_REMOVECC = "bugzilla.editor.removecc"; //$NON-NLS-1$
+ public static final String EDITOR_TYPE_SEEALSO = "bugzilla.editor.seealso"; //$NON-NLS-1$
+
public static final String EDITOR_TYPE_VOTES = "bugzilla.editor.votes"; //$NON-NLS-1$
public static final String EDITOR_TYPE_FLAG = "bugzilla.editor.flag"; //$NON-NLS-1$
diff --git a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/Messages.java b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/Messages.java
index 3a7275c8b..f1c6b8806 100644
--- a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/Messages.java
+++ b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/Messages.java
@@ -33,6 +33,8 @@ public class Messages extends NLS {
public static String BugzillaAttribute_Additional_Comments;
+ public static String BugzillaAttribute_AddSeeAlso;
+
public static String BugzillaAttribute_Alias;
public static String BugzillaAttribute_Assigned_to;
diff --git a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/SaxMultiBugReportContentHandler.java b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/SaxMultiBugReportContentHandler.java
index 6b132c912..9bf66008e 100644
--- a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/SaxMultiBugReportContentHandler.java
+++ b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/SaxMultiBugReportContentHandler.java
@@ -32,7 +32,7 @@ import org.xml.sax.helpers.DefaultHandler;
/**
* Parser for xml bugzilla reports.
- *
+ *
* @author Rob Elves
* @author Hiroyuki Inaba (internationalization)
*/
@@ -575,8 +575,20 @@ public class SaxMultiBugReportContentHandler extends DefaultHandler {
}
break;
case SEE_ALSO:
- BugzillaUtil.createAttributeWithKindDefaultIfUsed(parsedText, tag, repositoryTaskData,
- IBugzillaConstants.BUGZILLA_PARAM_USE_SEE_ALSO, false);
+ TaskAttribute seeAlso = repositoryTaskData.getRoot().getMappedAttribute(
+ BugzillaAttribute.SEE_ALSO_READ.getKey());
+ if (seeAlso == null) {
+ BugzillaUtil.createAttributeWithKindDefaultIfUsed(null, tag, repositoryTaskData,
+ IBugzillaConstants.BUGZILLA_PARAM_USE_SEE_ALSO, false);
+ BugzillaUtil.createAttributeWithKindDefaultIfUsed(parsedText, BugzillaAttribute.SEE_ALSO_READ,
+ repositoryTaskData, IBugzillaConstants.BUGZILLA_PARAM_USE_SEE_ALSO, false);
+ } else {
+ if (seeAlso.getValue().equals("")) { //$NON-NLS-1$
+ seeAlso.setValue(parsedText);
+ } else {
+ seeAlso.addValue(parsedText);
+ }
+ }
break;
case COMMENTID:
if (taskComment != null) {
diff --git a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/messages.properties b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/messages.properties
index 20fe5a1cc..6069328fd 100644
--- a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/messages.properties
+++ b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/messages.properties
@@ -12,6 +12,7 @@ BugzillaAttribute_Add=Add:
BugzillaAttribute_Add_CC=Add CC:
BugzillaAttribute_Add_self_to_CC=Add self to CC
BugzillaAttribute_Additional_Comments=Additional Comments:
+BugzillaAttribute_AddSeeAlso=Add See Also:
BugzillaAttribute_Alias=Alias:
BugzillaAttribute_Assigned_to=Assigned to:
BugzillaAttribute_Assigned_to_NAME=Assigned to:

Back to the top