Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsminto2010-02-04 18:53:46 -0500
committersminto2010-02-04 18:53:46 -0500
commit97ca9e3287d9466a1f30a1b3cf4a9c42e3f5a2a8 (patch)
treeecfd8738c483cf72f532635c4310e2cdff20f67d /org.eclipse.mylyn.tasks.core
parent4ab5bde168b73a6463b910ebc592b7ed361fde54 (diff)
downloadorg.eclipse.mylyn.tasks-97ca9e3287d9466a1f30a1b3cf4a9c42e3f5a2a8.tar.gz
org.eclipse.mylyn.tasks-97ca9e3287d9466a1f30a1b3cf4a9c42e3f5a2a8.tar.xz
org.eclipse.mylyn.tasks-97ca9e3287d9466a1f30a1b3cf4a9c42e3f5a2a8.zip
ASSIGNED - bug 241790: [update] context not saved on shutdown
https://bugs.eclipse.org/bugs/show_bug.cgi?id=241790
Diffstat (limited to 'org.eclipse.mylyn.tasks.core')
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/externalization/AbstractExternalizationParticipant.java8
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/externalization/ExternalizationManager.java27
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/externalization/IExternalizationParticipant.java2
3 files changed, 36 insertions, 1 deletions
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/externalization/AbstractExternalizationParticipant.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/externalization/AbstractExternalizationParticipant.java
index f43006dd8..3e6841710 100644
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/externalization/AbstractExternalizationParticipant.java
+++ b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/externalization/AbstractExternalizationParticipant.java
@@ -106,4 +106,12 @@ public abstract class AbstractExternalizationParticipant implements IExternaliza
return null;
}
+ /**
+ * @param full
+ * true when the workbench is shutting down and any time-based dirty states should be ignore
+ */
+ public boolean isDirty(boolean full) {
+ return isDirty();
+ }
+
} \ No newline at end of file
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/externalization/ExternalizationManager.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/externalization/ExternalizationManager.java
index 0fbc14784..3cc5f2550 100644
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/externalization/ExternalizationManager.java
+++ b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/externalization/ExternalizationManager.java
@@ -147,9 +147,20 @@ public class ExternalizationManager {
}
}
+ /**
+ * Performs a full save, trying until one has succeeded
+ */
public void saveNow() throws InterruptedException {
+ saveJob.setFullSavePending();
saveJob.wakeUp();
saveJob.join();
+
+ // make sure that we actually have done a full save before we exit this method
+ while (saveJob.isFullSavePending()) {
+ saveJob.schedule();
+ saveJob.wakeUp();
+ saveJob.join();
+ }
}
/**
@@ -172,10 +183,20 @@ public class ExternalizationManager {
private volatile IExternalizationContext context;
+ private volatile boolean isFullSavePending = false;
+
public ExternalizationJob(String jobTitle) {
super(jobTitle);
}
+ public boolean isFullSavePending() {
+ return isFullSavePending;
+ }
+
+ public void setFullSavePending() {
+ isFullSavePending = true;
+ }
+
public void setContext(IExternalizationContext saveContext) {
this.context = saveContext;
}
@@ -187,9 +208,13 @@ public class ExternalizationManager {
case SAVE:
try {
monitor.beginTask(Messages.ExternalizationManager_Saving_, externalizationParticipants.size());
+
+ boolean fullSave = isFullSavePending;
+ isFullSavePending = false;
+
for (IExternalizationParticipant participant : externalizationParticipants) {
ISchedulingRule rule = participant.getSchedulingRule();
- if (forceSave || participant.isDirty()) {
+ if (forceSave || participant.isDirty(fullSave)) {
try {
Job.getJobManager().beginRule(rule, monitor);
monitor.setTaskName(MessageFormat.format(Messages.ExternalizationManager_Saving_X,
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/externalization/IExternalizationParticipant.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/externalization/IExternalizationParticipant.java
index a55cbe289..3ef43ebd4 100644
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/externalization/IExternalizationParticipant.java
+++ b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/externalization/IExternalizationParticipant.java
@@ -22,6 +22,8 @@ public interface IExternalizationParticipant {
public abstract boolean isDirty();
+ public boolean isDirty(boolean full);
+
public abstract ISchedulingRule getSchedulingRule();
public abstract void execute(IExternalizationContext context, IProgressMonitor monitor) throws CoreException;

Back to the top