2 * Copyright (c) 2004 Christopher Lenz and others.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Common Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/cpl-v10.html
9 * Christopher Lenz - initial API and implementation
11 * $Id: CssPropertiesAdapterFactory.java,v 1.1 2004-09-02 18:11:49 jsurfer Exp $
14 package net.sourceforge.phpeclipse.css.ui.internal.properties;
16 import net.sourceforge.phpeclipse.css.core.model.IRule;
18 import org.eclipse.core.runtime.IAdapterFactory;
19 import org.eclipse.core.runtime.IAdapterManager;
20 import org.eclipse.ui.views.properties.IPropertySource;
23 * Factory for adapting model elements to property sources.
25 public class CssPropertiesAdapterFactory implements IAdapterFactory {
27 // Static Methods ----------------------------------------------------------
30 * Creates and registers this adapter factory with the given manager.
32 * @param manager the adapter manager to register with
34 public static void register(IAdapterManager manager) {
35 CssPropertiesAdapterFactory factory = new CssPropertiesAdapterFactory();
36 manager.registerAdapters(factory, IRule.class);
39 // IAdapterFactory Implementation ------------------------------------------
42 * @see IAdapterFactory#getAdapter(Object, Class)
44 public Object getAdapter(Object adaptableObject, Class adapterType) {
45 if (adapterType == IPropertySource.class) {
46 if (adaptableObject instanceof IRule) {
47 return new CssRulePropertySource((IRule) adaptableObject);
54 * @see IAdapterFactory#getAdapterList()
56 public Class[] getAdapterList() {
57 return new Class[] { IPropertySource.class };