use of org.pentaho.di.ui.core.dialog.ShowMessageDialog in project pentaho-kettle by pentaho.
the class PurRepositoryRevisionBrowserDialog method open.
public String open() {
try {
props.setLook(shell);
FormLayout formLayout = new FormLayout();
formLayout.marginWidth = Const.FORM_MARGIN;
formLayout.marginHeight = Const.FORM_MARGIN;
shell.setLayout(formLayout);
shell.setImage(GUIResource.getInstance().getImageVersionBrowser());
// int middle = props.getMiddlePct();
int margin = Const.MARGIN;
revisions = revisionService.getRevisions(element);
// Mmm, if we don't get any rows in the buffer: show a dialog box.
if (revisions == null || revisions.size() == 0) {
ShowMessageDialog dialog = new ShowMessageDialog(shell, SWT.OK | SWT.ICON_WARNING, BaseMessages.getString(PKG, "PurRepositoryRevisionBrowserDialog.NoRevisions.Text"), BaseMessages.getString(PKG, "PurRepositoryRevisionBrowserDialog.NoRevisions.Message"));
dialog.open();
shell.dispose();
return null;
}
wlFields = new Label(shell, SWT.LEFT);
wlFields.setText("Revision history of " + elementDescription);
props.setLook(wlFields);
fdlFields = new FormData();
fdlFields.left = new FormAttachment(0, 0);
fdlFields.right = new FormAttachment(100, 0);
fdlFields.top = new FormAttachment(0, margin);
wlFields.setLayoutData(fdlFields);
ColumnInfo[] colinf = new ColumnInfo[] { new ColumnInfo(BaseMessages.getString(PKG, "PurRepositoryRevisionBrowserDialog.Columns.Revision.Name"), ColumnInfo.COLUMN_TYPE_TEXT, false, true), new ColumnInfo(BaseMessages.getString(PKG, "PurRepositoryRevisionBrowserDialog.Columns.Revision.Comment"), ColumnInfo.COLUMN_TYPE_TEXT, false, true), new ColumnInfo(BaseMessages.getString(PKG, "PurRepositoryRevisionBrowserDialog.Columns.Revision.Date"), ColumnInfo.COLUMN_TYPE_TEXT, false, true), new ColumnInfo(BaseMessages.getString(PKG, "PurRepositoryRevisionBrowserDialog.Columns.Revision.Login"), ColumnInfo.COLUMN_TYPE_TEXT, false, true) };
wFields = new TableView(new Variables(), shell, SWT.BORDER | SWT.FULL_SELECTION | SWT.SINGLE, colinf, 0, null, props);
wFields.setReadonly(true);
fdFields = new FormData();
fdFields.left = new FormAttachment(0, 0);
fdFields.top = new FormAttachment(wlFields, margin);
fdFields.right = new FormAttachment(100, 0);
fdFields.bottom = new FormAttachment(100, -50);
wFields.setLayoutData(fdFields);
wFields.table.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
int index = wFields.getSelectionIndex();
if (index >= 0) {
String[] item = wFields.getItem(index);
if (item != null && item.length > 0) {
selectedRevision = item[0];
}
}
}
public void widgetDefaultSelected(SelectionEvent event) {
ok();
}
});
wOpen = new Button(shell, SWT.PUSH);
// $NON-NLS-1$
wOpen.setText(BaseMessages.getString("System.Button.Open"));
lsOpen = new Listener() {
public void handleEvent(Event e) {
ok();
}
};
wOpen.addListener(SWT.Selection, lsOpen);
wClose = new Button(shell, SWT.PUSH);
// $NON-NLS-1$
wClose.setText(BaseMessages.getString("System.Button.Close"));
lsClose = new Listener() {
public void handleEvent(Event e) {
cancel();
}
};
wClose.addListener(SWT.Selection, lsClose);
BaseStepDialog.positionBottomButtons(shell, new Button[] { wOpen, wClose }, margin, null);
// Detect X or ALT-F4 or something that kills this window...
shell.addShellListener(new ShellAdapter() {
public void shellClosed(ShellEvent e) {
cancel();
}
});
getData();
BaseStepDialog.setSize(shell);
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch())
display.sleep();
}
return selectedRevision;
} catch (Exception e) {
new ErrorDialog(shell, "Error browsing versions", "There was an error browsing the version history of element " + element, e);
return null;
}
}
use of org.pentaho.di.ui.core.dialog.ShowMessageDialog in project pentaho-cassandra-plugin by pentaho.
the class CassandraInputDialog method checkForUnresolved.
private boolean checkForUnresolved(CassandraInputMeta meta, String title) {
String query = transMeta.environmentSubstitute(meta.getCQLSelectQuery());
// $NON-NLS-1$ //$NON-NLS-2$
boolean notOk = (query.contains("${") || query.contains("?{"));
if (notOk) {
ShowMessageDialog smd = new ShowMessageDialog(shell, SWT.ICON_WARNING | SWT.OK, title, BaseMessages.getString(PKG, // $NON-NLS-1$
"CassandraInputDialog.Warning.Message.CassandraQueryContainsUnresolvedVarsFieldSubs"));
smd.open();
}
return !notOk;
}
Aggregations