public class PlatformModule extends Object
Modifier and Type | Field and Description |
---|---|
static String |
MODULE_ID
Module identifier.
|
Constructor and Description |
---|
PlatformModule() |
Modifier and Type | Method and Description |
---|---|
static Object |
adapt(Object source,
Class<?> target)
Adapt object to target type.
|
static void |
executeCommand(String commandId,
Map<String,String> parameters)
Execute a command from the command framework.
|
static Object |
getService(Class<?> type)
Get a platform service.
|
static String |
getSystemProperty(String key)
Get a system property value
|
static Object |
readPreferences(String node,
String key,
Object defaultValue)
Read a preferences value.
|
static Future |
runProcess(String name,
String[] args)
Run an external process.
|
static void |
writePreferences(String node,
String key,
Object value)
Set a preferences value.
|
public static final String MODULE_ID
public static Object adapt(Object source, Class<?> target)
source
- object to adapttarget
- target class to adapt tonull
public static Object getService(Class<?> type)
type
- service typenull
public static void executeCommand(String commandId, @ScriptParameter(defaultValue="org.eclipse.ease.modules.ScriptParameter.null") Map<String,String> parameters) throws ExecutionException, NotDefinedException, NotEnabledException, NotHandledException
commandId
- full id of the command to executeparameters
- command parametersExecutionException
NotDefinedException
NotEnabledException
NotHandledException
public static String getSystemProperty(String key)
key
- key to querypublic static Future runProcess(String name, @ScriptParameter(defaultValue="org.eclipse.ease.modules.ScriptParameter.null") String[] args)
Future
object is returned. Query the result for finished state, output
and error streams of the executed process.name
- program to run (with full path if necessary)args
- program argumentsFuture
object tracking the programpublic static Object readPreferences(String node, String key, @ScriptParameter(defaultValue="") Object defaultValue)
node
- node to read fromkey
- key name to read fromdefaultValue
- default value to use, if value is not set