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.ITx;
|
||||
import com.minres.scviewer.database.ITxEvent;
|
||||
import com.minres.scviewer.database.WaveformType;
|
||||
|
||||
public class TxEvent implements ITxEvent {
|
||||
|
||||
|
@ -52,7 +53,7 @@ public class TxEvent implements ITxEvent {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Class<?> getType() {
|
||||
return TxEvent.class;
|
||||
public WaveformType getType() {
|
||||
return WaveformType.TRANSACTION;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,6 +28,7 @@ import com.minres.scviewer.database.ITxGenerator;
|
|||
import com.minres.scviewer.database.IWaveform;
|
||||
import com.minres.scviewer.database.IWaveformDb;
|
||||
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.SQLiteDatabaseSelectHandler;
|
||||
import com.minres.scviewer.database.sqlite.tables.ScvGenerator;
|
||||
|
@ -77,11 +78,6 @@ public class TxStream extends HierNode implements IWaveform {
|
|||
return (long) scvStream.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getKind() {
|
||||
return scvStream.getKind();
|
||||
}
|
||||
|
||||
public List<ITxGenerator> getGenerators() {
|
||||
if(generators==null){
|
||||
SQLiteDatabaseSelectHandler<ScvGenerator> handler = new SQLiteDatabaseSelectHandler<ScvGenerator>(
|
||||
|
@ -100,7 +96,7 @@ public class TxStream extends HierNode implements IWaveform {
|
|||
}
|
||||
|
||||
@Override
|
||||
public int getMaxConcurrency() {
|
||||
public int getWidth() {
|
||||
if(maxConcurrency==null){
|
||||
java.sql.Connection connection=null;
|
||||
java.sql.Statement statement=null;
|
||||
|
@ -205,8 +201,8 @@ public class TxStream extends HierNode implements IWaveform {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Class<?> getType() {
|
||||
return TxEvent.class;
|
||||
public WaveformType getType() {
|
||||
return WaveformType.TRANSACTION;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -82,7 +82,7 @@ public class TextDbLoader implements IWaveformDbLoader{
|
|||
.make()
|
||||
// NPE here --->
|
||||
parseInput(gzipped?new GZIPInputStream(new FileInputStream(file)):new FileInputStream(file))
|
||||
streams.each{ TxStream stream -> stream.getMaxConcurrency() }
|
||||
streams.each{ TxStream stream -> stream.getWidth() }
|
||||
return true
|
||||
}
|
||||
} 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. StackTrace following... ");
|
||||
//e.printStackTrace()
|
||||
} catch(Error e) {
|
||||
System.out.println("---->>> Exception "+e.toString()+" caught while loading database. StackTrace following... ");
|
||||
e.printStackTrace()
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@ import com.minres.scviewer.database.ITxAttributeType
|
|||
import com.minres.scviewer.database.ITxAttribute
|
||||
|
||||
class TxAttributeTypeFactory {
|
||||
private static final instance = new TxAttributeTypeFactory()
|
||||
static final TxAttributeTypeFactory instance = new TxAttributeTypeFactory()
|
||||
|
||||
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.RelationType;
|
||||
|
||||
class TxRelation implements ITxRelation {
|
||||
Tx source
|
||||
final Tx source;
|
||||
|
||||
Tx target
|
||||
|
||||
RelationType relationType
|
||||
final Tx target;
|
||||
|
||||
final RelationType relationType;
|
||||
|
||||
public TxRelation(RelationType relationType, Tx source, Tx target) {
|
||||
this.source = source;
|
|
@ -23,6 +23,7 @@ import org.mapdb.Serializer
|
|||
import com.minres.scviewer.database.ITxEvent;
|
||||
import com.minres.scviewer.database.IWaveform;
|
||||
import com.minres.scviewer.database.IWaveformDb
|
||||
import com.minres.scviewer.database.WaveformType
|
||||
import com.minres.scviewer.database.ITxGenerator
|
||||
import com.minres.scviewer.database.EventKind
|
||||
import com.minres.scviewer.database.HierNode;
|
||||
|
@ -38,8 +39,6 @@ class TxStream extends HierNode implements IWaveform {
|
|||
|
||||
String fullName
|
||||
|
||||
String kind
|
||||
|
||||
def generators = []
|
||||
|
||||
int maxConcurrency
|
||||
|
@ -51,7 +50,6 @@ class TxStream extends HierNode implements IWaveform {
|
|||
this.id=id
|
||||
this.database=loader.db
|
||||
this.fullName=name
|
||||
this.kind=kind
|
||||
this.maxConcurrency=0
|
||||
//events = new TreeMap<Long, List<ITxEvent>>()
|
||||
events = loader.mapDb.treeMap(name).keySerializer(Serializer.LONG).createOrOpen();
|
||||
|
@ -67,7 +65,7 @@ class TxStream extends HierNode implements IWaveform {
|
|||
}
|
||||
|
||||
@Override
|
||||
public int getMaxConcurrency() {
|
||||
public int getWidth() {
|
||||
if(!maxConcurrency){
|
||||
generators.each {TxGenerator generator ->
|
||||
generator.transactions.each{ Tx tx ->
|
||||
|
@ -97,9 +95,12 @@ class TxStream extends HierNode implements IWaveform {
|
|||
|
||||
private putEvent(ITxEvent event){
|
||||
if(!events.containsKey(event.time))
|
||||
events.put(event.time, [event])
|
||||
else
|
||||
events[event.time]<<event
|
||||
events.put(event.time, [event] as IEvent[])
|
||||
else {
|
||||
def entries = events[event.time] as List
|
||||
entries<<event
|
||||
events.put(event.time, entries as IEvent[])
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -127,8 +128,8 @@ class TxStream extends HierNode implements IWaveform {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Class<?> getType() {
|
||||
return TxEvent.class;
|
||||
public WaveformType getType() {
|
||||
return WaveformType.TRANSACTION;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -13,9 +13,6 @@ package com.minres.scviewer.database.ui;
|
|||
|
||||
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;
|
||||
|
||||
public class TrackEntry {
|
||||
|
@ -105,20 +102,8 @@ public class TrackEntry {
|
|||
signalColors[1] = highlightedFallbackColor;
|
||||
}
|
||||
|
||||
public boolean isStream(){
|
||||
return waveform instanceof ITxStream<?>;
|
||||
}
|
||||
|
||||
public ITxStream<? extends ITxEvent> getStream(){
|
||||
return (ITxStream<?>) waveform;
|
||||
}
|
||||
|
||||
public boolean isSignal(){
|
||||
return waveform instanceof ISignal<?>;
|
||||
}
|
||||
|
||||
public ISignal<?> getSignal(){
|
||||
return (ISignal<?>) waveform;
|
||||
public IWaveform getWaveform(){
|
||||
return waveform;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -23,7 +23,6 @@ import org.eclipse.swt.widgets.Display;
|
|||
|
||||
import com.minres.scviewer.database.ITx;
|
||||
import com.minres.scviewer.database.ITxRelation;
|
||||
import com.minres.scviewer.database.ITxStream;
|
||||
import com.minres.scviewer.database.RelationType;
|
||||
import com.minres.scviewer.database.ui.WaveformColors;
|
||||
|
||||
|
@ -83,14 +82,13 @@ public class ArrowPainter implements IPainter {
|
|||
deferUpdate = false;
|
||||
iRect.clear();
|
||||
oRect.clear();
|
||||
ITxStream<?> stream = tx.getStream();
|
||||
IWaveformPainter painter = waveCanvas.wave2painterMap.get(stream);
|
||||
IWaveformPainter painter = waveCanvas.wave2painterMap.get(tx.getStream());
|
||||
if (painter == null) { // stream has been added but painter not yet
|
||||
// created
|
||||
deferUpdate = true;
|
||||
return;
|
||||
}
|
||||
int laneHeight = painter.getHeight() / stream.getMaxConcurrency();
|
||||
int laneHeight = painter.getHeight() / tx.getStream().getWidth();
|
||||
txRectangle = new Rectangle((int) (tx.getBeginTime() / scaleFactor),
|
||||
waveCanvas.rulerHeight + painter.getVerticalOffset() + laneHeight * tx.getConcurrencyIndex(),
|
||||
(int) ((tx.getEndTime() - tx.getBeginTime()) / scaleFactor), laneHeight);
|
||||
|
@ -102,9 +100,8 @@ public class ArrowPainter implements IPainter {
|
|||
for (ITxRelation iTxRelation : relations) {
|
||||
ITx otherTx = useTarget ? iTxRelation.getTarget() : iTxRelation.getSource();
|
||||
if (waveCanvas.wave2painterMap.containsKey(otherTx.getStream())) {
|
||||
ITxStream<?> stream = otherTx.getStream();
|
||||
IWaveformPainter painter = waveCanvas.wave2painterMap.get(stream);
|
||||
int laneHeight = painter.getHeight() / stream.getMaxConcurrency();
|
||||
IWaveformPainter painter = waveCanvas.wave2painterMap.get(otherTx.getStream());
|
||||
int laneHeight = painter.getHeight() / tx.getStream().getWidth();
|
||||
Rectangle bb = new Rectangle((int) (otherTx.getBeginTime() / scaleFactor),
|
||||
waveCanvas.rulerHeight + painter.getVerticalOffset()
|
||||
+ laneHeight * otherTx.getConcurrencyIndex(),
|
||||
|
|
|
@ -24,26 +24,28 @@ import org.eclipse.swt.graphics.Point;
|
|||
import org.eclipse.swt.graphics.Rectangle;
|
||||
|
||||
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.WaveformColors;
|
||||
|
||||
public class SignalPainter extends TrackPainter {
|
||||
private class SignalChange {
|
||||
long time;
|
||||
Object value;
|
||||
IEvent value;
|
||||
boolean fromMap;
|
||||
|
||||
public SignalChange(Entry<Long, ?> entry) {
|
||||
public SignalChange(Entry<Long, IEvent[]> entry) {
|
||||
time = entry.getKey();
|
||||
value = entry.getValue();
|
||||
value = entry.getValue()[0];
|
||||
fromMap = true;
|
||||
}
|
||||
|
||||
public void set(Entry<Long, ?> entry, Long actTime) {
|
||||
public void set(Entry<Long, IEvent[]> entry, Long actTime) {
|
||||
if (entry != null) {
|
||||
time = entry.getKey();
|
||||
value = entry.getValue();
|
||||
value = entry.getValue()[0];
|
||||
fromMap = true;
|
||||
} else {
|
||||
time = actTime;
|
||||
|
@ -84,7 +86,7 @@ public class SignalPainter extends TrackPainter {
|
|||
}
|
||||
|
||||
public void paintArea(Projection proj, Rectangle area) {
|
||||
ISignal<?> signal = trackEntry.getSignal();
|
||||
IWaveform signal = trackEntry.waveform;
|
||||
if (trackEntry.selected)
|
||||
proj.setBackground(this.waveCanvas.colors[WaveformColors.TRACK_BG_HIGHLITE.ordinal()]);
|
||||
else
|
||||
|
@ -97,8 +99,8 @@ public class SignalPainter extends TrackPainter {
|
|||
long beginTime = beginPos*scaleFactor;
|
||||
long endTime = beginTime + area.width*scaleFactor;
|
||||
|
||||
Entry<Long, ?> first = signal.getEvents().floorEntry(beginTime);
|
||||
Entry<Long, ?> last = signal.getEvents().floorEntry(endTime);
|
||||
Entry<Long, IEvent[]> first = signal.getEvents().floorEntry(beginTime);
|
||||
Entry<Long, IEvent[]> last = signal.getEvents().floorEntry(endTime);
|
||||
if (first == null) {
|
||||
if (last == null)
|
||||
return;
|
||||
|
@ -109,7 +111,7 @@ public class SignalPainter extends TrackPainter {
|
|||
proj.setForeground(this.waveCanvas.colors[WaveformColors.LINE.ordinal()]);
|
||||
proj.setLineStyle(SWT.LINE_SOLID);
|
||||
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 right = new SignalChange(entries.size() > 0 ? entries.firstEntry() : first);
|
||||
maxPosX = area.x + area.width;
|
||||
|
@ -150,7 +152,7 @@ public class SignalPainter extends TrackPainter {
|
|||
if (xSigChangeEndPos == xSigChangeBeginPos) {
|
||||
multiple = true;
|
||||
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)
|
||||
right.set(entry, endTime);
|
||||
xSigChangeEndPos = getXPosEnd(eTime);
|
||||
|
@ -158,8 +160,8 @@ public class SignalPainter extends TrackPainter {
|
|||
} while (left.time < endTime);
|
||||
}
|
||||
|
||||
private SignalStencil getStencil(GC gc, SignalChange left, NavigableMap<Long, ?> entries) {
|
||||
Object val = left.value;
|
||||
private SignalStencil getStencil(GC gc, SignalChange left, NavigableMap<Long, IEvent[]> entries) {
|
||||
IEvent val = left.value;
|
||||
if(val instanceof BitVector) {
|
||||
BitVector bv = (BitVector) val;
|
||||
if(bv.getWidth()==1)
|
||||
|
@ -170,7 +172,7 @@ public class SignalPainter extends TrackPainter {
|
|||
return new MultiBitStencilAnalog(entries, left.value,
|
||||
trackEntry.waveDisplay==TrackEntry.WaveDisplay.CONTINOUS,
|
||||
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);
|
||||
else
|
||||
return null;
|
||||
|
@ -178,7 +180,7 @@ public class SignalPainter extends TrackPainter {
|
|||
|
||||
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 {
|
||||
|
@ -192,7 +194,7 @@ public class SignalPainter extends TrackPainter {
|
|||
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()];
|
||||
BitVector last = (BitVector) left;
|
||||
if (last.getValue().toString().contains("X")) {
|
||||
|
@ -250,18 +252,19 @@ public class SignalPainter extends TrackPainter {
|
|||
private long minVal;
|
||||
private long range;
|
||||
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;
|
||||
Collection<?> values = ((NavigableMap<Long, ?>) entries).values();
|
||||
Collection<IEvent[]> values = entries.values();
|
||||
minVal=((BitVector) left).toUnsignedValue();
|
||||
range=2;
|
||||
if(!values.isEmpty()) {
|
||||
long maxVal=minVal;
|
||||
for (Object e : entries.values()) {
|
||||
long v = ((BitVector)e).toUnsignedValue();
|
||||
maxVal=Math.max(maxVal, v);
|
||||
minVal=Math.min(minVal, v);
|
||||
}
|
||||
for (IEvent[] tp : entries.values())
|
||||
for(IEvent e: tp) {
|
||||
long v = ((BitVector)e).toUnsignedValue();
|
||||
maxVal=Math.max(maxVal, v);
|
||||
minVal=Math.min(minVal, v);
|
||||
}
|
||||
if(maxVal==minVal) {
|
||||
maxVal--;
|
||||
minVal++;
|
||||
|
@ -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 rightVal= ((BitVector) right).toUnsignedValue();
|
||||
proj.setForeground(waveCanvas.colors[WaveformColors.SIGNAL_REAL.ordinal()]);
|
||||
|
@ -298,7 +301,7 @@ public class SignalPainter extends TrackPainter {
|
|||
}
|
||||
|
||||
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) {
|
||||
proj.setForeground(waveCanvas.colors[WaveformColors.SIGNALU.ordinal()]);
|
||||
proj.drawLine(xBegin, yOffsetT, xBegin, yOffsetB);
|
||||
|
@ -351,9 +354,9 @@ public class SignalPainter extends TrackPainter {
|
|||
|
||||
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;
|
||||
Collection<?> values = ((NavigableMap<Long, ?>) entries).values();
|
||||
Collection<IEvent[]> values = ((NavigableMap<Long, IEvent[]>) entries).values();
|
||||
minVal=(Double) left;
|
||||
range=2.0;
|
||||
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) {
|
||||
double leftVal = (Double) left;
|
||||
double rightVal= (Double) right;
|
||||
public void draw(Projection proj, Rectangle area, IEvent left, IEvent right, int xBegin, int xEnd, boolean multiple) {
|
||||
double leftVal = ((DoubleVal) left).value;
|
||||
double rightVal= ((DoubleVal) right).value;
|
||||
if(Double.isNaN(leftVal)) {
|
||||
Color color = waveCanvas.colors[WaveformColors.SIGNAL_NAN.ordinal()];
|
||||
int width = xEnd - xBegin;
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
package com.minres.scviewer.database.ui.swt.internal;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.NavigableMap;
|
||||
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.Rectangle;
|
||||
|
||||
import com.minres.scviewer.database.EventKind;
|
||||
import com.minres.scviewer.database.IEvent;
|
||||
import com.minres.scviewer.database.ITx;
|
||||
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.WaveformColors;
|
||||
|
||||
|
@ -33,7 +34,7 @@ public class StreamPainter extends TrackPainter{
|
|||
*
|
||||
*/
|
||||
private final WaveformCanvas waveCanvas;
|
||||
private ITxStream<? extends ITxEvent> stream;
|
||||
private IWaveform stream;
|
||||
private int txBase, txHeight;
|
||||
private boolean even;
|
||||
private TreeSet<ITx> seenTx;
|
||||
|
@ -41,7 +42,7 @@ public class StreamPainter extends TrackPainter{
|
|||
public StreamPainter(WaveformCanvas waveCanvas, boolean even, TrackEntry trackEntry) {
|
||||
super(trackEntry, even);
|
||||
this.waveCanvas = waveCanvas;
|
||||
this.stream=trackEntry.getStream();
|
||||
this.stream=trackEntry.waveform;
|
||||
this.seenTx=new TreeSet<ITx>();
|
||||
}
|
||||
|
||||
|
@ -62,7 +63,7 @@ public class StreamPainter extends TrackPainter{
|
|||
@SuppressWarnings("unchecked")
|
||||
public void paintArea(Projection proj, Rectangle area) {
|
||||
if(stream.getEvents().size()==0) return;
|
||||
int trackHeight=trackEntry.height/stream.getMaxConcurrency();
|
||||
int trackHeight=trackEntry.height/stream.getWidth();
|
||||
txBase=trackHeight/5;
|
||||
txHeight=trackHeight*3/5;
|
||||
if(trackEntry.selected) {
|
||||
|
@ -77,7 +78,7 @@ public class StreamPainter extends TrackPainter{
|
|||
long beginPos = area.x;
|
||||
long beginTime = beginPos*scaleFactor;
|
||||
//long endPos = beginPos + area.width;
|
||||
long endTime = beginTime + area.width*scaleFactor;
|
||||
long endTime = beginTime + area.width*scaleFactor;
|
||||
|
||||
Entry<Long, ?> firstTx=stream.getEvents().floorEntry(beginTime);
|
||||
Entry<Long, ?> lastTx=stream.getEvents().ceilingEntry(endTime);
|
||||
|
@ -88,22 +89,23 @@ public class StreamPainter extends TrackPainter{
|
|||
proj.setLineWidth(1);
|
||||
proj.setForeground(this.waveCanvas.colors[WaveformColors.LINE.ordinal()]);
|
||||
|
||||
for( int y1=area.y+trackHeight/2; y1<area.y+trackEntry.height; y1+=trackHeight)
|
||||
proj.drawLine(area.x, y1, area.x+area.width, y1);
|
||||
for( int y1=area.y+trackHeight/2; y1<area.y+trackEntry.height; y1+=trackHeight)
|
||||
proj.drawLine(area.x, y1, area.x+area.width, y1);
|
||||
if(firstTx==lastTx) {
|
||||
for(ITxEvent txEvent:(Collection<? extends ITxEvent>)firstTx.getValue())
|
||||
drawTx(proj, area, txEvent.getTransaction(), false);
|
||||
}else{
|
||||
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;
|
||||
proj.setForeground(this.waveCanvas.colors[WaveformColors.LINE.ordinal()]);
|
||||
proj.setForeground(this.waveCanvas.colors[WaveformColors.LINE.ordinal()]);
|
||||
|
||||
for(Entry<Long, ?> entry: entries.entrySet())
|
||||
for(ITxEvent txEvent:(Collection<? extends ITxEvent>)entry.getValue()){
|
||||
if(txEvent.getType()==ITxEvent.Type.BEGIN)
|
||||
for(Entry<Long, IEvent[]> entry: entries.entrySet())
|
||||
for(IEvent evt:entry.getValue()){
|
||||
ITxEvent txEvent = (ITxEvent) evt;
|
||||
if(txEvent.getKind()==EventKind.BEGIN)
|
||||
seenTx.add(txEvent.getTransaction());
|
||||
if(txEvent.getType()==ITxEvent.Type.END){
|
||||
if(txEvent.getKind()==EventKind.END){
|
||||
ITx tx = txEvent.getTransaction();
|
||||
highlighed|=waveCanvas.currentSelection!=null && waveCanvas.currentSelection.equals(tx);
|
||||
drawTx(proj, area, tx, false);
|
||||
|
@ -114,18 +116,18 @@ public class StreamPainter extends TrackPainter{
|
|||
drawTx(proj, area, tx, false);
|
||||
}
|
||||
if(highlighed){
|
||||
proj.setForeground(this.waveCanvas.colors[WaveformColors.LINE_HIGHLITE.ordinal()]);
|
||||
drawTx(proj, area, waveCanvas.currentSelection, true);
|
||||
proj.setForeground(this.waveCanvas.colors[WaveformColors.LINE_HIGHLITE.ordinal()]);
|
||||
drawTx(proj, area, waveCanvas.currentSelection, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void drawTx(Projection proj, Rectangle area, ITx tx, boolean highlighted ) {
|
||||
// compute colors
|
||||
java.awt.Color[] fallbackColors = trackEntry.getColors();
|
||||
java.awt.Color[] transColor = TrackEntry.computeColor( tx.getGenerator().getName(), fallbackColors[0], fallbackColors[1] );
|
||||
java.awt.Color[] fallbackColors = trackEntry.getColors();
|
||||
java.awt.Color[] transColor = TrackEntry.computeColor( tx.getGenerator().getName(), fallbackColors[0], fallbackColors[1] );
|
||||
|
||||
proj.setBackground( toSwtColor( proj.getGC(), transColor[highlighted?1:0] ) );
|
||||
proj.setBackground( toSwtColor( proj.getGC(), transColor[highlighted?1:0] ) );
|
||||
|
||||
int offset = tx.getConcurrencyIndex()*this.waveCanvas.getTrackHeight();
|
||||
Rectangle bb = new Rectangle(
|
||||
|
@ -154,7 +156,7 @@ public class StreamPainter extends TrackPainter{
|
|||
|
||||
public ITx getClicked(Point point) {
|
||||
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){
|
||||
do {
|
||||
ITx tx = getTxFromEntry(lane, point.x, firstTx);
|
||||
|
@ -165,31 +167,35 @@ public class StreamPainter extends TrackPainter{
|
|||
return null;
|
||||
}
|
||||
|
||||
public ITxStream<? extends ITxEvent> getStream() {
|
||||
public IWaveform getStream() {
|
||||
return stream;
|
||||
}
|
||||
|
||||
public void setStream(ITxStream<? extends ITxEvent> stream) {
|
||||
public void setStream(IWaveform stream) {
|
||||
this.stream = stream;
|
||||
}
|
||||
|
||||
protected ITx getTxFromEntry(int lane, int offset, Entry<Long, List<ITxEvent>> firstTx) {
|
||||
long timePoint=offset*waveCanvas.getScaleFactor();
|
||||
for(ITxEvent evt:firstTx.getValue()){
|
||||
ITx tx=evt.getTransaction();
|
||||
if(evt.getType()==ITxEvent.Type.BEGIN && tx.getConcurrencyIndex()==lane && tx.getBeginTime()<=timePoint && tx.getEndTime()>=timePoint){
|
||||
return evt.getTransaction();
|
||||
protected ITx getTxFromEntry(int lane, int offset, Entry<Long, IEvent[]> firstTx) {
|
||||
long timePoint=offset*waveCanvas.getScaleFactor();
|
||||
for(IEvent evt:firstTx.getValue()){
|
||||
if(evt instanceof ITxEvent) {
|
||||
ITx tx=((ITxEvent)evt).getTransaction();
|
||||
if(evt.getKind()==EventKind.BEGIN && tx.getConcurrencyIndex()==lane && tx.getBeginTime()<=timePoint && tx.getEndTime()>=timePoint){
|
||||
return ((ITxEvent)evt).getTransaction();
|
||||
}
|
||||
}
|
||||
}
|
||||
// now with some fuzziness
|
||||
timePoint=(offset-5)*waveCanvas.getScaleFactor();
|
||||
long timePointHigh=(offset+5)*waveCanvas.getScaleFactor();
|
||||
for(ITxEvent evt:firstTx.getValue()){
|
||||
ITx tx=evt.getTransaction();
|
||||
if(evt.getType()==ITxEvent.Type.BEGIN && tx.getConcurrencyIndex()==lane && tx.getBeginTime()<=timePointHigh && tx.getEndTime()>=timePoint){
|
||||
return evt.getTransaction();
|
||||
}
|
||||
}
|
||||
timePoint=(offset-5)*waveCanvas.getScaleFactor();
|
||||
long timePointHigh=(offset+5)*waveCanvas.getScaleFactor();
|
||||
for(IEvent evt:firstTx.getValue()){
|
||||
if(evt instanceof ITxEvent) {
|
||||
ITx tx=((ITxEvent)evt).getTransaction();
|
||||
if(evt.getKind()==EventKind.BEGIN && tx.getConcurrencyIndex()==lane && tx.getBeginTime()<=timePointHigh && tx.getEndTime()>=timePoint){
|
||||
return ((ITxEvent)evt).getTransaction();
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
@ -16,6 +16,7 @@ import java.beans.PropertyChangeListener;
|
|||
import java.beans.PropertyChangeSupport;
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
|
@ -78,13 +79,15 @@ import org.eclipse.wb.swt.SWTResourceManager;
|
|||
|
||||
import com.google.common.collect.Lists;
|
||||
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.ITxEvent;
|
||||
import com.minres.scviewer.database.ITxRelation;
|
||||
import com.minres.scviewer.database.ITxStream;
|
||||
import com.minres.scviewer.database.IWaveform;
|
||||
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.ICursor;
|
||||
import com.minres.scviewer.database.ui.IWaveformView;
|
||||
|
@ -251,17 +254,11 @@ public class WaveformView implements IWaveformView {
|
|||
Entry<Long, ?> floorEntry=null, ceilEntry=null;
|
||||
if(o instanceof TrackEntry){
|
||||
TrackEntry entry = (TrackEntry) o;
|
||||
if(entry.waveform instanceof ISignal<?>){
|
||||
NavigableMap<Long, ?> map = ((ISignal<?>)entry.waveform).getEvents();
|
||||
floorEntry = map.floorEntry(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);
|
||||
}
|
||||
NavigableMap<Long, IEvent[]> map = entry.waveform.getEvents();
|
||||
floorEntry = map.floorEntry(time);
|
||||
ceilEntry = map.ceilingEntry(time);
|
||||
} else if(o instanceof ITx){
|
||||
NavigableMap<Long, ?> map = ((ITx)o).getStream().getEvents();
|
||||
NavigableMap<Long, IEvent[]> map = ((ITx)o).getStream().getEvents();
|
||||
floorEntry = map.floorEntry(time);
|
||||
ceilEntry = map.ceilingEntry(time);
|
||||
}
|
||||
|
@ -522,11 +519,11 @@ public class WaveformView implements IWaveformView {
|
|||
for (TrackEntry streamEntry : streams) {
|
||||
streamEntry.height = waveformCanvas.getTrackHeight();
|
||||
streamEntry.vOffset=trackVerticalHeight;
|
||||
if (streamEntry.isStream()) {
|
||||
if (streamEntry.waveform.getType()==WaveformType.TRANSACTION) {
|
||||
streamEntry.currentValue="";
|
||||
streamEntry.height *= streamEntry.getStream().getMaxConcurrency();
|
||||
streamEntry.height *= streamEntry.waveform.getWidth();
|
||||
painter = new StreamPainter(waveformCanvas, even, streamEntry);
|
||||
} else if (streamEntry.isSignal()) {
|
||||
} else if (streamEntry.waveform.getType()==WaveformType.SIGNAL) {
|
||||
streamEntry.currentValue="---";
|
||||
painter = new SignalPainter(waveformCanvas, even, streamEntry);
|
||||
}
|
||||
|
@ -563,11 +560,10 @@ public class WaveformView implements IWaveformView {
|
|||
private void updateValueList(){
|
||||
final Long time = getCursorTime();
|
||||
for(TrackEntry entry:streams){
|
||||
if(entry.isSignal()){
|
||||
ISignal<?> signal = (ISignal<?>) entry.waveform;
|
||||
Object value = signal.getWaveformValueBeforeTime(time);
|
||||
if(value instanceof BitVector){
|
||||
BitVector bv = (BitVector) value;
|
||||
if(entry.waveform.getType() == WaveformType.SIGNAL){
|
||||
IEvent[] value = entry.waveform.getEventsBeforeTime(time);
|
||||
if(value[0] instanceof BitVector){
|
||||
BitVector bv = (BitVector) value[0];
|
||||
if(bv.getWidth()==1)
|
||||
entry.currentValue="b'"+bv;
|
||||
else {
|
||||
|
@ -583,27 +579,28 @@ public class WaveformView implements IWaveformView {
|
|||
entry.currentValue="h'"+bv.toHexString();
|
||||
}
|
||||
}
|
||||
} else if(value instanceof Double){
|
||||
Double val = (Double) value;
|
||||
} else if(value[0] instanceof DoubleVal){
|
||||
Double val = ((DoubleVal) value[0]).value;
|
||||
if(val>0.001)
|
||||
entry.currentValue=String.format("%1$,.3f", val);
|
||||
else
|
||||
entry.currentValue=Double.toString(val);
|
||||
}
|
||||
} else if(entry.isStream()){
|
||||
ITxStream<?> stream = (ITxStream<?>) entry.waveform;
|
||||
ITx[] resultsList = new ITx[stream.getMaxConcurrency()];
|
||||
Entry<Long, List<ITxEvent>> firstTx=stream.getEvents().floorEntry(time);
|
||||
} else if(entry.waveform.getType() == WaveformType.TRANSACTION){
|
||||
ITx[] resultsList = new ITx[entry.waveform.getWidth()];
|
||||
Entry<Long, IEvent[]> firstTx=entry.waveform.getEvents().floorEntry(time);
|
||||
if(firstTx!=null){
|
||||
do {
|
||||
for(ITxEvent evt:firstTx.getValue()){
|
||||
ITx tx=evt.getTransaction();
|
||||
if(evt.getType()==ITxEvent.Type.BEGIN && tx.getBeginTime()<=time && tx.getEndTime()>=time){
|
||||
for(IEvent evt:firstTx.getValue()){
|
||||
if(evt instanceof ITxEvent) {
|
||||
ITx tx=((ITxEvent)evt).getTransaction();
|
||||
if(evt.getKind()==EventKind.BEGIN && tx.getBeginTime()<=time && tx.getEndTime()>=time){
|
||||
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));
|
||||
entry.currentValue="";
|
||||
boolean separator=false;
|
||||
|
@ -804,15 +801,14 @@ public class WaveformView implements IWaveformView {
|
|||
else if(currentWaveformSelection.size()!=1) return;
|
||||
if(selectedWaveform==null)
|
||||
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)){
|
||||
ITxStream<? extends ITxEvent> stream = selectedWaveform.getStream();
|
||||
ITx transaction = null;
|
||||
if (direction == GotoDirection.NEXT) {
|
||||
List<ITxEvent> thisEntryList = stream.getEvents().get(currentTxSelection.getBeginTime());
|
||||
ITxEvent[] thisEntryList = (ITxEvent[]) selectedWaveform.waveform.getEvents().get(currentTxSelection.getBeginTime());
|
||||
boolean meFound=false;
|
||||
for (ITxEvent evt : thisEntryList) {
|
||||
if (evt.getType() == ITxEvent.Type.BEGIN) {
|
||||
if (evt.getKind() == EventKind.BEGIN) {
|
||||
if(meFound){
|
||||
transaction = evt.getTransaction();
|
||||
break;
|
||||
|
@ -821,42 +817,42 @@ public class WaveformView implements IWaveformView {
|
|||
}
|
||||
}
|
||||
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 {
|
||||
for (ITxEvent evt : entry.getValue()) {
|
||||
if (evt.getType() == ITxEvent.Type.BEGIN) {
|
||||
transaction = evt.getTransaction();
|
||||
for (IEvent evt : entry.getValue()) {
|
||||
if (evt instanceof ITxEvent && evt.getKind() == EventKind.BEGIN) {
|
||||
transaction = ((ITxEvent)evt).getTransaction();
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (transaction == null)
|
||||
entry = stream.getEvents().higherEntry(entry.getKey());
|
||||
entry = selectedWaveform.waveform.getEvents().higherEntry(entry.getKey());
|
||||
} while (entry != null && transaction == null);
|
||||
}
|
||||
} else if (direction == GotoDirection.PREV) {
|
||||
List<ITxEvent> thisEntryList = stream.getEvents().get(currentTxSelection.getBeginTime());
|
||||
IEvent[] thisEntryList = selectedWaveform.waveform.getEvents().get(currentTxSelection.getBeginTime());
|
||||
boolean meFound=false;
|
||||
for (ITxEvent evt : Lists.reverse(thisEntryList)) {
|
||||
if (evt.getType() == ITxEvent.Type.BEGIN) {
|
||||
for (IEvent evt : Lists.reverse(Arrays.asList(thisEntryList))) {
|
||||
if (evt instanceof ITxEvent && evt.getKind() == EventKind.BEGIN) {
|
||||
if(meFound){
|
||||
transaction = evt.getTransaction();
|
||||
transaction = ((ITxEvent)evt).getTransaction();
|
||||
break;
|
||||
}
|
||||
meFound|= evt.getTransaction().equals(currentTxSelection);
|
||||
meFound|= ((ITxEvent)evt).getTransaction().equals(currentTxSelection);
|
||||
}
|
||||
}
|
||||
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)
|
||||
do {
|
||||
for (ITxEvent evt : Lists.reverse(entry.getValue())) {
|
||||
if (evt.getType() == ITxEvent.Type.BEGIN) {
|
||||
transaction = evt.getTransaction();
|
||||
for (IEvent evt : Lists.reverse(Arrays.asList(thisEntryList))) {
|
||||
if (evt instanceof ITxEvent && evt.getKind() == EventKind.BEGIN) {
|
||||
transaction = ((ITxEvent)evt).getTransaction();
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (transaction == null)
|
||||
entry = stream.getEvents().lowerEntry(entry.getKey());
|
||||
entry = selectedWaveform.waveform.getEvents().lowerEntry(entry.getKey());
|
||||
} while (entry != null && transaction == null);
|
||||
}
|
||||
}
|
||||
|
@ -896,8 +892,8 @@ public class WaveformView implements IWaveformView {
|
|||
}
|
||||
|
||||
private boolean streamsVisible(ITxRelation relation) {
|
||||
final ITxStream<ITxEvent> src = relation.getSource().getStream();
|
||||
final ITxStream<ITxEvent> tgt = relation.getTarget().getStream();
|
||||
final IWaveform src = relation.getSource().getStream();
|
||||
final IWaveform tgt = relation.getTarget().getStream();
|
||||
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);
|
||||
long time = getCursorTime();
|
||||
NavigableMap<Long, ?> map=null;
|
||||
if(sel.isStream()){
|
||||
map=sel.getStream().getEvents();
|
||||
} else if(sel.isSignal()){
|
||||
map=sel.getSignal().getEvents();
|
||||
if(sel.waveform.getType()==WaveformType.TRANSACTION){
|
||||
map=sel.waveform.getEvents();
|
||||
} else if(sel.waveform.getType()==WaveformType.SIGNAL){
|
||||
map=sel.waveform.getEvents();
|
||||
}
|
||||
if(map!=null){
|
||||
Entry<Long, ?> entry=direction==GotoDirection.PREV?map.lowerEntry(time):map.higherEntry(time);
|
||||
|
@ -981,15 +977,15 @@ public class WaveformView implements IWaveformView {
|
|||
if (lastKey == firstKey) {
|
||||
TrackEntry trackEntry=trackVerticalOffset.get(firstKey);
|
||||
IWaveform w = trackEntry.waveform;
|
||||
if (w instanceof ITxStream<?>)
|
||||
subArea.height *= ((ITxStream<?>) w).getMaxConcurrency();
|
||||
if (w.getType()==WaveformType.TRANSACTION)
|
||||
subArea.height *= w.getWidth();
|
||||
drawTextFormat(gc, subArea, firstKey, w.getFullName(), trackEntry.selected);
|
||||
} else {
|
||||
for (Entry<Integer, TrackEntry> entry : trackVerticalOffset.subMap(firstKey, true, lastKey, true).entrySet()) {
|
||||
IWaveform w = entry.getValue().waveform;
|
||||
subArea.height = waveformCanvas.getTrackHeight();
|
||||
if (w instanceof ITxStream<?>)
|
||||
subArea.height *= ((ITxStream<?>) w).getMaxConcurrency();
|
||||
if (w.getType()==WaveformType.TRANSACTION)
|
||||
subArea.height *= w.getWidth();
|
||||
drawTextFormat(gc, subArea, entry.getKey(), w.getFullName(), entry.getValue().selected);
|
||||
}
|
||||
}
|
||||
|
@ -1008,16 +1004,16 @@ public class WaveformView implements IWaveformView {
|
|||
if (lastKey == firstKey) {
|
||||
TrackEntry trackEntry=trackVerticalOffset.get(firstKey);
|
||||
IWaveform w = trackEntry.waveform;
|
||||
if (w instanceof ITxStream<?>)
|
||||
subArea.height *= ((ITxStream<?>) w).getMaxConcurrency();
|
||||
if (w.getType()==WaveformType.TRANSACTION)
|
||||
subArea.height *= w.getWidth();
|
||||
drawValue(gc, subArea, firstKey, trackEntry.currentValue, trackEntry.selected);
|
||||
} else {
|
||||
for (Entry<Integer, TrackEntry> entry : trackVerticalOffset.subMap(firstKey, true, lastKey, true)
|
||||
.entrySet()) {
|
||||
IWaveform w = entry.getValue().waveform;
|
||||
subArea.height = waveformCanvas.getTrackHeight();
|
||||
if (w instanceof ITxStream<?>)
|
||||
subArea.height *= ((ITxStream<?>) w).getMaxConcurrency();
|
||||
if (w.getType()==WaveformType.TRANSACTION)
|
||||
subArea.height *= w.getWidth();
|
||||
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.IWaveform;
|
||||
import com.minres.scviewer.database.IWaveformDb;
|
||||
import com.minres.scviewer.database.WaveformType;
|
||||
|
||||
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 final String kind = "signal";
|
||||
|
||||
private final int width;
|
||||
|
||||
private final T dummy = null;
|
||||
|
||||
private IWaveformDb db;
|
||||
|
||||
private NavigableMap<Long, IEvent[]> values;
|
||||
|
@ -77,15 +74,6 @@ public class VCDSignal<T extends IEvent> extends HierNode implements IWaveform {
|
|||
return id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getKind() {
|
||||
return kind;
|
||||
}
|
||||
|
||||
public int getWidth() {
|
||||
return width;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IWaveformDb getDb() {
|
||||
return db;
|
||||
|
@ -128,13 +116,13 @@ public class VCDSignal<T extends IEvent> extends HierNode implements IWaveform {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Class<?> getType() {
|
||||
return dummy.getClass();
|
||||
public WaveformType getType() {
|
||||
return WaveformType.SIGNAL;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxConcurrency() {
|
||||
return 1;
|
||||
public int getWidth() {
|
||||
return width;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -173,8 +173,8 @@ public class BitVector implements IEvent {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Class<?> getType() {
|
||||
return this.getClass();
|
||||
public WaveformType getType() {
|
||||
return WaveformType.SIGNAL;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -2,7 +2,7 @@ package com.minres.scviewer.database;
|
|||
|
||||
public class DoubleVal implements IEvent {
|
||||
|
||||
final double value;
|
||||
public final double value;
|
||||
|
||||
public DoubleVal(double value) {
|
||||
this.value=value;
|
||||
|
@ -14,8 +14,8 @@ public class DoubleVal implements IEvent {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Class<?> getType() {
|
||||
return this.getClass();
|
||||
public WaveformType getType() {
|
||||
return WaveformType.SIGNAL;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -6,6 +6,6 @@ public interface IEvent {
|
|||
|
||||
public EventKind getKind();
|
||||
|
||||
public Class<?> getType();
|
||||
public WaveformType getType();
|
||||
|
||||
}
|
||||
|
|
|
@ -16,8 +16,6 @@ public interface IWaveform extends IHierNode {
|
|||
|
||||
public Long getId();
|
||||
|
||||
public String getKind();
|
||||
|
||||
public IWaveformDb getDb();
|
||||
|
||||
public Boolean equals(IWaveform other);
|
||||
|
@ -28,8 +26,8 @@ public interface IWaveform extends IHierNode {
|
|||
|
||||
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 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.e4.application.parts.WaveformViewer;
|
||||
|
||||
|
@ -38,9 +39,9 @@ public class WaveformPopupMenuContribution {
|
|||
for(Object elem:(IStructuredSelection)sel) {
|
||||
if(elem instanceof TrackEntry) {
|
||||
TrackEntry e = (TrackEntry) elem;
|
||||
if(e.waveform instanceof ISignal<?>) {
|
||||
Object o = ((ISignal<?>) e.waveform).getEvents().firstEntry().getValue();
|
||||
if(checkForDouble && o instanceof Double)
|
||||
if(e.waveform.getType() == WaveformType.SIGNAL) {
|
||||
Object o = e.waveform.getEvents().firstEntry().getValue()[0];
|
||||
if(checkForDouble && o instanceof DoubleVal)
|
||||
return true;
|
||||
else if(o instanceof BitVector && ((BitVector)o).getWidth()>1)
|
||||
return true;
|
||||
|
|
|
@ -17,6 +17,7 @@ import org.eclipse.jface.viewers.ISelection;
|
|||
import org.eclipse.jface.viewers.StructuredSelection;
|
||||
import org.eclipse.swt.widgets.Shell;
|
||||
|
||||
import com.minres.scviewer.database.WaveformType;
|
||||
import com.minres.scviewer.database.ui.TrackEntry;
|
||||
import com.minres.scviewer.e4.application.parts.WaveformViewer;
|
||||
public class SearchHandler {
|
||||
|
@ -31,7 +32,7 @@ public class SearchHandler {
|
|||
Object[] elem = ((StructuredSelection)sel).toArray();
|
||||
if(elem.length ==0) return false;
|
||||
TrackEntry e = findTrackEntry(elem);
|
||||
return e!=null && e.isStream();
|
||||
return e!=null && e.waveform.getType()==WaveformType.TRANSACTION;
|
||||
}
|
||||
}
|
||||
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;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
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.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.ISelection;
|
||||
import org.eclipse.jface.viewers.ISelectionChangedListener;
|
||||
import org.eclipse.jface.viewers.IStructuredSelection;
|
||||
|
@ -36,11 +36,13 @@ import org.eclipse.swt.widgets.TableColumn;
|
|||
import org.eclipse.swt.widgets.Text;
|
||||
|
||||
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.ITxAttribute;
|
||||
import com.minres.scviewer.database.ITxEvent;
|
||||
import com.minres.scviewer.database.ITxEvent.Type;
|
||||
import com.minres.scviewer.database.ITxStream;
|
||||
import com.minres.scviewer.database.IWaveform;
|
||||
import com.minres.scviewer.database.WaveformType;
|
||||
import com.minres.scviewer.database.ui.TrackEntry;
|
||||
import com.minres.scviewer.e4.application.parts.txTableTree.AbstractTransactionTreeContentProvider;
|
||||
import com.minres.scviewer.e4.application.parts.txTableTree.AttributeLabelProvider;
|
||||
|
@ -84,7 +86,7 @@ public class TransactionList extends Composite {
|
|||
|
||||
private AttributeLabelProvider valueLabelProvider = null;
|
||||
|
||||
private ITxStream<? extends ITxEvent> stream;
|
||||
private IWaveform stream;
|
||||
|
||||
private ObservableList<AttributeNameBean> attrNames = new WritableList<AttributeNameBean>();
|
||||
|
||||
|
@ -126,6 +128,7 @@ public class TransactionList extends Composite {
|
|||
@Override
|
||||
public void widgetSelected(SelectionEvent e) {
|
||||
int idx = searchPropCombo.getSelectionIndex();
|
||||
if(idx<0) return;
|
||||
AttributeNameBean sel = attrNames.get(idx);
|
||||
txFilter.setSearchProp(sel.getName(), sel.getType());
|
||||
tableViewer.refresh();
|
||||
|
@ -133,6 +136,7 @@ public class TransactionList extends Composite {
|
|||
@Override
|
||||
public void widgetDefaultSelected(SelectionEvent e) {
|
||||
int idx = searchPropCombo.getSelectionIndex();
|
||||
if(idx<0) return;
|
||||
AttributeNameBean sel = attrNames.get(idx);
|
||||
txFilter.setSearchProp(sel.getName(), sel.getType());
|
||||
tableViewer.refresh();
|
||||
|
@ -171,6 +175,7 @@ public class TransactionList extends Composite {
|
|||
@Override
|
||||
public void widgetSelected(SelectionEvent e) {
|
||||
int idx = viewPropCombo.getSelectionIndex();
|
||||
if(idx<0) return;
|
||||
valueLabelProvider.setShowProp(attrNames.get(idx).getName());
|
||||
tableViewer.refresh(true);
|
||||
}
|
||||
|
@ -238,11 +243,11 @@ public class TransactionList extends Composite {
|
|||
}
|
||||
|
||||
public void setInput(TrackEntry trackEntry) {
|
||||
if(trackEntry==null || !trackEntry.isStream()) {
|
||||
if(trackEntry==null || trackEntry.waveform.getType()!=WaveformType.TRANSACTION) {
|
||||
attrNames.clear();
|
||||
tableViewer.setInput(emptyList);
|
||||
} else {
|
||||
stream=trackEntry.getStream();
|
||||
stream=trackEntry.waveform;
|
||||
tableViewer.setInput(emptyList);
|
||||
new Thread() {
|
||||
private ConcurrentHashMap<String, DataType> propNames=new ConcurrentHashMap<String, DataType>();
|
||||
|
@ -255,11 +260,12 @@ public class TransactionList extends Composite {
|
|||
}
|
||||
|
||||
public void run() {
|
||||
eventList = stream.getEvents().values().parallelStream()
|
||||
Collection<IEvent[]> values = stream.getEvents().values();
|
||||
eventList = values.parallelStream().map(Arrays::asList)
|
||||
.flatMap(List::stream)
|
||||
.filter(evt -> evt.getType()==Type.BEGIN)
|
||||
.filter(evt -> evt.getKind()==EventKind.BEGIN)
|
||||
.map(evt-> {
|
||||
ITx tx = evt.getTransaction();
|
||||
ITx tx = ((ITxEvent)evt).getTransaction();
|
||||
for(ITxAttribute attr: tx.getAttributes()) {
|
||||
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.StructuredSelection;
|
||||
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.events.DisposeEvent;
|
||||
import org.eclipse.swt.events.DisposeListener;
|
||||
|
@ -88,6 +86,7 @@ import org.eclipse.swt.widgets.Widget;
|
|||
import org.osgi.service.prefs.Preferences;
|
||||
|
||||
import com.minres.scviewer.database.DataType;
|
||||
import com.minres.scviewer.database.IEvent;
|
||||
import com.minres.scviewer.database.ITx;
|
||||
import com.minres.scviewer.database.ITxAttribute;
|
||||
import com.minres.scviewer.database.ITxEvent;
|
||||
|
@ -790,7 +789,7 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
|
|||
// get transaction id
|
||||
persistedState.put(SELECTED_TX_ID, Long.toString(tx.getId()));
|
||||
//get TrackEntry name
|
||||
String name = te.getStream().getFullName();
|
||||
String name = te.waveform.getFullName();
|
||||
persistedState.put(SELECTED_TRACKENTRY_NAME, name);
|
||||
}
|
||||
}
|
||||
|
@ -874,11 +873,11 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
|
|||
if(te.waveform.getFullName().compareTo(trackentryName)==0) {
|
||||
boolean found = false;
|
||||
// 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;
|
||||
for(ITxEvent itxe : lev) {
|
||||
if(itxe == null) continue;
|
||||
ITx itx = itxe.getTransaction();
|
||||
for(IEvent itxe : lev) {
|
||||
if(itxe == null || !(itxe instanceof ITxEvent)) continue;
|
||||
ITx itx = ((ITxEvent)itxe).getTransaction();
|
||||
if(itx.getId() == txId) {
|
||||
found = true;
|
||||
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.wb.swt.ResourceManager;
|
||||
|
||||
import com.minres.scviewer.database.BitVector;
|
||||
import com.minres.scviewer.database.IHierNode;
|
||||
import com.minres.scviewer.database.ISignal;
|
||||
import com.minres.scviewer.database.ITxStream;
|
||||
import com.minres.scviewer.database.IWaveform;
|
||||
import com.minres.scviewer.database.IWaveformDb;
|
||||
import com.minres.scviewer.e4.application.parts.LoadingWaveformDb;
|
||||
|
||||
|
@ -91,14 +89,21 @@ public class TxDbLabelProvider implements ILabelProvider {
|
|||
return loadinDatabase;
|
||||
else
|
||||
return database;
|
||||
}else if(element instanceof ITxStream){
|
||||
return stream;
|
||||
}else if(element instanceof ISignal<?>){
|
||||
Object o = ((ISignal<?>)element).getEvents().firstEntry().getValue();
|
||||
if(o instanceof BitVector && ((BitVector)o).getWidth()==1)
|
||||
return signal;
|
||||
else
|
||||
return wave;
|
||||
}else if(element instanceof IWaveform){
|
||||
switch(((IWaveform) element).getType()) {
|
||||
case TRANSACTION:
|
||||
return stream;
|
||||
case FILTER:
|
||||
break;
|
||||
case SIGNAL:
|
||||
if(((IWaveform) element).getWidth()==1)
|
||||
return signal;
|
||||
else
|
||||
return wave;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return wave;
|
||||
}else if(element instanceof IHierNode){
|
||||
return folder;
|
||||
} else
|
||||
|
|
|
@ -17,10 +17,9 @@ import org.eclipse.jface.viewers.ILabelProvider;
|
|||
import org.eclipse.jface.viewers.ILabelProviderListener;
|
||||
import org.eclipse.swt.graphics.Image;
|
||||
|
||||
import com.minres.scviewer.database.ISignal;
|
||||
import com.minres.scviewer.database.IWaveformDb;
|
||||
import com.minres.scviewer.database.IHierNode;
|
||||
import com.minres.scviewer.database.ITxStream;
|
||||
import com.minres.scviewer.database.IWaveform;
|
||||
import com.minres.scviewer.ui.TxEditorPlugin;
|
||||
|
||||
public class TxDbTreeLabelProvider implements ILabelProvider {
|
||||
|
@ -31,6 +30,7 @@ public class TxDbTreeLabelProvider implements ILabelProvider {
|
|||
private Image stream;
|
||||
private Image signal;
|
||||
private Image folder;
|
||||
private Image wave;
|
||||
|
||||
|
||||
public TxDbTreeLabelProvider() {
|
||||
|
@ -39,6 +39,8 @@ public class TxDbTreeLabelProvider implements ILabelProvider {
|
|||
stream=TxEditorPlugin.createImage("stream");
|
||||
folder=TxEditorPlugin.createImage("folder");
|
||||
signal=TxEditorPlugin.createImage("signal");
|
||||
wave=TxEditorPlugin.createImage("wave");
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -68,10 +70,21 @@ public class TxDbTreeLabelProvider implements ILabelProvider {
|
|||
public Image getImage(Object element) {
|
||||
if(element instanceof IWaveformDb){
|
||||
return database;
|
||||
}else if(element instanceof ITxStream){
|
||||
return stream;
|
||||
}else if(element instanceof ISignal<?>){
|
||||
return signal;
|
||||
}else if(element instanceof IWaveform){
|
||||
switch(((IWaveform) element).getType()) {
|
||||
case TRANSACTION:
|
||||
return stream;
|
||||
case FILTER:
|
||||
break;
|
||||
case SIGNAL:
|
||||
if(((IWaveform) element).getWidth()==1)
|
||||
return signal;
|
||||
else
|
||||
return wave;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return wave;
|
||||
}else if(element instanceof IHierNode){
|
||||
return folder;
|
||||
} else
|
||||
|
|
Loading…
Reference in New Issue