use of org.pentaho.di.ui.core.dialog.ErrorDialog in project pentaho-kettle by pentaho.
the class LDAPOutputDialog method ok.
private void ok() {
if (Utils.isEmpty(wStepname.getText())) {
return;
}
stepname = wStepname.getText();
try {
getInfo(input);
} catch (KettleException e) {
new ErrorDialog(shell, BaseMessages.getString(PKG, "LDAPOutputDialog.ErrorParsingData.DialogTitle"), BaseMessages.getString(PKG, "LDAPOutputDialog.ErrorParsingData.DialogMessage"), e);
}
dispose();
}
use of org.pentaho.di.ui.core.dialog.ErrorDialog in project pentaho-kettle by pentaho.
the class XMLInputSaxDialog method get.
//
private void get() {
try {
XMLInputSaxMeta meta = new XMLInputSaxMeta();
getInfo(meta);
// OK, let's try to walk through the complete tree
List<XMLInputSaxField> fields = new ArrayList<XMLInputSaxField>();
// Keep the list of positions
String[] filePaths = meta.getFilePaths(transMeta);
if (meta.getInputPosition().length == 0) {
// error
MessageBox mb = new MessageBox(shell, SWT.OK | SWT.ICON_ERROR);
mb.setMessage(BaseMessages.getString(PKG, "XMLInputSaxDialog.Dialog.NoElements.Message"));
mb.setText(BaseMessages.getString(PKG, "XMLInputSaxDialog.Dialog.NoElements.Title"));
mb.open();
return;
}
for (int f = 0; f < filePaths.length; f++) {
XMLInputSaxFieldRetriever fieldRetreiver = new XMLInputSaxFieldRetriever(log, filePaths[f], meta);
fields = fieldRetreiver.getFields();
// add the values to the grid...
for (int i = 0; i < fields.size(); i++) {
XMLInputSaxField iF = fields.get(i);
TableItem item = new TableItem(wFields.table, SWT.NONE);
item.setText(1, iF.getName());
item.setText(2, iF.getTypeDesc());
item.setText(11, iF.getFieldPositionsCode(meta.getInputPosition().length));
}
wFields.removeEmptyRows();
wFields.setRowNums();
wFields.optWidth(true);
}
} catch (KettleException e) {
new ErrorDialog(shell, BaseMessages.getString(PKG, "XMLInputSaxDialog.Dialog.ErrorParsingInputData.Title"), BaseMessages.getString(PKG, "XMLInputSaxDialog.Dialog.ErrorParsingInputData.Message"), e);
System.out.println(e.getMessage());
}
}
use of org.pentaho.di.ui.core.dialog.ErrorDialog in project pentaho-kettle by pentaho.
the class XMLInputSaxDialog method preview.
// Preview the data
private void preview() {
try {
// Create the XML input step
XMLInputSaxMeta oneMeta = new XMLInputSaxMeta();
getInfo(oneMeta);
TransMeta previewMeta = TransPreviewFactory.generatePreviewTransformation(transMeta, oneMeta, wStepname.getText());
EnterNumberDialog numberDialog = new EnterNumberDialog(shell, props.getDefaultPreviewSize(), BaseMessages.getString(PKG, "XMLInputSaxDialog.Dialog.EnterPreviewSize.Title"), BaseMessages.getString(PKG, "XMLInputSaxDialog.Dialog.EnterPreviewSize.Message"));
int previewSize = numberDialog.open();
if (previewSize > 0) {
TransPreviewProgressDialog progressDialog = new TransPreviewProgressDialog(shell, previewMeta, new String[] { wStepname.getText() }, new int[] { previewSize });
progressDialog.open();
if (!progressDialog.isCancelled()) {
PreviewRowsDialog prd = new PreviewRowsDialog(shell, transMeta, SWT.NONE, wStepname.getText(), progressDialog.getPreviewRowsMeta(wStepname.getText()), progressDialog.getPreviewRows(wStepname.getText()));
prd.open();
}
}
} catch (KettleException e) {
new ErrorDialog(shell, BaseMessages.getString(PKG, "XMLInputSaxDialog.Dialog.ErrorDisplayingPreviewData.Title"), BaseMessages.getString(PKG, "XMLInputSaxDialog.Dialog.ErrorDisplayingPreviewData.Message"), e);
}
}
use of org.pentaho.di.ui.core.dialog.ErrorDialog in project pentaho-kettle by pentaho.
the class SelectObjectDialog method open.
@SuppressWarnings("deprecation")
public String open() {
Shell parent = getParent();
dircolor = GUIResource.getInstance().getColorDirectory();
shell = new Shell(parent, SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL | SWT.SHEET | SWT.RESIZE | SWT.MIN | SWT.MAX);
props.setLook(shell);
shell.setImage(GUIResource.getInstance().getImageSpoon());
FormLayout formLayout = new FormLayout();
formLayout.marginWidth = Const.FORM_MARGIN;
formLayout.marginHeight = Const.FORM_MARGIN;
shell.setLayout(formLayout);
shell.setText(shellText);
int margin = Const.MARGIN;
ToolBar treeTb = new ToolBar(shell, SWT.HORIZONTAL | SWT.FLAT);
props.setLook(treeTb);
wfilter = new ToolItem(treeTb, SWT.SEPARATOR);
searchText = new Text(treeTb, SWT.SEARCH | SWT.CANCEL);
searchText.setToolTipText(BaseMessages.getString(PKG, "RepositoryExplorerDialog.Search.FilterString.ToolTip"));
wfilter.setControl(searchText);
wfilter.setWidth(100);
wbRegex = new ToolItem(treeTb, SWT.CHECK);
wbRegex.setImage(GUIResource.getInstance().getImageRegexSmall());
wbRegex.setToolTipText(BaseMessages.getString(PKG, "RepositoryExplorerDialog.Search.UseRegex"));
goSearch = new ToolItem(treeTb, SWT.PUSH);
goSearch.setImage(GUIResource.getInstance().getImageSearchSmall());
goSearch.setToolTipText(BaseMessages.getString(PKG, "RepositoryExplorerDialog.Search.Run"));
expandAll = new ToolItem(treeTb, SWT.PUSH);
expandAll.setImage(GUIResource.getInstance().getImageExpandAll());
collapseAll = new ToolItem(treeTb, SWT.PUSH);
collapseAll.setImage(GUIResource.getInstance().getImageCollapseAll());
fdexpandAll = new FormData();
fdexpandAll.right = new FormAttachment(100, -margin);
fdexpandAll.top = new FormAttachment(0, margin);
treeTb.setLayoutData(fdexpandAll);
// From step line
wlTree = new Label(shell, SWT.NONE);
wlTree.setText(lineText);
props.setLook(wlTree);
fdlTree = new FormData();
fdlTree.left = new FormAttachment(0, 0);
fdlTree.top = new FormAttachment(0, margin);
wlTree.setLayoutData(fdlTree);
wTree = new Tree(shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
wTree.setHeaderVisible(true);
props.setLook(wTree);
// Add some columns to it as well...
nameColumn = new TreeColumn(wTree, SWT.LEFT);
nameColumn.setText(BaseMessages.getString(PKG, "RepositoryExplorerDialog.Column.Name"));
nameColumn.setWidth(350);
nameColumn.addListener(SWT.Selection, new Listener() {
public void handleEvent(Event e) {
setSort(0);
}
});
// No sorting on the type column just yet.
typeColumn = new TreeColumn(wTree, SWT.LEFT);
typeColumn.setText(BaseMessages.getString(PKG, "RepositoryExplorerDialog.Column.Type"));
typeColumn.setWidth(100);
typeColumn.addListener(SWT.Selection, new Listener() {
public void handleEvent(Event e) {
setSort(1);
}
});
userColumn = new TreeColumn(wTree, SWT.LEFT);
userColumn.setText(BaseMessages.getString(PKG, "RepositoryExplorerDialog.Column.User"));
userColumn.setWidth(100);
userColumn.addListener(SWT.Selection, new Listener() {
public void handleEvent(Event e) {
setSort(2);
}
});
changedColumn = new TreeColumn(wTree, SWT.LEFT);
changedColumn.setText(BaseMessages.getString(PKG, "RepositoryExplorerDialog.Column.Changed"));
changedColumn.setWidth(120);
changedColumn.addListener(SWT.Selection, new Listener() {
public void handleEvent(Event e) {
setSort(3);
}
});
descriptionColumn = new TreeColumn(wTree, SWT.LEFT);
descriptionColumn.setText(BaseMessages.getString(PKG, "RepositoryExplorerDialog.Column.Description"));
descriptionColumn.setWidth(120);
descriptionColumn.addListener(SWT.Selection, new Listener() {
public void handleEvent(Event e) {
setSort(4);
}
});
props.setLook(wTree);
fdTree = new FormData();
fdTree.left = new FormAttachment(0, 0);
fdTree.right = new FormAttachment(100, 0);
fdTree.top = new FormAttachment(treeTb, margin);
fdTree.bottom = new FormAttachment(100, -30);
wTree.setLayoutData(fdTree);
// Some buttons
wOK = new Button(shell, SWT.PUSH);
wOK.setText(BaseMessages.getString(PKG, "System.Button.OK"));
lsOK = new Listener() {
public void handleEvent(Event e) {
ok();
}
};
wOK.addListener(SWT.Selection, lsOK);
wOK.setEnabled(false);
wCancel = new Button(shell, SWT.PUSH);
wCancel.setText(BaseMessages.getString(PKG, "System.Button.Cancel"));
lsCancel = new Listener() {
public void handleEvent(Event e) {
cancel();
}
};
wCancel.addListener(SWT.Selection, lsCancel);
BaseStepDialog.positionBottomButtons(shell, new Button[] { wOK, wCancel }, margin, null);
// Add listeners
lsDef = new SelectionAdapter() {
public void widgetDefaultSelected(SelectionEvent e) {
ok();
}
};
wTree.addSelectionListener(lsDef);
wTree.addKeyListener(new KeyAdapter() {
public void keyPressed(KeyEvent e) {
if (e.character == SWT.CR) {
ok();
}
}
});
wTree.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
if (wTree.getSelection().length > 0) {
wOK.setEnabled(!Boolean.TRUE.equals(wTree.getSelection()[0].getData("isFolder")));
}
}
});
expandAll.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
expandAllItems(wTree.getItems(), true);
}
});
collapseAll.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
expandAllItems(wTree.getItems(), false);
}
});
goSearch.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
updateFilter();
}
});
searchText.addSelectionListener(new SelectionAdapter() {
public void widgetDefaultSelected(SelectionEvent e) {
updateFilter();
}
});
// Detect [X] or ALT-F4 or something that kills this window...
shell.addShellListener(new ShellAdapter() {
public void shellClosed(ShellEvent e) {
cancel();
}
});
try {
if (rep instanceof RepositoryExtended) {
RepositoryExtended repositoryExtended = (RepositoryExtended) this.rep;
directoryTree = repositoryExtended.loadRepositoryDirectoryTree("/", "*.kjb|*.ktr", -1, BooleanUtils.isTrue(repositoryExtended.getUserInfo().isAdmin()), true, false);
} else {
directoryTree = this.rep.loadRepositoryDirectoryTree();
}
} catch (KettleException e) {
new ErrorDialog(shell, BaseMessages.getString(PKG, "SelectObjectDialog.Dialog.ErrorRefreshingDirectoryTree.Title"), BaseMessages.getString(PKG, "SelectObjectDialog.Dialog.ErrorRefreshingDirectoryTree.Message"), e);
}
// catch()
getData();
wTree.setFocus();
BaseStepDialog.setSize(shell);
shell.open();
while (!shell.isDisposed()) {
if (!shell.getDisplay().readAndDispatch()) {
shell.getDisplay().sleep();
}
}
return objectName;
}
use of org.pentaho.di.ui.core.dialog.ErrorDialog in project pentaho-kettle by pentaho.
the class PartitionsController method removePartition.
public void removePartition() {
String partitionSchemaName = "";
try {
Collection<UIPartition> partitions = partitionsTable.getSelectedItems();
if (partitions != null && !partitions.isEmpty()) {
for (Object obj : partitions) {
if (obj != null && obj instanceof UIPartition) {
UIPartition partition = (UIPartition) obj;
PartitionSchema partitionSchema = partition.getPartitionSchema();
partitionSchemaName = partitionSchema.getName();
// Make sure the partition to delete exists in the repository
ObjectId partitionId = repository.getPartitionSchemaID(partitionSchema.getName());
if (partitionId == null) {
MessageBox mb = new MessageBox(shell, SWT.ICON_ERROR | SWT.OK);
mb.setMessage(BaseMessages.getString(PKG, "RepositoryExplorerDialog.Partition.DoesNotExists.Message", partitionSchemaName));
mb.setText(BaseMessages.getString(PKG, "RepositoryExplorerDialog.Partition.Delete.Title"));
mb.open();
} else {
repository.deletePartitionSchema(partitionId);
if (mainController != null && mainController.getSharedObjectSyncUtil() != null) {
mainController.getSharedObjectSyncUtil().deletePartitionSchema(partitionSchema);
}
}
}
}
} else {
MessageBox mb = new MessageBox(shell, SWT.ICON_ERROR | SWT.OK);
mb.setMessage(BaseMessages.getString(PKG, "RepositoryExplorerDialog.Partition.NoItemSelected.Message"));
mb.setText(BaseMessages.getString(PKG, "RepositoryExplorerDialog.Partition.Delete.Title"));
mb.open();
}
} catch (KettleException e) {
if (mainController == null || !mainController.handleLostRepository(e)) {
new ErrorDialog(shell, BaseMessages.getString(PKG, "RepositoryExplorerDialog.Partition.Delete.Title"), BaseMessages.getString(PKG, "RepositoryExplorerDialog.Partition.Delete.UnexpectedError.Message") + partitionSchemaName + "]", e);
}
} finally {
refreshPartitions();
}
}
Aggregations