-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAStep.java
More file actions
120 lines (96 loc) · 3.34 KB
/
Copy pathAStep.java
File metadata and controls
120 lines (96 loc) · 3.34 KB
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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
package fr.com.app.ui.widgets.wizard;
import java.util.Collection;
import org.apache.commons.collections.CollectionUtils;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.jface.layout.GridDataFactory;
import org.eclipse.jface.layout.GridLayoutFactory;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.PaintEvent;
import org.eclipse.swt.events.PaintListener;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.widgets.Canvas;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
import fr.com.app.ui.resources.CommonImages;
import fr.com.app.ui.resources.IPluginImages;
import fr.com.app.ui.resources.PluginColors;
import fr.com.app.ui.resources.PluginToolkit;
public abstract class AStep implements IStep {
// Toolkit
protected PluginToolkit toolkit = PluginToolkit.getInstance();
protected AWizard parentWizard;
protected Composite body;
protected String label;
protected String informationMessage;
protected StepStateEnum state;
public AStep(AWizard parentWizard, Shell shell, String titre) {
this.parentWizard = parentWizard;
this.label = titre;
}
@Override
public Composite getBody() {
return body;
}
@Override
public String getLabel() {
return label;
}
@Override
public StepStateEnum getState() {
return state;
}
@Override
public String getOkBtLabel() {
return "Suivant";
}
@Override
public Image getImage() {
return CommonImages.getSharedImage(IPluginImages.IMG_STATUT_STARTED);
}
@Override
public Image getOkBtIcon() {
return null;
}
public String getInformationMessage() {
return informationMessage;
}
@SuppressWarnings("unchecked")
@Override
public Collection<IStatus> validate() {
return CollectionUtils.EMPTY_COLLECTION;
}
@Override
public void save(Object dataContainer) {
}
@Override
public boolean isEnable() {
return true;
}
protected void createInformationLabel(Composite parent) {
if (getInformationMessage() == null)
return;
Group group = new Group(parent, SWT.NONE);
GridDataFactory.fillDefaults().grab(true, false).applyTo(group);
GridLayoutFactory.fillDefaults().margins(8, 8).applyTo(group);
group.setText("Information");
group.setBackground(PluginColors.getInstance().getColor(SWT.COLOR_WHITE));
Composite compositeInformation = PluginToolkit.getInstance().createComposite(group);
GridDataFactory.fillDefaults().grab(true, false).applyTo(compositeInformation);
GridLayoutFactory.fillDefaults().numColumns(2).applyTo(compositeInformation);
Canvas canvas = new Canvas(compositeInformation, SWT.NONE);
canvas.setBackground(PluginColors.getInstance().getColor(SWT.COLOR_WHITE));
canvas.addPaintListener(new PaintListener() {
public void paintControl(PaintEvent e) {
e.gc.drawImage(CommonImages.getSharedImage(IPluginImages.IMG_BULB_GREY), 10, 10);
}
});
Label lblInformation = new Label(compositeInformation, SWT.WRAP);
GridData data = new GridData(GridData.FILL_HORIZONTAL | SWT.CENTER);
lblInformation.setLayoutData(data);
lblInformation.setBackground(PluginColors.getInstance().getColor(SWT.COLOR_WHITE));
lblInformation.setText(informationMessage);
}
}