KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > pde > internal > core > feature > FeatureFactory


1 /*******************************************************************************
2  * Copyright (c) 2000, 2006 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.pde.internal.core.feature;
12
13 import org.eclipse.pde.internal.core.ifeature.IFeatureChild;
14 import org.eclipse.pde.internal.core.ifeature.IFeatureData;
15 import org.eclipse.pde.internal.core.ifeature.IFeatureImport;
16 import org.eclipse.pde.internal.core.ifeature.IFeatureInfo;
17 import org.eclipse.pde.internal.core.ifeature.IFeatureInstallHandler;
18 import org.eclipse.pde.internal.core.ifeature.IFeatureModel;
19 import org.eclipse.pde.internal.core.ifeature.IFeatureModelFactory;
20 import org.eclipse.pde.internal.core.ifeature.IFeaturePlugin;
21 import org.eclipse.pde.internal.core.ifeature.IFeatureURL;
22 import org.eclipse.pde.internal.core.ifeature.IFeatureURLElement;
23
24 public class FeatureFactory implements IFeatureModelFactory {
25     private IFeatureModel model;
26
27 public FeatureFactory(IFeatureModel model) {
28     this.model = model;
29 }
30
31 public IFeaturePlugin createPlugin() {
32     FeaturePlugin plugin = new FeaturePlugin();
33     plugin.model = model;
34     plugin.parent = model.getFeature();
35     return plugin;
36 }
37
38 public IFeatureData createData() {
39     FeatureData data = new FeatureData();
40     data.model = model;
41     data.parent = model.getFeature();
42     return data;
43 }
44
45 public IFeatureChild createChild() {
46     FeatureChild child = new FeatureChild();
47     child.model = model;
48     child.parent = model.getFeature();
49     return child;
50 }
51
52 public IFeatureImport createImport() {
53     FeatureImport iimport = new FeatureImport();
54     iimport.model = model;
55     iimport.parent = model.getFeature();
56     return iimport;
57 }
58 public IFeatureURL createURL() {
59     FeatureURL url = new FeatureURL();
60     url.model = model;
61     url.parent = model.getFeature();
62     return url;
63 }
64
65 public IFeatureInstallHandler createInstallHandler() {
66     FeatureInstallHandler handler = new FeatureInstallHandler();
67     handler.model = model;
68     handler.parent = model.getFeature();
69     return handler;
70 }
71
72 public IFeatureInfo createInfo(int index) {
73     FeatureInfo info = new FeatureInfo(index);
74     info.model = model;
75     info.parent = model.getFeature();
76     return info;
77 }
78
79 public IFeatureURLElement createURLElement(IFeatureURL parent, int elementType) {
80     FeatureURLElement element = new FeatureURLElement(elementType);
81     element.model = model;
82     element.parent = parent;
83     return element;
84 }
85 }
86
Popular Tags