public abstract class SafeRunnable extends Object implements ISafeRunnable
handleException
opens a dialog to show any
errors as they accumulate.
This may be executed on any thread.
Constructor and Description |
---|
SafeRunnable()
Creates a new instance of SafeRunnable with a default error message.
|
SafeRunnable(String message)
Creates a new instance of SafeRunnable with the given error message.
|
Modifier and Type | Method and Description |
---|---|
static boolean |
getIgnoreErrors()
Flag to avoid interactive error dialogs during automated testing.
|
static boolean |
getIgnoreErrors(boolean flag)
Deprecated.
use getIgnoreErrors()
|
static ISafeRunnableRunner |
getRunner()
Returns the safe runnable runner.
|
void |
handleException(Throwable e)
Handles an exception thrown by this runnable's
run
method. |
static void |
run(ISafeRunnable runnable)
Runs the given safe runnable using the safe runnable runner.
|
static void |
setIgnoreErrors(boolean flag)
Flag to avoid interactive error dialogs during automated testing.
|
static void |
setRunner(ISafeRunnableRunner runner)
Sets the safe runnable runner.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
run
public SafeRunnable()
public SafeRunnable(String message)
message
- the error message to usepublic void handleException(Throwable e)
ISafeRunnable
run
method. The processing done here should be specific to the
particular usecase for this runnable. Generalized exception
processing (e.g., logging in the platform's log) is done by the
SafeRunner
.
All exceptions from the ISafeRunnable.run()
method are passed to this method,
along with certain Error
types that are typically caused by
programming errors in the untrusted code being run.
handleException
in interface ISafeRunnable
e
- an exception which occurred during processing
the body of this runnable (i.e., in run()
)SafeRunner.run(ISafeRunnable)
@Deprecated public static boolean getIgnoreErrors(boolean flag)
flag
- public static boolean getIgnoreErrors()
public static void setIgnoreErrors(boolean flag)
flag
- set to true if errors should be ignoredpublic static ISafeRunnableRunner getRunner()
public static void setRunner(ISafeRunnableRunner runner)
runner
- the runner to set, or null
to reset to the
default runnerpublic static void run(ISafeRunnable runnable)
SafeRunnable.getRunner().run(runnable)
.runnable
- the runnable to run
Copyright (c) 2000, 2014 Eclipse Contributors and others. All rights reserved.Guidelines for using Eclipse APIs.