Compare commits
64 Commits
Author | SHA1 | Date | |
---|---|---|---|
184f1b2d2c | |||
90249dadb9 | |||
d47db29b93 | |||
e8148af10f | |||
b298a4ca6c | |||
f474e38687 | |||
2e806f7b86 | |||
b7a8d99e2d | |||
2a09fc7e6f | |||
e36abb8d55 | |||
5746b9f758 | |||
6be1f018b1 | |||
38a046aaef | |||
fdbd6f8402 | |||
1dad204494 | |||
54661c51ce | |||
b34fe0d0ba | |||
868eceddc5 | |||
b642c396c7 | |||
f3d8e34ed0 | |||
401c760e01 | |||
5add0e385d | |||
2ba6822f2b | |||
54124d13bf | |||
5b949a9d37 | |||
9a9b25622c | |||
dd6a8669b1 | |||
b483897769 | |||
bd24c4dd05 | |||
664e99d09e | |||
675b2ed972 | |||
e6f19311b1 | |||
4a8034191c | |||
9d4e5bf636 | |||
cc9be70708 | |||
2dcc72f679 | |||
563b6e2b01 | |||
6161c0e0ec | |||
61c2102ab7 | |||
796a04b981 | |||
2a71ab94f5 | |||
923b89c038 | |||
3de6c9900c | |||
ef1f2a758a | |||
3e6d5bd33e | |||
26968b8521 | |||
611cfc7b46 | |||
8cb77a555b | |||
b4a7f032f5 | |||
62e0ec2008 | |||
f6cc12e8c3 | |||
b38b268fcb | |||
55a14edc9d | |||
45c23564b5 | |||
b170fb3c2a | |||
ab975eadd1 | |||
7ad70411f3 | |||
24720340be | |||
ad51066f1c | |||
95e2db60b6 | |||
db1d377da6 | |||
230e8dcc7a | |||
ab2146102f | |||
b1148922d8 |
1
.gitignore
vendored
1
.gitignore
vendored
@ -8,3 +8,4 @@ SCViewer.xcf
|
||||
SCViewer_1.png
|
||||
*.launch
|
||||
copyrightLog.txt
|
||||
/workspace
|
||||
|
20
.project
20
.project
@ -1,16 +1,22 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>scviewer.parent</name>
|
||||
<name>com.minres.scviewer.parent</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.m2e.core.maven2Builder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.m2e.core.maven2Nature</nature>
|
||||
</natures>
|
||||
<filteredResources>
|
||||
<filter>
|
||||
<id>1591076960924</id>
|
||||
<id>0</id>
|
||||
<name></name>
|
||||
<type>10</type>
|
||||
<matcher>
|
||||
@ -19,7 +25,7 @@
|
||||
</matcher>
|
||||
</filter>
|
||||
<filter>
|
||||
<id>1591076960932</id>
|
||||
<id>0</id>
|
||||
<name></name>
|
||||
<type>10</type>
|
||||
<matcher>
|
||||
@ -28,7 +34,7 @@
|
||||
</matcher>
|
||||
</filter>
|
||||
<filter>
|
||||
<id>1591076960936</id>
|
||||
<id>0</id>
|
||||
<name></name>
|
||||
<type>10</type>
|
||||
<matcher>
|
||||
@ -37,7 +43,7 @@
|
||||
</matcher>
|
||||
</filter>
|
||||
<filter>
|
||||
<id>1591076960939</id>
|
||||
<id>0</id>
|
||||
<name></name>
|
||||
<type>10</type>
|
||||
<matcher>
|
||||
@ -46,7 +52,7 @@
|
||||
</matcher>
|
||||
</filter>
|
||||
<filter>
|
||||
<id>1591076960950</id>
|
||||
<id>0</id>
|
||||
<name></name>
|
||||
<type>10</type>
|
||||
<matcher>
|
||||
@ -55,7 +61,7 @@
|
||||
</matcher>
|
||||
</filter>
|
||||
<filter>
|
||||
<id>1591076960954</id>
|
||||
<id>0</id>
|
||||
<name></name>
|
||||
<type>10</type>
|
||||
<matcher>
|
||||
|
4
.settings/org.eclipse.m2e.core.prefs
Normal file
4
.settings/org.eclipse.m2e.core.prefs
Normal file
@ -0,0 +1,4 @@
|
||||
activeProfiles=
|
||||
eclipse.preferences.version=1
|
||||
resolveWorkspaceProjects=true
|
||||
version=1
|
@ -1,104 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<launchConfiguration type="org.eclipse.pde.ui.JunitLaunchConfig">
|
||||
<booleanAttribute key="append.args" value="true"/>
|
||||
<stringAttribute key="application" value="org.eclipse.pde.junit.runtime.coretestapplication"/>
|
||||
<booleanAttribute key="askclear" value="false"/>
|
||||
<booleanAttribute key="automaticAdd" value="true"/>
|
||||
<booleanAttribute key="automaticValidate" value="false"/>
|
||||
<stringAttribute key="bootstrap" value=""/>
|
||||
<stringAttribute key="checked" value="[NONE]"/>
|
||||
<booleanAttribute key="clearConfig" value="true"/>
|
||||
<booleanAttribute key="clearws" value="true"/>
|
||||
<booleanAttribute key="clearwslog" value="false"/>
|
||||
<stringAttribute key="configLocation" value="${workspace_loc}/.metadata/.plugins/org.eclipse.pde.core/pde-junit"/>
|
||||
<booleanAttribute key="default" value="true"/>
|
||||
<setAttribute key="deselected_workspace_bundles">
|
||||
<setEntry value="com.minres.scviewer.e4.application"/>
|
||||
<setEntry value="com.minres.scviewer.ui"/>
|
||||
</setAttribute>
|
||||
<booleanAttribute key="includeOptional" value="true"/>
|
||||
<stringAttribute key="location" value="${workspace_loc}/../junit-workspace"/>
|
||||
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
|
||||
<listEntry value="/com.minres.scviewer.database.test"/>
|
||||
</listAttribute>
|
||||
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
|
||||
<listEntry value="4"/>
|
||||
</listAttribute>
|
||||
<stringAttribute key="org.eclipse.jdt.junit.CONTAINER" value="=com.minres.scviewer.database.test"/>
|
||||
<booleanAttribute key="org.eclipse.jdt.junit.KEEPRUNNING_ATTR" value="false"/>
|
||||
<stringAttribute key="org.eclipse.jdt.junit.TESTNAME" value=""/>
|
||||
<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"/>
|
||||
<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=""/>
|
||||
<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.SOURCE_PATH_PROVIDER" value="org.eclipse.pde.ui.workbenchClasspathProvider"/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Xms40m -Xmx512m"/>
|
||||
<stringAttribute key="pde.version" value="3.3"/>
|
||||
<stringAttribute key="product" value="com.minres.scviewer.e4.product"/>
|
||||
<booleanAttribute key="run_in_ui_thread" value="true"/>
|
||||
<setAttribute key="selected_target_bundles">
|
||||
<setEntry value="com.google.guava@default:default"/>
|
||||
<setEntry value="javax.annotation@default:default"/>
|
||||
<setEntry value="javax.inject@default:default"/>
|
||||
<setEntry value="javax.servlet@default:default"/>
|
||||
<setEntry value="org.apache.ant@default:default"/>
|
||||
<setEntry value="org.apache.commons.jxpath@default:default"/>
|
||||
<setEntry value="org.apache.felix.gogo.command@default:default"/>
|
||||
<setEntry value="org.apache.felix.gogo.runtime@default:default"/>
|
||||
<setEntry value="org.codehaus.groovy@default:default"/>
|
||||
<setEntry value="org.eclipse.ant.core@default:default"/>
|
||||
<setEntry value="org.eclipse.core.commands@default:default"/>
|
||||
<setEntry value="org.eclipse.core.contenttype@default:default"/>
|
||||
<setEntry value="org.eclipse.core.expressions@default:default"/>
|
||||
<setEntry value="org.eclipse.core.filesystem.macosx@default:false"/>
|
||||
<setEntry value="org.eclipse.core.filesystem@default:default"/>
|
||||
<setEntry value="org.eclipse.core.jobs@default:default"/>
|
||||
<setEntry value="org.eclipse.core.resources@default:default"/>
|
||||
<setEntry value="org.eclipse.core.runtime@default:true"/>
|
||||
<setEntry value="org.eclipse.core.variables@default:default"/>
|
||||
<setEntry value="org.eclipse.e4.core.contexts@default:default"/>
|
||||
<setEntry value="org.eclipse.e4.core.di.annotations@default:default"/>
|
||||
<setEntry value="org.eclipse.e4.core.di.extensions@default:default"/>
|
||||
<setEntry value="org.eclipse.e4.core.di@default:default"/>
|
||||
<setEntry value="org.eclipse.e4.core.services@default:default"/>
|
||||
<setEntry value="org.eclipse.e4.emf.xpath@default:default"/>
|
||||
<setEntry value="org.eclipse.e4.ui.di@default:default"/>
|
||||
<setEntry value="org.eclipse.e4.ui.model.workbench@default:default"/>
|
||||
<setEntry value="org.eclipse.e4.ui.services@default:default"/>
|
||||
<setEntry value="org.eclipse.emf.common@default:default"/>
|
||||
<setEntry value="org.eclipse.emf.ecore@default:default"/>
|
||||
<setEntry value="org.eclipse.equinox.app@default:default"/>
|
||||
<setEntry value="org.eclipse.equinox.bidi@default:default"/>
|
||||
<setEntry value="org.eclipse.equinox.common@2:true"/>
|
||||
<setEntry value="org.eclipse.equinox.ds@1:true"/>
|
||||
<setEntry value="org.eclipse.equinox.preferences@default:default"/>
|
||||
<setEntry value="org.eclipse.equinox.registry@default:default"/>
|
||||
<setEntry value="org.eclipse.equinox.util@default:default"/>
|
||||
<setEntry value="org.eclipse.jface@default:default"/>
|
||||
<setEntry value="org.eclipse.osgi.compatibility.state@default:false"/>
|
||||
<setEntry value="org.eclipse.osgi.services@default:default"/>
|
||||
<setEntry value="org.eclipse.osgi@-1:true"/>
|
||||
<setEntry value="org.eclipse.swt.cocoa.macosx.x86_64@default:false"/>
|
||||
<setEntry value="org.eclipse.swt@default:default"/>
|
||||
<setEntry value="org.hamcrest.core@default:default"/>
|
||||
<setEntry value="org.junit@default:default"/>
|
||||
</setAttribute>
|
||||
<setAttribute key="selected_workspace_bundles">
|
||||
<setEntry value="com.minres.scviewer.database.sqlite@default:true"/>
|
||||
<setEntry value="com.minres.scviewer.database.test@default:default"/>
|
||||
<setEntry value="com.minres.scviewer.database.text@default:true"/>
|
||||
<setEntry value="com.minres.scviewer.database.ui.swt@default:default"/>
|
||||
<setEntry value="com.minres.scviewer.database.ui@default:default"/>
|
||||
<setEntry value="com.minres.scviewer.database.vcd@default:default"/>
|
||||
<setEntry value="com.minres.scviewer.database@default:true"/>
|
||||
<setEntry value="com.opcoach.e4.preferences@default:default"/>
|
||||
</setAttribute>
|
||||
<booleanAttribute key="show_selected_only" value="false"/>
|
||||
<booleanAttribute key="tracing" value="false"/>
|
||||
<booleanAttribute key="useCustomFeatures" value="false"/>
|
||||
<booleanAttribute key="useDefaultConfig" value="true"/>
|
||||
<booleanAttribute key="useDefaultConfigArea" value="false"/>
|
||||
<booleanAttribute key="useProduct" value="false"/>
|
||||
</launchConfiguration>
|
@ -8,8 +8,9 @@
|
||||
<unit id="org.eclipse.equinox.p2.sdk.feature.jar" version="0.0.0"/> <!-- needed by Linux exectable-->
|
||||
<unit id="org.eclipse.equinox.sdk.feature.group" version="0.0.0"/>
|
||||
<unit id="org.eclipse.platform.sdk" version="0.0.0"/>
|
||||
<unit id="org.eclipse.sdk.feature.group" version="0.0.0"/> <!-- org.junit for testing -->
|
||||
<unit id="org.eclipse.sdk.feature.group" version="0.0.0"/> <!-- org.eclipse.equinox.p2.iu -->
|
||||
<unit id="org.eclipse.rcptt.core.feature.group" version="0.0.0"/><!-- com.google.guave-->
|
||||
<unit id="org.eclipse.pde.feature.group" version="0.0.0"/> <!-- org.junit for testing -->
|
||||
</location>
|
||||
<location includeAllPlatforms="false" includeConfigurePhase="true" includeMode="planner" includeSource="true" type="InstallableUnit">
|
||||
<repository location="https://www.opcoach.com/repository/2020-03/"/>
|
||||
@ -19,6 +20,13 @@
|
||||
<repository location="http://dist.springsource.org/snapshot/GRECLIPSE/e4.15/"/>
|
||||
<unit id="org.codehaus.groovy25.feature.feature.group" version="0.0.0"/>
|
||||
</location>
|
||||
<location includeAllPlatforms="false" includeConfigurePhase="true" includeMode="planner" includeSource="true" type="InstallableUnit">
|
||||
<repository location="http://download.eclipse.org/nattable/releases/1.6.0/repository/"/>
|
||||
<unit id="org.eclipse.nebula.widgets.nattable.core.feature.feature.group" version="1.6.0.201909181823"/>
|
||||
<unit id="org.eclipse.nebula.widgets.nattable.extension.e4.feature.feature.group" version="1.2.0.201909181823"/>
|
||||
<unit id="org.eclipse.nebula.widgets.nattable.extension.glazedlists.feature.feature.group" version="1.6.0.201909181823"/>
|
||||
<unit id="org.eclipse.nebula.widgets.nattable.extension.poi.feature.feature.group" version="1.5.1.201909181823"/>
|
||||
</location>
|
||||
</locations>
|
||||
<targetJRE path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
|
||||
<launcherArgs>
|
||||
|
@ -0,0 +1,4 @@
|
||||
activeProfiles=
|
||||
eclipse.preferences.version=1
|
||||
resolveWorkspaceProjects=true
|
||||
version=1
|
@ -29,26 +29,12 @@ http://www.eclipse.org/legal/epl-v10.html
|
||||
</url>
|
||||
|
||||
<requires>
|
||||
<import plugin="org.codehaus.groovy" version="2.5.8" match="greaterOrEqual"/>
|
||||
<import plugin="org.eclipse.osgi.services" version="3.4.0" match="greaterOrEqual"/>
|
||||
<import plugin="com.google.guava" version="15.0.0" match="greaterOrEqual"/>
|
||||
<import plugin="org.eclipse.osgi"/>
|
||||
<import plugin="com.minres.scviewer.database" version="1.0.0" match="greaterOrEqual"/>
|
||||
<import plugin="com.minres.scviewer.database.ui" version="1.0.0" match="greaterOrEqual"/>
|
||||
<import plugin="com.minres.scviewer.database.ui.swt" version="1.0.0" match="greaterOrEqual"/>
|
||||
<import plugin="org.eclipse.core.runtime"/>
|
||||
<import plugin="org.eclipse.core.resources"/>
|
||||
<import plugin="org.eclipse.jface.text"/>
|
||||
<import plugin="org.eclipse.ui"/>
|
||||
<import plugin="org.eclipse.ui.editors"/>
|
||||
<import plugin="org.eclipse.ui.ide"/>
|
||||
<import plugin="org.eclipse.ui.views.properties.tabbed"/>
|
||||
<import plugin="org.eclipse.swt"/>
|
||||
<import plugin="org.eclipse.core.expressions" version="3.4.600" match="greaterOrEqual"/>
|
||||
<import plugin="org.eclipse.jface"/>
|
||||
<import plugin="org.eclipse.swt" version="3.103.1" match="greaterOrEqual"/>
|
||||
<import plugin="org.eclipse.equinox.registry"/>
|
||||
<import plugin="org.codehaus.groovy" version="2.5.8" match="greaterOrEqual"/>
|
||||
<import plugin="org.hamcrest.core" version="1.3.0" match="greaterOrEqual"/>
|
||||
</requires>
|
||||
|
||||
<plugin
|
||||
@ -85,4 +71,11 @@ http://www.eclipse.org/legal/epl-v10.html
|
||||
version="0.0.0"
|
||||
unpack="false"/>
|
||||
|
||||
<plugin
|
||||
id="com.google.guava"
|
||||
download-size="0"
|
||||
install-size="0"
|
||||
version="0.0.0"
|
||||
unpack="false"/>
|
||||
|
||||
</feature>
|
||||
|
@ -41,7 +41,6 @@
|
||||
<import plugin="org.eclipse.e4.ui.di" version="1.1.0" match="greaterOrEqual"/>
|
||||
<import plugin="org.eclipse.e4.core.contexts" version="1.4.0" match="greaterOrEqual"/>
|
||||
<import plugin="com.minres.scviewer.database.ui.swt" version="1.0.0" match="greaterOrEqual"/>
|
||||
<import plugin="com.minres.scviewer.database.ui"/>
|
||||
<import plugin="com.minres.scviewer.database" version="1.0.0" match="greaterOrEqual"/>
|
||||
<import plugin="org.eclipse.osgi.services" version="3.5.0" match="greaterOrEqual"/>
|
||||
<import plugin="org.eclipse.e4.core.services" version="2.0.0" match="greaterOrEqual"/>
|
||||
@ -51,17 +50,15 @@
|
||||
<import plugin="org.eclipse.equinox.preferences"/>
|
||||
<import plugin="org.eclipse.core.expressions"/>
|
||||
<import plugin="org.eclipse.e4.core.commands" version="0.11.0" match="greaterOrEqual"/>
|
||||
<import plugin="org.eclipse.e4.ui.workbench.addons.swt"/>
|
||||
<import plugin="com.opcoach.e4.preferences"/>
|
||||
<import plugin="org.eclipse.e4.core.di.extensions"/>
|
||||
<import plugin="org.eclipse.e4.ui.css.swt.theme" version="0.10.0" match="greaterOrEqual"/>
|
||||
<import plugin="org.eclipse.core.resources" version="3.13.0" match="greaterOrEqual"/>
|
||||
<import plugin="com.opcoach.e4.preferences.mainmenu" version="1.2.0" match="greaterOrEqual"/>
|
||||
<import feature="com.opcoach.e4.preferences.feature" version="1.3.0.202004072127"/>
|
||||
<import feature="org.eclipse.equinox.executable" version="3.8.700.v20200207-2156"/>
|
||||
<import feature="org.eclipse.equinox.sdk" version="3.20.100.v20200303-1901"/>
|
||||
<import feature="org.eclipse.sdk" version="4.15.0.v20200305-0155"/>
|
||||
<import feature="org.eclipse.rcptt.core" version="2.5.1.M3"/>
|
||||
<import plugin="org.eclipse.core.commands"/>
|
||||
</requires>
|
||||
|
||||
<plugin
|
||||
@ -71,4 +68,11 @@
|
||||
version="0.0.0"
|
||||
unpack="false"/>
|
||||
|
||||
<plugin
|
||||
id="com.opcoach.e4.preferences"
|
||||
download-size="0"
|
||||
install-size="0"
|
||||
version="0.0.0"
|
||||
unpack="false"/>
|
||||
|
||||
</feature>
|
||||
|
17
features/com.minres.scviewer.e4.platform.feature/.project
Normal file
17
features/com.minres.scviewer.e4.platform.feature/.project
Normal file
@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>com.minres.scviewer.e4.platform.feature</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.pde.FeatureBuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.pde.FeatureNature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
@ -0,0 +1 @@
|
||||
bin.includes = feature.xml
|
72
features/com.minres.scviewer.e4.platform.feature/feature.xml
Normal file
72
features/com.minres.scviewer.e4.platform.feature/feature.xml
Normal file
@ -0,0 +1,72 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<feature
|
||||
id="com.minres.scviewer.e4.platform.feature"
|
||||
label="SCViewer Platform Feature"
|
||||
version="1.0.0.qualifier"
|
||||
provider-name="MINRES Technologies GmbH">
|
||||
|
||||
<description url="http://www.example.com/description">
|
||||
[Enter Feature Description here.]
|
||||
</description>
|
||||
|
||||
<copyright url="http://www.example.com/copyright">
|
||||
[Enter Copyright Description here.]
|
||||
</copyright>
|
||||
|
||||
<license url="http://www.example.com/license">
|
||||
[Enter License Description here.]
|
||||
</license>
|
||||
|
||||
<includes
|
||||
id="org.eclipse.e4.rcp"
|
||||
version="0.0.0"/>
|
||||
|
||||
<includes
|
||||
id="org.eclipse.emf.ecore"
|
||||
version="0.0.0"/>
|
||||
|
||||
<includes
|
||||
id="org.eclipse.emf.common"
|
||||
version="0.0.0"/>
|
||||
|
||||
<requires>
|
||||
<import plugin="org.eclipse.core.expressions" version="3.2.0" match="compatible"/>
|
||||
<import plugin="org.eclipse.core.filesystem" version="1.3.0" match="compatible"/>
|
||||
<import plugin="org.eclipse.core.runtime" version="3.12.0" match="compatible"/>
|
||||
</requires>
|
||||
|
||||
<plugin
|
||||
id="org.eclipse.core.resources"
|
||||
download-size="0"
|
||||
install-size="0"
|
||||
version="0.0.0"
|
||||
unpack="false"/>
|
||||
|
||||
<plugin
|
||||
id="org.eclipse.core.filesystem"
|
||||
download-size="0"
|
||||
install-size="0"
|
||||
version="0.0.0"
|
||||
unpack="false"/>
|
||||
|
||||
<plugin
|
||||
id="org.eclipse.core.filesystem.linux.x86_64"
|
||||
os="linux"
|
||||
arch="x86_64"
|
||||
download-size="0"
|
||||
install-size="0"
|
||||
version="0.0.0"
|
||||
fragment="true"
|
||||
unpack="false"/>
|
||||
|
||||
<plugin
|
||||
id="org.eclipse.core.filesystem.win32.x86_64"
|
||||
os="win32"
|
||||
arch="x86_64"
|
||||
download-size="0"
|
||||
install-size="0"
|
||||
version="0.0.0"
|
||||
fragment="true"
|
||||
unpack="false"/>
|
||||
|
||||
</feature>
|
@ -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">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>com.minres.scviewer.database.ui</artifactId>
|
||||
<version>2.0.0-SNAPSHOT</version>
|
||||
<packaging>eclipse-plugin</packaging>
|
||||
<artifactId>com.minres.scviewer.e4.platform.feature</artifactId>
|
||||
<packaging>eclipse-feature</packaging>
|
||||
<parent>
|
||||
<groupId>com.minres.scviewer</groupId>
|
||||
<artifactId>com.minres.scviewer.parent</artifactId>
|
||||
<version>2.0.0-SNAPSHOT</version>
|
||||
<relativePath>../..</relativePath>
|
||||
</parent>
|
||||
</project>
|
||||
<version>1.0.0-SNAPSHOT</version>
|
||||
</project>
|
@ -6,9 +6,9 @@
|
||||
provider-name="%providerName">
|
||||
|
||||
<description>
|
||||
A viewer for SystemC Verification Library transactions and VCD
|
||||
signals. It supports a SQLite based recording as well as the built-in
|
||||
text base recording.
|
||||
A viewer for SystemC Verification Library transactions and VCD
|
||||
signals. It supports a SQLite based recording as well as the
|
||||
built-in text base recording.
|
||||
</description>
|
||||
|
||||
<copyright>
|
||||
@ -37,8 +37,8 @@ http://www.eclipse.org/legal/epl-v10.html
|
||||
version="0.0.0"/>
|
||||
|
||||
<requires>
|
||||
<import plugin="org.hamcrest.core" version="1.3.0" match="greaterOrEqual"/>
|
||||
<import plugin="com.minres.scviewer.database" version="1.0.0" match="greaterOrEqual"/>
|
||||
<import plugin="com.minres.scviewer.database.ui" version="1.0.0" match="greaterOrEqual"/>
|
||||
<import plugin="com.minres.scviewer.database.ui.swt" version="1.0.0" match="greaterOrEqual"/>
|
||||
<import plugin="org.eclipse.core.runtime"/>
|
||||
<import plugin="org.eclipse.core.resources"/>
|
||||
@ -52,7 +52,6 @@ http://www.eclipse.org/legal/epl-v10.html
|
||||
<import plugin="org.eclipse.core.expressions" version="3.4.600" match="greaterOrEqual"/>
|
||||
<import plugin="org.eclipse.jface"/>
|
||||
<import plugin="com.google.guava" version="15.0.0" match="greaterOrEqual"/>
|
||||
<import plugin="org.hamcrest.core" version="1.3.0" match="greaterOrEqual"/>
|
||||
</requires>
|
||||
|
||||
<plugin
|
||||
|
@ -17,4 +17,25 @@
|
||||
[Enter License Description here.]
|
||||
</license>
|
||||
|
||||
<includes
|
||||
id="com.minres.scviewer.database.feature"
|
||||
version="0.0.0"/>
|
||||
|
||||
<requires>
|
||||
<import plugin="org.eclipse.swt" version="3.103.1" match="greaterOrEqual"/>
|
||||
<import plugin="com.minres.scviewer.database" version="1.0.0" match="greaterOrEqual"/>
|
||||
<import plugin="com.google.guava" version="15.0.0" match="greaterOrEqual"/>
|
||||
<import plugin="org.eclipse.jface"/>
|
||||
<import plugin="org.eclipse.equinox.registry"/>
|
||||
<import plugin="org.eclipse.core.runtime"/>
|
||||
<import plugin="org.eclipse.osgi"/>
|
||||
</requires>
|
||||
|
||||
<plugin
|
||||
id="com.minres.scviewer.database.ui.swt"
|
||||
download-size="0"
|
||||
install-size="0"
|
||||
version="0.0.0"
|
||||
unpack="false"/>
|
||||
|
||||
</feature>
|
||||
|
@ -3,12 +3,13 @@
|
||||
<feature url="features/com.minres.scviewer.feature_1.0.0.qualifier.jar" id="com.minres.scviewer.feature" version="1.0.0.qualifier">
|
||||
<category name="com.minres.scviewer"/>
|
||||
</feature>
|
||||
<feature url="features/com.minres.scviewer.feature.source_1.0.0.qualifier.jar" id="com.minres.scviewer.feature.source" version="1.0.0.qualifier">
|
||||
<category name="com.minres.scviewer"/>
|
||||
<feature id="com.minres.scviewer.e4.feature">
|
||||
<category name="com.minres.scviewer.e4"/>
|
||||
</feature>
|
||||
<category-def name="com.minres.scviewer" label="SCViewer">
|
||||
<description>
|
||||
Viewer for SystemC Verification (SCV) library's transaction recording
|
||||
</description>
|
||||
</category-def>
|
||||
<category-def name="com.minres.scviewer.e4" label="SCViewer E4 application"/>
|
||||
</site>
|
||||
|
@ -4,4 +4,5 @@ org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
|
||||
org.eclipse.jdt.core.compiler.compliance=1.8
|
||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.release=disabled
|
||||
org.eclipse.jdt.core.compiler.source=1.8
|
||||
|
@ -70,7 +70,7 @@ public class TextDbLoader implements IWaveformDbLoader{
|
||||
try {
|
||||
def gzipped = isGzipped(file)
|
||||
if(isTxfile(gzipped?new GZIPInputStream(new FileInputStream(file)):new FileInputStream(file))){
|
||||
def mapDbFile = File.createTempFile("."+file.name, "tmp", file.parentFile)
|
||||
def mapDbFile = File.createTempFile("."+file.name, null /*"tmp"*/, null /*file.parentFile*/)
|
||||
mapDbFile.delete()
|
||||
mapDbFile.deleteOnExit()
|
||||
this.mapDb = DBMaker
|
||||
|
@ -98,4 +98,5 @@ org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
|
||||
org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=ignore
|
||||
org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
|
||||
org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
|
||||
org.eclipse.jdt.core.compiler.release=disabled
|
||||
org.eclipse.jdt.core.compiler.source=1.8
|
||||
|
@ -2,7 +2,7 @@ Manifest-Version: 1.0
|
||||
Bundle-ManifestVersion: 2
|
||||
Bundle-Name: SWT widget
|
||||
Bundle-SymbolicName: com.minres.scviewer.database.ui.swt
|
||||
Bundle-Version: 2.2.0.qualifier
|
||||
Bundle-Version: 2.3.1.qualifier
|
||||
Bundle-Vendor: MINRES Technologies GmbH
|
||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
|
||||
Require-Bundle: org.eclipse.swt;bundle-version="3.103.1",
|
||||
@ -10,11 +10,21 @@ Require-Bundle: org.eclipse.swt;bundle-version="3.103.1",
|
||||
com.google.guava;bundle-version="15.0.0",
|
||||
org.eclipse.jface,
|
||||
org.eclipse.equinox.registry,
|
||||
com.minres.scviewer.database.ui,
|
||||
org.eclipse.core.runtime,
|
||||
org.eclipse.osgi
|
||||
Export-Package: com.minres.scviewer.database.swt
|
||||
Export-Package: com.minres.scviewer.database.ui;
|
||||
uses:="org.eclipse.swt.events,
|
||||
org.eclipse.swt.graphics,
|
||||
org.eclipse.swt.widgets,
|
||||
com.minres.scviewer.database,
|
||||
org.eclipse.jface.viewers",
|
||||
com.minres.scviewer.database.ui.swt;
|
||||
uses:="org.osgi.framework,
|
||||
org.eclipse.core.runtime,
|
||||
com.minres.scviewer.database.ui,
|
||||
org.eclipse.swt.graphics,
|
||||
org.eclipse.swt.widgets"
|
||||
Bundle-ClassPath: .
|
||||
Bundle-ActivationPolicy: lazy
|
||||
Bundle-Activator: com.minres.scviewer.database.swt.DatabaseUiPlugin
|
||||
Bundle-Activator: com.minres.scviewer.database.ui.swt.DatabaseUiPlugin
|
||||
Automatic-Module-Name: com.minres.scviewer.database.ui.swt
|
||||
|
@ -8,5 +8,5 @@
|
||||
<version>2.0.0-SNAPSHOT</version>
|
||||
<relativePath>../..</relativePath>
|
||||
</parent>
|
||||
<version>2.2.0-SNAPSHOT</version>
|
||||
<version>2.3.1-SNAPSHOT</version>
|
||||
</project>
|
||||
|
@ -25,7 +25,7 @@ import org.eclipse.swt.widgets.Control;
|
||||
import com.minres.scviewer.database.IWaveform;
|
||||
import com.minres.scviewer.database.RelationType;
|
||||
|
||||
public interface IWaveformViewer extends PropertyChangeListener, ISelectionProvider{
|
||||
public interface IWaveformView extends PropertyChangeListener, ISelectionProvider{
|
||||
|
||||
String CURSOR_PROPERTY = "cursor_time";
|
||||
|
||||
@ -51,7 +51,9 @@ public interface IWaveformViewer extends PropertyChangeListener, ISelectionProvi
|
||||
|
||||
public void setSelection(ISelection selection);
|
||||
|
||||
public void setSelection(ISelection selection, boolean addIfNeeded);
|
||||
public void setSelection(ISelection selection, boolean showIfNeeded);
|
||||
|
||||
public void addToSelection(ISelection selection, boolean showIfNeeded);
|
||||
|
||||
public void moveSelection(GotoDirection direction);
|
||||
|
||||
@ -110,4 +112,6 @@ public interface IWaveformViewer extends PropertyChangeListener, ISelectionProvi
|
||||
public void scrollHorizontal(int percent);
|
||||
|
||||
public void addDisposeListener( DisposeListener listener );
|
||||
|
||||
public void deleteSelectedTracks();
|
||||
}
|
@ -12,6 +12,6 @@ package com.minres.scviewer.database.ui;
|
||||
|
||||
import org.eclipse.swt.widgets.Composite;
|
||||
|
||||
public interface IWaveformViewerFactory {
|
||||
public IWaveformViewer createPanel(Composite parent);
|
||||
public interface IWaveformViewFactory {
|
||||
public IWaveformView createPanel(Composite parent);
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
package com.minres.scviewer.database.swt;
|
||||
package com.minres.scviewer.database.ui.swt;
|
||||
|
||||
public class Constants {
|
||||
|
@ -8,7 +8,7 @@
|
||||
* Contributors:
|
||||
* MINRES Technologies GmbH - initial API and implementation
|
||||
*******************************************************************************/
|
||||
package com.minres.scviewer.database.swt;
|
||||
package com.minres.scviewer.database.ui.swt;
|
||||
|
||||
import org.eclipse.core.runtime.IStatus;
|
||||
import org.eclipse.core.runtime.Plugin;
|
@ -1,4 +1,4 @@
|
||||
package com.minres.scviewer.database.swt;
|
||||
package com.minres.scviewer.database.ui.swt;
|
||||
|
||||
import org.eclipse.swt.graphics.Point;
|
||||
import org.eclipse.swt.widgets.Composite;
|
@ -1,4 +1,4 @@
|
||||
package com.minres.scviewer.database.swt;
|
||||
package com.minres.scviewer.database.ui.swt;
|
||||
|
||||
import org.eclipse.swt.widgets.Widget;
|
||||
|
@ -8,19 +8,19 @@
|
||||
* Contributors:
|
||||
* MINRES Technologies GmbH - initial API and implementation
|
||||
*******************************************************************************/
|
||||
package com.minres.scviewer.database.swt;
|
||||
package com.minres.scviewer.database.ui.swt;
|
||||
|
||||
import org.eclipse.swt.widgets.Composite;
|
||||
|
||||
import com.minres.scviewer.database.swt.internal.WaveformViewer;
|
||||
import com.minres.scviewer.database.ui.IWaveformViewer;
|
||||
import com.minres.scviewer.database.ui.IWaveformViewerFactory;
|
||||
import com.minres.scviewer.database.ui.IWaveformView;
|
||||
import com.minres.scviewer.database.ui.IWaveformViewFactory;
|
||||
import com.minres.scviewer.database.ui.swt.internal.WaveformView;
|
||||
|
||||
public class WaveformViewerFactory implements IWaveformViewerFactory {
|
||||
public class WaveformViewFactory implements IWaveformViewFactory {
|
||||
|
||||
@Override
|
||||
public IWaveformViewer createPanel(Composite parent) {
|
||||
return new WaveformViewer(parent);
|
||||
public IWaveformView createPanel(Composite parent) {
|
||||
return new WaveformView(parent);
|
||||
}
|
||||
|
||||
}
|
@ -8,7 +8,7 @@
|
||||
* Contributors:
|
||||
* MINRES Technologies GmbH - initial API and implementation
|
||||
*******************************************************************************/
|
||||
package com.minres.scviewer.database.swt.internal;
|
||||
package com.minres.scviewer.database.ui.swt.internal;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.LinkedList;
|
||||
@ -16,7 +16,6 @@ import java.util.List;
|
||||
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.graphics.Color;
|
||||
import org.eclipse.swt.graphics.GC;
|
||||
import org.eclipse.swt.graphics.Path;
|
||||
import org.eclipse.swt.graphics.Point;
|
||||
import org.eclipse.swt.graphics.Rectangle;
|
||||
@ -50,7 +49,7 @@ public class ArrowPainter implements IPainter {
|
||||
|
||||
long scaleFactor;
|
||||
|
||||
boolean deferredUpdate;
|
||||
boolean deferUpdate;
|
||||
|
||||
public ArrowPainter(WaveformCanvas waveCanvas, RelationType relationType) {
|
||||
this.waveCanvas = waveCanvas;
|
||||
@ -81,17 +80,18 @@ public class ArrowPainter implements IPainter {
|
||||
}
|
||||
|
||||
protected void calculateGeometries() {
|
||||
deferredUpdate = false;
|
||||
deferUpdate = false;
|
||||
iRect.clear();
|
||||
oRect.clear();
|
||||
ITxStream<?> stream = tx.getStream();
|
||||
IWaveformPainter painter = waveCanvas.wave2painterMap.get(stream);
|
||||
if (painter == null) { // stream has been added but painter not yet
|
||||
// created
|
||||
deferredUpdate = true;
|
||||
deferUpdate = true;
|
||||
return;
|
||||
}
|
||||
selectionOffset = waveCanvas.getXOffset();
|
||||
int laneHeight = painter.getHeight() / stream.getMaxConcurrency();
|
||||
txRectangle = new Rectangle((int) (tx.getBeginTime() / scaleFactor-waveCanvas.getXOffset()),
|
||||
txRectangle = new Rectangle((int) (tx.getBeginTime() / scaleFactor),
|
||||
waveCanvas.rulerHeight + painter.getVerticalOffset() + laneHeight * tx.getConcurrencyIndex(),
|
||||
(int) ((tx.getEndTime() - tx.getBeginTime()) / scaleFactor), laneHeight);
|
||||
deriveGeom(tx.getIncomingRelations(), iRect, false);
|
||||
@ -105,7 +105,7 @@ public class ArrowPainter implements IPainter {
|
||||
ITxStream<?> stream = otherTx.getStream();
|
||||
IWaveformPainter painter = waveCanvas.wave2painterMap.get(stream);
|
||||
int laneHeight = painter.getHeight() / stream.getMaxConcurrency();
|
||||
Rectangle bb = new Rectangle((int) (otherTx.getBeginTime() / scaleFactor-waveCanvas.getXOffset()),
|
||||
Rectangle bb = new Rectangle((int) (otherTx.getBeginTime() / scaleFactor),
|
||||
waveCanvas.rulerHeight + painter.getVerticalOffset()
|
||||
+ laneHeight * otherTx.getConcurrencyIndex(),
|
||||
(int) ((otherTx.getEndTime() - otherTx.getBeginTime()) / scaleFactor), laneHeight);
|
||||
@ -115,42 +115,33 @@ public class ArrowPainter implements IPainter {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void paintArea(GC gc, Rectangle area) {
|
||||
public void paintArea(Projection proj, Rectangle clientRect) {
|
||||
Color fgColor = waveCanvas.colors[WaveformColors.REL_ARROW.ordinal()];
|
||||
Color highliteColor = waveCanvas.colors[WaveformColors.REL_ARROW_HIGHLITE.ordinal()];
|
||||
|
||||
if (deferredUpdate || (tx != null && waveCanvas.getScaleFactor() != scaleFactor)) {
|
||||
if(tx==null) return;
|
||||
if (!deferUpdate) {
|
||||
scaleFactor = waveCanvas.getScaleFactor();
|
||||
calculateGeometries();
|
||||
}
|
||||
if(txRectangle == null) return;
|
||||
int correctionValue = (int)(selectionOffset - waveCanvas.getXOffset());
|
||||
if(deferUpdate) return;
|
||||
int correctionValue = (int)(selectionOffset);
|
||||
Rectangle correctedTargetRectangle = new Rectangle(txRectangle.x+correctionValue, txRectangle.y, txRectangle.width, txRectangle.height);
|
||||
for (LinkEntry entry : iRect) {
|
||||
Rectangle correctedRectangle = new Rectangle(entry.rectangle.x+correctionValue, entry.rectangle.y, entry.rectangle.width, entry.rectangle.height);
|
||||
Point target = drawPath(gc, highlightType.equals(entry.relationType) ? highliteColor : fgColor,
|
||||
drawArrow(proj, highlightType.equals(entry.relationType) ? highliteColor : fgColor,
|
||||
correctedRectangle, correctedTargetRectangle);
|
||||
drawArrow(gc, target);
|
||||
}
|
||||
for (LinkEntry entry : oRect) {
|
||||
Rectangle correctedRectangle = new Rectangle(entry.rectangle.x+correctionValue, entry.rectangle.y, entry.rectangle.width, entry.rectangle.height);
|
||||
Point target = drawPath(gc, highlightType.equals(entry.relationType) ? highliteColor : fgColor, correctedTargetRectangle,
|
||||
drawArrow(proj, highlightType.equals(entry.relationType) ? highliteColor : fgColor, correctedTargetRectangle,
|
||||
correctedRectangle);
|
||||
drawArrow(gc, target);
|
||||
}
|
||||
}
|
||||
|
||||
protected void drawArrow(GC gc, Point target) {
|
||||
gc.drawLine(target.x - 8, target.y - 5, target.x, target.y);
|
||||
gc.drawLine(target.x - 8, target.y + 5, target.x, target.y);
|
||||
}
|
||||
|
||||
protected Point drawPath(GC gc, Color fgColor, Rectangle srcRectangle, Rectangle tgtRectangle) {
|
||||
Point point1 = new Point(0, srcRectangle.y + srcRectangle.height / 2);
|
||||
Point point2 = new Point(0, tgtRectangle.y + tgtRectangle.height / 2);
|
||||
|
||||
point1.x = srcRectangle.x;
|
||||
point2.x = tgtRectangle.x;
|
||||
protected void drawArrow(Projection proj, Color fgColor, Rectangle srcRectangle, Rectangle tgtRectangle) {
|
||||
Point point1 = proj.project(new Point(srcRectangle.x, srcRectangle.y + srcRectangle.height / 2));
|
||||
Point point2 = proj.project(new Point(tgtRectangle.x, tgtRectangle.y + tgtRectangle.height / 2));
|
||||
|
||||
if (point2.x > point1.x + srcRectangle.width)
|
||||
point1.x += srcRectangle.width;
|
||||
@ -165,11 +156,15 @@ public class ArrowPainter implements IPainter {
|
||||
path.cubicTo(center.x + xCtrlOffset, center.y, point2.x - xCtrlOffset, point2.y, point2.x, point2.y);
|
||||
} else
|
||||
path.cubicTo(point1.x + xCtrlOffset, point1.y, point2.x - xCtrlOffset, point2.y, point2.x, point2.y);
|
||||
gc.setAntialias(SWT.ON);
|
||||
gc.setForeground(fgColor);
|
||||
gc.drawPath(path);
|
||||
|
||||
proj.setAntialias(SWT.ON);
|
||||
proj.setForeground(fgColor);
|
||||
proj.getGC().drawPath(path);
|
||||
path.dispose();
|
||||
return point2;
|
||||
// now draw the arrow head
|
||||
proj.getGC().drawLine(point2.x - 8, point2.y - 5, point2.x, point2.y);
|
||||
proj.getGC().drawLine(point2.x - 8, point2.y + 5, point2.x, point2.y);
|
||||
|
||||
}
|
||||
|
||||
class LinkEntry {
|
@ -8,10 +8,9 @@
|
||||
* Contributors:
|
||||
* MINRES Technologies GmbH - initial API and implementation
|
||||
*******************************************************************************/
|
||||
package com.minres.scviewer.database.swt.internal;
|
||||
package com.minres.scviewer.database.ui.swt.internal;
|
||||
|
||||
import org.eclipse.swt.graphics.Color;
|
||||
import org.eclipse.swt.graphics.GC;
|
||||
import org.eclipse.swt.graphics.Rectangle;
|
||||
|
||||
import com.minres.scviewer.database.ui.ICursor;
|
||||
@ -62,30 +61,30 @@ public class CursorPainter implements IPainter, ICursor {
|
||||
}
|
||||
|
||||
|
||||
public void paintArea(GC gc, Rectangle area) {
|
||||
public void paintArea(Projection proj, Rectangle clientRect) {
|
||||
Rectangle area = proj.unProject(clientRect);
|
||||
if(this.waveCanvas.painterList.size()>0){
|
||||
|
||||
long scaleFactor=waveCanvas.getScaleFactor();
|
||||
long beginPos = area.x;
|
||||
|
||||
maxPosX = area.x + area.width;
|
||||
maxValX = maxPosX + (int)waveCanvas.getXOffset();
|
||||
maxValX = maxPosX;
|
||||
|
||||
// x position of marker in pixels on canvas
|
||||
int x = (int) (time/scaleFactor);
|
||||
// distance of marker from the top of Canvas' painting area
|
||||
int top = id<0?area.y:area.y+15;
|
||||
|
||||
Color drawColor=waveCanvas.colors[id<0?WaveformColors.CURSOR.ordinal():WaveformColors.MARKER.ordinal()];
|
||||
Color dragColor = waveCanvas.colors[WaveformColors.CURSOR_DRAG.ordinal()];
|
||||
Color textColor=waveCanvas.colors[id<0?WaveformColors.CURSOR_TEXT.ordinal():WaveformColors.MARKER_TEXT.ordinal()];
|
||||
if(x>=beginPos && x<=maxValX){
|
||||
gc.setForeground(isDragging?dragColor:drawColor);
|
||||
gc.drawLine(x-(int)waveCanvas.getXOffset(), top, x-(int)waveCanvas.getXOffset(), area.y+area.height);
|
||||
gc.setBackground(drawColor);
|
||||
gc.setForeground(textColor);
|
||||
proj.setForeground(isDragging?dragColor:drawColor);
|
||||
proj.drawLine(x, top, x, area.y+area.height);
|
||||
proj.setBackground(drawColor);
|
||||
proj.setForeground(textColor);
|
||||
Double dTime=new Double(time);
|
||||
gc.drawText((dTime/waveCanvas.getScaleFactorPow10())+waveCanvas.getUnitStr(), x+1-(int)waveCanvas.getXOffset(), top);
|
||||
proj.drawText((dTime/waveCanvas.getScaleFactorPow10())+waveCanvas.getUnitStr(), x+1, top);
|
||||
}
|
||||
}
|
||||
}
|
@ -8,13 +8,12 @@
|
||||
* Contributors:
|
||||
* MINRES Technologies GmbH - initial API and implementation
|
||||
*******************************************************************************/
|
||||
package com.minres.scviewer.database.swt.internal;
|
||||
package com.minres.scviewer.database.ui.swt.internal;
|
||||
|
||||
import org.eclipse.swt.graphics.GC;
|
||||
import org.eclipse.swt.graphics.Rectangle;
|
||||
|
||||
public interface IPainter {
|
||||
|
||||
void paintArea(GC gc,Rectangle area);
|
||||
void paintArea(Projection gc, Rectangle area);
|
||||
|
||||
}
|
@ -8,7 +8,7 @@
|
||||
* Contributors:
|
||||
* MINRES Technologies GmbH - initial API and implementation
|
||||
*******************************************************************************/
|
||||
package com.minres.scviewer.database.swt.internal;
|
||||
package com.minres.scviewer.database.ui.swt.internal;
|
||||
|
||||
import com.minres.scviewer.database.ui.TrackEntry;
|
||||
|
@ -8,7 +8,7 @@
|
||||
* Contributors:
|
||||
* MINRES Technologies GmbH - initial API and implementation
|
||||
*******************************************************************************/
|
||||
package com.minres.scviewer.database.swt.internal;
|
||||
package com.minres.scviewer.database.ui.swt.internal;
|
||||
|
||||
import java.beans.PropertyChangeEvent;
|
||||
import java.beans.PropertyChangeListener;
|
@ -0,0 +1,122 @@
|
||||
package com.minres.scviewer.database.ui.swt.internal;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
import org.eclipse.swt.graphics.Color;
|
||||
import org.eclipse.swt.graphics.GC;
|
||||
import org.eclipse.swt.graphics.Point;
|
||||
import org.eclipse.swt.graphics.Rectangle;
|
||||
|
||||
public class Projection {
|
||||
|
||||
private Point translation;
|
||||
private GC gc;
|
||||
|
||||
public Projection(GC gc) {
|
||||
super();
|
||||
this.gc = gc;
|
||||
translation=new Point(0, 0);
|
||||
}
|
||||
|
||||
void setTranslation(Point t) {
|
||||
translation = t;
|
||||
}
|
||||
|
||||
void setGC(GC gc) {
|
||||
this.gc=gc;
|
||||
}
|
||||
|
||||
Point getTranslation() {
|
||||
return translation;
|
||||
}
|
||||
|
||||
Point project(Point p) {
|
||||
return new Point(p.x+translation.x, p.y+translation.y);
|
||||
}
|
||||
|
||||
public Rectangle unProject(Rectangle r) {
|
||||
return new Rectangle(r.x-translation.x, r.y-translation.y, r.width, r.height);
|
||||
}
|
||||
|
||||
public void setBackground(Color color) {
|
||||
gc.setBackground(color);
|
||||
}
|
||||
public void setFillRule(int rule) {
|
||||
gc.setFillRule(rule);
|
||||
}
|
||||
public void setLineStyle(int style) {
|
||||
gc.setLineStyle(style);
|
||||
}
|
||||
|
||||
public void setLineWidth(int width) {
|
||||
gc.setLineWidth(width);
|
||||
}
|
||||
|
||||
public void setForeground(Color color) {
|
||||
gc.setForeground(color);
|
||||
}
|
||||
|
||||
public void drawLine(int x1, int y1, int x2, int y2) {
|
||||
gc.drawLine(x1+translation.x, y1+translation.y, x2+translation.x, y2+translation.y);
|
||||
|
||||
}
|
||||
|
||||
public GC getGC() {
|
||||
return gc;
|
||||
}
|
||||
|
||||
public void fillRectangle(Rectangle rect) {
|
||||
gc.fillRectangle(rect.x+translation.x, rect.y+translation.y, rect.width, rect.height);
|
||||
}
|
||||
|
||||
public void drawRectangle(Rectangle rect) {
|
||||
gc.drawRectangle(rect.x+translation.y, rect.y+translation.y, rect.width, rect.height);
|
||||
}
|
||||
|
||||
public void fillRoundRectangle(int x, int y, int width, int height, int arcWidth, int arcHeight) {
|
||||
gc.fillRoundRectangle(x+translation.x, y+translation.y, width, height, arcWidth, arcHeight);
|
||||
}
|
||||
|
||||
public void drawRoundRectangle(int x, int y, int width, int height, int arcWidth, int arcHeight) {
|
||||
gc.drawRoundRectangle(x+translation.x, y+translation.y, width, height, arcWidth, arcHeight);
|
||||
}
|
||||
|
||||
public void setAntialias(int antialias) {
|
||||
gc.setAntialias(antialias);
|
||||
}
|
||||
|
||||
public void drawText(String string, int x, int y) {
|
||||
gc.drawText(string, x+translation.x, y+translation.y);
|
||||
}
|
||||
|
||||
private int[] project(int[] points) {
|
||||
int[] res = Arrays.copyOf(points, points.length);
|
||||
for(int i=0; i<points.length; i+=2) {
|
||||
res[i]=points[i]+translation.x;
|
||||
res[i+1]=points[i+1]+translation.y;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
public void fillPolygon(int[] points) {
|
||||
gc.fillPolygon(project(points));
|
||||
}
|
||||
|
||||
public void drawPolygon(int[] points) {
|
||||
gc.drawPolygon(project(points));
|
||||
}
|
||||
|
||||
public Rectangle getClipping() {
|
||||
Rectangle c = gc.getClipping();
|
||||
return new Rectangle(c.x-translation.x, c.y-translation.y, c.width, c.height);
|
||||
}
|
||||
|
||||
public void setClipping(int x, int y, int width, int height) {
|
||||
gc.setClipping(x+translation.x, y+translation.y, width, height);
|
||||
}
|
||||
|
||||
public void setClipping(Rectangle r) {
|
||||
gc.setClipping(r.x+translation.x, r.y+translation.y, r.width, r.height);
|
||||
}
|
||||
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
package com.minres.scviewer.database.swt.internal;
|
||||
package com.minres.scviewer.database.ui.swt.internal;
|
||||
|
||||
import static org.eclipse.swt.events.SelectionListener.widgetSelectedAdapter;
|
||||
|
@ -8,7 +8,7 @@
|
||||
* Contributors:
|
||||
* MINRES Technologies GmbH - initial API and implementation
|
||||
*******************************************************************************/
|
||||
package com.minres.scviewer.database.swt.internal;
|
||||
package com.minres.scviewer.database.ui.swt.internal;
|
||||
|
||||
import java.text.DecimalFormat;
|
||||
|
||||
@ -31,8 +31,8 @@ public class RulerPainter implements IPainter {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void paintArea(GC gc, Rectangle area) {
|
||||
|
||||
public void paintArea(Projection proj, Rectangle area) {
|
||||
GC gc = proj.getGC();
|
||||
Color headerFgColor=waveCanvas.getDisplay().getSystemColor(SWT.COLOR_WIDGET_FOREGROUND);
|
||||
if(headerFgColor.isDisposed())
|
||||
headerFgColor=SWTResourceManager.getColor(0,0,0);
|
||||
@ -44,7 +44,7 @@ public class RulerPainter implements IPainter {
|
||||
long scaleFactor=waveCanvas.getScaleFactor();
|
||||
|
||||
long startPos=area.x*scaleFactor;
|
||||
long startVal=startPos + waveCanvas.getXOffset()*scaleFactor;
|
||||
long startVal=startPos - proj.getTranslation().x*scaleFactor;
|
||||
long endPos=startPos+area.width*scaleFactor;
|
||||
|
||||
long rulerTickMinor = rulerTickMinorC*scaleFactor;
|
@ -8,7 +8,7 @@
|
||||
* Contributors:
|
||||
* MINRES Technologies GmbH - initial API and implementation
|
||||
*******************************************************************************/
|
||||
package com.minres.scviewer.database.swt.internal;
|
||||
package com.minres.scviewer.database.ui.swt.internal;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Map.Entry;
|
||||
@ -79,22 +79,22 @@ public class SignalPainter extends TrackPainter {
|
||||
}
|
||||
|
||||
private int getXPosEnd(long time) {
|
||||
long ltmp = time / this.waveCanvas.getScaleFactor() - waveCanvas.getXOffset();
|
||||
long ltmp = time / this.waveCanvas.getScaleFactor();
|
||||
return ltmp > maxPosX ? maxPosX : (int) ltmp;
|
||||
}
|
||||
|
||||
public void paintArea(GC gc, Rectangle area) {
|
||||
public void paintArea(Projection proj, Rectangle area) {
|
||||
ISignal<?> signal = trackEntry.getSignal();
|
||||
if (trackEntry.selected)
|
||||
gc.setBackground(this.waveCanvas.colors[WaveformColors.TRACK_BG_HIGHLITE.ordinal()]);
|
||||
proj.setBackground(this.waveCanvas.colors[WaveformColors.TRACK_BG_HIGHLITE.ordinal()]);
|
||||
else
|
||||
gc.setBackground(this.waveCanvas.colors[even ? WaveformColors.TRACK_BG_EVEN.ordinal() : WaveformColors.TRACK_BG_ODD.ordinal()]);
|
||||
gc.setFillRule(SWT.FILL_EVEN_ODD);
|
||||
gc.fillRectangle(area);
|
||||
proj.setBackground(this.waveCanvas.colors[even ? WaveformColors.TRACK_BG_EVEN.ordinal() : WaveformColors.TRACK_BG_ODD.ordinal()]);
|
||||
proj.setFillRule(SWT.FILL_EVEN_ODD);
|
||||
proj.fillRectangle(area);
|
||||
|
||||
long scaleFactor = this.waveCanvas.getScaleFactor();
|
||||
long beginPos = area.x;
|
||||
long beginTime = (beginPos + waveCanvas.getXOffset())*scaleFactor;
|
||||
long beginTime = beginPos*scaleFactor;
|
||||
long endTime = beginTime + area.width*scaleFactor;
|
||||
|
||||
Entry<Long, ?> first = signal.getEvents().floorEntry(beginTime);
|
||||
@ -106,18 +106,17 @@ public class SignalPainter extends TrackPainter {
|
||||
} else if (last == null) {
|
||||
last = signal.getEvents().lastEntry();
|
||||
}
|
||||
gc.setForeground(this.waveCanvas.colors[WaveformColors.LINE.ordinal()]);
|
||||
gc.setLineStyle(SWT.LINE_SOLID);
|
||||
gc.setLineWidth(1);
|
||||
proj.setForeground(this.waveCanvas.colors[WaveformColors.LINE.ordinal()]);
|
||||
proj.setLineStyle(SWT.LINE_SOLID);
|
||||
proj.setLineWidth(1);
|
||||
NavigableMap<Long, ?> entries = signal.getEvents().subMap(first.getKey(), false, last.getKey(), true);
|
||||
SignalChange left = new SignalChange(first);
|
||||
SignalChange right = new SignalChange(entries.size() > 0 ? entries.firstEntry() : first);
|
||||
maxPosX = area.x + area.width;
|
||||
maxValX = maxPosX + (int)waveCanvas.getXOffset();
|
||||
yOffsetT = this.waveCanvas.getTrackHeight() / 5 + area.y;
|
||||
yOffsetM = this.waveCanvas.getTrackHeight() / 2 + area.y;
|
||||
yOffsetB = 4 * this.waveCanvas.getTrackHeight() / 5 + area.y;
|
||||
int xSigChangeBeginVal = Math.max(area.x + (int)waveCanvas.getXOffset(), (int) (left.time / this.waveCanvas.getScaleFactor()));
|
||||
int xSigChangeBeginVal = Math.max(area.x, (int) (left.time / this.waveCanvas.getScaleFactor()));
|
||||
int xSigChangeBeginPos = area.x;
|
||||
int xSigChangeEndPos = Math.max(area.x, getXPosEnd(right.time));
|
||||
|
||||
@ -138,9 +137,9 @@ public class SignalPainter extends TrackPainter {
|
||||
}
|
||||
|
||||
|
||||
SignalStencil stencil = getStencil(gc, left, entries);
|
||||
SignalStencil stencil = getStencil(proj.getGC(), left, entries);
|
||||
do {
|
||||
stencil.draw(gc, area, left.value, right.value, xSigChangeBeginPos, xSigChangeEndPos, multiple);
|
||||
stencil.draw(proj, area, left.value, right.value, xSigChangeBeginPos, xSigChangeEndPos, multiple);
|
||||
if (right.time >= endTime)
|
||||
break;
|
||||
left.assign(right);
|
||||
@ -179,7 +178,7 @@ public class SignalPainter extends TrackPainter {
|
||||
|
||||
private interface SignalStencil {
|
||||
|
||||
public void draw(GC gc, Rectangle area, Object left, Object right, int xBegin, int xEnd, boolean multiple);
|
||||
public void draw(Projection proj, Rectangle area, Object left, Object right, int xBegin, int xEnd, boolean multiple);
|
||||
}
|
||||
|
||||
private class MultiBitStencil implements SignalStencil {
|
||||
@ -193,7 +192,7 @@ public class SignalPainter extends TrackPainter {
|
||||
tmpAwtFont = new java.awt.Font(fd.getName(), fd.getStyle(), height);
|
||||
}
|
||||
|
||||
public void draw(GC gc, Rectangle area, Object left, Object right, int xBegin, int xEnd, boolean multiple) {
|
||||
public void draw(Projection proj, Rectangle area, Object left, Object right, int xBegin, int xEnd, boolean multiple) {
|
||||
Color colorBorder = waveCanvas.colors[WaveformColors.SIGNAL0.ordinal()];
|
||||
BitVector last = (BitVector) left;
|
||||
if (last.getValue().toString().contains("X")) {
|
||||
@ -211,9 +210,9 @@ public class SignalPainter extends TrackPainter {
|
||||
xEnd - 1, yOffsetB,
|
||||
xBegin + 1, yOffsetB
|
||||
};
|
||||
gc.setForeground(colorBorder);
|
||||
gc.drawPolygon(points);
|
||||
gc.setForeground(waveCanvas.colors[WaveformColors.SIGNAL_TEXT.ordinal()]);
|
||||
proj.setForeground(colorBorder);
|
||||
proj.drawPolygon(points);
|
||||
proj.setForeground(waveCanvas.colors[WaveformColors.SIGNAL_TEXT.ordinal()]);
|
||||
//TODO: this code should be provided from a central location
|
||||
String label = null;
|
||||
switch(trackEntry.valueDisplay) {
|
||||
@ -226,27 +225,23 @@ public class SignalPainter extends TrackPainter {
|
||||
default:
|
||||
label="h'"+last.toHexString();
|
||||
}
|
||||
Point bb = getBoxWidth(gc, label);
|
||||
Point bb = new Point(DUMMY_PANEL.getFontMetrics(tmpAwtFont).stringWidth(label), height);
|
||||
if (xBegin < area.x) {
|
||||
xBegin = area.x;
|
||||
width = xEnd - xBegin;
|
||||
}
|
||||
if (width > (bb.x+1)) {
|
||||
Rectangle old = gc.getClipping();
|
||||
gc.setClipping(xBegin + 3, yOffsetT, xEnd - xBegin - 5, yOffsetB - yOffsetT);
|
||||
gc.drawText(label, xBegin + 3, yOffsetM - bb.y / 2 - 1);
|
||||
gc.setClipping(old);
|
||||
Rectangle old = proj.getClipping();
|
||||
proj.setClipping(xBegin + 3, yOffsetT, xEnd - xBegin - 5, yOffsetB - yOffsetT);
|
||||
proj.drawText(label, xBegin + 3, yOffsetM - bb.y / 2 - 1);
|
||||
proj.setClipping(old);
|
||||
}
|
||||
} else {
|
||||
gc.setForeground(colorBorder);
|
||||
gc.drawLine(xEnd, yOffsetT, xEnd, yOffsetB);
|
||||
proj.setForeground(colorBorder);
|
||||
proj.drawLine(xEnd, yOffsetT, xEnd, yOffsetB);
|
||||
}
|
||||
}
|
||||
|
||||
private Point getBoxWidth(GC gc, String label) {
|
||||
return new Point(DUMMY_PANEL.getFontMetrics(tmpAwtFont).stringWidth(label), height);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private class MultiBitStencilAnalog implements SignalStencil {
|
||||
@ -254,7 +249,7 @@ public class SignalPainter extends TrackPainter {
|
||||
final boolean continous;
|
||||
private long minVal;
|
||||
private long range;
|
||||
|
||||
double yRange = (yOffsetB-yOffsetT);
|
||||
public MultiBitStencilAnalog(NavigableMap<Long, ?> entries, Object left, boolean continous, boolean signed) {
|
||||
this.continous=continous;
|
||||
Collection<?> values = ((NavigableMap<Long, ?>) entries).values();
|
||||
@ -277,25 +272,25 @@ public class SignalPainter extends TrackPainter {
|
||||
|
||||
}
|
||||
|
||||
public void draw(GC gc, Rectangle area, Object left, Object right, int xBegin, int xEnd, boolean multiple) {
|
||||
public void draw(Projection proj, Rectangle area, Object left, Object right, int xBegin, int xEnd, boolean multiple) {
|
||||
long leftVal = ((BitVector) left).toUnsignedValue();
|
||||
long rightVal= ((BitVector) right).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));
|
||||
proj.setForeground(waveCanvas.colors[WaveformColors.SIGNAL_REAL.ordinal()]);
|
||||
int yOffsetLeft = (int) ((leftVal-minVal) * yRange / range);
|
||||
int yOffsetRight = (int) ((rightVal-minVal) * yRange / range);
|
||||
if(continous) {
|
||||
if (xEnd > maxPosX) {
|
||||
gc.drawLine(xBegin, yOffsetB-yOffsetLeft, maxPosX, yOffsetB-yOffsetRight);
|
||||
proj.drawLine(xBegin, yOffsetB-yOffsetLeft, maxPosX, yOffsetB-yOffsetRight);
|
||||
} else {
|
||||
gc.drawLine(xBegin, yOffsetB-yOffsetLeft, xEnd, yOffsetB-yOffsetRight);
|
||||
proj.drawLine(xBegin, yOffsetB-yOffsetLeft, xEnd, yOffsetB-yOffsetRight);
|
||||
}
|
||||
} else {
|
||||
if (xEnd > maxPosX) {
|
||||
gc.drawLine(xBegin, yOffsetB-yOffsetLeft, maxPosX, yOffsetB-yOffsetLeft);
|
||||
proj.drawLine(xBegin, yOffsetB-yOffsetLeft, maxPosX, yOffsetB-yOffsetLeft);
|
||||
} else {
|
||||
gc.drawLine(xBegin, yOffsetB-yOffsetLeft, xEnd, yOffsetB-yOffsetLeft);
|
||||
proj.drawLine(xBegin, yOffsetB-yOffsetLeft, xEnd, yOffsetB-yOffsetLeft);
|
||||
if(yOffsetRight!=yOffsetLeft) {
|
||||
gc.drawLine(xEnd, yOffsetB-yOffsetLeft, xEnd, yOffsetB-yOffsetRight);
|
||||
proj.drawLine(xEnd, yOffsetB-yOffsetLeft, xEnd, yOffsetB-yOffsetRight);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -303,12 +298,12 @@ public class SignalPainter extends TrackPainter {
|
||||
}
|
||||
|
||||
private class SingleBitStencil implements SignalStencil {
|
||||
public void draw(GC gc, Rectangle area, Object left, Object right, int xBegin, int xEnd, boolean multiple) {
|
||||
public void draw(Projection proj, Rectangle area, Object left, Object right, int xBegin, int xEnd, boolean multiple) {
|
||||
if (multiple) {
|
||||
gc.setForeground(waveCanvas.colors[WaveformColors.SIGNALU.ordinal()]);
|
||||
gc.drawLine(xBegin, yOffsetT, xBegin, yOffsetB);
|
||||
proj.setForeground(waveCanvas.colors[WaveformColors.SIGNALU.ordinal()]);
|
||||
proj.drawLine(xBegin, yOffsetT, xBegin, yOffsetB);
|
||||
if(xEnd>xBegin)
|
||||
gc.drawLine(xEnd, yOffsetT, xEnd, yOffsetB);
|
||||
proj.drawLine(xEnd, yOffsetT, xEnd, yOffsetB);
|
||||
} else {
|
||||
Color color = waveCanvas.colors[WaveformColors.SIGNALX.ordinal()];
|
||||
int yOffset = yOffsetM;
|
||||
@ -326,11 +321,11 @@ public class SignalPainter extends TrackPainter {
|
||||
break;
|
||||
default:
|
||||
}
|
||||
gc.setForeground(color);
|
||||
proj.setForeground(color);
|
||||
if (xEnd > maxPosX) {
|
||||
gc.drawLine(xBegin, yOffset, maxPosX, yOffset);
|
||||
proj.drawLine(xBegin, yOffset, maxPosX, yOffset);
|
||||
} else {
|
||||
gc.drawLine(xBegin, yOffset, xEnd, yOffset);
|
||||
proj.drawLine(xBegin, yOffset, xEnd, yOffset);
|
||||
int yNext = yOffsetM;
|
||||
switch (((BitVector) right).getValue()[0]) {
|
||||
case '1':
|
||||
@ -342,7 +337,7 @@ public class SignalPainter extends TrackPainter {
|
||||
default:
|
||||
}
|
||||
if (yOffset != yNext)
|
||||
gc.drawLine(xEnd, yOffset, xEnd, yNext);
|
||||
proj.drawLine(xEnd, yOffset, xEnd, yNext);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -383,7 +378,7 @@ public class SignalPainter extends TrackPainter {
|
||||
}
|
||||
}
|
||||
|
||||
public void draw(GC gc, Rectangle area, Object left, Object right, int xBegin, int xEnd, boolean multiple) {
|
||||
public void draw(Projection proj, Rectangle area, Object left, Object right, int xBegin, int xEnd, boolean multiple) {
|
||||
double leftVal = (Double) left;
|
||||
double rightVal= (Double) right;
|
||||
if(Double.isNaN(leftVal)) {
|
||||
@ -396,31 +391,31 @@ public class SignalPainter extends TrackPainter {
|
||||
xEnd, yOffsetB,
|
||||
xBegin, yOffsetB
|
||||
};
|
||||
gc.setForeground(color);
|
||||
gc.drawPolygon(points);
|
||||
gc.setBackground(color);
|
||||
gc.fillPolygon(points);
|
||||
proj.setForeground(color);
|
||||
proj.drawPolygon(points);
|
||||
proj.setBackground(color);
|
||||
proj.fillPolygon(points);
|
||||
} else {
|
||||
gc.setForeground(color);
|
||||
gc.drawLine(xEnd, yOffsetT, xEnd, yOffsetB);
|
||||
proj.setForeground(color);
|
||||
proj.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));
|
||||
proj.setForeground(waveCanvas.colors[WaveformColors.SIGNAL_REAL.ordinal()]);
|
||||
int yOffsetLeft = (int) ((leftVal-minVal) * (yOffsetB-yOffsetT) / range);
|
||||
int yOffsetRight = Double.isNaN(rightVal)?yOffsetLeft:(int) ((rightVal-minVal) * (yOffsetB-yOffsetT) / range);
|
||||
if(continous) {
|
||||
if (xEnd > maxPosX) {
|
||||
gc.drawLine(xBegin, yOffsetB-yOffsetLeft, maxPosX, yOffsetB-yOffsetRight);
|
||||
proj.drawLine(xBegin, yOffsetB-yOffsetLeft, maxPosX, yOffsetB-yOffsetRight);
|
||||
} else {
|
||||
gc.drawLine(xBegin, yOffsetB-yOffsetLeft, xEnd, yOffsetB-yOffsetRight);
|
||||
proj.drawLine(xBegin, yOffsetB-yOffsetLeft, xEnd, yOffsetB-yOffsetRight);
|
||||
}
|
||||
} else {
|
||||
if (xEnd > maxPosX) {
|
||||
gc.drawLine(xBegin, yOffsetB-yOffsetLeft, maxPosX, yOffsetB-yOffsetLeft);
|
||||
proj.drawLine(xBegin, yOffsetB-yOffsetLeft, maxPosX, yOffsetB-yOffsetLeft);
|
||||
} else {
|
||||
gc.drawLine(xBegin, yOffsetB-yOffsetLeft, xEnd, yOffsetB-yOffsetLeft);
|
||||
proj.drawLine(xBegin, yOffsetB-yOffsetLeft, xEnd, yOffsetB-yOffsetLeft);
|
||||
if(yOffsetRight!=yOffsetLeft) {
|
||||
gc.drawLine(xEnd, yOffsetB-yOffsetLeft, xEnd, yOffsetB-yOffsetRight);
|
||||
proj.drawLine(xEnd, yOffsetB-yOffsetLeft, xEnd, yOffsetB-yOffsetRight);
|
||||
}
|
||||
}
|
||||
}
|
@ -8,7 +8,7 @@
|
||||
* Contributors:
|
||||
* MINRES Technologies GmbH - initial API and implementation
|
||||
*******************************************************************************/
|
||||
package com.minres.scviewer.database.swt.internal;
|
||||
package com.minres.scviewer.database.ui.swt.internal;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
@ -60,22 +60,22 @@ public class StreamPainter extends TrackPainter{
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public void paintArea(GC gc, Rectangle area) {
|
||||
public void paintArea(Projection proj, Rectangle area) {
|
||||
if(stream.getEvents().size()==0) return;
|
||||
int trackHeight=trackEntry.height/stream.getMaxConcurrency();
|
||||
txBase=trackHeight/5;
|
||||
txHeight=trackHeight*3/5;
|
||||
if(trackEntry.selected) {
|
||||
gc.setBackground(this.waveCanvas.colors[WaveformColors.TRACK_BG_HIGHLITE.ordinal()]);
|
||||
proj.setBackground(this.waveCanvas.colors[WaveformColors.TRACK_BG_HIGHLITE.ordinal()]);
|
||||
}
|
||||
else
|
||||
gc.setBackground(this.waveCanvas.colors[even?WaveformColors.TRACK_BG_EVEN.ordinal():WaveformColors.TRACK_BG_ODD.ordinal()]);
|
||||
gc.setFillRule(SWT.FILL_EVEN_ODD);
|
||||
gc.fillRectangle(area);
|
||||
proj.setBackground(this.waveCanvas.colors[even?WaveformColors.TRACK_BG_EVEN.ordinal():WaveformColors.TRACK_BG_ODD.ordinal()]);
|
||||
proj.setFillRule(SWT.FILL_EVEN_ODD);
|
||||
proj.fillRectangle(area);
|
||||
|
||||
long scaleFactor = this.waveCanvas.getScaleFactor();
|
||||
long beginPos = area.x;
|
||||
long beginTime = (beginPos + waveCanvas.getXOffset())*scaleFactor;
|
||||
long beginTime = beginPos*scaleFactor;
|
||||
//long endPos = beginPos + area.width;
|
||||
long endTime = beginTime + area.width*scaleFactor;
|
||||
|
||||
@ -83,21 +83,21 @@ public class StreamPainter extends TrackPainter{
|
||||
Entry<Long, ?> lastTx=stream.getEvents().ceilingEntry(endTime);
|
||||
if(firstTx==null) firstTx = stream.getEvents().firstEntry();
|
||||
if(lastTx==null) lastTx=stream.getEvents().lastEntry();
|
||||
gc.setFillRule(SWT.FILL_EVEN_ODD);
|
||||
gc.setLineStyle(SWT.LINE_SOLID);
|
||||
gc.setLineWidth(1);
|
||||
gc.setForeground(this.waveCanvas.colors[WaveformColors.LINE.ordinal()]);
|
||||
proj.setFillRule(SWT.FILL_EVEN_ODD);
|
||||
proj.setLineStyle(SWT.LINE_SOLID);
|
||||
proj.setLineWidth(1);
|
||||
proj.setForeground(this.waveCanvas.colors[WaveformColors.LINE.ordinal()]);
|
||||
|
||||
for( int y1=area.y+trackHeight/2; y1<area.y+trackEntry.height; y1+=trackHeight)
|
||||
gc.drawLine(area.x, y1, area.x+area.width, y1);
|
||||
proj.drawLine(area.x, y1, area.x+area.width, y1);
|
||||
if(firstTx==lastTx) {
|
||||
for(ITxEvent txEvent:(Collection<? extends ITxEvent>)firstTx.getValue())
|
||||
drawTx(gc, area, txEvent.getTransaction(), false);
|
||||
drawTx(proj, area, txEvent.getTransaction(), false);
|
||||
}else{
|
||||
seenTx.clear();
|
||||
NavigableMap<Long,?> entries = stream.getEvents().subMap(firstTx.getKey(), true, lastTx.getKey(), true);
|
||||
boolean highlighed=false;
|
||||
gc.setForeground(this.waveCanvas.colors[WaveformColors.LINE.ordinal()]);
|
||||
proj.setForeground(this.waveCanvas.colors[WaveformColors.LINE.ordinal()]);
|
||||
|
||||
for(Entry<Long, ?> entry: entries.entrySet())
|
||||
for(ITxEvent txEvent:(Collection<? extends ITxEvent>)entry.getValue()){
|
||||
@ -106,38 +106,35 @@ public class StreamPainter extends TrackPainter{
|
||||
if(txEvent.getType()==ITxEvent.Type.END){
|
||||
ITx tx = txEvent.getTransaction();
|
||||
highlighed|=waveCanvas.currentSelection!=null && waveCanvas.currentSelection.equals(tx);
|
||||
drawTx(gc, area, tx, false);
|
||||
drawTx(proj, area, tx, false);
|
||||
seenTx.remove(tx);
|
||||
}
|
||||
}
|
||||
for(ITx tx:seenTx){
|
||||
drawTx(gc, area, tx, false);
|
||||
drawTx(proj, area, tx, false);
|
||||
}
|
||||
if(highlighed){
|
||||
gc.setForeground(this.waveCanvas.colors[WaveformColors.LINE_HIGHLITE.ordinal()]);
|
||||
drawTx(gc, area, waveCanvas.currentSelection, true);
|
||||
proj.setForeground(this.waveCanvas.colors[WaveformColors.LINE_HIGHLITE.ordinal()]);
|
||||
drawTx(proj, area, waveCanvas.currentSelection, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void drawTx(GC gc, Rectangle area, ITx tx, boolean highlighted ) {
|
||||
protected void drawTx(Projection proj, Rectangle area, ITx tx, boolean highlighted ) {
|
||||
// compute colors
|
||||
java.awt.Color[] fallbackColors = trackEntry.getColors();
|
||||
java.awt.Color[] transColor = TrackEntry.computeColor( tx.getGenerator().getName(), fallbackColors[0], fallbackColors[1] );
|
||||
|
||||
gc.setBackground( toSwtColor( gc, transColor[highlighted?1:0] ) );
|
||||
proj.setBackground( toSwtColor( proj.getGC(), transColor[highlighted?1:0] ) );
|
||||
|
||||
int offset = tx.getConcurrencyIndex()*this.waveCanvas.getTrackHeight();
|
||||
Rectangle bb = new Rectangle(
|
||||
(int)(tx.getBeginTime()/this.waveCanvas.getScaleFactor()-waveCanvas.getXOffset()), area.y+offset+txBase,
|
||||
(int)(tx.getBeginTime()/this.waveCanvas.getScaleFactor()), area.y+offset+txBase,
|
||||
(int)((tx.getEndTime()-tx.getBeginTime())/this.waveCanvas.getScaleFactor()), txHeight);
|
||||
|
||||
if(bb.x+bb.width<area.x || bb.x>area.x+area.width) return;
|
||||
if(bb.width==0){
|
||||
gc.drawLine(bb.x, bb.y, bb.x, bb.y+bb.height);
|
||||
} else if(bb.width<10){
|
||||
gc.fillRectangle(bb);
|
||||
gc.drawRectangle(bb);
|
||||
proj.drawLine(bb.x, bb.y, bb.x, bb.y+bb.height);
|
||||
} else {
|
||||
if(bb.x < area.x) {
|
||||
bb.width = bb.width-(area.x-bb.x)+5;
|
||||
@ -149,8 +146,9 @@ public class StreamPainter extends TrackPainter{
|
||||
bb_x2=area_x2+5;
|
||||
bb.width= bb_x2-bb.x;
|
||||
}
|
||||
gc.fillRoundRectangle(bb.x, bb.y, bb.width, bb.height, 5, 5);
|
||||
gc.drawRoundRectangle(bb.x, bb.y, bb.width, bb.height, 5, 5);
|
||||
int arc = bb.width<10?1:5;
|
||||
proj.fillRoundRectangle(bb.x, bb.y, bb.width, bb.height, arc, arc);
|
||||
proj.drawRoundRectangle(bb.x, bb.y, bb.width, bb.height, arc, arc);
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
package com.minres.scviewer.database.swt.internal;
|
||||
package com.minres.scviewer.database.ui.swt.internal;
|
||||
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.graphics.Point;
|
||||
@ -13,9 +13,9 @@ import org.eclipse.swt.widgets.Listener;
|
||||
import org.eclipse.swt.widgets.Shell;
|
||||
import org.eclipse.swt.widgets.Widget;
|
||||
|
||||
import com.minres.scviewer.database.swt.Constants;
|
||||
import com.minres.scviewer.database.swt.ToolTipContentProvider;
|
||||
import com.minres.scviewer.database.swt.ToolTipHelpTextProvider;
|
||||
import com.minres.scviewer.database.ui.swt.Constants;
|
||||
import com.minres.scviewer.database.ui.swt.ToolTipContentProvider;
|
||||
import com.minres.scviewer.database.ui.swt.ToolTipHelpTextProvider;
|
||||
|
||||
class ToolTipHandler {
|
||||
|
@ -8,13 +8,12 @@
|
||||
* Contributors:
|
||||
* MINRES Technologies GmbH - initial API and implementation
|
||||
*******************************************************************************/
|
||||
package com.minres.scviewer.database.swt.internal;
|
||||
package com.minres.scviewer.database.ui.swt.internal;
|
||||
|
||||
import java.util.Map.Entry;
|
||||
import java.util.TreeMap;
|
||||
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.graphics.GC;
|
||||
import org.eclipse.swt.graphics.Rectangle;
|
||||
|
||||
import com.minres.scviewer.database.ui.WaveformColors;
|
||||
@ -35,11 +34,11 @@ public class TrackAreaPainter implements IPainter {
|
||||
this.trackVerticalOffset= new TreeMap<>();
|
||||
}
|
||||
|
||||
public void paintArea(GC gc, Rectangle a) {
|
||||
Rectangle area = new Rectangle(a.x, a.y+waveCanvas.rulerHeight, a.width, a.height-waveCanvas.rulerHeight);
|
||||
gc.setBackground(this.waveCanvas.colors[WaveformColors.TRACK_BG_EVEN.ordinal()]);
|
||||
gc.setFillRule(SWT.FILL_EVEN_ODD);
|
||||
gc.fillRectangle(area);
|
||||
public void paintArea(Projection proj, Rectangle a) {
|
||||
Rectangle area = proj.unProject(new Rectangle(a.x, a.y+waveCanvas.rulerHeight, a.width, a.height-waveCanvas.rulerHeight));
|
||||
proj.setBackground(this.waveCanvas.colors[WaveformColors.TRACK_BG_EVEN.ordinal()]);
|
||||
proj.setFillRule(SWT.FILL_EVEN_ODD);
|
||||
proj.fillRectangle(area);
|
||||
if(trackVerticalOffset.size()>0){
|
||||
Integer firstKey=trackVerticalOffset.floorKey(area.y);
|
||||
if(firstKey==null) firstKey=trackVerticalOffset.firstKey();
|
||||
@ -49,12 +48,12 @@ public class TrackAreaPainter implements IPainter {
|
||||
subArea.y=firstKey;
|
||||
IWaveformPainter p = trackVerticalOffset.get(firstKey);
|
||||
subArea.height=p.getHeight();
|
||||
p.paintArea(gc, subArea);
|
||||
p.paintArea(proj, subArea);
|
||||
}else{
|
||||
for(Entry<Integer, IWaveformPainter> entry : trackVerticalOffset.subMap(firstKey, true, lastKey, true).entrySet()){
|
||||
subArea.y=entry.getKey();
|
||||
subArea.height=entry.getValue().getHeight();
|
||||
entry.getValue().paintArea(gc, subArea);
|
||||
entry.getValue().paintArea(proj, subArea);
|
||||
}
|
||||
}
|
||||
}
|
@ -8,7 +8,7 @@
|
||||
* Contributors:
|
||||
* MINRES Technologies GmbH - initial API and implementation
|
||||
*******************************************************************************/
|
||||
package com.minres.scviewer.database.swt.internal;
|
||||
package com.minres.scviewer.database.ui.swt.internal;
|
||||
|
||||
import com.minres.scviewer.database.ui.TrackEntry;
|
||||
|
@ -8,7 +8,7 @@
|
||||
* Contributors:
|
||||
* MINRES Technologies GmbH - initial API and implementation
|
||||
*******************************************************************************/
|
||||
package com.minres.scviewer.database.swt.internal;
|
||||
package com.minres.scviewer.database.ui.swt.internal;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
@ -25,10 +25,10 @@ import org.eclipse.swt.events.SelectionAdapter;
|
||||
import org.eclipse.swt.events.SelectionEvent;
|
||||
import org.eclipse.swt.graphics.Color;
|
||||
import org.eclipse.swt.graphics.GC;
|
||||
import org.eclipse.swt.graphics.Image;
|
||||
import org.eclipse.swt.graphics.Point;
|
||||
import org.eclipse.swt.graphics.RGB;
|
||||
import org.eclipse.swt.graphics.Rectangle;
|
||||
import org.eclipse.swt.graphics.Transform;
|
||||
import org.eclipse.swt.widgets.Canvas;
|
||||
import org.eclipse.swt.widgets.Composite;
|
||||
import org.eclipse.swt.widgets.Display;
|
||||
@ -40,15 +40,17 @@ import com.google.common.collect.Lists;
|
||||
import com.minres.scviewer.database.ITx;
|
||||
import com.minres.scviewer.database.IWaveform;
|
||||
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.IWaveformView;
|
||||
import com.minres.scviewer.database.ui.TrackEntry;
|
||||
import com.minres.scviewer.database.ui.WaveformColors;
|
||||
import com.minres.scviewer.database.ui.swt.Constants;
|
||||
|
||||
public class WaveformCanvas extends Canvas{
|
||||
public class WaveformCanvas extends Canvas {
|
||||
|
||||
Color[] colors = new Color[WaveformColors.values().length];
|
||||
|
||||
private boolean doubleBuffering = true;
|
||||
|
||||
private int trackHeight = 50;
|
||||
|
||||
private long scaleFactor = 1000000L; // 1ns
|
||||
@ -60,9 +62,7 @@ public class WaveformCanvas extends Canvas{
|
||||
private long maxTime;
|
||||
|
||||
protected Point origin; /* original size */
|
||||
|
||||
protected Transform transform;
|
||||
|
||||
|
||||
protected int rulerHeight=40;
|
||||
|
||||
protected List<IPainter> painterList;
|
||||
@ -89,7 +89,7 @@ public class WaveformCanvas extends Canvas{
|
||||
* the style of this control.
|
||||
*/
|
||||
public WaveformCanvas(final Composite parent, int style) {
|
||||
super(parent, style | SWT.DOUBLE_BUFFERED | SWT.NO_BACKGROUND | SWT.NO_REDRAW_RESIZE | SWT.V_SCROLL | SWT.H_SCROLL);
|
||||
super(parent, style | SWT.DOUBLE_BUFFERED | SWT.NO_BACKGROUND | SWT.V_SCROLL | SWT.H_SCROLL);
|
||||
addControlListener(new ControlAdapter() { /* resize listener. */
|
||||
public void controlResized(ControlEvent event) {
|
||||
syncScrollBars();
|
||||
@ -102,7 +102,6 @@ public class WaveformCanvas extends Canvas{
|
||||
});
|
||||
painterList = new LinkedList<IPainter>();
|
||||
origin = new Point(0, 0);
|
||||
transform = new Transform(getDisplay());
|
||||
selectionListeners = new LinkedList<>();
|
||||
cursorPainters= new ArrayList<>();
|
||||
wave2painterMap=new HashMap<>();
|
||||
@ -112,10 +111,10 @@ public class WaveformCanvas extends Canvas{
|
||||
// order is important: it is bottom to top
|
||||
trackAreaPainter=new TrackAreaPainter(this);
|
||||
painterList.add(trackAreaPainter);
|
||||
arrowPainter=new ArrowPainter(this, IWaveformView.NEXT_PREV_IN_STREAM);
|
||||
painterList.add(arrowPainter);
|
||||
rulerPainter=new RulerPainter(this);
|
||||
painterList.add(rulerPainter);
|
||||
arrowPainter=new ArrowPainter(this, IWaveformViewer.NEXT_PREV_IN_STREAM);
|
||||
painterList.add(arrowPainter);
|
||||
CursorPainter cp = new CursorPainter(this, scaleFactor * 10, cursorPainters.size()-1);
|
||||
painterList.add(cp);
|
||||
cursorPainters.add(cp);
|
||||
@ -150,10 +149,6 @@ public class WaveformCanvas extends Canvas{
|
||||
|
||||
}
|
||||
|
||||
public long getXOffset() {
|
||||
return -origin.x;
|
||||
}
|
||||
|
||||
public void addCursoPainter(CursorPainter cursorPainter){
|
||||
painterList.add(cursorPainter);
|
||||
cursorPainters.add(cursorPainter);
|
||||
@ -234,10 +229,10 @@ public class WaveformCanvas extends Canvas{
|
||||
}
|
||||
|
||||
public void setZoomLevel(int level, long centerTime) {
|
||||
//FIXME: keep center if zoom-out and cursor is not in view
|
||||
long oldScaleFactor=scaleFactor;
|
||||
if(level<0) level = 0;
|
||||
if(level<Constants.unitMultiplier.length*Constants.unitString.length){
|
||||
this.level = level;
|
||||
this.scaleFactor = (long) Math.pow(10, level/2);
|
||||
if(level%2==1) this.scaleFactor*=3;
|
||||
ITx tx = arrowPainter.getTx();
|
||||
@ -248,18 +243,19 @@ public class WaveformCanvas extends Canvas{
|
||||
* xcn = tc/newScaleFactor
|
||||
* t0n = (xcn-xoffs)*scaleFactor
|
||||
*/
|
||||
long xc=centerTime/oldScaleFactor; // cursor total x-offset
|
||||
long xoffs=xc+origin.x; // cursor offset relative to left border
|
||||
long xcn=centerTime/scaleFactor; // new total x-offset
|
||||
long originX=xcn-xoffs;
|
||||
if(originX>0) {
|
||||
origin.x=(int) -originX; // new cursor time offset relative to left border
|
||||
}else {
|
||||
origin.x=0;
|
||||
}
|
||||
long xc=centerTime/oldScaleFactor; // cursor total x-offset
|
||||
long xoffs=xc+origin.x; // cursor offset relative to left border
|
||||
long xcn=centerTime/scaleFactor; // new total x-offset
|
||||
long originX=xcn-xoffs;
|
||||
if(originX>0) {
|
||||
origin.x=(int) -originX; // new cursor time offset relative to left border
|
||||
}else {
|
||||
origin.x=0;
|
||||
}
|
||||
syncScrollBars();
|
||||
arrowPainter.setTx(tx);
|
||||
redraw();
|
||||
this.level = level;
|
||||
}
|
||||
}
|
||||
|
||||
@ -323,7 +319,6 @@ public class WaveformCanvas extends Canvas{
|
||||
* Dispose the garbage here
|
||||
*/
|
||||
public void dispose() {
|
||||
transform.dispose();
|
||||
for (WaveformColors c : WaveformColors.values())
|
||||
colors[c.ordinal()].dispose();
|
||||
super.dispose();
|
||||
@ -402,28 +397,37 @@ public class WaveformCanvas extends Canvas{
|
||||
vertical.setSelection(-origin.y);
|
||||
redraw();
|
||||
fireSelectionEvent();
|
||||
|
||||
}
|
||||
|
||||
/* Paint function */
|
||||
private void paint(GC gc) {
|
||||
Point pt = getSize();
|
||||
if(pt.x==0 || pt.y==0) return;
|
||||
Rectangle clientRect = getClientArea(); /* Canvas' painting area */
|
||||
// clientRect.x = -origin.x;
|
||||
clientRect.y = -origin.y;
|
||||
// reset the transform
|
||||
transform.identity();
|
||||
// shift the content
|
||||
// DO NOT SHIFT HORIZONTALLY, the range is WAY TOO BIG for float!!!
|
||||
transform.translate(0, origin.y);
|
||||
gc.setTransform(transform);
|
||||
gc.setClipping(clientRect);
|
||||
GC thisGc = gc;
|
||||
Image d_backingImg = null;
|
||||
if(doubleBuffering) {
|
||||
d_backingImg = new Image(getDisplay(), pt.x, pt.y);
|
||||
thisGc = new GC(d_backingImg);
|
||||
thisGc.setBackground(gc.getBackground());
|
||||
thisGc.setForeground(gc.getForeground());
|
||||
thisGc.setFont(gc.getFont());
|
||||
|
||||
}
|
||||
Projection p = new Projection(thisGc);
|
||||
p.setTranslation(origin);
|
||||
if (painterList.size() > 0 ) {
|
||||
for (IPainter painter : painterList)
|
||||
painter.paintArea(gc, clientRect);
|
||||
painter.paintArea(p, clientRect);
|
||||
} else {
|
||||
gc.fillRectangle(clientRect);
|
||||
initScrollBars();
|
||||
}
|
||||
if(doubleBuffering) {
|
||||
gc.drawImage(d_backingImg, 0, 0);
|
||||
d_backingImg.dispose();
|
||||
thisGc.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
public List<Object> getElementsAt(Point point) {
|
@ -8,7 +8,7 @@
|
||||
* Contributors:
|
||||
* MINRES Technologies GmbH - initial API and implementation
|
||||
*******************************************************************************/
|
||||
package com.minres.scviewer.database.swt.internal;
|
||||
package com.minres.scviewer.database.ui.swt.internal;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.beans.PropertyChangeEvent;
|
||||
@ -52,7 +52,6 @@ import org.eclipse.swt.events.DisposeListener;
|
||||
import org.eclipse.swt.events.MouseAdapter;
|
||||
import org.eclipse.swt.events.MouseEvent;
|
||||
import org.eclipse.swt.events.MouseListener;
|
||||
import org.eclipse.swt.events.MouseMoveListener;
|
||||
import org.eclipse.swt.events.PaintEvent;
|
||||
import org.eclipse.swt.events.PaintListener;
|
||||
import org.eclipse.swt.events.SelectionAdapter;
|
||||
@ -86,14 +85,14 @@ import com.minres.scviewer.database.ITxRelation;
|
||||
import com.minres.scviewer.database.ITxStream;
|
||||
import com.minres.scviewer.database.IWaveform;
|
||||
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.ICursor;
|
||||
import com.minres.scviewer.database.ui.IWaveformViewer;
|
||||
import com.minres.scviewer.database.ui.IWaveformView;
|
||||
import com.minres.scviewer.database.ui.TrackEntry;
|
||||
import com.minres.scviewer.database.ui.WaveformColors;
|
||||
import com.minres.scviewer.database.ui.swt.Constants;
|
||||
|
||||
public class WaveformViewer implements IWaveformViewer {
|
||||
public class WaveformView implements IWaveformView {
|
||||
|
||||
private ListenerList<ISelectionChangedListener> selectionChangedListeners = new ListenerList<ISelectionChangedListener>();
|
||||
|
||||
@ -103,7 +102,7 @@ public class WaveformViewer implements IWaveformViewer {
|
||||
|
||||
private ITx currentTxSelection;
|
||||
|
||||
private TrackEntry currentWaveformSelection;
|
||||
private ArrayList<TrackEntry> currentWaveformSelection = new ArrayList<>();
|
||||
|
||||
private ScrolledComposite nameListScrolled;
|
||||
|
||||
@ -133,51 +132,49 @@ public class WaveformViewer implements IWaveformViewer {
|
||||
|
||||
private Font nameFont, nameFontB;
|
||||
|
||||
protected TrackEntry lastClickedEntry;
|
||||
|
||||
protected MouseListener nameValueMouseListener = new MouseAdapter() {
|
||||
|
||||
@Override
|
||||
public void mouseDown(MouseEvent e) {
|
||||
if (e.button == 1) {
|
||||
Entry<Integer, TrackEntry> entry = trackVerticalOffset.floorEntry(e.y);
|
||||
if (entry != null)
|
||||
setSelection(new StructuredSelection(entry.getValue()));
|
||||
if(entry!=null)
|
||||
entry.getValue().selected=true;
|
||||
} else if (e.button == 3) {
|
||||
Menu topMenu= top.getMenu();
|
||||
if(topMenu!=null) topMenu.setVisible(true);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseUp(MouseEvent e) {
|
||||
if (e.button == 1) {
|
||||
Entry<Integer, TrackEntry> entry = trackVerticalOffset.floorEntry(e.y);
|
||||
if (entry != null) {
|
||||
if((e.stateMask & SWT.SHIFT) != 0) {
|
||||
if(lastClickedEntry.selected) {
|
||||
int firstIdx=streams.indexOf(lastClickedEntry);
|
||||
int lastIdx = streams.indexOf(entry.getValue());
|
||||
List<TrackEntry> res = firstIdx>lastIdx?streams.subList(lastIdx, firstIdx+1):streams.subList(firstIdx, lastIdx+1);
|
||||
setSelection(new StructuredSelection(res), (e.stateMask & SWT.CTRL) !=0 , false);
|
||||
} else
|
||||
setSelection(new StructuredSelection(entry.getValue()), (e.stateMask & SWT.CTRL) !=0 , false);
|
||||
} else {
|
||||
setSelection(new StructuredSelection(entry.getValue()), (e.stateMask & SWT.CTRL) !=0 , false);
|
||||
}
|
||||
lastClickedEntry = entry.getValue();
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
class WaveformMouseListener implements MouseMoveListener, MouseListener, PaintListener {
|
||||
class WaveformMouseListener implements PaintListener, Listener {
|
||||
Point start, end;
|
||||
List<Object> initialSelected;
|
||||
boolean down=false;
|
||||
|
||||
@Override
|
||||
public void mouseDoubleClick(MouseEvent e) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseDown(MouseEvent e) {
|
||||
start=new Point(e.x, e.y);
|
||||
end=new Point(e.x, e.y);
|
||||
down=true;
|
||||
if((e.stateMask&SWT.MODIFIER_MASK)!=0) return; //don't react on modifier
|
||||
if (e.button == 1) {
|
||||
initialSelected = waveformCanvas.getElementsAt(start);
|
||||
} else if (e.button == 3) {
|
||||
Menu topMenu= top.getMenu();
|
||||
if(topMenu!=null) topMenu.setVisible(true);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseMove(MouseEvent e) {
|
||||
if(down) {
|
||||
end=new Point(e.x, e.y);
|
||||
asyncUpdate(e.widget);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void paintControl(PaintEvent e) {
|
||||
if(down) {
|
||||
@ -185,19 +182,17 @@ public class WaveformViewer implements IWaveformViewer {
|
||||
gc.setAlpha(128);
|
||||
int minX = Math.min(start.x, end.x);
|
||||
int width = Math.max(start.x, end.x) - minX;
|
||||
Point origin = waveformCanvas.getOrigin();
|
||||
int y_top = waveformCanvas.getRulerHeight()- origin.y;
|
||||
int y_top = waveformCanvas.getRulerHeight();
|
||||
int y_bottom = waveformCanvas.getSize().y;
|
||||
gc.fillRectangle(minX, y_top, width,y_bottom);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseUp(MouseEvent e) {
|
||||
private void mouseUp(MouseEvent e) {
|
||||
down=false;
|
||||
if(start==null) return;
|
||||
if((e.stateMask&SWT.MODIFIER_MASK&~SWT.SHIFT)!=0) return; //don't react on modifier except shift
|
||||
if(!start.equals(end)){
|
||||
if(e.button == 1 && Math.abs(e.x-start.x)>3){
|
||||
asyncUpdate(e.widget);
|
||||
long startTime = waveformCanvas.getTimeForOffset(start.x);
|
||||
long endTime = waveformCanvas.getTimeForOffset(end.x);
|
||||
@ -285,10 +280,45 @@ public class WaveformViewer implements IWaveformViewer {
|
||||
return time;
|
||||
}
|
||||
|
||||
};
|
||||
protected WaveformMouseListener waveformMouseListener = new WaveformMouseListener();
|
||||
@Override
|
||||
public void handleEvent(Event e) {
|
||||
switch (e.type) {
|
||||
case SWT.MouseWheel:
|
||||
break;
|
||||
case SWT.MouseDown:
|
||||
start=new Point(e.x, e.y);
|
||||
end=new Point(e.x, e.y);
|
||||
if((e.stateMask&SWT.MODIFIER_MASK)!=0) return; //don't react on modifier
|
||||
if (e.button == 1) {
|
||||
down=true;
|
||||
initialSelected = waveformCanvas.getElementsAt(start);
|
||||
} else if (e.button == 3) {
|
||||
Menu topMenu= top.getMenu();
|
||||
if(topMenu!=null) topMenu.setVisible(true);
|
||||
}
|
||||
break;
|
||||
case SWT.MouseUp:
|
||||
mouseUp(new MouseEvent(e));
|
||||
break;
|
||||
//case SWT.MouseDoubleClick:
|
||||
//mouseDoubleClick(new MouseEvent(e));
|
||||
//break;
|
||||
case SWT.MouseMove:
|
||||
if(down) {
|
||||
end=new Point(e.x, e.y);
|
||||
asyncUpdate(e.widget);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public WaveformViewer(Composite parent) {
|
||||
};
|
||||
protected WaveformMouseListener waveformMouseListener = new WaveformMouseListener();
|
||||
|
||||
public WaveformView(Composite parent) {
|
||||
pcs=new PropertyChangeSupport(this);
|
||||
|
||||
trackVerticalOffset = new TreeMap<Integer, TrackEntry>();
|
||||
@ -300,7 +330,7 @@ public class WaveformViewer implements IWaveformViewer {
|
||||
streams = new ObservableList<>();
|
||||
streams.addPropertyChangeListener("content", this);
|
||||
|
||||
top = new Composite(parent, SWT.NONE);
|
||||
top = parent;
|
||||
top.setLayout(new FillLayout(SWT.HORIZONTAL));
|
||||
|
||||
SashForm topSash = new SashForm(top, SWT.SMOOTH);
|
||||
@ -385,9 +415,12 @@ public class WaveformViewer implements IWaveformViewer {
|
||||
valueListScrolled.setContent(valueList);
|
||||
|
||||
waveformCanvas.setMaxTime(1);
|
||||
waveformCanvas.addMouseListener(waveformMouseListener);
|
||||
waveformCanvas.addMouseMoveListener(waveformMouseListener);
|
||||
waveformCanvas.addPaintListener(waveformMouseListener);
|
||||
waveformCanvas.addPaintListener(waveformMouseListener);
|
||||
waveformCanvas.addListener(SWT.MouseDown,waveformMouseListener);
|
||||
waveformCanvas.addListener(SWT.MouseUp,waveformMouseListener);
|
||||
//waveformCanvas.addListener(SWT.MouseDoubleClick,waveformMouseListener);
|
||||
waveformCanvas.addListener(SWT.MouseMove,waveformMouseListener);
|
||||
waveformCanvas.addListener(SWT.MouseWheel, waveformMouseListener);
|
||||
|
||||
nameListScrolled.getVerticalBar().addSelectionListener(new SelectionAdapter() {
|
||||
public void widgetSelected(SelectionEvent e) {
|
||||
@ -458,7 +491,7 @@ public class WaveformViewer implements IWaveformViewer {
|
||||
@Override
|
||||
public void run() {
|
||||
update();
|
||||
waveformCanvas.reveal(currentWaveformSelection.waveform);
|
||||
currentWaveformSelection.stream().forEach(e -> waveformCanvas.reveal(e.waveform));
|
||||
valueList.redraw();
|
||||
nameList.redraw();
|
||||
}
|
||||
@ -481,13 +514,11 @@ public class WaveformViewer implements IWaveformViewer {
|
||||
trackVerticalOffset.clear();
|
||||
waveformCanvas.clearAllWaveformPainter(false);
|
||||
boolean even = true;
|
||||
boolean clearSelection = true;
|
||||
TextLayout tl = new TextLayout(waveformCanvas.getDisplay());
|
||||
tl.setFont(nameFontB);
|
||||
for (TrackEntry streamEntry : streams) {
|
||||
streamEntry.height = waveformCanvas.getTrackHeight();
|
||||
streamEntry.vOffset=trackVerticalHeight;
|
||||
clearSelection &= currentWaveformSelection!=null && (streamEntry.waveform != currentWaveformSelection.waveform);
|
||||
if (streamEntry.isStream()) {
|
||||
streamEntry.currentValue="";
|
||||
streamEntry.height *= streamEntry.getStream().getMaxConcurrency();
|
||||
@ -513,7 +544,6 @@ public class WaveformViewer implements IWaveformViewer {
|
||||
if (trackVerticalOffset.isEmpty()){
|
||||
waveformCanvas.setOrigin(0, 0);
|
||||
}
|
||||
if(clearSelection) setSelection(new StructuredSelection());
|
||||
}
|
||||
|
||||
private int calculateValueWidth() {
|
||||
@ -651,14 +681,13 @@ public class WaveformViewer implements IWaveformViewer {
|
||||
*/
|
||||
@Override
|
||||
public ISelection getSelection() {
|
||||
ArrayList<Object> sel = new ArrayList<>();
|
||||
if (currentTxSelection != null) {
|
||||
Object[] elem = {currentTxSelection, currentWaveformSelection};
|
||||
return new StructuredSelection(elem);
|
||||
} else if (currentWaveformSelection != null) {
|
||||
Object[] elem = {currentWaveformSelection.waveform, currentWaveformSelection};
|
||||
return new StructuredSelection(elem);
|
||||
} else
|
||||
return new StructuredSelection();
|
||||
sel.add(currentTxSelection);
|
||||
}
|
||||
// sel.addAll(currentWaveformSelection.stream().map(e -> e.waveform).collect(Collectors.toList()));
|
||||
sel.addAll(currentWaveformSelection);
|
||||
return new StructuredSelection(sel.toArray());
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
@ -666,22 +695,33 @@ public class WaveformViewer implements IWaveformViewer {
|
||||
*/
|
||||
@Override
|
||||
public void setSelection(ISelection selection) {
|
||||
setSelection(selection, false);
|
||||
setSelection(selection, false, false);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see com.minres.scviewer.database.swt.IWaveformPanel#setSelection(org.eclipse.jface.viewers.ISelection, boolean)
|
||||
*/
|
||||
@Override
|
||||
public void setSelection(ISelection selection, boolean addIfNeeded) {
|
||||
public void setSelection(ISelection selection, boolean showIfNeeded) {
|
||||
setSelection(selection, false, showIfNeeded);
|
||||
}
|
||||
/* (non-Javadoc)
|
||||
* @see com.minres.scviewer.database.swt.IWaveformPanel#addToSelection(org.eclipse.jface.viewers.ISelection, boolean)
|
||||
*/
|
||||
@Override
|
||||
public void addToSelection(ISelection selection, boolean showIfNeeded) {
|
||||
setSelection(selection, true, showIfNeeded);
|
||||
}
|
||||
|
||||
public void setSelection(ISelection selection, boolean add, boolean addIfNeeded) {
|
||||
boolean selectionChanged = false;
|
||||
if(currentWaveformSelection!=null) currentWaveformSelection.selected=false;
|
||||
currentWaveformSelection.forEach(e->e.selected=false);
|
||||
if (selection instanceof IStructuredSelection) {
|
||||
if(((IStructuredSelection) selection).size()==0){
|
||||
selectionChanged = currentTxSelection!=null||currentWaveformSelection!=null;
|
||||
currentTxSelection = null;
|
||||
currentWaveformSelection = null;
|
||||
currentWaveformSelection .clear();
|
||||
} else {
|
||||
if(!add) currentWaveformSelection.clear();
|
||||
for(Object sel:((IStructuredSelection) selection).toArray()){
|
||||
if (sel instanceof ITx && currentTxSelection != sel){
|
||||
ITx txSel = (ITx) sel;
|
||||
@ -694,26 +734,27 @@ public class WaveformViewer implements IWaveformViewer {
|
||||
streams.add(trackEntry);
|
||||
}
|
||||
currentTxSelection = txSel;
|
||||
if(trackEntry!=null) currentWaveformSelection = trackEntry;
|
||||
// if(trackEntry!=null) {
|
||||
// currentWaveformSelection.add((TrackEntry)sel);
|
||||
// }
|
||||
selectionChanged = true;
|
||||
} else if (sel instanceof TrackEntry && currentWaveformSelection != sel) {
|
||||
currentWaveformSelection = (TrackEntry) sel;
|
||||
if(currentTxSelection!=null && currentTxSelection.getStream()!=currentWaveformSelection)
|
||||
currentTxSelection=null;
|
||||
|
||||
} else if (sel instanceof TrackEntry && !currentWaveformSelection.contains(sel)) {
|
||||
currentWaveformSelection.add((TrackEntry)sel);
|
||||
if(currentTxSelection!=null && !selectionChanged)
|
||||
currentTxSelection=null;
|
||||
selectionChanged = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (currentTxSelection != null || currentWaveformSelection != null)
|
||||
if (currentTxSelection != null || currentWaveformSelection.size() > 0)
|
||||
selectionChanged = true;
|
||||
currentTxSelection = null;
|
||||
currentWaveformSelection = null;
|
||||
currentWaveformSelection.clear();
|
||||
}
|
||||
if(currentWaveformSelection!=null) currentWaveformSelection.selected=true;
|
||||
currentWaveformSelection.forEach(e -> e.selected = true);
|
||||
if (selectionChanged) {
|
||||
if(currentWaveformSelection!=null) waveformCanvas.reveal(currentWaveformSelection.waveform);
|
||||
currentWaveformSelection.forEach(e -> waveformCanvas.reveal(e.waveform));
|
||||
waveformCanvas.setSelected(currentTxSelection);
|
||||
valueList.redraw();
|
||||
nameList.redraw();
|
||||
@ -723,13 +764,11 @@ public class WaveformViewer implements IWaveformViewer {
|
||||
|
||||
protected void fireSelectionChanged() {
|
||||
if(currentWaveformSelection==null) return;
|
||||
IStructuredSelection selection=currentTxSelection!=null?
|
||||
new StructuredSelection(new Object[]{currentTxSelection, currentWaveformSelection.waveform}):
|
||||
new StructuredSelection(currentWaveformSelection.waveform);
|
||||
Object[] list = selectionChangedListeners.getListeners();
|
||||
for (int i = 0; i < list.length; i++) {
|
||||
((ISelectionChangedListener) list[i]).selectionChanged(new SelectionChangedEvent(this, selection));
|
||||
}
|
||||
ISelection selection=getSelection();
|
||||
Object[] list = selectionChangedListeners.getListeners();
|
||||
for (int i = 0; i < list.length; i++) {
|
||||
((ISelectionChangedListener) list[i]).selectionChanged(new SelectionChangedEvent(this, selection));
|
||||
}
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
@ -740,12 +779,14 @@ public class WaveformViewer implements IWaveformViewer {
|
||||
if(direction==GotoDirection.NEXT || direction==GotoDirection.PREV)
|
||||
moveSelection(direction, NEXT_PREV_IN_STREAM) ;
|
||||
else {
|
||||
int idx = streams.indexOf(currentWaveformSelection);
|
||||
if(currentWaveformSelection.size()==1) {
|
||||
int idx = streams.indexOf(currentWaveformSelection.get(0));
|
||||
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)));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -754,9 +795,15 @@ public class WaveformViewer implements IWaveformViewer {
|
||||
*/
|
||||
@Override
|
||||
public void moveSelection(GotoDirection direction, RelationType relationType) {
|
||||
if (currentWaveformSelection!=null && currentWaveformSelection.isStream() && currentTxSelection!=null) {
|
||||
if(relationType.equals(IWaveformViewer.NEXT_PREV_IN_STREAM)){
|
||||
ITxStream<? extends ITxEvent> stream = currentWaveformSelection.getStream();
|
||||
TrackEntry selectedWaveform=null;
|
||||
if(currentTxSelection!=null)
|
||||
selectedWaveform = getEntryForStream(currentTxSelection.getStream());
|
||||
else if(currentWaveformSelection.size()!=1) return;
|
||||
if(selectedWaveform==null)
|
||||
selectedWaveform = currentWaveformSelection.get(1);
|
||||
if (selectedWaveform!=null && selectedWaveform.isStream() && currentTxSelection!=null) {
|
||||
if(relationType.equals(IWaveformView.NEXT_PREV_IN_STREAM)){
|
||||
ITxStream<? extends ITxEvent> stream = selectedWaveform.getStream();
|
||||
ITx transaction = null;
|
||||
if (direction == GotoDirection.NEXT) {
|
||||
List<ITxEvent> thisEntryList = stream.getEvents().get(currentTxSelection.getBeginTime());
|
||||
@ -856,14 +903,14 @@ public class WaveformViewer implements IWaveformViewer {
|
||||
*/
|
||||
@Override
|
||||
public void moveCursor(GotoDirection direction) {
|
||||
if(currentWaveformSelection.size()!=1) return;
|
||||
TrackEntry sel = currentWaveformSelection.get(0);
|
||||
long time = getCursorTime();
|
||||
NavigableMap<Long, ?> map=null;
|
||||
if(currentWaveformSelection!=null) {
|
||||
if(currentWaveformSelection.isStream()){
|
||||
map=currentWaveformSelection.getStream().getEvents();
|
||||
} else if(currentWaveformSelection.isSignal()){
|
||||
map=currentWaveformSelection.getSignal().getEvents();
|
||||
}
|
||||
if(sel.isStream()){
|
||||
map=sel.getStream().getEvents();
|
||||
} else if(sel.isSignal()){
|
||||
map=sel.getSignal().getEvents();
|
||||
}
|
||||
if(map!=null){
|
||||
Entry<Long, ?> entry=direction==GotoDirection.PREV?map.lowerEntry(time):map.higherEntry(time);
|
||||
@ -885,29 +932,37 @@ public class WaveformViewer implements IWaveformViewer {
|
||||
public List<TrackEntry> getStreamList() {
|
||||
return streams;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see com.minres.scviewer.database.swt.IWaveformPanel#deleteSelectedTracks()
|
||||
*/
|
||||
@Override
|
||||
public void deleteSelectedTracks() {
|
||||
List<TrackEntry> streams = getStreamList();
|
||||
for (Object o : (IStructuredSelection)getSelection()) {
|
||||
if(o instanceof TrackEntry) {
|
||||
TrackEntry e = (TrackEntry) o;
|
||||
e.selected=false;
|
||||
streams.remove(e);
|
||||
}
|
||||
}
|
||||
setSelection(new StructuredSelection());
|
||||
update();
|
||||
}
|
||||
/* (non-Javadoc)
|
||||
* @see com.minres.scviewer.database.swt.IWaveformPanel#moveSelected(int)
|
||||
*/
|
||||
@Override
|
||||
public void moveSelectedTrack(int i) {
|
||||
if(currentWaveformSelection!=null){
|
||||
int idx = streams.indexOf(currentWaveformSelection);
|
||||
int newIdx=idx+i;
|
||||
if(newIdx>=0 && newIdx<streams.size()){
|
||||
Collections.swap(streams,idx,newIdx);
|
||||
revealSelected=true;
|
||||
// update();
|
||||
// ITx selectedTx=currentTxSelection;
|
||||
// if(selectedTx!=null){
|
||||
// setSelection(new StructuredSelection(new Object[]{selectedTx, currentWaveformSelection.waveform}));
|
||||
// } else {
|
||||
// setSelection(new StructuredSelection(currentWaveformSelection.waveform));
|
||||
// }
|
||||
// waveformCanvas.reveal(currentWaveformSelection.waveform);
|
||||
// valueList.redraw();
|
||||
// nameList.redraw();
|
||||
}
|
||||
if(currentWaveformSelection.size()>0){
|
||||
int idx = streams.indexOf(currentWaveformSelection.get(0));
|
||||
for(Object o: currentWaveformSelection)
|
||||
streams.remove(o);
|
||||
int tgtIdx=idx+i;
|
||||
if(tgtIdx<0) tgtIdx=0;
|
||||
if(tgtIdx>=streams.size())
|
||||
streams.addAll(currentWaveformSelection);
|
||||
else
|
||||
streams.addAll(tgtIdx, currentWaveformSelection);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1109,38 +1164,30 @@ public class WaveformViewer implements IWaveformViewer {
|
||||
dropTarget.setTransfer(types);
|
||||
|
||||
dropTarget.addDropListener(new DropTargetAdapter() {
|
||||
@SuppressWarnings("unchecked")
|
||||
public void drop(DropTargetEvent event) {
|
||||
if (LocalSelectionTransfer.getTransfer().isSupportedType(event.currentDataType)){
|
||||
ISelection sel = LocalSelectionTransfer.getTransfer().getSelection();
|
||||
if(sel!=null && sel instanceof IStructuredSelection){
|
||||
Object source = ((IStructuredSelection)sel).getFirstElement();
|
||||
ISelection s = LocalSelectionTransfer.getTransfer().getSelection();
|
||||
if(s!=null && s instanceof IStructuredSelection){
|
||||
IStructuredSelection sel = (IStructuredSelection) s;
|
||||
for(Object o: sel.toList())
|
||||
streams.remove(o);
|
||||
DropTarget tgt = (DropTarget) event.widget;
|
||||
Point dropPoint = ((Canvas) tgt.getControl()).toControl(event.x, event.y);
|
||||
Object target = trackVerticalOffset.floorEntry(dropPoint.y).getValue();
|
||||
if(source instanceof TrackEntry && target instanceof TrackEntry){
|
||||
TrackEntry srcWave=(TrackEntry) source;
|
||||
int srcIdx=streams.indexOf(srcWave);
|
||||
streams.remove(srcWave);
|
||||
// extract all elements being selected
|
||||
if( dropPoint.y > trackVerticalOffset.lastKey()) {
|
||||
streams.addAll(sel.toList());
|
||||
} else {
|
||||
TrackEntry target = trackVerticalOffset.floorEntry(dropPoint.y).getValue();
|
||||
int tgtIdx=streams.indexOf(target);
|
||||
if(srcIdx<=tgtIdx) tgtIdx++;
|
||||
if(tgtIdx>=streams.size())
|
||||
streams.add(srcWave);
|
||||
else
|
||||
streams.add(tgtIdx, srcWave);
|
||||
currentWaveformSelection=srcWave;
|
||||
update();
|
||||
} else if(source instanceof CursorPainter){
|
||||
((CursorPainter)source).setTime(0);
|
||||
updateValueList();
|
||||
}
|
||||
streams.addAll(tgtIdx, sel.toList());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void dropAccept(DropTargetEvent event) {
|
||||
Point offset = canvas.toControl(event.x, event.y);
|
||||
if (event.detail != DND.DROP_MOVE || offset.y > trackVerticalOffset.lastKey() + waveformCanvas.getTrackHeight()) {
|
||||
if (event.detail != DND.DROP_MOVE) {
|
||||
event.detail = DND.DROP_NONE;
|
||||
}
|
||||
}
|
||||
@ -1351,4 +1398,5 @@ public class WaveformViewer implements IWaveformViewer {
|
||||
public void addDisposeListener( DisposeListener listener ) {
|
||||
waveformCanvas.addDisposeListener(listener);
|
||||
}
|
||||
|
||||
}
|
@ -1,13 +1,13 @@
|
||||
/*******************************************************************************
|
||||
* 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
|
||||
*******************************************************************************/
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2011 Google, Inc.
|
||||
* 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:
|
||||
* Google, Inc. - initial API and implementation
|
||||
*******************************************************************************/
|
||||
package org.eclipse.wb.swt;
|
||||
|
||||
import java.io.FileInputStream;
|
||||
|
@ -1,7 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
|
||||
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
@ -1,28 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>com.minres.scviewer.database.ui</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.pde.ManifestBuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.pde.SchemaBuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.pde.PluginNature</nature>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
@ -1,7 +0,0 @@
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
|
||||
org.eclipse.jdt.core.compiler.compliance=1.8
|
||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.source=1.8
|
@ -1,3 +0,0 @@
|
||||
eclipse.preferences.version=1
|
||||
pluginProject.extensions=false
|
||||
resolve.requirebundle=false
|
@ -1,12 +0,0 @@
|
||||
Manifest-Version: 1.0
|
||||
Bundle-ManifestVersion: 2
|
||||
Bundle-Name: Database UI
|
||||
Bundle-SymbolicName: com.minres.scviewer.database.ui
|
||||
Bundle-Version: 2.0.0.qualifier
|
||||
Bundle-Vendor: MINRES Technologies GmbH
|
||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
|
||||
Export-Package: com.minres.scviewer.database.ui
|
||||
Require-Bundle: com.minres.scviewer.database,
|
||||
org.eclipse.jface,
|
||||
org.eclipse.swt
|
||||
Automatic-Module-Name: com.minres.scviewer.database.ui
|
@ -1,4 +0,0 @@
|
||||
source.. = src/
|
||||
output.. = bin/
|
||||
bin.includes = META-INF/,\
|
||||
.
|
@ -4,4 +4,5 @@ org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
|
||||
org.eclipse.jdt.core.compiler.compliance=1.8
|
||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.release=disabled
|
||||
org.eclipse.jdt.core.compiler.source=1.8
|
||||
|
@ -5,4 +5,5 @@ org.eclipse.jdt.core.compiler.compliance=1.8
|
||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
|
||||
org.eclipse.jdt.core.compiler.release=disabled
|
||||
org.eclipse.jdt.core.compiler.source=1.8
|
||||
|
@ -9,4 +9,5 @@ org.eclipse.jdt.core.compiler.debug.localVariable=generate
|
||||
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
|
||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.release=disabled
|
||||
org.eclipse.jdt.core.compiler.source=1.8
|
||||
|
@ -1,43 +1,18 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<application:Application xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:advanced="http://www.eclipse.org/ui/2010/UIModel/application/ui/advanced" xmlns:application="http://www.eclipse.org/ui/2010/UIModel/application" xmlns:basic="http://www.eclipse.org/ui/2010/UIModel/application/ui/basic" xmlns:menu="http://www.eclipse.org/ui/2010/UIModel/application/ui/menu" xmlns:ui="http://www.eclipse.org/ui/2010/UIModel/application/ui" xmi:id="_95PfsHNmEeWBq8z1Dv39LA" elementId="org.eclipse.e4.ide.application" bindingContexts="_95PfuXNmEeWBq8z1Dv39LA">
|
||||
<children xsi:type="basic:TrimmedWindow" xmi:id="_95PfsXNmEeWBq8z1Dv39LA" label="SC Viewer" bindingContexts="_95PfunNmEeWBq8z1Dv39LA" width="980" height="700">
|
||||
<children xsi:type="basic:TrimmedWindow" xmi:id="_95PfsXNmEeWBq8z1Dv39LA" label="SC Viewer" bindingContexts="_95PfunNmEeWBq8z1Dv39LA" width="1280" height="700">
|
||||
<children xsi:type="advanced:PerspectiveStack" xmi:id="_95QGxnNmEeWBq8z1Dv39LA">
|
||||
<children xsi:type="advanced:Perspective" xmi:id="_95QGx3NmEeWBq8z1Dv39LA">
|
||||
<children xsi:type="basic:PartSashContainer" xmi:id="_95QGyHNmEeWBq8z1Dv39LA" horizontal="true">
|
||||
<children xsi:type="basic:Part" xmi:id="_95QGynNmEeWBq8z1Dv39LA" elementId="com.minres.scviewer.e4.application.parts.DesignBrowser" containerData="2000" contributionURI="bundleclass://com.minres.scviewer.e4.application/com.minres.scviewer.e4.application.parts.DesignBrowser" label="Design Browser" bindingContexts="_iQ3kQGVmEeqSQM-A6dw9ig">
|
||||
<handlers xmi:id="_JIWOYIq-EeWid7xO48ZBXw" elementId="com.minres.scviewer.e4.application.handler.addWaveformCommand" contributionURI="bundleclass://com.minres.scviewer.e4.application/com.minres.scviewer.e4.application.handlers.AddWaveformHandler" command="_2PehEHr9EeWVM_sKoXvptg"/>
|
||||
<menus xsi:type="menu:PopupMenu" xmi:id="_HvUl8Iq-EeWid7xO48ZBXw" elementId="com.minres.scviewer.e4.application.parts.DesignBrowser.popupmenu">
|
||||
<children xsi:type="menu:HandledMenuItem" xmi:id="_HvUl8Yq-EeWid7xO48ZBXw" elementId="com.minres.scviewer.e4.application.handledmenuitem.append" label="Append after" iconURI="platform:/plugin/com.minres.scviewer.e4.application/icons/append_wave.png" command="_2PehEHr9EeWVM_sKoXvptg">
|
||||
<parameters xmi:id="_HvUl8oq-EeWid7xO48ZBXw" elementId="com.minres.scviewer.e4.application.parameter.21" name="com.minres.scviewer.e4.application.command.addwaveform.where" value="after"/>
|
||||
<parameters xmi:id="_HvUl84q-EeWid7xO48ZBXw" elementId="com.minres.scviewer.e4.application.parameter.25" name="com.minres.scviewer.e4.application.command.addwaveform.all" value="false"/>
|
||||
</children>
|
||||
<children xsi:type="menu:HandledMenuItem" xmi:id="_HvUl9Iq-EeWid7xO48ZBXw" elementId="com.minres.scviewer.e4.application.handledmenuitem.insertbefore" label="Insert before" iconURI="platform:/plugin/com.minres.scviewer.e4.application/icons/insert_wave.png" command="_2PehEHr9EeWVM_sKoXvptg">
|
||||
<parameters xmi:id="_HvUl9Yq-EeWid7xO48ZBXw" elementId="com.minres.scviewer.e4.application.parameter.22" name="com.minres.scviewer.e4.application.command.addwaveform.where" value="before"/>
|
||||
<parameters xmi:id="_HvUl9oq-EeWid7xO48ZBXw" elementId="com.minres.scviewer.e4.application.parameter.26" name="com.minres.scviewer.e4.application.command.addwaveform.all" value="false"/>
|
||||
</children>
|
||||
<children xsi:type="menu:HandledMenuItem" xmi:id="_HvUl94q-EeWid7xO48ZBXw" elementId="com.minres.scviewer.e4.application.handledmenuitem.appendall" label="Append all" iconURI="platform:/plugin/com.minres.scviewer.e4.application/icons/append_all_waves.png" command="_2PehEHr9EeWVM_sKoXvptg">
|
||||
<parameters xmi:id="_HvUl-Iq-EeWid7xO48ZBXw" elementId="com.minres.scviewer.e4.application.parameter.23" name="com.minres.scviewer.e4.application.command.addwaveform.where" value="after"/>
|
||||
<parameters xmi:id="_HvUl-Yq-EeWid7xO48ZBXw" elementId="com.minres.scviewer.e4.application.parameter.27" name="com.minres.scviewer.e4.application.command.addwaveform.all" value="true"/>
|
||||
</children>
|
||||
<children xsi:type="menu:HandledMenuItem" xmi:id="_HvUl-oq-EeWid7xO48ZBXw" elementId="com.minres.scviewer.e4.application.handledmenuitem.insertall" label="Insert All" iconURI="platform:/plugin/com.minres.scviewer.e4.application/icons/insert_all_waves.png" command="_2PehEHr9EeWVM_sKoXvptg">
|
||||
<parameters xmi:id="_HvUl-4q-EeWid7xO48ZBXw" elementId="com.minres.scviewer.e4.application.parameter.24" name="com.minres.scviewer.e4.application.command.addwaveform.where" value="before"/>
|
||||
<parameters xmi:id="_HvUl_Iq-EeWid7xO48ZBXw" elementId="com.minres.scviewer.e4.application.parameter.28" name="com.minres.scviewer.e4.application.command.addwaveform.all" value="true"/>
|
||||
</children>
|
||||
</menus>
|
||||
</children>
|
||||
<children xsi:type="basic:PartSashContainer" xmi:id="_uT9BIHgtEeWwZ-9vrAR2UQ" elementId="" containerData="8000">
|
||||
<children xsi:type="basic:PartStack" xmi:id="_95QGyXNmEeWBq8z1Dv39LA" elementId="org.eclipse.editorss" containerData="7500">
|
||||
<tags>NoAutoCollapse</tags>
|
||||
</children>
|
||||
<children xsi:type="basic:Part" xmi:id="_vtfm8HgtEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.parts.WaveformDetails" containerData="2500" contributionURI="bundleclass://com.minres.scviewer.e4.application/com.minres.scviewer.e4.application.parts.TransactionDetails" label="Waveform Details"/>
|
||||
</children>
|
||||
<children xsi:type="basic:PartStack" xmi:id="_95QGyXNmEeWBq8z1Dv39LA" elementId="org.eclipse.editorss" containerData="7500">
|
||||
<tags>NoAutoCollapse</tags>
|
||||
</children>
|
||||
</children>
|
||||
</children>
|
||||
<children xsi:type="basic:Part" xmi:id="__VNlAIytEeWid7xO48ZBXw" elementId="com.minres.scviewer.e4.application.dialog.aboutscviewer" toBeRendered="false" visible="false" contributionURI="bundleclass://com.minres.scviewer.e4.application/com.minres.scviewer.e4.application.parts.AboutDialog" label="About SCViewer" bindingContexts="_95Pfu3NmEeWBq8z1Dv39LA"/>
|
||||
<mainMenu xmi:id="_95PfyXNmEeWBq8z1Dv39LA" elementId="menu:org.eclipse.ui.main.menu">
|
||||
<children xsi:type="menu:Menu" xmi:id="_95QGwHNmEeWBq8z1Dv39LA" elementId="com.minres.scviewer.e4.application.menu.file" label="File">
|
||||
<children xsi:type="menu:HandledMenuItem" xmi:id="_VJG3YHgvEeWwZ-9vrAR2UQ" elementId="" label="Open Database" iconURI="platform:/plugin/com.minres.scviewer.e4.application/icons/folder_database.png" mnemonics="M1+O" command="_95PfwHNmEeWBq8z1Dv39LA"/>
|
||||
<children xsi:type="menu:HandledMenuItem" xmi:id="_igsK0BkREeudD5MqrWoETQ" elementId="" label="Open Database" iconURI="platform:/plugin/com.minres.scviewer.e4.application/icons/folder_database.png" mnemonics="M1+O" command="_95PfwHNmEeWBq8z1Dv39LA"/>
|
||||
<children xsi:type="menu:HandledMenuItem" xmi:id="_VJG3YHgvEeWwZ-9vrAR2UQ" elementId="" label="Re-load Database" iconURI="platform:/plugin/com.minres.scviewer.e4.application/icons/database_refresh.png" mnemonics="M1+R" command="_srACsBkREeudD5MqrWoETQ"/>
|
||||
<children xsi:type="menu:HandledMenuItem" xmi:id="_e7MOYJedEeW09eyIbHsdvg" elementId="" label="Load active tab settings" iconURI="platform:/plugin/com.minres.scviewer.e4.application/icons/folder_page.png" command="_7-AIMJebEeW09eyIbHsdvg">
|
||||
<parameters xmi:id="_4vtYgJehEeW09eyIbHsdvg" elementId="com.minres.scviewer.e4.application.parameter.30" name="com.minres.scviewer.e4.application.commandparameter.loadStore" value="load"/>
|
||||
</children>
|
||||
@ -79,12 +54,14 @@
|
||||
<children xsi:type="menu:HandledMenuItem" xmi:id="_JTXBgYl_EeWxJ_wPkM6yGQ" elementId="" label="Preferences" command="_AxH6sIl_EeWxJ_wPkM6yGQ"/>
|
||||
</children>
|
||||
<children xsi:type="menu:Menu" xmi:id="_95QGxHNmEeWBq8z1Dv39LA" elementId="com.minres.scviewer.e4.application.menu.help" label="Help">
|
||||
<children xsi:type="menu:HandledMenuItem" xmi:id="_UQRi0B07EeuiP60JNw0iiA" elementId="com.minres.scviewer.e4.application.handledmenuitem.checkforupdate" visible="false" label="Check for Update" enabled="false" command="_-9ED4B06EeuiP60JNw0iiA"/>
|
||||
<children xsi:type="menu:HandledMenuItem" xmi:id="_95QGxXNmEeWBq8z1Dv39LA" label="About" command="_95PfxnNmEeWBq8z1Dv39LA"/>
|
||||
</children>
|
||||
</mainMenu>
|
||||
<trimBars xmi:id="_95QGy3NmEeWBq8z1Dv39LA" elementId="org.eclipse.ui.main.toolbar">
|
||||
<children xsi:type="menu:ToolBar" xmi:id="_95QGzHNmEeWBq8z1Dv39LA" elementId="toolbar:org.eclipse.ui.main.toolbar">
|
||||
<children xsi:type="menu:HandledToolItem" xmi:id="_95QGzXNmEeWBq8z1Dv39LA" iconURI="platform:/plugin/com.minres.scviewer.e4.application/icons/folder_database.png" tooltip="Open new database" command="_95PfwHNmEeWBq8z1Dv39LA"/>
|
||||
<children xsi:type="menu:HandledToolItem" xmi:id="_ZSajwBkZEeudD5MqrWoETQ" iconURI="platform:/plugin/com.minres.scviewer.e4.application/icons/folder_database.png" tooltip="Open new database" command="_95PfwHNmEeWBq8z1Dv39LA"/>
|
||||
<children xsi:type="menu:HandledToolItem" xmi:id="_95QGzXNmEeWBq8z1Dv39LA" iconURI="platform:/plugin/com.minres.scviewer.e4.application/icons/database_refresh.png" tooltip="Re-load database" command="_srACsBkREeudD5MqrWoETQ"/>
|
||||
<children xsi:type="menu:HandledToolItem" xmi:id="_o9UBUJeiEeW09eyIbHsdvg" elementId="com.minres.scviewer.e4.application.handledtoolitem.loadsettings" label="Load settings" iconURI="platform:/plugin/com.minres.scviewer.e4.application/icons/folder_page.png" command="_7-AIMJebEeW09eyIbHsdvg">
|
||||
<parameters xmi:id="_tQZAEJeiEeW09eyIbHsdvg" elementId="com.minres.scviewer.e4.application.parameter.32" name="com.minres.scviewer.e4.application.commandparameter.loadStore" value="load"/>
|
||||
</children>
|
||||
@ -144,10 +121,7 @@
|
||||
<children xsi:type="menu:ToolControl" xmi:id="_YsBi8HfLEeWwZ-9vrAR2UQ" elementId="org.eclipse.ui.StatusLine" contributionURI="bundleclass://com.minres.scviewer.e4.application/com.minres.scviewer.e4.application.internal.status.WaveStatusBarControl">
|
||||
<tags>stretch</tags>
|
||||
</children>
|
||||
<children xsi:type="menu:ToolControl" xmi:id="_VZzJMHdHEeWwZ-9vrAR2UQ" elementId="org.eclipse.ui.HeapStatus" contributionURI="bundleclass://com.minres.scviewer.e4.application/com.minres.scviewer.e4.application.internal.status.StatusBarControl">
|
||||
<tags>Draggable</tags>
|
||||
</children>
|
||||
<children xsi:type="menu:ToolControl" xmi:id="_y0ZS0HfzEeWwZ-9vrAR2UQ" elementId="org.eclipse.ui.ProgressBar" contributionURI="bundleclass://com.minres.scviewer.e4.application/com.minres.scviewer.e4.application.internal.status.StatusBarControl">
|
||||
<children xsi:type="menu:ToolControl" xmi:id="_VZzJMHdHEeWwZ-9vrAR2UQ" elementId="org.eclipse.ui.HeapStatus" contributionURI="bundleclass://com.minres.scviewer.e4.application/com.minres.scviewer.e4.application.internal.status.WaveStatusBarControl">
|
||||
<tags>Draggable</tags>
|
||||
</children>
|
||||
</trimBars>
|
||||
@ -162,6 +136,9 @@
|
||||
<handlers xmi:id="_V4EscIuGEeWid7xO48ZBXw" elementId="com.minres.scviewer.e4.application.handler.setreleationtype" contributionURI="bundleclass://com.minres.scviewer.e4.application/com.minres.scviewer.e4.application.handlers.SetRelationTypeHandler" command="_E9lUgIt2EeWid7xO48ZBXw"/>
|
||||
<handlers xmi:id="__99WoJebEeW09eyIbHsdvg" elementId="com.minres.scviewer.e4.application.handler.loadStoreSettings" contributionURI="bundleclass://com.minres.scviewer.e4.application/com.minres.scviewer.e4.application.handlers.LoadStoreSettingsHandler" command="_7-AIMJebEeW09eyIbHsdvg"/>
|
||||
<handlers xmi:id="_x4pSEGtTEeqmlpoaaMHoiw" elementId="com.minres.scviewer.e4.application.handler.0" contributionURI="bundleclass://com.minres.scviewer.e4.application/com.minres.scviewer.e4.application.handlers.EnableHover" command="_uyeyYGtTEeqmlpoaaMHoiw"/>
|
||||
<handlers xmi:id="_h3jU8BkWEeudD5MqrWoETQ" elementId="com.minres.scviewer.e4.application.handler.reloadCommand" contributionURI="bundleclass://com.minres.scviewer.e4.application/com.minres.scviewer.e4.application.handlers.ReloadHandler" command="_srACsBkREeudD5MqrWoETQ"/>
|
||||
<handlers xmi:id="_gn_boBlEEeuiP60JNw0iiA" elementId="com.minres.scviewer.e4.application.handler.txSearch" contributionURI="bundleclass://com.minres.scviewer.e4.application/com.minres.scviewer.e4.application.handlers.SearchHandler" command="_XDxTYBlEEeuiP60JNw0iiA"/>
|
||||
<handlers xmi:id="_CCEtAB07EeuiP60JNw0iiA" elementId="com.minres.scviewer.e4.application.handler.update" contributionURI="bundleclass://com.minres.scviewer.e4.application/com.minres.scviewer.e4.application.handlers.UpdateHandler" command="_-9ED4B06EeuiP60JNw0iiA"/>
|
||||
<bindingTables xmi:id="_95PfvnNmEeWBq8z1Dv39LA" bindingContext="_95PfuXNmEeWBq8z1Dv39LA">
|
||||
<bindings xmi:id="_95Pfv3NmEeWBq8z1Dv39LA" elementId="com.minres.scviewer.e4.application.keybinding.quit" keySequence="M1+Q" command="_95PfvHNmEeWBq8z1Dv39LA">
|
||||
<tags>type:user</tags>
|
||||
@ -226,6 +203,10 @@
|
||||
<children xsi:type="menu:HandledMenuItem" xmi:id="_Vj4jUHXIEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.handledmenuitem.remove" label="Remove" iconURI="platform:/plugin/com.minres.scviewer.e4.application/icons/cross.png" tooltip="Remove stream/waveform from list" command="_WUZ2wHXHEeWwZ-9vrAR2UQ">
|
||||
<visibleWhen xsi:type="ui:CoreExpression" xmi:id="_f6MH0HsCEeWVM_sKoXvptg" coreExpressionId="com.minres.scviewer.e4.application.oneWaveSeleted"/>
|
||||
</children>
|
||||
<children xsi:type="menu:MenuSeparator" xmi:id="_KSB5EBmuEeuiP60JNw0iiA" elementId="com.minres.scviewer.e4.application.menuseparator.0"/>
|
||||
<children xsi:type="menu:HandledMenuItem" xmi:id="_HOLGgBmuEeuiP60JNw0iiA" elementId="com.minres.scviewer.e4.application.handledmenuitem.search" label="Search Tx..." iconURI="platform:/plugin/com.minres.scviewer.e4.application/icons/find.png" command="_XDxTYBlEEeuiP60JNw0iiA">
|
||||
<visibleWhen xsi:type="ui:ImperativeExpression" xmi:id="_HOLGgRmuEeuiP60JNw0iiA" contributionURI="bundleclass://com.minres.scviewer.e4.application/com.minres.scviewer.e4.application.handlers.SearchHandler"/>
|
||||
</children>
|
||||
</menus>
|
||||
<menus xsi:type="menu:PopupMenu" xmi:id="_CxJvAHXGEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.popupmenu.wavecontext" label="Wave Menu">
|
||||
<children xsi:type="menu:HandledMenuItem" xmi:id="_7HrlwHXREeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.handledmenuitem.moveup" label="Move up" iconURI="platform:/plugin/com.minres.scviewer.e4.application/icons/up_blue.png" command="_N_sOkHXHEeWwZ-9vrAR2UQ">
|
||||
@ -252,6 +233,9 @@
|
||||
<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>
|
||||
<children xsi:type="menu:HandledMenuItem" xmi:id="_NnJA4BlEEeuiP60JNw0iiA" elementId="com.minres.scviewer.e4.application.handledmenuitem.search" label="Search Tx..." iconURI="platform:/plugin/com.minres.scviewer.e4.application/icons/find.png" command="_XDxTYBlEEeuiP60JNw0iiA">
|
||||
<visibleWhen xsi:type="ui:ImperativeExpression" xmi:id="_Se1voBlEEeuiP60JNw0iiA" contributionURI="bundleclass://com.minres.scviewer.e4.application/com.minres.scviewer.e4.application.handlers.SearchHandler"/>
|
||||
</children>
|
||||
</menus>
|
||||
</descriptors>
|
||||
<commands xmi:id="_95PfvHNmEeWBq8z1Dv39LA" elementId="org.eclipse.ui.file.exit" commandName="Quit Command"/>
|
||||
@ -293,6 +277,9 @@
|
||||
<parameters xmi:id="_4C_asc3ZEei6rfTGo88R-w" elementId="com.minres.scviewer.e4.application.commandparameter.changevaluedisplay" name="Type" optional="false"/>
|
||||
</commands>
|
||||
<commands xmi:id="_uyeyYGtTEeqmlpoaaMHoiw" elementId="com.minres.scviewer.e4.application.command.enablehover" commandName="Enable hover" description="Enable hover window in waveform"/>
|
||||
<commands xmi:id="_srACsBkREeudD5MqrWoETQ" elementId="com.minres.scviewer.e4.application.reload" commandName="Reload Command"/>
|
||||
<commands xmi:id="_XDxTYBlEEeuiP60JNw0iiA" elementId="com.minres.scviewer.e4.application.txSearch" commandName="Search Command"/>
|
||||
<commands xmi:id="_-9ED4B06EeuiP60JNw0iiA" elementId="com.minres.scviewer.e4.application.command.update" commandName="Update"/>
|
||||
<addons xmi:id="_95PfsnNmEeWBq8z1Dv39LA" elementId="org.eclipse.e4.core.commands.service" contributionURI="bundleclass://org.eclipse.e4.core.commands/org.eclipse.e4.core.commands.CommandServiceAddon"/>
|
||||
<addons xmi:id="_95Pfs3NmEeWBq8z1Dv39LA" elementId="org.eclipse.e4.ui.contexts.service" contributionURI="bundleclass://org.eclipse.e4.ui.services/org.eclipse.e4.ui.services.ContextServiceAddon"/>
|
||||
<addons xmi:id="_95PftHNmEeWBq8z1Dv39LA" elementId="org.eclipse.e4.ui.bindings.service" contributionURI="bundleclass://org.eclipse.e4.ui.bindings/org.eclipse.e4.ui.bindings.BindingServiceAddon"/>
|
||||
|
@ -2,7 +2,7 @@ Manifest-Version: 1.0
|
||||
Bundle-ManifestVersion: 2
|
||||
Bundle-Name: %Bundle-Name
|
||||
Bundle-SymbolicName: com.minres.scviewer.e4.application;singleton:=true
|
||||
Bundle-Version: 2.6.0.qualifier
|
||||
Bundle-Version: 2.9.2.qualifier
|
||||
Bundle-Vendor: %Bundle-Vendor
|
||||
Require-Bundle: javax.inject;bundle-version="1.0.0",
|
||||
org.eclipse.core.runtime;bundle-version="3.11.1",
|
||||
@ -15,7 +15,6 @@ Require-Bundle: javax.inject;bundle-version="1.0.0",
|
||||
org.eclipse.e4.ui.di;bundle-version="1.1.0",
|
||||
org.eclipse.e4.core.contexts;bundle-version="1.4.0",
|
||||
com.minres.scviewer.database.ui.swt;bundle-version="1.0.0",
|
||||
com.minres.scviewer.database.ui,
|
||||
com.minres.scviewer.database;bundle-version="1.0.0",
|
||||
org.eclipse.osgi.services;bundle-version="3.5.0",
|
||||
org.eclipse.e4.core.services;bundle-version="2.0.0",
|
||||
@ -26,12 +25,17 @@ Require-Bundle: javax.inject;bundle-version="1.0.0",
|
||||
org.eclipse.equinox.preferences,
|
||||
org.eclipse.core.expressions,
|
||||
org.eclipse.e4.core.commands;bundle-version="0.11.0",
|
||||
org.eclipse.e4.ui.workbench.addons.swt,
|
||||
com.opcoach.e4.preferences,
|
||||
org.eclipse.e4.core.di.extensions,
|
||||
org.eclipse.e4.ui.css.swt.theme;bundle-version="0.10.0",
|
||||
org.eclipse.core.resources;bundle-version="3.13.0",
|
||||
com.opcoach.e4.preferences.mainmenu;bundle-version="1.2.0"
|
||||
javax.annotation;bundle-version="1.2.0",
|
||||
org.eclipse.core.databinding,
|
||||
org.eclipse.jface.databinding,
|
||||
org.eclipse.equinox.p2.core;bundle-version="2.6.300",
|
||||
org.eclipse.equinox.p2.engine;bundle-version="2.6.600",
|
||||
org.eclipse.equinox.p2.operations;bundle-version="2.5.700",
|
||||
org.eclipse.equinox.p2.metadata.repository;bundle-version="1.3.400"
|
||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
|
||||
Import-Package: com.minres.scviewer.database,
|
||||
javax.inject;version="1.0.0"
|
||||
|
Binary file not shown.
After Width: | Height: | Size: 770 B |
BIN
plugins/com.minres.scviewer.e4.application/icons/find.png
Executable file
BIN
plugins/com.minres.scviewer.e4.application/icons/find.png
Executable file
Binary file not shown.
After Width: | Height: | Size: 659 B |
@ -22,6 +22,27 @@
|
||||
</property>
|
||||
</product>
|
||||
</extension>
|
||||
<extension
|
||||
id="product_slim"
|
||||
point="org.eclipse.core.runtime.products">
|
||||
<product
|
||||
application="org.eclipse.e4.ui.workbench.swt.E4Application"
|
||||
description="%product.description"
|
||||
name="SCViewer">
|
||||
<property
|
||||
name="lifeCycleURI"
|
||||
value="bundleclass://com.minres.scviewer.e4.application/com.minres.scviewer.e4.application.E4LifeCycle">
|
||||
</property>
|
||||
<property
|
||||
name="appName"
|
||||
value="SCViewer">
|
||||
</property>
|
||||
<property
|
||||
name="applicationCSS"
|
||||
value="platform:/plugin/com.minres.scviewer.e4.application/css/default.css">
|
||||
</property>
|
||||
</product>
|
||||
</extension>
|
||||
<extension
|
||||
point="org.eclipse.core.expressions.definitions">
|
||||
<definition
|
||||
@ -84,12 +105,5 @@
|
||||
category="com.minres.scviewer.e4.application.preferences.scviewer">
|
||||
</page>
|
||||
</extension>
|
||||
<extension
|
||||
point="com.opcoach.e4.preferences.e4PreferenceStoreProvider">
|
||||
<preferenceStoreProvider
|
||||
class="bundleclass://com.minres.scviewer.e4.application/com.minres.scviewer.e4.application.preferences.PreferencesStoreProvider"
|
||||
pluginId="com.minres.scviewer.e4.application">
|
||||
</preferenceStoreProvider>
|
||||
</extension>
|
||||
|
||||
</plugin>
|
||||
|
@ -1,7 +1,7 @@
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>com.minres.scviewer.e4.application</artifactId>
|
||||
<version>2.6.0-SNAPSHOT</version>
|
||||
<version>2.9.2-SNAPSHOT</version>
|
||||
<parent>
|
||||
<groupId>com.minres.scviewer</groupId>
|
||||
<artifactId>com.minres.scviewer.parent</artifactId>
|
||||
|
@ -10,14 +10,11 @@
|
||||
*******************************************************************************/
|
||||
package com.minres.scviewer.e4.application;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.inject.Inject;
|
||||
|
||||
import org.eclipse.core.runtime.Platform;
|
||||
import org.eclipse.e4.core.contexts.ContextInjectionFactory;
|
||||
import org.eclipse.e4.core.contexts.IEclipseContext;
|
||||
import org.eclipse.e4.core.services.events.IEventBroker;
|
||||
import org.eclipse.e4.ui.model.application.MApplication;
|
||||
@ -64,9 +61,11 @@ public class E4LifeCycle {
|
||||
* @param eventBroker the event broker
|
||||
*/
|
||||
@PostContextCreate
|
||||
void postContextCreate(IApplicationContext appContext, final IEventBroker eventBroker) {
|
||||
void postContextCreate(IApplicationContext appContext, final IEventBroker eventBroker,
|
||||
final IEclipseContext workbenchContext) {
|
||||
|
||||
final String[] args = (String[])appContext.getArguments().get(IApplicationContext.APPLICATION_ARGS);
|
||||
Options opt = new Options(args, 0, 1);
|
||||
final Options opt = new Options(args, 0, Integer.MAX_VALUE);
|
||||
opt.getSet()
|
||||
.addOption("clearPersistedState", Multiplicity.ZERO_OR_ONE)
|
||||
.addOption("c", Separator.BLANK, Multiplicity.ZERO_OR_ONE);
|
||||
@ -77,22 +76,14 @@ public class E4LifeCycle {
|
||||
final String confFile =opt.getSet().isSet("c")?opt.getSet().getOption("c").getResultValue(0):"";
|
||||
|
||||
// react on the first view being created, at that time the UI is available
|
||||
eventBroker.subscribe(UIEvents.UILifeCycle.ACTIVATE, new EventHandler() {
|
||||
@Override
|
||||
public void handleEvent(Event event) {
|
||||
MPart part = (MPart) event.getProperty("ChangedElement"); //$NON-NLS-1$
|
||||
if(part!=null){
|
||||
IEclipseContext ctx = part.getContext();
|
||||
OpenViewHandler openViewHandler= new OpenViewHandler();
|
||||
if(confFile.length()>0) openViewHandler.setConfigFile(confFile);
|
||||
ContextInjectionFactory.inject(openViewHandler, ctx);
|
||||
eventBroker.unsubscribe(this);
|
||||
for(String name:opt.getSet().getData()){
|
||||
openViewHandler.openViewForFile(name);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
// eventBroker.subscribe(UIEvents.UILifeCycle.ACTIVATE, new EventHandler() {
|
||||
// @Override
|
||||
// public void handleEvent(Event event) {
|
||||
// MPart part = (MPart) event.getProperty("ChangedElement"); //$NON-NLS-1$
|
||||
// if(part!=null){
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
eventBroker.subscribe(UIEvents.UILifeCycle.APP_STARTUP_COMPLETE, new EventHandler() {
|
||||
@Override
|
||||
public void handleEvent(Event event) {
|
||||
@ -101,9 +92,20 @@ public class E4LifeCycle {
|
||||
boolean isLocked = instanceLocation.isLocked();
|
||||
if(isLocked)
|
||||
instanceLocation.release();
|
||||
} catch (IOException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
} catch (IOException e) { }
|
||||
if(opt.getSet().getData().size()>0) {
|
||||
MApplication app= workbenchContext.get(MApplication.class);
|
||||
EModelService modelService = workbenchContext.get(EModelService.class);
|
||||
EPartService partService= workbenchContext.get(EPartService.class);
|
||||
MPart part = partService .createPart("com.minres.scviewer.e4.application.partdescriptor.waveformviewer"); //$NON-NLS-1$
|
||||
part.setLabel(opt.getSet().getData().get(0));
|
||||
MPartStack partStack = (MPartStack)modelService.find("org.eclipse.editorss", app); //$NON-NLS-1$
|
||||
partStack.getChildren().add(part);
|
||||
partService.showPart(part, PartState.CREATE);
|
||||
partService.showPart(part, PartState.ACTIVATE);
|
||||
IEclipseContext ctx = part.getContext();
|
||||
ctx.modify("input", opt.getSet().getData());
|
||||
ctx.modify("config", confFile); //$NON-NLS-1$
|
||||
}
|
||||
}
|
||||
});
|
||||
@ -135,70 +137,4 @@ public class E4LifeCycle {
|
||||
@ProcessRemovals
|
||||
void processRemovals(IEclipseContext workbenchContext) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Join.
|
||||
*
|
||||
* @param tokens the tokens
|
||||
* @return the string
|
||||
*/
|
||||
String join(String[] tokens){
|
||||
StringBuilder sb = new StringBuilder();
|
||||
boolean first=true;
|
||||
for(String token:tokens){
|
||||
if(!first) sb.append(","); //$NON-NLS-1$
|
||||
sb.append(token);
|
||||
first=false;
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* The Class OpenViewHandler.
|
||||
*/
|
||||
private class OpenViewHandler {
|
||||
|
||||
/** The app. */
|
||||
@Inject MApplication app;
|
||||
|
||||
/** The model service. */
|
||||
@Inject EModelService modelService;
|
||||
|
||||
/** The part service. */
|
||||
@Inject EPartService partService;
|
||||
|
||||
String confFile="";
|
||||
/**
|
||||
* Open view for file.
|
||||
*
|
||||
* @param name the name
|
||||
*/
|
||||
public void openViewForFile(String name){
|
||||
File file = new File(getFirstFileName(name));
|
||||
if(!file.exists())
|
||||
return;
|
||||
MPart part = partService.createPart("com.minres.scviewer.e4.application.partdescriptor.waveformviewer"); //$NON-NLS-1$
|
||||
part.setLabel(file.getName());
|
||||
MPartStack partStack = (MPartStack)modelService.find("org.eclipse.editorss", app); //$NON-NLS-1$
|
||||
partStack.getChildren().add(part);
|
||||
partService.showPart(part, PartState.ACTIVATE);
|
||||
IEclipseContext ctx=part.getContext();
|
||||
ctx.modify("input", name); //$NON-NLS-1$
|
||||
//ctx.declareModifiable("input"); //$NON-NLS-1$
|
||||
ctx.modify("config", confFile); //$NON-NLS-1$
|
||||
//ctx.declareModifiable("config"); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
private String getFirstFileName(String name) {
|
||||
if(name.contains(",")) {
|
||||
String[] tokens = name.split(",");
|
||||
return tokens[0];
|
||||
} else
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setConfigFile(String confFile) {
|
||||
this.confFile=confFile;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -41,6 +41,7 @@ public class Messages extends NLS {
|
||||
public static String TransactionDetails_21;
|
||||
public static String TransactionDetails_3;
|
||||
public static String TransactionDetails_4;
|
||||
public static String WaveformPreferencesPage_description;
|
||||
public static String WaveformPreferencesPage_1;
|
||||
public static String WaveformViewer_13;
|
||||
public static String WaveformViewer_14;
|
||||
@ -61,6 +62,30 @@ public class Messages extends NLS {
|
||||
public static String WaveStatusBarControl_6;
|
||||
public static String WaveStatusBarControl_7;
|
||||
public static String WaveStatusBarControl_8;
|
||||
public static String line;
|
||||
public static String line_highlite;
|
||||
public static String track_bg_even;
|
||||
public static String track_bg_odd;
|
||||
public static String track_bg_highlite;
|
||||
public static String tx_bg;
|
||||
public static String tx_bg_highlite;
|
||||
public static String tx_border;
|
||||
public static String signal0;
|
||||
public static String signal1;
|
||||
public static String signalz;
|
||||
public static String signalx;
|
||||
public static String signalu;
|
||||
public static String signal_text;
|
||||
public static String signal_real;
|
||||
public static String signal_nan;
|
||||
public static String cursor;
|
||||
public static String cursor_drag;
|
||||
public static String cursor_text;
|
||||
public static String marker;
|
||||
public static String marker_text;
|
||||
public static String rel_arrow;
|
||||
public static String rel_arrow_highlite;
|
||||
|
||||
static {
|
||||
// initialize resource bundle
|
||||
NLS.initializeMessages(BUNDLE_NAME, Messages.class);
|
||||
|
@ -123,7 +123,7 @@ public class RelationTypeToolControl extends PartListener implements ISelectionC
|
||||
return;
|
||||
}
|
||||
}
|
||||
comboViewer.getCombo().setEnabled(false);
|
||||
if(comboViewer!=null) comboViewer.getCombo().setEnabled(false);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
|
@ -1,7 +1,6 @@
|
||||
|
||||
package com.minres.scviewer.e4.application.elements;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import javax.inject.Inject;
|
||||
@ -34,22 +33,46 @@ public class WaveformPopupMenuContribution {
|
||||
|
||||
final TrackEntry nullEntry = new TrackEntry(null);
|
||||
|
||||
private boolean selHasBitVector(ISelection sel, boolean checkForDouble) {
|
||||
if(!sel.isEmpty() && sel instanceof IStructuredSelection) {
|
||||
for(Object elem:(IStructuredSelection)sel) {
|
||||
if(elem instanceof TrackEntry) {
|
||||
TrackEntry e = (TrackEntry) elem;
|
||||
if(e.waveform instanceof ISignal<?>) {
|
||||
Object o = ((ISignal<?>) e.waveform).getEvents().firstEntry().getValue();
|
||||
if(checkForDouble && o instanceof Double)
|
||||
return true;
|
||||
else if(o instanceof BitVector && ((BitVector)o).getWidth()>1)
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private TrackEntry getSingleTrackEntry(ISelection sel) {
|
||||
TrackEntry entry=null;
|
||||
if(!sel.isEmpty() && sel instanceof IStructuredSelection) {
|
||||
for(Object elem:(IStructuredSelection)sel) {
|
||||
if(elem instanceof TrackEntry) {
|
||||
if(entry != null)
|
||||
return null;
|
||||
entry = (TrackEntry) elem;
|
||||
}
|
||||
}
|
||||
}
|
||||
return entry;
|
||||
}
|
||||
|
||||
@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<?>) {
|
||||
Object x = ((ISignal<?>) selected).getEvents().firstEntry().getValue();
|
||||
if((x instanceof BitVector) && ((BitVector)x).getWidth()==1) {
|
||||
return false;
|
||||
} else
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return selHasBitVector(wfv.getSelection(), true);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@ -60,39 +83,24 @@ public class WaveformPopupMenuContribution {
|
||||
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<?>) {
|
||||
Object o = ((ISignal<?>) first).getEvents().firstEntry().getValue();
|
||||
//com.minres.scviewer.e4.application.menu.mulitvaluesettings
|
||||
if((o instanceof Double) || (o instanceof BitVector)) {
|
||||
TrackEntry entry=nullEntry;
|
||||
if(second instanceof TrackEntry)
|
||||
entry=(TrackEntry)second;
|
||||
if(o instanceof BitVector) {
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
TrackEntry elem = getSingleTrackEntry(sel);
|
||||
if(selHasBitVector(sel, false)) {
|
||||
addValueMenuItem(items, application, modelService, "hex", TrackEntry.ValueDisplay.DEFAULT, elem);
|
||||
addValueMenuItem(items, application, modelService, "unsigned", TrackEntry.ValueDisplay.UNSIGNED, elem);
|
||||
addValueMenuItem(items, application, modelService, "signed", TrackEntry.ValueDisplay.SIGNED, elem);
|
||||
items.add(MMenuFactory.INSTANCE.createMenuSeparator());
|
||||
addWaveMenuItem(items, application, modelService, "bit vector", TrackEntry.WaveDisplay.DEFAULT, elem);
|
||||
}
|
||||
addWaveMenuItem(items, application, modelService, "analog step-wise", TrackEntry.WaveDisplay.STEP_WISE, elem);
|
||||
addWaveMenuItem(items, application, modelService, "analog continous", TrackEntry.WaveDisplay.CONTINOUS, elem);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void addValueMenuItem(List<MMenuElement> items, MApplication application, EModelService modelService,
|
||||
String label, TrackEntry.ValueDisplay value, TrackEntry.ValueDisplay actual) {
|
||||
String label, TrackEntry.ValueDisplay value, TrackEntry elem) {
|
||||
MHandledMenuItem item = MMenuFactory.INSTANCE.createHandledMenuItem();
|
||||
item.setType(ItemType.RADIO);
|
||||
item.setSelected(value==actual);
|
||||
item.setSelected(elem != null && elem.valueDisplay == value);
|
||||
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);
|
||||
@ -106,10 +114,10 @@ public class WaveformPopupMenuContribution {
|
||||
}
|
||||
|
||||
private void addWaveMenuItem(List<MMenuElement> items, MApplication application, EModelService modelService,
|
||||
String label, TrackEntry.WaveDisplay value, TrackEntry.WaveDisplay actual) {
|
||||
String label, TrackEntry.WaveDisplay value, TrackEntry elem) {
|
||||
MHandledMenuItem item = MMenuFactory.INSTANCE.createHandledMenuItem();
|
||||
item.setType(ItemType.RADIO);
|
||||
item.setSelected(value==actual);
|
||||
item.setSelected(elem != null && elem.waveDisplay==value);
|
||||
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);
|
||||
|
@ -1,8 +1,6 @@
|
||||
|
||||
package com.minres.scviewer.e4.application.handlers;
|
||||
|
||||
import java.util.Iterator;
|
||||
|
||||
import javax.inject.Named;
|
||||
|
||||
import org.eclipse.e4.core.di.annotations.CanExecute;
|
||||
@ -34,18 +32,14 @@ public class ChangeValueDisplay {
|
||||
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();
|
||||
}
|
||||
for(Object elem:(IStructuredSelection)sel) {
|
||||
if(elem instanceof TrackEntry) {
|
||||
TrackEntry.ValueDisplay val= TrackEntry.ValueDisplay.valueOf(param);
|
||||
((TrackEntry)elem).valueDisplay=val;
|
||||
}
|
||||
}
|
||||
wfv.update();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -1,8 +1,6 @@
|
||||
|
||||
package com.minres.scviewer.e4.application.handlers;
|
||||
|
||||
import java.util.Iterator;
|
||||
|
||||
import javax.inject.Named;
|
||||
|
||||
import org.eclipse.e4.core.di.annotations.CanExecute;
|
||||
@ -34,16 +32,13 @@ public class ChangeWaveformDisplay {
|
||||
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();
|
||||
}
|
||||
for(Object elem:(IStructuredSelection)sel) {
|
||||
if(elem instanceof TrackEntry) {
|
||||
TrackEntry.WaveDisplay val= TrackEntry.WaveDisplay.valueOf(param);
|
||||
((TrackEntry)elem).waveDisplay=val;
|
||||
}
|
||||
}
|
||||
wfv.update();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -17,23 +17,30 @@ import org.eclipse.e4.ui.model.application.ui.basic.MPart;
|
||||
import org.eclipse.e4.ui.workbench.modeling.ESelectionService;
|
||||
import org.eclipse.jface.viewers.IStructuredSelection;
|
||||
|
||||
import com.minres.scviewer.database.IWaveform;
|
||||
import com.minres.scviewer.database.ui.TrackEntry;
|
||||
import com.minres.scviewer.e4.application.parts.WaveformViewer;
|
||||
|
||||
public class DeleteWaveformHandler {
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@CanExecute
|
||||
public Boolean canExecute(ESelectionService selectionService){
|
||||
Object o = selectionService.getSelection();
|
||||
return o instanceof IStructuredSelection && ((IStructuredSelection)o).getFirstElement() instanceof IWaveform;
|
||||
if(o instanceof IStructuredSelection) {
|
||||
IStructuredSelection sel = (IStructuredSelection) o;
|
||||
if(sel.size()>0)
|
||||
return sel.toList().stream().allMatch(e-> e instanceof TrackEntry);
|
||||
else
|
||||
return false;
|
||||
} else
|
||||
return false;
|
||||
}
|
||||
|
||||
@Execute
|
||||
public void execute(ESelectionService selectionService, MPart activePart) {
|
||||
Object o = activePart.getObject();
|
||||
Object sel = selectionService.getSelection();
|
||||
if(o instanceof WaveformViewer && ((IStructuredSelection)sel).getFirstElement() instanceof IWaveform){
|
||||
((WaveformViewer)o).removeStreamFromList((IWaveform) ((IStructuredSelection)sel).getFirstElement());
|
||||
if(o instanceof WaveformViewer){
|
||||
((WaveformViewer)o).removeSelectedStreamsFromList();
|
||||
}
|
||||
}
|
||||
}
|
@ -4,45 +4,43 @@ package com.minres.scviewer.e4.application.handlers;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.inject.Inject;
|
||||
|
||||
import org.eclipse.core.runtime.preferences.ConfigurationScope;
|
||||
import org.eclipse.e4.core.contexts.Active;
|
||||
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
|
||||
import org.eclipse.e4.core.di.annotations.Execute;
|
||||
import org.eclipse.e4.core.di.annotations.Optional;
|
||||
import org.eclipse.e4.core.di.extensions.Preference;
|
||||
import org.eclipse.e4.ui.model.application.MApplication;
|
||||
import org.eclipse.e4.ui.model.application.ui.basic.MPart;
|
||||
import org.eclipse.e4.ui.model.application.ui.basic.MWindow;
|
||||
import org.eclipse.e4.ui.model.application.ui.menu.MHandledItem;
|
||||
import org.eclipse.e4.ui.workbench.modeling.EModelService;
|
||||
import org.eclipse.jface.preference.IPreferenceStore;
|
||||
import org.osgi.service.prefs.BackingStoreException;
|
||||
|
||||
import com.minres.scviewer.e4.application.preferences.PreferenceConstants;
|
||||
import com.opcoach.e4.preferences.ScopedPreferenceStore;
|
||||
|
||||
@SuppressWarnings("restriction")
|
||||
public class EnableHover {
|
||||
static final String TAG_NAME = "EnableHover"; //$NON-NLS-1$
|
||||
|
||||
@Inject
|
||||
MApplication application;
|
||||
|
||||
@PostConstruct
|
||||
public void initialize(EModelService modelService) {
|
||||
@Inject
|
||||
@Optional
|
||||
public void reactOnShowHoverChange(EModelService modelService, @Preference(value = PreferenceConstants.SHOW_HOVER) Boolean hover) {
|
||||
List<String> tags = new LinkedList<>();
|
||||
tags.add(TAG_NAME);
|
||||
List<MHandledItem> elements = modelService.findElements(application, null, MHandledItem.class, tags );
|
||||
// cover initialization stuff, sync it with code
|
||||
IPreferenceStore store = new ScopedPreferenceStore(ConfigurationScope.INSTANCE, PreferenceConstants.PREFERENCES_SCOPE);
|
||||
boolean state = store.getBoolean(PreferenceConstants.SHOW_HOVER);
|
||||
for( MHandledItem hi : elements ){
|
||||
hi.setSelected(state);
|
||||
hi.setSelected(hover);
|
||||
}
|
||||
}
|
||||
|
||||
@Execute
|
||||
public void execute(@Active MPart part, @Active MWindow window, MHandledItem handledItem, EModelService modelService ) {
|
||||
IPreferenceStore store = new ScopedPreferenceStore(ConfigurationScope.INSTANCE, PreferenceConstants.PREFERENCES_SCOPE);
|
||||
store.setValue(PreferenceConstants.SHOW_HOVER, handledItem.isSelected());
|
||||
public void execute(MHandledItem handledItem, @Preference(nodePath = PreferenceConstants.PREFERENCES_SCOPE) IEclipsePreferences prefs ) {
|
||||
try {
|
||||
prefs.putBoolean(PreferenceConstants.SHOW_HOVER, handledItem.isSelected());
|
||||
prefs.flush();
|
||||
} catch (BackingStoreException e) {}
|
||||
}
|
||||
|
||||
}
|
@ -22,6 +22,7 @@ import org.eclipse.jface.viewers.IStructuredSelection;
|
||||
|
||||
import com.minres.scviewer.database.ITx;
|
||||
import com.minres.scviewer.database.IWaveform;
|
||||
import com.minres.scviewer.database.ui.TrackEntry;
|
||||
import com.minres.scviewer.e4.application.parts.WaveformViewer;
|
||||
|
||||
public class MoveWaveformHandler {
|
||||
@ -33,7 +34,7 @@ public class MoveWaveformHandler {
|
||||
Object sel = selectionService.getSelection();
|
||||
if( sel instanceof IStructuredSelection) {
|
||||
Object o= ((IStructuredSelection)sel).getFirstElement();
|
||||
return o instanceof IWaveform || o instanceof ITx;
|
||||
return o instanceof IWaveform || o instanceof ITx | o instanceof TrackEntry;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -23,6 +23,7 @@ import org.eclipse.jface.viewers.IStructuredSelection;
|
||||
import com.minres.scviewer.database.ITx;
|
||||
import com.minres.scviewer.database.IWaveform;
|
||||
import com.minres.scviewer.database.ui.GotoDirection;
|
||||
import com.minres.scviewer.database.ui.TrackEntry;
|
||||
import com.minres.scviewer.e4.application.parts.WaveformViewer;
|
||||
|
||||
public class NavigateEvent {
|
||||
@ -34,7 +35,7 @@ public class NavigateEvent {
|
||||
Object sel = selectionService.getSelection();
|
||||
if( sel instanceof IStructuredSelection) {
|
||||
Object o= ((IStructuredSelection)sel).getFirstElement();
|
||||
return o instanceof IWaveform || o instanceof ITx;
|
||||
return o instanceof IWaveform || o instanceof ITx || o instanceof TrackEntry;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -11,6 +11,7 @@
|
||||
package com.minres.scviewer.e4.application.handlers;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.e4.core.contexts.IEclipseContext;
|
||||
@ -39,13 +40,14 @@ public class OpenHandler {
|
||||
part.setLabel(files.get(0).getName());
|
||||
MPartStack partStack = (MPartStack)modelService.find("org.eclipse.editorss", app); //$NON-NLS-1$
|
||||
partStack.getChildren().add(part);
|
||||
partService.showPart(part, PartState.ACTIVATE);
|
||||
partService.showPart(part, PartState.CREATE);
|
||||
final IEclipseContext ctx=part.getContext();
|
||||
files.stream()
|
||||
.map(x -> x.getAbsolutePath())
|
||||
.reduce((s1, s2) -> s1 + "," + s2)
|
||||
.ifPresent(s -> ctx.modify("input", s)); //$NON-NLS-1$
|
||||
ctx.modify("config", ""); //$NON-NLS-1$
|
||||
List<String> inputs=new ArrayList<>();
|
||||
for(File f: files)
|
||||
inputs.add(f.getAbsolutePath());
|
||||
ctx.modify("input", inputs);
|
||||
ctx.modify("config", ""); //$NON-NLS-1$
|
||||
partStack.setSelectedElement(part);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,42 @@
|
||||
/*******************************************************************************
|
||||
* 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.e4.application.handlers;
|
||||
|
||||
import org.eclipse.e4.core.di.annotations.CanExecute;
|
||||
import org.eclipse.e4.core.di.annotations.Execute;
|
||||
import org.eclipse.e4.ui.model.application.MApplication;
|
||||
import org.eclipse.e4.ui.model.application.ui.basic.MPart;
|
||||
import org.eclipse.e4.ui.workbench.modeling.EModelService;
|
||||
import org.eclipse.e4.ui.workbench.modeling.EPartService;
|
||||
import org.eclipse.swt.widgets.Shell;
|
||||
|
||||
import com.minres.scviewer.e4.application.parts.WaveformViewer;
|
||||
public class ReloadHandler {
|
||||
|
||||
@CanExecute
|
||||
public boolean canExecute(EPartService partService) {
|
||||
MPart part = partService.getActivePart();
|
||||
if(part==null) return false;
|
||||
return (part.getObject() instanceof WaveformViewer);
|
||||
}
|
||||
|
||||
@Execute
|
||||
public void execute(Shell shell, MApplication app, EModelService modelService,
|
||||
EPartService partService){
|
||||
|
||||
MPart part = partService.getActivePart();
|
||||
Object obj = part.getObject();
|
||||
if(part!=null && (obj instanceof WaveformViewer)) {
|
||||
((WaveformViewer)obj).reloadDatabase();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,62 @@
|
||||
/*******************************************************************************
|
||||
* 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.e4.application.handlers;
|
||||
|
||||
import org.eclipse.e4.core.di.annotations.Evaluate;
|
||||
import org.eclipse.e4.core.di.annotations.Execute;
|
||||
import org.eclipse.e4.ui.model.application.ui.basic.MPart;
|
||||
import org.eclipse.jface.viewers.ISelection;
|
||||
import org.eclipse.jface.viewers.StructuredSelection;
|
||||
import org.eclipse.swt.widgets.Shell;
|
||||
|
||||
import com.minres.scviewer.database.ui.TrackEntry;
|
||||
import com.minres.scviewer.e4.application.parts.WaveformViewer;
|
||||
public class SearchHandler {
|
||||
|
||||
@Evaluate
|
||||
public boolean evaluate(MPart activePart) {
|
||||
Object obj = activePart.getObject();
|
||||
if(obj instanceof WaveformViewer){
|
||||
WaveformViewer wfv = (WaveformViewer)obj;
|
||||
ISelection sel = wfv.getSelection();
|
||||
if(sel instanceof StructuredSelection) {
|
||||
Object[] elem = ((StructuredSelection)sel).toArray();
|
||||
if(elem.length ==0) return false;
|
||||
TrackEntry e = findTrackEntry(elem);
|
||||
return e!=null && e.isStream();
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Execute
|
||||
public void execute(Shell shell, MPart activePart){
|
||||
Object obj = activePart.getObject();
|
||||
if(obj instanceof WaveformViewer){
|
||||
WaveformViewer wfv = (WaveformViewer)obj;
|
||||
wfv.showSearch();
|
||||
// ISelection sel = wfv.getSelection();
|
||||
// if(sel instanceof StructuredSelection) {
|
||||
// TrackEntry e = findTrackEntry(((StructuredSelection)sel).toArray());
|
||||
// SearchTxDialog dlg = new SearchTxDialog(shell, e.getStream());
|
||||
// if (dlg.open() != Window.OK) return;
|
||||
// wfv.search(dlg.getPropName(), dlg.getPropType(), dlg.getPropValue());
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
private TrackEntry findTrackEntry(Object[] elems) {
|
||||
for(Object o: elems)
|
||||
if(o instanceof TrackEntry)
|
||||
return (TrackEntry)o;
|
||||
return null;
|
||||
}
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
|
||||
package com.minres.scviewer.e4.application.handlers;
|
||||
|
||||
import org.eclipse.core.runtime.IStatus;
|
||||
import org.eclipse.e4.core.di.annotations.Execute;
|
||||
import org.eclipse.e4.ui.di.UISynchronize;
|
||||
import org.eclipse.e4.ui.workbench.IWorkbench;
|
||||
import org.eclipse.equinox.p2.core.IProvisioningAgent;
|
||||
import org.eclipse.equinox.p2.operations.ProvisioningSession;
|
||||
import org.eclipse.equinox.p2.operations.UpdateOperation;
|
||||
import org.eclipse.jface.dialogs.MessageDialog;
|
||||
|
||||
public class UpdateHandler {
|
||||
@Execute
|
||||
public void execute(IProvisioningAgent agent, UISynchronize synchronize, IWorkbench workbench) {
|
||||
ProvisioningSession session = new ProvisioningSession(agent);
|
||||
UpdateOperation operation = new UpdateOperation(session);
|
||||
IStatus status = operation.resolveModal(null);
|
||||
if(status.getCode() == UpdateOperation.STATUS_NOTHING_TO_UPDATE) {
|
||||
MessageDialog.openInformation(null, "Information", "Nothing to update");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -26,14 +26,10 @@ import org.eclipse.e4.ui.di.UISynchronize;
|
||||
import org.eclipse.e4.ui.model.application.ui.menu.MToolControl;
|
||||
import org.eclipse.e4.ui.workbench.modeling.EModelService;
|
||||
import org.eclipse.jface.action.StatusLineManager;
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.widgets.Composite;
|
||||
import org.eclipse.swt.widgets.Label;
|
||||
import org.eclipse.swt.widgets.ProgressBar;
|
||||
import org.osgi.service.prefs.PreferencesService;
|
||||
|
||||
import com.minres.scviewer.e4.application.AppModelId;
|
||||
import com.minres.scviewer.e4.application.Messages;
|
||||
|
||||
/**
|
||||
* The Class StatusBarControl.
|
||||
@ -58,9 +54,6 @@ public class StatusBarControl {
|
||||
/** The monitor. */
|
||||
private SyncedProgressMonitor monitor;
|
||||
|
||||
/** The progress bar. */
|
||||
private ProgressBar progressBar;
|
||||
|
||||
/**
|
||||
* Instantiates a new status bar control.
|
||||
*
|
||||
@ -84,9 +77,7 @@ public class StatusBarControl {
|
||||
if (toolControl.getElementId().equals(AppModelId.TOOLCONTROL_ORG_ECLIPSE_UI_STATUSLINE)) { //$NON-NLS-1$
|
||||
createStatusLine(parent, toolControl);
|
||||
} else if (toolControl.getElementId().equals(AppModelId.TOOLCONTROL_ORG_ECLIPSE_UI_HEAPSTATUS)) { //$NON-NLS-1$
|
||||
createHeapStatus(parent, toolControl);
|
||||
} else if (toolControl.getElementId().equals(AppModelId.TOOLCONTROL_ORG_ECLIPSE_UI_PROGRESSBAR)) { //$NON-NLS-1$
|
||||
createProgressBar(parent, toolControl);
|
||||
new HeapStatus(parent, osgiPreverences.getSystemPreferences());
|
||||
}
|
||||
}
|
||||
|
||||
@ -101,36 +92,6 @@ public class StatusBarControl {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates the progress bar.
|
||||
*
|
||||
* @param parent the parent
|
||||
* @param toolControl the tool control
|
||||
*/
|
||||
private void createProgressBar(Composite parent, MToolControl toolControl) {
|
||||
new Label(parent, SWT.NONE);
|
||||
progressBar = new ProgressBar(parent, SWT.SMOOTH);
|
||||
progressBar.setBounds(100, 10, 200, 20);
|
||||
new Label(parent, SWT.NONE);
|
||||
monitor=new SyncedProgressMonitor(progressBar);
|
||||
Job.getJobManager().setProgressProvider(new ProgressProvider() {
|
||||
@Override
|
||||
public IProgressMonitor createMonitor(Job job) {
|
||||
return monitor.addJob(job);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates the heap status.
|
||||
*
|
||||
* @param parent the parent
|
||||
* @param toolControl the tool control
|
||||
*/
|
||||
private void createHeapStatus(Composite parent, MToolControl toolControl) {
|
||||
new HeapStatus(parent, osgiPreverences.getSystemPreferences());
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates the status line.
|
||||
*
|
||||
@ -140,6 +101,14 @@ public class StatusBarControl {
|
||||
private void createStatusLine(Composite parent, MToolControl toolControl) {
|
||||
// IEclipseContext context = modelService.getContainingContext(toolControl);
|
||||
manager.createControl(parent);
|
||||
monitor=new SyncedProgressMonitor(manager.getProgressMonitor());
|
||||
Job.getJobManager().setProgressProvider(new ProgressProvider() {
|
||||
@Override
|
||||
public IProgressMonitor createMonitor(Job job) {
|
||||
return monitor.addJob(job);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@ -160,25 +129,17 @@ public class StatusBarControl {
|
||||
*/
|
||||
private final class SyncedProgressMonitor extends NullProgressMonitor {
|
||||
|
||||
// thread-Safe via thread confinement of the UI-Thread
|
||||
/** The running tasks. */
|
||||
// (means access only via UI-Thread)
|
||||
private long runningTasks = 0L;
|
||||
|
||||
/** The progress bar. */
|
||||
private ProgressBar progressBar;
|
||||
private IProgressMonitor progressBar;
|
||||
|
||||
/**
|
||||
* Instantiates a new synced progress monitor.
|
||||
*
|
||||
* @param progressBar the progress bar
|
||||
* @param iProgressMonitor the progress bar
|
||||
*/
|
||||
public SyncedProgressMonitor(ProgressBar progressBar) {
|
||||
public SyncedProgressMonitor(IProgressMonitor iProgressMonitor) {
|
||||
super();
|
||||
this.progressBar = progressBar;
|
||||
runningTasks=0;
|
||||
progressBar.setSelection(0);
|
||||
progressBar.setEnabled(false);
|
||||
this.progressBar = iProgressMonitor;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
@ -189,13 +150,41 @@ public class StatusBarControl {
|
||||
sync.asyncExec(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
runningTasks++;
|
||||
if(runningTasks == 1) { // --- no task is running at the moment ---
|
||||
progressBar.setEnabled(true);
|
||||
progressBar.setSelection(0);
|
||||
}
|
||||
progressBar.setMaximum(totalWork);
|
||||
progressBar.setToolTipText(Messages.StatusBarControl_1 + runningTasks + Messages.StatusBarControl_2 + name);
|
||||
progressBar.beginTask(name, totalWork);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* This implementation does nothing.
|
||||
* Subclasses may override this method to do something
|
||||
* with the name of the task.
|
||||
*
|
||||
* @see IProgressMonitor#setTaskName(String)
|
||||
*/
|
||||
@Override
|
||||
public void setTaskName(String name) {
|
||||
sync.asyncExec(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
progressBar.setTaskName(name);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* This implementation does nothing.
|
||||
* Subclasses may override this method to do interesting
|
||||
* processing when a subtask begins.
|
||||
*
|
||||
* @see IProgressMonitor#subTask(String)
|
||||
*/
|
||||
@Override
|
||||
public void subTask(String name) {
|
||||
sync.asyncExec(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
progressBar.subTask(name);
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -208,7 +197,16 @@ public class StatusBarControl {
|
||||
sync.asyncExec(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
progressBar.setSelection(progressBar.getSelection() + work);
|
||||
progressBar.worked(work);
|
||||
}
|
||||
});
|
||||
}
|
||||
@Override
|
||||
public void done() {
|
||||
sync.asyncExec(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
progressBar.done();
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -228,14 +226,8 @@ public class StatusBarControl {
|
||||
@Override
|
||||
public void run() {
|
||||
if(event.getResult()==null) return;
|
||||
if(runningTasks>0) runningTasks--;
|
||||
if (runningTasks > 0){ // --- some tasks are still running ---
|
||||
progressBar.setToolTipText(Messages.StatusBarControl_3 + runningTasks);
|
||||
} else { // --- all tasks are done (a reset of selection could also be done) ---
|
||||
progressBar.setToolTipText(Messages.StatusBarControl_4);
|
||||
progressBar.setSelection(progressBar.getMaximum());
|
||||
progressBar.setEnabled(false);
|
||||
}
|
||||
if(!event.getResult().isOK())
|
||||
progressBar.done();
|
||||
}
|
||||
});
|
||||
// clean-up
|
||||
|
@ -0,0 +1,229 @@
|
||||
package com.minres.scviewer.e4.application.internal.status;
|
||||
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.custom.CLabel;
|
||||
import org.eclipse.swt.events.MouseAdapter;
|
||||
import org.eclipse.swt.events.MouseEvent;
|
||||
import org.eclipse.swt.events.MouseListener;
|
||||
import org.eclipse.swt.graphics.GC;
|
||||
import org.eclipse.swt.graphics.Image;
|
||||
import org.eclipse.swt.widgets.Composite;
|
||||
import org.eclipse.swt.widgets.Display;
|
||||
import org.eclipse.swt.widgets.Label;
|
||||
|
||||
import org.eclipse.jface.action.ContributionItem;
|
||||
import org.eclipse.jface.action.IAction;
|
||||
import org.eclipse.jface.action.StatusLineLayoutData;
|
||||
import org.eclipse.jface.resource.JFaceColors;
|
||||
|
||||
|
||||
/**
|
||||
* Contribution item for the status line.
|
||||
* @since 2.0
|
||||
*/
|
||||
public class StatusLineContributionItem extends ContributionItem {
|
||||
|
||||
/**
|
||||
* Internal mouse listener to track double clicking the status line item.
|
||||
* @since 3.0
|
||||
*/
|
||||
private class Listener extends MouseAdapter {
|
||||
@Override
|
||||
public void mouseDoubleClick(MouseEvent e) {
|
||||
if (fActionHandler != null && fActionHandler.isEnabled())
|
||||
fActionHandler.run();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Left and right margin used in CLabel.
|
||||
* @since 2.1
|
||||
*/
|
||||
private static final int INDENT= 3;
|
||||
/**
|
||||
* Default number of characters that should fit into the item.
|
||||
* @since 3.0
|
||||
*/
|
||||
static final int DEFAULT_WIDTH_IN_CHARS = 19;
|
||||
/**
|
||||
* Pre-computed label width hint.
|
||||
* @since 2.1
|
||||
*/
|
||||
private int fFixedWidth= -1;
|
||||
/**
|
||||
* Pre-computed label height hint.
|
||||
* @since 3.0
|
||||
*/
|
||||
private int fFixedHeight= -1;
|
||||
/** The text */
|
||||
private String fText;
|
||||
/** The image */
|
||||
private Image fImage;
|
||||
/**
|
||||
* The error text.
|
||||
* @since 3.0
|
||||
*/
|
||||
private String fErrorText;
|
||||
/**
|
||||
* The error image.
|
||||
* @since 3.0
|
||||
*/
|
||||
private Image fErrorImage;
|
||||
/**
|
||||
* The tool tip text.
|
||||
* @since 3.0
|
||||
*/
|
||||
private String fToolTipText;
|
||||
/**
|
||||
* Number of characters that should fit into the item.
|
||||
* @since 3.0
|
||||
*/
|
||||
private int fWidthInChars;
|
||||
/** The status line label widget */
|
||||
private CLabel fLabel;
|
||||
/**
|
||||
* The action handler.
|
||||
* @since 3.0
|
||||
*/
|
||||
private IAction fActionHandler;
|
||||
/**
|
||||
* The mouse listener
|
||||
* @since 3.0
|
||||
*/
|
||||
private MouseListener fMouseListener;
|
||||
|
||||
|
||||
/**
|
||||
* Creates a new item with the given attributes.
|
||||
*
|
||||
* @param id the item's id
|
||||
* @param visible the visibility of this item
|
||||
* @param widthInChars the width in characters
|
||||
* @since 3.0
|
||||
*/
|
||||
public StatusLineContributionItem(String id, boolean visible, int widthInChars) {
|
||||
super(id);
|
||||
setVisible(visible);
|
||||
fWidthInChars= widthInChars;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fill(Composite parent) {
|
||||
|
||||
Label sep= new Label(parent, SWT.SEPARATOR);
|
||||
CLabel label=new CLabel(parent, SWT.SHADOW_NONE);
|
||||
label.setText(getId());
|
||||
fLabel= new CLabel(parent, SWT.SHADOW_IN);
|
||||
fLabel.setAlignment(SWT.RIGHT);
|
||||
|
||||
fLabel.addDisposeListener(e -> fMouseListener = null);
|
||||
if (fActionHandler != null) {
|
||||
fMouseListener= new Listener();
|
||||
fLabel.addMouseListener(fMouseListener);
|
||||
}
|
||||
|
||||
StatusLineLayoutData data= new StatusLineLayoutData();
|
||||
data.widthHint= getWidthHint(parent);
|
||||
fLabel.setLayoutData(data);
|
||||
|
||||
data= new StatusLineLayoutData();
|
||||
data.heightHint= getHeightHint(parent);
|
||||
sep.setLayoutData(data);
|
||||
|
||||
updateMessageLabel();
|
||||
}
|
||||
|
||||
public void setActionHandler(IAction actionHandler) {
|
||||
if (fActionHandler != null && actionHandler == null && fMouseListener != null) {
|
||||
if (!fLabel.isDisposed())
|
||||
fLabel.removeMouseListener(fMouseListener);
|
||||
fMouseListener= null;
|
||||
}
|
||||
|
||||
fActionHandler= actionHandler;
|
||||
|
||||
if (fLabel != null && !fLabel.isDisposed() && fMouseListener == null && fActionHandler != null) {
|
||||
fMouseListener= new Listener();
|
||||
fLabel.addMouseListener(fMouseListener);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the width hint for this label.
|
||||
*
|
||||
* @param control the root control of this label
|
||||
* @return the width hint for this label
|
||||
* @since 2.1
|
||||
*/
|
||||
private int getWidthHint(Composite control) {
|
||||
if (fFixedWidth < 0) {
|
||||
GC gc= new GC(control);
|
||||
gc.setFont(control.getFont());
|
||||
fFixedWidth = (int) gc.getFontMetrics().getAverageCharacterWidth() * fWidthInChars;
|
||||
fFixedWidth += INDENT * 2;
|
||||
gc.dispose();
|
||||
}
|
||||
return fFixedWidth;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the height hint for this label.
|
||||
*
|
||||
* @param control the root control of this label
|
||||
* @return the height hint for this label
|
||||
* @since 3.0
|
||||
*/
|
||||
private int getHeightHint(Composite control) {
|
||||
if (fFixedHeight < 0) {
|
||||
GC gc= new GC(control);
|
||||
gc.setFont(control.getFont());
|
||||
fFixedHeight= gc.getFontMetrics().getHeight();
|
||||
gc.dispose();
|
||||
}
|
||||
return fFixedHeight;
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates the message label widget.
|
||||
*
|
||||
* @since 3.0
|
||||
*/
|
||||
private void updateMessageLabel() {
|
||||
if (fLabel != null && !fLabel.isDisposed()) {
|
||||
Display display= fLabel.getDisplay();
|
||||
if ((fErrorText != null && !fErrorText.isEmpty()) || fErrorImage != null) {
|
||||
fLabel.setForeground(JFaceColors.getErrorText(display));
|
||||
fLabel.setText(fErrorText);
|
||||
fLabel.setImage(fErrorImage);
|
||||
if (fToolTipText != null)
|
||||
fLabel.setToolTipText(fToolTipText);
|
||||
else if (fErrorText.length() > fWidthInChars)
|
||||
fLabel.setToolTipText(fErrorText);
|
||||
else
|
||||
fLabel.setToolTipText(null);
|
||||
|
||||
} else {
|
||||
fLabel.setForeground(fLabel.getParent().getForeground());
|
||||
fLabel.setText(fText);
|
||||
fLabel.setImage(fImage);
|
||||
if (fToolTipText != null)
|
||||
fLabel.setToolTipText(fToolTipText);
|
||||
else if (fText != null && fText.length() > fWidthInChars)
|
||||
fLabel.setToolTipText(fText);
|
||||
else
|
||||
fLabel.setToolTipText(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void setText(String message){
|
||||
this.fText=message;
|
||||
updateMessageLabel();
|
||||
}
|
||||
|
||||
public void setErrorText(String message){
|
||||
this.fErrorText=message;
|
||||
updateMessageLabel();
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,72 @@
|
||||
package com.minres.scviewer.e4.application.internal.status;
|
||||
|
||||
import org.eclipse.jface.action.ContributionItem;
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.custom.CLabel;
|
||||
import org.eclipse.swt.graphics.Point;
|
||||
import org.eclipse.swt.layout.GridData;
|
||||
import org.eclipse.swt.layout.GridLayout;
|
||||
import org.eclipse.swt.widgets.Composite;
|
||||
|
||||
/**
|
||||
* The Class TextContributionItem.
|
||||
*/
|
||||
class TextContributionItem extends ContributionItem {
|
||||
|
||||
/** The label string. */
|
||||
final String labelString;
|
||||
|
||||
/** The text. */
|
||||
CLabel label, text;
|
||||
|
||||
/** The content. */
|
||||
private String content;
|
||||
|
||||
/**
|
||||
* Instantiates a new text contribution item.
|
||||
*
|
||||
* @param labelString the label string
|
||||
*/
|
||||
public TextContributionItem(String labelString) {
|
||||
super();
|
||||
this.labelString = labelString;
|
||||
content=""; //$NON-NLS-1$
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.jface.action.ContributionItem#fill(org.eclipse.swt.widgets.Composite)
|
||||
*/
|
||||
@Override
|
||||
public void fill(Composite parent) {
|
||||
Composite box=new Composite(parent, SWT.NONE); //NONE
|
||||
box.setLayout(new GridLayout(2, false));
|
||||
label=new CLabel(box, SWT.SHADOW_NONE);
|
||||
label.setText(labelString);
|
||||
text=new CLabel(box, SWT.SHADOW_IN);
|
||||
text.setAlignment(SWT.RIGHT);
|
||||
text.setText(" ");
|
||||
Point p = text.computeSize(SWT.DEFAULT, SWT.DEFAULT);
|
||||
GridData layoutData=new GridData(SWT.DEFAULT, SWT.DEFAULT, true, false);
|
||||
layoutData.minimumWidth=12*p.x;
|
||||
text.setLayoutData(layoutData);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.jface.action.ContributionItem#isDynamic()
|
||||
*/
|
||||
@Override
|
||||
public boolean isDynamic() {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the text.
|
||||
*
|
||||
* @param message the new text
|
||||
*/
|
||||
public void setText(String message){
|
||||
this.content=message;
|
||||
if(text!=null && !text.isDisposed()) text.setText(content);
|
||||
}
|
||||
|
||||
}
|
@ -18,15 +18,8 @@ import org.eclipse.e4.ui.di.UIEventTopic;
|
||||
import org.eclipse.e4.ui.di.UISynchronize;
|
||||
import org.eclipse.e4.ui.services.IServiceConstants;
|
||||
import org.eclipse.e4.ui.workbench.modeling.EModelService;
|
||||
import org.eclipse.jface.action.ContributionItem;
|
||||
import org.eclipse.jface.action.StatusLineManager;
|
||||
import org.eclipse.jface.viewers.IStructuredSelection;
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.custom.CLabel;
|
||||
import org.eclipse.swt.layout.GridData;
|
||||
import org.eclipse.swt.layout.GridLayout;
|
||||
import org.eclipse.swt.widgets.Composite;
|
||||
|
||||
import com.minres.scviewer.e4.application.Messages;
|
||||
|
||||
/**
|
||||
@ -50,76 +43,9 @@ public class WaveStatusBarControl extends StatusBarControl {
|
||||
@Inject
|
||||
EModelService modelService;
|
||||
|
||||
/**
|
||||
* The Class TextContributionItem.
|
||||
*/
|
||||
class TextContributionItem extends ContributionItem {
|
||||
|
||||
/** The label string. */
|
||||
final String labelString;
|
||||
|
||||
/** The width. */
|
||||
//final int width;
|
||||
|
||||
/** The text. */
|
||||
CLabel label, text;
|
||||
|
||||
/** The content. */
|
||||
private String content;
|
||||
|
||||
/**
|
||||
* Instantiates a new text contribution item.
|
||||
*
|
||||
* @param labelString the label string
|
||||
* @param width the width
|
||||
*/
|
||||
public TextContributionItem(String labelString /*, int width */) {
|
||||
super();
|
||||
this.labelString = labelString;
|
||||
//this.width=width;
|
||||
content=""; //$NON-NLS-1$
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.jface.action.ContributionItem#fill(org.eclipse.swt.widgets.Composite)
|
||||
*/
|
||||
@Override
|
||||
public void fill(Composite parent) {
|
||||
Composite box=new Composite(parent, SWT.NONE); //NONE
|
||||
box.setLayout(new GridLayout(2, false));
|
||||
label=new CLabel(box, SWT.SHADOW_NONE);
|
||||
label.setText(labelString);
|
||||
text=new CLabel(box, SWT.SHADOW_IN);
|
||||
text.setAlignment(SWT.RIGHT);
|
||||
//GridData layoutData=new GridData(SWT.DEFAULT, SWT.DEFAULT, true, false);
|
||||
GridData layoutData=new GridData(SWT.DEFAULT, SWT.DEFAULT, true, false);
|
||||
layoutData.minimumWidth=70;
|
||||
//layoutData.minimumWidth=width;
|
||||
text.setLayoutData(layoutData);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.jface.action.ContributionItem#isDynamic()
|
||||
*/
|
||||
@Override
|
||||
public boolean isDynamic() {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the text.
|
||||
*
|
||||
* @param message the new text
|
||||
*/
|
||||
public void setText(String message){
|
||||
this.content=message;
|
||||
if(text!=null && !text.isDisposed()) text.setText(content);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/** The zoom contribution. */
|
||||
TextContributionItem cursorContribution, markerContribution, markerDiffContribution, zoomContribution;
|
||||
StatusLineContributionItem cursorContribution, markerContribution, markerDiffContribution, zoomContribution;
|
||||
|
||||
/**
|
||||
* Instantiates a new wave status bar control.
|
||||
@ -130,10 +56,10 @@ public class WaveStatusBarControl extends StatusBarControl {
|
||||
public WaveStatusBarControl(UISynchronize sync) {
|
||||
super(sync);
|
||||
|
||||
cursorContribution = new TextContributionItem(Messages.WaveStatusBarControl_5 /*, 150 */); //150
|
||||
markerContribution = new TextContributionItem(Messages.WaveStatusBarControl_6 /*, 150 */); //150
|
||||
markerDiffContribution = new TextContributionItem(Messages.WaveStatusBarControl_7 /*, 150 */); //150
|
||||
zoomContribution = new TextContributionItem(Messages.WaveStatusBarControl_8 /*, 60 */); //60
|
||||
cursorContribution = new StatusLineContributionItem(Messages.WaveStatusBarControl_5, true, 20);
|
||||
markerContribution = new StatusLineContributionItem(Messages.WaveStatusBarControl_6, true, 20);
|
||||
markerDiffContribution = new StatusLineContributionItem(Messages.WaveStatusBarControl_7, true, 20);
|
||||
zoomContribution = new StatusLineContributionItem(Messages.WaveStatusBarControl_8, true, 8);
|
||||
manager.appendToGroup(StatusLineManager.BEGIN_GROUP,cursorContribution);
|
||||
manager.appendToGroup(StatusLineManager.BEGIN_GROUP,markerContribution);
|
||||
manager.appendToGroup(StatusLineManager.BEGIN_GROUP,markerDiffContribution);
|
||||
|
@ -35,6 +35,7 @@ TransactionDetails_20=Time
|
||||
TransactionDetails_21=End time
|
||||
TransactionDetails_3=Value
|
||||
TransactionDetails_4=Relation
|
||||
WaveformPreferencesPage_description=Default Waveform Window Settings
|
||||
WaveformPreferencesPage_1=Color for
|
||||
WaveformViewer_13=Database Load Status
|
||||
WaveformViewer_14=Database Load Cancelled
|
||||
@ -55,3 +56,27 @@ WaveStatusBarControl_5=C:
|
||||
WaveStatusBarControl_6=M:
|
||||
WaveStatusBarControl_7=C-M:
|
||||
WaveStatusBarControl_8=Z:
|
||||
line=Track line
|
||||
line_highlite=higlighted Track line
|
||||
track_bg_even=even Track Background
|
||||
track_bg_odd=odd Track Background
|
||||
track_bg_highlite=highlighted Track Background
|
||||
tx_bg=Transaction Background
|
||||
tx_bg_highlite=highlighted Transaction Background
|
||||
tx_border=Transaction Border
|
||||
signal0=Signal Value '0'
|
||||
signal1=Signal Value '1'
|
||||
signalz=Signal Value 'Z'
|
||||
signalx=Signal Value 'X'
|
||||
signalu=Signal Value 'U'
|
||||
signal_text=Signal text
|
||||
signal_real=Signal real Value
|
||||
signal_nan=Signal NaN Value
|
||||
cursor=Cursor
|
||||
cursor_drag=dragged Cursor
|
||||
cursor_text=Cursor Text
|
||||
marker=Marker
|
||||
marker_text=Marker TExt
|
||||
rel_arrow=Relation arrow
|
||||
rel_arrow_highlite=highlighted Relation arrorw
|
||||
|
||||
|
@ -64,6 +64,7 @@ import org.eclipse.swt.events.PaintEvent;
|
||||
import org.eclipse.swt.events.PaintListener;
|
||||
import org.eclipse.swt.events.SelectionAdapter;
|
||||
import org.eclipse.swt.events.SelectionEvent;
|
||||
import org.eclipse.swt.layout.FillLayout;
|
||||
import org.eclipse.swt.layout.GridData;
|
||||
import org.eclipse.swt.layout.GridLayout;
|
||||
import org.eclipse.swt.widgets.Composite;
|
||||
@ -149,6 +150,14 @@ public class DesignBrowser {
|
||||
treeViewer.refresh();
|
||||
}
|
||||
});
|
||||
} else if("WAVEFORMS".equals(evt.getPropertyName())) {
|
||||
treeViewer.getTree().getDisplay().asyncExec(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
IWaveformDb database = waveformViewerPart.getDatabase();
|
||||
treeViewer.setInput(Arrays.asList(database.isLoaded()?new IWaveformDb[]{database}:new IWaveformDb[]{new LoadingWaveformDb()}));
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
@ -177,7 +186,8 @@ public class DesignBrowser {
|
||||
* @param parent the parent
|
||||
*/
|
||||
@PostConstruct
|
||||
public void createComposite(Composite parent) {
|
||||
public void createComposite(Composite parent, @Optional WaveformViewer waveformViewerPart) {
|
||||
parent.setLayout(new FillLayout(SWT.HORIZONTAL));
|
||||
sashForm = new SashForm(parent, SWT.BORDER | SWT.SMOOTH | SWT.VERTICAL);
|
||||
|
||||
top = new Composite(sashForm, SWT.NONE);
|
||||
@ -193,6 +203,8 @@ public class DesignBrowser {
|
||||
top.removeControlListener(this);
|
||||
}
|
||||
});
|
||||
if(waveformViewerPart!=null)
|
||||
setWaveformViewer(waveformViewerPart);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -366,13 +378,11 @@ public class DesignBrowser {
|
||||
* @param waveformViewerPart the waveform viewer part
|
||||
* @return the status event
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
@Inject @Optional
|
||||
public void getActiveWaveformViewerEvent(@UIEventTopic(WaveformViewer.ACTIVE_WAVEFORMVIEW) WaveformViewer waveformViewerPart) {
|
||||
if(this.waveformViewerPart!=null) {
|
||||
this.waveformViewerPart.storeDesignBrowerState(new DBState());
|
||||
}
|
||||
if( this.waveformViewerPart == null || this.waveformViewerPart != waveformViewerPart ) {
|
||||
if(this.waveformViewerPart!=null)
|
||||
this.waveformViewerPart.storeDesignBrowerState(new DBState());
|
||||
waveformViewerPart.addDisposeListener( new DisposeListener() {
|
||||
@Override
|
||||
public void widgetDisposed(DisposeEvent e) {
|
||||
@ -384,7 +394,12 @@ public class DesignBrowser {
|
||||
}
|
||||
}
|
||||
} );
|
||||
setWaveformViewer(waveformViewerPart);
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public void setWaveformViewer(WaveformViewer waveformViewerPart) {
|
||||
this.waveformViewerPart=waveformViewerPart;
|
||||
IWaveformDb database = waveformViewerPart.getDatabase();
|
||||
Object input = treeViewer.getInput();
|
||||
|
@ -381,16 +381,12 @@ public class FileBrowserDialog extends TrayDialog {
|
||||
class FileTreeLabelProvider implements ILabelProvider {
|
||||
private List<ILabelProviderListener> listeners;
|
||||
|
||||
private Image file;
|
||||
|
||||
private Image dir;
|
||||
|
||||
public FileTreeLabelProvider() {
|
||||
listeners = new ArrayList<ILabelProviderListener>();
|
||||
}
|
||||
|
||||
public Image getImage(Object arg0) {
|
||||
return ((File) arg0).isDirectory() ? folderImage : file;
|
||||
return ((File) arg0).isDirectory() ? folderImage : fileImage;
|
||||
}
|
||||
|
||||
public String getText(Object arg0) {
|
||||
@ -402,16 +398,12 @@ public class FileBrowserDialog extends TrayDialog {
|
||||
listeners.add(arg0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dispose() {
|
||||
// Dispose the images
|
||||
if (dir != null)
|
||||
dir.dispose();
|
||||
if (file != null)
|
||||
file.dispose();
|
||||
}
|
||||
|
||||
public boolean isLabelProperty(Object arg0, String arg1) {
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
public void removeListener(ILabelProviderListener arg0) {
|
||||
|
@ -0,0 +1,181 @@
|
||||
package com.minres.scviewer.e4.application.parts;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.eclipse.jface.dialogs.IDialogConstants;
|
||||
import org.eclipse.jface.dialogs.TitleAreaDialog;
|
||||
import org.eclipse.jface.viewers.ArrayContentProvider;
|
||||
import org.eclipse.jface.viewers.ComboViewer;
|
||||
import org.eclipse.jface.viewers.ISelectionChangedListener;
|
||||
import org.eclipse.jface.viewers.IStructuredSelection;
|
||||
import org.eclipse.jface.viewers.LabelProvider;
|
||||
import org.eclipse.jface.viewers.SelectionChangedEvent;
|
||||
import org.eclipse.jface.viewers.StructuredSelection;
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.layout.GridData;
|
||||
import org.eclipse.swt.layout.GridLayout;
|
||||
import org.eclipse.swt.widgets.Button;
|
||||
import org.eclipse.swt.widgets.Composite;
|
||||
import org.eclipse.swt.widgets.Control;
|
||||
import org.eclipse.swt.widgets.Label;
|
||||
import org.eclipse.swt.widgets.Shell;
|
||||
import org.eclipse.swt.widgets.Text;
|
||||
import org.eclipse.wb.swt.ResourceManager;
|
||||
|
||||
import com.minres.scviewer.database.DataType;
|
||||
import com.minres.scviewer.database.ITxEvent;
|
||||
import com.minres.scviewer.database.ITxStream;
|
||||
|
||||
public class SearchTxDialog extends TitleAreaDialog {
|
||||
private ComboViewer propNameComboViewer = null;
|
||||
|
||||
private Text propValueText = null;
|
||||
|
||||
private String propName="";
|
||||
private DataType propType=null;
|
||||
private String propValue="";
|
||||
|
||||
private ITxStream<? extends ITxEvent> stream;
|
||||
|
||||
private ConcurrentHashMap<String, DataType> propNames=new ConcurrentHashMap<String, DataType>();
|
||||
|
||||
/**
|
||||
* Create the dialog.
|
||||
* @param parentShell
|
||||
* @param iTxStream
|
||||
*/
|
||||
public SearchTxDialog(Shell parentShell, ITxStream<? extends ITxEvent> iTxStream) {
|
||||
super(parentShell);
|
||||
setShellStyle(SWT.BORDER | SWT.RESIZE | SWT.TITLE | SWT.APPLICATION_MODAL);
|
||||
stream=iTxStream;
|
||||
new Thread() {
|
||||
public void run() {
|
||||
stream.getEvents().values().parallelStream().forEach(evtLst -> {
|
||||
evtLst.forEach(evt -> {
|
||||
evt.getTransaction().getAttributes().stream().forEach(attr -> {
|
||||
propNames.put(attr.getName(), attr.getDataType());
|
||||
});
|
||||
});
|
||||
});
|
||||
parentShell.getDisplay().asyncExec(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (propNameComboViewer!=null) {
|
||||
propNameComboViewer.setInput(getEntries());
|
||||
propNameComboViewer.setSelection(new StructuredSelection(propNameComboViewer.getElementAt(0)));
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}.run();
|
||||
}
|
||||
|
||||
/**
|
||||
* Create contents of the dialog.
|
||||
* @param parent
|
||||
*/
|
||||
@Override
|
||||
protected Control createDialogArea(Composite parent) {
|
||||
setMessage("Specify property name and value to search for");
|
||||
setTitleImage(ResourceManager.getPluginImage("com.minres.scviewer.e4.application", "icons/Minres_logo.png"));
|
||||
setTitle("Search Tx in stream");
|
||||
final Composite area = (Composite) super.createDialogArea(parent);
|
||||
final GridLayout gridLayout = (GridLayout) area.getLayout();
|
||||
gridLayout.marginTop = 10;
|
||||
gridLayout.marginBottom = 10;
|
||||
final Composite container = new Composite(area, SWT.NONE);
|
||||
final GridLayout gl_container = new GridLayout(2, false);
|
||||
gl_container.horizontalSpacing = 2;
|
||||
container.setLayout(gl_container);
|
||||
container.setLayoutData(new GridData(GridData.FILL_BOTH));
|
||||
|
||||
final Label header = new Label(container, SWT.CENTER | SWT.WRAP);
|
||||
GridData gd_header = new GridData(SWT.FILL, SWT.TOP, true, false, 2, 1);
|
||||
gd_header.verticalIndent = 10;
|
||||
header.setLayoutData(gd_header);
|
||||
header.setText("Stream: "+stream.getName());
|
||||
|
||||
final Label propNameLabel = new Label(container, SWT.NONE);
|
||||
propNameLabel.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
|
||||
propNameLabel.setText("Property Name:");
|
||||
|
||||
propNameComboViewer = new ComboViewer(container, SWT.NONE);
|
||||
propNameComboViewer.getCombo().setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
|
||||
propNameComboViewer.setContentProvider(ArrayContentProvider.getInstance());
|
||||
propNameComboViewer.setLabelProvider(new LabelProvider() {
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public String getText(Object element) {
|
||||
Map.Entry<String, DataType> e = (Map.Entry<String, DataType>)element;
|
||||
return e.getKey()+" ("+e.getValue().name()+")";
|
||||
}
|
||||
|
||||
});
|
||||
propNameComboViewer.addSelectionChangedListener(new ISelectionChangedListener() {
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public void selectionChanged(SelectionChangedEvent event) {
|
||||
IStructuredSelection sel = event.getStructuredSelection();
|
||||
Map.Entry<String, DataType> e = (Map.Entry<String, DataType>)sel.getFirstElement();
|
||||
propName=e.getKey();
|
||||
propType=e.getValue();
|
||||
}
|
||||
});
|
||||
propNameComboViewer.setInput(getEntries());
|
||||
propNameComboViewer.setSelection(new StructuredSelection(propNameComboViewer.getElementAt(0)));
|
||||
|
||||
final Label propValueLabel = new Label(container, SWT.NONE);
|
||||
propValueLabel.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
|
||||
propValueLabel.setText("Property Value:");
|
||||
|
||||
propValueText = new Text(container, SWT.BORDER);
|
||||
propValueText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
|
||||
|
||||
return area;
|
||||
}
|
||||
|
||||
private List<Entry<String,DataType>> getEntries() {
|
||||
return propNames.entrySet().stream().sorted((e1,e2)->e1.getKey().compareTo(e2.getKey())).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
/**
|
||||
* Create contents of the button bar.
|
||||
* @param parent
|
||||
*/
|
||||
@Override
|
||||
protected void createButtonsForButtonBar(Composite parent) {
|
||||
final Button okButton = createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);
|
||||
okButton.setImage(ResourceManager.getPluginImage("com.minres.scviewer.e4.application", "icons/tick.png"));
|
||||
final Button cancelButton = createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);
|
||||
cancelButton.setImage(ResourceManager.getPluginImage("com.minres.scviewer.e4.application", "icons/cross.png"));
|
||||
}
|
||||
|
||||
protected void constrainShellSize() {
|
||||
super.constrainShellSize();
|
||||
getShell().setMinimumSize(getShell().computeSize(-1, -1));
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void okPressed() {
|
||||
propValue=propValueText.getText();
|
||||
super.okPressed();
|
||||
}
|
||||
|
||||
public String getPropName() {
|
||||
return propName;
|
||||
}
|
||||
|
||||
public DataType getPropType() {
|
||||
return propType;
|
||||
}
|
||||
|
||||
public String getPropValue() {
|
||||
return propValue;
|
||||
}
|
||||
}
|
@ -10,16 +10,10 @@
|
||||
*******************************************************************************/
|
||||
package com.minres.scviewer.e4.application.parts;
|
||||
|
||||
import java.util.AbstractMap;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.TreeMap;
|
||||
import java.util.Vector;
|
||||
import java.util.function.Function;
|
||||
import java.util.regex.PatternSyntaxException;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
@ -35,24 +29,16 @@ import org.eclipse.e4.ui.services.IServiceConstants;
|
||||
import org.eclipse.e4.ui.workbench.modeling.EPartService;
|
||||
import org.eclipse.e4.ui.workbench.modeling.ESelectionService;
|
||||
import org.eclipse.jface.viewers.DelegatingStyledCellLabelProvider;
|
||||
import org.eclipse.jface.viewers.DelegatingStyledCellLabelProvider.IStyledLabelProvider;
|
||||
import org.eclipse.jface.viewers.DoubleClickEvent;
|
||||
import org.eclipse.jface.viewers.IDoubleClickListener;
|
||||
import org.eclipse.jface.viewers.IElementComparer;
|
||||
import org.eclipse.jface.viewers.ISelection;
|
||||
import org.eclipse.jface.viewers.IStructuredSelection;
|
||||
import org.eclipse.jface.viewers.ITreeContentProvider;
|
||||
import org.eclipse.jface.viewers.ITreeViewerListener;
|
||||
import org.eclipse.jface.viewers.LabelProvider;
|
||||
import org.eclipse.jface.viewers.StructuredSelection;
|
||||
import org.eclipse.jface.viewers.StyledString;
|
||||
import org.eclipse.jface.viewers.TreeExpansionEvent;
|
||||
import org.eclipse.jface.viewers.TreePath;
|
||||
import org.eclipse.jface.viewers.TreeViewer;
|
||||
import org.eclipse.jface.viewers.TreeViewerColumn;
|
||||
import org.eclipse.jface.viewers.Viewer;
|
||||
import org.eclipse.jface.viewers.ViewerComparator;
|
||||
import org.eclipse.jface.viewers.ViewerFilter;
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.events.ControlAdapter;
|
||||
import org.eclipse.swt.events.ControlEvent;
|
||||
@ -65,15 +51,19 @@ import org.eclipse.swt.graphics.Rectangle;
|
||||
import org.eclipse.swt.layout.GridData;
|
||||
import org.eclipse.swt.layout.GridLayout;
|
||||
import org.eclipse.swt.widgets.Composite;
|
||||
import org.eclipse.swt.widgets.Control;
|
||||
import org.eclipse.swt.widgets.Text;
|
||||
import org.eclipse.swt.widgets.Tree;
|
||||
import org.eclipse.swt.widgets.TreeItem;
|
||||
|
||||
import com.minres.scviewer.database.DataType;
|
||||
import com.minres.scviewer.database.ITx;
|
||||
import com.minres.scviewer.database.ITxAttribute;
|
||||
import com.minres.scviewer.database.ITxRelation;
|
||||
import com.minres.scviewer.e4.application.Messages;
|
||||
import com.minres.scviewer.e4.application.parts.txTableTree.AttributeLabelProvider;
|
||||
import com.minres.scviewer.e4.application.parts.txTableTree.AbstractTransactionTreeContentProvider;
|
||||
import com.minres.scviewer.e4.application.parts.txTableTree.TransactionTreeNode;
|
||||
import com.minres.scviewer.e4.application.parts.txTableTree.TransactionTreeNodeType;
|
||||
import com.minres.scviewer.e4.application.parts.txTableTree.TxAttributeFilter;
|
||||
import com.minres.scviewer.e4.application.parts.txTableTree.TxAttributeViewerSorter;
|
||||
import com.minres.scviewer.e4.application.provider.TxPropertiesLabelProvider;
|
||||
|
||||
/**
|
||||
@ -115,17 +105,21 @@ public class TransactionDetails {
|
||||
/** The waveform viewer part. */
|
||||
private WaveformViewer waveformViewerPart;
|
||||
|
||||
|
||||
private Composite top;
|
||||
|
||||
/**
|
||||
* Creates the composite.
|
||||
*
|
||||
* @param parent the parent
|
||||
*/
|
||||
@PostConstruct
|
||||
public void createComposite(final Composite parent) {
|
||||
parent.setLayout(new GridLayout(1, false));
|
||||
public void createComposite(final Composite parent, @Optional WaveformViewer waveformViewerPart) {
|
||||
this.waveformViewerPart=waveformViewerPart;
|
||||
|
||||
top = new Composite(parent, SWT.NONE);
|
||||
top.setLayout(new GridLayout(1, false));
|
||||
|
||||
nameFilter = new Text(parent, SWT.BORDER);
|
||||
nameFilter = new Text(top, SWT.BORDER);
|
||||
nameFilter.setMessage(Messages.TransactionDetails_0);
|
||||
nameFilter.addModifyListener(new ModifyListener() {
|
||||
@Override
|
||||
@ -141,8 +135,18 @@ public class TransactionDetails {
|
||||
attributeFilter = new TxAttributeFilter();
|
||||
viewSorter = new TxAttributeViewerSorter();
|
||||
|
||||
treeViewer = new TreeViewer(parent);
|
||||
treeViewer.setContentProvider(new TransactionTreeContentProvider());
|
||||
treeViewer = new TreeViewer(top);
|
||||
treeViewer.setContentProvider(new AbstractTransactionTreeContentProvider(waveformViewerPart) {
|
||||
@Override
|
||||
public Object[] getElements(Object element) {
|
||||
return new Object[]{
|
||||
new TransactionTreeNode((ITx)element, TransactionTreeNodeType.PROPS),
|
||||
new TransactionTreeNode((ITx)element, TransactionTreeNodeType.ATTRS),
|
||||
new TransactionTreeNode((ITx)element, TransactionTreeNodeType.IN_REL),
|
||||
new TransactionTreeNode((ITx)element, TransactionTreeNodeType.OUT_REL)
|
||||
};
|
||||
}
|
||||
});
|
||||
treeViewer.setLabelProvider(new TxPropertiesLabelProvider());
|
||||
treeViewer.getControl().setLayoutData(new GridData(GridData.FILL_BOTH));
|
||||
treeViewer.addFilter(attributeFilter);
|
||||
@ -152,15 +156,11 @@ public class TransactionDetails {
|
||||
|
||||
@Override
|
||||
public void treeCollapsed(TreeExpansionEvent event) {
|
||||
Object o = event.getElement();
|
||||
TreePath[] paths = treeViewer.getExpandedTreePaths();
|
||||
treeViewer.getSelection();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void treeExpanded(TreeExpansionEvent event) {
|
||||
Object o = event.getElement();
|
||||
TreePath[] paths = treeViewer.getExpandedTreePaths();
|
||||
treeViewer.getSelection();
|
||||
}
|
||||
|
||||
@ -172,7 +172,7 @@ public class TransactionDetails {
|
||||
col1 = new TreeViewerColumn(treeViewer, SWT.NONE);
|
||||
col1.getColumn().setText(Messages.TransactionDetails_1);
|
||||
col1.getColumn().setResizable(true);
|
||||
col1.setLabelProvider(new DelegatingStyledCellLabelProvider(new AttributeLabelProvider(AttributeLabelProvider.NAME)));
|
||||
col1.setLabelProvider(new DelegatingStyledCellLabelProvider(new AttributeLabelProvider(waveformViewerPart, AttributeLabelProvider.NAME)));
|
||||
col1.getColumn().addSelectionListener(new SelectionAdapter() {
|
||||
public void widgetSelected(SelectionEvent event) {
|
||||
((TxAttributeViewerSorter) treeViewer.getComparator()).doSort(COLUMN_FIRST);
|
||||
@ -183,7 +183,7 @@ public class TransactionDetails {
|
||||
col2 = new TreeViewerColumn(treeViewer, SWT.NONE);
|
||||
col2.getColumn().setText(Messages.TransactionDetails_2);
|
||||
col2.getColumn().setResizable(true);
|
||||
col2.setLabelProvider(new DelegatingStyledCellLabelProvider(new AttributeLabelProvider(AttributeLabelProvider.TYPE)));
|
||||
col2.setLabelProvider(new DelegatingStyledCellLabelProvider(new AttributeLabelProvider(waveformViewerPart, AttributeLabelProvider.TYPE)));
|
||||
col2.getColumn().addSelectionListener(new SelectionAdapter() {
|
||||
public void widgetSelected(SelectionEvent event) {
|
||||
((TxAttributeViewerSorter) treeViewer.getComparator()).doSort(COLUMN_SECOND);
|
||||
@ -194,7 +194,7 @@ public class TransactionDetails {
|
||||
col3 = new TreeViewerColumn(treeViewer, SWT.NONE);
|
||||
col3.getColumn().setText(Messages.TransactionDetails_3);
|
||||
col3.getColumn().setResizable(true);
|
||||
col3.setLabelProvider(new DelegatingStyledCellLabelProvider(new AttributeLabelProvider(AttributeLabelProvider.VALUE)));
|
||||
col3.setLabelProvider(new DelegatingStyledCellLabelProvider(new AttributeLabelProvider(waveformViewerPart, AttributeLabelProvider.VALUE)));
|
||||
col3.getColumn().addSelectionListener(new SelectionAdapter() {
|
||||
public void widgetSelected(SelectionEvent event) {
|
||||
((TxAttributeViewerSorter) treeViewer.getComparator()).doSort(COLUMN_SECOND);
|
||||
@ -229,10 +229,10 @@ public class TransactionDetails {
|
||||
}
|
||||
|
||||
});
|
||||
parent.addControlListener(new ControlAdapter() {
|
||||
top.addControlListener(new ControlAdapter() {
|
||||
public void controlResized(ControlEvent e) {
|
||||
Tree table = treeViewer.getTree();
|
||||
Rectangle area = parent.getClientArea();
|
||||
Rectangle area = top.getClientArea();
|
||||
Point preferredSize = table.computeSize(SWT.DEFAULT, SWT.DEFAULT);
|
||||
int width = area.width - 2*table.getBorderWidth();
|
||||
if (preferredSize.y > area.height + table.getHeaderHeight()) {
|
||||
@ -263,12 +263,16 @@ public class TransactionDetails {
|
||||
});
|
||||
}
|
||||
|
||||
public Control getControl() {
|
||||
return top;
|
||||
}
|
||||
/**
|
||||
* Sets the focus.
|
||||
*/
|
||||
@Focus
|
||||
public void setFocus() {
|
||||
treeViewer.getTree().setFocus();
|
||||
if(treeViewer!=null)
|
||||
treeViewer.getTree().setFocus();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -330,15 +334,15 @@ public class TransactionDetails {
|
||||
if(paths==null)
|
||||
treeViewer.setAutoExpandLevel(2);
|
||||
else {
|
||||
TransactionTreeContentProvider cp = (TransactionTreeContentProvider) treeViewer.getContentProvider();
|
||||
AbstractTransactionTreeContentProvider cp = (AbstractTransactionTreeContentProvider) treeViewer.getContentProvider();
|
||||
Object[] elems = cp.getElements(treeViewer.getInput());
|
||||
for(TreePath path: paths) {
|
||||
TreeNode firstSeg = (TreeNode)path.getFirstSegment();
|
||||
TransactionTreeNode firstSeg = (TransactionTreeNode)path.getFirstSegment();
|
||||
for(Object elem : elems) {
|
||||
if(((TreeNode)elem).type == firstSeg.type) {
|
||||
if(((TransactionTreeNode)elem).type == firstSeg.type) {
|
||||
treeViewer.setExpandedState(elem, true);
|
||||
if(firstSeg.type==TransactionDetails.Type.ATTRS && path.getSegmentCount()>1)
|
||||
expandSubNodes(path, 1, (TreeNode)elem);
|
||||
if(firstSeg.type==TransactionTreeNodeType.ATTRS && path.getSegmentCount()>1)
|
||||
expandSubNodes(path, 1, (TransactionTreeNode)elem);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -346,14 +350,14 @@ public class TransactionDetails {
|
||||
}
|
||||
}
|
||||
|
||||
private void expandSubNodes(TreePath path, int level, TreeNode elem) {
|
||||
private void expandSubNodes(TreePath path, int level, TransactionTreeNode elem) {
|
||||
if(level==path.getSegmentCount()) return;
|
||||
TransactionTreeContentProvider cp = (TransactionTreeContentProvider) treeViewer.getContentProvider();
|
||||
AbstractTransactionTreeContentProvider cp = (AbstractTransactionTreeContentProvider) treeViewer.getContentProvider();
|
||||
Object[] childs = cp.getChildren(elem);
|
||||
TreeNode nextSeg = (TreeNode)path.getSegment(level);
|
||||
TransactionTreeNode nextSeg = (TransactionTreeNode)path.getSegment(level);
|
||||
for(Object child:childs) {
|
||||
if(child instanceof TreeNode) {
|
||||
TreeNode node = (TreeNode) child;
|
||||
if(child instanceof TransactionTreeNode) {
|
||||
TransactionTreeNode node = (TransactionTreeNode) child;
|
||||
if(nextSeg.toString().equals(node.toString())) {
|
||||
treeViewer.setExpandedState(node, true);
|
||||
expandSubNodes(path, level+1, node);
|
||||
@ -395,414 +399,13 @@ public class TransactionDetails {
|
||||
public void setSelection(@Named(IServiceConstants.ACTIVE_SELECTION) @Optional IStructuredSelection selection, EPartService partService){
|
||||
// only react if selection is actually from the WaveformViewer and nothing else
|
||||
MPart part = partService.getActivePart();
|
||||
if( part == null || ! (part.getObject() instanceof WaveformViewer ) )
|
||||
if( part == null || ! (part.getObject() instanceof WaveformViewer ) || part.getObject() != waveformViewerPart)
|
||||
return;
|
||||
if(treeViewer!=null && selection!=null && !treeViewer.getTree().isDisposed()){
|
||||
if( selection instanceof IStructuredSelection) {
|
||||
if( selection instanceof IStructuredSelection && !selection.isEmpty()) {
|
||||
setInput(((IStructuredSelection)selection).getFirstElement());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Time to string.
|
||||
*
|
||||
* @param time the time
|
||||
* @return the string
|
||||
*/
|
||||
String timeToString(Long time){
|
||||
return waveformViewerPart.getScaledTime(time);
|
||||
}
|
||||
|
||||
/**
|
||||
* Tx to string.
|
||||
*
|
||||
* @param tx the tx
|
||||
* @return the string
|
||||
*/
|
||||
String txToString(ITx tx){
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("tx#").append(tx.getId()).append("[").append(timeToString(tx.getBeginTime())); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
sb.append(" - ").append(timeToString(tx.getEndTime())).append("]"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* The Class TxAttributeViewerSorter.
|
||||
*/
|
||||
class TxAttributeViewerSorter extends ViewerComparator {
|
||||
|
||||
/** The Constant ASCENDING. */
|
||||
private static final int ASCENDING = 0;
|
||||
|
||||
/** The Constant DESCENDING. */
|
||||
private static final int DESCENDING = 1;
|
||||
|
||||
/** The column. */
|
||||
private int column;
|
||||
|
||||
/** The direction. */
|
||||
private int direction;
|
||||
|
||||
/**
|
||||
* Does the sort. If it's a different column from the previous sort, do an
|
||||
* ascending sort. If it's the same column as the last sort, toggle the sort
|
||||
* direction.
|
||||
*
|
||||
* @param column the column
|
||||
*/
|
||||
public void doSort(int column) {
|
||||
if (column == this.column) {
|
||||
// Same column as last sort; toggle the direction
|
||||
direction = 1 - direction;
|
||||
} else {
|
||||
// New column; do an ascending sort
|
||||
this.column = column;
|
||||
direction = ASCENDING;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Compares the object for sorting.
|
||||
*
|
||||
* @param viewer the viewer
|
||||
* @param e1 the e1
|
||||
* @param e2 the e2
|
||||
* @return the int
|
||||
*/
|
||||
public int compare(Viewer viewer, Object e1, Object e2) {
|
||||
int rc = 0;
|
||||
if(e1 instanceof ITxAttribute && e2 instanceof ITxAttribute){
|
||||
ITxAttribute p1 = (ITxAttribute) e1;
|
||||
ITxAttribute p2 = (ITxAttribute) e2;
|
||||
// Determine which column and do the appropriate sort
|
||||
switch (column) {
|
||||
case COLUMN_FIRST:
|
||||
rc = getComparator().compare(p1.getName(), p2.getName());
|
||||
break;
|
||||
case COLUMN_SECOND:
|
||||
rc = getComparator().compare(p1.getDataType().name(), p2.getDataType().name());
|
||||
break;
|
||||
case COLUMN_THIRD:
|
||||
rc = getComparator().compare(p1.getValue().toString(), p2.getValue().toString());
|
||||
break;
|
||||
}
|
||||
// If descending order, flip the direction
|
||||
if (direction == DESCENDING) rc = -rc;
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The Class TxAttributeFilter.
|
||||
*/
|
||||
class TxAttributeFilter extends ViewerFilter {
|
||||
|
||||
/** The search string. */
|
||||
private String searchString;
|
||||
|
||||
/**
|
||||
* Sets the search text.
|
||||
*
|
||||
* @param s the new search text
|
||||
*/
|
||||
public void setSearchText(String s) {
|
||||
this.searchString = ".*" + s + ".*"; //$NON-NLS-1$ //$NON-NLS-2$
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.jface.viewers.ViewerFilter#select(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)
|
||||
*/
|
||||
@Override
|
||||
public boolean select(Viewer viewer, Object parentElement, Object element) {
|
||||
|
||||
if (searchString == null || searchString.length() == 0) {
|
||||
return true;
|
||||
}
|
||||
if(element instanceof TreeNode) {
|
||||
return true;
|
||||
}
|
||||
if(element instanceof ITxAttribute){
|
||||
try {
|
||||
return (((ITxAttribute) element).getName().toLowerCase().matches(searchString.toLowerCase()));
|
||||
} catch (PatternSyntaxException e) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if(element instanceof Object[]) {
|
||||
try {
|
||||
return (((Object[])element)[0]).toString().toLowerCase().matches(searchString.toLowerCase());
|
||||
} catch (PatternSyntaxException e) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The Enum Type.
|
||||
*/
|
||||
enum Type {
|
||||
PROPS, /** The props. */
|
||||
ATTRS, /** The attrs. */
|
||||
IN_REL, /** The in rel. */
|
||||
OUT_REL,/** The out rel. */
|
||||
HIER
|
||||
}
|
||||
|
||||
/**
|
||||
* The Class TreeNode.
|
||||
*/
|
||||
class TreeNode implements Comparable<TreeNode>{
|
||||
|
||||
/** The type. */
|
||||
public Type type;
|
||||
|
||||
/** The element. */
|
||||
public ITx element;
|
||||
|
||||
private String hier_path;
|
||||
/**
|
||||
* Instantiates a new tree node.
|
||||
*
|
||||
* @param element the element
|
||||
* @param type the type
|
||||
*/
|
||||
public TreeNode(ITx element, Type type){
|
||||
this.element=element;
|
||||
this.type=type;
|
||||
this.hier_path="";
|
||||
}
|
||||
|
||||
public TreeNode(ITx element, String path){
|
||||
this.element=element;
|
||||
this.type=Type.HIER;
|
||||
this.hier_path=path;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see java.lang.Object#toString()
|
||||
*/
|
||||
public String toString(){
|
||||
switch(type){
|
||||
case PROPS: return Messages.TransactionDetails_10;
|
||||
case ATTRS: return Messages.TransactionDetails_11;
|
||||
case IN_REL: return Messages.TransactionDetails_12;
|
||||
case OUT_REL: return Messages.TransactionDetails_13;
|
||||
case HIER:{
|
||||
String[] tokens = hier_path.split("\\.");
|
||||
return tokens[tokens.length-1];
|
||||
}
|
||||
}
|
||||
return ""; //$NON-NLS-1$
|
||||
}
|
||||
|
||||
public Object[] getAttributeListForHier() {
|
||||
if(childs==null) {
|
||||
Map<String, Object> res = element.getAttributes().stream()
|
||||
.filter(txAttr -> txAttr.getName().startsWith(hier_path))
|
||||
.map(txAttr -> {
|
||||
String target = hier_path.length()==0?txAttr.getName():txAttr.getName().replace(hier_path+'.', "");
|
||||
String[] tokens = target.split("\\.");
|
||||
if(tokens.length==1)
|
||||
return new AbstractMap.SimpleEntry<>(tokens[0], txAttr);
|
||||
else
|
||||
return new AbstractMap.SimpleEntry<>(tokens[0], new TreeNode(element, hier_path.length()>0?hier_path+"."+tokens[0]:tokens[0]));
|
||||
})
|
||||
.collect(Collectors.toMap(p -> p.getKey(), p -> p.getValue(), (first, second) -> first));
|
||||
childs = new TreeMap<String, Object>(res).values().toArray();
|
||||
}
|
||||
return childs;
|
||||
}
|
||||
|
||||
private Object[] childs=null;
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if(o instanceof TreeNode) {
|
||||
TreeNode t = (TreeNode) o;
|
||||
return type==t.type && hier_path.equals(t.hier_path);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(TreeNode o) {
|
||||
int res1 = type.compareTo(o.type);
|
||||
if(res1==0) {
|
||||
return hier_path.compareTo(o.hier_path);
|
||||
} else
|
||||
return res1;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The Class TransactionTreeContentProvider.
|
||||
*/
|
||||
class TransactionTreeContentProvider implements ITreeContentProvider {
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.jface.viewers.IContentProvider#dispose()
|
||||
*/
|
||||
@Override
|
||||
public void dispose() { }
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)
|
||||
*/
|
||||
@Override
|
||||
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.jface.viewers.ITreeContentProvider#getElements(java.lang.Object)
|
||||
*/
|
||||
@Override
|
||||
public Object[] getElements(Object element) {
|
||||
return new Object[]{
|
||||
new TreeNode((ITx)element, Type.PROPS),
|
||||
new TreeNode((ITx)element, Type.ATTRS),
|
||||
new TreeNode((ITx)element, Type.IN_REL),
|
||||
new TreeNode((ITx)element, Type.OUT_REL)
|
||||
};
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.jface.viewers.ITreeContentProvider#getChildren(java.lang.Object)
|
||||
*/
|
||||
@Override
|
||||
public Object[] getChildren(Object element) {
|
||||
if(element instanceof TreeNode){
|
||||
TreeNode propertyHolder=(TreeNode) element;
|
||||
if(propertyHolder.type == Type.PROPS){
|
||||
return new Object[][]{
|
||||
{Messages.TransactionDetails_1, Messages.TransactionDetails_16, propertyHolder.element.getStream().getFullName()},
|
||||
{Messages.TransactionDetails_2, Messages.TransactionDetails_16, propertyHolder.element.getGenerator().getName()},
|
||||
{Messages.TransactionDetails_19, Messages.TransactionDetails_20, timeToString(propertyHolder.element.getBeginTime())},
|
||||
{Messages.TransactionDetails_21, Messages.TransactionDetails_20, timeToString(propertyHolder.element.getEndTime())}
|
||||
};
|
||||
}else if(propertyHolder.type == Type.ATTRS || propertyHolder.type == Type.HIER)
|
||||
return propertyHolder.getAttributeListForHier();
|
||||
else if(propertyHolder.type == Type.IN_REL){
|
||||
Vector<Object[] > res = new Vector<>();
|
||||
for(ITxRelation rel:propertyHolder.element.getIncomingRelations()){
|
||||
res.add(new Object[]{
|
||||
rel.getRelationType(),
|
||||
rel.getSource().getGenerator().getName(),
|
||||
rel.getSource()});
|
||||
}
|
||||
return res.toArray();
|
||||
} else if(propertyHolder.type == Type.OUT_REL){
|
||||
Vector<Object[] > res = new Vector<>();
|
||||
for(ITxRelation rel:propertyHolder.element.getOutgoingRelations()){
|
||||
res.add(new Object[]{
|
||||
rel.getRelationType(),
|
||||
rel.getTarget().getGenerator().getName(),
|
||||
rel.getTarget()});
|
||||
}
|
||||
return res.toArray();
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.jface.viewers.ITreeContentProvider#getParent(java.lang.Object)
|
||||
*/
|
||||
@Override
|
||||
public Object getParent(Object element) {
|
||||
return null;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.jface.viewers.ITreeContentProvider#hasChildren(java.lang.Object)
|
||||
*/
|
||||
@Override
|
||||
public boolean hasChildren(Object element) {
|
||||
return getChildren(element)!=null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* The Class AttributeLabelProvider.
|
||||
*/
|
||||
class AttributeLabelProvider extends LabelProvider implements IStyledLabelProvider {
|
||||
|
||||
/** The field. */
|
||||
final int field;
|
||||
|
||||
/** The Constant NAME. */
|
||||
public static final int NAME=0;
|
||||
|
||||
/** The Constant TYPE. */
|
||||
public static final int TYPE=1;
|
||||
|
||||
/** The Constant VALUE. */
|
||||
public static final int VALUE=2;
|
||||
|
||||
/**
|
||||
* Instantiates a new attribute label provider.
|
||||
*
|
||||
* @param field the field
|
||||
*/
|
||||
public AttributeLabelProvider(int field) {
|
||||
this.field=field;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.jface.viewers.DelegatingStyledCellLabelProvider.IStyledLabelProvider#getStyledText(java.lang.Object)
|
||||
*/
|
||||
@Override
|
||||
public StyledString getStyledText(Object element) {
|
||||
switch(field){
|
||||
case NAME:
|
||||
if (element instanceof ITxAttribute) {
|
||||
ITxAttribute attribute = (ITxAttribute) element;
|
||||
String[] tokens = attribute.getName().split("\\.");
|
||||
return new StyledString(tokens[tokens.length-1]);
|
||||
}else if (element instanceof ITxRelation) {
|
||||
return new StyledString(Messages.TransactionDetails_4);
|
||||
}else if(element instanceof Object[]){
|
||||
Object[] elements = (Object[]) element;
|
||||
return new StyledString(elements[field].toString());
|
||||
} else
|
||||
return new StyledString(element.toString());
|
||||
case TYPE:
|
||||
if (element instanceof ITxAttribute) {
|
||||
ITxAttribute attribute = (ITxAttribute) element;
|
||||
return new StyledString(attribute.getDataType().toString());
|
||||
}else if(element instanceof Object[]){
|
||||
Object[] elements = (Object[]) element;
|
||||
return new StyledString(elements[field].toString());
|
||||
}else
|
||||
return new StyledString(""); //$NON-NLS-1$
|
||||
default:
|
||||
if (element instanceof ITxAttribute) {
|
||||
ITxAttribute attribute = (ITxAttribute) element;
|
||||
String value = attribute.getValue().toString();
|
||||
if((DataType.UNSIGNED == attribute.getDataType() || DataType.INTEGER==attribute.getDataType()) && !"0".equals(value)) {
|
||||
try {
|
||||
value += " [0x"+Long.toHexString(Long.parseLong(attribute.getValue().toString()))+"]";
|
||||
} catch(NumberFormatException e) { }
|
||||
}
|
||||
return new StyledString(value);
|
||||
}else if(element instanceof Object[]){
|
||||
Object[] elements = (Object[]) element;
|
||||
Object o = elements[field];
|
||||
if(o instanceof ITx) {
|
||||
ITx tx = (ITx)o;
|
||||
return new StyledString(txToString(tx)+" ("+tx.getStream().getFullName()+")");
|
||||
} else
|
||||
return new StyledString(o.toString());
|
||||
} else if(element instanceof ITx){
|
||||
return new StyledString(txToString((ITx) element));
|
||||
}else
|
||||
return new StyledString(""); //$NON-NLS-1$
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,301 @@
|
||||
package com.minres.scviewer.e4.application.parts;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.eclipse.core.databinding.observable.list.ObservableList;
|
||||
import org.eclipse.core.databinding.observable.list.WritableList;
|
||||
import org.eclipse.jface.databinding.viewers.ObservableListContentProvider;
|
||||
import org.eclipse.jface.viewers.ComboViewer;
|
||||
import org.eclipse.jface.viewers.DelegatingStyledCellLabelProvider;
|
||||
import org.eclipse.jface.viewers.DoubleClickEvent;
|
||||
import org.eclipse.jface.viewers.IDoubleClickListener;
|
||||
import org.eclipse.jface.viewers.ISelection;
|
||||
import org.eclipse.jface.viewers.IStructuredSelection;
|
||||
import org.eclipse.jface.viewers.LabelProvider;
|
||||
import org.eclipse.jface.viewers.StructuredSelection;
|
||||
import org.eclipse.jface.viewers.TableViewer;
|
||||
import org.eclipse.jface.viewers.TableViewerColumn;
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.events.ModifyEvent;
|
||||
import org.eclipse.swt.events.ModifyListener;
|
||||
import org.eclipse.swt.events.SelectionEvent;
|
||||
import org.eclipse.swt.events.SelectionListener;
|
||||
import org.eclipse.swt.layout.GridData;
|
||||
import org.eclipse.swt.layout.GridLayout;
|
||||
import org.eclipse.swt.widgets.Combo;
|
||||
import org.eclipse.swt.widgets.Composite;
|
||||
import org.eclipse.swt.widgets.Label;
|
||||
import org.eclipse.swt.widgets.Table;
|
||||
import org.eclipse.swt.widgets.TableColumn;
|
||||
import org.eclipse.swt.widgets.Text;
|
||||
|
||||
import com.minres.scviewer.database.DataType;
|
||||
import com.minres.scviewer.database.ITx;
|
||||
import com.minres.scviewer.database.ITxAttribute;
|
||||
import com.minres.scviewer.database.ITxEvent;
|
||||
import com.minres.scviewer.database.ITxEvent.Type;
|
||||
import com.minres.scviewer.database.ITxStream;
|
||||
import com.minres.scviewer.database.ui.TrackEntry;
|
||||
import com.minres.scviewer.e4.application.parts.txTableTree.AbstractTransactionTreeContentProvider;
|
||||
import com.minres.scviewer.e4.application.parts.txTableTree.AttributeLabelProvider;
|
||||
import com.minres.scviewer.e4.application.parts.txTableTree.TransactionTreeNode;
|
||||
import com.minres.scviewer.e4.application.parts.txTableTree.TransactionTreeNodeType;
|
||||
import com.minres.scviewer.e4.application.parts.txTableTree.TxFilter;
|
||||
|
||||
public class TransactionList extends Composite {
|
||||
public class AttributeNameBean {
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
public DataType getType() {
|
||||
return type;
|
||||
}
|
||||
public void setType(DataType type) {
|
||||
this.type = type;
|
||||
}
|
||||
public AttributeNameBean(String name, DataType type) {
|
||||
super();
|
||||
this.name = name;
|
||||
this.type = type;
|
||||
}
|
||||
String name;
|
||||
DataType type;
|
||||
|
||||
}
|
||||
|
||||
private ComboViewer searchPropComboViewer = null;
|
||||
|
||||
private ComboViewer viewPropComboViewer = null;
|
||||
|
||||
private Text searchPropValue;
|
||||
|
||||
private TableViewer tableViewer = null;
|
||||
|
||||
private TableColumn valueColumn = null;
|
||||
|
||||
private AttributeLabelProvider valueLabelProvider = null;
|
||||
|
||||
private ITxStream<? extends ITxEvent> stream;
|
||||
|
||||
private ObservableList<AttributeNameBean> attrNames = new WritableList<AttributeNameBean>();
|
||||
|
||||
private List<ITx> eventList = new ArrayList<ITx>();
|
||||
|
||||
private List<ITx> emptyList = new ArrayList<ITx>();
|
||||
|
||||
TxFilter txFilter;
|
||||
|
||||
/**
|
||||
* Create the composite.
|
||||
* @param parent
|
||||
* @param style
|
||||
*/
|
||||
public TransactionList(Composite parent, int style, WaveformViewer waveformViewer) {
|
||||
super(parent, style);
|
||||
setLayout(new GridLayout(5, false));
|
||||
txFilter = new TxFilter();
|
||||
|
||||
Label lbl1 = new Label(this, SWT.NONE);
|
||||
lbl1.setAlignment(SWT.RIGHT);
|
||||
lbl1.setText("Property to match:");
|
||||
lbl1.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1));
|
||||
|
||||
searchPropComboViewer = new ComboViewer(this, SWT.NONE);
|
||||
searchPropComboViewer.setLabelProvider(new LabelProvider() {
|
||||
public String getText(Object element) {
|
||||
AttributeNameBean entry = (AttributeNameBean) element;
|
||||
return entry.getName()+" ["+entry.getType().toString()+"]";
|
||||
}
|
||||
});
|
||||
searchPropComboViewer.setContentProvider(new ObservableListContentProvider<AttributeNameBean>());
|
||||
searchPropComboViewer.setInput(attrNames);
|
||||
Combo searchPropCombo = searchPropComboViewer.getCombo();
|
||||
searchPropCombo.setLayoutData(new GridData(SWT.LEFT, SWT.FILL, false, false, 1, 1));
|
||||
searchPropCombo.addSelectionListener(new SelectionListener() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent e) {
|
||||
int idx = searchPropCombo.getSelectionIndex();
|
||||
AttributeNameBean sel = attrNames.get(idx);
|
||||
txFilter.setSearchProp(sel.getName(), sel.getType());
|
||||
tableViewer.refresh();
|
||||
}
|
||||
@Override
|
||||
public void widgetDefaultSelected(SelectionEvent e) {
|
||||
int idx = searchPropCombo.getSelectionIndex();
|
||||
AttributeNameBean sel = attrNames.get(idx);
|
||||
txFilter.setSearchProp(sel.getName(), sel.getType());
|
||||
tableViewer.refresh();
|
||||
}
|
||||
});
|
||||
|
||||
searchPropValue = new Text(this, SWT.BORDER);
|
||||
GridData gd_searchPropValue = new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1);
|
||||
gd_searchPropValue.minimumWidth = 50;
|
||||
searchPropValue.setLayoutData(gd_searchPropValue);
|
||||
searchPropValue.addModifyListener(new ModifyListener() {
|
||||
@Override
|
||||
public void modifyText(ModifyEvent e) {
|
||||
txFilter.setSearchValue(((Text) e.widget).getText());
|
||||
tableViewer.refresh();
|
||||
}
|
||||
});
|
||||
|
||||
Label lbl2 = new Label(this, SWT.NONE);
|
||||
lbl2.setAlignment(SWT.RIGHT);
|
||||
lbl2.setText("Property to show:");
|
||||
lbl2.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1));
|
||||
|
||||
viewPropComboViewer = new ComboViewer(this, SWT.NONE);
|
||||
viewPropComboViewer.setLabelProvider(new LabelProvider() {
|
||||
public String getText(Object element) {
|
||||
AttributeNameBean entry = (AttributeNameBean) element;
|
||||
return entry.getName()+" ["+entry.getType().toString()+"]";
|
||||
}
|
||||
});
|
||||
viewPropComboViewer.setContentProvider(new ObservableListContentProvider<AttributeNameBean>());
|
||||
viewPropComboViewer.setInput(attrNames);
|
||||
Combo viewPropCombo = viewPropComboViewer.getCombo();
|
||||
viewPropCombo.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1));
|
||||
viewPropCombo.addSelectionListener(new SelectionListener() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent e) {
|
||||
int idx = viewPropCombo.getSelectionIndex();
|
||||
valueLabelProvider.setShowProp(attrNames.get(idx).getName());
|
||||
tableViewer.refresh(true);
|
||||
}
|
||||
@Override
|
||||
public void widgetDefaultSelected(SelectionEvent e) { }
|
||||
});
|
||||
|
||||
tableViewer = new TableViewer(this);
|
||||
tableViewer.setContentProvider(new AbstractTransactionTreeContentProvider(waveformViewer) {
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public Object[] getElements(Object inputElement) {
|
||||
if (inputElement instanceof ArrayList<?>) {
|
||||
return ((ArrayList<ITx>) inputElement).stream().map(tx-> new TransactionTreeNode(tx, TransactionTreeNodeType.TX)).collect(Collectors.toList()).toArray();
|
||||
}
|
||||
return new Object[0];
|
||||
}
|
||||
});
|
||||
tableViewer.addFilter(txFilter);
|
||||
tableViewer.addDoubleClickListener(new IDoubleClickListener() {
|
||||
@Override
|
||||
public void doubleClick(DoubleClickEvent event) {
|
||||
ISelection treeSelection = tableViewer.getSelection();
|
||||
if(treeSelection instanceof IStructuredSelection) {
|
||||
Object selected = ((IStructuredSelection)treeSelection).getFirstElement();
|
||||
if(selected instanceof ITx){
|
||||
waveformViewer.setSelection(new StructuredSelection(selected));
|
||||
} else if(selected instanceof TransactionTreeNode && ((TransactionTreeNode)selected).type == TransactionTreeNodeType.TX) {
|
||||
waveformViewer.setSelection(new StructuredSelection(((TransactionTreeNode)selected).element));
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Table table = tableViewer.getTable();
|
||||
table.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 5, 1));
|
||||
|
||||
TableViewerColumn nameColumnViewer = new TableViewerColumn(tableViewer, SWT.NONE);
|
||||
TableColumn nameColumn = nameColumnViewer.getColumn();
|
||||
nameColumn.setWidth(200);
|
||||
nameColumn.setText("Tx ID");
|
||||
nameColumn.setResizable(true);
|
||||
nameColumnViewer.setLabelProvider(new DelegatingStyledCellLabelProvider(new AttributeLabelProvider(waveformViewer, AttributeLabelProvider.NAME)));
|
||||
|
||||
TableViewerColumn timeColumnViewer = new TableViewerColumn(tableViewer, SWT.NONE);
|
||||
TableColumn timeColumn = timeColumnViewer.getColumn();
|
||||
timeColumn.setAlignment(SWT.RIGHT);
|
||||
timeColumn.setWidth(150);
|
||||
timeColumn.setText("Start time");
|
||||
timeColumn.setResizable(true);
|
||||
timeColumnViewer.setLabelProvider(new DelegatingStyledCellLabelProvider(new AttributeLabelProvider(waveformViewer, AttributeLabelProvider.TX_TIME)));
|
||||
|
||||
TableViewerColumn valueColumnViewer = new TableViewerColumn(tableViewer, SWT.NONE);
|
||||
valueColumn = valueColumnViewer.getColumn();
|
||||
valueColumn.setWidth(150);
|
||||
valueColumn.setText("Property Value");
|
||||
valueColumn.setResizable(true);
|
||||
valueLabelProvider= new AttributeLabelProvider(waveformViewer, AttributeLabelProvider.VALUE);
|
||||
valueColumnViewer.setLabelProvider(new DelegatingStyledCellLabelProvider(valueLabelProvider));
|
||||
|
||||
// Turn on the header and the lines
|
||||
table.setHeaderVisible(true);
|
||||
table.setLinesVisible(true);
|
||||
new Label(this, SWT.NONE);
|
||||
new Label(this, SWT.NONE);
|
||||
new Label(this, SWT.NONE);
|
||||
new Label(this, SWT.NONE);
|
||||
new Label(this, SWT.NONE);
|
||||
}
|
||||
|
||||
public void setInput(TrackEntry trackEntry) {
|
||||
if(trackEntry==null || !trackEntry.isStream()) {
|
||||
attrNames.clear();
|
||||
tableViewer.setInput(emptyList);
|
||||
} else {
|
||||
stream=trackEntry.getStream();
|
||||
tableViewer.setInput(emptyList);
|
||||
new Thread() {
|
||||
private ConcurrentHashMap<String, DataType> propNames=new ConcurrentHashMap<String, DataType>();
|
||||
|
||||
private List<AttributeNameBean> getEntries() {
|
||||
return propNames.entrySet().stream()
|
||||
.sorted((e1,e2)->e1.getKey().compareTo(e2.getKey()))
|
||||
.map(e -> new AttributeNameBean(e.getKey(), e.getValue()))
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
public void run() {
|
||||
eventList = stream.getEvents().values().parallelStream()
|
||||
.flatMap(List::stream)
|
||||
.filter(evt -> evt.getType()==Type.BEGIN)
|
||||
.map(evt-> {
|
||||
ITx tx = evt.getTransaction();
|
||||
for(ITxAttribute attr: tx.getAttributes()) {
|
||||
propNames.put(attr.getName(), attr.getDataType());
|
||||
}
|
||||
return tx;
|
||||
})
|
||||
.sorted((t1, t2)-> t1.getBeginTime().compareTo(t2.getBeginTime()))
|
||||
.collect(Collectors.toList());
|
||||
getDisplay().asyncExec(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
tableViewer.setInput(eventList);
|
||||
attrNames.clear();
|
||||
attrNames.addAll(getEntries());
|
||||
searchPropComboViewer.getCombo().select(0);
|
||||
txFilter.setSearchProp(attrNames.get(0).getName(), attrNames.get(0).getType());
|
||||
if (searchPropComboViewer!=null) {
|
||||
searchPropComboViewer.setInput(attrNames);
|
||||
searchPropComboViewer.setSelection(new StructuredSelection(searchPropComboViewer.getElementAt(0)));
|
||||
}
|
||||
tableViewer.refresh(true);
|
||||
}
|
||||
});
|
||||
}
|
||||
}.run();
|
||||
}
|
||||
}
|
||||
|
||||
public void setSearchProps(String propName, DataType type, String propValue) {
|
||||
for(int i=0; i<attrNames.size(); ++i) {
|
||||
AttributeNameBean e = attrNames.get(i);
|
||||
if(propName.equals(e.getName()) && type.equals(e.getType())) {
|
||||
searchPropComboViewer.getCombo().select(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
searchPropValue.setText(propValue);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,84 @@
|
||||
package com.minres.scviewer.e4.application.parts;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Named;
|
||||
|
||||
import org.eclipse.e4.core.di.annotations.Optional;
|
||||
import org.eclipse.e4.core.services.events.IEventBroker;
|
||||
import org.eclipse.e4.ui.di.Focus;
|
||||
import org.eclipse.e4.ui.model.application.ui.basic.MPart;
|
||||
import org.eclipse.e4.ui.services.IServiceConstants;
|
||||
import org.eclipse.e4.ui.workbench.modeling.EPartService;
|
||||
import org.eclipse.e4.ui.workbench.modeling.ESelectionService;
|
||||
import org.eclipse.jface.viewers.IStructuredSelection;
|
||||
import org.eclipse.jface.viewers.StructuredSelection;
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.widgets.Composite;
|
||||
|
||||
import com.minres.scviewer.database.ui.TrackEntry;
|
||||
|
||||
public class TransactionListView {
|
||||
private WaveformViewer waveformViewer;
|
||||
|
||||
private TransactionList transactionList;
|
||||
|
||||
/** The event broker. */
|
||||
@Inject IEventBroker eventBroker;
|
||||
|
||||
/** The selection service. */
|
||||
@Inject ESelectionService selectionService;
|
||||
|
||||
/**
|
||||
* Create the composite.
|
||||
* @param parent
|
||||
* @param style
|
||||
*/
|
||||
/**
|
||||
* Creates the composite.
|
||||
*
|
||||
* @param parent the parent
|
||||
*/
|
||||
@PostConstruct
|
||||
public void createComposite(final Composite parent, @Optional WaveformViewer waveformViewer) {
|
||||
this.waveformViewer=waveformViewer;
|
||||
transactionList = new TransactionList(parent, SWT.BORDER, waveformViewer);
|
||||
}
|
||||
|
||||
@Focus
|
||||
public void setFocus() {
|
||||
if(transactionList!=null)
|
||||
transactionList.setFocus();
|
||||
}
|
||||
/**
|
||||
* Sets the selection.
|
||||
*
|
||||
* @param selection the new selection
|
||||
*/
|
||||
@Inject
|
||||
public void setSelection(@Named(IServiceConstants.ACTIVE_SELECTION) @Optional IStructuredSelection selection, EPartService partService){
|
||||
// only react if selection is actually from the WaveformViewer and nothing else
|
||||
MPart part = partService.getActivePart();
|
||||
if( part == null || ! (part.getObject() instanceof WaveformViewer ) || part.getObject() != waveformViewer)
|
||||
return;
|
||||
if(selection==null || selection.isEmpty())
|
||||
transactionList.setInput(null);
|
||||
else if(selection instanceof IStructuredSelection) {
|
||||
TrackEntry e = findTrackEntry(((StructuredSelection)selection).toArray());
|
||||
if(e!=null)
|
||||
transactionList.setInput(e);
|
||||
}
|
||||
}
|
||||
|
||||
private TrackEntry findTrackEntry(Object[] elems) {
|
||||
for(Object o: elems)
|
||||
if(o instanceof TrackEntry)
|
||||
return (TrackEntry)o;
|
||||
return null;
|
||||
}
|
||||
|
||||
public TransactionList getControl() {
|
||||
return transactionList;
|
||||
}
|
||||
|
||||
}
|
@ -31,21 +31,20 @@ import javax.annotation.PostConstruct;
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Named;
|
||||
|
||||
import org.eclipse.core.internal.preferences.InstancePreferences;
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
import org.eclipse.core.runtime.IStatus;
|
||||
import org.eclipse.core.runtime.MultiStatus;
|
||||
import org.eclipse.core.runtime.OperationCanceledException;
|
||||
import org.eclipse.core.runtime.Status;
|
||||
import org.eclipse.core.runtime.SubMonitor;
|
||||
import org.eclipse.core.runtime.jobs.IJobChangeEvent;
|
||||
import org.eclipse.core.runtime.jobs.Job;
|
||||
import org.eclipse.core.runtime.jobs.JobChangeAdapter;
|
||||
import org.eclipse.core.runtime.jobs.JobGroup;
|
||||
import org.eclipse.core.runtime.preferences.ConfigurationScope;
|
||||
import org.eclipse.core.runtime.preferences.DefaultScope;
|
||||
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
|
||||
import org.eclipse.core.runtime.preferences.IEclipsePreferences.IPreferenceChangeListener;
|
||||
import org.eclipse.core.runtime.preferences.IEclipsePreferences.PreferenceChangeEvent;
|
||||
import org.eclipse.e4.core.contexts.ContextInjectionFactory;
|
||||
import org.eclipse.e4.core.contexts.IEclipseContext;
|
||||
import org.eclipse.e4.core.di.annotations.Optional;
|
||||
import org.eclipse.e4.core.di.extensions.Preference;
|
||||
import org.eclipse.e4.core.services.events.IEventBroker;
|
||||
import org.eclipse.e4.ui.di.Focus;
|
||||
import org.eclipse.e4.ui.di.PersistState;
|
||||
@ -56,15 +55,16 @@ import org.eclipse.e4.ui.services.EMenuService;
|
||||
import org.eclipse.e4.ui.workbench.modeling.EPartService;
|
||||
import org.eclipse.e4.ui.workbench.modeling.ESelectionService;
|
||||
import org.eclipse.jface.dialogs.MessageDialog;
|
||||
import org.eclipse.jface.preference.IPreferenceStore;
|
||||
import org.eclipse.jface.resource.StringConverter;
|
||||
import org.eclipse.jface.util.IPropertyChangeListener;
|
||||
import org.eclipse.jface.viewers.ISelection;
|
||||
import org.eclipse.jface.viewers.ISelectionChangedListener;
|
||||
import org.eclipse.jface.viewers.IStructuredSelection;
|
||||
import org.eclipse.jface.viewers.SelectionChangedEvent;
|
||||
import org.eclipse.jface.viewers.StructuredSelection;
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.custom.CTabFolder;
|
||||
import org.eclipse.swt.custom.CTabItem;
|
||||
import org.eclipse.swt.custom.SashForm;
|
||||
import org.eclipse.swt.events.DisposeEvent;
|
||||
import org.eclipse.swt.events.DisposeListener;
|
||||
import org.eclipse.swt.events.FocusListener;
|
||||
@ -74,6 +74,7 @@ import org.eclipse.swt.graphics.Font;
|
||||
import org.eclipse.swt.graphics.Point;
|
||||
import org.eclipse.swt.graphics.RGB;
|
||||
import org.eclipse.swt.graphics.Rectangle;
|
||||
import org.eclipse.swt.layout.FillLayout;
|
||||
import org.eclipse.swt.layout.GridData;
|
||||
import org.eclipse.swt.widgets.Composite;
|
||||
import org.eclipse.swt.widgets.Display;
|
||||
@ -84,7 +85,7 @@ import org.eclipse.swt.widgets.Table;
|
||||
import org.eclipse.swt.widgets.TableColumn;
|
||||
import org.eclipse.swt.widgets.TableItem;
|
||||
import org.eclipse.swt.widgets.Widget;
|
||||
import org.osgi.service.prefs.BackingStoreException;
|
||||
import org.osgi.service.prefs.Preferences;
|
||||
|
||||
import com.minres.scviewer.database.DataType;
|
||||
import com.minres.scviewer.database.ITx;
|
||||
@ -95,24 +96,23 @@ import com.minres.scviewer.database.IWaveform;
|
||||
import com.minres.scviewer.database.IWaveformDb;
|
||||
import com.minres.scviewer.database.IWaveformDbFactory;
|
||||
import com.minres.scviewer.database.RelationType;
|
||||
import com.minres.scviewer.database.swt.Constants;
|
||||
import com.minres.scviewer.database.swt.ToolTipContentProvider;
|
||||
import com.minres.scviewer.database.swt.ToolTipHelpTextProvider;
|
||||
import com.minres.scviewer.database.swt.WaveformViewerFactory;
|
||||
import com.minres.scviewer.database.ui.GotoDirection;
|
||||
import com.minres.scviewer.database.ui.ICursor;
|
||||
import com.minres.scviewer.database.ui.IWaveformViewer;
|
||||
import com.minres.scviewer.database.ui.IWaveformView;
|
||||
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.swt.Constants;
|
||||
import com.minres.scviewer.database.ui.swt.ToolTipContentProvider;
|
||||
import com.minres.scviewer.database.ui.swt.ToolTipHelpTextProvider;
|
||||
import com.minres.scviewer.database.ui.swt.WaveformViewFactory;
|
||||
import com.minres.scviewer.e4.application.Messages;
|
||||
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.IFileChangeListener;
|
||||
import com.minres.scviewer.e4.application.internal.util.IModificationChecker;
|
||||
import com.minres.scviewer.e4.application.preferences.PreferenceConstants;
|
||||
import com.opcoach.e4.preferences.ScopedPreferenceStore;
|
||||
|
||||
/**
|
||||
* The Class WaveformViewerPart.
|
||||
@ -170,11 +170,20 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
|
||||
private static int disposeListenerNumber = 0;
|
||||
|
||||
/** The factory. */
|
||||
WaveformViewerFactory factory = new WaveformViewerFactory();
|
||||
WaveformViewFactory factory = new WaveformViewFactory();
|
||||
|
||||
DesignBrowser browser = null;
|
||||
|
||||
TransactionDetails detailsView = null;
|
||||
|
||||
TransactionListView transactionList = null;
|
||||
|
||||
/** The waveform pane. */
|
||||
private IWaveformViewer waveformPane;
|
||||
private IWaveformView waveformPane;
|
||||
|
||||
private CTabFolder tabFolder;
|
||||
|
||||
private CTabItem tbtmSearchResults;
|
||||
/** get UISynchronize injected as field */
|
||||
@Inject UISynchronize sync;
|
||||
|
||||
@ -194,7 +203,7 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
|
||||
@Inject
|
||||
EPartService ePartService;
|
||||
|
||||
IPreferenceStore store = new ScopedPreferenceStore(ConfigurationScope.INSTANCE, PreferenceConstants.PREFERENCES_SCOPE);
|
||||
IEclipsePreferences store = null;
|
||||
|
||||
@Inject @Optional DesignBrowser designBrowser;
|
||||
|
||||
@ -205,14 +214,16 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
|
||||
private boolean checkForUpdates;
|
||||
|
||||
/** The my part. */
|
||||
private MPart myPart;
|
||||
@Inject private MPart myPart;
|
||||
|
||||
/** The my parent. */
|
||||
private Composite myParent;
|
||||
|
||||
/** The files to load. */
|
||||
ArrayList<File> filesToLoad;
|
||||
ArrayList<File> filesToLoad = new ArrayList<>();
|
||||
|
||||
String partConfig = "";
|
||||
|
||||
/** The persisted state. */
|
||||
Map<String, String> persistedState;
|
||||
|
||||
@ -223,7 +234,7 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
|
||||
private Object detailsSettings;
|
||||
|
||||
/** The navigation relation type. */
|
||||
private RelationType navigationRelationType=IWaveformViewer.NEXT_PREV_IN_STREAM ;
|
||||
private RelationType navigationRelationType=IWaveformView.NEXT_PREV_IN_STREAM ;
|
||||
|
||||
/** The file monitor. */
|
||||
FileMonitor fileMonitor = new FileMonitor();
|
||||
@ -231,6 +242,12 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
|
||||
/** The file checker. */
|
||||
IModificationChecker fileChecker;
|
||||
|
||||
@Inject IWaveformDbFactory dbFactory;
|
||||
|
||||
@Inject Composite parent;
|
||||
|
||||
private Boolean showHover;
|
||||
|
||||
/**
|
||||
* Creates the composite.
|
||||
*
|
||||
@ -239,11 +256,13 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
|
||||
* @param dbFactory the db factory
|
||||
*/
|
||||
@PostConstruct
|
||||
public void createComposite(MPart part, Composite parent, IWaveformDbFactory dbFactory) {
|
||||
public void createComposite(MPart part, EMenuService menuService, @Preference(nodePath = PreferenceConstants.PREFERENCES_SCOPE) IEclipsePreferences prefs, @Preference(value = PreferenceConstants.SHOW_HOVER) Boolean hover) {
|
||||
disposeListenerNumber += 1;
|
||||
|
||||
myPart = part;
|
||||
myParent = parent;
|
||||
store=prefs;
|
||||
showHover=hover;
|
||||
database = dbFactory.getDatabase();
|
||||
database.addPropertyChangeListener(new PropertyChangeListener() {
|
||||
@Override
|
||||
@ -258,13 +277,51 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
|
||||
}
|
||||
}
|
||||
});
|
||||
waveformPane = factory.createPanel(parent);
|
||||
waveformPane.setMaxTime(0);
|
||||
parent.setLayout(new FillLayout(SWT.HORIZONTAL));
|
||||
SashForm sashFormTop = new SashForm(parent, SWT.BORDER | SWT.SMOOTH);
|
||||
|
||||
Composite left = new Composite(sashFormTop, SWT.NONE);
|
||||
|
||||
IEclipseContext ctx = myPart.getContext();
|
||||
ctx.set(WaveformViewer.class, this);
|
||||
ctx.set(IWaveformDb.class, database);
|
||||
ctx.set(Composite.class, left);
|
||||
|
||||
browser = ContextInjectionFactory.make(DesignBrowser.class, ctx);
|
||||
|
||||
//Composite right = new Composite(sashFormTop, SWT.NONE);
|
||||
SashForm sashFormRight = new SashForm(sashFormTop, SWT.BORDER | SWT.SMOOTH | SWT.VERTICAL);
|
||||
sashFormTop.setWeights(new int[] {25, 75});
|
||||
|
||||
Composite rightTop = new Composite(sashFormRight, SWT.NONE);
|
||||
|
||||
waveformPane = factory.createPanel(rightTop);
|
||||
|
||||
tabFolder = new CTabFolder(sashFormRight, SWT.BORDER);
|
||||
tabFolder.setSelectionBackground(Display.getCurrent().getSystemColor(SWT.COLOR_TITLE_INACTIVE_BACKGROUND_GRADIENT));
|
||||
|
||||
CTabItem tbtmDetails = new CTabItem(tabFolder, SWT.NONE);
|
||||
tbtmDetails.setText("Transaction Details");
|
||||
|
||||
ctx.set(Composite.class, tabFolder);
|
||||
detailsView = ContextInjectionFactory.make(TransactionDetails.class, ctx);
|
||||
tbtmDetails.setControl(detailsView.getControl());
|
||||
|
||||
tbtmSearchResults = new CTabItem(tabFolder, SWT.NONE);
|
||||
tbtmSearchResults.setText("Search Results");
|
||||
|
||||
transactionList = ContextInjectionFactory.make(TransactionListView.class, ctx);
|
||||
tbtmSearchResults.setControl(transactionList.getControl());
|
||||
|
||||
sashFormRight.setWeights(new int[] {75, 25});
|
||||
tabFolder.setSelection(0);
|
||||
|
||||
waveformPane.setMaxTime(0);
|
||||
setupColors();
|
||||
//set selection to empty selection when opening a new waveformPane
|
||||
selectionService.setSelection(new StructuredSelection());
|
||||
|
||||
waveformPane.addPropertyChangeListener(IWaveformViewer.CURSOR_PROPERTY, new PropertyChangeListener() {
|
||||
waveformPane.addPropertyChangeListener(IWaveformView.CURSOR_PROPERTY, new PropertyChangeListener() {
|
||||
@Override
|
||||
public void propertyChange(PropertyChangeEvent evt) {
|
||||
Long time = (Long) evt.getNewValue();
|
||||
@ -274,7 +331,7 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
|
||||
|
||||
}
|
||||
});
|
||||
waveformPane.addPropertyChangeListener(IWaveformViewer.MARKER_PROPERTY, new PropertyChangeListener() {
|
||||
waveformPane.addPropertyChangeListener(IWaveformView.MARKER_PROPERTY, new PropertyChangeListener() {
|
||||
@Override
|
||||
public void propertyChange(PropertyChangeEvent evt) {
|
||||
Long time = (Long) evt.getNewValue();
|
||||
@ -348,8 +405,7 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
|
||||
});
|
||||
|
||||
zoomLevel = waveformPane.getZoomLevels();
|
||||
setupColors();
|
||||
checkForUpdates = store.getBoolean(PreferenceConstants.DATABASE_RELOAD);
|
||||
checkForUpdates = store.getBoolean(PreferenceConstants.DATABASE_RELOAD, true);
|
||||
filesToLoad = new ArrayList<File>();
|
||||
persistedState = part.getPersistedState();
|
||||
Integer files = persistedState.containsKey(DATABASE_FILE + "S") //$NON-NLS-1$
|
||||
@ -378,23 +434,6 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
|
||||
}
|
||||
}
|
||||
});
|
||||
store.addPropertyChangeListener(new IPropertyChangeListener() {
|
||||
@Override
|
||||
public void propertyChange(org.eclipse.jface.util.PropertyChangeEvent event) {
|
||||
if (PreferenceConstants.DATABASE_RELOAD.equals(event.getProperty())) {
|
||||
checkForUpdates = (Boolean)event.getNewValue();
|
||||
fileChecker = null;
|
||||
if (checkForUpdates)
|
||||
fileChecker = fileMonitor.addFileChangeListener(WaveformViewer.this, filesToLoad,
|
||||
FILE_CHECK_INTERVAL);
|
||||
else
|
||||
fileMonitor.removeFileChangeListener(WaveformViewer.this);
|
||||
} else if (!PreferenceConstants.SHOW_HOVER.equals(event.getProperty())){
|
||||
setupColors();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
waveformPane.addDisposeListener(this);
|
||||
|
||||
waveformPane.getWaveformControl().setData(Constants.HELP_PROVIDER_TAG, new ToolTipHelpTextProvider() {
|
||||
@ -406,7 +445,7 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
|
||||
waveformPane.getWaveformControl().setData(Constants.CONTENT_PROVIDER_TAG, new ToolTipContentProvider() {
|
||||
@Override
|
||||
public boolean createContent(Composite parent, Point pt) {
|
||||
if(!store.getBoolean(PreferenceConstants.SHOW_HOVER)) return false;
|
||||
if(!showHover) return false;
|
||||
List<Object> res = waveformPane.getElementsAt(pt);
|
||||
if(res.size()>0)
|
||||
if(res.get(0) instanceof ITx) {
|
||||
@ -476,8 +515,6 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
|
||||
final Font font = new Font(Display.getCurrent(), "Terminal", 10, SWT.NORMAL);
|
||||
|
||||
final Label label = new Label(parent, SWT.NONE);
|
||||
//label.setForeground(display.getSystemColor(SWT.COLOR_INFO_FOREGROUND));
|
||||
//label.setBackground(display.getSystemColor(SWT.COLOR_INFO_BACKGROUND));
|
||||
label.setText(te.waveform.getFullName());
|
||||
label.setFont(font);
|
||||
GridData labelGridData = new GridData();
|
||||
@ -491,35 +528,49 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
|
||||
});
|
||||
}
|
||||
|
||||
@Inject
|
||||
@Optional
|
||||
public void reactOnPrefsChange(@Preference(nodePath = PreferenceConstants.PREFERENCES_SCOPE) IEclipsePreferences prefs) {
|
||||
prefs.addPreferenceChangeListener(this);
|
||||
|
||||
}
|
||||
|
||||
@Inject
|
||||
@Optional
|
||||
public void reactOnShowHoverChange(@Preference(nodePath = PreferenceConstants.PREFERENCES_SCOPE, value = PreferenceConstants.SHOW_HOVER) Boolean hover) {
|
||||
showHover=hover;
|
||||
}
|
||||
|
||||
@Inject
|
||||
@Optional
|
||||
public void reactOnReloadDatabaseChange(@Preference(nodePath = PreferenceConstants.PREFERENCES_SCOPE, value = PreferenceConstants.DATABASE_RELOAD) Boolean checkForUpdates) {
|
||||
if (checkForUpdates) {
|
||||
fileChecker = fileMonitor.addFileChangeListener(WaveformViewer.this, filesToLoad, FILE_CHECK_INTERVAL);
|
||||
} else {
|
||||
fileMonitor.removeFileChangeListener(WaveformViewer.this);
|
||||
fileChecker = null;
|
||||
}
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.core.runtime.preferences.IEclipsePreferences.IPreferenceChangeListener#preferenceChange(org.eclipse.core.runtime.preferences.IEclipsePreferences.PreferenceChangeEvent)
|
||||
*/
|
||||
@Override
|
||||
public void preferenceChange(PreferenceChangeEvent event) {
|
||||
InstancePreferences pref = (InstancePreferences)event.getSource();
|
||||
if (PreferenceConstants.DATABASE_RELOAD.equals(event.getKey())) {
|
||||
checkForUpdates = pref.getBoolean(PreferenceConstants.DATABASE_RELOAD, true);
|
||||
fileChecker = null;
|
||||
if (checkForUpdates)
|
||||
fileChecker = fileMonitor.addFileChangeListener(WaveformViewer.this, filesToLoad,
|
||||
FILE_CHECK_INTERVAL);
|
||||
else
|
||||
fileMonitor.removeFileChangeListener(this);
|
||||
} else if (!PreferenceConstants.SHOW_HOVER.equals(event.getKey())){
|
||||
if (!PreferenceConstants.DATABASE_RELOAD.equals(event.getKey()) && !PreferenceConstants.SHOW_HOVER.equals(event.getKey())){
|
||||
setupColors();
|
||||
}
|
||||
try {
|
||||
pref.flush();
|
||||
} catch (BackingStoreException e) { }
|
||||
}
|
||||
|
||||
/**
|
||||
* Setup colors.
|
||||
*/
|
||||
protected void setupColors() {
|
||||
Preferences defaultPrefs= store.parent().parent().node("/"+DefaultScope.SCOPE+"/"+PreferenceConstants.PREFERENCES_SCOPE);
|
||||
HashMap<WaveformColors, RGB> colorPref = new HashMap<>();
|
||||
for (WaveformColors c : WaveformColors.values()) {
|
||||
String prefValue = store.getString(c.name() + "_COLOR"); //$NON-NLS-1$
|
||||
String key = c.name() + "_COLOR";
|
||||
String prefValue = store.get(key, defaultPrefs.get(key, "")); //$NON-NLS-1$
|
||||
RGB rgb = StringConverter.asRGB(prefValue);
|
||||
colorPref.put(c, rgb);
|
||||
}
|
||||
@ -535,9 +586,7 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
|
||||
|
||||
@Override
|
||||
protected IStatus run(IProgressMonitor monitor) {
|
||||
monitor.setTaskName(Messages.WaveformViewer_16+file.getName());
|
||||
boolean res = database.load(file);
|
||||
monitor.done();
|
||||
database.addPropertyChangeListener(waveformPane);
|
||||
return res?Status.OK_STATUS:Status.CANCEL_STATUS;
|
||||
}
|
||||
@ -548,16 +597,19 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
|
||||
* @param state the state
|
||||
*/
|
||||
protected void loadDatabase(final Map<String, String> state) {
|
||||
loadDatabase(state, 1000L);
|
||||
}
|
||||
|
||||
protected void loadDatabase(final Map<String, String> state, long delay) {
|
||||
fileMonitor.removeFileChangeListener(this);
|
||||
MultiStatus fStatus= new MultiStatus("blah", IStatus.OK, Messages.WaveformViewer_13, null);
|
||||
Job job = new Job(Messages.WaveformViewer_15) {
|
||||
@Override
|
||||
protected IStatus run(IProgressMonitor monitor) {
|
||||
SubMonitor subMonitor = SubMonitor.convert(monitor, filesToLoad.size());
|
||||
IProgressMonitor progressGroup = getJobManager().createProgressGroup();
|
||||
JobGroup jobGroup = new JobGroup(Messages.WaveformViewer_15, filesToLoad.size(), filesToLoad.size());
|
||||
filesToLoad.forEach((final File file) -> {
|
||||
Job job = new DbLoadJob(Messages.WaveformViewer_16 + file.getName(), file);
|
||||
job.setProgressGroup(subMonitor, 1);
|
||||
job.setProgressGroup(progressGroup, 1);
|
||||
job.setJobGroup(jobGroup);
|
||||
job.schedule();
|
||||
});
|
||||
@ -569,36 +621,31 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
|
||||
if (monitor.isCanceled())
|
||||
throw new OperationCanceledException(Messages.WaveformViewer_14);
|
||||
|
||||
fStatus.addAll(jobGroup.getResult());
|
||||
return fStatus;
|
||||
}
|
||||
};
|
||||
job.addJobChangeListener(new JobChangeAdapter() {
|
||||
@Override
|
||||
public void done(IJobChangeEvent event) {
|
||||
IStatus result = event.getResult();
|
||||
|
||||
IStatus result = jobGroup.getResult();
|
||||
if( (!result.isMultiStatus() && result.getCode() != Status.OK_STATUS.getCode() ) ||
|
||||
(result.isMultiStatus() && result.getChildren().length > 0 && result.getChildren()[0].getCode() != Status.OK_STATUS.getCode() ) ){
|
||||
(result.isMultiStatus() && result.getChildren().length > 0 && result.getChildren()[0].getCode() != Status.OK_STATUS.getCode() ) ){
|
||||
// kill editor and pop up warning for user
|
||||
sync.asyncExec(() -> {
|
||||
final Display display = myParent.getDisplay();
|
||||
MessageDialog.openWarning(display.getActiveShell(), "Error loading database", "Database cannot be loaded. Aborting...");
|
||||
ePartService.hidePart(myPart, true);
|
||||
ePartService.hidePart(myPart, true);
|
||||
});
|
||||
return;
|
||||
}
|
||||
sync.asyncExec(()->{
|
||||
waveformPane.setMaxTime(database.getMaxTime());
|
||||
if (state != null)
|
||||
restoreWaveformViewerState(state);
|
||||
fileChecker = null;
|
||||
if (checkForUpdates)
|
||||
fileChecker = fileMonitor.addFileChangeListener(WaveformViewer.this, filesToLoad, FILE_CHECK_INTERVAL);
|
||||
});
|
||||
} else
|
||||
sync.asyncExec(()->{
|
||||
waveformPane.setMaxTime(database.getMaxTime());
|
||||
if (state != null)
|
||||
restoreWaveformViewerState(state);
|
||||
fileChecker = null;
|
||||
if (checkForUpdates)
|
||||
fileChecker = fileMonitor.addFileChangeListener(WaveformViewer.this, filesToLoad, FILE_CHECK_INTERVAL);
|
||||
});
|
||||
return result;
|
||||
}
|
||||
});
|
||||
};
|
||||
job.setName("Load Database");
|
||||
job.setSystem(true);
|
||||
job.schedule(1000L); // let the UI initialize so that we have a progress monitor
|
||||
job.schedule(delay); // let the UI initialize so that we have a progress monitor
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
@ -612,18 +659,23 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
|
||||
public void run() {
|
||||
if (MessageDialog.openQuestion(display.getActiveShell(), Messages.WaveformViewer_17,
|
||||
Messages.WaveformViewer_18)) {
|
||||
Map<String, String> state = new HashMap<>();
|
||||
saveWaveformViewerState(state);
|
||||
waveformPane.getStreamList().clear();
|
||||
database.clear();
|
||||
if (filesToLoad.size() > 0)
|
||||
loadDatabase(state);
|
||||
reloadDatabase();
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
fileMonitor.removeFileChangeListener(this);
|
||||
}
|
||||
|
||||
public void reloadDatabase() {
|
||||
Map<String, String> state = new HashMap<>();
|
||||
saveWaveformViewerState(state);
|
||||
waveformPane.getStreamList().clear();
|
||||
database.clear();
|
||||
if (filesToLoad.size() > 0)
|
||||
loadDatabase(state, 0L);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the part input.
|
||||
*
|
||||
@ -631,48 +683,21 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
|
||||
*/
|
||||
@Inject
|
||||
@Optional
|
||||
public void setPartInput(@Named("input") Object partInput, @Named("config") Object partConfig) {
|
||||
if (partInput instanceof String) {
|
||||
String name = (String)partInput;
|
||||
filesToLoad = new ArrayList<File>();
|
||||
boolean explicit = name.contains(",");
|
||||
for(String tok: name.split(",")) {
|
||||
File file = new File(tok);
|
||||
if(file.isFile() && "CURRENT".equals(file.getName())){
|
||||
file=file.getParentFile();
|
||||
}
|
||||
if (file.exists()) {
|
||||
filesToLoad.add(file);
|
||||
}
|
||||
if(!explicit)
|
||||
try {
|
||||
String ext = getFileExtension(file.getName());
|
||||
if (Messages.WaveformViewer_19.equals(ext.toLowerCase())) {
|
||||
if (askIfToLoad(new File(renameFileExtension(file.getCanonicalPath(), Messages.WaveformViewer_20)))) {
|
||||
filesToLoad.add(new File(renameFileExtension(file.getCanonicalPath(), Messages.WaveformViewer_20)));
|
||||
} else if (askIfToLoad(new File(renameFileExtension(file.getCanonicalPath(), Messages.WaveformViewer_21)))) {
|
||||
filesToLoad.add(new File(renameFileExtension(file.getCanonicalPath(), Messages.WaveformViewer_21)));
|
||||
} else if (askIfToLoad(new File(renameFileExtension(file.getCanonicalPath(), Messages.WaveformViewer_22)))) {
|
||||
filesToLoad.add(new File(renameFileExtension(file.getCanonicalPath(), Messages.WaveformViewer_22)));
|
||||
}
|
||||
} else if (Messages.WaveformViewer_20.equals(ext.toLowerCase()) ||
|
||||
Messages.WaveformViewer_21.equals(ext.toLowerCase()) ||
|
||||
Messages.WaveformViewer_22.equals(ext.toLowerCase())
|
||||
) {
|
||||
if (askIfToLoad(new File(renameFileExtension(file.getCanonicalPath(), Messages.WaveformViewer_19)))) {
|
||||
filesToLoad.add(new File(renameFileExtension(file.getCanonicalPath(), Messages.WaveformViewer_19)));
|
||||
}
|
||||
}
|
||||
} catch (IOException e) { // silently ignore any error
|
||||
}
|
||||
|
||||
}
|
||||
if (filesToLoad.size() > 0)
|
||||
loadDatabase(persistedState);
|
||||
if(partConfig instanceof String && ((String)partConfig).length()>0) {
|
||||
loadState((String) partConfig);
|
||||
}
|
||||
public void setPartInput(@Named("input") List<String> partInput, @Named("config") String partConfig) {
|
||||
for(String s:partInput) {
|
||||
File file = new File(s);
|
||||
if(file.isFile() && "CURRENT".equals(file.getName()))
|
||||
file=file.getParentFile();
|
||||
if (file.exists())
|
||||
filesToLoad.add(file);
|
||||
}
|
||||
if(partConfig!=null) {
|
||||
this.partConfig=partConfig;
|
||||
}
|
||||
if (filesToLoad.size() > 0)
|
||||
loadDatabase(persistedState);
|
||||
if(partConfig.length()>0)
|
||||
loadState(partConfig);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -680,7 +705,7 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
|
||||
*/
|
||||
@Focus
|
||||
public void setFocus() {
|
||||
waveformPane.getWaveformControl().setFocus();
|
||||
if(waveformPane!=null) waveformPane.getWaveformControl().setFocus();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -773,10 +798,10 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
|
||||
// get selected transaction of a stream
|
||||
ISelection selection = waveformPane.getSelection();
|
||||
if (!selection.isEmpty()) {
|
||||
List<Object> t = getISelection(selection);
|
||||
if(t.get(0) instanceof ITx) {
|
||||
ITx tx = (ITx) t.get(0);
|
||||
TrackEntry te = (TrackEntry) t.get(1);
|
||||
List<Object> sel = getISelection(selection);
|
||||
if(sel.size()>1 && sel.get(0) instanceof ITx && sel.get(1) instanceof TrackEntry) {
|
||||
ITx tx = (ITx) sel.get(0);
|
||||
TrackEntry te = (TrackEntry) sel.get(1);
|
||||
// get transaction id
|
||||
persistedState.put(SELECTED_TX_ID, Long.toString(tx.getId()));
|
||||
//get TrackEntry name
|
||||
@ -1009,68 +1034,36 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
|
||||
waveformPane.getStreamList().addAll(streams);
|
||||
} else {
|
||||
Object first = selection.getFirstElement();
|
||||
IWaveform stream = (first instanceof ITx) ? ((ITx) first).getStream() : (IWaveform) first;
|
||||
TrackEntry trackEntry = waveformPane.getEntryForStream(stream);
|
||||
if (insert) {
|
||||
int index = waveformPane.getStreamList().indexOf(trackEntry);
|
||||
waveformPane.getStreamList().addAll(index, streams);
|
||||
} else {
|
||||
waveformPane.getStreamList().addAll(streams);
|
||||
if(first instanceof ITx) {
|
||||
IWaveform stream = (first instanceof ITx) ? ((ITx) first).getStream() : (IWaveform) first;
|
||||
TrackEntry trackEntry = waveformPane.getEntryForStream(stream);
|
||||
if (insert) {
|
||||
int index = waveformPane.getStreamList().indexOf(trackEntry);
|
||||
waveformPane.getStreamList().addAll(index, streams);
|
||||
} else {
|
||||
waveformPane.getStreamList().addAll(streams);
|
||||
}
|
||||
} else if(first instanceof TrackEntry) {
|
||||
TrackEntry trackEntry = (TrackEntry) first;
|
||||
if (insert) {
|
||||
int index = waveformPane.getStreamList().indexOf(trackEntry);
|
||||
waveformPane.getStreamList().addAll(index, streams);
|
||||
} else {
|
||||
waveformPane.getStreamList().addAll(streams);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
setFocus();
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes the stream from list.
|
||||
*
|
||||
* @param stream the stream
|
||||
*/
|
||||
public void removeStreamFromList(IWaveform stream) {
|
||||
TrackEntry trackEntry = waveformPane.getEntryForStream(stream);
|
||||
List<TrackEntry> streams = waveformPane.getStreamList();
|
||||
ISelection sel = waveformPane.getSelection();
|
||||
TrackEntry newSelection=null;
|
||||
|
||||
if(sel instanceof IStructuredSelection && ((IStructuredSelection) sel).size()==2) {
|
||||
Iterator<?> it = ((IStructuredSelection)sel).iterator();
|
||||
it.next();
|
||||
int idx = streams.indexOf(it.next());
|
||||
|
||||
if(idx==streams.size()-1) {
|
||||
//last stream gets deleted, no more selection
|
||||
if(idx==0) {
|
||||
newSelection=null;
|
||||
}
|
||||
//more than 1 stream left, last gets deleted, selection jumps to new last stream
|
||||
else {
|
||||
newSelection=streams.get(idx-1);
|
||||
}
|
||||
}
|
||||
//more than 1 stream left, any stream but the last gets deleted, selection jumps to the next stream
|
||||
else {
|
||||
newSelection=streams.get(idx+1);
|
||||
}
|
||||
}
|
||||
waveformPane.setSelection(new StructuredSelection());
|
||||
streams.remove(trackEntry);
|
||||
if(newSelection!=null) {
|
||||
Object[] o = {newSelection};
|
||||
waveformPane.setSelection(new StructuredSelection(o));
|
||||
}
|
||||
public void removeSelectedStreamsFromList() {
|
||||
waveformPane.deleteSelectedTracks();
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes the streams from list.
|
||||
*
|
||||
* @param iWaveforms the i waveforms
|
||||
*/
|
||||
public void removeStreamsFromList(IWaveform[] iWaveforms) {
|
||||
for (IWaveform stream : iWaveforms)
|
||||
removeStreamFromList(stream);
|
||||
public void removeStreamFromList(ISelection sel) {
|
||||
waveformPane.deleteSelectedTracks();
|
||||
}
|
||||
|
||||
/**
|
||||
* Move selected.
|
||||
*
|
||||
@ -1167,7 +1160,10 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
|
||||
* @return the selection
|
||||
*/
|
||||
public ISelection getSelection() {
|
||||
return waveformPane.getSelection();
|
||||
if(waveformPane!=null)
|
||||
return waveformPane.getSelection();
|
||||
else
|
||||
return new StructuredSelection();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1232,7 +1228,7 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
|
||||
*/
|
||||
public List<RelationType> getAllRelationTypes() {
|
||||
List<RelationType> res =new ArrayList<>();
|
||||
res.add(IWaveformViewer.NEXT_PREV_IN_STREAM);
|
||||
res.add(IWaveformView.NEXT_PREV_IN_STREAM);
|
||||
res.addAll(database.getAllRelationTypes());
|
||||
return res;
|
||||
}
|
||||
@ -1244,7 +1240,7 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
|
||||
*/
|
||||
public List<RelationType> getSelectionRelationTypes() {
|
||||
List<RelationType> res =new ArrayList<>();
|
||||
res.add(IWaveformViewer.NEXT_PREV_IN_STREAM);
|
||||
res.add(IWaveformView.NEXT_PREV_IN_STREAM);
|
||||
ISelection selection = waveformPane.getSelection();
|
||||
if(selection instanceof IStructuredSelection && !selection.isEmpty()){
|
||||
IStructuredSelection sel=(IStructuredSelection) selection;
|
||||
@ -1319,4 +1315,15 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
|
||||
}
|
||||
}
|
||||
|
||||
public void showSearch() {
|
||||
tabFolder.setSelection(tbtmSearchResults);
|
||||
}
|
||||
|
||||
public void search(String propName, DataType type, String propValue) {
|
||||
// StructuredSelection sel = (StructuredSelection) getSelection();
|
||||
// TrackEntry e = findTrackEntry((sel).toArray());
|
||||
// if(e==null) return;
|
||||
tabFolder.setSelection(tbtmSearchResults);
|
||||
transactionList.getControl().setSearchProps(propName, type, propValue);
|
||||
}
|
||||
}
|
@ -0,0 +1,103 @@
|
||||
package com.minres.scviewer.e4.application.parts.txTableTree;
|
||||
|
||||
import java.util.Vector;
|
||||
|
||||
import org.eclipse.jface.viewers.ITreeContentProvider;
|
||||
import org.eclipse.jface.viewers.Viewer;
|
||||
|
||||
import com.minres.scviewer.database.ITx;
|
||||
import com.minres.scviewer.database.ITxRelation;
|
||||
import com.minres.scviewer.e4.application.Messages;
|
||||
import com.minres.scviewer.e4.application.parts.WaveformViewer;
|
||||
|
||||
/**
|
||||
* The Class TransactionTreeContentProvider.
|
||||
*/
|
||||
public abstract class AbstractTransactionTreeContentProvider implements ITreeContentProvider {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private final WaveformViewer waveformViewerPart;
|
||||
|
||||
/**
|
||||
* @param transactionDetails
|
||||
*/
|
||||
public AbstractTransactionTreeContentProvider(WaveformViewer waveformViewerPart) {
|
||||
this.waveformViewerPart = waveformViewerPart;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.jface.viewers.IContentProvider#dispose()
|
||||
*/
|
||||
@Override
|
||||
public void dispose() { }
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)
|
||||
*/
|
||||
@Override
|
||||
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.jface.viewers.ITreeContentProvider#getChildren(java.lang.Object)
|
||||
*/
|
||||
@Override
|
||||
public Object[] getChildren(Object element) {
|
||||
if(element instanceof ITx) {
|
||||
return new Object[]{new TransactionTreeNode((ITx)element, TransactionTreeNodeType.ATTRS)};
|
||||
} else if(element instanceof TransactionTreeNode){
|
||||
TransactionTreeNode node=(TransactionTreeNode) element;
|
||||
switch(node.type) {
|
||||
case PROPS:
|
||||
return new Object[][]{
|
||||
{Messages.TransactionDetails_1, Messages.TransactionDetails_16, node.element.getStream().getFullName()},
|
||||
{Messages.TransactionDetails_2, Messages.TransactionDetails_16, node.element.getGenerator().getName()},
|
||||
{Messages.TransactionDetails_19, Messages.TransactionDetails_20, waveformViewerPart.getScaledTime(node.element.getBeginTime())},
|
||||
{Messages.TransactionDetails_21, Messages.TransactionDetails_20, waveformViewerPart.getScaledTime(node.element.getEndTime())}
|
||||
};
|
||||
case TX:
|
||||
case ATTRS:
|
||||
case HIER:
|
||||
return node.getAttributeListForHier();
|
||||
case IN_REL:
|
||||
Vector<Object[] > res_in = new Vector<>();
|
||||
for(ITxRelation rel:node.element.getIncomingRelations()){
|
||||
res_in.add(new Object[]{
|
||||
rel.getRelationType(),
|
||||
rel.getSource().getGenerator().getName(),
|
||||
rel.getSource()});
|
||||
}
|
||||
return res_in.toArray();
|
||||
case OUT_REL:
|
||||
Vector<Object[] > res_out = new Vector<>();
|
||||
for(ITxRelation rel:node.element.getOutgoingRelations()){
|
||||
res_out.add(new Object[]{
|
||||
rel.getRelationType(),
|
||||
rel.getTarget().getGenerator().getName(),
|
||||
rel.getTarget()});
|
||||
}
|
||||
return res_out.toArray();
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.jface.viewers.ITreeContentProvider#getParent(java.lang.Object)
|
||||
*/
|
||||
@Override
|
||||
public Object getParent(Object element) {
|
||||
return null;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.jface.viewers.ITreeContentProvider#hasChildren(java.lang.Object)
|
||||
*/
|
||||
@Override
|
||||
public boolean hasChildren(Object element) {
|
||||
return getChildren(element)!=null;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,186 @@
|
||||
package com.minres.scviewer.e4.application.parts.txTableTree;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.eclipse.jface.viewers.LabelProvider;
|
||||
import org.eclipse.jface.viewers.StyledString;
|
||||
import org.eclipse.jface.viewers.DelegatingStyledCellLabelProvider.IStyledLabelProvider;
|
||||
|
||||
import com.minres.scviewer.database.DataType;
|
||||
import com.minres.scviewer.database.ITx;
|
||||
import com.minres.scviewer.database.ITxAttribute;
|
||||
import com.minres.scviewer.database.ITxRelation;
|
||||
import com.minres.scviewer.e4.application.Messages;
|
||||
import com.minres.scviewer.e4.application.parts.WaveformViewer;
|
||||
|
||||
/**
|
||||
* The Class AttributeLabelProvider.
|
||||
*/
|
||||
public class AttributeLabelProvider extends LabelProvider implements IStyledLabelProvider {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private final WaveformViewer waveformViewerPart;
|
||||
|
||||
/** The field. */
|
||||
final int field;
|
||||
|
||||
/** The Constant NAME. */
|
||||
public static final int NAME=0;
|
||||
|
||||
/** The Constant TYPE. */
|
||||
public static final int TYPE=1;
|
||||
|
||||
/** The Constant VALUE. */
|
||||
public static final int VALUE=2;
|
||||
|
||||
/** The Constant VALUE. */
|
||||
public static final int TX_TIME=3;
|
||||
|
||||
String showProp;
|
||||
|
||||
public String getShowProp() {
|
||||
return showProp;
|
||||
}
|
||||
|
||||
public void setShowProp(String showProp) {
|
||||
this.showProp = showProp;
|
||||
}
|
||||
|
||||
/**
|
||||
* Instantiates a new attribute label provider.
|
||||
*
|
||||
* @param field the field
|
||||
* @param transactionDetails TODO
|
||||
*/
|
||||
public AttributeLabelProvider(WaveformViewer waveformViewerPart, int field) {
|
||||
this.waveformViewerPart = waveformViewerPart;
|
||||
this.field=field;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.jface.viewers.DelegatingStyledCellLabelProvider.IStyledLabelProvider#getStyledText(java.lang.Object)
|
||||
*/
|
||||
@Override
|
||||
public StyledString getStyledText(Object element) {
|
||||
if(element instanceof ITx) {
|
||||
ITx iTx = (ITx) element;
|
||||
switch(field){
|
||||
case NAME:
|
||||
return new StyledString(iTx.getId().toString());
|
||||
case TX_TIME:
|
||||
return new StyledString(waveformViewerPart.getScaledTime(iTx.getBeginTime()));
|
||||
case TYPE:
|
||||
if(showProp!=null){
|
||||
List<ITxAttribute> res = iTx.getAttributes().stream().filter(a -> showProp.equals(a.getName())).collect(Collectors.toList());
|
||||
if(res.size()==1)
|
||||
return new StyledString(res.get(0).getDataType().toString());
|
||||
}
|
||||
return new StyledString("");
|
||||
case VALUE:
|
||||
if(showProp!=null){
|
||||
List<ITxAttribute> res = iTx.getAttributes().stream().filter(a -> showProp.equals(a.getName())).collect(Collectors.toList());
|
||||
if(res.size()==1)
|
||||
return getAttrValueAsStyledString(res.get(0));
|
||||
}
|
||||
return new StyledString("");
|
||||
}
|
||||
} else {
|
||||
switch(field){
|
||||
case NAME:
|
||||
if (element instanceof ITxAttribute) {
|
||||
ITxAttribute attribute = (ITxAttribute) element;
|
||||
String[] tokens = attribute.getName().split("\\.");
|
||||
return new StyledString(tokens[tokens.length-1]);
|
||||
}else if (element instanceof ITxRelation) {
|
||||
return new StyledString(Messages.TransactionDetails_4);
|
||||
}else if(element instanceof Object[]){
|
||||
Object[] elements = (Object[]) element;
|
||||
return new StyledString(elements[field].toString());
|
||||
} else
|
||||
return new StyledString(element.toString());
|
||||
case TYPE:
|
||||
if(element instanceof TransactionTreeNode) {
|
||||
if(showProp!=null){
|
||||
ITx iTx = ((TransactionTreeNode) element).element;
|
||||
List<ITxAttribute> res = iTx.getAttributes().stream().filter(a -> showProp.equals(a.getName())).collect(Collectors.toList());
|
||||
if(res.size()==1)
|
||||
return new StyledString(res.get(0).getDataType().toString());
|
||||
}
|
||||
return new StyledString("");
|
||||
} else if (element instanceof ITxAttribute) {
|
||||
ITxAttribute attribute = (ITxAttribute) element;
|
||||
return new StyledString(attribute.getDataType().toString());
|
||||
} else if(element instanceof Object[]){
|
||||
Object[] elements = (Object[]) element;
|
||||
return new StyledString(elements[field].toString());
|
||||
} else
|
||||
return new StyledString(""); //$NON-NLS-1$
|
||||
case TX_TIME:
|
||||
if(element instanceof TransactionTreeNode) {
|
||||
ITx iTx = ((TransactionTreeNode) element).element;
|
||||
return new StyledString(waveformViewerPart.getScaledTime(iTx.getBeginTime()));
|
||||
}
|
||||
case VALUE:
|
||||
if(element instanceof TransactionTreeNode) {
|
||||
if(showProp!=null){
|
||||
ITx iTx = ((TransactionTreeNode) element).element;
|
||||
List<ITxAttribute> res = iTx.getAttributes().stream().filter(a -> showProp.equals(a.getName())).collect(Collectors.toList());
|
||||
if(res.size()==1)
|
||||
return getAttrValueAsStyledString(res.get(0));
|
||||
}
|
||||
return new StyledString("");
|
||||
} else if (element instanceof ITxAttribute) {
|
||||
ITxAttribute attribute = (ITxAttribute) element;
|
||||
return getAttrValueAsStyledString(attribute);
|
||||
} else if(element instanceof Object[]){
|
||||
Object[] elements = (Object[]) element;
|
||||
Object o = elements[field];
|
||||
if(o instanceof ITx) {
|
||||
ITx tx = (ITx)o;
|
||||
return new StyledString(this.txToString(tx)+" ("+tx.getStream().getFullName()+")");
|
||||
} else
|
||||
return new StyledString(o.toString());
|
||||
} else if(element instanceof ITx){
|
||||
return new StyledString(this.txToString((ITx) element));
|
||||
}
|
||||
}
|
||||
}
|
||||
return new StyledString(""); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
public StyledString getAttrValueAsStyledString(ITxAttribute attribute) {
|
||||
String value = attribute.getValue().toString();
|
||||
if((DataType.UNSIGNED == attribute.getDataType() || DataType.INTEGER==attribute.getDataType()) && !"0".equals(value)) {
|
||||
try {
|
||||
value += " [0x"+Long.toHexString(Long.parseLong(attribute.getValue().toString()))+"]";
|
||||
} catch(NumberFormatException e) { }
|
||||
}
|
||||
return new StyledString(value);
|
||||
}
|
||||
/**
|
||||
* Tx to string.
|
||||
*
|
||||
* @param tx the tx
|
||||
* @return the string
|
||||
*/
|
||||
String txToString(ITx tx){
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("tx#").append(tx.getId()).append("[").append(timeToString(tx.getBeginTime())); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
sb.append(" - ").append(timeToString(tx.getEndTime())).append("]"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Time to string.
|
||||
*
|
||||
* @param time the time
|
||||
* @return the string
|
||||
*/
|
||||
String timeToString(Long time){
|
||||
return waveformViewerPart.getScaledTime(time);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,96 @@
|
||||
package com.minres.scviewer.e4.application.parts.txTableTree;
|
||||
|
||||
import java.util.AbstractMap;
|
||||
import java.util.Map;
|
||||
import java.util.TreeMap;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import com.minres.scviewer.database.ITx;
|
||||
import com.minres.scviewer.e4.application.Messages;
|
||||
|
||||
/**
|
||||
* The Class TreeNode.
|
||||
*/
|
||||
public class TransactionTreeNode implements Comparable<TransactionTreeNode>{
|
||||
|
||||
/** The type. */
|
||||
public TransactionTreeNodeType type;
|
||||
|
||||
/** The element. */
|
||||
public ITx element;
|
||||
|
||||
private String hier_path;
|
||||
/**
|
||||
* Instantiates a new tree node.
|
||||
*
|
||||
* @param element the element
|
||||
* @param type the type
|
||||
*/
|
||||
public TransactionTreeNode(ITx element, TransactionTreeNodeType type){
|
||||
this.element=element;
|
||||
this.type=type;
|
||||
this.hier_path="";
|
||||
}
|
||||
|
||||
public TransactionTreeNode(ITx element, String path){
|
||||
this.element=element;
|
||||
this.type=TransactionTreeNodeType.HIER;
|
||||
this.hier_path=path;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see java.lang.Object#toString()
|
||||
*/
|
||||
public String toString(){
|
||||
switch(type){
|
||||
case TX: return "tx#"+element.getId();
|
||||
case PROPS: return Messages.TransactionDetails_10;
|
||||
case ATTRS: return Messages.TransactionDetails_11;
|
||||
case IN_REL: return Messages.TransactionDetails_12;
|
||||
case OUT_REL: return Messages.TransactionDetails_13;
|
||||
case HIER:{
|
||||
String[] tokens = hier_path.split("\\.");
|
||||
return tokens[tokens.length-1];
|
||||
}
|
||||
}
|
||||
return ""; //$NON-NLS-1$
|
||||
}
|
||||
|
||||
public Object[] getAttributeListForHier() {
|
||||
if(childs==null) {
|
||||
Map<String, Object> res = element.getAttributes().stream()
|
||||
.filter(txAttr -> txAttr.getName().startsWith(hier_path))
|
||||
.map(txAttr -> {
|
||||
String target = hier_path.length()==0?txAttr.getName():txAttr.getName().replace(hier_path+'.', "");
|
||||
String[] tokens = target.split("\\.");
|
||||
if(tokens.length==1)
|
||||
return new AbstractMap.SimpleEntry<>(tokens[0], txAttr);
|
||||
else
|
||||
return new AbstractMap.SimpleEntry<>(tokens[0], new TransactionTreeNode(element, hier_path.length()>0?hier_path+"."+tokens[0]:tokens[0]));
|
||||
})
|
||||
.collect(Collectors.toMap(p -> p.getKey(), p -> p.getValue(), (first, second) -> first));
|
||||
childs = new TreeMap<String, Object>(res).values().toArray();
|
||||
}
|
||||
return childs;
|
||||
}
|
||||
|
||||
private Object[] childs=null;
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if(o instanceof TransactionTreeNode) {
|
||||
TransactionTreeNode t = (TransactionTreeNode) o;
|
||||
return type==t.type && hier_path.equals(t.hier_path);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(TransactionTreeNode o) {
|
||||
int res1 = type.compareTo(o.type);
|
||||
if(res1==0) {
|
||||
return hier_path.compareTo(o.hier_path);
|
||||
} else
|
||||
return res1;
|
||||
}
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
package com.minres.scviewer.e4.application.parts.txTableTree;
|
||||
|
||||
/**
|
||||
* The Enum Type.
|
||||
*/
|
||||
public enum TransactionTreeNodeType {
|
||||
TX, /** The transaction. */
|
||||
PROPS, /** The props. */
|
||||
ATTRS, /** The attrs. */
|
||||
IN_REL, /** The in rel. */
|
||||
OUT_REL,/** The out rel. */
|
||||
HIER
|
||||
}
|
@ -0,0 +1,55 @@
|
||||
package com.minres.scviewer.e4.application.parts.txTableTree;
|
||||
|
||||
import java.util.regex.PatternSyntaxException;
|
||||
|
||||
import org.eclipse.jface.viewers.Viewer;
|
||||
import org.eclipse.jface.viewers.ViewerFilter;
|
||||
|
||||
import com.minres.scviewer.database.ITxAttribute;
|
||||
|
||||
/**
|
||||
* The Class TxAttributeFilter.
|
||||
*/
|
||||
public class TxAttributeFilter extends ViewerFilter {
|
||||
|
||||
/** The search string. */
|
||||
private String searchString;
|
||||
|
||||
/**
|
||||
* Sets the search text.
|
||||
*
|
||||
* @param s the new search text
|
||||
*/
|
||||
public void setSearchText(String s) {
|
||||
this.searchString = ".*" + s + ".*"; //$NON-NLS-1$ //$NON-NLS-2$
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.jface.viewers.ViewerFilter#select(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)
|
||||
*/
|
||||
@Override
|
||||
public boolean select(Viewer viewer, Object parentElement, Object element) {
|
||||
|
||||
if (searchString == null || searchString.length() == 0) {
|
||||
return true;
|
||||
}
|
||||
if(element instanceof TransactionTreeNode) {
|
||||
return true;
|
||||
}
|
||||
if(element instanceof ITxAttribute){
|
||||
try {
|
||||
return (((ITxAttribute) element).getName().toLowerCase().matches(searchString.toLowerCase()));
|
||||
} catch (PatternSyntaxException e) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if(element instanceof Object[]) {
|
||||
try {
|
||||
return (((Object[])element)[0]).toString().toLowerCase().matches(searchString.toLowerCase());
|
||||
} catch (PatternSyntaxException e) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
@ -0,0 +1,73 @@
|
||||
package com.minres.scviewer.e4.application.parts.txTableTree;
|
||||
|
||||
import org.eclipse.jface.viewers.Viewer;
|
||||
import org.eclipse.jface.viewers.ViewerComparator;
|
||||
|
||||
import com.minres.scviewer.database.ITxAttribute;
|
||||
|
||||
/**
|
||||
* The Class TxAttributeViewerSorter.
|
||||
*/
|
||||
public class TxAttributeViewerSorter extends ViewerComparator {
|
||||
|
||||
/** The Constant ASCENDING. */
|
||||
private static final int ASCENDING = 0;
|
||||
|
||||
/** The Constant DESCENDING. */
|
||||
private static final int DESCENDING = 1;
|
||||
|
||||
/** The column. */
|
||||
private int column;
|
||||
|
||||
/** The direction. */
|
||||
private int direction;
|
||||
|
||||
/**
|
||||
* Does the sort. If it's a different column from the previous sort, do an
|
||||
* ascending sort. If it's the same column as the last sort, toggle the sort
|
||||
* direction.
|
||||
*
|
||||
* @param column the column
|
||||
*/
|
||||
public void doSort(int column) {
|
||||
if (column == this.column) {
|
||||
// Same column as last sort; toggle the direction
|
||||
direction = 1 - direction;
|
||||
} else {
|
||||
// New column; do an ascending sort
|
||||
this.column = column;
|
||||
direction = ASCENDING;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Compares the object for sorting.
|
||||
*
|
||||
* @param viewer the viewer
|
||||
* @param e1 the e1
|
||||
* @param e2 the e2
|
||||
* @return the int
|
||||
*/
|
||||
public int compare(Viewer viewer, Object e1, Object e2) {
|
||||
int rc = 0;
|
||||
if(e1 instanceof ITxAttribute && e2 instanceof ITxAttribute){
|
||||
ITxAttribute p1 = (ITxAttribute) e1;
|
||||
ITxAttribute p2 = (ITxAttribute) e2;
|
||||
// Determine which column and do the appropriate sort
|
||||
switch (column) {
|
||||
case 0:
|
||||
rc = getComparator().compare(p1.getName(), p2.getName());
|
||||
break;
|
||||
case 1:
|
||||
rc = getComparator().compare(p1.getDataType().name(), p2.getDataType().name());
|
||||
break;
|
||||
case 2:
|
||||
rc = getComparator().compare(p1.getValue().toString(), p2.getValue().toString());
|
||||
break;
|
||||
}
|
||||
// If descending order, flip the direction
|
||||
if (direction == DESCENDING) rc = -rc;
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
}
|
@ -0,0 +1,94 @@
|
||||
package com.minres.scviewer.e4.application.parts.txTableTree;
|
||||
|
||||
import java.math.BigInteger;
|
||||
import java.util.List;
|
||||
import java.util.regex.PatternSyntaxException;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.eclipse.jface.viewers.Viewer;
|
||||
import org.eclipse.jface.viewers.ViewerFilter;
|
||||
|
||||
import com.minres.scviewer.database.DataType;
|
||||
import com.minres.scviewer.database.ITx;
|
||||
import com.minres.scviewer.database.ITxAttribute;
|
||||
|
||||
/**
|
||||
* The Class TxAttributeFilter.
|
||||
*/
|
||||
public class TxFilter extends ViewerFilter {
|
||||
|
||||
/** The search string. */
|
||||
private String searchProp;
|
||||
/** The search type. */
|
||||
private DataType searchType;
|
||||
/** The search string. */
|
||||
private String searchValue;
|
||||
|
||||
/**
|
||||
* Sets the search text.
|
||||
*
|
||||
* @param s the new search text
|
||||
* @param dataType
|
||||
*/
|
||||
public void setSearchProp(String s, DataType type) {
|
||||
this.searchProp = s;
|
||||
this.searchType = type;
|
||||
}
|
||||
/**
|
||||
* Sets the search text.
|
||||
*
|
||||
* @param s the new search text
|
||||
*/
|
||||
public void setSearchValue(String s) {
|
||||
this.searchValue = s;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.jface.viewers.ViewerFilter#select(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)
|
||||
*/
|
||||
@Override
|
||||
public boolean select(Viewer viewer, Object parentElement, Object element) {
|
||||
if (searchValue == null || searchValue.length() == 0)
|
||||
return true;
|
||||
ITx iTx = null;
|
||||
if(element instanceof ITx)
|
||||
iTx = (ITx) element;
|
||||
else if(element instanceof TransactionTreeNode && ((TransactionTreeNode)element).type == TransactionTreeNodeType.TX)
|
||||
iTx = ((TransactionTreeNode)element).element;
|
||||
if(iTx==null) return true;
|
||||
List<ITxAttribute> res = iTx.getAttributes().stream().filter(a -> searchProp.equals(a.getName())).collect(Collectors.toList());
|
||||
if(res.size()==1) {
|
||||
try {
|
||||
ITxAttribute attr =res.get(0);
|
||||
switch(searchType) {
|
||||
case BOOLEAN: // bool
|
||||
case ENUMERATION:
|
||||
return searchValue.equalsIgnoreCase((String) attr.getValue());
|
||||
case INTEGER:
|
||||
case UNSIGNED:
|
||||
BigInteger lval = new BigInteger(attr.getValue().toString());
|
||||
BigInteger sval = parseBigInteger(searchValue);
|
||||
return lval.equals(sval);
|
||||
case STRING:
|
||||
try {
|
||||
return (((ITxAttribute) element).getName().toLowerCase().matches(searchValue.toLowerCase()));
|
||||
} catch (PatternSyntaxException e) {
|
||||
return true;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
} catch(RuntimeException ex) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private BigInteger parseBigInteger(String value) {
|
||||
if(value.startsWith("0x") || value.startsWith("0X"))
|
||||
return new BigInteger(value.substring(2), 16);
|
||||
else
|
||||
return new BigInteger(value);
|
||||
}
|
||||
}
|
@ -12,14 +12,14 @@ package com.minres.scviewer.e4.application.preferences;
|
||||
|
||||
import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;
|
||||
import org.eclipse.core.runtime.preferences.DefaultScope;
|
||||
import org.eclipse.jface.preference.IPreferenceStore;
|
||||
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
|
||||
import org.eclipse.jface.resource.StringConverter;
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.graphics.Color;
|
||||
import org.eclipse.wb.swt.SWTResourceManager;
|
||||
import org.osgi.framework.FrameworkUtil;
|
||||
|
||||
import com.minres.scviewer.database.ui.WaveformColors;
|
||||
import com.opcoach.e4.preferences.ScopedPreferenceStore;
|
||||
|
||||
/**
|
||||
* The Class DefaultValuesInitializer.
|
||||
@ -27,7 +27,7 @@ import com.opcoach.e4.preferences.ScopedPreferenceStore;
|
||||
public class DefaultValuesInitializer extends AbstractPreferenceInitializer {
|
||||
|
||||
/** The default colors. */
|
||||
public final Color[] colors = new Color[WaveformColors.values().length];
|
||||
public static final Color[] colors = new Color[WaveformColors.values().length];
|
||||
|
||||
/**
|
||||
* Instantiates a new default values initializer.
|
||||
@ -64,21 +64,12 @@ public class DefaultValuesInitializer extends AbstractPreferenceInitializer {
|
||||
*/
|
||||
@Override
|
||||
public void initializeDefaultPreferences() {
|
||||
// IEclipsePreferences node = DefaultScope.INSTANCE.getNode(PreferenceConstants.PREFERENCES_SCOPE);
|
||||
// if (node != null)
|
||||
// {
|
||||
// node.putBoolean(PreferenceConstants.DATABASE_RELOAD, true);
|
||||
// node.putBoolean(PreferenceConstants.SHOW_HOVER, true);
|
||||
// for (WaveformColors c : WaveformColors.values()) {
|
||||
// node.put(c.name()+"_COLOR", StringConverter.asString(colors[c.ordinal()].getRGB())); //$NON-NLS-1$
|
||||
// }
|
||||
// }
|
||||
IPreferenceStore store = new ScopedPreferenceStore(DefaultScope.INSTANCE, PreferenceConstants.PREFERENCES_SCOPE);
|
||||
|
||||
store.setDefault(PreferenceConstants.DATABASE_RELOAD, true);
|
||||
store.setDefault(PreferenceConstants.SHOW_HOVER, true);
|
||||
IEclipsePreferences store = DefaultScope.INSTANCE.getNode(FrameworkUtil.getBundle(getClass()).getSymbolicName());
|
||||
|
||||
store.putBoolean(PreferenceConstants.DATABASE_RELOAD, true);
|
||||
store.putBoolean(PreferenceConstants.SHOW_HOVER, true);
|
||||
for (WaveformColors c : WaveformColors.values()) {
|
||||
store.setDefault(c.name()+"_COLOR", StringConverter.asString(colors[c.ordinal()].getRGB())); //$NON-NLS-1$
|
||||
store.put(c.name()+"_COLOR", StringConverter.asString(colors[c.ordinal()].getRGB())); //$NON-NLS-1$
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,18 +0,0 @@
|
||||
package com.minres.scviewer.e4.application.preferences;
|
||||
import org.eclipse.core.runtime.preferences.ConfigurationScope;
|
||||
import org.eclipse.jface.preference.IPreferenceStore;
|
||||
|
||||
import com.opcoach.e4.preferences.IPreferenceStoreProvider;
|
||||
import com.opcoach.e4.preferences.ScopedPreferenceStore;
|
||||
|
||||
public class PreferencesStoreProvider implements IPreferenceStoreProvider{
|
||||
|
||||
public PreferencesStoreProvider(){
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPreferenceStore getPreferenceStore() {
|
||||
return new ScopedPreferenceStore(ConfigurationScope.INSTANCE, PreferenceConstants.PREFERENCES_SCOPE);
|
||||
}
|
||||
|
||||
}
|
@ -10,6 +10,9 @@
|
||||
*******************************************************************************/
|
||||
package com.minres.scviewer.e4.application.preferences;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.HashMap;
|
||||
|
||||
import org.eclipse.jface.preference.ColorFieldEditor;
|
||||
import org.eclipse.jface.preference.FieldEditorPreferencePage;
|
||||
|
||||
@ -26,6 +29,7 @@ public class WaveformPreferencesPage extends FieldEditorPreferencePage {
|
||||
*/
|
||||
public WaveformPreferencesPage() {
|
||||
super(GRID);
|
||||
setDescription(Messages.WaveformPreferencesPage_description);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
@ -33,9 +37,18 @@ public class WaveformPreferencesPage extends FieldEditorPreferencePage {
|
||||
*/
|
||||
@Override
|
||||
protected void createFieldEditors() {
|
||||
|
||||
Field[] declaredFields = Messages.class.getDeclaredFields();
|
||||
HashMap<String, String> staticFields = new HashMap<String, String>();
|
||||
for (Field field : declaredFields) {
|
||||
if (java.lang.reflect.Modifier.isStatic(field.getModifiers())) {
|
||||
try {
|
||||
staticFields.put(field.getName(), (String)field.get(null));
|
||||
} catch (IllegalArgumentException | IllegalAccessException e) {}
|
||||
}
|
||||
}
|
||||
for (WaveformColors c : WaveformColors.values()) {
|
||||
addField(new ColorFieldEditor(c.name() + "_COLOR", Messages.WaveformPreferencesPage_1 + c.name().toLowerCase(), //$NON-NLS-1$
|
||||
addField(new ColorFieldEditor(c.name() + "_COLOR",
|
||||
Messages.WaveformPreferencesPage_1 + staticFields.get(c.name().toLowerCase()), //$NON-NLS-1$
|
||||
getFieldEditorParent()));
|
||||
}
|
||||
}
|
||||
|
@ -29,24 +29,24 @@ public class TxDbContentProvider implements ITreeContentProvider {
|
||||
|
||||
/** The show nodes. */
|
||||
// private List<HierNode> nodes;
|
||||
private boolean showNodes;
|
||||
private boolean tabelEntries;
|
||||
|
||||
/**
|
||||
* Instantiates a new tx db content provider.
|
||||
*/
|
||||
public TxDbContentProvider() {
|
||||
super();
|
||||
this.showNodes = false;
|
||||
this.tabelEntries = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Instantiates a new tx db content provider.
|
||||
*
|
||||
* @param showNodes the show nodes
|
||||
* @param tableEntries get nodes for waveform table entries
|
||||
*/
|
||||
public TxDbContentProvider(boolean showNodes) {
|
||||
public TxDbContentProvider(boolean tableEntries) {
|
||||
super();
|
||||
this.showNodes = showNodes;
|
||||
this.tabelEntries = tableEntries;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
@ -60,7 +60,6 @@ public class TxDbContentProvider implements ITreeContentProvider {
|
||||
*/
|
||||
@Override
|
||||
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
|
||||
// showNodes=!(newInput instanceof IHierNode);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
@ -68,11 +67,13 @@ public class TxDbContentProvider implements ITreeContentProvider {
|
||||
*/
|
||||
@Override
|
||||
public Object[] getElements(Object inputElement) {
|
||||
if(inputElement instanceof IHierNode){
|
||||
if(tabelEntries && inputElement instanceof IWaveformDb){
|
||||
return new Object[]{};
|
||||
}else if(inputElement instanceof IHierNode){
|
||||
Collection<IHierNode> res = Collections2.filter(((IHierNode)inputElement).getChildNodes(), new Predicate<IHierNode>(){
|
||||
@Override
|
||||
public boolean apply(IHierNode arg0) {
|
||||
if(showNodes){
|
||||
if(tabelEntries){
|
||||
return arg0 instanceof IWaveform;
|
||||
} else{
|
||||
return arg0.getChildNodes().size()!=0;
|
||||
@ -82,8 +83,6 @@ public class TxDbContentProvider implements ITreeContentProvider {
|
||||
return res.toArray();
|
||||
}else if(inputElement instanceof List<?>){
|
||||
return ((List<?>)inputElement).toArray();
|
||||
}else if(inputElement instanceof IWaveformDb){
|
||||
return new Object[]{};
|
||||
} else
|
||||
return null;
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user