fix bug 9032. Only scan SDKs for plugins once for an IDE configuration lifetime.
authortimkelly
Thu, 11 Jun 2009 17:14:06 -0500
changeset 231 4885a40e8b9b
parent 230 0c429b331dcc
child 232 bb76de95ab1e
fix bug 9032. Only scan SDKs for plugins once for an IDE configuration lifetime.
core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/sdk/core/model/SDKManager.java
core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/sdk/core/model/SymbianSDK.java
core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/sdk/core/ISymbianSDK.java
core/com.nokia.carbide.cpp.sdk.ui/src/com/nokia/carbide/cpp/internal/sdk/ui/NewPluginChecker.java
core/com.nokia.carbide.templatewizard.symbian.tests/src/com/nokia/carbide/templatewizard/symbian/tests/TestSymbianSDK.java
--- a/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/sdk/core/model/SDKManager.java	Thu Jun 11 16:16:05 2009 -0500
+++ b/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/sdk/core/model/SDKManager.java	Thu Jun 11 17:14:06 2009 -0500
@@ -62,6 +62,7 @@
 	private static final String SDK_CACHE_OS_VERSION_ATTRIB = "osVersion";
 	private static final String SDK_CACHE_OS_BRANCH_ATTRIB = "osBranch";
 	private static final String SDK_CACHE_SDK_VERSION_ATTRIB = "sdkVersion";
+	private static final String SDK_SCANNED_FOR_PLUGINS = "sdkScanned";
 	
 	private static final String EMPTY_STRING = "";
 	private static boolean enableBSFScanner;
@@ -420,9 +421,21 @@
 				if (sdkVersionItem != null)
 					sdkVersion = sdkVersionItem.getNodeValue();
 				
+				// get whether or not this SDK has been scanned
+				String wasScanned = "false";
+				Node sdkScannedItem = attribs.getNamedItem(SDK_SCANNED_FOR_PLUGINS);
+				if (sdkScannedItem != null)
+					wasScanned = sdkScannedItem.getNodeValue();
+				
 				ISymbianSDK sdk = getSDK(id, false);
 				if (sdk != null){
 					
+					if (wasScanned.equalsIgnoreCase("true")){
+						sdk.setPreviouslyScanned(true);
+					} else {
+						sdk.setPreviouslyScanned(false);
+					}
+					
 					if (sdkEnabled.equalsIgnoreCase("true")){
 						sdk.setEnabled(true);
 					} else {
@@ -506,6 +519,14 @@
 					}
 					attribs.setNamedItem(enabledNode);
 					
+					Node wasScannedNode = d.createAttribute(SDK_SCANNED_FOR_PLUGINS);
+					if (true == currSDK.isPreviouslyScanned()) {
+						wasScannedNode.setNodeValue("true");
+					} else {
+						wasScannedNode.setNodeValue("false");
+					}
+					attribs.setNamedItem(wasScannedNode);
+					
 					Node osVerNode = d.createAttribute(SDK_CACHE_OS_VERSION_ATTRIB);
 					osVerNode.setNodeValue(currSDK.getOSVersion().toString());
 					attribs.setNamedItem(osVerNode);
--- a/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/sdk/core/model/SymbianSDK.java	Thu Jun 11 16:16:05 2009 -0500
+++ b/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/sdk/core/model/SymbianSDK.java	Thu Jun 11 17:14:06 2009 -0500
@@ -72,6 +72,7 @@
 	
 	protected DeviceType deviceEntry = null;
 	private boolean enabled = true;
+	private boolean wasScanned = false;
 	private Version osVersion;
 	private Version sdkVersion;
 	private String sdkOSBranch;
@@ -1223,5 +1224,13 @@
 		}
 		return sbvCatalog;
 	}
+
+	public void setPreviouslyScanned(boolean wasScanned) {
+		this.wasScanned = wasScanned;
+	}
+	
+	public boolean isPreviouslyScanned() {
+		return wasScanned;
+	}
 	
 }
--- a/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/sdk/core/ISymbianSDK.java	Thu Jun 11 16:16:05 2009 -0500
+++ b/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/sdk/core/ISymbianSDK.java	Thu Jun 11 17:14:06 2009 -0500
@@ -366,4 +366,17 @@
 	 * Get the Symbian Binary Variation (SBV) catalog for the SDK.
 	 */
 	ISBVCatalog getSBVCatalog();
+	
+	/**
+	 * Tells whether or not the plug-in installer has sniffed this SDK for eclipse plug-ins to install.
+	 * @return true if the SDK was scanned.
+	 */
+	boolean isPreviouslyScanned();
+	
+	/**
+	 * Set flag to tell whether or not the SDK was scanned for eclipse plugins to install.
+	 * @param wasScanned was the SDK scanned for plugins?
+	 */
+	void setPreviouslyScanned(boolean wasScanned);
+	
 }
--- a/core/com.nokia.carbide.cpp.sdk.ui/src/com/nokia/carbide/cpp/internal/sdk/ui/NewPluginChecker.java	Thu Jun 11 16:16:05 2009 -0500
+++ b/core/com.nokia.carbide.cpp.sdk.ui/src/com/nokia/carbide/cpp/internal/sdk/ui/NewPluginChecker.java	Thu Jun 11 17:14:06 2009 -0500
@@ -46,28 +46,41 @@
 			@Override
 			protected IStatus run(IProgressMonitor monitor) {
 				boolean installed = false;
+				boolean oneSDKWasScanned = false;
 				for (ISymbianSDK sdk : sdkList) {
-					// XML was parsed, now try to run the feature installer
-					try {
-						String eclipsePluginsPath = sdk.getEPOCROOT() + SDK_FEATURE_SUBDIR;
-						DynamicFeatureInstaller installer = new DynamicFeatureInstaller(new File(eclipsePluginsPath), null);
-						if (installer.install()) {
-							installed = true;
+					
+					if (sdk.isPreviouslyScanned() == false){
+						oneSDKWasScanned = true;
+						// XML was parsed, now try to run the feature installer
+						try {
+							sdk.setPreviouslyScanned(true);
+							String eclipsePluginsPath = sdk.getEPOCROOT() + SDK_FEATURE_SUBDIR;
+							DynamicFeatureInstaller installer = new DynamicFeatureInstaller(new File(eclipsePluginsPath), null);
+							if (installer.install()) {
+								installed = true;
+							}
+	// Boog 8383: We should fail silently, since this will not break anything and may SDKs will not have any documentation
+	// Otherwise, these errors will be logged every time this check is done (workspace is opened)
+	// Originally, this was used to install MBS build support, but now is only used for SDK documentation
+						} catch (MalformedURLException e) {
+	//						ResourcesPlugin.getPlugin().getLog().log(new Status(IStatus.ERROR, SDKCorePlugin.PLUGIN_ID, IStatus.ERROR, "Unable to install plug-ins dynamically.", e));
+						} catch (FileNotFoundException e) {
+	//						ResourcesPlugin.getPlugin().getLog().log(new Status(IStatus.ERROR, SDKCorePlugin.PLUGIN_ID, IStatus.ERROR, "Unable to install plug-ins dynamically.", e));
+						} catch (InstallationFailureException e) {
+	//						ResourcesPlugin.getPlugin().getLog().log(new Status(IStatus.ERROR, SDKCorePlugin.PLUGIN_ID, IStatus.ERROR, "Unable to install plug-ins dynamically.", e));
 						}
-// Boog 8383: We should fail silently, since this will not break anything and may SDKs will not have any documentation
-// Otherwise, these errors will be logged every time this check is done (workspace is opened)
-// Originally, this was used to install MBS build support, but now is only used for SDK documentation
-					} catch (MalformedURLException e) {
-//						ResourcesPlugin.getPlugin().getLog().log(new Status(IStatus.ERROR, SDKCorePlugin.PLUGIN_ID, IStatus.ERROR, "Unable to install plug-ins dynamically.", e));
-					} catch (FileNotFoundException e) {
-//						ResourcesPlugin.getPlugin().getLog().log(new Status(IStatus.ERROR, SDKCorePlugin.PLUGIN_ID, IStatus.ERROR, "Unable to install plug-ins dynamically.", e));
-					} catch (InstallationFailureException e) {
-//						ResourcesPlugin.getPlugin().getLog().log(new Status(IStatus.ERROR, SDKCorePlugin.PLUGIN_ID, IStatus.ERROR, "Unable to install plug-ins dynamically.", e));
 					}
+					
+				}
+				
+				if (oneSDKWasScanned) {
+					SDKCorePlugin.getSDKManager().updateCarbideSDKCache();
 				}
 				if (installed) {
+					// plugins from some SDK were installed
 					doEclipseRestartDialog(workbench);
 				}
+				
 				return Status.OK_STATUS;
 			}
 		};
--- a/core/com.nokia.carbide.templatewizard.symbian.tests/src/com/nokia/carbide/templatewizard/symbian/tests/TestSymbianSDK.java	Thu Jun 11 16:16:05 2009 -0500
+++ b/core/com.nokia.carbide.templatewizard.symbian.tests/src/com/nokia/carbide/templatewizard/symbian/tests/TestSymbianSDK.java	Thu Jun 11 17:14:06 2009 -0500
@@ -228,6 +228,14 @@
 	public ISBVCatalog getSBVCatalog() {
 		return null;
 	}
+	public boolean isPreviouslyScanned() {
+		// TODO Auto-generated method stub
+		return false;
+	}
+	public void setPreviouslyScanned(boolean wasScanned) {
+		// TODO Auto-generated method stub
+		
+	}
 	
 	
 }
\ No newline at end of file