0
|
1 |
/*
|
|
2 |
* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
|
3 |
* All rights reserved.
|
|
4 |
* This component and the accompanying materials are made available
|
|
5 |
* under the terms of "Eclipse Public License v1.0"
|
|
6 |
* which accompanies this distribution, and is available
|
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
8 |
*
|
|
9 |
* Initial Contributors:
|
|
10 |
* Nokia Corporation - initial contribution.
|
|
11 |
*
|
|
12 |
* Contributors:
|
|
13 |
*
|
|
14 |
* Description:
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
package com.nokia.s60tools.symbianfoundationtemplates.ui.wizards.s60.classwizards;
|
|
18 |
|
|
19 |
import java.io.File;
|
|
20 |
import java.util.AbstractList;
|
|
21 |
import java.util.ArrayList;
|
|
22 |
import java.util.HashMap;
|
|
23 |
import java.util.Map;
|
|
24 |
|
|
25 |
import org.eclipse.core.resources.IFile;
|
|
26 |
import org.eclipse.core.resources.ResourcesPlugin;
|
|
27 |
import org.eclipse.core.runtime.IStatus;
|
|
28 |
import org.eclipse.core.runtime.Path;
|
|
29 |
import org.eclipse.core.runtime.Status;
|
|
30 |
import org.eclipse.swt.SWT;
|
|
31 |
import org.eclipse.swt.graphics.FontMetrics;
|
|
32 |
import org.eclipse.swt.graphics.GC;
|
|
33 |
import org.eclipse.swt.layout.GridData;
|
|
34 |
import org.eclipse.swt.layout.GridLayout;
|
|
35 |
import org.eclipse.swt.widgets.Button;
|
|
36 |
import org.eclipse.swt.widgets.Combo;
|
|
37 |
import org.eclipse.swt.widgets.Composite;
|
|
38 |
import org.eclipse.swt.widgets.Event;
|
|
39 |
import org.eclipse.swt.widgets.Label;
|
|
40 |
import org.eclipse.swt.widgets.Text;
|
|
41 |
import org.eclipse.ui.PlatformUI;
|
|
42 |
|
|
43 |
import com.nokia.s60tools.symbianfoundationtemplates.SymbianFoundationTemplates;
|
|
44 |
import com.nokia.s60tools.symbianfoundationtemplates.engine.OriginalTemplate;
|
|
45 |
import com.nokia.s60tools.symbianfoundationtemplates.engine.s60.S60TransformKeys;
|
|
46 |
import com.nokia.s60tools.symbianfoundationtemplates.resources.HelpContextIDs;
|
|
47 |
import com.nokia.s60tools.symbianfoundationtemplates.resources.LastUsedData;
|
|
48 |
import com.nokia.s60tools.symbianfoundationtemplates.resources.Messages;
|
|
49 |
import com.nokia.s60tools.symbianfoundationtemplates.resources.PreferenceConstants;
|
|
50 |
import com.nokia.s60tools.symbianfoundationtemplates.ui.wizards.s60.FileSelectionControl;
|
|
51 |
import com.nokia.s60tools.symbianfoundationtemplates.ui.wizards.s60.FolderSelectionControl;
|
|
52 |
import com.nokia.s60tools.symbianfoundationtemplates.ui.wizards.s60.S60TemplatePageType;
|
|
53 |
import com.nokia.s60tools.symbianfoundationtemplates.ui.wizards.s60.S60TemplateWizardPage;
|
|
54 |
import com.nokia.s60tools.symbianfoundationtemplates.util.Util;
|
|
55 |
|
|
56 |
/**
|
|
57 |
* Class page.
|
|
58 |
*
|
|
59 |
*/
|
|
60 |
public class ClassPage extends S60TemplateWizardPage {
|
|
61 |
private FolderSelectionControl sourceFolderSelection;
|
|
62 |
private FolderSelectionControl headerFolderSelection;
|
|
63 |
|
|
64 |
private FileSelectionControl classSelection;
|
|
65 |
public FileSelectionControl fileNameSelection;
|
|
66 |
private Text subSystemText;
|
|
67 |
private Text moduleText;
|
|
68 |
private Text descriptionText;
|
|
69 |
private Text copyrightText;
|
|
70 |
private Composite topLevel;
|
|
71 |
private Button cleanBtn;
|
|
72 |
private Combo licenseText;
|
|
73 |
private Combo companyNameText;
|
|
74 |
private Combo copyrightString;
|
|
75 |
|
|
76 |
public ClassPage(S60TemplatePageType pageType) {
|
|
77 |
super(pageType);
|
|
78 |
setTitle(pageType.getTitle());
|
|
79 |
}
|
|
80 |
|
|
81 |
public void createControl(Composite parent) {
|
|
82 |
topLevel = new Composite(parent, SWT.NONE);
|
|
83 |
// Layout manager
|
|
84 |
topLevel.setLayout(new GridLayout(1, false));
|
|
85 |
topLevel.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL));
|
|
86 |
|
|
87 |
Composite selection = new Composite(topLevel, SWT.NONE);
|
|
88 |
selection.setLayout(new GridLayout(3, false));
|
|
89 |
selection.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL));
|
|
90 |
|
|
91 |
if(pageType != S60TemplatePageType.M_CLASS_PAGE)
|
|
92 |
sourceFolderSelection = new FolderSelectionControl(selection, this, Messages.getString("WizardPageSourceFolderLabel")); //$NON-NLS-1$
|
|
93 |
|
|
94 |
// Folder selection control
|
|
95 |
headerFolderSelection = new FolderSelectionControl(selection, this, Messages.getString("WizardPageHeaderFolderLabel")); //$NON-NLS-1$
|
|
96 |
|
|
97 |
// File selection control
|
|
98 |
classSelection = new FileSelectionControl(selection, this, Messages.getString("WizardPageClassNameLabel")); //$NON-NLS-1$
|
|
99 |
|
|
100 |
//
|
|
101 |
fileNameSelection = new FileSelectionControl(selection, this, "File Name:");
|
|
102 |
|
|
103 |
// Separator
|
|
104 |
Label separator = new Label(topLevel, SWT.SEPARATOR | SWT.HORIZONTAL);
|
|
105 |
separator.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL));
|
|
106 |
|
|
107 |
// Info control
|
|
108 |
Composite info = new Composite(topLevel, SWT.NONE);
|
|
109 |
info.setLayout(new GridLayout(2, false));
|
|
110 |
info.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL));
|
|
111 |
|
|
112 |
new Label(info, SWT.NONE).setText(Messages.getString("WizardPageSubSystemLabel")); //$NON-NLS-1$
|
|
113 |
subSystemText = new Text(info, SWT.BORDER);
|
|
114 |
subSystemText.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL));
|
|
115 |
|
|
116 |
new Label(info, SWT.NONE).setText(Messages.getString("WizardPageModuleLabel")); //$NON-NLS-1$
|
|
117 |
moduleText = new Text(info, SWT.BORDER);
|
|
118 |
moduleText.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL));
|
|
119 |
|
|
120 |
new Label(info, SWT.NONE).setText(Messages.getString("WizardPageDescriptionLabel")); //$NON-NLS-1$
|
|
121 |
descriptionText = new Text(info, SWT.BORDER | SWT.V_SCROLL | SWT.MULTI | SWT.WRAP);
|
|
122 |
|
|
123 |
GC gc = new GC(descriptionText);
|
|
124 |
FontMetrics fm = gc.getFontMetrics();
|
|
125 |
int cols = 20;
|
|
126 |
int rows = 6;
|
|
127 |
int width = cols * fm.getAverageCharWidth();
|
|
128 |
int height = rows * fm.getHeight();
|
|
129 |
|
|
130 |
GridData gridData = new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL);
|
|
131 |
gridData.widthHint = width;
|
|
132 |
gridData.heightHint = height;
|
|
133 |
|
|
134 |
descriptionText.setLayoutData(gridData);
|
|
135 |
|
|
136 |
new Label(info, SWT.NONE).setText(Messages.getString("WizardPageCopyrightLabel")); //$NON-NLS-1$
|
|
137 |
copyrightText = new Text(info, SWT.BORDER);
|
|
138 |
copyrightText.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL));
|
|
139 |
|
|
140 |
new Label(info, SWT.NONE).setText(Messages.getString("WizardPageLicenseLabel")); //$NON-NLS-1$
|
|
141 |
licenseText = new Combo(info, SWT.BORDER|SWT.READ_ONLY);
|
|
142 |
licenseText.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL));
|
|
143 |
|
|
144 |
new Label(info, SWT.NONE).setText(Messages.getString("WizardPageCompanyLabel")); //$NON-NLS-1$
|
|
145 |
companyNameText = new Combo(info, SWT.BORDER);
|
|
146 |
companyNameText.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL));
|
|
147 |
|
|
148 |
new Label(info, SWT.NONE).setText(Messages.getString("WizardPageCopyrightStringLabel"));
|
|
149 |
copyrightString = new Combo(info, SWT.BORDER);// | SWT.V_SCROLL | SWT.MULTI | SWT.WRAP);
|
|
150 |
copyrightString.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL));
|
|
151 |
|
|
152 |
GridData data=new GridData(GridData.FILL_HORIZONTAL);
|
|
153 |
data.heightHint=30;
|
|
154 |
cleanBtn=new Button(topLevel,SWT.CHECK);
|
|
155 |
cleanBtn.setText(Messages.getString("WizardPageIncludeInstructionsLabel"));
|
|
156 |
cleanBtn.setSelection(true);
|
|
157 |
cleanBtn.setLayoutData(data);
|
|
158 |
|
|
159 |
setControl(topLevel);
|
|
160 |
setPageComplete(true);
|
|
161 |
|
|
162 |
copyrightText.setText(new Integer(Util.getCopyrightYear()).toString());
|
|
163 |
licenseText.setItems(Util.getDefaultLicence());
|
|
164 |
licenseText.select(0);
|
|
165 |
|
|
166 |
LastUsedData previousData = new LastUsedData();
|
|
167 |
String[] values = previousData.getPreviousValues(LastUsedData.ValueTypes.NAME);
|
|
168 |
if(values!=null)
|
|
169 |
{
|
|
170 |
companyNameText.setItems(values);
|
|
171 |
companyNameText.select(0);
|
|
172 |
}
|
|
173 |
else
|
|
174 |
{
|
|
175 |
companyNameText.setText(Util.getDefaultCompanyName());
|
|
176 |
previousData.saveValues(LastUsedData.ValueTypes.NAME, companyNameText.getText());
|
|
177 |
}
|
|
178 |
|
|
179 |
values = previousData.getPreviousValues(LastUsedData.ValueTypes.COPYRIGHT);
|
|
180 |
if(values !=null)
|
|
181 |
{
|
|
182 |
copyrightString.setItems(values);
|
|
183 |
copyrightString.select(0);
|
|
184 |
}
|
|
185 |
else
|
|
186 |
{
|
|
187 |
copyrightString.setText(Util.getDefaultCompanyCopyright());
|
|
188 |
previousData.saveValues(LastUsedData.ValueTypes.COPYRIGHT, copyrightString.getText());
|
|
189 |
}
|
|
190 |
|
|
191 |
if(!preferenceStore.getBoolean(PreferenceConstants.OPENED_FROM_VIEW))
|
|
192 |
setPreferencesFromStore();
|
|
193 |
|
|
194 |
performHelp();
|
|
195 |
//updateStatus();
|
|
196 |
topLevel.setFocus();
|
|
197 |
}
|
|
198 |
|
|
199 |
public void performHelp() {
|
|
200 |
PlatformUI.getWorkbench().getHelpSystem().setHelp(topLevel,
|
|
201 |
HelpContextIDs.SF_TEMPLATES_OVERVIEW);
|
|
202 |
}
|
|
203 |
|
|
204 |
public AbstractList<OriginalTemplate> getTemplates() {
|
|
205 |
AbstractList<OriginalTemplate> templates = new ArrayList<OriginalTemplate>();
|
|
206 |
|
|
207 |
String[] templateFiles = getTemplateFile().split(";"); //$NON-NLS-1$
|
|
208 |
|
|
209 |
IFile headerFile = ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(
|
|
210 |
headerFolderSelection.getSelectedFolder() + File.separator
|
|
211 |
+ fileNameSelection.getSelectedFileWithoutExtension() + ".h")); //$NON-NLS-1$
|
|
212 |
|
|
213 |
IFile sourceFile = null;
|
|
214 |
if(pageType != S60TemplatePageType.M_CLASS_PAGE)
|
|
215 |
sourceFile = ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(
|
|
216 |
sourceFolderSelection.getSelectedFolder() + File.separator
|
|
217 |
+ fileNameSelection.getSelectedFileWithoutExtension() + ".cpp")); //$NON-NLS-1$
|
|
218 |
|
|
219 |
templates.add(new OriginalTemplate(templateFiles[0], headerFile, getTransformRules()));
|
|
220 |
if(pageType != S60TemplatePageType.M_CLASS_PAGE)
|
|
221 |
templates.add(new OriginalTemplate(templateFiles[1], sourceFile, getTransformRules()));
|
|
222 |
|
|
223 |
return templates;
|
|
224 |
}
|
|
225 |
|
|
226 |
protected AbstractList<IStatus> getStatuses() {
|
|
227 |
AbstractList<IStatus> statuses = new ArrayList<IStatus>();
|
|
228 |
|
|
229 |
statuses.add(Util.getFolderNameStatus(headerFolderSelection.getSelectedFolder(), Messages.getString("WizardPageHeaderFolderMsg"))); //$NON-NLS-1$
|
|
230 |
if(pageType != S60TemplatePageType.M_CLASS_PAGE)
|
|
231 |
statuses.add(Util.getFolderNameStatus(sourceFolderSelection.getSelectedFolder(), Messages.getString("WizardPageSourceFolderMsg"))); //$NON-NLS-1$
|
|
232 |
|
|
233 |
statuses.add(getFileNameStatus(classSelection.getSelectedFile(),fileNameSelection.getSelectedFile()));
|
|
234 |
|
|
235 |
return statuses;
|
|
236 |
}
|
|
237 |
|
|
238 |
protected void updateFields() {
|
|
239 |
if(pageType != S60TemplatePageType.M_CLASS_PAGE)
|
|
240 |
subSystemText.setText(Util.getSubSystemName(sourceFolderSelection.getSelectedFolder()));
|
|
241 |
moduleText.setText(Util.getModuleName(headerFolderSelection.getSelectedFolder()));
|
|
242 |
}
|
|
243 |
|
|
244 |
protected void savePreferencesToStore() {
|
|
245 |
if(preferenceStore.getBoolean(PreferenceConstants.OPENED_FROM_VIEW)==false)
|
|
246 |
{
|
|
247 |
if(pageType != S60TemplatePageType.M_CLASS_PAGE)
|
|
248 |
preferenceStore.setValue(PreferenceConstants.SF_CLASS_PAGE_SRCDIR, sourceFolderSelection.getSelectedFolder());
|
|
249 |
preferenceStore.setValue(PreferenceConstants.SF_CLASS_PAGE_HDRDIR, headerFolderSelection.getSelectedFolder());
|
|
250 |
preferenceStore.setValue(PreferenceConstants.SF_CLASS_PAGE_MODULE, moduleText.getText());
|
|
251 |
preferenceStore.setValue(PreferenceConstants.SF_CLASS_PAGE_SUBSYSTEM, subSystemText.getText());
|
|
252 |
}
|
|
253 |
preferenceStore.setValue(PreferenceConstants.SF_LICENSE_INDEX, licenseText.getSelectionIndex());
|
|
254 |
LastUsedData saveData = new LastUsedData();
|
|
255 |
saveData.saveValues(LastUsedData.ValueTypes.NAME, companyNameText.getText());
|
|
256 |
saveData.saveValues(LastUsedData.ValueTypes.COPYRIGHT, copyrightString.getText());
|
|
257 |
}
|
|
258 |
|
|
259 |
private void setPreferencesFromStore() {
|
|
260 |
if(preferenceStore.getBoolean(PreferenceConstants.OPENED_FROM_VIEW)==false)
|
|
261 |
{
|
|
262 |
if(pageType != S60TemplatePageType.M_CLASS_PAGE && preferenceStore.getString(PreferenceConstants.SF_CLASS_PAGE_SRCDIR)!="")
|
|
263 |
sourceFolderSelection.setSelectedFolder(preferenceStore.getString(PreferenceConstants.SF_CLASS_PAGE_SRCDIR));
|
|
264 |
if(preferenceStore.getString(PreferenceConstants.SF_CLASS_PAGE_SRCDIR)!="")
|
|
265 |
headerFolderSelection.setSelectedFolder(preferenceStore.getString(PreferenceConstants.SF_CLASS_PAGE_HDRDIR));
|
|
266 |
moduleText.setText(preferenceStore.getString(PreferenceConstants.SF_CLASS_PAGE_MODULE));
|
|
267 |
subSystemText.setText(preferenceStore.getString(PreferenceConstants.SF_CLASS_PAGE_SUBSYSTEM));
|
|
268 |
}
|
|
269 |
licenseText.select(preferenceStore.getInt(PreferenceConstants.SF_LICENSE_INDEX));
|
|
270 |
}
|
|
271 |
|
|
272 |
private Map<String, String> getTransformRules() {
|
|
273 |
Map<String, String> transformRules = new HashMap<String, String>();
|
|
274 |
|
|
275 |
transformRules.put(S60TransformKeys.getString("key_filename"), fileNameSelection.getSelectedFileWithoutExtension()); //$NON-NLS-1$
|
|
276 |
transformRules.put(S60TransformKeys.getString("key_module"), moduleText.getText()); //$NON-NLS-1$
|
|
277 |
transformRules.put(S60TransformKeys.getString("key_subsystem"), subSystemText.getText()); //$NON-NLS-1$
|
|
278 |
transformRules.put(S60TransformKeys.getString("key_description"), descriptionText.getText()); //$NON-NLS-1$
|
|
279 |
transformRules.put(S60TransformKeys.getString("key_copyright"), copyrightText.getText()); //$NON-NLS-1$
|
|
280 |
transformRules.put(S60TransformKeys.getString("key_classname"), classSelection.getSelectedFileWithoutExtension()); //$NON-NLS-1$
|
|
281 |
transformRules.put(S60TransformKeys.getString("key_license"), licenseText.getText()); //$NON-NLS-1$
|
|
282 |
transformRules.put(S60TransformKeys.getString("key_companyname"), companyNameText.getText()); //$NON-NLS-1$
|
|
283 |
transformRules.put(S60TransformKeys.getString("key_companycopyright"), copyrightString.getText());
|
|
284 |
|
|
285 |
if(licenseText.getText().equalsIgnoreCase("Symbian Foundation License v1.0"))
|
|
286 |
transformRules.put(S60TransformKeys.getString("key_licenseurl"), "http://www.symbianfoundation.org/legal/sfl-v10.html");
|
|
287 |
else if(licenseText.getText().equalsIgnoreCase("Eclipse Public License v1.0"))
|
|
288 |
transformRules.put(S60TransformKeys.getString("key_licenseurl"), "http://www.eclipse.org/legal/epl-v10.html");
|
|
289 |
|
|
290 |
String upperCaseClassName = classSelection.getSelectedFileWithoutExtension().toUpperCase();
|
|
291 |
|
|
292 |
switch(pageType) {
|
|
293 |
case C_CLASS_PAGE:
|
|
294 |
transformRules.put(S60TransformKeys.getString("key_cclassname"), "C_" + upperCaseClassName + "_H"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
|
295 |
break;
|
|
296 |
case M_CLASS_PAGE:
|
|
297 |
transformRules.put(S60TransformKeys.getString("key_mclassname"), "M_" + upperCaseClassName + "_H"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
|
298 |
break;
|
|
299 |
case R_CLASS_PAGE:
|
|
300 |
transformRules.put(S60TransformKeys.getString("key_rclassname"), "R_" + upperCaseClassName + "_H"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
|
301 |
break;
|
|
302 |
case T_CLASS_PAGE:
|
|
303 |
transformRules.put(S60TransformKeys.getString("key_tclassname"), "T_" + upperCaseClassName + "_H"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
|
304 |
break;
|
|
305 |
}
|
|
306 |
|
|
307 |
return transformRules;
|
|
308 |
}
|
|
309 |
|
|
310 |
private IStatus getFileNameStatus(String className,String fileName) {
|
|
311 |
IStatus fileStatus = new Status(IStatus.OK, SymbianFoundationTemplates.PLUGIN_ID, 0, "", null); //$NON-NLS-1$
|
|
312 |
|
|
313 |
if(className.length() == 0)
|
|
314 |
fileStatus = new Status(IStatus.ERROR, SymbianFoundationTemplates.PLUGIN_ID, -1, Messages.getString("WizardPageErrorClassNameEmpty"), null); //$NON-NLS-1$
|
|
315 |
else if(fileName.length() == 0)
|
|
316 |
fileStatus = new Status(IStatus.ERROR, SymbianFoundationTemplates.PLUGIN_ID, -1, Messages.getString("WizardPageErrorFileNameEmpty"), null);
|
|
317 |
else if(fileName.indexOf(" ")!=-1)
|
|
318 |
fileStatus = new Status(IStatus.ERROR, SymbianFoundationTemplates.PLUGIN_ID, -1, Messages.getString("WizardPageErrorFileNameHasSpaces"), null);
|
|
319 |
else if(!Util.checkFileName(className))
|
|
320 |
fileStatus = new Status(IStatus.ERROR, SymbianFoundationTemplates.PLUGIN_ID, -1, className+Messages.getString("WizardPageErrorInvalidClassName"), null);
|
|
321 |
else if(!Util.checkFileName(fileName))
|
|
322 |
fileStatus = new Status(IStatus.ERROR, SymbianFoundationTemplates.PLUGIN_ID, -1, fileName+Messages.getString("WizardPageErrorInvalidFileName"), null);
|
|
323 |
else if(headerFolderSelection.getSelectedFolder()!="" && Util.getSelectedFile(fileName + ".h", headerFolderSelection.getSelectedFolder()).exists()) //$NON-NLS-1$
|
|
324 |
fileStatus = new Status(IStatus.ERROR, SymbianFoundationTemplates.PLUGIN_ID, -1, Messages.getString("WizardPageErrorClassHeader") + fileName + ".h" + Messages.getString("WizardPageErrorClassAlreadyExists"), null); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
|
325 |
else if(pageType != S60TemplatePageType.M_CLASS_PAGE && sourceFolderSelection.getSelectedFolder()!="" && Util.getSelectedFile(fileName + ".cpp", sourceFolderSelection.getSelectedFolder()).exists()) //$NON-NLS-1$
|
|
326 |
fileStatus = new Status(IStatus.ERROR, SymbianFoundationTemplates.PLUGIN_ID, -1, Messages.getString("WizardPageErrorClassSource") + fileName + ".cpp" + Messages.getString("WizardPageErrorClassAlreadyExists"), null); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
|
327 |
|
|
328 |
else {
|
|
329 |
String message = Messages.getString("WizardPageWarningClassNameDiscouraged"); //$NON-NLS-1$
|
|
330 |
|
|
331 |
switch(pageType) {
|
|
332 |
case C_CLASS_PAGE:
|
|
333 |
if(!className.startsWith("C")) //$NON-NLS-1$
|
|
334 |
fileStatus = new Status(IStatus.WARNING, SymbianFoundationTemplates.PLUGIN_ID, 1, message + "C.", null); //$NON-NLS-1$
|
|
335 |
break;
|
|
336 |
case M_CLASS_PAGE:
|
|
337 |
if(!className.startsWith("M")) //$NON-NLS-1$
|
|
338 |
fileStatus = new Status(IStatus.WARNING, SymbianFoundationTemplates.PLUGIN_ID, 1, message + "M.", null); //$NON-NLS-1$
|
|
339 |
break;
|
|
340 |
case R_CLASS_PAGE:
|
|
341 |
if(!className.startsWith("R")) //$NON-NLS-1$
|
|
342 |
fileStatus = new Status(IStatus.WARNING, SymbianFoundationTemplates.PLUGIN_ID, 1, message + "R.", null); //$NON-NLS-1$
|
|
343 |
break;
|
|
344 |
case T_CLASS_PAGE:
|
|
345 |
if(!className.startsWith("T")) //$NON-NLS-1$
|
|
346 |
fileStatus = new Status(IStatus.WARNING, SymbianFoundationTemplates.PLUGIN_ID, 1, message + "T.", null); //$NON-NLS-1$
|
|
347 |
break;
|
|
348 |
}
|
|
349 |
}
|
|
350 |
|
|
351 |
return fileStatus;
|
|
352 |
}
|
|
353 |
|
|
354 |
private String getTemplateFile() {
|
|
355 |
String location = SymbianFoundationTemplates.getDefault().getTemplatesPath() + File.separator;
|
|
356 |
String[] templateFiles = pageType.getTemplateFiles().split(";"); //$NON-NLS-1$
|
|
357 |
if(!cleanBtn.getSelection())
|
|
358 |
return location + templateFiles[2] + ";" + location + templateFiles[3]; //$NON-NLS-1$
|
|
359 |
|
|
360 |
return location + templateFiles[0] + ";" + location + templateFiles[1]; //$NON-NLS-1$
|
|
361 |
}
|
|
362 |
@Override
|
|
363 |
public void handleEvent(Event event) {
|
|
364 |
if(event.widget == classSelection.getTextControl())
|
|
365 |
{
|
|
366 |
fileNameSelection.setFileName(classSelection.getSelectedFile());
|
|
367 |
}
|
|
368 |
super.handleEvent(event);
|
|
369 |
}
|
|
370 |
}
|