adapt UI
This commit is contained in:
parent
21d83f93dc
commit
90f09cc222
|
@ -14,6 +14,7 @@ import com.minres.scviewer.database.EventKind;
|
||||||
import com.minres.scviewer.database.IEvent;
|
import com.minres.scviewer.database.IEvent;
|
||||||
import com.minres.scviewer.database.ITx;
|
import com.minres.scviewer.database.ITx;
|
||||||
import com.minres.scviewer.database.ITxEvent;
|
import com.minres.scviewer.database.ITxEvent;
|
||||||
|
import com.minres.scviewer.database.WaveformType;
|
||||||
|
|
||||||
public class TxEvent implements ITxEvent {
|
public class TxEvent implements ITxEvent {
|
||||||
|
|
||||||
|
@ -52,7 +53,7 @@ public class TxEvent implements ITxEvent {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Class<?> getType() {
|
public WaveformType getType() {
|
||||||
return TxEvent.class;
|
return WaveformType.TRANSACTION;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,6 +28,7 @@ import com.minres.scviewer.database.ITxGenerator;
|
||||||
import com.minres.scviewer.database.IWaveform;
|
import com.minres.scviewer.database.IWaveform;
|
||||||
import com.minres.scviewer.database.IWaveformDb;
|
import com.minres.scviewer.database.IWaveformDb;
|
||||||
import com.minres.scviewer.database.RelationType;
|
import com.minres.scviewer.database.RelationType;
|
||||||
|
import com.minres.scviewer.database.WaveformType;
|
||||||
import com.minres.scviewer.database.sqlite.db.IDatabase;
|
import com.minres.scviewer.database.sqlite.db.IDatabase;
|
||||||
import com.minres.scviewer.database.sqlite.db.SQLiteDatabaseSelectHandler;
|
import com.minres.scviewer.database.sqlite.db.SQLiteDatabaseSelectHandler;
|
||||||
import com.minres.scviewer.database.sqlite.tables.ScvGenerator;
|
import com.minres.scviewer.database.sqlite.tables.ScvGenerator;
|
||||||
|
@ -77,11 +78,6 @@ public class TxStream extends HierNode implements IWaveform {
|
||||||
return (long) scvStream.getId();
|
return (long) scvStream.getId();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getKind() {
|
|
||||||
return scvStream.getKind();
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<ITxGenerator> getGenerators() {
|
public List<ITxGenerator> getGenerators() {
|
||||||
if(generators==null){
|
if(generators==null){
|
||||||
SQLiteDatabaseSelectHandler<ScvGenerator> handler = new SQLiteDatabaseSelectHandler<ScvGenerator>(
|
SQLiteDatabaseSelectHandler<ScvGenerator> handler = new SQLiteDatabaseSelectHandler<ScvGenerator>(
|
||||||
|
@ -100,7 +96,7 @@ public class TxStream extends HierNode implements IWaveform {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMaxConcurrency() {
|
public int getWidth() {
|
||||||
if(maxConcurrency==null){
|
if(maxConcurrency==null){
|
||||||
java.sql.Connection connection=null;
|
java.sql.Connection connection=null;
|
||||||
java.sql.Statement statement=null;
|
java.sql.Statement statement=null;
|
||||||
|
@ -205,8 +201,8 @@ public class TxStream extends HierNode implements IWaveform {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Class<?> getType() {
|
public WaveformType getType() {
|
||||||
return TxEvent.class;
|
return WaveformType.TRANSACTION;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -82,7 +82,7 @@ public class TextDbLoader implements IWaveformDbLoader{
|
||||||
.make()
|
.make()
|
||||||
// NPE here --->
|
// NPE here --->
|
||||||
parseInput(gzipped?new GZIPInputStream(new FileInputStream(file)):new FileInputStream(file))
|
parseInput(gzipped?new GZIPInputStream(new FileInputStream(file)):new FileInputStream(file))
|
||||||
streams.each{ TxStream stream -> stream.getMaxConcurrency() }
|
streams.each{ TxStream stream -> stream.getWidth() }
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
} catch (IndexOutOfBoundsException e) {
|
} catch (IndexOutOfBoundsException e) {
|
||||||
|
@ -97,6 +97,9 @@ public class TextDbLoader implements IWaveformDbLoader{
|
||||||
System.out.println("---->>> Exception "+e.toString()+" caught while loading database");
|
System.out.println("---->>> Exception "+e.toString()+" caught while loading database");
|
||||||
//System.out.println("---->>> Exception "+e.toString()+" caught while loading database. StackTrace following... ");
|
//System.out.println("---->>> Exception "+e.toString()+" caught while loading database. StackTrace following... ");
|
||||||
//e.printStackTrace()
|
//e.printStackTrace()
|
||||||
|
} catch(Error e) {
|
||||||
|
System.out.println("---->>> Exception "+e.toString()+" caught while loading database. StackTrace following... ");
|
||||||
|
e.printStackTrace()
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,7 @@ import com.minres.scviewer.database.ITxAttributeType
|
||||||
import com.minres.scviewer.database.ITxAttribute
|
import com.minres.scviewer.database.ITxAttribute
|
||||||
|
|
||||||
class TxAttributeTypeFactory {
|
class TxAttributeTypeFactory {
|
||||||
private static final instance = new TxAttributeTypeFactory()
|
static final TxAttributeTypeFactory instance = new TxAttributeTypeFactory()
|
||||||
|
|
||||||
def attributes = [:]
|
def attributes = [:]
|
||||||
|
|
||||||
|
|
|
@ -1,41 +0,0 @@
|
||||||
package com.minres.scviewer.database.text;
|
|
||||||
|
|
||||||
import com.minres.scviewer.database.EventKind
|
|
||||||
import com.minres.scviewer.database.ITx
|
|
||||||
import com.minres.scviewer.database.ITxEvent
|
|
||||||
|
|
||||||
class TxEvent implements ITxEvent {
|
|
||||||
|
|
||||||
final EventKind kind;
|
|
||||||
|
|
||||||
final Tx transaction;
|
|
||||||
|
|
||||||
final Long time
|
|
||||||
|
|
||||||
TxEvent(EventKind kind, ITx transaction) {
|
|
||||||
super();
|
|
||||||
this.kind = kind;
|
|
||||||
this.transaction = transaction;
|
|
||||||
this.time = kind==EventKind.BEGIN?transaction.beginTime:transaction.endTime
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
ITxEvent duplicate() throws CloneNotSupportedException {
|
|
||||||
new TxEvent(type, transaction, time)
|
|
||||||
}
|
|
||||||
|
|
||||||
// @Override
|
|
||||||
// int compareTo(IWaveformEvent o) {
|
|
||||||
// time.compareTo(o.time)
|
|
||||||
// }
|
|
||||||
|
|
||||||
@Override
|
|
||||||
String toString() {
|
|
||||||
kind.toString()+"@"+time+" of tx #"+transaction.id;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
Class<?> getType() {
|
|
||||||
return this.getClass();
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -0,0 +1,66 @@
|
||||||
|
package com.minres.scviewer.database.text;
|
||||||
|
|
||||||
|
import com.minres.scviewer.database.EventKind;
|
||||||
|
import com.minres.scviewer.database.ITx;
|
||||||
|
import com.minres.scviewer.database.ITxEvent;
|
||||||
|
import com.minres.scviewer.database.WaveformType;
|
||||||
|
|
||||||
|
class TxEvent implements ITxEvent {
|
||||||
|
|
||||||
|
final EventKind kind;
|
||||||
|
|
||||||
|
final ITx transaction;
|
||||||
|
|
||||||
|
final Long time;
|
||||||
|
|
||||||
|
TxEvent(EventKind kind, ITx transaction) {
|
||||||
|
super();
|
||||||
|
this.kind = kind;
|
||||||
|
this.transaction = transaction;
|
||||||
|
this.time = kind==EventKind.BEGIN?transaction.getBeginTime():transaction.getEndTime();
|
||||||
|
}
|
||||||
|
|
||||||
|
public TxEvent(EventKind kind, ITx transaction, Long time) {
|
||||||
|
super();
|
||||||
|
this.kind = kind;
|
||||||
|
this.transaction = transaction;
|
||||||
|
this.time = time;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public
|
||||||
|
ITxEvent duplicate() throws CloneNotSupportedException {
|
||||||
|
return new TxEvent(kind, transaction, time);
|
||||||
|
}
|
||||||
|
|
||||||
|
// @Override
|
||||||
|
// int compareTo(IWaveformEvent o) {
|
||||||
|
// time.compareTo(o.time)
|
||||||
|
// }
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public
|
||||||
|
String toString() {
|
||||||
|
return kind.toString()+"@"+time+" of tx #"+transaction.getId();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public WaveformType getType() {
|
||||||
|
return WaveformType.TRANSACTION;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public EventKind getKind() {
|
||||||
|
return kind;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Long getTime() {
|
||||||
|
return time;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ITx getTransaction() {
|
||||||
|
return transaction;
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,16 +1,15 @@
|
||||||
package com.minres.scviewer.database.text
|
package com.minres.scviewer.database.text;
|
||||||
|
|
||||||
import com.minres.scviewer.database.ITxRelation
|
import com.minres.scviewer.database.ITxRelation;
|
||||||
import com.minres.scviewer.database.ITx;
|
import com.minres.scviewer.database.ITx;
|
||||||
import com.minres.scviewer.database.RelationType;
|
import com.minres.scviewer.database.RelationType;
|
||||||
|
|
||||||
class TxRelation implements ITxRelation {
|
class TxRelation implements ITxRelation {
|
||||||
Tx source
|
final Tx source;
|
||||||
|
|
||||||
Tx target
|
final Tx target;
|
||||||
|
|
||||||
RelationType relationType
|
|
||||||
|
|
||||||
|
final RelationType relationType;
|
||||||
|
|
||||||
public TxRelation(RelationType relationType, Tx source, Tx target) {
|
public TxRelation(RelationType relationType, Tx source, Tx target) {
|
||||||
this.source = source;
|
this.source = source;
|
|
@ -23,6 +23,7 @@ import org.mapdb.Serializer
|
||||||
import com.minres.scviewer.database.ITxEvent;
|
import com.minres.scviewer.database.ITxEvent;
|
||||||
import com.minres.scviewer.database.IWaveform;
|
import com.minres.scviewer.database.IWaveform;
|
||||||
import com.minres.scviewer.database.IWaveformDb
|
import com.minres.scviewer.database.IWaveformDb
|
||||||
|
import com.minres.scviewer.database.WaveformType
|
||||||
import com.minres.scviewer.database.ITxGenerator
|
import com.minres.scviewer.database.ITxGenerator
|
||||||
import com.minres.scviewer.database.EventKind
|
import com.minres.scviewer.database.EventKind
|
||||||
import com.minres.scviewer.database.HierNode;
|
import com.minres.scviewer.database.HierNode;
|
||||||
|
@ -38,8 +39,6 @@ class TxStream extends HierNode implements IWaveform {
|
||||||
|
|
||||||
String fullName
|
String fullName
|
||||||
|
|
||||||
String kind
|
|
||||||
|
|
||||||
def generators = []
|
def generators = []
|
||||||
|
|
||||||
int maxConcurrency
|
int maxConcurrency
|
||||||
|
@ -51,7 +50,6 @@ class TxStream extends HierNode implements IWaveform {
|
||||||
this.id=id
|
this.id=id
|
||||||
this.database=loader.db
|
this.database=loader.db
|
||||||
this.fullName=name
|
this.fullName=name
|
||||||
this.kind=kind
|
|
||||||
this.maxConcurrency=0
|
this.maxConcurrency=0
|
||||||
//events = new TreeMap<Long, List<ITxEvent>>()
|
//events = new TreeMap<Long, List<ITxEvent>>()
|
||||||
events = loader.mapDb.treeMap(name).keySerializer(Serializer.LONG).createOrOpen();
|
events = loader.mapDb.treeMap(name).keySerializer(Serializer.LONG).createOrOpen();
|
||||||
|
@ -67,7 +65,7 @@ class TxStream extends HierNode implements IWaveform {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMaxConcurrency() {
|
public int getWidth() {
|
||||||
if(!maxConcurrency){
|
if(!maxConcurrency){
|
||||||
generators.each {TxGenerator generator ->
|
generators.each {TxGenerator generator ->
|
||||||
generator.transactions.each{ Tx tx ->
|
generator.transactions.each{ Tx tx ->
|
||||||
|
@ -97,9 +95,12 @@ class TxStream extends HierNode implements IWaveform {
|
||||||
|
|
||||||
private putEvent(ITxEvent event){
|
private putEvent(ITxEvent event){
|
||||||
if(!events.containsKey(event.time))
|
if(!events.containsKey(event.time))
|
||||||
events.put(event.time, [event])
|
events.put(event.time, [event] as IEvent[])
|
||||||
else
|
else {
|
||||||
events[event.time]<<event
|
def entries = events[event.time] as List
|
||||||
|
entries<<event
|
||||||
|
events.put(event.time, entries as IEvent[])
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -127,8 +128,8 @@ class TxStream extends HierNode implements IWaveform {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Class<?> getType() {
|
public WaveformType getType() {
|
||||||
return TxEvent.class;
|
return WaveformType.TRANSACTION;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,9 +13,6 @@ package com.minres.scviewer.database.ui;
|
||||||
|
|
||||||
import java.awt.Color;
|
import java.awt.Color;
|
||||||
|
|
||||||
import com.minres.scviewer.database.ISignal;
|
|
||||||
import com.minres.scviewer.database.ITxEvent;
|
|
||||||
import com.minres.scviewer.database.ITxStream;
|
|
||||||
import com.minres.scviewer.database.IWaveform;
|
import com.minres.scviewer.database.IWaveform;
|
||||||
|
|
||||||
public class TrackEntry {
|
public class TrackEntry {
|
||||||
|
@ -105,20 +102,8 @@ public class TrackEntry {
|
||||||
signalColors[1] = highlightedFallbackColor;
|
signalColors[1] = highlightedFallbackColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isStream(){
|
public IWaveform getWaveform(){
|
||||||
return waveform instanceof ITxStream<?>;
|
return waveform;
|
||||||
}
|
|
||||||
|
|
||||||
public ITxStream<? extends ITxEvent> getStream(){
|
|
||||||
return (ITxStream<?>) waveform;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isSignal(){
|
|
||||||
return waveform instanceof ISignal<?>;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ISignal<?> getSignal(){
|
|
||||||
return (ISignal<?>) waveform;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -23,7 +23,6 @@ import org.eclipse.swt.widgets.Display;
|
||||||
|
|
||||||
import com.minres.scviewer.database.ITx;
|
import com.minres.scviewer.database.ITx;
|
||||||
import com.minres.scviewer.database.ITxRelation;
|
import com.minres.scviewer.database.ITxRelation;
|
||||||
import com.minres.scviewer.database.ITxStream;
|
|
||||||
import com.minres.scviewer.database.RelationType;
|
import com.minres.scviewer.database.RelationType;
|
||||||
import com.minres.scviewer.database.ui.WaveformColors;
|
import com.minres.scviewer.database.ui.WaveformColors;
|
||||||
|
|
||||||
|
@ -83,14 +82,13 @@ public class ArrowPainter implements IPainter {
|
||||||
deferUpdate = false;
|
deferUpdate = false;
|
||||||
iRect.clear();
|
iRect.clear();
|
||||||
oRect.clear();
|
oRect.clear();
|
||||||
ITxStream<?> stream = tx.getStream();
|
IWaveformPainter painter = waveCanvas.wave2painterMap.get(tx.getStream());
|
||||||
IWaveformPainter painter = waveCanvas.wave2painterMap.get(stream);
|
|
||||||
if (painter == null) { // stream has been added but painter not yet
|
if (painter == null) { // stream has been added but painter not yet
|
||||||
// created
|
// created
|
||||||
deferUpdate = true;
|
deferUpdate = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
int laneHeight = painter.getHeight() / stream.getMaxConcurrency();
|
int laneHeight = painter.getHeight() / tx.getStream().getWidth();
|
||||||
txRectangle = new Rectangle((int) (tx.getBeginTime() / scaleFactor),
|
txRectangle = new Rectangle((int) (tx.getBeginTime() / scaleFactor),
|
||||||
waveCanvas.rulerHeight + painter.getVerticalOffset() + laneHeight * tx.getConcurrencyIndex(),
|
waveCanvas.rulerHeight + painter.getVerticalOffset() + laneHeight * tx.getConcurrencyIndex(),
|
||||||
(int) ((tx.getEndTime() - tx.getBeginTime()) / scaleFactor), laneHeight);
|
(int) ((tx.getEndTime() - tx.getBeginTime()) / scaleFactor), laneHeight);
|
||||||
|
@ -102,9 +100,8 @@ public class ArrowPainter implements IPainter {
|
||||||
for (ITxRelation iTxRelation : relations) {
|
for (ITxRelation iTxRelation : relations) {
|
||||||
ITx otherTx = useTarget ? iTxRelation.getTarget() : iTxRelation.getSource();
|
ITx otherTx = useTarget ? iTxRelation.getTarget() : iTxRelation.getSource();
|
||||||
if (waveCanvas.wave2painterMap.containsKey(otherTx.getStream())) {
|
if (waveCanvas.wave2painterMap.containsKey(otherTx.getStream())) {
|
||||||
ITxStream<?> stream = otherTx.getStream();
|
IWaveformPainter painter = waveCanvas.wave2painterMap.get(otherTx.getStream());
|
||||||
IWaveformPainter painter = waveCanvas.wave2painterMap.get(stream);
|
int laneHeight = painter.getHeight() / tx.getStream().getWidth();
|
||||||
int laneHeight = painter.getHeight() / stream.getMaxConcurrency();
|
|
||||||
Rectangle bb = new Rectangle((int) (otherTx.getBeginTime() / scaleFactor),
|
Rectangle bb = new Rectangle((int) (otherTx.getBeginTime() / scaleFactor),
|
||||||
waveCanvas.rulerHeight + painter.getVerticalOffset()
|
waveCanvas.rulerHeight + painter.getVerticalOffset()
|
||||||
+ laneHeight * otherTx.getConcurrencyIndex(),
|
+ laneHeight * otherTx.getConcurrencyIndex(),
|
||||||
|
|
|
@ -24,26 +24,28 @@ import org.eclipse.swt.graphics.Point;
|
||||||
import org.eclipse.swt.graphics.Rectangle;
|
import org.eclipse.swt.graphics.Rectangle;
|
||||||
|
|
||||||
import com.minres.scviewer.database.BitVector;
|
import com.minres.scviewer.database.BitVector;
|
||||||
import com.minres.scviewer.database.ISignal;
|
import com.minres.scviewer.database.DoubleVal;
|
||||||
|
import com.minres.scviewer.database.IEvent;
|
||||||
|
import com.minres.scviewer.database.IWaveform;
|
||||||
import com.minres.scviewer.database.ui.TrackEntry;
|
import com.minres.scviewer.database.ui.TrackEntry;
|
||||||
import com.minres.scviewer.database.ui.WaveformColors;
|
import com.minres.scviewer.database.ui.WaveformColors;
|
||||||
|
|
||||||
public class SignalPainter extends TrackPainter {
|
public class SignalPainter extends TrackPainter {
|
||||||
private class SignalChange {
|
private class SignalChange {
|
||||||
long time;
|
long time;
|
||||||
Object value;
|
IEvent value;
|
||||||
boolean fromMap;
|
boolean fromMap;
|
||||||
|
|
||||||
public SignalChange(Entry<Long, ?> entry) {
|
public SignalChange(Entry<Long, IEvent[]> entry) {
|
||||||
time = entry.getKey();
|
time = entry.getKey();
|
||||||
value = entry.getValue();
|
value = entry.getValue()[0];
|
||||||
fromMap = true;
|
fromMap = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void set(Entry<Long, ?> entry, Long actTime) {
|
public void set(Entry<Long, IEvent[]> entry, Long actTime) {
|
||||||
if (entry != null) {
|
if (entry != null) {
|
||||||
time = entry.getKey();
|
time = entry.getKey();
|
||||||
value = entry.getValue();
|
value = entry.getValue()[0];
|
||||||
fromMap = true;
|
fromMap = true;
|
||||||
} else {
|
} else {
|
||||||
time = actTime;
|
time = actTime;
|
||||||
|
@ -84,7 +86,7 @@ public class SignalPainter extends TrackPainter {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void paintArea(Projection proj, Rectangle area) {
|
public void paintArea(Projection proj, Rectangle area) {
|
||||||
ISignal<?> signal = trackEntry.getSignal();
|
IWaveform signal = trackEntry.waveform;
|
||||||
if (trackEntry.selected)
|
if (trackEntry.selected)
|
||||||
proj.setBackground(this.waveCanvas.colors[WaveformColors.TRACK_BG_HIGHLITE.ordinal()]);
|
proj.setBackground(this.waveCanvas.colors[WaveformColors.TRACK_BG_HIGHLITE.ordinal()]);
|
||||||
else
|
else
|
||||||
|
@ -97,8 +99,8 @@ public class SignalPainter extends TrackPainter {
|
||||||
long beginTime = beginPos*scaleFactor;
|
long beginTime = beginPos*scaleFactor;
|
||||||
long endTime = beginTime + area.width*scaleFactor;
|
long endTime = beginTime + area.width*scaleFactor;
|
||||||
|
|
||||||
Entry<Long, ?> first = signal.getEvents().floorEntry(beginTime);
|
Entry<Long, IEvent[]> first = signal.getEvents().floorEntry(beginTime);
|
||||||
Entry<Long, ?> last = signal.getEvents().floorEntry(endTime);
|
Entry<Long, IEvent[]> last = signal.getEvents().floorEntry(endTime);
|
||||||
if (first == null) {
|
if (first == null) {
|
||||||
if (last == null)
|
if (last == null)
|
||||||
return;
|
return;
|
||||||
|
@ -109,7 +111,7 @@ public class SignalPainter extends TrackPainter {
|
||||||
proj.setForeground(this.waveCanvas.colors[WaveformColors.LINE.ordinal()]);
|
proj.setForeground(this.waveCanvas.colors[WaveformColors.LINE.ordinal()]);
|
||||||
proj.setLineStyle(SWT.LINE_SOLID);
|
proj.setLineStyle(SWT.LINE_SOLID);
|
||||||
proj.setLineWidth(1);
|
proj.setLineWidth(1);
|
||||||
NavigableMap<Long, ?> entries = signal.getEvents().subMap(first.getKey(), false, last.getKey(), true);
|
NavigableMap<Long, IEvent[]> entries = signal.getEvents().subMap(first.getKey(), false, last.getKey(), true);
|
||||||
SignalChange left = new SignalChange(first);
|
SignalChange left = new SignalChange(first);
|
||||||
SignalChange right = new SignalChange(entries.size() > 0 ? entries.firstEntry() : first);
|
SignalChange right = new SignalChange(entries.size() > 0 ? entries.firstEntry() : first);
|
||||||
maxPosX = area.x + area.width;
|
maxPosX = area.x + area.width;
|
||||||
|
@ -150,7 +152,7 @@ public class SignalPainter extends TrackPainter {
|
||||||
if (xSigChangeEndPos == xSigChangeBeginPos) {
|
if (xSigChangeEndPos == xSigChangeBeginPos) {
|
||||||
multiple = true;
|
multiple = true;
|
||||||
long eTime = (xSigChangeBeginPos + 1) * this.waveCanvas.getScaleFactor();
|
long eTime = (xSigChangeBeginPos + 1) * this.waveCanvas.getScaleFactor();
|
||||||
Entry<Long, ?> entry = entries.floorEntry(eTime);
|
Entry<Long, IEvent[]> entry = entries.floorEntry(eTime);
|
||||||
if(entry!=null && entry.getKey()> right.time)
|
if(entry!=null && entry.getKey()> right.time)
|
||||||
right.set(entry, endTime);
|
right.set(entry, endTime);
|
||||||
xSigChangeEndPos = getXPosEnd(eTime);
|
xSigChangeEndPos = getXPosEnd(eTime);
|
||||||
|
@ -158,8 +160,8 @@ public class SignalPainter extends TrackPainter {
|
||||||
} while (left.time < endTime);
|
} while (left.time < endTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
private SignalStencil getStencil(GC gc, SignalChange left, NavigableMap<Long, ?> entries) {
|
private SignalStencil getStencil(GC gc, SignalChange left, NavigableMap<Long, IEvent[]> entries) {
|
||||||
Object val = left.value;
|
IEvent val = left.value;
|
||||||
if(val instanceof BitVector) {
|
if(val instanceof BitVector) {
|
||||||
BitVector bv = (BitVector) val;
|
BitVector bv = (BitVector) val;
|
||||||
if(bv.getWidth()==1)
|
if(bv.getWidth()==1)
|
||||||
|
@ -170,7 +172,7 @@ public class SignalPainter extends TrackPainter {
|
||||||
return new MultiBitStencilAnalog(entries, left.value,
|
return new MultiBitStencilAnalog(entries, left.value,
|
||||||
trackEntry.waveDisplay==TrackEntry.WaveDisplay.CONTINOUS,
|
trackEntry.waveDisplay==TrackEntry.WaveDisplay.CONTINOUS,
|
||||||
trackEntry.valueDisplay==TrackEntry.ValueDisplay.SIGNED);
|
trackEntry.valueDisplay==TrackEntry.ValueDisplay.SIGNED);
|
||||||
} else if (val instanceof Double)
|
} else if (val instanceof DoubleVal)
|
||||||
return new RealStencil(entries, left.value, trackEntry.waveDisplay==TrackEntry.WaveDisplay.CONTINOUS);
|
return new RealStencil(entries, left.value, trackEntry.waveDisplay==TrackEntry.WaveDisplay.CONTINOUS);
|
||||||
else
|
else
|
||||||
return null;
|
return null;
|
||||||
|
@ -178,7 +180,7 @@ public class SignalPainter extends TrackPainter {
|
||||||
|
|
||||||
private interface SignalStencil {
|
private interface SignalStencil {
|
||||||
|
|
||||||
public void draw(Projection proj, Rectangle area, Object left, Object right, int xBegin, int xEnd, boolean multiple);
|
public void draw(Projection proj, Rectangle area, IEvent left, IEvent right, int xBegin, int xEnd, boolean multiple);
|
||||||
}
|
}
|
||||||
|
|
||||||
private class MultiBitStencil implements SignalStencil {
|
private class MultiBitStencil implements SignalStencil {
|
||||||
|
@ -192,7 +194,7 @@ public class SignalPainter extends TrackPainter {
|
||||||
tmpAwtFont = new java.awt.Font(fd.getName(), fd.getStyle(), height);
|
tmpAwtFont = new java.awt.Font(fd.getName(), fd.getStyle(), height);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void draw(Projection proj, Rectangle area, Object left, Object right, int xBegin, int xEnd, boolean multiple) {
|
public void draw(Projection proj, Rectangle area, IEvent left, IEvent right, int xBegin, int xEnd, boolean multiple) {
|
||||||
Color colorBorder = waveCanvas.colors[WaveformColors.SIGNAL0.ordinal()];
|
Color colorBorder = waveCanvas.colors[WaveformColors.SIGNAL0.ordinal()];
|
||||||
BitVector last = (BitVector) left;
|
BitVector last = (BitVector) left;
|
||||||
if (last.getValue().toString().contains("X")) {
|
if (last.getValue().toString().contains("X")) {
|
||||||
|
@ -250,14 +252,15 @@ public class SignalPainter extends TrackPainter {
|
||||||
private long minVal;
|
private long minVal;
|
||||||
private long range;
|
private long range;
|
||||||
double yRange = (yOffsetB-yOffsetT);
|
double yRange = (yOffsetB-yOffsetT);
|
||||||
public MultiBitStencilAnalog(NavigableMap<Long, ?> entries, Object left, boolean continous, boolean signed) {
|
public MultiBitStencilAnalog(NavigableMap<Long, IEvent[]> entries, Object left, boolean continous, boolean signed) {
|
||||||
this.continous=continous;
|
this.continous=continous;
|
||||||
Collection<?> values = ((NavigableMap<Long, ?>) entries).values();
|
Collection<IEvent[]> values = entries.values();
|
||||||
minVal=((BitVector) left).toUnsignedValue();
|
minVal=((BitVector) left).toUnsignedValue();
|
||||||
range=2;
|
range=2;
|
||||||
if(!values.isEmpty()) {
|
if(!values.isEmpty()) {
|
||||||
long maxVal=minVal;
|
long maxVal=minVal;
|
||||||
for (Object e : entries.values()) {
|
for (IEvent[] tp : entries.values())
|
||||||
|
for(IEvent e: tp) {
|
||||||
long v = ((BitVector)e).toUnsignedValue();
|
long v = ((BitVector)e).toUnsignedValue();
|
||||||
maxVal=Math.max(maxVal, v);
|
maxVal=Math.max(maxVal, v);
|
||||||
minVal=Math.min(minVal, v);
|
minVal=Math.min(minVal, v);
|
||||||
|
@ -272,7 +275,7 @@ public class SignalPainter extends TrackPainter {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void draw(Projection proj, Rectangle area, Object left, Object right, int xBegin, int xEnd, boolean multiple) {
|
public void draw(Projection proj, Rectangle area, IEvent left, IEvent right, int xBegin, int xEnd, boolean multiple) {
|
||||||
long leftVal = ((BitVector) left).toUnsignedValue();
|
long leftVal = ((BitVector) left).toUnsignedValue();
|
||||||
long rightVal= ((BitVector) right).toUnsignedValue();
|
long rightVal= ((BitVector) right).toUnsignedValue();
|
||||||
proj.setForeground(waveCanvas.colors[WaveformColors.SIGNAL_REAL.ordinal()]);
|
proj.setForeground(waveCanvas.colors[WaveformColors.SIGNAL_REAL.ordinal()]);
|
||||||
|
@ -298,7 +301,7 @@ public class SignalPainter extends TrackPainter {
|
||||||
}
|
}
|
||||||
|
|
||||||
private class SingleBitStencil implements SignalStencil {
|
private class SingleBitStencil implements SignalStencil {
|
||||||
public void draw(Projection proj, Rectangle area, Object left, Object right, int xBegin, int xEnd, boolean multiple) {
|
public void draw(Projection proj, Rectangle area, IEvent left, IEvent right, int xBegin, int xEnd, boolean multiple) {
|
||||||
if (multiple) {
|
if (multiple) {
|
||||||
proj.setForeground(waveCanvas.colors[WaveformColors.SIGNALU.ordinal()]);
|
proj.setForeground(waveCanvas.colors[WaveformColors.SIGNALU.ordinal()]);
|
||||||
proj.drawLine(xBegin, yOffsetT, xBegin, yOffsetB);
|
proj.drawLine(xBegin, yOffsetT, xBegin, yOffsetB);
|
||||||
|
@ -351,9 +354,9 @@ public class SignalPainter extends TrackPainter {
|
||||||
|
|
||||||
boolean continous=true;
|
boolean continous=true;
|
||||||
|
|
||||||
public RealStencil(NavigableMap<Long, ?> entries, Object left, boolean continous) {
|
public RealStencil(NavigableMap<Long, IEvent[]> entries, Object left, boolean continous) {
|
||||||
this.continous=continous;
|
this.continous=continous;
|
||||||
Collection<?> values = ((NavigableMap<Long, ?>) entries).values();
|
Collection<IEvent[]> values = ((NavigableMap<Long, IEvent[]>) entries).values();
|
||||||
minVal=(Double) left;
|
minVal=(Double) left;
|
||||||
range=2.0;
|
range=2.0;
|
||||||
if(!values.isEmpty()) {
|
if(!values.isEmpty()) {
|
||||||
|
@ -378,9 +381,9 @@ public class SignalPainter extends TrackPainter {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void draw(Projection proj, Rectangle area, Object left, Object right, int xBegin, int xEnd, boolean multiple) {
|
public void draw(Projection proj, Rectangle area, IEvent left, IEvent right, int xBegin, int xEnd, boolean multiple) {
|
||||||
double leftVal = (Double) left;
|
double leftVal = ((DoubleVal) left).value;
|
||||||
double rightVal= (Double) right;
|
double rightVal= ((DoubleVal) right).value;
|
||||||
if(Double.isNaN(leftVal)) {
|
if(Double.isNaN(leftVal)) {
|
||||||
Color color = waveCanvas.colors[WaveformColors.SIGNAL_NAN.ordinal()];
|
Color color = waveCanvas.colors[WaveformColors.SIGNAL_NAN.ordinal()];
|
||||||
int width = xEnd - xBegin;
|
int width = xEnd - xBegin;
|
||||||
|
|
|
@ -11,7 +11,6 @@
|
||||||
package com.minres.scviewer.database.ui.swt.internal;
|
package com.minres.scviewer.database.ui.swt.internal;
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
import java.util.NavigableMap;
|
import java.util.NavigableMap;
|
||||||
import java.util.TreeSet;
|
import java.util.TreeSet;
|
||||||
|
@ -21,9 +20,11 @@ import org.eclipse.swt.graphics.GC;
|
||||||
import org.eclipse.swt.graphics.Point;
|
import org.eclipse.swt.graphics.Point;
|
||||||
import org.eclipse.swt.graphics.Rectangle;
|
import org.eclipse.swt.graphics.Rectangle;
|
||||||
|
|
||||||
|
import com.minres.scviewer.database.EventKind;
|
||||||
|
import com.minres.scviewer.database.IEvent;
|
||||||
import com.minres.scviewer.database.ITx;
|
import com.minres.scviewer.database.ITx;
|
||||||
import com.minres.scviewer.database.ITxEvent;
|
import com.minres.scviewer.database.ITxEvent;
|
||||||
import com.minres.scviewer.database.ITxStream;
|
import com.minres.scviewer.database.IWaveform;
|
||||||
import com.minres.scviewer.database.ui.TrackEntry;
|
import com.minres.scviewer.database.ui.TrackEntry;
|
||||||
import com.minres.scviewer.database.ui.WaveformColors;
|
import com.minres.scviewer.database.ui.WaveformColors;
|
||||||
|
|
||||||
|
@ -33,7 +34,7 @@ public class StreamPainter extends TrackPainter{
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
private final WaveformCanvas waveCanvas;
|
private final WaveformCanvas waveCanvas;
|
||||||
private ITxStream<? extends ITxEvent> stream;
|
private IWaveform stream;
|
||||||
private int txBase, txHeight;
|
private int txBase, txHeight;
|
||||||
private boolean even;
|
private boolean even;
|
||||||
private TreeSet<ITx> seenTx;
|
private TreeSet<ITx> seenTx;
|
||||||
|
@ -41,7 +42,7 @@ public class StreamPainter extends TrackPainter{
|
||||||
public StreamPainter(WaveformCanvas waveCanvas, boolean even, TrackEntry trackEntry) {
|
public StreamPainter(WaveformCanvas waveCanvas, boolean even, TrackEntry trackEntry) {
|
||||||
super(trackEntry, even);
|
super(trackEntry, even);
|
||||||
this.waveCanvas = waveCanvas;
|
this.waveCanvas = waveCanvas;
|
||||||
this.stream=trackEntry.getStream();
|
this.stream=trackEntry.waveform;
|
||||||
this.seenTx=new TreeSet<ITx>();
|
this.seenTx=new TreeSet<ITx>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -62,7 +63,7 @@ public class StreamPainter extends TrackPainter{
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public void paintArea(Projection proj, Rectangle area) {
|
public void paintArea(Projection proj, Rectangle area) {
|
||||||
if(stream.getEvents().size()==0) return;
|
if(stream.getEvents().size()==0) return;
|
||||||
int trackHeight=trackEntry.height/stream.getMaxConcurrency();
|
int trackHeight=trackEntry.height/stream.getWidth();
|
||||||
txBase=trackHeight/5;
|
txBase=trackHeight/5;
|
||||||
txHeight=trackHeight*3/5;
|
txHeight=trackHeight*3/5;
|
||||||
if(trackEntry.selected) {
|
if(trackEntry.selected) {
|
||||||
|
@ -95,15 +96,16 @@ public class StreamPainter extends TrackPainter{
|
||||||
drawTx(proj, area, txEvent.getTransaction(), false);
|
drawTx(proj, area, txEvent.getTransaction(), false);
|
||||||
}else{
|
}else{
|
||||||
seenTx.clear();
|
seenTx.clear();
|
||||||
NavigableMap<Long,?> entries = stream.getEvents().subMap(firstTx.getKey(), true, lastTx.getKey(), true);
|
NavigableMap<Long, IEvent[]> entries = stream.getEvents().subMap(firstTx.getKey(), true, lastTx.getKey(), true);
|
||||||
boolean highlighed=false;
|
boolean highlighed=false;
|
||||||
proj.setForeground(this.waveCanvas.colors[WaveformColors.LINE.ordinal()]);
|
proj.setForeground(this.waveCanvas.colors[WaveformColors.LINE.ordinal()]);
|
||||||
|
|
||||||
for(Entry<Long, ?> entry: entries.entrySet())
|
for(Entry<Long, IEvent[]> entry: entries.entrySet())
|
||||||
for(ITxEvent txEvent:(Collection<? extends ITxEvent>)entry.getValue()){
|
for(IEvent evt:entry.getValue()){
|
||||||
if(txEvent.getType()==ITxEvent.Type.BEGIN)
|
ITxEvent txEvent = (ITxEvent) evt;
|
||||||
|
if(txEvent.getKind()==EventKind.BEGIN)
|
||||||
seenTx.add(txEvent.getTransaction());
|
seenTx.add(txEvent.getTransaction());
|
||||||
if(txEvent.getType()==ITxEvent.Type.END){
|
if(txEvent.getKind()==EventKind.END){
|
||||||
ITx tx = txEvent.getTransaction();
|
ITx tx = txEvent.getTransaction();
|
||||||
highlighed|=waveCanvas.currentSelection!=null && waveCanvas.currentSelection.equals(tx);
|
highlighed|=waveCanvas.currentSelection!=null && waveCanvas.currentSelection.equals(tx);
|
||||||
drawTx(proj, area, tx, false);
|
drawTx(proj, area, tx, false);
|
||||||
|
@ -154,7 +156,7 @@ public class StreamPainter extends TrackPainter{
|
||||||
|
|
||||||
public ITx getClicked(Point point) {
|
public ITx getClicked(Point point) {
|
||||||
int lane=point.y/waveCanvas.getTrackHeight();
|
int lane=point.y/waveCanvas.getTrackHeight();
|
||||||
Entry<Long, List<ITxEvent>> firstTx=stream.getEvents().floorEntry(point.x*waveCanvas.getScaleFactor());
|
Entry<Long, IEvent[]> firstTx=stream.getEvents().floorEntry(point.x*waveCanvas.getScaleFactor());
|
||||||
if(firstTx!=null){
|
if(firstTx!=null){
|
||||||
do {
|
do {
|
||||||
ITx tx = getTxFromEntry(lane, point.x, firstTx);
|
ITx tx = getTxFromEntry(lane, point.x, firstTx);
|
||||||
|
@ -165,29 +167,33 @@ public class StreamPainter extends TrackPainter{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ITxStream<? extends ITxEvent> getStream() {
|
public IWaveform getStream() {
|
||||||
return stream;
|
return stream;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setStream(ITxStream<? extends ITxEvent> stream) {
|
public void setStream(IWaveform stream) {
|
||||||
this.stream = stream;
|
this.stream = stream;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected ITx getTxFromEntry(int lane, int offset, Entry<Long, List<ITxEvent>> firstTx) {
|
protected ITx getTxFromEntry(int lane, int offset, Entry<Long, IEvent[]> firstTx) {
|
||||||
long timePoint=offset*waveCanvas.getScaleFactor();
|
long timePoint=offset*waveCanvas.getScaleFactor();
|
||||||
for(ITxEvent evt:firstTx.getValue()){
|
for(IEvent evt:firstTx.getValue()){
|
||||||
ITx tx=evt.getTransaction();
|
if(evt instanceof ITxEvent) {
|
||||||
if(evt.getType()==ITxEvent.Type.BEGIN && tx.getConcurrencyIndex()==lane && tx.getBeginTime()<=timePoint && tx.getEndTime()>=timePoint){
|
ITx tx=((ITxEvent)evt).getTransaction();
|
||||||
return evt.getTransaction();
|
if(evt.getKind()==EventKind.BEGIN && tx.getConcurrencyIndex()==lane && tx.getBeginTime()<=timePoint && tx.getEndTime()>=timePoint){
|
||||||
|
return ((ITxEvent)evt).getTransaction();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// now with some fuzziness
|
// now with some fuzziness
|
||||||
timePoint=(offset-5)*waveCanvas.getScaleFactor();
|
timePoint=(offset-5)*waveCanvas.getScaleFactor();
|
||||||
long timePointHigh=(offset+5)*waveCanvas.getScaleFactor();
|
long timePointHigh=(offset+5)*waveCanvas.getScaleFactor();
|
||||||
for(ITxEvent evt:firstTx.getValue()){
|
for(IEvent evt:firstTx.getValue()){
|
||||||
ITx tx=evt.getTransaction();
|
if(evt instanceof ITxEvent) {
|
||||||
if(evt.getType()==ITxEvent.Type.BEGIN && tx.getConcurrencyIndex()==lane && tx.getBeginTime()<=timePointHigh && tx.getEndTime()>=timePoint){
|
ITx tx=((ITxEvent)evt).getTransaction();
|
||||||
return evt.getTransaction();
|
if(evt.getKind()==EventKind.BEGIN && tx.getConcurrencyIndex()==lane && tx.getBeginTime()<=timePointHigh && tx.getEndTime()>=timePoint){
|
||||||
|
return ((ITxEvent)evt).getTransaction();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
|
|
@ -16,6 +16,7 @@ import java.beans.PropertyChangeListener;
|
||||||
import java.beans.PropertyChangeSupport;
|
import java.beans.PropertyChangeSupport;
|
||||||
import java.text.DecimalFormat;
|
import java.text.DecimalFormat;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
@ -78,13 +79,15 @@ import org.eclipse.wb.swt.SWTResourceManager;
|
||||||
|
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
import com.minres.scviewer.database.BitVector;
|
import com.minres.scviewer.database.BitVector;
|
||||||
import com.minres.scviewer.database.ISignal;
|
import com.minres.scviewer.database.DoubleVal;
|
||||||
|
import com.minres.scviewer.database.EventKind;
|
||||||
|
import com.minres.scviewer.database.IEvent;
|
||||||
import com.minres.scviewer.database.ITx;
|
import com.minres.scviewer.database.ITx;
|
||||||
import com.minres.scviewer.database.ITxEvent;
|
import com.minres.scviewer.database.ITxEvent;
|
||||||
import com.minres.scviewer.database.ITxRelation;
|
import com.minres.scviewer.database.ITxRelation;
|
||||||
import com.minres.scviewer.database.ITxStream;
|
|
||||||
import com.minres.scviewer.database.IWaveform;
|
import com.minres.scviewer.database.IWaveform;
|
||||||
import com.minres.scviewer.database.RelationType;
|
import com.minres.scviewer.database.RelationType;
|
||||||
|
import com.minres.scviewer.database.WaveformType;
|
||||||
import com.minres.scviewer.database.ui.GotoDirection;
|
import com.minres.scviewer.database.ui.GotoDirection;
|
||||||
import com.minres.scviewer.database.ui.ICursor;
|
import com.minres.scviewer.database.ui.ICursor;
|
||||||
import com.minres.scviewer.database.ui.IWaveformView;
|
import com.minres.scviewer.database.ui.IWaveformView;
|
||||||
|
@ -251,17 +254,11 @@ public class WaveformView implements IWaveformView {
|
||||||
Entry<Long, ?> floorEntry=null, ceilEntry=null;
|
Entry<Long, ?> floorEntry=null, ceilEntry=null;
|
||||||
if(o instanceof TrackEntry){
|
if(o instanceof TrackEntry){
|
||||||
TrackEntry entry = (TrackEntry) o;
|
TrackEntry entry = (TrackEntry) o;
|
||||||
if(entry.waveform instanceof ISignal<?>){
|
NavigableMap<Long, IEvent[]> map = entry.waveform.getEvents();
|
||||||
NavigableMap<Long, ?> map = ((ISignal<?>)entry.waveform).getEvents();
|
|
||||||
floorEntry = map.floorEntry(time);
|
floorEntry = map.floorEntry(time);
|
||||||
ceilEntry = map.ceilingEntry(time);
|
ceilEntry = map.ceilingEntry(time);
|
||||||
} else if (entry.waveform instanceof ITxStream<?>){
|
|
||||||
NavigableMap<Long, ?> map = ((ITxStream<?>)entry.waveform).getEvents();
|
|
||||||
floorEntry = map.floorEntry(time);
|
|
||||||
ceilEntry = map.ceilingEntry(time);
|
|
||||||
}
|
|
||||||
} else if(o instanceof ITx){
|
} else if(o instanceof ITx){
|
||||||
NavigableMap<Long, ?> map = ((ITx)o).getStream().getEvents();
|
NavigableMap<Long, IEvent[]> map = ((ITx)o).getStream().getEvents();
|
||||||
floorEntry = map.floorEntry(time);
|
floorEntry = map.floorEntry(time);
|
||||||
ceilEntry = map.ceilingEntry(time);
|
ceilEntry = map.ceilingEntry(time);
|
||||||
}
|
}
|
||||||
|
@ -522,11 +519,11 @@ public class WaveformView implements IWaveformView {
|
||||||
for (TrackEntry streamEntry : streams) {
|
for (TrackEntry streamEntry : streams) {
|
||||||
streamEntry.height = waveformCanvas.getTrackHeight();
|
streamEntry.height = waveformCanvas.getTrackHeight();
|
||||||
streamEntry.vOffset=trackVerticalHeight;
|
streamEntry.vOffset=trackVerticalHeight;
|
||||||
if (streamEntry.isStream()) {
|
if (streamEntry.waveform.getType()==WaveformType.TRANSACTION) {
|
||||||
streamEntry.currentValue="";
|
streamEntry.currentValue="";
|
||||||
streamEntry.height *= streamEntry.getStream().getMaxConcurrency();
|
streamEntry.height *= streamEntry.waveform.getWidth();
|
||||||
painter = new StreamPainter(waveformCanvas, even, streamEntry);
|
painter = new StreamPainter(waveformCanvas, even, streamEntry);
|
||||||
} else if (streamEntry.isSignal()) {
|
} else if (streamEntry.waveform.getType()==WaveformType.SIGNAL) {
|
||||||
streamEntry.currentValue="---";
|
streamEntry.currentValue="---";
|
||||||
painter = new SignalPainter(waveformCanvas, even, streamEntry);
|
painter = new SignalPainter(waveformCanvas, even, streamEntry);
|
||||||
}
|
}
|
||||||
|
@ -563,11 +560,10 @@ public class WaveformView implements IWaveformView {
|
||||||
private void updateValueList(){
|
private void updateValueList(){
|
||||||
final Long time = getCursorTime();
|
final Long time = getCursorTime();
|
||||||
for(TrackEntry entry:streams){
|
for(TrackEntry entry:streams){
|
||||||
if(entry.isSignal()){
|
if(entry.waveform.getType() == WaveformType.SIGNAL){
|
||||||
ISignal<?> signal = (ISignal<?>) entry.waveform;
|
IEvent[] value = entry.waveform.getEventsBeforeTime(time);
|
||||||
Object value = signal.getWaveformValueBeforeTime(time);
|
if(value[0] instanceof BitVector){
|
||||||
if(value instanceof BitVector){
|
BitVector bv = (BitVector) value[0];
|
||||||
BitVector bv = (BitVector) value;
|
|
||||||
if(bv.getWidth()==1)
|
if(bv.getWidth()==1)
|
||||||
entry.currentValue="b'"+bv;
|
entry.currentValue="b'"+bv;
|
||||||
else {
|
else {
|
||||||
|
@ -583,27 +579,28 @@ public class WaveformView implements IWaveformView {
|
||||||
entry.currentValue="h'"+bv.toHexString();
|
entry.currentValue="h'"+bv.toHexString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if(value instanceof Double){
|
} else if(value[0] instanceof DoubleVal){
|
||||||
Double val = (Double) value;
|
Double val = ((DoubleVal) value[0]).value;
|
||||||
if(val>0.001)
|
if(val>0.001)
|
||||||
entry.currentValue=String.format("%1$,.3f", val);
|
entry.currentValue=String.format("%1$,.3f", val);
|
||||||
else
|
else
|
||||||
entry.currentValue=Double.toString(val);
|
entry.currentValue=Double.toString(val);
|
||||||
}
|
}
|
||||||
} else if(entry.isStream()){
|
} else if(entry.waveform.getType() == WaveformType.TRANSACTION){
|
||||||
ITxStream<?> stream = (ITxStream<?>) entry.waveform;
|
ITx[] resultsList = new ITx[entry.waveform.getWidth()];
|
||||||
ITx[] resultsList = new ITx[stream.getMaxConcurrency()];
|
Entry<Long, IEvent[]> firstTx=entry.waveform.getEvents().floorEntry(time);
|
||||||
Entry<Long, List<ITxEvent>> firstTx=stream.getEvents().floorEntry(time);
|
|
||||||
if(firstTx!=null){
|
if(firstTx!=null){
|
||||||
do {
|
do {
|
||||||
for(ITxEvent evt:firstTx.getValue()){
|
for(IEvent evt:firstTx.getValue()){
|
||||||
ITx tx=evt.getTransaction();
|
if(evt instanceof ITxEvent) {
|
||||||
if(evt.getType()==ITxEvent.Type.BEGIN && tx.getBeginTime()<=time && tx.getEndTime()>=time){
|
ITx tx=((ITxEvent)evt).getTransaction();
|
||||||
|
if(evt.getKind()==EventKind.BEGIN && tx.getBeginTime()<=time && tx.getEndTime()>=time){
|
||||||
if(resultsList[tx.getConcurrencyIndex()]==null)
|
if(resultsList[tx.getConcurrencyIndex()]==null)
|
||||||
resultsList[tx.getConcurrencyIndex()]= evt.getTransaction();
|
resultsList[tx.getConcurrencyIndex()]= ((ITxEvent)evt).getTransaction();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
firstTx=stream.getEvents().lowerEntry(firstTx.getKey());
|
}
|
||||||
|
firstTx=entry.waveform.getEvents().lowerEntry(firstTx.getKey());
|
||||||
}while(firstTx!=null && !isArrayFull(resultsList));
|
}while(firstTx!=null && !isArrayFull(resultsList));
|
||||||
entry.currentValue="";
|
entry.currentValue="";
|
||||||
boolean separator=false;
|
boolean separator=false;
|
||||||
|
@ -804,15 +801,14 @@ public class WaveformView implements IWaveformView {
|
||||||
else if(currentWaveformSelection.size()!=1) return;
|
else if(currentWaveformSelection.size()!=1) return;
|
||||||
if(selectedWaveform==null)
|
if(selectedWaveform==null)
|
||||||
selectedWaveform = currentWaveformSelection.get(1);
|
selectedWaveform = currentWaveformSelection.get(1);
|
||||||
if (selectedWaveform!=null && selectedWaveform.isStream() && currentTxSelection!=null) {
|
if (selectedWaveform!=null && selectedWaveform.waveform.getType()==WaveformType.TRANSACTION && currentTxSelection!=null) {
|
||||||
if(relationType.equals(IWaveformView.NEXT_PREV_IN_STREAM)){
|
if(relationType.equals(IWaveformView.NEXT_PREV_IN_STREAM)){
|
||||||
ITxStream<? extends ITxEvent> stream = selectedWaveform.getStream();
|
|
||||||
ITx transaction = null;
|
ITx transaction = null;
|
||||||
if (direction == GotoDirection.NEXT) {
|
if (direction == GotoDirection.NEXT) {
|
||||||
List<ITxEvent> thisEntryList = stream.getEvents().get(currentTxSelection.getBeginTime());
|
ITxEvent[] thisEntryList = (ITxEvent[]) selectedWaveform.waveform.getEvents().get(currentTxSelection.getBeginTime());
|
||||||
boolean meFound=false;
|
boolean meFound=false;
|
||||||
for (ITxEvent evt : thisEntryList) {
|
for (ITxEvent evt : thisEntryList) {
|
||||||
if (evt.getType() == ITxEvent.Type.BEGIN) {
|
if (evt.getKind() == EventKind.BEGIN) {
|
||||||
if(meFound){
|
if(meFound){
|
||||||
transaction = evt.getTransaction();
|
transaction = evt.getTransaction();
|
||||||
break;
|
break;
|
||||||
|
@ -821,42 +817,42 @@ public class WaveformView implements IWaveformView {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (transaction == null){
|
if (transaction == null){
|
||||||
Entry<Long, List<ITxEvent>> entry = stream.getEvents().higherEntry(currentTxSelection.getBeginTime());
|
Entry<Long, IEvent[]> entry = selectedWaveform.waveform.getEvents().higherEntry(currentTxSelection.getBeginTime());
|
||||||
if (entry != null) do {
|
if (entry != null) do {
|
||||||
for (ITxEvent evt : entry.getValue()) {
|
for (IEvent evt : entry.getValue()) {
|
||||||
if (evt.getType() == ITxEvent.Type.BEGIN) {
|
if (evt instanceof ITxEvent && evt.getKind() == EventKind.BEGIN) {
|
||||||
transaction = evt.getTransaction();
|
transaction = ((ITxEvent)evt).getTransaction();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (transaction == null)
|
if (transaction == null)
|
||||||
entry = stream.getEvents().higherEntry(entry.getKey());
|
entry = selectedWaveform.waveform.getEvents().higherEntry(entry.getKey());
|
||||||
} while (entry != null && transaction == null);
|
} while (entry != null && transaction == null);
|
||||||
}
|
}
|
||||||
} else if (direction == GotoDirection.PREV) {
|
} else if (direction == GotoDirection.PREV) {
|
||||||
List<ITxEvent> thisEntryList = stream.getEvents().get(currentTxSelection.getBeginTime());
|
IEvent[] thisEntryList = selectedWaveform.waveform.getEvents().get(currentTxSelection.getBeginTime());
|
||||||
boolean meFound=false;
|
boolean meFound=false;
|
||||||
for (ITxEvent evt : Lists.reverse(thisEntryList)) {
|
for (IEvent evt : Lists.reverse(Arrays.asList(thisEntryList))) {
|
||||||
if (evt.getType() == ITxEvent.Type.BEGIN) {
|
if (evt instanceof ITxEvent && evt.getKind() == EventKind.BEGIN) {
|
||||||
if(meFound){
|
if(meFound){
|
||||||
transaction = evt.getTransaction();
|
transaction = ((ITxEvent)evt).getTransaction();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
meFound|= evt.getTransaction().equals(currentTxSelection);
|
meFound|= ((ITxEvent)evt).getTransaction().equals(currentTxSelection);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (transaction == null){
|
if (transaction == null){
|
||||||
Entry<Long, List<ITxEvent>> entry = stream.getEvents().lowerEntry(currentTxSelection.getBeginTime());
|
Entry<Long, IEvent[]> entry = selectedWaveform.waveform.getEvents().lowerEntry(currentTxSelection.getBeginTime());
|
||||||
if (entry != null)
|
if (entry != null)
|
||||||
do {
|
do {
|
||||||
for (ITxEvent evt : Lists.reverse(entry.getValue())) {
|
for (IEvent evt : Lists.reverse(Arrays.asList(thisEntryList))) {
|
||||||
if (evt.getType() == ITxEvent.Type.BEGIN) {
|
if (evt instanceof ITxEvent && evt.getKind() == EventKind.BEGIN) {
|
||||||
transaction = evt.getTransaction();
|
transaction = ((ITxEvent)evt).getTransaction();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (transaction == null)
|
if (transaction == null)
|
||||||
entry = stream.getEvents().lowerEntry(entry.getKey());
|
entry = selectedWaveform.waveform.getEvents().lowerEntry(entry.getKey());
|
||||||
} while (entry != null && transaction == null);
|
} while (entry != null && transaction == null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -896,8 +892,8 @@ public class WaveformView implements IWaveformView {
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean streamsVisible(ITxRelation relation) {
|
private boolean streamsVisible(ITxRelation relation) {
|
||||||
final ITxStream<ITxEvent> src = relation.getSource().getStream();
|
final IWaveform src = relation.getSource().getStream();
|
||||||
final ITxStream<ITxEvent> tgt = relation.getTarget().getStream();
|
final IWaveform tgt = relation.getTarget().getStream();
|
||||||
return streams.stream().anyMatch(x -> x.waveform == src) && streams.stream().anyMatch(x -> x.waveform == tgt);
|
return streams.stream().anyMatch(x -> x.waveform == src) && streams.stream().anyMatch(x -> x.waveform == tgt);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -910,10 +906,10 @@ public class WaveformView implements IWaveformView {
|
||||||
TrackEntry sel = currentWaveformSelection.get(0);
|
TrackEntry sel = currentWaveformSelection.get(0);
|
||||||
long time = getCursorTime();
|
long time = getCursorTime();
|
||||||
NavigableMap<Long, ?> map=null;
|
NavigableMap<Long, ?> map=null;
|
||||||
if(sel.isStream()){
|
if(sel.waveform.getType()==WaveformType.TRANSACTION){
|
||||||
map=sel.getStream().getEvents();
|
map=sel.waveform.getEvents();
|
||||||
} else if(sel.isSignal()){
|
} else if(sel.waveform.getType()==WaveformType.SIGNAL){
|
||||||
map=sel.getSignal().getEvents();
|
map=sel.waveform.getEvents();
|
||||||
}
|
}
|
||||||
if(map!=null){
|
if(map!=null){
|
||||||
Entry<Long, ?> entry=direction==GotoDirection.PREV?map.lowerEntry(time):map.higherEntry(time);
|
Entry<Long, ?> entry=direction==GotoDirection.PREV?map.lowerEntry(time):map.higherEntry(time);
|
||||||
|
@ -981,15 +977,15 @@ public class WaveformView implements IWaveformView {
|
||||||
if (lastKey == firstKey) {
|
if (lastKey == firstKey) {
|
||||||
TrackEntry trackEntry=trackVerticalOffset.get(firstKey);
|
TrackEntry trackEntry=trackVerticalOffset.get(firstKey);
|
||||||
IWaveform w = trackEntry.waveform;
|
IWaveform w = trackEntry.waveform;
|
||||||
if (w instanceof ITxStream<?>)
|
if (w.getType()==WaveformType.TRANSACTION)
|
||||||
subArea.height *= ((ITxStream<?>) w).getMaxConcurrency();
|
subArea.height *= w.getWidth();
|
||||||
drawTextFormat(gc, subArea, firstKey, w.getFullName(), trackEntry.selected);
|
drawTextFormat(gc, subArea, firstKey, w.getFullName(), trackEntry.selected);
|
||||||
} else {
|
} else {
|
||||||
for (Entry<Integer, TrackEntry> entry : trackVerticalOffset.subMap(firstKey, true, lastKey, true).entrySet()) {
|
for (Entry<Integer, TrackEntry> entry : trackVerticalOffset.subMap(firstKey, true, lastKey, true).entrySet()) {
|
||||||
IWaveform w = entry.getValue().waveform;
|
IWaveform w = entry.getValue().waveform;
|
||||||
subArea.height = waveformCanvas.getTrackHeight();
|
subArea.height = waveformCanvas.getTrackHeight();
|
||||||
if (w instanceof ITxStream<?>)
|
if (w.getType()==WaveformType.TRANSACTION)
|
||||||
subArea.height *= ((ITxStream<?>) w).getMaxConcurrency();
|
subArea.height *= w.getWidth();
|
||||||
drawTextFormat(gc, subArea, entry.getKey(), w.getFullName(), entry.getValue().selected);
|
drawTextFormat(gc, subArea, entry.getKey(), w.getFullName(), entry.getValue().selected);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1008,16 +1004,16 @@ public class WaveformView implements IWaveformView {
|
||||||
if (lastKey == firstKey) {
|
if (lastKey == firstKey) {
|
||||||
TrackEntry trackEntry=trackVerticalOffset.get(firstKey);
|
TrackEntry trackEntry=trackVerticalOffset.get(firstKey);
|
||||||
IWaveform w = trackEntry.waveform;
|
IWaveform w = trackEntry.waveform;
|
||||||
if (w instanceof ITxStream<?>)
|
if (w.getType()==WaveformType.TRANSACTION)
|
||||||
subArea.height *= ((ITxStream<?>) w).getMaxConcurrency();
|
subArea.height *= w.getWidth();
|
||||||
drawValue(gc, subArea, firstKey, trackEntry.currentValue, trackEntry.selected);
|
drawValue(gc, subArea, firstKey, trackEntry.currentValue, trackEntry.selected);
|
||||||
} else {
|
} else {
|
||||||
for (Entry<Integer, TrackEntry> entry : trackVerticalOffset.subMap(firstKey, true, lastKey, true)
|
for (Entry<Integer, TrackEntry> entry : trackVerticalOffset.subMap(firstKey, true, lastKey, true)
|
||||||
.entrySet()) {
|
.entrySet()) {
|
||||||
IWaveform w = entry.getValue().waveform;
|
IWaveform w = entry.getValue().waveform;
|
||||||
subArea.height = waveformCanvas.getTrackHeight();
|
subArea.height = waveformCanvas.getTrackHeight();
|
||||||
if (w instanceof ITxStream<?>)
|
if (w.getType()==WaveformType.TRANSACTION)
|
||||||
subArea.height *= ((ITxStream<?>) w).getMaxConcurrency();
|
subArea.height *= w.getWidth();
|
||||||
drawValue(gc, subArea, entry.getKey(), entry.getValue().currentValue, entry.getValue().selected);
|
drawValue(gc, subArea, entry.getKey(), entry.getValue().currentValue, entry.getValue().selected);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,6 +18,7 @@ import com.minres.scviewer.database.HierNode;
|
||||||
import com.minres.scviewer.database.IEvent;
|
import com.minres.scviewer.database.IEvent;
|
||||||
import com.minres.scviewer.database.IWaveform;
|
import com.minres.scviewer.database.IWaveform;
|
||||||
import com.minres.scviewer.database.IWaveformDb;
|
import com.minres.scviewer.database.IWaveformDb;
|
||||||
|
import com.minres.scviewer.database.WaveformType;
|
||||||
|
|
||||||
public class VCDSignal<T extends IEvent> extends HierNode implements IWaveform {
|
public class VCDSignal<T extends IEvent> extends HierNode implements IWaveform {
|
||||||
|
|
||||||
|
@ -25,12 +26,8 @@ public class VCDSignal<T extends IEvent> extends HierNode implements IWaveform {
|
||||||
|
|
||||||
private String fullName;
|
private String fullName;
|
||||||
|
|
||||||
private final String kind = "signal";
|
|
||||||
|
|
||||||
private final int width;
|
private final int width;
|
||||||
|
|
||||||
private final T dummy = null;
|
|
||||||
|
|
||||||
private IWaveformDb db;
|
private IWaveformDb db;
|
||||||
|
|
||||||
private NavigableMap<Long, IEvent[]> values;
|
private NavigableMap<Long, IEvent[]> values;
|
||||||
|
@ -77,15 +74,6 @@ public class VCDSignal<T extends IEvent> extends HierNode implements IWaveform {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getKind() {
|
|
||||||
return kind;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getWidth() {
|
|
||||||
return width;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IWaveformDb getDb() {
|
public IWaveformDb getDb() {
|
||||||
return db;
|
return db;
|
||||||
|
@ -128,13 +116,13 @@ public class VCDSignal<T extends IEvent> extends HierNode implements IWaveform {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Class<?> getType() {
|
public WaveformType getType() {
|
||||||
return dummy.getClass();
|
return WaveformType.SIGNAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getMaxConcurrency() {
|
public int getWidth() {
|
||||||
return 1;
|
return width;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -173,8 +173,8 @@ public class BitVector implements IEvent {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Class<?> getType() {
|
public WaveformType getType() {
|
||||||
return this.getClass();
|
return WaveformType.SIGNAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -2,7 +2,7 @@ package com.minres.scviewer.database;
|
||||||
|
|
||||||
public class DoubleVal implements IEvent {
|
public class DoubleVal implements IEvent {
|
||||||
|
|
||||||
final double value;
|
public final double value;
|
||||||
|
|
||||||
public DoubleVal(double value) {
|
public DoubleVal(double value) {
|
||||||
this.value=value;
|
this.value=value;
|
||||||
|
@ -14,8 +14,8 @@ public class DoubleVal implements IEvent {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Class<?> getType() {
|
public WaveformType getType() {
|
||||||
return this.getClass();
|
return WaveformType.SIGNAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -6,6 +6,6 @@ public interface IEvent {
|
||||||
|
|
||||||
public EventKind getKind();
|
public EventKind getKind();
|
||||||
|
|
||||||
public Class<?> getType();
|
public WaveformType getType();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,8 +16,6 @@ public interface IWaveform extends IHierNode {
|
||||||
|
|
||||||
public Long getId();
|
public Long getId();
|
||||||
|
|
||||||
public String getKind();
|
|
||||||
|
|
||||||
public IWaveformDb getDb();
|
public IWaveformDb getDb();
|
||||||
|
|
||||||
public Boolean equals(IWaveform other);
|
public Boolean equals(IWaveform other);
|
||||||
|
@ -28,8 +26,8 @@ public interface IWaveform extends IHierNode {
|
||||||
|
|
||||||
public IEvent[] getEventsBeforeTime(Long time);
|
public IEvent[] getEventsBeforeTime(Long time);
|
||||||
|
|
||||||
public Class<?> getType();
|
public WaveformType getType();
|
||||||
|
|
||||||
public int getMaxConcurrency();
|
public int getWidth();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
package com.minres.scviewer.database;
|
||||||
|
|
||||||
|
public enum WaveformType {
|
||||||
|
SIGNAL, TRANSACTION, FILTER
|
||||||
|
}
|
|
@ -22,7 +22,8 @@ import org.eclipse.jface.viewers.ISelection;
|
||||||
import org.eclipse.jface.viewers.IStructuredSelection;
|
import org.eclipse.jface.viewers.IStructuredSelection;
|
||||||
|
|
||||||
import com.minres.scviewer.database.BitVector;
|
import com.minres.scviewer.database.BitVector;
|
||||||
import com.minres.scviewer.database.ISignal;
|
import com.minres.scviewer.database.DoubleVal;
|
||||||
|
import com.minres.scviewer.database.WaveformType;
|
||||||
import com.minres.scviewer.database.ui.TrackEntry;
|
import com.minres.scviewer.database.ui.TrackEntry;
|
||||||
import com.minres.scviewer.e4.application.parts.WaveformViewer;
|
import com.minres.scviewer.e4.application.parts.WaveformViewer;
|
||||||
|
|
||||||
|
@ -38,9 +39,9 @@ public class WaveformPopupMenuContribution {
|
||||||
for(Object elem:(IStructuredSelection)sel) {
|
for(Object elem:(IStructuredSelection)sel) {
|
||||||
if(elem instanceof TrackEntry) {
|
if(elem instanceof TrackEntry) {
|
||||||
TrackEntry e = (TrackEntry) elem;
|
TrackEntry e = (TrackEntry) elem;
|
||||||
if(e.waveform instanceof ISignal<?>) {
|
if(e.waveform.getType() == WaveformType.SIGNAL) {
|
||||||
Object o = ((ISignal<?>) e.waveform).getEvents().firstEntry().getValue();
|
Object o = e.waveform.getEvents().firstEntry().getValue()[0];
|
||||||
if(checkForDouble && o instanceof Double)
|
if(checkForDouble && o instanceof DoubleVal)
|
||||||
return true;
|
return true;
|
||||||
else if(o instanceof BitVector && ((BitVector)o).getWidth()>1)
|
else if(o instanceof BitVector && ((BitVector)o).getWidth()>1)
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -17,6 +17,7 @@ import org.eclipse.jface.viewers.ISelection;
|
||||||
import org.eclipse.jface.viewers.StructuredSelection;
|
import org.eclipse.jface.viewers.StructuredSelection;
|
||||||
import org.eclipse.swt.widgets.Shell;
|
import org.eclipse.swt.widgets.Shell;
|
||||||
|
|
||||||
|
import com.minres.scviewer.database.WaveformType;
|
||||||
import com.minres.scviewer.database.ui.TrackEntry;
|
import com.minres.scviewer.database.ui.TrackEntry;
|
||||||
import com.minres.scviewer.e4.application.parts.WaveformViewer;
|
import com.minres.scviewer.e4.application.parts.WaveformViewer;
|
||||||
public class SearchHandler {
|
public class SearchHandler {
|
||||||
|
@ -31,7 +32,7 @@ public class SearchHandler {
|
||||||
Object[] elem = ((StructuredSelection)sel).toArray();
|
Object[] elem = ((StructuredSelection)sel).toArray();
|
||||||
if(elem.length ==0) return false;
|
if(elem.length ==0) return false;
|
||||||
TrackEntry e = findTrackEntry(elem);
|
TrackEntry e = findTrackEntry(elem);
|
||||||
return e!=null && e.isStream();
|
return e!=null && e.waveform.getType()==WaveformType.TRANSACTION;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -1,181 +0,0 @@
|
||||||
package com.minres.scviewer.e4.application.parts;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Map.Entry;
|
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
import org.eclipse.jface.dialogs.IDialogConstants;
|
|
||||||
import org.eclipse.jface.dialogs.TitleAreaDialog;
|
|
||||||
import org.eclipse.jface.viewers.ArrayContentProvider;
|
|
||||||
import org.eclipse.jface.viewers.ComboViewer;
|
|
||||||
import org.eclipse.jface.viewers.ISelectionChangedListener;
|
|
||||||
import org.eclipse.jface.viewers.IStructuredSelection;
|
|
||||||
import org.eclipse.jface.viewers.LabelProvider;
|
|
||||||
import org.eclipse.jface.viewers.SelectionChangedEvent;
|
|
||||||
import org.eclipse.jface.viewers.StructuredSelection;
|
|
||||||
import org.eclipse.swt.SWT;
|
|
||||||
import org.eclipse.swt.layout.GridData;
|
|
||||||
import org.eclipse.swt.layout.GridLayout;
|
|
||||||
import org.eclipse.swt.widgets.Button;
|
|
||||||
import org.eclipse.swt.widgets.Composite;
|
|
||||||
import org.eclipse.swt.widgets.Control;
|
|
||||||
import org.eclipse.swt.widgets.Label;
|
|
||||||
import org.eclipse.swt.widgets.Shell;
|
|
||||||
import org.eclipse.swt.widgets.Text;
|
|
||||||
import org.eclipse.wb.swt.ResourceManager;
|
|
||||||
|
|
||||||
import com.minres.scviewer.database.DataType;
|
|
||||||
import com.minres.scviewer.database.ITxEvent;
|
|
||||||
import com.minres.scviewer.database.ITxStream;
|
|
||||||
|
|
||||||
public class SearchTxDialog extends TitleAreaDialog {
|
|
||||||
private ComboViewer propNameComboViewer = null;
|
|
||||||
|
|
||||||
private Text propValueText = null;
|
|
||||||
|
|
||||||
private String propName="";
|
|
||||||
private DataType propType=null;
|
|
||||||
private String propValue="";
|
|
||||||
|
|
||||||
private ITxStream<? extends ITxEvent> stream;
|
|
||||||
|
|
||||||
private ConcurrentHashMap<String, DataType> propNames=new ConcurrentHashMap<String, DataType>();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Create the dialog.
|
|
||||||
* @param parentShell
|
|
||||||
* @param iTxStream
|
|
||||||
*/
|
|
||||||
public SearchTxDialog(Shell parentShell, ITxStream<? extends ITxEvent> iTxStream) {
|
|
||||||
super(parentShell);
|
|
||||||
setShellStyle(SWT.BORDER | SWT.RESIZE | SWT.TITLE | SWT.APPLICATION_MODAL);
|
|
||||||
stream=iTxStream;
|
|
||||||
new Thread() {
|
|
||||||
public void run() {
|
|
||||||
stream.getEvents().values().parallelStream().forEach(evtLst -> {
|
|
||||||
evtLst.forEach(evt -> {
|
|
||||||
evt.getTransaction().getAttributes().stream().forEach(attr -> {
|
|
||||||
propNames.put(attr.getName(), attr.getDataType());
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
parentShell.getDisplay().asyncExec(new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
if (propNameComboViewer!=null) {
|
|
||||||
propNameComboViewer.setInput(getEntries());
|
|
||||||
propNameComboViewer.setSelection(new StructuredSelection(propNameComboViewer.getElementAt(0)));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}.run();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Create contents of the dialog.
|
|
||||||
* @param parent
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
protected Control createDialogArea(Composite parent) {
|
|
||||||
setMessage("Specify property name and value to search for");
|
|
||||||
setTitleImage(ResourceManager.getPluginImage("com.minres.scviewer.e4.application", "icons/Minres_logo.png"));
|
|
||||||
setTitle("Search Tx in stream");
|
|
||||||
final Composite area = (Composite) super.createDialogArea(parent);
|
|
||||||
final GridLayout gridLayout = (GridLayout) area.getLayout();
|
|
||||||
gridLayout.marginTop = 10;
|
|
||||||
gridLayout.marginBottom = 10;
|
|
||||||
final Composite container = new Composite(area, SWT.NONE);
|
|
||||||
final GridLayout gl_container = new GridLayout(2, false);
|
|
||||||
gl_container.horizontalSpacing = 2;
|
|
||||||
container.setLayout(gl_container);
|
|
||||||
container.setLayoutData(new GridData(GridData.FILL_BOTH));
|
|
||||||
|
|
||||||
final Label header = new Label(container, SWT.CENTER | SWT.WRAP);
|
|
||||||
GridData gd_header = new GridData(SWT.FILL, SWT.TOP, true, false, 2, 1);
|
|
||||||
gd_header.verticalIndent = 10;
|
|
||||||
header.setLayoutData(gd_header);
|
|
||||||
header.setText("Stream: "+stream.getName());
|
|
||||||
|
|
||||||
final Label propNameLabel = new Label(container, SWT.NONE);
|
|
||||||
propNameLabel.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
|
|
||||||
propNameLabel.setText("Property Name:");
|
|
||||||
|
|
||||||
propNameComboViewer = new ComboViewer(container, SWT.NONE);
|
|
||||||
propNameComboViewer.getCombo().setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
|
|
||||||
propNameComboViewer.setContentProvider(ArrayContentProvider.getInstance());
|
|
||||||
propNameComboViewer.setLabelProvider(new LabelProvider() {
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
@Override
|
|
||||||
public String getText(Object element) {
|
|
||||||
Map.Entry<String, DataType> e = (Map.Entry<String, DataType>)element;
|
|
||||||
return e.getKey()+" ("+e.getValue().name()+")";
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
propNameComboViewer.addSelectionChangedListener(new ISelectionChangedListener() {
|
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
@Override
|
|
||||||
public void selectionChanged(SelectionChangedEvent event) {
|
|
||||||
IStructuredSelection sel = event.getStructuredSelection();
|
|
||||||
Map.Entry<String, DataType> e = (Map.Entry<String, DataType>)sel.getFirstElement();
|
|
||||||
propName=e.getKey();
|
|
||||||
propType=e.getValue();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
propNameComboViewer.setInput(getEntries());
|
|
||||||
propNameComboViewer.setSelection(new StructuredSelection(propNameComboViewer.getElementAt(0)));
|
|
||||||
|
|
||||||
final Label propValueLabel = new Label(container, SWT.NONE);
|
|
||||||
propValueLabel.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
|
|
||||||
propValueLabel.setText("Property Value:");
|
|
||||||
|
|
||||||
propValueText = new Text(container, SWT.BORDER);
|
|
||||||
propValueText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
|
|
||||||
|
|
||||||
return area;
|
|
||||||
}
|
|
||||||
|
|
||||||
private List<Entry<String,DataType>> getEntries() {
|
|
||||||
return propNames.entrySet().stream().sorted((e1,e2)->e1.getKey().compareTo(e2.getKey())).collect(Collectors.toList());
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Create contents of the button bar.
|
|
||||||
* @param parent
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
protected void createButtonsForButtonBar(Composite parent) {
|
|
||||||
final Button okButton = createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);
|
|
||||||
okButton.setImage(ResourceManager.getPluginImage("com.minres.scviewer.e4.application", "icons/tick.png"));
|
|
||||||
final Button cancelButton = createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);
|
|
||||||
cancelButton.setImage(ResourceManager.getPluginImage("com.minres.scviewer.e4.application", "icons/cross.png"));
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void constrainShellSize() {
|
|
||||||
super.constrainShellSize();
|
|
||||||
getShell().setMinimumSize(getShell().computeSize(-1, -1));
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void okPressed() {
|
|
||||||
propValue=propValueText.getText();
|
|
||||||
super.okPressed();
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getPropName() {
|
|
||||||
return propName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public DataType getPropType() {
|
|
||||||
return propType;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getPropValue() {
|
|
||||||
return propValue;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,6 +1,8 @@
|
||||||
package com.minres.scviewer.e4.application.parts;
|
package com.minres.scviewer.e4.application.parts;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
@ -10,8 +12,6 @@ import org.eclipse.core.databinding.observable.list.WritableList;
|
||||||
import org.eclipse.jface.databinding.viewers.ObservableListContentProvider;
|
import org.eclipse.jface.databinding.viewers.ObservableListContentProvider;
|
||||||
import org.eclipse.jface.viewers.ComboViewer;
|
import org.eclipse.jface.viewers.ComboViewer;
|
||||||
import org.eclipse.jface.viewers.DelegatingStyledCellLabelProvider;
|
import org.eclipse.jface.viewers.DelegatingStyledCellLabelProvider;
|
||||||
import org.eclipse.jface.viewers.DoubleClickEvent;
|
|
||||||
import org.eclipse.jface.viewers.IDoubleClickListener;
|
|
||||||
import org.eclipse.jface.viewers.ISelection;
|
import org.eclipse.jface.viewers.ISelection;
|
||||||
import org.eclipse.jface.viewers.ISelectionChangedListener;
|
import org.eclipse.jface.viewers.ISelectionChangedListener;
|
||||||
import org.eclipse.jface.viewers.IStructuredSelection;
|
import org.eclipse.jface.viewers.IStructuredSelection;
|
||||||
|
@ -36,11 +36,13 @@ import org.eclipse.swt.widgets.TableColumn;
|
||||||
import org.eclipse.swt.widgets.Text;
|
import org.eclipse.swt.widgets.Text;
|
||||||
|
|
||||||
import com.minres.scviewer.database.DataType;
|
import com.minres.scviewer.database.DataType;
|
||||||
|
import com.minres.scviewer.database.EventKind;
|
||||||
|
import com.minres.scviewer.database.IEvent;
|
||||||
import com.minres.scviewer.database.ITx;
|
import com.minres.scviewer.database.ITx;
|
||||||
import com.minres.scviewer.database.ITxAttribute;
|
import com.minres.scviewer.database.ITxAttribute;
|
||||||
import com.minres.scviewer.database.ITxEvent;
|
import com.minres.scviewer.database.ITxEvent;
|
||||||
import com.minres.scviewer.database.ITxEvent.Type;
|
import com.minres.scviewer.database.IWaveform;
|
||||||
import com.minres.scviewer.database.ITxStream;
|
import com.minres.scviewer.database.WaveformType;
|
||||||
import com.minres.scviewer.database.ui.TrackEntry;
|
import com.minres.scviewer.database.ui.TrackEntry;
|
||||||
import com.minres.scviewer.e4.application.parts.txTableTree.AbstractTransactionTreeContentProvider;
|
import com.minres.scviewer.e4.application.parts.txTableTree.AbstractTransactionTreeContentProvider;
|
||||||
import com.minres.scviewer.e4.application.parts.txTableTree.AttributeLabelProvider;
|
import com.minres.scviewer.e4.application.parts.txTableTree.AttributeLabelProvider;
|
||||||
|
@ -84,7 +86,7 @@ public class TransactionList extends Composite {
|
||||||
|
|
||||||
private AttributeLabelProvider valueLabelProvider = null;
|
private AttributeLabelProvider valueLabelProvider = null;
|
||||||
|
|
||||||
private ITxStream<? extends ITxEvent> stream;
|
private IWaveform stream;
|
||||||
|
|
||||||
private ObservableList<AttributeNameBean> attrNames = new WritableList<AttributeNameBean>();
|
private ObservableList<AttributeNameBean> attrNames = new WritableList<AttributeNameBean>();
|
||||||
|
|
||||||
|
@ -126,6 +128,7 @@ public class TransactionList extends Composite {
|
||||||
@Override
|
@Override
|
||||||
public void widgetSelected(SelectionEvent e) {
|
public void widgetSelected(SelectionEvent e) {
|
||||||
int idx = searchPropCombo.getSelectionIndex();
|
int idx = searchPropCombo.getSelectionIndex();
|
||||||
|
if(idx<0) return;
|
||||||
AttributeNameBean sel = attrNames.get(idx);
|
AttributeNameBean sel = attrNames.get(idx);
|
||||||
txFilter.setSearchProp(sel.getName(), sel.getType());
|
txFilter.setSearchProp(sel.getName(), sel.getType());
|
||||||
tableViewer.refresh();
|
tableViewer.refresh();
|
||||||
|
@ -133,6 +136,7 @@ public class TransactionList extends Composite {
|
||||||
@Override
|
@Override
|
||||||
public void widgetDefaultSelected(SelectionEvent e) {
|
public void widgetDefaultSelected(SelectionEvent e) {
|
||||||
int idx = searchPropCombo.getSelectionIndex();
|
int idx = searchPropCombo.getSelectionIndex();
|
||||||
|
if(idx<0) return;
|
||||||
AttributeNameBean sel = attrNames.get(idx);
|
AttributeNameBean sel = attrNames.get(idx);
|
||||||
txFilter.setSearchProp(sel.getName(), sel.getType());
|
txFilter.setSearchProp(sel.getName(), sel.getType());
|
||||||
tableViewer.refresh();
|
tableViewer.refresh();
|
||||||
|
@ -171,6 +175,7 @@ public class TransactionList extends Composite {
|
||||||
@Override
|
@Override
|
||||||
public void widgetSelected(SelectionEvent e) {
|
public void widgetSelected(SelectionEvent e) {
|
||||||
int idx = viewPropCombo.getSelectionIndex();
|
int idx = viewPropCombo.getSelectionIndex();
|
||||||
|
if(idx<0) return;
|
||||||
valueLabelProvider.setShowProp(attrNames.get(idx).getName());
|
valueLabelProvider.setShowProp(attrNames.get(idx).getName());
|
||||||
tableViewer.refresh(true);
|
tableViewer.refresh(true);
|
||||||
}
|
}
|
||||||
|
@ -238,11 +243,11 @@ public class TransactionList extends Composite {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setInput(TrackEntry trackEntry) {
|
public void setInput(TrackEntry trackEntry) {
|
||||||
if(trackEntry==null || !trackEntry.isStream()) {
|
if(trackEntry==null || trackEntry.waveform.getType()!=WaveformType.TRANSACTION) {
|
||||||
attrNames.clear();
|
attrNames.clear();
|
||||||
tableViewer.setInput(emptyList);
|
tableViewer.setInput(emptyList);
|
||||||
} else {
|
} else {
|
||||||
stream=trackEntry.getStream();
|
stream=trackEntry.waveform;
|
||||||
tableViewer.setInput(emptyList);
|
tableViewer.setInput(emptyList);
|
||||||
new Thread() {
|
new Thread() {
|
||||||
private ConcurrentHashMap<String, DataType> propNames=new ConcurrentHashMap<String, DataType>();
|
private ConcurrentHashMap<String, DataType> propNames=new ConcurrentHashMap<String, DataType>();
|
||||||
|
@ -255,11 +260,12 @@ public class TransactionList extends Composite {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void run() {
|
public void run() {
|
||||||
eventList = stream.getEvents().values().parallelStream()
|
Collection<IEvent[]> values = stream.getEvents().values();
|
||||||
|
eventList = values.parallelStream().map(Arrays::asList)
|
||||||
.flatMap(List::stream)
|
.flatMap(List::stream)
|
||||||
.filter(evt -> evt.getType()==Type.BEGIN)
|
.filter(evt -> evt.getKind()==EventKind.BEGIN)
|
||||||
.map(evt-> {
|
.map(evt-> {
|
||||||
ITx tx = evt.getTransaction();
|
ITx tx = ((ITxEvent)evt).getTransaction();
|
||||||
for(ITxAttribute attr: tx.getAttributes()) {
|
for(ITxAttribute attr: tx.getAttributes()) {
|
||||||
propNames.put(attr.getName(), attr.getDataType());
|
propNames.put(attr.getName(), attr.getDataType());
|
||||||
}
|
}
|
||||||
|
|
|
@ -62,8 +62,6 @@ import org.eclipse.jface.viewers.IStructuredSelection;
|
||||||
import org.eclipse.jface.viewers.SelectionChangedEvent;
|
import org.eclipse.jface.viewers.SelectionChangedEvent;
|
||||||
import org.eclipse.jface.viewers.StructuredSelection;
|
import org.eclipse.jface.viewers.StructuredSelection;
|
||||||
import org.eclipse.swt.SWT;
|
import org.eclipse.swt.SWT;
|
||||||
import org.eclipse.swt.custom.CTabFolder;
|
|
||||||
import org.eclipse.swt.custom.CTabItem;
|
|
||||||
import org.eclipse.swt.custom.SashForm;
|
import org.eclipse.swt.custom.SashForm;
|
||||||
import org.eclipse.swt.events.DisposeEvent;
|
import org.eclipse.swt.events.DisposeEvent;
|
||||||
import org.eclipse.swt.events.DisposeListener;
|
import org.eclipse.swt.events.DisposeListener;
|
||||||
|
@ -88,6 +86,7 @@ import org.eclipse.swt.widgets.Widget;
|
||||||
import org.osgi.service.prefs.Preferences;
|
import org.osgi.service.prefs.Preferences;
|
||||||
|
|
||||||
import com.minres.scviewer.database.DataType;
|
import com.minres.scviewer.database.DataType;
|
||||||
|
import com.minres.scviewer.database.IEvent;
|
||||||
import com.minres.scviewer.database.ITx;
|
import com.minres.scviewer.database.ITx;
|
||||||
import com.minres.scviewer.database.ITxAttribute;
|
import com.minres.scviewer.database.ITxAttribute;
|
||||||
import com.minres.scviewer.database.ITxEvent;
|
import com.minres.scviewer.database.ITxEvent;
|
||||||
|
@ -790,7 +789,7 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
|
||||||
// get transaction id
|
// get transaction id
|
||||||
persistedState.put(SELECTED_TX_ID, Long.toString(tx.getId()));
|
persistedState.put(SELECTED_TX_ID, Long.toString(tx.getId()));
|
||||||
//get TrackEntry name
|
//get TrackEntry name
|
||||||
String name = te.getStream().getFullName();
|
String name = te.waveform.getFullName();
|
||||||
persistedState.put(SELECTED_TRACKENTRY_NAME, name);
|
persistedState.put(SELECTED_TRACKENTRY_NAME, name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -874,11 +873,11 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
|
||||||
if(te.waveform.getFullName().compareTo(trackentryName)==0) {
|
if(te.waveform.getFullName().compareTo(trackentryName)==0) {
|
||||||
boolean found = false;
|
boolean found = false;
|
||||||
// TODO: find transaction by time? To avoid 3x for-loop
|
// TODO: find transaction by time? To avoid 3x for-loop
|
||||||
for( List<ITxEvent> lev : te.getStream().getEvents().values() ) {
|
for( IEvent[] lev : te.waveform.getEvents().values() ) {
|
||||||
if(lev == null) continue;
|
if(lev == null) continue;
|
||||||
for(ITxEvent itxe : lev) {
|
for(IEvent itxe : lev) {
|
||||||
if(itxe == null) continue;
|
if(itxe == null || !(itxe instanceof ITxEvent)) continue;
|
||||||
ITx itx = itxe.getTransaction();
|
ITx itx = ((ITxEvent)itxe).getTransaction();
|
||||||
if(itx.getId() == txId) {
|
if(itx.getId() == txId) {
|
||||||
found = true;
|
found = true;
|
||||||
ArrayList<Object> selectionList = new ArrayList<Object>();
|
ArrayList<Object> selectionList = new ArrayList<Object>();
|
||||||
|
|
|
@ -18,10 +18,8 @@ import org.eclipse.jface.viewers.ILabelProviderListener;
|
||||||
import org.eclipse.swt.graphics.Image;
|
import org.eclipse.swt.graphics.Image;
|
||||||
import org.eclipse.wb.swt.ResourceManager;
|
import org.eclipse.wb.swt.ResourceManager;
|
||||||
|
|
||||||
import com.minres.scviewer.database.BitVector;
|
|
||||||
import com.minres.scviewer.database.IHierNode;
|
import com.minres.scviewer.database.IHierNode;
|
||||||
import com.minres.scviewer.database.ISignal;
|
import com.minres.scviewer.database.IWaveform;
|
||||||
import com.minres.scviewer.database.ITxStream;
|
|
||||||
import com.minres.scviewer.database.IWaveformDb;
|
import com.minres.scviewer.database.IWaveformDb;
|
||||||
import com.minres.scviewer.e4.application.parts.LoadingWaveformDb;
|
import com.minres.scviewer.e4.application.parts.LoadingWaveformDb;
|
||||||
|
|
||||||
|
@ -91,14 +89,21 @@ public class TxDbLabelProvider implements ILabelProvider {
|
||||||
return loadinDatabase;
|
return loadinDatabase;
|
||||||
else
|
else
|
||||||
return database;
|
return database;
|
||||||
}else if(element instanceof ITxStream){
|
}else if(element instanceof IWaveform){
|
||||||
|
switch(((IWaveform) element).getType()) {
|
||||||
|
case TRANSACTION:
|
||||||
return stream;
|
return stream;
|
||||||
}else if(element instanceof ISignal<?>){
|
case FILTER:
|
||||||
Object o = ((ISignal<?>)element).getEvents().firstEntry().getValue();
|
break;
|
||||||
if(o instanceof BitVector && ((BitVector)o).getWidth()==1)
|
case SIGNAL:
|
||||||
|
if(((IWaveform) element).getWidth()==1)
|
||||||
return signal;
|
return signal;
|
||||||
else
|
else
|
||||||
return wave;
|
return wave;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return wave;
|
||||||
}else if(element instanceof IHierNode){
|
}else if(element instanceof IHierNode){
|
||||||
return folder;
|
return folder;
|
||||||
} else
|
} else
|
||||||
|
|
|
@ -17,10 +17,9 @@ import org.eclipse.jface.viewers.ILabelProvider;
|
||||||
import org.eclipse.jface.viewers.ILabelProviderListener;
|
import org.eclipse.jface.viewers.ILabelProviderListener;
|
||||||
import org.eclipse.swt.graphics.Image;
|
import org.eclipse.swt.graphics.Image;
|
||||||
|
|
||||||
import com.minres.scviewer.database.ISignal;
|
|
||||||
import com.minres.scviewer.database.IWaveformDb;
|
import com.minres.scviewer.database.IWaveformDb;
|
||||||
import com.minres.scviewer.database.IHierNode;
|
import com.minres.scviewer.database.IHierNode;
|
||||||
import com.minres.scviewer.database.ITxStream;
|
import com.minres.scviewer.database.IWaveform;
|
||||||
import com.minres.scviewer.ui.TxEditorPlugin;
|
import com.minres.scviewer.ui.TxEditorPlugin;
|
||||||
|
|
||||||
public class TxDbTreeLabelProvider implements ILabelProvider {
|
public class TxDbTreeLabelProvider implements ILabelProvider {
|
||||||
|
@ -31,6 +30,7 @@ public class TxDbTreeLabelProvider implements ILabelProvider {
|
||||||
private Image stream;
|
private Image stream;
|
||||||
private Image signal;
|
private Image signal;
|
||||||
private Image folder;
|
private Image folder;
|
||||||
|
private Image wave;
|
||||||
|
|
||||||
|
|
||||||
public TxDbTreeLabelProvider() {
|
public TxDbTreeLabelProvider() {
|
||||||
|
@ -39,6 +39,8 @@ public class TxDbTreeLabelProvider implements ILabelProvider {
|
||||||
stream=TxEditorPlugin.createImage("stream");
|
stream=TxEditorPlugin.createImage("stream");
|
||||||
folder=TxEditorPlugin.createImage("folder");
|
folder=TxEditorPlugin.createImage("folder");
|
||||||
signal=TxEditorPlugin.createImage("signal");
|
signal=TxEditorPlugin.createImage("signal");
|
||||||
|
wave=TxEditorPlugin.createImage("wave");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -68,10 +70,21 @@ public class TxDbTreeLabelProvider implements ILabelProvider {
|
||||||
public Image getImage(Object element) {
|
public Image getImage(Object element) {
|
||||||
if(element instanceof IWaveformDb){
|
if(element instanceof IWaveformDb){
|
||||||
return database;
|
return database;
|
||||||
}else if(element instanceof ITxStream){
|
}else if(element instanceof IWaveform){
|
||||||
|
switch(((IWaveform) element).getType()) {
|
||||||
|
case TRANSACTION:
|
||||||
return stream;
|
return stream;
|
||||||
}else if(element instanceof ISignal<?>){
|
case FILTER:
|
||||||
|
break;
|
||||||
|
case SIGNAL:
|
||||||
|
if(((IWaveform) element).getWidth()==1)
|
||||||
return signal;
|
return signal;
|
||||||
|
else
|
||||||
|
return wave;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return wave;
|
||||||
}else if(element instanceof IHierNode){
|
}else if(element instanceof IHierNode){
|
||||||
return folder;
|
return folder;
|
||||||
} else
|
} else
|
||||||
|
|
Loading…
Reference in New Issue