use of org.pentaho.ui.xul.swt.SwtXulLoader in project pdi-dataservice-server-plugin by pentaho.
the class DataServiceTestDialog method initXul.
private Document initXul(Composite parent) throws KettleException {
try {
SwtXulLoader swtLoader = new KettleXulLoader();
swtLoader.setOuterContext(parent);
swtLoader.registerClassLoader(getClass().getClassLoader());
XulDomContainer container = swtLoader.loadXul(XUL_PATH, resourceBundle);
container.addEventHandler(dataServiceTestController);
final XulRunner runner = new SwtXulRunner();
runner.addContainer(container);
runner.initialize();
return container.getDocumentRoot();
} catch (XulException xulException) {
throw new KettleException("Failed to initialize DataServicesTestDialog.", xulException);
}
}
use of org.pentaho.ui.xul.swt.SwtXulLoader in project pentaho-kettle by pentaho.
the class PurRepositoryDialog method open.
public RepositoryMeta open(final MODE mode) {
try {
SwtXulLoader swtLoader = new SwtXulLoader();
swtLoader.setOuterContext(parent);
swtLoader.registerClassLoader(getClass().getClassLoader());
container = // $NON-NLS-1$
swtLoader.loadXul("org/pentaho/di/ui/repository/pur/xul/pur-repository-config-dialog.xul", resourceBundle);
final XulRunner runner = new SwtXulRunner();
runner.addContainer(container);
parent.addDisposeListener(new DisposeListener() {
public void widgetDisposed(DisposeEvent arg0) {
hide();
}
});
repositoryConfigController.setMessages(resourceBundle);
repositoryConfigController.setRepositoryMeta(repositoryMeta);
repositoryConfigController.setCallback(new IRepositoryConfigDialogCallback() {
public void onSuccess(PurRepositoryMeta meta) {
// If repository does not have a name then send back a null repository meta
if (meta.getName() != null) {
// already exist
if (mode == MODE.ADD) {
if (masterRepositoriesMeta.searchRepository(meta.getName()) == null) {
repositoryMeta = meta;
hide();
} else {
displayRepositoryAlreadyExistMessage(meta.getName());
}
} else {
if (masterRepositoryName.equals(meta.getName())) {
repositoryMeta = meta;
hide();
} else if (masterRepositoriesMeta.searchRepository(meta.getName()) == null) {
repositoryMeta = meta;
hide();
} else {
displayRepositoryAlreadyExistMessage(meta.getName());
}
}
}
}
public void onError(Throwable t) {
SpoonFactory.getInstance().messageBox(t.getLocalizedMessage(), resourceBundle.getString("RepositoryConfigDialog.InitializationFailed"), false, // $NON-NLS-1$
Const.ERROR);
// $NON-NLS-1$
log.error(resourceBundle.getString("RepositoryConfigDialog.ErrorStartingXulApplication"), t);
}
public void onCancel() {
repositoryMeta = null;
hide();
}
});
container.addEventHandler(repositoryConfigController);
try {
runner.initialize();
show();
} catch (XulException e) {
SpoonFactory.getInstance().messageBox(e.getLocalizedMessage(), resourceBundle.getString("RepositoryConfigDialog.InitializationFailed"), false, // $NON-NLS-1$
Const.ERROR);
// $NON-NLS-1$
log.error(resourceBundle.getString("RepositoryConfigDialog.ErrorStartingXulApplication"), e);
}
} catch (XulException e) {
// $NON-NLS-1$
log.error(resourceBundle.getString("RepositoryConfigDialog.ErrorStartingXulApplication"), e);
}
return repositoryMeta;
}
Aggregations