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