KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > core > internal > registry > osgi > ExtensionEventDispatcherJob


1 /*******************************************************************************
2  * Copyright (c) 2007 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11 package org.eclipse.core.internal.registry.osgi;
12
13 import java.util.Map JavaDoc;
14 import org.eclipse.core.runtime.IProgressMonitor;
15 import org.eclipse.core.runtime.IStatus;
16 import org.eclipse.core.runtime.jobs.ISchedulingRule;
17 import org.eclipse.core.runtime.jobs.Job;
18 import org.eclipse.core.runtime.spi.RegistryStrategy;
19
20 /**
21  * Use Eclipse job scheduling mechanism.
22  */

23 final public class ExtensionEventDispatcherJob extends Job {
24     // an "identy rule" that forces extension events to be queued
25
private final static ISchedulingRule EXTENSION_EVENT_RULE = new ISchedulingRule() {
26         public boolean contains(ISchedulingRule rule) {
27             return rule == this;
28         }
29
30         public boolean isConflicting(ISchedulingRule rule) {
31             return rule == this;
32         }
33     };
34     private Map JavaDoc deltas;
35     private Object JavaDoc[] listenerInfos;
36     private Object JavaDoc registry;
37
38     public ExtensionEventDispatcherJob(Object JavaDoc[] listenerInfos, Map JavaDoc deltas, Object JavaDoc registry) {
39         // name not NL'd since it is a system job
40
super("Registry event dispatcher"); //$NON-NLS-1$
41
setSystem(true);
42         this.listenerInfos = listenerInfos;
43         this.deltas = deltas;
44         this.registry = registry;
45         // all extension event dispatching jobs use this rule
46
setRule(EXTENSION_EVENT_RULE);
47     }
48
49     public IStatus run(IProgressMonitor monitor) {
50         return RegistryStrategy.processChangeEvent(listenerInfos, deltas, registry);
51     }
52 }
53
Popular Tags