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
|
/***************************************************************************************************
* Copyright (c) 2005 Eteration A.S. and Gorkem Ercan. 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: Gorkem Ercan - initial API and implementation
*
**************************************************************************************************/
package org.eclipse.jst.server.generic.ui.internal;
import java.util.Map;
import org.eclipse.jst.server.generic.core.internal.CorePlugin;
import org.eclipse.jst.server.generic.servertype.definition.ServerRuntime;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.wst.server.ui.wizard.IWizardHandle;
import org.eclipse.wst.server.ui.wizard.WizardFragment;
/**
* A wizard fragment that provides support for serverdef files.
*
* @author Gorkem Ercan
*/
public abstract class ServerDefinitionTypeAwareWizardFragment extends WizardFragment {
private IWizardHandle fWizard;
public boolean hasComposite() {
return true;
}
public Composite createComposite(Composite parent, IWizardHandle handle) {
this.fWizard = handle;
Composite container = new Composite(parent, SWT.NONE);
GridLayout grid = new GridLayout(1,false);
grid.marginWidth=0;
container.setLayout(grid);
container.setLayoutData(new GridData(GridData.FILL_BOTH));
handle.setImageDescriptor(GenericUiPlugin.getDefault().imageDescriptor(GenericUiPlugin.WIZBAN_IMAGE));
handle.setTitle(title());
handle.setDescription(description());
createContent(container,handle);
return container;
}
public IWizardHandle getWizard(){
return fWizard;
}
/**
* Returns the description to be displayed on the wizard head.
* @return
*/
public abstract String description();
/**
* Returns the title of the wizard.
* @return
*/
public abstract String title();
/**
* Create the real content
* @param parent
* @param handle
*/
public abstract void createContent(Composite parent, IWizardHandle handle);
/**
* Retuns the ServerRuntime.
* @param definitionID
* @param properties
* @return
*/
protected ServerRuntime getServerTypeDefinition(String definitionID, Map properties)
{
return CorePlugin.getDefault().getServerTypeDefinitionManager().getServerRuntimeDefinition(definitionID,properties);
}
/**
* Retuns the ServerRuntime.
* @param serverTypeId
* @param runtimeTypeId
* @param properties
* @return
*/
protected ServerRuntime getServerTypeDefinition(String serverTypeId, String runtimeTypeId, Map properties)
{
return CorePlugin.getDefault().getServerTypeDefinitionManager().getServerRuntimeDefinition(serverTypeId, runtimeTypeId, properties);
}
}
|