@Override public String getColumnText(Object element, int columnIndex) { try { if (element instanceof PlaceHolder) { if (columnIndex == 1) { PlaceHolder ph = (PlaceHolder) element; return ph.getTitle(); } return ""; //$NON-NLS-1$ } ReportTemplateMetaData data = (ReportTemplateMetaData) element; switch (columnIndex) { case 0: return data.getOutputname(); // $NON-NLS-1$ case 1: StringBuilder sb = new StringBuilder(); OutputFormat[] formats = data.getOutputFormats(); for (int i = 0; i < formats.length; i++) { sb.append(formats[i]); if (!(i == formats.length - 1)) { sb.append(", "); } } return sb.toString(); // $NON-NLS-1$ case 2: return data.getFilename(); // $NON-NLS-1$ default: return null; } } catch (Exception e) { LOG.error("Error while getting column text", e); // $NON-NLS-1$ throw new RuntimeException(e); } }
private void deleteAttachments() { Iterator iterator = ((IStructuredSelection) viewer.getSelection()).iterator(); while (iterator.hasNext()) { ReportTemplateMetaData sel = (ReportTemplateMetaData) iterator.next(); try { ServiceFactory.lookupReportDepositService().remove(sel, Locale.getDefault().getLanguage()); } catch (ReportDepositException e) { ExceptionUtil.log(e, "Error deleting Reporttemplate:\t" + sel.getOutputname()); } } }
protected String getDefaultOutputFilename() { String outputFileName = chosenReportMetaData.getOutputname(); if (outputFileName == null || outputFileName.isEmpty()) { outputFileName = "unknown"; } StringBuilder sb = new StringBuilder(outputFileName); String scopeName = convertToFileName(scopeCombo.getText()); if (scopeName != null && !scopeName.isEmpty()) { sb.append("_").append(scopeName); } if (useDate) { String date = new SimpleDateFormat("yyyy-MM-dd").format(new Date()); sb.append("_").append(date); } if (chosenOutputFormat != null) { sb.append(".").append(chosenOutputFormat.getFileSuffix()); } else { sb.append(".pdf"); } return convertToFileName(sb.toString()); }