Merge branch 'release/2.0'
This commit is contained in:
commit
3cbe5d56d9
|
@ -6,6 +6,8 @@ created by the SystemC VCD trace implementation and the SystemC Verification Lib
|
||||||
For further description of the SCV please refer to
|
For further description of the SCV please refer to
|
||||||
http://www.accellera.org/activities/committees/systemc-verification.
|
http://www.accellera.org/activities/committees/systemc-verification.
|
||||||
|
|
||||||
|
> If you encounter issue when running on Linux please try running as `SWT_GTK3=0 scviewer` as there exist issues wiht GTK3.
|
||||||
|
|
||||||
The viewer is in early alpha stage and not yet ready for production use!
|
The viewer is in early alpha stage and not yet ready for production use!
|
||||||
|
|
||||||
The plugins are structured as follows:
|
The plugins are structured as follows:
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<classpath>
|
<classpath>
|
||||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
|
<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="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
||||||
<classpathentry kind="src" path="src"/>
|
<classpathentry kind="src" path="src"/>
|
||||||
<classpathentry exported="true" kind="lib" path="sqlite-jdbc-3.8.7.jar"/>
|
<classpathentry exported="true" kind="lib" path="sqlite-jdbc-3.8.7.jar"/>
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
eclipse.preferences.version=1
|
eclipse.preferences.version=1
|
||||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
|
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
|
||||||
org.eclipse.jdt.core.compiler.compliance=1.7
|
org.eclipse.jdt.core.compiler.compliance=1.8
|
||||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||||
org.eclipse.jdt.core.compiler.source=1.7
|
org.eclipse.jdt.core.compiler.source=1.8
|
||||||
|
|
|
@ -4,7 +4,7 @@ Bundle-Name: SQLite transaction database
|
||||||
Bundle-SymbolicName: com.minres.scviewer.database.sqlite
|
Bundle-SymbolicName: com.minres.scviewer.database.sqlite
|
||||||
Bundle-Version: 1.0.0.qualifier
|
Bundle-Version: 1.0.0.qualifier
|
||||||
Bundle-Vendor: MINRES Technologies GmbH
|
Bundle-Vendor: MINRES Technologies GmbH
|
||||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
|
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
|
||||||
Require-Bundle: com.minres.scviewer.database;bundle-version="1.0.0",
|
Require-Bundle: com.minres.scviewer.database;bundle-version="1.0.0",
|
||||||
org.eclipse.equinox.util;bundle-version="1.0.500",
|
org.eclipse.equinox.util;bundle-version="1.0.500",
|
||||||
org.eclipse.equinox.ds;bundle-version="1.4.200",
|
org.eclipse.equinox.ds;bundle-version="1.4.200",
|
||||||
|
@ -15,3 +15,4 @@ Bundle-ActivationPolicy: lazy
|
||||||
Embed-Dependency: sqlite-jdbc
|
Embed-Dependency: sqlite-jdbc
|
||||||
Embedded-Artifacts: sqlite-jdbc-3.8.7.jar;g="org.xerial";
|
Embedded-Artifacts: sqlite-jdbc-3.8.7.jar;g="org.xerial";
|
||||||
a="sqlite-jdbc";v="3.8.7"
|
a="sqlite-jdbc";v="3.8.7"
|
||||||
|
Automatic-Module-Name: com.minres.scviewer.database.sqlite
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.minres.scviewer</groupId>
|
<groupId>com.minres.scviewer</groupId>
|
||||||
<artifactId>com.minres.scviewer.parent</artifactId>
|
<artifactId>com.minres.scviewer.parent</artifactId>
|
||||||
<version>1.0.0-SNAPSHOT</version>
|
<version>2.0.0-SNAPSHOT</version>
|
||||||
<relativePath>../com.minres.scviewer.parent</relativePath>
|
<relativePath>../com.minres.scviewer.parent</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<packaging>eclipse-plugin</packaging>
|
<packaging>eclipse-plugin</packaging>
|
||||||
|
|
|
@ -117,6 +117,7 @@ public class TxStream extends HierNode implements ITxStream<ITxEvent> {
|
||||||
sb.append(scvStream.getId());
|
sb.append(scvStream.getId());
|
||||||
resultSet = statement.executeQuery(sb.toString());
|
resultSet = statement.executeQuery(sb.toString());
|
||||||
while (resultSet.next()) {
|
while (resultSet.next()) {
|
||||||
|
if(maxConcurrency==null) maxConcurrency=0;
|
||||||
Object value = resultSet.getObject("concurrencyLevel");
|
Object value = resultSet.getObject("concurrencyLevel");
|
||||||
if(value!=null)
|
if(value!=null)
|
||||||
maxConcurrency=(Integer) value;
|
maxConcurrency=(Integer) value;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<classpath>
|
<classpath>
|
||||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
|
<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="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
||||||
<classpathentry kind="src" path="src/"/>
|
<classpathentry kind="src" path="src"/>
|
||||||
<classpathentry kind="output" path="target/classes"/>
|
<classpathentry kind="output" path="target/classes"/>
|
||||||
</classpath>
|
</classpath>
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
eclipse.preferences.version=1
|
eclipse.preferences.version=1
|
||||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
|
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
|
||||||
org.eclipse.jdt.core.compiler.compliance=1.7
|
org.eclipse.jdt.core.compiler.compliance=1.8
|
||||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||||
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
|
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
|
||||||
org.eclipse.jdt.core.compiler.source=1.7
|
org.eclipse.jdt.core.compiler.source=1.8
|
||||||
|
|
|
@ -11,32 +11,32 @@
|
||||||
<booleanAttribute key="clearws" value="true"/>
|
<booleanAttribute key="clearws" value="true"/>
|
||||||
<booleanAttribute key="clearwslog" value="false"/>
|
<booleanAttribute key="clearwslog" value="false"/>
|
||||||
<stringAttribute key="configLocation" value="${workspace_loc}/.metadata/.plugins/org.eclipse.pde.core/pde-junit"/>
|
<stringAttribute key="configLocation" value="${workspace_loc}/.metadata/.plugins/org.eclipse.pde.core/pde-junit"/>
|
||||||
<booleanAttribute key="default" value="false"/>
|
<booleanAttribute key="default" value="true"/>
|
||||||
<stringAttribute key="deselected_workspace_plugins" value="com.minres.scviewer.database.swt,com.minres.scviewer.e4.application,com.minres.scviewer.ui"/>
|
<stringAttribute key="deselected_workspace_plugins" value="com.minres.scviewer.e4.application,com.minres.scviewer.ui"/>
|
||||||
<booleanAttribute key="includeOptional" value="true"/>
|
<booleanAttribute key="includeOptional" value="true"/>
|
||||||
<stringAttribute key="location" value="${workspace_loc}/../junit-workspace"/>
|
<stringAttribute key="location" value="${workspace_loc}/../junit-workspace"/>
|
||||||
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
|
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
|
||||||
<listEntry value="/com.minres.scviewer.database.test/src/com/minres/scviewer/database/test/DatabaseServicesTest.java"/>
|
<listEntry value="/com.minres.scviewer.database.test"/>
|
||||||
</listAttribute>
|
</listAttribute>
|
||||||
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
|
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
|
||||||
<listEntry value="1"/>
|
<listEntry value="4"/>
|
||||||
</listAttribute>
|
</listAttribute>
|
||||||
<stringAttribute key="org.eclipse.jdt.junit.CONTAINER" value=""/>
|
<stringAttribute key="org.eclipse.jdt.junit.CONTAINER" value="=com.minres.scviewer.database.test"/>
|
||||||
<booleanAttribute key="org.eclipse.jdt.junit.KEEPRUNNING_ATTR" value="false"/>
|
<booleanAttribute key="org.eclipse.jdt.junit.KEEPRUNNING_ATTR" value="false"/>
|
||||||
<stringAttribute key="org.eclipse.jdt.junit.TESTNAME" value=""/>
|
<stringAttribute key="org.eclipse.jdt.junit.TESTNAME" value=""/>
|
||||||
<stringAttribute key="org.eclipse.jdt.junit.TEST_KIND" value="org.eclipse.jdt.junit.loader.junit4"/>
|
<stringAttribute key="org.eclipse.jdt.junit.TEST_KIND" value="org.eclipse.jdt.junit.loader.junit4"/>
|
||||||
<booleanAttribute key="org.eclipse.jdt.launching.ATTR_USE_START_ON_FIRST_THREAD" value="true"/>
|
<booleanAttribute key="org.eclipse.jdt.launching.ATTR_USE_START_ON_FIRST_THREAD" value="true"/>
|
||||||
<stringAttribute key="org.eclipse.jdt.launching.JRE_CONTAINER" value="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
|
<stringAttribute key="org.eclipse.jdt.launching.JRE_CONTAINER" value="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
|
||||||
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="com.minres.scviewer.database.test.DatabaseServicesTest"/>
|
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value=""/>
|
||||||
<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-os ${target.os} -ws ${target.ws} -arch ${target.arch} -nl ${target.nl} -consoleLog"/>
|
<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-os ${target.os} -ws ${target.ws} -arch ${target.arch} -nl ${target.nl} -consoleLog"/>
|
||||||
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="com.minres.scviewer.database.test"/>
|
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="com.minres.scviewer.database.test"/>
|
||||||
<stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.pde.ui.workbenchClasspathProvider"/>
|
<stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.pde.ui.workbenchClasspathProvider"/>
|
||||||
<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Xms40m -Xmx512m -Xdock:icon=../Resources/Eclipse.icns -XstartOnFirstThread -Dorg.eclipse.swt.internal.carbon.smallFonts"/>
|
<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Xms40m -Xmx512m"/>
|
||||||
<stringAttribute key="pde.version" value="3.3"/>
|
<stringAttribute key="pde.version" value="3.3"/>
|
||||||
<stringAttribute key="product" value="com.minres.scviewer.e4.product"/>
|
<stringAttribute key="product" value="com.minres.scviewer.e4.product"/>
|
||||||
<booleanAttribute key="run_in_ui_thread" value="true"/>
|
<booleanAttribute key="run_in_ui_thread" value="true"/>
|
||||||
<stringAttribute key="selected_target_plugins" value="com.google.guava*10.0.1.v201203051515@default:default,com.google.guava*15.0.0.v201403281430@default:default,com.ibm.icu@default:default,javax.annotation@default:default,javax.inject@default:default,javax.servlet*3.0.0.v201112011016@default:default,javax.servlet*3.1.0.v201410161800@default:default,javax.xml@default:default,org.apache.ant@default:default,org.apache.batik.css@default:default,org.apache.batik.util.gui@default:default,org.apache.batik.util@default:default,org.apache.commons.jxpath@default:default,org.apache.commons.logging@default:default,org.apache.felix.gogo.runtime@default:default,org.apache.felix.gogo.shell@default:default,org.codehaus.groovy*2.4.3.xx-201508121448-e45@default:default,org.eclipse.ant.core@default:default,org.eclipse.compare.core@default:default,org.eclipse.core.commands@default:default,org.eclipse.core.contenttype@default:default,org.eclipse.core.databinding.observable@default:default,org.eclipse.core.databinding.property@default:default,org.eclipse.core.databinding@default:default,org.eclipse.core.expressions@default:default,org.eclipse.core.filesystem.java7@default:false,org.eclipse.core.filesystem.macosx@default:false,org.eclipse.core.filesystem@default:default,org.eclipse.core.jobs@default:default,org.eclipse.core.resources@default:default,org.eclipse.core.runtime.compatibility.registry@default:false,org.eclipse.core.runtime@default:true,org.eclipse.core.variables@default:default,org.eclipse.e4.core.commands@default:default,org.eclipse.e4.core.contexts@default:default,org.eclipse.e4.core.di.annotations@default:default,org.eclipse.e4.core.di.extensions@default:default,org.eclipse.e4.core.di@default:default,org.eclipse.e4.core.services@default:default,org.eclipse.e4.emf.xpath@default:default,org.eclipse.e4.ui.bindings@default:default,org.eclipse.e4.ui.css.core@default:default,org.eclipse.e4.ui.css.swt.theme@default:default,org.eclipse.e4.ui.css.swt@default:default,org.eclipse.e4.ui.di@default:default,org.eclipse.e4.ui.model.workbench@default:default,org.eclipse.e4.ui.services@default:default,org.eclipse.e4.ui.widgets@default:default,org.eclipse.e4.ui.workbench.addons.swt@default:default,org.eclipse.e4.ui.workbench.renderers.swt.cocoa@default:false,org.eclipse.e4.ui.workbench.renderers.swt@default:default,org.eclipse.e4.ui.workbench.swt@default:default,org.eclipse.e4.ui.workbench3@default:default,org.eclipse.e4.ui.workbench@default:default,org.eclipse.emf.common@default:default,org.eclipse.emf.ecore.change@default:default,org.eclipse.emf.ecore.xmi@default:default,org.eclipse.emf.ecore@default:default,org.eclipse.equinox.app@default:default,org.eclipse.equinox.bidi@default:default,org.eclipse.equinox.common@2:true,org.eclipse.equinox.console@default:default,org.eclipse.equinox.ds@1:true,org.eclipse.equinox.event@default:default,org.eclipse.equinox.preferences@default:default,org.eclipse.equinox.registry@default:default,org.eclipse.equinox.util@default:default,org.eclipse.help@default:default,org.eclipse.jface.databinding@default:default,org.eclipse.jface@default:default,org.eclipse.osgi.compatibility.state@default:false,org.eclipse.osgi.services@default:default,org.eclipse.osgi@-1:true,org.eclipse.swt.cocoa.macosx.x86_64@default:false,org.eclipse.swt@default:default,org.eclipse.team.core@default:default,org.eclipse.ui.cocoa@default:false,org.eclipse.ui.trace@default:default,org.eclipse.ui.workbench@default:default,org.eclipse.ui@default:default,org.hamcrest.core@default:default,org.junit@default:default,org.mozilla.javascript@default:default,org.w3c.css.sac@default:default,org.w3c.dom.events@default:default,org.w3c.dom.smil@default:default,org.w3c.dom.svg@default:default"/>
|
<stringAttribute key="selected_target_plugins" value="com.google.guava@default:default,javax.annotation@default:default,javax.inject@default:default,javax.servlet@default:default,org.apache.ant@default:default,org.apache.commons.jxpath@default:default,org.apache.felix.gogo.command@default:default,org.apache.felix.gogo.runtime@default:default,org.codehaus.groovy@default:default,org.eclipse.ant.core@default:default,org.eclipse.core.commands@default:default,org.eclipse.core.contenttype@default:default,org.eclipse.core.expressions@default:default,org.eclipse.core.filesystem.macosx@default:false,org.eclipse.core.filesystem@default:default,org.eclipse.core.jobs@default:default,org.eclipse.core.resources@default:default,org.eclipse.core.runtime@default:true,org.eclipse.core.variables@default:default,org.eclipse.e4.core.contexts@default:default,org.eclipse.e4.core.di.annotations@default:default,org.eclipse.e4.core.di.extensions@default:default,org.eclipse.e4.core.di@default:default,org.eclipse.e4.core.services@default:default,org.eclipse.e4.emf.xpath@default:default,org.eclipse.e4.ui.di@default:default,org.eclipse.e4.ui.model.workbench@default:default,org.eclipse.e4.ui.services@default:default,org.eclipse.emf.common@default:default,org.eclipse.emf.ecore@default:default,org.eclipse.equinox.app@default:default,org.eclipse.equinox.bidi@default:default,org.eclipse.equinox.common@2:true,org.eclipse.equinox.ds@1:true,org.eclipse.equinox.preferences@default:default,org.eclipse.equinox.registry@default:default,org.eclipse.equinox.util@default:default,org.eclipse.jface@default:default,org.eclipse.osgi.compatibility.state@default:false,org.eclipse.osgi.services@default:default,org.eclipse.osgi@-1:true,org.eclipse.swt.cocoa.macosx.x86_64@default:false,org.eclipse.swt@default:default,org.hamcrest.core@default:default,org.junit@default:default"/>
|
||||||
<stringAttribute key="selected_workspace_plugins" value="com.minres.scviewer.database.sqlite@default:true,com.minres.scviewer.database.test@default:default,com.minres.scviewer.database.text@default:true,com.minres.scviewer.database.vcd@default:default,com.minres.scviewer.database@default:true"/>
|
<stringAttribute key="selected_workspace_plugins" value="com.minres.scviewer.database.sqlite@default:true,com.minres.scviewer.database.test@default:default,com.minres.scviewer.database.text@default:true,com.minres.scviewer.database.ui.swt@default:default,com.minres.scviewer.database.ui@default:default,com.minres.scviewer.database.vcd@default:default,com.minres.scviewer.database@default:true,com.opcoach.e4.preferences@default:default"/>
|
||||||
<booleanAttribute key="show_selected_only" value="false"/>
|
<booleanAttribute key="show_selected_only" value="false"/>
|
||||||
<booleanAttribute key="tracing" value="false"/>
|
<booleanAttribute key="tracing" value="false"/>
|
||||||
<booleanAttribute key="useCustomFeatures" value="false"/>
|
<booleanAttribute key="useCustomFeatures" value="false"/>
|
||||||
|
|
|
@ -4,7 +4,7 @@ Bundle-Name: SCViewer database tests
|
||||||
Bundle-SymbolicName: com.minres.scviewer.database.test
|
Bundle-SymbolicName: com.minres.scviewer.database.test
|
||||||
Bundle-Version: 1.0.0.qualifier
|
Bundle-Version: 1.0.0.qualifier
|
||||||
Bundle-Vendor: MINRES Technologies GnbH
|
Bundle-Vendor: MINRES Technologies GnbH
|
||||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
|
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
|
||||||
Require-Bundle: org.junit,
|
Require-Bundle: org.junit,
|
||||||
com.minres.scviewer.database,
|
com.minres.scviewer.database,
|
||||||
com.minres.scviewer.database.sqlite;bundle-version="1.0.0",
|
com.minres.scviewer.database.sqlite;bundle-version="1.0.0",
|
||||||
|
@ -12,3 +12,4 @@ Require-Bundle: org.junit,
|
||||||
com.minres.scviewer.database.vcd;bundle-version="1.0.0"
|
com.minres.scviewer.database.vcd;bundle-version="1.0.0"
|
||||||
Bundle-ActivationPolicy: lazy
|
Bundle-ActivationPolicy: lazy
|
||||||
Service-Component: OSGI-INF/component.xml
|
Service-Component: OSGI-INF/component.xml
|
||||||
|
Automatic-Module-Name: com.minres.scviewer.database.test
|
||||||
|
|
|
@ -1 +1,2 @@
|
||||||
/.scviewer.*
|
/.scviewer.*
|
||||||
|
/.my_db.txlog*
|
File diff suppressed because it is too large
Load Diff
|
@ -5,7 +5,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.minres.scviewer</groupId>
|
<groupId>com.minres.scviewer</groupId>
|
||||||
<artifactId>com.minres.scviewer.parent</artifactId>
|
<artifactId>com.minres.scviewer.parent</artifactId>
|
||||||
<version>1.0.0-SNAPSHOT</version>
|
<version>2.0.0-SNAPSHOT</version>
|
||||||
<relativePath>../com.minres.scviewer.parent</relativePath>
|
<relativePath>../com.minres.scviewer.parent</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<packaging>eclipse-test-plugin</packaging>
|
<packaging>eclipse-test-plugin</packaging>
|
||||||
|
@ -14,6 +14,7 @@
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.eclipse.tycho</groupId>
|
<groupId>org.eclipse.tycho</groupId>
|
||||||
<artifactId>tycho-surefire-plugin</artifactId>
|
<artifactId>tycho-surefire-plugin</artifactId>
|
||||||
|
<version>0.23.1</version>
|
||||||
<configuration>
|
<configuration>
|
||||||
<!-- <bundleStartLevel /> -->
|
<!-- <bundleStartLevel /> -->
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
|
|
@ -86,5 +86,15 @@ public class DatabaseServicesTest {
|
||||||
assertEquals(1, waveformDb.getChildNodes().size());
|
assertEquals(1, waveformDb.getChildNodes().size());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testHierarchicalVCD() throws Exception {
|
||||||
|
File f = new File("inputs/simple_system.vcd").getAbsoluteFile();
|
||||||
|
assertTrue(f.exists());
|
||||||
|
waveformDb.load(f);
|
||||||
|
assertNotNull(waveformDb);
|
||||||
|
assertEquals(779, waveformDb.getAllWaves().size());
|
||||||
|
assertEquals(1, waveformDb.getChildNodes().size());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<classpath>
|
<classpath>
|
||||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
|
<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="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
||||||
<classpathentry kind="src" path="src/"/>
|
<classpathentry kind="src" path="src"/>
|
||||||
<classpathentry exported="true" kind="con" path="GROOVY_DSL_SUPPORT"/>
|
<classpathentry exported="true" kind="con" path="GROOVY_DSL_SUPPORT"/>
|
||||||
<classpathentry kind="output" path="target/classes"/>
|
<classpathentry kind="output" path="target/classes"/>
|
||||||
</classpath>
|
</classpath>
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
eclipse.preferences.version=1
|
eclipse.preferences.version=1
|
||||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
|
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
|
||||||
org.eclipse.jdt.core.compiler.compliance=1.7
|
org.eclipse.jdt.core.compiler.compliance=1.8
|
||||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||||
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
|
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
|
||||||
org.eclipse.jdt.core.compiler.source=1.7
|
org.eclipse.jdt.core.compiler.source=1.8
|
||||||
|
|
|
@ -1,2 +1,2 @@
|
||||||
eclipse.preferences.version=1
|
eclipse.preferences.version=1
|
||||||
groovy.compiler.level=23
|
groovy.compiler.level=26
|
||||||
|
|
|
@ -2,9 +2,9 @@ Manifest-Version: 1.0
|
||||||
Bundle-ManifestVersion: 2
|
Bundle-ManifestVersion: 2
|
||||||
Bundle-Name: Textual transaction database
|
Bundle-Name: Textual transaction database
|
||||||
Bundle-SymbolicName: com.minres.scviewer.database.text
|
Bundle-SymbolicName: com.minres.scviewer.database.text
|
||||||
Bundle-Version: 1.0.0.qualifier
|
Bundle-Version: 1.0.1.qualifier
|
||||||
Bundle-Vendor: MINRES Technologies GmbH
|
Bundle-Vendor: MINRES Technologies GmbH
|
||||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
|
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
|
||||||
Import-Package: com.minres.scviewer.database,
|
Import-Package: com.minres.scviewer.database,
|
||||||
org.osgi.framework;version="1.3.0"
|
org.osgi.framework;version="1.3.0"
|
||||||
Require-Bundle: com.minres.scviewer.database;bundle-version="1.0.0",
|
Require-Bundle: com.minres.scviewer.database;bundle-version="1.0.0",
|
||||||
|
@ -15,3 +15,4 @@ Require-Bundle: com.minres.scviewer.database;bundle-version="1.0.0",
|
||||||
com.google.guava;bundle-version="15.0.0"
|
com.google.guava;bundle-version="15.0.0"
|
||||||
Service-Component: OSGI-INF/component.xml
|
Service-Component: OSGI-INF/component.xml
|
||||||
Bundle-ActivationPolicy: lazy
|
Bundle-ActivationPolicy: lazy
|
||||||
|
Automatic-Module-Name: com.minres.scviewer.database.text
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.minres.scviewer</groupId>
|
<groupId>com.minres.scviewer</groupId>
|
||||||
<artifactId>com.minres.scviewer.parent</artifactId>
|
<artifactId>com.minres.scviewer.parent</artifactId>
|
||||||
<version>1.0.0-SNAPSHOT</version>
|
<version>2.0.0-SNAPSHOT</version>
|
||||||
<relativePath>../com.minres.scviewer.parent</relativePath>
|
<relativePath>../com.minres.scviewer.parent</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<packaging>eclipse-plugin</packaging>
|
<packaging>eclipse-plugin</packaging>
|
||||||
|
@ -39,4 +39,5 @@
|
||||||
</plugin>
|
</plugin>
|
||||||
</plugins>
|
</plugins>
|
||||||
</build>
|
</build>
|
||||||
</project>
|
<version>1.0.1-SNAPSHOT</version>
|
||||||
|
</project>
|
|
@ -13,8 +13,6 @@ package com.minres.scviewer.database.text;
|
||||||
import java.nio.charset.CharsetDecoder;
|
import java.nio.charset.CharsetDecoder;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.zip.GZIPInputStream
|
import java.util.zip.GZIPInputStream
|
||||||
import org.apache.jdbm.DB
|
|
||||||
import org.apache.jdbm.DBMaker
|
|
||||||
import groovy.io.FileType
|
import groovy.io.FileType
|
||||||
|
|
||||||
import com.minres.scviewer.database.AssociationType
|
import com.minres.scviewer.database.AssociationType
|
||||||
|
@ -32,8 +30,6 @@ public class TextDbLoader implements IWaveformDbLoader{
|
||||||
|
|
||||||
IWaveformDb db;
|
IWaveformDb db;
|
||||||
|
|
||||||
DB backingDb;
|
|
||||||
|
|
||||||
def streams = []
|
def streams = []
|
||||||
|
|
||||||
def relationTypes=[:]
|
def relationTypes=[:]
|
||||||
|
@ -65,20 +61,6 @@ public class TextDbLoader implements IWaveformDbLoader{
|
||||||
this.streams=[]
|
this.streams=[]
|
||||||
def gzipped = isGzipped(file)
|
def gzipped = isGzipped(file)
|
||||||
if(isTxfile(gzipped?new GZIPInputStream(new FileInputStream(file)):new FileInputStream(file))){
|
if(isTxfile(gzipped?new GZIPInputStream(new FileInputStream(file)):new FileInputStream(file))){
|
||||||
if(true) {
|
|
||||||
def parentDir=file.absoluteFile.parent
|
|
||||||
def filename=file.name
|
|
||||||
new File(parentDir).eachFileRecurse (FileType.FILES) { f -> if(f.name=~/^\.${filename}/) f.delete() }
|
|
||||||
this.backingDb = DBMaker.openFile(parentDir+File.separator+"."+filename+"_bdb")
|
|
||||||
.deleteFilesAfterClose()
|
|
||||||
.useRandomAccessFile()
|
|
||||||
.setMRUCacheSize(4096)
|
|
||||||
//.disableTransactions()
|
|
||||||
.disableLocking()
|
|
||||||
.make();
|
|
||||||
} else {
|
|
||||||
this.backingDb = DBMaker.openMemory().disableLocking().make()
|
|
||||||
}
|
|
||||||
parseInput(gzipped?new GZIPInputStream(new FileInputStream(file)):new FileInputStream(file))
|
parseInput(gzipped?new GZIPInputStream(new FileInputStream(file)):new FileInputStream(file))
|
||||||
calculateConcurrencyIndicees()
|
calculateConcurrencyIndicees()
|
||||||
return true
|
return true
|
||||||
|
@ -140,7 +122,7 @@ public class TextDbLoader implements IWaveformDbLoader{
|
||||||
case "end_attribute":
|
case "end_attribute":
|
||||||
if ((matcher = line =~ /^scv_tr_stream\s+\(ID (\d+),\s+name\s+"([^"]+)",\s+kind\s+"([^"]+)"\)$/)) {
|
if ((matcher = line =~ /^scv_tr_stream\s+\(ID (\d+),\s+name\s+"([^"]+)",\s+kind\s+"([^"]+)"\)$/)) {
|
||||||
def id = Integer.parseInt(matcher[0][1])
|
def id = Integer.parseInt(matcher[0][1])
|
||||||
def stream = new TxStream(db, id, matcher[0][2], matcher[0][3], backingDb)
|
def stream = new TxStream(db, id, matcher[0][2], matcher[0][3])
|
||||||
streams<<stream
|
streams<<stream
|
||||||
streamsById[id]=stream
|
streamsById[id]=stream
|
||||||
} else if ((matcher = line =~ /^scv_tr_generator\s+\(ID\s+(\d+),\s+name\s+"([^"]+)",\s+scv_tr_stream\s+(\d+),$/)) {
|
} else if ((matcher = line =~ /^scv_tr_generator\s+\(ID\s+(\d+),\s+name\s+"([^"]+)",\s+scv_tr_stream\s+(\d+),$/)) {
|
||||||
|
@ -183,9 +165,11 @@ public class TextDbLoader implements IWaveformDbLoader{
|
||||||
break
|
break
|
||||||
case "a"://matcher = line =~ /^a\s+(.+)$/
|
case "a"://matcher = line =~ /^a\s+(.+)$/
|
||||||
if(endTransaction){
|
if(endTransaction){
|
||||||
transaction.attributes << new TxAttribute(transaction.generator.end_attrs[0], tokens[1])
|
transaction.attributes << new TxAttribute(transaction.generator.end_attrs[transaction.generator.end_attrs_idx], tokens[1])
|
||||||
|
transaction.generator.end_attrs_idx++
|
||||||
} else {
|
} else {
|
||||||
transaction.attributes << new TxAttribute(transaction.generator.begin_attrs[0], tokens[1])
|
transaction.attributes << new TxAttribute(transaction.generator.begin_attrs[transaction.generator.begin_attrs_idx], tokens[1])
|
||||||
|
transaction.generator.begin_attrs_idx++
|
||||||
}
|
}
|
||||||
break
|
break
|
||||||
case "tx_relation"://matcher = line =~ /^tx_relation\s+\"(\S+)\"\s+(\d+)\s+(\d+)$/
|
case "tx_relation"://matcher = line =~ /^tx_relation\s+\"(\S+)\"\s+(\d+)\s+(\d+)$/
|
||||||
|
@ -202,9 +186,6 @@ public class TextDbLoader implements IWaveformDbLoader{
|
||||||
|
|
||||||
}
|
}
|
||||||
lineCnt++
|
lineCnt++
|
||||||
if((lineCnt%1000) == 0) {
|
|
||||||
backingDb.commit()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -43,15 +43,14 @@ class TxStream extends HierNode implements ITxStream {
|
||||||
|
|
||||||
private TreeMap<Long, List<ITxEvent>> events
|
private TreeMap<Long, List<ITxEvent>> events
|
||||||
|
|
||||||
TxStream(IWaveformDb db, int id, String name, String kind, DB backingStore){
|
TxStream(IWaveformDb db, int id, String name, String kind){
|
||||||
super(name)
|
super(name)
|
||||||
this.id=id
|
this.id=id
|
||||||
this.database=db
|
this.database=db
|
||||||
this.fullName=name
|
this.fullName=name
|
||||||
this.kind=kind
|
this.kind=kind
|
||||||
this.maxConcurrency=0
|
this.maxConcurrency=0
|
||||||
//events = new TreeMap<Long, List<ITxEvent>>()
|
events = new TreeMap<Long, List<ITxEvent>>()
|
||||||
events=backingStore.createTreeMap("stream-"+name)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
List<ITxGenerator> getGenerators(){
|
List<ITxGenerator> getGenerators(){
|
||||||
|
|
|
@ -11,6 +11,7 @@ import java.util.Comparator;
|
||||||
/**
|
/**
|
||||||
* Various utilities used in JDBM
|
* Various utilities used in JDBM
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("rawtypes")
|
||||||
class Utils {
|
class Utils {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -46,6 +47,7 @@ class Utils {
|
||||||
* Compares comparables. Default comparator for most of java types
|
* Compares comparables. Default comparator for most of java types
|
||||||
*/
|
*/
|
||||||
static final Comparator COMPARABLE_COMPARATOR = new Comparator<Comparable>() {
|
static final Comparator COMPARABLE_COMPARATOR = new Comparator<Comparable>() {
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
public int compare(Comparable o1, Comparable o2) {
|
public int compare(Comparable o1, Comparable o2) {
|
||||||
return o1 == null && o2 != null ? -1 : (o1 != null && o2 == null ? 1 : o1.compareTo(o2));
|
return o1 == null && o2 != null ? -1 : (o1 != null && o2 == null ? 1 : o1.compareTo(o2));
|
||||||
}
|
}
|
||||||
|
@ -72,6 +74,7 @@ class Utils {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
static <E> E max(E e1, E e2, Comparator comp){
|
static <E> E max(E e1, E e2, Comparator comp){
|
||||||
if(e1 == null) return e2;
|
if(e1 == null) return e2;
|
||||||
if(e2 == null) return e1;
|
if(e2 == null) return e1;
|
||||||
|
@ -81,6 +84,7 @@ class Utils {
|
||||||
return comp.compare(e1,e2)<0 ? e2:e1;
|
return comp.compare(e1,e2)<0 ? e2:e1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
static <E> E min(E e1, E e2, Comparator comp){
|
static <E> E min(E e1, E e2, Comparator comp){
|
||||||
if(e1 == null) return e2;
|
if(e1 == null) return e2;
|
||||||
if(e2 == null) return e1;
|
if(e2 == null) return e1;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<classpath>
|
<classpath>
|
||||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
|
<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="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
||||||
<classpathentry kind="src" path="src/"/>
|
<classpathentry kind="src" path="src"/>
|
||||||
<classpathentry kind="output" path="target/classes"/>
|
<classpathentry kind="output" path="target/classes"/>
|
||||||
</classpath>
|
</classpath>
|
||||||
|
|
|
@ -9,8 +9,8 @@ org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nul
|
||||||
org.eclipse.jdt.core.compiler.annotation.nullable.secondary=
|
org.eclipse.jdt.core.compiler.annotation.nullable.secondary=
|
||||||
org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled
|
org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled
|
||||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
|
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
|
||||||
org.eclipse.jdt.core.compiler.compliance=1.7
|
org.eclipse.jdt.core.compiler.compliance=1.8
|
||||||
org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
|
org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
|
||||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||||
org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
|
org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
|
||||||
|
@ -98,4 +98,4 @@ org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
|
||||||
org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=ignore
|
org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=ignore
|
||||||
org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
|
org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
|
||||||
org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
|
org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
|
||||||
org.eclipse.jdt.core.compiler.source=1.7
|
org.eclipse.jdt.core.compiler.source=1.8
|
||||||
|
|
|
@ -2,9 +2,9 @@ Manifest-Version: 1.0
|
||||||
Bundle-ManifestVersion: 2
|
Bundle-ManifestVersion: 2
|
||||||
Bundle-Name: SWT widget
|
Bundle-Name: SWT widget
|
||||||
Bundle-SymbolicName: com.minres.scviewer.database.ui.swt
|
Bundle-SymbolicName: com.minres.scviewer.database.ui.swt
|
||||||
Bundle-Version: 1.1.0.qualifier
|
Bundle-Version: 2.0.0.qualifier
|
||||||
Bundle-Vendor: MINRES Technologies GmbH
|
Bundle-Vendor: MINRES Technologies GmbH
|
||||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
|
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
|
||||||
Require-Bundle: org.eclipse.swt;bundle-version="3.103.1",
|
Require-Bundle: org.eclipse.swt;bundle-version="3.103.1",
|
||||||
com.minres.scviewer.database;bundle-version="1.0.0",
|
com.minres.scviewer.database;bundle-version="1.0.0",
|
||||||
com.google.guava;bundle-version="15.0.0",
|
com.google.guava;bundle-version="15.0.0",
|
||||||
|
@ -17,3 +17,4 @@ Export-Package: com.minres.scviewer.database.swt
|
||||||
Bundle-ClassPath: .
|
Bundle-ClassPath: .
|
||||||
Bundle-ActivationPolicy: lazy
|
Bundle-ActivationPolicy: lazy
|
||||||
Bundle-Activator: com.minres.scviewer.database.swt.DatabaseUiPlugin
|
Bundle-Activator: com.minres.scviewer.database.swt.DatabaseUiPlugin
|
||||||
|
Automatic-Module-Name: com.minres.scviewer.database.ui.swt
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<artifactId>com.minres.scviewer.database.ui.swt</artifactId>
|
<artifactId>com.minres.scviewer.database.ui.swt</artifactId>
|
||||||
|
<version>2.0.0-SNAPSHOT</version>
|
||||||
<packaging>eclipse-plugin</packaging>
|
<packaging>eclipse-plugin</packaging>
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.minres.scviewer</groupId>
|
<groupId>com.minres.scviewer</groupId>
|
||||||
<artifactId>com.minres.scviewer.parent</artifactId>
|
<artifactId>com.minres.scviewer.parent</artifactId>
|
||||||
<version>1.0.0-SNAPSHOT</version>
|
<version>2.0.0-SNAPSHOT</version>
|
||||||
<relativePath>../com.minres.scviewer.parent</relativePath>
|
<relativePath>../com.minres.scviewer.parent</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<version>1.1.0-SNAPSHOT</version>
|
|
||||||
</project>
|
</project>
|
|
@ -0,0 +1,9 @@
|
||||||
|
package com.minres.scviewer.database.swt;
|
||||||
|
|
||||||
|
public class Constants {
|
||||||
|
|
||||||
|
public final static String[] unitString={"fs", "ps", "ns", "us", "ms"};//, "s"};
|
||||||
|
|
||||||
|
public final static int[] unitMultiplier={1, 3, 10, 30, 100, 300};
|
||||||
|
|
||||||
|
}
|
|
@ -10,6 +10,7 @@
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package com.minres.scviewer.database.swt.internal;
|
package com.minres.scviewer.database.swt.internal;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
import java.util.NavigableMap;
|
import java.util.NavigableMap;
|
||||||
|
|
||||||
|
@ -24,8 +25,9 @@ import org.eclipse.swt.graphics.Rectangle;
|
||||||
|
|
||||||
import com.minres.scviewer.database.ISignal;
|
import com.minres.scviewer.database.ISignal;
|
||||||
import com.minres.scviewer.database.ISignalChange;
|
import com.minres.scviewer.database.ISignalChange;
|
||||||
import com.minres.scviewer.database.ISignalChangeMulti;
|
import com.minres.scviewer.database.ISignalChangeBit;
|
||||||
import com.minres.scviewer.database.ISignalChangeSingle;
|
import com.minres.scviewer.database.ISignalChangeBitVector;
|
||||||
|
import com.minres.scviewer.database.ISignalChangeReal;
|
||||||
import com.minres.scviewer.database.ui.TrackEntry;
|
import com.minres.scviewer.database.ui.TrackEntry;
|
||||||
import com.minres.scviewer.database.ui.WaveformColors;
|
import com.minres.scviewer.database.ui.WaveformColors;
|
||||||
|
|
||||||
|
@ -65,7 +67,6 @@ public class SignalPainter extends TrackPainter {
|
||||||
private static final JPanel DUMMY_PANEL = new JPanel();
|
private static final JPanel DUMMY_PANEL = new JPanel();
|
||||||
|
|
||||||
private final WaveformCanvas waveCanvas;
|
private final WaveformCanvas waveCanvas;
|
||||||
private ISignal<? extends ISignalChange> signal;
|
|
||||||
|
|
||||||
int yOffsetT;
|
int yOffsetT;
|
||||||
int yOffsetM;
|
int yOffsetM;
|
||||||
|
@ -75,7 +76,6 @@ public class SignalPainter extends TrackPainter {
|
||||||
public SignalPainter(WaveformCanvas txDisplay, boolean even, TrackEntry trackEntry) {
|
public SignalPainter(WaveformCanvas txDisplay, boolean even, TrackEntry trackEntry) {
|
||||||
super(trackEntry, even);
|
super(trackEntry, even);
|
||||||
this.waveCanvas = txDisplay;
|
this.waveCanvas = txDisplay;
|
||||||
this.signal = trackEntry.getSignal();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private int getXEnd(long time) {
|
private int getXEnd(long time) {
|
||||||
|
@ -84,6 +84,7 @@ public class SignalPainter extends TrackPainter {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void paintArea(GC gc, Rectangle area) {
|
public void paintArea(GC gc, Rectangle area) {
|
||||||
|
ISignal<? extends ISignalChange> signal = trackEntry.getSignal();
|
||||||
if (trackEntry.selected)
|
if (trackEntry.selected)
|
||||||
gc.setBackground(this.waveCanvas.colors[WaveformColors.TRACK_BG_HIGHLITE.ordinal()]);
|
gc.setBackground(this.waveCanvas.colors[WaveformColors.TRACK_BG_HIGHLITE.ordinal()]);
|
||||||
else
|
else
|
||||||
|
@ -107,8 +108,6 @@ public class SignalPainter extends TrackPainter {
|
||||||
NavigableMap<Long, ? extends ISignalChange> entries = signal.getEvents().subMap(first.getKey(), false, last.getKey(), true);
|
NavigableMap<Long, ? extends ISignalChange> entries = signal.getEvents().subMap(first.getKey(), false, last.getKey(), true);
|
||||||
SignalChange left = new SignalChange(first);
|
SignalChange left = new SignalChange(first);
|
||||||
SignalChange right = new SignalChange(entries.size() > 0 ? entries.firstEntry() : first);
|
SignalChange right = new SignalChange(entries.size() > 0 ? entries.firstEntry() : first);
|
||||||
SignalStencil stencil = left.value instanceof ISignalChangeSingle ? new SingleBitStencil() : new MultiBitStencil(gc);
|
|
||||||
|
|
||||||
maxX = area.x + area.width;
|
maxX = area.x + area.width;
|
||||||
yOffsetT = this.waveCanvas.getTrackHeight() / 5 + area.y;
|
yOffsetT = this.waveCanvas.getTrackHeight() / 5 + area.y;
|
||||||
yOffsetM = this.waveCanvas.getTrackHeight() / 2 + area.y;
|
yOffsetM = this.waveCanvas.getTrackHeight() / 2 + area.y;
|
||||||
|
@ -122,7 +121,6 @@ public class SignalPainter extends TrackPainter {
|
||||||
// b) left to close to right
|
// b) left to close to right
|
||||||
if (left.time == right.time) {
|
if (left.time == right.time) {
|
||||||
right.time = endTime;
|
right.time = endTime;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
multiple = true;
|
multiple = true;
|
||||||
long eTime = (xBegin + 1) * this.waveCanvas.getScaleFactor();
|
long eTime = (xBegin + 1) * this.waveCanvas.getScaleFactor();
|
||||||
|
@ -132,6 +130,7 @@ public class SignalPainter extends TrackPainter {
|
||||||
xEnd = getXEnd(right.time);
|
xEnd = getXEnd(right.time);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SignalStencil stencil = getStencil(gc, left, entries);
|
||||||
do {
|
do {
|
||||||
stencil.draw(gc, area, left.value, right.value, xBegin, xEnd, multiple);
|
stencil.draw(gc, area, left.value, right.value, xBegin, xEnd, multiple);
|
||||||
if (right.time >= endTime)
|
if (right.time >= endTime)
|
||||||
|
@ -144,12 +143,30 @@ public class SignalPainter extends TrackPainter {
|
||||||
if (xEnd == xBegin) {
|
if (xEnd == xBegin) {
|
||||||
multiple = true;
|
multiple = true;
|
||||||
long eTime = (xBegin + 1) * this.waveCanvas.getScaleFactor();
|
long eTime = (xBegin + 1) * this.waveCanvas.getScaleFactor();
|
||||||
right.set(entries.floorEntry(eTime), endTime);
|
Entry<Long, ? extends ISignalChange> entry = entries.floorEntry(eTime);
|
||||||
|
if(entry!=null && entry.getKey()> right.time)
|
||||||
|
right.set(entry, endTime);
|
||||||
xEnd = getXEnd(eTime);
|
xEnd = getXEnd(eTime);
|
||||||
}
|
}
|
||||||
} while (left.time < endTime);
|
} while (left.time < endTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private SignalStencil getStencil(GC gc, SignalChange left, NavigableMap<Long, ? extends ISignalChange> entries) {
|
||||||
|
if(left.value instanceof ISignalChangeBit)
|
||||||
|
return new SingleBitStencil();
|
||||||
|
else if (left.value instanceof ISignalChangeBitVector)
|
||||||
|
if(trackEntry.waveDisplay==TrackEntry.WaveDisplay.DEFAULT)
|
||||||
|
return new MultiBitStencil(gc);
|
||||||
|
else
|
||||||
|
return new MultiBitStencilAnalog(entries, left.value,
|
||||||
|
trackEntry.waveDisplay==TrackEntry.WaveDisplay.CONTINOUS,
|
||||||
|
trackEntry.valueDisplay==TrackEntry.ValueDisplay.SIGNED);
|
||||||
|
else if (left.value instanceof ISignalChangeReal)
|
||||||
|
return new RealStencil(entries, left.value, trackEntry.waveDisplay==TrackEntry.WaveDisplay.CONTINOUS);
|
||||||
|
else
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
private interface SignalStencil {
|
private interface SignalStencil {
|
||||||
|
|
||||||
public void draw(GC gc, Rectangle area, ISignalChange left, ISignalChange right, int xBegin, int xEnd, boolean multiple);
|
public void draw(GC gc, Rectangle area, ISignalChange left, ISignalChange right, int xBegin, int xEnd, boolean multiple);
|
||||||
|
@ -168,7 +185,7 @@ public class SignalPainter extends TrackPainter {
|
||||||
|
|
||||||
public void draw(GC gc, Rectangle area, ISignalChange left, ISignalChange right, int xBegin, int xEnd, boolean multiple) {
|
public void draw(GC gc, Rectangle area, ISignalChange left, ISignalChange right, int xBegin, int xEnd, boolean multiple) {
|
||||||
Color colorBorder = waveCanvas.colors[WaveformColors.SIGNAL0.ordinal()];
|
Color colorBorder = waveCanvas.colors[WaveformColors.SIGNAL0.ordinal()];
|
||||||
ISignalChangeMulti last = (ISignalChangeMulti) left;
|
ISignalChangeBitVector last = (ISignalChangeBitVector) left;
|
||||||
if (last.getValue().toString().contains("X")) {
|
if (last.getValue().toString().contains("X")) {
|
||||||
colorBorder = waveCanvas.colors[WaveformColors.SIGNALX.ordinal()];
|
colorBorder = waveCanvas.colors[WaveformColors.SIGNALX.ordinal()];
|
||||||
} else if (last.getValue().toString().contains("Z")) {
|
} else if (last.getValue().toString().contains("Z")) {
|
||||||
|
@ -187,7 +204,18 @@ public class SignalPainter extends TrackPainter {
|
||||||
gc.setForeground(colorBorder);
|
gc.setForeground(colorBorder);
|
||||||
gc.drawPolygon(points);
|
gc.drawPolygon(points);
|
||||||
gc.setForeground(waveCanvas.colors[WaveformColors.SIGNAL_TEXT.ordinal()]);
|
gc.setForeground(waveCanvas.colors[WaveformColors.SIGNAL_TEXT.ordinal()]);
|
||||||
String label = "h'" + last.getValue().toHexString();
|
//TODO: this code should be provided from a central location
|
||||||
|
String label = null;
|
||||||
|
switch(trackEntry.valueDisplay) {
|
||||||
|
case SIGNED:
|
||||||
|
label=Long.toString(last.getValue().toSignedValue());
|
||||||
|
break;
|
||||||
|
case UNSIGNED:
|
||||||
|
label=Long.toString(last.getValue().toUnsignedValue());
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
label="h'"+last.getValue().toHexString();
|
||||||
|
}
|
||||||
Point bb = getBoxWidth(gc, label);
|
Point bb = getBoxWidth(gc, label);
|
||||||
if (xBegin < area.x) {
|
if (xBegin < area.x) {
|
||||||
xBegin = area.x;
|
xBegin = area.x;
|
||||||
|
@ -211,16 +239,71 @@ public class SignalPainter extends TrackPainter {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private class MultiBitStencilAnalog implements SignalStencil {
|
||||||
|
|
||||||
|
final boolean continous;
|
||||||
|
private long minVal;
|
||||||
|
private long range;
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
public MultiBitStencilAnalog(NavigableMap<Long, ? extends ISignalChange> entries, ISignalChange left, boolean continous, boolean signed) {
|
||||||
|
this.continous=continous;
|
||||||
|
Collection<ISignalChangeBitVector> values = ((NavigableMap<Long, ISignalChangeBitVector>) entries).values();
|
||||||
|
minVal=((ISignalChangeBitVector) left).getValue().toUnsignedValue();
|
||||||
|
range=2;
|
||||||
|
if(!values.isEmpty()) {
|
||||||
|
long maxVal=minVal;
|
||||||
|
for (ISignalChange e : entries.values()) {
|
||||||
|
long v = ((ISignalChangeBitVector)e).getValue().toUnsignedValue();
|
||||||
|
maxVal=Math.max(maxVal, v);
|
||||||
|
minVal=Math.min(minVal, v);
|
||||||
|
}
|
||||||
|
if(maxVal==minVal) {
|
||||||
|
maxVal--;
|
||||||
|
minVal++;
|
||||||
|
}
|
||||||
|
range = maxVal-minVal;
|
||||||
|
} else
|
||||||
|
minVal--;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void draw(GC gc, Rectangle area, ISignalChange left, ISignalChange right, int xBegin, int xEnd, boolean multiple) {
|
||||||
|
long leftVal = ((ISignalChangeBitVector) left).getValue().toUnsignedValue();
|
||||||
|
long rightVal= ((ISignalChangeBitVector) right).getValue().toUnsignedValue();
|
||||||
|
gc.setForeground(waveCanvas.colors[WaveformColors.SIGNAL_REAL.ordinal()]);
|
||||||
|
int yOffsetLeft = (int) ((leftVal-minVal) / range * (yOffsetB-yOffsetT));
|
||||||
|
int yOffsetRight = (int) ((rightVal-minVal) / range * (yOffsetB-yOffsetT));
|
||||||
|
if(continous) {
|
||||||
|
if (xEnd > maxX) {
|
||||||
|
gc.drawLine(xBegin, yOffsetB-yOffsetLeft, maxX, yOffsetB-yOffsetRight);
|
||||||
|
} else {
|
||||||
|
gc.drawLine(xBegin, yOffsetB-yOffsetLeft, xEnd, yOffsetB-yOffsetRight);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (xEnd > maxX) {
|
||||||
|
gc.drawLine(xBegin, yOffsetB-yOffsetLeft, maxX, yOffsetB-yOffsetLeft);
|
||||||
|
} else {
|
||||||
|
gc.drawLine(xBegin, yOffsetB-yOffsetLeft, xEnd, yOffsetB-yOffsetLeft);
|
||||||
|
if(yOffsetRight!=yOffsetLeft) {
|
||||||
|
gc.drawLine(xEnd, yOffsetB-yOffsetLeft, xEnd, yOffsetB-yOffsetRight);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private class SingleBitStencil implements SignalStencil {
|
private class SingleBitStencil implements SignalStencil {
|
||||||
public void draw(GC gc, Rectangle area, ISignalChange left, ISignalChange right, int xBegin, int xEnd, boolean multiple) {
|
public void draw(GC gc, Rectangle area, ISignalChange left, ISignalChange right, int xBegin, int xEnd, boolean multiple) {
|
||||||
if (multiple) {
|
if (multiple) {
|
||||||
gc.setForeground(waveCanvas.colors[WaveformColors.SIGNALU.ordinal()]);
|
gc.setForeground(waveCanvas.colors[WaveformColors.SIGNALU.ordinal()]);
|
||||||
gc.drawLine(xBegin, yOffsetT, xBegin, yOffsetB);
|
gc.drawLine(xBegin, yOffsetT, xBegin, yOffsetB);
|
||||||
|
if(xEnd>xBegin)
|
||||||
gc.drawLine(xEnd, yOffsetT, xEnd, yOffsetB);
|
gc.drawLine(xEnd, yOffsetT, xEnd, yOffsetB);
|
||||||
} else {
|
} else {
|
||||||
Color color = waveCanvas.colors[WaveformColors.SIGNALX.ordinal()];
|
Color color = waveCanvas.colors[WaveformColors.SIGNALX.ordinal()];
|
||||||
int yOffset = yOffsetM;
|
int yOffset = yOffsetM;
|
||||||
switch (((ISignalChangeSingle) left).getValue()) {
|
switch (((ISignalChangeBit) left).getValue()) {
|
||||||
case '1':
|
case '1':
|
||||||
color = waveCanvas.colors[WaveformColors.SIGNAL1.ordinal()];
|
color = waveCanvas.colors[WaveformColors.SIGNAL1.ordinal()];
|
||||||
yOffset = yOffsetT;
|
yOffset = yOffsetT;
|
||||||
|
@ -240,7 +323,7 @@ public class SignalPainter extends TrackPainter {
|
||||||
} else {
|
} else {
|
||||||
gc.drawLine(xBegin, yOffset, xEnd, yOffset);
|
gc.drawLine(xBegin, yOffset, xEnd, yOffset);
|
||||||
int yNext = yOffsetM;
|
int yNext = yOffsetM;
|
||||||
switch (((ISignalChangeSingle) right).getValue()) {
|
switch (((ISignalChangeBit) right).getValue()) {
|
||||||
case '1':
|
case '1':
|
||||||
yNext = yOffsetT;
|
yNext = yOffsetT;
|
||||||
break;
|
break;
|
||||||
|
@ -254,11 +337,87 @@ public class SignalPainter extends TrackPainter {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public ISignal<? extends ISignalChange> getSignal() {
|
private class RealStencil implements SignalStencil {
|
||||||
return signal;
|
|
||||||
|
double minVal, range;
|
||||||
|
|
||||||
|
final double scaleFactor = 1.05;
|
||||||
|
|
||||||
|
boolean continous=true;
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
public RealStencil(NavigableMap<Long, ? extends ISignalChange> entries, ISignalChange left, boolean continous) {
|
||||||
|
this.continous=continous;
|
||||||
|
Collection<ISignalChangeReal> values = ((NavigableMap<Long, ISignalChangeReal>) entries).values();
|
||||||
|
minVal=((ISignalChangeReal) left).getValue();
|
||||||
|
range=2.0;
|
||||||
|
if(!values.isEmpty()) {
|
||||||
|
double maxVal=minVal;
|
||||||
|
for (ISignalChange e : entries.values()) {
|
||||||
|
double v = ((ISignalChangeReal)e).getValue();
|
||||||
|
if(Double.isNaN(maxVal))
|
||||||
|
maxVal=v;
|
||||||
|
else if(!Double.isNaN(v))
|
||||||
|
maxVal=Math.max(maxVal, v);
|
||||||
|
if(Double.isNaN(minVal))
|
||||||
|
minVal=v;
|
||||||
|
else if(!Double.isNaN(v))
|
||||||
|
minVal=Math.min(minVal, v);
|
||||||
|
}
|
||||||
|
if(Double.isNaN(maxVal)){
|
||||||
|
maxVal=minVal=0.0;
|
||||||
|
}
|
||||||
|
range = (maxVal-minVal)*scaleFactor;
|
||||||
|
double avg = (maxVal+minVal)/2.0;
|
||||||
|
minVal=avg-(avg-minVal)*scaleFactor;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void draw(GC gc, Rectangle area, ISignalChange left, ISignalChange right, int xBegin, int xEnd, boolean multiple) {
|
||||||
|
double leftVal = ((ISignalChangeReal) left).getValue();
|
||||||
|
double rightVal= ((ISignalChangeReal) right).getValue();
|
||||||
|
if(Double.isNaN(leftVal)) {
|
||||||
|
Color color = waveCanvas.colors[WaveformColors.SIGNAL_NAN.ordinal()];
|
||||||
|
int width = xEnd - xBegin;
|
||||||
|
if (width > 1) {
|
||||||
|
int[] points = {
|
||||||
|
xBegin, yOffsetT,
|
||||||
|
xEnd, yOffsetT,
|
||||||
|
xEnd, yOffsetB,
|
||||||
|
xBegin, yOffsetB
|
||||||
|
};
|
||||||
|
gc.setForeground(color);
|
||||||
|
gc.drawPolygon(points);
|
||||||
|
gc.setBackground(color);
|
||||||
|
gc.fillPolygon(points);
|
||||||
|
} else {
|
||||||
|
gc.setForeground(color);
|
||||||
|
gc.drawLine(xEnd, yOffsetT, xEnd, yOffsetB);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
gc.setForeground(waveCanvas.colors[WaveformColors.SIGNAL_REAL.ordinal()]);
|
||||||
|
int yOffsetLeft = (int) ((leftVal-minVal) / range * (yOffsetB-yOffsetT));
|
||||||
|
int yOffsetRight = Double.isNaN(rightVal)?yOffsetLeft:(int) ((rightVal-minVal) / range * (yOffsetB-yOffsetT));
|
||||||
|
if(continous) {
|
||||||
|
if (xEnd > maxX) {
|
||||||
|
gc.drawLine(xBegin, yOffsetB-yOffsetLeft, maxX, yOffsetB-yOffsetRight);
|
||||||
|
} else {
|
||||||
|
gc.drawLine(xBegin, yOffsetB-yOffsetLeft, xEnd, yOffsetB-yOffsetRight);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (xEnd > maxX) {
|
||||||
|
gc.drawLine(xBegin, yOffsetB-yOffsetLeft, maxX, yOffsetB-yOffsetLeft);
|
||||||
|
} else {
|
||||||
|
gc.drawLine(xBegin, yOffsetB-yOffsetLeft, xEnd, yOffsetB-yOffsetLeft);
|
||||||
|
if(yOffsetRight!=yOffsetLeft) {
|
||||||
|
gc.drawLine(xEnd, yOffsetB-yOffsetLeft, xEnd, yOffsetB-yOffsetRight);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -110,6 +110,17 @@ public class StreamPainter extends TrackPainter{
|
||||||
gc.fillRectangle(bb);
|
gc.fillRectangle(bb);
|
||||||
gc.drawRectangle(bb);
|
gc.drawRectangle(bb);
|
||||||
} else {
|
} else {
|
||||||
|
// adjusting drawing width to circumvent issues in canvas algos
|
||||||
|
if(bb.x < area.x) {
|
||||||
|
bb.width = bb.width-(area.x-bb.x)+5;
|
||||||
|
bb.x=area.x-5;
|
||||||
|
}
|
||||||
|
int bb_x2 = bb.x+bb.width;
|
||||||
|
int area_x2 = area.x+area.width;
|
||||||
|
if(bb_x2>area_x2){
|
||||||
|
bb_x2=area_x2+5;
|
||||||
|
bb.width= bb_x2-bb.x;
|
||||||
|
}
|
||||||
gc.fillRoundRectangle(bb.x, bb.y, bb.width, bb.height, 5, 5);
|
gc.fillRoundRectangle(bb.x, bb.y, bb.width, bb.height, 5, 5);
|
||||||
gc.drawRoundRectangle(bb.x, bb.y, bb.width, bb.height, 5, 5);
|
gc.drawRoundRectangle(bb.x, bb.y, bb.width, bb.height, 5, 5);
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,7 +41,9 @@ import com.minres.scviewer.database.ITx;
|
||||||
import com.minres.scviewer.database.IWaveform;
|
import com.minres.scviewer.database.IWaveform;
|
||||||
import com.minres.scviewer.database.IWaveformEvent;
|
import com.minres.scviewer.database.IWaveformEvent;
|
||||||
import com.minres.scviewer.database.RelationType;
|
import com.minres.scviewer.database.RelationType;
|
||||||
|
import com.minres.scviewer.database.swt.Constants;
|
||||||
import com.minres.scviewer.database.ui.IWaveformViewer;
|
import com.minres.scviewer.database.ui.IWaveformViewer;
|
||||||
|
import com.minres.scviewer.database.ui.TrackEntry;
|
||||||
import com.minres.scviewer.database.ui.WaveformColors;
|
import com.minres.scviewer.database.ui.WaveformColors;
|
||||||
|
|
||||||
public class WaveformCanvas extends Canvas {
|
public class WaveformCanvas extends Canvas {
|
||||||
|
@ -56,10 +58,6 @@ public class WaveformCanvas extends Canvas {
|
||||||
|
|
||||||
private int level = 12;
|
private int level = 12;
|
||||||
|
|
||||||
public final static String[] unitString={"fs", "ps", "ns", "µs", "ms"};//, "s"};
|
|
||||||
|
|
||||||
public final static int[] unitMultiplier={1, 3, 10, 30, 100, 300};
|
|
||||||
|
|
||||||
private long maxTime;
|
private long maxTime;
|
||||||
|
|
||||||
protected Point origin; /* original size */
|
protected Point origin; /* original size */
|
||||||
|
@ -126,6 +124,31 @@ public class WaveformCanvas extends Canvas {
|
||||||
painterList.add(marker);
|
painterList.add(marker);
|
||||||
cursorPainters.add(marker);
|
cursorPainters.add(marker);
|
||||||
wave2painterMap=new HashMap<>();
|
wave2painterMap=new HashMap<>();
|
||||||
|
// fall back initialization
|
||||||
|
colors[WaveformColors.LINE.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_RED);
|
||||||
|
colors[WaveformColors.LINE_HIGHLITE.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_CYAN);
|
||||||
|
colors[WaveformColors.TRACK_BG_EVEN.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_BLACK);
|
||||||
|
colors[WaveformColors.TRACK_BG_ODD.ordinal()] = SWTResourceManager.getColor(40, 40, 40);
|
||||||
|
colors[WaveformColors.TRACK_BG_HIGHLITE.ordinal()] = SWTResourceManager.getColor(40, 40, 80);
|
||||||
|
colors[WaveformColors.TX_BG.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_GREEN);
|
||||||
|
colors[WaveformColors.TX_BG_HIGHLITE.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_DARK_GREEN);
|
||||||
|
colors[WaveformColors.TX_BORDER.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_RED);
|
||||||
|
colors[WaveformColors.SIGNAL0.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_GREEN);
|
||||||
|
colors[WaveformColors.SIGNAL1.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_GREEN);
|
||||||
|
colors[WaveformColors.SIGNALZ.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_DARK_YELLOW);
|
||||||
|
colors[WaveformColors.SIGNALX.ordinal()] = SWTResourceManager.getColor(255, 51, 51);
|
||||||
|
colors[WaveformColors.SIGNALU.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_YELLOW);
|
||||||
|
colors[WaveformColors.SIGNAL_TEXT.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_WHITE);
|
||||||
|
colors[WaveformColors.SIGNAL_REAL.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_YELLOW);
|
||||||
|
colors[WaveformColors.SIGNAL_NAN.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_RED);
|
||||||
|
colors[WaveformColors.CURSOR.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_RED);
|
||||||
|
colors[WaveformColors.CURSOR_DRAG.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_GRAY);
|
||||||
|
colors[WaveformColors.CURSOR_TEXT.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_WHITE);
|
||||||
|
colors[WaveformColors.MARKER.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_DARK_GRAY);
|
||||||
|
colors[WaveformColors.MARKER_TEXT.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_WHITE);
|
||||||
|
colors[WaveformColors.REL_ARROW.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_MAGENTA);
|
||||||
|
colors[WaveformColors.REL_ARROW_HIGHLITE.ordinal()] = SWTResourceManager.getColor(255, 128, 255);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addCursoPainter(CursorPainter cursorPainter){
|
public void addCursoPainter(CursorPainter cursorPainter){
|
||||||
|
@ -137,33 +160,10 @@ public class WaveformCanvas extends Canvas {
|
||||||
Display d = getDisplay();
|
Display d = getDisplay();
|
||||||
if (colourMap != null) {
|
if (colourMap != null) {
|
||||||
for (WaveformColors c : WaveformColors.values()) {
|
for (WaveformColors c : WaveformColors.values()) {
|
||||||
if (colourMap.containsKey(c)) {
|
if (colourMap.containsKey(c))
|
||||||
colors[c.ordinal()] = new Color(d, colourMap.get(c));
|
colors[c.ordinal()] = new Color(d, colourMap.get(c));
|
||||||
}
|
}
|
||||||
}
|
|
||||||
redraw();
|
redraw();
|
||||||
} else {
|
|
||||||
colors[WaveformColors.LINE.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_RED);
|
|
||||||
colors[WaveformColors.LINE_HIGHLITE.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_CYAN);
|
|
||||||
colors[WaveformColors.TRACK_BG_EVEN.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_BLACK);
|
|
||||||
colors[WaveformColors.TRACK_BG_ODD.ordinal()] = SWTResourceManager.getColor(40, 40, 40);
|
|
||||||
colors[WaveformColors.TRACK_BG_HIGHLITE.ordinal()] = SWTResourceManager.getColor(40, 40, 80);
|
|
||||||
colors[WaveformColors.TX_BG.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_GREEN);
|
|
||||||
colors[WaveformColors.TX_BG_HIGHLITE.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_DARK_GREEN);
|
|
||||||
colors[WaveformColors.TX_BORDER.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_RED);
|
|
||||||
colors[WaveformColors.SIGNAL0.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_DARK_GREEN);
|
|
||||||
colors[WaveformColors.SIGNAL1.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_DARK_GREEN);
|
|
||||||
colors[WaveformColors.SIGNALZ.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_DARK_YELLOW);
|
|
||||||
colors[WaveformColors.SIGNALX.ordinal()] = SWTResourceManager.getColor(255, 51, 51);
|
|
||||||
colors[WaveformColors.SIGNALU.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_YELLOW);
|
|
||||||
colors[WaveformColors.SIGNAL_TEXT.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_WHITE);
|
|
||||||
colors[WaveformColors.CURSOR.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_RED);
|
|
||||||
colors[WaveformColors.CURSOR_DRAG.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_GRAY);
|
|
||||||
colors[WaveformColors.CURSOR_TEXT.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_WHITE);
|
|
||||||
colors[WaveformColors.MARKER.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_DARK_GRAY);
|
|
||||||
colors[WaveformColors.MARKER_TEXT.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_WHITE);
|
|
||||||
colors[WaveformColors.REL_ARROW.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_MAGENTA);
|
|
||||||
colors[WaveformColors.REL_ARROW_HIGHLITE.ordinal()] = SWTResourceManager.getColor(255, 128, 255);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -179,6 +179,9 @@ public class WaveformCanvas extends Canvas {
|
||||||
return origin;
|
return origin;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getWidth() {
|
||||||
|
return getClientArea().width;
|
||||||
|
}
|
||||||
public void setOrigin(Point origin) {
|
public void setOrigin(Point origin) {
|
||||||
setOrigin(origin.x, origin.y);
|
setOrigin(origin.x, origin.y);
|
||||||
}
|
}
|
||||||
|
@ -219,12 +222,12 @@ public class WaveformCanvas extends Canvas {
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getMaxZoomLevel(){
|
public int getMaxZoomLevel(){
|
||||||
return unitMultiplier.length*unitString.length-1;
|
return Constants.unitMultiplier.length*Constants.unitString.length-1;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setZoomLevel(int level) {
|
public void setZoomLevel(int level) {
|
||||||
long oldScaleFactor=scaleFactor;
|
long oldScaleFactor=scaleFactor;
|
||||||
if(level<unitMultiplier.length*unitString.length){
|
if(level<Constants.unitMultiplier.length*Constants.unitString.length){
|
||||||
this.level = level;
|
this.level = level;
|
||||||
this.scaleFactor = (long) Math.pow(10, level/2);
|
this.scaleFactor = (long) Math.pow(10, level/2);
|
||||||
if(level%2==1) this.scaleFactor*=3;
|
if(level%2==1) this.scaleFactor*=3;
|
||||||
|
@ -256,17 +259,17 @@ public class WaveformCanvas extends Canvas {
|
||||||
}
|
}
|
||||||
|
|
||||||
public long getScaleFactorPow10() {
|
public long getScaleFactorPow10() {
|
||||||
int scale = level/unitMultiplier.length;
|
int scale = level/Constants.unitMultiplier.length;
|
||||||
double res = Math.pow(1000, scale);
|
double res = Math.pow(1000, scale);
|
||||||
return (long) res;
|
return (long) res;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getUnitStr(){
|
public String getUnitStr(){
|
||||||
return unitString[level/unitMultiplier.length];
|
return Constants.unitString[level/Constants.unitMultiplier.length];
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getUnitMultiplier(){
|
public int getUnitMultiplier(){
|
||||||
return unitMultiplier[level%unitMultiplier.length];
|
return Constants.unitMultiplier[level%Constants.unitMultiplier.length];
|
||||||
}
|
}
|
||||||
|
|
||||||
public long getTimeForOffset(int xOffset){
|
public long getTimeForOffset(int xOffset){
|
||||||
|
@ -290,9 +293,13 @@ public class WaveformCanvas extends Canvas {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addWaveformPainter(IWaveformPainter painter) {
|
public void addWaveformPainter(IWaveformPainter painter) {
|
||||||
|
addWaveformPainter(painter, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
void addWaveformPainter(IWaveformPainter painter, boolean update) {
|
||||||
trackAreaPainter.addTrackPainter(painter);
|
trackAreaPainter.addTrackPainter(painter);
|
||||||
wave2painterMap.put(painter.getTrackEntry().waveform, painter);
|
wave2painterMap.put(painter.getTrackEntry().waveform, painter);
|
||||||
syncScrollBars();
|
if(update) syncScrollBars();
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<CursorPainter> getCursorPainters() {
|
public List<CursorPainter> getCursorPainters() {
|
||||||
|
@ -309,7 +316,7 @@ public class WaveformCanvas extends Canvas {
|
||||||
super.dispose();
|
super.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Initalize the scrollbar and register listeners. */
|
/* Initialize the scrollbar and register listeners. */
|
||||||
private void initScrollBars() {
|
private void initScrollBars() {
|
||||||
ScrollBar horizontal = getHorizontalBar();
|
ScrollBar horizontal = getHorizontalBar();
|
||||||
horizontal.setEnabled(false);
|
horizontal.setEnabled(false);
|
||||||
|
@ -467,6 +474,27 @@ public class WaveformCanvas extends Canvas {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void reveal(IWaveform<? extends IWaveformEvent> waveform) {
|
||||||
|
for (IWaveformPainter painter : wave2painterMap.values()) {
|
||||||
|
TrackEntry te = painter.getTrackEntry();
|
||||||
|
if(te.waveform == waveform) {
|
||||||
|
Point size = getSize();
|
||||||
|
//size.x -= getVerticalBar().getSize().x + 2;
|
||||||
|
size.y -=+rulerHeight;
|
||||||
|
ScrollBar sb = getHorizontalBar();
|
||||||
|
if((sb.getStyle()&SWT.SCROLLBAR_OVERLAY)!=0 && sb.isVisible()) // TODO: check on other platform than MacOSX
|
||||||
|
size.y-= getHorizontalBar().getSize().y;
|
||||||
|
int top = te.vOffset;
|
||||||
|
int bottom = top + trackHeight;
|
||||||
|
if (top < -origin.y) {
|
||||||
|
setOrigin(origin.x, -(top-trackHeight));
|
||||||
|
} else if (bottom > (size.y - origin.y)) {
|
||||||
|
setOrigin(origin.x, size.y - bottom);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void reveal(long time) {
|
public void reveal(long time) {
|
||||||
int scaledTime = (int) (time / scaleFactor);
|
int scaledTime = (int) (time / scaleFactor);
|
||||||
Point size = getSize();
|
Point size = getSize();
|
||||||
|
@ -511,4 +539,11 @@ public class WaveformCanvas extends Canvas {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
long getMaxVisibleTime() {
|
||||||
|
return (getClientArea().width+origin.x)*scaleFactor;
|
||||||
|
}
|
||||||
|
|
||||||
|
long getOriginTime() {
|
||||||
|
return origin.x * scaleFactor;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -66,13 +66,15 @@ import org.eclipse.swt.widgets.Label;
|
||||||
import org.eclipse.swt.widgets.Listener;
|
import org.eclipse.swt.widgets.Listener;
|
||||||
import org.eclipse.swt.widgets.Menu;
|
import org.eclipse.swt.widgets.Menu;
|
||||||
import org.eclipse.swt.widgets.ScrollBar;
|
import org.eclipse.swt.widgets.ScrollBar;
|
||||||
|
import org.eclipse.swt.widgets.Widget;
|
||||||
import org.eclipse.wb.swt.SWTResourceManager;
|
import org.eclipse.wb.swt.SWTResourceManager;
|
||||||
|
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
import com.minres.scviewer.database.ISignal;
|
import com.minres.scviewer.database.ISignal;
|
||||||
import com.minres.scviewer.database.ISignalChange;
|
import com.minres.scviewer.database.ISignalChange;
|
||||||
import com.minres.scviewer.database.ISignalChangeMulti;
|
import com.minres.scviewer.database.ISignalChangeBitVector;
|
||||||
import com.minres.scviewer.database.ISignalChangeSingle;
|
import com.minres.scviewer.database.ISignalChangeReal;
|
||||||
|
import com.minres.scviewer.database.ISignalChangeBit;
|
||||||
import com.minres.scviewer.database.ITx;
|
import com.minres.scviewer.database.ITx;
|
||||||
import com.minres.scviewer.database.ITxEvent;
|
import com.minres.scviewer.database.ITxEvent;
|
||||||
import com.minres.scviewer.database.ITxRelation;
|
import com.minres.scviewer.database.ITxRelation;
|
||||||
|
@ -80,6 +82,7 @@ import com.minres.scviewer.database.ITxStream;
|
||||||
import com.minres.scviewer.database.IWaveform;
|
import com.minres.scviewer.database.IWaveform;
|
||||||
import com.minres.scviewer.database.IWaveformEvent;
|
import com.minres.scviewer.database.IWaveformEvent;
|
||||||
import com.minres.scviewer.database.RelationType;
|
import com.minres.scviewer.database.RelationType;
|
||||||
|
import com.minres.scviewer.database.swt.Constants;
|
||||||
import com.minres.scviewer.database.ui.GotoDirection;
|
import com.minres.scviewer.database.ui.GotoDirection;
|
||||||
import com.minres.scviewer.database.ui.ICursor;
|
import com.minres.scviewer.database.ui.ICursor;
|
||||||
import com.minres.scviewer.database.ui.IWaveformViewer;
|
import com.minres.scviewer.database.ui.IWaveformViewer;
|
||||||
|
@ -88,7 +91,7 @@ import com.minres.scviewer.database.ui.WaveformColors;
|
||||||
|
|
||||||
public class WaveformViewer implements IWaveformViewer {
|
public class WaveformViewer implements IWaveformViewer {
|
||||||
|
|
||||||
private ListenerList selectionChangedListeners = new ListenerList();
|
private ListenerList<ISelectionChangedListener> selectionChangedListeners = new ListenerList<ISelectionChangedListener>();
|
||||||
|
|
||||||
private PropertyChangeSupport pcs;
|
private PropertyChangeSupport pcs;
|
||||||
|
|
||||||
|
@ -102,11 +105,13 @@ public class WaveformViewer implements IWaveformViewer {
|
||||||
|
|
||||||
private Control namePaneHeader;
|
private Control namePaneHeader;
|
||||||
|
|
||||||
private Canvas nameList;
|
final private Canvas nameList;
|
||||||
|
|
||||||
private Canvas valueList;
|
final private Canvas valueList;
|
||||||
|
|
||||||
WaveformCanvas waveformCanvas;
|
final WaveformCanvas waveformCanvas;
|
||||||
|
|
||||||
|
private boolean revealSelected=false;
|
||||||
|
|
||||||
private Composite top;
|
private Composite top;
|
||||||
|
|
||||||
|
@ -118,19 +123,16 @@ public class WaveformViewer implements IWaveformViewer {
|
||||||
|
|
||||||
private TreeMap<Integer, TrackEntry> trackVerticalOffset;
|
private TreeMap<Integer, TrackEntry> trackVerticalOffset;
|
||||||
|
|
||||||
private HashMap<IWaveform<? extends IWaveformEvent>, String> actualValues;
|
|
||||||
|
|
||||||
private Font nameFont, nameFontB;
|
private Font nameFont, nameFontB;
|
||||||
|
|
||||||
protected MouseListener nameValueMouseListener = new MouseAdapter() {
|
protected MouseListener nameValueMouseListener = new MouseAdapter() {
|
||||||
@Override
|
@Override
|
||||||
public void mouseDown(MouseEvent e) {
|
public void mouseDown(MouseEvent e) {
|
||||||
if ((e.button == 1 || e.button == 3)) {
|
if (e.button == 1) {
|
||||||
Entry<Integer, TrackEntry> entry = trackVerticalOffset.floorEntry(e.y);
|
Entry<Integer, TrackEntry> entry = trackVerticalOffset.floorEntry(e.y);
|
||||||
if (entry != null)
|
if (entry != null)
|
||||||
setSelection(new StructuredSelection(entry.getValue()));
|
setSelection(new StructuredSelection(entry.getValue()));
|
||||||
}
|
} else if (e.button == 3) {
|
||||||
if (e.button == 3) {
|
|
||||||
Menu topMenu= top.getMenu();
|
Menu topMenu= top.getMenu();
|
||||||
if(topMenu!=null) topMenu.setVisible(true);
|
if(topMenu!=null) topMenu.setVisible(true);
|
||||||
}
|
}
|
||||||
|
@ -144,12 +146,10 @@ public class WaveformViewer implements IWaveformViewer {
|
||||||
@Override
|
@Override
|
||||||
public void mouseDown(MouseEvent e) {
|
public void mouseDown(MouseEvent e) {
|
||||||
start=new Point(e.x, e.y);
|
start=new Point(e.x, e.y);
|
||||||
|
if((e.stateMask&SWT.MODIFIER_MASK)!=0) return; //don't react on modifier
|
||||||
if (e.button == 1) {
|
if (e.button == 1) {
|
||||||
initialSelected = waveformCanvas.getClicked(start);
|
initialSelected = waveformCanvas.getClicked(start);
|
||||||
} else if (e.button == 3) {
|
} else if (e.button == 3) {
|
||||||
List<Object> hitted = waveformCanvas.getClicked(start);
|
|
||||||
if(hitted!=null && hitted.size()>0)
|
|
||||||
setSelection(new StructuredSelection(hitted));
|
|
||||||
Menu topMenu= top.getMenu();
|
Menu topMenu= top.getMenu();
|
||||||
if(topMenu!=null) topMenu.setVisible(true);
|
if(topMenu!=null) topMenu.setVisible(true);
|
||||||
}
|
}
|
||||||
|
@ -157,29 +157,18 @@ public class WaveformViewer implements IWaveformViewer {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void mouseUp(MouseEvent e) {
|
public void mouseUp(MouseEvent e) {
|
||||||
if (e.button == 1) {
|
if((e.stateMask&SWT.MODIFIER_MASK&~SWT.SHIFT)!=0) return; //don't react on modifier
|
||||||
|
if (e.button == 1 && ((e.stateMask&SWT.SHIFT)==0)) {
|
||||||
if(Math.abs(e.x-start.x)<3 && Math.abs(e.y-start.y)<3){
|
if(Math.abs(e.x-start.x)<3 && Math.abs(e.y-start.y)<3){
|
||||||
// first set time
|
// first set cursor time
|
||||||
setCursorTime(snapOffsetToEvent(e));
|
setCursorTime(snapOffsetToEvent(e));
|
||||||
// then set selection and reveal
|
// then set selection and reveal
|
||||||
setSelection(new StructuredSelection(initialSelected));
|
setSelection(new StructuredSelection(initialSelected));
|
||||||
e.widget.getDisplay().asyncExec(new Runnable() {
|
asyncUpdate(e.widget);
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
waveformCanvas.redraw();
|
|
||||||
updateValueList();
|
|
||||||
}
|
}
|
||||||
});
|
}else if (e.button == 2 ||(e.button==1 && (e.stateMask&SWT.SHIFT)!=0)) {
|
||||||
}
|
|
||||||
}else if (e.button == 2) {
|
|
||||||
setMarkerTime(snapOffsetToEvent(e), selectedMarker);
|
setMarkerTime(snapOffsetToEvent(e), selectedMarker);
|
||||||
e.widget.getDisplay().asyncExec(new Runnable() {
|
asyncUpdate(e.widget);
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
waveformCanvas.redraw();
|
|
||||||
updateValueList();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -225,7 +214,6 @@ public class WaveformViewer implements IWaveformViewer {
|
||||||
|
|
||||||
trackVerticalOffset = new TreeMap<Integer, TrackEntry>();
|
trackVerticalOffset = new TreeMap<Integer, TrackEntry>();
|
||||||
trackVerticalHeight=0;
|
trackVerticalHeight=0;
|
||||||
actualValues = new HashMap<IWaveform<? extends IWaveformEvent>, String>();
|
|
||||||
|
|
||||||
nameFont = parent.getDisplay().getSystemFont();
|
nameFont = parent.getDisplay().getSystemFont();
|
||||||
nameFontB = SWTResourceManager.getBoldFont(nameFont);
|
nameFontB = SWTResourceManager.getBoldFont(nameFont);
|
||||||
|
@ -273,10 +261,12 @@ public class WaveformViewer implements IWaveformViewer {
|
||||||
nameList.addListener(SWT.Paint, new Listener() {
|
nameList.addListener(SWT.Paint, new Listener() {
|
||||||
@Override
|
@Override
|
||||||
public void handleEvent(Event event) {
|
public void handleEvent(Event event) {
|
||||||
|
if(!trackVerticalOffset.isEmpty()) {
|
||||||
GC gc = event.gc;
|
GC gc = event.gc;
|
||||||
Rectangle rect = ((Canvas) event.widget).getClientArea();
|
Rectangle rect = ((Canvas) event.widget).getClientArea();
|
||||||
paintNames(gc, rect);
|
paintNames(gc, rect);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
nameList.addMouseListener(nameValueMouseListener);
|
nameList.addMouseListener(nameValueMouseListener);
|
||||||
nameListScrolled.setContent(nameList);
|
nameListScrolled.setContent(nameList);
|
||||||
|
@ -305,10 +295,12 @@ public class WaveformViewer implements IWaveformViewer {
|
||||||
valueList.addListener(SWT.Paint, new Listener() {
|
valueList.addListener(SWT.Paint, new Listener() {
|
||||||
@Override
|
@Override
|
||||||
public void handleEvent(Event event) {
|
public void handleEvent(Event event) {
|
||||||
|
if(!trackVerticalOffset.isEmpty()) {
|
||||||
GC gc = event.gc;
|
GC gc = event.gc;
|
||||||
Rectangle rect = ((Canvas) event.widget).getClientArea();
|
Rectangle rect = ((Canvas) event.widget).getClientArea();
|
||||||
paintValues(gc, rect);
|
paintValues(gc, rect);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
valueList.addMouseListener(nameValueMouseListener);
|
valueList.addMouseListener(nameValueMouseListener);
|
||||||
valueListScrolled.setContent(valueList);
|
valueListScrolled.setContent(valueList);
|
||||||
|
@ -377,22 +369,33 @@ public class WaveformViewer implements IWaveformViewer {
|
||||||
@Override
|
@Override
|
||||||
public void propertyChange(PropertyChangeEvent pce) {
|
public void propertyChange(PropertyChangeEvent pce) {
|
||||||
if ("size".equals(pce.getPropertyName()) || "content".equals(pce.getPropertyName())) {
|
if ("size".equals(pce.getPropertyName()) || "content".equals(pce.getPropertyName())) {
|
||||||
|
if(revealSelected) {
|
||||||
waveformCanvas.getDisplay().asyncExec(new Runnable() {
|
waveformCanvas.getDisplay().asyncExec(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
updateTracklist();
|
update();
|
||||||
|
waveformCanvas.reveal(currentWaveformSelection.waveform);
|
||||||
|
valueList.redraw();
|
||||||
|
nameList.redraw();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
revealSelected=false;
|
||||||
|
} else
|
||||||
|
waveformCanvas.getDisplay().asyncExec(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
update();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void updateTracklist() {
|
public void update() {
|
||||||
trackVerticalHeight = 0;
|
trackVerticalHeight = 0;
|
||||||
int nameMaxWidth = 0;
|
int nameMaxWidth = 0;
|
||||||
int previousHeight = trackVerticalOffset.size() == 0 ? 0 : trackVerticalOffset.lastKey();
|
int previousHeight = trackVerticalOffset.size() == 0 ? 0 : trackVerticalOffset.lastKey();
|
||||||
IWaveformPainter painter = null;
|
IWaveformPainter painter = null;
|
||||||
trackVerticalOffset.clear();
|
trackVerticalOffset.clear();
|
||||||
actualValues.clear();
|
|
||||||
waveformCanvas.clearAllWaveformPainter();
|
waveformCanvas.clearAllWaveformPainter();
|
||||||
boolean even = true;
|
boolean even = true;
|
||||||
boolean clearSelection = true;
|
boolean clearSelection = true;
|
||||||
|
@ -403,20 +406,21 @@ public class WaveformViewer implements IWaveformViewer {
|
||||||
streamEntry.vOffset=trackVerticalHeight;
|
streamEntry.vOffset=trackVerticalHeight;
|
||||||
clearSelection &= currentWaveformSelection!=null && (streamEntry.waveform != currentWaveformSelection.waveform);
|
clearSelection &= currentWaveformSelection!=null && (streamEntry.waveform != currentWaveformSelection.waveform);
|
||||||
if (streamEntry.isStream()) {
|
if (streamEntry.isStream()) {
|
||||||
|
streamEntry.currentValue="";
|
||||||
streamEntry.height *= streamEntry.getStream().getMaxConcurrency();
|
streamEntry.height *= streamEntry.getStream().getMaxConcurrency();
|
||||||
painter = new StreamPainter(waveformCanvas, even, streamEntry);
|
painter = new StreamPainter(waveformCanvas, even, streamEntry);
|
||||||
actualValues.put(streamEntry.waveform, "");
|
|
||||||
} else if (streamEntry.isSignal()) {
|
} else if (streamEntry.isSignal()) {
|
||||||
|
streamEntry.currentValue="---";
|
||||||
painter = new SignalPainter(waveformCanvas, even, streamEntry);
|
painter = new SignalPainter(waveformCanvas, even, streamEntry);
|
||||||
actualValues.put(streamEntry.waveform, "---");
|
|
||||||
}
|
}
|
||||||
waveformCanvas.addWaveformPainter(painter);
|
waveformCanvas.addWaveformPainter(painter, false);
|
||||||
trackVerticalOffset.put(trackVerticalHeight, streamEntry);
|
trackVerticalOffset.put(trackVerticalHeight, streamEntry);
|
||||||
tl.setText(streamEntry.waveform.getFullName());
|
tl.setText(streamEntry.waveform.getFullName());
|
||||||
nameMaxWidth = Math.max(nameMaxWidth, tl.getBounds().width);
|
nameMaxWidth = Math.max(nameMaxWidth, tl.getBounds().width);
|
||||||
trackVerticalHeight += streamEntry.height;
|
trackVerticalHeight += streamEntry.height;
|
||||||
even = !even;
|
even = !even;
|
||||||
}
|
}
|
||||||
|
waveformCanvas.syncScrollBars();
|
||||||
nameList.setSize(nameMaxWidth + 15, trackVerticalHeight);
|
nameList.setSize(nameMaxWidth + 15, trackVerticalHeight);
|
||||||
nameListScrolled.setMinSize(nameMaxWidth + 15, trackVerticalHeight);
|
nameListScrolled.setMinSize(nameMaxWidth + 15, trackVerticalHeight);
|
||||||
valueList.setSize(calculateValueWidth(), trackVerticalHeight);
|
valueList.setSize(calculateValueWidth(), trackVerticalHeight);
|
||||||
|
@ -436,14 +440,15 @@ public class WaveformViewer implements IWaveformViewer {
|
||||||
for(Entry<Integer, IWaveform<? extends IWaveformEvent>> entry: trackVerticalOffset.entrySet()){
|
for(Entry<Integer, IWaveform<? extends IWaveformEvent>> entry: trackVerticalOffset.entrySet()){
|
||||||
System.out.println(" "+entry.getKey()+": " +entry.getValue().getFullName());
|
System.out.println(" "+entry.getKey()+": " +entry.getValue().getFullName());
|
||||||
}
|
}
|
||||||
*/ }
|
*/
|
||||||
|
}
|
||||||
|
|
||||||
private int calculateValueWidth() {
|
private int calculateValueWidth() {
|
||||||
TextLayout tl = new TextLayout(waveformCanvas.getDisplay());
|
TextLayout tl = new TextLayout(waveformCanvas.getDisplay());
|
||||||
tl.setFont(nameFontB);
|
tl.setFont(nameFontB);
|
||||||
int valueMaxWidth = 0;
|
int valueMaxWidth = 0;
|
||||||
for (String v : actualValues.values()) {
|
for (TrackEntry v : streams) {
|
||||||
tl.setText(v);
|
tl.setText(v.currentValue);
|
||||||
valueMaxWidth = Math.max(valueMaxWidth, tl.getBounds().width);
|
valueMaxWidth = Math.max(valueMaxWidth, tl.getBounds().width);
|
||||||
}
|
}
|
||||||
return valueMaxWidth + 15;
|
return valueMaxWidth + 15;
|
||||||
|
@ -451,16 +456,32 @@ public class WaveformViewer implements IWaveformViewer {
|
||||||
|
|
||||||
private void updateValueList(){
|
private void updateValueList(){
|
||||||
final Long time = getCursorTime();
|
final Long time = getCursorTime();
|
||||||
for(Entry<IWaveform<? extends IWaveformEvent>, String> entry:actualValues.entrySet()){
|
for(TrackEntry entry:streams){
|
||||||
if(entry.getKey() instanceof ISignal){
|
if(entry.isSignal()){
|
||||||
ISignalChange event = ((ISignal<?>)entry.getKey()).getWaveformEventsBeforeTime(time);
|
ISignalChange event = ((ISignal<?>)entry.waveform).getWaveformEventsBeforeTime(time);
|
||||||
if(event instanceof ISignalChangeSingle){
|
if(event instanceof ISignalChangeBit){
|
||||||
entry.setValue("b'"+((ISignalChangeSingle)event).getValue());
|
entry.currentValue="b'"+((ISignalChangeBit)event).getValue();
|
||||||
} else if(event instanceof ISignalChangeMulti){
|
} else if(event instanceof ISignalChangeBitVector){
|
||||||
entry.setValue("h'"+((ISignalChangeMulti)event).getValue().toHexString());
|
// TODO: same code resides in SignalPainter, fix it
|
||||||
|
switch(entry.valueDisplay) {
|
||||||
|
case SIGNED:
|
||||||
|
entry.currentValue=Long.toString(((ISignalChangeBitVector)event).getValue().toSignedValue());
|
||||||
|
break;
|
||||||
|
case UNSIGNED:
|
||||||
|
entry.currentValue=Long.toString(((ISignalChangeBitVector)event).getValue().toUnsignedValue());
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
entry.currentValue="h'"+((ISignalChangeBitVector)event).getValue().toHexString();
|
||||||
}
|
}
|
||||||
} else if(entry.getKey() instanceof ITxStream<?>){
|
} else if(event instanceof ISignalChangeReal){
|
||||||
ITxStream<?> stream = (ITxStream<?>) entry.getKey();
|
double val = ((ISignalChangeReal)event).getValue();
|
||||||
|
if(val>0.001)
|
||||||
|
entry.currentValue=String.format("%1$,.3f", val);
|
||||||
|
else
|
||||||
|
entry.currentValue=Double.toString(val);
|
||||||
|
}
|
||||||
|
} else if(entry.isStream()){
|
||||||
|
ITxStream<?> stream = (ITxStream<?>) entry.waveform;
|
||||||
ITx[] resultsList = new ITx[stream.getMaxConcurrency()];
|
ITx[] resultsList = new ITx[stream.getMaxConcurrency()];
|
||||||
Entry<Long, List<ITxEvent>> firstTx=stream.getEvents().floorEntry(time);
|
Entry<Long, List<ITxEvent>> firstTx=stream.getEvents().floorEntry(time);
|
||||||
if(firstTx!=null){
|
if(firstTx!=null){
|
||||||
|
@ -482,7 +503,7 @@ public class WaveformViewer implements IWaveformViewer {
|
||||||
value+="|";
|
value+="|";
|
||||||
if(o!=null) value+=((ITx)o).getGenerator().getName();
|
if(o!=null) value+=((ITx)o).getGenerator().getName();
|
||||||
}
|
}
|
||||||
entry.setValue(value);
|
entry.currentValue=value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -549,11 +570,13 @@ public class WaveformViewer implements IWaveformViewer {
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public ISelection getSelection() {
|
public ISelection getSelection() {
|
||||||
if (currentTxSelection != null)
|
if (currentTxSelection != null) {
|
||||||
return new StructuredSelection(currentTxSelection);
|
Object[] elem = {currentTxSelection, currentWaveformSelection};
|
||||||
else if (currentWaveformSelection != null)
|
return new StructuredSelection(elem);
|
||||||
return new StructuredSelection(currentWaveformSelection.waveform);
|
} else if (currentWaveformSelection != null) {
|
||||||
else
|
Object[] elem = {currentWaveformSelection.waveform, currentWaveformSelection};
|
||||||
|
return new StructuredSelection(elem);
|
||||||
|
} else
|
||||||
return new StructuredSelection();
|
return new StructuredSelection();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -593,6 +616,7 @@ public class WaveformViewer implements IWaveformViewer {
|
||||||
currentWaveformSelection = (TrackEntry) sel;
|
currentWaveformSelection = (TrackEntry) sel;
|
||||||
if(currentTxSelection!=null && currentTxSelection.getStream()!=currentWaveformSelection)
|
if(currentTxSelection!=null && currentTxSelection.getStream()!=currentWaveformSelection)
|
||||||
currentTxSelection=null;
|
currentTxSelection=null;
|
||||||
|
|
||||||
selectionChanged = true;
|
selectionChanged = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -605,6 +629,7 @@ public class WaveformViewer implements IWaveformViewer {
|
||||||
}
|
}
|
||||||
if(currentWaveformSelection!=null) currentWaveformSelection.selected=true;
|
if(currentWaveformSelection!=null) currentWaveformSelection.selected=true;
|
||||||
if (selectionChanged) {
|
if (selectionChanged) {
|
||||||
|
waveformCanvas.reveal(currentWaveformSelection.waveform);
|
||||||
waveformCanvas.setSelected(currentTxSelection);
|
waveformCanvas.setSelected(currentTxSelection);
|
||||||
valueList.redraw();
|
valueList.redraw();
|
||||||
nameList.redraw();
|
nameList.redraw();
|
||||||
|
@ -628,7 +653,16 @@ public class WaveformViewer implements IWaveformViewer {
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void moveSelection(GotoDirection direction) {
|
public void moveSelection(GotoDirection direction) {
|
||||||
|
if(direction==GotoDirection.NEXT || direction==GotoDirection.PREV)
|
||||||
moveSelection(direction, NEXT_PREV_IN_STREAM) ;
|
moveSelection(direction, NEXT_PREV_IN_STREAM) ;
|
||||||
|
else {
|
||||||
|
int idx = streams.indexOf(currentWaveformSelection);
|
||||||
|
if(direction==GotoDirection.UP && idx>0) {
|
||||||
|
setSelection(new StructuredSelection(streams.get(idx-1)));
|
||||||
|
} else if(direction==GotoDirection.DOWN && idx<(streams.size()-1)) {
|
||||||
|
setSelection(new StructuredSelection(streams.get(idx+1)));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
|
@ -738,6 +772,7 @@ public class WaveformViewer implements IWaveformViewer {
|
||||||
setCursorTime(time);
|
setCursorTime(time);
|
||||||
waveformCanvas.reveal(time);
|
waveformCanvas.reveal(time);
|
||||||
waveformCanvas.redraw();
|
waveformCanvas.redraw();
|
||||||
|
updateValueList();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -757,17 +792,21 @@ public class WaveformViewer implements IWaveformViewer {
|
||||||
@Override
|
@Override
|
||||||
public void moveSelectedTrack(int i) {
|
public void moveSelectedTrack(int i) {
|
||||||
if(currentWaveformSelection!=null){
|
if(currentWaveformSelection!=null){
|
||||||
ITx selectedTx=currentTxSelection;
|
|
||||||
TrackEntry selectedWaveform=currentWaveformSelection;
|
|
||||||
int idx = streams.indexOf(currentWaveformSelection);
|
int idx = streams.indexOf(currentWaveformSelection);
|
||||||
int newIdx=idx+i;
|
int newIdx=idx+i;
|
||||||
if(newIdx>=0 && newIdx<streams.size()){
|
if(newIdx>=0 && newIdx<streams.size()){
|
||||||
Collections.swap(streams,idx,newIdx);
|
Collections.swap(streams,idx,newIdx);
|
||||||
updateTracklist();
|
revealSelected=true;
|
||||||
if(selectedTx!=null){
|
// update();
|
||||||
setSelection(new StructuredSelection(new Object[]{selectedTx, selectedWaveform.waveform}));
|
// ITx selectedTx=currentTxSelection;
|
||||||
} else
|
// if(selectedTx!=null){
|
||||||
setSelection(new StructuredSelection(selectedWaveform.waveform));
|
// setSelection(new StructuredSelection(new Object[]{selectedTx, currentWaveformSelection.waveform}));
|
||||||
|
// } else {
|
||||||
|
// setSelection(new StructuredSelection(currentWaveformSelection.waveform));
|
||||||
|
// }
|
||||||
|
// waveformCanvas.reveal(currentWaveformSelection.waveform);
|
||||||
|
// valueList.redraw();
|
||||||
|
// nameList.redraw();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -813,7 +852,7 @@ public class WaveformViewer implements IWaveformViewer {
|
||||||
IWaveform<? extends IWaveformEvent> w = trackEntry.waveform;
|
IWaveform<? extends IWaveformEvent> w = trackEntry.waveform;
|
||||||
if (w instanceof ITxStream<?>)
|
if (w instanceof ITxStream<?>)
|
||||||
subArea.height *= ((ITxStream<?>) w).getMaxConcurrency();
|
subArea.height *= ((ITxStream<?>) w).getMaxConcurrency();
|
||||||
drawValue(gc, subArea, firstKey, actualValues.get(w), trackEntry.selected);
|
drawValue(gc, subArea, firstKey, trackEntry.currentValue, trackEntry.selected);
|
||||||
} else {
|
} else {
|
||||||
for (Entry<Integer, TrackEntry> entry : trackVerticalOffset.subMap(firstKey, true, lastKey, true)
|
for (Entry<Integer, TrackEntry> entry : trackVerticalOffset.subMap(firstKey, true, lastKey, true)
|
||||||
.entrySet()) {
|
.entrySet()) {
|
||||||
|
@ -821,7 +860,7 @@ public class WaveformViewer implements IWaveformViewer {
|
||||||
subArea.height = waveformCanvas.getTrackHeight();
|
subArea.height = waveformCanvas.getTrackHeight();
|
||||||
if (w instanceof ITxStream<?>)
|
if (w instanceof ITxStream<?>)
|
||||||
subArea.height *= ((ITxStream<?>) w).getMaxConcurrency();
|
subArea.height *= ((ITxStream<?>) w).getMaxConcurrency();
|
||||||
drawValue(gc, subArea, entry.getKey(), actualValues.get(w), entry.getValue().selected);
|
drawValue(gc, subArea, entry.getKey(), entry.getValue().currentValue, entry.getValue().selected);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}catch(NoSuchElementException e){}
|
}catch(NoSuchElementException e){}
|
||||||
|
@ -989,7 +1028,7 @@ public class WaveformViewer implements IWaveformViewer {
|
||||||
else
|
else
|
||||||
streams.add(tgtIdx, srcWave);
|
streams.add(tgtIdx, srcWave);
|
||||||
currentWaveformSelection=srcWave;
|
currentWaveformSelection=srcWave;
|
||||||
updateTracklist();
|
update();
|
||||||
} else if(source instanceof CursorPainter){
|
} else if(source instanceof CursorPainter){
|
||||||
((CursorPainter)source).setTime(0);
|
((CursorPainter)source).setTime(0);
|
||||||
updateValueList();
|
updateValueList();
|
||||||
|
@ -1156,10 +1195,10 @@ public class WaveformViewer implements IWaveformViewer {
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public String[] getZoomLevels(){
|
public String[] getZoomLevels(){
|
||||||
String[] res = new String[WaveformCanvas.unitMultiplier.length*WaveformCanvas.unitString.length];
|
String[] res = new String[Constants.unitMultiplier.length*Constants.unitString.length];
|
||||||
int index=0;
|
int index=0;
|
||||||
for(String unit:WaveformCanvas.unitString){
|
for(String unit:Constants.unitString){
|
||||||
for(int factor:WaveformCanvas.unitMultiplier){
|
for(int factor:Constants.unitMultiplier){
|
||||||
res[index++]= new Integer(factor).toString()+unit;
|
res[index++]= new Integer(factor).toString()+unit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1182,4 +1221,31 @@ public class WaveformViewer implements IWaveformViewer {
|
||||||
origin.x=(int) (-time/waveformCanvas.getScaleFactorPow10());
|
origin.x=(int) (-time/waveformCanvas.getScaleFactorPow10());
|
||||||
waveformCanvas.setOrigin(origin);
|
waveformCanvas.setOrigin(origin);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void scrollHorizontal(int percent) {
|
||||||
|
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();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void asyncUpdate(Widget widget) {
|
||||||
|
widget.getDisplay().asyncExec(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
waveformCanvas.redraw();
|
||||||
|
updateValueList();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<classpath>
|
<classpath>
|
||||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
|
<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="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
||||||
<classpathentry kind="src" path="src"/>
|
<classpathentry kind="src" path="src"/>
|
||||||
<classpathentry kind="output" path="bin"/>
|
<classpathentry kind="output" path="bin"/>
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
eclipse.preferences.version=1
|
eclipse.preferences.version=1
|
||||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
|
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
|
||||||
org.eclipse.jdt.core.compiler.compliance=1.7
|
org.eclipse.jdt.core.compiler.compliance=1.8
|
||||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||||
org.eclipse.jdt.core.compiler.source=1.7
|
org.eclipse.jdt.core.compiler.source=1.8
|
||||||
|
|
|
@ -2,9 +2,10 @@ Manifest-Version: 1.0
|
||||||
Bundle-ManifestVersion: 2
|
Bundle-ManifestVersion: 2
|
||||||
Bundle-Name: Database UI
|
Bundle-Name: Database UI
|
||||||
Bundle-SymbolicName: com.minres.scviewer.database.ui
|
Bundle-SymbolicName: com.minres.scviewer.database.ui
|
||||||
Bundle-Version: 1.0.0.qualifier
|
Bundle-Version: 2.0.0.qualifier
|
||||||
Bundle-Vendor: MINRES Technologies GmbH
|
Bundle-Vendor: MINRES Technologies GmbH
|
||||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
|
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
|
||||||
Export-Package: com.minres.scviewer.database.ui
|
Export-Package: com.minres.scviewer.database.ui
|
||||||
Require-Bundle: com.minres.scviewer.database,
|
Require-Bundle: com.minres.scviewer.database,
|
||||||
org.eclipse.jface
|
org.eclipse.jface
|
||||||
|
Automatic-Module-Name: com.minres.scviewer.database.ui
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<artifactId>com.minres.scviewer.database.ui</artifactId>
|
<artifactId>com.minres.scviewer.database.ui</artifactId>
|
||||||
<version>1.0.0-SNAPSHOT</version>
|
<version>2.0.0-SNAPSHOT</version>
|
||||||
<packaging>eclipse-plugin</packaging>
|
<packaging>eclipse-plugin</packaging>
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.minres.scviewer</groupId>
|
<groupId>com.minres.scviewer</groupId>
|
||||||
<artifactId>com.minres.scviewer.parent</artifactId>
|
<artifactId>com.minres.scviewer.parent</artifactId>
|
||||||
<version>1.0.0-SNAPSHOT</version>
|
<version>2.0.0-SNAPSHOT</version>
|
||||||
<relativePath>../com.minres.scviewer.parent</relativePath>
|
<relativePath>../com.minres.scviewer.parent</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
</project>
|
</project>
|
|
@ -35,6 +35,8 @@ public interface IWaveformViewer extends PropertyChangeListener, ISelectionProvi
|
||||||
|
|
||||||
public void removeSelectionChangedListener(ISelectionChangedListener listener);
|
public void removeSelectionChangedListener(ISelectionChangedListener listener);
|
||||||
|
|
||||||
|
public void update();
|
||||||
|
|
||||||
public Control getControl();
|
public Control getControl();
|
||||||
|
|
||||||
public Control getNameControl();
|
public Control getNameControl();
|
||||||
|
@ -100,4 +102,6 @@ public interface IWaveformViewer extends PropertyChangeListener, ISelectionProvi
|
||||||
public long getBaselineTime();
|
public long getBaselineTime();
|
||||||
|
|
||||||
public void setBaselineTime(Long scale);
|
public void setBaselineTime(Long scale);
|
||||||
|
|
||||||
|
public void scrollHorizontal(int percent);
|
||||||
}
|
}
|
|
@ -17,7 +17,17 @@ import com.minres.scviewer.database.ITxStream;
|
||||||
import com.minres.scviewer.database.IWaveform;
|
import com.minres.scviewer.database.IWaveform;
|
||||||
import com.minres.scviewer.database.IWaveformEvent;
|
import com.minres.scviewer.database.IWaveformEvent;
|
||||||
|
|
||||||
|
|
||||||
public class TrackEntry {
|
public class TrackEntry {
|
||||||
|
public enum ValueDisplay {
|
||||||
|
DEFAULT, SIGNED, UNSIGNED
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public enum WaveDisplay {
|
||||||
|
DEFAULT, STEP_WISE, CONTINOUS
|
||||||
|
}
|
||||||
|
|
||||||
final public IWaveform<? extends IWaveformEvent> waveform;
|
final public IWaveform<? extends IWaveformEvent> waveform;
|
||||||
|
|
||||||
public int vOffset;
|
public int vOffset;
|
||||||
|
@ -26,6 +36,12 @@ public class TrackEntry {
|
||||||
|
|
||||||
public boolean selected;
|
public boolean selected;
|
||||||
|
|
||||||
|
public String currentValue="";
|
||||||
|
|
||||||
|
public ValueDisplay valueDisplay = ValueDisplay.DEFAULT;
|
||||||
|
|
||||||
|
public WaveDisplay waveDisplay = WaveDisplay.DEFAULT;
|
||||||
|
|
||||||
public TrackEntry(IWaveform<? extends IWaveformEvent> waveform) {
|
public TrackEntry(IWaveform<? extends IWaveformEvent> waveform) {
|
||||||
this.waveform = waveform;
|
this.waveform = waveform;
|
||||||
vOffset=0;
|
vOffset=0;
|
||||||
|
|
|
@ -14,7 +14,7 @@ public enum WaveformColors {
|
||||||
LINE, LINE_HIGHLITE,
|
LINE, LINE_HIGHLITE,
|
||||||
TRACK_BG_EVEN, TRACK_BG_ODD, TRACK_BG_HIGHLITE,
|
TRACK_BG_EVEN, TRACK_BG_ODD, TRACK_BG_HIGHLITE,
|
||||||
TX_BG, TX_BG_HIGHLITE, TX_BORDER,
|
TX_BG, TX_BG_HIGHLITE, TX_BORDER,
|
||||||
SIGNAL0, SIGNAL1, SIGNALZ, SIGNALX, SIGNALU, SIGNAL_TEXT,
|
SIGNAL0, SIGNAL1, SIGNALZ, SIGNALX, SIGNALU, SIGNAL_TEXT, SIGNAL_REAL, SIGNAL_NAN,
|
||||||
CURSOR, CURSOR_DRAG, CURSOR_TEXT,
|
CURSOR, CURSOR_DRAG, CURSOR_TEXT,
|
||||||
MARKER, MARKER_TEXT, REL_ARROW, REL_ARROW_HIGHLITE
|
MARKER, MARKER_TEXT, REL_ARROW, REL_ARROW_HIGHLITE
|
||||||
}
|
}
|
|
@ -1,7 +1,7 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<classpath>
|
<classpath>
|
||||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
|
<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="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
||||||
<classpathentry kind="src" path="src/"/>
|
<classpathentry kind="src" path="src"/>
|
||||||
<classpathentry kind="output" path="target/classes"/>
|
<classpathentry kind="output" path="target/classes"/>
|
||||||
</classpath>
|
</classpath>
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
eclipse.preferences.version=1
|
eclipse.preferences.version=1
|
||||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
|
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
|
||||||
org.eclipse.jdt.core.compiler.compliance=1.7
|
org.eclipse.jdt.core.compiler.compliance=1.8
|
||||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||||
org.eclipse.jdt.core.compiler.source=1.7
|
org.eclipse.jdt.core.compiler.source=1.8
|
||||||
|
|
|
@ -2,9 +2,9 @@ Manifest-Version: 1.0
|
||||||
Bundle-ManifestVersion: 2
|
Bundle-ManifestVersion: 2
|
||||||
Bundle-Name: VCD signal database
|
Bundle-Name: VCD signal database
|
||||||
Bundle-SymbolicName: com.minres.scviewer.database.vcd
|
Bundle-SymbolicName: com.minres.scviewer.database.vcd
|
||||||
Bundle-Version: 1.0.0.qualifier
|
Bundle-Version: 2.0.0.qualifier
|
||||||
Bundle-Vendor: MINRES Technologies GmbH
|
Bundle-Vendor: MINRES Technologies GmbH
|
||||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
|
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
|
||||||
Require-Bundle: com.minres.scviewer.database;bundle-version="1.0.0",
|
Require-Bundle: com.minres.scviewer.database;bundle-version="1.0.0",
|
||||||
org.eclipse.equinox.util;bundle-version="1.0.500",
|
org.eclipse.equinox.util;bundle-version="1.0.500",
|
||||||
org.eclipse.equinox.ds;bundle-version="1.4.200",
|
org.eclipse.equinox.ds;bundle-version="1.4.200",
|
||||||
|
@ -13,3 +13,4 @@ Require-Bundle: com.minres.scviewer.database;bundle-version="1.0.0",
|
||||||
Service-Component: OSGI-INF/component.xml
|
Service-Component: OSGI-INF/component.xml
|
||||||
Bundle-ActivationPolicy: lazy
|
Bundle-ActivationPolicy: lazy
|
||||||
Import-Package: com.google.common.collect
|
Import-Package: com.google.common.collect
|
||||||
|
Automatic-Module-Name: com.minres.scviewer.database.vcd
|
||||||
|
|
|
@ -4,8 +4,9 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.minres.scviewer</groupId>
|
<groupId>com.minres.scviewer</groupId>
|
||||||
<artifactId>com.minres.scviewer.parent</artifactId>
|
<artifactId>com.minres.scviewer.parent</artifactId>
|
||||||
<version>1.0.0-SNAPSHOT</version>
|
<version>2.0.0-SNAPSHOT</version>
|
||||||
<relativePath>../com.minres.scviewer.parent</relativePath>
|
<relativePath>../com.minres.scviewer.parent</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<packaging>eclipse-plugin</packaging>
|
<packaging>eclipse-plugin</packaging>
|
||||||
</project>
|
<version>2.0.0-SNAPSHOT</version>
|
||||||
|
</project>
|
|
@ -34,26 +34,44 @@ public interface IVCDDatabaseBuilder {
|
||||||
*
|
*
|
||||||
* @param netName the net name
|
* @param netName the net name
|
||||||
* @param i the index of the net, -1 if a new one, otherwise the id if the referenced
|
* @param i the index of the net, -1 if a new one, otherwise the id if the referenced
|
||||||
* @param width the width
|
* @param width the width, -1 equals real, 0... is a bit vector
|
||||||
* @return the integer
|
* @return the net id
|
||||||
*/
|
*/
|
||||||
public Integer newNet(String netName, int i, int width) ;
|
public Integer newNet(String netName, int i, int width) ;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the net width.
|
* Gets the net width.
|
||||||
*
|
*
|
||||||
* @param intValue the int value
|
* @param intValue the net id
|
||||||
* @return the net width
|
* @return the net width, -1 means a real-valued net
|
||||||
*/
|
*/
|
||||||
public int getNetWidth(int intValue);
|
public int getNetWidth(int netId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Append transition.
|
* Append transition.
|
||||||
*
|
*
|
||||||
* @param signalId the int value
|
* @param netId the int value
|
||||||
|
* @param currentTime the current time in ps
|
||||||
|
* @param decodedValues the decoded bit values
|
||||||
|
*/
|
||||||
|
public void appendTransition(int netId, long currentTime, char decodedValue);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Append transition.
|
||||||
|
*
|
||||||
|
* @param netId the int value
|
||||||
* @param currentTime the current time in ps
|
* @param currentTime the current time in ps
|
||||||
* @param decodedValues the decoded values
|
* @param decodedValues the decoded values
|
||||||
*/
|
*/
|
||||||
public void appendTransition(int signalId, long currentTime, BitVector decodedValues);
|
public void appendTransition(int netId, long currentTime, BitVector decodedValue);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Append transition.
|
||||||
|
*
|
||||||
|
* @param netId the int value
|
||||||
|
* @param currentTime the current time in ps
|
||||||
|
* @param decodedValue the decoded values
|
||||||
|
*/
|
||||||
|
public void appendTransition(int netId, long currentTime, double decodedValue);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,6 +15,7 @@ import java.io.FileInputStream;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.NavigableMap;
|
||||||
import java.util.Stack;
|
import java.util.Stack;
|
||||||
import java.util.TreeMap;
|
import java.util.TreeMap;
|
||||||
import java.util.Vector;
|
import java.util.Vector;
|
||||||
|
@ -22,8 +23,9 @@ import java.util.Vector;
|
||||||
import com.minres.scviewer.database.BitVector;
|
import com.minres.scviewer.database.BitVector;
|
||||||
import com.minres.scviewer.database.ISignal;
|
import com.minres.scviewer.database.ISignal;
|
||||||
import com.minres.scviewer.database.ISignalChange;
|
import com.minres.scviewer.database.ISignalChange;
|
||||||
import com.minres.scviewer.database.ISignalChangeMulti;
|
import com.minres.scviewer.database.ISignalChangeBitVector;
|
||||||
import com.minres.scviewer.database.ISignalChangeSingle;
|
import com.minres.scviewer.database.ISignalChangeReal;
|
||||||
|
import com.minres.scviewer.database.ISignalChangeBit;
|
||||||
import com.minres.scviewer.database.IWaveform;
|
import com.minres.scviewer.database.IWaveform;
|
||||||
import com.minres.scviewer.database.IWaveformDb;
|
import com.minres.scviewer.database.IWaveformDb;
|
||||||
import com.minres.scviewer.database.IWaveformDbLoader;
|
import com.minres.scviewer.database.IWaveformDbLoader;
|
||||||
|
@ -68,6 +70,7 @@ public class VCDDbLoader implements IWaveformDbLoader, IVCDDatabaseBuilder {
|
||||||
@Override
|
@Override
|
||||||
public boolean load(IWaveformDb db, File file) throws Exception {
|
public boolean load(IWaveformDb db, File file) throws Exception {
|
||||||
this.db=db;
|
this.db=db;
|
||||||
|
this.maxTime=0;
|
||||||
FileInputStream fis = new FileInputStream(file);
|
FileInputStream fis = new FileInputStream(file);
|
||||||
byte[] buffer = new byte[dateBytes.length];
|
byte[] buffer = new byte[dateBytes.length];
|
||||||
int read = fis.read(buffer, 0, dateBytes.length);
|
int read = fis.read(buffer, 0, dateBytes.length);
|
||||||
|
@ -83,20 +86,25 @@ public class VCDDbLoader implements IWaveformDbLoader, IVCDDatabaseBuilder {
|
||||||
moduleStack=null;
|
moduleStack=null;
|
||||||
if(!res) throw new InputFormatException();
|
if(!res) throw new InputFormatException();
|
||||||
// calculate max time of database
|
// calculate max time of database
|
||||||
for(IWaveform<? extends IWaveformEvent> waveform:signals)
|
for(IWaveform<? extends IWaveformEvent> waveform:signals) {
|
||||||
maxTime= Math.max(maxTime, ((ISignal<? extends ISignalChange>)waveform).getEvents().lastKey());
|
NavigableMap<Long, ? extends ISignalChange> events =((ISignal<? extends ISignalChange>)waveform).getEvents();
|
||||||
|
if(events.size()>0)
|
||||||
|
maxTime= Math.max(maxTime, events.lastKey());
|
||||||
|
}
|
||||||
// extend signals to hav a last value set at max time
|
// extend signals to hav a last value set at max time
|
||||||
for(IWaveform<? extends IWaveformEvent> waveform:signals){
|
for(IWaveform<? extends IWaveformEvent> waveform:signals){
|
||||||
TreeMap<Long,? extends ISignalChange> events = ((VCDSignal<? extends ISignalChange>)waveform).values;
|
TreeMap<Long,? extends ISignalChange> events = ((VCDSignal<? extends ISignalChange>)waveform).values;
|
||||||
if(events.lastKey()<maxTime){
|
if(events.size()>0 && events.lastKey()<maxTime){
|
||||||
ISignalChange x = events.lastEntry().getValue();
|
ISignalChange x = events.lastEntry().getValue();
|
||||||
if(x instanceof ISignalChangeSingle)
|
if(x instanceof ISignalChangeBit)
|
||||||
((VCDSignal<ISignalChangeSingle>)waveform).values.put(maxTime,
|
((VCDSignal<ISignalChangeBit>)waveform).values.put(maxTime,
|
||||||
new VCDSignalChangeSingle(maxTime, ((ISignalChangeSingle)x).getValue()));
|
new VCDSignalChangeBit(maxTime, ((ISignalChangeBit)x).getValue()));
|
||||||
else
|
else if(x instanceof ISignalChangeBitVector)
|
||||||
if(x instanceof ISignalChangeMulti)
|
((VCDSignal<ISignalChangeBitVector>)waveform).values.put(maxTime,
|
||||||
((VCDSignal<ISignalChangeMulti>)waveform).values.put(maxTime,
|
new VCDSignalChangeBitVector(maxTime, ((ISignalChangeBitVector)x).getValue()));
|
||||||
new VCDSignalChangeMulti(maxTime, ((ISignalChangeMulti)x).getValue()));
|
else if(x instanceof ISignalChangeReal)
|
||||||
|
((VCDSignal<ISignalChangeReal>)waveform).values.put(maxTime,
|
||||||
|
new VCDSignalChangeReal(maxTime, ((ISignalChangeReal)x).getValue()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -123,9 +131,9 @@ public class VCDDbLoader implements IWaveformDbLoader, IVCDDatabaseBuilder {
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void enterModule(String tokenString) {
|
public void enterModule(String tokenString) {
|
||||||
if(moduleStack.isEmpty())
|
if(moduleStack.isEmpty()) {
|
||||||
moduleStack.push(tokenString);
|
if("SystemC".compareTo(tokenString)!=0) moduleStack.push(tokenString);
|
||||||
else
|
} else
|
||||||
moduleStack.push(moduleStack.peek()+"."+tokenString);
|
moduleStack.push(moduleStack.peek()+"."+tokenString);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -143,15 +151,19 @@ public class VCDDbLoader implements IWaveformDbLoader, IVCDDatabaseBuilder {
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
@Override
|
@Override
|
||||||
public Integer newNet(String netName, int i, int width) {
|
public Integer newNet(String name, int i, int width) {
|
||||||
|
String netName = moduleStack.empty()? name: moduleStack.lastElement()+"."+name;
|
||||||
int id = signals.size();
|
int id = signals.size();
|
||||||
VCDSignal<? extends IWaveformEvent> signal;
|
VCDSignal<? extends IWaveformEvent> signal;
|
||||||
if(width==1){
|
if(width<0) {
|
||||||
signal = i<0 ? new VCDSignal<ISignalChangeSingle>(db, id, netName) :
|
signal = i<0 ? new VCDSignal<ISignalChangeReal>(db, id, netName, width) :
|
||||||
new VCDSignal<ISignalChangeSingle>((VCDSignal<ISignalChangeSingle>)signals.get(i), id, netName);
|
new VCDSignal<ISignalChangeReal>((VCDSignal<ISignalChangeReal>)signals.get(i), id, netName);
|
||||||
|
} else if(width==1){
|
||||||
|
signal = i<0 ? new VCDSignal<ISignalChangeBit>(db, id, netName) :
|
||||||
|
new VCDSignal<ISignalChangeBit>((VCDSignal<ISignalChangeBit>)signals.get(i), id, netName);
|
||||||
} else {
|
} else {
|
||||||
signal = i<0 ? new VCDSignal<ISignalChangeMulti>(db, id, netName, width) :
|
signal = i<0 ? new VCDSignal<ISignalChangeBitVector>(db, id, netName, width) :
|
||||||
new VCDSignal<ISignalChangeMulti>((VCDSignal<VCDSignalChangeMulti>)signals.get(i), id, netName);
|
new VCDSignal<ISignalChangeBitVector>((VCDSignal<VCDSignalChangeBitVector>)signals.get(i), id, netName);
|
||||||
};
|
};
|
||||||
signals.add(signal);
|
signals.add(signal);
|
||||||
return id;
|
return id;
|
||||||
|
@ -166,6 +178,19 @@ public class VCDDbLoader implements IWaveformDbLoader, IVCDDatabaseBuilder {
|
||||||
return signal.getWidth();
|
return signal.getWidth();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see com.minres.scviewer.database.vcd.ITraceBuilder#appendTransition(int, long, com.minres.scviewer.database.vcd.BitVector)
|
||||||
|
*/
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
@Override
|
||||||
|
public void appendTransition(int signalId, long currentTime, char decodedValues) {
|
||||||
|
VCDSignal<? extends IWaveformEvent> signal = (VCDSignal<? extends IWaveformEvent>) signals.get(signalId);
|
||||||
|
Long time = currentTime*TIME_RES;
|
||||||
|
if(signal.getWidth()==1){
|
||||||
|
((VCDSignal<ISignalChangeBit>)signal).values.put(time, new VCDSignalChangeBit(time, decodedValues));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see com.minres.scviewer.database.vcd.ITraceBuilder#appendTransition(int, long, com.minres.scviewer.database.vcd.BitVector)
|
* @see com.minres.scviewer.database.vcd.ITraceBuilder#appendTransition(int, long, com.minres.scviewer.database.vcd.BitVector)
|
||||||
*/
|
*/
|
||||||
|
@ -174,10 +199,21 @@ public class VCDDbLoader implements IWaveformDbLoader, IVCDDatabaseBuilder {
|
||||||
public void appendTransition(int signalId, long currentTime, BitVector decodedValues) {
|
public void appendTransition(int signalId, long currentTime, BitVector decodedValues) {
|
||||||
VCDSignal<? extends IWaveformEvent> signal = (VCDSignal<? extends IWaveformEvent>) signals.get(signalId);
|
VCDSignal<? extends IWaveformEvent> signal = (VCDSignal<? extends IWaveformEvent>) signals.get(signalId);
|
||||||
Long time = currentTime* TIME_RES;
|
Long time = currentTime* TIME_RES;
|
||||||
if(signal.getWidth()==1){
|
if(signal.getWidth()>1){
|
||||||
((VCDSignal<ISignalChangeSingle>)signal).values.put(time, new VCDSignalChangeSingle(time, decodedValues.getValue()[0]));
|
((VCDSignal<VCDSignalChangeBitVector>)signal).values.put(time, new VCDSignalChangeBitVector(time, decodedValues));
|
||||||
} else {
|
}
|
||||||
((VCDSignal<VCDSignalChangeMulti>)signal).values.put(time, new VCDSignalChangeMulti(time, decodedValues));
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see com.minres.scviewer.database.vcd.ITraceBuilder#appendTransition(int, long, com.minres.scviewer.database.vcd.BitVector)
|
||||||
|
*/
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
@Override
|
||||||
|
public void appendTransition(int signalId, long currentTime, double decodedValue) {
|
||||||
|
VCDSignal<? extends IWaveformEvent> signal = (VCDSignal<? extends IWaveformEvent>) signals.get(signalId);
|
||||||
|
Long time = currentTime* TIME_RES;
|
||||||
|
if(signal.getWidth()<0){
|
||||||
|
((VCDSignal<ISignalChangeReal>)signal).values.put(time, new VCDSignalChangeReal(time, decodedValue));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -61,9 +61,11 @@ class VCDFileParser {
|
||||||
|
|
||||||
private void parseVar() throws Exception {
|
private void parseVar() throws Exception {
|
||||||
nextToken(); // type
|
nextToken(); // type
|
||||||
|
String type = tokenizer.sval;
|
||||||
nextToken(); // size
|
nextToken(); // size
|
||||||
int width = Integer.parseInt(tokenizer.sval);
|
int width = Integer.parseInt(tokenizer.sval);
|
||||||
|
if("real".equals(type))
|
||||||
|
width*=-1;
|
||||||
nextToken();
|
nextToken();
|
||||||
String id = tokenizer.sval;
|
String id = tokenizer.sval;
|
||||||
nextToken();
|
nextToken();
|
||||||
|
@ -153,7 +155,8 @@ class VCDFileParser {
|
||||||
} while (!tokenizer.sval.equals("$end"));
|
} while (!tokenizer.sval.equals("$end"));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (tokenizer.sval.equals("$dumpvars") || tokenizer.sval.equals("$end")) return true;
|
if (tokenizer.sval.equals("$dumpvars") || tokenizer.sval.equals("$end"))
|
||||||
|
return true;
|
||||||
String value, id;
|
String value, id;
|
||||||
if (tokenizer.sval.charAt(0) == 'b') {
|
if (tokenizer.sval.charAt(0) == 'b') {
|
||||||
// Multiple value net. Value appears first, followed by space,
|
// Multiple value net. Value appears first, followed by space,
|
||||||
|
@ -161,6 +164,12 @@ class VCDFileParser {
|
||||||
value = tokenizer.sval.substring(1);
|
value = tokenizer.sval.substring(1);
|
||||||
nextToken();
|
nextToken();
|
||||||
id = tokenizer.sval;
|
id = tokenizer.sval;
|
||||||
|
}else if (tokenizer.sval.charAt(0) == 'r') {
|
||||||
|
// Multiple value net. Value appears first, followed by space,
|
||||||
|
// then identifier
|
||||||
|
value = tokenizer.sval.substring(1);
|
||||||
|
nextToken();
|
||||||
|
id = tokenizer.sval;
|
||||||
} else {
|
} else {
|
||||||
// Single value net. identifier first, then value, no space.
|
// Single value net. identifier first, then value, no space.
|
||||||
value = tokenizer.sval.substring(0, 1);
|
value = tokenizer.sval.substring(0, 1);
|
||||||
|
@ -174,6 +183,12 @@ class VCDFileParser {
|
||||||
}
|
}
|
||||||
|
|
||||||
int netWidth = traceBuilder.getNetWidth(net);
|
int netWidth = traceBuilder.getNetWidth(net);
|
||||||
|
if(netWidth<0) {
|
||||||
|
if("nan".equals(value))
|
||||||
|
traceBuilder.appendTransition(net, currentTime, Double.NaN);
|
||||||
|
else
|
||||||
|
traceBuilder.appendTransition(net, currentTime, Double.parseDouble(value));
|
||||||
|
} else {
|
||||||
BitVector decodedValues = new BitVector(netWidth);
|
BitVector decodedValues = new BitVector(netWidth);
|
||||||
if (value.equals("z") && netWidth > 1) {
|
if (value.equals("z") && netWidth > 1) {
|
||||||
for (int i = 0; i < netWidth; i++)
|
for (int i = 0; i < netWidth; i++)
|
||||||
|
@ -206,8 +221,12 @@ class VCDFileParser {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if(netWidth==1)
|
||||||
|
traceBuilder.appendTransition(net, currentTime, decodedValues.getValue()[0]);
|
||||||
|
else
|
||||||
traceBuilder.appendTransition(net, currentTime, decodedValues);
|
traceBuilder.appendTransition(net, currentTime, decodedValues);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package com.minres.scviewer.database.vcd;
|
package com.minres.scviewer.database.vcd;
|
||||||
|
|
||||||
|
import java.util.Map.Entry;
|
||||||
import java.util.NavigableMap;
|
import java.util.NavigableMap;
|
||||||
import java.util.TreeMap;
|
import java.util.TreeMap;
|
||||||
|
|
||||||
|
@ -106,6 +107,10 @@ public class VCDSignal<T extends ISignalChange> extends HierNode implements ISig
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public T getWaveformEventsBeforeTime(Long time) {
|
public T getWaveformEventsBeforeTime(Long time) {
|
||||||
|
Entry<Long, T> e = values.floorEntry(time);
|
||||||
|
if(e==null)
|
||||||
|
return null;
|
||||||
|
else
|
||||||
return values.floorEntry(time).getValue();
|
return values.floorEntry(time).getValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,14 +10,14 @@
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package com.minres.scviewer.database.vcd;
|
package com.minres.scviewer.database.vcd;
|
||||||
|
|
||||||
import com.minres.scviewer.database.ISignalChangeSingle;
|
import com.minres.scviewer.database.ISignalChangeBit;
|
||||||
import com.minres.scviewer.database.SignalChange;
|
import com.minres.scviewer.database.SignalChange;
|
||||||
|
|
||||||
public class VCDSignalChangeSingle extends SignalChange implements ISignalChangeSingle, Cloneable {
|
public class VCDSignalChangeBit extends SignalChange implements ISignalChangeBit, Cloneable {
|
||||||
|
|
||||||
private char value;
|
private char value;
|
||||||
|
|
||||||
public VCDSignalChangeSingle(Long time, char value) {
|
public VCDSignalChangeBit(Long time, char value) {
|
||||||
super(time);
|
super(time);
|
||||||
this.value=value;
|
this.value=value;
|
||||||
}
|
}
|
|
@ -11,18 +11,18 @@
|
||||||
package com.minres.scviewer.database.vcd;
|
package com.minres.scviewer.database.vcd;
|
||||||
|
|
||||||
import com.minres.scviewer.database.BitVector;
|
import com.minres.scviewer.database.BitVector;
|
||||||
import com.minres.scviewer.database.ISignalChangeMulti;
|
import com.minres.scviewer.database.ISignalChangeBitVector;
|
||||||
import com.minres.scviewer.database.SignalChange;
|
import com.minres.scviewer.database.SignalChange;
|
||||||
|
|
||||||
public class VCDSignalChangeMulti extends SignalChange implements ISignalChangeMulti, Cloneable {
|
public class VCDSignalChangeBitVector extends SignalChange implements ISignalChangeBitVector, Cloneable {
|
||||||
|
|
||||||
private BitVector value;
|
private BitVector value;
|
||||||
|
|
||||||
public VCDSignalChangeMulti(Long time) {
|
public VCDSignalChangeBitVector(Long time) {
|
||||||
super(time);
|
super(time);
|
||||||
}
|
}
|
||||||
|
|
||||||
public VCDSignalChangeMulti(Long time, BitVector decodedValues) {
|
public VCDSignalChangeBitVector(Long time, BitVector decodedValues) {
|
||||||
super(time);
|
super(time);
|
||||||
this.value=decodedValues;
|
this.value=decodedValues;
|
||||||
}
|
}
|
|
@ -0,0 +1,37 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2015 MINRES Technologies GmbH and others.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* MINRES Technologies GmbH - initial API and implementation
|
||||||
|
*******************************************************************************/
|
||||||
|
package com.minres.scviewer.database.vcd;
|
||||||
|
|
||||||
|
import com.minres.scviewer.database.ISignalChangeReal;
|
||||||
|
import com.minres.scviewer.database.SignalChange;
|
||||||
|
|
||||||
|
public class VCDSignalChangeReal extends SignalChange implements ISignalChangeReal, Cloneable {
|
||||||
|
|
||||||
|
private double value;
|
||||||
|
|
||||||
|
public VCDSignalChangeReal(Long time, double value) {
|
||||||
|
super(time);
|
||||||
|
this.value=value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public double getValue() {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setValue(double value) {
|
||||||
|
this.value = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return value+"@"+getTime();
|
||||||
|
}
|
||||||
|
}
|
|
@ -2,6 +2,6 @@
|
||||||
<classpath>
|
<classpath>
|
||||||
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
||||||
<classpathentry kind="src" path="src"/>
|
<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.7"/>
|
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
|
||||||
<classpathentry kind="output" path="target/classes"/>
|
<classpathentry kind="output" path="target/classes"/>
|
||||||
</classpath>
|
</classpath>
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
eclipse.preferences.version=1
|
eclipse.preferences.version=1
|
||||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
|
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
|
||||||
org.eclipse.jdt.core.compiler.compliance=1.7
|
org.eclipse.jdt.core.compiler.compliance=1.8
|
||||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||||
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
|
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
|
||||||
org.eclipse.jdt.core.compiler.source=1.7
|
org.eclipse.jdt.core.compiler.source=1.8
|
||||||
|
|
|
@ -4,10 +4,11 @@ Bundle-Name: Waveform database
|
||||||
Bundle-SymbolicName: com.minres.scviewer.database
|
Bundle-SymbolicName: com.minres.scviewer.database
|
||||||
Bundle-Version: 1.0.0.qualifier
|
Bundle-Version: 1.0.0.qualifier
|
||||||
Bundle-Vendor: MINRES Technologies GmbH
|
Bundle-Vendor: MINRES Technologies GmbH
|
||||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
|
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
|
||||||
Export-Package: com.minres.scviewer.database
|
Export-Package: com.minres.scviewer.database
|
||||||
Bundle-ActivationPolicy: lazy
|
Bundle-ActivationPolicy: lazy
|
||||||
Service-Component: OSGI-INF/component.xml,OSGI-INF/component2.xml
|
Service-Component: OSGI-INF/component.xml,OSGI-INF/component2.xml
|
||||||
Require-Bundle: org.eclipse.equinox.ds;bundle-version="1.4.200",
|
Require-Bundle: org.eclipse.equinox.ds;bundle-version="1.4.200",
|
||||||
org.eclipse.equinox.util;bundle-version="1.0.500",
|
org.eclipse.equinox.util;bundle-version="1.0.500",
|
||||||
org.eclipse.osgi.services;bundle-version="3.4.0"
|
org.eclipse.osgi.services;bundle-version="3.4.0"
|
||||||
|
Automatic-Module-Name: com.minres.scviewer.database
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.minres.scviewer</groupId>
|
<groupId>com.minres.scviewer</groupId>
|
||||||
<artifactId>com.minres.scviewer.parent</artifactId>
|
<artifactId>com.minres.scviewer.parent</artifactId>
|
||||||
<version>1.0.0-SNAPSHOT</version>
|
<version>2.0.0-SNAPSHOT</version>
|
||||||
<relativePath>../com.minres.scviewer.parent</relativePath>
|
<relativePath>../com.minres.scviewer.parent</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<packaging>eclipse-plugin</packaging>
|
<packaging>eclipse-plugin</packaging>
|
||||||
|
|
|
@ -63,4 +63,49 @@ public class BitVector {
|
||||||
}
|
}
|
||||||
return new String(res);
|
return new String(res);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public long toUnsignedValue() {
|
||||||
|
long res = 0;
|
||||||
|
for(char c:value) {
|
||||||
|
res<<=1;
|
||||||
|
switch (c) {
|
||||||
|
case VALUE_1:
|
||||||
|
res++;
|
||||||
|
break;
|
||||||
|
case VALUE_X:
|
||||||
|
case VALUE_Z:
|
||||||
|
return 0;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
public long toSignedValue() {
|
||||||
|
Boolean negative=null;
|
||||||
|
long res = 0;
|
||||||
|
for(char c:value) {
|
||||||
|
if(negative == null) {
|
||||||
|
switch (c) {
|
||||||
|
case VALUE_1: negative=true; break;
|
||||||
|
case VALUE_0: negative=false; break;
|
||||||
|
case VALUE_X:
|
||||||
|
case VALUE_Z: return 0;
|
||||||
|
default:
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
res<<=1;
|
||||||
|
switch (c) {
|
||||||
|
case VALUE_1: if(!negative) res++; break;
|
||||||
|
case VALUE_0: if(negative) res++; break;
|
||||||
|
case VALUE_X:
|
||||||
|
case VALUE_Z: return 0;
|
||||||
|
default:
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return negative?-1*(res+1):res;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package com.minres.scviewer.database;
|
package com.minres.scviewer.database;
|
||||||
|
|
||||||
public interface ISignalChangeSingle extends ISignalChange{
|
public interface ISignalChangeBit extends ISignalChange{
|
||||||
|
|
||||||
public char getValue();
|
public char getValue();
|
||||||
|
|
|
@ -10,8 +10,7 @@
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package com.minres.scviewer.database;
|
package com.minres.scviewer.database;
|
||||||
|
|
||||||
|
public interface ISignalChangeBitVector extends ISignalChange {
|
||||||
public interface ISignalChangeMulti extends ISignalChange {
|
|
||||||
|
|
||||||
public BitVector getValue();
|
public BitVector getValue();
|
||||||
|
|
|
@ -0,0 +1,17 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2015 MINRES Technologies GmbH and others.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* MINRES Technologies GmbH - initial API and implementation
|
||||||
|
*******************************************************************************/
|
||||||
|
package com.minres.scviewer.database;
|
||||||
|
|
||||||
|
public interface ISignalChangeReal extends ISignalChange{
|
||||||
|
|
||||||
|
public double getValue();
|
||||||
|
|
||||||
|
}
|
|
@ -1,6 +1,6 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<classpath>
|
<classpath>
|
||||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
|
<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="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
||||||
<classpathentry kind="src" path="src"/>
|
<classpathentry kind="src" path="src"/>
|
||||||
<classpathentry kind="output" path="bin"/>
|
<classpathentry kind="output" path="bin"/>
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
eclipse.preferences.version=1
|
eclipse.preferences.version=1
|
||||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||||
org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
|
org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
|
||||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
|
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
|
||||||
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
|
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
|
||||||
org.eclipse.jdt.core.compiler.compliance=1.7
|
org.eclipse.jdt.core.compiler.compliance=1.8
|
||||||
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
|
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
|
||||||
org.eclipse.jdt.core.compiler.debug.localVariable=generate
|
org.eclipse.jdt.core.compiler.debug.localVariable=generate
|
||||||
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
|
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
|
||||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||||
org.eclipse.jdt.core.compiler.source=1.7
|
org.eclipse.jdt.core.compiler.source=1.8
|
||||||
|
|
|
@ -108,7 +108,7 @@
|
||||||
<parameters xmi:id="_cuGAkHcjEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.parameter.12" name="com.minres.scviewer.e4.application.command.navigateTransCommand.parameter.dir" value="prev"/>
|
<parameters xmi:id="_cuGAkHcjEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.parameter.12" name="com.minres.scviewer.e4.application.command.navigateTransCommand.parameter.dir" value="prev"/>
|
||||||
</children>
|
</children>
|
||||||
<children xsi:type="menu:ToolControl" xmi:id="_LtQhcIuKEeWid7xO48ZBXw" elementId="com.minres.scviewer.e4.application.toolcontrol.0" contributionURI="bundleclass://com.minres.scviewer.e4.application/com.minres.scviewer.e4.application.elements.RelationTypeToolControl"/>
|
<children xsi:type="menu:ToolControl" xmi:id="_LtQhcIuKEeWid7xO48ZBXw" elementId="com.minres.scviewer.e4.application.toolcontrol.0" contributionURI="bundleclass://com.minres.scviewer.e4.application/com.minres.scviewer.e4.application.elements.RelationTypeToolControl"/>
|
||||||
<children xsi:type="menu:DirectToolItem" xmi:id="_Z7ZQkIuJEeWid7xO48ZBXw" elementId="com.minres.scviewer.e4.application.directtoolitem.nextprevinstream" toBeRendered="false" visible="false" label="Next/Prev in stream" enabled="false">
|
<children xsi:type="menu:DirectToolItem" xmi:id="_Z7ZQkIuJEeWid7xO48ZBXw" elementId="com.minres.scviewer.e4.application.directtoolitem.nextprevinstream" toBeRendered="false" visible="false" label="Next/Prev in stream">
|
||||||
<menu xmi:id="_aPyMMIuJEeWid7xO48ZBXw" elementId="com.minres.scviewer.e4.application.menu.2">
|
<menu xmi:id="_aPyMMIuJEeWid7xO48ZBXw" elementId="com.minres.scviewer.e4.application.menu.2">
|
||||||
<children xsi:type="menu:DynamicMenuContribution" xmi:id="_cnNWkIuJEeWid7xO48ZBXw" elementId="com.minres.scviewer.e4.application.dynamicmenucontribution.2" contributionURI="bundleclass://com.minres.scviewer.e4.application/com.minres.scviewer.e4.application.parts.NavigateContribution"/>
|
<children xsi:type="menu:DynamicMenuContribution" xmi:id="_cnNWkIuJEeWid7xO48ZBXw" elementId="com.minres.scviewer.e4.application.dynamicmenucontribution.2" contributionURI="bundleclass://com.minres.scviewer.e4.application/com.minres.scviewer.e4.application.parts.NavigateContribution"/>
|
||||||
</menu>
|
</menu>
|
||||||
|
@ -142,7 +142,7 @@
|
||||||
</children>
|
</children>
|
||||||
</trimBars>
|
</trimBars>
|
||||||
</children>
|
</children>
|
||||||
<children xsi:type="basic:Dialog" xmi:id="_8BTkQIytEeWid7xO48ZBXw" elementId="com.minres.scviewer.e4.application.dialog.aboutscviewer" toBeRendered="false" visible="false" selectedElement="__VNlAIytEeWid7xO48ZBXw" label="About SCViewer" y="600">
|
<children xsi:type="basic:Window" xmi:id="_8BTkQIytEeWid7xO48ZBXw" elementId="com.minres.scviewer.e4.application.dialog.aboutscviewer" toBeRendered="false" visible="false" selectedElement="__VNlAIytEeWid7xO48ZBXw" label="About SCViewer" x="200" y="200">
|
||||||
<children xsi:type="basic:Part" xmi:id="__VNlAIytEeWid7xO48ZBXw" elementId="com.minres.scviewer.e4.application.part.0" contributionURI="bundleclass://com.minres.scviewer.e4.application/com.minres.scviewer.e4.application.parts.AboutDialog"/>
|
<children xsi:type="basic:Part" xmi:id="__VNlAIytEeWid7xO48ZBXw" elementId="com.minres.scviewer.e4.application.part.0" contributionURI="bundleclass://com.minres.scviewer.e4.application/com.minres.scviewer.e4.application.parts.AboutDialog"/>
|
||||||
</children>
|
</children>
|
||||||
<handlers xmi:id="_95PfvXNmEeWBq8z1Dv39LA" elementId="com.minres.scviewer.e4.application.handler.quitCommand" contributionURI="bundleclass://com.minres.scviewer.e4.application/com.minres.scviewer.e4.application.handlers.QuitHandler" command="_95PfvHNmEeWBq8z1Dv39LA"/>
|
<handlers xmi:id="_95PfvXNmEeWBq8z1Dv39LA" elementId="com.minres.scviewer.e4.application.handler.quitCommand" contributionURI="bundleclass://com.minres.scviewer.e4.application/com.minres.scviewer.e4.application.handlers.QuitHandler" command="_95PfvHNmEeWBq8z1Dv39LA"/>
|
||||||
|
@ -171,6 +171,8 @@
|
||||||
<handlers xmi:id="_297tsHXHEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.handler.deletewaveformCommand" contributionURI="bundleclass://com.minres.scviewer.e4.application/com.minres.scviewer.e4.application.handlers.DeleteWaveformHandler" command="_WUZ2wHXHEeWwZ-9vrAR2UQ"/>
|
<handlers xmi:id="_297tsHXHEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.handler.deletewaveformCommand" contributionURI="bundleclass://com.minres.scviewer.e4.application/com.minres.scviewer.e4.application.handlers.DeleteWaveformHandler" command="_WUZ2wHXHEeWwZ-9vrAR2UQ"/>
|
||||||
<handlers xmi:id="_2Ai4YHXHEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.handler.movewaveformupCommand" contributionURI="bundleclass://com.minres.scviewer.e4.application/com.minres.scviewer.e4.application.handlers.MoveWaveformHandler" command="_N_sOkHXHEeWwZ-9vrAR2UQ"/>
|
<handlers xmi:id="_2Ai4YHXHEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.handler.movewaveformupCommand" contributionURI="bundleclass://com.minres.scviewer.e4.application/com.minres.scviewer.e4.application.handlers.MoveWaveformHandler" command="_N_sOkHXHEeWwZ-9vrAR2UQ"/>
|
||||||
<handlers xmi:id="_Du1NAHcrEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.handler.zoomCommand" contributionURI="bundleclass://com.minres.scviewer.e4.application/com.minres.scviewer.e4.application.handlers.ZoomHandler" command="_693GoHcqEeWwZ-9vrAR2UQ"/>
|
<handlers xmi:id="_Du1NAHcrEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.handler.zoomCommand" contributionURI="bundleclass://com.minres.scviewer.e4.application/com.minres.scviewer.e4.application.handlers.ZoomHandler" command="_693GoHcqEeWwZ-9vrAR2UQ"/>
|
||||||
|
<handlers xmi:id="_bxt4QM3rEei6rfTGo88R-w" elementId="com.minres.scviewer.e4.application.handler.changeWaveDisplay" contributionURI="bundleclass://com.minres.scviewer.e4.application/com.minres.scviewer.e4.application.handlers.ChangeWaveformDisplay" command="_FZunYM2PEei6rfTGo88R-w"/>
|
||||||
|
<handlers xmi:id="_bxw7kM3rEei6rfTGo88R-w" elementId="com.minres.scviewer.e4.application.handler.changeValueDisplay" contributionURI="bundleclass://com.minres.scviewer.e4.application/com.minres.scviewer.e4.application.handlers.ChangeValueDisplay" command="_4C_asM3ZEei6rfTGo88R-w"/>
|
||||||
<menus xsi:type="menu:PopupMenu" xmi:id="_TwzrsHWSEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.popupmenu.namecontext" label="Name Menu">
|
<menus xsi:type="menu:PopupMenu" xmi:id="_TwzrsHWSEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.popupmenu.namecontext" label="Name Menu">
|
||||||
<children xsi:type="menu:HandledMenuItem" xmi:id="_Vco7YHWSEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.handledmenuitem.moveup" label="Move up" iconURI="platform:/plugin/com.minres.scviewer.e4.application/icons/up_blue.png" tooltip="Move stream/waveform in list up" command="_N_sOkHXHEeWwZ-9vrAR2UQ">
|
<children xsi:type="menu:HandledMenuItem" xmi:id="_Vco7YHWSEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.handledmenuitem.moveup" label="Move up" iconURI="platform:/plugin/com.minres.scviewer.e4.application/icons/up_blue.png" tooltip="Move stream/waveform in list up" command="_N_sOkHXHEeWwZ-9vrAR2UQ">
|
||||||
<visibleWhen xsi:type="ui:CoreExpression" xmi:id="_elFdcHr_EeWVM_sKoXvptg" coreExpressionId="com.minres.scviewer.e4.application.oneWaveSeleted"/>
|
<visibleWhen xsi:type="ui:CoreExpression" xmi:id="_elFdcHr_EeWVM_sKoXvptg" coreExpressionId="com.minres.scviewer.e4.application.oneWaveSeleted"/>
|
||||||
|
@ -204,40 +206,51 @@
|
||||||
<children xsi:type="menu:HandledMenuItem" xmi:id="_4ZeEQHabEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.handledmenuitem.previouschange" label="Previous Tx" iconURI="platform:/plugin/com.minres.scviewer.e4.application/icons/reverse_green.png" command="_Gn3lEHXKEeWwZ-9vrAR2UQ">
|
<children xsi:type="menu:HandledMenuItem" xmi:id="_4ZeEQHabEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.handledmenuitem.previouschange" label="Previous Tx" iconURI="platform:/plugin/com.minres.scviewer.e4.application/icons/reverse_green.png" command="_Gn3lEHXKEeWwZ-9vrAR2UQ">
|
||||||
<parameters xmi:id="_4ZeEQXabEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.parameter.5" name="com.minres.scviewer.e4.application.command.navigateTransCommand.parameter.dir" value="prev"/>
|
<parameters xmi:id="_4ZeEQXabEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.parameter.5" name="com.minres.scviewer.e4.application.command.navigateTransCommand.parameter.dir" value="prev"/>
|
||||||
</children>
|
</children>
|
||||||
|
<children xsi:type="menu:MenuSeparator" xmi:id="__Ubd4M1eEei6rfTGo88R-w" elementId="com.minres.scviewer.e4.application.menuseparator.0"/>
|
||||||
|
<children xsi:type="menu:Menu" xmi:id="_mAA6sM1bEei6rfTGo88R-w" elementId="com.minres.scviewer.e4.application.menu.view" label="View">
|
||||||
|
<visibleWhen xsi:type="ui:ImperativeExpression" xmi:id="_psvR0M1gEei6rfTGo88R-w" contributionURI="bundleclass://com.minres.scviewer.e4.application/com.minres.scviewer.e4.application.elements.WaveformPopupMenuContribution"/>
|
||||||
|
<children xsi:type="menu:DynamicMenuContribution" xmi:id="_IQZZQM3hEei6rfTGo88R-w" elementId="com.minres.scviewer.e4.application.dynamicmenucontribution.0" contributionURI="bundleclass://com.minres.scviewer.e4.application/com.minres.scviewer.e4.application.elements.WaveformPopupMenuContribution"/>
|
||||||
|
</children>
|
||||||
</menus>
|
</menus>
|
||||||
</descriptors>
|
</descriptors>
|
||||||
<commands xmi:id="_95PfvHNmEeWBq8z1Dv39LA" elementId="org.eclipse.ui.file.exit" commandName="quitCommand"/>
|
<commands xmi:id="_95PfvHNmEeWBq8z1Dv39LA" elementId="org.eclipse.ui.file.exit" commandName="Quit Command"/>
|
||||||
<commands xmi:id="_95PfwHNmEeWBq8z1Dv39LA" elementId="com.minres.scviewer.e4.application.open" commandName="openCommand"/>
|
<commands xmi:id="_95PfwHNmEeWBq8z1Dv39LA" elementId="com.minres.scviewer.e4.application.open" commandName="Open Command"/>
|
||||||
<commands xmi:id="_95Pfw3NmEeWBq8z1Dv39LA" elementId="org.eclipse.ui.file.save" commandName="saveCommand"/>
|
<commands xmi:id="_95Pfw3NmEeWBq8z1Dv39LA" elementId="org.eclipse.ui.file.save" commandName="Save Command"/>
|
||||||
<commands xmi:id="_95PfxnNmEeWBq8z1Dv39LA" elementId="org.eclipse.ui.help.aboutAction" commandName="aboutCommand"/>
|
<commands xmi:id="_95PfxnNmEeWBq8z1Dv39LA" elementId="org.eclipse.ui.help.aboutAction" commandName="About Command"/>
|
||||||
<commands xmi:id="_N_sOkHXHEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.command.movewaveformupCommand" commandName="moveWaveformCommand">
|
<commands xmi:id="_N_sOkHXHEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.command.movewaveformupCommand" commandName="Move Waveform Command">
|
||||||
<parameters xmi:id="_lMv-EHZWEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.command.movewaveformupCommand.parameter.dir" name="direction" optional="false"/>
|
<parameters xmi:id="_lMv-EHZWEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.command.movewaveformupCommand.parameter.dir" name="direction" optional="false"/>
|
||||||
</commands>
|
</commands>
|
||||||
<commands xmi:id="_WUZ2wHXHEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.command.deletewaveformCommand" commandName="deleteWaveformCommand"/>
|
<commands xmi:id="_WUZ2wHXHEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.command.deletewaveformCommand" commandName="Delete Waveform Command"/>
|
||||||
<commands xmi:id="_bV-TMHXHEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.command.selectallCommand" commandName="selectAllCommand"/>
|
<commands xmi:id="_bV-TMHXHEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.command.selectallCommand" commandName="Select All Command"/>
|
||||||
<commands xmi:id="_Gn3lEHXKEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.command.navigateTransCommand" commandName="navigateTransCommand" description="Navigate to related transaction">
|
<commands xmi:id="_Gn3lEHXKEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.command.navigateTransCommand" commandName="Navigate Transaction Command" description="Navigate to related transaction">
|
||||||
<parameters xmi:id="_howw0HXQEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.command.navigateTransCommand.parameter.dir" name="direction" optional="false"/>
|
<parameters xmi:id="_howw0HXQEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.command.navigateTransCommand.parameter.dir" name="direction" optional="false"/>
|
||||||
</commands>
|
</commands>
|
||||||
<commands xmi:id="_79rx4HabEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.command.navigateEventCommand" commandName="navigateEventCommand">
|
<commands xmi:id="_79rx4HabEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.command.navigateEventCommand" commandName="Navigate Event Command">
|
||||||
<parameters xmi:id="_79rx4XabEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.command.navigateEventCommand.parameter.dir" name="direction" optional="false"/>
|
<parameters xmi:id="_79rx4XabEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.command.navigateEventCommand.parameter.dir" name="direction" optional="false"/>
|
||||||
</commands>
|
</commands>
|
||||||
<commands xmi:id="_693GoHcqEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.command.zoomcommand" commandName="zoomCommand">
|
<commands xmi:id="_693GoHcqEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.command.zoomcommand" commandName="Zoom Command">
|
||||||
<parameters xmi:id="_8tbm0HcqEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.command.zoomcommand.parameter.level" name="level" optional="false"/>
|
<parameters xmi:id="_8tbm0HcqEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.command.zoomcommand.parameter.level" name="level" optional="false"/>
|
||||||
</commands>
|
</commands>
|
||||||
<commands xmi:id="_2PehEHr9EeWVM_sKoXvptg" elementId="com.minres.scviewer.e4.application.command.addwaveform" commandName="addWaveformCommand">
|
<commands xmi:id="_2PehEHr9EeWVM_sKoXvptg" elementId="com.minres.scviewer.e4.application.command.addwaveform" commandName="Add Waveform Command">
|
||||||
<parameters xmi:id="_6KsZcHr9EeWVM_sKoXvptg" elementId="com.minres.scviewer.e4.application.command.addwaveform.where" name="where" optional="false"/>
|
<parameters xmi:id="_6KsZcHr9EeWVM_sKoXvptg" elementId="com.minres.scviewer.e4.application.command.addwaveform.where" name="where" optional="false"/>
|
||||||
<parameters xmi:id="_7T1TcHwIEeWv0Y5uF2QN5w" elementId="com.minres.scviewer.e4.application.command.addwaveform.all" name="all" typeId="" optional="false"/>
|
<parameters xmi:id="_7T1TcHwIEeWv0Y5uF2QN5w" elementId="com.minres.scviewer.e4.application.command.addwaveform.all" name="all" typeId="" optional="false"/>
|
||||||
</commands>
|
</commands>
|
||||||
<commands xmi:id="_AxH6sIl_EeWxJ_wPkM6yGQ" elementId="org.eclipse.ui.window.preferences" commandName="Preferences"/>
|
<commands xmi:id="_AxH6sIl_EeWxJ_wPkM6yGQ" elementId="org.eclipse.ui.window.preferences" commandName="Preferences"/>
|
||||||
<commands xmi:id="_KlGlsIoNEeWxJ_wPkM6yGQ" elementId="com.minres.scviewer.e4.application.command.set_them" commandName="Set Theme">
|
<commands xmi:id="_KlGlsIoNEeWxJ_wPkM6yGQ" elementId="com.minres.scviewer.e4.application.command.set_them" commandName="Set Theme Command">
|
||||||
<parameters xmi:id="_O8Z9IIoNEeWxJ_wPkM6yGQ" elementId="com.minres.scviewer.e4.application.command.theme.parameter.id" name="themeId" optional="false"/>
|
<parameters xmi:id="_O8Z9IIoNEeWxJ_wPkM6yGQ" elementId="com.minres.scviewer.e4.application.command.theme.parameter.id" name="themeId" optional="false"/>
|
||||||
</commands>
|
</commands>
|
||||||
<commands xmi:id="_E9lUgIt2EeWid7xO48ZBXw" elementId="com.minres.scviewer.e4.application.command.setrelationtype" commandName="SetRelationType">
|
<commands xmi:id="_E9lUgIt2EeWid7xO48ZBXw" elementId="com.minres.scviewer.e4.application.command.setrelationtype" commandName="Set Relation Type Command">
|
||||||
<parameters xmi:id="_xnW7IIt_EeWid7xO48ZBXw" elementId="com.minres.scviewer.e4.application.commandparameter.relationName" name="relationName" optional="false"/>
|
<parameters xmi:id="_xnW7IIt_EeWid7xO48ZBXw" elementId="com.minres.scviewer.e4.application.commandparameter.relationName" name="relationName" optional="false"/>
|
||||||
</commands>
|
</commands>
|
||||||
<commands xmi:id="_7-AIMJebEeW09eyIbHsdvg" elementId="com.minres.scviewer.e4.application.command.loadStoreSettings" commandName="loadStoreSettings">
|
<commands xmi:id="_7-AIMJebEeW09eyIbHsdvg" elementId="com.minres.scviewer.e4.application.command.loadStoreSettings" commandName="Load-Store Settings Command">
|
||||||
<parameters xmi:id="_wxY3EJehEeW09eyIbHsdvg" elementId="com.minres.scviewer.e4.application.commandparameter.loadStore" name="loadStore"/>
|
<parameters xmi:id="_wxY3EJehEeW09eyIbHsdvg" elementId="com.minres.scviewer.e4.application.commandparameter.loadStore" name="loadStore"/>
|
||||||
</commands>
|
</commands>
|
||||||
|
<commands xmi:id="_FZunYM2PEei6rfTGo88R-w" elementId="com.minres.scviewer.e4.application.command.changewavedisplay" commandName="Change Waveform Display Command">
|
||||||
|
<parameters xmi:id="_P6PYwM2PEei6rfTGo88R-w" elementId="com.minres.scviewer.e4.application.commandparameter.changewavedisplay" name="Type" optional="false"/>
|
||||||
|
</commands>
|
||||||
|
<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>
|
||||||
<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="_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="_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"/>
|
<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-ManifestVersion: 2
|
||||||
Bundle-Name: %Bundle-Name
|
Bundle-Name: %Bundle-Name
|
||||||
Bundle-SymbolicName: com.minres.scviewer.e4.application;singleton:=true
|
Bundle-SymbolicName: com.minres.scviewer.e4.application;singleton:=true
|
||||||
Bundle-Version: 1.1.0.qualifier
|
Bundle-Version: 2.0.0.qualifier
|
||||||
Bundle-Vendor: %Bundle-Vendor
|
Bundle-Vendor: %Bundle-Vendor
|
||||||
Require-Bundle: javax.inject;bundle-version="1.0.0",
|
Require-Bundle: javax.inject;bundle-version="1.0.0",
|
||||||
org.eclipse.core.runtime;bundle-version="3.11.1",
|
org.eclipse.core.runtime;bundle-version="3.11.1",
|
||||||
|
@ -32,6 +32,7 @@ Require-Bundle: javax.inject;bundle-version="1.0.0",
|
||||||
com.opcoach.e4.preferences,
|
com.opcoach.e4.preferences,
|
||||||
org.eclipse.e4.core.di.extensions,
|
org.eclipse.e4.core.di.extensions,
|
||||||
org.eclipse.e4.ui.css.swt.theme;bundle-version="0.10.0"
|
org.eclipse.e4.ui.css.swt.theme;bundle-version="0.10.0"
|
||||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
|
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
|
||||||
Import-Package: com.minres.scviewer.database,
|
Import-Package: com.minres.scviewer.database,
|
||||||
javax.inject;version="1.0.0"
|
javax.inject;version="1.0.0"
|
||||||
|
Automatic-Module-Name: com.minres.scviewer.e4.application
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
<product
|
<product
|
||||||
application="org.eclipse.e4.ui.workbench.swt.E4Application"
|
application="org.eclipse.e4.ui.workbench.swt.E4Application"
|
||||||
description="%product.description"
|
description="%product.description"
|
||||||
name="%product.name">
|
name="SCViewer">
|
||||||
<property
|
<property
|
||||||
name="lifeCycleURI"
|
name="lifeCycleURI"
|
||||||
value="bundleclass://com.minres.scviewer.e4.application/com.minres.scviewer.e4.application.E4LifeCycle">
|
value="bundleclass://com.minres.scviewer.e4.application/com.minres.scviewer.e4.application.E4LifeCycle">
|
||||||
|
@ -16,10 +16,6 @@
|
||||||
name="appName"
|
name="appName"
|
||||||
value="SCViewer">
|
value="SCViewer">
|
||||||
</property>
|
</property>
|
||||||
<property
|
|
||||||
name="windowImages"
|
|
||||||
value="icons/SCViewer_16x32.png,icons/SCViewer_32x32.png,icons/SCViewer_48x32.png,icons/SCViewer_64x32.png,icons/SCViewer_128x32.png,icons/SCViewer_256x32.png">
|
|
||||||
</property>
|
|
||||||
<property
|
<property
|
||||||
name="applicationCSS"
|
name="applicationCSS"
|
||||||
value="platform:/plugin/com.minres.scviewer.e4.application/css/default.css">
|
value="platform:/plugin/com.minres.scviewer.e4.application/css/default.css">
|
||||||
|
|
|
@ -4,9 +4,8 @@
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.minres.scviewer</groupId>
|
<groupId>com.minres.scviewer</groupId>
|
||||||
<artifactId>com.minres.scviewer.parent</artifactId>
|
<artifactId>com.minres.scviewer.parent</artifactId>
|
||||||
<version>1.0.0-SNAPSHOT</version>
|
<version>2.0.0-SNAPSHOT</version>
|
||||||
<relativePath>../com.minres.scviewer.parent</relativePath>
|
<relativePath>../com.minres.scviewer.parent</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<packaging>eclipse-plugin</packaging>
|
<packaging>eclipse-plugin</packaging>
|
||||||
<version>1.1.0-SNAPSHOT</version>
|
|
||||||
</project>
|
</project>
|
|
@ -33,6 +33,10 @@ import org.eclipse.equinox.app.IApplicationContext;
|
||||||
import org.osgi.service.event.Event;
|
import org.osgi.service.event.Event;
|
||||||
import org.osgi.service.event.EventHandler;
|
import org.osgi.service.event.EventHandler;
|
||||||
|
|
||||||
|
import com.minres.scviewer.e4.application.options.Options;
|
||||||
|
import com.minres.scviewer.e4.application.options.Options.Multiplicity;
|
||||||
|
import com.minres.scviewer.e4.application.options.Options.Separator;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This implementation contains e4 LifeCycle annotated methods.<br />
|
* This implementation contains e4 LifeCycle annotated methods.<br />
|
||||||
* There is a corresponding entry in <em>plugin.xml</em> (under the
|
* There is a corresponding entry in <em>plugin.xml</em> (under the
|
||||||
|
@ -60,17 +64,28 @@ public class E4LifeCycle {
|
||||||
@PostContextCreate
|
@PostContextCreate
|
||||||
void postContextCreate(IApplicationContext appContext, final IEventBroker eventBroker) {
|
void postContextCreate(IApplicationContext appContext, final IEventBroker eventBroker) {
|
||||||
final String[] args = (String[])appContext.getArguments().get(IApplicationContext.APPLICATION_ARGS);
|
final String[] args = (String[])appContext.getArguments().get(IApplicationContext.APPLICATION_ARGS);
|
||||||
|
Options opt = new Options(args, 0);
|
||||||
|
opt.getSet()
|
||||||
|
.addOption("clearPersistedState", Multiplicity.ZERO_OR_ONE)
|
||||||
|
.addOption("c", Separator.BLANK, Multiplicity.ZERO_OR_ONE);
|
||||||
|
if (!opt.check(Options.DEFAULT_SET, true, false)) {
|
||||||
|
System.err.println(opt.getCheckErrors());
|
||||||
|
System.exit(1);
|
||||||
|
}
|
||||||
|
final String confFile =opt.getSet().isSet("c")?opt.getSet().getOption("c").getResultValue(0):"";
|
||||||
|
|
||||||
// react on the first view being created, at that time the UI is available
|
// react on the first view being created, at that time the UI is available
|
||||||
eventBroker.subscribe(UIEvents.UILifeCycle.ACTIVATE, new EventHandler() {
|
eventBroker.subscribe(UIEvents.UILifeCycle.ACTIVATE, new EventHandler() {
|
||||||
@Override
|
@Override
|
||||||
public void handleEvent(Event event) {
|
public void handleEvent(Event event) {
|
||||||
MPart part = (MPart) event.getProperty("ChangedElement");
|
MPart part = (MPart) event.getProperty("ChangedElement"); //$NON-NLS-1$
|
||||||
if(part!=null){
|
if(part!=null){
|
||||||
IEclipseContext ctx = part.getContext();
|
IEclipseContext ctx = part.getContext();
|
||||||
OpenViewHandler openViewHandler= new OpenViewHandler();
|
OpenViewHandler openViewHandler= new OpenViewHandler();
|
||||||
|
if(confFile.length()>0) openViewHandler.setConfigFile(confFile);
|
||||||
ContextInjectionFactory.inject(openViewHandler, ctx);
|
ContextInjectionFactory.inject(openViewHandler, ctx);
|
||||||
eventBroker.unsubscribe(this);
|
eventBroker.unsubscribe(this);
|
||||||
for(String name:args){
|
for(String name:opt.getSet().getData()){
|
||||||
if(new File(name).exists()) openViewHandler.openViewForFile(name);
|
if(new File(name).exists()) openViewHandler.openViewForFile(name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -115,7 +130,7 @@ public class E4LifeCycle {
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
boolean first=true;
|
boolean first=true;
|
||||||
for(String token:tokens){
|
for(String token:tokens){
|
||||||
if(!first) sb.append(",");
|
if(!first) sb.append(","); //$NON-NLS-1$
|
||||||
sb.append(token);
|
sb.append(token);
|
||||||
first=false;
|
first=false;
|
||||||
}
|
}
|
||||||
|
@ -136,6 +151,7 @@ public class E4LifeCycle {
|
||||||
/** The part service. */
|
/** The part service. */
|
||||||
@Inject EPartService partService;
|
@Inject EPartService partService;
|
||||||
|
|
||||||
|
String confFile="";
|
||||||
/**
|
/**
|
||||||
* Open view for file.
|
* Open view for file.
|
||||||
*
|
*
|
||||||
|
@ -143,14 +159,20 @@ public class E4LifeCycle {
|
||||||
*/
|
*/
|
||||||
public void openViewForFile(String name){
|
public void openViewForFile(String name){
|
||||||
File file = new File(name);
|
File file = new File(name);
|
||||||
MPart part = partService.createPart("com.minres.scviewer.e4.application.partdescriptor.waveformviewer");
|
MPart part = partService.createPart("com.minres.scviewer.e4.application.partdescriptor.waveformviewer"); //$NON-NLS-1$
|
||||||
part.setLabel(file.getName());
|
part.setLabel(file.getName());
|
||||||
MPartStack partStack = (MPartStack)modelService.find("org.eclipse.editorss", app);
|
MPartStack partStack = (MPartStack)modelService.find("org.eclipse.editorss", app); //$NON-NLS-1$
|
||||||
partStack.getChildren().add(part);
|
partStack.getChildren().add(part);
|
||||||
partService.showPart(part, PartState.ACTIVATE);
|
partService.showPart(part, PartState.ACTIVATE);
|
||||||
IEclipseContext ctx=part.getContext();
|
IEclipseContext ctx=part.getContext();
|
||||||
ctx.modify("input", file);
|
ctx.modify("input", file); //$NON-NLS-1$
|
||||||
ctx.declareModifiable("input");
|
//ctx.declareModifiable("input"); //$NON-NLS-1$
|
||||||
|
ctx.modify("config", confFile); //$NON-NLS-1$
|
||||||
|
//ctx.declareModifiable("config"); //$NON-NLS-1$
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setConfigFile(String confFile) {
|
||||||
|
this.confFile=confFile;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,66 @@
|
||||||
|
package com.minres.scviewer.e4.application;
|
||||||
|
|
||||||
|
import org.eclipse.osgi.util.NLS;
|
||||||
|
|
||||||
|
public class Messages extends NLS {
|
||||||
|
private static final String BUNDLE_NAME = "com.minres.scviewer.e4.application.messages"; //$NON-NLS-1$
|
||||||
|
public static String AboutDialog_0;
|
||||||
|
public static String AboutDialog_1;
|
||||||
|
public static String DesignBrowser_12;
|
||||||
|
public static String DesignBrowser_16;
|
||||||
|
public static String DesignBrowser_2;
|
||||||
|
public static String DesignBrowser_4;
|
||||||
|
public static String DesignBrowser_8;
|
||||||
|
public static String LoadingWaveformDb_0;
|
||||||
|
public static String LoadStoreSettingsHandler_2;
|
||||||
|
public static String LoadStoreSettingsHandler_3;
|
||||||
|
public static String OpenHandler_0;
|
||||||
|
public static String QuitHandler_0;
|
||||||
|
public static String QuitHandler_1;
|
||||||
|
public static String RelationTypeToolControl_0;
|
||||||
|
public static String RelationTypeToolControl_1;
|
||||||
|
public static String ResourceManager_0;
|
||||||
|
public static String SCViewerPreferencesPage_0;
|
||||||
|
public static String StatusBarControl_1;
|
||||||
|
public static String StatusBarControl_2;
|
||||||
|
public static String StatusBarControl_3;
|
||||||
|
public static String StatusBarControl_4;
|
||||||
|
public static String SWTResourceManager_0;
|
||||||
|
public static String TransactionDetails_0;
|
||||||
|
public static String TransactionDetails_1;
|
||||||
|
public static String TransactionDetails_10;
|
||||||
|
public static String TransactionDetails_11;
|
||||||
|
public static String TransactionDetails_12;
|
||||||
|
public static String TransactionDetails_13;
|
||||||
|
public static String TransactionDetails_16;
|
||||||
|
public static String TransactionDetails_19;
|
||||||
|
public static String TransactionDetails_2;
|
||||||
|
public static String TransactionDetails_20;
|
||||||
|
public static String TransactionDetails_21;
|
||||||
|
public static String TransactionDetails_3;
|
||||||
|
public static String TransactionDetails_4;
|
||||||
|
public static String WaveformPreferencesPage_1;
|
||||||
|
public static String WaveformViewer_15;
|
||||||
|
public static String WaveformViewer_16;
|
||||||
|
public static String WaveformViewer_17;
|
||||||
|
public static String WaveformViewer_18;
|
||||||
|
public static String WaveformViewer_19;
|
||||||
|
public static String WaveformViewer_20;
|
||||||
|
public static String WaveformViewer_21;
|
||||||
|
public static String WaveformViewer_37;
|
||||||
|
public static String WaveformViewer_38;
|
||||||
|
public static String WaveformViewer_39;
|
||||||
|
public static String WaveStatusBarControl_10;
|
||||||
|
public static String WaveStatusBarControl_12;
|
||||||
|
public static String WaveStatusBarControl_5;
|
||||||
|
public static String WaveStatusBarControl_6;
|
||||||
|
public static String WaveStatusBarControl_7;
|
||||||
|
public static String WaveStatusBarControl_8;
|
||||||
|
static {
|
||||||
|
// initialize resource bundle
|
||||||
|
NLS.initializeMessages(BUNDLE_NAME, Messages.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
private Messages() {
|
||||||
|
}
|
||||||
|
}
|
|
@ -32,7 +32,7 @@ import com.minres.scviewer.e4.application.parts.WaveformViewer;
|
||||||
/**
|
/**
|
||||||
* The Class NavigateContribution. Currently not used in Application.e4xmi
|
* The Class NavigateContribution. Currently not used in Application.e4xmi
|
||||||
*/
|
*/
|
||||||
public class NavigateContribution {
|
public class NavigateToolbarContribution {
|
||||||
|
|
||||||
/** The part service. */
|
/** The part service. */
|
||||||
@Inject EPartService partService;
|
@Inject EPartService partService;
|
||||||
|
@ -54,7 +54,7 @@ public class NavigateContribution {
|
||||||
WaveformViewer waveformViewerPart = (WaveformViewer) part.getObject();
|
WaveformViewer waveformViewerPart = (WaveformViewer) part.getObject();
|
||||||
RelationType relationTypeFilter = waveformViewerPart.getRelationTypeFilter();
|
RelationType relationTypeFilter = waveformViewerPart.getRelationTypeFilter();
|
||||||
MCommand command = modelService.findElements(application,
|
MCommand command = modelService.findElements(application,
|
||||||
"com.minres.scviewer.e4.application.command.setrelationtype", MCommand.class, null).get(0);
|
"com.minres.scviewer.e4.application.command.setrelationtype", MCommand.class, null).get(0); //$NON-NLS-1$
|
||||||
MCommandParameter commandParameter = command.getParameters().get(0);
|
MCommandParameter commandParameter = command.getParameters().get(0);
|
||||||
for(RelationType relationType:waveformViewerPart.getAllRelationTypes()){
|
for(RelationType relationType:waveformViewerPart.getAllRelationTypes()){
|
||||||
// MDirectMenuItem dynamicItem = modelService.createModelElement(MDirectMenuItem.class);
|
// MDirectMenuItem dynamicItem = modelService.createModelElement(MDirectMenuItem.class);
|
||||||
|
@ -69,15 +69,15 @@ public class NavigateContribution {
|
||||||
MParameter parameter=modelService.createModelElement(MParameter.class);
|
MParameter parameter=modelService.createModelElement(MParameter.class);
|
||||||
parameter.setName(commandParameter.getElementId());
|
parameter.setName(commandParameter.getElementId());
|
||||||
parameter.setValue(relationType.getName());
|
parameter.setValue(relationType.getName());
|
||||||
parameter.setContributorURI("platform:/plugin/com.minres.scviewer.e4.application");
|
parameter.setContributorURI("platform:/plugin/com.minres.scviewer.e4.application"); //$NON-NLS-1$
|
||||||
MHandledMenuItem handledMenuItem= modelService.createModelElement(MHandledMenuItem.class);
|
MHandledMenuItem handledMenuItem= modelService.createModelElement(MHandledMenuItem.class);
|
||||||
handledMenuItem.setLabel(relationType.getName());
|
handledMenuItem.setLabel(relationType.getName());
|
||||||
if(relationTypeFilter.equals(relationType)){
|
if(relationTypeFilter.equals(relationType)){
|
||||||
handledMenuItem.setEnabled(false);
|
handledMenuItem.setEnabled(false);
|
||||||
handledMenuItem.setIconURI("platform:/plugin/com.minres.scviewer.e4.application/icons/tick.png");
|
handledMenuItem.setIconURI("platform:/plugin/com.minres.scviewer.e4.application/icons/tick.png"); //$NON-NLS-1$
|
||||||
}else
|
}else
|
||||||
handledMenuItem.setIconURI("platform:/plugin/com.minres.scviewer.e4.application/icons/empty.png");
|
handledMenuItem.setIconURI("platform:/plugin/com.minres.scviewer.e4.application/icons/empty.png"); //$NON-NLS-1$
|
||||||
handledMenuItem.setContributorURI("platform:/plugin/com.minres.scviewer.e4.application");
|
handledMenuItem.setContributorURI("platform:/plugin/com.minres.scviewer.e4.application"); //$NON-NLS-1$
|
||||||
handledMenuItem.setCommand(command);
|
handledMenuItem.setCommand(command);
|
||||||
handledMenuItem.getParameters().add(parameter);
|
handledMenuItem.getParameters().add(parameter);
|
||||||
items.add(handledMenuItem);
|
items.add(handledMenuItem);
|
|
@ -31,6 +31,7 @@ import org.eclipse.swt.widgets.Composite;
|
||||||
|
|
||||||
import com.minres.scviewer.database.ITx;
|
import com.minres.scviewer.database.ITx;
|
||||||
import com.minres.scviewer.database.RelationType;
|
import com.minres.scviewer.database.RelationType;
|
||||||
|
import com.minres.scviewer.e4.application.Messages;
|
||||||
import com.minres.scviewer.e4.application.parts.PartListener;
|
import com.minres.scviewer.e4.application.parts.PartListener;
|
||||||
import com.minres.scviewer.e4.application.parts.WaveformViewer;
|
import com.minres.scviewer.e4.application.parts.WaveformViewer;
|
||||||
|
|
||||||
|
@ -49,7 +50,7 @@ public class RelationTypeToolControl extends PartListener implements ISelectionC
|
||||||
WaveformViewer waveformViewerPart;
|
WaveformViewer waveformViewerPart;
|
||||||
|
|
||||||
/** The dummy. */
|
/** The dummy. */
|
||||||
RelationType dummy = RelationType.create("------------");
|
RelationType dummy = RelationType.create(Messages.RelationTypeToolControl_0);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instantiates a new relation type tool control.
|
* Instantiates a new relation type tool control.
|
||||||
|
@ -72,7 +73,7 @@ public class RelationTypeToolControl extends PartListener implements ISelectionC
|
||||||
comboViewer = new ComboViewer(parent, SWT.NONE);
|
comboViewer = new ComboViewer(parent, SWT.NONE);
|
||||||
Combo comboBox = comboViewer.getCombo();
|
Combo comboBox = comboViewer.getCombo();
|
||||||
comboBox.setBounds(0, 0, 26, 22);
|
comboBox.setBounds(0, 0, 26, 22);
|
||||||
comboBox.setText("Select");
|
comboBox.setText(Messages.RelationTypeToolControl_1);
|
||||||
comboViewer.setContentProvider(new ArrayContentProvider());
|
comboViewer.setContentProvider(new ArrayContentProvider());
|
||||||
comboViewer.setInput(new RelationType[] {dummy});
|
comboViewer.setInput(new RelationType[] {dummy});
|
||||||
comboViewer.setSelection(new StructuredSelection(dummy));
|
comboViewer.setSelection(new StructuredSelection(dummy));
|
||||||
|
|
|
@ -0,0 +1,131 @@
|
||||||
|
|
||||||
|
package com.minres.scviewer.e4.application.elements;
|
||||||
|
|
||||||
|
import java.util.Iterator;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import javax.inject.Inject;
|
||||||
|
|
||||||
|
import org.eclipse.e4.core.di.annotations.Evaluate;
|
||||||
|
import org.eclipse.e4.ui.di.AboutToHide;
|
||||||
|
import org.eclipse.e4.ui.di.AboutToShow;
|
||||||
|
import org.eclipse.e4.ui.model.application.MApplication;
|
||||||
|
import org.eclipse.e4.ui.model.application.commands.MCommand;
|
||||||
|
import org.eclipse.e4.ui.model.application.commands.MCommandsFactory;
|
||||||
|
import org.eclipse.e4.ui.model.application.commands.MParameter;
|
||||||
|
import org.eclipse.e4.ui.model.application.ui.basic.MPart;
|
||||||
|
import org.eclipse.e4.ui.model.application.ui.menu.ItemType;
|
||||||
|
import org.eclipse.e4.ui.model.application.ui.menu.MHandledMenuItem;
|
||||||
|
import org.eclipse.e4.ui.model.application.ui.menu.MMenuElement;
|
||||||
|
import org.eclipse.e4.ui.model.application.ui.menu.MMenuFactory;
|
||||||
|
import org.eclipse.e4.ui.workbench.modeling.EModelService;
|
||||||
|
import org.eclipse.jface.viewers.ISelection;
|
||||||
|
import org.eclipse.jface.viewers.IStructuredSelection;
|
||||||
|
|
||||||
|
import com.minres.scviewer.database.ISignal;
|
||||||
|
import com.minres.scviewer.database.ISignalChange;
|
||||||
|
import com.minres.scviewer.database.ISignalChangeBitVector;
|
||||||
|
import com.minres.scviewer.database.ISignalChangeReal;
|
||||||
|
import com.minres.scviewer.database.ui.TrackEntry;
|
||||||
|
import com.minres.scviewer.e4.application.parts.WaveformViewer;
|
||||||
|
|
||||||
|
public class WaveformPopupMenuContribution {
|
||||||
|
int counter=0;
|
||||||
|
|
||||||
|
@Inject MPart activePart;
|
||||||
|
|
||||||
|
final TrackEntry nullEntry = new TrackEntry(null);
|
||||||
|
|
||||||
|
@Evaluate
|
||||||
|
public boolean evaluate() {
|
||||||
|
Object obj = activePart.getObject();
|
||||||
|
if(obj instanceof WaveformViewer){
|
||||||
|
WaveformViewer wfv = (WaveformViewer)obj;
|
||||||
|
ISelection sel = wfv.getSelection();
|
||||||
|
if(!sel.isEmpty() && sel instanceof IStructuredSelection) {
|
||||||
|
Object selected = ((IStructuredSelection)sel).getFirstElement();
|
||||||
|
if(selected instanceof ISignal<?>) {
|
||||||
|
ISignalChange s = (ISignalChange) ((ISignal<?>) selected).getEvents().firstEntry().getValue();
|
||||||
|
if((s instanceof ISignalChangeReal) || (s instanceof ISignalChangeBitVector)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@AboutToShow
|
||||||
|
public void aboutToShow(List<MMenuElement> items, MApplication application, EModelService modelService) {
|
||||||
|
Object obj = activePart.getObject();
|
||||||
|
if(obj instanceof WaveformViewer){
|
||||||
|
WaveformViewer wfv = (WaveformViewer)obj;
|
||||||
|
ISelection sel = wfv.getSelection();
|
||||||
|
if(!sel.isEmpty() && sel instanceof IStructuredSelection) {
|
||||||
|
Iterator<?> it = ((IStructuredSelection)sel).iterator();
|
||||||
|
Object first = it.next();
|
||||||
|
Object second=null;
|
||||||
|
if(it.hasNext()) second=it.next();
|
||||||
|
if(first instanceof ISignal<?>) {
|
||||||
|
ISignalChange s = (ISignalChange) ((ISignal<?>) first).getEvents().firstEntry().getValue();
|
||||||
|
//com.minres.scviewer.e4.application.menu.mulitvaluesettings
|
||||||
|
if((s instanceof ISignalChangeReal) || (s instanceof ISignalChangeBitVector)) {
|
||||||
|
TrackEntry entry=nullEntry;
|
||||||
|
if(second instanceof TrackEntry)
|
||||||
|
entry=(TrackEntry)second;
|
||||||
|
if(s instanceof ISignalChangeBitVector) {
|
||||||
|
addValueMenuItem(items, application, modelService, "hex", TrackEntry.ValueDisplay.DEFAULT, entry.valueDisplay);
|
||||||
|
addValueMenuItem(items, application, modelService, "unsigned", TrackEntry.ValueDisplay.UNSIGNED, entry.valueDisplay);
|
||||||
|
addValueMenuItem(items, application, modelService, "signed", TrackEntry.ValueDisplay.SIGNED, entry.valueDisplay);
|
||||||
|
items.add(MMenuFactory.INSTANCE.createMenuSeparator());
|
||||||
|
addWaveMenuItem(items, application, modelService, "bit vector", TrackEntry.WaveDisplay.DEFAULT, entry.waveDisplay);
|
||||||
|
}
|
||||||
|
addWaveMenuItem(items, application, modelService, "analog step-wise", TrackEntry.WaveDisplay.STEP_WISE, entry.waveDisplay);
|
||||||
|
addWaveMenuItem(items, application, modelService, "analog continous", TrackEntry.WaveDisplay.CONTINOUS, entry.waveDisplay);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void addValueMenuItem(List<MMenuElement> items, MApplication application, EModelService modelService,
|
||||||
|
String label, TrackEntry.ValueDisplay value, TrackEntry.ValueDisplay actual) {
|
||||||
|
MHandledMenuItem item = MMenuFactory.INSTANCE.createHandledMenuItem();
|
||||||
|
item.setType(ItemType.RADIO);
|
||||||
|
item.setSelected(value==actual);
|
||||||
|
item.setLabel("Show as "+label);
|
||||||
|
item.setContributorURI("platform:/plugin/com.minres.scviewer.e4.application");
|
||||||
|
List<MCommand> cmds = modelService.findElements(application, "com.minres.scviewer.e4.application.command.changevaluedisplay", MCommand.class, null);
|
||||||
|
if(cmds.size()!=1) System.err.println("No command found!");
|
||||||
|
else item.setCommand(cmds.get(0));
|
||||||
|
MParameter param = MCommandsFactory.INSTANCE.createParameter();
|
||||||
|
param.setName("com.minres.scviewer.e4.application.commandparameter.changevaluedisplay");
|
||||||
|
param.setValue(value.toString());
|
||||||
|
item.getParameters().add(param);
|
||||||
|
items.add(item);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void addWaveMenuItem(List<MMenuElement> items, MApplication application, EModelService modelService,
|
||||||
|
String label, TrackEntry.WaveDisplay value, TrackEntry.WaveDisplay actual) {
|
||||||
|
MHandledMenuItem item = MMenuFactory.INSTANCE.createHandledMenuItem();
|
||||||
|
item.setType(ItemType.RADIO);
|
||||||
|
item.setSelected(value==actual);
|
||||||
|
item.setLabel("Render "+label);
|
||||||
|
item.setContributorURI("platform:/plugin/com.minres.scviewer.e4.application");
|
||||||
|
List<MCommand> cmds = modelService.findElements(application, "com.minres.scviewer.e4.application.command.changewavedisplay", MCommand.class, null);
|
||||||
|
if(cmds.size()!=1) System.err.println("No command found!");
|
||||||
|
else item.setCommand(cmds.get(0));
|
||||||
|
MParameter param = MCommandsFactory.INSTANCE.createParameter();
|
||||||
|
param.setName("com.minres.scviewer.e4.application.commandparameter.changewavedisplay");
|
||||||
|
param.setValue(value.toString());
|
||||||
|
item.getParameters().add(param);
|
||||||
|
items.add(item);
|
||||||
|
}
|
||||||
|
|
||||||
|
@AboutToHide
|
||||||
|
public void aboutToHide(List<MMenuElement> items) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -12,16 +12,17 @@ package com.minres.scviewer.e4.application.handlers;
|
||||||
|
|
||||||
import org.eclipse.e4.core.di.annotations.Execute;
|
import org.eclipse.e4.core.di.annotations.Execute;
|
||||||
import org.eclipse.e4.ui.model.application.MApplication;
|
import org.eclipse.e4.ui.model.application.MApplication;
|
||||||
import org.eclipse.e4.ui.model.application.ui.basic.MDialog;
|
|
||||||
import org.eclipse.e4.ui.model.application.ui.basic.MWindow;
|
import org.eclipse.e4.ui.model.application.ui.basic.MWindow;
|
||||||
import org.eclipse.e4.ui.workbench.modeling.EModelService;
|
import org.eclipse.e4.ui.workbench.modeling.EModelService;
|
||||||
import org.eclipse.swt.widgets.Shell;
|
import org.eclipse.swt.widgets.Shell;
|
||||||
|
|
||||||
public class AboutHandler {
|
public class AboutHandler {
|
||||||
|
|
||||||
|
static final String DIALOG_ID="com.minres.scviewer.e4.application.dialog.aboutscviewer";
|
||||||
|
|
||||||
@Execute
|
@Execute
|
||||||
public void execute(Shell shell, MApplication app, MWindow window, EModelService ms /*@Named("mdialog01.dialog.0") MDialog dialog*/) {
|
public void execute(Shell shell, MApplication app, MWindow window, EModelService ms /*@Named("mdialog01.dialog.0") MDialog dialog*/) {
|
||||||
MDialog dialog = (MDialog) ms.find("com.minres.scviewer.e4.application.dialog.aboutscviewer", app);
|
MWindow dialog = (MWindow) ms.find(DIALOG_ID, app); //$NON-NLS-1$
|
||||||
dialog.setToBeRendered(true);
|
dialog.setToBeRendered(true);
|
||||||
dialog.setToBeRendered(false);
|
dialog.setToBeRendered(false);
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,8 +29,8 @@ import com.minres.scviewer.e4.application.parts.DesignBrowser;
|
||||||
|
|
||||||
public class AddWaveformHandler {
|
public class AddWaveformHandler {
|
||||||
|
|
||||||
public final static String PARAM_WHERE_ID="com.minres.scviewer.e4.application.command.addwaveform.where";
|
public final static String PARAM_WHERE_ID="com.minres.scviewer.e4.application.command.addwaveform.where"; //$NON-NLS-1$
|
||||||
public final static String PARAM_ALL_ID="com.minres.scviewer.e4.application.command.addwaveform.all";
|
public final static String PARAM_ALL_ID="com.minres.scviewer.e4.application.command.addwaveform.all"; //$NON-NLS-1$
|
||||||
|
|
||||||
@Inject @Optional DesignBrowser designBrowser;
|
@Inject @Optional DesignBrowser designBrowser;
|
||||||
|
|
||||||
|
@ -40,8 +40,8 @@ public class AddWaveformHandler {
|
||||||
@Named(IServiceConstants.ACTIVE_SELECTION) @Optional IStructuredSelection selection) {
|
@Named(IServiceConstants.ACTIVE_SELECTION) @Optional IStructuredSelection selection) {
|
||||||
if(designBrowser==null) designBrowser = getListPart( partService);
|
if(designBrowser==null) designBrowser = getListPart( partService);
|
||||||
if(designBrowser==null || designBrowser.getActiveWaveformViewerPart()==null) return false;
|
if(designBrowser==null || designBrowser.getActiveWaveformViewerPart()==null) return false;
|
||||||
Boolean before = "before".equalsIgnoreCase(where);
|
Boolean before = "before".equalsIgnoreCase(where); //$NON-NLS-1$
|
||||||
if("true".equalsIgnoreCase(all))
|
if("true".equalsIgnoreCase(all)) //$NON-NLS-1$
|
||||||
return designBrowser.getFilteredChildren().length>0 &&
|
return designBrowser.getFilteredChildren().length>0 &&
|
||||||
(!before || ((IStructuredSelection)designBrowser.getActiveWaveformViewerPart().getSelection()).size()>0);
|
(!before || ((IStructuredSelection)designBrowser.getActiveWaveformViewerPart().getSelection()).size()>0);
|
||||||
else
|
else
|
||||||
|
@ -57,7 +57,7 @@ public class AddWaveformHandler {
|
||||||
if(designBrowser!=null && selection.size()>0){
|
if(designBrowser!=null && selection.size()>0){
|
||||||
List<?> sel=selection.toList();
|
List<?> sel=selection.toList();
|
||||||
designBrowser.getActiveWaveformViewerPart().addStreamsToList(sel.toArray(new IWaveform<?>[]{}),
|
designBrowser.getActiveWaveformViewerPart().addStreamsToList(sel.toArray(new IWaveform<?>[]{}),
|
||||||
"before".equalsIgnoreCase(where));
|
"before".equalsIgnoreCase(where)); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,51 @@
|
||||||
|
|
||||||
|
package com.minres.scviewer.e4.application.handlers;
|
||||||
|
|
||||||
|
import java.util.Iterator;
|
||||||
|
|
||||||
|
import javax.inject.Named;
|
||||||
|
|
||||||
|
import org.eclipse.e4.core.di.annotations.CanExecute;
|
||||||
|
import org.eclipse.e4.core.di.annotations.Execute;
|
||||||
|
import org.eclipse.e4.ui.model.application.ui.basic.MPart;
|
||||||
|
import org.eclipse.e4.ui.workbench.modeling.EPartService;
|
||||||
|
import org.eclipse.jface.viewers.ISelection;
|
||||||
|
import org.eclipse.jface.viewers.IStructuredSelection;
|
||||||
|
|
||||||
|
import com.minres.scviewer.database.ui.TrackEntry;
|
||||||
|
import com.minres.scviewer.e4.application.parts.WaveformViewer;
|
||||||
|
|
||||||
|
public class ChangeValueDisplay {
|
||||||
|
|
||||||
|
static final String PARAMETER_ID="com.minres.scviewer.e4.application.commandparameter.changevaluedisplay"; //$NON-NLS-1$
|
||||||
|
|
||||||
|
@CanExecute
|
||||||
|
public boolean canExecute(EPartService partService) {
|
||||||
|
MPart part = partService.getActivePart();
|
||||||
|
if(part==null) return false;
|
||||||
|
return (part.getObject() instanceof WaveformViewer);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Execute
|
||||||
|
public void execute(@Named(PARAMETER_ID) String param, EPartService partService) {
|
||||||
|
MPart part = partService.getActivePart();
|
||||||
|
Object obj = part.getObject();
|
||||||
|
if(obj instanceof WaveformViewer){
|
||||||
|
WaveformViewer wfv = (WaveformViewer)obj;
|
||||||
|
ISelection sel = wfv.getSelection();
|
||||||
|
if(!sel.isEmpty() && sel instanceof IStructuredSelection) {
|
||||||
|
Iterator<?> it = ((IStructuredSelection)sel).iterator();
|
||||||
|
it.next();
|
||||||
|
if(it.hasNext()) {
|
||||||
|
Object second = it.next();
|
||||||
|
if(second instanceof TrackEntry) {
|
||||||
|
TrackEntry.ValueDisplay val = TrackEntry.ValueDisplay.valueOf(param);
|
||||||
|
((TrackEntry)second).valueDisplay=val;
|
||||||
|
wfv.update();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,51 @@
|
||||||
|
|
||||||
|
package com.minres.scviewer.e4.application.handlers;
|
||||||
|
|
||||||
|
import java.util.Iterator;
|
||||||
|
|
||||||
|
import javax.inject.Named;
|
||||||
|
|
||||||
|
import org.eclipse.e4.core.di.annotations.CanExecute;
|
||||||
|
import org.eclipse.e4.core.di.annotations.Execute;
|
||||||
|
import org.eclipse.e4.ui.model.application.ui.basic.MPart;
|
||||||
|
import org.eclipse.e4.ui.workbench.modeling.EPartService;
|
||||||
|
import org.eclipse.jface.viewers.ISelection;
|
||||||
|
import org.eclipse.jface.viewers.IStructuredSelection;
|
||||||
|
|
||||||
|
import com.minres.scviewer.database.ui.TrackEntry;
|
||||||
|
import com.minres.scviewer.e4.application.parts.WaveformViewer;
|
||||||
|
|
||||||
|
public class ChangeWaveformDisplay {
|
||||||
|
|
||||||
|
static final String PARAMETER_ID="com.minres.scviewer.e4.application.commandparameter.changewavedisplay"; //$NON-NLS-1$
|
||||||
|
|
||||||
|
@CanExecute
|
||||||
|
public boolean canExecute(EPartService partService) {
|
||||||
|
MPart part = partService.getActivePart();
|
||||||
|
if(part==null) return false;
|
||||||
|
return (part.getObject() instanceof WaveformViewer);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Execute
|
||||||
|
public void execute(@Named(PARAMETER_ID) String param, EPartService partService) {
|
||||||
|
MPart part = partService.getActivePart();
|
||||||
|
Object obj = part.getObject();
|
||||||
|
if(obj instanceof WaveformViewer){
|
||||||
|
WaveformViewer wfv = (WaveformViewer)obj;
|
||||||
|
ISelection sel = wfv.getSelection();
|
||||||
|
if(!sel.isEmpty() && sel instanceof IStructuredSelection) {
|
||||||
|
Iterator<?> it = ((IStructuredSelection)sel).iterator();
|
||||||
|
it.next();
|
||||||
|
if(it.hasNext()) {
|
||||||
|
Object second = it.next();
|
||||||
|
if(second instanceof TrackEntry) {
|
||||||
|
TrackEntry.WaveDisplay val= TrackEntry.WaveDisplay.valueOf(param);
|
||||||
|
((TrackEntry)second).waveDisplay=val;
|
||||||
|
wfv.update();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -22,10 +22,11 @@ import org.eclipse.swt.SWT;
|
||||||
import org.eclipse.swt.widgets.FileDialog;
|
import org.eclipse.swt.widgets.FileDialog;
|
||||||
import org.eclipse.swt.widgets.Shell;
|
import org.eclipse.swt.widgets.Shell;
|
||||||
|
|
||||||
|
import com.minres.scviewer.e4.application.Messages;
|
||||||
import com.minres.scviewer.e4.application.parts.WaveformViewer;
|
import com.minres.scviewer.e4.application.parts.WaveformViewer;
|
||||||
public class LoadStoreSettingsHandler {
|
public class LoadStoreSettingsHandler {
|
||||||
|
|
||||||
static final String PARAMETER_ID="com.minres.scviewer.e4.application.commandparameter.loadStore";
|
static final String PARAMETER_ID="com.minres.scviewer.e4.application.commandparameter.loadStore"; //$NON-NLS-1$
|
||||||
|
|
||||||
@CanExecute
|
@CanExecute
|
||||||
public boolean canExecute(EPartService partService) {
|
public boolean canExecute(EPartService partService) {
|
||||||
|
@ -37,10 +38,10 @@ public class LoadStoreSettingsHandler {
|
||||||
@Execute
|
@Execute
|
||||||
public void execute(@Named(PARAMETER_ID) String param, Shell shell, MApplication app, EModelService modelService,
|
public void execute(@Named(PARAMETER_ID) String param, Shell shell, MApplication app, EModelService modelService,
|
||||||
EPartService partService){
|
EPartService partService){
|
||||||
boolean load = "load".equals(param);
|
boolean load = "load".equals(param); //$NON-NLS-1$
|
||||||
FileDialog dialog = new FileDialog(shell, load?SWT.OPEN:SWT.SAVE);
|
FileDialog dialog = new FileDialog(shell, load?SWT.OPEN:SWT.SAVE);
|
||||||
dialog.setFilterExtensions (new String []{"*.scview"});
|
dialog.setFilterExtensions (new String []{Messages.LoadStoreSettingsHandler_2});
|
||||||
if(!load) dialog.setFileName("SCViewer.scview");
|
if(!load) dialog.setFileName(Messages.LoadStoreSettingsHandler_3);
|
||||||
String res = dialog.open();
|
String res = dialog.open();
|
||||||
MPart part = partService.getActivePart();
|
MPart part = partService.getActivePart();
|
||||||
if(res!=null && part!=null){
|
if(res!=null && part!=null){
|
||||||
|
|
|
@ -26,7 +26,7 @@ import com.minres.scviewer.e4.application.parts.WaveformViewer;
|
||||||
|
|
||||||
public class MoveWaveformHandler {
|
public class MoveWaveformHandler {
|
||||||
|
|
||||||
static final String PARAMETER_ID="com.minres.scviewer.e4.application.command.movewaveformupCommand.parameter.dir";
|
static final String PARAMETER_ID="com.minres.scviewer.e4.application.command.movewaveformupCommand.parameter.dir"; //$NON-NLS-1$
|
||||||
|
|
||||||
@CanExecute
|
@CanExecute
|
||||||
public Boolean canExecute(ESelectionService selectionService){
|
public Boolean canExecute(ESelectionService selectionService){
|
||||||
|
@ -43,9 +43,9 @@ public class MoveWaveformHandler {
|
||||||
MPart part = partService.getActivePart();
|
MPart part = partService.getActivePart();
|
||||||
Object obj = part.getObject();
|
Object obj = part.getObject();
|
||||||
if(obj instanceof WaveformViewer){
|
if(obj instanceof WaveformViewer){
|
||||||
if("up".equalsIgnoreCase(param))
|
if("up".equalsIgnoreCase(param)) //$NON-NLS-1$
|
||||||
((WaveformViewer)obj).moveSelected(-1);
|
((WaveformViewer)obj).moveSelected(-1);
|
||||||
else if("down".equalsIgnoreCase(param))
|
else if("down".equalsIgnoreCase(param)) //$NON-NLS-1$
|
||||||
((WaveformViewer)obj).moveSelected(1);
|
((WaveformViewer)obj).moveSelected(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,7 +27,7 @@ import com.minres.scviewer.e4.application.parts.WaveformViewer;
|
||||||
|
|
||||||
public class NavigateEvent {
|
public class NavigateEvent {
|
||||||
|
|
||||||
final static String PARAMTER_ID="com.minres.scviewer.e4.application.command.navigateEventCommand.parameter.dir";
|
final static String PARAMTER_ID="com.minres.scviewer.e4.application.command.navigateEventCommand.parameter.dir"; //$NON-NLS-1$
|
||||||
|
|
||||||
@CanExecute
|
@CanExecute
|
||||||
public Boolean canExecute(ESelectionService selectionService){
|
public Boolean canExecute(ESelectionService selectionService){
|
||||||
|
@ -46,9 +46,9 @@ public class NavigateEvent {
|
||||||
MPart part = partService.getActivePart();
|
MPart part = partService.getActivePart();
|
||||||
Object obj = part.getObject();
|
Object obj = part.getObject();
|
||||||
if(obj instanceof WaveformViewer){
|
if(obj instanceof WaveformViewer){
|
||||||
if("next".equalsIgnoreCase(param))
|
if("next".equalsIgnoreCase(param)) //$NON-NLS-1$
|
||||||
((WaveformViewer)obj).moveCursor(GotoDirection.NEXT);
|
((WaveformViewer)obj).moveCursor(GotoDirection.NEXT);
|
||||||
else if("prev".equalsIgnoreCase(param))
|
else if("prev".equalsIgnoreCase(param)) //$NON-NLS-1$
|
||||||
((WaveformViewer)obj).moveCursor(GotoDirection.PREV);
|
((WaveformViewer)obj).moveCursor(GotoDirection.PREV);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,7 +26,7 @@ import com.minres.scviewer.e4.application.parts.WaveformViewer;
|
||||||
|
|
||||||
public class NavigateTrans {
|
public class NavigateTrans {
|
||||||
|
|
||||||
final static String PARAMTER_ID="com.minres.scviewer.e4.application.command.navigateTransCommand.parameter.dir";
|
final static String PARAMTER_ID="com.minres.scviewer.e4.application.command.navigateTransCommand.parameter.dir"; //$NON-NLS-1$
|
||||||
|
|
||||||
@CanExecute
|
@CanExecute
|
||||||
public Boolean canExecute(ESelectionService selectionService){
|
public Boolean canExecute(ESelectionService selectionService){
|
||||||
|
@ -43,9 +43,9 @@ public class NavigateTrans {
|
||||||
MPart part = partService.getActivePart();
|
MPart part = partService.getActivePart();
|
||||||
Object obj = part.getObject();
|
Object obj = part.getObject();
|
||||||
if(obj instanceof WaveformViewer){
|
if(obj instanceof WaveformViewer){
|
||||||
if("next".equalsIgnoreCase(param))
|
if("next".equalsIgnoreCase(param)) //$NON-NLS-1$
|
||||||
((WaveformViewer)obj).moveSelection(GotoDirection.NEXT);
|
((WaveformViewer)obj).moveSelection(GotoDirection.NEXT);
|
||||||
else if("prev".equalsIgnoreCase(param))
|
else if("prev".equalsIgnoreCase(param)) //$NON-NLS-1$
|
||||||
((WaveformViewer)obj).moveSelection(GotoDirection.PREV);
|
((WaveformViewer)obj).moveSelection(GotoDirection.PREV);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,36 +23,27 @@ import org.eclipse.e4.ui.workbench.modeling.EPartService.PartState;
|
||||||
import org.eclipse.swt.SWT;
|
import org.eclipse.swt.SWT;
|
||||||
import org.eclipse.swt.widgets.FileDialog;
|
import org.eclipse.swt.widgets.FileDialog;
|
||||||
import org.eclipse.swt.widgets.Shell;
|
import org.eclipse.swt.widgets.Shell;
|
||||||
|
|
||||||
|
import com.minres.scviewer.e4.application.Messages;
|
||||||
public class OpenHandler {
|
public class OpenHandler {
|
||||||
|
|
||||||
@Execute
|
@Execute
|
||||||
public void execute(Shell shell, MApplication app, EModelService modelService, EPartService partService){
|
public void execute(Shell shell, MApplication app, EModelService modelService, EPartService partService){
|
||||||
FileDialog dialog = new FileDialog(shell, SWT.OPEN | SWT.MULTI);
|
FileDialog dialog = new FileDialog(shell, SWT.OPEN | SWT.MULTI);
|
||||||
// dialog.setFilterExtensions (new String []{"vcd", "txdb", "txlog"});
|
dialog.setFilterExtensions (new String []{Messages.OpenHandler_0});
|
||||||
dialog.setFilterExtensions (new String []{"*.vcd;*.txdb;*.txlog"});
|
|
||||||
dialog.open();
|
dialog.open();
|
||||||
String path = dialog.getFilterPath();
|
String path = dialog.getFilterPath();
|
||||||
for(String fileName: dialog.getFileNames()){
|
for(String fileName: dialog.getFileNames()){
|
||||||
File file = new File(path+File.separator+fileName);
|
File file = new File(path+File.separator+fileName);
|
||||||
if(file.exists()){
|
if(file.exists()){
|
||||||
// MPart part = MBasicFactory.INSTANCE.createPart();
|
MPart part = partService .createPart("com.minres.scviewer.e4.application.partdescriptor.waveformviewer"); //$NON-NLS-1$
|
||||||
// part.setLabel(fileName);
|
|
||||||
// part.setContributionURI("bundleclass://com.minres.scviewer.e4.application/"+ WaveformViewerPart.class.getName());
|
|
||||||
MPart part = partService .createPart("com.minres.scviewer.e4.application.partdescriptor.waveformviewer");
|
|
||||||
part.setLabel(file.getName());
|
part.setLabel(file.getName());
|
||||||
|
MPartStack partStack = (MPartStack)modelService.find("org.eclipse.editorss", app); //$NON-NLS-1$
|
||||||
|
|
||||||
MPartStack partStack = (MPartStack)modelService.find("org.eclipse.editorss", app);
|
|
||||||
partStack.getChildren().add(part);
|
partStack.getChildren().add(part);
|
||||||
partService.showPart(part, PartState.ACTIVATE);
|
partService.showPart(part, PartState.ACTIVATE);
|
||||||
// Object o = part.getObject();
|
|
||||||
// if(o instanceof WaveformViewerPart)
|
|
||||||
// ((WaveformViewerPart)o).setPartInput(file);
|
|
||||||
IEclipseContext ctx=part.getContext();
|
IEclipseContext ctx=part.getContext();
|
||||||
ctx.modify("input", file);
|
ctx.modify("input", file); //$NON-NLS-1$
|
||||||
ctx.declareModifiable("input");
|
ctx.modify("config", ""); //$NON-NLS-1$
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,12 +15,14 @@ import org.eclipse.e4.ui.workbench.IWorkbench;
|
||||||
import org.eclipse.jface.dialogs.MessageDialog;
|
import org.eclipse.jface.dialogs.MessageDialog;
|
||||||
import org.eclipse.swt.widgets.Shell;
|
import org.eclipse.swt.widgets.Shell;
|
||||||
|
|
||||||
|
import com.minres.scviewer.e4.application.Messages;
|
||||||
|
|
||||||
|
|
||||||
public class QuitHandler {
|
public class QuitHandler {
|
||||||
@Execute
|
@Execute
|
||||||
public void execute(IWorkbench workbench, Shell shell){
|
public void execute(IWorkbench workbench, Shell shell){
|
||||||
if (MessageDialog.openConfirm(shell, "Confirmation",
|
if (MessageDialog.openConfirm(shell, Messages.QuitHandler_0,
|
||||||
"Do you want to exit?")) {
|
Messages.QuitHandler_1)) {
|
||||||
workbench.close();
|
workbench.close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,7 +20,7 @@ import org.eclipse.e4.ui.workbench.modeling.EPartService;
|
||||||
import com.minres.scviewer.e4.application.parts.WaveformViewer;
|
import com.minres.scviewer.e4.application.parts.WaveformViewer;
|
||||||
|
|
||||||
public class SetRelationTypeHandler {
|
public class SetRelationTypeHandler {
|
||||||
final static String PARAMTER_ID="com.minres.scviewer.e4.application.commandparameter.relationName";
|
final static String PARAMTER_ID="com.minres.scviewer.e4.application.commandparameter.relationName"; //$NON-NLS-1$
|
||||||
|
|
||||||
@Execute
|
@Execute
|
||||||
public void execute(@Named(PARAMTER_ID) String relationName, EPartService partService) {
|
public void execute(@Named(PARAMTER_ID) String relationName, EPartService partService) {
|
||||||
|
|
|
@ -22,7 +22,7 @@ import org.eclipse.e4.ui.workbench.modeling.EPartService;
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("restriction")
|
@SuppressWarnings("restriction")
|
||||||
public class ThemeSetHandler {
|
public class ThemeSetHandler {
|
||||||
final static String PARAMTER_ID = "com.minres.scviewer.e4.application.command.theme.parameter.id";
|
final static String PARAMTER_ID = "com.minres.scviewer.e4.application.command.theme.parameter.id"; //$NON-NLS-1$
|
||||||
|
|
||||||
@CanExecute
|
@CanExecute
|
||||||
public boolean canExecute(EPartService partService) {
|
public boolean canExecute(EPartService partService) {
|
||||||
|
|
|
@ -22,7 +22,7 @@ import com.minres.scviewer.e4.application.parts.WaveformViewer;
|
||||||
|
|
||||||
public class ZoomHandler {
|
public class ZoomHandler {
|
||||||
|
|
||||||
final static String PARAMTER_ID="com.minres.scviewer.e4.application.command.zoomcommand.parameter.level";
|
final static String PARAMTER_ID="com.minres.scviewer.e4.application.command.zoomcommand.parameter.level"; //$NON-NLS-1$
|
||||||
|
|
||||||
@CanExecute
|
@CanExecute
|
||||||
public boolean canExecute(EPartService partService) {
|
public boolean canExecute(EPartService partService) {
|
||||||
|
@ -36,11 +36,11 @@ public class ZoomHandler {
|
||||||
if(obj instanceof WaveformViewer){
|
if(obj instanceof WaveformViewer){
|
||||||
WaveformViewer waveformViewerPart = (WaveformViewer) obj;
|
WaveformViewer waveformViewerPart = (WaveformViewer) obj;
|
||||||
int zoomLevel = waveformViewerPart.getZoomLevel();
|
int zoomLevel = waveformViewerPart.getZoomLevel();
|
||||||
if("in".equalsIgnoreCase(level))
|
if("in".equalsIgnoreCase(level)) //$NON-NLS-1$
|
||||||
waveformViewerPart.setZoomLevel(zoomLevel-1);
|
waveformViewerPart.setZoomLevel(zoomLevel-1);
|
||||||
else if("out".equalsIgnoreCase(level))
|
else if("out".equalsIgnoreCase(level)) //$NON-NLS-1$
|
||||||
waveformViewerPart.setZoomLevel(zoomLevel+1);
|
waveformViewerPart.setZoomLevel(zoomLevel+1);
|
||||||
else if("fit".equalsIgnoreCase(level))
|
else if("fit".equalsIgnoreCase(level)) //$NON-NLS-1$
|
||||||
waveformViewerPart.setZoomFit();
|
waveformViewerPart.setZoomFit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -32,13 +32,15 @@ import org.eclipse.swt.widgets.Label;
|
||||||
import org.eclipse.swt.widgets.ProgressBar;
|
import org.eclipse.swt.widgets.ProgressBar;
|
||||||
import org.osgi.service.prefs.PreferencesService;
|
import org.osgi.service.prefs.PreferencesService;
|
||||||
|
|
||||||
|
import com.minres.scviewer.e4.application.Messages;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Class StatusBarControl.
|
* The Class StatusBarControl.
|
||||||
*/
|
*/
|
||||||
public class StatusBarControl {
|
public class StatusBarControl {
|
||||||
|
|
||||||
/** The Constant STATUS_UPDATE. */
|
/** The Constant STATUS_UPDATE. */
|
||||||
public static final String STATUS_UPDATE="StatusUpdate";
|
public static final String STATUS_UPDATE="StatusUpdate"; //$NON-NLS-1$
|
||||||
|
|
||||||
/** The model service. */
|
/** The model service. */
|
||||||
@Inject EModelService modelService;
|
@Inject EModelService modelService;
|
||||||
|
@ -194,7 +196,7 @@ public class StatusBarControl {
|
||||||
progressBar.setMaximum(progressBar.getMaximum() + totalWork);
|
progressBar.setMaximum(progressBar.getMaximum() + totalWork);
|
||||||
}
|
}
|
||||||
runningTasks++;
|
runningTasks++;
|
||||||
progressBar.setToolTipText("Currently running: " + runningTasks + "\nLast task: " + name);
|
progressBar.setToolTipText(Messages.StatusBarControl_1 + runningTasks + Messages.StatusBarControl_2 + name);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -266,9 +268,9 @@ public class StatusBarControl {
|
||||||
public void run() {
|
public void run() {
|
||||||
runningTasks--;
|
runningTasks--;
|
||||||
if (runningTasks > 0){ // --- some tasks are still running ---
|
if (runningTasks > 0){ // --- some tasks are still running ---
|
||||||
progressBar.setToolTipText("Currently running: " + runningTasks);
|
progressBar.setToolTipText(Messages.StatusBarControl_3 + runningTasks);
|
||||||
} else { // --- all tasks are done (a reset of selection could also be done) ---
|
} else { // --- all tasks are done (a reset of selection could also be done) ---
|
||||||
progressBar.setToolTipText("No background progress running.");
|
progressBar.setToolTipText(Messages.StatusBarControl_4);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -27,22 +27,24 @@ import org.eclipse.swt.layout.GridData;
|
||||||
import org.eclipse.swt.layout.GridLayout;
|
import org.eclipse.swt.layout.GridLayout;
|
||||||
import org.eclipse.swt.widgets.Composite;
|
import org.eclipse.swt.widgets.Composite;
|
||||||
|
|
||||||
|
import com.minres.scviewer.e4.application.Messages;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Class WaveStatusBarControl.
|
* The Class WaveStatusBarControl.
|
||||||
*/
|
*/
|
||||||
public class WaveStatusBarControl extends StatusBarControl {
|
public class WaveStatusBarControl extends StatusBarControl {
|
||||||
|
|
||||||
/** The Constant ZOOM_LEVEL. */
|
/** The Constant ZOOM_LEVEL. */
|
||||||
public static final String ZOOM_LEVEL="ZoomLevelUpdate";
|
public static final String ZOOM_LEVEL="ZoomLevelUpdate"; //$NON-NLS-1$
|
||||||
|
|
||||||
/** The Constant CURSOR_TIME. */
|
/** The Constant CURSOR_TIME. */
|
||||||
public static final String CURSOR_TIME="CursorPosUpdate";
|
public static final String CURSOR_TIME="CursorPosUpdate"; //$NON-NLS-1$
|
||||||
|
|
||||||
/** The Constant MARKER_TIME. */
|
/** The Constant MARKER_TIME. */
|
||||||
public static final String MARKER_TIME="MarkerPosUpdate";
|
public static final String MARKER_TIME="MarkerPosUpdate"; //$NON-NLS-1$
|
||||||
|
|
||||||
/** The Constant MARKER_DIFF. */
|
/** The Constant MARKER_DIFF. */
|
||||||
public static final String MARKER_DIFF="MarlerDiffUpdate";
|
public static final String MARKER_DIFF="MarlerDiffUpdate"; //$NON-NLS-1$
|
||||||
|
|
||||||
/** The model service. */
|
/** The model service. */
|
||||||
@Inject
|
@Inject
|
||||||
|
@ -75,7 +77,7 @@ public class WaveStatusBarControl extends StatusBarControl {
|
||||||
super();
|
super();
|
||||||
this.labelString = labelString;
|
this.labelString = labelString;
|
||||||
this.width=width;
|
this.width=width;
|
||||||
content="";
|
content=""; //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
|
@ -124,10 +126,10 @@ public class WaveStatusBarControl extends StatusBarControl {
|
||||||
@Inject
|
@Inject
|
||||||
public WaveStatusBarControl(UISynchronize sync) {
|
public WaveStatusBarControl(UISynchronize sync) {
|
||||||
super(sync);
|
super(sync);
|
||||||
cursorContribution = new TextContributionItem("C:", 80);
|
cursorContribution = new TextContributionItem(Messages.WaveStatusBarControl_5, 80);
|
||||||
markerContribution = new TextContributionItem("M:", 80);
|
markerContribution = new TextContributionItem(Messages.WaveStatusBarControl_6, 80);
|
||||||
markerDiffContribution = new TextContributionItem("C-M:", 80);
|
markerDiffContribution = new TextContributionItem(Messages.WaveStatusBarControl_7, 80);
|
||||||
zoomContribution = new TextContributionItem("Z:", 80);
|
zoomContribution = new TextContributionItem(Messages.WaveStatusBarControl_8, 80);
|
||||||
manager.appendToGroup(StatusLineManager.BEGIN_GROUP,cursorContribution);
|
manager.appendToGroup(StatusLineManager.BEGIN_GROUP,cursorContribution);
|
||||||
manager.appendToGroup(StatusLineManager.BEGIN_GROUP,markerContribution);
|
manager.appendToGroup(StatusLineManager.BEGIN_GROUP,markerContribution);
|
||||||
manager.appendToGroup(StatusLineManager.BEGIN_GROUP,markerDiffContribution);
|
manager.appendToGroup(StatusLineManager.BEGIN_GROUP,markerDiffContribution);
|
||||||
|
@ -144,13 +146,13 @@ public class WaveStatusBarControl extends StatusBarControl {
|
||||||
if(manager!=null && selection!=null){
|
if(manager!=null && selection!=null){
|
||||||
switch(selection.size()){
|
switch(selection.size()){
|
||||||
case 0:
|
case 0:
|
||||||
manager.setMessage("");
|
manager.setMessage(""); //$NON-NLS-1$
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
manager.setMessage(selection.getFirstElement().getClass().getSimpleName()+" selected");
|
manager.setMessage(selection.getFirstElement().getClass().getSimpleName()+Messages.WaveStatusBarControl_10);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
manager.setMessage(""+selection.size()+" Elements");
|
manager.setMessage(""+selection.size()+Messages.WaveStatusBarControl_12); //$NON-NLS-1$
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,52 @@
|
||||||
|
AboutDialog_0=\nSCViewer - a SystemC waveform viewer\n\nVersion: 2.0\n
|
||||||
|
AboutDialog_1=\nCopyright (c) 2015, 2018 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.apache.jdbm and org.sqlite JDBC driver\n\nSources code is hosted at 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_4=Append after
|
||||||
|
DesignBrowser_8=Insert before
|
||||||
|
LoadingWaveformDb_0=Database loading...
|
||||||
|
LoadStoreSettingsHandler_2=*.scview
|
||||||
|
LoadStoreSettingsHandler_3=SCViewer.scview
|
||||||
|
OpenHandler_0=*.vcd;*.txdb;*.txlog
|
||||||
|
QuitHandler_0=Confirmation
|
||||||
|
QuitHandler_1=Do you want to exit?
|
||||||
|
RelationTypeToolControl_0=------------
|
||||||
|
RelationTypeToolControl_1=Select
|
||||||
|
ResourceManager_0=Wrong decorate corner
|
||||||
|
SCViewerPreferencesPage_0=Check for changed database
|
||||||
|
StatusBarControl_1=Currently running:
|
||||||
|
StatusBarControl_2=\nLast task:
|
||||||
|
StatusBarControl_3=Currently running:
|
||||||
|
StatusBarControl_4=No background progress running.
|
||||||
|
SWTResourceManager_0=Wrong decorate corner
|
||||||
|
TransactionDetails_0=Enter text to filter
|
||||||
|
TransactionDetails_1=Name
|
||||||
|
TransactionDetails_10=Properties
|
||||||
|
TransactionDetails_11=Attributes
|
||||||
|
TransactionDetails_12=Incoming relations
|
||||||
|
TransactionDetails_13=Outgoing relations
|
||||||
|
TransactionDetails_16=String
|
||||||
|
TransactionDetails_19=Start time
|
||||||
|
TransactionDetails_2=Type
|
||||||
|
TransactionDetails_20=Time
|
||||||
|
TransactionDetails_21=End time
|
||||||
|
TransactionDetails_3=Value
|
||||||
|
TransactionDetails_4=Relation
|
||||||
|
WaveformPreferencesPage_1=Color for
|
||||||
|
WaveformViewer_15=Database Load Job
|
||||||
|
WaveformViewer_16=Loading
|
||||||
|
WaveformViewer_17=Database re-load
|
||||||
|
WaveformViewer_18=Would you like to reload the database?
|
||||||
|
WaveformViewer_19=vcd
|
||||||
|
WaveformViewer_20=txdb
|
||||||
|
WaveformViewer_21=txlog
|
||||||
|
WaveformViewer_37=Database open
|
||||||
|
WaveformViewer_38=Would you like to open the adjacent database
|
||||||
|
WaveformViewer_39=\ as well?
|
||||||
|
WaveStatusBarControl_10=\ selected
|
||||||
|
WaveStatusBarControl_12=\ Elements
|
||||||
|
WaveStatusBarControl_5=C:
|
||||||
|
WaveStatusBarControl_6=M:
|
||||||
|
WaveStatusBarControl_7=C-M:
|
||||||
|
WaveStatusBarControl_8=Z:
|
|
@ -0,0 +1,275 @@
|
||||||
|
package com.minres.scviewer.e4.application.options;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This class holds all the data for an option. This includes the prefix, the key, the separator
|
||||||
|
* (for value options), the multiplicity, and all the other settings describing the option. The class
|
||||||
|
* is designed to be only a data container from a user perspective, i. e. the user has read-access to
|
||||||
|
* any data determined by the {@link Options#check()}, but not access to any of the other methods
|
||||||
|
* which are used internally for the operation of the actual check.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class OptionData {
|
||||||
|
|
||||||
|
private final static String CLASS = "OptionData";
|
||||||
|
|
||||||
|
private Options.Prefix prefix = null;
|
||||||
|
private String key = null;
|
||||||
|
private boolean detail = false;
|
||||||
|
private Options.Separator separator = null;
|
||||||
|
private boolean value = false;
|
||||||
|
private Options.Multiplicity multiplicity = null;
|
||||||
|
private java.util.regex.Pattern pattern = null;
|
||||||
|
private int counter = 0;
|
||||||
|
private java.util.ArrayList<String> values = null;
|
||||||
|
private java.util.ArrayList<String> details = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The constructor
|
||||||
|
*/
|
||||||
|
|
||||||
|
OptionData(Options.Prefix prefix,
|
||||||
|
String key,
|
||||||
|
boolean detail,
|
||||||
|
Options.Separator separator,
|
||||||
|
boolean value,
|
||||||
|
Options.Multiplicity multiplicity) {
|
||||||
|
|
||||||
|
if (prefix == null) throw new IllegalArgumentException(CLASS + ": prefix may not be null");
|
||||||
|
if (key == null) throw new IllegalArgumentException(CLASS + ": key may not be null");
|
||||||
|
if (separator == null) throw new IllegalArgumentException(CLASS + ": separator may not be null");
|
||||||
|
if (multiplicity == null) throw new IllegalArgumentException(CLASS + ": multiplicity may not be null");
|
||||||
|
|
||||||
|
//.... The data describing the option
|
||||||
|
|
||||||
|
this.prefix = prefix;
|
||||||
|
this.key = key;
|
||||||
|
this.detail = detail;
|
||||||
|
this.separator = separator;
|
||||||
|
this.value = value;
|
||||||
|
this.multiplicity = multiplicity;
|
||||||
|
|
||||||
|
//.... Create the pattern to match this option
|
||||||
|
|
||||||
|
if (value) {
|
||||||
|
if (separator == Options.Separator.BLANK) {
|
||||||
|
if (detail) {
|
||||||
|
pattern = java.util.regex.Pattern.compile(prefix.getName() + key + "((\\w|\\.)+)$");
|
||||||
|
} else {
|
||||||
|
pattern = java.util.regex.Pattern.compile(prefix.getName() + key + "$");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (detail) {
|
||||||
|
pattern = java.util.regex.Pattern.compile(prefix.getName() + key + "((\\w|\\.)+)" + separator.getName() + "(.+)$");
|
||||||
|
} else {
|
||||||
|
pattern = java.util.regex.Pattern.compile(prefix.getName() + key + separator.getName() + "(.+)$");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
pattern = java.util.regex.Pattern.compile(prefix.getName() + key + "$");
|
||||||
|
}
|
||||||
|
|
||||||
|
//.... Structures to hold result data
|
||||||
|
|
||||||
|
if (value) {
|
||||||
|
values = new java.util.ArrayList<String>();
|
||||||
|
if (detail)
|
||||||
|
details = new java.util.ArrayList<String>();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Getter method for <code>prefix</code> property
|
||||||
|
* <p>
|
||||||
|
* @return The value for the <code>prefix</code> property
|
||||||
|
*/
|
||||||
|
|
||||||
|
Options.Prefix getPrefix() {
|
||||||
|
return prefix;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Getter method for <code>key</code> property
|
||||||
|
* <p>
|
||||||
|
* @return The value for the <code>key</code> property
|
||||||
|
*/
|
||||||
|
|
||||||
|
String getKey() {
|
||||||
|
return key;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Getter method for <code>detail</code> property
|
||||||
|
* <p>
|
||||||
|
* @return The value for the <code>detail</code> property
|
||||||
|
*/
|
||||||
|
|
||||||
|
boolean useDetail() {
|
||||||
|
return detail;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Getter method for <code>separator</code> property
|
||||||
|
* <p>
|
||||||
|
* @return The value for the <code>separator</code> property
|
||||||
|
*/
|
||||||
|
|
||||||
|
Options.Separator getSeparator() {
|
||||||
|
return separator;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Getter method for <code>value</code> property
|
||||||
|
* <p>
|
||||||
|
* @return The value for the <code>value</code> property
|
||||||
|
*/
|
||||||
|
|
||||||
|
boolean useValue() {
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Getter method for <code>multiplicity</code> property
|
||||||
|
* <p>
|
||||||
|
* @return The value for the <code>multiplicity</code> property
|
||||||
|
*/
|
||||||
|
|
||||||
|
Options.Multiplicity getMultiplicity() {
|
||||||
|
return multiplicity;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Getter method for <code>pattern</code> property
|
||||||
|
* <p>
|
||||||
|
* @return The value for the <code>pattern</code> property
|
||||||
|
*/
|
||||||
|
|
||||||
|
java.util.regex.Pattern getPattern() {
|
||||||
|
return pattern;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the number of results found for this option, which is number of times the key matched
|
||||||
|
* <p>
|
||||||
|
* @return The number of results
|
||||||
|
*/
|
||||||
|
|
||||||
|
public int getResultCount() {
|
||||||
|
if (value) {
|
||||||
|
return values.size();
|
||||||
|
} else {
|
||||||
|
return counter;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the value with the given index. The index can range between 0 and {@link #getResultCount()}<code> - 1</code>.
|
||||||
|
* However, only for value options, a non-<code>null</code> value will be returned. Non-value options always
|
||||||
|
* return <code>null</code>.
|
||||||
|
* <p>
|
||||||
|
* @param index The index for the desired value
|
||||||
|
* <p>
|
||||||
|
* @return The option value with the given index
|
||||||
|
* <p>
|
||||||
|
* @throws IllegalArgumentException If the value for <code>index</code> is out of bounds
|
||||||
|
*/
|
||||||
|
|
||||||
|
public String getResultValue(int index) {
|
||||||
|
if (!value) return null;
|
||||||
|
if (index < 0 || index >= getResultCount()) throw new IllegalArgumentException(CLASS + ": illegal value for index");
|
||||||
|
return values.get(index);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the detail with the given index. The index can range between 0 and {@link #getResultCount()}<code> - 1</code>.
|
||||||
|
* However, only for value options which take details, a non-<code>null</code> detail will be returned. Non-value options
|
||||||
|
* and value options which do not take details always return <code>null</code>.
|
||||||
|
* <p>
|
||||||
|
* @param index The index for the desired value
|
||||||
|
* <p>
|
||||||
|
* @return The option detail with the given index
|
||||||
|
* <p>
|
||||||
|
* @throws IllegalArgumentException If the value for <code>index</code> is out of bounds
|
||||||
|
*/
|
||||||
|
|
||||||
|
public String getResultDetail(int index) {
|
||||||
|
if (!detail) return null;
|
||||||
|
if (index < 0 || index >= getResultCount()) throw new IllegalArgumentException(CLASS + ": illegal value for index");
|
||||||
|
return details.get(index);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Store the data for a match found
|
||||||
|
*/
|
||||||
|
|
||||||
|
void addResult(String valueData, String detailData) {
|
||||||
|
if (value) {
|
||||||
|
if (valueData == null) throw new IllegalArgumentException(CLASS + ": valueData may not be null");
|
||||||
|
values.add(valueData);
|
||||||
|
if (detail) {
|
||||||
|
if (detailData == null) throw new IllegalArgumentException(CLASS + ": detailData may not be null");
|
||||||
|
details.add(detailData);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
counter++;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This is the overloaded {@link Object#toString()} method, and it is provided mainly for debugging
|
||||||
|
* purposes.
|
||||||
|
* <p>
|
||||||
|
* @return A string representing the instance
|
||||||
|
*/
|
||||||
|
|
||||||
|
public String toString() {
|
||||||
|
|
||||||
|
StringBuffer sb = new StringBuffer();
|
||||||
|
|
||||||
|
sb.append("Prefix : ");
|
||||||
|
sb.append(prefix);
|
||||||
|
sb.append('\n');
|
||||||
|
sb.append("Key : ");
|
||||||
|
sb.append(key);
|
||||||
|
sb.append('\n');
|
||||||
|
sb.append("Detail : ");
|
||||||
|
sb.append(detail);
|
||||||
|
sb.append('\n');
|
||||||
|
sb.append("Separator : ");
|
||||||
|
sb.append(separator);
|
||||||
|
sb.append('\n');
|
||||||
|
sb.append("Value : ");
|
||||||
|
sb.append(value);
|
||||||
|
sb.append('\n');
|
||||||
|
sb.append("Multiplicity: ");
|
||||||
|
sb.append(multiplicity);
|
||||||
|
sb.append('\n');
|
||||||
|
sb.append("Pattern : ");
|
||||||
|
sb.append(pattern);
|
||||||
|
sb.append('\n');
|
||||||
|
|
||||||
|
sb.append("Results : ");
|
||||||
|
sb.append(counter);
|
||||||
|
sb.append('\n');
|
||||||
|
if (value) {
|
||||||
|
if (detail) {
|
||||||
|
for (int i = 0; i < values.size(); i++) {
|
||||||
|
sb.append(details.get(i));
|
||||||
|
sb.append(" / ");
|
||||||
|
sb.append(values.get(i));
|
||||||
|
sb.append('\n');
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
for (int i = 0; i < values.size(); i++) {
|
||||||
|
sb.append(values.get(i));
|
||||||
|
sb.append('\n');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return sb.toString();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,276 @@
|
||||||
|
package com.minres.scviewer.e4.application.options;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This class holds the information for a <i>set</i> of options. A set can hold any number of
|
||||||
|
* <code>OptionData</code> instances which are checked together to determine success or failure.
|
||||||
|
* <p>
|
||||||
|
* The approach to use this class looks like this:
|
||||||
|
* <p>
|
||||||
|
* <ol>
|
||||||
|
* <li> The user uses any of the <code>Options.addSet()</code> (e. g. {@link Options#addSet(String)}) to create
|
||||||
|
* any number of sets required (or just relies on the default set, if only one set is required)
|
||||||
|
* <li> The user adds all required option definitions to each set
|
||||||
|
* <li> Using any of the <code>Options.check()</code> methods, each set can be checked whether the options
|
||||||
|
* that were specified on the command line satisfy its requirements
|
||||||
|
* <li> If the check was successful for a given set, several data items are available from this class:
|
||||||
|
* <ul>
|
||||||
|
* <li> All options defined for the set (through with e. g. values, details, and multiplicity are available)
|
||||||
|
* <li> All data items found (these are the items on the command line which do not start with the prefix,
|
||||||
|
* i. e. non-option arguments)
|
||||||
|
* <li> All unmatched arguments on the command line (these are the items on the command line which start
|
||||||
|
* with the prefix, but do not match to one of the options).
|
||||||
|
* Programs can elect to ignore these, or react with an error
|
||||||
|
* </ul>
|
||||||
|
* </ol>
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class OptionSet {
|
||||||
|
|
||||||
|
private final static String CLASS = "OptionSet";
|
||||||
|
|
||||||
|
private java.util.ArrayList<OptionData> options = new java.util.ArrayList<OptionData>();
|
||||||
|
private java.util.HashMap<String, OptionData> keys = new java.util.HashMap<String, OptionData>();
|
||||||
|
private java.util.ArrayList<String> unmatched = new java.util.ArrayList<String>();
|
||||||
|
private java.util.ArrayList<String> data = new java.util.ArrayList<String>();
|
||||||
|
private String setName = null;
|
||||||
|
private int minData = 0;
|
||||||
|
private int maxData = 0;
|
||||||
|
private Options.Prefix prefix = null;
|
||||||
|
private Options.Multiplicity defaultMultiplicity = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
*/
|
||||||
|
|
||||||
|
OptionSet(Options.Prefix prefix, Options.Multiplicity defaultMultiplicity, String setName, int minData, int maxData) {
|
||||||
|
if (setName == null) throw new IllegalArgumentException(CLASS + ": setName may not be null");
|
||||||
|
if (minData < 0) throw new IllegalArgumentException(CLASS + ": minData must be >= 0");
|
||||||
|
if (maxData < minData) throw new IllegalArgumentException(CLASS + ": maxData must be >= minData");
|
||||||
|
this.prefix = prefix;
|
||||||
|
this.defaultMultiplicity = defaultMultiplicity;
|
||||||
|
this.setName = setName;
|
||||||
|
this.minData = minData;
|
||||||
|
this.maxData = maxData;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get a list of all the options defined for this set
|
||||||
|
* <p>
|
||||||
|
* @return A list of {@link OptionData} instances defined for this set
|
||||||
|
*/
|
||||||
|
|
||||||
|
public java.util.ArrayList<OptionData> getOptionData() {
|
||||||
|
return options;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the data for a specific option, identified by its key name (which is unique)
|
||||||
|
* <p>
|
||||||
|
* @param key The key for the option
|
||||||
|
* <p>
|
||||||
|
* @return The {@link OptionData} instance
|
||||||
|
* <p>
|
||||||
|
* @throws IllegalArgumentException If the <code>key</code> is <code>null</code> or unknown in this set
|
||||||
|
*/
|
||||||
|
|
||||||
|
public OptionData getOption(String key) {
|
||||||
|
if (key == null) throw new IllegalArgumentException(CLASS + ": key may not be null");
|
||||||
|
if (!keys.containsKey(key)) throw new IllegalArgumentException(CLASS + ": unknown key: " + key);
|
||||||
|
return keys.get(key);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check whether a specific option is set, i. e. whether it was specified at least once on the command line.
|
||||||
|
* <p>
|
||||||
|
* @param key The key for the option
|
||||||
|
* <p>
|
||||||
|
* @return <code>true</code> or <code>false</code>, depending on the outcome of the check
|
||||||
|
* <p>
|
||||||
|
* @throws IllegalArgumentException If the <code>key</code> is <code>null</code> or unknown in this set
|
||||||
|
*/
|
||||||
|
|
||||||
|
public boolean isSet(String key) {
|
||||||
|
if (key == null) throw new IllegalArgumentException(CLASS + ": key may not be null");
|
||||||
|
if (!keys.containsKey(key)) throw new IllegalArgumentException(CLASS + ": unknown key: " + key);
|
||||||
|
return keys.get(key).getResultCount() > 0 ? true : false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Getter method for <code>setName</code> property
|
||||||
|
* <p>
|
||||||
|
* @return The value for the <code>setName</code> property
|
||||||
|
*/
|
||||||
|
|
||||||
|
public String getSetName() {
|
||||||
|
return setName;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Getter method for <code>minData</code> property
|
||||||
|
* <p>
|
||||||
|
* @return The value for the <code>minData</code> property
|
||||||
|
*/
|
||||||
|
|
||||||
|
public int getMinData() {
|
||||||
|
return minData;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Getter method for <code>maxData</code> property
|
||||||
|
* <p>
|
||||||
|
* @return The value for the <code>maxData</code> property
|
||||||
|
*/
|
||||||
|
|
||||||
|
public int getMaxData() {
|
||||||
|
return maxData;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the data items found (these are the items on the command line which do not start with the prefix, i. e. non-option arguments)
|
||||||
|
* <p>
|
||||||
|
* @return A list of strings with all data items found
|
||||||
|
*/
|
||||||
|
|
||||||
|
public java.util.ArrayList<String> getData() {
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return all unmatched items found (these are the items on the command line which start with the prefix, but do not
|
||||||
|
* match to one of the options)
|
||||||
|
* <p>
|
||||||
|
* @return A list of strings with all unmatched items found
|
||||||
|
*/
|
||||||
|
|
||||||
|
public java.util.ArrayList<String> getUnmatched() {
|
||||||
|
return unmatched;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add a non-value option with the given key, and the default prefix and multiplicity
|
||||||
|
* <p>
|
||||||
|
* @param key The key for the option
|
||||||
|
* <p>
|
||||||
|
* @return The set instance itself (to support invocation chaining for <code>addOption()</code> methods)
|
||||||
|
* <p>
|
||||||
|
* @throws IllegalArgumentException If the <code>key</code> is <code>null</code> or a key with this name has already been defined
|
||||||
|
*/
|
||||||
|
|
||||||
|
public OptionSet addOption(String key) {
|
||||||
|
return addOption(key, defaultMultiplicity);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add a non-value option with the given key and multiplicity, and the default prefix
|
||||||
|
* <p>
|
||||||
|
* @param key The key for the option
|
||||||
|
* @param multiplicity The multiplicity for the option
|
||||||
|
* <p>
|
||||||
|
* @return The set instance itself (to support invocation chaining for <code>addOption()</code> methods)
|
||||||
|
* <p>
|
||||||
|
* @throws IllegalArgumentException If the <code>key</code> is <code>null</code> or a key with this name has already been defined
|
||||||
|
* or if <code>multiplicity</code> is <code>null</code>
|
||||||
|
*/
|
||||||
|
|
||||||
|
public OptionSet addOption(String key, Options.Multiplicity multiplicity) {
|
||||||
|
return addOption(key, false, Options.Separator.NONE, false, multiplicity);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add a value option with the given key and separator, no details, and the default prefix and multiplicity
|
||||||
|
* <p>
|
||||||
|
* @param key The key for the option
|
||||||
|
* @param separator The separator for the option
|
||||||
|
* <p>
|
||||||
|
* @return The set instance itself (to support invocation chaining for <code>addOption()</code> methods)
|
||||||
|
* <p>
|
||||||
|
* @throws IllegalArgumentException If the <code>key</code> is <code>null</code> or a key with this name has already been defined
|
||||||
|
* or if <code>separator</code> is <code>null</code>
|
||||||
|
*/
|
||||||
|
|
||||||
|
public OptionSet addOption(String key, Options.Separator separator) {
|
||||||
|
return addOption(key, false, separator, true, defaultMultiplicity);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add a value option with the given key, separator, and multiplicity, no details, and the default prefix
|
||||||
|
* <p>
|
||||||
|
* @param key The key for the option
|
||||||
|
* @param separator The separator for the option
|
||||||
|
* @param multiplicity The multiplicity for the option
|
||||||
|
* <p>
|
||||||
|
* @return The set instance itself (to support invocation chaining for <code>addOption()</code> methods)
|
||||||
|
* <p>
|
||||||
|
* @throws IllegalArgumentException If the <code>key</code> is <code>null</code> or a key with this name has already been defined
|
||||||
|
* or if <code>separator</code> or <code>multiplicity</code> are <code>null</code>
|
||||||
|
*/
|
||||||
|
|
||||||
|
public OptionSet addOption(String key, Options.Separator separator, Options.Multiplicity multiplicity) {
|
||||||
|
return addOption(key, false, separator, true, multiplicity);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* Add a value option with the given key and separator, possibly details, and the default prefix and multiplicity
|
||||||
|
* <p>
|
||||||
|
* @param key The key for the option
|
||||||
|
* @param details A boolean indicating whether details are expected for the option
|
||||||
|
* @param separator The separator for the option
|
||||||
|
* <p>
|
||||||
|
* @return The set instance itself (to support invocation chaining for <code>addOption()</code> methods)
|
||||||
|
* <p>
|
||||||
|
* @throws IllegalArgumentException If the <code>key</code> is <code>null</code> or a key with this name has already been defined
|
||||||
|
* or if <code>separator</code> is <code>null</code>
|
||||||
|
*/
|
||||||
|
|
||||||
|
public OptionSet addOption(String key, boolean details, Options.Separator separator) {
|
||||||
|
return addOption(key, details, separator, true, defaultMultiplicity);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add a value option with the given key, separator, and multiplicity, possibly details, and the default prefix
|
||||||
|
* <p>
|
||||||
|
* @param key The key for the option
|
||||||
|
* @param details A boolean indicating whether details are expected for the option
|
||||||
|
* @param separator The separator for the option
|
||||||
|
* @param multiplicity The multiplicity for the option
|
||||||
|
* <p>
|
||||||
|
* @return The set instance itself (to support invocation chaining for <code>addOption()</code> methods)
|
||||||
|
* <p>
|
||||||
|
* @throws IllegalArgumentException If the <code>key</code> is <code>null</code> or a key with this name has already been defined
|
||||||
|
* or if <code>separator</code> or <code>multiplicity</code> are <code>null</code>
|
||||||
|
*/
|
||||||
|
|
||||||
|
public OptionSet addOption(String key, boolean details, Options.Separator separator, Options.Multiplicity multiplicity) {
|
||||||
|
return addOption(key, details, separator, true, multiplicity);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The master method to add an option. Since there are combinations which are not
|
||||||
|
* acceptable (like a NONE separator and a true value), this method is not public.
|
||||||
|
* Internally, we only supply acceptable combinations.
|
||||||
|
*/
|
||||||
|
|
||||||
|
OptionSet addOption(String key,
|
||||||
|
boolean details,
|
||||||
|
Options.Separator separator,
|
||||||
|
boolean value,
|
||||||
|
Options.Multiplicity multiplicity) {
|
||||||
|
|
||||||
|
if (key == null) throw new IllegalArgumentException(CLASS + ": key may not be null");
|
||||||
|
if (multiplicity == null) throw new IllegalArgumentException(CLASS + ": multiplicity may not be null");
|
||||||
|
if (separator == null) throw new IllegalArgumentException(CLASS + ": separator may not be null");
|
||||||
|
if (keys.containsKey(key)) throw new IllegalArgumentException(CLASS + ": the key "
|
||||||
|
+ key + " has already been defined for this OptionSet");
|
||||||
|
|
||||||
|
OptionData od = new OptionData(prefix, key, details, separator, value, multiplicity);
|
||||||
|
options.add(od);
|
||||||
|
keys.put(key, od);
|
||||||
|
|
||||||
|
return this;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,768 @@
|
||||||
|
package com.minres.scviewer.e4.application.options;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The central class for option processing. Sets are identified by their name, but there is also
|
||||||
|
* an anonymous default set, which is very convenient if an application requieres only one set.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class Options {
|
||||||
|
|
||||||
|
private final static String CLASS = "Options";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The name used internally for the default set
|
||||||
|
*/
|
||||||
|
|
||||||
|
public final static String DEFAULT_SET = "DEFAULT_OPTION_SET";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An enum encapsulating the possible separators between value options and their actual values.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public enum Separator {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Separate option and value by ":"
|
||||||
|
*/
|
||||||
|
|
||||||
|
COLON(':'),
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Separate option and value by "="
|
||||||
|
*/
|
||||||
|
|
||||||
|
EQUALS('='),
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Separate option and value by blank space
|
||||||
|
*/
|
||||||
|
|
||||||
|
BLANK(' '), // Or, more precisely, whitespace (as allowed by the CLI)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This is just a placeholder in case no separator is required (i. e. for non-value options)
|
||||||
|
*/
|
||||||
|
|
||||||
|
NONE('D'); // NONE is a placeholder in case no separator is required, 'D' is just an arbitrary dummy value
|
||||||
|
|
||||||
|
private char c;
|
||||||
|
|
||||||
|
private Separator(char c) {
|
||||||
|
this.c = c;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the actual separator character
|
||||||
|
* <p>
|
||||||
|
* @return The actual separator character
|
||||||
|
*/
|
||||||
|
|
||||||
|
char getName() {
|
||||||
|
return c;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An enum encapsulating the possible prefixes identifying options (and separating them from command line data items)
|
||||||
|
*/
|
||||||
|
|
||||||
|
public enum Prefix {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Options start with a "-" (typically on Unix platforms)
|
||||||
|
*/
|
||||||
|
|
||||||
|
DASH('-'),
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Options start with a "/" (typically on Windows platforms)
|
||||||
|
*/
|
||||||
|
|
||||||
|
SLASH('/');
|
||||||
|
|
||||||
|
private char c;
|
||||||
|
|
||||||
|
private Prefix(char c) {
|
||||||
|
this.c = c;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the actual prefix character
|
||||||
|
* <p>
|
||||||
|
* @return The actual prefix character
|
||||||
|
*/
|
||||||
|
|
||||||
|
char getName() {
|
||||||
|
return c;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An enum encapsulating the possible multiplicities for options
|
||||||
|
*/
|
||||||
|
|
||||||
|
public enum Multiplicity {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Option needs to occur exactly once
|
||||||
|
*/
|
||||||
|
|
||||||
|
ONCE,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Option needs to occur at least once
|
||||||
|
*/
|
||||||
|
|
||||||
|
ONCE_OR_MORE,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Option needs to occur either once or not at all
|
||||||
|
*/
|
||||||
|
|
||||||
|
ZERO_OR_ONE,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Option can occur any number of times
|
||||||
|
*/
|
||||||
|
|
||||||
|
ZERO_OR_MORE;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private java.util.HashMap<String, OptionSet> optionSets = new java.util.HashMap<String, OptionSet>();
|
||||||
|
private Prefix prefix = null;
|
||||||
|
private Multiplicity defaultMultiplicity = null;
|
||||||
|
private String[] arguments = null;
|
||||||
|
private int defaultMinData = 0;
|
||||||
|
private int defaultMaxData = 0;
|
||||||
|
private StringBuffer checkErrors = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
* <p>
|
||||||
|
* @param args The command line arguments to check
|
||||||
|
* @param prefix The prefix to use for all command line options. It can only be set here for all options at
|
||||||
|
* the same time
|
||||||
|
* @param defaultMultiplicity The default multiplicity to use for all options (can be overridden when adding an option)
|
||||||
|
* @param defMinData The default minimum number of data items for all sets (can be overridden when adding a set)
|
||||||
|
* @param defMaxData The default maximum number of data items for all sets (can be overridden when adding a set)
|
||||||
|
* <p>
|
||||||
|
* @throws IllegalArgumentException If either <code>args</code>, <code>prefix</code>, or <code>defaultMultiplicity</code>
|
||||||
|
* is <code>null</code> - or if the data range values don't make sense
|
||||||
|
*/
|
||||||
|
|
||||||
|
public Options(String args[], Prefix prefix, Multiplicity defaultMultiplicity, int defMinData, int defMaxData) {
|
||||||
|
|
||||||
|
if (args == null) throw new IllegalArgumentException(CLASS + ": args may not be null");
|
||||||
|
if (prefix == null) throw new IllegalArgumentException(CLASS + ": prefix may not be null");
|
||||||
|
if (defaultMultiplicity == null) throw new IllegalArgumentException(CLASS + ": defaultMultiplicity may not be null");
|
||||||
|
|
||||||
|
if (defMinData < 0) throw new IllegalArgumentException(CLASS + ": defMinData must be >= 0");
|
||||||
|
if (defMaxData < defMinData) throw new IllegalArgumentException(CLASS + ": defMaxData must be >= defMinData");
|
||||||
|
|
||||||
|
arguments = new String[args.length];
|
||||||
|
int i = 0;
|
||||||
|
for (String s : args)
|
||||||
|
arguments[i++] = s;
|
||||||
|
|
||||||
|
this.prefix = prefix;
|
||||||
|
this.defaultMultiplicity = defaultMultiplicity;
|
||||||
|
this.defaultMinData = defMinData;
|
||||||
|
this.defaultMaxData = defMaxData;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
* <p>
|
||||||
|
* @param args The command line arguments to check
|
||||||
|
* @param prefix The prefix to use for all command line options. It can only be set here for all options at
|
||||||
|
* the same time
|
||||||
|
* @param defaultMultiplicity The default multiplicity to use for all options (can be overridden when adding an option)
|
||||||
|
* @param data The default minimum and maximum number of data items for all sets (can be overridden when adding a set)
|
||||||
|
* <p>
|
||||||
|
* @throws IllegalArgumentException If either <code>args</code>, <code>prefix</code>, or <code>defaultMultiplicity</code>
|
||||||
|
* is <code>null</code> - or if the data range value doesn't make sense
|
||||||
|
*/
|
||||||
|
|
||||||
|
public Options(String args[], Prefix prefix, Multiplicity defaultMultiplicity, int data) {
|
||||||
|
this(args, prefix, defaultMultiplicity, data, data);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor. The default number of data items is set to 0.
|
||||||
|
* <p>
|
||||||
|
* @param args The command line arguments to check
|
||||||
|
* @param prefix The prefix to use for all command line options. It can only be set here for all options at
|
||||||
|
* the same time
|
||||||
|
* @param defaultMultiplicity The default multiplicity to use for all options (can be overridden when adding an option)
|
||||||
|
* <p>
|
||||||
|
* @throws IllegalArgumentException If either <code>args</code>, <code>prefix</code>, or <code>defaultMultiplicity</code>
|
||||||
|
* is <code>null</code>
|
||||||
|
*/
|
||||||
|
|
||||||
|
public Options(String args[], Prefix prefix, Multiplicity defaultMultiplicity) {
|
||||||
|
this(args, prefix, defaultMultiplicity, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor. The prefix is set to {@link Prefix#DASH}.
|
||||||
|
* <p>
|
||||||
|
* @param args The command line arguments to check
|
||||||
|
* @param defaultMultiplicity The default multiplicity to use for all options (can be overridden when adding an option)
|
||||||
|
* @param defMinData The default minimum number of data items for all sets (can be overridden when adding a set)
|
||||||
|
* @param defMaxData The default maximum number of data items for all sets (can be overridden when adding a set)
|
||||||
|
* <p>
|
||||||
|
* @throws IllegalArgumentException If either <code>args</code> or <code>defaultMultiplicity</code>
|
||||||
|
* is <code>null</code> - or if the data range values don't make sense
|
||||||
|
*/
|
||||||
|
|
||||||
|
public Options(String args[], Multiplicity defaultMultiplicity, int defMinData, int defMaxData) {
|
||||||
|
this(args, Prefix.DASH, defaultMultiplicity, defMinData, defMaxData);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor. The prefix is set to {@link Prefix#DASH}.
|
||||||
|
* <p>
|
||||||
|
* @param args The command line arguments to check
|
||||||
|
* @param defaultMultiplicity The default multiplicity to use for all options (can be overridden when adding an option)
|
||||||
|
* @param data The default minimum and maximum number of data items for all sets (can be overridden when adding a set)
|
||||||
|
* <p>
|
||||||
|
* @throws IllegalArgumentException If either <code>args</code> or <code>defaultMultiplicity</code>
|
||||||
|
* is <code>null</code> - or if the data range value doesn't make sense
|
||||||
|
*/
|
||||||
|
|
||||||
|
public Options(String args[], Multiplicity defaultMultiplicity, int data) {
|
||||||
|
this(args, Prefix.DASH, defaultMultiplicity, data, data);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor. The prefix is set to {@link Prefix#DASH}, and the default number of data items is set to 0.
|
||||||
|
* <p>
|
||||||
|
* @param args The command line arguments to check
|
||||||
|
* @param defaultMultiplicity The default multiplicity to use for all options (can be overridden when adding an option)
|
||||||
|
* <p>
|
||||||
|
* @throws IllegalArgumentException If either <code>args</code> or <code>defaultMultiplicity</code>
|
||||||
|
* is <code>null</code>
|
||||||
|
*/
|
||||||
|
|
||||||
|
public Options(String args[], Multiplicity defaultMultiplicity) {
|
||||||
|
this(args, Prefix.DASH, defaultMultiplicity, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor. The prefix is set to {@link Prefix#DASH}, the default number of data items is set to 0, and
|
||||||
|
* the multiplicity is set to {@link Multiplicity#ONCE}.
|
||||||
|
* <p>
|
||||||
|
* @param args The command line arguments to check
|
||||||
|
* <p>
|
||||||
|
* @throws IllegalArgumentException If <code>args</code> is <code>null</code>
|
||||||
|
*/
|
||||||
|
|
||||||
|
public Options(String args[]) {
|
||||||
|
this(args, Prefix.DASH, Multiplicity.ONCE);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor. The prefix is set to {@link Prefix#DASH}, and
|
||||||
|
* the multiplicity is set to {@link Multiplicity#ONCE}.
|
||||||
|
* <p>
|
||||||
|
* @param args The command line arguments to check
|
||||||
|
* @param data The default minimum and maximum number of data items for all sets (can be overridden when adding a set)
|
||||||
|
* <p>
|
||||||
|
* @throws IllegalArgumentException If <code>args</code> is <code>null</code> - or if the data range value doesn't make sense
|
||||||
|
*/
|
||||||
|
|
||||||
|
public Options(String args[], int data) {
|
||||||
|
this(args, Prefix.DASH, Multiplicity.ONCE, data, data);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor. The prefix is set to {@link Prefix#DASH}, and
|
||||||
|
* the multiplicity is set to {@link Multiplicity#ONCE}.
|
||||||
|
* <p>
|
||||||
|
* @param args The command line arguments to check
|
||||||
|
* @param defMinData The default minimum number of data items for all sets (can be overridden when adding a set)
|
||||||
|
* @param defMaxData The default maximum number of data items for all sets (can be overridden when adding a set)
|
||||||
|
* <p>
|
||||||
|
* @throws IllegalArgumentException If <code>args</code> is <code>null</code> - or if the data range values don't make sense
|
||||||
|
*/
|
||||||
|
|
||||||
|
public Options(String args[], int defMinData, int defMaxData) {
|
||||||
|
this(args, Prefix.DASH, Multiplicity.ONCE, defMinData, defMaxData);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor. The default number of data items is set to 0, and
|
||||||
|
* the multiplicity is set to {@link Multiplicity#ONCE}.
|
||||||
|
* <p>
|
||||||
|
* @param args The command line arguments to check
|
||||||
|
* @param prefix The prefix to use for all command line options. It can only be set here for all options at
|
||||||
|
* the same time
|
||||||
|
* <p>
|
||||||
|
* @throws IllegalArgumentException If either <code>args</code> or <code>prefix</code> is <code>null</code>
|
||||||
|
*/
|
||||||
|
|
||||||
|
public Options(String args[], Prefix prefix) {
|
||||||
|
this(args, prefix, Multiplicity.ONCE, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor. The multiplicity is set to {@link Multiplicity#ONCE}.
|
||||||
|
* <p>
|
||||||
|
* @param args The command line arguments to check
|
||||||
|
* @param prefix The prefix to use for all command line options. It can only be set here for all options at
|
||||||
|
* @param data The default minimum and maximum number of data items for all sets (can be overridden when adding a set)
|
||||||
|
* <p>
|
||||||
|
* @throws IllegalArgumentException If either <code>args</code> or <code>prefix</code> is <code>null</code>
|
||||||
|
* - or if the data range value doesn't make sense
|
||||||
|
*/
|
||||||
|
|
||||||
|
public Options(String args[], Prefix prefix, int data) {
|
||||||
|
this(args, prefix, Multiplicity.ONCE, data, data);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor. The multiplicity is set to {@link Multiplicity#ONCE}.
|
||||||
|
* <p>
|
||||||
|
* @param args The command line arguments to check
|
||||||
|
* @param prefix The prefix to use for all command line options. It can only be set here for all options at
|
||||||
|
* the same time
|
||||||
|
* @param defMinData The default minimum number of data items for all sets (can be overridden when adding a set)
|
||||||
|
* @param defMaxData The default maximum number of data items for all sets (can be overridden when adding a set)
|
||||||
|
* <p>
|
||||||
|
* @throws IllegalArgumentException If either <code>args</code> or <code>prefix</code> is <code>null</code>
|
||||||
|
* - or if the data range values don't make sense
|
||||||
|
*/
|
||||||
|
|
||||||
|
public Options(String args[], Prefix prefix, int defMinData, int defMaxData) {
|
||||||
|
this(args, prefix, Multiplicity.ONCE, defMinData, defMaxData);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the (first) matching set. This invocation does not ignore unmatched options and requires that
|
||||||
|
* data items are the last ones on the command line.
|
||||||
|
* <p>
|
||||||
|
* @return The first set which matches (i. e. the <code>check()</code> method returns <code>true</code>) - or
|
||||||
|
* <code>null</code>, if no set matches.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public OptionSet getMatchingSet() {
|
||||||
|
return getMatchingSet(false, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the (first) matching set.
|
||||||
|
* <p>
|
||||||
|
* @param ignoreUnmatched A boolean to select whether unmatched options can be ignored in the checks or not
|
||||||
|
* @param requireDataLast A boolean to indicate whether the data items have to be the last ones on the command line or not
|
||||||
|
* <p>
|
||||||
|
* @return The first set which matches (i. e. the <code>check()</code> method returns <code>true</code>) - or
|
||||||
|
* <code>null</code>, if no set matches.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public OptionSet getMatchingSet(boolean ignoreUnmatched, boolean requireDataLast) {
|
||||||
|
for (String setName : optionSets.keySet())
|
||||||
|
if (check(setName, ignoreUnmatched, requireDataLast))
|
||||||
|
return optionSets.get(setName);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add an option set.
|
||||||
|
* <p>
|
||||||
|
* @param setName The name for the set. This must be a unique identifier
|
||||||
|
* @param minData The minimum number of data items for this set
|
||||||
|
* @param maxData The maximum number of data items for this set
|
||||||
|
* <p>
|
||||||
|
* @return The new <code>Optionset</code> instance created. This is useful to allow chaining of <code>addOption()</code>
|
||||||
|
* calls right after this method
|
||||||
|
*/
|
||||||
|
|
||||||
|
public OptionSet addSet(String setName, int minData, int maxData) {
|
||||||
|
if (setName == null) throw new IllegalArgumentException(CLASS + ": setName may not be null");
|
||||||
|
if (optionSets.containsKey(setName)) throw new IllegalArgumentException(CLASS + ": a set with the name "
|
||||||
|
+ setName + " has already been defined");
|
||||||
|
OptionSet os = new OptionSet(prefix, defaultMultiplicity, setName, minData, maxData);
|
||||||
|
optionSets.put(setName, os);
|
||||||
|
return os;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add an option set.
|
||||||
|
* <p>
|
||||||
|
* @param setName The name for the set. This must be a unique identifier
|
||||||
|
* @param data The minimum and maximum number of data items for this set
|
||||||
|
* <p>
|
||||||
|
* @return The new <code>Optionset</code> instance created. This is useful to allow chaining of <code>addOption()</code>
|
||||||
|
* calls right after this method
|
||||||
|
*/
|
||||||
|
|
||||||
|
public OptionSet addSet(String setName, int data) {
|
||||||
|
return addSet(setName, data, data);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add an option set. The defaults for the number of data items are used.
|
||||||
|
* <p>
|
||||||
|
* @param setName The name for the set. This must be a unique identifier
|
||||||
|
* <p>
|
||||||
|
* @return The new <code>Optionset</code> instance created. This is useful to allow chaining of <code>addOption()</code>
|
||||||
|
* calls right after this method
|
||||||
|
*/
|
||||||
|
|
||||||
|
public OptionSet addSet(String setName) {
|
||||||
|
return addSet(setName, defaultMinData, defaultMaxData);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return an option set - or <code>null</code>, if no set with the given name exists
|
||||||
|
* <p>
|
||||||
|
* @param setName The name for the set to retrieve
|
||||||
|
* <p>
|
||||||
|
* @return The set to retrieve (or <code>null</code>, if no set with the given name exists)
|
||||||
|
*/
|
||||||
|
|
||||||
|
public OptionSet getSet(String setName) {
|
||||||
|
return optionSets.get(setName);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This returns the (anonymous) default set
|
||||||
|
* <p>
|
||||||
|
* @return The default set
|
||||||
|
*/
|
||||||
|
|
||||||
|
public OptionSet getSet() {
|
||||||
|
if (getSet(DEFAULT_SET) == null)
|
||||||
|
addSet(DEFAULT_SET, defaultMinData, defaultMaxData);
|
||||||
|
return getSet(DEFAULT_SET);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The error messages collected during the last option check (invocation of any of the <code>check()</code> methods). This
|
||||||
|
* is useful to determine what was wrong with the command line arguments provided
|
||||||
|
* <p>
|
||||||
|
* @return A string with all collected error messages
|
||||||
|
*/
|
||||||
|
|
||||||
|
public String getCheckErrors() {
|
||||||
|
return checkErrors.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Run the checks for the default set. <code>ignoreUnmatched</code> is set to <code>false</code>, and
|
||||||
|
* <code>requireDataLast</code> is set to <code>true</code>.
|
||||||
|
* <p>
|
||||||
|
* @return A boolean indicating whether all checks were successful or not
|
||||||
|
*/
|
||||||
|
|
||||||
|
public boolean check() {
|
||||||
|
return check(DEFAULT_SET, false, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Run the checks for the default set.
|
||||||
|
* <p>
|
||||||
|
* @param ignoreUnmatched A boolean to select whether unmatched options can be ignored in the checks or not
|
||||||
|
* @param requireDataLast A boolean to indicate whether the data items have to be the last ones on the command line or not
|
||||||
|
* <p>
|
||||||
|
* @return A boolean indicating whether all checks were successful or not
|
||||||
|
*/
|
||||||
|
|
||||||
|
public boolean check(boolean ignoreUnmatched, boolean requireDataLast) {
|
||||||
|
return check(DEFAULT_SET, ignoreUnmatched, requireDataLast);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Run the checks for the given set. <code>ignoreUnmatched</code> is set to <code>false</code>, and
|
||||||
|
* <code>requireDataLast</code> is set to <code>true</code>.
|
||||||
|
* <p>
|
||||||
|
* @param setName The name for the set to check
|
||||||
|
* <p>
|
||||||
|
* @return A boolean indicating whether all checks were successful or not
|
||||||
|
* <p>
|
||||||
|
* @throws IllegalArgumentException If either <code>setName</code> is <code>null</code>, or the set is unknown.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public boolean check(String setName) {
|
||||||
|
return check(setName, false, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Run the checks for the given set.
|
||||||
|
* <p>
|
||||||
|
* @param setName The name for the set to check
|
||||||
|
* @param ignoreUnmatched A boolean to select whether unmatched options can be ignored in the checks or not
|
||||||
|
* @param requireDataLast A boolean to indicate whether the data items have to be the last ones on the command line or not
|
||||||
|
* <p>
|
||||||
|
* @return A boolean indicating whether all checks were successful or not
|
||||||
|
* <p>
|
||||||
|
* @throws IllegalArgumentException If either <code>setName</code> is <code>null</code>, or the set is unknown.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public boolean check(String setName, boolean ignoreUnmatched, boolean requireDataLast) {
|
||||||
|
|
||||||
|
if (setName == null) throw new IllegalArgumentException(CLASS + ": setName may not be null");
|
||||||
|
if (optionSets.get(setName) == null) throw new IllegalArgumentException(CLASS + ": Unknown OptionSet: " + setName);
|
||||||
|
|
||||||
|
checkErrors = new StringBuffer();
|
||||||
|
checkErrors.append("Checking set ");
|
||||||
|
checkErrors.append(setName);
|
||||||
|
checkErrors.append('\n');
|
||||||
|
|
||||||
|
//.... Access the data for the set to use
|
||||||
|
|
||||||
|
OptionSet set = optionSets.get(setName);
|
||||||
|
java.util.ArrayList<OptionData> options = set.getOptionData();
|
||||||
|
java.util.ArrayList<String> data = set.getData();
|
||||||
|
java.util.ArrayList<String> unmatched = set.getUnmatched();
|
||||||
|
|
||||||
|
//.... Catch some trivial cases
|
||||||
|
|
||||||
|
if (options.size() == 0) { // No options have been defined at all
|
||||||
|
if (arguments.length == 0) { // No arguments have been given: in this case, this is a success
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
checkErrors.append("No options have been defined, nothing to check\n");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
} else if (arguments.length == 0) { // Options have been defined, but no arguments given
|
||||||
|
checkErrors.append("Options have been defined, but no arguments have been given; nothing to check\n");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
//.... Parse all the arguments given
|
||||||
|
|
||||||
|
int ipos = 0;
|
||||||
|
int offset = 0;
|
||||||
|
java.util.regex.Matcher m = null;
|
||||||
|
String value = null;
|
||||||
|
String detail = null;
|
||||||
|
String next = null;
|
||||||
|
String key = null;
|
||||||
|
String pre = Character.toString(prefix.getName());
|
||||||
|
boolean add = true;
|
||||||
|
boolean[] matched = new boolean[arguments.length];
|
||||||
|
|
||||||
|
for (int i = 0; i < matched.length; i++) // Initially, we assume there was no match at all
|
||||||
|
matched[i] = false;
|
||||||
|
|
||||||
|
while (true) {
|
||||||
|
|
||||||
|
value = null;
|
||||||
|
detail = null;
|
||||||
|
offset = 0;
|
||||||
|
add = true;
|
||||||
|
key = arguments[ipos];
|
||||||
|
|
||||||
|
for (OptionData optionData : options) { // For each argument, we may need to check all defined options
|
||||||
|
m = optionData.getPattern().matcher(key);
|
||||||
|
if (m.lookingAt()) {
|
||||||
|
if (optionData.useValue()) { // The code section for value options
|
||||||
|
if (optionData.useDetail()) {
|
||||||
|
detail = m.group(1);
|
||||||
|
offset = 2; // required for correct Matcher.group access below
|
||||||
|
}
|
||||||
|
if (optionData.getSeparator() == Separator.BLANK) { // In this case, the next argument must be the value
|
||||||
|
if (ipos + 1 == arguments.length) { // The last argument, thus no value follows it: Error
|
||||||
|
checkErrors.append("At end of arguments - no value found following argument ");
|
||||||
|
checkErrors.append(key);
|
||||||
|
checkErrors.append('\n');
|
||||||
|
add = false;
|
||||||
|
} else {
|
||||||
|
next = arguments[ipos + 1];
|
||||||
|
if (next.startsWith(pre)) { // The next one is an argument, not a value: Error
|
||||||
|
checkErrors.append("No value found following argument ");
|
||||||
|
checkErrors.append(key);
|
||||||
|
checkErrors.append('\n');
|
||||||
|
add = false;
|
||||||
|
} else {
|
||||||
|
value = next;
|
||||||
|
matched[ipos++] = true; // Mark the key and the value
|
||||||
|
matched[ipos] = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else { // The value follows the separator in this case
|
||||||
|
value = m.group(1 + offset);
|
||||||
|
matched[ipos] = true;
|
||||||
|
}
|
||||||
|
} else { // Simple, non-value options
|
||||||
|
matched[ipos] = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (add) optionData.addResult(value, detail); // Store the result
|
||||||
|
break; // No need to check more options, we have a match
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ipos++; // Advance to the next argument to check
|
||||||
|
if (ipos >= arguments.length) break; // Terminating condition for the check loop
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//.... Identify unmatched arguments and actual (non-option) data
|
||||||
|
|
||||||
|
int first = -1; // Required later for requireDataLast
|
||||||
|
for (int i = 0; i < matched.length; i++) { // Assemble the list of unmatched options
|
||||||
|
if (!matched[i]) {
|
||||||
|
if (arguments[i].startsWith(pre)) { // This is an unmatched option
|
||||||
|
unmatched.add(arguments[i]);
|
||||||
|
checkErrors.append("No matching option found for argument ");
|
||||||
|
checkErrors.append(arguments[i]);
|
||||||
|
checkErrors.append('\n');
|
||||||
|
} else { // This is actual data
|
||||||
|
if (first < 0) first = i;
|
||||||
|
data.add(arguments[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//.... Checks to determine overall success; start with multiplicity of options
|
||||||
|
|
||||||
|
boolean err = true;
|
||||||
|
|
||||||
|
for (OptionData optionData : options) {
|
||||||
|
|
||||||
|
key = optionData.getKey();
|
||||||
|
err = false; // Local check result for one option
|
||||||
|
|
||||||
|
switch (optionData.getMultiplicity()) {
|
||||||
|
case ONCE: if (optionData.getResultCount() != 1) err = true; break;
|
||||||
|
case ONCE_OR_MORE: if (optionData.getResultCount() == 0) err = true; break;
|
||||||
|
case ZERO_OR_ONE: if (optionData.getResultCount() > 1) err = true; break;
|
||||||
|
case ZERO_OR_MORE: break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (err) {
|
||||||
|
checkErrors.append("Wrong number of occurences found for argument ");
|
||||||
|
checkErrors.append(prefix.getName());
|
||||||
|
checkErrors.append(key);
|
||||||
|
checkErrors.append('\n');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//.... Check range for data
|
||||||
|
|
||||||
|
if (data.size() < set.getMinData() || data.size() > set.getMaxData()) {
|
||||||
|
checkErrors.append("Invalid number of data arguments: ");
|
||||||
|
checkErrors.append(data.size());
|
||||||
|
checkErrors.append(" (allowed range: ");
|
||||||
|
checkErrors.append(set.getMinData());
|
||||||
|
checkErrors.append(" ... ");
|
||||||
|
checkErrors.append(set.getMaxData());
|
||||||
|
checkErrors.append(")\n");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
//.... Check for location of the data in the list of command line arguments
|
||||||
|
|
||||||
|
if (requireDataLast) {
|
||||||
|
if (first + data.size() != arguments.length) {
|
||||||
|
checkErrors.append("Invalid data specification: data arguments are not the last ones on the command line\n");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//.... Check for unmatched arguments
|
||||||
|
|
||||||
|
if (!ignoreUnmatched && unmatched.size() > 0) return false; // Don't accept unmatched arguments
|
||||||
|
|
||||||
|
//.... If we made it to here, all checks were successful
|
||||||
|
|
||||||
|
return true;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add the given non-value option to <i>all</i> known sets.
|
||||||
|
* See {@link OptionSet#addOption(String)} for details.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public void addOptionAllSets(String key) {
|
||||||
|
for (String setName : optionSets.keySet())
|
||||||
|
optionSets.get(setName).addOption(key, defaultMultiplicity);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add the given non-value option to <i>all</i> known sets.
|
||||||
|
* See {@link OptionSet#addOption(String, Options.Multiplicity)} for details.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public void addOptionAllSets(String key, Multiplicity multiplicity) {
|
||||||
|
for (String setName : optionSets.keySet())
|
||||||
|
optionSets.get(setName).addOption(key, false, Separator.NONE, false, multiplicity);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add the given value option to <i>all</i> known sets.
|
||||||
|
* See {@link OptionSet#addOption(String, Options.Separator)} for details.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public void addOptionAllSets(String key, Separator separator) {
|
||||||
|
for (String setName : optionSets.keySet())
|
||||||
|
optionSets.get(setName).addOption(key, false, separator, true, defaultMultiplicity);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add the given value option to <i>all</i> known sets.
|
||||||
|
* See {@link OptionSet#addOption(String, Options.Separator, Options.Multiplicity)} for details.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public void addOptionAllSets(String key, Separator separator, Multiplicity multiplicity) {
|
||||||
|
for (String setName : optionSets.keySet())
|
||||||
|
optionSets.get(setName).addOption(key, false, separator, true, multiplicity);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add the given value option to <i>all</i> known sets.
|
||||||
|
* See {@link OptionSet#addOption(String, boolean, Options.Separator)} for details.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public void addOptionAllSets(String key, boolean details, Separator separator) {
|
||||||
|
for (String setName : optionSets.keySet())
|
||||||
|
optionSets.get(setName).addOption(key, details, separator, true, defaultMultiplicity);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add the given value option to <i>all</i> known sets.
|
||||||
|
* See {@link OptionSet#addOption(String, boolean, Options.Separator, Options.Multiplicity)} for details.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public void addOptionAllSets(String key, boolean details, Separator separator, Multiplicity multiplicity) {
|
||||||
|
for (String setName : optionSets.keySet())
|
||||||
|
optionSets.get(setName).addOption(key, details, separator, true, multiplicity);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This is the overloaded {@link Object#toString()} method, and it is provided mainly for debugging
|
||||||
|
* purposes.
|
||||||
|
* <p>
|
||||||
|
* @return A string representing the instance
|
||||||
|
*/
|
||||||
|
|
||||||
|
public String toString() {
|
||||||
|
|
||||||
|
StringBuffer sb = new StringBuffer();
|
||||||
|
|
||||||
|
for (OptionSet set : optionSets.values()) {
|
||||||
|
sb.append("Set: ");
|
||||||
|
sb.append(set.getSetName());
|
||||||
|
sb.append('\n');
|
||||||
|
for (OptionData data : set.getOptionData()) {
|
||||||
|
sb.append(data.toString());
|
||||||
|
sb.append('\n');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return sb.toString();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -40,24 +40,18 @@ import org.eclipse.swt.widgets.Shell;
|
||||||
import org.eclipse.wb.swt.ResourceManager;
|
import org.eclipse.wb.swt.ResourceManager;
|
||||||
import org.eclipse.wb.swt.SWTResourceManager;
|
import org.eclipse.wb.swt.SWTResourceManager;
|
||||||
|
|
||||||
|
import com.minres.scviewer.e4.application.Messages;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Class AboutDialog.
|
* The Class AboutDialog.
|
||||||
*/
|
*/
|
||||||
public class AboutDialog extends Dialog {
|
public class AboutDialog extends Dialog {
|
||||||
|
|
||||||
/** The product title. */
|
/** The product title. */
|
||||||
private String productTitle=
|
private String productTitle=Messages.AboutDialog_0;
|
||||||
"\nSCViewer - a SystemC waveform viewer\n\nVersion: 1.0\n";
|
|
||||||
|
|
||||||
/** The copyright text. */
|
/** The copyright text. */
|
||||||
private String copyrightText="\nCopyright (c) 2015 MINRES Technologies GmbH and others.\n"+
|
private String copyrightText=Messages.AboutDialog_1;
|
||||||
"\n"+
|
|
||||||
"All 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\n"+
|
|
||||||
"Parts of the software are governed by the Apache License Version 2.0 available at http://www.apache.org/licenses/. "+
|
|
||||||
"These are namely org.apache.jdbm and org.sqlite JDBC driver\n"+
|
|
||||||
"\n\nSources code is hosted at GitHub: https://github.com/minres/SCViewer\n";
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create the dialog.
|
* Create the dialog.
|
||||||
|
@ -86,8 +80,8 @@ public class AboutDialog extends Dialog {
|
||||||
composite.setLayout(new GridLayout(2, false));
|
composite.setLayout(new GridLayout(2, false));
|
||||||
|
|
||||||
final Color white=SWTResourceManager.getColor(SWT.COLOR_WHITE);
|
final Color white=SWTResourceManager.getColor(SWT.COLOR_WHITE);
|
||||||
final Image scviewerLogo=ResourceManager.getPluginImage("com.minres.scviewer.e4.application", "icons/SCViewer_logo.png");
|
final Image scviewerLogo=ResourceManager.getPluginImage("com.minres.scviewer.e4.application", "icons/SCViewer_logo.png"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
final Image minresLogo=ResourceManager.getPluginImage("com.minres.scviewer.e4.application", "icons/Minres_logo.png");
|
final Image minresLogo=ResourceManager.getPluginImage("com.minres.scviewer.e4.application", "icons/Minres_logo.png"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
|
|
||||||
Canvas canvas = new Canvas(composite,SWT.NO_REDRAW_RESIZE);
|
Canvas canvas = new Canvas(composite,SWT.NO_REDRAW_RESIZE);
|
||||||
GridData gd_canvas = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
|
GridData gd_canvas = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
|
||||||
|
@ -117,7 +111,7 @@ public class AboutDialog extends Dialog {
|
||||||
styleRange.fontStyle = SWT.BOLD;
|
styleRange.fontStyle = SWT.BOLD;
|
||||||
styledText.setStyleRange(styleRange);
|
styledText.setStyleRange(styleRange);
|
||||||
///^(https?:\/\/)?([\da-z\.-]+)\.([a-z\.]{2,6})([\/\w \.-]*)*\/?$/
|
///^(https?:\/\/)?([\da-z\.-]+)\.([a-z\.]{2,6})([\/\w \.-]*)*\/?$/
|
||||||
Pattern pattern = Pattern.compile("https?:\\/\\/([\\da-z\\.-]+)\\.([a-z\\.]{2,6})([\\/\\w\\.-]*)*\\/?");
|
Pattern pattern = Pattern.compile("https?:\\/\\/([\\da-z\\.-]+)\\.([a-z\\.]{2,6})([\\/\\w\\.-]*)*\\/?"); //$NON-NLS-1$
|
||||||
// in case you would like to ignore case sensitivity,
|
// in case you would like to ignore case sensitivity,
|
||||||
// you could use this statement:
|
// you could use this statement:
|
||||||
// Pattern pattern = Pattern.compile("\\s+", Pattern.CASE_INSENSITIVE);
|
// Pattern pattern = Pattern.compile("\\s+", Pattern.CASE_INSENSITIVE);
|
||||||
|
@ -139,7 +133,7 @@ public class AboutDialog extends Dialog {
|
||||||
// links are activated on mouse down when the control key is held down
|
// links are activated on mouse down when the control key is held down
|
||||||
// if ((event.stateMask & SWT.MOD1) != 0) {
|
// if ((event.stateMask & SWT.MOD1) != 0) {
|
||||||
try {
|
try {
|
||||||
int offset = ((StyledText)event.widget).getOffsetAtLocation(new Point (event.x, event.y));
|
int offset = ((StyledText)event.widget).getOffsetAtPoint(new Point (event.x, event.y));
|
||||||
StyleRange style = ((StyledText)event.widget).getStyleRangeAtOffset(offset);
|
StyleRange style = ((StyledText)event.widget).getStyleRangeAtOffset(offset);
|
||||||
if (style != null && style.underline && style.underlineStyle == SWT.UNDERLINE_LINK) {
|
if (style != null && style.underline && style.underlineStyle == SWT.UNDERLINE_LINK) {
|
||||||
Desktop.getDesktop().browse(new java.net.URI(style.data.toString()));
|
Desktop.getDesktop().browse(new java.net.URI(style.data.toString()));
|
||||||
|
|
|
@ -68,6 +68,7 @@ import com.minres.scviewer.database.IHierNode;
|
||||||
import com.minres.scviewer.database.ITx;
|
import com.minres.scviewer.database.ITx;
|
||||||
import com.minres.scviewer.database.IWaveform;
|
import com.minres.scviewer.database.IWaveform;
|
||||||
import com.minres.scviewer.database.IWaveformDb;
|
import com.minres.scviewer.database.IWaveformDb;
|
||||||
|
import com.minres.scviewer.e4.application.Messages;
|
||||||
import com.minres.scviewer.e4.application.handlers.AddWaveformHandler;
|
import com.minres.scviewer.e4.application.handlers.AddWaveformHandler;
|
||||||
import com.minres.scviewer.e4.application.provider.TxDbContentProvider;
|
import com.minres.scviewer.e4.application.provider.TxDbContentProvider;
|
||||||
import com.minres.scviewer.e4.application.provider.TxDbLabelProvider;
|
import com.minres.scviewer.e4.application.provider.TxDbLabelProvider;
|
||||||
|
@ -79,7 +80,7 @@ import com.minres.scviewer.e4.application.provider.TxDbLabelProvider;
|
||||||
public class DesignBrowser {
|
public class DesignBrowser {
|
||||||
|
|
||||||
/** The Constant POPUP_ID. */
|
/** The Constant POPUP_ID. */
|
||||||
private static final String POPUP_ID="com.minres.scviewer.e4.application.parts.DesignBrowser.popupmenu";
|
private static final String POPUP_ID="com.minres.scviewer.e4.application.parts.DesignBrowser.popupmenu"; //$NON-NLS-1$
|
||||||
|
|
||||||
/** The event broker. */
|
/** The event broker. */
|
||||||
@Inject IEventBroker eventBroker;
|
@Inject IEventBroker eventBroker;
|
||||||
|
@ -124,7 +125,7 @@ public class DesignBrowser {
|
||||||
private PropertyChangeListener treeViewerPCL = new PropertyChangeListener() {
|
private PropertyChangeListener treeViewerPCL = new PropertyChangeListener() {
|
||||||
@Override
|
@Override
|
||||||
public void propertyChange(PropertyChangeEvent evt) {
|
public void propertyChange(PropertyChangeEvent evt) {
|
||||||
if("CHILDS".equals(evt.getPropertyName())){
|
if("CHILDS".equals(evt.getPropertyName())){ //$NON-NLS-1$
|
||||||
treeViewer.getTree().getDisplay().asyncExec(new Runnable() {
|
treeViewer.getTree().getDisplay().asyncExec(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
@ -215,7 +216,7 @@ public class DesignBrowser {
|
||||||
parent.setLayout(new GridLayout(1, false));
|
parent.setLayout(new GridLayout(1, false));
|
||||||
|
|
||||||
nameFilter = new Text(parent, SWT.BORDER);
|
nameFilter = new Text(parent, SWT.BORDER);
|
||||||
nameFilter.setMessage("Enter text to filter waveforms");
|
nameFilter.setMessage(Messages.DesignBrowser_2);
|
||||||
nameFilter.addModifyListener(new ModifyListener() {
|
nameFilter.addModifyListener(new ModifyListener() {
|
||||||
@Override
|
@Override
|
||||||
public void modifyText(ModifyEvent e) {
|
public void modifyText(ModifyEvent e) {
|
||||||
|
@ -237,7 +238,7 @@ public class DesignBrowser {
|
||||||
@Override
|
@Override
|
||||||
public void doubleClick(DoubleClickEvent event) {
|
public void doubleClick(DoubleClickEvent event) {
|
||||||
AddWaveformHandler myHandler = new AddWaveformHandler();
|
AddWaveformHandler myHandler = new AddWaveformHandler();
|
||||||
Object result = runCommand(myHandler, CanExecute.class, "after", false);
|
Object result = runCommand(myHandler, CanExecute.class, "after", false); //$NON-NLS-1$
|
||||||
if(result!=null && (Boolean)result)
|
if(result!=null && (Boolean)result)
|
||||||
ContextInjectionFactory.invoke(myHandler, Execute.class, eclipseCtx);
|
ContextInjectionFactory.invoke(myHandler, Execute.class, eclipseCtx);
|
||||||
}
|
}
|
||||||
|
@ -258,14 +259,14 @@ public class DesignBrowser {
|
||||||
toolBar.setBounds(0, 0, 87, 20);
|
toolBar.setBounds(0, 0, 87, 20);
|
||||||
|
|
||||||
appendItem = new ToolItem(toolBar, SWT.NONE);
|
appendItem = new ToolItem(toolBar, SWT.NONE);
|
||||||
appendItem.setToolTipText("Append after");
|
appendItem.setToolTipText(Messages.DesignBrowser_4);
|
||||||
appendItem.setImage(ResourceManager.getPluginImage("com.minres.scviewer.e4.application", "icons/append_wave.png"));
|
appendItem.setImage(ResourceManager.getPluginImage("com.minres.scviewer.e4.application", "icons/append_wave.png")); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
appendItem.setEnabled(false);
|
appendItem.setEnabled(false);
|
||||||
appendItem.addSelectionListener(new SelectionAdapter() {
|
appendItem.addSelectionListener(new SelectionAdapter() {
|
||||||
@Override
|
@Override
|
||||||
public void widgetSelected(SelectionEvent e) {
|
public void widgetSelected(SelectionEvent e) {
|
||||||
AddWaveformHandler myHandler = new AddWaveformHandler();
|
AddWaveformHandler myHandler = new AddWaveformHandler();
|
||||||
Object result = runCommand(myHandler, CanExecute.class, "after", false);
|
Object result = runCommand(myHandler, CanExecute.class, "after", false); //$NON-NLS-1$
|
||||||
if(result!=null && (Boolean)result)
|
if(result!=null && (Boolean)result)
|
||||||
ContextInjectionFactory.invoke(myHandler, Execute.class, eclipseCtx);
|
ContextInjectionFactory.invoke(myHandler, Execute.class, eclipseCtx);
|
||||||
}
|
}
|
||||||
|
@ -273,14 +274,14 @@ public class DesignBrowser {
|
||||||
});
|
});
|
||||||
|
|
||||||
insertItem = new ToolItem(toolBar, SWT.NONE);
|
insertItem = new ToolItem(toolBar, SWT.NONE);
|
||||||
insertItem.setToolTipText("Insert before");
|
insertItem.setToolTipText(Messages.DesignBrowser_8);
|
||||||
insertItem.setImage(ResourceManager.getPluginImage("com.minres.scviewer.e4.application", "icons/insert_wave.png"));
|
insertItem.setImage(ResourceManager.getPluginImage("com.minres.scviewer.e4.application", "icons/insert_wave.png")); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
insertItem.setEnabled(false);
|
insertItem.setEnabled(false);
|
||||||
insertItem.addSelectionListener(new SelectionAdapter() {
|
insertItem.addSelectionListener(new SelectionAdapter() {
|
||||||
@Override
|
@Override
|
||||||
public void widgetSelected(SelectionEvent e) {
|
public void widgetSelected(SelectionEvent e) {
|
||||||
AddWaveformHandler myHandler = new AddWaveformHandler();
|
AddWaveformHandler myHandler = new AddWaveformHandler();
|
||||||
Object result = runCommand(myHandler, CanExecute.class, "before", false);
|
Object result = runCommand(myHandler, CanExecute.class, "before", false); //$NON-NLS-1$
|
||||||
if(result!=null && (Boolean)result)
|
if(result!=null && (Boolean)result)
|
||||||
ContextInjectionFactory.invoke(myHandler, Execute.class, eclipseCtx);
|
ContextInjectionFactory.invoke(myHandler, Execute.class, eclipseCtx);
|
||||||
}
|
}
|
||||||
|
@ -288,8 +289,8 @@ public class DesignBrowser {
|
||||||
new ToolItem(toolBar, SWT.SEPARATOR);
|
new ToolItem(toolBar, SWT.SEPARATOR);
|
||||||
|
|
||||||
appendAllItem = new ToolItem(toolBar, SWT.NONE);
|
appendAllItem = new ToolItem(toolBar, SWT.NONE);
|
||||||
appendAllItem.setToolTipText("Append all after");
|
appendAllItem.setToolTipText(Messages.DesignBrowser_12);
|
||||||
appendAllItem.setImage(ResourceManager.getPluginImage("com.minres.scviewer.e4.application", "icons/append_all_waves.png"));
|
appendAllItem.setImage(ResourceManager.getPluginImage("com.minres.scviewer.e4.application", "icons/append_all_waves.png")); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
appendAllItem.setEnabled(false);
|
appendAllItem.setEnabled(false);
|
||||||
|
|
||||||
new ToolItem(toolBar, SWT.SEPARATOR);
|
new ToolItem(toolBar, SWT.SEPARATOR);
|
||||||
|
@ -301,7 +302,7 @@ public class DesignBrowser {
|
||||||
Object oldSel=selectionService.getSelection();
|
Object oldSel=selectionService.getSelection();
|
||||||
selectionService.setSelection(new StructuredSelection(all));
|
selectionService.setSelection(new StructuredSelection(all));
|
||||||
AddWaveformHandler myHandler = new AddWaveformHandler();
|
AddWaveformHandler myHandler = new AddWaveformHandler();
|
||||||
Object result = runCommand(myHandler, CanExecute.class, "after", false);
|
Object result = runCommand(myHandler, CanExecute.class, "after", false); //$NON-NLS-1$
|
||||||
if(result!=null && (Boolean)result)
|
if(result!=null && (Boolean)result)
|
||||||
ContextInjectionFactory.invoke(myHandler, Execute.class, eclipseCtx);
|
ContextInjectionFactory.invoke(myHandler, Execute.class, eclipseCtx);
|
||||||
selectionService.setSelection(oldSel);
|
selectionService.setSelection(oldSel);
|
||||||
|
@ -309,8 +310,8 @@ public class DesignBrowser {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
insertAllItem = new ToolItem(toolBar, SWT.NONE);
|
insertAllItem = new ToolItem(toolBar, SWT.NONE);
|
||||||
insertAllItem.setToolTipText("Insert all before");
|
insertAllItem.setToolTipText(Messages.DesignBrowser_16);
|
||||||
insertAllItem.setImage(ResourceManager.getPluginImage("com.minres.scviewer.e4.application", "icons/insert_all_waves.png"));
|
insertAllItem.setImage(ResourceManager.getPluginImage("com.minres.scviewer.e4.application", "icons/insert_all_waves.png")); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
insertAllItem.setEnabled(false);
|
insertAllItem.setEnabled(false);
|
||||||
insertAllItem.addSelectionListener(new SelectionAdapter() {
|
insertAllItem.addSelectionListener(new SelectionAdapter() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -320,7 +321,7 @@ public class DesignBrowser {
|
||||||
Object oldSel=selectionService.getSelection();
|
Object oldSel=selectionService.getSelection();
|
||||||
selectionService.setSelection(new StructuredSelection(all));
|
selectionService.setSelection(new StructuredSelection(all));
|
||||||
AddWaveformHandler myHandler = new AddWaveformHandler();
|
AddWaveformHandler myHandler = new AddWaveformHandler();
|
||||||
Object result = runCommand(myHandler, CanExecute.class, "before", false);
|
Object result = runCommand(myHandler, CanExecute.class, "before", false); //$NON-NLS-1$
|
||||||
if(result!=null && (Boolean)result)
|
if(result!=null && (Boolean)result)
|
||||||
ContextInjectionFactory.invoke(myHandler, Execute.class, eclipseCtx);
|
ContextInjectionFactory.invoke(myHandler, Execute.class, eclipseCtx);
|
||||||
selectionService.setSelection(oldSel);
|
selectionService.setSelection(oldSel);
|
||||||
|
@ -400,13 +401,13 @@ public class DesignBrowser {
|
||||||
if(txTableViewer!=null && !insertItem.isDisposed() && !appendItem.isDisposed() &&
|
if(txTableViewer!=null && !insertItem.isDisposed() && !appendItem.isDisposed() &&
|
||||||
!appendAllItem.isDisposed() && !insertAllItem.isDisposed()){
|
!appendAllItem.isDisposed() && !insertAllItem.isDisposed()){
|
||||||
AddWaveformHandler myHandler = new AddWaveformHandler();
|
AddWaveformHandler myHandler = new AddWaveformHandler();
|
||||||
Object result = runCommand(myHandler, CanExecute.class, "after", false);
|
Object result = runCommand(myHandler, CanExecute.class, "after", false); //$NON-NLS-1$
|
||||||
appendItem.setEnabled(result instanceof Boolean && (Boolean)result);
|
appendItem.setEnabled(result instanceof Boolean && (Boolean)result);
|
||||||
result = runCommand(myHandler, CanExecute.class, "after", true);
|
result = runCommand(myHandler, CanExecute.class, "after", true); //$NON-NLS-1$
|
||||||
appendAllItem.setEnabled(result instanceof Boolean && (Boolean)result);
|
appendAllItem.setEnabled(result instanceof Boolean && (Boolean)result);
|
||||||
result = runCommand(myHandler, CanExecute.class, "before", false);
|
result = runCommand(myHandler, CanExecute.class, "before", false); //$NON-NLS-1$
|
||||||
insertItem.setEnabled(result instanceof Boolean && (Boolean)result);
|
insertItem.setEnabled(result instanceof Boolean && (Boolean)result);
|
||||||
result = runCommand(myHandler, CanExecute.class, "before", true);
|
result = runCommand(myHandler, CanExecute.class, "before", true); //$NON-NLS-1$
|
||||||
insertAllItem.setEnabled(result instanceof Boolean && (Boolean)result);
|
insertAllItem.setEnabled(result instanceof Boolean && (Boolean)result);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -425,7 +426,7 @@ public class DesignBrowser {
|
||||||
* @param s the new search text
|
* @param s the new search text
|
||||||
*/
|
*/
|
||||||
public void setSearchText(String s) {
|
public void setSearchText(String s) {
|
||||||
this.searchString = ".*" + s + ".*";
|
this.searchString = ".*" + s + ".*"; //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
|
|
|
@ -10,10 +10,11 @@ import com.minres.scviewer.database.IWaveform;
|
||||||
import com.minres.scviewer.database.IWaveformDb;
|
import com.minres.scviewer.database.IWaveformDb;
|
||||||
import com.minres.scviewer.database.IWaveformEvent;
|
import com.minres.scviewer.database.IWaveformEvent;
|
||||||
import com.minres.scviewer.database.RelationType;
|
import com.minres.scviewer.database.RelationType;
|
||||||
|
import com.minres.scviewer.e4.application.Messages;
|
||||||
|
|
||||||
public class LoadingWaveformDb implements IWaveformDb {
|
public class LoadingWaveformDb implements IWaveformDb {
|
||||||
|
|
||||||
private final String label = "Database loading...";
|
private final String label = Messages.LoadingWaveformDb_0;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addPropertyChangeListener(PropertyChangeListener l) {
|
public void addPropertyChangeListener(PropertyChangeListener l) {
|
||||||
|
|
|
@ -55,6 +55,8 @@ import org.eclipse.swt.widgets.Tree;
|
||||||
import com.minres.scviewer.database.ITx;
|
import com.minres.scviewer.database.ITx;
|
||||||
import com.minres.scviewer.database.ITxAttribute;
|
import com.minres.scviewer.database.ITxAttribute;
|
||||||
import com.minres.scviewer.database.ITxRelation;
|
import com.minres.scviewer.database.ITxRelation;
|
||||||
|
import com.minres.scviewer.database.DataType;
|
||||||
|
import com.minres.scviewer.e4.application.Messages;
|
||||||
import com.minres.scviewer.e4.application.provider.TxPropertiesLabelProvider;
|
import com.minres.scviewer.e4.application.provider.TxPropertiesLabelProvider;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -107,7 +109,7 @@ public class TransactionDetails {
|
||||||
parent.setLayout(new GridLayout(1, false));
|
parent.setLayout(new GridLayout(1, false));
|
||||||
|
|
||||||
nameFilter = new Text(parent, SWT.BORDER);
|
nameFilter = new Text(parent, SWT.BORDER);
|
||||||
nameFilter.setMessage("Enter text to filter");
|
nameFilter.setMessage(Messages.TransactionDetails_0);
|
||||||
nameFilter.addModifyListener(new ModifyListener() {
|
nameFilter.addModifyListener(new ModifyListener() {
|
||||||
@Override
|
@Override
|
||||||
public void modifyText(ModifyEvent e) {
|
public void modifyText(ModifyEvent e) {
|
||||||
|
@ -133,7 +135,7 @@ public class TransactionDetails {
|
||||||
tree.setLayoutData(new GridData(GridData.FILL_BOTH));
|
tree.setLayoutData(new GridData(GridData.FILL_BOTH));
|
||||||
// Add the name column
|
// Add the name column
|
||||||
col1 = new TreeViewerColumn(treeViewer, SWT.NONE);
|
col1 = new TreeViewerColumn(treeViewer, SWT.NONE);
|
||||||
col1.getColumn().setText("Name");
|
col1.getColumn().setText(Messages.TransactionDetails_1);
|
||||||
col1.getColumn().setResizable(true);
|
col1.getColumn().setResizable(true);
|
||||||
col1.setLabelProvider(new DelegatingStyledCellLabelProvider(new AttributeLabelProvider(AttributeLabelProvider.NAME)));
|
col1.setLabelProvider(new DelegatingStyledCellLabelProvider(new AttributeLabelProvider(AttributeLabelProvider.NAME)));
|
||||||
col1.getColumn().addSelectionListener(new SelectionAdapter() {
|
col1.getColumn().addSelectionListener(new SelectionAdapter() {
|
||||||
|
@ -144,7 +146,7 @@ public class TransactionDetails {
|
||||||
});
|
});
|
||||||
// Add the type column
|
// Add the type column
|
||||||
col2 = new TreeViewerColumn(treeViewer, SWT.NONE);
|
col2 = new TreeViewerColumn(treeViewer, SWT.NONE);
|
||||||
col2.getColumn().setText("Type");
|
col2.getColumn().setText(Messages.TransactionDetails_2);
|
||||||
col2.getColumn().setResizable(true);
|
col2.getColumn().setResizable(true);
|
||||||
col2.setLabelProvider(new DelegatingStyledCellLabelProvider(new AttributeLabelProvider(AttributeLabelProvider.TYPE)));
|
col2.setLabelProvider(new DelegatingStyledCellLabelProvider(new AttributeLabelProvider(AttributeLabelProvider.TYPE)));
|
||||||
col2.getColumn().addSelectionListener(new SelectionAdapter() {
|
col2.getColumn().addSelectionListener(new SelectionAdapter() {
|
||||||
|
@ -155,7 +157,7 @@ public class TransactionDetails {
|
||||||
});
|
});
|
||||||
// Add the value column
|
// Add the value column
|
||||||
col3 = new TreeViewerColumn(treeViewer, SWT.NONE);
|
col3 = new TreeViewerColumn(treeViewer, SWT.NONE);
|
||||||
col3.getColumn().setText("Value");
|
col3.getColumn().setText(Messages.TransactionDetails_3);
|
||||||
col3.getColumn().setResizable(true);
|
col3.getColumn().setResizable(true);
|
||||||
col3.setLabelProvider(new DelegatingStyledCellLabelProvider(new AttributeLabelProvider(AttributeLabelProvider.VALUE)));
|
col3.setLabelProvider(new DelegatingStyledCellLabelProvider(new AttributeLabelProvider(AttributeLabelProvider.VALUE)));
|
||||||
col3.getColumn().addSelectionListener(new SelectionAdapter() {
|
col3.getColumn().addSelectionListener(new SelectionAdapter() {
|
||||||
|
@ -282,8 +284,8 @@ public class TransactionDetails {
|
||||||
*/
|
*/
|
||||||
String txToString(ITx tx){
|
String txToString(ITx tx){
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
sb.append("tx#").append(tx.getId()).append("[").append(timeToString(tx.getBeginTime())).
|
sb.append("tx#").append(tx.getId()).append("[").append(timeToString(tx.getBeginTime())). //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
append(" - ").append(timeToString(tx.getEndTime())).append("]");
|
append(" - ").append(timeToString(tx.getEndTime())).append("]"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
return sb.toString();
|
return sb.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -330,7 +332,6 @@ public class TransactionDetails {
|
||||||
* @param e2 the e2
|
* @param e2 the e2
|
||||||
* @return the int
|
* @return the int
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
public int compare(Viewer viewer, Object e1, Object e2) {
|
public int compare(Viewer viewer, Object e1, Object e2) {
|
||||||
int rc = 0;
|
int rc = 0;
|
||||||
if(e1 instanceof ITxAttribute && e2 instanceof ITxAttribute){
|
if(e1 instanceof ITxAttribute && e2 instanceof ITxAttribute){
|
||||||
|
@ -369,7 +370,7 @@ public class TransactionDetails {
|
||||||
* @param s the new search text
|
* @param s the new search text
|
||||||
*/
|
*/
|
||||||
public void setSearchText(String s) {
|
public void setSearchText(String s) {
|
||||||
this.searchString = ".*" + s + ".*";
|
this.searchString = ".*" + s + ".*"; //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
|
@ -427,12 +428,12 @@ PROPS, /** The attrs. */
|
||||||
*/
|
*/
|
||||||
public String toString(){
|
public String toString(){
|
||||||
switch(type){
|
switch(type){
|
||||||
case PROPS: return "Properties";
|
case PROPS: return Messages.TransactionDetails_10;
|
||||||
case ATTRS: return "Attributes";
|
case ATTRS: return Messages.TransactionDetails_11;
|
||||||
case IN_REL: return "Incoming relations";
|
case IN_REL: return Messages.TransactionDetails_12;
|
||||||
case OUT_REL: return "Outgoing relations";
|
case OUT_REL: return Messages.TransactionDetails_13;
|
||||||
}
|
}
|
||||||
return "";
|
return ""; //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -476,10 +477,10 @@ PROPS, /** The attrs. */
|
||||||
TreeNode propertyHolder=(TreeNode) element;
|
TreeNode propertyHolder=(TreeNode) element;
|
||||||
if(propertyHolder.type == Type.PROPS){
|
if(propertyHolder.type == Type.PROPS){
|
||||||
return new Object[][]{
|
return new Object[][]{
|
||||||
{"Name", "String", propertyHolder.element.getStream().getFullName()},
|
{Messages.TransactionDetails_1, Messages.TransactionDetails_16, propertyHolder.element.getStream().getFullName()},
|
||||||
{"Type", "String", propertyHolder.element.getGenerator().getName()},
|
{Messages.TransactionDetails_2, Messages.TransactionDetails_16, propertyHolder.element.getGenerator().getName()},
|
||||||
{"Start time", "Time", timeToString(propertyHolder.element.getBeginTime())},
|
{Messages.TransactionDetails_19, Messages.TransactionDetails_20, timeToString(propertyHolder.element.getBeginTime())},
|
||||||
{"End time", "Time", timeToString(propertyHolder.element.getEndTime())}
|
{Messages.TransactionDetails_21, Messages.TransactionDetails_20, timeToString(propertyHolder.element.getEndTime())}
|
||||||
};
|
};
|
||||||
}else if(propertyHolder.type == Type.ATTRS)
|
}else if(propertyHolder.type == Type.ATTRS)
|
||||||
return propertyHolder.element.getAttributes().toArray();
|
return propertyHolder.element.getAttributes().toArray();
|
||||||
|
@ -561,7 +562,7 @@ PROPS, /** The attrs. */
|
||||||
ITxAttribute attribute = (ITxAttribute) element;
|
ITxAttribute attribute = (ITxAttribute) element;
|
||||||
return new StyledString(attribute.getName());
|
return new StyledString(attribute.getName());
|
||||||
}else if (element instanceof ITxRelation) {
|
}else if (element instanceof ITxRelation) {
|
||||||
return new StyledString("Relation");
|
return new StyledString(Messages.TransactionDetails_4);
|
||||||
}else if(element instanceof Object[]){
|
}else if(element instanceof Object[]){
|
||||||
Object[] elements = (Object[]) element;
|
Object[] elements = (Object[]) element;
|
||||||
return new StyledString(elements[field].toString());
|
return new StyledString(elements[field].toString());
|
||||||
|
@ -575,18 +576,24 @@ PROPS, /** The attrs. */
|
||||||
Object[] elements = (Object[]) element;
|
Object[] elements = (Object[]) element;
|
||||||
return new StyledString(elements[field].toString());
|
return new StyledString(elements[field].toString());
|
||||||
}else
|
}else
|
||||||
return new StyledString("");
|
return new StyledString(""); //$NON-NLS-1$
|
||||||
default:
|
default:
|
||||||
if (element instanceof ITxAttribute) {
|
if (element instanceof ITxAttribute) {
|
||||||
ITxAttribute attribute = (ITxAttribute) element;
|
ITxAttribute attribute = (ITxAttribute) element;
|
||||||
return new StyledString(attribute.getValue().toString());
|
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()))+"]";
|
||||||
|
} catch(NumberFormatException e) { }
|
||||||
|
}
|
||||||
|
return new StyledString(value);
|
||||||
}else if(element instanceof Object[]){
|
}else if(element instanceof Object[]){
|
||||||
Object[] elements = (Object[]) element;
|
Object[] elements = (Object[]) element;
|
||||||
return new StyledString(elements[field].toString());
|
return new StyledString(elements[field].toString());
|
||||||
} else if(element instanceof ITx){
|
} else if(element instanceof ITx){
|
||||||
return new StyledString(txToString((ITx) element));
|
return new StyledString(txToString((ITx) element));
|
||||||
}else
|
}else
|
||||||
return new StyledString("");
|
return new StyledString(""); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,6 +14,7 @@ import java.beans.PropertyChangeEvent;
|
||||||
import java.beans.PropertyChangeListener;
|
import java.beans.PropertyChangeListener;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileInputStream;
|
import java.io.FileInputStream;
|
||||||
|
import java.io.FileNotFoundException;
|
||||||
import java.io.FileOutputStream;
|
import java.io.FileOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
@ -31,6 +32,7 @@ import javax.inject.Named;
|
||||||
|
|
||||||
import org.eclipse.core.runtime.IProgressMonitor;
|
import org.eclipse.core.runtime.IProgressMonitor;
|
||||||
import org.eclipse.core.runtime.IStatus;
|
import org.eclipse.core.runtime.IStatus;
|
||||||
|
import org.eclipse.core.runtime.Platform;
|
||||||
import org.eclipse.core.runtime.Status;
|
import org.eclipse.core.runtime.Status;
|
||||||
import org.eclipse.core.runtime.SubMonitor;
|
import org.eclipse.core.runtime.SubMonitor;
|
||||||
import org.eclipse.core.runtime.jobs.IJobChangeEvent;
|
import org.eclipse.core.runtime.jobs.IJobChangeEvent;
|
||||||
|
@ -55,9 +57,16 @@ import org.eclipse.jface.viewers.ISelection;
|
||||||
import org.eclipse.jface.viewers.ISelectionChangedListener;
|
import org.eclipse.jface.viewers.ISelectionChangedListener;
|
||||||
import org.eclipse.jface.viewers.IStructuredSelection;
|
import org.eclipse.jface.viewers.IStructuredSelection;
|
||||||
import org.eclipse.jface.viewers.SelectionChangedEvent;
|
import org.eclipse.jface.viewers.SelectionChangedEvent;
|
||||||
|
import org.eclipse.swt.SWT;
|
||||||
|
import org.eclipse.swt.events.MouseEvent;
|
||||||
|
import org.eclipse.swt.events.MouseTrackListener;
|
||||||
|
import org.eclipse.swt.events.MouseWheelListener;
|
||||||
import org.eclipse.swt.graphics.RGB;
|
import org.eclipse.swt.graphics.RGB;
|
||||||
|
import org.eclipse.swt.graphics.Rectangle;
|
||||||
import org.eclipse.swt.widgets.Composite;
|
import org.eclipse.swt.widgets.Composite;
|
||||||
import org.eclipse.swt.widgets.Display;
|
import org.eclipse.swt.widgets.Display;
|
||||||
|
import org.eclipse.swt.widgets.Event;
|
||||||
|
import org.eclipse.swt.widgets.Listener;
|
||||||
|
|
||||||
import com.minres.scviewer.database.ITx;
|
import com.minres.scviewer.database.ITx;
|
||||||
import com.minres.scviewer.database.ITxRelation;
|
import com.minres.scviewer.database.ITxRelation;
|
||||||
|
@ -66,12 +75,16 @@ import com.minres.scviewer.database.IWaveformDb;
|
||||||
import com.minres.scviewer.database.IWaveformDbFactory;
|
import com.minres.scviewer.database.IWaveformDbFactory;
|
||||||
import com.minres.scviewer.database.IWaveformEvent;
|
import com.minres.scviewer.database.IWaveformEvent;
|
||||||
import com.minres.scviewer.database.RelationType;
|
import com.minres.scviewer.database.RelationType;
|
||||||
|
import com.minres.scviewer.database.swt.Constants;
|
||||||
import com.minres.scviewer.database.swt.WaveformViewerFactory;
|
import com.minres.scviewer.database.swt.WaveformViewerFactory;
|
||||||
import com.minres.scviewer.database.ui.GotoDirection;
|
import com.minres.scviewer.database.ui.GotoDirection;
|
||||||
import com.minres.scviewer.database.ui.ICursor;
|
import com.minres.scviewer.database.ui.ICursor;
|
||||||
import com.minres.scviewer.database.ui.IWaveformViewer;
|
import com.minres.scviewer.database.ui.IWaveformViewer;
|
||||||
import com.minres.scviewer.database.ui.TrackEntry;
|
import com.minres.scviewer.database.ui.TrackEntry;
|
||||||
|
import com.minres.scviewer.database.ui.TrackEntry.ValueDisplay;
|
||||||
|
import com.minres.scviewer.database.ui.TrackEntry.WaveDisplay;
|
||||||
import com.minres.scviewer.database.ui.WaveformColors;
|
import com.minres.scviewer.database.ui.WaveformColors;
|
||||||
|
import com.minres.scviewer.e4.application.Messages;
|
||||||
import com.minres.scviewer.e4.application.internal.status.WaveStatusBarControl;
|
import com.minres.scviewer.e4.application.internal.status.WaveStatusBarControl;
|
||||||
import com.minres.scviewer.e4.application.internal.util.FileMonitor;
|
import com.minres.scviewer.e4.application.internal.util.FileMonitor;
|
||||||
import com.minres.scviewer.e4.application.internal.util.IFileChangeListener;
|
import com.minres.scviewer.e4.application.internal.util.IFileChangeListener;
|
||||||
|
@ -86,25 +99,29 @@ import com.minres.scviewer.e4.application.preferences.PreferenceConstants;
|
||||||
public class WaveformViewer implements IFileChangeListener, IPreferenceChangeListener {
|
public class WaveformViewer implements IFileChangeListener, IPreferenceChangeListener {
|
||||||
|
|
||||||
/** The Constant ACTIVE_WAVEFORMVIEW. */
|
/** The Constant ACTIVE_WAVEFORMVIEW. */
|
||||||
public static final String ACTIVE_WAVEFORMVIEW = "Active_Waveform_View";
|
public static final String ACTIVE_WAVEFORMVIEW = "Active_Waveform_View"; //$NON-NLS-1$
|
||||||
|
|
||||||
/** The Constant ADD_WAVEFORM. */
|
/** The Constant ADD_WAVEFORM. */
|
||||||
public static final String ADD_WAVEFORM = "AddWaveform";
|
public static final String ADD_WAVEFORM = "AddWaveform"; //$NON-NLS-1$
|
||||||
|
|
||||||
/** The Constant DATABASE_FILE. */
|
/** The Constant DATABASE_FILE. */
|
||||||
protected static final String DATABASE_FILE = "DATABASE_FILE";
|
protected static final String DATABASE_FILE = "DATABASE_FILE"; //$NON-NLS-1$
|
||||||
|
|
||||||
/** The Constant SHOWN_WAVEFORM. */
|
/** The Constant SHOWN_WAVEFORM. */
|
||||||
protected static final String SHOWN_WAVEFORM = "SHOWN_WAVEFORM";
|
protected static final String SHOWN_WAVEFORM = "SHOWN_WAVEFORM"; //$NON-NLS-1$
|
||||||
|
|
||||||
|
protected static final String VALUE_DISPLAY = ".VALUE_DISPLAY"; //$NON-NLS-1$
|
||||||
|
|
||||||
|
protected static final String WAVE_DISPLAY = ".WAVE_DISPLAY"; //$NON-NLS-1$
|
||||||
|
|
||||||
/** The Constant SHOWN_CURSOR. */
|
/** The Constant SHOWN_CURSOR. */
|
||||||
protected static final String SHOWN_CURSOR = "SHOWN_CURSOR";
|
protected static final String SHOWN_CURSOR = "SHOWN_CURSOR"; //$NON-NLS-1$
|
||||||
|
|
||||||
/** The Constant ZOOM_LEVEL. */
|
/** The Constant ZOOM_LEVEL. */
|
||||||
protected static final String ZOOM_LEVEL = "ZOOM_LEVEL";
|
protected static final String ZOOM_LEVEL = "ZOOM_LEVEL"; //$NON-NLS-1$
|
||||||
|
|
||||||
/** The Constant BASE_LINE_TIME. */
|
/** The Constant BASE_LINE_TIME. */
|
||||||
protected static final String BASE_LINE_TIME = "BASE_LINE_TIME";
|
protected static final String BASE_LINE_TIME = "BASE_LINE_TIME"; //$NON-NLS-1$
|
||||||
|
|
||||||
/** The Constant FILE_CHECK_INTERVAL. */
|
/** The Constant FILE_CHECK_INTERVAL. */
|
||||||
protected static final long FILE_CHECK_INTERVAL = 60000;
|
protected static final long FILE_CHECK_INTERVAL = 60000;
|
||||||
|
@ -116,7 +133,7 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
|
||||||
public static final String ID = "com.minres.scviewer.ui.TxEditorPart"; //$NON-NLS-1$
|
public static final String ID = "com.minres.scviewer.ui.TxEditorPart"; //$NON-NLS-1$
|
||||||
|
|
||||||
/** The Constant WAVE_ACTION_ID. */
|
/** The Constant WAVE_ACTION_ID. */
|
||||||
public static final String WAVE_ACTION_ID = "com.minres.scviewer.ui.action.AddToWave";
|
public static final String WAVE_ACTION_ID = "com.minres.scviewer.ui.action.AddToWave"; //$NON-NLS-1$
|
||||||
|
|
||||||
/** The factory. */
|
/** The factory. */
|
||||||
WaveformViewerFactory factory = new WaveformViewerFactory();
|
WaveformViewerFactory factory = new WaveformViewerFactory();
|
||||||
|
@ -136,7 +153,7 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
|
||||||
@Inject
|
@Inject
|
||||||
ESelectionService selectionService;
|
ESelectionService selectionService;
|
||||||
|
|
||||||
/** The e part service. */
|
/** The part service. */
|
||||||
@Inject
|
@Inject
|
||||||
EPartService ePartService;
|
EPartService ePartService;
|
||||||
|
|
||||||
|
@ -193,7 +210,7 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
|
||||||
database.addPropertyChangeListener(new PropertyChangeListener() {
|
database.addPropertyChangeListener(new PropertyChangeListener() {
|
||||||
@Override
|
@Override
|
||||||
public void propertyChange(PropertyChangeEvent evt) {
|
public void propertyChange(PropertyChangeEvent evt) {
|
||||||
if ("WAVEFORMS".equals(evt.getPropertyName())) {
|
if ("WAVEFORMS".equals(evt.getPropertyName())) { //$NON-NLS-1$
|
||||||
myParent.getDisplay().syncExec(new Runnable() {
|
myParent.getDisplay().syncExec(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
@ -231,25 +248,127 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
|
||||||
selectionService.setSelection(event.getSelection());
|
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() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void handleEvent(Event e) {
|
||||||
|
int state = e.stateMask & SWT.MODIFIER_MASK;
|
||||||
|
if(Platform.OS_MACOSX.equals(Platform.getOS())) { //swap cammnd and control for MacOSX
|
||||||
|
if((state&SWT.COMMAND)!=0) {
|
||||||
|
state&=~SWT.COMMAND;
|
||||||
|
state|=SWT.CONTROL;
|
||||||
|
} else if((state&SWT.CONTROL)!=0) {
|
||||||
|
state&=~SWT.CONTROL;
|
||||||
|
state|=SWT.COMMAND;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(state==SWT.ALT) {
|
||||||
|
switch(e.keyCode) {
|
||||||
|
case SWT.ARROW_LEFT:
|
||||||
|
waveformPane.scrollHorizontal(-100);
|
||||||
|
return;
|
||||||
|
case SWT.ARROW_RIGHT:
|
||||||
|
waveformPane.scrollHorizontal(100);
|
||||||
|
return;
|
||||||
|
case SWT.KEYPAD_ADD:
|
||||||
|
return;
|
||||||
|
case SWT.KEYPAD_SUBTRACT:
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
} else if(state==SWT.CTRL) {
|
||||||
|
int zoomlevel = waveformPane.getZoomLevel();
|
||||||
|
switch(e.keyCode) {
|
||||||
|
case '+':
|
||||||
|
case SWT.KEYPAD_ADD:
|
||||||
|
if(zoomlevel>0)
|
||||||
|
waveformPane.setZoomLevel(zoomlevel-1);
|
||||||
|
return;
|
||||||
|
case '-':
|
||||||
|
case SWT.KEYPAD_SUBTRACT:
|
||||||
|
if(zoomlevel<waveformPane.getZoomLevels().length-1)
|
||||||
|
waveformPane.setZoomLevel(zoomlevel+1);
|
||||||
|
return;
|
||||||
|
case SWT.ARROW_UP:
|
||||||
|
waveformPane.moveSelectedTrack(-1);
|
||||||
|
return;
|
||||||
|
case SWT.ARROW_DOWN:
|
||||||
|
waveformPane.moveSelectedTrack(1);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
} else if(state==SWT.SHIFT) {
|
||||||
|
} else {
|
||||||
|
switch(e.keyCode) {
|
||||||
|
case SWT.ARROW_LEFT:
|
||||||
|
waveformPane.scrollHorizontal(-10);
|
||||||
|
return;
|
||||||
|
case SWT.ARROW_RIGHT:
|
||||||
|
waveformPane.scrollHorizontal(10);
|
||||||
|
return;
|
||||||
|
case SWT.ARROW_UP:
|
||||||
|
waveformPane.moveSelection(GotoDirection.UP);
|
||||||
|
return;
|
||||||
|
case SWT.ARROW_DOWN:
|
||||||
|
waveformPane.moveSelection(GotoDirection.DOWN);
|
||||||
|
return;
|
||||||
|
case SWT.HOME: return; //TODO: should be handled
|
||||||
|
case SWT.END: return; //TODO: should be handled
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
zoomLevel = waveformPane.getZoomLevels();
|
zoomLevel = waveformPane.getZoomLevels();
|
||||||
setupColors();
|
setupColors();
|
||||||
checkForUpdates = prefs.getBoolean(PreferenceConstants.DATABASE_RELOAD, true);
|
checkForUpdates = prefs.getBoolean(PreferenceConstants.DATABASE_RELOAD, true);
|
||||||
filesToLoad = new ArrayList<File>();
|
filesToLoad = new ArrayList<File>();
|
||||||
persistedState = part.getPersistedState();
|
persistedState = part.getPersistedState();
|
||||||
Integer files = persistedState.containsKey(DATABASE_FILE + "S")
|
Integer files = persistedState.containsKey(DATABASE_FILE + "S") //$NON-NLS-1$
|
||||||
? Integer.parseInt(persistedState.get(DATABASE_FILE + "S")) : 0;
|
? Integer.parseInt(persistedState.get(DATABASE_FILE + "S")) : 0; //$NON-NLS-1$
|
||||||
for (int i = 0; i < files; i++) {
|
for (int i = 0; i < files; i++) {
|
||||||
filesToLoad.add(new File(persistedState.get(DATABASE_FILE + i)));
|
filesToLoad.add(new File(persistedState.get(DATABASE_FILE + i)));
|
||||||
}
|
}
|
||||||
if (filesToLoad.size() > 0)
|
if (filesToLoad.size() > 0)
|
||||||
loadDatabase(persistedState);
|
loadDatabase(persistedState);
|
||||||
eventBroker.post(WaveStatusBarControl.ZOOM_LEVEL, zoomLevel[waveformPane.getZoomLevel()]);
|
eventBroker.post(WaveStatusBarControl.ZOOM_LEVEL, zoomLevel[waveformPane.getZoomLevel()]);
|
||||||
|
// menuService.registerContextMenu(waveformPane.getNameControl(),
|
||||||
|
// "com.minres.scviewer.e4.application.popupmenu.namecontext"); //$NON-NLS-1$
|
||||||
menuService.registerContextMenu(waveformPane.getNameControl(),
|
menuService.registerContextMenu(waveformPane.getNameControl(),
|
||||||
"com.minres.scviewer.e4.application.popupmenu.namecontext");
|
"com.minres.scviewer.e4.application.popupmenu.wavecontext"); //$NON-NLS-1$
|
||||||
menuService.registerContextMenu(waveformPane.getValueControl(),
|
menuService.registerContextMenu(waveformPane.getValueControl(),
|
||||||
"com.minres.scviewer.e4.application.popupmenu.namecontext");
|
"com.minres.scviewer.e4.application.popupmenu.wavecontext"); //$NON-NLS-1$
|
||||||
menuService.registerContextMenu(waveformPane.getWaveformControl(),
|
menuService.registerContextMenu(waveformPane.getWaveformControl(),
|
||||||
"com.minres.scviewer.e4.application.popupmenu.wavecontext");
|
"com.minres.scviewer.e4.application.popupmenu.wavecontext"); //$NON-NLS-1$
|
||||||
ePartService.addPartListener(new PartListener() {
|
ePartService.addPartListener(new PartListener() {
|
||||||
@Override
|
@Override
|
||||||
public void partActivated(MPart part) {
|
public void partActivated(MPart part) {
|
||||||
|
@ -288,7 +407,7 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
|
||||||
DefaultValuesInitializer initializer = new DefaultValuesInitializer();
|
DefaultValuesInitializer initializer = new DefaultValuesInitializer();
|
||||||
HashMap<WaveformColors, RGB> colorPref = new HashMap<>();
|
HashMap<WaveformColors, RGB> colorPref = new HashMap<>();
|
||||||
for (WaveformColors c : WaveformColors.values()) {
|
for (WaveformColors c : WaveformColors.values()) {
|
||||||
String prefValue = prefs.get(c.name() + "_COLOR",
|
String prefValue = prefs.get(c.name() + "_COLOR", //$NON-NLS-1$
|
||||||
StringConverter.asString(initializer.colors[c.ordinal()].getRGB()));
|
StringConverter.asString(initializer.colors[c.ordinal()].getRGB()));
|
||||||
RGB rgb = StringConverter.asRGB(prefValue);
|
RGB rgb = StringConverter.asRGB(prefValue);
|
||||||
colorPref.put(c, rgb);
|
colorPref.put(c, rgb);
|
||||||
|
@ -303,7 +422,7 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
|
||||||
*/
|
*/
|
||||||
protected void loadDatabase(final Map<String, String> state) {
|
protected void loadDatabase(final Map<String, String> state) {
|
||||||
fileMonitor.removeFileChangeListener(this);
|
fileMonitor.removeFileChangeListener(this);
|
||||||
Job job = new Job("Database Load Job") {
|
Job job = new Job(Messages.WaveformViewer_15) {
|
||||||
@Override
|
@Override
|
||||||
protected IStatus run(IProgressMonitor monitor) {
|
protected IStatus run(IProgressMonitor monitor) {
|
||||||
// convert to SubMonitor and set total number of work units
|
// convert to SubMonitor and set total number of work units
|
||||||
|
@ -311,7 +430,7 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
|
||||||
try {
|
try {
|
||||||
subMonitor.worked(1);
|
subMonitor.worked(1);
|
||||||
for (File file : filesToLoad) {
|
for (File file : filesToLoad) {
|
||||||
subMonitor.setTaskName("Loading "+file.getName());
|
subMonitor.setTaskName(Messages.WaveformViewer_16+file.getName());
|
||||||
database.load(file);
|
database.load(file);
|
||||||
database.addPropertyChangeListener(waveformPane);
|
database.addPropertyChangeListener(waveformPane);
|
||||||
subMonitor.worked(1);
|
subMonitor.worked(1);
|
||||||
|
@ -358,8 +477,8 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
|
||||||
display.asyncExec(new Runnable() {
|
display.asyncExec(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
if (MessageDialog.openQuestion(display.getActiveShell(), "Database re-load",
|
if (MessageDialog.openQuestion(display.getActiveShell(), Messages.WaveformViewer_17,
|
||||||
"Would you like to reload the database?")) {
|
Messages.WaveformViewer_18)) {
|
||||||
Map<String, String> state = new HashMap<>();
|
Map<String, String> state = new HashMap<>();
|
||||||
saveWaveformViewerState(state);
|
saveWaveformViewerState(state);
|
||||||
waveformPane.getStreamList().clear();
|
waveformPane.getStreamList().clear();
|
||||||
|
@ -379,7 +498,7 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
|
||||||
*/
|
*/
|
||||||
@Inject
|
@Inject
|
||||||
@Optional
|
@Optional
|
||||||
public void setPartInput(@Named("input") Object partInput) {
|
public void setPartInput(@Named("input") Object partInput, @Named("config") Object partConfig) {
|
||||||
if (partInput instanceof File) {
|
if (partInput instanceof File) {
|
||||||
filesToLoad = new ArrayList<File>();
|
filesToLoad = new ArrayList<File>();
|
||||||
File file = (File) partInput;
|
File file = (File) partInput;
|
||||||
|
@ -387,15 +506,15 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
|
||||||
filesToLoad.add(file);
|
filesToLoad.add(file);
|
||||||
try {
|
try {
|
||||||
String ext = getFileExtension(file.getName());
|
String ext = getFileExtension(file.getName());
|
||||||
if ("vcd".equals(ext.toLowerCase())) {
|
if (Messages.WaveformViewer_19.equals(ext.toLowerCase())) {
|
||||||
if (askIfToLoad(new File(renameFileExtension(file.getCanonicalPath(), "txdb")))) {
|
if (askIfToLoad(new File(renameFileExtension(file.getCanonicalPath(), Messages.WaveformViewer_20)))) {
|
||||||
filesToLoad.add(new File(renameFileExtension(file.getCanonicalPath(), "txdb")));
|
filesToLoad.add(new File(renameFileExtension(file.getCanonicalPath(), Messages.WaveformViewer_20)));
|
||||||
} else if (askIfToLoad(new File(renameFileExtension(file.getCanonicalPath(), "txlog")))) {
|
} else if (askIfToLoad(new File(renameFileExtension(file.getCanonicalPath(), Messages.WaveformViewer_21)))) {
|
||||||
filesToLoad.add(new File(renameFileExtension(file.getCanonicalPath(), "txlog")));
|
filesToLoad.add(new File(renameFileExtension(file.getCanonicalPath(), Messages.WaveformViewer_21)));
|
||||||
}
|
}
|
||||||
} else if ("txdb".equals(ext.toLowerCase()) || "txlog".equals(ext.toLowerCase())) {
|
} else if (Messages.WaveformViewer_20.equals(ext.toLowerCase()) || Messages.WaveformViewer_21.equals(ext.toLowerCase())) {
|
||||||
if (askIfToLoad(new File(renameFileExtension(file.getCanonicalPath(), "vcd")))) {
|
if (askIfToLoad(new File(renameFileExtension(file.getCanonicalPath(), Messages.WaveformViewer_19)))) {
|
||||||
filesToLoad.add(new File(renameFileExtension(file.getCanonicalPath(), "vcd")));
|
filesToLoad.add(new File(renameFileExtension(file.getCanonicalPath(), Messages.WaveformViewer_19)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (IOException e) { // silently ignore any error
|
} catch (IOException e) { // silently ignore any error
|
||||||
|
@ -403,6 +522,9 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
|
||||||
}
|
}
|
||||||
if (filesToLoad.size() > 0)
|
if (filesToLoad.size() > 0)
|
||||||
loadDatabase(persistedState);
|
loadDatabase(persistedState);
|
||||||
|
if(partConfig instanceof String) {
|
||||||
|
loadState((String) partConfig);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -411,7 +533,7 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
|
||||||
*/
|
*/
|
||||||
@Focus
|
@Focus
|
||||||
public void setFocus() {
|
public void setFocus() {
|
||||||
myParent.setFocus();
|
waveformPane.getWaveformControl().setFocus();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -423,7 +545,7 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
|
||||||
public void saveState(MPart part) {
|
public void saveState(MPart part) {
|
||||||
// save changes
|
// save changes
|
||||||
Map<String, String> persistedState = part.getPersistedState();
|
Map<String, String> persistedState = part.getPersistedState();
|
||||||
persistedState.put(DATABASE_FILE + "S", Integer.toString(filesToLoad.size()));
|
persistedState.put(DATABASE_FILE + "S", Integer.toString(filesToLoad.size())); //$NON-NLS-1$
|
||||||
Integer index = 0;
|
Integer index = 0;
|
||||||
for (File file : filesToLoad) {
|
for (File file : filesToLoad) {
|
||||||
persistedState.put(DATABASE_FILE + index, file.getAbsolutePath());
|
persistedState.put(DATABASE_FILE + index, file.getAbsolutePath());
|
||||||
|
@ -434,7 +556,7 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
|
||||||
|
|
||||||
public void saveState(String fileName){
|
public void saveState(String fileName){
|
||||||
Map<String, String> persistedState = new HashMap<>();
|
Map<String, String> persistedState = new HashMap<>();
|
||||||
persistedState.put(DATABASE_FILE + "S", Integer.toString(filesToLoad.size()));
|
persistedState.put(DATABASE_FILE + "S", Integer.toString(filesToLoad.size())); //$NON-NLS-1$
|
||||||
Integer index = 0;
|
Integer index = 0;
|
||||||
for (File file : filesToLoad) {
|
for (File file : filesToLoad) {
|
||||||
persistedState.put(DATABASE_FILE + index, file.getAbsolutePath());
|
persistedState.put(DATABASE_FILE + index, file.getAbsolutePath());
|
||||||
|
@ -445,7 +567,7 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
|
||||||
props.putAll(persistedState);
|
props.putAll(persistedState);
|
||||||
try {
|
try {
|
||||||
FileOutputStream out = new FileOutputStream(fileName);
|
FileOutputStream out = new FileOutputStream(fileName);
|
||||||
props.store(out, "Written by SCViewer");
|
props.store(out, "Written by SCViewer"); //$NON-NLS-1$
|
||||||
out.close();
|
out.close();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
@ -458,12 +580,13 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
|
||||||
FileInputStream in = new FileInputStream(fileName);
|
FileInputStream in = new FileInputStream(fileName);
|
||||||
props.load(in);
|
props.load(in);
|
||||||
in.close();
|
in.close();
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||||
HashMap<String, String> propMap = new HashMap<String, String>((Map) props);
|
HashMap<String, String> propMap = new HashMap<String, String>((Map) props);
|
||||||
restoreWaveformViewerState(propMap);
|
restoreWaveformViewerState(propMap);
|
||||||
|
} catch(FileNotFoundException e) {
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -473,14 +596,16 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
|
||||||
*/
|
*/
|
||||||
protected void saveWaveformViewerState(Map<String, String> persistedState) {
|
protected void saveWaveformViewerState(Map<String, String> persistedState) {
|
||||||
Integer index;
|
Integer index;
|
||||||
persistedState.put(SHOWN_WAVEFORM + "S", Integer.toString(waveformPane.getStreamList().size()));
|
persistedState.put(SHOWN_WAVEFORM + "S", Integer.toString(waveformPane.getStreamList().size())); //$NON-NLS-1$
|
||||||
index = 0;
|
index = 0;
|
||||||
for (TrackEntry trackEntry : waveformPane.getStreamList()) {
|
for (TrackEntry trackEntry : waveformPane.getStreamList()) {
|
||||||
persistedState.put(SHOWN_WAVEFORM + index, trackEntry.waveform.getFullName());
|
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());
|
||||||
index++;
|
index++;
|
||||||
}
|
}
|
||||||
List<ICursor> cursors = waveformPane.getCursorList();
|
List<ICursor> cursors = waveformPane.getCursorList();
|
||||||
persistedState.put(SHOWN_CURSOR + "S", Integer.toString(cursors.size()));
|
persistedState.put(SHOWN_CURSOR + "S", Integer.toString(cursors.size())); //$NON-NLS-1$
|
||||||
index = 0;
|
index = 0;
|
||||||
for (ICursor cursor : cursors) {
|
for (ICursor cursor : cursors) {
|
||||||
persistedState.put(SHOWN_CURSOR + index, Long.toString(cursor.getTime()));
|
persistedState.put(SHOWN_CURSOR + index, Long.toString(cursor.getTime()));
|
||||||
|
@ -496,16 +621,24 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
|
||||||
* @param state the state
|
* @param state the state
|
||||||
*/
|
*/
|
||||||
protected void restoreWaveformViewerState(Map<String, String> state) {
|
protected void restoreWaveformViewerState(Map<String, String> state) {
|
||||||
Integer waves = state.containsKey(SHOWN_WAVEFORM+"S") ? Integer.parseInt(state.get(SHOWN_WAVEFORM + "S")):0;
|
Integer waves = state.containsKey(SHOWN_WAVEFORM+"S") ? Integer.parseInt(state.get(SHOWN_WAVEFORM + "S")):0; //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
List<TrackEntry> res = new LinkedList<>();
|
List<TrackEntry> res = new LinkedList<>();
|
||||||
for (int i = 0; i < waves; i++) {
|
for (int i = 0; i < waves; i++) {
|
||||||
IWaveform<? extends IWaveformEvent> waveform = database.getStreamByName(state.get(SHOWN_WAVEFORM + i));
|
IWaveform<? extends IWaveformEvent> waveform = database.getStreamByName(state.get(SHOWN_WAVEFORM + i));
|
||||||
if (waveform != null)
|
if (waveform != null) {
|
||||||
res.add(new TrackEntry(waveform));
|
TrackEntry t = new TrackEntry(waveform);
|
||||||
|
res.add(t);
|
||||||
|
String v = state.get(SHOWN_WAVEFORM + i + VALUE_DISPLAY);
|
||||||
|
if(v!=null)
|
||||||
|
t.valueDisplay=ValueDisplay.valueOf(v);
|
||||||
|
String s = state.get(SHOWN_WAVEFORM + i + WAVE_DISPLAY);
|
||||||
|
if(s!=null)
|
||||||
|
t.waveDisplay=WaveDisplay.valueOf(s);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (res.size() > 0)
|
if (res.size() > 0)
|
||||||
waveformPane.getStreamList().addAll(res);
|
waveformPane.getStreamList().addAll(res);
|
||||||
Integer cursorLength = state.containsKey(SHOWN_CURSOR+"S")?Integer.parseInt(state.get(SHOWN_CURSOR + "S")):0;
|
Integer cursorLength = state.containsKey(SHOWN_CURSOR+"S")?Integer.parseInt(state.get(SHOWN_CURSOR + "S")):0; //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
List<ICursor> cursors = waveformPane.getCursorList();
|
List<ICursor> cursors = waveformPane.getCursorList();
|
||||||
if (cursorLength == cursors.size()) {
|
if (cursorLength == cursors.size()) {
|
||||||
for (int i = 0; i < cursorLength; i++) {
|
for (int i = 0; i < cursorLength; i++) {
|
||||||
|
@ -567,8 +700,8 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
|
||||||
* @return true, if successful
|
* @return true, if successful
|
||||||
*/
|
*/
|
||||||
protected boolean askIfToLoad(File txFile) {
|
protected boolean askIfToLoad(File txFile) {
|
||||||
if (txFile.exists() && MessageDialog.openQuestion(myParent.getDisplay().getActiveShell(), "Database open",
|
if (txFile.exists() && MessageDialog.openQuestion(myParent.getDisplay().getActiveShell(), Messages.WaveformViewer_37,
|
||||||
"Would you like to open the adjacent database " + txFile.getName() + " as well?")) {
|
Messages.WaveformViewer_38 + txFile.getName() + Messages.WaveformViewer_39)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
@ -584,10 +717,10 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
|
||||||
protected static String renameFileExtension(String source, String newExt) {
|
protected static String renameFileExtension(String source, String newExt) {
|
||||||
String target;
|
String target;
|
||||||
String currentExt = getFileExtension(source);
|
String currentExt = getFileExtension(source);
|
||||||
if (currentExt.equals("")) {
|
if (currentExt.equals("")) { //$NON-NLS-1$
|
||||||
target = source + "." + newExt;
|
target = source + "." + newExt; //$NON-NLS-1$
|
||||||
} else {
|
} else {
|
||||||
target = source.replaceFirst(Pattern.quote("." + currentExt) + "$", Matcher.quoteReplacement("." + newExt));
|
target = source.replaceFirst(Pattern.quote("." + currentExt) + "$", Matcher.quoteReplacement("." + newExt)); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||||
}
|
}
|
||||||
return target;
|
return target;
|
||||||
}
|
}
|
||||||
|
@ -599,7 +732,7 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
|
||||||
* @return the file extension
|
* @return the file extension
|
||||||
*/
|
*/
|
||||||
protected static String getFileExtension(String f) {
|
protected static String getFileExtension(String f) {
|
||||||
String ext = "";
|
String ext = ""; //$NON-NLS-1$
|
||||||
int i = f.lastIndexOf('.');
|
int i = f.lastIndexOf('.');
|
||||||
if (i > 0 && i < f.length() - 1) {
|
if (i > 0 && i < f.length() - 1) {
|
||||||
ext = f.substring(i + 1);
|
ext = f.substring(i + 1);
|
||||||
|
@ -657,6 +790,7 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
|
||||||
index++;
|
index++;
|
||||||
waveformPane.getStreamList().addAll(index, streams);
|
waveformPane.getStreamList().addAll(index, streams);
|
||||||
}
|
}
|
||||||
|
setFocus();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -723,6 +857,7 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
|
||||||
* @param level the new zoom level
|
* @param level the new zoom level
|
||||||
*/
|
*/
|
||||||
public void setZoomLevel(Integer level) {
|
public void setZoomLevel(Integer level) {
|
||||||
|
//System.out.println("setZoomLevel() - ZoomLevel: " + level);
|
||||||
if (level < 0)
|
if (level < 0)
|
||||||
level = 0;
|
level = 0;
|
||||||
if (level > zoomLevel.length - 1)
|
if (level > zoomLevel.length - 1)
|
||||||
|
@ -735,7 +870,28 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
|
||||||
* Sets the zoom fit.
|
* Sets the zoom fit.
|
||||||
*/
|
*/
|
||||||
public void setZoomFit() {
|
public void setZoomFit() {
|
||||||
waveformPane.setZoomLevel(6);
|
|
||||||
|
//actual max time of signal
|
||||||
|
long maxTime = waveformPane.getMaxTime();
|
||||||
|
|
||||||
|
//get area actually capable of displaying data, i.e. area of the receiver which is capable of displaying data
|
||||||
|
Rectangle clientArea = myParent.getClientArea();
|
||||||
|
long clientAreaWidth = clientArea.width;
|
||||||
|
|
||||||
|
boolean foundZoom=false;
|
||||||
|
//try to find existing zoomlevel where scaleFactor*clientAreaWidth >= maxTime, if one is found set it as new zoomlevel
|
||||||
|
for (int level=0; level<Constants.unitMultiplier.length*Constants.unitString.length; level++){
|
||||||
|
long scaleFactor = (long) Math.pow(10, level/2);
|
||||||
|
if(level%2==1) scaleFactor*=3;
|
||||||
|
if(scaleFactor*clientAreaWidth >= maxTime) {
|
||||||
|
setZoomLevel(level);
|
||||||
|
foundZoom=true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//if no zoom level is found, set biggest one available
|
||||||
|
if(!foundZoom) setZoomLevel(Constants.unitMultiplier.length*Constants.unitString.length-1);
|
||||||
|
|
||||||
updateAll();
|
updateAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -878,4 +1034,8 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
|
||||||
navigationRelationType=relationType;
|
navigationRelationType=relationType;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void update() {
|
||||||
|
waveformPane.update();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -41,12 +41,15 @@ public class DefaultValuesInitializer extends AbstractPreferenceInitializer {
|
||||||
colors[WaveformColors.TX_BG.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_GREEN);
|
colors[WaveformColors.TX_BG.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_GREEN);
|
||||||
colors[WaveformColors.TX_BG_HIGHLITE.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_DARK_GREEN);
|
colors[WaveformColors.TX_BG_HIGHLITE.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_DARK_GREEN);
|
||||||
colors[WaveformColors.TX_BORDER.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_RED);
|
colors[WaveformColors.TX_BORDER.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_RED);
|
||||||
colors[WaveformColors.SIGNAL0.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_DARK_GREEN);
|
colors[WaveformColors.SIGNAL0.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_GREEN);
|
||||||
colors[WaveformColors.SIGNAL1.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_DARK_GREEN);
|
colors[WaveformColors.SIGNAL1.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_GREEN);
|
||||||
colors[WaveformColors.SIGNALZ.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_YELLOW);
|
colors[WaveformColors.SIGNALZ.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_YELLOW);
|
||||||
colors[WaveformColors.SIGNALX.ordinal()] = SWTResourceManager.getColor(255, 51, 51);
|
colors[WaveformColors.SIGNALX.ordinal()] = SWTResourceManager.getColor(255, 51, 51);
|
||||||
colors[WaveformColors.SIGNALU.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_DARK_YELLOW);
|
colors[WaveformColors.SIGNALU.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_DARK_YELLOW);
|
||||||
|
colors[WaveformColors.SIGNAL_REAL.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_YELLOW);
|
||||||
|
colors[WaveformColors.SIGNAL_NAN.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_RED);
|
||||||
colors[WaveformColors.SIGNAL_TEXT.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_WHITE);
|
colors[WaveformColors.SIGNAL_TEXT.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_WHITE);
|
||||||
|
colors[WaveformColors.SIGNAL_REAL.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_YELLOW);
|
||||||
colors[WaveformColors.CURSOR.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_RED);
|
colors[WaveformColors.CURSOR.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_RED);
|
||||||
colors[WaveformColors.CURSOR_DRAG.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_GRAY);
|
colors[WaveformColors.CURSOR_DRAG.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_GRAY);
|
||||||
colors[WaveformColors.CURSOR_TEXT.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_WHITE);
|
colors[WaveformColors.CURSOR_TEXT.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_WHITE);
|
||||||
|
@ -65,7 +68,7 @@ public class DefaultValuesInitializer extends AbstractPreferenceInitializer {
|
||||||
|
|
||||||
store.setDefault(PreferenceConstants.DATABASE_RELOAD, true);
|
store.setDefault(PreferenceConstants.DATABASE_RELOAD, true);
|
||||||
for (WaveformColors c : WaveformColors.values()) {
|
for (WaveformColors c : WaveformColors.values()) {
|
||||||
store.setDefault(c.name()+"_COLOR", StringConverter.asString(colors[c.ordinal()].getRGB()));
|
store.setDefault(c.name()+"_COLOR", StringConverter.asString(colors[c.ordinal()].getRGB())); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -16,64 +16,64 @@ package com.minres.scviewer.e4.application.preferences;
|
||||||
public class PreferenceConstants {
|
public class PreferenceConstants {
|
||||||
|
|
||||||
/** The Constant PREFERENCES_SCOPE. */
|
/** The Constant PREFERENCES_SCOPE. */
|
||||||
public static final String PREFERENCES_SCOPE="com.minres.scviewer.e4.application";
|
public static final String PREFERENCES_SCOPE="com.minres.scviewer.e4.application"; //$NON-NLS-1$
|
||||||
|
|
||||||
/** The Constant DATABASE_RELOAD. */
|
/** The Constant DATABASE_RELOAD. */
|
||||||
public static final String DATABASE_RELOAD="databaseReload";
|
public static final String DATABASE_RELOAD="databaseReload"; //$NON-NLS-1$
|
||||||
|
|
||||||
/** The Constant LINE_COLOR. */
|
/** The Constant LINE_COLOR. */
|
||||||
public static final String LINE_COLOR="LINE_COLOR";
|
public static final String LINE_COLOR="LINE_COLOR"; //$NON-NLS-1$
|
||||||
|
|
||||||
/** The Constant LINE_HIGHLITE_COLOR. */
|
/** The Constant LINE_HIGHLITE_COLOR. */
|
||||||
public static final String LINE_HIGHLITE_COLOR="LINE_HIGHLITE_COLOR";
|
public static final String LINE_HIGHLITE_COLOR="LINE_HIGHLITE_COLOR"; //$NON-NLS-1$
|
||||||
|
|
||||||
/** The Constant TRACK_BG_EVEN_COLOR. */
|
/** The Constant TRACK_BG_EVEN_COLOR. */
|
||||||
public static final String TRACK_BG_EVEN_COLOR="TRACK_BG_EVEN_COLOR";
|
public static final String TRACK_BG_EVEN_COLOR="TRACK_BG_EVEN_COLOR"; //$NON-NLS-1$
|
||||||
|
|
||||||
/** The Constant TRACK_BG_ODD_COLOR. */
|
/** The Constant TRACK_BG_ODD_COLOR. */
|
||||||
public static final String TRACK_BG_ODD_COLOR="TRACK_BG_ODD_COLOR";
|
public static final String TRACK_BG_ODD_COLOR="TRACK_BG_ODD_COLOR"; //$NON-NLS-1$
|
||||||
|
|
||||||
/** The Constant TRACK_BG_HIGHLITE_COLOR. */
|
/** The Constant TRACK_BG_HIGHLITE_COLOR. */
|
||||||
public static final String TRACK_BG_HIGHLITE_COLOR="TRACK_BG_HIGHLITE_COLOR";
|
public static final String TRACK_BG_HIGHLITE_COLOR="TRACK_BG_HIGHLITE_COLOR"; //$NON-NLS-1$
|
||||||
|
|
||||||
/** The Constant TX_BG_COLOR. */
|
/** The Constant TX_BG_COLOR. */
|
||||||
public static final String TX_BG_COLOR="TX_BG_COLOR";
|
public static final String TX_BG_COLOR="TX_BG_COLOR"; //$NON-NLS-1$
|
||||||
|
|
||||||
/** The Constant TX_BG_HIGHLITE_COLOR. */
|
/** The Constant TX_BG_HIGHLITE_COLOR. */
|
||||||
public static final String TX_BG_HIGHLITE_COLOR="TX_BG_HIGHLITE_COLOR";
|
public static final String TX_BG_HIGHLITE_COLOR="TX_BG_HIGHLITE_COLOR"; //$NON-NLS-1$
|
||||||
|
|
||||||
/** The Constant TX_BORDER_COLOR. */
|
/** The Constant TX_BORDER_COLOR. */
|
||||||
public static final String TX_BORDER_COLOR="TX_BORDER_COLOR";
|
public static final String TX_BORDER_COLOR="TX_BORDER_COLOR"; //$NON-NLS-1$
|
||||||
|
|
||||||
/** The Constant SIGNAL0_COLOR. */
|
/** The Constant SIGNAL0_COLOR. */
|
||||||
public static final String SIGNAL0_COLOR="SIGNAL0_COLOR";
|
public static final String SIGNAL0_COLOR="SIGNAL0_COLOR"; //$NON-NLS-1$
|
||||||
|
|
||||||
/** The Constant SIGNAL1_COLOR. */
|
/** The Constant SIGNAL1_COLOR. */
|
||||||
public static final String SIGNAL1_COLOR="SIGNAL1_COLOR";
|
public static final String SIGNAL1_COLOR="SIGNAL1_COLOR"; //$NON-NLS-1$
|
||||||
|
|
||||||
/** The Constant SIGNALZ_COLOR. */
|
/** The Constant SIGNALZ_COLOR. */
|
||||||
public static final String SIGNALZ_COLOR="SIGNALZ_COLOR";
|
public static final String SIGNALZ_COLOR="SIGNALZ_COLOR"; //$NON-NLS-1$
|
||||||
|
|
||||||
/** The Constant SIGNALX_COLOR. */
|
/** The Constant SIGNALX_COLOR. */
|
||||||
public static final String SIGNALX_COLOR="SIGNALX_COLOR";
|
public static final String SIGNALX_COLOR="SIGNALX_COLOR"; //$NON-NLS-1$
|
||||||
|
|
||||||
/** The Constant SIGNAL_TEXT_COLOR. */
|
/** The Constant SIGNAL_TEXT_COLOR. */
|
||||||
public static final String SIGNAL_TEXT_COLOR="SIGNAL_TEXT_COLOR";
|
public static final String SIGNAL_TEXT_COLOR="SIGNAL_TEXT_COLOR"; //$NON-NLS-1$
|
||||||
|
|
||||||
/** The Constant CURSOR_COLOR. */
|
/** The Constant CURSOR_COLOR. */
|
||||||
public static final String CURSOR_COLOR="CURSOR_COLOR";
|
public static final String CURSOR_COLOR="CURSOR_COLOR"; //$NON-NLS-1$
|
||||||
|
|
||||||
/** The Constant CURSOR_DRAG_COLOR. */
|
/** The Constant CURSOR_DRAG_COLOR. */
|
||||||
public static final String CURSOR_DRAG_COLOR="CURSOR_DRAG_COLOR";
|
public static final String CURSOR_DRAG_COLOR="CURSOR_DRAG_COLOR"; //$NON-NLS-1$
|
||||||
|
|
||||||
/** The Constant CURSOR_TEXT_COLOR. */
|
/** The Constant CURSOR_TEXT_COLOR. */
|
||||||
public static final String CURSOR_TEXT_COLOR="CURSOR_TEXT_COLOR";
|
public static final String CURSOR_TEXT_COLOR="CURSOR_TEXT_COLOR"; //$NON-NLS-1$
|
||||||
|
|
||||||
/** The Constant MARKER_COLOR. */
|
/** The Constant MARKER_COLOR. */
|
||||||
public static final String MARKER_COLOR="MARKER_COLOR";
|
public static final String MARKER_COLOR="MARKER_COLOR"; //$NON-NLS-1$
|
||||||
|
|
||||||
/** The Constant MARKER_TEXT_COLOR. */
|
/** The Constant MARKER_TEXT_COLOR. */
|
||||||
public static final String MARKER_TEXT_COLOR="MARKER_TEXT_COLOR";
|
public static final String MARKER_TEXT_COLOR="MARKER_TEXT_COLOR"; //$NON-NLS-1$
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,6 +13,8 @@ package com.minres.scviewer.e4.application.preferences;
|
||||||
import org.eclipse.jface.preference.BooleanFieldEditor;
|
import org.eclipse.jface.preference.BooleanFieldEditor;
|
||||||
import org.eclipse.jface.preference.FieldEditorPreferencePage;
|
import org.eclipse.jface.preference.FieldEditorPreferencePage;
|
||||||
|
|
||||||
|
import com.minres.scviewer.e4.application.Messages;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Class SCViewerPreferencesPage showing the SCViewer top preferences.
|
* The Class SCViewerPreferencesPage showing the SCViewer top preferences.
|
||||||
|
@ -32,7 +34,7 @@ public class SCViewerPreferencesPage extends FieldEditorPreferencePage {
|
||||||
@Override
|
@Override
|
||||||
protected void createFieldEditors() {
|
protected void createFieldEditors() {
|
||||||
|
|
||||||
addField(new BooleanFieldEditor(PreferenceConstants.DATABASE_RELOAD, "Check for changed database",
|
addField(new BooleanFieldEditor(PreferenceConstants.DATABASE_RELOAD, Messages.SCViewerPreferencesPage_0,
|
||||||
getFieldEditorParent()));
|
getFieldEditorParent()));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,6 +14,7 @@ import org.eclipse.jface.preference.ColorFieldEditor;
|
||||||
import org.eclipse.jface.preference.FieldEditorPreferencePage;
|
import org.eclipse.jface.preference.FieldEditorPreferencePage;
|
||||||
|
|
||||||
import com.minres.scviewer.database.ui.WaveformColors;
|
import com.minres.scviewer.database.ui.WaveformColors;
|
||||||
|
import com.minres.scviewer.e4.application.Messages;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The WaveformView preference page to show the colors to use.
|
* The WaveformView preference page to show the colors to use.
|
||||||
|
@ -34,7 +35,7 @@ public class WaveformPreferencesPage extends FieldEditorPreferencePage {
|
||||||
protected void createFieldEditors() {
|
protected void createFieldEditors() {
|
||||||
|
|
||||||
for (WaveformColors c : WaveformColors.values()) {
|
for (WaveformColors c : WaveformColors.values()) {
|
||||||
addField(new ColorFieldEditor(c.name() + "_COLOR", "Color for " + c.name().toLowerCase(),
|
addField(new ColorFieldEditor(c.name() + "_COLOR", Messages.WaveformPreferencesPage_1 + c.name().toLowerCase(), //$NON-NLS-1$
|
||||||
getFieldEditorParent()));
|
getFieldEditorParent()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,7 +20,7 @@ import org.eclipse.wb.swt.ResourceManager;
|
||||||
|
|
||||||
import com.minres.scviewer.database.IHierNode;
|
import com.minres.scviewer.database.IHierNode;
|
||||||
import com.minres.scviewer.database.ISignal;
|
import com.minres.scviewer.database.ISignal;
|
||||||
import com.minres.scviewer.database.ISignalChangeMulti;
|
import com.minres.scviewer.database.ISignalChangeBitVector;
|
||||||
import com.minres.scviewer.database.ITxStream;
|
import com.minres.scviewer.database.ITxStream;
|
||||||
import com.minres.scviewer.database.IWaveformDb;
|
import com.minres.scviewer.database.IWaveformDb;
|
||||||
import com.minres.scviewer.e4.application.parts.LoadingWaveformDb;
|
import com.minres.scviewer.e4.application.parts.LoadingWaveformDb;
|
||||||
|
@ -42,12 +42,12 @@ public class TxDbLabelProvider implements ILabelProvider {
|
||||||
*/
|
*/
|
||||||
public TxDbLabelProvider() {
|
public TxDbLabelProvider() {
|
||||||
super();
|
super();
|
||||||
loadinDatabase=ResourceManager.getPluginImage("com.minres.scviewer.e4.application", "icons/database_go.png");
|
loadinDatabase=ResourceManager.getPluginImage("com.minres.scviewer.e4.application", "icons/database_go.png"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
database=ResourceManager.getPluginImage("com.minres.scviewer.e4.application", "icons/database.png");
|
database=ResourceManager.getPluginImage("com.minres.scviewer.e4.application", "icons/database.png"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
stream=ResourceManager.getPluginImage("com.minres.scviewer.e4.application", "icons/stream.png");
|
stream=ResourceManager.getPluginImage("com.minres.scviewer.e4.application", "icons/stream.png"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
folder=ResourceManager.getPluginImage("com.minres.scviewer.e4.application", "icons/folder.png");
|
folder=ResourceManager.getPluginImage("com.minres.scviewer.e4.application", "icons/folder.png"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
signal=ResourceManager.getPluginImage("com.minres.scviewer.e4.application", "icons/signal.png");
|
signal=ResourceManager.getPluginImage("com.minres.scviewer.e4.application", "icons/signal.png"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
wave=ResourceManager.getPluginImage("com.minres.scviewer.e4.application", "icons/wave.png");
|
wave=ResourceManager.getPluginImage("com.minres.scviewer.e4.application", "icons/wave.png"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
|
@ -101,7 +101,7 @@ public class TxDbLabelProvider implements ILabelProvider {
|
||||||
return stream;
|
return stream;
|
||||||
}else if(element instanceof ISignal<?>){
|
}else if(element instanceof ISignal<?>){
|
||||||
Object o = ((ISignal<?>)element).getEvents().firstEntry().getValue();
|
Object o = ((ISignal<?>)element).getEvents().firstEntry().getValue();
|
||||||
if(o instanceof ISignalChangeMulti)
|
if(o instanceof ISignalChangeBitVector)
|
||||||
return wave;
|
return wave;
|
||||||
else
|
else
|
||||||
return signal;
|
return signal;
|
||||||
|
|
|
@ -80,7 +80,7 @@ public class TxPropertiesLabelProvider implements ITableLabelProvider {
|
||||||
@Override
|
@Override
|
||||||
public String getColumnText(Object element, int columnIndex) {
|
public String getColumnText(Object element, int columnIndex) {
|
||||||
ITxAttribute attribute = (ITxAttribute) element;
|
ITxAttribute attribute = (ITxAttribute) element;
|
||||||
String text = "";
|
String text = ""; //$NON-NLS-1$
|
||||||
switch (columnIndex) {
|
switch (columnIndex) {
|
||||||
case TransactionDetails.COLUMN_FIRST:
|
case TransactionDetails.COLUMN_FIRST:
|
||||||
text = attribute.getName();
|
text = attribute.getName();
|
||||||
|
|
|
@ -28,6 +28,8 @@ import org.eclipse.swt.graphics.Point;
|
||||||
import org.eclipse.swt.graphics.Rectangle;
|
import org.eclipse.swt.graphics.Rectangle;
|
||||||
import org.osgi.framework.Bundle;
|
import org.osgi.framework.Bundle;
|
||||||
|
|
||||||
|
import com.minres.scviewer.e4.application.Messages;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Utility class for managing OS resources associated with SWT/JFace controls such as colors, fonts, images,
|
* Utility class for managing OS resources associated with SWT/JFace controls such as colors, fonts, images,
|
||||||
* etc.
|
* etc.
|
||||||
|
@ -124,7 +126,7 @@ public class ResourceManager extends SWTResourceManager {
|
||||||
*/
|
*/
|
||||||
public static Image decorateImage(final Image baseImage, final Image decorator, final int corner) {
|
public static Image decorateImage(final Image baseImage, final Image decorator, final int corner) {
|
||||||
if (corner <= 0 || corner >= LAST_CORNER_KEY) {
|
if (corner <= 0 || corner >= LAST_CORNER_KEY) {
|
||||||
throw new IllegalArgumentException("Wrong decorate corner");
|
throw new IllegalArgumentException(Messages.ResourceManager_0);
|
||||||
}
|
}
|
||||||
Map<Image, Map<Image, Image>> cornerDecoratedImageMap = m_decoratedImageMap[corner];
|
Map<Image, Map<Image, Image>> cornerDecoratedImageMap = m_decoratedImageMap[corner];
|
||||||
if (cornerDecoratedImageMap == null) {
|
if (cornerDecoratedImageMap == null) {
|
||||||
|
@ -145,15 +147,15 @@ public class ResourceManager extends SWTResourceManager {
|
||||||
CompositeImageDescriptor compositImageDesc = new CompositeImageDescriptor() {
|
CompositeImageDescriptor compositImageDesc = new CompositeImageDescriptor() {
|
||||||
@Override
|
@Override
|
||||||
protected void drawCompositeImage(int width, int height) {
|
protected void drawCompositeImage(int width, int height) {
|
||||||
drawImage(baseImage.getImageData(), 0, 0);
|
drawImage(createCachedImageDataProvider(baseImage), 0, 0);
|
||||||
if (corner == TOP_LEFT) {
|
if (corner == TOP_LEFT) {
|
||||||
drawImage(decorator.getImageData(), 0, 0);
|
drawImage(createCachedImageDataProvider(decorator), 0, 0);
|
||||||
} else if (corner == TOP_RIGHT) {
|
} else if (corner == TOP_RIGHT) {
|
||||||
drawImage(decorator.getImageData(), bib.width - dib.width, 0);
|
drawImage(createCachedImageDataProvider(decorator), bib.width - dib.width, 0);
|
||||||
} else if (corner == BOTTOM_LEFT) {
|
} else if (corner == BOTTOM_LEFT) {
|
||||||
drawImage(decorator.getImageData(), 0, bib.height - dib.height);
|
drawImage(createCachedImageDataProvider(decorator), 0, bib.height - dib.height);
|
||||||
} else if (corner == BOTTOM_RIGHT) {
|
} else if (corner == BOTTOM_RIGHT) {
|
||||||
drawImage(decorator.getImageData(), bib.width - dib.width, bib.height - dib.height);
|
drawImage(createCachedImageDataProvider(decorator), bib.width - dib.width, bib.height - dib.height);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -28,6 +28,8 @@ import org.eclipse.swt.graphics.RGB;
|
||||||
import org.eclipse.swt.graphics.Rectangle;
|
import org.eclipse.swt.graphics.Rectangle;
|
||||||
import org.eclipse.swt.widgets.Display;
|
import org.eclipse.swt.widgets.Display;
|
||||||
|
|
||||||
|
import com.minres.scviewer.e4.application.Messages;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Utility class for managing OS resources associated with SWT controls such as colors, fonts, images, etc.
|
* Utility class for managing OS resources associated with SWT controls such as colors, fonts, images, etc.
|
||||||
* <p>
|
* <p>
|
||||||
|
@ -232,7 +234,7 @@ public class SWTResourceManager {
|
||||||
*/
|
*/
|
||||||
public static Image decorateImage(final Image baseImage, final Image decorator, final int corner) {
|
public static Image decorateImage(final Image baseImage, final Image decorator, final int corner) {
|
||||||
if (corner <= 0 || corner >= LAST_CORNER_KEY) {
|
if (corner <= 0 || corner >= LAST_CORNER_KEY) {
|
||||||
throw new IllegalArgumentException("Wrong decorate corner");
|
throw new IllegalArgumentException(Messages.SWTResourceManager_0);
|
||||||
}
|
}
|
||||||
Map<Image, Map<Image, Image>> cornerDecoratedImageMap = m_decoratedImageMap[corner];
|
Map<Image, Map<Image, Image>> cornerDecoratedImageMap = m_decoratedImageMap[corner];
|
||||||
if (cornerDecoratedImageMap == null) {
|
if (cornerDecoratedImageMap == null) {
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue