1 /*******************************************************************************2 * Copyright (c) 2004, 2005 IBM Corporation and others.3 * All rights reserved. This program and the accompanying materials4 * are made available under the terms of the Eclipse Public License v1.05 * which accompanies this distribution, and is available at6 * http://www.eclipse.org/legal/epl-v10.html7 *8 * Contributors:9 * IBM Corporation - initial API and implementation10 *******************************************************************************/11 package org.eclipse.ui.internal.part.services;12 13 import org.eclipse.ui.IWorkbenchPage;14 import org.eclipse.ui.internal.WorkbenchPage;15 import org.eclipse.ui.internal.components.framework.ComponentException;16 import org.eclipse.ui.internal.components.framework.ComponentFactory;17 import org.eclipse.ui.internal.components.framework.ComponentHandle;18 import org.eclipse.ui.internal.components.framework.IServiceProvider;19 import org.eclipse.ui.internal.components.framework.NonDisposingHandle;20 21 /**22 * Factory for the default IPartFactory instance. 23 * 24 * @since 3.125 */26 public class PartFactoryFactory extends ComponentFactory {27 public PartFactoryFactory() {28 29 }30 31 /* (non-Javadoc)32 * @see org.eclipse.core.component.ComponentAdapter#createInstance(org.eclipse.core.component.IContainer)33 */34 public ComponentHandle createHandle(IServiceProvider availableServices) throws ComponentException {35 IWorkbenchPage page;36 try {37 page = (IWorkbenchPage)availableServices.getService(IWorkbenchPage.class);38 } catch (ComponentException e) {39 throw new ComponentException(PartFactoryFactory.class, e);40 }41 return new NonDisposingHandle(((WorkbenchPage)page).getPartFactory());42 }43 }44