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
|
package org.openembedded.bc.ui.wizards.install;
import java.util.Map;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;
import org.openembedded.bc.ui.wizards.FiniteStateWizardPage;
public class WelcomePage extends FiniteStateWizardPage {
public static final String ACTION_INSTALL = "ACTION_INSTALL";
public static final String ACTION_USE = "ACTION_USE";
private Button installButton;
private Button useButton;
protected WelcomePage(Map model) {
super("Introduction", model);
setTitle("Select Project Type");
}
@Override
public void createControl(Composite parent) {
Composite top = new Composite(parent, SWT.None);
top.setLayout(new GridLayout());
top.setLayoutData(new GridData(GridData.FILL_BOTH));
ValidationListener listener = new ValidationListener();
installButton = new Button(top, SWT.RADIO | SWT.WRAP);
installButton.setText("Install a flavor of OpenEmbedded on your computer.");
Composite lc = new Composite(top, SWT.None);
lc.setLayout(new GridLayout(2, false));
lc.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
Label spacer = new Label(lc, SWT.None);
spacer.setText(" ");
Label installLabel = new Label(lc, SWT.WRAP);
installLabel.setText(
"This will install a flavor of OpenEmbedded in your Eclipse workspace. It is the " +
"recommended option for new projects in Eclipse."
);
installLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
installButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
installButton.addSelectionListener(listener);
useButton = new Button(top, SWT.RADIO | SWT.WRAP);
useButton.setText("Use an existing local copy of OpenEmbedded.");
lc = new Composite(top, SWT.None);
lc.setLayout(new GridLayout(2, false));
lc.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
spacer = new Label(lc, SWT.None);
spacer.setText(" ");
installLabel = new Label(lc, SWT.WRAP);
installLabel.setText(
"A working install " +
"of a flavor of OpenEmbedded is required. An init script will need to be selected to initialize " +
"the environment.");
installLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
useButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
useButton.addSelectionListener(listener);
setControl(top);
}
@Override
public void pageCleanup() {
}
@Override
public void pageDisplay() {
setMessage("Choose to install a new instance or an existing one.");
}
@Override
protected void updateModel() {
model.remove(ACTION_INSTALL);
model.remove(ACTION_USE);
if (installButton.getSelection()) {
model.put(ACTION_INSTALL, ACTION_INSTALL);
} else if (useButton.getSelection()) {
model.put(ACTION_USE, ACTION_USE);
}
}
@Override
protected boolean validatePage() {
return useButton.getSelection() || installButton.getSelection();
}
}
|