X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=src%2Forg%2Fxwt%2FTrap.java;h=770ad51b35d1d6d032d3034db72fd11138d744ad;hb=f2eb7d5128e23542ce51973714eeb41ca1d37a6d;hp=d2b39541179a4bb509272828cd2dec64af0c4bf0;hpb=6242c991f365dbd67eba62ecfa5df769a83fcbc6;p=org.ibex.core.git
diff --git a/src/org/xwt/Trap.java b/src/org/xwt/Trap.java
index d2b3954..770ad51 100644
--- a/src/org/xwt/Trap.java
+++ b/src/org/xwt/Trap.java
@@ -1,9 +1,9 @@
// Copyright 2002 Adam Megacz, see the COPYING file for licensing [GPL]
package org.xwt;
-import org.xwt.util.*;
import java.util.*;
-import org.mozilla.javascript.*;
+import org.xwt.js.*;
+import org.xwt.util.*;
/**
* This class encapsulates a single trap placed on a given node. The
@@ -16,7 +16,7 @@ public class Trap {
// Static Data //////////////////////////////////////////////////////////////
/** a vector of weak references to all instances of Trap; used for retheming */
- private static Vec allTraps = new Vec(1000);
+ private static Hashtable allTraps = new Hashtable(1000);
/** List of properties that cannot be trapped */
private static final Hash PROHIBITED = new Hash(120, 3);
@@ -32,16 +32,19 @@ public class Trap {
for(int i=0; i
b. Used for retheming */
- public static void removeAllTrapsByBox(Box b) {
- for(int i=0; i 0 && !isreadtrap && !tc.putCascadeHappened) cascadeFunction.call(null, null, null, arg);
+ if (args.length() > 0 && !isreadtrap && !tc.putCascadeHappened) cascadeFunction._call(args, f);
return ret;
- } catch (EcmaError e) {
- if (Log.on) Log.log(this, "WARNING: uncaught interpreter exception: " + e.getMessage());
- if (Log.on) Log.log(this, " thrown from within trap '" + name + "' at " + e.getSourceName() + ":" + e.getLineNumber());
- } catch (JavaScriptException e) {
- if (Log.on) Log.log(this, "WARNING: uncaught ecmascript exception: " + e.getMessage());
- if (Log.on) Log.log(this, " thrown from within trap '" + name + "' at " + e.sourceFile + ":" + e.line);
+ } catch (JS.Exn e) {
+ if (Log.on) Log.log(this, e);
+
} finally {
// restore the thread-locals
tc.putCascadeHappened = save_putCascadeHappened;
@@ -220,11 +212,7 @@ public class Trap {
}
if (trapee.surface != null && !trapee.is_trapped("KeyPressed") && !trapee.is_trapped("KeyReleased"))
trapee.surface.keywatchers.removeElement(trapee);
- if (allTraps.size() == 1) allTraps.setSize(0);
- else {
- allTraps.setElementAt(allTraps.elementAt(allTraps.size() - 1), indexInAllTraps);
- allTraps.setSize(allTraps.size() - 1);
- }
+ allTraps.remove(myWeak);
}
/** per-thread storage for Traps */
@@ -250,3 +238,4 @@ public class Trap {
}
}
+