core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/sdk/core/model/SDKManager.java
author stechong
Mon, 30 Aug 2010 16:39:11 -0500
changeset 1919 5c9cbbdfb5c2
parent 1913 bcd5f4dbd8ac
child 2033 018bd04fe39c
permissions -rw-r--r--
Fix for Bug 11934 [C3 SDK - If devices.xml has a drive a rescan will created a second instance].
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.File;
c39dede7ad37 fix bugs 7659 & 9755
timkelly
parents: 335
diff changeset
    16
import java.io.FileWriter;
c39dede7ad37 fix bugs 7659 & 9755
timkelly
parents: 335
diff changeset
    17
import java.io.IOException;
c39dede7ad37 fix bugs 7659 & 9755
timkelly
parents: 335
diff changeset
    18
import java.net.MalformedURLException;
c39dede7ad37 fix bugs 7659 & 9755
timkelly
parents: 335
diff changeset
    19
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
    20
import java.text.MessageFormat;
501
c39dede7ad37 fix bugs 7659 & 9755
timkelly
parents: 335
diff changeset
    21
import java.util.ArrayList;
c39dede7ad37 fix bugs 7659 & 9755
timkelly
parents: 335
diff changeset
    22
import java.util.Iterator;
c39dede7ad37 fix bugs 7659 & 9755
timkelly
parents: 335
diff changeset
    23
import java.util.List;
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    24
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    25
import org.eclipse.cdt.utils.WindowsRegistry;
501
c39dede7ad37 fix bugs 7659 & 9755
timkelly
parents: 335
diff changeset
    26
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
    27
import org.eclipse.core.runtime.IProgressMonitor;
501
c39dede7ad37 fix bugs 7659 & 9755
timkelly
parents: 335
diff changeset
    28
import org.eclipse.core.runtime.Path;
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    29
import org.eclipse.emf.common.util.EList;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    30
import org.eclipse.jface.dialogs.MessageDialog;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    31
import org.eclipse.swt.widgets.Shell;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    32
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
    33
import org.osgi.framework.Version;
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    34
1421
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
    35
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
    36
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
    37
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
    38
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
    39
import com.nokia.carbide.cpp.internal.sdk.core.xml.DevicesLoader;
1801
1d73a4591cf8 refactoring usage for getting variant.hrh and compiler preinclude macros. Now should use ISymbianContext both for preprocessed results and getting the IPath to the file.
timkelly
parents: 1779
diff changeset
    40
import com.nokia.carbide.cpp.sdk.core.ISDKManager;
501
c39dede7ad37 fix bugs 7659 & 9755
timkelly
parents: 335
diff changeset
    41
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
    42
import com.nokia.carbide.cpp.sdk.core.ISymbianSDKFeatures;
501
c39dede7ad37 fix bugs 7659 & 9755
timkelly
parents: 335
diff changeset
    43
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
    44
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
    45
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
    46
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
    47
public class SDKManager extends AbstractSDKManager {
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    48
	
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
    49
	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
    50
	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
    51
	
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
    52
	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
    53
	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
    54
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 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
    56
1904
e1859c9e4688 check for both qmake install locations. was preiously just checking the old location when internally installed
timkelly
parents: 1801
diff changeset
    57
	/** Older kits put qmake under the tools/qt folder. */
1421
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
    58
	private static final String QMAKE_FILE = "epoc32/tools/qt/qmake" + HostOS.EXE_EXT; //$NON-NLS-1$
1904
e1859c9e4688 check for both qmake install locations. was preiously just checking the old location when internally installed
timkelly
parents: 1801
diff changeset
    59
	/** Newer kits put qmake under the tools folder */
e1859c9e4688 check for both qmake install locations. was preiously just checking the old location when internally installed
timkelly
parents: 1801
diff changeset
    60
	private static final String QMAKE_FILE_LOCATION2 = "epoc32/tools/qmake" + HostOS.EXE_EXT; //$NON-NLS-1$
1421
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
    61
	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
    62
	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
    63
	private static final long VALID_ABLD_SIZE = 1024;
1913
bcd5f4dbd8ac Fix for Bug 11467; added automatic scan for changes in drive specs on project import/creation.
stechong
parents: 1904
diff changeset
    64
	
bcd5f4dbd8ac Fix for Bug 11467; added automatic scan for changes in drive specs on project import/creation.
stechong
parents: 1904
diff changeset
    65
	private File[] systemDrives;
1421
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
    66
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    67
	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
    68
	long devicesXLMLastModified;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    69
	
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
	 * 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
    72
	 */
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    73
	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
    74
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
	 * 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
    77
	 */
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    78
	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
    79
	
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    80
	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
    81
		super();
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    82
	}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    83
	
1421
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
    84
	protected boolean doScanSDKs(IProgressMonitor monitor) {
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
    85
		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
    86
		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
    87
		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
    88
			File devicesFile = getDevicesXMLFile();
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    89
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
    90
			if (devicesFile == null || !devicesFile.exists()) {
1474
f7fe29684b34 Fixed SDK scanning issues at startup; also fixed Bug 11470.
stechong
parents: 1468
diff changeset
    91
				// 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
    92
				// 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
    93
			} else {
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
    94
				devicesXLMLastModified = devicesFile.lastModified();
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
    95
				devicesType = DevicesLoader.loadDevices(devicesFile.toURL());
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
    96
				EList devices = devicesType.getDevice();
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
    97
				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
    98
					SymbianSDK sdk = new SymbianSDK((DeviceType) iter.next());
1474
f7fe29684b34 Fixed SDK scanning issues at startup; also fixed Bug 11470.
stechong
parents: 1468
diff changeset
    99
					sdk.addSupportedFeature(ISymbianSDKFeatures.IS_FROM_DEVICES_XML);
1919
5c9cbbdfb5c2 Fix for Bug 11934 [C3 SDK - If devices.xml has a drive a rescan will created a second instance].
stechong
parents: 1913
diff changeset
   100
					if (isInSDKList(sdk)) {
5c9cbbdfb5c2 Fix for Bug 11934 [C3 SDK - If devices.xml has a drive a rescan will created a second instance].
stechong
parents: 1913
diff changeset
   101
						continue;
5c9cbbdfb5c2 Fix for Bug 11934 [C3 SDK - If devices.xml has a drive a rescan will created a second instance].
stechong
parents: 1913
diff changeset
   102
					}
1421
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
   103
					sdkList.add(sdk);
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
   104
				}
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   105
			}
1421
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
   106
		} catch (Exception e) {
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
   107
			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
   108
			result = false;
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
   109
		}
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   110
1663
21ded3449e77 Updated SDK manager behavior when scanning drives for SDKs.
stechong
parents: 1568
diff changeset
   111
		scanCarbideSDKCache();
1421
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
   112
		doScanDrives(monitor);
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
   113
		return result;
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   114
	}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   115
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
   116
	public void updateSDK(ISymbianSDK sdk) {
1474
f7fe29684b34 Fixed SDK scanning issues at startup; also fixed Bug 11470.
stechong
parents: 1468
diff changeset
   117
		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
   118
			try {
f7fe29684b34 Fixed SDK scanning issues at startup; also fixed Bug 11470.
stechong
parents: 1468
diff changeset
   119
				File devicesFile = getDevicesXMLFile();
1431
536cdcdc768b Fixed various issues in new SDK preference page.
stechong
parents: 1424
diff changeset
   120
1474
f7fe29684b34 Fixed SDK scanning issues at startup; also fixed Bug 11470.
stechong
parents: 1468
diff changeset
   121
				if (devicesFile == null || !devicesFile.exists()) {
f7fe29684b34 Fixed SDK scanning issues at startup; also fixed Bug 11470.
stechong
parents: 1468
diff changeset
   122
					// 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
   123
					// add it
f7fe29684b34 Fixed SDK scanning issues at startup; also fixed Bug 11470.
stechong
parents: 1468
diff changeset
   124
					doAsynchPromptCreateDevicesXML();
f7fe29684b34 Fixed SDK scanning issues at startup; also fixed Bug 11470.
stechong
parents: 1468
diff changeset
   125
					return;
f7fe29684b34 Fixed SDK scanning issues at startup; also fixed Bug 11470.
stechong
parents: 1468
diff changeset
   126
				}
1431
536cdcdc768b Fixed various issues in new SDK preference page.
stechong
parents: 1424
diff changeset
   127
1474
f7fe29684b34 Fixed SDK scanning issues at startup; also fixed Bug 11470.
stechong
parents: 1468
diff changeset
   128
				// 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
   129
				DevicesLoader.updateDevice(sdk, devicesFile.toURL());
f7fe29684b34 Fixed SDK scanning issues at startup; also fixed Bug 11470.
stechong
parents: 1468
diff changeset
   130
				
f7fe29684b34 Fixed SDK scanning issues at startup; also fixed Bug 11470.
stechong
parents: 1468
diff changeset
   131
			} catch (Exception e) { 
f7fe29684b34 Fixed SDK scanning issues at startup; also fixed Bug 11470.
stechong
parents: 1468
diff changeset
   132
				// must catch and rethrow as unchecked exception this 
f7fe29684b34 Fixed SDK scanning issues at startup; also fixed Bug 11470.
stechong
parents: 1468
diff changeset
   133
				// because no throws clause in API method
f7fe29684b34 Fixed SDK scanning issues at startup; also fixed Bug 11470.
stechong
parents: 1468
diff changeset
   134
				throw new RuntimeException(e);
f7fe29684b34 Fixed SDK scanning issues at startup; also fixed Bug 11470.
stechong
parents: 1468
diff changeset
   135
			}
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   136
		}
1474
f7fe29684b34 Fixed SDK scanning issues at startup; also fixed Bug 11470.
stechong
parents: 1468
diff changeset
   137
		updateCarbideSDKCache();
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   138
	}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   139
	
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
	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
   141
		// 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
   142
		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
   143
		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
   144
			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
   145
			 
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
			// 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
   147
			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
   148
			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
   149
			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
   150
				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
   151
				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
   152
					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
   153
						return false; // write failed
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
					break;
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   156
				}
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
   157
			}
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
			
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
   159
			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
   160
		} 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
   161
			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
   162
		}
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
   163
		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
   164
		
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   165
	}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   166
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
   167
	// 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
   168
	// 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
   169
	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
   170
		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
   171
		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
   172
		
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
		if (regPath == null){
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   174
			// 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
   175
			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
   176
							"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
   177
							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
   178
			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
   179
			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
   180
		}
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
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
		// 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
   183
		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
   184
		if (!regPath.toFile().exists()){
1474
f7fe29684b34 Fixed SDK scanning issues at startup; also fixed Bug 11470.
stechong
parents: 1468
diff changeset
   185
//			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
   186
//			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
   187
			return null;
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   188
		}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   189
		
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
   190
		return regPath;
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   191
	}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   192
	
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   193
	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
   194
		IPath devicesPath = getDevicesXMLFromRegistry();
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   195
		
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
   196
		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
   197
			return devicesPath.toFile();
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   198
		}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   199
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
   200
		// 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
   201
		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
   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
		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
   204
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
   205
		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
   206
		return deviceDirPath.append(DEVICES_FILE_NAME).toFile();
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   207
	}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   208
	
1776
ad19bba5eef8 refactoring ISDKManager - removing unnecessary API
timkelly
parents: 1719
diff changeset
   209
	/**
ad19bba5eef8 refactoring ISDKManager - removing unnecessary API
timkelly
parents: 1719
diff changeset
   210
	 * Getting installation path of CSL (GCCE) Arm Toolchain from the registry.
ad19bba5eef8 refactoring ISDKManager - removing unnecessary API
timkelly
parents: 1719
diff changeset
   211
	 * The method also check that the all required tools exist.
ad19bba5eef8 refactoring ISDKManager - removing unnecessary API
timkelly
parents: 1719
diff changeset
   212
	 * @return Path to tool binaries under installation path directory, 
ad19bba5eef8 refactoring ISDKManager - removing unnecessary API
timkelly
parents: 1719
diff changeset
   213
	 *         successful. Otherwise throws an exception.
ad19bba5eef8 refactoring ISDKManager - removing unnecessary API
timkelly
parents: 1719
diff changeset
   214
	 * @throws SDKEnvInfoFailureException 
ad19bba5eef8 refactoring ISDKManager - removing unnecessary API
timkelly
parents: 1719
diff changeset
   215
	 */
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   216
	public String getCSLArmToolchainInstallPathAndCheckReqTools() throws SDKEnvInfoFailureException{
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   217
		
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   218
		String installPath = null;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   219
		
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   220
		try {			
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   221
			WindowsRegistry wr = WindowsRegistry.getRegistry();
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   222
			installPath = wr.getLocalMachineValue(CSL_ARM_TOOLCHAIN_REG_PATH, 
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   223
													 CSL_ARM_TOOLCHAIN_REG_KEY);			
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   224
		} catch (Exception e) {			
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   225
			String errMsg = "Could not read registry for local machine key: '" +  CSL_ARM_TOOLCHAIN_REG_PATH 
1709
6bd6640867aa clean up some TODOs
timkelly
parents: 1667
diff changeset
   226
								+ " (" + e.getMessage() +")."; //$NON-NLS-N$
0
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
		if (!new File(installPath).exists()){
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   231
			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
   232
							+  CSL_ARM_TOOLCHAIN_REG_PATH 
1709
6bd6640867aa clean up some TODOs
timkelly
parents: 1667
diff changeset
   233
							+ "' does not exist."; //$NON-NLS-N$
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   234
			throw new SDKEnvInfoFailureException(errMsg);
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
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   237
		String gcceToolDir = installPath + "\\bin";
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   238
		
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
   239
		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
   240
									"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
   241
									"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
   242
									};
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   243
		String toolName = null;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   244
		String toolPathName = null;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   245
		for (int i = 0; i < gccBinToolList.length; i++) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   246
			toolName = gccBinToolList[i];
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   247
			toolPathName = gcceToolDir + "\\" + toolName;
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
			if (!new File(toolPathName).exists()){
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   250
				String errMsg = "Required tool from CSL Arm Toolchain is missing: " 
1709
6bd6640867aa clean up some TODOs
timkelly
parents: 1667
diff changeset
   251
								+ toolPathName; //$NON-NLS-N$
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   252
				throw new SDKEnvInfoFailureException(errMsg);
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   253
			}			
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   254
		}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   255
		
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   256
		return gcceToolDir;
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
	public void doAsynchPromptCreateDevicesXML() {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   260
		PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   261
			public void run() {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   262
				checkDevicesXMLExistAndCreate();
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   263
			}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   264
		});
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   265
		
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   266
	}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   267
	
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
   268
	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
   269
		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
   270
		File devicesFile = getDevicesXMLFile();
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   271
		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
   272
			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
   273
					"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
   274
				try {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   275
					// 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
   276
					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
   277
						devicesFile.getParentFile().mkdirs();
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   278
					}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   279
					
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   280
					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
   281
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   282
					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
   283
					fw.write(EMPTY_DEVICES_XML_CONTENT);
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   284
					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
   285
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
					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
   287
							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
   288
								"{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
   289
								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
   290
					return true;
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   291
				} 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
   292
					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
   293
					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
   294
					logError(message, e);
0
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
			}
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
		
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
   299
		return false;
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   300
	}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   301
	
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   302
	
1776
ad19bba5eef8 refactoring ISDKManager - removing unnecessary API
timkelly
parents: 1719
diff changeset
   303
	/**
ad19bba5eef8 refactoring ISDKManager - removing unnecessary API
timkelly
parents: 1719
diff changeset
   304
	 * Checks to see if the devices.xml on disk contains the same current information
ad19bba5eef8 refactoring ISDKManager - removing unnecessary API
timkelly
parents: 1719
diff changeset
   305
	 * as what we have in the sdk list. When not synchronized, when an SDK is add or removed
ad19bba5eef8 refactoring ISDKManager - removing unnecessary API
timkelly
parents: 1719
diff changeset
   306
	 * outside of Carbide for example, this means an SDK rescan operation is needed.
ad19bba5eef8 refactoring ISDKManager - removing unnecessary API
timkelly
parents: 1719
diff changeset
   307
	 * @return true if synchronized (no rescan needed), otherwise false (not up to date). Will also return true when devices.xml does not exist
ad19bba5eef8 refactoring ISDKManager - removing unnecessary API
timkelly
parents: 1719
diff changeset
   308
	 * @see ISDKManager.fireDevicesXMLChanged
ad19bba5eef8 refactoring ISDKManager - removing unnecessary API
timkelly
parents: 1719
diff changeset
   309
	 * @since 2.0
ad19bba5eef8 refactoring ISDKManager - removing unnecessary API
timkelly
parents: 1719
diff changeset
   310
	 */ 
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   311
	public boolean checkDevicesXMLSynchronized(){
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   312
		if (devicesXLMLastModified == 0){
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   313
			return true; // no devices.xml file
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
		
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   316
		File deviceFile = getDevicesXMLFile();
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   317
		if (deviceFile.exists()){
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   318
			if (deviceFile.lastModified() <= devicesXLMLastModified){
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   319
				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
   320
			} else {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   321
				// 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
   322
				// has actually changed...
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   323
				boolean needsRescan = false;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   324
				devicesXLMLastModified = deviceFile.lastModified();
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   325
				
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   326
				// 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
   327
				// we get from devices.xml
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   328
				List<ISymbianSDK> localSDKList = new ArrayList<ISymbianSDK>();
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   329
				DevicesType devicesType;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   330
				try {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   331
					devicesType = DevicesLoader.loadDevices(deviceFile.toURL());
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   332
					EList devices = devicesType.getDevice();
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   333
					for (Iterator iter = devices.iterator(); iter.hasNext();) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   334
						SymbianSDK sdk = new SymbianSDK((DeviceType) iter.next());
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   335
						localSDKList.add(sdk);
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   336
					}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   337
				}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   338
				catch (MalformedURLException e) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   339
					e.printStackTrace();
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   340
				} catch (URISyntaxException e) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   341
					e.printStackTrace();
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   342
				} catch (IOException e) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   343
					e.printStackTrace();
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   344
				}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   345
				
1568
508bfdb3a934 Added caching of Raptor query data for aliases, products and configs.
stechong
parents: 1538
diff changeset
   346
				for (ISymbianSDK sdk : localSDKList){
508bfdb3a934 Added caching of Raptor query data for aliases, products and configs.
stechong
parents: 1538
diff changeset
   347
					ISymbianSDK currSDK = getSDK(sdk.getUniqueId(), false);
508bfdb3a934 Added caching of Raptor query data for aliases, products and configs.
stechong
parents: 1538
diff changeset
   348
					if (currSDK == null){
508bfdb3a934 Added caching of Raptor query data for aliases, products and configs.
stechong
parents: 1538
diff changeset
   349
						// sdk id has been changed
508bfdb3a934 Added caching of Raptor query data for aliases, products and configs.
stechong
parents: 1538
diff changeset
   350
						needsRescan = true;
508bfdb3a934 Added caching of Raptor query data for aliases, products and configs.
stechong
parents: 1538
diff changeset
   351
						break;
508bfdb3a934 Added caching of Raptor query data for aliases, products and configs.
stechong
parents: 1538
diff changeset
   352
					}
508bfdb3a934 Added caching of Raptor query data for aliases, products and configs.
stechong
parents: 1538
diff changeset
   353
					// check that the data are the same.
508bfdb3a934 Added caching of Raptor query data for aliases, products and configs.
stechong
parents: 1538
diff changeset
   354
					// 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
   355
					// the EPOCROOT or vendor 'name' has changed.
508bfdb3a934 Added caching of Raptor query data for aliases, products and configs.
stechong
parents: 1538
diff changeset
   356
					if (!sdk.getEPOCROOT().equalsIgnoreCase(currSDK.getEPOCROOT())){
508bfdb3a934 Added caching of Raptor query data for aliases, products and configs.
stechong
parents: 1538
diff changeset
   357
						needsRescan = true;
508bfdb3a934 Added caching of Raptor query data for aliases, products and configs.
stechong
parents: 1538
diff changeset
   358
						break;
508bfdb3a934 Added caching of Raptor query data for aliases, products and configs.
stechong
parents: 1538
diff changeset
   359
					}
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   360
				}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   361
				
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   362
				if (!needsRescan){
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   363
					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
   364
				}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   365
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   366
				hasScannedSDKs = false;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   367
				return false;  // SDKs were not up to date.
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   368
			}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   369
		} else {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   370
			return true;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   371
		}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   372
	}
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
   373
1913
bcd5f4dbd8ac Fix for Bug 11467; added automatic scan for changes in drive specs on project import/creation.
stechong
parents: 1904
diff changeset
   374
	public void ensureSystemDrivesSynchronized() {
bcd5f4dbd8ac Fix for Bug 11467; added automatic scan for changes in drive specs on project import/creation.
stechong
parents: 1904
diff changeset
   375
		if (HostOS.IS_WIN32) {
bcd5f4dbd8ac Fix for Bug 11467; added automatic scan for changes in drive specs on project import/creation.
stechong
parents: 1904
diff changeset
   376
			if (systemDrives != null && getSystemDrives().length > systemDrives.length) {
bcd5f4dbd8ac Fix for Bug 11467; added automatic scan for changes in drive specs on project import/creation.
stechong
parents: 1904
diff changeset
   377
				scanSDKs();
bcd5f4dbd8ac Fix for Bug 11467; added automatic scan for changes in drive specs on project import/creation.
stechong
parents: 1904
diff changeset
   378
			}
bcd5f4dbd8ac Fix for Bug 11467; added automatic scan for changes in drive specs on project import/creation.
stechong
parents: 1904
diff changeset
   379
		}
bcd5f4dbd8ac Fix for Bug 11467; added automatic scan for changes in drive specs on project import/creation.
stechong
parents: 1904
diff changeset
   380
	}
bcd5f4dbd8ac Fix for Bug 11467; added automatic scan for changes in drive specs on project import/creation.
stechong
parents: 1904
diff changeset
   381
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
   382
	@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
   383
	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
   384
		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
   385
	}
1421
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
   386
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
   387
	/**
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
   388
	 * Scan system drives for installed SDKs
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
   389
	 */
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
   390
	protected void doScanDrives(IProgressMonitor monitor) {
1913
bcd5f4dbd8ac Fix for Bug 11467; added automatic scan for changes in drive specs on project import/creation.
stechong
parents: 1904
diff changeset
   391
		File[] drives = systemDrives = getSystemDrives();
1421
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
   392
		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
   393
		for (File drive : drives) {
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
   394
			if (!isEPOCRoot(drive)) {
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
   395
				continue;
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
1431
536cdcdc768b Fixed various issues in new SDK preference page.
stechong
parents: 1424
diff changeset
   398
			String sdkId = getUniqueSDKId(drive);
1421
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
   399
			DeviceType deviceType = DevicesFactory.eINSTANCE.createDeviceType();
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
   400
			deviceType.setAlias(drive.toString());
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
   401
			deviceType.setDefault(DefaultType.NO_LITERAL);
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
   402
			deviceType.setEpocroot(drive.getAbsolutePath());
1431
536cdcdc768b Fixed various issues in new SDK preference page.
stechong
parents: 1424
diff changeset
   403
			deviceType.setId(sdkId);
1421
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
   404
			deviceType.setName("com.nokia.s60");
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
   405
			deviceType.setToolsroot(drive.getAbsolutePath());
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
   406
			deviceType.setUserdeletable("false");
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
   407
			deviceType.setUserdeletetable("false");
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
   408
			ISymbianSDK sdk = new SymbianSDK(deviceType);
1719
c55d4b8f7373 fixing SBSv2QueryTests.
timkelly
parents: 1710
diff changeset
   409
			if (sdk.getOSVersion().toString().equals("0.0")) {
1434
79471fd1fd69 First pass refactoring ISymbianSDK.
stechong
parents: 1431
diff changeset
   410
				((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
   411
			}
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
   412
1421
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
   413
			if (!isSupportedSDK(sdk)) {
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
   414
				continue;
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
   415
			}
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
   416
1421
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
   417
			if (isInSDKList(sdk)) {
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
   418
				continue;
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
   419
			}
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
   420
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
   421
			sdkList.add(sdk);
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
   422
			monitor.worked(1);
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
   423
			if (monitor.isCanceled()) {
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
   424
				monitor.done();
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
   425
				return;
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
   426
			}
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
   427
		}
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
   428
		monitor.done();
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
   429
	}
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
   430
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
   431
	private File[] getSystemDrives() {
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
   432
		if (HostOS.IS_WIN32) {
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
   433
			return File.listRoots();
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
   434
		}
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
   435
		return new File[0];
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
   436
	}
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
   437
1431
536cdcdc768b Fixed various issues in new SDK preference page.
stechong
parents: 1424
diff changeset
   438
	private String getUniqueSDKId(File drive) {
536cdcdc768b Fixed various issues in new SDK preference page.
stechong
parents: 1424
diff changeset
   439
		String sdkId = drive.toString().charAt(0) + "_SDK";
536cdcdc768b Fixed various issues in new SDK preference page.
stechong
parents: 1424
diff changeset
   440
		int suffice = 1;
536cdcdc768b Fixed various issues in new SDK preference page.
stechong
parents: 1424
diff changeset
   441
		while (!isUniqueSDKId(sdkId)) {
536cdcdc768b Fixed various issues in new SDK preference page.
stechong
parents: 1424
diff changeset
   442
			sdkId = drive.toString().charAt(0) + "_SDK" + suffice;
536cdcdc768b Fixed various issues in new SDK preference page.
stechong
parents: 1424
diff changeset
   443
			suffice++;
536cdcdc768b Fixed various issues in new SDK preference page.
stechong
parents: 1424
diff changeset
   444
		}
536cdcdc768b Fixed various issues in new SDK preference page.
stechong
parents: 1424
diff changeset
   445
		return sdkId;
536cdcdc768b Fixed various issues in new SDK preference page.
stechong
parents: 1424
diff changeset
   446
	}
536cdcdc768b Fixed various issues in new SDK preference page.
stechong
parents: 1424
diff changeset
   447
1421
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
   448
	private boolean hasAbldSupport(ISymbianSDK sdk) {
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
   449
		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
   450
		if (abld.exists()) {
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
   451
			long size = abld.length();
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
   452
			if (size >= VALID_ABLD_SIZE)
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
   453
				return true;
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
   454
		}
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
   455
		return false;
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
   456
	}
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
   457
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
   458
	private boolean hasQmake(ISymbianSDK sdk) {
1904
e1859c9e4688 check for both qmake install locations. was preiously just checking the old location when internally installed
timkelly
parents: 1801
diff changeset
   459
		File qmake = new File(sdk.getEPOCROOT(), QMAKE_FILE_LOCATION2);
1421
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
   460
		if (qmake.exists()) {
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
   461
			return true;
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
   462
		}
1904
e1859c9e4688 check for both qmake install locations. was preiously just checking the old location when internally installed
timkelly
parents: 1801
diff changeset
   463
		
e1859c9e4688 check for both qmake install locations. was preiously just checking the old location when internally installed
timkelly
parents: 1801
diff changeset
   464
		// try alternate (old) location
e1859c9e4688 check for both qmake install locations. was preiously just checking the old location when internally installed
timkelly
parents: 1801
diff changeset
   465
		qmake = new File(sdk.getEPOCROOT(), QMAKE_FILE);
e1859c9e4688 check for both qmake install locations. was preiously just checking the old location when internally installed
timkelly
parents: 1801
diff changeset
   466
		if (qmake.exists()) {
e1859c9e4688 check for both qmake install locations. was preiously just checking the old location when internally installed
timkelly
parents: 1801
diff changeset
   467
			return true;
e1859c9e4688 check for both qmake install locations. was preiously just checking the old location when internally installed
timkelly
parents: 1801
diff changeset
   468
		}
e1859c9e4688 check for both qmake install locations. was preiously just checking the old location when internally installed
timkelly
parents: 1801
diff changeset
   469
		
1421
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
   470
		return false;
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
   471
	}
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
   472
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
   473
	private boolean hasRaptor(ISymbianSDK sdk) {
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
   474
		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
   475
		if (mifconv.exists()) {
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
   476
			return true;
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
		return false;
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
   479
	}
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
   480
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
   481
	private boolean isEPOCRoot(File drive) {
1663
21ded3449e77 Updated SDK manager behavior when scanning drives for SDKs.
stechong
parents: 1568
diff changeset
   482
		IPath epocInclude = new Path(drive.getAbsolutePath()).append("epoc32").append("include");
21ded3449e77 Updated SDK manager behavior when scanning drives for SDKs.
stechong
parents: 1568
diff changeset
   483
		if (epocInclude.toFile().exists()) {
1421
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
   484
			return true;
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
   485
		} else {
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
   486
			return false;
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
   487
		}
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
   488
	}
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
   489
1919
5c9cbbdfb5c2 Fix for Bug 11934 [C3 SDK - If devices.xml has a drive a rescan will created a second instance].
stechong
parents: 1913
diff changeset
   490
	@Override
5c9cbbdfb5c2 Fix for Bug 11934 [C3 SDK - If devices.xml has a drive a rescan will created a second instance].
stechong
parents: 1913
diff changeset
   491
	protected boolean isInSDKList(ISymbianSDK sdk) {
1421
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
   492
		for (ISymbianSDK entry : sdkList) {
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
   493
			if (entry.getEPOCROOT().equalsIgnoreCase(sdk.getEPOCROOT())) {
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
   494
				return true;
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
		}
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
   497
		return false;
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
   498
	}
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
   499
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
   500
	private boolean isSupportedSDK(ISymbianSDK sdk) {
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
   501
		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
   502
			return true;
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
		return false;
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
   505
	}
587da7cb64b7 New SDK preference page and SDK scanning mechanism; fix for Bug 10634.
stechong
parents: 928
diff changeset
   506
1431
536cdcdc768b Fixed various issues in new SDK preference page.
stechong
parents: 1424
diff changeset
   507
	private boolean isUniqueSDKId(String sdkId) {
1500
9dcfd25090a5 Fixed problem in isUniqueSDKId() that may cause recursive calls.
stechong
parents: 1484
diff changeset
   508
		for (ISymbianSDK sdk : sdkList){
1431
536cdcdc768b Fixed various issues in new SDK preference page.
stechong
parents: 1424
diff changeset
   509
			if (sdk.getUniqueId().equalsIgnoreCase(sdkId)){
536cdcdc768b Fixed various issues in new SDK preference page.
stechong
parents: 1424
diff changeset
   510
				return false;
536cdcdc768b Fixed various issues in new SDK preference page.
stechong
parents: 1424
diff changeset
   511
			}
536cdcdc768b Fixed various issues in new SDK preference page.
stechong
parents: 1424
diff changeset
   512
		}
536cdcdc768b Fixed various issues in new SDK preference page.
stechong
parents: 1424
diff changeset
   513
		return true;
536cdcdc768b Fixed various issues in new SDK preference page.
stechong
parents: 1424
diff changeset
   514
	}
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   515
}