KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > ui > internal > part > services > PartFactoryFactory


1 /*******************************************************************************
2  * Copyright (c) 2004, 2005 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.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.1
25  */

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
Popular Tags