/** * 기존 리소스 호출 * * @param userDB * @param dao */ public void run(UserDBResourceDAO dao) { IEditorReference reference = EditorUtils.findSQLEditor(dao); if (reference == null) { try { MainEditorInput mei = new MainEditorInput(dao); PlatformUI.getWorkbench() .getActiveWorkbenchWindow() .getActivePage() .openEditor(mei, MainEditor.ID); } catch (Exception e) { logger.error("new editor", e); // $NON-NLS-1$ Status errStatus = new Status(IStatus.ERROR, Activator.PLUGIN_ID, e.getMessage(), e); // $NON-NLS-1$ ExceptionDetailsErrorDialog.openError( null, "Error", Messages.MainEditorInput_0, errStatus); // $NON-NLS-1$ } } else { try { MainEditor editor = (MainEditor) reference.getEditor(true); PlatformUI.getWorkbench() .getActiveWorkbenchWindow() .getActivePage() .openEditor(editor.getEditorInput(), MainEditor.ID, false); editor.setFocus(); } catch (Exception e) { logger.error("findEditor", e); // $NON-NLS-1$ Status errStatus = new Status(IStatus.ERROR, Activator.PLUGIN_ID, e.getMessage(), e); // $NON-NLS-1$ ExceptionDetailsErrorDialog.openError( null, "Error", Messages.AbstractQueryAction_1, errStatus); // $NON-NLS-1$ } } }
/** * 디비의 화면을 오픈합니다. * * @param userDB */ public void run(UserDBDAO userDB) { // mongodb인지 검사하여.. if (DBDefine.getDBDefine(userDB.getTypes()) != DBDefine.MONGODB_DEFAULT) { MainEditorInput mei = new MainEditorInput(userDB); try { PlatformUI.getWorkbench() .getActiveWorkbenchWindow() .getActivePage() .openEditor(mei, MainEditor.ID); } catch (PartInitException e) { logger.error("open editor", e); // $NON-NLS-1$ Status errStatus = new Status(IStatus.ERROR, Activator.PLUGIN_ID, e.getMessage(), e); // $NON-NLS-1$ ExceptionDetailsErrorDialog.openError( null, "Error", Messages.AbstractQueryAction_1, errStatus); // $NON-NLS-1$ } } else if (DBDefine.getDBDefine(userDB.getTypes()) == DBDefine.MONGODB_DEFAULT) { MongoDBInfosInput mongoInput = new MongoDBInfosInput(userDB); try { PlatformUI.getWorkbench() .getActiveWorkbenchWindow() .getActivePage() .openEditor(mongoInput, MongoDBInfosEditor.ID); } catch (PartInitException e) { logger.error("open editor", e); // $NON-NLS-1$ Status errStatus = new Status(IStatus.ERROR, Activator.PLUGIN_ID, e.getMessage(), e); // $NON-NLS-1$ ExceptionDetailsErrorDialog.openError( null, "Error", Messages.AbstractQueryAction_1, errStatus); // $NON-NLS-1$ } } }
@Override public void run(IAction action) { UserDBDAO userDB = (UserDBDAO) sel.getFirstElement(); IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(); try { ProfilingEditorInput input = new ProfilingEditorInput(userDB); page.openEditor(input, ProfilingEditor.ID, false); } catch (PartInitException e) { logger.error("Mongodb profilling", e); Status errStatus = new Status(IStatus.ERROR, Activator.PLUGIN_ID, e.getMessage(), e); // $NON-NLS-1$ ExceptionDetailsErrorDialog.openError( null, "Error", "Profilling Exception", errStatus); // $NON-NLS-1$ } }
/** index 정보를 최신으로 갱신 합니다. */ public void refreshIndexes(final UserDBDAO userDB, boolean boolRefresh) { if (!boolRefresh) if (listIndexes != null) return; this.userDB = userDB; try { SqlMapClient sqlClient = TadpoleSQLManager.getInstance(userDB); listIndexes = sqlClient.queryForList("indexList", userDB.getDb()); // $NON-NLS-1$ tableViewer.setInput(listIndexes); tableViewer.refresh(); } catch (Exception e) { logger.error("index refresh", e); // $NON-NLS-1$ Status errStatus = new Status(IStatus.ERROR, Activator.PLUGIN_ID, e.getMessage(), e); // $NON-NLS-1$ ExceptionDetailsErrorDialog.openError( getSite().getShell(), "Error", Messages.ExplorerViewer_1, errStatus); // $NON-NLS-1$ } }
@Override public void run() { StringBuffer sbSQL = new StringBuffer(); try { TableDAO tableDAO = (TableDAO) sel.getFirstElement(); Map<String, String> parameter = new HashMap<String, String>(); parameter.put("db", userDB.getDb()); parameter.put("table", tableDAO.getName()); SqlMapClient sqlClient = TadpoleSQLManager.getInstance(userDB); List<TableColumnDAO> showTableColumns = sqlClient.queryForList("tableColumnList", parameter); // $NON-NLS-1$ sbSQL.append(" DELETE FROM " + tableDAO.getName() + " "); // $NON-NLS-1$ //$NON-NLS-2$ sbSQL.append("\r\n WHERE \r\n "); // $NON-NLS-1$ int cnt = 0; for (int i = 0; i < showTableColumns.size(); i++) { TableColumnDAO dao = showTableColumns.get(i); if (Define.isKEY(dao.getKey())) { if (cnt == 0) sbSQL.append("\t" + dao.getField() + " = ? \r\n"); // $NON-NLS-1$ //$NON-NLS-2$ else sbSQL.append("\tAND " + dao.getField() + " = ?"); // $NON-NLS-1$ //$NON-NLS-2$ cnt++; } } sbSQL.append(Define.SQL_DILIMITER); // $NON-NLS-1$ // // QueryEditorAction qea = new QueryEditorAction(); FindEditorAndWriteQueryUtil.run(userDB, sbSQL.toString()); } catch (Exception e) { logger.error(Messages.GenerateSQLDeleteAction_10, e); Status errStatus = new Status(IStatus.ERROR, Activator.PLUGIN_ID, e.getMessage(), e); // $NON-NLS-1$ ExceptionDetailsErrorDialog.openError( null, "Error", Messages.GenerateSQLDeleteAction_0, errStatus); // $NON-NLS-1$ } }
@Override public boolean connection() { if (!isValidate()) return false; String dbUrl = ""; if (comboConnType.getText().equals("SID")) { dbUrl = String.format( DBDefine.ORACLE_DEFAULT.getDB_URL_INFO(), textHost.getText(), textPort.getText(), textDatabase.getText()); } else if (comboConnType.getText().equals("Service Name")) { dbUrl = String.format( "jdbc:oracle:thin:@%s:%s/%s", textHost.getText(), textPort.getText(), textDatabase.getText()); } userDB = new UserDBDAO(); userDB.setTypes(DBDefine.ORACLE_DEFAULT.getDBToString()); userDB.setUrl(dbUrl); userDB.setDb(textDatabase.getText()); userDB.setGroup_name(comboGroup.getText().trim()); userDB.setDisplay_name(textDisplayName.getText()); userDB.setOperation_type( DBOperationType.getNameToType(comboOperationType.getText()).toString()); userDB.setHost(textHost.getText()); userDB.setPasswd(textPassword.getText()); userDB.setPort(textPort.getText()); // userDB.setLocale(comboLocale.getText().trim()); userDB.setUsers(textUser.getText()); // 기존 데이터 업데이트 if (oldUserDB != null) { if (!MessageDialog.openConfirm(null, "Confirm", Messages.SQLiteLoginComposite_13)) return false; //$NON-NLS-1$ if (!checkDatabase(userDB)) return false; try { TadpoleSystem_UserDBQuery.updateUserDB(userDB, oldUserDB, SessionManager.getSeq()); } catch (Exception e) { logger.error(Messages.SQLiteLoginComposite_8, e); Status errStatus = new Status(IStatus.ERROR, Activator.PLUGIN_ID, e.getMessage(), e); // $NON-NLS-1$ ExceptionDetailsErrorDialog.openError( getShell(), "Error", Messages.SQLiteLoginComposite_5, errStatus); // $NON-NLS-1$ return false; } // 신규 데이터 저장. } else { // db가 정상적인지 채크해본다 try { SqlMapClient sqlClient = TadpoleSQLManager.getInstance(userDB); List showTables = sqlClient.queryForList("tableList", textDatabase.getText()); } catch (Exception e) { logger.error(Messages.OracleLoginComposite_7, e); Status errStatus = new Status(IStatus.ERROR, Activator.PLUGIN_ID, e.getMessage(), e); // $NON-NLS-1$ ExceptionDetailsErrorDialog.openError( getShell(), "Error", Messages.OracleLoginComposite_10, errStatus); // $NON-NLS-1$ return false; } try { TadpoleSystem_UserDBQuery.newUserDB(userDB, SessionManager.getSeq()); } catch (Exception e) { logger.error("Oracle db info save", e); Status errStatus = new Status(IStatus.ERROR, Activator.PLUGIN_ID, e.getMessage(), e); // $NON-NLS-1$ ExceptionDetailsErrorDialog.openError( getShell(), "Error", Messages.OracleLoginComposite_11, errStatus); // $NON-NLS-1$ } } return true; }