diff options
author | spingel | 2009-09-17 20:49:51 +0000 |
---|---|---|
committer | spingel | 2009-09-17 20:49:51 +0000 |
commit | 5d4d97fc18f4fb5a524d49e468077d5986076984 (patch) | |
tree | 496a1fd055a4fd546151e894bd44720ffb953dc5 | |
parent | 91c382de32a2d92dc0fe615834934ee3093f0d25 (diff) | |
download | org.eclipse.mylyn.tasks-5d4d97fc18f4fb5a524d49e468077d5986076984.tar.gz org.eclipse.mylyn.tasks-5d4d97fc18f4fb5a524d49e468077d5986076984.tar.xz org.eclipse.mylyn.tasks-5d4d97fc18f4fb5a524d49e468077d5986076984.zip |
RESOLVED - bug 279334: make the bugzilla keywords attribute editor usable by other connectors
https://bugs.eclipse.org/bugs/show_bug.cgi?id=279334
2 files changed, 17 insertions, 12 deletions
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/CheckboxMultiSelectAttributeEditor.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/CheckboxMultiSelectAttributeEditor.java index 94c738d38..111c1ac36 100644 --- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/CheckboxMultiSelectAttributeEditor.java +++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/CheckboxMultiSelectAttributeEditor.java @@ -18,8 +18,10 @@ import java.util.List; import java.util.Map; import java.util.Set; +import org.eclipse.jface.layout.GridDataFactory; import org.eclipse.jface.window.Window; import org.eclipse.mylyn.internal.provisional.commons.ui.CheckBoxTreeDialog; +import org.eclipse.mylyn.internal.provisional.commons.ui.CommonImages; import org.eclipse.mylyn.internal.provisional.commons.ui.WorkbenchUtil; import org.eclipse.mylyn.tasks.core.data.TaskAttribute; import org.eclipse.mylyn.tasks.core.data.TaskDataModel; @@ -33,12 +35,12 @@ import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.graphics.Color; import org.eclipse.swt.graphics.Point; -import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Text; +import org.eclipse.swt.widgets.ToolBar; +import org.eclipse.swt.widgets.ToolItem; import org.eclipse.ui.forms.widgets.FormToolkit; import org.eclipse.ui.forms.widgets.Section; import org.eclipse.ui.forms.widgets.SharedScrolledComposite; @@ -67,25 +69,23 @@ public class CheckboxMultiSelectAttributeEditor extends AbstractAttributeEditor composite.setLayout(layout); valueText = toolkit.createText(composite, "", SWT.FLAT | SWT.WRAP); //$NON-NLS-1$ + GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false).applyTo(valueText); valueText.setFont(EditorUtil.TEXT_FONT); - - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - valueText.setLayoutData(gd); valueText.setEditable(false); - Button changeValueButton = toolkit.createButton(composite, Messages.CheckboxMultiSelectAttributeEditor_Edit, - SWT.FLAT); - gd = new GridData(); - changeValueButton.setLayoutData(gd); - changeValueButton.addSelectionListener(new SelectionAdapter() { + + ToolBar toolBar = new ToolBar(composite, SWT.FLAT); + ToolItem item = new ToolItem(toolBar, SWT.FLAT); + item.setImage(CommonImages.getImage(CommonImages.EDIT)); + item.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { List<String> values = getValues(); Map<String, String> validValues = getAttributeMapper().getOptions(getTaskAttribute()); CheckBoxTreeDialog selectionDialog = new CheckBoxTreeDialog(WorkbenchUtil.getShell(), values, - validValues, NLS.bind(Messages.CheckboxMultiSelectAttributeEditor_Select_X, getLabel())); + validValues, NLS.bind(Messages.CheckboxMultiSelectAttributeEditor_Select_X, + EditorUtil.removeColon(getLabel()))); int responseCode = selectionDialog.open(); - if (responseCode == Window.OK) { Set<String> newValues = selectionDialog.getSelectedValues(); if (!new HashSet<String>(values).equals(newValues)) { diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/EditorUtil.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/EditorUtil.java index ed274e449..21d5fa13b 100644 --- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/EditorUtil.java +++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/EditorUtil.java @@ -503,4 +503,9 @@ public class EditorUtil { } } + public static String removeColon(String label) { + label = label.trim(); + return (label.endsWith(":")) ? label.substring(0, label.length() - 1) : label; //$NON-NLS-1$ + } + } |