01: /*******************************************************************************
02: * Copyright (c) 2004, 2005 IBM Corporation and others.
03: * All rights reserved. This program and the accompanying materials
04: * are made available under the terms of the Eclipse Public License v1.0
05: * which accompanies this distribution, and is available at
06: * http://www.eclipse.org/legal/epl-v10.html
07: *
08: * Contributors:
09: * IBM Corporation - initial API and implementation
10: *******************************************************************************/package org.eclipse.ui.examples.jobs.views;
11:
12: import org.eclipse.core.runtime.IAdapterFactory;
13: import org.eclipse.ui.model.IWorkbenchAdapter;
14: import org.eclipse.ui.progress.IDeferredWorkbenchAdapter;
15:
16: public class ProgressExampleAdapterFactory implements IAdapterFactory {
17: private SlowElementAdapter slowElementAdapter = new SlowElementAdapter();
18:
19: /* (non-Javadoc)
20: * @see org.eclipse.core.runtime.IAdapterFactory#getAdapter(java.lang.Object, java.lang.Class)
21: */
22: public Object getAdapter(Object object, Class type) {
23: if (object instanceof SlowElement) {
24: if (type == SlowElement.class
25: || type == IDeferredWorkbenchAdapter.class
26: || type == IWorkbenchAdapter.class)
27: return slowElementAdapter;
28: }
29: return null;
30: }
31:
32: /* (non-Javadoc)
33: * @see org.eclipse.core.runtime.IAdapterFactory#getAdapterList()
34: */
35: public Class[] getAdapterList() {
36: return new Class[] { SlowElement.class,
37: IDeferredWorkbenchAdapter.class,
38: IWorkbenchAdapter.class };
39: }
40: }
|