Merge branch 'release/2.9.2'

This commit is contained in:
Eyck Jentzsch 2020-11-11 18:00:58 +01:00
commit 184f1b2d2c
8 changed files with 88 additions and 60 deletions

View File

@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %Bundle-Name
Bundle-SymbolicName: com.minres.scviewer.e4.application;singleton:=true
Bundle-Version: 2.9.1.qualifier
Bundle-Version: 2.9.2.qualifier
Bundle-Vendor: %Bundle-Vendor
Require-Bundle: javax.inject;bundle-version="1.0.0",
org.eclipse.core.runtime;bundle-version="3.11.1",

View File

@ -1,7 +1,7 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>com.minres.scviewer.e4.application</artifactId>
<version>2.9.1-SNAPSHOT</version>
<version>2.9.2-SNAPSHOT</version>
<parent>
<groupId>com.minres.scviewer</groupId>
<artifactId>com.minres.scviewer.parent</artifactId>

View File

@ -12,11 +12,12 @@ import org.eclipse.jface.viewers.ComboViewer;
import org.eclipse.jface.viewers.DelegatingStyledCellLabelProvider;
import org.eclipse.jface.viewers.DoubleClickEvent;
import org.eclipse.jface.viewers.IDoubleClickListener;
import org.eclipse.jface.viewers.ITreeSelection;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.LabelProvider;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.jface.viewers.TreeViewerColumn;
import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.jface.viewers.TableViewerColumn;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
@ -26,9 +27,10 @@ import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.TableColumn;
import org.eclipse.swt.widgets.Text;
import org.eclipse.swt.widgets.Tree;
import org.eclipse.swt.widgets.TreeColumn;
import com.minres.scviewer.database.DataType;
import com.minres.scviewer.database.ITx;
@ -73,11 +75,11 @@ public class TransactionList extends Composite {
private Text searchPropValue;
private TreeViewer treeViewer = null;
private TableViewer tableViewer = null;
private TreeColumn valueColumn = null;
private AttributeLabelProvider nameLabelProvider = null;
private TableColumn valueColumn = null;
private AttributeLabelProvider valueLabelProvider = null;
private ITxStream<? extends ITxEvent> stream;
@ -96,9 +98,14 @@ public class TransactionList extends Composite {
*/
public TransactionList(Composite parent, int style, WaveformViewer waveformViewer) {
super(parent, style);
setLayout(new GridLayout(3, false));
setLayout(new GridLayout(5, false));
txFilter = new TxFilter();
Label lbl1 = new Label(this, SWT.NONE);
lbl1.setAlignment(SWT.RIGHT);
lbl1.setText("Property to match:");
lbl1.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1));
searchPropComboViewer = new ComboViewer(this, SWT.NONE);
searchPropComboViewer.setLabelProvider(new LabelProvider() {
public String getText(Object element) {
@ -116,27 +123,34 @@ public class TransactionList extends Composite {
int idx = searchPropCombo.getSelectionIndex();
AttributeNameBean sel = attrNames.get(idx);
txFilter.setSearchProp(sel.getName(), sel.getType());
treeViewer.refresh();
tableViewer.refresh();
}
@Override
public void widgetDefaultSelected(SelectionEvent e) {
int idx = searchPropCombo.getSelectionIndex();
AttributeNameBean sel = attrNames.get(idx);
txFilter.setSearchProp(sel.getName(), sel.getType());
treeViewer.refresh();
tableViewer.refresh();
}
});
searchPropValue = new Text(this, SWT.BORDER);
searchPropValue.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1));
GridData gd_searchPropValue = new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1);
gd_searchPropValue.minimumWidth = 50;
searchPropValue.setLayoutData(gd_searchPropValue);
searchPropValue.addModifyListener(new ModifyListener() {
@Override
public void modifyText(ModifyEvent e) {
txFilter.setSearchValue(((Text) e.widget).getText());
treeViewer.refresh();
tableViewer.refresh();
}
});
Label lbl2 = new Label(this, SWT.NONE);
lbl2.setAlignment(SWT.RIGHT);
lbl2.setText("Property to show:");
lbl2.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1));
viewPropComboViewer = new ComboViewer(this, SWT.NONE);
viewPropComboViewer.setLabelProvider(new LabelProvider() {
public String getText(Object element) {
@ -152,15 +166,15 @@ public class TransactionList extends Composite {
@Override
public void widgetSelected(SelectionEvent e) {
int idx = viewPropCombo.getSelectionIndex();
nameLabelProvider.setShowProp(attrNames.get(idx).getName());
treeViewer.refresh(true);
valueLabelProvider.setShowProp(attrNames.get(idx).getName());
tableViewer.refresh(true);
}
@Override
public void widgetDefaultSelected(SelectionEvent e) { }
});
treeViewer = new TreeViewer(this);
treeViewer.setContentProvider(new AbstractTransactionTreeContentProvider(waveformViewer) {
tableViewer = new TableViewer(this);
tableViewer.setContentProvider(new AbstractTransactionTreeContentProvider(waveformViewer) {
@SuppressWarnings("unchecked")
@Override
@ -171,66 +185,65 @@ public class TransactionList extends Composite {
return new Object[0];
}
});
treeViewer.addFilter(txFilter);
treeViewer.addDoubleClickListener(new IDoubleClickListener() {
tableViewer.addFilter(txFilter);
tableViewer.addDoubleClickListener(new IDoubleClickListener() {
@Override
public void doubleClick(DoubleClickEvent event) {
ITreeSelection treeSelection = treeViewer.getStructuredSelection();
Object selected = treeSelection.getFirstElement();
if(selected instanceof ITx){
waveformViewer.setSelection(new StructuredSelection(selected));
} else if(selected instanceof TransactionTreeNode && ((TransactionTreeNode)selected).type == TransactionTreeNodeType.TX) {
waveformViewer.setSelection(new StructuredSelection(((TransactionTreeNode)selected).element));
ISelection treeSelection = tableViewer.getSelection();
if(treeSelection instanceof IStructuredSelection) {
Object selected = ((IStructuredSelection)treeSelection).getFirstElement();
if(selected instanceof ITx){
waveformViewer.setSelection(new StructuredSelection(selected));
} else if(selected instanceof TransactionTreeNode && ((TransactionTreeNode)selected).type == TransactionTreeNodeType.TX) {
waveformViewer.setSelection(new StructuredSelection(((TransactionTreeNode)selected).element));
}
}
}
});
Tree tree = treeViewer.getTree();
tree.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 3, 1));
Table table = tableViewer.getTable();
table.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 5, 1));
TreeViewerColumn nameColumnViewer = new TreeViewerColumn(treeViewer, SWT.NONE);
TreeColumn nameColumn = nameColumnViewer.getColumn();
TableViewerColumn nameColumnViewer = new TableViewerColumn(tableViewer, SWT.NONE);
TableColumn nameColumn = nameColumnViewer.getColumn();
nameColumn.setWidth(200);
nameColumn.setText("Tx ID");
nameColumn.setResizable(true);
nameColumnViewer.setLabelProvider(new DelegatingStyledCellLabelProvider(new AttributeLabelProvider(waveformViewer, AttributeLabelProvider.NAME)));
TreeViewerColumn timeColumnViewer = new TreeViewerColumn(treeViewer, SWT.NONE);
TreeColumn timeColumn = timeColumnViewer.getColumn();
TableViewerColumn timeColumnViewer = new TableViewerColumn(tableViewer, SWT.NONE);
TableColumn timeColumn = timeColumnViewer.getColumn();
timeColumn.setAlignment(SWT.RIGHT);
timeColumn.setWidth(150);
timeColumn.setText("Start time");
timeColumn.setResizable(true);
timeColumnViewer.setLabelProvider(new DelegatingStyledCellLabelProvider(new AttributeLabelProvider(waveformViewer, AttributeLabelProvider.TX_TIME)));
TreeViewerColumn typeColumnViewer = new TreeViewerColumn(treeViewer, SWT.NONE);
TreeColumn typeColumn = typeColumnViewer.getColumn();
typeColumn.setAlignment(SWT.RIGHT);
typeColumn.setWidth(150);
typeColumn.setText("Type");
typeColumn.setResizable(true);
typeColumnViewer.setLabelProvider(new DelegatingStyledCellLabelProvider(new AttributeLabelProvider(waveformViewer, AttributeLabelProvider.TYPE)));
TreeViewerColumn valueColumnViewer = new TreeViewerColumn(treeViewer, SWT.NONE);
TableViewerColumn valueColumnViewer = new TableViewerColumn(tableViewer, SWT.NONE);
valueColumn = valueColumnViewer.getColumn();
valueColumn.setWidth(150);
valueColumn.setText("Value");
valueColumn.setText("Property Value");
valueColumn.setResizable(true);
nameLabelProvider= new AttributeLabelProvider(waveformViewer, AttributeLabelProvider.VALUE);
valueColumnViewer.setLabelProvider(new DelegatingStyledCellLabelProvider(nameLabelProvider));
valueLabelProvider= new AttributeLabelProvider(waveformViewer, AttributeLabelProvider.VALUE);
valueColumnViewer.setLabelProvider(new DelegatingStyledCellLabelProvider(valueLabelProvider));
// Turn on the header and the lines
tree.setHeaderVisible(true);
tree.setLinesVisible(true);
table.setHeaderVisible(true);
table.setLinesVisible(true);
new Label(this, SWT.NONE);
new Label(this, SWT.NONE);
new Label(this, SWT.NONE);
new Label(this, SWT.NONE);
new Label(this, SWT.NONE);
}
public void setInput(TrackEntry trackEntry) {
if(trackEntry==null || !trackEntry.isStream()) {
attrNames.clear();
treeViewer.setInput(emptyList);
tableViewer.setInput(emptyList);
} else {
stream=trackEntry.getStream();
treeViewer.setInput(emptyList);
tableViewer.setInput(emptyList);
new Thread() {
private ConcurrentHashMap<String, DataType> propNames=new ConcurrentHashMap<String, DataType>();
@ -257,7 +270,7 @@ public class TransactionList extends Composite {
getDisplay().asyncExec(new Runnable() {
@Override
public void run() {
treeViewer.setInput(eventList);
tableViewer.setInput(eventList);
attrNames.clear();
attrNames.addAll(getEntries());
searchPropComboViewer.getCombo().select(0);
@ -266,7 +279,7 @@ public class TransactionList extends Composite {
searchPropComboViewer.setInput(attrNames);
searchPropComboViewer.setSelection(new StructuredSelection(searchPropComboViewer.getElementAt(0)));
}
treeViewer.refresh(true);
tableViewer.refresh(true);
}
});
}

View File

@ -72,6 +72,13 @@ public class AttributeLabelProvider extends LabelProvider implements IStyledLabe
return new StyledString(iTx.getId().toString());
case TX_TIME:
return new StyledString(waveformViewerPart.getScaledTime(iTx.getBeginTime()));
case TYPE:
if(showProp!=null){
List<ITxAttribute> res = iTx.getAttributes().stream().filter(a -> showProp.equals(a.getName())).collect(Collectors.toList());
if(res.size()==1)
return new StyledString(res.get(0).getDataType().toString());
}
return new StyledString("");
case VALUE:
if(showProp!=null){
List<ITxAttribute> res = iTx.getAttributes().stream().filter(a -> showProp.equals(a.getName())).collect(Collectors.toList());
@ -95,13 +102,21 @@ public class AttributeLabelProvider extends LabelProvider implements IStyledLabe
} else
return new StyledString(element.toString());
case TYPE:
if (element instanceof ITxAttribute) {
if(element instanceof TransactionTreeNode) {
if(showProp!=null){
ITx iTx = ((TransactionTreeNode) element).element;
List<ITxAttribute> res = iTx.getAttributes().stream().filter(a -> showProp.equals(a.getName())).collect(Collectors.toList());
if(res.size()==1)
return new StyledString(res.get(0).getDataType().toString());
}
return new StyledString("");
} else if (element instanceof ITxAttribute) {
ITxAttribute attribute = (ITxAttribute) element;
return new StyledString(attribute.getDataType().toString());
}else if(element instanceof Object[]){
} else if(element instanceof Object[]){
Object[] elements = (Object[]) element;
return new StyledString(elements[field].toString());
}else
} else
return new StyledString(""); //$NON-NLS-1$
case TX_TIME:
if(element instanceof TransactionTreeNode) {
@ -120,7 +135,7 @@ public class AttributeLabelProvider extends LabelProvider implements IStyledLabe
} else if (element instanceof ITxAttribute) {
ITxAttribute attribute = (ITxAttribute) element;
return getAttrValueAsStyledString(attribute);
}else if(element instanceof Object[]){
} else if(element instanceof Object[]){
Object[] elements = (Object[]) element;
Object o = elements[field];
if(o instanceof ITx) {

View File

@ -10,7 +10,7 @@
<relativePath>../..</relativePath>
</parent>
<artifactId>com.minres.scviewer.e4.product</artifactId>
<version>2.9.1-SNAPSHOT</version>
<version>2.9.2-SNAPSHOT</version>
<packaging>eclipse-repository</packaging>
<groupId>com.minres.scviewer</groupId>
<build>

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<?pde version="3.5"?>
<product name="SCViewer" uid="product" id="com.minres.scviewer.e4.application.product" application="org.eclipse.e4.ui.workbench.swt.E4Application" version="2.9.1.qualifier" useFeatures="true" includeLaunchers="true">
<product name="SCViewer" uid="product" id="com.minres.scviewer.e4.application.product" application="org.eclipse.e4.ui.workbench.swt.E4Application" version="2.9.2.qualifier" useFeatures="true" includeLaunchers="true">
<configIni use="default">
</configIni>

View File

@ -10,7 +10,7 @@
<relativePath>../..</relativePath>
</parent>
<artifactId>com.minres.scviewer.e4.product_slim</artifactId>
<version>2.9.1-SNAPSHOT</version>
<version>2.9.2-SNAPSHOT</version>
<packaging>eclipse-repository</packaging>
<groupId>com.minres.scviewer</groupId>
<build>

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<?pde version="3.5"?>
<product name="SCViewer" uid="product_slim" id="com.minres.scviewer.e4.application.product_slim" application="org.eclipse.e4.ui.workbench.swt.E4Application" version="2.9.1.qualifier" useFeatures="false" includeLaunchers="true">
<product name="SCViewer" uid="product_slim" id="com.minres.scviewer.e4.application.product_slim" application="org.eclipse.e4.ui.workbench.swt.E4Application" version="2.9.2.qualifier" useFeatures="false" includeLaunchers="true">
<configIni use="default">
</configIni>