frameworkplugins/com.nokia.s60tools.ui/src/com/nokia/s60tools/ui/wizards/DebugMetadataWizardPage.java
author dpodwall
Tue, 12 Jan 2010 13:17:53 -0600
changeset 0 61163b28edca
child 8 df27719e5a0d
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) 2008 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
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    18
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    19
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    20
package com.nokia.s60tools.ui.wizards;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    21
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    22
import java.io.File;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    23
import org.eclipse.swt.widgets.DirectoryDialog;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    24
import org.eclipse.swt.SWT;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    25
import org.eclipse.swt.dnd.DND;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    26
import org.eclipse.swt.dnd.DropTarget;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    27
import org.eclipse.swt.dnd.DropTargetEvent;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    28
import org.eclipse.swt.dnd.DropTargetListener;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    29
import org.eclipse.swt.dnd.FileTransfer;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    30
import org.eclipse.swt.dnd.Transfer;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    31
import org.eclipse.swt.events.ModifyEvent;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    32
import org.eclipse.swt.events.ModifyListener;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    33
import org.eclipse.swt.events.SelectionEvent;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    34
import org.eclipse.swt.events.SelectionListener;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    35
import org.eclipse.swt.layout.GridData;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    36
import org.eclipse.swt.layout.GridLayout;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    37
import org.eclipse.swt.widgets.Button;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    38
import org.eclipse.swt.widgets.List;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    39
import org.eclipse.swt.widgets.Combo;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    40
import org.eclipse.swt.widgets.Composite;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    41
import org.eclipse.swt.widgets.FileDialog;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    42
import org.eclipse.swt.widgets.Group;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    43
import org.eclipse.swt.widgets.Label;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    44
import org.eclipse.swt.widgets.Text;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    45
import org.eclipse.ui.PlatformUI;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    46
import org.eclipse.jface.dialogs.IDialogSettings;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    47
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    48
import com.nokia.s60tools.ui.internal.resources.Messages;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    49
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    50
import java.util.*;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    51
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    52
/**
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    53
 * Wizard page for querying user for: Symbol, map and image files.
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    54
 * 
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    55
 * This page can also be used to query selge.ini location, but this
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    56
 * functionality is hidden from the user at the moment. It might 
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    57
 * be restored in the future.
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 abstract class DebugMetadataWizardPage extends S60ToolsWizardPage implements
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    61
		SelectionListener, ModifyListener, DropTargetListener {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    62
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    63
	// defines for map file radio buttons
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    64
	final int NO_MAP_FILES_RADIO = 0;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    65
	final int SDK_MAP_FILES_FOLDER_RADIO = 1;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    66
	final int MAP_FILES_ZIP_RADIO = 2;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    67
	final int MAP_FILES_FOLDER_RADIO = 3;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    68
	
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    69
	// width hint for all buttons in the page
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    70
	final int BUTTON_WIDTH = 60;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    71
	// height hint for all lists in the page
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    72
	final int LIST_HEIGHT = 50;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    73
	
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    74
	// filters for file selection dialogs
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    75
	static final String SELGE_INI_FILTER = "selge.ini";
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    76
	static final String SYMBOL_FILTER = "*.symbol";
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    77
	static final String ZIP_FILTER = "*.zip";
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    78
	static final String[] IMAGE_FILTER = {"*.fpsx", "*.img", "*.v??", ".c??", "*.*"};
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    79
	
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    80
	// wizard saves last entered values to these tags in dialog_settings.xml
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    81
	static final String LAST_USED_SELGE_INI_FILES = "SelgeIniFiles"; //$NON-NLS-1$
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    82
	static final String LAST_USED_SYMBOL_FILES = "SymbolFiles"; //$NON-NLS-1$
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    83
	static final String LAST_USED_DECODING_STYLE = "SymbolFileWasUsedLast"; //$NON-NLS-1$
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    84
	static final String LAST_USED_MAPFILES_FOLDER = "MapFilesFolder"; //$NON-NLS-1$
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    85
	static final String LAST_USED_MAPZIP_FILES = "MapZipFiles"; //$NON-NLS-1$
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    86
	static final String LAST_USED_IMAGE_FILES = "ImageFiles"; //$NON-NLS-1$
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    87
	static final String LAST_USED_MAPFILE_TYPE = "LastUsedMapFileType"; //$NON-NLS-1$
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    88
	static final String LAST_USED_SDK = "LastUsedSdk"; //$NON-NLS-1$
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    89
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    90
	// top level containers
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    91
	protected Composite composite;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    92
	protected Group groupSelge; // selge group is hidden at all times. Might be restored in the future
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    93
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    94
	// selge.ini page items. Page cannot be show at the moment. Might be restored in the future.
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    95
	protected Button buttonSelgeRadio;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    96
	protected Button buttonSelgeBrowse;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    97
	protected Button buttonShowSelgeDetails;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    98
	protected Text textSelgeDetails;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    99
	protected Combo comboSelge;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   100
	protected Label labelSelge;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   101
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   102
	// symbol page items
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   103
	protected Button buttonSymbolRadio = null;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   104
	protected Button buttonMapFolderBrowse;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   105
	protected Button buttonZipBrowse;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   106
	protected Button buttonMapFilesZipRadio;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   107
	protected Button buttonMapFilesFolderRadio;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   108
	protected Button buttonSdkFolderRadio;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   109
	protected Button buttonNoMapFilesRadio;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   110
	protected Button buttonAddSymbol;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   111
	protected Button buttonRemoveSymbol;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   112
	protected Button buttonAddImageFile;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   113
	protected Button buttonRemoveImageFile;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   114
	protected Combo comboMapFilesFolder;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   115
	protected Combo comboMapFilesZip;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   116
	protected Combo comboSdkFolder;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   117
	protected Group groupSymbolFiles;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   118
	protected Group groupMapFiles;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   119
	protected Group groupImageFiles;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   120
	protected Group groupSelgeSymbolRadios;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   121
	protected Label labelMapFilesFolder;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   122
	protected Label labelZip;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   123
	protected Label labelSdkFolder;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   124
	protected Label labelNoMapFiles;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   125
	protected List listSymbols;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   126
	protected List listImageFiles;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   127
	
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   128
	// owner can pass in ROM IDs so that we can check that correct symbol is selected
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   129
	protected String[] romIds = null;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   130
	
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   131
	// holds SDK names and their folders
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   132
	protected HashMap<String, String> sdkFolders = null;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   133
	
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   134
	// default location of selge.ini. 
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   135
	protected String defaultSelgeIniFile = "\\\\Vagrp014\\groups4\\Builds\\S60RnD\\S60_5_0\\SelgeIniFile\\selge.ini"; //$NON-NLS-1$
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   136
	
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   137
	// defines whether image files selection should be visible in the page
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   138
	boolean showImageFilesGroup = false;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   139
	
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   140
	// section where this wizard pages data is saved
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   141
	IDialogSettings previousValuesSection;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   142
	
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   143
	// defines how many previous user entered values are saved
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   144
	final int MAX_SAVED_VALUES;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   145
	
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   146
	/**
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   147
	 * Constructor.
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   148
	 * 
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   149
	 * @param pageName name of the page
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   150
	 * @param title page title
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   151
	 * @param imageFilesGroup if true, image files are queried from user. If false, image file are not queried
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   152
	 * @param section section where wizard reads/saves previously entered values
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   153
	 * @param maxSavedValues how many previously entered values are saved
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   154
	 */
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   155
	public DebugMetadataWizardPage(String pageName, 
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   156
									String title, 
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   157
									boolean imageFilesGroup,
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   158
									IDialogSettings section,
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   159
									int maxSavedValues){
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   160
		super(pageName);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   161
		MAX_SAVED_VALUES = maxSavedValues;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   162
		showImageFilesGroup = imageFilesGroup;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   163
		previousValuesSection = section;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   164
			
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   165
		setTitle(title);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   166
			
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   167
		setDescription(Messages.getString("DebugMetadataWizardPage.SelgeIniDescription")); //$NON-NLS-1$
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   168
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   169
		setPageComplete(true);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   170
	 }
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   171
	
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   172
	public abstract String getHelpContext();
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   173
	public abstract boolean canFinish();
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   174
	public abstract HashMap<String, String> getSdkMapFolders(); 
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   175
	public abstract boolean folderContainsMapFiles(String folder);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   176
	public abstract boolean zipContainsMapFiles(String path);
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
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   180
	@Override
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   181
	public void recalculateButtonStates() {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   182
	}
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   183
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   184
	@Override
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   185
	public void setInitialFocus() {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   186
		if (buttonSelgeRadio.getSelection())
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   187
			comboSelge.setFocus();
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   188
		else
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   189
			listSymbols.setFocus();
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   190
	}
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   191
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   192
	/**
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   193
	 * @see org.eclipse.jface.wizard.WizardPage
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   194
	 */
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   195
	public void createControl(Composite parent) {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   196
		composite = new Composite(parent, SWT.NULL);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   197
		GridLayout gl = new GridLayout();
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   198
		gl.numColumns = 1;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   199
		composite.setLayout(gl);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   200
		
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   201
		groupSelgeSymbolRadios = new Group(composite, SWT.NONE);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   202
		groupSelgeSymbolRadios.setLayout(gl);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   203
		groupSelgeSymbolRadios.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   204
		
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   205
		// Selge.ini radio button
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   206
		buttonSelgeRadio = new Button(groupSelgeSymbolRadios, SWT.RADIO);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   207
		buttonSelgeRadio.setText(Messages.getString("DebugMetadataWizardPage.UseSelgeIni")); //$NON-NLS-1$
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   208
		buttonSelgeRadio.setSelection(!symbolFileWasUsedPreviously());
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   209
		buttonSelgeRadio.addSelectionListener(this);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   210
		
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   211
		// symbol & map files radio button
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   212
		buttonSymbolRadio = new Button(groupSelgeSymbolRadios, SWT.RADIO);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   213
		buttonSymbolRadio.setText(Messages.getString("DebugMetadataWizardPage.DefinePathsManually")); //$NON-NLS-1$
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   214
		buttonSymbolRadio.setSelection(symbolFileWasUsedPreviously());
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   215
		
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   216
		createSelgeGroup();
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   217
		
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   218
		createSymbolGroup();
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   219
		
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   220
		setHelps();
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   221
		
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   222
		setInitialFocus();
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   223
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   224
		// selge.ini is not used at the moment, but it might be restored later
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   225
		hideSelgeIniSelection();
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   226
		
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   227
		Transfer[] types = new Transfer[] { FileTransfer.getInstance() };
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   228
	    DropTarget dropTarget = new DropTarget(composite, DND.DROP_COPY);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   229
	    dropTarget.setTransfer(types);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   230
	    dropTarget.addDropListener(this);		
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   231
		
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   232
		setControl(composite);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   233
	}
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   234
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   235
	/**
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   236
	 * Creates UI controls for selge.ini usage
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   237
	 *
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   238
	 */
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   239
	void createSelgeGroup() {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   240
		// Selge.ini group
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   241
		groupSelge = new Group(composite, SWT.NONE);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   242
		GridLayout gl = new GridLayout();
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   243
		GridData selgeGd = new GridData(GridData.FILL_BOTH);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   244
		gl.numColumns = 2;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   245
		groupSelge.setLayout(gl);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   246
		
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   247
		// show selge group if user used selge.ini last time, hide if symbol & map files was used
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   248
		groupSelge.setVisible(!symbolFileWasUsedPreviously()); 
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   249
		selgeGd.exclude = symbolFileWasUsedPreviously();
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   250
		groupSelge.setLayoutData(selgeGd);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   251
		
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   252
		// Selge.ini label
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   253
		labelSelge = new Label(groupSelge, SWT.LEFT);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   254
		GridData gd = new GridData(GridData.FILL_HORIZONTAL);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   255
		gd.horizontalSpan = 2;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   256
		labelSelge.setLayoutData(gd);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   257
		labelSelge.setText(Messages.getString("DebugMetadataWizardPage.SelgeIniFile")); //$NON-NLS-1$
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   258
		
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   259
		// Selge.ini combo
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   260
		comboSelge = new Combo(groupSelge, SWT.BORDER);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   261
		gd = new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_BEGINNING);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   262
		comboSelge.setLayoutData(gd);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   263
		comboSelge.addModifyListener(this);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   264
		
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   265
		String[] lastUsed = getPreviousPaths(LAST_USED_SELGE_INI_FILES);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   266
		// set the previous selge.ini file as default
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   267
		if (lastUsed != null) {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   268
			comboSelge.setItems(lastUsed);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   269
			comboSelge.select(0);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   270
		// user has not defined selge.ini previously, show default location
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   271
		} else {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   272
			comboSelge.setText(defaultSelgeIniFile);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   273
		}
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   274
		
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   275
		// Selge.ini browse button
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   276
		buttonSelgeBrowse = new Button(groupSelge, SWT.PUSH);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   277
		buttonSelgeBrowse.setText(Messages.getString("DebugMetadataWizardPage.Browse")); //$NON-NLS-1$
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   278
		buttonSelgeBrowse.addSelectionListener(this);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   279
		
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   280
		// Show selge.ini details button is not yet used i.e. shown to user
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   281
		GridData gdDetailsButton = new GridData();
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   282
		gdDetailsButton.horizontalSpan = 2;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   283
		buttonShowSelgeDetails = new Button(groupSelge, SWT.PUSH);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   284
		buttonShowSelgeDetails.setText(Messages.getString("DebugMetadataWizardPage.ShowDetails")); //$NON-NLS-1$
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   285
		buttonShowSelgeDetails.setLayoutData(gdDetailsButton);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   286
		buttonShowSelgeDetails.addSelectionListener(this);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   287
		buttonShowSelgeDetails.setVisible(false);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   288
		
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   289
		// textbox for selge.ini details. Not yet used.
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   290
		textSelgeDetails = new Text(groupSelge, SWT.READ_ONLY | SWT.MULTI | SWT.WRAP);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   291
		textSelgeDetails.setLayoutData(new GridData(GridData.FILL_BOTH));
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   292
	}
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   293
	
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   294
	/**
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   295
	 * Creates UI controls for symbol & map & image files usage.
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   296
	 *
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   297
	 */
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   298
	void createSymbolGroup() {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   299
		// Symbol group
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   300
		GridLayout gl = new GridLayout();
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   301
		gl.numColumns = 2;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   302
		GridData gd = new GridData(GridData.FILL_BOTH);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   303
		
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   304
		boolean visible = symbolFileWasUsedPreviously();
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   305
		// show symbol group if user used symbol & map files last time, hide if selge.ini was used
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   306
		gd.exclude = !visible;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   307
		if (visible)
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   308
			setDescription(Messages.getString("DebugMetadataWizardPage.SymbolDescription")); //$NON-NLS-1$
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   309
		
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   310
		// Symbol files group
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   311
		groupSymbolFiles = new Group(composite, SWT.LEFT);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   312
		groupSymbolFiles.setLayout(gl);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   313
		groupSymbolFiles.setLayoutData(new GridData(GridData.FILL_BOTH));
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   314
		GridData gdTwoSpan = new GridData(GridData.FILL_HORIZONTAL);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   315
		gdTwoSpan.horizontalSpan = 2;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   316
		groupSymbolFiles.setText(Messages.getString("DebugMetadataWizardPage.SymbolFiles")); //$NON-NLS-1$
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   317
		
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   318
		// Symbol file list
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   319
		listSymbols = new List(groupSymbolFiles, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL | SWT.MULTI);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   320
		GridData gdHorizontalTop = new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_BEGINNING);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   321
		gdHorizontalTop.verticalSpan = 2;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   322
		gdHorizontalTop.heightHint = LIST_HEIGHT;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   323
		listSymbols.setLayoutData(gdHorizontalTop);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   324
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   325
		// read last used symbol files to combo
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   326
		String[] lastUsed = getPreviousPaths(LAST_USED_SYMBOL_FILES);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   327
		if (lastUsed != null) {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   328
			listSymbols.setItems(lastUsed);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   329
		}				
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   330
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   331
		GridData gdButtons = new GridData();
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   332
		gdButtons.widthHint =  BUTTON_WIDTH;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   333
		
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   334
		// Add Symbol file button
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   335
		buttonAddSymbol = new Button(groupSymbolFiles, SWT.PUSH);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   336
		buttonAddSymbol.setText(Messages.getString("DebugMetadataWizardPage.Add")); //$NON-NLS-1$
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   337
		buttonAddSymbol.setLayoutData(gdButtons);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   338
		buttonAddSymbol.addSelectionListener(this);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   339
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   340
		// Remove Symbol file button
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   341
		buttonRemoveSymbol = new Button(groupSymbolFiles, SWT.PUSH);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   342
		buttonRemoveSymbol.setText(Messages.getString("DebugMetadataWizardPage.Remove")); //$NON-NLS-1$
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   343
		buttonRemoveSymbol.setLayoutData(gdButtons);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   344
		buttonRemoveSymbol.addSelectionListener(this);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   345
		
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   346
		createMapFilesGroup(composite);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   347
		
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   348
		// if image files UI is wanted, create it
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   349
		if (showImageFilesGroup)
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   350
			createImageFilesGroup(composite);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   351
	}
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
	 * Creates UI controls for map files usage.
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   355
	 *
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   356
	 */
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   357
	void createMapFilesGroup(Composite parent) {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   358
		// Map Files group
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   359
		groupMapFiles = new Group(parent, SWT.NONE);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   360
		GridData gd = new GridData(GridData.FILL_BOTH);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   361
		gd.horizontalSpan = 2;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   362
		gd.verticalIndent = 10;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   363
		GridLayout gl = new GridLayout();
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   364
		gl.numColumns = 3;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   365
		groupMapFiles.setLayout(gl);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   366
		groupMapFiles.setText(Messages.getString("DebugMetadataWizardPage.MapFiles")); //$NON-NLS-1$
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   367
		groupMapFiles.setLayoutData(gd);		
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   368
		
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   369
		// empty label to make layout correct
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   370
		new Label(groupMapFiles, SWT.LEFT);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   371
		
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   372
		// Map files folder label
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   373
		labelMapFilesFolder = new Label(groupMapFiles, SWT.LEFT);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   374
		GridData gdTwoSpanWithIndent = new GridData(GridData.FILL_HORIZONTAL);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   375
		gdTwoSpanWithIndent.horizontalSpan = 2;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   376
		gdTwoSpanWithIndent.verticalIndent = 10;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   377
		labelMapFilesFolder.setLayoutData(gdTwoSpanWithIndent);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   378
		labelMapFilesFolder.setText(Messages.getString("DebugMetadataWizardPage.MapFilesFolder")); //$NON-NLS-1$
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   379
		
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   380
		// Map files folder radio button
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   381
		buttonMapFilesFolderRadio = new Button(groupMapFiles, SWT.RADIO);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   382
		buttonMapFilesFolderRadio.addSelectionListener(this);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   383
		
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   384
		// Map files folder combo
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   385
		comboMapFilesFolder = new Combo(groupMapFiles, SWT.BORDER);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   386
		GridData gdHorizontal = new GridData(GridData.FILL_HORIZONTAL);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   387
		comboMapFilesFolder.setLayoutData(gdHorizontal);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   388
		comboMapFilesFolder.addModifyListener(this);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   389
		
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   390
		// read last used map file folders to combo
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   391
		String[] lastUsed = getPreviousPaths(LAST_USED_MAPFILES_FOLDER);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   392
		if (lastUsed != null) {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   393
			comboMapFilesFolder.setItems(lastUsed);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   394
			comboMapFilesFolder.select(0);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   395
		}						
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   396
		
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   397
		// Map files folder browse button
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   398
		buttonMapFolderBrowse = new Button(groupMapFiles, SWT.PUSH);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   399
		buttonMapFolderBrowse.setText(Messages.getString("DebugMetadataWizardPage.Browse")); //$NON-NLS-1$
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   400
		buttonMapFolderBrowse.addSelectionListener(this);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   401
		
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   402
		// empty label to make layout correct
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   403
		new Label(groupMapFiles, SWT.LEFT);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   404
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   405
		// MapFiles.zip label
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   406
		labelZip = new Label(groupMapFiles, SWT.LEFT);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   407
		GridData gdTwoSpan = new GridData(GridData.FILL_HORIZONTAL);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   408
		gdTwoSpan.horizontalSpan = 2;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   409
		labelZip.setLayoutData(gdTwoSpan);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   410
		labelZip.setText(Messages.getString("DebugMetadataWizardPage.MapFilesZip")); //$NON-NLS-1$
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   411
		
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   412
		// MapFiles.zip radio button
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   413
		buttonMapFilesZipRadio = new Button(groupMapFiles, SWT.RADIO);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   414
		buttonMapFilesZipRadio.addSelectionListener(this);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   415
		
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   416
		// MapFiles.zip combo
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   417
		comboMapFilesZip = new Combo(groupMapFiles, SWT.BORDER);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   418
		comboMapFilesZip.setLayoutData(gdHorizontal);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   419
		comboMapFilesZip.addModifyListener(this);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   420
		
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   421
		// read last used mapfiles.zip file paths to combo
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   422
		lastUsed = getPreviousPaths(LAST_USED_MAPZIP_FILES);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   423
		if (lastUsed != null) {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   424
			comboMapFilesZip.setItems(lastUsed);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   425
			comboMapFilesZip.select(0);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   426
		}						
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   427
		
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   428
		// MapFiles.zip browse button
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   429
		buttonZipBrowse = new Button(groupMapFiles, SWT.PUSH);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   430
		buttonZipBrowse.setText(Messages.getString("DebugMetadataWizardPage.Browse")); //$NON-NLS-1$
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   431
		buttonZipBrowse.addSelectionListener(this);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   432
		
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   433
		// empty label to make layout correct
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   434
		new Label(groupMapFiles, SWT.LEFT);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   435
		
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   436
		// SDK folder label
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   437
		labelSdkFolder = new Label(groupMapFiles, SWT.LEFT);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   438
		labelSdkFolder.setLayoutData(gdTwoSpan);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   439
		labelSdkFolder.setText(Messages.getString("DebugMetadataWizardPage.SdkMapFilesFolder")); //$NON-NLS-1$
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   440
		
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   441
		// SDK folder radio button
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   442
		buttonSdkFolderRadio = new Button(groupMapFiles, SWT.RADIO);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   443
		buttonSdkFolderRadio.addSelectionListener(this);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   444
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   445
		// SDK folder combo
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   446
		comboSdkFolder = new Combo(groupMapFiles, SWT.BORDER | SWT.READ_ONLY);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   447
		comboSdkFolder.setLayoutData(gdHorizontal);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   448
		comboSdkFolder.addModifyListener(this);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   449
		comboSdkFolder.setVisibleItemCount(50);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   450
		
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   451
		sdkFolders = getSdkMapFolders();
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   452
		
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   453
		// if no SDK folders were found disable SDK combo
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   454
		if (sdkFolders == null || sdkFolders.size() < 1) {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   455
			disableSdkSelection();
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   456
		// SDK folders were found, fill SDK combo with those values
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   457
		} else {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   458
			Set<String> keySet = sdkFolders.keySet();
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   459
			String[] keys = keySet.toArray(new String[keySet.size()]);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   460
			Arrays.sort(keys);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   461
			comboSdkFolder.setItems(keys);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   462
		}
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   463
		
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   464
		// read which SDK folder was used last, and select it in SDK combo if possible
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   465
		lastUsed = getPreviousPaths(LAST_USED_SDK);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   466
		if (lastUsed != null && sdkFolders != null && buttonSdkFolderRadio.getEnabled()) {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   467
			String[] items = comboSdkFolder.getItems();
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   468
			for (int i = 0; i < items.length; i++) {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   469
				if (items[i].equalsIgnoreCase(lastUsed[0])) {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   470
					comboSdkFolder.select(i);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   471
					break;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   472
				}
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   473
			}
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   474
		}										
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   475
		
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   476
		// empty label to make layout correct
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   477
		new Label(groupMapFiles, SWT.LEFT);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   478
		
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   479
		// No map files radio button
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   480
		buttonNoMapFilesRadio = new Button(groupMapFiles, SWT.RADIO);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   481
		buttonNoMapFilesRadio.addSelectionListener(this);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   482
		
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   483
		// No map files label
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   484
		labelNoMapFiles = new Label(groupMapFiles, SWT.LEFT);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   485
		labelNoMapFiles.setText(Messages.getString("DebugMetadataWizardPage.NoMapFiles")); //$NON-NLS-1$
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   486
		labelNoMapFiles.setLayoutData(gdTwoSpan);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   487
		
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   488
		// read how map files were used last time (i.e. which radio button
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   489
		// was selected) and select the same radio button this time.
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   490
		int lastUsedMapRadio = lastUsedMapFileType();
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   491
		switch (lastUsedMapRadio) {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   492
		case MAP_FILES_FOLDER_RADIO:
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   493
			buttonMapFilesFolderRadio.setSelection(true);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   494
			break;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   495
		case MAP_FILES_ZIP_RADIO:
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   496
			buttonMapFilesZipRadio.setSelection(true);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   497
			break;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   498
		case SDK_MAP_FILES_FOLDER_RADIO:
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   499
			buttonSdkFolderRadio.setSelection(true);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   500
			break;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   501
		default:
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   502
			buttonNoMapFilesRadio.setSelection(true);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   503
			break;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   504
		}
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   505
		
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   506
		enableMapSelections();
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   507
	}
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   508
	
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   509
	/**
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   510
	 * Creates UI controls for image files usage.
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   511
	 *
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   512
	 */
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   513
	void createImageFilesGroup(Composite parent) {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   514
		// Image files group
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   515
		groupImageFiles = new Group(parent, SWT.NONE);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   516
		GridData gd = new GridData(GridData.FILL_BOTH);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   517
		gd.horizontalSpan = 2;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   518
		gd.verticalIndent = 10;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   519
		GridLayout gl = new GridLayout();
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   520
		gl.numColumns = 2;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   521
		groupImageFiles.setLayout(gl);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   522
		groupImageFiles.setText(Messages.getString("DebugMetadataWizardPage.ImageFiles")); //$NON-NLS-1$
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   523
		groupImageFiles.setLayoutData(gd);		
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   524
		
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   525
		// Image file list
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   526
		listImageFiles = new List(groupImageFiles, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL | SWT.MULTI);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   527
		GridData gdHorizontalTop = new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_BEGINNING);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   528
		gdHorizontalTop.verticalSpan = 2;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   529
		gdHorizontalTop.heightHint = LIST_HEIGHT;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   530
		listImageFiles.setLayoutData(gdHorizontalTop);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   531
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   532
		// read last used image files and fill them into the list
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   533
		String[] lastUsed = getPreviousPaths(LAST_USED_IMAGE_FILES);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   534
		if (lastUsed != null) {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   535
			listImageFiles.setItems(lastUsed);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   536
		}				
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   537
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   538
		GridData gdButtons = new GridData();
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   539
		gdButtons.widthHint =  BUTTON_WIDTH;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   540
		
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   541
		// Add image file button
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   542
		buttonAddImageFile = new Button(groupImageFiles, SWT.PUSH);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   543
		buttonAddImageFile.setText(Messages.getString("DebugMetadataWizardPage.Add")); //$NON-NLS-1$
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   544
		buttonAddImageFile.setLayoutData(gdButtons);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   545
		buttonAddImageFile.addSelectionListener(this);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   546
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   547
		// Remove image file button
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   548
		buttonRemoveImageFile = new Button(groupImageFiles, SWT.PUSH);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   549
		buttonRemoveImageFile.setText(Messages.getString("DebugMetadataWizardPage.Remove")); //$NON-NLS-1$
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   550
		buttonRemoveImageFile.setLayoutData(gdButtons);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   551
		buttonRemoveImageFile.addSelectionListener(this);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   552
	}
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   553
	
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   554
	/**
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   555
	 * This'll disable selge.ini selection from user
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   556
	 */
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   557
	void hideSelgeIniSelection() {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   558
		// hide radios group
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   559
		GridData  gd = (GridData)groupSelgeSymbolRadios.getLayoutData();
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   560
		gd.exclude = true;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   561
		groupSelgeSymbolRadios.setVisible(false);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   562
		buttonSymbolRadio.setSelection(true);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   563
		
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   564
		// show symbol group
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   565
// ROWS COMMENTED SO THAT THEY CAN BE RESTORED INCASE SELGE.INI USAGE IS RESTORED		
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   566
/*		gd = (GridData)groupSymbol.getLayoutData();
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   567
		groupSymbol.setVisible(true);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   568
		gd.exclude = false;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   569
*/		
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   570
		// hide selge group
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   571
		gd = (GridData)groupSelge.getLayoutData();
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   572
		gd.exclude = true;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   573
		groupSelge.setVisible(false);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   574
		buttonSelgeRadio.setSelection(false);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   575
		
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   576
		setDescription(Messages.getString("DebugMetadataWizardPage.SymbolDescription")); //$NON-NLS-1$
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   577
		
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   578
		composite.layout();	
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   579
	}
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   580
	
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   581
	/**
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   582
	 * Return the default selge.ini file 
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   583
	 */
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   584
	public String getDefaultSelgeIniFile() {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   585
		return defaultSelgeIniFile;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   586
	}
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   587
	
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   588
	/**
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   589
	 * Returns the selected selge.ini file. Returns empty if symbol group
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   590
	 * is visible.
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   591
	 */
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   592
	public String getSelgeIniFile() {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   593
		if (buttonSymbolRadio.getSelection()) {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   594
			return ""; //$NON-NLS-1$
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   595
		} else {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   596
			return comboSelge.getText();
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   597
		}
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   598
	}
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   599
	
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   600
	/**
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   601
	 * Returns symbols files selected by user. If selge.ini group is visible,
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   602
	 * null is returned. 
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   603
	 */
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   604
	public String[] getSymbolFiles() {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   605
		if (buttonSelgeRadio.getSelection()) {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   606
			return null;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   607
		}
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   608
		
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   609
		return listSymbols.getItems();
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   610
	}
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   611
	
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   612
	/**
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   613
	 * Returns the selected map files folder. Return value depends on which
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   614
	 * map files radio button is selected. Returns empty if MapFiles.zip radio
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   615
	 * button is selected.  
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   616
	 */
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   617
	public String getMapFilesFolder() {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   618
		// if selge.ini group is visible, return empty
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   619
		if (buttonSelgeRadio.getSelection()) {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   620
			return ""; //$NON-NLS-1$
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   621
		// MapFiles.zip radio is selected, return empty
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   622
		}else if (buttonMapFilesZipRadio.getSelection()) {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   623
			return ""; //$NON-NLS-1$
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   624
		// Map Files folder radio button is selected
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   625
		} else if (buttonMapFilesFolderRadio.getSelection()) {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   626
			return comboMapFilesFolder.getText();
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   627
		// "SDK Map files folder" radio button is selected, return correct sdk folder
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   628
		} else if (buttonSdkFolderRadio.getSelection() && 
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   629
				   buttonSdkFolderRadio.getEnabled()   &&
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   630
				   sdkFolders != null && sdkFolders.size() > 0 &&
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   631
				   comboSdkFolder.getSelectionIndex() >= 0) {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   632
			return sdkFolders.get(comboSdkFolder.getText());
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   633
		// otherwise return empty
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   634
		} else {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   635
			return ""; //$NON-NLS-1$
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   636
		}
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   637
	}
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   638
	
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   639
	/**
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   640
	 * Returns the MapFiles.zip location user has provided. If MapFiles.zip radio button
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   641
	 * is not selected, this will return empty. 
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   642
	 */
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   643
	public String getMapFilesZip() {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   644
		// if selge.ini group is visible, return empty
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   645
		if (buttonSelgeRadio.getSelection()) {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   646
			return ""; //$NON-NLS-1$
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   647
		// return empty if MapFiles.zip radio button is not selected
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   648
		} else if (!buttonMapFilesZipRadio.getSelection()) {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   649
			return ""; //$NON-NLS-1$
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   650
		}
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   651
		
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   652
		return comboMapFilesZip.getText();
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   653
	}
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   654
	
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   655
	/**
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   656
	 * Returns image files selected by user. If selge.ini group is visible,
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   657
	 * null is returned. 
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   658
	 */
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   659
	public String[] getImageFiles() {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   660
		if (buttonSelgeRadio.getSelection()) {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   661
			return null;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   662
		}
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   663
		
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   664
		return listImageFiles.getItems();
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   665
	}
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   666
	
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   667
	/**
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   668
	 * Returns the provided ROM IDs 
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   669
	 */
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   670
	public String[] getRomIds() {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   671
		return romIds;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   672
	}
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   673
	
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   674
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   675
	/**
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   676
	 * Disables "SDK Map files folder" radio button & combo & label
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   677
	 */
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   678
	void disableSdkSelection() {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   679
		if (buttonSdkFolderRadio.getSelection())
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   680
			buttonNoMapFilesRadio.setSelection(true);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   681
		buttonSdkFolderRadio.setEnabled(false);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   682
		comboSdkFolder.setEnabled(false);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   683
	}
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   684
	
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   685
	public void widgetDefaultSelected(SelectionEvent arg0) {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   686
	}
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   687
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   688
	public void widgetSelected(SelectionEvent event) {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   689
		// change between selge.ini "view" and symbol&map files "view"
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   690
		if (event.widget == buttonSelgeRadio || event.widget == buttonSymbolRadio) {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   691
			this.setErrorMessage(null);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   692
// ROWS COMMENTED SO THAT THEY CAN BE RESTORED INCASE SELGE.INI USAGE IS RESTORED			
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   693
/*			boolean selgeButtonSelected = buttonSelgeRadio.getSelection();
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   694
			GridData gd = (GridData)groupSymbol.getLayoutData();
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   695
			boolean visible = !(gd.exclude = selgeButtonSelected);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   696
			groupSymbol.setVisible(visible);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   697
			
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   698
			gd = (GridData)groupSelge.getLayoutData();
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   699
			visible = !(gd.exclude = !selgeButtonSelected);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   700
			groupSelge.setVisible(visible);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   701
			if (visible) {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   702
				setDescription(Messages.getString("DebugMetadataWizardPage.SelgeIniDescription")); //$NON-NLS-1$
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   703
			} else {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   704
*/				setDescription(Messages.getString("DebugMetadataWizardPage.SymbolDescription")); //$NON-NLS-1$
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   705
//			}
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   706
			
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   707
			try {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   708
				getWizard().getContainer().updateButtons();
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   709
			} catch (Exception E) {}
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   710
			
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   711
			composite.layout();	
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   712
			
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   713
		// selge.ini browse button pressed
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   714
		} else if (event.widget == buttonSelgeBrowse) {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   715
			FileDialog dialog = new FileDialog(this.getShell(), SWT.OPEN);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   716
			dialog.setText(Messages.getString("DebugMetadataWizardPage.SelectSelgeIniFile")); //$NON-NLS-1$
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   717
			String[] filterExt = {SELGE_INI_FILTER};
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   718
	        dialog.setFilterExtensions(filterExt);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   719
	        dialog.setFilterPath(comboSelge.getText());
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   720
			String result = dialog.open();
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   721
			comboSelge.setText(result);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   722
			
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   723
		// show selge.ini details button pressed
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   724
		} else if (event.widget == buttonShowSelgeDetails) {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   725
						
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   726
		// Add symbol file button pressed
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   727
		} else if (event.widget == buttonAddSymbol) {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   728
			FileDialog dialog = new FileDialog(this.getShell(), SWT.OPEN | SWT.MULTI);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   729
			dialog.setText(Messages.getString("DebugMetadataWizardPage.SelectSymbolFile")); //$NON-NLS-1$
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   730
			String[] filterExt = {SYMBOL_FILTER};
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   731
	        dialog.setFilterExtensions(filterExt);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   732
			String result = dialog.open();
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   733
			// if user selected files, check that files don't already exist in the list
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   734
			// and add them if they don't already exist.
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   735
			if (result != null) {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   736
				String[] fileNames = dialog.getFileNames();
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   737
				if (fileNames != null) {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   738
					String path = dialog.getFilterPath() + File.separator;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   739
					for (int j = 0; j < fileNames.length; j++) {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   740
						String filePath = path + fileNames[j];
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   741
						String[] listItems = listSymbols.getItems();
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   742
						if (listItems != null && listItems.length > 0) {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   743
							boolean found = false;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   744
							for (int i = 0; i < listItems.length; i++) {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   745
								String listItem = listItems[i];
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   746
								if (listItem.compareToIgnoreCase(filePath) == 0) {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   747
									found = true;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   748
									break;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   749
								}
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   750
							}
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   751
							if (!found)
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   752
								listSymbols.add(filePath);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   753
						} else {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   754
							listSymbols.add(filePath);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   755
						}
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   756
					}
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   757
				}
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   758
			}
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   759
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   760
		// Remove symbol file button pressed
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   761
		} else if (event.widget == buttonRemoveSymbol) {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   762
			int[] selectedItems = listSymbols.getSelectionIndices();
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   763
			if (selectedItems != null && selectedItems.length > 0) {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   764
				listSymbols.remove(selectedItems);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   765
			}
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   766
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   767
			// Add image file button pressed
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   768
		} else if (event.widget == buttonAddImageFile) {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   769
			FileDialog dialog = new FileDialog(this.getShell(), SWT.OPEN | SWT.MULTI);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   770
			dialog.setText(Messages.getString("DebugMetadataWizardPage.SelectImageFile")); //$NON-NLS-1$
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   771
			String[] filterExt = IMAGE_FILTER; 
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   772
	        dialog.setFilterExtensions(filterExt);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   773
			String result = dialog.open();
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   774
			// if user selected files, check that files don't already exist in the list
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   775
			// and add them if they don't already exist.
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   776
			if (result != null) {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   777
				String[] fileNames = dialog.getFileNames();
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   778
				if (fileNames != null) {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   779
					String path = dialog.getFilterPath() + File.separator;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   780
					for (int j = 0; j < fileNames.length; j++) {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   781
						String filePath = path + fileNames[j];
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   782
						String[] listItems = listImageFiles.getItems();
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   783
						if (listItems != null && listItems.length > 0) {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   784
							boolean found = false;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   785
							for (int i = 0; i < listItems.length; i++) {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   786
								String listItem = listItems[i];
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   787
								if (listItem.compareToIgnoreCase(filePath) == 0) {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   788
									found = true;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   789
									break;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   790
								}
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   791
							}
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   792
							if (!found)
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   793
								listImageFiles.add(filePath);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   794
						} else {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   795
							listImageFiles.add(filePath);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   796
						}
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   797
					}
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   798
				}
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   799
			}
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   800
		
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   801
		// Remove image file button pressed
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   802
		} else if (event.widget == buttonRemoveImageFile) {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   803
			int[] selectedItems = listImageFiles.getSelectionIndices();
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   804
			if (selectedItems != null && selectedItems.length > 0) {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   805
				listImageFiles.remove(selectedItems);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   806
			}			
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   807
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   808
		// Map files folder browse button pressed
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   809
		} else if (event.widget == buttonMapFolderBrowse) {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   810
			DirectoryDialog dialog = new DirectoryDialog(getShell());
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   811
			dialog.setText(Messages.getString("DebugMetadataWizardPage.MapFilesFolder")); //$NON-NLS-1$
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   812
			String result = dialog.open();
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   813
			comboMapFilesFolder.setText(result);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   814
			
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   815
		// MapFiles.zip browse button pressed
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   816
		} else if (event.widget == buttonZipBrowse) {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   817
			FileDialog dialog = new FileDialog(this.getShell(), SWT.OPEN);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   818
			dialog.setText(Messages.getString("DebugMetadataWizardPage.SelectMapFilesZip")); //$NON-NLS-1$
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   819
			String[] filterExt = {ZIP_FILTER};
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   820
	        dialog.setFilterExtensions(filterExt);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   821
			String result = dialog.open();
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   822
			comboMapFilesZip.setText(result);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   823
			
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   824
		// map files radio selection changed
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   825
		} else if (event.widget == buttonMapFilesFolderRadio || event.widget == buttonMapFilesZipRadio ||
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   826
				   event.widget == buttonSdkFolderRadio || event.widget == buttonNoMapFilesRadio || event.widget == comboSdkFolder) {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   827
			enableMapSelections();
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   828
		}
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   829
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   830
		updateButtons();
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   831
	}
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   832
	
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   833
	/**
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   834
	 * Disables/Enables map file labels & combos & buttons accordingly to which
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   835
	 * Map Files radio button is selected.
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   836
	 */
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   837
	void enableMapSelections() {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   838
		comboMapFilesFolder.setEnabled(false);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   839
		buttonMapFolderBrowse.setEnabled(false);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   840
		comboMapFilesZip.setEnabled(false);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   841
		buttonZipBrowse.setEnabled(false);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   842
		comboSdkFolder.setEnabled(false);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   843
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   844
		// Map Files folder radio button is selected
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   845
		if (buttonMapFilesFolderRadio.getSelection()) {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   846
			comboMapFilesFolder.setEnabled(true);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   847
			buttonMapFolderBrowse.setEnabled(true);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   848
		// MapFiles.zip radio button is selected
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   849
		} else if (buttonMapFilesZipRadio.getSelection()) {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   850
			comboMapFilesZip.setEnabled(true);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   851
			buttonZipBrowse.setEnabled(true);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   852
		// SDK map files radio button is selected
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   853
		} else if (buttonSdkFolderRadio.getSelection()) {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   854
			comboSdkFolder.setEnabled(true);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   855
		}
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   856
	}
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   857
	
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   858
	public void modifyText(ModifyEvent event) {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   859
		this.setErrorMessage(null);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   860
		updateButtons();
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   861
	}
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   862
	
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   863
	/**
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   864
	 * Checks that selected selge.ini file is valid.
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   865
	 *
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   866
	 */
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   867
	private boolean checkSelgeIniFile() {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   868
		this.setErrorMessage(null);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   869
		File selge = new File(comboSelge.getText());
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   870
		if (selge.isFile() && selge.exists() && selge.getName().trim().toLowerCase().equals(SELGE_INI_FILTER)) {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   871
			return true;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   872
		} else {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   873
			if (comboSelge.getText().length() > 0)
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   874
				this.setErrorMessage(Messages.getString("DebugMetadataWizardPage.InvalidSelgeIni")); //$NON-NLS-1$
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   875
			return false;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   876
		}
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   877
	}
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   878
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   879
	/**
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   880
	 * Checks that atleast one symbol file is in the list 
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   881
	 */
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   882
	boolean checkSymbol() {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   883
		if (listSymbols.getItemCount() < 1)
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   884
			return false;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   885
		
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   886
		return true;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   887
	}
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   888
	
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   889
	/**
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   890
	 *  Checks that Map files folder or MapFiles.zip file is valid.
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   891
	 */
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   892
	boolean checkMapFiles(boolean cannotBeEmpty) {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   893
		// Map Files folder radio button is selected
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   894
		if (buttonMapFilesFolderRadio.getSelection()) {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   895
			try {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   896
				File f = new File(comboMapFilesFolder.getText());
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   897
				// given folder must exist and it must contain map files
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   898
				if (f.isDirectory() && f.exists()) {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   899
					if (folderContainsMapFiles(comboMapFilesFolder.getText())) {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   900
						return true;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   901
					}
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   902
					this.setErrorMessage(Messages.getString("DebugMetadataWizardPage.SelectedMapFilesFolderContainsNoMapFiles")); //$NON-NLS-1$
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   903
					return false;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   904
				}
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   905
				this.setErrorMessage(Messages.getString("DebugMetadataWizardPage.InvalidMapFilesFolder")); //$NON-NLS-1$
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   906
				return false;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   907
			} catch (Exception e) {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   908
				this.setErrorMessage(Messages.getString("DebugMetadataWizardPage.InvalidMapFilesFolder")); //$NON-NLS-1$
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   909
				return false;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   910
			}
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   911
		// MapFiles.zip radio button is selected
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   912
		} else if (buttonMapFilesZipRadio.getSelection()) {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   913
			try {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   914
				File f = new File(comboMapFilesZip.getText());
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   915
				// given zip file must exist and is must contain map files
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   916
				if (f.isFile() && f.exists() && f.getName().toLowerCase().endsWith("zip")) {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   917
					if (zipContainsMapFiles(comboMapFilesZip.getText())) {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   918
						return true;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   919
					}
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   920
					this.setErrorMessage(Messages.getString("DebugMetadataWizardPage.SelectedZipContainsNoMapFiles")); //$NON-NLS-1$
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   921
					return false;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   922
				}
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   923
				this.setErrorMessage(Messages.getString("DebugMetadataWizardPage.InvalidMapFilesZip")); //$NON-NLS-1$
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   924
				return false;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   925
			} catch (Exception e) {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   926
				this.setErrorMessage(Messages.getString("DebugMetadataWizardPage.InvalidMapFilesZip")); //$NON-NLS-1$
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   927
				return false;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   928
			}
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   929
		// SDK Map files folder" radio button is selected
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   930
		} else if (buttonSdkFolderRadio.getSelection()) {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   931
			// an item must be selected in the combo
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   932
			if (comboSdkFolder.getSelectionIndex() >= 0) {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   933
				return true;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   934
			}
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   935
			this.setErrorMessage(Messages.getString("DebugMetadataWizardPage.SdkMapFilesFolderNotSelected")); //$NON-NLS-1$
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   936
			return false;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   937
		} else if (buttonNoMapFilesRadio.getSelection() && cannotBeEmpty) {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   938
			return false;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   939
		}
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   940
		
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   941
		return true;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   942
	}
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   943
	
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   944
	/**
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   945
	 * ROM IDs can be passed with this method. If the ROM ID list contains
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   946
	 * multiple ROM IDs, only selge.ini group will be available for user. 
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   947
	 */
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   948
	public void setRomIds(String[] ids) {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   949
		if (buttonSymbolRadio != null) {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   950
			// if symbol&map group radio button is selected, and there are
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   951
			// multiple ROM IDs, show selge.ini group
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   952
			if (buttonSymbolRadio.getSelection() && ids.length > 1) {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   953
				buttonSymbolRadio.setSelection(false);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   954
// ROWS COMMENTED SO THAT THEY CAN BE RESTORED INCASE SELGE.INI USAGE IS RESTORED
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   955
/*				groupSymbol.setVisible(false);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   956
				GridData gd = (GridData)groupSymbol.getLayoutData();
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   957
				gd.exclude = true;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   958
				gd = (GridData)groupSelge.getLayoutData();
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   959
				gd.exclude = false;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   960
*/				groupSelge.setVisible(true);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   961
				buttonSelgeRadio.setSelection(true);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   962
				setDescription(Messages.getString("DebugMetadataWizardPage.SelgeIniDescription")); //$NON-NLS-1$
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   963
				updateButtons();
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   964
				this.setMessage(Messages.getString("DebugMetadataWizardPage.RomIdsDoNotMatch"), 2); //$NON-NLS-1$
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   965
				composite.layout();	
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   966
			}
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   967
			this.buttonSymbolRadio.setEnabled(!(ids.length > 1));
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   968
		}
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   969
	}
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   970
	
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   971
	public boolean canFlipToNextPage() {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   972
		return canProceed();
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   973
	}
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   974
	
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   975
	/**
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   976
	 * We can proceed to next page if selge.ini is a valid file (if selge.ini is used).
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   977
	 * If selge.ini is not used, we'll check that symbol file and mapfiles.zip is valid or empty
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   978
	 * @return true if we can proceed to next page, false if not
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   979
	 */
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   980
	protected boolean canProceed() {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   981
		// selge.ini is used, check that selge.ini is valid
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   982
		if (buttonSelgeRadio.getSelection()) {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   983
			return checkSelgeIniFile();
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   984
		// selge.ini is not used
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   985
		} else {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   986
			this.setErrorMessage(null);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   987
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   988
			// no symbols provided
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   989
			if (listSymbols.getItemCount() < 1) {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   990
				if (checkMapFiles(true))
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   991
					return true;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   992
				
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   993
			// symbols are provided
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   994
			} else {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   995
				if (checkSymbols() && checkMapFiles(false))
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   996
					return true;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   997
			}
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   998
			
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   999
			return false;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1000
		}
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1001
	}	
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1002
	
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1003
	boolean checkSymbols() {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1004
		for (int i = 0; i < listSymbols.getItemCount(); i++) {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1005
			File f = new File(listSymbols.getItem(i));
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1006
			if (!f.exists() || !f.isFile()) {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1007
				this.setErrorMessage("Invalid symbol files");
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1008
				return false;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1009
			}
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1010
		}
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1011
		return true;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1012
	}	
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1013
	/**
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1014
	 * Saves the values currently displayed in the UI. These values are
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1015
	 * automatically shown when this UI is shown the next time.
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1016
	 */
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1017
	public void saveUserEnteredData() {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1018
		// selge.ini is used
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1019
		if (buttonSelgeRadio.getSelection()) {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1020
			saveValue(comboSelge.getText(), LAST_USED_SELGE_INI_FILES, false);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1021
			savePreviousDecodingStyle(false);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1022
		// symbol & map files are used
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1023
		} else {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1024
			savePreviousDecodingStyle(true);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1025
			saveValues(listSymbols.getItems(), LAST_USED_SYMBOL_FILES); 
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1026
			saveValue(comboMapFilesZip.getText(), LAST_USED_MAPZIP_FILES, false);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1027
			saveValue(comboMapFilesFolder.getText(), LAST_USED_MAPFILES_FOLDER, false);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1028
			saveValue(comboSdkFolder.getText(), LAST_USED_SDK, true);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1029
			if (showImageFilesGroup)
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1030
				saveValues(listImageFiles.getItems(), LAST_USED_IMAGE_FILES);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1031
			int mapType = NO_MAP_FILES_RADIO;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1032
			if (buttonMapFilesFolderRadio.getSelection())
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1033
				mapType = MAP_FILES_FOLDER_RADIO;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1034
			else if (buttonMapFilesZipRadio.getSelection())
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1035
				mapType = MAP_FILES_ZIP_RADIO;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1036
			else if (buttonSdkFolderRadio.getSelection())
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1037
				mapType = SDK_MAP_FILES_FOLDER_RADIO;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1038
			savePreviousMapFilesType(mapType);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1039
		}
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1040
	}
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1041
	
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1042
	/**
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1043
	 * Updates next, finish button states
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1044
	 */
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1045
	protected void updateButtons() {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1046
		try {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1047
			getWizard().getContainer().updateButtons();
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1048
		} catch (Exception E) {}		
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1049
	}
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1050
	
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1051
	/**
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1052
	 * Set help contexts for UI items.
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1053
	 */
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1054
	protected void setHelps() {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1055
		String helpContext = getHelpContext();
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1056
		PlatformUI.getWorkbench().getHelpSystem().setHelp(buttonSelgeRadio, helpContext);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1057
		PlatformUI.getWorkbench().getHelpSystem().setHelp(buttonSymbolRadio, helpContext);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1058
		PlatformUI.getWorkbench().getHelpSystem().setHelp(buttonSelgeBrowse, helpContext);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1059
		PlatformUI.getWorkbench().getHelpSystem().setHelp(listSymbols, helpContext);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1060
		PlatformUI.getWorkbench().getHelpSystem().setHelp(buttonZipBrowse, helpContext);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1061
		PlatformUI.getWorkbench().getHelpSystem().setHelp(comboSelge, helpContext);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1062
		PlatformUI.getWorkbench().getHelpSystem().setHelp(buttonAddSymbol, helpContext);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1063
		PlatformUI.getWorkbench().getHelpSystem().setHelp(buttonRemoveSymbol, helpContext);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1064
		PlatformUI.getWorkbench().getHelpSystem().setHelp(comboMapFilesZip, helpContext);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1065
		PlatformUI.getWorkbench().getHelpSystem().setHelp(buttonMapFolderBrowse, helpContext);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1066
		PlatformUI.getWorkbench().getHelpSystem().setHelp(buttonMapFilesZipRadio, helpContext);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1067
		PlatformUI.getWorkbench().getHelpSystem().setHelp(buttonMapFilesFolderRadio, helpContext);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1068
		PlatformUI.getWorkbench().getHelpSystem().setHelp(buttonSdkFolderRadio, helpContext);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1069
		PlatformUI.getWorkbench().getHelpSystem().setHelp(buttonNoMapFilesRadio, helpContext);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1070
		PlatformUI.getWorkbench().getHelpSystem().setHelp(comboMapFilesFolder, helpContext);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1071
		PlatformUI.getWorkbench().getHelpSystem().setHelp(comboSdkFolder, helpContext);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1072
		PlatformUI.getWorkbench().getHelpSystem().setHelp(buttonShowSelgeDetails, helpContext);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1073
		PlatformUI.getWorkbench().getHelpSystem().setHelp(textSelgeDetails, helpContext);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1074
		if (showImageFilesGroup) {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1075
			PlatformUI.getWorkbench().getHelpSystem().setHelp(listImageFiles, helpContext);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1076
			PlatformUI.getWorkbench().getHelpSystem().setHelp(buttonAddImageFile, helpContext);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1077
			PlatformUI.getWorkbench().getHelpSystem().setHelp(buttonRemoveImageFile, helpContext);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1078
		}
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1079
	}	
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1080
	
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1081
	/**
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1082
	 * If symbol file group was used when this UI was used last time, returns true. 
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1083
	 * Otherwise returns false.  
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1084
	 */	
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1085
	boolean symbolFileWasUsedPreviously() {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1086
		try {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1087
			boolean retval = false;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1088
			if (previousValuesSection != null) {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1089
				retval = previousValuesSection.getBoolean(LAST_USED_DECODING_STYLE);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1090
			}
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1091
			return retval;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1092
		} catch (Exception e) {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1093
			return false;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1094
		}
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1095
	}
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1096
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1097
	/**
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1098
	 * Saves whether selge.ini group or symbol group is used for decoding.
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1099
	 * This info can be restored when this UI is shown the next time. 
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1100
	 */
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1101
	void savePreviousDecodingStyle(boolean symbolFile) {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1102
		try {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1103
			if (previousValuesSection != null) {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1104
				previousValuesSection.put(LAST_USED_DECODING_STYLE, symbolFile);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1105
			}			
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1106
		} catch (Exception E) {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1107
		}
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1108
	}
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1109
	
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1110
	/**
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1111
	 * Returns which map files radio button was selected the last time this 
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1112
	 * UI was used. 
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1113
	 */
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1114
	int lastUsedMapFileType() {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1115
		try {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1116
			int retval = 0;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1117
			if (previousValuesSection != null) {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1118
				retval = previousValuesSection.getInt(LAST_USED_MAPFILE_TYPE);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1119
			}
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1120
			return retval;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1121
		} catch (Exception e) {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1122
			return 0;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1123
		}
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1124
	}
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1125
	
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1126
	/**
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1127
	 * Saves which map file radio button is selected.
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1128
	 * This info can be restored when this UI is shown the next time.
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1129
	 */
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1130
	void savePreviousMapFilesType(int type) {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1131
		try {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1132
			if (previousValuesSection != null) {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1133
				previousValuesSection.put(LAST_USED_MAPFILE_TYPE, type);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1134
			}
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1135
		} catch (Exception E) {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1136
		}
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1137
	}
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1138
	
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1139
	/**
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1140
	 * Returns previously entered values of given item. 
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1141
	 */
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1142
	String[] getPreviousPaths(String item) {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1143
		String[] retVal = null;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1144
		if (previousValuesSection != null) {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1145
			retVal = previousValuesSection.getArray(item);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1146
		}
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1147
		
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1148
		return retVal;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1149
	}
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1150
	
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1151
	/**
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1152
	 * Saves values so that they can be used next this this UI is used. 
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1153
	 */
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1154
	void saveValues(String[] values, String item) {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1155
		try {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1156
			if (previousValuesSection != null) {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1157
				previousValuesSection.put(item, values);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1158
			}
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1159
		} catch (Exception E) {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1160
		}
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1161
	}
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1162
	
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1163
	/**
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1164
	 * Saves given value to correct section in dialog_settings.xml
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1165
	 * @param value value to save
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1166
	 * @param item name of the array which contains correct values
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1167
	 * @param saveJustOne if true, only 'value' is saved. If false, 'value' is added to previously used values.
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1168
	 */
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1169
	void saveValue(String value, String item, boolean saveJustOne) {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1170
		if (previousValuesSection != null) {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1171
			String[] previousValues = previousValuesSection.getArray(item);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1172
			
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1173
			// No previous values exist
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1174
			if (previousValues == null) {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1175
				previousValues = new String[1];
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1176
				previousValues[0] = value;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1177
			// Previous values exists
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1178
			} else {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1179
				int valuesCount = previousValues.length;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1180
				
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1181
				boolean valueExisted = false;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1182
				// see if passed value already exist.
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1183
				for (int i = 0; i < valuesCount; i++) {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1184
					if (previousValues[i].compareToIgnoreCase(value) == 0) {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1185
						valueExisted = true;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1186
						
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1187
						// passed value exists, move it to first position
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1188
						for (int j = i; j > 0; j--) {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1189
							previousValues[j] = previousValues[j-1];
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1190
						}
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1191
						previousValues[0] = value;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1192
						
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1193
						break;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1194
					}
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1195
				}
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1196
				
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1197
				// passed value did not exist, add it to first position (and move older values "down")
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1198
				if (!valueExisted) {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1199
					if (valuesCount >= MAX_SAVED_VALUES) {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1200
						for (int i = valuesCount-1; i > 0; i--) {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1201
							previousValues[i] = previousValues[i-1];
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1202
						}
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1203
						previousValues[0] = value;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1204
					} else {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1205
						String[] values = new String[valuesCount + 1];
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1206
						values[0] = value;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1207
						for (int i = 0; i < valuesCount; i++) {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1208
							values[i+1] = previousValues[i];
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1209
						}
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1210
						previousValues = values;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1211
					}
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1212
				}
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1213
			}
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1214
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1215
			if (saveJustOne) {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1216
				previousValues = new String[1];
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1217
				previousValues[0] = value;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1218
			}
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1219
			
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1220
			previousValuesSection.put(item, previousValues);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1221
		}
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1222
	}	
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1223
	
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1224
	public void dragEnter(DropTargetEvent event) {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1225
		event.detail = DND.DROP_COPY;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1226
	}
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1227
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1228
	public void dragLeave(DropTargetEvent event) {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1229
		// nothing to be done
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1230
	}
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1231
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1232
	public void dragOperationChanged(DropTargetEvent event) {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1233
		// nothing to be done
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1234
	}
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1235
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1236
	public void dragOver(DropTargetEvent event) {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1237
		event.feedback = DND.FEEDBACK_NONE;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1238
	}
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1239
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1240
	public void drop(DropTargetEvent event) {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1241
		// we accept only file drops
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1242
		if (FileTransfer.getInstance().isSupportedType(event.currentDataType)) {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1243
			if (event.data != null) {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1244
				String[] files = (String[])event.data;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1245
				executeDrop(files);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1246
			}
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1247
		}
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1248
	}
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1249
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1250
	public void dropAccept(DropTargetEvent event) {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1251
		// nothing to be done
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1252
	}
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1253
	
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1254
	/**
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1255
	 * Executes drop functionality when files are drag&dropped to wizard page.
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1256
	 * Checks whether dropped files are supported and places them into correct UI element
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1257
	 * @param files drag&dropped files (paths)
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1258
	 */
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1259
	protected void executeDrop(String[] files) {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1260
		for (int i = 0; i < files.length; i++) {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1261
			String file = files[i].toLowerCase();
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1262
			
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1263
			// symbols file, add to symbols list
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1264
			if (file.endsWith(".symbol") &&
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1265
				!listContains(listSymbols, file)) {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1266
				listSymbols.add(files[i]);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1267
			}
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1268
			
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1269
			// image file, add to images list
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1270
			if ( isImageFile(file) &&
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1271
				 !listContains(listImageFiles, file)) {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1272
				listImageFiles.add(files[i]);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1273
			}
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1274
			
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1275
			// zip file, select correct radio button and add file to combo
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1276
			if (file.endsWith(".zip")) {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1277
				comboMapFilesZip.setText(file);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1278
				if (buttonMapFilesFolderRadio.getSelection())
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1279
					buttonMapFilesFolderRadio.setSelection(false);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1280
				else if (buttonNoMapFilesRadio.getSelection())
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1281
					buttonNoMapFilesRadio.setSelection(false);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1282
				else if (buttonSdkFolderRadio.getSelection())
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1283
					buttonSdkFolderRadio.setSelection(false);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1284
				buttonMapFilesZipRadio.setSelection(true);
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1285
				enableMapSelections();
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1286
			}
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1287
		}
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1288
		
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1289
		updateButtons();
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1290
	}
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1291
	
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1292
	protected boolean isImageFile(String file) {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1293
		if (file.endsWith(".fpsx") ||
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1294
			file.endsWith(".img"))
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1295
			return true;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1296
		
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1297
		// .C?? and .V?? file
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1298
		if (file.substring(file.length()-4, file.length()-3).equals(".") &&
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1299
			(file.substring(file.length()-3, file.length()-2).equalsIgnoreCase("v") ||
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1300
			 file.substring(file.length()-3, file.length()-2).equalsIgnoreCase("c")))
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1301
			return true;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1302
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1303
		return false;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1304
	}
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1305
	
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1306
	protected boolean listContains(List list, String item) {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1307
		for (int i = 0; i < list.getItemCount(); i++) {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1308
			if (list.getItem(i).equalsIgnoreCase(item))
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1309
				return true;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1310
		}
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1311
		
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1312
		return false;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1313
	}
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1314
	
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
  1315
}