1 | package de.uka.ipd.sdq.pcm.gmf.allocation.part; |
2 | |
3 | import de.uka.ipd.sdq.pcm.system.System; |
4 | |
5 | /** |
6 | * This wizard page uses the regular resource selector page, but checks |
7 | * the type of the resource selected by the user to be a System. |
8 | */ |
9 | class SystemSelectorPage extends ResourceSelectorPage { |
10 | |
11 | private System mySystem; |
12 | |
13 | protected SystemSelectorPage(System selectedSystem) { |
14 | super("Select system",selectedSystem); |
15 | setTitle("Diagram system"); |
16 | setDescription("Select the system to be used for the diagram."); |
17 | mySystem = selectedSystem; |
18 | } |
19 | |
20 | protected System getSelectedSystem() { |
21 | return mySystem; |
22 | } |
23 | |
24 | @Override |
25 | protected boolean validatePage() { |
26 | if (getResolvedObject() == null) { |
27 | setErrorMessage("No system selected"); |
28 | return false; |
29 | } |
30 | |
31 | if (getResolvedObject() instanceof System) { |
32 | mySystem = (System) getResolvedObject(); |
33 | } |
34 | else { |
35 | setErrorMessage("Wrong resource type selected"); |
36 | return false; |
37 | } |
38 | |
39 | setErrorMessage(null); |
40 | return super.validatePage(); |
41 | } |
42 | } |