Skip to main content
summaryrefslogtreecommitdiffstats
blob: 2b797be53fa5347e6179b1d18ce773da2467a8ba (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
/*******************************************************************************
 * Copyright (c) 2012, 2017 Obeo 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
 * http://www.eclipse.org/legal/epl-v10.html
 * 
 * Contributors:
 *     Obeo - initial API and implementation
 *     Michael Borkowski - public CallbackType visibility for testing
 *     Stefan Dirix - bug 473985
 *******************************************************************************/
package org.eclipse.emf.compare.ide.ui.internal.structuremergeviewer;

import static com.google.common.base.Predicates.instanceOf;
import static com.google.common.collect.Iterables.toArray;
import static com.google.common.collect.Iterables.transform;

import com.google.common.base.Function;
import com.google.common.base.Optional;
import com.google.common.base.Predicates;
import com.google.common.collect.Iterables;
import com.google.common.collect.Iterators;
import com.google.common.collect.Lists;

import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.locks.ReentrantLock;

import org.eclipse.compare.structuremergeviewer.ICompareInput;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.jobs.IJobChangeEvent;
import org.eclipse.core.runtime.jobs.IJobChangeListener;
import org.eclipse.core.runtime.jobs.ISchedulingRule;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.emf.common.notify.Adapter;
import org.eclipse.emf.common.notify.AdapterFactory;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.Notifier;
import org.eclipse.emf.compare.Comparison;
import org.eclipse.emf.compare.ide.ui.internal.EMFCompareIDEUIMessages;
import org.eclipse.emf.compare.ide.ui.internal.treecontentmanager.EMFCompareDeferredTreeContentManager;
import org.eclipse.emf.compare.ide.ui.internal.treecontentmanager.EMFCompareDeferredTreeContentManagerUtil;
import org.eclipse.emf.compare.rcp.ui.internal.util.SWTUtil;
import org.eclipse.emf.compare.rcp.ui.structuremergeviewer.groups.IDifferenceGroupProvider2;
import org.eclipse.emf.edit.provider.IViewerNotification;
import org.eclipse.emf.edit.provider.ViewerNotification;
import org.eclipse.emf.edit.tree.TreeNode;
import org.eclipse.emf.edit.ui.provider.AdapterFactoryContentProvider;
import org.eclipse.emf.edit.ui.provider.NotifyChangedToViewerRefresh;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.viewers.AbstractTreeViewer;
import org.eclipse.jface.viewers.IContentProvider;
import org.eclipse.ui.progress.DeferredTreeContentManager;
import org.eclipse.ui.progress.IDeferredWorkbenchAdapter;
import org.eclipse.ui.progress.IElementCollector;
import org.eclipse.ui.progress.PendingUpdateAdapter;

/**
 * Specialized AdapterFactoryContentProvider for the emf compare structure merge viewer.
 * <p>
 * <i>This class is not intended to be used outside of its package. It has been set to public for testing
 * purpose only.</i>
 * </p>
 * 
 * @author <a href="mailto:mikael.barbero@obeo.fr">Mikael Barbero</a>
 */
public class EMFCompareStructureMergeViewerContentProvider extends AdapterFactoryContentProvider implements IJobChangeListener {

	/**
	 * Class to listen the state of the content provider.
	 * 
	 * @author <a href="mailto:arthur.daussy@obeo.fr">Arthur Daussy</a>
	 */
	static class FetchListener {

		/**
		 * This method is called when the content provider starts fetching new elements in an external Job.
		 */
		public void startFetching() {

		}

		/**
		 * This method is called when the content provider has finished fetching elements and has removed the
		 * {@link PendingUpdateAdapter} from the tree.
		 */
		public void doneFetching() {

		}
	}

	/**
	 * Callback holder used to defer the run of a callback in a specific thread.
	 * 
	 * @see {@link #callback}
	 * @see EMFCompareStructureMergeViewerContentProvider#runWhenReady(CallbackType, Runnable)
	 */
	private static class CallbackHolder {

		private final Runnable callback;

		private final CallbackType callbackType;

		public CallbackHolder(Runnable callback, CallbackType callbackType) {
			super();
			this.callback = callback;
			this.callbackType = callbackType;
		}

		private Runnable getCallback() {
			return callback;
		}

		private CallbackType getType() {
			return callbackType;
		}

	}

	/**
	 * {@link IDeferredWorkbenchAdapter} using this content provider to fetch children.
	 * 
	 * @author <a href="mailto:arthur.daussy@obeo.fr">Arthur Daussy</a>
	 */
	private static class EMFCompareStructureMergeViewerContentProviderDeferredAdapter implements IDeferredWorkbenchAdapter {

		private final EMFCompareStructureMergeViewerContentProvider contentProvider;

		public EMFCompareStructureMergeViewerContentProviderDeferredAdapter(
				EMFCompareStructureMergeViewerContentProvider contentProvider) {
			super();
			this.contentProvider = contentProvider;
		}

		/**
		 * {@inheritDoc}
		 * 
		 * @see {IDeferredWorkbenchAdapter{@link IDeferredWorkbenchAdapter#getChildren(Object)}
		 */
		public Object[] getChildren(Object o) {
			// Not used
			return null;
		}

		/**
		 * {@inheritDoc}
		 * 
		 * @see {IDeferredWorkbenchAdapter{@link IDeferredWorkbenchAdapter#getImageDescriptor(Object)}
		 */
		public ImageDescriptor getImageDescriptor(Object object) {
			// Not used
			return null;
		}

		/**
		 * {@inheritDoc}
		 * 
		 * @see {IDeferredWorkbenchAdapter{@link IDeferredWorkbenchAdapter#getLabel(Object)}
		 */
		public String getLabel(Object o) {
			return EMFCompareIDEUIMessages.getString(
					"EMFCompareStructureMergeViewerContentProvider.deferredWorkbenchAdapter.label"); //$NON-NLS-1$
		}

		/**
		 * {@inheritDoc}
		 * 
		 * @see {IDeferredWorkbenchAdapter{@link IDeferredWorkbenchAdapter#getParent(Object)}
		 */
		public Object getParent(Object o) {
			// Not used
			return null;
		}

		/**
		 * {@inheritDoc}
		 * 
		 * @see {IDeferredWorkbenchAdapter
		 *      {@link IDeferredWorkbenchAdapter#fetchDeferredChildren(Object object, IElementCollector collector, IProgressMonitor monitor)}
		 */
		public void fetchDeferredChildren(Object object, IElementCollector collector,
				IProgressMonitor monitor) {
			if (!monitor.isCanceled()) {
				if (object instanceof CompareInputAdapter) {
					Notifier target = ((Adapter)object).getTarget();
					Object[] children = contentProvider.getChildren(target);
					collector.add(children, monitor);
				}
			}

		}

		/**
		 * {@inheritDoc}
		 * 
		 * @see {IDeferredWorkbenchAdapter{@link IDeferredWorkbenchAdapter#isContainer()}
		 */
		public boolean isContainer() {
			// Not used
			return true;
		}

		/**
		 * {@inheritDoc}
		 * 
		 * @see {IDeferredWorkbenchAdapter{@link #getRule(Object)}
		 */
		public ISchedulingRule getRule(Object object) {
			// Not used
			return null;
		}

	}

	/** {@link DeferredTreeContentManager} use to fetch groups in a external {@link Job}. */
	private final EMFCompareDeferredTreeContentManager contentManagerAdapter;

	/** Holds true if this content provider is currently fetching children. */
	private boolean isFetchingGroup;

	/** Will protect R/W of {@link #pending} and {@link #isFetchingGroup}. */
	private final ReentrantLock lock;

	/** Object listening the status of this object. */
	private final List<FetchListener> listeners;

	/** List of current callbacks. Callbacks are only run once. */
	private List<CallbackHolder> callbacks;

	/** Pending object displayed in the tree. */
	private Object[] pending;

	/**
	 * Constructs the content provider with the appropriate adapter factory.
	 * 
	 * @param adapterFactory
	 *            The adapter factory used to construct the content provider.
	 */
	public EMFCompareStructureMergeViewerContentProvider(AdapterFactory adapterFactory,
			AbstractTreeViewer viewer) {
		super(adapterFactory);
		contentManagerAdapter = EMFCompareDeferredTreeContentManagerUtil
				.createEMFDeferredTreeContentManager(viewer);
		contentManagerAdapter.addUpdateCompleteListener(this);
		lock = new ReentrantLock();
		listeners = new CopyOnWriteArrayList<EMFCompareStructureMergeViewerContentProvider.FetchListener>();
		callbacks = new CopyOnWriteArrayList<EMFCompareStructureMergeViewerContentProvider.CallbackHolder>();

	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see org.eclipse.emf.edit.ui.provider.AdapterFactoryContentProvider#getParent(Object object)
	 */
	@Override
	public Object getParent(Object element) {
		final Object ret;
		if (element instanceof CompareInputAdapter) {
			Object parentNode = super.getParent(((Adapter)element).getTarget());
			if (parentNode instanceof TreeNode) {
				final Optional<Adapter> cia = Iterators.tryFind(((TreeNode)parentNode).eAdapters().iterator(),
						instanceOf(CompareInputAdapter.class));
				if (cia.isPresent()) {
					ret = cia.get();
				} else {
					ret = parentNode;
				}
			} else {
				ret = parentNode;
			}
		} else if (element instanceof ICompareInput) {
			ret = null;
		} else {
			ret = super.getParent(element);
		}
		return ret;
	}

	/**
	 * Enum used for better readability of the method
	 * {@link EMFCompareStructureMergeViewerContentProvider#runWhenReady(CallbackType, Runnable)}.
	 * 
	 * @author <a href="mailto:arthur.daussy@obeo.fr">Arthur Daussy</a>
	 */
	// public for testing
	public static enum CallbackType {
		/** Run the runnable in the UI thread synchronously. */
		IN_UI_SYNC,
		/** Run the runnable in the UI thread asynchronously. */
		IN_UI_ASYNC,
		/** Run the runnable in the current thread. */
		IN_CURRENT_THREAD
	}

	/**
	 * Run the given runnable in the specified thread when then content provider is ready. It can be run
	 * directly if the content provider is not fecthing or during a callback when the content provider is done
	 * fetching.
	 * 
	 * @param type
	 *            of thread to run the {@link Runnable} inside.
	 * @param runnable
	 *            to run
	 */
	public void runWhenReady(CallbackType type, final Runnable runnable) {
		// Prevents adding a callback if another thread set this content provider as not fetching.
		lock.lock();
		try {
			if (isFetchingGroup) {
				callbacks.add(new CallbackHolder(runnable, type));
			} else {
				run(runnable, type);
			}
		} finally {
			lock.unlock();
		}
	}

	/**
	 * Runs a callback in the related thread.
	 * 
	 * @param callback
	 *            to run.
	 * @param type
	 *            of thread.
	 */
	private void run(Runnable callback, CallbackType type) {
		switch (type) {
			case IN_UI_SYNC:
				SWTUtil.safeSyncExec(callback);
				break;
			case IN_UI_ASYNC:
				SWTUtil.safeAsyncExec(callback);
				break;
			default:
				callback.run();
				break;
		}
	}

	/**
	 * Adds a listener to this content provider.
	 * 
	 * @param listener
	 *            to add
	 * @return
	 */
	public boolean addFetchingListener(FetchListener listener) {
		return listeners.add(listener);
	}

	/**
	 * Removes a listener to this content provider.
	 * 
	 * @param listener
	 *            to remove
	 * @return
	 */
	public boolean removeFetchingListener(FetchListener listener) {
		return listeners.remove(listener);
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see org.eclipse.emf.edit.ui.provider.AdapterFactoryContentProvider#hasChildren(Object object)
	 */
	@Override
	public final boolean hasChildren(Object element) {
		final boolean ret;
		if (element instanceof CompareInputAdapter) {
			ret = super.hasChildren(((Adapter)element).getTarget());
		} else if (element instanceof ICompareInput) {
			ret = false;
		} else {
			ret = super.hasChildren(element);
		}
		return ret;
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see org.eclipse.emf.edit.ui.provider.AdapterFactoryContentProvider#getChildren(java.lang.Object)
	 */
	@Override
	public final Object[] getChildren(Object element) {
		Object[] children;
		if (element instanceof CompareInputAdapter) {
			children = getCompareInputAdapterChildren((CompareInputAdapter)element);
		} else if (element instanceof ICompareInput) {
			children = new Object[] {};
		} else {
			children = super.getChildren(element);
		}

		final Object[] compareInputChildren;
		// Avoid NPE.
		if (children == null) {
			children = new Object[] {};
		}
		// Do not adapt if it's a pending updater
		if (!Iterables.all(Arrays.asList(children), Predicates.instanceOf(PendingUpdateAdapter.class))) {
			Iterable<?> compareInputs = adapt(children, getAdapterFactory(), ICompareInput.class);
			compareInputChildren = toArray(compareInputs, Object.class);
		} else {
			compareInputChildren = children;
		}
		return compareInputChildren;
	}

	/**
	 * Returns a {@link PendingUpdateAdapter} while a Job is fetching the children for this object or the
	 * children if they have already been fetched.
	 * <p>
	 * When the job is finished it will autamically replace the {@link PendingUpdateAdapter} by the fetched
	 * children. The fetched children will be stored under the TreeItem holding the input object or at the
	 * root of the tree if the input object match the input of the tree viewer.
	 * </p>
	 * 
	 * @param compareInputAdapter
	 * @return
	 */
	private Object[] getCompareInputAdapterChildren(CompareInputAdapter compareInputAdapter) {
		Notifier target = compareInputAdapter.getTarget();
		if (target instanceof TreeNode) {
			TreeNode treeNode = (TreeNode)target;
			if (treeNode.getData() instanceof Comparison) {
				IDifferenceGroupProvider2 groupProvider2 = getGroupProvider2(treeNode);
				// Handles the first initialisation of the groups.
				lock.lock();
				try {
					if (groupProvider2 != null && !groupProvider2.groupsAreBuilt()) {
						return deferReturnChildren(compareInputAdapter);
					}
				} finally {
					lock.unlock();
				}
			}
		}
		return super.getChildren(compareInputAdapter.getTarget());
	}

	private Object[] deferReturnChildren(CompareInputAdapter compareInputAdapter) {
		if (!isFetchingGroup) {
			isFetchingGroup = true;
			/*
			 * Notifies listeners that the content provider starts fetching here and not in
			 * EMFCompareStructureMergeViewerContentProvider#aboutToRun() since it is only notified on the
			 * "clear pending updater" job events and not on the "fetching children" job events.
			 * @see org.eclipse.ui.progress.DeferredTreeContentManager.runClearPlaceholderJob(
			 * PendingUpdateAdapter)
			 */
			for (FetchListener callback : listeners) {
				callback.startFetching();
			}
			compareInputAdapter.setDeferredAdapter(
					new EMFCompareStructureMergeViewerContentProviderDeferredAdapter(this));
			pending = contentManagerAdapter.getChildren(compareInputAdapter);
		}
		return pending;
	}

	private IDifferenceGroupProvider2 getGroupProvider2(TreeNode treeNode) {
		IDifferenceGroupProvider2 result = null;
		Optional<Adapter> searchResult = Iterables.tryFind(treeNode.eAdapters(),
				Predicates.instanceOf(IDifferenceGroupProvider2.class));
		if (searchResult.isPresent()) {
			return (IDifferenceGroupProvider2)searchResult.get();
		}
		return result;
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see org.eclipse.emf.edit.ui.provider.AdapterFactoryContentProvider#getElements(Object object)
	 */
	@Override
	public Object[] getElements(Object element) {
		return getChildren(element);
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see IContentProvider#dispose()
	 */
	@Override
	public void dispose() {
		super.dispose();
		contentManagerAdapter.removeUpdateCompleteListener(this);
		listeners.clear();
	}

	/**
	 * This implementation specializes the EMF implementation to ensure that if more than 30 notifications
	 * arrive, the viewer is simply refreshed rather than processing each update separately. This is
	 * especially important for when undo is invoked in editor and there are many things to be undone.
	 * <p/>
	 * {@inheritDoc}
	 * 
	 * @see IContentProvider#dispose()
	 */
	@Override
	public void notifyChanged(Notification notification) {
		if (viewer != null && viewer.getControl() != null && !viewer.getControl().isDisposed()
				&& viewer.getInput() != null) {
			if (notification instanceof IViewerNotification) {
				if (viewerRefresh == null) {
					viewerRefresh = new ViewerRefresh(viewer) {
						int count = 0;

						@Override
						public synchronized boolean addNotification(IViewerNotification notification) {
							if (super.addNotification(notification)) {
								count = 0;
								return true;
							}

							// When there are more than 30 notifications, it's probably cheaper to simply
							// refresh the overall view.
							if (count > 30) {
								super.addNotification(new ViewerNotification(notification, null, true, true));
							}

							++count;
							return false;
						}
					};
				}

				if (viewerRefresh.addNotification((IViewerNotification)notification)) {
					viewer.getControl().getDisplay().asyncExec(viewerRefresh);
				}
			} else {
				NotifyChangedToViewerRefresh.handleNotifyChanged(viewer, notification.getNotifier(),
						notification.getEventType(), notification.getFeature(), notification.getOldValue(),
						notification.getNewValue(), notification.getPosition());
			}
		}
	}

	/**
	 * Adapts each elements of the the given <code>iterable</code> to the given <code>type</code> by using the
	 * given <code>adapterFactory</code>.
	 * 
	 * @param <T>
	 *            the type of returned elements.
	 * @param iterable
	 *            the iterable to transform.
	 * @param adapterFactory
	 *            the {@link AdapterFactory} used to adapt elements.
	 * @param type
	 *            the target type of adapted elements.
	 * @return an iterable with element of type <code>type</code>.
	 */
	private static Iterable<?> adapt(Iterable<?> iterable, final AdapterFactory adapterFactory,
			final Class<?> type) {
		Function<Object, Object> adaptFunction = new Function<Object, Object>() {
			public Object apply(Object input) {
				Object ret = adapterFactory.adapt(input, type);
				if (ret == null) {
					return input;
				}
				return ret;
			}
		};
		return transform(iterable, adaptFunction);
	}

	/**
	 * Adapts each elements of the the given <code>array</code> to the given <code>type</code> by using the
	 * given <code>adapterFactory</code>.
	 * 
	 * @param <T>
	 *            the type of returned elements.
	 * @param iterable
	 *            the array to transform.
	 * @param adapterFactory
	 *            the {@link AdapterFactory} used to adapt elements.
	 * @param type
	 *            the target type of adapted elements
	 * @return an iterable with element of type <code>type</code>.
	 */
	private static Iterable<?> adapt(Object[] iterable, final AdapterFactory adapterFactory,
			final Class<?> type) {
		return adapt(Arrays.asList(iterable), adapterFactory, type);
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see IJobChangeListener{@link #aboutToRun(IJobChangeEvent)
	 */
	public void aboutToRun(IJobChangeEvent event) {
		/*
		 * Nothing to do here since it has already been done in
		 * EMFCompareStructureMergeViewerContentProvider#getCompareInputAdapterChildren(CompareInputAdapter
		 * compareInputAdapter)
		 */
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see IJobChangeListener#awake(IJobChangeEvent)
	 */
	public void awake(IJobChangeEvent event) {
		// Nothing to do
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see IJobChangeListener#done(IJobChangeEvent)
	 */
	public void done(IJobChangeEvent event) {
		if (event.getResult().isOK()) {
			// Prevents running callbacks while another thread add a new callback or another thread launch a
			// fetching job.
			lock.lock();
			try {
				if (isFetchingGroup) {
					isFetchingGroup = false;
					pending = null;
					for (FetchListener listener : listeners) {
						listener.doneFetching();
						// If the listener starts to fetch again then stop notifying listeners and wait for
						// the content provider to be ready before re-starting.
						if (isFetchingGroup) {
							return;
						}
					}

					final Iterator<CallbackHolder> callbacksIterator = callbacks.iterator();

					while (callbacksIterator.hasNext()) {
						CallbackHolder callbackHolder = callbacksIterator.next();
						run(callbackHolder.getCallback(), callbackHolder.getType());
						// If the callback has started to fetch again the stop running callbacks and wait for
						// the content provider to be ready.
						if (isFetchingGroup) {
							List<CallbackHolder> remainingCallBack = Lists.newArrayList(callbacksIterator);
							callbacks = new CopyOnWriteArrayList<EMFCompareStructureMergeViewerContentProvider.CallbackHolder>(
									remainingCallBack);
							return;
						}
					}

					callbacks.clear();
				}
			} finally {
				lock.unlock();
			}
		}
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see IJobChangeListener#running(IJobChangeEvent)
	 */
	public void running(IJobChangeEvent event) {
		// Nothing to do
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see IJobChangeListener#scheduled(IJobChangeEvent)
	 */
	public void scheduled(IJobChangeEvent event) {
		// Nothing to do
	}

	/**
	 * {@inheritDoc}
	 * 
	 * @see IJobChangeListener#sleeping(IJobChangeEvent)
	 */
	public void sleeping(IJobChangeEvent event) {
		// Nothing to do
	}

}

Back to the top