Fixed compile warnings and performance bottlenecks in drawing

This commit is contained in:
2017-01-21 13:13:05 +01:00
parent 4ec9a928b9
commit 40a0137dfd
19 changed files with 332 additions and 129 deletions

View File

@ -9,5 +9,4 @@
</parent>
<packaging>eclipse-plugin</packaging>
<version>1.1.0-SNAPSHOT</version>
<groupId>com.minres.scviewer</groupId>
</project>
</project>

View File

@ -36,7 +36,7 @@ import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.jface.viewers.TreeViewerColumn;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jface.viewers.ViewerFilter;
import org.eclipse.jface.viewers.ViewerSorter;
import org.eclipse.jface.viewers.ViewerComparator;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.ControlAdapter;
import org.eclipse.swt.events.ControlEvent;
@ -125,7 +125,7 @@ public class TransactionDetails {
treeViewer.setLabelProvider(new TxPropertiesLabelProvider());
treeViewer.getControl().setLayoutData(new GridData(GridData.FILL_BOTH));
treeViewer.addFilter(attributeFilter);
treeViewer.setSorter(viewSorter);
treeViewer.setComparator(viewSorter);
treeViewer.setAutoExpandLevel(2);
// Set up the table
@ -138,7 +138,7 @@ public class TransactionDetails {
col1.setLabelProvider(new DelegatingStyledCellLabelProvider(new AttributeLabelProvider(AttributeLabelProvider.NAME)));
col1.getColumn().addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
((TxAttributeViewerSorter) treeViewer.getSorter()).doSort(COLUMN_FIRST);
((TxAttributeViewerSorter) treeViewer.getComparator()).doSort(COLUMN_FIRST);
treeViewer.refresh();
}
});
@ -149,7 +149,7 @@ public class TransactionDetails {
col2.setLabelProvider(new DelegatingStyledCellLabelProvider(new AttributeLabelProvider(AttributeLabelProvider.TYPE)));
col2.getColumn().addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
((TxAttributeViewerSorter) treeViewer.getSorter()).doSort(COLUMN_SECOND);
((TxAttributeViewerSorter) treeViewer.getComparator()).doSort(COLUMN_SECOND);
treeViewer.refresh();
}
});
@ -160,7 +160,7 @@ public class TransactionDetails {
col3.setLabelProvider(new DelegatingStyledCellLabelProvider(new AttributeLabelProvider(AttributeLabelProvider.VALUE)));
col3.getColumn().addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
((TxAttributeViewerSorter) treeViewer.getSorter()).doSort(COLUMN_SECOND);
((TxAttributeViewerSorter) treeViewer.getComparator()).doSort(COLUMN_SECOND);
treeViewer.refresh();
}
});
@ -290,7 +290,7 @@ public class TransactionDetails {
/**
* The Class TxAttributeViewerSorter.
*/
class TxAttributeViewerSorter extends ViewerSorter {
class TxAttributeViewerSorter extends ViewerComparator {
/** The Constant ASCENDING. */
private static final int ASCENDING = 0;
@ -345,7 +345,7 @@ public class TransactionDetails {
rc = getComparator().compare(p1.getDataType().name(), p2.getDataType().name());
break;
case COLUMN_THIRD:
rc = getComparator().compare(p1.getValue(), p2.getValue());
rc = getComparator().compare(p1.getValue().toString(), p2.getValue().toString());
break;
}
// If descending order, flip the direction

View File

@ -14,7 +14,6 @@ import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.ArrayList;
@ -22,7 +21,6 @@ import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Properties;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

View File

@ -43,8 +43,9 @@ public class DefaultValuesInitializer extends AbstractPreferenceInitializer {
colors[WaveformColors.TX_BORDER.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_RED);
colors[WaveformColors.SIGNAL0.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_DARK_GREEN);
colors[WaveformColors.SIGNAL1.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_DARK_GREEN);
colors[WaveformColors.SIGNALZ.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_GRAY);
colors[WaveformColors.SIGNALX.ordinal()] = SWTResourceManager.getColor(255, 128, 182);
colors[WaveformColors.SIGNALZ.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_YELLOW);
colors[WaveformColors.SIGNALX.ordinal()] = SWTResourceManager.getColor(255, 51, 51);
colors[WaveformColors.SIGNALU.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_DARK_YELLOW);
colors[WaveformColors.SIGNAL_TEXT.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_WHITE);
colors[WaveformColors.CURSOR.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_RED);
colors[WaveformColors.CURSOR_DRAG.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_GRAY);