1.1 --- a/openide.util/src/org/netbeans/modules/openide/util/ActionsBridge.java Sat Jul 25 02:58:31 2009 +0400
1.2 +++ b/openide.util/src/org/netbeans/modules/openide/util/ActionsBridge.java Wed Jul 29 02:55:29 2009 +0400
1.3 @@ -61,6 +61,12 @@
1.4 protected abstract void invokeAction(Action action, ActionEvent ev);
1.5
1.6 public static void doPerformAction(CallableSystemAction action, final ActionsBridge.ActionRunnable r) {
1.7 + implPerformAction(action, r);
1.8 + }
1.9 + public static void doPerformAction(Action action, final ActionsBridge.ActionRunnable r) {
1.10 + implPerformAction(action, r);
1.11 + }
1.12 + private static void implPerformAction(Action action, final ActionsBridge.ActionRunnable r) {
1.13 assert java.awt.EventQueue.isDispatchThread() : "Action " + action.getClass().getName() +
1.14 " may not be invoked from the thread " + Thread.currentThread().getName() +
1.15 ", only the event queue: http://www.netbeans.org/download/4_1/javadoc/OpenAPIs/apichanges.html#actions-event-thread";
1.16 @@ -83,15 +89,27 @@
1.17 */
1.18 public static abstract class ActionRunnable implements Action {
1.19 final ActionEvent ev;
1.20 - final SystemAction action;
1.21 + final Action action;
1.22 final boolean async;
1.23
1.24 public ActionRunnable(ActionEvent ev, SystemAction action, boolean async) {
1.25 + this(ev, (Action)action, async);
1.26 + }
1.27 + public ActionRunnable(ActionEvent ev, Action action, boolean async) {
1.28 this.ev = ev;
1.29 this.action = action;
1.30 this.async = async;
1.31 }
1.32
1.33 + public static ActionRunnable create(ActionEvent ev, Action a, boolean async) {
1.34 + return new ActionRunnable(ev, a, async) {
1.35 + @Override
1.36 + protected void run() {
1.37 + action.actionPerformed(ev);
1.38 + }
1.39 + };
1.40 + }
1.41 +
1.42 public final boolean needsToBeSynchronous() {
1.43 return "waitFinished".equals(ev.getActionCommand()); // NOI18N
1.44 }
2.1 --- a/openide.util/src/org/openide/util/lookup/Lookups.java Sat Jul 25 02:58:31 2009 +0400
2.2 +++ b/openide.util/src/org/openide/util/lookup/Lookups.java Wed Jul 29 02:55:29 2009 +0400
2.3 @@ -301,7 +301,7 @@
2.4 return (Class<? extends T>)instance.getClass();
2.5 }
2.6
2.7 - public boolean equals(Object object) {
2.8 + public @Override boolean equals(Object object) {
2.9 if (object instanceof LookupItem) {
2.10 return instance == ((LookupItem) object).getInstance();
2.11 }
2.12 @@ -309,7 +309,7 @@
2.13 return false;
2.14 }
2.15
2.16 - public int hashCode() {
2.17 + public @Override int hashCode() {
2.18 return instance.hashCode();
2.19 }
2.20 }