blob: 80117f7281713dee44a07473ba81934b0e38c497 [file] [log] [blame]
/*******************************************************************************
* Copyright (c) 2008 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
package org.eclipse.ant.internal.ui.model;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.IAdapterFactory;
/**
* Adapter factory for Ant elements in editor outline
*/
public class AntElementAdapterFactory implements IAdapterFactory {
/* (non-Javadoc)
* @see org.eclipse.core.runtime.IAdapterFactory#getAdapter(java.lang.Object, java.lang.Class)
*/
public Object getAdapter(Object adaptableObject, Class adapterType) {
if (adaptableObject instanceof AntElementNode) {
AntElementNode node = (AntElementNode) adaptableObject;
if (IResource.class.equals(adapterType)) {
return node.getIFile();
}
}
return null;
}
/* (non-Javadoc)
* @see org.eclipse.core.runtime.IAdapterFactory#getAdapterList()
*/
public Class[] getAdapterList() {
return new Class[] {IResource.class};
}
}