Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSam Davis2016-06-16 20:07:07 -0400
committerSam Davis2016-06-30 14:58:30 -0400
commit5d02737c1f258c88b2d5c1f02cef777dd8d7226a (patch)
tree45144ece21ce225c582e5a8a83d2582952c915c3
parent3340bc73cf3c1c381b3cb4133f5f7c97e626ce88 (diff)
downloadorg.eclipse.mylyn.tasks-e_4_5_m_3_20_x.tar.gz
org.eclipse.mylyn.tasks-e_4_5_m_3_20_x.tar.xz
org.eclipse.mylyn.tasks-e_4_5_m_3_20_x.zip
[3.20.x] 452674: mark task editor parts dirty when their attributes changee_4_5_m_3_20_x
This will cause the task editor's form to report that it's dirty, which will make the isDirty check in AbstractTaskEditorPage.initModel() work. Change-Id: I4686b1bea0a62bf346ea6dfbef1a27ba28455e55 Task-Url: https://bugs.eclipse.org/bugs/show_bug.cgi?id=452674
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/AbstractTaskEditorPart.java23
1 files changed, 20 insertions, 3 deletions
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/AbstractTaskEditorPart.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/AbstractTaskEditorPart.java
index de93f6082..7f1a0d665 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/AbstractTaskEditorPart.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/AbstractTaskEditorPart.java
@@ -11,6 +11,9 @@
package org.eclipse.mylyn.tasks.ui.editors;
+import java.util.HashSet;
+import java.util.Set;
+
import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.LegacyActionTools;
import org.eclipse.jface.action.ToolBarManager;
@@ -23,6 +26,8 @@ import org.eclipse.mylyn.internal.tasks.ui.editors.RichTextAttributeEditor;
import org.eclipse.mylyn.tasks.core.data.TaskAttribute;
import org.eclipse.mylyn.tasks.core.data.TaskData;
import org.eclipse.mylyn.tasks.core.data.TaskDataModel;
+import org.eclipse.mylyn.tasks.core.data.TaskDataModelEvent;
+import org.eclipse.mylyn.tasks.core.data.TaskDataModelListener;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.layout.GridData;
@@ -40,7 +45,7 @@ import org.eclipse.ui.forms.widgets.Section;
*/
public abstract class AbstractTaskEditorPart extends AbstractFormPart {
- // the default font of some controls, e.g. radio buttons, is too big; set this font explicitly on the control
+ // the default font of some controls, e.g. radio buttons, is too big; set this font explicitly on the control
protected static final Font TEXT_FONT = JFaceResources.getDefaultFont();
private Control control;
@@ -55,6 +60,8 @@ public abstract class AbstractTaskEditorPart extends AbstractFormPart {
private MaximizePartAction maximizePartAction;
+ private final Set<String> attributeIds = new HashSet<>();
+
public AbstractTaskEditorPart() {
}
@@ -71,6 +78,7 @@ public abstract class AbstractTaskEditorPart extends AbstractFormPart {
boolean spellChecking = getTaskEditorPage().getAttributeEditorToolkit().hasSpellChecking(attribute);
((RichTextAttributeEditor) editor).setSpellCheckingEnabled(spellChecking);
}
+ attributeIds.add(attribute.getId());
return editor;
}
return null;
@@ -121,6 +129,15 @@ public abstract class AbstractTaskEditorPart extends AbstractFormPart {
public void initialize(AbstractTaskEditorPage taskEditorPage) {
this.taskEditorPage = taskEditorPage;
+ getModel().addModelListener(new TaskDataModelListener() {
+
+ @Override
+ public void attributeChanged(TaskDataModelEvent event) {
+ if (attributeIds.contains(event.getTaskAttribute().getId())) {
+ markDirty();
+ }
+ }
+ });
}
public void setControl(Control control) {
@@ -176,7 +193,7 @@ public abstract class AbstractTaskEditorPart extends AbstractFormPart {
/**
* Returns an action for maximizing the part.
- *
+ *
* @since 3.5
*/
protected Action getMaximizePartAction() {
@@ -188,7 +205,7 @@ public abstract class AbstractTaskEditorPart extends AbstractFormPart {
/**
* Returns the control that determines the size of the part.
- *
+ *
* @see #getMaximizePartAction()
* @since 3.5
*/

Back to the top