core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/sdk/core/model/SDKManager.java
author stechong
Thu, 01 Jul 2010 16:36:11 -0500
branchC3_BUILDER_WORK
changeset 1568 508bfdb3a934
parent 1538 ac789a0152a8
child 1663 21ded3449e77
permissions -rw-r--r--
Added caching of Raptor query data for aliases, products and configs.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
     1
/*
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
     2
* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
     3
* All rights reserved.
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
     4
* This component and the accompanying materials are made available
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
     5
* under the terms of the License "Eclipse Public License v1.0"
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
     6
* which accompanies this distribution, and is available
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
     8
*
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
     9
* Initial Contributors:
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    10
* Nokia Corporation - initial contribution.
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    11
*
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    12
*/
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    13
package com.nokia.carbide.cpp.internal.sdk.core.model;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    14
501
c39dede7ad37 fix bugs 7659 & 9755
timkelly
parents: 335
diff changeset
    15
import java.io.BufferedReader;
c39dede7ad37 fix bugs 7659 & 9755
timkelly
parents: 335
diff changeset
    16
import java.io.File;
c39dede7ad37 fix bugs 7659 & 9755
timkelly
parents: 335
diff changeset
    17
import java.io.FileWriter;
c39dede7ad37 fix bugs 7659 & 9755
timkelly
parents: 335
diff changeset
    18
import java.io.IOException;
c39dede7ad37 fix bugs 7659 & 9755
timkelly
parents: 335
diff changeset
    19
import java.io.InputStreamReader;
c39dede7ad37 fix bugs 7659 & 9755
timkelly
parents: 335
diff changeset
    20
import java.net.MalformedURLException;
c39dede7ad37 fix bugs 7659 & 9755
timkelly
parents: 335
diff changeset
    21
import java.net.URISyntaxException;
335
a28d71356238 [Bug 8934] Ensure we create the devices.xml at the same location where we try to read it. Refactor copied method so single method called from SDKManager in core by SDKPreferencePage in ui. Ensure errors are reported in error log. Show dialog when unable to add SDK.
dadubrow
parents: 231
diff changeset
    22
import java.text.MessageFormat;
501
c39dede7ad37 fix bugs 7659 & 9755
timkelly
parents: 335
diff changeset
    23
import java.util.ArrayList;
c39dede7ad37 fix bugs 7659 & 9755
timkelly
parents: 335
diff changeset
    24
import java.util.Iterator;
c39dede7ad37 fix bugs 7659 & 9755
timkelly
parents: 335
diff changeset
    25
import java.util.List;
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    26
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    27
import org.eclipse.cdt.utils.WindowsRegistry;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    28
import org.eclipse.core.resources.ResourcesPlugin;
501
c39dede7ad37 fix bugs 7659 & 9755
timkelly
parents: 335
diff changeset
    29
import org.eclipse.core.runtime.IPath;
1421
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
    30
import org.eclipse.core.runtime.IProgressMonitor;
501
c39dede7ad37 fix bugs 7659 & 9755
timkelly
parents: 335
diff changeset
    31
import org.eclipse.core.runtime.IStatus;
c39dede7ad37 fix bugs 7659 & 9755
timkelly
parents: 335
diff changeset
    32
import org.eclipse.core.runtime.Path;
c39dede7ad37 fix bugs 7659 & 9755
timkelly
parents: 335
diff changeset
    33
import org.eclipse.core.runtime.Status;
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    34
import org.eclipse.emf.common.util.EList;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    35
import org.eclipse.jface.dialogs.MessageDialog;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    36
import org.eclipse.swt.widgets.Shell;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    37
import org.eclipse.ui.IWorkbenchWindow;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    38
import org.eclipse.ui.PlatformUI;
1424
f27f3399e676 Updated SDK manager to make sure scan job is not already running before scheduling it; also default OS version to 9.5 if buildinfo.txt is missing from an SDK.
stechong
parents: 1421
diff changeset
    39
import org.osgi.framework.Version;
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    40
1421
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
    41
import com.nokia.carbide.cpp.internal.sdk.core.gen.Devices.DefaultType;
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    42
import com.nokia.carbide.cpp.internal.sdk.core.gen.Devices.DeviceType;
1421
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
    43
import com.nokia.carbide.cpp.internal.sdk.core.gen.Devices.DevicesFactory;
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    44
import com.nokia.carbide.cpp.internal.sdk.core.gen.Devices.DevicesType;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    45
import com.nokia.carbide.cpp.internal.sdk.core.xml.DevicesLoader;
501
c39dede7ad37 fix bugs 7659 & 9755
timkelly
parents: 335
diff changeset
    46
import com.nokia.carbide.cpp.sdk.core.ISymbianSDK;
1474
f7fe29684b34 Fixed SDK scanning issues at startup; also fixed Bug 11470.
stechong
parents: 1468
diff changeset
    47
import com.nokia.carbide.cpp.sdk.core.ISymbianSDKFeatures;
501
c39dede7ad37 fix bugs 7659 & 9755
timkelly
parents: 335
diff changeset
    48
import com.nokia.carbide.cpp.sdk.core.SDKCorePlugin;
c39dede7ad37 fix bugs 7659 & 9755
timkelly
parents: 335
diff changeset
    49
import com.nokia.carbide.cpp.sdk.core.SDKEnvInfoFailureException;
630
dee2f67c6538 More Linux porting changes. Use HostOS.EXE_EXT to select the Win32 ".exe" suffix in executable filenames.
Ed Swartz <ed.swartz@nokia.com>
parents: 608
diff changeset
    50
import com.nokia.cpp.internal.api.utils.core.HostOS;
335
a28d71356238 [Bug 8934] Ensure we create the devices.xml at the same location where we try to read it. Refactor copied method so single method called from SDKManager in core by SDKPreferencePage in ui. Ensure errors are reported in error log. Show dialog when unable to add SDK.
dadubrow
parents: 231
diff changeset
    51
import com.nokia.cpp.internal.api.utils.ui.WorkbenchUtils;
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    52
608
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents: 501
diff changeset
    53
public class SDKManager extends AbstractSDKManager {
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    54
	
335
a28d71356238 [Bug 8934] Ensure we create the devices.xml at the same location where we try to read it. Refactor copied method so single method called from SDKManager in core by SDKPreferencePage in ui. Ensure errors are reported in error log. Show dialog when unable to add SDK.
dadubrow
parents: 231
diff changeset
    55
	private static final String SYMBIAN_COMMON_REG_PATH = "SOFTWARE\\Symbian\\EPOC SDKs\\";
a28d71356238 [Bug 8934] Ensure we create the devices.xml at the same location where we try to read it. Refactor copied method so single method called from SDKManager in core by SDKPreferencePage in ui. Ensure errors are reported in error log. Show dialog when unable to add SDK.
dadubrow
parents: 231
diff changeset
    56
	private static final String SYMBIAN_COMMON_PATH = "CommonPath";
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    57
	
335
a28d71356238 [Bug 8934] Ensure we create the devices.xml at the same location where we try to read it. Refactor copied method so single method called from SDKManager in core by SDKPreferencePage in ui. Ensure errors are reported in error log. Show dialog when unable to add SDK.
dadubrow
parents: 231
diff changeset
    58
	private static final String WINDOWS_SYSTEM_ROOT_REG = "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\";
a28d71356238 [Bug 8934] Ensure we create the devices.xml at the same location where we try to read it. Refactor copied method so single method called from SDKManager in core by SDKPreferencePage in ui. Ensure errors are reported in error log. Show dialog when unable to add SDK.
dadubrow
parents: 231
diff changeset
    59
	private static final String WINDOWS_SYSTEM_ROOT_KEY = "SystemRoot";
a28d71356238 [Bug 8934] Ensure we create the devices.xml at the same location where we try to read it. Refactor copied method so single method called from SDKManager in core by SDKPreferencePage in ui. Ensure errors are reported in error log. Show dialog when unable to add SDK.
dadubrow
parents: 231
diff changeset
    60
a28d71356238 [Bug 8934] Ensure we create the devices.xml at the same location where we try to read it. Refactor copied method so single method called from SDKManager in core by SDKPreferencePage in ui. Ensure errors are reported in error log. Show dialog when unable to add SDK.
dadubrow
parents: 231
diff changeset
    61
	private static final String EMPTY_DEVICES_XML_CONTENT = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><devices version=\"1.0\"></devices>";
1421
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
    62
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
    63
	private static final String QMAKE_FILE = "epoc32/tools/qt/qmake" + HostOS.EXE_EXT; //$NON-NLS-1$
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
    64
	private static final String MIFCONV_FILE = "epoc32/tools/mifconv" + HostOS.EXE_EXT; //$NON-NLS-1$
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
    65
	private static final String ABLD_FILE = "epoc32/tools/abld.pl"; //$NON-NLS-1$
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
    66
	private static final long VALID_ABLD_SIZE = 1024;
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
    67
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    68
	static boolean hasPromptedForDevicesXML = false; // make sure we only ask once at startup if devices.xml does not exist
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    69
	long devicesXLMLastModified;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    70
	
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    71
	/**
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    72
	 * Registry key location for checking CSL (GCCE) Arm Toolchain installation directory. 
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    73
	 */
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    74
	private static final String CSL_ARM_TOOLCHAIN_REG_PATH="SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\CSL Arm Toolchain (arm-symbianelf)_is1";
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    75
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    76
	/**
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    77
	 * Registry key for checking CSL (GCCE) Arm Toolchain installation directory. 
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    78
	 */
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    79
	private static final String CSL_ARM_TOOLCHAIN_REG_KEY="InstallLocation";
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    80
	
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    81
	public SDKManager() {
608
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents: 501
diff changeset
    82
		super();
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    83
		checkPerlInstallation();
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    84
	}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    85
	
1421
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
    86
	protected boolean doScanSDKs(IProgressMonitor monitor) {
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
    87
		boolean result = true;
608
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents: 501
diff changeset
    88
		DevicesType devicesType;
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents: 501
diff changeset
    89
		try {
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents: 501
diff changeset
    90
			File devicesFile = getDevicesXMLFile();
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    91
608
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents: 501
diff changeset
    92
			if (devicesFile == null || !devicesFile.exists()) {
1474
f7fe29684b34 Fixed SDK scanning issues at startup; also fixed Bug 11470.
stechong
parents: 1468
diff changeset
    93
				// It's ok if there is no devices.xml. 
f7fe29684b34 Fixed SDK scanning issues at startup; also fixed Bug 11470.
stechong
parents: 1468
diff changeset
    94
				// Raptor based SDKs no longer depends on it.
1421
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
    95
			} else {
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
    96
				devicesXLMLastModified = devicesFile.lastModified();
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
    97
				devicesType = DevicesLoader.loadDevices(devicesFile.toURL());
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
    98
				EList devices = devicesType.getDevice();
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
    99
				for (Iterator iter = devices.iterator(); iter.hasNext();) {
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
   100
					SymbianSDK sdk = new SymbianSDK((DeviceType) iter.next());
1474
f7fe29684b34 Fixed SDK scanning issues at startup; also fixed Bug 11470.
stechong
parents: 1468
diff changeset
   101
					sdk.addSupportedFeature(ISymbianSDKFeatures.IS_FROM_DEVICES_XML);
1421
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
   102
					sdkList.add(sdk);
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
   103
				}
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   104
			}
1421
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
   105
		} catch (Exception e) {
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
   106
			logError("Failed to scan devices.xml", e);
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
   107
			result = false;
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
   108
		}
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   109
1421
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
   110
		doScanDrives(monitor);
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
   111
		return result;
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   112
	}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   113
335
a28d71356238 [Bug 8934] Ensure we create the devices.xml at the same location where we try to read it. Refactor copied method so single method called from SDKManager in core by SDKPreferencePage in ui. Ensure errors are reported in error log. Show dialog when unable to add SDK.
dadubrow
parents: 231
diff changeset
   114
	public void updateSDK(ISymbianSDK sdk) {
1474
f7fe29684b34 Fixed SDK scanning issues at startup; also fixed Bug 11470.
stechong
parents: 1468
diff changeset
   115
		if (((SymbianSDK)sdk).getSupportedFeatures().contains(ISymbianSDKFeatures.IS_FROM_DEVICES_XML)) {
f7fe29684b34 Fixed SDK scanning issues at startup; also fixed Bug 11470.
stechong
parents: 1468
diff changeset
   116
			try {
f7fe29684b34 Fixed SDK scanning issues at startup; also fixed Bug 11470.
stechong
parents: 1468
diff changeset
   117
				File devicesFile = getDevicesXMLFile();
1431
536cdcdc768b Fixed various issues in new SDK preference page.
stechong
parents: 1424
diff changeset
   118
1474
f7fe29684b34 Fixed SDK scanning issues at startup; also fixed Bug 11470.
stechong
parents: 1468
diff changeset
   119
				if (devicesFile == null || !devicesFile.exists()) {
f7fe29684b34 Fixed SDK scanning issues at startup; also fixed Bug 11470.
stechong
parents: 1468
diff changeset
   120
					// There is no devices.xml. Ask the user if he/she wants to
f7fe29684b34 Fixed SDK scanning issues at startup; also fixed Bug 11470.
stechong
parents: 1468
diff changeset
   121
					// add it
f7fe29684b34 Fixed SDK scanning issues at startup; also fixed Bug 11470.
stechong
parents: 1468
diff changeset
   122
					doAsynchPromptCreateDevicesXML();
f7fe29684b34 Fixed SDK scanning issues at startup; also fixed Bug 11470.
stechong
parents: 1468
diff changeset
   123
					return;
f7fe29684b34 Fixed SDK scanning issues at startup; also fixed Bug 11470.
stechong
parents: 1468
diff changeset
   124
				}
1431
536cdcdc768b Fixed various issues in new SDK preference page.
stechong
parents: 1424
diff changeset
   125
1474
f7fe29684b34 Fixed SDK scanning issues at startup; also fixed Bug 11470.
stechong
parents: 1468
diff changeset
   126
				// If file does not exist exception will catch it
f7fe29684b34 Fixed SDK scanning issues at startup; also fixed Bug 11470.
stechong
parents: 1468
diff changeset
   127
				DevicesLoader.updateDevice(sdk, devicesFile.toURL());
f7fe29684b34 Fixed SDK scanning issues at startup; also fixed Bug 11470.
stechong
parents: 1468
diff changeset
   128
				
f7fe29684b34 Fixed SDK scanning issues at startup; also fixed Bug 11470.
stechong
parents: 1468
diff changeset
   129
			} catch (Exception e) { 
f7fe29684b34 Fixed SDK scanning issues at startup; also fixed Bug 11470.
stechong
parents: 1468
diff changeset
   130
				// must catch and rethrow as unchecked exception this 
f7fe29684b34 Fixed SDK scanning issues at startup; also fixed Bug 11470.
stechong
parents: 1468
diff changeset
   131
				// because no throws clause in API method
f7fe29684b34 Fixed SDK scanning issues at startup; also fixed Bug 11470.
stechong
parents: 1468
diff changeset
   132
				throw new RuntimeException(e);
f7fe29684b34 Fixed SDK scanning issues at startup; also fixed Bug 11470.
stechong
parents: 1468
diff changeset
   133
			}
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   134
		}
1474
f7fe29684b34 Fixed SDK scanning issues at startup; also fixed Bug 11470.
stechong
parents: 1468
diff changeset
   135
		updateCarbideSDKCache();
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   136
	}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   137
	
608
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents: 501
diff changeset
   138
	protected boolean doRemoveSDK(String sdkId) {
1484
273affe128cc Updated SDK manager to attempt removing SDK from devicex.xml only when the SDK is originally defined in the file.
stechong
parents: 1474
diff changeset
   139
		// Now actually remove it from devices.xml...
608
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents: 501
diff changeset
   140
		DevicesType devicesType;
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents: 501
diff changeset
   141
		try {
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents: 501
diff changeset
   142
			File devicesFile = getDevicesXMLFile();
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents: 501
diff changeset
   143
			 
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents: 501
diff changeset
   144
			// if file does not exist, let exception cath it...
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents: 501
diff changeset
   145
			devicesType = DevicesLoader.loadDevices(devicesFile.toURL());
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents: 501
diff changeset
   146
			EList devices = devicesType.getDevice();
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents: 501
diff changeset
   147
			for (Iterator iter = devices.iterator(); iter.hasNext();) {
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents: 501
diff changeset
   148
				DeviceType device = (DeviceType)iter.next();
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents: 501
diff changeset
   149
				if (device.getId().equals(sdkId)){
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents: 501
diff changeset
   150
					if (!DevicesLoader.deleteDeviceEntry(device, devicesFile.toURL())){
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents: 501
diff changeset
   151
						return false; // write failed
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   152
					}
608
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents: 501
diff changeset
   153
					break;
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   154
				}
608
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents: 501
diff changeset
   155
			}
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents: 501
diff changeset
   156
			
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents: 501
diff changeset
   157
			return true;
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents: 501
diff changeset
   158
		} catch (Exception e) {
1484
273affe128cc Updated SDK manager to attempt removing SDK from devicex.xml only when the SDK is originally defined in the file.
stechong
parents: 1474
diff changeset
   159
			logError("Failed to remove SDK from devices.xml", e);
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   160
		}
608
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents: 501
diff changeset
   161
		return false;
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents: 501
diff changeset
   162
		
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   163
	}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   164
335
a28d71356238 [Bug 8934] Ensure we create the devices.xml at the same location where we try to read it. Refactor copied method so single method called from SDKManager in core by SDKPreferencePage in ui. Ensure errors are reported in error log. Show dialog when unable to add SDK.
dadubrow
parents: 231
diff changeset
   165
	// Read the devices.xml locaiton from the local machine registry.
a28d71356238 [Bug 8934] Ensure we create the devices.xml at the same location where we try to read it. Refactor copied method so single method called from SDKManager in core by SDKPreferencePage in ui. Ensure errors are reported in error log. Show dialog when unable to add SDK.
dadubrow
parents: 231
diff changeset
   166
	// return IPath with absolute path to file if it exists or null if file does not exist or registry entry not found.
a28d71356238 [Bug 8934] Ensure we create the devices.xml at the same location where we try to read it. Refactor copied method so single method called from SDKManager in core by SDKPreferencePage in ui. Ensure errors are reported in error log. Show dialog when unable to add SDK.
dadubrow
parents: 231
diff changeset
   167
	private IPath getDevicesXMLFromRegistry(){
a28d71356238 [Bug 8934] Ensure we create the devices.xml at the same location where we try to read it. Refactor copied method so single method called from SDKManager in core by SDKPreferencePage in ui. Ensure errors are reported in error log. Show dialog when unable to add SDK.
dadubrow
parents: 231
diff changeset
   168
		String regValue = WindowsRegistry.getRegistry().getLocalMachineValue(SYMBIAN_COMMON_REG_PATH, SYMBIAN_COMMON_PATH);
a28d71356238 [Bug 8934] Ensure we create the devices.xml at the same location where we try to read it. Refactor copied method so single method called from SDKManager in core by SDKPreferencePage in ui. Ensure errors are reported in error log. Show dialog when unable to add SDK.
dadubrow
parents: 231
diff changeset
   169
		IPath regPath = regValue != null ? new Path(regValue) : null;
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   170
		
335
a28d71356238 [Bug 8934] Ensure we create the devices.xml at the same location where we try to read it. Refactor copied method so single method called from SDKManager in core by SDKPreferencePage in ui. Ensure errors are reported in error log. Show dialog when unable to add SDK.
dadubrow
parents: 231
diff changeset
   171
		if (regPath == null){
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   172
			// No registry entry found...
335
a28d71356238 [Bug 8934] Ensure we create the devices.xml at the same location where we try to read it. Refactor copied method so single method called from SDKManager in core by SDKPreferencePage in ui. Ensure errors are reported in error log. Show dialog when unable to add SDK.
dadubrow
parents: 231
diff changeset
   173
			String errMsg = MessageFormat.format(
a28d71356238 [Bug 8934] Ensure we create the devices.xml at the same location where we try to read it. Refactor copied method so single method called from SDKManager in core by SDKPreferencePage in ui. Ensure errors are reported in error log. Show dialog when unable to add SDK.
dadubrow
parents: 231
diff changeset
   174
							"Could not read registry for local machine key: {0} Cannot get devices.xml for installed SDKs.",
a28d71356238 [Bug 8934] Ensure we create the devices.xml at the same location where we try to read it. Refactor copied method so single method called from SDKManager in core by SDKPreferencePage in ui. Ensure errors are reported in error log. Show dialog when unable to add SDK.
dadubrow
parents: 231
diff changeset
   175
							SYMBIAN_COMMON_REG_PATH);
a28d71356238 [Bug 8934] Ensure we create the devices.xml at the same location where we try to read it. Refactor copied method so single method called from SDKManager in core by SDKPreferencePage in ui. Ensure errors are reported in error log. Show dialog when unable to add SDK.
dadubrow
parents: 231
diff changeset
   176
			logError(errMsg, null);
a28d71356238 [Bug 8934] Ensure we create the devices.xml at the same location where we try to read it. Refactor copied method so single method called from SDKManager in core by SDKPreferencePage in ui. Ensure errors are reported in error log. Show dialog when unable to add SDK.
dadubrow
parents: 231
diff changeset
   177
			return null;
a28d71356238 [Bug 8934] Ensure we create the devices.xml at the same location where we try to read it. Refactor copied method so single method called from SDKManager in core by SDKPreferencePage in ui. Ensure errors are reported in error log. Show dialog when unable to add SDK.
dadubrow
parents: 231
diff changeset
   178
		}
a28d71356238 [Bug 8934] Ensure we create the devices.xml at the same location where we try to read it. Refactor copied method so single method called from SDKManager in core by SDKPreferencePage in ui. Ensure errors are reported in error log. Show dialog when unable to add SDK.
dadubrow
parents: 231
diff changeset
   179
a28d71356238 [Bug 8934] Ensure we create the devices.xml at the same location where we try to read it. Refactor copied method so single method called from SDKManager in core by SDKPreferencePage in ui. Ensure errors are reported in error log. Show dialog when unable to add SDK.
dadubrow
parents: 231
diff changeset
   180
		// registry entry exists, check existence of file
a28d71356238 [Bug 8934] Ensure we create the devices.xml at the same location where we try to read it. Refactor copied method so single method called from SDKManager in core by SDKPreferencePage in ui. Ensure errors are reported in error log. Show dialog when unable to add SDK.
dadubrow
parents: 231
diff changeset
   181
		regPath = regPath.append(DEVICES_FILE_NAME);
a28d71356238 [Bug 8934] Ensure we create the devices.xml at the same location where we try to read it. Refactor copied method so single method called from SDKManager in core by SDKPreferencePage in ui. Ensure errors are reported in error log. Show dialog when unable to add SDK.
dadubrow
parents: 231
diff changeset
   182
		if (!regPath.toFile().exists()){
1474
f7fe29684b34 Fixed SDK scanning issues at startup; also fixed Bug 11470.
stechong
parents: 1468
diff changeset
   183
//			String errMsg = MessageFormat.format("Devices.xml does not exist at: {0}", regPath);
f7fe29684b34 Fixed SDK scanning issues at startup; also fixed Bug 11470.
stechong
parents: 1468
diff changeset
   184
//			logError(errMsg, null);
335
a28d71356238 [Bug 8934] Ensure we create the devices.xml at the same location where we try to read it. Refactor copied method so single method called from SDKManager in core by SDKPreferencePage in ui. Ensure errors are reported in error log. Show dialog when unable to add SDK.
dadubrow
parents: 231
diff changeset
   185
			return null;
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   186
		}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   187
		
335
a28d71356238 [Bug 8934] Ensure we create the devices.xml at the same location where we try to read it. Refactor copied method so single method called from SDKManager in core by SDKPreferencePage in ui. Ensure errors are reported in error log. Show dialog when unable to add SDK.
dadubrow
parents: 231
diff changeset
   188
		return regPath;
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   189
	}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   190
	
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   191
	public File getDevicesXMLFile() {
335
a28d71356238 [Bug 8934] Ensure we create the devices.xml at the same location where we try to read it. Refactor copied method so single method called from SDKManager in core by SDKPreferencePage in ui. Ensure errors are reported in error log. Show dialog when unable to add SDK.
dadubrow
parents: 231
diff changeset
   192
		IPath devicesPath = getDevicesXMLFromRegistry();
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   193
		
335
a28d71356238 [Bug 8934] Ensure we create the devices.xml at the same location where we try to read it. Refactor copied method so single method called from SDKManager in core by SDKPreferencePage in ui. Ensure errors are reported in error log. Show dialog when unable to add SDK.
dadubrow
parents: 231
diff changeset
   194
		if (devicesPath != null && devicesPath.toFile().exists()) {
a28d71356238 [Bug 8934] Ensure we create the devices.xml at the same location where we try to read it. Refactor copied method so single method called from SDKManager in core by SDKPreferencePage in ui. Ensure errors are reported in error log. Show dialog when unable to add SDK.
dadubrow
parents: 231
diff changeset
   195
			return devicesPath.toFile();
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   196
		}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   197
335
a28d71356238 [Bug 8934] Ensure we create the devices.xml at the same location where we try to read it. Refactor copied method so single method called from SDKManager in core by SDKPreferencePage in ui. Ensure errors are reported in error log. Show dialog when unable to add SDK.
dadubrow
parents: 231
diff changeset
   198
		// Not in registry, get the OS drive from the windows registry
a28d71356238 [Bug 8934] Ensure we create the devices.xml at the same location where we try to read it. Refactor copied method so single method called from SDKManager in core by SDKPreferencePage in ui. Ensure errors are reported in error log. Show dialog when unable to add SDK.
dadubrow
parents: 231
diff changeset
   199
		String regValue = WindowsRegistry.getRegistry().getLocalMachineValue(WINDOWS_SYSTEM_ROOT_REG, WINDOWS_SYSTEM_ROOT_KEY);
a28d71356238 [Bug 8934] Ensure we create the devices.xml at the same location where we try to read it. Refactor copied method so single method called from SDKManager in core by SDKPreferencePage in ui. Ensure errors are reported in error log. Show dialog when unable to add SDK.
dadubrow
parents: 231
diff changeset
   200
a28d71356238 [Bug 8934] Ensure we create the devices.xml at the same location where we try to read it. Refactor copied method so single method called from SDKManager in core by SDKPreferencePage in ui. Ensure errors are reported in error log. Show dialog when unable to add SDK.
dadubrow
parents: 231
diff changeset
   201
		String osDriveSpec = regValue != null ? new Path(regValue).getDevice() : DEFAULT_DEVICES_DRIVE_SPEC;
a28d71356238 [Bug 8934] Ensure we create the devices.xml at the same location where we try to read it. Refactor copied method so single method called from SDKManager in core by SDKPreferencePage in ui. Ensure errors are reported in error log. Show dialog when unable to add SDK.
dadubrow
parents: 231
diff changeset
   202
a28d71356238 [Bug 8934] Ensure we create the devices.xml at the same location where we try to read it. Refactor copied method so single method called from SDKManager in core by SDKPreferencePage in ui. Ensure errors are reported in error log. Show dialog when unable to add SDK.
dadubrow
parents: 231
diff changeset
   203
		IPath deviceDirPath = new Path(osDriveSpec, DEFAULT_DEVICES_XML_DIR);
a28d71356238 [Bug 8934] Ensure we create the devices.xml at the same location where we try to read it. Refactor copied method so single method called from SDKManager in core by SDKPreferencePage in ui. Ensure errors are reported in error log. Show dialog when unable to add SDK.
dadubrow
parents: 231
diff changeset
   204
		return deviceDirPath.append(DEVICES_FILE_NAME).toFile();
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   205
	}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   206
	
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   207
	public String getCSLArmToolchainInstallPathAndCheckReqTools() throws SDKEnvInfoFailureException{
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   208
		
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   209
		String installPath = null;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   210
		
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   211
		try {			
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   212
			WindowsRegistry wr = WindowsRegistry.getRegistry();
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   213
			installPath = wr.getLocalMachineValue(CSL_ARM_TOOLCHAIN_REG_PATH, 
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   214
													 CSL_ARM_TOOLCHAIN_REG_KEY);			
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   215
		} catch (Exception e) {			
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   216
			//TODO: Localise
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   217
			String errMsg = "Could not read registry for local machine key: '" +  CSL_ARM_TOOLCHAIN_REG_PATH 
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   218
								+ " (" + e.getMessage() +").";
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   219
			throw new SDKEnvInfoFailureException(errMsg);
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   220
		}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   221
		
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   222
		if (!new File(installPath).exists()){
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   223
			//TODO: Localise
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   224
			String errMsg = "CSL Arm Toolchain installation path pointed by registry key '" 
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   225
							+  CSL_ARM_TOOLCHAIN_REG_PATH 
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   226
							+ "' does not exist.";
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   227
			throw new SDKEnvInfoFailureException(errMsg);
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   228
		}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   229
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   230
		String gcceToolDir = installPath + "\\bin";
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   231
		
630
dee2f67c6538 More Linux porting changes. Use HostOS.EXE_EXT to select the Win32 ".exe" suffix in executable filenames.
Ed Swartz <ed.swartz@nokia.com>
parents: 608
diff changeset
   232
		String[] gccBinToolList = { "arm-none-symbianelf-nm" + HostOS.EXE_EXT,
dee2f67c6538 More Linux porting changes. Use HostOS.EXE_EXT to select the Win32 ".exe" suffix in executable filenames.
Ed Swartz <ed.swartz@nokia.com>
parents: 608
diff changeset
   233
									"arm-none-symbianelf-readelf" + HostOS.EXE_EXT,
dee2f67c6538 More Linux porting changes. Use HostOS.EXE_EXT to select the Win32 ".exe" suffix in executable filenames.
Ed Swartz <ed.swartz@nokia.com>
parents: 608
diff changeset
   234
									"arm-none-symbianelf-c++filt" + HostOS.EXE_EXT
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   235
									};
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   236
		String toolName = null;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   237
		String toolPathName = null;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   238
		for (int i = 0; i < gccBinToolList.length; i++) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   239
			toolName = gccBinToolList[i];
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   240
			toolPathName = gcceToolDir + "\\" + toolName;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   241
			
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   242
			if (!new File(toolPathName).exists()){
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   243
				//TODO: Localise
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   244
				String errMsg = "Required tool from CSL Arm Toolchain is missing: " 
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   245
								+ toolPathName;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   246
				throw new SDKEnvInfoFailureException(errMsg);
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   247
			}			
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   248
		}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   249
		
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   250
		return gcceToolDir;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   251
	}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   252
	
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   253
	public void doAsynchPromptCreateDevicesXML() {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   254
		PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   255
			public void run() {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   256
				checkDevicesXMLExistAndCreate();
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   257
			}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   258
		});
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   259
		
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   260
	}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   261
	
335
a28d71356238 [Bug 8934] Ensure we create the devices.xml at the same location where we try to read it. Refactor copied method so single method called from SDKManager in core by SDKPreferencePage in ui. Ensure errors are reported in error log. Show dialog when unable to add SDK.
dadubrow
parents: 231
diff changeset
   262
	public boolean checkDevicesXMLExistAndCreate() {
a28d71356238 [Bug 8934] Ensure we create the devices.xml at the same location where we try to read it. Refactor copied method so single method called from SDKManager in core by SDKPreferencePage in ui. Ensure errors are reported in error log. Show dialog when unable to add SDK.
dadubrow
parents: 231
diff changeset
   263
		Shell shell = WorkbenchUtils.getSafeShell();
a28d71356238 [Bug 8934] Ensure we create the devices.xml at the same location where we try to read it. Refactor copied method so single method called from SDKManager in core by SDKPreferencePage in ui. Ensure errors are reported in error log. Show dialog when unable to add SDK.
dadubrow
parents: 231
diff changeset
   264
		File devicesFile = getDevicesXMLFile();
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   265
		if (!devicesFile.exists()){
335
a28d71356238 [Bug 8934] Ensure we create the devices.xml at the same location where we try to read it. Refactor copied method so single method called from SDKManager in core by SDKPreferencePage in ui. Ensure errors are reported in error log. Show dialog when unable to add SDK.
dadubrow
parents: 231
diff changeset
   266
			if (MessageDialog.openQuestion(shell, "Devices.xml Not Found", 
a28d71356238 [Bug 8934] Ensure we create the devices.xml at the same location where we try to read it. Refactor copied method so single method called from SDKManager in core by SDKPreferencePage in ui. Ensure errors are reported in error log. Show dialog when unable to add SDK.
dadubrow
parents: 231
diff changeset
   267
					"Carbide.c++ requires a valid devices.xml file to manage SDKs.\n\nDo you want Carbide to create this file?")) {
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   268
				try {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   269
					// First check to make sure the directory exists....
335
a28d71356238 [Bug 8934] Ensure we create the devices.xml at the same location where we try to read it. Refactor copied method so single method called from SDKManager in core by SDKPreferencePage in ui. Ensure errors are reported in error log. Show dialog when unable to add SDK.
dadubrow
parents: 231
diff changeset
   270
					if (!devicesFile.getParentFile().exists()){
a28d71356238 [Bug 8934] Ensure we create the devices.xml at the same location where we try to read it. Refactor copied method so single method called from SDKManager in core by SDKPreferencePage in ui. Ensure errors are reported in error log. Show dialog when unable to add SDK.
dadubrow
parents: 231
diff changeset
   271
						devicesFile.getParentFile().mkdirs();
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   272
					}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   273
					
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   274
					devicesFile.createNewFile();
335
a28d71356238 [Bug 8934] Ensure we create the devices.xml at the same location where we try to read it. Refactor copied method so single method called from SDKManager in core by SDKPreferencePage in ui. Ensure errors are reported in error log. Show dialog when unable to add SDK.
dadubrow
parents: 231
diff changeset
   275
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   276
					FileWriter fw = new FileWriter(devicesFile);
335
a28d71356238 [Bug 8934] Ensure we create the devices.xml at the same location where we try to read it. Refactor copied method so single method called from SDKManager in core by SDKPreferencePage in ui. Ensure errors are reported in error log. Show dialog when unable to add SDK.
dadubrow
parents: 231
diff changeset
   277
					fw.write(EMPTY_DEVICES_XML_CONTENT);
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   278
					fw.close();
335
a28d71356238 [Bug 8934] Ensure we create the devices.xml at the same location where we try to read it. Refactor copied method so single method called from SDKManager in core by SDKPreferencePage in ui. Ensure errors are reported in error log. Show dialog when unable to add SDK.
dadubrow
parents: 231
diff changeset
   279
a28d71356238 [Bug 8934] Ensure we create the devices.xml at the same location where we try to read it. Refactor copied method so single method called from SDKManager in core by SDKPreferencePage in ui. Ensure errors are reported in error log. Show dialog when unable to add SDK.
dadubrow
parents: 231
diff changeset
   280
					MessageDialog.openInformation(shell, "Devices.xml File Created", 
a28d71356238 [Bug 8934] Ensure we create the devices.xml at the same location where we try to read it. Refactor copied method so single method called from SDKManager in core by SDKPreferencePage in ui. Ensure errors are reported in error log. Show dialog when unable to add SDK.
dadubrow
parents: 231
diff changeset
   281
							MessageFormat.format(
a28d71356238 [Bug 8934] Ensure we create the devices.xml at the same location where we try to read it. Refactor copied method so single method called from SDKManager in core by SDKPreferencePage in ui. Ensure errors are reported in error log. Show dialog when unable to add SDK.
dadubrow
parents: 231
diff changeset
   282
								"{0} was created successfully. Please add an SDK under the SDK Preferences page with the \"Add\" button before you attempt to create a project.",
a28d71356238 [Bug 8934] Ensure we create the devices.xml at the same location where we try to read it. Refactor copied method so single method called from SDKManager in core by SDKPreferencePage in ui. Ensure errors are reported in error log. Show dialog when unable to add SDK.
dadubrow
parents: 231
diff changeset
   283
								devicesFile.getAbsolutePath()));
a28d71356238 [Bug 8934] Ensure we create the devices.xml at the same location where we try to read it. Refactor copied method so single method called from SDKManager in core by SDKPreferencePage in ui. Ensure errors are reported in error log. Show dialog when unable to add SDK.
dadubrow
parents: 231
diff changeset
   284
					return true;
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   285
				} catch (IOException e){
335
a28d71356238 [Bug 8934] Ensure we create the devices.xml at the same location where we try to read it. Refactor copied method so single method called from SDKManager in core by SDKPreferencePage in ui. Ensure errors are reported in error log. Show dialog when unable to add SDK.
dadubrow
parents: 231
diff changeset
   286
					String message = "Could not create file: " + devicesFile.getAbsolutePath();
a28d71356238 [Bug 8934] Ensure we create the devices.xml at the same location where we try to read it. Refactor copied method so single method called from SDKManager in core by SDKPreferencePage in ui. Ensure errors are reported in error log. Show dialog when unable to add SDK.
dadubrow
parents: 231
diff changeset
   287
					MessageDialog.openError(shell, "Cannot Create File", message);
a28d71356238 [Bug 8934] Ensure we create the devices.xml at the same location where we try to read it. Refactor copied method so single method called from SDKManager in core by SDKPreferencePage in ui. Ensure errors are reported in error log. Show dialog when unable to add SDK.
dadubrow
parents: 231
diff changeset
   288
					logError(message, e);
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   289
				}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   290
			}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   291
		}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   292
		
335
a28d71356238 [Bug 8934] Ensure we create the devices.xml at the same location where we try to read it. Refactor copied method so single method called from SDKManager in core by SDKPreferencePage in ui. Ensure errors are reported in error log. Show dialog when unable to add SDK.
dadubrow
parents: 231
diff changeset
   293
		return false;
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   294
	}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   295
	
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   296
	protected void checkPerlInstallation(){
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   297
		
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   298
		Runtime rt=Runtime.getRuntime();
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   299
		
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   300
		// check for Perl
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   301
		try {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   302
			Process p = rt.exec("perl.exe -v");
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   303
			
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   304
			BufferedReader br = new BufferedReader(new InputStreamReader(p.getInputStream()));
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   305
			String overallOutput = null;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   306
			String stdErrLine = null;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   307
			while ((stdErrLine = br.readLine()) != null) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   308
				overallOutput += stdErrLine;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   309
			}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   310
			
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   311
			if (overallOutput != null && !overallOutput.contains("v5.6.1")){
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   312
				ResourcesPlugin.getPlugin().getLog().log(new Status(IStatus.WARNING, SDKCorePlugin.PLUGIN_ID, IStatus.WARNING, "Perl v5.6.1 was not detected. Some SDKs do not work with other Perl versions.", null));
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   313
			}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   314
			
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   315
			p.destroy();
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   316
			
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   317
		}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   318
		catch (IOException e) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   319
			//	report error to PDE log
1538
ac789a0152a8 remove perl not found dialog (only emit to error log). Clean up some text messages.
timkelly
parents: 1500
diff changeset
   320
			ResourcesPlugin.getPlugin().getLog().log(new Status(IStatus.ERROR, SDKCorePlugin.PLUGIN_ID, IStatus.ERROR, "Perl was not found on the PATH environment variable. Perl 5.6.1 is recommended for Carbide use if using SBSv1 and Symbian OS 9.4 and prior.", e));
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   321
		}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   322
	}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   323
	
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   324
	public boolean checkDevicesXMLSynchronized(){
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   325
		if (devicesXLMLastModified == 0){
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   326
			return true; // no devices.xml file
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   327
		}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   328
		
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   329
		File deviceFile = getDevicesXMLFile();
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   330
		if (deviceFile.exists()){
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   331
			if (deviceFile.lastModified() <= devicesXLMLastModified){
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   332
				return true;  // file is up to date, nothing to do.
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   333
			} else {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   334
				// file is out of date but let's make sure some data
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   335
				// has actually changed...
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   336
				boolean needsRescan = false;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   337
				devicesXLMLastModified = deviceFile.lastModified();
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   338
				
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   339
				// Read the devices.xml and see if our current SDK list differs from the list
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   340
				// we get from devices.xml
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   341
				List<ISymbianSDK> localSDKList = new ArrayList<ISymbianSDK>();
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   342
				DevicesType devicesType;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   343
				try {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   344
					devicesType = DevicesLoader.loadDevices(deviceFile.toURL());
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   345
					EList devices = devicesType.getDevice();
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   346
					for (Iterator iter = devices.iterator(); iter.hasNext();) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   347
						SymbianSDK sdk = new SymbianSDK((DeviceType) iter.next());
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   348
						localSDKList.add(sdk);
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   349
					}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   350
				}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   351
				catch (MalformedURLException e) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   352
					e.printStackTrace();
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   353
				} catch (URISyntaxException e) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   354
					e.printStackTrace();
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   355
				} catch (IOException e) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   356
					e.printStackTrace();
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   357
				}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   358
				
1568
508bfdb3a934 Added caching of Raptor query data for aliases, products and configs.
stechong
parents: 1538
diff changeset
   359
				for (ISymbianSDK sdk : localSDKList){
508bfdb3a934 Added caching of Raptor query data for aliases, products and configs.
stechong
parents: 1538
diff changeset
   360
					ISymbianSDK currSDK = getSDK(sdk.getUniqueId(), false);
508bfdb3a934 Added caching of Raptor query data for aliases, products and configs.
stechong
parents: 1538
diff changeset
   361
					if (currSDK == null){
508bfdb3a934 Added caching of Raptor query data for aliases, products and configs.
stechong
parents: 1538
diff changeset
   362
						// sdk id has been changed
508bfdb3a934 Added caching of Raptor query data for aliases, products and configs.
stechong
parents: 1538
diff changeset
   363
						needsRescan = true;
508bfdb3a934 Added caching of Raptor query data for aliases, products and configs.
stechong
parents: 1538
diff changeset
   364
						break;
508bfdb3a934 Added caching of Raptor query data for aliases, products and configs.
stechong
parents: 1538
diff changeset
   365
					}
508bfdb3a934 Added caching of Raptor query data for aliases, products and configs.
stechong
parents: 1538
diff changeset
   366
					// check that the data are the same.
508bfdb3a934 Added caching of Raptor query data for aliases, products and configs.
stechong
parents: 1538
diff changeset
   367
					// Other than the 'id' attrib, all we really care is whether or not
508bfdb3a934 Added caching of Raptor query data for aliases, products and configs.
stechong
parents: 1538
diff changeset
   368
					// the EPOCROOT or vendor 'name' has changed.
508bfdb3a934 Added caching of Raptor query data for aliases, products and configs.
stechong
parents: 1538
diff changeset
   369
					if (!sdk.getEPOCROOT().equalsIgnoreCase(currSDK.getEPOCROOT())){
508bfdb3a934 Added caching of Raptor query data for aliases, products and configs.
stechong
parents: 1538
diff changeset
   370
						needsRescan = true;
508bfdb3a934 Added caching of Raptor query data for aliases, products and configs.
stechong
parents: 1538
diff changeset
   371
						break;
508bfdb3a934 Added caching of Raptor query data for aliases, products and configs.
stechong
parents: 1538
diff changeset
   372
					}
508bfdb3a934 Added caching of Raptor query data for aliases, products and configs.
stechong
parents: 1538
diff changeset
   373
					if (!sdk.getName().equalsIgnoreCase(currSDK.getName())){
508bfdb3a934 Added caching of Raptor query data for aliases, products and configs.
stechong
parents: 1538
diff changeset
   374
						needsRescan = true;
508bfdb3a934 Added caching of Raptor query data for aliases, products and configs.
stechong
parents: 1538
diff changeset
   375
						break;
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   376
					}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   377
				}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   378
				
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   379
				if (!needsRescan){
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   380
					return true; // file has changed but data is up to date.
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   381
				}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   382
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   383
				hasScannedSDKs = false;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   384
				return false;  // SDKs were not up to date.
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   385
			}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   386
		} else {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   387
			return true;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   388
		}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   389
	}
608
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents: 501
diff changeset
   390
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents: 501
diff changeset
   391
	@Override
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents: 501
diff changeset
   392
	protected boolean isEPOCRootFixed() {
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents: 501
diff changeset
   393
		return true;
335
a28d71356238 [Bug 8934] Ensure we create the devices.xml at the same location where we try to read it. Refactor copied method so single method called from SDKManager in core by SDKPreferencePage in ui. Ensure errors are reported in error log. Show dialog when unable to add SDK.
dadubrow
parents: 231
diff changeset
   394
	}
1421
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
   395
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
   396
	/**
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
   397
	 * Scan system drives for installed SDKs
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
   398
	 */
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
   399
	protected void doScanDrives(IProgressMonitor monitor) {
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
   400
		File[] drives = getSystemDrives();
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
   401
		monitor.beginTask("Scanning system drives for installed SDKs", drives.length);
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
   402
		for (File drive : drives) {
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
   403
			if (!isEPOCRoot(drive)) {
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
   404
				continue;
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
   405
			}
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
   406
1431
536cdcdc768b Fixed various issues in new SDK preference page.
stechong
parents: 1424
diff changeset
   407
			String sdkId = getUniqueSDKId(drive);
1421
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
   408
			DeviceType deviceType = DevicesFactory.eINSTANCE.createDeviceType();
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
   409
			deviceType.setAlias(drive.toString());
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
   410
			deviceType.setDefault(DefaultType.NO_LITERAL);
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
   411
			deviceType.setEpocroot(drive.getAbsolutePath());
1431
536cdcdc768b Fixed various issues in new SDK preference page.
stechong
parents: 1424
diff changeset
   412
			deviceType.setId(sdkId);
1421
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
   413
			deviceType.setName("com.nokia.s60");
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
   414
			deviceType.setToolsroot(drive.getAbsolutePath());
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
   415
			deviceType.setUserdeletable("false");
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
   416
			deviceType.setUserdeletetable("false");
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
   417
			ISymbianSDK sdk = new SymbianSDK(deviceType);
1424
f27f3399e676 Updated SDK manager to make sure scan job is not already running before scheduling it; also default OS version to 9.5 if buildinfo.txt is missing from an SDK.
stechong
parents: 1421
diff changeset
   418
			if (sdk.getOSVersion().toString().equals("0.0.0")) {
1434
79471fd1fd69 First pass refactoring ISymbianSDK.
stechong
parents: 1431
diff changeset
   419
				((SymbianSDK)sdk).setOSVersion(new Version("9.5"));
1424
f27f3399e676 Updated SDK manager to make sure scan job is not already running before scheduling it; also default OS version to 9.5 if buildinfo.txt is missing from an SDK.
stechong
parents: 1421
diff changeset
   420
			}
f27f3399e676 Updated SDK manager to make sure scan job is not already running before scheduling it; also default OS version to 9.5 if buildinfo.txt is missing from an SDK.
stechong
parents: 1421
diff changeset
   421
1468
48201eb47999 When scanning system drives for installed SDKs, default SDK version to 5.0 when no SDK version info is available; also updated SDK properties dialog to correctly display SDK version string.
stechong
parents: 1462
diff changeset
   422
			if (sdk.getSDKVersion().toString().equals("0.0.0")) {
48201eb47999 When scanning system drives for installed SDKs, default SDK version to 5.0 when no SDK version info is available; also updated SDK properties dialog to correctly display SDK version string.
stechong
parents: 1462
diff changeset
   423
				((SymbianSDK)sdk).setSDKVersion(new Version("5.0"));
48201eb47999 When scanning system drives for installed SDKs, default SDK version to 5.0 when no SDK version info is available; also updated SDK properties dialog to correctly display SDK version string.
stechong
parents: 1462
diff changeset
   424
			}
48201eb47999 When scanning system drives for installed SDKs, default SDK version to 5.0 when no SDK version info is available; also updated SDK properties dialog to correctly display SDK version string.
stechong
parents: 1462
diff changeset
   425
1421
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
   426
			if (!isSupportedSDK(sdk)) {
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
   427
				continue;
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
   428
			}
1468
48201eb47999 When scanning system drives for installed SDKs, default SDK version to 5.0 when no SDK version info is available; also updated SDK properties dialog to correctly display SDK version string.
stechong
parents: 1462
diff changeset
   429
1421
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
   430
			if (isInSDKList(sdk)) {
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
   431
				continue;
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
   432
			}
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
   433
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
   434
			sdkList.add(sdk);
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
   435
			monitor.worked(1);
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
   436
			if (monitor.isCanceled()) {
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
   437
				monitor.done();
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
   438
				return;
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
   439
			}
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
   440
		}
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
   441
		monitor.done();
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
   442
	}
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
   443
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
   444
	private File[] getSystemDrives() {
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
   445
		if (HostOS.IS_WIN32) {
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
   446
			return File.listRoots();
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
   447
		}
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
   448
		return new File[0];
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
   449
	}
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
   450
1431
536cdcdc768b Fixed various issues in new SDK preference page.
stechong
parents: 1424
diff changeset
   451
	private String getUniqueSDKId(File drive) {
536cdcdc768b Fixed various issues in new SDK preference page.
stechong
parents: 1424
diff changeset
   452
		String sdkId = drive.toString().charAt(0) + "_SDK";
536cdcdc768b Fixed various issues in new SDK preference page.
stechong
parents: 1424
diff changeset
   453
		int suffice = 1;
536cdcdc768b Fixed various issues in new SDK preference page.
stechong
parents: 1424
diff changeset
   454
		while (!isUniqueSDKId(sdkId)) {
536cdcdc768b Fixed various issues in new SDK preference page.
stechong
parents: 1424
diff changeset
   455
			sdkId = drive.toString().charAt(0) + "_SDK" + suffice;
536cdcdc768b Fixed various issues in new SDK preference page.
stechong
parents: 1424
diff changeset
   456
			suffice++;
536cdcdc768b Fixed various issues in new SDK preference page.
stechong
parents: 1424
diff changeset
   457
		}
536cdcdc768b Fixed various issues in new SDK preference page.
stechong
parents: 1424
diff changeset
   458
		return sdkId;
536cdcdc768b Fixed various issues in new SDK preference page.
stechong
parents: 1424
diff changeset
   459
	}
536cdcdc768b Fixed various issues in new SDK preference page.
stechong
parents: 1424
diff changeset
   460
1421
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
   461
	private boolean hasAbldSupport(ISymbianSDK sdk) {
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
   462
		File abld = new File(sdk.getEPOCROOT(), ABLD_FILE);
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
   463
		if (abld.exists()) {
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
   464
			long size = abld.length();
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
   465
			if (size >= VALID_ABLD_SIZE)
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
   466
				return true;
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
   467
		}
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
   468
		return false;
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
   469
	}
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
   470
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
   471
	private boolean hasQmake(ISymbianSDK sdk) {
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
   472
		File qmake = new File(sdk.getEPOCROOT(), QMAKE_FILE);
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
   473
		if (qmake.exists()) {
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
   474
			return true;
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
   475
		}
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
   476
		return false;
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
   477
	}
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
   478
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
   479
	private boolean hasRaptor(ISymbianSDK sdk) {
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
   480
		File mifconv = new File(sdk.getEPOCROOT(), MIFCONV_FILE);
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
   481
		if (mifconv.exists()) {
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
   482
			return true;
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
   483
		}
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
   484
		return false;
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
   485
	}
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
   486
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
   487
	private boolean isEPOCRoot(File drive) {
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
   488
		File epocRoot = new File(drive, "epoc32");
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
   489
		if (epocRoot.exists()) {
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
   490
			return true;
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
   491
		} else {
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
   492
			return false;
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
   493
		}
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
   494
	}
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
   495
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
   496
	private boolean isInSDKList(ISymbianSDK sdk) {
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
   497
		for (ISymbianSDK entry : sdkList) {
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
   498
			if (entry.getEPOCROOT().equalsIgnoreCase(sdk.getEPOCROOT())) {
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
   499
				return true;
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
   500
			}
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
   501
		}
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
   502
		return false;
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
   503
	}
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
   504
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
   505
	private boolean isSupportedSDK(ISymbianSDK sdk) {
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
   506
		if (!hasAbldSupport(sdk) || hasQmake(sdk) || hasRaptor(sdk)) {
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
   507
			return true;
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
   508
		}
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
   509
		return false;
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
   510
	}
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
   511
1431
536cdcdc768b Fixed various issues in new SDK preference page.
stechong
parents: 1424
diff changeset
   512
	private boolean isUniqueSDKId(String sdkId) {
1500
9dcfd25090a5 Fixed problem in isUniqueSDKId() that may cause recursive calls.
stechong
parents: 1484
diff changeset
   513
		for (ISymbianSDK sdk : sdkList){
1431
536cdcdc768b Fixed various issues in new SDK preference page.
stechong
parents: 1424
diff changeset
   514
			if (sdk.getUniqueId().equalsIgnoreCase(sdkId)){
536cdcdc768b Fixed various issues in new SDK preference page.
stechong
parents: 1424
diff changeset
   515
				return false;
536cdcdc768b Fixed various issues in new SDK preference page.
stechong
parents: 1424
diff changeset
   516
			}
536cdcdc768b Fixed various issues in new SDK preference page.
stechong
parents: 1424
diff changeset
   517
		}
536cdcdc768b Fixed various issues in new SDK preference page.
stechong
parents: 1424
diff changeset
   518
		return true;
536cdcdc768b Fixed various issues in new SDK preference page.
stechong
parents: 1424
diff changeset
   519
	}
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   520
}