Painter base waveform canvas implemented
Fixed Copyright information
This commit is contained in:
parent
5f5bfbd792
commit
6853484417
|
@ -8,8 +8,7 @@ Bundle-RequiredExecutionEnvironment: JavaSE-1.7
|
||||||
Require-Bundle: com.minres.scviewer.database;bundle-version="1.0.0",
|
Require-Bundle: com.minres.scviewer.database;bundle-version="1.0.0",
|
||||||
org.eclipse.equinox.util;bundle-version="1.0.500",
|
org.eclipse.equinox.util;bundle-version="1.0.500",
|
||||||
org.eclipse.equinox.ds;bundle-version="1.4.200",
|
org.eclipse.equinox.ds;bundle-version="1.4.200",
|
||||||
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"
|
|
||||||
Bundle-ClassPath: .,
|
Bundle-ClassPath: .,
|
||||||
sqlite-jdbc-3.8.7.jar
|
sqlite-jdbc-3.8.7.jar
|
||||||
Service-Component: OSGI-INF/component.xml
|
Service-Component: OSGI-INF/component.xml
|
||||||
|
|
|
@ -1,3 +1,13 @@
|
||||||
|
###############################################################################
|
||||||
|
# Copyright (c) 2014, 2015 MINRES Technologies GmbH and others.
|
||||||
|
# All rights reserved. This program and the accompanying materials
|
||||||
|
# are made available under the terms of the Eclipse Public License v1.0
|
||||||
|
# which accompanies this distribution, and is available at
|
||||||
|
# http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
#
|
||||||
|
# Contributors:
|
||||||
|
# MINRES Technologies GmbH - initial API and implementation
|
||||||
|
###############################################################################
|
||||||
source.. = src/
|
source.. = src/
|
||||||
output.. = bin/
|
output.. = bin/
|
||||||
bin.includes = META-INF/,\
|
bin.includes = META-INF/,\
|
||||||
|
|
|
@ -1,3 +1,13 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2014, 2015 MINRES Technologies GmbH and others.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* MINRES Technologies GmbH - initial API and implementation
|
||||||
|
*******************************************************************************/
|
||||||
package com.minres.scviewer.database.sqlite;
|
package com.minres.scviewer.database.sqlite;
|
||||||
|
|
||||||
import java.beans.IntrospectionException;
|
import java.beans.IntrospectionException;
|
||||||
|
@ -6,14 +16,12 @@ import java.io.FileInputStream;
|
||||||
import java.lang.reflect.InvocationTargetException;
|
import java.lang.reflect.InvocationTargetException;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
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.IWaveformDbLoader;
|
import com.minres.scviewer.database.IWaveformDbLoader;
|
||||||
import com.minres.scviewer.database.IWaveformEvent;
|
import com.minres.scviewer.database.IWaveformEvent;
|
||||||
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.SQLiteDatabase;
|
import com.minres.scviewer.database.sqlite.db.SQLiteDatabase;
|
||||||
import com.minres.scviewer.database.sqlite.db.SQLiteDatabaseSelectHandler;
|
import com.minres.scviewer.database.sqlite.db.SQLiteDatabaseSelectHandler;
|
||||||
|
@ -29,10 +37,12 @@ public class SQLiteDbLoader implements IWaveformDbLoader {
|
||||||
|
|
||||||
long timeResolution=1;
|
long timeResolution=1;
|
||||||
|
|
||||||
private HashMap<String, RelationType> relationMap = new HashMap<String, RelationType>();
|
private RelationTypeFactory rtf = new RelationTypeFactory();
|
||||||
|
|
||||||
private IWaveformDb db;
|
private IWaveformDb db;
|
||||||
|
|
||||||
|
private ScvSimProps scvSimProps;
|
||||||
|
|
||||||
public SQLiteDbLoader() {
|
public SQLiteDbLoader() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -43,7 +53,7 @@ public class SQLiteDbLoader implements IWaveformDbLoader {
|
||||||
try {
|
try {
|
||||||
List<ScvTxEvent> event = handler.selectObjects();
|
List<ScvTxEvent> event = handler.selectObjects();
|
||||||
if(event.size()>0)
|
if(event.size()>0)
|
||||||
return event.get(0).getTime();
|
return event.get(0).getTime()*scvSimProps.getTime_resolution();
|
||||||
} catch (SecurityException | IllegalArgumentException | InstantiationException | IllegalAccessException
|
} catch (SecurityException | IllegalArgumentException | InstantiationException | IllegalAccessException
|
||||||
| InvocationTargetException | SQLException | IntrospectionException e) {
|
| InvocationTargetException | SQLException | IntrospectionException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
@ -58,7 +68,9 @@ public class SQLiteDbLoader implements IWaveformDbLoader {
|
||||||
streams=new ArrayList<IWaveform<? extends IWaveformEvent>>();
|
streams=new ArrayList<IWaveform<? extends IWaveformEvent>>();
|
||||||
try {
|
try {
|
||||||
for(ScvStream scvStream:handler.selectObjects()){
|
for(ScvStream scvStream:handler.selectObjects()){
|
||||||
streams.add(new TxStream(database, db, scvStream));
|
TxStream stream = new TxStream(database, db, scvStream);
|
||||||
|
stream.setRelationTypeFactory(rtf);
|
||||||
|
streams.add(stream);
|
||||||
}
|
}
|
||||||
} catch (SecurityException | IllegalArgumentException | InstantiationException | IllegalAccessException
|
} catch (SecurityException | IllegalArgumentException | InstantiationException | IllegalAccessException
|
||||||
| InvocationTargetException | SQLException | IntrospectionException e) {
|
| InvocationTargetException | SQLException | IntrospectionException e) {
|
||||||
|
@ -85,7 +97,8 @@ public class SQLiteDbLoader implements IWaveformDbLoader {
|
||||||
database.setData("TIMERESOLUTION", 1L);
|
database.setData("TIMERESOLUTION", 1L);
|
||||||
SQLiteDatabaseSelectHandler<ScvSimProps> handler = new SQLiteDatabaseSelectHandler<ScvSimProps>(ScvSimProps.class, database);
|
SQLiteDatabaseSelectHandler<ScvSimProps> handler = new SQLiteDatabaseSelectHandler<ScvSimProps>(ScvSimProps.class, database);
|
||||||
try {
|
try {
|
||||||
for(ScvSimProps scvSimProps:handler.selectObjects()){
|
for(ScvSimProps simProps:handler.selectObjects()){
|
||||||
|
scvSimProps=simProps;
|
||||||
database.setData("TIMERESOLUTION", scvSimProps.getTime_resolution());
|
database.setData("TIMERESOLUTION", scvSimProps.getTime_resolution());
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -95,13 +108,4 @@ public class SQLiteDbLoader implements IWaveformDbLoader {
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public RelationType getRelationType(String relationName) {
|
|
||||||
if(relationMap.containsKey(relationName)) return relationMap.get(relationName);
|
|
||||||
RelationType type = new RelationType(relationName);
|
|
||||||
relationMap.put(relationName, type);
|
|
||||||
return type;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,13 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2014, 2015 MINRES Technologies GmbH and others.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* MINRES Technologies GmbH - initial API and implementation
|
||||||
|
*******************************************************************************/
|
||||||
package com.minres.scviewer.database.sqlite;
|
package com.minres.scviewer.database.sqlite;
|
||||||
|
|
||||||
import java.beans.IntrospectionException;
|
import java.beans.IntrospectionException;
|
||||||
|
@ -16,6 +26,7 @@ import com.minres.scviewer.database.ITxRelation;
|
||||||
import com.minres.scviewer.database.ITxStream;
|
import com.minres.scviewer.database.ITxStream;
|
||||||
import com.minres.scviewer.database.sqlite.db.IDatabase;
|
import com.minres.scviewer.database.sqlite.db.IDatabase;
|
||||||
import com.minres.scviewer.database.sqlite.db.SQLiteDatabaseSelectHandler;
|
import com.minres.scviewer.database.sqlite.db.SQLiteDatabaseSelectHandler;
|
||||||
|
import com.minres.scviewer.database.sqlite.tables.ScvStream;
|
||||||
import com.minres.scviewer.database.sqlite.tables.ScvTx;
|
import com.minres.scviewer.database.sqlite.tables.ScvTx;
|
||||||
import com.minres.scviewer.database.sqlite.tables.ScvTxAttribute;
|
import com.minres.scviewer.database.sqlite.tables.ScvTxAttribute;
|
||||||
import com.minres.scviewer.database.sqlite.tables.ScvTxEvent;
|
import com.minres.scviewer.database.sqlite.tables.ScvTxEvent;
|
||||||
|
@ -29,7 +40,7 @@ public class Tx implements ITx {
|
||||||
private ScvTx scvTx;
|
private ScvTx scvTx;
|
||||||
private List<ITxAttribute> attributes;
|
private List<ITxAttribute> attributes;
|
||||||
private Long begin, end;
|
private Long begin, end;
|
||||||
private List<ITxRelation> incoming, outgoing;
|
private List<ITxRelation> incoming, outgoing;
|
||||||
|
|
||||||
public Tx(IDatabase database, TxStream trStream, TxGenerator trGenerator, ScvTx scvTx) {
|
public Tx(IDatabase database, TxStream trStream, TxGenerator trGenerator, ScvTx scvTx) {
|
||||||
this.database=database;
|
this.database=database;
|
||||||
|
@ -143,20 +154,26 @@ public class Tx implements ITx {
|
||||||
}
|
}
|
||||||
|
|
||||||
private ITxRelation createRelation(ScvTxRelation rel, boolean outgoing) {
|
private ITxRelation createRelation(ScvTxRelation rel, boolean outgoing) {
|
||||||
long otherId = outgoing?rel.getSink():rel.getSrc();
|
int otherId = outgoing?rel.getSink():rel.getSrc();
|
||||||
/*FIXME:
|
SQLiteDatabaseSelectHandler<ScvTx> handler = new SQLiteDatabaseSelectHandler<ScvTx>(ScvTx.class, database,
|
||||||
|
"id="+otherId);
|
||||||
try {
|
try {
|
||||||
List<ScvTx> scvTx=new SQLiteDatabaseSelectHandler<ScvTx>(ScvTx.class, database, "id="+otherId).selectObjects();
|
List<ScvTx> res = handler.selectObjects();
|
||||||
assert(scvTx.size()==1);
|
if(res.size()!=1) return null;
|
||||||
ITxStream stream = trStream.getDb().getStreamById(scvTx.get(0).getStream());
|
List<ScvStream> streams = new SQLiteDatabaseSelectHandler<ScvStream>(ScvStream.class, database,
|
||||||
Tx that=(Tx) stream.getTransactionById(otherId);
|
"id="+res.get(0).getStream()).selectObjects();
|
||||||
|
if(streams.size()!=1) return null;
|
||||||
|
TxStream tgtStream = (TxStream) trStream.getDb().getStreamByName(streams.get(0).getName());
|
||||||
|
Tx that = (Tx) tgtStream.getTransactions().get(otherId);
|
||||||
if(outgoing)
|
if(outgoing)
|
||||||
return new TxRelation(trStream.getDb().getRelationType(rel.getName()), this, that);
|
return new TxRelation(trStream.getRelationType(rel.getName()), this, that);
|
||||||
else
|
else
|
||||||
return new TxRelation(trStream.getDb().getRelationType(rel.getName()), that, this);
|
return new TxRelation(trStream.getRelationType(rel.getName()), that, this);
|
||||||
} catch (SecurityException | IllegalArgumentException | InstantiationException | IllegalAccessException
|
} catch (SecurityException | IllegalArgumentException | InstantiationException | IllegalAccessException
|
||||||
| InvocationTargetException | SQLException | IntrospectionException e) {
|
| InvocationTargetException | SQLException | IntrospectionException e) {
|
||||||
}*/
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -165,4 +182,8 @@ public class Tx implements ITx {
|
||||||
return this.getBeginTime().compareTo(o.getBeginTime());
|
return this.getBeginTime().compareTo(o.getBeginTime());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "tx#"+getId()+"@"+getBeginTime()+"-@"+getEndTime();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,13 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2014, 2015 MINRES Technologies GmbH and others.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* MINRES Technologies GmbH - initial API and implementation
|
||||||
|
*******************************************************************************/
|
||||||
package com.minres.scviewer.database.sqlite;
|
package com.minres.scviewer.database.sqlite;
|
||||||
|
|
||||||
import com.minres.scviewer.database.AssociationType;
|
import com.minres.scviewer.database.AssociationType;
|
||||||
|
|
|
@ -1,3 +1,13 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2014, 2015 MINRES Technologies GmbH and others.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* MINRES Technologies GmbH - initial API and implementation
|
||||||
|
*******************************************************************************/
|
||||||
package com.minres.scviewer.database.sqlite;
|
package com.minres.scviewer.database.sqlite;
|
||||||
|
|
||||||
import com.minres.scviewer.database.ITx;
|
import com.minres.scviewer.database.ITx;
|
||||||
|
@ -40,4 +50,8 @@ public class TxEvent implements ITxEvent {
|
||||||
return type;
|
return type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return type.toString()+"@"+getTime()+" of tx #"+tx.getId();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,13 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2014, 2015 MINRES Technologies GmbH and others.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* MINRES Technologies GmbH - initial API and implementation
|
||||||
|
*******************************************************************************/
|
||||||
package com.minres.scviewer.database.sqlite;
|
package com.minres.scviewer.database.sqlite;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -11,7 +21,9 @@ import com.minres.scviewer.database.sqlite.tables.ScvGenerator;
|
||||||
public class TxGenerator implements ITxGenerator {
|
public class TxGenerator implements ITxGenerator {
|
||||||
|
|
||||||
private ITxStream<ITxEvent> stream;
|
private ITxStream<ITxEvent> stream;
|
||||||
|
|
||||||
private ScvGenerator scvGenerator;
|
private ScvGenerator scvGenerator;
|
||||||
|
|
||||||
public TxGenerator(ITxStream<ITxEvent> stream, ScvGenerator scvGenerator) {
|
public TxGenerator(ITxStream<ITxEvent> stream, ScvGenerator scvGenerator) {
|
||||||
this.stream=stream;
|
this.stream=stream;
|
||||||
this.scvGenerator=scvGenerator;
|
this.scvGenerator=scvGenerator;
|
||||||
|
|
|
@ -1,3 +1,13 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2014, 2015 MINRES Technologies GmbH and others.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* MINRES Technologies GmbH - initial API and implementation
|
||||||
|
*******************************************************************************/
|
||||||
package com.minres.scviewer.database.sqlite;
|
package com.minres.scviewer.database.sqlite;
|
||||||
|
|
||||||
import com.minres.scviewer.database.ITxRelation;
|
import com.minres.scviewer.database.ITxRelation;
|
||||||
|
|
|
@ -1,3 +1,13 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2014, 2015 MINRES Technologies GmbH and others.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* MINRES Technologies GmbH - initial API and implementation
|
||||||
|
*******************************************************************************/
|
||||||
package com.minres.scviewer.database.sqlite;
|
package com.minres.scviewer.database.sqlite;
|
||||||
|
|
||||||
import java.beans.IntrospectionException;
|
import java.beans.IntrospectionException;
|
||||||
|
@ -5,18 +15,20 @@ import java.lang.reflect.InvocationTargetException;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
import java.util.NavigableMap;
|
import java.util.NavigableMap;
|
||||||
|
import java.util.TreeMap;
|
||||||
|
import java.util.Vector;
|
||||||
|
|
||||||
import com.google.common.collect.TreeMultimap;
|
|
||||||
import com.minres.scviewer.database.HierNode;
|
import com.minres.scviewer.database.HierNode;
|
||||||
import com.minres.scviewer.database.ITx;
|
import com.minres.scviewer.database.ITx;
|
||||||
import com.minres.scviewer.database.ITxEvent;
|
import com.minres.scviewer.database.ITxEvent;
|
||||||
import com.minres.scviewer.database.ITxGenerator;
|
import com.minres.scviewer.database.ITxGenerator;
|
||||||
import com.minres.scviewer.database.ITxStream;
|
import com.minres.scviewer.database.ITxStream;
|
||||||
import com.minres.scviewer.database.IWaveformDb;
|
import com.minres.scviewer.database.IWaveformDb;
|
||||||
|
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;
|
||||||
import com.minres.scviewer.database.sqlite.tables.ScvGenerator;
|
import com.minres.scviewer.database.sqlite.tables.ScvGenerator;
|
||||||
|
@ -33,13 +45,15 @@ public class TxStream extends HierNode implements ITxStream<ITxEvent> {
|
||||||
|
|
||||||
private ScvStream scvStream;
|
private ScvStream scvStream;
|
||||||
|
|
||||||
private HashMap<Integer, TxGenerator> generators;
|
private TreeMap<Integer, TxGenerator> generators;
|
||||||
|
|
||||||
private HashMap<Integer, ITx> transactions;
|
private TreeMap<Integer, ITx> transactions;
|
||||||
|
|
||||||
private Integer maxConcurrency;
|
private Integer maxConcurrency;
|
||||||
|
|
||||||
private TreeMultimap<Long, ITxEvent> events;
|
private TreeMap<Long, List<ITxEvent>> events;
|
||||||
|
|
||||||
|
private RelationTypeFactory relationMap;
|
||||||
|
|
||||||
public TxStream(IDatabase database, IWaveformDb waveformDb, ScvStream scvStream) {
|
public TxStream(IDatabase database, IWaveformDb waveformDb, ScvStream scvStream) {
|
||||||
super(scvStream.getName());
|
super(scvStream.getName());
|
||||||
|
@ -74,7 +88,7 @@ public class TxStream extends HierNode implements ITxStream<ITxEvent> {
|
||||||
if(generators==null){
|
if(generators==null){
|
||||||
SQLiteDatabaseSelectHandler<ScvGenerator> handler = new SQLiteDatabaseSelectHandler<ScvGenerator>(
|
SQLiteDatabaseSelectHandler<ScvGenerator> handler = new SQLiteDatabaseSelectHandler<ScvGenerator>(
|
||||||
ScvGenerator.class, database, "stream="+scvStream.getId());
|
ScvGenerator.class, database, "stream="+scvStream.getId());
|
||||||
generators=new HashMap<Integer, TxGenerator>();
|
generators=new TreeMap<Integer, TxGenerator>();
|
||||||
try {
|
try {
|
||||||
for(ScvGenerator scvGenerator:handler.selectObjects()){
|
for(ScvGenerator scvGenerator:handler.selectObjects()){
|
||||||
generators.put(scvGenerator.getId(), new TxGenerator(this, scvGenerator));
|
generators.put(scvGenerator.getId(), new TxGenerator(this, scvGenerator));
|
||||||
|
@ -120,22 +134,32 @@ public class TxStream extends HierNode implements ITxStream<ITxEvent> {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public NavigableMap<Long, Collection<ITxEvent>> getEvents(){
|
public NavigableMap<Long, List<ITxEvent>> getEvents(){
|
||||||
if(events==null){
|
if(events==null){
|
||||||
events=TreeMultimap.create();
|
events=new TreeMap<Long, List<ITxEvent>>();
|
||||||
for(Entry<Integer, ITx> entry:getTransactions().entrySet()){
|
for(Entry<Integer, ITx> entry:getTransactions().entrySet()){
|
||||||
events.put(entry.getValue().getBeginTime(), new TxEvent(TxEvent.Type.BEGIN, entry.getValue()));
|
putEvent(new TxEvent(TxEvent.Type.BEGIN, entry.getValue()));
|
||||||
events.put(entry.getValue().getBeginTime(), new TxEvent(TxEvent.Type.END, entry.getValue()));
|
putEvent(new TxEvent(TxEvent.Type.END, entry.getValue()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return events.asMap();
|
return events;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void putEvent(TxEvent ev){
|
||||||
|
Long time = ev.getTime();
|
||||||
|
if(!events.containsKey(time)){
|
||||||
|
Vector<ITxEvent> vector=new Vector<ITxEvent>();
|
||||||
|
vector.add(ev);
|
||||||
|
events.put(time, vector);
|
||||||
|
} else {
|
||||||
|
events.get(time).add(ev);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
protected HashMap<Integer, ITx> getTransactions() {
|
protected Map<Integer, ITx> getTransactions() {
|
||||||
if(transactions==null){
|
if(transactions==null){
|
||||||
if(generators==null) getGenerators();
|
if(generators==null) getGenerators();
|
||||||
transactions = new HashMap<Integer, ITx>();
|
transactions = new TreeMap<Integer, ITx>();
|
||||||
SQLiteDatabaseSelectHandler<ScvTx> handler = new SQLiteDatabaseSelectHandler<ScvTx>(ScvTx.class, database,
|
SQLiteDatabaseSelectHandler<ScvTx> handler = new SQLiteDatabaseSelectHandler<ScvTx>(ScvTx.class, database,
|
||||||
"stream="+scvStream.getId());
|
"stream="+scvStream.getId());
|
||||||
try {
|
try {
|
||||||
|
@ -155,4 +179,14 @@ public class TxStream extends HierNode implements ITxStream<ITxEvent> {
|
||||||
return getEvents().get(time);
|
return getEvents().get(time);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setRelationTypeFactory(RelationTypeFactory rtf) {
|
||||||
|
this.relationMap=rtf;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public RelationType getRelationType(String name) {
|
||||||
|
if(relationMap!=null) return relationMap.getRelationType(name);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,13 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2014, 2015 MINRES Technologies GmbH and others.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* MINRES Technologies GmbH - initial API and implementation
|
||||||
|
*******************************************************************************/
|
||||||
package com.minres.scviewer.database.sqlite.db;
|
package com.minres.scviewer.database.sqlite.db;
|
||||||
|
|
||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
|
|
|
@ -1,3 +1,13 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2014, 2015 MINRES Technologies GmbH and others.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* MINRES Technologies GmbH - initial API and implementation
|
||||||
|
*******************************************************************************/
|
||||||
package com.minres.scviewer.database.sqlite.db;
|
package com.minres.scviewer.database.sqlite.db;
|
||||||
|
|
||||||
import java.sql.Connection;
|
import java.sql.Connection;
|
||||||
|
|
|
@ -1,3 +1,13 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2014, 2015 MINRES Technologies GmbH and others.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* MINRES Technologies GmbH - initial API and implementation
|
||||||
|
*******************************************************************************/
|
||||||
package com.minres.scviewer.database.sqlite.db;
|
package com.minres.scviewer.database.sqlite.db;
|
||||||
|
|
||||||
import java.sql.Connection;
|
import java.sql.Connection;
|
||||||
|
|
|
@ -1,3 +1,13 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2014, 2015 MINRES Technologies GmbH and others.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* MINRES Technologies GmbH - initial API and implementation
|
||||||
|
*******************************************************************************/
|
||||||
package com.minres.scviewer.database.sqlite.db;
|
package com.minres.scviewer.database.sqlite.db;
|
||||||
import java.beans.IntrospectionException;
|
import java.beans.IntrospectionException;
|
||||||
import java.beans.PropertyDescriptor;
|
import java.beans.PropertyDescriptor;
|
||||||
|
|
|
@ -1,3 +1,13 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2014, 2015 MINRES Technologies GmbH and others.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* MINRES Technologies GmbH - initial API and implementation
|
||||||
|
*******************************************************************************/
|
||||||
package com.minres.scviewer.database.sqlite.db;
|
package com.minres.scviewer.database.sqlite.db;
|
||||||
|
|
||||||
import java.beans.IntrospectionException;
|
import java.beans.IntrospectionException;
|
||||||
|
|
|
@ -1,3 +1,13 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2014, 2015 MINRES Technologies GmbH and others.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* MINRES Technologies GmbH - initial API and implementation
|
||||||
|
*******************************************************************************/
|
||||||
package com.minres.scviewer.database.sqlite.tables;
|
package com.minres.scviewer.database.sqlite.tables;
|
||||||
|
|
||||||
public class ScvGenerator {
|
public class ScvGenerator {
|
||||||
|
|
|
@ -1,3 +1,13 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2014, 2015 MINRES Technologies GmbH and others.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* MINRES Technologies GmbH - initial API and implementation
|
||||||
|
*******************************************************************************/
|
||||||
package com.minres.scviewer.database.sqlite.tables;
|
package com.minres.scviewer.database.sqlite.tables;
|
||||||
|
|
||||||
public class ScvSimProps {
|
public class ScvSimProps {
|
||||||
|
|
|
@ -1,3 +1,13 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2014, 2015 MINRES Technologies GmbH and others.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* MINRES Technologies GmbH - initial API and implementation
|
||||||
|
*******************************************************************************/
|
||||||
package com.minres.scviewer.database.sqlite.tables;
|
package com.minres.scviewer.database.sqlite.tables;
|
||||||
|
|
||||||
public class ScvStream {
|
public class ScvStream {
|
||||||
|
|
|
@ -1,3 +1,13 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2014, 2015 MINRES Technologies GmbH and others.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* MINRES Technologies GmbH - initial API and implementation
|
||||||
|
*******************************************************************************/
|
||||||
package com.minres.scviewer.database.sqlite.tables;
|
package com.minres.scviewer.database.sqlite.tables;
|
||||||
|
|
||||||
public class ScvTx {
|
public class ScvTx {
|
||||||
|
|
|
@ -1,3 +1,13 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2014, 2015 MINRES Technologies GmbH and others.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* MINRES Technologies GmbH - initial API and implementation
|
||||||
|
*******************************************************************************/
|
||||||
package com.minres.scviewer.database.sqlite.tables;
|
package com.minres.scviewer.database.sqlite.tables;
|
||||||
|
|
||||||
public class ScvTxAttribute {
|
public class ScvTxAttribute {
|
||||||
|
|
|
@ -1,3 +1,13 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2014, 2015 MINRES Technologies GmbH and others.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* MINRES Technologies GmbH - initial API and implementation
|
||||||
|
*******************************************************************************/
|
||||||
package com.minres.scviewer.database.sqlite.tables;
|
package com.minres.scviewer.database.sqlite.tables;
|
||||||
|
|
||||||
public class ScvTxEvent {
|
public class ScvTxEvent {
|
||||||
|
|
|
@ -1,3 +1,13 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2014, 2015 MINRES Technologies GmbH and others.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* MINRES Technologies GmbH - initial API and implementation
|
||||||
|
*******************************************************************************/
|
||||||
package com.minres.scviewer.database.sqlite.tables;
|
package com.minres.scviewer.database.sqlite.tables;
|
||||||
|
|
||||||
public class ScvTxRelation {
|
public class ScvTxRelation {
|
||||||
|
|
|
@ -1,5 +1,15 @@
|
||||||
|
###############################################################################
|
||||||
|
# Copyright (c) 2014, 2015 MINRES Technologies GmbH and others.
|
||||||
|
# All rights reserved. This program and the accompanying materials
|
||||||
|
# are made available under the terms of the Eclipse Public License v1.0
|
||||||
|
# which accompanies this distribution, and is available at
|
||||||
|
# http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
#
|
||||||
|
# Contributors:
|
||||||
|
# MINRES Technologies GmbH - initial API and implementation
|
||||||
|
###############################################################################
|
||||||
output.. = bin/
|
output.. = bin/
|
||||||
bin.includes = META-INF/,\
|
bin.includes = META-INF/,\
|
||||||
.,\
|
.,\
|
||||||
OSGI-INF/component.xml
|
OSGI-INF/
|
||||||
source.. = src/
|
source.. = src/
|
||||||
|
|
|
@ -1,3 +1,13 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2014, 2015 MINRES Technologies GmbH and others.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* MINRES Technologies GmbH - initial API and implementation
|
||||||
|
*******************************************************************************/
|
||||||
package com.minres.scviewer.database.test;
|
package com.minres.scviewer.database.test;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
|
@ -6,18 +16,12 @@ import static org.junit.Assert.assertTrue;
|
||||||
import static org.junit.Assert.fail;
|
import static org.junit.Assert.fail;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.net.URISyntaxException;
|
|
||||||
import java.util.LinkedList;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.concurrent.CountDownLatch;
|
|
||||||
import java.util.concurrent.TimeUnit;
|
|
||||||
|
|
||||||
import org.junit.After;
|
import org.junit.After;
|
||||||
import org.junit.Before;
|
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.IWaveformDbLoader;
|
|
||||||
import com.minres.scviewer.database.WaveformDb;
|
import com.minres.scviewer.database.WaveformDb;
|
||||||
|
|
||||||
public class DatabaseServicesTest {
|
public class DatabaseServicesTest {
|
||||||
|
|
|
@ -1,6 +1,15 @@
|
||||||
|
###############################################################################
|
||||||
|
# Copyright (c) 2014, 2015 MINRES Technologies GmbH and others.
|
||||||
|
# All rights reserved. This program and the accompanying materials
|
||||||
|
# are made available under the terms of the Eclipse Public License v1.0
|
||||||
|
# which accompanies this distribution, and is available at
|
||||||
|
# http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
#
|
||||||
|
# Contributors:
|
||||||
|
# MINRES Technologies GmbH - initial API and implementation
|
||||||
|
###############################################################################
|
||||||
output.. = bin/
|
output.. = bin/
|
||||||
bin.includes = META-INF/,\
|
bin.includes = META-INF/,\
|
||||||
.,\
|
.,\
|
||||||
component.xml,\
|
|
||||||
OSGI-INF/
|
OSGI-INF/
|
||||||
source.. = src/
|
source.. = src/
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
package com.minres.scviewer.database.text;
|
package com.minres.scviewer.database.text;
|
||||||
|
|
||||||
import com.minres.scviewer.database.ITx;
|
import com.minres.scviewer.database.ITx
|
||||||
import com.minres.scviewer.database.ITxEvent;
|
import com.minres.scviewer.database.ITxEvent
|
||||||
import com.minres.scviewer.database.IWaveformEvent;
|
import com.minres.scviewer.database.IWaveformEvent
|
||||||
|
|
||||||
class TxEvent implements ITxEvent {
|
class TxEvent implements ITxEvent {
|
||||||
|
|
||||||
|
@ -27,6 +27,11 @@ class TxEvent implements ITxEvent {
|
||||||
}
|
}
|
||||||
|
|
||||||
Long getTime(){
|
Long getTime(){
|
||||||
return type==ITxEvent.Type.BEGIN?transaction.beginTime:transaction.endTime
|
type==ITxEvent.Type.BEGIN?transaction.beginTime:transaction.endTime
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
String toString() {
|
||||||
|
type.toString()+"@"+getTime()+" of tx #"+transaction.id;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,9 +15,11 @@ import java.util.List;
|
||||||
|
|
||||||
import com.minres.scviewer.database.ITxAttributeType
|
import com.minres.scviewer.database.ITxAttributeType
|
||||||
import com.minres.scviewer.database.ITxAttribute;
|
import com.minres.scviewer.database.ITxAttribute;
|
||||||
|
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.ITx;
|
import com.minres.scviewer.database.ITx;
|
||||||
|
import com.minres.scviewer.database.IWaveformEvent;
|
||||||
|
|
||||||
class TxGenerator implements ITxGenerator{
|
class TxGenerator implements ITxGenerator{
|
||||||
Long id
|
Long id
|
||||||
|
@ -37,7 +39,7 @@ class TxGenerator implements ITxGenerator{
|
||||||
this.name=name
|
this.name=name
|
||||||
}
|
}
|
||||||
|
|
||||||
ITxStream getStream(){
|
ITxStream<? extends ITxEvent> getStream(){
|
||||||
return stream;
|
return stream;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,15 @@
|
||||||
|
###############################################################################
|
||||||
|
# Copyright (c) 2014, 2015 MINRES Technologies GmbH and others.
|
||||||
|
# All rights reserved. This program and the accompanying materials
|
||||||
|
# are made available under the terms of the Eclipse Public License v1.0
|
||||||
|
# which accompanies this distribution, and is available at
|
||||||
|
# http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
#
|
||||||
|
# Contributors:
|
||||||
|
# MINRES Technologies GmbH - initial API and implementation
|
||||||
|
###############################################################################
|
||||||
source.. = src/
|
source.. = src/
|
||||||
output.. = bin/
|
output.. = bin/
|
||||||
bin.includes = META-INF/,\
|
bin.includes = META-INF/,\
|
||||||
.
|
.,\
|
||||||
|
OSGI-INF/
|
||||||
|
|
|
@ -1,3 +1,13 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2014, 2015 MINRES Technologies GmbH and others.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* MINRES Technologies GmbH - initial API and implementation
|
||||||
|
*******************************************************************************/
|
||||||
package com.minres.scviewer.database.vcd;
|
package com.minres.scviewer.database.vcd;
|
||||||
|
|
||||||
import com.minres.scviewer.database.BitVector;
|
import com.minres.scviewer.database.BitVector;
|
||||||
|
@ -41,10 +51,10 @@ public interface IVCDDatabaseBuilder {
|
||||||
/**
|
/**
|
||||||
* Append transition.
|
* Append transition.
|
||||||
*
|
*
|
||||||
* @param intValue the int value
|
* @param signalId the int value
|
||||||
* @param fCurrentTime the f current time
|
* @param currentTime the current time in ps
|
||||||
* @param decodedValues the decoded values
|
* @param decodedValues the decoded values
|
||||||
*/
|
*/
|
||||||
public void appendTransition(int intValue, long fCurrentTime, BitVector decodedValues);
|
public void appendTransition(int signalId, long currentTime, BitVector decodedValues);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,13 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2014, 2015 MINRES Technologies GmbH and others.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* MINRES Technologies GmbH - initial API and implementation
|
||||||
|
*******************************************************************************/
|
||||||
package com.minres.scviewer.database.vcd;
|
package com.minres.scviewer.database.vcd;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
@ -93,7 +103,7 @@ public class VCDDbLoader implements IWaveformDbLoader, IVCDDatabaseBuilder {
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Long getMaxTime() {
|
public Long getMaxTime() {
|
||||||
return maxTime* TIME_RES;
|
return maxTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
|
@ -157,9 +167,9 @@ public class VCDDbLoader implements IWaveformDbLoader, IVCDDatabaseBuilder {
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
@Override
|
@Override
|
||||||
public void appendTransition(int signalId, long fCurrentTime, BitVector decodedValues) {
|
public void appendTransition(int signalId, long currentTime, BitVector decodedValues) {
|
||||||
VCDSignal<? extends IWaveformEvent> signal = (VCDSignal<? extends IWaveformEvent>) signals.get(signalId);
|
VCDSignal<? extends IWaveformEvent> signal = (VCDSignal<? extends IWaveformEvent>) signals.get(signalId);
|
||||||
Long time = fCurrentTime* TIME_RES;
|
Long time = currentTime* TIME_RES;
|
||||||
if(signal.getWidth()==1){
|
if(signal.getWidth()==1){
|
||||||
((VCDSignal<ISignalChangeSingle>)signal).values.put(time, new VCDSignalChangeSingle(time, decodedValues.getValue()[0]));
|
((VCDSignal<ISignalChangeSingle>)signal).values.put(time, new VCDSignalChangeSingle(time, decodedValues.getValue()[0]));
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -1,3 +1,13 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2014, 2015 MINRES Technologies GmbH and others.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* MINRES Technologies GmbH - initial API and implementation
|
||||||
|
*******************************************************************************/
|
||||||
package com.minres.scviewer.database.vcd;
|
package com.minres.scviewer.database.vcd;
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
|
|
|
@ -1,18 +1,24 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2014, 2015 MINRES Technologies GmbH and others.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* MINRES Technologies GmbH - initial API and implementation
|
||||||
|
*******************************************************************************/
|
||||||
package com.minres.scviewer.database.vcd;
|
package com.minres.scviewer.database.vcd;
|
||||||
|
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.Map.Entry;
|
|
||||||
import java.util.NavigableMap;
|
import java.util.NavigableMap;
|
||||||
import java.util.TreeMap;
|
import java.util.TreeMap;
|
||||||
|
|
||||||
import com.google.common.collect.Ordering;
|
|
||||||
import com.google.common.collect.TreeMultimap;
|
|
||||||
import com.minres.scviewer.database.HierNode;
|
import com.minres.scviewer.database.HierNode;
|
||||||
import com.minres.scviewer.database.ISignal;
|
import com.minres.scviewer.database.ISignal;
|
||||||
import com.minres.scviewer.database.ISignalChange;
|
import com.minres.scviewer.database.ISignalChange;
|
||||||
import com.minres.scviewer.database.IWaveformEvent;
|
|
||||||
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;
|
||||||
|
|
||||||
public class VCDSignal<T extends ISignalChange> extends HierNode implements ISignal<T> {
|
public class VCDSignal<T extends ISignalChange> extends HierNode implements ISignal<T> {
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,13 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2014, 2015 MINRES Technologies GmbH and others.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* MINRES Technologies GmbH - initial API and implementation
|
||||||
|
*******************************************************************************/
|
||||||
package com.minres.scviewer.database.vcd;
|
package com.minres.scviewer.database.vcd;
|
||||||
|
|
||||||
import com.minres.scviewer.database.BitVector;
|
import com.minres.scviewer.database.BitVector;
|
||||||
|
@ -25,4 +35,9 @@ public class VCDSignalChangeMulti extends SignalChange implements ISignalChangeM
|
||||||
this.value = value;
|
this.value = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return value.toHexString()+"@"+getTime();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,13 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2014, 2015 MINRES Technologies GmbH and others.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* MINRES Technologies GmbH - initial API and implementation
|
||||||
|
*******************************************************************************/
|
||||||
package com.minres.scviewer.database.vcd;
|
package com.minres.scviewer.database.vcd;
|
||||||
|
|
||||||
import com.minres.scviewer.database.ISignalChangeSingle;
|
import com.minres.scviewer.database.ISignalChangeSingle;
|
||||||
|
@ -20,4 +30,8 @@ public class VCDSignalChangeSingle extends SignalChange implements ISignalChange
|
||||||
this.value = value;
|
this.value = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return value+"@"+getTime();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,15 @@
|
||||||
|
###############################################################################
|
||||||
|
# Copyright (c) 2014, 2015 MINRES Technologies GmbH and others.
|
||||||
|
# All rights reserved. This program and the accompanying materials
|
||||||
|
# are made available under the terms of the Eclipse Public License v1.0
|
||||||
|
# which accompanies this distribution, and is available at
|
||||||
|
# http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
#
|
||||||
|
# Contributors:
|
||||||
|
# MINRES Technologies GmbH - initial API and implementation
|
||||||
|
###############################################################################
|
||||||
output.. = bin/
|
output.. = bin/
|
||||||
bin.includes = META-INF/,\
|
bin.includes = META-INF/,\
|
||||||
.,\
|
.,\
|
||||||
OSGI-INF/component.xml,\
|
OSGI-INF/
|
||||||
OSGI-INF/component.xml
|
|
||||||
source.. = src/
|
source.. = src/
|
||||||
|
|
|
@ -1,3 +1,13 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2014, 2015 MINRES Technologies GmbH and others.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* MINRES Technologies GmbH - initial API and implementation
|
||||||
|
*******************************************************************************/
|
||||||
package com.minres.scviewer.database;
|
package com.minres.scviewer.database;
|
||||||
|
|
||||||
public enum AssociationType {
|
public enum AssociationType {
|
||||||
|
|
|
@ -1,3 +1,13 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2014, 2015 MINRES Technologies GmbH and others.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* MINRES Technologies GmbH - initial API and implementation
|
||||||
|
*******************************************************************************/
|
||||||
package com.minres.scviewer.database;
|
package com.minres.scviewer.database;
|
||||||
|
|
||||||
public class BitVector {
|
public class BitVector {
|
||||||
|
|
|
@ -1,3 +1,13 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2014, 2015 MINRES Technologies GmbH and others.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* MINRES Technologies GmbH - initial API and implementation
|
||||||
|
*******************************************************************************/
|
||||||
package com.minres.scviewer.database;
|
package com.minres.scviewer.database;
|
||||||
|
|
||||||
public enum DataType {
|
public enum DataType {
|
||||||
|
|
|
@ -1,3 +1,13 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2014, 2015 MINRES Technologies GmbH and others.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* MINRES Technologies GmbH - initial API and implementation
|
||||||
|
*******************************************************************************/
|
||||||
package com.minres.scviewer.database;
|
package com.minres.scviewer.database;
|
||||||
|
|
||||||
import java.beans.PropertyChangeListener;
|
import java.beans.PropertyChangeListener;
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2012 IT Just working.
|
* Copyright (c) 2014, 2015 MINRES Technologies GmbH and others.
|
||||||
* 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:
|
||||||
* IT Just working - initial API and implementation
|
* MINRES Technologies GmbH - initial API and implementation
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package com.minres.scviewer.database;
|
package com.minres.scviewer.database;
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,13 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2014, 2015 MINRES Technologies GmbH and others.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* MINRES Technologies GmbH - initial API and implementation
|
||||||
|
*******************************************************************************/
|
||||||
package com.minres.scviewer.database;
|
package com.minres.scviewer.database;
|
||||||
|
|
||||||
import java.util.NavigableMap;
|
import java.util.NavigableMap;
|
||||||
|
|
|
@ -1,3 +1,13 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2014, 2015 MINRES Technologies GmbH and others.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* MINRES Technologies GmbH - initial API and implementation
|
||||||
|
*******************************************************************************/
|
||||||
package com.minres.scviewer.database;
|
package com.minres.scviewer.database;
|
||||||
|
|
||||||
public interface ISignalChange extends IWaveformEvent {
|
public interface ISignalChange extends IWaveformEvent {
|
||||||
|
|
|
@ -1,3 +1,13 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2014, 2015 MINRES Technologies GmbH and others.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* MINRES Technologies GmbH - initial API and implementation
|
||||||
|
*******************************************************************************/
|
||||||
package com.minres.scviewer.database;
|
package com.minres.scviewer.database;
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,13 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2014, 2015 MINRES Technologies GmbH and others.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* MINRES Technologies GmbH - initial API and implementation
|
||||||
|
*******************************************************************************/
|
||||||
package com.minres.scviewer.database;
|
package com.minres.scviewer.database;
|
||||||
|
|
||||||
public interface ISignalChangeSingle extends ISignalChange{
|
public interface ISignalChangeSingle extends ISignalChange{
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2012 IT Just working.
|
* Copyright (c) 2014, 2015 MINRES Technologies GmbH and others.
|
||||||
* 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:
|
||||||
* IT Just working - initial API and implementation
|
* MINRES Technologies GmbH - initial API and implementation
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package com.minres.scviewer.database;
|
package com.minres.scviewer.database;
|
||||||
|
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2012 IT Just working.
|
* Copyright (c) 2014, 2015 MINRES Technologies GmbH and others.
|
||||||
* 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:
|
||||||
* IT Just working - initial API and implementation
|
* MINRES Technologies GmbH - initial API and implementation
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package com.minres.scviewer.database;
|
package com.minres.scviewer.database;
|
||||||
|
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2012 IT Just working.
|
* Copyright (c) 2014, 2015 MINRES Technologies GmbH and others.
|
||||||
* 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:
|
||||||
* IT Just working - initial API and implementation
|
* MINRES Technologies GmbH - initial API and implementation
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package com.minres.scviewer.database;
|
package com.minres.scviewer.database;
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,13 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2014, 2015 MINRES Technologies GmbH and others.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* MINRES Technologies GmbH - initial API and implementation
|
||||||
|
*******************************************************************************/
|
||||||
package com.minres.scviewer.database;
|
package com.minres.scviewer.database;
|
||||||
|
|
||||||
public interface ITxEvent extends IWaveformEvent {
|
public interface ITxEvent extends IWaveformEvent {
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2012 IT Just working.
|
* Copyright (c) 2014, 2015 MINRES Technologies GmbH and others.
|
||||||
* 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:
|
||||||
* IT Just working - initial API and implementation
|
* MINRES Technologies GmbH - initial API and implementation
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package com.minres.scviewer.database;
|
package com.minres.scviewer.database;
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,13 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2014, 2015 MINRES Technologies GmbH and others.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* MINRES Technologies GmbH - initial API and implementation
|
||||||
|
*******************************************************************************/
|
||||||
package com.minres.scviewer.database;
|
package com.minres.scviewer.database;
|
||||||
|
|
||||||
public interface ITxRelation {
|
public interface ITxRelation {
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2012 IT Just working.
|
* Copyright (c) 2014, 2015 MINRES Technologies GmbH and others.
|
||||||
* 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:
|
||||||
* IT Just working - initial API and implementation
|
* MINRES Technologies GmbH - initial API and implementation
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package com.minres.scviewer.database;
|
package com.minres.scviewer.database;
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@ public interface ITxStream<T extends ITxEvent> extends IWaveform<T> {
|
||||||
|
|
||||||
public int getMaxConcurrency();
|
public int getMaxConcurrency();
|
||||||
|
|
||||||
public NavigableMap<Long, Collection<T>> getEvents();
|
public NavigableMap<Long, List<ITxEvent>> getEvents();
|
||||||
|
|
||||||
public Collection<T> getWaveformEventsAtTime(Long time);
|
public Collection<T> getWaveformEventsAtTime(Long time);
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,13 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2014, 2015 MINRES Technologies GmbH and others.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* MINRES Technologies GmbH - initial API and implementation
|
||||||
|
*******************************************************************************/
|
||||||
package com.minres.scviewer.database;
|
package com.minres.scviewer.database;
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2012 IT Just working.
|
* Copyright (c) 2014, 2015 MINRES Technologies GmbH and others.
|
||||||
* 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:
|
||||||
* IT Just working - initial API and implementation
|
* MINRES Technologies GmbH - initial API and implementation
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package com.minres.scviewer.database;
|
package com.minres.scviewer.database;
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@ public interface IWaveformDb extends IHierNode {
|
||||||
|
|
||||||
public Long getMaxTime();
|
public Long getMaxTime();
|
||||||
|
|
||||||
public IWaveform<?> getStreamByName(String name);
|
public IWaveform<? extends IWaveformEvent> getStreamByName(String name);
|
||||||
|
|
||||||
public List<IWaveform<?>> getAllWaves();
|
public List<IWaveform<?>> getAllWaves();
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,13 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2014, 2015 MINRES Technologies GmbH and others.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* MINRES Technologies GmbH - initial API and implementation
|
||||||
|
*******************************************************************************/
|
||||||
package com.minres.scviewer.database;
|
package com.minres.scviewer.database;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
|
|
@ -1,3 +1,13 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2014, 2015 MINRES Technologies GmbH and others.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* MINRES Technologies GmbH - initial API and implementation
|
||||||
|
*******************************************************************************/
|
||||||
package com.minres.scviewer.database;
|
package com.minres.scviewer.database;
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2012 IT Just working.
|
* Copyright (c) 2014, 2015 MINRES Technologies GmbH and others.
|
||||||
* 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:
|
||||||
* IT Just working - initial API and implementation
|
* MINRES Technologies GmbH - initial API and implementation
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package com.minres.scviewer.database;
|
package com.minres.scviewer.database;
|
||||||
|
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2012 IT Just working.
|
* Copyright (c) 2014, 2015 MINRES Technologies GmbH and others.
|
||||||
* 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:
|
||||||
* IT Just working - initial API and implementation
|
* MINRES Technologies GmbH - initial API and implementation
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package com.minres.scviewer.database;
|
package com.minres.scviewer.database;
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,13 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2014, 2015 MINRES Technologies GmbH and others.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* MINRES Technologies GmbH - initial API and implementation
|
||||||
|
*******************************************************************************/
|
||||||
package com.minres.scviewer.database;
|
package com.minres.scviewer.database;
|
||||||
|
|
||||||
public class SignalChange implements IWaveformEvent {
|
public class SignalChange implements IWaveformEvent {
|
||||||
|
|
|
@ -1,3 +1,13 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2014, 2015 MINRES Technologies GmbH and others.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* MINRES Technologies GmbH - initial API and implementation
|
||||||
|
*******************************************************************************/
|
||||||
package com.minres.scviewer.database;
|
package com.minres.scviewer.database;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
@ -44,7 +54,7 @@ public class WaveformDb extends HierNode implements IWaveformDb {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IWaveform<?> getStreamByName(String name) {
|
public IWaveform<? extends IWaveformEvent> getStreamByName(String name) {
|
||||||
return waveforms.get(name);
|
return waveforms.get(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,3 +21,4 @@ Bundle-RequiredExecutionEnvironment: JavaSE-1.7
|
||||||
Bundle-ActivationPolicy: lazy
|
Bundle-ActivationPolicy: lazy
|
||||||
Bundle-ClassPath: .,
|
Bundle-ClassPath: .,
|
||||||
swing2swt.jar
|
swing2swt.jar
|
||||||
|
Import-Package: com.google.common.collect
|
||||||
|
|
|
@ -1,10 +1,18 @@
|
||||||
output.. = bin/
|
###############################################################################
|
||||||
|
# Copyright (c) 2014, 2015 MINRES Technologies GmbH and others.
|
||||||
|
# All rights reserved. This program and the accompanying materials
|
||||||
|
# are made available under the terms of the Eclipse Public License v1.0
|
||||||
|
# which accompanies this distribution, and is available at
|
||||||
|
# http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
#
|
||||||
|
# Contributors:
|
||||||
|
# MINRES Technologies GmbH - initial API and implementation
|
||||||
|
###############################################################################
|
||||||
bin.includes = plugin.xml,\
|
bin.includes = plugin.xml,\
|
||||||
META-INF/,\
|
META-INF/,\
|
||||||
.,\
|
.,\
|
||||||
icons/,\
|
|
||||||
contexts.xml,\
|
contexts.xml,\
|
||||||
res/,\
|
res/
|
||||||
swing2swt.jar,\
|
|
||||||
OSGI-INF/
|
|
||||||
source.. = src/
|
source.. = src/
|
||||||
|
jars.compile.order = .
|
||||||
|
output.. = bin/
|
||||||
|
|
|
@ -116,8 +116,6 @@
|
||||||
id="com.minres.scviewer.ui.toolbar1">
|
id="com.minres.scviewer.ui.toolbar1">
|
||||||
<command
|
<command
|
||||||
commandId="com.minres.scviewer.ui.gotoPrev"
|
commandId="com.minres.scviewer.ui.gotoPrev"
|
||||||
disabledIcon="res/images/previous-green-d.png"
|
|
||||||
icon="res/images/previous-green.png"
|
|
||||||
label="Prev"
|
label="Prev"
|
||||||
style="push"
|
style="push"
|
||||||
tooltip="Go to previous event">
|
tooltip="Go to previous event">
|
||||||
|
@ -130,8 +128,6 @@
|
||||||
</command>
|
</command>
|
||||||
<command
|
<command
|
||||||
commandId="com.minres.scviewer.ui.gotoNext"
|
commandId="com.minres.scviewer.ui.gotoNext"
|
||||||
disabledIcon="res/images/next-green-d.png"
|
|
||||||
icon="res/images/next-green.png"
|
|
||||||
label="Next"
|
label="Next"
|
||||||
style="push"
|
style="push"
|
||||||
tooltip="Go to next event">
|
tooltip="Go to next event">
|
||||||
|
@ -142,8 +138,157 @@
|
||||||
</reference>
|
</reference>
|
||||||
</visibleWhen>
|
</visibleWhen>
|
||||||
</command>
|
</command>
|
||||||
|
<command
|
||||||
|
commandId="com.minres.scviewer.ui.zoom"
|
||||||
|
id="com.minres.scviewer.ui.zoom.command"
|
||||||
|
style="pulldown"
|
||||||
|
tooltip="Set zoom level">
|
||||||
|
<visibleWhen
|
||||||
|
checkEnabled="false">
|
||||||
|
<reference
|
||||||
|
definitionId="com.minres.scviewer.ui.waveEditorActive">
|
||||||
|
</reference>
|
||||||
|
</visibleWhen>
|
||||||
|
</command>
|
||||||
|
<command
|
||||||
|
commandId="com.minres.scviewer.ui.zoomin"
|
||||||
|
label="Zoom in"
|
||||||
|
style="push"
|
||||||
|
tooltip="Zoom into">
|
||||||
|
<visibleWhen
|
||||||
|
checkEnabled="false">
|
||||||
|
<reference
|
||||||
|
definitionId="com.minres.scviewer.ui.waveEditorActive">
|
||||||
|
</reference>
|
||||||
|
</visibleWhen>
|
||||||
|
</command>
|
||||||
|
<command
|
||||||
|
commandId="com.minres.scviewer.ui.zoomout"
|
||||||
|
label="Zoom out"
|
||||||
|
style="push"
|
||||||
|
tooltip="Zoom out of">
|
||||||
|
<visibleWhen
|
||||||
|
checkEnabled="false">
|
||||||
|
<reference
|
||||||
|
definitionId="com.minres.scviewer.ui.waveEditorActive">
|
||||||
|
</reference>
|
||||||
|
</visibleWhen>
|
||||||
|
</command>
|
||||||
</toolbar>
|
</toolbar>
|
||||||
</menuContribution>
|
</menuContribution>
|
||||||
|
<menuContribution
|
||||||
|
locationURI="menu:com.minres.scviewer.ui.zoom.command">
|
||||||
|
<command
|
||||||
|
commandId="com.minres.scviewer.ui.zoom"
|
||||||
|
label="100ps"
|
||||||
|
style="push"
|
||||||
|
tooltip="Resolution 100ps">
|
||||||
|
<parameter
|
||||||
|
name="com.minres.scviewer.ui.zoom.level"
|
||||||
|
value="5">
|
||||||
|
</parameter>
|
||||||
|
</command>
|
||||||
|
<command
|
||||||
|
commandId="com.minres.scviewer.ui.zoom"
|
||||||
|
label="1ns"
|
||||||
|
style="push"
|
||||||
|
tooltip="Resolution 1ns">
|
||||||
|
<parameter
|
||||||
|
name="com.minres.scviewer.ui.zoom.level"
|
||||||
|
value="6">
|
||||||
|
</parameter>
|
||||||
|
</command>
|
||||||
|
<command
|
||||||
|
commandId="com.minres.scviewer.ui.zoom"
|
||||||
|
label="10ns"
|
||||||
|
style="push"
|
||||||
|
tooltip="Resolution 10ns">
|
||||||
|
<parameter
|
||||||
|
name="com.minres.scviewer.ui.zoom.level"
|
||||||
|
value="7">
|
||||||
|
</parameter>
|
||||||
|
</command>
|
||||||
|
<command
|
||||||
|
commandId="com.minres.scviewer.ui.zoom"
|
||||||
|
label="100ns"
|
||||||
|
style="push"
|
||||||
|
tooltip="Resolution 100ns">
|
||||||
|
<parameter
|
||||||
|
name="com.minres.scviewer.ui.zoom.level"
|
||||||
|
value="8">
|
||||||
|
</parameter>
|
||||||
|
</command>
|
||||||
|
<command
|
||||||
|
commandId="com.minres.scviewer.ui.zoom"
|
||||||
|
label="1us"
|
||||||
|
style="push"
|
||||||
|
tooltip="Resolution 1us">
|
||||||
|
<parameter
|
||||||
|
name="com.minres.scviewer.ui.zoom.level"
|
||||||
|
value="9">
|
||||||
|
</parameter>
|
||||||
|
</command>
|
||||||
|
<command
|
||||||
|
commandId="com.minres.scviewer.ui.zoom"
|
||||||
|
label="10us"
|
||||||
|
style="push"
|
||||||
|
tooltip="Resolution 10us">
|
||||||
|
<parameter
|
||||||
|
name="com.minres.scviewer.ui.zoom.level"
|
||||||
|
value="10">
|
||||||
|
</parameter>
|
||||||
|
</command>
|
||||||
|
<command
|
||||||
|
commandId="com.minres.scviewer.ui.zoom"
|
||||||
|
label="100us"
|
||||||
|
style="push"
|
||||||
|
tooltip="Resolution 100us">
|
||||||
|
<parameter
|
||||||
|
name="com.minres.scviewer.ui.zoom.level"
|
||||||
|
value="11">
|
||||||
|
</parameter>
|
||||||
|
</command>
|
||||||
|
<command
|
||||||
|
commandId="com.minres.scviewer.ui.zoom"
|
||||||
|
label="1ms"
|
||||||
|
style="push"
|
||||||
|
tooltip="Resolution 1ms">
|
||||||
|
<parameter
|
||||||
|
name="com.minres.scviewer.ui.zoom.level"
|
||||||
|
value="12">
|
||||||
|
</parameter>
|
||||||
|
</command>
|
||||||
|
<command
|
||||||
|
commandId="com.minres.scviewer.ui.zoom"
|
||||||
|
label="10ms"
|
||||||
|
style="push"
|
||||||
|
tooltip="Resolution 10ms">
|
||||||
|
<parameter
|
||||||
|
name="com.minres.scviewer.ui.zoom.level"
|
||||||
|
value="13">
|
||||||
|
</parameter>
|
||||||
|
</command>
|
||||||
|
<command
|
||||||
|
commandId="com.minres.scviewer.ui.zoom"
|
||||||
|
label="100ms"
|
||||||
|
style="push"
|
||||||
|
tooltip="Resolution 100ms">
|
||||||
|
<parameter
|
||||||
|
name="com.minres.scviewer.ui.zoom.level"
|
||||||
|
value="14">
|
||||||
|
</parameter>
|
||||||
|
</command>
|
||||||
|
<command
|
||||||
|
commandId="com.minres.scviewer.ui.zoom"
|
||||||
|
label="1s"
|
||||||
|
style="push"
|
||||||
|
tooltip="Resolution 1s">
|
||||||
|
<parameter
|
||||||
|
name="com.minres.scviewer.ui.zoom.level"
|
||||||
|
value="15">
|
||||||
|
</parameter>
|
||||||
|
</command>
|
||||||
|
</menuContribution>
|
||||||
</extension>
|
</extension>
|
||||||
<extension
|
<extension
|
||||||
point="org.eclipse.ui.commands">
|
point="org.eclipse.ui.commands">
|
||||||
|
@ -157,9 +302,37 @@
|
||||||
id="com.minres.scviewer.ui.gotoPrev"
|
id="com.minres.scviewer.ui.gotoPrev"
|
||||||
name="Prev">
|
name="Prev">
|
||||||
</command>
|
</command>
|
||||||
|
<command
|
||||||
|
defaultHandler="com.minres.scviewer.ui.handler.Zoom"
|
||||||
|
description="Set the zoom level"
|
||||||
|
id="com.minres.scviewer.ui.zoom"
|
||||||
|
name="Zoom">
|
||||||
|
<commandParameter
|
||||||
|
id="com.minres.scviewer.ui.zoom.level"
|
||||||
|
name="level"
|
||||||
|
optional="true">
|
||||||
|
</commandParameter>
|
||||||
|
</command>
|
||||||
|
<command
|
||||||
|
id="com.minres.scviewer.ui.zoomin"
|
||||||
|
name="Zoom in">
|
||||||
|
</command>
|
||||||
|
<command
|
||||||
|
id="com.minres.scviewer.ui.zoomout"
|
||||||
|
name="Zoom out">
|
||||||
|
</command>
|
||||||
</extension>
|
</extension>
|
||||||
<extension
|
<extension
|
||||||
point="org.eclipse.ui.handlers">
|
point="org.eclipse.ui.handlers">
|
||||||
|
<handler
|
||||||
|
class="com.minres.scviewer.ui.handler.GotoPrev"
|
||||||
|
commandId="com.minres.scviewer.ui.gotoPrev">
|
||||||
|
<enabledWhen>
|
||||||
|
<reference
|
||||||
|
definitionId="com.minres.scviewer.ui.oneElementSeleted">
|
||||||
|
</reference>
|
||||||
|
</enabledWhen>
|
||||||
|
</handler>
|
||||||
<handler
|
<handler
|
||||||
class="com.minres.scviewer.ui.handler.GotoNext"
|
class="com.minres.scviewer.ui.handler.GotoNext"
|
||||||
commandId="com.minres.scviewer.ui.gotoNext">
|
commandId="com.minres.scviewer.ui.gotoNext">
|
||||||
|
@ -170,11 +343,20 @@
|
||||||
</enabledWhen>
|
</enabledWhen>
|
||||||
</handler>
|
</handler>
|
||||||
<handler
|
<handler
|
||||||
class="com.minres.scviewer.ui.handler.GotoPrev"
|
class="com.minres.scviewer.ui.handler.ZoomInOut"
|
||||||
commandId="com.minres.scviewer.ui.gotoPrev">
|
commandId="com.minres.scviewer.ui.zoomin">
|
||||||
<enabledWhen>
|
<enabledWhen>
|
||||||
<reference
|
<reference
|
||||||
definitionId="com.minres.scviewer.ui.oneElementSeleted">
|
definitionId="com.minres.scviewer.ui.waveEditorActive">
|
||||||
|
</reference>
|
||||||
|
</enabledWhen>
|
||||||
|
</handler>
|
||||||
|
<handler
|
||||||
|
class="com.minres.scviewer.ui.handler.ZoomInOut"
|
||||||
|
commandId="com.minres.scviewer.ui.zoomout">
|
||||||
|
<enabledWhen>
|
||||||
|
<reference
|
||||||
|
definitionId="com.minres.scviewer.ui.waveEditorActive">
|
||||||
</reference>
|
</reference>
|
||||||
</enabledWhen>
|
</enabledWhen>
|
||||||
</handler>
|
</handler>
|
||||||
|
@ -206,5 +388,30 @@
|
||||||
</with>
|
</with>
|
||||||
</definition>
|
</definition>
|
||||||
</extension>
|
</extension>
|
||||||
|
<extension
|
||||||
|
point="org.eclipse.ui.commandImages">
|
||||||
|
<image
|
||||||
|
commandId="com.minres.scviewer.ui.gotoPrev"
|
||||||
|
disabledIcon="res/images/previous-green-d.png"
|
||||||
|
icon="res/images/previous-green.png">
|
||||||
|
</image>
|
||||||
|
<image
|
||||||
|
commandId="com.minres.scviewer.ui.gotoNext"
|
||||||
|
disabledIcon="res/images/next-green-d.png"
|
||||||
|
icon="res/images/next-green.png">
|
||||||
|
</image>
|
||||||
|
<image
|
||||||
|
commandId="com.minres.scviewer.ui.zoom"
|
||||||
|
icon="res/images/zoom.png">
|
||||||
|
</image>
|
||||||
|
<image
|
||||||
|
commandId="com.minres.scviewer.ui.zoomin"
|
||||||
|
icon="res/images/zoom_in.png">
|
||||||
|
</image>
|
||||||
|
<image
|
||||||
|
commandId="com.minres.scviewer.ui.zoomout"
|
||||||
|
icon="res/images/zoom_out.png">
|
||||||
|
</image>
|
||||||
|
</extension>
|
||||||
|
|
||||||
</plugin>
|
</plugin>
|
||||||
|
|
Binary file not shown.
After Width: | Height: | Size: 692 B |
Binary file not shown.
After Width: | Height: | Size: 725 B |
Binary file not shown.
After Width: | Height: | Size: 708 B |
|
@ -1,3 +1,13 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2014, 2015 MINRES Technologies GmbH and others.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* MINRES Technologies GmbH - initial API and implementation
|
||||||
|
*******************************************************************************/
|
||||||
package com.minres.scviewer.ui;
|
package com.minres.scviewer.ui;
|
||||||
|
|
||||||
import org.eclipse.ui.part.EditorActionBarContributor;
|
import org.eclipse.ui.part.EditorActionBarContributor;
|
||||||
|
|
|
@ -1,3 +1,13 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2014, 2015 MINRES Technologies GmbH and others.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* MINRES Technologies GmbH - initial API and implementation
|
||||||
|
*******************************************************************************/
|
||||||
package com.minres.scviewer.ui;
|
package com.minres.scviewer.ui;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
@ -11,6 +21,8 @@ public class TxEditorInput extends FileEditorInput {
|
||||||
|
|
||||||
private ArrayList<String> streamNames;
|
private ArrayList<String> streamNames;
|
||||||
|
|
||||||
|
private Boolean secondaryLoaded=null;
|
||||||
|
|
||||||
public TxEditorInput(IFile file) {
|
public TxEditorInput(IFile file) {
|
||||||
super(file);
|
super(file);
|
||||||
streamNames=new ArrayList<String>();
|
streamNames=new ArrayList<String>();
|
||||||
|
@ -28,4 +40,12 @@ public class TxEditorInput extends FileEditorInput {
|
||||||
return streamNames;
|
return streamNames;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Boolean isSecondaryLoaded() {
|
||||||
|
return secondaryLoaded;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSecondaryLoaded(Boolean secondaryLoaded) {
|
||||||
|
this.secondaryLoaded = secondaryLoaded;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,13 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2014, 2015 MINRES Technologies GmbH and others.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* MINRES Technologies GmbH - initial API and implementation
|
||||||
|
*******************************************************************************/
|
||||||
package com.minres.scviewer.ui;
|
package com.minres.scviewer.ui;
|
||||||
|
|
||||||
import java.io.ByteArrayInputStream;
|
import java.io.ByteArrayInputStream;
|
||||||
|
@ -21,13 +31,18 @@ public class TxEditorInputFactory implements IElementFactory {
|
||||||
* with the "org.eclipse.ui.elementFactories" extension point.
|
* with the "org.eclipse.ui.elementFactories" extension point.
|
||||||
*/
|
*/
|
||||||
private static final String ID_FACTORY = "com.minres.scviewer.ui.TxEditorInputFactory"; //$NON-NLS-1$
|
private static final String ID_FACTORY = "com.minres.scviewer.ui.TxEditorInputFactory"; //$NON-NLS-1$
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tag for the IFile.fullPath of the file resource.
|
* Tag for the IFile.fullPath of the file resource.
|
||||||
*/
|
*/
|
||||||
private static final String TAG_PATH = "path"; //$NON-NLS-1$
|
private static final String TAG_PATH = "path"; //$NON-NLS-1$
|
||||||
|
/**
|
||||||
private static final String STREAMLIST_PATH = "stream_list"; //$NON-NLS-1$
|
* Tag for the secondaryLoade of the resource.
|
||||||
|
*/
|
||||||
|
private static final String TAG_SECONDARY = "secondary"; //$NON-NLS-1$
|
||||||
|
/**
|
||||||
|
* Tag for the streamList of the resource.
|
||||||
|
*/
|
||||||
|
private static final String TAG_STREAMLIST = "stream_list"; //$NON-NLS-1$
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new factory.
|
* Creates a new factory.
|
||||||
|
@ -45,13 +60,15 @@ public class TxEditorInputFactory implements IElementFactory {
|
||||||
if (fileName == null) {
|
if (fileName == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get a handle to the IFile...which can be a handle
|
// Get a handle to the IFile...which can be a handle
|
||||||
// to a resource that does not exist in workspace
|
// to a resource that does not exist in workspace
|
||||||
IFile file = ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(fileName));
|
IFile file = ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(fileName));
|
||||||
if (file != null) {
|
if (file != null) {
|
||||||
TxEditorInput tei = new TxEditorInput(file);
|
TxEditorInput tei = new TxEditorInput(file);
|
||||||
String listData = memento.getString(STREAMLIST_PATH);
|
Boolean isSecondaryLoaded = memento.getBoolean(TAG_SECONDARY);
|
||||||
|
if(isSecondaryLoaded!=null)
|
||||||
|
tei.setSecondaryLoaded(isSecondaryLoaded);
|
||||||
|
String listData = memento.getString(TAG_STREAMLIST);
|
||||||
if (listData != null) {
|
if (listData != null) {
|
||||||
try {
|
try {
|
||||||
ByteArrayInputStream bais = new ByteArrayInputStream(javax.xml.bind.DatatypeConverter.parseHexBinary(listData));
|
ByteArrayInputStream bais = new ByteArrayInputStream(javax.xml.bind.DatatypeConverter.parseHexBinary(listData));
|
||||||
|
@ -85,11 +102,12 @@ public class TxEditorInputFactory implements IElementFactory {
|
||||||
public static void saveState(IMemento memento, TxEditorInput input) {
|
public static void saveState(IMemento memento, TxEditorInput input) {
|
||||||
IFile file = input.getFile();
|
IFile file = input.getFile();
|
||||||
memento.putString(TAG_PATH, file.getFullPath().toString());
|
memento.putString(TAG_PATH, file.getFullPath().toString());
|
||||||
|
if(input.isSecondaryLoaded()!=null) memento.putBoolean(TAG_SECONDARY, input.isSecondaryLoaded());
|
||||||
try {
|
try {
|
||||||
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||||
ObjectOutputStream oos = new ObjectOutputStream(baos);
|
ObjectOutputStream oos = new ObjectOutputStream(baos);
|
||||||
oos.writeObject(input.getStreamNames());
|
oos.writeObject(input.getStreamNames());
|
||||||
memento.putString(STREAMLIST_PATH, javax.xml.bind.DatatypeConverter.printHexBinary(baos.toByteArray()));
|
memento.putString(TAG_STREAMLIST, javax.xml.bind.DatatypeConverter.printHexBinary(baos.toByteArray()));
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2012 IT Just working.
|
* Copyright (c) 2014, 2015 MINRES Technologies GmbH and others.
|
||||||
* 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:
|
||||||
* IT Just working - initial API and implementation
|
* MINRES Technologies GmbH - initial API and implementation
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package com.minres.scviewer.ui;
|
package com.minres.scviewer.ui;
|
||||||
|
|
||||||
|
@ -20,12 +20,10 @@ import java.util.List;
|
||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
import org.eclipse.core.runtime.IPath;
|
|
||||||
import org.eclipse.core.runtime.IProgressMonitor;
|
import org.eclipse.core.runtime.IProgressMonitor;
|
||||||
import org.eclipse.jface.dialogs.MessageDialog;
|
import org.eclipse.jface.dialogs.MessageDialog;
|
||||||
import org.eclipse.jface.operation.IRunnableWithProgress;
|
import org.eclipse.jface.operation.IRunnableWithProgress;
|
||||||
import org.eclipse.jface.viewers.ISelection;
|
import org.eclipse.jface.viewers.ISelection;
|
||||||
import org.eclipse.swt.graphics.Color;
|
|
||||||
import org.eclipse.swt.widgets.Composite;
|
import org.eclipse.swt.widgets.Composite;
|
||||||
import org.eclipse.ui.IEditorInput;
|
import org.eclipse.ui.IEditorInput;
|
||||||
import org.eclipse.ui.IEditorSite;
|
import org.eclipse.ui.IEditorSite;
|
||||||
|
@ -40,13 +38,10 @@ import org.eclipse.ui.views.contentoutline.IContentOutlinePage;
|
||||||
import org.eclipse.ui.views.properties.IPropertySheetPage;
|
import org.eclipse.ui.views.properties.IPropertySheetPage;
|
||||||
import org.eclipse.ui.views.properties.tabbed.ITabbedPropertySheetPageContributor;
|
import org.eclipse.ui.views.properties.tabbed.ITabbedPropertySheetPageContributor;
|
||||||
import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage;
|
import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage;
|
||||||
import org.osgi.framework.BundleContext;
|
|
||||||
import org.osgi.framework.FrameworkUtil;
|
|
||||||
import org.osgi.framework.ServiceReference;
|
|
||||||
|
|
||||||
import com.minres.scviewer.database.IWaveformDb;
|
|
||||||
import com.minres.scviewer.database.ITxStream;
|
|
||||||
import com.minres.scviewer.database.IWaveform;
|
import com.minres.scviewer.database.IWaveform;
|
||||||
|
import com.minres.scviewer.database.IWaveformDb;
|
||||||
|
import com.minres.scviewer.database.IWaveformEvent;
|
||||||
import com.minres.scviewer.database.WaveformDb;
|
import com.minres.scviewer.database.WaveformDb;
|
||||||
import com.minres.scviewer.ui.handler.GotoDirection;
|
import com.minres.scviewer.ui.handler.GotoDirection;
|
||||||
import com.minres.scviewer.ui.swt.TxDisplay;
|
import com.minres.scviewer.ui.swt.TxDisplay;
|
||||||
|
@ -76,19 +71,6 @@ public class TxEditorPart extends EditorPart implements ITabbedPropertySheetPage
|
||||||
public void createPartControl(Composite parent) {
|
public void createPartControl(Composite parent) {
|
||||||
myParent=parent;
|
myParent=parent;
|
||||||
database=new WaveformDb();
|
database=new WaveformDb();
|
||||||
txDisplay = new TxDisplay(parent);
|
|
||||||
txDisplay.setMaxTime(0);
|
|
||||||
getSite().setSelectionProvider(txDisplay);
|
|
||||||
new Thread(new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
try {
|
|
||||||
loadDatabases();
|
|
||||||
} catch (InvocationTargetException | IOException | InterruptedException e) {
|
|
||||||
handleLoadException(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}).run();
|
|
||||||
database.addPropertyChangeListener(new PropertyChangeListener() {
|
database.addPropertyChangeListener(new PropertyChangeListener() {
|
||||||
@Override
|
@Override
|
||||||
public void propertyChange(PropertyChangeEvent evt) {
|
public void propertyChange(PropertyChangeEvent evt) {
|
||||||
|
@ -102,6 +84,19 @@ public class TxEditorPart extends EditorPart implements ITabbedPropertySheetPage
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
txDisplay = new TxDisplay(parent);
|
||||||
|
txDisplay.setMaxTime(0);
|
||||||
|
getSite().setSelectionProvider(txDisplay);
|
||||||
|
new Thread(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
try {
|
||||||
|
loadDatabases();
|
||||||
|
} catch (InvocationTargetException | IOException | InterruptedException e) {
|
||||||
|
handleLoadException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}).run();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -121,23 +116,35 @@ public class TxEditorPart extends EditorPart implements ITabbedPropertySheetPage
|
||||||
IProgressService ps = wb.getProgressService();
|
IProgressService ps = wb.getProgressService();
|
||||||
IEditorInput input = getEditorInput();
|
IEditorInput input = getEditorInput();
|
||||||
File file=null;
|
File file=null;
|
||||||
|
boolean loadSecondary=false;
|
||||||
|
boolean dontAskForSecondary=false;
|
||||||
ArrayList<File> filesToLoad=new ArrayList<File>();
|
ArrayList<File> filesToLoad=new ArrayList<File>();
|
||||||
if(input instanceof IFileEditorInput){
|
if(input instanceof TxEditorInput){
|
||||||
file = ((IFileEditorInput) input).getFile().getLocation().toFile();
|
TxEditorInput txInput = (TxEditorInput) input;
|
||||||
|
file = txInput.getFile().getLocation().toFile();
|
||||||
|
loadSecondary=txInput.isSecondaryLoaded()==null||txInput.isSecondaryLoaded();
|
||||||
|
dontAskForSecondary=txInput.isSecondaryLoaded()!=null;
|
||||||
} else if(input instanceof FileStoreEditorInput){
|
} else if(input instanceof FileStoreEditorInput){
|
||||||
file=new File(((FileStoreEditorInput) input).getURI().getPath());
|
file=new File(((FileStoreEditorInput) input).getURI().getPath());
|
||||||
}
|
}
|
||||||
if(file.exists()){
|
if(file.exists()){
|
||||||
filesToLoad.add(file);
|
filesToLoad.add(file);
|
||||||
|
if(loadSecondary){
|
||||||
String ext = getFileExtension(file.getName());
|
String ext = getFileExtension(file.getName());
|
||||||
if("vcd".equals(ext.toLowerCase())){
|
if("vcd".equals(ext.toLowerCase())){
|
||||||
if(askIfToLoad(new File(renameFileExtension(file.getCanonicalPath(), "txdb"))))
|
if(dontAskForSecondary || askIfToLoad(new File(renameFileExtension(file.getCanonicalPath(), "txdb")))){
|
||||||
filesToLoad.add(new File(renameFileExtension(file.getCanonicalPath(), "txdb")));
|
filesToLoad.add(new File(renameFileExtension(file.getCanonicalPath(), "txdb")));
|
||||||
else if(askIfToLoad(new File(renameFileExtension(file.getCanonicalPath(), "txlog"))))
|
if(input instanceof TxEditorInput) ((TxEditorInput) input).setSecondaryLoaded(true);
|
||||||
|
}else if(dontAskForSecondary ||askIfToLoad(new File(renameFileExtension(file.getCanonicalPath(), "txlog")))){
|
||||||
filesToLoad.add(new File(renameFileExtension(file.getCanonicalPath(), "txlog")));
|
filesToLoad.add(new File(renameFileExtension(file.getCanonicalPath(), "txlog")));
|
||||||
|
if(input instanceof TxEditorInput) ((TxEditorInput) input).setSecondaryLoaded(true);
|
||||||
|
}
|
||||||
} else if("txdb".equals(ext.toLowerCase()) || "txlog".equals(ext.toLowerCase())){
|
} else if("txdb".equals(ext.toLowerCase()) || "txlog".equals(ext.toLowerCase())){
|
||||||
if(askIfToLoad(new File(renameFileExtension(file.getCanonicalPath(), "vcd"))))
|
if(dontAskForSecondary || askIfToLoad(new File(renameFileExtension(file.getCanonicalPath(), "vcd")))){
|
||||||
filesToLoad.add(new File(renameFileExtension(file.getCanonicalPath(), "vcd")));
|
filesToLoad.add(new File(renameFileExtension(file.getCanonicalPath(), "vcd")));
|
||||||
|
if(input instanceof TxEditorInput) ((TxEditorInput) input).setSecondaryLoaded(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -183,7 +190,7 @@ public class TxEditorPart extends EditorPart implements ITabbedPropertySheetPage
|
||||||
if(TxEditorPart.this.getEditorInput() instanceof TxEditorInput &&
|
if(TxEditorPart.this.getEditorInput() instanceof TxEditorInput &&
|
||||||
((TxEditorInput) TxEditorPart.this.getEditorInput()).getStreamNames().size()>0){
|
((TxEditorInput) TxEditorPart.this.getEditorInput()).getStreamNames().size()>0){
|
||||||
for(String streamName:((TxEditorInput) TxEditorPart.this.getEditorInput()).getStreamNames()){
|
for(String streamName:((TxEditorInput) TxEditorPart.this.getEditorInput()).getStreamNames()){
|
||||||
IWaveform stream = database.getStreamByName(streamName);
|
IWaveform<? extends IWaveformEvent> stream = database.getStreamByName(streamName);
|
||||||
if(stream!=null)
|
if(stream!=null)
|
||||||
txDisplay.getStreamList().add(stream);
|
txDisplay.getStreamList().add(stream);
|
||||||
}
|
}
|
||||||
|
@ -266,7 +273,7 @@ public class TxEditorPart extends EditorPart implements ITabbedPropertySheetPage
|
||||||
return database;
|
return database;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addStreamToList(IWaveform obj){
|
public void addStreamToList(IWaveform<? extends IWaveformEvent> obj){
|
||||||
if(getEditorInput() instanceof TxEditorInput && !((TxEditorInput) getEditorInput()).getStreamNames().contains(obj.getFullName())){
|
if(getEditorInput() instanceof TxEditorInput && !((TxEditorInput) getEditorInput()).getStreamNames().contains(obj.getFullName())){
|
||||||
((TxEditorInput) getEditorInput()).getStreamNames().add(obj.getFullName());
|
((TxEditorInput) getEditorInput()).getStreamNames().add(obj.getFullName());
|
||||||
txDisplay.getStreamList().add(obj);
|
txDisplay.getStreamList().add(obj);
|
||||||
|
@ -275,12 +282,12 @@ public class TxEditorPart extends EditorPart implements ITabbedPropertySheetPage
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addStreamsToList(IWaveform[] iWaveforms){
|
public void addStreamsToList(IWaveform<? extends IWaveformEvent>[] iWaveforms){
|
||||||
for(IWaveform stream:iWaveforms)
|
for(IWaveform<? extends IWaveformEvent> stream:iWaveforms)
|
||||||
addStreamToList(stream);
|
addStreamToList(stream);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void removeStreamFromList(IWaveform obj){
|
public void removeStreamFromList(IWaveform<? extends IWaveformEvent> obj){
|
||||||
if(getEditorInput() instanceof TxEditorInput && ((TxEditorInput) getEditorInput()).getStreamNames().contains(obj.getFullName())){
|
if(getEditorInput() instanceof TxEditorInput && ((TxEditorInput) getEditorInput()).getStreamNames().contains(obj.getFullName())){
|
||||||
((TxEditorInput) getEditorInput()).getStreamNames().remove(obj.getFullName());
|
((TxEditorInput) getEditorInput()).getStreamNames().remove(obj.getFullName());
|
||||||
txDisplay.getStreamList().remove(obj);
|
txDisplay.getStreamList().remove(obj);
|
||||||
|
@ -288,12 +295,12 @@ public class TxEditorPart extends EditorPart implements ITabbedPropertySheetPage
|
||||||
txDisplay.getStreamList().remove(obj);
|
txDisplay.getStreamList().remove(obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void removeStreamsFromList(IWaveform[] iWaveforms){
|
public void removeStreamsFromList(IWaveform<? extends IWaveformEvent>[] iWaveforms){
|
||||||
for(IWaveform stream:iWaveforms)
|
for(IWaveform<? extends IWaveformEvent> stream:iWaveforms)
|
||||||
removeStreamFromList(stream);
|
removeStreamFromList(stream);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<IWaveform> getStreamList(){
|
public List<IWaveform<? extends IWaveformEvent>> getStreamList(){
|
||||||
return txDisplay.getStreamList();
|
return txDisplay.getStreamList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -315,4 +322,16 @@ public class TxEditorPart extends EditorPart implements ITabbedPropertySheetPage
|
||||||
txDisplay.moveSelection( next);
|
txDisplay.moveSelection( next);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setZoomLevel(Integer level) {
|
||||||
|
txDisplay.setZoomLevel(level);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setZoomFit() {
|
||||||
|
txDisplay.setZoomLevel(6);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getZoomLevel() {
|
||||||
|
return txDisplay.getZoomLevel();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,18 +1,16 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2012 IT Just working.
|
* Copyright (c) 2014, 2015 MINRES Technologies GmbH and others.
|
||||||
* 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:
|
||||||
* IT Just working - initial API and implementation
|
* MINRES Technologies GmbH - initial API and implementation
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package com.minres.scviewer.ui;
|
package com.minres.scviewer.ui;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.MissingResourceException;
|
import java.util.MissingResourceException;
|
||||||
import java.util.ResourceBundle;
|
import java.util.ResourceBundle;
|
||||||
|
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2012 IT Just working.
|
* Copyright (c) 2014, 2015 MINRES Technologies GmbH and others.
|
||||||
* 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:
|
||||||
* IT Just working - initial API and implementation
|
* MINRES Technologies GmbH - initial API and implementation
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package com.minres.scviewer.ui.adapter;
|
package com.minres.scviewer.ui.adapter;
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,13 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2014, 2015 MINRES Technologies GmbH and others.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* MINRES Technologies GmbH - initial API and implementation
|
||||||
|
*******************************************************************************/
|
||||||
package com.minres.scviewer.ui.adapter;
|
package com.minres.scviewer.ui.adapter;
|
||||||
|
|
||||||
import org.eclipse.core.runtime.IAdapterFactory;
|
import org.eclipse.core.runtime.IAdapterFactory;
|
||||||
|
|
|
@ -1,3 +1,13 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2014, 2015 MINRES Technologies GmbH and others.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* MINRES Technologies GmbH - initial API and implementation
|
||||||
|
*******************************************************************************/
|
||||||
package com.minres.scviewer.ui.handler;
|
package com.minres.scviewer.ui.handler;
|
||||||
|
|
||||||
public enum GotoDirection {PREV, NEXT}
|
public enum GotoDirection {PREV, NEXT}
|
|
@ -1,3 +1,13 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2014, 2015 MINRES Technologies GmbH and others.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* MINRES Technologies GmbH - initial API and implementation
|
||||||
|
*******************************************************************************/
|
||||||
package com.minres.scviewer.ui.handler;
|
package com.minres.scviewer.ui.handler;
|
||||||
|
|
||||||
import org.eclipse.core.commands.AbstractHandler;
|
import org.eclipse.core.commands.AbstractHandler;
|
||||||
|
|
|
@ -1,3 +1,13 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2014, 2015 MINRES Technologies GmbH and others.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* MINRES Technologies GmbH - initial API and implementation
|
||||||
|
*******************************************************************************/
|
||||||
package com.minres.scviewer.ui.handler;
|
package com.minres.scviewer.ui.handler;
|
||||||
|
|
||||||
import org.eclipse.core.commands.AbstractHandler;
|
import org.eclipse.core.commands.AbstractHandler;
|
||||||
|
|
|
@ -0,0 +1,41 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2014, 2015 MINRES Technologies GmbH and others.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* MINRES Technologies GmbH - initial API and implementation
|
||||||
|
*******************************************************************************/
|
||||||
|
package com.minres.scviewer.ui.handler;
|
||||||
|
|
||||||
|
import org.eclipse.core.commands.AbstractHandler;
|
||||||
|
import org.eclipse.core.commands.ExecutionEvent;
|
||||||
|
import org.eclipse.core.commands.ExecutionException;
|
||||||
|
import org.eclipse.ui.IEditorPart;
|
||||||
|
import org.eclipse.ui.handlers.HandlerUtil;
|
||||||
|
|
||||||
|
import com.minres.scviewer.ui.TxEditorPart;
|
||||||
|
|
||||||
|
public class Zoom extends AbstractHandler {
|
||||||
|
private static final String PARM_MSG = "com.minres.scviewer.ui.zoom.level";
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object execute(ExecutionEvent event) throws ExecutionException {
|
||||||
|
IEditorPart editor = HandlerUtil.getActiveEditor(event);
|
||||||
|
String msg = event.getParameter(PARM_MSG);
|
||||||
|
if (msg == null) {
|
||||||
|
if(editor instanceof TxEditorPart){
|
||||||
|
((TxEditorPart)editor).setZoomFit();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Integer level = Integer.parseInt(msg);
|
||||||
|
if(editor instanceof TxEditorPart){
|
||||||
|
((TxEditorPart)editor).setZoomLevel(level);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,39 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2014, 2015 MINRES Technologies GmbH and others.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* MINRES Technologies GmbH - initial API and implementation
|
||||||
|
*******************************************************************************/
|
||||||
|
package com.minres.scviewer.ui.handler;
|
||||||
|
|
||||||
|
import org.eclipse.core.commands.AbstractHandler;
|
||||||
|
import org.eclipse.core.commands.ExecutionEvent;
|
||||||
|
import org.eclipse.core.commands.ExecutionException;
|
||||||
|
import org.eclipse.ui.IEditorPart;
|
||||||
|
import org.eclipse.ui.handlers.HandlerUtil;
|
||||||
|
|
||||||
|
import com.minres.scviewer.ui.TxEditorPart;
|
||||||
|
|
||||||
|
public class ZoomInOut extends AbstractHandler {
|
||||||
|
private static final String ZOOMIN_ID = "com.minres.scviewer.ui.zoomin";
|
||||||
|
private static final String ZOOMOUT_ID= "com.minres.scviewer.ui.zoomout";
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object execute(ExecutionEvent event) throws ExecutionException {
|
||||||
|
IEditorPart editor = HandlerUtil.getActiveEditor(event);
|
||||||
|
if(editor instanceof TxEditorPart){
|
||||||
|
String id = event.getCommand().getId();
|
||||||
|
TxEditorPart txEditor=(TxEditorPart) editor;
|
||||||
|
if (ZOOMIN_ID.compareTo(id) == 0)
|
||||||
|
txEditor.setZoomLevel(txEditor.getZoomLevel()-1);
|
||||||
|
else if(ZOOMOUT_ID.compareTo(id) == 0)
|
||||||
|
txEditor.setZoomLevel(txEditor.getZoomLevel()+1);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,50 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2014, 2015 MINRES Technologies GmbH and others.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* MINRES Technologies GmbH - initial API and implementation
|
||||||
|
*******************************************************************************/
|
||||||
|
package com.minres.scviewer.ui.swt;
|
||||||
|
|
||||||
|
import org.eclipse.swt.graphics.GC;
|
||||||
|
import org.eclipse.swt.graphics.Rectangle;
|
||||||
|
|
||||||
|
class CursorPainter implements IPainter {
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
private final WaveformCanvas waveCanvas;
|
||||||
|
private long time;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param i
|
||||||
|
* @param txDisplay
|
||||||
|
*/
|
||||||
|
CursorPainter(WaveformCanvas txDisplay, long time) {
|
||||||
|
this.waveCanvas = txDisplay;
|
||||||
|
this.time=time;
|
||||||
|
}
|
||||||
|
|
||||||
|
public long getTime() {
|
||||||
|
return time;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTime(long time) {
|
||||||
|
this.time = time;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void paintArea(GC gc, Rectangle area) {
|
||||||
|
if(this.waveCanvas.streams.size()>0){
|
||||||
|
int x = (int) (time/waveCanvas.getScaleFactor());
|
||||||
|
if(x>=area.x && x<=(area.x+area.width)){
|
||||||
|
gc.setForeground(waveCanvas.colors[WaveformCanvas.Colors.CURSOR.ordinal()]);
|
||||||
|
gc.drawLine(x, area.y, x, area.y+area.height);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,7 +1,16 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2014, 2015 MINRES Technologies GmbH and others.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* MINRES Technologies GmbH - initial API and implementation
|
||||||
|
*******************************************************************************/
|
||||||
package com.minres.scviewer.ui.swt;
|
package com.minres.scviewer.ui.swt;
|
||||||
|
|
||||||
import org.eclipse.swt.graphics.GC;
|
import org.eclipse.swt.graphics.GC;
|
||||||
import org.eclipse.swt.graphics.Image;
|
|
||||||
import org.eclipse.swt.graphics.Rectangle;
|
import org.eclipse.swt.graphics.Rectangle;
|
||||||
|
|
||||||
public interface IPainter {
|
public interface IPainter {
|
||||||
|
|
|
@ -1,3 +1,13 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2014, 2015 MINRES Technologies GmbH and others.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* MINRES Technologies GmbH - initial API and implementation
|
||||||
|
*******************************************************************************/
|
||||||
package com.minres.scviewer.ui.swt;
|
package com.minres.scviewer.ui.swt;
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,13 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2014, 2015 MINRES Technologies GmbH and others.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* MINRES Technologies GmbH - initial API and implementation
|
||||||
|
*******************************************************************************/
|
||||||
package com.minres.scviewer.ui.swt;
|
package com.minres.scviewer.ui.swt;
|
||||||
|
|
||||||
import java.beans.PropertyChangeEvent;
|
import java.beans.PropertyChangeEvent;
|
||||||
|
@ -208,6 +218,7 @@ public class ObservableList<E> implements List<E> {
|
||||||
List<E> values = new ArrayList<E>();
|
List<E> values = new ArrayList<E>();
|
||||||
if (c != null) {
|
if (c != null) {
|
||||||
for (Iterator<?> i = c.iterator(); i.hasNext();) {
|
for (Iterator<?> i = c.iterator(); i.hasNext();) {
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
E element = (E) i.next();
|
E element = (E) i.next();
|
||||||
if (this.delegate.contains(element)) {
|
if (this.delegate.contains(element)) {
|
||||||
values.add(element);
|
values.add(element);
|
||||||
|
|
|
@ -1,3 +1,13 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2014, 2015 MINRES Technologies GmbH and others.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* MINRES Technologies GmbH - initial API and implementation
|
||||||
|
*******************************************************************************/
|
||||||
package com.minres.scviewer.ui.swt;
|
package com.minres.scviewer.ui.swt;
|
||||||
|
|
||||||
import org.eclipse.swt.SWT;
|
import org.eclipse.swt.SWT;
|
||||||
|
@ -19,21 +29,26 @@ public class Ruler extends Composite {
|
||||||
static final int tickY = 15;
|
static final int tickY = 15;
|
||||||
static final int majorTickY = 5;
|
static final int majorTickY = 5;
|
||||||
|
|
||||||
static final int rulerTickMinor = 10;
|
static final int rulerTickMinorC = 10;
|
||||||
static final int rulerTickMajor = 100;
|
static final int rulerTickMajorC = 100;
|
||||||
|
|
||||||
private int length;
|
private int length;
|
||||||
private int start;
|
private long start;
|
||||||
|
|
||||||
private TxEditorPlugin plugin;
|
private TxEditorPlugin plugin;
|
||||||
private Color headerBgColor;
|
private Color headerBgColor;
|
||||||
private Color headerFgColor;
|
private Color headerFgColor;
|
||||||
private int bottom;
|
private int bottom;
|
||||||
private int baselineY;
|
private int baselineY;
|
||||||
|
private long scaleFactor=1000000;
|
||||||
|
private long rulerScaleFactor=1000000;
|
||||||
|
private long rulerTickMinor = rulerTickMinorC*scaleFactor;
|
||||||
|
private long rulerTickMajor = rulerTickMajorC*scaleFactor;
|
||||||
|
private String unit="";
|
||||||
|
|
||||||
Ruler(Composite parent, int style, int lenght) {
|
Ruler(Composite parent, int style) {
|
||||||
super(parent, style | SWT.DOUBLE_BUFFERED);
|
super(parent, style | SWT.DOUBLE_BUFFERED);
|
||||||
this.length=lenght;
|
this.length=0;
|
||||||
headerBgColor=getDisplay().getSystemColor(SWT.COLOR_WHITE);
|
headerBgColor=getDisplay().getSystemColor(SWT.COLOR_WHITE);
|
||||||
headerFgColor=getDisplay().getSystemColor(SWT.COLOR_BLACK);
|
headerFgColor=getDisplay().getSystemColor(SWT.COLOR_BLACK);
|
||||||
plugin=TxEditorPlugin.getDefault();
|
plugin=TxEditorPlugin.getDefault();
|
||||||
|
@ -71,10 +86,10 @@ public class Ruler extends Composite {
|
||||||
|
|
||||||
void paintControl(PaintEvent e) {
|
void paintControl(PaintEvent e) {
|
||||||
GC gc = e.gc;
|
GC gc = e.gc;
|
||||||
int startMinorIncr = start;
|
long startMinorIncr = start;
|
||||||
int modulo = start % rulerTickMinor;
|
long modulo = start % rulerTickMinor;
|
||||||
startMinorIncr+=rulerTickMinor-modulo;
|
startMinorIncr+=rulerTickMinor-modulo;
|
||||||
int end=start+e.width;
|
long end=start+e.width*scaleFactor;
|
||||||
|
|
||||||
gc.setBackground(getDisplay().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND));
|
gc.setBackground(getDisplay().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND));
|
||||||
gc.fillRectangle(new Rectangle(e.x, e.y, e.width, height));
|
gc.fillRectangle(new Rectangle(e.x, e.y, e.width, height));
|
||||||
|
@ -83,10 +98,10 @@ public class Ruler extends Composite {
|
||||||
gc.setForeground(headerFgColor);
|
gc.setForeground(headerFgColor);
|
||||||
gc.drawLine(0, bottom, e.width, bottom);
|
gc.drawLine(0, bottom, e.width, bottom);
|
||||||
|
|
||||||
for (int tick = startMinorIncr; tick < end; tick += rulerTickMinor) {
|
for (long tick = startMinorIncr; tick < end; tick += rulerTickMinor) {
|
||||||
int x0 = tick-start;
|
int x0 = (int) ((tick-start)/scaleFactor);
|
||||||
if ((tick % rulerTickMajor) == 0) {
|
if ((tick % rulerTickMajor) == 0) {
|
||||||
gc.drawText(Integer.toString(tick), x0, 0);
|
gc.drawText(Double.toString(tick/rulerScaleFactor)+unit, (int) x0, 0);
|
||||||
gc.drawLine(x0, majorTickY, x0, bottom);
|
gc.drawLine(x0, majorTickY, x0, bottom);
|
||||||
} else {
|
} else {
|
||||||
gc.drawLine(x0, tickY, x0, bottom);
|
gc.drawLine(x0, tickY, x0, bottom);
|
||||||
|
@ -99,8 +114,34 @@ public class Ruler extends Composite {
|
||||||
return new Point(0, height);
|
return new Point(0, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setStartPoint(int start) {
|
public void setStartPoint(long l) {
|
||||||
this.start=start;
|
this.start=l;
|
||||||
|
redraw();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setScaleFactor(long scaleFactor) {
|
||||||
|
this.scaleFactor=scaleFactor;
|
||||||
|
if(scaleFactor<1000L){
|
||||||
|
unit="fs";
|
||||||
|
rulerScaleFactor=(long) 1e0;
|
||||||
|
}else if(scaleFactor<1000000L){
|
||||||
|
unit="ps";
|
||||||
|
rulerScaleFactor=(long) 1e3;
|
||||||
|
}else if(scaleFactor<1000000000L){
|
||||||
|
unit="ns";
|
||||||
|
rulerScaleFactor=(long) 1e6;
|
||||||
|
}else if(scaleFactor<1000000000000L){
|
||||||
|
unit="us";
|
||||||
|
rulerScaleFactor=(long) 1e9;
|
||||||
|
}else if(scaleFactor<1000000000000000L){
|
||||||
|
unit="ms";
|
||||||
|
rulerScaleFactor=(long) 1e9;
|
||||||
|
}else{
|
||||||
|
unit="s";
|
||||||
|
rulerScaleFactor=(long) 1e12;
|
||||||
|
}
|
||||||
|
this.rulerTickMinor = rulerTickMinorC*scaleFactor;
|
||||||
|
this.rulerTickMajor = rulerTickMajorC*scaleFactor;
|
||||||
redraw();
|
redraw();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,13 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2014, 2015 MINRES Technologies GmbH and others.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* MINRES Technologies GmbH - initial API and implementation
|
||||||
|
*******************************************************************************/
|
||||||
package com.minres.scviewer.ui.swt;
|
package com.minres.scviewer.ui.swt;
|
||||||
|
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
|
@ -32,7 +42,10 @@ class SignalPainter implements IWaveformPainter {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void paintArea(GC gc, Rectangle area) {
|
public void paintArea(GC gc, Rectangle area) {
|
||||||
gc.setBackground(this.waveCanvas.colors[even?WaveformCanvas.Colors.TRACK_BG_EVEN.ordinal():WaveformCanvas.Colors.TRACK_BG_ODD.ordinal()]);
|
if(waveCanvas.currentWaveformSelection!=null && waveCanvas.currentWaveformSelection.getId()==signal.getId())
|
||||||
|
gc.setBackground(this.waveCanvas.colors[WaveformCanvas.Colors.TRACK_BG_HIGHLITE.ordinal()]);
|
||||||
|
else
|
||||||
|
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(area);
|
gc.fillRectangle(area);
|
||||||
Entry<Long, ? extends ISignalChange> firstChange=signal.getEvents().floorEntry(area.x*this.waveCanvas.getScaleFactor());
|
Entry<Long, ? extends ISignalChange> firstChange=signal.getEvents().floorEntry(area.x*this.waveCanvas.getScaleFactor());
|
||||||
|
@ -128,4 +141,8 @@ class SignalPainter implements IWaveformPainter {
|
||||||
return height;
|
return height;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ISignal<? extends ISignalChange> getSignal() {
|
||||||
|
return signal;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -1,11 +1,24 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2014, 2015 MINRES Technologies GmbH and others.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* MINRES Technologies GmbH - initial API and implementation
|
||||||
|
*******************************************************************************/
|
||||||
package com.minres.scviewer.ui.swt;
|
package com.minres.scviewer.ui.swt;
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Map;
|
import java.util.List;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
|
import java.util.NavigableMap;
|
||||||
|
import java.util.TreeSet;
|
||||||
|
|
||||||
import org.eclipse.swt.SWT;
|
import org.eclipse.swt.SWT;
|
||||||
import org.eclipse.swt.graphics.GC;
|
import org.eclipse.swt.graphics.GC;
|
||||||
|
import org.eclipse.swt.graphics.Point;
|
||||||
import org.eclipse.swt.graphics.Rectangle;
|
import org.eclipse.swt.graphics.Rectangle;
|
||||||
|
|
||||||
import com.minres.scviewer.database.ITx;
|
import com.minres.scviewer.database.ITx;
|
||||||
|
@ -22,6 +35,7 @@ class StreamPainter implements IWaveformPainter{
|
||||||
private int height, upper, txHeight;
|
private int height, upper, txHeight;
|
||||||
private int totalHeight;
|
private int totalHeight;
|
||||||
private boolean even;
|
private boolean even;
|
||||||
|
private TreeSet<ITx> seenTx;
|
||||||
|
|
||||||
public StreamPainter(WaveformCanvas txDisplay, boolean even, int height, ITxStream<? extends ITxEvent> stream) {
|
public StreamPainter(WaveformCanvas txDisplay, boolean even, int height, ITxStream<? extends ITxEvent> stream) {
|
||||||
this.waveCanvas = txDisplay;
|
this.waveCanvas = txDisplay;
|
||||||
|
@ -31,10 +45,15 @@ class StreamPainter implements IWaveformPainter{
|
||||||
this.txHeight=3*this.waveCanvas.getTrackHeight()/5;
|
this.txHeight=3*this.waveCanvas.getTrackHeight()/5;
|
||||||
this.totalHeight=stream.getMaxConcurrency()*this.waveCanvas.getTrackHeight();
|
this.totalHeight=stream.getMaxConcurrency()*this.waveCanvas.getTrackHeight();
|
||||||
this.even=even;
|
this.even=even;
|
||||||
|
this.seenTx=new TreeSet<ITx>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
public void paintArea(GC gc, Rectangle area) {
|
public void paintArea(GC gc, Rectangle area) {
|
||||||
gc.setBackground(this.waveCanvas.colors[even?WaveformCanvas.Colors.TRACK_BG_EVEN.ordinal():WaveformCanvas.Colors.TRACK_BG_ODD.ordinal()]);
|
if(waveCanvas.currentWaveformSelection!=null && waveCanvas.currentWaveformSelection.getId()==stream.getId())
|
||||||
|
gc.setBackground(this.waveCanvas.colors[WaveformCanvas.Colors.TRACK_BG_HIGHLITE.ordinal()]);
|
||||||
|
else
|
||||||
|
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(area);
|
gc.fillRectangle(area);
|
||||||
Entry<Long, ?> firstTx=stream.getEvents().floorEntry(area.x*waveCanvas.getScaleFactor());
|
Entry<Long, ?> firstTx=stream.getEvents().floorEntry(area.x*waveCanvas.getScaleFactor());
|
||||||
|
@ -45,24 +64,42 @@ class StreamPainter implements IWaveformPainter{
|
||||||
} else if(lastTx==null){
|
} else if(lastTx==null){
|
||||||
lastTx=stream.getEvents().lastEntry();
|
lastTx=stream.getEvents().lastEntry();
|
||||||
}
|
}
|
||||||
gc.setForeground(this.waveCanvas.colors[WaveformCanvas.Colors.LINE.ordinal()]);
|
|
||||||
gc.setBackground(this.waveCanvas.colors[WaveformCanvas.Colors.TX_BG.ordinal()]);
|
|
||||||
gc.setFillRule(SWT.FILL_EVEN_ODD);
|
gc.setFillRule(SWT.FILL_EVEN_ODD);
|
||||||
gc.setLineStyle(SWT.LINE_SOLID);
|
gc.setLineStyle(SWT.LINE_SOLID);
|
||||||
gc.setLineWidth(1);
|
gc.setLineWidth(1);
|
||||||
|
gc.setForeground(this.waveCanvas.colors[WaveformCanvas.Colors.LINE.ordinal()]);
|
||||||
for(int y1=area.y+this.waveCanvas.getTrackHeight()/2; y1<area.y+totalHeight; y1+=this.waveCanvas.getTrackHeight())
|
for(int y1=area.y+this.waveCanvas.getTrackHeight()/2; y1<area.y+totalHeight; y1+=this.waveCanvas.getTrackHeight())
|
||||||
gc.drawLine(area.x, y1, area.x+area.width, y1);
|
gc.drawLine(area.x, y1, area.x+area.width, y1);
|
||||||
if(firstTx==lastTx)
|
if(firstTx==lastTx)
|
||||||
for(ITxEvent x:(Collection<? extends ITxEvent>)firstTx.getValue())
|
for(ITxEvent x:(Collection<? extends ITxEvent>)firstTx.getValue())
|
||||||
drawTx(gc, area, x.getTransaction());
|
drawTx(gc, area, x.getTransaction());
|
||||||
else{
|
else{
|
||||||
for(Entry<Long, ?> tx: stream.getEvents().subMap(firstTx.getKey(), true, lastTx.getKey(), true).entrySet())
|
seenTx.clear();
|
||||||
for(ITxEvent x:(Collection<? extends ITxEvent>)tx.getValue())
|
NavigableMap<Long,?> entries = stream.getEvents().subMap(firstTx.getKey(), true, lastTx.getKey(), true);
|
||||||
if(x.getType()==ITxEvent.Type.END) drawTx(gc, area, x.getTransaction());
|
for(Entry<Long, ?> tx: entries.entrySet())
|
||||||
|
for(ITxEvent x:(Collection<? extends ITxEvent>)tx.getValue()){
|
||||||
|
if(x.getType()==ITxEvent.Type.BEGIN)
|
||||||
|
seenTx.add(x.getTransaction());
|
||||||
|
if(x.getType()==ITxEvent.Type.END){
|
||||||
|
drawTx(gc, area, x.getTransaction());
|
||||||
|
seenTx.remove(x.getTransaction());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
for(ITx tx:seenTx){
|
||||||
|
drawTx(gc, area, tx);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void drawTx(GC gc, Rectangle area, ITx tx) {
|
protected void drawTx(GC gc, Rectangle area, ITx tx) {
|
||||||
|
if(waveCanvas.currentSelection!=null && waveCanvas.currentSelection.getId()==tx.getId()){
|
||||||
|
gc.setForeground(this.waveCanvas.colors[WaveformCanvas.Colors.LINE_HIGHLITE.ordinal()]);
|
||||||
|
gc.setBackground(this.waveCanvas.colors[WaveformCanvas.Colors.TX_BG_HIGHLITE.ordinal()]);
|
||||||
|
}else {
|
||||||
|
gc.setForeground(this.waveCanvas.colors[WaveformCanvas.Colors.LINE.ordinal()]);
|
||||||
|
gc.setBackground(this.waveCanvas.colors[WaveformCanvas.Colors.TX_BG.ordinal()]);
|
||||||
|
}
|
||||||
int offset = tx.getConcurrencyIndex()*this.waveCanvas.getTrackHeight();
|
int offset = tx.getConcurrencyIndex()*this.waveCanvas.getTrackHeight();
|
||||||
Rectangle bb = new Rectangle(
|
Rectangle bb = new Rectangle(
|
||||||
(int)(tx.getBeginTime()/this.waveCanvas.getScaleFactor()), area.y+offset+upper,
|
(int)(tx.getBeginTime()/this.waveCanvas.getScaleFactor()), area.y+offset+upper,
|
||||||
|
@ -82,4 +119,26 @@ class StreamPainter implements IWaveformPainter{
|
||||||
return height;
|
return height;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Object getClicked(Point point) {
|
||||||
|
int lane=point.y/waveCanvas.getTrackHeight();
|
||||||
|
Entry<Long, List<ITxEvent>> firstTx=stream.getEvents().floorEntry(point.x*waveCanvas.getScaleFactor());
|
||||||
|
if(firstTx!=null){
|
||||||
|
do {
|
||||||
|
ITx tx = getTxFromEntry(lane, firstTx);
|
||||||
|
if(tx!=null) return tx;
|
||||||
|
firstTx=stream.getEvents().lowerEntry(firstTx.getKey());
|
||||||
|
}while(firstTx!=null);
|
||||||
|
}
|
||||||
|
return stream;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected ITx getTxFromEntry(int lane, Entry<Long, List<ITxEvent>> firstTx) {
|
||||||
|
for(ITxEvent evt:firstTx.getValue()){
|
||||||
|
if(evt.getType()==ITxEvent.Type.BEGIN && evt.getTransaction().getConcurrencyIndex()==lane){
|
||||||
|
return evt.getTransaction();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -1,8 +1,17 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2014, 2015 MINRES Technologies GmbH and others.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* MINRES Technologies GmbH - initial API and implementation
|
||||||
|
*******************************************************************************/
|
||||||
package com.minres.scviewer.ui.swt;
|
package com.minres.scviewer.ui.swt;
|
||||||
|
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
|
|
||||||
import org.eclipse.swt.SWT;
|
|
||||||
import org.eclipse.swt.graphics.GC;
|
import org.eclipse.swt.graphics.GC;
|
||||||
import org.eclipse.swt.graphics.Rectangle;
|
import org.eclipse.swt.graphics.Rectangle;
|
||||||
|
|
||||||
|
|
|
@ -1,21 +1,20 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2012 IT Just working.
|
* Copyright (c) 2014, 2015 MINRES Technologies GmbH and others.
|
||||||
* 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:
|
||||||
* IT Just working - initial API and implementation
|
* MINRES Technologies GmbH - initial API and implementation
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package com.minres.scviewer.ui.swt;
|
package com.minres.scviewer.ui.swt;
|
||||||
|
|
||||||
import java.beans.PropertyChangeEvent;
|
import java.beans.PropertyChangeEvent;
|
||||||
import java.beans.PropertyChangeListener;
|
import java.beans.PropertyChangeListener;
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.NavigableMap;
|
import java.util.Vector;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
import java.util.TreeMap;
|
import java.util.TreeMap;
|
||||||
|
|
||||||
|
@ -33,24 +32,21 @@ import org.eclipse.swt.custom.SashForm;
|
||||||
import org.eclipse.swt.custom.ScrolledComposite;
|
import org.eclipse.swt.custom.ScrolledComposite;
|
||||||
import org.eclipse.swt.events.ControlAdapter;
|
import org.eclipse.swt.events.ControlAdapter;
|
||||||
import org.eclipse.swt.events.ControlEvent;
|
import org.eclipse.swt.events.ControlEvent;
|
||||||
import org.eclipse.swt.events.ControlListener;
|
|
||||||
import org.eclipse.swt.events.DisposeEvent;
|
import org.eclipse.swt.events.DisposeEvent;
|
||||||
import org.eclipse.swt.events.DisposeListener;
|
import org.eclipse.swt.events.DisposeListener;
|
||||||
import org.eclipse.swt.events.MouseEvent;
|
import org.eclipse.swt.events.MouseEvent;
|
||||||
import org.eclipse.swt.events.MouseListener;
|
import org.eclipse.swt.events.MouseListener;
|
||||||
import org.eclipse.swt.events.SelectionAdapter;
|
import org.eclipse.swt.events.SelectionAdapter;
|
||||||
import org.eclipse.swt.events.SelectionEvent;
|
import org.eclipse.swt.events.SelectionEvent;
|
||||||
import org.eclipse.swt.graphics.Color;
|
|
||||||
import org.eclipse.swt.graphics.Font;
|
import org.eclipse.swt.graphics.Font;
|
||||||
|
import org.eclipse.swt.graphics.FontData;
|
||||||
import org.eclipse.swt.graphics.GC;
|
import org.eclipse.swt.graphics.GC;
|
||||||
import org.eclipse.swt.graphics.Point;
|
import org.eclipse.swt.graphics.Point;
|
||||||
import org.eclipse.swt.graphics.RGB;
|
|
||||||
import org.eclipse.swt.graphics.Rectangle;
|
import org.eclipse.swt.graphics.Rectangle;
|
||||||
import org.eclipse.swt.graphics.TextLayout;
|
import org.eclipse.swt.graphics.TextLayout;
|
||||||
import org.eclipse.swt.layout.FillLayout;
|
import org.eclipse.swt.layout.FillLayout;
|
||||||
import org.eclipse.swt.layout.GridData;
|
import org.eclipse.swt.layout.GridData;
|
||||||
import org.eclipse.swt.layout.GridLayout;
|
import org.eclipse.swt.layout.GridLayout;
|
||||||
import org.eclipse.swt.layout.RowLayout;
|
|
||||||
import org.eclipse.swt.widgets.Canvas;
|
import org.eclipse.swt.widgets.Canvas;
|
||||||
import org.eclipse.swt.widgets.Composite;
|
import org.eclipse.swt.widgets.Composite;
|
||||||
import org.eclipse.swt.widgets.Control;
|
import org.eclipse.swt.widgets.Control;
|
||||||
|
@ -68,45 +64,44 @@ import com.minres.scviewer.database.ITx;
|
||||||
import com.minres.scviewer.database.ITxEvent;
|
import com.minres.scviewer.database.ITxEvent;
|
||||||
import com.minres.scviewer.database.ITxStream;
|
import com.minres.scviewer.database.ITxStream;
|
||||||
import com.minres.scviewer.database.IWaveform;
|
import com.minres.scviewer.database.IWaveform;
|
||||||
|
import com.minres.scviewer.database.IWaveformEvent;
|
||||||
import com.minres.scviewer.ui.handler.GotoDirection;
|
import com.minres.scviewer.ui.handler.GotoDirection;
|
||||||
|
|
||||||
public class TxDisplay implements PropertyChangeListener, ISelectionProvider, MouseListener{
|
public class TxDisplay implements PropertyChangeListener, ISelectionProvider, MouseListener{
|
||||||
private ListenerList listeners = new ListenerList();
|
private ListenerList listeners = new ListenerList();
|
||||||
private IWaveform currentStreamSelection;
|
|
||||||
|
private static final String SELECTION="selection";
|
||||||
private ITx currentSelection;
|
private ITx currentSelection;
|
||||||
private IWaveform currentWaveformSelection;
|
private IWaveform<? extends IWaveformEvent> currentWaveformSelection;
|
||||||
|
|
||||||
private ScrolledComposite nameListScrolled;
|
private ScrolledComposite nameListScrolled;
|
||||||
private ScrolledComposite valueListScrolled;
|
private ScrolledComposite valueListScrolled;
|
||||||
|
|
||||||
private Canvas nameList;
|
private Canvas nameList;
|
||||||
private Canvas valueList;
|
private Canvas valueList;
|
||||||
private WaveformCanvas trackList;
|
WaveformCanvas trackList;
|
||||||
|
|
||||||
private Composite top;
|
private Composite top;
|
||||||
ObservableList<IWaveform> streams;
|
|
||||||
|
protected ObservableList<IWaveform<? extends IWaveformEvent>> streams;
|
||||||
|
Vector<CursorPainter> cursorPainters;
|
||||||
|
|
||||||
private Composite trackPane;
|
private Composite trackPane;
|
||||||
private Ruler ruler;
|
private Ruler ruler;
|
||||||
TreeMap<Integer, IWaveform> trackVerticalOffset;
|
TreeMap<Integer, IWaveform<? extends IWaveformEvent>> trackVerticalOffset;
|
||||||
|
HashMap<IWaveform<? extends IWaveformEvent>, String> actualValues;
|
||||||
// private long maxTime=0;
|
// private long maxTime=0;
|
||||||
private Font nameFont;
|
private Font nameFont, nameFontB;
|
||||||
private Font valueFont;
|
|
||||||
|
|
||||||
public TxDisplay(Composite parent) {
|
public TxDisplay(Composite parent) {
|
||||||
trackVerticalOffset = new TreeMap<Integer, IWaveform>();
|
trackVerticalOffset = new TreeMap<Integer, IWaveform<? extends IWaveformEvent>>();
|
||||||
Display d =parent.getDisplay();
|
actualValues= new HashMap<IWaveform<? extends IWaveformEvent>, String>();
|
||||||
parent.addDisposeListener(new DisposeListener() {
|
cursorPainters=new Vector<CursorPainter>();
|
||||||
@Override
|
|
||||||
public void widgetDisposed(DisposeEvent e) {
|
|
||||||
dispose();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
FontDescriptor fontDescriptor = FontDescriptor.createFrom(d.getSystemFont()).setStyle(SWT.BOLD);
|
|
||||||
nameFont = fontDescriptor.createFont(d);
|
|
||||||
valueFont = fontDescriptor.createFont(d);
|
|
||||||
|
|
||||||
streams=new ObservableList<IWaveform>();
|
nameFont = parent.getDisplay().getSystemFont();
|
||||||
|
nameFontB = SWTResourceManager.getBoldFont(nameFont);
|
||||||
|
|
||||||
|
streams=new ObservableList<IWaveform<? extends IWaveformEvent>>();
|
||||||
streams.addPropertyChangeListener(this);
|
streams.addPropertyChangeListener(this);
|
||||||
|
|
||||||
top = new Composite(parent, SWT.NONE);
|
top = new Composite(parent, SWT.NONE);
|
||||||
|
@ -184,13 +179,17 @@ public class TxDisplay implements PropertyChangeListener, ISelectionProvider, Mo
|
||||||
|
|
||||||
trackPane = new Composite(topSash, SWT.NONE);
|
trackPane = new Composite(topSash, SWT.NONE);
|
||||||
trackPane.setLayout(new BorderLayout(0, 0));
|
trackPane.setLayout(new BorderLayout(0, 0));
|
||||||
ruler = new Ruler(trackPane, SWT.NONE, 0);
|
ruler = new Ruler(trackPane, SWT.NONE);
|
||||||
ruler.setLayoutData(BorderLayout.NORTH);
|
ruler.setLayoutData(BorderLayout.NORTH);
|
||||||
|
|
||||||
trackList = new WaveformCanvas(trackPane, SWT.NONE);
|
trackList = new WaveformCanvas(trackPane, SWT.NONE);
|
||||||
trackList.setLayoutData(BorderLayout.CENTER);
|
trackList.setLayoutData(BorderLayout.CENTER);
|
||||||
trackList.streams=streams;
|
trackList.setStreams(streams);
|
||||||
trackList.addTrackPainter(new TrackPainter(trackList));
|
trackList.setRuler(ruler);
|
||||||
|
trackList.addPainter(new TrackPainter(trackList));
|
||||||
|
CursorPainter cp = new CursorPainter(trackList, trackList.getScaleFactor()*10);
|
||||||
|
trackList.addPainter(cp);
|
||||||
|
cursorPainters.add(cp);
|
||||||
trackList.setMaxTime(1);
|
trackList.setMaxTime(1);
|
||||||
trackList.addMouseListener(this);
|
trackList.addMouseListener(this);
|
||||||
|
|
||||||
|
@ -208,11 +207,6 @@ public class TxDisplay implements PropertyChangeListener, ISelectionProvider, Mo
|
||||||
trackList.scrollToY(y);
|
trackList.scrollToY(y);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
trackList.getHorizontalBar().addSelectionListener(new SelectionAdapter() {
|
|
||||||
public void widgetSelected(SelectionEvent e) {
|
|
||||||
ruler.setStartPoint(trackList.getHorizontalBar().getSelection());
|
|
||||||
}
|
|
||||||
});
|
|
||||||
trackList.getVerticalBar().addSelectionListener(new SelectionAdapter() {
|
trackList.getVerticalBar().addSelectionListener(new SelectionAdapter() {
|
||||||
public void widgetSelected(SelectionEvent e) {
|
public void widgetSelected(SelectionEvent e) {
|
||||||
int y = trackList.getVerticalBar().getSelection();
|
int y = trackList.getVerticalBar().getSelection();
|
||||||
|
@ -225,10 +219,6 @@ public class TxDisplay implements PropertyChangeListener, ISelectionProvider, Mo
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
protected void dispose() {
|
|
||||||
nameFont.dispose();
|
|
||||||
valueFont.dispose();
|
|
||||||
}
|
|
||||||
|
|
||||||
private Composite createTextPane(SashForm leftSash, String text) {
|
private Composite createTextPane(SashForm leftSash, String text) {
|
||||||
Composite namePane = new Composite(leftSash, SWT.NONE);
|
Composite namePane = new Composite(leftSash, SWT.NONE);
|
||||||
|
@ -261,40 +251,54 @@ public class TxDisplay implements PropertyChangeListener, ISelectionProvider, Mo
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
protected void updateTracklist() {
|
protected void updateTracklist() {
|
||||||
int yoffs=0;
|
int yoffs=0;
|
||||||
int nameMaxWidth=0;
|
int nameMaxWidth=0;
|
||||||
int valueMaxWidth=0;
|
|
||||||
|
|
||||||
IWaveformPainter painter=null;
|
IWaveformPainter painter=null;
|
||||||
trackVerticalOffset.clear();
|
trackVerticalOffset.clear();
|
||||||
|
actualValues.clear();
|
||||||
trackList.clearAllWavefromPainter();
|
trackList.clearAllWavefromPainter();
|
||||||
boolean even=true;
|
boolean even=true;
|
||||||
TextLayout tl = new TextLayout(trackList.getDisplay());
|
TextLayout tl = new TextLayout(trackList.getDisplay());
|
||||||
for(IWaveform waveform:streams){
|
tl.setFont(nameFontB);
|
||||||
|
for(IWaveform<? extends IWaveformEvent> waveform:streams){
|
||||||
int height=trackList.getTrackHeight();
|
int height=trackList.getTrackHeight();
|
||||||
if(waveform instanceof ITxStream){
|
if(waveform instanceof ITxStream<?>){
|
||||||
height*=((ITxStream)waveform).getMaxConcurrency();
|
height*=((ITxStream<? extends ITxEvent>)waveform).getMaxConcurrency();
|
||||||
painter= new StreamPainter(trackList, even, height, (ITxStream) waveform);
|
painter= new StreamPainter(trackList, even, height, (ITxStream<? extends ITxEvent>) waveform);
|
||||||
|
actualValues.put(waveform, "");
|
||||||
} else if(waveform instanceof ISignal<?>){
|
} else if(waveform instanceof ISignal<?>){
|
||||||
painter= new SignalPainter(trackList, even, height, (ISignal<?>) waveform);
|
painter= new SignalPainter(trackList, even, height, (ISignal<?>) waveform);
|
||||||
|
actualValues.put(waveform, "---");
|
||||||
}
|
}
|
||||||
trackList.addWavefromPainter(yoffs, painter);
|
trackList.addWavefromPainter(yoffs, painter);
|
||||||
trackVerticalOffset.put(yoffs, waveform);
|
trackVerticalOffset.put(yoffs, waveform);
|
||||||
tl.setText(waveform.getFullName());
|
tl.setText(waveform.getFullName());
|
||||||
nameMaxWidth=Math.max(nameMaxWidth, tl.getBounds().width);
|
nameMaxWidth=Math.max(nameMaxWidth, tl.getBounds().width);
|
||||||
valueMaxWidth=nameMaxWidth;
|
|
||||||
yoffs+=height;
|
yoffs+=height;
|
||||||
even=!even;
|
even=!even;
|
||||||
}
|
}
|
||||||
valueList.setSize(nameMaxWidth, yoffs);
|
nameList.setSize(nameMaxWidth+15, yoffs);
|
||||||
nameList.setSize(valueMaxWidth, yoffs);
|
valueList.setSize(calculateValueWidth(), yoffs);
|
||||||
valueList.redraw();
|
|
||||||
nameList.redraw();
|
nameList.redraw();
|
||||||
|
valueList.redraw();
|
||||||
trackList.redraw();
|
trackList.redraw();
|
||||||
top.layout(new Control[]{valueList, nameList, trackList});
|
top.layout(new Control[]{valueList, nameList, trackList});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private int calculateValueWidth() {
|
||||||
|
TextLayout tl = new TextLayout(trackList.getDisplay());
|
||||||
|
tl.setFont(nameFontB);
|
||||||
|
int valueMaxWidth=0;
|
||||||
|
for(String v:actualValues.values()){
|
||||||
|
tl.setText(v);
|
||||||
|
valueMaxWidth=Math.max(valueMaxWidth, tl.getBounds().width);
|
||||||
|
}
|
||||||
|
return valueMaxWidth+15;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addSelectionChangedListener(ISelectionChangedListener listener) {
|
public void addSelectionChangedListener(ISelectionChangedListener listener) {
|
||||||
listeners.add(listener);
|
listeners.add(listener);
|
||||||
|
@ -309,12 +313,13 @@ public class TxDisplay implements PropertyChangeListener, ISelectionProvider, Mo
|
||||||
public ISelection getSelection() {
|
public ISelection getSelection() {
|
||||||
if(currentSelection!=null)
|
if(currentSelection!=null)
|
||||||
return new StructuredSelection(currentSelection);
|
return new StructuredSelection(currentSelection);
|
||||||
else if(currentStreamSelection!=null)
|
else if(currentWaveformSelection!=null)
|
||||||
return new StructuredSelection(currentStreamSelection);
|
return new StructuredSelection(currentWaveformSelection);
|
||||||
else
|
else
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
@Override
|
@Override
|
||||||
public void setSelection(ISelection selection) {
|
public void setSelection(ISelection selection) {
|
||||||
boolean selectionChanged=false;
|
boolean selectionChanged=false;
|
||||||
|
@ -324,9 +329,9 @@ public class TxDisplay implements PropertyChangeListener, ISelectionProvider, Mo
|
||||||
currentSelection=(ITx) sel;
|
currentSelection=(ITx) sel;
|
||||||
currentWaveformSelection = currentSelection.getStream();
|
currentWaveformSelection = currentSelection.getStream();
|
||||||
selectionChanged=true;
|
selectionChanged=true;
|
||||||
} else if(sel instanceof IWaveform && currentStreamSelection!=sel){
|
} else if(sel instanceof IWaveform<?> && currentWaveformSelection!=sel){
|
||||||
currentSelection=null;
|
currentSelection=null;
|
||||||
currentWaveformSelection = (IWaveform) sel;
|
currentWaveformSelection = (IWaveform<? extends IWaveformEvent>) sel;
|
||||||
selectionChanged=true;
|
selectionChanged=true;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -335,6 +340,10 @@ public class TxDisplay implements PropertyChangeListener, ISelectionProvider, Mo
|
||||||
currentWaveformSelection = null;
|
currentWaveformSelection = null;
|
||||||
}
|
}
|
||||||
if(selectionChanged){
|
if(selectionChanged){
|
||||||
|
trackList.setSelected(currentSelection, currentWaveformSelection);
|
||||||
|
nameList.setData(SELECTION, currentWaveformSelection);
|
||||||
|
valueList.redraw();
|
||||||
|
nameList.redraw();
|
||||||
Object[] list = listeners.getListeners();
|
Object[] list = listeners.getListeners();
|
||||||
for (int i = 0; i < list.length; i++) {
|
for (int i = 0; i < list.length; i++) {
|
||||||
((ISelectionChangedListener) list[i]).selectionChanged(new SelectionChangedEvent(this, selection));
|
((ISelectionChangedListener) list[i]).selectionChanged(new SelectionChangedEvent(this, selection));
|
||||||
|
@ -342,21 +351,40 @@ public class TxDisplay implements PropertyChangeListener, ISelectionProvider, Mo
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
public void moveSelection(GotoDirection direction) {
|
public void moveSelection(GotoDirection direction) {
|
||||||
if(currentStreamSelection instanceof ITxStream<?>){
|
if(currentWaveformSelection instanceof ITxStream<?>){
|
||||||
ITxStream<ITxEvent> stream = (ITxStream<ITxEvent>) currentStreamSelection;
|
ITxStream<ITxEvent> stream = (ITxStream<ITxEvent>) currentWaveformSelection;
|
||||||
ITx transaction=null;
|
ITx transaction=null;
|
||||||
if(direction==GotoDirection.NEXT){
|
if(direction==GotoDirection.NEXT){
|
||||||
Entry<Long, Collection<ITxEvent>> entry = stream.getEvents().higherEntry(currentSelection.getBeginTime());
|
Entry<Long, List<ITxEvent>> entry = stream.getEvents().higherEntry(currentSelection.getBeginTime());
|
||||||
if(entry!=null)
|
if(entry!=null)
|
||||||
transaction = entry.getValue().iterator().next().getTransaction();
|
do {
|
||||||
|
for(ITxEvent evt:entry.getValue()){
|
||||||
|
if(evt.getType()==ITxEvent.Type.BEGIN){
|
||||||
|
transaction=evt.getTransaction();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(transaction==null)
|
||||||
|
entry=stream.getEvents().higherEntry(entry.getKey());
|
||||||
|
}while(entry!=null && transaction==null);
|
||||||
}else if(direction==GotoDirection.PREV){
|
}else if(direction==GotoDirection.PREV){
|
||||||
Entry<Long, Collection<ITxEvent>> entry = stream.getEvents().lowerEntry(currentSelection.getBeginTime());
|
Entry<Long, List<ITxEvent>> entry = stream.getEvents().lowerEntry(currentSelection.getBeginTime());
|
||||||
if(entry!=null)
|
if(entry!=null)
|
||||||
transaction = entry.getValue().iterator().next().getTransaction();
|
do {
|
||||||
|
for(ITxEvent evt:entry.getValue()){
|
||||||
|
if(evt.getType()==ITxEvent.Type.BEGIN)
|
||||||
|
transaction=evt.getTransaction();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if(transaction==null)
|
||||||
|
entry=stream.getEvents().lowerEntry(entry.getKey());
|
||||||
|
}while(entry!=null && transaction==null);
|
||||||
}
|
}
|
||||||
if(transaction!=null)
|
if(transaction!=null){
|
||||||
setSelection(new StructuredSelection(transaction));
|
setSelection(new StructuredSelection(transaction));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -367,11 +395,13 @@ public class TxDisplay implements PropertyChangeListener, ISelectionProvider, Mo
|
||||||
@Override
|
@Override
|
||||||
public void mouseDown(MouseEvent e) {
|
public void mouseDown(MouseEvent e) {
|
||||||
if(e.widget==trackList){
|
if(e.widget==trackList){
|
||||||
|
Object o = trackList.getClicked(new Point(e.x, e.y));
|
||||||
}else if(e.widget==valueList){
|
if(o !=null)
|
||||||
|
setSelection(new StructuredSelection(o));
|
||||||
}else if(e.widget==nameList){
|
}else if(e.widget==valueList || e.widget==nameList){
|
||||||
|
Entry<Integer, IWaveform<? extends IWaveformEvent>> entry = trackVerticalOffset.floorEntry(e.y);
|
||||||
|
if(entry!=null)
|
||||||
|
setSelection(new StructuredSelection(entry.getValue()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -379,45 +409,66 @@ public class TxDisplay implements PropertyChangeListener, ISelectionProvider, Mo
|
||||||
public void mouseUp(MouseEvent e) {
|
public void mouseUp(MouseEvent e) {
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<IWaveform> getStreamList(){
|
public List<IWaveform<? extends IWaveformEvent>> getStreamList(){
|
||||||
return streams;
|
return streams;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void paintNames(GC gc, Rectangle rect) {
|
protected void paintNames(GC gc, Rectangle rect) {
|
||||||
if(streams.size()>0){
|
if(streams.size()>0){
|
||||||
|
IWaveform<? extends IWaveformEvent> wave = (IWaveform<? extends IWaveformEvent>) nameList.getData(SELECTION);
|
||||||
Integer firstKey=trackVerticalOffset.floorKey(rect.y);
|
Integer firstKey=trackVerticalOffset.floorKey(rect.y);
|
||||||
if(firstKey==null) firstKey=trackVerticalOffset.firstKey();
|
if(firstKey==null) firstKey=trackVerticalOffset.firstKey();
|
||||||
Integer lastKey = trackVerticalOffset.floorKey(rect.y+rect.height);
|
Integer lastKey = trackVerticalOffset.floorKey(rect.y+rect.height);
|
||||||
Rectangle subArea = new Rectangle(rect.x, 0, rect.width, 0);
|
Rectangle subArea = new Rectangle(rect.x, 0, rect.width, trackList.getTrackHeight());
|
||||||
if(lastKey==firstKey){
|
if(lastKey==firstKey){
|
||||||
drawTextFormat(gc, subArea, firstKey, trackVerticalOffset.get(firstKey).getFullName());
|
IWaveform<? extends IWaveformEvent> w = trackVerticalOffset.get(firstKey);
|
||||||
|
if(w instanceof ITxStream<?>)
|
||||||
|
subArea.height*=((ITxStream<?>)w).getMaxConcurrency();
|
||||||
|
drawTextFormat(gc, subArea, firstKey, w.getFullName(), wave!=null && w.getId()==wave.getId());
|
||||||
}else{
|
}else{
|
||||||
for(Entry<Integer, IWaveform> entry : trackVerticalOffset.subMap(firstKey, true, lastKey, true).entrySet()){
|
for(Entry<Integer, IWaveform<? extends IWaveformEvent>> entry : trackVerticalOffset.subMap(firstKey, true, lastKey, true).entrySet()){
|
||||||
drawTextFormat(gc, subArea, entry.getKey(), entry.getValue().getFullName());
|
IWaveform<? extends IWaveformEvent> w = entry.getValue();
|
||||||
|
subArea.height=trackList.getTrackHeight();
|
||||||
|
if(w instanceof ITxStream<?>)
|
||||||
|
subArea.height*=((ITxStream<?>)w).getMaxConcurrency();
|
||||||
|
drawTextFormat(gc, subArea, entry.getKey(), w.getFullName(), wave!=null && w.getId()==wave.getId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
protected void paintValues(GC gc, Rectangle rect) {
|
protected void paintValues(GC gc, Rectangle rect) {
|
||||||
if(streams.size()>0){
|
if(streams.size()>0){
|
||||||
|
IWaveform<? extends IWaveformEvent> wave = (IWaveform<? extends IWaveformEvent>) nameList.getData(SELECTION);
|
||||||
Integer firstKey=trackVerticalOffset.floorKey(rect.y);
|
Integer firstKey=trackVerticalOffset.floorKey(rect.y);
|
||||||
if(firstKey==null) firstKey=trackVerticalOffset.firstKey();
|
if(firstKey==null) firstKey=trackVerticalOffset.firstKey();
|
||||||
Integer lastKey = trackVerticalOffset.floorKey(rect.y+rect.height);
|
Integer lastKey = trackVerticalOffset.floorKey(rect.y+rect.height);
|
||||||
Rectangle subArea = new Rectangle(rect.x, 0, rect.width, 0);
|
Rectangle subArea = new Rectangle(rect.x, 0, rect.width, trackList.getTrackHeight());
|
||||||
if(lastKey==firstKey){
|
if(lastKey==firstKey){
|
||||||
drawTextFormat(gc, subArea, firstKey, trackVerticalOffset.get(firstKey).getFullName());
|
IWaveform<? extends IWaveformEvent> w = trackVerticalOffset.get(firstKey);
|
||||||
|
if(w instanceof ITxStream<?>)
|
||||||
|
subArea.height*=((ITxStream<?>)w).getMaxConcurrency();
|
||||||
|
drawTextFormat(gc, subArea, firstKey, actualValues.get(w), wave!=null && w.getId()==wave.getId());
|
||||||
}else{
|
}else{
|
||||||
for(Entry<Integer, IWaveform> entry : trackVerticalOffset.subMap(firstKey, true, lastKey, true).entrySet()){
|
for(Entry<Integer, IWaveform<? extends IWaveformEvent>> entry : trackVerticalOffset.subMap(firstKey, true, lastKey, true).entrySet()){
|
||||||
drawTextFormat(gc, subArea, entry.getKey(), "---");
|
IWaveform<? extends IWaveformEvent> w = entry.getValue();
|
||||||
|
subArea.height=trackList.getTrackHeight();
|
||||||
|
if(w instanceof ITxStream<?>)
|
||||||
|
subArea.height*=((ITxStream<?>)w).getMaxConcurrency();
|
||||||
|
drawTextFormat(gc, subArea, entry.getKey(), actualValues.get(w), wave!=null && w.getId()==wave.getId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void drawTextFormat(GC gc, Rectangle subArea, int yOffset, String p) {
|
protected void drawTextFormat(GC gc, Rectangle subArea, int yOffset, String value, boolean highlite) {
|
||||||
Point size = gc.textExtent(p);
|
Point size = gc.textExtent(value);
|
||||||
gc.drawText(p, subArea.x, subArea.y + yOffset+(trackList.getTrackHeight()-size.y)/2, true);
|
if(highlite)
|
||||||
|
gc.setFont(nameFontB);
|
||||||
|
else
|
||||||
|
gc.setFont(nameFont);
|
||||||
|
gc.drawText(value, subArea.x+5, subArea.y + yOffset+(trackList.getTrackHeight()-size.y)/2, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public long getMaxTime() {
|
public long getMaxTime() {
|
||||||
|
@ -428,4 +479,14 @@ public class TxDisplay implements PropertyChangeListener, ISelectionProvider, Mo
|
||||||
this.trackList.setMaxTime(maxTime);
|
this.trackList.setMaxTime(maxTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setZoomLevel(int scale) {
|
||||||
|
trackList.setZoomLevel(scale);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getZoomLevel() {
|
||||||
|
return trackList.getZoomLevel();
|
||||||
|
}
|
||||||
|
// public long getScaleFactor(){
|
||||||
|
// return trackList.getScaleFactor();
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2015 MINRES Technologies GmbH.
|
* Copyright (c) 2014, 2015 MINRES Technologies GmbH and others.
|
||||||
* 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
|
||||||
|
@ -10,11 +10,10 @@
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package com.minres.scviewer.ui.swt;
|
package com.minres.scviewer.ui.swt;
|
||||||
|
|
||||||
import java.awt.geom.AffineTransform;
|
|
||||||
import java.awt.geom.Point2D;
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map.Entry;
|
||||||
import java.util.TreeMap;
|
import java.util.TreeMap;
|
||||||
|
|
||||||
import org.eclipse.swt.SWT;
|
import org.eclipse.swt.SWT;
|
||||||
|
@ -26,11 +25,9 @@ import org.eclipse.swt.events.SelectionAdapter;
|
||||||
import org.eclipse.swt.events.SelectionEvent;
|
import org.eclipse.swt.events.SelectionEvent;
|
||||||
import org.eclipse.swt.graphics.Color;
|
import org.eclipse.swt.graphics.Color;
|
||||||
import org.eclipse.swt.graphics.GC;
|
import org.eclipse.swt.graphics.GC;
|
||||||
import org.eclipse.swt.graphics.Image;
|
|
||||||
import org.eclipse.swt.graphics.Point;
|
import org.eclipse.swt.graphics.Point;
|
||||||
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.graphics.Region;
|
|
||||||
import org.eclipse.swt.graphics.Transform;
|
import org.eclipse.swt.graphics.Transform;
|
||||||
import org.eclipse.swt.widgets.Canvas;
|
import org.eclipse.swt.widgets.Canvas;
|
||||||
import org.eclipse.swt.widgets.Composite;
|
import org.eclipse.swt.widgets.Composite;
|
||||||
|
@ -38,7 +35,10 @@ import org.eclipse.swt.widgets.Display;
|
||||||
import org.eclipse.swt.widgets.ScrollBar;
|
import org.eclipse.swt.widgets.ScrollBar;
|
||||||
import org.eclipse.wb.swt.SWTResourceManager;
|
import org.eclipse.wb.swt.SWTResourceManager;
|
||||||
|
|
||||||
|
import com.google.common.collect.Lists;
|
||||||
|
import com.minres.scviewer.database.ITx;
|
||||||
import com.minres.scviewer.database.IWaveform;
|
import com.minres.scviewer.database.IWaveform;
|
||||||
|
import com.minres.scviewer.database.IWaveformEvent;
|
||||||
|
|
||||||
public class WaveformCanvas extends Canvas {
|
public class WaveformCanvas extends Canvas {
|
||||||
public enum Colors {
|
public enum Colors {
|
||||||
|
@ -54,25 +54,27 @@ public class WaveformCanvas extends Canvas {
|
||||||
SIGNAL1,
|
SIGNAL1,
|
||||||
SIGNALZ,
|
SIGNALZ,
|
||||||
SIGNALX,
|
SIGNALX,
|
||||||
SIGNAL_TEXT
|
SIGNAL_TEXT,
|
||||||
|
CURSOR
|
||||||
}
|
}
|
||||||
|
|
||||||
Color[] colors=new Color[Colors.values().length];
|
Color[] colors=new Color[Colors.values().length];
|
||||||
|
|
||||||
/* zooming rates in x and y direction are equal.*/
|
|
||||||
final float ZOOMIN_RATE = 1.1f; /* zoomin rate */
|
|
||||||
final float ZOOMOUT_RATE = 0.9f; /* zoomout rate */
|
|
||||||
|
|
||||||
private int trackHeight = 50;
|
private int trackHeight = 50;
|
||||||
private long scaleFactor = 1000000L;
|
private long scaleFactor = 1000000L;
|
||||||
|
private int level=6;
|
||||||
private long maxTime;
|
private long maxTime;
|
||||||
|
|
||||||
protected Point origin; /* original size */
|
protected Point origin; /* original size */
|
||||||
protected Transform transform;
|
protected Transform transform;
|
||||||
|
protected Ruler ruler;
|
||||||
protected List<IPainter> painterList;
|
protected List<IPainter> painterList;
|
||||||
TreeMap<Integer, IWaveformPainter> trackVerticalOffset;
|
TreeMap<Integer, IWaveformPainter> trackVerticalOffset;
|
||||||
List<IWaveform> streams;
|
|
||||||
|
protected List<IWaveform<? extends IWaveformEvent>> streams;
|
||||||
|
|
||||||
|
ITx currentSelection;
|
||||||
|
IWaveform<? extends IWaveformEvent> currentWaveformSelection;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor for ScrollableCanvas.
|
* Constructor for ScrollableCanvas.
|
||||||
|
@ -112,8 +114,8 @@ public class WaveformCanvas extends Canvas {
|
||||||
colors[Colors.LINE.ordinal()]=SWTResourceManager.getColor(SWT.COLOR_RED);
|
colors[Colors.LINE.ordinal()]=SWTResourceManager.getColor(SWT.COLOR_RED);
|
||||||
colors[Colors.LINE_HIGHLITE.ordinal()]=SWTResourceManager.getColor(SWT.COLOR_CYAN);
|
colors[Colors.LINE_HIGHLITE.ordinal()]=SWTResourceManager.getColor(SWT.COLOR_CYAN);
|
||||||
colors[Colors.TRACK_BG_EVEN.ordinal()]=SWTResourceManager.getColor(SWT.COLOR_BLACK);
|
colors[Colors.TRACK_BG_EVEN.ordinal()]=SWTResourceManager.getColor(SWT.COLOR_BLACK);
|
||||||
colors[Colors.TRACK_BG_ODD.ordinal()]=SWTResourceManager.getColor(25,25,25);
|
colors[Colors.TRACK_BG_ODD.ordinal()]=SWTResourceManager.getColor(40,40,40);
|
||||||
colors[Colors.TRACK_BG_HIGHLITE.ordinal()]=SWTResourceManager.getColor(SWT.COLOR_GRAY);
|
colors[Colors.TRACK_BG_HIGHLITE.ordinal()]=SWTResourceManager.getColor(40,40,80);
|
||||||
colors[Colors.TX_BG.ordinal()]=SWTResourceManager.getColor(SWT.COLOR_GREEN);
|
colors[Colors.TX_BG.ordinal()]=SWTResourceManager.getColor(SWT.COLOR_GREEN);
|
||||||
colors[Colors.TX_BG_HIGHLITE.ordinal()]=SWTResourceManager.getColor(SWT.COLOR_DARK_GREEN);
|
colors[Colors.TX_BG_HIGHLITE.ordinal()]=SWTResourceManager.getColor(SWT.COLOR_DARK_GREEN);
|
||||||
colors[Colors.TX_BORDER.ordinal()]=SWTResourceManager.getColor(SWT.COLOR_RED);
|
colors[Colors.TX_BORDER.ordinal()]=SWTResourceManager.getColor(SWT.COLOR_RED);
|
||||||
|
@ -122,9 +124,30 @@ public class WaveformCanvas extends Canvas {
|
||||||
colors[Colors.SIGNALZ.ordinal()]=SWTResourceManager.getColor(SWT.COLOR_GRAY);
|
colors[Colors.SIGNALZ.ordinal()]=SWTResourceManager.getColor(SWT.COLOR_GRAY);
|
||||||
colors[Colors.SIGNALX.ordinal()]=SWTResourceManager.getColor(SWT.COLOR_RED);
|
colors[Colors.SIGNALX.ordinal()]=SWTResourceManager.getColor(SWT.COLOR_RED);
|
||||||
colors[Colors.SIGNAL_TEXT.ordinal()]=SWTResourceManager.getColor(SWT.COLOR_WHITE);
|
colors[Colors.SIGNAL_TEXT.ordinal()]=SWTResourceManager.getColor(SWT.COLOR_WHITE);
|
||||||
|
colors[Colors.CURSOR.ordinal()]=SWTResourceManager.getColor(SWT.COLOR_DARK_RED);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<IWaveform<? extends IWaveformEvent>> getStreams() {
|
||||||
|
return streams;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStreams(List<IWaveform<? extends IWaveformEvent>> streams) {
|
||||||
|
this.streams = streams;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Ruler getRuler(){
|
||||||
|
return ruler;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRuler(Ruler ruler) {
|
||||||
|
this.ruler=ruler;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Object getOrigin() {
|
||||||
|
return origin;
|
||||||
|
}
|
||||||
|
|
||||||
public long getMaxTime() {
|
public long getMaxTime() {
|
||||||
return maxTime;
|
return maxTime;
|
||||||
}
|
}
|
||||||
|
@ -143,20 +166,27 @@ public class WaveformCanvas extends Canvas {
|
||||||
syncScrollBars();
|
syncScrollBars();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setZoomLevel(int level) {
|
||||||
|
this.level=level;
|
||||||
|
this.scaleFactor = (long) Math.pow(10, level);
|
||||||
|
if(ruler!=null) ruler.setStartPoint(-origin.x*scaleFactor);
|
||||||
|
syncScrollBars();
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getZoomLevel() {
|
||||||
|
return level;
|
||||||
|
}
|
||||||
|
|
||||||
public long getScaleFactor() {
|
public long getScaleFactor() {
|
||||||
return scaleFactor;
|
return scaleFactor;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setScaleFactor(long scaleFactor) {
|
public void addPainter(IPainter painter) {
|
||||||
this.scaleFactor = scaleFactor;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void addTrackPainter(IPainter painter) {
|
|
||||||
painterList.add(painter);
|
painterList.add(painter);
|
||||||
redraw();
|
redraw();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void removeTrackPainter(IPainter painter){
|
public void removePainter(IPainter painter){
|
||||||
painterList.remove(painter);
|
painterList.remove(painter);
|
||||||
redraw();
|
redraw();
|
||||||
}
|
}
|
||||||
|
@ -196,6 +226,7 @@ public class WaveformCanvas extends Canvas {
|
||||||
private void scrollHorizontally(ScrollBar scrollBar) {
|
private void scrollHorizontally(ScrollBar scrollBar) {
|
||||||
if (painterList.size()==0) return;
|
if (painterList.size()==0) return;
|
||||||
origin.x= -scrollBar.getSelection();
|
origin.x= -scrollBar.getSelection();
|
||||||
|
if(ruler!=null) ruler.setStartPoint(-origin.x*scaleFactor);
|
||||||
syncScrollBars();
|
syncScrollBars();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -271,6 +302,7 @@ public class WaveformCanvas extends Canvas {
|
||||||
}
|
}
|
||||||
vertical.setSelection(-origin.y);
|
vertical.setSelection(-origin.y);
|
||||||
vertical.setThumb(ch);
|
vertical.setThumb(ch);
|
||||||
|
ruler.setScaleFactor(scaleFactor);
|
||||||
redraw();
|
redraw();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -294,4 +326,43 @@ public class WaveformCanvas extends Canvas {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Object getClicked(Point point) {
|
||||||
|
for(IPainter p:Lists.reverse(painterList)){
|
||||||
|
if(p instanceof TrackPainter){
|
||||||
|
int y= point.y-origin.y;
|
||||||
|
int x=point.x-origin.x;
|
||||||
|
Entry<Integer, IWaveformPainter> entry = trackVerticalOffset.floorEntry(y);
|
||||||
|
if(entry!=null){
|
||||||
|
if(entry.getValue() instanceof StreamPainter){
|
||||||
|
return ((StreamPainter)entry.getValue()).getClicked(new Point(x,y-entry.getKey()));
|
||||||
|
}else if(entry.getValue() instanceof SignalPainter)
|
||||||
|
return ((SignalPainter)entry.getValue()).getSignal();
|
||||||
|
}
|
||||||
|
}else if(p instanceof CursorPainter){
|
||||||
|
if(Math.abs(point.x*scaleFactor-((CursorPainter)p).getTime())<2){
|
||||||
|
return p;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSelected(ITx currentSelection, IWaveform<? extends IWaveformEvent> currentWaveformSelection) {
|
||||||
|
this.currentSelection=currentSelection;
|
||||||
|
this.currentWaveformSelection=currentWaveformSelection;
|
||||||
|
if(currentSelection!=null) reveal(currentSelection.getBeginTime(), currentSelection.getEndTime());
|
||||||
|
redraw();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void reveal(Long beginTime, Long endTime) {
|
||||||
|
int lower = (int) (beginTime/scaleFactor);
|
||||||
|
int higher=(int) (endTime/scaleFactor);
|
||||||
|
Point size = getSize();
|
||||||
|
if(lower<-origin.x){
|
||||||
|
scrollToX(lower);
|
||||||
|
} else if(higher>(size.x-origin.x)){
|
||||||
|
scrollToX(higher-size.x);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2012 IT Just working.
|
* Copyright (c) 2014, 2015 MINRES Technologies GmbH and others.
|
||||||
* 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:
|
||||||
* IT Just working - initial API and implementation
|
* MINRES Technologies GmbH - initial API and implementation
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package com.minres.scviewer.ui.views;
|
package com.minres.scviewer.ui.views;
|
||||||
|
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2012 IT Just working.
|
* Copyright (c) 2014, 2015 MINRES Technologies GmbH and others.
|
||||||
* 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:
|
||||||
* IT Just working - initial API and implementation
|
* MINRES Technologies GmbH - initial API and implementation
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package com.minres.scviewer.ui.views;
|
package com.minres.scviewer.ui.views;
|
||||||
|
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2012 IT Just working.
|
* Copyright (c) 2014, 2015 MINRES Technologies GmbH and others.
|
||||||
* 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:
|
||||||
* IT Just working - initial API and implementation
|
* MINRES Technologies GmbH - initial API and implementation
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package com.minres.scviewer.ui.views;
|
package com.minres.scviewer.ui.views;
|
||||||
|
|
||||||
|
@ -27,20 +27,16 @@ import org.eclipse.jface.viewers.TreeViewer;
|
||||||
import org.eclipse.swt.widgets.Composite;
|
import org.eclipse.swt.widgets.Composite;
|
||||||
import org.eclipse.swt.widgets.Control;
|
import org.eclipse.swt.widgets.Control;
|
||||||
import org.eclipse.swt.widgets.Menu;
|
import org.eclipse.swt.widgets.Menu;
|
||||||
import org.eclipse.ui.IActionBars;
|
|
||||||
import org.eclipse.ui.ISelectionListener;
|
import org.eclipse.ui.ISelectionListener;
|
||||||
import org.eclipse.ui.ISharedImages;
|
import org.eclipse.ui.ISharedImages;
|
||||||
import org.eclipse.ui.IWorkbenchPart;
|
import org.eclipse.ui.IWorkbenchPart;
|
||||||
import org.eclipse.ui.PlatformUI;
|
import org.eclipse.ui.PlatformUI;
|
||||||
import org.eclipse.ui.actions.ActionFactory;
|
|
||||||
import org.eclipse.ui.part.IPageSite;
|
import org.eclipse.ui.part.IPageSite;
|
||||||
import org.eclipse.ui.views.contentoutline.ContentOutline;
|
|
||||||
import org.eclipse.ui.views.contentoutline.ContentOutlinePage;
|
import org.eclipse.ui.views.contentoutline.ContentOutlinePage;
|
||||||
|
|
||||||
import com.minres.scviewer.database.IHierNode;
|
import com.minres.scviewer.database.IHierNode;
|
||||||
import com.minres.scviewer.database.ITxStream;
|
|
||||||
import com.minres.scviewer.database.ITx;
|
|
||||||
import com.minres.scviewer.database.IWaveform;
|
import com.minres.scviewer.database.IWaveform;
|
||||||
|
import com.minres.scviewer.database.IWaveformEvent;
|
||||||
import com.minres.scviewer.ui.TxEditorPart;
|
import com.minres.scviewer.ui.TxEditorPart;
|
||||||
import com.minres.scviewer.ui.views.provider.TxDbTreeContentProvider;
|
import com.minres.scviewer.ui.views.provider.TxDbTreeContentProvider;
|
||||||
import com.minres.scviewer.ui.views.provider.TxDbTreeLabelProvider;
|
import com.minres.scviewer.ui.views.provider.TxDbTreeLabelProvider;
|
||||||
|
@ -119,7 +115,7 @@ public class TxOutlinePage extends ContentOutlinePage implements ISelectionList
|
||||||
*/
|
*/
|
||||||
public void init(IPageSite pageSite) {
|
public void init(IPageSite pageSite) {
|
||||||
super.init(pageSite);
|
super.init(pageSite);
|
||||||
IActionBars bars = pageSite.getActionBars();
|
// IActionBars bars = pageSite.getActionBars();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void fillContextMenu(IMenuManager menuMgr) {
|
private void fillContextMenu(IMenuManager menuMgr) {
|
||||||
|
@ -181,21 +177,22 @@ public class TxOutlinePage extends ContentOutlinePage implements ISelectionList
|
||||||
|
|
||||||
private Action makeStreamAction(String text, String imgDescriptor, final IStructuredSelection selection, boolean enabled, final boolean remove) {
|
private Action makeStreamAction(String text, String imgDescriptor, final IStructuredSelection selection, boolean enabled, final boolean remove) {
|
||||||
Action action = new Action() {
|
Action action = new Action() {
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
public void run() {
|
public void run() {
|
||||||
if(selection!=null)
|
if(selection!=null)
|
||||||
for(Object obj :selection.toArray()){
|
for(Object obj :selection.toArray()){
|
||||||
if(obj instanceof IWaveform){
|
if(obj instanceof IWaveform){
|
||||||
if(remove)
|
if(remove)
|
||||||
editor.removeStreamFromList((IWaveform) obj);
|
editor.removeStreamFromList((IWaveform<? extends IWaveformEvent>) obj);
|
||||||
else
|
else
|
||||||
editor.addStreamToList((IWaveform) obj);
|
editor.addStreamToList((IWaveform<? extends IWaveformEvent>) obj);
|
||||||
} else if(obj instanceof IHierNode){
|
} else if(obj instanceof IHierNode){
|
||||||
LinkedList<IHierNode> queue = new LinkedList<IHierNode>();
|
LinkedList<IHierNode> queue = new LinkedList<IHierNode>();
|
||||||
LinkedList<IWaveform> streams = new LinkedList<IWaveform>();
|
LinkedList<IWaveform<? extends IWaveformEvent>> streams = new LinkedList<IWaveform<? extends IWaveformEvent>>();
|
||||||
queue.add((IHierNode)obj);
|
queue.add((IHierNode)obj);
|
||||||
while(queue.size()>0){
|
while(queue.size()>0){
|
||||||
IHierNode n = queue.poll();
|
IHierNode n = queue.poll();
|
||||||
if(n instanceof IWaveform) streams.add((IWaveform) n);
|
if(n instanceof IWaveform) streams.add((IWaveform<? extends IWaveformEvent>) n);
|
||||||
queue.addAll(n.getChildNodes());
|
queue.addAll(n.getChildNodes());
|
||||||
}
|
}
|
||||||
if(remove)
|
if(remove)
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2012 IT Just working.
|
* Copyright (c) 2014, 2015 MINRES Technologies GmbH and others.
|
||||||
* 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:
|
||||||
* IT Just working - initial API and implementation
|
* MINRES Technologies GmbH - initial API and implementation
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package com.minres.scviewer.ui.views.provider;
|
package com.minres.scviewer.ui.views.provider;
|
||||||
|
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2012 IT Just working.
|
* Copyright (c) 2014, 2015 MINRES Technologies GmbH and others.
|
||||||
* 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:
|
||||||
* IT Just working - initial API and implementation
|
* MINRES Technologies GmbH - initial API and implementation
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package com.minres.scviewer.ui.views.provider;
|
package com.minres.scviewer.ui.views.provider;
|
||||||
|
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2012 IT Just working.
|
* Copyright (c) 2014, 2015 MINRES Technologies GmbH and others.
|
||||||
* 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:
|
||||||
* IT Just working - initial API and implementation
|
* MINRES Technologies GmbH - initial API and implementation
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package com.minres.scviewer.ui.views.sections;
|
package com.minres.scviewer.ui.views.sections;
|
||||||
|
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2012 IT Just working.
|
* Copyright (c) 2014, 2015 MINRES Technologies GmbH and others.
|
||||||
* 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:
|
||||||
* IT Just working - initial API and implementation
|
* MINRES Technologies GmbH - initial API and implementation
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package com.minres.scviewer.ui.views.sections;
|
package com.minres.scviewer.ui.views.sections;
|
||||||
|
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2011 Google, Inc.
|
* Copyright (c) 2014, 2015 MINRES Technologies GmbH and others.
|
||||||
* 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:
|
||||||
* Google, Inc. - initial API and implementation
|
* MINRES Technologies GmbH - initial API and implementation
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.wb.swt;
|
package org.eclipse.wb.swt;
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,13 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2014, 2015 MINRES Technologies GmbH and others.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* MINRES Technologies GmbH - initial API and implementation
|
||||||
|
*******************************************************************************/
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
Loading…
Reference in New Issue