/** table data를 삭제합니다. */ private void deleteExtensionBrowserData() { String strName = StringUtils.trimToEmpty(textName.getText()); String strUrl = StringUtils.trimToEmpty(textURL.getText()); // url데이터가 이미 존재하는지 검사합니다. List<ExternalBrowserInfoDAO> listCheckExterBroswer = (List) tableViewer.getInput(); for (ExternalBrowserInfoDAO externalBrowserInfoDAO : listCheckExterBroswer) { if (strName.equals(externalBrowserInfoDAO.getName()) && strUrl.equals(externalBrowserInfoDAO.getUrl())) { listExterBroswer.remove(externalBrowserInfoDAO); tableViewer.refresh(); return; } } }
@Override public String getColumnText(Object element, int columnIndex) { ExternalBrowserInfoDAO dao = (ExternalBrowserInfoDAO) element; switch (columnIndex) { case 0: return dao.getIs_used(); case 1: return dao.getName(); case 2: return dao.getUrl(); case 3: return dao.getComment(); } return "*** not set column ***"; //$NON-NLS-1$ }
/** browser data를 추가합니다. */ private void addExtensionBrowserData() { String strName = StringUtils.trimToEmpty(textName.getText()); String strUrl = StringUtils.trimToEmpty(textURL.getText()); String strCmt = StringUtils.trimToEmpty(textComment.getText()); if ("".equals(strName)) { // $NON-NLS-1$ MessageDialog.openError(null, "Error", Messages.ExtensionBrowserURLDialog_18); // $NON-NLS-1$ textName.setFocus(); return; } if ("".equals(strUrl)) { // $NON-NLS-1$ MessageDialog.openError(null, "Error", Messages.ExtensionBrowserURLDialog_21); // $NON-NLS-1$ textURL.setFocus(); return; } // url데이터가 이미 존재하는지 검사합니다. List<ExternalBrowserInfoDAO> listCheckExterBroswer = (List) tableViewer.getInput(); for (ExternalBrowserInfoDAO externalBrowserInfoDAO : listCheckExterBroswer) { if (strUrl.equals(externalBrowserInfoDAO.getUrl())) { MessageDialog.openError( null, "Error", Messages.ExtensionBrowserURLDialog_23); // $NON-NLS-1$ return; } } // 신규데이터를 만든다. ExternalBrowserInfoDAO newDao = new ExternalBrowserInfoDAO(); newDao.setIs_used(comboUsed.getText()); newDao.setName(strName); newDao.setUrl(strUrl); newDao.setComment(strCmt); listExterBroswer.add(newDao); tableViewer.refresh(); }
/** * select Obj * * @param externalDAo */ private void selectData(ExternalBrowserInfoDAO externalDAo) { comboUsed.setText(externalDAo.getIs_used()); textName.setText(externalDAo.getName()); textURL.setText(externalDAo.getUrl()); textComment.setText(externalDAo.getComment()); }