From 09f1499af9a5e4e4e65ede41fd3b2800e368942a Mon Sep 17 00:00:00 2001 From: Max Schenkelberg Date: Thu, 20 Dec 2012 17:14:34 -0600 Subject: [PATCH] Issue #1329 Fixed nsharp issue that came about after changing when the renderable display sets itself on the descriptor. Change-Id: I1a5bcb4ba18a8dd73f8857c5bd4256529af57fde Former-commit-id: fabb9bbcffbdc546957f4215f543d398fba7b751 [formerly fabb9bbcffbdc546957f4215f543d398fba7b751 [formerly 4b62eb9cb14005f5f1a4ab660336d2c6e6db0592]] Former-commit-id: 7e3273db95935b9e321640b54b0dc373ee02ff9a Former-commit-id: 904270b99bbf4f48138ee8ea212cfa05976702b8 --- .../uf/common/localization/FileLocker.java | 23 ++++++++++--------- .../display/rsc/NsharpSkewTPaneResource.java | 3 +++ .../display/rsc/NsharpWitoPaneResource.java | 3 +++ 3 files changed, 18 insertions(+), 11 deletions(-) diff --git a/edexOsgi/com.raytheon.uf.common.localization/src/com/raytheon/uf/common/localization/FileLocker.java b/edexOsgi/com.raytheon.uf.common.localization/src/com/raytheon/uf/common/localization/FileLocker.java index 498b777666..09980ff99c 100644 --- a/edexOsgi/com.raytheon.uf.common.localization/src/com/raytheon/uf/common/localization/FileLocker.java +++ b/edexOsgi/com.raytheon.uf.common.localization/src/com/raytheon/uf/common/localization/FileLocker.java @@ -333,17 +333,17 @@ public class FileLocker { boolean gotLock = false; File lockFile = new File(parentDir, "." + file.getName() + "_LOCK"); try { - gotLock = lockFile.createNewFile(); - if (!gotLock) { - long waitInterval = 500; - long tryCount = MAX_WAIT / waitInterval; - for (int i = 0; !gotLock && i < tryCount; ++i) { - try { - Thread.sleep(waitInterval); - } catch (InterruptedException e) { - // Ignore - } - gotLock = lockFile.createNewFile(); + long waitInterval = 500; + long tryCount = MAX_WAIT / waitInterval; + long fileTime; + for (int i = 0; !gotLock && i < tryCount; ++i) { + gotLock = lockFile.createNewFile() + || ((fileTime = lockFile.lastModified()) > 0 && (System + .currentTimeMillis() - fileTime) > MAX_WAIT); + try { + Thread.sleep(waitInterval); + } catch (InterruptedException e) { + // Ignore } } } catch (IOException e) { @@ -355,6 +355,7 @@ public class FileLocker { + ", returning anyway"); Thread.dumpStack(); } + lockFile.setLastModified(System.currentTimeMillis()); lock.lockFile = lockFile; return gotLock; } diff --git a/ncep/gov.noaa.nws.ncep.ui.nsharp/src/gov/noaa/nws/ncep/ui/nsharp/display/rsc/NsharpSkewTPaneResource.java b/ncep/gov.noaa.nws.ncep.ui.nsharp/src/gov/noaa/nws/ncep/ui/nsharp/display/rsc/NsharpSkewTPaneResource.java index 865999c40d..4c362f48f4 100644 --- a/ncep/gov.noaa.nws.ncep.ui.nsharp/src/gov/noaa/nws/ncep/ui/nsharp/display/rsc/NsharpSkewTPaneResource.java +++ b/ncep/gov.noaa.nws.ncep.ui.nsharp/src/gov/noaa/nws/ncep/ui/nsharp/display/rsc/NsharpSkewTPaneResource.java @@ -2609,6 +2609,9 @@ public class NsharpSkewTPaneResource extends NsharpAbstractPaneResource{ return; IExtent ext = getDescriptor().getRenderableDisplay().getExtent(); ext.reset(); + if (ext.getWidth() == 0.0 || ext.getHeight() == 0.0) { + return; + } //System.out.println("skewtPane: handleResize"); this.rectangle = new Rectangle((int)ext.getMinX(), (int) ext.getMinY(), (int) ext.getWidth(), (int) ext.getHeight()); diff --git a/ncep/gov.noaa.nws.ncep.ui.nsharp/src/gov/noaa/nws/ncep/ui/nsharp/display/rsc/NsharpWitoPaneResource.java b/ncep/gov.noaa.nws.ncep.ui.nsharp/src/gov/noaa/nws/ncep/ui/nsharp/display/rsc/NsharpWitoPaneResource.java index 12ba133737..74ad6804ba 100644 --- a/ncep/gov.noaa.nws.ncep.ui.nsharp/src/gov/noaa/nws/ncep/ui/nsharp/display/rsc/NsharpWitoPaneResource.java +++ b/ncep/gov.noaa.nws.ncep.ui.nsharp/src/gov/noaa/nws/ncep/ui/nsharp/display/rsc/NsharpWitoPaneResource.java @@ -521,6 +521,9 @@ public class NsharpWitoPaneResource extends NsharpAbstractPaneResource{ super.handleResize(); IExtent ext = getDescriptor().getRenderableDisplay().getExtent(); ext.reset(); + if (ext.getWidth() == 0.0 || ext.getHeight() == 0.0) { + return; + } this.rectangle = new Rectangle((int)ext.getMinX(), (int) ext.getMinY(), (int) ext.getWidth(), (int) ext.getHeight()); world = new WGraphics(this.rectangle);