use of org.eclipse.swt.widgets.MessageBox in project tdi-studio-se by Talend.
the class AddArrayIndexDialog method okPressed.
protected void okPressed() {
String com = text.getText();
index = Integer.valueOf(indexText);
if (text.getEnabled() == true && ("".equals(text.getText()) || text.getText() == null)) {
MessageBox box = new MessageBox(parentShell, SWT.ICON_ERROR | SWT.OK);
//$NON-NLS-1$
box.setText(Messages.getString("AddArrayIndexDialog.Error"));
//$NON-NLS-1$
box.setMessage(Messages.getString("AddArrayIndexDialog.Input_Index"));
box.open();
return;
}
if (arraySize != -1 && (index < 0 || index > arraySize)) {
MessageBox box = new MessageBox(parentShell, SWT.ICON_ERROR | SWT.OK | SWT.CANCEL);
//$NON-NLS-1$
box.setText(Messages.getString("AddArrayIndexDialog.Error"));
//$NON-NLS-1$
box.setMessage(Messages.getString("AddArrayIndexDialog.check_size"));
box.open();
//$NON-NLS-1$
text.setText("");
return;
}
super.okPressed();
}
use of org.eclipse.swt.widgets.MessageBox in project tdi-studio-se by Talend.
the class AddListDialog method okPressed.
@Override
protected void okPressed() {
boolean falg = false;
IStructuredSelection selection = (IStructuredSelection) treeViewer.getSelection();
paramList = selection.toList();
if (selection.size() == 1) {
ParameterInfo selPara = getSelectedParaInfo();
ParameterInfo usePara = null;
paraUtil = new ParameterInfoUtil();
int currentindex = -1;
// if select multi simple type items.
if (paramList != null && !paramList.isEmpty()) {
}
// if selected have branch.
if (selPara == null) {
return;
}
if (!selPara.getParameterInfos().isEmpty()) {
MessageBox box = new MessageBox(parentShell, SWT.ICON_ERROR | SWT.OK);
//$NON-NLS-1$
box.setText(Messages.getString("AddListDialog.Error"));
//$NON-NLS-1$
box.setMessage("Please Select " + selPara.getName() + " branch Item.");
box.open();
return;
}
} else if (selection.size() > 1) {
paraUtil = new ParameterInfoUtil();
List<ParameterInfo> list = selection.toList();
for (ParameterInfo info : list) {
if (!info.getParameterInfos().isEmpty()) {
MessageBox box = new MessageBox(parentShell, SWT.ICON_ERROR | SWT.OK);
//$NON-NLS-1$
box.setText(Messages.getString("AddListDialog.Error"));
//$NON-NLS-1$
box.setMessage("Please Select " + info.getName() + " branch Item.");
box.open();
return;
}
}
}
// if select a array item.
// if (selPara.getArraySize() == -1) {
// AddArrayIndexDialog dlg = new AddArrayIndexDialog(parentShell, selPara);
// int openCode = dlg.open();
// if (openCode == AddArrayIndexDialog.OK) {
// String indexValue = dlg.getIndexText();
// currentindex = Integer.valueOf(indexValue);
// } else {
// return;
// }
// paraUtil.setCurrentindex(currentindex);
// // super.okPressed();
// }
// if select item's parent is array.
// if (arraySize == 0 && selPara.getParent() != null && !getAllArrayFromParents(selPara, null).isEmpty()) {
// List<ParameterInfo> paraList = paraUtil.getAllParameterInfo(selPara);
// goout: for (ParameterInfo para : paraList) {
// if (para.getArraySize() != 0) {
// falg = true;
// usePara = para;
// arraySize = para.getArraySize();
// break goout;
// }
// }
// }
// if (falg) {
// String title = "";
// if (usePara != null && usePara.getName() != null) {
// title = usePara.getName() + " index is :";
// }
// if (getAllArrayFromParents(selPara, null).size() == 1 && "input".equals(inOrOut) && false) {
// InputDialog dlg = new InputDialog(parentShell, title, title, "", new InputIndexValidator()); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
// int openCode = dlg.open();
// if (openCode == InputDialog.OK) {
// String indexValue = dlg.getValue();
// currentindex = Integer.valueOf(indexValue);
// } else if (openCode == InputDialog.CANCEL) {
// // super.cancelPressed();
// return;
// }
// if (arraySize != -1 && currentindex > arraySize) {
// currentindex = -1;
// MessageBox box = new MessageBox(parentShell, SWT.ICON_ERROR | SWT.OK | SWT.CANCEL);
// box.setText(Messages.getString("AddListDialog.Error")); //$NON-NLS-1$
// box.setMessage(Messages.getString("AddListDialog.CHECKSIZE")); //$NON-NLS-1$
// box.open();
// return;
// }
// paraUtil.setCurrentindex(currentindex);
// super.okPressed();
// } else if (getAllArrayFromParents(selPara, null).size() >= 1) {
//
// AddArrayIndexForParentsDialog multiDialog = new AddArrayIndexForParentsDialog(parentShell, selPara);
// int openCode = multiDialog.open();
// if (openCode == AddArrayIndexForParentsDialog.OK) {
// List indexList = null;
// if (multiDialog.getArrayIndexList() != null) {
// indexList = multiDialog.getArrayIndexList();
// }
// paraUtil.setCurrenIndexList(indexList);
// super.okPressed();
// } else {
// return;
// }
// }
//
// }
// paraUtil.setCurrentindex(currentindex);
super.okPressed();
}
Aggregations