1 | package de.uka.ipd.sdq.pcm.gmf.allocation.part; |
2 | |
3 | import de.uka.ipd.sdq.pcm.resourceenvironment.ResourceEnvironment; |
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 ResourceEnvironment. |
8 | */ |
9 | class ResourceEnvironmentSelectorPage extends ResourceSelectorPage { |
10 | |
11 | private ResourceEnvironment myResourceEnvironment; |
12 | |
13 | protected ResourceEnvironmentSelectorPage(ResourceEnvironment selectedResourceEnvironment) { |
14 | super("Select resource environment",selectedResourceEnvironment); |
15 | setTitle("Diagram resource environment"); |
16 | setDescription("Select the resource environment to be used for the diagram."); |
17 | myResourceEnvironment = selectedResourceEnvironment; |
18 | } |
19 | |
20 | protected ResourceEnvironment getSelectedResourceEnvironment() { |
21 | return myResourceEnvironment; |
22 | } |
23 | |
24 | @Override |
25 | protected boolean validatePage() { |
26 | if (getResolvedObject() == null) { |
27 | setErrorMessage("No resource environment selected"); |
28 | return false; |
29 | } |
30 | |
31 | if (getResolvedObject() instanceof ResourceEnvironment) { |
32 | myResourceEnvironment = (ResourceEnvironment) getResolvedObject(); |
33 | } |
34 | else { |
35 | setErrorMessage("Wrong resource type selected"); |
36 | return false; |
37 | } |
38 | |
39 | setErrorMessage(null); |
40 | return super.validatePage(); |
41 | } |
42 | } |