From 30531b319d3bdddf08a14432e3c2a17e842c9906 Mon Sep 17 00:00:00 2001 From: relves Date: Sat, 17 Feb 2007 03:30:26 +0000 Subject: NEW - bug 158921: improve task editor information density https://bugs.eclipse.org/bugs/show_bug.cgi?id=158921 --- .../bugzilla/ui/editor/BugzillaTaskEditor.java | 32 +++--------- .../ui/editors/AbstractRepositoryTaskEditor.java | 60 +++++++++++++--------- 2 files changed, 42 insertions(+), 50 deletions(-) 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 08221aa38..29164509d 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,6 +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.editor.FormEditor; import org.eclipse.ui.forms.events.HyperlinkAdapter; import org.eclipse.ui.forms.events.HyperlinkEvent; @@ -115,17 +116,10 @@ public class BugzillaTaskEditor extends AbstractRepositoryTaskEditor { @Override protected void createCustomAttributeLayout(Composite composite) { - // FormToolkit toolkit = getManagedForm().getToolkit(); RepositoryTaskAttribute attribute = this.taskData.getAttribute(BugzillaReportElement.DEPENDSON.getKeyString()); - if (attribute != null && !attribute.isReadOnly()) { - Label label; - if (hasOutgoingChange(attribute)) { - label = toolkit.createLabel(composite, "*" + BugzillaReportElement.DEPENDSON.toString()); - } else { - label = toolkit.createLabel(composite, BugzillaReportElement.DEPENDSON.toString()); - } - + if (attribute != null && !attribute.isReadOnly()) { + Label label = createLabel(composite, attribute); GridDataFactory.fillDefaults().align(SWT.RIGHT, SWT.CENTER).applyTo(label); Composite textFieldComposite = toolkit.createComposite(composite); GridLayout textLayout = new GridLayout(); @@ -144,12 +138,7 @@ public class BugzillaTaskEditor extends AbstractRepositoryTaskEditor { attribute = this.taskData.getAttribute(BugzillaReportElement.BLOCKED.getKeyString()); if (attribute != null && !attribute.isReadOnly()) { - Label label; - if (hasOutgoingChange(attribute)) { - label = toolkit.createLabel(composite, "*" + BugzillaReportElement.BLOCKED.toString()); - } else { - label = toolkit.createLabel(composite, BugzillaReportElement.BLOCKED.toString()); - } + Label label = createLabel(composite, attribute); GridDataFactory.fillDefaults().align(SWT.RIGHT, SWT.CENTER).applyTo(label); Composite textFieldComposite = toolkit.createComposite(composite); GridLayout textLayout = new GridLayout(); @@ -218,12 +207,7 @@ public class BugzillaTaskEditor extends AbstractRepositoryTaskEditor { attribute = this.taskData.getAttribute(BugzillaReportElement.BUG_FILE_LOC.getKeyString()); if (attribute != null && !attribute.isReadOnly()) { - Label label; - if (hasOutgoingChange(attribute)) { - label = toolkit.createLabel(composite, "*" + BugzillaReportElement.BUG_FILE_LOC.toString()); - } else { - label = toolkit.createLabel(composite, BugzillaReportElement.BUG_FILE_LOC.toString()); - } + Label label = createLabel(composite, attribute); GridDataFactory.fillDefaults().align(SWT.RIGHT, SWT.CENTER).applyTo(label); Text urlField = createTextField(composite, attribute, SWT.FLAT); GridDataFactory.fillDefaults().hint(135, SWT.DEFAULT).applyTo(urlField); @@ -268,7 +252,6 @@ public class BugzillaTaskEditor extends AbstractRepositoryTaskEditor { } private void addBugHyperlinks(Composite composite, String key) { - FormToolkit toolkit = getManagedForm().getToolkit(); Composite hyperlinksComposite = toolkit.createComposite(composite); RowLayout rowLayout = new RowLayout(); rowLayout.marginBottom = 0; @@ -490,8 +473,7 @@ public class BugzillaTaskEditor extends AbstractRepositoryTaskEditor { if (attribute == null) return; String keywords = attribute.getValue(); - FormToolkit toolkit = getManagedForm().getToolkit(); - Label label = toolkit.createLabel(attributesComposite, "Keywords:"); + Label label = createLabel(attributesComposite, attribute); GridDataFactory.fillDefaults().align(SWT.RIGHT, SWT.CENTER).applyTo(label); // toolkit.createText(attributesComposite, keywords) @@ -552,8 +534,8 @@ public class BugzillaTaskEditor extends AbstractRepositoryTaskEditor { } protected void addVoting(Composite attributesComposite) { - FormToolkit toolkit = getManagedForm().getToolkit(); Label label = toolkit.createLabel(attributesComposite, "Votes:"); + label.setForeground(toolkit.getColors().getColor(IFormColors.TB_TOGGLE)); 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.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 552c1c26e..338b38132 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 @@ -765,23 +765,23 @@ public abstract class AbstractRepositoryTaskEditor extends TaskFormPage { headerLayout.horizontalSpacing = 6; headerInfoComposite.setLayout(headerLayout); + + RepositoryTaskAttribute statusAtribute = taskData.getAttribute(RepositoryTaskAttribute.STATUS); - if (statusAtribute != null) { - createLabel(headerInfoComposite, statusAtribute);// .setFont(TITLE_FONT); - createTextField(headerInfoComposite, statusAtribute, SWT.NONE | SWT.READ_ONLY); - } + addNameValue(headerInfoComposite, statusAtribute); RepositoryTaskAttribute priorityAttribute = taskData.getAttribute(RepositoryTaskAttribute.PRIORITY); - if (priorityAttribute != null) { - createLabel(headerInfoComposite, priorityAttribute);// .setFont(TITLE_FONT); - createTextField(headerInfoComposite, priorityAttribute, SWT.NONE | SWT.READ_ONLY); - } + addNameValue(headerInfoComposite, priorityAttribute); String idLabel = (repositoryTask != null) ? repositoryTask.getIdentifyingLabel() : taskData.getId(); if (idLabel != null) { - toolkit.createLabel(headerInfoComposite, "ID:");// .setFont(TITLE_FONT); - toolkit.createText(headerInfoComposite, idLabel, SWT.FLAT | SWT.READ_ONLY); + + Composite nameValue = toolkit.createComposite(headerInfoComposite); + nameValue.setLayout(new GridLayout(2, false)); + toolkit.createLabel(nameValue, "ID:");// .setFont(TITLE_FONT); + toolkit.createText(nameValue, idLabel, SWT.FLAT | SWT.READ_ONLY); } + String openedDateString = ""; String modifiedDateString = ""; @@ -798,14 +798,18 @@ public abstract class AbstractRepositoryTaskEditor extends TaskFormPage { RepositoryTaskAttribute creationAttribute = taskData.getAttribute(RepositoryTaskAttribute.DATE_CREATION); if (creationAttribute != null) { - createLabel(headerInfoComposite, creationAttribute);// .setFont(TITLE_FONT); - toolkit.createText(headerInfoComposite, openedDateString, SWT.FLAT | SWT.READ_ONLY); + Composite nameValue = toolkit.createComposite(headerInfoComposite); + nameValue.setLayout(new GridLayout(2, false)); + createLabel(nameValue, creationAttribute); + toolkit.createText(nameValue, openedDateString, SWT.FLAT | SWT.READ_ONLY); } RepositoryTaskAttribute modifiedAttribute = taskData.getAttribute(RepositoryTaskAttribute.DATE_MODIFIED); - if (modifiedAttribute != null) { - createLabel(headerInfoComposite, modifiedAttribute);// .setFont(TITLE_FONT); - toolkit.createText(headerInfoComposite, modifiedDateString, SWT.FLAT | SWT.READ_ONLY); + if (modifiedAttribute != null) { + Composite nameValue = toolkit.createComposite(headerInfoComposite); + nameValue.setLayout(new GridLayout(2, false)); + createLabel(nameValue, modifiedAttribute); + toolkit.createText(nameValue, modifiedDateString, SWT.FLAT | SWT.READ_ONLY); } if (getActivityUrl() != null) { @@ -824,6 +828,15 @@ public abstract class AbstractRepositoryTaskEditor extends TaskFormPage { // SWT.DEFAULT).align(SWT.RIGHT, SWT.DEFAULT).applyTo(hyperlink); } } + + private void addNameValue(Composite parent, RepositoryTaskAttribute attribute) { + Composite nameValue = toolkit.createComposite(parent); + nameValue.setLayout(new GridLayout(2, false)); + if (attribute != null) { + createLabel(nameValue, attribute);// .setFont(TITLE_FONT); + createTextField(nameValue, attribute, SWT.NONE | SWT.READ_ONLY); + } + } /** * Utility method to create text field sets backgournd to @@ -867,6 +880,7 @@ public abstract class AbstractRepositoryTaskEditor extends TaskFormPage { } else { label = toolkit.createLabel(composite, attribute.getName()); } + label.setForeground(toolkit.getColors().getColor(IFormColors.TB_TOGGLE)); return label; } @@ -905,7 +919,6 @@ public abstract class AbstractRepositoryTaskEditor extends TaskFormPage { int currentCol = 1; for (RepositoryTaskAttribute attribute : taskData.getAttributes()) { - String name = attribute.getName(); String value = ""; value = checkText(attribute.getValue()); if (attribute.isHidden()) @@ -921,10 +934,7 @@ public abstract class AbstractRepositoryTaskEditor extends TaskFormPage { data.horizontalIndent = HORZ_INDENT; if (attribute.hasOptions() && !attribute.isReadOnly()) { - if (hasOutgoingChange(attribute)) { - name = "*" + name; - } - Label label = toolkit.createLabel(attributesComposite, name); + Label label = createLabel(attributesComposite, attribute); GridDataFactory.fillDefaults().align(SWT.RIGHT, SWT.CENTER).applyTo(label); attributeCombo = new CCombo(attributesComposite, SWT.FLAT | SWT.READ_ONLY); toolkit.adapt(attributeCombo, true, true); @@ -945,7 +955,7 @@ public abstract class AbstractRepositoryTaskEditor extends TaskFormPage { comboListenerMap.put(attributeCombo, attribute); currentCol += 2; } else { - Label label = toolkit.createLabel(attributesComposite, name); + Label label = createLabel(attributesComposite, attribute); GridDataFactory.fillDefaults().align(SWT.RIGHT, SWT.CENTER).applyTo(label); Composite textFieldComposite = toolkit.createComposite(attributesComposite); GridLayout textLayout = new GridLayout(); @@ -1723,7 +1733,7 @@ public abstract class AbstractRepositoryTaskEditor extends TaskFormPage { foundNew = true; } - expandableComposite .setTitleBarForeground(toolkit.getColors().getColor(IFormColors.TB_TOGGLE)); + expandableComposite.setTitleBarForeground(toolkit.getColors().getColor(IFormColors.TB_TOGGLE)); expandableComposite.setText(taskComment.getNumber() + ": " + taskComment.getAuthorName() + ", " + taskComment.getCreated()); @@ -2012,7 +2022,7 @@ public abstract class AbstractRepositoryTaskEditor extends TaskFormPage { } @Override - public void dispose() { + public void dispose() { TasksUiPlugin.getTaskListManager().getTaskList().removeChangeListener(TASKLIST_CHANGE_LISTENER); getSite().getPage().removeSelectionListener(selectionListener); if (waitCursor != null) { @@ -2024,8 +2034,8 @@ public abstract class AbstractRepositoryTaskEditor extends TaskFormPage { // Must discard these unsaved changes TasksUiPlugin.getSynchronizationManager().discardOutgoing(repositoryTask); repositoryTask.setDirty(false); - } - + } + super.dispose(); } -- cgit v1.2.3