01: /*
02: * uDig - User Friendly Desktop Internet GIS client
03: * http://udig.refractions.net
04: * (C) 2004, Refractions Research Inc.
05: *
06: * This library is free software; you can redistribute it and/or
07: * modify it under the terms of the GNU Lesser General Public
08: * License as published by the Free Software Foundation;
09: * version 2.1 of the License.
10: *
11: * This library is distributed in the hope that it will be useful,
12: * but WITHOUT ANY WARRANTY; without even the implied warranty of
13: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14: * Lesser General Public License for more details.
15: *
16: */
17: package net.refractions.udig.catalog.internal.ui;
18:
19: import net.refractions.udig.catalog.IResolve;
20: import net.refractions.udig.core.IBlockingAdaptable;
21:
22: import org.eclipse.core.runtime.IAdapterFactory;
23:
24: /**
25: * AdapterFactory that adapts IResolves to IAdaptables
26: *
27: * @author jeichar
28: * @since 0.9
29: */
30: public class IResolveAdapterFactory implements IAdapterFactory {
31:
32: /**
33: * @see org.eclipse.core.runtime.IAdapterFactory#getAdapter(java.lang.Object, java.lang.Class)
34: */
35: public Object getAdapter(Object adaptableObject, Class adapterType) {
36: if (IBlockingAdaptable.class.isAssignableFrom(adapterType)
37: && adaptableObject instanceof IResolve)
38: return new IResolveAdaptable((IResolve) adaptableObject);
39: return null;
40: }
41:
42: /**
43: * @see org.eclipse.core.runtime.IAdapterFactory#getAdapterList()
44: */
45: public Class[] getAdapterList() {
46: return new Class[] { IBlockingAdaptable.class };
47: }
48:
49: }
|