Compare commits
85 Commits
Author | SHA1 | Date | |
---|---|---|---|
2a930720be | |||
2b1cb7856f | |||
f1d080983a | |||
767b083a22 | |||
348ffe20d6 | |||
9b6908f193 | |||
0cfcc8c118 | |||
ec5cd209c6 | |||
5933bcd512 | |||
14ac6654b9 | |||
cea11743eb | |||
210d925987 | |||
ffbffd88f1 | |||
ec8d54dca3 | |||
e8682e446b | |||
e87e1791c3 | |||
f5a4e3c39e | |||
306e20d14f | |||
c76805d133 | |||
8ebb2dc3a6 | |||
669fd6a881 | |||
8e66e5fe0b | |||
674aa7d3ce | |||
2b7c9a240f | |||
18f2a110f0 | |||
27f1e8ca6a | |||
3565a6a05b | |||
aef4901b2b | |||
d77aaa3865 | |||
b398a07fd7 | |||
732bd82034 | |||
2ccc5274aa | |||
9f4f71046d | |||
d73b01f77d | |||
77302521b2 | |||
f89471e14b | |||
0634556256 | |||
4f097e7f59 | |||
f1abc645c3 | |||
2c8b7129e9 | |||
2f81529f93 | |||
8f76d816f1 | |||
594a71a9ba | |||
0fa0d4a5b8 | |||
97443c6cd8 | |||
c3486eb6c8 | |||
8a286a8eac | |||
e4329213fa | |||
857bbe17d7 | |||
091cb1cf7f | |||
0623b8de4a | |||
8b55548cca | |||
a0a4ea1f53 | |||
e034d1faad | |||
68660d0892 | |||
a0f0b55045 | |||
3d20b6961e | |||
ca02c92a18 | |||
347dbf134b | |||
44ac32359f | |||
48c7d81b8a | |||
e945a3acbe | |||
145dfbd74d | |||
b7646dc29e | |||
475181c8df | |||
3d043ce1b7 | |||
7e2869b7ee | |||
51d9d7e25c | |||
ed665ac032 | |||
689d7874f4 | |||
c7c1f97b0c | |||
7b2db09585 | |||
52f3f7b348 | |||
429ea37080 | |||
04f011e82f | |||
3a6ed3ce7e | |||
79eb8073d8 | |||
4ea841cc7b | |||
6bf642d2af | |||
15c24f0925 | |||
4d4a6579c6 | |||
b648dccfd8 | |||
f9425834a3 | |||
e0d00e6402 | |||
b1b7517759 |
@ -1,2 +0,0 @@
|
||||
eclipse.preferences.version=1
|
||||
encoding/<project>=UTF-8
|
@ -5,10 +5,7 @@ Bundle-SymbolicName: com.minres.scviewer.database.sqlite
|
||||
Bundle-Version: 1.0.0.qualifier
|
||||
Bundle-Vendor: MINRES Technologies GmbH
|
||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
|
||||
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.osgi.services;bundle-version="3.4.0"
|
||||
Require-Bundle: com.minres.scviewer.database;bundle-version="1.0.0"
|
||||
Bundle-ClassPath: .,sqlite-jdbc-3.8.7.jar
|
||||
Service-Component: OSGI-INF/component.xml
|
||||
Bundle-ActivationPolicy: lazy
|
||||
|
@ -14,6 +14,7 @@ import java.beans.IntrospectionException;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
@ -91,6 +92,8 @@ public class SQLiteDbLoader implements IWaveformDbLoader {
|
||||
if (buffer[i] != x[i]) return false;
|
||||
} catch(FileNotFoundException e) {
|
||||
return false;
|
||||
} catch(IOException e) { //if an I/O error occurs
|
||||
return false;
|
||||
}
|
||||
database=new SQLiteDatabase(file.getAbsolutePath());
|
||||
database.setData("TIMERESOLUTION", 1L);
|
||||
|
@ -193,7 +193,7 @@ public class TxStream extends HierNode implements ITxStream<ITxEvent> {
|
||||
|
||||
@Override
|
||||
public Boolean equals(IWaveform other) {
|
||||
return(other instanceof TxStream && this.getId()==other.getId());
|
||||
return(other instanceof TxStream && this.getId().equals(other.getId()));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -2,6 +2,10 @@
|
||||
<classpath>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
|
||||
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="src" path="src/">
|
||||
<attributes>
|
||||
<attribute name="test" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="output" path="target/classes"/>
|
||||
</classpath>
|
||||
|
@ -1,3 +0,0 @@
|
||||
eclipse.preferences.version=1
|
||||
encoding//src/com/minres/scviewer/database/test/DatabaseServicesTest.java=UTF-8
|
||||
encoding/<project>=UTF-8
|
@ -2,7 +2,7 @@ Manifest-Version: 1.0
|
||||
Bundle-ManifestVersion: 2
|
||||
Bundle-Name: SCViewer database tests
|
||||
Bundle-SymbolicName: com.minres.scviewer.database.test
|
||||
Bundle-Version: 1.0.0.qualifier
|
||||
Bundle-Version: 1.0.1.qualifier
|
||||
Bundle-Vendor: MINRES Technologies GnbH
|
||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
|
||||
Require-Bundle: org.junit,
|
||||
|
238
com.minres.scviewer.database.test/inputs/my_db_truncated.txlog
Normal file
238
com.minres.scviewer.database.test/inputs/my_db_truncated.txlog
Normal file
@ -0,0 +1,238 @@
|
||||
scv_tr_stream (ID 1, name "tr.pipelined_stream", kind "transactor")
|
||||
scv_tr_stream (ID 2, name "tr.addr_stream", kind "transactor")
|
||||
scv_tr_stream (ID 3, name "tr.data_stream", kind "transactor")
|
||||
scv_tr_generator (ID 4, name "read", scv_tr_stream 1,
|
||||
begin_attribute (ID 0, name "addr", type "UNSIGNED")
|
||||
end_attribute (ID 1, name "data", type "UNSIGNED")
|
||||
)
|
||||
scv_tr_generator (ID 5, name "write", scv_tr_stream 1,
|
||||
begin_attribute (ID 0, name "addr", type "UNSIGNED")
|
||||
end_attribute (ID 1, name "data", type "UNSIGNED")
|
||||
)
|
||||
scv_tr_generator (ID 6, name "addr", scv_tr_stream 2,
|
||||
begin_attribute (ID 0, name "addr", type "UNSIGNED")
|
||||
)
|
||||
scv_tr_generator (ID 7, name "rdata", scv_tr_stream 3,
|
||||
end_attribute (ID 0, name "data", type "UNSIGNED")
|
||||
)
|
||||
scv_tr_generator (ID 8, name "wdata", scv_tr_stream 3,
|
||||
begin_attribute (ID 0, name "data", type "UNSIGNED")
|
||||
)
|
||||
tx_begin 1 4 0 s
|
||||
a 0
|
||||
tx_record_attribute 1 "data_size" UNSIGNED = 24
|
||||
tx_begin 2 6 0 s
|
||||
a 0
|
||||
tx_relation "addr_phase" 2 1
|
||||
tx_end 2 6 180 ns
|
||||
tx_begin 3 7 180 ns
|
||||
tx_relation "data_phase" 3 1
|
||||
tx_begin 4 4 180 ns
|
||||
a 0
|
||||
tx_record_attribute 4 "data_size" UNSIGNED = 24
|
||||
tx_begin 5 6 180 ns
|
||||
a 0
|
||||
tx_relation "addr_phase" 5 4
|
||||
tx_end 5 6 300 ns
|
||||
tx_end 3 7 420 ns
|
||||
a 0
|
||||
tx_end 1 4 420 ns
|
||||
a 0
|
||||
tx_begin 6 4 420 ns
|
||||
a 1
|
||||
tx_record_attribute 6 "data_size" UNSIGNED = 24
|
||||
tx_begin 7 6 420 ns
|
||||
a 1
|
||||
tx_relation "addr_phase" 7 6
|
||||
tx_begin 8 7 420 ns
|
||||
tx_relation "data_phase" 8 4
|
||||
tx_end 7 6 480 ns
|
||||
tx_end 8 7 620 ns
|
||||
a 0
|
||||
tx_end 4 4 620 ns
|
||||
a 0
|
||||
tx_begin 9 4 620 ns
|
||||
a 1
|
||||
tx_record_attribute 9 "data_size" UNSIGNED = 24
|
||||
tx_begin 10 6 620 ns
|
||||
a 1
|
||||
tx_relation "addr_phase" 10 9
|
||||
tx_begin 11 7 620 ns
|
||||
tx_relation "data_phase" 11 6
|
||||
tx_end 11 7 700 ns
|
||||
a 1
|
||||
tx_end 6 4 700 ns
|
||||
a 1
|
||||
tx_end 10 6 760 ns
|
||||
tx_begin 12 7 760 ns
|
||||
tx_relation "data_phase" 12 9
|
||||
tx_begin 13 4 760 ns
|
||||
a 2
|
||||
tx_record_attribute 13 "data_size" UNSIGNED = 24
|
||||
tx_begin 14 6 760 ns
|
||||
a 2
|
||||
tx_relation "addr_phase" 14 13
|
||||
tx_end 14 6 880 ns
|
||||
tx_end 12 7 980 ns
|
||||
a 1
|
||||
tx_end 9 4 980 ns
|
||||
a 1
|
||||
tx_begin 15 4 980 ns
|
||||
a 2
|
||||
tx_record_attribute 15 "data_size" UNSIGNED = 24
|
||||
tx_begin 16 6 980 ns
|
||||
a 2
|
||||
tx_relation "addr_phase" 16 15
|
||||
tx_begin 17 7 980 ns
|
||||
tx_relation "data_phase" 17 13
|
||||
tx_end 16 6 1040 ns
|
||||
tx_end 17 7 1200 ns
|
||||
a 2
|
||||
tx_end 13 4 1200 ns
|
||||
a 2
|
||||
tx_begin 18 4 1200 ns
|
||||
a 120
|
||||
tx_record_attribute 18 "data_size" UNSIGNED = 24
|
||||
tx_begin 19 6 1200 ns
|
||||
a 120
|
||||
tx_relation "addr_phase" 19 18
|
||||
tx_begin 20 7 1200 ns
|
||||
tx_relation "data_phase" 20 15
|
||||
tx_end 19 6 1300 ns
|
||||
tx_end 20 7 1340 ns
|
||||
a 2
|
||||
tx_end 15 4 1340 ns
|
||||
a 2
|
||||
tx_begin 21 4 1340 ns
|
||||
a 11
|
||||
tx_record_attribute 21 "data_size" UNSIGNED = 24
|
||||
tx_begin 22 6 1340 ns
|
||||
a 11
|
||||
tx_relation "addr_phase" 22 21
|
||||
tx_begin 23 7 1340 ns
|
||||
tx_relation "data_phase" 23 18
|
||||
tx_end 23 7 1420 ns
|
||||
a 120
|
||||
tx_end 18 4 1420 ns
|
||||
a 120
|
||||
tx_end 22 6 1540 ns
|
||||
tx_begin 24 7 1540 ns
|
||||
tx_relation "data_phase" 24 21
|
||||
tx_begin 25 4 1540 ns
|
||||
a 147
|
||||
tx_record_attribute 25 "data_size" UNSIGNED = 24
|
||||
tx_begin 26 6 1540 ns
|
||||
a 147
|
||||
tx_relation "addr_phase" 26 25
|
||||
tx_end 24 7 1660 ns
|
||||
a 11
|
||||
tx_end 21 4 1660 ns
|
||||
a 11
|
||||
tx_end 26 6 1740 ns
|
||||
tx_begin 27 7 1740 ns
|
||||
tx_relation "data_phase" 27 25
|
||||
tx_begin 28 4 1740 ns
|
||||
a 99
|
||||
tx_record_attribute 28 "data_size" UNSIGNED = 24
|
||||
tx_begin 29 6 1740 ns
|
||||
a 99
|
||||
tx_relation "addr_phase" 29 28
|
||||
tx_end 29 6 1800 ns
|
||||
tx_end 27 7 1980 ns
|
||||
a 147
|
||||
tx_end 25 4 1980 ns
|
||||
a 147
|
||||
tx_begin 30 4 1980 ns
|
||||
a 55
|
||||
tx_record_attribute 30 "data_size" UNSIGNED = 24
|
||||
tx_begin 31 6 1980 ns
|
||||
a 55
|
||||
tx_relation "addr_phase" 31 30
|
||||
tx_begin 32 7 1980 ns
|
||||
tx_relation "data_phase" 32 28
|
||||
tx_end 32 7 2060 ns
|
||||
a 99
|
||||
tx_end 28 4 2060 ns
|
||||
a 99
|
||||
tx_end 31 6 2100 ns
|
||||
tx_begin 33 7 2100 ns
|
||||
tx_relation "data_phase" 33 30
|
||||
tx_begin 34 4 2100 ns
|
||||
a 126
|
||||
tx_record_attribute 34 "data_size" UNSIGNED = 24
|
||||
tx_begin 35 6 2100 ns
|
||||
a 126
|
||||
tx_relation "addr_phase" 35 34
|
||||
tx_end 33 7 2340 ns
|
||||
a 55
|
||||
tx_end 30 4 2340 ns
|
||||
a 55
|
||||
tx_end 35 6 2340 ns
|
||||
tx_begin 36 7 2340 ns
|
||||
tx_relation "data_phase" 36 34
|
||||
tx_begin 37 5 2340 ns
|
||||
a 204
|
||||
tx_record_attribute 37 "data_size" UNSIGNED = 24
|
||||
tx_begin 38 6 2340 ns
|
||||
a 204
|
||||
tx_relation "addr_phase" 38 37
|
||||
tx_end 38 6 2400 ns
|
||||
tx_end 36 7 2540 ns
|
||||
a 126
|
||||
tx_end 34 4 2540 ns
|
||||
a 126
|
||||
tx_begin 39 5 2540 ns
|
||||
a 242
|
||||
tx_record_attribute 39 "data_size" UNSIGNED = 24
|
||||
tx_begin 40 6 2540 ns
|
||||
a 242
|
||||
tx_relation "addr_phase" 40 39
|
||||
tx_begin 41 8 2540 ns
|
||||
a 211
|
||||
tx_relation "data_phase" 41 37
|
||||
tx_end 41 8 2640 ns
|
||||
tx_end 37 5 2640 ns
|
||||
a 211
|
||||
tx_end 40 6 2780 ns
|
||||
tx_begin 42 8 2780 ns
|
||||
a 58
|
||||
tx_relation "data_phase" 42 39
|
||||
tx_begin 43 5 2780 ns
|
||||
a 135
|
||||
tx_record_attribute 43 "data_size" UNSIGNED = 24
|
||||
tx_begin 44 6 2780 ns
|
||||
a 135
|
||||
tx_relation "addr_phase" 44 43
|
||||
tx_end 44 6 2960 ns
|
||||
tx_end 42 8 3 us
|
||||
tx_end 39 5 3 us
|
||||
a 58
|
||||
tx_begin 45 5 3 us
|
||||
a 26
|
||||
tx_record_attribute 45 "data_size" UNSIGNED = 24
|
||||
tx_begin 46 6 3 us
|
||||
a 26
|
||||
tx_relation "addr_phase" 46 45
|
||||
tx_begin 47 8 3 us
|
||||
a 31
|
||||
tx_relation "data_phase" 47 43
|
||||
tx_end 47 8 3140 ns
|
||||
tx_end 43 5 3140 ns
|
||||
a 31
|
||||
tx_end 46 6 3200 ns
|
||||
tx_begin 48 8 3200 ns
|
||||
a 37
|
||||
tx_relation "data_phase" 48 45
|
||||
tx_begin 49 5 3200 ns
|
||||
a 176
|
||||
tx_record_attribute 49 "data_size" UNSIGNED = 24
|
||||
tx_begin 50 6 3200 ns
|
||||
a 176
|
||||
tx_relation "addr_phase" 50 49
|
||||
tx_end 50 6 3300 ns
|
||||
tx_end 48 8 3380 ns
|
||||
tx_end 45 5 3380 ns
|
||||
a 37
|
||||
tx_begin 51 5 3380 ns
|
||||
a 58
|
||||
tx_record_attribute 51 "data_
|
@ -2,6 +2,7 @@
|
||||
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>
|
||||
<artifactId>com.minres.scviewer.database.test</artifactId>
|
||||
<version>1.0.1-SNAPSHOT</version>
|
||||
<parent>
|
||||
<groupId>com.minres.scviewer</groupId>
|
||||
<artifactId>com.minres.scviewer.parent</artifactId>
|
||||
@ -14,7 +15,7 @@
|
||||
<plugin>
|
||||
<groupId>org.eclipse.tycho</groupId>
|
||||
<artifactId>tycho-surefire-plugin</artifactId>
|
||||
<version>0.23.1</version>
|
||||
<version>${tycho-version}</version>
|
||||
<configuration>
|
||||
<!-- <bundleStartLevel /> -->
|
||||
<dependencies>
|
||||
@ -27,5 +28,4 @@
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
<version>1.0.0-SNAPSHOT</version>
|
||||
</project>
|
@ -100,6 +100,16 @@ public class DatabaseServicesTest {
|
||||
assertEquals(1, waveformDb.getChildNodes().size());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testTxTextTruncated() throws Exception {
|
||||
File f = new File("inputs/my_db_truncated.txlog").getAbsoluteFile();
|
||||
assertTrue(f.exists());
|
||||
waveformDb.load(f);
|
||||
assertNotNull(waveformDb);
|
||||
assertEquals(3, waveformDb.getAllWaves().size());
|
||||
assertEquals(1, waveformDb.getChildNodes().size());
|
||||
}
|
||||
|
||||
//@Test
|
||||
public void testTxLDb() throws Exception {
|
||||
File f = new File("inputs/my_ldb.txldb").getAbsoluteFile();
|
||||
|
@ -1,19 +1,22 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry exported="true" kind="lib" path="lib/elsa-3.0.0-M5.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/eclipse-collections-9.2.0.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/eclipse-collections-api-9.2.0.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/eclipse-collections-forkjoin-9.2.0.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/kotlin-stdlib-1.2.42.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/lz4-1.3.0.jar"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
|
||||
<attributes>
|
||||
<attribute name="maven.pomderived" value="true"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/mapdb-3.0.7.jar" sourcepath="lib/mapdb-3.0.7-sources.jar">
|
||||
<attributes>
|
||||
<attribute name="javadoc_location" value="jar:platform:/resource/com.minres.scviewer.database.text/lib/mapdb-3.0.7-javadoc.jar!/"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
|
||||
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry exported="true" kind="con" path="GROOVY_DSL_SUPPORT"/>
|
||||
<classpathentry kind="src" path="src/"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/eclipse-collections-9.2.0.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/eclipse-collections-api-9.2.0.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/eclipse-collections-forkjoin-9.2.0.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/kotlin-stdlib-1.2.42.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/lz4-1.3.0.jar"/>
|
||||
<classpathentry exported="true" kind="lib" path="lib/elsa-3.0.0-M5.jar"/>
|
||||
<classpathentry kind="output" path="target/classes"/>
|
||||
</classpath>
|
||||
|
@ -5,4 +5,5 @@ org.eclipse.jdt.core.compiler.compliance=1.8
|
||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
|
||||
org.eclipse.jdt.core.compiler.release=disabled
|
||||
org.eclipse.jdt.core.compiler.source=1.8
|
||||
|
@ -1,2 +1,2 @@
|
||||
eclipse.preferences.version=1
|
||||
groovy.compiler.level=26
|
||||
groovy.compiler.level=25
|
||||
|
@ -2,12 +2,12 @@ Manifest-Version: 1.0
|
||||
Bundle-ManifestVersion: 2
|
||||
Bundle-Name: Textual transaction database
|
||||
Bundle-SymbolicName: com.minres.scviewer.database.text
|
||||
Bundle-Version: 2.0.0.qualifier
|
||||
Bundle-Version: 2.0.2.qualifier
|
||||
Bundle-Vendor: MINRES Technologies GmbH
|
||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
|
||||
Import-Package: org.osgi.framework;version="1.3.0"
|
||||
Require-Bundle: com.minres.scviewer.database;bundle-version="1.0.0",
|
||||
org.codehaus.groovy;bundle-version="1.8.6",
|
||||
Require-Bundle: com.minres.scviewer.database,
|
||||
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.osgi.services;bundle-version="3.4.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">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>com.minres.scviewer.database.text</artifactId>
|
||||
<version>2.0.0-SNAPSHOT</version>
|
||||
<version>2.0.2-SNAPSHOT</version>
|
||||
<parent>
|
||||
<groupId>com.minres.scviewer</groupId>
|
||||
<artifactId>com.minres.scviewer.parent</artifactId>
|
||||
@ -15,10 +15,13 @@
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.eclipse.tycho</groupId>
|
||||
<artifactId>tycho-compiler-plugin</artifactId>
|
||||
<version>0.23.1</version>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.8.0</version>
|
||||
<configuration>
|
||||
<compilerId>groovy-eclipse-compiler</compilerId>
|
||||
<compilerArguments>
|
||||
<indy/><!-- optional; supported by batch 2.4.12-04+ -->
|
||||
</compilerArguments>
|
||||
<!-- set verbose to be true if you want lots of uninteresting messages -->
|
||||
<!-- <verbose>true</verbose> -->
|
||||
<source>1.7</source>
|
||||
@ -34,8 +37,6 @@
|
||||
<groupId>org.codehaus.groovy</groupId>
|
||||
<artifactId>groovy-eclipse-batch</artifactId>
|
||||
<version>${groovy-eclipse-batch-version}</version>
|
||||
<!-- or choose a different compiler version -->
|
||||
<!-- <version>2.1.8-01</version> -->
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</plugin>
|
||||
|
@ -80,14 +80,23 @@ public class TextDbLoader implements IWaveformDbLoader{
|
||||
.allocateStartSize(64*1024*1024)
|
||||
.allocateIncrement(64*1024*1024)
|
||||
.make()
|
||||
// NPE here --->
|
||||
parseInput(gzipped?new GZIPInputStream(new FileInputStream(file)):new FileInputStream(file))
|
||||
calculateConcurrencyIndicees()
|
||||
return true
|
||||
}
|
||||
} catch (IndexOutOfBoundsException e) {
|
||||
return false
|
||||
} catch (IllegalArgumentException e) {
|
||||
return false
|
||||
} catch (NumberFormatException e) {
|
||||
return false
|
||||
} catch(EOFException e) {
|
||||
return true;
|
||||
} catch(Exception e) {
|
||||
e.printStackTrace()
|
||||
System.out.println("---->>> Exception "+e.toString()+" caught while loading database");
|
||||
//System.out.println("---->>> Exception "+e.toString()+" caught while loading database. StackTrace following... ");
|
||||
//e.printStackTrace()
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@ -113,7 +122,7 @@ public class TextDbLoader implements IWaveformDbLoader{
|
||||
} catch (IOException e) {
|
||||
return false;
|
||||
} finally {
|
||||
is.close()
|
||||
if(is!=null) is.close()
|
||||
}
|
||||
}
|
||||
|
||||
@ -126,7 +135,9 @@ public class TextDbLoader implements IWaveformDbLoader{
|
||||
case "ms":return 1000000000000L
|
||||
case "s": return 1000000000000000L
|
||||
}
|
||||
return "fs"
|
||||
}
|
||||
|
||||
private def parseInput(InputStream inputStream){
|
||||
def streamsById = [:]
|
||||
def generatorsById = [:]
|
||||
@ -138,7 +149,7 @@ public class TextDbLoader implements IWaveformDbLoader{
|
||||
BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream, "UTF-8"));
|
||||
long lineCnt=0;
|
||||
reader.eachLine { line ->
|
||||
def tokens = line.split(/\s+/)
|
||||
def tokens = line.split(/\s+/) as ArrayList
|
||||
switch(tokens[0]){
|
||||
case "scv_tr_stream":
|
||||
case "scv_tr_generator":
|
||||
@ -185,7 +196,10 @@ public class TextDbLoader implements IWaveformDbLoader{
|
||||
break
|
||||
case "tx_record_attribute"://matcher = line =~ /^tx_record_attribute\s+(\d+)\s+"([^"]+)"\s+(\S+)\s*=\s*(.+)$/
|
||||
def id = Integer.parseInt(tokens[1])
|
||||
transactionsById[id].attributes<<new TxAttribute(tokens[2][1..-2], DataType.valueOf(tokens[3]), AssociationType.RECORD, tokens[5..-1].join(' '))
|
||||
def name = tokens[2][1..-2]
|
||||
def type = tokens[3] as DataType
|
||||
def remaining = tokens.size()>5?tokens[5..-1].join(' '):""
|
||||
transactionsById[id].attributes<<new TxAttribute(name, type, AssociationType.RECORD, remaining)
|
||||
break
|
||||
case "a"://matcher = line =~ /^a\s+(.+)$/
|
||||
if(endTransaction){
|
||||
@ -213,6 +227,26 @@ 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() }
|
||||
}
|
||||
|
@ -1,2 +0,0 @@
|
||||
eclipse.preferences.version=1
|
||||
encoding/<project>=UTF-8
|
@ -2,7 +2,7 @@ Manifest-Version: 1.0
|
||||
Bundle-ManifestVersion: 2
|
||||
Bundle-Name: SWT widget
|
||||
Bundle-SymbolicName: com.minres.scviewer.database.ui.swt
|
||||
Bundle-Version: 2.0.1.qualifier
|
||||
Bundle-Version: 2.2.0.qualifier
|
||||
Bundle-Vendor: MINRES Technologies GmbH
|
||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
|
||||
Require-Bundle: org.eclipse.swt;bundle-version="3.103.1",
|
||||
|
@ -8,5 +8,5 @@
|
||||
<version>2.0.0-SNAPSHOT</version>
|
||||
<relativePath>../com.minres.scviewer.parent</relativePath>
|
||||
</parent>
|
||||
<version>2.0.1-SNAPSHOT</version>
|
||||
<version>2.2.0-SNAPSHOT</version>
|
||||
</project>
|
@ -2,8 +2,11 @@ package com.minres.scviewer.database.swt;
|
||||
|
||||
public class Constants {
|
||||
|
||||
public final static String[] unitString={"fs", "ps", "ns", "us", "ms"};//, "s"};
|
||||
public static final String[] unitString={"fs", "ps", "ns", "us", "ms"};//, "s"};
|
||||
|
||||
public final static int[] unitMultiplier={1, 3, 10, 30, 100, 300};
|
||||
public static final int[] unitMultiplier={1, 3, 10, 30, 100, 300};
|
||||
|
||||
public static final String CONTENT_PROVIDER_TAG = "TOOLTIP_CONTENT_PROVIDER";
|
||||
public static final String HELP_PROVIDER_TAG = "TOOLTIP_HELP_PROVIDER";
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,10 @@
|
||||
package com.minres.scviewer.database.swt;
|
||||
|
||||
import org.eclipse.swt.graphics.Point;
|
||||
import org.eclipse.swt.widgets.Composite;
|
||||
|
||||
public interface ToolTipContentProvider {
|
||||
|
||||
public boolean createContent(Composite parent, Point pt);
|
||||
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
package com.minres.scviewer.database.swt;
|
||||
|
||||
import org.eclipse.swt.widgets.Widget;
|
||||
|
||||
public interface ToolTipHelpTextProvider {
|
||||
/**
|
||||
* Get help text
|
||||
* @param widget the widget that is under help
|
||||
* @return a help text string
|
||||
*/
|
||||
public String getHelpText(Widget widget);
|
||||
}
|
@ -0,0 +1,73 @@
|
||||
package com.minres.scviewer.database.swt.internal;
|
||||
|
||||
import static org.eclipse.swt.events.SelectionListener.widgetSelectedAdapter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.layout.RowLayout;
|
||||
import org.eclipse.swt.widgets.Button;
|
||||
import org.eclipse.swt.widgets.Dialog;
|
||||
import org.eclipse.swt.widgets.Display;
|
||||
import org.eclipse.swt.widgets.Label;
|
||||
import org.eclipse.swt.widgets.List;
|
||||
import org.eclipse.swt.widgets.Shell;
|
||||
|
||||
import com.minres.scviewer.database.ITx;
|
||||
import com.minres.scviewer.database.ITxRelation;
|
||||
|
||||
class RelSelectionDialog extends Dialog {
|
||||
private java.util.List<ITxRelation> entries;
|
||||
|
||||
private java.util.List<ITx> entryTx;
|
||||
|
||||
private ITxRelation selected = null;
|
||||
|
||||
public RelSelectionDialog(Shell shell, ArrayList<ITxRelation> candidates, boolean target) {
|
||||
super(shell);
|
||||
entries = candidates;
|
||||
entryTx = entries.stream().map(r->target?r.getTarget():r.getSource()).collect(Collectors.toCollection(ArrayList::new));
|
||||
}
|
||||
|
||||
public ITxRelation open() {
|
||||
Shell parent = getParent();
|
||||
Shell dialog = new Shell(parent, SWT.SHEET | SWT.APPLICATION_MODAL);
|
||||
dialog.setMinimumSize(10, 10);
|
||||
|
||||
RowLayout rowLayout = new RowLayout(SWT.VERTICAL);
|
||||
//rowLayout.fill = true; // Overriding default values.
|
||||
rowLayout.marginWidth=3;
|
||||
rowLayout.marginHeight=0;
|
||||
rowLayout.marginLeft = 3;
|
||||
rowLayout.marginTop = 0;
|
||||
rowLayout.marginRight = 3;
|
||||
rowLayout.marginBottom = 0;
|
||||
dialog.setLayout(rowLayout);
|
||||
final Label lbl = new Label(dialog,SWT.NONE);
|
||||
lbl.setText("Select one:");
|
||||
final List list = new List (dialog, SWT.NONE);
|
||||
for (ITx iTx : entryTx) {
|
||||
list.add ("#tx" + iTx.getId()+" ("+iTx.getStream().getFullName()+")");
|
||||
}
|
||||
list.addListener (SWT.Selection, e -> {
|
||||
int selection = list.getSelectionIndex();
|
||||
if(selection>=0) {
|
||||
selected=entries.get(selection);
|
||||
dialog.close();
|
||||
}
|
||||
});
|
||||
final Button bt = new Button(dialog, SWT.PUSH | SWT.RIGHT);
|
||||
bt.setText("Dismiss");
|
||||
bt.setAlignment(SWT.CENTER);
|
||||
bt.addSelectionListener(widgetSelectedAdapter(e -> dialog.close()));
|
||||
dialog.pack();
|
||||
dialog.open();
|
||||
Display display = parent.getDisplay();
|
||||
while (!dialog.isDisposed()) {
|
||||
if (!display.readAndDispatch())
|
||||
display.sleep();
|
||||
}
|
||||
return selected;
|
||||
}
|
||||
}
|
@ -46,7 +46,6 @@ public class RulerPainter implements IPainter {
|
||||
long startPos=area.x*scaleFactor;
|
||||
long startVal=startPos + waveCanvas.getXOffset()*scaleFactor;
|
||||
long endPos=startPos+area.width*scaleFactor;
|
||||
long endVal=startVal+area.width*scaleFactor;
|
||||
|
||||
long rulerTickMinor = rulerTickMinorC*scaleFactor;
|
||||
long rulerTickMajor = rulerTickMajorC*scaleFactor;
|
||||
@ -68,12 +67,9 @@ public class RulerPainter implements IPainter {
|
||||
gc.setForeground(headerFgColor);
|
||||
gc.drawLine(area.x, area.y+bottom, area.x+area.width, area.y+bottom);
|
||||
|
||||
int x0_max = 0;
|
||||
|
||||
for (long pos = startMinorIncrPos, tick = startMinorIncrVal; pos < endPos; pos+= rulerTickMinor, tick += rulerTickMinor) {
|
||||
int x0_pos = (int) (pos/scaleFactor);
|
||||
long x0_val = tick/scaleFactor;
|
||||
x0_max = x0_pos;
|
||||
if ((tick % rulerTickMajor) == 0) {
|
||||
gc.drawText(df.format(x0_val*unitMultiplier)+unit, x0_pos, area.y+textY);
|
||||
gc.drawLine(x0_pos, area.y+majorTickY, x0_pos,area.y+ bottom);
|
||||
|
@ -78,11 +78,6 @@ public class SignalPainter extends TrackPainter {
|
||||
this.waveCanvas = txDisplay;
|
||||
}
|
||||
|
||||
private int getXValEnd(long time) {
|
||||
long ltmp = time / this.waveCanvas.getScaleFactor();
|
||||
return ltmp > maxValX ? maxValX : (int) ltmp;
|
||||
}
|
||||
|
||||
private int getXPosEnd(long time) {
|
||||
long ltmp = time / this.waveCanvas.getScaleFactor() - waveCanvas.getXOffset();
|
||||
return ltmp > maxPosX ? maxPosX : (int) ltmp;
|
||||
@ -100,7 +95,6 @@ public class SignalPainter extends TrackPainter {
|
||||
long scaleFactor = this.waveCanvas.getScaleFactor();
|
||||
long beginPos = area.x;
|
||||
long beginTime = (beginPos + waveCanvas.getXOffset())*scaleFactor;
|
||||
long endPos = beginPos + area.width;
|
||||
long endTime = beginTime + area.width*scaleFactor;
|
||||
|
||||
Entry<Long, ?> first = signal.getEvents().floorEntry(beginTime);
|
||||
@ -125,7 +119,6 @@ public class SignalPainter extends TrackPainter {
|
||||
yOffsetB = 4 * this.waveCanvas.getTrackHeight() / 5 + area.y;
|
||||
int xSigChangeBeginVal = Math.max(area.x + (int)waveCanvas.getXOffset(), (int) (left.time / this.waveCanvas.getScaleFactor()));
|
||||
int xSigChangeBeginPos = area.x;
|
||||
int xSigChangeEndVal = Math.max(area.x + (int)waveCanvas.getXOffset(), getXValEnd(right.time));
|
||||
int xSigChangeEndPos = Math.max(area.x, getXPosEnd(right.time));
|
||||
|
||||
boolean multiple = false;
|
||||
|
@ -45,14 +45,29 @@ public class StreamPainter extends TrackPainter{
|
||||
this.seenTx=new TreeSet<ITx>();
|
||||
}
|
||||
|
||||
/*
|
||||
* 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")
|
||||
public void paintArea(GC gc, Rectangle area) {
|
||||
if(stream.getEvents().size()==0) return;
|
||||
int trackHeight=trackEntry.height/stream.getMaxConcurrency();
|
||||
txBase=trackHeight/5;
|
||||
txHeight=trackHeight*3/5;
|
||||
if(trackEntry.selected)
|
||||
if(trackEntry.selected) {
|
||||
gc.setBackground(this.waveCanvas.colors[WaveformColors.TRACK_BG_HIGHLITE.ordinal()]);
|
||||
}
|
||||
else
|
||||
gc.setBackground(this.waveCanvas.colors[even?WaveformColors.TRACK_BG_EVEN.ordinal():WaveformColors.TRACK_BG_ODD.ordinal()]);
|
||||
gc.setFillRule(SWT.FILL_EVEN_ODD);
|
||||
@ -61,7 +76,7 @@ public class StreamPainter extends TrackPainter{
|
||||
long scaleFactor = this.waveCanvas.getScaleFactor();
|
||||
long beginPos = area.x;
|
||||
long beginTime = (beginPos + waveCanvas.getXOffset())*scaleFactor;
|
||||
long endPos = beginPos + area.width;
|
||||
//long endPos = beginPos + area.width;
|
||||
long endTime = beginTime + area.width*scaleFactor;
|
||||
|
||||
Entry<Long, ?> firstTx=stream.getEvents().floorEntry(beginTime);
|
||||
@ -75,15 +90,15 @@ public class StreamPainter extends TrackPainter{
|
||||
|
||||
for( int y1=area.y+trackHeight/2; y1<area.y+trackEntry.height; y1+=trackHeight)
|
||||
gc.drawLine(area.x, y1, area.x+area.width, y1);
|
||||
if(firstTx==lastTx)
|
||||
if(firstTx==lastTx) {
|
||||
for(ITxEvent txEvent:(Collection<? extends ITxEvent>)firstTx.getValue())
|
||||
drawTx(gc, area, txEvent.getTransaction());
|
||||
else{
|
||||
drawTx(gc, area, txEvent.getTransaction(), false);
|
||||
}else{
|
||||
seenTx.clear();
|
||||
NavigableMap<Long,?> entries = stream.getEvents().subMap(firstTx.getKey(), true, lastTx.getKey(), true);
|
||||
boolean highlighed=false;
|
||||
gc.setForeground(this.waveCanvas.colors[WaveformColors.LINE.ordinal()]);
|
||||
gc.setBackground(this.waveCanvas.colors[WaveformColors.TX_BG.ordinal()]);
|
||||
|
||||
for(Entry<Long, ?> entry: entries.entrySet())
|
||||
for(ITxEvent txEvent:(Collection<? extends ITxEvent>)entry.getValue()){
|
||||
if(txEvent.getType()==ITxEvent.Type.BEGIN)
|
||||
@ -91,22 +106,27 @@ public class StreamPainter extends TrackPainter{
|
||||
if(txEvent.getType()==ITxEvent.Type.END){
|
||||
ITx tx = txEvent.getTransaction();
|
||||
highlighed|=waveCanvas.currentSelection!=null && waveCanvas.currentSelection.equals(tx);
|
||||
drawTx(gc, area, tx);
|
||||
drawTx(gc, area, tx, false);
|
||||
seenTx.remove(tx);
|
||||
}
|
||||
}
|
||||
for(ITx tx:seenTx){
|
||||
drawTx(gc, area, tx);
|
||||
drawTx(gc, area, tx, false);
|
||||
}
|
||||
if(highlighed){
|
||||
gc.setForeground(this.waveCanvas.colors[WaveformColors.LINE_HIGHLITE.ordinal()]);
|
||||
gc.setBackground(this.waveCanvas.colors[WaveformColors.TX_BG_HIGHLITE.ordinal()]);
|
||||
drawTx(gc, area, waveCanvas.currentSelection);
|
||||
drawTx(gc, area, waveCanvas.currentSelection, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void drawTx(GC gc, Rectangle area, ITx tx) {
|
||||
protected void drawTx(GC gc, Rectangle area, ITx tx, boolean highlighted ) {
|
||||
// compute colors
|
||||
java.awt.Color[] fallbackColors = trackEntry.getColors();
|
||||
java.awt.Color[] transColor = TrackEntry.computeColor( tx.getGenerator().getName(), fallbackColors[0], fallbackColors[1] );
|
||||
|
||||
gc.setBackground( toSwtColor( gc, transColor[highlighted?1:0] ) );
|
||||
|
||||
int offset = tx.getConcurrencyIndex()*this.waveCanvas.getTrackHeight();
|
||||
Rectangle bb = new Rectangle(
|
||||
(int)(tx.getBeginTime()/this.waveCanvas.getScaleFactor()-waveCanvas.getXOffset()), area.y+offset+txBase,
|
||||
|
@ -0,0 +1,143 @@
|
||||
package com.minres.scviewer.database.swt.internal;
|
||||
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.graphics.Point;
|
||||
import org.eclipse.swt.graphics.Rectangle;
|
||||
import org.eclipse.swt.layout.FillLayout;
|
||||
import org.eclipse.swt.layout.GridLayout;
|
||||
import org.eclipse.swt.layout.RowLayout;
|
||||
import org.eclipse.swt.widgets.Control;
|
||||
import org.eclipse.swt.widgets.Display;
|
||||
import org.eclipse.swt.widgets.Event;
|
||||
import org.eclipse.swt.widgets.Label;
|
||||
import org.eclipse.swt.widgets.Listener;
|
||||
import org.eclipse.swt.widgets.Shell;
|
||||
import org.eclipse.swt.widgets.Widget;
|
||||
|
||||
import com.minres.scviewer.database.swt.Constants;
|
||||
import com.minres.scviewer.database.swt.ToolTipContentProvider;
|
||||
import com.minres.scviewer.database.swt.ToolTipHelpTextProvider;
|
||||
|
||||
class ToolTipHandler {
|
||||
|
||||
private final Display display;
|
||||
private Shell parentShell;
|
||||
private Shell shell;
|
||||
|
||||
private Widget tipWidget; // widget this tooltip is hovering over
|
||||
private Point tipPosition; // the position being hovered over
|
||||
|
||||
private static final int hoverYOffset = 1;
|
||||
|
||||
/**
|
||||
* Creates a new tooltip handler
|
||||
*
|
||||
* @param parent the parent Shell
|
||||
*/
|
||||
public ToolTipHandler(Shell parent) {
|
||||
display = parent.getDisplay();
|
||||
parentShell = parent;
|
||||
}
|
||||
|
||||
/**
|
||||
* Enables customized hover help for a specified control
|
||||
*
|
||||
* @control the control on which to enable hoverhelp
|
||||
*/
|
||||
public void activateHoverHelp(final Control control) {
|
||||
Listener listener = new Listener () {
|
||||
Shell tip = null;
|
||||
@Override
|
||||
public void handleEvent (Event event) {
|
||||
switch (event.type) {
|
||||
case SWT.KeyDown:{
|
||||
if (tip != null && tip.isVisible() && event.keyCode == SWT.F2) {
|
||||
tip.setFocus();
|
||||
break;
|
||||
}
|
||||
}
|
||||
case SWT.Dispose:
|
||||
case SWT.MouseMove:
|
||||
case SWT.MouseDown: {
|
||||
if (tip != null){
|
||||
tip.dispose ();
|
||||
tip = null;
|
||||
tipWidget=null;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case SWT.MouseHover: {
|
||||
Object o = control.getData(Constants.CONTENT_PROVIDER_TAG);
|
||||
if(o != null && o instanceof ToolTipContentProvider) {
|
||||
ToolTipContentProvider provider = ((ToolTipContentProvider)o);
|
||||
Point pt = new Point (event.x, event.y);
|
||||
tipPosition = control.toDisplay(pt);
|
||||
if (tip != null && !tip.isDisposed ()) tip.dispose ();
|
||||
tip = new Shell (parentShell, SWT.ON_TOP | SWT.NO_FOCUS | SWT.TOOL);
|
||||
tip.setBackground (display.getSystemColor (SWT.COLOR_INFO_BACKGROUND));
|
||||
GridLayout layout = new GridLayout(1, true);
|
||||
layout.verticalSpacing=0;
|
||||
layout.horizontalSpacing=0;
|
||||
layout.marginWidth = 0;
|
||||
layout.marginHeight = 0;
|
||||
tip.setLayout(layout);
|
||||
boolean visible = provider.createContent(tip, pt);
|
||||
tip.pack();
|
||||
tip.setSize(tip.computeSize(SWT.DEFAULT, SWT.DEFAULT));
|
||||
setHoverLocation(tip, tipPosition);
|
||||
tip.setVisible (visible);
|
||||
if(visible)
|
||||
tipWidget=event.widget;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
control.addListener (SWT.Dispose, listener);
|
||||
control.addListener (SWT.KeyDown, listener);
|
||||
//control.addListener (SWT.MouseMove, listener);
|
||||
control.addListener (SWT.MouseHover, listener);
|
||||
control.addListener (SWT.MouseDown, listener);
|
||||
|
||||
/*
|
||||
* Trap F1 Help to pop up a custom help box
|
||||
*/
|
||||
control.addHelpListener(event -> {
|
||||
if (tipWidget == null) return;
|
||||
ToolTipHelpTextProvider handler = (ToolTipHelpTextProvider)tipWidget.getData(Constants.HELP_PROVIDER_TAG);
|
||||
if (handler == null) return;
|
||||
String text = handler.getHelpText(tipWidget);
|
||||
if (text == null) return;
|
||||
|
||||
if (shell.isVisible()) {
|
||||
shell.setVisible(false);
|
||||
Shell helpShell = new Shell(parentShell, SWT.SHELL_TRIM);
|
||||
helpShell.setLayout(new FillLayout());
|
||||
Label label = new Label(helpShell, SWT.NONE);
|
||||
label.setText(text);
|
||||
helpShell.pack();
|
||||
setHoverLocation(helpShell, tipPosition);
|
||||
helpShell.open();
|
||||
}
|
||||
});
|
||||
// control.addKeyListener(KeyListener.keyPressedAdapter( e-> {
|
||||
// if (e.keyCode == SWT.F2 && shell.isVisible()) {
|
||||
// shell.setFocus();
|
||||
// }
|
||||
// }));
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the location for a hovering shell
|
||||
* @param shell the object that is to hover
|
||||
* @param position the position of a widget to hover over
|
||||
* @return the top-left location for a hovering box
|
||||
*/
|
||||
private void setHoverLocation(Shell shell, Point position) {
|
||||
Rectangle displayBounds = shell.getDisplay().getBounds();
|
||||
Rectangle shellBounds = shell.getBounds();
|
||||
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);
|
||||
shell.setBounds(shellBounds);
|
||||
}
|
||||
}
|
@ -229,7 +229,13 @@ public class WaveformCanvas extends Canvas{
|
||||
}
|
||||
|
||||
public void setZoomLevel(int level) {
|
||||
long tc=cursorPainters.get(0).getTime(); // cursor time
|
||||
setZoomLevel(level, tc);
|
||||
}
|
||||
|
||||
public void setZoomLevel(int level, long centerTime) {
|
||||
long oldScaleFactor=scaleFactor;
|
||||
if(level<0) level = 0;
|
||||
if(level<Constants.unitMultiplier.length*Constants.unitString.length){
|
||||
this.level = level;
|
||||
this.scaleFactor = (long) Math.pow(10, level/2);
|
||||
@ -242,10 +248,9 @@ public class WaveformCanvas extends Canvas{
|
||||
* xcn = tc/newScaleFactor
|
||||
* t0n = (xcn-xoffs)*scaleFactor
|
||||
*/
|
||||
long tc=cursorPainters.get(0).getTime(); // cursor time
|
||||
long xc=tc/oldScaleFactor; // cursor total x-offset
|
||||
long xc=centerTime/oldScaleFactor; // cursor total x-offset
|
||||
long xoffs=xc+origin.x; // cursor offset relative to left border
|
||||
long xcn=tc/scaleFactor; // new total x-offset
|
||||
long xcn=centerTime/scaleFactor; // new total x-offset
|
||||
long originX=xcn-xoffs;
|
||||
if(originX>0) {
|
||||
origin.x=(int) -originX; // new cursor time offset relative to left border
|
||||
@ -421,7 +426,7 @@ public class WaveformCanvas extends Canvas{
|
||||
}
|
||||
}
|
||||
|
||||
public List<Object> getClicked(Point point) {
|
||||
public List<Object> getElementsAt(Point point) {
|
||||
LinkedList<Object> result=new LinkedList<>();
|
||||
for (IPainter p : Lists.reverse(painterList)) {
|
||||
if (p instanceof TrackAreaPainter) {
|
||||
@ -557,7 +562,7 @@ public class WaveformCanvas extends Canvas{
|
||||
return (getClientArea().width+origin.x)*scaleFactor;
|
||||
}
|
||||
|
||||
long getOriginTime() {
|
||||
long getMinVisibleTime() {
|
||||
return origin.x * scaleFactor;
|
||||
}
|
||||
}
|
||||
|
@ -10,10 +10,12 @@
|
||||
*******************************************************************************/
|
||||
package com.minres.scviewer.database.swt.internal;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.beans.PropertyChangeEvent;
|
||||
import java.beans.PropertyChangeListener;
|
||||
import java.beans.PropertyChangeSupport;
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
@ -23,6 +25,7 @@ import java.util.Map.Entry;
|
||||
import java.util.NavigableMap;
|
||||
import java.util.NoSuchElementException;
|
||||
import java.util.TreeMap;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.eclipse.core.runtime.ListenerList;
|
||||
import org.eclipse.jface.util.LocalSelectionTransfer;
|
||||
@ -45,9 +48,13 @@ import org.eclipse.swt.dnd.DropTargetEvent;
|
||||
import org.eclipse.swt.dnd.Transfer;
|
||||
import org.eclipse.swt.events.ControlAdapter;
|
||||
import org.eclipse.swt.events.ControlEvent;
|
||||
import org.eclipse.swt.events.DisposeListener;
|
||||
import org.eclipse.swt.events.MouseAdapter;
|
||||
import org.eclipse.swt.events.MouseEvent;
|
||||
import org.eclipse.swt.events.MouseListener;
|
||||
import org.eclipse.swt.events.MouseMoveListener;
|
||||
import org.eclipse.swt.events.PaintEvent;
|
||||
import org.eclipse.swt.events.PaintListener;
|
||||
import org.eclipse.swt.events.SelectionAdapter;
|
||||
import org.eclipse.swt.events.SelectionEvent;
|
||||
import org.eclipse.swt.graphics.Font;
|
||||
@ -92,7 +99,7 @@ public class WaveformViewer implements IWaveformViewer {
|
||||
|
||||
private PropertyChangeSupport pcs;
|
||||
|
||||
static final DecimalFormat df = new DecimalFormat("#.00####");
|
||||
static final DecimalFormat df = new DecimalFormat("#0.00####");
|
||||
|
||||
private ITx currentTxSelection;
|
||||
|
||||
@ -110,6 +117,8 @@ public class WaveformViewer implements IWaveformViewer {
|
||||
|
||||
final WaveformCanvas waveformCanvas;
|
||||
|
||||
final ToolTipHandler toolTipHandler;
|
||||
|
||||
private boolean revealSelected=false;
|
||||
|
||||
private Composite top;
|
||||
@ -138,43 +147,112 @@ public class WaveformViewer implements IWaveformViewer {
|
||||
}
|
||||
};
|
||||
|
||||
protected MouseListener waveformMouseListener = new MouseAdapter(){
|
||||
Point start;
|
||||
class WaveformMouseListener implements MouseMoveListener, MouseListener, PaintListener {
|
||||
Point start, end;
|
||||
List<Object> initialSelected;
|
||||
boolean down=false;
|
||||
|
||||
@Override
|
||||
public void mouseDoubleClick(MouseEvent e) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseDown(MouseEvent e) {
|
||||
start=new Point(e.x, e.y);
|
||||
end=new Point(e.x, e.y);
|
||||
down=true;
|
||||
if((e.stateMask&SWT.MODIFIER_MASK)!=0) return; //don't react on modifier
|
||||
if (e.button == 1) {
|
||||
initialSelected = waveformCanvas.getClicked(start);
|
||||
initialSelected = waveformCanvas.getElementsAt(start);
|
||||
} else if (e.button == 3) {
|
||||
Menu topMenu= top.getMenu();
|
||||
if(topMenu!=null) topMenu.setVisible(true);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseMove(MouseEvent e) {
|
||||
if(down) {
|
||||
end=new Point(e.x, e.y);
|
||||
asyncUpdate(e.widget);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void paintControl(PaintEvent e) {
|
||||
if(down) {
|
||||
GC gc = e.gc;
|
||||
gc.setAlpha(128);
|
||||
int minX = Math.min(start.x, end.x);
|
||||
int width = Math.max(start.x, end.x) - minX;
|
||||
Point origin = waveformCanvas.getOrigin();
|
||||
int y_top = waveformCanvas.getRulerHeight()- origin.y;
|
||||
int y_bottom = waveformCanvas.getSize().y;
|
||||
gc.fillRectangle(minX, y_top, width,y_bottom);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseUp(MouseEvent e) {
|
||||
if((e.stateMask&SWT.MODIFIER_MASK&~SWT.SHIFT)!=0) return; //don't react on modifier
|
||||
if (e.button == 1 && ((e.stateMask&SWT.SHIFT)==0)) {
|
||||
down=false;
|
||||
if(start==null) return;
|
||||
if((e.stateMask&SWT.MODIFIER_MASK&~SWT.SHIFT)!=0) return; //don't react on modifier except shift
|
||||
if(!start.equals(end)){
|
||||
asyncUpdate(e.widget);
|
||||
long startTime = waveformCanvas.getTimeForOffset(start.x);
|
||||
long endTime = waveformCanvas.getTimeForOffset(end.x);
|
||||
long targetTimeRange = endTime-startTime;
|
||||
long currentTimeRange = waveformCanvas.getMaxVisibleTime()-waveformCanvas.getMinVisibleTime();
|
||||
if(targetTimeRange==0) return;
|
||||
long relation = currentTimeRange/targetTimeRange;
|
||||
long i = 1;
|
||||
int level=0;//relation>0?0:0;
|
||||
do {
|
||||
if(relation<0 ) {
|
||||
if(-relation<i) {
|
||||
break;
|
||||
}
|
||||
level--;
|
||||
if(-relation<i*3) {
|
||||
break;
|
||||
}
|
||||
level--;
|
||||
} else {
|
||||
if(relation<i) {
|
||||
break;
|
||||
}
|
||||
level++;
|
||||
if(relation<i*3) {
|
||||
break;
|
||||
}
|
||||
level++;
|
||||
}
|
||||
i=i*10;
|
||||
} while(i<10000);
|
||||
if(i<10000) {
|
||||
int curLevel = waveformCanvas.getZoomLevel();
|
||||
waveformCanvas.setZoomLevel(curLevel-level, (startTime+endTime)/2);
|
||||
}
|
||||
} else if (e.button == 1 && ((e.stateMask&SWT.SHIFT)==0)) {
|
||||
// set cursor (button 1 and no shift)
|
||||
if(Math.abs(e.x-start.x)<3 && Math.abs(e.y-start.y)<3){
|
||||
// first set cursor time
|
||||
setCursorTime(snapOffsetToEvent(e));
|
||||
setCursorTime(snapOffsetToEvent(start));
|
||||
// then set selection and reveal
|
||||
setSelection(new StructuredSelection(initialSelected));
|
||||
asyncUpdate(e.widget);
|
||||
}
|
||||
}else if (e.button == 2 ||(e.button==1 && (e.stateMask&SWT.SHIFT)!=0)) {
|
||||
setMarkerTime(snapOffsetToEvent(e), selectedMarker);
|
||||
// set marker (button 1 and shift)
|
||||
setMarkerTime(snapOffsetToEvent(start), selectedMarker);
|
||||
asyncUpdate(e.widget);
|
||||
}
|
||||
}
|
||||
|
||||
protected long snapOffsetToEvent(MouseEvent e) {
|
||||
long time= waveformCanvas.getTimeForOffset(e.x);
|
||||
protected long snapOffsetToEvent(Point p) {
|
||||
long time= waveformCanvas.getTimeForOffset(p.x);
|
||||
long scaling=5*waveformCanvas.getScaleFactor();
|
||||
for(Object o:waveformCanvas.getClicked(start)){
|
||||
for(Object o:waveformCanvas.getElementsAt(p)){
|
||||
Entry<Long, ?> floorEntry=null, ceilEntry=null;
|
||||
if(o instanceof TrackEntry){
|
||||
TrackEntry entry = (TrackEntry) o;
|
||||
@ -206,7 +284,9 @@ public class WaveformViewer implements IWaveformViewer {
|
||||
}
|
||||
return time;
|
||||
}
|
||||
|
||||
};
|
||||
protected WaveformMouseListener waveformMouseListener = new WaveformMouseListener();
|
||||
|
||||
public WaveformViewer(Composite parent) {
|
||||
pcs=new PropertyChangeSupport(this);
|
||||
@ -306,6 +386,8 @@ public class WaveformViewer implements IWaveformViewer {
|
||||
|
||||
waveformCanvas.setMaxTime(1);
|
||||
waveformCanvas.addMouseListener(waveformMouseListener);
|
||||
waveformCanvas.addMouseMoveListener(waveformMouseListener);
|
||||
waveformCanvas.addPaintListener(waveformMouseListener);
|
||||
|
||||
nameListScrolled.getVerticalBar().addSelectionListener(new SelectionAdapter() {
|
||||
public void widgetSelected(SelectionEvent e) {
|
||||
@ -339,6 +421,9 @@ public class WaveformViewer implements IWaveformViewer {
|
||||
createStreamDropTarget(valueList);
|
||||
createWaveformDragSource(waveformCanvas);
|
||||
createWaveformDropTarget(waveformCanvas);
|
||||
|
||||
toolTipHandler = new ToolTipHandler(parent.getShell());
|
||||
toolTipHandler.activateHoverHelp(waveformCanvas);
|
||||
}
|
||||
|
||||
private Composite createTextPane(SashForm leftSash, String text) {
|
||||
@ -489,9 +574,11 @@ public class WaveformViewer implements IWaveformViewer {
|
||||
}while(firstTx!=null && !isArrayFull(resultsList));
|
||||
entry.currentValue="";
|
||||
boolean separator=false;
|
||||
|
||||
for(ITx o:resultsList){
|
||||
if(separator) entry.currentValue+="|";
|
||||
if(o!=null) entry.currentValue+=((ITx)o).getGenerator().getName();
|
||||
|
||||
separator=true;
|
||||
}
|
||||
}
|
||||
@ -503,6 +590,7 @@ public class WaveformViewer implements IWaveformViewer {
|
||||
valueListScrolled.redraw();
|
||||
}
|
||||
|
||||
|
||||
private boolean isArrayFull(Object[] array){
|
||||
for(Object o:array){
|
||||
if(o==null) return false;
|
||||
@ -600,6 +688,9 @@ public class WaveformViewer implements IWaveformViewer {
|
||||
TrackEntry trackEntry = getEntryForStream(txSel.getStream());
|
||||
if(trackEntry==null && addIfNeeded){
|
||||
trackEntry=new TrackEntry(txSel.getStream());
|
||||
// compute fallback colors
|
||||
Color fallbackColors[] = TrackEntry.computeColor(txSel.getStream().getName(), TrackEntry.fallbackColor, TrackEntry.highlightedFallbackColor);
|
||||
trackEntry.setColor(fallbackColors[0], fallbackColors[1]);
|
||||
streams.add(trackEntry);
|
||||
}
|
||||
currentTxSelection = txSel;
|
||||
@ -725,24 +816,40 @@ public class WaveformViewer implements IWaveformViewer {
|
||||
} else {
|
||||
if (direction == GotoDirection.NEXT) {
|
||||
Collection<ITxRelation> outRel=currentTxSelection.getOutgoingRelations();
|
||||
for(ITxRelation rel:outRel){
|
||||
if(relationType.equals(rel.getRelationType())){
|
||||
setSelection(new StructuredSelection(rel.getTarget()), true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
ITxRelation tx = selectTxToNavigateTo(outRel, relationType, true);
|
||||
if(tx!=null) setSelection(new StructuredSelection(tx.getTarget()), true);
|
||||
} else if (direction == GotoDirection.PREV) {
|
||||
Collection<ITxRelation> inRel=currentTxSelection.getIncomingRelations();
|
||||
for(ITxRelation rel:inRel){
|
||||
if(relationType.equals(rel.getRelationType())){
|
||||
setSelection(new StructuredSelection(rel.getSource()), true);
|
||||
return;
|
||||
ITxRelation tx = selectTxToNavigateTo(inRel, relationType, false);
|
||||
if(tx!=null) setSelection(new StructuredSelection(tx.getSource()), true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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));
|
||||
//new RelSelectionDialog(waveformCanvas.getShell(), candidates, target).open();
|
||||
switch (candidates.size()) {
|
||||
case 0: return null;
|
||||
case 1: return candidates.get(0);
|
||||
default:
|
||||
ArrayList<ITxRelation> visibleCandidates = candidates.stream().filter(r -> streamsVisible(r)).collect(Collectors.toCollection(ArrayList::new));
|
||||
if(visibleCandidates.size()==0) {
|
||||
return new RelSelectionDialog(waveformCanvas.getShell(), candidates, target).open();
|
||||
} else if(visibleCandidates.size()==1) {
|
||||
return visibleCandidates.size()==1?visibleCandidates.get(0):null;
|
||||
} else {
|
||||
return new RelSelectionDialog(waveformCanvas.getShell(), visibleCandidates, target).open();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private boolean streamsVisible(ITxRelation relation) {
|
||||
final ITxStream<ITxEvent> src = relation.getSource().getStream();
|
||||
final ITxStream<ITxEvent> tgt = relation.getTarget().getStream();
|
||||
return streams.stream().anyMatch(x -> x.waveform == src) && streams.stream().anyMatch(x -> x.waveform == tgt);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see com.minres.scviewer.database.swt.IWaveformPanel#moveCursor(com.minres.scviewer.database.swt.GotoDirection)
|
||||
@ -1046,6 +1153,10 @@ public class WaveformViewer implements IWaveformViewer {
|
||||
return null;
|
||||
}
|
||||
|
||||
public List<Object> getElementsAt(Point pt){
|
||||
return waveformCanvas.getElementsAt(pt);
|
||||
}
|
||||
|
||||
private void createWaveformDragSource(final Canvas canvas) {
|
||||
Transfer[] types = new Transfer[] { LocalSelectionTransfer.getTransfer() };
|
||||
DragSource dragSource = new DragSource(canvas, DND.DROP_MOVE);
|
||||
@ -1053,7 +1164,7 @@ public class WaveformViewer implements IWaveformViewer {
|
||||
dragSource.addDragListener(new DragSourceAdapter() {
|
||||
public void dragStart(DragSourceEvent event) {
|
||||
event.doit = false;
|
||||
List<Object> clicked = waveformCanvas.getClicked(new Point(event.x, event.y));
|
||||
List<Object> clicked = waveformCanvas.getElementsAt(new Point(event.x, event.y));
|
||||
for(Object o:clicked){
|
||||
if(o instanceof CursorPainter){
|
||||
LocalSelectionTransfer.getTransfer().setSelection(new StructuredSelection(o));
|
||||
@ -1066,7 +1177,7 @@ public class WaveformViewer implements IWaveformViewer {
|
||||
|
||||
public void dragSetData(DragSourceEvent event) {
|
||||
if (LocalSelectionTransfer.getTransfer().isSupportedType(event.dataType)) {
|
||||
event.data=waveformCanvas.getClicked(new Point(event.x, event.y));
|
||||
event.data=waveformCanvas.getElementsAt(new Point(event.x, event.y));
|
||||
}
|
||||
}
|
||||
});
|
||||
@ -1221,13 +1332,6 @@ public class WaveformViewer implements IWaveformViewer {
|
||||
if(percent<-100) percent=-100;
|
||||
if(percent>100) percent=100;
|
||||
int diff = (waveformCanvas.getWidth()*percent)/100;
|
||||
// ScrollBar sb = waveformCanvas.getHorizontalBar();
|
||||
// int x = sb.getSelection();
|
||||
// System.out.println("Setting sb to "+ (x+diff));
|
||||
// if((x+diff)>0)
|
||||
// sb.setSelection(x+diff);
|
||||
// else
|
||||
// sb.setSelection(0);
|
||||
Point o = waveformCanvas.getOrigin();
|
||||
waveformCanvas.setOrigin(o.x-diff, o.y);
|
||||
waveformCanvas.redraw();
|
||||
@ -1242,4 +1346,9 @@ public class WaveformViewer implements IWaveformViewer {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/// probably not the way it should be done
|
||||
public void addDisposeListener( DisposeListener listener ) {
|
||||
waveformCanvas.addDisposeListener(listener);
|
||||
}
|
||||
}
|
||||
|
@ -17,6 +17,8 @@ import java.util.List;
|
||||
import org.eclipse.jface.viewers.ISelection;
|
||||
import org.eclipse.jface.viewers.ISelectionChangedListener;
|
||||
import org.eclipse.jface.viewers.ISelectionProvider;
|
||||
import org.eclipse.swt.events.DisposeListener;
|
||||
import org.eclipse.swt.graphics.Point;
|
||||
import org.eclipse.swt.graphics.RGB;
|
||||
import org.eclipse.swt.widgets.Control;
|
||||
|
||||
@ -61,6 +63,8 @@ public interface IWaveformViewer extends PropertyChangeListener, ISelectionProvi
|
||||
|
||||
public TrackEntry getEntryForStream(IWaveform source);
|
||||
|
||||
public List<Object> getElementsAt(Point pt);
|
||||
|
||||
public void moveSelectedTrack(int i);
|
||||
|
||||
public void setHighliteRelation(RelationType relationType);
|
||||
@ -104,4 +108,6 @@ public interface IWaveformViewer extends PropertyChangeListener, ISelectionProvi
|
||||
public void setBaselineTime(Long scale);
|
||||
|
||||
public void scrollHorizontal(int percent);
|
||||
|
||||
public void addDisposeListener( DisposeListener listener );
|
||||
}
|
@ -10,13 +10,87 @@
|
||||
*******************************************************************************/
|
||||
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;
|
||||
|
||||
|
||||
public class TrackEntry {
|
||||
|
||||
// color info
|
||||
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 colors to standard values
|
||||
if (streamValue.contains("read")){
|
||||
result[0] = new Color(86,174,53);
|
||||
result[1] = new Color (86,194,53);
|
||||
}else if (streamValue.contains("rdata")){
|
||||
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;
|
||||
|
||||
}
|
||||
|
||||
public void setColor(Color changedColor, Color highlightColor) {
|
||||
signalColors[0] = changedColor;
|
||||
signalColors[1] = highlightColor;
|
||||
}
|
||||
|
||||
public Color[] getColors() {
|
||||
return signalColors;
|
||||
}
|
||||
|
||||
public enum ValueDisplay {
|
||||
DEFAULT, SIGNED, UNSIGNED
|
||||
|
||||
@ -45,6 +119,9 @@ public class TrackEntry {
|
||||
vOffset=0;
|
||||
height=0;
|
||||
selected=false;
|
||||
signalColors = new Color[2];
|
||||
signalColors[0] = fallbackColor;
|
||||
signalColors[1] = highlightedFallbackColor;
|
||||
}
|
||||
|
||||
public boolean isStream(){
|
||||
|
@ -1,2 +0,0 @@
|
||||
eclipse.preferences.version=1
|
||||
encoding/<project>=UTF-8
|
@ -12,7 +12,6 @@ package com.minres.scviewer.database.vcd;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.Collection;
|
||||
|
@ -117,7 +117,7 @@ public class VCDSignal<T> extends HierNode implements ISignal<T> {
|
||||
|
||||
@Override
|
||||
public Boolean equals(IWaveform other) {
|
||||
return(other instanceof VCDSignal<?> && this.getId()==other.getId());
|
||||
return( other instanceof VCDSignal<?> && this.getId().equals(other.getId()));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
|
||||
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
||||
<classpathentry kind="src" path="src/"/>
|
||||
<classpathentry kind="output" path="target/classes"/>
|
||||
</classpath>
|
||||
|
@ -1,2 +0,0 @@
|
||||
eclipse.preferences.version=1
|
||||
encoding/<project>=UTF-8
|
@ -5,10 +5,8 @@ Bundle-SymbolicName: com.minres.scviewer.database
|
||||
Bundle-Version: 1.0.0.qualifier
|
||||
Bundle-Vendor: MINRES Technologies GmbH
|
||||
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
|
||||
Bundle-ActivationPolicy: lazy
|
||||
Service-Component: OSGI-INF/component.xml,OSGI-INF/component2.xml
|
||||
Require-Bundle: org.eclipse.equinox.ds;bundle-version="1.4.200",
|
||||
org.eclipse.equinox.util;bundle-version="1.0.500",
|
||||
org.eclipse.osgi.services;bundle-version="3.4.0"
|
||||
Automatic-Module-Name: com.minres.scviewer.database
|
||||
|
@ -76,6 +76,7 @@ public class BitVector {
|
||||
for(int i=resWidth-1; i>=0; i--){
|
||||
int digit=0;
|
||||
for(int j=3; j>=0; j--){
|
||||
if((4*i+j)>=value.length) continue;
|
||||
BitValue val = BitValue.fromChar(value[4*i+j]);
|
||||
switch(val) {
|
||||
case X:
|
||||
|
@ -140,7 +140,7 @@ public class WaveformDb extends HierNode implements IWaveformDb {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(name == hier[hier.length-1]){ //leaf
|
||||
if(name.equals(hier[hier.length-1])){ //leaf
|
||||
if(n1!=null) {
|
||||
if(n1 instanceof HierNode){
|
||||
node.getChildNodes().remove(n1);
|
||||
|
@ -3,5 +3,5 @@
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
|
||||
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
<classpathentry kind="output" path="target/classes"/>
|
||||
</classpath>
|
||||
|
@ -1,10 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<application:Application xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:advanced="http://www.eclipse.org/ui/2010/UIModel/application/ui/advanced" xmlns:application="http://www.eclipse.org/ui/2010/UIModel/application" xmlns:basic="http://www.eclipse.org/ui/2010/UIModel/application/ui/basic" xmlns:menu="http://www.eclipse.org/ui/2010/UIModel/application/ui/menu" xmlns:ui="http://www.eclipse.org/ui/2010/UIModel/application/ui" xmi:id="_95PfsHNmEeWBq8z1Dv39LA" elementId="org.eclipse.e4.ide.application" bindingContexts="_95PfuXNmEeWBq8z1Dv39LA">
|
||||
<children xsi:type="basic:TrimmedWindow" xmi:id="_95PfsXNmEeWBq8z1Dv39LA" label="SC Viewer" width="980" height="700">
|
||||
<children xsi:type="basic:TrimmedWindow" xmi:id="_95PfsXNmEeWBq8z1Dv39LA" label="SC Viewer" bindingContexts="_95PfunNmEeWBq8z1Dv39LA" width="980" height="700">
|
||||
<children xsi:type="advanced:PerspectiveStack" xmi:id="_95QGxnNmEeWBq8z1Dv39LA">
|
||||
<children xsi:type="advanced:Perspective" xmi:id="_95QGx3NmEeWBq8z1Dv39LA">
|
||||
<children xsi:type="basic:PartSashContainer" xmi:id="_95QGyHNmEeWBq8z1Dv39LA" horizontal="true">
|
||||
<children xsi:type="basic:Part" xmi:id="_95QGynNmEeWBq8z1Dv39LA" elementId="com.minres.scviewer.e4.application.parts.DesignBrowser" containerData="20" contributionURI="bundleclass://com.minres.scviewer.e4.application/com.minres.scviewer.e4.application.parts.DesignBrowser" label="Design Browser">
|
||||
<children xsi:type="basic:Part" xmi:id="_95QGynNmEeWBq8z1Dv39LA" elementId="com.minres.scviewer.e4.application.parts.DesignBrowser" containerData="2000" contributionURI="bundleclass://com.minres.scviewer.e4.application/com.minres.scviewer.e4.application.parts.DesignBrowser" label="Design Browser" bindingContexts="_iQ3kQGVmEeqSQM-A6dw9ig">
|
||||
<handlers xmi:id="_JIWOYIq-EeWid7xO48ZBXw" elementId="com.minres.scviewer.e4.application.handler.addWaveformCommand" contributionURI="bundleclass://com.minres.scviewer.e4.application/com.minres.scviewer.e4.application.handlers.AddWaveformHandler" command="_2PehEHr9EeWVM_sKoXvptg"/>
|
||||
<menus xsi:type="menu:PopupMenu" xmi:id="_HvUl8Iq-EeWid7xO48ZBXw" elementId="com.minres.scviewer.e4.application.parts.DesignBrowser.popupmenu">
|
||||
<children xsi:type="menu:HandledMenuItem" xmi:id="_HvUl8Yq-EeWid7xO48ZBXw" elementId="com.minres.scviewer.e4.application.handledmenuitem.append" label="Append after" iconURI="platform:/plugin/com.minres.scviewer.e4.application/icons/append_wave.png" command="_2PehEHr9EeWVM_sKoXvptg">
|
||||
@ -25,21 +25,23 @@
|
||||
</children>
|
||||
</menus>
|
||||
</children>
|
||||
<children xsi:type="basic:PartSashContainer" xmi:id="_uT9BIHgtEeWwZ-9vrAR2UQ" elementId="" containerData="80">
|
||||
<children xsi:type="basic:PartStack" xmi:id="_95QGyXNmEeWBq8z1Dv39LA" elementId="org.eclipse.editorss" containerData="75"/>
|
||||
<children xsi:type="basic:Part" xmi:id="_vtfm8HgtEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.parts.WaveformDetails" containerData="25" contributionURI="bundleclass://com.minres.scviewer.e4.application/com.minres.scviewer.e4.application.parts.TransactionDetails" label="Waveform Details"/>
|
||||
<children xsi:type="basic:PartSashContainer" xmi:id="_uT9BIHgtEeWwZ-9vrAR2UQ" elementId="" containerData="8000">
|
||||
<children xsi:type="basic:PartStack" xmi:id="_95QGyXNmEeWBq8z1Dv39LA" elementId="org.eclipse.editorss" containerData="7500">
|
||||
<tags>NoAutoCollapse</tags>
|
||||
</children>
|
||||
<children xsi:type="basic:Part" xmi:id="_vtfm8HgtEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.parts.WaveformDetails" containerData="2500" contributionURI="bundleclass://com.minres.scviewer.e4.application/com.minres.scviewer.e4.application.parts.TransactionDetails" label="Waveform Details"/>
|
||||
</children>
|
||||
</children>
|
||||
</children>
|
||||
</children>
|
||||
<children xsi:type="basic:Part" xmi:id="__VNlAIytEeWid7xO48ZBXw" elementId="com.minres.scviewer.e4.application.dialog.aboutscviewer" toBeRendered="false" visible="false" contributionURI="bundleclass://com.minres.scviewer.e4.application/com.minres.scviewer.e4.application.parts.AboutDialog" label="About SCViewer"/>
|
||||
<children xsi:type="basic:Part" xmi:id="__VNlAIytEeWid7xO48ZBXw" elementId="com.minres.scviewer.e4.application.dialog.aboutscviewer" toBeRendered="false" visible="false" contributionURI="bundleclass://com.minres.scviewer.e4.application/com.minres.scviewer.e4.application.parts.AboutDialog" label="About SCViewer" bindingContexts="_95Pfu3NmEeWBq8z1Dv39LA"/>
|
||||
<mainMenu xmi:id="_95PfyXNmEeWBq8z1Dv39LA" elementId="menu:org.eclipse.ui.main.menu">
|
||||
<children xsi:type="menu:Menu" xmi:id="_95QGwHNmEeWBq8z1Dv39LA" elementId="com.minres.scviewer.e4.application.menu.file" label="File">
|
||||
<children xsi:type="menu:HandledMenuItem" xmi:id="_VJG3YHgvEeWwZ-9vrAR2UQ" elementId="" label="Open Database" iconURI="platform:/plugin/com.minres.scviewer.e4.application/icons/folder_database.png" command="_95PfwHNmEeWBq8z1Dv39LA"/>
|
||||
<children xsi:type="menu:HandledMenuItem" xmi:id="_e7MOYJedEeW09eyIbHsdvg" elementId="" label="Load settings" iconURI="platform:/plugin/com.minres.scviewer.e4.application/icons/folder_page.png" command="_7-AIMJebEeW09eyIbHsdvg">
|
||||
<children xsi:type="menu:HandledMenuItem" xmi:id="_VJG3YHgvEeWwZ-9vrAR2UQ" elementId="" label="Open Database" iconURI="platform:/plugin/com.minres.scviewer.e4.application/icons/folder_database.png" mnemonics="M1+O" command="_95PfwHNmEeWBq8z1Dv39LA"/>
|
||||
<children xsi:type="menu:HandledMenuItem" xmi:id="_e7MOYJedEeW09eyIbHsdvg" elementId="" label="Load active tab settings" iconURI="platform:/plugin/com.minres.scviewer.e4.application/icons/folder_page.png" command="_7-AIMJebEeW09eyIbHsdvg">
|
||||
<parameters xmi:id="_4vtYgJehEeW09eyIbHsdvg" elementId="com.minres.scviewer.e4.application.parameter.30" name="com.minres.scviewer.e4.application.commandparameter.loadStore" value="load"/>
|
||||
</children>
|
||||
<children xsi:type="menu:HandledMenuItem" xmi:id="_95QGwnNmEeWBq8z1Dv39LA" label="Save settings" iconURI="platform:/plugin/com.minres.scviewer.e4.application/icons/script_save.png" command="_7-AIMJebEeW09eyIbHsdvg">
|
||||
<children xsi:type="menu:HandledMenuItem" xmi:id="_95QGwnNmEeWBq8z1Dv39LA" label="Save active tab settings" iconURI="platform:/plugin/com.minres.scviewer.e4.application/icons/script_save.png" command="_7-AIMJebEeW09eyIbHsdvg">
|
||||
<parameters xmi:id="_61QIsJehEeW09eyIbHsdvg" elementId="com.minres.scviewer.e4.application.parameter.31" name="com.minres.scviewer.e4.application.commandparameter.loadStore" value="store"/>
|
||||
</children>
|
||||
<children xsi:type="menu:HandledMenuItem" xmi:id="_95QGw3NmEeWBq8z1Dv39LA" label="Quit" command="_95PfvHNmEeWBq8z1Dv39LA"/>
|
||||
@ -86,7 +88,9 @@
|
||||
<children xsi:type="menu:HandledToolItem" xmi:id="_o9UBUJeiEeW09eyIbHsdvg" elementId="com.minres.scviewer.e4.application.handledtoolitem.loadsettings" label="Load settings" iconURI="platform:/plugin/com.minres.scviewer.e4.application/icons/folder_page.png" command="_7-AIMJebEeW09eyIbHsdvg">
|
||||
<parameters xmi:id="_tQZAEJeiEeW09eyIbHsdvg" elementId="com.minres.scviewer.e4.application.parameter.32" name="com.minres.scviewer.e4.application.commandparameter.loadStore" value="load"/>
|
||||
</children>
|
||||
<children xsi:type="menu:HandledToolItem" xmi:id="_95QGznNmEeWBq8z1Dv39LA" toBeRendered="false" visible="false" iconURI="platform:/plugin/com.minres.scviewer.e4.application/icons/save_edit.png" command="_95Pfw3NmEeWBq8z1Dv39LA"/>
|
||||
<children xsi:type="menu:HandledToolItem" xmi:id="_95QGznNmEeWBq8z1Dv39LA" elementId="com.minres.scviewer.e4.application.handledtoolitem.savesettings" toBeRendered="false" visible="false" label="Save settings" iconURI="platform:/plugin/com.minres.scviewer.e4.application/icons/save_edit.png" command="_7-AIMJebEeW09eyIbHsdvg">
|
||||
<parameters xmi:id="_HHALEGVSEeqSQM-A6dw9ig" elementId="com.minres.scviewer.e4.application.parameter.32" name="com.minres.scviewer.e4.application.commandparameter.loadStore" value="store"/>
|
||||
</children>
|
||||
</children>
|
||||
<children xsi:type="menu:ToolBar" xmi:id="_VUv_AHckEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.toolbar.0">
|
||||
<children xsi:type="menu:HandledToolItem" xmi:id="_EboiQHcjEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.handledtoolitem.removestream" label="Remove Stream" iconURI="platform:/plugin/com.minres.scviewer.e4.application/icons/cross.png" tooltip="Remove stream/waveform from list" command="_WUZ2wHXHEeWwZ-9vrAR2UQ"/>
|
||||
@ -119,17 +123,22 @@
|
||||
</children>
|
||||
</children>
|
||||
<children xsi:type="menu:ToolBar" xmi:id="_oQdMUHcqEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.toolbar.1">
|
||||
<children xsi:type="menu:HandledToolItem" xmi:id="_5DrGQHf4EeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.handledtoolitem.zoomfit" label="Zoom out" iconURI="platform:/plugin/com.minres.scviewer.e4.application/icons/zoom.png" tooltip="Restore default zoom level" command="_693GoHcqEeWwZ-9vrAR2UQ">
|
||||
<children xsi:type="menu:HandledToolItem" xmi:id="_5DrGQHf4EeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.handledtoolitem.zoomfit" label="Zoom out" iconURI="platform:/plugin/com.minres.scviewer.e4.application/icons/magnifier.png" tooltip="Restore default zoom level" command="_693GoHcqEeWwZ-9vrAR2UQ">
|
||||
<parameters xmi:id="_5DrGQXf4EeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.parameter.14" name="com.minres.scviewer.e4.application.command.zoomcommand.parameter.level" value="fit"/>
|
||||
</children>
|
||||
<children xsi:type="menu:ToolBarSeparator" xmi:id="_p1AvUHcqEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.toolbarseparator.1"/>
|
||||
<children xsi:type="menu:HandledToolItem" xmi:id="_XMQPAHcrEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.handledtoolitem.zoomin" label="Zoom in" iconURI="platform:/plugin/com.minres.scviewer.e4.application/icons/zoom_in.png" tooltip="Zoom in by a factor of 3" command="_693GoHcqEeWwZ-9vrAR2UQ">
|
||||
<children xsi:type="menu:HandledToolItem" xmi:id="_XMQPAHcrEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.handledtoolitem.zoomin" label="Zoom in" iconURI="platform:/plugin/com.minres.scviewer.e4.application/icons/magnifier_zoom_in.png" tooltip="Zoom in by a factor of 3" command="_693GoHcqEeWwZ-9vrAR2UQ">
|
||||
<parameters xmi:id="_fi5w4HcrEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.parameter.15" name="com.minres.scviewer.e4.application.command.zoomcommand.parameter.level" value="in"/>
|
||||
</children>
|
||||
<children xsi:type="menu:HandledToolItem" xmi:id="_XqTc8HcrEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.handledtoolitem.zoomout" label="Zoom out" iconURI="platform:/plugin/com.minres.scviewer.e4.application/icons/zoom_out.png" tooltip="Zoom out by a factor of 3" command="_693GoHcqEeWwZ-9vrAR2UQ">
|
||||
<children xsi:type="menu:HandledToolItem" xmi:id="_XqTc8HcrEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.handledtoolitem.zoomout" label="Zoom out" iconURI="platform:/plugin/com.minres.scviewer.e4.application/icons/magifier_zoom_out.png" tooltip="Zoom out by a factor of 3" command="_693GoHcqEeWwZ-9vrAR2UQ">
|
||||
<parameters xmi:id="_d7OBYHcrEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.parameter.14" name="com.minres.scviewer.e4.application.command.zoomcommand.parameter.level" value="out"/>
|
||||
</children>
|
||||
</children>
|
||||
<children xsi:type="menu:ToolBar" xmi:id="_fwn8wGtTEeqmlpoaaMHoiw" elementId="com.minres.scviewer.e4.application.toolbar.2">
|
||||
<children xsi:type="menu:HandledToolItem" xmi:id="_j-XIgGtTEeqmlpoaaMHoiw" elementId="com.minres.scviewer.e4.application.handledtoolitem.hover" label="Hover" iconURI="platform:/plugin/com.minres.scviewer.e4.application/icons/lightbulb.png" tooltip="Enable hover window in waveform" selected="true" type="Check" command="_uyeyYGtTEeqmlpoaaMHoiw">
|
||||
<tags>EnableHover</tags>
|
||||
</children>
|
||||
</children>
|
||||
</trimBars>
|
||||
<trimBars xmi:id="_JHMt8HS8EeWBq8z1Dv39LA" elementId="org.eclipse.ui.trim.status" side="Bottom">
|
||||
<children xsi:type="menu:ToolControl" xmi:id="_YsBi8HfLEeWwZ-9vrAR2UQ" elementId="org.eclipse.ui.StatusLine" contributionURI="bundleclass://com.minres.scviewer.e4.application/com.minres.scviewer.e4.application.internal.status.WaveStatusBarControl">
|
||||
@ -152,17 +161,51 @@
|
||||
<handlers xmi:id="_UUnX8IoNEeWxJ_wPkM6yGQ" elementId="com.minres.scviewer.e4.application.handler.set_them" contributionURI="bundleclass://com.minres.scviewer.e4.application/com.minres.scviewer.e4.application.handlers.ThemeSetHandler" command="_KlGlsIoNEeWxJ_wPkM6yGQ"/>
|
||||
<handlers xmi:id="_V4EscIuGEeWid7xO48ZBXw" elementId="com.minres.scviewer.e4.application.handler.setreleationtype" contributionURI="bundleclass://com.minres.scviewer.e4.application/com.minres.scviewer.e4.application.handlers.SetRelationTypeHandler" command="_E9lUgIt2EeWid7xO48ZBXw"/>
|
||||
<handlers xmi:id="__99WoJebEeW09eyIbHsdvg" elementId="com.minres.scviewer.e4.application.handler.loadStoreSettings" contributionURI="bundleclass://com.minres.scviewer.e4.application/com.minres.scviewer.e4.application.handlers.LoadStoreSettingsHandler" command="_7-AIMJebEeW09eyIbHsdvg"/>
|
||||
<handlers xmi:id="_x4pSEGtTEeqmlpoaaMHoiw" elementId="com.minres.scviewer.e4.application.handler.0" contributionURI="bundleclass://com.minres.scviewer.e4.application/com.minres.scviewer.e4.application.handlers.EnableHover" command="_uyeyYGtTEeqmlpoaaMHoiw"/>
|
||||
<bindingTables xmi:id="_95PfvnNmEeWBq8z1Dv39LA" bindingContext="_95PfuXNmEeWBq8z1Dv39LA">
|
||||
<bindings xmi:id="_95Pfv3NmEeWBq8z1Dv39LA" keySequence="M1+Q" command="_95PfvHNmEeWBq8z1Dv39LA"/>
|
||||
<bindings xmi:id="_95PfwnNmEeWBq8z1Dv39LA" keySequence="M1+O" command="_95PfwHNmEeWBq8z1Dv39LA"/>
|
||||
<bindings xmi:id="_95PfxXNmEeWBq8z1Dv39LA" keySequence="M1+S" command="_95Pfw3NmEeWBq8z1Dv39LA"/>
|
||||
<bindings xmi:id="_95PfyHNmEeWBq8z1Dv39LA" keySequence="M1+A" command="_bV-TMHXHEeWwZ-9vrAR2UQ"/>
|
||||
<bindings xmi:id="_95Pfv3NmEeWBq8z1Dv39LA" elementId="com.minres.scviewer.e4.application.keybinding.quit" keySequence="M1+Q" command="_95PfvHNmEeWBq8z1Dv39LA">
|
||||
<tags>type:user</tags>
|
||||
</bindings>
|
||||
</bindingTables>
|
||||
<bindingTables xmi:id="_zZFy0GVNEeqSQM-A6dw9ig" elementId="com.minres.scviewer.e4.application.bindingtable.waveform" bindingContext="_q4VSsGVNEeqSQM-A6dw9ig">
|
||||
<bindings xmi:id="_1o3dEGVNEeqSQM-A6dw9ig" elementId="com.minres.scviewer.e4.application.keybinding.zoom_in" keySequence="M1++" command="_693GoHcqEeWwZ-9vrAR2UQ">
|
||||
<tags>type:user</tags>
|
||||
<parameters xmi:id="_53UagGVNEeqSQM-A6dw9ig" elementId="com.minres.scviewer.e4.application.parameter.33" name="com.minres.scviewer.e4.application.command.zoomcommand.parameter.level" value="in"/>
|
||||
</bindings>
|
||||
<bindings xmi:id="_8i3awGVNEeqSQM-A6dw9ig" elementId="com.minres.scviewer.e4.application.keybinding.zoom_out" keySequence="M1+-" command="_693GoHcqEeWwZ-9vrAR2UQ">
|
||||
<tags>type:user</tags>
|
||||
<parameters xmi:id="__UCh4GVNEeqSQM-A6dw9ig" elementId="com.minres.scviewer.e4.application.parameter.34" name="com.minres.scviewer.e4.application.command.zoomcommand.parameter.level" value="out"/>
|
||||
</bindings>
|
||||
</bindingTables>
|
||||
<bindingTables xmi:id="_XullMGVOEeqSQM-A6dw9ig" elementId="com.minres.scviewer.e4.application.bindingtable.window" bindingContext="_95PfunNmEeWBq8z1Dv39LA">
|
||||
<bindings xmi:id="_95PfwnNmEeWBq8z1Dv39LA" elementId="com.minres.scviewer.e4.application.keybinding.load" keySequence="M1+L" command="_7-AIMJebEeW09eyIbHsdvg">
|
||||
<tags>type:user</tags>
|
||||
<parameters xmi:id="_G_ulwGVPEeqSQM-A6dw9ig" elementId="com.minres.scviewer.e4.application.parameter.35" name="com.minres.scviewer.e4.application.commandparameter.loadStore" value="load"/>
|
||||
</bindings>
|
||||
<bindings xmi:id="_95PfxXNmEeWBq8z1Dv39LA" elementId="com.minres.scviewer.e4.application.keybinding.save" keySequence="M1+S" command="_7-AIMJebEeW09eyIbHsdvg">
|
||||
<tags>type:user</tags>
|
||||
<parameters xmi:id="_NJlf8GVPEeqSQM-A6dw9ig" elementId="com.minres.scviewer.e4.application.parameter.36" name="com.minres.scviewer.e4.application.commandparameter.loadStore" value="store"/>
|
||||
</bindings>
|
||||
<bindings xmi:id="_s7JNEGVPEeqSQM-A6dw9ig" elementId="com.minres.scviewer.e4.application.keybinding.preferences" keySequence="M1+," command="_AxH6sIl_EeWxJ_wPkM6yGQ">
|
||||
<tags>type:user</tags>
|
||||
</bindings>
|
||||
<bindings xmi:id="_3PRIQGVPEeqSQM-A6dw9ig" elementId="com.minres.scviewer.e4.application.keybinding.open" keySequence="M1+O" command="_95PfwHNmEeWBq8z1Dv39LA">
|
||||
<tags>type:user</tags>
|
||||
</bindings>
|
||||
</bindingTables>
|
||||
<bindingTables xmi:id="_mnMrUGVmEeqSQM-A6dw9ig" elementId="com.minres.scviewer.e4.application.bindingtable.0" bindingContext="_iQ3kQGVmEeqSQM-A6dw9ig">
|
||||
<bindings xmi:id="_n9yDwGVmEeqSQM-A6dw9ig" elementId="com.minres.scviewer.e4.application.keybinding.0" keySequence="M1+A" command="_bV-TMHXHEeWwZ-9vrAR2UQ">
|
||||
<tags>type:user</tags>
|
||||
</bindings>
|
||||
</bindingTables>
|
||||
<rootContext xmi:id="_95PfuXNmEeWBq8z1Dv39LA" elementId="org.eclipse.ui.contexts.dialogAndWindow" name="In Dialog and Windows">
|
||||
<children xmi:id="_95PfunNmEeWBq8z1Dv39LA" elementId="org.eclipse.ui.contexts.window" name="In Windows"/>
|
||||
<children xmi:id="_95PfunNmEeWBq8z1Dv39LA" elementId="org.eclipse.ui.contexts.window" name="In Windows">
|
||||
<children xmi:id="_q4VSsGVNEeqSQM-A6dw9ig" elementId="com.minres.scviewer.e4.application.bindingcontext.waveform" name="In Waveform Part"/>
|
||||
<children xmi:id="_iQ3kQGVmEeqSQM-A6dw9ig" elementId="com.minres.scviewer.e4.application.bindingcontext.indesignbrowser" name="In DesignBrowser"/>
|
||||
</children>
|
||||
<children xmi:id="_95Pfu3NmEeWBq8z1Dv39LA" elementId="org.eclipse.ui.contexts.dialog" name="In Dialogs"/>
|
||||
</rootContext>
|
||||
<descriptors xmi:id="_KicY0HRMEeWBq8z1Dv39LA" elementId="com.minres.scviewer.e4.application.partdescriptor.waveformviewer" label="SCViewer" iconURI="platform:/plugin/com.minres.scviewer.e4.application/icons/scviewer.png" allowMultiple="true" category="General" closeable="true" contributionURI="bundleclass://com.minres.scviewer.e4.application/com.minres.scviewer.e4.application.parts.WaveformViewer">
|
||||
<descriptors xmi:id="_KicY0HRMEeWBq8z1Dv39LA" elementId="com.minres.scviewer.e4.application.partdescriptor.waveformviewer" label="SCViewer" iconURI="platform:/plugin/com.minres.scviewer.e4.application/icons/scviewer.png" bindingContexts="_q4VSsGVNEeqSQM-A6dw9ig" allowMultiple="true" category="General" closeable="true" contributionURI="bundleclass://com.minres.scviewer.e4.application/com.minres.scviewer.e4.application.parts.WaveformViewer">
|
||||
<tags>categoryTag:General</tags>
|
||||
<handlers xmi:id="_BSIuEHacEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.handler.navigateEventCommand" contributionURI="bundleclass://com.minres.scviewer.e4.application/com.minres.scviewer.e4.application.handlers.NavigateEvent" command="_79rx4HabEeWwZ-9vrAR2UQ"/>
|
||||
<handlers xmi:id="_JpdGwHXKEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.handler.navigateTransCommand" contributionURI="bundleclass://com.minres.scviewer.e4.application/com.minres.scviewer.e4.application.handlers.NavigateTrans" command="_Gn3lEHXKEeWwZ-9vrAR2UQ"/>
|
||||
@ -249,6 +292,7 @@
|
||||
<commands xmi:id="_4C_asM3ZEei6rfTGo88R-w" elementId="com.minres.scviewer.e4.application.command.changevaluedisplay" commandName="Change Value Display Command">
|
||||
<parameters xmi:id="_4C_asc3ZEei6rfTGo88R-w" elementId="com.minres.scviewer.e4.application.commandparameter.changevaluedisplay" name="Type" optional="false"/>
|
||||
</commands>
|
||||
<commands xmi:id="_uyeyYGtTEeqmlpoaaMHoiw" elementId="com.minres.scviewer.e4.application.command.enablehover" commandName="Enable hover" description="Enable hover window in waveform"/>
|
||||
<addons xmi:id="_95PfsnNmEeWBq8z1Dv39LA" elementId="org.eclipse.e4.core.commands.service" contributionURI="bundleclass://org.eclipse.e4.core.commands/org.eclipse.e4.core.commands.CommandServiceAddon"/>
|
||||
<addons xmi:id="_95Pfs3NmEeWBq8z1Dv39LA" elementId="org.eclipse.e4.ui.contexts.service" contributionURI="bundleclass://org.eclipse.e4.ui.services/org.eclipse.e4.ui.services.ContextServiceAddon"/>
|
||||
<addons xmi:id="_95PftHNmEeWBq8z1Dv39LA" elementId="org.eclipse.e4.ui.bindings.service" contributionURI="bundleclass://org.eclipse.e4.ui.bindings/org.eclipse.e4.ui.bindings.BindingServiceAddon"/>
|
||||
|
@ -2,7 +2,7 @@ Manifest-Version: 1.0
|
||||
Bundle-ManifestVersion: 2
|
||||
Bundle-Name: %Bundle-Name
|
||||
Bundle-SymbolicName: com.minres.scviewer.e4.application;singleton:=true
|
||||
Bundle-Version: 2.0.5.qualifier
|
||||
Bundle-Version: 2.4.1.qualifier
|
||||
Bundle-Vendor: %Bundle-Vendor
|
||||
Require-Bundle: javax.inject;bundle-version="1.0.0",
|
||||
org.eclipse.core.runtime;bundle-version="3.11.1",
|
||||
|
@ -1,4 +1,3 @@
|
||||
output.. = bin/
|
||||
bin.includes = META-INF/,\
|
||||
.,\
|
||||
plugin.xml,\
|
||||
|
BIN
com.minres.scviewer.e4.application/icons/lightbulb.png
Normal file
BIN
com.minres.scviewer.e4.application/icons/lightbulb.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 782 B |
BIN
com.minres.scviewer.e4.application/icons/magifier_zoom_out.png
Executable file
BIN
com.minres.scviewer.e4.application/icons/magifier_zoom_out.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 657 B |
BIN
com.minres.scviewer.e4.application/icons/magnifier.png
Executable file
BIN
com.minres.scviewer.e4.application/icons/magnifier.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 615 B |
BIN
com.minres.scviewer.e4.application/icons/magnifier_zoom_in.png
Executable file
BIN
com.minres.scviewer.e4.application/icons/magnifier_zoom_in.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 680 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">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>com.minres.scviewer.e4.application</artifactId>
|
||||
<version>2.0.5-SNAPSHOT</version>
|
||||
<version>2.4.1-SNAPSHOT</version>
|
||||
<parent>
|
||||
<groupId>com.minres.scviewer</groupId>
|
||||
<artifactId>com.minres.scviewer.parent</artifactId>
|
||||
|
@ -86,7 +86,7 @@ public class E4LifeCycle {
|
||||
ContextInjectionFactory.inject(openViewHandler, ctx);
|
||||
eventBroker.unsubscribe(this);
|
||||
for(String name:opt.getSet().getData()){
|
||||
if(new File(name).exists()) openViewHandler.openViewForFile(name);
|
||||
openViewHandler.openViewForFile(name);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -158,19 +158,29 @@ public class E4LifeCycle {
|
||||
* @param name the name
|
||||
*/
|
||||
public void openViewForFile(String name){
|
||||
File file = new File(name);
|
||||
File file = new File(getFirstFileName(name));
|
||||
if(!file.exists())
|
||||
return;
|
||||
MPart part = partService.createPart("com.minres.scviewer.e4.application.partdescriptor.waveformviewer"); //$NON-NLS-1$
|
||||
part.setLabel(file.getName());
|
||||
MPartStack partStack = (MPartStack)modelService.find("org.eclipse.editorss", app); //$NON-NLS-1$
|
||||
partStack.getChildren().add(part);
|
||||
partService.showPart(part, PartState.ACTIVATE);
|
||||
IEclipseContext ctx=part.getContext();
|
||||
ctx.modify("input", file); //$NON-NLS-1$
|
||||
ctx.modify("input", name); //$NON-NLS-1$
|
||||
//ctx.declareModifiable("input"); //$NON-NLS-1$
|
||||
ctx.modify("config", confFile); //$NON-NLS-1$
|
||||
//ctx.declareModifiable("config"); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
private String getFirstFileName(String name) {
|
||||
if(name.contains(",")) {
|
||||
String[] tokens = name.split(",");
|
||||
return tokens[0];
|
||||
} else
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setConfigFile(String confFile) {
|
||||
this.confFile=confFile;
|
||||
}
|
||||
|
@ -9,6 +9,7 @@ public class Messages extends NLS {
|
||||
public static String DesignBrowser_12;
|
||||
public static String DesignBrowser_16;
|
||||
public static String DesignBrowser_2;
|
||||
public static String DesignBrowser_3;
|
||||
public static String DesignBrowser_4;
|
||||
public static String DesignBrowser_8;
|
||||
public static String LoadingWaveformDb_0;
|
||||
@ -21,6 +22,7 @@ public class Messages extends NLS {
|
||||
public static String RelationTypeToolControl_1;
|
||||
public static String ResourceManager_0;
|
||||
public static String SCViewerPreferencesPage_0;
|
||||
public static String SCViewerPreferencesPage_1;
|
||||
public static String StatusBarControl_1;
|
||||
public static String StatusBarControl_2;
|
||||
public static String StatusBarControl_3;
|
||||
|
@ -40,13 +40,16 @@ public class AddWaveformHandler {
|
||||
@Named(IServiceConstants.ACTIVE_SELECTION) @Optional IStructuredSelection selection) {
|
||||
if(designBrowser==null) designBrowser = getListPart( partService);
|
||||
if(designBrowser==null || designBrowser.getActiveWaveformViewerPart()==null) return false;
|
||||
Boolean before = "before".equalsIgnoreCase(where); //$NON-NLS-1$
|
||||
boolean before = "before".equalsIgnoreCase(where); //$NON-NLS-1$
|
||||
IStructuredSelection waveformSelection = null;
|
||||
if(designBrowser.getActiveWaveformViewerPart()!=null)
|
||||
waveformSelection = (IStructuredSelection)designBrowser.getActiveWaveformViewerPart().getSelection();
|
||||
if("true".equalsIgnoreCase(all)) //$NON-NLS-1$
|
||||
return designBrowser.getFilteredChildren().length>0 &&
|
||||
(!before || ((IStructuredSelection)designBrowser.getActiveWaveformViewerPart().getSelection()).size()>0);
|
||||
(!before || (waveformSelection!=null && waveformSelection.size()>0));
|
||||
else
|
||||
return selection.size()>0 &&
|
||||
(!before || ((IStructuredSelection)designBrowser.getActiveWaveformViewerPart().getSelection()).size()>0);
|
||||
return selection!=null && selection.size()>0 &&
|
||||
(!before || (waveformSelection!=null && waveformSelection.size()>0));
|
||||
}
|
||||
|
||||
@Execute
|
||||
|
@ -0,0 +1,49 @@
|
||||
|
||||
package com.minres.scviewer.e4.application.handlers;
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.inject.Inject;
|
||||
|
||||
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
|
||||
import org.eclipse.e4.core.contexts.Active;
|
||||
import org.eclipse.e4.core.di.annotations.Execute;
|
||||
import org.eclipse.e4.core.di.extensions.Preference;
|
||||
import org.eclipse.e4.ui.model.application.MApplication;
|
||||
import org.eclipse.e4.ui.model.application.ui.basic.MPart;
|
||||
import org.eclipse.e4.ui.model.application.ui.basic.MWindow;
|
||||
import org.eclipse.e4.ui.model.application.ui.menu.MHandledItem;
|
||||
import org.eclipse.e4.ui.workbench.modeling.EModelService;
|
||||
|
||||
import com.minres.scviewer.e4.application.preferences.PreferenceConstants;
|
||||
|
||||
@SuppressWarnings("restriction")
|
||||
public class EnableHover {
|
||||
static final String TAG_NAME = "EnableHover"; //$NON-NLS-1$
|
||||
|
||||
@Inject
|
||||
@Preference(nodePath = PreferenceConstants.PREFERENCES_SCOPE)
|
||||
IEclipsePreferences prefs;
|
||||
|
||||
@Inject
|
||||
MApplication application;
|
||||
|
||||
@PostConstruct
|
||||
public void initialize(EModelService modelService) {
|
||||
List<String> tags = new LinkedList<>();
|
||||
tags.add(TAG_NAME);
|
||||
List<MHandledItem> elements = modelService.findElements(application, null, MHandledItem.class, tags );
|
||||
// cover initialization stuff, sync it with code
|
||||
for( MHandledItem hi : elements ){
|
||||
hi.setSelected(prefs.getBoolean(PreferenceConstants.SHOW_HOVER, true));
|
||||
}
|
||||
}
|
||||
|
||||
@Execute
|
||||
public void execute(@Active MPart part, @Active MWindow window, MHandledItem handledItem, EModelService modelService ) {
|
||||
prefs.putBoolean(PreferenceConstants.SHOW_HOVER, handledItem.isSelected());
|
||||
}
|
||||
|
||||
}
|
@ -10,6 +10,8 @@
|
||||
*******************************************************************************/
|
||||
package com.minres.scviewer.e4.application.handlers;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import javax.inject.Named;
|
||||
|
||||
import org.eclipse.e4.core.di.annotations.CanExecute;
|
||||
@ -20,6 +22,7 @@ import org.eclipse.e4.ui.workbench.modeling.EModelService;
|
||||
import org.eclipse.e4.ui.workbench.modeling.EPartService;
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.widgets.FileDialog;
|
||||
import org.eclipse.swt.widgets.MessageBox;
|
||||
import org.eclipse.swt.widgets.Shell;
|
||||
|
||||
import com.minres.scviewer.e4.application.Messages;
|
||||
@ -38,21 +41,60 @@ public class LoadStoreSettingsHandler {
|
||||
@Execute
|
||||
public void execute(@Named(PARAMETER_ID) String param, Shell shell, MApplication app, EModelService modelService,
|
||||
EPartService partService){
|
||||
|
||||
boolean load = "load".equals(param); //$NON-NLS-1$
|
||||
FileDialog dialog = new FileDialog(shell, load?SWT.OPEN:SWT.SAVE);
|
||||
dialog.setFilterExtensions (new String []{Messages.LoadStoreSettingsHandler_2});
|
||||
if(!load) dialog.setFileName(Messages.LoadStoreSettingsHandler_3);
|
||||
String res = dialog.open();
|
||||
MPart part = partService.getActivePart();
|
||||
if(res!=null && part!=null){
|
||||
Object obj = part.getObject();
|
||||
if(obj instanceof WaveformViewer){
|
||||
if(load)
|
||||
((WaveformViewer)obj).loadState(res);
|
||||
else
|
||||
((WaveformViewer)obj).saveState(res);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
String fileName = null;
|
||||
MPart part = partService.getActivePart();
|
||||
Object obj = part.getObject();
|
||||
|
||||
// Save active tab settings
|
||||
if(!load) {
|
||||
// 3 possible cases when when saving active tab settings:
|
||||
// - user dismisses the dialog by pressing Cancel
|
||||
// - selected file name does not exist
|
||||
// - user agrees to overwrite existing file
|
||||
boolean done = false;
|
||||
while (!done) {
|
||||
// open the File Dialog
|
||||
fileName = dialog.open();
|
||||
if (fileName == null) {
|
||||
// user has cancelled -> quit and return
|
||||
done = true;
|
||||
} else {
|
||||
// user has selected a file -> see if it already exists
|
||||
File file = new File(fileName);
|
||||
if (file.exists()) {
|
||||
// file already exists -> asks for confirmation
|
||||
MessageBox mb = new MessageBox(dialog.getParent(), SWT.ICON_WARNING
|
||||
| SWT.YES | SWT.NO);
|
||||
mb.setText("Confirm overwrite");
|
||||
mb.setMessage(fileName + " already exists. Do you want to overwrite it?");
|
||||
// user clicks Yes -> all done, drop out
|
||||
if(mb.open() == SWT.YES) {
|
||||
((WaveformViewer)obj).saveState(fileName);
|
||||
done = true;
|
||||
} else { // user clicks No -> redisplay the File Dialog
|
||||
done = false;
|
||||
}
|
||||
} else {
|
||||
// file does not exist -> save and drop out
|
||||
((WaveformViewer)obj).saveState(fileName);
|
||||
done = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return;
|
||||
} // end if(!load)
|
||||
|
||||
else { // load active tab settings
|
||||
String res = dialog.open();
|
||||
if(res != null && part!=null && (obj instanceof WaveformViewer)) {
|
||||
((WaveformViewer)obj).loadState(res);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -11,6 +11,7 @@
|
||||
package com.minres.scviewer.e4.application.handlers;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.eclipse.e4.core.contexts.IEclipseContext;
|
||||
import org.eclipse.e4.core.di.annotations.Execute;
|
||||
@ -31,21 +32,27 @@ public class OpenHandler {
|
||||
public void execute(Shell shell, MApplication app, EModelService modelService, EPartService partService){
|
||||
FileDialog dialog = new FileDialog(shell, SWT.OPEN | SWT.MULTI);
|
||||
dialog.setFilterExtensions (new String []{Messages.OpenHandler_0});
|
||||
dialog.open();
|
||||
String ret = dialog.open();
|
||||
if(ret==null)
|
||||
return;
|
||||
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()){
|
||||
if(file.exists())
|
||||
files.add(file);
|
||||
}
|
||||
MPart part = partService .createPart("com.minres.scviewer.e4.application.partdescriptor.waveformviewer"); //$NON-NLS-1$
|
||||
part.setLabel(file.getName());
|
||||
part.setLabel(files.get(0).getName());
|
||||
MPartStack partStack = (MPartStack)modelService.find("org.eclipse.editorss", app); //$NON-NLS-1$
|
||||
partStack.getChildren().add(part);
|
||||
partService.showPart(part, PartState.ACTIVATE);
|
||||
IEclipseContext ctx=part.getContext();
|
||||
ctx.modify("input", file); //$NON-NLS-1$
|
||||
final IEclipseContext ctx=part.getContext();
|
||||
files.stream()
|
||||
.map(x -> x.getAbsolutePath())
|
||||
.reduce((s1, s2) -> s1 + "," + s2)
|
||||
.ifPresent(s -> ctx.modify("input", s)); //$NON-NLS-1$
|
||||
ctx.modify("config", ""); //$NON-NLS-1$
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -11,13 +11,33 @@
|
||||
|
||||
package com.minres.scviewer.e4.application.handlers;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import org.eclipse.e4.core.di.annotations.Execute;
|
||||
import org.eclipse.e4.core.di.annotations.Optional;
|
||||
import org.eclipse.e4.ui.model.application.ui.basic.MPart;
|
||||
import org.eclipse.e4.ui.workbench.modeling.EPartService;
|
||||
|
||||
import com.minres.scviewer.e4.application.parts.DesignBrowser;
|
||||
|
||||
public class SelectAllHandler {
|
||||
|
||||
@Execute
|
||||
public void execute() {
|
||||
@Inject @Optional DesignBrowser designBrowser;
|
||||
|
||||
@Execute
|
||||
public void execute(EPartService partService) {
|
||||
if(designBrowser==null) designBrowser = getListPart(partService);
|
||||
if(designBrowser!=null){
|
||||
designBrowser.selectAllWaveforms();
|
||||
}
|
||||
}
|
||||
|
||||
protected DesignBrowser getListPart(EPartService partService){
|
||||
MPart part = partService.getActivePart();
|
||||
if(part.getObject() instanceof DesignBrowser)
|
||||
return (DesignBrowser) part.getObject();
|
||||
else
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
@ -1,8 +1,9 @@
|
||||
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/SCViewer and the master branch is mirrored to GitHub: https://git.com/minres/SCViewer\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
|
||||
DesignBrowser_12=Append all after
|
||||
DesignBrowser_16=Insert all before
|
||||
DesignBrowser_2=Enter text to filter waveforms
|
||||
DesignBrowser_3=Enter text to filter hierarchy
|
||||
DesignBrowser_4=Append after
|
||||
DesignBrowser_8=Insert before
|
||||
LoadingWaveformDb_0=Database loading...
|
||||
@ -15,6 +16,7 @@ RelationTypeToolControl_0=------------
|
||||
RelationTypeToolControl_1=Select
|
||||
ResourceManager_0=Wrong decorate corner
|
||||
SCViewerPreferencesPage_0=Check for changed database
|
||||
SCViewerPreferencesPage_1=Show hover window in waveform
|
||||
StatusBarControl_1=Currently running:
|
||||
StatusBarControl_2=\nLast task:
|
||||
StatusBarControl_3=Currently running:
|
||||
|
@ -50,9 +50,6 @@ import com.minres.scviewer.e4.application.Messages;
|
||||
*/
|
||||
public class AboutDialog extends Dialog {
|
||||
|
||||
/** The product title. */
|
||||
private String productTitle=Messages.AboutDialog_0;
|
||||
|
||||
/** The copyright text. */
|
||||
private String copyrightText=Messages.AboutDialog_1;
|
||||
|
||||
@ -106,8 +103,8 @@ public class AboutDialog extends Dialog {
|
||||
styledText.setLayoutData(gd_styledText);
|
||||
Version version = Platform.getProduct().getDefiningBundle().getVersion();
|
||||
String versionString = String.format("%d.%d.%d", version.getMajor(), version.getMinor(), version.getMicro());
|
||||
String pt = NLS.bind(Messages.AboutDialog_0, versionString);
|
||||
styledText.setText(pt+copyrightText);
|
||||
String productTitle = NLS.bind(Messages.AboutDialog_0, versionString);
|
||||
styledText.setText(productTitle+copyrightText);
|
||||
styledText.setBackground(white);
|
||||
styledText.setWordWrap(true);
|
||||
styledText.setLeftMargin(5);
|
||||
@ -139,7 +136,8 @@ public class AboutDialog extends Dialog {
|
||||
// links are activated on mouse down when the control key is held down
|
||||
// if ((event.stateMask & SWT.MOD1) != 0) {
|
||||
try {
|
||||
int offset = ((StyledText)event.widget).getOffsetAtPoint(new Point (event.x, event.y));
|
||||
@SuppressWarnings("deprecation")
|
||||
int offset = ((StyledText)event.widget).getOffsetAtLocation(new Point (event.x, event.y));
|
||||
StyleRange style = ((StyledText)event.widget).getStyleRangeAtOffset(offset);
|
||||
if (style != null && style.underline && style.underlineStyle == SWT.UNDERLINE_LINK) {
|
||||
Desktop.getDesktop().browse(new java.net.URI(style.data.toString()));
|
||||
|
@ -13,8 +13,11 @@ package com.minres.scviewer.e4.application.parts;
|
||||
import java.beans.PropertyChangeEvent;
|
||||
import java.beans.PropertyChangeListener;
|
||||
import java.lang.annotation.Annotation;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.regex.PatternSyntaxException;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.inject.Inject;
|
||||
@ -34,14 +37,18 @@ import org.eclipse.e4.ui.services.IServiceConstants;
|
||||
import org.eclipse.e4.ui.workbench.modeling.EPartService;
|
||||
import org.eclipse.e4.ui.workbench.modeling.ESelectionService;
|
||||
import org.eclipse.jface.viewers.DoubleClickEvent;
|
||||
import org.eclipse.jface.viewers.IContentProvider;
|
||||
import org.eclipse.jface.viewers.IDoubleClickListener;
|
||||
import org.eclipse.jface.viewers.ISelection;
|
||||
import org.eclipse.jface.viewers.ISelectionChangedListener;
|
||||
import org.eclipse.jface.viewers.IStructuredContentProvider;
|
||||
import org.eclipse.jface.viewers.IStructuredSelection;
|
||||
import org.eclipse.jface.viewers.ITreeContentProvider;
|
||||
import org.eclipse.jface.viewers.ITreePathContentProvider;
|
||||
import org.eclipse.jface.viewers.SelectionChangedEvent;
|
||||
import org.eclipse.jface.viewers.StructuredSelection;
|
||||
import org.eclipse.jface.viewers.TableViewer;
|
||||
import org.eclipse.jface.viewers.TreePath;
|
||||
import org.eclipse.jface.viewers.TreeViewer;
|
||||
import org.eclipse.jface.viewers.Viewer;
|
||||
import org.eclipse.jface.viewers.ViewerFilter;
|
||||
@ -49,6 +56,8 @@ import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.custom.SashForm;
|
||||
import org.eclipse.swt.events.ControlAdapter;
|
||||
import org.eclipse.swt.events.ControlEvent;
|
||||
import org.eclipse.swt.events.DisposeEvent;
|
||||
import org.eclipse.swt.events.DisposeListener;
|
||||
import org.eclipse.swt.events.ModifyEvent;
|
||||
import org.eclipse.swt.events.ModifyListener;
|
||||
import org.eclipse.swt.events.PaintEvent;
|
||||
@ -58,12 +67,14 @@ import org.eclipse.swt.events.SelectionEvent;
|
||||
import org.eclipse.swt.layout.GridData;
|
||||
import org.eclipse.swt.layout.GridLayout;
|
||||
import org.eclipse.swt.widgets.Composite;
|
||||
import org.eclipse.swt.widgets.Control;
|
||||
import org.eclipse.swt.widgets.Text;
|
||||
import org.eclipse.swt.widgets.ToolBar;
|
||||
import org.eclipse.swt.widgets.ToolItem;
|
||||
import org.eclipse.wb.swt.ResourceManager;
|
||||
import org.eclipse.wb.swt.SWTResourceManager;
|
||||
|
||||
import com.minres.scviewer.database.HierNode;
|
||||
import com.minres.scviewer.database.IHierNode;
|
||||
import com.minres.scviewer.database.ITx;
|
||||
import com.minres.scviewer.database.IWaveform;
|
||||
@ -106,17 +117,23 @@ public class DesignBrowser {
|
||||
/** The tree viewer. */
|
||||
private TreeViewer treeViewer;
|
||||
|
||||
/** The name filter of the design browser tree. */
|
||||
private Text treeNameFilter;
|
||||
|
||||
/** The attribute filter. */
|
||||
StreamTTreeFilter treeAttributeFilter;
|
||||
|
||||
/** The name filter. */
|
||||
private Text nameFilter;
|
||||
private Text tableNameFilter;
|
||||
|
||||
/** The attribute filter. */
|
||||
StreamTableFilter tableAttributeFilter;
|
||||
|
||||
/** The tx table viewer. */
|
||||
private TableViewer txTableViewer;
|
||||
|
||||
/** The append all item. */
|
||||
ToolItem appendItem, insertItem, insertAllItem, appendAllItem;
|
||||
|
||||
/** The attribute filter. */
|
||||
WaveformAttributeFilter attributeFilter;
|
||||
ToolItem appendItem, insertItem;
|
||||
|
||||
/** The other selection count. */
|
||||
int thisSelectionCount=0, otherSelectionCount=0;
|
||||
@ -185,10 +202,25 @@ public class DesignBrowser {
|
||||
*/
|
||||
public void createTreeViewerComposite(Composite parent) {
|
||||
parent.setLayout(new GridLayout(1, false));
|
||||
|
||||
treeNameFilter = new Text(parent, SWT.BORDER);
|
||||
treeNameFilter.setMessage(Messages.DesignBrowser_3);
|
||||
treeNameFilter.addModifyListener(new ModifyListener() {
|
||||
@Override
|
||||
public void modifyText(ModifyEvent e) {
|
||||
treeAttributeFilter.setSearchText(((Text) e.widget).getText());
|
||||
treeViewer.refresh();
|
||||
}
|
||||
});
|
||||
treeNameFilter.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
|
||||
|
||||
treeAttributeFilter = new StreamTTreeFilter();
|
||||
|
||||
treeViewer = new TreeViewer(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
|
||||
treeViewer.getTree().setLayoutData(new GridData(GridData.FILL_BOTH));
|
||||
treeViewer.setContentProvider(new TxDbContentProvider());
|
||||
treeViewer.setLabelProvider(new TxDbLabelProvider());
|
||||
treeViewer.addFilter(treeAttributeFilter);
|
||||
treeViewer.setUseHashlookup(true);
|
||||
treeViewer.setAutoExpandLevel(2);
|
||||
treeViewer.addSelectionChangedListener(new ISelectionChangedListener() {
|
||||
@ -198,10 +230,14 @@ public class DesignBrowser {
|
||||
ISelection selection=event.getSelection();
|
||||
if( selection instanceof IStructuredSelection) {
|
||||
Object object= ((IStructuredSelection)selection).getFirstElement();
|
||||
if(object instanceof IHierNode&& ((IHierNode)object).getChildNodes().size()!=0){
|
||||
if(object instanceof IHierNode && ((IHierNode)object).getChildNodes().size()!=0){
|
||||
txTableViewer.setInput(object);
|
||||
updateButtons();
|
||||
}
|
||||
else { //if selection is changed but empty
|
||||
txTableViewer.setInput(null);
|
||||
updateButtons();
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
@ -215,25 +251,25 @@ public class DesignBrowser {
|
||||
public void createTableComposite(Composite parent) {
|
||||
parent.setLayout(new GridLayout(1, false));
|
||||
|
||||
nameFilter = new Text(parent, SWT.BORDER);
|
||||
nameFilter.setMessage(Messages.DesignBrowser_2);
|
||||
nameFilter.addModifyListener(new ModifyListener() {
|
||||
tableNameFilter = new Text(parent, SWT.BORDER);
|
||||
tableNameFilter.setMessage(Messages.DesignBrowser_2);
|
||||
tableNameFilter.addModifyListener(new ModifyListener() {
|
||||
@Override
|
||||
public void modifyText(ModifyEvent e) {
|
||||
attributeFilter.setSearchText(((Text) e.widget).getText());
|
||||
tableAttributeFilter.setSearchText(((Text) e.widget).getText());
|
||||
updateButtons();
|
||||
txTableViewer.refresh();
|
||||
}
|
||||
});
|
||||
nameFilter.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
|
||||
tableNameFilter.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
|
||||
|
||||
attributeFilter = new WaveformAttributeFilter();
|
||||
tableAttributeFilter = new StreamTableFilter();
|
||||
|
||||
txTableViewer = new TableViewer(parent);
|
||||
txTableViewer.setContentProvider(new TxDbContentProvider(true));
|
||||
txTableViewer.setLabelProvider(new TxDbLabelProvider());
|
||||
txTableViewer.getTable().setLayoutData(new GridData(GridData.FILL_BOTH));
|
||||
txTableViewer.addFilter(attributeFilter);
|
||||
txTableViewer.addFilter(tableAttributeFilter);
|
||||
txTableViewer.addDoubleClickListener(new IDoubleClickListener() {
|
||||
@Override
|
||||
public void doubleClick(DoubleClickEvent event) {
|
||||
@ -251,7 +287,6 @@ public class DesignBrowser {
|
||||
updateButtons();
|
||||
}
|
||||
});
|
||||
|
||||
menuService.registerContextMenu(txTableViewer.getControl(), POPUP_ID);
|
||||
|
||||
ToolBar toolBar = new ToolBar(parent, SWT.FLAT | SWT.RIGHT);
|
||||
@ -286,48 +321,6 @@ public class DesignBrowser {
|
||||
ContextInjectionFactory.invoke(myHandler, Execute.class, eclipseCtx);
|
||||
}
|
||||
});
|
||||
new ToolItem(toolBar, SWT.SEPARATOR);
|
||||
|
||||
appendAllItem = new ToolItem(toolBar, SWT.NONE);
|
||||
appendAllItem.setToolTipText(Messages.DesignBrowser_12);
|
||||
appendAllItem.setImage(ResourceManager.getPluginImage("com.minres.scviewer.e4.application", "icons/append_all_waves.png")); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
appendAllItem.setEnabled(false);
|
||||
|
||||
new ToolItem(toolBar, SWT.SEPARATOR);
|
||||
appendAllItem.addSelectionListener(new SelectionAdapter() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent e) {
|
||||
Object[] all = getFilteredChildren(txTableViewer);
|
||||
if(all.length>0){
|
||||
Object oldSel=selectionService.getSelection();
|
||||
selectionService.setSelection(new StructuredSelection(all));
|
||||
AddWaveformHandler myHandler = new AddWaveformHandler();
|
||||
Object result = runCommand(myHandler, CanExecute.class, "after", false); //$NON-NLS-1$
|
||||
if(result!=null && (Boolean)result)
|
||||
ContextInjectionFactory.invoke(myHandler, Execute.class, eclipseCtx);
|
||||
selectionService.setSelection(oldSel);
|
||||
}
|
||||
}
|
||||
});
|
||||
insertAllItem = new ToolItem(toolBar, SWT.NONE);
|
||||
insertAllItem.setToolTipText(Messages.DesignBrowser_16);
|
||||
insertAllItem.setImage(ResourceManager.getPluginImage("com.minres.scviewer.e4.application", "icons/insert_all_waves.png")); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
insertAllItem.setEnabled(false);
|
||||
insertAllItem.addSelectionListener(new SelectionAdapter() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent e) {
|
||||
Object[] all = getFilteredChildren(txTableViewer);
|
||||
if(all.length>0){
|
||||
Object oldSel=selectionService.getSelection();
|
||||
selectionService.setSelection(new StructuredSelection(all));
|
||||
AddWaveformHandler myHandler = new AddWaveformHandler();
|
||||
Object result = runCommand(myHandler, CanExecute.class, "before", false); //$NON-NLS-1$
|
||||
if(result!=null && (Boolean)result)
|
||||
ContextInjectionFactory.invoke(myHandler, Execute.class, eclipseCtx);
|
||||
selectionService.setSelection(oldSel);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
@ -345,6 +338,26 @@ public class DesignBrowser {
|
||||
updateButtons();
|
||||
}
|
||||
|
||||
/**
|
||||
* reset tree viewer and tableviewer after every closed tab
|
||||
*/
|
||||
protected void resetTreeViewer() {
|
||||
//reset tree- and tableviewer
|
||||
treeViewer.setInput(null);
|
||||
txTableViewer.setInput(null);
|
||||
txTableViewer.setSelection(null);
|
||||
}
|
||||
|
||||
public void selectAllWaveforms() {
|
||||
int itemCount = txTableViewer.getTable().getItemCount();
|
||||
ArrayList<Object> list = new ArrayList<>();
|
||||
for(int i=0; i<itemCount; i++) {
|
||||
list.add(txTableViewer.getElementAt(i));
|
||||
}
|
||||
StructuredSelection sel = new StructuredSelection(list);
|
||||
txTableViewer.setSelection(sel);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the status event.
|
||||
*
|
||||
@ -354,14 +367,28 @@ public class DesignBrowser {
|
||||
@SuppressWarnings("unchecked")
|
||||
@Inject @Optional
|
||||
public void getActiveWaveformViewerEvent(@UIEventTopic(WaveformViewer.ACTIVE_WAVEFORMVIEW) WaveformViewer waveformViewerPart) {
|
||||
if(this.waveformViewerPart!=null)
|
||||
if(this.waveformViewerPart!=null) {
|
||||
this.waveformViewerPart.storeDesignBrowerState(new DBState());
|
||||
}
|
||||
if( this.waveformViewerPart == null || this.waveformViewerPart != waveformViewerPart ) {
|
||||
waveformViewerPart.addDisposeListener( new DisposeListener() {
|
||||
@Override
|
||||
public void widgetDisposed(DisposeEvent e) {
|
||||
Control control = treeViewer.getControl();
|
||||
// check if widget is already disposed (f.ex. because of workbench closing)
|
||||
if (control == null || control.isDisposed()) { //if so: do nothing
|
||||
}else { //reset tree- and tableviewer
|
||||
resetTreeViewer();
|
||||
}
|
||||
}
|
||||
} );
|
||||
}
|
||||
this.waveformViewerPart=waveformViewerPart;
|
||||
IWaveformDb database = waveformViewerPart.getDatabase();
|
||||
Object input = treeViewer.getInput();
|
||||
if(input!=null && input instanceof List<?>){
|
||||
IWaveformDb db = ((List<IWaveformDb>)input).get(0);
|
||||
if(db==database) return; // do nothing if old and new daabase is the same
|
||||
if(db==database) return; // do nothing if old and new database is the same
|
||||
((List<IWaveformDb>)input).get(0).removePropertyChangeListener(treeViewerPCL);
|
||||
}
|
||||
treeViewer.setInput(Arrays.asList(database.isLoaded()?new IWaveformDb[]{database}:new IWaveformDb[]{new LoadingWaveformDb()}));
|
||||
@ -398,27 +425,23 @@ public class DesignBrowser {
|
||||
* Update buttons.
|
||||
*/
|
||||
private void updateButtons() {
|
||||
if(txTableViewer!=null && !insertItem.isDisposed() && !appendItem.isDisposed() &&
|
||||
!appendAllItem.isDisposed() && !insertAllItem.isDisposed()){
|
||||
if(txTableViewer!=null && !insertItem.isDisposed() && !appendItem.isDisposed()){
|
||||
AddWaveformHandler myHandler = new AddWaveformHandler();
|
||||
Object result = runCommand(myHandler, CanExecute.class, "after", false); //$NON-NLS-1$
|
||||
appendItem.setEnabled(result instanceof Boolean && (Boolean)result);
|
||||
result = runCommand(myHandler, CanExecute.class, "after", true); //$NON-NLS-1$
|
||||
appendAllItem.setEnabled(result instanceof Boolean && (Boolean)result);
|
||||
result = runCommand(myHandler, CanExecute.class, "before", false); //$NON-NLS-1$
|
||||
insertItem.setEnabled(result instanceof Boolean && (Boolean)result);
|
||||
result = runCommand(myHandler, CanExecute.class, "before", true); //$NON-NLS-1$
|
||||
insertAllItem.setEnabled(result instanceof Boolean && (Boolean)result);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The Class WaveformAttributeFilter.
|
||||
* The Class StreamTableFilter.
|
||||
*/
|
||||
public class WaveformAttributeFilter extends ViewerFilter {
|
||||
public class StreamTableFilter extends ViewerFilter {
|
||||
|
||||
/** The search string. */
|
||||
private String searchString;
|
||||
private Pattern pattern;
|
||||
|
||||
/**
|
||||
* Sets the search text.
|
||||
@ -426,7 +449,10 @@ public class DesignBrowser {
|
||||
* @param s the new search text
|
||||
*/
|
||||
public void setSearchText(String s) {
|
||||
try {
|
||||
pattern = Pattern.compile(".*" + s + ".*"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
this.searchString = ".*" + s + ".*"; //$NON-NLS-1$ //$NON-NLS-2$
|
||||
} catch (PatternSyntaxException e) {}
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
@ -437,14 +463,103 @@ public class DesignBrowser {
|
||||
if (searchString == null || searchString.length() == 0) {
|
||||
return true;
|
||||
}
|
||||
IWaveform p = (IWaveform) element;
|
||||
if (p.getName().matches(searchString)) {
|
||||
if(element instanceof IWaveform) {
|
||||
if (pattern.matcher(((IWaveform) element).getName()).matches())
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public class StreamTTreeFilter extends ViewerFilter {
|
||||
|
||||
/** The search string. */
|
||||
private String searchString;
|
||||
private Pattern pattern;
|
||||
|
||||
/**
|
||||
* Sets the search text.
|
||||
*
|
||||
* @param s the new search text
|
||||
*/
|
||||
public void setSearchText(String s) {
|
||||
try {
|
||||
pattern = Pattern.compile(".*" + s + ".*");
|
||||
this.searchString = ".*" + s + ".*"; //$NON-NLS-1$ //$NON-NLS-2$
|
||||
} catch (PatternSyntaxException e) {}
|
||||
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.jface.viewers.ViewerFilter#select(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)
|
||||
*/
|
||||
@Override
|
||||
public boolean select(Viewer viewer, Object parentElement, Object element) {
|
||||
return selectTreePath(viewer, new TreePath(new Object[] { parentElement }), element);
|
||||
}
|
||||
|
||||
private boolean selectTreePath(Viewer viewer, TreePath parentPath, Object element) {
|
||||
// Cut off children of elements that are shown repeatedly.
|
||||
for (int i = 0; i < parentPath.getSegmentCount() - 1; i++) {
|
||||
if (element.equals(parentPath.getSegment(i))) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (!(viewer instanceof TreeViewer)) {
|
||||
return true;
|
||||
}
|
||||
if (searchString == null || searchString.length() == 0) {
|
||||
return true;
|
||||
}
|
||||
TreeViewer treeViewer = (TreeViewer) viewer;
|
||||
Boolean matchingResult = isMatchingOrNull(element);
|
||||
if (matchingResult != null) {
|
||||
return matchingResult;
|
||||
}
|
||||
return hasUnfilteredChild(treeViewer, parentPath, element);
|
||||
}
|
||||
|
||||
Boolean isMatchingOrNull(Object element) {
|
||||
if(element instanceof IWaveform) {
|
||||
if (pattern.matcher(((IWaveform) element).getName()).matches())
|
||||
return Boolean.TRUE;
|
||||
} else if(element instanceof IWaveformDb) {
|
||||
return Boolean.TRUE;
|
||||
} else if(element instanceof HierNode) {
|
||||
HierNode n = (HierNode) element;
|
||||
try {
|
||||
if (pattern.matcher(n.getFullName()).matches())
|
||||
return Boolean.TRUE;
|
||||
} catch (PatternSyntaxException e) {
|
||||
return Boolean.TRUE;
|
||||
}
|
||||
} else {
|
||||
return Boolean.FALSE;
|
||||
}
|
||||
/* maybe children are matching */
|
||||
return null;
|
||||
}
|
||||
|
||||
private boolean hasUnfilteredChild(TreeViewer viewer, TreePath parentPath, Object element) {
|
||||
TreePath elementPath = parentPath.createChildPath(element);
|
||||
IContentProvider contentProvider = viewer.getContentProvider();
|
||||
Object[] children = contentProvider instanceof ITreePathContentProvider
|
||||
? ((ITreePathContentProvider) contentProvider).getChildren(elementPath)
|
||||
: ((ITreeContentProvider) contentProvider).getChildren(element);
|
||||
|
||||
/* avoid NPE + guard close */
|
||||
if (children == null || children.length == 0) {
|
||||
return false;
|
||||
}
|
||||
for (int i = 0; i < children.length; i++) {
|
||||
if (selectTreePath(viewer, elementPath, children[i])) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Gets the filtered children.
|
||||
*
|
||||
|
@ -8,7 +8,6 @@ import java.util.List;
|
||||
import com.minres.scviewer.database.IHierNode;
|
||||
import com.minres.scviewer.database.IWaveform;
|
||||
import com.minres.scviewer.database.IWaveformDb;
|
||||
import com.minres.scviewer.database.IWaveformEvent;
|
||||
import com.minres.scviewer.database.RelationType;
|
||||
import com.minres.scviewer.e4.application.Messages;
|
||||
|
||||
|
@ -21,7 +21,9 @@ import org.eclipse.e4.core.di.annotations.Optional;
|
||||
import org.eclipse.e4.core.services.events.IEventBroker;
|
||||
import org.eclipse.e4.ui.di.Focus;
|
||||
import org.eclipse.e4.ui.di.UIEventTopic;
|
||||
import org.eclipse.e4.ui.model.application.ui.basic.MPart;
|
||||
import org.eclipse.e4.ui.services.IServiceConstants;
|
||||
import org.eclipse.e4.ui.workbench.modeling.EPartService;
|
||||
import org.eclipse.e4.ui.workbench.modeling.ESelectionService;
|
||||
import org.eclipse.jface.viewers.DelegatingStyledCellLabelProvider;
|
||||
import org.eclipse.jface.viewers.DelegatingStyledCellLabelProvider.IStyledLabelProvider;
|
||||
@ -119,8 +121,10 @@ public class TransactionDetails {
|
||||
public void modifyText(ModifyEvent e) {
|
||||
attributeFilter.setSearchText(((Text) e.widget).getText());
|
||||
treeViewer.refresh();
|
||||
treeViewer.expandAll(true);
|
||||
}
|
||||
});
|
||||
|
||||
nameFilter.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
|
||||
|
||||
attributeFilter = new TxAttributeFilter();
|
||||
@ -184,9 +188,9 @@ public class TransactionDetails {
|
||||
}
|
||||
});
|
||||
// Pack the columns
|
||||
// for (int i = 0, n = table.getColumnCount(); i < n; i++) {
|
||||
// table.getColumn(i).pack();
|
||||
// }
|
||||
// for (int i = 0, n = table.getColumnCount(); i < n; i++) {
|
||||
// table.getColumn(i).pack();
|
||||
// }
|
||||
|
||||
// Turn on the header and the lines
|
||||
tree.setHeaderVisible(true);
|
||||
@ -341,7 +345,11 @@ public class TransactionDetails {
|
||||
* @param selection the new selection
|
||||
*/
|
||||
@Inject
|
||||
public void setSelection(@Named(IServiceConstants.ACTIVE_SELECTION) @Optional IStructuredSelection selection){
|
||||
public void setSelection(@Named(IServiceConstants.ACTIVE_SELECTION) @Optional IStructuredSelection selection, EPartService partService){
|
||||
// only react if selection is actually from the WaveformViewer and nothing else
|
||||
MPart part = partService.getActivePart();
|
||||
if( part == null || ! (part.getObject() instanceof WaveformViewer ) )
|
||||
return;
|
||||
if(treeViewer!=null && selection!=null && !treeViewer.getTree().isDisposed()){
|
||||
if( selection instanceof IStructuredSelection) {
|
||||
setInput(((IStructuredSelection)selection).getFirstElement());
|
||||
@ -367,8 +375,8 @@ public class TransactionDetails {
|
||||
*/
|
||||
String txToString(ITx tx){
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("tx#").append(tx.getId()).append("[").append(timeToString(tx.getBeginTime())). //$NON-NLS-1$ //$NON-NLS-2$
|
||||
append(" - ").append(timeToString(tx.getEndTime())).append("]"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
sb.append("tx#").append(tx.getId()).append("[").append(timeToString(tx.getBeginTime())); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
sb.append(" - ").append(timeToString(tx.getEndTime())).append("]"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
@ -461,16 +469,20 @@ public class TransactionDetails {
|
||||
*/
|
||||
@Override
|
||||
public boolean select(Viewer viewer, Object parentElement, Object element) {
|
||||
|
||||
if (searchString == null || searchString.length() == 0) {
|
||||
return true;
|
||||
}
|
||||
if(element instanceof ITxAttribute){
|
||||
ITxAttribute p = (ITxAttribute) element;
|
||||
if (p.getName().matches(searchString)) {
|
||||
if(element instanceof TreeNode) {
|
||||
return true;
|
||||
}
|
||||
} else if(element instanceof TreeNode)
|
||||
return true;
|
||||
if(element instanceof ITxAttribute){
|
||||
return (((ITxAttribute) element).getName().toLowerCase().matches(searchString.toLowerCase()));
|
||||
}
|
||||
if(element instanceof Object[]) {
|
||||
return (((Object[])element)[0]).toString().toLowerCase().matches(searchString.toLowerCase());
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -479,7 +491,7 @@ public class TransactionDetails {
|
||||
* The Enum Type.
|
||||
*/
|
||||
enum Type {/** The props. */
|
||||
PROPS, /** The attrs. */
|
||||
PROPS, /** The attrs. */
|
||||
ATTRS, /** The in rel. */
|
||||
IN_REL, /** The out rel. */
|
||||
OUT_REL}
|
||||
@ -666,13 +678,18 @@ PROPS, /** The attrs. */
|
||||
String value = attribute.getValue().toString();
|
||||
if((DataType.UNSIGNED == attribute.getDataType() || DataType.INTEGER==attribute.getDataType()) && !"0".equals(value)) {
|
||||
try {
|
||||
value = attribute.getValue().toString() + " [0x"+Long.toHexString(Long.parseLong(attribute.getValue().toString()))+"]";
|
||||
value += " [0x"+Long.toHexString(Long.parseLong(attribute.getValue().toString()))+"]";
|
||||
} catch(NumberFormatException e) { }
|
||||
}
|
||||
return new StyledString(value);
|
||||
}else if(element instanceof Object[]){
|
||||
Object[] elements = (Object[]) element;
|
||||
return new StyledString(elements[field].toString());
|
||||
Object o = elements[field];
|
||||
if(o instanceof ITx) {
|
||||
ITx tx = (ITx)o;
|
||||
return new StyledString(txToString(tx)+" ("+tx.getStream().getFullName()+")");
|
||||
} else
|
||||
return new StyledString(o.toString());
|
||||
} else if(element instanceof ITx){
|
||||
return new StyledString(txToString((ITx) element));
|
||||
}else
|
||||
|
@ -31,6 +31,7 @@ import javax.annotation.PostConstruct;
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Named;
|
||||
|
||||
import org.eclipse.core.internal.preferences.InstancePreferences;
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
import org.eclipse.core.runtime.IStatus;
|
||||
import org.eclipse.core.runtime.MultiStatus;
|
||||
@ -41,9 +42,11 @@ import org.eclipse.core.runtime.jobs.IJobChangeEvent;
|
||||
import org.eclipse.core.runtime.jobs.Job;
|
||||
import org.eclipse.core.runtime.jobs.JobChangeAdapter;
|
||||
import org.eclipse.core.runtime.jobs.JobGroup;
|
||||
import org.eclipse.core.runtime.preferences.ConfigurationScope;
|
||||
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
|
||||
import org.eclipse.core.runtime.preferences.IEclipsePreferences.IPreferenceChangeListener;
|
||||
import org.eclipse.core.runtime.preferences.IEclipsePreferences.PreferenceChangeEvent;
|
||||
import org.eclipse.e4.core.contexts.IEclipseContext;
|
||||
import org.eclipse.e4.core.di.annotations.Optional;
|
||||
import org.eclipse.e4.core.di.extensions.Preference;
|
||||
import org.eclipse.e4.core.services.events.IEventBroker;
|
||||
@ -63,23 +66,39 @@ import org.eclipse.jface.viewers.IStructuredSelection;
|
||||
import org.eclipse.jface.viewers.SelectionChangedEvent;
|
||||
import org.eclipse.jface.viewers.StructuredSelection;
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.events.MouseEvent;
|
||||
import org.eclipse.swt.events.MouseTrackListener;
|
||||
import org.eclipse.swt.events.MouseWheelListener;
|
||||
import org.eclipse.swt.events.DisposeEvent;
|
||||
import org.eclipse.swt.events.DisposeListener;
|
||||
import org.eclipse.swt.events.FocusListener;
|
||||
import org.eclipse.swt.events.PaintEvent;
|
||||
import org.eclipse.swt.events.PaintListener;
|
||||
import org.eclipse.swt.graphics.Font;
|
||||
import org.eclipse.swt.graphics.Point;
|
||||
import org.eclipse.swt.graphics.RGB;
|
||||
import org.eclipse.swt.graphics.Rectangle;
|
||||
import org.eclipse.swt.layout.GridData;
|
||||
import org.eclipse.swt.widgets.Composite;
|
||||
import org.eclipse.swt.widgets.Display;
|
||||
import org.eclipse.swt.widgets.Event;
|
||||
import org.eclipse.swt.widgets.Label;
|
||||
import org.eclipse.swt.widgets.Listener;
|
||||
import org.eclipse.swt.widgets.Table;
|
||||
import org.eclipse.swt.widgets.TableColumn;
|
||||
import org.eclipse.swt.widgets.TableItem;
|
||||
import org.eclipse.swt.widgets.Widget;
|
||||
import org.osgi.service.prefs.BackingStoreException;
|
||||
|
||||
import com.minres.scviewer.database.DataType;
|
||||
import com.minres.scviewer.database.ITx;
|
||||
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.IWaveformDb;
|
||||
import com.minres.scviewer.database.IWaveformDbFactory;
|
||||
import com.minres.scviewer.database.RelationType;
|
||||
import com.minres.scviewer.database.swt.Constants;
|
||||
import com.minres.scviewer.database.swt.ToolTipContentProvider;
|
||||
import com.minres.scviewer.database.swt.ToolTipHelpTextProvider;
|
||||
import com.minres.scviewer.database.swt.WaveformViewerFactory;
|
||||
import com.minres.scviewer.database.ui.GotoDirection;
|
||||
import com.minres.scviewer.database.ui.ICursor;
|
||||
@ -100,7 +119,7 @@ import com.minres.scviewer.e4.application.preferences.PreferenceConstants;
|
||||
* The Class WaveformViewerPart.
|
||||
*/
|
||||
@SuppressWarnings("restriction")
|
||||
public class WaveformViewer implements IFileChangeListener, IPreferenceChangeListener {
|
||||
public class WaveformViewer implements IFileChangeListener, IPreferenceChangeListener, DisposeListener {
|
||||
|
||||
/** The Constant ACTIVE_WAVEFORMVIEW. */
|
||||
public static final String ACTIVE_WAVEFORMVIEW = "Active_Waveform_View"; //$NON-NLS-1$
|
||||
@ -127,6 +146,15 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
|
||||
/** The Constant BASE_LINE_TIME. */
|
||||
protected static final String BASE_LINE_TIME = "BASE_LINE_TIME"; //$NON-NLS-1$
|
||||
|
||||
/** The Constant SELECTED_TX_ID. */
|
||||
protected static final String SELECTED_TX_ID = "SELECTED_TX_ID"; //$NON-NLS-1$
|
||||
|
||||
/** The Constant SELECTED_TRACKENTRY_NAME. */
|
||||
protected static final String SELECTED_TRACKENTRY_NAME = "SELECTED_TRACKENTRY_NAME"; //$NON-NLS-1$
|
||||
|
||||
/** The Constant WAVEFORM_SELECTED. */
|
||||
protected static final String WAVEFORM_SELECTED = ".WAVEFORM_SELECTED"; //$NON-NLS-1$
|
||||
|
||||
/** The Constant FILE_CHECK_INTERVAL. */
|
||||
protected static final long FILE_CHECK_INTERVAL = 60000;
|
||||
|
||||
@ -139,6 +167,9 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
|
||||
/** The Constant WAVE_ACTION_ID. */
|
||||
public static final String WAVE_ACTION_ID = "com.minres.scviewer.ui.action.AddToWave"; //$NON-NLS-1$
|
||||
|
||||
/** The number of active DisposeListeners */
|
||||
private static int disposeListenerNumber = 0;
|
||||
|
||||
/** The factory. */
|
||||
WaveformViewerFactory factory = new WaveformViewerFactory();
|
||||
|
||||
@ -166,8 +197,10 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
|
||||
|
||||
/** The prefs. */
|
||||
@Inject
|
||||
@Preference(nodePath = PreferenceConstants.PREFERENCES_SCOPE)
|
||||
IEclipsePreferences prefs;
|
||||
@Preference(value = ConfigurationScope.SCOPE, nodePath = PreferenceConstants.PREFERENCES_SCOPE)
|
||||
protected IEclipsePreferences prefs;
|
||||
|
||||
@Inject @Optional DesignBrowser designBrowser;
|
||||
|
||||
/** The database. */
|
||||
private IWaveformDb database;
|
||||
@ -211,6 +244,8 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
|
||||
*/
|
||||
@PostConstruct
|
||||
public void createComposite(MPart part, Composite parent, IWaveformDbFactory dbFactory) {
|
||||
disposeListenerNumber += 1;
|
||||
|
||||
myPart = part;
|
||||
myParent = parent;
|
||||
database = dbFactory.getDatabase();
|
||||
@ -229,6 +264,10 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
|
||||
});
|
||||
waveformPane = factory.createPanel(parent);
|
||||
waveformPane.setMaxTime(0);
|
||||
|
||||
//set selection to empty selection when opening a new waveformPane
|
||||
selectionService.setSelection(new StructuredSelection());
|
||||
|
||||
waveformPane.addPropertyChangeListener(IWaveformViewer.CURSOR_PROPERTY, new PropertyChangeListener() {
|
||||
@Override
|
||||
public void propertyChange(PropertyChangeEvent evt) {
|
||||
@ -248,58 +287,19 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
|
||||
eventBroker.post(WaveStatusBarControl.MARKER_DIFF, waveformPane.getScaledTime(cursor - time));
|
||||
}
|
||||
});
|
||||
|
||||
waveformPane.addSelectionChangedListener(new ISelectionChangedListener() {
|
||||
@Override
|
||||
public void selectionChanged(SelectionChangedEvent event) {
|
||||
if (event.getSelection() instanceof IStructuredSelection)
|
||||
if (event.getSelection() instanceof IStructuredSelection) {
|
||||
selectionService.setSelection(event.getSelection());
|
||||
}
|
||||
});
|
||||
waveformPane.getWaveformControl().addMouseTrackListener(new MouseTrackListener() {
|
||||
|
||||
@Override
|
||||
public void mouseHover(MouseEvent e) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseExit(MouseEvent e) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseEnter(MouseEvent e) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
waveformPane.getWaveformControl().addMouseWheelListener(new MouseWheelListener() {
|
||||
|
||||
@Override
|
||||
public void mouseScrolled(MouseEvent e) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
waveformPane.getWaveformControl().addListener(SWT.KeyDown, new Listener() {
|
||||
|
||||
@SuppressWarnings("null")
|
||||
@Override
|
||||
public void handleEvent(Event e) {
|
||||
/*
|
||||
String string = e.type == SWT.KeyDown ? "DOWN:" : "UP :";
|
||||
string += " stateMask=0x" + Integer.toHexString (e.stateMask) + ","; // SWT.CTRL, SWT.ALT, SWT.SHIFT, SWT.COMMAND
|
||||
string += " keyCode=0x" + Integer.toHexString (e.keyCode) + ",";
|
||||
string += " character=0x" + Integer.toHexString (e.character) ;
|
||||
if (e.keyLocation != 0) {
|
||||
string += " location="+e.keyLocation;
|
||||
}
|
||||
System.out.println (string);
|
||||
*/
|
||||
if((e.stateMask&SWT.MOD3)!=0) { // Alt key
|
||||
} else if((e.stateMask&SWT.MOD1)!=0) { //Ctrl/Cmd
|
||||
int zoomlevel = waveformPane.getZoomLevel();
|
||||
@ -383,6 +383,102 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
|
||||
}
|
||||
});
|
||||
prefs.addPreferenceChangeListener(this);
|
||||
|
||||
waveformPane.addDisposeListener(this);
|
||||
|
||||
waveformPane.getWaveformControl().setData(Constants.HELP_PROVIDER_TAG, new ToolTipHelpTextProvider() {
|
||||
@Override
|
||||
public String getHelpText(Widget widget) {
|
||||
return "Waveform pane: press F2 to set the focus to the tooltip";
|
||||
}
|
||||
});
|
||||
waveformPane.getWaveformControl().setData(Constants.CONTENT_PROVIDER_TAG, new ToolTipContentProvider() {
|
||||
@Override
|
||||
public boolean createContent(Composite parent, Point pt) {
|
||||
if(!prefs.getBoolean(PreferenceConstants.SHOW_HOVER, true)) return false;
|
||||
List<Object> res = waveformPane.getElementsAt(pt);
|
||||
if(res.size()>0)
|
||||
if(res.get(0) instanceof ITx) {
|
||||
ITx tx = (ITx)res.get(0);
|
||||
final Display display = parent.getDisplay();
|
||||
final Font font = new Font(Display.getCurrent(), "Terminal", 10, SWT.NORMAL);
|
||||
|
||||
final Label label = new Label(parent, SWT.NONE);
|
||||
// label.setForeground(display.getSystemColor(SWT.COLOR_INFO_FOREGROUND));
|
||||
// label.setBackground(display.getSystemColor(SWT.COLOR_INFO_BACKGROUND));
|
||||
label.setText(tx.toString());
|
||||
label.setFont(font);
|
||||
GridData labelGridData = new GridData();
|
||||
labelGridData.horizontalAlignment = GridData.FILL;
|
||||
labelGridData.grabExcessHorizontalSpace = true;
|
||||
label.setLayoutData(labelGridData);
|
||||
|
||||
final Table table = new Table(parent, SWT.NONE);
|
||||
table.setHeaderVisible(true);
|
||||
table.setLinesVisible(true);
|
||||
table.setFont(font);
|
||||
// table.setForeground(display.getSystemColor(SWT.COLOR_INFO_FOREGROUND));
|
||||
// table.setBackground(display.getSystemColor(SWT.COLOR_INFO_BACKGROUND));
|
||||
table.setRedraw(false);
|
||||
GridData tableGridData = new GridData();
|
||||
tableGridData.horizontalAlignment = GridData.FILL;
|
||||
tableGridData.grabExcessHorizontalSpace = true;
|
||||
table.setLayoutData(tableGridData);
|
||||
|
||||
final TableColumn nameCol = new TableColumn(table, SWT.LEFT);
|
||||
nameCol.setText("Attribute");
|
||||
final TableColumn valueCol = new TableColumn(table, SWT.LEFT);
|
||||
valueCol.setText("Value");
|
||||
|
||||
for (ITxAttribute iTxAttribute : tx.getAttributes()) {
|
||||
String value = iTxAttribute.getValue().toString();
|
||||
if((DataType.UNSIGNED == iTxAttribute.getDataType() || DataType.INTEGER==iTxAttribute.getDataType()) && !"0".equals(value)) {
|
||||
try {
|
||||
value += " [0x"+Long.toHexString(Long.parseLong(iTxAttribute.getValue().toString()))+"]";
|
||||
} catch(NumberFormatException e) { }
|
||||
}
|
||||
TableItem item = new TableItem(table, SWT.NONE);
|
||||
item.setText(0, iTxAttribute.getName());
|
||||
item.setText(1, value);
|
||||
}
|
||||
TableItem item = new TableItem(table, SWT.NONE);
|
||||
item.setText(0, "");
|
||||
item.setText(1, "");
|
||||
nameCol.pack();
|
||||
valueCol.pack();
|
||||
table.pack();
|
||||
table.setRedraw(true);
|
||||
|
||||
parent.addPaintListener(new PaintListener() {
|
||||
@Override
|
||||
public void paintControl(PaintEvent e) {
|
||||
Rectangle area = parent.getClientArea();
|
||||
valueCol.setWidth(area.width - nameCol.getWidth());
|
||||
}
|
||||
});
|
||||
parent.addFocusListener(FocusListener.focusGainedAdapter(e -> {
|
||||
table.setFocus();
|
||||
}));
|
||||
return true;
|
||||
} else if(res.get(0) instanceof TrackEntry) {
|
||||
TrackEntry te = (TrackEntry)res.get(0);
|
||||
final Display display = parent.getDisplay();
|
||||
final Font font = new Font(Display.getCurrent(), "Terminal", 10, SWT.NORMAL);
|
||||
|
||||
final Label label = new Label(parent, SWT.NONE);
|
||||
//label.setForeground(display.getSystemColor(SWT.COLOR_INFO_FOREGROUND));
|
||||
//label.setBackground(display.getSystemColor(SWT.COLOR_INFO_BACKGROUND));
|
||||
label.setText(te.waveform.getFullName());
|
||||
label.setFont(font);
|
||||
GridData labelGridData = new GridData();
|
||||
labelGridData.horizontalAlignment = GridData.FILL;
|
||||
labelGridData.grabExcessHorizontalSpace = true;
|
||||
label.setLayoutData(labelGridData);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
@ -390,17 +486,21 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
|
||||
*/
|
||||
@Override
|
||||
public void preferenceChange(PreferenceChangeEvent event) {
|
||||
InstancePreferences pref = (InstancePreferences)event.getSource();
|
||||
if (PreferenceConstants.DATABASE_RELOAD.equals(event.getKey())) {
|
||||
checkForUpdates = (Boolean) event.getNewValue();
|
||||
checkForUpdates = pref.getBoolean(PreferenceConstants.DATABASE_RELOAD, true);
|
||||
fileChecker = null;
|
||||
if (checkForUpdates)
|
||||
fileChecker = fileMonitor.addFileChangeListener(WaveformViewer.this, filesToLoad,
|
||||
FILE_CHECK_INTERVAL);
|
||||
else
|
||||
fileMonitor.removeFileChangeListener(this);
|
||||
} else {
|
||||
} else if (!PreferenceConstants.SHOW_HOVER.equals(event.getKey())){
|
||||
setupColors();
|
||||
}
|
||||
try {
|
||||
pref.flush();
|
||||
} catch (BackingStoreException e) { }
|
||||
}
|
||||
|
||||
/**
|
||||
@ -468,7 +568,17 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
|
||||
job.addJobChangeListener(new JobChangeAdapter() {
|
||||
@Override
|
||||
public void done(IJobChangeEvent event) {
|
||||
if (event.getResult().getCode() != Status.OK_STATUS.getCode()) return;
|
||||
IStatus result = event.getResult();
|
||||
if( (!result.isMultiStatus() && result.getCode() != Status.OK_STATUS.getCode() ) ||
|
||||
(result.isMultiStatus() && result.getChildren().length > 0 && result.getChildren()[0].getCode() != Status.OK_STATUS.getCode() ) ){
|
||||
// kill editor and pop up warning for user
|
||||
sync.asyncExec(() -> {
|
||||
final Display display = myParent.getDisplay();
|
||||
MessageDialog.openWarning(display.getActiveShell(), "Error loading database", "Database cannot be loaded. Aborting...");
|
||||
ePartService.hidePart(myPart, true);
|
||||
});
|
||||
return;
|
||||
}
|
||||
sync.asyncExec(()->{
|
||||
waveformPane.setMaxTime(database.getMaxTime());
|
||||
if (state != null)
|
||||
@ -514,14 +624,19 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
|
||||
@Inject
|
||||
@Optional
|
||||
public void setPartInput(@Named("input") Object partInput, @Named("config") Object partConfig) {
|
||||
if (partInput instanceof File) {
|
||||
if (partInput instanceof String) {
|
||||
String name = (String)partInput;
|
||||
filesToLoad = new ArrayList<File>();
|
||||
File file = (File) partInput;
|
||||
boolean explicit = name.contains(",");
|
||||
for(String tok: name.split(",")) {
|
||||
File file = new File(tok);
|
||||
if(file.isFile() && "CURRENT".equals(file.getName())){
|
||||
file=file.getParentFile();
|
||||
}
|
||||
if (file.exists()) {
|
||||
filesToLoad.add(file);
|
||||
}
|
||||
if(!explicit)
|
||||
try {
|
||||
String ext = getFileExtension(file.getName());
|
||||
if (Messages.WaveformViewer_19.equals(ext.toLowerCase())) {
|
||||
@ -542,6 +657,7 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
|
||||
}
|
||||
} catch (IOException e) { // silently ignore any error
|
||||
}
|
||||
|
||||
}
|
||||
if (filesToLoad.size() > 0)
|
||||
loadDatabase(persistedState);
|
||||
@ -588,7 +704,9 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
|
||||
saveWaveformViewerState(persistedState);
|
||||
Properties props = new Properties();
|
||||
props.putAll(persistedState);
|
||||
|
||||
try {
|
||||
|
||||
FileOutputStream out = new FileOutputStream(fileName);
|
||||
props.store(out, "Written by SCViewer"); //$NON-NLS-1$
|
||||
out.close();
|
||||
@ -600,6 +718,13 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
|
||||
public void loadState(String fileName){
|
||||
Properties props = new Properties();
|
||||
try {
|
||||
//clear old streams before loading tab settings
|
||||
if(!waveformPane.getStreamList().isEmpty()) {
|
||||
waveformPane.getStreamList().clear();
|
||||
for (TrackEntry trackEntry : waveformPane.getStreamList()) {
|
||||
trackEntry.selected = false;
|
||||
}
|
||||
}
|
||||
FileInputStream in = new FileInputStream(fileName);
|
||||
props.load(in);
|
||||
in.close();
|
||||
@ -618,13 +743,13 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
|
||||
* @param persistedState the persisted state
|
||||
*/
|
||||
protected void saveWaveformViewerState(Map<String, String> persistedState) {
|
||||
Integer index;
|
||||
persistedState.put(SHOWN_WAVEFORM + "S", Integer.toString(waveformPane.getStreamList().size())); //$NON-NLS-1$
|
||||
index = 0;
|
||||
Integer index = 0;
|
||||
for (TrackEntry trackEntry : waveformPane.getStreamList()) {
|
||||
persistedState.put(SHOWN_WAVEFORM + index, trackEntry.waveform.getFullName());
|
||||
persistedState.put(SHOWN_WAVEFORM + index + VALUE_DISPLAY, trackEntry.valueDisplay.toString());
|
||||
persistedState.put(SHOWN_WAVEFORM + index + WAVE_DISPLAY, trackEntry.waveDisplay.toString());
|
||||
persistedState.put(SHOWN_WAVEFORM + index + WAVEFORM_SELECTED, String.valueOf(trackEntry.selected).toUpperCase());
|
||||
index++;
|
||||
}
|
||||
List<ICursor> cursors = waveformPane.getCursorList();
|
||||
@ -636,6 +761,37 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
|
||||
}
|
||||
persistedState.put(ZOOM_LEVEL, Integer.toString(waveformPane.getZoomLevel()));
|
||||
persistedState.put(BASE_LINE_TIME, Long.toString(waveformPane.getBaselineTime()));
|
||||
|
||||
// get selected transaction of a stream
|
||||
ISelection selection = waveformPane.getSelection();
|
||||
if (!selection.isEmpty()) {
|
||||
List<Object> t = getISelection(selection);
|
||||
if(t.get(0) instanceof ITx) {
|
||||
ITx tx = (ITx) t.get(0);
|
||||
TrackEntry te = (TrackEntry) t.get(1);
|
||||
// get transaction id
|
||||
persistedState.put(SELECTED_TX_ID, Long.toString(tx.getId()));
|
||||
//get TrackEntry name
|
||||
String name = te.getStream().getFullName();
|
||||
persistedState.put(SELECTED_TRACKENTRY_NAME, name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected List<Object> getISelection(ISelection selection){
|
||||
List<Object> result = new LinkedList<Object> ();
|
||||
|
||||
if ( selection instanceof IStructuredSelection ) {
|
||||
Iterator<?> i = ((IStructuredSelection)selection).iterator();
|
||||
while (i.hasNext()){
|
||||
Object o = i.next ();
|
||||
if (o == null) {
|
||||
continue;
|
||||
}
|
||||
result.add(o);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -650,6 +806,13 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
|
||||
IWaveform waveform = database.getStreamByName(state.get(SHOWN_WAVEFORM + i));
|
||||
if (waveform != null) {
|
||||
TrackEntry t = new TrackEntry(waveform);
|
||||
//check if t is selected
|
||||
boolean isSelected = Boolean.valueOf(state.get(SHOWN_WAVEFORM + i + WAVEFORM_SELECTED));
|
||||
if(isSelected) {
|
||||
t.selected = true;
|
||||
} else {
|
||||
t.selected = false;
|
||||
}
|
||||
res.add(t);
|
||||
String v = state.get(SHOWN_WAVEFORM + i + VALUE_DISPLAY);
|
||||
if(v!=null)
|
||||
@ -683,6 +846,38 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
|
||||
} catch (NumberFormatException e) {
|
||||
}
|
||||
}
|
||||
if (state.containsKey(SELECTED_TX_ID) && state.containsKey(SELECTED_TRACKENTRY_NAME)) {
|
||||
try {
|
||||
Long txId = Long.parseLong(state.get(SELECTED_TX_ID));
|
||||
String trackentryName = state.get(SELECTED_TRACKENTRY_NAME);
|
||||
|
||||
//get TrackEntry Object based on name and TX Object by id and put into selectionList
|
||||
for(TrackEntry te : res) {
|
||||
if(te.waveform.getFullName().compareTo(trackentryName)==0) {
|
||||
boolean found = false;
|
||||
// TODO: find transaction by time? To avoid 3x for-loop
|
||||
for( List<ITxEvent> lev : te.getStream().getEvents().values() ) {
|
||||
if(lev == null) continue;
|
||||
for(ITxEvent itxe : lev) {
|
||||
if(itxe == null) continue;
|
||||
ITx itx = itxe.getTransaction();
|
||||
if(itx.getId() == txId) {
|
||||
found = true;
|
||||
ArrayList<Object> selectionList = new ArrayList<Object>();
|
||||
selectionList.add(te);
|
||||
selectionList.add(itx);
|
||||
waveformPane.setSelection(new StructuredSelection (selectionList));
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(found) break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
} catch (NumberFormatException e) {
|
||||
}
|
||||
}
|
||||
updateAll();
|
||||
}
|
||||
|
||||
@ -808,10 +1003,13 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
|
||||
Object first = selection.getFirstElement();
|
||||
IWaveform stream = (first instanceof ITx) ? ((ITx) first).getStream() : (IWaveform) first;
|
||||
TrackEntry trackEntry = waveformPane.getEntryForStream(stream);
|
||||
if (insert) {
|
||||
int index = waveformPane.getStreamList().indexOf(trackEntry);
|
||||
if (!insert)
|
||||
index++;
|
||||
waveformPane.getStreamList().addAll(index, streams);
|
||||
} else {
|
||||
waveformPane.getStreamList().addAll(streams);
|
||||
}
|
||||
|
||||
}
|
||||
setFocus();
|
||||
}
|
||||
@ -826,15 +1024,27 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
|
||||
List<TrackEntry> streams = waveformPane.getStreamList();
|
||||
ISelection sel = waveformPane.getSelection();
|
||||
TrackEntry newSelection=null;
|
||||
|
||||
if(sel instanceof IStructuredSelection && ((IStructuredSelection) sel).size()==2) {
|
||||
Iterator<?> it = ((IStructuredSelection)sel).iterator();
|
||||
it.next();
|
||||
int idx = streams.indexOf(it.next());
|
||||
if(idx==streams.size()-1)
|
||||
|
||||
if(idx==streams.size()-1) {
|
||||
//last stream gets deleted, no more selection
|
||||
if(idx==0) {
|
||||
newSelection=null;
|
||||
}
|
||||
//more than 1 stream left, last gets deleted, selection jumps to new last stream
|
||||
else {
|
||||
newSelection=streams.get(idx-1);
|
||||
else
|
||||
}
|
||||
}
|
||||
//more than 1 stream left, any stream but the last gets deleted, selection jumps to the next stream
|
||||
else {
|
||||
newSelection=streams.get(idx+1);
|
||||
}
|
||||
}
|
||||
waveformPane.setSelection(new StructuredSelection());
|
||||
streams.remove(trackEntry);
|
||||
if(newSelection!=null) {
|
||||
@ -910,7 +1120,6 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
|
||||
* Sets the zoom fit.
|
||||
*/
|
||||
public void setZoomFit() {
|
||||
|
||||
//actual max time of signal
|
||||
long maxTime = waveformPane.getMaxTime();
|
||||
|
||||
@ -1078,4 +1287,28 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
|
||||
waveformPane.update();
|
||||
}
|
||||
|
||||
/**
|
||||
* add dispose listener
|
||||
*
|
||||
* @param listener
|
||||
*/
|
||||
public void addDisposeListener (DisposeListener listener) {
|
||||
waveformPane.getControl().addDisposeListener(listener);
|
||||
}
|
||||
|
||||
/**
|
||||
* triggers included actions if widget is disposed
|
||||
*
|
||||
* @param e
|
||||
*/
|
||||
public void widgetDisposed(DisposeEvent e) {
|
||||
disposeListenerNumber -= 1;
|
||||
if( disposeListenerNumber == 0) { //if the last tab is closed, reset statusbar
|
||||
eventBroker.post(WaveStatusBarControl.ZOOM_LEVEL, null);
|
||||
eventBroker.post(WaveStatusBarControl.CURSOR_TIME, null);
|
||||
eventBroker.post(WaveStatusBarControl.MARKER_TIME, null);
|
||||
eventBroker.post(WaveStatusBarControl.MARKER_DIFF, null);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -11,15 +11,14 @@
|
||||
package com.minres.scviewer.e4.application.preferences;
|
||||
|
||||
import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;
|
||||
import org.eclipse.core.runtime.preferences.InstanceScope;
|
||||
import org.eclipse.jface.preference.IPreferenceStore;
|
||||
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.wb.swt.SWTResourceManager;
|
||||
|
||||
import com.minres.scviewer.database.ui.WaveformColors;
|
||||
import com.opcoach.e4.preferences.ScopedPreferenceStore;
|
||||
|
||||
/**
|
||||
* The Class DefaultValuesInitializer.
|
||||
@ -64,12 +63,22 @@ public class DefaultValuesInitializer extends AbstractPreferenceInitializer {
|
||||
*/
|
||||
@Override
|
||||
public void initializeDefaultPreferences() {
|
||||
IPreferenceStore store = new ScopedPreferenceStore(InstanceScope.INSTANCE, PreferenceConstants.PREFERENCES_SCOPE);
|
||||
|
||||
store.setDefault(PreferenceConstants.DATABASE_RELOAD, true);
|
||||
IEclipsePreferences node = DefaultScope.INSTANCE.getNode(PreferenceConstants.PREFERENCES_SCOPE);
|
||||
if (node != null)
|
||||
{
|
||||
node.putBoolean(PreferenceConstants.DATABASE_RELOAD, true);
|
||||
node.putBoolean(PreferenceConstants.SHOW_HOVER, true);
|
||||
for (WaveformColors c : WaveformColors.values()) {
|
||||
store.setDefault(c.name()+"_COLOR", StringConverter.asString(colors[c.ordinal()].getRGB())); //$NON-NLS-1$
|
||||
node.put(c.name()+"_COLOR", StringConverter.asString(colors[c.ordinal()].getRGB())); //$NON-NLS-1$
|
||||
}
|
||||
}
|
||||
// IPreferenceStore store = new ScopedPreferenceStore(InstanceScope.INSTANCE, PreferenceConstants.PREFERENCES_SCOPE);
|
||||
//
|
||||
// store.setDefault(PreferenceConstants.DATABASE_RELOAD, true);
|
||||
// store.setDefault(PreferenceConstants.SHOW_HOVER, true);
|
||||
// for (WaveformColors c : WaveformColors.values()) {
|
||||
// store.setDefault(c.name()+"_COLOR", StringConverter.asString(colors[c.ordinal()].getRGB())); //$NON-NLS-1$
|
||||
// }
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -21,6 +21,9 @@ public class PreferenceConstants {
|
||||
/** The Constant DATABASE_RELOAD. */
|
||||
public static final String DATABASE_RELOAD="databaseReload"; //$NON-NLS-1$
|
||||
|
||||
/** The Constant DATABASE_RELOAD. */
|
||||
public static final String SHOW_HOVER="showWaveformHover"; //$NON-NLS-1$
|
||||
|
||||
/** The Constant LINE_COLOR. */
|
||||
public static final String LINE_COLOR="LINE_COLOR"; //$NON-NLS-1$
|
||||
|
||||
|
@ -0,0 +1,18 @@
|
||||
package com.minres.scviewer.e4.application.preferences;
|
||||
import org.eclipse.core.runtime.preferences.ConfigurationScope;
|
||||
import org.eclipse.jface.preference.IPreferenceStore;
|
||||
|
||||
import com.opcoach.e4.preferences.IPreferenceStoreProvider;
|
||||
import com.opcoach.e4.preferences.ScopedPreferenceStore;
|
||||
|
||||
public class PreferencesStoreProvider implements IPreferenceStoreProvider{
|
||||
|
||||
public PreferencesStoreProvider(){
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPreferenceStore getPreferenceStore() {
|
||||
return new ScopedPreferenceStore(ConfigurationScope.INSTANCE, PreferenceConstants.PREFERENCES_SCOPE);
|
||||
}
|
||||
|
||||
}
|
@ -36,6 +36,8 @@ public class SCViewerPreferencesPage extends FieldEditorPreferencePage {
|
||||
|
||||
addField(new BooleanFieldEditor(PreferenceConstants.DATABASE_RELOAD, Messages.SCViewerPreferencesPage_0,
|
||||
getFieldEditorParent()));
|
||||
addField(new BooleanFieldEditor(PreferenceConstants.SHOW_HOVER, Messages.SCViewerPreferencesPage_1,
|
||||
getFieldEditorParent()));
|
||||
|
||||
}
|
||||
|
||||
|
@ -10,7 +10,7 @@
|
||||
<relativePath>../com.minres.scviewer.parent</relativePath>
|
||||
</parent>
|
||||
<artifactId>com.minres.scviewer.e4.product</artifactId>
|
||||
<version>2.0.5-SNAPSHOT</version>
|
||||
<version>2.4.1-SNAPSHOT</version>
|
||||
<packaging>eclipse-repository</packaging>
|
||||
<groupId>com.minres.scviewer</groupId>
|
||||
<build>
|
||||
|
@ -1,13 +1,14 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<?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.0.5.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.4.1.qualifier" useFeatures="false" includeLaunchers="true">
|
||||
|
||||
|
||||
<configIni use="default">
|
||||
</configIni>
|
||||
|
||||
<launcherArgs>
|
||||
<programArgs>-clearPersistedState -data @none
|
||||
<programArgs>-clearPersistedState
|
||||
</programArgs>
|
||||
<vmArgs>-Xmx2G
|
||||
</vmArgs>
|
||||
@ -33,6 +34,7 @@
|
||||
</win>
|
||||
</launcher>
|
||||
|
||||
|
||||
<vm>
|
||||
<linux include="false">org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8</linux>
|
||||
<macos include="false">org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8</macos>
|
||||
@ -47,7 +49,6 @@
|
||||
<plugin id="com.google.guava"/>
|
||||
<plugin id="com.ibm.icu"/>
|
||||
<plugin id="com.minres.scviewer.database"/>
|
||||
<plugin id="com.minres.scviewer.database.leveldb"/>
|
||||
<plugin id="com.minres.scviewer.database.sqlite"/>
|
||||
<plugin id="com.minres.scviewer.database.text"/>
|
||||
<plugin id="com.minres.scviewer.database.ui"/>
|
||||
|
@ -1,2 +0,0 @@
|
||||
eclipse.preferences.version=1
|
||||
encoding/<project>=UTF-8
|
@ -1,4 +1,5 @@
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.minres.scviewer</groupId>
|
||||
@ -11,7 +12,7 @@
|
||||
<module>../com.minres.scviewer.database.sqlite</module>
|
||||
<module>../com.minres.scviewer.database.text</module>
|
||||
<module>../com.minres.scviewer.database.vcd</module>
|
||||
<module>../com.minres.scviewer.database.leveldb</module>
|
||||
<!-- <module>../com.minres.scviewer.database.leveldb</module> -->
|
||||
<module>../com.minres.scviewer.database.test</module>
|
||||
<module>../com.minres.scviewer.database.ui</module>
|
||||
<module>../com.minres.scviewer.database.ui.swt</module>
|
||||
@ -24,25 +25,10 @@
|
||||
</modules>
|
||||
|
||||
<properties>
|
||||
<tycho-version>0.23.1</tycho-version>
|
||||
<tycho-extras-version>${tycho-version}</tycho-extras-version>
|
||||
<groovy-eclipse-compiler-version>2.8.0-01</groovy-eclipse-compiler-version>
|
||||
<!-- <groovy-eclipse-batch-version>2.0.5</groovy-eclipse-batch-version> -->
|
||||
<groovy-eclipse-batch-version>2.1.8-01</groovy-eclipse-batch-version>
|
||||
|
||||
<tycho-version>1.5.0</tycho-version>
|
||||
<groovy-eclipse-compiler-version>3.5.0</groovy-eclipse-compiler-version>
|
||||
<groovy-eclipse-batch-version>2.5.8-03</groovy-eclipse-batch-version>
|
||||
</properties>
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>mars</id>
|
||||
<layout>p2</layout>
|
||||
<url>http://download.eclipse.org/releases/photon</url>
|
||||
</repository>
|
||||
<repository>
|
||||
<id>GRECLIPSE</id>
|
||||
<layout>p2</layout>
|
||||
<url>http://dist.springsource.org/snapshot/GRECLIPSE/e4.8</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
@ -53,11 +39,54 @@
|
||||
<extensions>true</extensions>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.eclipse.tycho</groupId>
|
||||
<artifactId>tycho-source-plugin</artifactId>
|
||||
<version>${tycho-version}</version>
|
||||
|
||||
<executions>
|
||||
<execution>
|
||||
<id>plugin-source</id>
|
||||
<goals>
|
||||
<goal>plugin-source</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.eclipse.tycho</groupId>
|
||||
<artifactId>tycho-p2-plugin</artifactId>
|
||||
<version>${tycho-version}</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>attach-p2-metadata</id>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>p2-metadata</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.eclipse.tycho</groupId>
|
||||
<artifactId>tycho-versions-plugin</artifactId>
|
||||
<version>${tycho-version}</version>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.eclipse.tycho</groupId>
|
||||
<artifactId>target-platform-configuration</artifactId>
|
||||
<version>${tycho-version}</version>
|
||||
<configuration>
|
||||
<target>
|
||||
<artifact>
|
||||
<groupId>com.minres.scviewer</groupId>
|
||||
<artifactId>com.minres.scviewer.target</artifactId>
|
||||
<version>2.0.0-SNAPSHOT</version>
|
||||
</artifact>
|
||||
</target>
|
||||
<environments>
|
||||
<environment>
|
||||
<os>linux</os>
|
||||
@ -91,7 +120,7 @@
|
||||
<plugin>
|
||||
<groupId>org.eclipse.tycho.extras</groupId>
|
||||
<artifactId>tycho-source-feature-plugin</artifactId>
|
||||
<version>${tycho-extras-version}</version>
|
||||
<version>${tycho-version}</version>
|
||||
|
||||
<executions>
|
||||
<execution>
|
||||
@ -111,41 +140,6 @@
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.eclipse.tycho</groupId>
|
||||
<artifactId>tycho-source-plugin</artifactId>
|
||||
<version>${tycho-version}</version>
|
||||
|
||||
<executions>
|
||||
<execution>
|
||||
<id>plugin-source</id>
|
||||
<goals>
|
||||
<goal>plugin-source</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.eclipse.tycho</groupId>
|
||||
<artifactId>tycho-p2-plugin</artifactId>
|
||||
<version>${tycho-version}</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>attached-p2-metadata</id>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>p2-metadata</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>org.eclipse.tycho</groupId>
|
||||
<artifactId>tycho-versions-plugin</artifactId>
|
||||
<version>${tycho-version}</version>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
@ -1,4 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?><?pde version="3.8"?><target name="Photon Platform" sequenceNumber="138">
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<?pde version="3.8"?>
|
||||
<target name="com.minres.scviewer.target" sequenceNumber="138">
|
||||
<locations>
|
||||
<location includeAllPlatforms="false" includeConfigurePhase="true" includeMode="planner" includeSource="true" type="InstallableUnit">
|
||||
<unit id="org.eclipse.equinox.executable.feature.group" version="0.0.0"/>
|
||||
@ -11,8 +13,9 @@
|
||||
<repository location="http://download.eclipse.org/releases/photon"/>
|
||||
</location>
|
||||
<location includeAllPlatforms="false" includeConfigurePhase="true" includeMode="planner" includeSource="true" type="InstallableUnit">
|
||||
<unit id="org.codehaus.groovy24.feature.feature.group" version="0.0.0"/>
|
||||
<unit id="org.codehaus.groovy24.feature.feature.group" version="3.5.1.v201909291550-e48"/>
|
||||
<repository location="http://dist.springsource.org/snapshot/GRECLIPSE/e4.8/"/>
|
||||
<unit id="org.codehaus.groovy25.feature.feature.group" version="3.5.1.v201909291550-e48"/>
|
||||
</location>
|
||||
</locations>
|
||||
<environment>
|
@ -1,22 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?><?pde version="3.8"?><target name="Neon Platform" sequenceNumber="138">
|
||||
<locations>
|
||||
<location includeAllPlatforms="false" includeConfigurePhase="true" includeMode="planner" includeSource="true" type="InstallableUnit">
|
||||
<unit id="org.eclipse.equinox.executable.feature.group" version="3.6.300.v20161122-1740"/>
|
||||
<unit id="org.eclipse.platform.sdk" version="4.6.2.M20161124-1400"/>
|
||||
<unit id="org.eclipse.rcp.sdk.id" version="4.6.2.M20161124-1400"/>
|
||||
<unit id="org.eclipse.rcptt.core.feature.group" version="2.1.0.201604261352"/>
|
||||
<repository location="http://download.eclipse.org/releases/neon"/>
|
||||
</location>
|
||||
<location includeAllPlatforms="false" includeConfigurePhase="true" includeMode="planner" includeSource="true" type="InstallableUnit">
|
||||
<unit id="org.codehaus.groovy24.feature.feature.group" version="2.9.3.xx-201806261157-e46"/>
|
||||
<repository location="http://dist.springsource.org/snapshot/GRECLIPSE/e4.6"/>
|
||||
</location>
|
||||
</locations>
|
||||
<environment>
|
||||
<arch>x86_64</arch>
|
||||
<nl>de_DE</nl>
|
||||
</environment>
|
||||
<launcherArgs>
|
||||
<vmArgs>-Dosgi.requiredJavaVersion=1.7 -XX:MaxPermSize=256 -Xms40m -Xmx2G </vmArgs>
|
||||
</launcherArgs>
|
||||
</target>
|
@ -4,7 +4,7 @@
|
||||
xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>photon</artifactId>
|
||||
<artifactId>com.minres.scviewer.target</artifactId>
|
||||
|
||||
<packaging>eclipse-target-definition</packaging>
|
||||
<name>SCViewer Target Definition</name>
|
||||
|
@ -2,7 +2,6 @@
|
||||
<classpath>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
|
||||
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry exported="true" kind="con" path="GROOVY_DSL_SUPPORT"/>
|
||||
<classpathentry kind="src" path="src/"/>
|
||||
<classpathentry kind="output" path="target/classes"/>
|
||||
</classpath>
|
||||
|
@ -1,2 +0,0 @@
|
||||
eclipse.preferences.version=1
|
||||
encoding/<project>=UTF-8
|
36
com.minres.scviewer.ui/src/com/minres/scviewer/ui/Hex.java
Normal file
36
com.minres.scviewer.ui/src/com/minres/scviewer/ui/Hex.java
Normal file
@ -0,0 +1,36 @@
|
||||
package com.minres.scviewer.ui;
|
||||
public final class Hex {
|
||||
public static byte[] decode(final String hex) {
|
||||
if (hex.length() % 2 != 0) {
|
||||
throw new IllegalArgumentException("A hex string must contain an even number of characters: " + hex);
|
||||
}
|
||||
|
||||
byte[] out = new byte[hex.length() / 2];
|
||||
|
||||
for (int i = 0; i < hex.length(); i += 2) {
|
||||
int high = Character.digit(hex.charAt(i), 16);
|
||||
int low = Character.digit(hex.charAt(i + 1), 16);
|
||||
if (high == -1 || low == -1) {
|
||||
throw new IllegalArgumentException("A hex string can only contain the characters 0-9, A-F, a-f: " + hex);
|
||||
}
|
||||
|
||||
out[i / 2] = (byte) (high * 16 + low);
|
||||
}
|
||||
|
||||
return out;
|
||||
}
|
||||
|
||||
private static final char[] UPPER_HEX_DIGITS = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F', };
|
||||
|
||||
public static String encode(final byte[] bytes) {
|
||||
StringBuilder stringBuilder = new StringBuilder(bytes.length * 2);
|
||||
for (byte cur : bytes) {
|
||||
stringBuilder.append(UPPER_HEX_DIGITS[(cur >> 4) & 0xF]);
|
||||
stringBuilder.append(UPPER_HEX_DIGITS[(cur & 0xF)]);
|
||||
}
|
||||
return stringBuilder.toString();
|
||||
}
|
||||
|
||||
private Hex() {
|
||||
}
|
||||
}
|
@ -71,7 +71,7 @@ public class TxEditorInputFactory implements IElementFactory {
|
||||
String listData = memento.getString(TAG_STREAMLIST);
|
||||
if (listData != null) {
|
||||
try {
|
||||
ByteArrayInputStream bais = new ByteArrayInputStream(javax.xml.bind.DatatypeConverter.parseHexBinary(listData));
|
||||
ByteArrayInputStream bais = new ByteArrayInputStream(Hex.decode(listData));
|
||||
ObjectInputStream ois = new ObjectInputStream(bais);
|
||||
Object obj = ois.readObject();
|
||||
if(obj instanceof List<?>)
|
||||
@ -107,8 +107,9 @@ public class TxEditorInputFactory implements IElementFactory {
|
||||
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||
ObjectOutputStream oos = new ObjectOutputStream(baos);
|
||||
oos.writeObject(input.getStreamNames());
|
||||
memento.putString(TAG_STREAMLIST, javax.xml.bind.DatatypeConverter.printHexBinary(baos.toByteArray()));
|
||||
memento.putString(TAG_STREAMLIST, Hex.encode(baos.toByteArray()));
|
||||
} catch (IOException e) {
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,2 +0,0 @@
|
||||
eclipse.preferences.version=1
|
||||
encoding/<project>=UTF-8
|
@ -46,6 +46,7 @@ public class E4PreferenceRegistry
|
||||
|
||||
public static final String PREFS_PAGE_XP = "com.opcoach.e4.preferences.e4PreferencePages"; // $NON-NLS-1$
|
||||
public static final String PREF_STORE_PROVIDER = "com.opcoach.e4.preferences.e4PreferenceStoreProvider"; // $NON-NLS-1$
|
||||
public static final String KEY_PREF_STORE_PROVIDERS = "com.opcoach.e4.preferences.e4PreferenceStoreProviders"; // $NON-NLS-1$
|
||||
protected static final String ELMT_PAGE = "page"; // $NON-NLS-1$
|
||||
protected static final String ATTR_ID = "id"; // $NON-NLS-1$
|
||||
protected static final String ATTR_CATEGORY = "category"; // $NON-NLS-1$
|
||||
@ -235,6 +236,7 @@ public class E4PreferenceRegistry
|
||||
IContributionFactory factory = context.get(IContributionFactory.class);
|
||||
|
||||
psProviders = new HashMap<String, Object>();
|
||||
IExtensionRegistry registry = context.get(IExtensionRegistry.class);
|
||||
|
||||
// Read extensions and fill the map...
|
||||
for (IConfigurationElement elmt : registry.getConfigurationElementsFor(PREF_STORE_PROVIDER))
|
||||
@ -261,7 +263,7 @@ public class E4PreferenceRegistry
|
||||
Object data = objectId;
|
||||
if (classname != null)
|
||||
{
|
||||
data = factory.create(classname, context);
|
||||
data = factory.create("bundleclass://"+declaringBundle+"/"+classname, context);
|
||||
if (!(data instanceof IPreferenceStoreProvider))
|
||||
{
|
||||
logger.warn("In extension " + PREF_STORE_PROVIDER + " the class must implements IPreferenceStoreProvider. Check the plugin " + declaringBundle);
|
||||
@ -272,6 +274,8 @@ public class E4PreferenceRegistry
|
||||
psProviders.put(pluginId, data);
|
||||
|
||||
}
|
||||
|
||||
context.set(KEY_PREF_STORE_PROVIDERS, psProviders);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user