Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'org.eclipse.mylyn.bugzilla.ui')
-rw-r--r--org.eclipse.mylyn.bugzilla.ui/.classpath2
-rw-r--r--org.eclipse.mylyn.bugzilla.ui/META-INF/MANIFEST.MF2
-rw-r--r--org.eclipse.mylyn.bugzilla.ui/plugin.xml6
-rw-r--r--org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/BugzillaHyperlinkUtil.java84
-rw-r--r--org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/BugzillaTaskHyperlinkDetector.java69
-rw-r--r--org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/BugzillaTaskEditor.java21
-rw-r--r--org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaCustomQueryWizardPage.java6
-rw-r--r--org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaQueryTypeWizardPage.java4
8 files changed, 180 insertions, 14 deletions
diff --git a/org.eclipse.mylyn.bugzilla.ui/.classpath b/org.eclipse.mylyn.bugzilla.ui/.classpath
index fb06a62b3..ddacaf769 100644
--- a/org.eclipse.mylyn.bugzilla.ui/.classpath
+++ b/org.eclipse.mylyn.bugzilla.ui/.classpath
@@ -3,7 +3,7 @@
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins">
<accessrules>
- <accessrule kind="accessible" pattern="**/TaskListImages"/>
+ <accessrule kind="accessible" pattern="**/TasksUiImages"/>
<accessrule kind="accessible" pattern="**/TaskListColorsAndFonts"/>
<accessrule kind="accessible" pattern="**/TaskListPreferenceConstants"/>
<accessrule kind="accessible" pattern="**/mylar/internal/bugzilla/**"/>
diff --git a/org.eclipse.mylyn.bugzilla.ui/META-INF/MANIFEST.MF b/org.eclipse.mylyn.bugzilla.ui/META-INF/MANIFEST.MF
index ca8a9743f..845e06aff 100644
--- a/org.eclipse.mylyn.bugzilla.ui/META-INF/MANIFEST.MF
+++ b/org.eclipse.mylyn.bugzilla.ui/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Mylar Bugzilla Client Ui Plug-in
Bundle-SymbolicName: org.eclipse.mylar.bugzilla.ui; singleton:=true
-Bundle-Version: 2.0.0.v20070328-2130
+Bundle-Version: 2.0.0.v20070403-1300
Bundle-Activator: org.eclipse.mylar.internal.bugzilla.ui.BugzillaUiPlugin
Bundle-Vendor: Eclipse.org
Require-Bundle: org.eclipse.ui,
diff --git a/org.eclipse.mylyn.bugzilla.ui/plugin.xml b/org.eclipse.mylyn.bugzilla.ui/plugin.xml
index d1ff45600..334ffa91c 100644
--- a/org.eclipse.mylyn.bugzilla.ui/plugin.xml
+++ b/org.eclipse.mylyn.bugzilla.ui/plugin.xml
@@ -27,9 +27,9 @@
<extension
point="org.eclipse.mylar.tasks.ui.editors">
<editorFactory class="org.eclipse.mylar.internal.bugzilla.ui.tasklist.BugzillaTaskEditorFactory"/>
- <!-- <hyperlinkDetector
- class="org.eclipse.mylar.tasks.ui.editors.TaskHyperlinkDetector"
- id="org.eclipse.mylar.tasks.hyperlinkdetector.bugzillatask"/>-->
+ <hyperlinkDetector
+ class="org.eclipse.mylar.internal.bugzilla.ui.BugzillaTaskHyperlinkDetector"
+ id="org.eclipse.mylar.tasks.hyperlinkdetector.bugzillatask"/>
</extension>
<extension
diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/BugzillaHyperlinkUtil.java b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/BugzillaHyperlinkUtil.java
new file mode 100644
index 000000000..e2dad9ee0
--- /dev/null
+++ b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/BugzillaHyperlinkUtil.java
@@ -0,0 +1,84 @@
+/*******************************************************************************
+ * Copyright (c) 2004 - 2006 University Of British Columbia 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:
+ * University Of British Columbia - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.mylar.internal.bugzilla.ui;
+
+import java.util.ArrayList;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.eclipse.jface.text.IRegion;
+import org.eclipse.jface.text.Region;
+import org.eclipse.jface.text.hyperlink.IHyperlink;
+import org.eclipse.mylar.tasks.core.TaskRepository;
+import org.eclipse.mylar.tasks.ui.TaskHyperlink;
+import org.eclipse.mylar.tasks.ui.TasksUiPlugin;
+
+/**
+ * @author Rob Elves (multiple bug/task hyperlink support)
+ * @author Mik Kersten
+ */
+public class BugzillaHyperlinkUtil {
+
+ private static final int TASK_NUM_GROUP = 3;
+
+ private static final String regexp = "(duplicate of|bug|task)(\\s#|#|#\\s|\\s|)(\\s\\d+|\\d+)";
+
+ private static final Pattern PATTERN = Pattern.compile(regexp, Pattern.CASE_INSENSITIVE);
+
+ public static IHyperlink[] findBugHyperlinks(String repositoryUrl, int offset, String comment, int lineOffset) {
+ ArrayList<IHyperlink> hyperlinksFound = new ArrayList<IHyperlink>();
+
+ Matcher m = PATTERN.matcher(comment);
+ while (m.find()) {
+ if (offset >= m.start() && offset <= m.end()) {
+ IHyperlink link = extractHyperlink(repositoryUrl, lineOffset, m);
+ if (link != null)
+ hyperlinksFound.add(link);
+ }
+ }
+
+ if (hyperlinksFound.size() > 0) {
+ return hyperlinksFound.toArray(new IHyperlink[1]);
+ }
+ return null;
+ }
+
+ private static IHyperlink extractHyperlink(String repositoryUrl, int lineOffset, Matcher m) {
+
+ int start = -1;
+
+ if(m.group().startsWith("duplicate")) {
+ start = m.start() + m.group().indexOf(m.group(TASK_NUM_GROUP));
+ } else {
+ start = m.start();
+ }
+
+ int end = m.end();
+
+ if (end == -1)
+ end = m.group().length();
+
+ TaskRepository repository = TasksUiPlugin.getRepositoryManager().getRepository(repositoryUrl);
+
+ try {
+
+ String bugId = m.group(TASK_NUM_GROUP).trim();
+ start += lineOffset;
+ end += lineOffset;
+
+ IRegion sregion = new Region(start, end - start);
+ return new TaskHyperlink(sregion, repository, bugId);
+
+ } catch (NumberFormatException e) {
+ return null;
+ }
+ }
+}
diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/BugzillaTaskHyperlinkDetector.java b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/BugzillaTaskHyperlinkDetector.java
new file mode 100644
index 000000000..361ea2bd6
--- /dev/null
+++ b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/BugzillaTaskHyperlinkDetector.java
@@ -0,0 +1,69 @@
+/*******************************************************************************
+ * Copyright (c) 2004 - 2006 University Of British Columbia 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:
+ * University Of British Columbia - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.mylar.internal.bugzilla.ui;
+
+import org.eclipse.jface.text.BadLocationException;
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.jface.text.IRegion;
+import org.eclipse.jface.text.ITextViewer;
+import org.eclipse.jface.text.hyperlink.IHyperlink;
+import org.eclipse.jface.text.hyperlink.IHyperlinkDetector;
+import org.eclipse.mylar.tasks.core.TaskRepository;
+import org.eclipse.mylar.tasks.ui.editors.RepositoryTextViewer;
+
+/**
+ * @author Rob Elves
+ */
+public class BugzillaTaskHyperlinkDetector implements IHyperlinkDetector {
+
+ private TaskRepository repository;
+
+ public IHyperlink[] detectHyperlinks(ITextViewer textViewer, IRegion region, boolean canShowMultipleHyperlinks) {
+ if (region == null || textViewer == null)
+ return null;
+
+ if (!(textViewer instanceof RepositoryTextViewer))
+ return null;
+
+ RepositoryTextViewer viewer = (RepositoryTextViewer) textViewer;
+
+ repository = viewer.getRepository();
+
+ if (repository == null)
+ return null;
+
+ IDocument document = textViewer.getDocument();
+
+ int offset = region.getOffset();
+
+ if (document == null)
+ return null;
+
+ IRegion lineInfo;
+ String line;
+ try {
+ lineInfo = document.getLineInformationOfOffset(offset);
+ line = document.get(lineInfo.getOffset(), lineInfo.getLength());
+ } catch (BadLocationException ex) {
+ return null;
+ }
+
+ int offsetInLine = offset - lineInfo.getOffset();
+
+ IHyperlink[] links = BugzillaHyperlinkUtil.findBugHyperlinks(repository.getUrl(), offsetInLine, line, lineInfo
+ .getOffset());
+
+ return links;
+
+ }
+
+}
diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/BugzillaTaskEditor.java b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/BugzillaTaskEditor.java
index 4ae0588a5..40d07ee3f 100644
--- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/BugzillaTaskEditor.java
+++ b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/BugzillaTaskEditor.java
@@ -52,7 +52,7 @@ import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.List;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Text;
-import org.eclipse.ui.forms.IFormColors;
+import org.eclipse.ui.forms.FormColors;
import org.eclipse.ui.forms.editor.FormEditor;
import org.eclipse.ui.forms.events.HyperlinkAdapter;
import org.eclipse.ui.forms.events.HyperlinkEvent;
@@ -212,6 +212,18 @@ public class BugzillaTaskEditor extends AbstractRepositoryTaskEditor {
Text urlField = createTextField(composite, attribute, SWT.FLAT);
GridDataFactory.fillDefaults().hint(135, SWT.DEFAULT).applyTo(urlField);
}
+
+ attribute = this.taskData.getAttribute(BugzillaReportElement.STATUS_WHITEBOARD.getKeyString());
+ if(attribute == null){
+ this.taskData.setAttributeValue(BugzillaReportElement.STATUS_WHITEBOARD.getKeyString(), "");
+ attribute = this.taskData.getAttribute(BugzillaReportElement.STATUS_WHITEBOARD.getKeyString());
+ }
+ if (attribute != null && !attribute.isReadOnly()) {
+ Label label = createLabel(composite, attribute);
+ GridDataFactory.fillDefaults().align(SWT.RIGHT, SWT.CENTER).applyTo(label);
+ Text whiteboardField = createTextField(composite, attribute, SWT.FLAT);
+ GridDataFactory.fillDefaults().hint(135, SWT.DEFAULT).applyTo(whiteboardField);
+ }
addVoting(composite);
@@ -235,7 +247,8 @@ public class BugzillaTaskEditor extends AbstractRepositoryTaskEditor {
BugzillaReportElement.CCLIST_ACCESSIBLE.getKeyString(),
BugzillaReportElement.ESTIMATED_TIME.getKeyString(),
BugzillaReportElement.REMAINING_TIME.getKeyString(), BugzillaReportElement.ACTUAL_TIME.getKeyString(),
- BugzillaReportElement.DEADLINE.getKeyString() };
+ BugzillaReportElement.DEADLINE.getKeyString(),
+ BugzillaReportElement.STATUS_WHITEBOARD.getKeyString()};
for (String key : customAttributeKeys) {
RepositoryTaskAttribute attribute = taskData.getAttribute(key);
if (hasChanged(attribute)) {
@@ -388,7 +401,7 @@ public class BugzillaTaskEditor extends AbstractRepositoryTaskEditor {
}
Label label = toolkit.createLabel(timeComposite, "Current Estimate:");
- label.setForeground(toolkit.getColors().getColor(IFormColors.TITLE));
+ label.setForeground(toolkit.getColors().getColor(FormColors.TITLE));
Text currentEstimate = toolkit.createText(timeComposite,
""
@@ -537,7 +550,7 @@ public class BugzillaTaskEditor extends AbstractRepositoryTaskEditor {
protected void addVoting(Composite attributesComposite) {
Label label = toolkit.createLabel(attributesComposite, "Votes:");
- label.setForeground(toolkit.getColors().getColor(IFormColors.TITLE));
+ label.setForeground(toolkit.getColors().getColor(FormColors.TITLE));
GridDataFactory.fillDefaults().align(SWT.RIGHT, SWT.CENTER).applyTo(label);
Composite votingComposite = toolkit.createComposite(attributesComposite);
GridLayout layout = new GridLayout(3, false);
diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaCustomQueryWizardPage.java b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaCustomQueryWizardPage.java
index 3b8408d7c..724a03ffa 100644
--- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaCustomQueryWizardPage.java
+++ b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaCustomQueryWizardPage.java
@@ -12,7 +12,7 @@
package org.eclipse.mylar.internal.bugzilla.ui.tasklist;
import org.eclipse.mylar.internal.bugzilla.core.BugzillaRepositoryQuery;
-import org.eclipse.mylar.internal.tasks.ui.TaskListImages;
+import org.eclipse.mylar.internal.tasks.ui.TasksUiImages;
import org.eclipse.mylar.tasks.core.TaskRepository;
import org.eclipse.mylar.tasks.ui.TasksUiPlugin;
import org.eclipse.mylar.tasks.ui.search.AbstractRepositoryQueryPage;
@@ -49,7 +49,7 @@ public class BugzillaCustomQueryWizardPage extends AbstractRepositoryQueryPage {
this.repository = repository;
setTitle(LABEL_CUSTOM_QUERY);
// setDescription(DESCRIPTION);
- setImageDescriptor(TaskListImages.BANNER_REPOSITORY);
+ setImageDescriptor(TasksUiImages.BANNER_REPOSITORY);
}
public BugzillaCustomQueryWizardPage(TaskRepository repository) {
@@ -57,7 +57,7 @@ public class BugzillaCustomQueryWizardPage extends AbstractRepositoryQueryPage {
this.repository = repository;
setTitle(LABEL_CUSTOM_QUERY);
// setDescription(DESCRIPTION);
- setImageDescriptor(TaskListImages.BANNER_REPOSITORY);
+ setImageDescriptor(TasksUiImages.BANNER_REPOSITORY);
}
@Override
diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaQueryTypeWizardPage.java b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaQueryTypeWizardPage.java
index 2b3de45ec..f07dc93f8 100644
--- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaQueryTypeWizardPage.java
+++ b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaQueryTypeWizardPage.java
@@ -14,7 +14,7 @@ package org.eclipse.mylar.internal.bugzilla.ui.tasklist;
import org.eclipse.jface.wizard.IWizardPage;
import org.eclipse.jface.wizard.WizardPage;
import org.eclipse.mylar.internal.bugzilla.ui.search.BugzillaSearchPage;
-import org.eclipse.mylar.internal.tasks.ui.TaskListImages;
+import org.eclipse.mylar.internal.tasks.ui.TasksUiImages;
import org.eclipse.mylar.tasks.core.TaskRepository;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
@@ -49,7 +49,7 @@ public class BugzillaQueryTypeWizardPage extends WizardPage {
super(TITLE);
setTitle(TITLE);
setDescription(DESCRIPTION);
- setImageDescriptor(TaskListImages.BANNER_REPOSITORY);
+ setImageDescriptor(TasksUiImages.BANNER_REPOSITORY);
customPage = new BugzillaCustomQueryWizardPage(repository);
searchPage = new BugzillaSearchPage(repository);
searchPage.setRestoreQueryOptions(false);

Back to the top