Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 405356
Collapse All | Expand All

(-)a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/IPreferenceConstants.java (+2 lines)
Lines 246-249 public interface IPreferenceConstants { Link Here
246
	 */
246
	 */
247
	public static final String WORKBENCH_SAVE_INTERVAL = "WORKBENCH_SAVE_INTERVAL"; //$NON-NLS-1$
247
	public static final String WORKBENCH_SAVE_INTERVAL = "WORKBENCH_SAVE_INTERVAL"; //$NON-NLS-1$
248
248
249
	public static final int DEFAULT_WORBENCH_SAVE_INTERVAL = 120000;
250
249
}
251
}
(-)a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/Workbench.java (-16 / +43 lines)
Lines 441-446 public final class Workbench extends EventManager implements IWorkbench { Link Here
441
441
442
	private Job autoSaveJob;
442
	private Job autoSaveJob;
443
443
444
	private boolean autoSaveRunning = true;
445
444
	/**
446
	/**
445
	 * Creates a new workbench.
447
	 * Creates a new workbench.
446
	 * 
448
	 * 
Lines 1034-1039 public final class Workbench extends EventManager implements IWorkbench { Link Here
1034
		if(autoSaveJob != null) {
1036
		if(autoSaveJob != null) {
1035
			autoSaveJob.cancel();
1037
			autoSaveJob.cancel();
1036
			autoSaveJob = null;
1038
			autoSaveJob = null;
1039
			autoSaveRunning = false;
1037
		}
1040
		}
1038
1041
1039
		boolean closeEditors = !force
1042
		boolean closeEditors = !force
Lines 2677-2700 UIEvents.Context.TOPIC_CONTEXT, Link Here
2677
				};
2680
				};
2678
				e4Context.set(PartRenderingEngine.EARLY_STARTUP_HOOK, earlyStartup);
2681
				e4Context.set(PartRenderingEngine.EARLY_STARTUP_HOOK, earlyStartup);
2679
				// start workspace auto-save
2682
				// start workspace auto-save
2680
				final int millisecondInterval = getAutoSaveJobTime();
2683
				Thread autoSaveThread = new Thread(new Runnable() {
2681
				if (millisecondInterval > 0) {
2684
2682
					autoSaveJob = new WorkbenchJob("Workbench Auto-Save Job") { //$NON-NLS-1$
2685
					public void run() {
2683
						@Override
2686
						while (autoSaveRunning) {
2684
						public IStatus runInUIThread(IProgressMonitor monitor) {
2687
							if (autoSaveJob != null) {
2685
							final int nextDelay = getAutoSaveJobTime();
2688
								autoSaveJob.cancel();
2686
							persist(false);
2689
							}
2687
							monitor.done();
2690
							final int millisecondInterval = getAutoSaveJobTime();
2688
							// repeat
2691
							if (millisecondInterval > 0) {
2689
							if (nextDelay > 0) {
2692
								autoSaveJob = new WorkbenchJob("Workbench Auto-Save Job") { //$NON-NLS-1$
2690
								this.schedule(nextDelay);
2693
									@Override
2694
									public IStatus runInUIThread(IProgressMonitor monitor) {
2695
										persist(false);
2696
										monitor.done();
2697
										return Status.OK_STATUS;
2698
									}
2699
								};
2700
								autoSaveJob.setSystem(true);
2701
								try {
2702
									Thread.sleep(millisecondInterval);
2703
								} catch (InterruptedException e) {
2704
									String msg = "Exception in Workbench.runUI"; //$NON-NLS-1$
2705
									WorkbenchPlugin.log(msg, new Status(IStatus.INFO,
2706
											WorkbenchPlugin.PI_WORKBENCH, 1, msg, e));
2707
								}
2708
								autoSaveJob.schedule();
2709
2710
							} else {
2711
								try {
2712
									Thread.sleep(IPreferenceConstants.DEFAULT_WORBENCH_SAVE_INTERVAL);
2713
								} catch (InterruptedException e) {
2714
									String msg = "Exception in Workbench.runUI"; //$NON-NLS-1$
2715
									WorkbenchPlugin.log(msg, new Status(IStatus.INFO,
2716
											WorkbenchPlugin.PI_WORKBENCH, 1, msg, e));
2717
								}
2691
							}
2718
							}
2692
							return Status.OK_STATUS;
2719
2693
						}
2720
						}
2694
					};
2721
					}
2695
					autoSaveJob.setSystem(true);
2722
				}, "Workbench Auto-Save Thread"); //$NON-NLS-1$
2696
					autoSaveJob.schedule(millisecondInterval);
2723
2697
				}
2724
				autoSaveThread.start();
2698
2725
2699
				// WWinPluginAction.refreshActionList();
2726
				// WWinPluginAction.refreshActionList();
2700
2727
(-)a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchPreferenceInitializer.java (-3 / +2 lines)
Lines 65-72 public class WorkbenchPreferenceInitializer extends Link Here
65
		// node. It works because the default-default is false.
65
		// node. It works because the default-default is false.
66
		node.putBoolean(IWorkbenchPreferenceConstants.DISABLE_OPEN_EDITOR_IN_PLACE, false);
66
		node.putBoolean(IWorkbenchPreferenceConstants.DISABLE_OPEN_EDITOR_IN_PLACE, false);
67
		
67
		
68
		// 5 minute workbench save interval
68
		// 0 minute workbench save interval
69
		node.putInt(IPreferenceConstants.WORKBENCH_SAVE_INTERVAL, 5);
69
		node.putInt(IPreferenceConstants.WORKBENCH_SAVE_INTERVAL, 0);
70
70
71
		node.putBoolean(IPreferenceConstants.USE_IPERSISTABLE_EDITORS, true);
71
		node.putBoolean(IPreferenceConstants.USE_IPERSISTABLE_EDITORS, true);
72
		
72
		
73
- 

Return to bug 405356