Compare commits

...

626 Commits

Author SHA1 Message Date
97d6062c3f Merge branch 'release/2.19.4' 2024-02-11 12:59:13 +01:00
92428a3859 update version numbers 2024-02-11 12:58:44 +01:00
5f244dc03a fixes an multiple-load issue leading to NPE when adding empty generator
streams
2024-02-11 12:35:10 +01:00
64cc09d207 updates plugin settings to conform with Eclipse 2023-12 2024-02-11 12:34:12 +01:00
7af8b73bdd Merge branch 'release/2.19.3' 2024-01-27 15:11:44 +01:00
61bc407fb3 updates version numbers 2024-01-27 15:05:04 +01:00
f6a3da013e fixes some drawing and state restore issues 2024-01-27 14:58:55 +01:00
c4fafae029 fixes a missing increment statement 2024-01-27 14:57:15 +01:00
819e549d87 Merge branch 'release/2.19.1' 2024-01-24 06:31:00 +01:00
e472a092c3 updates version numbers 2024-01-23 17:51:02 +01:00
523c266e8d fixes locking issue preventing reload 2024-01-23 17:50:43 +01:00
db640808f2 updates packaged java version 2023-09-14 16:29:02 +02:00
09a55f1513 fixes some naming for the update site 2023-08-15 13:44:23 +02:00
088500afff update update site address 2023-08-11 14:02:49 +02:00
917a51ced7 Merge branch 'release/2.19.0' 2023-08-11 13:28:01 +02:00
c27354070c updates version numbers 2023-08-11 13:26:42 +02:00
9ca573efdb Merge branch 'release/2.19' 2023-08-11 13:15:51 +02:00
299c10363a Merge branch 'release/2.19' 2023-08-11 12:35:34 +02:00
36fdc68051 updates version and eclipse rcp version 2023-08-11 12:34:54 +02:00
53576f5e1b fixes load issue when using partial txlog files 2023-08-11 11:40:21 +02:00
abb8b45cd8 changes font handling for MultiBitStencil 2023-06-27 21:20:08 +02:00
e557e2c8d4 Merge branch 'develop' 2023-06-27 19:42:35 +02:00
aaf8a9e5d0 fixes bitvector conversion to hex number 2023-06-27 19:42:06 +02:00
c9a94334c4 fixes packaging to work without JS 2023-06-27 18:49:45 +02:00
8e7e977ac5 Merge branch 'develop' 2023-06-27 17:36:37 +02:00
24a362c277 adds some more test data 2023-06-27 17:33:10 +02:00
aa4659f8ef adds some more cleanup 2023-06-27 17:00:19 +02:00
81f37d4740 puts some cleanup 2023-06-27 16:56:03 +02:00
69c82ac9a8 adds some more test files 2023-06-27 16:29:26 +02:00
95c04c2240 updates images 2023-06-27 16:19:14 +02:00
be87792dad uadds and pdates some graphics and menu items 2023-06-27 16:01:13 +02:00
d1808ec1cf updates README.md 2023-06-27 10:39:36 +02:00
1a86104b19 fixes alignment issue in waveform canvas 2023-03-19 17:09:13 +01:00
dc4798b8ba implements visual improvements 2023-03-19 17:02:00 +01:00
3890a87a8c adds rendering of hierarchy indicator 2023-03-19 11:29:16 +01:00
d657843541 improves bit vector rendering 2023-03-19 11:28:44 +01:00
361a18b38e changes value representation in waves 2023-03-19 11:23:25 +01:00
354c4a4390 fixes signed/unsigned conversion for large integer sizes 2023-03-18 18:29:34 +01:00
65461ccc48 fixes unit test 2023-03-18 12:47:43 +01:00
654cf3f9e5 fixes visual handling of Tx not yet being loaded 2023-03-18 12:20:29 +01:00
6f2f5a388c fixes deferred loading of Tx when being referenced 2023-03-18 12:18:20 +01:00
f9d38b5091 adapts to extended database format 2023-03-18 10:13:10 +01:00
ba83c585f0 fixes missing block increment which prevents loading large dbs 2023-03-18 10:12:27 +01:00
14425b9102 fixes FST timescale calculation 2023-03-15 16:53:40 +01:00
1b7d4c3ed6 fixes FTR to delay tx chunk reading 2023-03-04 15:33:19 +01:00
b391d19303 updates time scale handling 2023-03-04 12:33:22 +01:00
bf38ccd6db updates test cases 2023-03-04 11:54:18 +01:00
567d62cea1 Merge branch 'develop' into feature/waveform_groups 2023-03-01 20:00:41 +01:00
6769513e2d fixes database reopening problem due to locking 2023-03-01 12:53:34 +01:00
f64a1baf02 rename BLANK to EMPY, enhances separator render, fixes menu selection 2023-03-01 09:21:11 +01:00
9be9671d3a adds configurable label to separator 2023-02-28 23:05:39 +01:00
c39ca8884a renames blank to separator 2023-02-28 13:23:42 +01:00
5670977d52 fixes color handling 2023-02-28 12:12:47 +01:00
463dad60b9 fixes color preferences handling 2023-02-28 12:03:34 +01:00
8a54ed3f6c Merge branch 'develop' into feature/waveform_groups 2023-02-28 11:30:12 +01:00
74f30e921f fixes imports 2023-02-28 11:29:28 +01:00
dbae0f1666 Merge branch 'develop' into feature/waveform_groups 2023-02-28 11:27:51 +01:00
52232bb0db adds blank entry for waveform viewer 2023-02-28 11:23:38 +01:00
6dfe6c8e2b adds blank entry for waveform viewer 2023-02-28 07:50:10 +01:00
a18f72c43f updates and cleans messages 2023-02-28 07:22:42 +01:00
ec471348f6 adds binary render option 2023-02-28 07:06:48 +01:00
b268b4b677 updates gitignore 2023-02-27 20:31:22 +01:00
da2cd03606 updates version numbers, fixes missing pom.xml 2023-02-27 20:29:41 +01:00
c45d7b5024 add windows fst library 2023-02-27 19:50:18 +01:00
1efb574a98 fixes missing dispose of resources 2023-02-27 15:56:15 +01:00
0105621be3 adds UI support and fixes a reading issue 2023-02-27 15:16:55 +01:00
e44e4d0a05 adds working FST reader implementation 2023-02-27 13:09:38 +01:00
299f76323f cleans interfaces up 2023-02-27 13:07:10 +01:00
bba4349e1e adds skeleton of FST plugin 2023-02-26 10:53:39 +01:00
85d9c92f21 fixes a tree display issue in transaction details view 2023-02-24 11:28:40 +01:00
cf663bcae5 Merge branch 'release/2.17.3' 2023-02-24 09:15:23 +01:00
2885cb9602 Merge branch 'release/2.17.3' into develop 2023-02-24 09:15:23 +01:00
31e79e453c updates version number 2023-02-24 09:15:10 +01:00
23a2f8d6c8 fixes data type numbering 2023-02-24 08:31:53 +01:00
ceaf52bfa1 fixes some divide by zero exception while drawing 2023-02-23 21:10:57 +01:00
7a98eda464 Merge branch 'release/2.17.2' 2023-02-23 15:51:49 +01:00
c8e587c1ea updates version numbers 2023-02-23 15:50:47 +01:00
d95683a146 fixes FTR reading and makes it more robust 2023-02-23 13:33:32 +01:00
07062d5618 updates target platform to 2022-12 2023-02-22 08:29:50 +01:00
e0b710efc4 sets target execution environment for launch configs 2023-02-22 07:56:28 +01:00
e0f174173c Merge branch 'release/2.17.1' 2023-02-22 07:47:27 +01:00
12a7c701e3 cleans imports and other warnings 2023-02-22 07:45:22 +01:00
cb259503cb Merge branch 'release/2.17.1' into develop 2023-02-22 07:30:43 +01:00
8aca26e499 Merge branch 'release/2.17.1' 2023-02-22 07:30:06 +01:00
ebf3f920bf updates version numbers 2023-02-22 07:29:26 +01:00
3b57ec029b adds support for compressed FTR 2023-02-22 07:24:02 +01:00
01c9b7f1c2 adds support for FTR chunk type 0 2023-02-22 06:14:17 +01:00
a737f5588d fixes entries in product definition 2023-02-21 20:03:59 +01:00
f7f512a5f3 Merge branch 'release/2.17.0' 2023-02-21 19:57:07 +01:00
8f838a96b7 Merge branch 'release/2.17.0' into develop 2023-02-21 19:57:07 +01:00
4d49e3b53f updates version numbers 2023-02-21 19:56:55 +01:00
b809042189 fixes removing traces 2023-02-21 19:24:13 +01:00
0e705ce0e9 adds initial version of FTR reader 2023-02-21 17:59:11 +01:00
25064f9744 externalizes strings 2022-09-30 15:29:16 +02:00
31fd54c6be adds update functionality for SCViewer 2022-09-30 14:23:54 +02:00
Eyck Jentzsch
3a931d59d5 Merge branch 'release/2.16.1' 2022-06-12 20:58:31 +02:00
Eyck Jentzsch
a1094ff870 Merge branch 'release/2.16.1' into develop 2022-06-12 20:58:31 +02:00
Eyck Jentzsch
e53764cd7b update version numbers 2022-06-12 13:10:15 +02:00
Eyck Jentzsch
3f7bdc7e28 simplify and speedup txlog parsing 2022-06-12 11:40:23 +02:00
8d94b517c1 fix file type detection for SCV files 2022-05-17 16:40:56 +02:00
d5e50a06b2 correct used eclipse version in update site generation
Merge branch 'release/2.16.0'
2022-05-16 22:28:00 +02:00
fda4c64ac7 Merge branch 'release/2.16.0' 2022-05-16 21:16:31 +02:00
8dcfc061cb Merge branch 'release/2.16.0' into develop 2022-05-16 21:16:31 +02:00
79a5343cde update version numbers 2022-05-16 21:13:00 +02:00
c9c6db8e4c update target platform to release 21-12 2022-05-16 21:07:32 +02:00
e629bdc5bc add LZ4 (de)compressor to target platform and add as input format 2022-05-16 20:34:23 +02:00
8522627081 align adoc format and fix issues 2022-01-09 14:30:48 +01:00
d7f6d9b879 add second style for documentation 2022-01-09 14:02:05 +01:00
8f48abf0ae cleanup package structure 2022-01-09 13:57:49 +01:00
fbec708522 fix geometry of file browser 2022-01-09 13:54:58 +01:00
5c59fb0676 Merge branch 'feature/integrated_jre' into develop 2022-01-09 13:30:00 +01:00
2a9c5ff6a5 add justj runtime 2022-01-09 13:29:10 +01:00
9fe7a83dfa update target definition to 2021-09 2022-01-09 12:13:01 +01:00
eb4e2301c1 fix minimum required execution environment 2022-01-09 11:59:33 +01:00
a6aa9859ea update maven plugin versions 2022-01-09 11:52:25 +01:00
1866ae17a9 add JavaSE-15 execution environment 2022-01-09 11:12:17 +01:00
6987985e36 fix maven build 2022-01-09 08:57:45 +01:00
f81f84d60e cleanup of settings and add non-linux bundles to help feature 2022-01-09 08:44:59 +01:00
fd8e2ea751 finishing touches on help system 2022-01-08 19:26:22 +01:00
2d11e39653 Merge branch 'feature/custom_scrollbar' into develop 2022-01-08 19:17:15 +01:00
ab419a743f Merge branch 'feature/help_system' into develop 2022-01-08 19:16:15 +01:00
fc64fa781a fix adoc syntax 2022-01-08 18:31:42 +01:00
c474ca33d8 use internal help browser 2022-01-08 18:31:27 +01:00
8119c1a4f3 direct generation of help plugin 2022-01-08 17:36:52 +01:00
5f84194145 first working version of help with dummy input 2022-01-08 17:24:26 +01:00
7dbcffe95d fix layout for auto-hiding scrollbar (e.g. GTK) 2022-01-07 21:25:01 +01:00
20934a9f47 fix behavior of ZoomBar used by WaveformCanvas 2022-01-07 19:42:27 +01:00
24890f9bbb change behavior with a clear distinction
If no modifier key is used the zoombar acts as a scroll bar. If ctrl is
used it modifies the zoom level, shift is a speed modifier
2022-01-06 19:15:31 +01:00
bd0629301b add next increment - basically working 2022-01-06 17:48:40 +01:00
71da420d86 checkpoint development 2022-01-05 21:51:57 +01:00
f9be6758e2 implement scrollbar adapter and first version of zooming scrollbar 2022-01-03 21:46:40 +01:00
93a8c067fc add sliuder variant 2022-01-03 14:15:59 +01:00
5a372d0f90 add first elements 2022-01-02 15:51:52 +01:00
806000c4cc add missing icon 2021-12-14 21:16:11 +01:00
539e5de813 Merge branch 'release/2.15.1' 2021-12-02 16:55:18 +01:00
c32d46cdc0 Merge branch 'release/2.15.1' into develop 2021-12-02 16:55:18 +01:00
5736279e8d update version numbers 2021-12-02 16:55:07 +01:00
e3f4dc6616 fix loading of corrupted uncompressed SCV files 2021-12-02 16:47:12 +01:00
a64e06ff7a Merge branch 'master' into develop 2021-11-28 12:01:29 +01:00
a42b786835 fixe some naming 2021-11-28 11:39:51 +01:00
e76000d87b fix path for gh-pages checkout 2021-11-27 17:16:56 +01:00
60ead71029 Merge branch 'release/2.15.0' into develop 2021-11-27 16:49:01 +01:00
4c48fda5ad Merge branch 'release/2.15.0' 2021-11-27 16:49:01 +01:00
6a591f2dbc add gh-pages deployment steps 2021-11-27 16:48:09 +01:00
86c30ad948 update version numbers 2021-11-27 15:39:07 +01:00
0ae055b486 Merge branch 'feature/continous_zoom' into develop 2021-11-27 15:22:44 +01:00
efcd4f5ab8 update tool bar actions and icons 2021-11-27 15:21:17 +01:00
232d2d4275 move zomm/navigate toolbar to view 2021-11-27 14:31:39 +01:00
44f96e5383 cleanup imports 2021-11-27 14:04:25 +01:00
44812310b0 implement continous zoom and removed zoom level status control 2021-11-27 14:04:06 +01:00
6ef91bb5e7 Merge branch 'release/2.14.2' 2021-11-18 14:31:09 +01:00
aa459b0ea6 Merge branch 'release/2.14.2' into develop 2021-11-18 14:31:09 +01:00
a2adf66618 update version numbers 2021-11-18 14:30:54 +01:00
3405e90df9 fix behavior of help window 2021-11-18 14:24:08 +01:00
9a59947e67 fix handling of key short cuts 2021-11-18 12:55:23 +01:00
9384d3278c remove hierarchy in poms 2021-11-18 08:41:52 +01:00
1af3171b2e cleanup imports 2021-11-16 14:15:33 +01:00
03fd9e154b Merge branch 'master' into develop 2021-11-16 14:13:22 +01:00
3572f683e3 add zoom levels 2021-11-16 14:12:10 +01:00
524ffb189c fix MT race condition 2021-11-16 14:11:30 +01:00
7fac6c8f74 Merge branch 'release/2.14.1' into develop 2021-11-16 11:32:41 +01:00
037c645075 Merge branch 'release/2.14.1' 2021-11-16 11:32:41 +01:00
2f9bd29dc8 update version numbers 2021-11-16 11:32:34 +01:00
92662c546a fix zoom level calculation 2021-11-16 11:28:32 +01:00
efa6544623 cleanup 2021-11-16 11:27:58 +01:00
52cf9daeec unify time printing (#69) 2021-11-16 09:37:50 +01:00
4a315722b1 add help browser window instead of dialog 2021-11-16 09:33:09 +01:00
a52efd1a12 Merge branch 'master' into develop 2021-11-15 22:25:12 +01:00
535df30ada Merge branch 'release/2.14.0' into develop 2021-11-15 21:38:51 +01:00
bad34dd1d1 Merge branch 'release/2.14.0' 2021-11-15 21:38:51 +01:00
5ac7f05f57 Merge branch 'master' of https://git.minres.com/VP-Tools/SCViewer 2021-11-15 21:37:51 +01:00
8353b59a27 update version numbers for release
This release fixes the following tickets:
* #62: Instead of or in addition to the Restore Default Zoom button, add
Full Zoom Out button.
* #64: Load multiple trace files and enable the possibility to view
signals from different files in a single window.
* partial #66: key shortcuts for actions like zoom in/out, go to
next/prev event etc
* #70: add full zoom and zoom between markers (once we had markers)
* #75: marker is often hiding events underneath for highlighting and
getting transaction details
* #82: Implement help for keyboard shortcuts
2021-11-15 21:29:08 +01:00
2c6ca6c376 update version number to 2.14 2021-11-15 21:25:05 +01:00
f4b03cb0e6 extend zoom handling (#70) and hide tx property panes (#58) 2021-11-15 21:23:13 +01:00
c7858997c0 update README.md 2021-11-15 15:18:56 +01:00
bd99ab3992 corrected parent path im poms 2021-11-15 15:14:04 +01:00
66f365d38d externalize string in HelpDialog class 2021-11-15 15:14:04 +01:00
59987f262d update key bindings 2021-11-15 15:14:04 +01:00
452a28362e fix help link 2021-11-15 15:14:04 +01:00
d6805f383b add help dialog 2021-11-15 15:14:04 +01:00
076611eec7 allow multiple loading of same format 2021-11-15 15:14:04 +01:00
e0fa55e2c0 corrected parent path im poms 2021-11-15 14:32:55 +01:00
9ea1994228 update key bindings 2021-11-15 14:16:46 +01:00
36f628c365 add help dialog 2021-11-15 13:07:58 +01:00
ff87e72510 allow multiple loading of same format 2021-11-15 10:52:59 +01:00
aef1e29a53 Merge branch 'release/2.13.2' into develop 2021-07-11 14:22:41 +02:00
1ebf9ba382 update version numbers 2021-07-11 13:47:48 +02:00
929408d08c fix missing gzip txlog file filter in file dialog 2021-07-11 13:47:27 +02:00
f57fb93525 fix reload issues 2021-07-11 13:46:35 +02:00
788065e456 Merge branch 'release/2.13.1' 2021-03-25 21:09:49 +00:00
22b46e0525 fix fit zoom level calculation 2021-03-25 21:07:05 +00:00
b75018239a Merge branch 'master' into develop
Conflicts:
	features/com.minres.scviewer.database.feature/pom.xml
	features/com.minres.scviewer.e4.feature/pom.xml
	features/com.minres.scviewer.e4.platform.feature/pom.xml
	features/com.minres.scviewer.feature/pom.xml
	features/com.minres.scviewer.ui.feature/pom.xml
	plugins/com.minres.scviewer.database.sqlite/pom.xml
	plugins/com.minres.scviewer.database.text/pom.xml
	plugins/com.minres.scviewer.database.ui.swt/pom.xml
	plugins/com.minres.scviewer.database.vcd/pom.xml
	plugins/com.minres.scviewer.database/pom.xml
	plugins/com.minres.scviewer.e4.application/META-INF/MANIFEST.MF
	plugins/com.minres.scviewer.e4.application/pom.xml
	plugins/com.minres.scviewer.ui/pom.xml
	pom.xml
	products/com.minres.scviewer.e4.product/pom.xml
	products/com.minres.scviewer.e4.product/scviewer.product
	releng/com.minres.scviewer.target/pom.xml
	releng/com.minres.scviewer.updateSite/pom.xml
	tests/com.minres.scviewer.database.test/pom.xml
2021-03-25 20:46:30 +00:00
598bb8eec7 Merge remote-tracking branch 'origin/master' 2021-03-25 20:33:25 +00:00
869265fc13 add gzip files to file dialog filter 2021-03-25 20:27:55 +00:00
5ad813527a fix CLI handling 2021-03-25 20:27:55 +00:00
73f8d3d50a fix full name display of generators 2021-03-25 20:27:55 +00:00
da1701195d update version numbers 2021-03-25 20:27:55 +00:00
9b6334509e update version numbers 2021-03-25 20:27:54 +00:00
ac4acc34a4 fix warning and left-overs 2021-03-25 20:27:54 +00:00
b6963f38d6 move interface to primitive types 2021-03-25 20:27:54 +00:00
182a036ade some more refactoring 2021-03-25 20:27:53 +00:00
97f2182290 adapt painter 2021-03-25 20:27:53 +00:00
1986a8c9c3 add explicit event list 2021-03-25 20:27:53 +00:00
6905d96329 add TreeMap facade 2021-03-25 20:27:52 +00:00
818f786b1d add dispose check in case view is closed while loading db 2021-03-25 20:27:52 +00:00
2948c1bd33 update version numbers 2021-03-25 20:22:15 +00:00
78faab404c apply UI fixes
* wrong arrow target of transaction
* wrong zomm factor calculation for zoom fit
* streams and waveforms not visible if at root level
2021-03-25 20:18:50 +00:00
64b10970a8 add gzip files to file dialog filter 2021-03-02 21:55:52 +01:00
6ab8fd232e fix CLI handling 2021-03-02 21:55:52 +01:00
f337a94112 fix full name display of generators 2021-03-02 21:55:52 +01:00
0135631a3e update version numbers 2021-03-02 21:55:52 +01:00
d0e1e8801f update version numbers 2021-03-02 21:55:52 +01:00
d1b3a91979 fix warning and left-overs 2021-03-02 21:55:52 +01:00
45c1396e0e move interface to primitive types 2021-03-02 21:55:51 +01:00
b7301733f0 some more refactoring 2021-03-02 21:55:51 +01:00
5df91dbaa8 adapt painter 2021-03-02 21:55:51 +01:00
68918689e7 add explicit event list 2021-03-02 21:55:51 +01:00
c41dd646da add TreeMap facade 2021-03-02 21:55:51 +01:00
a077389b83 add dispose check in case view is closed while loading db 2021-03-02 21:55:51 +01:00
caa37375c0 add gzip files to file dialog filter 2021-03-02 21:42:54 +01:00
3daea8ab43 fix CLI handling 2021-03-02 19:32:21 +01:00
c5d77af0d0 fix full name display of generators 2021-03-02 19:32:09 +01:00
7f7fdf09f4 update version numbers 2021-02-27 19:13:28 +00:00
7aba6a2ecb update version numbers 2021-02-27 19:13:17 +00:00
012395b933 Merge branch 'feature/eclipse_collections' into develop 2021-02-27 18:47:31 +00:00
787e3accc0 fix warning and left-overs 2021-02-27 14:00:29 +00:00
b778940c83 move interface to primitive types 2021-02-27 13:59:00 +00:00
71297c4e5a some more refactoring 2021-02-27 13:47:37 +00:00
1d2395e00d adapt painter 2021-02-27 13:33:15 +00:00
b69e1886b9 add explicit event list 2021-02-27 13:27:51 +00:00
d65803a4b7 add TreeMap facade 2021-02-26 11:57:54 +00:00
0e49a68e09 add dispose check in case view is closed while loading db 2021-02-24 08:46:19 +00:00
7af5593fd4 Merge branch 'release/2.12.2' into develop 2021-02-24 07:05:00 +00:00
25545dac51 Merge branch 'release/2.12.2' 2021-02-24 07:04:59 +00:00
df77af64ca update version numbers 2021-02-24 07:04:47 +00:00
e264ab2cbe fix name display in waveform view (#6) 2021-02-24 06:56:28 +00:00
8c17ed4146 Merge branch 'release/2.12.1' into develop 2021-02-18 08:19:17 +00:00
4ee2e8bc68 Merge branch 'release/2.12.1' 2021-02-18 08:19:16 +00:00
bdcba613d5 fix version numbers 2021-02-18 08:18:47 +00:00
049de0ddaf add VM arguments for Java > 9 2021-02-18 08:14:12 +00:00
6be3f378d4 renmove deprecated newInstance call 2021-02-18 06:32:14 +00:00
6d8aa33fc9 update language level 2021-02-18 06:26:42 +00:00
b37ba9f2f1 Merge branch 'master' into develop 2021-02-17 21:15:33 +00:00
799f083a74 fix hierarchy display 2021-02-17 21:14:28 +00:00
156abe63cd fix display bug 2021-02-17 20:27:58 +00:00
d38016a03f fix display bug 2021-02-17 20:24:25 +00:00
5604c3ee5e Merge branch 'release/2.12.0' 2021-01-15 16:50:33 +01:00
5adeae15a9 change name of generated product artifacts 2021-01-15 15:52:28 +01:00
bca94ceb9d fix stream row calculation 2021-01-15 15:51:59 +01:00
a42f086339 set max heap to 2GB by default 2021-01-14 23:56:04 +01:00
888edf32be remove ITxGenerator interface 2021-01-14 23:55:47 +01:00
ee5536f1b5 update version numbers 2021-01-14 23:51:18 +01:00
59859e5d90 cache some more infos for stream 2021-01-14 23:36:29 +01:00
5bae086712 fix (Sonarlint) warnings 2021-01-14 23:36:07 +01:00
16de83616a adapt ui to database API 2021-01-14 23:14:22 +01:00
6530362b89 refactor tests 2021-01-14 23:14:05 +01:00
0372e03abb minor database API change 2021-01-14 23:13:11 +01:00
26e8ea8a51 change design browser icons 2021-01-14 21:57:27 +01:00
efd042dd22 fix duplicate version numbers 2021-01-12 20:28:51 +01:00
d06642d51f Merge branch 'release/2.11.2' into develop 2021-01-12 20:25:46 +01:00
f27bcd7109 Merge branch 'release/2.11.2' 2021-01-12 20:25:45 +01:00
eaea5a4653 update version numbers 2021-01-12 20:25:34 +01:00
fa4bd0ddd5 move database to hashmap 2021-01-12 11:46:21 +01:00
3cbbdbee92 reduce default JVM heap size 2021-01-12 11:30:59 +01:00
d674e155e1 fix wrong name extraction 2021-01-12 11:30:37 +01:00
cb3366a559 fix project setup 2021-01-12 07:36:41 +01:00
8de0e11226 Merge branch 'release/2.11.1' 2021-01-12 07:36:02 +01:00
b12232329b Merge branch 'release/2.11.1' into develop 2021-01-12 07:36:02 +01:00
5e63972500 update version numbers 2021-01-12 07:34:36 +01:00
d53db967b3 Merge branch 'hotfix/tx_end_time_fix' into develop 2021-01-12 07:18:25 +01:00
25170d0d83 Merge branch 'hotfix/tx_end_time_fix' 2021-01-12 07:18:24 +01:00
ba6446378a store complete transactions
only complete ScvTx should be put into MapDB otherwise later property
updates might get lost. Since they might not end in the order they start
an additional redirection is need to insert with ascending keys
2021-01-12 07:16:42 +01:00
12b08ca8c6 fix version numbers to adhere to eclipse versioning 2021-01-10 16:26:46 +01:00
bb60f3a9c8 fix bintray repo layout 2021-01-10 15:27:40 +01:00
ba347a258d refactor structure 2021-01-10 14:40:25 +01:00
ac41feff6e cleanup 2021-01-10 14:34:12 +01:00
ec9eb17ee3 Merge branch 'release/2.11.0' 2021-01-10 13:37:39 +01:00
d2cf13d64b Merge branch 'release/2.11.0' into develop 2021-01-10 13:37:39 +01:00
7775f5978b update product version numbers in pom and reduce feature product size 2021-01-10 13:37:16 +01:00
8c031e7649 add maven launch configs 2021-01-10 13:16:28 +01:00
6b2eae7f26 fix repository build and build numbers 2021-01-10 13:09:45 +01:00
69805a423f add bintray upload of update site 2021-01-10 02:16:41 +01:00
f1178157c8 remove left-over test 2021-01-09 23:27:36 +01:00
1ebc6eb03a rename interfaces 2021-01-09 23:25:31 +01:00
916215c0c2 fix sonarlint messages 2021-01-09 23:24:00 +01:00
6c8e149be2 fix unused import 2021-01-09 22:30:20 +01:00
bd08b69747 Merge branch 'feature/dynamic_stream_addition' into develop 2021-01-09 22:28:42 +01:00
33e0061147 update version numbers 2021-01-09 22:27:59 +01:00
45e1031e5e fix Sonarlint warnings 2021-01-09 22:23:38 +01:00
73b21cb80b add dynamic update of waveform list 2021-01-09 20:10:58 +01:00
15fb825548 Merge branch 'feature/generater_as_stream' into develop 2021-01-09 15:43:09 +01:00
0d448368cc fix license statement and Sonarlint 2021-01-09 14:26:49 +01:00
abacae42d7 fix selection handling in viewer and Sonarlint warnings 2021-01-09 13:43:11 +01:00
9d2e2e7f64 show children of streams 2021-01-09 12:56:14 +01:00
eb64cc60c5 fix copyright header, javadoc, and warnings 2021-01-09 12:44:15 +01:00
5ea0d6446a Merge branch 'feature/factor_out_groovy' into develop 2021-01-09 10:36:25 +01:00
d970d07048 make ITxGenerator as stream 2021-01-09 10:34:22 +01:00
90f45c698f fix Sonarlint warnings 2021-01-08 20:50:24 +01:00
af388b2462 add TX attribute value caching 2021-01-08 20:31:24 +01:00
8700e2fdde Improve loading performance 2021-01-08 15:05:24 +01:00
23ad84ef30 pure memory based implementation of text db reader 2021-01-07 17:38:29 +01:00
0d074ea6ae fix track and relation handling 2021-01-04 17:39:11 +01:00
351a246238 separate RelationTypeFactory from RelationType 2021-01-04 17:36:09 +01:00
841b5fe2b2 cleanup build 2021-01-03 17:44:52 +01:00
85ce07f11f refactor internal transaction representation 2021-01-03 14:16:56 +01:00
b44f3418f4 fix max concurrency handling 2021-01-02 18:04:48 +01:00
bfbc40c282 fix serialization issue 2021-01-02 17:02:05 +01:00
2c66bf3edd Merge branch 'feature/database_refactor' into develop 2021-01-02 16:31:33 +01:00
a51f922ea4 refactor groovy classes to Java, 1st step 2021-01-02 16:15:27 +01:00
4d8e7a3cd1 fix CLI invocation (at least on MacOS) 2020-11-29 14:06:33 +01:00
70ccf35fe4 fix sonar lint reported issues in UI plugins 2020-11-29 12:44:28 +01:00
6c5032da10 fix sonarlint issues, add IDerivedWaveform interface 2020-11-29 12:42:26 +01:00
b2e269b67c update version numbers 2020-11-29 09:52:20 +01:00
cd01c6a808 fix layout quirks 2020-11-28 20:53:26 +01:00
179d40ac8d add track height preferences 2020-11-28 20:44:33 +01:00
754a61e989 move color settings into style provider 2020-11-28 20:32:11 +01:00
bedf4c5c4d move settings into style provider 2020-11-28 19:41:00 +01:00
7c27bcec47 moved TX interfaces into own package 2020-11-28 14:47:43 +01:00
90f09cc222 adapt UI 2020-11-28 14:08:34 +01:00
21d83f93dc refactor database class hierarchy 2020-11-28 10:22:22 +01:00
db838efc65 Merge branch 'release/2.10.0' into develop 2020-11-27 09:34:21 +01:00
929af41dd3 Merge branch 'release/2.10.0' 2020-11-27 09:34:20 +01:00
979a7672e6 update version numbers 2020-11-27 09:34:12 +01:00
67818ff4dd Squashed commit of the following:
commit dccd2c524c1c00ab3998546276b7244e6d0f389c
Author: eyck <eyck@minres.com>
Date:   Fri Nov 27 08:52:58 2020 +0100

	re-layout sashes

commit d932367a67e081307c49fd248c54c057357a96d2
Author: eyck <eyck@minres.com>
Date:   Fri Nov 27 08:47:50 2020 +0100

	fix string filter and layout

commit 7f4bf0a64d4d685390e9a7af61f377a512d5332d
Author: eyck <eyck@minres.com>
Date:   Fri Nov 27 08:46:30 2020 +0100

	set single clock selection

commit 972e3ce9267c9cd2b9437e5f7403b3ff69d2928f
Author: eyck <eyck@minres.com>
Date:   Fri Nov 27 08:45:49 2020 +0100

	apply filter only to attributes

commit 13a25692bd7909bad98169648edabd01872a7ecb
Author: eyck <eyck@minres.com>
Date:   Fri Nov 27 08:45:22 2020 +0100

	re-layout elements
2020-11-27 08:53:34 +01:00
0c7631e912 Merge branch 'release/2.9.3' 2020-11-24 16:20:18 +01:00
a06b888365 Merge branch 'release/2.9.3' into develop 2020-11-24 16:20:18 +01:00
ded10e1c22 fix some bugs
* NPE when stream contains no transactions and hence no attributes
* changed sash hierarchy in waveform pane
2020-11-24 16:20:08 +01:00
2f3bc0d892 Merge branch 'release/2.9.2' into develop 2020-11-11 18:00:59 +01:00
184f1b2d2c Merge branch 'release/2.9.2' 2020-11-11 18:00:58 +01:00
90249dadb9 replace TreeViewer with TableViewer in TransactionList 2020-11-11 17:55:10 +01:00
c88eb32db8 Merge branch 'release/2.9.1' into develop 2020-11-11 07:25:06 +01:00
d47db29b93 Merge branch 'release/2.9.1' 2020-11-11 07:25:05 +01:00
e8148af10f update version numbers 2020-11-11 07:24:54 +01:00
b298a4ca6c fix TX search list implementation 2020-11-10 21:02:34 +01:00
f474e38687 add type for TransactionTreeNode 2020-11-04 08:50:04 +01:00
2e806f7b86 Merge branch 'release/2.9.0' into develop 2020-11-01 18:29:44 +01:00
b7a8d99e2d Merge branch 'release/2.9.0' 2020-11-01 18:29:43 +01:00
2a09fc7e6f update version numbers 2020-11-01 18:29:29 +01:00
e36abb8d55 Merge branch 'feature/tx_search' into develop 2020-11-01 18:18:21 +01:00
5746b9f758 add initial version of search list 2020-11-01 17:42:16 +01:00
6be1f018b1 add search dialog and pane 2020-10-29 07:48:35 +01:00
38a046aaef Merge branch 'release/2.8.1' into develop 2020-10-28 14:19:51 +01:00
fdbd6f8402 Merge branch 'release/2.8.1' 2020-10-28 14:19:50 +01:00
1dad204494 update release numbers 2020-10-28 14:19:25 +01:00
54661c51ce Merge branch 'release/2.8.1' 2020-10-28 14:16:13 +01:00
b34fe0d0ba add reload menu and toolbar item 2020-10-28 13:33:07 +01:00
868eceddc5 fix CLI handling 2020-10-28 13:33:06 +01:00
b642c396c7 add reload menu and toolbar item 2020-10-28 13:32:17 +01:00
f3d8e34ed0 fix CLI handling 2020-10-27 18:11:03 +01:00
401c760e01 Merge branch 'release/2.8' into develop 2020-10-19 07:09:27 +02:00
5add0e385d Merge branch 'release/2.8' 2020-10-19 07:09:27 +02:00
2ba6822f2b update version numbers 2020-10-19 07:09:11 +02:00
54124d13bf fix trace add problem when only a track is selected 2020-10-19 07:09:00 +02:00
5b949a9d37 fix packaging name 2020-10-18 17:48:26 +02:00
9a9b25622c fix arrow painter if stream is moved 2020-10-17 13:54:34 +02:00
dd6a8669b1 fix arrow paint error 2020-10-17 13:13:34 +02:00
b483897769 Merge branch 'feature/unified_window' into develop 2020-10-17 12:46:19 +02:00
bd24c4dd05 update JDT/Groovy settings 2020-10-17 12:44:55 +02:00
664e99d09e re-organize layout and fix drawing errors 2020-10-17 12:44:33 +02:00
675b2ed972 Merge branch 'develop' into feature/unified_window 2020-10-04 18:33:37 +02:00
e6f19311b1 re-arrange directory structure 2020-10-04 18:30:18 +02:00
4a8034191c Merge branch 'develop' 2020-10-04 18:13:36 +02:00
9d4e5bf636 fix product setup 2020-10-04 18:12:50 +02:00
cc9be70708 refactor to integrate design browser 2020-10-04 16:20:16 +02:00
2dcc72f679 Merge branch 'release/2.7.1' 2020-07-26 15:27:31 +02:00
563b6e2b01 Merge branch 'release/2.7.1' into develop 2020-07-26 15:27:31 +02:00
6161c0e0ec update version numbers 2020-07-26 15:16:55 +02:00
61c2102ab7 fix ITx selection issue 2020-07-26 15:07:55 +02:00
796a04b981 fix tree node issue 2020-07-26 14:57:09 +02:00
2a71ab94f5 add plugin based product 2020-07-26 14:41:36 +02:00
923b89c038 add eclipse IDE compatibility fix 2020-07-22 21:15:50 +02:00
3de6c9900c Merge branch 'release/2.7.0' 2020-07-15 22:08:05 +02:00
ef1f2a758a fix wrongly shown signals and streams in table 2020-07-15 21:58:49 +02:00
3e6d5bd33e update version numbers 2020-07-15 21:48:41 +02:00
26968b8521 add multi-selection in waveform viewer 2020-07-15 21:43:07 +02:00
611cfc7b46 change package structure 2020-07-15 21:42:10 +02:00
8cb77a555b refactor plugin structures 2020-07-15 21:39:30 +02:00
b4a7f032f5 update versions 2020-07-11 21:05:04 +02:00
62e0ec2008 Merge branch 'release/v2.6.2' 2020-07-11 19:57:17 +02:00
f6cc12e8c3 fix analog painting calculation issue 2020-07-11 19:36:45 +02:00
b38b268fcb refactor class names 2020-07-11 19:36:28 +02:00
55a14edc9d improve preferences handling and textual representation 2020-06-21 17:06:18 +02:00
45c23564b5 Merge branch 'release/2.6.1' 2020-06-21 16:04:29 +02:00
b170fb3c2a Merge branch 'release/2.6.1' into develop 2020-06-21 16:04:29 +02:00
ab975eadd1 udate version numbers 2020-06-21 16:04:22 +02:00
7ad70411f3 fix preference handling 2020-06-21 15:37:38 +02:00
24720340be update feature definition 2020-06-21 12:23:34 +02:00
ad51066f1c add tycho settings 2020-06-21 09:25:24 +02:00
95e2db60b6 cleanup build and imports 2020-06-20 18:04:57 +02:00
db1d377da6 fix redraw issues 2020-06-20 17:58:26 +02:00
230e8dcc7a update status bar handling 2020-06-14 21:59:42 +02:00
ab2146102f fix startup 2020-06-14 15:27:27 +02:00
b1148922d8 implement feature-based product definition 2020-06-11 14:34:14 +02:00
e4de765da9 Merge branch 'develop' 2020-06-11 11:04:08 +02:00
47120c66b7 Merge branch 'feature/feature_base_product' into develop 2020-06-11 10:53:51 +02:00
35ccc71f10 fix TransactionDetails handling of attributes 2020-06-11 10:51:59 +02:00
688a6abd99 add set of features 2020-06-11 10:49:34 +02:00
97693cd0c4 [WIP ]reorganized dir structure 2020-06-01 22:01:00 +02:00
3e5ab7b0ac cleanup use of org.equinox.ds 2020-06-01 12:39:20 +02:00
ad80671dd2 fxi start issues 2020-06-01 12:38:51 +02:00
4ab3000b69 fix left-overs 2020-06-01 12:06:33 +02:00
572e999a5b remove version constraint on groovy bundle 2020-06-01 11:10:07 +02:00
e5bcb25d24 update RCP to 2019-12 2020-05-09 14:20:29 +02:00
19ea1f0b6d fix #33 2020-05-09 12:52:48 +02:00
e88014ebba fix reference to org.eclipse.equinox.util 2020-05-09 12:52:48 +02:00
10a0608fd3 Revert "update to Eclipse 2020-03 RCP base"
This reverts commit 077a6f801127e8f6704b59b7a504bfc58b1a6fd7.
2020-05-09 12:52:47 +02:00
60abfb7afd update to Eclipse 2020-03 RCP base 2020-05-09 12:52:47 +02:00
6b9e3c0e70 add performance improvement fixes 2020-05-09 12:52:47 +02:00
19065cdbb7 remove fixed color assignment 2020-05-09 12:52:46 +02:00
a7afeb1f7c change database interface 2020-05-09 12:52:44 +02:00
150c404cdb fix #33 2020-05-09 12:50:28 +02:00
5fe8b261ec fix reference to org.eclipse.equinox.util 2020-05-08 13:22:14 +02:00
f8a177c9e0 Revert "update to Eclipse 2020-03 RCP base"
This reverts commit 077a6f801127e8f6704b59b7a504bfc58b1a6fd7.
2020-05-08 10:39:43 +02:00
077a6f8011 update to Eclipse 2020-03 RCP base 2020-05-08 09:53:36 +02:00
8b84f1341b add performance improvement fixes 2020-05-08 08:38:43 +02:00
20824e75c1 remove fixed color assignment 2020-04-02 14:17:44 +02:00
fb283ab668 change database interface 2020-04-02 14:17:44 +02:00
dc3df60716 Merge branch 'release/2.5' into develop 2020-03-30 11:36:07 +02:00
47b58ed770 Merge branch 'release/2.5' 2020-03-30 11:36:06 +02:00
1cebc2da0a update version numbers 2020-03-30 11:34:26 +02:00
414030cbd2 fix behavior of FileBrowserDialog 2020-03-30 11:31:51 +02:00
8011585113 add globbing selection and tool bar to file dialog 2020-03-29 17:16:14 +02:00
270a004037 fix file detection 2020-03-29 16:10:36 +02:00
2aa4160400 Initial version of custom file selection dialog 2020-03-29 16:05:48 +02:00
c8e416966b Merge branch 'release/2.4.2' into develop 2020-03-27 20:05:55 +01:00
20cb208719 Merge branch 'release/2.4.2' 2020-03-27 20:05:54 +01:00
e30aff82ee set version numbers 2020-03-27 20:05:46 +01:00
ad2937c332 Merge branch 'master' into develop
Conflicts:
	com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/parts/WaveformViewer.java
	com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/preferences/DefaultValuesInitializer.java
	com.opcoach.e4.preferences/src/com/opcoach/e4/preferences/internal/E4PreferenceRegistry.java
2020-03-25 23:20:15 +01:00
0e8a757d6e fix settings handling
for this a common workspace is being created. To allow for multiple
instances the work space is being unlocked as soon as the application is
initialized
2020-03-25 23:01:28 +01:00
220eaea73c move to opcoach repository at https://www.opcoach.com/repository/2018-12 2020-03-25 22:52:39 +01:00
24d6085ded update version
this release contains for #31 and #14
2020-03-24 08:09:52 +00:00
8a66734279 fix #32 2020-03-24 08:09:52 +00:00
f6e2224651 fix preferences storage 2020-03-24 08:09:52 +00:00
5d85c12bb8 Merge branch 'release/2.4.1' into develop 2020-03-24 08:06:10 +00:00
2b1cb7856f update version
this release contains for #31 and #14
2020-03-24 08:05:55 +00:00
f1d080983a fix #32 2020-03-24 06:43:10 +00:00
767b083a22 fix preferences storage 2020-03-21 15:17:34 +01:00
348ffe20d6 Merge branch 'release/2.4.0' into develop 2020-03-21 11:35:52 +01:00
f3494e7562 Merge branch 'release/2.4.0' 2020-03-21 11:35:51 +01:00
9b6908f193 update product version and removed leveldb 2020-03-21 11:35:29 +01:00
0cfcc8c118 fix identification of SQLite file 2020-03-21 11:31:59 +01:00
ec5cd209c6 Merge branch 'feature/add_hover_to_transaction' into develop 2020-03-21 11:31:16 +01:00
5933bcd512 configure the hover visibility from UI 2020-03-21 11:30:30 +01:00
14ac6654b9 refactor ToolTipHandler to allow more control over content 2020-03-21 08:42:35 +01:00
cea11743eb clean up of ToolTip handler 2020-03-21 07:31:14 +01:00
210d925987 add initial implementation of TX hover 2020-03-21 06:28:28 +01:00
ffbffd88f1 fix typos 2020-03-17 13:42:18 +01:00
ec8d54dca3 add multi file feature 2020-03-17 12:54:38 +01:00
e8682e446b Merge branch 'release/2.2.0' 2020-03-14 15:56:36 +01:00
e87e1791c3 fix drag-zoom visual 2020-03-14 15:31:51 +01:00
f5a4e3c39e cleanup of code 2020-03-13 22:26:53 +01:00
306e20d14f fix compiler warnings 2020-03-13 22:25:42 +01:00
c76805d133 Merge branch 'release/2.2.0' into develop 2020-03-13 22:12:10 +01:00
8ebb2dc3a6 Merge branch 'release/2.2.0' 2020-03-13 22:12:09 +01:00
669fd6a881 update version numbers 2020-03-13 22:11:39 +01:00
8e66e5fe0b add a select-all key stroke to design browsers stream table 2020-03-13 22:06:55 +01:00
674aa7d3ce add initial version of drag-zoom 2020-03-13 21:06:53 +01:00
2b7c9a240f add drag area to wavefrom view 2020-03-13 19:52:55 +01:00
18f2a110f0 add shortcuts for zoom 2020-03-13 18:51:35 +01:00
27f1e8ca6a Merge branch 'hotfix/#28_add_filter' 2020-03-13 16:03:22 +01:00
3565a6a05b Merge branch 'hotfix/#28_add_filter' into develop 2020-03-13 16:03:22 +01:00
aef4901b2b bug fix for #28
the filter for the treeviewer did not work properly and needed to be
re-implemented
2020-03-13 16:03:16 +01:00
d77aaa3865 Merge branch 'hotfix/#29_cannot_delete_signals' into develop 2020-03-13 16:01:30 +01:00
b398a07fd7 Merge branch 'hotfix/#29_cannot_delete_signals' 2020-03-13 16:01:29 +01:00
732bd82034 fix #29 cannot delete VCD signals
comparison of objects were done by idendity not .equals()
2020-03-13 16:01:16 +01:00
2ccc5274aa Merge branch 'hotfix/#27_add_filter' into develop 2020-03-12 21:59:01 +01:00
9f4f71046d Merge branch 'hotfix/#27_add_filter' 2020-03-12 21:59:01 +01:00
d73b01f77d fix #27 'Add filter to hierarchy viewer' 2020-03-12 18:17:47 +01:00
77302521b2 add another fix for #27 'parser doesn't handle truncated input files' 2020-03-11 23:11:42 +01:00
f89471e14b Merge branch 'release/2.1.6' 2020-03-11 07:51:54 +01:00
0634556256 Merge branch 'release/2.1.6' into develop 2020-03-11 07:51:54 +01:00
4f097e7f59 update version numbers 2020-03-11 07:51:09 +01:00
f1abc645c3 Merge branch 'hotfix/#27_truncated_input' 2020-03-11 07:37:21 +01:00
2c8b7129e9 add fix for #27 'parser doesn't handle truncated input files' 2020-03-11 07:37:14 +01:00
2f81529f93 Merge branch 'hotfix/#26_incomplete_regex_throws_exception' into develop 2020-03-11 07:35:43 +01:00
8f76d816f1 Merge branch 'hotfix/#26_incomplete_regex_throws_exception' 2020-03-11 07:35:42 +01:00
594a71a9ba add try-catch to filter application 2020-03-11 07:35:31 +01:00
0fa0d4a5b8 Merge branch 'hotfix/#27_truncated_input' into develop 2020-03-11 07:27:16 +01:00
97443c6cd8 Merge branch 'release/2.1.4' 2020-03-09 18:02:19 +01:00
c3486eb6c8 Updated version numbers 2020-03-09 18:00:15 +01:00
8a286a8eac Merge branch 'release/2.1.4' 2020-03-09 17:58:47 +01:00
e4329213fa Fixed missing version number 2020-03-09 17:55:50 +01:00
857bbe17d7 Merge branch 'release/2.1.3' 2020-03-09 17:55:05 +01:00
091cb1cf7f Fixed missing version number 2020-03-09 17:53:35 +01:00
Brita Keller
0623b8de4a Fixed #25 - TransactionDetails vanish when setting filter for streamlist 2020-02-28 21:19:40 +01:00
Brita Keller
8b55548cca Fixed #16 - Setting and deleting filter removes properties 2020-02-17 19:43:27 +01:00
a0a4ea1f53 Merge branch 'release/2.1.3'
Conflicts:
	com.minres.scviewer.e4.application/META-INF/MANIFEST.MF
2020-02-10 07:04:54 +01:00
e034d1faad Updated version numbers 2020-02-10 07:03:24 +01:00
68660d0892 Merge branch 'release/2.1.2' 2020-02-10 06:50:07 +01:00
a0f0b55045 Updated application bundle version number 2020-02-10 06:46:55 +01:00
3d20b6961e Updated groovy compiler level 2020-02-10 02:25:40 +01:00
Brita Keller
ca02c92a18 Fixed #23 - Fix sync of properties 2020-02-03 21:30:44 +01:00
347dbf134b removed javax.xml.bind dependency 2020-01-28 23:23:15 +01:00
Brita Keller
44ac32359f Fixed #19 - Fixed sync of streamlist 2020-01-27 20:37:53 +01:00
48c7d81b8a Merge branch 'develop' of VP-Tools/SCViewer into master 2020-01-13 12:26:56 +00:00
e945a3acbe Fixed NP and updated build infrastructure and target platform 2020-01-13 12:26:56 +00:00
145dfbd74d Fixed NP and updated build infrastructure and target platform 2020-01-13 12:26:56 +00:00
b7646dc29e Extended data type for text database 2020-01-13 12:26:56 +00:00
Brita Keller
475181c8df Fixed #21 - IllegalStateException when closing SCViewer 2020-01-13 12:26:56 +00:00
Brita Keller
3d043ce1b7 Fixed #20 - NPE gets caught when opening a damaged file and info popup
is shown
2020-01-13 12:26:56 +00:00
Brita Keller
7e2869b7ee Fixed # 18 - Fixed tree view and stream list after last tab is closed 2020-01-13 12:26:56 +00:00
51d9d7e25c Fixed NP and updated build infrastructure and target platform 2020-01-13 13:17:27 +01:00
ed665ac032 Fixed NP and updated build infrastructure and target platform 2020-01-13 13:14:34 +01:00
689d7874f4 Extended data type for text database 2020-01-07 12:43:39 +01:00
Brita Keller
c7c1f97b0c Fixed #21 - IllegalStateException when closing SCViewer 2019-12-18 17:16:20 +01:00
Brita Keller
7b2db09585 Fixed #20 - NPE gets caught when opening a damaged file and info popup
is shown
2019-12-03 22:19:56 +01:00
Brita Keller
52f3f7b348 Fixed # 18 - Fixed tree view and stream list after last tab is closed 2019-11-25 17:46:28 +01:00
429ea37080 Merge branch 'release/2.1.2' 2019-09-11 13:08:52 +02:00
04f011e82f Fixed array out of bounds error 2019-09-11 13:05:26 +02:00
Brita Keller
3a6ed3ce7e Fixed 'Save Settings' #4 2019-09-04 20:50:34 +02:00
79eb8073d8 Merge branch 'release/2.1.1' 2019-07-08 18:44:47 +02:00
4ea841cc7b Fixed Part Stack issue and updated About Dialog 2019-07-08 18:38:53 +02:00
6bf642d2af Merge branch 'release/2.1.0' 2019-06-30 11:54:10 +02:00
Brita Keller
15c24f0925 Fixed #15 - no more ArrayOutOfBounds exception when deleting last stream 2019-06-25 22:21:10 +02:00
Brita Keller
4d4a6579c6 Fixed #13 - added transaction colors 2019-06-09 21:49:45 +02:00
b648dccfd8 Fixed NPE in case of detached waveform 2019-04-11 06:24:47 +00:00
f9425834a3 Merge branch 'develop' of https://eyck@git.minres.com/VP/SCViewer.git into develop 2019-04-11 06:09:46 +00:00
e0d00e6402 Settings update 2019-04-11 06:09:35 +00:00
b1b7517759 Merge branch 'release/2.0.5' into develop 2019-03-19 19:15:28 +01:00
a5b9c28007 Merge branch 'release/2.0.5' 2019-03-19 19:15:27 +01:00
b5e408595b Updated version numbers 2019-03-19 19:14:39 +01:00
f15930682e Merge branch 'develop' of https://git.minres.com/VP/SCViewer.git into develop 2019-03-19 18:46:56 +01:00
Brita Keller
f8765518bc Fixed #10 -all status bar parts now visible after starting program 2019-03-18 17:17:18 +01:00
Brita Keller
73e952faea Fixed #11 - No more display problems in waveforms when zooming in and
scrolling
2019-03-18 17:17:17 +01:00
111383bcba Merge branch 'release/2.0.4' into develop 2019-03-15 08:53:16 +01:00
244f005ae6 Merge branch 'release/2.0.4' 2019-03-15 08:53:15 +01:00
701733e69d Updated version numbers and display in about dialog 2019-03-15 08:50:12 +01:00
6b4a9c1e14 Fixed handling of TransactionDetails view state 2019-03-15 07:31:13 +00:00
3abbc3e0e2 Merge branch 'master' into develop 2019-03-14 21:29:23 +01:00
2a7b713ef2 Merge branch 'release/2.0.3' 2019-03-14 21:26:55 +01:00
593571ce10 Merge branch 'hotfix/selction_bug' into develop 2019-03-14 21:23:59 +01:00
979261432a Merge branch 'hotfix/selction_bug' 2019-03-14 21:23:58 +01:00
e25f56a8a9 Fixed NPE 2019-03-14 21:23:39 +01:00
e8788e6ce0 Merge branch 'master' into develop 2019-03-14 21:14:26 +01:00
8a8691a889 Merge branch 'release/2.0.2' 2019-03-14 21:11:51 +01:00
de15b84bef Merge branch 'feature/keep_properties_scroll' into develop 2019-03-14 20:51:31 +01:00
b78d8bea45 Fixed format detection bug and adapted VCD loader to Arteris specifics 2019-03-14 20:51:02 +01:00
a49842a119 Added logic to keep the same element revealed in transaction details
view
2019-03-14 19:28:38 +01:00
dbe5d603ed Fixed EOFException so that partial gzip files get loaded 2019-03-14 19:27:58 +01:00
cde1835c74 Merge branch 'develop' of https://eyck@git.minres.com/VP/SCViewer.git into develop 2018-11-06 12:36:40 +01:00
b332eca891 Fixed about dialog handling 2018-11-06 12:36:25 +01:00
75efd69b77 Merge branch 'master' of https://github.com/Minres/SCViewer 2018-11-06 12:33:34 +01:00
960610bab2 Fixed about dialog handling 2018-11-06 12:28:45 +01:00
98029f8c7a Merge branch 'master' of https://eyck@git.minres.com/VP/SCViewer.git 2018-11-06 12:08:42 +01:00
9c09cf5f40 Merge branch 'release/2.0.0' into develop 2018-11-06 12:07:37 +01:00
113d65cfc4 Merge branch 'release/2.0.0' 2018-11-06 12:07:35 +01:00
22e7bb04f0 Updated documentation 2018-11-06 12:07:23 +01:00
d8c5b7d9c3 Merge branch 'develop' of https://git.minres.com/VP/SCViewer into
develop

# Conflicts:
#	com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/parts/WaveformViewer.java
2018-11-06 08:35:00 +01:00
2e7ae5309f Merge branch 'feature/MapDB-backing' into develop 2018-11-06 08:32:12 +01:00
f81e830e93 Updated UI to reflect database changes esp. in VCD 2018-11-06 08:26:39 +01:00
47a285bf6d Added MapDB backing store for Text based Transactions, cleanup of
imports etc.
2018-11-06 08:24:26 +01:00
c080773878 Removed jdbm files and added MapDB 3.0.7 jar files 2018-11-05 18:33:51 +01:00
bcf4e1a274 Adapted application to data model changes 2018-11-05 18:23:17 +01:00
93fd192782 Refactored database data model to improve speed and reduce memory
consumption
2018-11-05 18:22:28 +01:00
e687eef42c Fixed Tx properties 2018-11-05 18:16:59 +01:00
2a709113fe Uodated tests to run on LevelDB backed transaction db 2018-11-03 17:49:40 +01:00
8d7acdb9cb Added LevelDB transaction db reader 2018-11-03 17:48:36 +01:00
77684d828c Merge branch 'master' of https://git.minres.com/VP/SCViewer 2018-10-15 22:31:22 +02:00
9f902057ba Merge branch 'release/2.0.1' 2018-10-15 22:30:02 +02:00
42660c7a2e Fixed some warnings 2018-10-15 22:01:44 +02:00
97a806f9d9 Changed selection handling and fixed keycode handling 2018-10-15 21:55:35 +02:00
60185fbaee Version inconsitency fixes 2018-10-15 10:09:51 +02:00
5411a405d4 Merge branch 'master' of https://github.com/Minres/SCViewer 2018-10-15 09:32:43 +02:00
694dad1cf5 Merge branch 'develop' 2018-10-15 09:17:44 +02:00
5fb9a7dcdf Merge branch 'master' of https://git.minres.com/VP/SCViewer 2018-10-15 09:15:04 +02:00
3faa7205ae Merge branch 'release/2.0' into develop 2018-10-15 09:13:55 +02:00
3cbe5d56d9 Merge branch 'release/2.0' 2018-10-15 09:13:54 +02:00
5745ab4f2c Fixed cli options and NaN handling in VCD loader 2018-10-15 09:13:41 +02:00
4a17108ccc Moved commonly used constants to own class 2018-10-15 09:10:10 +02:00
408138c27c Merge branch 'develop' of https://git.minres.com/VP/SCViewer into develop 2018-10-15 07:50:31 +02:00
3211db8743 Merge branch 'release/2.0' 2018-10-14 21:29:23 +02:00
0c81988d8c Merge branch 'release/2.0' into develop 2018-10-14 21:29:23 +02:00
0107c423a3 Fixed warnings in Java files and MANIFESTS.MF, updated version numbers 2018-10-14 21:29:09 +02:00
5d41816eb6 Merge branch 'feature/add-keyboard-navigation' into develop 2018-10-14 20:44:41 +02:00
e41b7e25ed Updated reading/writing of scview files, added command line argument to
load config file
2018-10-14 20:44:17 +02:00
dba8b2731d Added keyboard navigation to scroll, move selection, move selected and
zoom
2018-10-14 17:30:37 +02:00
048fa93b53 Merge branch 'feature/Extend-waveform-configurability' into develop 2018-10-14 08:59:37 +02:00
6cc5597c25 Added handler and configurability of wavefrom view 2018-10-14 08:59:17 +02:00
694423be3b [WIP] extended application to configure waveform display 2018-10-11 15:23:07 +02:00
0634b9cfd5 Merge branch 'develop' of https://git.minres.com/VP/SCViewer.git into
develop

Conflicts:
	com.minres.scviewer.database.test/inputs/simple_system.vcd
	com.minres.scviewer.database.test/src/com/minres/scviewer/database/test/DatabaseServicesTest.java
	com.minres.scviewer.database.text/.settings/org.eclipse.jdt.groovy.core.prefs
	com.minres.scviewer.database.ui.swt/src/com/minres/scviewer/database/swt/internal/SignalPainter.java
	com.minres.scviewer.database.ui.swt/src/com/minres/scviewer/database/swt/internal/WaveformCanvas.java
	com.minres.scviewer.database.ui.swt/src/com/minres/scviewer/database/swt/internal/WaveformViewer.java
	com.minres.scviewer.database.ui/src/com/minres/scviewer/database/ui/WaveformColors.java
	com.minres.scviewer.database.vcd/src/com/minres/scviewer/database/vcd/VCDDbLoader.java
	com.minres.scviewer.database.vcd/src/com/minres/scviewer/database/vcd/VCDFileParser.java
	com.minres.scviewer.e4.application/plugin.xml
	com.minres.scviewer.e4.product/scviewer.product
	com.minres.scviewer.target/neon.target
	com.minres.scviewer.target/photon.target
	com.minres.scviewer.ui/.settings/org.eclipse.jdt.groovy.core.prefs
2018-10-11 15:22:10 +02:00
c4b16338a8 Merge branch 'feature/real_signal_support' into develop 2018-10-11 14:53:07 +02:00
bda2a84532 Fixed #6 Implement right-click menue for signal names 2018-10-11 14:48:36 +02:00
9d4c951e7f Added support for real valued signals in waveform UI 2018-10-11 14:44:41 +02:00
8a89b21d34 Added database support to read real valued signals 2018-10-11 11:23:28 +02:00
e02df858fa Merge branch 'develop' of https://git.minres.com/VP/SCViewer into develop 2018-09-26 21:25:23 +02:00
0fbe22e2e0 Fixed NPE when concurrencyLevel is 0 2018-09-26 21:25:02 +02:00
Brita Keller
021c2bceff Fixed ZoomFit and encoding issue 2018-09-17 17:06:57 +02:00
Brita Keller
9862c14040 Additional files missing in the last commit 2018-09-17 16:38:27 +02:00
Brita Keller
23131e7527 Fixed ZoomFit 2018-09-17 16:38:26 +02:00
0833bca1bd Fixed VCD parsing error 2018-09-17 16:38:25 +02:00
1cf00ec882 Updated to Photon platform 2018-09-17 16:38:24 +02:00
6c0bbd5f1f Added hierarchical VCD File 2018-09-17 16:32:07 +02:00
Eyck Jentzsch
f13b091664 Update README.md 2018-09-17 16:26:49 +02:00
dff41eceb2 Updated version numbers 2018-09-17 16:26:49 +02:00
d267e64907 Fixed parsing bug 2018-09-17 16:26:49 +02:00
792dcd55f3 Fixed rendering of integral transaction attributes and updated version
numbers
2018-09-17 16:26:48 +02:00
2b33ea0c85 Fixed drawing issue for very long transactions 2018-08-27 23:46:06 +02:00
f69a6f2e89 Removed jdbm 2018-08-27 23:16:54 +02:00
0f133a3df6 Added UI support for real value signals 2018-08-27 23:13:19 +02:00
549c522bf7 Added support for real value signals 2018-08-27 16:19:59 +02:00
2f11d8ed7b Fixed VCD parsing error 2018-07-16 13:17:58 +02:00
7dd0a24df6 Updated to Photon platform 2018-07-16 13:17:43 +02:00
a052fe2324 Added hierarchical VCD File 2018-07-14 11:42:55 +02:00
4fc24453ae Merge branch 'develop'
* develop:
  Update README.md
2018-04-05 23:10:31 +02:00
Eyck Jentzsch
b468fba441 Update README.md 2018-04-05 23:04:12 +02:00
Eyck Jentzsch
f80021059e
Update README.md 2017-11-01 19:02:01 +01:00
Eyck Jentzsch
7c0822b4d2 Merge pull request #4 from Minres/develop
Develop
2017-10-14 19:06:53 +00:00
cdde384ed3 Updated version numbers 2017-10-14 20:59:30 +02:00
fce1bdb1e7 Fixed parsing bug 2017-10-14 20:46:22 +02:00
Eyck Jentzsch
b68a7d3259 Merge pull request #3 from Minres/develop
Changes for 1.2.1 version
2017-10-13 08:03:11 +00:00
44b13c105d Fixed rendering of integral transaction attributes and updated version
numbers
2017-10-13 09:36:44 +02:00
ed0558afdf Fixed compiler warnings and moved execution environment to Java 1.8 2017-01-23 23:25:28 +01:00
d0be3b0ca2 Externalized strings 2017-01-23 23:07:29 +01:00
a052c6aa3b Enabled test 2017-01-23 22:26:05 +01:00
8a30ba8dea Fixed target platform setting for tests 2017-01-23 22:18:59 +01:00
Eyck Jentzsch
0a7972c54d Merge pull request #2 from Minres/develop
Merge in latest changes
2017-01-23 20:44:18 +00:00
b1890eb5e1 Updated License information and fixed pom warning 2017-01-23 21:41:48 +01:00
1aaf5c837e Added support for gzipped txlog files and org.apache.jdbm as backing
store
2017-01-23 21:23:43 +01:00
c8a213e985 Fixed windows icons, adjusted version numbers 2017-01-22 15:14:03 +01:00
5f82700290 Updated to Neon platform 2017-01-22 14:05:42 +01:00
40a0137dfd Fixed compile warnings and performance bottlenecks in drawing 2017-01-22 10:28:49 +01:00
Eyck Jentzsch
4ec9a928b9 Merge pull request #1 from Minres/master
Create LICENSE
2016-12-15 13:16:50 +01:00
Eyck Jentzsch
c82c41bbf0 Create LICENSE 2016-10-20 07:08:35 +02:00
79c49e6f1d Removed SCV code 2016-10-08 21:53:07 +02:00
96d628d322 Updated version numbers 2015-12-02 20:35:03 +01:00
b4d81d96b8 Cleanup of project structure 2015-12-02 20:29:17 +01:00
718 changed files with 48652 additions and 173698 deletions

8
.gitignore vendored
View File

@ -3,3 +3,11 @@
/.recommenders/
/RemoteSystemsTempFiles/
/*.zip
SCViewer initiator_target.launch
SCViewer.xcf
SCViewer_1.png
copyrightLog.txt
/workspace
?*.launch
/.settings/
.tycho-consumer-pom.xml

View File

@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<launchConfiguration type="org.eclipse.m2e.Maven2LaunchConfigurationType">
<intAttribute key="M2_COLORS" value="0"/>
<booleanAttribute key="M2_DEBUG_OUTPUT" value="false"/>
<stringAttribute key="M2_GOALS" value="package"/>
<booleanAttribute key="M2_NON_RECURSIVE" value="false"/>
<booleanAttribute key="M2_OFFLINE" value="false"/>
<stringAttribute key="M2_PROFILES" value=""/>
<listAttribute key="M2_PROPERTIES"/>
<stringAttribute key="M2_RUNTIME" value="EMBEDDED"/>
<booleanAttribute key="M2_SKIP_TESTS" value="false"/>
<intAttribute key="M2_THREADS" value="1"/>
<booleanAttribute key="M2_UPDATE_SNAPSHOTS" value="false"/>
<stringAttribute key="M2_USER_SETTINGS" value=""/>
<booleanAttribute key="M2_WORKSPACE_RESOLUTION" value="false"/>
<booleanAttribute key="org.eclipse.debug.core.ATTR_FORCE_SYSTEM_CONSOLE_ENCODING" value="false"/>
<booleanAttribute key="org.eclipse.jdt.launching.ATTR_ATTR_USE_ARGFILE" value="false"/>
<booleanAttribute key="org.eclipse.jdt.launching.ATTR_SHOW_CODEDETAILS_IN_EXCEPTION_MESSAGES" value="true"/>
<booleanAttribute key="org.eclipse.jdt.launching.ATTR_USE_CLASSPATH_ONLY_JAR" value="false"/>
<booleanAttribute key="org.eclipse.jdt.launching.ATTR_USE_START_ON_FIRST_THREAD" value="true"/>
<stringAttribute key="org.eclipse.jdt.launching.JRE_CONTAINER" value="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-17/"/>
<stringAttribute key="org.eclipse.jdt.launching.WORKING_DIRECTORY" value="${project_loc:com.minres.scviewer.parent}"/>
</launchConfiguration>

View File

@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<launchConfiguration type="org.eclipse.m2e.Maven2LaunchConfigurationType">
<intAttribute key="M2_COLORS" value="0"/>
<booleanAttribute key="M2_DEBUG_OUTPUT" value="false"/>
<stringAttribute key="M2_GOALS" value="package"/>
<booleanAttribute key="M2_NON_RECURSIVE" value="false"/>
<booleanAttribute key="M2_OFFLINE" value="false"/>
<stringAttribute key="M2_PROFILES" value="release-composite"/>
<listAttribute key="M2_PROPERTIES"/>
<stringAttribute key="M2_RUNTIME" value="EMBEDDED"/>
<booleanAttribute key="M2_SKIP_TESTS" value="false"/>
<intAttribute key="M2_THREADS" value="4"/>
<booleanAttribute key="M2_UPDATE_SNAPSHOTS" value="false"/>
<stringAttribute key="M2_USER_SETTINGS" value=""/>
<booleanAttribute key="M2_WORKSPACE_RESOLUTION" value="true"/>
<booleanAttribute key="org.eclipse.debug.core.ATTR_FORCE_SYSTEM_CONSOLE_ENCODING" value="false"/>
<booleanAttribute key="org.eclipse.jdt.launching.ATTR_ATTR_USE_ARGFILE" value="false"/>
<booleanAttribute key="org.eclipse.jdt.launching.ATTR_SHOW_CODEDETAILS_IN_EXCEPTION_MESSAGES" value="true"/>
<booleanAttribute key="org.eclipse.jdt.launching.ATTR_USE_CLASSPATH_ONLY_JAR" value="false"/>
<booleanAttribute key="org.eclipse.jdt.launching.ATTR_USE_START_ON_FIRST_THREAD" value="true"/>
<stringAttribute key="org.eclipse.jdt.launching.JRE_CONTAINER" value="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-17/"/>
<stringAttribute key="org.eclipse.jdt.launching.WORKING_DIRECTORY" value="${project_loc:com.minres.scviewer.parent}"/>
</launchConfiguration>

View File

@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<launchConfiguration type="org.eclipse.m2e.Maven2LaunchConfigurationType">
<intAttribute key="M2_COLORS" value="0"/>
<booleanAttribute key="M2_DEBUG_OUTPUT" value="false"/>
<stringAttribute key="M2_GOALS" value="tycho-versions:set-version tycho-versions:update-pom"/>
<booleanAttribute key="M2_NON_RECURSIVE" value="false"/>
<booleanAttribute key="M2_OFFLINE" value="false"/>
<stringAttribute key="M2_PROFILES" value=""/>
<listAttribute key="M2_PROPERTIES">
<listEntry value="newVersion=${string_prompt:new version number}"/>
</listAttribute>
<stringAttribute key="M2_RUNTIME" value="EMBEDDED"/>
<booleanAttribute key="M2_SKIP_TESTS" value="false"/>
<intAttribute key="M2_THREADS" value="1"/>
<booleanAttribute key="M2_UPDATE_SNAPSHOTS" value="false"/>
<stringAttribute key="M2_USER_SETTINGS" value=""/>
<booleanAttribute key="M2_WORKSPACE_RESOLUTION" value="false"/>
<stringAttribute key="bad_container_name" value="/com.minres.scviewer.parent/.launch"/>
<booleanAttribute key="org.eclipse.debug.core.ATTR_FORCE_SYSTEM_CONSOLE_ENCODING" value="false"/>
<booleanAttribute key="org.eclipse.jdt.launching.ATTR_ATTR_USE_ARGFILE" value="false"/>
<booleanAttribute key="org.eclipse.jdt.launching.ATTR_SHOW_CODEDETAILS_IN_EXCEPTION_MESSAGES" value="true"/>
<booleanAttribute key="org.eclipse.jdt.launching.ATTR_USE_CLASSPATH_ONLY_JAR" value="false"/>
<booleanAttribute key="org.eclipse.jdt.launching.ATTR_USE_START_ON_FIRST_THREAD" value="true"/>
<stringAttribute key="org.eclipse.jdt.launching.JRE_CONTAINER" value="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-17/"/>
<stringAttribute key="org.eclipse.jdt.launching.WORKING_DIRECTORY" value="${project_loc:com.minres.scviewer.parent}"/>
</launchConfiguration>

203
LICENSE Normal file
View File

@ -0,0 +1,203 @@
Eclipse Public License - v 1.0
THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE PUBLIC
LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM
CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT.
1. DEFINITIONS
"Contribution" means:
a) in the case of the initial Contributor, the initial code and documentation
distributed under this Agreement, and
b) in the case of each subsequent Contributor:
i) changes to the Program, and
ii) additions to the Program;
where such changes and/or additions to the Program originate from and are
distributed by that particular Contributor. A Contribution 'originates'
from a Contributor if it was added to the Program by such Contributor
itself or anyone acting on such Contributor's behalf. Contributions do not
include additions to the Program which: (i) are separate modules of
software distributed in conjunction with the Program under their own
license agreement, and (ii) are not derivative works of the Program.
"Contributor" means any person or entity that distributes the Program.
"Licensed Patents" mean patent claims licensable by a Contributor which are
necessarily infringed by the use or sale of its Contribution alone or when
combined with the Program.
"Program" means the Contributions distributed in accordance with this
Agreement.
"Recipient" means anyone who receives the Program under this Agreement,
including all Contributors.
2. GRANT OF RIGHTS
a) Subject to the terms of this Agreement, each Contributor hereby grants
Recipient a non-exclusive, worldwide, royalty-free copyright license to
reproduce, prepare derivative works of, publicly display, publicly
perform, distribute and sublicense the Contribution of such Contributor,
if any, and such derivative works, in source code and object code form.
b) Subject to the terms of this Agreement, each Contributor hereby grants
Recipient a non-exclusive, worldwide, royalty-free patent license under
Licensed Patents to make, use, sell, offer to sell, import and otherwise
transfer the Contribution of such Contributor, if any, in source code and
object code form. This patent license shall apply to the combination of
the Contribution and the Program if, at the time the Contribution is
added by the Contributor, such addition of the Contribution causes such
combination to be covered by the Licensed Patents. The patent license
shall not apply to any other combinations which include the Contribution.
No hardware per se is licensed hereunder.
c) Recipient understands that although each Contributor grants the licenses
to its Contributions set forth herein, no assurances are provided by any
Contributor that the Program does not infringe the patent or other
intellectual property rights of any other entity. Each Contributor
disclaims any liability to Recipient for claims brought by any other
entity based on infringement of intellectual property rights or
otherwise. As a condition to exercising the rights and licenses granted
hereunder, each Recipient hereby assumes sole responsibility to secure
any other intellectual property rights needed, if any. For example, if a
third party patent license is required to allow Recipient to distribute
the Program, it is Recipient's responsibility to acquire that license
before distributing the Program.
d) Each Contributor represents that to its knowledge it has sufficient
copyright rights in its Contribution, if any, to grant the copyright
license set forth in this Agreement.
3. REQUIREMENTS
A Contributor may choose to distribute the Program in object code form under
its own license agreement, provided that:
a) it complies with the terms and conditions of this Agreement; and
b) its license agreement:
i) effectively disclaims on behalf of all Contributors all warranties
and conditions, express and implied, including warranties or
conditions of title and non-infringement, and implied warranties or
conditions of merchantability and fitness for a particular purpose;
ii) effectively excludes on behalf of all Contributors all liability for
damages, including direct, indirect, special, incidental and
consequential damages, such as lost profits;
iii) states that any provisions which differ from this Agreement are
offered by that Contributor alone and not by any other party; and
iv) states that source code for the Program is available from such
Contributor, and informs licensees how to obtain it in a reasonable
manner on or through a medium customarily used for software exchange.
When the Program is made available in source code form:
a) it must be made available under this Agreement; and
b) a copy of this Agreement must be included with each copy of the Program.
Contributors may not remove or alter any copyright notices contained
within the Program.
Each Contributor must identify itself as the originator of its Contribution,
if
any, in a manner that reasonably allows subsequent Recipients to identify the
originator of the Contribution.
4. COMMERCIAL DISTRIBUTION
Commercial distributors of software may accept certain responsibilities with
respect to end users, business partners and the like. While this license is
intended to facilitate the commercial use of the Program, the Contributor who
includes the Program in a commercial product offering should do so in a manner
which does not create potential liability for other Contributors. Therefore,
if a Contributor includes the Program in a commercial product offering, such
Contributor ("Commercial Contributor") hereby agrees to defend and indemnify
every other Contributor ("Indemnified Contributor") against any losses,
damages and costs (collectively "Losses") arising from claims, lawsuits and
other legal actions brought by a third party against the Indemnified
Contributor to the extent caused by the acts or omissions of such Commercial
Contributor in connection with its distribution of the Program in a commercial
product offering. The obligations in this section do not apply to any claims
or Losses relating to any actual or alleged intellectual property
infringement. In order to qualify, an Indemnified Contributor must:
a) promptly notify the Commercial Contributor in writing of such claim, and
b) allow the Commercial Contributor to control, and cooperate with the
Commercial Contributor in, the defense and any related settlement
negotiations. The Indemnified Contributor may participate in any such claim at
its own expense.
For example, a Contributor might include the Program in a commercial product
offering, Product X. That Contributor is then a Commercial Contributor. If
that Commercial Contributor then makes performance claims, or offers
warranties related to Product X, those performance claims and warranties are
such Commercial Contributor's responsibility alone. Under this section, the
Commercial Contributor would have to defend claims against the other
Contributors related to those performance claims and warranties, and if a
court requires any other Contributor to pay any damages as a result, the
Commercial Contributor must pay those damages.
5. NO WARRANTY
EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS PROVIDED 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. Each
Recipient is solely responsible for determining the appropriateness of using
and distributing the Program and assumes all risks associated with its
exercise of rights under this Agreement , including but not limited to the
risks and costs of program errors, compliance with applicable laws, damage to
or loss of data, programs or equipment, and unavailability or interruption of
operations.
6. DISCLAIMER OF LIABILITY
EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR ANY
CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION
LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE
EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY
OF SUCH DAMAGES.
7. GENERAL
If any provision of this Agreement is invalid or unenforceable under
applicable law, it shall not affect the validity or enforceability of the
remainder of the terms of this Agreement, and without further action by the
parties hereto, such provision shall be reformed to the minimum extent
necessary to make such provision valid and enforceable.
If Recipient institutes patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Program itself
(excluding combinations of the Program with other software or hardware)
infringes such Recipient's patent(s), then such Recipient's rights granted
under Section 2(b) shall terminate as of the date such litigation is filed.
All Recipient's rights under this Agreement shall terminate if it fails to
comply with any of the material terms or conditions of this Agreement and does
not cure such failure in a reasonable period of time after becoming aware of
such noncompliance. If all Recipient's rights under this Agreement terminate,
Recipient agrees to cease use and distribution of the Program as soon as
reasonably practicable. However, Recipient's obligations under this Agreement
and any licenses granted by Recipient relating to the Program shall continue
and survive.
Everyone is permitted to copy and distribute copies of this Agreement, but in
order to avoid inconsistency the Agreement is copyrighted and may only be
modified in the following manner. The Agreement Steward reserves the right to
publish new versions (including revisions) of this Agreement from time to
time. No one other than the Agreement Steward has the right to modify this
Agreement. The Eclipse Foundation is the initial Agreement Steward. The
Eclipse Foundation may assign the responsibility to serve as the Agreement
Steward to a suitable separate entity. Each new version of the Agreement will
be given a distinguishing version number. The Program (including
Contributions) may always be distributed subject to the version of the
Agreement under which it was received. In addition, after a new version of the
Agreement is published, Contributor may elect to distribute the Program
(including its Contributions) under the new version. Except as expressly
stated in Sections 2(a) and 2(b) above, Recipient receives no rights or
licenses to the intellectual property of any Contributor under this Agreement,
whether expressly, by implication, estoppel or otherwise. All rights in the
Program not expressly granted under this Agreement are reserved.
This Agreement is governed by the laws of the State of New York and the
intellectual property laws of the United States of America. No party to this
Agreement will bring a legal action under this Agreement more than one year
after the cause of action arose. Each party waives its rights to a jury trial in
any resulting litigation.

100
README.md
View File

@ -1,42 +1,70 @@
SCViewer
========
SCViewer is composed of a set of eclipse plugins to display VCD and transaction streams
created by the SystemC VCD trace implementation and the SystemC Verification Library (SCV).
For further description of the SCV please refer to
http://www.accellera.org/activities/committees/systemc-verification.
SCViewer is composed of a set of eclipse plugins to display VCD (e.g. created by SystemC VCD trace) and transaction streams. Those streams can be
created by the SystemC Verification Library (SCV, For further description of the SCV please refer to https://www.accellera.org/activities/working-groups/systemc-verification) or by the **L**ight**w**eight **T**ranasaction **R**ecording for SystemC ( [LWTR4SC](https://github.com/Minres/LWTR4SC) ).
The viewer is in early alpha stage and not yet ready for production use!
The viewer has the following features
- support of VCD files (compressed and uncompressed)
- real numbers
- showing vectors and real numbers as analog (step-wise & continuous)
- various value representations of bit vectors
- support of SCV transaction recordings in various formats
- text log files (compressed and uncompressed)
- sqlite based
- visualization of transaction relations
The plugins are structured as follows:
- com.minres.scviewer.database
the interface defining the API to access the database and the implementation for VCD
- com.minres.scviewer.database.text
an implementation of the API to read the text files generated by the SCV
sc_tr_text database
- com.minres.scviewer.database.sqlite
an implementation of the API to read the files generated by implementation in the
sc_tr_sqlite project using a SQLite based database
- com.minres.scviewer.database.test
a some JUnit tests of the 3 back ends
- com.minres.scviewer.ui
the viewer it self to diplay the transactions and associated views like the
outline of the DB and the properties of the transaction
- com.minres.scviewer.feature
the feature combining the plugins above into a somhow usable form
- scv_tr_sqlite
a C++ project containing the SQLite based SCV database implementation and the scv4tlm
socket implementations.
A simple example (scv_tr_recording_example.cpp) for testig purposes of the database is
provided.
To build the plugins the Eclipse SDK or PDE can be used. In both cases the Groovy
eclipse plugin (http://groovy.codehaus.org/Eclipse+Plugin or Market) has to be
installed.
> If you encounter issue when running on Linux please try running as `SWT_GTK3=0 scviewer` as there exist issues wiht GTK3.
To build the plugins the Eclipse SDK or PDE can be used.
Key Shortcuts
=============
Legend:
* Left Mouse Button: LMB
* Middle Mouse Button: MMB
* Mouse Scroll wheel: MScrl
* Context any means Name List, Value List or Waveform
| Input | Modifier | Context | Action |
|------------|----------|----------|-----------------------------------|
| LMB click | | any | select |
| LMB click | Shift | Waveform | move selected marker to position |
| LMB click | Control | Waveform | move cursor to position |
| LMB drag | | Waveform | zoom to range |
| MMB click | | Waveform | move selected marker to position |
| MScrl | | any | scroll window up/down |
| MScrl | Shift | any | scroll window left/right |
| MScrl | Control | Waveform | zoom in/out |
| Key left | | Waveform | scroll window to the left (slow) |
| Key right | | Waveform | scroll window to the right (slow) |
| Key left | Shift | Waveform | scroll window to the left (fast) |
| Key right | Shift | Waveform | scroll window to the right (fast) |
| Key up | | Waveform | move selection up |
| Key down | | Waveform | move selection down |
| Key up | Control | Waveform | move selected track up |
| Key down | Control | Waveform | move selected track down |
| Key + | Control | Waveform | zoom in |
| Key - | Control | Waveform | zoom out |
| Key Pos1 | | Waveform | jump to selected marker |
| Key End | | Waveform | jump to cursor |
| Key Del | | any | delete selected entries |
| LMB click | | ZoomBar | increment/decrement 1 page |
| LMB drag | | ZoomBar | drag both markers (pan) |
| LMB drag | Control | ZoomBar | drag one marker (zoom) |
| MMB drag | | ZoomBar | drag one marker (zoom) |
| xMB dclick | | ZoomBar | pan to position |
| MScrl | | ZoomBar | scroll window left/right |
| MScrl | Shift | ZoomBar | scroll window left/right double speed |
| MScrl | Control | ZoomBar | zoom in/out |
| Key left | | ZoomBar | scroll window to the left (slow) |
| Key right | | ZoomBar | scroll window to the right (slow) |
| Key up | | ZoomBar | scroll window to the left (slow) |
| Key down | | ZoomBar | scroll window to the right (slow) |
| Key PgUp | | ZoomBar | scroll window to the left (fast) |
| Key PgDown | | ZoomBar | scroll window to the right (fast) |
| Key Pos1 | | ZoomBar | scroll to begin |
| Key End | | ZoomBar | scroll to end |
TODO
====
- add more tests
- move to feature based product to allow automatic updates
- improve graphics
- catch-up e3 plugin to functionality of e4 product

View File

@ -1,7 +0,0 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
org.eclipse.jdt.core.compiler.compliance=1.7
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.7

View File

@ -1,52 +0,0 @@
/*******************************************************************************
* Copyright (c) 2015 MINRES Technologies GmbH and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* MINRES Technologies GmbH - initial API and implementation
*******************************************************************************/
package com.minres.scviewer.database.sqlite;
import java.util.List;
import com.minres.scviewer.database.ITx;
import com.minres.scviewer.database.ITxEvent;
import com.minres.scviewer.database.ITxGenerator;
import com.minres.scviewer.database.ITxStream;
import com.minres.scviewer.database.sqlite.tables.ScvGenerator;
public class TxGenerator implements ITxGenerator {
private ITxStream<ITxEvent> stream;
private ScvGenerator scvGenerator;
public TxGenerator(ITxStream<ITxEvent> stream, ScvGenerator scvGenerator) {
this.stream=stream;
this.scvGenerator=scvGenerator;
}
@Override
public Long getId() {
return (long) scvGenerator.getId();
}
@Override
public ITxStream<ITxEvent> getStream() {
return stream;
}
@Override
public String getName() {
return scvGenerator.getName();
}
@Override
public List<ITx> getTransactions() {
return null;
}
}

View File

@ -1,199 +0,0 @@
/*******************************************************************************
* Copyright (c) 2015 MINRES Technologies GmbH and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* MINRES Technologies GmbH - initial API and implementation
*******************************************************************************/
package com.minres.scviewer.database.sqlite;
import java.beans.IntrospectionException;
import java.lang.reflect.InvocationTargetException;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.NavigableMap;
import java.util.TreeMap;
import java.util.Vector;
import com.minres.scviewer.database.HierNode;
import com.minres.scviewer.database.ITx;
import com.minres.scviewer.database.ITxEvent;
import com.minres.scviewer.database.ITxGenerator;
import com.minres.scviewer.database.ITxStream;
import com.minres.scviewer.database.IWaveform;
import com.minres.scviewer.database.IWaveformDb;
import com.minres.scviewer.database.IWaveformEvent;
import com.minres.scviewer.database.RelationType;
import com.minres.scviewer.database.sqlite.db.IDatabase;
import com.minres.scviewer.database.sqlite.db.SQLiteDatabaseSelectHandler;
import com.minres.scviewer.database.sqlite.tables.ScvGenerator;
import com.minres.scviewer.database.sqlite.tables.ScvStream;
import com.minres.scviewer.database.sqlite.tables.ScvTx;
public class TxStream extends HierNode implements ITxStream<ITxEvent> {
private IDatabase database;
private String fullName;
private IWaveformDb db;
private ScvStream scvStream;
private TreeMap<Integer, TxGenerator> generators;
private TreeMap<Integer, ITx> transactions;
private Integer maxConcurrency;
private TreeMap<Long, List<ITxEvent>> events;
private List<RelationType> usedRelationsList;
public TxStream(IDatabase database, IWaveformDb waveformDb, ScvStream scvStream) {
super(scvStream.getName());
this.database=database;
fullName=scvStream.getName();
this.scvStream=scvStream;
db=waveformDb;
}
@Override
public IWaveformDb getDb() {
return db;
}
@Override
public String getFullName() {
return fullName;
}
@Override
public Long getId() {
return (long) scvStream.getId();
}
@Override
public String getKind() {
return scvStream.getKind();
}
@Override
public List<ITxGenerator> getGenerators() {
if(generators==null){
SQLiteDatabaseSelectHandler<ScvGenerator> handler = new SQLiteDatabaseSelectHandler<ScvGenerator>(
ScvGenerator.class, database, "stream="+scvStream.getId());
generators=new TreeMap<Integer, TxGenerator>();
try {
for(ScvGenerator scvGenerator:handler.selectObjects()){
generators.put(scvGenerator.getId(), new TxGenerator(this, scvGenerator));
}
} catch (SecurityException | IllegalArgumentException | InstantiationException | IllegalAccessException
| InvocationTargetException | SQLException | IntrospectionException e) {
e.printStackTrace();
}
}
return new ArrayList<ITxGenerator>(generators.values());
}
@Override
public int getMaxConcurrency() {
if(maxConcurrency==null){
java.sql.Connection connection=null;
java.sql.Statement statement=null;
java.sql.ResultSet resultSet=null;
try {
connection = database.createConnection();
statement = connection.createStatement();
StringBuilder sb = new StringBuilder();
sb.append("SELECT MAX(concurrencyLevel) as concurrencyLevel FROM ScvTx where stream=");
sb.append(scvStream.getId());
resultSet = statement.executeQuery(sb.toString());
while (resultSet.next()) {
Object value = resultSet.getObject("concurrencyLevel");
if(value!=null)
maxConcurrency=(Integer) value;
}
} catch (SQLException e) {
if(maxConcurrency==null) maxConcurrency=0;
} finally {
try{
if(resultSet!=null) resultSet.close();
if(statement!=null) statement.close();
if(connection!=null) connection.close();
} catch (SQLException e) { }
}
maxConcurrency+=1;
}
return maxConcurrency;
}
@Override
public NavigableMap<Long, List<ITxEvent>> getEvents(){
if(events==null){
events=new TreeMap<Long, List<ITxEvent>>();
for(Entry<Integer, ITx> entry:getTransactions().entrySet()){
putEvent(new TxEvent(TxEvent.Type.BEGIN, entry.getValue()));
putEvent(new TxEvent(TxEvent.Type.END, entry.getValue()));
}
}
return events;
}
private void putEvent(TxEvent ev){
Long time = ev.getTime();
if(!events.containsKey(time)){
Vector<ITxEvent> vector=new Vector<ITxEvent>();
vector.add(ev);
events.put(time, vector);
} else {
events.get(time).add(ev);
}
}
protected Map<Integer, ITx> getTransactions() {
if(transactions==null){
if(generators==null) getGenerators();
transactions = new TreeMap<Integer, ITx>();
SQLiteDatabaseSelectHandler<ScvTx> handler = new SQLiteDatabaseSelectHandler<ScvTx>(ScvTx.class, database,
"stream="+scvStream.getId());
try {
for(ScvTx scvTx:handler.selectObjects()){
transactions.put(scvTx.getId(), new Tx(database, this, generators.get(scvTx.getGenerator()), scvTx));
}
} catch (SecurityException | IllegalArgumentException | InstantiationException | IllegalAccessException
| InvocationTargetException | SQLException | IntrospectionException e) {
e.printStackTrace();
}
}
return transactions;
}
@Override
public Collection<ITxEvent> getWaveformEventsAtTime(Long time) {
return getEvents().get(time);
}
public void setRelationTypeList(List<RelationType> usedRelationsList){
this.usedRelationsList=usedRelationsList;
}
public RelationType getRelationType(String name) {
RelationType relType=RelationType.create(name);
if(!usedRelationsList.contains(relType)) usedRelationsList.add(relType);
return relType;
}
@Override
public Boolean equals(IWaveform<? extends IWaveformEvent> other) {
return(other instanceof TxStream && this.getId()==other.getId());
}
}

View File

@ -1,7 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src/"/>
<classpathentry kind="output" path="target/classes"/>
</classpath>

View File

@ -1,3 +0,0 @@
eclipse.preferences.version=1
encoding//src/com/minres/scviewer/database/test/DatabaseServicesTest.java=UTF-8
encoding/<project>=UTF-8

View File

@ -1,8 +0,0 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
org.eclipse.jdt.core.compiler.compliance=1.7
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
org.eclipse.jdt.core.compiler.source=1.7

View File

@ -1,46 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<launchConfiguration type="org.eclipse.pde.ui.JunitLaunchConfig">
<booleanAttribute key="append.args" value="true"/>
<stringAttribute key="application" value="org.eclipse.pde.junit.runtime.coretestapplication"/>
<booleanAttribute key="askclear" value="false"/>
<booleanAttribute key="automaticAdd" value="true"/>
<booleanAttribute key="automaticValidate" value="false"/>
<stringAttribute key="bootstrap" value=""/>
<stringAttribute key="checked" value="[NONE]"/>
<booleanAttribute key="clearConfig" value="true"/>
<booleanAttribute key="clearws" value="true"/>
<booleanAttribute key="clearwslog" value="false"/>
<stringAttribute key="configLocation" value="${workspace_loc}/.metadata/.plugins/org.eclipse.pde.core/pde-junit"/>
<booleanAttribute key="default" value="false"/>
<stringAttribute key="deselected_workspace_plugins" value="com.minres.scviewer.database.swt,com.minres.scviewer.e4.application,com.minres.scviewer.ui"/>
<booleanAttribute key="includeOptional" value="true"/>
<stringAttribute key="location" value="${workspace_loc}/../junit-workspace"/>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
<listEntry value="/com.minres.scviewer.database.test/src/com/minres/scviewer/database/test/DatabaseServicesTest.java"/>
</listAttribute>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
<listEntry value="1"/>
</listAttribute>
<stringAttribute key="org.eclipse.jdt.junit.CONTAINER" value=""/>
<booleanAttribute key="org.eclipse.jdt.junit.KEEPRUNNING_ATTR" value="false"/>
<stringAttribute key="org.eclipse.jdt.junit.TESTNAME" value=""/>
<stringAttribute key="org.eclipse.jdt.junit.TEST_KIND" value="org.eclipse.jdt.junit.loader.junit4"/>
<booleanAttribute key="org.eclipse.jdt.launching.ATTR_USE_START_ON_FIRST_THREAD" value="true"/>
<stringAttribute key="org.eclipse.jdt.launching.JRE_CONTAINER" value="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="com.minres.scviewer.database.test.DatabaseServicesTest"/>
<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-os ${target.os} -ws ${target.ws} -arch ${target.arch} -nl ${target.nl} -consoleLog"/>
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="com.minres.scviewer.database.test"/>
<stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.pde.ui.workbenchClasspathProvider"/>
<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Xms40m -Xmx512m -Xdock:icon=../Resources/Eclipse.icns -XstartOnFirstThread -Dorg.eclipse.swt.internal.carbon.smallFonts"/>
<stringAttribute key="pde.version" value="3.3"/>
<stringAttribute key="product" value="com.minres.scviewer.e4.product"/>
<booleanAttribute key="run_in_ui_thread" value="true"/>
<stringAttribute key="selected_target_plugins" value="com.google.guava*10.0.1.v201203051515@default:default,com.google.guava*15.0.0.v201403281430@default:default,com.ibm.icu@default:default,javax.annotation@default:default,javax.inject@default:default,javax.servlet*3.0.0.v201112011016@default:default,javax.servlet*3.1.0.v201410161800@default:default,javax.xml@default:default,org.apache.ant@default:default,org.apache.batik.css@default:default,org.apache.batik.util.gui@default:default,org.apache.batik.util@default:default,org.apache.commons.jxpath@default:default,org.apache.commons.logging@default:default,org.apache.felix.gogo.runtime@default:default,org.apache.felix.gogo.shell@default:default,org.codehaus.groovy*2.4.3.xx-201508121448-e45@default:default,org.eclipse.ant.core@default:default,org.eclipse.compare.core@default:default,org.eclipse.core.commands@default:default,org.eclipse.core.contenttype@default:default,org.eclipse.core.databinding.observable@default:default,org.eclipse.core.databinding.property@default:default,org.eclipse.core.databinding@default:default,org.eclipse.core.expressions@default:default,org.eclipse.core.filesystem.java7@default:false,org.eclipse.core.filesystem.macosx@default:false,org.eclipse.core.filesystem@default:default,org.eclipse.core.jobs@default:default,org.eclipse.core.resources@default:default,org.eclipse.core.runtime.compatibility.registry@default:false,org.eclipse.core.runtime@default:true,org.eclipse.core.variables@default:default,org.eclipse.e4.core.commands@default:default,org.eclipse.e4.core.contexts@default:default,org.eclipse.e4.core.di.annotations@default:default,org.eclipse.e4.core.di.extensions@default:default,org.eclipse.e4.core.di@default:default,org.eclipse.e4.core.services@default:default,org.eclipse.e4.emf.xpath@default:default,org.eclipse.e4.ui.bindings@default:default,org.eclipse.e4.ui.css.core@default:default,org.eclipse.e4.ui.css.swt.theme@default:default,org.eclipse.e4.ui.css.swt@default:default,org.eclipse.e4.ui.di@default:default,org.eclipse.e4.ui.model.workbench@default:default,org.eclipse.e4.ui.services@default:default,org.eclipse.e4.ui.widgets@default:default,org.eclipse.e4.ui.workbench.addons.swt@default:default,org.eclipse.e4.ui.workbench.renderers.swt.cocoa@default:false,org.eclipse.e4.ui.workbench.renderers.swt@default:default,org.eclipse.e4.ui.workbench.swt@default:default,org.eclipse.e4.ui.workbench3@default:default,org.eclipse.e4.ui.workbench@default:default,org.eclipse.emf.common@default:default,org.eclipse.emf.ecore.change@default:default,org.eclipse.emf.ecore.xmi@default:default,org.eclipse.emf.ecore@default:default,org.eclipse.equinox.app@default:default,org.eclipse.equinox.bidi@default:default,org.eclipse.equinox.common@2:true,org.eclipse.equinox.console@default:default,org.eclipse.equinox.ds@1:true,org.eclipse.equinox.event@default:default,org.eclipse.equinox.preferences@default:default,org.eclipse.equinox.registry@default:default,org.eclipse.equinox.util@default:default,org.eclipse.help@default:default,org.eclipse.jface.databinding@default:default,org.eclipse.jface@default:default,org.eclipse.osgi.compatibility.state@default:false,org.eclipse.osgi.services@default:default,org.eclipse.osgi@-1:true,org.eclipse.swt.cocoa.macosx.x86_64@default:false,org.eclipse.swt@default:default,org.eclipse.team.core@default:default,org.eclipse.ui.cocoa@default:false,org.eclipse.ui.trace@default:default,org.eclipse.ui.workbench@default:default,org.eclipse.ui@default:default,org.hamcrest.core@default:default,org.junit@default:default,org.mozilla.javascript@default:default,org.w3c.css.sac@default:default,org.w3c.dom.events@default:default,org.w3c.dom.smil@default:default,org.w3c.dom.svg@default:default"/>
<stringAttribute key="selected_workspace_plugins" value="com.minres.scviewer.database.sqlite@default:true,com.minres.scviewer.database.test@default:default,com.minres.scviewer.database.text@default:true,com.minres.scviewer.database.vcd@default:default,com.minres.scviewer.database@default:true"/>
<booleanAttribute key="show_selected_only" value="false"/>
<booleanAttribute key="tracing" value="false"/>
<booleanAttribute key="useCustomFeatures" value="false"/>
<booleanAttribute key="useDefaultConfig" value="true"/>
<booleanAttribute key="useDefaultConfigArea" value="false"/>
<booleanAttribute key="useProduct" value="false"/>
</launchConfiguration>

View File

@ -1,90 +0,0 @@
/*******************************************************************************
* Copyright (c) 2015 MINRES Technologies GmbH and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* MINRES Technologies GmbH - initial API and implementation
*******************************************************************************/
package com.minres.scviewer.database.test;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import java.io.File;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import com.minres.scviewer.database.IWaveformDb;
import com.minres.scviewer.database.IWaveformDbFactory;
public class DatabaseServicesTest {
private static IWaveformDbFactory waveformDbFactory;
private IWaveformDb waveformDb;
public synchronized void setFactory(IWaveformDbFactory service) {
waveformDbFactory = service;
}
public synchronized void unsetFactory(IWaveformDbFactory service) {
if (waveformDbFactory == service) {
waveformDbFactory = null;
}
}
@Before
public void setUp() throws Exception {
waveformDb=waveformDbFactory.getDatabase();
// Wait for OSGi dependencies
// for (int i = 0; i < 10; i++) {
// if (waveformDb.size() == 3) // Dependencies fulfilled
// return;
// Thread.sleep(1000);
// }
// assertEquals("OSGi dependencies unfulfilled", 3, WaveformDb.getLoaders().size());
}
@After
public void tearDown() throws Exception {
}
@Test
public void testVCD() throws Exception {
File f = new File("inputs/my_db.vcd").getAbsoluteFile();
assertTrue(f.exists());
waveformDb.load(f);
assertNotNull(waveformDb);
assertEquals(14, waveformDb.getAllWaves().size());
assertEquals(2, waveformDb.getChildNodes().size());
}
@Test
public void testTxSQLite() throws Exception {
File f = new File("inputs/my_db.txdb").getAbsoluteFile();
assertTrue(f.exists());
waveformDb.load(f);
assertNotNull(waveformDb);
assertEquals(3, waveformDb.getAllWaves().size());
assertEquals(1, waveformDb.getChildNodes().size());
}
@Test
public void testTxText() throws Exception {
File f = new File("inputs/my_db.txlog").getAbsoluteFile();
assertTrue(f.exists());
waveformDb.load(f);
assertNotNull(waveformDb);
assertEquals(3, waveformDb.getAllWaves().size());
assertEquals(1, waveformDb.getChildNodes().size());
}
}

View File

@ -1,7 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src/"/>
<classpathentry kind="output" path="target/classes"/>
</classpath>

View File

@ -1,8 +0,0 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
org.eclipse.jdt.core.compiler.compliance=1.7
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
org.eclipse.jdt.core.compiler.source=1.7

View File

@ -1,17 +0,0 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Textual transaction database
Bundle-SymbolicName: com.minres.scviewer.database.text
Bundle-Version: 1.0.0.qualifier
Bundle-Vendor: MINRES Technologies GmbH
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
Import-Package: com.minres.scviewer.database,
org.osgi.framework;version="1.3.0"
Require-Bundle: com.minres.scviewer.database;bundle-version="1.0.0",
org.codehaus.groovy;bundle-version="1.8.6",
org.eclipse.equinox.util;bundle-version="1.0.500",
org.eclipse.equinox.ds;bundle-version="1.4.200",
org.eclipse.osgi.services;bundle-version="3.4.0",
com.google.guava;bundle-version="15.0.0"
Service-Component: OSGI-INF/component.xml
Bundle-ActivationPolicy: lazy

View File

@ -1,43 +0,0 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>com.minres.scviewer.database.text</artifactId>
<parent>
<groupId>com.minres.scviewer</groupId>
<artifactId>com.minres.scviewer.parent</artifactId>
<version>1.0.0-SNAPSHOT</version>
<relativePath>../com.minres.scviewer.parent</relativePath>
</parent>
<packaging>eclipse-plugin</packaging>
<build>
<plugins>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-compiler-plugin</artifactId>
<configuration>
<compilerId>groovy-eclipse-compiler</compilerId>
<!-- set verbose to be true if you want lots of uninteresting messages -->
<!-- <verbose>true</verbose> -->
<source>1.7</source>
<target>1.7</target>
</configuration>
<dependencies>
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-eclipse-compiler</artifactId>
<version>${groovy-eclipse-compiler-version}</version>
</dependency>
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-eclipse-batch</artifactId>
<version>${groovy-eclipse-batch-version}</version>
<!-- or choose a different compiler version -->
<!-- <version>2.1.8-01</version> -->
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
<groupId>com.minres.scviewer</groupId>
<version>1.0.0-SNAPSHOT</version>
</project>

View File

@ -1,171 +0,0 @@
/*******************************************************************************
* Copyright (c) 2012 IT Just working.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IT Just working - initial API and implementation
*******************************************************************************/
package com.minres.scviewer.database.text;
import java.util.Collection;
import com.minres.scviewer.database.AssociationType
import com.minres.scviewer.database.DataType
import com.minres.scviewer.database.ITxGenerator
import com.minres.scviewer.database.ITxStream
import com.minres.scviewer.database.IWaveform
import com.minres.scviewer.database.IWaveformDb
import com.minres.scviewer.database.IWaveformDbLoader
import com.minres.scviewer.database.RelationType
public class TextDbLoader implements IWaveformDbLoader{
private Long maxTime;
IWaveformDb db;
def streams = []
def relationTypes=[:]
public TextDbLoader() {
}
@Override
public Long getMaxTime() {
return maxTime;
}
@Override
public List<IWaveform> getAllWaves() {
return new LinkedList<IWaveform>(streams);
}
public Map<Long, ITxGenerator> getGeneratorsById() {
TreeMap<Long, ITxGenerator> res = new TreeMap<Long, ITxGenerator>();
streams.each{TxStream stream -> stream.generators.each{res.put(it.id, id)} }
return res;
}
static final byte[] x = "scv_tr_stream".bytes
@Override
boolean load(IWaveformDb db, File file) throws Exception {
this.db=db
this.streams=[]
FileInputStream fis = new FileInputStream(file)
byte[] buffer = new byte[x.size()]
def readCnt = fis.read(buffer, 0, x.size())
fis.close()
if(readCnt==x.size())
for(int i=0; i<x.size(); i++)
if(buffer[i]!=x[i]) return false
parseInput(file)
calculateConcurrencyIndicees()
return true
}
private stringToScale(String scale){
switch(scale.trim()){
case "fs":return 1L
case "ps":return 1000L
case "ns":return 1000000L
case "us":return 1000000000L
case "ms":return 1000000000000L
case "s": return 1000000000000000L
}
}
private def parseInput(File input){
def streamsById = [:]
def generatorsById = [:]
def transactionsById = [:]
TxGenerator generator
Tx transaction
boolean endTransaction=false
def matcher
input.eachLine { line ->
def tokens = line.split(/\s+/)
switch(tokens[0]){
case "scv_tr_stream":
case "scv_tr_generator":
case "begin_attribute":
case "end_attribute":
if ((matcher = line =~ /^scv_tr_stream\s+\(ID (\d+),\s+name\s+"([^"]+)",\s+kind\s+"([^"]+)"\)$/)) {
def id = Integer.parseInt(matcher[0][1])
def stream = new TxStream(db, id, matcher[0][2], matcher[0][3])
streams<<stream
streamsById[id]=stream
} else if ((matcher = line =~ /^scv_tr_generator\s+\(ID\s+(\d+),\s+name\s+"([^"]+)",\s+scv_tr_stream\s+(\d+),$/)) {
def id = Integer.parseInt(matcher[0][1])
ITxStream stream=streamsById[Integer.parseInt(matcher[0][3])]
generator=new TxGenerator(id, stream, matcher[0][2])
stream.generators<<generator
generatorsById[id]=generator
} else if ((matcher = line =~ /^begin_attribute \(ID (\d+), name "([^"]+)", type "([^"]+)"\)$/)) {
generator.begin_attrs << TxAttributeType.getAttrType(matcher[0][2], DataType.valueOf(matcher[0][3]), AssociationType.BEGIN)
} else if ((matcher = line =~ /^end_attribute \(ID (\d+), name "([^"]+)", type "([^"]+)"\)$/)) {
generator.end_attrs << TxAttributeType.getAttrType(matcher[0][2], DataType.valueOf(matcher[0][3]), AssociationType.END)
}
break;
case ")":
generator=null
break
case "tx_begin"://matcher = line =~ /^tx_begin\s+(\d+)\s+(\d+)\s+(\d+)\s+([munpf]?s)/
def id = Integer.parseInt(tokens[1])
TxGenerator gen=generatorsById[Integer.parseInt(tokens[2])]
transaction = new Tx(id, gen.stream, gen, Long.parseLong(tokens[3])*stringToScale(tokens[4]))
gen.transactions << transaction
transactionsById[id]= transaction
gen.begin_attrs_idx=0;
maxTime = maxTime>transaction.beginTime?maxTime:transaction.beginTime
endTransaction=false
break
case "tx_end"://matcher = line =~ /^tx_end\s+(\d+)\s+(\d+)\s+(\d+)\s+([munpf]?s)/
def id = Integer.parseInt(tokens[1])
transaction = transactionsById[id]
assert Integer.parseInt(tokens[2])==transaction.generator.id
transaction.endTime = Long.parseLong(tokens[3])*stringToScale(tokens[4])
transaction.generator.end_attrs_idx=0;
maxTime = maxTime>transaction.endTime?maxTime:transaction.endTime
endTransaction=true
break
case "tx_record_attribute"://matcher = line =~ /^tx_record_attribute\s+(\d+)\s+"([^"]+)"\s+(\S+)\s*=\s*(.+)$/
def id = Integer.parseInt(tokens[1])
transactionsById[id].attributes<<new TxAttribute(tokens[2][1..-2], DataType.valueOf(tokens[3]), AssociationType.RECORD, tokens[5..-1].join(' '))
break
case "a"://matcher = line =~ /^a\s+(.+)$/
if(endTransaction){
transaction.attributes << new TxAttribute(transaction.generator.end_attrs[0], tokens[1])
} else {
transaction.attributes << new TxAttribute(transaction.generator.begin_attrs[0], tokens[1])
}
break
case "tx_relation"://matcher = line =~ /^tx_relation\s+\"(\S+)\"\s+(\d+)\s+(\d+)$/
Tx tr2= transactionsById[Integer.parseInt(tokens[2])]
Tx tr1= transactionsById[Integer.parseInt(tokens[3])]
def relType=tokens[1][1..-2]
if(!relationTypes.containsKey(relType)) relationTypes[relType]=RelationType.create(relType)
def rel = new TxRelation(relationTypes[relType], tr1, tr2)
tr1.outgoingRelations<<rel
tr2.incomingRelations<<rel
break
default:
println "Don't know what to do with: '$line'"
}
}
}
private def calculateConcurrencyIndicees(){
streams.each{ TxStream stream -> stream.getMaxConcurrency() }
}
public Collection<RelationType> getAllRelationTypes(){
return relationTypes.values();
}
}

View File

@ -1,67 +0,0 @@
/*******************************************************************************
* Copyright (c) 2012 IT Just working.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IT Just working - initial API and implementation
*******************************************************************************/
package com.minres.scviewer.database.text
import com.minres.scviewer.database.*
class Tx implements ITx {
Long id
TxGenerator generator
TxStream stream
int concurrencyIndex
Long beginTime
Long endTime
ArrayList<ITxAttribute> attributes = new ArrayList<ITxAttribute>()
def incomingRelations =[]
def outgoingRelations =[]
Tx(int id, TxStream stream, TxGenerator generator, Long begin){
this.id=id
this.stream=stream
this.generator=generator
this.beginTime=begin
this.endTime=begin
}
@Override
public Collection<ITxRelation> getIncomingRelations() {
return incomingRelations;
}
@Override
public Collection<ITxRelation> getOutgoingRelations() {
return outgoingRelations;
}
@Override
public int compareTo(ITx o) {
def res =beginTime.compareTo(o.beginTime)
if(res!=0)
return res
else
return id.compareTo(o.id)
}
@Override
public String toString() {
return "tx#"+getId()+"["+getBeginTime()/1000000+"ns - "+getEndTime()/1000000+"ns]";
}
}

View File

@ -1,59 +0,0 @@
/*******************************************************************************
* Copyright (c) 2012 IT Just working.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IT Just working - initial API and implementation
*******************************************************************************/
package com.minres.scviewer.database.text
import com.minres.scviewer.database.AssociationType;
import com.minres.scviewer.database.DataType;
import com.minres.scviewer.database.ITxAttributeType;
import com.minres.scviewer.database.ITxAttribute
class TxAttribute implements ITxAttribute{
TxAttributeType attributeType
def value
TxAttribute(String name, DataType dataType, AssociationType type, value){
attributeType = TxAttributeTypeFactory.instance.getAttrType(name, dataType, type)
switch(dataType){
case DataType.STRING:
case DataType.ENUMERATION:
this.value=value[1..-2]
break;
default:
this.value=value
}
}
TxAttribute(TxAttributeType other){
attributeType=other
}
TxAttribute(TxAttributeType other, value){
this(other.name, other.dataType, other.type, value)
}
@Override
public String getName() {
return attributeType.getName();
}
@Override
public AssociationType getType() {
attributeType.type;
}
@Override
public DataType getDataType() {
attributeType.dataType;
}
}

View File

@ -1,31 +0,0 @@
/*******************************************************************************
* Copyright (c) 2012 IT Just working.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IT Just working - initial API and implementation
*******************************************************************************/
package com.minres.scviewer.database.text
import com.minres.scviewer.database.AssociationType;
import com.minres.scviewer.database.DataType;
import com.minres.scviewer.database.ITxAttributeType;
class TxAttributeType implements ITxAttributeType {
String name
DataType dataType
AssociationType type
static TxAttributeType getAttrType(String name, DataType dataType, AssociationType type){
TxAttributeTypeFactory.instance.getAttrType(name, dataType, type)
}
TxAttributeType(String name, DataType dataType, AssociationType type){
this.name=name
this.dataType=dataType
this.type=type
}
}

View File

@ -1,38 +0,0 @@
/*******************************************************************************
* Copyright (c) 2012 IT Just working.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IT Just working - initial API and implementation
*******************************************************************************/
package com.minres.scviewer.database.text
import com.minres.scviewer.database.AssociationType;
import com.minres.scviewer.database.DataType
import com.minres.scviewer.database.ITxAttributeType
import com.minres.scviewer.database.ITxAttribute
class TxAttributeTypeFactory {
private static final instance = new TxAttributeTypeFactory()
def attributes = [:]
private TxAttributeTypeFactory() {
TxAttributeTypeFactory.metaClass.constructor = {-> instance }
}
ITxAttributeType getAttrType(String name, DataType dataType, AssociationType type){
def key = name+":"+dataType.toString()
ITxAttributeType res
if(attributes.containsKey(key)){
res=attributes[key]
} else {
res=new TxAttributeType(name, dataType, type)
attributes[key]=res
}
return res
}
}

View File

@ -1,36 +0,0 @@
package com.minres.scviewer.database.text;
import com.minres.scviewer.database.ITx
import com.minres.scviewer.database.ITxEvent
import com.minres.scviewer.database.IWaveformEvent
class TxEvent implements ITxEvent {
final ITxEvent.Type type;
final Tx transaction;
final Long time
TxEvent(ITxEvent.Type type, ITx transaction) {
super();
this.type = type;
this.transaction = transaction;
this.time = type==ITxEvent.Type.BEGIN?transaction.beginTime:transaction.endTime
}
@Override
IWaveformEvent duplicate() throws CloneNotSupportedException {
new TxEvent(type, transaction, time)
}
@Override
int compareTo(IWaveformEvent o) {
time.compareTo(o.time)
}
@Override
String toString() {
type.toString()+"@"+time+" of tx #"+transaction.id;
}
}

View File

@ -1,52 +0,0 @@
/*******************************************************************************
* Copyright (c) 2012 IT Just working.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IT Just working - initial API and implementation
*******************************************************************************/
package com.minres.scviewer.database.text
import java.util.ArrayList;
import java.util.List;
import com.minres.scviewer.database.ITxAttributeType
import com.minres.scviewer.database.ITxAttribute;
import com.minres.scviewer.database.ITxEvent;
import com.minres.scviewer.database.ITxGenerator;
import com.minres.scviewer.database.ITxStream;
import com.minres.scviewer.database.ITx;
import com.minres.scviewer.database.IWaveformEvent;
class TxGenerator implements ITxGenerator{
Long id
TxStream stream
String name
Boolean active = false
ArrayList<ITx> transactions=[]
ArrayList<ITxAttributeType> begin_attrs = []
int begin_attrs_idx = 0
ArrayList<ITxAttributeType> end_attrs= []
int end_attrs_idx = 0
TxGenerator(int id, TxStream stream, name){
this.id=id
this.stream=stream
this.name=name
}
ITxStream<? extends ITxEvent> getStream(){
return stream;
}
List<ITx> getTransactions(){
return transactions
}
Boolean isActive() {return active};
}

View File

@ -1,36 +0,0 @@
package com.minres.scviewer.database.text
import com.minres.scviewer.database.ITxRelation
import com.minres.scviewer.database.ITx;
import com.minres.scviewer.database.RelationType;
class TxRelation implements ITxRelation {
Tx source
Tx target
RelationType relationType
public TxRelation(RelationType relationType, Tx source, Tx target) {
this.source = source;
this.target = target;
this.relationType = relationType;
}
@Override
public RelationType getRelationType() {
return relationType;
}
@Override
public ITx getSource() {
return source;
}
@Override
public ITx getTarget() {
return target;
}
}

View File

@ -1,117 +0,0 @@
/*******************************************************************************
* Copyright (c) 2012 IT Just working.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IT Just working - initial API and implementation
*******************************************************************************/
package com.minres.scviewer.database.text
import java.beans.PropertyChangeListener;
import java.util.Collection;
import java.util.Comparator;
import java.util.List;
import java.util.Map;
import java.util.NavigableMap;
import com.google.common.collect.TreeMultimap
import com.minres.scviewer.database.ITxEvent;
import com.minres.scviewer.database.IWaveform;
import com.minres.scviewer.database.IWaveformDb
import com.minres.scviewer.database.IWaveformEvent
import com.minres.scviewer.database.ITxGenerator
import com.minres.scviewer.database.HierNode;
import com.minres.scviewer.database.IHierNode
import com.minres.scviewer.database.ITxStream
import com.minres.scviewer.database.ITx
class TxStream extends HierNode implements ITxStream {
Long id
IWaveformDb database
String fullName
String kind
def generators = []
int maxConcurrency
private TreeMap<Long, List<ITxEvent>> events
TxStream(IWaveformDb db, int id, String name, String kind){
super(name)
this.id=id
this.database=db
this.fullName=name
this.kind=kind
this.maxConcurrency=0
events = new TreeMap<Long, List<ITxEvent>>()
}
List<ITxGenerator> getGenerators(){
return generators as List<ITxGenerator>
}
@Override
public IWaveformDb getDb() {
return database
}
@Override
public int getMaxConcurrency() {
if(!maxConcurrency){
generators.each {TxGenerator generator ->
generator.transactions.each{ Tx tx ->
putEvent(new TxEvent(ITxEvent.Type.BEGIN, tx))
putEvent(new TxEvent(ITxEvent.Type.END, tx))
}
}
def rowendtime = [0]
events.keySet().each{long time ->
def value=events.get(time)
def starts=value.findAll{ITxEvent event ->event.type==ITxEvent.Type.BEGIN}
starts.each {ITxEvent event ->
Tx tx = event.transaction
def rowIdx = 0
for(rowIdx=0; rowIdx<rowendtime.size() && rowendtime[rowIdx]>tx.beginTime; rowIdx++);
if(rowendtime.size<=rowIdx)
rowendtime<<tx.endTime
else
rowendtime[rowIdx]=tx.endTime
tx.concurrencyIndex=rowIdx
}
}
maxConcurrency=rowendtime.size()
}
return maxConcurrency
}
private putEvent(ITxEvent event){
if(!events.containsKey(event.time))
events.put(event.time, [event])
else
events[event.time]<<event
}
@Override
public NavigableMap getEvents() {
return events;
}
@Override
public Collection getWaveformEventsAtTime(Long time) {
return events.get(time);
}
@Override
public Boolean equals(IWaveform<? extends IWaveformEvent> other) {
return(other instanceof TxStream && this.getId()==other.getId());
}
}

View File

@ -1,7 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src/"/>
<classpathentry kind="output" path="target/classes"/>
</classpath>

View File

@ -1,7 +0,0 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
org.eclipse.jdt.core.compiler.compliance=1.7
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.7

View File

@ -1,19 +0,0 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: SWT widget
Bundle-SymbolicName: com.minres.scviewer.database.ui.swt
Bundle-Version: 1.0.0.qualifier
Bundle-Vendor: MINRES Technologies GmbH
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
Require-Bundle: org.eclipse.swt;bundle-version="3.103.1",
com.minres.scviewer.database;bundle-version="1.0.0",
com.google.guava;bundle-version="15.0.0",
org.eclipse.jface,
org.eclipse.equinox.registry,
com.minres.scviewer.database.ui,
org.eclipse.core.runtime,
org.eclipse.osgi
Export-Package: com.minres.scviewer.database.swt
Bundle-ClassPath: .
Bundle-ActivationPolicy: lazy
Bundle-Activator: com.minres.scviewer.database.swt.DatabaseUiPlugin

View File

@ -1,26 +0,0 @@
/*******************************************************************************
* Copyright (c) 2015 MINRES Technologies GmbH and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* MINRES Technologies GmbH - initial API and implementation
*******************************************************************************/
package com.minres.scviewer.database.swt;
import org.eclipse.swt.widgets.Composite;
import com.minres.scviewer.database.swt.internal.WaveformViewer;
import com.minres.scviewer.database.ui.IWaveformViewer;
import com.minres.scviewer.database.ui.IWaveformViewerFactory;
public class WaveformViewerFactory implements IWaveformViewerFactory {
@Override
public IWaveformViewer createPanel(Composite parent) {
return new WaveformViewer(parent);
}
}

View File

@ -1,178 +0,0 @@
/*******************************************************************************
* Copyright (c) 2015 MINRES Technologies GmbH and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* MINRES Technologies GmbH - initial API and implementation
*******************************************************************************/
package com.minres.scviewer.database.swt.internal;
import java.util.Collection;
import java.util.LinkedList;
import java.util.List;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.GC;
import org.eclipse.swt.graphics.Path;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.widgets.Display;
import com.minres.scviewer.database.ITx;
import com.minres.scviewer.database.ITxRelation;
import com.minres.scviewer.database.ITxStream;
import com.minres.scviewer.database.RelationType;
import com.minres.scviewer.database.ui.WaveformColors;
public class ArrowPainter implements IPainter {
private final int xCtrlOffset = 50;
private final int yCtrlOffset = 30;
private WaveformCanvas waveCanvas;
private ITx tx;
private List<LinkEntry> iRect;
private List<LinkEntry> oRect;
private Rectangle txRectangle;
private RelationType highlightType;
long scaleFactor;
boolean deferredUpdate;
public ArrowPainter(WaveformCanvas waveCanvas, RelationType relationType) {
this.waveCanvas = waveCanvas;
highlightType=relationType;
setTx(null);
}
public RelationType getHighlightType() {
return highlightType;
}
public void setHighlightType(RelationType highlightType) {
this.highlightType = highlightType;
}
public ITx getTx() {
return tx;
}
public void setTx(ITx newTx) {
this.tx = newTx;
iRect = new LinkedList<>();
oRect = new LinkedList<>();
scaleFactor = waveCanvas.getScaleFactor();
if (tx != null) {
calculateGeometries();
}
}
protected void calculateGeometries() {
deferredUpdate = false;
ITxStream<?> stream = tx.getStream();
IWaveformPainter painter = waveCanvas.wave2painterMap.get(stream);
if (painter == null) { // stream has been added but painter not yet
// created
deferredUpdate = true;
return;
}
int laneHeight = painter.getHeight() / stream.getMaxConcurrency();
txRectangle = new Rectangle((int) (tx.getBeginTime() / scaleFactor),
waveCanvas.rulerHeight + painter.getVerticalOffset() + laneHeight * tx.getConcurrencyIndex(),
(int) ((tx.getEndTime() - tx.getBeginTime()) / scaleFactor), laneHeight);
deriveGeom(tx.getIncomingRelations(), iRect, false);
deriveGeom(tx.getOutgoingRelations(), oRect, true);
}
protected void deriveGeom(Collection<ITxRelation> relations, List<LinkEntry> res, boolean useTarget) {
for (ITxRelation iTxRelation : relations) {
ITx otherTx = useTarget ? iTxRelation.getTarget() : iTxRelation.getSource();
if (waveCanvas.wave2painterMap.containsKey(otherTx.getStream())) {
ITxStream<?> stream = otherTx.getStream();
IWaveformPainter painter = waveCanvas.wave2painterMap.get(stream);
int laneHeight = painter.getHeight() / stream.getMaxConcurrency();
Rectangle bb = new Rectangle((int) (otherTx.getBeginTime() / scaleFactor),
waveCanvas.rulerHeight + painter.getVerticalOffset()
+ laneHeight * otherTx.getConcurrencyIndex(),
(int) ((otherTx.getEndTime() - otherTx.getBeginTime()) / scaleFactor), laneHeight);
res.add(new LinkEntry(bb, iTxRelation.getRelationType()));
}
}
}
@Override
public void paintArea(GC gc, Rectangle area) {
Color fgColor = waveCanvas.colors[WaveformColors.REL_ARROW.ordinal()];
Color highliteColor = waveCanvas.colors[WaveformColors.REL_ARROW_HIGHLITE.ordinal()];
if (deferredUpdate || (tx != null && waveCanvas.getScaleFactor() != scaleFactor)) {
scaleFactor = waveCanvas.getScaleFactor();
calculateGeometries();
}
for (LinkEntry entry : iRect) {
Point target = drawPath(gc, highlightType.equals(entry.relationType) ? highliteColor : fgColor,
entry.rectangle, txRectangle);
drawArrow(gc, target);
}
for (LinkEntry entry : oRect) {
Point target = drawPath(gc, highlightType.equals(entry.relationType) ? highliteColor : fgColor, txRectangle,
entry.rectangle);
drawArrow(gc, target);
}
}
protected void drawArrow(GC gc, Point target) {
gc.drawLine(target.x - 8, target.y - 5, target.x, target.y);
gc.drawLine(target.x - 8, target.y + 5, target.x, target.y);
}
protected Point drawPath(GC gc, Color fgColor, Rectangle srcRectangle, Rectangle tgtRectangle) {
Point point1 = new Point(0, srcRectangle.y + srcRectangle.height / 2);
Point point2 = new Point(0, tgtRectangle.y + tgtRectangle.height / 2);
point1.x = srcRectangle.x;
point2.x = tgtRectangle.x;
if (point2.x > point1.x + srcRectangle.width)
point1.x += srcRectangle.width;
if (point1.x > point2.x + tgtRectangle.width)
point2.x += tgtRectangle.width;
Path path = new Path(Display.getCurrent());
path.moveTo(point1.x, point1.y);
if (point1.y == point2.y) {
Point center = new Point((point1.x + point2.x) / 2, point1.y - yCtrlOffset);
path.cubicTo(point1.x + xCtrlOffset, point1.y, center.x - xCtrlOffset, center.y, center.x, center.y);
path.cubicTo(center.x + xCtrlOffset, center.y, point2.x - xCtrlOffset, point2.y, point2.x, point2.y);
} else
path.cubicTo(point1.x + xCtrlOffset, point1.y, point2.x - xCtrlOffset, point2.y, point2.x, point2.y);
gc.setAntialias(SWT.ON);
gc.setForeground(fgColor);
gc.drawPath(path);
path.dispose();
return point2;
}
class LinkEntry {
public Rectangle rectangle;
public RelationType relationType;
public LinkEntry(Rectangle rectangle, RelationType relationType) {
super();
this.rectangle = rectangle;
this.relationType = relationType;
}
}
}

View File

@ -1,78 +0,0 @@
/*******************************************************************************
* Copyright (c) 2015 MINRES Technologies GmbH and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* MINRES Technologies GmbH - initial API and implementation
*******************************************************************************/
package com.minres.scviewer.database.swt.internal;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.GC;
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.wb.swt.SWTResourceManager;
public class RulerPainter implements IPainter {
protected WaveformCanvas waveCanvas;
static final int rulerTickMinorC = 10;
static final int rulerTickMajorC = 100;
public RulerPainter(WaveformCanvas waveCanvas) {
this.waveCanvas=waveCanvas;
}
@Override
public void paintArea(GC gc, Rectangle area) {
Color headerFgColor=waveCanvas.getDisplay().getSystemColor(SWT.COLOR_WIDGET_FOREGROUND);
if(headerFgColor.isDisposed())
headerFgColor=SWTResourceManager.getColor(0,0,0);
Color headerBgColor = waveCanvas.getDisplay().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND);
if(headerBgColor.isDisposed())
headerBgColor=SWTResourceManager.getColor(255,255,255);
String unit=waveCanvas.getUnitStr();
int unitMultiplier=waveCanvas.getUnitMultiplier();
long scaleFactor=waveCanvas.getScaleFactor();
long zoomLevel = waveCanvas.getZoomLevel();
long start=area.x*scaleFactor;
long end=start+area.width*scaleFactor;
long rulerTickMinor = rulerTickMinorC*scaleFactor;
long rulerTickMajor = rulerTickMajorC*scaleFactor;
if(zoomLevel%3==1){
rulerTickMinor/=3;
rulerTickMajor/=3;
}
int minorTickY = waveCanvas.rulerHeight-5;
int majorTickY = waveCanvas.rulerHeight-15;
int textY=waveCanvas.rulerHeight-20;
int baselineY=waveCanvas.rulerHeight - 1;
int bottom=waveCanvas.rulerHeight - 2;
long startMinorIncr = start;
long modulo = start % rulerTickMinor;
startMinorIncr+=rulerTickMinor-modulo;
gc.setBackground(waveCanvas.getDisplay().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND));
gc.fillRectangle(new Rectangle(area.x, area.y, area.width, waveCanvas.rulerHeight));
gc.setBackground(headerBgColor);
gc.fillRectangle(new Rectangle(area.x, area.y, area.width, baselineY));
gc.setForeground(headerFgColor);
gc.drawLine(area.x, area.y+bottom, area.x+area.width, area.y+bottom);
for (long tick = startMinorIncr; tick < end; tick += rulerTickMinor) {
int x0 = (int) (tick/scaleFactor);
if ((tick % rulerTickMajor) == 0) {
gc.drawText(Double.toString(tick/scaleFactor*unitMultiplier)+unit, x0, area.y+textY);
gc.drawLine(x0, area.y+majorTickY, x0,area.y+ bottom);
} else {
gc.drawLine(x0, area.y+minorTickY, x0, area.y+bottom);
}
}
}
}

View File

@ -1,145 +0,0 @@
/*******************************************************************************
* Copyright (c) 2015 MINRES Technologies GmbH and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* MINRES Technologies GmbH - initial API and implementation
*******************************************************************************/
package com.minres.scviewer.database.swt.internal;
import java.util.Map.Entry;
import java.util.NavigableMap;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.GC;
import org.eclipse.swt.graphics.Rectangle;
import com.minres.scviewer.database.ISignal;
import com.minres.scviewer.database.ISignalChange;
import com.minres.scviewer.database.ISignalChangeMulti;
import com.minres.scviewer.database.ISignalChangeSingle;
import com.minres.scviewer.database.ui.TrackEntry;
import com.minres.scviewer.database.ui.WaveformColors;
public class SignalPainter extends TrackPainter {
/**
*
*/
private final WaveformCanvas waveCanvas;
private ISignal<? extends ISignalChange> signal;
public SignalPainter(WaveformCanvas txDisplay, boolean even, TrackEntry trackEntry) {
super(trackEntry, even);
this.waveCanvas = txDisplay;
this.signal=trackEntry.getSignal();
}
public void paintArea(GC gc, Rectangle area) {
if(trackEntry.selected)
gc.setBackground(this.waveCanvas.colors[WaveformColors.TRACK_BG_HIGHLITE.ordinal()]);
else
gc.setBackground(this.waveCanvas.colors[even?WaveformColors.TRACK_BG_EVEN.ordinal():WaveformColors.TRACK_BG_ODD.ordinal()]);
gc.setFillRule(SWT.FILL_EVEN_ODD);
gc.fillRectangle(area);
Entry<Long, ? extends ISignalChange> firstChange=signal.getEvents().floorEntry(area.x*this.waveCanvas.getScaleFactor());
Entry<Long, ? extends ISignalChange> lastTx=signal.getEvents().ceilingEntry((area.x+area.width)*this.waveCanvas.getScaleFactor());
if(firstChange==null){
if(lastTx==null) return;
firstChange = signal.getEvents().firstEntry();
} else if(lastTx==null){
lastTx=signal.getEvents().lastEntry();
}
gc.setForeground(this.waveCanvas.colors[WaveformColors.LINE.ordinal()]);
gc.setLineStyle(SWT.LINE_SOLID);
gc.setLineWidth(1);
Entry<Long, ? extends ISignalChange> left=firstChange;
if(left.getValue() instanceof ISignalChangeSingle){
NavigableMap<Long, ? extends ISignalChange> entries=signal.getEvents().subMap(firstChange.getKey(), false, lastTx.getKey(), true);
for(Entry<Long, ? extends ISignalChange> right:entries.entrySet()){
int xEnd= (int)(right.getKey()/this.waveCanvas.getScaleFactor());
int xBegin= (int)(left.getKey()/this.waveCanvas.getScaleFactor());
if(xEnd>xBegin){
int yOffset = this.waveCanvas.getTrackHeight()/2;
Color color = this.waveCanvas.colors[WaveformColors.SIGNALX.ordinal()];
switch(((ISignalChangeSingle) left.getValue()).getValue()){
case '1':
color=this.waveCanvas.colors[WaveformColors.SIGNAL1.ordinal()];
yOffset = this.waveCanvas.getTrackHeight()/5;
break;
case '0':
color=this.waveCanvas.colors[WaveformColors.SIGNAL0.ordinal()];
yOffset = 4*this.waveCanvas.getTrackHeight()/5;
break;
case 'Z':
color=this.waveCanvas.colors[WaveformColors.SIGNALZ.ordinal()];
break;
default:
}
yOffset+=area.y;
gc.setForeground(color);
gc.drawLine(xBegin, yOffset, xEnd, yOffset);
int yNext = this.waveCanvas.getTrackHeight()/2;
switch(((ISignalChangeSingle) right.getValue()).getValue()){
case '1':
yNext = this.waveCanvas.getTrackHeight()/5+area.y;
break;
case '0':
yNext = 4*this.waveCanvas.getTrackHeight()/5+area.y;
break;
default:
}
gc.drawLine(xEnd, yOffset, xEnd, yNext);
}
left=right;
}
} else if(left.getValue() instanceof ISignalChangeMulti){
NavigableMap<Long,? extends ISignalChange> entries=signal.getEvents().subMap(firstChange.getKey(), false, lastTx.getKey(), true);
for(Entry<Long, ? extends ISignalChange> right:entries.entrySet()){
int yOffsetT = this.waveCanvas.getTrackHeight()/5+area.y;
int yOffsetM = this.waveCanvas.getTrackHeight()/2+area.y;
int yOffsetB = 4*this.waveCanvas.getTrackHeight()/5+area.y;
Color colorBorder = this.waveCanvas.colors[WaveformColors.SIGNAL0.ordinal()];
ISignalChangeMulti last = (ISignalChangeMulti) left.getValue();
if(last.getValue().toString().contains("X")){
colorBorder=this.waveCanvas.colors[WaveformColors.SIGNALX.ordinal()];
}else if(last.getValue().toString().contains("Z")){
colorBorder=this.waveCanvas.colors[WaveformColors.SIGNALZ.ordinal()];
}
int beginTime= (int)(left.getKey()/this.waveCanvas.getScaleFactor());
int endTime= (int)(right.getKey()/this.waveCanvas.getScaleFactor());
int[] points = {
beginTime,yOffsetM,
beginTime+1,yOffsetT,
endTime-1,yOffsetT,
endTime,yOffsetM,
endTime-1,yOffsetB,
beginTime+1,yOffsetB
};
gc.setForeground(colorBorder);
gc.drawPolygon(points);
gc.setForeground(this.waveCanvas.colors[WaveformColors.SIGNAL_TEXT.ordinal()]);
int size = gc.getDevice().getDPI().y * gc.getFont().getFontData()[0].getHeight()/72;
if(beginTime<area.x) beginTime=area.x;
int width=endTime-beginTime;
if(width>6) {
Rectangle old = gc.getClipping();
gc.setClipping(beginTime+3, yOffsetT, endTime-beginTime-5, yOffsetB-yOffsetT);
gc.drawText("h'"+last.getValue().toHexString(), beginTime+3, yOffsetM-size/2-1);
gc.setClipping(old);
}
left=right;
}
}
}
public ISignal<? extends ISignalChange> getSignal() {
return signal;
}
}

View File

@ -1,159 +0,0 @@
/*******************************************************************************
* Copyright (c) 2015 MINRES Technologies GmbH and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* MINRES Technologies GmbH - initial API and implementation
*******************************************************************************/
package com.minres.scviewer.database.swt.internal;
import java.util.Collection;
import java.util.List;
import java.util.Map.Entry;
import java.util.NavigableMap;
import java.util.TreeSet;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.GC;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.graphics.Rectangle;
import com.minres.scviewer.database.ITx;
import com.minres.scviewer.database.ITxEvent;
import com.minres.scviewer.database.ITxStream;
import com.minres.scviewer.database.ui.TrackEntry;
import com.minres.scviewer.database.ui.WaveformColors;
public class StreamPainter extends TrackPainter{
/**
*
*/
private final WaveformCanvas waveCanvas;
private ITxStream<? extends ITxEvent> stream;
private int txBase, txHeight;
private boolean even;
private TreeSet<ITx> seenTx;
public StreamPainter(WaveformCanvas waveCanvas, boolean even, TrackEntry trackEntry) {
super(trackEntry, even);
this.waveCanvas = waveCanvas;
this.stream=trackEntry.getStream();
this.seenTx=new TreeSet<ITx>();
}
@SuppressWarnings("unchecked")
public void paintArea(GC gc, Rectangle area) {
if(stream.getEvents().size()==0) return;
int trackHeight=trackEntry.height/stream.getMaxConcurrency();
txBase=trackHeight/5;
txHeight=trackHeight*3/5;
if(trackEntry.selected)
gc.setBackground(this.waveCanvas.colors[WaveformColors.TRACK_BG_HIGHLITE.ordinal()]);
else
gc.setBackground(this.waveCanvas.colors[even?WaveformColors.TRACK_BG_EVEN.ordinal():WaveformColors.TRACK_BG_ODD.ordinal()]);
gc.setFillRule(SWT.FILL_EVEN_ODD);
gc.fillRectangle(area);
Entry<Long, ?> firstTx=stream.getEvents().floorEntry(area.x*waveCanvas.getScaleFactor());
Entry<Long, ?> lastTx=stream.getEvents().ceilingEntry((area.x+area.width)*waveCanvas.getScaleFactor());
if(firstTx==null) firstTx = stream.getEvents().firstEntry();
if(lastTx==null) lastTx=stream.getEvents().lastEntry();
gc.setFillRule(SWT.FILL_EVEN_ODD);
gc.setLineStyle(SWT.LINE_SOLID);
gc.setLineWidth(1);
gc.setForeground(this.waveCanvas.colors[WaveformColors.LINE.ordinal()]);
for(int y1=area.y+trackHeight/2; y1<area.y+trackEntry.height; y1+=trackHeight)
gc.drawLine(area.x, y1, area.x+area.width, y1);
if(firstTx==lastTx)
for(ITxEvent txEvent:(Collection<? extends ITxEvent>)firstTx.getValue())
drawTx(gc, area, txEvent.getTransaction());
else{
seenTx.clear();
NavigableMap<Long,?> entries = stream.getEvents().subMap(firstTx.getKey(), true, lastTx.getKey(), true);
boolean highlighed=false;
gc.setForeground(this.waveCanvas.colors[WaveformColors.LINE.ordinal()]);
gc.setBackground(this.waveCanvas.colors[WaveformColors.TX_BG.ordinal()]);
for(Entry<Long, ?> entry: entries.entrySet())
for(ITxEvent txEvent:(Collection<? extends ITxEvent>)entry.getValue()){
if(txEvent.getType()==ITxEvent.Type.BEGIN)
seenTx.add(txEvent.getTransaction());
if(txEvent.getType()==ITxEvent.Type.END){
ITx tx = txEvent.getTransaction();
highlighed|=waveCanvas.currentSelection!=null && waveCanvas.currentSelection.equals(tx);
drawTx(gc, area, tx);
seenTx.remove(tx);
}
}
for(ITx tx:seenTx){
drawTx(gc, area, tx);
}
if(highlighed){
gc.setForeground(this.waveCanvas.colors[WaveformColors.LINE_HIGHLITE.ordinal()]);
gc.setBackground(this.waveCanvas.colors[WaveformColors.TX_BG_HIGHLITE.ordinal()]);
drawTx(gc, area, waveCanvas.currentSelection);
}
}
}
protected void drawTx(GC gc, Rectangle area, ITx tx) {
int offset = tx.getConcurrencyIndex()*this.waveCanvas.getTrackHeight();
Rectangle bb = new Rectangle(
(int)(tx.getBeginTime()/this.waveCanvas.getScaleFactor()), area.y+offset+txBase,
(int)((tx.getEndTime()-tx.getBeginTime())/this.waveCanvas.getScaleFactor()), txHeight);
if(bb.x+bb.width<area.x || bb.x>area.x+area.width) return;
if(bb.width==0){
gc.drawLine(bb.x, bb.y, bb.x, bb.y+bb.height);
} else if(bb.width<10){
gc.fillRectangle(bb);
gc.drawRectangle(bb);
} else {
gc.fillRoundRectangle(bb.x, bb.y, bb.width, bb.height, 5, 5);
gc.drawRoundRectangle(bb.x, bb.y, bb.width, bb.height, 5, 5);
}
}
public ITx getClicked(Point point) {
int lane=point.y/waveCanvas.getTrackHeight();
Entry<Long, List<ITxEvent>> firstTx=stream.getEvents().floorEntry(point.x*waveCanvas.getScaleFactor());
if(firstTx!=null){
do {
ITx tx = getTxFromEntry(lane, point.x, firstTx);
if(tx!=null) return tx;
firstTx=stream.getEvents().lowerEntry(firstTx.getKey());
}while(firstTx!=null);
}
return null;
}
public ITxStream<? extends ITxEvent> getStream() {
return stream;
}
public void setStream(ITxStream<? extends ITxEvent> stream) {
this.stream = stream;
}
protected ITx getTxFromEntry(int lane, int offset, Entry<Long, List<ITxEvent>> firstTx) {
long timePoint=offset*waveCanvas.getScaleFactor();
for(ITxEvent evt:firstTx.getValue()){
ITx tx=evt.getTransaction();
if(evt.getType()==ITxEvent.Type.BEGIN && tx.getConcurrencyIndex()==lane && tx.getBeginTime()<=timePoint && tx.getEndTime()>=timePoint){
return evt.getTransaction();
}
}
// now with some fuzziness
timePoint=(offset-5)*waveCanvas.getScaleFactor();
long timePointHigh=(offset+5)*waveCanvas.getScaleFactor();
for(ITxEvent evt:firstTx.getValue()){
ITx tx=evt.getTransaction();
if(evt.getType()==ITxEvent.Type.BEGIN && tx.getConcurrencyIndex()==lane && tx.getBeginTime()<=timePointHigh && tx.getEndTime()>=timePoint){
return evt.getTransaction();
}
}
return null;
}
}

View File

@ -1,513 +0,0 @@
/*******************************************************************************
* Copyright (c) 2015 MINRES Technologies GmbH and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* MINRES Technologies GmbH - initial API and implementation
*******************************************************************************/
package com.minres.scviewer.database.swt.internal;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map.Entry;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.ControlAdapter;
import org.eclipse.swt.events.ControlEvent;
import org.eclipse.swt.events.PaintEvent;
import org.eclipse.swt.events.PaintListener;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.GC;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.graphics.RGB;
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.graphics.Transform;
import org.eclipse.swt.widgets.Canvas;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.ScrollBar;
import org.eclipse.wb.swt.SWTResourceManager;
import com.google.common.collect.Lists;
import com.minres.scviewer.database.ITx;
import com.minres.scviewer.database.IWaveform;
import com.minres.scviewer.database.IWaveformEvent;
import com.minres.scviewer.database.RelationType;
import com.minres.scviewer.database.ui.IWaveformViewer;
import com.minres.scviewer.database.ui.WaveformColors;
public class WaveformCanvas extends Canvas {
Color[] colors = new Color[WaveformColors.values().length];
private int trackHeight = 50;
private long scaleFactor = 1000000L; // 1ns
String unit="ns";
private int level = 12;
public final static String[] unitString={"fs", "ps", "ns", "µs", "ms"};//, "s"};
public final static int[] unitMultiplier={1, 3, 10, 30, 100, 300};
private long maxTime;
protected Point origin; /* original size */
protected Transform transform;
protected int rulerHeight=40;
protected List<IPainter> painterList;
ITx currentSelection;
private List<SelectionAdapter> selectionListeners;
private RulerPainter rulerPainter;
private TrackAreaPainter trackAreaPainter;
private ArrowPainter arrowPainter;
private List<CursorPainter> cursorPainters;
HashMap<IWaveform<?>, IWaveformPainter> wave2painterMap;
/**
* Constructor for ScrollableCanvas.
*
* @param parent
* the parent of this control.
* @param style
* the style of this control.
*/
public WaveformCanvas(final Composite parent, int style) {
super(parent, style | SWT.DOUBLE_BUFFERED | SWT.NO_BACKGROUND | SWT.NO_REDRAW_RESIZE | SWT.V_SCROLL | SWT.H_SCROLL);
addControlListener(new ControlAdapter() { /* resize listener. */
public void controlResized(ControlEvent event) {
syncScrollBars();
}
});
addPaintListener(new PaintListener() { /* paint listener. */
public void paintControl(final PaintEvent event) {
paint(event.gc);
}
});
painterList = new LinkedList<IPainter>();
origin = new Point(0, 0);
transform = new Transform(getDisplay());
selectionListeners = new LinkedList<>();
cursorPainters= new ArrayList<>();
wave2painterMap=new HashMap<>();
initScrollBars();
initColors(null);
// order is important: it is bottom to top
trackAreaPainter=new TrackAreaPainter(this);
painterList.add(trackAreaPainter);
rulerPainter=new RulerPainter(this);
painterList.add(rulerPainter);
arrowPainter=new ArrowPainter(this, IWaveformViewer.NEXT_PREV_IN_STREAM);
painterList.add(arrowPainter);
CursorPainter cp = new CursorPainter(this, scaleFactor * 10, cursorPainters.size()-1);
painterList.add(cp);
cursorPainters.add(cp);
CursorPainter marker = new CursorPainter(this, scaleFactor * 100, cursorPainters.size()-1);
painterList.add(marker);
cursorPainters.add(marker);
wave2painterMap=new HashMap<>();
}
public void addCursoPainter(CursorPainter cursorPainter){
painterList.add(cursorPainter);
cursorPainters.add(cursorPainter);
}
public void initColors(HashMap<WaveformColors, RGB> colourMap) {
Display d = getDisplay();
if (colourMap != null) {
for (WaveformColors c : WaveformColors.values()) {
if (colourMap.containsKey(c)) {
colors[c.ordinal()] = new Color(d, colourMap.get(c));
}
}
redraw();
} else {
colors[WaveformColors.LINE.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_RED);
colors[WaveformColors.LINE_HIGHLITE.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_CYAN);
colors[WaveformColors.TRACK_BG_EVEN.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_BLACK);
colors[WaveformColors.TRACK_BG_ODD.ordinal()] = SWTResourceManager.getColor(40, 40, 40);
colors[WaveformColors.TRACK_BG_HIGHLITE.ordinal()] = SWTResourceManager.getColor(40, 40, 80);
colors[WaveformColors.TX_BG.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_GREEN);
colors[WaveformColors.TX_BG_HIGHLITE.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_DARK_GREEN);
colors[WaveformColors.TX_BORDER.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_RED);
colors[WaveformColors.SIGNAL0.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_DARK_GREEN);
colors[WaveformColors.SIGNAL1.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_DARK_GREEN);
colors[WaveformColors.SIGNALZ.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_GRAY);
colors[WaveformColors.SIGNALX.ordinal()] = SWTResourceManager.getColor(255, 128, 182);
colors[WaveformColors.SIGNAL_TEXT.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_WHITE);
colors[WaveformColors.CURSOR.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_RED);
colors[WaveformColors.CURSOR_DRAG.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_GRAY);
colors[WaveformColors.CURSOR_TEXT.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_WHITE);
colors[WaveformColors.MARKER.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_DARK_GRAY);
colors[WaveformColors.MARKER_TEXT.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_WHITE);
colors[WaveformColors.REL_ARROW.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_MAGENTA);
colors[WaveformColors.REL_ARROW_HIGHLITE.ordinal()] = SWTResourceManager.getColor(255, 128, 255);
}
}
public void setHighliteRelation(RelationType relationType){
if(arrowPainter!=null){
boolean redraw = arrowPainter.getHighlightType()!=relationType;
arrowPainter.setHighlightType(relationType);
if(redraw) redraw();
}
}
public Point getOrigin() {
return origin;
}
public void setOrigin(Point origin) {
setOrigin(origin.x, origin.y);
}
public void setOrigin(int x, int y) {
checkWidget();
ScrollBar hBar = getHorizontalBar();
hBar.setSelection(-x);
x = -hBar.getSelection();
ScrollBar vBar = getVerticalBar();
vBar.setSelection(-y);
y = -vBar.getSelection();
origin.x = x;
origin.y = y;
syncScrollBars();
}
public long getMaxTime() {
return maxTime;
}
public void setMaxTime(long maxTime) {
this.maxTime = maxTime;
syncScrollBars();
}
public int getTrackHeight() {
return trackHeight;
}
public void setTrackHeight(int trackHeight) {
this.trackHeight = trackHeight;
syncScrollBars();
}
public int getZoomLevel() {
return level;
}
public int getMaxZoomLevel(){
return unitMultiplier.length*unitString.length-1;
}
public void setZoomLevel(int level) {
long oldScaleFactor=scaleFactor;
if(level<unitMultiplier.length*unitString.length){
this.level = level;
this.scaleFactor = (long) Math.pow(10, level/2);
if(level%2==1) this.scaleFactor*=3;
ITx tx = arrowPainter.getTx();
arrowPainter.setTx(null);
/*
* xc = tc/oldScaleFactor
* xoffs = xc+origin.x
* xcn = tc/newScaleFactor
* t0n = (xcn-xoffs)*scaleFactor
*/
long tc=cursorPainters.get(0).getTime(); // cursor time
long xc=tc/oldScaleFactor; // cursor total x-offset
long xoffs=xc+origin.x; // cursor offset relative to left border
long xcn=tc/scaleFactor; // new total x-offset
long originX=xcn-xoffs;
if(originX>0)
origin.x=(int) -originX; // new cursor time offset relative to left border
else
origin.x=0;
syncScrollBars();
arrowPainter.setTx(tx);
redraw();
}
}
public long getScaleFactor() {
return scaleFactor;
}
public long getScaleFactorPow10() {
int scale = level/unitMultiplier.length;
double res = Math.pow(1000, scale);
return (long) res;
}
public String getUnitStr(){
return unitString[level/unitMultiplier.length];
}
public int getUnitMultiplier(){
return unitMultiplier[level%unitMultiplier.length];
}
public long getTimeForOffset(int xOffset){
return (xOffset-origin.x) * scaleFactor;
}
public void addPainter(IPainter painter) {
painterList.add(painter);
redraw();
}
public void removePainter(IPainter painter) {
painterList.remove(painter);
redraw();
}
public void clearAllWaveformPainter() {
trackAreaPainter.getTrackVerticalOffset().clear();
wave2painterMap.clear();
syncScrollBars();
}
public void addWaveformPainter(IWaveformPainter painter) {
trackAreaPainter.addTrackPainter(painter);
wave2painterMap.put(painter.getTrackEntry().waveform, painter);
syncScrollBars();
}
public List<CursorPainter> getCursorPainters() {
return cursorPainters;
}
/**
* Dispose the garbage here
*/
public void dispose() {
transform.dispose();
for (WaveformColors c : WaveformColors.values())
colors[c.ordinal()].dispose();
super.dispose();
}
/* Initalize the scrollbar and register listeners. */
private void initScrollBars() {
ScrollBar horizontal = getHorizontalBar();
horizontal.setEnabled(false);
horizontal.setVisible(true);
horizontal.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
if (painterList.size() == 0)
return;
setOrigin(-((ScrollBar) event.widget).getSelection(), origin.y);
}
});
ScrollBar vertical = getVerticalBar();
vertical.setEnabled(false);
vertical.setVisible(true);
vertical.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
if (painterList.size() == 0)
return;
setOrigin(origin.x, -((ScrollBar) event.widget).getSelection());
}
});
}
/**
* Synchronize the scrollbar with the image. If the transform is out of
* range, it will correct it. This function considers only following factors
* :<b> transform, image size, client area</b>.
*/
public void syncScrollBars() {
if (painterList.size() == 0) {
redraw();
return;
}
int height = trackAreaPainter.getHeight();
int width = (int) (maxTime / scaleFactor);
ScrollBar horizontal = getHorizontalBar();
horizontal.setIncrement((int) (getClientArea().width / 100));
horizontal.setPageIncrement(getClientArea().width);
int cw = getClientArea().width;
if (width > cw) { /* image is wider than client area */
horizontal.setMaximum(width);
horizontal.setEnabled(true);
if (((int) -origin.x) > horizontal.getMaximum() - cw)
origin.x = -horizontal.getMaximum() + cw;
} else { /* image is narrower than client area */
horizontal.setEnabled(false);
}
horizontal.setSelection(-origin.x);
horizontal.setThumb(cw);
ScrollBar vertical = getVerticalBar();
vertical.setIncrement((int) (getClientArea().height / 100));
vertical.setPageIncrement((int) (getClientArea().height));
int ch = getClientArea().height;
if (height > ch) { /* image is higher than client area */
vertical.setMaximum(height);
vertical.setEnabled(true);
if (((int) -origin.y) > vertical.getMaximum() - ch)
origin.y = -vertical.getMaximum() + ch;
} else { /* image is less higher than client area */
vertical.setMaximum((int) (ch));
vertical.setEnabled(false);
}
vertical.setSelection(-origin.y);
vertical.setThumb(ch);
redraw();
fireSelectionEvent();
}
/* Paint function */
private void paint(GC gc) {
Rectangle clientRect = getClientArea(); /* Canvas' painting area */
clientRect.x = -origin.x;
clientRect.y = -origin.y;
// reset the transform
transform.identity();
// shift the content
transform.translate(origin.x, origin.y);
gc.setTransform(transform);
gc.setClipping(clientRect);
if (painterList.size() > 0 ) {
for (IPainter painter : painterList)
painter.paintArea(gc, clientRect);
} else {
gc.fillRectangle(clientRect);
initScrollBars();
}
}
public List<Object> getClicked(Point point) {
LinkedList<Object> result=new LinkedList<>();
for (IPainter p : Lists.reverse(painterList)) {
if (p instanceof TrackAreaPainter) {
int y = point.y - origin.y;
int x = point.x - origin.x;
Entry<Integer, IWaveformPainter> entry = trackAreaPainter.getTrackVerticalOffset().floorEntry(y);
if (entry != null) {
if (entry.getValue() instanceof StreamPainter) {
ITx tx = ((StreamPainter) entry.getValue()).getClicked(new Point(x, y - entry.getKey()));
if(tx!=null)
result.add(tx);
}
result.add(entry.getValue().getTrackEntry());
}
} else if (p instanceof CursorPainter) {
if (Math.abs(point.x - origin.x - ((CursorPainter) p).getTime()/scaleFactor) < 2) {
result.add(p);
}
}
}
return result;
}
public List<Object> getEntriesAtPosition(IWaveform<? extends IWaveformEvent> iWaveform, int i) {
LinkedList<Object> result=new LinkedList<>();
int x = i - origin.x;
for(IPainter p: wave2painterMap.values()){
if (p instanceof StreamPainter && ((StreamPainter)p).getStream()==iWaveform) {
result.add(((StreamPainter) p).getClicked(new Point(x, trackHeight/2)));
}
}
return result;
}
public void setSelected(ITx currentSelection) {
this.currentSelection = currentSelection;
if (currentSelection != null)
reveal(currentSelection);
arrowPainter.setTx(currentSelection);
redraw();
}
public void reveal(ITx tx) {
int lower = (int) (tx.getBeginTime() / scaleFactor);
int higher = (int) (tx.getEndTime() / scaleFactor);
Point size = getSize();
size.x -= getVerticalBar().getSize().x + 2;
size.y -= getHorizontalBar().getSize().y;
if (lower < -origin.x) {
setOrigin(-lower, origin.y);
} else if (higher > (size.x - origin.x)) {
setOrigin(size.x - higher, origin.y);
}
for (IWaveformPainter painter : wave2painterMap.values()) {
if (painter instanceof StreamPainter && ((StreamPainter) painter).getStream() == tx.getStream()) {
int top = painter.getVerticalOffset() + trackHeight * tx.getConcurrencyIndex();
int bottom = top + trackHeight;
if (top < -origin.y) {
setOrigin(origin.x, -(top-trackHeight));
} else if (bottom > (size.y - origin.y)) {
setOrigin(origin.x, size.y - bottom);
}
}
}
}
public void reveal(long time) {
int scaledTime = (int) (time / scaleFactor);
Point size = getSize();
size.x -= getVerticalBar().getSize().x + 2;
size.y -= getHorizontalBar().getSize().y;
if (scaledTime < -origin.x) {
setOrigin(-scaledTime+10, origin.y);
} else if (scaledTime > (size.x - origin.x)) {
setOrigin(size.x - scaledTime-30, origin.y);
}
}
public int getRulerHeight() {
return rulerHeight;
}
public void setRulerHeight(int rulerHeight) {
this.rulerHeight = rulerHeight;
}
public void addSelectionListener(SelectionAdapter selectionAdapter) {
selectionListeners.add(selectionAdapter);
}
public void removeSelectionListener(SelectionAdapter selectionAdapter) {
selectionListeners.remove(selectionAdapter);
}
/**
*
*/
protected void fireSelectionEvent() {
Event e = new Event();
e.widget = this;
e.detail=SWT.SELECTED;
e.type=SWT.Selection;
SelectionEvent ev = new SelectionEvent(e);
ev.x = origin.x;
ev.y = origin.y;
for (SelectionAdapter a : selectionListeners) {
a.widgetSelected(ev);
}
}
}

View File

@ -1,7 +0,0 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
org.eclipse.jdt.core.compiler.compliance=1.7
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.7

View File

@ -1,10 +0,0 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Database UI
Bundle-SymbolicName: com.minres.scviewer.database.ui
Bundle-Version: 1.0.0.qualifier
Bundle-Vendor: MINRES Technologies GmbH
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
Export-Package: com.minres.scviewer.database.ui
Require-Bundle: com.minres.scviewer.database,
org.eclipse.jface

View File

@ -1,4 +0,0 @@
source.. = src/
output.. = bin/
bin.includes = META-INF/,\
.

View File

@ -1,103 +0,0 @@
/*******************************************************************************
* Copyright (c) 2015 MINRES Technologies GmbH and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* MINRES Technologies GmbH - initial API and implementation
*******************************************************************************/
package com.minres.scviewer.database.ui;
import java.beans.PropertyChangeListener;
import java.util.HashMap;
import java.util.List;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.ISelectionProvider;
import org.eclipse.swt.graphics.RGB;
import org.eclipse.swt.widgets.Control;
import com.minres.scviewer.database.IWaveform;
import com.minres.scviewer.database.RelationType;
public interface IWaveformViewer extends PropertyChangeListener, ISelectionProvider{
String CURSOR_PROPERTY = "cursor_time";
String MARKER_PROPERTY = "marker_time";
public static final RelationType NEXT_PREV_IN_STREAM = RelationType.create("Prev/Next in stream");
public void addSelectionChangedListener(ISelectionChangedListener listener);
public void removeSelectionChangedListener(ISelectionChangedListener listener);
public Control getControl();
public Control getNameControl();
public Control getValueControl();
public Control getWaveformControl();
public ISelection getSelection();
public void setSelection(ISelection selection);
public void setSelection(ISelection selection, boolean addIfNeeded);
public void moveSelection(GotoDirection direction);
public void moveSelection(GotoDirection direction, RelationType relationType);
public void moveCursor(GotoDirection direction);
public List<TrackEntry> getStreamList();
public TrackEntry getEntryForStream(IWaveform<?> source);
public void moveSelectedTrack(int i);
public void setHighliteRelation(RelationType relationType);
public long getMaxTime();
public void setMaxTime(long maxTime);
public void setZoomLevel(int scale);
public int getZoomLevel();
public void setCursorTime(long time);
public void setMarkerTime(long time, int index);
public long getCursorTime();
public int getSelectedMarkerId();
public long getMarkerTime(int index);
public void addPropertyChangeListener(PropertyChangeListener listener);
public void addPropertyChangeListener(String propertyName, PropertyChangeListener listener);
public void removePropertyChangeListener(PropertyChangeListener listener);
public void removePropertyChangeListener(String propertyName, PropertyChangeListener listener);
public String getScaledTime(long time);
public String[] getZoomLevels();
public List<ICursor> getCursorList();
public void setColors(HashMap<WaveformColors, RGB> colourMap);
public long getBaselineTime();
public void setBaselineTime(Long scale);
}

View File

@ -1,60 +0,0 @@
/*******************************************************************************
* Copyright (c) 2015 MINRES Technologies GmbH and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* MINRES Technologies GmbH - initial API and implementation
*******************************************************************************/
package com.minres.scviewer.database.ui;
import com.minres.scviewer.database.ISignal;
import com.minres.scviewer.database.ISignalChange;
import com.minres.scviewer.database.ITxEvent;
import com.minres.scviewer.database.ITxStream;
import com.minres.scviewer.database.IWaveform;
import com.minres.scviewer.database.IWaveformEvent;
public class TrackEntry {
final public IWaveform<? extends IWaveformEvent> waveform;
public int vOffset;
public int height;
public boolean selected;
public TrackEntry(IWaveform<? extends IWaveformEvent> waveform) {
this.waveform = waveform;
vOffset=0;
height=0;
selected=false;
}
public boolean isStream(){
return waveform instanceof ITxStream<?>;
}
public ITxStream<? extends ITxEvent> getStream(){
return (ITxStream<?>) waveform;
}
public boolean isSignal(){
return waveform instanceof ISignal<?>;
}
public ISignal<? extends ISignalChange> getSignal(){
return (ISignal<?>) waveform;
}
@Override
public boolean equals(Object obj) {
if(obj instanceof TrackEntry){
TrackEntry o = (TrackEntry) obj;
return waveform==o.waveform && vOffset==o.vOffset;
}
return false;
}
}

View File

@ -1,7 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src/"/>
<classpathentry kind="output" path="target/classes"/>
</classpath>

View File

@ -1,7 +0,0 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
org.eclipse.jdt.core.compiler.compliance=1.7
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.7

View File

@ -1,192 +0,0 @@
/*******************************************************************************
* Copyright (c) 2015 MINRES Technologies GmbH and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* MINRES Technologies GmbH - initial API and implementation
*******************************************************************************/
package com.minres.scviewer.database.vcd;
import java.io.File;
import java.io.FileInputStream;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Stack;
import java.util.TreeMap;
import java.util.Vector;
import com.minres.scviewer.database.BitVector;
import com.minres.scviewer.database.ISignal;
import com.minres.scviewer.database.ISignalChange;
import com.minres.scviewer.database.ISignalChangeMulti;
import com.minres.scviewer.database.ISignalChangeSingle;
import com.minres.scviewer.database.IWaveform;
import com.minres.scviewer.database.IWaveformDb;
import com.minres.scviewer.database.IWaveformDbLoader;
import com.minres.scviewer.database.IWaveformEvent;
import com.minres.scviewer.database.InputFormatException;
import com.minres.scviewer.database.RelationType;
/**
* The Class VCDDb.
*/
public class VCDDbLoader implements IWaveformDbLoader, IVCDDatabaseBuilder {
/** The Constant TIME_RES. */
private static final Long TIME_RES = 1000L; // ps;
/** The db. */
private IWaveformDb db;
/** The module stack. */
private Stack<String> moduleStack;
/** The signals. */
private List<IWaveform<? extends IWaveformEvent>> signals;
/** The max time. */
private long maxTime;
/**
* Instantiates a new VCD db.
*/
public VCDDbLoader() {
}
/** The date bytes. */
private byte[] dateBytes = "$date".getBytes();
/* (non-Javadoc)
* @see com.minres.scviewer.database.ITrDb#load(java.io.File)
*/
@SuppressWarnings("unchecked")
@Override
public boolean load(IWaveformDb db, File file) throws Exception {
this.db=db;
FileInputStream fis = new FileInputStream(file);
byte[] buffer = new byte[dateBytes.length];
int read = fis.read(buffer, 0, dateBytes.length);
fis.close();
if (read == dateBytes.length)
for (int i = 0; i < dateBytes.length; i++)
if (buffer[i] != dateBytes[i])
return false;
signals = new Vector<IWaveform<? extends IWaveformEvent>>();
moduleStack= new Stack<String>();
boolean res = new VCDFileParser(false).load(new FileInputStream(file), this);
moduleStack=null;
if(!res) throw new InputFormatException();
// calculate max time of database
for(IWaveform<? extends IWaveformEvent> waveform:signals)
maxTime= Math.max(maxTime, ((ISignal<? extends ISignalChange>)waveform).getEvents().lastKey());
// extend signals to hav a last value set at max time
for(IWaveform<? extends IWaveformEvent> waveform:signals){
TreeMap<Long,? extends ISignalChange> events = ((VCDSignal<? extends ISignalChange>)waveform).values;
if(events.lastKey()<maxTime){
ISignalChange x = events.lastEntry().getValue();
if(x instanceof ISignalChangeSingle)
((VCDSignal<ISignalChangeSingle>)waveform).values.put(maxTime,
new VCDSignalChangeSingle(maxTime, ((ISignalChangeSingle)x).getValue()));
else
if(x instanceof ISignalChangeMulti)
((VCDSignal<ISignalChangeMulti>)waveform).values.put(maxTime,
new VCDSignalChangeMulti(maxTime, ((ISignalChangeMulti)x).getValue()));
}
}
return true;
}
/* (non-Javadoc)
* @see com.minres.scviewer.database.ITrDb#getMaxTime()
*/
@Override
public Long getMaxTime() {
return maxTime;
}
/* (non-Javadoc)
* @see com.minres.scviewer.database.ITrDb#getAllWaves()
*/
@Override
public List<IWaveform<? extends IWaveformEvent>> getAllWaves() {
return signals;
}
/* (non-Javadoc)
* @see com.minres.scviewer.database.vcd.ITraceBuilder#enterModule(java.lang.String)
*/
@Override
public void enterModule(String tokenString) {
if(moduleStack.isEmpty())
moduleStack.push(tokenString);
else
moduleStack.push(moduleStack.peek()+"."+tokenString);
}
/* (non-Javadoc)
* @see com.minres.scviewer.database.vcd.ITraceBuilder#exitModule()
*/
@Override
public void exitModule() {
if(!moduleStack.isEmpty()) moduleStack.pop();
}
/* (non-Javadoc)
* @see com.minres.scviewer.database.vcd.ITraceBuilder#newNet(java.lang.String, int, int)
*/
@SuppressWarnings("unchecked")
@Override
public Integer newNet(String netName, int i, int width) {
int id = signals.size();
VCDSignal<? extends IWaveformEvent> signal;
if(width==1){
signal = i<0 ? new VCDSignal<ISignalChangeSingle>(db, id, netName) :
new VCDSignal<ISignalChangeSingle>((VCDSignal<ISignalChangeSingle>)signals.get(i), id, netName);
} else {
signal = i<0 ? new VCDSignal<ISignalChangeMulti>(db, id, netName, width) :
new VCDSignal<ISignalChangeMulti>((VCDSignal<VCDSignalChangeMulti>)signals.get(i), id, netName);
};
signals.add(signal);
return id;
}
/* (non-Javadoc)
* @see com.minres.scviewer.database.vcd.ITraceBuilder#getNetWidth(int)
*/
@Override
public int getNetWidth(int intValue) {
VCDSignal<? extends IWaveformEvent> signal = (VCDSignal<? extends IWaveformEvent>) signals.get(intValue);
return signal.getWidth();
}
/* (non-Javadoc)
* @see com.minres.scviewer.database.vcd.ITraceBuilder#appendTransition(int, long, com.minres.scviewer.database.vcd.BitVector)
*/
@SuppressWarnings("unchecked")
@Override
public void appendTransition(int signalId, long currentTime, BitVector decodedValues) {
VCDSignal<? extends IWaveformEvent> signal = (VCDSignal<? extends IWaveformEvent>) signals.get(signalId);
Long time = currentTime* TIME_RES;
if(signal.getWidth()==1){
((VCDSignal<ISignalChangeSingle>)signal).values.put(time, new VCDSignalChangeSingle(time, decodedValues.getValue()[0]));
} else {
((VCDSignal<VCDSignalChangeMulti>)signal).values.put(time, new VCDSignalChangeMulti(time, decodedValues));
}
}
/* (non-Javadoc)
* @see com.minres.scviewer.database.IWaveformDbLoader#getAllRelationTypes()
*/
@Override
public Collection<RelationType> getAllRelationTypes(){
return Collections.emptyList();
}
}

View File

@ -1,119 +0,0 @@
/*******************************************************************************
* Copyright (c) 2015 MINRES Technologies GmbH and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* MINRES Technologies GmbH - initial API and implementation
*******************************************************************************/
package com.minres.scviewer.database.vcd;
import java.util.NavigableMap;
import java.util.TreeMap;
import com.minres.scviewer.database.HierNode;
import com.minres.scviewer.database.ISignal;
import com.minres.scviewer.database.ISignalChange;
import com.minres.scviewer.database.IWaveform;
import com.minres.scviewer.database.IWaveformDb;
import com.minres.scviewer.database.IWaveformEvent;
public class VCDSignal<T extends ISignalChange> extends HierNode implements ISignal<T> {
private long id;
private String fullName;
private final String kind = "signal";
private final int width;
private IWaveformDb db;
TreeMap<Long, T> values;
public VCDSignal(IWaveformDb db, String name) {
this(db, 0, name, 1);
}
public VCDSignal(IWaveformDb db, int id, String name) {
this(db, id,name,1);
}
public VCDSignal(IWaveformDb db, int id, String name, int width) {
super(name);
this.db=db;
fullName=name;
this.id=id;
this.width=width;
this.values=new TreeMap<Long, T>();
}
@SuppressWarnings("unchecked")
public VCDSignal(IWaveform<? extends ISignalChange> other, int id, String name) {
super(name);
fullName=name;
this.id=id;
assert(other instanceof VCDSignal<?>);
this.width=((VCDSignal<? extends IWaveformEvent>)other).width;
this.values=((VCDSignal<T>)other).values;
this.db=other.getDb();
}
@Override
public String getFullName() {
return fullName;
}
public void setId(int id) {
this.id=id;
}
@Override
public Long getId() {
return id;
}
@Override
public String getKind() {
return kind;
}
public int getWidth() {
return width;
}
@Override
public IWaveformDb getDb() {
return db;
}
public void addSignalChange(T change){
values.put(change.getTime(), change);
}
@Override
public NavigableMap<Long, T> getEvents() {
return values;
}
@Override
public T getWaveformEventsAtTime(Long time) {
return values.get(time);
}
@Override
public T getWaveformEventsBeforeTime(Long time) {
return values.floorEntry(time).getValue();
}
@Override
public Boolean equals(IWaveform<? extends IWaveformEvent> other) {
return(other instanceof VCDSignal<?> && this.getId()==other.getId());
}
}

View File

@ -1,43 +0,0 @@
/*******************************************************************************
* Copyright (c) 2015 MINRES Technologies GmbH and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* MINRES Technologies GmbH - initial API and implementation
*******************************************************************************/
package com.minres.scviewer.database.vcd;
import com.minres.scviewer.database.BitVector;
import com.minres.scviewer.database.ISignalChangeMulti;
import com.minres.scviewer.database.SignalChange;
public class VCDSignalChangeMulti extends SignalChange implements ISignalChangeMulti, Cloneable {
private BitVector value;
public VCDSignalChangeMulti(Long time) {
super(time);
}
public VCDSignalChangeMulti(Long time, BitVector decodedValues) {
super(time);
this.value=decodedValues;
}
public BitVector getValue() {
return value;
}
public void setValue(BitVector value) {
this.value = value;
}
@Override
public String toString() {
return value.toHexString()+"@"+getTime();
}
}

View File

@ -1,37 +0,0 @@
/*******************************************************************************
* Copyright (c) 2015 MINRES Technologies GmbH and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* MINRES Technologies GmbH - initial API and implementation
*******************************************************************************/
package com.minres.scviewer.database.vcd;
import com.minres.scviewer.database.ISignalChangeSingle;
import com.minres.scviewer.database.SignalChange;
public class VCDSignalChangeSingle extends SignalChange implements ISignalChangeSingle, Cloneable {
private char value;
public VCDSignalChangeSingle(Long time, char value) {
super(time);
this.value=value;
}
public char getValue() {
return value;
}
public void setValue(char value) {
this.value = value;
}
@Override
public String toString() {
return value+"@"+getTime();
}
}

View File

@ -1,7 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
<classpathentry kind="output" path="target/classes"/>
</classpath>

View File

@ -1,8 +0,0 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
org.eclipse.jdt.core.compiler.compliance=1.7
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
org.eclipse.jdt.core.compiler.source=1.7

View File

@ -1,13 +0,0 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Waveform database
Bundle-SymbolicName: com.minres.scviewer.database
Bundle-Version: 1.0.0.qualifier
Bundle-Vendor: MINRES Technologies GmbH
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
Export-Package: com.minres.scviewer.database
Bundle-ActivationPolicy: lazy
Service-Component: OSGI-INF/component.xml,OSGI-INF/component2.xml
Require-Bundle: org.eclipse.equinox.ds;bundle-version="1.4.200",
org.eclipse.equinox.util;bundle-version="1.0.500",
org.eclipse.osgi.services;bundle-version="3.4.0"

View File

@ -1,66 +0,0 @@
/*******************************************************************************
* Copyright (c) 2015 MINRES Technologies GmbH and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* MINRES Technologies GmbH - initial API and implementation
*******************************************************************************/
package com.minres.scviewer.database;
public class BitVector {
public static final char VALUE_X = 'X';
public static final char VALUE_Z = 'Z';
public static final char VALUE_1 = '1';
public static final char VALUE_0 = '0';
private final int width;
private char[] value;
public BitVector(int netWidth) {
this.width=netWidth;
value = new char[netWidth];
for(int i=0; i<netWidth; i++) value[i]='0';
}
public void setValue(int i, char value) {
this.value[i]=value;
}
public char[] getValue() {
return value;
}
public void setValue(char[] value) {
this.value = value;
}
public int getWidth() {
return width;
}
public String toString(){
return new String(value);
}
public String toHexString(){
int resWidth=(width-1)/4+1;
char[] res = new char[resWidth];
for(int i=resWidth-1; i>=0; i--){
int digit=0;
for(int j=3; j>=0; j--){
if(value[4*i+j]==VALUE_X ||value[4*i+j]==VALUE_Z ){
res[i]=VALUE_X;
}
if(value[4*i+j]==VALUE_1)
digit+=1<<(3-j);
res[i]=Character.forDigit(digit, 16); //((digit < 10) ? '0' + digit : 'a' + digit -10)
}
}
return new String(res);
}
}

View File

@ -1,28 +0,0 @@
/*******************************************************************************
* Copyright (c) 2015 MINRES Technologies GmbH and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* MINRES Technologies GmbH - initial API and implementation
*******************************************************************************/
package com.minres.scviewer.database;
public enum DataType {
BOOLEAN, // bool
ENUMERATION, // enum
INTEGER, // char, short, int, long, long long, sc_int, sc_bigint
UNSIGNED, // unsigned { char, short, int, long, long long }, sc_uint,
// sc_biguint
FLOATING_POINT_NUMBER, // float, double
BIT_VECTOR, // sc_bit, sc_bv
LOGIC_VECTOR, // sc_logic, sc_lv
FIXED_POINT_INTEGER, // sc_fixed
UNSIGNED_FIXED_POINT_INTEGER, // sc_ufixed
RECORD, // struct/class
POINTER, // T*
ARRAY, // T[N]
STRING // string, std::string
};

View File

@ -1,87 +0,0 @@
/*******************************************************************************
* Copyright (c) 2015 MINRES Technologies GmbH and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* MINRES Technologies GmbH - initial API and implementation
*******************************************************************************/
package com.minres.scviewer.database;
import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
import java.util.ArrayList;
import java.util.List;
public class HierNode implements IHierNode {
protected String name;
protected String parentName;
protected ArrayList<IHierNode> childs;
protected PropertyChangeSupport pcs;
public HierNode() {
childs = new ArrayList<IHierNode>();
pcs=new PropertyChangeSupport(this);
}
public HierNode(String name) {
this(name, "");
}
public HierNode(String name, String parentName) {
this();
this.name=name;
this.parentName=parentName;
}
@Override
public void addPropertyChangeListener(PropertyChangeListener l) {
pcs.addPropertyChangeListener(l);
}
@Override
public void removePropertyChangeListener(PropertyChangeListener l) {
pcs.removePropertyChangeListener(l);
}
@Override
public String getFullName() {
if(parentName!=null && parentName.length()>0)
return parentName+"."+name;
else
return name;
}
@Override
public String getName() {
return name;
}
@Override
public void setName(String name) {
this.name=name;
}
@Override
public void setParentName(String name) {
this.parentName=name;
}
@Override
public List<IHierNode> getChildNodes() {
return childs;
}
@Override
public int compareTo(IHierNode o) {
return name.compareTo(o.getName());
}
}

View File

@ -1,46 +0,0 @@
/*******************************************************************************
* Copyright (c) 2015 MINRES Technologies GmbH and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* MINRES Technologies GmbH - initial API and implementation
*******************************************************************************/
package com.minres.scviewer.database;
import java.beans.PropertyChangeListener;
import java.util.List;
public interface IHierNode extends Comparable<IHierNode>{
/**
* 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) ;
public String getFullName();
public String getName();
public void setName(String name);
public void setParentName(String name);
public List<IHierNode> getChildNodes();
}

View File

@ -1,24 +0,0 @@
/*******************************************************************************
* Copyright (c) 2015 MINRES Technologies GmbH and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* MINRES Technologies GmbH - initial API and implementation
*******************************************************************************/
package com.minres.scviewer.database;
import java.util.NavigableMap;
public interface ISignal<T extends ISignalChange> extends IWaveform<T>{
public NavigableMap<Long, T> getEvents();
public T getWaveformEventsAtTime(Long time);
public T getWaveformEventsBeforeTime(Long time);
}

View File

@ -1,35 +0,0 @@
/*******************************************************************************
* Copyright (c) 2015 MINRES Technologies GmbH and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* MINRES Technologies GmbH - initial API and implementation
*******************************************************************************/
package com.minres.scviewer.database;
import java.util.Collection;
import java.util.List;
public interface ITx extends Comparable<ITx>{
public Long getId();
public ITxStream<ITxEvent> getStream();
public ITxGenerator getGenerator();
public Long getBeginTime();
public Long getEndTime();
public int getConcurrencyIndex();
public List<ITxAttribute> getAttributes();
public Collection<ITxRelation> getIncomingRelations();
public Collection<ITxRelation> getOutgoingRelations();
}

View File

@ -1,20 +0,0 @@
/*******************************************************************************
* Copyright (c) 2015 MINRES Technologies GmbH and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* MINRES Technologies GmbH - initial API and implementation
*******************************************************************************/
package com.minres.scviewer.database;
import java.util.List;
public interface ITxGenerator {
public Long getId();
public ITxStream<ITxEvent> getStream();
public String getName();
public List<ITx> getTransactions();
}

View File

@ -1,27 +0,0 @@
/*******************************************************************************
* Copyright (c) 2015 MINRES Technologies GmbH and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* MINRES Technologies GmbH - initial API and implementation
*******************************************************************************/
package com.minres.scviewer.database;
import java.util.Collection;
import java.util.List;
import java.util.NavigableMap;
public interface ITxStream<T extends ITxEvent> extends IWaveform<T> {
public List<ITxGenerator> getGenerators();
public int getMaxConcurrency();
public NavigableMap<Long, List<ITxEvent>> getEvents();
public Collection<T> getWaveformEventsAtTime(Long time);
}

View File

@ -1,46 +0,0 @@
/*******************************************************************************
* Copyright (c) 2015 MINRES Technologies GmbH and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* MINRES Technologies GmbH - initial API and implementation
*******************************************************************************/
package com.minres.scviewer.database;
public class SignalChange implements IWaveformEvent {
Long time;
public SignalChange() {
time=0L;
}
public SignalChange(Long time) {
super();
this.time = time;
}
@Override
public int compareTo(IWaveformEvent o) {
return time.compareTo(o.getTime());
}
@Override
public Long getTime() {
return time;
}
public void setTime(Long time) {
this.time = time;
}
@Override
public IWaveformEvent duplicate() throws CloneNotSupportedException {
return (IWaveformEvent) this.clone();
}
}

View File

@ -1,198 +0,0 @@
/*******************************************************************************
* Copyright (c) 2015 MINRES Technologies GmbH and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* MINRES Technologies GmbH - initial API and implementation
*******************************************************************************/
package com.minres.scviewer.database.internal;
import java.io.File;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import com.minres.scviewer.database.HierNode;
import com.minres.scviewer.database.IHierNode;
import com.minres.scviewer.database.ISignal;
import com.minres.scviewer.database.ITxStream;
import com.minres.scviewer.database.IWaveform;
import com.minres.scviewer.database.IWaveformDb;
import com.minres.scviewer.database.IWaveformDbLoader;
import com.minres.scviewer.database.IWaveformEvent;
import com.minres.scviewer.database.InputFormatException;
import com.minres.scviewer.database.RelationType;
public class WaveformDb extends HierNode implements IWaveformDb {
private static List<IWaveformDbLoader> loaders=new LinkedList<IWaveformDbLoader>();
private boolean loaded;
private List<IHierNode> childNodes;
private List<RelationType> relationTypes;
private Map<String, IWaveform<?>> waveforms;
private Long maxTime;
public synchronized void bind(IWaveformDbLoader loader){
loaders.add(loader);
}
public synchronized void unbind(IWaveformDbLoader loader){
loaders.remove(loader);
}
public static List<IWaveformDbLoader> getLoaders() {
return Collections.unmodifiableList(loaders);
}
public WaveformDb() {
super();
waveforms = new HashMap<String, IWaveform<?>>();
relationTypes=new ArrayList<>();
maxTime=0L;
}
@Override
public Long getMaxTime() {
return maxTime;
}
@Override
public IWaveform<? extends IWaveformEvent> getStreamByName(String name) {
return waveforms.get(name);
}
@Override
public List<IWaveform<?>> getAllWaves() {
return new ArrayList<IWaveform<?>>(waveforms.values());
}
@Override
public boolean load(File inp) throws Exception {
for(IWaveformDbLoader loader:loaders){
if(loader.load(this, inp)){
for(IWaveform<?> w:loader.getAllWaves()){
waveforms.put(w.getFullName(),w);
}
if(loader.getMaxTime()>maxTime){
maxTime=loader.getMaxTime();
}
if(name==null) name=getFileBasename(inp.getName());
buildHierarchyNodes() ;
relationTypes.addAll(loader.getAllRelationTypes());
pcs.firePropertyChange("WAVEFORMS", null, waveforms);
pcs.firePropertyChange("CHILDS", null, childNodes);
loaded = true;
return true;
}
}
return false;
}
protected static String getFileBasename(String f) {
String ext = "";
int i = f.lastIndexOf('.');
if (i > 0 && i < f.length() - 1) {
ext = f.substring(0, i);
}
return ext;
}
@Override
public void clear() {
waveforms.clear();
childNodes.clear();
loaded=false;
}
public boolean isLoaded() {
return loaded;
}
private void buildHierarchyNodes() throws InputFormatException{
childNodes= new ArrayList<IHierNode>();
for(IWaveform<?> stream:getAllWaves()){
updateMaxTime(stream);
String[] hier = stream.getName().split("\\.");
IHierNode node = this;
List<String> path=new LinkedList<String>();
path.add(name);
for(String name:hier){
IHierNode n1 = null;
for (IHierNode n : node.getChildNodes()) {
if (n.getName().equals(name)) {
n1=n;
break;
}
}
if(name == hier[hier.length-1]){ //leaf
if(n1!=null) {
if(n1 instanceof HierNode){
node.getChildNodes().remove(n1);
stream.getChildNodes().addAll(n1.getChildNodes());
Collections.sort(stream.getChildNodes());
} else {
throw new InputFormatException();
}
}
stream.setName(name);
stream.setParentName(join(path, "."));
node.getChildNodes().add(stream);
Collections.sort(node.getChildNodes());
node=stream;
} else { // intermediate
if(n1 != null) {
node=n1;
} else {
HierNode newNode = new HierNode(name, join(path, "."));
node.getChildNodes().add(newNode);
Collections.sort(node.getChildNodes());
node=newNode;
}
}
path.add(name);
}
}
}
private void updateMaxTime(IWaveform<?> waveform) {
Long last=0L;
if(waveform instanceof ITxStream<?> && ((ITxStream<?>)waveform).getEvents().lastEntry()!=null)
last=((ITxStream<?>)waveform).getEvents().lastEntry().getKey();
else if(waveform instanceof ISignal<?> && ((ISignal<?>)waveform).getEvents().lastEntry()!=null)
last=((ISignal<?>)waveform).getEvents().lastEntry().getKey();
if(last>maxTime)
maxTime=last;
}
private static String join(Collection<?> col, String delim) {
StringBuilder sb = new StringBuilder();
Iterator<?> iter = col.iterator();
if (iter.hasNext())
sb.append(iter.next().toString());
while (iter.hasNext()) {
sb.append(delim);
sb.append(iter.next().toString());
}
return sb.toString();
}
@Override
public List<RelationType> getAllRelationTypes() {
return relationTypes;
}
}

View File

@ -1,7 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="output" path="bin"/>
</classpath>

View File

@ -1,3 +0,0 @@
eclipse.preferences.version=1
pluginProject.extensions=false
resolve.requirebundle=false

View File

@ -1,13 +0,0 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>com.minres.scviewer.e4.application</artifactId>
<parent>
<groupId>com.minres.scviewer</groupId>
<artifactId>com.minres.scviewer.parent</artifactId>
<version>1.0.0-SNAPSHOT</version>
<relativePath>../com.minres.scviewer.parent</relativePath>
</parent>
<packaging>eclipse-plugin</packaging>
<version>1.0.0-SNAPSHOT</version>
<groupId>com.minres.scviewer</groupId>
</project>

View File

@ -1,60 +0,0 @@
/*******************************************************************************
* Copyright (c) 2015 MINRES Technologies GmbH and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* MINRES Technologies GmbH - initial API and implementation
*******************************************************************************/
package com.minres.scviewer.e4.application.handlers;
import java.io.File;
import org.eclipse.e4.core.contexts.IEclipseContext;
import org.eclipse.e4.core.di.annotations.Execute;
import org.eclipse.e4.ui.model.application.MApplication;
import org.eclipse.e4.ui.model.application.ui.basic.MPart;
import org.eclipse.e4.ui.model.application.ui.basic.MPartStack;
import org.eclipse.e4.ui.workbench.modeling.EModelService;
import org.eclipse.e4.ui.workbench.modeling.EPartService;
import org.eclipse.e4.ui.workbench.modeling.EPartService.PartState;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.FileDialog;
import org.eclipse.swt.widgets.Shell;
public class OpenHandler {
@Execute
public void execute(Shell shell, MApplication app, EModelService modelService, EPartService partService){
FileDialog dialog = new FileDialog(shell, SWT.OPEN | SWT.MULTI);
// dialog.setFilterExtensions (new String []{"vcd", "txdb", "txlog"});
dialog.setFilterExtensions (new String []{"*.vcd;*.txdb;*.txlog"});
dialog.open();
String path = dialog.getFilterPath();
for(String fileName: dialog.getFileNames()){
File file = new File(path+File.separator+fileName);
if(file.exists()){
// MPart part = MBasicFactory.INSTANCE.createPart();
// part.setLabel(fileName);
// part.setContributionURI("bundleclass://com.minres.scviewer.e4.application/"+ WaveformViewerPart.class.getName());
MPart part = partService .createPart("com.minres.scviewer.e4.application.partdescriptor.waveformviewer");
part.setLabel(file.getName());
MPartStack partStack = (MPartStack)modelService.find("org.eclipse.editorss", app);
partStack.getChildren().add(part);
partService.showPart(part, PartState.ACTIVATE);
// Object o = part.getObject();
// if(o instanceof WaveformViewerPart)
// ((WaveformViewerPart)o).setPartInput(file);
IEclipseContext ctx=part.getContext();
ctx.modify("input", file);
ctx.declareModifiable("input");
}
}
}
}

View File

@ -1,23 +0,0 @@
/*******************************************************************************
* Copyright (c) 2015 MINRES Technologies GmbH and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* MINRES Technologies GmbH - initial API and implementation
*******************************************************************************/
package com.minres.scviewer.e4.application.handlers;
import org.eclipse.e4.core.di.annotations.Execute;
public class SelectAllHandler {
@Execute
public void execute() {
}
}

View File

@ -1,779 +0,0 @@
/*******************************************************************************
* Copyright (c) 2015 MINRES Technologies GmbH and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* MINRES Technologies GmbH - initial API and implementation
*******************************************************************************/
package com.minres.scviewer.e4.application.internal.status;
import java.lang.reflect.Method;
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
import org.eclipse.core.runtime.preferences.IEclipsePreferences.IPreferenceChangeListener;
import org.eclipse.core.runtime.preferences.IEclipsePreferences.PreferenceChangeEvent;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.action.IMenuListener;
import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.action.MenuManager;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.GC;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.widgets.Canvas;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Menu;
import org.eclipse.wb.swt.ResourceManager;
import org.eclipse.wb.swt.SWTResourceManager;
import org.osgi.service.prefs.Preferences;
/**
* The Heap Status control, which shows the heap usage statistics in the window trim.
* Part of the code is taken from the eclipse internal implementation
*/
public class HeapStatus extends Composite {
/** The armed. */
private boolean armed;
/** The gc image. */
private Image gcImage;
/** The disabled gc image. */
private Image disabledGcImage;
/** The arm col. */
private Color bgCol, usedMemCol, lowMemCol, freeMemCol, topLeftCol, bottomRightCol, sepCol, textCol, markCol, armCol;
/** The button. */
private Canvas button;
/** The preferences. */
private Preferences preferences;
/** The update interval. */
private int updateInterval;
/** The show max. */
private boolean showMax;
/** The total mem. */
private long totalMem;
/** The prev total mem. */
private long prevTotalMem = -1L;
/** The prev used mem. */
private long prevUsedMem = -1L;
/** The has changed. */
private boolean hasChanged;
/** The used mem. */
private long usedMem;
/** The mark. */
private long mark = -1;
/** The img bounds. */
// start with 12x12
private Rectangle imgBounds = new Rectangle(0,0,12,12);
/** The max mem. */
private long maxMem = Long.MAX_VALUE;
/** The max mem known. */
private boolean maxMemKnown;
/** The low mem threshold. */
private float lowMemThreshold = 0.05f;
/** The show low mem threshold. */
private boolean showLowMemThreshold = true;
/** The update tooltip. */
private boolean updateTooltip = false;
/** The is in gc. */
protected volatile boolean isInGC = false;
/** The timer. */
private final Runnable timer = new Runnable() {
@Override
public void run() {
if (!isDisposed()) {
updateStats();
if (hasChanged) {
if (updateTooltip) {
updateToolTip();
}
redraw();
hasChanged = false;
}
getDisplay().timerExec(updateInterval, this);
}
}
};
/** The pref listener. */
private final IPreferenceChangeListener prefListener = new IPreferenceChangeListener() {
@Override
public void preferenceChange(PreferenceChangeEvent event) {
if (IHeapStatusConstants.PREF_UPDATE_INTERVAL.equals(event.getKey())) {
setUpdateIntervalInMS(preferences.getInt(IHeapStatusConstants.PREF_UPDATE_INTERVAL, 100));
}
else if (IHeapStatusConstants.PREF_SHOW_MAX.equals(event.getKey())) {
showMax = preferences.getBoolean(IHeapStatusConstants.PREF_SHOW_MAX, true);
}
}
};
/**
* Creates a new heap status control with the given parent, and using
* the given preference store to obtain settings such as the refresh
* interval.
*
* @param parent the parent composite
* @param preferences the preference store
*/
public HeapStatus(Composite parent, Preferences preferences) {
super(parent, SWT.NONE);
maxMem = getMaxMem();
maxMemKnown = maxMem != Long.MAX_VALUE;
this.preferences = preferences;
if(this.preferences instanceof IEclipsePreferences)
((IEclipsePreferences)this.preferences).addPreferenceChangeListener(prefListener);
setUpdateIntervalInMS(preferences.getInt(IHeapStatusConstants.PREF_UPDATE_INTERVAL, 100));
showMax = preferences.getBoolean(IHeapStatusConstants.PREF_SHOW_MAX, true);
button = new Canvas(this, SWT.NONE);
button.setToolTipText("Run Garbage Collection");
ImageDescriptor imageDesc = ResourceManager.getPluginImageDescriptor("com.minres.scviewer.e4.application", "icons/trash.png"); //$NON-NLS-1$
Display display = getDisplay();
gcImage = imageDesc.createImage();
if (gcImage != null) {
imgBounds = gcImage.getBounds();
disabledGcImage = new Image(display, gcImage, SWT.IMAGE_DISABLE);
}
usedMemCol = display.getSystemColor(SWT.COLOR_INFO_BACKGROUND);
lowMemCol = SWTResourceManager.getColor(255, 70, 70); // medium red
freeMemCol = SWTResourceManager.getColor(255, 190, 125); // light orange
bgCol = SWTResourceManager.getColor(SWT.COLOR_WIDGET_BACKGROUND);
sepCol = topLeftCol = armCol = SWTResourceManager.getColor(SWT.COLOR_WIDGET_NORMAL_SHADOW);
bottomRightCol = SWTResourceManager.getColor(SWT.COLOR_WIDGET_HIGHLIGHT_SHADOW);
markCol = textCol = SWTResourceManager.getColor(SWT.COLOR_INFO_FOREGROUND);
createContextMenu();
Listener listener = new Listener() {
@Override
public void handleEvent(Event event) {
switch (event.type) {
case SWT.Dispose:
doDispose();
break;
case SWT.Resize:
Rectangle rect = getClientArea();
button.setBounds(rect.width - imgBounds.width - 1, 1, imgBounds.width, rect.height - 2);
break;
case SWT.Paint:
if (event.widget == HeapStatus.this) {
paintComposite(event.gc);
}
else if (event.widget == button) {
paintButton(event.gc);
}
break;
case SWT.MouseUp:
if (event.button == 1) {
if (!isInGC) {
arm(false);
gc();
}
}
break;
case SWT.MouseDown:
if (event.button == 1) {
if (event.widget == HeapStatus.this) {
setMark();
} else if (event.widget == button) {
if (!isInGC)
arm(true);
}
}
break;
case SWT.MouseEnter:
HeapStatus.this.updateTooltip = true;
updateToolTip();
break;
case SWT.MouseExit:
if (event.widget == HeapStatus.this) {
HeapStatus.this.updateTooltip = false;
} else if (event.widget == button) {
arm(false);
}
break;
}
}
};
addListener(SWT.Dispose, listener);
addListener(SWT.MouseDown, listener);
addListener(SWT.Paint, listener);
addListener(SWT.Resize, listener);
addListener(SWT.MouseEnter, listener);
addListener(SWT.MouseExit, listener);
button.addListener(SWT.MouseDown, listener);
button.addListener(SWT.MouseExit, listener);
button.addListener(SWT.MouseUp, listener);
button.addListener(SWT.Paint, listener);
// make sure stats are updated before first paint
updateStats();
getDisplay().asyncExec(new Runnable() {
@Override
public void run() {
if (!isDisposed()) {
getDisplay().timerExec(updateInterval, timer);
}
}
});
}
/* (non-Javadoc)
* @see org.eclipse.swt.widgets.Control#setBackground(org.eclipse.swt.graphics.Color)
*/
@Override
public void setBackground(Color color) {
bgCol = color;
button.redraw();
button.update();
}
/* (non-Javadoc)
* @see org.eclipse.swt.widgets.Control#setForeground(org.eclipse.swt.graphics.Color)
*/
@Override
public void setForeground(Color color) {
if (color == null) {
usedMemCol = getDisplay().getSystemColor(SWT.COLOR_INFO_BACKGROUND);
} else {
usedMemCol = color;
}
button.redraw();
button.update();
}
/* (non-Javadoc)
* @see org.eclipse.swt.widgets.Control#getForeground()
*/
@Override
public Color getForeground() {
if (usedMemCol != null) {
return usedMemCol;
}
return getDisplay().getSystemColor(SWT.COLOR_INFO_BACKGROUND);
}
/**
* Returns the maximum memory limit, or Long.MAX_VALUE if the max is not known.
*
* @return the max mem
*/
private long getMaxMem() {
long max = Long.MAX_VALUE;
try {
// Must use reflect to allow compilation against JCL/Foundation
Method maxMemMethod = Runtime.class.getMethod("maxMemory", new Class[0]); //$NON-NLS-1$
Object o = maxMemMethod.invoke(Runtime.getRuntime(), new Object[0]);
if (o instanceof Long) {
max = ((Long) o).longValue();
}
}
catch (Exception e) {
// ignore if method missing or if there are other failures trying to determine the max
}
return max;
}
/**
* Sets the update interval in ms.
*
* @param interval the new update interval in ms
*/
private void setUpdateIntervalInMS(int interval) {
updateInterval = Math.max(100, interval);
}
/**
* Do dispose.
*/
private void doDispose() {
if(preferences instanceof IEclipsePreferences)
((IEclipsePreferences)preferences).removePreferenceChangeListener(prefListener);
if (gcImage != null) {
gcImage.dispose();
}
if (disabledGcImage != null) {
disabledGcImage.dispose();
}
}
/* (non-Javadoc)
* @see org.eclipse.swt.widgets.Composite#computeSize(int, int, boolean)
*/
@Override
public Point computeSize(int wHint, int hHint, boolean changed) {
GC gc = new GC(this);
Point p = gc.textExtent("MMMMMMMMMMMM");
int height = imgBounds.height;
// choose the largest of
// - Text height + margins
// - Image height + margins
// - Default Trim heightin
height = Math.max(height, p.y) + 4;
height = Math.max(TrimUtil.TRIM_DEFAULT_HEIGHT, height);
gc.dispose();
return new Point(p.x + 15, height);
}
/**
* Arm.
*
* @param armed the armed
*/
private void arm(boolean armed) {
if (this.armed == armed) {
return;
}
this.armed = armed;
button.redraw();
button.update();
}
/**
* Gc running.
*
* @param isInGC the is in gc
*/
private void gcRunning(boolean isInGC) {
if (this.isInGC == isInGC) {
return;
}
this.isInGC = isInGC;
button.redraw();
button.update();
}
/**
* Creates the context menu.
*/
private void createContextMenu() {
MenuManager menuMgr = new MenuManager();
menuMgr.setRemoveAllWhenShown(true);
menuMgr.addMenuListener(new IMenuListener() {
@Override
public void menuAboutToShow(IMenuManager menuMgr) {
fillMenu(menuMgr);
}
});
Menu menu = menuMgr.createContextMenu(this);
setMenu(menu);
}
/**
* Fill menu.
*
* @param menuMgr the menu mgr
*/
private void fillMenu(IMenuManager menuMgr) {
menuMgr.add(new SetMarkAction());
menuMgr.add(new ClearMarkAction());
menuMgr.add(new ShowMaxAction());
menuMgr.add(new CloseHeapStatusAction());
// if (isKyrsoftViewAvailable()) {
// menuMgr.add(new ShowKyrsoftViewAction());
// }
}
/**
* Sets the mark to the current usedMem level.
*/
private void setMark() {
updateStats(); // get up-to-date stats before taking the mark
mark = usedMem;
hasChanged = true;
redraw();
}
/**
* Clears the mark.
*/
private void clearMark() {
mark = -1;
hasChanged = true;
redraw();
}
/**
* Gc.
*/
private void gc() {
gcRunning(true);
Thread t = new Thread() {
@Override
public void run() {
busyGC();
getDisplay().asyncExec(new Runnable() {
@Override
public void run() {
if (!isDisposed()) {
gcRunning(false);
}
}
});
}
};
t.start();
}
/**
* Busy gc.
*/
private void busyGC() {
for (int i = 0; i < 2; ++i) {
System.gc();
System.runFinalization();
}
}
/**
* Paint button.
*
* @param gc the gc
*/
private void paintButton(GC gc) {
Rectangle rect = button.getClientArea();
if (isInGC) {
if (disabledGcImage != null) {
int buttonY = (rect.height - imgBounds.height) / 2 + rect.y;
gc.drawImage(disabledGcImage, rect.x, buttonY);
}
return;
}
if (armed) {
gc.setBackground(armCol);
gc.fillRectangle(rect.x, rect.y, rect.width, rect.height);
}
if (gcImage != null) {
int by = (rect.height - imgBounds.height) / 2 + rect.y; // button y
gc.drawImage(gcImage, rect.x, by);
}
}
/**
* Paint composite.
*
* @param gc the gc
*/
private void paintComposite(GC gc) {
if (showMax && maxMemKnown) {
paintCompositeMaxKnown(gc);
} else {
paintCompositeMaxUnknown(gc);
}
}
/**
* Paint composite max unknown.
*
* @param gc the gc
*/
private void paintCompositeMaxUnknown(GC gc) {
Rectangle rect = getClientArea();
int x = rect.x;
int y = rect.y;
int w = rect.width;
int h = rect.height;
int bw = imgBounds.width; // button width
int dx = x + w - bw - 2; // divider x
int sw = w - bw - 3; // status width
int uw = (int) (sw * usedMem / totalMem); // used mem width
int ux = x + 1 + uw; // used mem right edge
if (bgCol != null) {
gc.setBackground(bgCol);
}
gc.fillRectangle(rect);
gc.setForeground(sepCol);
gc.drawLine(dx, y, dx, y + h);
gc.drawLine(ux, y, ux, y + h);
gc.setForeground(topLeftCol);
gc.drawLine(x, y, x+w, y);
gc.drawLine(x, y, x, y+h);
gc.setForeground(bottomRightCol);
gc.drawLine(x+w-1, y, x+w-1, y+h);
gc.drawLine(x, y+h-1, x+w, y+h-1);
gc.setBackground(usedMemCol);
gc.fillRectangle(x + 1, y + 1, uw, h - 2);
String s = convertToMegString(usedMem)+" of "+ convertToMegString(totalMem);
Point p = gc.textExtent(s);
int sx = (rect.width - 15 - p.x) / 2 + rect.x + 1;
int sy = (rect.height - 2 - p.y) / 2 + rect.y + 1;
gc.setForeground(textCol);
gc.drawString(s, sx, sy, true);
// draw an I-shaped bar in the foreground colour for the mark (if present)
if (mark != -1) {
int ssx = (int) (sw * mark / totalMem) + x + 1;
paintMark(gc, ssx, y, h);
}
}
/**
* Paint composite max known.
*
* @param gc the gc
*/
private void paintCompositeMaxKnown(GC gc) {
Rectangle rect = getClientArea();
int x = rect.x;
int y = rect.y;
int w = rect.width;
int h = rect.height;
int bw = imgBounds.width; // button width
int dx = x + w - bw - 2; // divider x
int sw = w - bw - 3; // status width
int uw = (int) (sw * usedMem / maxMem); // used mem width
int ux = x + 1 + uw; // used mem right edge
int tw = (int) (sw * totalMem / maxMem); // current total mem width
int tx = x + 1 + tw; // current total mem right edge
if (bgCol != null) {
gc.setBackground(bgCol);
}
gc.fillRectangle(rect);
gc.setForeground(sepCol);
gc.drawLine(dx, y, dx, y + h);
gc.drawLine(ux, y, ux, y + h);
gc.drawLine(tx, y, tx, y + h);
gc.setForeground(topLeftCol);
gc.drawLine(x, y, x+w, y);
gc.drawLine(x, y, x, y+h);
gc.setForeground(bottomRightCol);
gc.drawLine(x+w-1, y, x+w-1, y+h);
gc.drawLine(x, y+h-1, x+w, y+h-1);
if (lowMemThreshold != 0 && ((double)(maxMem - usedMem) / (double)maxMem < lowMemThreshold)) {
gc.setBackground(lowMemCol);
} else {
gc.setBackground(usedMemCol);
}
gc.fillRectangle(x + 1, y + 1, uw, h - 2);
gc.setBackground(freeMemCol);
gc.fillRectangle(ux + 1, y + 1, tx - (ux + 1), h - 2);
// paint line for low memory threshold
if (showLowMemThreshold && lowMemThreshold != 0) {
gc.setForeground(lowMemCol);
int thresholdX = x + 1 + (int) (sw * (1.0 - lowMemThreshold));
gc.drawLine(thresholdX, y + 1, thresholdX, y + h - 2);
}
String s = convertToMegString(usedMem)+" of "+convertToMegString(totalMem);
Point p = gc.textExtent(s);
int sx = (rect.width - 15 - p.x) / 2 + rect.x + 1;
int sy = (rect.height - 2 - p.y) / 2 + rect.y + 1;
gc.setForeground(textCol);
gc.drawString(s, sx, sy, true);
// draw an I-shaped bar in the foreground colour for the mark (if present)
if (mark != -1) {
int ssx = (int) (sw * mark / maxMem) + x + 1;
paintMark(gc, ssx, y, h);
}
}
/**
* Paint mark.
*
* @param gc the gc
* @param x the x
* @param y the y
* @param h the h
*/
private void paintMark(GC gc, int x, int y, int h) {
gc.setForeground(markCol);
gc.drawLine(x, y+1, x, y+h-2);
gc.drawLine(x-1, y+1, x+1, y+1);
gc.drawLine(x-1, y+h-2, x+1, y+h-2);
}
/**
* Update stats.
*/
private void updateStats() {
Runtime runtime = Runtime.getRuntime();
totalMem = runtime.totalMemory();
long freeMem = runtime.freeMemory();
usedMem = totalMem - freeMem;
if (convertToMeg(prevUsedMem) != convertToMeg(usedMem)) {
prevUsedMem = usedMem;
this.hasChanged = true;
}
if (prevTotalMem != totalMem) {
prevTotalMem = totalMem;
this.hasChanged = true;
}
}
/**
* Update tool tip.
*/
private void updateToolTip() {
String usedStr = convertToMegString(usedMem);
String totalStr = convertToMegString(totalMem);
String maxStr = maxMemKnown ? convertToMegString(maxMem) : "<unknown>";
String markStr = mark == -1 ? "<none>" : convertToMegString(mark);
String toolTip = "Heap size: "+usedStr+" of total: "+totalStr+" max: "+maxStr+" mark: "+markStr;
if (!toolTip.equals(getToolTipText())) {
setToolTipText(toolTip);
}
}
/**
* Converts the given number of bytes to a printable number of megabytes (rounded up).
*
* @param numBytes the num bytes
* @return the string
*/
private String convertToMegString(long numBytes) {
return new Long(convertToMeg(numBytes)).toString()+"M";
}
/**
* Converts the given number of bytes to the corresponding number of megabytes (rounded up).
*
* @param numBytes the num bytes
* @return the long
*/
private long convertToMeg(long numBytes) {
return (numBytes + (512 * 1024)) / (1024 * 1024);
}
/**
* The Class SetMarkAction.
*/
class SetMarkAction extends Action {
/**
* Instantiates a new sets the mark action.
*/
SetMarkAction() {
super("&Set Mark");
}
/* (non-Javadoc)
* @see org.eclipse.jface.action.Action#run()
*/
@Override
public void run() {
setMark();
}
}
/**
* The Class ClearMarkAction.
*/
class ClearMarkAction extends Action {
/**
* Instantiates a new clear mark action.
*/
ClearMarkAction() {
super("&Clear Mark");
}
/* (non-Javadoc)
* @see org.eclipse.jface.action.Action#run()
*/
@Override
public void run() {
clearMark();
}
}
/**
* The Class ShowMaxAction.
*/
class ShowMaxAction extends Action {
/**
* Instantiates a new show max action.
*/
ShowMaxAction() {
super("Show &Max Heap", IAction.AS_CHECK_BOX);
setEnabled(maxMemKnown);
setChecked(showMax);
}
/* (non-Javadoc)
* @see org.eclipse.jface.action.Action#run()
*/
@Override
public void run() {
preferences.putBoolean(IHeapStatusConstants.PREF_SHOW_MAX, isChecked());
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");
}
}
}

View File

@ -1,203 +0,0 @@
/*******************************************************************************
* Copyright (c) 2015 MINRES Technologies GmbH and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* MINRES Technologies GmbH - initial API and implementation
*******************************************************************************/
package com.minres.scviewer.e4.application.internal.status;
import javax.inject.Inject;
import javax.inject.Named;
import org.eclipse.e4.core.di.annotations.Optional;
import org.eclipse.e4.ui.di.UIEventTopic;
import org.eclipse.e4.ui.di.UISynchronize;
import org.eclipse.e4.ui.services.IServiceConstants;
import org.eclipse.e4.ui.workbench.modeling.EModelService;
import org.eclipse.jface.action.ContributionItem;
import org.eclipse.jface.action.StatusLineManager;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.CLabel;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
/**
* The Class WaveStatusBarControl.
*/
public class WaveStatusBarControl extends StatusBarControl {
/** The Constant ZOOM_LEVEL. */
public static final String ZOOM_LEVEL="ZoomLevelUpdate";
/** The Constant CURSOR_TIME. */
public static final String CURSOR_TIME="CursorPosUpdate";
/** The Constant MARKER_TIME. */
public static final String MARKER_TIME="MarkerPosUpdate";
/** The Constant MARKER_DIFF. */
public static final String MARKER_DIFF="MarlerDiffUpdate";
/** The model service. */
@Inject
EModelService modelService;
/**
* The Class TextContributionItem.
*/
class TextContributionItem extends ContributionItem {
/** The label string. */
final String labelString;
/** The width. */
final int width;
/** The text. */
CLabel label, text;
/** The content. */
private String content;
/**
* Instantiates a new text contribution item.
*
* @param labelString the label string
* @param width the width
*/
public TextContributionItem(String labelString, int width) {
super();
this.labelString = labelString;
this.width=width;
content="";
}
/* (non-Javadoc)
* @see org.eclipse.jface.action.ContributionItem#fill(org.eclipse.swt.widgets.Composite)
*/
@Override
public void fill(Composite parent) {
Composite box=new Composite(parent, SWT.NONE);
box.setLayout(new GridLayout(2, false));
label=new CLabel(box, SWT.SHADOW_NONE);
label.setText(labelString);
text=new CLabel(box, SWT.SHADOW_IN);
GridData layoutData=new GridData(SWT.DEFAULT, SWT.DEFAULT, true, false);
layoutData.minimumWidth=width;
text.setLayoutData(layoutData);
}
/* (non-Javadoc)
* @see org.eclipse.jface.action.ContributionItem#isDynamic()
*/
@Override
public boolean isDynamic() {
return true;
}
/**
* Sets the text.
*
* @param message the new text
*/
public void setText(String message){
this.content=message;
if(text!=null && !text.isDisposed()) text.setText(content);
}
}
/** The zoom contribution. */
TextContributionItem cursorContribution, markerContribution, markerDiffContribution, zoomContribution;
/**
* Instantiates a new wave status bar control.
*
* @param sync the sync
*/
@Inject
public WaveStatusBarControl(UISynchronize sync) {
super(sync);
cursorContribution = new TextContributionItem("C:", 80);
markerContribution = new TextContributionItem("M:", 80);
markerDiffContribution = new TextContributionItem("C-M:", 80);
zoomContribution = new TextContributionItem("Z:", 80);
manager.appendToGroup(StatusLineManager.BEGIN_GROUP,cursorContribution);
manager.appendToGroup(StatusLineManager.BEGIN_GROUP,markerContribution);
manager.appendToGroup(StatusLineManager.BEGIN_GROUP,markerDiffContribution);
manager.appendToGroup(StatusLineManager.BEGIN_GROUP, zoomContribution);
}
/**
* Sets the selection.
*
* @param selection the new selection
*/
@Inject
public void setSelection(@Named(IServiceConstants.ACTIVE_SELECTION)@Optional IStructuredSelection selection){
if(manager!=null && selection!=null){
switch(selection.size()){
case 0:
manager.setMessage("");
break;
case 1:
manager.setMessage(selection.getFirstElement().getClass().getSimpleName()+" selected");
break;
default:
manager.setMessage(""+selection.size()+" Elements");
break;
}
}
}
/**
* Gets the zoom event.
*
* @param text the text
* @return the zoom event
*/
@Inject @Optional
public void getZoomEvent(@UIEventTopic(ZOOM_LEVEL) String text) {
zoomContribution.setText(text);
}
/**
* Gets the cursor event.
*
* @param text the text
* @return the cursor event
*/
@Inject @Optional
public void getCursorEvent(@UIEventTopic(CURSOR_TIME) String text) {
cursorContribution.setText(text);
}
/**
* Gets the marker event.
*
* @param text the text
* @return the marker event
*/
@Inject @Optional
public void getMarkerEvent(@UIEventTopic(MARKER_TIME) String text) {
markerContribution.setText(text);
}
/**
* Gets the diff event.
*
* @param text the text
* @return the diff event
*/
@Inject @Optional
public void getDiffEvent(@UIEventTopic(MARKER_DIFF) String text) {
markerDiffContribution.setText(text);
}
}

View File

@ -1,88 +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.IHierNode;
import com.minres.scviewer.database.IWaveform;
import com.minres.scviewer.database.IWaveformDb;
import com.minres.scviewer.database.IWaveformEvent;
import com.minres.scviewer.database.RelationType;
public class LoadingWaveformDb implements IWaveformDb {
private final String label = "Database loading...";
@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 setParentName(String 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<? extends IWaveformEvent> 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) throws Exception {
return false;
}
@Override
public boolean isLoaded() {
return false;
}
@Override
public void clear() {
}
}

View File

@ -1,594 +0,0 @@
/*******************************************************************************
* Copyright (c) 2015 MINRES Technologies GmbH and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* MINRES Technologies GmbH - initial API and implementation
*******************************************************************************/
package com.minres.scviewer.e4.application.parts;
import java.util.Vector;
import javax.annotation.PostConstruct;
import javax.inject.Inject;
import javax.inject.Named;
import org.eclipse.e4.core.di.annotations.Optional;
import org.eclipse.e4.core.services.events.IEventBroker;
import org.eclipse.e4.ui.di.Focus;
import org.eclipse.e4.ui.di.UIEventTopic;
import org.eclipse.e4.ui.services.IServiceConstants;
import org.eclipse.e4.ui.workbench.modeling.ESelectionService;
import org.eclipse.jface.viewers.DelegatingStyledCellLabelProvider;
import org.eclipse.jface.viewers.DelegatingStyledCellLabelProvider.IStyledLabelProvider;
import org.eclipse.jface.viewers.DoubleClickEvent;
import org.eclipse.jface.viewers.IDoubleClickListener;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.ITreeContentProvider;
import org.eclipse.jface.viewers.LabelProvider;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jface.viewers.StyledString;
import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.jface.viewers.TreeViewerColumn;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jface.viewers.ViewerFilter;
import org.eclipse.jface.viewers.ViewerSorter;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.ControlAdapter;
import org.eclipse.swt.events.ControlEvent;
import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Text;
import org.eclipse.swt.widgets.Tree;
import com.minres.scviewer.database.ITx;
import com.minres.scviewer.database.ITxAttribute;
import com.minres.scviewer.database.ITxRelation;
import com.minres.scviewer.e4.application.provider.TxPropertiesLabelProvider;
/**
* The Class TransactionDetails shows the details of a selected transaction.
*/
public class TransactionDetails {
/** The Constant COLUMN_FIRST. */
// Column constants
public static final int COLUMN_FIRST = 0;
/** The Constant COLUMN_SECOND. */
public static final int COLUMN_SECOND = 1;
/** The Constant COLUMN_THIRD. */
public static final int COLUMN_THIRD = 2;
/** The event broker. */
@Inject IEventBroker eventBroker;
/** The selection service. */
@Inject ESelectionService selectionService;
/** The name filter. */
private Text nameFilter;
/** The tree viewer. */
private TreeViewer treeViewer;
/** The col3. */
private TreeViewerColumn col1, col2, col3;
/** The attribute filter. */
TxAttributeFilter attributeFilter;
/** The view sorter. */
TxAttributeViewerSorter viewSorter;
/** The waveform viewer part. */
private WaveformViewer waveformViewerPart;
/**
* Creates the composite.
*
* @param parent the parent
*/
@PostConstruct
public void createComposite(final Composite parent) {
parent.setLayout(new GridLayout(1, false));
nameFilter = new Text(parent, SWT.BORDER);
nameFilter.setMessage("Enter text to filter");
nameFilter.addModifyListener(new ModifyListener() {
@Override
public void modifyText(ModifyEvent e) {
attributeFilter.setSearchText(((Text) e.widget).getText());
treeViewer.refresh();
}
});
nameFilter.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
attributeFilter = new TxAttributeFilter();
viewSorter = new TxAttributeViewerSorter();
treeViewer = new TreeViewer(parent);
treeViewer.setContentProvider(new TransactionTreeContentProvider());
treeViewer.setLabelProvider(new TxPropertiesLabelProvider());
treeViewer.getControl().setLayoutData(new GridData(GridData.FILL_BOTH));
treeViewer.addFilter(attributeFilter);
treeViewer.setSorter(viewSorter);
treeViewer.setAutoExpandLevel(2);
// Set up the table
Tree tree = treeViewer.getTree();
tree.setLayoutData(new GridData(GridData.FILL_BOTH));
// Add the name column
col1 = new TreeViewerColumn(treeViewer, SWT.NONE);
col1.getColumn().setText("Name");
col1.getColumn().setResizable(true);
col1.setLabelProvider(new DelegatingStyledCellLabelProvider(new AttributeLabelProvider(AttributeLabelProvider.NAME)));
col1.getColumn().addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
((TxAttributeViewerSorter) treeViewer.getSorter()).doSort(COLUMN_FIRST);
treeViewer.refresh();
}
});
// Add the type column
col2 = new TreeViewerColumn(treeViewer, SWT.NONE);
col2.getColumn().setText("Type");
col2.getColumn().setResizable(true);
col2.setLabelProvider(new DelegatingStyledCellLabelProvider(new AttributeLabelProvider(AttributeLabelProvider.TYPE)));
col2.getColumn().addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
((TxAttributeViewerSorter) treeViewer.getSorter()).doSort(COLUMN_SECOND);
treeViewer.refresh();
}
});
// Add the value column
col3 = new TreeViewerColumn(treeViewer, SWT.NONE);
col3.getColumn().setText("Value");
col3.getColumn().setResizable(true);
col3.setLabelProvider(new DelegatingStyledCellLabelProvider(new AttributeLabelProvider(AttributeLabelProvider.VALUE)));
col3.getColumn().addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent event) {
((TxAttributeViewerSorter) treeViewer.getSorter()).doSort(COLUMN_SECOND);
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
tree.setHeaderVisible(true);
tree.setLinesVisible(true);
treeViewer.addDoubleClickListener(new IDoubleClickListener(){
@Override
public void doubleClick(DoubleClickEvent event) {
ISelection selection = treeViewer.getSelection();
if(selection instanceof IStructuredSelection){
IStructuredSelection structuredSelection = (IStructuredSelection) selection;
Object selected = structuredSelection.getFirstElement();
if(selected instanceof Object[]){
Object[] selectedArray = (Object[]) selected;
if(selectedArray.length==3 && selectedArray[2] instanceof ITx){
waveformViewerPart.setSelection(new StructuredSelection(selectedArray[2]));
treeViewer.setInput(selectedArray[2]);
}
}
}
}
});
parent.addControlListener(new ControlAdapter() {
public void controlResized(ControlEvent e) {
Tree table = treeViewer.getTree();
Rectangle area = parent.getClientArea();
Point preferredSize = table.computeSize(SWT.DEFAULT, SWT.DEFAULT);
int width = area.width - 2*table.getBorderWidth();
if (preferredSize.y > area.height + table.getHeaderHeight()) {
// Subtract the scrollbar width from the total column width
// if a vertical scrollbar will be required
Point vBarSize = table.getVerticalBar().getSize();
width -= vBarSize.x;
}
Point oldSize = table.getSize();
if (oldSize.x > area.width) {
// table is getting smaller so make the columns
// smaller first and then resize the table to
// match the client area width
col1.getColumn().setWidth(width/3);
col2.getColumn().setWidth(width/4);
col3.getColumn().setWidth(width - col1.getColumn().getWidth());
table.setSize(area.width, area.height);
} else {
// table is getting bigger so make the table
// bigger first and then make the columns wider
// to match the client area width
table.setSize(area.width, area.height);
col1.getColumn().setWidth(width/3);
col2.getColumn().setWidth(width/4);
col3.getColumn().setWidth(width - col1.getColumn().getWidth()- col2.getColumn().getWidth());
}
}
});
}
/**
* Sets the focus.
*/
@Focus
public void setFocus() {
treeViewer.getTree().setFocus();
}
/**
* Gets the status event.
*
* @param part the part
* @return the status event
*/
@Inject @Optional
public void getStatusEvent(@UIEventTopic(WaveformViewer.ACTIVE_WAVEFORMVIEW) WaveformViewer part) {
this.waveformViewerPart=part;
}
/**
* Sets the selection.
*
* @param selection the new selection
*/
@Inject
public void setSelection(@Named(IServiceConstants.ACTIVE_SELECTION) @Optional IStructuredSelection selection){
if(treeViewer!=null && selection!=null && !treeViewer.getTree().isDisposed()){
if( selection instanceof IStructuredSelection) {
Object object= ((IStructuredSelection)selection).getFirstElement();
if(object instanceof ITx){
treeViewer.setInput(object);
} else {
treeViewer.setInput(null);
}
}
}
}
/**
* Time to string.
*
* @param time the time
* @return the string
*/
String timeToString(Long time){
return waveformViewerPart.getScaledTime(time);
}
/**
* Tx to string.
*
* @param tx the tx
* @return the string
*/
String txToString(ITx tx){
StringBuilder sb = new StringBuilder();
sb.append("tx#").append(tx.getId()).append("[").append(timeToString(tx.getBeginTime())).
append(" - ").append(timeToString(tx.getEndTime())).append("]");
return sb.toString();
}
/**
* The Class TxAttributeViewerSorter.
*/
class TxAttributeViewerSorter extends ViewerSorter {
/** The Constant ASCENDING. */
private static final int ASCENDING = 0;
/** The Constant DESCENDING. */
private static final int DESCENDING = 1;
/** The column. */
private int column;
/** The direction. */
private int direction;
/**
* Does the sort. If it's a different column from the previous sort, do an
* ascending sort. If it's the same column as the last sort, toggle the sort
* direction.
*
* @param column the column
*/
public void doSort(int column) {
if (column == this.column) {
// Same column as last sort; toggle the direction
direction = 1 - direction;
} else {
// New column; do an ascending sort
this.column = column;
direction = ASCENDING;
}
}
/**
* Compares the object for sorting.
*
* @param viewer the viewer
* @param e1 the e1
* @param e2 the e2
* @return the int
*/
@SuppressWarnings("unchecked")
public int compare(Viewer viewer, Object e1, Object e2) {
int rc = 0;
if(e1 instanceof ITxAttribute && e2 instanceof ITxAttribute){
ITxAttribute p1 = (ITxAttribute) e1;
ITxAttribute p2 = (ITxAttribute) e2;
// Determine which column and do the appropriate sort
switch (column) {
case COLUMN_FIRST:
rc = getComparator().compare(p1.getName(), p2.getName());
break;
case COLUMN_SECOND:
rc = getComparator().compare(p1.getDataType().name(), p2.getDataType().name());
break;
case COLUMN_THIRD:
rc = getComparator().compare(p1.getValue(), p2.getValue());
break;
}
// If descending order, flip the direction
if (direction == DESCENDING) rc = -rc;
}
return rc;
}
}
/**
* The Class TxAttributeFilter.
*/
class TxAttributeFilter extends ViewerFilter {
/** The search string. */
private String searchString;
/**
* Sets the search text.
*
* @param s the new search text
*/
public void setSearchText(String s) {
this.searchString = ".*" + s + ".*";
}
/* (non-Javadoc)
* @see org.eclipse.jface.viewers.ViewerFilter#select(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)
*/
@Override
public boolean select(Viewer viewer, Object parentElement, Object element) {
if (searchString == null || searchString.length() == 0) {
return true;
}
if(element instanceof ITxAttribute){
ITxAttribute p = (ITxAttribute) element;
if (p.getName().matches(searchString)) {
return true;
}
} else if(element instanceof TreeNode)
return true;
return false;
}
}
/**
* The Enum Type.
*/
enum Type {/** The props. */
PROPS, /** The attrs. */
ATTRS, /** The in rel. */
IN_REL, /** The out rel. */
OUT_REL}
/**
* The Class TreeNode.
*/
class TreeNode{
/** The type. */
public Type type;
/** The element. */
public ITx element;
/**
* Instantiates a new tree node.
*
* @param element the element
* @param type the type
*/
public TreeNode(ITx element, Type type){
this.element=element;
this.type=type;
}
/* (non-Javadoc)
* @see java.lang.Object#toString()
*/
public String toString(){
switch(type){
case PROPS: return "Properties";
case ATTRS: return "Attributes";
case IN_REL: return "Incoming relations";
case OUT_REL: return "Outgoing relations";
}
return "";
}
}
/**
* The Class TransactionTreeContentProvider.
*/
class TransactionTreeContentProvider implements ITreeContentProvider {
/* (non-Javadoc)
* @see org.eclipse.jface.viewers.IContentProvider#dispose()
*/
@Override
public void dispose() { }
/* (non-Javadoc)
* @see org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)
*/
@Override
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
}
/* (non-Javadoc)
* @see org.eclipse.jface.viewers.ITreeContentProvider#getElements(java.lang.Object)
*/
@Override
public Object[] getElements(Object element) {
return new Object[]{
new TreeNode((ITx)element, Type.PROPS),
new TreeNode((ITx)element, Type.ATTRS),
new TreeNode((ITx)element, Type.IN_REL),
new TreeNode((ITx)element, Type.OUT_REL)
};
}
/* (non-Javadoc)
* @see org.eclipse.jface.viewers.ITreeContentProvider#getChildren(java.lang.Object)
*/
@Override
public Object[] getChildren(Object element) {
if(element instanceof TreeNode){
TreeNode propertyHolder=(TreeNode) element;
if(propertyHolder.type == Type.PROPS){
return new Object[][]{
{"Name", "String", propertyHolder.element.getStream().getFullName()},
{"Type", "String", propertyHolder.element.getGenerator().getName()},
{"Start time", "Time", timeToString(propertyHolder.element.getBeginTime())},
{"End time", "Time", timeToString(propertyHolder.element.getEndTime())}
};
}else if(propertyHolder.type == Type.ATTRS)
return propertyHolder.element.getAttributes().toArray();
else if(propertyHolder.type == Type.IN_REL){
Vector<Object[] > res = new Vector<>();
for(ITxRelation rel:propertyHolder.element.getIncomingRelations()){
res.add(new Object[]{
rel.getRelationType(),
rel.getSource().getGenerator().getName(),
rel.getSource()});
}
return res.toArray();
} else if(propertyHolder.type == Type.OUT_REL){
Vector<Object[] > res = new Vector<>();
for(ITxRelation rel:propertyHolder.element.getOutgoingRelations()){
res.add(new Object[]{
rel.getRelationType(),
rel.getTarget().getGenerator().getName(),
rel.getTarget()});
}
return res.toArray();
}
}
return null;
}
/* (non-Javadoc)
* @see org.eclipse.jface.viewers.ITreeContentProvider#getParent(java.lang.Object)
*/
@Override
public Object getParent(Object element) {
return null;
}
/* (non-Javadoc)
* @see org.eclipse.jface.viewers.ITreeContentProvider#hasChildren(java.lang.Object)
*/
@Override
public boolean hasChildren(Object element) {
return getChildren(element)!=null;
}
}
/**
* The Class AttributeLabelProvider.
*/
class AttributeLabelProvider extends LabelProvider implements IStyledLabelProvider {
/** The field. */
final int field;
/** The Constant NAME. */
public static final int NAME=0;
/** The Constant TYPE. */
public static final int TYPE=1;
/** The Constant VALUE. */
public static final int VALUE=2;
/**
* Instantiates a new attribute label provider.
*
* @param field the field
*/
public AttributeLabelProvider(int field) {
this.field=field;
}
/* (non-Javadoc)
* @see org.eclipse.jface.viewers.DelegatingStyledCellLabelProvider.IStyledLabelProvider#getStyledText(java.lang.Object)
*/
@Override
public StyledString getStyledText(Object element) {
switch(field){
case NAME:
if (element instanceof ITxAttribute) {
ITxAttribute attribute = (ITxAttribute) element;
return new StyledString(attribute.getName());
}else if (element instanceof ITxRelation) {
return new StyledString("Relation");
}else if(element instanceof Object[]){
Object[] elements = (Object[]) element;
return new StyledString(elements[field].toString());
} else
return new StyledString(element.toString());
case TYPE:
if (element instanceof ITxAttribute) {
ITxAttribute attribute = (ITxAttribute) element;
return new StyledString(attribute.getDataType().toString());
}else if(element instanceof Object[]){
Object[] elements = (Object[]) element;
return new StyledString(elements[field].toString());
}else
return new StyledString("");
default:
if (element instanceof ITxAttribute) {
ITxAttribute attribute = (ITxAttribute) element;
return new StyledString(attribute.getValue().toString());
}else if(element instanceof Object[]){
Object[] elements = (Object[]) element;
return new StyledString(elements[field].toString());
} else if(element instanceof ITx){
return new StyledString(txToString((ITx) element));
}else
return new StyledString("");
}
}
}
}

View File

@ -1,883 +0,0 @@
/*******************************************************************************
* Copyright (c) 2015 MINRES Technologies GmbH and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* MINRES Technologies GmbH - initial API and implementation
*******************************************************************************/
package com.minres.scviewer.e4.application.parts;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Properties;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import javax.annotation.PostConstruct;
import javax.inject.Inject;
import javax.inject.Named;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.SubMonitor;
import org.eclipse.core.runtime.jobs.IJobChangeEvent;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.core.runtime.jobs.JobChangeAdapter;
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
import org.eclipse.core.runtime.preferences.IEclipsePreferences.IPreferenceChangeListener;
import org.eclipse.core.runtime.preferences.IEclipsePreferences.PreferenceChangeEvent;
import org.eclipse.e4.core.di.annotations.Optional;
import org.eclipse.e4.core.di.extensions.Preference;
import org.eclipse.e4.core.services.events.IEventBroker;
import org.eclipse.e4.ui.di.Focus;
import org.eclipse.e4.ui.di.PersistState;
import org.eclipse.e4.ui.di.UIEventTopic;
import org.eclipse.e4.ui.model.application.ui.basic.MPart;
import org.eclipse.e4.ui.services.EMenuService;
import org.eclipse.e4.ui.workbench.modeling.EPartService;
import org.eclipse.e4.ui.workbench.modeling.ESelectionService;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.resource.StringConverter;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.swt.graphics.RGB;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import com.minres.scviewer.database.ITx;
import com.minres.scviewer.database.ITxRelation;
import com.minres.scviewer.database.IWaveform;
import com.minres.scviewer.database.IWaveformDb;
import com.minres.scviewer.database.IWaveformDbFactory;
import com.minres.scviewer.database.IWaveformEvent;
import com.minres.scviewer.database.RelationType;
import com.minres.scviewer.database.swt.WaveformViewerFactory;
import com.minres.scviewer.database.ui.GotoDirection;
import com.minres.scviewer.database.ui.ICursor;
import com.minres.scviewer.database.ui.IWaveformViewer;
import com.minres.scviewer.database.ui.TrackEntry;
import com.minres.scviewer.database.ui.WaveformColors;
import com.minres.scviewer.e4.application.internal.status.WaveStatusBarControl;
import com.minres.scviewer.e4.application.internal.util.FileMonitor;
import com.minres.scviewer.e4.application.internal.util.IFileChangeListener;
import com.minres.scviewer.e4.application.internal.util.IModificationChecker;
import com.minres.scviewer.e4.application.preferences.DefaultValuesInitializer;
import com.minres.scviewer.e4.application.preferences.PreferenceConstants;
/**
* The Class WaveformViewerPart.
*/
@SuppressWarnings("restriction")
public class WaveformViewer implements IFileChangeListener, IPreferenceChangeListener {
/** The Constant ACTIVE_WAVEFORMVIEW. */
public static final String ACTIVE_WAVEFORMVIEW = "Active_Waveform_View";
/** The Constant ADD_WAVEFORM. */
public static final String ADD_WAVEFORM = "AddWaveform";
/** The Constant DATABASE_FILE. */
protected static final String DATABASE_FILE = "DATABASE_FILE";
/** The Constant SHOWN_WAVEFORM. */
protected static final String SHOWN_WAVEFORM = "SHOWN_WAVEFORM";
/** The Constant SHOWN_CURSOR. */
protected static final String SHOWN_CURSOR = "SHOWN_CURSOR";
/** The Constant ZOOM_LEVEL. */
protected static final String ZOOM_LEVEL = "ZOOM_LEVEL";
/** The Constant BASE_LINE_TIME. */
protected static final String BASE_LINE_TIME = "BASE_LINE_TIME";
/** The Constant FILE_CHECK_INTERVAL. */
protected static final long FILE_CHECK_INTERVAL = 60000;
/** The zoom level. */
private String[] zoomLevel;
/** The Constant ID. */
public static final String ID = "com.minres.scviewer.ui.TxEditorPart"; //$NON-NLS-1$
/** The Constant WAVE_ACTION_ID. */
public static final String WAVE_ACTION_ID = "com.minres.scviewer.ui.action.AddToWave";
/** The factory. */
WaveformViewerFactory factory = new WaveformViewerFactory();
/** The waveform pane. */
private IWaveformViewer waveformPane;
/** The event broker. */
@Inject
private IEventBroker eventBroker;
/** The menu service. */
@Inject
EMenuService menuService;
/** The selection service. */
@Inject
ESelectionService selectionService;
/** The e part service. */
@Inject
EPartService ePartService;
/** The prefs. */
@Inject
@Preference(nodePath = PreferenceConstants.PREFERENCES_SCOPE)
IEclipsePreferences prefs;
/** The database. */
private IWaveformDb database;
/** The check for updates. */
private boolean checkForUpdates;
/** The my part. */
private MPart myPart;
/** The my parent. */
private Composite myParent;
/** The files to load. */
ArrayList<File> filesToLoad;
/** The persisted state. */
Map<String, String> persistedState;
/** The browser state. */
private Object browserState;
/** The details settings. */
private Object detailsSettings;
/** The navigation relation type. */
private RelationType navigationRelationType=IWaveformViewer.NEXT_PREV_IN_STREAM ;
/** The file monitor. */
FileMonitor fileMonitor = new FileMonitor();
/** The file checker. */
IModificationChecker fileChecker;
/**
* Creates the composite.
*
* @param part the part
* @param parent the parent
* @param dbFactory the db factory
*/
@PostConstruct
public void createComposite(MPart part, Composite parent, IWaveformDbFactory dbFactory) {
myPart = part;
myParent = parent;
database = dbFactory.getDatabase();
database.addPropertyChangeListener(new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent evt) {
if ("WAVEFORMS".equals(evt.getPropertyName())) {
myParent.getDisplay().syncExec(new Runnable() {
@Override
public void run() {
waveformPane.setMaxTime(database.getMaxTime());
}
});
}
}
});
waveformPane = factory.createPanel(parent);
waveformPane.setMaxTime(0);
waveformPane.addPropertyChangeListener(IWaveformViewer.CURSOR_PROPERTY, new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent evt) {
Long time = (Long) evt.getNewValue();
eventBroker.post(WaveStatusBarControl.CURSOR_TIME, waveformPane.getScaledTime(time));
long marker = waveformPane.getMarkerTime(waveformPane.getSelectedMarkerId());
eventBroker.post(WaveStatusBarControl.MARKER_DIFF, waveformPane.getScaledTime(time - marker));
}
});
waveformPane.addPropertyChangeListener(IWaveformViewer.MARKER_PROPERTY, new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent evt) {
Long time = (Long) evt.getNewValue();
eventBroker.post(WaveStatusBarControl.MARKER_TIME, waveformPane.getScaledTime(time));
long cursor = waveformPane.getCursorTime();
eventBroker.post(WaveStatusBarControl.MARKER_DIFF, waveformPane.getScaledTime(cursor - time));
}
});
waveformPane.addSelectionChangedListener(new ISelectionChangedListener() {
@Override
public void selectionChanged(SelectionChangedEvent event) {
if (event.getSelection() instanceof IStructuredSelection)
selectionService.setSelection(event.getSelection());
}
});
zoomLevel = waveformPane.getZoomLevels();
setupColors();
checkForUpdates = prefs.getBoolean(PreferenceConstants.DATABASE_RELOAD, true);
filesToLoad = new ArrayList<File>();
persistedState = part.getPersistedState();
Integer files = persistedState.containsKey(DATABASE_FILE + "S")
? Integer.parseInt(persistedState.get(DATABASE_FILE + "S")) : 0;
for (int i = 0; i < files; i++) {
filesToLoad.add(new File(persistedState.get(DATABASE_FILE + i)));
}
if (filesToLoad.size() > 0)
loadDatabase(persistedState);
eventBroker.post(WaveStatusBarControl.ZOOM_LEVEL, zoomLevel[waveformPane.getZoomLevel()]);
menuService.registerContextMenu(waveformPane.getNameControl(),
"com.minres.scviewer.e4.application.popupmenu.namecontext");
menuService.registerContextMenu(waveformPane.getValueControl(),
"com.minres.scviewer.e4.application.popupmenu.namecontext");
menuService.registerContextMenu(waveformPane.getWaveformControl(),
"com.minres.scviewer.e4.application.popupmenu.wavecontext");
ePartService.addPartListener(new PartListener() {
@Override
public void partActivated(MPart part) {
if (part == myPart) {
if (fileChecker != null)
fileChecker.check();
updateAll();
}
}
});
prefs.addPreferenceChangeListener(this);
}
/* (non-Javadoc)
* @see org.eclipse.core.runtime.preferences.IEclipsePreferences.IPreferenceChangeListener#preferenceChange(org.eclipse.core.runtime.preferences.IEclipsePreferences.PreferenceChangeEvent)
*/
@Override
public void preferenceChange(PreferenceChangeEvent event) {
if (PreferenceConstants.DATABASE_RELOAD.equals(event.getKey())) {
checkForUpdates = (Boolean) event.getNewValue();
fileChecker = null;
if (checkForUpdates)
fileChecker = fileMonitor.addFileChangeListener(WaveformViewer.this, filesToLoad,
FILE_CHECK_INTERVAL);
else
fileMonitor.removeFileChangeListener(this);
} else {
setupColors();
}
}
/**
* Setup colors.
*/
protected void setupColors() {
DefaultValuesInitializer initializer = new DefaultValuesInitializer();
HashMap<WaveformColors, RGB> colorPref = new HashMap<>();
for (WaveformColors c : WaveformColors.values()) {
String prefValue = prefs.get(c.name() + "_COLOR",
StringConverter.asString(initializer.colors[c.ordinal()].getRGB()));
RGB rgb = StringConverter.asRGB(prefValue);
colorPref.put(c, rgb);
}
waveformPane.setColors(colorPref);
}
/**
* Load database.
*
* @param state the state
*/
protected void loadDatabase(final Map<String, String> state) {
fileMonitor.removeFileChangeListener(this);
Job job = new Job("Database Load Job") {
@Override
protected IStatus run(IProgressMonitor monitor) {
// convert to SubMonitor and set total number of work units
SubMonitor subMonitor = SubMonitor.convert(monitor, filesToLoad.size()+1);
try {
subMonitor.worked(1);
for (File file : filesToLoad) {
subMonitor.setTaskName("Loading "+file.getName());
database.load(file);
database.addPropertyChangeListener(waveformPane);
subMonitor.worked(1);
if (monitor.isCanceled())
return Status.CANCEL_STATUS;
}
} catch (Exception e) {
database = null;
e.printStackTrace();
return Status.CANCEL_STATUS;
}
subMonitor.done();
monitor.done();
return Status.OK_STATUS;
}
};
job.addJobChangeListener(new JobChangeAdapter() {
@Override
public void done(IJobChangeEvent event) {
if (event.getResult() == Status.OK_STATUS)
myParent.getDisplay().asyncExec(new Runnable() {
@Override
public void run() {
waveformPane.setMaxTime(database.getMaxTime());
if (state != null)
restoreWaveformViewerState(state);
fileChecker = null;
if (checkForUpdates)
fileChecker = fileMonitor.addFileChangeListener(WaveformViewer.this, filesToLoad,
FILE_CHECK_INTERVAL);
}
});
}
});
job.schedule(0);
}
/* (non-Javadoc)
* @see com.minres.scviewer.e4.application.internal.util.IFileChangeListener#fileChanged(java.util.List)
*/
@Override
public void fileChanged(List<File> file) {
final Display display = myParent.getDisplay();
display.asyncExec(new Runnable() {
@Override
public void run() {
if (MessageDialog.openQuestion(display.getActiveShell(), "Database re-load",
"Would you like to reload the database?")) {
Map<String, String> state = new HashMap<>();
saveWaveformViewerState(state);
waveformPane.getStreamList().clear();
database.clear();
if (filesToLoad.size() > 0)
loadDatabase(state);
}
}
});
fileMonitor.removeFileChangeListener(this);
}
/**
* Sets the part input.
*
* @param partInput the new part input
*/
@Inject
@Optional
public void setPartInput(@Named("input") Object partInput) {
if (partInput instanceof File) {
filesToLoad = new ArrayList<File>();
File file = (File) partInput;
if (file.exists()) {
filesToLoad.add(file);
try {
String ext = getFileExtension(file.getName());
if ("vcd".equals(ext.toLowerCase())) {
if (askIfToLoad(new File(renameFileExtension(file.getCanonicalPath(), "txdb")))) {
filesToLoad.add(new File(renameFileExtension(file.getCanonicalPath(), "txdb")));
} else if (askIfToLoad(new File(renameFileExtension(file.getCanonicalPath(), "txlog")))) {
filesToLoad.add(new File(renameFileExtension(file.getCanonicalPath(), "txlog")));
}
} else if ("txdb".equals(ext.toLowerCase()) || "txlog".equals(ext.toLowerCase())) {
if (askIfToLoad(new File(renameFileExtension(file.getCanonicalPath(), "vcd")))) {
filesToLoad.add(new File(renameFileExtension(file.getCanonicalPath(), "vcd")));
}
}
} catch (IOException e) { // silently ignore any error
}
}
if (filesToLoad.size() > 0)
loadDatabase(persistedState);
}
}
/**
* Sets the focus.
*/
@Focus
public void setFocus() {
myParent.setFocus();
}
/**
* Save state.
*
* @param part the part
*/
@PersistState
public void saveState(MPart part) {
// save changes
Map<String, String> persistedState = part.getPersistedState();
persistedState.put(DATABASE_FILE + "S", Integer.toString(filesToLoad.size()));
Integer index = 0;
for (File file : filesToLoad) {
persistedState.put(DATABASE_FILE + index, file.getAbsolutePath());
index++;
}
saveWaveformViewerState(persistedState);
}
public void saveState(String fileName){
Map<String, String> persistedState = new HashMap<>();
persistedState.put(DATABASE_FILE + "S", Integer.toString(filesToLoad.size()));
Integer index = 0;
for (File file : filesToLoad) {
persistedState.put(DATABASE_FILE + index, file.getAbsolutePath());
index++;
}
saveWaveformViewerState(persistedState);
Properties props = new Properties();
props.putAll(persistedState);
try {
FileOutputStream out = new FileOutputStream(fileName);
props.store(out, "Written by SCViewer");
out.close();
} catch (IOException e) {
e.printStackTrace();
}
}
public void loadState(String fileName){
Properties props = new Properties();
try {
FileInputStream in = new FileInputStream(fileName);
props.load(in);
in.close();
} catch (IOException e) {
e.printStackTrace();
}
@SuppressWarnings({ "unchecked", "rawtypes" })
HashMap<String, String> propMap = new HashMap<String, String>((Map) props);
restoreWaveformViewerState(propMap);
}
/**
* Save waveform viewer state.
*
* @param persistedState the persisted state
*/
protected void saveWaveformViewerState(Map<String, String> persistedState) {
Integer index;
persistedState.put(SHOWN_WAVEFORM + "S", Integer.toString(waveformPane.getStreamList().size()));
index = 0;
for (TrackEntry trackEntry : waveformPane.getStreamList()) {
persistedState.put(SHOWN_WAVEFORM + index, trackEntry.waveform.getFullName());
index++;
}
List<ICursor> cursors = waveformPane.getCursorList();
persistedState.put(SHOWN_CURSOR + "S", Integer.toString(cursors.size()));
index = 0;
for (ICursor cursor : cursors) {
persistedState.put(SHOWN_CURSOR + index, Long.toString(cursor.getTime()));
index++;
}
persistedState.put(ZOOM_LEVEL, Integer.toString(waveformPane.getZoomLevel()));
persistedState.put(BASE_LINE_TIME, Long.toString(waveformPane.getBaselineTime()));
}
/**
* Restore waveform viewer state.
*
* @param state the state
*/
protected void restoreWaveformViewerState(Map<String, String> state) {
Integer waves = state.containsKey(SHOWN_WAVEFORM+"S") ? Integer.parseInt(state.get(SHOWN_WAVEFORM + "S")):0;
List<TrackEntry> res = new LinkedList<>();
for (int i = 0; i < waves; i++) {
IWaveform<? extends IWaveformEvent> waveform = database.getStreamByName(state.get(SHOWN_WAVEFORM + i));
if (waveform != null)
res.add(new TrackEntry(waveform));
}
if (res.size() > 0)
waveformPane.getStreamList().addAll(res);
Integer cursorLength = state.containsKey(SHOWN_CURSOR+"S")?Integer.parseInt(state.get(SHOWN_CURSOR + "S")):0;
List<ICursor> cursors = waveformPane.getCursorList();
if (cursorLength == cursors.size()) {
for (int i = 0; i < cursorLength; i++) {
Long time = Long.parseLong(state.get(SHOWN_CURSOR + i));
cursors.get(i).setTime(time);
}
}
if (state.containsKey(ZOOM_LEVEL)) {
try {
Integer scale = Integer.parseInt(state.get(ZOOM_LEVEL));
waveformPane.setZoomLevel(scale);
} catch (NumberFormatException e) {
}
}
if (state.containsKey(BASE_LINE_TIME)) {
try {
Long scale = Long.parseLong(state.get(BASE_LINE_TIME));
waveformPane.setBaselineTime(scale);
} catch (NumberFormatException e) {
}
}
updateAll();
}
/**
* Update all status elements by posting respective events.
*/
private void updateAll() {
eventBroker.post(ACTIVE_WAVEFORMVIEW, this);
eventBroker.post(WaveStatusBarControl.ZOOM_LEVEL, zoomLevel[waveformPane.getZoomLevel()]);
long cursor = waveformPane.getCursorTime();
long marker = waveformPane.getMarkerTime(waveformPane.getSelectedMarkerId());
eventBroker.post(WaveStatusBarControl.CURSOR_TIME, waveformPane.getScaledTime(cursor));
eventBroker.post(WaveStatusBarControl.MARKER_TIME, waveformPane.getScaledTime(marker));
eventBroker.post(WaveStatusBarControl.MARKER_DIFF, waveformPane.getScaledTime(cursor - marker));
}
/**
* Gets the adds the waveform event.
*
* @param o the o
* @return the adds the waveform event
*/
@Inject
@Optional
public void getAddWaveformEvent(@UIEventTopic(WaveformViewer.ADD_WAVEFORM) Object o) {
Object sel = o == null ? selectionService.getSelection() : o;
if (sel instanceof IStructuredSelection)
for (Object el : ((IStructuredSelection) sel).toArray()) {
if (el instanceof IWaveform<?>)
addStreamToList((IWaveform<?>) el, false);
}
}
/**
* Ask if to load.
*
* @param txFile the tx file
* @return true, if successful
*/
protected boolean askIfToLoad(File txFile) {
if (txFile.exists() && MessageDialog.openQuestion(myParent.getDisplay().getActiveShell(), "Database open",
"Would you like to open the adjacent database " + txFile.getName() + " as well?")) {
return true;
}
return false;
}
/**
* Rename file extension.
*
* @param source the source
* @param newExt the new ext
* @return the string
*/
protected static String renameFileExtension(String source, String newExt) {
String target;
String currentExt = getFileExtension(source);
if (currentExt.equals("")) {
target = source + "." + newExt;
} else {
target = source.replaceFirst(Pattern.quote("." + currentExt) + "$", Matcher.quoteReplacement("." + newExt));
}
return target;
}
/**
* Gets the file extension.
*
* @param f the f
* @return the file extension
*/
protected static String getFileExtension(String f) {
String ext = "";
int i = f.lastIndexOf('.');
if (i > 0 && i < f.length() - 1) {
ext = f.substring(i + 1);
}
return ext;
}
/**
* Gets the model.
*
* @return the model
*/
public IWaveformDb getModel() {
return database;
}
/**
* Gets the database.
*
* @return the database
*/
public IWaveformDb getDatabase() {
return database;
}
/**
* Adds the stream to list.
*
* @param obj the obj
* @param insert the insert
*/
public void addStreamToList(IWaveform<? extends IWaveformEvent> obj, boolean insert) {
addStreamsToList(new IWaveform<?>[] { obj }, insert);
}
/**
* Adds the streams to list.
*
* @param iWaveforms the i waveforms
* @param insert the insert
*/
public void addStreamsToList(IWaveform<? extends IWaveformEvent>[] iWaveforms, boolean insert) {
List<TrackEntry> streams = new LinkedList<>();
for (IWaveform<? extends IWaveformEvent> stream : iWaveforms)
streams.add(new TrackEntry(stream));
IStructuredSelection selection = (IStructuredSelection) waveformPane.getSelection();
if (selection.size() == 0) {
waveformPane.getStreamList().addAll(streams);
} else {
Object first = selection.getFirstElement();
IWaveform<?> stream = (first instanceof ITx) ? ((ITx) first).getStream() : (IWaveform<?>) first;
TrackEntry trackEntry = waveformPane.getEntryForStream(stream);
int index = waveformPane.getStreamList().indexOf(trackEntry);
if (!insert)
index++;
waveformPane.getStreamList().addAll(index, streams);
}
}
/**
* Removes the stream from list.
*
* @param stream the stream
*/
public void removeStreamFromList(IWaveform<? extends IWaveformEvent> stream) {
TrackEntry trackEntry = waveformPane.getEntryForStream(stream);
waveformPane.getStreamList().remove(trackEntry);
}
/**
* Removes the streams from list.
*
* @param iWaveforms the i waveforms
*/
public void removeStreamsFromList(IWaveform<? extends IWaveformEvent>[] iWaveforms) {
for (IWaveform<? extends IWaveformEvent> stream : iWaveforms)
removeStreamFromList(stream);
}
/**
* Move selected.
*
* @param i the i
*/
public void moveSelected(int i) {
waveformPane.moveSelectedTrack(i);
}
/**
* Move selection.
*
* @param direction the direction
*/
public void moveSelection(GotoDirection direction ) {
moveSelection(direction, navigationRelationType);
}
/**
* Move selection.
*
* @param direction the direction
* @param relationType the relation type
*/
public void moveSelection(GotoDirection direction, RelationType relationType) {
waveformPane.moveSelection(direction, relationType);
}
/**
* Move cursor.
*
* @param direction the direction
*/
public void moveCursor(GotoDirection direction) {
waveformPane.moveCursor(direction);
}
/**
* Sets the zoom level.
*
* @param level the new zoom level
*/
public void setZoomLevel(Integer level) {
if (level < 0)
level = 0;
if (level > zoomLevel.length - 1)
level = zoomLevel.length - 1;
waveformPane.setZoomLevel(level);
updateAll();
}
/**
* Sets the zoom fit.
*/
public void setZoomFit() {
waveformPane.setZoomLevel(6);
updateAll();
}
/**
* Gets the zoom level.
*
* @return the zoom level
*/
public int getZoomLevel() {
return waveformPane.getZoomLevel();
}
/**
* Gets the selection.
*
* @return the selection
*/
public ISelection getSelection() {
return waveformPane.getSelection();
}
/**
* Sets the selection.
*
* @param structuredSelection the new selection
*/
public void setSelection(IStructuredSelection structuredSelection) {
waveformPane.setSelection(structuredSelection, true);
}
/**
* Gets the scaled time.
*
* @param time the time
* @return the scaled time
*/
public String getScaledTime(Long time) {
return waveformPane.getScaledTime(time);
}
/**
* Store design brower state.
*
* @param browserState the browser state
*/
public void storeDesignBrowerState(Object browserState) {
this.browserState=browserState;
}
/**
* Retrieve design brower state.
*
* @return the object
*/
public Object retrieveDesignBrowerState() {
return browserState;
}
/**
* Store transaction details settings
*
* @param detailsSettings the details settings
*/
public void storeDetailsSettings(Object detailsSettings) {
this.detailsSettings=detailsSettings;
}
/**
* Retrieve design details settings.
*
* @return the details settings
*/
public Object retrieveDetailsSettings() {
return detailsSettings;
}
/**
* Gets the all relation types.
*
* @return the all relation types
*/
public List<RelationType> getAllRelationTypes() {
List<RelationType> res =new ArrayList<>();
res.add(IWaveformViewer.NEXT_PREV_IN_STREAM);
res.addAll(database.getAllRelationTypes());
return res;
}
/**
* Gets the selection relation types.
*
* @return the selection relation types
*/
public List<RelationType> getSelectionRelationTypes() {
List<RelationType> res =new ArrayList<>();
res.add(IWaveformViewer.NEXT_PREV_IN_STREAM);
ISelection selection = waveformPane.getSelection();
if(selection instanceof IStructuredSelection && !selection.isEmpty()){
IStructuredSelection sel=(IStructuredSelection) selection;
if(sel.getFirstElement() instanceof ITx){
ITx tx = (ITx) sel.getFirstElement();
for(ITxRelation rel:tx.getIncomingRelations()){
if(!res.contains(rel.getRelationType()))
res.add(rel.getRelationType());
}
for(ITxRelation rel:tx.getOutgoingRelations()){
if(!res.contains(rel.getRelationType()))
res.add(rel.getRelationType());
}
}
}
return res;
}
/**
* Gets the relation type filter.
*
* @return the relation type filter
*/
public RelationType getRelationTypeFilter() {
return navigationRelationType;
}
/**
* Sets the navigation relation type.
*
* @param relationName the new navigation relation type
*/
public void setNavigationRelationType(String relationName) {
setNavigationRelationType(RelationType.create(relationName));
}
/**
* Sets the navigation relation type.
*
* @param relationType the new navigation relation type
*/
public void setNavigationRelationType(RelationType relationType) {
if(navigationRelationType!=relationType) waveformPane.setHighliteRelation(relationType);
navigationRelationType=relationType;
}
}

View File

@ -1,71 +0,0 @@
/*******************************************************************************
* Copyright (c) 2015 MINRES Technologies GmbH and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* MINRES Technologies GmbH - initial API and implementation
*******************************************************************************/
package com.minres.scviewer.e4.application.preferences;
import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;
import org.eclipse.core.runtime.preferences.InstanceScope;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.resource.StringConverter;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Color;
import org.eclipse.wb.swt.SWTResourceManager;
import com.minres.scviewer.database.ui.WaveformColors;
import com.opcoach.e4.preferences.ScopedPreferenceStore;
/**
* The Class DefaultValuesInitializer.
*/
public class DefaultValuesInitializer extends AbstractPreferenceInitializer {
/** The default colors. */
public final Color[] colors = new Color[WaveformColors.values().length];
/**
* Instantiates a new default values initializer.
*/
public DefaultValuesInitializer() {
colors[WaveformColors.LINE.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_RED);
colors[WaveformColors.LINE_HIGHLITE.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_CYAN);
colors[WaveformColors.TRACK_BG_EVEN.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_BLACK);
colors[WaveformColors.TRACK_BG_ODD.ordinal()] = SWTResourceManager.getColor(40, 40, 40);
colors[WaveformColors.TRACK_BG_HIGHLITE.ordinal()] = SWTResourceManager.getColor(40, 40, 80);
colors[WaveformColors.TX_BG.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_GREEN);
colors[WaveformColors.TX_BG_HIGHLITE.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_DARK_GREEN);
colors[WaveformColors.TX_BORDER.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_RED);
colors[WaveformColors.SIGNAL0.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_DARK_GREEN);
colors[WaveformColors.SIGNAL1.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_DARK_GREEN);
colors[WaveformColors.SIGNALZ.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_GRAY);
colors[WaveformColors.SIGNALX.ordinal()] = SWTResourceManager.getColor(255, 128, 182);
colors[WaveformColors.SIGNAL_TEXT.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_WHITE);
colors[WaveformColors.CURSOR.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_RED);
colors[WaveformColors.CURSOR_DRAG.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_GRAY);
colors[WaveformColors.CURSOR_TEXT.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_WHITE);
colors[WaveformColors.MARKER.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_DARK_GRAY);
colors[WaveformColors.MARKER_TEXT.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_WHITE);
colors[WaveformColors.REL_ARROW.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_MAGENTA);
colors[WaveformColors.REL_ARROW_HIGHLITE.ordinal()] = SWTResourceManager.getColor(255, 128, 255);
}
/* (non-Javadoc)
* @see org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer#initializeDefaultPreferences()
*/
@Override
public void initializeDefaultPreferences() {
IPreferenceStore store = new ScopedPreferenceStore(InstanceScope.INSTANCE, PreferenceConstants.PREFERENCES_SCOPE);
store.setDefault(PreferenceConstants.DATABASE_RELOAD, true);
for (WaveformColors c : WaveformColors.values()) {
store.setDefault(c.name()+"_COLOR", StringConverter.asString(colors[c.ordinal()].getRGB()));
}
}
}

View File

@ -1,79 +0,0 @@
/*******************************************************************************
* Copyright (c) 2015 MINRES Technologies GmbH and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* MINRES Technologies GmbH - initial API and implementation
*******************************************************************************/
package com.minres.scviewer.e4.application.preferences;
/**
* The Class PreferenceConstants for the preferences dialog & setting.
*/
public class PreferenceConstants {
/** The Constant PREFERENCES_SCOPE. */
public static final String PREFERENCES_SCOPE="com.minres.scviewer.e4.application";
/** The Constant DATABASE_RELOAD. */
public static final String DATABASE_RELOAD="databaseReload";
/** The Constant LINE_COLOR. */
public static final String LINE_COLOR="LINE_COLOR";
/** The Constant LINE_HIGHLITE_COLOR. */
public static final String LINE_HIGHLITE_COLOR="LINE_HIGHLITE_COLOR";
/** The Constant TRACK_BG_EVEN_COLOR. */
public static final String TRACK_BG_EVEN_COLOR="TRACK_BG_EVEN_COLOR";
/** The Constant TRACK_BG_ODD_COLOR. */
public static final String TRACK_BG_ODD_COLOR="TRACK_BG_ODD_COLOR";
/** The Constant TRACK_BG_HIGHLITE_COLOR. */
public static final String TRACK_BG_HIGHLITE_COLOR="TRACK_BG_HIGHLITE_COLOR";
/** The Constant TX_BG_COLOR. */
public static final String TX_BG_COLOR="TX_BG_COLOR";
/** The Constant TX_BG_HIGHLITE_COLOR. */
public static final String TX_BG_HIGHLITE_COLOR="TX_BG_HIGHLITE_COLOR";
/** The Constant TX_BORDER_COLOR. */
public static final String TX_BORDER_COLOR="TX_BORDER_COLOR";
/** The Constant SIGNAL0_COLOR. */
public static final String SIGNAL0_COLOR="SIGNAL0_COLOR";
/** The Constant SIGNAL1_COLOR. */
public static final String SIGNAL1_COLOR="SIGNAL1_COLOR";
/** The Constant SIGNALZ_COLOR. */
public static final String SIGNALZ_COLOR="SIGNALZ_COLOR";
/** The Constant SIGNALX_COLOR. */
public static final String SIGNALX_COLOR="SIGNALX_COLOR";
/** The Constant SIGNAL_TEXT_COLOR. */
public static final String SIGNAL_TEXT_COLOR="SIGNAL_TEXT_COLOR";
/** The Constant CURSOR_COLOR. */
public static final String CURSOR_COLOR="CURSOR_COLOR";
/** The Constant CURSOR_DRAG_COLOR. */
public static final String CURSOR_DRAG_COLOR="CURSOR_DRAG_COLOR";
/** The Constant CURSOR_TEXT_COLOR. */
public static final String CURSOR_TEXT_COLOR="CURSOR_TEXT_COLOR";
/** The Constant MARKER_COLOR. */
public static final String MARKER_COLOR="MARKER_COLOR";
/** The Constant MARKER_TEXT_COLOR. */
public static final String MARKER_TEXT_COLOR="MARKER_TEXT_COLOR";
}

View File

@ -1,124 +0,0 @@
/*******************************************************************************
* Copyright (c) 2015 MINRES Technologies GmbH and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* MINRES Technologies GmbH - initial API and implementation
*******************************************************************************/
package com.minres.scviewer.e4.application.provider;
import java.util.ArrayList;
import java.util.List;
import org.eclipse.jface.viewers.ILabelProvider;
import org.eclipse.jface.viewers.ILabelProviderListener;
import org.eclipse.swt.graphics.Image;
import org.eclipse.wb.swt.ResourceManager;
import com.minres.scviewer.database.IHierNode;
import com.minres.scviewer.database.ISignal;
import com.minres.scviewer.database.ISignalChangeMulti;
import com.minres.scviewer.database.ITxStream;
import com.minres.scviewer.database.IWaveformDb;
import com.minres.scviewer.e4.application.parts.LoadingWaveformDb;
/**
* The Class TxDbLabelProvider providing the labels for the respective viewers.
*/
public class TxDbLabelProvider implements ILabelProvider {
/** The listeners. */
private List<ILabelProviderListener> listeners = new ArrayList<ILabelProviderListener>();
/** The wave. */
private Image loadinDatabase, database, stream, signal, folder, wave;
/**
* Instantiates a new tx db label provider.
*/
public TxDbLabelProvider() {
super();
loadinDatabase=ResourceManager.getPluginImage("com.minres.scviewer.e4.application", "icons/database_go.png");
database=ResourceManager.getPluginImage("com.minres.scviewer.e4.application", "icons/database.png");
stream=ResourceManager.getPluginImage("com.minres.scviewer.e4.application", "icons/stream.png");
folder=ResourceManager.getPluginImage("com.minres.scviewer.e4.application", "icons/folder.png");
signal=ResourceManager.getPluginImage("com.minres.scviewer.e4.application", "icons/signal.png");
wave=ResourceManager.getPluginImage("com.minres.scviewer.e4.application", "icons/wave.png");
}
/* (non-Javadoc)
* @see org.eclipse.jface.viewers.IBaseLabelProvider#addListener(org.eclipse.jface.viewers.ILabelProviderListener)
*/
@Override
public void addListener(ILabelProviderListener listener) {
listeners.add(listener);
}
/* (non-Javadoc)
* @see org.eclipse.jface.viewers.IBaseLabelProvider#dispose()
*/
@Override
public void dispose() {
if(loadinDatabase!=null) database.dispose();
if(database!=null) database.dispose();
if(stream!=null) stream.dispose();
if(folder!=null) folder.dispose();
if(signal!=null) signal.dispose();
if(wave!=null) wave.dispose();
}
/* (non-Javadoc)
* @see org.eclipse.jface.viewers.IBaseLabelProvider#isLabelProperty(java.lang.Object, java.lang.String)
*/
@Override
public boolean isLabelProperty(Object element, String property) {
return false;
}
/* (non-Javadoc)
* @see org.eclipse.jface.viewers.IBaseLabelProvider#removeListener(org.eclipse.jface.viewers.ILabelProviderListener)
*/
@Override
public void removeListener(ILabelProviderListener listener) {
listeners.remove(listener);
}
/* (non-Javadoc)
* @see org.eclipse.jface.viewers.ILabelProvider#getImage(java.lang.Object)
*/
@Override
public Image getImage(Object element) {
if(element instanceof IWaveformDb){
if(element instanceof LoadingWaveformDb)
return loadinDatabase;
else
return database;
}else if(element instanceof ITxStream){
return stream;
}else if(element instanceof ISignal<?>){
Object o = ((ISignal<?>)element).getEvents().firstEntry().getValue();
if(o instanceof ISignalChangeMulti)
return wave;
else
return signal;
}else if(element instanceof IHierNode){
return folder;
} else
return null;
}
/* (non-Javadoc)
* @see org.eclipse.jface.viewers.ILabelProvider#getText(java.lang.Object)
*/
@Override
public String getText(Object element) {
return ((IHierNode)element).getName();
}
}

View File

@ -1,415 +0,0 @@
/*******************************************************************************
* Copyright (c) 2015 MINRES Technologies GmbH and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* MINRES Technologies GmbH - initial API and implementation
*******************************************************************************/
package org.eclipse.wb.swt;
import java.io.File;
import java.io.InputStream;
import java.lang.reflect.Constructor;
import java.lang.reflect.Method;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import org.eclipse.core.runtime.Platform;
import org.eclipse.jface.resource.CompositeImageDescriptor;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.graphics.Rectangle;
import org.osgi.framework.Bundle;
/**
* Utility class for managing OS resources associated with SWT/JFace controls such as colors, fonts, images,
* etc.
*
* !!! IMPORTANT !!! Application code must explicitly invoke the <code>dispose()</code> method to release the
* operating system resources managed by cached objects when those objects and OS resources are no longer
* needed (e.g. on application shutdown)
*
* This class may be freely distributed as part of any application or plugin.
* <p>
*
* @author scheglov_ke
* @author Dan Rubel
*/
public class ResourceManager extends SWTResourceManager {
////////////////////////////////////////////////////////////////////////////
//
// Image
//
////////////////////////////////////////////////////////////////////////////
private static Map<ImageDescriptor, Image> m_descriptorImageMap = new HashMap<ImageDescriptor, Image>();
/**
* Returns an {@link ImageDescriptor} stored in the file at the specified path relative to the specified
* class.
*
* @param clazz
* the {@link Class} relative to which to find the image descriptor.
* @param path
* the path to the image file.
* @return the {@link ImageDescriptor} stored in the file at the specified path.
*/
public static ImageDescriptor getImageDescriptor(Class<?> clazz, String path) {
return ImageDescriptor.createFromFile(clazz, path);
}
/**
* Returns an {@link ImageDescriptor} stored in the file at the specified path.
*
* @param path
* the path to the image file.
* @return the {@link ImageDescriptor} stored in the file at the specified path.
*/
public static ImageDescriptor getImageDescriptor(String path) {
try {
return ImageDescriptor.createFromURL(new File(path).toURI().toURL());
} catch (MalformedURLException e) {
return null;
}
}
/**
* Returns an {@link Image} based on the specified {@link ImageDescriptor}.
*
* @param descriptor
* the {@link ImageDescriptor} for the {@link Image}.
* @return the {@link Image} based on the specified {@link ImageDescriptor}.
*/
public static Image getImage(ImageDescriptor descriptor) {
if (descriptor == null) {
return null;
}
Image image = m_descriptorImageMap.get(descriptor);
if (image == null) {
image = descriptor.createImage();
m_descriptorImageMap.put(descriptor, image);
}
return image;
}
/**
* Maps images to decorated images.
*/
@SuppressWarnings("unchecked")
private static Map<Image, Map<Image, Image>>[] m_decoratedImageMap = new Map[LAST_CORNER_KEY];
/**
* Returns an {@link Image} composed of a base image decorated by another image.
*
* @param baseImage
* the base {@link Image} that should be decorated.
* @param decorator
* the {@link Image} to decorate the base image.
* @return {@link Image} The resulting decorated image.
*/
public static Image decorateImage(Image baseImage, Image decorator) {
return decorateImage(baseImage, decorator, BOTTOM_RIGHT);
}
/**
* Returns an {@link Image} composed of a base image decorated by another image.
*
* @param baseImage
* the base {@link Image} that should be decorated.
* @param decorator
* the {@link Image} to decorate the base image.
* @param corner
* the corner to place decorator image.
* @return the resulting decorated {@link Image}.
*/
public static Image decorateImage(final Image baseImage, final Image decorator, final int corner) {
if (corner <= 0 || corner >= LAST_CORNER_KEY) {
throw new IllegalArgumentException("Wrong decorate corner");
}
Map<Image, Map<Image, Image>> cornerDecoratedImageMap = m_decoratedImageMap[corner];
if (cornerDecoratedImageMap == null) {
cornerDecoratedImageMap = new HashMap<Image, Map<Image, Image>>();
m_decoratedImageMap[corner] = cornerDecoratedImageMap;
}
Map<Image, Image> decoratedMap = cornerDecoratedImageMap.get(baseImage);
if (decoratedMap == null) {
decoratedMap = new HashMap<Image, Image>();
cornerDecoratedImageMap.put(baseImage, decoratedMap);
}
//
Image result = decoratedMap.get(decorator);
if (result == null) {
final Rectangle bib = baseImage.getBounds();
final Rectangle dib = decorator.getBounds();
final Point baseImageSize = new Point(bib.width, bib.height);
CompositeImageDescriptor compositImageDesc = new CompositeImageDescriptor() {
@Override
protected void drawCompositeImage(int width, int height) {
drawImage(baseImage.getImageData(), 0, 0);
if (corner == TOP_LEFT) {
drawImage(decorator.getImageData(), 0, 0);
} else if (corner == TOP_RIGHT) {
drawImage(decorator.getImageData(), bib.width - dib.width, 0);
} else if (corner == BOTTOM_LEFT) {
drawImage(decorator.getImageData(), 0, bib.height - dib.height);
} else if (corner == BOTTOM_RIGHT) {
drawImage(decorator.getImageData(), bib.width - dib.width, bib.height - dib.height);
}
}
@Override
protected Point getSize() {
return baseImageSize;
}
};
//
result = compositImageDesc.createImage();
decoratedMap.put(decorator, result);
}
return result;
}
/**
* Dispose all of the cached images.
*/
public static void disposeImages() {
SWTResourceManager.disposeImages();
// dispose ImageDescriptor images
{
for (Iterator<Image> I = m_descriptorImageMap.values().iterator(); I.hasNext();) {
I.next().dispose();
}
m_descriptorImageMap.clear();
}
// dispose decorated images
for (int i = 0; i < m_decoratedImageMap.length; i++) {
Map<Image, Map<Image, Image>> cornerDecoratedImageMap = m_decoratedImageMap[i];
if (cornerDecoratedImageMap != null) {
for (Map<Image, Image> decoratedMap : cornerDecoratedImageMap.values()) {
for (Image image : decoratedMap.values()) {
image.dispose();
}
decoratedMap.clear();
}
cornerDecoratedImageMap.clear();
}
}
// dispose plugin images
{
for (Iterator<Image> I = m_URLImageMap.values().iterator(); I.hasNext();) {
I.next().dispose();
}
m_URLImageMap.clear();
}
}
////////////////////////////////////////////////////////////////////////////
//
// Plugin images support
//
////////////////////////////////////////////////////////////////////////////
/**
* Maps URL to images.
*/
private static Map<String, Image> m_URLImageMap = new HashMap<String, Image>();
/**
* Provider for plugin resources, used by WindowBuilder at design time.
*/
public interface PluginResourceProvider {
URL getEntry(String symbolicName, String path);
}
/**
* Instance of {@link PluginResourceProvider}, used by WindowBuilder at design time.
*/
private static PluginResourceProvider m_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.
*
* @param symbolicName
* the symbolic name of the {@link Bundle}.
* @param path
* the path of the resource entry.
* @return the {@link Image} stored in the file at the specified path.
*/
public static Image getPluginImage(String symbolicName, String path) {
try {
URL url = getPluginImageURL(symbolicName, path);
if (url != null) {
return getPluginImageFromUrl(url);
}
} catch (Throwable e) {
// Ignore any exceptions
}
return null;
}
/**
* Returns an {@link Image} based on given {@link URL}.
*/
private static Image getPluginImageFromUrl(URL url) {
try {
try {
String key = url.toExternalForm();
Image image = m_URLImageMap.get(key);
if (image == null) {
InputStream stream = url.openStream();
try {
image = getImage(stream);
m_URLImageMap.put(key, image);
} finally {
stream.close();
}
}
return image;
} catch (Throwable 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
}
return null;
}
/**
* Returns an {@link ImageDescriptor} based on a {@link Bundle} and resource entry path.
*
* @param symbolicName
* the symbolic name of the {@link Bundle}.
* @param path
* the path of the resource entry.
* @return the {@link ImageDescriptor} based on a {@link Bundle} and resource entry path.
*/
public static ImageDescriptor getPluginImageDescriptor(String symbolicName, String path) {
try {
URL url = getPluginImageURL(symbolicName, path);
if (url != null) {
return ImageDescriptor.createFromURL(url);
}
} catch (Throwable e) {
// Ignore any exceptions
}
return null;
}
/**
* Returns an {@link URL} based on a {@link Bundle} and resource entry path.
*/
private static URL getPluginImageURL(String symbolicName, String path) {
// try runtime plugins
{
Bundle bundle = Platform.getBundle(symbolicName);
if (bundle != null) {
return bundle.getEntry(path);
}
}
// try design time provider
if (m_designTimePluginResourceProvider != null) {
return m_designTimePluginResourceProvider.getEntry(symbolicName, path);
}
// no such resource
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
//
////////////////////////////////////////////////////////////////////////////
/**
* Dispose of cached objects and their underlying OS resources. This should only be called when the cached
* objects are no longer needed (e.g. on application shutdown).
*/
public static void dispose() {
disposeColors();
disposeFonts();
disposeImages();
}
}

View File

@ -1,34 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<launchConfiguration type="org.eclipse.pde.ui.RuntimeWorkbench">
<booleanAttribute key="append.args" value="true"/>
<stringAttribute key="application" value="org.eclipse.e4.ui.workbench.swt.E4Application"/>
<booleanAttribute key="askclear" value="true"/>
<booleanAttribute key="automaticAdd" value="false"/>
<booleanAttribute key="automaticValidate" value="false"/>
<stringAttribute key="bootstrap" value=""/>
<stringAttribute key="checked" value="[NONE]"/>
<booleanAttribute key="clearConfig" value="false"/>
<booleanAttribute key="clearws" value="false"/>
<booleanAttribute key="clearwslog" value="false"/>
<stringAttribute key="configLocation" value="${workspace_loc}/.metadata/.plugins/org.eclipse.pde.core/SCViewer (restart)"/>
<booleanAttribute key="default" value="false"/>
<booleanAttribute key="includeOptional" value="true"/>
<stringAttribute key="location" value="${workspace_loc}/../runtime-com.minres.scviewer.e4.application.product"/>
<booleanAttribute key="org.eclipse.jdt.launching.ATTR_USE_START_ON_FIRST_THREAD" value="true"/>
<stringAttribute key="org.eclipse.jdt.launching.JRE_CONTAINER" value="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-os ${target.os} -ws ${target.ws} -arch ${target.arch} -nl ${target.nl} -consoleLog"/>
<stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.pde.ui.workbenchClasspathProvider"/>
<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Xms40m -Xmx512m -Xdock:icon=../Resources/Eclipse.icns -XstartOnFirstThread -Dorg.eclipse.swt.internal.carbon.smallFonts"/>
<stringAttribute key="pde.version" value="3.3"/>
<stringAttribute key="product" value="com.minres.scviewer.e4.application.product"/>
<stringAttribute key="productFile" value="/com.minres.scviewer.e4.application/com.minres.scviewer.e4.application.product"/>
<stringAttribute key="selected_target_plugins" value="com.google.guava@default:default,com.ibm.icu@default:default,javax.annotation@default:default,javax.inject@default:default,javax.servlet@default:default,javax.xml@default:default,org.apache.ant@default:default,org.apache.batik.css@default:default,org.apache.batik.util.gui@default:default,org.apache.batik.util@default:default,org.apache.commons.jxpath@default:default,org.apache.commons.logging@default:default,org.apache.felix.gogo.command@default:default,org.apache.felix.gogo.runtime@default:default,org.apache.felix.gogo.shell@default:default,org.codehaus.groovy@default:default,org.eclipse.ant.core@default:default,org.eclipse.compare.core@default:default,org.eclipse.core.commands@default:default,org.eclipse.core.contenttype@default:default,org.eclipse.core.databinding.beans@default:default,org.eclipse.core.databinding.observable@default:default,org.eclipse.core.databinding.property@default:default,org.eclipse.core.databinding@default:default,org.eclipse.core.expressions@default:default,org.eclipse.core.filesystem.java7@default:false,org.eclipse.core.filesystem.macosx@default:false,org.eclipse.core.filesystem@default:default,org.eclipse.core.jobs@default:default,org.eclipse.core.resources@default:default,org.eclipse.core.runtime.compatibility.registry@default:false,org.eclipse.core.runtime@default:true,org.eclipse.core.variables@default:default,org.eclipse.e4.core.commands@default:default,org.eclipse.e4.core.contexts@default:default,org.eclipse.e4.core.di.annotations@default:default,org.eclipse.e4.core.di.extensions@default:default,org.eclipse.e4.core.di@default:default,org.eclipse.e4.core.services@default:default,org.eclipse.e4.emf.xpath@default:default,org.eclipse.e4.ui.bindings@default:default,org.eclipse.e4.ui.css.core@default:default,org.eclipse.e4.ui.css.swt.theme@default:default,org.eclipse.e4.ui.css.swt@default:default,org.eclipse.e4.ui.di@default:default,org.eclipse.e4.ui.model.workbench@default:default,org.eclipse.e4.ui.services@default:default,org.eclipse.e4.ui.widgets@default:default,org.eclipse.e4.ui.workbench.addons.swt@default:default,org.eclipse.e4.ui.workbench.renderers.swt.cocoa@default:false,org.eclipse.e4.ui.workbench.renderers.swt@default:default,org.eclipse.e4.ui.workbench.swt@default:default,org.eclipse.e4.ui.workbench3@default:default,org.eclipse.e4.ui.workbench@default:default,org.eclipse.emf.common@default:default,org.eclipse.emf.ecore.change@default:default,org.eclipse.emf.ecore.xmi@default:default,org.eclipse.emf.ecore@default:default,org.eclipse.equinox.app@default:default,org.eclipse.equinox.bidi@default:default,org.eclipse.equinox.common@2:true,org.eclipse.equinox.concurrent@default:default,org.eclipse.equinox.console@default:default,org.eclipse.equinox.ds@1:true,org.eclipse.equinox.event@default:default,org.eclipse.equinox.preferences@default:default,org.eclipse.equinox.registry@default:default,org.eclipse.equinox.util@default:default,org.eclipse.help@default:default,org.eclipse.jface.databinding@default:default,org.eclipse.jface.text@default:default,org.eclipse.jface@default:default,org.eclipse.osgi.compatibility.state@default:false,org.eclipse.osgi.services@default:default,org.eclipse.osgi@-1:true,org.eclipse.swt.cocoa.macosx.x86_64@default:false,org.eclipse.swt@default:default,org.eclipse.team.core@default:default,org.eclipse.text@default:default,org.eclipse.ui.cocoa@default:false,org.eclipse.ui.console@default:default,org.eclipse.ui.workbench.texteditor@default:default,org.eclipse.ui.workbench@default:default,org.eclipse.ui@default:default,org.hamcrest.core@default:default,org.junit@default:default,org.w3c.css.sac@default:default,org.w3c.dom.events@default:default,org.w3c.dom.smil@default:default,org.w3c.dom.svg@default:default"/>
<stringAttribute key="selected_workspace_plugins" value="com.minres.scviewer.database.sqlite@default:default,com.minres.scviewer.database.text@default:default,com.minres.scviewer.database.ui.swt@default:default,com.minres.scviewer.database.ui@default:default,com.minres.scviewer.database.vcd@default:default,com.minres.scviewer.database@default:default,com.minres.scviewer.e4.application@default:default,com.opcoach.e4.preferences@default:default"/>
<booleanAttribute key="show_selected_only" value="false"/>
<booleanAttribute key="tracing" value="false"/>
<booleanAttribute key="useCustomFeatures" value="false"/>
<booleanAttribute key="useDefaultConfig" value="true"/>
<booleanAttribute key="useDefaultConfigArea" value="true"/>
<booleanAttribute key="useProduct" value="true"/>
<booleanAttribute key="usefeatures" value="false"/>
</launchConfiguration>

View File

@ -1,120 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<?pde version="3.5"?>
<product name="SCViewer" uid="scviewer" id="com.minres.scviewer.e4.application.product" application="org.eclipse.e4.ui.workbench.swt.E4Application" version="1.0.0.qualifier" useFeatures="false" includeLaunchers="true">
<configIni use="default">
</configIni>
<launcherArgs>
<programArgs>-clearPersistedState -data @none
</programArgs>
<vmArgsMac>-XstartOnFirstThread -Dorg.eclipse.swt.internal.carbon.smallFonts
</vmArgsMac>
</launcherArgs>
<windowImages i16="/com.minres.scviewer.e4.application/icons/SCViewer_16x32.png" i32="/com.minres.scviewer.e4.application/icons/SCViewer_32x32.png" i48="/com.minres.scviewer.e4.application/icons/SCViewer_48x32.png" i64="/com.minres.scviewer.e4.application/icons/SCViewer_64x32.png" i128="/com.minres.scviewer.e4.application/icons/SCViewer_128x32.png" i256="/com.minres.scviewer.e4.application/icons/SCViewer_256x32.png"/>
<launcher name="scviewer">
<linux icon="icons/SCViewer_512x512.xpm"/>
<macosx icon="icons/SCViewer.icns"/>
<solaris/>
<win useIco="false">
<bmp
winSmallHigh="icons/SCViewer_16x16@32.bmp"
winSmallLow="icons/SCViewer_16x16@8.bmp"
winMediumHigh="icons/SCViewer_32x32@32.bmp"
winMediumLow="icons/SCViewer_32x32@8.bmp"
winLargeHigh="icons/SCViewer_48x48@32.bmp"
winLargeLow="icons/SCViewer_48x48@8.bmp"
winExtraLargeHigh="icons/SCViewer_256x256@32.bmp"/>
</win>
</launcher>
<vm>
</vm>
<plugins>
<plugin id="com.ibm.icu"/>
<plugin id="com.minres.scviewer.database"/>
<plugin id="com.minres.scviewer.database.sqlite"/>
<plugin id="com.minres.scviewer.database.text"/>
<plugin id="com.minres.scviewer.database.ui"/>
<plugin id="com.minres.scviewer.database.ui.swt"/>
<plugin id="com.minres.scviewer.database.vcd"/>
<plugin id="com.minres.scviewer.e4.application"/>
<plugin id="com.opcoach.e4.preferences"/>
<plugin id="javax.annotation"/>
<plugin id="javax.inject"/>
<plugin id="javax.xml"/>
<plugin id="org.apache.batik.css"/>
<plugin id="org.apache.batik.util"/>
<plugin id="org.apache.batik.util.gui"/>
<plugin id="org.apache.commons.jxpath"/>
<plugin id="org.apache.commons.logging"/>
<plugin id="org.eclipse.core.commands"/>
<plugin id="org.eclipse.core.contenttype"/>
<plugin id="org.eclipse.core.databinding"/>
<plugin id="org.eclipse.core.databinding.beans"/>
<plugin id="org.eclipse.core.databinding.observable"/>
<plugin id="org.eclipse.core.databinding.property"/>
<plugin id="org.eclipse.core.expressions"/>
<plugin id="org.eclipse.core.filesystem"/>
<plugin id="org.eclipse.core.filesystem.macosx" fragment="true"/>
<plugin id="org.eclipse.core.jobs"/>
<plugin id="org.eclipse.core.resources"/>
<plugin id="org.eclipse.core.runtime"/>
<plugin id="org.eclipse.core.runtime.compatibility.registry" fragment="true"/>
<plugin id="org.eclipse.e4.core.commands"/>
<plugin id="org.eclipse.e4.core.contexts"/>
<plugin id="org.eclipse.e4.core.di"/>
<plugin id="org.eclipse.e4.core.di.annotations"/>
<plugin id="org.eclipse.e4.core.di.extensions"/>
<plugin id="org.eclipse.e4.core.services"/>
<plugin id="org.eclipse.e4.emf.xpath"/>
<plugin id="org.eclipse.e4.ui.bindings"/>
<plugin id="org.eclipse.e4.ui.css.core"/>
<plugin id="org.eclipse.e4.ui.css.swt"/>
<plugin id="org.eclipse.e4.ui.css.swt.theme"/>
<plugin id="org.eclipse.e4.ui.di"/>
<plugin id="org.eclipse.e4.ui.model.workbench"/>
<plugin id="org.eclipse.e4.ui.services"/>
<plugin id="org.eclipse.e4.ui.widgets"/>
<plugin id="org.eclipse.e4.ui.workbench"/>
<plugin id="org.eclipse.e4.ui.workbench.renderers.swt"/>
<plugin id="org.eclipse.e4.ui.workbench.renderers.swt.cocoa" fragment="true"/>
<plugin id="org.eclipse.e4.ui.workbench.swt"/>
<plugin id="org.eclipse.e4.ui.workbench3"/>
<plugin id="org.eclipse.emf.common"/>
<plugin id="org.eclipse.emf.ecore"/>
<plugin id="org.eclipse.emf.ecore.change"/>
<plugin id="org.eclipse.emf.ecore.xmi"/>
<plugin id="org.eclipse.equinox.app"/>
<plugin id="org.eclipse.equinox.common"/>
<plugin id="org.eclipse.equinox.concurrent"/>
<plugin id="org.eclipse.equinox.ds"/>
<plugin id="org.eclipse.equinox.event"/>
<plugin id="org.eclipse.equinox.preferences"/>
<plugin id="org.eclipse.equinox.registry"/>
<plugin id="org.eclipse.equinox.util"/>
<plugin id="org.eclipse.jface"/>
<plugin id="org.eclipse.jface.databinding"/>
<plugin id="org.eclipse.osgi"/>
<plugin id="org.eclipse.osgi.compatibility.state" fragment="true"/>
<plugin id="org.eclipse.osgi.services"/>
<plugin id="org.eclipse.swt"/>
<plugin id="org.eclipse.swt.cocoa.macosx.x86_64" fragment="true"/>
<plugin id="org.w3c.css.sac"/>
<plugin id="org.w3c.dom.events"/>
<plugin id="org.w3c.dom.smil"/>
<plugin id="org.w3c.dom.svg"/>
</plugins>
<configurations>
<plugin id="org.eclipse.core.runtime" autoStart="true" startLevel="0" />
<plugin id="org.eclipse.equinox.common" autoStart="true" startLevel="2" />
<plugin id="org.eclipse.equinox.ds" autoStart="true" startLevel="2" />
<plugin id="org.eclipse.equinox.event" autoStart="true" startLevel="2" />
</configurations>
</product>

View File

@ -1 +0,0 @@
/workspace/

View File

@ -1,143 +0,0 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.minres.scviewer</groupId>
<artifactId>com.minres.scviewer.parent</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>pom</packaging>
<modules>
<module>../com.minres.scviewer.target</module>
<module>../com.minres.scviewer.database</module>
<module>../com.minres.scviewer.database.sqlite</module>
<module>../com.minres.scviewer.database.text</module>
<module>../com.minres.scviewer.database.vcd</module>
<module>../com.minres.scviewer.database.ui</module>
<module>../com.minres.scviewer.database.ui.swt</module>
<module>../com.opcoach.e4.preferences</module>
<module>../com.minres.scviewer.e4.application</module>
<module>../com.minres.scviewer.ui</module>
<module>../com.minres.scviewer.feature</module>
<module>../com.minres.scviewer.updateSite</module>
<module>../com.minres.scviewer.e4.product</module>
</modules>
<properties>
<tycho-version>0.23.1</tycho-version>
<tycho-extras-version>${tycho-version}</tycho-extras-version>
<groovy-eclipse-compiler-version>2.8.0-01</groovy-eclipse-compiler-version>
<!-- <groovy-eclipse-batch-version>2.0.5</groovy-eclipse-batch-version> -->
<groovy-eclipse-batch-version>2.1.8-01</groovy-eclipse-batch-version>
</properties>
<repositories>
<repository>
<id>mars</id>
<layout>p2</layout>
<url>http://download.eclipse.org/releases/mars</url>
</repository>
<repository>
<id>GRECLIPSE</id>
<layout>p2</layout>
<url>http://dist.springsource.org/snapshot/GRECLIPSE/e4.5</url>
</repository>
</repositories>
<build>
<plugins>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-maven-plugin</artifactId>
<version>${tycho-version}</version>
<extensions>true</extensions>
</plugin>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>target-platform-configuration</artifactId>
<version>${tycho-version}</version>
<configuration>
<environments>
<environment>
<os>linux</os>
<ws>gtk</ws>
<arch>x86</arch>
</environment>
<environment>
<os>linux</os>
<ws>gtk</ws>
<arch>x86_64</arch>
</environment>
<environment>
<os>win32</os>
<ws>win32</ws>
<arch>x86</arch>
</environment>
<environment>
<os>win32</os>
<ws>win32</ws>
<arch>x86_64</arch>
</environment>
<environment>
<os>macosx</os>
<ws>cocoa</ws>
<arch>x86_64</arch>
</environment>
</environments>
</configuration>
</plugin>
<plugin>
<groupId>org.eclipse.tycho.extras</groupId>
<artifactId>tycho-source-feature-plugin</artifactId>
<version>${tycho-extras-version}</version>
<executions>
<execution>
<id>source-feature</id>
<phase>package</phase>
<goals>
<goal>source-feature</goal>
</goals>
</execution>
</executions>
<configuration>
<excludes>
<!-- provide plug-ins not containing any source code -->
<plugin id="org.codehaus.groovy" />
</excludes>
</configuration>
</plugin>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-source-plugin</artifactId>
<version>${tycho-version}</version>
<executions>
<execution>
<id>plugin-source</id>
<goals>
<goal>plugin-source</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-p2-plugin</artifactId>
<version>${tycho-version}</version>
<executions>
<execution>
<id>attached-p2-metadata</id>
<phase>package</phase>
<goals>
<goal>p2-metadata</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View File

@ -1,24 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?pde version="3.8"?><target name="Mars Platform" sequenceNumber="130">
<locations>
<location includeAllPlatforms="false" includeConfigurePhase="true" includeMode="planner" includeSource="true" type="InstallableUnit">
<unit id="org.eclipse.rcp.sdk.id" version="4.5.1.M20150904-0015"/>
<unit id="org.eclipse.equinox.executable.feature.group" version="3.6.200.v20150602-1417"/>
<unit id="org.eclipse.rcptt.core.feature.group" version="2.0.1.201508201020"/>
<unit id="org.eclipse.platform.sdk" version="4.5.1.M20150904-0015"/>
<repository location="http://download.eclipse.org/releases/mars"/>
</location>
<location includeAllPlatforms="false" includeConfigurePhase="true" includeMode="planner" includeSource="true" type="InstallableUnit">
<unit id="org.codehaus.groovy24.feature.feature.group" version="2.9.2.xx-201508121448-e45"/>
<repository location="http://dist.springsource.org/snapshot/GRECLIPSE/e4.5"/>
</location>
</locations>
<environment>
<arch>x86_64</arch>
<nl>de_DE</nl>
</environment>
<targetJRE path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.launching.macosx.MacOSXType/Java SE 7 [1.7.0_45]"/>
<launcherArgs>
<vmArgs>-Dosgi.requiredJavaVersion=1.6 -XstartOnFirstThread -Dorg.eclipse.swt.internal.carbon.smallFonts -XX:MaxPermSize=256m -Xdock:icon=../Resources/Eclipse.icns -XstartOnFirstThread -Dorg.eclipse.swt.internal.carbon.smallFonts -Xms40m -Xmx512m -Xdock:icon=../Resources/Eclipse.icns -XstartOnFirstThread -Dorg.eclipse.swt.internal.carbon.smallFonts</vmArgs>
</launcherArgs>
</target>

View File

@ -1,7 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="output" path="target/classes"/>
</classpath>

View File

@ -1,2 +0,0 @@
eclipse.preferences.version=1
groovy.compiler.level=23

Binary file not shown.

Before

Width:  |  Height:  |  Size: 444 B

View File

@ -1,41 +0,0 @@
/*******************************************************************************
* Copyright (c) 2015 MINRES Technologies GmbH and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* MINRES Technologies GmbH - initial API and implementation
*******************************************************************************/
package com.minres.scviewer.ui.handler;
import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.handlers.HandlerUtil;
import com.minres.scviewer.ui.TxEditorPart;
public class Zoom extends AbstractHandler {
private static final String PARM_MSG = "com.minres.scviewer.ui.zoom.level";
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
IEditorPart editor = HandlerUtil.getActiveEditor(event);
String msg = event.getParameter(PARM_MSG);
if (msg == null) {
if(editor instanceof TxEditorPart){
((TxEditorPart)editor).setZoomFit();
}
} else {
Integer level = Integer.parseInt(msg);
if(editor instanceof TxEditorPart){
((TxEditorPart)editor).setZoomLevel(level);
}
}
return null;
}
}

View File

@ -1,11 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<site>
<feature url="features/com.minres.scviewer.feature_1.0.0.qualifier.jar" id="com.minres.scviewer.feature" version="1.0.0.qualifier">
<category name="com.minres.scviewer"/>
</feature>
<category-def name="com.minres.scviewer" label="SCViewer">
<description>
Viewer for SystemC Verification (SCV) library&apos;s transaction recording
</description>
</category-def>
</site>

View File

@ -1,20 +0,0 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>com.minres.scviewer.updateSite</artifactId>
<packaging>eclipse-repository</packaging>
<parent>
<groupId>com.minres.scviewer</groupId>
<artifactId>com.minres.scviewer.parent</artifactId>
<version>1.0.0-SNAPSHOT</version>
<relativePath>../com.minres.scviewer.parent</relativePath>
</parent>
<!-- <build>
<finalName>resources</finalName>
<resources>
<resource>
<directory>resources</directory>
</resource>
</resources>
</build> -->
</project>

View File

@ -1,7 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
<classpathentry kind="output" path="bin"/>
</classpath>

View File

@ -1,18 +0,0 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Preferences
Bundle-SymbolicName: com.opcoach.e4.preferences;singleton:=true
Bundle-Version: 1.0.0.qualifier
Bundle-Vendor: OPCOACH
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
Require-Bundle: javax.inject,
org.eclipse.core.runtime;bundle-version="3.9.0",
org.eclipse.jface;bundle-version="3.9.0",
org.eclipse.e4.core.di;bundle-version="1.3.0",
org.eclipse.e4.ui.model.workbench;bundle-version="1.0.0",
org.eclipse.e4.core.services;bundle-version="1.1.0",
org.eclipse.e4.core.contexts;bundle-version="1.3.0",
org.eclipse.e4.ui.services;bundle-version="1.0.0"
Export-Package: com.opcoach.e4.preferences,
com.opcoach.e4.preferences.handlers
Bundle-ActivationPolicy: lazy

View File

@ -1,5 +0,0 @@
source.. = src/
output.. = bin/
bin.includes = META-INF/,\
.,\
plugin.xml

View File

@ -1,7 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.4"?>
<plugin>
<extension-point id="e4PreferencePages" name="e4PreferencePages" schema="schema/e4PreferencePages.exsd"/>
<extension-point id="e4PreferenceStoreProvider" name="e4PreferenceStoreProvider" schema="schema/e4PreferenceStoreProvider.exsd"/>
</plugin>

View File

@ -1,13 +0,0 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>com.opcoach.e4.preferences</artifactId>
<parent>
<groupId>com.minres.scviewer</groupId>
<artifactId>com.minres.scviewer.parent</artifactId>
<version>1.0.0-SNAPSHOT</version>
<relativePath>../com.minres.scviewer.parent</relativePath>
</parent>
<packaging>eclipse-plugin</packaging>
<version>1.0.0-SNAPSHOT</version>
<groupId>com.minres.scviewer</groupId>
</project>

View File

@ -1,163 +0,0 @@
<?xml version='1.0' encoding='UTF-8'?>
<!-- Schema file written by PDE -->
<schema targetNamespace="com.opcoach.e4.preferences" xmlns="http://www.w3.org/2001/XMLSchema">
<annotation>
<appinfo>
<meta.schema plugin="com.opcoach.e4.preferences" id="e4PreferencePages" name="e4PreferencePages"/>
</appinfo>
<documentation>
[Enter description of this extension point.]
</documentation>
</annotation>
<element name="extension">
<annotation>
<appinfo>
<meta.element />
</appinfo>
</annotation>
<complexType>
<sequence>
<element ref="page" minOccurs="0" maxOccurs="unbounded"/>
</sequence>
<attribute name="point" type="string" use="required">
<annotation>
<documentation>
a fully qualified identifier of the target extension point
</documentation>
</annotation>
</attribute>
<attribute name="id" type="string">
<annotation>
<documentation>
an optional identifier of the extension instance
</documentation>
</annotation>
</attribute>
<attribute name="name" type="string">
<annotation>
<documentation>
an optional name of the extension instance
</documentation>
<appinfo>
<meta.attribute translatable="true"/>
</appinfo>
</annotation>
</attribute>
</complexType>
</element>
<element name="page">
<annotation>
<appinfo>
<meta.element labelAttribute="name"/>
</appinfo>
</annotation>
<complexType>
<sequence>
<element ref="keywordReference" minOccurs="0" maxOccurs="unbounded"/>
</sequence>
<attribute name="id" type="string" use="required">
<annotation>
<documentation>
a unique name that will be used to identify this page.
</documentation>
</annotation>
</attribute>
<attribute name="name" type="string" use="required">
<annotation>
<documentation>
a translatable name that will be used in the UI for this page.
</documentation>
<appinfo>
<meta.attribute translatable="true"/>
</appinfo>
</annotation>
</attribute>
<attribute name="class" type="string" use="required">
<annotation>
<documentation>
a name of the fully qualified class that implements
&lt;samp&gt;org.eclipse.jface.preference.IPreferencePage&lt;/samp&gt;.
IT IS EASYER to extend FieldEditorPreferencePage
If this class extends directly org.eclipse.jface.preference.FieldEditorPreferencePage preferenceStore is automatically set on it.
</documentation>
<appinfo>
<meta.attribute kind="java" basedOn="org.eclipse.jface.preference.FieldEditorPreferencePage:"/>
</appinfo>
</annotation>
</attribute>
<attribute name="category" type="string">
<annotation>
<documentation>
a path indicating the location of the page in the preference tree. The path may either be a parent node ID or a sequence
of IDs separated by &apos;/&apos;, representing the full path from the root node.
</documentation>
<appinfo>
<meta.attribute kind="identifier" basedOn="com.opcoach.e4.preferences.e4PreferencePages/page/@id"/>
</appinfo>
</annotation>
</attribute>
</complexType>
</element>
<element name="keywordReference">
<annotation>
<documentation>
A reference by a preference page to a keyword. See the keywords extension point.
</documentation>
</annotation>
<complexType>
<attribute name="id" type="string" use="required">
<annotation>
<documentation>
The id of the keyword being referred to.
</documentation>
<appinfo>
<meta.attribute kind="identifier" basedOn="org.eclipse.ui.keywords/keyword/@id"/>
</appinfo>
</annotation>
</attribute>
</complexType>
</element>
<annotation>
<appinfo>
<meta.section type="since"/>
</appinfo>
<documentation>
[Enter the first release in which this extension point appears.]
</documentation>
</annotation>
<annotation>
<appinfo>
<meta.section type="examples"/>
</appinfo>
<documentation>
[Enter extension point usage example here.]
</documentation>
</annotation>
<annotation>
<appinfo>
<meta.section type="apiinfo"/>
</appinfo>
<documentation>
[Enter API information here.]
</documentation>
</annotation>
<annotation>
<appinfo>
<meta.section type="implementation"/>
</appinfo>
<documentation>
[Enter information about supplied implementation of this extension point.]
</documentation>
</annotation>
</schema>

View File

@ -1,149 +0,0 @@
<?xml version='1.0' encoding='UTF-8'?>
<!-- Schema file written by PDE -->
<schema targetNamespace="com.opcoach.e4.preferences" xmlns="http://www.w3.org/2001/XMLSchema">
<annotation>
<appinfo>
<meta.schema plugin="com.opcoach.e4.preferences" id="e4PreferenceStoreProvider" name="e4PreferenceStoreProvider"/>
</appinfo>
<documentation>
This extension point is used to associate a preference store to a plugin.
You can choose either to implement the IPreferenceStoreProvider interface or to give the ID of the IPreferenceStore to use (stored in the workbench context of your E4 application).
If this extension point is not used, a default ScopedPreferenceStore will be used for the preference page.
</documentation>
</annotation>
<element name="extension">
<annotation>
<appinfo>
<meta.element />
</appinfo>
</annotation>
<complexType>
<sequence>
<element ref="preferenceStoreProvider" minOccurs="1" maxOccurs="unbounded"/>
</sequence>
<attribute name="point" type="string" use="required">
<annotation>
<documentation>
</documentation>
</annotation>
</attribute>
<attribute name="id" type="string">
<annotation>
<documentation>
</documentation>
</annotation>
</attribute>
<attribute name="name" type="string">
<annotation>
<documentation>
</documentation>
<appinfo>
<meta.attribute translatable="true"/>
</appinfo>
</annotation>
</attribute>
</complexType>
</element>
<element name="preferenceStoreProvider">
<complexType>
<attribute name="pluginId" type="string" use="required">
<annotation>
<documentation>
Set here the plugin Id concerned by this extension.
Must be a valid plugin ID (control will be done at runtime)
</documentation>
</annotation>
</attribute>
<attribute name="class" type="string">
<annotation>
<documentation>
Set a class to get the IPreferenceStore for the defined pluginID.
This parameter is optional if you use the contextId attribute.
</documentation>
<appinfo>
<meta.attribute kind="java" basedOn=":com.opcoach.e4.preferences.IPreferenceStoreProvider"/>
</appinfo>
</annotation>
</attribute>
<attribute name="idInWorkbenchContext" type="string">
<annotation>
<documentation>
If no class is defined, you can set here the ID of the IPreferenceStore available in the context.
This object must be set in the workbenchContext using an Addon for instance, with the following code (in addon):
@PostContextCreate
public void initMyAddon(IEclipseContext ctx)
{
IPreferenceStore ps = new ... . // The code to create your pref store
ctx.set(ID set in this extension, ps);
}
</documentation>
</annotation>
</attribute>
</complexType>
</element>
<annotation>
<appinfo>
<meta.section type="since"/>
</appinfo>
<documentation>
[Enter the first release in which this extension point appears.]
</documentation>
</annotation>
<annotation>
<appinfo>
<meta.section type="examples"/>
</appinfo>
<documentation>
The definition could be like the following :
pluginId=&quot;yourPluginID&quot;
provider=&quot;a class implementing IPreferenceStoreProvider&quot;
Or using the key in context (usefull to share the same preference store between plugins) :
pluginId=&quot;yourPluginID&quot;
keyInContext=&quot;the key of the IPreferenceStore stored in context&quot;
</documentation>
</annotation>
<annotation>
<appinfo>
<meta.section type="apiinfo"/>
</appinfo>
<documentation>
[Enter API information here.]
</documentation>
</annotation>
<annotation>
<appinfo>
<meta.section type="implementation"/>
</appinfo>
<documentation>
[Enter information about supplied implementation of this extension point.]
</documentation>
</annotation>
<annotation>
<appinfo>
<meta.section type="copyright"/>
</appinfo>
<documentation>
@OPCoach 2014
</documentation>
</annotation>
</schema>

View File

@ -1,25 +0,0 @@
/*******************************************************************************
* Copyright (c) 2014 OPCoach.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* OPCoach - initial API and implementation
*******************************************************************************/
package com.opcoach.e4.preferences;
import org.eclipse.jface.preference.IPreferenceStore;
/** This interface can be implemented to provide a PreferenceStore for a given plugin.
* This associatino must be done in the e4PreferenceStoreProvider extension point.
* @author olivier
*
*/
public interface IPreferenceStoreProvider
{
/** Must be implemented to return a preference store */
public IPreferenceStore getPreferenceStore();
}

View File

@ -1,861 +0,0 @@
/*******************************************************************************
* Copyright (c) 2014 OPCoach.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Eclipse - copy of the implementation coming from jface
*******************************************************************************/
package com.opcoach.e4.preferences;
import java.io.IOException;
import org.eclipse.core.commands.common.EventManager;
import org.eclipse.core.runtime.Assert;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.Plugin;
import org.eclipse.core.runtime.SafeRunner;
import org.eclipse.core.runtime.preferences.DefaultScope;
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
import org.eclipse.core.runtime.preferences.IScopeContext;
import org.eclipse.core.runtime.preferences.IEclipsePreferences.INodeChangeListener;
import org.eclipse.core.runtime.preferences.IEclipsePreferences.NodeChangeEvent;
import org.eclipse.core.runtime.preferences.IEclipsePreferences.PreferenceChangeEvent;
import org.eclipse.jface.preference.IPersistentPreferenceStore;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.resource.JFaceResources;
import org.eclipse.jface.util.IPropertyChangeListener;
import org.eclipse.jface.util.PropertyChangeEvent;
import org.eclipse.jface.util.SafeRunnable;
import org.osgi.service.prefs.BackingStoreException;
/**
* The ScopedPreferenceStore is an IPreferenceStore that uses the scopes
* provided in org.eclipse.core.runtime.preferences.
* <p>
* A ScopedPreferenceStore does the lookup of a preference based on it's search
* scopes and sets the value of the preference based on its store scope.
* </p>
* <p>
* The default scope is always included in the search scopes when searching for
* preference values.
* </p>
*
* @see org.eclipse.core.runtime.preferences
* @since 3.1
*/
public class ScopedPreferenceStore extends EventManager implements
IPreferenceStore, IPersistentPreferenceStore {
/**
* The storeContext is the context where values will stored with the
* setValue methods. If there are no searchContexts this will be the search
* context. (along with the "default" context)
*/
private IScopeContext storeContext;
/**
* The searchContext is the array of contexts that will be used by the get
* methods for searching for values.
*/
private IScopeContext[] searchContexts;
/**
* A boolean to indicate the property changes should not be propagated.
*/
protected boolean silentRunning = false;
/**
* The listener on the IEclipsePreferences. This is used to forward updates
* to the property change listeners on the preference store.
*/
IEclipsePreferences.IPreferenceChangeListener preferencesListener;
/**
* The default context is the context where getDefault and setDefault
* methods will search. This context is also used in the search.
*/
private IScopeContext defaultContext = DefaultScope.INSTANCE;
/**
* The nodeQualifer is the string used to look up the node in the contexts.
*/
String nodeQualifier;
/**
* The defaultQualifier is the string used to look up the default node.
*/
String defaultQualifier;
/**
* Boolean value indicating whether or not this store has changes to be
* saved.
*/
private boolean dirty;
/**
* Create a new instance of the receiver. Store the values in context in the
* node looked up by qualifier. <strong>NOTE:</strong> Any instance of
* ScopedPreferenceStore should call
*
* @param context
* the scope to store to
* @param qualifier
* the qualifier used to look up the preference node
* @param defaultQualifierPath
* the qualifier used when looking up the defaults
*/
public ScopedPreferenceStore(IScopeContext context, String qualifier,
String defaultQualifierPath) {
this(context, qualifier);
this.defaultQualifier = defaultQualifierPath;
}
/**
* Create a new instance of the receiver. Store the values in context in the
* node looked up by qualifier.
*
* @param context
* the scope to store to
* @param qualifier
* the qualifer used to look up the preference node
*/
public ScopedPreferenceStore(IScopeContext context, String qualifier) {
storeContext = context;
this.nodeQualifier = qualifier;
this.defaultQualifier = qualifier;
((IEclipsePreferences) getStorePreferences().parent())
.addNodeChangeListener(getNodeChangeListener());
}
/**
* Return a node change listener that adds a removes the receiver when nodes
* change.
*
* @return INodeChangeListener
*/
private INodeChangeListener getNodeChangeListener() {
return new IEclipsePreferences.INodeChangeListener() {
/*
* (non-Javadoc)
*
* @see org.eclipse.core.runtime.preferences.IEclipsePreferences.INodeChangeListener#added(org.eclipse.core.runtime.preferences.IEclipsePreferences.NodeChangeEvent)
*/
public void added(NodeChangeEvent event) {
if (nodeQualifier.equals(event.getChild().name())
&& isListenerAttached()) {
getStorePreferences().addPreferenceChangeListener(
preferencesListener);
}
}
/*
* (non-Javadoc)
*
* @see org.eclipse.core.runtime.preferences.IEclipsePreferences.INodeChangeListener#removed(org.eclipse.core.runtime.preferences.IEclipsePreferences.NodeChangeEvent)
*/
public void removed(NodeChangeEvent event) {
// Do nothing as there are no events from removed node
}
};
}
/**
* Initialize the preferences listener.
*/
private void initializePreferencesListener() {
if (preferencesListener == null) {
preferencesListener = new IEclipsePreferences.IPreferenceChangeListener() {
/*
* (non-Javadoc)
*
* @see org.eclipse.core.runtime.preferences.IEclipsePreferences.IPreferenceChangeListener#preferenceChange(org.eclipse.core.runtime.preferences.IEclipsePreferences.PreferenceChangeEvent)
*/
public void preferenceChange(PreferenceChangeEvent event) {
if (silentRunning) {
return;
}
Object oldValue = event.getOldValue();
Object newValue = event.getNewValue();
String key = event.getKey();
if (newValue == null) {
newValue = getDefault(key, oldValue);
} else if (oldValue == null) {
oldValue = getDefault(key, newValue);
}
firePropertyChangeEvent(event.getKey(), oldValue, newValue);
}
};
getStorePreferences().addPreferenceChangeListener(
preferencesListener);
}
}
/**
* Does its best at determining the default value for the given key. Checks
* the given object's type and then looks in the list of defaults to see if
* a value exists. If not or if there is a problem converting the value, the
* default default value for that type is returned.
*
* @param key
* the key to search
* @param obj
* the object who default we are looking for
* @return Object or <code>null</code>
*/
Object getDefault(String key, Object obj) {
IEclipsePreferences defaults = getDefaultPreferences();
if (obj instanceof String) {
return defaults.get(key, STRING_DEFAULT_DEFAULT);
} else if (obj instanceof Integer) {
return new Integer(defaults.getInt(key, INT_DEFAULT_DEFAULT));
} else if (obj instanceof Double) {
return new Double(defaults.getDouble(key, DOUBLE_DEFAULT_DEFAULT));
} else if (obj instanceof Float) {
return new Float(defaults.getFloat(key, FLOAT_DEFAULT_DEFAULT));
} else if (obj instanceof Long) {
return new Long(defaults.getLong(key, LONG_DEFAULT_DEFAULT));
} else if (obj instanceof Boolean) {
return defaults.getBoolean(key, BOOLEAN_DEFAULT_DEFAULT) ? Boolean.TRUE
: Boolean.FALSE;
} else {
return null;
}
}
/**
* Return the IEclipsePreferences node associated with this store.
*
* @return the preference node for this store
*/
IEclipsePreferences getStorePreferences() {
return storeContext.getNode(nodeQualifier);
}
/**
* Return the default IEclipsePreferences for this store.
*
* @return this store's default preference node
*/
private IEclipsePreferences getDefaultPreferences() {
return defaultContext.getNode(defaultQualifier);
}
/*
* (non-Javadoc)
*
* @see org.eclipse.jface.preference.IPreferenceStore#addPropertyChangeListener(org.eclipse.jface.util.IPropertyChangeListener)
*/
public void addPropertyChangeListener(IPropertyChangeListener listener) {
initializePreferencesListener();// Create the preferences listener if it
// does not exist
addListenerObject(listener);
}
/**
* Return the preference path to search preferences on. This is the list of
* preference nodes based on the scope contexts for this store. If there are
* no search contexts set, then return this store's context.
* <p>
* Whether or not the default context should be included in the resulting
* list is specified by the <code>includeDefault</code> parameter.
* </p>
*
* @param includeDefault
* <code>true</code> if the default context should be included
* and <code>false</code> otherwise
* @return IEclipsePreferences[]
* @since 3.4 public, was added in 3.1 as private method
*/
public IEclipsePreferences[] getPreferenceNodes(boolean includeDefault) {
// if the user didn't specify a search order, then return the scope that
// this store was created on. (and optionally the default)
if (searchContexts == null) {
if (includeDefault) {
return new IEclipsePreferences[] { getStorePreferences(),
getDefaultPreferences() };
}
return new IEclipsePreferences[] { getStorePreferences() };
}
// otherwise the user specified a search order so return the appropriate
// nodes based on it
int length = searchContexts.length;
if (includeDefault) {
length++;
}
IEclipsePreferences[] preferences = new IEclipsePreferences[length];
for (int i = 0; i < searchContexts.length; i++) {
preferences[i] = searchContexts[i].getNode(nodeQualifier);
}
if (includeDefault) {
preferences[length - 1] = getDefaultPreferences();
}
return preferences;
}
/**
* Set the search contexts to scopes. When searching for a value the seach
* will be done in the order of scope contexts and will not search the
* storeContext unless it is in this list.
* <p>
* If the given list is <code>null</code>, then clear this store's search
* contexts. This means that only this store's scope context and default
* scope will be used during preference value searching.
* </p>
* <p>
* The defaultContext will be added to the end of this list automatically
* and <em>MUST NOT</em> be included by the user.
* </p>
*
* @param scopes
* a list of scope contexts to use when searching, or
* <code>null</code>
*/
public void setSearchContexts(IScopeContext[] scopes) {
this.searchContexts = scopes;
if (scopes == null) {
return;
}
// Assert that the default was not included (we automatically add it to
// the end)
for (int i = 0; i < scopes.length; i++) {
if (scopes[i].equals(defaultContext)) {
Assert
.isTrue(
false,
"Do not add the default to the search contexts");
}
}
}
/*
* (non-Javadoc)
*
* @see org.eclipse.jface.preference.IPreferenceStore#contains(java.lang.String)
*/
public boolean contains(String name) {
if (name == null) {
return false;
}
return (Platform.getPreferencesService().get(name, null,
getPreferenceNodes(true))) != null;
}
/*
* (non-Javadoc)
*
* @see org.eclipse.jface.preference.IPreferenceStore#firePropertyChangeEvent(java.lang.String,
* java.lang.Object, java.lang.Object)
*/
public void firePropertyChangeEvent(String name, Object oldValue,
Object newValue) {
// important: create intermediate array to protect against listeners
// being added/removed during the notification
final Object[] list = getListeners();
if (list.length == 0) {
return;
}
final PropertyChangeEvent event = new PropertyChangeEvent(this, name,
oldValue, newValue);
for (int i = 0; i < list.length; i++) {
final IPropertyChangeListener listener = (IPropertyChangeListener) list[i];
SafeRunner.run(new SafeRunnable(JFaceResources
.getString("PreferenceStore.changeError")) { //$NON-NLS-1$
public void run() {
listener.propertyChange(event);
}
});
}
}
/*
* (non-Javadoc)
*
* @see org.eclipse.jface.preference.IPreferenceStore#getBoolean(java.lang.String)
*/
public boolean getBoolean(String name) {
String value = internalGet(name);
return value == null ? BOOLEAN_DEFAULT_DEFAULT : Boolean.valueOf(value)
.booleanValue();
}
/*
* (non-Javadoc)
*
* @see org.eclipse.jface.preference.IPreferenceStore#getDefaultBoolean(java.lang.String)
*/
public boolean getDefaultBoolean(String name) {
return getDefaultPreferences()
.getBoolean(name, BOOLEAN_DEFAULT_DEFAULT);
}
/*
* (non-Javadoc)
*
* @see org.eclipse.jface.preference.IPreferenceStore#getDefaultDouble(java.lang.String)
*/
public double getDefaultDouble(String name) {
return getDefaultPreferences().getDouble(name, DOUBLE_DEFAULT_DEFAULT);
}
/*
* (non-Javadoc)
*
* @see org.eclipse.jface.preference.IPreferenceStore#getDefaultFloat(java.lang.String)
*/
public float getDefaultFloat(String name) {
return getDefaultPreferences().getFloat(name, FLOAT_DEFAULT_DEFAULT);
}
/*
* (non-Javadoc)
*
* @see org.eclipse.jface.preference.IPreferenceStore#getDefaultInt(java.lang.String)
*/
public int getDefaultInt(String name) {
return getDefaultPreferences().getInt(name, INT_DEFAULT_DEFAULT);
}
/*
* (non-Javadoc)
*
* @see org.eclipse.jface.preference.IPreferenceStore#getDefaultLong(java.lang.String)
*/
public long getDefaultLong(String name) {
return getDefaultPreferences().getLong(name, LONG_DEFAULT_DEFAULT);
}
/*
* (non-Javadoc)
*
* @see org.eclipse.jface.preference.IPreferenceStore#getDefaultString(java.lang.String)
*/
public String getDefaultString(String name) {
return getDefaultPreferences().get(name, STRING_DEFAULT_DEFAULT);
}
/*
* (non-Javadoc)
*
* @see org.eclipse.jface.preference.IPreferenceStore#getDouble(java.lang.String)
*/
public double getDouble(String name) {
String value = internalGet(name);
if (value == null) {
return DOUBLE_DEFAULT_DEFAULT;
}
try {
return Double.parseDouble(value);
} catch (NumberFormatException e) {
return DOUBLE_DEFAULT_DEFAULT;
}
}
/**
* Return the string value for the specified key. Look in the nodes which
* are specified by this object's list of search scopes. If the value does
* not exist then return <code>null</code>.
*
* @param key
* the key to search with
* @return String or <code>null</code> if the value does not exist.
*/
private String internalGet(String key) {
return Platform.getPreferencesService().get(key, null,
getPreferenceNodes(true));
}
/*
* (non-Javadoc)
*
* @see org.eclipse.jface.preference.IPreferenceStore#getFloat(java.lang.String)
*/
public float getFloat(String name) {
String value = internalGet(name);
if (value == null) {
return FLOAT_DEFAULT_DEFAULT;
}
try {
return Float.parseFloat(value);
} catch (NumberFormatException e) {
return FLOAT_DEFAULT_DEFAULT;
}
}
/*
* (non-Javadoc)
*
* @see org.eclipse.jface.preference.IPreferenceStore#getInt(java.lang.String)
*/
public int getInt(String name) {
String value = internalGet(name);
if (value == null) {
return INT_DEFAULT_DEFAULT;
}
try {
return Integer.parseInt(value);
} catch (NumberFormatException e) {
return INT_DEFAULT_DEFAULT;
}
}
/*
* (non-Javadoc)
*
* @see org.eclipse.jface.preference.IPreferenceStore#getLong(java.lang.String)
*/
public long getLong(String name) {
String value = internalGet(name);
if (value == null) {
return LONG_DEFAULT_DEFAULT;
}
try {
return Long.parseLong(value);
} catch (NumberFormatException e) {
return LONG_DEFAULT_DEFAULT;
}
}
/*
* (non-Javadoc)
*
* @see org.eclipse.jface.preference.IPreferenceStore#getString(java.lang.String)
*/
public String getString(String name) {
String value = internalGet(name);
return value == null ? STRING_DEFAULT_DEFAULT : value;
}
/*
* (non-Javadoc)
*
* @see org.eclipse.jface.preference.IPreferenceStore#isDefault(java.lang.String)
*/
public boolean isDefault(String name) {
if (name == null) {
return false;
}
return (Platform.getPreferencesService().get(name, null,
getPreferenceNodes(false))) == null;
}
/*
* (non-Javadoc)
*
* @see org.eclipse.jface.preference.IPreferenceStore#needsSaving()
*/
public boolean needsSaving() {
return dirty;
}
/*
* (non-Javadoc)
*
* @see org.eclipse.jface.preference.IPreferenceStore#putValue(java.lang.String,
* java.lang.String)
*/
public void putValue(String name, String value) {
try {
// Do not notify listeners
silentRunning = true;
getStorePreferences().put(name, value);
} finally {
// Be sure that an exception does not stop property updates
silentRunning = false;
dirty = true;
}
}
/*
* (non-Javadoc)
*
* @see org.eclipse.jface.preference.IPreferenceStore#removePropertyChangeListener(org.eclipse.jface.util.IPropertyChangeListener)
*/
public void removePropertyChangeListener(IPropertyChangeListener listener) {
removeListenerObject(listener);
if (!isListenerAttached()) {
disposePreferenceStoreListener();
}
}
/*
* (non-Javadoc)
*
* @see org.eclipse.jface.preference.IPreferenceStore#setDefault(java.lang.String,
* double)
*/
public void setDefault(String name, double value) {
getDefaultPreferences().putDouble(name, value);
}
/*
* (non-Javadoc)
*
* @see org.eclipse.jface.preference.IPreferenceStore#setDefault(java.lang.String,
* float)
*/
public void setDefault(String name, float value) {
getDefaultPreferences().putFloat(name, value);
}
/*
* (non-Javadoc)
*
* @see org.eclipse.jface.preference.IPreferenceStore#setDefault(java.lang.String,
* int)
*/
public void setDefault(String name, int value) {
getDefaultPreferences().putInt(name, value);
}
/*
* (non-Javadoc)
*
* @see org.eclipse.jface.preference.IPreferenceStore#setDefault(java.lang.String,
* long)
*/
public void setDefault(String name, long value) {
getDefaultPreferences().putLong(name, value);
}
/*
* (non-Javadoc)
*
* @see org.eclipse.jface.preference.IPreferenceStore#setDefault(java.lang.String,
* java.lang.String)
*/
public void setDefault(String name, String defaultObject) {
getDefaultPreferences().put(name, defaultObject);
}
/*
* (non-Javadoc)
*
* @see org.eclipse.jface.preference.IPreferenceStore#setDefault(java.lang.String,
* boolean)
*/
public void setDefault(String name, boolean value) {
getDefaultPreferences().putBoolean(name, value);
}
/*
* (non-Javadoc)
*
* @see org.eclipse.jface.preference.IPreferenceStore#setToDefault(java.lang.String)
*/
public void setToDefault(String name) {
String oldValue = getString(name);
String defaultValue = getDefaultString(name);
try {
silentRunning = true;// Turn off updates from the store
// removing a non-existing preference is a no-op so call the Core
// API directly
getStorePreferences().remove(name);
if (oldValue != defaultValue){
dirty = true;
firePropertyChangeEvent(name, oldValue, defaultValue);
}
} finally {
silentRunning = false;// Restart listening to preferences
}
}
/*
* (non-Javadoc)
*
* @see org.eclipse.jface.preference.IPreferenceStore#setValue(java.lang.String,
* double)
*/
public void setValue(String name, double value) {
double oldValue = getDouble(name);
if (oldValue == value) {
return;
}
try {
silentRunning = true;// Turn off updates from the store
if (getDefaultDouble(name) == value) {
getStorePreferences().remove(name);
} else {
getStorePreferences().putDouble(name, value);
}
dirty = true;
firePropertyChangeEvent(name, new Double(oldValue), new Double(
value));
} finally {
silentRunning = false;// Restart listening to preferences
}
}
/*
* (non-Javadoc)
*
* @see org.eclipse.jface.preference.IPreferenceStore#setValue(java.lang.String,
* float)
*/
public void setValue(String name, float value) {
float oldValue = getFloat(name);
if (oldValue == value) {
return;
}
try {
silentRunning = true;// Turn off updates from the store
if (getDefaultFloat(name) == value) {
getStorePreferences().remove(name);
} else {
getStorePreferences().putFloat(name, value);
}
dirty = true;
firePropertyChangeEvent(name, new Float(oldValue), new Float(value));
} finally {
silentRunning = false;// Restart listening to preferences
}
}
/*
* (non-Javadoc)
*
* @see org.eclipse.jface.preference.IPreferenceStore#setValue(java.lang.String,
* int)
*/
public void setValue(String name, int value) {
int oldValue = getInt(name);
if (oldValue == value) {
return;
}
try {
silentRunning = true;// Turn off updates from the store
if (getDefaultInt(name) == value) {
getStorePreferences().remove(name);
} else {
getStorePreferences().putInt(name, value);
}
dirty = true;
firePropertyChangeEvent(name, new Integer(oldValue), new Integer(
value));
} finally {
silentRunning = false;// Restart listening to preferences
}
}
/*
* (non-Javadoc)
*
* @see org.eclipse.jface.preference.IPreferenceStore#setValue(java.lang.String,
* long)
*/
public void setValue(String name, long value) {
long oldValue = getLong(name);
if (oldValue == value) {
return;
}
try {
silentRunning = true;// Turn off updates from the store
if (getDefaultLong(name) == value) {
getStorePreferences().remove(name);
} else {
getStorePreferences().putLong(name, value);
}
dirty = true;
firePropertyChangeEvent(name, new Long(oldValue), new Long(value));
} finally {
silentRunning = false;// Restart listening to preferences
}
}
/*
* (non-Javadoc)
*
* @see org.eclipse.jface.preference.IPreferenceStore#setValue(java.lang.String,
* java.lang.String)
*/
public void setValue(String name, String value) {
// Do not turn on silent running here as Strings are propagated
if (getDefaultString(name).equals(value)) {
getStorePreferences().remove(name);
} else {
getStorePreferences().put(name, value);
}
dirty = true;
}
/*
* (non-Javadoc)
*
* @see org.eclipse.jface.preference.IPreferenceStore#setValue(java.lang.String,
* boolean)
*/
public void setValue(String name, boolean value) {
boolean oldValue = getBoolean(name);
if (oldValue == value) {
return;
}
try {
silentRunning = true;// Turn off updates from the store
if (getDefaultBoolean(name) == value) {
getStorePreferences().remove(name);
} else {
getStorePreferences().putBoolean(name, value);
}
dirty = true;
firePropertyChangeEvent(name, oldValue ? Boolean.TRUE
: Boolean.FALSE, value ? Boolean.TRUE : Boolean.FALSE);
} finally {
silentRunning = false;// Restart listening to preferences
}
}
/*
* (non-Javadoc)
*
* @see org.eclipse.jface.preference.IPersistentPreferenceStore#save()
*/
public void save() throws IOException {
try {
getStorePreferences().flush();
dirty = false;
} catch (BackingStoreException e) {
throw new IOException(e.getMessage());
}
}
/**
* Dispose the receiver.
*/
private void disposePreferenceStoreListener() {
IEclipsePreferences root = (IEclipsePreferences) Platform
.getPreferencesService().getRootNode().node(
Plugin.PLUGIN_PREFERENCE_SCOPE);
try {
if (!(root.nodeExists(nodeQualifier))) {
return;
}
} catch (BackingStoreException e) {
return;// No need to report here as the node won't have the
// listener
}
IEclipsePreferences preferences = getStorePreferences();
if (preferences == null) {
return;
}
if (preferencesListener != null) {
preferences.removePreferenceChangeListener(preferencesListener);
preferencesListener = null;
}
}
}

View File

@ -1,57 +0,0 @@
/*******************************************************************************
* Copyright (c) 2014 OPCoach.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Manumitting Technologies : Brian de Alwis for initial API and implementation
* OPCoach : O.Prouvost fix bugs on hierarchy
*******************************************************************************//*
* Handler to open up a configured preferences dialog.
* Written by Brian de Alwis, Manumitting Technologies.
* Placed in the public domain.
* This code comes from : http://www.eclipse.org/forums/index.php/fa/4347/
* and was referenced in the thread : http://www.eclipse.org/forums/index.php/m/750139/
*/
package com.opcoach.e4.preferences.handlers;
import javax.inject.Named;
import org.eclipse.e4.core.di.annotations.CanExecute;
import org.eclipse.e4.core.di.annotations.Execute;
import org.eclipse.e4.ui.services.IServiceConstants;
import org.eclipse.jface.preference.PreferenceDialog;
import org.eclipse.jface.preference.PreferenceManager;
import org.eclipse.jface.viewers.ViewerComparator;
import org.eclipse.swt.widgets.Shell;
import com.opcoach.e4.preferences.internal.E4PreferenceRegistry;
public class E4PreferencesHandler
{
@CanExecute
public boolean canExecute()
{
return true;
}
@Execute
public void execute(@Named(IServiceConstants.ACTIVE_SHELL) Shell shell, E4PreferenceRegistry prefReg)
{
PreferenceManager pm = prefReg.getPreferenceManager();
PreferenceDialog dialog = new PreferenceDialog(shell, pm);
dialog.create();
dialog.getTreeViewer().setComparator(new ViewerComparator());
dialog.getTreeViewer().expandAll();
dialog.open();
}
}

View File

@ -1,321 +0,0 @@
/*******************************************************************************
* Copyright (c) 2014 OPCoach.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* OPCoach - initial API and implementation
*******************************************************************************/
package com.opcoach.e4.preferences.internal;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import javax.inject.Inject;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IExtensionRegistry;
import org.eclipse.core.runtime.preferences.InstanceScope;
import org.eclipse.e4.core.contexts.ContextInjectionFactory;
import org.eclipse.e4.core.contexts.IEclipseContext;
import org.eclipse.e4.core.di.annotations.Creatable;
import org.eclipse.e4.core.services.contributions.IContributionFactory;
import org.eclipse.e4.core.services.log.Logger;
import org.eclipse.jface.preference.IPreferenceNode;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.preference.PreferenceManager;
import org.eclipse.jface.preference.PreferenceNode;
import org.eclipse.jface.preference.PreferencePage;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Label;
import com.opcoach.e4.preferences.IPreferenceStoreProvider;
import com.opcoach.e4.preferences.ScopedPreferenceStore;
@SuppressWarnings("restriction")
@Creatable
public class E4PreferenceRegistry
{
public static final String PREFS_PAGE_XP = "com.opcoach.e4.preferences.e4PreferencePages"; // $NON-NLS-1$
public static final String PREF_STORE_PROVIDER = "com.opcoach.e4.preferences.e4PreferenceStoreProvider"; // $NON-NLS-1$
protected static final String ELMT_PAGE = "page"; // $NON-NLS-1$
protected static final String ATTR_ID = "id"; // $NON-NLS-1$
protected static final String ATTR_CATEGORY = "category"; // $NON-NLS-1$
protected static final String ATTR_CLASS = "class"; // $NON-NLS-1$
protected static final String ATTR_NAME = "name"; // $NON-NLS-1$
protected static final String ATTR_PLUGIN_ID = "pluginId"; // $NON-NLS-1$
protected static final String ATTR_ID_IN_WBCONTEXT = "idInWorkbenchContext"; // $NON-NLS-1$
@Inject
protected Logger logger;
@Inject
protected IEclipseContext context;
@Inject
protected IExtensionRegistry registry;
private PreferenceManager pm = null;
// A map of (pluginId, { IPreferenceStoreProvider, or key in wbcontext }
private Map<String, Object> psProviders;
public PreferenceManager getPreferenceManager()
{
// Remember of the unbounded nodes to order parent pages.
// Map<category, list of children> (all nodes except root nodes)
Map<String, Collection<IPreferenceNode>> childrenNodes = new HashMap<String, Collection<IPreferenceNode>>();
if (pm != null)
return pm;
pm = new PreferenceManager();
IContributionFactory factory = context.get(IContributionFactory.class);
for (IConfigurationElement elmt : registry.getConfigurationElementsFor(PREFS_PAGE_XP))
{
String bundleId = elmt.getNamespaceIdentifier();
if (!elmt.getName().equals(ELMT_PAGE))
{
logger.warn("unexpected element: {0}", elmt.getName());
continue;
} else if (isEmpty(elmt.getAttribute(ATTR_ID)) || isEmpty(elmt.getAttribute(ATTR_NAME)))
{
logger.warn("missing id and/or name: {}", bundleId);
continue;
}
PreferenceNode pn = null;
if (elmt.getAttribute(ATTR_CLASS) != null)
{
PreferencePage page = null;
try
{
String prefPageURI = getClassURI(bundleId, elmt.getAttribute(ATTR_CLASS));
Object object = factory.create(prefPageURI, context);
if (!(object instanceof PreferencePage))
{
logger.error("Expected instance of PreferencePage: {0}", elmt.getAttribute(ATTR_CLASS));
continue;
}
page = (PreferencePage) object;
setPreferenceStore(bundleId, page);
} catch (ClassNotFoundException e)
{
logger.error(e);
continue;
}
ContextInjectionFactory.inject(page, context);
if ((page.getTitle() == null || page.getTitle().isEmpty()) && elmt.getAttribute(ATTR_NAME) != null)
{
page.setTitle(elmt.getAttribute(ATTR_NAME));
}
pn = new PreferenceNode(elmt.getAttribute(ATTR_ID), page);
} else
{
pn = new PreferenceNode(elmt.getAttribute(ATTR_ID), new EmptyPreferencePage(elmt.getAttribute(ATTR_NAME)));
}
// Issue 2 : Fix bug on order (see :
// https://github.com/opcoach/e4Preferences/issues/2)
// Add only pages at root level and remember of child pages for
// categories
String category = elmt.getAttribute(ATTR_CATEGORY);
if (isEmpty(category))
{
pm.addToRoot(pn);
} else
{
/*
* IPreferenceNode parent = findNode(pm, category); if (parent
* == null) { // No parent found, but may be the extension has
* not been read yet. So remember of it unboundedNodes.put(pn,
* category); } else { parent.add(pn); }
*/
// Check if this category is already registered.
Collection<IPreferenceNode> children = childrenNodes.get(category);
if (children == null)
{
children = new ArrayList<IPreferenceNode>();
childrenNodes.put(category, children);
}
children.add(pn);
}
}
// Must now bind pages that has not been added in nodes (depends on the
// preference page read order)
// Iterate on all possible categories
Collection<String> categoriesDone = new ArrayList<String>();
while (!childrenNodes.isEmpty())
{
for (String cat : Collections.unmodifiableSet(childrenNodes.keySet()))
{
// Is this category already in preference manager ? If not add
// it later...
IPreferenceNode parent = findNode(pm, cat);
if (parent != null)
{
// Can add the list of children to this parent page...
for (IPreferenceNode pn : childrenNodes.get(cat))
{
parent.add(pn);
}
// Ok This parent page is done. Can remove it from map
// outside of this loop
categoriesDone.add(cat);
}
}
for (String keyToRemove : categoriesDone)
childrenNodes.remove(keyToRemove);
categoriesDone.clear();
}
return pm;
}
private void setPreferenceStore(String bundleId, PreferencePage page)
{
// Affect preference store to this page if this is a
// PreferencePage, else, must manage it internally
// Set the issue#1 on github :
// https://github.com/opcoach/e4Preferences/issues/1
// And manage the extensions of IP
initialisePreferenceStoreProviders();
IPreferenceStore store = null;
// Get the preference store according to policy.
Object data = psProviders.get(bundleId);
if (data != null)
{
if (data instanceof IPreferenceStore)
store = (IPreferenceStore) data;
else if (data instanceof IPreferenceStoreProvider)
store = ((IPreferenceStoreProvider) data).getPreferenceStore();
else if (data instanceof String)
store = (IPreferenceStore) context.get((String) data);
} else
{
// Default behavior : create a preference store for this bundle and remember of it
store = new ScopedPreferenceStore(InstanceScope.INSTANCE, bundleId);
psProviders.put(bundleId, store);
}
if (store != null)
page.setPreferenceStore(store);
else
{
logger.warn("Unable to set the preferenceStore for page " + page.getTitle() + " defined in bundle " + bundleId);
}
}
/** Read the e4PreferenceStoreProvider extension point */
private void initialisePreferenceStoreProviders()
{
if (psProviders == null)
{
IContributionFactory factory = context.get(IContributionFactory.class);
psProviders = new HashMap<String, Object>();
// Read extensions and fill the map...
for (IConfigurationElement elmt : registry.getConfigurationElementsFor(PREF_STORE_PROVIDER))
{
String declaringBundle = elmt.getNamespaceIdentifier();
String pluginId = elmt.getAttribute(ATTR_PLUGIN_ID);
if (isEmpty(pluginId))
{
logger.warn("missing plugin Id in extension " + PREF_STORE_PROVIDER + " check the plugin " + declaringBundle);
continue;
}
String classname = elmt.getAttribute(ATTR_CLASS);
String objectId = elmt.getAttribute(ATTR_ID_IN_WBCONTEXT);
if ((isEmpty(classname) && isEmpty(objectId)) || (((classname != null) && classname.length() > 0) && ((objectId != null) && objectId.length() > 0)))
{
logger.warn("In extension " + PREF_STORE_PROVIDER + " only one of the two attributes (pluginId or idInWorkbenchContext) must be set. Check the plugin "
+ declaringBundle);
continue;
}
// Ok can now work with data...
Object data = objectId;
if (classname != null)
{
data = factory.create(classname, context);
if (!(data instanceof IPreferenceStoreProvider))
{
logger.warn("In extension " + PREF_STORE_PROVIDER + " the class must implements IPreferenceStoreProvider. Check the plugin " + declaringBundle);
continue;
}
}
psProviders.put(pluginId, data);
}
}
}
private IPreferenceNode findNode(PreferenceManager pm, String categoryId)
{
for (Object o : pm.getElements(PreferenceManager.POST_ORDER))
{
if (o instanceof IPreferenceNode && ((IPreferenceNode) o).getId().equals(categoryId))
{
return (IPreferenceNode) o;
}
}
return null;
}
private String getClassURI(String definingBundleId, String spec) throws ClassNotFoundException
{
if (spec.startsWith("platform:"))
{
return spec;
} // $NON-NLS-1$
return "bundleclass://" + definingBundleId + '/' + spec;
}
private boolean isEmpty(String value)
{
return value == null || value.trim().isEmpty();
}
static class EmptyPreferencePage extends PreferencePage
{
public EmptyPreferencePage(String title)
{
setTitle(title);
noDefaultAndApplyButton();
}
@Override
protected Control createContents(Composite parent)
{
return new Label(parent, SWT.NONE);
}
}
}

View File

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>com.minres.scviewer.doc</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
</buildSpec>
<natures>
</natures>
</projectDescription>

Some files were not shown because too many files have changed in this diff Show More