Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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
-rw-r--r--org.eclipse.mylyn.bugzilla.tests/testdata/schema/taskdata.txt4
-rw-r--r--org.eclipse.mylyn.bugzilla.ui/icons/elcl16/gerrit.gifbin0 -> 211 bytes
-rw-r--r--org.eclipse.mylyn.bugzilla.ui/icons/elcl16/git.pngbin0 -> 617 bytes
-rw-r--r--org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/BugzillaImages.java4
-rw-r--r--org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/BugzillaSeeAlsoAttributeEditor.java240
-rw-r--r--org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/BugzillaTaskEditorPage.java40
-rw-r--r--org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/Messages.java14
-rw-r--r--org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/messages.properties7
14 files changed, 357 insertions, 51 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:
diff --git a/org.eclipse.mylyn.bugzilla.tests/testdata/schema/taskdata.txt b/org.eclipse.mylyn.bugzilla.tests/testdata/schema/taskdata.txt
index 4dcc472a3..a1b72ab96 100644
--- a/org.eclipse.mylyn.bugzilla.tests/testdata/schema/taskdata.txt
+++ b/org.eclipse.mylyn.bugzilla.tests/testdata/schema/taskdata.txt
@@ -54,7 +54,9 @@ TaskAttribute[id=root,values=[],options=null,metaData=null]
TaskAttribute[id=reporter_accessible,values=[],options=null,metaData={task.meta.readOnly=false, task.meta.type=boolean}]
TaskAttribute[id=resolution,values=[],options=null,metaData={task.meta.readOnly=true, task.meta.attributeKind=task.common.kind.default, task.meta.type=shortText}]
TaskAttribute[id=remaining_time,values=[],options=null,metaData={task.meta.readOnly=false, task.meta.type=shortText}]
- TaskAttribute[id=see_also,values=[],options=null,metaData={task.meta.readOnly=false, task.meta.type=shortText}]
+ TaskAttribute[id=remove_see_also,values=[],options=null,metaData={task.meta.readOnly=false, task.meta.type=bugzilla.editor.seealso}]
+ TaskAttribute[id=see_also,values=[],options=null,metaData={task.meta.readOnly=false, task.meta.attributeKind=task.common.kind.default, task.meta.type=url}]
+ TaskAttribute[id=read_see_also,values=[],options=null,metaData={task.meta.readOnly=false, task.meta.attributeKind=task.common.kind.default, task.meta.type=bugzilla.editor.seealso}]
TaskAttribute[id=set_default_assignee,values=[],options=null,metaData={task.meta.readOnly=false, task.meta.type=boolean}]
TaskAttribute[id=short_desc,values=[],options=null,metaData={task.meta.readOnly=false, task.meta.type=shortRichText}]
TaskAttribute[id=size,values=[],options=null,metaData={task.meta.readOnly=false, task.meta.attributeKind=task.common.kind.default, task.meta.type=shortText}]
diff --git a/org.eclipse.mylyn.bugzilla.ui/icons/elcl16/gerrit.gif b/org.eclipse.mylyn.bugzilla.ui/icons/elcl16/gerrit.gif
new file mode 100644
index 000000000..5c65e1fb5
--- /dev/null
+++ b/org.eclipse.mylyn.bugzilla.ui/icons/elcl16/gerrit.gif
Binary files differ
diff --git a/org.eclipse.mylyn.bugzilla.ui/icons/elcl16/git.png b/org.eclipse.mylyn.bugzilla.ui/icons/elcl16/git.png
new file mode 100644
index 000000000..d072d3cbe
--- /dev/null
+++ b/org.eclipse.mylyn.bugzilla.ui/icons/elcl16/git.png
Binary files differ
diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/BugzillaImages.java b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/BugzillaImages.java
index 930ef635f..1c539887d 100644
--- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/BugzillaImages.java
+++ b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/BugzillaImages.java
@@ -38,6 +38,10 @@ public class BugzillaImages {
public static final ImageDescriptor BUG = create(T_ELCL, "bug.gif"); //$NON-NLS-1$
+ public static final ImageDescriptor GERRIT = create(T_ELCL, "gerrit.gif"); //$NON-NLS-1$
+
+ public static final ImageDescriptor GIT = create(T_ELCL, "git.png"); //$NON-NLS-1$
+
public static final ImageDescriptor BUG_COMMENT = create(T_ELCL, "bug-comment.gif"); //$NON-NLS-1$
public static final ImageDescriptor REMOVE_ALL = create("", "remove-all.gif"); //$NON-NLS-1$ //$NON-NLS-2$
diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/BugzillaSeeAlsoAttributeEditor.java b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/BugzillaSeeAlsoAttributeEditor.java
new file mode 100644
index 000000000..9c120522b
--- /dev/null
+++ b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/BugzillaSeeAlsoAttributeEditor.java
@@ -0,0 +1,240 @@
+/*******************************************************************************
+ * Copyright (c) 2015 Frank Becker and others.
+ * All rights reserved. This program and the accompanying materials
+ * are 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:
+ * Frank Becker - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.mylyn.internal.bugzilla.ui.editor;
+
+import java.util.List;
+
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.IMenuListener;
+import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.jface.action.MenuManager;
+import org.eclipse.jface.viewers.ArrayContentProvider;
+import org.eclipse.jface.viewers.ColumnLabelProvider;
+import org.eclipse.jface.viewers.ColumnViewerToolTipSupport;
+import org.eclipse.jface.viewers.IOpenListener;
+import org.eclipse.jface.viewers.OpenEvent;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.jface.viewers.ViewerCell;
+import org.eclipse.jface.window.ToolTip;
+import org.eclipse.mylyn.commons.ui.CommonImages;
+import org.eclipse.mylyn.commons.workbench.browser.BrowserUtil;
+import org.eclipse.mylyn.internal.bugzilla.core.BugzillaAttribute;
+import org.eclipse.mylyn.internal.bugzilla.core.BugzillaTaskDataHandler;
+import org.eclipse.mylyn.internal.bugzilla.ui.BugzillaImages;
+import org.eclipse.mylyn.tasks.core.data.TaskAttribute;
+import org.eclipse.mylyn.tasks.core.data.TaskDataModel;
+import org.eclipse.mylyn.tasks.ui.editors.AbstractAttributeEditor;
+import org.eclipse.mylyn.tasks.ui.editors.LayoutHint;
+import org.eclipse.mylyn.tasks.ui.editors.LayoutHint.ColumnSpan;
+import org.eclipse.mylyn.tasks.ui.editors.LayoutHint.RowSpan;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.dnd.Clipboard;
+import org.eclipse.swt.dnd.TextTransfer;
+import org.eclipse.swt.dnd.Transfer;
+import org.eclipse.swt.graphics.GC;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Menu;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.TableColumn;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+
+public class BugzillaSeeAlsoAttributeEditor extends AbstractAttributeEditor {
+
+ private Table seeAlsoTable;
+
+ private TaskAttribute attrRemoveSeeAlso;
+
+ public BugzillaSeeAlsoAttributeEditor(TaskDataModel manager, TaskAttribute taskAttribute) {
+ super(manager, taskAttribute);
+ setLayoutHint(new LayoutHint(RowSpan.MULTIPLE, ColumnSpan.MULTIPLE));
+ }
+
+ @Override
+ public void createControl(Composite parent, FormToolkit toolkit) {
+ attrRemoveSeeAlso = getModel().getTaskData()
+ .getRoot()
+ .getMappedAttribute(BugzillaAttribute.REMOVE_SEE_ALSO.getKey());
+
+ if (attrRemoveSeeAlso == null) {
+ attrRemoveSeeAlso = BugzillaTaskDataHandler.createAttribute(getModel().getTaskData(),
+ BugzillaAttribute.REMOVE_SEE_ALSO);
+ }
+ createSeeAlsoTable(toolkit, parent);
+ setControl(seeAlsoTable);
+ }
+
+ private final String[] seeAlsoColumns = {
+ "", Messages.BugzillaSeeAlsoAttributeEditor_Remove, Messages.BugzillaSeeAlsoAttributeEditor_URL }; //$NON-NLS-1$
+
+ private final int[] seeAlsoColumnWidths = { 25, 60, 100 };
+
+ private TableViewer seeAlsoViewer;
+
+ private void createSeeAlsoTable(FormToolkit toolkit, final Composite seeAlsoComposite) {
+
+ seeAlsoTable = toolkit.createTable(seeAlsoComposite, SWT.MULTI | SWT.FULL_SELECTION);
+ seeAlsoTable.setLinesVisible(true);
+ seeAlsoTable.setHeaderVisible(true);
+ seeAlsoTable.setLayout(new GridLayout());
+ seeAlsoTable.setData(FormToolkit.KEY_DRAW_BORDER, FormToolkit.TREE_BORDER);
+
+ for (int i = 0; i < seeAlsoColumns.length; i++) {
+ TableColumn column = new TableColumn(seeAlsoTable, SWT.LEFT, i);
+ column.setText(seeAlsoColumns[i]);
+ column.setWidth(seeAlsoColumnWidths[i]);
+ column.setMoveable(true);
+ }
+
+ seeAlsoViewer = new TableViewer(seeAlsoTable);
+ seeAlsoViewer.setUseHashlookup(true);
+ seeAlsoViewer.setColumnProperties(seeAlsoColumns);
+ ColumnViewerToolTipSupport.enableFor(seeAlsoViewer, ToolTip.NO_RECREATE);
+
+ seeAlsoViewer.setContentProvider(new ArrayContentProvider());
+ seeAlsoViewer.addOpenListener(new IOpenListener() {
+ public void open(OpenEvent event) {
+ openseeAlso(event);
+ }
+
+ private void openseeAlso(OpenEvent event) {
+ StructuredSelection selection = (StructuredSelection) event.getSelection();
+ for (String item : (List<String>) selection.toList()) {
+ BrowserUtil.openUrl(item);
+ }
+
+ }
+ });
+ seeAlsoViewer.setLabelProvider(new ColumnLabelProvider() {
+
+ public Image getColumnImage(Object element, int columnIndex) {
+ String value = (String) element;
+ if (columnIndex == 0) {
+ if (value.contains("/r/#/c/")) { //$NON-NLS-1$
+ return CommonImages.getImage(BugzillaImages.GERRIT);
+ } else if (value.contains("/commit/?id=")) { //$NON-NLS-1$
+ return CommonImages.getImage(BugzillaImages.GIT);
+ } else {
+ return CommonImages.getImage(BugzillaImages.BUG);
+ }
+ }
+ return null;
+ }
+
+ public String getColumnText(Object element, int columnIndex) {
+ String value = (String) element;
+ switch (columnIndex) {
+ case 0:
+ return null;
+ case 1:
+ return attrRemoveSeeAlso.getValues().contains(value)
+ ? Messages.BugzillaSeeAlsoAttributeEditor_Yes
+ : Messages.BugzillaSeeAlsoAttributeEditor_No;
+ default:
+ return value;
+ }
+ }
+
+ @Override
+ public void update(ViewerCell cell) {
+ Object element = cell.getElement();
+ cell.setText(getColumnText(element, cell.getColumnIndex()));
+ Image image = getColumnImage(element, cell.getColumnIndex());
+ cell.setImage(image);
+ cell.setBackground(getBackground(element));
+ cell.setForeground(getForeground(element));
+ cell.setFont(getFont(element));
+ }
+
+ });
+ seeAlsoViewer.setInput(getTaskAttribute().getValues().toArray());
+ GC gc = new GC(seeAlsoComposite);
+ int maxSize = 0;
+ for (String string : getTaskAttribute().getValues()) {
+ Point size = gc.textExtent(string);
+ if (size.x > maxSize) {
+ maxSize = size.x;
+ }
+ }
+ if (maxSize == 0) {
+ maxSize = 100;
+ }
+ seeAlsoTable.getColumn(2).setWidth(maxSize);
+ MenuManager menuManager = new MenuManager();
+ menuManager.setRemoveAllWhenShown(true);
+ menuManager.addMenuListener(new IMenuListener() {
+ public void menuAboutToShow(IMenuManager manager) {
+ manager.add(openAction);
+ manager.add(copyURLToClipAction);
+ manager.add(toggelRemoveStateAction);
+ }
+ });
+ Menu menu = menuManager.createContextMenu(seeAlsoTable);
+ seeAlsoTable.setMenu(menu);
+ }
+
+ final Action copyURLToClipAction = new Action(Messages.BugzillaSeeAlsoAttributeEditor_CopyURL) {
+ @Override
+ public void run() {
+ StructuredSelection selection = ((StructuredSelection) seeAlsoViewer.getSelection());
+ if (selection != null) {
+ Object firstElement = selection.getFirstElement();
+ if (firstElement != null) {
+ Clipboard clip = new Clipboard(PlatformUI.getWorkbench().getDisplay());
+ clip.setContents(new Object[] { (String) firstElement },
+ new Transfer[] { TextTransfer.getInstance() });
+ clip.dispose();
+ }
+ }
+ }
+ };
+
+ final Action openAction = new Action(Messages.BugzillaSeeAlsoAttributeEditor_Open) {
+ @Override
+ public void run() {
+ StructuredSelection selection = ((StructuredSelection) seeAlsoViewer.getSelection());
+ if (selection != null) {
+ for (String url : (List<String>) selection.toList()) {
+ BrowserUtil.openUrl(url);
+ }
+ }
+ }
+ };
+
+ final Action toggelRemoveStateAction = new Action(Messages.BugzillaSeeAlsoAttributeEditor_ToggelRemoveState) {
+ @Override
+ public void run() {
+ StructuredSelection selection = ((StructuredSelection) seeAlsoViewer.getSelection());
+ boolean changed = false;
+ if (selection != null) {
+ for (String url : (List<String>) selection.toList()) {
+ if (attrRemoveSeeAlso.getValues().contains(url)) {
+ attrRemoveSeeAlso.removeValue(url);
+ } else {
+ attrRemoveSeeAlso.addValue(url);
+ }
+ changed = true;
+ }
+
+ if (changed) {
+ getModel().attributeChanged(attrRemoveSeeAlso);
+ seeAlsoViewer.refresh();
+ }
+ }
+ }
+ };
+
+}
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 b5f271100..be15206e6 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
@@ -103,7 +103,7 @@ public class BugzillaTaskEditorPage extends AbstractTaskEditorPage {
/**
* Call this constructor if extending the Bugzilla connector
- *
+ *
* @param editor
* @param connectorKind
*/
@@ -239,6 +239,8 @@ public class BugzillaTaskEditorPage extends AbstractTaskEditorPage {
editor = new BugzillaVotesEditor(getModel(), taskAttribute);
} else if (IBugzillaConstants.EDITOR_TYPE_FLAG.equals(type)) {
editor = new FlagAttributeEditor(getModel(), taskAttribute);
+ } else if (IBugzillaConstants.EDITOR_TYPE_SEEALSO.equals(type)) {
+ editor = new BugzillaSeeAlsoAttributeEditor(getModel(), taskAttribute);
} else {
editor = super.createEditor(type, taskAttribute);
if (TaskAttribute.TYPE_BOOLEAN.equals(type)) {
@@ -580,12 +582,12 @@ public class BugzillaTaskEditorPage extends AbstractTaskEditorPage {
if (bugzillaResponse.getResponseData().size() > 0) {
getTaskEditor().setMessage(Messages.BugzillaTaskEditorPage_Changes_Submitted_Message,
IMessageProvider.INFORMATION, new HyperlinkAdapter() {
- @Override
- public void linkActivated(HyperlinkEvent event) {
- showSubmitResponse(bugzillaResponse);
- }
+ @Override
+ public void linkActivated(HyperlinkEvent event) {
+ showSubmitResponse(bugzillaResponse);
+ }
- });
+ });
} else {
getTaskEditor().setMessage(Messages.BugzillaTaskEditorPage_Changes_Submitted_Message,
IMessageProvider.INFORMATION);
@@ -610,12 +612,12 @@ public class BugzillaTaskEditorPage extends AbstractTaskEditorPage {
public void run() {
getTaskEditor().setMessage(Messages.BugzillaTaskEditorPage_Anonymous_can_not_submit_Tasks, type,
new HyperlinkAdapter() {
- @Override
- public void linkActivated(HyperlinkEvent e) {
- TasksUiUtil.openEditRepositoryWizard(taskRepository);
- refresh();
- }
- });
+ @Override
+ public void linkActivated(HyperlinkEvent e) {
+ TasksUiUtil.openEditRepositoryWizard(taskRepository);
+ refresh();
+ }
+ });
}
});
return false;
@@ -629,12 +631,12 @@ public class BugzillaTaskEditorPage extends AbstractTaskEditorPage {
public void run() {
getTaskEditor().setMessage(Messages.BugzillaTaskEditorPage_submit_disabled_please_refresh,
type, new HyperlinkAdapter() {
- @Override
- public void linkActivated(HyperlinkEvent e) {
- TasksUiUtil.openEditRepositoryWizard(taskRepository);
- refresh();
- }
- });
+ @Override
+ public void linkActivated(HyperlinkEvent e) {
+ TasksUiUtil.openEditRepositoryWizard(taskRepository);
+ refresh();
+ }
+ });
}
});
return false;
@@ -787,7 +789,7 @@ public class BugzillaTaskEditorPage extends AbstractTaskEditorPage {
final ControlDecoration decoration = new ControlDecoration(control, SWT.LEFT | SWT.DOWN);
decoration.setImage(newPersonProposalMap.size() == 1
? fieldDecorationWarning.getImage()
- : fieldDecoration.getImage());
+ : fieldDecoration.getImage());
IBindingService bindingService = (IBindingService) PlatformUI.getWorkbench().getService(IBindingService.class);
if (message != null && !message.equals("")) { //$NON-NLS-1$
decoration.setDescriptionText(message);
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 51882c182..a66305198 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
@@ -47,6 +47,20 @@ public class Messages extends NLS {
public static String BugzillaPlanningEditorPart_Team_Planning;
+ public static String BugzillaSeeAlsoAttributeEditor_CopyURL;
+
+ public static String BugzillaSeeAlsoAttributeEditor_No;
+
+ public static String BugzillaSeeAlsoAttributeEditor_Open;
+
+ public static String BugzillaSeeAlsoAttributeEditor_Remove;
+
+ public static String BugzillaSeeAlsoAttributeEditor_ToggelRemoveState;
+
+ public static String BugzillaSeeAlsoAttributeEditor_URL;
+
+ public static String BugzillaSeeAlsoAttributeEditor_Yes;
+
public static String BugzillaTaskEditorPage_Bug_Line;
public static String BugzillaTaskEditorPage_Action_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 b5838a009..fca1dec79 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
@@ -20,6 +20,13 @@ BugzillaFlagPart_used_flags=set flags
BugzillaPlanningEditorPart_Current_Estimate=Current Estimate:
BugzillaPlanningEditorPart_Team_Planning=Team Planning
+BugzillaSeeAlsoAttributeEditor_CopyURL=Copy &URL
+BugzillaSeeAlsoAttributeEditor_No=No
+BugzillaSeeAlsoAttributeEditor_Open=Open
+BugzillaSeeAlsoAttributeEditor_Remove=Remove
+BugzillaSeeAlsoAttributeEditor_ToggelRemoveState=Toggel Remove State
+BugzillaSeeAlsoAttributeEditor_URL=URL
+BugzillaSeeAlsoAttributeEditor_Yes=Yes
BugzillaTaskEditorPage_Bug_Line={0}\n
BugzillaTaskEditorPage_Action_Line=\ \ \ \ \ \ \ \ {0}\n

Back to the top