[Esbox-commits] r1947 - branches/work_Ed/org.maemo.esbox.scratchbox.sb1/src/org/maemo/esbox/internal/scratchbox/sb1/core
eswartz at garage.maemo.org
eswartz at garage.maemo.org
Thu Aug 6 00:56:04 EEST 2009
Author: eswartz
Date: 2009-08-06 00:55:58 +0300 (Thu, 06 Aug 2009)
New Revision: 1947
Modified:
branches/work_Ed/org.maemo.esbox.scratchbox.sb1/src/org/maemo/esbox/internal/scratchbox/sb1/core/Scratchbox1SDK.java
Log:
Don't cache current SB1 target for more than 30 seconds; user may change it outside Eclipse.
Modified: branches/work_Ed/org.maemo.esbox.scratchbox.sb1/src/org/maemo/esbox/internal/scratchbox/sb1/core/Scratchbox1SDK.java
===================================================================
--- branches/work_Ed/org.maemo.esbox.scratchbox.sb1/src/org/maemo/esbox/internal/scratchbox/sb1/core/Scratchbox1SDK.java 2009-08-05 21:52:44 UTC (rev 1946)
+++ branches/work_Ed/org.maemo.esbox.scratchbox.sb1/src/org/maemo/esbox/internal/scratchbox/sb1/core/Scratchbox1SDK.java 2009-08-05 21:55:58 UTC (rev 1947)
@@ -66,6 +66,8 @@
private IPath sdkRoot;
+ private long nextTargetCheck;
+
public Scratchbox1SDK(IMachine machine, IPath installLocation,
IPreferenceProvider prefProvider) {
super(machine, installLocation, IScratchbox1SDK.NAME,
@@ -315,6 +317,15 @@
* @see org.maemo.mica.maemosdk.core.sdk.IScratchboxSDK#getCurrentTarget()
*/
public String getCurrentTarget() throws MicaException {
+ // We can't rely on the cache forever, since the user may be
+ // manually switching things outside. Making the user remember to
+ // refresh the SDK is not the right way to fix this. Just let the
+ // cache entry time out after a while.
+ if (System.currentTimeMillis() >= nextTargetCheck) {
+ getCache().set(CURRENT_TARGET_KEY, (String)null);
+ nextTargetCheck = System.currentTimeMillis() + 30 * 1000;
+ }
+
String currentTarget = (String) getCache().get(CURRENT_TARGET_KEY, String.class);
if (currentTarget != null && getTargets().contains(currentTarget))
return currentTarget;
More information about the Esbox-commits
mailing list