Compare commits
15 Commits
Author | SHA1 | Date | |
---|---|---|---|
ae3dcb51ad | |||
150c404cdb | |||
5fe8b261ec | |||
f8a177c9e0 | |||
077a6f8011 | |||
8b84f1341b | |||
20824e75c1 | |||
fb283ab668 | |||
dc3df60716 | |||
1cebc2da0a | |||
414030cbd2 | |||
8011585113 | |||
270a004037 | |||
2aa4160400 | |||
c8e416966b |
@ -9,7 +9,6 @@ Import-Package: org.osgi.framework;version="1.3.0"
|
|||||||
Automatic-Module-Name: com.minres.scviewer.database.leveldb
|
Automatic-Module-Name: com.minres.scviewer.database.leveldb
|
||||||
Service-Component: OSGI-INF/*.xml
|
Service-Component: OSGI-INF/*.xml
|
||||||
Require-Bundle: com.minres.scviewer.database;bundle-version="1.0.0",
|
Require-Bundle: com.minres.scviewer.database;bundle-version="1.0.0",
|
||||||
org.eclipse.equinox.util;bundle-version="1.0.500",
|
|
||||||
org.eclipse.equinox.ds;bundle-version="1.4.200",
|
org.eclipse.equinox.ds;bundle-version="1.4.200",
|
||||||
org.eclipse.osgi.services;bundle-version="3.4.0"
|
org.eclipse.osgi.services;bundle-version="3.4.0"
|
||||||
Bundle-ActivationPolicy: lazy
|
Bundle-ActivationPolicy: lazy
|
||||||
|
@ -64,7 +64,7 @@ public class LevelDBLoader implements IWaveformDbLoader {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<IWaveform> getAllWaves() {
|
public Collection<IWaveform> getAllWaves() {
|
||||||
List<IWaveform> streams=new ArrayList<IWaveform>();
|
List<IWaveform> streams=new ArrayList<IWaveform>();
|
||||||
SeekingIterator<String, String> it = levelDb.iterator();
|
SeekingIterator<String, String> it = levelDb.iterator();
|
||||||
it.seek("s~");
|
it.seek("s~");
|
||||||
|
@ -61,7 +61,7 @@ public class SQLiteDbLoader implements IWaveformDbLoader {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<IWaveform> getAllWaves() {
|
public Collection<IWaveform> getAllWaves() {
|
||||||
SQLiteDatabaseSelectHandler<ScvStream> handler = new SQLiteDatabaseSelectHandler<ScvStream>(ScvStream.class, database);
|
SQLiteDatabaseSelectHandler<ScvStream> handler = new SQLiteDatabaseSelectHandler<ScvStream>(ScvStream.class, database);
|
||||||
List<IWaveform> streams=new ArrayList<IWaveform>();
|
List<IWaveform> streams=new ArrayList<IWaveform>();
|
||||||
try {
|
try {
|
||||||
@ -81,6 +81,7 @@ public class SQLiteDbLoader implements IWaveformDbLoader {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean load(IWaveformDb db, File file) throws Exception {
|
public boolean load(IWaveformDb db, File file) throws Exception {
|
||||||
|
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);
|
||||||
|
@ -1,46 +1,104 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
<launchConfiguration type="org.eclipse.pde.ui.JunitLaunchConfig">
|
<launchConfiguration type="org.eclipse.pde.ui.JunitLaunchConfig">
|
||||||
<booleanAttribute key="append.args" value="true"/>
|
<booleanAttribute key="append.args" value="true"/>
|
||||||
<stringAttribute key="application" value="org.eclipse.pde.junit.runtime.coretestapplication"/>
|
<stringAttribute key="application" value="org.eclipse.pde.junit.runtime.coretestapplication"/>
|
||||||
<booleanAttribute key="askclear" value="false"/>
|
<booleanAttribute key="askclear" value="false"/>
|
||||||
<booleanAttribute key="automaticAdd" value="true"/>
|
<booleanAttribute key="automaticAdd" value="true"/>
|
||||||
<booleanAttribute key="automaticValidate" value="false"/>
|
<booleanAttribute key="automaticValidate" value="false"/>
|
||||||
<stringAttribute key="bootstrap" value=""/>
|
<stringAttribute key="bootstrap" value=""/>
|
||||||
<stringAttribute key="checked" value="[NONE]"/>
|
<stringAttribute key="checked" value="[NONE]"/>
|
||||||
<booleanAttribute key="clearConfig" value="true"/>
|
<booleanAttribute key="clearConfig" value="true"/>
|
||||||
<booleanAttribute key="clearws" value="true"/>
|
<booleanAttribute key="clearws" value="true"/>
|
||||||
<booleanAttribute key="clearwslog" value="false"/>
|
<booleanAttribute key="clearwslog" value="false"/>
|
||||||
<stringAttribute key="configLocation" value="${workspace_loc}/.metadata/.plugins/org.eclipse.pde.core/pde-junit"/>
|
<stringAttribute key="configLocation" value="${workspace_loc}/.metadata/.plugins/org.eclipse.pde.core/pde-junit"/>
|
||||||
<booleanAttribute key="default" value="true"/>
|
<booleanAttribute key="default" value="true"/>
|
||||||
<stringAttribute key="deselected_workspace_plugins" value="com.minres.scviewer.e4.application,com.minres.scviewer.ui"/>
|
<setAttribute key="deselected_workspace_bundles">
|
||||||
<booleanAttribute key="includeOptional" value="true"/>
|
<setEntry value="com.minres.scviewer.e4.application"/>
|
||||||
<stringAttribute key="location" value="${workspace_loc}/../junit-workspace"/>
|
<setEntry value="com.minres.scviewer.ui"/>
|
||||||
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
|
</setAttribute>
|
||||||
<listEntry value="/com.minres.scviewer.database.test"/>
|
<booleanAttribute key="includeOptional" value="true"/>
|
||||||
</listAttribute>
|
<stringAttribute key="location" value="${workspace_loc}/../junit-workspace"/>
|
||||||
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
|
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
|
||||||
<listEntry value="4"/>
|
<listEntry value="/com.minres.scviewer.database.test"/>
|
||||||
</listAttribute>
|
</listAttribute>
|
||||||
<stringAttribute key="org.eclipse.jdt.junit.CONTAINER" value="=com.minres.scviewer.database.test"/>
|
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
|
||||||
<booleanAttribute key="org.eclipse.jdt.junit.KEEPRUNNING_ATTR" value="false"/>
|
<listEntry value="4"/>
|
||||||
<stringAttribute key="org.eclipse.jdt.junit.TESTNAME" value=""/>
|
</listAttribute>
|
||||||
<stringAttribute key="org.eclipse.jdt.junit.TEST_KIND" value="org.eclipse.jdt.junit.loader.junit4"/>
|
<stringAttribute key="org.eclipse.jdt.junit.CONTAINER" value="=com.minres.scviewer.database.test"/>
|
||||||
<booleanAttribute key="org.eclipse.jdt.launching.ATTR_USE_START_ON_FIRST_THREAD" value="true"/>
|
<booleanAttribute key="org.eclipse.jdt.junit.KEEPRUNNING_ATTR" value="false"/>
|
||||||
<stringAttribute key="org.eclipse.jdt.launching.JRE_CONTAINER" value="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
|
<stringAttribute key="org.eclipse.jdt.junit.TESTNAME" value=""/>
|
||||||
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value=""/>
|
<stringAttribute key="org.eclipse.jdt.junit.TEST_KIND" value="org.eclipse.jdt.junit.loader.junit4"/>
|
||||||
<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-os ${target.os} -ws ${target.ws} -arch ${target.arch} -nl ${target.nl} -consoleLog"/>
|
<booleanAttribute key="org.eclipse.jdt.launching.ATTR_USE_START_ON_FIRST_THREAD" value="true"/>
|
||||||
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="com.minres.scviewer.database.test"/>
|
<stringAttribute key="org.eclipse.jdt.launching.JRE_CONTAINER" value="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
|
||||||
<stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.pde.ui.workbenchClasspathProvider"/>
|
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value=""/>
|
||||||
<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Xms40m -Xmx512m"/>
|
<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-os ${target.os} -ws ${target.ws} -arch ${target.arch} -nl ${target.nl} -consoleLog"/>
|
||||||
<stringAttribute key="pde.version" value="3.3"/>
|
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="com.minres.scviewer.database.test"/>
|
||||||
<stringAttribute key="product" value="com.minres.scviewer.e4.product"/>
|
<stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.pde.ui.workbenchClasspathProvider"/>
|
||||||
<booleanAttribute key="run_in_ui_thread" value="true"/>
|
<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Xms40m -Xmx512m"/>
|
||||||
<stringAttribute key="selected_target_plugins" value="com.google.guava@default:default,javax.annotation@default:default,javax.inject@default:default,javax.servlet@default:default,org.apache.ant@default:default,org.apache.commons.jxpath@default:default,org.apache.felix.gogo.command@default:default,org.apache.felix.gogo.runtime@default:default,org.codehaus.groovy@default:default,org.eclipse.ant.core@default:default,org.eclipse.core.commands@default:default,org.eclipse.core.contenttype@default:default,org.eclipse.core.expressions@default:default,org.eclipse.core.filesystem.macosx@default:false,org.eclipse.core.filesystem@default:default,org.eclipse.core.jobs@default:default,org.eclipse.core.resources@default:default,org.eclipse.core.runtime@default:true,org.eclipse.core.variables@default:default,org.eclipse.e4.core.contexts@default:default,org.eclipse.e4.core.di.annotations@default:default,org.eclipse.e4.core.di.extensions@default:default,org.eclipse.e4.core.di@default:default,org.eclipse.e4.core.services@default:default,org.eclipse.e4.emf.xpath@default:default,org.eclipse.e4.ui.di@default:default,org.eclipse.e4.ui.model.workbench@default:default,org.eclipse.e4.ui.services@default:default,org.eclipse.emf.common@default:default,org.eclipse.emf.ecore@default:default,org.eclipse.equinox.app@default:default,org.eclipse.equinox.bidi@default:default,org.eclipse.equinox.common@2:true,org.eclipse.equinox.ds@1:true,org.eclipse.equinox.preferences@default:default,org.eclipse.equinox.registry@default:default,org.eclipse.equinox.util@default:default,org.eclipse.jface@default:default,org.eclipse.osgi.compatibility.state@default:false,org.eclipse.osgi.services@default:default,org.eclipse.osgi@-1:true,org.eclipse.swt.cocoa.macosx.x86_64@default:false,org.eclipse.swt@default:default,org.hamcrest.core@default:default,org.junit@default:default"/>
|
<stringAttribute key="pde.version" value="3.3"/>
|
||||||
<stringAttribute key="selected_workspace_plugins" value="com.minres.scviewer.database.sqlite@default:true,com.minres.scviewer.database.test@default:default,com.minres.scviewer.database.text@default:true,com.minres.scviewer.database.ui.swt@default:default,com.minres.scviewer.database.ui@default:default,com.minres.scviewer.database.vcd@default:default,com.minres.scviewer.database@default:true,com.opcoach.e4.preferences@default:default"/>
|
<stringAttribute key="product" value="com.minres.scviewer.e4.product"/>
|
||||||
<booleanAttribute key="show_selected_only" value="false"/>
|
<booleanAttribute key="run_in_ui_thread" value="true"/>
|
||||||
<booleanAttribute key="tracing" value="false"/>
|
<setAttribute key="selected_target_bundles">
|
||||||
<booleanAttribute key="useCustomFeatures" value="false"/>
|
<setEntry value="com.google.guava@default:default"/>
|
||||||
<booleanAttribute key="useDefaultConfig" value="true"/>
|
<setEntry value="javax.annotation@default:default"/>
|
||||||
<booleanAttribute key="useDefaultConfigArea" value="false"/>
|
<setEntry value="javax.inject@default:default"/>
|
||||||
<booleanAttribute key="useProduct" value="false"/>
|
<setEntry value="javax.servlet@default:default"/>
|
||||||
|
<setEntry value="org.apache.ant@default:default"/>
|
||||||
|
<setEntry value="org.apache.commons.jxpath@default:default"/>
|
||||||
|
<setEntry value="org.apache.felix.gogo.command@default:default"/>
|
||||||
|
<setEntry value="org.apache.felix.gogo.runtime@default:default"/>
|
||||||
|
<setEntry value="org.codehaus.groovy@default:default"/>
|
||||||
|
<setEntry value="org.eclipse.ant.core@default:default"/>
|
||||||
|
<setEntry value="org.eclipse.core.commands@default:default"/>
|
||||||
|
<setEntry value="org.eclipse.core.contenttype@default:default"/>
|
||||||
|
<setEntry value="org.eclipse.core.expressions@default:default"/>
|
||||||
|
<setEntry value="org.eclipse.core.filesystem.macosx@default:false"/>
|
||||||
|
<setEntry value="org.eclipse.core.filesystem@default:default"/>
|
||||||
|
<setEntry value="org.eclipse.core.jobs@default:default"/>
|
||||||
|
<setEntry value="org.eclipse.core.resources@default:default"/>
|
||||||
|
<setEntry value="org.eclipse.core.runtime@default:true"/>
|
||||||
|
<setEntry value="org.eclipse.core.variables@default:default"/>
|
||||||
|
<setEntry value="org.eclipse.e4.core.contexts@default:default"/>
|
||||||
|
<setEntry value="org.eclipse.e4.core.di.annotations@default:default"/>
|
||||||
|
<setEntry value="org.eclipse.e4.core.di.extensions@default:default"/>
|
||||||
|
<setEntry value="org.eclipse.e4.core.di@default:default"/>
|
||||||
|
<setEntry value="org.eclipse.e4.core.services@default:default"/>
|
||||||
|
<setEntry value="org.eclipse.e4.emf.xpath@default:default"/>
|
||||||
|
<setEntry value="org.eclipse.e4.ui.di@default:default"/>
|
||||||
|
<setEntry value="org.eclipse.e4.ui.model.workbench@default:default"/>
|
||||||
|
<setEntry value="org.eclipse.e4.ui.services@default:default"/>
|
||||||
|
<setEntry value="org.eclipse.emf.common@default:default"/>
|
||||||
|
<setEntry value="org.eclipse.emf.ecore@default:default"/>
|
||||||
|
<setEntry value="org.eclipse.equinox.app@default:default"/>
|
||||||
|
<setEntry value="org.eclipse.equinox.bidi@default:default"/>
|
||||||
|
<setEntry value="org.eclipse.equinox.common@2:true"/>
|
||||||
|
<setEntry value="org.eclipse.equinox.ds@1:true"/>
|
||||||
|
<setEntry value="org.eclipse.equinox.preferences@default:default"/>
|
||||||
|
<setEntry value="org.eclipse.equinox.registry@default:default"/>
|
||||||
|
<setEntry value="org.eclipse.equinox.util@default:default"/>
|
||||||
|
<setEntry value="org.eclipse.jface@default:default"/>
|
||||||
|
<setEntry value="org.eclipse.osgi.compatibility.state@default:false"/>
|
||||||
|
<setEntry value="org.eclipse.osgi.services@default:default"/>
|
||||||
|
<setEntry value="org.eclipse.osgi@-1:true"/>
|
||||||
|
<setEntry value="org.eclipse.swt.cocoa.macosx.x86_64@default:false"/>
|
||||||
|
<setEntry value="org.eclipse.swt@default:default"/>
|
||||||
|
<setEntry value="org.hamcrest.core@default:default"/>
|
||||||
|
<setEntry value="org.junit@default:default"/>
|
||||||
|
</setAttribute>
|
||||||
|
<setAttribute key="selected_workspace_bundles">
|
||||||
|
<setEntry value="com.minres.scviewer.database.sqlite@default:true"/>
|
||||||
|
<setEntry value="com.minres.scviewer.database.test@default:default"/>
|
||||||
|
<setEntry value="com.minres.scviewer.database.text@default:true"/>
|
||||||
|
<setEntry value="com.minres.scviewer.database.ui.swt@default:default"/>
|
||||||
|
<setEntry value="com.minres.scviewer.database.ui@default:default"/>
|
||||||
|
<setEntry value="com.minres.scviewer.database.vcd@default:default"/>
|
||||||
|
<setEntry value="com.minres.scviewer.database@default:true"/>
|
||||||
|
<setEntry value="com.opcoach.e4.preferences@default:default"/>
|
||||||
|
</setAttribute>
|
||||||
|
<booleanAttribute key="show_selected_only" value="false"/>
|
||||||
|
<booleanAttribute key="tracing" value="false"/>
|
||||||
|
<booleanAttribute key="useCustomFeatures" value="false"/>
|
||||||
|
<booleanAttribute key="useDefaultConfig" value="true"/>
|
||||||
|
<booleanAttribute key="useDefaultConfigArea" value="false"/>
|
||||||
|
<booleanAttribute key="useProduct" value="false"/>
|
||||||
</launchConfiguration>
|
</launchConfiguration>
|
||||||
|
@ -8,7 +8,6 @@ Bundle-RequiredExecutionEnvironment: JavaSE-1.8
|
|||||||
Import-Package: org.osgi.framework;version="1.3.0"
|
Import-Package: org.osgi.framework;version="1.3.0"
|
||||||
Require-Bundle: com.minres.scviewer.database,
|
Require-Bundle: com.minres.scviewer.database,
|
||||||
org.codehaus.groovy;bundle-version="2.5.8",
|
org.codehaus.groovy;bundle-version="2.5.8",
|
||||||
org.eclipse.equinox.util;bundle-version="1.0.500",
|
|
||||||
org.eclipse.equinox.ds;bundle-version="1.4.200",
|
org.eclipse.equinox.ds;bundle-version="1.4.200",
|
||||||
org.eclipse.osgi.services;bundle-version="3.4.0",
|
org.eclipse.osgi.services;bundle-version="3.4.0",
|
||||||
com.google.guava;bundle-version="15.0.0"
|
com.google.guava;bundle-version="15.0.0"
|
||||||
|
@ -24,8 +24,8 @@
|
|||||||
</compilerArguments>
|
</compilerArguments>
|
||||||
<!-- set verbose to be true if you want lots of uninteresting messages -->
|
<!-- set verbose to be true if you want lots of uninteresting messages -->
|
||||||
<!-- <verbose>true</verbose> -->
|
<!-- <verbose>true</verbose> -->
|
||||||
<source>1.7</source>
|
<source>1.8</source>
|
||||||
<target>1.7</target>
|
<target>1.8</target>
|
||||||
</configuration>
|
</configuration>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
|
@ -50,8 +50,8 @@ public class TextDbLoader implements IWaveformDbLoader{
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<IWaveform> getAllWaves() {
|
public Collection<IWaveform> getAllWaves() {
|
||||||
return new LinkedList<IWaveform>(streams);
|
return streams;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Map<Long, ITxGenerator> getGeneratorsById() {
|
public Map<Long, ITxGenerator> getGeneratorsById() {
|
||||||
@ -64,6 +64,7 @@ public class TextDbLoader implements IWaveformDbLoader{
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
boolean load(IWaveformDb db, File file) throws Exception {
|
boolean load(IWaveformDb db, File file) throws Exception {
|
||||||
|
if(file.isDirectory() || !file.exists()) return false;
|
||||||
this.db=db
|
this.db=db
|
||||||
this.streams=[]
|
this.streams=[]
|
||||||
try {
|
try {
|
||||||
@ -82,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))
|
||||||
calculateConcurrencyIndicees()
|
streams.each{ TxStream stream -> stream.getMaxConcurrency() }
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
} catch (IndexOutOfBoundsException e) {
|
} catch (IndexOutOfBoundsException e) {
|
||||||
@ -135,7 +136,7 @@ public class TextDbLoader implements IWaveformDbLoader{
|
|||||||
case "ms":return 1000000000000L
|
case "ms":return 1000000000000L
|
||||||
case "s": return 1000000000000000L
|
case "s": return 1000000000000000L
|
||||||
}
|
}
|
||||||
return "fs"
|
return 1L
|
||||||
}
|
}
|
||||||
|
|
||||||
private def parseInput(InputStream inputStream){
|
private def parseInput(InputStream inputStream){
|
||||||
@ -152,23 +153,29 @@ public class TextDbLoader implements IWaveformDbLoader{
|
|||||||
def tokens = line.split(/\s+/) as ArrayList
|
def tokens = line.split(/\s+/) as ArrayList
|
||||||
switch(tokens[0]){
|
switch(tokens[0]){
|
||||||
case "scv_tr_stream":
|
case "scv_tr_stream":
|
||||||
case "scv_tr_generator":
|
|
||||||
case "begin_attribute":
|
|
||||||
case "end_attribute":
|
|
||||||
if ((matcher = line =~ /^scv_tr_stream\s+\(ID (\d+),\s+name\s+"([^"]+)",\s+kind\s+"([^"]+)"\)$/)) {
|
if ((matcher = line =~ /^scv_tr_stream\s+\(ID (\d+),\s+name\s+"([^"]+)",\s+kind\s+"([^"]+)"\)$/)) {
|
||||||
def id = Integer.parseInt(matcher[0][1])
|
def id = Integer.parseInt(matcher[0][1])
|
||||||
def stream = new TxStream(this, id, matcher[0][2], matcher[0][3])
|
def stream = new TxStream(this, id, matcher[0][2], matcher[0][3])
|
||||||
streams<<stream
|
streams<<stream
|
||||||
streamsById[id]=stream
|
streamsById[id]=stream
|
||||||
} else if ((matcher = line =~ /^scv_tr_generator\s+\(ID\s+(\d+),\s+name\s+"([^"]+)",\s+scv_tr_stream\s+(\d+),$/)) {
|
}
|
||||||
|
break;
|
||||||
|
case "scv_tr_generator":
|
||||||
|
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])]
|
ITxStream stream=streamsById[Integer.parseInt(matcher[0][3])]
|
||||||
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
|
||||||
} else if ((matcher = line =~ /^begin_attribute \(ID (\d+), name "([^"]+)", type "([^"]+)"\)$/)) {
|
}
|
||||||
|
break;
|
||||||
|
case "begin_attribute":
|
||||||
|
if ((matcher = line =~ /^begin_attribute \(ID (\d+), name "([^"]+)", type "([^"]+)"\)$/)) {
|
||||||
generator.begin_attrs << TxAttributeType.getAttrType(matcher[0][2], DataType.valueOf(matcher[0][3]), AssociationType.BEGIN)
|
generator.begin_attrs << TxAttributeType.getAttrType(matcher[0][2], DataType.valueOf(matcher[0][3]), AssociationType.BEGIN)
|
||||||
} else if ((matcher = line =~ /^end_attribute \(ID (\d+), name "([^"]+)", type "([^"]+)"\)$/)) {
|
}
|
||||||
|
break;
|
||||||
|
case "end_attribute":
|
||||||
|
if ((matcher = line =~ /^end_attribute \(ID (\d+), name "([^"]+)", type "([^"]+)"\)$/)) {
|
||||||
generator.end_attrs << TxAttributeType.getAttrType(matcher[0][2], DataType.valueOf(matcher[0][3]), AssociationType.END)
|
generator.end_attrs << TxAttributeType.getAttrType(matcher[0][2], DataType.valueOf(matcher[0][3]), AssociationType.END)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -227,31 +234,6 @@ public class TextDbLoader implements IWaveformDbLoader{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private def toDataType(String str){
|
|
||||||
switch (str)
|
|
||||||
{
|
|
||||||
case "BOOLEAN": return DataType. BOOLEAN
|
|
||||||
case "ENUMERATION": return DataType. ENUMERATION
|
|
||||||
case "INTEGER": return DataType. INTEGER
|
|
||||||
case "UNSIGNED": return DataType. UNSIGNED
|
|
||||||
case "FLOATING_POINT_NUMBER": return DataType. FLOATING_POINT_NUMBER
|
|
||||||
case "BIT_VECTOR": return DataType. BIT_VECTOR
|
|
||||||
case "LOGIC_VECTOR": return DataType. LOGIC_VECTOR
|
|
||||||
case "FIXED_POINT_INTEGER": return DataType. FIXED_POINT_INTEGER
|
|
||||||
case "UNSIGNED_FIXED_POINT_INTEGER": return DataType. UNSIGNED_FIXED_POINT_INTEGER
|
|
||||||
case "RECORD": return DataType. RECORD
|
|
||||||
case "POINTER": return DataType. POINTER
|
|
||||||
case "ARRAY": return DataType. ARRAY
|
|
||||||
case "STRING": return DataType. STRING
|
|
||||||
default: return DataType.INTEGER
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private def calculateConcurrencyIndicees(){
|
|
||||||
streams.each{ TxStream stream -> stream.getMaxConcurrency() }
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public Collection<RelationType> getAllRelationTypes(){
|
public Collection<RelationType> getAllRelationTypes(){
|
||||||
return relationTypes.values();
|
return relationTypes.values();
|
||||||
}
|
}
|
||||||
|
@ -7,5 +7,6 @@ Bundle-Vendor: MINRES Technologies GmbH
|
|||||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
|
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
|
||||||
Export-Package: com.minres.scviewer.database.ui
|
Export-Package: com.minres.scviewer.database.ui
|
||||||
Require-Bundle: com.minres.scviewer.database,
|
Require-Bundle: com.minres.scviewer.database,
|
||||||
org.eclipse.jface
|
org.eclipse.jface,
|
||||||
|
org.eclipse.swt
|
||||||
Automatic-Module-Name: com.minres.scviewer.database.ui
|
Automatic-Module-Name: com.minres.scviewer.database.ui
|
||||||
|
@ -51,31 +51,12 @@ public class TrackEntry {
|
|||||||
|
|
||||||
result[0] = fallback;
|
result[0] = fallback;
|
||||||
result[1] = highlightedFallback;
|
result[1] = highlightedFallback;
|
||||||
|
|
||||||
// assign colors to standard values
|
// assign "random" color here, one name always results in the same color!
|
||||||
if (streamValue.contains("read")){
|
if( streamValue!=null && randomColors.length > 0 ) {
|
||||||
result[0] = new Color(86,174,53);
|
int index = Math.abs(streamValue.hashCode()) % randomColors.length;
|
||||||
result[1] = new Color (86,194,53);
|
result[0] = randomColors[index][0];
|
||||||
}else if (streamValue.contains("rdata")){
|
result[1] = randomColors[index][1];
|
||||||
result[0] = new Color(138,151,71);
|
|
||||||
result[1] = new Color (138,171,71);
|
|
||||||
}else if (streamValue.contains("addr")){
|
|
||||||
result[0] = new Color(233,187,68);
|
|
||||||
result[1] = new Color (233,207,68);
|
|
||||||
}else if (streamValue.contains("write")){
|
|
||||||
result[0] = new Color(1,128,191);
|
|
||||||
result[1] = new Color (1,128,211);
|
|
||||||
}else if (streamValue.contains("wdata")){
|
|
||||||
result[0] = new Color(2,181,160);
|
|
||||||
result[1] = new Color (2,201,160);
|
|
||||||
|
|
||||||
}else {
|
|
||||||
// assign "random" color here, one name always results in the same color!
|
|
||||||
if( randomColors.length > 0 ) {
|
|
||||||
int index = Math.abs(streamValue.hashCode()) % randomColors.length;
|
|
||||||
result[0] = randomColors[index][0];
|
|
||||||
result[1] = randomColors[index][1];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
@ -6,7 +6,6 @@ Bundle-Version: 2.0.2.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",
|
||||||
org.eclipse.equinox.util;bundle-version="1.0.500",
|
|
||||||
org.eclipse.equinox.ds;bundle-version="1.4.200",
|
org.eclipse.equinox.ds;bundle-version="1.4.200",
|
||||||
org.eclipse.osgi.services;bundle-version="3.4.0",
|
org.eclipse.osgi.services;bundle-version="3.4.0",
|
||||||
com.google.guava;bundle-version="15.0.0"
|
com.google.guava;bundle-version="15.0.0"
|
||||||
|
@ -79,6 +79,7 @@ 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 Exception {
|
||||||
|
if(file.isDirectory() || !file.exists()) return false;
|
||||||
this.db=db;
|
this.db=db;
|
||||||
this.maxTime=0;
|
this.maxTime=0;
|
||||||
String name = file.getCanonicalFile().getName();
|
String name = file.getCanonicalFile().getName();
|
||||||
@ -127,7 +128,7 @@ public class VCDDbLoader implements IWaveformDbLoader, IVCDDatabaseBuilder {
|
|||||||
* @see com.minres.scviewer.database.ITrDb#getAllWaves()
|
* @see com.minres.scviewer.database.ITrDb#getAllWaves()
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<IWaveform> getAllWaves() {
|
public Collection<IWaveform> getAllWaves() {
|
||||||
return signals;
|
return signals;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12,7 +12,6 @@ package com.minres.scviewer.database;
|
|||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public interface IWaveformDbLoader {
|
public interface IWaveformDbLoader {
|
||||||
|
|
||||||
@ -20,7 +19,7 @@ public interface IWaveformDbLoader {
|
|||||||
|
|
||||||
public Long getMaxTime();
|
public Long getMaxTime();
|
||||||
|
|
||||||
public List<IWaveform> getAllWaves() ;
|
public Collection<IWaveform> getAllWaves() ;
|
||||||
|
|
||||||
public Collection<RelationType> getAllRelationTypes() ;
|
public Collection<RelationType> getAllRelationTypes() ;
|
||||||
|
|
||||||
|
@ -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.4.2.qualifier
|
Bundle-Version: 2.6.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",
|
||||||
@ -18,7 +18,6 @@ Require-Bundle: javax.inject;bundle-version="1.0.0",
|
|||||||
com.minres.scviewer.database.ui,
|
com.minres.scviewer.database.ui,
|
||||||
com.minres.scviewer.database;bundle-version="1.0.0",
|
com.minres.scviewer.database;bundle-version="1.0.0",
|
||||||
org.eclipse.equinox.ds;bundle-version="1.4.300",
|
org.eclipse.equinox.ds;bundle-version="1.4.300",
|
||||||
org.eclipse.equinox.util;bundle-version="1.0.500",
|
|
||||||
org.eclipse.osgi.services;bundle-version="3.5.0",
|
org.eclipse.osgi.services;bundle-version="3.5.0",
|
||||||
org.eclipse.e4.core.services;bundle-version="2.0.0",
|
org.eclipse.e4.core.services;bundle-version="2.0.0",
|
||||||
org.eclipse.osgi.services;bundle-version="3.5.0",
|
org.eclipse.osgi.services;bundle-version="3.5.0",
|
||||||
|
BIN
com.minres.scviewer.e4.application/icons/arrow_up.png
Normal file
BIN
com.minres.scviewer.e4.application/icons/arrow_up.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 372 B |
BIN
com.minres.scviewer.e4.application/icons/page_white.png
Normal file
BIN
com.minres.scviewer.e4.application/icons/page_white.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 294 B |
@ -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.4.2-SNAPSHOT</version>
|
<version>2.6.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>
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
package com.minres.scviewer.e4.application.handlers;
|
package com.minres.scviewer.e4.application.handlers;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.ArrayList;
|
import java.util.List;
|
||||||
|
|
||||||
import org.eclipse.e4.core.contexts.IEclipseContext;
|
import org.eclipse.e4.core.contexts.IEclipseContext;
|
||||||
import org.eclipse.e4.core.di.annotations.Execute;
|
import org.eclipse.e4.core.di.annotations.Execute;
|
||||||
@ -21,27 +21,20 @@ import org.eclipse.e4.ui.model.application.ui.basic.MPartStack;
|
|||||||
import org.eclipse.e4.ui.workbench.modeling.EModelService;
|
import org.eclipse.e4.ui.workbench.modeling.EModelService;
|
||||||
import org.eclipse.e4.ui.workbench.modeling.EPartService;
|
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.swt.SWT;
|
import org.eclipse.jface.window.Window;
|
||||||
import org.eclipse.swt.widgets.FileDialog;
|
|
||||||
import org.eclipse.swt.widgets.Shell;
|
import org.eclipse.swt.widgets.Shell;
|
||||||
|
|
||||||
import com.minres.scviewer.e4.application.Messages;
|
import com.minres.scviewer.e4.application.Messages;
|
||||||
|
import com.minres.scviewer.e4.application.parts.FileBrowserDialog;
|
||||||
public class OpenHandler {
|
public class OpenHandler {
|
||||||
|
|
||||||
@Execute
|
@Execute
|
||||||
public void execute(Shell shell, MApplication app, EModelService modelService, EPartService partService){
|
public void execute(Shell shell, MApplication app, EModelService modelService, EPartService partService){
|
||||||
FileDialog dialog = new FileDialog(shell, SWT.OPEN | SWT.MULTI);
|
FileBrowserDialog dlg = new FileBrowserDialog(shell);
|
||||||
dialog.setFilterExtensions (new String []{Messages.OpenHandler_0});
|
//dlg.create();
|
||||||
String ret = dialog.open();
|
dlg.setFilterExtensions (new String []{Messages.OpenHandler_0, "*"});
|
||||||
if(ret==null)
|
if (dlg.open() != Window.OK) return;
|
||||||
return;
|
List<File> files = dlg.getSelectedFiles();
|
||||||
String path = dialog.getFilterPath();
|
|
||||||
ArrayList<File> files = new ArrayList<File>();
|
|
||||||
for(String fileName: dialog.getFileNames()){
|
|
||||||
File file = new File(path+File.separator+fileName);
|
|
||||||
if(file.exists())
|
|
||||||
files.add(file);
|
|
||||||
}
|
|
||||||
MPart part = partService .createPart("com.minres.scviewer.e4.application.partdescriptor.waveformviewer"); //$NON-NLS-1$
|
MPart part = partService .createPart("com.minres.scviewer.e4.application.partdescriptor.waveformviewer"); //$NON-NLS-1$
|
||||||
part.setLabel(files.get(0).getName());
|
part.setLabel(files.get(0).getName());
|
||||||
MPartStack partStack = (MPartStack)modelService.find("org.eclipse.editorss", app); //$NON-NLS-1$
|
MPartStack partStack = (MPartStack)modelService.find("org.eclipse.editorss", app); //$NON-NLS-1$
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
AboutDialog_0=\nSCViewer - a SystemC waveform viewer\n\nVersion: {0}\n
|
AboutDialog_0=\nSCViewer - a SystemC waveform viewer\n\nVersion: {0}\n
|
||||||
AboutDialog_1=\nCopyright (c) 2015, 2019 MINRES Technologies GmbH and others.\n\nAll rights reserved. MINRES and the MINRES logo are trademarks of MINRES Technologies GmbH, http://www.minres.com/. 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\n\nParts of the software are governed by the Apache License Version 2.0 available at http://www.apache.org/licenses/. These are namely org.mapdb and org.sqlite JDBC driver\n\nSource code is hosted at https://git.minres.com/VP-Tools/SCViewer and the master branch is mirrored to GitHub: https://github.com/minres/SCViewer\n
|
AboutDialog_1=\nCopyright (c) 2015, 2019, 2020 MINRES Technologies GmbH and others.\n\nAll rights reserved. MINRES and the MINRES logo are trademarks of MINRES Technologies GmbH, http://www.minres.com/. 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\n\nParts of the software are governed by the Apache License Version 2.0 available at http://www.apache.org/licenses/. These are namely org.mapdb and org.sqlite JDBC driver\n\nSource code is hosted at https://git.minres.com/VP-Tools/SCViewer and the master branch is mirrored to GitHub: https://github.com/minres/SCViewer\n
|
||||||
DesignBrowser_12=Append all after
|
DesignBrowser_12=Append all after
|
||||||
DesignBrowser_16=Insert all before
|
DesignBrowser_16=Insert all before
|
||||||
DesignBrowser_2=Enter text to filter waveforms
|
DesignBrowser_2=Enter text to filter waveforms
|
||||||
@ -9,7 +9,7 @@ DesignBrowser_8=Insert before
|
|||||||
LoadingWaveformDb_0=Database loading...
|
LoadingWaveformDb_0=Database loading...
|
||||||
LoadStoreSettingsHandler_2=*.scview
|
LoadStoreSettingsHandler_2=*.scview
|
||||||
LoadStoreSettingsHandler_3=SCViewer.scview
|
LoadStoreSettingsHandler_3=SCViewer.scview
|
||||||
OpenHandler_0=*.vcd;*.txdb;*.txlog;CURRENT
|
OpenHandler_0=*.vcd;*.txdb;*.txlog;*.fbrdb
|
||||||
QuitHandler_0=Confirmation
|
QuitHandler_0=Confirmation
|
||||||
QuitHandler_1=Do you want to exit?
|
QuitHandler_1=Do you want to exit?
|
||||||
RelationTypeToolControl_0=------------
|
RelationTypeToolControl_0=------------
|
||||||
@ -45,7 +45,7 @@ WaveformViewer_18=Would you like to reload the database?
|
|||||||
WaveformViewer_19=vcd
|
WaveformViewer_19=vcd
|
||||||
WaveformViewer_20=txdb
|
WaveformViewer_20=txdb
|
||||||
WaveformViewer_21=txlog
|
WaveformViewer_21=txlog
|
||||||
WaveformViewer_22=txldb
|
WaveformViewer_22=fbrdb
|
||||||
WaveformViewer_37=Database open
|
WaveformViewer_37=Database open
|
||||||
WaveformViewer_38=Would you like to open the adjacent database
|
WaveformViewer_38=Would you like to open the adjacent database
|
||||||
WaveformViewer_39=\ as well?
|
WaveformViewer_39=\ as well?
|
||||||
|
@ -328,13 +328,15 @@ public class DesignBrowser {
|
|||||||
*/
|
*/
|
||||||
@Focus
|
@Focus
|
||||||
public void setFocus() {
|
public void setFocus() {
|
||||||
txTableViewer.getTable().setFocus();
|
if(txTableViewer!=null) {
|
||||||
IStructuredSelection selection = (IStructuredSelection)txTableViewer.getSelection();
|
txTableViewer.getTable().setFocus();
|
||||||
if(selection.size()==0){
|
IStructuredSelection selection = (IStructuredSelection)txTableViewer.getSelection();
|
||||||
appendItem.setEnabled(false);
|
if(selection.size()==0){
|
||||||
|
appendItem.setEnabled(false);
|
||||||
|
}
|
||||||
|
selectionService.setSelection(selection);
|
||||||
|
thisSelectionCount=selection.toList().size();
|
||||||
}
|
}
|
||||||
selectionService.setSelection(selection);
|
|
||||||
thisSelectionCount=selection.toList().size();
|
|
||||||
updateButtons();
|
updateButtons();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -0,0 +1,482 @@
|
|||||||
|
package com.minres.scviewer.e4.application.parts;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.nio.file.FileSystems;
|
||||||
|
import java.nio.file.PathMatcher;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Comparator;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
import org.eclipse.jface.dialogs.IDialogConstants;
|
||||||
|
import org.eclipse.jface.dialogs.TrayDialog;
|
||||||
|
import org.eclipse.jface.viewers.ArrayContentProvider;
|
||||||
|
import org.eclipse.jface.viewers.ColumnLabelProvider;
|
||||||
|
import org.eclipse.jface.viewers.ILabelProvider;
|
||||||
|
import org.eclipse.jface.viewers.ILabelProviderListener;
|
||||||
|
import org.eclipse.jface.viewers.IStructuredSelection;
|
||||||
|
import org.eclipse.jface.viewers.ITreeContentProvider;
|
||||||
|
import org.eclipse.jface.viewers.TableViewer;
|
||||||
|
import org.eclipse.jface.viewers.TableViewerColumn;
|
||||||
|
import org.eclipse.jface.viewers.TreePath;
|
||||||
|
import org.eclipse.jface.viewers.TreeSelection;
|
||||||
|
import org.eclipse.jface.viewers.TreeViewer;
|
||||||
|
import org.eclipse.jface.viewers.Viewer;
|
||||||
|
import org.eclipse.jface.viewers.ViewerComparator;
|
||||||
|
import org.eclipse.jface.viewers.ViewerFilter;
|
||||||
|
import org.eclipse.swt.SWT;
|
||||||
|
import org.eclipse.swt.custom.SashForm;
|
||||||
|
import org.eclipse.swt.events.MouseAdapter;
|
||||||
|
import org.eclipse.swt.events.MouseEvent;
|
||||||
|
import org.eclipse.swt.events.SelectionAdapter;
|
||||||
|
import org.eclipse.swt.events.SelectionEvent;
|
||||||
|
import org.eclipse.swt.graphics.Color;
|
||||||
|
import org.eclipse.swt.graphics.Image;
|
||||||
|
import org.eclipse.swt.graphics.Point;
|
||||||
|
import org.eclipse.swt.layout.GridData;
|
||||||
|
import org.eclipse.swt.layout.GridLayout;
|
||||||
|
import org.eclipse.swt.widgets.Combo;
|
||||||
|
import org.eclipse.swt.widgets.Composite;
|
||||||
|
import org.eclipse.swt.widgets.Control;
|
||||||
|
import org.eclipse.swt.widgets.Shell;
|
||||||
|
import org.eclipse.swt.widgets.Table;
|
||||||
|
import org.eclipse.swt.widgets.TableColumn;
|
||||||
|
import org.eclipse.swt.widgets.TableItem;
|
||||||
|
import org.eclipse.swt.widgets.Text;
|
||||||
|
import org.eclipse.swt.widgets.ToolBar;
|
||||||
|
import org.eclipse.swt.widgets.ToolItem;
|
||||||
|
import org.eclipse.wb.swt.ResourceManager;
|
||||||
|
|
||||||
|
public class FileBrowserDialog extends TrayDialog {
|
||||||
|
|
||||||
|
private Image folderImage;
|
||||||
|
|
||||||
|
private Image fileImage;
|
||||||
|
|
||||||
|
private Image dbImage;
|
||||||
|
|
||||||
|
File currentDirFile;
|
||||||
|
|
||||||
|
TreeViewer dirTreeViewer;
|
||||||
|
|
||||||
|
TableViewer tableViewer;
|
||||||
|
|
||||||
|
Text fileNameEntry;
|
||||||
|
|
||||||
|
Combo filterCombo;
|
||||||
|
|
||||||
|
FileTableComparator fileTableComparator;
|
||||||
|
|
||||||
|
private FileGlobber globber = new FileGlobber();
|
||||||
|
|
||||||
|
private FileGlobber imageGlobber = new FileGlobber();
|
||||||
|
|
||||||
|
private File selectedDir;
|
||||||
|
|
||||||
|
private List<File> selectedFiles;
|
||||||
|
|
||||||
|
String[] filterStrings = new String[] {"*"};
|
||||||
|
|
||||||
|
public FileBrowserDialog(Shell parentShell) {
|
||||||
|
super(parentShell);
|
||||||
|
folderImage=ResourceManager.getPluginImage("com.minres.scviewer.e4.application", "icons/folder.png"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
|
dbImage=ResourceManager.getPluginImage("com.minres.scviewer.e4.application", "icons/database.png"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
|
fileImage=ResourceManager.getPluginImage("com.minres.scviewer.e4.application", "icons/page_white.png"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
|
currentDirFile = new File(".");
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setFilterExtensions(String[] filterStrings) {
|
||||||
|
if(filterStrings.length==0){
|
||||||
|
globber = new FileGlobber();
|
||||||
|
} else {
|
||||||
|
globber= new FileGlobber(filterStrings[0]);
|
||||||
|
imageGlobber = new FileGlobber(filterStrings[0]);
|
||||||
|
if(filterCombo!=null) {
|
||||||
|
filterCombo.setItems(filterStrings);
|
||||||
|
filterCombo.select(0);
|
||||||
|
filterCombo.computeSize(SWT.DEFAULT, SWT.DEFAULT);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.filterStrings=filterStrings;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<File> getSelectedFiles(){
|
||||||
|
return selectedFiles;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Control createContents(Composite parent) {
|
||||||
|
Control ret = super.createContents(parent);
|
||||||
|
setDirSelection(currentDirFile.getAbsoluteFile().getParentFile());
|
||||||
|
getButton(IDialogConstants.OK_ID).setEnabled(!tableViewer.getSelection().isEmpty());
|
||||||
|
if(parent instanceof Shell) {
|
||||||
|
Point size = ((Shell)parent).computeSize(SWT.DEFAULT, SWT.DEFAULT);
|
||||||
|
((Shell)parent).setSize(size.x, 400);
|
||||||
|
((Shell)parent).setText("Select database");
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected Control createDialogArea(Composite parent) {
|
||||||
|
Composite area = (Composite) super.createDialogArea(parent);
|
||||||
|
final SashForm sashForm = new SashForm(area, SWT.HORIZONTAL);
|
||||||
|
sashForm.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.FILL_VERTICAL));
|
||||||
|
|
||||||
|
dirTreeViewer = new TreeViewer(sashForm);
|
||||||
|
dirTreeViewer.setContentProvider(new FileTreeContentProvider());
|
||||||
|
dirTreeViewer.setLabelProvider(new FileTreeLabelProvider());
|
||||||
|
dirTreeViewer.addSelectionChangedListener(event -> {
|
||||||
|
IStructuredSelection sel = event.getStructuredSelection();
|
||||||
|
File entry = (File) sel.getFirstElement();
|
||||||
|
if(entry!=null && entry.isDirectory()) {
|
||||||
|
selectedDir = entry;
|
||||||
|
tableViewer.setInput(selectedDir.listFiles());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
dirTreeViewer.setInput("root");
|
||||||
|
|
||||||
|
final Composite tableViewerParent = new Composite(sashForm, SWT.NONE);
|
||||||
|
GridLayout gridLayout = new GridLayout(1, true);
|
||||||
|
gridLayout.horizontalSpacing=0;
|
||||||
|
gridLayout.verticalSpacing=5;
|
||||||
|
gridLayout.marginHeight=0;
|
||||||
|
gridLayout.marginHeight=0;
|
||||||
|
tableViewerParent.setLayout(gridLayout);
|
||||||
|
final ToolBar toolBar = new ToolBar(tableViewerParent, SWT.HORIZONTAL |SWT.SHADOW_OUT);
|
||||||
|
toolBar.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL));
|
||||||
|
final ToolItem toolbarItemUp = new ToolItem(toolBar, SWT.PUSH);
|
||||||
|
toolbarItemUp.setToolTipText("up one level");
|
||||||
|
toolbarItemUp.setImage(ResourceManager.getPluginImage("com.minres.scviewer.e4.application", "icons/arrow_up.png")); //$NON-NLS-1$ //$NON-NLS-2$);
|
||||||
|
toolbarItemUp.addSelectionListener(new SelectionAdapter() {
|
||||||
|
@Override
|
||||||
|
public void widgetSelected(SelectionEvent e) {
|
||||||
|
if(selectedDir.getParentFile()!=null) {
|
||||||
|
selectedDir=selectedDir.getParentFile();
|
||||||
|
tableViewer.setInput(selectedDir.listFiles());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
tableViewer = new TableViewer(tableViewerParent, SWT.BORDER | SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION | SWT.MULTI);
|
||||||
|
tableViewer.getTable().setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL | GridData.VERTICAL_ALIGN_FILL | GridData.HORIZONTAL_ALIGN_FILL));
|
||||||
|
tableViewer.addSelectionChangedListener(event -> {
|
||||||
|
IStructuredSelection sel = event.getStructuredSelection();
|
||||||
|
getButton(IDialogConstants.OK_ID).setEnabled(!sel.isEmpty());
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
Object text = sel.toList().stream().map(e -> ((File)e).getName()).collect(Collectors.joining(";"));
|
||||||
|
fileNameEntry.setText(text.toString());
|
||||||
|
});
|
||||||
|
tableViewer.addDoubleClickListener(event -> {
|
||||||
|
IStructuredSelection sel = tableViewer.getStructuredSelection();
|
||||||
|
if(sel.isEmpty()) return;
|
||||||
|
if(sel.size()==1) {
|
||||||
|
File elem = (File) sel.getFirstElement();
|
||||||
|
if(globber.matches(elem))
|
||||||
|
buttonPressed(IDialogConstants.OK_ID);
|
||||||
|
else if(elem.isDirectory())
|
||||||
|
setDirSelection(elem);
|
||||||
|
} else
|
||||||
|
buttonPressed(IDialogConstants.OK_ID);
|
||||||
|
});
|
||||||
|
tableViewer.setContentProvider(ArrayContentProvider.getInstance());
|
||||||
|
tableViewer.getTable().setHeaderVisible(true);
|
||||||
|
tableViewer.getTable().setLinesVisible(true);
|
||||||
|
tableViewer.getTable().addMouseListener(new MouseAdapter() {
|
||||||
|
@Override
|
||||||
|
public void mouseDown(MouseEvent e) { mouseUp(e); }
|
||||||
|
@Override
|
||||||
|
public void mouseUp(MouseEvent e) {
|
||||||
|
TableItem element = (TableItem)tableViewer.getTable().getItem(new Point(e.x, e.y));
|
||||||
|
final Table table = tableViewer.getTable();
|
||||||
|
if (element == null )//&& (e.stateMask&SWT.MODIFIER_MASK)!=0)
|
||||||
|
table.deselectAll();
|
||||||
|
else {
|
||||||
|
int[] indices = table.getSelectionIndices();
|
||||||
|
if(indices.length==1) {
|
||||||
|
TableItem ti = table.getItem(indices[0]);
|
||||||
|
if(!globber.matches(ti.getData()) && !((File)ti.getData()).isDirectory())
|
||||||
|
table.deselect(indices[0]);
|
||||||
|
} else {
|
||||||
|
for (int idx : indices) {
|
||||||
|
TableItem ti = table.getItem(idx);
|
||||||
|
if(!globber.matches(ti.getData()))
|
||||||
|
table.deselect(idx);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
TableViewerColumn colName = new TableViewerColumn(tableViewer, SWT.NONE);
|
||||||
|
colName.setLabelProvider(new FileTableLabelProvider() {
|
||||||
|
@Override public String getText(Object element) { return ((File) element).getName(); }
|
||||||
|
@Override public Image getImage(Object element){
|
||||||
|
if(imageGlobber.matches(element)) return dbImage;
|
||||||
|
return ((File) element).isDirectory()?folderImage:fileImage;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
colName.getColumn().setWidth(300);
|
||||||
|
colName.getColumn().setText("Name");
|
||||||
|
colName.getColumn().addSelectionListener(getSelectionAdapter(colName.getColumn(), 0));
|
||||||
|
|
||||||
|
TableViewerColumn colSize = new TableViewerColumn(tableViewer, SWT.RIGHT);
|
||||||
|
colSize.setLabelProvider(new FileTableLabelProvider() {
|
||||||
|
@Override public String getText(Object element) { return String.format("%d", ((File) element).length()); }
|
||||||
|
});
|
||||||
|
colSize.getColumn().setWidth(100);
|
||||||
|
colSize.getColumn().setText("Size");
|
||||||
|
colSize.getColumn().addSelectionListener(getSelectionAdapter(colSize.getColumn(), 1));
|
||||||
|
|
||||||
|
TableViewerColumn colEmpty = new TableViewerColumn(tableViewer, SWT.CENTER);
|
||||||
|
colEmpty.setLabelProvider(new FileTableLabelProvider() {
|
||||||
|
@Override public String getText(Object element) { return ""; }
|
||||||
|
});
|
||||||
|
//colEmpty.getColumn().setWidth(200);
|
||||||
|
colEmpty.getColumn().setText("");
|
||||||
|
|
||||||
|
fileTableComparator = new FileTableComparator();
|
||||||
|
tableViewer.setComparator(fileTableComparator);
|
||||||
|
tableViewer.addFilter(new FileTableFilter());
|
||||||
|
|
||||||
|
Composite bottomBar = new Composite(tableViewerParent, SWT.NONE);
|
||||||
|
bottomBar.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL));
|
||||||
|
GridLayout gridLayoutBottom = new GridLayout(2, false);
|
||||||
|
gridLayoutBottom.horizontalSpacing=0;
|
||||||
|
gridLayoutBottom.verticalSpacing=0;
|
||||||
|
gridLayoutBottom.marginHeight=0;
|
||||||
|
gridLayoutBottom.marginWidth=0;
|
||||||
|
bottomBar.setLayout(gridLayoutBottom);
|
||||||
|
|
||||||
|
fileNameEntry = new Text(bottomBar, SWT.BORDER);
|
||||||
|
fileNameEntry.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL));
|
||||||
|
fileNameEntry.setEditable(false); //TODO: temporary disabled
|
||||||
|
fileNameEntry.setEnabled(false);
|
||||||
|
|
||||||
|
filterCombo = new Combo(bottomBar, SWT.DROP_DOWN | SWT.BORDER | SWT.READ_ONLY);
|
||||||
|
filterCombo.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
|
||||||
|
filterCombo.setItems(filterStrings);
|
||||||
|
filterCombo.select(0);
|
||||||
|
filterCombo.addSelectionListener(new SelectionAdapter() {
|
||||||
|
@Override
|
||||||
|
public void widgetSelected(SelectionEvent e) {
|
||||||
|
globber= new FileGlobber(filterCombo.getText());
|
||||||
|
tableViewer.setInput(selectedDir.listFiles());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
sashForm.setWeights(new int[]{3, 3});
|
||||||
|
return area;
|
||||||
|
}
|
||||||
|
|
||||||
|
private SelectionAdapter getSelectionAdapter(final TableColumn column, final int index) {
|
||||||
|
SelectionAdapter selectionAdapter = new SelectionAdapter() {
|
||||||
|
@Override
|
||||||
|
public void widgetSelected(SelectionEvent e) {
|
||||||
|
fileTableComparator.setColumn(index);
|
||||||
|
int dir = fileTableComparator.getDirection();
|
||||||
|
tableViewer.getTable().setSortDirection(dir);
|
||||||
|
tableViewer.getTable().setSortColumn(column);
|
||||||
|
tableViewer.refresh();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
return selectionAdapter;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setDirSelection(File f) {
|
||||||
|
ArrayList<File> fileTree = getParentDirList(f);
|
||||||
|
TreeSelection selection = new TreeSelection(new TreePath(fileTree.toArray()));
|
||||||
|
dirTreeViewer.setSelection(selection, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
private ArrayList<File> getParentDirList(File actual){
|
||||||
|
if(actual==null)
|
||||||
|
return new ArrayList<>();
|
||||||
|
else {
|
||||||
|
ArrayList<File> l = getParentDirList(actual.getParentFile());
|
||||||
|
l.add(actual);
|
||||||
|
return l;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected boolean isResizable() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// save content of the Text fields because they get disposed
|
||||||
|
// as soon as the Dialog closes
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
private void saveInput() {
|
||||||
|
selectedFiles= tableViewer.getStructuredSelection().toList();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void okPressed() {
|
||||||
|
saveInput();
|
||||||
|
super.okPressed();
|
||||||
|
}
|
||||||
|
|
||||||
|
class FileGlobber {
|
||||||
|
|
||||||
|
List<PathMatcher> matchers;
|
||||||
|
|
||||||
|
public FileGlobber() {
|
||||||
|
matchers = new ArrayList<>(); }
|
||||||
|
|
||||||
|
public FileGlobber(String expr) {
|
||||||
|
ArrayList<PathMatcher> m = new ArrayList<>();
|
||||||
|
if(expr.length()>0) {
|
||||||
|
String[] tok = expr.split(";");
|
||||||
|
for (String string : tok) {
|
||||||
|
m.add(FileSystems.getDefault().getPathMatcher("glob:**/"+string));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
matchers = m;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean matches(Object f) {
|
||||||
|
assert(f instanceof File);
|
||||||
|
if(matchers.size()==0) return true;
|
||||||
|
for (PathMatcher m : matchers) {
|
||||||
|
if(m.matches(((File)f).toPath())) return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class FileTreeContentProvider implements ITreeContentProvider {
|
||||||
|
public Object[] getChildren(Object arg0) {
|
||||||
|
File[] entries = ((File) arg0).listFiles();
|
||||||
|
if(entries != null) {
|
||||||
|
List<File> res = Arrays.stream(entries)
|
||||||
|
.filter(file -> !(file.isFile()||file.getName().startsWith(".") ||globber.matches(file)))
|
||||||
|
.sorted(new Comparator<File>(){
|
||||||
|
public int compare(File f1, File f2){return f1.getName().compareTo(f2.getName());}
|
||||||
|
})
|
||||||
|
.collect(Collectors.toList()); ;
|
||||||
|
return res.toArray();
|
||||||
|
} else
|
||||||
|
return new Object[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
public Object getParent(Object arg0) {
|
||||||
|
return ((File) arg0).getParentFile();
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean hasChildren(Object arg0) {
|
||||||
|
Object[] obj = getChildren(arg0);
|
||||||
|
return obj == null ? false : obj.length > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Object[] getElements(Object arg0) {
|
||||||
|
return File.listRoots();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void dispose() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public void inputChanged(Viewer arg0, Object arg1, Object arg2) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class FileTreeLabelProvider implements ILabelProvider {
|
||||||
|
private List<ILabelProviderListener> listeners;
|
||||||
|
|
||||||
|
private Image file;
|
||||||
|
|
||||||
|
private Image dir;
|
||||||
|
|
||||||
|
public FileTreeLabelProvider() {
|
||||||
|
listeners = new ArrayList<ILabelProviderListener>();
|
||||||
|
}
|
||||||
|
|
||||||
|
public Image getImage(Object arg0) {
|
||||||
|
return ((File) arg0).isDirectory() ? folderImage : file;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getText(Object arg0) {
|
||||||
|
File f = (File)arg0;
|
||||||
|
return f.getName().length() == 0? f.getPath() : f.getName();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addListener(ILabelProviderListener arg0) {
|
||||||
|
listeners.add(arg0);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void dispose() {
|
||||||
|
// Dispose the images
|
||||||
|
if (dir != null)
|
||||||
|
dir.dispose();
|
||||||
|
if (file != null)
|
||||||
|
file.dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isLabelProperty(Object arg0, String arg1) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void removeListener(ILabelProviderListener arg0) {
|
||||||
|
listeners.remove(arg0);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public class FileTableFilter extends ViewerFilter {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean select(Viewer viewer, Object parentElement, Object element) {
|
||||||
|
File p = (File) element;
|
||||||
|
return !p.getName().startsWith(".");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public class FileTableComparator extends ViewerComparator {
|
||||||
|
private int propertyIndex = 0;
|
||||||
|
private boolean descending = false;
|
||||||
|
|
||||||
|
public FileTableComparator() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getDirection() {
|
||||||
|
return descending ? SWT.DOWN : SWT.UP;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setColumn(int column) {
|
||||||
|
descending = column == this.propertyIndex?!descending : false;
|
||||||
|
this.propertyIndex = column;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int compare(Viewer viewer, Object e1, Object e2) {
|
||||||
|
File p1 = (File) e1;
|
||||||
|
File p2 = (File) e2;
|
||||||
|
int rc = 0;
|
||||||
|
switch (propertyIndex) {
|
||||||
|
case 0:
|
||||||
|
rc = p1.getName().compareTo(p2.getName());
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
rc = Long.valueOf(p1.length()).compareTo(p2.length());
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
rc = 0;
|
||||||
|
}
|
||||||
|
// If descending order, flip the direction
|
||||||
|
return descending? -rc : rc;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public class FileTableLabelProvider extends ColumnLabelProvider {
|
||||||
|
@Override
|
||||||
|
public Color getBackground(Object element) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Color getForeground(Object element) {
|
||||||
|
return globber.matches(element) || ((File)element).isDirectory()? null: ResourceManager.getColor(SWT.COLOR_GRAY);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -10,8 +10,14 @@
|
|||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package com.minres.scviewer.e4.application.parts;
|
package com.minres.scviewer.e4.application.parts;
|
||||||
|
|
||||||
|
import java.util.AbstractMap;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.TreeMap;
|
||||||
import java.util.Vector;
|
import java.util.Vector;
|
||||||
|
import java.util.regex.PatternSyntaxException;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import javax.annotation.PostConstruct;
|
import javax.annotation.PostConstruct;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
@ -477,12 +483,19 @@ public class TransactionDetails {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if(element instanceof ITxAttribute){
|
if(element instanceof ITxAttribute){
|
||||||
return (((ITxAttribute) element).getName().toLowerCase().matches(searchString.toLowerCase()));
|
try {
|
||||||
|
return (((ITxAttribute) element).getName().toLowerCase().matches(searchString.toLowerCase()));
|
||||||
|
} catch (PatternSyntaxException e) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if(element instanceof Object[]) {
|
if(element instanceof Object[]) {
|
||||||
return (((Object[])element)[0]).toString().toLowerCase().matches(searchString.toLowerCase());
|
try {
|
||||||
|
return (((Object[])element)[0]).toString().toLowerCase().matches(searchString.toLowerCase());
|
||||||
|
} catch (PatternSyntaxException e) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -490,11 +503,13 @@ public class TransactionDetails {
|
|||||||
/**
|
/**
|
||||||
* The Enum Type.
|
* The Enum Type.
|
||||||
*/
|
*/
|
||||||
enum Type {/** The props. */
|
enum Type {
|
||||||
PROPS, /** The attrs. */
|
PROPS, /** The props. */
|
||||||
ATTRS, /** The in rel. */
|
ATTRS, /** The attrs. */
|
||||||
IN_REL, /** The out rel. */
|
IN_REL, /** The in rel. */
|
||||||
OUT_REL}
|
OUT_REL,/** The out rel. */
|
||||||
|
HIER
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Class TreeNode.
|
* The Class TreeNode.
|
||||||
@ -507,6 +522,7 @@ public class TransactionDetails {
|
|||||||
/** The element. */
|
/** The element. */
|
||||||
public ITx element;
|
public ITx element;
|
||||||
|
|
||||||
|
private String hier_path;
|
||||||
/**
|
/**
|
||||||
* Instantiates a new tree node.
|
* Instantiates a new tree node.
|
||||||
*
|
*
|
||||||
@ -516,6 +532,13 @@ public class TransactionDetails {
|
|||||||
public TreeNode(ITx element, Type type){
|
public TreeNode(ITx element, Type type){
|
||||||
this.element=element;
|
this.element=element;
|
||||||
this.type=type;
|
this.type=type;
|
||||||
|
this.hier_path="";
|
||||||
|
}
|
||||||
|
|
||||||
|
public TreeNode(ITx element, String path){
|
||||||
|
this.element=element;
|
||||||
|
this.type=Type.HIER;
|
||||||
|
this.hier_path=path;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
@ -527,9 +550,33 @@ public class TransactionDetails {
|
|||||||
case ATTRS: return Messages.TransactionDetails_11;
|
case ATTRS: return Messages.TransactionDetails_11;
|
||||||
case IN_REL: return Messages.TransactionDetails_12;
|
case IN_REL: return Messages.TransactionDetails_12;
|
||||||
case OUT_REL: return Messages.TransactionDetails_13;
|
case OUT_REL: return Messages.TransactionDetails_13;
|
||||||
|
case HIER:{
|
||||||
|
String[] tokens = hier_path.split("\\.");
|
||||||
|
return tokens[tokens.length-1];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return ""; //$NON-NLS-1$
|
return ""; //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Object[] getAttributeListForHier() {
|
||||||
|
if(childs==null) {
|
||||||
|
Map<String, Object> res = element.getAttributes().stream()
|
||||||
|
.filter(txAttr -> txAttr.getName().startsWith(hier_path))
|
||||||
|
.map(txAttr -> {
|
||||||
|
String target = hier_path.length()==0?txAttr.getName():txAttr.getName().replace(hier_path+'.', "");
|
||||||
|
String[] tokens = target.split("\\.");
|
||||||
|
if(tokens.length==1)
|
||||||
|
return new AbstractMap.SimpleEntry<>(tokens[0], txAttr);
|
||||||
|
else
|
||||||
|
return new AbstractMap.SimpleEntry<>(tokens[0], new TreeNode(element, hier_path.length()>0?hier_path+"."+tokens[0]:tokens[0]));
|
||||||
|
})
|
||||||
|
.collect(Collectors.toMap(p -> p.getKey(), p -> p.getValue(), (first, second) -> first));
|
||||||
|
childs = new TreeMap<String, Object>(res).values().toArray();
|
||||||
|
}
|
||||||
|
return childs;
|
||||||
|
}
|
||||||
|
|
||||||
|
private Object[] childs=null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -577,8 +624,8 @@ public class TransactionDetails {
|
|||||||
{Messages.TransactionDetails_19, Messages.TransactionDetails_20, timeToString(propertyHolder.element.getBeginTime())},
|
{Messages.TransactionDetails_19, Messages.TransactionDetails_20, timeToString(propertyHolder.element.getBeginTime())},
|
||||||
{Messages.TransactionDetails_21, Messages.TransactionDetails_20, timeToString(propertyHolder.element.getEndTime())}
|
{Messages.TransactionDetails_21, Messages.TransactionDetails_20, timeToString(propertyHolder.element.getEndTime())}
|
||||||
};
|
};
|
||||||
}else if(propertyHolder.type == Type.ATTRS)
|
}else if(propertyHolder.type == Type.ATTRS || propertyHolder.type == Type.HIER)
|
||||||
return propertyHolder.element.getAttributes().toArray();
|
return propertyHolder.getAttributeListForHier();
|
||||||
else if(propertyHolder.type == Type.IN_REL){
|
else if(propertyHolder.type == Type.IN_REL){
|
||||||
Vector<Object[] > res = new Vector<>();
|
Vector<Object[] > res = new Vector<>();
|
||||||
for(ITxRelation rel:propertyHolder.element.getIncomingRelations()){
|
for(ITxRelation rel:propertyHolder.element.getIncomingRelations()){
|
||||||
@ -655,7 +702,8 @@ public class TransactionDetails {
|
|||||||
case NAME:
|
case NAME:
|
||||||
if (element instanceof ITxAttribute) {
|
if (element instanceof ITxAttribute) {
|
||||||
ITxAttribute attribute = (ITxAttribute) element;
|
ITxAttribute attribute = (ITxAttribute) element;
|
||||||
return new StyledString(attribute.getName());
|
String[] tokens = attribute.getName().split("\\.");
|
||||||
|
return new StyledString(tokens[tokens.length-1]);
|
||||||
}else if (element instanceof ITxRelation) {
|
}else if (element instanceof ITxRelation) {
|
||||||
return new StyledString(Messages.TransactionDetails_4);
|
return new StyledString(Messages.TransactionDetails_4);
|
||||||
}else if(element instanceof Object[]){
|
}else if(element instanceof Object[]){
|
||||||
|
@ -669,7 +669,7 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
|
|||||||
}
|
}
|
||||||
if (filesToLoad.size() > 0)
|
if (filesToLoad.size() > 0)
|
||||||
loadDatabase(persistedState);
|
loadDatabase(persistedState);
|
||||||
if(partConfig instanceof String) {
|
if(partConfig instanceof String && ((String)partConfig).length()>0) {
|
||||||
loadState((String) partConfig);
|
loadState((String) partConfig);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
<relativePath>../com.minres.scviewer.parent</relativePath>
|
<relativePath>../com.minres.scviewer.parent</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<artifactId>com.minres.scviewer.e4.product</artifactId>
|
<artifactId>com.minres.scviewer.e4.product</artifactId>
|
||||||
<version>2.4.2-SNAPSHOT</version>
|
<version>2.6.0-SNAPSHOT</version>
|
||||||
<packaging>eclipse-repository</packaging>
|
<packaging>eclipse-repository</packaging>
|
||||||
<groupId>com.minres.scviewer</groupId>
|
<groupId>com.minres.scviewer</groupId>
|
||||||
<build>
|
<build>
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<?pde version="3.5"?>
|
<?pde version="3.5"?>
|
||||||
|
|
||||||
<product name="SCViewer" uid="scviewer" id="com.minres.scviewer.e4.application.product" application="org.eclipse.e4.ui.workbench.swt.E4Application" version="2.4.2.qualifier" useFeatures="false" includeLaunchers="true">
|
<product name="SCViewer" uid="scviewer" id="com.minres.scviewer.e4.application.product" application="org.eclipse.e4.ui.workbench.swt.E4Application" version="2.6.0.qualifier" useFeatures="false" includeLaunchers="true">
|
||||||
|
|
||||||
<configIni use="default">
|
<configIni use="default">
|
||||||
</configIni>
|
</configIni>
|
||||||
@ -56,6 +56,7 @@
|
|||||||
<plugin id="com.minres.scviewer.database.vcd"/>
|
<plugin id="com.minres.scviewer.database.vcd"/>
|
||||||
<plugin id="com.minres.scviewer.e4.application"/>
|
<plugin id="com.minres.scviewer.e4.application"/>
|
||||||
<plugin id="com.opcoach.e4.preferences"/>
|
<plugin id="com.opcoach.e4.preferences"/>
|
||||||
|
<plugin id="com.opcoach.e4.preferences.mainmenu"/>
|
||||||
<plugin id="javax.annotation"/>
|
<plugin id="javax.annotation"/>
|
||||||
<plugin id="javax.inject"/>
|
<plugin id="javax.inject"/>
|
||||||
<plugin id="org.apache.batik.constants"/>
|
<plugin id="org.apache.batik.constants"/>
|
||||||
@ -113,7 +114,6 @@
|
|||||||
<plugin id="org.eclipse.equinox.app"/>
|
<plugin id="org.eclipse.equinox.app"/>
|
||||||
<plugin id="org.eclipse.equinox.common"/>
|
<plugin id="org.eclipse.equinox.common"/>
|
||||||
<plugin id="org.eclipse.equinox.concurrent"/>
|
<plugin id="org.eclipse.equinox.concurrent"/>
|
||||||
<plugin id="org.eclipse.equinox.ds"/>
|
|
||||||
<plugin id="org.eclipse.equinox.event"/>
|
<plugin id="org.eclipse.equinox.event"/>
|
||||||
<plugin id="org.eclipse.equinox.preferences"/>
|
<plugin id="org.eclipse.equinox.preferences"/>
|
||||||
<plugin id="org.eclipse.equinox.registry"/>
|
<plugin id="org.eclipse.equinox.registry"/>
|
||||||
|
@ -30,11 +30,12 @@ http://www.eclipse.org/legal/epl-v10.html
|
|||||||
|
|
||||||
<requires>
|
<requires>
|
||||||
<import plugin="org.eclipse.equinox.ds" version="1.4.200" match="greaterOrEqual"/>
|
<import plugin="org.eclipse.equinox.ds" version="1.4.200" match="greaterOrEqual"/>
|
||||||
<import plugin="org.eclipse.equinox.util" version="1.0.500" match="greaterOrEqual"/>
|
|
||||||
<import plugin="org.eclipse.osgi.services" version="3.4.0" match="greaterOrEqual"/>
|
<import plugin="org.eclipse.osgi.services" version="3.4.0" match="greaterOrEqual"/>
|
||||||
<import plugin="com.minres.scviewer.database" version="1.0.0" match="greaterOrEqual"/>
|
<import plugin="com.google.guava" version="15.0.0" match="greaterOrEqual"/>
|
||||||
<import plugin="org.codehaus.groovy" version="1.8.6" match="greaterOrEqual"/>
|
|
||||||
<import plugin="org.eclipse.osgi"/>
|
<import plugin="org.eclipse.osgi"/>
|
||||||
|
<import plugin="com.minres.scviewer.database" version="1.0.0" match="greaterOrEqual"/>
|
||||||
|
<import plugin="com.minres.scviewer.database.ui" version="1.0.0" match="greaterOrEqual"/>
|
||||||
|
<import plugin="com.minres.scviewer.database.ui.swt" version="1.0.0" match="greaterOrEqual"/>
|
||||||
<import plugin="org.eclipse.core.runtime"/>
|
<import plugin="org.eclipse.core.runtime"/>
|
||||||
<import plugin="org.eclipse.core.resources"/>
|
<import plugin="org.eclipse.core.resources"/>
|
||||||
<import plugin="org.eclipse.jface.text"/>
|
<import plugin="org.eclipse.jface.text"/>
|
||||||
@ -43,15 +44,12 @@ http://www.eclipse.org/legal/epl-v10.html
|
|||||||
<import plugin="org.eclipse.ui.ide"/>
|
<import plugin="org.eclipse.ui.ide"/>
|
||||||
<import plugin="org.eclipse.ui.views.properties.tabbed"/>
|
<import plugin="org.eclipse.ui.views.properties.tabbed"/>
|
||||||
<import plugin="org.eclipse.swt"/>
|
<import plugin="org.eclipse.swt"/>
|
||||||
<import plugin="org.apache.ant"/>
|
|
||||||
<import plugin="com.google.guava" version="15.0.0" match="greaterOrEqual"/>
|
|
||||||
<import plugin="com.minres.scviewer.database.ui" version="1.0.0" match="greaterOrEqual"/>
|
|
||||||
<import plugin="com.minres.scviewer.database.ui.swt" version="1.0.0" match="greaterOrEqual"/>
|
|
||||||
<import plugin="org.eclipse.core.expressions" version="3.4.600" match="greaterOrEqual"/>
|
<import plugin="org.eclipse.core.expressions" version="3.4.600" match="greaterOrEqual"/>
|
||||||
<import plugin="org.eclipse.jface"/>
|
<import plugin="org.eclipse.jface"/>
|
||||||
<import plugin="org.junit"/>
|
|
||||||
<import plugin="org.eclipse.swt" version="3.103.1" match="greaterOrEqual"/>
|
<import plugin="org.eclipse.swt" version="3.103.1" match="greaterOrEqual"/>
|
||||||
<import plugin="org.eclipse.equinox.registry"/>
|
<import plugin="org.eclipse.equinox.registry"/>
|
||||||
|
<import plugin="org.codehaus.groovy" version="2.5.8" match="greaterOrEqual"/>
|
||||||
|
<import plugin="org.hamcrest.core" version="1.3.0" match="greaterOrEqual"/>
|
||||||
</requires>
|
</requires>
|
||||||
|
|
||||||
<plugin
|
<plugin
|
||||||
|
@ -24,8 +24,8 @@
|
|||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
<tycho-version>1.5.0</tycho-version>
|
<tycho-version>1.5.0</tycho-version>
|
||||||
<groovy-eclipse-compiler-version>3.5.0</groovy-eclipse-compiler-version>
|
<groovy-eclipse-compiler-version>3.6.0-03</groovy-eclipse-compiler-version>
|
||||||
<groovy-eclipse-batch-version>2.5.8-03</groovy-eclipse-batch-version>
|
<groovy-eclipse-batch-version>3.0.3-01</groovy-eclipse-batch-version>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
|
Reference in New Issue
Block a user