|
1 // Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // ${file_name} |
|
15 // |
|
16 // |
|
17 |
|
18 package com.symbian.smt.gui.wizard; |
|
19 |
|
20 import org.eclipse.jface.dialogs.IDialogPage; |
|
21 import org.eclipse.jface.viewers.ISelection; |
|
22 import org.eclipse.jface.wizard.WizardPage; |
|
23 import org.eclipse.swt.SWT; |
|
24 import org.eclipse.swt.layout.FillLayout; |
|
25 import org.eclipse.swt.widgets.Composite; |
|
26 |
|
27 import com.symbian.smt.gui.smtwidgets.SystemDefinitionFilesWidget; |
|
28 import com.symbian.smt.gui.smtwidgets.ValidModelDefinedListener; |
|
29 import com.symbian.smt.gui.smtwidgets.ValidModelEvent; |
|
30 import com.symbian.smt.gui.smtwidgets.ValidModelObservable; |
|
31 |
|
32 public class NewProjectWizardSystemDefsPage extends WizardPage implements |
|
33 ValidModelDefinedListener { |
|
34 private SystemDefinitionFilesWidget sysdef; |
|
35 |
|
36 /** |
|
37 * Creates a wizard page for entering information about System Definitions |
|
38 * |
|
39 * @return void |
|
40 */ |
|
41 protected NewProjectWizardSystemDefsPage(ISelection selection) { |
|
42 super("wizardPage"); |
|
43 setTitle("System Model Manager Wizard"); |
|
44 setDescription("Enter one or more system definition files to use for the System Model Diagram"); |
|
45 setPageComplete(false); |
|
46 } |
|
47 |
|
48 /** |
|
49 * @see IDialogPage#createControl(Composite) |
|
50 */ |
|
51 public void createControl(Composite parent) { |
|
52 Composite container = new Composite(parent, SWT.NULL); |
|
53 container.setLayout(new FillLayout(SWT.VERTICAL)); |
|
54 initialize(); |
|
55 |
|
56 setControl(container); |
|
57 |
|
58 sysdef = new SystemDefinitionFilesWidget(container, SWT.NONE); |
|
59 |
|
60 if (sysdef instanceof ValidModelObservable) { |
|
61 ((ValidModelObservable) sysdef).addModelListener(this); |
|
62 } |
|
63 } |
|
64 |
|
65 @Override |
|
66 public void dispose() { |
|
67 if (sysdef != null) { |
|
68 if (sysdef instanceof ValidModelObservable) { |
|
69 ((ValidModelObservable) sysdef).removeModelListener(this); |
|
70 } |
|
71 } |
|
72 |
|
73 super.dispose(); |
|
74 } |
|
75 |
|
76 /** |
|
77 * Returns a list of the system definition files |
|
78 * |
|
79 * @return String[] |
|
80 */ |
|
81 public String[] getSystemDefinitions() { |
|
82 return sysdef.getSystemDefinitions(); |
|
83 } |
|
84 |
|
85 private void initialize() { |
|
86 } |
|
87 |
|
88 /** |
|
89 * Sets the system definition files |
|
90 * |
|
91 * @param sysDefs |
|
92 * A list containing system definition files |
|
93 * @return void |
|
94 */ |
|
95 public void setSystemDefinitions(String[] sysDefs) { |
|
96 sysdef.setSystemDefinitions(sysDefs); |
|
97 } |
|
98 |
|
99 /** |
|
100 * This is called by the observed object when a change is made and controls |
|
101 * wizard flow |
|
102 * |
|
103 * @param event |
|
104 * the ValidModelEvent object created by the observer object and |
|
105 * indicating if the wizard page is complete |
|
106 * @return void |
|
107 */ |
|
108 public void validModelDefined(ValidModelEvent event) { |
|
109 Boolean isValid = event.isValid(); |
|
110 |
|
111 setPageComplete(isValid); |
|
112 } |
|
113 } |