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 java.io.IOException;
20:
21: import net.refractions.udig.catalog.IResolve;
22: import net.refractions.udig.core.IBlockingAdaptable;
23:
24: import org.eclipse.core.runtime.IProgressMonitor;
25:
26: /**
27: * An IAdaptable object that adaptes IResolves to other objects. This is used by the framework. The
28: * IResolveAdapterFactory will adapt IResolves to objects of this class so that the frame work can
29: * try to
30: *
31: * @author jeichar
32: */
33: public class IResolveAdaptable implements IBlockingAdaptable {
34:
35: private IResolve resolve;
36:
37: /**
38: *
39: */
40: public IResolveAdaptable(IResolve resolve) {
41: this .resolve = resolve;
42: }
43:
44: /**
45: * @see net.refractions.udig.ui.operations.IBlockingAdaptable#getAdapter(java.lang.Class,
46: * org.eclipse.core.runtime.IProgressMonitor)
47: */
48: public <T> T getAdapter(Class<T> adapter, IProgressMonitor monitor)
49: throws IOException {
50: return resolve.resolve(adapter, monitor);
51: }
52:
53: /**
54: * @see net.refractions.udig.ui.operations.IBlockingAdaptable#canAdaptTo(java.lang.Class)
55: */
56: public <T> boolean canAdaptTo(Class<T> adapter) {
57: return resolve.canResolve(adapter);
58: }
59:
60: }
|