Commit d13f857b authored by Matija Obreza's avatar Matija Obreza
Browse files

Eclipse code cleanup

parent 11a465a0
......@@ -91,6 +91,7 @@ public class AppWindow {
private ExecutorService threadPool = Executors.newFixedThreadPool(4);
private static class ViewerLabelProvider extends LabelProvider {
@Override
public Image getImage(Object element) {
_log.debug("getImage " + element);
if (element instanceof DataSourceFile) {
......@@ -102,6 +103,7 @@ public class AppWindow {
return super.getImage(element);
}
@Override
public String getText(Object element) {
_log.debug("getText " + element);
if (element instanceof DataSourceFile) {
......@@ -115,12 +117,15 @@ public class AppWindow {
}
private static class TreeContentProvider implements ITreeContentProvider {
@Override
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
}
@Override
public void dispose() {
}
@Override
public Object[] getElements(Object inputElement) {
_log.debug("getElements " + inputElement + " " + inputElement.getClass());
if (inputElement instanceof DwcaBuilder) {
......@@ -135,6 +140,7 @@ public class AppWindow {
return getChildren(inputElement);
}
@Override
public Object[] getChildren(Object parentElement) {
_log.debug("getChildren " + parentElement + " " + parentElement.getClass());
......@@ -150,10 +156,12 @@ public class AppWindow {
return new Object[] { "Item 0", "Item 1", "Item 2" };
}
@Override
public Object getParent(Object element) {
return null;
}
@Override
public boolean hasChildren(Object element) {
_log.debug("hasChildren " + element + " " + element.getClass());
......@@ -198,6 +206,7 @@ public class AppWindow {
public static void main(String[] args) {
Display display = Display.getDefault();
Realm.runWithDefault(SWTObservables.getRealm(display), new Runnable() {
@Override
public void run() {
try {
AppWindow window = new AppWindow();
......@@ -253,6 +262,7 @@ public class AppWindow {
protected void createContents() {
shlGenesysMagic = new Shell();
shlGenesysMagic.addDisposeListener(new DisposeListener() {
@Override
public void widgetDisposed(DisposeEvent e) {
doShutdown();
}
......@@ -422,6 +432,7 @@ public class AppWindow {
sashForm.setWeights(new int[] { 3, 6, 3 });
treeViewer.addDoubleClickListener(new IDoubleClickListener() {
@Override
public void doubleClick(DoubleClickEvent e) {
IStructuredSelection thisSelection = (IStructuredSelection) e.getSelection();
Object selectedNode = thisSelection.getFirstElement();
......
......@@ -106,6 +106,7 @@ public class PushDialog extends Dialog {
private void createContents() {
shell = new Shell(getParent(), getStyle());
shell.addDisposeListener(new DisposeListener() {
@Override
public void widgetDisposed(DisposeEvent e) {
_log.warn("Terminating thread pool!");
executorService.shutdownNow();
......@@ -113,6 +114,7 @@ public class PushDialog extends Dialog {
}
});
shell.addListener(SWT.Close, new Listener() {
@Override
public void handleEvent(Event event) {
_log.info("Killing worker thread pool");
executorService.shutdown();
......
......@@ -82,6 +82,7 @@ public class SheetDisplay extends Composite {
private static final ObjectMapper mapper = new ObjectMapper();
private static class ContentProvider implements IStructuredContentProvider {
@Override
public Object[] getElements(Object inputElement) {
if (inputElement instanceof List) {
return ((List<?>) inputElement).toArray();
......@@ -89,18 +90,22 @@ public class SheetDisplay extends Composite {
return new Object[0];
}
@Override
public void dispose() {
}
@Override
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
}
}
private class TableLabelProvider extends LabelProvider implements ITableLabelProvider {
@Override
public Image getColumnImage(Object element, int columnIndex) {
return null;
}
@Override
public String getColumnText(Object element, int columnIndex) {
if (element instanceof Object[]) {
try {
......@@ -146,6 +151,7 @@ public class SheetDisplay extends Composite {
this.dsw.setDataSourceSheet(dataSourceSheet);
addDisposeListener(new DisposeListener() {
@Override
public void widgetDisposed(DisposeEvent e) {
// UNBIND ALL STUFF
sampleDataDswObserveValue.dispose();
......@@ -170,6 +176,7 @@ public class SheetDisplay extends Composite {
tableViewer = new TableViewer(sashForm, SWT.BORDER);
tableViewer.addDoubleClickListener(new IDoubleClickListener() {
@Override
public void doubleClick(DoubleClickEvent arg0) {
IStructuredSelection selection = (IStructuredSelection) arg0.getSelection();
Object row = selection.getFirstElement();
......@@ -328,6 +335,7 @@ public class SheetDisplay extends Composite {
btnReload2.setText("Reload");
txtHeaderRowIndex.addListener(SWT.Verify, new Listener() {
@Override
public void handleEvent(Event e) {
String string = e.text;
char[] chars = new char[string.length()];
......@@ -413,6 +421,7 @@ public class SheetDisplay extends Composite {
@Override
public void handleChange(ChangeEvent arg0) {
getDisplay().asyncExec(new Runnable() {
@Override
public void run() {
updateTable();
}
......
......@@ -31,6 +31,7 @@ public class SwtLogAppender extends WriterAppender {
}
});
text.addPaintListener(new PaintListener() {
@Override
public void paintControl(PaintEvent e) {
if (resetText.getAndSet(false)) {
text.setText(logBuffer.toString());
......@@ -50,12 +51,14 @@ public class SwtLogAppender extends WriterAppender {
patternLayout.setConversionPattern(conversionPattern);
}
@Override
public void close() {
LogManager.getRootLogger().removeAppender(this);
this.text = null;
this.display = null;
}
@Override
public void append(LoggingEvent loggingEvent) {
// System.err.println("append!");
if (text == null || display == null) {
......
......@@ -107,6 +107,7 @@ public class VerifierDialog extends Dialog {
txtVerifier = new Text(shlEstablishLinkTo, SWT.BORDER);
txtVerifier.addModifyListener(new ModifyListener() {
@Override
public void modifyText(ModifyEvent e) {
verifierCode = txtVerifier.getText();
}
......
......@@ -130,6 +130,7 @@ public class XlsxDataSourceParser extends BasicDataSourceParser {
handler.setRowHandler(new RowHandler() {
int rowCount = 0;
@Override
public void handleRow(Object[] row) {
if (startAt > rowCount) {
return;
......
......@@ -45,6 +45,9 @@ import org.apache.poi.hssf.usermodel.HSSFRichTextString;
import org.apache.poi.hssf.usermodel.HSSFRow;
import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.CellStyle;
import org.apache.poi.ss.usermodel.Font;
import org.apache.poi.ss.util.CellRangeAddress;
/**
......@@ -82,13 +85,13 @@ public final class HSSFReadWrite {
f.setFontHeightInPoints((short) 12);
f.setColor((short) 0xA);
f.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);
f.setBoldweight(Font.BOLDWEIGHT_BOLD);
f2.setFontHeightInPoints((short) 10);
f2.setColor((short) 0xf);
f2.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);
f2.setBoldweight(Font.BOLDWEIGHT_BOLD);
cs.setFont(f);
cs.setDataFormat(HSSFDataFormat.getBuiltinFormat("($#,##0_);[Red]($#,##0)"));
cs2.setBorderBottom(HSSFCellStyle.BORDER_THIN);
cs2.setBorderBottom(CellStyle.BORDER_THIN);
cs2.setFillPattern((short) 1); // fill w fg
cs2.setFillForegroundColor((short) 0xA);
cs2.setFont(f2);
......@@ -120,7 +123,7 @@ public final class HSSFReadWrite {
rownum++;
rownum++;
HSSFRow r = s.createRow(rownum);
cs3.setBorderBottom(HSSFCellStyle.BORDER_THICK);
cs3.setBorderBottom(CellStyle.BORDER_THICK);
for (int cellnum = 0; cellnum < 50; cellnum++) {
HSSFCell c = r.createCell(cellnum);
c.setCellStyle(cs3);
......@@ -241,15 +244,15 @@ public final class HSSFReadWrite {
switch (cell.getCellType()) {
case HSSFCell.CELL_TYPE_FORMULA:
case Cell.CELL_TYPE_FORMULA:
value = "FORMULA value=" + cell.getCellFormula();
break;
case HSSFCell.CELL_TYPE_NUMERIC:
case Cell.CELL_TYPE_NUMERIC:
value = "NUMERIC value=" + cell.getNumericCellValue();
break;
case HSSFCell.CELL_TYPE_STRING:
case Cell.CELL_TYPE_STRING:
value = "STRING value=" + cell.getStringCellValue();
break;
......
......@@ -115,6 +115,7 @@ public class MyXSSFSheetHandler extends DefaultHandler {
* @see org.xml.sax.helpers.DefaultHandler#startElement(java.lang.String,
* java.lang.String, java.lang.String, org.xml.sax.Attributes)
*/
@Override
public void startElement(String uri, String localName, String name,
Attributes attributes) throws SAXException {
......@@ -173,6 +174,7 @@ public class MyXSSFSheetHandler extends DefaultHandler {
* @see org.xml.sax.helpers.DefaultHandler#endElement(java.lang.String,
* java.lang.String, java.lang.String)
*/
@Override
public void endElement(String uri, String localName, String name)
throws SAXException {
......@@ -287,6 +289,7 @@ public class MyXSSFSheetHandler extends DefaultHandler {
* Captures characters only if a suitable element is open. Originally was
* just "v"; extended for inlineStr also.
*/
@Override
public void characters(char[] ch, int start, int length)
throws SAXException {
if (vIsOpen)
......
......@@ -112,15 +112,15 @@ public final class XSSFReadWrite {
switch (cell.getCellType()) {
case HSSFCell.CELL_TYPE_FORMULA:
case Cell.CELL_TYPE_FORMULA:
value = "FORMULA value=" + cell.getCellFormula();
break;
case HSSFCell.CELL_TYPE_NUMERIC:
case Cell.CELL_TYPE_NUMERIC:
value = "NUMERIC value=" + cell.getNumericCellValue();
break;
case HSSFCell.CELL_TYPE_STRING:
case Cell.CELL_TYPE_STRING:
value = "STRING value=" + cell.getStringCellValue();
break;
......@@ -183,6 +183,7 @@ public final class XSSFReadWrite {
this.sst = sst;
}
@Override
public void startElement(String uri, String localName, String name,
Attributes attributes) throws SAXException {
// _log.debug(">> " + name);
......@@ -216,6 +217,7 @@ public final class XSSFReadWrite {
lastContents = "";
}
@Override
public void endElement(String uri, String localName, String name)
throws SAXException {
// Process the last contents as required.
......@@ -234,6 +236,7 @@ public final class XSSFReadWrite {
}
}
@Override
public void characters(char[] ch, int start, int length)
throws SAXException {
lastContents += new String(ch, start, length);
......
......@@ -128,6 +128,7 @@ public final class XSSFRowReader {
this.sst = sst;
}
@Override
public void startElement(String uri, String localName, String name,
Attributes attributes) throws SAXException {
// System.out.println(">> " + name);
......@@ -161,6 +162,7 @@ public final class XSSFRowReader {
lastContents = "";
}
@Override
public void endElement(String uri, String localName, String name)
throws SAXException {
// Process the last contents as required.
......@@ -179,6 +181,7 @@ public final class XSSFRowReader {
}
}
@Override
public void characters(char[] ch, int start, int length)
throws SAXException {
lastContents += new String(ch, start, length);
......@@ -201,6 +204,7 @@ public final class XSSFRowReader {
while (sheets.hasNext()) {
final List<Object[]> rows = new ArrayList<Object[]>();
handler.setRowHandler(new RowHandler() {
@Override
public void handleRow(Object[] row) {
rows.add(row);
}
......@@ -252,6 +256,7 @@ public final class XSSFRowReader {
this.rowHandler = rowHandler;
}
@Override
public void startElement(String uri, String localName, String name,
Attributes attributes) throws SAXException {
// System.out.println(">> " + name);
......@@ -291,6 +296,7 @@ public final class XSSFRowReader {
lastContents = "";
}
@Override
public void endElement(String uri, String localName, String name)
throws SAXException {
// Process the last contents as required.
......@@ -317,6 +323,7 @@ public final class XSSFRowReader {
}
}
@Override
public void characters(char[] ch, int start, int length)
throws SAXException {
lastContents += new String(ch, start, length);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment