Compare commits
	
		
			518 Commits
		
	
	
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 92428a3859 | |||
| 5f244dc03a | |||
| 64cc09d207 | |||
| 61bc407fb3 | |||
| f6a3da013e | |||
| c4fafae029 | |||
| e472a092c3 | |||
| 523c266e8d | |||
| db640808f2 | |||
| 09a55f1513 | |||
| 088500afff | |||
| c27354070c | |||
| 9ca573efdb | |||
| 36fdc68051 | |||
| 53576f5e1b | |||
| abb8b45cd8 | |||
| aaf8a9e5d0 | |||
| c9a94334c4 | |||
| 24a362c277 | |||
| aa4659f8ef | |||
| 81f37d4740 | |||
| 69c82ac9a8 | |||
| 95c04c2240 | |||
| be87792dad | |||
| d1808ec1cf | |||
| 1a86104b19 | |||
| dc4798b8ba | |||
| 3890a87a8c | |||
| d657843541 | |||
| 361a18b38e | |||
| 354c4a4390 | |||
| 65461ccc48 | |||
| 654cf3f9e5 | |||
| 6f2f5a388c | |||
| f9d38b5091 | |||
| ba83c585f0 | |||
| 14425b9102 | |||
| 1b7d4c3ed6 | |||
| b391d19303 | |||
| bf38ccd6db | |||
| 567d62cea1 | |||
| 6769513e2d | |||
| f64a1baf02 | |||
| 9be9671d3a | |||
| c39ca8884a | |||
| 5670977d52 | |||
| 463dad60b9 | |||
| 8a54ed3f6c | |||
| 74f30e921f | |||
| dbae0f1666 | |||
| 52232bb0db | |||
| 6dfe6c8e2b | |||
| a18f72c43f | |||
| ec471348f6 | |||
| b268b4b677 | |||
| da2cd03606 | |||
| c45d7b5024 | |||
| 1efb574a98 | |||
| 0105621be3 | |||
| e44e4d0a05 | |||
| 299f76323f | |||
| bba4349e1e | |||
| 85d9c92f21 | |||
| 2885cb9602 | |||
| 31e79e453c | |||
| 23a2f8d6c8 | |||
| ceaf52bfa1 | |||
| c8e587c1ea | |||
| d95683a146 | |||
| 07062d5618 | |||
| e0b710efc4 | |||
| 12a7c701e3 | |||
| cb259503cb | |||
| ebf3f920bf | |||
| 3b57ec029b | |||
| a737f5588d | |||
| 8f838a96b7 | |||
| 4d49e3b53f | |||
| b809042189 | |||
| 0e705ce0e9 | |||
| 25064f9744 | |||
| 31fd54c6be | |||
| 
						 | 
					a1094ff870 | ||
| 
						 | 
					e53764cd7b | ||
| 
						 | 
					3f7bdc7e28 | ||
| 8d94b517c1 | |||
| d5e50a06b2 | |||
| 8dcfc061cb | |||
| 79a5343cde | |||
| c9c6db8e4c | |||
| e629bdc5bc | |||
| 8522627081 | |||
| d7f6d9b879 | |||
| 8f48abf0ae | |||
| fbec708522 | |||
| 5c59fb0676 | |||
| 2a9c5ff6a5 | |||
| 9fe7a83dfa | |||
| eb4e2301c1 | |||
| a6aa9859ea | |||
| 1866ae17a9 | |||
| 6987985e36 | |||
| f81f84d60e | |||
| fd8e2ea751 | |||
| 2d11e39653 | |||
| ab419a743f | |||
| fc64fa781a | |||
| c474ca33d8 | |||
| 8119c1a4f3 | |||
| 5f84194145 | |||
| 7dbcffe95d | |||
| 20934a9f47 | |||
| 24890f9bbb | |||
| bd0629301b | |||
| 71da420d86 | |||
| f9be6758e2 | |||
| 93a8c067fc | |||
| 5a372d0f90 | |||
| 806000c4cc | |||
| c32d46cdc0 | |||
| 5736279e8d | |||
| e3f4dc6616 | |||
| a64e06ff7a | |||
| a42b786835 | |||
| e76000d87b | |||
| 60ead71029 | |||
| 4c48fda5ad | |||
| 6a591f2dbc | |||
| 86c30ad948 | |||
| 0ae055b486 | |||
| efcd4f5ab8 | |||
| 232d2d4275 | |||
| 44f96e5383 | |||
| 44812310b0 | |||
| 6ef91bb5e7 | |||
| aa459b0ea6 | |||
| a2adf66618 | |||
| 3405e90df9 | |||
| 9a59947e67 | |||
| 9384d3278c | |||
| 1af3171b2e | |||
| 03fd9e154b | |||
| 3572f683e3 | |||
| 524ffb189c | |||
| 7fac6c8f74 | |||
| 037c645075 | |||
| 2f9bd29dc8 | |||
| 92662c546a | |||
| efa6544623 | |||
| 52cf9daeec | |||
| 4a315722b1 | |||
| a52efd1a12 | |||
| 535df30ada | |||
| bad34dd1d1 | |||
| 5ac7f05f57 | |||
| 8353b59a27 | |||
| 2c6ca6c376 | |||
| f4b03cb0e6 | |||
| c7858997c0 | |||
| bd99ab3992 | |||
| 66f365d38d | |||
| 59987f262d | |||
| 452a28362e | |||
| d6805f383b | |||
| 076611eec7 | |||
| e0fa55e2c0 | |||
| 9ea1994228 | |||
| 36f628c365 | |||
| ff87e72510 | |||
| aef1e29a53 | |||
| 1ebf9ba382 | |||
| 929408d08c | |||
| f57fb93525 | |||
| 788065e456 | |||
| 22b46e0525 | |||
| b75018239a | |||
| 598bb8eec7 | |||
| 869265fc13 | |||
| 5ad813527a | |||
| 73f8d3d50a | |||
| da1701195d | |||
| 9b6334509e | |||
| ac4acc34a4 | |||
| b6963f38d6 | |||
| 182a036ade | |||
| 97f2182290 | |||
| 1986a8c9c3 | |||
| 6905d96329 | |||
| 818f786b1d | |||
| 2948c1bd33 | |||
| 78faab404c | |||
| 64b10970a8 | |||
| 6ab8fd232e | |||
| f337a94112 | |||
| 0135631a3e | |||
| d0e1e8801f | |||
| d1b3a91979 | |||
| 45c1396e0e | |||
| b7301733f0 | |||
| 5df91dbaa8 | |||
| 68918689e7 | |||
| c41dd646da | |||
| a077389b83 | |||
| caa37375c0 | |||
| 3daea8ab43 | |||
| c5d77af0d0 | |||
| 7f7fdf09f4 | |||
| 7aba6a2ecb | |||
| 012395b933 | |||
| 787e3accc0 | |||
| b778940c83 | |||
| 71297c4e5a | |||
| 1d2395e00d | |||
| b69e1886b9 | |||
| d65803a4b7 | |||
| 0e49a68e09 | |||
| 7af5593fd4 | |||
| 25545dac51 | |||
| df77af64ca | |||
| e264ab2cbe | |||
| 8c17ed4146 | |||
| 4ee2e8bc68 | |||
| bdcba613d5 | |||
| 049de0ddaf | |||
| 6be3f378d4 | |||
| 6d8aa33fc9 | |||
| b37ba9f2f1 | |||
| 799f083a74 | |||
| 156abe63cd | |||
| d38016a03f | |||
| 5604c3ee5e | |||
| 5adeae15a9 | |||
| bca94ceb9d | |||
| a42f086339 | |||
| 888edf32be | |||
| ee5536f1b5 | |||
| 59859e5d90 | |||
| 5bae086712 | |||
| 16de83616a | |||
| 6530362b89 | |||
| 0372e03abb | |||
| 26e8ea8a51 | |||
| efd042dd22 | |||
| d06642d51f | |||
| f27bcd7109 | |||
| eaea5a4653 | |||
| fa4bd0ddd5 | |||
| 3cbbdbee92 | |||
| d674e155e1 | |||
| cb3366a559 | |||
| 8de0e11226 | |||
| b12232329b | |||
| 5e63972500 | |||
| d53db967b3 | |||
| 25170d0d83 | |||
| ba6446378a | |||
| 12b08ca8c6 | |||
| bb60f3a9c8 | |||
| ba347a258d | |||
| ac41feff6e | |||
| ec9eb17ee3 | |||
| d2cf13d64b | |||
| 7775f5978b | |||
| 8c031e7649 | |||
| 6b2eae7f26 | |||
| 69805a423f | |||
| f1178157c8 | |||
| 1ebc6eb03a | |||
| 916215c0c2 | |||
| 6c8e149be2 | |||
| bd08b69747 | |||
| 33e0061147 | |||
| 45e1031e5e | |||
| 73b21cb80b | |||
| 15fb825548 | |||
| 0d448368cc | |||
| abacae42d7 | |||
| 9d2e2e7f64 | |||
| eb64cc60c5 | |||
| 5ea0d6446a | |||
| d970d07048 | |||
| 90f45c698f | |||
| af388b2462 | |||
| 8700e2fdde | |||
| 23ad84ef30 | |||
| 0d074ea6ae | |||
| 351a246238 | |||
| 841b5fe2b2 | |||
| 85ce07f11f | |||
| b44f3418f4 | |||
| bfbc40c282 | |||
| 2c66bf3edd | |||
| a51f922ea4 | |||
| 4d8e7a3cd1 | |||
| 70ccf35fe4 | |||
| 6c5032da10 | |||
| b2e269b67c | |||
| cd01c6a808 | |||
| 179d40ac8d | |||
| 754a61e989 | |||
| bedf4c5c4d | |||
| 7c27bcec47 | |||
| 90f09cc222 | |||
| 21d83f93dc | |||
| db838efc65 | |||
| 929af41dd3 | |||
| 979a7672e6 | |||
| 67818ff4dd | |||
| 0c7631e912 | |||
| a06b888365 | |||
| ded10e1c22 | |||
| 2f3bc0d892 | |||
| 184f1b2d2c | |||
| 90249dadb9 | |||
| c88eb32db8 | |||
| d47db29b93 | |||
| e8148af10f | |||
| b298a4ca6c | |||
| f474e38687 | |||
| 2e806f7b86 | |||
| b7a8d99e2d | |||
| 2a09fc7e6f | |||
| e36abb8d55 | |||
| 5746b9f758 | |||
| 6be1f018b1 | |||
| 38a046aaef | |||
| fdbd6f8402 | |||
| 1dad204494 | |||
| 54661c51ce | |||
| b34fe0d0ba | |||
| 868eceddc5 | |||
| b642c396c7 | |||
| f3d8e34ed0 | |||
| 401c760e01 | |||
| 5add0e385d | |||
| 2ba6822f2b | |||
| 54124d13bf | |||
| 5b949a9d37 | |||
| 9a9b25622c | |||
| dd6a8669b1 | |||
| b483897769 | |||
| bd24c4dd05 | |||
| 664e99d09e | |||
| 675b2ed972 | |||
| e6f19311b1 | |||
| 4a8034191c | |||
| 9d4e5bf636 | |||
| cc9be70708 | |||
| 2dcc72f679 | |||
| 563b6e2b01 | |||
| 6161c0e0ec | |||
| 61c2102ab7 | |||
| 796a04b981 | |||
| 2a71ab94f5 | |||
| 923b89c038 | |||
| 3de6c9900c | |||
| ef1f2a758a | |||
| 3e6d5bd33e | |||
| 26968b8521 | |||
| 611cfc7b46 | |||
| 8cb77a555b | |||
| b4a7f032f5 | |||
| 62e0ec2008 | |||
| f6cc12e8c3 | |||
| b38b268fcb | |||
| 55a14edc9d | |||
| 45c23564b5 | |||
| b170fb3c2a | |||
| ab975eadd1 | |||
| 7ad70411f3 | |||
| 24720340be | |||
| ad51066f1c | |||
| 95e2db60b6 | |||
| db1d377da6 | |||
| 230e8dcc7a | |||
| ab2146102f | |||
| b1148922d8 | |||
| e4de765da9 | |||
| 47120c66b7 | |||
| 35ccc71f10 | |||
| 688a6abd99 | |||
| 97693cd0c4 | |||
| 3e5ab7b0ac | |||
| ad80671dd2 | |||
| 4ab3000b69 | |||
| 572e999a5b | |||
| e5bcb25d24 | |||
| 19ea1f0b6d | |||
| e88014ebba | |||
| 10a0608fd3 | |||
| 60abfb7afd | |||
| 6b9e3c0e70 | |||
| 19065cdbb7 | |||
| a7afeb1f7c | |||
| 150c404cdb | |||
| 5fe8b261ec | |||
| f8a177c9e0 | |||
| 077a6f8011 | |||
| 8b84f1341b | |||
| 20824e75c1 | |||
| fb283ab668 | |||
| dc3df60716 | |||
| 47b58ed770 | |||
| 1cebc2da0a | |||
| 414030cbd2 | |||
| 8011585113 | |||
| 270a004037 | |||
| 2aa4160400 | |||
| c8e416966b | |||
| 20cb208719 | |||
| e30aff82ee | |||
| ad2937c332 | |||
| 0e8a757d6e | |||
| 220eaea73c | |||
| 24d6085ded | |||
| 8a66734279 | |||
| f6e2224651 | |||
| 5d85c12bb8 | |||
| 2b1cb7856f | |||
| f1d080983a | |||
| 767b083a22 | |||
| 348ffe20d6 | |||
| f3494e7562 | |||
| 9b6908f193 | |||
| 0cfcc8c118 | |||
| ec5cd209c6 | |||
| 5933bcd512 | |||
| 14ac6654b9 | |||
| cea11743eb | |||
| 210d925987 | |||
| ffbffd88f1 | |||
| ec8d54dca3 | |||
| e8682e446b | |||
| e87e1791c3 | |||
| f5a4e3c39e | |||
| 306e20d14f | |||
| c76805d133 | |||
| 8ebb2dc3a6 | |||
| 669fd6a881 | |||
| 8e66e5fe0b | |||
| 674aa7d3ce | |||
| 2b7c9a240f | |||
| 18f2a110f0 | |||
| 27f1e8ca6a | |||
| 3565a6a05b | |||
| aef4901b2b | |||
| d77aaa3865 | |||
| b398a07fd7 | |||
| 732bd82034 | |||
| 2ccc5274aa | |||
| 9f4f71046d | |||
| d73b01f77d | |||
| 77302521b2 | |||
| f89471e14b | |||
| 0634556256 | |||
| 4f097e7f59 | |||
| f1abc645c3 | |||
| 2c8b7129e9 | |||
| 2f81529f93 | |||
| 8f76d816f1 | |||
| 594a71a9ba | |||
| 0fa0d4a5b8 | |||
| 97443c6cd8 | |||
| c3486eb6c8 | |||
| 8a286a8eac | |||
| e4329213fa | |||
| 857bbe17d7 | |||
| 091cb1cf7f | |||
| 
						 | 
					0623b8de4a | ||
| 
						 | 
					8b55548cca | ||
| a0a4ea1f53 | |||
| e034d1faad | |||
| 68660d0892 | |||
| a0f0b55045 | |||
| 3d20b6961e | |||
| 
						 | 
					ca02c92a18 | ||
| 347dbf134b | |||
| 
						 | 
					44ac32359f | ||
| 48c7d81b8a | |||
| e945a3acbe | |||
| 145dfbd74d | |||
| b7646dc29e | |||
| 
						 | 
					475181c8df | ||
| 
						 | 
					3d043ce1b7 | ||
| 
						 | 
					7e2869b7ee | ||
| 51d9d7e25c | |||
| ed665ac032 | |||
| 689d7874f4 | |||
| 
						 | 
					c7c1f97b0c | ||
| 
						 | 
					7b2db09585 | ||
| 
						 | 
					52f3f7b348 | ||
| 429ea37080 | |||
| 04f011e82f | |||
| 
						 | 
					3a6ed3ce7e | ||
| 79eb8073d8 | |||
| 4ea841cc7b | |||
| 6bf642d2af | |||
| 
						 | 
					15c24f0925 | ||
| 
						 | 
					4d4a6579c6 | ||
| b648dccfd8 | |||
| f9425834a3 | |||
| e0d00e6402 | |||
| b1b7517759 | |||
| a5b9c28007 | |||
| b5e408595b | |||
| f15930682e | |||
| 
						 | 
					f8765518bc | ||
| 
						 | 
					73e952faea | ||
| 111383bcba | |||
| 244f005ae6 | |||
| 701733e69d | |||
| 6b4a9c1e14 | |||
| 3abbc3e0e2 | |||
| 2a7b713ef2 | |||
| 593571ce10 | |||
| 979261432a | |||
| e25f56a8a9 | |||
| e8788e6ce0 | 
							
								
								
									
										5
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										5
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							@@ -6,5 +6,8 @@
 | 
				
			|||||||
SCViewer initiator_target.launch
 | 
					SCViewer initiator_target.launch
 | 
				
			||||||
SCViewer.xcf
 | 
					SCViewer.xcf
 | 
				
			||||||
SCViewer_1.png
 | 
					SCViewer_1.png
 | 
				
			||||||
*.launch
 | 
					 | 
				
			||||||
copyrightLog.txt
 | 
					copyrightLog.txt
 | 
				
			||||||
 | 
					/workspace
 | 
				
			||||||
 | 
					?*.launch
 | 
				
			||||||
 | 
					/.settings/
 | 
				
			||||||
 | 
					.tycho-consumer-pom.xml
 | 
				
			||||||
							
								
								
									
										23
									
								
								.launch/Build SCViewer.launch
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										23
									
								
								.launch/Build SCViewer.launch
									
									
									
									
									
										Normal 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>
 | 
				
			||||||
							
								
								
									
										23
									
								
								.launch/Build and deploy SCViewer.launch
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										23
									
								
								.launch/Build and deploy SCViewer.launch
									
									
									
									
									
										Normal 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>
 | 
				
			||||||
							
								
								
									
										26
									
								
								.launch/Set SCViewer version.launch
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										26
									
								
								.launch/Set SCViewer version.launch
									
									
									
									
									
										Normal 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>
 | 
				
			||||||
							
								
								
									
										71
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										71
									
								
								README.md
									
									
									
									
									
								
							@@ -1,12 +1,8 @@
 | 
				
			|||||||
SCViewer
 | 
					SCViewer
 | 
				
			||||||
========
 | 
					========
 | 
				
			||||||
 | 
					
 | 
				
			||||||
SCViewer is composed of a set of eclipse plugins to display VCD and transaction streams 
 | 
					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 VCD trace implementation and the SystemC Verification Library (SCV).
 | 
					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) ).
 | 
				
			||||||
For further description of the SCV please refer to 
 | 
					 | 
				
			||||||
http://www.accellera.org/activities/committees/systemc-verification.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
> If you encounter issue when running on Linux please try running as `SWT_GTK3=0 scviewer` as there exist issues wiht GTK3.
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
The viewer has the following features
 | 
					The viewer has the following features
 | 
				
			||||||
- support of VCD files (compressed and uncompressed)
 | 
					- support of VCD files (compressed and uncompressed)
 | 
				
			||||||
@@ -18,14 +14,57 @@ The viewer has the following features
 | 
				
			|||||||
 - sqlite based 
 | 
					 - sqlite based 
 | 
				
			||||||
 - visualization of transaction relations
 | 
					 - visualization of transaction relations
 | 
				
			||||||
 | 
					
 | 
				
			||||||
To build the plugins the Eclipse SDK or PDE can be used. In both cases the Groovy
 | 
					> If you encounter issue when running on Linux please try running as `SWT_GTK3=0 scviewer` as there exist issues wiht GTK3.
 | 
				
			||||||
eclipse plugin (http://groovy.codehaus.org/Eclipse+Plugin or Market) has to be
 | 
					
 | 
				
			||||||
installed.
 | 
					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
 | 
					 | 
				
			||||||
- add calculated traces
 | 
					 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,9 +0,0 @@
 | 
				
			|||||||
<?xml version="1.0" encoding="UTF-8"?>
 | 
					 | 
				
			||||||
<classpath>
 | 
					 | 
				
			||||||
	<classpathentry exported="true" kind="lib" path="json-20180813.jar" sourcepath="json-20180813-sources.jar"/>
 | 
					 | 
				
			||||||
	<classpathentry exported="true" kind="lib" path="leveldb-0.11-SNAPSHOT-uber.jar" sourcepath="leveldb-0.11-SNAPSHOT-sources.jar"/>
 | 
					 | 
				
			||||||
	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
 | 
					 | 
				
			||||||
	<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
 | 
					 | 
				
			||||||
	<classpathentry kind="src" path="src"/>
 | 
					 | 
				
			||||||
	<classpathentry kind="output" path="bin"/>
 | 
					 | 
				
			||||||
</classpath>
 | 
					 | 
				
			||||||
@@ -1,4 +0,0 @@
 | 
				
			|||||||
/json-20180813-sources.jar
 | 
					 | 
				
			||||||
/leveldb-0.11-SNAPSHOT-sources.jar
 | 
					 | 
				
			||||||
/bin/
 | 
					 | 
				
			||||||
/target/
 | 
					 | 
				
			||||||
@@ -1,7 +0,0 @@
 | 
				
			|||||||
eclipse.preferences.version=1
 | 
					 | 
				
			||||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
 | 
					 | 
				
			||||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
 | 
					 | 
				
			||||||
org.eclipse.jdt.core.compiler.compliance=1.8
 | 
					 | 
				
			||||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
 | 
					 | 
				
			||||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
 | 
					 | 
				
			||||||
org.eclipse.jdt.core.compiler.source=1.8
 | 
					 | 
				
			||||||
@@ -1,4 +0,0 @@
 | 
				
			|||||||
eclipse.preferences.version=1
 | 
					 | 
				
			||||||
pluginProject.equinox=false
 | 
					 | 
				
			||||||
pluginProject.extensions=false
 | 
					 | 
				
			||||||
resolve.requirebundle=false
 | 
					 | 
				
			||||||
@@ -1,5 +0,0 @@
 | 
				
			|||||||
eclipse.preferences.version=1
 | 
					 | 
				
			||||||
enabled=true
 | 
					 | 
				
			||||||
path=OSGI-INF
 | 
					 | 
				
			||||||
validationErrorLevel=error
 | 
					 | 
				
			||||||
validationErrorLevel.missingImplicitUnbindMethod=error
 | 
					 | 
				
			||||||
@@ -1,18 +0,0 @@
 | 
				
			|||||||
Manifest-Version: 1.0
 | 
					 | 
				
			||||||
Bundle-ManifestVersion: 2
 | 
					 | 
				
			||||||
Bundle-Name: Leveldb
 | 
					 | 
				
			||||||
Bundle-SymbolicName: com.minres.scviewer.database.leveldb
 | 
					 | 
				
			||||||
Bundle-Version: 1.0.0.qualifier
 | 
					 | 
				
			||||||
Bundle-Vendor: MINRES Technologies GmbH
 | 
					 | 
				
			||||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
 | 
					 | 
				
			||||||
Import-Package: org.osgi.framework;version="1.3.0"
 | 
					 | 
				
			||||||
Automatic-Module-Name: com.minres.scviewer.database.leveldb
 | 
					 | 
				
			||||||
Service-Component: OSGI-INF/*.xml
 | 
					 | 
				
			||||||
Require-Bundle: com.minres.scviewer.database;bundle-version="1.0.0",
 | 
					 | 
				
			||||||
 org.eclipse.equinox.util;bundle-version="1.0.500",
 | 
					 | 
				
			||||||
 org.eclipse.equinox.ds;bundle-version="1.4.200",
 | 
					 | 
				
			||||||
 org.eclipse.osgi.services;bundle-version="3.4.0"
 | 
					 | 
				
			||||||
Bundle-ActivationPolicy: lazy
 | 
					 | 
				
			||||||
Bundle-ClassPath: leveldb-0.11-SNAPSHOT-uber.jar,
 | 
					 | 
				
			||||||
 .,
 | 
					 | 
				
			||||||
 json-20180813.jar
 | 
					 | 
				
			||||||
@@ -1,7 +0,0 @@
 | 
				
			|||||||
source.. = src/
 | 
					 | 
				
			||||||
output.. = bin/
 | 
					 | 
				
			||||||
bin.includes = META-INF/,\
 | 
					 | 
				
			||||||
               .,\
 | 
					 | 
				
			||||||
               OSGI-INF/,\
 | 
					 | 
				
			||||||
               leveldb-0.11-SNAPSHOT-uber.jar,\
 | 
					 | 
				
			||||||
               json-20180813.jar
 | 
					 | 
				
			||||||
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							@@ -1,87 +0,0 @@
 | 
				
			|||||||
package com.minres.scviewer.database.leveldb;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
import static java.nio.charset.StandardCharsets.UTF_8;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
import java.io.File;
 | 
					 | 
				
			||||||
import java.util.ArrayList;
 | 
					 | 
				
			||||||
import java.util.Collection;
 | 
					 | 
				
			||||||
import java.util.List;
 | 
					 | 
				
			||||||
import java.util.Map.Entry;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
import org.iq80.leveldb.Options;
 | 
					 | 
				
			||||||
import org.iq80.leveldb.impl.SeekingIterator;
 | 
					 | 
				
			||||||
import org.json.JSONObject;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
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 LevelDBLoader implements IWaveformDbLoader {
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	static byte[] toByteArray(String value) {
 | 
					 | 
				
			||||||
		return value.getBytes(UTF_8);
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	private TxDBWrapper levelDb;
 | 
					 | 
				
			||||||
	private IWaveformDb db;
 | 
					 | 
				
			||||||
	private Long maxTime=null;
 | 
					 | 
				
			||||||
	private List<RelationType> usedRelationsList = new ArrayList<>();
 | 
					 | 
				
			||||||
	
 | 
					 | 
				
			||||||
	@Override
 | 
					 | 
				
			||||||
	public boolean load(IWaveformDb db, File inp) throws Exception {
 | 
					 | 
				
			||||||
		try {
 | 
					 | 
				
			||||||
			this.db=db;
 | 
					 | 
				
			||||||
			levelDb = new TxDBWrapper(new Options(), inp);
 | 
					 | 
				
			||||||
			JSONObject configVal = new JSONObject(levelDb.get("__config"));
 | 
					 | 
				
			||||||
			if(!configVal.isEmpty())
 | 
					 | 
				
			||||||
				levelDb.setTimeResolution(configVal.getLong("resolution"));
 | 
					 | 
				
			||||||
		} catch(Exception e) {
 | 
					 | 
				
			||||||
			return false;
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
		return true;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	@Override
 | 
					 | 
				
			||||||
	public Long getMaxTime() {
 | 
					 | 
				
			||||||
		if(maxTime==null) {
 | 
					 | 
				
			||||||
			SeekingIterator<String, String> it = levelDb.iterator();
 | 
					 | 
				
			||||||
			it.seek("st~");
 | 
					 | 
				
			||||||
			Entry<String, String> val = null;
 | 
					 | 
				
			||||||
			while(it.hasNext()) {
 | 
					 | 
				
			||||||
				Entry<String, String>  v = it.next();
 | 
					 | 
				
			||||||
				if(!v.getKey().startsWith("st~")) continue;
 | 
					 | 
				
			||||||
				val=v;
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
			if(val==null) 
 | 
					 | 
				
			||||||
				maxTime = 0L;
 | 
					 | 
				
			||||||
			else {
 | 
					 | 
				
			||||||
				String[] token = val.getKey().split("~");
 | 
					 | 
				
			||||||
				maxTime = Long.parseLong(token[2], 16)*levelDb.getTimeResolution();
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
		return maxTime;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	@Override
 | 
					 | 
				
			||||||
	public List<IWaveform> getAllWaves() {
 | 
					 | 
				
			||||||
		List<IWaveform> streams=new ArrayList<IWaveform>();
 | 
					 | 
				
			||||||
		SeekingIterator<String, String> it = levelDb.iterator();
 | 
					 | 
				
			||||||
		it.seek("s~");
 | 
					 | 
				
			||||||
		while(it.hasNext()) {
 | 
					 | 
				
			||||||
			Entry<String, String> val = it.next();
 | 
					 | 
				
			||||||
			if(!val.getKey().startsWith("s~")) break;
 | 
					 | 
				
			||||||
			TxStream stream = new TxStream(levelDb, db, new JSONObject(val.getValue()));
 | 
					 | 
				
			||||||
			stream.setRelationTypeList(usedRelationsList);
 | 
					 | 
				
			||||||
			streams.add(stream);
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
		return streams;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	@Override
 | 
					 | 
				
			||||||
	public Collection<RelationType> getAllRelationTypes() {
 | 
					 | 
				
			||||||
//		return Collections.emptyList();
 | 
					 | 
				
			||||||
		return usedRelationsList;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
@@ -1,51 +0,0 @@
 | 
				
			|||||||
package com.minres.scviewer.database.leveldb;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
import static java.nio.charset.StandardCharsets.UTF_8;
 | 
					 | 
				
			||||||
import static org.iq80.leveldb.shaded.guava.collect.Maps.immutableEntry;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
import java.util.Map.Entry;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
import org.iq80.leveldb.DBIterator;
 | 
					 | 
				
			||||||
import org.iq80.leveldb.impl.SeekingIterator;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
class StringDbIterator implements SeekingIterator<String, String> {
 | 
					 | 
				
			||||||
	private final DBIterator iterator;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	StringDbIterator(DBIterator iterator) {
 | 
					 | 
				
			||||||
		this.iterator = iterator;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	@Override
 | 
					 | 
				
			||||||
	public boolean hasNext() {
 | 
					 | 
				
			||||||
		return iterator.hasNext();
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	@Override
 | 
					 | 
				
			||||||
	public void seekToFirst() {
 | 
					 | 
				
			||||||
		iterator.seekToFirst();
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	@Override
 | 
					 | 
				
			||||||
	public void seek(String targetKey) {
 | 
					 | 
				
			||||||
		iterator.seek(targetKey.getBytes(UTF_8));
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	@Override
 | 
					 | 
				
			||||||
	public Entry<String, String> peek() {
 | 
					 | 
				
			||||||
		return adapt(iterator.peekNext());
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	@Override
 | 
					 | 
				
			||||||
	public Entry<String, String> next() {
 | 
					 | 
				
			||||||
		return adapt(iterator.next());
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	@Override
 | 
					 | 
				
			||||||
	public void remove() {
 | 
					 | 
				
			||||||
		throw new UnsupportedOperationException();
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	private Entry<String, String> adapt(Entry<byte[], byte[]> next) {
 | 
					 | 
				
			||||||
		return immutableEntry(new String(next.getKey(), UTF_8), new String(next.getValue(), UTF_8));
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
@@ -1,172 +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.leveldb;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
import java.util.ArrayList;
 | 
					 | 
				
			||||||
import java.util.Collection;
 | 
					 | 
				
			||||||
import java.util.List;
 | 
					 | 
				
			||||||
import org.iq80.leveldb.impl.SeekingIterator;
 | 
					 | 
				
			||||||
import org.json.JSONArray;
 | 
					 | 
				
			||||||
import org.json.JSONException;
 | 
					 | 
				
			||||||
import org.json.JSONObject;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
import com.minres.scviewer.database.ITx;
 | 
					 | 
				
			||||||
import com.minres.scviewer.database.ITxAttribute;
 | 
					 | 
				
			||||||
import com.minres.scviewer.database.ITxEvent;
 | 
					 | 
				
			||||||
import com.minres.scviewer.database.ITxGenerator;
 | 
					 | 
				
			||||||
import com.minres.scviewer.database.ITxRelation;
 | 
					 | 
				
			||||||
import com.minres.scviewer.database.ITxStream;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
public class Tx implements ITx {
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	private TxDBWrapper levelDb;
 | 
					 | 
				
			||||||
	private TxStream trStream;
 | 
					 | 
				
			||||||
	private TxGenerator trGenerator;
 | 
					 | 
				
			||||||
	private long id;
 | 
					 | 
				
			||||||
	private long start_time=0;
 | 
					 | 
				
			||||||
	private long end_time=0;
 | 
					 | 
				
			||||||
	private int concurency_index;
 | 
					 | 
				
			||||||
	private boolean initialized=false;
 | 
					 | 
				
			||||||
	private List<ITxAttribute> attributes;
 | 
					 | 
				
			||||||
	private List<ITxRelation> incoming, outgoing;
 | 
					 | 
				
			||||||
	
 | 
					 | 
				
			||||||
	public Tx(TxDBWrapper levelDb, TxStream trStream, TxGenerator trGenerator, long id) {
 | 
					 | 
				
			||||||
		this.levelDb=levelDb;
 | 
					 | 
				
			||||||
		this.trStream=trStream;
 | 
					 | 
				
			||||||
		this.trGenerator=trGenerator;
 | 
					 | 
				
			||||||
		this.id=id;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	@Override
 | 
					 | 
				
			||||||
	public Long getId() {
 | 
					 | 
				
			||||||
		return id;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	@Override
 | 
					 | 
				
			||||||
	public ITxStream<ITxEvent> getStream() {
 | 
					 | 
				
			||||||
		return trStream;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	@Override
 | 
					 | 
				
			||||||
	public ITxGenerator getGenerator() {
 | 
					 | 
				
			||||||
		return trGenerator;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	@Override
 | 
					 | 
				
			||||||
	public int getConcurrencyIndex() {
 | 
					 | 
				
			||||||
		if(!initialized) loadFromDb();
 | 
					 | 
				
			||||||
		return concurency_index;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	@Override
 | 
					 | 
				
			||||||
	public Long getBeginTime() {
 | 
					 | 
				
			||||||
		if(!initialized) loadFromDb();
 | 
					 | 
				
			||||||
		return start_time;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	@Override
 | 
					 | 
				
			||||||
	public Long getEndTime() {
 | 
					 | 
				
			||||||
		loadFromDb();
 | 
					 | 
				
			||||||
		return end_time;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	@Override
 | 
					 | 
				
			||||||
	public List<ITxAttribute> getAttributes() {
 | 
					 | 
				
			||||||
		if(attributes==null) {
 | 
					 | 
				
			||||||
			loadFromDb();
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
		return attributes;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	@Override
 | 
					 | 
				
			||||||
	public Collection<ITxRelation> getIncomingRelations() {
 | 
					 | 
				
			||||||
		if(incoming==null) {
 | 
					 | 
				
			||||||
			incoming = new ArrayList<ITxRelation>();
 | 
					 | 
				
			||||||
			SeekingIterator<String, String> it = levelDb.iterator();
 | 
					 | 
				
			||||||
			String key = "ri~"+String.format("%016x", id);
 | 
					 | 
				
			||||||
			it.seek(key);
 | 
					 | 
				
			||||||
			while(it.hasNext()) {
 | 
					 | 
				
			||||||
				String val = it.next().getKey();
 | 
					 | 
				
			||||||
				if(!val.startsWith(key)) break;;
 | 
					 | 
				
			||||||
				String[] token = val.split("~");
 | 
					 | 
				
			||||||
				long otherId = Long.parseLong(token[2], 16);
 | 
					 | 
				
			||||||
				incoming.add(createRelation(otherId, token[3], false));
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
		return incoming;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	@Override
 | 
					 | 
				
			||||||
	public Collection<ITxRelation> getOutgoingRelations() {
 | 
					 | 
				
			||||||
		if(outgoing==null) {
 | 
					 | 
				
			||||||
			outgoing = new ArrayList<ITxRelation>();
 | 
					 | 
				
			||||||
			SeekingIterator<String, String> it = levelDb.iterator();
 | 
					 | 
				
			||||||
			String key="ro~"+String.format("%016x", id);
 | 
					 | 
				
			||||||
			it.seek(key);
 | 
					 | 
				
			||||||
			while(it.hasNext()) {
 | 
					 | 
				
			||||||
				String val = it.next().getKey();
 | 
					 | 
				
			||||||
				if(!val.startsWith(key)) break;
 | 
					 | 
				
			||||||
				String[] token = val.split("~");
 | 
					 | 
				
			||||||
				long otherId = Long.parseLong(token[2], 16);
 | 
					 | 
				
			||||||
				outgoing.add(createRelation(otherId, token[3], true));
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
		return outgoing;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	@Override
 | 
					 | 
				
			||||||
	public int compareTo(ITx o) {
 | 
					 | 
				
			||||||
		int res = this.getBeginTime().compareTo(o.getBeginTime());
 | 
					 | 
				
			||||||
		if(res!=0)	
 | 
					 | 
				
			||||||
			return res;
 | 
					 | 
				
			||||||
		else
 | 
					 | 
				
			||||||
			return this.getId().compareTo(o.getId());
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	@Override
 | 
					 | 
				
			||||||
	public String toString() {
 | 
					 | 
				
			||||||
		return "tx#"+getId()+"["+getBeginTime()/1000000+"ns - "+getEndTime()/1000000+"ns]";
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	
 | 
					 | 
				
			||||||
	private void loadFromDb() throws JSONException {
 | 
					 | 
				
			||||||
		JSONObject dbVal = new JSONObject(levelDb.get("x~"+ String.format("%016x", id)));
 | 
					 | 
				
			||||||
		start_time=dbVal.getLong("START_TIME") * levelDb.getTimeResolution();
 | 
					 | 
				
			||||||
		end_time=dbVal.getLong("END_TIME") * levelDb.getTimeResolution();
 | 
					 | 
				
			||||||
		concurency_index=dbVal.getInt("conc");
 | 
					 | 
				
			||||||
		attributes=new ArrayList<>();
 | 
					 | 
				
			||||||
		JSONArray arr = dbVal.getJSONArray("attr");
 | 
					 | 
				
			||||||
		arr.forEach(entry -> {
 | 
					 | 
				
			||||||
			TxAttribute attr = new TxAttribute(this, (JSONObject) entry);
 | 
					 | 
				
			||||||
			attributes.add(attr);
 | 
					 | 
				
			||||||
		});
 | 
					 | 
				
			||||||
		initialized=true;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	private ITxRelation createRelation(long otherId, String name, boolean outgoing) {
 | 
					 | 
				
			||||||
		try {
 | 
					 | 
				
			||||||
			JSONObject otherTxVal = new JSONObject(levelDb.get("x~"+ String.format("%016x", otherId)));
 | 
					 | 
				
			||||||
			if(otherTxVal.isEmpty()) return null;
 | 
					 | 
				
			||||||
			JSONObject otherStreamVal = new JSONObject(levelDb.get("s~"+ String.format("%016x", otherTxVal.getLong("s"))));
 | 
					 | 
				
			||||||
			if(otherStreamVal.isEmpty()) return null;
 | 
					 | 
				
			||||||
			TxStream tgtStream = (TxStream) trStream.getDb().getStreamByName(otherStreamVal.getString("name"));
 | 
					 | 
				
			||||||
			Tx that = (Tx) tgtStream.getTransactions().get(otherId);
 | 
					 | 
				
			||||||
			return outgoing?
 | 
					 | 
				
			||||||
					new TxRelation(trStream.getRelationType(name), this, that):
 | 
					 | 
				
			||||||
						new TxRelation(trStream.getRelationType(name), that, this);
 | 
					 | 
				
			||||||
		} catch (SecurityException | IllegalArgumentException | JSONException e) {
 | 
					 | 
				
			||||||
			e.printStackTrace();
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
		return null;		
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
@@ -1,56 +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.leveldb;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
import org.json.JSONObject;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
import com.minres.scviewer.database.AssociationType;
 | 
					 | 
				
			||||||
import com.minres.scviewer.database.DataType;
 | 
					 | 
				
			||||||
import com.minres.scviewer.database.ITxAttribute;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
public class TxAttribute implements ITxAttribute{
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	private String name;
 | 
					 | 
				
			||||||
	
 | 
					 | 
				
			||||||
	private DataType dataType;
 | 
					 | 
				
			||||||
	
 | 
					 | 
				
			||||||
	private AssociationType associationType;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	private Object value;
 | 
					 | 
				
			||||||
	
 | 
					 | 
				
			||||||
	public TxAttribute(Tx trTransaction, JSONObject attribute) {
 | 
					 | 
				
			||||||
		this.name=attribute.getString("name");
 | 
					 | 
				
			||||||
		this.dataType=DataType.values()[attribute.getInt("type")];
 | 
					 | 
				
			||||||
		this.associationType=AssociationType.values()[attribute.getInt("assoc")];
 | 
					 | 
				
			||||||
		this.value=attribute.get("value");
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	@Override
 | 
					 | 
				
			||||||
	public String getName() {
 | 
					 | 
				
			||||||
		return name;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	@Override
 | 
					 | 
				
			||||||
	public DataType getDataType() {
 | 
					 | 
				
			||||||
		return dataType;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	@Override
 | 
					 | 
				
			||||||
	public AssociationType getType() {
 | 
					 | 
				
			||||||
		return associationType;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	@Override
 | 
					 | 
				
			||||||
	public Object getValue() {
 | 
					 | 
				
			||||||
		return value;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
@@ -1,90 +0,0 @@
 | 
				
			|||||||
package com.minres.scviewer.database.leveldb;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
import static java.nio.charset.StandardCharsets.UTF_8;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
import java.io.File;
 | 
					 | 
				
			||||||
import java.io.IOException;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
import org.iq80.leveldb.Options;
 | 
					 | 
				
			||||||
import org.iq80.leveldb.Range;
 | 
					 | 
				
			||||||
import org.iq80.leveldb.ReadOptions;
 | 
					 | 
				
			||||||
import org.iq80.leveldb.Snapshot;
 | 
					 | 
				
			||||||
import org.iq80.leveldb.impl.DbImpl;
 | 
					 | 
				
			||||||
import org.iq80.leveldb.impl.SeekingIterator;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
class TxDBWrapper {
 | 
					 | 
				
			||||||
	private final Options options;
 | 
					 | 
				
			||||||
	private final ReadOptions ro = new ReadOptions();
 | 
					 | 
				
			||||||
	private final File databaseDir;
 | 
					 | 
				
			||||||
	private DbImpl db;
 | 
					 | 
				
			||||||
	private long timeResolution=1L;;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	TxDBWrapper(Options options, File databaseDir) throws IOException {
 | 
					 | 
				
			||||||
		this.options = options.verifyChecksums(true).createIfMissing(false).errorIfExists(false).cacheSize(64*1024*1024);
 | 
					 | 
				
			||||||
		this.databaseDir = databaseDir;
 | 
					 | 
				
			||||||
		this.db = new DbImpl(options, databaseDir);
 | 
					 | 
				
			||||||
		ro.snapshot(db.getSnapshot());
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	public String get(String key) {
 | 
					 | 
				
			||||||
		byte[] slice = db.get(LevelDBLoader.toByteArray(key));
 | 
					 | 
				
			||||||
		if (slice == null) {
 | 
					 | 
				
			||||||
			return null;
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
		return new String(slice, UTF_8);
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	public String get(String key, Snapshot snapshot) {
 | 
					 | 
				
			||||||
		byte[] slice = db.get(LevelDBLoader.toByteArray(key), ro);
 | 
					 | 
				
			||||||
		return slice == null? null : new String(slice, UTF_8);
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	public void put(String key, String value) {
 | 
					 | 
				
			||||||
		db.put(LevelDBLoader.toByteArray(key), LevelDBLoader.toByteArray(value));
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	public void delete(String key) {
 | 
					 | 
				
			||||||
		db.delete(LevelDBLoader.toByteArray(key));
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	public SeekingIterator<String, String> iterator() {
 | 
					 | 
				
			||||||
		return new StringDbIterator(db.iterator());
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	public Snapshot getSnapshot() {
 | 
					 | 
				
			||||||
		return db.getSnapshot();
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	public void close() {
 | 
					 | 
				
			||||||
		try {
 | 
					 | 
				
			||||||
			ro.snapshot().close();
 | 
					 | 
				
			||||||
			db.close();
 | 
					 | 
				
			||||||
		} catch (IOException e) {} // ignore any error
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	public long size(String start, String limit) {
 | 
					 | 
				
			||||||
		return db.getApproximateSizes(new Range(LevelDBLoader.toByteArray(start), LevelDBLoader.toByteArray(limit)));
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	public long getMaxNextLevelOverlappingBytes() {
 | 
					 | 
				
			||||||
		return db.getMaxNextLevelOverlappingBytes();
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	public void reopen() throws IOException {
 | 
					 | 
				
			||||||
		reopen(options);
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	public void reopen(Options options) throws IOException {
 | 
					 | 
				
			||||||
		this.close();
 | 
					 | 
				
			||||||
		db = new DbImpl(options.verifyChecksums(true).createIfMissing(false).errorIfExists(false), databaseDir);
 | 
					 | 
				
			||||||
		ro.snapshot(db.getSnapshot());
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	
 | 
					 | 
				
			||||||
	public long getTimeResolution() {
 | 
					 | 
				
			||||||
		return timeResolution;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	
 | 
					 | 
				
			||||||
	public void setTimeResolution(long resolution) {
 | 
					 | 
				
			||||||
		this.timeResolution = resolution;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
@@ -1,57 +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.leveldb;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
import com.minres.scviewer.database.ITx;
 | 
					 | 
				
			||||||
import com.minres.scviewer.database.ITxEvent;
 | 
					 | 
				
			||||||
import com.minres.scviewer.database.IWaveformEvent;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
public class TxEvent implements ITxEvent {
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	private final Type type;
 | 
					 | 
				
			||||||
	private ITx tx;
 | 
					 | 
				
			||||||
	
 | 
					 | 
				
			||||||
	public TxEvent(Type type, ITx tx) {
 | 
					 | 
				
			||||||
		super();
 | 
					 | 
				
			||||||
		this.type = type;
 | 
					 | 
				
			||||||
		this.tx = tx;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	@Override
 | 
					 | 
				
			||||||
	public Long getTime() {
 | 
					 | 
				
			||||||
		return type==Type.BEGIN?tx.getBeginTime():tx.getEndTime();
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	@Override
 | 
					 | 
				
			||||||
	public IWaveformEvent duplicate() throws CloneNotSupportedException {
 | 
					 | 
				
			||||||
		return new TxEvent(type, tx);
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	@Override
 | 
					 | 
				
			||||||
	public int compareTo(IWaveformEvent o) {
 | 
					 | 
				
			||||||
		return getTime().compareTo(o.getTime());
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	@Override
 | 
					 | 
				
			||||||
	public ITx getTransaction() {
 | 
					 | 
				
			||||||
		return tx;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	@Override
 | 
					 | 
				
			||||||
	public Type getType() {
 | 
					 | 
				
			||||||
		return type;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	@Override
 | 
					 | 
				
			||||||
	public String toString() {
 | 
					 | 
				
			||||||
		return type.toString()+"@"+getTime()+" of tx #"+tx.getId();
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
@@ -1,56 +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.leveldb;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
import java.util.List;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
import org.json.JSONObject;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
import com.minres.scviewer.database.ITx;
 | 
					 | 
				
			||||||
import com.minres.scviewer.database.ITxEvent;
 | 
					 | 
				
			||||||
import com.minres.scviewer.database.ITxGenerator;
 | 
					 | 
				
			||||||
import com.minres.scviewer.database.ITxStream;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
public class TxGenerator implements ITxGenerator {
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	private ITxStream<ITxEvent>  stream;
 | 
					 | 
				
			||||||
	
 | 
					 | 
				
			||||||
	private long id;
 | 
					 | 
				
			||||||
	
 | 
					 | 
				
			||||||
	private String name;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	public TxGenerator(ITxStream<ITxEvent>  stream, JSONObject object) {
 | 
					 | 
				
			||||||
		this.stream=stream;
 | 
					 | 
				
			||||||
		this.id=object.getLong("id");
 | 
					 | 
				
			||||||
		this.name=object.getString("name");
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	@Override
 | 
					 | 
				
			||||||
	public Long getId() {
 | 
					 | 
				
			||||||
		return id;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	@Override
 | 
					 | 
				
			||||||
	public ITxStream<ITxEvent> getStream() {
 | 
					 | 
				
			||||||
		return stream;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	@Override
 | 
					 | 
				
			||||||
	public String getName() {
 | 
					 | 
				
			||||||
		return name;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	@Override
 | 
					 | 
				
			||||||
	public List<ITx> getTransactions() {
 | 
					 | 
				
			||||||
		return null;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
@@ -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.leveldb;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
import com.minres.scviewer.database.ITxRelation;
 | 
					 | 
				
			||||||
import com.minres.scviewer.database.ITx;
 | 
					 | 
				
			||||||
import com.minres.scviewer.database.RelationType;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
public class TxRelation implements ITxRelation {
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	RelationType relationType;
 | 
					 | 
				
			||||||
	Tx source, target;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	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;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
@@ -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.leveldb;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
import java.util.ArrayList;
 | 
					 | 
				
			||||||
import java.util.Collection;
 | 
					 | 
				
			||||||
import java.util.List;
 | 
					 | 
				
			||||||
import java.util.Map;
 | 
					 | 
				
			||||||
import java.util.Map.Entry;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
import org.iq80.leveldb.impl.SeekingIterator;
 | 
					 | 
				
			||||||
import org.json.JSONObject;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
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.RelationType;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
public class TxStream extends HierNode implements ITxStream<ITxEvent> {
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	private TxDBWrapper levelDb;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	private String fullName;
 | 
					 | 
				
			||||||
	
 | 
					 | 
				
			||||||
	private String kind;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	private IWaveformDb db;
 | 
					 | 
				
			||||||
		
 | 
					 | 
				
			||||||
	private long id;
 | 
					 | 
				
			||||||
	
 | 
					 | 
				
			||||||
	private TreeMap<Long, TxGenerator> generators;
 | 
					 | 
				
			||||||
	
 | 
					 | 
				
			||||||
	private TreeMap<Long, ITx> transactions;
 | 
					 | 
				
			||||||
	
 | 
					 | 
				
			||||||
	private Integer maxConcurrency;
 | 
					 | 
				
			||||||
	
 | 
					 | 
				
			||||||
	private TreeMap<Long, List<ITxEvent>> events;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	private List<RelationType> usedRelationsList;
 | 
					 | 
				
			||||||
	
 | 
					 | 
				
			||||||
	public TxStream(TxDBWrapper database, IWaveformDb waveformDb, JSONObject object) {
 | 
					 | 
				
			||||||
		super(object.get("name").toString());
 | 
					 | 
				
			||||||
		this.levelDb=database;
 | 
					 | 
				
			||||||
		this.db=waveformDb;
 | 
					 | 
				
			||||||
		this.fullName=object.getString("name");
 | 
					 | 
				
			||||||
		this.kind=object.getString("kind");
 | 
					 | 
				
			||||||
		this.id = object.getLong("id");
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	@Override
 | 
					 | 
				
			||||||
	public IWaveformDb getDb() {
 | 
					 | 
				
			||||||
		return db;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	@Override
 | 
					 | 
				
			||||||
	public String getFullName() {
 | 
					 | 
				
			||||||
		return fullName;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	@Override
 | 
					 | 
				
			||||||
	public Long getId() {
 | 
					 | 
				
			||||||
		return id;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	@Override
 | 
					 | 
				
			||||||
	public String getKind() {
 | 
					 | 
				
			||||||
		return kind;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	@Override
 | 
					 | 
				
			||||||
	public List<ITxGenerator> getGenerators() {
 | 
					 | 
				
			||||||
		if(generators==null){
 | 
					 | 
				
			||||||
			generators=new TreeMap<Long, TxGenerator>();
 | 
					 | 
				
			||||||
			SeekingIterator<String, String> it = levelDb.iterator();
 | 
					 | 
				
			||||||
			String key="sg~"+String.format("%016x", id);
 | 
					 | 
				
			||||||
			it.seek(key);
 | 
					 | 
				
			||||||
			while(it.hasNext()) {
 | 
					 | 
				
			||||||
				Entry<String, String> val = it.next();
 | 
					 | 
				
			||||||
				if(!val.getKey().startsWith(key)) break;
 | 
					 | 
				
			||||||
				JSONObject jVal = new JSONObject(val.getValue());
 | 
					 | 
				
			||||||
				generators.put(jVal.getLong("id"), new TxGenerator(this, jVal));
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
		return new ArrayList<ITxGenerator>(generators.values());
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	@Override
 | 
					 | 
				
			||||||
	public int getMaxConcurrency() {
 | 
					 | 
				
			||||||
		if(maxConcurrency==null){
 | 
					 | 
				
			||||||
				getTransactions();
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
		return maxConcurrency;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	@Override
 | 
					 | 
				
			||||||
	public  NavigableMap<Long, List<ITxEvent>> getEvents(){
 | 
					 | 
				
			||||||
		if(events==null){
 | 
					 | 
				
			||||||
			events=new TreeMap<Long, List<ITxEvent>>();
 | 
					 | 
				
			||||||
			for(Entry<Long, ITx> entry:getTransactions().entrySet()){
 | 
					 | 
				
			||||||
				ITx tx = entry.getValue();
 | 
					 | 
				
			||||||
				putEvent(new TxEvent(TxEvent.Type.BEGIN, tx));
 | 
					 | 
				
			||||||
				putEvent(new TxEvent(TxEvent.Type.END, tx));
 | 
					 | 
				
			||||||
			}	
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
		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<Long, ITx> getTransactions() {
 | 
					 | 
				
			||||||
		if(transactions==null){
 | 
					 | 
				
			||||||
			if(generators==null) getGenerators();
 | 
					 | 
				
			||||||
			transactions = new TreeMap<Long, ITx>();
 | 
					 | 
				
			||||||
			maxConcurrency=0;
 | 
					 | 
				
			||||||
			SeekingIterator<String, String> it = levelDb.iterator();
 | 
					 | 
				
			||||||
			String key = "sgx~"+String.format("%016x", id);
 | 
					 | 
				
			||||||
			it.seek(key);
 | 
					 | 
				
			||||||
			while(it.hasNext()) {
 | 
					 | 
				
			||||||
				Entry<String, String> val = it.next();
 | 
					 | 
				
			||||||
				if(!val.getKey().startsWith(key)) break;
 | 
					 | 
				
			||||||
				String[] token = val.getKey().split("~");
 | 
					 | 
				
			||||||
				long gid = Long.parseLong(token[2], 16); // gen id
 | 
					 | 
				
			||||||
				long id = Long.parseLong(token[3], 16); // tx id
 | 
					 | 
				
			||||||
				ITx tx = new Tx(levelDb, this, generators.get(gid), id);
 | 
					 | 
				
			||||||
				transactions.put(id, tx);
 | 
					 | 
				
			||||||
				maxConcurrency= Math.max(maxConcurrency, tx.getConcurrencyIndex());
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
			maxConcurrency++;
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
		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 other) {
 | 
					 | 
				
			||||||
		return(other instanceof TxStream && this.getId()==other.getId());
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
@@ -1,8 +0,0 @@
 | 
				
			|||||||
<?xml version="1.0" encoding="UTF-8"?>
 | 
					 | 
				
			||||||
<classpath>
 | 
					 | 
				
			||||||
	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
 | 
					 | 
				
			||||||
	<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
 | 
					 | 
				
			||||||
	<classpathentry kind="src" path="src"/>
 | 
					 | 
				
			||||||
	<classpathentry exported="true" kind="lib" path="sqlite-jdbc-3.8.7.jar"/>
 | 
					 | 
				
			||||||
	<classpathentry kind="output" path="target/classes"/>
 | 
					 | 
				
			||||||
</classpath>
 | 
					 | 
				
			||||||
@@ -1,7 +0,0 @@
 | 
				
			|||||||
eclipse.preferences.version=1
 | 
					 | 
				
			||||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
 | 
					 | 
				
			||||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
 | 
					 | 
				
			||||||
org.eclipse.jdt.core.compiler.compliance=1.8
 | 
					 | 
				
			||||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
 | 
					 | 
				
			||||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
 | 
					 | 
				
			||||||
org.eclipse.jdt.core.compiler.source=1.8
 | 
					 | 
				
			||||||
@@ -1,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;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
@@ -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.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()) {
 | 
					 | 
				
			||||||
					if(maxConcurrency==null) maxConcurrency=0;
 | 
					 | 
				
			||||||
					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 other) {
 | 
					 | 
				
			||||||
		return(other instanceof TxStream && this.getId()==other.getId());
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
@@ -1,7 +0,0 @@
 | 
				
			|||||||
<?xml version="1.0" encoding="UTF-8"?>
 | 
					 | 
				
			||||||
<classpath>
 | 
					 | 
				
			||||||
	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
 | 
					 | 
				
			||||||
	<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
 | 
					 | 
				
			||||||
	<classpathentry kind="src" path="src"/>
 | 
					 | 
				
			||||||
	<classpathentry kind="output" path="target/classes"/>
 | 
					 | 
				
			||||||
</classpath>
 | 
					 | 
				
			||||||
@@ -1,3 +0,0 @@
 | 
				
			|||||||
eclipse.preferences.version=1
 | 
					 | 
				
			||||||
encoding//src/com/minres/scviewer/database/test/DatabaseServicesTest.java=UTF-8
 | 
					 | 
				
			||||||
encoding/<project>=UTF-8
 | 
					 | 
				
			||||||
@@ -1,8 +0,0 @@
 | 
				
			|||||||
eclipse.preferences.version=1
 | 
					 | 
				
			||||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
 | 
					 | 
				
			||||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
 | 
					 | 
				
			||||||
org.eclipse.jdt.core.compiler.compliance=1.8
 | 
					 | 
				
			||||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
 | 
					 | 
				
			||||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
 | 
					 | 
				
			||||||
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
 | 
					 | 
				
			||||||
org.eclipse.jdt.core.compiler.source=1.8
 | 
					 | 
				
			||||||
@@ -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="true"/>
 | 
					 | 
				
			||||||
<stringAttribute key="deselected_workspace_plugins" value="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"/>
 | 
					 | 
				
			||||||
</listAttribute>
 | 
					 | 
				
			||||||
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
 | 
					 | 
				
			||||||
<listEntry value="4"/>
 | 
					 | 
				
			||||||
</listAttribute>
 | 
					 | 
				
			||||||
<stringAttribute key="org.eclipse.jdt.junit.CONTAINER" value="=com.minres.scviewer.database.test"/>
 | 
					 | 
				
			||||||
<booleanAttribute key="org.eclipse.jdt.junit.KEEPRUNNING_ATTR" value="false"/>
 | 
					 | 
				
			||||||
<stringAttribute key="org.eclipse.jdt.junit.TESTNAME" value=""/>
 | 
					 | 
				
			||||||
<stringAttribute key="org.eclipse.jdt.junit.TEST_KIND" value="org.eclipse.jdt.junit.loader.junit4"/>
 | 
					 | 
				
			||||||
<booleanAttribute key="org.eclipse.jdt.launching.ATTR_USE_START_ON_FIRST_THREAD" value="true"/>
 | 
					 | 
				
			||||||
<stringAttribute key="org.eclipse.jdt.launching.JRE_CONTAINER" value="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
 | 
					 | 
				
			||||||
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value=""/>
 | 
					 | 
				
			||||||
<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-os ${target.os} -ws ${target.ws} -arch ${target.arch} -nl ${target.nl} -consoleLog"/>
 | 
					 | 
				
			||||||
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="com.minres.scviewer.database.test"/>
 | 
					 | 
				
			||||||
<stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.pde.ui.workbenchClasspathProvider"/>
 | 
					 | 
				
			||||||
<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Xms40m -Xmx512m"/>
 | 
					 | 
				
			||||||
<stringAttribute key="pde.version" value="3.3"/>
 | 
					 | 
				
			||||||
<stringAttribute key="product" value="com.minres.scviewer.e4.product"/>
 | 
					 | 
				
			||||||
<booleanAttribute key="run_in_ui_thread" value="true"/>
 | 
					 | 
				
			||||||
<stringAttribute key="selected_target_plugins" value="com.google.guava@default:default,javax.annotation@default:default,javax.inject@default:default,javax.servlet@default:default,org.apache.ant@default:default,org.apache.commons.jxpath@default:default,org.apache.felix.gogo.command@default:default,org.apache.felix.gogo.runtime@default:default,org.codehaus.groovy@default:default,org.eclipse.ant.core@default:default,org.eclipse.core.commands@default:default,org.eclipse.core.contenttype@default:default,org.eclipse.core.expressions@default:default,org.eclipse.core.filesystem.macosx@default:false,org.eclipse.core.filesystem@default:default,org.eclipse.core.jobs@default:default,org.eclipse.core.resources@default:default,org.eclipse.core.runtime@default:true,org.eclipse.core.variables@default:default,org.eclipse.e4.core.contexts@default:default,org.eclipse.e4.core.di.annotations@default:default,org.eclipse.e4.core.di.extensions@default:default,org.eclipse.e4.core.di@default:default,org.eclipse.e4.core.services@default:default,org.eclipse.e4.emf.xpath@default:default,org.eclipse.e4.ui.di@default:default,org.eclipse.e4.ui.model.workbench@default:default,org.eclipse.e4.ui.services@default:default,org.eclipse.emf.common@default:default,org.eclipse.emf.ecore@default:default,org.eclipse.equinox.app@default:default,org.eclipse.equinox.bidi@default:default,org.eclipse.equinox.common@2:true,org.eclipse.equinox.ds@1:true,org.eclipse.equinox.preferences@default:default,org.eclipse.equinox.registry@default:default,org.eclipse.equinox.util@default:default,org.eclipse.jface@default:default,org.eclipse.osgi.compatibility.state@default:false,org.eclipse.osgi.services@default:default,org.eclipse.osgi@-1:true,org.eclipse.swt.cocoa.macosx.x86_64@default:false,org.eclipse.swt@default:default,org.hamcrest.core@default:default,org.junit@default:default"/>
 | 
					 | 
				
			||||||
<stringAttribute key="selected_workspace_plugins" value="com.minres.scviewer.database.sqlite@default:true,com.minres.scviewer.database.test@default:default,com.minres.scviewer.database.text@default:true,com.minres.scviewer.database.ui.swt@default:default,com.minres.scviewer.database.ui@default:default,com.minres.scviewer.database.vcd@default:default,com.minres.scviewer.database@default:true,com.opcoach.e4.preferences@default:default"/>
 | 
					 | 
				
			||||||
<booleanAttribute key="show_selected_only" value="false"/>
 | 
					 | 
				
			||||||
<booleanAttribute key="tracing" value="false"/>
 | 
					 | 
				
			||||||
<booleanAttribute key="useCustomFeatures" value="false"/>
 | 
					 | 
				
			||||||
<booleanAttribute key="useDefaultConfig" value="true"/>
 | 
					 | 
				
			||||||
<booleanAttribute key="useDefaultConfigArea" value="false"/>
 | 
					 | 
				
			||||||
<booleanAttribute key="useProduct" value="false"/>
 | 
					 | 
				
			||||||
</launchConfiguration>
 | 
					 | 
				
			||||||
@@ -1,2 +0,0 @@
 | 
				
			|||||||
/.scviewer.*
 | 
					 | 
				
			||||||
/.my_db.txlog*
 | 
					 | 
				
			||||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							@@ -1 +0,0 @@
 | 
				
			|||||||
MANIFEST-000045
 | 
					 | 
				
			||||||
@@ -1 +0,0 @@
 | 
				
			|||||||
2018/11/03-15:38:59.715484 139851522529088Delete type=3 #1
 | 
					 | 
				
			||||||
										
											Binary file not shown.
										
									
								
							@@ -1,147 +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 java.util.List;
 | 
					 | 
				
			||||||
import java.util.Map.Entry;
 | 
					 | 
				
			||||||
import java.util.NavigableMap;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
import org.junit.After;
 | 
					 | 
				
			||||||
import org.junit.Before;
 | 
					 | 
				
			||||||
import org.junit.Test;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
import com.minres.scviewer.database.AssociationType;
 | 
					 | 
				
			||||||
import com.minres.scviewer.database.DataType;
 | 
					 | 
				
			||||||
import com.minres.scviewer.database.ISignal;
 | 
					 | 
				
			||||||
import com.minres.scviewer.database.ITx;
 | 
					 | 
				
			||||||
import com.minres.scviewer.database.ITxAttribute;
 | 
					 | 
				
			||||||
import com.minres.scviewer.database.ITxEvent;
 | 
					 | 
				
			||||||
import com.minres.scviewer.database.ITxEvent.Type;
 | 
					 | 
				
			||||||
import com.minres.scviewer.database.ITxStream;
 | 
					 | 
				
			||||||
import com.minres.scviewer.database.IWaveform;
 | 
					 | 
				
			||||||
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();
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	@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);
 | 
					 | 
				
			||||||
		List<IWaveform> waves= waveformDb.getAllWaves();
 | 
					 | 
				
			||||||
		assertEquals(14,  waves.size());
 | 
					 | 
				
			||||||
		assertEquals(2,  waveformDb.getChildNodes().size());
 | 
					 | 
				
			||||||
		IWaveform bus_data_wave = waves.get(0);
 | 
					 | 
				
			||||||
		ISignal<?> bus_data_sig = (ISignal<?>) bus_data_wave;
 | 
					 | 
				
			||||||
		Entry<Long, ?> bus_data_entry = bus_data_sig.getEvents().floorEntry(1400000000L);
 | 
					 | 
				
			||||||
		assertTrue("01111000".equals(bus_data_entry.getValue().toString()));
 | 
					 | 
				
			||||||
		IWaveform rw_wave = waves.get(2);
 | 
					 | 
				
			||||||
		ISignal<?> rw_sig = (ISignal<?>) rw_wave;
 | 
					 | 
				
			||||||
		Entry<Long, ?> rw_entry = rw_sig.getEvents().floorEntry(2360000000L);
 | 
					 | 
				
			||||||
		assertTrue("1".equals(rw_entry.getValue().toString()));
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	@Test
 | 
					 | 
				
			||||||
	public void testTxSQLite() throws Exception {
 | 
					 | 
				
			||||||
		File f = new File("inputs/my_sqldb.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());
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	//@Test
 | 
					 | 
				
			||||||
	public void testTxLDb() throws Exception {
 | 
					 | 
				
			||||||
		File f = new File("inputs/my_ldb.txldb").getAbsoluteFile();
 | 
					 | 
				
			||||||
		assertTrue(f.exists());
 | 
					 | 
				
			||||||
		waveformDb.load(f);
 | 
					 | 
				
			||||||
		assertNotNull(waveformDb);
 | 
					 | 
				
			||||||
		assertEquals(1,  waveformDb.getChildNodes().size());
 | 
					 | 
				
			||||||
		List<IWaveform> waves = waveformDb.getAllWaves();
 | 
					 | 
				
			||||||
		assertEquals(3,  waves.size());
 | 
					 | 
				
			||||||
		IWaveform wave = waves.get(0);
 | 
					 | 
				
			||||||
		assertTrue(wave instanceof ITxStream<?>);
 | 
					 | 
				
			||||||
		ITxStream<?> stream = (ITxStream<?>) wave;
 | 
					 | 
				
			||||||
		assertEquals(2,  stream.getGenerators().size());
 | 
					 | 
				
			||||||
		NavigableMap<Long, List<ITxEvent>> eventsList = stream.getEvents();
 | 
					 | 
				
			||||||
		assertEquals(27, eventsList.size());
 | 
					 | 
				
			||||||
		Entry<Long, List<ITxEvent>> eventEntry = eventsList.firstEntry();
 | 
					 | 
				
			||||||
		assertEquals(100000000L, (long) eventEntry.getKey());
 | 
					 | 
				
			||||||
		List<ITxEvent> events = eventEntry.getValue();
 | 
					 | 
				
			||||||
		assertEquals(1, events.size());
 | 
					 | 
				
			||||||
		ITxEvent event = events.get(0);
 | 
					 | 
				
			||||||
		assertEquals(Type.BEGIN, event.getType());
 | 
					 | 
				
			||||||
		ITx tx = event.getTransaction();
 | 
					 | 
				
			||||||
		assertEquals(3L,  (long) tx.getId());
 | 
					 | 
				
			||||||
		List<ITxAttribute> attrs = tx.getAttributes();
 | 
					 | 
				
			||||||
		assertEquals(1, attrs.size());
 | 
					 | 
				
			||||||
		ITxAttribute attr = attrs.get(0);
 | 
					 | 
				
			||||||
		assertEquals("data", attr.getName());
 | 
					 | 
				
			||||||
		assertEquals(DataType.UNSIGNED, attr.getDataType());
 | 
					 | 
				
			||||||
		assertEquals(AssociationType.END, attr.getType());
 | 
					 | 
				
			||||||
		assertTrue(attr.getValue() instanceof Integer);
 | 
					 | 
				
			||||||
		assertEquals(0, (int) attr.getValue());
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	@Test
 | 
					 | 
				
			||||||
	public void testHierarchicalVCD() throws Exception {
 | 
					 | 
				
			||||||
		File f = new File("inputs/simple_system.vcd").getAbsoluteFile();
 | 
					 | 
				
			||||||
		assertTrue(f.exists());
 | 
					 | 
				
			||||||
		waveformDb.load(f);
 | 
					 | 
				
			||||||
		assertNotNull(waveformDb);
 | 
					 | 
				
			||||||
		assertEquals(779,  waveformDb.getAllWaves().size());
 | 
					 | 
				
			||||||
		assertEquals(1,  waveformDb.getChildNodes().size());
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
@@ -1,8 +0,0 @@
 | 
				
			|||||||
eclipse.preferences.version=1
 | 
					 | 
				
			||||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
 | 
					 | 
				
			||||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
 | 
					 | 
				
			||||||
org.eclipse.jdt.core.compiler.compliance=1.8
 | 
					 | 
				
			||||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
 | 
					 | 
				
			||||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
 | 
					 | 
				
			||||||
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
 | 
					 | 
				
			||||||
org.eclipse.jdt.core.compiler.source=1.8
 | 
					 | 
				
			||||||
@@ -1,25 +0,0 @@
 | 
				
			|||||||
Manifest-Version: 1.0
 | 
					 | 
				
			||||||
Bundle-ManifestVersion: 2
 | 
					 | 
				
			||||||
Bundle-Name: Textual transaction database
 | 
					 | 
				
			||||||
Bundle-SymbolicName: com.minres.scviewer.database.text
 | 
					 | 
				
			||||||
Bundle-Version: 2.0.0.qualifier
 | 
					 | 
				
			||||||
Bundle-Vendor: MINRES Technologies GmbH
 | 
					 | 
				
			||||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
 | 
					 | 
				
			||||||
Import-Package: org.osgi.framework;version="1.3.0"
 | 
					 | 
				
			||||||
Require-Bundle: com.minres.scviewer.database;bundle-version="1.0.0",
 | 
					 | 
				
			||||||
 org.codehaus.groovy;bundle-version="1.8.6",
 | 
					 | 
				
			||||||
 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
 | 
					 | 
				
			||||||
Automatic-Module-Name: com.minres.scviewer.database.text
 | 
					 | 
				
			||||||
Bundle-ClassPath: lib/mapdb-3.0.7.jar,
 | 
					 | 
				
			||||||
 .,
 | 
					 | 
				
			||||||
 lib/eclipse-collections-9.2.0.jar,
 | 
					 | 
				
			||||||
 lib/eclipse-collections-api-9.2.0.jar,
 | 
					 | 
				
			||||||
 lib/eclipse-collections-forkjoin-9.2.0.jar,
 | 
					 | 
				
			||||||
 lib/kotlin-stdlib-1.2.42.jar,
 | 
					 | 
				
			||||||
 lib/lz4-1.3.0.jar,
 | 
					 | 
				
			||||||
 lib/elsa-3.0.0-M5.jar
 | 
					 | 
				
			||||||
										
											Binary file not shown.
										
									
								
							
										
											Binary file not shown.
										
									
								
							@@ -1,44 +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>
 | 
					 | 
				
			||||||
	<version>2.0.0-SNAPSHOT</version>
 | 
					 | 
				
			||||||
	<parent>
 | 
					 | 
				
			||||||
		<groupId>com.minres.scviewer</groupId>
 | 
					 | 
				
			||||||
		<artifactId>com.minres.scviewer.parent</artifactId>
 | 
					 | 
				
			||||||
		<version>2.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>
 | 
					 | 
				
			||||||
        		<version>0.23.1</version>
 | 
					 | 
				
			||||||
				<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>
 | 
					 | 
				
			||||||
</project>
 | 
					 | 
				
			||||||
@@ -1,226 +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.nio.charset.CharsetDecoder;
 | 
					 | 
				
			||||||
import java.util.Collection;
 | 
					 | 
				
			||||||
import java.util.zip.GZIPInputStream
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
import org.codehaus.groovy.ast.stmt.CatchStatement
 | 
					 | 
				
			||||||
import org.mapdb.DB
 | 
					 | 
				
			||||||
import org.mapdb.DBMaker
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
import groovy.io.FileType
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
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=[:]
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	DB mapDb
 | 
					 | 
				
			||||||
	
 | 
					 | 
				
			||||||
	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=[]
 | 
					 | 
				
			||||||
		try {
 | 
					 | 
				
			||||||
			def gzipped = isGzipped(file)
 | 
					 | 
				
			||||||
			if(isTxfile(gzipped?new GZIPInputStream(new FileInputStream(file)):new FileInputStream(file))){
 | 
					 | 
				
			||||||
				def mapDbFile = File.createTempFile("."+file.name, "tmp", file.parentFile)
 | 
					 | 
				
			||||||
				mapDbFile.delete()
 | 
					 | 
				
			||||||
				mapDbFile.deleteOnExit()
 | 
					 | 
				
			||||||
				this.mapDb = DBMaker
 | 
					 | 
				
			||||||
				.fileDB(mapDbFile)
 | 
					 | 
				
			||||||
				.fileMmapEnableIfSupported()
 | 
					 | 
				
			||||||
				.fileMmapPreclearDisable()
 | 
					 | 
				
			||||||
				.cleanerHackEnable()
 | 
					 | 
				
			||||||
				.allocateStartSize(64*1024*1024)
 | 
					 | 
				
			||||||
				.allocateIncrement(64*1024*1024)
 | 
					 | 
				
			||||||
				.make()
 | 
					 | 
				
			||||||
				parseInput(gzipped?new GZIPInputStream(new FileInputStream(file)):new FileInputStream(file))
 | 
					 | 
				
			||||||
				calculateConcurrencyIndicees()
 | 
					 | 
				
			||||||
				return true
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
		} catch(EOFException e) {
 | 
					 | 
				
			||||||
			return true;
 | 
					 | 
				
			||||||
		} catch(Exception e) {
 | 
					 | 
				
			||||||
			e.printStackTrace()
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
		return false;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	private static boolean isTxfile(InputStream istream) {
 | 
					 | 
				
			||||||
		byte[] buffer = new byte[x.size()]
 | 
					 | 
				
			||||||
		def readCnt = istream.read(buffer, 0, x.size())
 | 
					 | 
				
			||||||
		istream.close()
 | 
					 | 
				
			||||||
		if(readCnt==x.size()){
 | 
					 | 
				
			||||||
			for(int i=0; i<x.size(); i++)
 | 
					 | 
				
			||||||
				if(buffer[i]!=x[i]) return false
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
		return true
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	private static boolean isGzipped(File f) {
 | 
					 | 
				
			||||||
		InputStream is = null;
 | 
					 | 
				
			||||||
		try {
 | 
					 | 
				
			||||||
			is = new FileInputStream(f);
 | 
					 | 
				
			||||||
			byte [] signature = new byte[2];
 | 
					 | 
				
			||||||
			int nread = is.read( signature ); //read the gzip signature
 | 
					 | 
				
			||||||
			return nread == 2 && signature[ 0 ] == (byte) 0x1f && signature[ 1 ] == (byte) 0x8b;
 | 
					 | 
				
			||||||
		} catch (IOException e) {
 | 
					 | 
				
			||||||
			return false;
 | 
					 | 
				
			||||||
		} finally {
 | 
					 | 
				
			||||||
			is.close()
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	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(InputStream inputStream){
 | 
					 | 
				
			||||||
		def streamsById = [:]
 | 
					 | 
				
			||||||
		def generatorsById = [:]
 | 
					 | 
				
			||||||
		def transactionsById = [:]
 | 
					 | 
				
			||||||
		TxGenerator generator
 | 
					 | 
				
			||||||
		Tx transaction
 | 
					 | 
				
			||||||
		boolean endTransaction=false
 | 
					 | 
				
			||||||
		def matcher
 | 
					 | 
				
			||||||
		BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream, "UTF-8"));
 | 
					 | 
				
			||||||
		long lineCnt=0;
 | 
					 | 
				
			||||||
		reader.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(this, 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[transaction.generator.end_attrs_idx], tokens[1])
 | 
					 | 
				
			||||||
						transaction.generator.end_attrs_idx++
 | 
					 | 
				
			||||||
					} else {
 | 
					 | 
				
			||||||
						transaction.attributes << new TxAttribute(transaction.generator.begin_attrs[transaction.generator.begin_attrs_idx], tokens[1])
 | 
					 | 
				
			||||||
						transaction.generator.begin_attrs_idx++
 | 
					 | 
				
			||||||
					}
 | 
					 | 
				
			||||||
					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'"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
			lineCnt++
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	private def calculateConcurrencyIndicees(){
 | 
					 | 
				
			||||||
		streams.each{ TxStream  stream -> stream.getMaxConcurrency() }
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	public Collection<RelationType> getAllRelationTypes(){
 | 
					 | 
				
			||||||
		return relationTypes.values();
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
@@ -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]";
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
@@ -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;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
@@ -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
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
@@ -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
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
@@ -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;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
@@ -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};
 | 
					 | 
				
			||||||
	
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
@@ -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;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
@@ -1,119 +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 org.mapdb.Serializer
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
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(TextDbLoader loader, int id, String name, String kind){
 | 
					 | 
				
			||||||
		super(name)
 | 
					 | 
				
			||||||
		this.id=id
 | 
					 | 
				
			||||||
		this.database=loader.db
 | 
					 | 
				
			||||||
		this.fullName=name
 | 
					 | 
				
			||||||
		this.kind=kind
 | 
					 | 
				
			||||||
		this.maxConcurrency=0
 | 
					 | 
				
			||||||
		//events = new TreeMap<Long, List<ITxEvent>>()
 | 
					 | 
				
			||||||
		events = loader.mapDb.treeMap(name).keySerializer(Serializer.LONG).createOrOpen();
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	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 other) {
 | 
					 | 
				
			||||||
		return(other instanceof TxStream && this.getId()==other.getId());
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
@@ -1,7 +0,0 @@
 | 
				
			|||||||
<?xml version="1.0" encoding="UTF-8"?>
 | 
					 | 
				
			||||||
<classpath>
 | 
					 | 
				
			||||||
	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
 | 
					 | 
				
			||||||
	<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
 | 
					 | 
				
			||||||
	<classpathentry kind="src" path="src"/>
 | 
					 | 
				
			||||||
	<classpathentry kind="output" path="target/classes"/>
 | 
					 | 
				
			||||||
</classpath>
 | 
					 | 
				
			||||||
@@ -1,20 +0,0 @@
 | 
				
			|||||||
Manifest-Version: 1.0
 | 
					 | 
				
			||||||
Bundle-ManifestVersion: 2
 | 
					 | 
				
			||||||
Bundle-Name: SWT widget
 | 
					 | 
				
			||||||
Bundle-SymbolicName: com.minres.scviewer.database.ui.swt
 | 
					 | 
				
			||||||
Bundle-Version: 2.0.0.qualifier
 | 
					 | 
				
			||||||
Bundle-Vendor: MINRES Technologies GmbH
 | 
					 | 
				
			||||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
 | 
					 | 
				
			||||||
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
 | 
					 | 
				
			||||||
Automatic-Module-Name: com.minres.scviewer.database.ui.swt
 | 
					 | 
				
			||||||
@@ -1,9 +0,0 @@
 | 
				
			|||||||
package com.minres.scviewer.database.swt;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
public class Constants {
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	public final static String[] unitString={"fs", "ps", "ns", "us", "ms"};//, "s"};
 | 
					 | 
				
			||||||
    
 | 
					 | 
				
			||||||
    public final static int[] unitMultiplier={1, 3, 10, 30, 100, 300};
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
@@ -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;
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
@@ -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.database.swt.internal;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
import java.text.DecimalFormat;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
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;
 | 
					 | 
				
			||||||
       
 | 
					 | 
				
			||||||
	static final DecimalFormat df = new DecimalFormat("#.00####"); 
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    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;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        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(df.format(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);
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
        
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
@@ -1,420 +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.Map.Entry;
 | 
					 | 
				
			||||||
import java.util.NavigableMap;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
import javax.swing.JPanel;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
import org.eclipse.swt.SWT;
 | 
					 | 
				
			||||||
import org.eclipse.swt.graphics.Color;
 | 
					 | 
				
			||||||
import org.eclipse.swt.graphics.FontData;
 | 
					 | 
				
			||||||
import org.eclipse.swt.graphics.GC;
 | 
					 | 
				
			||||||
import org.eclipse.swt.graphics.Point;
 | 
					 | 
				
			||||||
import org.eclipse.swt.graphics.Rectangle;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
import com.minres.scviewer.database.BitVector;
 | 
					 | 
				
			||||||
import com.minres.scviewer.database.ISignal;
 | 
					 | 
				
			||||||
import com.minres.scviewer.database.ui.TrackEntry;
 | 
					 | 
				
			||||||
import com.minres.scviewer.database.ui.WaveformColors;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
public class SignalPainter extends TrackPainter {
 | 
					 | 
				
			||||||
	private class SignalChange {
 | 
					 | 
				
			||||||
		long time;
 | 
					 | 
				
			||||||
		Object value;
 | 
					 | 
				
			||||||
		boolean fromMap;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		public SignalChange(Entry<Long, ?> entry) {
 | 
					 | 
				
			||||||
			time = entry.getKey();
 | 
					 | 
				
			||||||
			value = entry.getValue();
 | 
					 | 
				
			||||||
			fromMap = true;
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		public void set(Entry<Long, ?> entry, Long actTime) {
 | 
					 | 
				
			||||||
			if (entry != null) {
 | 
					 | 
				
			||||||
				time = entry.getKey();
 | 
					 | 
				
			||||||
				value = entry.getValue();
 | 
					 | 
				
			||||||
				fromMap = true;
 | 
					 | 
				
			||||||
			} else {
 | 
					 | 
				
			||||||
				time = actTime;
 | 
					 | 
				
			||||||
				fromMap = false;
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		public void assign(SignalChange other) {
 | 
					 | 
				
			||||||
			time = other.time;
 | 
					 | 
				
			||||||
			value = other.value;
 | 
					 | 
				
			||||||
			fromMap = other.fromMap;
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	/**
 | 
					 | 
				
			||||||
	 * 
 | 
					 | 
				
			||||||
	 */
 | 
					 | 
				
			||||||
	private static final JPanel DUMMY_PANEL = new JPanel();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	private final WaveformCanvas waveCanvas;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	int yOffsetT;
 | 
					 | 
				
			||||||
	int yOffsetM;
 | 
					 | 
				
			||||||
	int yOffsetB;
 | 
					 | 
				
			||||||
	int maxX;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	public SignalPainter(WaveformCanvas txDisplay, boolean even, TrackEntry trackEntry) {
 | 
					 | 
				
			||||||
		super(trackEntry, even);
 | 
					 | 
				
			||||||
		this.waveCanvas = txDisplay;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	private int getXEnd(long time) {
 | 
					 | 
				
			||||||
		long ltmp = time / this.waveCanvas.getScaleFactor();
 | 
					 | 
				
			||||||
		return ltmp > maxX ? maxX : (int) ltmp;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	public void paintArea(GC gc, Rectangle area) {
 | 
					 | 
				
			||||||
		ISignal<?> signal = trackEntry.getSignal();
 | 
					 | 
				
			||||||
		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);
 | 
					 | 
				
			||||||
		long beginTime = area.x * this.waveCanvas.getScaleFactor();
 | 
					 | 
				
			||||||
		long endTime = (area.x + area.width) * this.waveCanvas.getScaleFactor();
 | 
					 | 
				
			||||||
		Entry<Long, ?> first = signal.getEvents().floorEntry(beginTime);
 | 
					 | 
				
			||||||
		Entry<Long, ?> last = signal.getEvents().floorEntry(endTime);
 | 
					 | 
				
			||||||
		if (first == null) {
 | 
					 | 
				
			||||||
			if (last == null)
 | 
					 | 
				
			||||||
				return;
 | 
					 | 
				
			||||||
			first = signal.getEvents().firstEntry();
 | 
					 | 
				
			||||||
		} else if (last == null) {
 | 
					 | 
				
			||||||
			last = signal.getEvents().lastEntry();
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
		gc.setForeground(this.waveCanvas.colors[WaveformColors.LINE.ordinal()]);
 | 
					 | 
				
			||||||
		gc.setLineStyle(SWT.LINE_SOLID);
 | 
					 | 
				
			||||||
		gc.setLineWidth(1);
 | 
					 | 
				
			||||||
		NavigableMap<Long, ?> entries = signal.getEvents().subMap(first.getKey(), false, last.getKey(), true);
 | 
					 | 
				
			||||||
		SignalChange left = new SignalChange(first);
 | 
					 | 
				
			||||||
		SignalChange right = new SignalChange(entries.size() > 0 ? entries.firstEntry() : first);
 | 
					 | 
				
			||||||
		maxX = area.x + area.width;
 | 
					 | 
				
			||||||
		yOffsetT = this.waveCanvas.getTrackHeight() / 5 + area.y;
 | 
					 | 
				
			||||||
		yOffsetM = this.waveCanvas.getTrackHeight() / 2 + area.y;
 | 
					 | 
				
			||||||
		yOffsetB = 4 * this.waveCanvas.getTrackHeight() / 5 + area.y;
 | 
					 | 
				
			||||||
		int xBegin = Math.max(area.x, (int) (left.time / this.waveCanvas.getScaleFactor()));
 | 
					 | 
				
			||||||
		int xEnd = Math.max(area.x, getXEnd(right.time));
 | 
					 | 
				
			||||||
		boolean multiple = false;
 | 
					 | 
				
			||||||
		if (xEnd == xBegin) {
 | 
					 | 
				
			||||||
			// this can trigger if
 | 
					 | 
				
			||||||
			// a) left == right
 | 
					 | 
				
			||||||
			// b) left to close to right
 | 
					 | 
				
			||||||
			if (left.time == right.time) {
 | 
					 | 
				
			||||||
				right.time = endTime;
 | 
					 | 
				
			||||||
			} else {
 | 
					 | 
				
			||||||
				multiple = true;
 | 
					 | 
				
			||||||
				long eTime = (xBegin + 1) * this.waveCanvas.getScaleFactor();
 | 
					 | 
				
			||||||
				right.set(entries.floorEntry(eTime), endTime);
 | 
					 | 
				
			||||||
				right.time = eTime;
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
			xEnd = getXEnd(right.time);
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		SignalStencil stencil = getStencil(gc, left, entries);
 | 
					 | 
				
			||||||
		do {
 | 
					 | 
				
			||||||
			stencil.draw(gc, area, left.value, right.value, xBegin, xEnd, multiple);
 | 
					 | 
				
			||||||
			if (right.time >= endTime)
 | 
					 | 
				
			||||||
				break;
 | 
					 | 
				
			||||||
			left.assign(right);
 | 
					 | 
				
			||||||
			xBegin = xEnd;
 | 
					 | 
				
			||||||
			right.set(entries.higherEntry(left.time), endTime);
 | 
					 | 
				
			||||||
			xEnd = getXEnd(right.time);
 | 
					 | 
				
			||||||
			multiple = false;
 | 
					 | 
				
			||||||
			if (xEnd == xBegin) {
 | 
					 | 
				
			||||||
				multiple = true;
 | 
					 | 
				
			||||||
				long eTime = (xBegin + 1) * this.waveCanvas.getScaleFactor();
 | 
					 | 
				
			||||||
				Entry<Long, ?> entry = entries.floorEntry(eTime);
 | 
					 | 
				
			||||||
				if(entry!=null && entry.getKey()> right.time)
 | 
					 | 
				
			||||||
					right.set(entry, endTime);
 | 
					 | 
				
			||||||
				xEnd = getXEnd(eTime);
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
		} while (left.time < endTime);
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	private SignalStencil getStencil(GC gc, SignalChange left, NavigableMap<Long, ?> entries) {
 | 
					 | 
				
			||||||
		Object val = left.value;
 | 
					 | 
				
			||||||
		if(val instanceof BitVector) {
 | 
					 | 
				
			||||||
			BitVector bv = (BitVector) val;
 | 
					 | 
				
			||||||
			if(bv.getWidth()==1)
 | 
					 | 
				
			||||||
				return new SingleBitStencil();				
 | 
					 | 
				
			||||||
			if(trackEntry.waveDisplay==TrackEntry.WaveDisplay.DEFAULT)
 | 
					 | 
				
			||||||
				return new MultiBitStencil(gc);
 | 
					 | 
				
			||||||
			else
 | 
					 | 
				
			||||||
				return new MultiBitStencilAnalog(entries, left.value, 
 | 
					 | 
				
			||||||
						trackEntry.waveDisplay==TrackEntry.WaveDisplay.CONTINOUS,
 | 
					 | 
				
			||||||
						trackEntry.valueDisplay==TrackEntry.ValueDisplay.SIGNED);
 | 
					 | 
				
			||||||
		} else if (val instanceof Double)
 | 
					 | 
				
			||||||
			return new RealStencil(entries, left.value, trackEntry.waveDisplay==TrackEntry.WaveDisplay.CONTINOUS);
 | 
					 | 
				
			||||||
		else
 | 
					 | 
				
			||||||
			return null;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	private interface SignalStencil {
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		public void draw(GC gc, Rectangle area, Object left, Object right, int xBegin, int xEnd, boolean multiple);
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	private class MultiBitStencil implements SignalStencil {
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		private java.awt.Font tmpAwtFont;
 | 
					 | 
				
			||||||
		private int height;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		public MultiBitStencil(GC gc) {
 | 
					 | 
				
			||||||
			FontData fd = gc.getFont().getFontData()[0];
 | 
					 | 
				
			||||||
			height = gc.getDevice().getDPI().y * fd.getHeight() / 72;
 | 
					 | 
				
			||||||
			tmpAwtFont = new java.awt.Font(fd.getName(), fd.getStyle(), height);
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		public void draw(GC gc, Rectangle area, Object left, Object right, int xBegin, int xEnd, boolean multiple) {
 | 
					 | 
				
			||||||
			Color colorBorder = waveCanvas.colors[WaveformColors.SIGNAL0.ordinal()];
 | 
					 | 
				
			||||||
			BitVector last = (BitVector) left;
 | 
					 | 
				
			||||||
			if (last.getValue().toString().contains("X")) {
 | 
					 | 
				
			||||||
				colorBorder = waveCanvas.colors[WaveformColors.SIGNALX.ordinal()];
 | 
					 | 
				
			||||||
			} else if (last.getValue().toString().contains("Z")) {
 | 
					 | 
				
			||||||
				colorBorder = waveCanvas.colors[WaveformColors.SIGNALZ.ordinal()];
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
			int width = xEnd - xBegin;
 | 
					 | 
				
			||||||
			if (width > 1) {
 | 
					 | 
				
			||||||
				int[] points = { 
 | 
					 | 
				
			||||||
						xBegin,     yOffsetM, 
 | 
					 | 
				
			||||||
						xBegin + 1, yOffsetT, 
 | 
					 | 
				
			||||||
						xEnd - 1,   yOffsetT, 
 | 
					 | 
				
			||||||
						xEnd,       yOffsetM, 
 | 
					 | 
				
			||||||
						xEnd - 1,   yOffsetB, 
 | 
					 | 
				
			||||||
						xBegin + 1, yOffsetB
 | 
					 | 
				
			||||||
				};
 | 
					 | 
				
			||||||
				gc.setForeground(colorBorder);
 | 
					 | 
				
			||||||
				gc.drawPolygon(points);
 | 
					 | 
				
			||||||
				gc.setForeground(waveCanvas.colors[WaveformColors.SIGNAL_TEXT.ordinal()]);
 | 
					 | 
				
			||||||
				//TODO: this code should be provided from a central location
 | 
					 | 
				
			||||||
				String label = null;
 | 
					 | 
				
			||||||
				switch(trackEntry.valueDisplay) {
 | 
					 | 
				
			||||||
				case SIGNED:
 | 
					 | 
				
			||||||
					label=Long.toString(last.toSignedValue());
 | 
					 | 
				
			||||||
					break;
 | 
					 | 
				
			||||||
				case UNSIGNED:
 | 
					 | 
				
			||||||
					label=Long.toString(last.toUnsignedValue());
 | 
					 | 
				
			||||||
					break;
 | 
					 | 
				
			||||||
				default:
 | 
					 | 
				
			||||||
					label="h'"+last.toHexString();
 | 
					 | 
				
			||||||
				}
 | 
					 | 
				
			||||||
				Point bb = getBoxWidth(gc, label);
 | 
					 | 
				
			||||||
				if (xBegin < area.x) {
 | 
					 | 
				
			||||||
					xBegin = area.x;
 | 
					 | 
				
			||||||
					width = xEnd - xBegin;
 | 
					 | 
				
			||||||
				}
 | 
					 | 
				
			||||||
				if (width > (bb.x+1)) {
 | 
					 | 
				
			||||||
					Rectangle old = gc.getClipping();
 | 
					 | 
				
			||||||
					gc.setClipping(xBegin + 3, yOffsetT, xEnd - xBegin - 5, yOffsetB - yOffsetT);
 | 
					 | 
				
			||||||
					gc.drawText(label, xBegin + 3, yOffsetM - bb.y / 2 - 1);
 | 
					 | 
				
			||||||
					gc.setClipping(old);
 | 
					 | 
				
			||||||
				}
 | 
					 | 
				
			||||||
			} else {
 | 
					 | 
				
			||||||
				gc.setForeground(colorBorder);
 | 
					 | 
				
			||||||
				gc.drawLine(xEnd, yOffsetT, xEnd, yOffsetB);
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		private Point getBoxWidth(GC gc, String label) {
 | 
					 | 
				
			||||||
			return new Point(DUMMY_PANEL.getFontMetrics(tmpAwtFont).stringWidth(label), height);
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	private class MultiBitStencilAnalog implements SignalStencil {
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		final boolean continous;
 | 
					 | 
				
			||||||
		private long minVal;
 | 
					 | 
				
			||||||
		private long range;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		public MultiBitStencilAnalog(NavigableMap<Long, ?> entries, Object left, boolean continous, boolean signed) {
 | 
					 | 
				
			||||||
			this.continous=continous;
 | 
					 | 
				
			||||||
			Collection<?> values = ((NavigableMap<Long, ?>) entries).values();
 | 
					 | 
				
			||||||
			minVal=((BitVector) left).toUnsignedValue();
 | 
					 | 
				
			||||||
			range=2;
 | 
					 | 
				
			||||||
			if(!values.isEmpty()) {
 | 
					 | 
				
			||||||
				long maxVal=minVal;
 | 
					 | 
				
			||||||
				for (Object e : entries.values()) {
 | 
					 | 
				
			||||||
					long v = ((BitVector)e).toUnsignedValue();
 | 
					 | 
				
			||||||
					maxVal=Math.max(maxVal, v);
 | 
					 | 
				
			||||||
					minVal=Math.min(minVal, v);
 | 
					 | 
				
			||||||
				}
 | 
					 | 
				
			||||||
				if(maxVal==minVal) {
 | 
					 | 
				
			||||||
					maxVal--;
 | 
					 | 
				
			||||||
					minVal++;
 | 
					 | 
				
			||||||
				}
 | 
					 | 
				
			||||||
				range = maxVal-minVal;
 | 
					 | 
				
			||||||
			} else
 | 
					 | 
				
			||||||
				minVal--;
 | 
					 | 
				
			||||||
			
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		public void draw(GC gc, Rectangle area, Object left, Object right, int xBegin, int xEnd, boolean multiple) {
 | 
					 | 
				
			||||||
			long leftVal = ((BitVector) left).toUnsignedValue();
 | 
					 | 
				
			||||||
			long rightVal= ((BitVector) right).toUnsignedValue();
 | 
					 | 
				
			||||||
			gc.setForeground(waveCanvas.colors[WaveformColors.SIGNAL_REAL.ordinal()]);
 | 
					 | 
				
			||||||
			int yOffsetLeft = (int) ((leftVal-minVal) / range * (yOffsetB-yOffsetT));
 | 
					 | 
				
			||||||
			int yOffsetRight = (int) ((rightVal-minVal) / range * (yOffsetB-yOffsetT));
 | 
					 | 
				
			||||||
			if(continous) {
 | 
					 | 
				
			||||||
				if (xEnd > maxX) {
 | 
					 | 
				
			||||||
					gc.drawLine(xBegin, yOffsetB-yOffsetLeft, maxX, yOffsetB-yOffsetRight);
 | 
					 | 
				
			||||||
				} else {
 | 
					 | 
				
			||||||
					gc.drawLine(xBegin, yOffsetB-yOffsetLeft, xEnd, yOffsetB-yOffsetRight);
 | 
					 | 
				
			||||||
				}
 | 
					 | 
				
			||||||
			} else {
 | 
					 | 
				
			||||||
				if (xEnd > maxX) {
 | 
					 | 
				
			||||||
					gc.drawLine(xBegin, yOffsetB-yOffsetLeft, maxX, yOffsetB-yOffsetLeft);
 | 
					 | 
				
			||||||
				} else {
 | 
					 | 
				
			||||||
					gc.drawLine(xBegin, yOffsetB-yOffsetLeft, xEnd, yOffsetB-yOffsetLeft);
 | 
					 | 
				
			||||||
					if(yOffsetRight!=yOffsetLeft) {
 | 
					 | 
				
			||||||
						gc.drawLine(xEnd, yOffsetB-yOffsetLeft, xEnd, yOffsetB-yOffsetRight);
 | 
					 | 
				
			||||||
					}
 | 
					 | 
				
			||||||
				}
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	private class SingleBitStencil implements SignalStencil {
 | 
					 | 
				
			||||||
		public void draw(GC gc, Rectangle area, Object left, Object right, int xBegin, int xEnd, boolean multiple) {
 | 
					 | 
				
			||||||
			if (multiple) {
 | 
					 | 
				
			||||||
				gc.setForeground(waveCanvas.colors[WaveformColors.SIGNALU.ordinal()]);
 | 
					 | 
				
			||||||
				gc.drawLine(xBegin, yOffsetT, xBegin, yOffsetB);
 | 
					 | 
				
			||||||
				if(xEnd>xBegin) 
 | 
					 | 
				
			||||||
					gc.drawLine(xEnd, yOffsetT, xEnd, yOffsetB);
 | 
					 | 
				
			||||||
			} else {
 | 
					 | 
				
			||||||
				Color color = waveCanvas.colors[WaveformColors.SIGNALX.ordinal()];
 | 
					 | 
				
			||||||
				int yOffset = yOffsetM;
 | 
					 | 
				
			||||||
				switch (((BitVector) left).getValue()[0]) {
 | 
					 | 
				
			||||||
				case '1':
 | 
					 | 
				
			||||||
					color = waveCanvas.colors[WaveformColors.SIGNAL1.ordinal()];
 | 
					 | 
				
			||||||
					yOffset = yOffsetT;
 | 
					 | 
				
			||||||
					break;
 | 
					 | 
				
			||||||
				case '0':
 | 
					 | 
				
			||||||
					color = waveCanvas.colors[WaveformColors.SIGNAL0.ordinal()];
 | 
					 | 
				
			||||||
					yOffset = yOffsetB;
 | 
					 | 
				
			||||||
					break;
 | 
					 | 
				
			||||||
				case 'Z':
 | 
					 | 
				
			||||||
					color = waveCanvas.colors[WaveformColors.SIGNALZ.ordinal()];
 | 
					 | 
				
			||||||
					break;
 | 
					 | 
				
			||||||
				default:
 | 
					 | 
				
			||||||
				}
 | 
					 | 
				
			||||||
				gc.setForeground(color);
 | 
					 | 
				
			||||||
				if (xEnd > maxX) {
 | 
					 | 
				
			||||||
					gc.drawLine(xBegin, yOffset, maxX, yOffset);
 | 
					 | 
				
			||||||
				} else {
 | 
					 | 
				
			||||||
					gc.drawLine(xBegin, yOffset, xEnd, yOffset);
 | 
					 | 
				
			||||||
					int yNext = yOffsetM;
 | 
					 | 
				
			||||||
					switch (((BitVector) right).getValue()[0]) {
 | 
					 | 
				
			||||||
					case '1':
 | 
					 | 
				
			||||||
						yNext = yOffsetT;
 | 
					 | 
				
			||||||
						break;
 | 
					 | 
				
			||||||
					case '0':
 | 
					 | 
				
			||||||
						yNext = yOffsetB;
 | 
					 | 
				
			||||||
						break;
 | 
					 | 
				
			||||||
					default:
 | 
					 | 
				
			||||||
					}
 | 
					 | 
				
			||||||
					if (yOffset != yNext)
 | 
					 | 
				
			||||||
						gc.drawLine(xEnd, yOffset, xEnd, yNext);
 | 
					 | 
				
			||||||
				}
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	private class RealStencil implements SignalStencil {
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		double minVal, range;
 | 
					 | 
				
			||||||
		
 | 
					 | 
				
			||||||
		final double scaleFactor = 1.05;
 | 
					 | 
				
			||||||
		
 | 
					 | 
				
			||||||
		boolean continous=true;
 | 
					 | 
				
			||||||
		
 | 
					 | 
				
			||||||
		public RealStencil(NavigableMap<Long, ?> entries, Object left, boolean continous) {
 | 
					 | 
				
			||||||
			this.continous=continous;
 | 
					 | 
				
			||||||
			Collection<?> values = ((NavigableMap<Long, ?>) entries).values();
 | 
					 | 
				
			||||||
			minVal=(Double) left;
 | 
					 | 
				
			||||||
			range=2.0;
 | 
					 | 
				
			||||||
			if(!values.isEmpty()) {
 | 
					 | 
				
			||||||
				double maxVal=minVal;
 | 
					 | 
				
			||||||
				for (Object e : entries.values()) {
 | 
					 | 
				
			||||||
					double v = ((Double)e);
 | 
					 | 
				
			||||||
					if(Double.isNaN(maxVal))
 | 
					 | 
				
			||||||
						maxVal=v;
 | 
					 | 
				
			||||||
					else if(!Double.isNaN(v))
 | 
					 | 
				
			||||||
						maxVal=Math.max(maxVal, v);
 | 
					 | 
				
			||||||
					if(Double.isNaN(minVal))
 | 
					 | 
				
			||||||
						minVal=v;
 | 
					 | 
				
			||||||
					else if(!Double.isNaN(v))
 | 
					 | 
				
			||||||
						minVal=Math.min(minVal, v);
 | 
					 | 
				
			||||||
				}
 | 
					 | 
				
			||||||
				if(Double.isNaN(maxVal)){
 | 
					 | 
				
			||||||
					maxVal=minVal=0.0;
 | 
					 | 
				
			||||||
				}
 | 
					 | 
				
			||||||
				range = (maxVal-minVal)*scaleFactor;
 | 
					 | 
				
			||||||
				double avg = (maxVal+minVal)/2.0;
 | 
					 | 
				
			||||||
				minVal=avg-(avg-minVal)*scaleFactor;
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		public void draw(GC gc, Rectangle area, Object left, Object right, int xBegin, int xEnd, boolean multiple) {
 | 
					 | 
				
			||||||
			double leftVal = (Double) left;
 | 
					 | 
				
			||||||
			double rightVal= (Double) right;
 | 
					 | 
				
			||||||
			if(Double.isNaN(leftVal)) {
 | 
					 | 
				
			||||||
				Color color = waveCanvas.colors[WaveformColors.SIGNAL_NAN.ordinal()];
 | 
					 | 
				
			||||||
				int width = xEnd - xBegin;
 | 
					 | 
				
			||||||
				if (width > 1) {
 | 
					 | 
				
			||||||
					int[] points = { 
 | 
					 | 
				
			||||||
							xBegin, yOffsetT, 
 | 
					 | 
				
			||||||
							xEnd,   yOffsetT, 
 | 
					 | 
				
			||||||
							xEnd,   yOffsetB, 
 | 
					 | 
				
			||||||
							xBegin, yOffsetB
 | 
					 | 
				
			||||||
					};
 | 
					 | 
				
			||||||
					gc.setForeground(color);
 | 
					 | 
				
			||||||
					gc.drawPolygon(points);
 | 
					 | 
				
			||||||
					gc.setBackground(color);
 | 
					 | 
				
			||||||
					gc.fillPolygon(points);
 | 
					 | 
				
			||||||
				} else {
 | 
					 | 
				
			||||||
					gc.setForeground(color);
 | 
					 | 
				
			||||||
					gc.drawLine(xEnd, yOffsetT, xEnd, yOffsetB);
 | 
					 | 
				
			||||||
				}
 | 
					 | 
				
			||||||
			} else {				
 | 
					 | 
				
			||||||
				gc.setForeground(waveCanvas.colors[WaveformColors.SIGNAL_REAL.ordinal()]);
 | 
					 | 
				
			||||||
				int yOffsetLeft = (int) ((leftVal-minVal) / range * (yOffsetB-yOffsetT));
 | 
					 | 
				
			||||||
				int yOffsetRight = Double.isNaN(rightVal)?yOffsetLeft:(int) ((rightVal-minVal) / range * (yOffsetB-yOffsetT));
 | 
					 | 
				
			||||||
				if(continous) {
 | 
					 | 
				
			||||||
					if (xEnd > maxX) {
 | 
					 | 
				
			||||||
						gc.drawLine(xBegin, yOffsetB-yOffsetLeft, maxX, yOffsetB-yOffsetRight);
 | 
					 | 
				
			||||||
					} else {
 | 
					 | 
				
			||||||
						gc.drawLine(xBegin, yOffsetB-yOffsetLeft, xEnd, yOffsetB-yOffsetRight);
 | 
					 | 
				
			||||||
					}
 | 
					 | 
				
			||||||
				} else {
 | 
					 | 
				
			||||||
					if (xEnd > maxX) {
 | 
					 | 
				
			||||||
						gc.drawLine(xBegin, yOffsetB-yOffsetLeft, maxX, yOffsetB-yOffsetLeft);
 | 
					 | 
				
			||||||
					} else {
 | 
					 | 
				
			||||||
						gc.drawLine(xBegin, yOffsetB-yOffsetLeft, xEnd, yOffsetB-yOffsetLeft);
 | 
					 | 
				
			||||||
						if(yOffsetRight!=yOffsetLeft) {
 | 
					 | 
				
			||||||
							gc.drawLine(xEnd, yOffsetB-yOffsetLeft, xEnd, yOffsetB-yOffsetRight);
 | 
					 | 
				
			||||||
						}
 | 
					 | 
				
			||||||
					}
 | 
					 | 
				
			||||||
				}
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
@@ -1,170 +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 {
 | 
					 | 
				
			||||||
			// adjusting drawing width to circumvent issues in canvas algos
 | 
					 | 
				
			||||||
			if(bb.x < area.x) {
 | 
					 | 
				
			||||||
				bb.width = bb.width-(area.x-bb.x)+5;
 | 
					 | 
				
			||||||
				bb.x=area.x-5;
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
			int bb_x2 = bb.x+bb.width;
 | 
					 | 
				
			||||||
			int area_x2 = area.x+area.width;
 | 
					 | 
				
			||||||
			if(bb_x2>area_x2){
 | 
					 | 
				
			||||||
				bb_x2=area_x2+5;
 | 
					 | 
				
			||||||
				bb.width= bb_x2-bb.x;
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
		    gc.fillRoundRectangle(bb.x, bb.y, bb.width, bb.height, 5, 5);
 | 
					 | 
				
			||||||
		    gc.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;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
@@ -1,555 +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.RelationType;
 | 
					 | 
				
			||||||
import com.minres.scviewer.database.swt.Constants;
 | 
					 | 
				
			||||||
import com.minres.scviewer.database.ui.IWaveformViewer;
 | 
					 | 
				
			||||||
import com.minres.scviewer.database.ui.TrackEntry;
 | 
					 | 
				
			||||||
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;
 | 
					 | 
				
			||||||
        
 | 
					 | 
				
			||||||
    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<>();
 | 
					 | 
				
			||||||
    	// fall back initialization
 | 
					 | 
				
			||||||
        colors[WaveformColors.LINE.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_RED);
 | 
					 | 
				
			||||||
        colors[WaveformColors.LINE_HIGHLITE.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_CYAN);
 | 
					 | 
				
			||||||
        colors[WaveformColors.TRACK_BG_EVEN.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_BLACK);
 | 
					 | 
				
			||||||
        colors[WaveformColors.TRACK_BG_ODD.ordinal()] = SWTResourceManager.getColor(40, 40, 40);
 | 
					 | 
				
			||||||
        colors[WaveformColors.TRACK_BG_HIGHLITE.ordinal()] = SWTResourceManager.getColor(40, 40, 80);
 | 
					 | 
				
			||||||
        colors[WaveformColors.TX_BG.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_GREEN);
 | 
					 | 
				
			||||||
        colors[WaveformColors.TX_BG_HIGHLITE.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_DARK_GREEN);
 | 
					 | 
				
			||||||
        colors[WaveformColors.TX_BORDER.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_RED);
 | 
					 | 
				
			||||||
        colors[WaveformColors.SIGNAL0.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_GREEN);
 | 
					 | 
				
			||||||
        colors[WaveformColors.SIGNAL1.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_GREEN);
 | 
					 | 
				
			||||||
        colors[WaveformColors.SIGNALZ.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_DARK_YELLOW);
 | 
					 | 
				
			||||||
        colors[WaveformColors.SIGNALX.ordinal()] = SWTResourceManager.getColor(255,  51,  51);
 | 
					 | 
				
			||||||
        colors[WaveformColors.SIGNALU.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_YELLOW);
 | 
					 | 
				
			||||||
        colors[WaveformColors.SIGNAL_TEXT.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_WHITE);
 | 
					 | 
				
			||||||
        colors[WaveformColors.SIGNAL_REAL.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_YELLOW);
 | 
					 | 
				
			||||||
        colors[WaveformColors.SIGNAL_NAN.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_RED);
 | 
					 | 
				
			||||||
        colors[WaveformColors.CURSOR.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_RED);
 | 
					 | 
				
			||||||
        colors[WaveformColors.CURSOR_DRAG.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_GRAY);
 | 
					 | 
				
			||||||
        colors[WaveformColors.CURSOR_TEXT.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_WHITE);
 | 
					 | 
				
			||||||
        colors[WaveformColors.MARKER.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_DARK_GRAY);
 | 
					 | 
				
			||||||
        colors[WaveformColors.MARKER_TEXT.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_WHITE);
 | 
					 | 
				
			||||||
        colors[WaveformColors.REL_ARROW.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_MAGENTA);
 | 
					 | 
				
			||||||
        colors[WaveformColors.REL_ARROW_HIGHLITE.ordinal()] = SWTResourceManager.getColor(255, 128, 255);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	public void addCursoPainter(CursorPainter cursorPainter){
 | 
					 | 
				
			||||||
		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();
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    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 int getWidth() {
 | 
					 | 
				
			||||||
    	return getClientArea().width; 
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
    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 Constants.unitMultiplier.length*Constants.unitString.length-1;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    public void setZoomLevel(int level) {
 | 
					 | 
				
			||||||
    	long oldScaleFactor=scaleFactor;
 | 
					 | 
				
			||||||
    	if(level<Constants.unitMultiplier.length*Constants.unitString.length){
 | 
					 | 
				
			||||||
    		this.level = level;
 | 
					 | 
				
			||||||
    		this.scaleFactor = (long) Math.pow(10, level/2);
 | 
					 | 
				
			||||||
    		if(level%2==1) this.scaleFactor*=3;
 | 
					 | 
				
			||||||
    		ITx tx = arrowPainter.getTx();
 | 
					 | 
				
			||||||
    		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/Constants.unitMultiplier.length;
 | 
					 | 
				
			||||||
    	double res = Math.pow(1000, scale);
 | 
					 | 
				
			||||||
    	return (long) res;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    public String getUnitStr(){
 | 
					 | 
				
			||||||
        return Constants.unitString[level/Constants.unitMultiplier.length];
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
     
 | 
					 | 
				
			||||||
    public int getUnitMultiplier(){
 | 
					 | 
				
			||||||
        return Constants.unitMultiplier[level%Constants.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() {
 | 
					 | 
				
			||||||
    	clearAllWaveformPainter(true);
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
    
 | 
					 | 
				
			||||||
    void clearAllWaveformPainter(boolean update) {
 | 
					 | 
				
			||||||
        trackAreaPainter.getTrackVerticalOffset().clear();
 | 
					 | 
				
			||||||
        wave2painterMap.clear();
 | 
					 | 
				
			||||||
        if(update) syncScrollBars();
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    public void addWaveformPainter(IWaveformPainter painter) {
 | 
					 | 
				
			||||||
    	addWaveformPainter(painter, true);
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
    
 | 
					 | 
				
			||||||
    void addWaveformPainter(IWaveformPainter painter, boolean update) {
 | 
					 | 
				
			||||||
        trackAreaPainter.addTrackPainter(painter);
 | 
					 | 
				
			||||||
        wave2painterMap.put(painter.getTrackEntry().waveform, painter);
 | 
					 | 
				
			||||||
        if(update) 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();
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    /* Initialize 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(); // incl. Ruler
 | 
					 | 
				
			||||||
        int width = (int) (maxTime / scaleFactor);
 | 
					 | 
				
			||||||
        Rectangle clientArea=getClientArea();
 | 
					 | 
				
			||||||
        ScrollBar horizontal = getHorizontalBar();
 | 
					 | 
				
			||||||
        horizontal.setIncrement((int) (getClientArea().width / 100));
 | 
					 | 
				
			||||||
        horizontal.setPageIncrement(getClientArea().width);
 | 
					 | 
				
			||||||
        int clientWidthw = clientArea.width;
 | 
					 | 
				
			||||||
        if (width > clientWidthw) { /* image is wider than client area */
 | 
					 | 
				
			||||||
        	horizontal.setMinimum(0);
 | 
					 | 
				
			||||||
            horizontal.setMaximum(width);
 | 
					 | 
				
			||||||
            horizontal.setEnabled(true);
 | 
					 | 
				
			||||||
            if (((int) -origin.x) > horizontal.getMaximum() - clientWidthw)
 | 
					 | 
				
			||||||
                origin.x = -horizontal.getMaximum() + clientWidthw;
 | 
					 | 
				
			||||||
        } else { /* image is narrower than client area */
 | 
					 | 
				
			||||||
            horizontal.setEnabled(false);
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
        horizontal.setThumb(clientWidthw);
 | 
					 | 
				
			||||||
        horizontal.setSelection(-origin.x);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        ScrollBar vertical = getVerticalBar();
 | 
					 | 
				
			||||||
        vertical.setIncrement((int) (getClientArea().height / 100));
 | 
					 | 
				
			||||||
        vertical.setPageIncrement((int) (getClientArea().height));
 | 
					 | 
				
			||||||
        int clientHeighth = clientArea.height;
 | 
					 | 
				
			||||||
        if (height > clientHeighth) { /* image is higher than client area */
 | 
					 | 
				
			||||||
            vertical.setMinimum(0);
 | 
					 | 
				
			||||||
            vertical.setMaximum(height);
 | 
					 | 
				
			||||||
            vertical.setEnabled(true);
 | 
					 | 
				
			||||||
            if (((int) -origin.y) > vertical.getMaximum() - clientHeighth)
 | 
					 | 
				
			||||||
                origin.y = -vertical.getMaximum() + clientHeighth;
 | 
					 | 
				
			||||||
        } else { /* image is less higher than client area */
 | 
					 | 
				
			||||||
            vertical.setMaximum((int) (clientHeighth));
 | 
					 | 
				
			||||||
            vertical.setEnabled(false);
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
        vertical.setThumb(clientHeighth);
 | 
					 | 
				
			||||||
        vertical.setSelection(-origin.y);
 | 
					 | 
				
			||||||
        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 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(IWaveform waveform) {
 | 
					 | 
				
			||||||
        for (IWaveformPainter painter : wave2painterMap.values()) {
 | 
					 | 
				
			||||||
        	TrackEntry te = painter.getTrackEntry();
 | 
					 | 
				
			||||||
        	if(te.waveform == waveform) {
 | 
					 | 
				
			||||||
                Point size = getSize();
 | 
					 | 
				
			||||||
                //size.x -= getVerticalBar().getSize().x + 2;
 | 
					 | 
				
			||||||
                size.y -=+rulerHeight;
 | 
					 | 
				
			||||||
                ScrollBar sb = getHorizontalBar();
 | 
					 | 
				
			||||||
                if((sb.getStyle()&SWT.SCROLLBAR_OVERLAY)!=0 && sb.isVisible()) // TODO: check on other platform than MacOSX
 | 
					 | 
				
			||||||
                	size.y-=  getHorizontalBar().getSize().y;
 | 
					 | 
				
			||||||
                int top = te.vOffset;
 | 
					 | 
				
			||||||
                int bottom = top + trackHeight;
 | 
					 | 
				
			||||||
                if (top < -origin.y) {
 | 
					 | 
				
			||||||
                    setOrigin(origin.x, -(top-trackHeight));
 | 
					 | 
				
			||||||
                } else if (bottom > (size.y - origin.y)) {
 | 
					 | 
				
			||||||
                    setOrigin(origin.x, size.y - bottom);
 | 
					 | 
				
			||||||
                }
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    public void reveal(long time) {
 | 
					 | 
				
			||||||
        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);
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    long getMaxVisibleTime() {
 | 
					 | 
				
			||||||
    	return (getClientArea().width+origin.x)*scaleFactor;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    long getOriginTime() {
 | 
					 | 
				
			||||||
    	return origin.x * scaleFactor;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							@@ -1,7 +0,0 @@
 | 
				
			|||||||
eclipse.preferences.version=1
 | 
					 | 
				
			||||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
 | 
					 | 
				
			||||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
 | 
					 | 
				
			||||||
org.eclipse.jdt.core.compiler.compliance=1.8
 | 
					 | 
				
			||||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
 | 
					 | 
				
			||||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
 | 
					 | 
				
			||||||
org.eclipse.jdt.core.compiler.source=1.8
 | 
					 | 
				
			||||||
@@ -1,11 +0,0 @@
 | 
				
			|||||||
Manifest-Version: 1.0
 | 
					 | 
				
			||||||
Bundle-ManifestVersion: 2
 | 
					 | 
				
			||||||
Bundle-Name: Database UI
 | 
					 | 
				
			||||||
Bundle-SymbolicName: com.minres.scviewer.database.ui
 | 
					 | 
				
			||||||
Bundle-Version: 2.0.0.qualifier
 | 
					 | 
				
			||||||
Bundle-Vendor: MINRES Technologies GmbH
 | 
					 | 
				
			||||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
 | 
					 | 
				
			||||||
Export-Package: com.minres.scviewer.database.ui
 | 
					 | 
				
			||||||
Require-Bundle: com.minres.scviewer.database,
 | 
					 | 
				
			||||||
 org.eclipse.jface
 | 
					 | 
				
			||||||
Automatic-Module-Name: com.minres.scviewer.database.ui
 | 
					 | 
				
			||||||
@@ -1,4 +0,0 @@
 | 
				
			|||||||
source.. = src/
 | 
					 | 
				
			||||||
output.. = bin/
 | 
					 | 
				
			||||||
bin.includes = META-INF/,\
 | 
					 | 
				
			||||||
               .
 | 
					 | 
				
			||||||
@@ -1,12 +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.ui</artifactId>
 | 
					 | 
				
			||||||
  <version>2.0.0-SNAPSHOT</version>
 | 
					 | 
				
			||||||
  <packaging>eclipse-plugin</packaging>
 | 
					 | 
				
			||||||
  <parent>
 | 
					 | 
				
			||||||
  	<groupId>com.minres.scviewer</groupId>
 | 
					 | 
				
			||||||
  	<artifactId>com.minres.scviewer.parent</artifactId>
 | 
					 | 
				
			||||||
  	<version>2.0.0-SNAPSHOT</version>
 | 
					 | 
				
			||||||
  	<relativePath>../com.minres.scviewer.parent</relativePath>
 | 
					 | 
				
			||||||
  </parent>
 | 
					 | 
				
			||||||
  </project>
 | 
					 | 
				
			||||||
@@ -1,107 +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 void update();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	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);
 | 
					 | 
				
			||||||
	
 | 
					 | 
				
			||||||
	public void scrollHorizontal(int percent);
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
@@ -1,7 +0,0 @@
 | 
				
			|||||||
eclipse.preferences.version=1
 | 
					 | 
				
			||||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
 | 
					 | 
				
			||||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
 | 
					 | 
				
			||||||
org.eclipse.jdt.core.compiler.compliance=1.8
 | 
					 | 
				
			||||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
 | 
					 | 
				
			||||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
 | 
					 | 
				
			||||||
org.eclipse.jdt.core.compiler.source=1.8
 | 
					 | 
				
			||||||
@@ -1,130 +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.Map.Entry;
 | 
					 | 
				
			||||||
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.IWaveform;
 | 
					 | 
				
			||||||
import com.minres.scviewer.database.IWaveformDb;
 | 
					 | 
				
			||||||
import com.minres.scviewer.database.IWaveformEvent;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
public class VCDSignal<T> extends HierNode implements ISignal<T> {
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	private long id;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	private String fullName;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	private final String kind = "signal";
 | 
					 | 
				
			||||||
	
 | 
					 | 
				
			||||||
	private final int width;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	private final T dummy = null;
 | 
					 | 
				
			||||||
	
 | 
					 | 
				
			||||||
	private IWaveformDb db;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	private 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(ISignal<T> 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(Long time, T value){
 | 
					 | 
				
			||||||
		values.put(time, value);
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	
 | 
					 | 
				
			||||||
	@Override
 | 
					 | 
				
			||||||
	public NavigableMap<Long, T> getEvents() {
 | 
					 | 
				
			||||||
		return values;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	@Override
 | 
					 | 
				
			||||||
	public T getWaveformValueAtTime(Long time) {
 | 
					 | 
				
			||||||
		return values.get(time);
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    @Override
 | 
					 | 
				
			||||||
    public T getWaveformValueBeforeTime(Long time) {
 | 
					 | 
				
			||||||
    	Entry<Long, T> e = values.floorEntry(time);
 | 
					 | 
				
			||||||
    	if(e==null)
 | 
					 | 
				
			||||||
    		return null;
 | 
					 | 
				
			||||||
    	else
 | 
					 | 
				
			||||||
    		return  values.floorEntry(time).getValue();
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	@Override
 | 
					 | 
				
			||||||
	public Boolean equals(IWaveform other) {
 | 
					 | 
				
			||||||
		return(other instanceof VCDSignal<?> && this.getId()==other.getId());
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	@Override
 | 
					 | 
				
			||||||
	public Class<?> getType() {
 | 
					 | 
				
			||||||
		return dummy.getClass();
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
@@ -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.8"/>
 | 
					 | 
				
			||||||
	<classpathentry kind="output" path="target/classes"/>
 | 
					 | 
				
			||||||
</classpath>
 | 
					 | 
				
			||||||
@@ -1,8 +0,0 @@
 | 
				
			|||||||
eclipse.preferences.version=1
 | 
					 | 
				
			||||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
 | 
					 | 
				
			||||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
 | 
					 | 
				
			||||||
org.eclipse.jdt.core.compiler.compliance=1.8
 | 
					 | 
				
			||||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
 | 
					 | 
				
			||||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
 | 
					 | 
				
			||||||
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
 | 
					 | 
				
			||||||
org.eclipse.jdt.core.compiler.source=1.8
 | 
					 | 
				
			||||||
@@ -1,68 +0,0 @@
 | 
				
			|||||||
package com.minres.scviewer.database;
 | 
					 | 
				
			||||||
public enum BitValue {
 | 
					 | 
				
			||||||
    ZERO,
 | 
					 | 
				
			||||||
    ONE,
 | 
					 | 
				
			||||||
    X,
 | 
					 | 
				
			||||||
    Z;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    private static final BitValue[] ORDINAL_TABLE = BitValue.values();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    public static BitValue fromChar(char c) {
 | 
					 | 
				
			||||||
        switch (c) {
 | 
					 | 
				
			||||||
            case '0':
 | 
					 | 
				
			||||||
                return ZERO;
 | 
					 | 
				
			||||||
            case '1':
 | 
					 | 
				
			||||||
                return ONE;
 | 
					 | 
				
			||||||
            case 'x':
 | 
					 | 
				
			||||||
            case 'X':
 | 
					 | 
				
			||||||
                return X;
 | 
					 | 
				
			||||||
            case 'z':
 | 
					 | 
				
			||||||
            case 'Z':
 | 
					 | 
				
			||||||
                return Z;
 | 
					 | 
				
			||||||
            default:
 | 
					 | 
				
			||||||
                throw new NumberFormatException("unknown digit " + c);
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    public char toChar() {
 | 
					 | 
				
			||||||
        switch (this) {
 | 
					 | 
				
			||||||
            case ZERO:
 | 
					 | 
				
			||||||
                return '0';
 | 
					 | 
				
			||||||
            case ONE:
 | 
					 | 
				
			||||||
                return '1';
 | 
					 | 
				
			||||||
            case X:
 | 
					 | 
				
			||||||
                return 'x';
 | 
					 | 
				
			||||||
            case Z:
 | 
					 | 
				
			||||||
                return 'z';
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        return ' '; // Unreachable?
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    public static BitValue fromInt(int i) {
 | 
					 | 
				
			||||||
        if (i == 0) {
 | 
					 | 
				
			||||||
            return ZERO;
 | 
					 | 
				
			||||||
        } else {
 | 
					 | 
				
			||||||
            return ONE;
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    public int toInt() {
 | 
					 | 
				
			||||||
        return (this == ONE) ? 1 : 0;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    public static BitValue fromOrdinal(int ord) {
 | 
					 | 
				
			||||||
        return ORDINAL_TABLE[ord];
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    public int compare(BitValue other) {
 | 
					 | 
				
			||||||
        if (this == ONE && other == ZERO) {
 | 
					 | 
				
			||||||
            return 1;
 | 
					 | 
				
			||||||
        } else if (this == ZERO && other == ONE) {
 | 
					 | 
				
			||||||
            return -1;
 | 
					 | 
				
			||||||
        } else {
 | 
					 | 
				
			||||||
            // Either these are equal, or there is an X and Z, which match everything.
 | 
					 | 
				
			||||||
            return 0;
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
@@ -1,169 +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 {
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	private final int width;
 | 
					 | 
				
			||||||
	
 | 
					 | 
				
			||||||
	private int[] packedValues;
 | 
					 | 
				
			||||||
	
 | 
					 | 
				
			||||||
	public BitVector(int netWidth) {
 | 
					 | 
				
			||||||
		this.width=netWidth;
 | 
					 | 
				
			||||||
		packedValues = new int[(netWidth+15)/16];
 | 
					 | 
				
			||||||
		for(int i=0; i<packedValues.length; i++) packedValues[i]=0;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	public void setValue(int i, BitValue value) {
 | 
					 | 
				
			||||||
		int bitIndex = i*2;
 | 
					 | 
				
			||||||
		int wordOffset = bitIndex >> 5;
 | 
					 | 
				
			||||||
		int bitOffset = bitIndex & 31;
 | 
					 | 
				
			||||||
		packedValues[wordOffset] &= ~(3 << bitOffset);
 | 
					 | 
				
			||||||
		packedValues[wordOffset] |= value.ordinal() << bitOffset;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	public char[] getValue() {
 | 
					 | 
				
			||||||
        int bitOffset = 0;
 | 
					 | 
				
			||||||
        int wordOffset = 0;
 | 
					 | 
				
			||||||
        char[] res = new char[width];
 | 
					 | 
				
			||||||
        // Copy values out of packed array
 | 
					 | 
				
			||||||
        for (int i = 0; i < width; i++) {
 | 
					 | 
				
			||||||
            int currentWord = (packedValues[wordOffset] >> bitOffset)&3;
 | 
					 | 
				
			||||||
        	res[width-i-1]=BitValue.fromInt(currentWord).toChar();
 | 
					 | 
				
			||||||
            bitOffset += 2;
 | 
					 | 
				
			||||||
            if (bitOffset == 32) {
 | 
					 | 
				
			||||||
                wordOffset++;
 | 
					 | 
				
			||||||
                bitOffset = 0;
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
		return res;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	public void setValue(char[] value) {
 | 
					 | 
				
			||||||
		int bitIndex = width;
 | 
					 | 
				
			||||||
		int wordOffset = bitIndex >> 4;
 | 
					 | 
				
			||||||
		int bitOffset = (bitIndex * 2) % 32;
 | 
					 | 
				
			||||||
		for (int i = Math.min(value.length, width) - 1; i >= 0; i--) {
 | 
					 | 
				
			||||||
			packedValues[wordOffset] |= BitValue.fromChar(value[i]).ordinal() << bitOffset;
 | 
					 | 
				
			||||||
			bitOffset += 2;
 | 
					 | 
				
			||||||
			if (bitOffset == 32) {
 | 
					 | 
				
			||||||
				wordOffset++;
 | 
					 | 
				
			||||||
				bitOffset = 0;
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	public int getWidth() {
 | 
					 | 
				
			||||||
		return width;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	public String toString(){
 | 
					 | 
				
			||||||
		return new String(getValue());
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	
 | 
					 | 
				
			||||||
	public String toHexString(){
 | 
					 | 
				
			||||||
		int resWidth=(width-1)/4+1;
 | 
					 | 
				
			||||||
		char[] value=getValue();
 | 
					 | 
				
			||||||
		char[] res = new char[resWidth];
 | 
					 | 
				
			||||||
		for(int i=resWidth-1; i>=0; i--){
 | 
					 | 
				
			||||||
			int digit=0;
 | 
					 | 
				
			||||||
			for(int j=3; j>=0; j--){
 | 
					 | 
				
			||||||
				BitValue val = BitValue.fromChar(value[4*i+j]);
 | 
					 | 
				
			||||||
				switch(val) {
 | 
					 | 
				
			||||||
				case X:
 | 
					 | 
				
			||||||
				case Z:
 | 
					 | 
				
			||||||
					res[i]=val.toChar();
 | 
					 | 
				
			||||||
					continue;
 | 
					 | 
				
			||||||
				case ONE:
 | 
					 | 
				
			||||||
					digit+=1<<(3-j);
 | 
					 | 
				
			||||||
					break;
 | 
					 | 
				
			||||||
				default:
 | 
					 | 
				
			||||||
					break;
 | 
					 | 
				
			||||||
				}
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
			res[i]=Character.forDigit(digit, 16); //((digit < 10) ? '0' + digit : 'a' + digit -10)
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
		return new String(res);		
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	
 | 
					 | 
				
			||||||
	public long toUnsignedValue() {
 | 
					 | 
				
			||||||
		long res = 0;
 | 
					 | 
				
			||||||
        int bitOffset = 0;
 | 
					 | 
				
			||||||
        int wordOffset = 0;
 | 
					 | 
				
			||||||
        int currentWord = 0;
 | 
					 | 
				
			||||||
        // Copy values out of packed array
 | 
					 | 
				
			||||||
        for (int i = 0; i < width; i++) {
 | 
					 | 
				
			||||||
            if(bitOffset==0) currentWord = packedValues[wordOffset];
 | 
					 | 
				
			||||||
			switch (currentWord & 3) {
 | 
					 | 
				
			||||||
			case 1:
 | 
					 | 
				
			||||||
				res|=1<<i;
 | 
					 | 
				
			||||||
				break;
 | 
					 | 
				
			||||||
			case 2:
 | 
					 | 
				
			||||||
			case 3:
 | 
					 | 
				
			||||||
				return 0;
 | 
					 | 
				
			||||||
			default:
 | 
					 | 
				
			||||||
				break;
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
            bitOffset += 2;
 | 
					 | 
				
			||||||
            if (bitOffset == 32) {
 | 
					 | 
				
			||||||
                wordOffset++;
 | 
					 | 
				
			||||||
                bitOffset = 0;
 | 
					 | 
				
			||||||
            } else {
 | 
					 | 
				
			||||||
                currentWord >>= 2;
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
        return res;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	
 | 
					 | 
				
			||||||
	public long toSignedValue() {
 | 
					 | 
				
			||||||
		long res = 0;
 | 
					 | 
				
			||||||
        int bitOffset = 0;
 | 
					 | 
				
			||||||
        int wordOffset = 0;
 | 
					 | 
				
			||||||
        int currentWord = 0;
 | 
					 | 
				
			||||||
        int lastVal=0;
 | 
					 | 
				
			||||||
        // Copy values out of packed array
 | 
					 | 
				
			||||||
        for (int i = 0; i < width; i++) {
 | 
					 | 
				
			||||||
        	if(bitOffset==0) currentWord = packedValues[wordOffset];
 | 
					 | 
				
			||||||
        	lastVal=0;
 | 
					 | 
				
			||||||
			switch (currentWord & 3) {
 | 
					 | 
				
			||||||
			case 1:
 | 
					 | 
				
			||||||
				res|=1<<i;
 | 
					 | 
				
			||||||
				lastVal=1;
 | 
					 | 
				
			||||||
				break;
 | 
					 | 
				
			||||||
			case 2:
 | 
					 | 
				
			||||||
			case 3:
 | 
					 | 
				
			||||||
				return 0;
 | 
					 | 
				
			||||||
			default:
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
            bitOffset += 2;
 | 
					 | 
				
			||||||
            if (bitOffset == 32) {
 | 
					 | 
				
			||||||
                wordOffset++;
 | 
					 | 
				
			||||||
                bitOffset = 0;
 | 
					 | 
				
			||||||
            } else {
 | 
					 | 
				
			||||||
                currentWord >>= 2;
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
        for(int i=width; i<64; i++) {
 | 
					 | 
				
			||||||
        	if(bitOffset==0) currentWord = packedValues[wordOffset];
 | 
					 | 
				
			||||||
        	res|=lastVal<<i;
 | 
					 | 
				
			||||||
        	bitOffset += 2;
 | 
					 | 
				
			||||||
            if (bitOffset == 32) {
 | 
					 | 
				
			||||||
                wordOffset++;
 | 
					 | 
				
			||||||
                bitOffset = 0;
 | 
					 | 
				
			||||||
            } else {
 | 
					 | 
				
			||||||
                currentWord >>= 2;
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
        	
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
		return res;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
@@ -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
 | 
					 | 
				
			||||||
};
 | 
					 | 
				
			||||||
@@ -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());
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
@@ -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();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
@@ -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();
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
@@ -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 {
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	public List<ITxGenerator> getGenerators();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	public int getMaxConcurrency();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	public NavigableMap<Long, List<ITxEvent>> getEvents();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	public Collection<T> getWaveformEventsAtTime(Long time);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
@@ -1,189 +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.IWaveform;
 | 
					 | 
				
			||||||
import com.minres.scviewer.database.IWaveformDb;
 | 
					 | 
				
			||||||
import com.minres.scviewer.database.IWaveformDbLoader;
 | 
					 | 
				
			||||||
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 getStreamByName(String name) {
 | 
					 | 
				
			||||||
		return waveforms.get(name);
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	@Override
 | 
					 | 
				
			||||||
	public List<IWaveform> getAllWaves() {
 | 
					 | 
				
			||||||
		return new ArrayList<IWaveform>(waveforms.values());
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	@Override
 | 
					 | 
				
			||||||
	public boolean load(File inp){
 | 
					 | 
				
			||||||
		for(IWaveformDbLoader loader:loaders){
 | 
					 | 
				
			||||||
			try {
 | 
					 | 
				
			||||||
				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;
 | 
					 | 
				
			||||||
				}
 | 
					 | 
				
			||||||
			} catch (Exception e) {
 | 
					 | 
				
			||||||
				return false;
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
		}		
 | 
					 | 
				
			||||||
		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 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;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
@@ -1,7 +0,0 @@
 | 
				
			|||||||
<?xml version="1.0" encoding="UTF-8"?>
 | 
					 | 
				
			||||||
<classpath>
 | 
					 | 
				
			||||||
	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
 | 
					 | 
				
			||||||
	<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
 | 
					 | 
				
			||||||
	<classpathentry kind="src" path="src"/>
 | 
					 | 
				
			||||||
	<classpathentry kind="output" path="bin"/>
 | 
					 | 
				
			||||||
</classpath>
 | 
					 | 
				
			||||||
@@ -1,3 +0,0 @@
 | 
				
			|||||||
eclipse.preferences.version=1
 | 
					 | 
				
			||||||
pluginProject.extensions=false
 | 
					 | 
				
			||||||
resolve.requirebundle=false
 | 
					 | 
				
			||||||
@@ -1,38 +0,0 @@
 | 
				
			|||||||
Manifest-Version: 1.0
 | 
					 | 
				
			||||||
Bundle-ManifestVersion: 2
 | 
					 | 
				
			||||||
Bundle-Name: %Bundle-Name
 | 
					 | 
				
			||||||
Bundle-SymbolicName: com.minres.scviewer.e4.application;singleton:=true
 | 
					 | 
				
			||||||
Bundle-Version: 2.0.2.qualifier
 | 
					 | 
				
			||||||
Bundle-Vendor: %Bundle-Vendor
 | 
					 | 
				
			||||||
Require-Bundle: javax.inject;bundle-version="1.0.0",
 | 
					 | 
				
			||||||
  org.eclipse.core.runtime;bundle-version="3.11.1",
 | 
					 | 
				
			||||||
  org.eclipse.swt;bundle-version="3.104.1",
 | 
					 | 
				
			||||||
  org.eclipse.e4.ui.model.workbench;bundle-version="1.1.100",
 | 
					 | 
				
			||||||
  org.eclipse.jface;bundle-version="3.11.0",
 | 
					 | 
				
			||||||
  org.eclipse.e4.ui.services;bundle-version="1.2.0",
 | 
					 | 
				
			||||||
  org.eclipse.e4.ui.workbench;bundle-version="1.3.0",
 | 
					 | 
				
			||||||
  org.eclipse.e4.core.di;bundle-version="1.5.0",
 | 
					 | 
				
			||||||
  org.eclipse.e4.ui.di;bundle-version="1.1.0",
 | 
					 | 
				
			||||||
  org.eclipse.e4.core.contexts;bundle-version="1.4.0",
 | 
					 | 
				
			||||||
  com.minres.scviewer.database.ui.swt;bundle-version="1.0.0",
 | 
					 | 
				
			||||||
  com.minres.scviewer.database.ui,
 | 
					 | 
				
			||||||
  com.minres.scviewer.database;bundle-version="1.0.0",
 | 
					 | 
				
			||||||
  org.eclipse.equinox.ds;bundle-version="1.4.300",
 | 
					 | 
				
			||||||
  org.eclipse.equinox.util;bundle-version="1.0.500",
 | 
					 | 
				
			||||||
  org.eclipse.osgi.services;bundle-version="3.5.0",
 | 
					 | 
				
			||||||
  org.eclipse.e4.core.services;bundle-version="2.0.0",
 | 
					 | 
				
			||||||
  org.eclipse.osgi.services;bundle-version="3.5.0",
 | 
					 | 
				
			||||||
  org.eclipse.core.jobs,
 | 
					 | 
				
			||||||
  org.eclipse.osgi,
 | 
					 | 
				
			||||||
  com.google.guava,
 | 
					 | 
				
			||||||
  org.eclipse.equinox.preferences,
 | 
					 | 
				
			||||||
  org.eclipse.core.expressions,
 | 
					 | 
				
			||||||
  org.eclipse.e4.core.commands;bundle-version="0.11.0",
 | 
					 | 
				
			||||||
  org.eclipse.e4.ui.workbench.addons.swt,
 | 
					 | 
				
			||||||
  com.opcoach.e4.preferences,
 | 
					 | 
				
			||||||
  org.eclipse.e4.core.di.extensions,
 | 
					 | 
				
			||||||
  org.eclipse.e4.ui.css.swt.theme;bundle-version="0.10.0"
 | 
					 | 
				
			||||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
 | 
					 | 
				
			||||||
Import-Package: com.minres.scviewer.database,
 | 
					 | 
				
			||||||
  javax.inject;version="1.0.0"
 | 
					 | 
				
			||||||
Automatic-Module-Name: com.minres.scviewer.e4.application
 | 
					 | 
				
			||||||
@@ -1,12 +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>
 | 
					 | 
				
			||||||
  <version>2.0.2-SNAPSHOT</version>
 | 
					 | 
				
			||||||
  <parent>
 | 
					 | 
				
			||||||
  	<groupId>com.minres.scviewer</groupId>
 | 
					 | 
				
			||||||
  	<artifactId>com.minres.scviewer.parent</artifactId>
 | 
					 | 
				
			||||||
  	<version>2.0.0-SNAPSHOT</version>
 | 
					 | 
				
			||||||
  	<relativePath>../com.minres.scviewer.parent</relativePath>
 | 
					 | 
				
			||||||
  </parent>
 | 
					 | 
				
			||||||
  <packaging>eclipse-plugin</packaging>
 | 
					 | 
				
			||||||
  </project>
 | 
					 | 
				
			||||||
@@ -1,69 +0,0 @@
 | 
				
			|||||||
package com.minres.scviewer.e4.application;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
import org.eclipse.osgi.util.NLS;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
public class Messages extends NLS {
 | 
					 | 
				
			||||||
	private static final String BUNDLE_NAME = "com.minres.scviewer.e4.application.messages"; //$NON-NLS-1$
 | 
					 | 
				
			||||||
	public static String AboutDialog_0;
 | 
					 | 
				
			||||||
	public static String AboutDialog_1;
 | 
					 | 
				
			||||||
	public static String DesignBrowser_12;
 | 
					 | 
				
			||||||
	public static String DesignBrowser_16;
 | 
					 | 
				
			||||||
	public static String DesignBrowser_2;
 | 
					 | 
				
			||||||
	public static String DesignBrowser_4;
 | 
					 | 
				
			||||||
	public static String DesignBrowser_8;
 | 
					 | 
				
			||||||
	public static String LoadingWaveformDb_0;
 | 
					 | 
				
			||||||
	public static String LoadStoreSettingsHandler_2;
 | 
					 | 
				
			||||||
	public static String LoadStoreSettingsHandler_3;
 | 
					 | 
				
			||||||
	public static String OpenHandler_0;
 | 
					 | 
				
			||||||
	public static String QuitHandler_0;
 | 
					 | 
				
			||||||
	public static String QuitHandler_1;
 | 
					 | 
				
			||||||
	public static String RelationTypeToolControl_0;
 | 
					 | 
				
			||||||
	public static String RelationTypeToolControl_1;
 | 
					 | 
				
			||||||
	public static String ResourceManager_0;
 | 
					 | 
				
			||||||
	public static String SCViewerPreferencesPage_0;
 | 
					 | 
				
			||||||
	public static String StatusBarControl_1;
 | 
					 | 
				
			||||||
	public static String StatusBarControl_2;
 | 
					 | 
				
			||||||
	public static String StatusBarControl_3;
 | 
					 | 
				
			||||||
	public static String StatusBarControl_4;
 | 
					 | 
				
			||||||
	public static String SWTResourceManager_0;
 | 
					 | 
				
			||||||
	public static String TransactionDetails_0;
 | 
					 | 
				
			||||||
	public static String TransactionDetails_1;
 | 
					 | 
				
			||||||
	public static String TransactionDetails_10;
 | 
					 | 
				
			||||||
	public static String TransactionDetails_11;
 | 
					 | 
				
			||||||
	public static String TransactionDetails_12;
 | 
					 | 
				
			||||||
	public static String TransactionDetails_13;
 | 
					 | 
				
			||||||
	public static String TransactionDetails_16;
 | 
					 | 
				
			||||||
	public static String TransactionDetails_19;
 | 
					 | 
				
			||||||
	public static String TransactionDetails_2;
 | 
					 | 
				
			||||||
	public static String TransactionDetails_20;
 | 
					 | 
				
			||||||
	public static String TransactionDetails_21;
 | 
					 | 
				
			||||||
	public static String TransactionDetails_3;
 | 
					 | 
				
			||||||
	public static String TransactionDetails_4;
 | 
					 | 
				
			||||||
	public static String WaveformPreferencesPage_1;
 | 
					 | 
				
			||||||
	public static String WaveformViewer_13;
 | 
					 | 
				
			||||||
	public static String WaveformViewer_14;
 | 
					 | 
				
			||||||
	public static String WaveformViewer_15;
 | 
					 | 
				
			||||||
	public static String WaveformViewer_16;
 | 
					 | 
				
			||||||
	public static String WaveformViewer_17;
 | 
					 | 
				
			||||||
	public static String WaveformViewer_18;
 | 
					 | 
				
			||||||
	public static String WaveformViewer_19;
 | 
					 | 
				
			||||||
	public static String WaveformViewer_20;
 | 
					 | 
				
			||||||
	public static String WaveformViewer_21;
 | 
					 | 
				
			||||||
	public static String WaveformViewer_22;
 | 
					 | 
				
			||||||
	public static String WaveformViewer_37;
 | 
					 | 
				
			||||||
	public static String WaveformViewer_38;
 | 
					 | 
				
			||||||
	public static String WaveformViewer_39;
 | 
					 | 
				
			||||||
	public static String WaveStatusBarControl_10;
 | 
					 | 
				
			||||||
	public static String WaveStatusBarControl_12;
 | 
					 | 
				
			||||||
	public static String WaveStatusBarControl_5;
 | 
					 | 
				
			||||||
	public static String WaveStatusBarControl_6;
 | 
					 | 
				
			||||||
	public static String WaveStatusBarControl_7;
 | 
					 | 
				
			||||||
	public static String WaveStatusBarControl_8;
 | 
					 | 
				
			||||||
	static {
 | 
					 | 
				
			||||||
		// initialize resource bundle
 | 
					 | 
				
			||||||
		NLS.initializeMessages(BUNDLE_NAME, Messages.class);
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	private Messages() {
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
@@ -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() {
 | 
					 | 
				
			||||||
		
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
		
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
@@ -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");
 | 
					 | 
				
			||||||
    	}
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
@@ -1,55 +0,0 @@
 | 
				
			|||||||
AboutDialog_0=\nSCViewer - a SystemC waveform viewer\n\nVersion: 2.0\n
 | 
					 | 
				
			||||||
AboutDialog_1=\nCopyright (c) 2015, 2018 MINRES Technologies GmbH and others.\n\nAll rights reserved. MINRES and the MINRES logo are trademarks of MINRES Technologies GmbH, http://www.minres.com/. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at http://www.eclipse.org/legal/epl-v10.html\n\nParts of the software are governed by the Apache License Version 2.0 available at http://www.apache.org/licenses/. These are namely org.mapdb and org.sqlite JDBC driver\n\nSource code is hosted at https://git.minres.com/VP/SCViewer and the master branch is mirrored to GitHub: https://git.com/minres/SCViewer\n
 | 
					 | 
				
			||||||
DesignBrowser_12=Append all after
 | 
					 | 
				
			||||||
DesignBrowser_16=Insert all before
 | 
					 | 
				
			||||||
DesignBrowser_2=Enter text to filter waveforms
 | 
					 | 
				
			||||||
DesignBrowser_4=Append after
 | 
					 | 
				
			||||||
DesignBrowser_8=Insert before
 | 
					 | 
				
			||||||
LoadingWaveformDb_0=Database loading...
 | 
					 | 
				
			||||||
LoadStoreSettingsHandler_2=*.scview
 | 
					 | 
				
			||||||
LoadStoreSettingsHandler_3=SCViewer.scview
 | 
					 | 
				
			||||||
OpenHandler_0=*.vcd;*.txdb;*.txlog;CURRENT
 | 
					 | 
				
			||||||
QuitHandler_0=Confirmation
 | 
					 | 
				
			||||||
QuitHandler_1=Do you want to exit?
 | 
					 | 
				
			||||||
RelationTypeToolControl_0=------------
 | 
					 | 
				
			||||||
RelationTypeToolControl_1=Select
 | 
					 | 
				
			||||||
ResourceManager_0=Wrong decorate corner
 | 
					 | 
				
			||||||
SCViewerPreferencesPage_0=Check for changed database
 | 
					 | 
				
			||||||
StatusBarControl_1=Currently running: 
 | 
					 | 
				
			||||||
StatusBarControl_2=\nLast task: 
 | 
					 | 
				
			||||||
StatusBarControl_3=Currently running: 
 | 
					 | 
				
			||||||
StatusBarControl_4=No background progress running.
 | 
					 | 
				
			||||||
SWTResourceManager_0=Wrong decorate corner
 | 
					 | 
				
			||||||
TransactionDetails_0=Enter text to filter
 | 
					 | 
				
			||||||
TransactionDetails_1=Name
 | 
					 | 
				
			||||||
TransactionDetails_10=Properties
 | 
					 | 
				
			||||||
TransactionDetails_11=Attributes
 | 
					 | 
				
			||||||
TransactionDetails_12=Incoming relations
 | 
					 | 
				
			||||||
TransactionDetails_13=Outgoing relations
 | 
					 | 
				
			||||||
TransactionDetails_16=String
 | 
					 | 
				
			||||||
TransactionDetails_19=Start time
 | 
					 | 
				
			||||||
TransactionDetails_2=Type
 | 
					 | 
				
			||||||
TransactionDetails_20=Time
 | 
					 | 
				
			||||||
TransactionDetails_21=End time
 | 
					 | 
				
			||||||
TransactionDetails_3=Value
 | 
					 | 
				
			||||||
TransactionDetails_4=Relation
 | 
					 | 
				
			||||||
WaveformPreferencesPage_1=Color for 
 | 
					 | 
				
			||||||
WaveformViewer_13=Database Load Status
 | 
					 | 
				
			||||||
WaveformViewer_14=Database Load Cancelled
 | 
					 | 
				
			||||||
WaveformViewer_15=Database Load Job
 | 
					 | 
				
			||||||
WaveformViewer_16=Loading 
 | 
					 | 
				
			||||||
WaveformViewer_17=Database re-load
 | 
					 | 
				
			||||||
WaveformViewer_18=Would you like to reload the database?
 | 
					 | 
				
			||||||
WaveformViewer_19=vcd
 | 
					 | 
				
			||||||
WaveformViewer_20=txdb
 | 
					 | 
				
			||||||
WaveformViewer_21=txlog
 | 
					 | 
				
			||||||
WaveformViewer_22=txldb
 | 
					 | 
				
			||||||
WaveformViewer_37=Database open
 | 
					 | 
				
			||||||
WaveformViewer_38=Would you like to open the adjacent database 
 | 
					 | 
				
			||||||
WaveformViewer_39=\ as well?
 | 
					 | 
				
			||||||
WaveStatusBarControl_10=\ selected
 | 
					 | 
				
			||||||
WaveStatusBarControl_12=\ Elements
 | 
					 | 
				
			||||||
WaveStatusBarControl_5=C:
 | 
					 | 
				
			||||||
WaveStatusBarControl_6=M:
 | 
					 | 
				
			||||||
WaveStatusBarControl_7=C-M:
 | 
					 | 
				
			||||||
WaveStatusBarControl_8=Z:
 | 
					 | 
				
			||||||
@@ -1,89 +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;
 | 
					 | 
				
			||||||
import com.minres.scviewer.e4.application.Messages;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
public class LoadingWaveformDb implements IWaveformDb {
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	private final String label = Messages.LoadingWaveformDb_0; 
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	@Override
 | 
					 | 
				
			||||||
	public void addPropertyChangeListener(PropertyChangeListener l) {
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	@Override
 | 
					 | 
				
			||||||
	public void removePropertyChangeListener(PropertyChangeListener l) {
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	@Override
 | 
					 | 
				
			||||||
	public String getFullName() {
 | 
					 | 
				
			||||||
		return label;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	@Override
 | 
					 | 
				
			||||||
	public String getName() {
 | 
					 | 
				
			||||||
		return label;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	@Override
 | 
					 | 
				
			||||||
	public void setName(String name) {
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	@Override
 | 
					 | 
				
			||||||
	public void 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 getStreamByName(String name) {
 | 
					 | 
				
			||||||
		return null;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	@Override
 | 
					 | 
				
			||||||
	public List<IWaveform> getAllWaves() {
 | 
					 | 
				
			||||||
		return new ArrayList<IWaveform>();
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	@Override
 | 
					 | 
				
			||||||
	public List<RelationType> getAllRelationTypes() {
 | 
					 | 
				
			||||||
		return new ArrayList<RelationType>();
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	@Override
 | 
					 | 
				
			||||||
	public boolean load(File inp) {
 | 
					 | 
				
			||||||
		return false;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	@Override
 | 
					 | 
				
			||||||
	public boolean isLoaded() {
 | 
					 | 
				
			||||||
		return false;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	@Override
 | 
					 | 
				
			||||||
	public void clear() {
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
@@ -1,627 +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.ITreeViewerListener;
 | 
					 | 
				
			||||||
import org.eclipse.jface.viewers.LabelProvider;
 | 
					 | 
				
			||||||
import org.eclipse.jface.viewers.StructuredSelection;
 | 
					 | 
				
			||||||
import org.eclipse.jface.viewers.StyledString;
 | 
					 | 
				
			||||||
import org.eclipse.jface.viewers.TreeExpansionEvent;
 | 
					 | 
				
			||||||
import org.eclipse.jface.viewers.TreeViewer;
 | 
					 | 
				
			||||||
import org.eclipse.jface.viewers.TreeViewerColumn;
 | 
					 | 
				
			||||||
import org.eclipse.jface.viewers.Viewer;
 | 
					 | 
				
			||||||
import org.eclipse.jface.viewers.ViewerFilter;
 | 
					 | 
				
			||||||
import org.eclipse.jface.viewers.ViewerComparator;
 | 
					 | 
				
			||||||
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 org.eclipse.swt.widgets.TreeItem;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
import com.minres.scviewer.database.ITx;
 | 
					 | 
				
			||||||
import com.minres.scviewer.database.ITxAttribute;
 | 
					 | 
				
			||||||
import com.minres.scviewer.database.ITxRelation;
 | 
					 | 
				
			||||||
import com.minres.scviewer.database.DataType;
 | 
					 | 
				
			||||||
import com.minres.scviewer.e4.application.Messages;
 | 
					 | 
				
			||||||
import com.minres.scviewer.e4.application.provider.TxPropertiesLabelProvider;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/**
 | 
					 | 
				
			||||||
 * 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(Messages.TransactionDetails_0);
 | 
					 | 
				
			||||||
		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.setComparator(viewSorter);
 | 
					 | 
				
			||||||
		treeViewer.setAutoExpandLevel(2);
 | 
					 | 
				
			||||||
		treeViewer.addTreeListener(new ITreeViewerListener() {
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
			@Override
 | 
					 | 
				
			||||||
			public void treeCollapsed(TreeExpansionEvent event) {
 | 
					 | 
				
			||||||
				treeViewer.getSelection();
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
			@Override
 | 
					 | 
				
			||||||
			public void treeExpanded(TreeExpansionEvent event) {
 | 
					 | 
				
			||||||
				treeViewer.getSelection();
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
			
 | 
					 | 
				
			||||||
		});
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		// 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(Messages.TransactionDetails_1);
 | 
					 | 
				
			||||||
		col1.getColumn().setResizable(true);
 | 
					 | 
				
			||||||
		col1.setLabelProvider(new DelegatingStyledCellLabelProvider(new AttributeLabelProvider(AttributeLabelProvider.NAME)));
 | 
					 | 
				
			||||||
		col1.getColumn().addSelectionListener(new SelectionAdapter() {
 | 
					 | 
				
			||||||
			public void widgetSelected(SelectionEvent event) {
 | 
					 | 
				
			||||||
				((TxAttributeViewerSorter) treeViewer.getComparator()).doSort(COLUMN_FIRST);
 | 
					 | 
				
			||||||
				treeViewer.refresh();
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
		});
 | 
					 | 
				
			||||||
		// Add the type column
 | 
					 | 
				
			||||||
		col2 = new TreeViewerColumn(treeViewer, SWT.NONE);
 | 
					 | 
				
			||||||
		col2.getColumn().setText(Messages.TransactionDetails_2);
 | 
					 | 
				
			||||||
		col2.getColumn().setResizable(true);
 | 
					 | 
				
			||||||
		col2.setLabelProvider(new DelegatingStyledCellLabelProvider(new AttributeLabelProvider(AttributeLabelProvider.TYPE)));
 | 
					 | 
				
			||||||
		col2.getColumn().addSelectionListener(new SelectionAdapter() {
 | 
					 | 
				
			||||||
			public void widgetSelected(SelectionEvent event) {
 | 
					 | 
				
			||||||
				((TxAttributeViewerSorter) treeViewer.getComparator()).doSort(COLUMN_SECOND);
 | 
					 | 
				
			||||||
				treeViewer.refresh();
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
		});
 | 
					 | 
				
			||||||
		// Add the value column
 | 
					 | 
				
			||||||
		col3 = new TreeViewerColumn(treeViewer, SWT.NONE);
 | 
					 | 
				
			||||||
		col3.getColumn().setText(Messages.TransactionDetails_3);
 | 
					 | 
				
			||||||
		col3.getColumn().setResizable(true);
 | 
					 | 
				
			||||||
		col3.setLabelProvider(new DelegatingStyledCellLabelProvider(new AttributeLabelProvider(AttributeLabelProvider.VALUE)));
 | 
					 | 
				
			||||||
		col3.getColumn().addSelectionListener(new SelectionAdapter() {
 | 
					 | 
				
			||||||
			public void widgetSelected(SelectionEvent event) {
 | 
					 | 
				
			||||||
				((TxAttributeViewerSorter) treeViewer.getComparator()).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;
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	public void setInput(Object object) {
 | 
					 | 
				
			||||||
		if(object instanceof ITx){
 | 
					 | 
				
			||||||
			TreeItem obj = treeViewer.getTree().getTopItem();
 | 
					 | 
				
			||||||
			Rectangle bounds = null;
 | 
					 | 
				
			||||||
			if(obj!=null) bounds=obj.getBounds();
 | 
					 | 
				
			||||||
			treeViewer.setInput(object);
 | 
					 | 
				
			||||||
			if(bounds!=null) {
 | 
					 | 
				
			||||||
				TreeItem ti =  treeViewer.getTree().getItem (new Point(bounds.x, bounds.y));
 | 
					 | 
				
			||||||
				treeViewer.getTree().setTopItem(ti);
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
		} else {
 | 
					 | 
				
			||||||
			treeViewer.setInput(null);
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
		
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	/**
 | 
					 | 
				
			||||||
	 * 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) {
 | 
					 | 
				
			||||||
				setInput(((IStructuredSelection)selection).getFirstElement());			
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	/**
 | 
					 | 
				
			||||||
	 * Time to string.
 | 
					 | 
				
			||||||
	 *
 | 
					 | 
				
			||||||
	 * @param time the time
 | 
					 | 
				
			||||||
	 * @return the string
 | 
					 | 
				
			||||||
	 */
 | 
					 | 
				
			||||||
	String timeToString(Long time){
 | 
					 | 
				
			||||||
		return waveformViewerPart.getScaledTime(time);
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	/**
 | 
					 | 
				
			||||||
	 * Tx to string.
 | 
					 | 
				
			||||||
	 *
 | 
					 | 
				
			||||||
	 * @param tx the tx
 | 
					 | 
				
			||||||
	 * @return the string
 | 
					 | 
				
			||||||
	 */
 | 
					 | 
				
			||||||
	String txToString(ITx tx){
 | 
					 | 
				
			||||||
		StringBuilder sb = new StringBuilder();
 | 
					 | 
				
			||||||
		sb.append("tx#").append(tx.getId()).append("[").append(timeToString(tx.getBeginTime())). //$NON-NLS-1$ //$NON-NLS-2$
 | 
					 | 
				
			||||||
			append(" - ").append(timeToString(tx.getEndTime())).append("]"); //$NON-NLS-1$ //$NON-NLS-2$
 | 
					 | 
				
			||||||
		return sb.toString();
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	
 | 
					 | 
				
			||||||
	/**
 | 
					 | 
				
			||||||
	 * The Class TxAttributeViewerSorter.
 | 
					 | 
				
			||||||
	 */
 | 
					 | 
				
			||||||
	class TxAttributeViewerSorter extends ViewerComparator {
 | 
					 | 
				
			||||||
		
 | 
					 | 
				
			||||||
		/** The Constant ASCENDING. */
 | 
					 | 
				
			||||||
		private static final int ASCENDING = 0;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		/** The Constant DESCENDING. */
 | 
					 | 
				
			||||||
		private static final int DESCENDING = 1;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		/** The column. */
 | 
					 | 
				
			||||||
		private int column;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		/** The direction. */
 | 
					 | 
				
			||||||
		private int direction;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		/**
 | 
					 | 
				
			||||||
		 * Does the sort. If it's a different column from the previous sort, do an
 | 
					 | 
				
			||||||
		 * ascending sort. If it's the same column as the last sort, toggle the sort
 | 
					 | 
				
			||||||
		 * direction.
 | 
					 | 
				
			||||||
		 *
 | 
					 | 
				
			||||||
		 * @param column the column
 | 
					 | 
				
			||||||
		 */
 | 
					 | 
				
			||||||
		public void doSort(int column) {
 | 
					 | 
				
			||||||
			if (column == this.column) {
 | 
					 | 
				
			||||||
				// Same column as last sort; toggle the direction
 | 
					 | 
				
			||||||
				direction = 1 - direction;
 | 
					 | 
				
			||||||
			} else {
 | 
					 | 
				
			||||||
				// New column; do an ascending sort
 | 
					 | 
				
			||||||
				this.column = column;
 | 
					 | 
				
			||||||
				direction = ASCENDING;
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		/**
 | 
					 | 
				
			||||||
		 * Compares the object for sorting.
 | 
					 | 
				
			||||||
		 *
 | 
					 | 
				
			||||||
		 * @param viewer the viewer
 | 
					 | 
				
			||||||
		 * @param e1 the e1
 | 
					 | 
				
			||||||
		 * @param e2 the e2
 | 
					 | 
				
			||||||
		 * @return the int
 | 
					 | 
				
			||||||
		 */
 | 
					 | 
				
			||||||
		public int compare(Viewer viewer, Object e1, Object e2) {
 | 
					 | 
				
			||||||
			int rc = 0;
 | 
					 | 
				
			||||||
			if(e1 instanceof ITxAttribute && e2 instanceof ITxAttribute){
 | 
					 | 
				
			||||||
				ITxAttribute p1 = (ITxAttribute) e1;
 | 
					 | 
				
			||||||
				ITxAttribute p2 = (ITxAttribute) e2;
 | 
					 | 
				
			||||||
				// Determine which column and do the appropriate sort
 | 
					 | 
				
			||||||
				switch (column) {
 | 
					 | 
				
			||||||
				case COLUMN_FIRST:
 | 
					 | 
				
			||||||
					rc = getComparator().compare(p1.getName(), p2.getName());
 | 
					 | 
				
			||||||
					break;
 | 
					 | 
				
			||||||
				case COLUMN_SECOND:
 | 
					 | 
				
			||||||
					rc = getComparator().compare(p1.getDataType().name(), p2.getDataType().name());
 | 
					 | 
				
			||||||
					break;
 | 
					 | 
				
			||||||
				case COLUMN_THIRD:
 | 
					 | 
				
			||||||
					rc = getComparator().compare(p1.getValue().toString(), p2.getValue().toString());
 | 
					 | 
				
			||||||
					break;
 | 
					 | 
				
			||||||
				}
 | 
					 | 
				
			||||||
				// If descending order, flip the direction
 | 
					 | 
				
			||||||
				if (direction == DESCENDING) rc = -rc;
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
			return rc;
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	/**
 | 
					 | 
				
			||||||
	 * The Class TxAttributeFilter.
 | 
					 | 
				
			||||||
	 */
 | 
					 | 
				
			||||||
	class TxAttributeFilter extends ViewerFilter {
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		/** The search string. */
 | 
					 | 
				
			||||||
		private String searchString;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		/**
 | 
					 | 
				
			||||||
		 * Sets the search text.
 | 
					 | 
				
			||||||
		 *
 | 
					 | 
				
			||||||
		 * @param s the new search text
 | 
					 | 
				
			||||||
		 */
 | 
					 | 
				
			||||||
		public void setSearchText(String s) {
 | 
					 | 
				
			||||||
			this.searchString = ".*" + s + ".*"; //$NON-NLS-1$ //$NON-NLS-2$
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		/* (non-Javadoc)
 | 
					 | 
				
			||||||
		 * @see org.eclipse.jface.viewers.ViewerFilter#select(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)
 | 
					 | 
				
			||||||
		 */
 | 
					 | 
				
			||||||
		@Override
 | 
					 | 
				
			||||||
		public boolean select(Viewer viewer, Object parentElement, Object element) {
 | 
					 | 
				
			||||||
			if (searchString == null || searchString.length() == 0) {
 | 
					 | 
				
			||||||
				return true;
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
			if(element instanceof 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 Messages.TransactionDetails_10;
 | 
					 | 
				
			||||||
			case ATTRS:	     return Messages.TransactionDetails_11;
 | 
					 | 
				
			||||||
			case IN_REL:     return Messages.TransactionDetails_12;
 | 
					 | 
				
			||||||
			case OUT_REL:    return Messages.TransactionDetails_13;
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
			return ""; //$NON-NLS-1$
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	/**
 | 
					 | 
				
			||||||
	 * The Class TransactionTreeContentProvider.
 | 
					 | 
				
			||||||
	 */
 | 
					 | 
				
			||||||
	class TransactionTreeContentProvider implements ITreeContentProvider {
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		/* (non-Javadoc)
 | 
					 | 
				
			||||||
		 * @see org.eclipse.jface.viewers.IContentProvider#dispose()
 | 
					 | 
				
			||||||
		 */
 | 
					 | 
				
			||||||
		@Override
 | 
					 | 
				
			||||||
		public void dispose() {	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		/* (non-Javadoc)
 | 
					 | 
				
			||||||
		 * @see org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)
 | 
					 | 
				
			||||||
		 */
 | 
					 | 
				
			||||||
		@Override
 | 
					 | 
				
			||||||
		public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		/* (non-Javadoc)
 | 
					 | 
				
			||||||
		 * @see org.eclipse.jface.viewers.ITreeContentProvider#getElements(java.lang.Object)
 | 
					 | 
				
			||||||
		 */
 | 
					 | 
				
			||||||
		@Override
 | 
					 | 
				
			||||||
		public Object[] getElements(Object element) {
 | 
					 | 
				
			||||||
			return new Object[]{
 | 
					 | 
				
			||||||
					new TreeNode((ITx)element, Type.PROPS),  
 | 
					 | 
				
			||||||
					new TreeNode((ITx)element, Type.ATTRS),  
 | 
					 | 
				
			||||||
					new TreeNode((ITx)element, Type.IN_REL),
 | 
					 | 
				
			||||||
					new TreeNode((ITx)element, Type.OUT_REL)
 | 
					 | 
				
			||||||
			};
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		/* (non-Javadoc)
 | 
					 | 
				
			||||||
		 * @see org.eclipse.jface.viewers.ITreeContentProvider#getChildren(java.lang.Object)
 | 
					 | 
				
			||||||
		 */
 | 
					 | 
				
			||||||
		@Override
 | 
					 | 
				
			||||||
		public Object[] getChildren(Object element) {
 | 
					 | 
				
			||||||
			if(element instanceof TreeNode){
 | 
					 | 
				
			||||||
				TreeNode propertyHolder=(TreeNode) element;
 | 
					 | 
				
			||||||
				if(propertyHolder.type == Type.PROPS){
 | 
					 | 
				
			||||||
					return new Object[][]{
 | 
					 | 
				
			||||||
						{Messages.TransactionDetails_1, Messages.TransactionDetails_16, propertyHolder.element.getStream().getFullName()},
 | 
					 | 
				
			||||||
						{Messages.TransactionDetails_2, Messages.TransactionDetails_16, propertyHolder.element.getGenerator().getName()},
 | 
					 | 
				
			||||||
						{Messages.TransactionDetails_19, Messages.TransactionDetails_20, timeToString(propertyHolder.element.getBeginTime())},
 | 
					 | 
				
			||||||
						{Messages.TransactionDetails_21, Messages.TransactionDetails_20, timeToString(propertyHolder.element.getEndTime())}
 | 
					 | 
				
			||||||
					};
 | 
					 | 
				
			||||||
				}else if(propertyHolder.type == Type.ATTRS)
 | 
					 | 
				
			||||||
					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(Messages.TransactionDetails_4);
 | 
					 | 
				
			||||||
				}else if(element instanceof Object[]){
 | 
					 | 
				
			||||||
					Object[] elements = (Object[]) element;
 | 
					 | 
				
			||||||
					return new StyledString(elements[field].toString());
 | 
					 | 
				
			||||||
				} else 
 | 
					 | 
				
			||||||
					return new StyledString(element.toString());
 | 
					 | 
				
			||||||
			case TYPE:
 | 
					 | 
				
			||||||
				if (element instanceof ITxAttribute) {
 | 
					 | 
				
			||||||
					ITxAttribute attribute = (ITxAttribute) element;
 | 
					 | 
				
			||||||
					return new StyledString(attribute.getDataType().toString());
 | 
					 | 
				
			||||||
				}else if(element instanceof Object[]){
 | 
					 | 
				
			||||||
					Object[] elements = (Object[]) element;
 | 
					 | 
				
			||||||
					return new StyledString(elements[field].toString());
 | 
					 | 
				
			||||||
				}else 
 | 
					 | 
				
			||||||
					return new StyledString("");					 //$NON-NLS-1$
 | 
					 | 
				
			||||||
			default:
 | 
					 | 
				
			||||||
				if (element instanceof ITxAttribute) {
 | 
					 | 
				
			||||||
					ITxAttribute attribute = (ITxAttribute) element;
 | 
					 | 
				
			||||||
					String value = attribute.getValue().toString();
 | 
					 | 
				
			||||||
					if((DataType.UNSIGNED == attribute.getDataType() || DataType.INTEGER==attribute.getDataType()) && !"0".equals(value)) {
 | 
					 | 
				
			||||||
						try {
 | 
					 | 
				
			||||||
							value = attribute.getValue().toString() + " [0x"+Long.toHexString(Long.parseLong(attribute.getValue().toString()))+"]";
 | 
					 | 
				
			||||||
						} catch(NumberFormatException e) { }
 | 
					 | 
				
			||||||
					}
 | 
					 | 
				
			||||||
					return new StyledString(value);
 | 
					 | 
				
			||||||
				}else if(element instanceof Object[]){
 | 
					 | 
				
			||||||
					Object[] elements = (Object[]) element;
 | 
					 | 
				
			||||||
					return new StyledString(elements[field].toString());
 | 
					 | 
				
			||||||
				} else if(element instanceof ITx){
 | 
					 | 
				
			||||||
					return new StyledString(txToString((ITx) element));
 | 
					 | 
				
			||||||
				}else 
 | 
					 | 
				
			||||||
					return new StyledString("");					 //$NON-NLS-1$
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							@@ -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"; //$NON-NLS-1$
 | 
					 | 
				
			||||||
	
 | 
					 | 
				
			||||||
	/** The Constant DATABASE_RELOAD. */
 | 
					 | 
				
			||||||
	public static final String DATABASE_RELOAD="databaseReload"; //$NON-NLS-1$
 | 
					 | 
				
			||||||
	
 | 
					 | 
				
			||||||
	/** The Constant LINE_COLOR. */
 | 
					 | 
				
			||||||
	public static final String LINE_COLOR="LINE_COLOR"; //$NON-NLS-1$
 | 
					 | 
				
			||||||
	
 | 
					 | 
				
			||||||
	/** The Constant LINE_HIGHLITE_COLOR. */
 | 
					 | 
				
			||||||
	public static final String LINE_HIGHLITE_COLOR="LINE_HIGHLITE_COLOR"; //$NON-NLS-1$
 | 
					 | 
				
			||||||
	
 | 
					 | 
				
			||||||
	/** The Constant TRACK_BG_EVEN_COLOR. */
 | 
					 | 
				
			||||||
	public static final String TRACK_BG_EVEN_COLOR="TRACK_BG_EVEN_COLOR"; //$NON-NLS-1$
 | 
					 | 
				
			||||||
	
 | 
					 | 
				
			||||||
	/** The Constant TRACK_BG_ODD_COLOR. */
 | 
					 | 
				
			||||||
	public static final String TRACK_BG_ODD_COLOR="TRACK_BG_ODD_COLOR"; //$NON-NLS-1$
 | 
					 | 
				
			||||||
	
 | 
					 | 
				
			||||||
	/** The Constant TRACK_BG_HIGHLITE_COLOR. */
 | 
					 | 
				
			||||||
	public static final String TRACK_BG_HIGHLITE_COLOR="TRACK_BG_HIGHLITE_COLOR";  //$NON-NLS-1$
 | 
					 | 
				
			||||||
	
 | 
					 | 
				
			||||||
	/** The Constant TX_BG_COLOR. */
 | 
					 | 
				
			||||||
	public static final String TX_BG_COLOR="TX_BG_COLOR"; //$NON-NLS-1$
 | 
					 | 
				
			||||||
	
 | 
					 | 
				
			||||||
	/** The Constant TX_BG_HIGHLITE_COLOR. */
 | 
					 | 
				
			||||||
	public static final String TX_BG_HIGHLITE_COLOR="TX_BG_HIGHLITE_COLOR"; //$NON-NLS-1$
 | 
					 | 
				
			||||||
	
 | 
					 | 
				
			||||||
	/** The Constant TX_BORDER_COLOR. */
 | 
					 | 
				
			||||||
	public static final String TX_BORDER_COLOR="TX_BORDER_COLOR"; //$NON-NLS-1$
 | 
					 | 
				
			||||||
	
 | 
					 | 
				
			||||||
	/** The Constant SIGNAL0_COLOR. */
 | 
					 | 
				
			||||||
	public static final String SIGNAL0_COLOR="SIGNAL0_COLOR"; //$NON-NLS-1$
 | 
					 | 
				
			||||||
	
 | 
					 | 
				
			||||||
	/** The Constant SIGNAL1_COLOR. */
 | 
					 | 
				
			||||||
	public static final String SIGNAL1_COLOR="SIGNAL1_COLOR"; //$NON-NLS-1$
 | 
					 | 
				
			||||||
	
 | 
					 | 
				
			||||||
	/** The Constant SIGNALZ_COLOR. */
 | 
					 | 
				
			||||||
	public static final String SIGNALZ_COLOR="SIGNALZ_COLOR"; //$NON-NLS-1$
 | 
					 | 
				
			||||||
	
 | 
					 | 
				
			||||||
	/** The Constant SIGNALX_COLOR. */
 | 
					 | 
				
			||||||
	public static final String SIGNALX_COLOR="SIGNALX_COLOR"; //$NON-NLS-1$
 | 
					 | 
				
			||||||
	
 | 
					 | 
				
			||||||
	/** The Constant SIGNAL_TEXT_COLOR. */
 | 
					 | 
				
			||||||
	public static final String SIGNAL_TEXT_COLOR="SIGNAL_TEXT_COLOR";  //$NON-NLS-1$
 | 
					 | 
				
			||||||
	
 | 
					 | 
				
			||||||
	/** The Constant CURSOR_COLOR. */
 | 
					 | 
				
			||||||
	public static final String CURSOR_COLOR="CURSOR_COLOR"; //$NON-NLS-1$
 | 
					 | 
				
			||||||
	
 | 
					 | 
				
			||||||
	/** The Constant CURSOR_DRAG_COLOR. */
 | 
					 | 
				
			||||||
	public static final String CURSOR_DRAG_COLOR="CURSOR_DRAG_COLOR"; //$NON-NLS-1$
 | 
					 | 
				
			||||||
	
 | 
					 | 
				
			||||||
	/** The Constant CURSOR_TEXT_COLOR. */
 | 
					 | 
				
			||||||
	public static final String CURSOR_TEXT_COLOR="CURSOR_TEXT_COLOR"; //$NON-NLS-1$
 | 
					 | 
				
			||||||
	
 | 
					 | 
				
			||||||
	/** The Constant MARKER_COLOR. */
 | 
					 | 
				
			||||||
	public static final String MARKER_COLOR="MARKER_COLOR"; //$NON-NLS-1$
 | 
					 | 
				
			||||||
	
 | 
					 | 
				
			||||||
	/** The Constant MARKER_TEXT_COLOR. */
 | 
					 | 
				
			||||||
	public static final String MARKER_TEXT_COLOR="MARKER_TEXT_COLOR"; //$NON-NLS-1$
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
@@ -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.BitVector;
 | 
					 | 
				
			||||||
import com.minres.scviewer.database.IHierNode;
 | 
					 | 
				
			||||||
import com.minres.scviewer.database.ISignal;
 | 
					 | 
				
			||||||
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"); //$NON-NLS-1$ //$NON-NLS-2$
 | 
					 | 
				
			||||||
		database=ResourceManager.getPluginImage("com.minres.scviewer.e4.application", "icons/database.png"); //$NON-NLS-1$ //$NON-NLS-2$
 | 
					 | 
				
			||||||
		stream=ResourceManager.getPluginImage("com.minres.scviewer.e4.application", "icons/stream.png"); //$NON-NLS-1$ //$NON-NLS-2$
 | 
					 | 
				
			||||||
		folder=ResourceManager.getPluginImage("com.minres.scviewer.e4.application", "icons/folder.png"); //$NON-NLS-1$ //$NON-NLS-2$
 | 
					 | 
				
			||||||
		signal=ResourceManager.getPluginImage("com.minres.scviewer.e4.application", "icons/signal.png"); //$NON-NLS-1$ //$NON-NLS-2$
 | 
					 | 
				
			||||||
		wave=ResourceManager.getPluginImage("com.minres.scviewer.e4.application", "icons/wave.png"); //$NON-NLS-1$ //$NON-NLS-2$
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	/* (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 BitVector && ((BitVector)o).getWidth()==1)
 | 
					 | 
				
			||||||
				return signal;
 | 
					 | 
				
			||||||
			else 
 | 
					 | 
				
			||||||
				return wave;
 | 
					 | 
				
			||||||
		}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();
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
@@ -1,417 +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;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
import com.minres.scviewer.e4.application.Messages;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/**
 | 
					 | 
				
			||||||
 * 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(Messages.ResourceManager_0);
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
		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(createCachedImageDataProvider(baseImage), 0, 0);
 | 
					 | 
				
			||||||
					if (corner == TOP_LEFT) {
 | 
					 | 
				
			||||||
						drawImage(createCachedImageDataProvider(decorator), 0, 0);
 | 
					 | 
				
			||||||
					} else if (corner == TOP_RIGHT) {
 | 
					 | 
				
			||||||
						drawImage(createCachedImageDataProvider(decorator), bib.width - dib.width, 0);
 | 
					 | 
				
			||||||
					} else if (corner == BOTTOM_LEFT) {
 | 
					 | 
				
			||||||
						drawImage(createCachedImageDataProvider(decorator), 0, bib.height - dib.height);
 | 
					 | 
				
			||||||
					} else if (corner == BOTTOM_RIGHT) {
 | 
					 | 
				
			||||||
						drawImage(createCachedImageDataProvider(decorator), 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();
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
@@ -1,144 +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="2.0.2.qualifier" useFeatures="false" includeLaunchers="true">
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
   <configIni use="default">
 | 
					 | 
				
			||||||
   </configIni>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
   <launcherArgs>
 | 
					 | 
				
			||||||
      <programArgs>-clearPersistedState -data @none
 | 
					 | 
				
			||||||
      </programArgs>
 | 
					 | 
				
			||||||
      <vmArgs>-Xmx2G
 | 
					 | 
				
			||||||
      </vmArgs>
 | 
					 | 
				
			||||||
      <vmArgsMac>-XstartOnFirstThread -Dorg.eclipse.swt.internal.carbon.smallFonts
 | 
					 | 
				
			||||||
      </vmArgsMac>
 | 
					 | 
				
			||||||
   </launcherArgs>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
   <windowImages/>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
   <launcher name="scviewer">
 | 
					 | 
				
			||||||
      <linux icon="icons/SCViewer_512x512.xpm"/>
 | 
					 | 
				
			||||||
      <macosx icon="icons/SCViewer.icns"/>
 | 
					 | 
				
			||||||
      <win useIco="true">
 | 
					 | 
				
			||||||
         <ico path="icons/SCViewer.ico"/>
 | 
					 | 
				
			||||||
         <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>
 | 
					 | 
				
			||||||
      <linux include="false">org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8</linux>
 | 
					 | 
				
			||||||
      <macos include="false">org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8</macos>
 | 
					 | 
				
			||||||
      <windows include="false">org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8</windows>
 | 
					 | 
				
			||||||
   </vm>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
   <license>
 | 
					 | 
				
			||||||
        <url>http://www.eclipse.org/legal/epl-v10.html</url>
 | 
					 | 
				
			||||||
   </license>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
   <plugins>
 | 
					 | 
				
			||||||
      <plugin id="com.google.guava"/>
 | 
					 | 
				
			||||||
      <plugin id="com.ibm.icu"/>
 | 
					 | 
				
			||||||
      <plugin id="com.minres.scviewer.database"/>
 | 
					 | 
				
			||||||
      <plugin id="com.minres.scviewer.database.leveldb"/>
 | 
					 | 
				
			||||||
      <plugin id="com.minres.scviewer.database.sqlite"/>
 | 
					 | 
				
			||||||
      <plugin id="com.minres.scviewer.database.text"/>
 | 
					 | 
				
			||||||
      <plugin id="com.minres.scviewer.database.ui"/>
 | 
					 | 
				
			||||||
      <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="org.apache.batik.constants"/>
 | 
					 | 
				
			||||||
      <plugin id="org.apache.batik.css"/>
 | 
					 | 
				
			||||||
      <plugin id="org.apache.batik.i18n"/>
 | 
					 | 
				
			||||||
      <plugin id="org.apache.batik.util"/>
 | 
					 | 
				
			||||||
      <plugin id="org.apache.commons.io"/>
 | 
					 | 
				
			||||||
      <plugin id="org.apache.commons.jxpath"/>
 | 
					 | 
				
			||||||
      <plugin id="org.apache.commons.logging"/>
 | 
					 | 
				
			||||||
      <plugin id="org.apache.felix.scr"/>
 | 
					 | 
				
			||||||
      <plugin id="org.apache.xmlgraphics"/>
 | 
					 | 
				
			||||||
      <plugin id="org.codehaus.groovy"/>
 | 
					 | 
				
			||||||
      <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.linux.x86_64" fragment="true"/>
 | 
					 | 
				
			||||||
      <plugin id="org.eclipse.core.filesystem.macosx" fragment="true"/>
 | 
					 | 
				
			||||||
      <plugin id="org.eclipse.core.filesystem.win32.x86_64" fragment="true"/>
 | 
					 | 
				
			||||||
      <plugin id="org.eclipse.core.jobs"/>
 | 
					 | 
				
			||||||
      <plugin id="org.eclipse.core.resources"/>
 | 
					 | 
				
			||||||
      <plugin id="org.eclipse.core.resources.win32.x86_64" fragment="true"/>
 | 
					 | 
				
			||||||
      <plugin id="org.eclipse.core.runtime"/>
 | 
					 | 
				
			||||||
      <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.di.extensions.supplier"/>
 | 
					 | 
				
			||||||
      <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.swt.gtk" fragment="true"/>
 | 
					 | 
				
			||||||
      <plugin id="org.eclipse.e4.ui.widgets"/>
 | 
					 | 
				
			||||||
      <plugin id="org.eclipse.e4.ui.workbench"/>
 | 
					 | 
				
			||||||
      <plugin id="org.eclipse.e4.ui.workbench.addons.swt"/>
 | 
					 | 
				
			||||||
      <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.osgi.util"/>
 | 
					 | 
				
			||||||
      <plugin id="org.eclipse.pde.ds.lib"/>
 | 
					 | 
				
			||||||
      <plugin id="org.eclipse.swt"/>
 | 
					 | 
				
			||||||
      <plugin id="org.eclipse.swt.cocoa.macosx.x86_64" fragment="true"/>
 | 
					 | 
				
			||||||
      <plugin id="org.eclipse.swt.gtk.linux.x86_64" fragment="true"/>
 | 
					 | 
				
			||||||
      <plugin id="org.eclipse.swt.win32.win32.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>
 | 
					 | 
				
			||||||
							
								
								
									
										1
									
								
								com.minres.scviewer.parent/.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								com.minres.scviewer.parent/.gitignore
									
									
									
									
										vendored
									
									
								
							@@ -1 +0,0 @@
 | 
				
			|||||||
/workspace/
 | 
					 | 
				
			||||||
@@ -1,151 +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>2.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.leveldb</module>
 | 
					 | 
				
			||||||
		<module>../com.minres.scviewer.database.test</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/photon</url>
 | 
					 | 
				
			||||||
		</repository>
 | 
					 | 
				
			||||||
		<repository>
 | 
					 | 
				
			||||||
			<id>GRECLIPSE</id>
 | 
					 | 
				
			||||||
			<layout>p2</layout>
 | 
					 | 
				
			||||||
			<url>http://dist.springsource.org/snapshot/GRECLIPSE/e4.8</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>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
			<plugin>
 | 
					 | 
				
			||||||
				<groupId>org.eclipse.tycho</groupId>
 | 
					 | 
				
			||||||
				<artifactId>tycho-versions-plugin</artifactId>
 | 
					 | 
				
			||||||
				<version>${tycho-version}</version>
 | 
					 | 
				
			||||||
			</plugin>
 | 
					 | 
				
			||||||
		</plugins>
 | 
					 | 
				
			||||||
	</build>
 | 
					 | 
				
			||||||
</project>
 | 
					 | 
				
			||||||
@@ -1,22 +0,0 @@
 | 
				
			|||||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?><?pde version="3.8"?><target name="Neon Platform" sequenceNumber="138">
 | 
					 | 
				
			||||||
<locations>
 | 
					 | 
				
			||||||
<location includeAllPlatforms="false" includeConfigurePhase="true" includeMode="planner" includeSource="true" type="InstallableUnit">
 | 
					 | 
				
			||||||
<unit id="org.eclipse.equinox.executable.feature.group" version="3.6.300.v20161122-1740"/>
 | 
					 | 
				
			||||||
<unit id="org.eclipse.platform.sdk" version="4.6.2.M20161124-1400"/>
 | 
					 | 
				
			||||||
<unit id="org.eclipse.rcp.sdk.id" version="4.6.2.M20161124-1400"/>
 | 
					 | 
				
			||||||
<unit id="org.eclipse.rcptt.core.feature.group" version="2.1.0.201604261352"/>
 | 
					 | 
				
			||||||
<repository location="http://download.eclipse.org/releases/neon"/>
 | 
					 | 
				
			||||||
</location>
 | 
					 | 
				
			||||||
<location includeAllPlatforms="false" includeConfigurePhase="true" includeMode="planner" includeSource="true" type="InstallableUnit">
 | 
					 | 
				
			||||||
<unit id="org.codehaus.groovy24.feature.feature.group" version="2.9.3.xx-201806261157-e46"/>
 | 
					 | 
				
			||||||
<repository location="http://dist.springsource.org/snapshot/GRECLIPSE/e4.6"/>
 | 
					 | 
				
			||||||
</location>
 | 
					 | 
				
			||||||
</locations>
 | 
					 | 
				
			||||||
<environment>
 | 
					 | 
				
			||||||
<arch>x86_64</arch>
 | 
					 | 
				
			||||||
<nl>de_DE</nl>
 | 
					 | 
				
			||||||
</environment>
 | 
					 | 
				
			||||||
<launcherArgs>
 | 
					 | 
				
			||||||
<vmArgs>-Dosgi.requiredJavaVersion=1.7 -XX:MaxPermSize=256 -Xms40m -Xmx2G </vmArgs>
 | 
					 | 
				
			||||||
</launcherArgs>
 | 
					 | 
				
			||||||
</target>
 | 
					 | 
				
			||||||
Some files were not shown because too many files have changed in this diff Show More
		Reference in New Issue
	
	Block a user