# HG changeset patch
# User timkelly
# Date 1266202172 21600
# Node ID 6773165abc05dad6984c5aa90ac44cd3bb0560a3
# Parent 57698352558cc2a2125c9602f390ef00b681af93
Fix bug 10681. Merge from default.
diff -r 57698352558c -r 6773165abc05 core/com.nokia.carbide.cpp.sdk.core/plugin.xml
--- a/core/com.nokia.carbide.cpp.sdk.core/plugin.xml Fri Feb 12 14:45:16 2010 -0600
+++ b/core/com.nokia.carbide.cpp.sdk.core/plugin.xml Sun Feb 14 20:49:32 2010 -0600
@@ -21,6 +21,9 @@
type="devices"
class="com.nokia.carbide.cpp.internal.sdk.core.gen.Devices.util.DevicesResourceFactoryImpl" />
+
+
+
diff -r 57698352558c -r 6773165abc05 core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/sdk/core/model/SDKManager.java
--- a/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/sdk/core/model/SDKManager.java Fri Feb 12 14:45:16 2010 -0600
+++ b/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/sdk/core/model/SDKManager.java Sun Feb 14 20:49:32 2010 -0600
@@ -39,6 +39,10 @@
import org.eclipse.cdt.utils.WindowsRegistry;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IExtension;
+import org.eclipse.core.runtime.IExtensionPoint;
+import org.eclipse.core.runtime.IExtensionRegistry;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Path;
@@ -60,6 +64,7 @@
import com.nokia.carbide.cpp.internal.api.sdk.BuildPlat;
import com.nokia.carbide.cpp.internal.api.sdk.ICarbideDevicesXMLChangeListener;
import com.nokia.carbide.cpp.internal.api.sdk.ISDKManagerInternal;
+import com.nokia.carbide.cpp.internal.api.sdk.ISDKManagerLoadedHook;
import com.nokia.carbide.cpp.internal.api.sdk.SBSv2Utils;
import com.nokia.carbide.cpp.internal.api.sdk.SDKManagerInternalAPI;
import com.nokia.carbide.cpp.internal.api.sdk.SymbianMacroStore;
@@ -113,8 +118,6 @@
*/
public static final Version MINIMUM_RAPTOR_VERSION = new Version(2, 8, 6);
-
-
static boolean hasPromptedForDevicesXML = false; // make sure we only ask once at startup if devices.xml does not exist
static boolean hasScannedSDKs = false; // make sure we only scan SDKs when needed
long devicesXLMLastModified;
@@ -143,6 +146,8 @@
*/
private static ListenerList devicesXMLListeners = new ListenerList();
+ static boolean sdkHookExtenstionsNotified;
+ public static final String SDK_MANAGER_LOADED_HOOK = SDKCorePlugin.PLUGIN_ID + ".sdkManagerLoadedHook"; //$NON-NLS-1$
public SDKManager() {
macroStore = SymbianMacroStore.getInstance();
@@ -231,6 +236,12 @@
private void ensureScannedSDKs() {
if (!hasScannedSDKs) {
scanSDKs();
+
+ // Notify any plugins that want to know if the SDKManager has scanned plugins.
+ if (!sdkHookExtenstionsNotified) {
+ notifySDKManagerLoaded();
+ sdkHookExtenstionsNotified = true;
+ }
}
}
@@ -1043,5 +1054,38 @@
return MINIMUM_RAPTOR_VERSION;
}
-
+ /**
+ * Find clients of the 'sdkManagerLoadedHook' extension point so their plug-ins can be loaded
+ */
+ private void notifySDKManagerLoaded() {
+ ISDKManagerLoadedHook sdkHook = null;
+ IExtensionRegistry er = Platform.getExtensionRegistry();
+ IExtensionPoint ep = er.getExtensionPoint(SDK_MANAGER_LOADED_HOOK);
+ IExtension[] extensions = ep.getExtensions();
+
+ for (int i = 0; i < extensions.length; i++) {
+ IExtension extension = extensions[i];
+ IConfigurationElement[] ces = extension.getConfigurationElements();
+ if (ces != null && ces.length >= 1) {
+ IConfigurationElement providerElement = ces[0];
+ String name = providerElement.getAttribute("name"); //$NON-NLS-1$
+ if (name != null) {
+ if (providerElement.getAttribute("class") != null) { //$NON-NLS-1$
+
+ try {
+ sdkHook = (ISDKManagerLoadedHook) providerElement.createExecutableExtension("class"); //$NON-NLS-1$
+ sdkHook.symbianSDKManagerLoaded();
+ } catch (CoreException e) {
+ // ignore
+ // e.printStackTrace();
+ }
+ }
+ }
+
+ }
+ }
+ return;
+
+ }
+
}
diff -r 57698352558c -r 6773165abc05 qt/com.nokia.carbide.cpp.qt.core/.settings/org.eclipse.jdt.core.prefs
--- a/qt/com.nokia.carbide.cpp.qt.core/.settings/org.eclipse.jdt.core.prefs Fri Feb 12 14:45:16 2010 -0600
+++ b/qt/com.nokia.carbide.cpp.qt.core/.settings/org.eclipse.jdt.core.prefs Sun Feb 14 20:49:32 2010 -0600
@@ -1,7 +1,74 @@
-#Thu Jul 24 13:26:54 CDT 2008
+#Wed Feb 10 21:25:23 CST 2010
eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
+org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning
+org.eclipse.jdt.core.compiler.problem.deadCode=warning
+org.eclipse.jdt.core.compiler.problem.deprecation=warning
+org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
+org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled
+org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
+org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
+org.eclipse.jdt.core.compiler.problem.fatalOptionalError=enabled
+org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore
+org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
+org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
+org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
+org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
+org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
+org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=ignore
+org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore
+org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore
+org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
+org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=ignore
+org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=ignore
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore
+org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
+org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore
+org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
+org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
+org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore
+org.eclipse.jdt.core.compiler.problem.nullReference=warning
+org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
+org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
+org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=ignore
+org.eclipse.jdt.core.compiler.problem.potentialNullReference=ignore
+org.eclipse.jdt.core.compiler.problem.rawTypeReference=warning
+org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore
+org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore
+org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
+org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
+org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
+org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
+org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
+org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
+org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
+org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
+org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
+org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=ignore
+org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
+org.eclipse.jdt.core.compiler.problem.unusedImport=warning
+org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
+org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
+org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore
+org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=enabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
+org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
+org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
+org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
org.eclipse.jdt.core.compiler.source=1.5
diff -r 57698352558c -r 6773165abc05 qt/com.nokia.carbide.cpp.qt.core/META-INF/MANIFEST.MF
--- a/qt/com.nokia.carbide.cpp.qt.core/META-INF/MANIFEST.MF Fri Feb 12 14:45:16 2010 -0600
+++ b/qt/com.nokia.carbide.cpp.qt.core/META-INF/MANIFEST.MF Sun Feb 14 20:49:32 2010 -0600
@@ -7,11 +7,14 @@
Bundle-Vendor: Nokia
Require-Bundle: org.eclipse.core.runtime,
org.eclipse.cdt.core,
+ org.eclipse.ui,
org.eclipse.core.resources,
org.eclipse.jface,
com.nokia.carbide.cpp.sdk.core,
com.nokia.carbide.cpp.sdk.ui,
- com.trolltech.qtcppproject;bundle-version="1.6.0";resolution:=optional
+ com.nokia.cpp.utils.core;bundle-version="1.0.0",
+ com.trolltech.qtcppproject;bundle-version="1.6.0";resolution:=optional,
+ com.trolltech.qtproject;bundle-version="1.6.0";resolution:=optional
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Bundle-ActivationPolicy: lazy
Export-Package: com.nokia.carbide.cpp.internal.qt.core
diff -r 57698352558c -r 6773165abc05 qt/com.nokia.carbide.cpp.qt.core/plugin.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/qt/com.nokia.carbide.cpp.qt.core/plugin.xml Sun Feb 14 20:49:32 2010 -0600
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff -r 57698352558c -r 6773165abc05 qt/com.nokia.carbide.cpp.qt.core/src/com/nokia/carbide/cpp/internal/qt/core/QtCorePlugin.java
--- a/qt/com.nokia.carbide.cpp.qt.core/src/com/nokia/carbide/cpp/internal/qt/core/QtCorePlugin.java Fri Feb 12 14:45:16 2010 -0600
+++ b/qt/com.nokia.carbide.cpp.qt.core/src/com/nokia/carbide/cpp/internal/qt/core/QtCorePlugin.java Sun Feb 14 20:49:32 2010 -0600
@@ -17,16 +17,25 @@
*/
package com.nokia.carbide.cpp.internal.qt.core;
+import java.util.List;
+
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IProjectDescription;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Plugin;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.Job;
import org.osgi.framework.BundleContext;
+import com.nokia.carbide.cpp.internal.api.sdk.ISDKManagerLoadedHook;
+import com.nokia.carbide.cpp.sdk.core.ICarbideInstalledSDKChangeListener;
+import com.nokia.carbide.cpp.sdk.core.ISymbianSDK;
+import com.nokia.carbide.cpp.sdk.core.SDKCorePlugin;
import com.trolltech.qtcppproject.QtNature;
-public class QtCorePlugin extends Plugin {
+public class QtCorePlugin extends Plugin implements ICarbideInstalledSDKChangeListener, ISDKManagerLoadedHook {
// The plug-in ID
public static final String PLUGIN_ID = "com.nokia.carbide.cpp.qt.core"; //$NON-NLS-1$
@@ -56,6 +65,7 @@
* @see org.eclipse.core.runtime.Plugin#stop(org.osgi.framework.BundleContext)
*/
public void stop(BundleContext context) throws Exception {
+ SDKCorePlugin.getSDKManager().removeInstalledSdkChangeListener(this);
plugin = null;
super.stop(context);
}
@@ -84,4 +94,33 @@
project.setDescription(description, monitor);
}
+ private void scanForQtSDKs() {
+
+ final String jobBaseText = "Checking for Qt installed in Symbian SDKs";
+ Job job = new Job(jobBaseText) {
+
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ List sdkList = SDKCorePlugin.getSDKManager()
+ .getSDKList();
+ for (ISymbianSDK sdk : sdkList) {
+ QtSDKUtils.addQtSDKForSymbianSDK(sdk, false);
+ }
+
+ return Status.OK_STATUS;
+ }
+
+ };
+ job.schedule();
+ }
+
+ public void symbianSDKManagerLoaded() {
+ scanForQtSDKs();
+ SDKCorePlugin.getSDKManager().addInstalledSdkChangeListener(this);
+ }
+
+ public void installedSdkChanged(SDKChangeEventType eventType) {
+ scanForQtSDKs();
+ }
+
}
diff -r 57698352558c -r 6773165abc05 qt/com.nokia.carbide.cpp.qt.core/src/com/nokia/carbide/cpp/internal/qt/core/QtSDKUtils.java
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/qt/com.nokia.carbide.cpp.qt.core/src/com/nokia/carbide/cpp/internal/qt/core/QtSDKUtils.java Sun Feb 14 20:49:32 2010 -0600
@@ -0,0 +1,224 @@
+/*
+* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+*/
+package com.nokia.carbide.cpp.internal.qt.core;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.QualifiedName;
+import org.eclipse.jface.preference.IPreferenceStore;
+
+import com.nokia.carbide.cpp.sdk.core.ISymbianSDK;
+import com.nokia.cpp.internal.api.utils.core.HostOS;
+import com.trolltech.qtcppproject.QtProjectPlugin;
+import com.trolltech.qtcppproject.preferences.PreferenceConstants;
+
+/**
+ * Wrapper utils for the Qt-ecilpse integration and obtaining information about internally installed Qt-sdks
+ */
+@SuppressWarnings({ "restriction" })
+public class QtSDKUtils {
+
+ private static class QtSDK {
+
+ /**
+ * Represents one Qt-SDK from the Qt global preferences
+ */
+ QtSDK(String name, String incPath, String binPath){
+ this.binPath = binPath;
+ this.incPath = incPath;
+ this.name = name;
+ }
+
+ public String name;
+ public String binPath;
+ public String incPath;
+ }
+
+ /** Qt bin folder for internal SDK installs - epocroot relative */
+ private static final String QT_SDK_BIN_PATH = "epoc32/tools/qt";
+ /** Qt include folder for internal SDK installs - epocroot relative */
+ private static final String QT_SDK_INC_PATH = "epoc32/include/mw";
+
+ /** qt subfolder under QT_INC_FOLDER */
+ private static final String QT_FOLDER = "qt";
+ private static final String QT_MKSPECS = "mkspecs";
+ private static final String QT_QMAKE_WIN32 = "qmake.exe";
+ private static final String QT_QMAKE_UNIX = "qmake";
+
+ public static final String QT_DEFAULT_SDK_NAME = "";
+
+ private static List qtSDKList = new ArrayList();
+
+ // private data from QtProject.java
+ private static final String QTVERSION = "com.trolltech.qtcppproject.properties.qtversion";
+
+ /**
+ * For the given Symbian SDK, test whether or not it qualifies for have Qt internally built.
+ * @param sdk - The Symbian SDK or source base to test
+ * @return - true if Qt is internally installed
+ */
+ static private boolean isQtInternallyInstalled(ISymbianSDK sdk){
+
+ String epocRoot = sdk.getEPOCROOT();
+ if (new File(epocRoot + QT_SDK_BIN_PATH).exists() &&
+ new File(epocRoot + QT_SDK_INC_PATH).exists() &&
+ new File(epocRoot + QT_SDK_INC_PATH + File.separator + QT_FOLDER).exists() &&
+ new File(epocRoot + QT_SDK_BIN_PATH + File.separator + QT_MKSPECS).exists() )
+ {
+ if (HostOS.IS_WIN32 && new File(epocRoot + QT_SDK_BIN_PATH + File.separator + QT_QMAKE_WIN32).exists()){
+ return true;
+ } else if (HostOS.IS_UNIX && new File(epocRoot + QT_SDK_BIN_PATH + File.separator + QT_QMAKE_UNIX).exists()){
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ /**
+ * For the given Symbian SDK, get the Qt SDK name from the Qt global preferences.
+ * @param sdk
+ * @return The Qt SDK display name in the preferences, null if not found
+ */
+ static public String getQtSDKNameForSymbianSDK(ISymbianSDK sdk){
+
+ String epocRoot = sdk.getEPOCROOT();
+ File qtBinPath = new File (epocRoot + QT_SDK_BIN_PATH);
+ File qtIncPath = new File (epocRoot + QT_SDK_INC_PATH);
+
+ refreshQtStoredSDKs();
+
+ if (qtSDKList.size() == 0){
+ return null;
+ }
+
+ for (QtSDK qtSDK : qtSDKList){
+ File currBinPath = new File(qtSDK.binPath);
+ File currIncPath = new File(qtSDK.incPath);
+
+ if (currBinPath.equals(qtBinPath) && currIncPath.equals(qtIncPath)){
+ return qtSDK.name;
+ }
+ }
+
+ return null;
+ }
+
+ /**
+ * Add a single Qt-SDK BIN and INLCUDE path to the Qt global preferences iff it is an internally built
+ * Qt-SDK and the BIN and INC path do not already exist.
+ * @param sdk
+ * @param makeDefault - Set the default name in the global Qt prefs
+ */
+ static public void addQtSDKForSymbianSDK(ISymbianSDK sdk, boolean makeDefault){
+
+ refreshQtStoredSDKs();
+ if ((getQtSDKNameForSymbianSDK(sdk) == null) && isQtInternallyInstalled(sdk)){
+ IPath binPath = new Path(sdk.getEPOCROOT() + QT_SDK_BIN_PATH);
+ IPath incPath = new Path(sdk.getEPOCROOT() + QT_SDK_INC_PATH);
+ addQtSDK(sdk.getUniqueId(), binPath, incPath, makeDefault);
+ }
+ }
+
+ /**
+ * Add a Qt-SDK to the Qt global preferences
+ * @param name
+ * @param binPath
+ * @param incPath
+ * @param makeDefault
+ */
+ static private void addQtSDK(String name, IPath binPath, IPath incPath, boolean makeDefault){
+
+ IPreferenceStore store = QtProjectPlugin.getDefault().getPreferenceStore();
+ int count = store.getInt(PreferenceConstants.QTVERSION_COUNT);
+
+ // Store settings using zero-index base
+ store.setValue(PreferenceConstants.QTVERSION_NAME + "."
+ + Integer.toString(count), name);
+ store.setValue(PreferenceConstants.QTVERSION_BINPATH + "."
+ + Integer.toString(count), binPath.toOSString());
+ store.setValue(PreferenceConstants.QTVERSION_INCLUDEPATH + "."
+ + Integer.toString(count), incPath.toOSString());
+
+ if (makeDefault || count == 0){
+ store.setValue(PreferenceConstants.QTVERSION_DEFAULT, count);
+ }
+
+ store.setValue(PreferenceConstants.QTVERSION_COUNT, count + 1); // # of table items, base is 1 (i.e. not zero)
+
+ refreshQtStoredSDKs();
+ }
+
+ /**
+ * Update the internal list of Qt-SDKs found in the Qt global preferences
+ */
+ static void refreshQtStoredSDKs(){
+
+ qtSDKList.clear();
+
+ IPreferenceStore store = QtProjectPlugin.getDefault().getPreferenceStore();
+ int count = store.getInt(PreferenceConstants.QTVERSION_COUNT);
+ for (int i = 0; i < count; i++) {
+ String nameKey = PreferenceConstants.QTVERSION_NAME + "."
+ + Integer.toString(i);
+ String binpathKey = PreferenceConstants.QTVERSION_BINPATH + "."
+ + Integer.toString(i);
+ String includepathKey = PreferenceConstants.QTVERSION_INCLUDEPATH
+ + "." + Integer.toString(i);
+ String name = "";
+ String binPath = "";
+ String incPath = "";
+ if (store.contains(nameKey)) {
+ name = store.getString(nameKey);
+ }
+ if (store.contains(binpathKey)) {
+ binPath = store.getString(binpathKey);
+ }
+ if (store.contains(includepathKey)) {
+ incPath = store.getString(includepathKey);
+ }
+
+ QtSDK qtSDK = new QtSDK(name, incPath, binPath);
+ qtSDKList.add(qtSDK);
+ }
+ }
+
+ /**
+ * This method assumes the IProject has a Qt nature and sets the QTVERSION in the Qt project settings panel
+ * @param project
+ * @param qtSDKName
+ * @throws CoreException
+ */
+ public static void setDefaultQtSDKForProject(IProject project, String qtSDKName) throws CoreException{
+ project.setPersistentProperty(new QualifiedName("", QTVERSION), qtSDKName);
+ }
+
+ /**
+ * Assuming a Qt project, this retrieves the Qt project setting for the currently set Qt-SDK
+ * @param project
+ * @return
+ * @throws CoreException
+ */
+ public static String getDefaultQtSDKForProject(IProject project) throws CoreException{
+ return project.getPersistentProperty(new QualifiedName("", QTVERSION));
+ }
+
+}
+
+
diff -r 57698352558c -r 6773165abc05 qt/com.nokia.carbide.cpp.qt.ui/plugin.xml
--- a/qt/com.nokia.carbide.cpp.qt.ui/plugin.xml Fri Feb 12 14:45:16 2010 -0600
+++ b/qt/com.nokia.carbide.cpp.qt.ui/plugin.xml Sun Feb 14 20:49:32 2010 -0600
@@ -87,5 +87,15 @@
class="com.nokia.carbide.cpp.internal.qt.ui.QMakeEnvironmentModifier">
+
+
+
+
+
diff -r 57698352558c -r 6773165abc05 qt/com.nokia.carbide.cpp.qt.ui/src/com/nokia/carbide/cpp/internal/qt/ui/QtUIPlugin.java
--- a/qt/com.nokia.carbide.cpp.qt.ui/src/com/nokia/carbide/cpp/internal/qt/ui/QtUIPlugin.java Fri Feb 12 14:45:16 2010 -0600
+++ b/qt/com.nokia.carbide.cpp.qt.ui/src/com/nokia/carbide/cpp/internal/qt/ui/QtUIPlugin.java Sun Feb 14 20:49:32 2010 -0600
@@ -19,6 +19,7 @@
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
@@ -32,12 +33,16 @@
import com.nokia.carbide.cdt.builder.CarbideBuilderPlugin;
import com.nokia.carbide.cdt.builder.project.ICarbideBuildConfiguration;
+import com.nokia.carbide.cdt.builder.project.ICarbideConfigurationChangedListener;
import com.nokia.carbide.cdt.builder.project.ICarbideProjectInfo;
import com.nokia.carbide.cdt.builder.project.ISISBuilderInfo;
import com.nokia.carbide.cdt.internal.api.builder.SISBuilderInfo2;
+import com.nokia.carbide.cpp.internal.api.sdk.ISDKManagerLoadedHook;
+import com.nokia.carbide.cpp.internal.qt.core.QtCorePlugin;
+import com.nokia.carbide.cpp.internal.qt.core.QtSDKUtils;
import com.nokia.carbide.cpp.sdk.core.ISymbianBuildContext;
-public class QtUIPlugin extends AbstractUIPlugin {
+public class QtUIPlugin extends AbstractUIPlugin implements ICarbideConfigurationChangedListener, ISDKManagerLoadedHook {
// The plug-in ID
public static final String PLUGIN_ID = "com.nokia.carbide.cpp.qt.ui"; //$NON-NLS-1$
@@ -65,6 +70,7 @@
* @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
*/
public void stop(BundleContext context) throws Exception {
+ CarbideBuilderPlugin.removeBuildConfigChangedListener(this);
plugin = null;
super.stop(context);
}
@@ -140,4 +146,44 @@
// PlatformUI.getWorkbench() throws if running headless
}
}
+
+ /**
+ * Implements ICarbideConfigurationChangedListener
+ */
+ public void buildConfigurationChanged(ICarbideBuildConfiguration currentConfig) {
+ checkDefaultQtSDKForProject(currentConfig);
+ }
+
+ /**
+ * For the newly selected build configuration, check and see if there's an analogous internally installed
+ * Qt-SDK, and if so make that the default. The default should not change if already set to <Default> in the qt preferences or
+ * if the new configuration has no internally built Qt-SDK.
+ * @param currentConfig
+ */
+ @SuppressWarnings("restriction")
+ private void checkDefaultQtSDKForProject(ICarbideBuildConfiguration currentConfig){
+ IProject project = currentConfig.getCarbideProject().getProject();
+ try {
+ if (project != null && project.hasNature(QtCorePlugin.QT_PROJECT_NATURE_ID)) {
+
+ String qtSDKName = QtSDKUtils.getQtSDKNameForSymbianSDK(currentConfig.getSDK());
+ // If qtSDK is not internally installed or is set, don't change anything
+ String currQtSDK = QtSDKUtils.getDefaultQtSDKForProject(project);
+ if (qtSDKName == null || currQtSDK == null || currQtSDK.equals(QtSDKUtils.QT_DEFAULT_SDK_NAME)) {
+ return;
+ }
+
+ QtSDKUtils.setDefaultQtSDKForProject(project, qtSDKName);
+ }
+ } catch (CoreException e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * Implements ISDKManagerLoadedHook
+ */
+ public void symbianSDKManagerLoaded() {
+ CarbideBuilderPlugin.addBuildConfigChangedListener(this);
+ }
}
diff -r 57698352558c -r 6773165abc05 qt/com.nokia.carbide.cpp.qt.ui/src/com/nokia/carbide/cpp/internal/qt/ui/processes/ProjectCreatedTasksQt.java
--- a/qt/com.nokia.carbide.cpp.qt.ui/src/com/nokia/carbide/cpp/internal/qt/ui/processes/ProjectCreatedTasksQt.java Fri Feb 12 14:45:16 2010 -0600
+++ b/qt/com.nokia.carbide.cpp.qt.ui/src/com/nokia/carbide/cpp/internal/qt/ui/processes/ProjectCreatedTasksQt.java Sun Feb 14 20:49:32 2010 -0600
@@ -32,9 +32,11 @@
import org.eclipse.core.runtime.Status;
import com.nokia.carbide.cpp.internal.qt.core.QtCorePlugin;
+import com.nokia.carbide.cpp.internal.qt.core.QtSDKUtils;
import com.nokia.carbide.cpp.internal.qt.ui.QtUIPlugin;
import com.nokia.carbide.cpp.project.ui.processes.ProjectCreatedTasks;
import com.nokia.carbide.cpp.sdk.core.ISymbianBuildContext;
+import com.nokia.carbide.cpp.sdk.core.ISymbianSDK;
import com.nokia.carbide.template.engine.ITemplate;
import com.nokia.carbide.templatewizard.process.IParameter;
import com.trolltech.qtcppproject.QtProject;
@@ -46,6 +48,7 @@
super();
}
+ @SuppressWarnings("restriction")
@Override
public void process(ITemplate template, List parameters, IProgressMonitor monitor) throws CoreException {
@@ -81,6 +84,19 @@
// set the qmake generated pkg files to be built
QtUIPlugin.setupSISBuilderSettings(project);
+
+ // set the default Qt SDK
+ ISymbianSDK sdk = ((ISymbianBuildContext)listOfBuildConfigs.get(0)).getSDK();
+ String qtSDKName = QtSDKUtils.getQtSDKNameForSymbianSDK(sdk);
+ if (qtSDKName == null){
+ QtSDKUtils.addQtSDKForSymbianSDK(sdk, false);
+ qtSDKName = QtSDKUtils.getQtSDKNameForSymbianSDK(sdk);
+ }
+
+ if (qtSDKName != null){
+ QtSDKUtils.setDefaultQtSDKForProject(project, qtSDKName);
+ }
+
}
}
}
diff -r 57698352558c -r 6773165abc05 qt/com.nokia.carbide.cpp.qt.ui/src/com/nokia/carbide/cpp/internal/qt/ui/wizard/QtProFileImportWizard.java
--- a/qt/com.nokia.carbide.cpp.qt.ui/src/com/nokia/carbide/cpp/internal/qt/ui/wizard/QtProFileImportWizard.java Fri Feb 12 14:45:16 2010 -0600
+++ b/qt/com.nokia.carbide.cpp.qt.ui/src/com/nokia/carbide/cpp/internal/qt/ui/wizard/QtProFileImportWizard.java Sun Feb 14 20:49:32 2010 -0600
@@ -40,6 +40,7 @@
import com.nokia.carbide.cpp.internal.api.sdk.ISDKManagerInternal;
import com.nokia.carbide.cpp.internal.project.ui.ProjectUIPlugin;
import com.nokia.carbide.cpp.internal.qt.core.QtCorePlugin;
+import com.nokia.carbide.cpp.internal.qt.core.QtSDKUtils;
import com.nokia.carbide.cpp.internal.qt.ui.QtUIPlugin;
import com.nokia.carbide.cpp.project.core.ProjectCorePlugin;
import com.nokia.carbide.cpp.sdk.core.*;
@@ -120,7 +121,19 @@
// set the qmake generated pkg files to be built
QtUIPlugin.setupSISBuilderSettings(newProject);
-
+
+ // Set the default Qt SDK, if any
+ ISymbianSDK sdk = selectedConfigs.get(0).getSDK();
+ String qtSDKName = QtSDKUtils.getQtSDKNameForSymbianSDK(sdk);
+ if (qtSDKName == null){
+ QtSDKUtils.addQtSDKForSymbianSDK(sdk, false);
+ qtSDKName = QtSDKUtils.getQtSDKNameForSymbianSDK(sdk);
+ }
+
+ if (qtSDKName != null){
+ QtSDKUtils.setDefaultQtSDKForProject(newProject, qtSDKName);
+ }
+
if (monitor.isCanceled()) {
// the user canceled the import so delete the project
newProject.delete(false, true, null);