Saros
Distributed Collaborative Editing and Distributed Party Programming
de.fu_berlin.inf.dpp.ui.util.SWTUtils Class Reference

List of all members.

Classes

class  CallableResult< T >

Static Public Member Functions

static boolean openInternalBrowser (String urlString, String title)
static boolean openExternalBrowser (String urlString)
static boolean isSWT ()
static IViewPart findView (String id)
static void runSafeSWTAsync (final Logger log, final Runnable runnable)
static< T > T runSWTSync (final Callable< T > callable) throws Exception
static void runSafeSWTSync (final Logger log, final Runnable runnable)
static Display getDisplay ()
static Shell getShell ()

Member Function Documentation

static IViewPart de.fu_berlin.inf.dpp.ui.util.SWTUtils.findView ( String  id) [static]

Needs to be called from the SWT-UI thread, otherwise null is returned.

static Display de.fu_berlin.inf.dpp.ui.util.SWTUtils.getDisplay ( ) [static]

Returns the display of the current workbench. Should be used instead of Display#getDefault().

See also:
IWorkbench.getDisplay()
Returns:
the display of the current workbench
static Shell de.fu_berlin.inf.dpp.ui.util.SWTUtils.getShell ( ) [static]

Tries to get a Shell shell} that is centered on the shells of the current Eclipse application.

Should be used instead of Display#getActiveShell().

Returns:
a shell centered on top of the current application or null if no such shell exists or the default display is disposed
static boolean de.fu_berlin.inf.dpp.ui.util.SWTUtils.isSWT ( ) [static]

Crude check whether we are on the SWT thread

static boolean de.fu_berlin.inf.dpp.ui.util.SWTUtils.openExternalBrowser ( String  urlString) [static]

Tries to open the given URL string in the default external browser. The Desktop API is deliberately not used for this because it only works with Java 1.6.

Parameters:
urlStringthe URL to show as a String
Returns:
true if the browser could be opened, false otherwise
static boolean de.fu_berlin.inf.dpp.ui.util.SWTUtils.openInternalBrowser ( String  urlString,
String  title 
) [static]

Tries to open the given URL string in Eclipse's internal browser. However if the user specified in the preferences to use an external browser instead, the external browser is tried to open.

Parameters:
urlStringthe URL to show as a String
titlea string displayed in the browsers title area
Returns:
true if the browser could be opened, false otherwise
static void de.fu_berlin.inf.dpp.ui.util.SWTUtils.runSafeSWTAsync ( final Logger  log,
final Runnable  runnable 
) [static]

Run the given runnable in the SWT-Thread and log any RuntimeExceptions to the given log.

static void de.fu_berlin.inf.dpp.ui.util.SWTUtils.runSafeSWTSync ( final Logger  log,
final Runnable  runnable 
) [static]

Run the given runnable in the SWT-Thread, log any RuntimeExceptions to the given log and block until the runnable returns.

static <T> T de.fu_berlin.inf.dpp.ui.util.SWTUtils.runSWTSync ( final Callable< T >  callable) throws Exception [static]

Runs the given callable in the SWT Thread returning the result of the computation or throwing an exception that was thrown by the callable.

 All Classes Namespaces Files Functions Variables Enumerations