use of org.pentaho.ui.xul.XulException in project pentaho-kettle by pentaho.
the class BaseStepGenericXulDialog method showMessage.
public void showMessage(final String message, final String title) {
try {
final XulMessageBox msg = (XulMessageBox) document.createElement("messagebox");
msg.setModalParent(modalParent);
msg.setTitle(title);
msg.setMessage(message);
msg.open();
} catch (XulException e) {
log.logError("Error displaying message: {0}", message);
}
}
use of org.pentaho.ui.xul.XulException in project pentaho-kettle by pentaho.
the class BaseStepGenericXulDialog method showPromptMessage.
public int showPromptMessage(final String message, final String title, Object[] buttons) {
try {
final XulMessageBox msg = (XulMessageBox) document.createElement("messagebox");
msg.setModalParent(modalParent);
msg.setTitle(title);
msg.setMessage(message);
msg.setButtons(buttons);
return msg.open();
} catch (XulException e) {
log.logError("Error displaying message: {0}", message);
}
return -1;
}
use of org.pentaho.ui.xul.XulException 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;
}
use of org.pentaho.ui.xul.XulException in project pentaho-kettle by pentaho.
the class AbsController method initializeLogicalRolesUI.
/**
* Initialized the ActionPermissions UI with all the possible values from LogicalRoles enum
*/
private void initializeLogicalRolesUI() {
try {
Map<String, String> logicalRoles = ((IAbsSecurityManager) service).getAllLogicalRoles(GlobalMessages.getLocale().getDisplayName());
for (Entry<String, String> logicalRole : logicalRoles.entrySet()) {
XulCheckbox logicalRoleCheckbox;
// $NON-NLS-1$
logicalRoleCheckbox = (XulCheckbox) document.createElement("checkbox");
logicalRoleCheckbox.setLabel(logicalRole.getValue());
logicalRoleCheckbox.setId(logicalRole.getValue());
// $NON-NLS-1$
logicalRoleCheckbox.setCommand("iSecurityController.updateRoleActionPermission()");
logicalRoleCheckbox.setFlex(1);
logicalRoleCheckbox.setDisabled(true);
logicalRolesBox.addChild(logicalRoleCheckbox);
logicalRoleChecboxMap.put(logicalRoleCheckbox, logicalRole.getKey());
bf.setBindingType(Binding.Type.ONE_WAY);
// $NON-NLS-1$ //$NON-NLS-2$
bf.createBinding(roleListBox, "selectedIndex", logicalRoleCheckbox, "disabled", buttonConverter);
}
} catch (XulException xe) {
} catch (KettleException xe) {
}
}
use of org.pentaho.ui.xul.XulException in project pentaho-kettle by pentaho.
the class TrashBrowseController method renameRepositoryObject.
@Override
protected void renameRepositoryObject(final UIRepositoryObject repoObject) throws XulException {
// final Document doc = document;
XulPromptBox prompt = promptForName(repoObject);
prompt.addDialogCallback(new XulDialogCallback<String>() {
public void onClose(XulComponent component, Status status, String value) {
if (status == Status.ACCEPT) {
final String newName = value;
try {
repoObject.setName(newName);
} catch (KettleException ke) {
if (ke.getCause() instanceof RepositoryObjectAccessException) {
moveDeletePrompt(ke, repoObject, new XulDialogCallback<Object>() {
public void onClose(XulComponent sender, Status returnCode, Object retVal) {
if (returnCode == Status.ACCEPT) {
try {
((UIEERepositoryDirectory) repoObject).setName(newName, true);
} catch (Exception e) {
if (mainController == null || !mainController.handleLostRepository(e)) {
displayExceptionMessage(BaseMessages.getString(PKG, e.getLocalizedMessage()));
}
}
}
}
public void onError(XulComponent sender, Throwable t) {
if (mainController == null || !mainController.handleLostRepository(t)) {
throw new RuntimeException(t);
}
}
});
} else {
if (mainController == null || !mainController.handleLostRepository(ke)) {
throw new RuntimeException(ke);
}
}
} catch (Exception e) {
if (mainController == null || !mainController.handleLostRepository(e)) {
// convert to runtime exception so it bubbles up through the UI
throw new RuntimeException(e);
}
}
}
}
public void onError(XulComponent component, Throwable err) {
if (mainController == null || !mainController.handleLostRepository(err)) {
throw new RuntimeException(err);
}
}
});
prompt.open();
}
Aggregations