Merge branch 'feature/keep_properties_scroll' into develop
This commit is contained in:
commit
de15b84bef
|
@ -84,7 +84,11 @@ public class TextDbLoader implements IWaveformDbLoader{
|
||||||
calculateConcurrencyIndicees()
|
calculateConcurrencyIndicees()
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
} catch(Exception e) { }
|
} catch(EOFException e) {
|
||||||
|
return true;
|
||||||
|
} catch(Exception e) {
|
||||||
|
e.printStackTrace()
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -13,6 +13,8 @@ package com.minres.scviewer.database.vcd;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileInputStream;
|
import java.io.FileInputStream;
|
||||||
import java.io.FileNotFoundException;
|
import java.io.FileNotFoundException;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -20,6 +22,7 @@ import java.util.NavigableMap;
|
||||||
import java.util.Stack;
|
import java.util.Stack;
|
||||||
import java.util.TreeMap;
|
import java.util.TreeMap;
|
||||||
import java.util.Vector;
|
import java.util.Vector;
|
||||||
|
import java.util.zip.GZIPInputStream;
|
||||||
|
|
||||||
import com.minres.scviewer.database.BitVector;
|
import com.minres.scviewer.database.BitVector;
|
||||||
import com.minres.scviewer.database.ISignal;
|
import com.minres.scviewer.database.ISignal;
|
||||||
|
@ -56,8 +59,20 @@ public class VCDDbLoader implements IWaveformDbLoader, IVCDDatabaseBuilder {
|
||||||
public VCDDbLoader() {
|
public VCDDbLoader() {
|
||||||
}
|
}
|
||||||
|
|
||||||
/** The date bytes. */
|
private static boolean isGzipped(File f) {
|
||||||
private byte[] dateBytes = "$date".getBytes();
|
InputStream is = null;
|
||||||
|
try {
|
||||||
|
is = new FileInputStream(f);
|
||||||
|
byte [] signature = new byte[2];
|
||||||
|
int nread = is.read( signature ); //read the gzip signature
|
||||||
|
return nread == 2 && signature[ 0 ] == (byte) 0x1f && signature[ 1 ] == (byte) 0x8b;
|
||||||
|
} catch (IOException e) {
|
||||||
|
return false;
|
||||||
|
} finally {
|
||||||
|
try { is.close();} catch (IOException e) { }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see com.minres.scviewer.database.ITrDb#load(java.io.File)
|
* @see com.minres.scviewer.database.ITrDb#load(java.io.File)
|
||||||
|
@ -67,22 +82,16 @@ public class VCDDbLoader implements IWaveformDbLoader, IVCDDatabaseBuilder {
|
||||||
public boolean load(IWaveformDb db, File file) throws Exception {
|
public boolean load(IWaveformDb db, File file) throws Exception {
|
||||||
this.db=db;
|
this.db=db;
|
||||||
this.maxTime=0;
|
this.maxTime=0;
|
||||||
try {
|
String name = file.getCanonicalFile().getName();
|
||||||
FileInputStream fis = new FileInputStream(file);
|
if(!(name.endsWith(".vcd") ||
|
||||||
byte[] buffer = new byte[dateBytes.length];
|
name.endsWith(".vcdz") ||
|
||||||
int read = fis.read(buffer, 0, dateBytes.length);
|
name.endsWith(".vcdgz") ||
|
||||||
fis.close();
|
name.endsWith(".vcd.gz")) )
|
||||||
if (read == dateBytes.length)
|
|
||||||
for (int i = 0; i < dateBytes.length; i++)
|
|
||||||
if (buffer[i] != dateBytes[i])
|
|
||||||
return false;
|
return false;
|
||||||
} catch(FileNotFoundException e) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
signals = new Vector<IWaveform>();
|
signals = new Vector<IWaveform>();
|
||||||
moduleStack= new Stack<String>();
|
moduleStack= new Stack<String>();
|
||||||
boolean res = new VCDFileParser(false).load(new FileInputStream(file), this);
|
FileInputStream fis = new FileInputStream(file);
|
||||||
|
boolean res = new VCDFileParser(false).load(isGzipped(file)?new GZIPInputStream(fis):fis, this);
|
||||||
moduleStack=null;
|
moduleStack=null;
|
||||||
if(!res) throw new InputFormatException();
|
if(!res) throw new InputFormatException();
|
||||||
// calculate max time of database
|
// calculate max time of database
|
||||||
|
|
|
@ -22,10 +22,12 @@ class VCDFileParser {
|
||||||
private HashMap<String, Integer> nameToNetMap = new HashMap<String, Integer>();
|
private HashMap<String, Integer> nameToNetMap = new HashMap<String, Integer>();
|
||||||
private long picoSecondsPerIncrement;
|
private long picoSecondsPerIncrement;
|
||||||
private boolean stripNetWidth;
|
private boolean stripNetWidth;
|
||||||
|
private boolean replaceColon;
|
||||||
long currentTime;
|
long currentTime;
|
||||||
|
|
||||||
public VCDFileParser(boolean stripNetWidth) {
|
public VCDFileParser(boolean stripNetWidth) {
|
||||||
this.stripNetWidth=stripNetWidth;
|
this.stripNetWidth=stripNetWidth;
|
||||||
|
this.replaceColon=false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean load(InputStream is, IVCDDatabaseBuilder builder) {
|
public boolean load(InputStream is, IVCDDatabaseBuilder builder) {
|
||||||
|
@ -76,11 +78,17 @@ class VCDFileParser {
|
||||||
}
|
}
|
||||||
|
|
||||||
Integer net = nameToNetMap.get(id);
|
Integer net = nameToNetMap.get(id);
|
||||||
if (net == null) {
|
if (net == null) { // We've never seen this net before
|
||||||
// We've never seen this net before
|
|
||||||
if(stripNetWidth){
|
|
||||||
int openBracket = netName.indexOf('[');
|
int openBracket = netName.indexOf('[');
|
||||||
|
if(stripNetWidth){
|
||||||
if (openBracket != -1) netName = netName.substring(0, openBracket);
|
if (openBracket != -1) netName = netName.substring(0, openBracket);
|
||||||
|
openBracket = -1;
|
||||||
|
}
|
||||||
|
if(replaceColon) {
|
||||||
|
if (openBracket != -1) {
|
||||||
|
netName = netName.substring(0, openBracket).replaceAll(":", ".")+netName.substring(openBracket);
|
||||||
|
} else
|
||||||
|
netName=netName.replaceAll(":", ".");
|
||||||
}
|
}
|
||||||
nameToNetMap.put(id, traceBuilder.newNet(netName, -1, width));
|
nameToNetMap.put(id, traceBuilder.newNet(netName, -1, width));
|
||||||
} else {
|
} else {
|
||||||
|
@ -89,6 +97,17 @@ class VCDFileParser {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void parseComment() throws Exception {
|
||||||
|
nextToken();
|
||||||
|
String s = tokenizer.sval;
|
||||||
|
nextToken();
|
||||||
|
while(!tokenizer.sval.equals("$end")){
|
||||||
|
s+=" "+tokenizer.sval;
|
||||||
|
nextToken();
|
||||||
|
}
|
||||||
|
replaceColon|=s.contains("ARTERIS Architecture");
|
||||||
|
}
|
||||||
|
|
||||||
private void parseTimescale() throws Exception {
|
private void parseTimescale() throws Exception {
|
||||||
nextToken();
|
nextToken();
|
||||||
String s = tokenizer.sval;
|
String s = tokenizer.sval;
|
||||||
|
@ -132,6 +151,8 @@ class VCDFileParser {
|
||||||
parseUpscope();
|
parseUpscope();
|
||||||
else if (tokenizer.sval.equals("$timescale"))
|
else if (tokenizer.sval.equals("$timescale"))
|
||||||
parseTimescale();
|
parseTimescale();
|
||||||
|
else if (tokenizer.sval.equals("$comment"))
|
||||||
|
parseComment();
|
||||||
else if (tokenizer.sval.equals("$enddefinitions")) {
|
else if (tokenizer.sval.equals("$enddefinitions")) {
|
||||||
match("$end");
|
match("$end");
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -29,9 +29,11 @@ import org.eclipse.jface.viewers.IDoubleClickListener;
|
||||||
import org.eclipse.jface.viewers.ISelection;
|
import org.eclipse.jface.viewers.ISelection;
|
||||||
import org.eclipse.jface.viewers.IStructuredSelection;
|
import org.eclipse.jface.viewers.IStructuredSelection;
|
||||||
import org.eclipse.jface.viewers.ITreeContentProvider;
|
import org.eclipse.jface.viewers.ITreeContentProvider;
|
||||||
|
import org.eclipse.jface.viewers.ITreeViewerListener;
|
||||||
import org.eclipse.jface.viewers.LabelProvider;
|
import org.eclipse.jface.viewers.LabelProvider;
|
||||||
import org.eclipse.jface.viewers.StructuredSelection;
|
import org.eclipse.jface.viewers.StructuredSelection;
|
||||||
import org.eclipse.jface.viewers.StyledString;
|
import org.eclipse.jface.viewers.StyledString;
|
||||||
|
import org.eclipse.jface.viewers.TreeExpansionEvent;
|
||||||
import org.eclipse.jface.viewers.TreeViewer;
|
import org.eclipse.jface.viewers.TreeViewer;
|
||||||
import org.eclipse.jface.viewers.TreeViewerColumn;
|
import org.eclipse.jface.viewers.TreeViewerColumn;
|
||||||
import org.eclipse.jface.viewers.Viewer;
|
import org.eclipse.jface.viewers.Viewer;
|
||||||
|
@ -51,6 +53,7 @@ import org.eclipse.swt.layout.GridLayout;
|
||||||
import org.eclipse.swt.widgets.Composite;
|
import org.eclipse.swt.widgets.Composite;
|
||||||
import org.eclipse.swt.widgets.Text;
|
import org.eclipse.swt.widgets.Text;
|
||||||
import org.eclipse.swt.widgets.Tree;
|
import org.eclipse.swt.widgets.Tree;
|
||||||
|
import org.eclipse.swt.widgets.TreeItem;
|
||||||
|
|
||||||
import com.minres.scviewer.database.ITx;
|
import com.minres.scviewer.database.ITx;
|
||||||
import com.minres.scviewer.database.ITxAttribute;
|
import com.minres.scviewer.database.ITxAttribute;
|
||||||
|
@ -129,6 +132,19 @@ public class TransactionDetails {
|
||||||
treeViewer.addFilter(attributeFilter);
|
treeViewer.addFilter(attributeFilter);
|
||||||
treeViewer.setComparator(viewSorter);
|
treeViewer.setComparator(viewSorter);
|
||||||
treeViewer.setAutoExpandLevel(2);
|
treeViewer.setAutoExpandLevel(2);
|
||||||
|
treeViewer.addTreeListener(new ITreeViewerListener() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void treeCollapsed(TreeExpansionEvent event) {
|
||||||
|
treeViewer.getSelection();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void treeExpanded(TreeExpansionEvent event) {
|
||||||
|
treeViewer.getSelection();
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
// Set up the table
|
// Set up the table
|
||||||
Tree tree = treeViewer.getTree();
|
Tree tree = treeViewer.getTree();
|
||||||
|
@ -247,6 +263,21 @@ public class TransactionDetails {
|
||||||
this.waveformViewerPart=part;
|
this.waveformViewerPart=part;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setInput(Object object) {
|
||||||
|
if(object instanceof ITx){
|
||||||
|
TreeItem obj = treeViewer.getTree().getTopItem();
|
||||||
|
Rectangle bounds = null;
|
||||||
|
if(obj!=null) bounds=obj.getBounds();
|
||||||
|
treeViewer.setInput(object);
|
||||||
|
if(bounds!=null) {
|
||||||
|
TreeItem ti = treeViewer.getTree().getItem (new Point(bounds.x, bounds.y));
|
||||||
|
treeViewer.getTree().setTopItem(ti);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
treeViewer.setInput(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* Sets the selection.
|
* Sets the selection.
|
||||||
*
|
*
|
||||||
|
@ -256,12 +287,7 @@ public class TransactionDetails {
|
||||||
public void setSelection(@Named(IServiceConstants.ACTIVE_SELECTION) @Optional IStructuredSelection selection){
|
public void setSelection(@Named(IServiceConstants.ACTIVE_SELECTION) @Optional IStructuredSelection selection){
|
||||||
if(treeViewer!=null && selection!=null && !treeViewer.getTree().isDisposed()){
|
if(treeViewer!=null && selection!=null && !treeViewer.getTree().isDisposed()){
|
||||||
if( selection instanceof IStructuredSelection) {
|
if( selection instanceof IStructuredSelection) {
|
||||||
Object object= ((IStructuredSelection)selection).getFirstElement();
|
setInput(((IStructuredSelection)selection).getFirstElement());
|
||||||
if(object instanceof ITx){
|
|
||||||
treeViewer.setInput(object);
|
|
||||||
} else {
|
|
||||||
treeViewer.setInput(null);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue