Merge branch 'feature/database_refactor' into develop
This commit is contained in:
		@@ -2,7 +2,7 @@
 | 
				
			|||||||
<feature
 | 
					<feature
 | 
				
			||||||
      id="com.minres.scviewer.database.feature"
 | 
					      id="com.minres.scviewer.database.feature"
 | 
				
			||||||
      label="%featureName"
 | 
					      label="%featureName"
 | 
				
			||||||
      version="1.0.0.qualifier"
 | 
					      version="2.0.0.qualifier"
 | 
				
			||||||
      provider-name="%providerName">
 | 
					      provider-name="%providerName">
 | 
				
			||||||
 | 
					
 | 
				
			||||||
   <description>
 | 
					   <description>
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -8,5 +8,5 @@
 | 
				
			|||||||
  	<version>2.0.0-SNAPSHOT</version>
 | 
					  	<version>2.0.0-SNAPSHOT</version>
 | 
				
			||||||
	<relativePath>../..</relativePath>
 | 
						<relativePath>../..</relativePath>
 | 
				
			||||||
  </parent>
 | 
					  </parent>
 | 
				
			||||||
  <version>1.0.0-SNAPSHOT</version>
 | 
					  <version>2.0.0-SNAPSHOT</version>
 | 
				
			||||||
</project>
 | 
					</project>
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -2,7 +2,7 @@
 | 
				
			|||||||
<feature
 | 
					<feature
 | 
				
			||||||
      id="com.minres.scviewer.e4.feature"
 | 
					      id="com.minres.scviewer.e4.feature"
 | 
				
			||||||
      label="SCViewer Feature"
 | 
					      label="SCViewer Feature"
 | 
				
			||||||
      version="1.0.0.qualifier"
 | 
					      version="1.1.0.qualifier"
 | 
				
			||||||
      provider-name="MINRES Technologies GmbH">
 | 
					      provider-name="MINRES Technologies GmbH">
 | 
				
			||||||
 | 
					
 | 
				
			||||||
   <description url="http://www.example.com/description">
 | 
					   <description url="http://www.example.com/description">
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -8,5 +8,5 @@
 | 
				
			|||||||
  	<version>2.0.0-SNAPSHOT</version>
 | 
					  	<version>2.0.0-SNAPSHOT</version>
 | 
				
			||||||
	<relativePath>../..</relativePath>
 | 
						<relativePath>../..</relativePath>
 | 
				
			||||||
  </parent>
 | 
					  </parent>
 | 
				
			||||||
  <version>1.0.0-SNAPSHOT</version>
 | 
					  <version>1.1.0-SNAPSHOT</version>
 | 
				
			||||||
</project>
 | 
					</project>
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -2,7 +2,7 @@
 | 
				
			|||||||
<feature
 | 
					<feature
 | 
				
			||||||
      id="com.minres.scviewer.feature"
 | 
					      id="com.minres.scviewer.feature"
 | 
				
			||||||
      label="%featureName"
 | 
					      label="%featureName"
 | 
				
			||||||
      version="1.0.0.qualifier"
 | 
					      version="1.1.0.qualifier"
 | 
				
			||||||
      provider-name="%providerName">
 | 
					      provider-name="%providerName">
 | 
				
			||||||
 | 
					
 | 
				
			||||||
   <description>
 | 
					   <description>
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -8,5 +8,5 @@
 | 
				
			|||||||
  	<version>2.0.0-SNAPSHOT</version>
 | 
					  	<version>2.0.0-SNAPSHOT</version>
 | 
				
			||||||
	<relativePath>../..</relativePath>
 | 
						<relativePath>../..</relativePath>
 | 
				
			||||||
  </parent>
 | 
					  </parent>
 | 
				
			||||||
  <version>1.0.0-SNAPSHOT</version>
 | 
					  <version>1.1.0-SNAPSHOT</version>
 | 
				
			||||||
</project>
 | 
					</project>
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -2,7 +2,7 @@
 | 
				
			|||||||
<feature
 | 
					<feature
 | 
				
			||||||
      id="com.minres.scviewer.ui.feature"
 | 
					      id="com.minres.scviewer.ui.feature"
 | 
				
			||||||
      label="SCViewer UI"
 | 
					      label="SCViewer UI"
 | 
				
			||||||
      version="1.0.0.qualifier"
 | 
					      version="1.1.0.qualifier"
 | 
				
			||||||
      provider-name="MINRES Technologies GmbH">
 | 
					      provider-name="MINRES Technologies GmbH">
 | 
				
			||||||
 | 
					
 | 
				
			||||||
   <description url="http://www.example.com/description">
 | 
					   <description url="http://www.example.com/description">
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -8,5 +8,5 @@
 | 
				
			|||||||
  	<version>2.0.0-SNAPSHOT</version>
 | 
					  	<version>2.0.0-SNAPSHOT</version>
 | 
				
			||||||
	<relativePath>../..</relativePath>
 | 
						<relativePath>../..</relativePath>
 | 
				
			||||||
  </parent>
 | 
					  </parent>
 | 
				
			||||||
  <version>1.0.0-SNAPSHOT</version>
 | 
					  <version>1.1.0-SNAPSHOT</version>
 | 
				
			||||||
</project>
 | 
					</project>
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,11 +1,11 @@
 | 
				
			|||||||
<?xml version="1.0" encoding="UTF-8"?>
 | 
					<?xml version="1.0" encoding="UTF-8"?>
 | 
				
			||||||
<site>
 | 
					<site>
 | 
				
			||||||
   <feature url="features/com.minres.scviewer.feature_1.0.0.qualifier.jar" id="com.minres.scviewer.feature" version="1.0.0.qualifier">
 | 
					 | 
				
			||||||
      <category name="com.minres.scviewer"/>
 | 
					 | 
				
			||||||
   </feature>
 | 
					 | 
				
			||||||
   <feature id="com.minres.scviewer.e4.feature">
 | 
					   <feature id="com.minres.scviewer.e4.feature">
 | 
				
			||||||
      <category name="com.minres.scviewer.e4"/>
 | 
					      <category name="com.minres.scviewer.e4"/>
 | 
				
			||||||
   </feature>
 | 
					   </feature>
 | 
				
			||||||
 | 
					   <feature id="com.minres.scviewer.feature">
 | 
				
			||||||
 | 
					      <category name="com.minres.scviewer"/>
 | 
				
			||||||
 | 
					   </feature>
 | 
				
			||||||
   <category-def name="com.minres.scviewer" label="SCViewer">
 | 
					   <category-def name="com.minres.scviewer" label="SCViewer">
 | 
				
			||||||
      <description>
 | 
					      <description>
 | 
				
			||||||
         Viewer for SystemC Verification (SCV) library's transaction recording
 | 
					         Viewer for SystemC Verification (SCV) library's transaction recording
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -13,7 +13,6 @@ package com.minres.scviewer.database.sqlite;
 | 
				
			|||||||
import java.beans.IntrospectionException;
 | 
					import java.beans.IntrospectionException;
 | 
				
			||||||
import java.io.File;
 | 
					import java.io.File;
 | 
				
			||||||
import java.io.FileInputStream;
 | 
					import java.io.FileInputStream;
 | 
				
			||||||
import java.io.FileNotFoundException;
 | 
					 | 
				
			||||||
import java.io.IOException;
 | 
					import java.io.IOException;
 | 
				
			||||||
import java.lang.reflect.InvocationTargetException;
 | 
					import java.lang.reflect.InvocationTargetException;
 | 
				
			||||||
import java.sql.SQLException;
 | 
					import java.sql.SQLException;
 | 
				
			||||||
@@ -24,6 +23,7 @@ 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.InputFormatException;
 | 
				
			||||||
import com.minres.scviewer.database.RelationType;
 | 
					import com.minres.scviewer.database.RelationType;
 | 
				
			||||||
import com.minres.scviewer.database.sqlite.db.IDatabase;
 | 
					import com.minres.scviewer.database.sqlite.db.IDatabase;
 | 
				
			||||||
import com.minres.scviewer.database.sqlite.db.SQLiteDatabase;
 | 
					import com.minres.scviewer.database.sqlite.db.SQLiteDatabase;
 | 
				
			||||||
@@ -42,16 +42,13 @@ public class SQLiteDbLoader implements IWaveformDbLoader {
 | 
				
			|||||||
	
 | 
						
 | 
				
			||||||
	private ScvSimProps scvSimProps;
 | 
						private ScvSimProps scvSimProps;
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
	public SQLiteDbLoader() {
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	@Override
 | 
						@Override
 | 
				
			||||||
	public Long getMaxTime() {
 | 
						public Long getMaxTime() {
 | 
				
			||||||
		SQLiteDatabaseSelectHandler<ScvTxEvent> handler = new SQLiteDatabaseSelectHandler<ScvTxEvent>(ScvTxEvent.class,
 | 
							SQLiteDatabaseSelectHandler<ScvTxEvent> handler = new SQLiteDatabaseSelectHandler<>(ScvTxEvent.class,
 | 
				
			||||||
				database, "time = (SELECT MAX(time) FROM ScvTxEvent)");
 | 
									database, "time = (SELECT MAX(time) FROM ScvTxEvent)");
 | 
				
			||||||
		try {
 | 
							try {
 | 
				
			||||||
			List<ScvTxEvent> event = handler.selectObjects();
 | 
								List<ScvTxEvent> event = handler.selectObjects();
 | 
				
			||||||
			if(event.size()>0)
 | 
								if(!event.isEmpty())
 | 
				
			||||||
				return event.get(0).getTime()*scvSimProps.getTime_resolution();
 | 
									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) {
 | 
				
			||||||
@@ -62,8 +59,8 @@ public class SQLiteDbLoader implements IWaveformDbLoader {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	@Override
 | 
						@Override
 | 
				
			||||||
	public Collection<IWaveform> getAllWaves() {
 | 
						public Collection<IWaveform> getAllWaves() {
 | 
				
			||||||
		SQLiteDatabaseSelectHandler<ScvStream> handler = new SQLiteDatabaseSelectHandler<ScvStream>(ScvStream.class, database);
 | 
							SQLiteDatabaseSelectHandler<ScvStream> handler = new SQLiteDatabaseSelectHandler<>(ScvStream.class, database);
 | 
				
			||||||
		List<IWaveform> streams=new ArrayList<IWaveform>();
 | 
							List<IWaveform> streams=new ArrayList<>();
 | 
				
			||||||
		try {
 | 
							try {
 | 
				
			||||||
			for(ScvStream scvStream:handler.selectObjects()){
 | 
								for(ScvStream scvStream:handler.selectObjects()){
 | 
				
			||||||
				TxStream stream = new TxStream(database, db, scvStream);
 | 
									TxStream stream = new TxStream(database, db, scvStream);
 | 
				
			||||||
@@ -72,7 +69,6 @@ public class SQLiteDbLoader implements IWaveformDbLoader {
 | 
				
			|||||||
			}
 | 
								}
 | 
				
			||||||
		} catch (SecurityException | IllegalArgumentException | InstantiationException | IllegalAccessException
 | 
							} catch (SecurityException | IllegalArgumentException | InstantiationException | IllegalAccessException
 | 
				
			||||||
				| InvocationTargetException | SQLException | IntrospectionException e) {
 | 
									| InvocationTargetException | SQLException | IntrospectionException e) {
 | 
				
			||||||
//			e.printStackTrace();
 | 
					 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		return streams;
 | 
							return streams;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
@@ -80,25 +76,21 @@ public class SQLiteDbLoader implements IWaveformDbLoader {
 | 
				
			|||||||
	private byte[] x = "SQLite format 3".getBytes();
 | 
						private byte[] x = "SQLite format 3".getBytes();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	@Override
 | 
						@Override
 | 
				
			||||||
	public boolean load(IWaveformDb db, File file) throws Exception {
 | 
						public boolean load(IWaveformDb db, File file) throws InputFormatException {
 | 
				
			||||||
		if(file.isDirectory() || !file.exists()) return false;
 | 
							if(file.isDirectory() || !file.exists()) return false;
 | 
				
			||||||
		this.db=db;
 | 
							this.db=db;
 | 
				
			||||||
		try {
 | 
							try(FileInputStream fis = new FileInputStream(file)) {
 | 
				
			||||||
			FileInputStream fis = new FileInputStream(file);
 | 
					 | 
				
			||||||
			byte[] buffer = new byte[x.length];
 | 
								byte[] buffer = new byte[x.length];
 | 
				
			||||||
			int read = fis.read(buffer, 0, x.length);
 | 
								int read = fis.read(buffer, 0, x.length);
 | 
				
			||||||
			fis.close();
 | 
					 | 
				
			||||||
			if (read == x.length)
 | 
								if (read == x.length)
 | 
				
			||||||
				for (int i = 0; i < x.length; i++)
 | 
									for (int i = 0; i < x.length; i++)
 | 
				
			||||||
					if (buffer[i] != x[i])	return false;
 | 
										if (buffer[i] != x[i])	return false;
 | 
				
			||||||
		} catch(FileNotFoundException e) {
 | 
							} catch(IOException e) {
 | 
				
			||||||
			return false;
 | 
					 | 
				
			||||||
		} catch(IOException e) { //if an I/O error occurs
 | 
					 | 
				
			||||||
			return false;
 | 
								return false;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		database=new SQLiteDatabase(file.getAbsolutePath());
 | 
							database=new SQLiteDatabase(file.getAbsolutePath());
 | 
				
			||||||
		database.setData("TIMERESOLUTION", 1L);
 | 
							database.setData("TIMERESOLUTION", 1L);
 | 
				
			||||||
		SQLiteDatabaseSelectHandler<ScvSimProps> handler = new SQLiteDatabaseSelectHandler<ScvSimProps>(ScvSimProps.class, database);
 | 
							SQLiteDatabaseSelectHandler<ScvSimProps> handler = new SQLiteDatabaseSelectHandler<>(ScvSimProps.class, database);
 | 
				
			||||||
		try {
 | 
							try {
 | 
				
			||||||
			for(ScvSimProps simProps:handler.selectObjects()){
 | 
								for(ScvSimProps simProps:handler.selectObjects()){
 | 
				
			||||||
				scvSimProps=simProps;
 | 
									scvSimProps=simProps;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -18,12 +18,7 @@ import java.util.Collection;
 | 
				
			|||||||
import java.util.List;
 | 
					import java.util.List;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import com.minres.scviewer.database.AssociationType;
 | 
					import com.minres.scviewer.database.AssociationType;
 | 
				
			||||||
import com.minres.scviewer.database.ITx;
 | 
					import com.minres.scviewer.database.IWaveform;
 | 
				
			||||||
import com.minres.scviewer.database.ITxAttribute;
 | 
					 | 
				
			||||||
import com.minres.scviewer.database.ITxEvent;
 | 
					 | 
				
			||||||
import com.minres.scviewer.database.ITxGenerator;
 | 
					 | 
				
			||||||
import com.minres.scviewer.database.ITxRelation;
 | 
					 | 
				
			||||||
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.ScvStream;
 | 
				
			||||||
@@ -31,6 +26,10 @@ 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;
 | 
				
			||||||
import com.minres.scviewer.database.sqlite.tables.ScvTxRelation;
 | 
					import com.minres.scviewer.database.sqlite.tables.ScvTxRelation;
 | 
				
			||||||
 | 
					import com.minres.scviewer.database.tx.ITx;
 | 
				
			||||||
 | 
					import com.minres.scviewer.database.tx.ITxAttribute;
 | 
				
			||||||
 | 
					import com.minres.scviewer.database.tx.ITxGenerator;
 | 
				
			||||||
 | 
					import com.minres.scviewer.database.tx.ITxRelation;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public class Tx implements ITx {
 | 
					public class Tx implements ITx {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -39,8 +38,10 @@ public class Tx implements ITx {
 | 
				
			|||||||
	private TxGenerator trGenerator;
 | 
						private TxGenerator trGenerator;
 | 
				
			||||||
	private ScvTx scvTx;
 | 
						private ScvTx scvTx;
 | 
				
			||||||
	private List<ITxAttribute> attributes;
 | 
						private List<ITxAttribute> attributes;
 | 
				
			||||||
	private Long begin, end;
 | 
						private Long begin;
 | 
				
			||||||
	private List<ITxRelation> incoming, outgoing;
 | 
						private Long end;
 | 
				
			||||||
 | 
						private List<ITxRelation> incoming;
 | 
				
			||||||
 | 
						private List<ITxRelation> 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;
 | 
				
			||||||
@@ -55,7 +56,7 @@ public class Tx implements ITx {
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	@Override
 | 
						@Override
 | 
				
			||||||
	public ITxStream<ITxEvent> getStream() {
 | 
						public IWaveform getStream() {
 | 
				
			||||||
		return trStream;
 | 
							return trStream;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -72,7 +73,7 @@ public class Tx implements ITx {
 | 
				
			|||||||
	@Override
 | 
						@Override
 | 
				
			||||||
	public Long getBeginTime() {
 | 
						public Long getBeginTime() {
 | 
				
			||||||
		if(begin==null){
 | 
							if(begin==null){
 | 
				
			||||||
		SQLiteDatabaseSelectHandler<ScvTxEvent> handler = new SQLiteDatabaseSelectHandler<ScvTxEvent>(ScvTxEvent.class,
 | 
							SQLiteDatabaseSelectHandler<ScvTxEvent> handler = new SQLiteDatabaseSelectHandler<>(ScvTxEvent.class,
 | 
				
			||||||
				database, "tx="+scvTx.getId()+" AND type="+ AssociationType.BEGIN.ordinal());
 | 
									database, "tx="+scvTx.getId()+" AND type="+ AssociationType.BEGIN.ordinal());
 | 
				
			||||||
		try {
 | 
							try {
 | 
				
			||||||
			for(ScvTxEvent scvEvent:handler.selectObjects()){
 | 
								for(ScvTxEvent scvEvent:handler.selectObjects()){
 | 
				
			||||||
@@ -88,7 +89,7 @@ public class Tx implements ITx {
 | 
				
			|||||||
	@Override
 | 
						@Override
 | 
				
			||||||
	public Long getEndTime() {
 | 
						public Long getEndTime() {
 | 
				
			||||||
		if(end==null){
 | 
							if(end==null){
 | 
				
			||||||
		SQLiteDatabaseSelectHandler<ScvTxEvent> handler = new SQLiteDatabaseSelectHandler<ScvTxEvent>(ScvTxEvent.class,
 | 
							SQLiteDatabaseSelectHandler<ScvTxEvent> handler = new SQLiteDatabaseSelectHandler<>(ScvTxEvent.class,
 | 
				
			||||||
				database, "tx="+scvTx.getId()+" AND type="+ AssociationType.END.ordinal());
 | 
									database, "tx="+scvTx.getId()+" AND type="+ AssociationType.END.ordinal());
 | 
				
			||||||
		try {
 | 
							try {
 | 
				
			||||||
			for(ScvTxEvent scvEvent:handler.selectObjects()){
 | 
								for(ScvTxEvent scvEvent:handler.selectObjects()){
 | 
				
			||||||
@@ -104,10 +105,10 @@ public class Tx implements ITx {
 | 
				
			|||||||
	@Override
 | 
						@Override
 | 
				
			||||||
	public List<ITxAttribute> getAttributes() {
 | 
						public List<ITxAttribute> getAttributes() {
 | 
				
			||||||
		if(attributes==null){
 | 
							if(attributes==null){
 | 
				
			||||||
			SQLiteDatabaseSelectHandler<ScvTxAttribute> handler = new SQLiteDatabaseSelectHandler<ScvTxAttribute>(
 | 
								SQLiteDatabaseSelectHandler<ScvTxAttribute> handler = new SQLiteDatabaseSelectHandler<>(
 | 
				
			||||||
					ScvTxAttribute.class, database, "tx="+scvTx.getId());
 | 
										ScvTxAttribute.class, database, "tx="+scvTx.getId());
 | 
				
			||||||
			try {
 | 
								try {
 | 
				
			||||||
				attributes = new ArrayList<ITxAttribute>();
 | 
									attributes = new ArrayList<>();
 | 
				
			||||||
				for(ScvTxAttribute scvAttribute:handler.selectObjects()){
 | 
									for(ScvTxAttribute scvAttribute:handler.selectObjects()){
 | 
				
			||||||
					attributes.add(new TxAttribute(this, scvAttribute));
 | 
										attributes.add(new TxAttribute(this, scvAttribute));
 | 
				
			||||||
					
 | 
										
 | 
				
			||||||
@@ -122,10 +123,10 @@ public class Tx implements ITx {
 | 
				
			|||||||
	@Override
 | 
						@Override
 | 
				
			||||||
	public Collection<ITxRelation> getIncomingRelations() {
 | 
						public Collection<ITxRelation> getIncomingRelations() {
 | 
				
			||||||
		if(incoming==null){
 | 
							if(incoming==null){
 | 
				
			||||||
			SQLiteDatabaseSelectHandler<ScvTxRelation> handler = new SQLiteDatabaseSelectHandler<ScvTxRelation>(
 | 
								SQLiteDatabaseSelectHandler<ScvTxRelation> handler = new SQLiteDatabaseSelectHandler<>(
 | 
				
			||||||
					ScvTxRelation.class, database, "sink="+scvTx.getId());
 | 
										ScvTxRelation.class, database, "sink="+scvTx.getId());
 | 
				
			||||||
			try {
 | 
								try {
 | 
				
			||||||
				incoming = new ArrayList<ITxRelation>();
 | 
									incoming = new ArrayList<>();
 | 
				
			||||||
				for(ScvTxRelation scvRelation:handler.selectObjects()){
 | 
									for(ScvTxRelation scvRelation:handler.selectObjects()){
 | 
				
			||||||
					incoming.add(createRelation(scvRelation, false));
 | 
										incoming.add(createRelation(scvRelation, false));
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
@@ -139,10 +140,10 @@ public class Tx implements ITx {
 | 
				
			|||||||
	@Override
 | 
						@Override
 | 
				
			||||||
	public Collection<ITxRelation> getOutgoingRelations() {
 | 
						public Collection<ITxRelation> getOutgoingRelations() {
 | 
				
			||||||
		if(outgoing==null){
 | 
							if(outgoing==null){
 | 
				
			||||||
			SQLiteDatabaseSelectHandler<ScvTxRelation> handler = new SQLiteDatabaseSelectHandler<ScvTxRelation>(
 | 
								SQLiteDatabaseSelectHandler<ScvTxRelation> handler = new SQLiteDatabaseSelectHandler<>(
 | 
				
			||||||
					ScvTxRelation.class, database, "src="+scvTx.getId());
 | 
										ScvTxRelation.class, database, "src="+scvTx.getId());
 | 
				
			||||||
			try {
 | 
								try {
 | 
				
			||||||
				outgoing = new ArrayList<ITxRelation>();
 | 
									outgoing = new ArrayList<>();
 | 
				
			||||||
				for(ScvTxRelation scvRelation:handler.selectObjects()){
 | 
									for(ScvTxRelation scvRelation:handler.selectObjects()){
 | 
				
			||||||
					outgoing.add(createRelation(scvRelation, true));
 | 
										outgoing.add(createRelation(scvRelation, true));
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
@@ -155,7 +156,7 @@ public class Tx implements ITx {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	private ITxRelation createRelation(ScvTxRelation rel, boolean outgoing) {
 | 
						private ITxRelation createRelation(ScvTxRelation rel, boolean outgoing) {
 | 
				
			||||||
		int otherId = outgoing?rel.getSink():rel.getSrc();
 | 
							int otherId = outgoing?rel.getSink():rel.getSrc();
 | 
				
			||||||
		SQLiteDatabaseSelectHandler<ScvTx> handler = new SQLiteDatabaseSelectHandler<ScvTx>(ScvTx.class, database,
 | 
							SQLiteDatabaseSelectHandler<ScvTx> handler = new SQLiteDatabaseSelectHandler<>(ScvTx.class, database,
 | 
				
			||||||
				"id="+otherId);
 | 
									"id="+otherId);
 | 
				
			||||||
		try {
 | 
							try {
 | 
				
			||||||
			List<ScvTx> res = handler.selectObjects();
 | 
								List<ScvTx> res = handler.selectObjects();
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -12,8 +12,8 @@ package com.minres.scviewer.database.sqlite;
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
import com.minres.scviewer.database.AssociationType;
 | 
					import com.minres.scviewer.database.AssociationType;
 | 
				
			||||||
import com.minres.scviewer.database.DataType;
 | 
					import com.minres.scviewer.database.DataType;
 | 
				
			||||||
import com.minres.scviewer.database.ITxAttribute;
 | 
					 | 
				
			||||||
import com.minres.scviewer.database.sqlite.tables.ScvTxAttribute;
 | 
					import com.minres.scviewer.database.sqlite.tables.ScvTxAttribute;
 | 
				
			||||||
 | 
					import com.minres.scviewer.database.tx.ITxAttribute;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public class TxAttribute implements ITxAttribute{
 | 
					public class TxAttribute implements ITxAttribute{
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -10,16 +10,18 @@
 | 
				
			|||||||
 *******************************************************************************/
 | 
					 *******************************************************************************/
 | 
				
			||||||
package com.minres.scviewer.database.sqlite;
 | 
					package com.minres.scviewer.database.sqlite;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import com.minres.scviewer.database.ITx;
 | 
					import com.minres.scviewer.database.EventKind;
 | 
				
			||||||
import com.minres.scviewer.database.ITxEvent;
 | 
					import com.minres.scviewer.database.IEvent;
 | 
				
			||||||
import com.minres.scviewer.database.IWaveformEvent;
 | 
					import com.minres.scviewer.database.WaveformType;
 | 
				
			||||||
 | 
					import com.minres.scviewer.database.tx.ITx;
 | 
				
			||||||
 | 
					import com.minres.scviewer.database.tx.ITxEvent;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public class TxEvent implements ITxEvent {
 | 
					public class TxEvent implements ITxEvent {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	private final Type type;
 | 
						private final EventKind type;
 | 
				
			||||||
	private ITx tx;
 | 
						private ITx tx;
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	public TxEvent(Type type, ITx tx) {
 | 
						public TxEvent(EventKind type, ITx tx) {
 | 
				
			||||||
		super();
 | 
							super();
 | 
				
			||||||
		this.type = type;
 | 
							this.type = type;
 | 
				
			||||||
		this.tx = tx;
 | 
							this.tx = tx;
 | 
				
			||||||
@@ -27,26 +29,21 @@ public class TxEvent implements ITxEvent {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	@Override
 | 
						@Override
 | 
				
			||||||
	public Long getTime() {
 | 
						public Long getTime() {
 | 
				
			||||||
		return type==Type.BEGIN?tx.getBeginTime():tx.getEndTime();
 | 
							return type==EventKind.BEGIN?tx.getBeginTime():tx.getEndTime();
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	@Override
 | 
						@Override
 | 
				
			||||||
	public IWaveformEvent duplicate() throws CloneNotSupportedException {
 | 
						public IEvent duplicate() throws CloneNotSupportedException {
 | 
				
			||||||
		return new TxEvent(type, tx);
 | 
							return new TxEvent(type, tx);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	@Override
 | 
					 | 
				
			||||||
	public int compareTo(IWaveformEvent o) {
 | 
					 | 
				
			||||||
		return getTime().compareTo(o.getTime());
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	@Override
 | 
						@Override
 | 
				
			||||||
	public ITx getTransaction() {
 | 
						public ITx getTransaction() {
 | 
				
			||||||
		return tx;
 | 
							return tx;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	@Override
 | 
						@Override
 | 
				
			||||||
	public Type getType() {
 | 
						public EventKind getKind() {
 | 
				
			||||||
		return type;
 | 
							return type;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -54,4 +51,9 @@ public class TxEvent implements ITxEvent {
 | 
				
			|||||||
	public String toString() {
 | 
						public String toString() {
 | 
				
			||||||
		return type.toString()+"@"+getTime()+" of tx #"+tx.getId();
 | 
							return type.toString()+"@"+getTime()+" of tx #"+tx.getId();
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						@Override
 | 
				
			||||||
 | 
						public WaveformType getType() {
 | 
				
			||||||
 | 
							return WaveformType.TRANSACTION;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -10,21 +10,21 @@
 | 
				
			|||||||
 *******************************************************************************/
 | 
					 *******************************************************************************/
 | 
				
			||||||
package com.minres.scviewer.database.sqlite;
 | 
					package com.minres.scviewer.database.sqlite;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import java.util.ArrayList;
 | 
				
			||||||
import java.util.List;
 | 
					import java.util.List;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import com.minres.scviewer.database.ITx;
 | 
					import com.minres.scviewer.database.IWaveform;
 | 
				
			||||||
import com.minres.scviewer.database.ITxEvent;
 | 
					 | 
				
			||||||
import com.minres.scviewer.database.ITxGenerator;
 | 
					 | 
				
			||||||
import com.minres.scviewer.database.ITxStream;
 | 
					 | 
				
			||||||
import com.minres.scviewer.database.sqlite.tables.ScvGenerator;
 | 
					import com.minres.scviewer.database.sqlite.tables.ScvGenerator;
 | 
				
			||||||
 | 
					import com.minres.scviewer.database.tx.ITx;
 | 
				
			||||||
 | 
					import com.minres.scviewer.database.tx.ITxGenerator;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public class TxGenerator implements ITxGenerator {
 | 
					public class TxGenerator implements ITxGenerator {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	private ITxStream<ITxEvent>  stream;
 | 
						private IWaveform  stream;
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	private ScvGenerator scvGenerator;
 | 
						private ScvGenerator scvGenerator;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	public TxGenerator(ITxStream<ITxEvent>  stream, ScvGenerator scvGenerator) {
 | 
						public TxGenerator(IWaveform stream, ScvGenerator scvGenerator) {
 | 
				
			||||||
		this.stream=stream;
 | 
							this.stream=stream;
 | 
				
			||||||
		this.scvGenerator=scvGenerator;
 | 
							this.scvGenerator=scvGenerator;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
@@ -35,7 +35,7 @@ public class TxGenerator implements ITxGenerator {
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	@Override
 | 
						@Override
 | 
				
			||||||
	public ITxStream<ITxEvent> getStream() {
 | 
						public IWaveform getStream() {
 | 
				
			||||||
		return stream;
 | 
							return stream;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -46,7 +46,7 @@ public class TxGenerator implements ITxGenerator {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	@Override
 | 
						@Override
 | 
				
			||||||
	public List<ITx> getTransactions() {
 | 
						public List<ITx> getTransactions() {
 | 
				
			||||||
		return null;
 | 
							return new ArrayList<>();
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -10,14 +10,15 @@
 | 
				
			|||||||
 *******************************************************************************/
 | 
					 *******************************************************************************/
 | 
				
			||||||
package com.minres.scviewer.database.sqlite;
 | 
					package com.minres.scviewer.database.sqlite;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import com.minres.scviewer.database.ITxRelation;
 | 
					 | 
				
			||||||
import com.minres.scviewer.database.ITx;
 | 
					 | 
				
			||||||
import com.minres.scviewer.database.RelationType;
 | 
					import com.minres.scviewer.database.RelationType;
 | 
				
			||||||
 | 
					import com.minres.scviewer.database.tx.ITx;
 | 
				
			||||||
 | 
					import com.minres.scviewer.database.tx.ITxRelation;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public class TxRelation implements ITxRelation {
 | 
					public class TxRelation implements ITxRelation {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	RelationType relationType;
 | 
						RelationType relationType;
 | 
				
			||||||
	Tx source, target;
 | 
						Tx source;
 | 
				
			||||||
 | 
						Tx target;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	public TxRelation(RelationType relationType, Tx source, Tx target) {
 | 
						public TxRelation(RelationType relationType, Tx source, Tx target) {
 | 
				
			||||||
		this.source = source;
 | 
							this.source = source;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -14,29 +14,28 @@ import java.beans.IntrospectionException;
 | 
				
			|||||||
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.Collection;
 | 
					 | 
				
			||||||
import java.util.List;
 | 
					import java.util.List;
 | 
				
			||||||
import java.util.Map;
 | 
					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.TreeMap;
 | 
				
			||||||
import java.util.Vector;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import com.minres.scviewer.database.EventKind;
 | 
				
			||||||
import com.minres.scviewer.database.HierNode;
 | 
					import com.minres.scviewer.database.HierNode;
 | 
				
			||||||
import com.minres.scviewer.database.ITx;
 | 
					import com.minres.scviewer.database.IEvent;
 | 
				
			||||||
import com.minres.scviewer.database.ITxEvent;
 | 
					 | 
				
			||||||
import com.minres.scviewer.database.ITxGenerator;
 | 
					 | 
				
			||||||
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.IWaveformDb;
 | 
				
			||||||
import com.minres.scviewer.database.RelationType;
 | 
					import com.minres.scviewer.database.RelationType;
 | 
				
			||||||
 | 
					import com.minres.scviewer.database.WaveformType;
 | 
				
			||||||
import com.minres.scviewer.database.sqlite.db.IDatabase;
 | 
					import com.minres.scviewer.database.sqlite.db.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;
 | 
				
			||||||
import com.minres.scviewer.database.sqlite.tables.ScvStream;
 | 
					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.tx.ITx;
 | 
				
			||||||
 | 
					import com.minres.scviewer.database.tx.ITxGenerator;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public class TxStream extends HierNode implements ITxStream<ITxEvent> {
 | 
					public class TxStream extends HierNode implements IWaveform {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	private IDatabase database;
 | 
						private IDatabase database;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -52,7 +51,7 @@ public class TxStream extends HierNode implements ITxStream<ITxEvent> {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	private Integer maxConcurrency;
 | 
						private Integer maxConcurrency;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	private TreeMap<Long, List<ITxEvent>> events;
 | 
						private TreeMap<Long, IEvent[]> events;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	private List<RelationType> usedRelationsList;
 | 
						private List<RelationType> usedRelationsList;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -79,17 +78,11 @@ public class TxStream extends HierNode implements ITxStream<ITxEvent> {
 | 
				
			|||||||
		return (long) scvStream.getId();
 | 
							return (long) scvStream.getId();
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	@Override
 | 
					 | 
				
			||||||
	public String getKind() {
 | 
					 | 
				
			||||||
		return scvStream.getKind();
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	@Override
 | 
					 | 
				
			||||||
	public List<ITxGenerator> getGenerators() {
 | 
						public List<ITxGenerator> getGenerators() {
 | 
				
			||||||
		if(generators==null){
 | 
							if(generators==null){
 | 
				
			||||||
			SQLiteDatabaseSelectHandler<ScvGenerator> handler = new SQLiteDatabaseSelectHandler<ScvGenerator>(
 | 
								SQLiteDatabaseSelectHandler<ScvGenerator> handler = new SQLiteDatabaseSelectHandler<>(
 | 
				
			||||||
					ScvGenerator.class, database, "stream="+scvStream.getId());
 | 
										ScvGenerator.class, database, "stream="+scvStream.getId());
 | 
				
			||||||
			generators=new TreeMap<Integer, TxGenerator>();
 | 
								generators=new TreeMap<>();
 | 
				
			||||||
			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));
 | 
				
			||||||
@@ -99,22 +92,20 @@ public class TxStream extends HierNode implements ITxStream<ITxEvent> {
 | 
				
			|||||||
				e.printStackTrace();
 | 
									e.printStackTrace();
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		return new ArrayList<ITxGenerator>(generators.values());
 | 
							return new ArrayList<>(generators.values());
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	@Override
 | 
						@Override
 | 
				
			||||||
	public int getMaxConcurrency() {
 | 
						public int getWidth() {
 | 
				
			||||||
		if(maxConcurrency==null){
 | 
							if(maxConcurrency==null){
 | 
				
			||||||
			java.sql.Connection connection=null;
 | 
					 | 
				
			||||||
			java.sql.Statement statement=null;
 | 
					 | 
				
			||||||
			java.sql.ResultSet resultSet=null;
 | 
					 | 
				
			||||||
			try {
 | 
					 | 
				
			||||||
				connection = database.createConnection();
 | 
					 | 
				
			||||||
				statement = connection.createStatement();
 | 
					 | 
				
			||||||
			StringBuilder sb = new StringBuilder();
 | 
								StringBuilder sb = new StringBuilder();
 | 
				
			||||||
			sb.append("SELECT MAX(concurrencyLevel) as concurrencyLevel FROM ScvTx where stream=");
 | 
								sb.append("SELECT MAX(concurrencyLevel) as concurrencyLevel FROM ScvTx where stream=");
 | 
				
			||||||
			sb.append(scvStream.getId());
 | 
								sb.append(scvStream.getId());
 | 
				
			||||||
				resultSet = statement.executeQuery(sb.toString());
 | 
								try(
 | 
				
			||||||
 | 
										java.sql.Connection connection = database.createConnection();
 | 
				
			||||||
 | 
										java.sql.Statement statement = connection.createStatement();
 | 
				
			||||||
 | 
										java.sql.ResultSet resultSet = statement.executeQuery(sb.toString());
 | 
				
			||||||
 | 
										) {
 | 
				
			||||||
				while (resultSet.next()) {
 | 
									while (resultSet.next()) {
 | 
				
			||||||
					if(maxConcurrency==null) maxConcurrency=0;
 | 
										if(maxConcurrency==null) maxConcurrency=0;
 | 
				
			||||||
					Object value = resultSet.getObject("concurrencyLevel");
 | 
										Object value = resultSet.getObject("concurrencyLevel");
 | 
				
			||||||
@@ -123,12 +114,6 @@ public class TxStream extends HierNode implements ITxStream<ITxEvent> {
 | 
				
			|||||||
				}
 | 
									}
 | 
				
			||||||
			} catch (SQLException e) {
 | 
								} catch (SQLException e) {
 | 
				
			||||||
				if(maxConcurrency==null) maxConcurrency=0;
 | 
									if(maxConcurrency==null) maxConcurrency=0;
 | 
				
			||||||
			} finally {
 | 
					 | 
				
			||||||
				try{
 | 
					 | 
				
			||||||
				if(resultSet!=null) resultSet.close();
 | 
					 | 
				
			||||||
				if(statement!=null) statement.close();
 | 
					 | 
				
			||||||
				if(connection!=null) connection.close();
 | 
					 | 
				
			||||||
				} catch (SQLException e) {	}
 | 
					 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			maxConcurrency+=1;
 | 
								maxConcurrency+=1;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
@@ -136,12 +121,12 @@ public class TxStream extends HierNode implements ITxStream<ITxEvent> {
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	@Override
 | 
						@Override
 | 
				
			||||||
	public  NavigableMap<Long, List<ITxEvent>> getEvents(){
 | 
						public  NavigableMap<Long, IEvent[]> getEvents(){
 | 
				
			||||||
		if(events==null){
 | 
							if(events==null){
 | 
				
			||||||
			events=new TreeMap<Long, List<ITxEvent>>();
 | 
								events=new TreeMap<>();
 | 
				
			||||||
			for(Entry<Integer, ITx> entry:getTransactions().entrySet()){
 | 
								for(Entry<Integer, ITx> entry:getTransactions().entrySet()){
 | 
				
			||||||
				putEvent(new TxEvent(TxEvent.Type.BEGIN, entry.getValue()));
 | 
									putEvent(new TxEvent(EventKind.BEGIN, entry.getValue()));
 | 
				
			||||||
				putEvent(new TxEvent(TxEvent.Type.END, entry.getValue()));
 | 
									putEvent(new TxEvent(EventKind.END, entry.getValue()));
 | 
				
			||||||
			}	
 | 
								}	
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		return events;
 | 
							return events;
 | 
				
			||||||
@@ -149,20 +134,22 @@ public class TxStream extends HierNode implements ITxStream<ITxEvent> {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	private void putEvent(TxEvent ev){
 | 
						private void putEvent(TxEvent ev){
 | 
				
			||||||
		Long time = ev.getTime();
 | 
							Long time = ev.getTime();
 | 
				
			||||||
		if(!events.containsKey(time)){
 | 
							if(events.containsKey(time)) {
 | 
				
			||||||
			Vector<ITxEvent> vector=new Vector<ITxEvent>();
 | 
								IEvent[] oldV = events.get(time);
 | 
				
			||||||
			vector.add(ev);
 | 
								IEvent[] newV = new IEvent[oldV.length+1];
 | 
				
			||||||
			events.put(time,  vector);
 | 
								System.arraycopy(oldV, 0, newV, 0, oldV.length);
 | 
				
			||||||
 | 
								newV[oldV.length]=ev;
 | 
				
			||||||
 | 
								events.put(time, newV);
 | 
				
			||||||
		} else {
 | 
							} else {
 | 
				
			||||||
			events.get(time).add(ev);
 | 
								events.put(time, new IEvent[] {ev});
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	protected Map<Integer, ITx> getTransactions() {
 | 
						protected Map<Integer, ITx> getTransactions() {
 | 
				
			||||||
		if(transactions==null){
 | 
							if(transactions==null){
 | 
				
			||||||
			if(generators==null) getGenerators();
 | 
								if(generators==null) getGenerators();
 | 
				
			||||||
			transactions = new TreeMap<Integer, ITx>();
 | 
								transactions = new TreeMap<>();
 | 
				
			||||||
			SQLiteDatabaseSelectHandler<ScvTx> handler = new SQLiteDatabaseSelectHandler<ScvTx>(ScvTx.class, database,
 | 
								SQLiteDatabaseSelectHandler<ScvTx> handler = new SQLiteDatabaseSelectHandler<>(ScvTx.class, database,
 | 
				
			||||||
					"stream="+scvStream.getId());
 | 
										"stream="+scvStream.getId());
 | 
				
			||||||
			try {
 | 
								try {
 | 
				
			||||||
				for(ScvTx scvTx:handler.selectObjects()){
 | 
									for(ScvTx scvTx:handler.selectObjects()){
 | 
				
			||||||
@@ -177,7 +164,7 @@ public class TxStream extends HierNode implements ITxStream<ITxEvent> {
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	@Override
 | 
						@Override
 | 
				
			||||||
	public Collection<ITxEvent> getWaveformEventsAtTime(Long time) {
 | 
						public IEvent[] getEventsAtTime(Long time) {
 | 
				
			||||||
		return getEvents().get(time);
 | 
							return getEvents().get(time);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -192,8 +179,22 @@ public class TxStream extends HierNode implements ITxStream<ITxEvent> {
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	@Override
 | 
						@Override
 | 
				
			||||||
	public Boolean equals(IWaveform other) {
 | 
						public boolean isSame(IWaveform other) {
 | 
				
			||||||
		return(other instanceof TxStream && this.getId().equals(other.getId()));
 | 
							return(other instanceof TxStream && this.getId().equals(other.getId()));
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						@Override
 | 
				
			||||||
 | 
						public IEvent[] getEventsBeforeTime(Long time) {
 | 
				
			||||||
 | 
							Entry<Long, IEvent[]> e = events.floorEntry(time);
 | 
				
			||||||
 | 
							if(e==null)
 | 
				
			||||||
 | 
								return new IEvent[]{};
 | 
				
			||||||
 | 
							else
 | 
				
			||||||
 | 
								return  events.floorEntry(time).getValue();
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						@Override
 | 
				
			||||||
 | 
						public WaveformType getType() {
 | 
				
			||||||
 | 
							return WaveformType.TRANSACTION;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
 | 
				
			|||||||
Bundle-ManifestVersion: 2
 | 
					Bundle-ManifestVersion: 2
 | 
				
			||||||
Bundle-Name: Textual transaction database
 | 
					Bundle-Name: Textual transaction database
 | 
				
			||||||
Bundle-SymbolicName: com.minres.scviewer.database.text
 | 
					Bundle-SymbolicName: com.minres.scviewer.database.text
 | 
				
			||||||
Bundle-Version: 2.0.2.qualifier
 | 
					Bundle-Version: 2.1.0.qualifier
 | 
				
			||||||
Bundle-Vendor: MINRES Technologies GmbH
 | 
					Bundle-Vendor: MINRES Technologies GmbH
 | 
				
			||||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
 | 
					Bundle-RequiredExecutionEnvironment: JavaSE-1.8
 | 
				
			||||||
Import-Package: org.osgi.framework;version="1.3.0"
 | 
					Import-Package: org.osgi.framework;version="1.3.0"
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -2,7 +2,7 @@
 | 
				
			|||||||
	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
 | 
						xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
 | 
				
			||||||
	<modelVersion>4.0.0</modelVersion>
 | 
						<modelVersion>4.0.0</modelVersion>
 | 
				
			||||||
	<artifactId>com.minres.scviewer.database.text</artifactId>
 | 
						<artifactId>com.minres.scviewer.database.text</artifactId>
 | 
				
			||||||
	<version>2.0.2-SNAPSHOT</version>
 | 
						<version>2.1.0-SNAPSHOT</version>
 | 
				
			||||||
	<parent>
 | 
						<parent>
 | 
				
			||||||
		<groupId>com.minres.scviewer</groupId>
 | 
							<groupId>com.minres.scviewer</groupId>
 | 
				
			||||||
		<artifactId>com.minres.scviewer.parent</artifactId>
 | 
							<artifactId>com.minres.scviewer.parent</artifactId>
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -22,12 +22,12 @@ import groovy.io.FileType
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
import com.minres.scviewer.database.AssociationType
 | 
					import com.minres.scviewer.database.AssociationType
 | 
				
			||||||
import com.minres.scviewer.database.DataType
 | 
					import com.minres.scviewer.database.DataType
 | 
				
			||||||
import com.minres.scviewer.database.ITxGenerator
 | 
					 | 
				
			||||||
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.IWaveformDb
 | 
				
			||||||
import com.minres.scviewer.database.IWaveformDbLoader
 | 
					import com.minres.scviewer.database.IWaveformDbLoader
 | 
				
			||||||
 | 
					import com.minres.scviewer.database.InputFormatException
 | 
				
			||||||
import com.minres.scviewer.database.RelationType
 | 
					import com.minres.scviewer.database.RelationType
 | 
				
			||||||
 | 
					import com.minres.scviewer.database.tx.ITxGenerator
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public class TextDbLoader implements IWaveformDbLoader{
 | 
					public class TextDbLoader implements IWaveformDbLoader{
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -63,7 +63,7 @@ public class TextDbLoader implements IWaveformDbLoader{
 | 
				
			|||||||
	static final byte[] x = "scv_tr_stream".bytes
 | 
						static final byte[] x = "scv_tr_stream".bytes
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	@Override
 | 
						@Override
 | 
				
			||||||
	boolean load(IWaveformDb db, File file) throws Exception {
 | 
						boolean load(IWaveformDb db, File file) throws InputFormatException {
 | 
				
			||||||
		if(file.isDirectory() || !file.exists()) return false;
 | 
							if(file.isDirectory() || !file.exists()) return false;
 | 
				
			||||||
		this.db=db
 | 
							this.db=db
 | 
				
			||||||
		this.streams=[]
 | 
							this.streams=[]
 | 
				
			||||||
@@ -83,7 +83,7 @@ public class TextDbLoader implements IWaveformDbLoader{
 | 
				
			|||||||
				.make()
 | 
									.make()
 | 
				
			||||||
				// NPE here --->
 | 
									// NPE here --->
 | 
				
			||||||
				parseInput(gzipped?new GZIPInputStream(new FileInputStream(file)):new FileInputStream(file))
 | 
									parseInput(gzipped?new GZIPInputStream(new FileInputStream(file)):new FileInputStream(file))
 | 
				
			||||||
				streams.each{ TxStream  stream -> stream.getMaxConcurrency() }
 | 
									streams.each{ TxStream  stream -> stream.getWidth() }
 | 
				
			||||||
				return true
 | 
									return true
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		} catch (IndexOutOfBoundsException e) {
 | 
							} catch (IndexOutOfBoundsException e) {
 | 
				
			||||||
@@ -98,6 +98,9 @@ public class TextDbLoader implements IWaveformDbLoader{
 | 
				
			|||||||
			System.out.println("---->>> Exception "+e.toString()+" caught while loading database");
 | 
								System.out.println("---->>> Exception "+e.toString()+" caught while loading database");
 | 
				
			||||||
			//System.out.println("---->>> Exception "+e.toString()+" caught while loading database. StackTrace following... ");
 | 
								//System.out.println("---->>> Exception "+e.toString()+" caught while loading database. StackTrace following... ");
 | 
				
			||||||
			//e.printStackTrace()
 | 
								//e.printStackTrace()
 | 
				
			||||||
 | 
							} catch(Error e) {
 | 
				
			||||||
 | 
								System.out.println("---->>> Exception "+e.toString()+" caught while loading database. StackTrace following... ");
 | 
				
			||||||
 | 
								e.printStackTrace()
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		return false;
 | 
							return false;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
@@ -163,7 +166,7 @@ public class TextDbLoader implements IWaveformDbLoader{
 | 
				
			|||||||
				case "scv_tr_generator":
 | 
									case "scv_tr_generator":
 | 
				
			||||||
					if ((matcher = line =~ /^scv_tr_generator\s+\(ID\s+(\d+),\s+name\s+"([^"]+)",\s+scv_tr_stream\s+(\d+),$/)) {
 | 
										if ((matcher = line =~ /^scv_tr_generator\s+\(ID\s+(\d+),\s+name\s+"([^"]+)",\s+scv_tr_stream\s+(\d+),$/)) {
 | 
				
			||||||
						def id = Integer.parseInt(matcher[0][1])
 | 
											def id = Integer.parseInt(matcher[0][1])
 | 
				
			||||||
						ITxStream stream=streamsById[Integer.parseInt(matcher[0][3])]
 | 
											TxStream stream=streamsById[Integer.parseInt(matcher[0][3])] as TxStream
 | 
				
			||||||
						generator=new TxGenerator(id, stream, matcher[0][2])
 | 
											generator=new TxGenerator(id, stream, matcher[0][2])
 | 
				
			||||||
						stream.generators<<generator
 | 
											stream.generators<<generator
 | 
				
			||||||
						generatorsById[id]=generator
 | 
											generatorsById[id]=generator
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -11,6 +11,9 @@
 | 
				
			|||||||
package com.minres.scviewer.database.text
 | 
					package com.minres.scviewer.database.text
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import com.minres.scviewer.database.*
 | 
					import com.minres.scviewer.database.*
 | 
				
			||||||
 | 
					import com.minres.scviewer.database.tx.ITx
 | 
				
			||||||
 | 
					import com.minres.scviewer.database.tx.ITxAttribute
 | 
				
			||||||
 | 
					import com.minres.scviewer.database.tx.ITxRelation
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class Tx implements ITx {
 | 
					class Tx implements ITx {
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -12,8 +12,8 @@ package com.minres.scviewer.database.text
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
import com.minres.scviewer.database.AssociationType;
 | 
					import com.minres.scviewer.database.AssociationType;
 | 
				
			||||||
import com.minres.scviewer.database.DataType;
 | 
					import com.minres.scviewer.database.DataType;
 | 
				
			||||||
import com.minres.scviewer.database.ITxAttributeType;
 | 
					import com.minres.scviewer.database.tx.ITxAttribute
 | 
				
			||||||
import com.minres.scviewer.database.ITxAttribute
 | 
					import com.minres.scviewer.database.tx.ITxAttributeType
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class TxAttribute  implements ITxAttribute{
 | 
					class TxAttribute  implements ITxAttribute{
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -12,7 +12,7 @@ package com.minres.scviewer.database.text
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
import com.minres.scviewer.database.AssociationType;
 | 
					import com.minres.scviewer.database.AssociationType;
 | 
				
			||||||
import com.minres.scviewer.database.DataType;
 | 
					import com.minres.scviewer.database.DataType;
 | 
				
			||||||
import com.minres.scviewer.database.ITxAttributeType;
 | 
					import com.minres.scviewer.database.tx.ITxAttributeType
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class TxAttributeType implements ITxAttributeType {
 | 
					class TxAttributeType implements ITxAttributeType {
 | 
				
			||||||
	String name
 | 
						String name
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -12,11 +12,11 @@ package com.minres.scviewer.database.text
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
import com.minres.scviewer.database.AssociationType;
 | 
					import com.minres.scviewer.database.AssociationType;
 | 
				
			||||||
import com.minres.scviewer.database.DataType
 | 
					import com.minres.scviewer.database.DataType
 | 
				
			||||||
import com.minres.scviewer.database.ITxAttributeType
 | 
					import com.minres.scviewer.database.tx.ITxAttribute
 | 
				
			||||||
import com.minres.scviewer.database.ITxAttribute
 | 
					import com.minres.scviewer.database.tx.ITxAttributeType
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class TxAttributeTypeFactory {
 | 
					class TxAttributeTypeFactory {
 | 
				
			||||||
	private static final instance = new TxAttributeTypeFactory()
 | 
						static final TxAttributeTypeFactory instance = new TxAttributeTypeFactory()
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	def attributes = [:]
 | 
						def attributes = [:]
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,36 +0,0 @@
 | 
				
			|||||||
package com.minres.scviewer.database.text;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
import com.minres.scviewer.database.ITx
 | 
					 | 
				
			||||||
import com.minres.scviewer.database.ITxEvent
 | 
					 | 
				
			||||||
import com.minres.scviewer.database.IWaveformEvent
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
class TxEvent implements ITxEvent {
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	final ITxEvent.Type type;
 | 
					 | 
				
			||||||
	
 | 
					 | 
				
			||||||
	final Tx transaction;
 | 
					 | 
				
			||||||
	
 | 
					 | 
				
			||||||
	final Long time
 | 
					 | 
				
			||||||
	
 | 
					 | 
				
			||||||
	TxEvent(ITxEvent.Type type, ITx transaction) {
 | 
					 | 
				
			||||||
		super();
 | 
					 | 
				
			||||||
		this.type = type;
 | 
					 | 
				
			||||||
		this.transaction = transaction;
 | 
					 | 
				
			||||||
		this.time = type==ITxEvent.Type.BEGIN?transaction.beginTime:transaction.endTime
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	@Override
 | 
					 | 
				
			||||||
	IWaveformEvent duplicate() throws CloneNotSupportedException {
 | 
					 | 
				
			||||||
		new TxEvent(type, transaction, time)
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	@Override
 | 
					 | 
				
			||||||
	int compareTo(IWaveformEvent o) {
 | 
					 | 
				
			||||||
		time.compareTo(o.time)
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	@Override
 | 
					 | 
				
			||||||
	String toString() {
 | 
					 | 
				
			||||||
		type.toString()+"@"+time+" of tx #"+transaction.id;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
@@ -0,0 +1,61 @@
 | 
				
			|||||||
 | 
					package com.minres.scviewer.database.text;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import com.minres.scviewer.database.EventKind;
 | 
				
			||||||
 | 
					import com.minres.scviewer.database.WaveformType;
 | 
				
			||||||
 | 
					import com.minres.scviewer.database.tx.ITx;
 | 
				
			||||||
 | 
					import com.minres.scviewer.database.tx.ITxEvent;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					class TxEvent implements ITxEvent {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						final EventKind kind;
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						final ITx transaction;
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						final Long time;
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						TxEvent(EventKind kind, ITx transaction) {
 | 
				
			||||||
 | 
							super();
 | 
				
			||||||
 | 
							this.kind = kind;
 | 
				
			||||||
 | 
							this.transaction = transaction;
 | 
				
			||||||
 | 
							this.time = kind==EventKind.BEGIN?transaction.getBeginTime():transaction.getEndTime();
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						public TxEvent(EventKind kind, ITx transaction, Long time) {
 | 
				
			||||||
 | 
							super();
 | 
				
			||||||
 | 
							this.kind = kind;
 | 
				
			||||||
 | 
							this.transaction = transaction;
 | 
				
			||||||
 | 
							this.time = time;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						@Override
 | 
				
			||||||
 | 
						public
 | 
				
			||||||
 | 
						ITxEvent duplicate() throws CloneNotSupportedException {
 | 
				
			||||||
 | 
							return new TxEvent(kind, transaction, time);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						@Override
 | 
				
			||||||
 | 
						public
 | 
				
			||||||
 | 
						String toString() {
 | 
				
			||||||
 | 
							return kind.toString()+"@"+time+" of tx #"+transaction.getId();
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						@Override
 | 
				
			||||||
 | 
						public WaveformType getType() {
 | 
				
			||||||
 | 
							return WaveformType.TRANSACTION;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						@Override
 | 
				
			||||||
 | 
						public EventKind getKind() {
 | 
				
			||||||
 | 
							return kind;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						@Override
 | 
				
			||||||
 | 
						public Long getTime() {
 | 
				
			||||||
 | 
							return time;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						@Override
 | 
				
			||||||
 | 
						public ITx getTransaction() {
 | 
				
			||||||
 | 
							return transaction;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@@ -13,17 +13,15 @@ package com.minres.scviewer.database.text
 | 
				
			|||||||
import java.util.ArrayList;
 | 
					import java.util.ArrayList;
 | 
				
			||||||
import java.util.List;
 | 
					import java.util.List;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import com.minres.scviewer.database.ITxAttributeType
 | 
					import com.minres.scviewer.database.IWaveform
 | 
				
			||||||
import com.minres.scviewer.database.ITxAttribute;
 | 
					import com.minres.scviewer.database.tx.ITx
 | 
				
			||||||
import com.minres.scviewer.database.ITxEvent;
 | 
					import com.minres.scviewer.database.tx.ITxAttribute
 | 
				
			||||||
import com.minres.scviewer.database.ITxGenerator;
 | 
					import com.minres.scviewer.database.tx.ITxAttributeType
 | 
				
			||||||
import com.minres.scviewer.database.ITxStream;
 | 
					import com.minres.scviewer.database.tx.ITxGenerator
 | 
				
			||||||
import com.minres.scviewer.database.ITx;
 | 
					 | 
				
			||||||
import com.minres.scviewer.database.IWaveformEvent;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
class TxGenerator implements ITxGenerator{
 | 
					class TxGenerator implements ITxGenerator{
 | 
				
			||||||
	Long id
 | 
						Long id
 | 
				
			||||||
	TxStream stream
 | 
						IWaveform stream
 | 
				
			||||||
	String name
 | 
						String name
 | 
				
			||||||
	Boolean active = false
 | 
						Boolean active = false
 | 
				
			||||||
	ArrayList<ITx> transactions=[]
 | 
						ArrayList<ITx> transactions=[]
 | 
				
			||||||
@@ -39,7 +37,7 @@ class TxGenerator implements ITxGenerator{
 | 
				
			|||||||
		this.name=name
 | 
							this.name=name
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	ITxStream<? extends ITxEvent> getStream(){
 | 
						IWaveform getStream(){
 | 
				
			||||||
		return stream;
 | 
							return stream;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,16 +1,15 @@
 | 
				
			|||||||
package com.minres.scviewer.database.text
 | 
					package com.minres.scviewer.database.text;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import com.minres.scviewer.database.ITxRelation
 | 
					 | 
				
			||||||
import com.minres.scviewer.database.ITx;
 | 
					 | 
				
			||||||
import com.minres.scviewer.database.RelationType;
 | 
					import com.minres.scviewer.database.RelationType;
 | 
				
			||||||
 | 
					import com.minres.scviewer.database.tx.ITx;
 | 
				
			||||||
 | 
					import com.minres.scviewer.database.tx.ITxRelation;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class TxRelation implements ITxRelation {
 | 
					class TxRelation implements ITxRelation {
 | 
				
			||||||
	Tx source
 | 
						final Tx source;
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	Tx target
 | 
						final Tx target;
 | 
				
			||||||
	
 | 
					 | 
				
			||||||
	RelationType relationType
 | 
					 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
 | 
						final RelationType relationType;
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	public TxRelation(RelationType relationType, Tx source, Tx target) {
 | 
						public TxRelation(RelationType relationType, Tx source, Tx target) {
 | 
				
			||||||
		this.source = source;
 | 
							this.source = source;
 | 
				
			||||||
@@ -16,20 +16,22 @@ import java.util.Comparator;
 | 
				
			|||||||
import java.util.List;
 | 
					import java.util.List;
 | 
				
			||||||
import java.util.Map;
 | 
					import java.util.Map;
 | 
				
			||||||
import java.util.NavigableMap;
 | 
					import java.util.NavigableMap;
 | 
				
			||||||
 | 
					import java.util.Map.Entry
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import org.mapdb.Serializer
 | 
					import org.mapdb.Serializer
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import com.minres.scviewer.database.ITxEvent;
 | 
					 | 
				
			||||||
import com.minres.scviewer.database.IWaveform;
 | 
					import com.minres.scviewer.database.IWaveform;
 | 
				
			||||||
import com.minres.scviewer.database.IWaveformDb
 | 
					import com.minres.scviewer.database.IWaveformDb
 | 
				
			||||||
import com.minres.scviewer.database.IWaveformEvent
 | 
					import com.minres.scviewer.database.WaveformType
 | 
				
			||||||
import com.minres.scviewer.database.ITxGenerator
 | 
					import com.minres.scviewer.database.tx.ITx
 | 
				
			||||||
 | 
					import com.minres.scviewer.database.tx.ITxEvent
 | 
				
			||||||
 | 
					import com.minres.scviewer.database.tx.ITxGenerator
 | 
				
			||||||
 | 
					import com.minres.scviewer.database.EventKind
 | 
				
			||||||
import com.minres.scviewer.database.HierNode;
 | 
					import com.minres.scviewer.database.HierNode;
 | 
				
			||||||
 | 
					import com.minres.scviewer.database.IEvent
 | 
				
			||||||
import com.minres.scviewer.database.IHierNode
 | 
					import com.minres.scviewer.database.IHierNode
 | 
				
			||||||
import com.minres.scviewer.database.ITxStream
 | 
					 | 
				
			||||||
import com.minres.scviewer.database.ITx
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
class TxStream extends HierNode implements ITxStream {
 | 
					class TxStream extends HierNode implements IWaveform {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	Long id
 | 
						Long id
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
@@ -37,20 +39,17 @@ class TxStream extends HierNode implements ITxStream {
 | 
				
			|||||||
	
 | 
						
 | 
				
			||||||
	String fullName
 | 
						String fullName
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	String kind
 | 
					 | 
				
			||||||
	
 | 
					 | 
				
			||||||
	def generators = []
 | 
						def generators = []
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	int maxConcurrency
 | 
						int maxConcurrency
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	private TreeMap<Long, List<ITxEvent>> events
 | 
						private TreeMap<Long, IEvent[]> events
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	TxStream(TextDbLoader loader, int id, String name, String kind){
 | 
						TxStream(TextDbLoader loader, int id, String name, String kind){
 | 
				
			||||||
		super(name)
 | 
							super(name)
 | 
				
			||||||
		this.id=id
 | 
							this.id=id
 | 
				
			||||||
		this.database=loader.db
 | 
							this.database=loader.db
 | 
				
			||||||
		this.fullName=name
 | 
							this.fullName=name
 | 
				
			||||||
		this.kind=kind
 | 
					 | 
				
			||||||
		this.maxConcurrency=0
 | 
							this.maxConcurrency=0
 | 
				
			||||||
		//events = new TreeMap<Long, List<ITxEvent>>()
 | 
							//events = new TreeMap<Long, List<ITxEvent>>()
 | 
				
			||||||
		events = loader.mapDb.treeMap(name).keySerializer(Serializer.LONG).createOrOpen();
 | 
							events = loader.mapDb.treeMap(name).keySerializer(Serializer.LONG).createOrOpen();
 | 
				
			||||||
@@ -66,18 +65,18 @@ class TxStream extends HierNode implements ITxStream {
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	@Override
 | 
						@Override
 | 
				
			||||||
	public int getMaxConcurrency() {
 | 
						public int getWidth() {
 | 
				
			||||||
		if(!maxConcurrency){
 | 
							if(!maxConcurrency){
 | 
				
			||||||
			generators.each {TxGenerator generator ->
 | 
								generators.each {TxGenerator generator ->
 | 
				
			||||||
				generator.transactions.each{ Tx tx ->
 | 
									generator.transactions.each{ Tx tx ->
 | 
				
			||||||
					putEvent(new TxEvent(ITxEvent.Type.BEGIN, tx))
 | 
										putEvent(new TxEvent(EventKind.BEGIN, tx))
 | 
				
			||||||
					putEvent(new TxEvent(ITxEvent.Type.END, tx))
 | 
										putEvent(new TxEvent(EventKind.END, tx))
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			def rowendtime = [0]
 | 
								def rowendtime = [0]
 | 
				
			||||||
			events.keySet().each{long time ->
 | 
								events.keySet().each{long time ->
 | 
				
			||||||
				def value=events.get(time)
 | 
									def value=events.get(time)
 | 
				
			||||||
				def starts=value.findAll{ITxEvent event ->event.type==ITxEvent.Type.BEGIN}
 | 
									def starts=value.findAll{IEvent event ->event.kind==EventKind.BEGIN}
 | 
				
			||||||
				starts.each {ITxEvent event ->
 | 
									starts.each {ITxEvent event ->
 | 
				
			||||||
					Tx tx = event.transaction
 | 
										Tx tx = event.transaction
 | 
				
			||||||
					def rowIdx = 0
 | 
										def rowIdx = 0
 | 
				
			||||||
@@ -96,24 +95,41 @@ class TxStream extends HierNode implements ITxStream {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	private putEvent(ITxEvent event){
 | 
						private putEvent(ITxEvent event){
 | 
				
			||||||
		if(!events.containsKey(event.time)) 
 | 
							if(!events.containsKey(event.time)) 
 | 
				
			||||||
			events.put(event.time, [event])
 | 
								events.put(event.time, [event] as IEvent[])
 | 
				
			||||||
		else
 | 
							else {
 | 
				
			||||||
			events[event.time]<<event
 | 
								def entries = events[event.time] as List
 | 
				
			||||||
 | 
								entries<<event
 | 
				
			||||||
 | 
								events.put(event.time, entries as IEvent[])
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	@Override
 | 
						@Override
 | 
				
			||||||
	public NavigableMap getEvents() {
 | 
						public NavigableMap<Long, IEvent[]> getEvents() {
 | 
				
			||||||
		return events;
 | 
							return events;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	@Override
 | 
						@Override
 | 
				
			||||||
	public Collection getWaveformEventsAtTime(Long time) {
 | 
						public IEvent[] getEventsAtTime(Long time) {
 | 
				
			||||||
		return events.get(time);
 | 
							return events.get(time);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	@Override
 | 
						@Override
 | 
				
			||||||
	public Boolean equals(IWaveform other) {
 | 
						public boolean isSame(IWaveform other) {
 | 
				
			||||||
		return(other instanceof TxStream && this.getId()==other.getId());
 | 
							return(other instanceof TxStream && this.getId()==other.getId());
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						@Override
 | 
				
			||||||
 | 
						public IEvent[] getEventsBeforeTime(Long time) {
 | 
				
			||||||
 | 
					    	Entry<Long, IEvent[]> e = events.floorEntry(time);
 | 
				
			||||||
 | 
					    	if(e==null)
 | 
				
			||||||
 | 
					    		return null;
 | 
				
			||||||
 | 
					    	else
 | 
				
			||||||
 | 
					    		return  events.floorEntry(time).getValue();
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						@Override
 | 
				
			||||||
 | 
						public WaveformType getType() {
 | 
				
			||||||
 | 
							return WaveformType.TRANSACTION;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
 | 
				
			|||||||
Bundle-ManifestVersion: 2
 | 
					Bundle-ManifestVersion: 2
 | 
				
			||||||
Bundle-Name: SWT widget
 | 
					Bundle-Name: SWT widget
 | 
				
			||||||
Bundle-SymbolicName: com.minres.scviewer.database.ui.swt
 | 
					Bundle-SymbolicName: com.minres.scviewer.database.ui.swt
 | 
				
			||||||
Bundle-Version: 2.3.1.qualifier
 | 
					Bundle-Version: 3.0.0.qualifier
 | 
				
			||||||
Bundle-Vendor: MINRES Technologies GmbH
 | 
					Bundle-Vendor: MINRES Technologies GmbH
 | 
				
			||||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
 | 
					Bundle-RequiredExecutionEnvironment: JavaSE-1.8
 | 
				
			||||||
Require-Bundle: org.eclipse.swt;bundle-version="3.103.1",
 | 
					Require-Bundle: org.eclipse.swt;bundle-version="3.103.1",
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -8,5 +8,5 @@
 | 
				
			|||||||
  	<version>2.0.0-SNAPSHOT</version>
 | 
					  	<version>2.0.0-SNAPSHOT</version>
 | 
				
			||||||
	<relativePath>../..</relativePath>
 | 
						<relativePath>../..</relativePath>
 | 
				
			||||||
  </parent>
 | 
					  </parent>
 | 
				
			||||||
  <version>2.3.1-SNAPSHOT</version>
 | 
					  <version>3.0.0-SNAPSHOT</version>
 | 
				
			||||||
</project>
 | 
					</project>
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -0,0 +1,17 @@
 | 
				
			|||||||
 | 
					package com.minres.scviewer.database.ui;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import org.eclipse.swt.graphics.Color;
 | 
				
			||||||
 | 
					import org.eclipse.swt.graphics.Font;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public interface IWaveformStyleProvider {
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						Font getNameFont();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						Font getNameFontHighlite();
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						int getTrackHeight();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						Color getColor(WaveformColors type);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						Color[] computeColor(String name);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@@ -11,7 +11,6 @@
 | 
				
			|||||||
package com.minres.scviewer.database.ui;
 | 
					package com.minres.scviewer.database.ui;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import java.beans.PropertyChangeListener;
 | 
					import java.beans.PropertyChangeListener;
 | 
				
			||||||
import java.util.HashMap;
 | 
					 | 
				
			||||||
import java.util.List;
 | 
					import java.util.List;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import org.eclipse.jface.viewers.ISelection;
 | 
					import org.eclipse.jface.viewers.ISelection;
 | 
				
			||||||
@@ -19,7 +18,6 @@ import org.eclipse.jface.viewers.ISelectionChangedListener;
 | 
				
			|||||||
import org.eclipse.jface.viewers.ISelectionProvider;
 | 
					import org.eclipse.jface.viewers.ISelectionProvider;
 | 
				
			||||||
import org.eclipse.swt.events.DisposeListener;
 | 
					import org.eclipse.swt.events.DisposeListener;
 | 
				
			||||||
import org.eclipse.swt.graphics.Point;
 | 
					import org.eclipse.swt.graphics.Point;
 | 
				
			||||||
import org.eclipse.swt.graphics.RGB;
 | 
					 | 
				
			||||||
import org.eclipse.swt.widgets.Control;
 | 
					import org.eclipse.swt.widgets.Control;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import com.minres.scviewer.database.IWaveform;
 | 
					import com.minres.scviewer.database.IWaveform;
 | 
				
			||||||
@@ -37,6 +35,8 @@ public interface IWaveformView extends PropertyChangeListener, ISelectionProvide
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	public void removeSelectionChangedListener(ISelectionChangedListener listener);
 | 
						public void removeSelectionChangedListener(ISelectionChangedListener listener);
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
 | 
						public void setStyleProvider(IWaveformStyleProvider styleProvider);
 | 
				
			||||||
 | 
						
 | 
				
			||||||
	public void update();
 | 
						public void update();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	public Control getControl();
 | 
						public Control getControl();
 | 
				
			||||||
@@ -103,8 +103,6 @@ public interface IWaveformView extends PropertyChangeListener, ISelectionProvide
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	public List<ICursor> getCursorList();
 | 
						public List<ICursor> getCursorList();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	public void setColors(HashMap<WaveformColors, RGB> colourMap);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	public long getBaselineTime();
 | 
						public long getBaselineTime();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	public void setBaselineTime(Long scale);
 | 
						public void setBaselineTime(Long scale);
 | 
				
			||||||
@@ -114,4 +112,6 @@ public interface IWaveformView extends PropertyChangeListener, ISelectionProvide
 | 
				
			|||||||
	public void addDisposeListener( DisposeListener listener );
 | 
						public void addDisposeListener( DisposeListener listener );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	public void deleteSelectedTracks();
 | 
						public void deleteSelectedTracks();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						public TrackEntry addWaveform(IWaveform waveform, int pos);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@@ -14,4 +14,6 @@ import org.eclipse.swt.widgets.Composite;
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
public interface IWaveformViewFactory {
 | 
					public interface IWaveformViewFactory {
 | 
				
			||||||
	public IWaveformView createPanel(Composite parent);
 | 
						public IWaveformView createPanel(Composite parent);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						public IWaveformView createPanel(Composite parent, IWaveformStyleProvider styleProvider);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -11,66 +11,11 @@
 | 
				
			|||||||
package com.minres.scviewer.database.ui;
 | 
					package com.minres.scviewer.database.ui;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import java.awt.Color;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
import com.minres.scviewer.database.ISignal;
 | 
					 | 
				
			||||||
import com.minres.scviewer.database.ITxEvent;
 | 
					 | 
				
			||||||
import com.minres.scviewer.database.ITxStream;
 | 
					 | 
				
			||||||
import com.minres.scviewer.database.IWaveform;
 | 
					import com.minres.scviewer.database.IWaveform;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public class TrackEntry {
 | 
					public class TrackEntry {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 	// color info
 | 
						IWaveformStyleProvider styleProvider;
 | 
				
			||||||
	public static Color fallbackColor = new Color(200,0,0);
 | 
					 | 
				
			||||||
	public static Color highlightedFallbackColor = new Color(255,0,0);
 | 
					 | 
				
			||||||
	private Color[]signalColors;
 | 
					 | 
				
			||||||
	
 | 
					 | 
				
			||||||
	// list of random colors
 | 
					 | 
				
			||||||
	private static Color[][] randomColors = {
 | 
					 | 
				
			||||||
			{ new Color( 170,  66,  37 ), new Color ( 190,  66,  37 ) },
 | 
					 | 
				
			||||||
			{ new Color(  96,  74, 110 ), new Color (  96,  74, 130 ) },
 | 
					 | 
				
			||||||
			{ new Color( 133, 105, 128 ), new Color ( 153, 105, 128 ) },
 | 
					 | 
				
			||||||
			{ new Color(   0, 126, 135 ), new Color (   0, 126, 155 ) },
 | 
					 | 
				
			||||||
			{ new Color( 243, 146,  75 ), new Color ( 255, 146,  75 ) },
 | 
					 | 
				
			||||||
			{ new Color( 206, 135, 163 ), new Color ( 226, 135, 163 ) },
 | 
					 | 
				
			||||||
			{ new Color( 124, 103,  74 ), new Color ( 144, 103,  74 ) },
 | 
					 | 
				
			||||||
			{ new Color( 194, 187, 169 ), new Color ( 214, 187, 169 ) },
 | 
					 | 
				
			||||||
			{ new Color( 104,  73,  71 ), new Color ( 124,  73,  71 ) },
 | 
					 | 
				
			||||||
			{ new Color(  75, 196, 213 ), new Color (  75, 196, 233 ) },
 | 
					 | 
				
			||||||
			{ new Color( 206, 232, 229 ), new Color ( 206, 252, 229 ) },
 | 
					 | 
				
			||||||
			{ new Color( 169, 221, 199 ), new Color ( 169, 241, 199 ) },
 | 
					 | 
				
			||||||
			{ new Color( 100, 165, 197 ), new Color ( 100, 165, 217 ) },
 | 
					 | 
				
			||||||
			{ new Color( 150, 147, 178 ), new Color ( 150, 147, 198 ) },
 | 
					 | 
				
			||||||
			{ new Color( 200, 222, 182 ), new Color ( 200, 242, 182 ) },
 | 
					 | 
				
			||||||
			{ new Color( 147, 208, 197 ), new Color ( 147, 228, 197 ) }
 | 
					 | 
				
			||||||
	};
 | 
					 | 
				
			||||||
	
 | 
					 | 
				
			||||||
	public static Color[] computeColor (String streamValue, Color fallback, Color highlightedFallback) {
 | 
					 | 
				
			||||||
	
 | 
					 | 
				
			||||||
		Color[]result = new Color[2];
 | 
					 | 
				
			||||||
				
 | 
					 | 
				
			||||||
		result[0] = fallback;
 | 
					 | 
				
			||||||
		result[1] = highlightedFallback;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		// assign "random" color here, one name always results in the same color!
 | 
					 | 
				
			||||||
		if( streamValue!=null && randomColors.length > 0 ) {
 | 
					 | 
				
			||||||
			int index = Math.abs(streamValue.hashCode()) % randomColors.length;
 | 
					 | 
				
			||||||
			result[0] = randomColors[index][0];
 | 
					 | 
				
			||||||
			result[1] = randomColors[index][1];
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
		
 | 
					 | 
				
			||||||
		return result;
 | 
					 | 
				
			||||||
		
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	
 | 
					 | 
				
			||||||
	public void setColor(Color changedColor, Color highlightColor) {
 | 
					 | 
				
			||||||
		signalColors[0] = changedColor;
 | 
					 | 
				
			||||||
		signalColors[1] = highlightColor;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	
 | 
					 | 
				
			||||||
	public Color[] getColors() {
 | 
					 | 
				
			||||||
		return signalColors;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	public enum ValueDisplay {
 | 
						public enum ValueDisplay {
 | 
				
			||||||
		DEFAULT, SIGNED, UNSIGNED
 | 
							DEFAULT, SIGNED, UNSIGNED
 | 
				
			||||||
@@ -95,30 +40,12 @@ public class TrackEntry {
 | 
				
			|||||||
	
 | 
						
 | 
				
			||||||
	public WaveDisplay waveDisplay = WaveDisplay.DEFAULT;
 | 
						public WaveDisplay waveDisplay = WaveDisplay.DEFAULT;
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	public TrackEntry(IWaveform waveform) {
 | 
						public TrackEntry(IWaveform waveform, IWaveformStyleProvider styleProvider) {
 | 
				
			||||||
		this.waveform = waveform;
 | 
							this.waveform = waveform;
 | 
				
			||||||
 | 
							this.styleProvider=styleProvider;
 | 
				
			||||||
		vOffset=0;
 | 
							vOffset=0;
 | 
				
			||||||
		height=0;
 | 
							height=0;
 | 
				
			||||||
		selected=false;
 | 
							selected=false;
 | 
				
			||||||
		signalColors = new Color[2];
 | 
					 | 
				
			||||||
		signalColors[0] = fallbackColor;
 | 
					 | 
				
			||||||
		signalColors[1] = highlightedFallbackColor;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	
 | 
					 | 
				
			||||||
	public boolean isStream(){
 | 
					 | 
				
			||||||
		return waveform instanceof ITxStream<?>;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	public ITxStream<? extends ITxEvent> getStream(){
 | 
					 | 
				
			||||||
		return (ITxStream<?>) waveform;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	public boolean isSignal(){
 | 
					 | 
				
			||||||
		return waveform instanceof ISignal<?>;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	
 | 
					 | 
				
			||||||
	public ISignal<?> getSignal(){
 | 
					 | 
				
			||||||
		return (ISignal<?>) waveform;
 | 
					 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	@Override
 | 
						@Override
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -2,11 +2,13 @@ package com.minres.scviewer.database.ui.swt;
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
public class Constants {
 | 
					public class Constants {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	public static final String[] unitString={"fs", "ps", "ns", "us", "ms"};//, "s"};
 | 
						public static final String[] UNIT_STRING={"fs", "ps", "ns", "us", "ms"};//, "s"};
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
    public static final int[] unitMultiplier={1, 3, 10, 30, 100, 300};
 | 
					    public static final int[] UNIT_MULTIPLIER={1, 3, 10, 30, 100, 300};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	public static final String CONTENT_PROVIDER_TAG = "TOOLTIP_CONTENT_PROVIDER";
 | 
						public static final String CONTENT_PROVIDER_TAG = "TOOLTIP_CONTENT_PROVIDER";
 | 
				
			||||||
	public static final String HELP_PROVIDER_TAG = "TOOLTIP_HELP_PROVIDER";
 | 
						public static final String HELP_PROVIDER_TAG = "TOOLTIP_HELP_PROVIDER";
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
 | 
						private Constants() {}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -17,10 +17,12 @@ import org.osgi.framework.BundleContext;
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
public class DatabaseUiPlugin extends Plugin {
 | 
					public class DatabaseUiPlugin extends Plugin {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						@Override
 | 
				
			||||||
	public void start(BundleContext context) throws Exception {
 | 
						public void start(BundleContext context) throws Exception {
 | 
				
			||||||
		getLog().log(new Status(IStatus.OK, "org.eclipse.e4.core", "Starting org.eclipse.e4.core bundle..."));
 | 
							getLog().log(new Status(IStatus.OK, "org.eclipse.e4.core", "Starting org.eclipse.e4.core bundle..."));
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						@Override
 | 
				
			||||||
	public void stop(BundleContext context) throws Exception {
 | 
						public void stop(BundleContext context) throws Exception {
 | 
				
			||||||
		getLog().log(new Status(IStatus.OK, "org.eclipse.e4.core", "Stopping org.eclipse.e4.core bundle..."));
 | 
							getLog().log(new Status(IStatus.OK, "org.eclipse.e4.core", "Stopping org.eclipse.e4.core bundle..."));
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -0,0 +1,91 @@
 | 
				
			|||||||
 | 
					package com.minres.scviewer.database.ui.swt;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import java.util.Map;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import org.eclipse.swt.SWT;
 | 
				
			||||||
 | 
					import org.eclipse.swt.graphics.Color;
 | 
				
			||||||
 | 
					import org.eclipse.swt.graphics.Font;
 | 
				
			||||||
 | 
					import org.eclipse.swt.graphics.RGB;
 | 
				
			||||||
 | 
					import org.eclipse.swt.widgets.Composite;
 | 
				
			||||||
 | 
					import org.eclipse.swt.widgets.Display;
 | 
				
			||||||
 | 
					import org.eclipse.wb.swt.SWTResourceManager;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import com.minres.scviewer.database.ui.IWaveformStyleProvider;
 | 
				
			||||||
 | 
					import com.minres.scviewer.database.ui.WaveformColors;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public class DefaultWaveformStyleProvider implements IWaveformStyleProvider {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						Composite parent;
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						private Font nameFont;
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						private Font nameFontB;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    Color[] colors = new Color[WaveformColors.values().length];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						public DefaultWaveformStyleProvider() {
 | 
				
			||||||
 | 
							nameFont = Display.getCurrent().getSystemFont();
 | 
				
			||||||
 | 
							nameFontB = SWTResourceManager.getBoldFont(nameFont);
 | 
				
			||||||
 | 
					        colors[WaveformColors.LINE.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_RED);
 | 
				
			||||||
 | 
					        colors[WaveformColors.LINE_HIGHLITE.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_CYAN);
 | 
				
			||||||
 | 
					        colors[WaveformColors.TRACK_BG_EVEN.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_BLACK);
 | 
				
			||||||
 | 
					        colors[WaveformColors.TRACK_BG_ODD.ordinal()] = SWTResourceManager.getColor(40, 40, 40);
 | 
				
			||||||
 | 
					        colors[WaveformColors.TRACK_BG_HIGHLITE.ordinal()] = SWTResourceManager.getColor(40, 40, 80);
 | 
				
			||||||
 | 
					        colors[WaveformColors.TX_BG.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_GREEN);
 | 
				
			||||||
 | 
					        colors[WaveformColors.TX_BG_HIGHLITE.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_DARK_GREEN);
 | 
				
			||||||
 | 
					        colors[WaveformColors.TX_BORDER.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_RED);
 | 
				
			||||||
 | 
					        colors[WaveformColors.SIGNAL0.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_GREEN);
 | 
				
			||||||
 | 
					        colors[WaveformColors.SIGNAL1.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_GREEN);
 | 
				
			||||||
 | 
					        colors[WaveformColors.SIGNALZ.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_DARK_YELLOW);
 | 
				
			||||||
 | 
					        colors[WaveformColors.SIGNALX.ordinal()] = SWTResourceManager.getColor(255,  51,  51);
 | 
				
			||||||
 | 
					        colors[WaveformColors.SIGNALU.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_YELLOW);
 | 
				
			||||||
 | 
					        colors[WaveformColors.SIGNAL_TEXT.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_WHITE);
 | 
				
			||||||
 | 
					        colors[WaveformColors.SIGNAL_REAL.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_YELLOW);
 | 
				
			||||||
 | 
					        colors[WaveformColors.SIGNAL_NAN.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_RED);
 | 
				
			||||||
 | 
					        colors[WaveformColors.CURSOR.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_RED);
 | 
				
			||||||
 | 
					        colors[WaveformColors.CURSOR_DRAG.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_GRAY);
 | 
				
			||||||
 | 
					        colors[WaveformColors.CURSOR_TEXT.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_WHITE);
 | 
				
			||||||
 | 
					        colors[WaveformColors.MARKER.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_DARK_GRAY);
 | 
				
			||||||
 | 
					        colors[WaveformColors.MARKER_TEXT.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_WHITE);
 | 
				
			||||||
 | 
					        colors[WaveformColors.REL_ARROW.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_MAGENTA);
 | 
				
			||||||
 | 
					        colors[WaveformColors.REL_ARROW_HIGHLITE.ordinal()] = SWTResourceManager.getColor(255, 128, 255);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						/** 
 | 
				
			||||||
 | 
						 * needs redraw() afterwards
 | 
				
			||||||
 | 
						 * @param colourMap
 | 
				
			||||||
 | 
						 */
 | 
				
			||||||
 | 
					    public void initColors(Map<WaveformColors, RGB> colourMap) {
 | 
				
			||||||
 | 
					        Display d = parent.getDisplay();
 | 
				
			||||||
 | 
					        if (colourMap != null) {
 | 
				
			||||||
 | 
					            for (WaveformColors c : WaveformColors.values()) {
 | 
				
			||||||
 | 
					                if (colourMap.containsKey(c))
 | 
				
			||||||
 | 
					                    colors[c.ordinal()] = new Color(d, colourMap.get(c));
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						@Override
 | 
				
			||||||
 | 
						public Font getNameFont() {
 | 
				
			||||||
 | 
							return nameFont;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						@Override
 | 
				
			||||||
 | 
						public Font getNameFontHighlite() {
 | 
				
			||||||
 | 
							return nameFontB;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						@Override
 | 
				
			||||||
 | 
						public int getTrackHeight() {
 | 
				
			||||||
 | 
							return 50;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						@Override
 | 
				
			||||||
 | 
						public Color getColor(WaveformColors type) {
 | 
				
			||||||
 | 
							return colors[type.ordinal()];
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						@Override
 | 
				
			||||||
 | 
						public Color[] computeColor(String name) {
 | 
				
			||||||
 | 
							return new Color[] {SWTResourceManager.getColor( 200,0,0), SWTResourceManager.getColor( 255,0,0)};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@@ -12,6 +12,7 @@ package com.minres.scviewer.database.ui.swt;
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
import org.eclipse.swt.widgets.Composite;
 | 
					import org.eclipse.swt.widgets.Composite;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import com.minres.scviewer.database.ui.IWaveformStyleProvider;
 | 
				
			||||||
import com.minres.scviewer.database.ui.IWaveformView;
 | 
					import com.minres.scviewer.database.ui.IWaveformView;
 | 
				
			||||||
import com.minres.scviewer.database.ui.IWaveformViewFactory;
 | 
					import com.minres.scviewer.database.ui.IWaveformViewFactory;
 | 
				
			||||||
import com.minres.scviewer.database.ui.swt.internal.WaveformView;
 | 
					import com.minres.scviewer.database.ui.swt.internal.WaveformView;
 | 
				
			||||||
@@ -20,7 +21,12 @@ public class WaveformViewFactory implements IWaveformViewFactory {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	@Override
 | 
						@Override
 | 
				
			||||||
	public IWaveformView createPanel(Composite parent) {
 | 
						public IWaveformView createPanel(Composite parent) {
 | 
				
			||||||
		return new WaveformView(parent);
 | 
							return new WaveformView(parent, new DefaultWaveformStyleProvider());
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						@Override
 | 
				
			||||||
 | 
						public IWaveformView createPanel(Composite parent, IWaveformStyleProvider styleProvider) {
 | 
				
			||||||
 | 
							return new WaveformView(parent, styleProvider);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -21,17 +21,16 @@ import org.eclipse.swt.graphics.Point;
 | 
				
			|||||||
import org.eclipse.swt.graphics.Rectangle;
 | 
					import org.eclipse.swt.graphics.Rectangle;
 | 
				
			||||||
import org.eclipse.swt.widgets.Display;
 | 
					import org.eclipse.swt.widgets.Display;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import com.minres.scviewer.database.ITx;
 | 
					 | 
				
			||||||
import com.minres.scviewer.database.ITxRelation;
 | 
					 | 
				
			||||||
import com.minres.scviewer.database.ITxStream;
 | 
					 | 
				
			||||||
import com.minres.scviewer.database.RelationType;
 | 
					import com.minres.scviewer.database.RelationType;
 | 
				
			||||||
 | 
					import com.minres.scviewer.database.tx.ITx;
 | 
				
			||||||
 | 
					import com.minres.scviewer.database.tx.ITxRelation;
 | 
				
			||||||
import com.minres.scviewer.database.ui.WaveformColors;
 | 
					import com.minres.scviewer.database.ui.WaveformColors;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public class ArrowPainter implements IPainter {
 | 
					public class ArrowPainter implements IPainter {
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	private final int xCtrlOffset = 50;
 | 
						private static final float X_CTRL_OFFSET = 50;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	private final int yCtrlOffset = 30;
 | 
						private int yCtrlOffset = 30;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	private WaveformCanvas waveCanvas;
 | 
						private WaveformCanvas waveCanvas;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -83,14 +82,13 @@ public class ArrowPainter implements IPainter {
 | 
				
			|||||||
		deferUpdate = false;
 | 
							deferUpdate = false;
 | 
				
			||||||
		iRect.clear();
 | 
							iRect.clear();
 | 
				
			||||||
		oRect.clear();
 | 
							oRect.clear();
 | 
				
			||||||
		ITxStream<?> stream = tx.getStream();
 | 
							IWaveformPainter painter = waveCanvas.wave2painterMap.get(tx.getStream());
 | 
				
			||||||
		IWaveformPainter painter = waveCanvas.wave2painterMap.get(stream);
 | 
					 | 
				
			||||||
		if (painter == null) { // stream has been added but painter not yet
 | 
							if (painter == null) { // stream has been added but painter not yet
 | 
				
			||||||
								// created
 | 
													// created
 | 
				
			||||||
			deferUpdate = true;
 | 
								deferUpdate = true;
 | 
				
			||||||
			return;
 | 
								return;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		int laneHeight = painter.getHeight() / stream.getMaxConcurrency();
 | 
							int laneHeight = painter.getHeight() / tx.getStream().getWidth();
 | 
				
			||||||
		txRectangle = new Rectangle((int) (tx.getBeginTime() / scaleFactor),
 | 
							txRectangle = new Rectangle((int) (tx.getBeginTime() / scaleFactor),
 | 
				
			||||||
				waveCanvas.rulerHeight + painter.getVerticalOffset() + laneHeight * tx.getConcurrencyIndex(),
 | 
									waveCanvas.rulerHeight + painter.getVerticalOffset() + laneHeight * tx.getConcurrencyIndex(),
 | 
				
			||||||
				(int) ((tx.getEndTime() - tx.getBeginTime()) / scaleFactor), laneHeight);
 | 
									(int) ((tx.getEndTime() - tx.getBeginTime()) / scaleFactor), laneHeight);
 | 
				
			||||||
@@ -102,13 +100,13 @@ public class ArrowPainter implements IPainter {
 | 
				
			|||||||
		for (ITxRelation iTxRelation : relations) {
 | 
							for (ITxRelation iTxRelation : relations) {
 | 
				
			||||||
			ITx otherTx = useTarget ? iTxRelation.getTarget() : iTxRelation.getSource();
 | 
								ITx otherTx = useTarget ? iTxRelation.getTarget() : iTxRelation.getSource();
 | 
				
			||||||
			if (waveCanvas.wave2painterMap.containsKey(otherTx.getStream())) {
 | 
								if (waveCanvas.wave2painterMap.containsKey(otherTx.getStream())) {
 | 
				
			||||||
				ITxStream<?> stream = otherTx.getStream();
 | 
									IWaveformPainter painter = waveCanvas.wave2painterMap.get(otherTx.getStream());
 | 
				
			||||||
				IWaveformPainter painter = waveCanvas.wave2painterMap.get(stream);
 | 
									int height = waveCanvas.styleProvider.getTrackHeight();
 | 
				
			||||||
				int laneHeight = painter.getHeight() / stream.getMaxConcurrency();
 | 
									Rectangle bb = new Rectangle(
 | 
				
			||||||
				Rectangle bb = new Rectangle((int) (otherTx.getBeginTime() / scaleFactor),
 | 
											(int) (otherTx.getBeginTime() / scaleFactor),
 | 
				
			||||||
						waveCanvas.rulerHeight + painter.getVerticalOffset()
 | 
											waveCanvas.rulerHeight + painter.getVerticalOffset() + height * otherTx.getConcurrencyIndex(),
 | 
				
			||||||
								+ laneHeight * otherTx.getConcurrencyIndex(),
 | 
											(int) ((otherTx.getEndTime() - otherTx.getBeginTime()) / scaleFactor),
 | 
				
			||||||
						(int) ((otherTx.getEndTime() - otherTx.getBeginTime()) / scaleFactor), laneHeight);
 | 
											height);
 | 
				
			||||||
				res.add(new LinkEntry(bb, iTxRelation.getRelationType()));
 | 
									res.add(new LinkEntry(bb, iTxRelation.getRelationType()));
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
@@ -116,8 +114,9 @@ public class ArrowPainter implements IPainter {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	@Override
 | 
						@Override
 | 
				
			||||||
	public void paintArea(Projection proj, Rectangle clientRect) {
 | 
						public void paintArea(Projection proj, Rectangle clientRect) {
 | 
				
			||||||
		Color fgColor = waveCanvas.colors[WaveformColors.REL_ARROW.ordinal()];
 | 
							yCtrlOffset = waveCanvas.styleProvider.getTrackHeight()/2;
 | 
				
			||||||
		Color highliteColor = waveCanvas.colors[WaveformColors.REL_ARROW_HIGHLITE.ordinal()];
 | 
							Color fgColor = waveCanvas.styleProvider.getColor(WaveformColors.REL_ARROW);
 | 
				
			||||||
 | 
							Color highliteColor = waveCanvas.styleProvider.getColor(WaveformColors.REL_ARROW_HIGHLITE);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if(tx==null) return;
 | 
							if(tx==null) return;
 | 
				
			||||||
		if (!deferUpdate) {
 | 
							if (!deferUpdate) {
 | 
				
			||||||
@@ -152,10 +151,10 @@ public class ArrowPainter implements IPainter {
 | 
				
			|||||||
		path.moveTo(point1.x, point1.y);
 | 
							path.moveTo(point1.x, point1.y);
 | 
				
			||||||
		if (point1.y == point2.y) {
 | 
							if (point1.y == point2.y) {
 | 
				
			||||||
			Point center = new Point((point1.x + point2.x) / 2, point1.y - yCtrlOffset);
 | 
								Point center = new Point((point1.x + point2.x) / 2, point1.y - yCtrlOffset);
 | 
				
			||||||
			path.cubicTo(point1.x + xCtrlOffset, point1.y, center.x - xCtrlOffset, center.y, center.x, center.y);
 | 
								path.cubicTo(point1.x + X_CTRL_OFFSET, point1.y, center.x - X_CTRL_OFFSET, center.y, center.x, center.y);
 | 
				
			||||||
			path.cubicTo(center.x + xCtrlOffset, center.y, point2.x - xCtrlOffset, point2.y, point2.x, point2.y);
 | 
								path.cubicTo(center.x + X_CTRL_OFFSET, center.y, point2.x - X_CTRL_OFFSET, point2.y, point2.x, point2.y);
 | 
				
			||||||
		} else
 | 
							} else
 | 
				
			||||||
			path.cubicTo(point1.x + xCtrlOffset, point1.y, point2.x - xCtrlOffset, point2.y, point2.x, point2.y);
 | 
								path.cubicTo(point1.x + X_CTRL_OFFSET, point1.y, point2.x - X_CTRL_OFFSET, point2.y, point2.x, point2.y);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		proj.setAntialias(SWT.ON);
 | 
							proj.setAntialias(SWT.ON);
 | 
				
			||||||
		proj.setForeground(fgColor);
 | 
							proj.setForeground(fgColor);
 | 
				
			||||||
@@ -168,8 +167,8 @@ public class ArrowPainter implements IPainter {
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	class LinkEntry {
 | 
						class LinkEntry {
 | 
				
			||||||
		public Rectangle rectangle;
 | 
							public final Rectangle rectangle;
 | 
				
			||||||
		public RelationType relationType;
 | 
							public final RelationType relationType;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		public LinkEntry(Rectangle rectangle, RelationType relationType) {
 | 
							public LinkEntry(Rectangle rectangle, RelationType relationType) {
 | 
				
			||||||
			super();
 | 
								super();
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -63,7 +63,7 @@ public class CursorPainter implements IPainter, ICursor {
 | 
				
			|||||||
	
 | 
						
 | 
				
			||||||
	public void paintArea(Projection proj, Rectangle clientRect) {
 | 
						public void paintArea(Projection proj, Rectangle clientRect) {
 | 
				
			||||||
		Rectangle area = proj.unProject(clientRect);
 | 
							Rectangle area = proj.unProject(clientRect);
 | 
				
			||||||
		if(this.waveCanvas.painterList.size()>0){
 | 
							if(!waveCanvas.painterList.isEmpty()){
 | 
				
			||||||
			
 | 
								
 | 
				
			||||||
			long scaleFactor=waveCanvas.getScaleFactor();
 | 
								long scaleFactor=waveCanvas.getScaleFactor();
 | 
				
			||||||
			long beginPos = area.x;
 | 
								long beginPos = area.x;
 | 
				
			||||||
@@ -75,15 +75,15 @@ public class CursorPainter implements IPainter, ICursor {
 | 
				
			|||||||
			int x = (int) (time/scaleFactor);
 | 
								int x = (int) (time/scaleFactor);
 | 
				
			||||||
			// distance of marker from the top of Canvas' painting area
 | 
								// distance of marker from the top of Canvas' painting area
 | 
				
			||||||
			int top = id<0?area.y:area.y+15;
 | 
								int top = id<0?area.y:area.y+15;
 | 
				
			||||||
			Color drawColor=waveCanvas.colors[id<0?WaveformColors.CURSOR.ordinal():WaveformColors.MARKER.ordinal()];
 | 
								Color drawColor=waveCanvas.styleProvider.getColor(id<0?WaveformColors.CURSOR:WaveformColors.MARKER);
 | 
				
			||||||
			Color dragColor = waveCanvas.colors[WaveformColors.CURSOR_DRAG.ordinal()];
 | 
								Color dragColor = waveCanvas.styleProvider.getColor(WaveformColors.CURSOR_DRAG);
 | 
				
			||||||
			Color textColor=waveCanvas.colors[id<0?WaveformColors.CURSOR_TEXT.ordinal():WaveformColors.MARKER_TEXT.ordinal()];
 | 
								Color textColor=waveCanvas.styleProvider.getColor(id<0?WaveformColors.CURSOR_TEXT:WaveformColors.MARKER_TEXT);
 | 
				
			||||||
			if(x>=beginPos && x<=maxValX){
 | 
								if(x>=beginPos && x<=maxValX){
 | 
				
			||||||
				proj.setForeground(isDragging?dragColor:drawColor);
 | 
									proj.setForeground(isDragging?dragColor:drawColor);
 | 
				
			||||||
				proj.drawLine(x, top, x, area.y+area.height);
 | 
									proj.drawLine(x, top, x, area.y+area.height);
 | 
				
			||||||
				proj.setBackground(drawColor);
 | 
									proj.setBackground(drawColor);
 | 
				
			||||||
				proj.setForeground(textColor);
 | 
									proj.setForeground(textColor);
 | 
				
			||||||
				Double dTime=new Double(time);
 | 
									double dTime=time;
 | 
				
			||||||
				proj.drawText((dTime/waveCanvas.getScaleFactorPow10())+waveCanvas.getUnitStr(), x+1, top);
 | 
									proj.drawText((dTime/waveCanvas.getScaleFactorPow10())+waveCanvas.getUnitStr(), x+1, top);
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -27,7 +27,7 @@ public class ObservableList<E> implements List<E> {
 | 
				
			|||||||
	public static final String CONTENT_PROPERTY = "content";
 | 
						public static final String CONTENT_PROPERTY = "content";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	public ObservableList() {
 | 
						public ObservableList() {
 | 
				
			||||||
		this(new ArrayList<E>());
 | 
							this(new ArrayList<>());
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	public ObservableList(List<E> delegate) {
 | 
						public ObservableList(List<E> delegate) {
 | 
				
			||||||
@@ -100,7 +100,7 @@ public class ObservableList<E> implements List<E> {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
		boolean success = this.delegate.addAll(c);
 | 
							boolean success = this.delegate.addAll(c);
 | 
				
			||||||
		if ((success) && (c != null)) {
 | 
							if ((success) && (c != null)) {
 | 
				
			||||||
			List<E> values = new ArrayList<E>();
 | 
								List<E> values = new ArrayList<>();
 | 
				
			||||||
			for (Iterator<? extends E> i = c.iterator(); i.hasNext();) {
 | 
								for (Iterator<? extends E> i = c.iterator(); i.hasNext();) {
 | 
				
			||||||
				values.add(i.next());
 | 
									values.add(i.next());
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
@@ -118,7 +118,7 @@ public class ObservableList<E> implements List<E> {
 | 
				
			|||||||
		boolean success = this.delegate.addAll(index, c);
 | 
							boolean success = this.delegate.addAll(index, c);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if ((success) && (c != null)) {
 | 
							if ((success) && (c != null)) {
 | 
				
			||||||
			List<E> values = new ArrayList<E>();
 | 
								List<E> values = new ArrayList<>();
 | 
				
			||||||
			for (Iterator<? extends E> i = c.iterator(); i.hasNext();) {
 | 
								for (Iterator<? extends E> i = c.iterator(); i.hasNext();) {
 | 
				
			||||||
				values.add(i.next());
 | 
									values.add(i.next());
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
@@ -133,7 +133,7 @@ public class ObservableList<E> implements List<E> {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	public void clear() {
 | 
						public void clear() {
 | 
				
			||||||
		int oldSize = size();
 | 
							int oldSize = size();
 | 
				
			||||||
		List<E> values = new ArrayList<E>();
 | 
							List<E> values = new ArrayList<>();
 | 
				
			||||||
		values.addAll(this.delegate);
 | 
							values.addAll(this.delegate);
 | 
				
			||||||
		this.delegate.clear();
 | 
							this.delegate.clear();
 | 
				
			||||||
		if (!(values.isEmpty())) {
 | 
							if (!(values.isEmpty())) {
 | 
				
			||||||
@@ -215,8 +215,7 @@ public class ObservableList<E> implements List<E> {
 | 
				
			|||||||
			return false;
 | 
								return false;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		List<E> values = new ArrayList<E>();
 | 
							List<E> values = new ArrayList<>();
 | 
				
			||||||
		if (c != null) {
 | 
					 | 
				
			||||||
		for (Iterator<?> i = c.iterator(); i.hasNext();) {
 | 
							for (Iterator<?> i = c.iterator(); i.hasNext();) {
 | 
				
			||||||
			@SuppressWarnings("unchecked")
 | 
								@SuppressWarnings("unchecked")
 | 
				
			||||||
			E element = (E) i.next();
 | 
								E element = (E) i.next();
 | 
				
			||||||
@@ -224,7 +223,6 @@ public class ObservableList<E> implements List<E> {
 | 
				
			|||||||
				values.add(element);
 | 
									values.add(element);
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
		int oldSize = size();
 | 
							int oldSize = size();
 | 
				
			||||||
		boolean success = this.delegate.removeAll(c);
 | 
							boolean success = this.delegate.removeAll(c);
 | 
				
			||||||
@@ -241,16 +239,14 @@ public class ObservableList<E> implements List<E> {
 | 
				
			|||||||
			return false;
 | 
								return false;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		List<E> values = new ArrayList<E>();
 | 
							List<E> values = new ArrayList<>();
 | 
				
			||||||
		Iterator<? extends E> i;
 | 
							Iterator<? extends E> i;
 | 
				
			||||||
		if (c != null) {
 | 
					 | 
				
			||||||
		for (i = this.delegate.iterator(); i.hasNext();) {
 | 
							for (i = this.delegate.iterator(); i.hasNext();) {
 | 
				
			||||||
			E element = i.next();
 | 
								E element = i.next();
 | 
				
			||||||
			if (!(c.contains(element))) {
 | 
								if (!(c.contains(element))) {
 | 
				
			||||||
				values.add(element);
 | 
									values.add(element);
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
		int oldSize = size();
 | 
							int oldSize = size();
 | 
				
			||||||
		boolean success = this.delegate.retainAll(c);
 | 
							boolean success = this.delegate.retainAll(c);
 | 
				
			||||||
@@ -327,7 +323,7 @@ public class ObservableList<E> implements List<E> {
 | 
				
			|||||||
         */
 | 
					         */
 | 
				
			||||||
        private static final long serialVersionUID = 7819626246672640599L;
 | 
					        private static final long serialVersionUID = 7819626246672640599L;
 | 
				
			||||||
        
 | 
					        
 | 
				
			||||||
        private List<Object> values = new ArrayList<Object>();
 | 
					        private List<Object> values = new ArrayList<>();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        public MultiElementUpdatedEvent(Object source, List<?> values) {
 | 
					        public MultiElementUpdatedEvent(Object source, List<?> values) {
 | 
				
			||||||
            super(source, ObservableList.ChangeType.oldValue, ObservableList.ChangeType.newValue, 0,
 | 
					            super(source, ObservableList.ChangeType.oldValue, ObservableList.ChangeType.newValue, 0,
 | 
				
			||||||
@@ -336,7 +332,7 @@ public class ObservableList<E> implements List<E> {
 | 
				
			|||||||
                this.values.addAll(values);
 | 
					                this.values.addAll(values);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        public List<?> getValues() {
 | 
					        public List<Object> getValues() {
 | 
				
			||||||
            return Collections.unmodifiableList(this.values);
 | 
					            return Collections.unmodifiableList(this.values);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
@@ -347,7 +343,7 @@ public class ObservableList<E> implements List<E> {
 | 
				
			|||||||
		 */
 | 
							 */
 | 
				
			||||||
		private static final long serialVersionUID = 7819626246672640599L;
 | 
							private static final long serialVersionUID = 7819626246672640599L;
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		private List<Object> values = new ArrayList<Object>();
 | 
							private List<Object> values = new ArrayList<>();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		public MultiElementRemovedEvent(Object source, List<?> values) {
 | 
							public MultiElementRemovedEvent(Object source, List<?> values) {
 | 
				
			||||||
			super(source, ObservableList.ChangeType.oldValue, ObservableList.ChangeType.newValue, 0,
 | 
								super(source, ObservableList.ChangeType.oldValue, ObservableList.ChangeType.newValue, 0,
 | 
				
			||||||
@@ -356,7 +352,7 @@ public class ObservableList<E> implements List<E> {
 | 
				
			|||||||
				this.values.addAll(values);
 | 
									this.values.addAll(values);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		public List<?> getValues() {
 | 
							public List<Object> getValues() {
 | 
				
			||||||
			return Collections.unmodifiableList(this.values);
 | 
								return Collections.unmodifiableList(this.values);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
@@ -366,7 +362,7 @@ public class ObservableList<E> implements List<E> {
 | 
				
			|||||||
		 * 
 | 
							 * 
 | 
				
			||||||
		 */
 | 
							 */
 | 
				
			||||||
		private static final long serialVersionUID = -116376519087713082L;
 | 
							private static final long serialVersionUID = -116376519087713082L;
 | 
				
			||||||
		private List<Object> values = new ArrayList<Object>();
 | 
							private List<Object> values = new ArrayList<>();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		public MultiElementAddedEvent(Object source, int index, List<?> values) {
 | 
							public MultiElementAddedEvent(Object source, int index, List<?> values) {
 | 
				
			||||||
			super(source, ObservableList.ChangeType.oldValue, ObservableList.ChangeType.newValue, index,
 | 
								super(source, ObservableList.ChangeType.oldValue, ObservableList.ChangeType.newValue, index,
 | 
				
			||||||
@@ -375,7 +371,7 @@ public class ObservableList<E> implements List<E> {
 | 
				
			|||||||
				this.values.addAll(values);
 | 
									this.values.addAll(values);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		public List<?> getValues() {
 | 
							public List<Object> getValues() {
 | 
				
			||||||
			return Collections.unmodifiableList(this.values);
 | 
								return Collections.unmodifiableList(this.values);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
@@ -385,7 +381,7 @@ public class ObservableList<E> implements List<E> {
 | 
				
			|||||||
		 * 
 | 
							 * 
 | 
				
			||||||
		 */
 | 
							 */
 | 
				
			||||||
		private static final long serialVersionUID = -8654027608903811577L;
 | 
							private static final long serialVersionUID = -8654027608903811577L;
 | 
				
			||||||
		private List<Object> values = new ArrayList<Object>();
 | 
							private List<Object> values = new ArrayList<>();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		public ElementClearedEvent(Object source, List<?> values) {
 | 
							public ElementClearedEvent(Object source, List<?> values) {
 | 
				
			||||||
			super(source, ObservableList.ChangeType.oldValue, ObservableList.ChangeType.newValue, 0,
 | 
								super(source, ObservableList.ChangeType.oldValue, ObservableList.ChangeType.newValue, 0,
 | 
				
			||||||
@@ -394,7 +390,7 @@ public class ObservableList<E> implements List<E> {
 | 
				
			|||||||
				this.values.addAll(values);
 | 
									this.values.addAll(values);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		public List<?> getValues() {
 | 
							public List<Object> getValues() {
 | 
				
			||||||
			return Collections.unmodifiableList(this.values);
 | 
								return Collections.unmodifiableList(this.values);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
@@ -432,7 +428,7 @@ public class ObservableList<E> implements List<E> {
 | 
				
			|||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	public static abstract class ElementEvent extends PropertyChangeEvent {
 | 
						public abstract static class ElementEvent extends PropertyChangeEvent {
 | 
				
			||||||
		/**
 | 
							/**
 | 
				
			||||||
		 * 
 | 
							 * 
 | 
				
			||||||
		 */
 | 
							 */
 | 
				
			||||||
@@ -441,7 +437,7 @@ public class ObservableList<E> implements List<E> {
 | 
				
			|||||||
		private final int index;
 | 
							private final int index;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		public ElementEvent(Object source, Object oldValue, Object newValue, int index, ObservableList.ChangeType type) {
 | 
							public ElementEvent(Object source, Object oldValue, Object newValue, int index, ObservableList.ChangeType type) {
 | 
				
			||||||
			super(source, "content", oldValue, newValue);
 | 
								super(source, CONTENT_PROPERTY, oldValue, newValue);
 | 
				
			||||||
			this.type = type;
 | 
								this.type = type;
 | 
				
			||||||
			this.index = index;
 | 
								this.index = index;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
@@ -463,7 +459,7 @@ public class ObservableList<E> implements List<E> {
 | 
				
			|||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	public static enum ChangeType {
 | 
						public enum ChangeType {
 | 
				
			||||||
		ADDED, UPDATED, REMOVED, CLEARED, MULTI_ADD, MULTI_UPDATED, MULTI_REMOVE, NONE;
 | 
							ADDED, UPDATED, REMOVED, CLEARED, MULTI_ADD, MULTI_UPDATED, MULTI_REMOVE, NONE;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		public static final Object oldValue;
 | 
							public static final Object oldValue;
 | 
				
			||||||
@@ -483,10 +479,10 @@ public class ObservableList<E> implements List<E> {
 | 
				
			|||||||
				return MULTI_REMOVE;
 | 
									return MULTI_REMOVE;
 | 
				
			||||||
			case 6:
 | 
								case 6:
 | 
				
			||||||
				return NONE;
 | 
									return NONE;
 | 
				
			||||||
			case 1:
 | 
								default:
 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
				return UPDATED;
 | 
									return UPDATED;
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		static {
 | 
							static {
 | 
				
			||||||
			oldValue = new Object();
 | 
								oldValue = new Object();
 | 
				
			||||||
@@ -554,6 +550,7 @@ public class ObservableList<E> implements List<E> {
 | 
				
			|||||||
			return this.iterDelegate.next();
 | 
								return this.iterDelegate.next();
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							@Override
 | 
				
			||||||
		public void remove() {
 | 
							public void remove() {
 | 
				
			||||||
			int oldSize = ObservableList.this.size();
 | 
								int oldSize = ObservableList.this.size();
 | 
				
			||||||
			Object element = ObservableList.this.get(this.cursor);
 | 
								Object element = ObservableList.this.get(this.cursor);
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -14,8 +14,8 @@ import org.eclipse.swt.widgets.Label;
 | 
				
			|||||||
import org.eclipse.swt.widgets.List;
 | 
					import org.eclipse.swt.widgets.List;
 | 
				
			||||||
import org.eclipse.swt.widgets.Shell;
 | 
					import org.eclipse.swt.widgets.Shell;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import com.minres.scviewer.database.ITx;
 | 
					import com.minres.scviewer.database.tx.ITx;
 | 
				
			||||||
import com.minres.scviewer.database.ITxRelation;
 | 
					import com.minres.scviewer.database.tx.ITxRelation;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class RelSelectionDialog extends Dialog {
 | 
					class RelSelectionDialog extends Dialog {
 | 
				
			||||||
	private java.util.List<ITxRelation> entries;
 | 
						private java.util.List<ITxRelation> entries;
 | 
				
			||||||
@@ -24,7 +24,7 @@ class RelSelectionDialog extends Dialog {
 | 
				
			|||||||
	
 | 
						
 | 
				
			||||||
	private ITxRelation selected = null;
 | 
						private ITxRelation selected = null;
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	public RelSelectionDialog(Shell shell, ArrayList<ITxRelation> candidates, boolean target) {
 | 
						public RelSelectionDialog(Shell shell, java.util.List<ITxRelation> candidates, boolean target) {
 | 
				
			||||||
		super(shell);
 | 
							super(shell);
 | 
				
			||||||
		entries = candidates;
 | 
							entries = candidates;
 | 
				
			||||||
		entryTx = entries.stream().map(r->target?r.getTarget():r.getSource()).collect(Collectors.toCollection(ArrayList::new));
 | 
							entryTx = entries.stream().map(r->target?r.getTarget():r.getSource()).collect(Collectors.toCollection(ArrayList::new));
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -21,8 +21,8 @@ import org.eclipse.wb.swt.SWTResourceManager;
 | 
				
			|||||||
public class RulerPainter implements IPainter {
 | 
					public class RulerPainter implements IPainter {
 | 
				
			||||||
    protected WaveformCanvas waveCanvas;
 | 
					    protected WaveformCanvas waveCanvas;
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
    static final int rulerTickMinorC = 10;
 | 
					    static final int RULER_TICK_MINOR = 10;
 | 
				
			||||||
    static final int rulerTickMajorC = 100;
 | 
					    static final int RULER_TICK_MAJOR = 100;
 | 
				
			||||||
       
 | 
					       
 | 
				
			||||||
	static final DecimalFormat df = new DecimalFormat("#.00####"); 
 | 
						static final DecimalFormat df = new DecimalFormat("#.00####"); 
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -47,8 +47,8 @@ public class RulerPainter implements IPainter {
 | 
				
			|||||||
        long startVal=startPos - proj.getTranslation().x*scaleFactor;
 | 
					        long startVal=startPos - proj.getTranslation().x*scaleFactor;
 | 
				
			||||||
        long endPos=startPos+area.width*scaleFactor;
 | 
					        long endPos=startPos+area.width*scaleFactor;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        long rulerTickMinor = rulerTickMinorC*scaleFactor;
 | 
					        long rulerTickMinor = RULER_TICK_MINOR*scaleFactor;
 | 
				
			||||||
        long rulerTickMajor = rulerTickMajorC*scaleFactor;
 | 
					        long rulerTickMajor = RULER_TICK_MAJOR*scaleFactor;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        int minorTickY = waveCanvas.rulerHeight-5;
 | 
					        int minorTickY = waveCanvas.rulerHeight-5;
 | 
				
			||||||
        int majorTickY = waveCanvas.rulerHeight-15;
 | 
					        int majorTickY = waveCanvas.rulerHeight-15;
 | 
				
			||||||
@@ -68,13 +68,13 @@ public class RulerPainter implements IPainter {
 | 
				
			|||||||
        gc.drawLine(area.x, area.y+bottom, area.x+area.width, area.y+bottom);
 | 
					        gc.drawLine(area.x, area.y+bottom, area.x+area.width, area.y+bottom);
 | 
				
			||||||
        
 | 
					        
 | 
				
			||||||
        for (long pos = startMinorIncrPos, tick = startMinorIncrVal; pos < endPos; pos+= rulerTickMinor, tick += rulerTickMinor) {
 | 
					        for (long pos = startMinorIncrPos, tick = startMinorIncrVal; pos < endPos; pos+= rulerTickMinor, tick += rulerTickMinor) {
 | 
				
			||||||
            int x0_pos = (int) (pos/scaleFactor);
 | 
					            int x0Pos = (int) (pos/scaleFactor);
 | 
				
			||||||
            long x0_val = tick/scaleFactor;
 | 
					            long x0Val = tick/scaleFactor;
 | 
				
			||||||
            if ((tick % rulerTickMajor) == 0) {
 | 
					            if ((tick % rulerTickMajor) == 0) {
 | 
				
			||||||
                gc.drawText(df.format(x0_val*unitMultiplier)+unit, x0_pos, area.y+textY);
 | 
					                gc.drawText(df.format(x0Val*unitMultiplier)+unit, x0Pos, area.y+textY);
 | 
				
			||||||
                gc.drawLine(x0_pos, area.y+majorTickY, x0_pos,area.y+ bottom);
 | 
					                gc.drawLine(x0Pos, area.y+majorTickY, x0Pos,area.y+ bottom);
 | 
				
			||||||
            } else {
 | 
					            } else {
 | 
				
			||||||
                gc.drawLine(x0_pos, area.y+minorTickY, x0_pos, area.y+bottom);
 | 
					                gc.drawLine(x0Pos, area.y+minorTickY, x0Pos, area.y+bottom);
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -10,6 +10,7 @@
 | 
				
			|||||||
 *******************************************************************************/
 | 
					 *******************************************************************************/
 | 
				
			||||||
package com.minres.scviewer.database.ui.swt.internal;
 | 
					package com.minres.scviewer.database.ui.swt.internal;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import java.util.Arrays;
 | 
				
			||||||
import java.util.Collection;
 | 
					import java.util.Collection;
 | 
				
			||||||
import java.util.Map.Entry;
 | 
					import java.util.Map.Entry;
 | 
				
			||||||
import java.util.NavigableMap;
 | 
					import java.util.NavigableMap;
 | 
				
			||||||
@@ -24,26 +25,28 @@ import org.eclipse.swt.graphics.Point;
 | 
				
			|||||||
import org.eclipse.swt.graphics.Rectangle;
 | 
					import org.eclipse.swt.graphics.Rectangle;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import com.minres.scviewer.database.BitVector;
 | 
					import com.minres.scviewer.database.BitVector;
 | 
				
			||||||
import com.minres.scviewer.database.ISignal;
 | 
					import com.minres.scviewer.database.DoubleVal;
 | 
				
			||||||
 | 
					import com.minres.scviewer.database.IEvent;
 | 
				
			||||||
 | 
					import com.minres.scviewer.database.IWaveform;
 | 
				
			||||||
import com.minres.scviewer.database.ui.TrackEntry;
 | 
					import com.minres.scviewer.database.ui.TrackEntry;
 | 
				
			||||||
import com.minres.scviewer.database.ui.WaveformColors;
 | 
					import com.minres.scviewer.database.ui.WaveformColors;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public class SignalPainter extends TrackPainter {
 | 
					public class SignalPainter extends TrackPainter {
 | 
				
			||||||
	private class SignalChange {
 | 
						private class SignalChange {
 | 
				
			||||||
		long time;
 | 
							long time;
 | 
				
			||||||
		Object value;
 | 
							IEvent value;
 | 
				
			||||||
		boolean fromMap;
 | 
							boolean fromMap;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		public SignalChange(Entry<Long, ?> entry) {
 | 
							public SignalChange(Entry<Long, IEvent[]> entry) {
 | 
				
			||||||
			time = entry.getKey();
 | 
								time = entry.getKey();
 | 
				
			||||||
			value = entry.getValue();
 | 
								value = entry.getValue()[0];
 | 
				
			||||||
			fromMap = true;
 | 
								fromMap = true;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		public void set(Entry<Long, ?> entry, Long actTime) {
 | 
							public void set(Entry<Long, IEvent[]> entry, Long actTime) {
 | 
				
			||||||
			if (entry != null) {
 | 
								if (entry != null) {
 | 
				
			||||||
				time = entry.getKey();
 | 
									time = entry.getKey();
 | 
				
			||||||
				value = entry.getValue();
 | 
									value = entry.getValue()[0];
 | 
				
			||||||
				fromMap = true;
 | 
									fromMap = true;
 | 
				
			||||||
			} else {
 | 
								} else {
 | 
				
			||||||
				time = actTime;
 | 
									time = actTime;
 | 
				
			||||||
@@ -84,11 +87,11 @@ public class SignalPainter extends TrackPainter {
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	public void paintArea(Projection proj, Rectangle area) {
 | 
						public void paintArea(Projection proj, Rectangle area) {
 | 
				
			||||||
		ISignal<?> signal = trackEntry.getSignal();
 | 
							IWaveform signal = trackEntry.waveform;
 | 
				
			||||||
		if (trackEntry.selected)
 | 
							if (trackEntry.selected)
 | 
				
			||||||
			proj.setBackground(this.waveCanvas.colors[WaveformColors.TRACK_BG_HIGHLITE.ordinal()]);
 | 
								proj.setBackground(this.waveCanvas.styleProvider.getColor(WaveformColors.TRACK_BG_HIGHLITE));
 | 
				
			||||||
		else
 | 
							else
 | 
				
			||||||
			proj.setBackground(this.waveCanvas.colors[even ? WaveformColors.TRACK_BG_EVEN.ordinal() : WaveformColors.TRACK_BG_ODD.ordinal()]);
 | 
								proj.setBackground(this.waveCanvas.styleProvider.getColor(even ? WaveformColors.TRACK_BG_EVEN : WaveformColors.TRACK_BG_ODD));
 | 
				
			||||||
		proj.setFillRule(SWT.FILL_EVEN_ODD);
 | 
							proj.setFillRule(SWT.FILL_EVEN_ODD);
 | 
				
			||||||
		proj.fillRectangle(area);
 | 
							proj.fillRectangle(area);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -97,8 +100,8 @@ public class SignalPainter extends TrackPainter {
 | 
				
			|||||||
		long beginTime = beginPos*scaleFactor;
 | 
							long beginTime = beginPos*scaleFactor;
 | 
				
			||||||
        long endTime = beginTime + area.width*scaleFactor;
 | 
					        long endTime = beginTime + area.width*scaleFactor;
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		Entry<Long, ?> first = signal.getEvents().floorEntry(beginTime);
 | 
							Entry<Long, IEvent[]> first = signal.getEvents().floorEntry(beginTime);
 | 
				
			||||||
		Entry<Long, ?> last = signal.getEvents().floorEntry(endTime);
 | 
							Entry<Long, IEvent[]> last = signal.getEvents().floorEntry(endTime);
 | 
				
			||||||
		if (first == null) {
 | 
							if (first == null) {
 | 
				
			||||||
			if (last == null)
 | 
								if (last == null)
 | 
				
			||||||
				return;
 | 
									return;
 | 
				
			||||||
@@ -106,16 +109,16 @@ public class SignalPainter extends TrackPainter {
 | 
				
			|||||||
		} else if (last == null) {
 | 
							} else if (last == null) {
 | 
				
			||||||
			last = signal.getEvents().lastEntry();
 | 
								last = signal.getEvents().lastEntry();
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		proj.setForeground(this.waveCanvas.colors[WaveformColors.LINE.ordinal()]);
 | 
							proj.setForeground(this.waveCanvas.styleProvider.getColor(WaveformColors.LINE));
 | 
				
			||||||
		proj.setLineStyle(SWT.LINE_SOLID);
 | 
							proj.setLineStyle(SWT.LINE_SOLID);
 | 
				
			||||||
		proj.setLineWidth(1);
 | 
							proj.setLineWidth(1);
 | 
				
			||||||
		NavigableMap<Long, ?> entries = signal.getEvents().subMap(first.getKey(), false, last.getKey(), true);
 | 
							NavigableMap<Long, IEvent[]> entries = signal.getEvents().subMap(first.getKey(), false, last.getKey(), true);
 | 
				
			||||||
		SignalChange left = new SignalChange(first);
 | 
							SignalChange left = new SignalChange(first);
 | 
				
			||||||
		SignalChange right = new SignalChange(entries.size() > 0 ? entries.firstEntry() : first);
 | 
							SignalChange right = new SignalChange(entries.size() > 0 ? entries.firstEntry() : first);
 | 
				
			||||||
		maxPosX = area.x + area.width;
 | 
							maxPosX = area.x + area.width;
 | 
				
			||||||
		yOffsetT = this.waveCanvas.getTrackHeight() / 5 + area.y;
 | 
							yOffsetT = this.waveCanvas.styleProvider.getTrackHeight() / 5 + area.y;
 | 
				
			||||||
		yOffsetM = this.waveCanvas.getTrackHeight() / 2 + area.y;
 | 
							yOffsetM = this.waveCanvas.styleProvider.getTrackHeight() / 2 + area.y;
 | 
				
			||||||
		yOffsetB = 4 * this.waveCanvas.getTrackHeight() / 5 + area.y;
 | 
							yOffsetB = 4 * this.waveCanvas.styleProvider.getTrackHeight() / 5 + area.y;
 | 
				
			||||||
		int xSigChangeBeginVal = Math.max(area.x, (int) (left.time / this.waveCanvas.getScaleFactor()));
 | 
							int xSigChangeBeginVal = Math.max(area.x, (int) (left.time / this.waveCanvas.getScaleFactor()));
 | 
				
			||||||
		int xSigChangeBeginPos = area.x;
 | 
							int xSigChangeBeginPos = area.x;
 | 
				
			||||||
		int xSigChangeEndPos = Math.max(area.x, getXPosEnd(right.time));
 | 
							int xSigChangeEndPos = Math.max(area.x, getXPosEnd(right.time));
 | 
				
			||||||
@@ -138,7 +141,7 @@ public class SignalPainter extends TrackPainter {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		SignalStencil stencil = getStencil(proj.getGC(), left, entries);
 | 
							SignalStencil stencil = getStencil(proj.getGC(), left, entries);
 | 
				
			||||||
		do {
 | 
							if(stencil!=null) do {
 | 
				
			||||||
			stencil.draw(proj, area, left.value, right.value, xSigChangeBeginPos, xSigChangeEndPos, multiple);
 | 
								stencil.draw(proj, area, left.value, right.value, xSigChangeBeginPos, xSigChangeEndPos, multiple);
 | 
				
			||||||
			if (right.time >= endTime)
 | 
								if (right.time >= endTime)
 | 
				
			||||||
				break;
 | 
									break;
 | 
				
			||||||
@@ -150,7 +153,7 @@ public class SignalPainter extends TrackPainter {
 | 
				
			|||||||
			if (xSigChangeEndPos == xSigChangeBeginPos) {
 | 
								if (xSigChangeEndPos == xSigChangeBeginPos) {
 | 
				
			||||||
				multiple = true;
 | 
									multiple = true;
 | 
				
			||||||
				long eTime = (xSigChangeBeginPos + 1) * this.waveCanvas.getScaleFactor();
 | 
									long eTime = (xSigChangeBeginPos + 1) * this.waveCanvas.getScaleFactor();
 | 
				
			||||||
				Entry<Long, ?> entry = entries.floorEntry(eTime);
 | 
									Entry<Long, IEvent[]> entry = entries.floorEntry(eTime);
 | 
				
			||||||
				if(entry!=null && entry.getKey()> right.time)
 | 
									if(entry!=null && entry.getKey()> right.time)
 | 
				
			||||||
					right.set(entry, endTime);
 | 
										right.set(entry, endTime);
 | 
				
			||||||
				xSigChangeEndPos = getXPosEnd(eTime);
 | 
									xSigChangeEndPos = getXPosEnd(eTime);
 | 
				
			||||||
@@ -158,8 +161,8 @@ public class SignalPainter extends TrackPainter {
 | 
				
			|||||||
		} while (left.time < endTime);
 | 
							} while (left.time < endTime);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	private SignalStencil getStencil(GC gc, SignalChange left, NavigableMap<Long, ?> entries) {
 | 
						private SignalStencil getStencil(GC gc, SignalChange left, NavigableMap<Long, IEvent[]> entries) {
 | 
				
			||||||
		Object val = left.value;
 | 
							IEvent val = left.value;
 | 
				
			||||||
		if(val instanceof BitVector) {
 | 
							if(val instanceof BitVector) {
 | 
				
			||||||
			BitVector bv = (BitVector) val;
 | 
								BitVector bv = (BitVector) val;
 | 
				
			||||||
			if(bv.getWidth()==1)
 | 
								if(bv.getWidth()==1)
 | 
				
			||||||
@@ -170,7 +173,7 @@ public class SignalPainter extends TrackPainter {
 | 
				
			|||||||
				return new MultiBitStencilAnalog(entries, left.value, 
 | 
									return new MultiBitStencilAnalog(entries, left.value, 
 | 
				
			||||||
						trackEntry.waveDisplay==TrackEntry.WaveDisplay.CONTINOUS,
 | 
											trackEntry.waveDisplay==TrackEntry.WaveDisplay.CONTINOUS,
 | 
				
			||||||
						trackEntry.valueDisplay==TrackEntry.ValueDisplay.SIGNED);
 | 
											trackEntry.valueDisplay==TrackEntry.ValueDisplay.SIGNED);
 | 
				
			||||||
		} else if (val instanceof Double)
 | 
							} else if (val instanceof DoubleVal)
 | 
				
			||||||
			return new RealStencil(entries, left.value, trackEntry.waveDisplay==TrackEntry.WaveDisplay.CONTINOUS);
 | 
								return new RealStencil(entries, left.value, trackEntry.waveDisplay==TrackEntry.WaveDisplay.CONTINOUS);
 | 
				
			||||||
		else
 | 
							else
 | 
				
			||||||
			return null;
 | 
								return null;
 | 
				
			||||||
@@ -178,7 +181,7 @@ public class SignalPainter extends TrackPainter {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	private interface SignalStencil {
 | 
						private interface SignalStencil {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		public void draw(Projection proj, Rectangle area, Object left, Object right, int xBegin, int xEnd, boolean multiple);
 | 
							public void draw(Projection proj, Rectangle area, IEvent left, IEvent right, int xBegin, int xEnd, boolean multiple);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	private class MultiBitStencil implements SignalStencil {
 | 
						private class MultiBitStencil implements SignalStencil {
 | 
				
			||||||
@@ -192,13 +195,13 @@ public class SignalPainter extends TrackPainter {
 | 
				
			|||||||
			tmpAwtFont = new java.awt.Font(fd.getName(), fd.getStyle(), height);
 | 
								tmpAwtFont = new java.awt.Font(fd.getName(), fd.getStyle(), height);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		public void draw(Projection proj, Rectangle area, Object left, Object right, int xBegin, int xEnd, boolean multiple) {
 | 
							public void draw(Projection proj, Rectangle area, IEvent left, IEvent right, int xBegin, int xEnd, boolean multiple) {
 | 
				
			||||||
			Color colorBorder = waveCanvas.colors[WaveformColors.SIGNAL0.ordinal()];
 | 
								Color colorBorder = waveCanvas.styleProvider.getColor(WaveformColors.SIGNAL0);
 | 
				
			||||||
			BitVector last = (BitVector) left;
 | 
								BitVector last = (BitVector) left;
 | 
				
			||||||
			if (last.getValue().toString().contains("X")) {
 | 
								if (Arrays.toString(last.getValue()).contains("X")) {
 | 
				
			||||||
				colorBorder = waveCanvas.colors[WaveformColors.SIGNALX.ordinal()];
 | 
									colorBorder = waveCanvas.styleProvider.getColor(WaveformColors.SIGNALX);
 | 
				
			||||||
			} else if (last.getValue().toString().contains("Z")) {
 | 
								} else if (Arrays.toString(last.getValue()).contains("Z")) {
 | 
				
			||||||
				colorBorder = waveCanvas.colors[WaveformColors.SIGNALZ.ordinal()];
 | 
									colorBorder = waveCanvas.styleProvider.getColor(WaveformColors.SIGNALZ);
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			int width = xEnd - xBegin;
 | 
								int width = xEnd - xBegin;
 | 
				
			||||||
			if (width > 1) {
 | 
								if (width > 1) {
 | 
				
			||||||
@@ -212,8 +215,7 @@ public class SignalPainter extends TrackPainter {
 | 
				
			|||||||
				};
 | 
									};
 | 
				
			||||||
				proj.setForeground(colorBorder);
 | 
									proj.setForeground(colorBorder);
 | 
				
			||||||
				proj.drawPolygon(points);
 | 
									proj.drawPolygon(points);
 | 
				
			||||||
				proj.setForeground(waveCanvas.colors[WaveformColors.SIGNAL_TEXT.ordinal()]);
 | 
									proj.setForeground(waveCanvas.styleProvider.getColor(WaveformColors.SIGNAL_TEXT));
 | 
				
			||||||
				//TODO: this code should be provided from a central location
 | 
					 | 
				
			||||||
				String label = null;
 | 
									String label = null;
 | 
				
			||||||
				switch(trackEntry.valueDisplay) {
 | 
									switch(trackEntry.valueDisplay) {
 | 
				
			||||||
				case SIGNED:
 | 
									case SIGNED:
 | 
				
			||||||
@@ -247,18 +249,20 @@ public class SignalPainter extends TrackPainter {
 | 
				
			|||||||
	private class MultiBitStencilAnalog implements SignalStencil {
 | 
						private class MultiBitStencilAnalog implements SignalStencil {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		final boolean continous;
 | 
							final boolean continous;
 | 
				
			||||||
 | 
							final boolean signed;
 | 
				
			||||||
 | 
							private long maxVal;
 | 
				
			||||||
		private long minVal;
 | 
							private long minVal;
 | 
				
			||||||
		private long range;
 | 
					 | 
				
			||||||
		double yRange = (yOffsetB-yOffsetT);
 | 
							double yRange = (yOffsetB-yOffsetT);
 | 
				
			||||||
		public MultiBitStencilAnalog(NavigableMap<Long, ?> entries, Object left, boolean continous, boolean signed) {
 | 
							public MultiBitStencilAnalog(NavigableMap<Long, IEvent[]> entries, Object left, boolean continous, boolean signed) {
 | 
				
			||||||
			this.continous=continous;
 | 
								this.continous=continous;
 | 
				
			||||||
			Collection<?> values = ((NavigableMap<Long, ?>) entries).values();
 | 
								this.signed=signed;
 | 
				
			||||||
			minVal=((BitVector) left).toUnsignedValue();
 | 
								Collection<IEvent[]> values = entries.values();
 | 
				
			||||||
			range=2;
 | 
								minVal=signed?((BitVector)left).toSignedValue():((BitVector)left).toUnsignedValue();
 | 
				
			||||||
			if(!values.isEmpty()) {
 | 
								if(!values.isEmpty()) {
 | 
				
			||||||
				long maxVal=minVal;
 | 
									maxVal=minVal;
 | 
				
			||||||
				for (Object e : entries.values()) {
 | 
									for (IEvent[] tp : entries.values())
 | 
				
			||||||
					long v = ((BitVector)e).toUnsignedValue();
 | 
										for(IEvent e: tp) {
 | 
				
			||||||
 | 
											long v = signed?((BitVector)e).toSignedValue():((BitVector)e).toUnsignedValue();
 | 
				
			||||||
						maxVal=Math.max(maxVal, v);
 | 
											maxVal=Math.max(maxVal, v);
 | 
				
			||||||
						minVal=Math.min(minVal, v);
 | 
											minVal=Math.min(minVal, v);
 | 
				
			||||||
					}
 | 
										}
 | 
				
			||||||
@@ -266,16 +270,18 @@ public class SignalPainter extends TrackPainter {
 | 
				
			|||||||
					maxVal--;
 | 
										maxVal--;
 | 
				
			||||||
					minVal++;
 | 
										minVal++;
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
				range = maxVal-minVal;
 | 
								} else {
 | 
				
			||||||
			} else
 | 
					 | 
				
			||||||
				minVal--;
 | 
									minVal--;
 | 
				
			||||||
 | 
									maxVal=minVal+2;
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
			
 | 
								
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		public void draw(Projection proj, Rectangle area, Object left, Object right, int xBegin, int xEnd, boolean multiple) {
 | 
							public void draw(Projection proj, Rectangle area, IEvent left, IEvent right, int xBegin, int xEnd, boolean multiple) {
 | 
				
			||||||
			long leftVal = ((BitVector) left).toUnsignedValue();
 | 
								long leftVal = signed?((BitVector)left).toSignedValue():((BitVector)left).toUnsignedValue();
 | 
				
			||||||
			long rightVal= ((BitVector) right).toUnsignedValue();
 | 
								long rightVal= signed?((BitVector)right).toSignedValue():((BitVector)right).toUnsignedValue();
 | 
				
			||||||
			proj.setForeground(waveCanvas.colors[WaveformColors.SIGNAL_REAL.ordinal()]);
 | 
								proj.setForeground(waveCanvas.styleProvider.getColor(WaveformColors.SIGNAL_REAL));
 | 
				
			||||||
 | 
								long range = maxVal-minVal;
 | 
				
			||||||
			int yOffsetLeft = (int) ((leftVal-minVal) * yRange / range);
 | 
								int yOffsetLeft = (int) ((leftVal-minVal) * yRange / range);
 | 
				
			||||||
			int yOffsetRight = (int) ((rightVal-minVal) * yRange / range);
 | 
								int yOffsetRight = (int) ((rightVal-minVal) * yRange / range);
 | 
				
			||||||
			if(continous) {
 | 
								if(continous) {
 | 
				
			||||||
@@ -298,26 +304,26 @@ public class SignalPainter extends TrackPainter {
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	private class SingleBitStencil implements SignalStencil {
 | 
						private class SingleBitStencil implements SignalStencil {
 | 
				
			||||||
		public void draw(Projection proj, Rectangle area, Object left, Object right, int xBegin, int xEnd, boolean multiple) {
 | 
							public void draw(Projection proj, Rectangle area, IEvent left, IEvent right, int xBegin, int xEnd, boolean multiple) {
 | 
				
			||||||
			if (multiple) {
 | 
								if (multiple) {
 | 
				
			||||||
				proj.setForeground(waveCanvas.colors[WaveformColors.SIGNALU.ordinal()]);
 | 
									proj.setForeground(waveCanvas.styleProvider.getColor(WaveformColors.SIGNALU));
 | 
				
			||||||
				proj.drawLine(xBegin, yOffsetT, xBegin, yOffsetB);
 | 
									proj.drawLine(xBegin, yOffsetT, xBegin, yOffsetB);
 | 
				
			||||||
				if(xEnd>xBegin) 
 | 
									if(xEnd>xBegin) 
 | 
				
			||||||
					proj.drawLine(xEnd, yOffsetT, xEnd, yOffsetB);
 | 
										proj.drawLine(xEnd, yOffsetT, xEnd, yOffsetB);
 | 
				
			||||||
			} else {
 | 
								} else {
 | 
				
			||||||
				Color color = waveCanvas.colors[WaveformColors.SIGNALX.ordinal()];
 | 
									Color color = waveCanvas.styleProvider.getColor(WaveformColors.SIGNALX);
 | 
				
			||||||
				int yOffset = yOffsetM;
 | 
									int yOffset = yOffsetM;
 | 
				
			||||||
				switch (((BitVector) left).getValue()[0]) {
 | 
									switch (((BitVector) left).getValue()[0]) {
 | 
				
			||||||
				case '1':
 | 
									case '1':
 | 
				
			||||||
					color = waveCanvas.colors[WaveformColors.SIGNAL1.ordinal()];
 | 
										color = waveCanvas.styleProvider.getColor(WaveformColors.SIGNAL1);
 | 
				
			||||||
					yOffset = yOffsetT;
 | 
										yOffset = yOffsetT;
 | 
				
			||||||
					break;
 | 
										break;
 | 
				
			||||||
				case '0':
 | 
									case '0':
 | 
				
			||||||
					color = waveCanvas.colors[WaveformColors.SIGNAL0.ordinal()];
 | 
										color = waveCanvas.styleProvider.getColor(WaveformColors.SIGNAL0);
 | 
				
			||||||
					yOffset = yOffsetB;
 | 
										yOffset = yOffsetB;
 | 
				
			||||||
					break;
 | 
										break;
 | 
				
			||||||
				case 'Z':
 | 
									case 'Z':
 | 
				
			||||||
					color = waveCanvas.colors[WaveformColors.SIGNALZ.ordinal()];
 | 
										color = waveCanvas.styleProvider.getColor(WaveformColors.SIGNALZ);
 | 
				
			||||||
					break;
 | 
										break;
 | 
				
			||||||
				default:
 | 
									default:
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
@@ -345,21 +351,23 @@ public class SignalPainter extends TrackPainter {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	private class RealStencil implements SignalStencil {
 | 
						private class RealStencil implements SignalStencil {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		double minVal, range;
 | 
							double minVal;
 | 
				
			||||||
 | 
							double range;
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		final double scaleFactor = 1.05;
 | 
							final double scaleFactor = 1.05;
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		boolean continous=true;
 | 
							boolean continous=true;
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		public RealStencil(NavigableMap<Long, ?> entries, Object left, boolean continous) {
 | 
							public RealStencil(NavigableMap<Long, IEvent[]> entries, Object left, boolean continous) {
 | 
				
			||||||
			this.continous=continous;
 | 
								this.continous=continous;
 | 
				
			||||||
			Collection<?> values = ((NavigableMap<Long, ?>) entries).values();
 | 
								Collection<IEvent[]> values = entries.values();
 | 
				
			||||||
			minVal=(Double) left;
 | 
								minVal=(Double) left;
 | 
				
			||||||
			range=2.0;
 | 
								range=2.0;
 | 
				
			||||||
			if(!values.isEmpty()) {
 | 
								if(!values.isEmpty()) {
 | 
				
			||||||
				double maxVal=minVal;
 | 
									double maxVal=minVal;
 | 
				
			||||||
				for (Object e : entries.values()) {
 | 
									for (IEvent[] val : entries.values())
 | 
				
			||||||
					double v = ((Double)e);
 | 
										for(IEvent e:val) {
 | 
				
			||||||
 | 
											double v = ((DoubleVal)e).value;
 | 
				
			||||||
						if(Double.isNaN(maxVal))
 | 
											if(Double.isNaN(maxVal))
 | 
				
			||||||
							maxVal=v;
 | 
												maxVal=v;
 | 
				
			||||||
						else if(!Double.isNaN(v))
 | 
											else if(!Double.isNaN(v))
 | 
				
			||||||
@@ -378,11 +386,11 @@ public class SignalPainter extends TrackPainter {
 | 
				
			|||||||
			}
 | 
								}
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		public void draw(Projection proj, Rectangle area, Object left, Object right, int xBegin, int xEnd, boolean multiple) {
 | 
							public void draw(Projection proj, Rectangle area, IEvent left, IEvent right, int xBegin, int xEnd, boolean multiple) {
 | 
				
			||||||
			double leftVal = (Double) left;
 | 
								double leftVal = ((DoubleVal) left).value;
 | 
				
			||||||
			double rightVal= (Double) right;
 | 
								double rightVal= ((DoubleVal) right).value;
 | 
				
			||||||
			if(Double.isNaN(leftVal)) {
 | 
								if(Double.isNaN(leftVal)) {
 | 
				
			||||||
				Color color = waveCanvas.colors[WaveformColors.SIGNAL_NAN.ordinal()];
 | 
									Color color = waveCanvas.styleProvider.getColor(WaveformColors.SIGNAL_NAN);
 | 
				
			||||||
				int width = xEnd - xBegin;
 | 
									int width = xEnd - xBegin;
 | 
				
			||||||
				if (width > 1) {
 | 
									if (width > 1) {
 | 
				
			||||||
					int[] points = { 
 | 
										int[] points = { 
 | 
				
			||||||
@@ -400,7 +408,7 @@ public class SignalPainter extends TrackPainter {
 | 
				
			|||||||
					proj.drawLine(xEnd, yOffsetT, xEnd, yOffsetB);
 | 
										proj.drawLine(xEnd, yOffsetT, xEnd, yOffsetB);
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
			} else {				
 | 
								} else {				
 | 
				
			||||||
				proj.setForeground(waveCanvas.colors[WaveformColors.SIGNAL_REAL.ordinal()]);
 | 
									proj.setForeground(waveCanvas.styleProvider.getColor(WaveformColors.SIGNAL_REAL));
 | 
				
			||||||
				int yOffsetLeft = (int) ((leftVal-minVal) * (yOffsetB-yOffsetT) / range);
 | 
									int yOffsetLeft = (int) ((leftVal-minVal) * (yOffsetB-yOffsetT) / range);
 | 
				
			||||||
				int yOffsetRight = Double.isNaN(rightVal)?yOffsetLeft:(int) ((rightVal-minVal) * (yOffsetB-yOffsetT) / range);
 | 
									int yOffsetRight = Double.isNaN(rightVal)?yOffsetLeft:(int) ((rightVal-minVal) * (yOffsetB-yOffsetT) / range);
 | 
				
			||||||
				if(continous) {
 | 
									if(continous) {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -11,19 +11,20 @@
 | 
				
			|||||||
package com.minres.scviewer.database.ui.swt.internal;
 | 
					package com.minres.scviewer.database.ui.swt.internal;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import java.util.Collection;
 | 
					import java.util.Collection;
 | 
				
			||||||
import java.util.List;
 | 
					 | 
				
			||||||
import java.util.Map.Entry;
 | 
					import java.util.Map.Entry;
 | 
				
			||||||
import java.util.NavigableMap;
 | 
					import java.util.NavigableMap;
 | 
				
			||||||
import java.util.TreeSet;
 | 
					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.Color;
 | 
				
			||||||
import org.eclipse.swt.graphics.Point;
 | 
					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.EventKind;
 | 
				
			||||||
import com.minres.scviewer.database.ITxEvent;
 | 
					import com.minres.scviewer.database.IEvent;
 | 
				
			||||||
import com.minres.scviewer.database.ITxStream;
 | 
					import com.minres.scviewer.database.IWaveform;
 | 
				
			||||||
 | 
					import com.minres.scviewer.database.tx.ITx;
 | 
				
			||||||
 | 
					import com.minres.scviewer.database.tx.ITxEvent;
 | 
				
			||||||
import com.minres.scviewer.database.ui.TrackEntry;
 | 
					import com.minres.scviewer.database.ui.TrackEntry;
 | 
				
			||||||
import com.minres.scviewer.database.ui.WaveformColors;
 | 
					import com.minres.scviewer.database.ui.WaveformColors;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -33,50 +34,35 @@ public class StreamPainter extends TrackPainter{
 | 
				
			|||||||
	 * 
 | 
						 * 
 | 
				
			||||||
	 */
 | 
						 */
 | 
				
			||||||
	private final WaveformCanvas waveCanvas;
 | 
						private final WaveformCanvas waveCanvas;
 | 
				
			||||||
	private ITxStream<? extends ITxEvent> stream;
 | 
						private IWaveform stream;
 | 
				
			||||||
	private int txBase, txHeight;
 | 
						private int txBase;
 | 
				
			||||||
	private boolean even;
 | 
						private int txHeight;
 | 
				
			||||||
	private TreeSet<ITx> seenTx;
 | 
						private TreeSet<ITx> seenTx;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	public StreamPainter(WaveformCanvas waveCanvas, boolean even, TrackEntry trackEntry) {
 | 
						public StreamPainter(WaveformCanvas waveCanvas, boolean even, TrackEntry trackEntry) {
 | 
				
			||||||
		super(trackEntry, even);
 | 
							super(trackEntry, even);
 | 
				
			||||||
		this.waveCanvas = waveCanvas;
 | 
							this.waveCanvas = waveCanvas;
 | 
				
			||||||
		this.stream=trackEntry.getStream();
 | 
							this.stream=trackEntry.waveform;
 | 
				
			||||||
		this.seenTx=new TreeSet<ITx>();
 | 
							this.seenTx=new TreeSet<>();
 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
    
 | 
					 | 
				
			||||||
	/*
 | 
					 | 
				
			||||||
	 * convert java.awt.Color to org.eclipse.swt.graphics.Color 
 | 
					 | 
				
			||||||
	 */
 | 
					 | 
				
			||||||
	static org.eclipse.swt.graphics.Color toSwtColor( GC gc, java.awt.Color awtColor ){
 | 
					 | 
				
			||||||
		return new org.eclipse.swt.graphics.Color( gc.getDevice(), awtColor.getRed(), awtColor.getGreen(), awtColor.getBlue() );
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	static org.eclipse.swt.graphics.Color[] toSwtColors( GC gc, java.awt.Color[] awtColors ){
 | 
					 | 
				
			||||||
		org.eclipse.swt.graphics.Color[] swtColors = new org.eclipse.swt.graphics.Color[awtColors.length];
 | 
					 | 
				
			||||||
		for( int i=0; i<awtColors.length; i++ )
 | 
					 | 
				
			||||||
			swtColors[i] = toSwtColor( gc, awtColors[i] );
 | 
					 | 
				
			||||||
		return swtColors;
 | 
					 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	@SuppressWarnings("unchecked")
 | 
						@SuppressWarnings("unchecked")
 | 
				
			||||||
	public void paintArea(Projection proj, Rectangle area) {
 | 
						public void paintArea(Projection proj, Rectangle area) {
 | 
				
			||||||
		if(stream.getEvents().size()==0) return;
 | 
							if(stream.getEvents().size()==0) return;
 | 
				
			||||||
		int trackHeight=trackEntry.height/stream.getMaxConcurrency();
 | 
							int trackHeight=trackEntry.height/stream.getWidth();
 | 
				
			||||||
		txBase=trackHeight/5;
 | 
							txBase=trackHeight/5;
 | 
				
			||||||
		txHeight=trackHeight*3/5;
 | 
							txHeight=trackHeight*3/5;
 | 
				
			||||||
		if(trackEntry.selected) {
 | 
							if(trackEntry.selected) {
 | 
				
			||||||
			proj.setBackground(this.waveCanvas.colors[WaveformColors.TRACK_BG_HIGHLITE.ordinal()]);
 | 
								proj.setBackground(this.waveCanvas.styleProvider.getColor(WaveformColors.TRACK_BG_HIGHLITE));
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		else
 | 
							else
 | 
				
			||||||
			proj.setBackground(this.waveCanvas.colors[even?WaveformColors.TRACK_BG_EVEN.ordinal():WaveformColors.TRACK_BG_ODD.ordinal()]);
 | 
								proj.setBackground(this.waveCanvas.styleProvider.getColor(even?WaveformColors.TRACK_BG_EVEN:WaveformColors.TRACK_BG_ODD));
 | 
				
			||||||
		proj.setFillRule(SWT.FILL_EVEN_ODD);
 | 
							proj.setFillRule(SWT.FILL_EVEN_ODD);
 | 
				
			||||||
		proj.fillRectangle(area);
 | 
							proj.fillRectangle(area);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		long scaleFactor = this.waveCanvas.getScaleFactor();
 | 
							long scaleFactor = this.waveCanvas.getScaleFactor();
 | 
				
			||||||
		long beginPos = area.x;
 | 
							long beginPos = area.x;
 | 
				
			||||||
		long beginTime = beginPos*scaleFactor;
 | 
							long beginTime = beginPos*scaleFactor;
 | 
				
			||||||
		//long endPos = beginPos + area.width;
 | 
					 | 
				
			||||||
		long endTime = beginTime + area.width*scaleFactor;
 | 
							long endTime = beginTime + area.width*scaleFactor;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		Entry<Long, ?> firstTx=stream.getEvents().floorEntry(beginTime);
 | 
							Entry<Long, ?> firstTx=stream.getEvents().floorEntry(beginTime);
 | 
				
			||||||
@@ -86,7 +72,7 @@ public class StreamPainter extends TrackPainter{
 | 
				
			|||||||
		proj.setFillRule(SWT.FILL_EVEN_ODD);
 | 
							proj.setFillRule(SWT.FILL_EVEN_ODD);
 | 
				
			||||||
		proj.setLineStyle(SWT.LINE_SOLID);
 | 
							proj.setLineStyle(SWT.LINE_SOLID);
 | 
				
			||||||
		proj.setLineWidth(1);
 | 
							proj.setLineWidth(1);
 | 
				
			||||||
		proj.setForeground(this.waveCanvas.colors[WaveformColors.LINE.ordinal()]);
 | 
							proj.setForeground(this.waveCanvas.styleProvider.getColor(WaveformColors.LINE));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		for( int y1=area.y+trackHeight/2; y1<area.y+trackEntry.height; y1+=trackHeight)
 | 
							for( int y1=area.y+trackHeight/2; y1<area.y+trackEntry.height; y1+=trackHeight)
 | 
				
			||||||
			proj.drawLine(area.x, y1, area.x+area.width, y1);
 | 
								proj.drawLine(area.x, y1, area.x+area.width, y1);
 | 
				
			||||||
@@ -95,15 +81,16 @@ public class StreamPainter extends TrackPainter{
 | 
				
			|||||||
				drawTx(proj, area, txEvent.getTransaction(), false);
 | 
									drawTx(proj, area, txEvent.getTransaction(), false);
 | 
				
			||||||
		}else{
 | 
							}else{
 | 
				
			||||||
			seenTx.clear();
 | 
								seenTx.clear();
 | 
				
			||||||
			NavigableMap<Long,?> entries = stream.getEvents().subMap(firstTx.getKey(), true, lastTx.getKey(), true);
 | 
								NavigableMap<Long, IEvent[]> entries = stream.getEvents().subMap(firstTx.getKey(), true, lastTx.getKey(), true);
 | 
				
			||||||
			boolean highlighed=false;
 | 
								boolean highlighed=false;
 | 
				
			||||||
	        proj.setForeground(this.waveCanvas.colors[WaveformColors.LINE.ordinal()]);
 | 
								proj.setForeground(this.waveCanvas.styleProvider.getColor(WaveformColors.LINE));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	        for(Entry<Long, ?> entry: entries.entrySet())
 | 
								for(Entry<Long, IEvent[]> entry: entries.entrySet())
 | 
				
			||||||
				for(ITxEvent txEvent:(Collection<?  extends ITxEvent>)entry.getValue()){
 | 
									for(IEvent evt:entry.getValue()){
 | 
				
			||||||
					if(txEvent.getType()==ITxEvent.Type.BEGIN)
 | 
										ITxEvent txEvent = (ITxEvent) evt;
 | 
				
			||||||
 | 
										if(txEvent.getKind()==EventKind.BEGIN)
 | 
				
			||||||
						seenTx.add(txEvent.getTransaction());
 | 
											seenTx.add(txEvent.getTransaction());
 | 
				
			||||||
					if(txEvent.getType()==ITxEvent.Type.END){
 | 
										if(txEvent.getKind()==EventKind.END){
 | 
				
			||||||
						ITx tx = txEvent.getTransaction();
 | 
											ITx tx = txEvent.getTransaction();
 | 
				
			||||||
						highlighed|=waveCanvas.currentSelection!=null && waveCanvas.currentSelection.equals(tx);
 | 
											highlighed|=waveCanvas.currentSelection!=null && waveCanvas.currentSelection.equals(tx);
 | 
				
			||||||
						drawTx(proj, area, tx, false);
 | 
											drawTx(proj, area, tx, false);
 | 
				
			||||||
@@ -114,7 +101,7 @@ public class StreamPainter extends TrackPainter{
 | 
				
			|||||||
				drawTx(proj, area, tx, false);
 | 
									drawTx(proj, area, tx, false);
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			if(highlighed){
 | 
								if(highlighed){
 | 
				
			||||||
		        proj.setForeground(this.waveCanvas.colors[WaveformColors.LINE_HIGHLITE.ordinal()]);
 | 
									proj.setForeground(this.waveCanvas.styleProvider.getColor(WaveformColors.LINE_HIGHLITE));
 | 
				
			||||||
				drawTx(proj, area, waveCanvas.currentSelection, true);
 | 
									drawTx(proj, area, waveCanvas.currentSelection, true);
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
@@ -122,12 +109,11 @@ public class StreamPainter extends TrackPainter{
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	protected void drawTx(Projection proj, Rectangle area, ITx tx, boolean highlighted ) {
 | 
						protected void drawTx(Projection proj, Rectangle area, ITx tx, boolean highlighted ) {
 | 
				
			||||||
		// compute colors
 | 
							// compute colors
 | 
				
			||||||
        java.awt.Color[] fallbackColors = trackEntry.getColors();
 | 
							Color[] transColor = waveCanvas.styleProvider.computeColor( tx.getGenerator().getName());
 | 
				
			||||||
        java.awt.Color[] transColor = TrackEntry.computeColor( tx.getGenerator().getName(), fallbackColors[0], fallbackColors[1] );
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
        proj.setBackground( toSwtColor( proj.getGC(), transColor[highlighted?1:0] ) );
 | 
							proj.setBackground(transColor[highlighted?1:0]);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		int offset = tx.getConcurrencyIndex()*this.waveCanvas.getTrackHeight();
 | 
							int offset = tx.getConcurrencyIndex()*this.waveCanvas.styleProvider.getTrackHeight();
 | 
				
			||||||
		Rectangle bb = new Rectangle(
 | 
							Rectangle bb = new Rectangle(
 | 
				
			||||||
				(int)(tx.getBeginTime()/this.waveCanvas.getScaleFactor()), area.y+offset+txBase,
 | 
									(int)(tx.getBeginTime()/this.waveCanvas.getScaleFactor()), area.y+offset+txBase,
 | 
				
			||||||
				(int)((tx.getEndTime()-tx.getBeginTime())/this.waveCanvas.getScaleFactor()), txHeight);
 | 
									(int)((tx.getEndTime()-tx.getBeginTime())/this.waveCanvas.getScaleFactor()), txHeight);
 | 
				
			||||||
@@ -140,11 +126,11 @@ public class StreamPainter extends TrackPainter{
 | 
				
			|||||||
				bb.width = bb.width-(area.x-bb.x)+5;
 | 
									bb.width = bb.width-(area.x-bb.x)+5;
 | 
				
			||||||
				bb.x=area.x-5;
 | 
									bb.x=area.x-5;
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			int bb_x2 = bb.x+bb.width;
 | 
								int bbX2 = bb.x+bb.width;
 | 
				
			||||||
			int area_x2 = area.x+area.width;
 | 
								int areaX2 = area.x+area.width;
 | 
				
			||||||
			if(bb_x2>area_x2){
 | 
								if(bbX2>areaX2){
 | 
				
			||||||
				bb_x2=area_x2+5;
 | 
									bbX2=areaX2+5;
 | 
				
			||||||
				bb.width= bb_x2-bb.x;
 | 
									bb.width= bbX2-bb.x;
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			int arc = bb.width<10?1:5;
 | 
								int arc = bb.width<10?1:5;
 | 
				
			||||||
			proj.fillRoundRectangle(bb.x, bb.y, bb.width, bb.height, arc, arc);
 | 
								proj.fillRoundRectangle(bb.x, bb.y, bb.width, bb.height, arc, arc);
 | 
				
			||||||
@@ -153,8 +139,8 @@ public class StreamPainter extends TrackPainter{
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	public ITx getClicked(Point point) {
 | 
						public ITx getClicked(Point point) {
 | 
				
			||||||
		int lane=point.y/waveCanvas.getTrackHeight();
 | 
							int lane=point.y/waveCanvas.styleProvider.getTrackHeight();
 | 
				
			||||||
		Entry<Long, List<ITxEvent>> firstTx=stream.getEvents().floorEntry(point.x*waveCanvas.getScaleFactor());
 | 
							Entry<Long, IEvent[]> firstTx=stream.getEvents().floorEntry(point.x*waveCanvas.getScaleFactor());
 | 
				
			||||||
		if(firstTx!=null){
 | 
							if(firstTx!=null){
 | 
				
			||||||
			do {
 | 
								do {
 | 
				
			||||||
				ITx tx = getTxFromEntry(lane, point.x, firstTx);
 | 
									ITx tx = getTxFromEntry(lane, point.x, firstTx);
 | 
				
			||||||
@@ -165,29 +151,33 @@ public class StreamPainter extends TrackPainter{
 | 
				
			|||||||
		return null;
 | 
							return null;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	public ITxStream<? extends ITxEvent> getStream() {
 | 
						public IWaveform getStream() {
 | 
				
			||||||
		return stream;
 | 
							return stream;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	public void setStream(ITxStream<? extends ITxEvent> stream) {
 | 
						public void setStream(IWaveform stream) {
 | 
				
			||||||
		this.stream = stream;
 | 
							this.stream = stream;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	protected ITx getTxFromEntry(int lane, int offset, Entry<Long, List<ITxEvent>> firstTx) {
 | 
						protected ITx getTxFromEntry(int lane, int offset, Entry<Long, IEvent[]> firstTx) {
 | 
				
			||||||
		long timePoint=offset*waveCanvas.getScaleFactor();
 | 
							long timePoint=offset*waveCanvas.getScaleFactor();
 | 
				
			||||||
		for(ITxEvent evt:firstTx.getValue()){
 | 
							for(IEvent evt:firstTx.getValue()){
 | 
				
			||||||
		    ITx tx=evt.getTransaction();
 | 
								if(evt instanceof ITxEvent) {
 | 
				
			||||||
			if(evt.getType()==ITxEvent.Type.BEGIN && tx.getConcurrencyIndex()==lane && tx.getBeginTime()<=timePoint && tx.getEndTime()>=timePoint){
 | 
									ITx tx=((ITxEvent)evt).getTransaction();
 | 
				
			||||||
				return evt.getTransaction();
 | 
									if(evt.getKind()==EventKind.BEGIN && tx.getConcurrencyIndex()==lane && tx.getBeginTime()<=timePoint && tx.getEndTime()>=timePoint){
 | 
				
			||||||
 | 
										return ((ITxEvent)evt).getTransaction();
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		// now with some fuzziness
 | 
							// now with some fuzziness
 | 
				
			||||||
		timePoint=(offset-5)*waveCanvas.getScaleFactor();
 | 
							timePoint=(offset-5)*waveCanvas.getScaleFactor();
 | 
				
			||||||
		long timePointHigh=(offset+5)*waveCanvas.getScaleFactor();
 | 
							long timePointHigh=(offset+5)*waveCanvas.getScaleFactor();
 | 
				
			||||||
        for(ITxEvent evt:firstTx.getValue()){
 | 
							for(IEvent evt:firstTx.getValue()){
 | 
				
			||||||
            ITx tx=evt.getTransaction();
 | 
								if(evt instanceof ITxEvent) {
 | 
				
			||||||
            if(evt.getType()==ITxEvent.Type.BEGIN && tx.getConcurrencyIndex()==lane && tx.getBeginTime()<=timePointHigh && tx.getEndTime()>=timePoint){
 | 
									ITx tx=((ITxEvent)evt).getTransaction();
 | 
				
			||||||
                return evt.getTransaction();
 | 
									if(evt.getKind()==EventKind.BEGIN && tx.getConcurrencyIndex()==lane && tx.getBeginTime()<=timePointHigh && tx.getEndTime()>=timePoint){
 | 
				
			||||||
 | 
										return ((ITxEvent)evt).getTransaction();
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		return null;
 | 
							return null;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -26,7 +26,7 @@ class ToolTipHandler {
 | 
				
			|||||||
	private Widget tipWidget; // widget this tooltip is hovering over
 | 
						private Widget tipWidget; // widget this tooltip is hovering over
 | 
				
			||||||
	private Point  tipPosition; // the position being hovered over
 | 
						private Point  tipPosition; // the position being hovered over
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	private static final int hoverYOffset = 1;
 | 
						private static final int HOVER_YOFFSET = 1;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/**
 | 
						/**
 | 
				
			||||||
	 * Creates a new tooltip handler
 | 
						 * Creates a new tooltip handler
 | 
				
			||||||
@@ -45,56 +45,57 @@ class ToolTipHandler {
 | 
				
			|||||||
	 */
 | 
						 */
 | 
				
			||||||
	public void activateHoverHelp(final Control control) {
 | 
						public void activateHoverHelp(final Control control) {
 | 
				
			||||||
		Listener listener = new Listener () {
 | 
							Listener listener = new Listener () {
 | 
				
			||||||
			Shell tip = null;
 | 
								Shell shell = null;
 | 
				
			||||||
			@Override
 | 
								@Override
 | 
				
			||||||
			public void handleEvent (Event event) {
 | 
								public void handleEvent (Event event) {
 | 
				
			||||||
				switch (event.type) {
 | 
									switch (event.type) {
 | 
				
			||||||
				case SWT.KeyDown:{
 | 
									case SWT.KeyDown:
 | 
				
			||||||
					if (tip != null && tip.isVisible() && event.keyCode == SWT.F2) {
 | 
										if (shell != null && shell.isVisible() && event.keyCode == SWT.F2)
 | 
				
			||||||
						tip.setFocus();
 | 
											shell.setFocus();
 | 
				
			||||||
					break;
 | 
										break;
 | 
				
			||||||
					} 
 | 
					 | 
				
			||||||
				}
 | 
					 | 
				
			||||||
				case SWT.Dispose:
 | 
									case SWT.Dispose:
 | 
				
			||||||
				case SWT.MouseMove:
 | 
									case SWT.MouseMove:
 | 
				
			||||||
				case SWT.MouseDown: {
 | 
									case SWT.MouseDown:
 | 
				
			||||||
					if (tip != null){
 | 
										if (shell != null){
 | 
				
			||||||
						tip.dispose ();
 | 
											shell.dispose ();
 | 
				
			||||||
						tip = null;
 | 
											shell = null;
 | 
				
			||||||
						tipWidget=null;
 | 
											tipWidget=null;
 | 
				
			||||||
					}
 | 
										}
 | 
				
			||||||
					break;
 | 
										break;
 | 
				
			||||||
 | 
									case SWT.MouseHover:
 | 
				
			||||||
 | 
										createHoverWindow(control, event);
 | 
				
			||||||
 | 
										break;
 | 
				
			||||||
 | 
									default:
 | 
				
			||||||
 | 
										/* do nothing */	
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
				case SWT.MouseHover: {
 | 
								}
 | 
				
			||||||
 | 
								private void createHoverWindow(final Control control, Event event) {
 | 
				
			||||||
				Object o = control.getData(Constants.CONTENT_PROVIDER_TAG);
 | 
									Object o = control.getData(Constants.CONTENT_PROVIDER_TAG);
 | 
				
			||||||
					if(o != null && o instanceof ToolTipContentProvider) {
 | 
									if(o instanceof ToolTipContentProvider) {
 | 
				
			||||||
					ToolTipContentProvider provider = ((ToolTipContentProvider)o);
 | 
										ToolTipContentProvider provider = ((ToolTipContentProvider)o);
 | 
				
			||||||
					Point pt = new Point (event.x, event.y);
 | 
										Point pt = new Point (event.x, event.y);
 | 
				
			||||||
					tipPosition = control.toDisplay(pt);
 | 
										tipPosition = control.toDisplay(pt);
 | 
				
			||||||
						if (tip != null  && !tip.isDisposed ()) tip.dispose ();
 | 
										if (shell != null  && !shell.isDisposed ()) shell.dispose ();
 | 
				
			||||||
						tip = new Shell (parentShell, SWT.NO_FOCUS | SWT.TOOL);
 | 
										shell = new Shell (parentShell, SWT.NO_FOCUS | SWT.TOOL);
 | 
				
			||||||
						tip.setBackground (display.getSystemColor (SWT.COLOR_INFO_BACKGROUND));
 | 
										shell.setBackground (display.getSystemColor (SWT.COLOR_INFO_BACKGROUND));
 | 
				
			||||||
					GridLayout layout = new GridLayout(1, true);
 | 
										GridLayout layout = new GridLayout(1, true);
 | 
				
			||||||
					layout.verticalSpacing=0;
 | 
										layout.verticalSpacing=0;
 | 
				
			||||||
					layout.horizontalSpacing=0;
 | 
										layout.horizontalSpacing=0;
 | 
				
			||||||
					layout.marginWidth = 0;
 | 
										layout.marginWidth = 0;
 | 
				
			||||||
					layout.marginHeight = 0;
 | 
										layout.marginHeight = 0;
 | 
				
			||||||
						tip.setLayout(layout);
 | 
										shell.setLayout(layout);
 | 
				
			||||||
						boolean visible = provider.createContent(tip, pt);
 | 
										boolean visible = provider.createContent(shell, pt);
 | 
				
			||||||
						tip.pack();
 | 
										shell.pack();
 | 
				
			||||||
						tip.setSize(tip.computeSize(SWT.DEFAULT, SWT.DEFAULT));
 | 
										shell.setSize(shell.computeSize(SWT.DEFAULT, SWT.DEFAULT));
 | 
				
			||||||
						setHoverLocation(tip, tipPosition);	
 | 
										setHoverLocation(shell, tipPosition);	
 | 
				
			||||||
						tip.setVisible (visible);
 | 
										shell.setVisible (visible);
 | 
				
			||||||
					if(visible)
 | 
										if(visible)
 | 
				
			||||||
						tipWidget=event.widget;
 | 
											tipWidget=event.widget;
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
				}
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
		};
 | 
							};
 | 
				
			||||||
		control.addListener (SWT.Dispose, listener);
 | 
							control.addListener (SWT.Dispose, listener);
 | 
				
			||||||
		control.addListener (SWT.KeyDown, listener);
 | 
							control.addListener (SWT.KeyDown, listener);
 | 
				
			||||||
		//control.addListener (SWT.MouseMove, listener);
 | 
					 | 
				
			||||||
		control.addListener (SWT.MouseHover, listener);
 | 
							control.addListener (SWT.MouseHover, listener);
 | 
				
			||||||
		control.addListener (SWT.MouseDown, listener);
 | 
							control.addListener (SWT.MouseDown, listener);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -119,11 +120,6 @@ class ToolTipHandler {
 | 
				
			|||||||
				helpShell.open();
 | 
									helpShell.open();
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		});
 | 
							});
 | 
				
			||||||
		//		control.addKeyListener(KeyListener.keyPressedAdapter( e-> {
 | 
					 | 
				
			||||||
		//				if (e.keyCode == SWT.F2 && shell.isVisible()) {
 | 
					 | 
				
			||||||
		//                    shell.setFocus();
 | 
					 | 
				
			||||||
		//                }
 | 
					 | 
				
			||||||
		//		}));
 | 
					 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/**
 | 
						/**
 | 
				
			||||||
@@ -136,7 +132,7 @@ class ToolTipHandler {
 | 
				
			|||||||
		Rectangle displayBounds = shell.getDisplay().getBounds();
 | 
							Rectangle displayBounds = shell.getDisplay().getBounds();
 | 
				
			||||||
		Rectangle shellBounds = shell.getBounds();
 | 
							Rectangle shellBounds = shell.getBounds();
 | 
				
			||||||
		shellBounds.x = Math.max(Math.min(position.x, displayBounds.width - shellBounds.width), 0);
 | 
							shellBounds.x = Math.max(Math.min(position.x, displayBounds.width - shellBounds.width), 0);
 | 
				
			||||||
		shellBounds.y = Math.max(Math.min(position.y + hoverYOffset, displayBounds.height - shellBounds.height), 0);
 | 
							shellBounds.y = Math.max(Math.min(position.y + HOVER_YOFFSET, displayBounds.height - shellBounds.height), 0);
 | 
				
			||||||
		shell.setBounds(shellBounds);
 | 
							shell.setBounds(shellBounds);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@@ -25,7 +25,7 @@ public class TrackAreaPainter implements IPainter {
 | 
				
			|||||||
	 */
 | 
						 */
 | 
				
			||||||
	private final WaveformCanvas waveCanvas;
 | 
						private final WaveformCanvas waveCanvas;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	TreeMap<Integer, IWaveformPainter> trackVerticalOffset;
 | 
						final TreeMap<Integer, IWaveformPainter> trackVerticalOffset;
 | 
				
			||||||
	/**
 | 
						/**
 | 
				
			||||||
	 * @param txDisplay
 | 
						 * @param txDisplay
 | 
				
			||||||
	 */
 | 
						 */
 | 
				
			||||||
@@ -36,7 +36,7 @@ public class TrackAreaPainter implements IPainter {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	public void paintArea(Projection proj, Rectangle a) {
 | 
						public void paintArea(Projection proj, Rectangle a) {
 | 
				
			||||||
	    Rectangle area = proj.unProject(new Rectangle(a.x, a.y+waveCanvas.rulerHeight, a.width, a.height-waveCanvas.rulerHeight));
 | 
						    Rectangle area = proj.unProject(new Rectangle(a.x, a.y+waveCanvas.rulerHeight, a.width, a.height-waveCanvas.rulerHeight));
 | 
				
			||||||
	    proj.setBackground(this.waveCanvas.colors[WaveformColors.TRACK_BG_EVEN.ordinal()]);
 | 
						    proj.setBackground(this.waveCanvas.styleProvider.getColor(WaveformColors.TRACK_BG_EVEN));
 | 
				
			||||||
	    proj.setFillRule(SWT.FILL_EVEN_ODD);
 | 
						    proj.setFillRule(SWT.FILL_EVEN_ODD);
 | 
				
			||||||
	    proj.fillRectangle(area);
 | 
						    proj.fillRectangle(area);
 | 
				
			||||||
		if(trackVerticalOffset.size()>0){
 | 
							if(trackVerticalOffset.size()>0){
 | 
				
			||||||
@@ -44,7 +44,7 @@ public class TrackAreaPainter implements IPainter {
 | 
				
			|||||||
			if(firstKey==null) firstKey=trackVerticalOffset.firstKey();
 | 
								if(firstKey==null) firstKey=trackVerticalOffset.firstKey();
 | 
				
			||||||
			Integer lastKey = trackVerticalOffset.floorKey(area.y+area.height);
 | 
								Integer lastKey = trackVerticalOffset.floorKey(area.y+area.height);
 | 
				
			||||||
			Rectangle subArea = new Rectangle(area.x, 0, area.width, 0);
 | 
								Rectangle subArea = new Rectangle(area.x, 0, area.width, 0);
 | 
				
			||||||
			if(lastKey==firstKey){
 | 
								if(lastKey.equals(firstKey)){
 | 
				
			||||||
				subArea.y=firstKey;
 | 
									subArea.y=firstKey;
 | 
				
			||||||
				IWaveformPainter p = trackVerticalOffset.get(firstKey);
 | 
									IWaveformPainter p = trackVerticalOffset.get(firstKey);
 | 
				
			||||||
				subArea.height=p.getHeight();
 | 
									subArea.height=p.getHeight();
 | 
				
			||||||
@@ -59,10 +59,6 @@ public class TrackAreaPainter implements IPainter {
 | 
				
			|||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	public TreeMap<Integer, IWaveformPainter> getTrackVerticalOffset() {
 | 
					 | 
				
			||||||
		return trackVerticalOffset;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	
 | 
					 | 
				
			||||||
	public void addTrackPainter(IWaveformPainter trackPainter){
 | 
						public void addTrackPainter(IWaveformPainter trackPainter){
 | 
				
			||||||
		trackVerticalOffset.put(trackPainter.getVerticalOffset()+waveCanvas.rulerHeight, trackPainter);
 | 
							trackVerticalOffset.put(trackPainter.getVerticalOffset()+waveCanvas.rulerHeight, trackPainter);
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -20,38 +20,31 @@ import org.eclipse.swt.SWT;
 | 
				
			|||||||
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.PaintEvent;
 | 
					import org.eclipse.swt.events.PaintEvent;
 | 
				
			||||||
import org.eclipse.swt.events.PaintListener;
 | 
					 | 
				
			||||||
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.GC;
 | 
					import org.eclipse.swt.graphics.GC;
 | 
				
			||||||
import org.eclipse.swt.graphics.Image;
 | 
					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.Rectangle;
 | 
					import org.eclipse.swt.graphics.Rectangle;
 | 
				
			||||||
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.Display;
 | 
					 | 
				
			||||||
import org.eclipse.swt.widgets.Event;
 | 
					import org.eclipse.swt.widgets.Event;
 | 
				
			||||||
import org.eclipse.swt.widgets.ScrollBar;
 | 
					import org.eclipse.swt.widgets.ScrollBar;
 | 
				
			||||||
import org.eclipse.wb.swt.SWTResourceManager;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
import com.google.common.collect.Lists;
 | 
					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.RelationType;
 | 
					import com.minres.scviewer.database.RelationType;
 | 
				
			||||||
 | 
					import com.minres.scviewer.database.tx.ITx;
 | 
				
			||||||
 | 
					import com.minres.scviewer.database.ui.IWaveformStyleProvider;
 | 
				
			||||||
import com.minres.scviewer.database.ui.IWaveformView;
 | 
					import com.minres.scviewer.database.ui.IWaveformView;
 | 
				
			||||||
import com.minres.scviewer.database.ui.TrackEntry;
 | 
					import com.minres.scviewer.database.ui.TrackEntry;
 | 
				
			||||||
import com.minres.scviewer.database.ui.WaveformColors;
 | 
					 | 
				
			||||||
import com.minres.scviewer.database.ui.swt.Constants;
 | 
					import com.minres.scviewer.database.ui.swt.Constants;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public class WaveformCanvas extends Canvas {
 | 
					public class WaveformCanvas extends Canvas {
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
    Color[] colors = new Color[WaveformColors.values().length];
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    private boolean doubleBuffering = true;
 | 
					    private boolean doubleBuffering = true;
 | 
				
			||||||
    	
 | 
					    	
 | 
				
			||||||
    private int trackHeight = 50;
 | 
					    IWaveformStyleProvider styleProvider;
 | 
				
			||||||
        
 | 
					        
 | 
				
			||||||
    private long scaleFactor = 1000000L; // 1ns
 | 
					    private long scaleFactor = 1000000L; // 1ns
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
@@ -88,26 +81,23 @@ public class WaveformCanvas extends Canvas {
 | 
				
			|||||||
     * @param style
 | 
					     * @param style
 | 
				
			||||||
     *            the style of this control.
 | 
					     *            the style of this control.
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    public WaveformCanvas(final Composite parent, int style) {
 | 
					    public WaveformCanvas(final Composite parent, int style, IWaveformStyleProvider styleProvider) {
 | 
				
			||||||
        super(parent, style | SWT.DOUBLE_BUFFERED | SWT.NO_BACKGROUND | SWT.V_SCROLL | SWT.H_SCROLL);
 | 
					        super(parent, style | SWT.DOUBLE_BUFFERED | SWT.NO_BACKGROUND | SWT.V_SCROLL | SWT.H_SCROLL);
 | 
				
			||||||
 | 
					        this.styleProvider=styleProvider;
 | 
				
			||||||
    	addControlListener(new ControlAdapter() { /* resize listener. */
 | 
					    	addControlListener(new ControlAdapter() { /* resize listener. */
 | 
				
			||||||
 | 
								@Override
 | 
				
			||||||
			public void controlResized(ControlEvent event) {
 | 
								public void controlResized(ControlEvent event) {
 | 
				
			||||||
                syncScrollBars();
 | 
					                syncScrollBars();
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        });
 | 
					        });
 | 
				
			||||||
        addPaintListener(new PaintListener() { /* paint listener. */
 | 
					        addPaintListener((final PaintEvent event) -> paint(event.gc));
 | 
				
			||||||
            public void paintControl(final PaintEvent event) {
 | 
					        painterList = new LinkedList<>();
 | 
				
			||||||
                paint(event.gc);
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
        });
 | 
					 | 
				
			||||||
        painterList = new LinkedList<IPainter>();
 | 
					 | 
				
			||||||
        origin = new Point(0, 0);
 | 
					        origin = new Point(0, 0);
 | 
				
			||||||
        selectionListeners = new LinkedList<>();
 | 
					        selectionListeners = new LinkedList<>();
 | 
				
			||||||
        cursorPainters= new ArrayList<>();
 | 
					        cursorPainters= new ArrayList<>();
 | 
				
			||||||
        wave2painterMap=new HashMap<>();
 | 
					        wave2painterMap=new HashMap<>();
 | 
				
			||||||
        
 | 
					        
 | 
				
			||||||
        initScrollBars();
 | 
					        initScrollBars();
 | 
				
			||||||
        initColors(null);
 | 
					 | 
				
			||||||
		// order is important: it is bottom to top
 | 
							// order is important: it is bottom to top
 | 
				
			||||||
        trackAreaPainter=new TrackAreaPainter(this);
 | 
					        trackAreaPainter=new TrackAreaPainter(this);
 | 
				
			||||||
        painterList.add(trackAreaPainter);
 | 
					        painterList.add(trackAreaPainter);
 | 
				
			||||||
@@ -122,31 +112,6 @@ public class WaveformCanvas extends Canvas {
 | 
				
			|||||||
		painterList.add(marker);
 | 
							painterList.add(marker);
 | 
				
			||||||
		cursorPainters.add(marker);
 | 
							cursorPainters.add(marker);
 | 
				
			||||||
		wave2painterMap=new HashMap<>();
 | 
							wave2painterMap=new HashMap<>();
 | 
				
			||||||
    	// fall back initialization
 | 
					 | 
				
			||||||
        colors[WaveformColors.LINE.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_RED);
 | 
					 | 
				
			||||||
        colors[WaveformColors.LINE_HIGHLITE.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_CYAN);
 | 
					 | 
				
			||||||
        colors[WaveformColors.TRACK_BG_EVEN.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_BLACK);
 | 
					 | 
				
			||||||
        colors[WaveformColors.TRACK_BG_ODD.ordinal()] = SWTResourceManager.getColor(40, 40, 40);
 | 
					 | 
				
			||||||
        colors[WaveformColors.TRACK_BG_HIGHLITE.ordinal()] = SWTResourceManager.getColor(40, 40, 80);
 | 
					 | 
				
			||||||
        colors[WaveformColors.TX_BG.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_GREEN);
 | 
					 | 
				
			||||||
        colors[WaveformColors.TX_BG_HIGHLITE.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_DARK_GREEN);
 | 
					 | 
				
			||||||
        colors[WaveformColors.TX_BORDER.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_RED);
 | 
					 | 
				
			||||||
        colors[WaveformColors.SIGNAL0.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_GREEN);
 | 
					 | 
				
			||||||
        colors[WaveformColors.SIGNAL1.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_GREEN);
 | 
					 | 
				
			||||||
        colors[WaveformColors.SIGNALZ.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_DARK_YELLOW);
 | 
					 | 
				
			||||||
        colors[WaveformColors.SIGNALX.ordinal()] = SWTResourceManager.getColor(255,  51,  51);
 | 
					 | 
				
			||||||
        colors[WaveformColors.SIGNALU.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_YELLOW);
 | 
					 | 
				
			||||||
        colors[WaveformColors.SIGNAL_TEXT.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_WHITE);
 | 
					 | 
				
			||||||
        colors[WaveformColors.SIGNAL_REAL.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_YELLOW);
 | 
					 | 
				
			||||||
        colors[WaveformColors.SIGNAL_NAN.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_RED);
 | 
					 | 
				
			||||||
        colors[WaveformColors.CURSOR.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_RED);
 | 
					 | 
				
			||||||
        colors[WaveformColors.CURSOR_DRAG.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_GRAY);
 | 
					 | 
				
			||||||
        colors[WaveformColors.CURSOR_TEXT.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_WHITE);
 | 
					 | 
				
			||||||
        colors[WaveformColors.MARKER.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_DARK_GRAY);
 | 
					 | 
				
			||||||
        colors[WaveformColors.MARKER_TEXT.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_WHITE);
 | 
					 | 
				
			||||||
        colors[WaveformColors.REL_ARROW.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_MAGENTA);
 | 
					 | 
				
			||||||
        colors[WaveformColors.REL_ARROW_HIGHLITE.ordinal()] = SWTResourceManager.getColor(255, 128, 255);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
	public void addCursoPainter(CursorPainter cursorPainter){
 | 
						public void addCursoPainter(CursorPainter cursorPainter){
 | 
				
			||||||
@@ -154,17 +119,6 @@ public class WaveformCanvas extends Canvas {
 | 
				
			|||||||
		cursorPainters.add(cursorPainter);
 | 
							cursorPainters.add(cursorPainter);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
    public void initColors(HashMap<WaveformColors, RGB> colourMap) {
 | 
					 | 
				
			||||||
        Display d = getDisplay();
 | 
					 | 
				
			||||||
        if (colourMap != null) {
 | 
					 | 
				
			||||||
            for (WaveformColors c : WaveformColors.values()) {
 | 
					 | 
				
			||||||
                if (colourMap.containsKey(c))
 | 
					 | 
				
			||||||
                    colors[c.ordinal()] = new Color(d, colourMap.get(c));
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
            redraw();
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    public void setHighliteRelation(RelationType relationType){
 | 
					    public void setHighliteRelation(RelationType relationType){
 | 
				
			||||||
    	if(arrowPainter!=null){
 | 
					    	if(arrowPainter!=null){
 | 
				
			||||||
    		boolean redraw = arrowPainter.getHighlightType()!=relationType; 
 | 
					    		boolean redraw = arrowPainter.getHighlightType()!=relationType; 
 | 
				
			||||||
@@ -206,21 +160,12 @@ public class WaveformCanvas extends Canvas {
 | 
				
			|||||||
        syncScrollBars();
 | 
					        syncScrollBars();
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public int getTrackHeight() {
 | 
					 | 
				
			||||||
        return trackHeight;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    public void setTrackHeight(int trackHeight) {
 | 
					 | 
				
			||||||
        this.trackHeight = trackHeight;
 | 
					 | 
				
			||||||
        syncScrollBars();
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    public int getZoomLevel() {
 | 
					    public int getZoomLevel() {
 | 
				
			||||||
        return level;
 | 
					        return level;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
    public int getMaxZoomLevel(){
 | 
					    public int getMaxZoomLevel(){
 | 
				
			||||||
    	return Constants.unitMultiplier.length*Constants.unitString.length-1;
 | 
					    	return Constants.UNIT_MULTIPLIER.length*Constants.UNIT_STRING.length-1;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public void setZoomLevel(int level) {
 | 
					    public void setZoomLevel(int level) {
 | 
				
			||||||
@@ -232,8 +177,8 @@ public class WaveformCanvas extends Canvas {
 | 
				
			|||||||
    	//FIXME: keep center if zoom-out and cursor is not in view
 | 
					    	//FIXME: keep center if zoom-out and cursor is not in view
 | 
				
			||||||
    	long oldScaleFactor=scaleFactor;
 | 
					    	long oldScaleFactor=scaleFactor;
 | 
				
			||||||
    	if(level<0) level = 0;
 | 
					    	if(level<0) level = 0;
 | 
				
			||||||
    	if(level<Constants.unitMultiplier.length*Constants.unitString.length){
 | 
					    	if(level<Constants.UNIT_MULTIPLIER.length*Constants.UNIT_STRING.length){
 | 
				
			||||||
    		this.scaleFactor = (long) Math.pow(10, level/2);
 | 
					    		this.scaleFactor = (long) Math.pow(10, level/2d);
 | 
				
			||||||
    		if(level%2==1) this.scaleFactor*=3;
 | 
					    		if(level%2==1) this.scaleFactor*=3;
 | 
				
			||||||
    		ITx tx = arrowPainter.getTx();
 | 
					    		ITx tx = arrowPainter.getTx();
 | 
				
			||||||
    		arrowPainter.setTx(null);
 | 
					    		arrowPainter.setTx(null);
 | 
				
			||||||
@@ -264,17 +209,17 @@ public class WaveformCanvas extends Canvas {
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public long getScaleFactorPow10() {
 | 
					    public long getScaleFactorPow10() {
 | 
				
			||||||
    	int scale = level/Constants.unitMultiplier.length;
 | 
					    	int scale = level/Constants.UNIT_MULTIPLIER.length;
 | 
				
			||||||
    	double res = Math.pow(1000, scale);
 | 
					    	double res = Math.pow(1000, scale);
 | 
				
			||||||
    	return (long) res;
 | 
					    	return (long) res;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public String getUnitStr(){
 | 
					    public String getUnitStr(){
 | 
				
			||||||
        return Constants.unitString[level/Constants.unitMultiplier.length];
 | 
					        return Constants.UNIT_STRING[level/Constants.UNIT_MULTIPLIER.length];
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
     
 | 
					     
 | 
				
			||||||
    public int getUnitMultiplier(){
 | 
					    public int getUnitMultiplier(){
 | 
				
			||||||
        return Constants.unitMultiplier[level%Constants.unitMultiplier.length];
 | 
					        return Constants.UNIT_MULTIPLIER[level%Constants.UNIT_MULTIPLIER.length];
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
    public long getTimeForOffset(int xOffset){
 | 
					    public long getTimeForOffset(int xOffset){
 | 
				
			||||||
@@ -296,7 +241,7 @@ public class WaveformCanvas extends Canvas {
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
    void clearAllWaveformPainter(boolean update) {
 | 
					    void clearAllWaveformPainter(boolean update) {
 | 
				
			||||||
        trackAreaPainter.getTrackVerticalOffset().clear();
 | 
					        trackAreaPainter.trackVerticalOffset.clear();
 | 
				
			||||||
        wave2painterMap.clear();
 | 
					        wave2painterMap.clear();
 | 
				
			||||||
        if(update) syncScrollBars();
 | 
					        if(update) syncScrollBars();
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
@@ -315,23 +260,15 @@ public class WaveformCanvas extends Canvas {
 | 
				
			|||||||
		return cursorPainters;
 | 
							return cursorPainters;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/**
 | 
					 | 
				
			||||||
     * Dispose the garbage here
 | 
					 | 
				
			||||||
     */
 | 
					 | 
				
			||||||
    public void dispose() {
 | 
					 | 
				
			||||||
        for (WaveformColors c : WaveformColors.values())
 | 
					 | 
				
			||||||
            colors[c.ordinal()].dispose();
 | 
					 | 
				
			||||||
        super.dispose();
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    /* Initialize the scrollbar and register listeners. */
 | 
					    /* Initialize the scrollbar and register listeners. */
 | 
				
			||||||
    private void initScrollBars() {
 | 
					    private void initScrollBars() {
 | 
				
			||||||
        ScrollBar horizontal = getHorizontalBar();
 | 
					        ScrollBar horizontal = getHorizontalBar();
 | 
				
			||||||
        horizontal.setEnabled(false);
 | 
					        horizontal.setEnabled(false);
 | 
				
			||||||
        horizontal.setVisible(true);
 | 
					        horizontal.setVisible(true);
 | 
				
			||||||
        horizontal.addSelectionListener(new SelectionAdapter() {
 | 
					        horizontal.addSelectionListener(new SelectionAdapter() {
 | 
				
			||||||
 | 
								@Override
 | 
				
			||||||
            public void widgetSelected(SelectionEvent event) {
 | 
					            public void widgetSelected(SelectionEvent event) {
 | 
				
			||||||
                if (painterList.size() == 0)
 | 
					                if (painterList.isEmpty())
 | 
				
			||||||
                    return;
 | 
					                    return;
 | 
				
			||||||
                setOrigin(-((ScrollBar) event.widget).getSelection(), origin.y);
 | 
					                setOrigin(-((ScrollBar) event.widget).getSelection(), origin.y);
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
@@ -340,8 +277,9 @@ public class WaveformCanvas extends Canvas {
 | 
				
			|||||||
        vertical.setEnabled(false);
 | 
					        vertical.setEnabled(false);
 | 
				
			||||||
        vertical.setVisible(true);
 | 
					        vertical.setVisible(true);
 | 
				
			||||||
        vertical.addSelectionListener(new SelectionAdapter() {
 | 
					        vertical.addSelectionListener(new SelectionAdapter() {
 | 
				
			||||||
 | 
								@Override
 | 
				
			||||||
            public void widgetSelected(SelectionEvent event) {
 | 
					            public void widgetSelected(SelectionEvent event) {
 | 
				
			||||||
                if (painterList.size() == 0)
 | 
					                if (painterList.isEmpty())
 | 
				
			||||||
                    return;
 | 
					                    return;
 | 
				
			||||||
                setOrigin(origin.x, -((ScrollBar) event.widget).getSelection());
 | 
					                setOrigin(origin.x, -((ScrollBar) event.widget).getSelection());
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
@@ -354,7 +292,7 @@ public class WaveformCanvas extends Canvas {
 | 
				
			|||||||
     * :<b> transform, image size, client area</b>.
 | 
					     * :<b> transform, image size, client area</b>.
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    public void syncScrollBars() {
 | 
					    public void syncScrollBars() {
 | 
				
			||||||
        if (painterList.size() == 0) {
 | 
					        if (painterList.isEmpty()) {
 | 
				
			||||||
            redraw();
 | 
					            redraw();
 | 
				
			||||||
            return;
 | 
					            return;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
@@ -362,14 +300,14 @@ public class WaveformCanvas extends Canvas {
 | 
				
			|||||||
        long width = maxTime / scaleFactor;
 | 
					        long width = maxTime / scaleFactor;
 | 
				
			||||||
        Rectangle clientArea=getClientArea();
 | 
					        Rectangle clientArea=getClientArea();
 | 
				
			||||||
        ScrollBar horizontal = getHorizontalBar();
 | 
					        ScrollBar horizontal = getHorizontalBar();
 | 
				
			||||||
        horizontal.setIncrement((int) (getClientArea().width / 100));
 | 
					        horizontal.setIncrement(getClientArea().width / 100);
 | 
				
			||||||
        horizontal.setPageIncrement(getClientArea().width);
 | 
					        horizontal.setPageIncrement(getClientArea().width);
 | 
				
			||||||
        int clientWidthw = clientArea.width;
 | 
					        int clientWidthw = clientArea.width;
 | 
				
			||||||
        if (width > clientWidthw) { /* image is wider than client area */
 | 
					        if (width > clientWidthw) { /* image is wider than client area */
 | 
				
			||||||
        	horizontal.setMinimum(0);
 | 
					        	horizontal.setMinimum(0);
 | 
				
			||||||
            horizontal.setMaximum((int)width);
 | 
					            horizontal.setMaximum((int)width);
 | 
				
			||||||
            horizontal.setEnabled(true);
 | 
					            horizontal.setEnabled(true);
 | 
				
			||||||
            if (((int) -origin.x) > horizontal.getMaximum() - clientWidthw) {
 | 
					            if (-origin.x > horizontal.getMaximum() - clientWidthw) {
 | 
				
			||||||
                origin.x = -horizontal.getMaximum() + clientWidthw;
 | 
					                origin.x = -horizontal.getMaximum() + clientWidthw;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        } else { /* image is narrower than client area */
 | 
					        } else { /* image is narrower than client area */
 | 
				
			||||||
@@ -379,18 +317,18 @@ public class WaveformCanvas extends Canvas {
 | 
				
			|||||||
        horizontal.setSelection(-origin.x);
 | 
					        horizontal.setSelection(-origin.x);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        ScrollBar vertical = getVerticalBar();
 | 
					        ScrollBar vertical = getVerticalBar();
 | 
				
			||||||
        vertical.setIncrement((int) (getClientArea().height / 100));
 | 
					        vertical.setIncrement(getClientArea().height / 100);
 | 
				
			||||||
        vertical.setPageIncrement((int) (getClientArea().height));
 | 
					        vertical.setPageIncrement(getClientArea().height);
 | 
				
			||||||
        int clientHeighth = clientArea.height;
 | 
					        int clientHeighth = clientArea.height;
 | 
				
			||||||
        if (height > clientHeighth) { /* image is higher than client area */
 | 
					        if (height > clientHeighth) { /* image is higher than client area */
 | 
				
			||||||
            vertical.setMinimum(0);
 | 
					            vertical.setMinimum(0);
 | 
				
			||||||
            vertical.setMaximum(height);
 | 
					            vertical.setMaximum(height);
 | 
				
			||||||
            vertical.setEnabled(true);
 | 
					            vertical.setEnabled(true);
 | 
				
			||||||
            if (((int) -origin.y) > vertical.getMaximum() - clientHeighth) {
 | 
					            if ( -origin.y > vertical.getMaximum() - clientHeighth) {
 | 
				
			||||||
                origin.y = -vertical.getMaximum() + clientHeighth;
 | 
					                origin.y = -vertical.getMaximum() + clientHeighth;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        } else { /* image is less higher than client area */
 | 
					        } else { /* image is less higher than client area */
 | 
				
			||||||
            vertical.setMaximum((int) (clientHeighth));
 | 
					            vertical.setMaximum(clientHeighth);
 | 
				
			||||||
            vertical.setEnabled(false);
 | 
					            vertical.setEnabled(false);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        vertical.setThumb(clientHeighth);
 | 
					        vertical.setThumb(clientHeighth);
 | 
				
			||||||
@@ -405,10 +343,10 @@ public class WaveformCanvas extends Canvas {
 | 
				
			|||||||
        if(pt.x==0  || pt.y==0) return;
 | 
					        if(pt.x==0  || pt.y==0) return;
 | 
				
			||||||
        Rectangle clientRect = getClientArea(); /* Canvas' painting area */
 | 
					        Rectangle clientRect = getClientArea(); /* Canvas' painting area */
 | 
				
			||||||
        GC thisGc = gc;
 | 
					        GC thisGc = gc;
 | 
				
			||||||
        Image d_backingImg = null;
 | 
					        Image dBackingImg = null;
 | 
				
			||||||
        if(doubleBuffering) {
 | 
					        if(doubleBuffering) {
 | 
				
			||||||
            d_backingImg = new Image(getDisplay(), pt.x, pt.y);
 | 
					        	dBackingImg = new Image(getDisplay(), pt.x, pt.y);
 | 
				
			||||||
            thisGc = new GC(d_backingImg);
 | 
					            thisGc = new GC(dBackingImg);
 | 
				
			||||||
            thisGc.setBackground(gc.getBackground());
 | 
					            thisGc.setBackground(gc.getBackground());
 | 
				
			||||||
            thisGc.setForeground(gc.getForeground());
 | 
					            thisGc.setForeground(gc.getForeground());
 | 
				
			||||||
            thisGc.setFont(gc.getFont());
 | 
					            thisGc.setFont(gc.getFont());
 | 
				
			||||||
@@ -416,7 +354,7 @@ public class WaveformCanvas extends Canvas {
 | 
				
			|||||||
        }
 | 
					        }
 | 
				
			||||||
        Projection p = new Projection(thisGc);
 | 
					        Projection p = new Projection(thisGc);
 | 
				
			||||||
        p.setTranslation(origin);
 | 
					        p.setTranslation(origin);
 | 
				
			||||||
        if (painterList.size() > 0 ) {
 | 
					        if (!painterList.isEmpty() ) {
 | 
				
			||||||
            for (IPainter painter : painterList)
 | 
					            for (IPainter painter : painterList)
 | 
				
			||||||
                painter.paintArea(p, clientRect);
 | 
					                painter.paintArea(p, clientRect);
 | 
				
			||||||
        } else {
 | 
					        } else {
 | 
				
			||||||
@@ -424,8 +362,8 @@ public class WaveformCanvas extends Canvas {
 | 
				
			|||||||
            initScrollBars();
 | 
					            initScrollBars();
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        if(doubleBuffering) {
 | 
					        if(doubleBuffering) {
 | 
				
			||||||
            gc.drawImage(d_backingImg, 0, 0);
 | 
					            gc.drawImage(dBackingImg, 0, 0);
 | 
				
			||||||
            d_backingImg.dispose();
 | 
					            if(dBackingImg!=null) dBackingImg.dispose();
 | 
				
			||||||
            thisGc.dispose();
 | 
					            thisGc.dispose();
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
@@ -436,7 +374,7 @@ public class WaveformCanvas extends Canvas {
 | 
				
			|||||||
            if (p instanceof TrackAreaPainter) {
 | 
					            if (p instanceof TrackAreaPainter) {
 | 
				
			||||||
                int y = point.y - origin.y;
 | 
					                int y = point.y - origin.y;
 | 
				
			||||||
                int x = point.x - origin.x;
 | 
					                int x = point.x - origin.x;
 | 
				
			||||||
                Entry<Integer, IWaveformPainter> entry = trackAreaPainter.getTrackVerticalOffset().floorEntry(y);
 | 
					                Entry<Integer, IWaveformPainter> entry = trackAreaPainter.trackVerticalOffset.floorEntry(y);
 | 
				
			||||||
                if (entry != null) {
 | 
					                if (entry != null) {
 | 
				
			||||||
                    if (entry.getValue() instanceof StreamPainter) {
 | 
					                    if (entry.getValue() instanceof StreamPainter) {
 | 
				
			||||||
                    	ITx tx = ((StreamPainter) entry.getValue()).getClicked(new Point(x, y - entry.getKey()));
 | 
					                    	ITx tx = ((StreamPainter) entry.getValue()).getClicked(new Point(x, y - entry.getKey()));
 | 
				
			||||||
@@ -457,9 +395,9 @@ public class WaveformCanvas extends Canvas {
 | 
				
			|||||||
    public List<Object> getEntriesAtPosition(IWaveform iWaveform, int i) {
 | 
					    public List<Object> getEntriesAtPosition(IWaveform iWaveform, int i) {
 | 
				
			||||||
    	LinkedList<Object> result=new LinkedList<>();
 | 
					    	LinkedList<Object> result=new LinkedList<>();
 | 
				
			||||||
        int x = i - origin.x;
 | 
					        int x = i - origin.x;
 | 
				
			||||||
        for(IPainter p: wave2painterMap.values()){
 | 
					        for(IWaveformPainter p: wave2painterMap.values()){
 | 
				
			||||||
        	if (p instanceof StreamPainter && ((StreamPainter)p).getStream()==iWaveform) {
 | 
					        	if (p instanceof StreamPainter && ((StreamPainter)p).getStream()==iWaveform) {
 | 
				
			||||||
        		result.add(((StreamPainter) p).getClicked(new Point(x, trackHeight/2)));
 | 
					        		result.add(((StreamPainter) p).getClicked(new Point(x, styleProvider.getTrackHeight()/2)));
 | 
				
			||||||
        	}
 | 
					        	}
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        return result;
 | 
					        return result;
 | 
				
			||||||
@@ -486,10 +424,10 @@ public class WaveformCanvas extends Canvas {
 | 
				
			|||||||
        }
 | 
					        }
 | 
				
			||||||
        for (IWaveformPainter painter : wave2painterMap.values()) {
 | 
					        for (IWaveformPainter painter : wave2painterMap.values()) {
 | 
				
			||||||
            if (painter instanceof StreamPainter && ((StreamPainter) painter).getStream() == tx.getStream()) {
 | 
					            if (painter instanceof StreamPainter && ((StreamPainter) painter).getStream() == tx.getStream()) {
 | 
				
			||||||
                int top = painter.getVerticalOffset() + trackHeight * tx.getConcurrencyIndex();
 | 
					                int top = painter.getVerticalOffset() + styleProvider.getTrackHeight() * tx.getConcurrencyIndex();
 | 
				
			||||||
                int bottom = top + trackHeight;
 | 
					                int bottom = top + styleProvider.getTrackHeight();
 | 
				
			||||||
                if (top < -origin.y) {
 | 
					                if (top < -origin.y) {
 | 
				
			||||||
                    setOrigin(origin.x, -(top-trackHeight));
 | 
					                    setOrigin(origin.x, -(top-styleProvider.getTrackHeight()));
 | 
				
			||||||
                } else if (bottom > (size.y - origin.y)) {
 | 
					                } else if (bottom > (size.y - origin.y)) {
 | 
				
			||||||
                    setOrigin(origin.x, size.y - bottom);
 | 
					                    setOrigin(origin.x, size.y - bottom);
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
@@ -502,15 +440,14 @@ public class WaveformCanvas extends Canvas {
 | 
				
			|||||||
        	TrackEntry te = painter.getTrackEntry();
 | 
					        	TrackEntry te = painter.getTrackEntry();
 | 
				
			||||||
        	if(te.waveform == waveform) {
 | 
					        	if(te.waveform == waveform) {
 | 
				
			||||||
                Point size = getSize();
 | 
					                Point size = getSize();
 | 
				
			||||||
                //size.x -= getVerticalBar().getSize().x + 2;
 | 
					 | 
				
			||||||
                size.y -=+rulerHeight;
 | 
					                size.y -=+rulerHeight;
 | 
				
			||||||
                ScrollBar sb = getHorizontalBar();
 | 
					                ScrollBar sb = getHorizontalBar();
 | 
				
			||||||
                if((sb.getStyle()&SWT.SCROLLBAR_OVERLAY)!=0 && sb.isVisible()) // TODO: check on other platform than MacOSX
 | 
					                if((sb.getStyle()&SWT.SCROLLBAR_OVERLAY)!=0 && sb.isVisible())
 | 
				
			||||||
                	size.y-=  getHorizontalBar().getSize().y;
 | 
					                	size.y-=  getHorizontalBar().getSize().y;
 | 
				
			||||||
                int top = te.vOffset;
 | 
					                int top = te.vOffset;
 | 
				
			||||||
                int bottom = top + trackHeight;
 | 
					                int bottom = top + styleProvider.getTrackHeight();
 | 
				
			||||||
                if (top < -origin.y) {
 | 
					                if (top < -origin.y) {
 | 
				
			||||||
                    setOrigin(origin.x, -(top-trackHeight));
 | 
					                    setOrigin(origin.x, -(top-styleProvider.getTrackHeight()));
 | 
				
			||||||
                } else if (bottom > (size.y - origin.y)) {
 | 
					                } else if (bottom > (size.y - origin.y)) {
 | 
				
			||||||
                    setOrigin(origin.x, size.y - bottom);
 | 
					                    setOrigin(origin.x, size.y - bottom);
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
@@ -569,4 +506,9 @@ public class WaveformCanvas extends Canvas {
 | 
				
			|||||||
    long getMinVisibleTime() {
 | 
					    long getMinVisibleTime() {
 | 
				
			||||||
    	return origin.x * scaleFactor;
 | 
					    	return origin.x * scaleFactor;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						public void setStyleProvider(IWaveformStyleProvider styleProvider) {
 | 
				
			||||||
 | 
							this.styleProvider=styleProvider;
 | 
				
			||||||
 | 
							redraw();
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -10,15 +10,14 @@
 | 
				
			|||||||
 *******************************************************************************/
 | 
					 *******************************************************************************/
 | 
				
			||||||
package com.minres.scviewer.database.ui.swt.internal;
 | 
					package com.minres.scviewer.database.ui.swt.internal;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import java.awt.Color;
 | 
					 | 
				
			||||||
import java.beans.PropertyChangeEvent;
 | 
					import java.beans.PropertyChangeEvent;
 | 
				
			||||||
import java.beans.PropertyChangeListener;
 | 
					import java.beans.PropertyChangeListener;
 | 
				
			||||||
import java.beans.PropertyChangeSupport;
 | 
					import java.beans.PropertyChangeSupport;
 | 
				
			||||||
import java.text.DecimalFormat;
 | 
					import java.text.DecimalFormat;
 | 
				
			||||||
import java.util.ArrayList;
 | 
					import java.util.ArrayList;
 | 
				
			||||||
 | 
					import java.util.Arrays;
 | 
				
			||||||
import java.util.Collection;
 | 
					import java.util.Collection;
 | 
				
			||||||
import java.util.Collections;
 | 
					import java.util.Collections;
 | 
				
			||||||
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.Map.Entry;
 | 
				
			||||||
@@ -56,10 +55,8 @@ import org.eclipse.swt.events.PaintEvent;
 | 
				
			|||||||
import org.eclipse.swt.events.PaintListener;
 | 
					import org.eclipse.swt.events.PaintListener;
 | 
				
			||||||
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.Font;
 | 
					 | 
				
			||||||
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;
 | 
				
			||||||
@@ -78,23 +75,25 @@ import org.eclipse.wb.swt.SWTResourceManager;
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
import com.google.common.collect.Lists;
 | 
					import com.google.common.collect.Lists;
 | 
				
			||||||
import com.minres.scviewer.database.BitVector;
 | 
					import com.minres.scviewer.database.BitVector;
 | 
				
			||||||
import com.minres.scviewer.database.ISignal;
 | 
					import com.minres.scviewer.database.DoubleVal;
 | 
				
			||||||
import com.minres.scviewer.database.ITx;
 | 
					import com.minres.scviewer.database.EventKind;
 | 
				
			||||||
import com.minres.scviewer.database.ITxEvent;
 | 
					import com.minres.scviewer.database.IEvent;
 | 
				
			||||||
import com.minres.scviewer.database.ITxRelation;
 | 
					 | 
				
			||||||
import com.minres.scviewer.database.ITxStream;
 | 
					 | 
				
			||||||
import com.minres.scviewer.database.IWaveform;
 | 
					import com.minres.scviewer.database.IWaveform;
 | 
				
			||||||
import com.minres.scviewer.database.RelationType;
 | 
					import com.minres.scviewer.database.RelationType;
 | 
				
			||||||
 | 
					import com.minres.scviewer.database.WaveformType;
 | 
				
			||||||
 | 
					import com.minres.scviewer.database.tx.ITx;
 | 
				
			||||||
 | 
					import com.minres.scviewer.database.tx.ITxEvent;
 | 
				
			||||||
 | 
					import com.minres.scviewer.database.tx.ITxRelation;
 | 
				
			||||||
import com.minres.scviewer.database.ui.GotoDirection;
 | 
					import com.minres.scviewer.database.ui.GotoDirection;
 | 
				
			||||||
import com.minres.scviewer.database.ui.ICursor;
 | 
					import com.minres.scviewer.database.ui.ICursor;
 | 
				
			||||||
 | 
					import com.minres.scviewer.database.ui.IWaveformStyleProvider;
 | 
				
			||||||
import com.minres.scviewer.database.ui.IWaveformView;
 | 
					import com.minres.scviewer.database.ui.IWaveformView;
 | 
				
			||||||
import com.minres.scviewer.database.ui.TrackEntry;
 | 
					import com.minres.scviewer.database.ui.TrackEntry;
 | 
				
			||||||
import com.minres.scviewer.database.ui.WaveformColors;
 | 
					 | 
				
			||||||
import com.minres.scviewer.database.ui.swt.Constants;
 | 
					import com.minres.scviewer.database.ui.swt.Constants;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public class WaveformView implements IWaveformView  {
 | 
					public class WaveformView implements IWaveformView  {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	private ListenerList<ISelectionChangedListener> selectionChangedListeners = new ListenerList<ISelectionChangedListener>();
 | 
						private ListenerList<ISelectionChangedListener> selectionChangedListeners = new ListenerList<>();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	private PropertyChangeSupport pcs;
 | 
						private PropertyChangeSupport pcs;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -110,9 +109,9 @@ public class WaveformView implements IWaveformView  {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	private Control namePaneHeader;
 | 
						private Control namePaneHeader;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	final private Canvas nameList;
 | 
						private final Canvas nameList;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	final private Canvas valueList;
 | 
						private final Canvas valueList;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	final WaveformCanvas waveformCanvas;
 | 
						final WaveformCanvas waveformCanvas;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -126,11 +125,11 @@ public class WaveformView implements IWaveformView  {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	int selectedMarker = 0;
 | 
						int selectedMarker = 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	private int trackVerticalHeight;
 | 
						private int tracksVerticalHeight;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	private TreeMap<Integer, TrackEntry> trackVerticalOffset;
 | 
						private TreeMap<Integer, TrackEntry> trackVerticalOffset;
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	private Font nameFont, nameFontB;
 | 
						private IWaveformStyleProvider styleProvider;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	protected TrackEntry lastClickedEntry;
 | 
						protected TrackEntry lastClickedEntry;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -171,7 +170,8 @@ public class WaveformView implements IWaveformView  {
 | 
				
			|||||||
	};
 | 
						};
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	class WaveformMouseListener implements PaintListener, Listener {
 | 
						class WaveformMouseListener implements PaintListener, Listener {
 | 
				
			||||||
		Point start, end;
 | 
							Point start;
 | 
				
			||||||
 | 
							Point end;
 | 
				
			||||||
		List<Object> initialSelected;
 | 
							List<Object> initialSelected;
 | 
				
			||||||
		boolean down=false;
 | 
							boolean down=false;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -182,9 +182,9 @@ public class WaveformView implements IWaveformView  {
 | 
				
			|||||||
	            gc.setAlpha(128);
 | 
						            gc.setAlpha(128);
 | 
				
			||||||
	            int minX = Math.min(start.x, end.x);
 | 
						            int minX = Math.min(start.x, end.x);
 | 
				
			||||||
	            int width = Math.max(start.x, end.x) - minX;
 | 
						            int width = Math.max(start.x, end.x) - minX;
 | 
				
			||||||
	            int y_top = waveformCanvas.getRulerHeight();
 | 
						            int yTop = waveformCanvas.getRulerHeight();
 | 
				
			||||||
	            int y_bottom = waveformCanvas.getSize().y;
 | 
						            int yBottom = waveformCanvas.getSize().y;
 | 
				
			||||||
	            gc.fillRectangle(minX, y_top, width,y_bottom);
 | 
						            gc.fillRectangle(minX, yTop, width,yBottom);
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -201,7 +201,7 @@ public class WaveformView implements IWaveformView  {
 | 
				
			|||||||
				if(targetTimeRange==0) return;
 | 
									if(targetTimeRange==0) return;
 | 
				
			||||||
				long relation = currentTimeRange/targetTimeRange;
 | 
									long relation = currentTimeRange/targetTimeRange;
 | 
				
			||||||
				long i = 1;
 | 
									long i = 1;
 | 
				
			||||||
				int level=0;//relation>0?0:0;
 | 
									int level=0;
 | 
				
			||||||
				do {
 | 
									do {
 | 
				
			||||||
					if(relation<0 ) {
 | 
										if(relation<0 ) {
 | 
				
			||||||
						if(-relation<i) {
 | 
											if(-relation<i) {
 | 
				
			||||||
@@ -248,20 +248,15 @@ public class WaveformView implements IWaveformView  {
 | 
				
			|||||||
			long time= waveformCanvas.getTimeForOffset(p.x);
 | 
								long time= waveformCanvas.getTimeForOffset(p.x);
 | 
				
			||||||
			long scaling=5*waveformCanvas.getScaleFactor();
 | 
								long scaling=5*waveformCanvas.getScaleFactor();
 | 
				
			||||||
			for(Object o:waveformCanvas.getElementsAt(p)){
 | 
								for(Object o:waveformCanvas.getElementsAt(p)){
 | 
				
			||||||
				Entry<Long, ?> floorEntry=null, ceilEntry=null;
 | 
									Entry<Long, IEvent[]> floorEntry=null;
 | 
				
			||||||
 | 
									Entry<Long, IEvent[]> ceilEntry=null;
 | 
				
			||||||
				if(o instanceof TrackEntry){ 
 | 
									if(o instanceof TrackEntry){ 
 | 
				
			||||||
					TrackEntry entry = (TrackEntry) o;
 | 
										TrackEntry entry = (TrackEntry) o;
 | 
				
			||||||
					if(entry.waveform instanceof ISignal<?>){
 | 
										NavigableMap<Long, IEvent[]> map = entry.waveform.getEvents();
 | 
				
			||||||
						NavigableMap<Long, ?> map = ((ISignal<?>)entry.waveform).getEvents();
 | 
					 | 
				
			||||||
					floorEntry = map.floorEntry(time);
 | 
										floorEntry = map.floorEntry(time);
 | 
				
			||||||
					ceilEntry = map.ceilingEntry(time);
 | 
										ceilEntry = map.ceilingEntry(time);
 | 
				
			||||||
					} else if (entry.waveform instanceof ITxStream<?>){
 | 
					 | 
				
			||||||
						NavigableMap<Long, ?> map = ((ITxStream<?>)entry.waveform).getEvents();
 | 
					 | 
				
			||||||
						floorEntry = map.floorEntry(time);
 | 
					 | 
				
			||||||
						ceilEntry = map.ceilingEntry(time);
 | 
					 | 
				
			||||||
					}
 | 
					 | 
				
			||||||
				} else if(o instanceof ITx){
 | 
									} else if(o instanceof ITx){
 | 
				
			||||||
					NavigableMap<Long, ?> map = ((ITx)o).getStream().getEvents();
 | 
										NavigableMap<Long, IEvent[]> map = ((ITx)o).getStream().getEvents();
 | 
				
			||||||
					floorEntry = map.floorEntry(time);
 | 
										floorEntry = map.floorEntry(time);
 | 
				
			||||||
					ceilEntry = map.ceilingEntry(time);
 | 
										ceilEntry = map.ceilingEntry(time);
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
@@ -300,9 +295,6 @@ public class WaveformView implements IWaveformView  {
 | 
				
			|||||||
			case SWT.MouseUp:
 | 
								case SWT.MouseUp:
 | 
				
			||||||
				mouseUp(new MouseEvent(e));
 | 
									mouseUp(new MouseEvent(e));
 | 
				
			||||||
				break;
 | 
									break;
 | 
				
			||||||
			//case SWT.MouseDoubleClick:
 | 
					 | 
				
			||||||
				//mouseDoubleClick(new MouseEvent(e));
 | 
					 | 
				
			||||||
				//break;
 | 
					 | 
				
			||||||
			case SWT.MouseMove:
 | 
								case SWT.MouseMove:
 | 
				
			||||||
				if(down) {
 | 
									if(down) {
 | 
				
			||||||
					end=new Point(e.x, e.y);
 | 
										end=new Point(e.x, e.y);
 | 
				
			||||||
@@ -315,17 +307,16 @@ public class WaveformView implements IWaveformView  {
 | 
				
			|||||||
			
 | 
								
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	};
 | 
						}
 | 
				
			||||||
	protected WaveformMouseListener waveformMouseListener  = new WaveformMouseListener();
 | 
						protected WaveformMouseListener waveformMouseListener  = new WaveformMouseListener();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	public WaveformView(Composite parent) {
 | 
						public WaveformView(Composite parent, IWaveformStyleProvider styleProvider) {
 | 
				
			||||||
 | 
							this.styleProvider=styleProvider;
 | 
				
			||||||
 | 
							
 | 
				
			||||||
		pcs=new PropertyChangeSupport(this);
 | 
							pcs=new PropertyChangeSupport(this);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		trackVerticalOffset = new TreeMap<Integer, TrackEntry>();
 | 
							trackVerticalOffset = new TreeMap<>();
 | 
				
			||||||
		trackVerticalHeight=0;
 | 
							tracksVerticalHeight=0;
 | 
				
			||||||
 | 
					 | 
				
			||||||
		nameFont = parent.getDisplay().getSystemFont();
 | 
					 | 
				
			||||||
		nameFontB = SWTResourceManager.getBoldFont(nameFont);
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
		streams = new ObservableList<>();
 | 
							streams = new ObservableList<>();
 | 
				
			||||||
		streams.addPropertyChangeListener("content", this);
 | 
							streams.addPropertyChangeListener("content", this);
 | 
				
			||||||
@@ -344,7 +335,7 @@ public class WaveformView implements IWaveformView  {
 | 
				
			|||||||
		rightSash.setBackground(SWTResourceManager.getColor(SWT.COLOR_GRAY));
 | 
							rightSash.setBackground(SWTResourceManager.getColor(SWT.COLOR_GRAY));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		Composite valuePane = new Composite(rightSash, SWT.NONE);
 | 
							Composite valuePane = new Composite(rightSash, SWT.NONE);
 | 
				
			||||||
		waveformCanvas      = new WaveformCanvas(rightSash, SWT.NONE);
 | 
							waveformCanvas      = new WaveformCanvas(rightSash, SWT.NONE, styleProvider);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		// create the name pane
 | 
							// create the name pane
 | 
				
			||||||
		createTextPane(namePane, "Name");
 | 
							createTextPane(namePane, "Name");
 | 
				
			||||||
@@ -371,15 +362,12 @@ public class WaveformView implements IWaveformView  {
 | 
				
			|||||||
				return new Point(bounds.width, bounds.height);
 | 
									return new Point(bounds.width, bounds.height);
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		};
 | 
							};
 | 
				
			||||||
		nameList.addListener(SWT.Paint, new Listener() {
 | 
							nameList.addListener(SWT.Paint, (Event event) -> {
 | 
				
			||||||
			@Override
 | 
					 | 
				
			||||||
			public void handleEvent(Event event) {
 | 
					 | 
				
			||||||
			if(!trackVerticalOffset.isEmpty()) {
 | 
								if(!trackVerticalOffset.isEmpty()) {
 | 
				
			||||||
				GC gc = event.gc;
 | 
									GC gc = event.gc;
 | 
				
			||||||
				Rectangle rect = ((Canvas) event.widget).getClientArea();
 | 
									Rectangle rect = ((Canvas) event.widget).getClientArea();
 | 
				
			||||||
				paintNames(gc, rect);
 | 
									paintNames(gc, rect);
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
		});
 | 
							});
 | 
				
			||||||
		nameList.addMouseListener(nameValueMouseListener);
 | 
							nameList.addMouseListener(nameValueMouseListener);
 | 
				
			||||||
		nameListScrolled.setContent(nameList);
 | 
							nameListScrolled.setContent(nameList);
 | 
				
			||||||
@@ -406,15 +394,12 @@ public class WaveformView implements IWaveformView  {
 | 
				
			|||||||
				return new Point(bounds.width, bounds.height);
 | 
									return new Point(bounds.width, bounds.height);
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		};
 | 
							};
 | 
				
			||||||
		valueList.addListener(SWT.Paint, new Listener() {
 | 
							valueList.addListener(SWT.Paint, (Event event) -> {
 | 
				
			||||||
			@Override
 | 
					 | 
				
			||||||
			public void handleEvent(Event event) {
 | 
					 | 
				
			||||||
			if(!trackVerticalOffset.isEmpty()) {
 | 
								if(!trackVerticalOffset.isEmpty()) {
 | 
				
			||||||
				GC gc = event.gc;
 | 
									GC gc = event.gc;
 | 
				
			||||||
				Rectangle rect = ((Canvas) event.widget).getClientArea();
 | 
									Rectangle rect = ((Canvas) event.widget).getClientArea();
 | 
				
			||||||
				paintValues(gc, rect);
 | 
									paintValues(gc, rect);
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
		});
 | 
							});
 | 
				
			||||||
		valueList.addMouseListener(nameValueMouseListener);
 | 
							valueList.addMouseListener(nameValueMouseListener);
 | 
				
			||||||
		valueListScrolled.setContent(valueList);
 | 
							valueListScrolled.setContent(valueList);
 | 
				
			||||||
@@ -423,11 +408,11 @@ public class WaveformView implements IWaveformView  {
 | 
				
			|||||||
		waveformCanvas.addPaintListener(waveformMouseListener);	
 | 
							waveformCanvas.addPaintListener(waveformMouseListener);	
 | 
				
			||||||
		waveformCanvas.addListener(SWT.MouseDown,waveformMouseListener);
 | 
							waveformCanvas.addListener(SWT.MouseDown,waveformMouseListener);
 | 
				
			||||||
		waveformCanvas.addListener(SWT.MouseUp,waveformMouseListener);
 | 
							waveformCanvas.addListener(SWT.MouseUp,waveformMouseListener);
 | 
				
			||||||
		//waveformCanvas.addListener(SWT.MouseDoubleClick,waveformMouseListener);
 | 
					 | 
				
			||||||
		waveformCanvas.addListener(SWT.MouseMove,waveformMouseListener);
 | 
							waveformCanvas.addListener(SWT.MouseMove,waveformMouseListener);
 | 
				
			||||||
		waveformCanvas.addListener(SWT.MouseWheel, waveformMouseListener);
 | 
							waveformCanvas.addListener(SWT.MouseWheel, waveformMouseListener);
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		nameListScrolled.getVerticalBar().addSelectionListener(new SelectionAdapter() {
 | 
							nameListScrolled.getVerticalBar().addSelectionListener(new SelectionAdapter() {
 | 
				
			||||||
 | 
								@Override
 | 
				
			||||||
			public void widgetSelected(SelectionEvent e) {
 | 
								public void widgetSelected(SelectionEvent e) {
 | 
				
			||||||
				int y = ((ScrollBar) e.widget).getSelection();
 | 
									int y = ((ScrollBar) e.widget).getSelection();
 | 
				
			||||||
				Point v = valueListScrolled.getOrigin();
 | 
									Point v = valueListScrolled.getOrigin();
 | 
				
			||||||
@@ -437,6 +422,7 @@ public class WaveformView implements IWaveformView  {
 | 
				
			|||||||
			}
 | 
								}
 | 
				
			||||||
		});
 | 
							});
 | 
				
			||||||
		valueListScrolled.getVerticalBar().addSelectionListener(new SelectionAdapter() {
 | 
							valueListScrolled.getVerticalBar().addSelectionListener(new SelectionAdapter() {
 | 
				
			||||||
 | 
								@Override
 | 
				
			||||||
			public void widgetSelected(SelectionEvent e) {
 | 
								public void widgetSelected(SelectionEvent e) {
 | 
				
			||||||
				int y = ((ScrollBar) e.widget).getSelection();
 | 
									int y = ((ScrollBar) e.widget).getSelection();
 | 
				
			||||||
				nameListScrolled.setOrigin(nameListScrolled.getOrigin().x, y);
 | 
									nameListScrolled.setOrigin(nameListScrolled.getOrigin().x, y);
 | 
				
			||||||
@@ -444,6 +430,7 @@ public class WaveformView implements IWaveformView  {
 | 
				
			|||||||
			}
 | 
								}
 | 
				
			||||||
		});
 | 
							});
 | 
				
			||||||
		waveformCanvas.addSelectionListener(new SelectionAdapter() {
 | 
							waveformCanvas.addSelectionListener(new SelectionAdapter() {
 | 
				
			||||||
 | 
								@Override
 | 
				
			||||||
			public void widgetSelected(SelectionEvent e) {
 | 
								public void widgetSelected(SelectionEvent e) {
 | 
				
			||||||
				int y = waveformCanvas.getVerticalBar().getSelection();
 | 
									int y = waveformCanvas.getVerticalBar().getSelection();
 | 
				
			||||||
				nameListScrolled.setOrigin(nameListScrolled.getOrigin().x, y);
 | 
									nameListScrolled.setOrigin(nameListScrolled.getOrigin().x, y);
 | 
				
			||||||
@@ -465,81 +452,73 @@ public class WaveformView implements IWaveformView  {
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	private void createTextPane(Composite namePane, String text) {
 | 
						private void createTextPane(Composite namePane, String text) {
 | 
				
			||||||
		GridLayout gl_namePane = new GridLayout(1, false);
 | 
							GridLayout glNamePane = new GridLayout(1, false);
 | 
				
			||||||
		gl_namePane.verticalSpacing = 0;
 | 
							glNamePane.verticalSpacing = 0;
 | 
				
			||||||
		gl_namePane.marginWidth = 0;
 | 
							glNamePane.marginWidth = 0;
 | 
				
			||||||
		gl_namePane.horizontalSpacing = 0;
 | 
							glNamePane.horizontalSpacing = 0;
 | 
				
			||||||
		gl_namePane.marginHeight = 0;
 | 
							glNamePane.marginHeight = 0;
 | 
				
			||||||
		namePane.setLayout(gl_namePane);
 | 
							namePane.setLayout(glNamePane);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		CLabel nameLabel = new CLabel(namePane, SWT.NONE);
 | 
							CLabel nameLabel = new CLabel(namePane, SWT.NONE);
 | 
				
			||||||
		GridData gd_nameLabel = new GridData(SWT.CENTER, SWT.CENTER, true, false, 1, 1);
 | 
							GridData gdNameLabel = new GridData(SWT.CENTER, SWT.CENTER, true, false, 1, 1);
 | 
				
			||||||
		gd_nameLabel.heightHint = waveformCanvas.getRulerHeight() - 2;
 | 
							gdNameLabel.heightHint = waveformCanvas.getRulerHeight() - 2;
 | 
				
			||||||
		nameLabel.setLayoutData(gd_nameLabel);
 | 
							nameLabel.setLayoutData(gdNameLabel);
 | 
				
			||||||
		nameLabel.setText(text);
 | 
							nameLabel.setText(text);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		Label nameSep = new Label(namePane, SWT.SEPARATOR | SWT.HORIZONTAL);
 | 
							Label nameSep = new Label(namePane, SWT.SEPARATOR | SWT.HORIZONTAL);
 | 
				
			||||||
		nameSep.setBackground(SWTResourceManager.getColor(SWT.COLOR_DARK_GRAY));
 | 
							nameSep.setBackground(SWTResourceManager.getColor(SWT.COLOR_DARK_GRAY));
 | 
				
			||||||
		nameSep.setForeground(SWTResourceManager.getColor(SWT.COLOR_BLACK));
 | 
							nameSep.setForeground(SWTResourceManager.getColor(SWT.COLOR_BLACK));
 | 
				
			||||||
		GridData gd_nameSep = new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1);
 | 
							GridData gdNameSep = new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1);
 | 
				
			||||||
		gd_nameSep.heightHint = 2;
 | 
							gdNameSep.heightHint = 2;
 | 
				
			||||||
		nameSep.setLayoutData(gd_nameSep);
 | 
							nameSep.setLayoutData(gdNameSep);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	@Override
 | 
						@Override
 | 
				
			||||||
	public void propertyChange(PropertyChangeEvent pce) {
 | 
						public void propertyChange(PropertyChangeEvent pce) {
 | 
				
			||||||
		if ("size".equals(pce.getPropertyName()) || "content".equals(pce.getPropertyName())) {
 | 
							if ("size".equals(pce.getPropertyName()) || "content".equals(pce.getPropertyName())) {
 | 
				
			||||||
			if(revealSelected) {
 | 
								if(revealSelected) {
 | 
				
			||||||
				waveformCanvas.getDisplay().asyncExec(new Runnable() {
 | 
									waveformCanvas.getDisplay().asyncExec(() ->{
 | 
				
			||||||
					@Override
 | 
					 | 
				
			||||||
					public void run() {
 | 
					 | 
				
			||||||
						update();
 | 
											update();
 | 
				
			||||||
						currentWaveformSelection.stream().forEach(e -> waveformCanvas.reveal(e.waveform));
 | 
											currentWaveformSelection.stream().forEach(e -> waveformCanvas.reveal(e.waveform));
 | 
				
			||||||
						valueList.redraw();
 | 
											valueList.redraw();
 | 
				
			||||||
						nameList.redraw();
 | 
											nameList.redraw();
 | 
				
			||||||
					}
 | 
					 | 
				
			||||||
				});
 | 
									});
 | 
				
			||||||
				revealSelected=false;
 | 
									revealSelected=false;
 | 
				
			||||||
			} else 
 | 
								} else 
 | 
				
			||||||
				waveformCanvas.getDisplay().asyncExec(new Runnable() {
 | 
									waveformCanvas.getDisplay().asyncExec(WaveformView.this::update);
 | 
				
			||||||
					@Override
 | 
					 | 
				
			||||||
					public void run() {
 | 
					 | 
				
			||||||
						update();
 | 
					 | 
				
			||||||
					}
 | 
					 | 
				
			||||||
				});
 | 
					 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	public void update() {
 | 
						public void update() {
 | 
				
			||||||
		trackVerticalHeight = 0;
 | 
							tracksVerticalHeight = 0;
 | 
				
			||||||
		int nameMaxWidth = 0;
 | 
							int nameMaxWidth = 0;
 | 
				
			||||||
		IWaveformPainter painter = null;
 | 
							IWaveformPainter painter = null;
 | 
				
			||||||
		trackVerticalOffset.clear();
 | 
							trackVerticalOffset.clear();
 | 
				
			||||||
		waveformCanvas.clearAllWaveformPainter(false);
 | 
							waveformCanvas.clearAllWaveformPainter(false);
 | 
				
			||||||
		boolean even = true;
 | 
							boolean even = true;
 | 
				
			||||||
		TextLayout tl = new TextLayout(waveformCanvas.getDisplay());
 | 
							TextLayout tl = new TextLayout(waveformCanvas.getDisplay());
 | 
				
			||||||
		tl.setFont(nameFontB);
 | 
							tl.setFont(styleProvider.getNameFont());
 | 
				
			||||||
		for (TrackEntry streamEntry : streams) {
 | 
							for (TrackEntry streamEntry : streams) {
 | 
				
			||||||
			streamEntry.height = waveformCanvas.getTrackHeight();
 | 
								streamEntry.height = styleProvider.getTrackHeight();
 | 
				
			||||||
			streamEntry.vOffset=trackVerticalHeight;
 | 
								streamEntry.vOffset=tracksVerticalHeight;
 | 
				
			||||||
			if (streamEntry.isStream()) {
 | 
								if (streamEntry.waveform.getType()==WaveformType.TRANSACTION) {
 | 
				
			||||||
				streamEntry.currentValue="";
 | 
									streamEntry.currentValue="";
 | 
				
			||||||
				streamEntry.height *= streamEntry.getStream().getMaxConcurrency();
 | 
									streamEntry.height *= streamEntry.waveform.getWidth();
 | 
				
			||||||
				painter = new StreamPainter(waveformCanvas, even, streamEntry);
 | 
									painter = new StreamPainter(waveformCanvas, even, streamEntry);
 | 
				
			||||||
			} else if (streamEntry.isSignal()) {
 | 
								} else if (streamEntry.waveform.getType()==WaveformType.SIGNAL) {
 | 
				
			||||||
				streamEntry.currentValue="---";
 | 
									streamEntry.currentValue="---";
 | 
				
			||||||
				painter = new SignalPainter(waveformCanvas, even, streamEntry);
 | 
									painter = new SignalPainter(waveformCanvas, even, streamEntry);
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			waveformCanvas.addWaveformPainter(painter, false);
 | 
								waveformCanvas.addWaveformPainter(painter, false);
 | 
				
			||||||
			trackVerticalOffset.put(trackVerticalHeight, streamEntry);
 | 
								trackVerticalOffset.put(tracksVerticalHeight, streamEntry);
 | 
				
			||||||
			tl.setText(streamEntry.waveform.getFullName());
 | 
								tl.setText(streamEntry.waveform.getFullName());
 | 
				
			||||||
			nameMaxWidth = Math.max(nameMaxWidth, tl.getBounds().width);
 | 
								nameMaxWidth = Math.max(nameMaxWidth, tl.getBounds().width);
 | 
				
			||||||
			trackVerticalHeight += streamEntry.height;
 | 
								tracksVerticalHeight += streamEntry.height;
 | 
				
			||||||
			even = !even;
 | 
								even = !even;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		waveformCanvas.syncScrollBars();
 | 
							waveformCanvas.syncScrollBars();
 | 
				
			||||||
		nameList.setSize(nameMaxWidth + 15, trackVerticalHeight);
 | 
							nameList.setSize(nameMaxWidth + 15, tracksVerticalHeight);
 | 
				
			||||||
		nameListScrolled.setMinSize(nameMaxWidth + 15, trackVerticalHeight);
 | 
							nameListScrolled.setMinSize(nameMaxWidth + 15, tracksVerticalHeight);
 | 
				
			||||||
		nameList.redraw();
 | 
							nameList.redraw();
 | 
				
			||||||
		updateValueList();
 | 
							updateValueList();
 | 
				
			||||||
		waveformCanvas.redraw();
 | 
							waveformCanvas.redraw();
 | 
				
			||||||
@@ -551,7 +530,7 @@ public class WaveformView implements IWaveformView  {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	private int calculateValueWidth() {
 | 
						private int calculateValueWidth() {
 | 
				
			||||||
		TextLayout tl = new TextLayout(waveformCanvas.getDisplay());
 | 
							TextLayout tl = new TextLayout(waveformCanvas.getDisplay());
 | 
				
			||||||
		tl.setFont(nameFontB);
 | 
							tl.setFont(styleProvider.getNameFontHighlite());
 | 
				
			||||||
		int valueMaxWidth = 0;
 | 
							int valueMaxWidth = 0;
 | 
				
			||||||
		for (TrackEntry v : streams) {
 | 
							for (TrackEntry v : streams) {
 | 
				
			||||||
			tl.setText(v.currentValue);
 | 
								tl.setText(v.currentValue);
 | 
				
			||||||
@@ -563,15 +542,13 @@ public class WaveformView implements IWaveformView  {
 | 
				
			|||||||
	private void updateValueList(){
 | 
						private void updateValueList(){
 | 
				
			||||||
		final Long time = getCursorTime();
 | 
							final Long time = getCursorTime();
 | 
				
			||||||
		for(TrackEntry entry:streams){
 | 
							for(TrackEntry entry:streams){
 | 
				
			||||||
			if(entry.isSignal()){
 | 
								if(entry.waveform.getType() == WaveformType.SIGNAL){
 | 
				
			||||||
				ISignal<?> signal = (ISignal<?>) entry.waveform;
 | 
									IEvent[] value = entry.waveform.getEventsBeforeTime(time);
 | 
				
			||||||
				Object value = signal.getWaveformValueBeforeTime(time);
 | 
									if(value[0] instanceof BitVector){
 | 
				
			||||||
				if(value instanceof BitVector){
 | 
										BitVector bv = (BitVector) value[0];
 | 
				
			||||||
					BitVector bv = (BitVector) value;
 | 
					 | 
				
			||||||
					if(bv.getWidth()==1)
 | 
										if(bv.getWidth()==1)
 | 
				
			||||||
						entry.currentValue="b'"+bv;
 | 
											entry.currentValue="b'"+bv;
 | 
				
			||||||
					else {
 | 
										else {
 | 
				
			||||||
						// TODO: same code resides in SignalPainter, fix it
 | 
					 | 
				
			||||||
						switch(entry.valueDisplay) {
 | 
											switch(entry.valueDisplay) {
 | 
				
			||||||
						case SIGNED:
 | 
											case SIGNED:
 | 
				
			||||||
							entry.currentValue=Long.toString(bv.toSignedValue());
 | 
												entry.currentValue=Long.toString(bv.toSignedValue());
 | 
				
			||||||
@@ -583,43 +560,44 @@ public class WaveformView implements IWaveformView  {
 | 
				
			|||||||
							entry.currentValue="h'"+bv.toHexString();
 | 
												entry.currentValue="h'"+bv.toHexString();
 | 
				
			||||||
						}
 | 
											}
 | 
				
			||||||
					}
 | 
										}
 | 
				
			||||||
				} else if(value instanceof Double){
 | 
									} else if(value[0] instanceof DoubleVal){
 | 
				
			||||||
					Double val = (Double) value;
 | 
										Double val = ((DoubleVal) value[0]).value;
 | 
				
			||||||
					if(val>0.001)
 | 
										if(val>0.001)
 | 
				
			||||||
						entry.currentValue=String.format("%1$,.3f", val);
 | 
											entry.currentValue=String.format("%1$,.3f", val);
 | 
				
			||||||
					else
 | 
										else
 | 
				
			||||||
						entry.currentValue=Double.toString(val);
 | 
											entry.currentValue=Double.toString(val);
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
			} else if(entry.isStream()){
 | 
								} else if(entry.waveform.getType() == WaveformType.TRANSACTION){
 | 
				
			||||||
				ITxStream<?> stream = (ITxStream<?>) entry.waveform;
 | 
									ITx[] resultsList = new ITx[entry.waveform.getWidth()];
 | 
				
			||||||
				ITx[] resultsList = new ITx[stream.getMaxConcurrency()];
 | 
									Entry<Long, IEvent[]> firstTx=entry.waveform.getEvents().floorEntry(time);
 | 
				
			||||||
				Entry<Long, List<ITxEvent>> firstTx=stream.getEvents().floorEntry(time);
 | 
					 | 
				
			||||||
				if(firstTx!=null){
 | 
									if(firstTx!=null){
 | 
				
			||||||
					do {
 | 
										do {
 | 
				
			||||||
						for(ITxEvent evt:firstTx.getValue()){
 | 
											for(IEvent evt:firstTx.getValue()){
 | 
				
			||||||
							ITx tx=evt.getTransaction();
 | 
												if(evt instanceof ITxEvent) {
 | 
				
			||||||
							if(evt.getType()==ITxEvent.Type.BEGIN && tx.getBeginTime()<=time && tx.getEndTime()>=time){
 | 
												ITx tx=((ITxEvent)evt).getTransaction();
 | 
				
			||||||
 | 
												if(evt.getKind()==EventKind.BEGIN && tx.getBeginTime()<=time && tx.getEndTime()>=time){
 | 
				
			||||||
								if(resultsList[tx.getConcurrencyIndex()]==null)
 | 
													if(resultsList[tx.getConcurrencyIndex()]==null)
 | 
				
			||||||
									resultsList[tx.getConcurrencyIndex()]= evt.getTransaction();
 | 
														resultsList[tx.getConcurrencyIndex()]= ((ITxEvent)evt).getTransaction();
 | 
				
			||||||
							}
 | 
												}
 | 
				
			||||||
							}
 | 
												}
 | 
				
			||||||
						firstTx=stream.getEvents().lowerEntry(firstTx.getKey());	
 | 
											}
 | 
				
			||||||
 | 
											firstTx=entry.waveform.getEvents().lowerEntry(firstTx.getKey());	
 | 
				
			||||||
					}while(firstTx!=null && !isArrayFull(resultsList));
 | 
										}while(firstTx!=null && !isArrayFull(resultsList));
 | 
				
			||||||
					entry.currentValue="";
 | 
					 | 
				
			||||||
					boolean separator=false;
 | 
										boolean separator=false;
 | 
				
			||||||
									
 | 
										StringBuilder sb = new StringBuilder();
 | 
				
			||||||
					for(ITx o:resultsList){
 | 
										for(ITx o:resultsList){
 | 
				
			||||||
						if(separator) entry.currentValue+="|";
 | 
											if(separator) sb.append("|");
 | 
				
			||||||
						if(o!=null) entry.currentValue+=((ITx)o).getGenerator().getName();
 | 
											if(o!=null) sb.append(o.getGenerator().getName());
 | 
				
			||||||
											
 | 
					 | 
				
			||||||
						separator=true;
 | 
											separator=true;
 | 
				
			||||||
					}
 | 
										}
 | 
				
			||||||
 | 
										entry.currentValue=sb.toString();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		int width = calculateValueWidth();
 | 
							int width = calculateValueWidth();
 | 
				
			||||||
		valueList.setSize(width, trackVerticalHeight);
 | 
							valueList.setSize(width, tracksVerticalHeight);
 | 
				
			||||||
		valueListScrolled.setMinSize(width, trackVerticalHeight);
 | 
							valueListScrolled.setMinSize(width, tracksVerticalHeight);
 | 
				
			||||||
		valueListScrolled.redraw();
 | 
							valueListScrolled.redraw();
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
@@ -688,7 +666,6 @@ public class WaveformView implements IWaveformView  {
 | 
				
			|||||||
		if (currentTxSelection != null) {
 | 
							if (currentTxSelection != null) {
 | 
				
			||||||
			sel.add(currentTxSelection);
 | 
								sel.add(currentTxSelection);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		// sel.addAll(currentWaveformSelection.stream().map(e -> e.waveform).collect(Collectors.toList()));
 | 
					 | 
				
			||||||
		sel.addAll(currentWaveformSelection);
 | 
							sel.addAll(currentWaveformSelection);
 | 
				
			||||||
		return new StructuredSelection(sel.toArray());
 | 
							return new StructuredSelection(sel.toArray());
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
@@ -730,16 +707,10 @@ public class WaveformView implements IWaveformView  {
 | 
				
			|||||||
						ITx txSel = (ITx) sel;
 | 
											ITx txSel = (ITx) sel;
 | 
				
			||||||
						TrackEntry trackEntry = getEntryForStream(txSel.getStream());
 | 
											TrackEntry trackEntry = getEntryForStream(txSel.getStream());
 | 
				
			||||||
						if(trackEntry==null && addIfNeeded){
 | 
											if(trackEntry==null && addIfNeeded){
 | 
				
			||||||
							trackEntry=new TrackEntry(txSel.getStream());
 | 
												trackEntry=new TrackEntry(txSel.getStream(), styleProvider);
 | 
				
			||||||
							// compute fallback colors
 | 
					 | 
				
			||||||
							Color fallbackColors[] = TrackEntry.computeColor(txSel.getStream().getName(), TrackEntry.fallbackColor, TrackEntry.highlightedFallbackColor);
 | 
					 | 
				
			||||||
							trackEntry.setColor(fallbackColors[0], fallbackColors[1]);
 | 
					 | 
				
			||||||
							streams.add(trackEntry);
 | 
												streams.add(trackEntry);
 | 
				
			||||||
						}
 | 
											}
 | 
				
			||||||
						currentTxSelection = txSel;
 | 
											currentTxSelection = txSel;
 | 
				
			||||||
//						if(trackEntry!=null) {
 | 
					 | 
				
			||||||
//							currentWaveformSelection.add((TrackEntry)sel);
 | 
					 | 
				
			||||||
//						}
 | 
					 | 
				
			||||||
						selectionChanged = true;
 | 
											selectionChanged = true;
 | 
				
			||||||
					} else if (sel instanceof TrackEntry && !currentWaveformSelection.contains(sel)) {
 | 
										} else if (sel instanceof TrackEntry && !currentWaveformSelection.contains(sel)) {
 | 
				
			||||||
						currentWaveformSelection.add((TrackEntry)sel);
 | 
											currentWaveformSelection.add((TrackEntry)sel);
 | 
				
			||||||
@@ -750,7 +721,7 @@ public class WaveformView implements IWaveformView  {
 | 
				
			|||||||
				}
 | 
									}
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		} else {
 | 
							} else {
 | 
				
			||||||
			if (currentTxSelection != null || currentWaveformSelection.size() > 0)
 | 
								if (currentTxSelection != null || !currentWaveformSelection.isEmpty())
 | 
				
			||||||
				selectionChanged = true;
 | 
									selectionChanged = true;
 | 
				
			||||||
			currentTxSelection = null;
 | 
								currentTxSelection = null;
 | 
				
			||||||
			currentWaveformSelection.clear();
 | 
								currentWaveformSelection.clear();
 | 
				
			||||||
@@ -804,15 +775,14 @@ public class WaveformView implements IWaveformView  {
 | 
				
			|||||||
		else if(currentWaveformSelection.size()!=1) return;
 | 
							else if(currentWaveformSelection.size()!=1) return;
 | 
				
			||||||
		if(selectedWaveform==null)
 | 
							if(selectedWaveform==null)
 | 
				
			||||||
			selectedWaveform = currentWaveformSelection.get(1);
 | 
								selectedWaveform = currentWaveformSelection.get(1);
 | 
				
			||||||
		if (selectedWaveform!=null && selectedWaveform.isStream() && currentTxSelection!=null) {
 | 
							if (selectedWaveform!=null && selectedWaveform.waveform.getType()==WaveformType.TRANSACTION && currentTxSelection!=null) {
 | 
				
			||||||
			if(relationType.equals(IWaveformView.NEXT_PREV_IN_STREAM)){
 | 
								if(relationType.equals(IWaveformView.NEXT_PREV_IN_STREAM)){
 | 
				
			||||||
				ITxStream<? extends ITxEvent> stream = selectedWaveform.getStream();
 | 
					 | 
				
			||||||
				ITx transaction = null;
 | 
									ITx transaction = null;
 | 
				
			||||||
				if (direction == GotoDirection.NEXT) {
 | 
									if (direction == GotoDirection.NEXT) {
 | 
				
			||||||
					List<ITxEvent> thisEntryList = stream.getEvents().get(currentTxSelection.getBeginTime());
 | 
										ITxEvent[] thisEntryList = (ITxEvent[]) selectedWaveform.waveform.getEvents().get(currentTxSelection.getBeginTime());
 | 
				
			||||||
					boolean meFound=false;
 | 
										boolean meFound=false;
 | 
				
			||||||
					for (ITxEvent evt : thisEntryList) {
 | 
										for (ITxEvent evt : thisEntryList) {
 | 
				
			||||||
						if (evt.getType() == ITxEvent.Type.BEGIN) {
 | 
											if (evt.getKind() == EventKind.BEGIN) {
 | 
				
			||||||
							if(meFound){
 | 
												if(meFound){
 | 
				
			||||||
								transaction = evt.getTransaction();
 | 
													transaction = evt.getTransaction();
 | 
				
			||||||
								break;
 | 
													break;
 | 
				
			||||||
@@ -821,42 +791,42 @@ public class WaveformView implements IWaveformView  {
 | 
				
			|||||||
						}
 | 
											}
 | 
				
			||||||
					}
 | 
										}
 | 
				
			||||||
					if (transaction == null){
 | 
										if (transaction == null){
 | 
				
			||||||
						Entry<Long, List<ITxEvent>> entry = stream.getEvents().higherEntry(currentTxSelection.getBeginTime());
 | 
											Entry<Long, IEvent[]> entry = selectedWaveform.waveform.getEvents().higherEntry(currentTxSelection.getBeginTime());
 | 
				
			||||||
						if (entry != null) do {
 | 
											if (entry != null) do {
 | 
				
			||||||
							for (ITxEvent evt : entry.getValue()) {
 | 
												for (IEvent evt : entry.getValue()) {
 | 
				
			||||||
								if (evt.getType() == ITxEvent.Type.BEGIN) {
 | 
													if (evt instanceof ITxEvent && evt.getKind() == EventKind.BEGIN) {
 | 
				
			||||||
									transaction = evt.getTransaction();
 | 
														transaction = ((ITxEvent)evt).getTransaction();
 | 
				
			||||||
									break;
 | 
														break;
 | 
				
			||||||
								}
 | 
													}
 | 
				
			||||||
							}
 | 
												}
 | 
				
			||||||
							if (transaction == null)
 | 
												if (transaction == null)
 | 
				
			||||||
								entry = stream.getEvents().higherEntry(entry.getKey());
 | 
													entry = selectedWaveform.waveform.getEvents().higherEntry(entry.getKey());
 | 
				
			||||||
						} while (entry != null && transaction == null);
 | 
											} while (entry != null && transaction == null);
 | 
				
			||||||
					}
 | 
										}
 | 
				
			||||||
				} else if (direction == GotoDirection.PREV) {
 | 
									} else if (direction == GotoDirection.PREV) {
 | 
				
			||||||
					List<ITxEvent> thisEntryList = stream.getEvents().get(currentTxSelection.getBeginTime());
 | 
										IEvent[] thisEntryList = selectedWaveform.waveform.getEvents().get(currentTxSelection.getBeginTime());
 | 
				
			||||||
					boolean meFound=false;
 | 
										boolean meFound=false;
 | 
				
			||||||
					for (ITxEvent evt :  Lists.reverse(thisEntryList)) {
 | 
										for (IEvent evt :  Lists.reverse(Arrays.asList(thisEntryList))) {
 | 
				
			||||||
						if (evt.getType() == ITxEvent.Type.BEGIN) {
 | 
											if (evt instanceof ITxEvent && evt.getKind() == EventKind.BEGIN) {
 | 
				
			||||||
							if(meFound){
 | 
												if(meFound){
 | 
				
			||||||
								transaction = evt.getTransaction();
 | 
													transaction = ((ITxEvent)evt).getTransaction();
 | 
				
			||||||
								break;
 | 
													break;
 | 
				
			||||||
							}
 | 
												}
 | 
				
			||||||
							meFound|= evt.getTransaction().equals(currentTxSelection);
 | 
												meFound|= ((ITxEvent)evt).getTransaction().equals(currentTxSelection);
 | 
				
			||||||
						}
 | 
											}
 | 
				
			||||||
					}
 | 
										}
 | 
				
			||||||
					if (transaction == null){
 | 
										if (transaction == null){
 | 
				
			||||||
						Entry<Long, List<ITxEvent>> entry = stream.getEvents().lowerEntry(currentTxSelection.getBeginTime());
 | 
											Entry<Long, IEvent[]> entry = selectedWaveform.waveform.getEvents().lowerEntry(currentTxSelection.getBeginTime());
 | 
				
			||||||
						if (entry != null)
 | 
											if (entry != null)
 | 
				
			||||||
							do {
 | 
												do {
 | 
				
			||||||
								for (ITxEvent evt : Lists.reverse(entry.getValue())) {
 | 
													for (IEvent evt : Lists.reverse(Arrays.asList(thisEntryList))) {
 | 
				
			||||||
									if (evt.getType() == ITxEvent.Type.BEGIN) {
 | 
														if (evt instanceof ITxEvent && evt.getKind() == EventKind.BEGIN) {
 | 
				
			||||||
										transaction = evt.getTransaction();
 | 
															transaction = ((ITxEvent)evt).getTransaction();
 | 
				
			||||||
										break;
 | 
															break;
 | 
				
			||||||
									}
 | 
														}
 | 
				
			||||||
								}
 | 
													}
 | 
				
			||||||
								if (transaction == null)
 | 
													if (transaction == null)
 | 
				
			||||||
									entry = stream.getEvents().lowerEntry(entry.getKey());
 | 
														entry = selectedWaveform.waveform.getEvents().lowerEntry(entry.getKey());
 | 
				
			||||||
							} while (entry != null && transaction == null);
 | 
												} while (entry != null && transaction == null);
 | 
				
			||||||
					}
 | 
										}
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
@@ -879,13 +849,12 @@ public class WaveformView implements IWaveformView  {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	private ITxRelation selectTxToNavigateTo(Collection<ITxRelation> rel, RelationType relationType, boolean target) {
 | 
						private ITxRelation selectTxToNavigateTo(Collection<ITxRelation> rel, RelationType relationType, boolean target) {
 | 
				
			||||||
		ArrayList<ITxRelation> candidates = rel.stream().filter(r -> relationType.equals(r.getRelationType())).collect(Collectors.toCollection(ArrayList::new));
 | 
							ArrayList<ITxRelation> candidates = rel.stream().filter(r -> relationType.equals(r.getRelationType())).collect(Collectors.toCollection(ArrayList::new));
 | 
				
			||||||
		//new RelSelectionDialog(waveformCanvas.getShell(), candidates, target).open();
 | 
					 | 
				
			||||||
		switch (candidates.size()) {
 | 
							switch (candidates.size()) {
 | 
				
			||||||
		case 0: return null;
 | 
							case 0: return null;
 | 
				
			||||||
		case 1: return candidates.get(0);
 | 
							case 1: return candidates.get(0);
 | 
				
			||||||
		default:
 | 
							default:
 | 
				
			||||||
			ArrayList<ITxRelation> visibleCandidates = candidates.stream().filter(r -> streamsVisible(r)).collect(Collectors.toCollection(ArrayList::new));
 | 
								ArrayList<ITxRelation> visibleCandidates = candidates.stream().filter(this::streamsVisible).collect(Collectors.toCollection(ArrayList::new));
 | 
				
			||||||
			if(visibleCandidates.size()==0) {
 | 
								if(visibleCandidates.isEmpty()) {
 | 
				
			||||||
				return new RelSelectionDialog(waveformCanvas.getShell(), candidates, target).open();
 | 
									return new RelSelectionDialog(waveformCanvas.getShell(), candidates, target).open();
 | 
				
			||||||
			} else if(visibleCandidates.size()==1) {
 | 
								} else if(visibleCandidates.size()==1) {
 | 
				
			||||||
				return visibleCandidates.size()==1?visibleCandidates.get(0):null;
 | 
									return visibleCandidates.size()==1?visibleCandidates.get(0):null;
 | 
				
			||||||
@@ -896,8 +865,8 @@ public class WaveformView implements IWaveformView  {
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	private boolean streamsVisible(ITxRelation relation) {
 | 
						private boolean streamsVisible(ITxRelation relation) {
 | 
				
			||||||
		final ITxStream<ITxEvent> src = relation.getSource().getStream();
 | 
							final IWaveform src = relation.getSource().getStream();
 | 
				
			||||||
		final ITxStream<ITxEvent> tgt = relation.getTarget().getStream();
 | 
							final IWaveform tgt = relation.getTarget().getStream();
 | 
				
			||||||
		return streams.stream().anyMatch(x -> x.waveform == src) && streams.stream().anyMatch(x -> x.waveform == tgt);
 | 
							return streams.stream().anyMatch(x -> x.waveform == src) && streams.stream().anyMatch(x -> x.waveform == tgt);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -910,10 +879,8 @@ public class WaveformView implements IWaveformView  {
 | 
				
			|||||||
		TrackEntry sel = currentWaveformSelection.get(0);
 | 
							TrackEntry sel = currentWaveformSelection.get(0);
 | 
				
			||||||
		long time = getCursorTime();
 | 
							long time = getCursorTime();
 | 
				
			||||||
		NavigableMap<Long, ?> map=null;
 | 
							NavigableMap<Long, ?> map=null;
 | 
				
			||||||
		if(sel.isStream()){
 | 
							if(sel.waveform.getType()==WaveformType.TRANSACTION || sel.waveform.getType()==WaveformType.SIGNAL){
 | 
				
			||||||
			map=sel.getStream().getEvents();
 | 
								map=sel.waveform.getEvents();
 | 
				
			||||||
		} else if(sel.isSignal()){
 | 
					 | 
				
			||||||
			map=sel.getSignal().getEvents();
 | 
					 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		if(map!=null){
 | 
							if(map!=null){
 | 
				
			||||||
			Entry<Long, ?> entry=direction==GotoDirection.PREV?map.lowerEntry(time):map.higherEntry(time);
 | 
								Entry<Long, ?> entry=direction==GotoDirection.PREV?map.lowerEntry(time):map.higherEntry(time);
 | 
				
			||||||
@@ -940,12 +907,12 @@ public class WaveformView implements IWaveformView  {
 | 
				
			|||||||
	 */
 | 
						 */
 | 
				
			||||||
	@Override
 | 
						@Override
 | 
				
			||||||
	public void deleteSelectedTracks() {
 | 
						public void deleteSelectedTracks() {
 | 
				
			||||||
		List<TrackEntry> streams = getStreamList();
 | 
							List<TrackEntry> streamList = getStreamList();
 | 
				
			||||||
		for (Object o : (IStructuredSelection)getSelection()) {
 | 
							for (Object o : (IStructuredSelection)getSelection()) {
 | 
				
			||||||
			if(o instanceof TrackEntry) {
 | 
								if(o instanceof TrackEntry) {
 | 
				
			||||||
				TrackEntry e = (TrackEntry) o;
 | 
									TrackEntry e = (TrackEntry) o;
 | 
				
			||||||
				e.selected=false;
 | 
									e.selected=false;
 | 
				
			||||||
				streams.remove(e);				
 | 
									streamList.remove(e);				
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		setSelection(new StructuredSelection());
 | 
							setSelection(new StructuredSelection());
 | 
				
			||||||
@@ -956,7 +923,7 @@ public class WaveformView implements IWaveformView  {
 | 
				
			|||||||
	 */
 | 
						 */
 | 
				
			||||||
	@Override
 | 
						@Override
 | 
				
			||||||
	public void moveSelectedTrack(int i) {
 | 
						public void moveSelectedTrack(int i) {
 | 
				
			||||||
		if(currentWaveformSelection.size()>0){
 | 
							if(!currentWaveformSelection.isEmpty()){
 | 
				
			||||||
			int idx = streams.indexOf(currentWaveformSelection.get(0));
 | 
								int idx = streams.indexOf(currentWaveformSelection.get(0));
 | 
				
			||||||
			for(Object o: currentWaveformSelection)
 | 
								for(Object o: currentWaveformSelection)
 | 
				
			||||||
				streams.remove(o);
 | 
									streams.remove(o);
 | 
				
			||||||
@@ -971,25 +938,25 @@ public class WaveformView implements IWaveformView  {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	protected void paintNames(GC gc, Rectangle rect) {
 | 
						protected void paintNames(GC gc, Rectangle rect) {
 | 
				
			||||||
		if (streams.size() > 0) {
 | 
							if (!streams.isEmpty()) {
 | 
				
			||||||
			try {
 | 
								try {
 | 
				
			||||||
				Integer firstKey = trackVerticalOffset.floorKey(rect.y);
 | 
									Integer firstKey = trackVerticalOffset.floorKey(rect.y);
 | 
				
			||||||
				if (firstKey == null)
 | 
									if (firstKey == null)
 | 
				
			||||||
					firstKey = trackVerticalOffset.firstKey();
 | 
										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, waveformCanvas.getTrackHeight());
 | 
									Rectangle subArea = new Rectangle(rect.x, 0, rect.width, styleProvider.getTrackHeight());
 | 
				
			||||||
				if (lastKey == firstKey) {
 | 
									if (lastKey.equals(firstKey)) {
 | 
				
			||||||
					TrackEntry trackEntry=trackVerticalOffset.get(firstKey);
 | 
										TrackEntry trackEntry=trackVerticalOffset.get(firstKey);
 | 
				
			||||||
					IWaveform w = trackEntry.waveform;
 | 
										IWaveform w = trackEntry.waveform;
 | 
				
			||||||
					if (w instanceof ITxStream<?>)
 | 
										if (w.getType()==WaveformType.TRANSACTION)
 | 
				
			||||||
						subArea.height *= ((ITxStream<?>) w).getMaxConcurrency();
 | 
											subArea.height *= w.getWidth();
 | 
				
			||||||
					drawTextFormat(gc, subArea, firstKey, w.getFullName(), trackEntry.selected);
 | 
										drawTextFormat(gc, subArea, firstKey, w.getFullName(), trackEntry.selected);
 | 
				
			||||||
				} else {
 | 
									} else {
 | 
				
			||||||
					for (Entry<Integer, TrackEntry> entry : trackVerticalOffset.subMap(firstKey, true, lastKey, true).entrySet()) {
 | 
										for (Entry<Integer, TrackEntry> entry : trackVerticalOffset.subMap(firstKey, true, lastKey, true).entrySet()) {
 | 
				
			||||||
						IWaveform w = entry.getValue().waveform;
 | 
											IWaveform w = entry.getValue().waveform;
 | 
				
			||||||
						subArea.height = waveformCanvas.getTrackHeight();
 | 
											subArea.height = styleProvider.getTrackHeight();
 | 
				
			||||||
						if (w instanceof ITxStream<?>)
 | 
											if (w.getType()==WaveformType.TRANSACTION)
 | 
				
			||||||
							subArea.height *= ((ITxStream<?>) w).getMaxConcurrency();
 | 
												subArea.height *= w.getWidth();
 | 
				
			||||||
						drawTextFormat(gc, subArea, entry.getKey(), w.getFullName(), entry.getValue().selected);
 | 
											drawTextFormat(gc, subArea, entry.getKey(), w.getFullName(), entry.getValue().selected);
 | 
				
			||||||
					}
 | 
										}
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
@@ -998,26 +965,26 @@ public class WaveformView implements IWaveformView  {
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	protected void paintValues(GC gc, Rectangle rect) {
 | 
						protected void paintValues(GC gc, Rectangle rect) {
 | 
				
			||||||
		if (streams.size() > 0) {
 | 
							if (!streams.isEmpty()) {
 | 
				
			||||||
			try {
 | 
								try {
 | 
				
			||||||
				Integer firstKey = trackVerticalOffset.floorKey(rect.y);
 | 
									Integer firstKey = trackVerticalOffset.floorKey(rect.y);
 | 
				
			||||||
				if (firstKey == null)
 | 
									if (firstKey == null)
 | 
				
			||||||
					firstKey = trackVerticalOffset.firstKey();
 | 
										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, waveformCanvas.getTrackHeight());
 | 
									Rectangle subArea = new Rectangle(rect.x, 0, rect.width, styleProvider.getTrackHeight());
 | 
				
			||||||
				if (lastKey == firstKey) {
 | 
									if (lastKey.equals(firstKey)) {
 | 
				
			||||||
					TrackEntry trackEntry=trackVerticalOffset.get(firstKey);
 | 
										TrackEntry trackEntry=trackVerticalOffset.get(firstKey);
 | 
				
			||||||
					IWaveform w = trackEntry.waveform;
 | 
										IWaveform w = trackEntry.waveform;
 | 
				
			||||||
					if (w instanceof ITxStream<?>)
 | 
										if (w.getType()==WaveformType.TRANSACTION)
 | 
				
			||||||
						subArea.height *= ((ITxStream<?>) w).getMaxConcurrency();
 | 
											subArea.height *= w.getWidth();
 | 
				
			||||||
					drawValue(gc, subArea, firstKey, trackEntry.currentValue, trackEntry.selected);
 | 
										drawValue(gc, subArea, firstKey, trackEntry.currentValue, trackEntry.selected);
 | 
				
			||||||
				} else {
 | 
									} else {
 | 
				
			||||||
					for (Entry<Integer, TrackEntry> entry : trackVerticalOffset.subMap(firstKey, true, lastKey, true)
 | 
										for (Entry<Integer, TrackEntry> entry : trackVerticalOffset.subMap(firstKey, true, lastKey, true)
 | 
				
			||||||
							.entrySet()) {
 | 
												.entrySet()) {
 | 
				
			||||||
						IWaveform w = entry.getValue().waveform;
 | 
											IWaveform w = entry.getValue().waveform;
 | 
				
			||||||
						subArea.height = waveformCanvas.getTrackHeight();
 | 
											subArea.height = styleProvider.getTrackHeight();
 | 
				
			||||||
						if (w instanceof ITxStream<?>)
 | 
											if (w.getType()==WaveformType.TRANSACTION)
 | 
				
			||||||
							subArea.height *= ((ITxStream<?>) w).getMaxConcurrency();
 | 
												subArea.height *= w.getWidth();
 | 
				
			||||||
						drawValue(gc, subArea, entry.getKey(), entry.getValue().currentValue, entry.getValue().selected);
 | 
											drawValue(gc, subArea, entry.getKey(), entry.getValue().currentValue, entry.getValue().selected);
 | 
				
			||||||
					}
 | 
										}
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
@@ -1027,10 +994,10 @@ public class WaveformView implements IWaveformView  {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	protected void drawValue(GC gc, Rectangle subArea, Integer yOffset, String value, boolean highlite) {
 | 
						protected void drawValue(GC gc, Rectangle subArea, Integer yOffset, String value, boolean highlite) {
 | 
				
			||||||
		int beginIndex=0;
 | 
							int beginIndex=0;
 | 
				
			||||||
		for(int offset=0; offset<subArea.height; offset+=waveformCanvas.getTrackHeight()){
 | 
							for(int offset=0; offset<subArea.height; offset+=styleProvider.getTrackHeight()){
 | 
				
			||||||
			int endIndex=value.indexOf('|', beginIndex);
 | 
								int endIndex=value.indexOf('|', beginIndex);
 | 
				
			||||||
			String str = endIndex<0?value.substring(beginIndex):value.substring(beginIndex, endIndex);
 | 
								String str = endIndex<0?value.substring(beginIndex):value.substring(beginIndex, endIndex);
 | 
				
			||||||
			drawTextFormat(gc, new Rectangle(subArea.x, subArea.y, subArea.width, waveformCanvas.getTrackHeight()), yOffset+offset, str, highlite);
 | 
								drawTextFormat(gc, new Rectangle(subArea.x, subArea.y, subArea.width, styleProvider.getTrackHeight()), yOffset+offset, str, highlite);
 | 
				
			||||||
			beginIndex=endIndex<0?beginIndex:endIndex+1;
 | 
								beginIndex=endIndex<0?beginIndex:endIndex+1;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
@@ -1041,13 +1008,13 @@ public class WaveformView implements IWaveformView  {
 | 
				
			|||||||
			gc.setBackground(SWTResourceManager.getColor(SWT.COLOR_LIST_SELECTION));
 | 
								gc.setBackground(SWTResourceManager.getColor(SWT.COLOR_LIST_SELECTION));
 | 
				
			||||||
			gc.setForeground(SWTResourceManager.getColor(SWT.COLOR_LIST_SELECTION_TEXT));
 | 
								gc.setForeground(SWTResourceManager.getColor(SWT.COLOR_LIST_SELECTION_TEXT));
 | 
				
			||||||
			gc.fillRectangle(subArea.x, subArea.y + yOffset, subArea.width, subArea.height);
 | 
								gc.fillRectangle(subArea.x, subArea.y + yOffset, subArea.width, subArea.height);
 | 
				
			||||||
			gc.setFont(nameFontB);
 | 
								gc.setFont(styleProvider.getNameFontHighlite());
 | 
				
			||||||
		} else {
 | 
							} else {
 | 
				
			||||||
			gc.setBackground(namePaneHeader.getBackground());
 | 
								gc.setBackground(namePaneHeader.getBackground());
 | 
				
			||||||
			gc.setForeground(namePaneHeader.getForeground());
 | 
								gc.setForeground(namePaneHeader.getForeground());
 | 
				
			||||||
			gc.setFont(nameFont);
 | 
								gc.setFont(styleProvider.getNameFont());
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		gc.drawText(value, subArea.x + 5, subArea.y + yOffset + (waveformCanvas.getTrackHeight() - size.y) / 2, true);
 | 
							gc.drawText(value, subArea.x + 5, subArea.y + yOffset + (styleProvider.getTrackHeight() - size.y) / 2, true);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -1146,13 +1113,14 @@ public class WaveformView implements IWaveformView  {
 | 
				
			|||||||
		DragSource dragSource = new DragSource(canvas, DND.DROP_MOVE);
 | 
							DragSource dragSource = new DragSource(canvas, DND.DROP_MOVE);
 | 
				
			||||||
		dragSource.setTransfer(types);
 | 
							dragSource.setTransfer(types);
 | 
				
			||||||
		dragSource.addDragListener(new DragSourceAdapter() {
 | 
							dragSource.addDragListener(new DragSourceAdapter() {
 | 
				
			||||||
 | 
								@Override
 | 
				
			||||||
			public void dragStart(DragSourceEvent event) {
 | 
								public void dragStart(DragSourceEvent event) {
 | 
				
			||||||
				if (event.y < trackVerticalHeight) {
 | 
									if (event.y < tracksVerticalHeight) {
 | 
				
			||||||
					event.doit = true;
 | 
										event.doit = true;
 | 
				
			||||||
					LocalSelectionTransfer.getTransfer().setSelection(new StructuredSelection(currentWaveformSelection));
 | 
										LocalSelectionTransfer.getTransfer().setSelection(new StructuredSelection(currentWaveformSelection));
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
 | 
								@Override
 | 
				
			||||||
			public void dragSetData(DragSourceEvent event) {
 | 
								public void dragSetData(DragSourceEvent event) {
 | 
				
			||||||
				if (LocalSelectionTransfer.getTransfer().isSupportedType(event.dataType)) {
 | 
									if (LocalSelectionTransfer.getTransfer().isSupportedType(event.dataType)) {
 | 
				
			||||||
					event.data =getSelection(); 
 | 
										event.data =getSelection(); 
 | 
				
			||||||
@@ -1168,10 +1136,11 @@ public class WaveformView implements IWaveformView  {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
		dropTarget.addDropListener(new DropTargetAdapter() {
 | 
							dropTarget.addDropListener(new DropTargetAdapter() {
 | 
				
			||||||
			@SuppressWarnings("unchecked")
 | 
								@SuppressWarnings("unchecked")
 | 
				
			||||||
 | 
								@Override
 | 
				
			||||||
			public void drop(DropTargetEvent event) {
 | 
								public void drop(DropTargetEvent event) {
 | 
				
			||||||
				if (LocalSelectionTransfer.getTransfer().isSupportedType(event.currentDataType)){
 | 
									if (LocalSelectionTransfer.getTransfer().isSupportedType(event.currentDataType)){
 | 
				
			||||||
					ISelection s = LocalSelectionTransfer.getTransfer().getSelection();
 | 
										ISelection s = LocalSelectionTransfer.getTransfer().getSelection();
 | 
				
			||||||
					if(s!=null && s instanceof IStructuredSelection){
 | 
										if(s instanceof IStructuredSelection){
 | 
				
			||||||
						IStructuredSelection sel = (IStructuredSelection) s;
 | 
											IStructuredSelection sel = (IStructuredSelection) s;
 | 
				
			||||||
						for(Object o: sel.toList())
 | 
											for(Object o: sel.toList())
 | 
				
			||||||
							streams.remove(o);
 | 
												streams.remove(o);
 | 
				
			||||||
@@ -1188,7 +1157,7 @@ public class WaveformView implements IWaveformView  {
 | 
				
			|||||||
					}
 | 
										}
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
 | 
								@Override
 | 
				
			||||||
			public void dropAccept(DropTargetEvent event) {
 | 
								public void dropAccept(DropTargetEvent event) {
 | 
				
			||||||
				if (event.detail != DND.DROP_MOVE) {
 | 
									if (event.detail != DND.DROP_MOVE) {
 | 
				
			||||||
					event.detail = DND.DROP_NONE;
 | 
										event.detail = DND.DROP_NONE;
 | 
				
			||||||
@@ -1199,7 +1168,7 @@ public class WaveformView implements IWaveformView  {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	public TrackEntry getEntryForStream(IWaveform source) {
 | 
						public TrackEntry getEntryForStream(IWaveform source) {
 | 
				
			||||||
		for(TrackEntry trackEntry:streams)
 | 
							for(TrackEntry trackEntry:streams)
 | 
				
			||||||
			if(trackEntry.waveform.equals(source)) return trackEntry;
 | 
								if(trackEntry.waveform.isSame(source)) return trackEntry;
 | 
				
			||||||
		return null;
 | 
							return null;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -1212,6 +1181,7 @@ public class WaveformView implements IWaveformView  {
 | 
				
			|||||||
		DragSource dragSource = new DragSource(canvas, DND.DROP_MOVE);
 | 
							DragSource dragSource = new DragSource(canvas, DND.DROP_MOVE);
 | 
				
			||||||
		dragSource.setTransfer(types);
 | 
							dragSource.setTransfer(types);
 | 
				
			||||||
		dragSource.addDragListener(new DragSourceAdapter() {
 | 
							dragSource.addDragListener(new DragSourceAdapter() {
 | 
				
			||||||
 | 
								@Override
 | 
				
			||||||
			public void dragStart(DragSourceEvent event) {
 | 
								public void dragStart(DragSourceEvent event) {
 | 
				
			||||||
				event.doit = false;
 | 
									event.doit = false;
 | 
				
			||||||
				List<Object> clicked = waveformCanvas.getElementsAt(new Point(event.x, event.y));
 | 
									List<Object> clicked = waveformCanvas.getElementsAt(new Point(event.x, event.y));
 | 
				
			||||||
@@ -1224,13 +1194,22 @@ public class WaveformView implements IWaveformView  {
 | 
				
			|||||||
					}
 | 
										}
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
 | 
								@Override
 | 
				
			||||||
			public void dragSetData(DragSourceEvent event) {
 | 
								public void dragSetData(DragSourceEvent event) {
 | 
				
			||||||
				if (LocalSelectionTransfer.getTransfer().isSupportedType(event.dataType)) {
 | 
									if (LocalSelectionTransfer.getTransfer().isSupportedType(event.dataType)) {
 | 
				
			||||||
					event.data=waveformCanvas.getElementsAt(new Point(event.x, event.y)); 
 | 
										event.data=waveformCanvas.getElementsAt(new Point(event.x, event.y)); 
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		});
 | 
							});
 | 
				
			||||||
 | 
					//		int style = SWT.MULTI | SWT.WRAP | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER;
 | 
				
			||||||
 | 
					//		final StyledText text = new StyledText(waveformCanvas, style);
 | 
				
			||||||
 | 
					//		text.setText("Dragging");
 | 
				
			||||||
 | 
					//		dragSource.setDragSourceEffect(new DragSourceEffect(text) {
 | 
				
			||||||
 | 
					//			@Override
 | 
				
			||||||
 | 
					//			public void dragStart(DragSourceEvent event) {
 | 
				
			||||||
 | 
					//				event.image = waveformCanvas.getDisplay().getSystemImage(SWT.ICON_WARNING);
 | 
				
			||||||
 | 
					//			}
 | 
				
			||||||
 | 
					//		});
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	private void createWaveformDropTarget(final Canvas canvas) {
 | 
						private void createWaveformDropTarget(final Canvas canvas) {
 | 
				
			||||||
@@ -1238,10 +1217,11 @@ public class WaveformView implements IWaveformView  {
 | 
				
			|||||||
		DropTarget dropTarget = new DropTarget(canvas, DND.DROP_MOVE);
 | 
							DropTarget dropTarget = new DropTarget(canvas, DND.DROP_MOVE);
 | 
				
			||||||
		dropTarget.setTransfer(types);
 | 
							dropTarget.setTransfer(types);
 | 
				
			||||||
		dropTarget.addDropListener(new DropTargetAdapter() {
 | 
							dropTarget.addDropListener(new DropTargetAdapter() {
 | 
				
			||||||
 | 
								@Override
 | 
				
			||||||
			public void drop(DropTargetEvent event) {
 | 
								public void drop(DropTargetEvent event) {
 | 
				
			||||||
				if (LocalSelectionTransfer.getTransfer().isSupportedType(event.currentDataType)){
 | 
									if (LocalSelectionTransfer.getTransfer().isSupportedType(event.currentDataType)){
 | 
				
			||||||
					ISelection sel = LocalSelectionTransfer.getTransfer().getSelection();
 | 
										ISelection sel = LocalSelectionTransfer.getTransfer().getSelection();
 | 
				
			||||||
					if(sel!=null && sel instanceof IStructuredSelection &&
 | 
										if(sel instanceof IStructuredSelection &&
 | 
				
			||||||
							((IStructuredSelection)sel).getFirstElement() instanceof CursorPainter){
 | 
												((IStructuredSelection)sel).getFirstElement() instanceof CursorPainter){
 | 
				
			||||||
						CursorPainter painter = (CursorPainter)((IStructuredSelection)sel).getFirstElement();
 | 
											CursorPainter painter = (CursorPainter)((IStructuredSelection)sel).getFirstElement();
 | 
				
			||||||
						painter.setDragging(false);
 | 
											painter.setDragging(false);
 | 
				
			||||||
@@ -1249,17 +1229,17 @@ public class WaveformView implements IWaveformView  {
 | 
				
			|||||||
					}
 | 
										}
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
 | 
								@Override
 | 
				
			||||||
			public void dropAccept(DropTargetEvent event) {
 | 
								public void dropAccept(DropTargetEvent event) {
 | 
				
			||||||
				Point offset = canvas.toControl(event.x, event.y); 
 | 
									Point offset = canvas.toControl(event.x, event.y); 
 | 
				
			||||||
				if (event.detail != DND.DROP_MOVE || offset.y > trackVerticalOffset.lastKey() + waveformCanvas.getTrackHeight()) {
 | 
									if (event.detail != DND.DROP_MOVE || offset.y > trackVerticalOffset.lastKey() + styleProvider.getTrackHeight()) {
 | 
				
			||||||
					event.detail = DND.DROP_NONE;
 | 
										event.detail = DND.DROP_NONE;
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
 | 
								@Override
 | 
				
			||||||
			public void dragOver(DropTargetEvent event){
 | 
								public void dragOver(DropTargetEvent event){
 | 
				
			||||||
				ISelection sel = LocalSelectionTransfer.getTransfer().getSelection();
 | 
									ISelection sel = LocalSelectionTransfer.getTransfer().getSelection();
 | 
				
			||||||
				if(sel!=null && sel instanceof IStructuredSelection &&
 | 
									if(sel instanceof IStructuredSelection &&
 | 
				
			||||||
						((IStructuredSelection)sel).getFirstElement() instanceof CursorPainter){
 | 
											((IStructuredSelection)sel).getFirstElement() instanceof CursorPainter){
 | 
				
			||||||
					updateWaveform(canvas, event, (CursorPainter) ((IStructuredSelection)sel).getFirstElement());
 | 
										updateWaveform(canvas, event, (CursorPainter) ((IStructuredSelection)sel).getFirstElement());
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
@@ -1276,14 +1256,11 @@ public class WaveformView implements IWaveformView  {
 | 
				
			|||||||
					pcs.firePropertyChange(MARKER_PROPERTY, oldVal, time);
 | 
										pcs.firePropertyChange(MARKER_PROPERTY, oldVal, time);
 | 
				
			||||||
					pcs.firePropertyChange(MARKER_PROPERTY+painter.id, oldVal, time);
 | 
										pcs.firePropertyChange(MARKER_PROPERTY+painter.id, oldVal, time);
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
				canvas.getDisplay().asyncExec(new Runnable() {
 | 
									canvas.getDisplay().asyncExec(() -> {
 | 
				
			||||||
					@Override
 | 
					 | 
				
			||||||
					public void run() {
 | 
					 | 
				
			||||||
					if(!canvas.isDisposed()){
 | 
										if(!canvas.isDisposed()){
 | 
				
			||||||
						canvas.redraw();
 | 
											canvas.redraw();
 | 
				
			||||||
						updateValueList();
 | 
											updateValueList();
 | 
				
			||||||
					}
 | 
										}
 | 
				
			||||||
					}
 | 
					 | 
				
			||||||
				});
 | 
									});
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		});
 | 
							});
 | 
				
			||||||
@@ -1340,8 +1317,8 @@ public class WaveformView implements IWaveformView  {
 | 
				
			|||||||
	@Override
 | 
						@Override
 | 
				
			||||||
	public String getScaledTime(long time) {
 | 
						public String getScaledTime(long time) {
 | 
				
			||||||
		StringBuilder sb = new StringBuilder();
 | 
							StringBuilder sb = new StringBuilder();
 | 
				
			||||||
		Double dTime=new Double(time);
 | 
							double dTime=time;
 | 
				
			||||||
		Double scaledTime = dTime/waveformCanvas.getScaleFactorPow10();
 | 
							double scaledTime = dTime/waveformCanvas.getScaleFactorPow10();
 | 
				
			||||||
		return sb.append(df.format(scaledTime)).append(waveformCanvas.getUnitStr()).toString();
 | 
							return sb.append(df.format(scaledTime)).append(waveformCanvas.getUnitStr()).toString();
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -1350,21 +1327,16 @@ public class WaveformView implements IWaveformView  {
 | 
				
			|||||||
	 */
 | 
						 */
 | 
				
			||||||
	@Override
 | 
						@Override
 | 
				
			||||||
	public String[] getZoomLevels(){
 | 
						public String[] getZoomLevels(){
 | 
				
			||||||
		String[] res = new String[Constants.unitMultiplier.length*Constants.unitString.length];
 | 
							String[] res = new String[Constants.UNIT_MULTIPLIER.length*Constants.UNIT_STRING.length];
 | 
				
			||||||
		int index=0;
 | 
							int index=0;
 | 
				
			||||||
		for(String unit:Constants.unitString){
 | 
							for(String unit:Constants.UNIT_STRING){
 | 
				
			||||||
			for(int factor:Constants.unitMultiplier){
 | 
								for(int factor:Constants.UNIT_MULTIPLIER){
 | 
				
			||||||
				res[index++]= new Integer(factor).toString()+unit;
 | 
									res[index++]= Integer.toString(factor)+unit;
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		return res;
 | 
							return res;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	@Override
 | 
					 | 
				
			||||||
	public void setColors(HashMap<WaveformColors, RGB> colourMap) {
 | 
					 | 
				
			||||||
		waveformCanvas.initColors(colourMap);
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	@Override
 | 
						@Override
 | 
				
			||||||
	public long getBaselineTime() {
 | 
						public long getBaselineTime() {
 | 
				
			||||||
		return -waveformCanvas.getScaleFactorPow10()*waveformCanvas.getOrigin().x;
 | 
							return -waveformCanvas.getScaleFactorPow10()*waveformCanvas.getOrigin().x;
 | 
				
			||||||
@@ -1388,18 +1360,33 @@ public class WaveformView implements IWaveformView  {
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	public void asyncUpdate(Widget widget) {
 | 
						public void asyncUpdate(Widget widget) {
 | 
				
			||||||
		widget.getDisplay().asyncExec(new Runnable() {
 | 
							widget.getDisplay().asyncExec(() -> {
 | 
				
			||||||
			@Override
 | 
					 | 
				
			||||||
			public void run() {
 | 
					 | 
				
			||||||
			waveformCanvas.redraw();
 | 
								waveformCanvas.redraw();
 | 
				
			||||||
			updateValueList();
 | 
								updateValueList();
 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
		});
 | 
							});
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	/// probably not the way it should be done
 | 
						/// probably not the way it should be done
 | 
				
			||||||
	public void addDisposeListener( DisposeListener listener ) {
 | 
						@Override
 | 
				
			||||||
 | 
						public void addDisposeListener(DisposeListener listener ) {
 | 
				
			||||||
		waveformCanvas.addDisposeListener(listener);
 | 
							waveformCanvas.addDisposeListener(listener);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						@Override
 | 
				
			||||||
 | 
						public void setStyleProvider(IWaveformStyleProvider styleProvider) {
 | 
				
			||||||
 | 
							this.styleProvider=styleProvider;
 | 
				
			||||||
 | 
							waveformCanvas.setStyleProvider(styleProvider);
 | 
				
			||||||
 | 
							update();
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						@Override
 | 
				
			||||||
 | 
						public TrackEntry addWaveform(IWaveform waveform, int idx) {
 | 
				
			||||||
 | 
							TrackEntry e = new TrackEntry(waveform, styleProvider);
 | 
				
			||||||
 | 
							if(idx<0)
 | 
				
			||||||
 | 
								getStreamList().add(e);
 | 
				
			||||||
 | 
							else
 | 
				
			||||||
 | 
								getStreamList().add(idx, e);
 | 
				
			||||||
 | 
							return e;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
 | 
				
			|||||||
Bundle-ManifestVersion: 2
 | 
					Bundle-ManifestVersion: 2
 | 
				
			||||||
Bundle-Name: VCD signal database
 | 
					Bundle-Name: VCD signal database
 | 
				
			||||||
Bundle-SymbolicName: com.minres.scviewer.database.vcd
 | 
					Bundle-SymbolicName: com.minres.scviewer.database.vcd
 | 
				
			||||||
Bundle-Version: 2.0.2.qualifier
 | 
					Bundle-Version: 2.1.0.qualifier
 | 
				
			||||||
Bundle-Vendor: MINRES Technologies GmbH
 | 
					Bundle-Vendor: MINRES Technologies GmbH
 | 
				
			||||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
 | 
					Bundle-RequiredExecutionEnvironment: JavaSE-1.8
 | 
				
			||||||
Require-Bundle: com.minres.scviewer.database;bundle-version="1.0.0",
 | 
					Require-Bundle: com.minres.scviewer.database;bundle-version="1.0.0",
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,7 +1,7 @@
 | 
				
			|||||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
 | 
					<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
 | 
				
			||||||
  <modelVersion>4.0.0</modelVersion>
 | 
					  <modelVersion>4.0.0</modelVersion>
 | 
				
			||||||
  <artifactId>com.minres.scviewer.database.vcd</artifactId>
 | 
					  <artifactId>com.minres.scviewer.database.vcd</artifactId>
 | 
				
			||||||
  <version>2.0.2-SNAPSHOT</version>
 | 
					  <version>2.1.0-SNAPSHOT</version>
 | 
				
			||||||
  <parent>
 | 
					  <parent>
 | 
				
			||||||
  	<groupId>com.minres.scviewer</groupId>
 | 
					  	<groupId>com.minres.scviewer</groupId>
 | 
				
			||||||
  	<artifactId>com.minres.scviewer.parent</artifactId>
 | 
					  	<artifactId>com.minres.scviewer.parent</artifactId>
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -14,17 +14,18 @@ import java.io.File;
 | 
				
			|||||||
import java.io.FileInputStream;
 | 
					import java.io.FileInputStream;
 | 
				
			||||||
import java.io.IOException;
 | 
					import java.io.IOException;
 | 
				
			||||||
import java.io.InputStream;
 | 
					import java.io.InputStream;
 | 
				
			||||||
 | 
					import java.util.ArrayDeque;
 | 
				
			||||||
import java.util.Collection;
 | 
					import java.util.Collection;
 | 
				
			||||||
import java.util.Collections;
 | 
					import java.util.Collections;
 | 
				
			||||||
import java.util.List;
 | 
					import java.util.List;
 | 
				
			||||||
import java.util.NavigableMap;
 | 
					import java.util.NavigableMap;
 | 
				
			||||||
import java.util.Stack;
 | 
					 | 
				
			||||||
import java.util.TreeMap;
 | 
					import java.util.TreeMap;
 | 
				
			||||||
import java.util.Vector;
 | 
					import java.util.Vector;
 | 
				
			||||||
import java.util.zip.GZIPInputStream;
 | 
					import java.util.zip.GZIPInputStream;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import com.minres.scviewer.database.BitVector;
 | 
					import com.minres.scviewer.database.BitVector;
 | 
				
			||||||
import com.minres.scviewer.database.ISignal;
 | 
					import com.minres.scviewer.database.DoubleVal;
 | 
				
			||||||
 | 
					import com.minres.scviewer.database.IEvent;
 | 
				
			||||||
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;
 | 
				
			||||||
@@ -38,13 +39,13 @@ public class VCDDbLoader implements IWaveformDbLoader, IVCDDatabaseBuilder {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/** The Constant TIME_RES. */
 | 
						/** The Constant TIME_RES. */
 | 
				
			||||||
	private static final Long TIME_RES = 1000L; // ps;
 | 
						private static final Long TIME_RES = 1000L; // ps
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/** The db. */
 | 
						/** The db. */
 | 
				
			||||||
	private IWaveformDb db;
 | 
						private IWaveformDb db;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/** The module stack. */
 | 
						/** The module stack. */
 | 
				
			||||||
	private Stack<String> moduleStack;
 | 
						private ArrayDeque<String> moduleStack;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/** The signals. */
 | 
						/** The signals. */
 | 
				
			||||||
	private List<IWaveform> signals;
 | 
						private List<IWaveform> signals;
 | 
				
			||||||
@@ -52,23 +53,14 @@ public class VCDDbLoader implements IWaveformDbLoader, IVCDDatabaseBuilder {
 | 
				
			|||||||
	/** The max time. */
 | 
						/** The max time. */
 | 
				
			||||||
	private long maxTime;
 | 
						private long maxTime;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/**
 | 
					 | 
				
			||||||
	 * Instantiates a new VCD db.
 | 
					 | 
				
			||||||
	 */
 | 
					 | 
				
			||||||
	public VCDDbLoader() {
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	private static boolean isGzipped(File f) {
 | 
						private static boolean isGzipped(File f) {
 | 
				
			||||||
		InputStream is = null;
 | 
							try (InputStream is = new FileInputStream(f)) {
 | 
				
			||||||
		try {
 | 
					 | 
				
			||||||
			is = new FileInputStream(f);
 | 
					 | 
				
			||||||
			byte [] signature = new byte[2];
 | 
								byte [] signature = new byte[2];
 | 
				
			||||||
			int nread = is.read( signature ); //read the gzip signature
 | 
								int nread = is.read( signature ); //read the gzip signature
 | 
				
			||||||
			return nread == 2 && signature[ 0 ] == (byte) 0x1f && signature[ 1 ] == (byte) 0x8b;
 | 
								return nread == 2 && signature[ 0 ] == (byte) 0x1f && signature[ 1 ] == (byte) 0x8b;
 | 
				
			||||||
		} catch (IOException e) {
 | 
							}
 | 
				
			||||||
 | 
							catch (IOException e) {
 | 
				
			||||||
			return false;
 | 
								return false;
 | 
				
			||||||
		} finally {
 | 
					 | 
				
			||||||
			try { is.close();} catch (IOException e) { }
 | 
					 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -78,25 +70,31 @@ public class VCDDbLoader implements IWaveformDbLoader, IVCDDatabaseBuilder {
 | 
				
			|||||||
	 */
 | 
						 */
 | 
				
			||||||
	@SuppressWarnings("unchecked")
 | 
						@SuppressWarnings("unchecked")
 | 
				
			||||||
	@Override
 | 
						@Override
 | 
				
			||||||
	public boolean load(IWaveformDb db, File file) throws Exception {
 | 
						public boolean load(IWaveformDb db, File file) throws InputFormatException {
 | 
				
			||||||
		if(file.isDirectory() || !file.exists()) return false;
 | 
							if(file.isDirectory() || !file.exists()) return false;
 | 
				
			||||||
		this.db=db;
 | 
							this.db=db;
 | 
				
			||||||
		this.maxTime=0;
 | 
							this.maxTime=0;
 | 
				
			||||||
 | 
							boolean res = false;
 | 
				
			||||||
 | 
							try {
 | 
				
			||||||
			String name = file.getCanonicalFile().getName();
 | 
								String name = file.getCanonicalFile().getName();
 | 
				
			||||||
			if(!(name.endsWith(".vcd") ||
 | 
								if(!(name.endsWith(".vcd") ||
 | 
				
			||||||
					name.endsWith(".vcdz") ||
 | 
										name.endsWith(".vcdz") ||
 | 
				
			||||||
					name.endsWith(".vcdgz")  ||
 | 
										name.endsWith(".vcdgz")  ||
 | 
				
			||||||
					name.endsWith(".vcd.gz")) )
 | 
										name.endsWith(".vcd.gz")) )
 | 
				
			||||||
				return false;
 | 
									return false;
 | 
				
			||||||
		signals = new Vector<IWaveform>();
 | 
								signals = new Vector<>();
 | 
				
			||||||
		moduleStack= new Stack<String>();
 | 
								moduleStack= new ArrayDeque<>();
 | 
				
			||||||
			FileInputStream fis = new FileInputStream(file);
 | 
								FileInputStream fis = new FileInputStream(file);
 | 
				
			||||||
		boolean res = new VCDFileParser(false).load(isGzipped(file)?new GZIPInputStream(fis):fis, this);
 | 
								res = new VCDFileParser(false).load(isGzipped(file)?new GZIPInputStream(fis):fis, this);
 | 
				
			||||||
			moduleStack=null;
 | 
								moduleStack=null;
 | 
				
			||||||
 | 
							} catch(IOException e) { 
 | 
				
			||||||
 | 
								moduleStack=null;
 | 
				
			||||||
 | 
								throw new InputFormatException();
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
		if(!res) throw new InputFormatException();
 | 
							if(!res) throw new InputFormatException();
 | 
				
			||||||
		// calculate max time of database
 | 
							// calculate max time of database
 | 
				
			||||||
		for(IWaveform waveform:signals) {
 | 
							for(IWaveform waveform:signals) {
 | 
				
			||||||
			NavigableMap<Long, ?> events =((ISignal<?>)waveform).getEvents();
 | 
								NavigableMap<Long, IEvent[]> events =waveform.getEvents();
 | 
				
			||||||
			if(events.size()>0)
 | 
								if(events.size()>0)
 | 
				
			||||||
				maxTime= Math.max(maxTime, events.lastKey());
 | 
									maxTime= Math.max(maxTime, events.lastKey());
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
@@ -108,8 +106,8 @@ public class VCDDbLoader implements IWaveformDbLoader, IVCDDatabaseBuilder {
 | 
				
			|||||||
					Object val = events.lastEntry().getValue();
 | 
										Object val = events.lastEntry().getValue();
 | 
				
			||||||
					if(val instanceof BitVector) {
 | 
										if(val instanceof BitVector) {
 | 
				
			||||||
						((VCDSignal<BitVector>)s).addSignalChange(maxTime, (BitVector) val);
 | 
											((VCDSignal<BitVector>)s).addSignalChange(maxTime, (BitVector) val);
 | 
				
			||||||
					} else if(val instanceof Double)
 | 
										} else if(val instanceof DoubleVal)
 | 
				
			||||||
						((VCDSignal<Double>)s).addSignalChange(maxTime, (Double) val);
 | 
											((VCDSignal<DoubleVal>)s).addSignalChange(maxTime, (DoubleVal) val);
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
@@ -158,12 +156,11 @@ public class VCDDbLoader implements IWaveformDbLoader, IVCDDatabaseBuilder {
 | 
				
			|||||||
	@SuppressWarnings("unchecked")
 | 
						@SuppressWarnings("unchecked")
 | 
				
			||||||
	@Override
 | 
						@Override
 | 
				
			||||||
	public Integer newNet(String name, int i, int width) {
 | 
						public Integer newNet(String name, int i, int width) {
 | 
				
			||||||
		String netName = moduleStack.empty()? name: moduleStack.lastElement()+"."+name;
 | 
							String netName = moduleStack.isEmpty()? name: moduleStack.peek()+"."+name;
 | 
				
			||||||
		int id = signals.size();
 | 
							int id = signals.size();
 | 
				
			||||||
		assert(width>=0);
 | 
					 | 
				
			||||||
		if(width==0) {
 | 
							if(width==0) {
 | 
				
			||||||
			signals.add( i<0 ? new VCDSignal<Double>(db, id, netName, width) :
 | 
								signals.add( i<0 ? new VCDSignal<DoubleVal>(db, id, netName, width) :
 | 
				
			||||||
				new VCDSignal<Double>((VCDSignal<Double>)signals.get(i), id, netName));			
 | 
									new VCDSignal<DoubleVal>((VCDSignal<DoubleVal>)signals.get(i), id, netName));			
 | 
				
			||||||
		} else if(width>0){
 | 
							} else if(width>0){
 | 
				
			||||||
			signals.add( i<0 ? new VCDSignal<BitVector>(db, id, netName, width) :
 | 
								signals.add( i<0 ? new VCDSignal<BitVector>(db, id, netName, width) :
 | 
				
			||||||
				new VCDSignal<BitVector>((VCDSignal<BitVector>)signals.get(i), id, netName));
 | 
									new VCDSignal<BitVector>((VCDSignal<BitVector>)signals.get(i), id, netName));
 | 
				
			||||||
@@ -188,7 +185,7 @@ public class VCDDbLoader implements IWaveformDbLoader, IVCDDatabaseBuilder {
 | 
				
			|||||||
	public void appendTransition(int signalId, long currentTime, BitVector value) {
 | 
						public void appendTransition(int signalId, long currentTime, BitVector value) {
 | 
				
			||||||
		VCDSignal<BitVector> signal = (VCDSignal<BitVector>) signals.get(signalId);
 | 
							VCDSignal<BitVector> signal = (VCDSignal<BitVector>) signals.get(signalId);
 | 
				
			||||||
		Long time = currentTime* TIME_RES;
 | 
							Long time = currentTime* TIME_RES;
 | 
				
			||||||
		signal.getEvents().put(time, value);
 | 
							signal.addSignalChange(time, value);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/* (non-Javadoc)
 | 
						/* (non-Javadoc)
 | 
				
			||||||
@@ -197,11 +194,9 @@ public class VCDDbLoader implements IWaveformDbLoader, IVCDDatabaseBuilder {
 | 
				
			|||||||
	@SuppressWarnings("unchecked")
 | 
						@SuppressWarnings("unchecked")
 | 
				
			||||||
	@Override
 | 
						@Override
 | 
				
			||||||
	public void appendTransition(int signalId, long currentTime, double value) {
 | 
						public void appendTransition(int signalId, long currentTime, double value) {
 | 
				
			||||||
		VCDSignal<?> signal = (VCDSignal<?>) signals.get(signalId);
 | 
							VCDSignal<DoubleVal> signal = (VCDSignal<DoubleVal>) signals.get(signalId);
 | 
				
			||||||
		Long time = currentTime* TIME_RES;
 | 
							Long time = currentTime* TIME_RES;
 | 
				
			||||||
		if(signal.getWidth()==0){
 | 
							signal.addSignalChange(time, new DoubleVal(value));
 | 
				
			||||||
			((VCDSignal<Double>)signal).getEvents().put(time, value);
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/* (non-Javadoc)
 | 
						/* (non-Javadoc)
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -11,6 +11,7 @@
 | 
				
			|||||||
package com.minres.scviewer.database.vcd;
 | 
					package com.minres.scviewer.database.vcd;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import java.io.*;
 | 
					import java.io.*;
 | 
				
			||||||
 | 
					import java.text.ParseException;
 | 
				
			||||||
import java.util.*;
 | 
					import java.util.*;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import com.minres.scviewer.database.BitValue;
 | 
					import com.minres.scviewer.database.BitValue;
 | 
				
			||||||
@@ -19,7 +20,7 @@ import com.minres.scviewer.database.BitVector;
 | 
				
			|||||||
class VCDFileParser {
 | 
					class VCDFileParser {
 | 
				
			||||||
	private StreamTokenizer tokenizer;
 | 
						private StreamTokenizer tokenizer;
 | 
				
			||||||
	private IVCDDatabaseBuilder traceBuilder;
 | 
						private IVCDDatabaseBuilder traceBuilder;
 | 
				
			||||||
	private HashMap<String, Integer> nameToNetMap = new HashMap<String, Integer>();
 | 
						private HashMap<String, Integer> nameToNetMap = new HashMap<>();
 | 
				
			||||||
	private long picoSecondsPerIncrement;
 | 
						private long picoSecondsPerIncrement;
 | 
				
			||||||
	private boolean stripNetWidth;
 | 
						private boolean stripNetWidth;
 | 
				
			||||||
	private boolean replaceColon;
 | 
						private boolean replaceColon;
 | 
				
			||||||
@@ -50,19 +51,19 @@ class VCDFileParser {
 | 
				
			|||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	private void parseScope() throws Exception {
 | 
						private void parseScope() throws IOException, ParseException {
 | 
				
			||||||
		nextToken(); // Scope type (ignore)
 | 
							nextToken(); // Scope type (ignore)
 | 
				
			||||||
		nextToken();
 | 
							nextToken();
 | 
				
			||||||
		traceBuilder.enterModule(tokenizer.sval);
 | 
							traceBuilder.enterModule(tokenizer.sval);
 | 
				
			||||||
		match("$end");
 | 
							match("$end");
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	private void parseUpscope() throws Exception {
 | 
						private void parseUpscope() throws IOException, ParseException {
 | 
				
			||||||
		match("$end");
 | 
							match("$end");
 | 
				
			||||||
		traceBuilder.exitModule();
 | 
							traceBuilder.exitModule();
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	private void parseVar() throws Exception {
 | 
						private void parseVar() throws IOException {
 | 
				
			||||||
		nextToken(); // type
 | 
							nextToken(); // type
 | 
				
			||||||
		String type = tokenizer.sval;
 | 
							String type = tokenizer.sval;
 | 
				
			||||||
		nextToken(); // size
 | 
							nextToken(); // size
 | 
				
			||||||
@@ -72,11 +73,12 @@ class VCDFileParser {
 | 
				
			|||||||
		nextToken();
 | 
							nextToken();
 | 
				
			||||||
		String id = tokenizer.sval;
 | 
							String id = tokenizer.sval;
 | 
				
			||||||
		nextToken();
 | 
							nextToken();
 | 
				
			||||||
		String netName = tokenizer.sval;
 | 
							StringBuilder sb = new StringBuilder();
 | 
				
			||||||
 | 
							sb.append(tokenizer.sval);
 | 
				
			||||||
		while (nextToken() && !tokenizer.sval.equals("$end")) {
 | 
							while (nextToken() && !tokenizer.sval.equals("$end")) {
 | 
				
			||||||
			netName+=tokenizer.sval;
 | 
								sb.append(tokenizer.sval);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
							String netName = sb.toString();
 | 
				
			||||||
		Integer net = nameToNetMap.get(id);
 | 
							Integer net = nameToNetMap.get(id);
 | 
				
			||||||
		if (net == null) { // We've never seen this net before
 | 
							if (net == null) { // We've never seen this net before
 | 
				
			||||||
			int openBracket = netName.indexOf('[');
 | 
								int openBracket = netName.indexOf('[');
 | 
				
			||||||
@@ -86,9 +88,9 @@ class VCDFileParser {
 | 
				
			|||||||
			}
 | 
								}
 | 
				
			||||||
			if(replaceColon) {
 | 
								if(replaceColon) {
 | 
				
			||||||
				if (openBracket != -1) {
 | 
									if (openBracket != -1) {
 | 
				
			||||||
					netName = netName.substring(0, openBracket).replaceAll(":", ".")+netName.substring(openBracket);
 | 
										netName = netName.substring(0, openBracket).replace(":", ".")+netName.substring(openBracket);
 | 
				
			||||||
				} else
 | 
									} else
 | 
				
			||||||
					netName=netName.replaceAll(":", ".");
 | 
										netName=netName.replace(":", ".");
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			nameToNetMap.put(id, traceBuilder.newNet(netName, -1, width));
 | 
								nameToNetMap.put(id, traceBuilder.newNet(netName, -1, width));
 | 
				
			||||||
		} else {
 | 
							} else {
 | 
				
			||||||
@@ -97,25 +99,28 @@ class VCDFileParser {
 | 
				
			|||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	private void parseComment() throws Exception {
 | 
						private void parseComment() throws IOException {
 | 
				
			||||||
		nextToken();
 | 
							nextToken();
 | 
				
			||||||
		String s = tokenizer.sval;
 | 
							StringBuilder s = new StringBuilder();
 | 
				
			||||||
 | 
							s.append(tokenizer.sval);
 | 
				
			||||||
		nextToken();
 | 
							nextToken();
 | 
				
			||||||
		while(!tokenizer.sval.equals("$end")){
 | 
							while(!tokenizer.sval.equals("$end")){
 | 
				
			||||||
			s+=" "+tokenizer.sval;
 | 
								s.append(" ").append(tokenizer.sval);
 | 
				
			||||||
			nextToken();
 | 
								nextToken();
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		replaceColon|=s.contains("ARTERIS Architecture");
 | 
							replaceColon|=s.toString().contains("ARTERIS Architecture");
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	private void parseTimescale() throws Exception {
 | 
						private void parseTimescale() throws IOException {
 | 
				
			||||||
		nextToken();
 | 
							nextToken();
 | 
				
			||||||
		String s = tokenizer.sval;
 | 
							StringBuilder sb = new StringBuilder();
 | 
				
			||||||
 | 
							sb.append(tokenizer.sval);
 | 
				
			||||||
		nextToken();
 | 
							nextToken();
 | 
				
			||||||
		while(!tokenizer.sval.equals("$end")){
 | 
							while(!tokenizer.sval.equals("$end")){
 | 
				
			||||||
			s+=" "+tokenizer.sval;
 | 
								sb.append(" ").append(tokenizer.sval);
 | 
				
			||||||
			nextToken();
 | 
								nextToken();
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
							String s = sb.toString();
 | 
				
			||||||
		switch (s.charAt(s.length() - 2)){
 | 
							switch (s.charAt(s.length() - 2)){
 | 
				
			||||||
		case 'p': // Nano-seconds
 | 
							case 'p': // Nano-seconds
 | 
				
			||||||
			picoSecondsPerIncrement = 1;
 | 
								picoSecondsPerIncrement = 1;
 | 
				
			||||||
@@ -141,7 +146,7 @@ class VCDFileParser {
 | 
				
			|||||||
		picoSecondsPerIncrement *= Long.parseLong(s);
 | 
							picoSecondsPerIncrement *= Long.parseLong(s);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	private boolean parseDefinition() throws Exception {
 | 
						private boolean parseDefinition() throws IOException, ParseException {
 | 
				
			||||||
		nextToken();
 | 
							nextToken();
 | 
				
			||||||
		if (tokenizer.sval.equals("$scope"))
 | 
							if (tokenizer.sval.equals("$scope"))
 | 
				
			||||||
			parseScope();
 | 
								parseScope();
 | 
				
			||||||
@@ -166,7 +171,7 @@ class VCDFileParser {
 | 
				
			|||||||
		return true;
 | 
							return true;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	private boolean parseTransition() throws Exception {
 | 
						private boolean parseTransition() throws IOException {
 | 
				
			||||||
		if (!nextToken()) return false;
 | 
							if (!nextToken()) return false;
 | 
				
			||||||
		if (tokenizer.sval.charAt(0) == '#') {	// If the line begins with a #, this is a timestamp.
 | 
							if (tokenizer.sval.charAt(0) == '#') {	// If the line begins with a #, this is a timestamp.
 | 
				
			||||||
			currentTime = Long.parseLong(tokenizer.sval.substring(1)) * picoSecondsPerIncrement;
 | 
								currentTime = Long.parseLong(tokenizer.sval.substring(1)) * picoSecondsPerIncrement;
 | 
				
			||||||
@@ -179,16 +184,10 @@ class VCDFileParser {
 | 
				
			|||||||
			}
 | 
								}
 | 
				
			||||||
			if (tokenizer.sval.equals("$dumpvars") || tokenizer.sval.equals("$end"))
 | 
								if (tokenizer.sval.equals("$dumpvars") || tokenizer.sval.equals("$end"))
 | 
				
			||||||
				return true;
 | 
									return true;
 | 
				
			||||||
			String value, id;
 | 
								String value;
 | 
				
			||||||
			if (tokenizer.sval.charAt(0) == 'b') {
 | 
								String id;
 | 
				
			||||||
				// Multiple value net. Value appears first, followed by space,
 | 
								if (tokenizer.sval.charAt(0) == 'b' || tokenizer.sval.charAt(0) == 'r') {
 | 
				
			||||||
				// then identifier
 | 
									// Multiple value net. Value appears first, followed by space, then identifier
 | 
				
			||||||
				value = tokenizer.sval.substring(1);
 | 
					 | 
				
			||||||
				nextToken();
 | 
					 | 
				
			||||||
				id = tokenizer.sval;
 | 
					 | 
				
			||||||
			}else if (tokenizer.sval.charAt(0) == 'r') {
 | 
					 | 
				
			||||||
					// Multiple value net. Value appears first, followed by space,
 | 
					 | 
				
			||||||
					// then identifier
 | 
					 | 
				
			||||||
				value = tokenizer.sval.substring(1);
 | 
									value = tokenizer.sval.substring(1);
 | 
				
			||||||
				nextToken();
 | 
									nextToken();
 | 
				
			||||||
				id = tokenizer.sval;
 | 
									id = tokenizer.sval;
 | 
				
			||||||
@@ -199,10 +198,8 @@ class VCDFileParser {
 | 
				
			|||||||
			}
 | 
								}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			Integer net = nameToNetMap.get(id);
 | 
								Integer net = nameToNetMap.get(id);
 | 
				
			||||||
			if (net == null) {
 | 
								if (net == null) 
 | 
				
			||||||
				System.out.println("unknown net " + id + " value " + value);
 | 
					 | 
				
			||||||
				return true;
 | 
									return true;
 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
			int netWidth = traceBuilder.getNetWidth(net);
 | 
								int netWidth = traceBuilder.getNetWidth(net);
 | 
				
			||||||
			if(netWidth==0) {
 | 
								if(netWidth==0) {
 | 
				
			||||||
@@ -253,14 +250,14 @@ class VCDFileParser {
 | 
				
			|||||||
		return true;
 | 
							return true;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	private void match(String value) throws Exception {
 | 
						private void match(String value) throws ParseException, IOException {
 | 
				
			||||||
		nextToken();
 | 
							nextToken();
 | 
				
			||||||
		if (!tokenizer.sval.equals(value)) 
 | 
							if (!tokenizer.sval.equals(value)) 
 | 
				
			||||||
			throw new Exception("Line "+tokenizer.lineno()+": parse error, expected "+value+" got "+tokenizer.sval);
 | 
								throw new ParseException("Line "+tokenizer.lineno()+": parse error, expected "+value+" got "+tokenizer.sval, tokenizer.lineno());
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	private boolean nextToken() throws IOException {
 | 
						private boolean nextToken() throws IOException {
 | 
				
			||||||
		return tokenizer.nextToken() != StreamTokenizer.TT_EOF;
 | 
							return tokenizer.nextToken() != StreamTokenizer.TT_EOF;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
};
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -15,26 +15,22 @@ import java.util.NavigableMap;
 | 
				
			|||||||
import java.util.TreeMap;
 | 
					import java.util.TreeMap;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import com.minres.scviewer.database.HierNode;
 | 
					import com.minres.scviewer.database.HierNode;
 | 
				
			||||||
import com.minres.scviewer.database.ISignal;
 | 
					import com.minres.scviewer.database.IEvent;
 | 
				
			||||||
import com.minres.scviewer.database.IWaveform;
 | 
					import com.minres.scviewer.database.IWaveform;
 | 
				
			||||||
import com.minres.scviewer.database.IWaveformDb;
 | 
					import com.minres.scviewer.database.IWaveformDb;
 | 
				
			||||||
import com.minres.scviewer.database.IWaveformEvent;
 | 
					import com.minres.scviewer.database.WaveformType;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public class VCDSignal<T> extends HierNode implements ISignal<T> {
 | 
					public class VCDSignal<T extends IEvent> extends HierNode implements IWaveform {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	private long id;
 | 
						private long id;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	private String fullName;
 | 
						private String fullName;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	private final String kind = "signal";
 | 
					 | 
				
			||||||
	
 | 
					 | 
				
			||||||
	private final int width;
 | 
						private final int width;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	private final T dummy = null;
 | 
					 | 
				
			||||||
	
 | 
					 | 
				
			||||||
	private IWaveformDb db;
 | 
						private IWaveformDb db;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	private TreeMap<Long, T> values;
 | 
						private NavigableMap<Long, IEvent[]> values;
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	public VCDSignal(IWaveformDb db, String name) {
 | 
						public VCDSignal(IWaveformDb db, String name) {
 | 
				
			||||||
		this(db, 0, name, 1);
 | 
							this(db, 0, name, 1);
 | 
				
			||||||
@@ -50,18 +46,16 @@ public class VCDSignal<T> extends HierNode implements ISignal<T> {
 | 
				
			|||||||
		fullName=name;
 | 
							fullName=name;
 | 
				
			||||||
		this.id=id;
 | 
							this.id=id;
 | 
				
			||||||
		this.width=width;
 | 
							this.width=width;
 | 
				
			||||||
		this.values=new TreeMap<Long, T>();
 | 
							this.values=new TreeMap<>();
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	@SuppressWarnings("unchecked")
 | 
						public VCDSignal(VCDSignal<T> o, int id, String name) {
 | 
				
			||||||
	public VCDSignal(ISignal<T> other, int id, String name) {
 | 
					 | 
				
			||||||
		super(name);
 | 
							super(name);
 | 
				
			||||||
		fullName=name;
 | 
							fullName=name;
 | 
				
			||||||
		this.id=id;
 | 
							this.id=id;
 | 
				
			||||||
		assert(other instanceof VCDSignal<?>);
 | 
							this.width=o.width;
 | 
				
			||||||
		this.width=((VCDSignal<? extends IWaveformEvent>)other).width;
 | 
							this.values=o.values;
 | 
				
			||||||
		this.values=((VCDSignal<T>)other).values;
 | 
							this.db=o.getDb();
 | 
				
			||||||
		this.db=other.getDb();
 | 
					 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	@Override
 | 
						@Override
 | 
				
			||||||
@@ -78,53 +72,55 @@ public class VCDSignal<T> extends HierNode implements ISignal<T> {
 | 
				
			|||||||
		return id;
 | 
							return id;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	@Override
 | 
					 | 
				
			||||||
	public String getKind() {
 | 
					 | 
				
			||||||
		return kind;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	public int getWidth() {
 | 
					 | 
				
			||||||
		return width;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	@Override
 | 
						@Override
 | 
				
			||||||
	public IWaveformDb getDb() {
 | 
						public IWaveformDb getDb() {
 | 
				
			||||||
		return db;
 | 
							return db;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	public void addSignalChange(Long time, T value){
 | 
						public void addSignalChange(Long time, T value){
 | 
				
			||||||
		values.put(time, value);
 | 
							if(values.containsKey(time)) {
 | 
				
			||||||
 | 
								IEvent[] oldV = values.get(time);
 | 
				
			||||||
 | 
								IEvent[] newV = new IEvent[oldV.length+1];
 | 
				
			||||||
 | 
								System.arraycopy(oldV, 0, newV, 0, oldV.length);
 | 
				
			||||||
 | 
								newV[oldV.length]=value;
 | 
				
			||||||
 | 
								values.put(time, newV);
 | 
				
			||||||
 | 
							} else {
 | 
				
			||||||
 | 
								values.put(time, new IEvent[] {value});
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	@Override
 | 
						@Override
 | 
				
			||||||
	public NavigableMap<Long, T> getEvents() {
 | 
						public NavigableMap<Long, IEvent[]> getEvents() {
 | 
				
			||||||
		return values;
 | 
							return values;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	@Override
 | 
						@Override
 | 
				
			||||||
	public T getWaveformValueAtTime(Long time) {
 | 
						public IEvent[] getEventsAtTime(Long time) {
 | 
				
			||||||
		return values.get(time);
 | 
							return values.get(time);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Override
 | 
					    @Override
 | 
				
			||||||
    public T getWaveformValueBeforeTime(Long time) {
 | 
					    public IEvent[] getEventsBeforeTime(Long time) {
 | 
				
			||||||
    	Entry<Long, T> e = values.floorEntry(time);
 | 
					    	Entry<Long, IEvent[]> e = values.floorEntry(time);
 | 
				
			||||||
    	if(e==null)
 | 
					    	if(e==null)
 | 
				
			||||||
    		return null;
 | 
					    		return new IEvent[] {};
 | 
				
			||||||
    	else
 | 
					    	else
 | 
				
			||||||
    		return values.floorEntry(time).getValue();
 | 
					    		return values.floorEntry(time).getValue();
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	@Override
 | 
						@Override
 | 
				
			||||||
	public Boolean equals(IWaveform other) {
 | 
						public boolean isSame(IWaveform other) {
 | 
				
			||||||
		return( other instanceof VCDSignal<?> && this.getId().equals(other.getId()));
 | 
							return( other instanceof VCDSignal<?> && this.getId().equals(other.getId()));
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	@Override
 | 
						@Override
 | 
				
			||||||
	public Class<?> getType() {
 | 
						public WaveformType getType() {
 | 
				
			||||||
		return dummy.getClass();
 | 
							return WaveformType.SIGNAL;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						@Override
 | 
				
			||||||
 | 
						public int getWidth() {
 | 
				
			||||||
 | 
							return width;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -2,11 +2,11 @@ Manifest-Version: 1.0
 | 
				
			|||||||
Bundle-ManifestVersion: 2
 | 
					Bundle-ManifestVersion: 2
 | 
				
			||||||
Bundle-Name: Waveform database
 | 
					Bundle-Name: Waveform database
 | 
				
			||||||
Bundle-SymbolicName: com.minres.scviewer.database
 | 
					Bundle-SymbolicName: com.minres.scviewer.database
 | 
				
			||||||
Bundle-Version: 1.0.0.qualifier
 | 
					Bundle-Version: 2.0.0.qualifier
 | 
				
			||||||
Bundle-Vendor: MINRES Technologies GmbH
 | 
					Bundle-Vendor: MINRES Technologies GmbH
 | 
				
			||||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
 | 
					Bundle-RequiredExecutionEnvironment: JavaSE-1.8
 | 
				
			||||||
Export-Package: com.minres.scviewer.database,
 | 
					Export-Package: com.minres.scviewer.database,
 | 
				
			||||||
 com.minres.scviewer.database.internal;x-internal:=true
 | 
					 com.minres.scviewer.database.tx
 | 
				
			||||||
Bundle-ActivationPolicy: lazy
 | 
					Bundle-ActivationPolicy: lazy
 | 
				
			||||||
Service-Component: OSGI-INF/component.xml,OSGI-INF/component2.xml
 | 
					Service-Component: OSGI-INF/component.xml,OSGI-INF/component2.xml
 | 
				
			||||||
Automatic-Module-Name: com.minres.scviewer.database
 | 
					Automatic-Module-Name: com.minres.scviewer.database
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -8,5 +8,5 @@
 | 
				
			|||||||
	<relativePath>../..</relativePath>
 | 
						<relativePath>../..</relativePath>
 | 
				
			||||||
  </parent>
 | 
					  </parent>
 | 
				
			||||||
  <packaging>eclipse-plugin</packaging>
 | 
					  <packaging>eclipse-plugin</packaging>
 | 
				
			||||||
  <version>1.0.0-SNAPSHOT</version>
 | 
					  <version>2.0.0-SNAPSHOT</version>
 | 
				
			||||||
</project>
 | 
					</project>
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -10,7 +10,7 @@
 | 
				
			|||||||
 *******************************************************************************/
 | 
					 *******************************************************************************/
 | 
				
			||||||
package com.minres.scviewer.database;
 | 
					package com.minres.scviewer.database;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public class BitVector {
 | 
					public class BitVector implements IEvent {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	private final int width;
 | 
						private final int width;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -76,7 +76,7 @@ public class BitVector {
 | 
				
			|||||||
		for(int i=resWidth-1; i>=0; i--){
 | 
							for(int i=resWidth-1; i>=0; i--){
 | 
				
			||||||
			int digit=0;
 | 
								int digit=0;
 | 
				
			||||||
			for(int j=3; j>=0; j--){
 | 
								for(int j=3; j>=0; j--){
 | 
				
			||||||
				if((4*i+j)>=value.length) continue;
 | 
									if((4*i+j)<value.length) {
 | 
				
			||||||
					BitValue val = BitValue.fromChar(value[4*i+j]);
 | 
										BitValue val = BitValue.fromChar(value[4*i+j]);
 | 
				
			||||||
					switch(val) {
 | 
										switch(val) {
 | 
				
			||||||
					case X:
 | 
										case X:
 | 
				
			||||||
@@ -90,6 +90,7 @@ public class BitVector {
 | 
				
			|||||||
						break;
 | 
											break;
 | 
				
			||||||
					}
 | 
										}
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
			res[i]=Character.forDigit(digit, 16); //((digit < 10) ? '0' + digit : 'a' + digit -10)
 | 
								res[i]=Character.forDigit(digit, 16); //((digit < 10) ? '0' + digit : 'a' + digit -10)
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		return new String(res);		
 | 
							return new String(res);		
 | 
				
			||||||
@@ -152,19 +153,24 @@ public class BitVector {
 | 
				
			|||||||
				currentWord >>= 2;
 | 
									currentWord >>= 2;
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
        for(int i=width; i<64; i++) {
 | 
							if(lastVal!=0)
 | 
				
			||||||
        	if(bitOffset==0) currentWord = packedValues[wordOffset];
 | 
								res |= -1l<<width;
 | 
				
			||||||
        	res|=lastVal<<i;
 | 
							return res;
 | 
				
			||||||
        	bitOffset += 2;
 | 
					 | 
				
			||||||
            if (bitOffset == 32) {
 | 
					 | 
				
			||||||
                wordOffset++;
 | 
					 | 
				
			||||||
                bitOffset = 0;
 | 
					 | 
				
			||||||
            } else {
 | 
					 | 
				
			||||||
                currentWord >>= 2;
 | 
					 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						@Override
 | 
				
			||||||
 | 
						public EventKind getKind() {
 | 
				
			||||||
 | 
							return EventKind.SINGLE;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
		return res;
 | 
					
 | 
				
			||||||
 | 
						@Override
 | 
				
			||||||
 | 
						public WaveformType getType() {
 | 
				
			||||||
 | 
							return WaveformType.SIGNAL;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						@Override
 | 
				
			||||||
 | 
						public IEvent duplicate() throws CloneNotSupportedException {
 | 
				
			||||||
 | 
							return (IEvent)this.clone();
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -25,4 +25,4 @@ public enum DataType {
 | 
				
			|||||||
	POINTER, // T*
 | 
						POINTER, // T*
 | 
				
			||||||
	ARRAY, // T[N]
 | 
						ARRAY, // T[N]
 | 
				
			||||||
	STRING // string, std::string
 | 
						STRING // string, std::string
 | 
				
			||||||
};
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -0,0 +1,26 @@
 | 
				
			|||||||
 | 
					package com.minres.scviewer.database;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public class DoubleVal implements IEvent {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						public final double value;
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						public DoubleVal(double value) {
 | 
				
			||||||
 | 
							this.value=value;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						@Override
 | 
				
			||||||
 | 
						public EventKind getKind() {
 | 
				
			||||||
 | 
							return EventKind.SINGLE;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						@Override
 | 
				
			||||||
 | 
						public WaveformType getType() {
 | 
				
			||||||
 | 
							return WaveformType.SIGNAL;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						@Override
 | 
				
			||||||
 | 
						public IEvent duplicate() throws CloneNotSupportedException {
 | 
				
			||||||
 | 
							return (IEvent) clone();
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@@ -0,0 +1,5 @@
 | 
				
			|||||||
 | 
					package com.minres.scviewer.database;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public enum EventKind {
 | 
				
			||||||
 | 
						SINGLE, BEGIN, END
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@@ -19,25 +19,26 @@ public class HierNode implements IHierNode {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	protected String name;
 | 
						protected String name;
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	protected String parentName;
 | 
						protected IHierNode parent = null;
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	protected ArrayList<IHierNode> childs;
 | 
						protected ArrayList<IHierNode> childs;
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	protected PropertyChangeSupport pcs;
 | 
						protected PropertyChangeSupport pcs;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	public HierNode() {
 | 
						public HierNode() {
 | 
				
			||||||
		childs = new ArrayList<IHierNode>();
 | 
							childs = new ArrayList<>();
 | 
				
			||||||
		pcs=new PropertyChangeSupport(this);
 | 
							pcs=new PropertyChangeSupport(this);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	public HierNode(String name) {
 | 
						public HierNode(String name) {
 | 
				
			||||||
		this(name, "");
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	public HierNode(String name, String parentName) {
 | 
					 | 
				
			||||||
		this();
 | 
							this();
 | 
				
			||||||
		this.name=name;
 | 
							this.name=name;
 | 
				
			||||||
		this.parentName=parentName;
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						public HierNode(String name, IHierNode parent) {
 | 
				
			||||||
 | 
							this();
 | 
				
			||||||
 | 
							this.name=name;
 | 
				
			||||||
 | 
							this.parent=parent;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	@Override
 | 
						@Override
 | 
				
			||||||
@@ -53,8 +54,8 @@ public class HierNode implements IHierNode {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	@Override
 | 
						@Override
 | 
				
			||||||
	public String getFullName() {
 | 
						public String getFullName() {
 | 
				
			||||||
		if(parentName!=null && parentName.length()>0)
 | 
							if(parent!=null)
 | 
				
			||||||
			return parentName+"."+name;
 | 
								return parent.getFullName()+"."+name;
 | 
				
			||||||
		else
 | 
							else
 | 
				
			||||||
			return name;
 | 
								return name;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
@@ -70,8 +71,8 @@ public class HierNode implements IHierNode {
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	@Override
 | 
						@Override
 | 
				
			||||||
	public void setParentName(String name) {
 | 
						public void setParent(IHierNode parent) {
 | 
				
			||||||
		this.parentName=name;
 | 
							this.parent=parent;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	@Override
 | 
						@Override
 | 
				
			||||||
@@ -81,7 +82,12 @@ public class HierNode implements IHierNode {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	@Override
 | 
						@Override
 | 
				
			||||||
	public int compareTo(IHierNode o) {
 | 
						public int compareTo(IHierNode o) {
 | 
				
			||||||
		return name.compareTo(o.getName());
 | 
							return getFullName().compareTo(o.getFullName());
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						@Override
 | 
				
			||||||
 | 
						public IDerivedWaveform deriveWaveform() {
 | 
				
			||||||
 | 
							return null;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,5 +1,5 @@
 | 
				
			|||||||
/*******************************************************************************
 | 
					/*******************************************************************************
 | 
				
			||||||
 * Copyright (c) 2015 MINRES Technologies GmbH and others.
 | 
					 * Copyright (c) 2015, 2020 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.database;
 | 
					package com.minres.scviewer.database;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * The Interface IDerivedWaveform.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					public interface IDerivedWaveform extends IWaveform {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public interface IWaveformEvent extends Comparable<IWaveformEvent>{
 | 
						void addSourceWaveform(IWaveform waveform);
 | 
				
			||||||
 | 
					 | 
				
			||||||
	public Long getTime();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	public IWaveformEvent duplicate() throws CloneNotSupportedException;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@@ -0,0 +1,11 @@
 | 
				
			|||||||
 | 
					package com.minres.scviewer.database;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public interface IEvent {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						public IEvent duplicate() throws CloneNotSupportedException;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						public EventKind getKind();
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						public WaveformType getType();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@@ -1,5 +1,5 @@
 | 
				
			|||||||
/*******************************************************************************
 | 
					/*******************************************************************************
 | 
				
			||||||
 * Copyright (c) 2015 MINRES Technologies GmbH and others.
 | 
					 * Copyright (c) 2015, 2020 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
 | 
				
			||||||
@@ -13,6 +13,9 @@ package com.minres.scviewer.database;
 | 
				
			|||||||
import java.beans.PropertyChangeListener;
 | 
					import java.beans.PropertyChangeListener;
 | 
				
			||||||
import java.util.List;
 | 
					import java.util.List;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * The Interface IHierNode.
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
public interface IHierNode extends Comparable<IHierNode>{
 | 
					public interface IHierNode extends Comparable<IHierNode>{
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	/**
 | 
						/**
 | 
				
			||||||
@@ -33,14 +36,46 @@ public interface IHierNode extends Comparable<IHierNode>{
 | 
				
			|||||||
	 */
 | 
						 */
 | 
				
			||||||
	public void removePropertyChangeListener(PropertyChangeListener l) ;
 | 
						public void removePropertyChangeListener(PropertyChangeListener l) ;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						/**
 | 
				
			||||||
 | 
						 * Gets the full name.
 | 
				
			||||||
 | 
						 *
 | 
				
			||||||
 | 
						 * @return the full name
 | 
				
			||||||
 | 
						 */
 | 
				
			||||||
	public String getFullName();
 | 
						public String getFullName();
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
 | 
						/**
 | 
				
			||||||
 | 
						 * Gets the name.
 | 
				
			||||||
 | 
						 *
 | 
				
			||||||
 | 
						 * @return the name
 | 
				
			||||||
 | 
						 */
 | 
				
			||||||
	public String getName();
 | 
						public String getName();
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
 | 
						/**
 | 
				
			||||||
 | 
						 * Sets the name.
 | 
				
			||||||
 | 
						 *
 | 
				
			||||||
 | 
						 * @param name the new name
 | 
				
			||||||
 | 
						 */
 | 
				
			||||||
	public void setName(String name);
 | 
						public void setName(String name);
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	public void setParentName(String name);
 | 
						/**
 | 
				
			||||||
 | 
						 * Sets the parent.
 | 
				
			||||||
 | 
						 *
 | 
				
			||||||
 | 
						 * @param parent the new parent
 | 
				
			||||||
 | 
						 */
 | 
				
			||||||
 | 
						public void setParent(IHierNode parent);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						/**
 | 
				
			||||||
 | 
						 * Gets the child nodes.
 | 
				
			||||||
 | 
						 *
 | 
				
			||||||
 | 
						 * @return the child nodes
 | 
				
			||||||
 | 
						 */
 | 
				
			||||||
	public List<IHierNode> getChildNodes();
 | 
						public List<IHierNode> getChildNodes();
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
 | 
						/**
 | 
				
			||||||
 | 
						 * Derive waveform.
 | 
				
			||||||
 | 
						 *
 | 
				
			||||||
 | 
						 * @return the i derived waveform or null if none could be created
 | 
				
			||||||
 | 
						 */
 | 
				
			||||||
 | 
						public IDerivedWaveform deriveWaveform();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,26 +0,0 @@
 | 
				
			|||||||
/*******************************************************************************
 | 
					 | 
				
			||||||
 * Copyright (c) 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;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
import java.util.NavigableMap;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
public interface ISignal<T> extends IWaveform{
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	public NavigableMap<Long, T> getEvents();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	public T getWaveformValueAtTime(Long time);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	public T getWaveformValueBeforeTime(Long time);
 | 
					 | 
				
			||||||
	
 | 
					 | 
				
			||||||
	public Class<?> getType();
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
@@ -1,27 +0,0 @@
 | 
				
			|||||||
/*******************************************************************************
 | 
					 | 
				
			||||||
 * Copyright (c) 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;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
import java.util.Collection;
 | 
					 | 
				
			||||||
import java.util.List;
 | 
					 | 
				
			||||||
import java.util.NavigableMap;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
public interface  ITxStream<T extends ITxEvent> extends IWaveform {
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	public List<ITxGenerator> getGenerators();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	public int getMaxConcurrency();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	public NavigableMap<Long, List<ITxEvent>> getEvents();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	public Collection<T> getWaveformEventsAtTime(Long time);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
@@ -10,15 +10,24 @@
 | 
				
			|||||||
 *******************************************************************************/
 | 
					 *******************************************************************************/
 | 
				
			||||||
package com.minres.scviewer.database;
 | 
					package com.minres.scviewer.database;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import java.util.NavigableMap;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public interface IWaveform extends IHierNode {
 | 
					public interface IWaveform extends IHierNode {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	public Long getId();
 | 
						public Long getId();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	public String getKind();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	public IWaveformDb getDb();
 | 
						public IWaveformDb getDb();
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	public Boolean equals(IWaveform other);
 | 
						public boolean isSame(IWaveform other);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						public NavigableMap<Long, IEvent[]> getEvents();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						public IEvent[] getEventsAtTime(Long time);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						public IEvent[] getEventsBeforeTime(Long time);
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						public WaveformType getType();
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						public int getWidth();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -15,7 +15,7 @@ import java.util.Collection;
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
public interface IWaveformDbLoader {
 | 
					public interface IWaveformDbLoader {
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	public boolean load(IWaveformDb db, File inp) throws Exception;
 | 
						public boolean load(IWaveformDb db, File inp) throws InputFormatException;
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	public Long getMaxTime();
 | 
						public Long getMaxTime();
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -50,4 +50,9 @@ public class RelationType {
 | 
				
			|||||||
	public int hashCode() {
 | 
						public int hashCode() {
 | 
				
			||||||
		return name.hashCode();
 | 
							return name.hashCode();
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						@Override
 | 
				
			||||||
 | 
						public boolean equals(Object obj) {
 | 
				
			||||||
 | 
							return name.equals(obj);
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -0,0 +1,5 @@
 | 
				
			|||||||
 | 
					package com.minres.scviewer.database;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public enum WaveformType {
 | 
				
			||||||
 | 
						SIGNAL, TRANSACTION, FILTER
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@@ -12,10 +12,8 @@ package com.minres.scviewer.database.internal;
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
import java.io.File;
 | 
					import java.io.File;
 | 
				
			||||||
import java.util.ArrayList;
 | 
					import java.util.ArrayList;
 | 
				
			||||||
import java.util.Collection;
 | 
					 | 
				
			||||||
import java.util.Collections;
 | 
					import java.util.Collections;
 | 
				
			||||||
import java.util.HashMap;
 | 
					import java.util.HashMap;
 | 
				
			||||||
import java.util.Iterator;
 | 
					 | 
				
			||||||
import java.util.LinkedList;
 | 
					import java.util.LinkedList;
 | 
				
			||||||
import java.util.List;
 | 
					import java.util.List;
 | 
				
			||||||
import java.util.Map;
 | 
					import java.util.Map;
 | 
				
			||||||
@@ -25,17 +23,14 @@ import com.minres.scviewer.database.IHierNode;
 | 
				
			|||||||
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.InputFormatException;
 | 
					 | 
				
			||||||
import com.minres.scviewer.database.RelationType;
 | 
					import com.minres.scviewer.database.RelationType;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public class WaveformDb extends HierNode implements IWaveformDb {
 | 
					public class WaveformDb extends HierNode implements IWaveformDb {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	private static List<IWaveformDbLoader> loaders=new LinkedList<IWaveformDbLoader>();
 | 
						private static List<IWaveformDbLoader> loaders=new LinkedList<>();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	private boolean loaded;
 | 
						private boolean loaded;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	private List<IHierNode> childNodes;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	private List<RelationType> relationTypes;
 | 
						private List<RelationType> relationTypes;
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	private Map<String, IWaveform> waveforms;
 | 
						private Map<String, IWaveform> waveforms;
 | 
				
			||||||
@@ -58,7 +53,7 @@ public class WaveformDb extends HierNode implements IWaveformDb {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	public WaveformDb() {
 | 
						public WaveformDb() {
 | 
				
			||||||
		super();
 | 
							super();
 | 
				
			||||||
		waveforms = new HashMap<String, IWaveform>();
 | 
							waveforms = new HashMap<>();
 | 
				
			||||||
		relationTypes=new ArrayList<>();
 | 
							relationTypes=new ArrayList<>();
 | 
				
			||||||
		maxTime=0L;
 | 
							maxTime=0L;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
@@ -75,7 +70,7 @@ public class WaveformDb extends HierNode implements IWaveformDb {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	@Override
 | 
						@Override
 | 
				
			||||||
	public List<IWaveform> getAllWaves() {
 | 
						public List<IWaveform> getAllWaves() {
 | 
				
			||||||
		return new ArrayList<IWaveform>(waveforms.values());
 | 
							return new ArrayList<>(waveforms.values());
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	@Override
 | 
						@Override
 | 
				
			||||||
@@ -93,7 +88,7 @@ public class WaveformDb extends HierNode implements IWaveformDb {
 | 
				
			|||||||
					buildHierarchyNodes() ;
 | 
										buildHierarchyNodes() ;
 | 
				
			||||||
					relationTypes.addAll(loader.getAllRelationTypes());
 | 
										relationTypes.addAll(loader.getAllRelationTypes());
 | 
				
			||||||
					pcs.firePropertyChange("WAVEFORMS", null, waveforms);
 | 
										pcs.firePropertyChange("WAVEFORMS", null, waveforms);
 | 
				
			||||||
					pcs.firePropertyChange("CHILDS", null, childNodes);
 | 
										pcs.firePropertyChange("CHILDS", null, childs);
 | 
				
			||||||
					loaded = true;
 | 
										loaded = true;
 | 
				
			||||||
					return true;
 | 
										return true;
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
@@ -116,7 +111,7 @@ public class WaveformDb extends HierNode implements IWaveformDb {
 | 
				
			|||||||
	@Override
 | 
						@Override
 | 
				
			||||||
	public void clear() {
 | 
						public void clear() {
 | 
				
			||||||
		waveforms.clear();
 | 
							waveforms.clear();
 | 
				
			||||||
		childNodes.clear();
 | 
							childs.clear();
 | 
				
			||||||
		loaded=false;
 | 
							loaded=false;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -124,62 +119,41 @@ public class WaveformDb extends HierNode implements IWaveformDb {
 | 
				
			|||||||
		return loaded;
 | 
							return loaded;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	private void buildHierarchyNodes() throws InputFormatException{
 | 
						private void buildHierarchyNodes() {
 | 
				
			||||||
		childNodes= new ArrayList<IHierNode>();
 | 
					 | 
				
			||||||
		for(IWaveform stream:getAllWaves()){
 | 
							for(IWaveform stream:getAllWaves()){
 | 
				
			||||||
			//updateMaxTime(stream);
 | 
					 | 
				
			||||||
			String[] hier = stream.getName().split("\\.");
 | 
								String[] hier = stream.getName().split("\\.");
 | 
				
			||||||
			IHierNode node = this;
 | 
								IHierNode node = this;
 | 
				
			||||||
			List<String> path=new LinkedList<String>();
 | 
								for(int i=0; i<hier.length-1; ++i){
 | 
				
			||||||
			path.add(name);
 | 
									String name = hier[i];
 | 
				
			||||||
			for(String name:hier){
 | 
									IHierNode childNode = null;
 | 
				
			||||||
				IHierNode n1 = null;
 | 
					 | 
				
			||||||
				for (IHierNode n : node.getChildNodes()) {
 | 
									for (IHierNode n : node.getChildNodes()) {
 | 
				
			||||||
					if (n.getName().equals(name)) {
 | 
										if (n.getName().equals(name)) {
 | 
				
			||||||
						n1=n;
 | 
											childNode=n;
 | 
				
			||||||
						break;
 | 
											break;
 | 
				
			||||||
					}
 | 
										}
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
				if(name.equals(hier[hier.length-1])){ //leaf
 | 
									if(childNode != null) {
 | 
				
			||||||
					if(n1!=null) {
 | 
										node = childNode;
 | 
				
			||||||
						if(n1 instanceof HierNode){
 | 
										break;
 | 
				
			||||||
							node.getChildNodes().remove(n1);
 | 
					 | 
				
			||||||
							stream.getChildNodes().addAll(n1.getChildNodes());
 | 
					 | 
				
			||||||
							Collections.sort(stream.getChildNodes());
 | 
					 | 
				
			||||||
						} else {
 | 
					 | 
				
			||||||
							throw new InputFormatException();
 | 
					 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
					}
 | 
									HierNode newNode = new HierNode(name, node);
 | 
				
			||||||
					stream.setName(name);
 | 
					 | 
				
			||||||
					stream.setParentName(join(path, "."));
 | 
					 | 
				
			||||||
					node.getChildNodes().add(stream);
 | 
					 | 
				
			||||||
					Collections.sort(node.getChildNodes());
 | 
					 | 
				
			||||||
					node=stream;
 | 
					 | 
				
			||||||
				} else { // intermediate
 | 
					 | 
				
			||||||
					if(n1 != null) {
 | 
					 | 
				
			||||||
						node=n1;
 | 
					 | 
				
			||||||
					} else {
 | 
					 | 
				
			||||||
						HierNode newNode = new HierNode(name, join(path, "."));
 | 
					 | 
				
			||||||
				node.getChildNodes().add(newNode);
 | 
									node.getChildNodes().add(newNode);
 | 
				
			||||||
						Collections.sort(node.getChildNodes());
 | 
					 | 
				
			||||||
				node=newNode;
 | 
									node=newNode;
 | 
				
			||||||
 | 
										
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
 | 
								node.getChildNodes().add(stream);
 | 
				
			||||||
 | 
								stream.setParent(node);
 | 
				
			||||||
 | 
								stream.setName(hier[hier.length-1]);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
				path.add(name);
 | 
							sortRecursive(this);
 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	private static String join(Collection<?> col, String delim) {
 | 
						private void sortRecursive(IHierNode node) {
 | 
				
			||||||
	    StringBuilder sb = new StringBuilder();
 | 
							Collections.sort(node.getChildNodes(), (IHierNode o1, IHierNode o2) -> o1.getName().compareTo(o2.getName()));
 | 
				
			||||||
	    Iterator<?> iter = col.iterator();
 | 
							for(IHierNode n:node.getChildNodes()) {
 | 
				
			||||||
	    if (iter.hasNext())
 | 
								if(!n.getChildNodes().isEmpty())
 | 
				
			||||||
	        sb.append(iter.next().toString());
 | 
									sortRecursive(n);
 | 
				
			||||||
	    while (iter.hasNext()) {
 | 
					 | 
				
			||||||
	        sb.append(delim);
 | 
					 | 
				
			||||||
	        sb.append(iter.next().toString());
 | 
					 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	    return sb.toString();
 | 
					 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	@Override
 | 
						@Override
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -8,16 +8,18 @@
 | 
				
			|||||||
 * Contributors:
 | 
					 * Contributors:
 | 
				
			||||||
 *     MINRES Technologies GmbH - initial API and implementation
 | 
					 *     MINRES Technologies GmbH - initial API and implementation
 | 
				
			||||||
 *******************************************************************************/
 | 
					 *******************************************************************************/
 | 
				
			||||||
package com.minres.scviewer.database;
 | 
					package com.minres.scviewer.database.tx;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import java.util.Collection;
 | 
					import java.util.Collection;
 | 
				
			||||||
import java.util.List;
 | 
					import java.util.List;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import com.minres.scviewer.database.IWaveform;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public interface ITx extends Comparable<ITx>{
 | 
					public interface ITx extends Comparable<ITx>{
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	public Long getId();
 | 
						public Long getId();
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	public ITxStream<ITxEvent> getStream();
 | 
						public IWaveform getStream();
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	public ITxGenerator getGenerator();
 | 
						public ITxGenerator getGenerator();
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
@@ -8,7 +8,7 @@
 | 
				
			|||||||
 * Contributors:
 | 
					 * Contributors:
 | 
				
			||||||
 *     MINRES Technologies GmbH - initial API and implementation
 | 
					 *     MINRES Technologies GmbH - initial API and implementation
 | 
				
			||||||
 *******************************************************************************/
 | 
					 *******************************************************************************/
 | 
				
			||||||
package com.minres.scviewer.database;
 | 
					package com.minres.scviewer.database.tx;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public interface ITxAttribute extends ITxAttributeType {
 | 
					public interface ITxAttribute extends ITxAttributeType {
 | 
				
			||||||
	public Object getValue();
 | 
						public Object getValue();
 | 
				
			||||||
@@ -8,7 +8,10 @@
 | 
				
			|||||||
 * Contributors:
 | 
					 * Contributors:
 | 
				
			||||||
 *     MINRES Technologies GmbH - initial API and implementation
 | 
					 *     MINRES Technologies GmbH - initial API and implementation
 | 
				
			||||||
 *******************************************************************************/
 | 
					 *******************************************************************************/
 | 
				
			||||||
package com.minres.scviewer.database;
 | 
					package com.minres.scviewer.database.tx;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import com.minres.scviewer.database.AssociationType;
 | 
				
			||||||
 | 
					import com.minres.scviewer.database.DataType;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public interface ITxAttributeType {
 | 
					public interface ITxAttributeType {
 | 
				
			||||||
	public String getName();
 | 
						public String getName();
 | 
				
			||||||
@@ -8,12 +8,13 @@
 | 
				
			|||||||
 * Contributors:
 | 
					 * Contributors:
 | 
				
			||||||
 *     MINRES Technologies GmbH - initial API and implementation
 | 
					 *     MINRES Technologies GmbH - initial API and implementation
 | 
				
			||||||
 *******************************************************************************/
 | 
					 *******************************************************************************/
 | 
				
			||||||
package com.minres.scviewer.database;
 | 
					package com.minres.scviewer.database.tx;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public interface ITxEvent extends IWaveformEvent {
 | 
					import com.minres.scviewer.database.IEvent;
 | 
				
			||||||
	enum Type {BEGIN, END};
 | 
					
 | 
				
			||||||
 | 
					public interface ITxEvent extends IEvent {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						public Long getTime();
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	public ITx getTransaction();	
 | 
						public ITx getTransaction();	
 | 
				
			||||||
	
 | 
					 | 
				
			||||||
	public Type getType();
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@@ -8,13 +8,15 @@
 | 
				
			|||||||
 * Contributors:
 | 
					 * Contributors:
 | 
				
			||||||
 *     MINRES Technologies GmbH - initial API and implementation
 | 
					 *     MINRES Technologies GmbH - initial API and implementation
 | 
				
			||||||
 *******************************************************************************/
 | 
					 *******************************************************************************/
 | 
				
			||||||
package com.minres.scviewer.database;
 | 
					package com.minres.scviewer.database.tx;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import java.util.List;
 | 
					import java.util.List;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import com.minres.scviewer.database.IWaveform;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public interface ITxGenerator {
 | 
					public interface ITxGenerator {
 | 
				
			||||||
	public Long getId();
 | 
						public Long getId();
 | 
				
			||||||
	public ITxStream<ITxEvent> getStream();
 | 
						public IWaveform getStream();
 | 
				
			||||||
	public String getName();
 | 
						public String getName();
 | 
				
			||||||
	public List<ITx> getTransactions();
 | 
						public List<ITx> getTransactions();
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@@ -8,7 +8,9 @@
 | 
				
			|||||||
 * Contributors:
 | 
					 * Contributors:
 | 
				
			||||||
 *     MINRES Technologies GmbH - initial API and implementation
 | 
					 *     MINRES Technologies GmbH - initial API and implementation
 | 
				
			||||||
 *******************************************************************************/
 | 
					 *******************************************************************************/
 | 
				
			||||||
package com.minres.scviewer.database;
 | 
					package com.minres.scviewer.database.tx;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import com.minres.scviewer.database.RelationType;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public interface ITxRelation {
 | 
					public interface ITxRelation {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
 | 
				
			|||||||
Bundle-ManifestVersion: 2
 | 
					Bundle-ManifestVersion: 2
 | 
				
			||||||
Bundle-Name: %Bundle-Name
 | 
					Bundle-Name: %Bundle-Name
 | 
				
			||||||
Bundle-SymbolicName: com.minres.scviewer.e4.application;singleton:=true
 | 
					Bundle-SymbolicName: com.minres.scviewer.e4.application;singleton:=true
 | 
				
			||||||
Bundle-Version: 2.10.0.qualifier
 | 
					Bundle-Version: 2.11.0.qualifier
 | 
				
			||||||
Bundle-Vendor: %Bundle-Vendor
 | 
					Bundle-Vendor: %Bundle-Vendor
 | 
				
			||||||
Require-Bundle: javax.inject;bundle-version="1.0.0",
 | 
					Require-Bundle: javax.inject;bundle-version="1.0.0",
 | 
				
			||||||
 org.eclipse.core.runtime;bundle-version="3.11.1",
 | 
					 org.eclipse.core.runtime;bundle-version="3.11.1",
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -70,7 +70,7 @@
 | 
				
			|||||||
                  </count>
 | 
					                  </count>
 | 
				
			||||||
 				<iterate
 | 
					 				<iterate
 | 
				
			||||||
           operator="or">
 | 
					           operator="or">
 | 
				
			||||||
       				<instanceof value="com.minres.scviewer.database.ITx"/>
 | 
					       				<instanceof value="com.minres.scviewer.database.tx.ITx"/>
 | 
				
			||||||
    			</iterate>      
 | 
					    			</iterate>      
 | 
				
			||||||
            </and>
 | 
					            </and>
 | 
				
			||||||
            </with>
 | 
					            </with>
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,7 +1,7 @@
 | 
				
			|||||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
 | 
					<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
 | 
				
			||||||
  <modelVersion>4.0.0</modelVersion>
 | 
					  <modelVersion>4.0.0</modelVersion>
 | 
				
			||||||
  <artifactId>com.minres.scviewer.e4.application</artifactId>
 | 
					  <artifactId>com.minres.scviewer.e4.application</artifactId>
 | 
				
			||||||
  <version>2.10.0-SNAPSHOT</version>
 | 
					  <version>2.11.0-SNAPSHOT</version>
 | 
				
			||||||
  <parent>
 | 
					  <parent>
 | 
				
			||||||
  	<groupId>com.minres.scviewer</groupId>
 | 
					  	<groupId>com.minres.scviewer</groupId>
 | 
				
			||||||
  	<artifactId>com.minres.scviewer.parent</artifactId>
 | 
					  	<artifactId>com.minres.scviewer.parent</artifactId>
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -13,6 +13,7 @@ package com.minres.scviewer.e4.application;
 | 
				
			|||||||
import java.io.IOException;
 | 
					import java.io.IOException;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import javax.annotation.PostConstruct;
 | 
					import javax.annotation.PostConstruct;
 | 
				
			||||||
 | 
					import javax.inject.Inject;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import org.eclipse.core.runtime.Platform;
 | 
					import org.eclipse.core.runtime.Platform;
 | 
				
			||||||
import org.eclipse.e4.core.contexts.IEclipseContext;
 | 
					import org.eclipse.e4.core.contexts.IEclipseContext;
 | 
				
			||||||
@@ -30,8 +31,10 @@ import org.eclipse.e4.ui.workbench.modeling.EPartService;
 | 
				
			|||||||
import org.eclipse.e4.ui.workbench.modeling.EPartService.PartState;
 | 
					import org.eclipse.e4.ui.workbench.modeling.EPartService.PartState;
 | 
				
			||||||
import org.eclipse.equinox.app.IApplicationContext;
 | 
					import org.eclipse.equinox.app.IApplicationContext;
 | 
				
			||||||
import org.eclipse.osgi.service.datalocation.Location;
 | 
					import org.eclipse.osgi.service.datalocation.Location;
 | 
				
			||||||
 | 
					import org.eclipse.swt.widgets.Display;
 | 
				
			||||||
import org.osgi.service.event.Event;
 | 
					import org.osgi.service.event.Event;
 | 
				
			||||||
import org.osgi.service.event.EventHandler;
 | 
					import org.osgi.service.event.EventHandler;
 | 
				
			||||||
 | 
					import org.eclipse.e4.core.services.log.Logger;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import com.minres.scviewer.e4.application.options.Options;
 | 
					import com.minres.scviewer.e4.application.options.Options;
 | 
				
			||||||
import com.minres.scviewer.e4.application.options.Options.Multiplicity;
 | 
					import com.minres.scviewer.e4.application.options.Options.Multiplicity;
 | 
				
			||||||
@@ -45,6 +48,8 @@ import com.minres.scviewer.e4.application.options.Options.Separator;
 | 
				
			|||||||
 **/
 | 
					 **/
 | 
				
			||||||
public class E4LifeCycle {
 | 
					public class E4LifeCycle {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						@Inject private Logger logger;
 | 
				
			||||||
 | 
						
 | 
				
			||||||
	/**
 | 
						/**
 | 
				
			||||||
	 * Post construct.
 | 
						 * Post construct.
 | 
				
			||||||
	 *
 | 
						 *
 | 
				
			||||||
@@ -70,20 +75,10 @@ public class E4LifeCycle {
 | 
				
			|||||||
			.addOption("clearPersistedState", Multiplicity.ZERO_OR_ONE)
 | 
								.addOption("clearPersistedState", Multiplicity.ZERO_OR_ONE)
 | 
				
			||||||
			.addOption("c", Separator.BLANK, Multiplicity.ZERO_OR_ONE);
 | 
								.addOption("c", Separator.BLANK, Multiplicity.ZERO_OR_ONE);
 | 
				
			||||||
		if (!opt.check(Options.DEFAULT_SET, true, false)) {
 | 
							if (!opt.check(Options.DEFAULT_SET, true, false)) {
 | 
				
			||||||
			System.err.println(opt.getCheckErrors());
 | 
								logger.error(opt.getCheckErrors());
 | 
				
			||||||
			System.exit(1);
 | 
								System.exit(1);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		final String confFile =opt.getSet().isSet("c")?opt.getSet().getOption("c").getResultValue(0):"";
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
		// react on the first view being created, at that time the UI is available
 | 
					 | 
				
			||||||
//		eventBroker.subscribe(UIEvents.UILifeCycle.ACTIVATE, new EventHandler() {
 | 
					 | 
				
			||||||
//			@Override
 | 
					 | 
				
			||||||
//			public void handleEvent(Event event) {
 | 
					 | 
				
			||||||
//				MPart part = (MPart) event.getProperty("ChangedElement"); //$NON-NLS-1$
 | 
					 | 
				
			||||||
//				if(part!=null){
 | 
					 | 
				
			||||||
//				}
 | 
					 | 
				
			||||||
//			}
 | 
					 | 
				
			||||||
//		});
 | 
					 | 
				
			||||||
		eventBroker.subscribe(UIEvents.UILifeCycle.APP_STARTUP_COMPLETE, new EventHandler() {
 | 
							eventBroker.subscribe(UIEvents.UILifeCycle.APP_STARTUP_COMPLETE, new EventHandler() {
 | 
				
			||||||
			@Override
 | 
								@Override
 | 
				
			||||||
			public void handleEvent(Event event) {
 | 
								public void handleEvent(Event event) {
 | 
				
			||||||
@@ -93,7 +88,8 @@ public class E4LifeCycle {
 | 
				
			|||||||
					if(isLocked)
 | 
										if(isLocked)
 | 
				
			||||||
						instanceLocation.release();
 | 
											instanceLocation.release();
 | 
				
			||||||
				} catch (IOException e) { }
 | 
									} catch (IOException e) { }
 | 
				
			||||||
				if(opt.getSet().getData().size()>0) {
 | 
									if(!opt.getSet().getData().isEmpty()) {
 | 
				
			||||||
 | 
										Display.getCurrent().timerExec (100, () -> {
 | 
				
			||||||
						MApplication app= workbenchContext.get(MApplication.class);
 | 
											MApplication app= workbenchContext.get(MApplication.class);
 | 
				
			||||||
						EModelService modelService = workbenchContext.get(EModelService.class);
 | 
											EModelService modelService = workbenchContext.get(EModelService.class);
 | 
				
			||||||
						EPartService partService= workbenchContext.get(EPartService.class);
 | 
											EPartService partService= workbenchContext.get(EPartService.class);
 | 
				
			||||||
@@ -105,7 +101,9 @@ public class E4LifeCycle {
 | 
				
			|||||||
						partService.showPart(part, PartState.ACTIVATE);
 | 
											partService.showPart(part, PartState.ACTIVATE);
 | 
				
			||||||
						IEclipseContext ctx = part.getContext();
 | 
											IEclipseContext ctx = part.getContext();
 | 
				
			||||||
						ctx.modify("input", opt.getSet().getData());
 | 
											ctx.modify("input", opt.getSet().getData());
 | 
				
			||||||
 | 
											String confFile =opt.getSet().isSet("c")?opt.getSet().getOption("c").getResultValue(0):"";
 | 
				
			||||||
						ctx.modify("config", confFile); //$NON-NLS-1$
 | 
											ctx.modify("config", confFile); //$NON-NLS-1$
 | 
				
			||||||
 | 
										});
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		});
 | 
							});
 | 
				
			||||||
@@ -118,6 +116,7 @@ public class E4LifeCycle {
 | 
				
			|||||||
	 */
 | 
						 */
 | 
				
			||||||
	@PreSave
 | 
						@PreSave
 | 
				
			||||||
	void preSave(IEclipseContext workbenchContext) {
 | 
						void preSave(IEclipseContext workbenchContext) {
 | 
				
			||||||
 | 
							/* nothing to be done here */
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/**
 | 
						/**
 | 
				
			||||||
@@ -127,6 +126,7 @@ public class E4LifeCycle {
 | 
				
			|||||||
	 */
 | 
						 */
 | 
				
			||||||
	@ProcessAdditions
 | 
						@ProcessAdditions
 | 
				
			||||||
	void processAdditions(IEclipseContext workbenchContext) {
 | 
						void processAdditions(IEclipseContext workbenchContext) {
 | 
				
			||||||
 | 
							/* nothing to be done here */
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/**
 | 
						/**
 | 
				
			||||||
@@ -136,5 +136,6 @@ public class E4LifeCycle {
 | 
				
			|||||||
	 */
 | 
						 */
 | 
				
			||||||
	@ProcessRemovals
 | 
						@ProcessRemovals
 | 
				
			||||||
	void processRemovals(IEclipseContext workbenchContext) {
 | 
						void processRemovals(IEclipseContext workbenchContext) {
 | 
				
			||||||
 | 
							/* nothing to be done here */
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -23,6 +23,7 @@ public class Messages extends NLS {
 | 
				
			|||||||
	public static String ResourceManager_0;
 | 
						public static String ResourceManager_0;
 | 
				
			||||||
	public static String SCViewerPreferencesPage_0;
 | 
						public static String SCViewerPreferencesPage_0;
 | 
				
			||||||
	public static String SCViewerPreferencesPage_1;
 | 
						public static String SCViewerPreferencesPage_1;
 | 
				
			||||||
 | 
						public static String SCViewerPreferencesPage_2;
 | 
				
			||||||
	public static String StatusBarControl_1;
 | 
						public static String StatusBarControl_1;
 | 
				
			||||||
	public static String StatusBarControl_2;
 | 
						public static String StatusBarControl_2;
 | 
				
			||||||
	public static String StatusBarControl_3;
 | 
						public static String StatusBarControl_3;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -29,8 +29,8 @@ import org.eclipse.swt.SWT;
 | 
				
			|||||||
import org.eclipse.swt.widgets.Combo;
 | 
					import org.eclipse.swt.widgets.Combo;
 | 
				
			||||||
import org.eclipse.swt.widgets.Composite;
 | 
					import org.eclipse.swt.widgets.Composite;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import com.minres.scviewer.database.ITx;
 | 
					 | 
				
			||||||
import com.minres.scviewer.database.RelationType;
 | 
					import com.minres.scviewer.database.RelationType;
 | 
				
			||||||
 | 
					import com.minres.scviewer.database.tx.ITx;
 | 
				
			||||||
import com.minres.scviewer.e4.application.Messages;
 | 
					import com.minres.scviewer.e4.application.Messages;
 | 
				
			||||||
import com.minres.scviewer.e4.application.parts.PartListener;
 | 
					import com.minres.scviewer.e4.application.parts.PartListener;
 | 
				
			||||||
import com.minres.scviewer.e4.application.parts.WaveformViewer;
 | 
					import com.minres.scviewer.e4.application.parts.WaveformViewer;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -22,7 +22,8 @@ import org.eclipse.jface.viewers.ISelection;
 | 
				
			|||||||
import org.eclipse.jface.viewers.IStructuredSelection;
 | 
					import org.eclipse.jface.viewers.IStructuredSelection;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import com.minres.scviewer.database.BitVector;
 | 
					import com.minres.scviewer.database.BitVector;
 | 
				
			||||||
import com.minres.scviewer.database.ISignal;
 | 
					import com.minres.scviewer.database.DoubleVal;
 | 
				
			||||||
 | 
					import com.minres.scviewer.database.WaveformType;
 | 
				
			||||||
import com.minres.scviewer.database.ui.TrackEntry;
 | 
					import com.minres.scviewer.database.ui.TrackEntry;
 | 
				
			||||||
import com.minres.scviewer.e4.application.parts.WaveformViewer;
 | 
					import com.minres.scviewer.e4.application.parts.WaveformViewer;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -31,16 +32,16 @@ public class WaveformPopupMenuContribution {
 | 
				
			|||||||
	
 | 
						
 | 
				
			||||||
	@Inject MPart activePart;
 | 
						@Inject MPart activePart;
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
	final TrackEntry nullEntry = new TrackEntry(null);
 | 
						final TrackEntry nullEntry = new TrackEntry(null, null);
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	private boolean selHasBitVector(ISelection sel, boolean checkForDouble) {
 | 
						private boolean selHasBitVector(ISelection sel, boolean checkForDouble) {
 | 
				
			||||||
		if(!sel.isEmpty() && sel instanceof IStructuredSelection) {
 | 
							if(!sel.isEmpty() && sel instanceof IStructuredSelection) {
 | 
				
			||||||
			for(Object elem:(IStructuredSelection)sel) {
 | 
								for(Object elem:(IStructuredSelection)sel) {
 | 
				
			||||||
				if(elem instanceof TrackEntry) {
 | 
									if(elem instanceof TrackEntry) {
 | 
				
			||||||
					TrackEntry e = (TrackEntry) elem;
 | 
										TrackEntry e = (TrackEntry) elem;
 | 
				
			||||||
					if(e.waveform instanceof ISignal<?>) {
 | 
										if(e.waveform.getType() == WaveformType.SIGNAL) {
 | 
				
			||||||
						Object o = ((ISignal<?>) e.waveform).getEvents().firstEntry().getValue();
 | 
											Object o = e.waveform.getEvents().firstEntry().getValue()[0];
 | 
				
			||||||
						if(checkForDouble && o instanceof Double) 
 | 
											if(checkForDouble && o instanceof DoubleVal) 
 | 
				
			||||||
							return true;
 | 
												return true;
 | 
				
			||||||
						else if(o instanceof BitVector && ((BitVector)o).getWidth()>1)
 | 
											else if(o instanceof BitVector && ((BitVector)o).getWidth()>1)
 | 
				
			||||||
							return true;
 | 
												return true;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -20,8 +20,8 @@ import org.eclipse.e4.ui.workbench.modeling.EPartService;
 | 
				
			|||||||
import org.eclipse.e4.ui.workbench.modeling.ESelectionService;
 | 
					import org.eclipse.e4.ui.workbench.modeling.ESelectionService;
 | 
				
			||||||
import org.eclipse.jface.viewers.IStructuredSelection;
 | 
					import org.eclipse.jface.viewers.IStructuredSelection;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import com.minres.scviewer.database.ITx;
 | 
					 | 
				
			||||||
import com.minres.scviewer.database.IWaveform;
 | 
					import com.minres.scviewer.database.IWaveform;
 | 
				
			||||||
 | 
					import com.minres.scviewer.database.tx.ITx;
 | 
				
			||||||
import com.minres.scviewer.database.ui.TrackEntry;
 | 
					import com.minres.scviewer.database.ui.TrackEntry;
 | 
				
			||||||
import com.minres.scviewer.e4.application.parts.WaveformViewer;
 | 
					import com.minres.scviewer.e4.application.parts.WaveformViewer;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -20,8 +20,8 @@ import org.eclipse.e4.ui.workbench.modeling.EPartService;
 | 
				
			|||||||
import org.eclipse.e4.ui.workbench.modeling.ESelectionService;
 | 
					import org.eclipse.e4.ui.workbench.modeling.ESelectionService;
 | 
				
			||||||
import org.eclipse.jface.viewers.IStructuredSelection;
 | 
					import org.eclipse.jface.viewers.IStructuredSelection;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import com.minres.scviewer.database.ITx;
 | 
					 | 
				
			||||||
import com.minres.scviewer.database.IWaveform;
 | 
					import com.minres.scviewer.database.IWaveform;
 | 
				
			||||||
 | 
					import com.minres.scviewer.database.tx.ITx;
 | 
				
			||||||
import com.minres.scviewer.database.ui.GotoDirection;
 | 
					import com.minres.scviewer.database.ui.GotoDirection;
 | 
				
			||||||
import com.minres.scviewer.database.ui.TrackEntry;
 | 
					import com.minres.scviewer.database.ui.TrackEntry;
 | 
				
			||||||
import com.minres.scviewer.e4.application.parts.WaveformViewer;
 | 
					import com.minres.scviewer.e4.application.parts.WaveformViewer;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -20,7 +20,7 @@ import org.eclipse.e4.ui.workbench.modeling.EPartService;
 | 
				
			|||||||
import org.eclipse.e4.ui.workbench.modeling.ESelectionService;
 | 
					import org.eclipse.e4.ui.workbench.modeling.ESelectionService;
 | 
				
			||||||
import org.eclipse.jface.viewers.IStructuredSelection;
 | 
					import org.eclipse.jface.viewers.IStructuredSelection;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import com.minres.scviewer.database.ITx;
 | 
					import com.minres.scviewer.database.tx.ITx;
 | 
				
			||||||
import com.minres.scviewer.database.ui.GotoDirection;
 | 
					import com.minres.scviewer.database.ui.GotoDirection;
 | 
				
			||||||
import com.minres.scviewer.e4.application.parts.WaveformViewer;
 | 
					import com.minres.scviewer.e4.application.parts.WaveformViewer;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -17,6 +17,7 @@ import org.eclipse.jface.viewers.ISelection;
 | 
				
			|||||||
import org.eclipse.jface.viewers.StructuredSelection;
 | 
					import org.eclipse.jface.viewers.StructuredSelection;
 | 
				
			||||||
import org.eclipse.swt.widgets.Shell;
 | 
					import org.eclipse.swt.widgets.Shell;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import com.minres.scviewer.database.WaveformType;
 | 
				
			||||||
import com.minres.scviewer.database.ui.TrackEntry;
 | 
					import com.minres.scviewer.database.ui.TrackEntry;
 | 
				
			||||||
import com.minres.scviewer.e4.application.parts.WaveformViewer;
 | 
					import com.minres.scviewer.e4.application.parts.WaveformViewer;
 | 
				
			||||||
public class SearchHandler {
 | 
					public class SearchHandler {
 | 
				
			||||||
@@ -31,7 +32,7 @@ public class SearchHandler {
 | 
				
			|||||||
				Object[] elem = ((StructuredSelection)sel).toArray();
 | 
									Object[] elem = ((StructuredSelection)sel).toArray();
 | 
				
			||||||
				if(elem.length ==0) return false;
 | 
									if(elem.length ==0) return false;
 | 
				
			||||||
				TrackEntry e = findTrackEntry(elem);
 | 
									TrackEntry e = findTrackEntry(elem);
 | 
				
			||||||
				return e!=null && e.isStream();
 | 
									return e!=null && e.waveform.getType()==WaveformType.TRANSACTION;
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		return false;
 | 
							return false;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -22,7 +22,7 @@ import org.eclipse.e4.ui.workbench.modeling.EPartService;
 | 
				
			|||||||
 */
 | 
					 */
 | 
				
			||||||
@SuppressWarnings("restriction")
 | 
					@SuppressWarnings("restriction")
 | 
				
			||||||
public class ThemeSetHandler {
 | 
					public class ThemeSetHandler {
 | 
				
			||||||
	final static String PARAMTER_ID = "com.minres.scviewer.e4.application.command.theme.parameter.id"; //$NON-NLS-1$
 | 
						static final String PARAMTER_ID = "com.minres.scviewer.e4.application.command.theme.parameter.id"; //$NON-NLS-1$
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	@CanExecute
 | 
						@CanExecute
 | 
				
			||||||
	public boolean canExecute(EPartService partService) {
 | 
						public boolean canExecute(EPartService partService) {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -17,6 +17,7 @@ RelationTypeToolControl_1=Select
 | 
				
			|||||||
ResourceManager_0=Wrong decorate corner
 | 
					ResourceManager_0=Wrong decorate corner
 | 
				
			||||||
SCViewerPreferencesPage_0=Check for changed database
 | 
					SCViewerPreferencesPage_0=Check for changed database
 | 
				
			||||||
SCViewerPreferencesPage_1=Show hover window in waveform
 | 
					SCViewerPreferencesPage_1=Show hover window in waveform
 | 
				
			||||||
 | 
					SCViewerPreferencesPage_2=Waveform track height
 | 
				
			||||||
StatusBarControl_1=Currently running: 
 | 
					StatusBarControl_1=Currently running: 
 | 
				
			||||||
StatusBarControl_2=\nLast task: 
 | 
					StatusBarControl_2=\nLast task: 
 | 
				
			||||||
StatusBarControl_3=Currently running: 
 | 
					StatusBarControl_3=Currently running: 
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -77,9 +77,9 @@ import org.eclipse.wb.swt.SWTResourceManager;
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
import com.minres.scviewer.database.HierNode;
 | 
					import com.minres.scviewer.database.HierNode;
 | 
				
			||||||
import com.minres.scviewer.database.IHierNode;
 | 
					import com.minres.scviewer.database.IHierNode;
 | 
				
			||||||
import com.minres.scviewer.database.ITx;
 | 
					 | 
				
			||||||
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.tx.ITx;
 | 
				
			||||||
import com.minres.scviewer.e4.application.Messages;
 | 
					import com.minres.scviewer.e4.application.Messages;
 | 
				
			||||||
import com.minres.scviewer.e4.application.handlers.AddWaveformHandler;
 | 
					import com.minres.scviewer.e4.application.handlers.AddWaveformHandler;
 | 
				
			||||||
import com.minres.scviewer.e4.application.provider.TxDbContentProvider;
 | 
					import com.minres.scviewer.e4.application.provider.TxDbContentProvider;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -5,6 +5,7 @@ import java.io.File;
 | 
				
			|||||||
import java.util.ArrayList;
 | 
					import java.util.ArrayList;
 | 
				
			||||||
import java.util.List;
 | 
					import java.util.List;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import com.minres.scviewer.database.IDerivedWaveform;
 | 
				
			||||||
import com.minres.scviewer.database.IHierNode;
 | 
					import com.minres.scviewer.database.IHierNode;
 | 
				
			||||||
import com.minres.scviewer.database.IWaveform;
 | 
					import com.minres.scviewer.database.IWaveform;
 | 
				
			||||||
import com.minres.scviewer.database.IWaveformDb;
 | 
					import com.minres.scviewer.database.IWaveformDb;
 | 
				
			||||||
@@ -38,7 +39,7 @@ public class LoadingWaveformDb implements IWaveformDb {
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	@Override
 | 
						@Override
 | 
				
			||||||
	public void setParentName(String name) {
 | 
						public void setParent(IHierNode name) {
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	@Override
 | 
						@Override
 | 
				
			||||||
@@ -85,4 +86,9 @@ public class LoadingWaveformDb implements IWaveformDb {
 | 
				
			|||||||
	public void clear() {
 | 
						public void clear() {
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						@Override
 | 
				
			||||||
 | 
						public IDerivedWaveform deriveWaveform() {
 | 
				
			||||||
 | 
							return null;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,181 +0,0 @@
 | 
				
			|||||||
package com.minres.scviewer.e4.application.parts;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
import java.util.List;
 | 
					 | 
				
			||||||
import java.util.Map;
 | 
					 | 
				
			||||||
import java.util.Map.Entry;
 | 
					 | 
				
			||||||
import java.util.concurrent.ConcurrentHashMap;
 | 
					 | 
				
			||||||
import java.util.stream.Collectors;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
import org.eclipse.jface.dialogs.IDialogConstants;
 | 
					 | 
				
			||||||
import org.eclipse.jface.dialogs.TitleAreaDialog;
 | 
					 | 
				
			||||||
import org.eclipse.jface.viewers.ArrayContentProvider;
 | 
					 | 
				
			||||||
import org.eclipse.jface.viewers.ComboViewer;
 | 
					 | 
				
			||||||
import org.eclipse.jface.viewers.ISelectionChangedListener;
 | 
					 | 
				
			||||||
import org.eclipse.jface.viewers.IStructuredSelection;
 | 
					 | 
				
			||||||
import org.eclipse.jface.viewers.LabelProvider;
 | 
					 | 
				
			||||||
import org.eclipse.jface.viewers.SelectionChangedEvent;
 | 
					 | 
				
			||||||
import org.eclipse.jface.viewers.StructuredSelection;
 | 
					 | 
				
			||||||
import org.eclipse.swt.SWT;
 | 
					 | 
				
			||||||
import org.eclipse.swt.layout.GridData;
 | 
					 | 
				
			||||||
import org.eclipse.swt.layout.GridLayout;
 | 
					 | 
				
			||||||
import org.eclipse.swt.widgets.Button;
 | 
					 | 
				
			||||||
import org.eclipse.swt.widgets.Composite;
 | 
					 | 
				
			||||||
import org.eclipse.swt.widgets.Control;
 | 
					 | 
				
			||||||
import org.eclipse.swt.widgets.Label;
 | 
					 | 
				
			||||||
import org.eclipse.swt.widgets.Shell;
 | 
					 | 
				
			||||||
import org.eclipse.swt.widgets.Text;
 | 
					 | 
				
			||||||
import org.eclipse.wb.swt.ResourceManager;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
import com.minres.scviewer.database.DataType;
 | 
					 | 
				
			||||||
import com.minres.scviewer.database.ITxEvent;
 | 
					 | 
				
			||||||
import com.minres.scviewer.database.ITxStream;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
public class SearchTxDialog extends TitleAreaDialog {
 | 
					 | 
				
			||||||
	private ComboViewer propNameComboViewer = null; 
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	private Text propValueText = null;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	private String propName="";
 | 
					 | 
				
			||||||
	private DataType propType=null;
 | 
					 | 
				
			||||||
	private String propValue="";
 | 
					 | 
				
			||||||
	
 | 
					 | 
				
			||||||
	private ITxStream<? extends ITxEvent> stream;
 | 
					 | 
				
			||||||
	
 | 
					 | 
				
			||||||
	private ConcurrentHashMap<String, DataType> propNames=new ConcurrentHashMap<String, DataType>();
 | 
					 | 
				
			||||||
	
 | 
					 | 
				
			||||||
	/**
 | 
					 | 
				
			||||||
	 * Create the dialog.
 | 
					 | 
				
			||||||
	 * @param parentShell
 | 
					 | 
				
			||||||
	 * @param iTxStream 
 | 
					 | 
				
			||||||
	 */
 | 
					 | 
				
			||||||
	public SearchTxDialog(Shell parentShell, ITxStream<? extends ITxEvent> iTxStream) {
 | 
					 | 
				
			||||||
		super(parentShell);
 | 
					 | 
				
			||||||
		setShellStyle(SWT.BORDER | SWT.RESIZE | SWT.TITLE | SWT.APPLICATION_MODAL);
 | 
					 | 
				
			||||||
		stream=iTxStream;
 | 
					 | 
				
			||||||
		new Thread() {
 | 
					 | 
				
			||||||
			public void run() {
 | 
					 | 
				
			||||||
				stream.getEvents().values().parallelStream().forEach(evtLst -> {
 | 
					 | 
				
			||||||
					evtLst.forEach(evt -> {
 | 
					 | 
				
			||||||
						 evt.getTransaction().getAttributes().stream().forEach(attr -> {
 | 
					 | 
				
			||||||
							 propNames.put(attr.getName(), attr.getDataType());
 | 
					 | 
				
			||||||
						 });
 | 
					 | 
				
			||||||
					});
 | 
					 | 
				
			||||||
				});
 | 
					 | 
				
			||||||
				parentShell.getDisplay().asyncExec(new Runnable() {
 | 
					 | 
				
			||||||
					@Override
 | 
					 | 
				
			||||||
					public void run() {
 | 
					 | 
				
			||||||
						if (propNameComboViewer!=null) {
 | 
					 | 
				
			||||||
							propNameComboViewer.setInput(getEntries());
 | 
					 | 
				
			||||||
							propNameComboViewer.setSelection(new StructuredSelection(propNameComboViewer.getElementAt(0)));
 | 
					 | 
				
			||||||
						}
 | 
					 | 
				
			||||||
					}
 | 
					 | 
				
			||||||
				});
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
		}.run();
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	/**
 | 
					 | 
				
			||||||
	 * Create contents of the dialog.
 | 
					 | 
				
			||||||
	 * @param parent
 | 
					 | 
				
			||||||
	 */
 | 
					 | 
				
			||||||
	@Override
 | 
					 | 
				
			||||||
	protected Control createDialogArea(Composite parent) {
 | 
					 | 
				
			||||||
		setMessage("Specify property name and value to search for");
 | 
					 | 
				
			||||||
		setTitleImage(ResourceManager.getPluginImage("com.minres.scviewer.e4.application", "icons/Minres_logo.png"));
 | 
					 | 
				
			||||||
		setTitle("Search Tx in stream");
 | 
					 | 
				
			||||||
		final Composite area = (Composite) super.createDialogArea(parent);
 | 
					 | 
				
			||||||
		final GridLayout gridLayout = (GridLayout) area.getLayout();
 | 
					 | 
				
			||||||
		gridLayout.marginTop = 10;
 | 
					 | 
				
			||||||
		gridLayout.marginBottom = 10;
 | 
					 | 
				
			||||||
		final Composite container = new Composite(area, SWT.NONE);
 | 
					 | 
				
			||||||
		final GridLayout gl_container = new GridLayout(2, false);
 | 
					 | 
				
			||||||
		gl_container.horizontalSpacing = 2;
 | 
					 | 
				
			||||||
		container.setLayout(gl_container);
 | 
					 | 
				
			||||||
		container.setLayoutData(new GridData(GridData.FILL_BOTH));
 | 
					 | 
				
			||||||
		
 | 
					 | 
				
			||||||
		final Label header = new Label(container, SWT.CENTER | SWT.WRAP);
 | 
					 | 
				
			||||||
		GridData gd_header = new GridData(SWT.FILL, SWT.TOP, true, false, 2, 1);
 | 
					 | 
				
			||||||
		gd_header.verticalIndent = 10;
 | 
					 | 
				
			||||||
		header.setLayoutData(gd_header);
 | 
					 | 
				
			||||||
		header.setText("Stream: "+stream.getName());
 | 
					 | 
				
			||||||
		
 | 
					 | 
				
			||||||
		final Label propNameLabel = new Label(container, SWT.NONE);
 | 
					 | 
				
			||||||
		propNameLabel.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
 | 
					 | 
				
			||||||
		propNameLabel.setText("Property Name:");
 | 
					 | 
				
			||||||
		
 | 
					 | 
				
			||||||
		propNameComboViewer = new ComboViewer(container, SWT.NONE);
 | 
					 | 
				
			||||||
		propNameComboViewer.getCombo().setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
 | 
					 | 
				
			||||||
		propNameComboViewer.setContentProvider(ArrayContentProvider.getInstance());
 | 
					 | 
				
			||||||
		propNameComboViewer.setLabelProvider(new LabelProvider() {
 | 
					 | 
				
			||||||
			@SuppressWarnings("unchecked")
 | 
					 | 
				
			||||||
			@Override
 | 
					 | 
				
			||||||
			public String getText(Object element) {
 | 
					 | 
				
			||||||
				Map.Entry<String, DataType> e = (Map.Entry<String, DataType>)element;	
 | 
					 | 
				
			||||||
				return e.getKey()+" ("+e.getValue().name()+")";
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		});
 | 
					 | 
				
			||||||
		propNameComboViewer.addSelectionChangedListener(new ISelectionChangedListener() {
 | 
					 | 
				
			||||||
			
 | 
					 | 
				
			||||||
			@SuppressWarnings("unchecked")
 | 
					 | 
				
			||||||
			@Override
 | 
					 | 
				
			||||||
			public void selectionChanged(SelectionChangedEvent event) {
 | 
					 | 
				
			||||||
				IStructuredSelection sel = event.getStructuredSelection();
 | 
					 | 
				
			||||||
				Map.Entry<String, DataType> e = (Map.Entry<String, DataType>)sel.getFirstElement();
 | 
					 | 
				
			||||||
				propName=e.getKey();
 | 
					 | 
				
			||||||
				propType=e.getValue();
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
		});
 | 
					 | 
				
			||||||
		propNameComboViewer.setInput(getEntries());
 | 
					 | 
				
			||||||
		propNameComboViewer.setSelection(new StructuredSelection(propNameComboViewer.getElementAt(0)));
 | 
					 | 
				
			||||||
		
 | 
					 | 
				
			||||||
		final Label propValueLabel = new Label(container, SWT.NONE);
 | 
					 | 
				
			||||||
		propValueLabel.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
 | 
					 | 
				
			||||||
		propValueLabel.setText("Property Value:");
 | 
					 | 
				
			||||||
		
 | 
					 | 
				
			||||||
		propValueText = new Text(container, SWT.BORDER);
 | 
					 | 
				
			||||||
		propValueText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		return area;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	private List<Entry<String,DataType>> getEntries() {
 | 
					 | 
				
			||||||
		return propNames.entrySet().stream().sorted((e1,e2)->e1.getKey().compareTo(e2.getKey())).collect(Collectors.toList());
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	/**
 | 
					 | 
				
			||||||
	 * Create contents of the button bar.
 | 
					 | 
				
			||||||
	 * @param parent
 | 
					 | 
				
			||||||
	 */
 | 
					 | 
				
			||||||
	@Override
 | 
					 | 
				
			||||||
	protected void createButtonsForButtonBar(Composite parent) {
 | 
					 | 
				
			||||||
		final Button okButton = createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);
 | 
					 | 
				
			||||||
		okButton.setImage(ResourceManager.getPluginImage("com.minres.scviewer.e4.application", "icons/tick.png"));
 | 
					 | 
				
			||||||
		final Button cancelButton = createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);
 | 
					 | 
				
			||||||
		cancelButton.setImage(ResourceManager.getPluginImage("com.minres.scviewer.e4.application", "icons/cross.png"));
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	protected void constrainShellSize() {
 | 
					 | 
				
			||||||
		super.constrainShellSize();
 | 
					 | 
				
			||||||
		getShell().setMinimumSize(getShell().computeSize(-1, -1));
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	@Override
 | 
					 | 
				
			||||||
	protected void okPressed() {
 | 
					 | 
				
			||||||
		propValue=propValueText.getText();
 | 
					 | 
				
			||||||
		super.okPressed();
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	public String getPropName() {
 | 
					 | 
				
			||||||
		return propName;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	public DataType getPropType() {
 | 
					 | 
				
			||||||
		return propType;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	
 | 
					 | 
				
			||||||
	public String getPropValue() {
 | 
					 | 
				
			||||||
		return propValue;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
@@ -57,7 +57,7 @@ import org.eclipse.swt.widgets.Text;
 | 
				
			|||||||
import org.eclipse.swt.widgets.Tree;
 | 
					import org.eclipse.swt.widgets.Tree;
 | 
				
			||||||
import org.eclipse.swt.widgets.TreeItem;
 | 
					import org.eclipse.swt.widgets.TreeItem;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import com.minres.scviewer.database.ITx;
 | 
					import com.minres.scviewer.database.tx.ITx;
 | 
				
			||||||
import com.minres.scviewer.e4.application.Messages;
 | 
					import com.minres.scviewer.e4.application.Messages;
 | 
				
			||||||
import com.minres.scviewer.e4.application.parts.txTableTree.AttributeLabelProvider;
 | 
					import com.minres.scviewer.e4.application.parts.txTableTree.AttributeLabelProvider;
 | 
				
			||||||
import com.minres.scviewer.e4.application.parts.txTableTree.AbstractTransactionTreeContentProvider;
 | 
					import com.minres.scviewer.e4.application.parts.txTableTree.AbstractTransactionTreeContentProvider;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,6 +1,8 @@
 | 
				
			|||||||
package com.minres.scviewer.e4.application.parts;
 | 
					package com.minres.scviewer.e4.application.parts;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import java.util.ArrayList;
 | 
					import java.util.ArrayList;
 | 
				
			||||||
 | 
					import java.util.Arrays;
 | 
				
			||||||
 | 
					import java.util.Collection;
 | 
				
			||||||
import java.util.List;
 | 
					import java.util.List;
 | 
				
			||||||
import java.util.concurrent.ConcurrentHashMap;
 | 
					import java.util.concurrent.ConcurrentHashMap;
 | 
				
			||||||
import java.util.stream.Collectors;
 | 
					import java.util.stream.Collectors;
 | 
				
			||||||
@@ -10,8 +12,6 @@ import org.eclipse.core.databinding.observable.list.WritableList;
 | 
				
			|||||||
import org.eclipse.jface.databinding.viewers.ObservableListContentProvider;
 | 
					import org.eclipse.jface.databinding.viewers.ObservableListContentProvider;
 | 
				
			||||||
import org.eclipse.jface.viewers.ComboViewer;
 | 
					import org.eclipse.jface.viewers.ComboViewer;
 | 
				
			||||||
import org.eclipse.jface.viewers.DelegatingStyledCellLabelProvider;
 | 
					import org.eclipse.jface.viewers.DelegatingStyledCellLabelProvider;
 | 
				
			||||||
import org.eclipse.jface.viewers.DoubleClickEvent;
 | 
					 | 
				
			||||||
import org.eclipse.jface.viewers.IDoubleClickListener;
 | 
					 | 
				
			||||||
import org.eclipse.jface.viewers.ISelection;
 | 
					import org.eclipse.jface.viewers.ISelection;
 | 
				
			||||||
import org.eclipse.jface.viewers.ISelectionChangedListener;
 | 
					import org.eclipse.jface.viewers.ISelectionChangedListener;
 | 
				
			||||||
import org.eclipse.jface.viewers.IStructuredSelection;
 | 
					import org.eclipse.jface.viewers.IStructuredSelection;
 | 
				
			||||||
@@ -36,11 +36,13 @@ import org.eclipse.swt.widgets.TableColumn;
 | 
				
			|||||||
import org.eclipse.swt.widgets.Text;
 | 
					import org.eclipse.swt.widgets.Text;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import com.minres.scviewer.database.DataType;
 | 
					import com.minres.scviewer.database.DataType;
 | 
				
			||||||
import com.minres.scviewer.database.ITx;
 | 
					import com.minres.scviewer.database.EventKind;
 | 
				
			||||||
import com.minres.scviewer.database.ITxAttribute;
 | 
					import com.minres.scviewer.database.IEvent;
 | 
				
			||||||
import com.minres.scviewer.database.ITxEvent;
 | 
					import com.minres.scviewer.database.IWaveform;
 | 
				
			||||||
import com.minres.scviewer.database.ITxEvent.Type;
 | 
					import com.minres.scviewer.database.WaveformType;
 | 
				
			||||||
import com.minres.scviewer.database.ITxStream;
 | 
					import com.minres.scviewer.database.tx.ITx;
 | 
				
			||||||
 | 
					import com.minres.scviewer.database.tx.ITxAttribute;
 | 
				
			||||||
 | 
					import com.minres.scviewer.database.tx.ITxEvent;
 | 
				
			||||||
import com.minres.scviewer.database.ui.TrackEntry;
 | 
					import com.minres.scviewer.database.ui.TrackEntry;
 | 
				
			||||||
import com.minres.scviewer.e4.application.parts.txTableTree.AbstractTransactionTreeContentProvider;
 | 
					import com.minres.scviewer.e4.application.parts.txTableTree.AbstractTransactionTreeContentProvider;
 | 
				
			||||||
import com.minres.scviewer.e4.application.parts.txTableTree.AttributeLabelProvider;
 | 
					import com.minres.scviewer.e4.application.parts.txTableTree.AttributeLabelProvider;
 | 
				
			||||||
@@ -84,7 +86,7 @@ public class TransactionList extends Composite {
 | 
				
			|||||||
	
 | 
						
 | 
				
			||||||
	private AttributeLabelProvider valueLabelProvider = null;
 | 
						private AttributeLabelProvider valueLabelProvider = null;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	private ITxStream<? extends ITxEvent> stream;
 | 
						private IWaveform stream;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	private ObservableList<AttributeNameBean> attrNames = new WritableList<AttributeNameBean>();
 | 
						private ObservableList<AttributeNameBean> attrNames = new WritableList<AttributeNameBean>();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -121,11 +123,14 @@ public class TransactionList extends Composite {
 | 
				
			|||||||
		searchPropComboViewer.setContentProvider(new ObservableListContentProvider<AttributeNameBean>());
 | 
							searchPropComboViewer.setContentProvider(new ObservableListContentProvider<AttributeNameBean>());
 | 
				
			||||||
		searchPropComboViewer.setInput(attrNames);
 | 
							searchPropComboViewer.setInput(attrNames);
 | 
				
			||||||
		Combo searchPropCombo = searchPropComboViewer.getCombo();
 | 
							Combo searchPropCombo = searchPropComboViewer.getCombo();
 | 
				
			||||||
		searchPropCombo.setLayoutData(new GridData(SWT.LEFT, SWT.FILL, false, false, 1, 1));
 | 
							GridData gd_searchProp = new GridData(SWT.LEFT, SWT.FILL, false, false, 1, 1);
 | 
				
			||||||
 | 
							gd_searchProp.widthHint=100;
 | 
				
			||||||
 | 
							searchPropCombo.setLayoutData(gd_searchProp);
 | 
				
			||||||
		searchPropCombo.addSelectionListener(new SelectionListener() {
 | 
							searchPropCombo.addSelectionListener(new SelectionListener() {
 | 
				
			||||||
			@Override
 | 
								@Override
 | 
				
			||||||
			public void widgetSelected(SelectionEvent e) {
 | 
								public void widgetSelected(SelectionEvent e) {
 | 
				
			||||||
				int idx = searchPropCombo.getSelectionIndex();
 | 
									int idx = searchPropCombo.getSelectionIndex();
 | 
				
			||||||
 | 
									if(idx<0) return;
 | 
				
			||||||
				AttributeNameBean sel = attrNames.get(idx);
 | 
									AttributeNameBean sel = attrNames.get(idx);
 | 
				
			||||||
				txFilter.setSearchProp(sel.getName(), sel.getType());
 | 
									txFilter.setSearchProp(sel.getName(), sel.getType());
 | 
				
			||||||
				tableViewer.refresh();
 | 
									tableViewer.refresh();
 | 
				
			||||||
@@ -133,6 +138,7 @@ public class TransactionList extends Composite {
 | 
				
			|||||||
			@Override
 | 
								@Override
 | 
				
			||||||
			public void widgetDefaultSelected(SelectionEvent e) { 
 | 
								public void widgetDefaultSelected(SelectionEvent e) { 
 | 
				
			||||||
				int idx = searchPropCombo.getSelectionIndex();
 | 
									int idx = searchPropCombo.getSelectionIndex();
 | 
				
			||||||
 | 
									if(idx<0) return;
 | 
				
			||||||
				AttributeNameBean sel = attrNames.get(idx);
 | 
									AttributeNameBean sel = attrNames.get(idx);
 | 
				
			||||||
				txFilter.setSearchProp(sel.getName(), sel.getType());
 | 
									txFilter.setSearchProp(sel.getName(), sel.getType());
 | 
				
			||||||
				tableViewer.refresh();
 | 
									tableViewer.refresh();
 | 
				
			||||||
@@ -166,11 +172,14 @@ public class TransactionList extends Composite {
 | 
				
			|||||||
		viewPropComboViewer.setContentProvider(new ObservableListContentProvider<AttributeNameBean>());
 | 
							viewPropComboViewer.setContentProvider(new ObservableListContentProvider<AttributeNameBean>());
 | 
				
			||||||
		viewPropComboViewer.setInput(attrNames);
 | 
							viewPropComboViewer.setInput(attrNames);
 | 
				
			||||||
		Combo viewPropCombo = viewPropComboViewer.getCombo();
 | 
							Combo viewPropCombo = viewPropComboViewer.getCombo();
 | 
				
			||||||
		viewPropCombo.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1));
 | 
							GridData gd_viewProp = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
 | 
				
			||||||
 | 
							gd_viewProp.widthHint=100;
 | 
				
			||||||
 | 
							viewPropCombo.setLayoutData(gd_viewProp);
 | 
				
			||||||
		viewPropCombo.addSelectionListener(new SelectionListener() {
 | 
							viewPropCombo.addSelectionListener(new SelectionListener() {
 | 
				
			||||||
			@Override
 | 
								@Override
 | 
				
			||||||
			public void widgetSelected(SelectionEvent e) {
 | 
								public void widgetSelected(SelectionEvent e) {
 | 
				
			||||||
				int idx = viewPropCombo.getSelectionIndex();
 | 
									int idx = viewPropCombo.getSelectionIndex();
 | 
				
			||||||
 | 
									if(idx<0) return;
 | 
				
			||||||
				valueLabelProvider.setShowProp(attrNames.get(idx).getName());
 | 
									valueLabelProvider.setShowProp(attrNames.get(idx).getName());
 | 
				
			||||||
				tableViewer.refresh(true);
 | 
									tableViewer.refresh(true);
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
@@ -238,11 +247,11 @@ public class TransactionList extends Composite {
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	public void setInput(TrackEntry trackEntry) {
 | 
						public void setInput(TrackEntry trackEntry) {
 | 
				
			||||||
		if(trackEntry==null || !trackEntry.isStream()) {
 | 
							if(trackEntry==null || trackEntry.waveform.getType()!=WaveformType.TRANSACTION) {
 | 
				
			||||||
			attrNames.clear();
 | 
								attrNames.clear();
 | 
				
			||||||
			tableViewer.setInput(emptyList);
 | 
								tableViewer.setInput(emptyList);
 | 
				
			||||||
		} else { 
 | 
							} else { 
 | 
				
			||||||
			stream=trackEntry.getStream();
 | 
								stream=trackEntry.waveform;
 | 
				
			||||||
			tableViewer.setInput(emptyList);
 | 
								tableViewer.setInput(emptyList);
 | 
				
			||||||
			new Thread() {
 | 
								new Thread() {
 | 
				
			||||||
				private ConcurrentHashMap<String, DataType> propNames=new ConcurrentHashMap<String, DataType>();
 | 
									private ConcurrentHashMap<String, DataType> propNames=new ConcurrentHashMap<String, DataType>();
 | 
				
			||||||
@@ -255,11 +264,12 @@ public class TransactionList extends Composite {
 | 
				
			|||||||
				}
 | 
									}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
				public void run() {
 | 
									public void run() {
 | 
				
			||||||
					eventList = stream.getEvents().values().parallelStream()
 | 
										Collection<IEvent[]> values = stream.getEvents().values();
 | 
				
			||||||
 | 
										eventList = values.parallelStream().map(Arrays::asList)
 | 
				
			||||||
							.flatMap(List::stream)
 | 
												.flatMap(List::stream)
 | 
				
			||||||
							.filter(evt -> evt.getType()==Type.BEGIN)
 | 
												.filter(evt -> evt.getKind()==EventKind.BEGIN)
 | 
				
			||||||
							.map(evt-> {
 | 
												.map(evt-> {
 | 
				
			||||||
								ITx tx = evt.getTransaction();
 | 
													ITx tx = ((ITxEvent)evt).getTransaction();
 | 
				
			||||||
								for(ITxAttribute attr: tx.getAttributes()) {
 | 
													for(ITxAttribute attr: tx.getAttributes()) {
 | 
				
			||||||
									propNames.put(attr.getName(), attr.getDataType());
 | 
														propNames.put(attr.getName(), attr.getDataType());
 | 
				
			||||||
								}
 | 
													}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -0,0 +1,142 @@
 | 
				
			|||||||
 | 
					package com.minres.scviewer.e4.application.parts;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import java.util.HashMap;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import org.eclipse.core.runtime.preferences.DefaultScope;
 | 
				
			||||||
 | 
					import org.eclipse.core.runtime.preferences.IEclipsePreferences;
 | 
				
			||||||
 | 
					import org.eclipse.jface.resource.StringConverter;
 | 
				
			||||||
 | 
					import org.eclipse.swt.SWT;
 | 
				
			||||||
 | 
					import org.eclipse.swt.graphics.Color;
 | 
				
			||||||
 | 
					import org.eclipse.swt.graphics.Font;
 | 
				
			||||||
 | 
					import org.eclipse.swt.graphics.RGB;
 | 
				
			||||||
 | 
					import org.eclipse.swt.widgets.Composite;
 | 
				
			||||||
 | 
					import org.eclipse.swt.widgets.Display;
 | 
				
			||||||
 | 
					import org.eclipse.wb.swt.SWTResourceManager;
 | 
				
			||||||
 | 
					import org.osgi.service.prefs.Preferences;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import com.minres.scviewer.database.ui.IWaveformStyleProvider;
 | 
				
			||||||
 | 
					import com.minres.scviewer.database.ui.WaveformColors;
 | 
				
			||||||
 | 
					import com.minres.scviewer.e4.application.preferences.PreferenceConstants;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public class WaveformStyleProvider implements IWaveformStyleProvider {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						private Composite parent;
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						private Font nameFont;
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						private Color[] colors = new Color[WaveformColors.values().length];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						// list of random colors
 | 
				
			||||||
 | 
						private static Color[][] randomColors;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						private int trackHeigth=25;
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						public WaveformStyleProvider() {
 | 
				
			||||||
 | 
							setupDefaults();
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						private void setupDefaults() {
 | 
				
			||||||
 | 
							Display display = Display.getCurrent();
 | 
				
			||||||
 | 
							
 | 
				
			||||||
 | 
							nameFont = display.getSystemFont();
 | 
				
			||||||
 | 
					        colors[WaveformColors.LINE.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_RED);
 | 
				
			||||||
 | 
					        colors[WaveformColors.LINE_HIGHLITE.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_CYAN);
 | 
				
			||||||
 | 
					        colors[WaveformColors.TRACK_BG_EVEN.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_BLACK);
 | 
				
			||||||
 | 
					        colors[WaveformColors.TRACK_BG_ODD.ordinal()] = SWTResourceManager.getColor(40, 40, 40);
 | 
				
			||||||
 | 
					        colors[WaveformColors.TRACK_BG_HIGHLITE.ordinal()] = SWTResourceManager.getColor(40, 40, 80);
 | 
				
			||||||
 | 
					        colors[WaveformColors.TX_BG.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_GREEN);
 | 
				
			||||||
 | 
					        colors[WaveformColors.TX_BG_HIGHLITE.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_DARK_GREEN);
 | 
				
			||||||
 | 
					        colors[WaveformColors.TX_BORDER.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_RED);
 | 
				
			||||||
 | 
					        colors[WaveformColors.SIGNAL0.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_GREEN);
 | 
				
			||||||
 | 
					        colors[WaveformColors.SIGNAL1.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_GREEN);
 | 
				
			||||||
 | 
					        colors[WaveformColors.SIGNALZ.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_DARK_YELLOW);
 | 
				
			||||||
 | 
					        colors[WaveformColors.SIGNALX.ordinal()] = SWTResourceManager.getColor(255,  51,  51);
 | 
				
			||||||
 | 
					        colors[WaveformColors.SIGNALU.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_YELLOW);
 | 
				
			||||||
 | 
					        colors[WaveformColors.SIGNAL_TEXT.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_WHITE);
 | 
				
			||||||
 | 
					        colors[WaveformColors.SIGNAL_REAL.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_YELLOW);
 | 
				
			||||||
 | 
					        colors[WaveformColors.SIGNAL_NAN.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_RED);
 | 
				
			||||||
 | 
					        colors[WaveformColors.CURSOR.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_RED);
 | 
				
			||||||
 | 
					        colors[WaveformColors.CURSOR_DRAG.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_GRAY);
 | 
				
			||||||
 | 
					        colors[WaveformColors.CURSOR_TEXT.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_WHITE);
 | 
				
			||||||
 | 
					        colors[WaveformColors.MARKER.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_DARK_GRAY);
 | 
				
			||||||
 | 
					        colors[WaveformColors.MARKER_TEXT.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_WHITE);
 | 
				
			||||||
 | 
					        colors[WaveformColors.REL_ARROW.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_MAGENTA);
 | 
				
			||||||
 | 
					        colors[WaveformColors.REL_ARROW_HIGHLITE.ordinal()] = SWTResourceManager.getColor(255, 128, 255);
 | 
				
			||||||
 | 
							randomColors = new Color[][] {
 | 
				
			||||||
 | 
									{ SWTResourceManager.getColor( 170,  66,  37 ), SWTResourceManager.getColor( 190,  66,  37 ) },
 | 
				
			||||||
 | 
									{ SWTResourceManager.getColor(  96,  74, 110 ), SWTResourceManager.getColor(  96,  74, 130 ) },
 | 
				
			||||||
 | 
									{ SWTResourceManager.getColor( 133, 105, 128 ), SWTResourceManager.getColor( 153, 105, 128 ) },
 | 
				
			||||||
 | 
									{ SWTResourceManager.getColor(   0, 126, 135 ), SWTResourceManager.getColor(   0, 126, 155 ) },
 | 
				
			||||||
 | 
									{ SWTResourceManager.getColor( 243, 146,  75 ), SWTResourceManager.getColor( 255, 146,  75 ) },
 | 
				
			||||||
 | 
									{ SWTResourceManager.getColor( 206, 135, 163 ), SWTResourceManager.getColor( 226, 135, 163 ) },
 | 
				
			||||||
 | 
									{ SWTResourceManager.getColor( 124, 103,  74 ), SWTResourceManager.getColor( 144, 103,  74 ) },
 | 
				
			||||||
 | 
									{ SWTResourceManager.getColor( 194, 187, 169 ), SWTResourceManager.getColor( 214, 187, 169 ) },
 | 
				
			||||||
 | 
									{ SWTResourceManager.getColor( 104,  73,  71 ), SWTResourceManager.getColor( 124,  73,  71 ) },
 | 
				
			||||||
 | 
									{ SWTResourceManager.getColor(  75, 196, 213 ), SWTResourceManager.getColor(  75, 196, 233 ) },
 | 
				
			||||||
 | 
									{ SWTResourceManager.getColor( 206, 232, 229 ), SWTResourceManager.getColor( 206, 252, 229 ) },
 | 
				
			||||||
 | 
									{ SWTResourceManager.getColor( 169, 221, 199 ), SWTResourceManager.getColor( 169, 241, 199 ) },
 | 
				
			||||||
 | 
									{ SWTResourceManager.getColor( 100, 165, 197 ), SWTResourceManager.getColor( 100, 165, 217 ) },
 | 
				
			||||||
 | 
									{ SWTResourceManager.getColor( 150, 147, 178 ), SWTResourceManager.getColor( 150, 147, 198 ) },
 | 
				
			||||||
 | 
									{ SWTResourceManager.getColor( 200, 222, 182 ), SWTResourceManager.getColor( 200, 242, 182 ) },
 | 
				
			||||||
 | 
									{ SWTResourceManager.getColor( 147, 208, 197 ), SWTResourceManager.getColor( 147, 228, 197 ) }
 | 
				
			||||||
 | 
							};
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
						public WaveformStyleProvider(IEclipsePreferences store) {
 | 
				
			||||||
 | 
							setupDefaults();
 | 
				
			||||||
 | 
							Preferences defaultPrefs= store.parent().parent().node("/"+DefaultScope.SCOPE+"/"+PreferenceConstants.PREFERENCES_SCOPE);
 | 
				
			||||||
 | 
							HashMap<WaveformColors, RGB> colorPref = new HashMap<>();
 | 
				
			||||||
 | 
							for (WaveformColors c : WaveformColors.values()) {
 | 
				
			||||||
 | 
								String key = c.name() + "_COLOR";
 | 
				
			||||||
 | 
								String prefValue = store.get(key, defaultPrefs.get(key,  "")); //$NON-NLS-1$
 | 
				
			||||||
 | 
								RGB rgb = StringConverter.asRGB(prefValue);
 | 
				
			||||||
 | 
								colorPref.put(c, rgb);
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							trackHeigth = store.getInt(PreferenceConstants.TRACK_HEIGHT, defaultPrefs.getInt(PreferenceConstants.TRACK_HEIGHT,  25)); //$NON-NLS-1$
 | 
				
			||||||
 | 
						}	
 | 
				
			||||||
 | 
						/** 
 | 
				
			||||||
 | 
						 * needs redraw() afterwards
 | 
				
			||||||
 | 
						 * @param colourMap
 | 
				
			||||||
 | 
						 */
 | 
				
			||||||
 | 
					    public void initColors(HashMap<WaveformColors, RGB> colourMap) {
 | 
				
			||||||
 | 
					        Display d = parent.getDisplay();
 | 
				
			||||||
 | 
					        if (colourMap != null) {
 | 
				
			||||||
 | 
					            for (WaveformColors c : WaveformColors.values()) {
 | 
				
			||||||
 | 
					                if (colourMap.containsKey(c))
 | 
				
			||||||
 | 
					                    colors[c.ordinal()] = new Color(d, colourMap.get(c));
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						@Override
 | 
				
			||||||
 | 
						public Font getNameFont() {
 | 
				
			||||||
 | 
							return nameFont;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						@Override
 | 
				
			||||||
 | 
						public Font getNameFontHighlite() {
 | 
				
			||||||
 | 
							return nameFont;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						@Override
 | 
				
			||||||
 | 
						public int getTrackHeight() {
 | 
				
			||||||
 | 
							return trackHeigth;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						@Override
 | 
				
			||||||
 | 
						public Color getColor(WaveformColors type) {
 | 
				
			||||||
 | 
							return colors[type.ordinal()];
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						@Override
 | 
				
			||||||
 | 
						public Color[] computeColor (String streamValue) {
 | 
				
			||||||
 | 
							Color[] result = new Color[] {SWTResourceManager.getColor( 200,0,0), SWTResourceManager.getColor( 255,0,0)};
 | 
				
			||||||
 | 
							// assign "random" color here, one name always results in the same color!
 | 
				
			||||||
 | 
							if( streamValue!=null && randomColors.length > 0 ) {
 | 
				
			||||||
 | 
								int index = Math.abs(streamValue.hashCode()) % randomColors.length;
 | 
				
			||||||
 | 
								result[0] = randomColors[index][0];
 | 
				
			||||||
 | 
								result[1] = randomColors[index][1];
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							return result;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@@ -37,7 +37,6 @@ import org.eclipse.core.runtime.OperationCanceledException;
 | 
				
			|||||||
import org.eclipse.core.runtime.Status;
 | 
					import org.eclipse.core.runtime.Status;
 | 
				
			||||||
import org.eclipse.core.runtime.jobs.Job;
 | 
					import org.eclipse.core.runtime.jobs.Job;
 | 
				
			||||||
import org.eclipse.core.runtime.jobs.JobGroup;
 | 
					import org.eclipse.core.runtime.jobs.JobGroup;
 | 
				
			||||||
import org.eclipse.core.runtime.preferences.DefaultScope;
 | 
					 | 
				
			||||||
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
 | 
					import org.eclipse.core.runtime.preferences.IEclipsePreferences;
 | 
				
			||||||
import org.eclipse.core.runtime.preferences.IEclipsePreferences.IPreferenceChangeListener;
 | 
					import org.eclipse.core.runtime.preferences.IEclipsePreferences.IPreferenceChangeListener;
 | 
				
			||||||
import org.eclipse.core.runtime.preferences.IEclipsePreferences.PreferenceChangeEvent;
 | 
					import org.eclipse.core.runtime.preferences.IEclipsePreferences.PreferenceChangeEvent;
 | 
				
			||||||
@@ -55,15 +54,12 @@ import org.eclipse.e4.ui.services.EMenuService;
 | 
				
			|||||||
import org.eclipse.e4.ui.workbench.modeling.EPartService;
 | 
					import org.eclipse.e4.ui.workbench.modeling.EPartService;
 | 
				
			||||||
import org.eclipse.e4.ui.workbench.modeling.ESelectionService;
 | 
					import org.eclipse.e4.ui.workbench.modeling.ESelectionService;
 | 
				
			||||||
import org.eclipse.jface.dialogs.MessageDialog;
 | 
					import org.eclipse.jface.dialogs.MessageDialog;
 | 
				
			||||||
import org.eclipse.jface.resource.StringConverter;
 | 
					 | 
				
			||||||
import org.eclipse.jface.viewers.ISelection;
 | 
					import org.eclipse.jface.viewers.ISelection;
 | 
				
			||||||
import org.eclipse.jface.viewers.ISelectionChangedListener;
 | 
					import org.eclipse.jface.viewers.ISelectionChangedListener;
 | 
				
			||||||
import org.eclipse.jface.viewers.IStructuredSelection;
 | 
					import org.eclipse.jface.viewers.IStructuredSelection;
 | 
				
			||||||
import org.eclipse.jface.viewers.SelectionChangedEvent;
 | 
					import org.eclipse.jface.viewers.SelectionChangedEvent;
 | 
				
			||||||
import org.eclipse.jface.viewers.StructuredSelection;
 | 
					import org.eclipse.jface.viewers.StructuredSelection;
 | 
				
			||||||
import org.eclipse.swt.SWT;
 | 
					import org.eclipse.swt.SWT;
 | 
				
			||||||
import org.eclipse.swt.custom.CTabFolder;
 | 
					 | 
				
			||||||
import org.eclipse.swt.custom.CTabItem;
 | 
					 | 
				
			||||||
import org.eclipse.swt.custom.SashForm;
 | 
					import org.eclipse.swt.custom.SashForm;
 | 
				
			||||||
import org.eclipse.swt.events.DisposeEvent;
 | 
					import org.eclipse.swt.events.DisposeEvent;
 | 
				
			||||||
import org.eclipse.swt.events.DisposeListener;
 | 
					import org.eclipse.swt.events.DisposeListener;
 | 
				
			||||||
@@ -72,7 +68,6 @@ import org.eclipse.swt.events.PaintEvent;
 | 
				
			|||||||
import org.eclipse.swt.events.PaintListener;
 | 
					import org.eclipse.swt.events.PaintListener;
 | 
				
			||||||
import org.eclipse.swt.graphics.Font;
 | 
					import org.eclipse.swt.graphics.Font;
 | 
				
			||||||
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.layout.FillLayout;
 | 
					import org.eclipse.swt.layout.FillLayout;
 | 
				
			||||||
import org.eclipse.swt.layout.GridData;
 | 
					import org.eclipse.swt.layout.GridData;
 | 
				
			||||||
@@ -85,24 +80,23 @@ import org.eclipse.swt.widgets.Table;
 | 
				
			|||||||
import org.eclipse.swt.widgets.TableColumn;
 | 
					import org.eclipse.swt.widgets.TableColumn;
 | 
				
			||||||
import org.eclipse.swt.widgets.TableItem;
 | 
					import org.eclipse.swt.widgets.TableItem;
 | 
				
			||||||
import org.eclipse.swt.widgets.Widget;
 | 
					import org.eclipse.swt.widgets.Widget;
 | 
				
			||||||
import org.osgi.service.prefs.Preferences;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
import com.minres.scviewer.database.DataType;
 | 
					import com.minres.scviewer.database.DataType;
 | 
				
			||||||
import com.minres.scviewer.database.ITx;
 | 
					import com.minres.scviewer.database.IEvent;
 | 
				
			||||||
import com.minres.scviewer.database.ITxAttribute;
 | 
					 | 
				
			||||||
import com.minres.scviewer.database.ITxEvent;
 | 
					 | 
				
			||||||
import com.minres.scviewer.database.ITxRelation;
 | 
					 | 
				
			||||||
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.IWaveformDbFactory;
 | 
					import com.minres.scviewer.database.IWaveformDbFactory;
 | 
				
			||||||
import com.minres.scviewer.database.RelationType;
 | 
					import com.minres.scviewer.database.RelationType;
 | 
				
			||||||
 | 
					import com.minres.scviewer.database.tx.ITx;
 | 
				
			||||||
 | 
					import com.minres.scviewer.database.tx.ITxAttribute;
 | 
				
			||||||
 | 
					import com.minres.scviewer.database.tx.ITxEvent;
 | 
				
			||||||
 | 
					import com.minres.scviewer.database.tx.ITxRelation;
 | 
				
			||||||
import com.minres.scviewer.database.ui.GotoDirection;
 | 
					import com.minres.scviewer.database.ui.GotoDirection;
 | 
				
			||||||
import com.minres.scviewer.database.ui.ICursor;
 | 
					import com.minres.scviewer.database.ui.ICursor;
 | 
				
			||||||
import com.minres.scviewer.database.ui.IWaveformView;
 | 
					import com.minres.scviewer.database.ui.IWaveformView;
 | 
				
			||||||
import com.minres.scviewer.database.ui.TrackEntry;
 | 
					import com.minres.scviewer.database.ui.TrackEntry;
 | 
				
			||||||
import com.minres.scviewer.database.ui.TrackEntry.ValueDisplay;
 | 
					import com.minres.scviewer.database.ui.TrackEntry.ValueDisplay;
 | 
				
			||||||
import com.minres.scviewer.database.ui.TrackEntry.WaveDisplay;
 | 
					import com.minres.scviewer.database.ui.TrackEntry.WaveDisplay;
 | 
				
			||||||
import com.minres.scviewer.database.ui.WaveformColors;
 | 
					 | 
				
			||||||
import com.minres.scviewer.database.ui.swt.Constants;
 | 
					import com.minres.scviewer.database.ui.swt.Constants;
 | 
				
			||||||
import com.minres.scviewer.database.ui.swt.ToolTipContentProvider;
 | 
					import com.minres.scviewer.database.ui.swt.ToolTipContentProvider;
 | 
				
			||||||
import com.minres.scviewer.database.ui.swt.ToolTipHelpTextProvider;
 | 
					import com.minres.scviewer.database.ui.swt.ToolTipHelpTextProvider;
 | 
				
			||||||
@@ -302,7 +296,6 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
 | 
				
			|||||||
		transactionList = ContextInjectionFactory.make(TransactionListView.class, ctx);
 | 
							transactionList = ContextInjectionFactory.make(TransactionListView.class, ctx);
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
		waveformPane.setMaxTime(0);
 | 
							waveformPane.setMaxTime(0);
 | 
				
			||||||
		setupColors();
 | 
					 | 
				
			||||||
		//set selection to empty selection when opening a new waveformPane
 | 
							//set selection to empty selection when opening a new waveformPane
 | 
				
			||||||
		selectionService.setSelection(new StructuredSelection());
 | 
							selectionService.setSelection(new StructuredSelection());
 | 
				
			||||||
		
 | 
							
 | 
				
			||||||
@@ -511,6 +504,7 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
 | 
				
			|||||||
				return false;
 | 
									return false;
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		});
 | 
							});
 | 
				
			||||||
 | 
							waveformPane.setStyleProvider(new WaveformStyleProvider(store));
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	@Inject
 | 
						@Inject
 | 
				
			||||||
@@ -543,23 +537,7 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
 | 
				
			|||||||
	@Override
 | 
						@Override
 | 
				
			||||||
	public void preferenceChange(PreferenceChangeEvent event) {
 | 
						public void preferenceChange(PreferenceChangeEvent event) {
 | 
				
			||||||
		if (!PreferenceConstants.DATABASE_RELOAD.equals(event.getKey()) && !PreferenceConstants.SHOW_HOVER.equals(event.getKey())){
 | 
							if (!PreferenceConstants.DATABASE_RELOAD.equals(event.getKey()) && !PreferenceConstants.SHOW_HOVER.equals(event.getKey())){
 | 
				
			||||||
			setupColors();
 | 
								waveformPane.setStyleProvider(new WaveformStyleProvider(store));		}
 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	/**
 | 
					 | 
				
			||||||
	 * Setup colors.
 | 
					 | 
				
			||||||
	 */
 | 
					 | 
				
			||||||
	protected void setupColors() {
 | 
					 | 
				
			||||||
		Preferences defaultPrefs= store.parent().parent().node("/"+DefaultScope.SCOPE+"/"+PreferenceConstants.PREFERENCES_SCOPE);
 | 
					 | 
				
			||||||
		HashMap<WaveformColors, RGB> colorPref = new HashMap<>();
 | 
					 | 
				
			||||||
		for (WaveformColors c : WaveformColors.values()) {
 | 
					 | 
				
			||||||
			String key = c.name() + "_COLOR";
 | 
					 | 
				
			||||||
			String prefValue = store.get(key, defaultPrefs.get(key,  "")); //$NON-NLS-1$
 | 
					 | 
				
			||||||
			RGB rgb = StringConverter.asRGB(prefValue);
 | 
					 | 
				
			||||||
			colorPref.put(c, rgb);
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
		waveformPane.setColors(colorPref);
 | 
					 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	class DbLoadJob extends Job {
 | 
						class DbLoadJob extends Job {
 | 
				
			||||||
@@ -790,7 +768,7 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
 | 
				
			|||||||
				// get transaction id
 | 
									// get transaction id
 | 
				
			||||||
				persistedState.put(SELECTED_TX_ID, Long.toString(tx.getId()));
 | 
									persistedState.put(SELECTED_TX_ID, Long.toString(tx.getId()));
 | 
				
			||||||
				//get TrackEntry name
 | 
									//get TrackEntry name
 | 
				
			||||||
				String name = te.getStream().getFullName();
 | 
									String name = te.waveform.getFullName();
 | 
				
			||||||
				persistedState.put(SELECTED_TRACKENTRY_NAME, name);
 | 
									persistedState.put(SELECTED_TRACKENTRY_NAME, name);
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
@@ -823,7 +801,7 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
 | 
				
			|||||||
		for (int i = 0; i < waves; i++) {
 | 
							for (int i = 0; i < waves; i++) {
 | 
				
			||||||
			IWaveform waveform = database.getStreamByName(state.get(SHOWN_WAVEFORM + i));
 | 
								IWaveform waveform = database.getStreamByName(state.get(SHOWN_WAVEFORM + i));
 | 
				
			||||||
			if (waveform != null) {
 | 
								if (waveform != null) {
 | 
				
			||||||
				TrackEntry t = new TrackEntry(waveform);
 | 
									TrackEntry t = waveformPane.addWaveform(waveform, -1);
 | 
				
			||||||
				//check if t is selected
 | 
									//check if t is selected
 | 
				
			||||||
				boolean isSelected = Boolean.valueOf(state.get(SHOWN_WAVEFORM + i + WAVEFORM_SELECTED));
 | 
									boolean isSelected = Boolean.valueOf(state.get(SHOWN_WAVEFORM + i + WAVEFORM_SELECTED));
 | 
				
			||||||
				if(isSelected) {
 | 
									if(isSelected) {
 | 
				
			||||||
@@ -840,8 +818,6 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
 | 
				
			|||||||
					t.waveDisplay=WaveDisplay.valueOf(s);
 | 
										t.waveDisplay=WaveDisplay.valueOf(s);
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		if (res.size() > 0)
 | 
					 | 
				
			||||||
			waveformPane.getStreamList().addAll(res);
 | 
					 | 
				
			||||||
		Integer cursorLength = state.containsKey(SHOWN_CURSOR+"S")?Integer.parseInt(state.get(SHOWN_CURSOR + "S")):0; //$NON-NLS-1$ //$NON-NLS-2$
 | 
							Integer cursorLength = state.containsKey(SHOWN_CURSOR+"S")?Integer.parseInt(state.get(SHOWN_CURSOR + "S")):0; //$NON-NLS-1$ //$NON-NLS-2$
 | 
				
			||||||
		List<ICursor> cursors = waveformPane.getCursorList();
 | 
							List<ICursor> cursors = waveformPane.getCursorList();
 | 
				
			||||||
		if (cursorLength == cursors.size()) {
 | 
							if (cursorLength == cursors.size()) {
 | 
				
			||||||
@@ -874,11 +850,11 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
 | 
				
			|||||||
					if(te.waveform.getFullName().compareTo(trackentryName)==0) {
 | 
										if(te.waveform.getFullName().compareTo(trackentryName)==0) {
 | 
				
			||||||
						boolean found = false;
 | 
											boolean found = false;
 | 
				
			||||||
						// TODO: find transaction by time? To avoid 3x for-loop
 | 
											// TODO: find transaction by time? To avoid 3x for-loop
 | 
				
			||||||
						for( List<ITxEvent> lev : te.getStream().getEvents().values() ) {
 | 
											for( IEvent[] lev : te.waveform.getEvents().values() ) {
 | 
				
			||||||
							if(lev == null) continue;
 | 
												if(lev == null) continue;
 | 
				
			||||||
							for(ITxEvent itxe : lev) {
 | 
												for(IEvent itxe : lev) {
 | 
				
			||||||
								if(itxe == null) continue;
 | 
													if(itxe == null || !(itxe instanceof ITxEvent)) continue;
 | 
				
			||||||
								ITx itx = itxe.getTransaction();
 | 
													ITx itx = ((ITxEvent)itxe).getTransaction();
 | 
				
			||||||
								if(itx.getId() == txId) {
 | 
													if(itx.getId() == txId) {
 | 
				
			||||||
									found = true;
 | 
														found = true;
 | 
				
			||||||
									ArrayList<Object> selectionList = new ArrayList<Object>();
 | 
														ArrayList<Object> selectionList = new ArrayList<Object>();
 | 
				
			||||||
@@ -1011,12 +987,10 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
 | 
				
			|||||||
	 * @param insert the insert
 | 
						 * @param insert the insert
 | 
				
			||||||
	 */
 | 
						 */
 | 
				
			||||||
	public void addStreamsToList(IWaveform[] iWaveforms, boolean insert) {
 | 
						public void addStreamsToList(IWaveform[] iWaveforms, boolean insert) {
 | 
				
			||||||
		List<TrackEntry> streams = new LinkedList<>();
 | 
					 | 
				
			||||||
		for (IWaveform stream : iWaveforms)
 | 
					 | 
				
			||||||
			streams.add(new TrackEntry(stream));
 | 
					 | 
				
			||||||
		IStructuredSelection selection = (IStructuredSelection) waveformPane.getSelection();
 | 
							IStructuredSelection selection = (IStructuredSelection) waveformPane.getSelection();
 | 
				
			||||||
		if (selection.size() == 0) {
 | 
							if (selection.size() == 0) {
 | 
				
			||||||
			waveformPane.getStreamList().addAll(streams);
 | 
								for (IWaveform waveform : iWaveforms)
 | 
				
			||||||
 | 
									waveformPane.addWaveform(waveform, -1);
 | 
				
			||||||
		} else {
 | 
							} else {
 | 
				
			||||||
			Object first = selection.getFirstElement();
 | 
								Object first = selection.getFirstElement();
 | 
				
			||||||
			if(first instanceof ITx) {
 | 
								if(first instanceof ITx) {
 | 
				
			||||||
@@ -1024,17 +998,21 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
 | 
				
			|||||||
				TrackEntry trackEntry = waveformPane.getEntryForStream(stream);
 | 
									TrackEntry trackEntry = waveformPane.getEntryForStream(stream);
 | 
				
			||||||
				if (insert) {
 | 
									if (insert) {
 | 
				
			||||||
					int index = waveformPane.getStreamList().indexOf(trackEntry);
 | 
										int index = waveformPane.getStreamList().indexOf(trackEntry);
 | 
				
			||||||
					waveformPane.getStreamList().addAll(index, streams);
 | 
										for (IWaveform waveform : iWaveforms)
 | 
				
			||||||
 | 
											waveformPane.addWaveform(waveform, index++);
 | 
				
			||||||
				} else {
 | 
									} else {
 | 
				
			||||||
					waveformPane.getStreamList().addAll(streams);
 | 
										for (IWaveform waveform : iWaveforms)
 | 
				
			||||||
 | 
											waveformPane.addWaveform(waveform, -1);
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
			} else if(first instanceof TrackEntry) {
 | 
								} else if(first instanceof TrackEntry) {
 | 
				
			||||||
				TrackEntry trackEntry = (TrackEntry) first;
 | 
									TrackEntry trackEntry = (TrackEntry) first;
 | 
				
			||||||
				if (insert) {
 | 
									if (insert) {
 | 
				
			||||||
					int index = waveformPane.getStreamList().indexOf(trackEntry);
 | 
										int index = waveformPane.getStreamList().indexOf(trackEntry);
 | 
				
			||||||
					waveformPane.getStreamList().addAll(index, streams);
 | 
										for (IWaveform waveform : iWaveforms)
 | 
				
			||||||
 | 
											waveformPane.addWaveform(waveform, index++);
 | 
				
			||||||
				} else {
 | 
									} else {
 | 
				
			||||||
					waveformPane.getStreamList().addAll(streams);
 | 
										for (IWaveform waveform : iWaveforms)
 | 
				
			||||||
 | 
											waveformPane.addWaveform(waveform, -1);
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -1115,7 +1093,7 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
 | 
				
			|||||||
				
 | 
									
 | 
				
			||||||
    	boolean foundZoom=false;
 | 
					    	boolean foundZoom=false;
 | 
				
			||||||
		//try to find existing zoomlevel where scaleFactor*clientAreaWidth >= maxTime, if one is found set it as new zoomlevel
 | 
							//try to find existing zoomlevel where scaleFactor*clientAreaWidth >= maxTime, if one is found set it as new zoomlevel
 | 
				
			||||||
		for (int level=0; level<Constants.unitMultiplier.length*Constants.unitString.length; level++){
 | 
							for (int level=0; level<Constants.UNIT_MULTIPLIER.length*Constants.UNIT_STRING.length; level++){
 | 
				
			||||||
			long scaleFactor = (long) Math.pow(10, level/2);
 | 
								long scaleFactor = (long) Math.pow(10, level/2);
 | 
				
			||||||
		    if(level%2==1) scaleFactor*=3;
 | 
							    if(level%2==1) scaleFactor*=3;
 | 
				
			||||||
		    if(scaleFactor*clientAreaWidth >= maxTime) {
 | 
							    if(scaleFactor*clientAreaWidth >= maxTime) {
 | 
				
			||||||
@@ -1125,7 +1103,7 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
 | 
				
			|||||||
		    }
 | 
							    }
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		//if no zoom level is found, set biggest one available
 | 
							//if no zoom level is found, set biggest one available
 | 
				
			||||||
		if(!foundZoom) setZoomLevel(Constants.unitMultiplier.length*Constants.unitString.length-1);
 | 
							if(!foundZoom) setZoomLevel(Constants.UNIT_MULTIPLIER.length*Constants.UNIT_STRING.length-1);
 | 
				
			||||||
				
 | 
									
 | 
				
			||||||
		updateAll();
 | 
							updateAll();
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -5,8 +5,8 @@ import java.util.Vector;
 | 
				
			|||||||
import org.eclipse.jface.viewers.ITreeContentProvider;
 | 
					import org.eclipse.jface.viewers.ITreeContentProvider;
 | 
				
			||||||
import org.eclipse.jface.viewers.Viewer;
 | 
					import org.eclipse.jface.viewers.Viewer;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import com.minres.scviewer.database.ITx;
 | 
					import com.minres.scviewer.database.tx.ITx;
 | 
				
			||||||
import com.minres.scviewer.database.ITxRelation;
 | 
					import com.minres.scviewer.database.tx.ITxRelation;
 | 
				
			||||||
import com.minres.scviewer.e4.application.Messages;
 | 
					import com.minres.scviewer.e4.application.Messages;
 | 
				
			||||||
import com.minres.scviewer.e4.application.parts.WaveformViewer;
 | 
					import com.minres.scviewer.e4.application.parts.WaveformViewer;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -8,9 +8,9 @@ import org.eclipse.jface.viewers.StyledString;
 | 
				
			|||||||
import org.eclipse.jface.viewers.DelegatingStyledCellLabelProvider.IStyledLabelProvider;
 | 
					import org.eclipse.jface.viewers.DelegatingStyledCellLabelProvider.IStyledLabelProvider;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import com.minres.scviewer.database.DataType;
 | 
					import com.minres.scviewer.database.DataType;
 | 
				
			||||||
import com.minres.scviewer.database.ITx;
 | 
					import com.minres.scviewer.database.tx.ITx;
 | 
				
			||||||
import com.minres.scviewer.database.ITxAttribute;
 | 
					import com.minres.scviewer.database.tx.ITxAttribute;
 | 
				
			||||||
import com.minres.scviewer.database.ITxRelation;
 | 
					import com.minres.scviewer.database.tx.ITxRelation;
 | 
				
			||||||
import com.minres.scviewer.e4.application.Messages;
 | 
					import com.minres.scviewer.e4.application.Messages;
 | 
				
			||||||
import com.minres.scviewer.e4.application.parts.WaveformViewer;
 | 
					import com.minres.scviewer.e4.application.parts.WaveformViewer;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -5,7 +5,7 @@ import java.util.Map;
 | 
				
			|||||||
import java.util.TreeMap;
 | 
					import java.util.TreeMap;
 | 
				
			||||||
import java.util.stream.Collectors;
 | 
					import java.util.stream.Collectors;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import com.minres.scviewer.database.ITx;
 | 
					import com.minres.scviewer.database.tx.ITx;
 | 
				
			||||||
import com.minres.scviewer.e4.application.Messages;
 | 
					import com.minres.scviewer.e4.application.Messages;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 
 | 
				
			|||||||
Some files were not shown because too many files have changed in this diff Show More
		Reference in New Issue
	
	Block a user