javauis/eswt_qt/org.eclipse.swt/Eclipse_SWT_PI/common_j2se/org/eclipse/swt/internal/qt/UIThreadHandOverManager.java
changeset 80 d6dafc5d983f
equal deleted inserted replaced
78:71ad690e91f5 80:d6dafc5d983f
       
     1 /*******************************************************************************
       
     2  * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
       
     3  * All rights reserved. This program and the accompanying materials
       
     4  * are made available under the terms of the Eclipse Public License v1.0
       
     5  * which accompanies this distribution, and is available at
       
     6  * http://www.eclipse.org/legal/epl-v10.html
       
     7  *
       
     8  * Contributors:
       
     9  *     Nokia Corporation - initial implementation
       
    10  *******************************************************************************/
       
    11 
       
    12 package org.eclipse.swt.internal.qt;
       
    13 
       
    14 import org.eclipse.swt.internal.qt.midp.UIThreadLauncher;
       
    15 import org.eclipse.swt.widgets.Display;
       
    16 import org.eclipse.swt.widgets.Internal_PackageSupport;
       
    17 import org.eclipse.swt.widgets.Shell;
       
    18 
       
    19 /**
       
    20  * A class that manages the UI thread hand-over from the internal UI event 
       
    21  * loop to the application. 
       
    22  */
       
    23 public final class UIThreadHandOverManager {
       
    24 
       
    25     /**
       
    26      * Called indirectly by the application when it's requesting the UI thread. 
       
    27      * Application will pass a Runnable as a parameter and expects it to get called
       
    28      * in the UI thread. 
       
    29      * 
       
    30      * @param runnable
       
    31      *            The Runnable to call in the UI thread.
       
    32      * @return True if obtaining the UI thread was successful and the runnable
       
    33      *         will be called.
       
    34      */
       
    35     public static boolean startInUIThread(Runnable runnable) {
       
    36         if(!UIThreadLauncher.startInUIThread(runnable)) {
       
    37             return false;
       
    38         }
       
    39         
       
    40         return true;
       
    41     }
       
    42 }