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