Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorspingel2011-05-17 23:40:16 +0000
committerspingel2011-05-17 23:40:16 +0000
commitdb518e8f0cf6759e4e0f1395412b3c7b87ca92dd (patch)
treee238670d6435efafe2d7a010d242d982a165adb5 /org.eclipse.mylyn.tasks.ui
parent7624b813def465b75e15f94578b07eedde65f943 (diff)
downloadorg.eclipse.mylyn.tasks-db518e8f0cf6759e4e0f1395412b3c7b87ca92dd.tar.gz
org.eclipse.mylyn.tasks-db518e8f0cf6759e4e0f1395412b3c7b87ca92dd.tar.xz
org.eclipse.mylyn.tasks-db518e8f0cf6759e4e0f1395412b3c7b87ca92dd.zip
RESOLVED - bug 345909: [regression] priority editor doesn't show new value
https://bugs.eclipse.org/bugs/show_bug.cgi?id=345909
Diffstat (limited to 'org.eclipse.mylyn.tasks.ui')
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/BooleanAttributeEditor.java12
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/CheckboxMultiSelectAttributeEditor.java63
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/LongTextAttributeEditor.java9
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/MultiSelectionAttributeEditor.java15
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/RichTextAttributeEditor.java11
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TextAttributeEditor.java11
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/UserAttributeEditor.java6
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/AbstractAttributeEditor.java11
8 files changed, 74 insertions, 64 deletions
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/BooleanAttributeEditor.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/BooleanAttributeEditor.java
index b1433a274..51a15ae97 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/BooleanAttributeEditor.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/BooleanAttributeEditor.java
@@ -30,6 +30,8 @@ public class BooleanAttributeEditor extends AbstractAttributeEditor {
private boolean ignoreNotification;
+ private boolean suppressRefresh;
+
public BooleanAttributeEditor(TaskDataModel manager, TaskAttribute taskAttribute) {
super(manager, taskAttribute);
}
@@ -42,7 +44,12 @@ public class BooleanAttributeEditor extends AbstractAttributeEditor {
@Override
public void widgetSelected(SelectionEvent e) {
if (!ignoreNotification) {
- setValue(button.getSelection());
+ try {
+ suppressRefresh = true;
+ setValue(button.getSelection());
+ } finally {
+ suppressRefresh = false;
+ }
}
}
});
@@ -81,6 +88,7 @@ public class BooleanAttributeEditor extends AbstractAttributeEditor {
@Override
public boolean shouldAutoRefresh() {
- return true;
+ return !suppressRefresh;
}
+
}
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 cbf0d4ea7..26c3c958c 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
@@ -58,7 +58,7 @@ public class CheckboxMultiSelectAttributeEditor extends AbstractAttributeEditor
private Button button;
- private boolean cflowSelect;
+ private boolean suppressRefresh;
public CheckboxMultiSelectAttributeEditor(TaskDataModel manager, TaskAttribute taskAttribute) {
super(manager, taskAttribute);
@@ -73,7 +73,7 @@ public class CheckboxMultiSelectAttributeEditor extends AbstractAttributeEditor
toolkit.adapt(valueText, false, false);
valueText.setData(FormToolkit.KEY_DRAW_BORDER, Boolean.FALSE);
valueText.setToolTipText(getDescription());
- updateText();
+ refresh();
setControl(valueText);
} else {
this.parent = parent;
@@ -110,23 +110,23 @@ public class CheckboxMultiSelectAttributeEditor extends AbstractAttributeEditor
selectionDialog.addEventListener(new IInPlaceDialogListener() {
public void buttonPressed(InPlaceDialogEvent event) {
- cflowSelect = true;
+ suppressRefresh = true;
try {
if (event.getReturnCode() == Window.OK) {
Set<String> newValues = selectionDialog.getSelectedValues();
if (!new HashSet<String>(values).equals(newValues)) {
setValues(new ArrayList<String>(newValues));
- updateText();
+ refresh();
}
} else if (event.getReturnCode() == AbstractInPlaceDialog.ID_CLEAR) {
Set<String> newValues = new HashSet<String>();
if (!new HashSet<String>(values).equals(newValues)) {
setValues(new ArrayList<String>(newValues));
- updateText();
+ refresh();
}
}
} finally {
- cflowSelect = false;
+ suppressRefresh = false;
}
}
});
@@ -134,35 +134,11 @@ public class CheckboxMultiSelectAttributeEditor extends AbstractAttributeEditor
}
});
toolkit.adapt(valueText, false, false);
- updateText();
+ refresh();
setControl(composite);
}
}
- private void updateText() {
- if (valueText != null && !valueText.isDisposed()) {
- StringBuilder valueString = new StringBuilder();
- List<String> values = getValuesLabels();
- Collections.sort(values);
- for (int i = 0; i < values.size(); i++) {
- valueString.append(values.get(i));
- if (i != values.size() - 1) {
- valueString.append(", "); //$NON-NLS-1$
- }
- }
- valueText.setText(valueString.toString());
- if (valueText != null && parent != null && parent.getParent() != null
- && parent.getParent().getParent() != null) {
- Point size = valueText.getSize();
- // subtract 1 from size for border
- Point newSize = valueText.computeSize(size.x - 1, SWT.DEFAULT);
- if (newSize.y != size.y) {
- reflow();
- }
- }
- }
- }
-
/**
* Update scroll bars of the enclosing form.
*
@@ -222,13 +198,32 @@ public class CheckboxMultiSelectAttributeEditor extends AbstractAttributeEditor
@Override
public void refresh() {
- if (!cflowSelect) {
- updateText();
+ if (valueText == null || valueText.isDisposed()) {
+ return;
+ }
+
+ StringBuilder valueString = new StringBuilder();
+ List<String> values = getValuesLabels();
+ Collections.sort(values);
+ for (int i = 0; i < values.size(); i++) {
+ valueString.append(values.get(i));
+ if (i != values.size() - 1) {
+ valueString.append(", "); //$NON-NLS-1$
+ }
+ }
+ valueText.setText(valueString.toString());
+ if (valueText != null && parent != null && parent.getParent() != null && parent.getParent().getParent() != null) {
+ Point size = valueText.getSize();
+ // subtract 1 from size for border
+ Point newSize = valueText.computeSize(size.x - 1, SWT.DEFAULT);
+ if (newSize.y != size.y) {
+ reflow();
+ }
}
}
@Override
public boolean shouldAutoRefresh() {
- return true;
+ return !suppressRefresh;
}
}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/LongTextAttributeEditor.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/LongTextAttributeEditor.java
index 66c8fef23..d581f8e41 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/LongTextAttributeEditor.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/LongTextAttributeEditor.java
@@ -68,12 +68,7 @@ public class LongTextAttributeEditor extends AbstractAttributeEditor {
text.setData(FormToolkit.KEY_DRAW_BORDER, FormToolkit.TREE_BORDER);
text.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
- try {
- cflowModify = true;
- setValue(text.getText());
- } finally {
- cflowModify = false;
- }
+ setValue(text.getText());
CommonFormUtil.ensureVisible(text);
}
});
@@ -93,7 +88,7 @@ public class LongTextAttributeEditor extends AbstractAttributeEditor {
@Override
public void refresh() {
- if (!cflowModify && viewer.getTextWidget() != null && !viewer.getTextWidget().isDisposed()) {
+ if (viewer.getTextWidget() != null && !viewer.getTextWidget().isDisposed()) {
viewer.getDocument().set(getValue());
}
}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/MultiSelectionAttributeEditor.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/MultiSelectionAttributeEditor.java
index 50443f72d..53af1dfb7 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/MultiSelectionAttributeEditor.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/MultiSelectionAttributeEditor.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2009 Tasktop Technologies and others.
+ * Copyright (c) 2008, 2009 Tasktop Technologies 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
@@ -29,7 +29,6 @@ import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.List;
import org.eclipse.swt.widgets.Text;
-import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.forms.widgets.FormToolkit;
/**
@@ -43,6 +42,8 @@ public class MultiSelectionAttributeEditor extends AbstractAttributeEditor {
private List list;
+ protected boolean suppressRefresh;
+
public MultiSelectionAttributeEditor(TaskDataModel manager, TaskAttribute taskAttribute) {
super(manager, taskAttribute);
if (isReadOnly()) {
@@ -54,7 +55,6 @@ public class MultiSelectionAttributeEditor extends AbstractAttributeEditor {
@Override
public void createControl(Composite parent, FormToolkit toolkit) {
-
if (isReadOnly()) {
text = new Text(parent, SWT.FLAT | SWT.READ_ONLY | SWT.WRAP);
text.setFont(EditorUtil.TEXT_FONT);
@@ -87,7 +87,12 @@ public class MultiSelectionAttributeEditor extends AbstractAttributeEditor {
Assert.isLegal(index >= 0 && index <= allValues.length - 1);
selectedValues[i] = allValues[index];
}
- setValues(selectedValues);
+ try {
+ suppressRefresh = true;
+ setValues(selectedValues);
+ } finally {
+ suppressRefresh = false;
+ }
}
});
list.showSelection();
@@ -164,6 +169,6 @@ public class MultiSelectionAttributeEditor extends AbstractAttributeEditor {
@Override
public boolean shouldAutoRefresh() {
- return true;
+ return !suppressRefresh;
}
}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/RichTextAttributeEditor.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/RichTextAttributeEditor.java
index 269521a3b..9d774b911 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/RichTextAttributeEditor.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/RichTextAttributeEditor.java
@@ -41,6 +41,8 @@ public class RichTextAttributeEditor extends AbstractAttributeEditor {
protected boolean ignoreNotification;
+ protected boolean suppressRefresh;
+
public RichTextAttributeEditor(TaskDataModel manager, TaskRepository taskRepository, TaskAttribute taskAttribute) {
this(manager, taskRepository, taskAttribute, SWT.MULTI);
}
@@ -57,7 +59,12 @@ public class RichTextAttributeEditor extends AbstractAttributeEditor {
@Override
public void valueChanged(String value) {
if (!ignoreNotification) {
- RichTextAttributeEditor.this.setValue(value);
+ try {
+ suppressRefresh = true;
+ RichTextAttributeEditor.this.setValue(value);
+ } finally {
+ suppressRefresh = false;
+ }
}
};
};
@@ -175,7 +182,7 @@ public class RichTextAttributeEditor extends AbstractAttributeEditor {
@Override
public boolean shouldAutoRefresh() {
- return true;
+ return !suppressRefresh;
}
@Override
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TextAttributeEditor.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TextAttributeEditor.java
index 769ab6738..56bce4442 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TextAttributeEditor.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TextAttributeEditor.java
@@ -32,7 +32,7 @@ public class TextAttributeEditor extends AbstractAttributeEditor {
private Text text;
- private boolean cflowModifyText;
+ private boolean suppressRefresh;
public TextAttributeEditor(TaskDataModel manager, TaskAttribute taskAttribute) {
super(manager, taskAttribute);
@@ -58,11 +58,11 @@ public class TextAttributeEditor extends AbstractAttributeEditor {
text.setToolTipText(getDescription());
text.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
- cflowModifyText = true;// prevent infinite recursion and also prevent resetting the caret location
try {
+ suppressRefresh = true;
setValue(text.getText());
} finally {
- cflowModifyText = false;
+ suppressRefresh = false;
}
CommonFormUtil.ensureVisible(text);
}
@@ -83,13 +83,14 @@ public class TextAttributeEditor extends AbstractAttributeEditor {
@Override
public void refresh() {
- if (!cflowModifyText && text != null && !text.isDisposed()) {
+ if (text != null && !text.isDisposed()) {
text.setText(getValue());
}
}
@Override
public boolean shouldAutoRefresh() {
- return true;
+ return !suppressRefresh;
}
+
}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/UserAttributeEditor.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/UserAttributeEditor.java
index 0655aa346..bc978a90a 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/UserAttributeEditor.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/UserAttributeEditor.java
@@ -118,6 +118,12 @@ public class UserAttributeEditor extends AbstractAttributeEditor {
}
@Override
+ protected boolean shouldAutoRefresh() {
+ // do not auto refresh to avoid picking up partially entered accounts
+ return false;
+ }
+
+ @Override
public void refresh() {
if (label.isDisposed()) {
return;
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/AbstractAttributeEditor.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/AbstractAttributeEditor.java
index 25f2ca313..4c7ccac3c 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/AbstractAttributeEditor.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/AbstractAttributeEditor.java
@@ -63,7 +63,7 @@ public abstract class AbstractAttributeEditor {
private final TaskDataModelListener modelListener = new TaskDataModelListener() {
@Override
public void attributeChanged(TaskDataModelEvent event) {
- if (!ignoreAttributeChanged && shouldAutoRefresh() && getTaskAttribute().equals(event.getTaskAttribute())) {
+ if (shouldAutoRefresh() && getTaskAttribute().equals(event.getTaskAttribute())) {
try {
refresh();
} catch (UnsupportedOperationException e) {
@@ -78,8 +78,6 @@ public abstract class AbstractAttributeEditor {
}
};
- private boolean ignoreAttributeChanged;
-
/**
* @since 3.0
*/
@@ -98,12 +96,7 @@ public abstract class AbstractAttributeEditor {
* @since 3.0
*/
protected void attributeChanged() {
- try {
- ignoreAttributeChanged = true;
- getModel().attributeChanged(getTaskAttribute());
- } finally {
- ignoreAttributeChanged = false;
- }
+ getModel().attributeChanged(getTaskAttribute());
}
/**

Back to the top