Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrelves2007-01-16 19:28:40 -0500
committerrelves2007-01-16 19:28:40 -0500
commitaea3edc22901e80f82c8a54d8073b5b29638dd8f (patch)
tree7120c94054657fe6c4b50ee746db774a2b9759e0
parent98a522669a148ea494e1bf5e6212863aacd8c16f (diff)
downloadorg.eclipse.mylyn.tasks-aea3edc22901e80f82c8a54d8073b5b29638dd8f.tar.gz
org.eclipse.mylyn.tasks-aea3edc22901e80f82c8a54d8073b5b29638dd8f.tar.xz
org.eclipse.mylyn.tasks-aea3edc22901e80f82c8a54d8073b5b29638dd8f.zip
RESOLVED - bug 170483: Add roles support to bugzilla task editor
https://bugs.eclipse.org/bugs/show_bug.cgi?id=170483
-rw-r--r--org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaClient.java1
-rw-r--r--org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaReportElement.java5
-rw-r--r--org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/BugzillaTaskEditor.java150
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/AbstractRepositoryTaskEditor.java26
4 files changed, 126 insertions, 56 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 87ed1318d..cebe5b046 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
@@ -841,6 +841,7 @@ public class BugzillaClient {
continue;
} else if (a.getID() != null && a.getID().compareTo("") != 0) {
String value = a.getValue();
+ // DEBUG: System.err.println(">>> "+a.getName()+" = "+a.getValue());
if (a.getID().equals(BugzillaReportElement.DELTA_TS.getKeyString())) {
value = stripTimeZone(value);
}
diff --git a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaReportElement.java b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaReportElement.java
index e3793385c..5e92462e2 100644
--- a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaReportElement.java
+++ b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaReportElement.java
@@ -34,7 +34,7 @@ public enum BugzillaReportElement {
BUG_WHEN ("bug_when", "bug_when", true, true),
BUGZILLA ("bugzilla", "bugzilla", true),
CC ("CC:", "cc", true, true),
- CCLIST_ACCESSIBLE ("cclist_accessible", "cclist_accessible", true),
+ CCLIST_ACCESSIBLE ("CC List", "cclist_accessible", true),
CLASSIFICATION ("Classification:", "classification", true),
CLASSIFICATION_ID ("Classification ID:", "classification_id", true),
COMPONENT ("Component:", "component", false),
@@ -49,6 +49,7 @@ public enum BugzillaReportElement {
EVERCONFIRMED ("everconfirmed", "everconfirmed", true),
ESTIMATED_TIME ("Estimated Time:", "estimated_time", true),
FILENAME ("filename", "filename"),
+ GROUP ("Group", "group", true, true),
IS_OBSOLETE ("Obsolete", "isobsolete", true),
IS_PATCH("Patch", "ispatch", true),
KEYWORDS ("Keywords:", "keywords", true),
@@ -60,7 +61,7 @@ public enum BugzillaReportElement {
PRODUCT ("Product:", "product", false),
REP_PLATFORM ("Platform:", "rep_platform", false),
REPORTER ("Reporter:", "reporter", true, true),
- REPORTER_ACCESSIBLE ("reporter_accessible", "reporter_accessible", true),
+ REPORTER_ACCESSIBLE ("Reporter", "reporter_accessible", true),
RESOLUTION ("Resolution:", "resolution", false, true), // Exiting bug field, new cc
REMAINING_TIME( "Hours Left:", "remaining_time", true),
SHORT_DESC ("Summary:", "short_desc", true),
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 7e2fa546f..cc3cab5df 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
@@ -39,12 +39,14 @@ import org.eclipse.mylar.tasks.ui.editors.TaskEditor;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.layout.RowLayout;
+import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Label;
@@ -244,52 +246,37 @@ public class BugzillaTaskEditor extends AbstractRepositoryTaskEditor {
addVoting(composite);
- label = toolkit.createLabel(composite, "");
-
- Hyperlink viewActivity = toolkit.createHyperlink(composite, "Show Bug Activity", SWT.NONE);
- viewActivity.addHyperlinkListener(new HyperlinkAdapter() {
- @Override
- public void linkActivated(HyperlinkEvent e) {
- if (BugzillaTaskEditor.this.getEditor() instanceof TaskEditor) {
- TaskEditor mylarTaskEditor = (TaskEditor) BugzillaTaskEditor.this.getEditor();
- mylarTaskEditor.displayInBrowser(repository.getUrl() + IBugzillaConstants.URL_BUG_ACTIVITY
- + taskData.getId());
- }
- }
- });
+// label = toolkit.createLabel(composite, "");
+// Hyperlink viewActivity = toolkit.createHyperlink(composite, "Show Bug Activity", SWT.NONE);
+// viewActivity.addHyperlinkListener(new HyperlinkAdapter() {
+// @Override
+// public void linkActivated(HyperlinkEvent e) {
+// if (BugzillaTaskEditor.this.getEditor() instanceof TaskEditor) {
+// TaskEditor mylarTaskEditor = (TaskEditor) BugzillaTaskEditor.this.getEditor();
+// mylarTaskEditor.displayInBrowser(repository.getUrl() + IBugzillaConstants.URL_BUG_ACTIVITY
+// + taskData.getId());
+// }
+// }
+// });
+
+ // If groups is available add roles
+ if (taskData.getAttribute(BugzillaReportElement.GROUP.getKeyString()) != null) {
+ addRoles(composite);
+ }
if (taskData.getAttribute(BugzillaReportElement.ESTIMATED_TIME.getKeyString()) != null)
addBugzillaTimeTracker(toolkit, composite);
}
- // @Override
- // protected Control createActionsTextClient(Section section) {
- // Hyperlink hyperlink =
- // super.getManagedForm().getToolkit().createHyperlink(section, "Past
- // activity", SWT.NONE);
- // hyperlink.setBackground(section.getBackground());
- // hyperlink.addHyperlinkListener(new HyperlinkAdapter() {
- // @Override
- // public void linkActivated(HyperlinkEvent e) {
- // if (BugzillaTaskEditor.this.getEditor() instanceof TaskEditor) {
- // TaskEditor mylarTaskEditor = (TaskEditor)
- // BugzillaTaskEditor.this.getEditor();
- // mylarTaskEditor.displayInBrowser(repository.getUrl() +
- // IBugzillaConstants.URL_BUG_ACTIVITY
- // + taskData.getId());
- // }
- // }
- // });
- // return hyperlink;
- // }
-
private boolean hasCustomAttributeChanges() {
if (taskData == null)
return false;
String customAttributeKeys[] = { BugzillaReportElement.BUG_FILE_LOC.getKeyString(),
BugzillaReportElement.DEPENDSON.getKeyString(), BugzillaReportElement.BLOCKED.getKeyString(),
- BugzillaReportElement.KEYWORDS.getKeyString(), BugzillaReportElement.VOTES.getKeyString() };
+ BugzillaReportElement.KEYWORDS.getKeyString(), BugzillaReportElement.VOTES.getKeyString(),
+ BugzillaReportElement.REPORTER_ACCESSIBLE.getKeyString(),
+ BugzillaReportElement.CCLIST_ACCESSIBLE.getKeyString() };
for (String key : customAttributeKeys) {
RepositoryTaskAttribute attribute = taskData.getAttribute(key);
if (hasChanged(attribute)) {
@@ -435,12 +422,86 @@ public class BugzillaTaskEditor extends AbstractRepositoryTaskEditor {
}
}
+ protected void addRoles(Composite parent) {
+ Section rolesSection = toolkit.createSection(parent, ExpandableComposite.SHORT_TITLE_BAR);
+ rolesSection.setText("Users in the roles selected below can always view this bug");
+ rolesSection
+ .setDescription("(The assignee can always see a bug, and this section does not take effect unless the bug is restricted to at least one group.)");
+ GridLayout gl = new GridLayout();
+ GridData gd = new GridData(SWT.FILL, SWT.NONE, false, false);
+ gd.horizontalSpan = 4;
+ rolesSection.setLayout(gl);
+ rolesSection.setLayoutData(gd);
+
+ Composite rolesComposite = toolkit.createComposite(rolesSection);
+ GridLayout attributesLayout = new GridLayout();
+ attributesLayout.numColumns = 4;
+ attributesLayout.horizontalSpacing = 5;
+ attributesLayout.verticalSpacing = 4;
+ rolesComposite.setLayout(attributesLayout);
+ GridData attributesData = new GridData(GridData.FILL_BOTH);
+ attributesData.horizontalSpan = 1;
+ attributesData.grabExcessVerticalSpace = false;
+ rolesComposite.setLayoutData(attributesData);
+ rolesSection.setClient(rolesComposite);
+
+ RepositoryTaskAttribute attribute = taskData.getAttribute(BugzillaReportElement.REPORTER_ACCESSIBLE
+ .getKeyString());
+ if (attribute == null) {
+ taskData.setAttributeValue(BugzillaReportElement.REPORTER_ACCESSIBLE.getKeyString(), "0");
+ attribute = taskData.getAttribute(BugzillaReportElement.REPORTER_ACCESSIBLE.getKeyString());
+ }
+ Button button = addButtonField(rolesComposite, attribute, SWT.CHECK);
+ if (hasChanged(attribute)) {
+ button.setBackground(color_backgroundIncoming);
+ }
+
+ attribute = null;
+ attribute = taskData.getAttribute(BugzillaReportElement.CCLIST_ACCESSIBLE.getKeyString());
+ if (attribute == null) {
+ taskData.setAttributeValue(BugzillaReportElement.CCLIST_ACCESSIBLE.getKeyString(), "0");
+ attribute = taskData.getAttribute(BugzillaReportElement.CCLIST_ACCESSIBLE.getKeyString());
+ }
+ button = addButtonField(rolesComposite, attribute, SWT.CHECK);
+ if (hasChanged(attribute)) {
+ button.setBackground(color_backgroundIncoming);
+ }
+ }
+
+ private Button addButtonField(Composite rolesComposite, RepositoryTaskAttribute attribute, int style) {
+ if (attribute == null) {
+ return null;
+ }
+ final Button button = toolkit.createButton(rolesComposite, attribute.getName(), style);
+ if (!attribute.isReadOnly()) {
+ button.setData(attribute);
+ button.setSelection(attribute.getValue().equals("1"));
+ button.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
+ button.addSelectionListener(new SelectionAdapter() {
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ String sel = "1";
+ if (!button.getSelection()) {
+ sel = "0";
+ }
+ RepositoryTaskAttribute a = (RepositoryTaskAttribute) button.getData();
+ if (!(a.getValue().equals(sel))) {
+ a.setValue(sel);
+ markDirty(true);
+ }
+ }
+ });
+ }
+ return button;
+ }
+
protected void addBugzillaTimeTracker(FormToolkit toolkit, Composite parent) {
- Section timeSection = toolkit.createSection(parent, ExpandableComposite.TREE_NODE);
+ Section timeSection = toolkit.createSection(parent, ExpandableComposite.SHORT_TITLE_BAR);
timeSection.setText(LABEL_TIME_TRACKING);
GridLayout gl = new GridLayout();
- GridData gd = new GridData(SWT.FILL, SWT.NONE, true, false);
+ GridData gd = new GridData(SWT.FILL, SWT.NONE, false, false);
gd.horizontalSpan = 4;
timeSection.setLayout(gl);
timeSection.setLayoutData(gd);
@@ -840,6 +901,21 @@ public class BugzillaTaskEditor extends AbstractRepositoryTaskEditor {
urlText.addListener(SWT.FocusIn, new GenericListener());
}
+ protected void addActionButtons(Composite buttonComposite) {
+ super.addActionButtons(buttonComposite);
+ Hyperlink hyperlink = toolkit.createHyperlink(buttonComposite, "Past activity", SWT.NONE);
+ hyperlink.addHyperlinkListener(new HyperlinkAdapter() {
+ @Override
+ public void linkActivated(HyperlinkEvent e) {
+ if (BugzillaTaskEditor.this.getEditor() instanceof TaskEditor) {
+ TaskEditor mylarTaskEditor = (TaskEditor) BugzillaTaskEditor.this.getEditor();
+ mylarTaskEditor.displayInBrowser(repository.getUrl() + IBugzillaConstants.URL_BUG_ACTIVITY
+ + taskData.getId());
+ }
+ }
+ });
+
+ }
// protected void createDescriptionLayout(Composite composite) {
// // This is migration code from 0.6.1 -> 0.6.2
// // Changes to the abstract editor causes the description
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/AbstractRepositoryTaskEditor.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/AbstractRepositoryTaskEditor.java
index 4629eb76a..45a34268b 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/AbstractRepositoryTaskEditor.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/AbstractRepositoryTaskEditor.java
@@ -204,7 +204,7 @@ public abstract class AbstractRepositoryTaskEditor extends TaskFormPage {
protected static final String SECTION_TITLE_PEOPLE = "People";
- private FormToolkit toolkit;
+ protected FormToolkit toolkit;
private ScrolledForm form;
@@ -530,7 +530,7 @@ public abstract class AbstractRepositoryTaskEditor extends TaskFormPage {
// protected abstract void submitToRepository();
- private Color backgroundIncoming;
+ protected Color color_backgroundIncoming;
protected boolean hasAttributeChanges = false;
@@ -555,7 +555,7 @@ public abstract class AbstractRepositoryTaskEditor extends TaskFormPage {
protected void createFormContent(final IManagedForm managedForm) {
IThemeManager themeManager = getSite().getWorkbenchWindow().getWorkbench().getThemeManager();
- backgroundIncoming = themeManager.getCurrentTheme().getColorRegistry().get(
+ color_backgroundIncoming = themeManager.getCurrentTheme().getColorRegistry().get(
TaskListColorsAndFonts.THEME_COLOR_TASKS_INCOMING_BACKGROUND);
super.createFormContent(managedForm);
@@ -696,7 +696,7 @@ public abstract class AbstractRepositoryTaskEditor extends TaskFormPage {
});
}
if (hasChanged(attribute)) {
- text.setBackground(backgroundIncoming);
+ text.setBackground(color_backgroundIncoming);
}
return text;
}
@@ -750,7 +750,7 @@ public abstract class AbstractRepositoryTaskEditor extends TaskFormPage {
attributeCombo.setFont(TEXT_FONT);
if (hasChanged(attribute)) {
- attributeCombo.setBackground(backgroundIncoming);
+ attributeCombo.setBackground(color_backgroundIncoming);
}
attributeCombo.setLayoutData(data);
for (String val : values) {
@@ -1377,7 +1377,7 @@ public abstract class AbstractRepositoryTaskEditor extends TaskFormPage {
}
if (hasChanged(taskData.getAttribute(RepositoryTaskAttribute.DESCRIPTION))) {
- descriptionTextViewer.getTextWidget().setBackground(backgroundIncoming);
+ descriptionTextViewer.getTextWidget().setBackground(color_backgroundIncoming);
}
descriptionTextViewer.getTextWidget().addListener(SWT.FocusIn, new DescriptionListener());
@@ -1468,7 +1468,7 @@ public abstract class AbstractRepositoryTaskEditor extends TaskFormPage {
ccListData.heightHint = 95;
ccList.setLayoutData(ccListData);
if (hasChanged(taskData.getAttribute(RepositoryTaskAttribute.USER_CC))) {
- ccList.setBackground(backgroundIncoming);
+ ccList.setBackground(color_backgroundIncoming);
}
java.util.List<String> ccs = taskData.getCC();
if (ccs != null) {
@@ -1611,9 +1611,9 @@ public abstract class AbstractRepositoryTaskEditor extends TaskFormPage {
if (commentDate != null
&& (commentDate.after(calLastMod.getTime()) || commentDate.equals(calLastMod.getTime()))) {
expandableComposite.setExpanded(true);
- expandableComposite.setBackground(backgroundIncoming);
+ expandableComposite.setBackground(color_backgroundIncoming);
if (expandableComposite.getTextClient() != null) {
- expandableComposite.getTextClient().setBackground(backgroundIncoming);
+ expandableComposite.getTextClient().setBackground(color_backgroundIncoming);
}
}
}
@@ -1715,7 +1715,6 @@ public abstract class AbstractRepositoryTaskEditor extends TaskFormPage {
protected void createActionsLayout(Composite composite) {
Section section = createSection(composite, LABEL_SECTION_ACTIONS);
GridDataFactory.fillDefaults().align(SWT.FILL, SWT.TOP).grab(true, true).applyTo(section);
- section.setTextClient(createActionsTextClient(section));
Composite buttonComposite = toolkit.createComposite(section);
GridLayout buttonLayout = new GridLayout();
GridDataFactory.fillDefaults().align(SWT.FILL, SWT.TOP).applyTo(buttonComposite);
@@ -1726,13 +1725,6 @@ public abstract class AbstractRepositoryTaskEditor extends TaskFormPage {
section.setClient(buttonComposite);
}
- /**
- * Override to contribute controls to Action section's title area
- */
- protected Control createActionsTextClient(Section section) {
- return null;
- }
-
protected Section createSection(Composite composite, String title) {
Section section = toolkit.createSection(composite, ExpandableComposite.TITLE_BAR | Section.TWISTIE);
section.setText(title);

Back to the top