Fixed bugs and enhanced functionality to allow E4 application
This commit is contained in:
parent
1f338cbf3f
commit
ef3ce7273a
|
@ -11,7 +11,6 @@ Require-Bundle: com.minres.scviewer.database;bundle-version="1.0.0",
|
||||||
org.eclipse.osgi.services;bundle-version="3.4.0"
|
org.eclipse.osgi.services;bundle-version="3.4.0"
|
||||||
Bundle-ClassPath: .,sqlite-jdbc-3.8.7.jar
|
Bundle-ClassPath: .,sqlite-jdbc-3.8.7.jar
|
||||||
Service-Component: OSGI-INF/component.xml
|
Service-Component: OSGI-INF/component.xml
|
||||||
Export-Package: com.minres.scviewer.database.sqlite
|
|
||||||
Bundle-ActivationPolicy: lazy
|
Bundle-ActivationPolicy: lazy
|
||||||
Embed-Dependency: sqlite-jdbc
|
Embed-Dependency: sqlite-jdbc
|
||||||
Embedded-Artifacts: sqlite-jdbc-3.8.7.jar;g="org.xerial";
|
Embedded-Artifacts: sqlite-jdbc-3.8.7.jar;g="org.xerial";
|
||||||
|
|
|
@ -33,10 +33,6 @@ public class SQLiteDbLoader implements IWaveformDbLoader {
|
||||||
|
|
||||||
protected IDatabase database;
|
protected IDatabase database;
|
||||||
|
|
||||||
protected List<IWaveform<? extends IWaveformEvent>> streams;
|
|
||||||
|
|
||||||
long timeResolution=1;
|
|
||||||
|
|
||||||
private RelationTypeFactory rtf = new RelationTypeFactory();
|
private RelationTypeFactory rtf = new RelationTypeFactory();
|
||||||
|
|
||||||
private IWaveformDb db;
|
private IWaveformDb db;
|
||||||
|
@ -63,19 +59,17 @@ public class SQLiteDbLoader implements IWaveformDbLoader {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<IWaveform<? extends IWaveformEvent>> getAllWaves() {
|
public List<IWaveform<? extends IWaveformEvent>> getAllWaves() {
|
||||||
if(streams==null){
|
SQLiteDatabaseSelectHandler<ScvStream> handler = new SQLiteDatabaseSelectHandler<ScvStream>(ScvStream.class, database);
|
||||||
SQLiteDatabaseSelectHandler<ScvStream> handler = new SQLiteDatabaseSelectHandler<ScvStream>(ScvStream.class, database);
|
List<IWaveform<? extends IWaveformEvent>> streams=new ArrayList<IWaveform<? extends IWaveformEvent>>();
|
||||||
streams=new ArrayList<IWaveform<? extends IWaveformEvent>>();
|
try {
|
||||||
try {
|
for(ScvStream scvStream:handler.selectObjects()){
|
||||||
for(ScvStream scvStream:handler.selectObjects()){
|
TxStream stream = new TxStream(database, db, scvStream);
|
||||||
TxStream stream = new TxStream(database, db, scvStream);
|
stream.setRelationTypeFactory(rtf);
|
||||||
stream.setRelationTypeFactory(rtf);
|
streams.add(stream);
|
||||||
streams.add(stream);
|
|
||||||
}
|
|
||||||
} catch (SecurityException | IllegalArgumentException | InstantiationException | IllegalAccessException
|
|
||||||
| InvocationTargetException | SQLException | IntrospectionException e) {
|
|
||||||
// e.printStackTrace();
|
|
||||||
}
|
}
|
||||||
|
} catch (SecurityException | IllegalArgumentException | InstantiationException | IllegalAccessException
|
||||||
|
| InvocationTargetException | SQLException | IntrospectionException e) {
|
||||||
|
// e.printStackTrace();
|
||||||
}
|
}
|
||||||
return streams;
|
return streams;
|
||||||
}
|
}
|
||||||
|
@ -85,7 +79,6 @@ public class SQLiteDbLoader implements IWaveformDbLoader {
|
||||||
@Override
|
@Override
|
||||||
public boolean load(IWaveformDb db, File file) throws Exception {
|
public boolean load(IWaveformDb db, File file) throws Exception {
|
||||||
this.db=db;
|
this.db=db;
|
||||||
streams=null;
|
|
||||||
FileInputStream fis = new FileInputStream(file);
|
FileInputStream fis = new FileInputStream(file);
|
||||||
byte[] buffer = new byte[x.length];
|
byte[] buffer = new byte[x.length];
|
||||||
int read = fis.read(buffer, 0, x.length);
|
int read = fis.read(buffer, 0, x.length);
|
||||||
|
|
|
@ -27,7 +27,9 @@ import com.minres.scviewer.database.ITx;
|
||||||
import com.minres.scviewer.database.ITxEvent;
|
import com.minres.scviewer.database.ITxEvent;
|
||||||
import com.minres.scviewer.database.ITxGenerator;
|
import com.minres.scviewer.database.ITxGenerator;
|
||||||
import com.minres.scviewer.database.ITxStream;
|
import com.minres.scviewer.database.ITxStream;
|
||||||
|
import com.minres.scviewer.database.IWaveform;
|
||||||
import com.minres.scviewer.database.IWaveformDb;
|
import com.minres.scviewer.database.IWaveformDb;
|
||||||
|
import com.minres.scviewer.database.IWaveformEvent;
|
||||||
import com.minres.scviewer.database.RelationType;
|
import com.minres.scviewer.database.RelationType;
|
||||||
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;
|
||||||
|
@ -189,4 +191,9 @@ public class TxStream extends HierNode implements ITxStream<ITxEvent> {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Boolean equals(IWaveform<? extends IWaveformEvent> other) {
|
||||||
|
return(other instanceof TxStream && this.getId()==other.getId());
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -42,7 +42,7 @@ public class SignalPainter implements IWaveformPainter {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void paintArea(GC gc, Rectangle area) {
|
public void paintArea(GC gc, Rectangle area) {
|
||||||
if(waveCanvas.currentWaveformSelection!=null && waveCanvas.currentWaveformSelection.getId()==signal.getId())
|
if(waveCanvas.currentWaveformSelection!=null && waveCanvas.currentWaveformSelection.equals(signal))
|
||||||
gc.setBackground(this.waveCanvas.colors[WaveformCanvas.Colors.TRACK_BG_HIGHLITE.ordinal()]);
|
gc.setBackground(this.waveCanvas.colors[WaveformCanvas.Colors.TRACK_BG_HIGHLITE.ordinal()]);
|
||||||
else
|
else
|
||||||
gc.setBackground(this.waveCanvas.colors[even?WaveformCanvas.Colors.TRACK_BG_EVEN.ordinal():WaveformCanvas.Colors.TRACK_BG_ODD.ordinal()]);
|
gc.setBackground(this.waveCanvas.colors[even?WaveformCanvas.Colors.TRACK_BG_EVEN.ordinal():WaveformCanvas.Colors.TRACK_BG_ODD.ordinal()]);
|
||||||
|
|
|
@ -51,12 +51,12 @@ public class StreamPainter implements IWaveformPainter{
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public void paintArea(GC gc, Rectangle area) {
|
public void paintArea(GC gc, Rectangle area) {
|
||||||
if(stream.getEvents().size()==0) return;
|
if(stream.getEvents().size()==0) return;
|
||||||
if(waveCanvas.currentWaveformSelection!=null && waveCanvas.currentWaveformSelection.getId()==stream.getId())
|
if(waveCanvas.currentWaveformSelection!=null && waveCanvas.currentWaveformSelection.equals(stream))
|
||||||
gc.setBackground(this.waveCanvas.colors[WaveformCanvas.Colors.TRACK_BG_HIGHLITE.ordinal()]);
|
gc.setBackground(this.waveCanvas.colors[WaveformCanvas.Colors.TRACK_BG_HIGHLITE.ordinal()]);
|
||||||
else
|
else
|
||||||
gc.setBackground(this.waveCanvas.colors[even?WaveformCanvas.Colors.TRACK_BG_EVEN.ordinal():WaveformCanvas.Colors.TRACK_BG_ODD.ordinal()]);
|
gc.setBackground(this.waveCanvas.colors[even?WaveformCanvas.Colors.TRACK_BG_EVEN.ordinal():WaveformCanvas.Colors.TRACK_BG_ODD.ordinal()]);
|
||||||
gc.setFillRule(SWT.FILL_EVEN_ODD);
|
gc.setFillRule(SWT.FILL_EVEN_ODD);
|
||||||
gc.fillRectangle(0,0,area.width, area.height);
|
gc.fillRectangle(area);
|
||||||
Entry<Long, ?> firstTx=stream.getEvents().floorEntry(area.x*waveCanvas.getScaleFactor());
|
Entry<Long, ?> firstTx=stream.getEvents().floorEntry(area.x*waveCanvas.getScaleFactor());
|
||||||
Entry<Long, ?> lastTx=stream.getEvents().ceilingEntry((area.x+area.width)*waveCanvas.getScaleFactor());
|
Entry<Long, ?> lastTx=stream.getEvents().ceilingEntry((area.x+area.width)*waveCanvas.getScaleFactor());
|
||||||
if(firstTx==null) firstTx = stream.getEvents().firstEntry();
|
if(firstTx==null) firstTx = stream.getEvents().firstEntry();
|
||||||
|
@ -82,7 +82,7 @@ public class StreamPainter implements IWaveformPainter{
|
||||||
seenTx.add(txEvent.getTransaction());
|
seenTx.add(txEvent.getTransaction());
|
||||||
if(txEvent.getType()==ITxEvent.Type.END){
|
if(txEvent.getType()==ITxEvent.Type.END){
|
||||||
ITx tx = txEvent.getTransaction();
|
ITx tx = txEvent.getTransaction();
|
||||||
highlighed|=waveCanvas.currentSelection!=null && waveCanvas.currentSelection.getId()==tx.getId();
|
highlighed|=waveCanvas.currentSelection!=null && waveCanvas.currentSelection.equals(tx);
|
||||||
drawTx(gc, area, tx);
|
drawTx(gc, area, tx);
|
||||||
seenTx.remove(tx);
|
seenTx.remove(tx);
|
||||||
}
|
}
|
||||||
|
|
|
@ -327,7 +327,8 @@ public class WaveformCanvas extends Canvas {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Object getClicked(Point point) {
|
public List<Object> getClicked(Point point) {
|
||||||
|
LinkedList<Object> result=new LinkedList<>();
|
||||||
for (IPainter p : Lists.reverse(painterList)) {
|
for (IPainter p : Lists.reverse(painterList)) {
|
||||||
if (p instanceof TrackPainter) {
|
if (p instanceof TrackPainter) {
|
||||||
int y = point.y - origin.y;
|
int y = point.y - origin.y;
|
||||||
|
@ -335,17 +336,28 @@ public class WaveformCanvas extends Canvas {
|
||||||
Entry<Integer, IWaveformPainter> entry = trackVerticalOffset.floorEntry(y);
|
Entry<Integer, IWaveformPainter> entry = trackVerticalOffset.floorEntry(y);
|
||||||
if (entry != null) {
|
if (entry != null) {
|
||||||
if (entry.getValue() instanceof StreamPainter) {
|
if (entry.getValue() instanceof StreamPainter) {
|
||||||
return ((StreamPainter) entry.getValue()).getClicked(new Point(x, y - entry.getKey()));
|
result.add(((StreamPainter) entry.getValue()).getClicked(new Point(x, y - entry.getKey())));
|
||||||
} else if (entry.getValue() instanceof SignalPainter)
|
} else if (entry.getValue() instanceof SignalPainter)
|
||||||
return ((SignalPainter) entry.getValue()).getSignal();
|
result.add(((SignalPainter) entry.getValue()).getSignal());
|
||||||
}
|
}
|
||||||
} else if (p instanceof CursorPainter) {
|
} else if (p instanceof CursorPainter) {
|
||||||
if (Math.abs(point.x - ((CursorPainter) p).getTime()/scaleFactor) < 2) {
|
if (Math.abs(point.x - origin.x - ((CursorPainter) p).getTime()/scaleFactor) < 2) {
|
||||||
return p;
|
result.add(p);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Object> getEntriesAtPosition(IWaveform<? extends IWaveformEvent> iWaveform, int i) {
|
||||||
|
LinkedList<Object> result=new LinkedList<>();
|
||||||
|
int x = i - origin.x;
|
||||||
|
for(IPainter p: trackVerticalOffset.values()){
|
||||||
|
if (p instanceof StreamPainter && ((StreamPainter)p).getStream()==iWaveform) {
|
||||||
|
result.add(((StreamPainter) p).getClicked(new Point(x, trackHeight/2)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSelected(ITx currentSelection, IWaveform<? extends IWaveformEvent> currentWaveformSelection) {
|
public void setSelected(ITx currentSelection, IWaveform<? extends IWaveformEvent> currentWaveformSelection) {
|
||||||
|
@ -379,6 +391,18 @@ public class WaveformCanvas extends Canvas {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void reveal(long time) {
|
||||||
|
int scaledTime = (int) (time / scaleFactor);
|
||||||
|
Point size = getSize();
|
||||||
|
size.x -= getVerticalBar().getSize().x + 2;
|
||||||
|
size.y -= getHorizontalBar().getSize().y;
|
||||||
|
if (scaledTime < -origin.x) {
|
||||||
|
setOrigin(-scaledTime+10, origin.y);
|
||||||
|
} else if (scaledTime > (size.x - origin.x)) {
|
||||||
|
setOrigin(size.x - scaledTime-30, origin.y);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public int getRulerHeight() {
|
public int getRulerHeight() {
|
||||||
return rulerHeight;
|
return rulerHeight;
|
||||||
|
|
|
@ -1,32 +1,32 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2014, 2015 MINRES Technologies GmbH and others.
|
* Copyright (c) 2011 Google, Inc.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* MINRES Technologies GmbH - initial API and implementation
|
* Google, Inc. - initial API and implementation
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.wb.swt;
|
package org.eclipse.wb.swt;
|
||||||
|
|
||||||
import java.io.FileInputStream;
|
import java.io.FileInputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import org.eclipse.swt.SWT;
|
import org.eclipse.swt.SWT;
|
||||||
import org.eclipse.swt.graphics.Color;
|
import org.eclipse.swt.graphics.Color;
|
||||||
import org.eclipse.swt.graphics.Cursor;
|
import org.eclipse.swt.graphics.Cursor;
|
||||||
import org.eclipse.swt.graphics.Font;
|
import org.eclipse.swt.graphics.Font;
|
||||||
import org.eclipse.swt.graphics.FontData;
|
import org.eclipse.swt.graphics.FontData;
|
||||||
import org.eclipse.swt.graphics.GC;
|
import org.eclipse.swt.graphics.GC;
|
||||||
import org.eclipse.swt.graphics.Image;
|
import org.eclipse.swt.graphics.Image;
|
||||||
import org.eclipse.swt.graphics.ImageData;
|
import org.eclipse.swt.graphics.ImageData;
|
||||||
import org.eclipse.swt.graphics.RGB;
|
import org.eclipse.swt.graphics.RGB;
|
||||||
import org.eclipse.swt.graphics.Rectangle;
|
import org.eclipse.swt.graphics.Rectangle;
|
||||||
import org.eclipse.swt.widgets.Display;
|
import org.eclipse.swt.widgets.Display;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Utility class for managing OS resources associated with SWT controls such as colors, fonts, images, etc.
|
* Utility class for managing OS resources associated with SWT controls such as colors, fonts, images, etc.
|
||||||
|
|
|
@ -21,7 +21,7 @@ import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
import com.minres.scviewer.database.IWaveformDb;
|
import com.minres.scviewer.database.IWaveformDb;
|
||||||
import com.minres.scviewer.database.WaveformDb;
|
import com.minres.scviewer.database.internal.WaveformDb;
|
||||||
|
|
||||||
public class DatabaseServicesTest {
|
public class DatabaseServicesTest {
|
||||||
|
|
||||||
|
|
|
@ -14,5 +14,4 @@ Require-Bundle: com.minres.scviewer.database;bundle-version="1.0.0",
|
||||||
org.eclipse.osgi.services;bundle-version="3.4.0",
|
org.eclipse.osgi.services;bundle-version="3.4.0",
|
||||||
com.google.guava;bundle-version="15.0.0"
|
com.google.guava;bundle-version="15.0.0"
|
||||||
Service-Component: OSGI-INF/component.xml
|
Service-Component: OSGI-INF/component.xml
|
||||||
Export-Package: com.minres.scviewer.database.text
|
|
||||||
Bundle-ActivationPolicy: lazy
|
Bundle-ActivationPolicy: lazy
|
||||||
|
|
|
@ -17,12 +17,13 @@ import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.NavigableMap;
|
import java.util.NavigableMap;
|
||||||
|
|
||||||
import com.google.common.collect.TreeMultimap;
|
import com.google.common.collect.TreeMultimap
|
||||||
import com.minres.scviewer.database.HierNode;
|
|
||||||
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.IWaveformEvent
|
||||||
import com.minres.scviewer.database.ITxGenerator
|
import com.minres.scviewer.database.ITxGenerator
|
||||||
|
import com.minres.scviewer.database.HierNode;
|
||||||
import com.minres.scviewer.database.IHierNode
|
import com.minres.scviewer.database.IHierNode
|
||||||
import com.minres.scviewer.database.ITxStream
|
import com.minres.scviewer.database.ITxStream
|
||||||
import com.minres.scviewer.database.ITx
|
import com.minres.scviewer.database.ITx
|
||||||
|
@ -107,4 +108,10 @@ class TxStream extends HierNode implements ITxStream {
|
||||||
public Collection getWaveformEventsAtTime(Long time) {
|
public Collection getWaveformEventsAtTime(Long time) {
|
||||||
return events.get(time);
|
return events.get(time);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Boolean equals(IWaveform<? extends IWaveformEvent> other) {
|
||||||
|
return(other instanceof TxStream && this.getId()==other.getId());
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -109,6 +109,11 @@ public class VCDSignal<T extends ISignalChange> extends HierNode implements ISig
|
||||||
return values.floorEntry(time).getValue();
|
return values.floorEntry(time).getValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Boolean equals(IWaveform<? extends IWaveformEvent> other) {
|
||||||
|
return(other instanceof VCDSignal<?> && this.getId()==other.getId());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,8 @@ Bundle-Vendor: MINRES Technologies GmbH
|
||||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
|
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
|
||||||
Export-Package: com.minres.scviewer.database
|
Export-Package: com.minres.scviewer.database
|
||||||
Bundle-ActivationPolicy: lazy
|
Bundle-ActivationPolicy: lazy
|
||||||
Service-Component: OSGI-INF/component.xml
|
Service-Component: OSGI-INF/component.xml,OSGI-INF/component2.xml
|
||||||
Require-Bundle: org.eclipse.equinox.ds;bundle-version="1.4.200",
|
Require-Bundle: org.eclipse.equinox.ds;bundle-version="1.4.200",
|
||||||
org.eclipse.equinox.util;bundle-version="1.0.500",
|
org.eclipse.equinox.util;bundle-version="1.0.500",
|
||||||
org.eclipse.osgi.services;bundle-version="3.4.0"
|
org.eclipse.osgi.services;bundle-version="3.4.0",
|
||||||
|
org.eclipse.wb.core.lib
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="com.minres.scviewer.database">
|
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="com.minres.scviewer.database.loader">
|
||||||
<implementation class="com.minres.scviewer.database.WaveformDb"/>
|
<implementation class="com.minres.scviewer.database.internal.WaveformDb"/>
|
||||||
<reference bind="bind" cardinality="1..n" interface="com.minres.scviewer.database.IWaveformDbLoader" name="IWaveformDbLoader" policy="dynamic" unbind="unbind"/>
|
<reference bind="bind" cardinality="1..n" interface="com.minres.scviewer.database.IWaveformDbLoader" name="IWaveformDbLoader" policy="dynamic" unbind="unbind"/>
|
||||||
</scr:component>
|
</scr:component>
|
||||||
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="com.minres.scviewer.database">
|
||||||
|
<implementation class="com.minres.scviewer.database.internal.WaveformDbFactory"/>
|
||||||
|
<service>
|
||||||
|
<provide interface="com.minres.scviewer.database.IWaveformDbFactory"/>
|
||||||
|
</service>
|
||||||
|
</scr:component>
|
|
@ -19,6 +19,8 @@ public class HierNode implements IHierNode {
|
||||||
|
|
||||||
protected String name;
|
protected String name;
|
||||||
|
|
||||||
|
protected String parentName;
|
||||||
|
|
||||||
protected ArrayList<IHierNode> childs;
|
protected ArrayList<IHierNode> childs;
|
||||||
|
|
||||||
protected PropertyChangeSupport pcs;
|
protected PropertyChangeSupport pcs;
|
||||||
|
@ -29,8 +31,13 @@ public class HierNode implements IHierNode {
|
||||||
}
|
}
|
||||||
|
|
||||||
public HierNode(String name) {
|
public HierNode(String name) {
|
||||||
|
this(name, "");
|
||||||
|
}
|
||||||
|
|
||||||
|
public HierNode(String name, String parentName) {
|
||||||
this();
|
this();
|
||||||
this.name=name;
|
this.name=name;
|
||||||
|
this.parentName=parentName;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -46,7 +53,10 @@ public class HierNode implements IHierNode {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getFullName() {
|
public String getFullName() {
|
||||||
return name;
|
if(parentName!=null && parentName.length()>0)
|
||||||
|
return parentName+"."+name;
|
||||||
|
else
|
||||||
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -59,6 +69,11 @@ public class HierNode implements IHierNode {
|
||||||
this.name=name;
|
this.name=name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setParentName(String name) {
|
||||||
|
this.parentName=name;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<IHierNode> getChildNodes() {
|
public List<IHierNode> getChildNodes() {
|
||||||
return childs;
|
return childs;
|
||||||
|
|
|
@ -39,6 +39,8 @@ public interface IHierNode extends Comparable<IHierNode>{
|
||||||
|
|
||||||
public void setName(String name);
|
public void setName(String name);
|
||||||
|
|
||||||
|
public void setParentName(String name);
|
||||||
|
|
||||||
public List<IHierNode> getChildNodes();
|
public List<IHierNode> getChildNodes();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,5 +18,7 @@ public interface IWaveform<T extends IWaveformEvent> extends IHierNode {
|
||||||
public String getKind();
|
public String getKind();
|
||||||
|
|
||||||
public IWaveformDb getDb();
|
public IWaveformDb getDb();
|
||||||
|
|
||||||
|
public Boolean equals(IWaveform<? extends IWaveformEvent> other);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
package com.minres.scviewer.database;
|
||||||
|
|
||||||
|
public interface IWaveformDbFactory {
|
||||||
|
|
||||||
|
IWaveformDb getDatabase();
|
||||||
|
}
|
|
@ -8,7 +8,7 @@
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* MINRES Technologies GmbH - initial API and implementation
|
* MINRES Technologies GmbH - initial API and implementation
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package com.minres.scviewer.database;
|
package com.minres.scviewer.database.internal;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
@ -18,6 +18,17 @@ import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import com.google.common.base.Joiner;
|
||||||
|
import com.minres.scviewer.database.HierNode;
|
||||||
|
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.database.IWaveformDbLoader;
|
||||||
|
import com.minres.scviewer.database.IWaveformEvent;
|
||||||
|
import com.minres.scviewer.database.InputFormatException;
|
||||||
|
|
||||||
public class WaveformDb extends HierNode implements IWaveformDb {
|
public class WaveformDb extends HierNode implements IWaveformDb {
|
||||||
|
|
||||||
private static List<IWaveformDbLoader> loaders=new LinkedList<IWaveformDbLoader>();
|
private static List<IWaveformDbLoader> loaders=new LinkedList<IWaveformDbLoader>();
|
||||||
|
@ -29,11 +40,11 @@ public class WaveformDb extends HierNode implements IWaveformDb {
|
||||||
private Long maxTime;
|
private Long maxTime;
|
||||||
|
|
||||||
|
|
||||||
public void bind(IWaveformDbLoader loader){
|
public synchronized void bind(IWaveformDbLoader loader){
|
||||||
loaders.add(loader);
|
loaders.add(loader);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void unbind(IWaveformDbLoader loader){
|
public synchronized void unbind(IWaveformDbLoader loader){
|
||||||
loaders.remove(loader);
|
loaders.remove(loader);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -73,8 +84,8 @@ public class WaveformDb extends HierNode implements IWaveformDb {
|
||||||
if(loader.getMaxTime()>maxTime){
|
if(loader.getMaxTime()>maxTime){
|
||||||
maxTime=loader.getMaxTime();
|
maxTime=loader.getMaxTime();
|
||||||
}
|
}
|
||||||
buildHierarchyNodes() ;
|
|
||||||
if(name==null) name=getFileBasename(inp.getName());
|
if(name==null) name=getFileBasename(inp.getName());
|
||||||
|
buildHierarchyNodes() ;
|
||||||
pcs.firePropertyChange("WAVEFORMS", null, waveforms);
|
pcs.firePropertyChange("WAVEFORMS", null, waveforms);
|
||||||
pcs.firePropertyChange("CHILDS", null, childNodes);
|
pcs.firePropertyChange("CHILDS", null, childNodes);
|
||||||
return true;
|
return true;
|
||||||
|
@ -102,16 +113,18 @@ public class WaveformDb extends HierNode implements IWaveformDb {
|
||||||
childNodes= new ArrayList<IHierNode>();
|
childNodes= new ArrayList<IHierNode>();
|
||||||
for(IWaveform<?> stream:getAllWaves()){
|
for(IWaveform<?> stream:getAllWaves()){
|
||||||
updateMaxTime(stream);
|
updateMaxTime(stream);
|
||||||
String[] hier = stream.getFullName().split("\\.");
|
String[] hier = stream.getName().split("\\.");
|
||||||
IHierNode node = this;
|
IHierNode node = this;
|
||||||
|
List<String> path=new LinkedList<String>();
|
||||||
|
path.add(name);
|
||||||
for(String name:hier){
|
for(String name:hier){
|
||||||
IHierNode n1 = null;
|
IHierNode n1 = null;
|
||||||
for (IHierNode n : node.getChildNodes()) {
|
for (IHierNode n : node.getChildNodes()) {
|
||||||
if (n.getName().equals(name)) {
|
if (n.getName().equals(name)) {
|
||||||
n1=n;
|
n1=n;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(name == hier[hier.length-1]){ //leaf
|
if(name == hier[hier.length-1]){ //leaf
|
||||||
if(n1!=null) {
|
if(n1!=null) {
|
||||||
if(n1 instanceof HierNode){
|
if(n1 instanceof HierNode){
|
||||||
|
@ -123,6 +136,7 @@ public class WaveformDb extends HierNode implements IWaveformDb {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
stream.setName(name);
|
stream.setName(name);
|
||||||
|
stream.setParentName(Joiner.on(".").join(path));
|
||||||
node.getChildNodes().add(stream);
|
node.getChildNodes().add(stream);
|
||||||
Collections.sort(node.getChildNodes());
|
Collections.sort(node.getChildNodes());
|
||||||
node=stream;
|
node=stream;
|
||||||
|
@ -130,12 +144,13 @@ public class WaveformDb extends HierNode implements IWaveformDb {
|
||||||
if(n1 != null) {
|
if(n1 != null) {
|
||||||
node=n1;
|
node=n1;
|
||||||
} else {
|
} else {
|
||||||
HierNode newNode = new HierNode(name);
|
HierNode newNode = new HierNode(name, Joiner.on(".").join(path));
|
||||||
node.getChildNodes().add(newNode);
|
node.getChildNodes().add(newNode);
|
||||||
Collections.sort(node.getChildNodes());
|
Collections.sort(node.getChildNodes());
|
||||||
node=newNode;
|
node=newNode;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
path.add(name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -0,0 +1,23 @@
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package com.minres.scviewer.database.internal;
|
||||||
|
|
||||||
|
import com.minres.scviewer.database.IWaveformDb;
|
||||||
|
import com.minres.scviewer.database.IWaveformDbFactory;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author eyck
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class WaveformDbFactory implements IWaveformDbFactory {
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see com.minres.scviewer.database.IWaveformDbFactory#getDatabase()
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public IWaveformDb getDatabase() {
|
||||||
|
return new WaveformDb();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,20 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<project>
|
||||||
|
<configuration id="cdt.managedbuild.config.gnu.macosx.exe.debug.133691581" name="Debug">
|
||||||
|
<extension point="org.eclipse.cdt.core.LanguageSettingsProvider">
|
||||||
|
<provider-reference id="org.eclipse.cdt.ui.UserLanguageSettingsProvider" ref="shared-provider"/>
|
||||||
|
<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
|
||||||
|
<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
|
||||||
|
<provider-reference id="org.eclipse.cdt.managedbuilder.core.GCCBuiltinSpecsDetector" ref="shared-provider"/>
|
||||||
|
<provider class="org.eclipse.cdt.managedbuilder.language.settings.providers.GCCBuildCommandParser" id="org.eclipse.cdt.managedbuilder.core.GCCBuildCommandParser" keep-relative-paths="false" name="CDT GCC Build Output Parser" parameter="(gcc)|([gc]\+\+)|(clang)" prefer-non-shared="true"/>
|
||||||
|
</extension>
|
||||||
|
</configuration>
|
||||||
|
<configuration id="cdt.managedbuild.config.macosx.exe.release.222902119" name="Release">
|
||||||
|
<extension point="org.eclipse.cdt.core.LanguageSettingsProvider">
|
||||||
|
<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
|
||||||
|
<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
|
||||||
|
<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
|
||||||
|
<provider-reference id="org.eclipse.cdt.managedbuilder.core.GCCBuiltinSpecsDetector" ref="shared-provider"/>
|
||||||
|
</extension>
|
||||||
|
</configuration>
|
||||||
|
</project>
|
|
@ -0,0 +1 @@
|
||||||
|
/target/
|
|
@ -0,0 +1,17 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<projectDescription>
|
||||||
|
<name>sqlite-jdbc.osgi</name>
|
||||||
|
<comment></comment>
|
||||||
|
<projects>
|
||||||
|
</projects>
|
||||||
|
<buildSpec>
|
||||||
|
<buildCommand>
|
||||||
|
<name>org.eclipse.m2e.core.maven2Builder</name>
|
||||||
|
<arguments>
|
||||||
|
</arguments>
|
||||||
|
</buildCommand>
|
||||||
|
</buildSpec>
|
||||||
|
<natures>
|
||||||
|
<nature>org.eclipse.m2e.core.maven2Nature</nature>
|
||||||
|
</natures>
|
||||||
|
</projectDescription>
|
|
@ -0,0 +1,48 @@
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
<groupId>sqlite</groupId>
|
||||||
|
<artifactId>sqlite-jdbc.osgi</artifactId>
|
||||||
|
<version>3.8.7</version>
|
||||||
|
<packaging>bundle</packaging>
|
||||||
|
|
||||||
|
<name>sqlite-jdbc.osgi-wrapped</name>
|
||||||
|
<url>http://maven.apache.org</url>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
</properties>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>junit</groupId>
|
||||||
|
<artifactId>junit</artifactId>
|
||||||
|
<version>3.8.1</version>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.xerial</groupId>
|
||||||
|
<artifactId>sqlite-jdbc</artifactId>
|
||||||
|
<version>3.8.7</version>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.felix</groupId>
|
||||||
|
<artifactId>maven-bundle-plugin</artifactId>
|
||||||
|
<version>2.3.7</version>
|
||||||
|
<extensions>true</extensions>
|
||||||
|
<configuration>
|
||||||
|
<instructions>
|
||||||
|
<Import-Package>*;resolution:=optional</Import-Package>
|
||||||
|
<_exportcontents>*</_exportcontents>
|
||||||
|
<Embed-Dependency>sqlite-jdbc</Embed-Dependency>
|
||||||
|
</instructions>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
</project>
|
Loading…
Reference in New Issue