1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 package com.sun.star.script.framework.provider;
25 
26 import javax.swing.SwingUtilities;
27 
28 // On Mac OS X, AWT/Swing must not be accessed from the AppKit thread, so call
29 // SwingUtilities.invokeLater always on a fresh thread to avoid that problem
30 // (also, the current thread must not wait for that fresh thread to terminate,
31 // as that would cause a deadlock if this thread is the AppKit thread):
32 public final class SwingInvocation {
invoke(final Runnable doRun)33     public static void invoke(final Runnable doRun) {
34         new Thread("SwingInvocation") {
35             public void run() { SwingUtilities.invokeLater(doRun); }
36         }.start();
37     }
38 
SwingInvocation()39     private SwingInvocation() {}
40 }
41