KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > ltk > internal > ui > refactoring > model > RefactoringModelAdapterFactory


1 /*******************************************************************************
2  * Copyright (c) 2005, 2006 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.ltk.internal.ui.refactoring.model;
12
13 import org.eclipse.core.runtime.IAdapterFactory;
14
15 import org.eclipse.core.resources.mapping.ResourceMapping;
16
17 import org.eclipse.ltk.core.refactoring.RefactoringDescriptorProxy;
18
19 /**
20  * Adaptor factory for refactoring model support.
21  *
22  * @since 3.2
23  */

24 public final class RefactoringModelAdapterFactory implements IAdapterFactory {
25
26     /**
27      * {@inheritDoc}
28      */

29     public Object JavaDoc getAdapter(final Object JavaDoc adaptable, final Class JavaDoc adapter) {
30         if (adaptable instanceof RefactoringDescriptorCompareInput) {
31             final RefactoringDescriptorCompareInput input= (RefactoringDescriptorCompareInput) adaptable;
32             final RefactoringDescriptorProxy descriptor= input.getDescriptor();
33             if (descriptor != null)
34                 return descriptor.getAdapter(ResourceMapping.class);
35         }
36         return null;
37     }
38
39     /**
40      * {@inheritDoc}
41      */

42     public Class JavaDoc[] getAdapterList() {
43         return new Class JavaDoc[] { ResourceMapping.class};
44     }
45 }
46
Popular Tags