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: af67ccef2e [formerly 04cd8a3390e6615ec2c3abdbd5ba24652c6b54da]
Former-commit-id: d4ed7f5b06
This commit is contained in:
Nate Jensen 2012-12-21 13:41:12 -06:00 committed by Gerrit Code Review
commit b1972e519d
3 changed files with 18 additions and 11 deletions

View file

@ -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;
}

View file

@ -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());

View file

@ -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);