Merge branch 'develop'

This commit is contained in:
Eyck Jentzsch 2018-10-15 09:17:44 +02:00
commit 694dad1cf5
20 changed files with 59 additions and 54 deletions

View File

@ -4,7 +4,7 @@
<parent>
<groupId>com.minres.scviewer</groupId>
<artifactId>com.minres.scviewer.parent</artifactId>
<version>1.0.0-SNAPSHOT</version>
<version>2.0.0-SNAPSHOT</version>
<relativePath>../com.minres.scviewer.parent</relativePath>
</parent>
<packaging>eclipse-plugin</packaging>

View File

@ -117,6 +117,7 @@ public class TxStream extends HierNode implements ITxStream<ITxEvent> {
sb.append(scvStream.getId());
resultSet = statement.executeQuery(sb.toString());
while (resultSet.next()) {
if(maxConcurrency==null) maxConcurrency=0;
Object value = resultSet.getObject("concurrencyLevel");
if(value!=null)
maxConcurrency=(Integer) value;

View File

@ -5,7 +5,7 @@
<parent>
<groupId>com.minres.scviewer</groupId>
<artifactId>com.minres.scviewer.parent</artifactId>
<version>1.0.0-SNAPSHOT</version>
<version>2.0.0-SNAPSHOT</version>
<relativePath>../com.minres.scviewer.parent</relativePath>
</parent>
<packaging>eclipse-test-plugin</packaging>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>com.minres.scviewer</groupId>
<artifactId>com.minres.scviewer.parent</artifactId>
<version>1.0.0-SNAPSHOT</version>
<version>2.0.0-SNAPSHOT</version>
<relativePath>../com.minres.scviewer.parent</relativePath>
</parent>
<packaging>eclipse-plugin</packaging>

View File

@ -6,7 +6,7 @@
<parent>
<groupId>com.minres.scviewer</groupId>
<artifactId>com.minres.scviewer.parent</artifactId>
<version>1.0.0-SNAPSHOT</version>
<version>2.0.0-SNAPSHOT</version>
<relativePath>../com.minres.scviewer.parent</relativePath>
</parent>
</project>

View File

@ -0,0 +1,9 @@
package com.minres.scviewer.database.swt;
public class Constants {
public final static String[] unitString={"fs", "ps", "ns", "us", "ms"};//, "s"};
public final static int[] unitMultiplier={1, 3, 10, 30, 100, 300};
}

View File

@ -41,6 +41,7 @@ import com.minres.scviewer.database.ITx;
import com.minres.scviewer.database.IWaveform;
import com.minres.scviewer.database.IWaveformEvent;
import com.minres.scviewer.database.RelationType;
import com.minres.scviewer.database.swt.Constants;
import com.minres.scviewer.database.ui.IWaveformViewer;
import com.minres.scviewer.database.ui.TrackEntry;
import com.minres.scviewer.database.ui.WaveformColors;
@ -57,10 +58,6 @@ public class WaveformCanvas extends Canvas {
private int level = 12;
public final static String[] unitString={"fs", "ps", "ns", "us", "ms"};//, "s"};
public final static int[] unitMultiplier={1, 3, 10, 30, 100, 300};
private long maxTime;
protected Point origin; /* original size */
@ -225,12 +222,12 @@ public class WaveformCanvas extends Canvas {
}
public int getMaxZoomLevel(){
return unitMultiplier.length*unitString.length-1;
return Constants.unitMultiplier.length*Constants.unitString.length-1;
}
public void setZoomLevel(int level) {
long oldScaleFactor=scaleFactor;
if(level<unitMultiplier.length*unitString.length){
if(level<Constants.unitMultiplier.length*Constants.unitString.length){
this.level = level;
this.scaleFactor = (long) Math.pow(10, level/2);
if(level%2==1) this.scaleFactor*=3;
@ -262,17 +259,17 @@ public class WaveformCanvas extends Canvas {
}
public long getScaleFactorPow10() {
int scale = level/unitMultiplier.length;
int scale = level/Constants.unitMultiplier.length;
double res = Math.pow(1000, scale);
return (long) res;
}
public String getUnitStr(){
return unitString[level/unitMultiplier.length];
return Constants.unitString[level/Constants.unitMultiplier.length];
}
public int getUnitMultiplier(){
return unitMultiplier[level%unitMultiplier.length];
return Constants.unitMultiplier[level%Constants.unitMultiplier.length];
}
public long getTimeForOffset(int xOffset){

View File

@ -82,6 +82,7 @@ import com.minres.scviewer.database.ITxStream;
import com.minres.scviewer.database.IWaveform;
import com.minres.scviewer.database.IWaveformEvent;
import com.minres.scviewer.database.RelationType;
import com.minres.scviewer.database.swt.Constants;
import com.minres.scviewer.database.ui.GotoDirection;
import com.minres.scviewer.database.ui.ICursor;
import com.minres.scviewer.database.ui.IWaveformViewer;
@ -1194,10 +1195,10 @@ public class WaveformViewer implements IWaveformViewer {
*/
@Override
public String[] getZoomLevels(){
String[] res = new String[WaveformCanvas.unitMultiplier.length*WaveformCanvas.unitString.length];
String[] res = new String[Constants.unitMultiplier.length*Constants.unitString.length];
int index=0;
for(String unit:WaveformCanvas.unitString){
for(int factor:WaveformCanvas.unitMultiplier){
for(String unit:Constants.unitString){
for(int factor:Constants.unitMultiplier){
res[index++]= new Integer(factor).toString()+unit;
}
}

View File

@ -70,6 +70,7 @@ public class VCDDbLoader implements IWaveformDbLoader, IVCDDatabaseBuilder {
@Override
public boolean load(IWaveformDb db, File file) throws Exception {
this.db=db;
this.maxTime=0;
FileInputStream fis = new FileInputStream(file);
byte[] buffer = new byte[dateBytes.length];
int read = fis.read(buffer, 0, dateBytes.length);

View File

@ -184,6 +184,9 @@ class VCDFileParser {
int netWidth = traceBuilder.getNetWidth(net);
if(netWidth<0) {
if("nan".equals(value))
traceBuilder.appendTransition(net, currentTime, Double.NaN);
else
traceBuilder.appendTransition(net, currentTime, Double.parseDouble(value));
} else {
BitVector decodedValues = new BitVector(netWidth);

View File

@ -10,6 +10,7 @@
*******************************************************************************/
package com.minres.scviewer.database.vcd;
import java.util.Map.Entry;
import java.util.NavigableMap;
import java.util.TreeMap;
@ -106,6 +107,10 @@ public class VCDSignal<T extends ISignalChange> extends HierNode implements ISig
@Override
public T getWaveformEventsBeforeTime(Long time) {
Entry<Long, T> e = values.floorEntry(time);
if(e==null)
return null;
else
return values.floorEntry(time).getValue();
}

View File

@ -4,7 +4,7 @@
<parent>
<groupId>com.minres.scviewer</groupId>
<artifactId>com.minres.scviewer.parent</artifactId>
<version>1.0.0-SNAPSHOT</version>
<version>2.0.0-SNAPSHOT</version>
<relativePath>../com.minres.scviewer.parent</relativePath>
</parent>
<packaging>eclipse-plugin</packaging>

View File

@ -64,9 +64,12 @@ public class E4LifeCycle {
@PostContextCreate
void postContextCreate(IApplicationContext appContext, final IEventBroker eventBroker) {
final String[] args = (String[])appContext.getArguments().get(IApplicationContext.APPLICATION_ARGS);
Options opt = new Options(args, 1);
opt.getSet().addOption("c", Separator.BLANK, Multiplicity.ONCE);
if (!opt.check(Options.DEFAULT_SET, true, true)) {
Options opt = new Options(args, 0);
opt.getSet()
.addOption("clearPersistedState", Multiplicity.ZERO_OR_ONE)
.addOption("c", Separator.BLANK, Multiplicity.ZERO_OR_ONE);
if (!opt.check(Options.DEFAULT_SET, true, false)) {
System.err.println(opt.getCheckErrors());
System.exit(1);
}
final String confFile =opt.getSet().isSet("c")?opt.getSet().getOption("c").getResultValue(0):"";

View File

@ -30,31 +30,20 @@ public class OpenHandler {
@Execute
public void execute(Shell shell, MApplication app, EModelService modelService, EPartService partService){
FileDialog dialog = new FileDialog(shell, SWT.OPEN | SWT.MULTI);
// dialog.setFilterExtensions (new String []{"vcd", "txdb", "txlog"});
dialog.setFilterExtensions (new String []{Messages.OpenHandler_0});
dialog.open();
String path = dialog.getFilterPath();
for(String fileName: dialog.getFileNames()){
File file = new File(path+File.separator+fileName);
if(file.exists()){
// MPart part = MBasicFactory.INSTANCE.createPart();
// part.setLabel(fileName);
// part.setContributionURI("bundleclass://com.minres.scviewer.e4.application/"+ WaveformViewerPart.class.getName());
MPart part = partService .createPart("com.minres.scviewer.e4.application.partdescriptor.waveformviewer"); //$NON-NLS-1$
part.setLabel(file.getName());
MPartStack partStack = (MPartStack)modelService.find("org.eclipse.editorss", app); //$NON-NLS-1$
partStack.getChildren().add(part);
partService.showPart(part, PartState.ACTIVATE);
// Object o = part.getObject();
// if(o instanceof WaveformViewerPart)
// ((WaveformViewerPart)o).setPartInput(file);
IEclipseContext ctx=part.getContext();
ctx.modify("input", file); //$NON-NLS-1$
ctx.declareModifiable("input"); //$NON-NLS-1$
ctx.modify("config", ""); //$NON-NLS-1$
}
}
}

View File

@ -75,6 +75,7 @@ import com.minres.scviewer.database.IWaveformDb;
import com.minres.scviewer.database.IWaveformDbFactory;
import com.minres.scviewer.database.IWaveformEvent;
import com.minres.scviewer.database.RelationType;
import com.minres.scviewer.database.swt.Constants;
import com.minres.scviewer.database.swt.WaveformViewerFactory;
import com.minres.scviewer.database.ui.GotoDirection;
import com.minres.scviewer.database.ui.ICursor;
@ -865,12 +866,6 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
updateAll();
}
//FIXME: need to use unitString and unitMultiplier from class WaveformCanvas which is located in >com.minres.scviewer.database.swt.internal.
//Trying to import com.minres.scviewer.database.swt.internal.WaveformCanvas results in the error:
//'Access restriction: The type 'WaveformCanvas' is not API (restriction on required project 'com.minres.scviewer.database.ui.swt')'.
public final static String[] unitString={"fs", "ps", "ns", "<EFBFBD>s", "ms"};//, "s"};
public final static int[] unitMultiplier={1, 3, 10, 30, 100, 300};
/**
* Sets the zoom fit.
*/
@ -883,14 +878,9 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
Rectangle clientArea = myParent.getClientArea();
long clientAreaWidth = clientArea.width;
//System.out.println("ZoomLevel[] Array (Length " + zoomLevel.length + "): " + Arrays.toString(zoomLevel));
//System.out.println("ClientArea myParent: " + myParent.getClientArea());
//System.out.println("MaxTime: " + maxTime);
//System.out.println("clientAreaWidth: " + clientAreaWidth);
boolean foundZoom=false;
//try to find existing zoomlevel where scaleFactor*clientAreaWidth >= maxTime, if one is found set it as new zoomlevel
for (int level=0; level<unitMultiplier.length*unitString.length; level++){
for (int level=0; level<Constants.unitMultiplier.length*Constants.unitString.length; level++){
long scaleFactor = (long) Math.pow(10, level/2);
if(level%2==1) scaleFactor*=3;
if(scaleFactor*clientAreaWidth >= maxTime) {
@ -900,7 +890,7 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
}
}
//if no zoom level is found, set biggest one available
if(!foundZoom) setZoomLevel(unitMultiplier.length*unitString.length-1);
if(!foundZoom) setZoomLevel(Constants.unitMultiplier.length*Constants.unitString.length-1);
updateAll();
}

View File

@ -34,6 +34,9 @@
</launcher>
<vm>
<linux include="false">org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8</linux>
<macos include="false">org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8</macos>
<windows include="false">org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8</windows>
</vm>
<license>
@ -71,6 +74,7 @@
<plugin id="org.eclipse.core.databinding.property"/>
<plugin id="org.eclipse.core.expressions"/>
<plugin id="org.eclipse.core.filesystem"/>
<plugin id="org.eclipse.core.filesystem.linux.x86_64" fragment="true"/>
<plugin id="org.eclipse.core.filesystem.macosx" fragment="true"/>
<plugin id="org.eclipse.core.filesystem.win32.x86_64" fragment="true"/>
<plugin id="org.eclipse.core.jobs"/>
@ -92,6 +96,7 @@
<plugin id="org.eclipse.e4.ui.di"/>
<plugin id="org.eclipse.e4.ui.model.workbench"/>
<plugin id="org.eclipse.e4.ui.services"/>
<plugin id="org.eclipse.e4.ui.swt.gtk" fragment="true"/>
<plugin id="org.eclipse.e4.ui.widgets"/>
<plugin id="org.eclipse.e4.ui.workbench"/>
<plugin id="org.eclipse.e4.ui.workbench.addons.swt"/>
@ -120,6 +125,7 @@
<plugin id="org.eclipse.pde.ds.lib"/>
<plugin id="org.eclipse.swt"/>
<plugin id="org.eclipse.swt.cocoa.macosx.x86_64" fragment="true"/>
<plugin id="org.eclipse.swt.gtk.linux.x86_64" fragment="true"/>
<plugin id="org.eclipse.swt.win32.win32.x86_64" fragment="true"/>
<plugin id="org.w3c.css.sac"/>
<plugin id="org.w3c.dom.events"/>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>com.minres.scviewer</groupId>
<artifactId>com.minres.scviewer.parent</artifactId>
<version>1.0.0-SNAPSHOT</version>
<version>2.0.0-SNAPSHOT</version>
<relativePath>../com.minres.scviewer.parent</relativePath>
</parent>
</project>

View File

@ -12,7 +12,7 @@
<parent>
<groupId>com.minres.scviewer</groupId>
<artifactId>com.minres.scviewer.parent</artifactId>
<version>1.0.0-SNAPSHOT</version>
<version>2.0.0-SNAPSHOT</version>
<relativePath>../com.minres.scviewer.parent</relativePath>
</parent>

View File

@ -4,7 +4,7 @@
<parent>
<groupId>com.minres.scviewer</groupId>
<artifactId>com.minres.scviewer.parent</artifactId>
<version>1.0.0-SNAPSHOT</version>
<version>2.0.0-SNAPSHOT</version>
<relativePath>../com.minres.scviewer.parent</relativePath>
</parent>
<packaging>eclipse-plugin</packaging>

View File

@ -6,7 +6,7 @@
<parent>
<groupId>com.minres.scviewer</groupId>
<artifactId>com.minres.scviewer.parent</artifactId>
<version>1.0.0-SNAPSHOT</version>
<version>2.0.0-SNAPSHOT</version>
<relativePath>../com.minres.scviewer.parent</relativePath>
</parent>
<!-- <build>