List of usage examples for org.eclipse.jface.dialogs MessageDialog openWarning
public static void openWarning(Shell parent, String title, String message)
From source file:com.hangum.tadpole.commons.libs.core.utils.ValidChecker.java
License:Open Source License
/** * number checker util// w w w.ja v a 2 s. co m * * @param text * @param msg * @return */ public static boolean checkNumberCtl(Text text, String msg) { if (!NumberUtils.isNumber(text.getText())) { MessageDialog.openWarning(null, Messages.get().Warning, msg + Messages.get().CheckNumberString); text.setFocus(); return false; } return true; }
From source file:com.hangum.tadpole.commons.libs.core.utils.ValidChecker.java
License:Open Source License
/** * Text checker util/*from w w w . jav a2s.co m*/ * * @param text * @param msg * @return */ public static boolean checkTextCtl(Text text, String msg) { if ("".equals(StringUtils.trimToEmpty(text.getText()))) { //$NON-NLS-1$ MessageDialog.openWarning(null, Messages.get().Warning, msg + Messages.get().CheckTextString); text.setFocus(); return false; } return true; }
From source file:com.hangum.tadpole.commons.libs.core.utils.ValidChecker.java
License:Open Source License
/** * combo checker util//from www . j av a 2s.c om * * @param text * @param msg * @return */ public static boolean checkTextCtl(Combo text, String msg) { if ("".equals(StringUtils.trimToEmpty(text.getText()))) { //$NON-NLS-1$ MessageDialog.openWarning(null, Messages.get().Warning, msg + Messages.get().CheckTextString); text.setFocus(); return false; } return true; }
From source file:com.hangum.tadpole.engine.security.DBLockDialog.java
License:Open Source License
@Override protected void okPressed() { String strPassword = textPassword.getText(); if (!strPassword.equals(userDB.getPasswd())) { MessageDialog.openWarning(getShell(), Messages.get().Warning, Messages.get().DBLockDialog_3); textPassword.setFocus();//from w w w. j a v a2 s .c o m return; } super.okPressed(); }
From source file:com.hangum.tadpole.engine.security.DBPasswordAndOTPDialog.java
License:Open Source License
@Override protected void okPressed() { String strOTPCode = textOTP.getText(); if ("".equals(strOTPCode)) { MessageDialog.openError(getShell(), CommonMessages.get().Error, Messages.get().OTPEmpty); textOTP.setFocus();//w w w . jav a 2 s .c om return; } try { GetOTPCode.isValidate(SessionManager.getEMAIL(), SessionManager.getOTPSecretKey(), strOTPCode); } catch (Exception e) { logger.error("OTP check", e); MessageDialog.openError(getShell(), CommonMessages.get().Error, e.getMessage()); textOTP.setFocus(); return; } // ? ? . try { userDB.setPasswd(StringUtils.trim(textPassword.getText())); TadpoleSQLManager.getInstance(userDB); } catch (Exception e) { logger.error("Test Passwd+opt Connection error "); String msg = e.getMessage(); if (StringUtils.contains(msg, "No more data to read from socket")) { MessageDialog.openWarning(getShell(), CommonMessages.get().Warning, msg + CommonMessages.get().Check_DBAccessSystem); } else { MessageDialog.openWarning(getShell(), CommonMessages.get().Warning, msg); } textPassword.setFocus(); return; } super.okPressed(); }
From source file:com.hangum.tadpole.engine.security.DBPasswordDialog.java
License:Open Source License
@Override protected void okPressed() { // ? ? .//from w ww.j ava2s.c om try { userDB.setPasswd(StringUtils.trim(textPassword.getText())); TadpoleSQLManager.getInstance(userDB); } catch (Exception e) { logger.error("test passwd Connection error "); String msg = e.getMessage(); if (StringUtils.contains(msg, "No more data to read from socket")) { MessageDialog.openWarning(getShell(), CommonMessages.get().Warning, msg + CommonMessages.get().Check_DBAccessSystem); } else { MessageDialog.openWarning(getShell(), CommonMessages.get().Warning, msg); } textPassword.setFocus(); return; } super.okPressed(); }
From source file:com.hangum.tadpole.engine.sql.dialog.save.ResourceSaveDialog.java
License:Open Source License
@Override protected void buttonPressed(int buttonId) { if (buttonId == BTN_SHOW_URL) { String strApiURI = textAPIURI.getText(); if (strApiURI.equals("")) { //$NON-NLS-1$ MessageDialog.openWarning(getShell(), Messages.get().Warning, Messages.get().ResourceSaveDialog_8); textAPIURI.setFocus();//from w ww . j av a 2 s .co m return; } else if (RESOURCE_TYPE.ERD == resourceType) { MessageDialog.openWarning(getShell(), Messages.get().Warning, Messages.get().ResourceSaveDialog_10); return; } String strURL = RESTfulAPIUtils.makeURL(strContentData, textAPIURI.getText()); TadpoleSimpleMessageDialog dialog = new TadpoleSimpleMessageDialog(getShell(), Messages.get().ResourceSaveDialog_11, strURL); dialog.open(); } else { super.buttonPressed(buttonId); } }
From source file:com.hangum.tadpole.engine.sql.dialog.save.ResourceSaveDialog.java
License:Open Source License
/** * data validation/* w w w . j av a 2s. c o m*/ * * @param name * @return */ private boolean isValid() { int len = StringUtils.trimToEmpty(textName.getText()).length(); if (len < 3) { MessageDialog.openWarning(null, Messages.get().Warning, Messages.get().ResourceSaveDialog_16); textName.setFocus(); return false; } // sql type if (resourceType == RESOURCE_TYPE.SQL) { if (PublicTadpoleDefine.YES_NO.YES.name().equals(comboUseAPI.getText())) { String strAPIURI = textAPIURI.getText().trim(); if (strAPIURI.equals("")) { //$NON-NLS-1$ MessageDialog.openWarning(getShell(), Messages.get().Warning, Messages.get().ResourceSaveDialog_19); textAPIURI.setFocus(); return false; } // check valid url. url pattern is must be /{parent}/{child} if (!RESTfulAPIUtils.validateURL(textAPIURI.getText())) { MessageDialog.openWarning(getShell(), Messages.get().Warning, Messages.get().ResourceSaveDialog_21); textAPIURI.setFocus(); return false; } } } return true; }
From source file:com.hangum.tadpole.engine.sql.util.executer.ProcedureExecuterManager.java
License:Open Source License
/** * Is executed procedure?//from w w w . j a v a 2 s .c o m * * @param procedureDAO * @param useDB * @return */ public boolean isExecuted(ProcedureFunctionDAO procedureDAO, UserDBDAO selectUseDB) { if (!isSupport()) { MessageDialog.openWarning(null, Messages.get().Warning, Messages.get().ProcedureExecuterManager_0); return false; } if (!procedureDAO.isValid()) { MessageDialog.openWarning(null, Messages.get().Warning, Messages.get().ProcedureExecuterManager_4); return false; } if (userDB.getDBDefine() == DBDefine.MYSQL_DEFAULT) { double dbVersion = 0.0; try { SqlMapClient sqlClient = TadpoleSQLManager.getInstance(userDB); DBInfoDAO dbInfo = (DBInfoDAO) sqlClient.queryForObject("findDBInfo"); //$NON-NLS-1$ dbVersion = Double.parseDouble(StringUtils.substring(dbInfo.getProductversion(), 0, 3)); if (dbVersion < 5.5) { MessageDialog.openInformation(null, Messages.get().Information, Messages.get().ProcedureExecuterManager_6); return false; } } catch (Exception e) { logger.error("find DB info", e); //$NON-NLS-1$ return false; } } try { ProcedureExecutor procedureExecutor = getExecuter(); procedureExecutor.getInParameters(); } catch (Exception e) { MessageDialog.openError(null, Messages.get().Error, e.getMessage()); return false; } return true; }
From source file:com.hangum.tadpole.importexport.core.dialogs.CsvToRDBImportDialog.java
License:Open Source License
private void saveLog() { try {// w w w . jav a 2 s .c om if ("".equals(textSQL.getText())) { //$NON-NLS-1$ MessageDialog.openWarning(null, Messages.get().Warning, Messages.get().SQLToDBImportDialog_LogEmpty); return; } String filename = PublicTadpoleDefine.TEMP_DIR + userDB.getDisplay_name() + "_SQLImportResult.log"; //$NON-NLS-1$ FileOutputStream fos = new FileOutputStream(filename); OutputStreamWriter bw = new OutputStreamWriter(fos, "UTF-8"); //$NON-NLS-1$ bw.write(textSQL.getText()); bw.close(); String strImportResultLogContent = FileUtils.readFileToString(new File(filename)); downloadExtFile(userDB.getDisplay_name() + "_SQLImportResult.log", strImportResultLogContent);//sbExportData.toString()); //$NON-NLS-1$ } catch (Exception ee) { logger.error("log writer", ee); //$NON-NLS-1$ } }