Moved scanning job back to invoking thread for now; disabled rescan button during SDK scanning.
--- a/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/sdk/core/model/AbstractSDKManager.java Thu Jun 10 11:33:55 2010 -0500
+++ b/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/sdk/core/model/AbstractSDKManager.java Thu Jun 10 12:23:31 2010 -0500
@@ -41,6 +41,7 @@
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.IJobChangeListener;
@@ -129,67 +130,12 @@
public AbstractSDKManager() {
macroStore = SymbianMacroStore.getInstance();
- scanJob = new Job ("Scan System Drives") {
- @Override
- protected IStatus run(IProgressMonitor monitor) {
- synchronized (sdkList)
- {
- ArrayList<ISymbianSDK> oldSDKList = new ArrayList<ISymbianSDK>(sdkList);
-
- getSBSv2Version(true);
-
- if (sdkList != null){
- sdkList.clear();
- }
-
- if (!doScanSDKs(monitor))
- return Status.OK_STATUS;;
-
- // now these SDK's are newly added, remove from internal list
- for (ISymbianSDK sdk : sdkList) {
- if (SDKManagerInternalAPI.getMissingSdk(sdk.getUniqueId()) != null) {
- SDKManagerInternalAPI.removeMissingSdk(sdk
- .getUniqueId());
- }
- }
-
- // now these SDK's are removed from the old list, add to
- // internal list
- for (ISymbianSDK oldSdk : oldSDKList) {
- boolean found = false;
- for (ISymbianSDK sdk : sdkList) {
- if (sdk.getUniqueId().equals(oldSdk.getUniqueId())) {
- found = true;
- break;
- }
- }
- if (found == false) {
- SDKManagerInternalAPI.addMissingSdk(oldSdk
- .getUniqueId());
- // flush cache
- SymbianBuildContextDataCache.refreshForSDKs(new ISymbianSDK[] { oldSdk });
- }
- }
- }
-
- // make sure we don't rescan over and over again
- hasScannedSDKs = true;
-
- // tell others about it
- fireInstalledSdkChanged(SDKChangeEventType.eSDKScanned);
- scanCarbideSDKCache();
-
- // Notify any plugins that want to know if the SDKManager has scanned plugins.
- if (!sdkHookExtenstionsNotified) {
- notifySDKManagerLoaded();
- sdkHookExtenstionsNotified = true;
- }
- if (monitor.isCanceled()) {
- return Status.CANCEL_STATUS;
- }
- return Status.OK_STATUS;
- }
- };
+// scanJob = new Job ("Scan System Drives") {
+// @Override
+// protected IStatus run(IProgressMonitor monitor) {
+// return handleScan(monitor);
+// }
+// };
}
public SymbianMacroStore getSymbianMacroStore(){
@@ -197,10 +143,70 @@
}
public void scanSDKs() {
- if (scanJob.getState() == Job.NONE) {
- scanJob.setSystem(true);
- scanJob.schedule();
+// if (scanJob.getState() == Job.NONE) {
+// scanJob.setSystem(true);
+// scanJob.schedule();
+// }
+ handleScan(new NullProgressMonitor());
+ }
+
+ private IStatus handleScan(IProgressMonitor monitor) {
+ synchronized (sdkList)
+ {
+ ArrayList<ISymbianSDK> oldSDKList = new ArrayList<ISymbianSDK>(sdkList);
+
+ getSBSv2Version(true);
+
+ if (sdkList != null){
+ sdkList.clear();
+ }
+
+ if (!doScanSDKs(monitor))
+ return Status.OK_STATUS;;
+
+ // now these SDK's are newly added, remove from internal list
+ for (ISymbianSDK sdk : sdkList) {
+ if (SDKManagerInternalAPI.getMissingSdk(sdk.getUniqueId()) != null) {
+ SDKManagerInternalAPI.removeMissingSdk(sdk
+ .getUniqueId());
+ }
+ }
+
+ // now these SDK's are removed from the old list, add to
+ // internal list
+ for (ISymbianSDK oldSdk : oldSDKList) {
+ boolean found = false;
+ for (ISymbianSDK sdk : sdkList) {
+ if (sdk.getUniqueId().equals(oldSdk.getUniqueId())) {
+ found = true;
+ break;
+ }
+ }
+ if (found == false) {
+ SDKManagerInternalAPI.addMissingSdk(oldSdk
+ .getUniqueId());
+ // flush cache
+ SymbianBuildContextDataCache.refreshForSDKs(new ISymbianSDK[] { oldSdk });
+ }
+ }
}
+
+ // make sure we don't rescan over and over again
+ hasScannedSDKs = true;
+
+ // tell others about it
+ fireInstalledSdkChanged(SDKChangeEventType.eSDKScanned);
+ scanCarbideSDKCache();
+
+ // Notify any plugins that want to know if the SDKManager has scanned plugins.
+ if (!sdkHookExtenstionsNotified) {
+ notifySDKManagerLoaded();
+ sdkHookExtenstionsNotified = true;
+ }
+ if (monitor.isCanceled()) {
+ return Status.CANCEL_STATUS;
+ }
+ return Status.OK_STATUS;
}
/**
--- a/core/com.nokia.carbide.cpp.sdk.ui/src/com/nokia/carbide/cpp/internal/sdk/ui/SDKPreferencePage.java Thu Jun 10 11:33:55 2010 -0500
+++ b/core/com.nokia.carbide.cpp.sdk.ui/src/com/nokia/carbide/cpp/internal/sdk/ui/SDKPreferencePage.java Thu Jun 10 12:23:31 2010 -0500
@@ -225,7 +225,7 @@
public void done(IJobChangeEvent event) {
Display.getDefault().asyncExec(new Runnable() {
public void run() {
- rescanSDKs();
+ finishRescanning();
}
});
}
@@ -261,7 +261,7 @@
*/
public SDKPreferencePage() {
super();
- scanJobListner = new ScanJobListener();
+// scanJobListner = new ScanJobListener();
}
/*
@@ -277,7 +277,7 @@
sdkList = sdkMgr.getSDKList();
if (sdkMgr instanceof SDKManager) {
SDKManager mgr = (SDKManager) sdkMgr;
- mgr.addScanJobListner(scanJobListner);
+// mgr.addScanJobListner(scanJobListner);
}
super.createControl(parent);
@@ -558,10 +558,17 @@
private void handleRescanButton() {
// forcible rescan; dump cache
SymbianBuildContextDataCache.refreshForSDKs(null);
+ startRescanning();
sdkMgr.scanSDKs();
+ finishRescanning();
}
- private void rescanSDKs(){
+ private void startRescanning() {
+ rescanButton.setText(Messages.getString("SDKPreferencePage.Rescanning_Button_Label")); //$NON-NLS-1$
+ rescanButton.setEnabled(false);
+ }
+
+ private void finishRescanning(){
sdkListTableViewer.getTable().clearAll();
sdkListTableViewer.refresh();
sdkList.clear();
@@ -569,6 +576,8 @@
addSDKComponentTableItems();
sdkListTableViewer.refresh();
selectSDKEntry(0);
+ rescanButton.setText(Messages.getString("SDKPreferencePage.Rescan_Button_Label")); //$NON-NLS-1$
+ rescanButton.setEnabled(true);
if (scanForNewPlugins){
NewPluginChecker.checkForNewlyInstalledPlugins(SDKUIPlugin.getDefault().getWorkbench());
--- a/core/com.nokia.carbide.cpp.sdk.ui/src/com/nokia/carbide/cpp/internal/sdk/ui/messages.properties Thu Jun 10 11:33:55 2010 -0500
+++ b/core/com.nokia.carbide.cpp.sdk.ui/src/com/nokia/carbide/cpp/internal/sdk/ui/messages.properties Thu Jun 10 12:23:31 2010 -0500
@@ -14,6 +14,7 @@
SDKPreferencePage.ScanForNewPlugins_Button_Label=Scan SDKs for installable Eclipse plugins
SDKPreferencePage.Rescan_Button_Label=Rescan All SDKs
SDKPreferencePage.Rescan_Button_ToolTip=Rebuilds all SDK entries (same as restarting the IDE).
+SDKPreferencePage.Rescanning_Button_Label=Rescanning...
SDKPreferencePage.No_SDKs_Available_Message=No SDKs are available.
SDKPreferencePage.No_selected_SDK_detected=No selected SDK detected.
SDKPreferencePage.List_of_Available_SDKs_ToolTip=List of available SDKs.