use of org.eclipse.jface.dialogs.MessageDialog in project tdi-studio-se by Talend.
the class JavaProcessorUtilities method handleMissingJarsForProcess.
/**
*
* Added by Marvin Wang on Nov 7, 2012.
*
* @param missingJarsForRoutines
* @param missingJarsForProcess
* @param missingJars
* @throws BusinessException
*/
private static void handleMissingJarsForProcess(Set<String> missingJarsForRoutines, final Set<String> missingJarsForProcess, String missingJars) throws ProcessorException {
//$NON-NLS-1$
final StringBuffer sb = new StringBuffer("");
if (missingJarsForProcess.size() > 0) {
//$NON-NLS-1$
sb.append(Messages.getString("JavaProcessorUtilities.msg.missingjar.forProcess"));
for (String missingJar : missingJarsForProcess) {
sb.append(missingJar);
//$NON-NLS-1$
sb.append(", ");
}
if (missingJarsForRoutines.size() > 0) {
// subForMsg(sb.toString());
//$NON-NLS-1$
sb.append("\r\n\r\n\r\n");
//$NON-NLS-1$
sb.append(Messages.getString("JavaProcessorUtilities.msg.missingjar.note"));
//$NON-NLS-1$
sb.append("\r\n");
//$NON-NLS-1$
sb.append(Messages.getString("JavaProcessorUtilities.msg.missingjar.onlyforroutine"));
//$NON-NLS-1$
sb.append("\r\n");
for (String missingJar : missingJarsForRoutines) {
sb.append(missingJar);
//$NON-NLS-1$
sb.append(", ");
}
subForMsg(sb.toString());
} else {
subForMsg(sb.toString());
}
if (!CommonsPlugin.isHeadless()) {
Display display = DisplayUtils.getDisplay();
if (display != null) {
display.syncExec(new Runnable() {
@Override
public void run() {
// fix for TDI-24906
MessageDialog dialog = new MessageDialog(Display.getDefault().getActiveShell(), Messages.getString("JavaProcessorUtilities.msg.missingjar.warningtitle"), null, subForMsg(sb.toString()), 4, new String[] { IDialogConstants.OK_LABEL }, 0) {
/*
* (non-Javadoc)
*
* @see org.eclipse.jface.window.Window#setShellStyle(int)
*/
@Override
protected void setShellStyle(int newShellStyle) {
super.setShellStyle(getShellStyle() | SWT.APPLICATION_MODAL);
}
};
dialog.open();
}
});
}
} else {
throw new ProcessorException(missingJars);
}
} else {
if (missingJarsForRoutines.size() > 0) {
//$NON-NLS-1$
sb.append(Messages.getString("JavaProcessorUtilities.msg.missingjar.onlyforroutine"));
for (String missingJar : missingJarsForRoutines) {
sb.append(missingJar);
//$NON-NLS-1$
sb.append(", ");
}
CommonExceptionHandler.warn(subForMsg(sb.toString()));
}
}
}
use of org.eclipse.jface.dialogs.MessageDialog in project tdi-studio-se by Talend.
the class CreateNodeContainerCommand method execute.
@Override
public void execute() {
if (this.location != null) {
this.nodeContainer.getNode().setLocation(this.location);
}
updatePaletteRecentlyUsedList();
AbstractProcessProvider provider = AbstractProcessProvider.findProcessProviderFromPID(nodeContainer.getNode().getComponent().getPluginExtension());
IElementParameter ep = nodeContainer.getNode().getElementParameter(EParameterName.UNIQUE_NAME.getName());
process.addUniqueNodeName(ep.getValue().toString());
if (provider == null || (provider != null && provider.containNodeInMemoryNotProcess())) {
this.process.addNodeContainer(this.nodeContainer);
process.checkStartNodes();
nodeContainer.getNode().checkAndRefreshNode();
refreshRelatedNodes();
// }
if (nodeContainer.getNode().getComponent().getComponentType() == EComponentType.JOBLET) {
IUpdateItemType jobletContextType = UpdateManagerProviderDetector.INSTANCE.getUpdateItemType(UpdateManagerHelper.TYPE_JOBLET_CONTEXT);
if (jobletContextType != null) {
process.getUpdateManager().update(jobletContextType);
}
}
} else {
String name = provider.getComponentProcess().getName() + " " + provider.getComponentProcess().getVersion();
MessageDialog warningMessageDialog = new MessageDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), "Can't create node", null, "Joblet process " + name + " is not saved. Please save it first", MessageDialog.OK, new String[] { "OK" }, 0);
warningMessageDialog.open();
}
}
use of org.eclipse.jface.dialogs.MessageDialog in project cubrid-manager by CUBRID.
the class QueryEditorDNDController method openConfirmDialog.
/**
*
* Open confirm dialog
*
* @return the button id
*/
private int openConfirmDialog() {
String title = com.cubrid.common.ui.common.Messages.titleConfirm;
String[] buttons = new String[] { Messages.btnYes, Messages.btnNo, Messages.cancel };
MessageDialog dialog = new MessageDialog(editor.getSite().getShell(), title, null, Messages.changeDbConfirm, MessageDialog.QUESTION, buttons, 0) {
protected void buttonPressed(int buttonId) {
switch(buttonId) {
case 0:
setReturnCode(0);
close();
break;
case 1:
setReturnCode(1);
close();
break;
case 2:
setReturnCode(2);
close();
break;
default:
break;
}
}
};
return dialog.open();
}
use of org.eclipse.jface.dialogs.MessageDialog in project cubrid-manager by CUBRID.
the class QueryEditorPart method queryErrSkipOrNot.
/**
* Open a message dialog to confirm skip query error or not.
*
* @param ee SQLException
* @param errorSql String
* @return value boolean[]
*
*/
public boolean[] queryErrSkipOrNot(final SQLException ee, String errorSql) {
final boolean[] value = new boolean[2];
SQLEditorComposite sqlEditorComp = combinedQueryComposite.getSqlEditorComp();
StyledText txaEdit = sqlEditorComp.getText();
if (txaEdit != null && !txaEdit.isDisposed()) {
sqlEditorComp.txtFind(errorSql, 0, false, false, true, false);
line = txaEdit.getLineAtOffset(txaEdit.getSelection().x) + 1;
}
String errorLineMsg = Messages.bind(Messages.errWhere, line);
String errMsg = Messages.skipOrNot + StringUtil.NEWLINE + StringUtil.NEWLINE + Messages.runError + ee.getErrorCode() + StringUtil.NEWLINE + errorLineMsg + StringUtil.NEWLINE + Messages.errorHead + ee.getMessage();
MessageDialog dialog = new MessageDialog(QueryEditorPart.this.getEditorSite().getShell(), Messages.warning, null, errMsg, MessageDialog.QUESTION, new String[] { Messages.btnYes, Messages.btnNo }, 1) {
Button btn = null;
protected Control createCustomArea(Composite parent) {
btn = new Button(parent, SWT.CHECK);
btn.setText(Messages.showOneTimeTip);
return btn;
}
protected void buttonPressed(int buttonId) {
value[0] = btn.getSelection();
if (buttonId == IDialogConstants.CANCEL_ID) {
value[1] = false;
} else {
value[1] = true;
}
close();
}
};
dialog.open();
return value;
}
use of org.eclipse.jface.dialogs.MessageDialog in project cubrid-manager by CUBRID.
the class QueryEditorPart method resetJDBCConnection.
/**
* Reset the query connection
*
* @return boolean
*/
public boolean resetJDBCConnection() {
if (connection.hasConnection() && isActive) {
String title = com.cubrid.common.ui.common.Messages.titleConfirm;
String msg = Messages.bind(Messages.connCloseConfirm, new String[] { this.getSelectedDatabase().getLabel() });
String[] buttons = new String[] { Messages.btnYes, Messages.btnNo, Messages.cancel };
MessageDialog dialog = new MessageDialog(getSite().getShell(), title, null, msg, MessageDialog.QUESTION, buttons, 0) {
protected void buttonPressed(int buttonId) {
switch(buttonId) {
case 0:
commit();
setReturnCode(0);
close();
break;
case 1:
rollback();
setReturnCode(1);
close();
break;
case 2:
setReturnCode(2);
close();
break;
default:
break;
}
}
};
int returnVal = dialog.open();
if (returnVal == 2 || returnVal == -1) {
return false;
}
}
if (connection != null) {
connection.close();
}
return true;
}
Aggregations