変換をアプリケーションの一部として実行するには、以下の例のように、変換 API を呼び出すことができます。IFile file = ResourcesPlugin.getWorkspace().getRoot().getFile(new Path("/MyWorkspace/MyConfig.tc"));
try {
ITransformConfig config = TransformConfigUtil.loadConfiguration(file);
IStatus status = TransformController.getInstance().execute(config, null, false, null);
}
catch (IOException e) {
// 構成ファイルを読み取れませんでした。
}
以下の例のように URL を指定することで、変換構成をロードすることもできます。 try {
URL url= new URL(platform:/plugin/myPluginID/myConfig.tc);
ITransformConfig config = TransformConfigUtil.loadConfiguration(url);
}
catch (MalformedURLException malURLEx) {
// 例外を処理します。
}
catch (IOException ioEx) {
// 例外を処理します。
}
以下の例のように、さまざまなプロトコルを使用する URL を指定できます。 - platform:/plugin/myPluginID/myConfig.tc
- http://myServer.myCompany.com/myConfig.tc
- ftp://myUsername:myPassword@myServer.myCompany.com/myConfig.tc
- jar:file:c:/myFolder/myJar.jar!/myConfig.tc
- file:c:/myFolder/myConfig.tc
|