Merge "Issue #1329 Fixed nsharp issue that came about after changing when the renderable display sets itself on the descriptor." into development

Former-commit-id: c12b081dd5 [formerly af67ccef2e] [formerly c12b081dd5 [formerly af67ccef2e] [formerly d4ed7f5b06 [formerly 04cd8a3390e6615ec2c3abdbd5ba24652c6b54da]]]
Former-commit-id: d4ed7f5b06
Former-commit-id: 10b4bdf1cb [formerly b1972e519d]
Former-commit-id: f7ca60ad57
This commit is contained in:
Nate Jensen 2012-12-21 13:41:12 -06:00 committed by Gerrit Code Review
commit 0b60945017
3 changed files with 18 additions and 11 deletions

View file

@ -333,17 +333,17 @@ public class FileLocker {
boolean gotLock = false; boolean gotLock = false;
File lockFile = new File(parentDir, "." + file.getName() + "_LOCK"); File lockFile = new File(parentDir, "." + file.getName() + "_LOCK");
try { try {
gotLock = lockFile.createNewFile(); long waitInterval = 500;
if (!gotLock) { long tryCount = MAX_WAIT / waitInterval;
long waitInterval = 500; long fileTime;
long tryCount = MAX_WAIT / waitInterval; for (int i = 0; !gotLock && i < tryCount; ++i) {
for (int i = 0; !gotLock && i < tryCount; ++i) { gotLock = lockFile.createNewFile()
try { || ((fileTime = lockFile.lastModified()) > 0 && (System
Thread.sleep(waitInterval); .currentTimeMillis() - fileTime) > MAX_WAIT);
} catch (InterruptedException e) { try {
// Ignore Thread.sleep(waitInterval);
} } catch (InterruptedException e) {
gotLock = lockFile.createNewFile(); // Ignore
} }
} }
} catch (IOException e) { } catch (IOException e) {
@ -355,6 +355,7 @@ public class FileLocker {
+ ", returning anyway"); + ", returning anyway");
Thread.dumpStack(); Thread.dumpStack();
} }
lockFile.setLastModified(System.currentTimeMillis());
lock.lockFile = lockFile; lock.lockFile = lockFile;
return gotLock; return gotLock;
} }

View file

@ -2609,6 +2609,9 @@ public class NsharpSkewTPaneResource extends NsharpAbstractPaneResource{
return; return;
IExtent ext = getDescriptor().getRenderableDisplay().getExtent(); IExtent ext = getDescriptor().getRenderableDisplay().getExtent();
ext.reset(); ext.reset();
if (ext.getWidth() == 0.0 || ext.getHeight() == 0.0) {
return;
}
//System.out.println("skewtPane: handleResize"); //System.out.println("skewtPane: handleResize");
this.rectangle = new Rectangle((int)ext.getMinX(), (int) ext.getMinY(), this.rectangle = new Rectangle((int)ext.getMinX(), (int) ext.getMinY(),
(int) ext.getWidth(), (int) ext.getHeight()); (int) ext.getWidth(), (int) ext.getHeight());

View file

@ -521,6 +521,9 @@ public class NsharpWitoPaneResource extends NsharpAbstractPaneResource{
super.handleResize(); super.handleResize();
IExtent ext = getDescriptor().getRenderableDisplay().getExtent(); IExtent ext = getDescriptor().getRenderableDisplay().getExtent();
ext.reset(); ext.reset();
if (ext.getWidth() == 0.0 || ext.getHeight() == 0.0) {
return;
}
this.rectangle = new Rectangle((int)ext.getMinX(), (int) ext.getMinY(), this.rectangle = new Rectangle((int)ext.getMinX(), (int) ext.getMinY(),
(int) ext.getWidth(), (int) ext.getHeight()); (int) ext.getWidth(), (int) ext.getHeight());
world = new WGraphics(this.rectangle); world = new WGraphics(this.rectangle);