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 124919 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/mylar/tasklist/tests/TaskActivityViewTest.java (-1 / +3 lines)
Lines 102-110 Link Here
102
		DateRangeContainer thisWeekActivity = MylarTaskListPlugin.getTaskListManager().getActivityThisWeek();
102
		DateRangeContainer thisWeekActivity = MylarTaskListPlugin.getTaskListManager().getActivityThisWeek();
103
		assertNotNull(thisWeekActivity);
103
		assertNotNull(thisWeekActivity);
104
		assertEquals(0, thisWeekActivity.getChildren().size());
104
		assertEquals(0, thisWeekActivity.getChildren().size());
105
105
		assertEquals(0, thisWeekActivity.getTotalElapsed());
106
		Calendar thisWeekCalendarStart = GregorianCalendar.getInstance();
106
		Calendar thisWeekCalendarStart = GregorianCalendar.getInstance();
107
		thisWeekCalendarStart.setTime(thisWeekActivity.getStart().getTime());
107
		Calendar thisWeekCalendarStop = GregorianCalendar.getInstance();
108
		Calendar thisWeekCalendarStop = GregorianCalendar.getInstance();
109
		thisWeekCalendarStop.setTime(thisWeekActivity.getStart().getTime());
108
		thisWeekCalendarStop.add(Calendar.MILLISECOND, 2);
110
		thisWeekCalendarStop.add(Calendar.MILLISECOND, 2);
109
		assertTrue(thisWeekActivity.includes(thisWeekCalendarStart));
111
		assertTrue(thisWeekActivity.includes(thisWeekCalendarStart));
110
112
(-)src/org/eclipse/mylar/internal/core/MylarContextManager.java (-4 / +60 lines)
Lines 107-122 Link Here
107
107
108
	private static ScalingFactors scalingFactors = new ScalingFactors();
108
	private static ScalingFactors scalingFactors = new ScalingFactors();
109
109
110
	private class ActivityListener implements ITimerThreadListener, IInteractionEventListener {
110
	private class ActivityListener implements ITimerThreadListener, IInteractionEventListener, IMylarContextListener {
111
111
112
		private TimerThread timer;
112
		private TimerThread timer;
113
113
		private int sleepPeriod = 60000;
114
		private boolean isStalled;
114
		private boolean isStalled;
115
115
116
		public ActivityListener(int millis) {
116
		public ActivityListener(int millis) {
117
			timer = new TimerThread(millis);
117
			timer = new TimerThread(millis);
118
			timer.addListener(this);
118
			timer.addListener(this);
119
			timer.start();
119
			timer.start();
120
			sleepPeriod = millis;
120
			MylarPlugin.getDefault().addInteractionListener(this);
121
			MylarPlugin.getDefault().addInteractionListener(this);
121
		}
122
		}
122
123
Lines 155-165 Link Here
155
156
156
		public void setTimeout(int millis) {
157
		public void setTimeout(int millis) {
157
			timer.kill();
158
			timer.kill();
158
159
			sleepPeriod = millis;
159
			timer = new TimerThread(millis);
160
			timer = new TimerThread(millis);
160
			timer.addListener(this);
161
			timer.addListener(this);
161
			timer.start();
162
			timer.start();
162
		}
163
		}
164
165
		public void contextActivated(IMylarContext context) {
166
			interactionObserved(null);
167
			timer.kill();
168
			timer = new TimerThread(sleepPeriod);
169
			timer.addListener(this);
170
			timer.start();
171
			
172
		}
173
174
		public void contextDeactivated(IMylarContext context) {
175
			interactionObserved(null);
176
			timer.kill();
177
		}
178
179
		public void presentationSettingsChanging(UpdateKind kind) {
180
			// ignore
181
			
182
		}
183
184
		public void presentationSettingsChanged(UpdateKind kind) {
185
			// ignore
186
			
187
		}
188
189
		public void interestChanged(IMylarElement element) {
190
			// ignore
191
			
192
		}
193
194
		public void interestChanged(List<IMylarElement> elements) {
195
			// ignore
196
			
197
		}
198
199
		public void nodeDeleted(IMylarElement element) {
200
			// ignore
201
			
202
		}
203
204
		public void landmarkAdded(IMylarElement element) {
205
			// ignore
206
			
207
		}
208
209
		public void landmarkRemoved(IMylarElement element) {
210
			// ignore
211
			
212
		}
213
214
		public void edgesChanged(IMylarElement element) {
215
			// ignore
216
			
217
		}
163
	}
218
	}
164
219
165
	public MylarContextManager() {
220
	public MylarContextManager() {
Lines 176-181 Link Here
176
		}
231
		}
177
232
178
		activityListener = new ActivityListener(INACTIVITY_TIMEOUT_MILLIS);// INACTIVITY_TIMEOUT_MILLIS);
233
		activityListener = new ActivityListener(INACTIVITY_TIMEOUT_MILLIS);// INACTIVITY_TIMEOUT_MILLIS);
234
		this.addListener(activityListener);
179
		activityListener.startObserving();
235
		activityListener.startObserving();
180
	}
236
	}
181
237
Lines 487-493 Link Here
487
	public void contextDeactivated(String handleIdentifier) {
543
	public void contextDeactivated(String handleIdentifier) {
488
		try {
544
		try {
489
			IMylarContext context = currentContext.getContextMap().get(handleIdentifier);
545
			IMylarContext context = currentContext.getContextMap().get(handleIdentifier);
490
			if (context != null) {
546
			if (context != null) {			
491
				saveContext(handleIdentifier);
547
				saveContext(handleIdentifier);
492
				currentContext.getContextMap().remove(handleIdentifier);
548
				currentContext.getContextMap().remove(handleIdentifier);
493
549

Return to bug 124919