blob: 17a766cbdfc2f3c5b3cb68729786c982b19e1dd1 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
|
/*******************************************************************************
* Copyright (c) 2003, 2005 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
/*
* Created on Oct 20, 2003
*
* To change the template for this generated file go to
* Window>Preferences>Java>Code Generation>Code and Comments
*/
package org.eclipse.wst.common.frameworks.internal.operation.extensionui;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.jem.util.logger.proxy.Logger;
import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
import org.eclipse.wst.common.frameworks.internal.ConfigurationElementWrapper;
import org.eclipse.wst.common.frameworks.internal.datamodel.ui.DataModelWizardPage;
import org.eclipse.wst.common.frameworks.internal.datamodel.ui.IDMPageGroupHandler;
import org.eclipse.wst.common.frameworks.internal.datamodel.ui.IDMPageHandler;
/**
* @author schacher
*
* To change the template for this generated type comment go to Window>Preferences>Java>Code
* Generation>Code and Comments
*/
public class DMWizardPageFactoryElement extends ConfigurationElementWrapper {
static final String ATT_CLASS_NAME = "className"; //$NON-NLS-1$
protected String className;
protected DMWizardExtensionFactory wizardPageFactory;
protected boolean isPageFactoryInitialized;
protected String pageGroupID;
/**
* @param element
*/
public DMWizardPageFactoryElement(IConfigurationElement element, String pageGroupID) {
super(element);
className = element.getAttribute(ATT_CLASS_NAME);
this.pageGroupID = pageGroupID;
}
public IDMPageHandler createPageHandler(IDataModel dataModel) {
if (!isPageFactoryInitialized)
initPageFactory();
if (wizardPageFactory == null)
return null;
IDMPageHandler handler = wizardPageFactory.createPageHandler(dataModel, pageGroupID);
return handler;
}
public DataModelWizardPage[] createPageGroup(IDataModel dataModel) {
if (!isPageFactoryInitialized)
initPageFactory();
if (wizardPageFactory == null)
return null;
DataModelWizardPage[] pages = wizardPageFactory.createPageGroup(dataModel, pageGroupID);
return pages;
}
public IDMPageGroupHandler createPageGroupHandler( IDataModel dataModel )
{
if (!isPageFactoryInitialized) initPageFactory();
if( wizardPageFactory == null ) return null;
return wizardPageFactory.createPageGroupHandler( dataModel, pageGroupID );
}
private void initPageFactory() {
try {
wizardPageFactory = (DMWizardExtensionFactory) element.createExecutableExtension(ATT_CLASS_NAME);
} catch (CoreException e) {
Logger.getLogger().logError("Error getting page factory: " + className); //$NON-NLS-1$
Logger.getLogger().logError(e);
} finally {
isPageFactoryInitialized = true;
}
}
}
|