Merge branch 'feature/dynamic_stream_addition' into develop
This commit is contained in:
commit
bd08b69747
|
@ -2,7 +2,7 @@
|
||||||
<feature
|
<feature
|
||||||
id="com.minres.scviewer.database.feature"
|
id="com.minres.scviewer.database.feature"
|
||||||
label="%featureName"
|
label="%featureName"
|
||||||
version="2.0.0.qualifier"
|
version="3.0.0.qualifier"
|
||||||
provider-name="%providerName">
|
provider-name="%providerName">
|
||||||
|
|
||||||
<description>
|
<description>
|
||||||
|
|
|
@ -8,4 +8,5 @@
|
||||||
<version>2.0.0-SNAPSHOT</version>
|
<version>2.0.0-SNAPSHOT</version>
|
||||||
<relativePath>../..</relativePath>
|
<relativePath>../..</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
|
<version>3.0.0-SNAPSHOT</version>
|
||||||
</project>
|
</project>
|
||||||
|
|
|
@ -1,8 +1,5 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<site>
|
<site>
|
||||||
<feature id="com.minres.scviewer.e4.feature">
|
|
||||||
<category name="com.minres.scviewer.e4"/>
|
|
||||||
</feature>
|
|
||||||
<feature id="com.minres.scviewer.feature">
|
<feature id="com.minres.scviewer.feature">
|
||||||
<category name="com.minres.scviewer"/>
|
<category name="com.minres.scviewer"/>
|
||||||
</feature>
|
</feature>
|
||||||
|
@ -11,5 +8,4 @@
|
||||||
Viewer for SystemC Verification (SCV) library's transaction recording
|
Viewer for SystemC Verification (SCV) library's transaction recording
|
||||||
</description>
|
</description>
|
||||||
</category-def>
|
</category-def>
|
||||||
<category-def name="com.minres.scviewer.e4" label="SCViewer E4 application"/>
|
|
||||||
</site>
|
</site>
|
||||||
|
|
|
@ -2,7 +2,7 @@ Manifest-Version: 1.0
|
||||||
Bundle-ManifestVersion: 2
|
Bundle-ManifestVersion: 2
|
||||||
Bundle-Name: SQLite transaction database
|
Bundle-Name: SQLite transaction database
|
||||||
Bundle-SymbolicName: com.minres.scviewer.database.sqlite
|
Bundle-SymbolicName: com.minres.scviewer.database.sqlite
|
||||||
Bundle-Version: 1.0.0.qualifier
|
Bundle-Version: 1.1.0.qualifier
|
||||||
Bundle-Vendor: MINRES Technologies GmbH
|
Bundle-Vendor: MINRES Technologies GmbH
|
||||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
|
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
|
||||||
Require-Bundle: com.minres.scviewer.database;bundle-version="1.0.0"
|
Require-Bundle: com.minres.scviewer.database;bundle-version="1.0.0"
|
||||||
|
|
|
@ -15,5 +15,5 @@
|
||||||
<version>3.8.7</version>
|
<version>3.8.7</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
<version>1.0.0-SNAPSHOT</version>
|
<version>1.1.0-SNAPSHOT</version>
|
||||||
</project>
|
</project>
|
||||||
|
|
|
@ -11,9 +11,11 @@
|
||||||
package com.minres.scviewer.database.sqlite;
|
package com.minres.scviewer.database.sqlite;
|
||||||
|
|
||||||
import java.beans.IntrospectionException;
|
import java.beans.IntrospectionException;
|
||||||
|
import java.beans.PropertyChangeListener;
|
||||||
|
import java.beans.PropertyChangeSupport;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileInputStream;
|
import java.io.FileInputStream;
|
||||||
import java.io.IOException;
|
import java.io.InputStream;
|
||||||
import java.lang.reflect.InvocationTargetException;
|
import java.lang.reflect.InvocationTargetException;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
@ -40,6 +42,11 @@ public class SQLiteDbLoader implements IWaveformDbLoader {
|
||||||
|
|
||||||
private ScvSimProps scvSimProps;
|
private ScvSimProps scvSimProps;
|
||||||
|
|
||||||
|
private static final byte[] x = "SQLite format 3".getBytes();
|
||||||
|
|
||||||
|
/** The pcs. */
|
||||||
|
protected PropertyChangeSupport pcs = new PropertyChangeSupport(this);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Long getMaxTime() {
|
public Long getMaxTime() {
|
||||||
SQLiteDatabaseSelectHandler<ScvTxEvent> handler = new SQLiteDatabaseSelectHandler<>(ScvTxEvent.class,
|
SQLiteDatabaseSelectHandler<ScvTxEvent> handler = new SQLiteDatabaseSelectHandler<>(ScvTxEvent.class,
|
||||||
|
@ -71,21 +78,28 @@ public class SQLiteDbLoader implements IWaveformDbLoader {
|
||||||
return streams;
|
return streams;
|
||||||
}
|
}
|
||||||
|
|
||||||
private byte[] x = "SQLite format 3".getBytes();
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean load(IWaveformDb db, File file) throws InputFormatException {
|
public boolean canLoad(File inputFile) {
|
||||||
dispose();
|
if (!inputFile.isDirectory() && inputFile.exists()) {
|
||||||
if(file.isDirectory() || !file.exists()) return false;
|
try(InputStream stream = new FileInputStream(inputFile)){
|
||||||
try(FileInputStream fis = new FileInputStream(file)) {
|
|
||||||
byte[] buffer = new byte[x.length];
|
byte[] buffer = new byte[x.length];
|
||||||
int read = fis.read(buffer, 0, x.length);
|
int readCnt = stream.read(buffer, 0, x.length);
|
||||||
if (read == x.length)
|
if (readCnt == x.length) {
|
||||||
for (int i = 0; i < x.length; i++)
|
for (int i = 0; i < x.length; i++)
|
||||||
if (buffer[i] != x[i]) return false;
|
if (buffer[i] != x[i])
|
||||||
} catch(IOException e) {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
|
} catch (Exception e) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void load(IWaveformDb db, File file) throws InputFormatException {
|
||||||
|
dispose();
|
||||||
database=new SQLiteDatabase(file.getAbsolutePath(), db);
|
database=new SQLiteDatabase(file.getAbsolutePath(), db);
|
||||||
database.setData("TIMERESOLUTION", 1L);
|
database.setData("TIMERESOLUTION", 1L);
|
||||||
SQLiteDatabaseSelectHandler<ScvSimProps> handler = new SQLiteDatabaseSelectHandler<>(ScvSimProps.class, database);
|
SQLiteDatabaseSelectHandler<ScvSimProps> handler = new SQLiteDatabaseSelectHandler<>(ScvSimProps.class, database);
|
||||||
|
@ -94,12 +108,11 @@ public class SQLiteDbLoader implements IWaveformDbLoader {
|
||||||
scvSimProps=simProps;
|
scvSimProps=simProps;
|
||||||
database.setData("TIMERESOLUTION", scvSimProps.getTime_resolution());
|
database.setData("TIMERESOLUTION", scvSimProps.getTime_resolution());
|
||||||
}
|
}
|
||||||
return true;
|
pcs.firePropertyChange(IWaveformDbLoader.LOADING_FINISHED, null, null);
|
||||||
} catch (SecurityException | IllegalArgumentException | InstantiationException | IllegalAccessException
|
} catch (SecurityException | IllegalArgumentException | InstantiationException | IllegalAccessException
|
||||||
| InvocationTargetException | SQLException | IntrospectionException e) {
|
| InvocationTargetException | SQLException | IntrospectionException e) {
|
||||||
e.printStackTrace();
|
throw new InputFormatException();
|
||||||
}
|
}
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void dispose() {
|
public void dispose() {
|
||||||
|
@ -112,4 +125,24 @@ public class SQLiteDbLoader implements IWaveformDbLoader {
|
||||||
return usedRelationsList;
|
return usedRelationsList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds the property change listener.
|
||||||
|
*
|
||||||
|
* @param l the l
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void addPropertyChangeListener(PropertyChangeListener l) {
|
||||||
|
pcs.addPropertyChangeListener(l);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Removes the property change listener.
|
||||||
|
*
|
||||||
|
* @param l the l
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void removePropertyChangeListener(PropertyChangeListener l) {
|
||||||
|
pcs.removePropertyChangeListener(l);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@ Manifest-Version: 1.0
|
||||||
Bundle-ManifestVersion: 2
|
Bundle-ManifestVersion: 2
|
||||||
Bundle-Name: Textual transaction database
|
Bundle-Name: Textual transaction database
|
||||||
Bundle-SymbolicName: com.minres.scviewer.database.text
|
Bundle-SymbolicName: com.minres.scviewer.database.text
|
||||||
Bundle-Version: 2.1.0.qualifier
|
Bundle-Version: 3.0.0.qualifier
|
||||||
Bundle-Vendor: MINRES Technologies GmbH
|
Bundle-Vendor: MINRES Technologies GmbH
|
||||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
|
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
|
||||||
Import-Package: org.osgi.framework;version="1.3.0"
|
Import-Package: org.osgi.framework;version="1.3.0"
|
||||||
|
|
|
@ -0,0 +1,177 @@
|
||||||
|
|
||||||
|
Apache License
|
||||||
|
Version 2.0, January 2004
|
||||||
|
http://www.apache.org/licenses/
|
||||||
|
|
||||||
|
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||||
|
|
||||||
|
1. Definitions.
|
||||||
|
|
||||||
|
"License" shall mean the terms and conditions for use, reproduction,
|
||||||
|
and distribution as defined by Sections 1 through 9 of this document.
|
||||||
|
|
||||||
|
"Licensor" shall mean the copyright owner or entity authorized by
|
||||||
|
the copyright owner that is granting the License.
|
||||||
|
|
||||||
|
"Legal Entity" shall mean the union of the acting entity and all
|
||||||
|
other entities that control, are controlled by, or are under common
|
||||||
|
control with that entity. For the purposes of this definition,
|
||||||
|
"control" means (i) the power, direct or indirect, to cause the
|
||||||
|
direction or management of such entity, whether by contract or
|
||||||
|
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||||
|
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||||
|
|
||||||
|
"You" (or "Your") shall mean an individual or Legal Entity
|
||||||
|
exercising permissions granted by this License.
|
||||||
|
|
||||||
|
"Source" form shall mean the preferred form for making modifications,
|
||||||
|
including but not limited to software source code, documentation
|
||||||
|
source, and configuration files.
|
||||||
|
|
||||||
|
"Object" form shall mean any form resulting from mechanical
|
||||||
|
transformation or translation of a Source form, including but
|
||||||
|
not limited to compiled object code, generated documentation,
|
||||||
|
and conversions to other media types.
|
||||||
|
|
||||||
|
"Work" shall mean the work of authorship, whether in Source or
|
||||||
|
Object form, made available under the License, as indicated by a
|
||||||
|
copyright notice that is included in or attached to the work
|
||||||
|
(an example is provided in the Appendix below).
|
||||||
|
|
||||||
|
"Derivative Works" shall mean any work, whether in Source or Object
|
||||||
|
form, that is based on (or derived from) the Work and for which the
|
||||||
|
editorial revisions, annotations, elaborations, or other modifications
|
||||||
|
represent, as a whole, an original work of authorship. For the purposes
|
||||||
|
of this License, Derivative Works shall not include works that remain
|
||||||
|
separable from, or merely link (or bind by name) to the interfaces of,
|
||||||
|
the Work and Derivative Works thereof.
|
||||||
|
|
||||||
|
"Contribution" shall mean any work of authorship, including
|
||||||
|
the original version of the Work and any modifications or additions
|
||||||
|
to that Work or Derivative Works thereof, that is intentionally
|
||||||
|
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||||
|
or by an individual or Legal Entity authorized to submit on behalf of
|
||||||
|
the copyright owner. For the purposes of this definition, "submitted"
|
||||||
|
means any form of electronic, verbal, or written communication sent
|
||||||
|
to the Licensor or its representatives, including but not limited to
|
||||||
|
communication on electronic mailing lists, source code control systems,
|
||||||
|
and issue tracking systems that are managed by, or on behalf of, the
|
||||||
|
Licensor for the purpose of discussing and improving the Work, but
|
||||||
|
excluding communication that is conspicuously marked or otherwise
|
||||||
|
designated in writing by the copyright owner as "Not a Contribution."
|
||||||
|
|
||||||
|
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||||
|
on behalf of whom a Contribution has been received by Licensor and
|
||||||
|
subsequently incorporated within the Work.
|
||||||
|
|
||||||
|
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||||
|
this License, each Contributor hereby grants to You a perpetual,
|
||||||
|
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||||
|
copyright license to reproduce, prepare Derivative Works of,
|
||||||
|
publicly display, publicly perform, sublicense, and distribute the
|
||||||
|
Work and such Derivative Works in Source or Object form.
|
||||||
|
|
||||||
|
3. Grant of Patent License. Subject to the terms and conditions of
|
||||||
|
this License, each Contributor hereby grants to You a perpetual,
|
||||||
|
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||||
|
(except as stated in this section) patent license to make, have made,
|
||||||
|
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||||
|
where such license applies only to those patent claims licensable
|
||||||
|
by such Contributor that are necessarily infringed by their
|
||||||
|
Contribution(s) alone or by combination of their Contribution(s)
|
||||||
|
with the Work to which such Contribution(s) was submitted. If You
|
||||||
|
institute patent litigation against any entity (including a
|
||||||
|
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||||
|
or a Contribution incorporated within the Work constitutes direct
|
||||||
|
or contributory patent infringement, then any patent licenses
|
||||||
|
granted to You under this License for that Work shall terminate
|
||||||
|
as of the date such litigation is filed.
|
||||||
|
|
||||||
|
4. Redistribution. You may reproduce and distribute copies of the
|
||||||
|
Work or Derivative Works thereof in any medium, with or without
|
||||||
|
modifications, and in Source or Object form, provided that You
|
||||||
|
meet the following conditions:
|
||||||
|
|
||||||
|
(a) You must give any other recipients of the Work or
|
||||||
|
Derivative Works a copy of this License; and
|
||||||
|
|
||||||
|
(b) You must cause any modified files to carry prominent notices
|
||||||
|
stating that You changed the files; and
|
||||||
|
|
||||||
|
(c) You must retain, in the Source form of any Derivative Works
|
||||||
|
that You distribute, all copyright, patent, trademark, and
|
||||||
|
attribution notices from the Source form of the Work,
|
||||||
|
excluding those notices that do not pertain to any part of
|
||||||
|
the Derivative Works; and
|
||||||
|
|
||||||
|
(d) If the Work includes a "NOTICE" text file as part of its
|
||||||
|
distribution, then any Derivative Works that You distribute must
|
||||||
|
include a readable copy of the attribution notices contained
|
||||||
|
within such NOTICE file, excluding those notices that do not
|
||||||
|
pertain to any part of the Derivative Works, in at least one
|
||||||
|
of the following places: within a NOTICE text file distributed
|
||||||
|
as part of the Derivative Works; within the Source form or
|
||||||
|
documentation, if provided along with the Derivative Works; or,
|
||||||
|
within a display generated by the Derivative Works, if and
|
||||||
|
wherever such third-party notices normally appear. The contents
|
||||||
|
of the NOTICE file are for informational purposes only and
|
||||||
|
do not modify the License. You may add Your own attribution
|
||||||
|
notices within Derivative Works that You distribute, alongside
|
||||||
|
or as an addendum to the NOTICE text from the Work, provided
|
||||||
|
that such additional attribution notices cannot be construed
|
||||||
|
as modifying the License.
|
||||||
|
|
||||||
|
You may add Your own copyright statement to Your modifications and
|
||||||
|
may provide additional or different license terms and conditions
|
||||||
|
for use, reproduction, or distribution of Your modifications, or
|
||||||
|
for any such Derivative Works as a whole, provided Your use,
|
||||||
|
reproduction, and distribution of the Work otherwise complies with
|
||||||
|
the conditions stated in this License.
|
||||||
|
|
||||||
|
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||||
|
any Contribution intentionally submitted for inclusion in the Work
|
||||||
|
by You to the Licensor shall be under the terms and conditions of
|
||||||
|
this License, without any additional terms or conditions.
|
||||||
|
Notwithstanding the above, nothing herein shall supersede or modify
|
||||||
|
the terms of any separate license agreement you may have executed
|
||||||
|
with Licensor regarding such Contributions.
|
||||||
|
|
||||||
|
6. Trademarks. This License does not grant permission to use the trade
|
||||||
|
names, trademarks, service marks, or product names of the Licensor,
|
||||||
|
except as required for reasonable and customary use in describing the
|
||||||
|
origin of the Work and reproducing the content of the NOTICE file.
|
||||||
|
|
||||||
|
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||||
|
agreed to in writing, Licensor provides the Work (and each
|
||||||
|
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||||
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||||
|
implied, including, without limitation, any warranties or conditions
|
||||||
|
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||||
|
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||||
|
appropriateness of using or redistributing the Work and assume any
|
||||||
|
risks associated with Your exercise of permissions under this License.
|
||||||
|
|
||||||
|
8. Limitation of Liability. In no event and under no legal theory,
|
||||||
|
whether in tort (including negligence), contract, or otherwise,
|
||||||
|
unless required by applicable law (such as deliberate and grossly
|
||||||
|
negligent acts) or agreed to in writing, shall any Contributor be
|
||||||
|
liable to You for damages, including any direct, indirect, special,
|
||||||
|
incidental, or consequential damages of any character arising as a
|
||||||
|
result of this License or out of the use or inability to use the
|
||||||
|
Work (including but not limited to damages for loss of goodwill,
|
||||||
|
work stoppage, computer failure or malfunction, or any and all
|
||||||
|
other commercial damages or losses), even if such Contributor
|
||||||
|
has been advised of the possibility of such damages.
|
||||||
|
|
||||||
|
9. Accepting Warranty or Additional Liability. While redistributing
|
||||||
|
the Work or Derivative Works thereof, You may choose to offer,
|
||||||
|
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||||
|
or other liability obligations and/or rights consistent with this
|
||||||
|
License. However, in accepting such obligations, You may act only
|
||||||
|
on Your own behalf and on Your sole responsibility, not on behalf
|
||||||
|
of any other Contributor, and only if You agree to indemnify,
|
||||||
|
defend, and hold each Contributor harmless for any liability
|
||||||
|
incurred by, or claims asserted against, such Contributor by reason
|
||||||
|
of your accepting any such warranty or additional liability.
|
||||||
|
|
||||||
|
END OF TERMS AND CONDITIONS
|
|
@ -2,7 +2,7 @@
|
||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<artifactId>com.minres.scviewer.database.text</artifactId>
|
<artifactId>com.minres.scviewer.database.text</artifactId>
|
||||||
<version>2.1.0-SNAPSHOT</version>
|
<version>3.0.0-SNAPSHOT</version>
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.minres.scviewer</groupId>
|
<groupId>com.minres.scviewer</groupId>
|
||||||
<artifactId>com.minres.scviewer.parent</artifactId>
|
<artifactId>com.minres.scviewer.parent</artifactId>
|
||||||
|
|
|
@ -11,6 +11,8 @@
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package com.minres.scviewer.database.text;
|
package com.minres.scviewer.database.text;
|
||||||
|
|
||||||
|
import java.beans.PropertyChangeListener;
|
||||||
|
import java.beans.PropertyChangeSupport;
|
||||||
import java.io.BufferedReader;
|
import java.io.BufferedReader;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileInputStream;
|
import java.io.FileInputStream;
|
||||||
|
@ -89,6 +91,12 @@ public class TextDbLoader implements IWaveformDbLoader {
|
||||||
/** The threads. */
|
/** The threads. */
|
||||||
List<Thread> threads = new ArrayList<>();
|
List<Thread> threads = new ArrayList<>();
|
||||||
|
|
||||||
|
/** The pcs. */
|
||||||
|
protected PropertyChangeSupport pcs = new PropertyChangeSupport(this);
|
||||||
|
|
||||||
|
/** The Constant x. */
|
||||||
|
static final byte[] x = "scv_tr_stream".getBytes();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the max time.
|
* Gets the max time.
|
||||||
*
|
*
|
||||||
|
@ -109,8 +117,31 @@ public class TextDbLoader implements IWaveformDbLoader {
|
||||||
return new ArrayList<>(txStreams.values());
|
return new ArrayList<>(txStreams.values());
|
||||||
}
|
}
|
||||||
|
|
||||||
/** The Constant x. */
|
/**
|
||||||
static final byte[] x = "scv_tr_stream".getBytes();
|
* Can load.
|
||||||
|
*
|
||||||
|
* @param inputFile the input file
|
||||||
|
* @return true, if successful
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public boolean canLoad(File inputFile) {
|
||||||
|
if (!inputFile.isDirectory() && inputFile.exists()) {
|
||||||
|
boolean gzipped = isGzipped(inputFile);
|
||||||
|
try(InputStream stream = gzipped ? new GZIPInputStream(new FileInputStream(inputFile)) : new FileInputStream(inputFile)){
|
||||||
|
byte[] buffer = new byte[x.length];
|
||||||
|
int readCnt = stream.read(buffer, 0, x.length);
|
||||||
|
if (readCnt == x.length) {
|
||||||
|
for (int i = 0; i < x.length; i++)
|
||||||
|
if (buffer[i] != x[i])
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
} catch (Exception e) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Load.
|
* Load.
|
||||||
|
@ -122,19 +153,9 @@ public class TextDbLoader implements IWaveformDbLoader {
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
@Override
|
@Override
|
||||||
public boolean load(IWaveformDb db, File file) throws InputFormatException {
|
public void load(IWaveformDb db, File file) throws InputFormatException {
|
||||||
dispose();
|
dispose();
|
||||||
if (file.isDirectory() || !file.exists())
|
|
||||||
return false;
|
|
||||||
TextDbParser parser = new TextDbParser(this);
|
|
||||||
boolean gzipped = isGzipped(file);
|
boolean gzipped = isGzipped(file);
|
||||||
try {
|
|
||||||
if (!isTxfile(gzipped ? new GZIPInputStream(new FileInputStream(file)) : new FileInputStream(file)))
|
|
||||||
return false;
|
|
||||||
} catch (Exception e) {
|
|
||||||
throw new InputFormatException();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (file.length() < 75000000 * (gzipped ? 1 : 10)
|
if (file.length() < 75000000 * (gzipped ? 1 : 10)
|
||||||
|| "memory".equals(System.getProperty("ScvBackingDB", "file")))
|
|| "memory".equals(System.getProperty("ScvBackingDB", "file")))
|
||||||
mapDb = DBMaker.memoryDirectDB().allocateStartSize(512l * 1024l * 1024l)
|
mapDb = DBMaker.memoryDirectDB().allocateStartSize(512l * 1024l * 1024l)
|
||||||
|
@ -145,13 +166,14 @@ public class TextDbLoader implements IWaveformDbLoader {
|
||||||
mapDbFile = File.createTempFile("." + file.getName(), ".mapdb", null /* file.parentFile */);
|
mapDbFile = File.createTempFile("." + file.getName(), ".mapdb", null /* file.parentFile */);
|
||||||
Files.delete(Paths.get(mapDbFile.getPath()));
|
Files.delete(Paths.get(mapDbFile.getPath()));
|
||||||
} catch (IOException e1) {
|
} catch (IOException e1) {
|
||||||
return false;
|
throw new InputFormatException();
|
||||||
}
|
}
|
||||||
mapDb = DBMaker.fileDB(mapDbFile).fileMmapEnable() // Always enable mmap
|
mapDb = DBMaker.fileDB(mapDbFile).fileMmapEnable() // Always enable mmap
|
||||||
.fileMmapEnableIfSupported().fileMmapPreclearDisable().allocateStartSize(512l * 1024l * 1024l)
|
.fileMmapEnableIfSupported().fileMmapPreclearDisable().allocateStartSize(512l * 1024l * 1024l)
|
||||||
.allocateIncrement(128l * 1024l * 1024l).cleanerHackEnable().make();
|
.allocateIncrement(128l * 1024l * 1024l).cleanerHackEnable().make();
|
||||||
mapDbFile.deleteOnExit();
|
mapDbFile.deleteOnExit();
|
||||||
}
|
}
|
||||||
|
TextDbParser parser = new TextDbParser(this);
|
||||||
try {
|
try {
|
||||||
parser.txSink = mapDb.treeMap("transactions", Serializer.LONG, Serializer.JAVA).createFromSink();
|
parser.txSink = mapDb.treeMap("transactions", Serializer.LONG, Serializer.JAVA).createFromSink();
|
||||||
parser.parseInput(gzipped ? new GZIPInputStream(new FileInputStream(file)) : new FileInputStream(file));
|
parser.parseInput(gzipped ? new GZIPInputStream(new FileInputStream(file)) : new FileInputStream(file));
|
||||||
|
@ -160,7 +182,7 @@ public class TextDbLoader implements IWaveformDbLoader {
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
System.out.println("---->>> Exception " + e.toString() + " caught while loading database");
|
System.out.println("---->>> Exception " + e.toString() + " caught while loading database");
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
return false;
|
throw new InputFormatException();
|
||||||
}
|
}
|
||||||
for (TxStream stream : txStreams.values()) {
|
for (TxStream stream : txStreams.values()) {
|
||||||
Thread t = new Thread() {
|
Thread t = new Thread() {
|
||||||
|
@ -175,7 +197,6 @@ public class TextDbLoader implements IWaveformDbLoader {
|
||||||
threads.add(t);
|
threads.add(t);
|
||||||
t.start();
|
t.start();
|
||||||
}
|
}
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -197,28 +218,6 @@ public class TextDbLoader implements IWaveformDbLoader {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Checks if is txfile.
|
|
||||||
*
|
|
||||||
* @param istream the istream
|
|
||||||
* @return true, if is txfile
|
|
||||||
*/
|
|
||||||
private static boolean isTxfile(InputStream istream) {
|
|
||||||
byte[] buffer = new byte[x.length];
|
|
||||||
try {
|
|
||||||
int readCnt = istream.read(buffer, 0, x.length);
|
|
||||||
istream.close();
|
|
||||||
if (readCnt == x.length) {
|
|
||||||
for (int i = 0; i < x.length; i++)
|
|
||||||
if (buffer[i] != x[i])
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
} catch (IOException e) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if is gzipped.
|
* Checks if is gzipped.
|
||||||
*
|
*
|
||||||
|
@ -416,7 +415,7 @@ public class TextDbLoader implements IWaveformDbLoader {
|
||||||
if (matcher.matches()) {
|
if (matcher.matches()) {
|
||||||
Long id = Long.parseLong(matcher.group(1));
|
Long id = Long.parseLong(matcher.group(1));
|
||||||
TxStream stream = new TxStream(loader, id, matcher.group(2), matcher.group(3));
|
TxStream stream = new TxStream(loader, id, matcher.group(2), matcher.group(3));
|
||||||
loader.txStreams.put(id, stream);
|
add(id, stream);
|
||||||
}
|
}
|
||||||
} else if ("scv_tr_generator".equals(tokens[0])) {
|
} else if ("scv_tr_generator".equals(tokens[0])) {
|
||||||
Matcher matcher = scv_tr_generator.matcher(curLine);
|
Matcher matcher = scv_tr_generator.matcher(curLine);
|
||||||
|
@ -424,7 +423,7 @@ public class TextDbLoader implements IWaveformDbLoader {
|
||||||
Long id = Long.parseLong(matcher.group(1));
|
Long id = Long.parseLong(matcher.group(1));
|
||||||
TxStream stream = loader.txStreams.get(Long.parseLong(matcher.group(3)));
|
TxStream stream = loader.txStreams.get(Long.parseLong(matcher.group(3)));
|
||||||
generator = new TxGenerator(loader, id, matcher.group(2), stream);
|
generator = new TxGenerator(loader, id, matcher.group(2), stream);
|
||||||
loader.txGenerators.put(id, generator);
|
add(id, generator);
|
||||||
}
|
}
|
||||||
} else if ("begin_attribute".equals(tokens[0])) {
|
} else if ("begin_attribute".equals(tokens[0])) {
|
||||||
Matcher matcher = begin_attribute.matcher(curLine);
|
Matcher matcher = begin_attribute.matcher(curLine);
|
||||||
|
@ -497,6 +496,16 @@ public class TextDbLoader implements IWaveformDbLoader {
|
||||||
return 1000000000000000L;
|
return 1000000000000000L;
|
||||||
return 1L;
|
return 1L;
|
||||||
}
|
}
|
||||||
|
private void add(Long id, TxStream stream) {
|
||||||
|
loader.txStreams.put(id, stream);
|
||||||
|
loader.pcs.firePropertyChange(IWaveformDbLoader.STREAM_ADDED, null, stream);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void add(Long id, TxGenerator generator) {
|
||||||
|
loader.txGenerators.put(id, generator);
|
||||||
|
loader.pcs.firePropertyChange(IWaveformDbLoader.GENERATOR_ADDED, null, generator);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -513,4 +522,24 @@ public class TextDbLoader implements IWaveformDbLoader {
|
||||||
return tx;
|
return tx;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds the property change listener.
|
||||||
|
*
|
||||||
|
* @param l the l
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void addPropertyChangeListener(PropertyChangeListener l) {
|
||||||
|
pcs.addPropertyChangeListener(l);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Removes the property change listener.
|
||||||
|
*
|
||||||
|
* @param l the l
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void removePropertyChangeListener(PropertyChangeListener l) {
|
||||||
|
pcs.removePropertyChangeListener(l);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
Manifest-Version: 1.0
|
Manifest-Version: 1.0
|
||||||
Bundle-ManifestVersion: 2
|
Bundle-ManifestVersion: 2
|
||||||
Bundle-Name: SWT widget
|
Bundle-Name: SWT database widget
|
||||||
Bundle-SymbolicName: com.minres.scviewer.database.ui.swt
|
Bundle-SymbolicName: com.minres.scviewer.database.ui.swt
|
||||||
Bundle-Version: 3.0.0.qualifier
|
Bundle-Version: 3.0.0.qualifier
|
||||||
Bundle-Vendor: MINRES Technologies GmbH
|
Bundle-Vendor: MINRES Technologies GmbH
|
||||||
|
|
|
@ -144,7 +144,8 @@ public class WaveformView implements IWaveformView {
|
||||||
entry.getValue().selected = true;
|
entry.getValue().selected = true;
|
||||||
} else if (e.button == 3) {
|
} else if (e.button == 3) {
|
||||||
Menu topMenu = top.getMenu();
|
Menu topMenu = top.getMenu();
|
||||||
if(topMenu!=null) topMenu.setVisible(true);
|
if (topMenu != null)
|
||||||
|
topMenu.setVisible(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -157,10 +158,12 @@ public class WaveformView implements IWaveformView {
|
||||||
if (lastClickedEntry.selected) {
|
if (lastClickedEntry.selected) {
|
||||||
int firstIdx = streams.indexOf(lastClickedEntry);
|
int firstIdx = streams.indexOf(lastClickedEntry);
|
||||||
int lastIdx = streams.indexOf(entry.getValue());
|
int lastIdx = streams.indexOf(entry.getValue());
|
||||||
List<TrackEntry> res = firstIdx>lastIdx?streams.subList(lastIdx, firstIdx+1):streams.subList(firstIdx, lastIdx+1);
|
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);
|
setSelection(new StructuredSelection(res), (e.stateMask & SWT.CTRL) != 0, false);
|
||||||
} else
|
} else
|
||||||
setSelection(new StructuredSelection(entry.getValue()), (e.stateMask & SWT.CTRL) !=0 , false);
|
setSelection(new StructuredSelection(entry.getValue()), (e.stateMask & SWT.CTRL) != 0,
|
||||||
|
false);
|
||||||
} else {
|
} else {
|
||||||
setSelection(new StructuredSelection(entry.getValue()), (e.stateMask & SWT.CTRL) != 0, false);
|
setSelection(new StructuredSelection(entry.getValue()), (e.stateMask & SWT.CTRL) != 0, false);
|
||||||
}
|
}
|
||||||
|
@ -191,15 +194,18 @@ public class WaveformView implements IWaveformView {
|
||||||
|
|
||||||
private void mouseUp(MouseEvent e) {
|
private void mouseUp(MouseEvent e) {
|
||||||
down = false;
|
down = false;
|
||||||
if(start==null) return;
|
if (start == null)
|
||||||
if((e.stateMask&SWT.MODIFIER_MASK&~SWT.SHIFT)!=0) return; //don't react on modifier except shift
|
return;
|
||||||
|
if ((e.stateMask & SWT.MODIFIER_MASK & ~SWT.SHIFT) != 0)
|
||||||
|
return; // don't react on modifier except shift
|
||||||
if (e.button == 1 && Math.abs(e.x - start.x) > 3) {
|
if (e.button == 1 && Math.abs(e.x - start.x) > 3) {
|
||||||
asyncUpdate(e.widget);
|
asyncUpdate(e.widget);
|
||||||
long startTime = waveformCanvas.getTimeForOffset(start.x);
|
long startTime = waveformCanvas.getTimeForOffset(start.x);
|
||||||
long endTime = waveformCanvas.getTimeForOffset(end.x);
|
long endTime = waveformCanvas.getTimeForOffset(end.x);
|
||||||
long targetTimeRange = endTime - startTime;
|
long targetTimeRange = endTime - startTime;
|
||||||
long currentTimeRange = waveformCanvas.getMaxVisibleTime() - waveformCanvas.getMinVisibleTime();
|
long currentTimeRange = waveformCanvas.getMaxVisibleTime() - waveformCanvas.getMinVisibleTime();
|
||||||
if(targetTimeRange==0) return;
|
if (targetTimeRange == 0)
|
||||||
|
return;
|
||||||
long relation = currentTimeRange / targetTimeRange;
|
long relation = currentTimeRange / targetTimeRange;
|
||||||
long i = 1;
|
long i = 1;
|
||||||
int level = 0;
|
int level = 0;
|
||||||
|
@ -270,7 +276,8 @@ public class WaveformView implements IWaveformView {
|
||||||
} else if (ceilEntry != null && floorEntry == null) {
|
} else if (ceilEntry != null && floorEntry == null) {
|
||||||
time = ceilEntry.getKey();
|
time = ceilEntry.getKey();
|
||||||
} else if (ceilEntry != null && floorEntry != null) {
|
} else if (ceilEntry != null && floorEntry != null) {
|
||||||
time=time-floorEntry.getKey()<ceilEntry.getKey()-time?floorEntry.getKey(): ceilEntry.getKey();
|
time = time - floorEntry.getKey() < ceilEntry.getKey() - time ? floorEntry.getKey()
|
||||||
|
: ceilEntry.getKey();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return time;
|
return time;
|
||||||
|
@ -284,13 +291,15 @@ public class WaveformView implements IWaveformView {
|
||||||
case SWT.MouseDown:
|
case SWT.MouseDown:
|
||||||
start = new Point(e.x, e.y);
|
start = new Point(e.x, e.y);
|
||||||
end = 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.stateMask & SWT.MODIFIER_MASK) != 0)
|
||||||
|
return; // don't react on modifier
|
||||||
if (e.button == 1) {
|
if (e.button == 1) {
|
||||||
down = true;
|
down = true;
|
||||||
initialSelected = waveformCanvas.getElementsAt(start);
|
initialSelected = waveformCanvas.getElementsAt(start);
|
||||||
} else if (e.button == 3) {
|
} else if (e.button == 3) {
|
||||||
Menu topMenu = top.getMenu();
|
Menu topMenu = top.getMenu();
|
||||||
if(topMenu!=null) topMenu.setVisible(true);
|
if (topMenu != null)
|
||||||
|
topMenu.setVisible(true);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case SWT.MouseUp:
|
case SWT.MouseUp:
|
||||||
|
@ -309,6 +318,7 @@ public class WaveformView implements IWaveformView {
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected WaveformMouseListener waveformMouseListener = new WaveformMouseListener();
|
protected WaveformMouseListener waveformMouseListener = new WaveformMouseListener();
|
||||||
|
|
||||||
public WaveformView(Composite parent, IWaveformStyleProvider styleProvider) {
|
public WaveformView(Composite parent, IWaveformStyleProvider styleProvider) {
|
||||||
|
@ -576,19 +586,21 @@ public class WaveformView implements IWaveformView {
|
||||||
for (IEvent evt : firstTx.getValue()) {
|
for (IEvent evt : firstTx.getValue()) {
|
||||||
if (evt instanceof ITxEvent) {
|
if (evt instanceof ITxEvent) {
|
||||||
ITx tx = ((ITxEvent) evt).getTransaction();
|
ITx tx = ((ITxEvent) evt).getTransaction();
|
||||||
if((evt.getKind()==EventKind.BEGIN || evt.getKind()==EventKind.SINGLE) && tx.getBeginTime()<=time && tx.getEndTime()>=time){
|
if ((evt.getKind() == EventKind.BEGIN || evt.getKind() == EventKind.SINGLE)
|
||||||
if(resultsList[tx.getConcurrencyIndex()]==null)
|
&& tx.getBeginTime() <= time && tx.getEndTime() >= time
|
||||||
|
&& resultsList[tx.getConcurrencyIndex()] == null)
|
||||||
resultsList[tx.getConcurrencyIndex()] = ((ITxEvent) evt).getTransaction();
|
resultsList[tx.getConcurrencyIndex()] = ((ITxEvent) evt).getTransaction();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
firstTx = entry.waveform.getEvents().lowerEntry(firstTx.getKey());
|
firstTx = entry.waveform.getEvents().lowerEntry(firstTx.getKey());
|
||||||
} while (firstTx != null && !isArrayFull(resultsList));
|
} while (firstTx != null && !isArrayFull(resultsList));
|
||||||
boolean separator = false;
|
boolean separator = false;
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
for (ITx o : resultsList) {
|
for (ITx o : resultsList) {
|
||||||
if(separator) sb.append("|");
|
if (separator)
|
||||||
if(o!=null) sb.append(o.getGenerator().getName());
|
sb.append("|");
|
||||||
|
if (o != null)
|
||||||
|
sb.append(o.getGenerator().getName());
|
||||||
separator = true;
|
separator = true;
|
||||||
}
|
}
|
||||||
entry.currentValue = sb.toString();
|
entry.currentValue = sb.toString();
|
||||||
|
@ -602,31 +614,41 @@ public class WaveformView implements IWaveformView {
|
||||||
valueListScrolled.redraw();
|
valueListScrolled.redraw();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private boolean isArrayFull(Object[] array) {
|
private boolean isArrayFull(Object[] array) {
|
||||||
for (Object o : array) {
|
for (Object o : array) {
|
||||||
if(o==null) return false;
|
if (o == null)
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/*
|
||||||
* @see com.minres.scviewer.database.swt.IWaveformPanel#addSelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener)
|
* (non-Javadoc)
|
||||||
|
*
|
||||||
|
* @see
|
||||||
|
* com.minres.scviewer.database.swt.IWaveformPanel#addSelectionChangedListener(
|
||||||
|
* org.eclipse.jface.viewers.ISelectionChangedListener)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void addSelectionChangedListener(ISelectionChangedListener listener) {
|
public void addSelectionChangedListener(ISelectionChangedListener listener) {
|
||||||
selectionChangedListeners.add(listener);
|
selectionChangedListeners.add(listener);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/*
|
||||||
* @see com.minres.scviewer.database.swt.IWaveformPanel#removeSelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener)
|
* (non-Javadoc)
|
||||||
|
*
|
||||||
|
* @see com.minres.scviewer.database.swt.IWaveformPanel#
|
||||||
|
* removeSelectionChangedListener(org.eclipse.jface.viewers.
|
||||||
|
* ISelectionChangedListener)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void removeSelectionChangedListener(ISelectionChangedListener listener) {
|
public void removeSelectionChangedListener(ISelectionChangedListener listener) {
|
||||||
selectionChangedListeners.remove(listener);
|
selectionChangedListeners.remove(listener);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
*
|
||||||
* @see com.minres.scviewer.database.swt.IWaveformPanel#getControl()
|
* @see com.minres.scviewer.database.swt.IWaveformPanel#getControl()
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
@ -634,7 +656,9 @@ public class WaveformView implements IWaveformView {
|
||||||
return top;
|
return top;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
*
|
||||||
* @see com.minres.scviewer.database.swt.IWaveformPanel#getNameControl()
|
* @see com.minres.scviewer.database.swt.IWaveformPanel#getNameControl()
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
@ -642,7 +666,9 @@ public class WaveformView implements IWaveformView {
|
||||||
return nameList;
|
return nameList;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
*
|
||||||
* @see com.minres.scviewer.database.swt.IWaveformPanel#getValueControl()
|
* @see com.minres.scviewer.database.swt.IWaveformPanel#getValueControl()
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
@ -650,7 +676,9 @@ public class WaveformView implements IWaveformView {
|
||||||
return valueList;
|
return valueList;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
*
|
||||||
* @see com.minres.scviewer.database.swt.IWaveformPanel#getWaveformControl()
|
* @see com.minres.scviewer.database.swt.IWaveformPanel#getWaveformControl()
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
@ -658,7 +686,9 @@ public class WaveformView implements IWaveformView {
|
||||||
return waveformCanvas;
|
return waveformCanvas;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
*
|
||||||
* @see com.minres.scviewer.database.swt.IWaveformPanel#getSelection()
|
* @see com.minres.scviewer.database.swt.IWaveformPanel#getSelection()
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
@ -671,22 +701,36 @@ public class WaveformView implements IWaveformView {
|
||||||
return new StructuredSelection(sel.toArray());
|
return new StructuredSelection(sel.toArray());
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/*
|
||||||
* @see com.minres.scviewer.database.swt.IWaveformPanel#setSelection(org.eclipse.jface.viewers.ISelection)
|
* (non-Javadoc)
|
||||||
|
*
|
||||||
|
* @see
|
||||||
|
* com.minres.scviewer.database.swt.IWaveformPanel#setSelection(org.eclipse.
|
||||||
|
* jface.viewers.ISelection)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void setSelection(ISelection selection) {
|
public void setSelection(ISelection selection) {
|
||||||
setSelection(selection, false, false);
|
setSelection(selection, false, false);
|
||||||
}
|
}
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see com.minres.scviewer.database.swt.IWaveformPanel#setSelection(org.eclipse.jface.viewers.ISelection, boolean)
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
*
|
||||||
|
* @see
|
||||||
|
* com.minres.scviewer.database.swt.IWaveformPanel#setSelection(org.eclipse.
|
||||||
|
* jface.viewers.ISelection, boolean)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void setSelection(ISelection selection, boolean showIfNeeded) {
|
public void setSelection(ISelection selection, boolean showIfNeeded) {
|
||||||
setSelection(selection, false, showIfNeeded);
|
setSelection(selection, false, showIfNeeded);
|
||||||
}
|
}
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see com.minres.scviewer.database.swt.IWaveformPanel#addToSelection(org.eclipse.jface.viewers.ISelection, boolean)
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
*
|
||||||
|
* @see
|
||||||
|
* com.minres.scviewer.database.swt.IWaveformPanel#addToSelection(org.eclipse.
|
||||||
|
* jface.viewers.ISelection, boolean)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void addToSelection(ISelection selection, boolean showIfNeeded) {
|
public void addToSelection(ISelection selection, boolean showIfNeeded) {
|
||||||
|
@ -703,12 +747,14 @@ public class WaveformView implements IWaveformView {
|
||||||
currentTxSelection = null;
|
currentTxSelection = null;
|
||||||
currentWaveformSelection.clear();
|
currentWaveformSelection.clear();
|
||||||
} else {
|
} else {
|
||||||
if(!add) currentWaveformSelection.clear();
|
if (!add)
|
||||||
|
currentWaveformSelection.clear();
|
||||||
List<?> selList = sel.toList();
|
List<?> selList = sel.toList();
|
||||||
if (selList.get(0) instanceof ITx) {
|
if (selList.get(0) instanceof ITx) {
|
||||||
ITx txSel = (ITx) selList.get(0);
|
ITx txSel = (ITx) selList.get(0);
|
||||||
TrackEntry trackEntry = selList.size()==2 && selList.get(1) instanceof TrackEntry?
|
TrackEntry trackEntry = selList.size() == 2 && selList.get(1) instanceof TrackEntry
|
||||||
(TrackEntry) selList.get(1):null;
|
? (TrackEntry) selList.get(1)
|
||||||
|
: null;
|
||||||
if (trackEntry == null) {
|
if (trackEntry == null) {
|
||||||
trackEntry = getEntryFor(txSel);
|
trackEntry = getEntryFor(txSel);
|
||||||
if (trackEntry == null && addIfNeeded) {
|
if (trackEntry == null && addIfNeeded) {
|
||||||
|
@ -746,7 +792,8 @@ public class WaveformView implements IWaveformView {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void fireSelectionChanged() {
|
protected void fireSelectionChanged() {
|
||||||
if(currentWaveformSelection==null) return;
|
if (currentWaveformSelection == null)
|
||||||
|
return;
|
||||||
ISelection selection = getSelection();
|
ISelection selection = getSelection();
|
||||||
Object[] list = selectionChangedListeners.getListeners();
|
Object[] list = selectionChangedListeners.getListeners();
|
||||||
for (int i = 0; i < list.length; i++) {
|
for (int i = 0; i < list.length; i++) {
|
||||||
|
@ -754,8 +801,12 @@ public class WaveformView implements IWaveformView {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/*
|
||||||
* @see com.minres.scviewer.database.swt.IWaveformPanel#moveSelection(com.minres.scviewer.database.swt.GotoDirection)
|
* (non-Javadoc)
|
||||||
|
*
|
||||||
|
* @see
|
||||||
|
* com.minres.scviewer.database.swt.IWaveformPanel#moveSelection(com.minres.
|
||||||
|
* scviewer.database.swt.GotoDirection)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void moveSelection(GotoDirection direction) {
|
public void moveSelection(GotoDirection direction) {
|
||||||
|
@ -773,14 +824,20 @@ public class WaveformView implements IWaveformView {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/*
|
||||||
* @see com.minres.scviewer.database.swt.IWaveformPanel#moveSelection(com.minres.scviewer.database.swt.GotoDirection, com.minres.scviewer.database.RelationType)
|
* (non-Javadoc)
|
||||||
|
*
|
||||||
|
* @see
|
||||||
|
* com.minres.scviewer.database.swt.IWaveformPanel#moveSelection(com.minres.
|
||||||
|
* scviewer.database.swt.GotoDirection,
|
||||||
|
* com.minres.scviewer.database.RelationType)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void moveSelection(GotoDirection direction, RelationType relationType) {
|
public void moveSelection(GotoDirection direction, RelationType relationType) {
|
||||||
if(currentWaveformSelection.size() !=1 && currentTxSelection==null) return;
|
if (currentWaveformSelection.size() != 1 && currentTxSelection == null)
|
||||||
TrackEntry selectedWaveform=currentWaveformSelection.size() == 1?
|
return;
|
||||||
currentWaveformSelection.get(0) : getEntryFor(currentTxSelection);
|
TrackEntry selectedWaveform = currentWaveformSelection.size() == 1 ? currentWaveformSelection.get(0)
|
||||||
|
: getEntryFor(currentTxSelection);
|
||||||
if (selectedWaveform.waveform.getType() == WaveformType.TRANSACTION && currentTxSelection != null) {
|
if (selectedWaveform.waveform.getType() == WaveformType.TRANSACTION && currentTxSelection != null) {
|
||||||
if (relationType.equals(IWaveformView.NEXT_PREV_IN_STREAM)) {
|
if (relationType.equals(IWaveformView.NEXT_PREV_IN_STREAM)) {
|
||||||
ITx transaction = null;
|
ITx transaction = null;
|
||||||
|
@ -788,7 +845,8 @@ public class WaveformView implements IWaveformView {
|
||||||
IEvent[] eventsList = selectedWaveform.waveform.getEvents().get(currentTxSelection.getBeginTime());
|
IEvent[] eventsList = selectedWaveform.waveform.getEvents().get(currentTxSelection.getBeginTime());
|
||||||
boolean meFound = false;
|
boolean meFound = false;
|
||||||
for (IEvent evt : eventsList) {
|
for (IEvent evt : eventsList) {
|
||||||
if (evt instanceof ITxEvent && evt.getKind() == EventKind.BEGIN || evt.getKind()==EventKind.SINGLE) {
|
if (evt instanceof ITxEvent && evt.getKind() == EventKind.BEGIN
|
||||||
|
|| evt.getKind() == EventKind.SINGLE) {
|
||||||
if (meFound) {
|
if (meFound) {
|
||||||
transaction = ((ITxEvent) evt).getTransaction();
|
transaction = ((ITxEvent) evt).getTransaction();
|
||||||
break;
|
break;
|
||||||
|
@ -797,10 +855,13 @@ public class WaveformView implements IWaveformView {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (transaction == null) {
|
if (transaction == null) {
|
||||||
Entry<Long, IEvent[]> entry = selectedWaveform.waveform.getEvents().higherEntry(currentTxSelection.getBeginTime());
|
Entry<Long, IEvent[]> entry = selectedWaveform.waveform.getEvents()
|
||||||
if (entry != null) do {
|
.higherEntry(currentTxSelection.getBeginTime());
|
||||||
|
if (entry != null)
|
||||||
|
do {
|
||||||
for (IEvent evt : entry.getValue()) {
|
for (IEvent evt : entry.getValue()) {
|
||||||
if (evt instanceof ITxEvent && (evt.getKind() == EventKind.BEGIN || evt.getKind()==EventKind.SINGLE)) {
|
if (evt instanceof ITxEvent && (evt.getKind() == EventKind.BEGIN
|
||||||
|
|| evt.getKind() == EventKind.SINGLE)) {
|
||||||
transaction = ((ITxEvent) evt).getTransaction();
|
transaction = ((ITxEvent) evt).getTransaction();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -813,7 +874,8 @@ public class WaveformView implements IWaveformView {
|
||||||
IEvent[] eventsList = selectedWaveform.waveform.getEvents().get(currentTxSelection.getBeginTime());
|
IEvent[] eventsList = selectedWaveform.waveform.getEvents().get(currentTxSelection.getBeginTime());
|
||||||
boolean meFound = false;
|
boolean meFound = false;
|
||||||
for (IEvent evt : Lists.reverse(Arrays.asList(eventsList))) {
|
for (IEvent evt : Lists.reverse(Arrays.asList(eventsList))) {
|
||||||
if (evt instanceof ITxEvent && (evt.getKind() == EventKind.BEGIN || evt.getKind()==EventKind.SINGLE)) {
|
if (evt instanceof ITxEvent
|
||||||
|
&& (evt.getKind() == EventKind.BEGIN || evt.getKind() == EventKind.SINGLE)) {
|
||||||
if (meFound) {
|
if (meFound) {
|
||||||
transaction = ((ITxEvent) evt).getTransaction();
|
transaction = ((ITxEvent) evt).getTransaction();
|
||||||
break;
|
break;
|
||||||
|
@ -822,10 +884,13 @@ public class WaveformView implements IWaveformView {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (transaction == null) {
|
if (transaction == null) {
|
||||||
Entry<Long, IEvent[]> entry = selectedWaveform.waveform.getEvents().lowerEntry(currentTxSelection.getBeginTime());
|
Entry<Long, IEvent[]> entry = selectedWaveform.waveform.getEvents()
|
||||||
if (entry != null) do {
|
.lowerEntry(currentTxSelection.getBeginTime());
|
||||||
|
if (entry != null)
|
||||||
|
do {
|
||||||
for (IEvent evt : Lists.reverse(Arrays.asList(entry.getValue()))) {
|
for (IEvent evt : Lists.reverse(Arrays.asList(entry.getValue()))) {
|
||||||
if (evt instanceof ITxEvent && (evt.getKind() == EventKind.BEGIN || evt.getKind()==EventKind.SINGLE)) {
|
if (evt instanceof ITxEvent && (evt.getKind() == EventKind.BEGIN
|
||||||
|
|| evt.getKind() == EventKind.SINGLE)) {
|
||||||
transaction = ((ITxEvent) evt).getTransaction();
|
transaction = ((ITxEvent) evt).getTransaction();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -856,12 +921,16 @@ public class WaveformView implements IWaveformView {
|
||||||
}
|
}
|
||||||
|
|
||||||
private ITxRelation selectTxToNavigateTo(Collection<ITxRelation> rel, RelationType relationType, boolean target) {
|
private ITxRelation selectTxToNavigateTo(Collection<ITxRelation> rel, RelationType relationType, boolean target) {
|
||||||
ArrayList<ITxRelation> candidates = rel.stream().filter(r -> relationType.equals(r.getRelationType())).collect(Collectors.toCollection(ArrayList::new));
|
ArrayList<ITxRelation> candidates = rel.stream().filter(r -> relationType.equals(r.getRelationType()))
|
||||||
|
.collect(Collectors.toCollection(ArrayList::new));
|
||||||
switch (candidates.size()) {
|
switch (candidates.size()) {
|
||||||
case 0: return null;
|
case 0:
|
||||||
case 1: return candidates.get(0);
|
return null;
|
||||||
|
case 1:
|
||||||
|
return candidates.get(0);
|
||||||
default:
|
default:
|
||||||
ArrayList<ITxRelation> visibleCandidates = candidates.stream().filter(this::streamsVisible).collect(Collectors.toCollection(ArrayList::new));
|
ArrayList<ITxRelation> visibleCandidates = candidates.stream().filter(this::streamsVisible)
|
||||||
|
.collect(Collectors.toCollection(ArrayList::new));
|
||||||
if (visibleCandidates.isEmpty()) {
|
if (visibleCandidates.isEmpty()) {
|
||||||
return new RelSelectionDialog(waveformCanvas.getShell(), candidates, target).open();
|
return new RelSelectionDialog(waveformCanvas.getShell(), candidates, target).open();
|
||||||
} else if (visibleCandidates.size() == 1) {
|
} else if (visibleCandidates.size() == 1) {
|
||||||
|
@ -878,12 +947,16 @@ public class WaveformView implements IWaveformView {
|
||||||
return streams.stream().anyMatch(x -> x.waveform == src) && streams.stream().anyMatch(x -> x.waveform == tgt);
|
return streams.stream().anyMatch(x -> x.waveform == src) && streams.stream().anyMatch(x -> x.waveform == tgt);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/*
|
||||||
* @see com.minres.scviewer.database.swt.IWaveformPanel#moveCursor(com.minres.scviewer.database.swt.GotoDirection)
|
* (non-Javadoc)
|
||||||
|
*
|
||||||
|
* @see com.minres.scviewer.database.swt.IWaveformPanel#moveCursor(com.minres.
|
||||||
|
* scviewer.database.swt.GotoDirection)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void moveCursor(GotoDirection direction) {
|
public void moveCursor(GotoDirection direction) {
|
||||||
if(currentWaveformSelection.size()!=1) return;
|
if (currentWaveformSelection.size() != 1)
|
||||||
|
return;
|
||||||
TrackEntry sel = currentWaveformSelection.get(0);
|
TrackEntry sel = currentWaveformSelection.get(0);
|
||||||
long time = getCursorTime();
|
long time = getCursorTime();
|
||||||
NavigableMap<Long, ?> map = null;
|
NavigableMap<Long, ?> map = null;
|
||||||
|
@ -903,14 +976,19 @@ public class WaveformView implements IWaveformView {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
*
|
||||||
* @see com.minres.scviewer.database.swt.IWaveformPanel#getStreamList()
|
* @see com.minres.scviewer.database.swt.IWaveformPanel#getStreamList()
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<TrackEntry> getStreamList() {
|
public List<TrackEntry> getStreamList() {
|
||||||
return streams;
|
return streams;
|
||||||
}
|
}
|
||||||
/* (non-Javadoc)
|
|
||||||
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
*
|
||||||
* @see com.minres.scviewer.database.swt.IWaveformPanel#deleteSelectedTracks()
|
* @see com.minres.scviewer.database.swt.IWaveformPanel#deleteSelectedTracks()
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
@ -926,7 +1004,10 @@ public class WaveformView implements IWaveformView {
|
||||||
setSelection(new StructuredSelection());
|
setSelection(new StructuredSelection());
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
/* (non-Javadoc)
|
|
||||||
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
*
|
||||||
* @see com.minres.scviewer.database.swt.IWaveformPanel#moveSelected(int)
|
* @see com.minres.scviewer.database.swt.IWaveformPanel#moveSelected(int)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
@ -936,7 +1017,8 @@ public class WaveformView implements IWaveformView {
|
||||||
for (Object o : currentWaveformSelection)
|
for (Object o : currentWaveformSelection)
|
||||||
streams.remove(o);
|
streams.remove(o);
|
||||||
int tgtIdx = idx + i;
|
int tgtIdx = idx + i;
|
||||||
if(tgtIdx<0) tgtIdx=0;
|
if (tgtIdx < 0)
|
||||||
|
tgtIdx = 0;
|
||||||
if (tgtIdx >= streams.size())
|
if (tgtIdx >= streams.size())
|
||||||
streams.addAll(currentWaveformSelection);
|
streams.addAll(currentWaveformSelection);
|
||||||
else
|
else
|
||||||
|
@ -944,7 +1026,6 @@ public class WaveformView implements IWaveformView {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
protected void paintNames(GC gc, Rectangle rect) {
|
protected void paintNames(GC gc, Rectangle rect) {
|
||||||
if (!streams.isEmpty()) {
|
if (!streams.isEmpty()) {
|
||||||
try {
|
try {
|
||||||
|
@ -960,7 +1041,8 @@ public class WaveformView implements IWaveformView {
|
||||||
subArea.height *= w.getWidth();
|
subArea.height *= w.getWidth();
|
||||||
drawTextFormat(gc, subArea, firstKey, w.getFullName(), trackEntry.selected);
|
drawTextFormat(gc, subArea, firstKey, w.getFullName(), trackEntry.selected);
|
||||||
} else {
|
} else {
|
||||||
for (Entry<Integer, TrackEntry> entry : trackVerticalOffset.subMap(firstKey, true, lastKey, true).entrySet()) {
|
for (Entry<Integer, TrackEntry> entry : trackVerticalOffset.subMap(firstKey, true, lastKey, true)
|
||||||
|
.entrySet()) {
|
||||||
IWaveform w = entry.getValue().waveform;
|
IWaveform w = entry.getValue().waveform;
|
||||||
subArea.height = styleProvider.getTrackHeight();
|
subArea.height = styleProvider.getTrackHeight();
|
||||||
if (w.getType() == WaveformType.TRANSACTION)
|
if (w.getType() == WaveformType.TRANSACTION)
|
||||||
|
@ -968,7 +1050,8 @@ public class WaveformView implements IWaveformView {
|
||||||
drawTextFormat(gc, subArea, entry.getKey(), w.getFullName(), entry.getValue().selected);
|
drawTextFormat(gc, subArea, entry.getKey(), w.getFullName(), entry.getValue().selected);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}catch(NoSuchElementException e){}
|
} catch (NoSuchElementException e) {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -993,10 +1076,12 @@ public class WaveformView implements IWaveformView {
|
||||||
subArea.height = styleProvider.getTrackHeight();
|
subArea.height = styleProvider.getTrackHeight();
|
||||||
if (w.getType() == WaveformType.TRANSACTION)
|
if (w.getType() == WaveformType.TRANSACTION)
|
||||||
subArea.height *= w.getWidth();
|
subArea.height *= w.getWidth();
|
||||||
drawValue(gc, subArea, entry.getKey(), entry.getValue().currentValue, entry.getValue().selected);
|
drawValue(gc, subArea, entry.getKey(), entry.getValue().currentValue,
|
||||||
|
entry.getValue().selected);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}catch(NoSuchElementException e){}
|
} catch (NoSuchElementException e) {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1005,7 +1090,8 @@ public class WaveformView implements IWaveformView {
|
||||||
for (int offset = 0; offset < subArea.height; offset += styleProvider.getTrackHeight()) {
|
for (int offset = 0; offset < subArea.height; offset += styleProvider.getTrackHeight()) {
|
||||||
int endIndex = value.indexOf('|', beginIndex);
|
int endIndex = value.indexOf('|', beginIndex);
|
||||||
String str = endIndex < 0 ? value.substring(beginIndex) : value.substring(beginIndex, endIndex);
|
String str = endIndex < 0 ? value.substring(beginIndex) : value.substring(beginIndex, endIndex);
|
||||||
drawTextFormat(gc, new Rectangle(subArea.x, subArea.y, subArea.width, styleProvider.getTrackHeight()), yOffset+offset, str, highlite);
|
drawTextFormat(gc, new Rectangle(subArea.x, subArea.y, subArea.width, styleProvider.getTrackHeight()),
|
||||||
|
yOffset + offset, str, highlite);
|
||||||
beginIndex = endIndex < 0 ? beginIndex : endIndex + 1;
|
beginIndex = endIndex < 0 ? beginIndex : endIndex + 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1025,12 +1111,13 @@ public class WaveformView implements IWaveformView {
|
||||||
gc.drawText(value, subArea.x + 5, subArea.y + yOffset + (styleProvider.getTrackHeight() - size.y) / 2, true);
|
gc.drawText(value, subArea.x + 5, subArea.y + yOffset + (styleProvider.getTrackHeight() - size.y) / 2, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void setHighliteRelation(RelationType relationType) {
|
public void setHighliteRelation(RelationType relationType) {
|
||||||
this.waveformCanvas.setHighliteRelation(relationType);
|
this.waveformCanvas.setHighliteRelation(relationType);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
*
|
||||||
* @see com.minres.scviewer.database.swt.IWaveformPanel#getMaxTime()
|
* @see com.minres.scviewer.database.swt.IWaveformPanel#getMaxTime()
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
@ -1038,7 +1125,9 @@ public class WaveformView implements IWaveformView {
|
||||||
return waveformCanvas.getMaxTime();
|
return waveformCanvas.getMaxTime();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
*
|
||||||
* @see com.minres.scviewer.database.swt.IWaveformPanel#setMaxTime(long)
|
* @see com.minres.scviewer.database.swt.IWaveformPanel#setMaxTime(long)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
@ -1046,7 +1135,9 @@ public class WaveformView implements IWaveformView {
|
||||||
this.waveformCanvas.setMaxTime(maxTime);
|
this.waveformCanvas.setMaxTime(maxTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
*
|
||||||
* @see com.minres.scviewer.database.swt.IWaveformPanel#setZoomLevel(int)
|
* @see com.minres.scviewer.database.swt.IWaveformPanel#setZoomLevel(int)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
@ -1055,7 +1146,9 @@ public class WaveformView implements IWaveformView {
|
||||||
waveformCanvas.reveal(getCursorTime());
|
waveformCanvas.reveal(getCursorTime());
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
*
|
||||||
* @see com.minres.scviewer.database.swt.IWaveformPanel#getZoomLevel()
|
* @see com.minres.scviewer.database.swt.IWaveformPanel#getZoomLevel()
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
@ -1063,7 +1156,9 @@ public class WaveformView implements IWaveformView {
|
||||||
return waveformCanvas.getZoomLevel();
|
return waveformCanvas.getZoomLevel();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
*
|
||||||
* @see com.minres.scviewer.database.swt.IWaveformPanel#setCursorTime(long)
|
* @see com.minres.scviewer.database.swt.IWaveformPanel#setCursorTime(long)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
@ -1073,7 +1168,9 @@ public class WaveformView implements IWaveformView {
|
||||||
pcs.firePropertyChange(CURSOR_PROPERTY, oldVal, time);
|
pcs.firePropertyChange(CURSOR_PROPERTY, oldVal, time);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
*
|
||||||
* @see com.minres.scviewer.database.swt.IWaveformPanel#setMarkerTime(long, int)
|
* @see com.minres.scviewer.database.swt.IWaveformPanel#setMarkerTime(long, int)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
@ -1085,7 +1182,9 @@ public class WaveformView implements IWaveformView {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
*
|
||||||
* @see com.minres.scviewer.database.swt.IWaveformPanel#getCursorTime()
|
* @see com.minres.scviewer.database.swt.IWaveformPanel#getCursorTime()
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
@ -1093,7 +1192,9 @@ public class WaveformView implements IWaveformView {
|
||||||
return waveformCanvas.getCursorPainters().get(0).getTime();
|
return waveformCanvas.getCursorPainters().get(0).getTime();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
*
|
||||||
* @see com.minres.scviewer.database.swt.IWaveformPanel#getActMarkerTime()
|
* @see com.minres.scviewer.database.swt.IWaveformPanel#getActMarkerTime()
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
@ -1104,11 +1205,14 @@ public class WaveformView implements IWaveformView {
|
||||||
@Override
|
@Override
|
||||||
public List<ICursor> getCursorList() {
|
public List<ICursor> getCursorList() {
|
||||||
List<ICursor> cursors = new LinkedList<>();
|
List<ICursor> cursors = new LinkedList<>();
|
||||||
for(CursorPainter painter:waveformCanvas.getCursorPainters()) cursors.add(painter);
|
for (CursorPainter painter : waveformCanvas.getCursorPainters())
|
||||||
|
cursors.add(painter);
|
||||||
return Collections.unmodifiableList(cursors);
|
return Collections.unmodifiableList(cursors);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
*
|
||||||
* @see com.minres.scviewer.database.swt.IWaveformPanel#getMarkerTime(int)
|
* @see com.minres.scviewer.database.swt.IWaveformPanel#getMarkerTime(int)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
@ -1125,9 +1229,11 @@ public class WaveformView implements IWaveformView {
|
||||||
public void dragStart(DragSourceEvent event) {
|
public void dragStart(DragSourceEvent event) {
|
||||||
if (event.y < tracksVerticalHeight) {
|
if (event.y < tracksVerticalHeight) {
|
||||||
event.doit = true;
|
event.doit = true;
|
||||||
LocalSelectionTransfer.getTransfer().setSelection(new StructuredSelection(currentWaveformSelection));
|
LocalSelectionTransfer.getTransfer()
|
||||||
|
.setSelection(new StructuredSelection(currentWaveformSelection));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void dragSetData(DragSourceEvent event) {
|
public void dragSetData(DragSourceEvent event) {
|
||||||
if (LocalSelectionTransfer.getTransfer().isSupportedType(event.dataType)) {
|
if (LocalSelectionTransfer.getTransfer().isSupportedType(event.dataType)) {
|
||||||
|
@ -1165,6 +1271,7 @@ public class WaveformView implements IWaveformView {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void dropAccept(DropTargetEvent event) {
|
public void dropAccept(DropTargetEvent event) {
|
||||||
if (event.detail != DND.DROP_MOVE) {
|
if (event.detail != DND.DROP_MOVE) {
|
||||||
|
@ -1175,7 +1282,8 @@ public class WaveformView implements IWaveformView {
|
||||||
}
|
}
|
||||||
|
|
||||||
public TrackEntry getEntryFor(ITx source) {
|
public TrackEntry getEntryFor(ITx source) {
|
||||||
Optional<TrackEntry> optGen = streams.stream().filter(e->source.getGenerator().equals(e.waveform)).findFirst();
|
Optional<TrackEntry> optGen = streams.stream().filter(e -> source.getGenerator().equals(e.waveform))
|
||||||
|
.findFirst();
|
||||||
if (optGen.isPresent())
|
if (optGen.isPresent())
|
||||||
return optGen.get();
|
return optGen.get();
|
||||||
Optional<TrackEntry> optStr = streams.stream().filter(e -> source.getStream().equals(e.waveform)).findFirst();
|
Optional<TrackEntry> optStr = streams.stream().filter(e -> source.getStream().equals(e.waveform)).findFirst();
|
||||||
|
@ -1214,6 +1322,7 @@ public class WaveformView implements IWaveformView {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void dragSetData(DragSourceEvent event) {
|
public void dragSetData(DragSourceEvent event) {
|
||||||
if (LocalSelectionTransfer.getTransfer().isSupportedType(event.dataType)) {
|
if (LocalSelectionTransfer.getTransfer().isSupportedType(event.dataType)) {
|
||||||
|
@ -1221,15 +1330,6 @@ public class WaveformView implements IWaveformView {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
// int style = SWT.MULTI | SWT.WRAP | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER;
|
|
||||||
// final StyledText text = new StyledText(waveformCanvas, style);
|
|
||||||
// text.setText("Dragging");
|
|
||||||
// dragSource.setDragSourceEffect(new DragSourceEffect(text) {
|
|
||||||
// @Override
|
|
||||||
// public void dragStart(DragSourceEvent event) {
|
|
||||||
// event.image = waveformCanvas.getDisplay().getSystemImage(SWT.ICON_WARNING);
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void createWaveformDropTarget(final Canvas canvas) {
|
private void createWaveformDropTarget(final Canvas canvas) {
|
||||||
|
@ -1241,26 +1341,29 @@ public class WaveformView implements IWaveformView {
|
||||||
public void drop(DropTargetEvent event) {
|
public void drop(DropTargetEvent event) {
|
||||||
if (LocalSelectionTransfer.getTransfer().isSupportedType(event.currentDataType)) {
|
if (LocalSelectionTransfer.getTransfer().isSupportedType(event.currentDataType)) {
|
||||||
ISelection sel = LocalSelectionTransfer.getTransfer().getSelection();
|
ISelection sel = LocalSelectionTransfer.getTransfer().getSelection();
|
||||||
if(sel instanceof IStructuredSelection &&
|
if (sel instanceof IStructuredSelection
|
||||||
((IStructuredSelection)sel).getFirstElement() instanceof CursorPainter){
|
&& ((IStructuredSelection) sel).getFirstElement() instanceof CursorPainter) {
|
||||||
CursorPainter painter = (CursorPainter) ((IStructuredSelection) sel).getFirstElement();
|
CursorPainter painter = (CursorPainter) ((IStructuredSelection) sel).getFirstElement();
|
||||||
painter.setDragging(false);
|
painter.setDragging(false);
|
||||||
updateWaveform(canvas, event, painter);
|
updateWaveform(canvas, event, painter);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void dropAccept(DropTargetEvent event) {
|
public void dropAccept(DropTargetEvent event) {
|
||||||
Point offset = canvas.toControl(event.x, event.y);
|
Point offset = canvas.toControl(event.x, event.y);
|
||||||
if (event.detail != DND.DROP_MOVE || offset.y > trackVerticalOffset.lastKey() + styleProvider.getTrackHeight()) {
|
if (event.detail != DND.DROP_MOVE
|
||||||
|
|| offset.y > trackVerticalOffset.lastKey() + styleProvider.getTrackHeight()) {
|
||||||
event.detail = DND.DROP_NONE;
|
event.detail = DND.DROP_NONE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void dragOver(DropTargetEvent event) {
|
public void dragOver(DropTargetEvent event) {
|
||||||
ISelection sel = LocalSelectionTransfer.getTransfer().getSelection();
|
ISelection sel = LocalSelectionTransfer.getTransfer().getSelection();
|
||||||
if(sel instanceof IStructuredSelection &&
|
if (sel instanceof IStructuredSelection
|
||||||
((IStructuredSelection)sel).getFirstElement() instanceof CursorPainter){
|
&& ((IStructuredSelection) sel).getFirstElement() instanceof CursorPainter) {
|
||||||
updateWaveform(canvas, event, (CursorPainter) ((IStructuredSelection) sel).getFirstElement());
|
updateWaveform(canvas, event, (CursorPainter) ((IStructuredSelection) sel).getFirstElement());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1287,16 +1390,24 @@ public class WaveformView implements IWaveformView {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/*
|
||||||
* @see com.minres.scviewer.database.swt.IWaveformPanel#addPropertyChangeListener(java.beans.PropertyChangeListener)
|
* (non-Javadoc)
|
||||||
|
*
|
||||||
|
* @see
|
||||||
|
* com.minres.scviewer.database.swt.IWaveformPanel#addPropertyChangeListener(
|
||||||
|
* java.beans.PropertyChangeListener)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void addPropertyChangeListener(PropertyChangeListener listener) {
|
public void addPropertyChangeListener(PropertyChangeListener listener) {
|
||||||
this.pcs.addPropertyChangeListener(listener);
|
this.pcs.addPropertyChangeListener(listener);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/*
|
||||||
* @see com.minres.scviewer.database.swt.IWaveformPanel#addPropertyChangeListener(java.lang.String, java.beans.PropertyChangeListener)
|
* (non-Javadoc)
|
||||||
|
*
|
||||||
|
* @see
|
||||||
|
* com.minres.scviewer.database.swt.IWaveformPanel#addPropertyChangeListener(
|
||||||
|
* java.lang.String, java.beans.PropertyChangeListener)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void addPropertyChangeListener(String propertyName, PropertyChangeListener listener) {
|
public void addPropertyChangeListener(String propertyName, PropertyChangeListener listener) {
|
||||||
|
@ -1311,16 +1422,24 @@ public class WaveformView implements IWaveformView {
|
||||||
return this.pcs.getPropertyChangeListeners(propertyName);
|
return this.pcs.getPropertyChangeListeners(propertyName);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/*
|
||||||
* @see com.minres.scviewer.database.swt.IWaveformPanel#removePropertyChangeListener(java.beans.PropertyChangeListener)
|
* (non-Javadoc)
|
||||||
|
*
|
||||||
|
* @see
|
||||||
|
* com.minres.scviewer.database.swt.IWaveformPanel#removePropertyChangeListener(
|
||||||
|
* java.beans.PropertyChangeListener)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void removePropertyChangeListener(PropertyChangeListener listener) {
|
public void removePropertyChangeListener(PropertyChangeListener listener) {
|
||||||
this.pcs.removePropertyChangeListener(listener);
|
this.pcs.removePropertyChangeListener(listener);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/*
|
||||||
* @see com.minres.scviewer.database.swt.IWaveformPanel#removePropertyChangeListener(java.lang.String, java.beans.PropertyChangeListener)
|
* (non-Javadoc)
|
||||||
|
*
|
||||||
|
* @see
|
||||||
|
* com.minres.scviewer.database.swt.IWaveformPanel#removePropertyChangeListener(
|
||||||
|
* java.lang.String, java.beans.PropertyChangeListener)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void removePropertyChangeListener(String propertyName, PropertyChangeListener listener) {
|
public void removePropertyChangeListener(String propertyName, PropertyChangeListener listener) {
|
||||||
|
@ -1331,7 +1450,9 @@ public class WaveformView implements IWaveformView {
|
||||||
return this.pcs.hasListeners(propertyName);
|
return this.pcs.hasListeners(propertyName);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
*
|
||||||
* @see com.minres.scviewer.database.swt.IWaveformPanel#getScaledTime(long)
|
* @see com.minres.scviewer.database.swt.IWaveformPanel#getScaledTime(long)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
@ -1342,7 +1463,9 @@ public class WaveformView implements IWaveformView {
|
||||||
return sb.append(df.format(scaledTime)).append(waveformCanvas.getUnitStr()).toString();
|
return sb.append(df.format(scaledTime)).append(waveformCanvas.getUnitStr()).toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
*
|
||||||
* @see com.minres.scviewer.database.swt.IWaveformPanel#getZoomLevels()
|
* @see com.minres.scviewer.database.swt.IWaveformPanel#getZoomLevels()
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
@ -1371,8 +1494,10 @@ public class WaveformView implements IWaveformView {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void scrollHorizontal(int percent) {
|
public void scrollHorizontal(int percent) {
|
||||||
if(percent<-100) percent=-100;
|
if (percent < -100)
|
||||||
if(percent>100) percent=100;
|
percent = -100;
|
||||||
|
if (percent > 100)
|
||||||
|
percent = 100;
|
||||||
int diff = (waveformCanvas.getWidth() * percent) / 100;
|
int diff = (waveformCanvas.getWidth() * percent) / 100;
|
||||||
Point o = waveformCanvas.getOrigin();
|
Point o = waveformCanvas.getOrigin();
|
||||||
waveformCanvas.setOrigin(o.x - diff, o.y);
|
waveformCanvas.setOrigin(o.x - diff, o.y);
|
||||||
|
|
|
@ -2,7 +2,7 @@ Manifest-Version: 1.0
|
||||||
Bundle-ManifestVersion: 2
|
Bundle-ManifestVersion: 2
|
||||||
Bundle-Name: VCD signal database
|
Bundle-Name: VCD signal database
|
||||||
Bundle-SymbolicName: com.minres.scviewer.database.vcd
|
Bundle-SymbolicName: com.minres.scviewer.database.vcd
|
||||||
Bundle-Version: 2.1.0.qualifier
|
Bundle-Version: 2.2.0.qualifier
|
||||||
Bundle-Vendor: MINRES Technologies GmbH
|
Bundle-Vendor: MINRES Technologies GmbH
|
||||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
|
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
|
||||||
Require-Bundle: com.minres.scviewer.database;bundle-version="1.0.0",
|
Require-Bundle: com.minres.scviewer.database;bundle-version="1.0.0",
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<artifactId>com.minres.scviewer.database.vcd</artifactId>
|
<artifactId>com.minres.scviewer.database.vcd</artifactId>
|
||||||
<version>2.1.0-SNAPSHOT</version>
|
<version>2.2.0-SNAPSHOT</version>
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.minres.scviewer</groupId>
|
<groupId>com.minres.scviewer</groupId>
|
||||||
<artifactId>com.minres.scviewer.parent</artifactId>
|
<artifactId>com.minres.scviewer.parent</artifactId>
|
||||||
|
|
|
@ -10,6 +10,8 @@
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package com.minres.scviewer.database.vcd;
|
package com.minres.scviewer.database.vcd;
|
||||||
|
|
||||||
|
import java.beans.PropertyChangeListener;
|
||||||
|
import java.beans.PropertyChangeSupport;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileInputStream;
|
import java.io.FileInputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
@ -23,6 +25,7 @@ import java.util.TreeMap;
|
||||||
import java.util.Vector;
|
import java.util.Vector;
|
||||||
import java.util.zip.GZIPInputStream;
|
import java.util.zip.GZIPInputStream;
|
||||||
|
|
||||||
|
import com.google.common.collect.Iterables;
|
||||||
import com.minres.scviewer.database.BitVector;
|
import com.minres.scviewer.database.BitVector;
|
||||||
import com.minres.scviewer.database.DoubleVal;
|
import com.minres.scviewer.database.DoubleVal;
|
||||||
import com.minres.scviewer.database.IEvent;
|
import com.minres.scviewer.database.IEvent;
|
||||||
|
@ -50,6 +53,9 @@ public class VCDDbLoader implements IWaveformDbLoader, IVCDDatabaseBuilder {
|
||||||
/** The max time. */
|
/** The max time. */
|
||||||
private long maxTime;
|
private long maxTime;
|
||||||
|
|
||||||
|
/** The pcs. */
|
||||||
|
protected PropertyChangeSupport pcs = new PropertyChangeSupport(this);
|
||||||
|
|
||||||
private static boolean isGzipped(File f) {
|
private static boolean isGzipped(File f) {
|
||||||
try (InputStream is = new FileInputStream(f)) {
|
try (InputStream is = new FileInputStream(f)) {
|
||||||
byte [] signature = new byte[2];
|
byte [] signature = new byte[2];
|
||||||
|
@ -62,23 +68,44 @@ public class VCDDbLoader implements IWaveformDbLoader, IVCDDatabaseBuilder {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/**
|
||||||
* @see com.minres.scviewer.database.ITrDb#load(java.io.File)
|
* Can load.
|
||||||
|
*
|
||||||
|
* @param inputFile the input file
|
||||||
|
* @return true, if successful
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
@Override
|
@Override
|
||||||
public boolean load(IWaveformDb db, File file) throws InputFormatException {
|
public boolean canLoad(File inputFile) {
|
||||||
dispose();
|
if(!inputFile.isDirectory() || inputFile.exists()) {
|
||||||
if(file.isDirectory() || !file.exists()) return false;
|
String name = inputFile.getName();
|
||||||
this.maxTime=0;
|
|
||||||
boolean res = false;
|
|
||||||
try {
|
|
||||||
String name = file.getCanonicalFile().getName();
|
|
||||||
if(!(name.endsWith(".vcd") ||
|
if(!(name.endsWith(".vcd") ||
|
||||||
name.endsWith(".vcdz") ||
|
name.endsWith(".vcdz") ||
|
||||||
name.endsWith(".vcdgz") ||
|
name.endsWith(".vcdgz") ||
|
||||||
name.endsWith(".vcd.gz")) )
|
name.endsWith(".vcd.gz")) )
|
||||||
return false;
|
return false;
|
||||||
|
boolean gzipped = isGzipped(inputFile);
|
||||||
|
try(InputStream stream = gzipped ? new GZIPInputStream(new FileInputStream(inputFile)) : new FileInputStream(inputFile)){
|
||||||
|
byte[] buffer = new byte[8];
|
||||||
|
if (stream.read(buffer, 0, buffer.length) == buffer.length) {
|
||||||
|
return buffer[0]=='$';
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see com.minres.scviewer.database.ITrDb#load(java.io.File)
|
||||||
|
*/
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
@Override
|
||||||
|
public void load(IWaveformDb db, File file) throws InputFormatException {
|
||||||
|
dispose();
|
||||||
|
this.maxTime=0;
|
||||||
|
boolean res = false;
|
||||||
|
try {
|
||||||
signals = new Vector<>();
|
signals = new Vector<>();
|
||||||
moduleStack= new ArrayDeque<>();
|
moduleStack= new ArrayDeque<>();
|
||||||
FileInputStream fis = new FileInputStream(file);
|
FileInputStream fis = new FileInputStream(file);
|
||||||
|
@ -89,13 +116,13 @@ public class VCDDbLoader implements IWaveformDbLoader, IVCDDatabaseBuilder {
|
||||||
throw new InputFormatException();
|
throw new InputFormatException();
|
||||||
}
|
}
|
||||||
if(!res) throw new InputFormatException();
|
if(!res) throw new InputFormatException();
|
||||||
// calculate max time of database
|
// calculate max time of this database
|
||||||
for(IWaveform waveform:signals) {
|
for(IWaveform waveform:signals) {
|
||||||
NavigableMap<Long, IEvent[]> events =waveform.getEvents();
|
NavigableMap<Long, IEvent[]> events =waveform.getEvents();
|
||||||
if(events.size()>0)
|
if(!events.isEmpty())
|
||||||
maxTime= Math.max(maxTime, events.lastKey());
|
maxTime= Math.max(maxTime, events.lastKey());
|
||||||
}
|
}
|
||||||
// extend signals to hav a last value set at max time
|
// extend signals to have a last value set at max time
|
||||||
for(IWaveform s:signals){
|
for(IWaveform s:signals){
|
||||||
if(s instanceof VCDSignal<?>) {
|
if(s instanceof VCDSignal<?>) {
|
||||||
TreeMap<Long,?> events = (TreeMap<Long, ?>) ((VCDSignal<?>)s).getEvents();
|
TreeMap<Long,?> events = (TreeMap<Long, ?>) ((VCDSignal<?>)s).getEvents();
|
||||||
|
@ -108,7 +135,7 @@ public class VCDDbLoader implements IWaveformDbLoader, IVCDDatabaseBuilder {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
pcs.firePropertyChange(IWaveformDbLoader.LOADING_FINISHED, null, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void dispose() {
|
public void dispose() {
|
||||||
|
@ -167,6 +194,7 @@ public class VCDDbLoader implements IWaveformDbLoader, IVCDDatabaseBuilder {
|
||||||
signals.add( i<0 ? new VCDSignal<BitVector>(id, netName, width) :
|
signals.add( i<0 ? new VCDSignal<BitVector>(id, netName, width) :
|
||||||
new VCDSignal<BitVector>((VCDSignal<BitVector>)signals.get(i), id, netName));
|
new VCDSignal<BitVector>((VCDSignal<BitVector>)signals.get(i), id, netName));
|
||||||
}
|
}
|
||||||
|
pcs.firePropertyChange(IWaveformDbLoader.SIGNAL_ADDED, null, Iterables.getLast(signals));
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -209,4 +237,25 @@ public class VCDDbLoader implements IWaveformDbLoader, IVCDDatabaseBuilder {
|
||||||
return Collections.emptyList();
|
return Collections.emptyList();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds the property change listener.
|
||||||
|
*
|
||||||
|
* @param l the l
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void addPropertyChangeListener(PropertyChangeListener l) {
|
||||||
|
pcs.addPropertyChangeListener(l);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Removes the property change listener.
|
||||||
|
*
|
||||||
|
* @param l the l
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void removePropertyChangeListener(PropertyChangeListener l) {
|
||||||
|
pcs.removePropertyChangeListener(l);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -161,12 +161,9 @@ class VCDFileParser {
|
||||||
else if (tokenizer.sval.equals("$enddefinitions")) {
|
else if (tokenizer.sval.equals("$enddefinitions")) {
|
||||||
match("$end");
|
match("$end");
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else do {
|
||||||
// Ignore this defintion
|
|
||||||
do {
|
|
||||||
if (!nextToken()) return false;
|
if (!nextToken()) return false;
|
||||||
} while (!tokenizer.sval.equals("$end"));
|
} while (!tokenizer.sval.equals("$end"));
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@ Manifest-Version: 1.0
|
||||||
Bundle-ManifestVersion: 2
|
Bundle-ManifestVersion: 2
|
||||||
Bundle-Name: Waveform database
|
Bundle-Name: Waveform database
|
||||||
Bundle-SymbolicName: com.minres.scviewer.database
|
Bundle-SymbolicName: com.minres.scviewer.database
|
||||||
Bundle-Version: 2.0.0.qualifier
|
Bundle-Version: 3.0.0.qualifier
|
||||||
Bundle-Vendor: MINRES Technologies GmbH
|
Bundle-Vendor: MINRES Technologies GmbH
|
||||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
|
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
|
||||||
Export-Package: com.minres.scviewer.database,
|
Export-Package: com.minres.scviewer.database,
|
||||||
|
|
|
@ -8,4 +8,5 @@
|
||||||
<relativePath>../..</relativePath>
|
<relativePath>../..</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<packaging>eclipse-plugin</packaging>
|
<packaging>eclipse-plugin</packaging>
|
||||||
|
<version>3.0.0-SNAPSHOT</version>
|
||||||
</project>
|
</project>
|
||||||
|
|
|
@ -13,6 +13,7 @@ package com.minres.scviewer.database;
|
||||||
import java.beans.PropertyChangeListener;
|
import java.beans.PropertyChangeListener;
|
||||||
import java.beans.PropertyChangeSupport;
|
import java.beans.PropertyChangeSupport;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -27,18 +28,10 @@ public class HierNode implements IHierNode {
|
||||||
protected IHierNode parent = null;
|
protected IHierNode parent = null;
|
||||||
|
|
||||||
/** The childs. */
|
/** The childs. */
|
||||||
protected ArrayList<IHierNode> childs;
|
protected List<IHierNode> childNodes = Collections.synchronizedList(new ArrayList<>());
|
||||||
|
|
||||||
/** The pcs. */
|
/** The pcs. */
|
||||||
protected PropertyChangeSupport pcs;
|
protected PropertyChangeSupport pcs = new PropertyChangeSupport(this);
|
||||||
|
|
||||||
/**
|
|
||||||
* Instantiates a new hier node.
|
|
||||||
*/
|
|
||||||
public HierNode() {
|
|
||||||
childs = new ArrayList<>();
|
|
||||||
pcs = new PropertyChangeSupport(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instantiates a new hier node.
|
* Instantiates a new hier node.
|
||||||
|
@ -46,7 +39,6 @@ public class HierNode implements IHierNode {
|
||||||
* @param name the name
|
* @param name the name
|
||||||
*/
|
*/
|
||||||
public HierNode(String name) {
|
public HierNode(String name) {
|
||||||
this();
|
|
||||||
this.name = name;
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -57,11 +49,16 @@ public class HierNode implements IHierNode {
|
||||||
* @param parent the parent
|
* @param parent the parent
|
||||||
*/
|
*/
|
||||||
public HierNode(String name, IHierNode parent) {
|
public HierNode(String name, IHierNode parent) {
|
||||||
this();
|
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.parent = parent;
|
this.parent = parent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Instantiates a new hier node.
|
||||||
|
*/
|
||||||
|
public HierNode() {
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds the property change listener.
|
* Adds the property change listener.
|
||||||
*
|
*
|
||||||
|
@ -115,6 +112,16 @@ public class HierNode implements IHierNode {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the parent.
|
||||||
|
*
|
||||||
|
* @return the parent
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public IHierNode getParent() {
|
||||||
|
return parent;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the parent.
|
* Sets the parent.
|
||||||
*
|
*
|
||||||
|
@ -132,7 +139,7 @@ public class HierNode implements IHierNode {
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public List<IHierNode> getChildNodes() {
|
public List<IHierNode> getChildNodes() {
|
||||||
return childs;
|
return Collections.unmodifiableList(childNodes);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -140,9 +147,10 @@ public class HierNode implements IHierNode {
|
||||||
*
|
*
|
||||||
* @param child the child
|
* @param child the child
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void addChild(IHierNode child) {
|
public void addChild(IHierNode child) {
|
||||||
if (!childs.contains(child)) {
|
if (!childNodes.contains(child)) {
|
||||||
childs.add(child);
|
childNodes.add(child);
|
||||||
child.setParent(this);
|
child.setParent(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,6 +18,15 @@ import java.util.List;
|
||||||
*/
|
*/
|
||||||
public interface IHierNode extends Comparable<IHierNode> {
|
public interface IHierNode extends Comparable<IHierNode> {
|
||||||
|
|
||||||
|
/** The Constant WAVEFORMS. */
|
||||||
|
static final String WAVEFORMS = "Waveforms";
|
||||||
|
|
||||||
|
/** The Constant CHILDS. */
|
||||||
|
static final String CHILDS = "Childs";
|
||||||
|
|
||||||
|
/** The Constant LOADING_FINISHED. */
|
||||||
|
static final String LOADING_FINISHED = "LoadingFinished";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Attach a non-null PropertyChangeListener to this object.
|
* Attach a non-null PropertyChangeListener to this object.
|
||||||
*
|
*
|
||||||
|
@ -61,6 +70,13 @@ public interface IHierNode extends Comparable<IHierNode> {
|
||||||
*/
|
*/
|
||||||
public void setParent(IHierNode parent);
|
public void setParent(IHierNode parent);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the parent.
|
||||||
|
*
|
||||||
|
* @return the parent
|
||||||
|
*/
|
||||||
|
public IHierNode getParent();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the child nodes.
|
* Gets the child nodes.
|
||||||
*
|
*
|
||||||
|
@ -68,6 +84,12 @@ public interface IHierNode extends Comparable<IHierNode> {
|
||||||
*/
|
*/
|
||||||
public List<IHierNode> getChildNodes();
|
public List<IHierNode> getChildNodes();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds the child.
|
||||||
|
*
|
||||||
|
* @param child the child
|
||||||
|
*/
|
||||||
|
public void addChild(IHierNode child);
|
||||||
/**
|
/**
|
||||||
* Derive waveform.
|
* Derive waveform.
|
||||||
*
|
*
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package com.minres.scviewer.database;
|
package com.minres.scviewer.database;
|
||||||
|
|
||||||
|
import java.beans.PropertyChangeListener;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
|
||||||
|
@ -17,38 +18,51 @@ import java.util.Collection;
|
||||||
* The Interface IWaveformDbLoader.
|
* The Interface IWaveformDbLoader.
|
||||||
*/
|
*/
|
||||||
public interface IWaveformDbLoader {
|
public interface IWaveformDbLoader {
|
||||||
// static final String STREAM_ADDED = "StreamAdded";
|
|
||||||
//
|
|
||||||
// static final String GENERATOR_ADDED = "GeneratorAdded";
|
|
||||||
//
|
|
||||||
// static final String LOADING_FINISHED = "LoadingFinished";
|
|
||||||
// /**
|
|
||||||
// * Attach a non-null PropertyChangeListener to this object.
|
|
||||||
// *
|
|
||||||
// * @param l
|
|
||||||
// * a non-null PropertyChangeListener instance
|
|
||||||
// * @throws IllegalArgumentException
|
|
||||||
// * if the parameter is null
|
|
||||||
// */
|
|
||||||
// public void addPropertyChangeListener(PropertyChangeListener l);
|
|
||||||
//
|
|
||||||
// /**
|
|
||||||
// * Remove a PropertyChangeListener from this component.
|
|
||||||
// *
|
|
||||||
// * @param l
|
|
||||||
// * a PropertyChangeListener instance
|
|
||||||
// */
|
|
||||||
// public void removePropertyChangeListener(PropertyChangeListener l) ;
|
|
||||||
|
|
||||||
|
/** The Constant STREAM_ADDED. */
|
||||||
|
static final String STREAM_ADDED = "StreamAdded";
|
||||||
|
|
||||||
|
/** The Constant STREAM_ADDED. */
|
||||||
|
static final String SIGNAL_ADDED = "SignalAdded";
|
||||||
|
|
||||||
|
/** The Constant GENERATOR_ADDED. */
|
||||||
|
static final String GENERATOR_ADDED = "GeneratorAdded";
|
||||||
|
|
||||||
|
/** The Constant LOADING_FINISHED. */
|
||||||
|
static final String LOADING_FINISHED = "LoadingFinished";
|
||||||
|
/**
|
||||||
|
* Attach a non-null PropertyChangeListener to this object.
|
||||||
|
*
|
||||||
|
* @param l
|
||||||
|
* a non-null PropertyChangeListener instance
|
||||||
|
* @throws IllegalArgumentException
|
||||||
|
* if the parameter is null
|
||||||
|
*/
|
||||||
|
public void addPropertyChangeListener(PropertyChangeListener l);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove a PropertyChangeListener from this component.
|
||||||
|
*
|
||||||
|
* @param l
|
||||||
|
* a PropertyChangeListener instance
|
||||||
|
*/
|
||||||
|
public void removePropertyChangeListener(PropertyChangeListener l) ;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Can load the given file.
|
||||||
|
*
|
||||||
|
* @param inputFile the input file
|
||||||
|
* @return true, if successful
|
||||||
|
*/
|
||||||
|
public boolean canLoad(File inputFile);
|
||||||
/**
|
/**
|
||||||
* Load.
|
* Load.
|
||||||
*
|
*
|
||||||
* @param db the db
|
* @param db the db
|
||||||
* @param inp the inp
|
* @param inputFile the input file
|
||||||
* @return true, if successful
|
|
||||||
* @throws InputFormatException the input format exception
|
* @throws InputFormatException the input format exception
|
||||||
*/
|
*/
|
||||||
public boolean load(IWaveformDb db, File inp) throws InputFormatException;
|
public void load(IWaveformDb db, File inputFile) throws InputFormatException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the max time.
|
* Gets the max time.
|
||||||
|
|
|
@ -10,6 +10,8 @@
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package com.minres.scviewer.database.internal;
|
package com.minres.scviewer.database.internal;
|
||||||
|
|
||||||
|
import java.beans.PropertyChangeEvent;
|
||||||
|
import java.beans.PropertyChangeListener;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
@ -28,7 +30,7 @@ import com.minres.scviewer.database.RelationType;
|
||||||
/**
|
/**
|
||||||
* The Class WaveformDb.
|
* The Class WaveformDb.
|
||||||
*/
|
*/
|
||||||
public class WaveformDb extends HierNode implements IWaveformDb {
|
public class WaveformDb extends HierNode implements IWaveformDb, PropertyChangeListener {
|
||||||
|
|
||||||
/** The loaders. */
|
/** The loaders. */
|
||||||
private static List<IWaveformDbLoader> loaders = new LinkedList<>();
|
private static List<IWaveformDbLoader> loaders = new LinkedList<>();
|
||||||
|
@ -122,8 +124,11 @@ public class WaveformDb extends HierNode implements IWaveformDb {
|
||||||
@Override
|
@Override
|
||||||
public boolean load(File inp) {
|
public boolean load(File inp) {
|
||||||
for (IWaveformDbLoader loader : loaders) {
|
for (IWaveformDbLoader loader : loaders) {
|
||||||
|
if (loader.canLoad(inp)) {
|
||||||
try {
|
try {
|
||||||
if (loader.load(this, inp)) {
|
loader.addPropertyChangeListener(this);
|
||||||
|
loader.load(this, inp);
|
||||||
|
loader.removePropertyChangeListener(this);
|
||||||
for (IWaveform w : loader.getAllWaves()) {
|
for (IWaveform w : loader.getAllWaves()) {
|
||||||
waveforms.put(w.getFullName(), w);
|
waveforms.put(w.getFullName(), w);
|
||||||
}
|
}
|
||||||
|
@ -134,15 +139,14 @@ public class WaveformDb extends HierNode implements IWaveformDb {
|
||||||
name = getFileBasename(inp.getName());
|
name = getFileBasename(inp.getName());
|
||||||
buildHierarchyNodes();
|
buildHierarchyNodes();
|
||||||
relationTypes.addAll(loader.getAllRelationTypes());
|
relationTypes.addAll(loader.getAllRelationTypes());
|
||||||
pcs.firePropertyChange("WAVEFORMS", null, waveforms);
|
pcs.firePropertyChange(IHierNode.LOADING_FINISHED, null, null);
|
||||||
pcs.firePropertyChange("CHILDS", null, childs);
|
|
||||||
loaded = true;
|
loaded = true;
|
||||||
return true;
|
return true;
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -167,7 +171,7 @@ public class WaveformDb extends HierNode implements IWaveformDb {
|
||||||
@Override
|
@Override
|
||||||
public void clear() {
|
public void clear() {
|
||||||
waveforms.clear();
|
waveforms.clear();
|
||||||
childs.clear();
|
childNodes.clear();
|
||||||
loaded = false;
|
loaded = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -180,12 +184,38 @@ public class WaveformDb extends HierNode implements IWaveformDb {
|
||||||
return loaded;
|
return loaded;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void propertyChange(PropertyChangeEvent evt) {
|
||||||
|
if (IWaveformDbLoader.SIGNAL_ADDED.equals(evt.getPropertyName())
|
||||||
|
|| IWaveformDbLoader.STREAM_ADDED.equals(evt.getPropertyName())) {
|
||||||
|
IWaveform waveform = (IWaveform) evt.getNewValue();
|
||||||
|
putInHierarchy(waveform);
|
||||||
|
pcs.firePropertyChange(IHierNode.WAVEFORMS, null, waveforms);
|
||||||
|
pcs.firePropertyChange(IHierNode.CHILDS, null, childNodes);
|
||||||
|
} else if (IWaveformDbLoader.GENERATOR_ADDED.equals(evt.getPropertyName())) {
|
||||||
|
pcs.firePropertyChange(IHierNode.CHILDS, null, childNodes);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Builds the hierarchy nodes.
|
* Builds the hierarchy nodes.
|
||||||
*/
|
*/
|
||||||
private void buildHierarchyNodes() {
|
private void buildHierarchyNodes() {
|
||||||
|
boolean needsSorting = false;
|
||||||
for (IWaveform stream : getAllWaves()) {
|
for (IWaveform stream : getAllWaves()) {
|
||||||
String[] hier = stream.getName().split("\\.");
|
if (stream.getParent() == null) {
|
||||||
|
putInHierarchy(stream);
|
||||||
|
needsSorting = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (needsSorting) {
|
||||||
|
pcs.firePropertyChange(IHierNode.WAVEFORMS, null, waveforms);
|
||||||
|
pcs.firePropertyChange(IHierNode.CHILDS, null, childNodes);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private synchronized void putInHierarchy(IWaveform waveform) {
|
||||||
|
String[] hier = waveform.getName().split("\\.");
|
||||||
IHierNode node = this;
|
IHierNode node = this;
|
||||||
for (int i = 0; i < hier.length - 1; ++i) {
|
for (int i = 0; i < hier.length - 1; ++i) {
|
||||||
String name = hier[i];
|
String name = hier[i];
|
||||||
|
@ -201,28 +231,13 @@ public class WaveformDb extends HierNode implements IWaveformDb {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
HierNode newNode = new HierNode(name, node);
|
HierNode newNode = new HierNode(name, node);
|
||||||
node.getChildNodes().add(newNode);
|
node.addChild(newNode);
|
||||||
node = newNode;
|
node = newNode;
|
||||||
|
|
||||||
}
|
}
|
||||||
node.getChildNodes().add(stream);
|
node.addChild(waveform);
|
||||||
stream.setParent(node);
|
waveform.setParent(node);
|
||||||
stream.setName(hier[hier.length - 1]);
|
waveform.setName(hier[hier.length - 1]);
|
||||||
}
|
|
||||||
sortRecursive(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sort recursive.
|
|
||||||
*
|
|
||||||
* @param node the node
|
|
||||||
*/
|
|
||||||
private void sortRecursive(IHierNode node) {
|
|
||||||
Collections.sort(node.getChildNodes(), (IHierNode o1, IHierNode o2) -> o1.getName().compareTo(o2.getName()));
|
|
||||||
for (IHierNode n : node.getChildNodes()) {
|
|
||||||
if (!n.getChildNodes().isEmpty())
|
|
||||||
sortRecursive(n);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -234,4 +249,5 @@ public class WaveformDb extends HierNode implements IWaveformDb {
|
||||||
public List<RelationType> getAllRelationTypes() {
|
public List<RelationType> getAllRelationTypes() {
|
||||||
return relationTypes;
|
return relationTypes;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
package com.minres.scviewer.e4.application;
|
||||||
|
|
||||||
|
public class Constants {
|
||||||
|
|
||||||
|
public static final String PLUGIN_ID = "com.minres.scviewer.e4.application"; //$NON-NLS-1$
|
||||||
|
|
||||||
|
private Constants() {}
|
||||||
|
|
||||||
|
}
|
|
@ -29,8 +29,8 @@ import com.minres.scviewer.e4.application.parts.DesignBrowser;
|
||||||
|
|
||||||
public class AddWaveformHandler {
|
public class AddWaveformHandler {
|
||||||
|
|
||||||
public final static String PARAM_WHERE_ID="com.minres.scviewer.e4.application.command.addwaveform.where"; //$NON-NLS-1$
|
public static final String PARAM_WHERE_ID="com.minres.scviewer.e4.application.command.addwaveform.where"; //$NON-NLS-1$
|
||||||
public final static String PARAM_ALL_ID="com.minres.scviewer.e4.application.command.addwaveform.all"; //$NON-NLS-1$
|
public static final String PARAM_ALL_ID="com.minres.scviewer.e4.application.command.addwaveform.all"; //$NON-NLS-1$
|
||||||
|
|
||||||
@Inject @Optional DesignBrowser designBrowser;
|
@Inject @Optional DesignBrowser designBrowser;
|
||||||
|
|
||||||
|
@ -42,8 +42,11 @@ public class AddWaveformHandler {
|
||||||
if(designBrowser==null || designBrowser.getActiveWaveformViewerPart()==null) return false;
|
if(designBrowser==null || designBrowser.getActiveWaveformViewerPart()==null) return false;
|
||||||
boolean before = "before".equalsIgnoreCase(where); //$NON-NLS-1$
|
boolean before = "before".equalsIgnoreCase(where); //$NON-NLS-1$
|
||||||
IStructuredSelection waveformSelection = null;
|
IStructuredSelection waveformSelection = null;
|
||||||
if(designBrowser.getActiveWaveformViewerPart()!=null)
|
if(designBrowser.getActiveWaveformViewerPart()!=null) {
|
||||||
|
if(!designBrowser.getActiveWaveformViewerPart().getDatabase().isLoaded())
|
||||||
|
return false;
|
||||||
waveformSelection = (IStructuredSelection)designBrowser.getActiveWaveformViewerPart().getSelection();
|
waveformSelection = (IStructuredSelection)designBrowser.getActiveWaveformViewerPart().getSelection();
|
||||||
|
}
|
||||||
if("true".equalsIgnoreCase(all)) //$NON-NLS-1$
|
if("true".equalsIgnoreCase(all)) //$NON-NLS-1$
|
||||||
return designBrowser.getFilteredChildren().length>0 &&
|
return designBrowser.getFilteredChildren().length>0 &&
|
||||||
(!before || (waveformSelection!=null && waveformSelection.size()>0));
|
(!before || (waveformSelection!=null && waveformSelection.size()>0));
|
||||||
|
|
|
@ -9,14 +9,14 @@
|
||||||
* MINRES Technologies GmbH - initial API and implementation
|
* MINRES Technologies GmbH - initial API and implementation
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package com.minres.scviewer.e4.application.internal.status;
|
package com.minres.scviewer.e4.application.internal.status;
|
||||||
|
|
||||||
|
import java.lang.ref.WeakReference;
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
|
|
||||||
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
|
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
|
||||||
import org.eclipse.core.runtime.preferences.IEclipsePreferences.IPreferenceChangeListener;
|
import org.eclipse.core.runtime.preferences.IEclipsePreferences.IPreferenceChangeListener;
|
||||||
import org.eclipse.core.runtime.preferences.IEclipsePreferences.PreferenceChangeEvent;
|
|
||||||
import org.eclipse.jface.action.Action;
|
import org.eclipse.jface.action.Action;
|
||||||
import org.eclipse.jface.action.IAction;
|
import org.eclipse.jface.action.IAction;
|
||||||
import org.eclipse.jface.action.IMenuListener;
|
|
||||||
import org.eclipse.jface.action.IMenuManager;
|
import org.eclipse.jface.action.IMenuManager;
|
||||||
import org.eclipse.jface.action.MenuManager;
|
import org.eclipse.jface.action.MenuManager;
|
||||||
import org.eclipse.jface.resource.ImageDescriptor;
|
import org.eclipse.jface.resource.ImageDescriptor;
|
||||||
|
@ -29,16 +29,17 @@ import org.eclipse.swt.graphics.Rectangle;
|
||||||
import org.eclipse.swt.widgets.Canvas;
|
import org.eclipse.swt.widgets.Canvas;
|
||||||
import org.eclipse.swt.widgets.Composite;
|
import org.eclipse.swt.widgets.Composite;
|
||||||
import org.eclipse.swt.widgets.Display;
|
import org.eclipse.swt.widgets.Display;
|
||||||
import org.eclipse.swt.widgets.Event;
|
|
||||||
import org.eclipse.swt.widgets.Listener;
|
import org.eclipse.swt.widgets.Listener;
|
||||||
import org.eclipse.swt.widgets.Menu;
|
import org.eclipse.swt.widgets.Menu;
|
||||||
import org.eclipse.wb.swt.ResourceManager;
|
import org.eclipse.wb.swt.ResourceManager;
|
||||||
import org.eclipse.wb.swt.SWTResourceManager;
|
import org.eclipse.wb.swt.SWTResourceManager;
|
||||||
import org.osgi.service.prefs.Preferences;
|
import org.osgi.service.prefs.Preferences;
|
||||||
|
|
||||||
|
import com.minres.scviewer.e4.application.Constants;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Heap Status control, which shows the heap usage statistics in the window trim.
|
* The Heap Status control, which shows the heap usage statistics in the window
|
||||||
* Part of the code is taken from the eclipse internal implementation
|
* trim. Part of the code is taken from the eclipse internal implementation
|
||||||
*/
|
*/
|
||||||
public class HeapStatus extends Composite {
|
public class HeapStatus extends Composite {
|
||||||
|
|
||||||
|
@ -52,7 +53,8 @@ public class HeapStatus extends Composite {
|
||||||
private Image disabledGcImage;
|
private Image disabledGcImage;
|
||||||
|
|
||||||
/** The arm col. */
|
/** The arm col. */
|
||||||
private Color bgCol, usedMemCol, lowMemCol, freeMemCol, topLeftCol, bottomRightCol, sepCol, textCol, markCol, armCol;
|
private Color bgCol, usedMemCol, lowMemCol, freeMemCol, topLeftCol, bottomRightCol, sepCol, textCol, markCol,
|
||||||
|
armCol;
|
||||||
|
|
||||||
/** The button. */
|
/** The button. */
|
||||||
private Canvas button;
|
private Canvas button;
|
||||||
|
@ -125,23 +127,17 @@ public class HeapStatus extends Composite {
|
||||||
};
|
};
|
||||||
|
|
||||||
/** The pref listener. */
|
/** The pref listener. */
|
||||||
private final IPreferenceChangeListener prefListener = new IPreferenceChangeListener() {
|
private final IPreferenceChangeListener prefListener = event -> {
|
||||||
@Override
|
|
||||||
public void preferenceChange(PreferenceChangeEvent event) {
|
|
||||||
if (IHeapStatusConstants.PREF_UPDATE_INTERVAL.equals(event.getKey())) {
|
if (IHeapStatusConstants.PREF_UPDATE_INTERVAL.equals(event.getKey())) {
|
||||||
setUpdateIntervalInMS(preferences.getInt(IHeapStatusConstants.PREF_UPDATE_INTERVAL, 100));
|
setUpdateIntervalInMS(preferences.getInt(IHeapStatusConstants.PREF_UPDATE_INTERVAL, 100));
|
||||||
}
|
} else if (IHeapStatusConstants.PREF_SHOW_MAX.equals(event.getKey())) {
|
||||||
else if (IHeapStatusConstants.PREF_SHOW_MAX.equals(event.getKey())) {
|
|
||||||
showMax = preferences.getBoolean(IHeapStatusConstants.PREF_SHOW_MAX, true);
|
showMax = preferences.getBoolean(IHeapStatusConstants.PREF_SHOW_MAX, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new heap status control with the given parent, and using
|
* Creates a new heap status control with the given parent, and using the given
|
||||||
* the given preference store to obtain settings such as the refresh
|
* preference store to obtain settings such as the refresh interval.
|
||||||
* interval.
|
|
||||||
*
|
*
|
||||||
* @param parent the parent composite
|
* @param parent the parent composite
|
||||||
* @param preferences the preference store
|
* @param preferences the preference store
|
||||||
|
@ -162,7 +158,7 @@ public class HeapStatus extends Composite {
|
||||||
button = new Canvas(this, SWT.NONE);
|
button = new Canvas(this, SWT.NONE);
|
||||||
button.setToolTipText("Run Garbage Collection");
|
button.setToolTipText("Run Garbage Collection");
|
||||||
|
|
||||||
ImageDescriptor imageDesc = ResourceManager.getPluginImageDescriptor("com.minres.scviewer.e4.application", "icons/trash.png"); //$NON-NLS-1$
|
ImageDescriptor imageDesc = ResourceManager.getPluginImageDescriptor(Constants.PLUGIN_ID, "icons/trash.png"); //$NON-NLS-1$
|
||||||
Display display = getDisplay();
|
Display display = getDisplay();
|
||||||
gcImage = imageDesc.createImage();
|
gcImage = imageDesc.createImage();
|
||||||
if (gcImage != null) {
|
if (gcImage != null) {
|
||||||
|
@ -179,10 +175,7 @@ public class HeapStatus extends Composite {
|
||||||
|
|
||||||
createContextMenu();
|
createContextMenu();
|
||||||
|
|
||||||
Listener listener = new Listener() {
|
Listener listener = event -> {
|
||||||
|
|
||||||
@Override
|
|
||||||
public void handleEvent(Event event) {
|
|
||||||
switch (event.type) {
|
switch (event.type) {
|
||||||
case SWT.Dispose:
|
case SWT.Dispose:
|
||||||
doDispose();
|
doDispose();
|
||||||
|
@ -194,28 +187,23 @@ public class HeapStatus extends Composite {
|
||||||
case SWT.Paint:
|
case SWT.Paint:
|
||||||
if (event.widget == HeapStatus.this) {
|
if (event.widget == HeapStatus.this) {
|
||||||
paintComposite(event.gc);
|
paintComposite(event.gc);
|
||||||
}
|
} else if (event.widget == button) {
|
||||||
else if (event.widget == button) {
|
|
||||||
paintButton(event.gc);
|
paintButton(event.gc);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case SWT.MouseUp:
|
case SWT.MouseUp:
|
||||||
if (event.button == 1) {
|
if (event.button == 1 && !isInGC) {
|
||||||
if (!isInGC) {
|
|
||||||
arm(false);
|
arm(false);
|
||||||
gc();
|
gc();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case SWT.MouseDown:
|
case SWT.MouseDown:
|
||||||
if (event.button == 1) {
|
if (event.button == 1) {
|
||||||
if (event.widget == HeapStatus.this) {
|
if (event.widget == HeapStatus.this) {
|
||||||
setMark();
|
setMark();
|
||||||
} else if (event.widget == button) {
|
} else if (event.widget == button && !isInGC)
|
||||||
if (!isInGC)
|
|
||||||
arm(true);
|
arm(true);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case SWT.MouseEnter:
|
case SWT.MouseEnter:
|
||||||
HeapStatus.this.updateTooltip = true;
|
HeapStatus.this.updateTooltip = true;
|
||||||
|
@ -228,9 +216,9 @@ public class HeapStatus extends Composite {
|
||||||
arm(false);
|
arm(false);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
};
|
};
|
||||||
addListener(SWT.Dispose, listener);
|
addListener(SWT.Dispose, listener);
|
||||||
addListener(SWT.MouseDown, listener);
|
addListener(SWT.MouseDown, listener);
|
||||||
|
@ -246,18 +234,18 @@ public class HeapStatus extends Composite {
|
||||||
// make sure stats are updated before first paint
|
// make sure stats are updated before first paint
|
||||||
updateStats();
|
updateStats();
|
||||||
|
|
||||||
getDisplay().asyncExec(new Runnable() {
|
getDisplay().asyncExec(() -> {
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
if (!isDisposed()) {
|
if (!isDisposed()) {
|
||||||
getDisplay().timerExec(updateInterval, timer);
|
getDisplay().timerExec(updateInterval, timer);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/*
|
||||||
* @see org.eclipse.swt.widgets.Control#setBackground(org.eclipse.swt.graphics.Color)
|
* (non-Javadoc)
|
||||||
|
*
|
||||||
|
* @see
|
||||||
|
* org.eclipse.swt.widgets.Control#setBackground(org.eclipse.swt.graphics.Color)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void setBackground(Color color) {
|
public void setBackground(Color color) {
|
||||||
|
@ -266,8 +254,11 @@ public class HeapStatus extends Composite {
|
||||||
button.update();
|
button.update();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/*
|
||||||
* @see org.eclipse.swt.widgets.Control#setForeground(org.eclipse.swt.graphics.Color)
|
* (non-Javadoc)
|
||||||
|
*
|
||||||
|
* @see
|
||||||
|
* org.eclipse.swt.widgets.Control#setForeground(org.eclipse.swt.graphics.Color)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void setForeground(Color color) {
|
public void setForeground(Color color) {
|
||||||
|
@ -281,7 +272,9 @@ public class HeapStatus extends Composite {
|
||||||
button.update();
|
button.update();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
*
|
||||||
* @see org.eclipse.swt.widgets.Control#getForeground()
|
* @see org.eclipse.swt.widgets.Control#getForeground()
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
@ -301,14 +294,14 @@ public class HeapStatus extends Composite {
|
||||||
long max = Long.MAX_VALUE;
|
long max = Long.MAX_VALUE;
|
||||||
try {
|
try {
|
||||||
// Must use reflect to allow compilation against JCL/Foundation
|
// Must use reflect to allow compilation against JCL/Foundation
|
||||||
Method maxMemMethod = Runtime.class.getMethod("maxMemory", new Class[0]); //$NON-NLS-1$
|
Method maxMemMethod = Runtime.class.getMethod("maxMemory"); //$NON-NLS-1$
|
||||||
Object o = maxMemMethod.invoke(Runtime.getRuntime(), new Object[0]);
|
Object o = maxMemMethod.invoke(Runtime.getRuntime());
|
||||||
if (o instanceof Long) {
|
if (o instanceof Long) {
|
||||||
max = ((Long) o).longValue();
|
max = ((Long) o).longValue();
|
||||||
}
|
}
|
||||||
}
|
} catch (Exception e) {
|
||||||
catch (Exception e) {
|
// ignore if method missing or if there are other failures trying to determine
|
||||||
// ignore if method missing or if there are other failures trying to determine the max
|
// the max
|
||||||
}
|
}
|
||||||
return max;
|
return max;
|
||||||
}
|
}
|
||||||
|
@ -336,7 +329,9 @@ public class HeapStatus extends Composite {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
*
|
||||||
* @see org.eclipse.swt.widgets.Composite#computeSize(int, int, boolean)
|
* @see org.eclipse.swt.widgets.Composite#computeSize(int, int, boolean)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
@ -388,12 +383,7 @@ public class HeapStatus extends Composite {
|
||||||
private void createContextMenu() {
|
private void createContextMenu() {
|
||||||
MenuManager menuMgr = new MenuManager();
|
MenuManager menuMgr = new MenuManager();
|
||||||
menuMgr.setRemoveAllWhenShown(true);
|
menuMgr.setRemoveAllWhenShown(true);
|
||||||
menuMgr.addMenuListener(new IMenuListener() {
|
menuMgr.addMenuListener(mgr -> fillMenu(mgr));
|
||||||
@Override
|
|
||||||
public void menuAboutToShow(IMenuManager menuMgr) {
|
|
||||||
fillMenu(menuMgr);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
Menu menu = menuMgr.createContextMenu(this);
|
Menu menu = menuMgr.createContextMenu(this);
|
||||||
setMenu(menu);
|
setMenu(menu);
|
||||||
}
|
}
|
||||||
|
@ -407,10 +397,6 @@ public class HeapStatus extends Composite {
|
||||||
menuMgr.add(new SetMarkAction());
|
menuMgr.add(new SetMarkAction());
|
||||||
menuMgr.add(new ClearMarkAction());
|
menuMgr.add(new ClearMarkAction());
|
||||||
menuMgr.add(new ShowMaxAction());
|
menuMgr.add(new ShowMaxAction());
|
||||||
menuMgr.add(new CloseHeapStatusAction());
|
|
||||||
// if (isKyrsoftViewAvailable()) {
|
|
||||||
// menuMgr.add(new ShowKyrsoftViewAction());
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -441,13 +427,9 @@ public class HeapStatus extends Composite {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
busyGC();
|
busyGC();
|
||||||
getDisplay().asyncExec(new Runnable() {
|
getDisplay().asyncExec(() -> {
|
||||||
@Override
|
if (!isDisposed())
|
||||||
public void run() {
|
|
||||||
if (!isDisposed()) {
|
|
||||||
gcRunning(false);
|
gcRunning(false);
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -458,10 +440,13 @@ public class HeapStatus extends Composite {
|
||||||
* Busy gc.
|
* Busy gc.
|
||||||
*/
|
*/
|
||||||
private void busyGC() {
|
private void busyGC() {
|
||||||
for (int i = 0; i < 2; ++i) {
|
Object obj = new Object();
|
||||||
|
WeakReference<Object> ref = new WeakReference<>(obj);
|
||||||
|
obj = null;
|
||||||
|
do {
|
||||||
System.gc();
|
System.gc();
|
||||||
System.runFinalization();
|
System.runFinalization();
|
||||||
}
|
} while (ref.get() != null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -663,17 +648,19 @@ public class HeapStatus extends Composite {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Converts the given number of bytes to a printable number of megabytes (rounded up).
|
* Converts the given number of bytes to a printable number of megabytes
|
||||||
|
* (rounded up).
|
||||||
*
|
*
|
||||||
* @param numBytes the num bytes
|
* @param numBytes the num bytes
|
||||||
* @return the string
|
* @return the string
|
||||||
*/
|
*/
|
||||||
private String convertToMegString(long numBytes) {
|
private String convertToMegString(long numBytes) {
|
||||||
return new Long(convertToMeg(numBytes)).toString()+"M";
|
return Long.toString(convertToMeg(numBytes)) + "M";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Converts the given number of bytes to the corresponding number of megabytes (rounded up).
|
* Converts the given number of bytes to the corresponding number of megabytes
|
||||||
|
* (rounded up).
|
||||||
*
|
*
|
||||||
* @param numBytes the num bytes
|
* @param numBytes the num bytes
|
||||||
* @return the long
|
* @return the long
|
||||||
|
@ -682,7 +669,6 @@ public class HeapStatus extends Composite {
|
||||||
return (numBytes + (512 * 1024)) / (1024 * 1024);
|
return (numBytes + (512 * 1024)) / (1024 * 1024);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Class SetMarkAction.
|
* The Class SetMarkAction.
|
||||||
*/
|
*/
|
||||||
|
@ -695,7 +681,9 @@ public class HeapStatus extends Composite {
|
||||||
super("&Set Mark");
|
super("&Set Mark");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
*
|
||||||
* @see org.eclipse.jface.action.Action#run()
|
* @see org.eclipse.jface.action.Action#run()
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
@ -716,7 +704,9 @@ public class HeapStatus extends Composite {
|
||||||
super("&Clear Mark");
|
super("&Clear Mark");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
*
|
||||||
* @see org.eclipse.jface.action.Action#run()
|
* @see org.eclipse.jface.action.Action#run()
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
@ -739,7 +729,9 @@ public class HeapStatus extends Composite {
|
||||||
setChecked(showMax);
|
setChecked(showMax);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
*
|
||||||
* @see org.eclipse.jface.action.Action#run()
|
* @see org.eclipse.jface.action.Action#run()
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
@ -748,32 +740,4 @@ public class HeapStatus extends Composite {
|
||||||
redraw();
|
redraw();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* The Class CloseHeapStatusAction.
|
|
||||||
*/
|
|
||||||
class CloseHeapStatusAction extends Action{
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Instantiates a new close heap status action.
|
|
||||||
*/
|
|
||||||
CloseHeapStatusAction(){
|
|
||||||
super("&Close");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.jface.action.Action#run()
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public void run(){
|
|
||||||
// WorkbenchWindow wbw = (WorkbenchWindow) PlatformUI.getWorkbench()
|
|
||||||
// .getActiveWorkbenchWindow();
|
|
||||||
// if (wbw != null) {
|
|
||||||
// wbw.showHeapStatus(false);
|
|
||||||
// }
|
|
||||||
System.out.println("NYI");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
AboutDialog_0=\nSCViewer - a SystemC waveform viewer\n\nVersion: {0}\n
|
AboutDialog_0=\nSCViewer - a SystemC waveform viewer\n\nVersion: {0}\n
|
||||||
AboutDialog_1=\nCopyright (c) 2015, 2019, 2020 MINRES Technologies GmbH and others.\n\nAll rights reserved. MINRES and the MINRES logo are trademarks of MINRES Technologies GmbH, http://www.minres.com/. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at http://www.eclipse.org/legal/epl-v10.html\n\nParts of the software are governed by the Apache License Version 2.0 available at http://www.apache.org/licenses/. These are namely org.mapdb and org.sqlite JDBC driver\n\nSource code is hosted at https://git.minres.com/VP-Tools/SCViewer and the master branch is mirrored to GitHub: https://github.com/minres/SCViewer\n
|
AboutDialog_1=\nCopyright (c) 2015, 2019, 2020, 2021 MINRES Technologies GmbH and others.\n\nAll rights reserved. MINRES and the MINRES logo are trademarks of MINRES Technologies GmbH, http://www.minres.com/. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at http://www.eclipse.org/legal/epl-v10.html\n\nParts of the software are governed by the Apache License Version 2.0 available at http://www.apache.org/licenses/. These are namely org.mapdb and org.sqlite JDBC driver\n\nSource code is hosted at https://git.minres.com/VP-Tools/SCViewer and the master branch is mirrored to GitHub: https://github.com/minres/SCViewer\n
|
||||||
DesignBrowser_12=Append all after
|
DesignBrowser_12=Append all after
|
||||||
DesignBrowser_16=Insert all before
|
DesignBrowser_16=Insert all before
|
||||||
DesignBrowser_2=Enter text to filter waveforms
|
DesignBrowser_2=Enter text to filter waveforms
|
||||||
|
|
|
@ -26,8 +26,6 @@ import org.eclipse.osgi.util.NLS;
|
||||||
import org.eclipse.swt.SWT;
|
import org.eclipse.swt.SWT;
|
||||||
import org.eclipse.swt.custom.StyleRange;
|
import org.eclipse.swt.custom.StyleRange;
|
||||||
import org.eclipse.swt.custom.StyledText;
|
import org.eclipse.swt.custom.StyledText;
|
||||||
import org.eclipse.swt.events.PaintEvent;
|
|
||||||
import org.eclipse.swt.events.PaintListener;
|
|
||||||
import org.eclipse.swt.graphics.Color;
|
import org.eclipse.swt.graphics.Color;
|
||||||
import org.eclipse.swt.graphics.Image;
|
import org.eclipse.swt.graphics.Image;
|
||||||
import org.eclipse.swt.graphics.Point;
|
import org.eclipse.swt.graphics.Point;
|
||||||
|
@ -36,13 +34,12 @@ import org.eclipse.swt.layout.GridLayout;
|
||||||
import org.eclipse.swt.widgets.Canvas;
|
import org.eclipse.swt.widgets.Canvas;
|
||||||
import org.eclipse.swt.widgets.Composite;
|
import org.eclipse.swt.widgets.Composite;
|
||||||
import org.eclipse.swt.widgets.Control;
|
import org.eclipse.swt.widgets.Control;
|
||||||
import org.eclipse.swt.widgets.Event;
|
|
||||||
import org.eclipse.swt.widgets.Listener;
|
|
||||||
import org.eclipse.swt.widgets.Shell;
|
import org.eclipse.swt.widgets.Shell;
|
||||||
import org.eclipse.wb.swt.ResourceManager;
|
import org.eclipse.wb.swt.ResourceManager;
|
||||||
import org.eclipse.wb.swt.SWTResourceManager;
|
import org.eclipse.wb.swt.SWTResourceManager;
|
||||||
import org.osgi.framework.Version;
|
import org.osgi.framework.Version;
|
||||||
|
|
||||||
|
import com.minres.scviewer.e4.application.Constants;
|
||||||
import com.minres.scviewer.e4.application.Messages;
|
import com.minres.scviewer.e4.application.Messages;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -73,34 +70,32 @@ public class AboutDialog extends Dialog {
|
||||||
@Override
|
@Override
|
||||||
protected Control createDialogArea(Composite parent) {
|
protected Control createDialogArea(Composite parent) {
|
||||||
Composite composite = new Composite(parent, SWT.NONE);
|
Composite composite = new Composite(parent, SWT.NONE);
|
||||||
GridData gd_composite = new GridData(SWT.LEFT, SWT.FILL, true, true);
|
GridData gdComposite = new GridData(SWT.LEFT, SWT.FILL, true, true);
|
||||||
gd_composite.widthHint = 600;
|
gdComposite.widthHint = 600;
|
||||||
gd_composite.heightHint =300;
|
gdComposite.heightHint =300;
|
||||||
composite.setLayoutData(gd_composite);
|
composite.setLayoutData(gdComposite);
|
||||||
composite.setLayout(new GridLayout(2, false));
|
composite.setLayout(new GridLayout(2, false));
|
||||||
|
|
||||||
final Color white=SWTResourceManager.getColor(SWT.COLOR_WHITE);
|
final Color white=SWTResourceManager.getColor(SWT.COLOR_WHITE);
|
||||||
final Image scviewerLogo=ResourceManager.getPluginImage("com.minres.scviewer.e4.application", "icons/SCViewer_logo.png"); //$NON-NLS-1$ //$NON-NLS-2$
|
final Image scviewerLogo=ResourceManager.getPluginImage(Constants.PLUGIN_ID, "icons/SCViewer_logo.png"); //$NON-NLS-1$
|
||||||
final Image minresLogo=ResourceManager.getPluginImage("com.minres.scviewer.e4.application", "icons/Minres_logo.png"); //$NON-NLS-1$ //$NON-NLS-2$
|
final Image minresLogo=ResourceManager.getPluginImage(Constants.PLUGIN_ID, "icons/Minres_logo.png"); //$NON-NLS-1$
|
||||||
|
|
||||||
Canvas canvas = new Canvas(composite,SWT.NO_REDRAW_RESIZE);
|
Canvas canvas = new Canvas(composite,SWT.NO_REDRAW_RESIZE);
|
||||||
GridData gd_canvas = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
|
GridData gdCanvas = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
|
||||||
gd_canvas.widthHint = 200;
|
gdCanvas.widthHint = 200;
|
||||||
gd_canvas.heightHint =300;
|
gdCanvas.heightHint =300;
|
||||||
canvas.setLayoutData(gd_canvas);
|
canvas.setLayoutData(gdCanvas);
|
||||||
canvas.addPaintListener(new PaintListener() {
|
canvas.addPaintListener(e -> {
|
||||||
public void paintControl(PaintEvent e) {
|
|
||||||
e.gc.setBackground(white);
|
e.gc.setBackground(white);
|
||||||
e.gc.fillRectangle(e.x, e.y, e.width, e.height);
|
e.gc.fillRectangle(e.x, e.y, e.width, e.height);
|
||||||
e.gc.drawImage(scviewerLogo,4,0);
|
e.gc.drawImage(scviewerLogo,4,0);
|
||||||
e.gc.drawImage(minresLogo,0,200);
|
e.gc.drawImage(minresLogo,0,200);
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
StyledText styledText = new StyledText(composite, SWT.V_SCROLL | SWT.BORDER);
|
StyledText styledText = new StyledText(composite, SWT.V_SCROLL | SWT.BORDER);
|
||||||
styledText.setEditable(false);
|
styledText.setEditable(false);
|
||||||
GridData gd_styledText = new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1);
|
GridData gdStyledText = new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1);
|
||||||
styledText.setLayoutData(gd_styledText);
|
styledText.setLayoutData(gdStyledText);
|
||||||
Version version = Platform.getProduct().getDefiningBundle().getVersion();
|
Version version = Platform.getProduct().getDefiningBundle().getVersion();
|
||||||
String versionString = String.format("%d.%d.%d", version.getMajor(), version.getMinor(), version.getMicro());
|
String versionString = String.format("%d.%d.%d", version.getMajor(), version.getMinor(), version.getMicro());
|
||||||
String productTitle = NLS.bind(Messages.AboutDialog_0, versionString);
|
String productTitle = NLS.bind(Messages.AboutDialog_0, versionString);
|
||||||
|
@ -129,12 +124,9 @@ public class AboutDialog extends Dialog {
|
||||||
styleRange.length = matcher.end()-matcher.start();
|
styleRange.length = matcher.end()-matcher.start();
|
||||||
styledText.setStyleRange(styleRange);
|
styledText.setStyleRange(styleRange);
|
||||||
}
|
}
|
||||||
styledText.addListener(SWT.MouseDown, new Listener() {
|
styledText.addListener(SWT.MouseDown, event -> {
|
||||||
@Override
|
|
||||||
public void handleEvent(Event event) {
|
|
||||||
// It is up to the application to determine when and how a link should be activated.
|
// It is up to the application to determine when and how a link should be activated.
|
||||||
// links are activated on mouse down when the control key is held down
|
// links are activated on mouse down when the control key is held down
|
||||||
// if ((event.stateMask & SWT.MOD1) != 0) {
|
|
||||||
try {
|
try {
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
int offset = ((StyledText)event.widget).getOffsetAtLocation(new Point (event.x, event.y));
|
int offset = ((StyledText)event.widget).getOffsetAtLocation(new Point (event.x, event.y));
|
||||||
|
@ -143,8 +135,6 @@ public class AboutDialog extends Dialog {
|
||||||
Desktop.getDesktop().browse(new java.net.URI(style.data.toString()));
|
Desktop.getDesktop().browse(new java.net.URI(style.data.toString()));
|
||||||
}
|
}
|
||||||
} catch (IOException | URISyntaxException | IllegalArgumentException e) {}
|
} catch (IOException | URISyntaxException | IllegalArgumentException e) {}
|
||||||
// }
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
styleRange.start = 0;
|
styleRange.start = 0;
|
||||||
|
@ -154,6 +144,7 @@ public class AboutDialog extends Dialog {
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.jface.dialogs.Dialog#createButtonsForButtonBar(org.eclipse.swt.widgets.Composite)
|
* @see org.eclipse.jface.dialogs.Dialog#createButtonsForButtonBar(org.eclipse.swt.widgets.Composite)
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
protected void createButtonsForButtonBar(Composite parent) {
|
protected void createButtonsForButtonBar(Composite parent) {
|
||||||
// create OK button
|
// create OK button
|
||||||
createButton(parent, IDialogConstants.OK_ID, IDialogConstants.CLOSE_LABEL, true);
|
createButton(parent, IDialogConstants.OK_ID, IDialogConstants.CLOSE_LABEL, true);
|
||||||
|
|
|
@ -13,7 +13,6 @@ package com.minres.scviewer.e4.application.parts;
|
||||||
import java.beans.PropertyChangeListener;
|
import java.beans.PropertyChangeListener;
|
||||||
import java.lang.annotation.Annotation;
|
import java.lang.annotation.Annotation;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
import java.util.regex.PatternSyntaxException;
|
import java.util.regex.PatternSyntaxException;
|
||||||
|
@ -65,6 +64,7 @@ import com.minres.scviewer.database.HierNode;
|
||||||
import com.minres.scviewer.database.IHierNode;
|
import com.minres.scviewer.database.IHierNode;
|
||||||
import com.minres.scviewer.database.IWaveform;
|
import com.minres.scviewer.database.IWaveform;
|
||||||
import com.minres.scviewer.database.IWaveformDb;
|
import com.minres.scviewer.database.IWaveformDb;
|
||||||
|
import com.minres.scviewer.e4.application.Constants;
|
||||||
import com.minres.scviewer.e4.application.Messages;
|
import com.minres.scviewer.e4.application.Messages;
|
||||||
import com.minres.scviewer.e4.application.handlers.AddWaveformHandler;
|
import com.minres.scviewer.e4.application.handlers.AddWaveformHandler;
|
||||||
import com.minres.scviewer.e4.application.provider.TxDbContentProvider;
|
import com.minres.scviewer.e4.application.provider.TxDbContentProvider;
|
||||||
|
@ -125,12 +125,17 @@ public class DesignBrowser {
|
||||||
|
|
||||||
/** The tree viewer pcl. */
|
/** The tree viewer pcl. */
|
||||||
private PropertyChangeListener treeViewerPCL = evt -> {
|
private PropertyChangeListener treeViewerPCL = evt -> {
|
||||||
if("CHILDS".equals(evt.getPropertyName())){ //$NON-NLS-1$
|
if(IHierNode.CHILDS.equals(evt.getPropertyName())){ //$NON-NLS-1$
|
||||||
treeViewer.getTree().getDisplay().asyncExec(() -> treeViewer.refresh());
|
treeViewer.getTree().getDisplay().asyncExec(() -> treeViewer.refresh());
|
||||||
} else if("WAVEFORMS".equals(evt.getPropertyName())) {
|
} else if(IHierNode.WAVEFORMS.equals(evt.getPropertyName())) {
|
||||||
treeViewer.getTree().getDisplay().asyncExec(() -> {
|
treeViewer.getTree().getDisplay().asyncExec(() -> {
|
||||||
IWaveformDb database = waveformViewerPart.getDatabase();
|
treeViewer.setInput(new IWaveformDb[]{waveformViewerPart.getDatabase()});
|
||||||
treeViewer.setInput(Arrays.asList(database.isLoaded()?new IWaveformDb[]{database}:new IWaveformDb[]{new LoadingWaveformDb()}));
|
treeViewer.refresh();
|
||||||
|
});
|
||||||
|
} else if(IHierNode.LOADING_FINISHED.equals(evt.getPropertyName())) {
|
||||||
|
treeViewer.getTree().getDisplay().asyncExec(() -> {
|
||||||
|
treeViewer.update(waveformViewerPart.getDatabase(), null);
|
||||||
|
DesignBrowser.this.updateButtons();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -195,7 +200,12 @@ public class DesignBrowser {
|
||||||
|
|
||||||
treeViewer = new TreeViewer(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
|
treeViewer = new TreeViewer(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
|
||||||
treeViewer.getTree().setLayoutData(new GridData(GridData.FILL_BOTH));
|
treeViewer.getTree().setLayoutData(new GridData(GridData.FILL_BOTH));
|
||||||
treeViewer.setContentProvider(new TxDbContentProvider());
|
treeViewer.setContentProvider(new TxDbContentProvider() {
|
||||||
|
@Override
|
||||||
|
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
|
||||||
|
updateButtons();
|
||||||
|
}
|
||||||
|
});
|
||||||
treeViewer.setLabelProvider(new TxDbLabelProvider());
|
treeViewer.setLabelProvider(new TxDbLabelProvider());
|
||||||
treeViewer.addFilter(treeAttributeFilter);
|
treeViewer.addFilter(treeAttributeFilter);
|
||||||
treeViewer.setUseHashlookup(true);
|
treeViewer.setUseHashlookup(true);
|
||||||
|
@ -236,7 +246,12 @@ public class DesignBrowser {
|
||||||
tableAttributeFilter = new StreamTableFilter();
|
tableAttributeFilter = new StreamTableFilter();
|
||||||
|
|
||||||
txTableViewer = new TableViewer(parent);
|
txTableViewer = new TableViewer(parent);
|
||||||
txTableViewer.setContentProvider(new TxDbContentProvider(true));
|
txTableViewer.setContentProvider(new TxDbContentProvider(true) {
|
||||||
|
@Override
|
||||||
|
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
|
||||||
|
updateButtons();
|
||||||
|
}
|
||||||
|
});
|
||||||
txTableViewer.setLabelProvider(new TxDbLabelProvider());
|
txTableViewer.setLabelProvider(new TxDbLabelProvider());
|
||||||
txTableViewer.getTable().setLayoutData(new GridData(GridData.FILL_BOTH));
|
txTableViewer.getTable().setLayoutData(new GridData(GridData.FILL_BOTH));
|
||||||
txTableViewer.addFilter(tableAttributeFilter);
|
txTableViewer.addFilter(tableAttributeFilter);
|
||||||
|
@ -258,7 +273,7 @@ public class DesignBrowser {
|
||||||
|
|
||||||
appendItem = new ToolItem(toolBar, SWT.NONE);
|
appendItem = new ToolItem(toolBar, SWT.NONE);
|
||||||
appendItem.setToolTipText(Messages.DesignBrowser_4);
|
appendItem.setToolTipText(Messages.DesignBrowser_4);
|
||||||
appendItem.setImage(ResourceManager.getPluginImage("com.minres.scviewer.e4.application", "icons/append_wave.png")); //$NON-NLS-1$ //$NON-NLS-2$
|
appendItem.setImage(ResourceManager.getPluginImage(Constants.PLUGIN_ID, "icons/append_wave.png")); //$NON-NLS-1$
|
||||||
appendItem.setEnabled(false);
|
appendItem.setEnabled(false);
|
||||||
appendItem.addSelectionListener(new SelectionAdapter() {
|
appendItem.addSelectionListener(new SelectionAdapter() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -273,7 +288,7 @@ public class DesignBrowser {
|
||||||
|
|
||||||
insertItem = new ToolItem(toolBar, SWT.NONE);
|
insertItem = new ToolItem(toolBar, SWT.NONE);
|
||||||
insertItem.setToolTipText(Messages.DesignBrowser_8);
|
insertItem.setToolTipText(Messages.DesignBrowser_8);
|
||||||
insertItem.setImage(ResourceManager.getPluginImage("com.minres.scviewer.e4.application", "icons/insert_wave.png")); //$NON-NLS-1$ //$NON-NLS-2$
|
insertItem.setImage(ResourceManager.getPluginImage(Constants.PLUGIN_ID, "icons/insert_wave.png")); //$NON-NLS-1$
|
||||||
insertItem.setEnabled(false);
|
insertItem.setEnabled(false);
|
||||||
insertItem.addSelectionListener(new SelectionAdapter() {
|
insertItem.addSelectionListener(new SelectionAdapter() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -356,7 +371,7 @@ public class DesignBrowser {
|
||||||
if(db==database) return; // do nothing if old and new database is the same
|
if(db==database) return; // do nothing if old and new database is the same
|
||||||
((List<IWaveformDb>)input).get(0).removePropertyChangeListener(treeViewerPCL);
|
((List<IWaveformDb>)input).get(0).removePropertyChangeListener(treeViewerPCL);
|
||||||
}
|
}
|
||||||
treeViewer.setInput(Arrays.asList(database.isLoaded()?new IWaveformDb[]{database}:new IWaveformDb[]{new LoadingWaveformDb()}));
|
treeViewer.setInput(new IWaveformDb[]{database});
|
||||||
Object state=this.waveformViewerPart.retrieveDesignBrowerState();
|
Object state=this.waveformViewerPart.retrieveDesignBrowerState();
|
||||||
if(state instanceof DBState)
|
if(state instanceof DBState)
|
||||||
((DBState)state).apply();
|
((DBState)state).apply();
|
||||||
|
|
|
@ -5,7 +5,6 @@ import java.nio.file.FileSystems;
|
||||||
import java.nio.file.PathMatcher;
|
import java.nio.file.PathMatcher;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Comparator;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
@ -48,6 +47,8 @@ import org.eclipse.swt.widgets.ToolBar;
|
||||||
import org.eclipse.swt.widgets.ToolItem;
|
import org.eclipse.swt.widgets.ToolItem;
|
||||||
import org.eclipse.wb.swt.ResourceManager;
|
import org.eclipse.wb.swt.ResourceManager;
|
||||||
|
|
||||||
|
import com.minres.scviewer.e4.application.Constants;
|
||||||
|
|
||||||
public class FileBrowserDialog extends TrayDialog {
|
public class FileBrowserDialog extends TrayDialog {
|
||||||
|
|
||||||
private Image folderImage;
|
private Image folderImage;
|
||||||
|
@ -80,9 +81,9 @@ public class FileBrowserDialog extends TrayDialog {
|
||||||
|
|
||||||
public FileBrowserDialog(Shell parentShell) {
|
public FileBrowserDialog(Shell parentShell) {
|
||||||
super(parentShell);
|
super(parentShell);
|
||||||
folderImage=ResourceManager.getPluginImage("com.minres.scviewer.e4.application", "icons/folder.png"); //$NON-NLS-1$ //$NON-NLS-2$
|
folderImage=ResourceManager.getPluginImage(Constants.PLUGIN_ID, "icons/folder.png"); //$NON-NLS-1$
|
||||||
dbImage=ResourceManager.getPluginImage("com.minres.scviewer.e4.application", "icons/database.png"); //$NON-NLS-1$ //$NON-NLS-2$
|
dbImage=ResourceManager.getPluginImage(Constants.PLUGIN_ID, "icons/database.png"); //$NON-NLS-1$
|
||||||
fileImage=ResourceManager.getPluginImage("com.minres.scviewer.e4.application", "icons/page_white.png"); //$NON-NLS-1$ //$NON-NLS-2$
|
fileImage=ResourceManager.getPluginImage(Constants.PLUGIN_ID, "icons/page_white.png"); //$NON-NLS-1$
|
||||||
currentDirFile = new File(".");
|
currentDirFile = new File(".");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -148,7 +149,7 @@ public class FileBrowserDialog extends TrayDialog {
|
||||||
toolBar.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL));
|
toolBar.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL));
|
||||||
final ToolItem toolbarItemUp = new ToolItem(toolBar, SWT.PUSH);
|
final ToolItem toolbarItemUp = new ToolItem(toolBar, SWT.PUSH);
|
||||||
toolbarItemUp.setToolTipText("up one level");
|
toolbarItemUp.setToolTipText("up one level");
|
||||||
toolbarItemUp.setImage(ResourceManager.getPluginImage("com.minres.scviewer.e4.application", "icons/arrow_up.png")); //$NON-NLS-1$ //$NON-NLS-2$);
|
toolbarItemUp.setImage(ResourceManager.getPluginImage(Constants.PLUGIN_ID, "icons/arrow_up.png")); //$NON-NLS-1$
|
||||||
toolbarItemUp.addSelectionListener(new SelectionAdapter() {
|
toolbarItemUp.addSelectionListener(new SelectionAdapter() {
|
||||||
@Override
|
@Override
|
||||||
public void widgetSelected(SelectionEvent e) {
|
public void widgetSelected(SelectionEvent e) {
|
||||||
|
@ -158,7 +159,7 @@ public class FileBrowserDialog extends TrayDialog {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
tableViewer = new TableViewer(tableViewerParent, SWT.BORDER | SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION | SWT.MULTI);
|
tableViewer = new TableViewer(tableViewerParent, SWT.BORDER | SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION);
|
||||||
tableViewer.getTable().setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL | GridData.VERTICAL_ALIGN_FILL | GridData.HORIZONTAL_ALIGN_FILL));
|
tableViewer.getTable().setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL | GridData.VERTICAL_ALIGN_FILL | GridData.HORIZONTAL_ALIGN_FILL));
|
||||||
tableViewer.addSelectionChangedListener(event -> {
|
tableViewer.addSelectionChangedListener(event -> {
|
||||||
IStructuredSelection sel = event.getStructuredSelection();
|
IStructuredSelection sel = event.getStructuredSelection();
|
||||||
|
@ -187,8 +188,8 @@ public class FileBrowserDialog extends TrayDialog {
|
||||||
public void mouseDown(MouseEvent e) { mouseUp(e); }
|
public void mouseDown(MouseEvent e) { mouseUp(e); }
|
||||||
@Override
|
@Override
|
||||||
public void mouseUp(MouseEvent e) {
|
public void mouseUp(MouseEvent e) {
|
||||||
TableItem element = (TableItem)tableViewer.getTable().getItem(new Point(e.x, e.y));
|
|
||||||
final Table table = tableViewer.getTable();
|
final Table table = tableViewer.getTable();
|
||||||
|
TableItem element = table.getItem(new Point(e.x, e.y));
|
||||||
if (element == null )//&& (e.stateMask&SWT.MODIFIER_MASK)!=0)
|
if (element == null )//&& (e.stateMask&SWT.MODIFIER_MASK)!=0)
|
||||||
table.deselectAll();
|
table.deselectAll();
|
||||||
else {
|
else {
|
||||||
|
@ -231,7 +232,6 @@ public class FileBrowserDialog extends TrayDialog {
|
||||||
colEmpty.setLabelProvider(new FileTableLabelProvider() {
|
colEmpty.setLabelProvider(new FileTableLabelProvider() {
|
||||||
@Override public String getText(Object element) { return ""; }
|
@Override public String getText(Object element) { return ""; }
|
||||||
});
|
});
|
||||||
//colEmpty.getColumn().setWidth(200);
|
|
||||||
colEmpty.getColumn().setText("");
|
colEmpty.getColumn().setText("");
|
||||||
|
|
||||||
fileTableComparator = new FileTableComparator();
|
fileTableComparator = new FileTableComparator();
|
||||||
|
@ -268,7 +268,7 @@ public class FileBrowserDialog extends TrayDialog {
|
||||||
}
|
}
|
||||||
|
|
||||||
private SelectionAdapter getSelectionAdapter(final TableColumn column, final int index) {
|
private SelectionAdapter getSelectionAdapter(final TableColumn column, final int index) {
|
||||||
SelectionAdapter selectionAdapter = new SelectionAdapter() {
|
return new SelectionAdapter() {
|
||||||
@Override
|
@Override
|
||||||
public void widgetSelected(SelectionEvent e) {
|
public void widgetSelected(SelectionEvent e) {
|
||||||
fileTableComparator.setColumn(index);
|
fileTableComparator.setColumn(index);
|
||||||
|
@ -278,7 +278,6 @@ public class FileBrowserDialog extends TrayDialog {
|
||||||
tableViewer.refresh();
|
tableViewer.refresh();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
return selectionAdapter;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setDirSelection(File f) {
|
private void setDirSelection(File f) {
|
||||||
|
@ -334,11 +333,12 @@ public class FileBrowserDialog extends TrayDialog {
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean matches(Object f) {
|
public boolean matches(Object f) {
|
||||||
assert(f instanceof File);
|
if(f instanceof File) {
|
||||||
if(matchers.size()==0) return true;
|
if(matchers.isEmpty()) return true;
|
||||||
for (PathMatcher m : matchers) {
|
for (PathMatcher m : matchers) {
|
||||||
if(m.matches(((File)f).toPath())) return true;
|
if(m.matches(((File)f).toPath())) return true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -349,10 +349,8 @@ public class FileBrowserDialog extends TrayDialog {
|
||||||
if(entries != null) {
|
if(entries != null) {
|
||||||
List<File> res = Arrays.stream(entries)
|
List<File> res = Arrays.stream(entries)
|
||||||
.filter(file -> !(file.isFile()||file.getName().startsWith(".") ||globber.matches(file)))
|
.filter(file -> !(file.isFile()||file.getName().startsWith(".") ||globber.matches(file)))
|
||||||
.sorted(new Comparator<File>(){
|
.sorted( (f1, f2) -> f1.getName().compareTo(f2.getName()))
|
||||||
public int compare(File f1, File f2){return f1.getName().compareTo(f2.getName());}
|
.collect(Collectors.toList());
|
||||||
})
|
|
||||||
.collect(Collectors.toList()); ;
|
|
||||||
return res.toArray();
|
return res.toArray();
|
||||||
} else
|
} else
|
||||||
return new Object[0];
|
return new Object[0];
|
||||||
|
@ -364,25 +362,20 @@ public class FileBrowserDialog extends TrayDialog {
|
||||||
|
|
||||||
public boolean hasChildren(Object arg0) {
|
public boolean hasChildren(Object arg0) {
|
||||||
Object[] obj = getChildren(arg0);
|
Object[] obj = getChildren(arg0);
|
||||||
return obj == null ? false : obj.length > 0;
|
return obj != null && obj.length > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Object[] getElements(Object arg0) {
|
public Object[] getElements(Object arg0) {
|
||||||
return File.listRoots();
|
return File.listRoots();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void dispose() {
|
|
||||||
}
|
|
||||||
|
|
||||||
public void inputChanged(Viewer arg0, Object arg1, Object arg2) {
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class FileTreeLabelProvider implements ILabelProvider {
|
class FileTreeLabelProvider implements ILabelProvider {
|
||||||
private List<ILabelProviderListener> listeners;
|
private List<ILabelProviderListener> listeners;
|
||||||
|
|
||||||
public FileTreeLabelProvider() {
|
public FileTreeLabelProvider() {
|
||||||
listeners = new ArrayList<ILabelProviderListener>();
|
listeners = new ArrayList<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Image getImage(Object arg0) {
|
public Image getImage(Object arg0) {
|
||||||
|
@ -400,6 +393,7 @@ public class FileBrowserDialog extends TrayDialog {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void dispose() {
|
public void dispose() {
|
||||||
|
// nothing to ispose
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isLabelProperty(Object arg0, String arg1) {
|
public boolean isLabelProperty(Object arg0, String arg1) {
|
||||||
|
@ -425,15 +419,12 @@ public class FileBrowserDialog extends TrayDialog {
|
||||||
private int propertyIndex = 0;
|
private int propertyIndex = 0;
|
||||||
private boolean descending = false;
|
private boolean descending = false;
|
||||||
|
|
||||||
public FileTableComparator() {
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getDirection() {
|
public int getDirection() {
|
||||||
return descending ? SWT.DOWN : SWT.UP;
|
return descending ? SWT.DOWN : SWT.UP;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setColumn(int column) {
|
public void setColumn(int column) {
|
||||||
descending = column == this.propertyIndex?!descending : false;
|
descending = column == this.propertyIndex && !descending;
|
||||||
this.propertyIndex = column;
|
this.propertyIndex = column;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,94 +0,0 @@
|
||||||
package com.minres.scviewer.e4.application.parts;
|
|
||||||
|
|
||||||
import java.beans.PropertyChangeListener;
|
|
||||||
import java.io.File;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import com.minres.scviewer.database.IDerivedWaveform;
|
|
||||||
import com.minres.scviewer.database.IHierNode;
|
|
||||||
import com.minres.scviewer.database.IWaveform;
|
|
||||||
import com.minres.scviewer.database.IWaveformDb;
|
|
||||||
import com.minres.scviewer.database.RelationType;
|
|
||||||
import com.minres.scviewer.e4.application.Messages;
|
|
||||||
|
|
||||||
public class LoadingWaveformDb implements IWaveformDb {
|
|
||||||
|
|
||||||
private final String label = Messages.LoadingWaveformDb_0;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void addPropertyChangeListener(PropertyChangeListener l) {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void removePropertyChangeListener(PropertyChangeListener l) {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getFullName() {
|
|
||||||
return label;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getName() {
|
|
||||||
return label;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setName(String name) {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setParent(IHierNode name) {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<IHierNode> getChildNodes() {
|
|
||||||
return new ArrayList<IHierNode>();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int compareTo(IHierNode o) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Long getMaxTime() {
|
|
||||||
return new Long(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public IWaveform getStreamByName(String name) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<IWaveform> getAllWaves() {
|
|
||||||
return new ArrayList<IWaveform>();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<RelationType> getAllRelationTypes() {
|
|
||||||
return new ArrayList<RelationType>();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean load(File inp) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isLoaded() {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void clear() {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public IDerivedWaveform deriveWaveform() {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -85,9 +85,6 @@ public class TransactionDetails {
|
||||||
/** The selection service. */
|
/** The selection service. */
|
||||||
@Inject ESelectionService selectionService;
|
@Inject ESelectionService selectionService;
|
||||||
|
|
||||||
/** The name filter. */
|
|
||||||
private Text nameFilter;
|
|
||||||
|
|
||||||
/** The tree viewer. */
|
/** The tree viewer. */
|
||||||
private TreeViewer treeViewer;
|
private TreeViewer treeViewer;
|
||||||
|
|
||||||
|
@ -122,7 +119,7 @@ public class TransactionDetails {
|
||||||
top = new Composite(parent, SWT.NONE);
|
top = new Composite(parent, SWT.NONE);
|
||||||
top.setLayout(new GridLayout(1, false));
|
top.setLayout(new GridLayout(1, false));
|
||||||
|
|
||||||
nameFilter = new Text(top, SWT.BORDER);
|
Text nameFilter = new Text(top, SWT.BORDER);
|
||||||
nameFilter.setMessage(Messages.TransactionDetails_0);
|
nameFilter.setMessage(Messages.TransactionDetails_0);
|
||||||
nameFilter.addModifyListener(e -> {
|
nameFilter.addModifyListener(e -> {
|
||||||
attributeFilter.setSearchText(((Text) e.widget).getText());
|
attributeFilter.setSearchText(((Text) e.widget).getText());
|
||||||
|
@ -204,11 +201,6 @@ public class TransactionDetails {
|
||||||
treeViewer.refresh();
|
treeViewer.refresh();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
// Pack the columns
|
|
||||||
// for (int i = 0, n = table.getColumnCount(); i < n; i++) {
|
|
||||||
// table.getColumn(i).pack();
|
|
||||||
// }
|
|
||||||
|
|
||||||
// Turn on the header and the lines
|
// Turn on the header and the lines
|
||||||
tree.setHeaderVisible(true);
|
tree.setHeaderVisible(true);
|
||||||
tree.setLinesVisible(true);
|
tree.setLinesVisible(true);
|
||||||
|
|
|
@ -16,11 +16,13 @@ import java.io.FileNotFoundException;
|
||||||
import java.io.FileOutputStream;
|
import java.io.FileOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Objects;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
@ -75,6 +77,7 @@ import org.eclipse.swt.widgets.Widget;
|
||||||
|
|
||||||
import com.minres.scviewer.database.DataType;
|
import com.minres.scviewer.database.DataType;
|
||||||
import com.minres.scviewer.database.IEvent;
|
import com.minres.scviewer.database.IEvent;
|
||||||
|
import com.minres.scviewer.database.IHierNode;
|
||||||
import com.minres.scviewer.database.IWaveform;
|
import com.minres.scviewer.database.IWaveform;
|
||||||
import com.minres.scviewer.database.IWaveformDb;
|
import com.minres.scviewer.database.IWaveformDb;
|
||||||
import com.minres.scviewer.database.IWaveformDbFactory;
|
import com.minres.scviewer.database.IWaveformDbFactory;
|
||||||
|
@ -251,7 +254,7 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
|
||||||
showHover=hover;
|
showHover=hover;
|
||||||
database = dbFactory.getDatabase();
|
database = dbFactory.getDatabase();
|
||||||
database.addPropertyChangeListener(evt -> {
|
database.addPropertyChangeListener(evt -> {
|
||||||
if ("WAVEFORMS".equals(evt.getPropertyName())) { //$NON-NLS-1$
|
if (IHierNode.WAVEFORMS.equals(evt.getPropertyName())) { //$NON-NLS-1$
|
||||||
myParent.getDisplay().syncExec(() -> waveformPane.setMaxTime(database.getMaxTime()));
|
myParent.getDisplay().syncExec(() -> waveformPane.setMaxTime(database.getMaxTime()));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -354,8 +357,10 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
|
||||||
case SWT.ARROW_DOWN:
|
case SWT.ARROW_DOWN:
|
||||||
waveformPane.moveSelection(GotoDirection.DOWN);
|
waveformPane.moveSelection(GotoDirection.DOWN);
|
||||||
return;
|
return;
|
||||||
case SWT.HOME: return; //TODO: should be handled
|
case SWT.HOME:
|
||||||
case SWT.END: return; //TODO: should be handled
|
return;
|
||||||
|
case SWT.END:
|
||||||
|
return;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -536,6 +541,7 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
|
||||||
|
|
||||||
protected void loadDatabase(final Map<String, String> state, long delay) {
|
protected void loadDatabase(final Map<String, String> state, long delay) {
|
||||||
fileMonitor.removeFileChangeListener(this);
|
fileMonitor.removeFileChangeListener(this);
|
||||||
|
database.setName(filesToLoad.stream().map(File::getName).reduce(null, (prefix, element) -> prefix==null? element : prefix + ","+ element));
|
||||||
Job job = new Job(Messages.WaveformViewer_15) {
|
Job job = new Job(Messages.WaveformViewer_15) {
|
||||||
@Override
|
@Override
|
||||||
protected IStatus run(IProgressMonitor monitor) {
|
protected IStatus run(IProgressMonitor monitor) {
|
||||||
|
@ -683,9 +689,7 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
|
||||||
//clear old streams before loading tab settings
|
//clear old streams before loading tab settings
|
||||||
if(!waveformPane.getStreamList().isEmpty()) {
|
if(!waveformPane.getStreamList().isEmpty()) {
|
||||||
waveformPane.getStreamList().clear();
|
waveformPane.getStreamList().clear();
|
||||||
for (TrackEntry trackEntry : waveformPane.getStreamList()) {
|
waveformPane.getStreamList().stream().forEach(e -> e.selected=false);
|
||||||
trackEntry.selected = false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
try (FileInputStream in = new FileInputStream(fileName)) {
|
try (FileInputStream in = new FileInputStream(fileName)) {
|
||||||
Properties props = new Properties();
|
Properties props = new Properties();
|
||||||
|
@ -763,25 +767,25 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
|
||||||
*/
|
*/
|
||||||
protected void restoreWaveformViewerState(Map<String, String> state) {
|
protected void restoreWaveformViewerState(Map<String, String> state) {
|
||||||
Integer waves = state.containsKey(SHOWN_WAVEFORM+"S") ? Integer.parseInt(state.get(SHOWN_WAVEFORM + "S")):0; //$NON-NLS-1$ //$NON-NLS-2$
|
Integer waves = state.containsKey(SHOWN_WAVEFORM+"S") ? Integer.parseInt(state.get(SHOWN_WAVEFORM + "S")):0; //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
List<TrackEntry> res = new LinkedList<>();
|
List<TrackEntry> trackEntries = new LinkedList<>();
|
||||||
for (int i = 0; i < waves; i++) {
|
for (int i = 0; i < waves; i++) {
|
||||||
IWaveform waveform = database.getStreamByName(state.get(SHOWN_WAVEFORM + i));
|
IWaveform waveform = database.getStreamByName(state.get(SHOWN_WAVEFORM + i));
|
||||||
if (waveform != null) {
|
if (waveform != null) {
|
||||||
TrackEntry t = waveformPane.addWaveform(waveform, -1);
|
TrackEntry trackEntry = waveformPane.addWaveform(waveform, -1);
|
||||||
//check if t is selected
|
//check if t is selected
|
||||||
boolean isSelected = Boolean.parseBoolean(state.get(SHOWN_WAVEFORM + i + WAVEFORM_SELECTED));
|
boolean isSelected = Boolean.parseBoolean(state.get(SHOWN_WAVEFORM + i + WAVEFORM_SELECTED));
|
||||||
if(isSelected) {
|
if(isSelected) {
|
||||||
t.selected = true;
|
trackEntry.selected = true;
|
||||||
} else {
|
} else {
|
||||||
t.selected = false;
|
trackEntry.selected = false;
|
||||||
}
|
}
|
||||||
res.add(t);
|
trackEntries.add(trackEntry);
|
||||||
String v = state.get(SHOWN_WAVEFORM + i + VALUE_DISPLAY);
|
String v = state.get(SHOWN_WAVEFORM + i + VALUE_DISPLAY);
|
||||||
if(v!=null)
|
if(v!=null)
|
||||||
t.valueDisplay=ValueDisplay.valueOf(v);
|
trackEntry.valueDisplay=ValueDisplay.valueOf(v);
|
||||||
String s = state.get(SHOWN_WAVEFORM + i + WAVE_DISPLAY);
|
String s = state.get(SHOWN_WAVEFORM + i + WAVE_DISPLAY);
|
||||||
if(s!=null)
|
if(s!=null)
|
||||||
t.waveDisplay=WaveDisplay.valueOf(s);
|
trackEntry.waveDisplay=WaveDisplay.valueOf(s);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Integer cursorLength = state.containsKey(SHOWN_CURSOR+"S")?Integer.parseInt(state.get(SHOWN_CURSOR + "S")):0; //$NON-NLS-1$ //$NON-NLS-2$
|
Integer cursorLength = state.containsKey(SHOWN_CURSOR+"S")?Integer.parseInt(state.get(SHOWN_CURSOR + "S")):0; //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
|
@ -810,32 +814,11 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
|
||||||
try {
|
try {
|
||||||
Long txId = Long.parseLong(state.get(SELECTED_TX_ID));
|
Long txId = Long.parseLong(state.get(SELECTED_TX_ID));
|
||||||
String trackentryName = state.get(SELECTED_TRACKENTRY_NAME);
|
String trackentryName = state.get(SELECTED_TRACKENTRY_NAME);
|
||||||
|
|
||||||
//get TrackEntry Object based on name and TX Object by id and put into selectionList
|
//get TrackEntry Object based on name and TX Object by id and put into selectionList
|
||||||
for(TrackEntry te : res) {
|
trackEntries.stream().filter(e->trackentryName.equals(e.waveform.getFullName())).forEach(trackEntry ->
|
||||||
if(te.waveform.getFullName().compareTo(trackentryName)==0) {
|
trackEntry.waveform.getEvents().values().stream().filter(Objects::nonNull).forEach(entries->
|
||||||
boolean found = false;
|
Arrays.stream(entries).filter(e->e instanceof ITxEvent && txId.equals(((ITxEvent)e).getTransaction().getId())).forEach(event ->
|
||||||
// TODO: find transaction by time? To avoid 3x for-loop
|
waveformPane.setSelection(new StructuredSelection(new Object[] {((ITxEvent)event).getTransaction(), trackEntry})))));
|
||||||
for( IEvent[] lev : te.waveform.getEvents().values() ) {
|
|
||||||
if(lev != null)
|
|
||||||
for(IEvent itxe : lev) {
|
|
||||||
if(itxe instanceof ITxEvent) {
|
|
||||||
ITx itx = ((ITxEvent)itxe).getTransaction();
|
|
||||||
if(itx.getId().equals(txId)) {
|
|
||||||
found = true;
|
|
||||||
ArrayList<Object> selectionList = new ArrayList<>();
|
|
||||||
selectionList.add(te);
|
|
||||||
selectionList.add(itx);
|
|
||||||
waveformPane.setSelection(new StructuredSelection (selectionList));
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(found) break;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (NumberFormatException e) {
|
} catch (NumberFormatException e) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -916,15 +899,6 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
|
||||||
return ext;
|
return ext;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the model.
|
|
||||||
*
|
|
||||||
* @return the model
|
|
||||||
*/
|
|
||||||
public IWaveformDb getModel() {
|
|
||||||
return database;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the database.
|
* Gets the database.
|
||||||
*
|
*
|
||||||
|
|
|
@ -10,13 +10,15 @@
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package com.minres.scviewer.e4.application.preferences;
|
package com.minres.scviewer.e4.application.preferences;
|
||||||
|
|
||||||
|
import com.minres.scviewer.e4.application.Constants;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Class PreferenceConstants for the preferences dialog & setting.
|
* The Class PreferenceConstants for the preferences dialog & setting.
|
||||||
*/
|
*/
|
||||||
public class PreferenceConstants {
|
public class PreferenceConstants {
|
||||||
|
|
||||||
/** The Constant PREFERENCES_SCOPE. */
|
/** The Constant PREFERENCES_SCOPE. */
|
||||||
public static final String PREFERENCES_SCOPE="com.minres.scviewer.e4.application"; //$NON-NLS-1$
|
public static final String PREFERENCES_SCOPE=Constants.PLUGIN_ID; //$NON-NLS-1$
|
||||||
|
|
||||||
/** The Constant DATABASE_RELOAD. */
|
/** The Constant DATABASE_RELOAD. */
|
||||||
public static final String DATABASE_RELOAD="databaseReload"; //$NON-NLS-1$
|
public static final String DATABASE_RELOAD="databaseReload"; //$NON-NLS-1$
|
||||||
|
@ -81,5 +83,5 @@ public class PreferenceConstants {
|
||||||
/** The Constant MARKER_TEXT_COLOR. */
|
/** The Constant MARKER_TEXT_COLOR. */
|
||||||
public static final String MARKER_TEXT_COLOR="MARKER_TEXT_COLOR"; //$NON-NLS-1$
|
public static final String MARKER_TEXT_COLOR="MARKER_TEXT_COLOR"; //$NON-NLS-1$
|
||||||
|
|
||||||
|
private PreferenceConstants() {}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,8 @@
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package com.minres.scviewer.e4.application.provider;
|
package com.minres.scviewer.e4.application.provider;
|
||||||
|
|
||||||
import java.util.Collection;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Comparator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
@ -54,12 +55,15 @@ public class TxDbContentProvider implements ITreeContentProvider {
|
||||||
if(tableEntries && inputElement instanceof IWaveformDb){
|
if(tableEntries && inputElement instanceof IWaveformDb){
|
||||||
return new Object[]{};
|
return new Object[]{};
|
||||||
}else if(inputElement instanceof IHierNode){
|
}else if(inputElement instanceof IHierNode){
|
||||||
Collection<IHierNode> res = ((IHierNode)inputElement).getChildNodes().stream().filter(n ->
|
// make a copy as the laoder might continue to add waveforms
|
||||||
|
ArrayList<IHierNode> nodes = new ArrayList<>(((IHierNode)inputElement).getChildNodes());
|
||||||
|
return nodes.stream().filter(n ->
|
||||||
tableEntries? n instanceof IWaveform : !n.getChildNodes().isEmpty()
|
tableEntries? n instanceof IWaveform : !n.getChildNodes().isEmpty()
|
||||||
).collect(Collectors.toList());
|
).sorted(Comparator.comparing(IHierNode::getName)).collect(Collectors.toList()).toArray();
|
||||||
return res.toArray();
|
|
||||||
}else if(inputElement instanceof List<?>){
|
}else if(inputElement instanceof List<?>){
|
||||||
return ((List<?>)inputElement).toArray();
|
return ((List<?>)inputElement).toArray();
|
||||||
|
}else if(inputElement instanceof Object[]){
|
||||||
|
return (Object[]) inputElement;
|
||||||
} else
|
} else
|
||||||
return new Object[]{};
|
return new Object[]{};
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,7 +21,7 @@ import org.eclipse.wb.swt.ResourceManager;
|
||||||
import com.minres.scviewer.database.IHierNode;
|
import com.minres.scviewer.database.IHierNode;
|
||||||
import com.minres.scviewer.database.IWaveform;
|
import com.minres.scviewer.database.IWaveform;
|
||||||
import com.minres.scviewer.database.IWaveformDb;
|
import com.minres.scviewer.database.IWaveformDb;
|
||||||
import com.minres.scviewer.e4.application.parts.LoadingWaveformDb;
|
import com.minres.scviewer.e4.application.Constants;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Class TxDbLabelProvider providing the labels for the respective viewers.
|
* The Class TxDbLabelProvider providing the labels for the respective viewers.
|
||||||
|
@ -29,25 +29,44 @@ import com.minres.scviewer.e4.application.parts.LoadingWaveformDb;
|
||||||
public class TxDbLabelProvider implements ILabelProvider {
|
public class TxDbLabelProvider implements ILabelProvider {
|
||||||
|
|
||||||
/** The listeners. */
|
/** The listeners. */
|
||||||
private List<ILabelProviderListener> listeners = new ArrayList<ILabelProviderListener>();
|
private List<ILabelProviderListener> listeners = new ArrayList<>();
|
||||||
|
|
||||||
/** The wave. */
|
/** The wave. */
|
||||||
private Image loadinDatabase, database, stream, signal, folder, wave;
|
private Image loadinDatabase;
|
||||||
|
|
||||||
|
/** The database. */
|
||||||
|
private Image database;
|
||||||
|
|
||||||
|
/** The stream. */
|
||||||
|
private Image stream;
|
||||||
|
|
||||||
|
/** The signal. */
|
||||||
|
private Image signal;
|
||||||
|
|
||||||
|
/** The folder. */
|
||||||
|
private Image folder;
|
||||||
|
|
||||||
|
/** The wave. */
|
||||||
|
private Image wave;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instantiates a new tx db label provider.
|
* Instantiates a new tx db label provider.
|
||||||
*/
|
*/
|
||||||
public TxDbLabelProvider() {
|
public TxDbLabelProvider() {
|
||||||
super();
|
super();
|
||||||
loadinDatabase=ResourceManager.getPluginImage("com.minres.scviewer.e4.application", "icons/database_go.png"); //$NON-NLS-1$ //$NON-NLS-2$
|
loadinDatabase=ResourceManager.getPluginImage(Constants.PLUGIN_ID, "icons/database_go.png"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
database=ResourceManager.getPluginImage("com.minres.scviewer.e4.application", "icons/database.png"); //$NON-NLS-1$ //$NON-NLS-2$
|
database=ResourceManager.getPluginImage(Constants.PLUGIN_ID, "icons/database.png"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
stream=ResourceManager.getPluginImage("com.minres.scviewer.e4.application", "icons/stream.png"); //$NON-NLS-1$ //$NON-NLS-2$
|
stream=ResourceManager.getPluginImage(Constants.PLUGIN_ID, "icons/stream.png"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
folder=ResourceManager.getPluginImage("com.minres.scviewer.e4.application", "icons/folder.png"); //$NON-NLS-1$ //$NON-NLS-2$
|
folder=ResourceManager.getPluginImage(Constants.PLUGIN_ID, "icons/folder.png"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
signal=ResourceManager.getPluginImage("com.minres.scviewer.e4.application", "icons/signal.png"); //$NON-NLS-1$ //$NON-NLS-2$
|
signal=ResourceManager.getPluginImage(Constants.PLUGIN_ID, "icons/signal.png"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
wave=ResourceManager.getPluginImage("com.minres.scviewer.e4.application", "icons/wave.png"); //$NON-NLS-1$ //$NON-NLS-2$
|
wave=ResourceManager.getPluginImage(Constants.PLUGIN_ID, "icons/wave.png"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds the listener.
|
||||||
|
*
|
||||||
|
* @param listener the listener
|
||||||
|
*/
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.jface.viewers.IBaseLabelProvider#addListener(org.eclipse.jface.viewers.ILabelProviderListener)
|
* @see org.eclipse.jface.viewers.IBaseLabelProvider#addListener(org.eclipse.jface.viewers.ILabelProviderListener)
|
||||||
*/
|
*/
|
||||||
|
@ -56,13 +75,24 @@ public class TxDbLabelProvider implements ILabelProvider {
|
||||||
listeners.add(listener);
|
listeners.add(listener);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Dispose.
|
||||||
|
*/
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.jface.viewers.IBaseLabelProvider#dispose()
|
* @see org.eclipse.jface.viewers.IBaseLabelProvider#dispose()
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void dispose() {
|
public void dispose() {
|
||||||
|
// no resources to dispose
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if is label property.
|
||||||
|
*
|
||||||
|
* @param element the element
|
||||||
|
* @param property the property
|
||||||
|
* @return true, if is label property
|
||||||
|
*/
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.jface.viewers.IBaseLabelProvider#isLabelProperty(java.lang.Object, java.lang.String)
|
* @see org.eclipse.jface.viewers.IBaseLabelProvider#isLabelProperty(java.lang.Object, java.lang.String)
|
||||||
*/
|
*/
|
||||||
|
@ -71,6 +101,11 @@ public class TxDbLabelProvider implements ILabelProvider {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Removes the listener.
|
||||||
|
*
|
||||||
|
* @param listener the listener
|
||||||
|
*/
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.jface.viewers.IBaseLabelProvider#removeListener(org.eclipse.jface.viewers.ILabelProviderListener)
|
* @see org.eclipse.jface.viewers.IBaseLabelProvider#removeListener(org.eclipse.jface.viewers.ILabelProviderListener)
|
||||||
*/
|
*/
|
||||||
|
@ -79,16 +114,19 @@ public class TxDbLabelProvider implements ILabelProvider {
|
||||||
listeners.remove(listener);
|
listeners.remove(listener);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the image.
|
||||||
|
*
|
||||||
|
* @param element the element
|
||||||
|
* @return the image
|
||||||
|
*/
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.jface.viewers.ILabelProvider#getImage(java.lang.Object)
|
* @see org.eclipse.jface.viewers.ILabelProvider#getImage(java.lang.Object)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Image getImage(Object element) {
|
public Image getImage(Object element) {
|
||||||
if(element instanceof IWaveformDb){
|
if(element instanceof IWaveformDb){
|
||||||
if(element instanceof LoadingWaveformDb)
|
return ((IWaveformDb)element).isLoaded()?database:loadinDatabase;
|
||||||
return loadinDatabase;
|
|
||||||
else
|
|
||||||
return database;
|
|
||||||
}else if(element instanceof IWaveform){
|
}else if(element instanceof IWaveform){
|
||||||
switch(((IWaveform) element).getType()) {
|
switch(((IWaveform) element).getType()) {
|
||||||
case TRANSACTION:
|
case TRANSACTION:
|
||||||
|
@ -110,6 +148,12 @@ public class TxDbLabelProvider implements ILabelProvider {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the text.
|
||||||
|
*
|
||||||
|
* @param element the element
|
||||||
|
* @return the text
|
||||||
|
*/
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.jface.viewers.ILabelProvider#getText(java.lang.Object)
|
* @see org.eclipse.jface.viewers.ILabelProvider#getText(java.lang.Object)
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -13,8 +13,6 @@ package org.eclipse.wb.swt;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.lang.reflect.Constructor;
|
|
||||||
import java.lang.reflect.Method;
|
|
||||||
import java.net.MalformedURLException;
|
import java.net.MalformedURLException;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
@ -61,7 +59,7 @@ public class ResourceManager extends SWTResourceManager {
|
||||||
/**
|
/**
|
||||||
* The map where we store our images.
|
* The map where we store our images.
|
||||||
*/
|
*/
|
||||||
private static Map<ImageDescriptor, Image> m_descriptorImageMap = new HashMap<ImageDescriptor, Image>();
|
private static Map<ImageDescriptor, Image> descriptorImageMap = new HashMap<>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns an {@link ImageDescriptor} stored in the file at the specified path
|
* Returns an {@link ImageDescriptor} stored in the file at the specified path
|
||||||
|
@ -97,22 +95,16 @@ public class ResourceManager extends SWTResourceManager {
|
||||||
* @return the {@link Image} based on the specified {@link ImageDescriptor}.
|
* @return the {@link Image} based on the specified {@link ImageDescriptor}.
|
||||||
*/
|
*/
|
||||||
public static Image getImage(ImageDescriptor descriptor) {
|
public static Image getImage(ImageDescriptor descriptor) {
|
||||||
if (descriptor == null) {
|
if (descriptor == null)
|
||||||
return null;
|
return null;
|
||||||
}
|
return descriptorImageMap.computeIfAbsent(descriptor, ImageDescriptor::createImage);
|
||||||
Image image = m_descriptorImageMap.get(descriptor);
|
|
||||||
if (image == null) {
|
|
||||||
image = descriptor.createImage();
|
|
||||||
m_descriptorImageMap.put(descriptor, image);
|
|
||||||
}
|
|
||||||
return image;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Maps images to decorated images.
|
* Maps images to decorated images.
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
private static Map<Image, Map<Image, Image>>[] m_decoratedImageMap = new Map[LAST_CORNER_KEY];
|
private static Map<Image, Map<Image, Image>>[] decoratedImageMap = new Map[LAST_CORNER_KEY];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns an {@link Image} composed of a base image decorated by another image.
|
* Returns an {@link Image} composed of a base image decorated by another image.
|
||||||
|
@ -140,17 +132,12 @@ public class ResourceManager extends SWTResourceManager {
|
||||||
if (corner <= 0 || corner >= LAST_CORNER_KEY) {
|
if (corner <= 0 || corner >= LAST_CORNER_KEY) {
|
||||||
throw new IllegalArgumentException(Messages.ResourceManager_0);
|
throw new IllegalArgumentException(Messages.ResourceManager_0);
|
||||||
}
|
}
|
||||||
Map<Image, Map<Image, Image>> cornerDecoratedImageMap = m_decoratedImageMap[corner];
|
Map<Image, Map<Image, Image>> cornerDecoratedImageMap = decoratedImageMap[corner];
|
||||||
if (cornerDecoratedImageMap == null) {
|
if (cornerDecoratedImageMap == null) {
|
||||||
cornerDecoratedImageMap = new HashMap<Image, Map<Image, Image>>();
|
cornerDecoratedImageMap = new HashMap<>();
|
||||||
m_decoratedImageMap[corner] = cornerDecoratedImageMap;
|
decoratedImageMap[corner] = cornerDecoratedImageMap;
|
||||||
}
|
}
|
||||||
Map<Image, Image> decoratedMap = cornerDecoratedImageMap.get(baseImage);
|
Map<Image, Image> decoratedMap = cornerDecoratedImageMap.computeIfAbsent(baseImage, k -> new HashMap<Image, Image>());
|
||||||
if (decoratedMap == null) {
|
|
||||||
decoratedMap = new HashMap<Image, Image>();
|
|
||||||
cornerDecoratedImageMap.put(baseImage, decoratedMap);
|
|
||||||
}
|
|
||||||
//
|
|
||||||
Image result = decoratedMap.get(decorator);
|
Image result = decoratedMap.get(decorator);
|
||||||
if (result == null) {
|
if (result == null) {
|
||||||
final Rectangle bib = baseImage.getBounds();
|
final Rectangle bib = baseImage.getBounds();
|
||||||
|
@ -193,15 +180,13 @@ public class ResourceManager extends SWTResourceManager {
|
||||||
public static void disposeImages() {
|
public static void disposeImages() {
|
||||||
SWTResourceManager.disposeImages();
|
SWTResourceManager.disposeImages();
|
||||||
// dispose ImageDescriptor images
|
// dispose ImageDescriptor images
|
||||||
{
|
for (Iterator<Image> I = descriptorImageMap.values().iterator(); I.hasNext();) {
|
||||||
for (Iterator<Image> I = m_descriptorImageMap.values().iterator(); I.hasNext();) {
|
|
||||||
I.next().dispose();
|
I.next().dispose();
|
||||||
}
|
}
|
||||||
m_descriptorImageMap.clear();
|
descriptorImageMap.clear();
|
||||||
}
|
|
||||||
// dispose decorated images
|
// dispose decorated images
|
||||||
for (int i = 0; i < m_decoratedImageMap.length; i++) {
|
for (int i = 0; i < decoratedImageMap.length; i++) {
|
||||||
Map<Image, Map<Image, Image>> cornerDecoratedImageMap = m_decoratedImageMap[i];
|
Map<Image, Map<Image, Image>> cornerDecoratedImageMap = decoratedImageMap[i];
|
||||||
if (cornerDecoratedImageMap != null) {
|
if (cornerDecoratedImageMap != null) {
|
||||||
for (Map<Image, Image> decoratedMap : cornerDecoratedImageMap.values()) {
|
for (Map<Image, Image> decoratedMap : cornerDecoratedImageMap.values()) {
|
||||||
for (Image image : decoratedMap.values()) {
|
for (Image image : decoratedMap.values()) {
|
||||||
|
@ -213,12 +198,10 @@ public class ResourceManager extends SWTResourceManager {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// dispose plugin images
|
// dispose plugin images
|
||||||
{
|
for (Iterator<Image> I = urlImageMap.values().iterator(); I.hasNext();) {
|
||||||
for (Iterator<Image> I = m_URLImageMap.values().iterator(); I.hasNext();) {
|
|
||||||
I.next().dispose();
|
I.next().dispose();
|
||||||
}
|
}
|
||||||
m_URLImageMap.clear();
|
urlImageMap.clear();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -229,7 +212,7 @@ public class ResourceManager extends SWTResourceManager {
|
||||||
/**
|
/**
|
||||||
* Maps URL to images.
|
* Maps URL to images.
|
||||||
*/
|
*/
|
||||||
private static Map<String, Image> m_URLImageMap = new HashMap<String, Image>();
|
private static Map<String, Image> urlImageMap = new HashMap<>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provider for plugin resources, used by WindowBuilder at design time.
|
* Provider for plugin resources, used by WindowBuilder at design time.
|
||||||
|
@ -242,29 +225,7 @@ public class ResourceManager extends SWTResourceManager {
|
||||||
* Instance of {@link PluginResourceProvider}, used by WindowBuilder at design
|
* Instance of {@link PluginResourceProvider}, used by WindowBuilder at design
|
||||||
* time.
|
* time.
|
||||||
*/
|
*/
|
||||||
private static PluginResourceProvider m_designTimePluginResourceProvider = null;
|
private static PluginResourceProvider designTimePluginResourceProvider = null;
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns an {@link Image} based on a plugin and file path.
|
|
||||||
*
|
|
||||||
* @param plugin the plugin {@link Object} containing the image
|
|
||||||
* @param name the path to the image within the plugin
|
|
||||||
* @return the {@link Image} stored in the file at the specified path
|
|
||||||
*
|
|
||||||
* @deprecated Use {@link #getPluginImage(String, String)} instead.
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public static Image getPluginImage(Object plugin, String name) {
|
|
||||||
try {
|
|
||||||
URL url = getPluginImageURL(plugin, name);
|
|
||||||
if (url != null) {
|
|
||||||
return getPluginImageFromUrl(url);
|
|
||||||
}
|
|
||||||
} catch (Throwable e) {
|
|
||||||
// Ignore any exceptions
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns an {@link Image} based on a {@link Bundle} and resource entry path.
|
* Returns an {@link Image} based on a {@link Bundle} and resource entry path.
|
||||||
|
@ -279,7 +240,7 @@ public class ResourceManager extends SWTResourceManager {
|
||||||
if (url != null) {
|
if (url != null) {
|
||||||
return getPluginImageFromUrl(url);
|
return getPluginImageFromUrl(url);
|
||||||
}
|
}
|
||||||
} catch (Throwable e) {
|
} catch (Exception e) {
|
||||||
// Ignore any exceptions
|
// Ignore any exceptions
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
@ -289,48 +250,20 @@ public class ResourceManager extends SWTResourceManager {
|
||||||
* Returns an {@link Image} based on given {@link URL}.
|
* Returns an {@link Image} based on given {@link URL}.
|
||||||
*/
|
*/
|
||||||
private static Image getPluginImageFromUrl(URL url) {
|
private static Image getPluginImageFromUrl(URL url) {
|
||||||
try {
|
|
||||||
try {
|
try {
|
||||||
String key = url.toExternalForm();
|
String key = url.toExternalForm();
|
||||||
Image image = m_URLImageMap.get(key);
|
Image image = urlImageMap.get(key);
|
||||||
if (image == null) {
|
if (image == null) {
|
||||||
InputStream stream = url.openStream();
|
InputStream stream = url.openStream();
|
||||||
try {
|
try {
|
||||||
image = getImage(stream);
|
image = getImage(stream);
|
||||||
m_URLImageMap.put(key, image);
|
urlImageMap.put(key, image);
|
||||||
} finally {
|
} finally {
|
||||||
stream.close();
|
stream.close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return image;
|
return image;
|
||||||
} catch (Throwable e) {
|
} catch (Exception e) {
|
||||||
// Ignore any exceptions
|
|
||||||
}
|
|
||||||
} catch (Throwable e) {
|
|
||||||
// Ignore any exceptions
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns an {@link ImageDescriptor} based on a plugin and file path.
|
|
||||||
*
|
|
||||||
* @param plugin the plugin {@link Object} containing the image.
|
|
||||||
* @param name the path to th eimage within the plugin.
|
|
||||||
* @return the {@link ImageDescriptor} stored in the file at the specified path.
|
|
||||||
*
|
|
||||||
* @deprecated Use {@link #getPluginImageDescriptor(String, String)} instead.
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public static ImageDescriptor getPluginImageDescriptor(Object plugin, String name) {
|
|
||||||
try {
|
|
||||||
try {
|
|
||||||
URL url = getPluginImageURL(plugin, name);
|
|
||||||
return ImageDescriptor.createFromURL(url);
|
|
||||||
} catch (Throwable e) {
|
|
||||||
// Ignore any exceptions
|
|
||||||
}
|
|
||||||
} catch (Throwable e) {
|
|
||||||
// Ignore any exceptions
|
// Ignore any exceptions
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
@ -351,7 +284,7 @@ public class ResourceManager extends SWTResourceManager {
|
||||||
if (url != null) {
|
if (url != null) {
|
||||||
return ImageDescriptor.createFromURL(url);
|
return ImageDescriptor.createFromURL(url);
|
||||||
}
|
}
|
||||||
} catch (Throwable e) {
|
} catch (Exception e) {
|
||||||
// Ignore any exceptions
|
// Ignore any exceptions
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
@ -362,66 +295,18 @@ public class ResourceManager extends SWTResourceManager {
|
||||||
*/
|
*/
|
||||||
private static URL getPluginImageURL(String symbolicName, String path) {
|
private static URL getPluginImageURL(String symbolicName, String path) {
|
||||||
// try runtime plugins
|
// try runtime plugins
|
||||||
{
|
|
||||||
Bundle bundle = Platform.getBundle(symbolicName);
|
Bundle bundle = Platform.getBundle(symbolicName);
|
||||||
if (bundle != null) {
|
if (bundle != null) {
|
||||||
return bundle.getEntry(path);
|
return bundle.getEntry(path);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
// try design time provider
|
// try design time provider
|
||||||
if (m_designTimePluginResourceProvider != null) {
|
if (designTimePluginResourceProvider != null) {
|
||||||
return m_designTimePluginResourceProvider.getEntry(symbolicName, path);
|
return designTimePluginResourceProvider.getEntry(symbolicName, path);
|
||||||
}
|
}
|
||||||
// no such resource
|
// no such resource
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns an {@link URL} based on a plugin and file path.
|
|
||||||
*
|
|
||||||
* @param plugin the plugin {@link Object} containing the file path.
|
|
||||||
* @param name the file path.
|
|
||||||
* @return the {@link URL} representing the file at the specified path.
|
|
||||||
* @throws Exception
|
|
||||||
*/
|
|
||||||
private static URL getPluginImageURL(Object plugin, String name) throws Exception {
|
|
||||||
// try to work with 'plugin' as with OSGI BundleContext
|
|
||||||
try {
|
|
||||||
Class<?> BundleClass = Class.forName("org.osgi.framework.Bundle"); //$NON-NLS-1$
|
|
||||||
Class<?> BundleContextClass = Class.forName("org.osgi.framework.BundleContext"); //$NON-NLS-1$
|
|
||||||
if (BundleContextClass.isAssignableFrom(plugin.getClass())) {
|
|
||||||
Method getBundleMethod = BundleContextClass.getMethod("getBundle", new Class[0]); //$NON-NLS-1$
|
|
||||||
Object bundle = getBundleMethod.invoke(plugin, new Object[0]);
|
|
||||||
//
|
|
||||||
Class<?> PathClass = Class.forName("org.eclipse.core.runtime.Path"); //$NON-NLS-1$
|
|
||||||
Constructor<?> pathConstructor = PathClass.getConstructor(new Class[] { String.class });
|
|
||||||
Object path = pathConstructor.newInstance(new Object[] { name });
|
|
||||||
//
|
|
||||||
Class<?> IPathClass = Class.forName("org.eclipse.core.runtime.IPath"); //$NON-NLS-1$
|
|
||||||
Class<?> PlatformClass = Class.forName("org.eclipse.core.runtime.Platform"); //$NON-NLS-1$
|
|
||||||
Method findMethod = PlatformClass.getMethod("find", new Class[] { BundleClass, IPathClass }); //$NON-NLS-1$
|
|
||||||
return (URL) findMethod.invoke(null, new Object[] { bundle, path });
|
|
||||||
}
|
|
||||||
} catch (Throwable e) {
|
|
||||||
// Ignore any exceptions
|
|
||||||
}
|
|
||||||
// else work with 'plugin' as with usual Eclipse plugin
|
|
||||||
{
|
|
||||||
Class<?> PluginClass = Class.forName("org.eclipse.core.runtime.Plugin"); //$NON-NLS-1$
|
|
||||||
if (PluginClass.isAssignableFrom(plugin.getClass())) {
|
|
||||||
//
|
|
||||||
Class<?> PathClass = Class.forName("org.eclipse.core.runtime.Path"); //$NON-NLS-1$
|
|
||||||
Constructor<?> pathConstructor = PathClass.getConstructor(new Class[] { String.class });
|
|
||||||
Object path = pathConstructor.newInstance(new Object[] { name });
|
|
||||||
//
|
|
||||||
Class<?> IPathClass = Class.forName("org.eclipse.core.runtime.IPath"); //$NON-NLS-1$
|
|
||||||
Method findMethod = PluginClass.getMethod("find", new Class[] { IPathClass }); //$NON-NLS-1$
|
|
||||||
return (URL) findMethod.invoke(plugin, new Object[] { path });
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////
|
||||||
//
|
//
|
||||||
// General
|
// General
|
||||||
|
|
|
@ -34,7 +34,7 @@
|
||||||
<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-os ${target.os} -ws ${target.ws} -arch ${target.arch} -nl ${target.nl} -consoleLog"/>
|
<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-os ${target.os} -ws ${target.ws} -arch ${target.arch} -nl ${target.nl} -consoleLog"/>
|
||||||
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="com.minres.scviewer.database.test"/>
|
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="com.minres.scviewer.database.test"/>
|
||||||
<stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.pde.ui.workbenchClasspathProvider"/>
|
<stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.pde.ui.workbenchClasspathProvider"/>
|
||||||
<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Xms40m -Xmx512m"/>
|
<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Xms40m -Xmx2G"/>
|
||||||
<stringAttribute key="pde.version" value="3.3"/>
|
<stringAttribute key="pde.version" value="3.3"/>
|
||||||
<stringAttribute key="product" value="com.minres.scviewer.e4.product"/>
|
<stringAttribute key="product" value="com.minres.scviewer.e4.product"/>
|
||||||
<booleanAttribute key="run_in_ui_thread" value="true"/>
|
<booleanAttribute key="run_in_ui_thread" value="true"/>
|
||||||
|
|
|
@ -3,7 +3,7 @@ Bundle-ManifestVersion: 2
|
||||||
Bundle-Name: SCViewer database tests
|
Bundle-Name: SCViewer database tests
|
||||||
Bundle-SymbolicName: com.minres.scviewer.database.test
|
Bundle-SymbolicName: com.minres.scviewer.database.test
|
||||||
Bundle-Version: 1.0.1.qualifier
|
Bundle-Version: 1.0.1.qualifier
|
||||||
Bundle-Vendor: MINRES Technologies GnbH
|
Bundle-Vendor: MINRES Technologies GmbH
|
||||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
|
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
|
||||||
Require-Bundle: org.junit,
|
Require-Bundle: org.junit,
|
||||||
com.minres.scviewer.database,
|
com.minres.scviewer.database,
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2015 MINRES Technologies GmbH and others.
|
* Copyright (c) 2015-2021 MINRES Technologies GmbH and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -71,10 +71,10 @@ public class DatabaseServicesTest {
|
||||||
assertEquals(2, waveformDb.getChildNodes().size());
|
assertEquals(2, waveformDb.getChildNodes().size());
|
||||||
IWaveform bus_data_wave = waves.get(0);
|
IWaveform bus_data_wave = waves.get(0);
|
||||||
Entry<Long, IEvent[]> bus_data_entry = bus_data_wave.getEvents().floorEntry(1400000000L);
|
Entry<Long, IEvent[]> bus_data_entry = bus_data_wave.getEvents().floorEntry(1400000000L);
|
||||||
assertTrue("01111000".equals(bus_data_entry.getValue()[0].toString()));
|
assertEquals("01111000", bus_data_entry.getValue()[0].toString());
|
||||||
IWaveform rw_wave = waves.get(2);
|
IWaveform rw_wave = waves.get(2);
|
||||||
Entry<Long, IEvent[]> rw_entry = rw_wave.getEvents().floorEntry(2360000000L);
|
Entry<Long, IEvent[]> rw_entry = rw_wave.getEvents().floorEntry(2360000000L);
|
||||||
assertTrue("1".equals(rw_entry.getValue()[0].toString()));
|
assertEquals("1", rw_entry.getValue()[0].toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -107,6 +107,16 @@ public class DatabaseServicesTest {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testTxTextLargeFile() throws Exception {
|
||||||
|
File f = new File("inputs/hw_cfg7.txlog").getAbsoluteFile();
|
||||||
|
assertTrue(f.exists());
|
||||||
|
waveformDb.load(f);
|
||||||
|
assertNotNull(waveformDb);
|
||||||
|
// hw_cfg_2_gen.txlog: 7.5s (2G)
|
||||||
|
// hw_cfg7.txlog: 48s(2G)
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testTxTextTruncated() throws Exception {
|
public void testTxTextTruncated() throws Exception {
|
||||||
File f = new File("inputs/my_db_truncated.txlog").getAbsoluteFile();
|
File f = new File("inputs/my_db_truncated.txlog").getAbsoluteFile();
|
||||||
|
|
Loading…
Reference in New Issue