[WIP ]reorganized dir structure
7
plugins/com.minres.scviewer.e4.application/.classpath
Normal file
@ -0,0 +1,7 @@
|
||||
<?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>
|
2
plugins/com.minres.scviewer.e4.application/.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
/bin/
|
||||
/target/
|
39
plugins/com.minres.scviewer.e4.application/.project
Normal file
@ -0,0 +1,39 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>com.minres.scviewer.e4.application</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.pde.ManifestBuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.pde.SchemaBuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.pde.ds.core.builder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.m2e.core.maven2Builder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.m2e.core.maven2Nature</nature>
|
||||
<nature>org.eclipse.pde.PluginNature</nature>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
@ -0,0 +1,12 @@
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||
org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
|
||||
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
|
||||
org.eclipse.jdt.core.compiler.compliance=1.8
|
||||
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
|
||||
org.eclipse.jdt.core.compiler.debug.localVariable=generate
|
||||
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
|
||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.source=1.8
|
@ -0,0 +1,2 @@
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.ltk.core.refactoring.enable.project.refactoring.history=false
|
@ -0,0 +1,4 @@
|
||||
activeProfiles=
|
||||
eclipse.preferences.version=1
|
||||
resolveWorkspaceProjects=true
|
||||
version=1
|
@ -0,0 +1,3 @@
|
||||
eclipse.preferences.version=1
|
||||
pluginProject.extensions=false
|
||||
resolve.requirebundle=false
|
304
plugins/com.minres.scviewer.e4.application/Application.e4xmi
Normal file
@ -0,0 +1,304 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<application:Application xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:advanced="http://www.eclipse.org/ui/2010/UIModel/application/ui/advanced" xmlns:application="http://www.eclipse.org/ui/2010/UIModel/application" xmlns:basic="http://www.eclipse.org/ui/2010/UIModel/application/ui/basic" xmlns:menu="http://www.eclipse.org/ui/2010/UIModel/application/ui/menu" xmlns:ui="http://www.eclipse.org/ui/2010/UIModel/application/ui" xmi:id="_95PfsHNmEeWBq8z1Dv39LA" elementId="org.eclipse.e4.ide.application" bindingContexts="_95PfuXNmEeWBq8z1Dv39LA">
|
||||
<children xsi:type="basic:TrimmedWindow" xmi:id="_95PfsXNmEeWBq8z1Dv39LA" label="SC Viewer" bindingContexts="_95PfunNmEeWBq8z1Dv39LA" width="980" height="700">
|
||||
<children xsi:type="advanced:PerspectiveStack" xmi:id="_95QGxnNmEeWBq8z1Dv39LA">
|
||||
<children xsi:type="advanced:Perspective" xmi:id="_95QGx3NmEeWBq8z1Dv39LA">
|
||||
<children xsi:type="basic:PartSashContainer" xmi:id="_95QGyHNmEeWBq8z1Dv39LA" horizontal="true">
|
||||
<children xsi:type="basic:Part" xmi:id="_95QGynNmEeWBq8z1Dv39LA" elementId="com.minres.scviewer.e4.application.parts.DesignBrowser" containerData="2000" contributionURI="bundleclass://com.minres.scviewer.e4.application/com.minres.scviewer.e4.application.parts.DesignBrowser" label="Design Browser" bindingContexts="_iQ3kQGVmEeqSQM-A6dw9ig">
|
||||
<handlers xmi:id="_JIWOYIq-EeWid7xO48ZBXw" elementId="com.minres.scviewer.e4.application.handler.addWaveformCommand" contributionURI="bundleclass://com.minres.scviewer.e4.application/com.minres.scviewer.e4.application.handlers.AddWaveformHandler" command="_2PehEHr9EeWVM_sKoXvptg"/>
|
||||
<menus xsi:type="menu:PopupMenu" xmi:id="_HvUl8Iq-EeWid7xO48ZBXw" elementId="com.minres.scviewer.e4.application.parts.DesignBrowser.popupmenu">
|
||||
<children xsi:type="menu:HandledMenuItem" xmi:id="_HvUl8Yq-EeWid7xO48ZBXw" elementId="com.minres.scviewer.e4.application.handledmenuitem.append" label="Append after" iconURI="platform:/plugin/com.minres.scviewer.e4.application/icons/append_wave.png" command="_2PehEHr9EeWVM_sKoXvptg">
|
||||
<parameters xmi:id="_HvUl8oq-EeWid7xO48ZBXw" elementId="com.minres.scviewer.e4.application.parameter.21" name="com.minres.scviewer.e4.application.command.addwaveform.where" value="after"/>
|
||||
<parameters xmi:id="_HvUl84q-EeWid7xO48ZBXw" elementId="com.minres.scviewer.e4.application.parameter.25" name="com.minres.scviewer.e4.application.command.addwaveform.all" value="false"/>
|
||||
</children>
|
||||
<children xsi:type="menu:HandledMenuItem" xmi:id="_HvUl9Iq-EeWid7xO48ZBXw" elementId="com.minres.scviewer.e4.application.handledmenuitem.insertbefore" label="Insert before" iconURI="platform:/plugin/com.minres.scviewer.e4.application/icons/insert_wave.png" command="_2PehEHr9EeWVM_sKoXvptg">
|
||||
<parameters xmi:id="_HvUl9Yq-EeWid7xO48ZBXw" elementId="com.minres.scviewer.e4.application.parameter.22" name="com.minres.scviewer.e4.application.command.addwaveform.where" value="before"/>
|
||||
<parameters xmi:id="_HvUl9oq-EeWid7xO48ZBXw" elementId="com.minres.scviewer.e4.application.parameter.26" name="com.minres.scviewer.e4.application.command.addwaveform.all" value="false"/>
|
||||
</children>
|
||||
<children xsi:type="menu:HandledMenuItem" xmi:id="_HvUl94q-EeWid7xO48ZBXw" elementId="com.minres.scviewer.e4.application.handledmenuitem.appendall" label="Append all" iconURI="platform:/plugin/com.minres.scviewer.e4.application/icons/append_all_waves.png" command="_2PehEHr9EeWVM_sKoXvptg">
|
||||
<parameters xmi:id="_HvUl-Iq-EeWid7xO48ZBXw" elementId="com.minres.scviewer.e4.application.parameter.23" name="com.minres.scviewer.e4.application.command.addwaveform.where" value="after"/>
|
||||
<parameters xmi:id="_HvUl-Yq-EeWid7xO48ZBXw" elementId="com.minres.scviewer.e4.application.parameter.27" name="com.minres.scviewer.e4.application.command.addwaveform.all" value="true"/>
|
||||
</children>
|
||||
<children xsi:type="menu:HandledMenuItem" xmi:id="_HvUl-oq-EeWid7xO48ZBXw" elementId="com.minres.scviewer.e4.application.handledmenuitem.insertall" label="Insert All" iconURI="platform:/plugin/com.minres.scviewer.e4.application/icons/insert_all_waves.png" command="_2PehEHr9EeWVM_sKoXvptg">
|
||||
<parameters xmi:id="_HvUl-4q-EeWid7xO48ZBXw" elementId="com.minres.scviewer.e4.application.parameter.24" name="com.minres.scviewer.e4.application.command.addwaveform.where" value="before"/>
|
||||
<parameters xmi:id="_HvUl_Iq-EeWid7xO48ZBXw" elementId="com.minres.scviewer.e4.application.parameter.28" name="com.minres.scviewer.e4.application.command.addwaveform.all" value="true"/>
|
||||
</children>
|
||||
</menus>
|
||||
</children>
|
||||
<children xsi:type="basic:PartSashContainer" xmi:id="_uT9BIHgtEeWwZ-9vrAR2UQ" elementId="" containerData="8000">
|
||||
<children xsi:type="basic:PartStack" xmi:id="_95QGyXNmEeWBq8z1Dv39LA" elementId="org.eclipse.editorss" containerData="7500">
|
||||
<tags>NoAutoCollapse</tags>
|
||||
</children>
|
||||
<children xsi:type="basic:Part" xmi:id="_vtfm8HgtEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.parts.WaveformDetails" containerData="2500" contributionURI="bundleclass://com.minres.scviewer.e4.application/com.minres.scviewer.e4.application.parts.TransactionDetails" label="Waveform Details"/>
|
||||
</children>
|
||||
</children>
|
||||
</children>
|
||||
</children>
|
||||
<children xsi:type="basic:Part" xmi:id="__VNlAIytEeWid7xO48ZBXw" elementId="com.minres.scviewer.e4.application.dialog.aboutscviewer" toBeRendered="false" visible="false" contributionURI="bundleclass://com.minres.scviewer.e4.application/com.minres.scviewer.e4.application.parts.AboutDialog" label="About SCViewer" bindingContexts="_95Pfu3NmEeWBq8z1Dv39LA"/>
|
||||
<mainMenu xmi:id="_95PfyXNmEeWBq8z1Dv39LA" elementId="menu:org.eclipse.ui.main.menu">
|
||||
<children xsi:type="menu:Menu" xmi:id="_95QGwHNmEeWBq8z1Dv39LA" elementId="com.minres.scviewer.e4.application.menu.file" label="File">
|
||||
<children xsi:type="menu:HandledMenuItem" xmi:id="_VJG3YHgvEeWwZ-9vrAR2UQ" elementId="" label="Open Database" iconURI="platform:/plugin/com.minres.scviewer.e4.application/icons/folder_database.png" mnemonics="M1+O" command="_95PfwHNmEeWBq8z1Dv39LA"/>
|
||||
<children xsi:type="menu:HandledMenuItem" xmi:id="_e7MOYJedEeW09eyIbHsdvg" elementId="" label="Load active tab settings" iconURI="platform:/plugin/com.minres.scviewer.e4.application/icons/folder_page.png" command="_7-AIMJebEeW09eyIbHsdvg">
|
||||
<parameters xmi:id="_4vtYgJehEeW09eyIbHsdvg" elementId="com.minres.scviewer.e4.application.parameter.30" name="com.minres.scviewer.e4.application.commandparameter.loadStore" value="load"/>
|
||||
</children>
|
||||
<children xsi:type="menu:HandledMenuItem" xmi:id="_95QGwnNmEeWBq8z1Dv39LA" label="Save active tab settings" iconURI="platform:/plugin/com.minres.scviewer.e4.application/icons/script_save.png" command="_7-AIMJebEeW09eyIbHsdvg">
|
||||
<parameters xmi:id="_61QIsJehEeW09eyIbHsdvg" elementId="com.minres.scviewer.e4.application.parameter.31" name="com.minres.scviewer.e4.application.commandparameter.loadStore" value="store"/>
|
||||
</children>
|
||||
<children xsi:type="menu:HandledMenuItem" xmi:id="_95QGw3NmEeWBq8z1Dv39LA" label="Quit" command="_95PfvHNmEeWBq8z1Dv39LA"/>
|
||||
</children>
|
||||
<children xsi:type="menu:Menu" xmi:id="_ZyHC0HgvEeWwZ-9vrAR2UQ" elementId="" label="Edit">
|
||||
<children xsi:type="menu:HandledMenuItem" xmi:id="_cPlx4HgvEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.handledmenuitem.delete" label="Delete" iconURI="platform:/plugin/com.minres.scviewer.e4.application/icons/cross.png" command="_WUZ2wHXHEeWwZ-9vrAR2UQ"/>
|
||||
</children>
|
||||
<children xsi:type="menu:Menu" xmi:id="_XmZY4HchEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.menu.navigate" label="Navigate">
|
||||
<children xsi:type="menu:Menu" xmi:id="_VCn_cHgwEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.menu.waveform" label="Waveform ...">
|
||||
<children xsi:type="menu:HandledMenuItem" xmi:id="_3I82cHguEeWwZ-9vrAR2UQ" elementId="" label="Move Waveform up" iconURI="platform:/plugin/com.minres.scviewer.e4.application/icons/up_blue.png" command="_N_sOkHXHEeWwZ-9vrAR2UQ">
|
||||
<parameters xmi:id="_5bKwsHguEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.parameter.16" name="com.minres.scviewer.e4.application.command.movewaveformupCommand.parameter.dir" value="up"/>
|
||||
</children>
|
||||
<children xsi:type="menu:HandledMenuItem" xmi:id="_7BRy4HguEeWwZ-9vrAR2UQ" elementId="" label="Move Waveform down" iconURI="platform:/plugin/com.minres.scviewer.e4.application/icons/down_blue.png" command="_N_sOkHXHEeWwZ-9vrAR2UQ">
|
||||
<parameters xmi:id="_7BRy4XguEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.parameter.29" name="com.minres.scviewer.e4.application.command.movewaveformupCommand.parameter.dir" value="down"/>
|
||||
</children>
|
||||
</children>
|
||||
<children xsi:type="menu:Menu" xmi:id="_ZywtoHgwEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.menu.cursor" label="Cursor ...">
|
||||
<children xsi:type="menu:HandledMenuItem" xmi:id="_pJVrgHgvEeWwZ-9vrAR2UQ" elementId="" label="Prev Event" iconURI="platform:/plugin/com.minres.scviewer.e4.application/icons/reverse_blue.png" command="_79rx4HabEeWwZ-9vrAR2UQ">
|
||||
<parameters xmi:id="_6P8nIHgvEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.parameter.17" name="com.minres.scviewer.e4.application.command.navigateEventCommand.parameter.dir" value="prev"/>
|
||||
</children>
|
||||
<children xsi:type="menu:HandledMenuItem" xmi:id="_ptDckHgvEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.handledmenuitem.nextevent" label="Next Event" iconURI="platform:/plugin/com.minres.scviewer.e4.application/icons/play_blue.png" command="_79rx4HabEeWwZ-9vrAR2UQ">
|
||||
<parameters xmi:id="_8bqQwHgvEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.parameter.18" name="com.minres.scviewer.e4.application.command.navigateEventCommand.parameter.dir" value="next"/>
|
||||
</children>
|
||||
</children>
|
||||
<children xsi:type="menu:Menu" xmi:id="_ckjf0HgwEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.menu.transaction" label="Transaction ...">
|
||||
<children xsi:type="menu:HandledMenuItem" xmi:id="_qKg0oHgvEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.handledmenuitem.prevtx" label="Prev Tx" iconURI="platform:/plugin/com.minres.scviewer.e4.application/icons/reverse_green.png" command="_Gn3lEHXKEeWwZ-9vrAR2UQ">
|
||||
<parameters xmi:id="_-szM8HgvEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.parameter.19" name="com.minres.scviewer.e4.application.command.navigateTransCommand.parameter.dir" value="prev"/>
|
||||
</children>
|
||||
<children xsi:type="menu:HandledMenuItem" xmi:id="_qsECgHgvEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.handledmenuitem.nexttx" label="Next Tx" iconURI="platform:/plugin/com.minres.scviewer.e4.application/icons/play_green.png" command="_79rx4HabEeWwZ-9vrAR2UQ">
|
||||
<parameters xmi:id="_BFe7kHgwEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.parameter.20" name="com.minres.scviewer.e4.application.command.navigateEventCommand.parameter.dir" value="next"/>
|
||||
</children>
|
||||
</children>
|
||||
</children>
|
||||
<children xsi:type="menu:Menu" xmi:id="_JTXBgIl_EeWxJ_wPkM6yGQ" elementId="com.minres.scviewer.e4.application.menu.window" label="Window">
|
||||
<children xsi:type="menu:HandledMenuItem" xmi:id="_JTXBgYl_EeWxJ_wPkM6yGQ" elementId="" label="Preferences" command="_AxH6sIl_EeWxJ_wPkM6yGQ"/>
|
||||
</children>
|
||||
<children xsi:type="menu:Menu" xmi:id="_95QGxHNmEeWBq8z1Dv39LA" elementId="com.minres.scviewer.e4.application.menu.help" label="Help">
|
||||
<children xsi:type="menu:HandledMenuItem" xmi:id="_95QGxXNmEeWBq8z1Dv39LA" label="About" command="_95PfxnNmEeWBq8z1Dv39LA"/>
|
||||
</children>
|
||||
</mainMenu>
|
||||
<trimBars xmi:id="_95QGy3NmEeWBq8z1Dv39LA" elementId="org.eclipse.ui.main.toolbar">
|
||||
<children xsi:type="menu:ToolBar" xmi:id="_95QGzHNmEeWBq8z1Dv39LA" elementId="toolbar:org.eclipse.ui.main.toolbar">
|
||||
<children xsi:type="menu:HandledToolItem" xmi:id="_95QGzXNmEeWBq8z1Dv39LA" iconURI="platform:/plugin/com.minres.scviewer.e4.application/icons/folder_database.png" tooltip="Open new database" command="_95PfwHNmEeWBq8z1Dv39LA"/>
|
||||
<children xsi:type="menu:HandledToolItem" xmi:id="_o9UBUJeiEeW09eyIbHsdvg" elementId="com.minres.scviewer.e4.application.handledtoolitem.loadsettings" label="Load settings" iconURI="platform:/plugin/com.minres.scviewer.e4.application/icons/folder_page.png" command="_7-AIMJebEeW09eyIbHsdvg">
|
||||
<parameters xmi:id="_tQZAEJeiEeW09eyIbHsdvg" elementId="com.minres.scviewer.e4.application.parameter.32" name="com.minres.scviewer.e4.application.commandparameter.loadStore" value="load"/>
|
||||
</children>
|
||||
<children xsi:type="menu:HandledToolItem" xmi:id="_95QGznNmEeWBq8z1Dv39LA" elementId="com.minres.scviewer.e4.application.handledtoolitem.savesettings" toBeRendered="false" visible="false" label="Save settings" iconURI="platform:/plugin/com.minres.scviewer.e4.application/icons/save_edit.png" command="_7-AIMJebEeW09eyIbHsdvg">
|
||||
<parameters xmi:id="_HHALEGVSEeqSQM-A6dw9ig" elementId="com.minres.scviewer.e4.application.parameter.32" name="com.minres.scviewer.e4.application.commandparameter.loadStore" value="store"/>
|
||||
</children>
|
||||
</children>
|
||||
<children xsi:type="menu:ToolBar" xmi:id="_VUv_AHckEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.toolbar.0">
|
||||
<children xsi:type="menu:HandledToolItem" xmi:id="_EboiQHcjEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.handledtoolitem.removestream" label="Remove Stream" iconURI="platform:/plugin/com.minres.scviewer.e4.application/icons/cross.png" tooltip="Remove stream/waveform from list" command="_WUZ2wHXHEeWwZ-9vrAR2UQ"/>
|
||||
<children xsi:type="menu:ToolBarSeparator" xmi:id="_rLVjAHgwEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.toolbarseparator.2"/>
|
||||
<children xsi:type="menu:HandledToolItem" xmi:id="_FE0CIHcjEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.handledtoolitem.movestreamup" label="Move Stream up" iconURI="platform:/plugin/com.minres.scviewer.e4.application/icons/up_blue.png" tooltip="Move stream/waveform in list up" command="_N_sOkHXHEeWwZ-9vrAR2UQ">
|
||||
<parameters xmi:id="_S_M5YHcjEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.parameter.8" name="com.minres.scviewer.e4.application.command.movewaveformupCommand.parameter.dir" value="up"/>
|
||||
</children>
|
||||
<children xsi:type="menu:HandledToolItem" xmi:id="_FrGmEHcjEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.handledtoolitem.movestreamdown" label="Move Stream down" iconURI="platform:/plugin/com.minres.scviewer.e4.application/icons/down_blue.png" tooltip="Move stream/waveform in list down" command="_N_sOkHXHEeWwZ-9vrAR2UQ">
|
||||
<parameters xmi:id="_VA_yAHcjEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.parameter.9" name="com.minres.scviewer.e4.application.command.movewaveformupCommand.parameter.dir" value="down"/>
|
||||
</children>
|
||||
<children xsi:type="menu:ToolBarSeparator" xmi:id="_srcD0HgwEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.toolbarseparator.3"/>
|
||||
<children xsi:type="menu:HandledToolItem" xmi:id="_GKi7IHcjEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.handledtoolitem.previousevent" label="Previous Event" iconURI="platform:/plugin/com.minres.scviewer.e4.application/icons/reverse_blue.png" tooltip="Navigate to previous event in stream/waveform" command="_79rx4HabEeWwZ-9vrAR2UQ">
|
||||
<parameters xmi:id="_XS7YYHcjEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.parameter.10" name="com.minres.scviewer.e4.application.command.navigateEventCommand.parameter.dir" value="prev"/>
|
||||
</children>
|
||||
<children xsi:type="menu:HandledToolItem" xmi:id="_GjlGMHcjEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.handledtoolitem.nextevent" label="Next Event" iconURI="platform:/plugin/com.minres.scviewer.e4.application/icons/play_blue.png" tooltip="Navigate to next event in stream/waveform" command="_79rx4HabEeWwZ-9vrAR2UQ">
|
||||
<parameters xmi:id="_ZzTqcHcjEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.parameter.11" name="com.minres.scviewer.e4.application.command.navigateEventCommand.parameter.dir" value="next"/>
|
||||
</children>
|
||||
<children xsi:type="menu:ToolBarSeparator" xmi:id="_tcxaIHgwEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.toolbarseparator.4"/>
|
||||
<children xsi:type="menu:HandledToolItem" xmi:id="_HdKZkHcjEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.handledtoolitem.previoustransaction" label="Previous Transaction" iconURI="platform:/plugin/com.minres.scviewer.e4.application/icons/reverse_green.png" tooltip="Navigate to previous transaction" command="_Gn3lEHXKEeWwZ-9vrAR2UQ">
|
||||
<parameters xmi:id="_cuGAkHcjEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.parameter.12" name="com.minres.scviewer.e4.application.command.navigateTransCommand.parameter.dir" value="prev"/>
|
||||
</children>
|
||||
<children xsi:type="menu:ToolControl" xmi:id="_LtQhcIuKEeWid7xO48ZBXw" elementId="com.minres.scviewer.e4.application.toolcontrol.0" contributionURI="bundleclass://com.minres.scviewer.e4.application/com.minres.scviewer.e4.application.elements.RelationTypeToolControl"/>
|
||||
<children xsi:type="menu:DirectToolItem" xmi:id="_Z7ZQkIuJEeWid7xO48ZBXw" elementId="com.minres.scviewer.e4.application.directtoolitem.nextprevinstream" toBeRendered="false" visible="false" label="Next/Prev in stream">
|
||||
<menu xmi:id="_aPyMMIuJEeWid7xO48ZBXw" elementId="com.minres.scviewer.e4.application.menu.2">
|
||||
<children xsi:type="menu:DynamicMenuContribution" xmi:id="_cnNWkIuJEeWid7xO48ZBXw" elementId="com.minres.scviewer.e4.application.dynamicmenucontribution.2" contributionURI="bundleclass://com.minres.scviewer.e4.application/com.minres.scviewer.e4.application.parts.NavigateContribution"/>
|
||||
</menu>
|
||||
</children>
|
||||
<children xsi:type="menu:HandledToolItem" xmi:id="_H7bp8HcjEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.handledtoolitem.nexttransaction" label="Next Transaction" iconURI="platform:/plugin/com.minres.scviewer.e4.application/icons/play_green.png" tooltip="Navigate to next transaction" command="_Gn3lEHXKEeWwZ-9vrAR2UQ">
|
||||
<parameters xmi:id="_fiO8IHcjEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.parameter.13" name="com.minres.scviewer.e4.application.command.navigateTransCommand.parameter.dir" value="next"/>
|
||||
</children>
|
||||
</children>
|
||||
<children xsi:type="menu:ToolBar" xmi:id="_oQdMUHcqEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.toolbar.1">
|
||||
<children xsi:type="menu:HandledToolItem" xmi:id="_5DrGQHf4EeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.handledtoolitem.zoomfit" label="Zoom out" iconURI="platform:/plugin/com.minres.scviewer.e4.application/icons/magnifier.png" tooltip="Restore default zoom level" command="_693GoHcqEeWwZ-9vrAR2UQ">
|
||||
<parameters xmi:id="_5DrGQXf4EeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.parameter.14" name="com.minres.scviewer.e4.application.command.zoomcommand.parameter.level" value="fit"/>
|
||||
</children>
|
||||
<children xsi:type="menu:ToolBarSeparator" xmi:id="_p1AvUHcqEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.toolbarseparator.1"/>
|
||||
<children xsi:type="menu:HandledToolItem" xmi:id="_XMQPAHcrEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.handledtoolitem.zoomin" label="Zoom in" iconURI="platform:/plugin/com.minres.scviewer.e4.application/icons/magnifier_zoom_in.png" tooltip="Zoom in by a factor of 3" command="_693GoHcqEeWwZ-9vrAR2UQ">
|
||||
<parameters xmi:id="_fi5w4HcrEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.parameter.15" name="com.minres.scviewer.e4.application.command.zoomcommand.parameter.level" value="in"/>
|
||||
</children>
|
||||
<children xsi:type="menu:HandledToolItem" xmi:id="_XqTc8HcrEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.handledtoolitem.zoomout" label="Zoom out" iconURI="platform:/plugin/com.minres.scviewer.e4.application/icons/magifier_zoom_out.png" tooltip="Zoom out by a factor of 3" command="_693GoHcqEeWwZ-9vrAR2UQ">
|
||||
<parameters xmi:id="_d7OBYHcrEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.parameter.14" name="com.minres.scviewer.e4.application.command.zoomcommand.parameter.level" value="out"/>
|
||||
</children>
|
||||
</children>
|
||||
<children xsi:type="menu:ToolBar" xmi:id="_fwn8wGtTEeqmlpoaaMHoiw" elementId="com.minres.scviewer.e4.application.toolbar.2">
|
||||
<children xsi:type="menu:HandledToolItem" xmi:id="_j-XIgGtTEeqmlpoaaMHoiw" elementId="com.minres.scviewer.e4.application.handledtoolitem.hover" label="Hover" iconURI="platform:/plugin/com.minres.scviewer.e4.application/icons/lightbulb.png" tooltip="Enable hover window in waveform" selected="true" type="Check" command="_uyeyYGtTEeqmlpoaaMHoiw">
|
||||
<tags>EnableHover</tags>
|
||||
</children>
|
||||
</children>
|
||||
</trimBars>
|
||||
<trimBars xmi:id="_JHMt8HS8EeWBq8z1Dv39LA" elementId="org.eclipse.ui.trim.status" side="Bottom">
|
||||
<children xsi:type="menu:ToolControl" xmi:id="_YsBi8HfLEeWwZ-9vrAR2UQ" elementId="org.eclipse.ui.StatusLine" contributionURI="bundleclass://com.minres.scviewer.e4.application/com.minres.scviewer.e4.application.internal.status.WaveStatusBarControl">
|
||||
<tags>stretch</tags>
|
||||
</children>
|
||||
<children xsi:type="menu:ToolControl" xmi:id="_VZzJMHdHEeWwZ-9vrAR2UQ" elementId="org.eclipse.ui.HeapStatus" contributionURI="bundleclass://com.minres.scviewer.e4.application/com.minres.scviewer.e4.application.internal.status.StatusBarControl">
|
||||
<tags>Draggable</tags>
|
||||
</children>
|
||||
<children xsi:type="menu:ToolControl" xmi:id="_y0ZS0HfzEeWwZ-9vrAR2UQ" elementId="org.eclipse.ui.ProgressBar" contributionURI="bundleclass://com.minres.scviewer.e4.application/com.minres.scviewer.e4.application.internal.status.StatusBarControl">
|
||||
<tags>Draggable</tags>
|
||||
</children>
|
||||
</trimBars>
|
||||
</children>
|
||||
<handlers xmi:id="_95PfvXNmEeWBq8z1Dv39LA" elementId="com.minres.scviewer.e4.application.handler.quitCommand" contributionURI="bundleclass://com.minres.scviewer.e4.application/com.minres.scviewer.e4.application.handlers.QuitHandler" command="_95PfvHNmEeWBq8z1Dv39LA"/>
|
||||
<handlers xmi:id="_95PfwXNmEeWBq8z1Dv39LA" elementId="com.minres.scviewer.e4.application.handler.openCommand" contributionURI="bundleclass://com.minres.scviewer.e4.application/com.minres.scviewer.e4.application.handlers.OpenHandler" command="_95PfwHNmEeWBq8z1Dv39LA"/>
|
||||
<handlers xmi:id="_95PfxHNmEeWBq8z1Dv39LA" elementId="com.minres.scviewer.e4.application.handler.saveCommand" contributionURI="bundleclass://com.minres.scviewer.e4.application/com.minres.scviewer.e4.application.handlers.SaveHandler" command="_95Pfw3NmEeWBq8z1Dv39LA"/>
|
||||
<handlers xmi:id="_95Pfx3NmEeWBq8z1Dv39LA" elementId="com.minres.scviewer.e4.application.handler.aboutCommand" contributionURI="bundleclass://com.minres.scviewer.e4.application/com.minres.scviewer.e4.application.handlers.AboutHandler" command="_95PfxnNmEeWBq8z1Dv39LA"/>
|
||||
<handlers xmi:id="_3ZZhsHXHEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.handler.selectallCommand" contributionURI="bundleclass://com.minres.scviewer.e4.application/com.minres.scviewer.e4.application.handlers.SelectAllHandler" command="_bV-TMHXHEeWwZ-9vrAR2UQ"/>
|
||||
<handlers xmi:id="_CTcpEIl_EeWxJ_wPkM6yGQ" elementId="com.minres.scviewer.e4.application.handler.preferences" contributionURI="bundleclass://com.opcoach.e4.preferences/com.opcoach.e4.preferences.handlers.E4PreferencesHandler" command="_AxH6sIl_EeWxJ_wPkM6yGQ"/>
|
||||
<handlers xmi:id="_UUnX8IoNEeWxJ_wPkM6yGQ" elementId="com.minres.scviewer.e4.application.handler.set_them" contributionURI="bundleclass://com.minres.scviewer.e4.application/com.minres.scviewer.e4.application.handlers.ThemeSetHandler" command="_KlGlsIoNEeWxJ_wPkM6yGQ"/>
|
||||
<handlers xmi:id="_V4EscIuGEeWid7xO48ZBXw" elementId="com.minres.scviewer.e4.application.handler.setreleationtype" contributionURI="bundleclass://com.minres.scviewer.e4.application/com.minres.scviewer.e4.application.handlers.SetRelationTypeHandler" command="_E9lUgIt2EeWid7xO48ZBXw"/>
|
||||
<handlers xmi:id="__99WoJebEeW09eyIbHsdvg" elementId="com.minres.scviewer.e4.application.handler.loadStoreSettings" contributionURI="bundleclass://com.minres.scviewer.e4.application/com.minres.scviewer.e4.application.handlers.LoadStoreSettingsHandler" command="_7-AIMJebEeW09eyIbHsdvg"/>
|
||||
<handlers xmi:id="_x4pSEGtTEeqmlpoaaMHoiw" elementId="com.minres.scviewer.e4.application.handler.0" contributionURI="bundleclass://com.minres.scviewer.e4.application/com.minres.scviewer.e4.application.handlers.EnableHover" command="_uyeyYGtTEeqmlpoaaMHoiw"/>
|
||||
<bindingTables xmi:id="_95PfvnNmEeWBq8z1Dv39LA" bindingContext="_95PfuXNmEeWBq8z1Dv39LA">
|
||||
<bindings xmi:id="_95Pfv3NmEeWBq8z1Dv39LA" elementId="com.minres.scviewer.e4.application.keybinding.quit" keySequence="M1+Q" command="_95PfvHNmEeWBq8z1Dv39LA">
|
||||
<tags>type:user</tags>
|
||||
</bindings>
|
||||
</bindingTables>
|
||||
<bindingTables xmi:id="_zZFy0GVNEeqSQM-A6dw9ig" elementId="com.minres.scviewer.e4.application.bindingtable.waveform" bindingContext="_q4VSsGVNEeqSQM-A6dw9ig">
|
||||
<bindings xmi:id="_1o3dEGVNEeqSQM-A6dw9ig" elementId="com.minres.scviewer.e4.application.keybinding.zoom_in" keySequence="M1++" command="_693GoHcqEeWwZ-9vrAR2UQ">
|
||||
<tags>type:user</tags>
|
||||
<parameters xmi:id="_53UagGVNEeqSQM-A6dw9ig" elementId="com.minres.scviewer.e4.application.parameter.33" name="com.minres.scviewer.e4.application.command.zoomcommand.parameter.level" value="in"/>
|
||||
</bindings>
|
||||
<bindings xmi:id="_8i3awGVNEeqSQM-A6dw9ig" elementId="com.minres.scviewer.e4.application.keybinding.zoom_out" keySequence="M1+-" command="_693GoHcqEeWwZ-9vrAR2UQ">
|
||||
<tags>type:user</tags>
|
||||
<parameters xmi:id="__UCh4GVNEeqSQM-A6dw9ig" elementId="com.minres.scviewer.e4.application.parameter.34" name="com.minres.scviewer.e4.application.command.zoomcommand.parameter.level" value="out"/>
|
||||
</bindings>
|
||||
</bindingTables>
|
||||
<bindingTables xmi:id="_XullMGVOEeqSQM-A6dw9ig" elementId="com.minres.scviewer.e4.application.bindingtable.window" bindingContext="_95PfunNmEeWBq8z1Dv39LA">
|
||||
<bindings xmi:id="_95PfwnNmEeWBq8z1Dv39LA" elementId="com.minres.scviewer.e4.application.keybinding.load" keySequence="M1+L" command="_7-AIMJebEeW09eyIbHsdvg">
|
||||
<tags>type:user</tags>
|
||||
<parameters xmi:id="_G_ulwGVPEeqSQM-A6dw9ig" elementId="com.minres.scviewer.e4.application.parameter.35" name="com.minres.scviewer.e4.application.commandparameter.loadStore" value="load"/>
|
||||
</bindings>
|
||||
<bindings xmi:id="_95PfxXNmEeWBq8z1Dv39LA" elementId="com.minres.scviewer.e4.application.keybinding.save" keySequence="M1+S" command="_7-AIMJebEeW09eyIbHsdvg">
|
||||
<tags>type:user</tags>
|
||||
<parameters xmi:id="_NJlf8GVPEeqSQM-A6dw9ig" elementId="com.minres.scviewer.e4.application.parameter.36" name="com.minres.scviewer.e4.application.commandparameter.loadStore" value="store"/>
|
||||
</bindings>
|
||||
<bindings xmi:id="_s7JNEGVPEeqSQM-A6dw9ig" elementId="com.minres.scviewer.e4.application.keybinding.preferences" keySequence="M1+," command="_AxH6sIl_EeWxJ_wPkM6yGQ">
|
||||
<tags>type:user</tags>
|
||||
</bindings>
|
||||
<bindings xmi:id="_3PRIQGVPEeqSQM-A6dw9ig" elementId="com.minres.scviewer.e4.application.keybinding.open" keySequence="M1+O" command="_95PfwHNmEeWBq8z1Dv39LA">
|
||||
<tags>type:user</tags>
|
||||
</bindings>
|
||||
</bindingTables>
|
||||
<bindingTables xmi:id="_mnMrUGVmEeqSQM-A6dw9ig" elementId="com.minres.scviewer.e4.application.bindingtable.0" bindingContext="_iQ3kQGVmEeqSQM-A6dw9ig">
|
||||
<bindings xmi:id="_n9yDwGVmEeqSQM-A6dw9ig" elementId="com.minres.scviewer.e4.application.keybinding.0" keySequence="M1+A" command="_bV-TMHXHEeWwZ-9vrAR2UQ">
|
||||
<tags>type:user</tags>
|
||||
</bindings>
|
||||
</bindingTables>
|
||||
<rootContext xmi:id="_95PfuXNmEeWBq8z1Dv39LA" elementId="org.eclipse.ui.contexts.dialogAndWindow" name="In Dialog and Windows">
|
||||
<children xmi:id="_95PfunNmEeWBq8z1Dv39LA" elementId="org.eclipse.ui.contexts.window" name="In Windows">
|
||||
<children xmi:id="_q4VSsGVNEeqSQM-A6dw9ig" elementId="com.minres.scviewer.e4.application.bindingcontext.waveform" name="In Waveform Part"/>
|
||||
<children xmi:id="_iQ3kQGVmEeqSQM-A6dw9ig" elementId="com.minres.scviewer.e4.application.bindingcontext.indesignbrowser" name="In DesignBrowser"/>
|
||||
</children>
|
||||
<children xmi:id="_95Pfu3NmEeWBq8z1Dv39LA" elementId="org.eclipse.ui.contexts.dialog" name="In Dialogs"/>
|
||||
</rootContext>
|
||||
<descriptors xmi:id="_KicY0HRMEeWBq8z1Dv39LA" elementId="com.minres.scviewer.e4.application.partdescriptor.waveformviewer" label="SCViewer" iconURI="platform:/plugin/com.minres.scviewer.e4.application/icons/scviewer.png" bindingContexts="_q4VSsGVNEeqSQM-A6dw9ig" allowMultiple="true" category="General" closeable="true" contributionURI="bundleclass://com.minres.scviewer.e4.application/com.minres.scviewer.e4.application.parts.WaveformViewer">
|
||||
<tags>categoryTag:General</tags>
|
||||
<handlers xmi:id="_BSIuEHacEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.handler.navigateEventCommand" contributionURI="bundleclass://com.minres.scviewer.e4.application/com.minres.scviewer.e4.application.handlers.NavigateEvent" command="_79rx4HabEeWwZ-9vrAR2UQ"/>
|
||||
<handlers xmi:id="_JpdGwHXKEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.handler.navigateTransCommand" contributionURI="bundleclass://com.minres.scviewer.e4.application/com.minres.scviewer.e4.application.handlers.NavigateTrans" command="_Gn3lEHXKEeWwZ-9vrAR2UQ"/>
|
||||
<handlers xmi:id="_297tsHXHEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.handler.deletewaveformCommand" contributionURI="bundleclass://com.minres.scviewer.e4.application/com.minres.scviewer.e4.application.handlers.DeleteWaveformHandler" command="_WUZ2wHXHEeWwZ-9vrAR2UQ"/>
|
||||
<handlers xmi:id="_2Ai4YHXHEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.handler.movewaveformupCommand" contributionURI="bundleclass://com.minres.scviewer.e4.application/com.minres.scviewer.e4.application.handlers.MoveWaveformHandler" command="_N_sOkHXHEeWwZ-9vrAR2UQ"/>
|
||||
<handlers xmi:id="_Du1NAHcrEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.handler.zoomCommand" contributionURI="bundleclass://com.minres.scviewer.e4.application/com.minres.scviewer.e4.application.handlers.ZoomHandler" command="_693GoHcqEeWwZ-9vrAR2UQ"/>
|
||||
<handlers xmi:id="_bxt4QM3rEei6rfTGo88R-w" elementId="com.minres.scviewer.e4.application.handler.changeWaveDisplay" contributionURI="bundleclass://com.minres.scviewer.e4.application/com.minres.scviewer.e4.application.handlers.ChangeWaveformDisplay" command="_FZunYM2PEei6rfTGo88R-w"/>
|
||||
<handlers xmi:id="_bxw7kM3rEei6rfTGo88R-w" elementId="com.minres.scviewer.e4.application.handler.changeValueDisplay" contributionURI="bundleclass://com.minres.scviewer.e4.application/com.minres.scviewer.e4.application.handlers.ChangeValueDisplay" command="_4C_asM3ZEei6rfTGo88R-w"/>
|
||||
<menus xsi:type="menu:PopupMenu" xmi:id="_TwzrsHWSEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.popupmenu.namecontext" label="Name Menu">
|
||||
<children xsi:type="menu:HandledMenuItem" xmi:id="_Vco7YHWSEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.handledmenuitem.moveup" label="Move up" iconURI="platform:/plugin/com.minres.scviewer.e4.application/icons/up_blue.png" tooltip="Move stream/waveform in list up" command="_N_sOkHXHEeWwZ-9vrAR2UQ">
|
||||
<visibleWhen xsi:type="ui:CoreExpression" xmi:id="_elFdcHr_EeWVM_sKoXvptg" coreExpressionId="com.minres.scviewer.e4.application.oneWaveSeleted"/>
|
||||
<parameters xmi:id="_qNG5kHZWEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.parameter.0" name="com.minres.scviewer.e4.application.command.movewaveformupCommand.parameter.dir" value="up"/>
|
||||
</children>
|
||||
<children xsi:type="menu:HandledMenuItem" xmi:id="_UlTbMHXIEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.handledmenuitem.movedown" label="Move down" iconURI="platform:/plugin/com.minres.scviewer.e4.application/icons/down_blue.png" tooltip="Move stream/waveform in list down" command="_N_sOkHXHEeWwZ-9vrAR2UQ">
|
||||
<visibleWhen xsi:type="ui:CoreExpression" xmi:id="_eBN0AHsCEeWVM_sKoXvptg" coreExpressionId="com.minres.scviewer.e4.application.oneWaveSeleted"/>
|
||||
<parameters xmi:id="_soO4MHZWEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.parameter.1" name="com.minres.scviewer.e4.application.command.movewaveformupCommand.parameter.dir" value="down"/>
|
||||
</children>
|
||||
<children xsi:type="menu:HandledMenuItem" xmi:id="_Vj4jUHXIEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.handledmenuitem.remove" label="Remove" iconURI="platform:/plugin/com.minres.scviewer.e4.application/icons/cross.png" tooltip="Remove stream/waveform from list" command="_WUZ2wHXHEeWwZ-9vrAR2UQ">
|
||||
<visibleWhen xsi:type="ui:CoreExpression" xmi:id="_f6MH0HsCEeWVM_sKoXvptg" coreExpressionId="com.minres.scviewer.e4.application.oneWaveSeleted"/>
|
||||
</children>
|
||||
</menus>
|
||||
<menus xsi:type="menu:PopupMenu" xmi:id="_CxJvAHXGEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.popupmenu.wavecontext" label="Wave Menu">
|
||||
<children xsi:type="menu:HandledMenuItem" xmi:id="_7HrlwHXREeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.handledmenuitem.moveup" label="Move up" iconURI="platform:/plugin/com.minres.scviewer.e4.application/icons/up_blue.png" command="_N_sOkHXHEeWwZ-9vrAR2UQ">
|
||||
<parameters xmi:id="_snsmsHaYEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.parameter.2" name="com.minres.scviewer.e4.application.command.movewaveformupCommand.parameter.dir" value="up"/>
|
||||
</children>
|
||||
<children xsi:type="menu:HandledMenuItem" xmi:id="_8MkxQHXREeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.handledmenuitem.movedown" label="Move down" iconURI="platform:/plugin/com.minres.scviewer.e4.application/icons/down_blue.png" command="_N_sOkHXHEeWwZ-9vrAR2UQ">
|
||||
<parameters xmi:id="_uZBaYHaYEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.parameter.3" name="com.minres.scviewer.e4.application.command.movewaveformupCommand.parameter.dir" value="down"/>
|
||||
</children>
|
||||
<children xsi:type="menu:HandledMenuItem" xmi:id="_7Hz3sHXIEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.handledmenuitem.remove" label="Remove" iconURI="platform:/plugin/com.minres.scviewer.e4.application/icons/cross.png" command="_WUZ2wHXHEeWwZ-9vrAR2UQ"/>
|
||||
<children xsi:type="menu:HandledMenuItem" xmi:id="_h4B6YHcZEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.handledmenuitem.nextevent" label="Next event" iconURI="platform:/plugin/com.minres.scviewer.e4.application/icons/play_blue.png" command="_79rx4HabEeWwZ-9vrAR2UQ">
|
||||
<parameters xmi:id="_rKkcwHcZEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.parameter.6" name="com.minres.scviewer.e4.application.command.navigateEventCommand.parameter.dir" value="next"/>
|
||||
</children>
|
||||
<children xsi:type="menu:HandledMenuItem" xmi:id="_kU1UAHcZEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.handledmenuitem.previousevent" label="Previous event" iconURI="platform:/plugin/com.minres.scviewer.e4.application/icons/reverse_blue.png" command="_79rx4HabEeWwZ-9vrAR2UQ">
|
||||
<parameters xmi:id="_tJOh0HcZEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.parameter.7" name="com.minres.scviewer.e4.application.command.navigateEventCommand.parameter.dir" value="prev"/>
|
||||
</children>
|
||||
<children xsi:type="menu:HandledMenuItem" xmi:id="_33qXsHabEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.handledmenuitem.nextchange" label="Next Tx" iconURI="platform:/plugin/com.minres.scviewer.e4.application/icons/play_green.png" command="_Gn3lEHXKEeWwZ-9vrAR2UQ">
|
||||
<parameters xmi:id="_33qXsXabEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.parameter.4" name="com.minres.scviewer.e4.application.command.navigateTransCommand.parameter.dir" value="next"/>
|
||||
</children>
|
||||
<children xsi:type="menu:HandledMenuItem" xmi:id="_4ZeEQHabEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.handledmenuitem.previouschange" label="Previous Tx" iconURI="platform:/plugin/com.minres.scviewer.e4.application/icons/reverse_green.png" command="_Gn3lEHXKEeWwZ-9vrAR2UQ">
|
||||
<parameters xmi:id="_4ZeEQXabEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.parameter.5" name="com.minres.scviewer.e4.application.command.navigateTransCommand.parameter.dir" value="prev"/>
|
||||
</children>
|
||||
<children xsi:type="menu:MenuSeparator" xmi:id="__Ubd4M1eEei6rfTGo88R-w" elementId="com.minres.scviewer.e4.application.menuseparator.0"/>
|
||||
<children xsi:type="menu:Menu" xmi:id="_mAA6sM1bEei6rfTGo88R-w" elementId="com.minres.scviewer.e4.application.menu.view" label="View">
|
||||
<visibleWhen xsi:type="ui:ImperativeExpression" xmi:id="_psvR0M1gEei6rfTGo88R-w" contributionURI="bundleclass://com.minres.scviewer.e4.application/com.minres.scviewer.e4.application.elements.WaveformPopupMenuContribution"/>
|
||||
<children xsi:type="menu:DynamicMenuContribution" xmi:id="_IQZZQM3hEei6rfTGo88R-w" elementId="com.minres.scviewer.e4.application.dynamicmenucontribution.0" contributionURI="bundleclass://com.minres.scviewer.e4.application/com.minres.scviewer.e4.application.elements.WaveformPopupMenuContribution"/>
|
||||
</children>
|
||||
</menus>
|
||||
</descriptors>
|
||||
<commands xmi:id="_95PfvHNmEeWBq8z1Dv39LA" elementId="org.eclipse.ui.file.exit" commandName="Quit Command"/>
|
||||
<commands xmi:id="_95PfwHNmEeWBq8z1Dv39LA" elementId="com.minres.scviewer.e4.application.open" commandName="Open Command"/>
|
||||
<commands xmi:id="_95Pfw3NmEeWBq8z1Dv39LA" elementId="org.eclipse.ui.file.save" commandName="Save Command"/>
|
||||
<commands xmi:id="_95PfxnNmEeWBq8z1Dv39LA" elementId="org.eclipse.ui.help.aboutAction" commandName="About Command"/>
|
||||
<commands xmi:id="_N_sOkHXHEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.command.movewaveformupCommand" commandName="Move Waveform Command">
|
||||
<parameters xmi:id="_lMv-EHZWEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.command.movewaveformupCommand.parameter.dir" name="direction" optional="false"/>
|
||||
</commands>
|
||||
<commands xmi:id="_WUZ2wHXHEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.command.deletewaveformCommand" commandName="Delete Waveform Command"/>
|
||||
<commands xmi:id="_bV-TMHXHEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.command.selectallCommand" commandName="Select All Command"/>
|
||||
<commands xmi:id="_Gn3lEHXKEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.command.navigateTransCommand" commandName="Navigate Transaction Command" description="Navigate to related transaction">
|
||||
<parameters xmi:id="_howw0HXQEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.command.navigateTransCommand.parameter.dir" name="direction" optional="false"/>
|
||||
</commands>
|
||||
<commands xmi:id="_79rx4HabEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.command.navigateEventCommand" commandName="Navigate Event Command">
|
||||
<parameters xmi:id="_79rx4XabEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.command.navigateEventCommand.parameter.dir" name="direction" optional="false"/>
|
||||
</commands>
|
||||
<commands xmi:id="_693GoHcqEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.command.zoomcommand" commandName="Zoom Command">
|
||||
<parameters xmi:id="_8tbm0HcqEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.command.zoomcommand.parameter.level" name="level" optional="false"/>
|
||||
</commands>
|
||||
<commands xmi:id="_2PehEHr9EeWVM_sKoXvptg" elementId="com.minres.scviewer.e4.application.command.addwaveform" commandName="Add Waveform Command">
|
||||
<parameters xmi:id="_6KsZcHr9EeWVM_sKoXvptg" elementId="com.minres.scviewer.e4.application.command.addwaveform.where" name="where" optional="false"/>
|
||||
<parameters xmi:id="_7T1TcHwIEeWv0Y5uF2QN5w" elementId="com.minres.scviewer.e4.application.command.addwaveform.all" name="all" typeId="" optional="false"/>
|
||||
</commands>
|
||||
<commands xmi:id="_AxH6sIl_EeWxJ_wPkM6yGQ" elementId="org.eclipse.ui.window.preferences" commandName="Preferences"/>
|
||||
<commands xmi:id="_KlGlsIoNEeWxJ_wPkM6yGQ" elementId="com.minres.scviewer.e4.application.command.set_them" commandName="Set Theme Command">
|
||||
<parameters xmi:id="_O8Z9IIoNEeWxJ_wPkM6yGQ" elementId="com.minres.scviewer.e4.application.command.theme.parameter.id" name="themeId" optional="false"/>
|
||||
</commands>
|
||||
<commands xmi:id="_E9lUgIt2EeWid7xO48ZBXw" elementId="com.minres.scviewer.e4.application.command.setrelationtype" commandName="Set Relation Type Command">
|
||||
<parameters xmi:id="_xnW7IIt_EeWid7xO48ZBXw" elementId="com.minres.scviewer.e4.application.commandparameter.relationName" name="relationName" optional="false"/>
|
||||
</commands>
|
||||
<commands xmi:id="_7-AIMJebEeW09eyIbHsdvg" elementId="com.minres.scviewer.e4.application.command.loadStoreSettings" commandName="Load-Store Settings Command">
|
||||
<parameters xmi:id="_wxY3EJehEeW09eyIbHsdvg" elementId="com.minres.scviewer.e4.application.commandparameter.loadStore" name="loadStore"/>
|
||||
</commands>
|
||||
<commands xmi:id="_FZunYM2PEei6rfTGo88R-w" elementId="com.minres.scviewer.e4.application.command.changewavedisplay" commandName="Change Waveform Display Command">
|
||||
<parameters xmi:id="_P6PYwM2PEei6rfTGo88R-w" elementId="com.minres.scviewer.e4.application.commandparameter.changewavedisplay" name="Type" optional="false"/>
|
||||
</commands>
|
||||
<commands xmi:id="_4C_asM3ZEei6rfTGo88R-w" elementId="com.minres.scviewer.e4.application.command.changevaluedisplay" commandName="Change Value Display Command">
|
||||
<parameters xmi:id="_4C_asc3ZEei6rfTGo88R-w" elementId="com.minres.scviewer.e4.application.commandparameter.changevaluedisplay" name="Type" optional="false"/>
|
||||
</commands>
|
||||
<commands xmi:id="_uyeyYGtTEeqmlpoaaMHoiw" elementId="com.minres.scviewer.e4.application.command.enablehover" commandName="Enable hover" description="Enable hover window in waveform"/>
|
||||
<addons xmi:id="_95PfsnNmEeWBq8z1Dv39LA" elementId="org.eclipse.e4.core.commands.service" contributionURI="bundleclass://org.eclipse.e4.core.commands/org.eclipse.e4.core.commands.CommandServiceAddon"/>
|
||||
<addons xmi:id="_95Pfs3NmEeWBq8z1Dv39LA" elementId="org.eclipse.e4.ui.contexts.service" contributionURI="bundleclass://org.eclipse.e4.ui.services/org.eclipse.e4.ui.services.ContextServiceAddon"/>
|
||||
<addons xmi:id="_95PftHNmEeWBq8z1Dv39LA" elementId="org.eclipse.e4.ui.bindings.service" contributionURI="bundleclass://org.eclipse.e4.ui.bindings/org.eclipse.e4.ui.bindings.BindingServiceAddon"/>
|
||||
<addons xmi:id="_95PftXNmEeWBq8z1Dv39LA" elementId="org.eclipse.e4.ui.workbench.commands.model" contributionURI="bundleclass://org.eclipse.e4.ui.workbench/org.eclipse.e4.ui.internal.workbench.addons.CommandProcessingAddon"/>
|
||||
<addons xmi:id="_95PftnNmEeWBq8z1Dv39LA" elementId="org.eclipse.e4.ui.workbench.handler.model" contributionURI="bundleclass://org.eclipse.e4.ui.workbench/org.eclipse.e4.ui.internal.workbench.addons.HandlerProcessingAddon"/>
|
||||
<addons xmi:id="_95Pft3NmEeWBq8z1Dv39LA" elementId="org.eclipse.e4.ui.workbench.contexts.model" contributionURI="bundleclass://org.eclipse.e4.ui.workbench/org.eclipse.e4.ui.internal.workbench.addons.ContextProcessingAddon"/>
|
||||
<addons xmi:id="_95PfuHNmEeWBq8z1Dv39LA" elementId="org.eclipse.e4.ui.workbench.bindings.model" contributionURI="bundleclass://org.eclipse.e4.ui.workbench.swt/org.eclipse.e4.ui.workbench.swt.util.BindingProcessingAddon"/>
|
||||
<addons xmi:id="_zSk-cIkcEeWxJ_wPkM6yGQ" elementId="org.eclipse.e4.ui.workbench.addons.dndaddon.DnDAddon" contributionURI="bundleclass://org.eclipse.e4.ui.workbench.addons.swt/org.eclipse.e4.ui.workbench.addons.dndaddon.DnDAddon"/>
|
||||
</application:Application>
|
@ -0,0 +1,38 @@
|
||||
Manifest-Version: 1.0
|
||||
Bundle-ManifestVersion: 2
|
||||
Bundle-Name: %Bundle-Name
|
||||
Bundle-SymbolicName: com.minres.scviewer.e4.application;singleton:=true
|
||||
Bundle-Version: 2.6.0.qualifier
|
||||
Bundle-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.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",
|
||||
org.eclipse.core.resources;bundle-version="3.13.0",
|
||||
com.opcoach.e4.preferences.mainmenu;bundle-version="1.2.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
|
@ -0,0 +1,5 @@
|
||||
#Properties file for com.minres.scviewer.e4.application
|
||||
Bundle-Vendor = MINRES Technologies GmbH
|
||||
Bundle-Name = Application
|
||||
product.description = SystemC Transaction and Waveform Viewer
|
||||
product.name = SCViewer
|
@ -0,0 +1,56 @@
|
||||
Silk companion icon set #1 - "More Silk!"
|
||||
Last updated: 19 November 2007
|
||||
|
||||
_________________________________________
|
||||
Damien Guard
|
||||
http://www.damieng.com/icons/silkcompanion
|
||||
_________________________________________
|
||||
|
||||
This work is licensed under a
|
||||
Creative Commons Attribution 2.5 License.
|
||||
[ http://creativecommons.org/licenses/by/2.5/ ]
|
||||
|
||||
The FamFamFam Silk icon set is a very large,
|
||||
consistent set of well-drawn icons that has
|
||||
proven to be popular with both applications
|
||||
and web sites.
|
||||
|
||||
On a number of occasions I have found myself
|
||||
wanting more icons in the same style. This
|
||||
companion set represents what I needed but also
|
||||
what I felt like adding.
|
||||
|
||||
Some are new icons in the same style, some are
|
||||
alternative sizes/colours of the existing icons
|
||||
and some are new compositions of the elements.
|
||||
|
||||
Any questions about this companion set please
|
||||
contact damieng@gmail.com.
|
||||
|
||||
|
||||
|
||||
The Original Silk readme this work is based upon:
|
||||
|
||||
|
||||
Silk icon set 1.3
|
||||
|
||||
_________________________________________
|
||||
Mark James
|
||||
http://www.famfamfam.com/lab/icons/silk/
|
||||
_________________________________________
|
||||
|
||||
This work is licensed under a
|
||||
Creative Commons Attribution 2.5 License.
|
||||
[ http://creativecommons.org/licenses/by/2.5/ ]
|
||||
|
||||
This means you may use it for any purpose,
|
||||
and make any changes you like.
|
||||
All I ask is that you include a link back
|
||||
to this page in your credits.
|
||||
|
||||
Are you using this icon set? Send me an email
|
||||
(including a link or picture if available) to
|
||||
mjames@gmail.com
|
||||
|
||||
Any other questions about this icon set please
|
||||
contact mjames@gmail.com
|
@ -0,0 +1,9 @@
|
||||
bin.includes = META-INF/,\
|
||||
.,\
|
||||
plugin.xml,\
|
||||
plugin.xml,\
|
||||
Application.e4xmi,\
|
||||
icons/,\
|
||||
css/,\
|
||||
OSGI-INF/
|
||||
source.. = src/
|
78
plugins/com.minres.scviewer.e4.application/css/default.css
Normal file
@ -0,0 +1,78 @@
|
||||
Label, Button[style~='SWT.CHECK'] {
|
||||
color: black;
|
||||
}
|
||||
|
||||
Composite Label {
|
||||
color: black;
|
||||
}
|
||||
|
||||
#SeparatorLabel {
|
||||
color: #1d659f;
|
||||
}
|
||||
|
||||
/*
|
||||
Text {
|
||||
font: Verdana 8px;
|
||||
}
|
||||
*/
|
||||
|
||||
Composite Text {
|
||||
background-color: white;
|
||||
color: black;
|
||||
}
|
||||
|
||||
SashForm {
|
||||
background-color: #dddddd;
|
||||
}
|
||||
|
||||
#DetailsView {
|
||||
background-color: #e8e8e8 #cccccc 60%;
|
||||
}
|
||||
|
||||
Table {
|
||||
/*background-color: #e8e8e8 #cccccc 60%;*/
|
||||
background-color: #f7f7f7 60%;
|
||||
color: black;
|
||||
}
|
||||
|
||||
Tree {
|
||||
/*background-color: #e8e8e8 #cccccc 60%;*/
|
||||
background-color: #f7f7f7 60%;
|
||||
color: black;
|
||||
}
|
||||
|
||||
.MTrimBar {
|
||||
background-color: white #dddddd #eeeeee 35% 25% 25%;
|
||||
color: white;
|
||||
}
|
||||
|
||||
CTabFolder {
|
||||
/* The tab rendering background for the min/max toolbar pulls
|
||||
* background from the tabfolder's background (or it's parent?)
|
||||
* and so the gradient doesn't come through. So just set the
|
||||
* tabfolder's background to a color */
|
||||
/*background-color: white #dddddd #eeeeee 35% 25% 25%;*/
|
||||
background-color: #eeeeee;
|
||||
color: white;
|
||||
swt-simple: true;
|
||||
}
|
||||
|
||||
CTabItem {
|
||||
color: black;
|
||||
}
|
||||
|
||||
CTabItem:selected {
|
||||
background-color: #cccccc #e8e8e8 60%;
|
||||
font-weight: normal;
|
||||
}
|
||||
|
||||
CTabItem.active:selected {
|
||||
background-color: #ffffff #cccccc #dddddd 50% 50%;
|
||||
color: #1d659f;
|
||||
font: bold;
|
||||
}
|
||||
|
||||
Shell {
|
||||
background-color: #e8e8e8 #cccccc 60%;
|
||||
swt-background-mode: default;
|
||||
}
|
22
plugins/com.minres.scviewer.e4.application/famfamfam_silk_icons_v013.txt
Executable file
@ -0,0 +1,22 @@
|
||||
Silk icon set 1.3
|
||||
|
||||
_________________________________________
|
||||
Mark James
|
||||
http://www.famfamfam.com/lab/icons/silk/
|
||||
_________________________________________
|
||||
|
||||
This work is licensed under a
|
||||
Creative Commons Attribution 2.5 License.
|
||||
[ http://creativecommons.org/licenses/by/2.5/ ]
|
||||
|
||||
This means you may use it for any purpose,
|
||||
and make any changes you like.
|
||||
All I ask is that you include a link back
|
||||
to this page in your credits.
|
||||
|
||||
Are you using this icon set? Send me an email
|
||||
(including a link or picture if available) to
|
||||
mjames@gmail.com
|
||||
|
||||
Any other questions about this icon set please
|
||||
contact mjames@gmail.com
|
BIN
plugins/com.minres.scviewer.e4.application/icons/Minres_logo.png
Normal file
After Width: | Height: | Size: 7.8 KiB |
After Width: | Height: | Size: 37 KiB |
After Width: | Height: | Size: 3.1 KiB |
BIN
plugins/com.minres.scviewer.e4.application/icons/append_wave.png
Normal file
After Width: | Height: | Size: 3.0 KiB |
BIN
plugins/com.minres.scviewer.e4.application/icons/arrow_up.png
Normal file
After Width: | Height: | Size: 372 B |
BIN
plugins/com.minres.scviewer.e4.application/icons/bullet_plus.png
Normal file
After Width: | Height: | Size: 305 B |
BIN
plugins/com.minres.scviewer.e4.application/icons/cross.png
Normal file
After Width: | Height: | Size: 655 B |
BIN
plugins/com.minres.scviewer.e4.application/icons/database.png
Executable file
After Width: | Height: | Size: 390 B |
BIN
plugins/com.minres.scviewer.e4.application/icons/database_go.png
Normal file
After Width: | Height: | Size: 698 B |
BIN
plugins/com.minres.scviewer.e4.application/icons/down_blue.png
Normal file
After Width: | Height: | Size: 760 B |
BIN
plugins/com.minres.scviewer.e4.application/icons/empty.png
Normal file
After Width: | Height: | Size: 3.1 KiB |
BIN
plugins/com.minres.scviewer.e4.application/icons/folder.png
Executable file
After Width: | Height: | Size: 537 B |
After Width: | Height: | Size: 687 B |
BIN
plugins/com.minres.scviewer.e4.application/icons/folder_page.png
Normal file
After Width: | Height: | Size: 688 B |
After Width: | Height: | Size: 3.1 KiB |
BIN
plugins/com.minres.scviewer.e4.application/icons/insert_wave.png
Normal file
After Width: | Height: | Size: 3.0 KiB |
BIN
plugins/com.minres.scviewer.e4.application/icons/lightbulb.png
Normal file
After Width: | Height: | Size: 782 B |
BIN
plugins/com.minres.scviewer.e4.application/icons/magifier_zoom_out.png
Executable file
After Width: | Height: | Size: 657 B |
BIN
plugins/com.minres.scviewer.e4.application/icons/magnifier.png
Executable file
After Width: | Height: | Size: 615 B |
BIN
plugins/com.minres.scviewer.e4.application/icons/magnifier_zoom_in.png
Executable file
After Width: | Height: | Size: 680 B |
BIN
plugins/com.minres.scviewer.e4.application/icons/page_white.png
Normal file
After Width: | Height: | Size: 294 B |
BIN
plugins/com.minres.scviewer.e4.application/icons/play_blue.png
Normal file
After Width: | Height: | Size: 407 B |
BIN
plugins/com.minres.scviewer.e4.application/icons/play_green.png
Normal file
After Width: | Height: | Size: 414 B |
After Width: | Height: | Size: 402 B |
After Width: | Height: | Size: 406 B |
BIN
plugins/com.minres.scviewer.e4.application/icons/save_edit.png
Normal file
After Width: | Height: | Size: 933 B |
BIN
plugins/com.minres.scviewer.e4.application/icons/script_save.png
Normal file
After Width: | Height: | Size: 804 B |
BIN
plugins/com.minres.scviewer.e4.application/icons/scviewer.png
Normal file
After Width: | Height: | Size: 255 B |
BIN
plugins/com.minres.scviewer.e4.application/icons/signal.png
Normal file
After Width: | Height: | Size: 717 B |
BIN
plugins/com.minres.scviewer.e4.application/icons/stream.png
Executable file
After Width: | Height: | Size: 444 B |
BIN
plugins/com.minres.scviewer.e4.application/icons/tick.png
Normal file
After Width: | Height: | Size: 537 B |
BIN
plugins/com.minres.scviewer.e4.application/icons/trash.png
Normal file
After Width: | Height: | Size: 676 B |
BIN
plugins/com.minres.scviewer.e4.application/icons/up_blue.png
Normal file
After Width: | Height: | Size: 759 B |
BIN
plugins/com.minres.scviewer.e4.application/icons/wave.png
Normal file
After Width: | Height: | Size: 3.2 KiB |
BIN
plugins/com.minres.scviewer.e4.application/icons/zoom.png
Normal file
After Width: | Height: | Size: 692 B |
BIN
plugins/com.minres.scviewer.e4.application/icons/zoom_in.png
Normal file
After Width: | Height: | Size: 725 B |
BIN
plugins/com.minres.scviewer.e4.application/icons/zoom_out.png
Normal file
After Width: | Height: | Size: 708 B |
95
plugins/com.minres.scviewer.e4.application/plugin.xml
Normal file
@ -0,0 +1,95 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<plugin>
|
||||
|
||||
<extension
|
||||
id="product"
|
||||
point="org.eclipse.core.runtime.products">
|
||||
<product
|
||||
application="org.eclipse.e4.ui.workbench.swt.E4Application"
|
||||
description="%product.description"
|
||||
name="SCViewer">
|
||||
<property
|
||||
name="lifeCycleURI"
|
||||
value="bundleclass://com.minres.scviewer.e4.application/com.minres.scviewer.e4.application.E4LifeCycle">
|
||||
</property>
|
||||
<property
|
||||
name="appName"
|
||||
value="SCViewer">
|
||||
</property>
|
||||
<property
|
||||
name="applicationCSS"
|
||||
value="platform:/plugin/com.minres.scviewer.e4.application/css/default.css">
|
||||
</property>
|
||||
</product>
|
||||
</extension>
|
||||
<extension
|
||||
point="org.eclipse.core.expressions.definitions">
|
||||
<definition
|
||||
id="com.minres.scviewer.e4.application.oneWaveSeleted">
|
||||
<with
|
||||
variable="selection">
|
||||
<and>
|
||||
<count
|
||||
value="1">
|
||||
</count>
|
||||
<iterate
|
||||
operator="or">
|
||||
<instanceof value="com.minres.scviewer.database.IWaveform"/>
|
||||
</iterate>
|
||||
</and>
|
||||
</with>
|
||||
</definition>
|
||||
<definition
|
||||
id="com.minres.scviewer.e4.application.oneTxSeleted">
|
||||
<with
|
||||
variable="selection">
|
||||
<and>
|
||||
<count
|
||||
value="1">
|
||||
</count>
|
||||
<iterate
|
||||
operator="or">
|
||||
<instanceof value="com.minres.scviewer.database.ITx"/>
|
||||
</iterate>
|
||||
</and>
|
||||
</with>
|
||||
</definition>
|
||||
<definition
|
||||
id="com.minres.scviewer.e4.application.waveformViewerActive">
|
||||
<with
|
||||
variable="activeEditorId">
|
||||
<equals
|
||||
value="com.minres.scviewer.e4.application.partdescriptor.waveformviewer">
|
||||
</equals>
|
||||
</with>
|
||||
</definition>
|
||||
</extension>
|
||||
<extension
|
||||
point="org.eclipse.core.runtime.preferences">
|
||||
<initializer
|
||||
class="com.minres.scviewer.e4.application.preferences.DefaultValuesInitializer">
|
||||
</initializer>
|
||||
</extension>
|
||||
<extension
|
||||
point="com.opcoach.e4.preferences.e4PreferencePages">
|
||||
<page
|
||||
class="com.minres.scviewer.e4.application.preferences.SCViewerPreferencesPage"
|
||||
id="com.minres.scviewer.e4.application.preferences.scviewer"
|
||||
name="SCViewer Page">
|
||||
</page>
|
||||
<page
|
||||
class="com.minres.scviewer.e4.application.preferences.WaveformPreferencesPage"
|
||||
id="com.minres.scviewer.e4.application.preferences.waveform"
|
||||
name="Waveform view"
|
||||
category="com.minres.scviewer.e4.application.preferences.scviewer">
|
||||
</page>
|
||||
</extension>
|
||||
<extension
|
||||
point="com.opcoach.e4.preferences.e4PreferenceStoreProvider">
|
||||
<preferenceStoreProvider
|
||||
class="bundleclass://com.minres.scviewer.e4.application/com.minres.scviewer.e4.application.preferences.PreferencesStoreProvider"
|
||||
pluginId="com.minres.scviewer.e4.application">
|
||||
</preferenceStoreProvider>
|
||||
</extension>
|
||||
|
||||
</plugin>
|
12
plugins/com.minres.scviewer.e4.application/pom.xml
Normal file
@ -0,0 +1,12 @@
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>com.minres.scviewer.e4.application</artifactId>
|
||||
<version>2.6.0-SNAPSHOT</version>
|
||||
<parent>
|
||||
<groupId>com.minres.scviewer</groupId>
|
||||
<artifactId>com.minres.scviewer.parent</artifactId>
|
||||
<version>2.0.0-SNAPSHOT</version>
|
||||
<relativePath>../..</relativePath>
|
||||
</parent>
|
||||
<packaging>eclipse-plugin</packaging>
|
||||
</project>
|
@ -0,0 +1,155 @@
|
||||
package com.minres.scviewer.e4.application;
|
||||
|
||||
public class AppModelId {
|
||||
public static final String ADDON_ORG_ECLIPSE_E4_CORE_COMMANDS_SERVICE = "org.eclipse.e4.core.commands.service";
|
||||
public static final String ADDON_ORG_ECLIPSE_E4_UI_BINDINGS_SERVICE = "org.eclipse.e4.ui.bindings.service";
|
||||
public static final String ADDON_ORG_ECLIPSE_E4_UI_CONTEXTS_SERVICE = "org.eclipse.e4.ui.contexts.service";
|
||||
public static final String ADDON_ORG_ECLIPSE_E4_UI_WORKBENCH_BINDINGS_MODEL = "org.eclipse.e4.ui.workbench.bindings.model";
|
||||
public static final String ADDON_ORG_ECLIPSE_E4_UI_WORKBENCH_COMMANDS_MODEL = "org.eclipse.e4.ui.workbench.commands.model";
|
||||
public static final String ADDON_ORG_ECLIPSE_E4_UI_WORKBENCH_CONTEXTS_MODEL = "org.eclipse.e4.ui.workbench.contexts.model";
|
||||
public static final String ADDON_ORG_ECLIPSE_E4_UI_WORKBENCH_HANDLER_MODEL = "org.eclipse.e4.ui.workbench.handler.model";
|
||||
public static final String ADDON_ORG_ECLIPSE_E4_UI_WORKBENC__H_ADDONS_DNDADDON_DNDADDON = "org.eclipse.e4.ui.workbench.addons.dndaddon.DnDAddon";
|
||||
public static final String APPLICATION_ORG_ECLIPSE_E4_IDE_APPLICATION = "org.eclipse.e4.ide.application";
|
||||
public static final String BINDINGCONTEXT_ORG_ECLIPSE_UI_CONTEXTS_DIALOG = "org.eclipse.ui.contexts.dialog";
|
||||
public static final String BINDINGCONTEXT_ORG_ECLIPSE_UI_CONTEXTS_DIALOGANDWINDOW = "org.eclipse.ui.contexts.dialogAndWindow";
|
||||
public static final String BINDINGCONTEXT_ORG_ECLIPSE_UI_CONTEXTS_WINDOW = "org.eclipse.ui.contexts.window";
|
||||
public static final String COMMANDPARAMETER_COM_MINRES_SCVIEWER_E4_APPLICATION_COMMANDPARAMETER_CHANGEVALUEDISPLAY = "com.minres.scviewer.e4.application.commandparameter.changevaluedisplay";
|
||||
public static final String COMMANDPARAMETER_COM_MINRES_SCVIEWER_E4_APPLICATION_COMMANDPARAMETER_CHANGEWAVEDISPLAY = "com.minres.scviewer.e4.application.commandparameter.changewavedisplay";
|
||||
public static final String COMMANDPARAMETER_COM_MINRES_SCVIEWER_E4_APPLICATION_COMMANDPARAMETER_LOADSTORE = "com.minres.scviewer.e4.application.commandparameter.loadStore";
|
||||
public static final String COMMANDPARAMETER_COM_MINRES_SCVIEWER_E4_APPLICATION_COMMANDPARAMETER_RELATIONNAME = "com.minres.scviewer.e4.application.commandparameter.relationName";
|
||||
public static final String COMMANDPARAMETER_COM_MINRES_SCVIEWER_E4_APPLICATION_COMMAND_ADDWAVEFORM_ALL = "com.minres.scviewer.e4.application.command.addwaveform.all";
|
||||
public static final String COMMANDPARAMETER_COM_MINRES_SCVIEWER_E4_APPLICATION_COMMAND_ADDWAVEFORM_WHERE = "com.minres.scviewer.e4.application.command.addwaveform.where";
|
||||
public static final String COMMANDPARAMETER_COM_MINRES_SCVIEWER_E4_APPLICATION_COMMAND_MOVEWAVEFORMUPCOMMAND_PARAMETER_DIR = "com.minres.scviewer.e4.application.command.movewaveformupCommand.parameter.dir";
|
||||
public static final String COMMANDPARAMETER_COM_MINRES_SCVIEWER_E4_APPLICATION_COMMAND_NAVIGATEEVENTCOMMAND_PARAMETER_DIR = "com.minres.scviewer.e4.application.command.navigateEventCommand.parameter.dir";
|
||||
public static final String COMMANDPARAMETER_COM_MINRES_SCVIEWER_E4_APPLICATION_COMMAND_NAVIGATETRANSCOMMAND_PARAMETER_DIR = "com.minres.scviewer.e4.application.command.navigateTransCommand.parameter.dir";
|
||||
public static final String COMMANDPARAMETER_COM_MINRES_SCVIEWER_E4_APPLICATION_COMMAND_THEME_PARAMETER_ID = "com.minres.scviewer.e4.application.command.theme.parameter.id";
|
||||
public static final String COMMANDPARAMETER_COM_MINRES_SCVIEWER_E4_APPLICATION_COMMAND_ZOOMCOMMAND_PARAMETER_LEVEL = "com.minres.scviewer.e4.application.command.zoomcommand.parameter.level";
|
||||
public static final String COMMAND_COM_MINRES_SCVIEWER_E4_APPLICATION_COMMAND_ADDWAVEFORM = "com.minres.scviewer.e4.application.command.addwaveform";
|
||||
public static final String COMMAND_COM_MINRES_SCVIEWER_E4_APPLICATION_COMMAND_CHANGEVALUEDISPLAY = "com.minres.scviewer.e4.application.command.changevaluedisplay";
|
||||
public static final String COMMAND_COM_MINRES_SCVIEWER_E4_APPLICATION_COMMAND_CHANGEWAVEDISPLAY = "com.minres.scviewer.e4.application.command.changewavedisplay";
|
||||
public static final String COMMAND_COM_MINRES_SCVIEWER_E4_APPLICATION_COMMAND_DELETEWAVEFORMCOMMAND = "com.minres.scviewer.e4.application.command.deletewaveformCommand";
|
||||
public static final String COMMAND_COM_MINRES_SCVIEWER_E4_APPLICATION_COMMAND_LOADSTORESETTINGS = "com.minres.scviewer.e4.application.command.loadStoreSettings";
|
||||
public static final String COMMAND_COM_MINRES_SCVIEWER_E4_APPLICATION_COMMAND_MOVEWAVEFORMUPCOMMAND = "com.minres.scviewer.e4.application.command.movewaveformupCommand";
|
||||
public static final String COMMAND_COM_MINRES_SCVIEWER_E4_APPLICATION_COMMAND_NAVIGATEEVENTCOMMAND = "com.minres.scviewer.e4.application.command.navigateEventCommand";
|
||||
public static final String COMMAND_COM_MINRES_SCVIEWER_E4_APPLICATION_COMMAND_NAVIGATETRANSCOMMAND = "com.minres.scviewer.e4.application.command.navigateTransCommand";
|
||||
public static final String COMMAND_COM_MINRES_SCVIEWER_E4_APPLICATION_COMMAND_SELECTALLCOMMAND = "com.minres.scviewer.e4.application.command.selectallCommand";
|
||||
public static final String COMMAND_COM_MINRES_SCVIEWER_E4_APPLICATION_COMMAND_SETRELATIONTYPE = "com.minres.scviewer.e4.application.command.setrelationtype";
|
||||
public static final String COMMAND_COM_MINRES_SCVIEWER_E4_APPLICATION_COMMAND_SET_THEM = "com.minres.scviewer.e4.application.command.set_them";
|
||||
public static final String COMMAND_COM_MINRES_SCVIEWER_E4_APPLICATION_COMMAND_ZOOMCOMMAND = "com.minres.scviewer.e4.application.command.zoomcommand";
|
||||
public static final String COMMAND_COM_MINRES_SCVIEWER_E4_APPLICATION_OPEN = "com.minres.scviewer.e4.application.open";
|
||||
public static final String COMMAND_ORG_ECLIPSE_UI_FILE_EXIT = "org.eclipse.ui.file.exit";
|
||||
public static final String COMMAND_ORG_ECLIPSE_UI_FILE_SAVE = "org.eclipse.ui.file.save";
|
||||
public static final String COMMAND_ORG_ECLIPSE_UI_HELP_ABOUTACTION = "org.eclipse.ui.help.aboutAction";
|
||||
public static final String COMMAND_ORG_ECLIPSE_UI_WINDOW_PREFERENCES = "org.eclipse.ui.window.preferences";
|
||||
public static final String DIRECTTOOLITEM_COM_MINRES_SCVIEWER_E4_APPLICATION_DIRECTTOOLITEM_NEXTPREVINSTREAM = "com.minres.scviewer.e4.application.directtoolitem.nextprevinstream";
|
||||
public static final String DYNAMICMENUCONTRIBUTION_COM_MINRES_SCVIEWER_E4_APPLICATION_DYNAMICMENUCONTRIBUTION_0 = "com.minres.scviewer.e4.application.dynamicmenucontribution.0";
|
||||
public static final String DYNAMICMENUCONTRIBUTION_COM_MINRES_SCVIEWER_E4_APPLICATION_DYNAMICMENUCONTRIBUTION_2 = "com.minres.scviewer.e4.application.dynamicmenucontribution.2";
|
||||
public static final String HANDLEDMENUITEM_COM_MINRES_SCVIEWER_E4_APPLICATION_HANDLEDMENUITEM_APPEND = "com.minres.scviewer.e4.application.handledmenuitem.append";
|
||||
public static final String HANDLEDMENUITEM_COM_MINRES_SCVIEWER_E4_APPLICATION_HANDLEDMENUITEM_APPENDALL = "com.minres.scviewer.e4.application.handledmenuitem.appendall";
|
||||
public static final String HANDLEDMENUITEM_COM_MINRES_SCVIEWER_E4_APPLICATION_HANDLEDMENUITEM_DELETE = "com.minres.scviewer.e4.application.handledmenuitem.delete";
|
||||
public static final String HANDLEDMENUITEM_COM_MINRES_SCVIEWER_E4_APPLICATION_HANDLEDMENUITEM_INSERTALL = "com.minres.scviewer.e4.application.handledmenuitem.insertall";
|
||||
public static final String HANDLEDMENUITEM_COM_MINRES_SCVIEWER_E4_APPLICATION_HANDLEDMENUITEM_INSERTBEFORE = "com.minres.scviewer.e4.application.handledmenuitem.insertbefore";
|
||||
public static final String HANDLEDMENUITEM_COM_MINRES_SCVIEWER_E4_APPLICATION_HANDLEDMENUITEM_MOVEDOWN = "com.minres.scviewer.e4.application.handledmenuitem.movedown";
|
||||
public static final String HANDLEDMENUITEM_COM_MINRES_SCVIEWER_E4_APPLICATION_HANDLEDMENUITEM_MOVEUP = "com.minres.scviewer.e4.application.handledmenuitem.moveup";
|
||||
public static final String HANDLEDMENUITEM_COM_MINRES_SCVIEWER_E4_APPLICATION_HANDLEDMENUITEM_NEXTCHANGE = "com.minres.scviewer.e4.application.handledmenuitem.nextchange";
|
||||
public static final String HANDLEDMENUITEM_COM_MINRES_SCVIEWER_E4_APPLICATION_HANDLEDMENUITEM_NEXTEVENT = "com.minres.scviewer.e4.application.handledmenuitem.nextevent";
|
||||
public static final String HANDLEDMENUITEM_COM_MINRES_SCVIEWER_E4_APPLICATION_HANDLEDMENUITEM_NEXTTX = "com.minres.scviewer.e4.application.handledmenuitem.nexttx";
|
||||
public static final String HANDLEDMENUITEM_COM_MINRES_SCVIEWER_E4_APPLICATION_HANDLEDMENUITEM_PREVIOUSCHANGE = "com.minres.scviewer.e4.application.handledmenuitem.previouschange";
|
||||
public static final String HANDLEDMENUITEM_COM_MINRES_SCVIEWER_E4_APPLICATION_HANDLEDMENUITEM_PREVIOUSEVENT = "com.minres.scviewer.e4.application.handledmenuitem.previousevent";
|
||||
public static final String HANDLEDMENUITEM_COM_MINRES_SCVIEWER_E4_APPLICATION_HANDLEDMENUITEM_PREVTX = "com.minres.scviewer.e4.application.handledmenuitem.prevtx";
|
||||
public static final String HANDLEDMENUITEM_COM_MINRES_SCVIEWER_E4_APPLICATION_HANDLEDMENUITEM_REMOVE = "com.minres.scviewer.e4.application.handledmenuitem.remove";
|
||||
public static final String HANDLEDTOOLITEM_COM_MINRES_SCVIEWER_E4_APPLICATION_HANDLEDTOOLITEM_LOADSETTINGS = "com.minres.scviewer.e4.application.handledtoolitem.loadsettings";
|
||||
public static final String HANDLEDTOOLITEM_COM_MINRES_SCVIEWER_E4_APPLICATION_HANDLEDTOOLITEM_MOVESTREAMDOWN = "com.minres.scviewer.e4.application.handledtoolitem.movestreamdown";
|
||||
public static final String HANDLEDTOOLITEM_COM_MINRES_SCVIEWER_E4_APPLICATION_HANDLEDTOOLITEM_MOVESTREAMUP = "com.minres.scviewer.e4.application.handledtoolitem.movestreamup";
|
||||
public static final String HANDLEDTOOLITEM_COM_MINRES_SCVIEWER_E4_APPLICATION_HANDLEDTOOLITEM_NEXTEVENT = "com.minres.scviewer.e4.application.handledtoolitem.nextevent";
|
||||
public static final String HANDLEDTOOLITEM_COM_MINRES_SCVIEWER_E4_APPLICATION_HANDLEDTOOLITEM_NEXTTRANSACTION = "com.minres.scviewer.e4.application.handledtoolitem.nexttransaction";
|
||||
public static final String HANDLEDTOOLITEM_COM_MINRES_SCVIEWER_E4_APPLICATION_HANDLEDTOOLITEM_PREVIOUSEVENT = "com.minres.scviewer.e4.application.handledtoolitem.previousevent";
|
||||
public static final String HANDLEDTOOLITEM_COM_MINRES_SCVIEWER_E4_APPLICATION_HANDLEDTOOLITEM_PREVIOUSTRANSACTION = "com.minres.scviewer.e4.application.handledtoolitem.previoustransaction";
|
||||
public static final String HANDLEDTOOLITEM_COM_MINRES_SCVIEWER_E4_APPLICATION_HANDLEDTOOLITEM_REMOVESTREAM = "com.minres.scviewer.e4.application.handledtoolitem.removestream";
|
||||
public static final String HANDLEDTOOLITEM_COM_MINRES_SCVIEWER_E4_APPLICATION_HANDLEDTOOLITEM_ZOOMFIT = "com.minres.scviewer.e4.application.handledtoolitem.zoomfit";
|
||||
public static final String HANDLEDTOOLITEM_COM_MINRES_SCVIEWER_E4_APPLICATION_HANDLEDTOOLITEM_ZOOMIN = "com.minres.scviewer.e4.application.handledtoolitem.zoomin";
|
||||
public static final String HANDLEDTOOLITEM_COM_MINRES_SCVIEWER_E4_APPLICATION_HANDLEDTOOLITEM_ZOOMOUT = "com.minres.scviewer.e4.application.handledtoolitem.zoomout";
|
||||
public static final String HANDLER_COM_MINRES_SCVIEWER_E4_APPLICATION_HANDLER_ABOUTCOMMAND = "com.minres.scviewer.e4.application.handler.aboutCommand";
|
||||
public static final String HANDLER_COM_MINRES_SCVIEWER_E4_APPLICATION_HANDLER_ADDWAVEFORMCOMMAND = "com.minres.scviewer.e4.application.handler.addWaveformCommand";
|
||||
public static final String HANDLER_COM_MINRES_SCVIEWER_E4_APPLICATION_HANDLER_CHANGEVALUEDISPLAY = "com.minres.scviewer.e4.application.handler.changeValueDisplay";
|
||||
public static final String HANDLER_COM_MINRES_SCVIEWER_E4_APPLICATION_HANDLER_CHANGEWAVEDISPLAY = "com.minres.scviewer.e4.application.handler.changeWaveDisplay";
|
||||
public static final String HANDLER_COM_MINRES_SCVIEWER_E4_APPLICATION_HANDLER_DELETEWAVEFORMCOMMAND = "com.minres.scviewer.e4.application.handler.deletewaveformCommand";
|
||||
public static final String HANDLER_COM_MINRES_SCVIEWER_E4_APPLICATION_HANDLER_LOADSTORESETTINGS = "com.minres.scviewer.e4.application.handler.loadStoreSettings";
|
||||
public static final String HANDLER_COM_MINRES_SCVIEWER_E4_APPLICATION_HANDLER_MOVEWAVEFORMUPCOMMAND = "com.minres.scviewer.e4.application.handler.movewaveformupCommand";
|
||||
public static final String HANDLER_COM_MINRES_SCVIEWER_E4_APPLICATION_HANDLER_NAVIGATEEVENTCOMMAND = "com.minres.scviewer.e4.application.handler.navigateEventCommand";
|
||||
public static final String HANDLER_COM_MINRES_SCVIEWER_E4_APPLICATION_HANDLER_NAVIGATETRANSCOMMAND = "com.minres.scviewer.e4.application.handler.navigateTransCommand";
|
||||
public static final String HANDLER_COM_MINRES_SCVIEWER_E4_APPLICATION_HANDLER_OPENCOMMAND = "com.minres.scviewer.e4.application.handler.openCommand";
|
||||
public static final String HANDLER_COM_MINRES_SCVIEWER_E4_APPLICATION_HANDLER_PREFERENCES = "com.minres.scviewer.e4.application.handler.preferences";
|
||||
public static final String HANDLER_COM_MINRES_SCVIEWER_E4_APPLICATION_HANDLER_QUITCOMMAND = "com.minres.scviewer.e4.application.handler.quitCommand";
|
||||
public static final String HANDLER_COM_MINRES_SCVIEWER_E4_APPLICATION_HANDLER_SAVECOMMAND = "com.minres.scviewer.e4.application.handler.saveCommand";
|
||||
public static final String HANDLER_COM_MINRES_SCVIEWER_E4_APPLICATION_HANDLER_SELECTALLCOMMAND = "com.minres.scviewer.e4.application.handler.selectallCommand";
|
||||
public static final String HANDLER_COM_MINRES_SCVIEWER_E4_APPLICATION_HANDLER_SETRELEATIONTYPE = "com.minres.scviewer.e4.application.handler.setreleationtype";
|
||||
public static final String HANDLER_COM_MINRES_SCVIEWER_E4_APPLICATION_HANDLER_SET_THEM = "com.minres.scviewer.e4.application.handler.set_them";
|
||||
public static final String HANDLER_COM_MINRES_SCVIEWER_E4_APPLICATION_HANDLER_ZOOMCOMMAND = "com.minres.scviewer.e4.application.handler.zoomCommand";
|
||||
public static final String MENUSEPARATOR_COM_MINRES_SCVIEWER_E4_APPLICATION_MENUSEPARATOR_0 = "com.minres.scviewer.e4.application.menuseparator.0";
|
||||
public static final String MENU_COM_MINRES_SCVIEWER_E4_APPLICATION_MENU_2 = "com.minres.scviewer.e4.application.menu.2";
|
||||
public static final String MENU_COM_MINRES_SCVIEWER_E4_APPLICATION_MENU_CURSOR = "com.minres.scviewer.e4.application.menu.cursor";
|
||||
public static final String MENU_COM_MINRES_SCVIEWER_E4_APPLICATION_MENU_FILE = "com.minres.scviewer.e4.application.menu.file";
|
||||
public static final String MENU_COM_MINRES_SCVIEWER_E4_APPLICATION_MENU_HELP = "com.minres.scviewer.e4.application.menu.help";
|
||||
public static final String MENU_COM_MINRES_SCVIEWER_E4_APPLICATION_MENU_NAVIGATE = "com.minres.scviewer.e4.application.menu.navigate";
|
||||
public static final String MENU_COM_MINRES_SCVIEWER_E4_APPLICATION_MENU_TRANSACTION = "com.minres.scviewer.e4.application.menu.transaction";
|
||||
public static final String MENU_COM_MINRES_SCVIEWER_E4_APPLICATION_MENU_VIEW = "com.minres.scviewer.e4.application.menu.view";
|
||||
public static final String MENU_COM_MINRES_SCVIEWER_E4_APPLICATION_MENU_WAVEFORM = "com.minres.scviewer.e4.application.menu.waveform";
|
||||
public static final String MENU_COM_MINRES_SCVIEWER_E4_APPLICATION_MENU_WINDOW = "com.minres.scviewer.e4.application.menu.window";
|
||||
public static final String MENU_MENU_ORG_ECLIPSE_UI_MAIN_MENU = "menu:org.eclipse.ui.main.menu";
|
||||
public static final String PARAMETER_COM_MINRES_SCVIEWER_E4_APPLICATION_PARAMETER_0 = "com.minres.scviewer.e4.application.parameter.0";
|
||||
public static final String PARAMETER_COM_MINRES_SCVIEWER_E4_APPLICATION_PARAMETER_1 = "com.minres.scviewer.e4.application.parameter.1";
|
||||
public static final String PARAMETER_COM_MINRES_SCVIEWER_E4_APPLICATION_PARAMETER_2 = "com.minres.scviewer.e4.application.parameter.2";
|
||||
public static final String PARAMETER_COM_MINRES_SCVIEWER_E4_APPLICATION_PARAMETER_3 = "com.minres.scviewer.e4.application.parameter.3";
|
||||
public static final String PARAMETER_COM_MINRES_SCVIEWER_E4_APPLICATION_PARAMETER_4 = "com.minres.scviewer.e4.application.parameter.4";
|
||||
public static final String PARAMETER_COM_MINRES_SCVIEWER_E4_APPLICATION_PARAMETER_5 = "com.minres.scviewer.e4.application.parameter.5";
|
||||
public static final String PARAMETER_COM_MINRES_SCVIEWER_E4_APPLICATION_PARAMETER_6 = "com.minres.scviewer.e4.application.parameter.6";
|
||||
public static final String PARAMETER_COM_MINRES_SCVIEWER_E4_APPLICATION_PARAMETER_7 = "com.minres.scviewer.e4.application.parameter.7";
|
||||
public static final String PARAMETER_COM_MINRES_SCVIEWER_E4_APPLICATION_PARAMETER_8 = "com.minres.scviewer.e4.application.parameter.8";
|
||||
public static final String PARAMETER_COM_MINRES_SCVIEWER_E4_APPLICATION_PARAMETER_9 = "com.minres.scviewer.e4.application.parameter.9";
|
||||
public static final String PARAMETER_COM_MINRES_SCVIEWER_E4_APPLICATION_PARAMETER_10 = "com.minres.scviewer.e4.application.parameter.10";
|
||||
public static final String PARAMETER_COM_MINRES_SCVIEWER_E4_APPLICATION_PARAMETER_11 = "com.minres.scviewer.e4.application.parameter.11";
|
||||
public static final String PARAMETER_COM_MINRES_SCVIEWER_E4_APPLICATION_PARAMETER_12 = "com.minres.scviewer.e4.application.parameter.12";
|
||||
public static final String PARAMETER_COM_MINRES_SCVIEWER_E4_APPLICATION_PARAMETER_13 = "com.minres.scviewer.e4.application.parameter.13";
|
||||
public static final String PARAMETER_COM_MINRES_SCVIEWER_E4_APPLICATION_PARAMETER_14 = "com.minres.scviewer.e4.application.parameter.14";
|
||||
public static final String PARAMETER_COM_MINRES_SCVIEWER_E4_APPLICATION_PARAMETER_15 = "com.minres.scviewer.e4.application.parameter.15";
|
||||
public static final String PARAMETER_COM_MINRES_SCVIEWER_E4_APPLICATION_PARAMETER_16 = "com.minres.scviewer.e4.application.parameter.16";
|
||||
public static final String PARAMETER_COM_MINRES_SCVIEWER_E4_APPLICATION_PARAMETER_17 = "com.minres.scviewer.e4.application.parameter.17";
|
||||
public static final String PARAMETER_COM_MINRES_SCVIEWER_E4_APPLICATION_PARAMETER_18 = "com.minres.scviewer.e4.application.parameter.18";
|
||||
public static final String PARAMETER_COM_MINRES_SCVIEWER_E4_APPLICATION_PARAMETER_19 = "com.minres.scviewer.e4.application.parameter.19";
|
||||
public static final String PARAMETER_COM_MINRES_SCVIEWER_E4_APPLICATION_PARAMETER_20 = "com.minres.scviewer.e4.application.parameter.20";
|
||||
public static final String PARAMETER_COM_MINRES_SCVIEWER_E4_APPLICATION_PARAMETER_21 = "com.minres.scviewer.e4.application.parameter.21";
|
||||
public static final String PARAMETER_COM_MINRES_SCVIEWER_E4_APPLICATION_PARAMETER_22 = "com.minres.scviewer.e4.application.parameter.22";
|
||||
public static final String PARAMETER_COM_MINRES_SCVIEWER_E4_APPLICATION_PARAMETER_23 = "com.minres.scviewer.e4.application.parameter.23";
|
||||
public static final String PARAMETER_COM_MINRES_SCVIEWER_E4_APPLICATION_PARAMETER_24 = "com.minres.scviewer.e4.application.parameter.24";
|
||||
public static final String PARAMETER_COM_MINRES_SCVIEWER_E4_APPLICATION_PARAMETER_25 = "com.minres.scviewer.e4.application.parameter.25";
|
||||
public static final String PARAMETER_COM_MINRES_SCVIEWER_E4_APPLICATION_PARAMETER_26 = "com.minres.scviewer.e4.application.parameter.26";
|
||||
public static final String PARAMETER_COM_MINRES_SCVIEWER_E4_APPLICATION_PARAMETER_27 = "com.minres.scviewer.e4.application.parameter.27";
|
||||
public static final String PARAMETER_COM_MINRES_SCVIEWER_E4_APPLICATION_PARAMETER_28 = "com.minres.scviewer.e4.application.parameter.28";
|
||||
public static final String PARAMETER_COM_MINRES_SCVIEWER_E4_APPLICATION_PARAMETER_29 = "com.minres.scviewer.e4.application.parameter.29";
|
||||
public static final String PARAMETER_COM_MINRES_SCVIEWER_E4_APPLICATION_PARAMETER_30 = "com.minres.scviewer.e4.application.parameter.30";
|
||||
public static final String PARAMETER_COM_MINRES_SCVIEWER_E4_APPLICATION_PARAMETER_31 = "com.minres.scviewer.e4.application.parameter.31";
|
||||
public static final String PARAMETER_COM_MINRES_SCVIEWER_E4_APPLICATION_PARAMETER_32 = "com.minres.scviewer.e4.application.parameter.32";
|
||||
public static final String PARTDESCRIPTOR_COM_MINRES_SCVIEWER_E4_APPLICATION_PARTDESCRIPTOR_WAVEFORMVIEWER = "com.minres.scviewer.e4.application.partdescriptor.waveformviewer";
|
||||
public static final String PARTSTACK_ORG_ECLIPSE_EDITORSS = "org.eclipse.editorss";
|
||||
public static final String PART_COM_MINRES_SCVIEWER_E4_APPLICATION_PARTS_DESIGNBROWSER = "com.minres.scviewer.e4.application.parts.DesignBrowser";
|
||||
public static final String PART_COM_MINRES_SCVIEWER_E4_APPLICATION_PARTS_WAVEFORMDETAILS = "com.minres.scviewer.e4.application.parts.WaveformDetails";
|
||||
public static final String PART_COM_MINRES_SCVIEWER_E4_APPLICATION_PART_0 = "com.minres.scviewer.e4.application.part.0";
|
||||
public static final String POPUPMENU_COM_MINRES_SCVIEWER_E4_APPLICATION_PARTS_DESIGNBROWSER_POPUPMENU = "com.minres.scviewer.e4.application.parts.DesignBrowser.popupmenu";
|
||||
public static final String POPUPMENU_COM_MINRES_SCVIEWER_E4_APPLICATION_POPUPMENU_NAMECONTEXT = "com.minres.scviewer.e4.application.popupmenu.namecontext";
|
||||
public static final String POPUPMENU_COM_MINRES_SCVIEWER_E4_APPLICATION_POPUPMENU_WAVECONTEXT = "com.minres.scviewer.e4.application.popupmenu.wavecontext";
|
||||
public static final String TOOLBARSEPARATOR_COM_MINRES_SCVIEWER_E4_APPLICATION_TOOLBARSEPARATOR_1 = "com.minres.scviewer.e4.application.toolbarseparator.1";
|
||||
public static final String TOOLBARSEPARATOR_COM_MINRES_SCVIEWER_E4_APPLICATION_TOOLBARSEPARATOR_2 = "com.minres.scviewer.e4.application.toolbarseparator.2";
|
||||
public static final String TOOLBARSEPARATOR_COM_MINRES_SCVIEWER_E4_APPLICATION_TOOLBARSEPARATOR_3 = "com.minres.scviewer.e4.application.toolbarseparator.3";
|
||||
public static final String TOOLBARSEPARATOR_COM_MINRES_SCVIEWER_E4_APPLICATION_TOOLBARSEPARATOR_4 = "com.minres.scviewer.e4.application.toolbarseparator.4";
|
||||
public static final String TOOLBAR_COM_MINRES_SCVIEWER_E4_APPLICATION_TOOLBAR_0 = "com.minres.scviewer.e4.application.toolbar.0";
|
||||
public static final String TOOLBAR_COM_MINRES_SCVIEWER_E4_APPLICATION_TOOLBAR_1 = "com.minres.scviewer.e4.application.toolbar.1";
|
||||
public static final String TOOLBAR_TOOLBAR_ORG_ECLIPSE_UI_MAIN_TOOLBAR = "toolbar:org.eclipse.ui.main.toolbar";
|
||||
public static final String TOOLCONTROL_COM_MINRES_SCVIEWER_E4_APPLICATION_TOOLCONTROL_0 = "com.minres.scviewer.e4.application.toolcontrol.0";
|
||||
public static final String TOOLCONTROL_ORG_ECLIPSE_UI_HEAPSTATUS = "org.eclipse.ui.HeapStatus";
|
||||
public static final String TOOLCONTROL_ORG_ECLIPSE_UI_PROGRESSBAR = "org.eclipse.ui.ProgressBar";
|
||||
public static final String TOOLCONTROL_ORG_ECLIPSE_UI_STATUSLINE = "org.eclipse.ui.StatusLine";
|
||||
public static final String TRIMBAR_ORG_ECLIPSE_UI_MAIN_TOOLBAR = "org.eclipse.ui.main.toolbar";
|
||||
public static final String TRIMBAR_ORG_ECLIPSE_UI_TRIM_STATUS = "org.eclipse.ui.trim.status";
|
||||
public static final String WINDOW_COM_MINRES_SCVIEWER_E4_APPLICATION_DIALOG_ABOUTSCVIEWER = "com.minres.scviewer.e4.application.dialog.aboutscviewer";
|
||||
}
|
@ -0,0 +1,204 @@
|
||||
/*******************************************************************************
|
||||
* 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;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.inject.Inject;
|
||||
|
||||
import org.eclipse.core.runtime.Platform;
|
||||
import org.eclipse.e4.core.contexts.ContextInjectionFactory;
|
||||
import org.eclipse.e4.core.contexts.IEclipseContext;
|
||||
import org.eclipse.e4.core.services.events.IEventBroker;
|
||||
import org.eclipse.e4.ui.model.application.MApplication;
|
||||
import org.eclipse.e4.ui.model.application.ui.basic.MPart;
|
||||
import org.eclipse.e4.ui.model.application.ui.basic.MPartStack;
|
||||
import org.eclipse.e4.ui.workbench.UIEvents;
|
||||
import org.eclipse.e4.ui.workbench.lifecycle.PostContextCreate;
|
||||
import org.eclipse.e4.ui.workbench.lifecycle.PreSave;
|
||||
import org.eclipse.e4.ui.workbench.lifecycle.ProcessAdditions;
|
||||
import org.eclipse.e4.ui.workbench.lifecycle.ProcessRemovals;
|
||||
import org.eclipse.e4.ui.workbench.modeling.EModelService;
|
||||
import org.eclipse.e4.ui.workbench.modeling.EPartService;
|
||||
import org.eclipse.e4.ui.workbench.modeling.EPartService.PartState;
|
||||
import org.eclipse.equinox.app.IApplicationContext;
|
||||
import org.eclipse.osgi.service.datalocation.Location;
|
||||
import org.osgi.service.event.Event;
|
||||
import org.osgi.service.event.EventHandler;
|
||||
|
||||
import com.minres.scviewer.e4.application.options.Options;
|
||||
import com.minres.scviewer.e4.application.options.Options.Multiplicity;
|
||||
import com.minres.scviewer.e4.application.options.Options.Separator;
|
||||
|
||||
/**
|
||||
* This implementation contains e4 LifeCycle annotated methods.<br />
|
||||
* There is a corresponding entry in <em>plugin.xml</em> (under the
|
||||
* <em>org.eclipse.core.runtime.products' extension point</em>) that references
|
||||
* this class.
|
||||
**/
|
||||
public class E4LifeCycle {
|
||||
|
||||
/**
|
||||
* Post construct.
|
||||
*
|
||||
* @param eventBroker the event broker
|
||||
*/
|
||||
@PostConstruct
|
||||
private static void postConstruct(final IEventBroker eventBroker) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Post context create. Open a database if given on command line using the OpenViewHandler
|
||||
*
|
||||
* @param appContext the app context
|
||||
* @param eventBroker the event broker
|
||||
*/
|
||||
@PostContextCreate
|
||||
void postContextCreate(IApplicationContext appContext, final IEventBroker eventBroker) {
|
||||
final String[] args = (String[])appContext.getArguments().get(IApplicationContext.APPLICATION_ARGS);
|
||||
Options opt = new Options(args, 0, 1);
|
||||
opt.getSet()
|
||||
.addOption("clearPersistedState", Multiplicity.ZERO_OR_ONE)
|
||||
.addOption("c", Separator.BLANK, Multiplicity.ZERO_OR_ONE);
|
||||
if (!opt.check(Options.DEFAULT_SET, true, false)) {
|
||||
System.err.println(opt.getCheckErrors());
|
||||
System.exit(1);
|
||||
}
|
||||
final String confFile =opt.getSet().isSet("c")?opt.getSet().getOption("c").getResultValue(0):"";
|
||||
|
||||
// react on the first view being created, at that time the UI is available
|
||||
eventBroker.subscribe(UIEvents.UILifeCycle.ACTIVATE, new EventHandler() {
|
||||
@Override
|
||||
public void handleEvent(Event event) {
|
||||
MPart part = (MPart) event.getProperty("ChangedElement"); //$NON-NLS-1$
|
||||
if(part!=null){
|
||||
IEclipseContext ctx = part.getContext();
|
||||
OpenViewHandler openViewHandler= new OpenViewHandler();
|
||||
if(confFile.length()>0) openViewHandler.setConfigFile(confFile);
|
||||
ContextInjectionFactory.inject(openViewHandler, ctx);
|
||||
eventBroker.unsubscribe(this);
|
||||
for(String name:opt.getSet().getData()){
|
||||
openViewHandler.openViewForFile(name);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
eventBroker.subscribe(UIEvents.UILifeCycle.APP_STARTUP_COMPLETE, new EventHandler() {
|
||||
@Override
|
||||
public void handleEvent(Event event) {
|
||||
Location instanceLocation = Platform.getInstanceLocation();
|
||||
try {
|
||||
boolean isLocked = instanceLocation.isLocked();
|
||||
if(isLocked)
|
||||
instanceLocation.release();
|
||||
} catch (IOException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Pre save.
|
||||
*
|
||||
* @param workbenchContext the workbench context
|
||||
*/
|
||||
@PreSave
|
||||
void preSave(IEclipseContext workbenchContext) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Process additions.
|
||||
*
|
||||
* @param workbenchContext the workbench context
|
||||
*/
|
||||
@ProcessAdditions
|
||||
void processAdditions(IEclipseContext workbenchContext) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Process removals.
|
||||
*
|
||||
* @param workbenchContext the workbench context
|
||||
*/
|
||||
@ProcessRemovals
|
||||
void processRemovals(IEclipseContext workbenchContext) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Join.
|
||||
*
|
||||
* @param tokens the tokens
|
||||
* @return the string
|
||||
*/
|
||||
String join(String[] tokens){
|
||||
StringBuilder sb = new StringBuilder();
|
||||
boolean first=true;
|
||||
for(String token:tokens){
|
||||
if(!first) sb.append(","); //$NON-NLS-1$
|
||||
sb.append(token);
|
||||
first=false;
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* The Class OpenViewHandler.
|
||||
*/
|
||||
private class OpenViewHandler {
|
||||
|
||||
/** The app. */
|
||||
@Inject MApplication app;
|
||||
|
||||
/** The model service. */
|
||||
@Inject EModelService modelService;
|
||||
|
||||
/** The part service. */
|
||||
@Inject EPartService partService;
|
||||
|
||||
String confFile="";
|
||||
/**
|
||||
* Open view for file.
|
||||
*
|
||||
* @param name the name
|
||||
*/
|
||||
public void openViewForFile(String name){
|
||||
File file = new File(getFirstFileName(name));
|
||||
if(!file.exists())
|
||||
return;
|
||||
MPart part = partService.createPart("com.minres.scviewer.e4.application.partdescriptor.waveformviewer"); //$NON-NLS-1$
|
||||
part.setLabel(file.getName());
|
||||
MPartStack partStack = (MPartStack)modelService.find("org.eclipse.editorss", app); //$NON-NLS-1$
|
||||
partStack.getChildren().add(part);
|
||||
partService.showPart(part, PartState.ACTIVATE);
|
||||
IEclipseContext ctx=part.getContext();
|
||||
ctx.modify("input", name); //$NON-NLS-1$
|
||||
//ctx.declareModifiable("input"); //$NON-NLS-1$
|
||||
ctx.modify("config", confFile); //$NON-NLS-1$
|
||||
//ctx.declareModifiable("config"); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
private String getFirstFileName(String name) {
|
||||
if(name.contains(",")) {
|
||||
String[] tokens = name.split(",");
|
||||
return tokens[0];
|
||||
} else
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setConfigFile(String confFile) {
|
||||
this.confFile=confFile;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,71 @@
|
||||
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_3;
|
||||
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 SCViewerPreferencesPage_1;
|
||||
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() {
|
||||
}
|
||||
}
|
@ -0,0 +1,88 @@
|
||||
/*******************************************************************************
|
||||
* 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.elements;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import org.eclipse.e4.ui.di.AboutToShow;
|
||||
import org.eclipse.e4.ui.model.application.MApplication;
|
||||
import org.eclipse.e4.ui.model.application.commands.MCommand;
|
||||
import org.eclipse.e4.ui.model.application.commands.MCommandParameter;
|
||||
import org.eclipse.e4.ui.model.application.commands.MParameter;
|
||||
import org.eclipse.e4.ui.model.application.ui.basic.MPart;
|
||||
import org.eclipse.e4.ui.model.application.ui.menu.MHandledMenuItem;
|
||||
import org.eclipse.e4.ui.model.application.ui.menu.MMenuElement;
|
||||
import org.eclipse.e4.ui.workbench.modeling.EModelService;
|
||||
import org.eclipse.e4.ui.workbench.modeling.EPartService;
|
||||
|
||||
import com.minres.scviewer.database.RelationType;
|
||||
import com.minres.scviewer.e4.application.parts.WaveformViewer;
|
||||
|
||||
/**
|
||||
* The Class NavigateContribution. Currently not used in Application.e4xmi
|
||||
*/
|
||||
public class NavigateToolbarContribution {
|
||||
|
||||
/** The part service. */
|
||||
@Inject EPartService partService;
|
||||
|
||||
/**
|
||||
* About to show.
|
||||
*
|
||||
* @param items the items
|
||||
* @param application the application
|
||||
* @param modelService the model service
|
||||
*/
|
||||
@AboutToShow
|
||||
public void aboutToShow(List<MMenuElement> items, MApplication application, EModelService modelService) {
|
||||
// modelService.getActivePerspective(window)
|
||||
// modelService.findElements(application,"myID",MPart.class, EModelService.IN_ACTIVE_PERSPECTIVE);
|
||||
// MDirectMenuItem dynamicItem = MMenuFactory.INSTANCE.createDirectMenuItem();
|
||||
MPart part = partService.getActivePart();
|
||||
if(part.getObject()instanceof WaveformViewer){
|
||||
WaveformViewer waveformViewerPart = (WaveformViewer) part.getObject();
|
||||
RelationType relationTypeFilter = waveformViewerPart.getRelationTypeFilter();
|
||||
MCommand command = modelService.findElements(application,
|
||||
"com.minres.scviewer.e4.application.command.setrelationtype", MCommand.class, null).get(0); //$NON-NLS-1$
|
||||
MCommandParameter commandParameter = command.getParameters().get(0);
|
||||
for(RelationType relationType:waveformViewerPart.getAllRelationTypes()){
|
||||
// MDirectMenuItem dynamicItem = modelService.createModelElement(MDirectMenuItem.class);
|
||||
//
|
||||
// dynamicItem.setLabel(relationType.getName());
|
||||
// dynamicItem.setIconURI(relationTypeFilter.equals(relationType)?
|
||||
// "platform:/plugin/com.minres.scviewer.e4.application/icons/tick.png":
|
||||
// "platform:/plugin/com.minres.scviewer.e4.application/icons/empty.png");
|
||||
// dynamicItem.setContributorURI("platform:/plugin/com.minres.scviewer.e4.application");
|
||||
// dynamicItem.setContributionURI("bundleclass://com.minres.scviewer.e4.application/com.minres.scviewer.e4.application.parts.DirectMenuItem?blah=1");
|
||||
// items.add(dynamicItem);
|
||||
MParameter parameter=modelService.createModelElement(MParameter.class);
|
||||
parameter.setName(commandParameter.getElementId());
|
||||
parameter.setValue(relationType.getName());
|
||||
parameter.setContributorURI("platform:/plugin/com.minres.scviewer.e4.application"); //$NON-NLS-1$
|
||||
MHandledMenuItem handledMenuItem= modelService.createModelElement(MHandledMenuItem.class);
|
||||
handledMenuItem.setLabel(relationType.getName());
|
||||
if(relationTypeFilter.equals(relationType)){
|
||||
handledMenuItem.setEnabled(false);
|
||||
handledMenuItem.setIconURI("platform:/plugin/com.minres.scviewer.e4.application/icons/tick.png"); //$NON-NLS-1$
|
||||
}else
|
||||
handledMenuItem.setIconURI("platform:/plugin/com.minres.scviewer.e4.application/icons/empty.png"); //$NON-NLS-1$
|
||||
handledMenuItem.setContributorURI("platform:/plugin/com.minres.scviewer.e4.application"); //$NON-NLS-1$
|
||||
handledMenuItem.setCommand(command);
|
||||
handledMenuItem.getParameters().add(parameter);
|
||||
items.add(handledMenuItem);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,144 @@
|
||||
/*******************************************************************************
|
||||
* 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.elements;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Named;
|
||||
|
||||
import org.eclipse.e4.core.di.annotations.Optional;
|
||||
import org.eclipse.e4.ui.model.application.ui.basic.MPart;
|
||||
import org.eclipse.e4.ui.services.IServiceConstants;
|
||||
import org.eclipse.e4.ui.workbench.modeling.EPartService;
|
||||
import org.eclipse.jface.viewers.ArrayContentProvider;
|
||||
import org.eclipse.jface.viewers.ComboViewer;
|
||||
import org.eclipse.jface.viewers.ISelection;
|
||||
import org.eclipse.jface.viewers.ISelectionChangedListener;
|
||||
import org.eclipse.jface.viewers.IStructuredSelection;
|
||||
import org.eclipse.jface.viewers.SelectionChangedEvent;
|
||||
import org.eclipse.jface.viewers.StructuredSelection;
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.widgets.Combo;
|
||||
import org.eclipse.swt.widgets.Composite;
|
||||
|
||||
import com.minres.scviewer.database.ITx;
|
||||
import com.minres.scviewer.database.RelationType;
|
||||
import com.minres.scviewer.e4.application.Messages;
|
||||
import com.minres.scviewer.e4.application.parts.PartListener;
|
||||
import com.minres.scviewer.e4.application.parts.WaveformViewer;
|
||||
|
||||
/**
|
||||
* The Class RelationTypeToolControl allowing to control which TX relation is used for navigation.
|
||||
*/
|
||||
public class RelationTypeToolControl extends PartListener implements ISelectionChangedListener {
|
||||
|
||||
/** The part service. */
|
||||
EPartService partService;
|
||||
|
||||
/** The combo viewer. */
|
||||
ComboViewer comboViewer;
|
||||
|
||||
/** The waveform viewer part. */
|
||||
WaveformViewer waveformViewerPart;
|
||||
|
||||
/** The dummy. */
|
||||
RelationType dummy = RelationType.create(Messages.RelationTypeToolControl_0);
|
||||
|
||||
/**
|
||||
* Instantiates a new relation type tool control.
|
||||
*
|
||||
* @param partService the part service
|
||||
*/
|
||||
@Inject
|
||||
public RelationTypeToolControl(EPartService partService) {
|
||||
this.partService=partService;
|
||||
partService.addPartListener(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates the gui.
|
||||
*
|
||||
* @param parent the parent
|
||||
*/
|
||||
@PostConstruct
|
||||
public void createGui(Composite parent) {
|
||||
comboViewer = new ComboViewer(parent, SWT.NONE);
|
||||
Combo comboBox = comboViewer.getCombo();
|
||||
comboBox.setBounds(0, 0, 26, 22);
|
||||
comboBox.setText(Messages.RelationTypeToolControl_1);
|
||||
comboViewer.setContentProvider(new ArrayContentProvider());
|
||||
comboViewer.setInput(new RelationType[] {dummy});
|
||||
comboViewer.setSelection(new StructuredSelection(dummy));
|
||||
comboViewer.addSelectionChangedListener(this);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see com.minres.scviewer.e4.application.parts.PartListener#partActivated(org.eclipse.e4.ui.model.application.ui.basic.MPart)
|
||||
*/
|
||||
@Override
|
||||
public void partActivated(MPart part) {
|
||||
if(part.getObject() instanceof WaveformViewer){
|
||||
waveformViewerPart=(WaveformViewer) part.getObject();
|
||||
checkSelection(waveformViewerPart.getSelection());
|
||||
} else {
|
||||
waveformViewerPart=null;
|
||||
checkSelection(new StructuredSelection());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the selection.
|
||||
*
|
||||
* @param selection the selection
|
||||
* @param partService the part service
|
||||
*/
|
||||
@Inject
|
||||
public void setSelection(@Named(IServiceConstants.ACTIVE_SELECTION) @Optional IStructuredSelection selection, EPartService partService){
|
||||
MPart part = partService.getActivePart();
|
||||
if(part!=null && part.getObject() instanceof WaveformViewer && comboViewer!=null){
|
||||
checkSelection(selection);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check selection.
|
||||
*
|
||||
* @param selection the selection
|
||||
*/
|
||||
protected void checkSelection(ISelection selection) {
|
||||
if( selection instanceof IStructuredSelection) {
|
||||
Object object= ((IStructuredSelection)selection).getFirstElement();
|
||||
if(object instanceof ITx && waveformViewerPart!=null){
|
||||
comboViewer.getCombo().setEnabled(true);
|
||||
comboViewer.setInput(waveformViewerPart.getSelectionRelationTypes());//getAllRelationTypes());
|
||||
comboViewer.setSelection(new StructuredSelection(waveformViewerPart.getRelationTypeFilter()));
|
||||
return;
|
||||
}
|
||||
}
|
||||
comboViewer.getCombo().setEnabled(false);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.jface.viewers.ISelectionChangedListener#selectionChanged(org.eclipse.jface.viewers.SelectionChangedEvent)
|
||||
*/
|
||||
@Override
|
||||
public void selectionChanged(SelectionChangedEvent event) {
|
||||
MPart part = partService.getActivePart();
|
||||
if(part!=null && part.getObject() instanceof WaveformViewer && !event.getSelection().isEmpty()){
|
||||
WaveformViewer waveformViewerPart=(WaveformViewer) part.getObject();
|
||||
if(event.getSelection() instanceof IStructuredSelection){
|
||||
waveformViewerPart.setNavigationRelationType(
|
||||
(RelationType)((IStructuredSelection)event.getSelection()).getFirstElement());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,130 @@
|
||||
|
||||
package com.minres.scviewer.e4.application.elements;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import org.eclipse.e4.core.di.annotations.Evaluate;
|
||||
import org.eclipse.e4.ui.di.AboutToHide;
|
||||
import org.eclipse.e4.ui.di.AboutToShow;
|
||||
import org.eclipse.e4.ui.model.application.MApplication;
|
||||
import org.eclipse.e4.ui.model.application.commands.MCommand;
|
||||
import org.eclipse.e4.ui.model.application.commands.MCommandsFactory;
|
||||
import org.eclipse.e4.ui.model.application.commands.MParameter;
|
||||
import org.eclipse.e4.ui.model.application.ui.basic.MPart;
|
||||
import org.eclipse.e4.ui.model.application.ui.menu.ItemType;
|
||||
import org.eclipse.e4.ui.model.application.ui.menu.MHandledMenuItem;
|
||||
import org.eclipse.e4.ui.model.application.ui.menu.MMenuElement;
|
||||
import org.eclipse.e4.ui.model.application.ui.menu.MMenuFactory;
|
||||
import org.eclipse.e4.ui.workbench.modeling.EModelService;
|
||||
import org.eclipse.jface.viewers.ISelection;
|
||||
import org.eclipse.jface.viewers.IStructuredSelection;
|
||||
|
||||
import com.minres.scviewer.database.BitVector;
|
||||
import com.minres.scviewer.database.ISignal;
|
||||
import com.minres.scviewer.database.ui.TrackEntry;
|
||||
import com.minres.scviewer.e4.application.parts.WaveformViewer;
|
||||
|
||||
public class WaveformPopupMenuContribution {
|
||||
int counter=0;
|
||||
|
||||
@Inject MPart activePart;
|
||||
|
||||
final TrackEntry nullEntry = new TrackEntry(null);
|
||||
|
||||
@Evaluate
|
||||
public boolean evaluate() {
|
||||
Object obj = activePart.getObject();
|
||||
if(obj instanceof WaveformViewer){
|
||||
WaveformViewer wfv = (WaveformViewer)obj;
|
||||
ISelection sel = wfv.getSelection();
|
||||
if(!sel.isEmpty() && sel instanceof IStructuredSelection) {
|
||||
Object selected = ((IStructuredSelection)sel).getFirstElement();
|
||||
if(selected instanceof ISignal<?>) {
|
||||
Object x = ((ISignal<?>) selected).getEvents().firstEntry().getValue();
|
||||
if((x instanceof BitVector) && ((BitVector)x).getWidth()==1) {
|
||||
return false;
|
||||
} else
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@AboutToShow
|
||||
public void aboutToShow(List<MMenuElement> items, MApplication application, EModelService modelService) {
|
||||
Object obj = activePart.getObject();
|
||||
if(obj instanceof WaveformViewer){
|
||||
WaveformViewer wfv = (WaveformViewer)obj;
|
||||
ISelection sel = wfv.getSelection();
|
||||
if(!sel.isEmpty() && sel instanceof IStructuredSelection) {
|
||||
Iterator<?> it = ((IStructuredSelection)sel).iterator();
|
||||
Object first = it.next();
|
||||
Object second=null;
|
||||
if(it.hasNext()) second=it.next();
|
||||
if(first instanceof ISignal<?>) {
|
||||
Object o = ((ISignal<?>) first).getEvents().firstEntry().getValue();
|
||||
//com.minres.scviewer.e4.application.menu.mulitvaluesettings
|
||||
if((o instanceof Double) || (o instanceof BitVector)) {
|
||||
TrackEntry entry=nullEntry;
|
||||
if(second instanceof TrackEntry)
|
||||
entry=(TrackEntry)second;
|
||||
if(o instanceof BitVector) {
|
||||
addValueMenuItem(items, application, modelService, "hex", TrackEntry.ValueDisplay.DEFAULT, entry.valueDisplay);
|
||||
addValueMenuItem(items, application, modelService, "unsigned", TrackEntry.ValueDisplay.UNSIGNED, entry.valueDisplay);
|
||||
addValueMenuItem(items, application, modelService, "signed", TrackEntry.ValueDisplay.SIGNED, entry.valueDisplay);
|
||||
items.add(MMenuFactory.INSTANCE.createMenuSeparator());
|
||||
addWaveMenuItem(items, application, modelService, "bit vector", TrackEntry.WaveDisplay.DEFAULT, entry.waveDisplay);
|
||||
}
|
||||
addWaveMenuItem(items, application, modelService, "analog step-wise", TrackEntry.WaveDisplay.STEP_WISE, entry.waveDisplay);
|
||||
addWaveMenuItem(items, application, modelService, "analog continous", TrackEntry.WaveDisplay.CONTINOUS, entry.waveDisplay);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void addValueMenuItem(List<MMenuElement> items, MApplication application, EModelService modelService,
|
||||
String label, TrackEntry.ValueDisplay value, TrackEntry.ValueDisplay actual) {
|
||||
MHandledMenuItem item = MMenuFactory.INSTANCE.createHandledMenuItem();
|
||||
item.setType(ItemType.RADIO);
|
||||
item.setSelected(value==actual);
|
||||
item.setLabel("Show as "+label);
|
||||
item.setContributorURI("platform:/plugin/com.minres.scviewer.e4.application");
|
||||
List<MCommand> cmds = modelService.findElements(application, "com.minres.scviewer.e4.application.command.changevaluedisplay", MCommand.class, null);
|
||||
if(cmds.size()!=1) System.err.println("No command found!");
|
||||
else item.setCommand(cmds.get(0));
|
||||
MParameter param = MCommandsFactory.INSTANCE.createParameter();
|
||||
param.setName("com.minres.scviewer.e4.application.commandparameter.changevaluedisplay");
|
||||
param.setValue(value.toString());
|
||||
item.getParameters().add(param);
|
||||
items.add(item);
|
||||
}
|
||||
|
||||
private void addWaveMenuItem(List<MMenuElement> items, MApplication application, EModelService modelService,
|
||||
String label, TrackEntry.WaveDisplay value, TrackEntry.WaveDisplay actual) {
|
||||
MHandledMenuItem item = MMenuFactory.INSTANCE.createHandledMenuItem();
|
||||
item.setType(ItemType.RADIO);
|
||||
item.setSelected(value==actual);
|
||||
item.setLabel("Render "+label);
|
||||
item.setContributorURI("platform:/plugin/com.minres.scviewer.e4.application");
|
||||
List<MCommand> cmds = modelService.findElements(application, "com.minres.scviewer.e4.application.command.changewavedisplay", MCommand.class, null);
|
||||
if(cmds.size()!=1) System.err.println("No command found!");
|
||||
else item.setCommand(cmds.get(0));
|
||||
MParameter param = MCommandsFactory.INSTANCE.createParameter();
|
||||
param.setName("com.minres.scviewer.e4.application.commandparameter.changewavedisplay");
|
||||
param.setValue(value.toString());
|
||||
item.getParameters().add(param);
|
||||
items.add(item);
|
||||
}
|
||||
|
||||
@AboutToHide
|
||||
public void aboutToHide(List<MMenuElement> items) {
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,31 @@
|
||||
/*******************************************************************************
|
||||
* 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;
|
||||
import org.eclipse.e4.ui.model.application.MApplication;
|
||||
import org.eclipse.e4.ui.model.application.ui.basic.MPart;
|
||||
import org.eclipse.e4.ui.model.application.ui.basic.MWindow;
|
||||
import org.eclipse.e4.ui.workbench.modeling.EModelService;
|
||||
import org.eclipse.swt.widgets.Shell;
|
||||
|
||||
public class AboutHandler {
|
||||
|
||||
static final String DIALOG_ID="com.minres.scviewer.e4.application.dialog.aboutscviewer";
|
||||
|
||||
@Execute
|
||||
public void execute(Shell shell, MApplication app, MWindow window, EModelService ms /*@Named("mdialog01.dialog.0") MDialog dialog*/) {
|
||||
MPart mel = (MPart) ms.find(DIALOG_ID, app); //$NON-NLS-1$
|
||||
mel.setToBeRendered(true);
|
||||
mel.setToBeRendered(false);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,74 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2015 MINRES Technologies GmbH and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* MINRES Technologies GmbH - initial API and implementation
|
||||
*******************************************************************************/
|
||||
|
||||
package com.minres.scviewer.e4.application.handlers;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Named;
|
||||
|
||||
import org.eclipse.e4.core.di.annotations.CanExecute;
|
||||
import org.eclipse.e4.core.di.annotations.Execute;
|
||||
import org.eclipse.e4.core.di.annotations.Optional;
|
||||
import org.eclipse.e4.ui.model.application.ui.basic.MPart;
|
||||
import org.eclipse.e4.ui.services.IServiceConstants;
|
||||
import org.eclipse.e4.ui.workbench.modeling.EPartService;
|
||||
import org.eclipse.jface.viewers.IStructuredSelection;
|
||||
|
||||
import com.minres.scviewer.database.IWaveform;
|
||||
import com.minres.scviewer.e4.application.parts.DesignBrowser;
|
||||
|
||||
public class AddWaveformHandler {
|
||||
|
||||
public final static String PARAM_WHERE_ID="com.minres.scviewer.e4.application.command.addwaveform.where"; //$NON-NLS-1$
|
||||
public final static String PARAM_ALL_ID="com.minres.scviewer.e4.application.command.addwaveform.all"; //$NON-NLS-1$
|
||||
|
||||
@Inject @Optional DesignBrowser designBrowser;
|
||||
|
||||
@CanExecute
|
||||
public boolean canExecute(@Named(PARAM_WHERE_ID) String where, @Named(PARAM_ALL_ID) String all,
|
||||
EPartService partService,
|
||||
@Named(IServiceConstants.ACTIVE_SELECTION) @Optional IStructuredSelection selection) {
|
||||
if(designBrowser==null) designBrowser = getListPart( partService);
|
||||
if(designBrowser==null || designBrowser.getActiveWaveformViewerPart()==null) return false;
|
||||
boolean before = "before".equalsIgnoreCase(where); //$NON-NLS-1$
|
||||
IStructuredSelection waveformSelection = null;
|
||||
if(designBrowser.getActiveWaveformViewerPart()!=null)
|
||||
waveformSelection = (IStructuredSelection)designBrowser.getActiveWaveformViewerPart().getSelection();
|
||||
if("true".equalsIgnoreCase(all)) //$NON-NLS-1$
|
||||
return designBrowser.getFilteredChildren().length>0 &&
|
||||
(!before || (waveformSelection!=null && waveformSelection.size()>0));
|
||||
else
|
||||
return selection!=null && selection.size()>0 &&
|
||||
(!before || (waveformSelection!=null && waveformSelection.size()>0));
|
||||
}
|
||||
|
||||
@Execute
|
||||
public void execute(@Named(PARAM_WHERE_ID) String where, @Named(PARAM_ALL_ID) String all,
|
||||
EPartService partService,
|
||||
@Named(IServiceConstants.ACTIVE_SELECTION) @Optional IStructuredSelection selection) {
|
||||
if(designBrowser==null) designBrowser = getListPart( partService);
|
||||
if(designBrowser!=null && selection.size()>0){
|
||||
List<?> sel=selection.toList();
|
||||
designBrowser.getActiveWaveformViewerPart().addStreamsToList(sel.toArray(new IWaveform[]{}),
|
||||
"before".equalsIgnoreCase(where)); //$NON-NLS-1$
|
||||
}
|
||||
}
|
||||
|
||||
protected DesignBrowser getListPart(EPartService partService){
|
||||
MPart part = partService.getActivePart();
|
||||
if(part.getObject() instanceof DesignBrowser)
|
||||
return (DesignBrowser) part.getObject();
|
||||
else
|
||||
return null;
|
||||
}
|
||||
}
|
@ -0,0 +1,51 @@
|
||||
|
||||
package com.minres.scviewer.e4.application.handlers;
|
||||
|
||||
import java.util.Iterator;
|
||||
|
||||
import javax.inject.Named;
|
||||
|
||||
import org.eclipse.e4.core.di.annotations.CanExecute;
|
||||
import org.eclipse.e4.core.di.annotations.Execute;
|
||||
import org.eclipse.e4.ui.model.application.ui.basic.MPart;
|
||||
import org.eclipse.e4.ui.workbench.modeling.EPartService;
|
||||
import org.eclipse.jface.viewers.ISelection;
|
||||
import org.eclipse.jface.viewers.IStructuredSelection;
|
||||
|
||||
import com.minres.scviewer.database.ui.TrackEntry;
|
||||
import com.minres.scviewer.e4.application.parts.WaveformViewer;
|
||||
|
||||
public class ChangeValueDisplay {
|
||||
|
||||
static final String PARAMETER_ID="com.minres.scviewer.e4.application.commandparameter.changevaluedisplay"; //$NON-NLS-1$
|
||||
|
||||
@CanExecute
|
||||
public boolean canExecute(EPartService partService) {
|
||||
MPart part = partService.getActivePart();
|
||||
if(part==null) return false;
|
||||
return (part.getObject() instanceof WaveformViewer);
|
||||
}
|
||||
|
||||
@Execute
|
||||
public void execute(@Named(PARAMETER_ID) String param, EPartService partService) {
|
||||
MPart part = partService.getActivePart();
|
||||
Object obj = part.getObject();
|
||||
if(obj instanceof WaveformViewer){
|
||||
WaveformViewer wfv = (WaveformViewer)obj;
|
||||
ISelection sel = wfv.getSelection();
|
||||
if(!sel.isEmpty() && sel instanceof IStructuredSelection) {
|
||||
Iterator<?> it = ((IStructuredSelection)sel).iterator();
|
||||
it.next();
|
||||
if(it.hasNext()) {
|
||||
Object second = it.next();
|
||||
if(second instanceof TrackEntry) {
|
||||
TrackEntry.ValueDisplay val = TrackEntry.ValueDisplay.valueOf(param);
|
||||
((TrackEntry)second).valueDisplay=val;
|
||||
wfv.update();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,51 @@
|
||||
|
||||
package com.minres.scviewer.e4.application.handlers;
|
||||
|
||||
import java.util.Iterator;
|
||||
|
||||
import javax.inject.Named;
|
||||
|
||||
import org.eclipse.e4.core.di.annotations.CanExecute;
|
||||
import org.eclipse.e4.core.di.annotations.Execute;
|
||||
import org.eclipse.e4.ui.model.application.ui.basic.MPart;
|
||||
import org.eclipse.e4.ui.workbench.modeling.EPartService;
|
||||
import org.eclipse.jface.viewers.ISelection;
|
||||
import org.eclipse.jface.viewers.IStructuredSelection;
|
||||
|
||||
import com.minres.scviewer.database.ui.TrackEntry;
|
||||
import com.minres.scviewer.e4.application.parts.WaveformViewer;
|
||||
|
||||
public class ChangeWaveformDisplay {
|
||||
|
||||
static final String PARAMETER_ID="com.minres.scviewer.e4.application.commandparameter.changewavedisplay"; //$NON-NLS-1$
|
||||
|
||||
@CanExecute
|
||||
public boolean canExecute(EPartService partService) {
|
||||
MPart part = partService.getActivePart();
|
||||
if(part==null) return false;
|
||||
return (part.getObject() instanceof WaveformViewer);
|
||||
}
|
||||
|
||||
@Execute
|
||||
public void execute(@Named(PARAMETER_ID) String param, EPartService partService) {
|
||||
MPart part = partService.getActivePart();
|
||||
Object obj = part.getObject();
|
||||
if(obj instanceof WaveformViewer){
|
||||
WaveformViewer wfv = (WaveformViewer)obj;
|
||||
ISelection sel = wfv.getSelection();
|
||||
if(!sel.isEmpty() && sel instanceof IStructuredSelection) {
|
||||
Iterator<?> it = ((IStructuredSelection)sel).iterator();
|
||||
it.next();
|
||||
if(it.hasNext()) {
|
||||
Object second = it.next();
|
||||
if(second instanceof TrackEntry) {
|
||||
TrackEntry.WaveDisplay val= TrackEntry.WaveDisplay.valueOf(param);
|
||||
((TrackEntry)second).waveDisplay=val;
|
||||
wfv.update();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,39 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2015 MINRES Technologies GmbH and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* MINRES Technologies GmbH - initial API and implementation
|
||||
*******************************************************************************/
|
||||
|
||||
package com.minres.scviewer.e4.application.handlers;
|
||||
|
||||
import org.eclipse.e4.core.di.annotations.CanExecute;
|
||||
import org.eclipse.e4.core.di.annotations.Execute;
|
||||
import org.eclipse.e4.ui.model.application.ui.basic.MPart;
|
||||
import org.eclipse.e4.ui.workbench.modeling.ESelectionService;
|
||||
import org.eclipse.jface.viewers.IStructuredSelection;
|
||||
|
||||
import com.minres.scviewer.database.IWaveform;
|
||||
import com.minres.scviewer.e4.application.parts.WaveformViewer;
|
||||
|
||||
public class DeleteWaveformHandler {
|
||||
|
||||
@CanExecute
|
||||
public Boolean canExecute(ESelectionService selectionService){
|
||||
Object o = selectionService.getSelection();
|
||||
return o instanceof IStructuredSelection && ((IStructuredSelection)o).getFirstElement() instanceof IWaveform;
|
||||
}
|
||||
|
||||
@Execute
|
||||
public void execute(ESelectionService selectionService, MPart activePart) {
|
||||
Object o = activePart.getObject();
|
||||
Object sel = selectionService.getSelection();
|
||||
if(o instanceof WaveformViewer && ((IStructuredSelection)sel).getFirstElement() instanceof IWaveform){
|
||||
((WaveformViewer)o).removeStreamFromList((IWaveform) ((IStructuredSelection)sel).getFirstElement());
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,48 @@
|
||||
|
||||
package com.minres.scviewer.e4.application.handlers;
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.inject.Inject;
|
||||
|
||||
import org.eclipse.core.runtime.preferences.ConfigurationScope;
|
||||
import org.eclipse.e4.core.contexts.Active;
|
||||
import org.eclipse.e4.core.di.annotations.Execute;
|
||||
import org.eclipse.e4.ui.model.application.MApplication;
|
||||
import org.eclipse.e4.ui.model.application.ui.basic.MPart;
|
||||
import org.eclipse.e4.ui.model.application.ui.basic.MWindow;
|
||||
import org.eclipse.e4.ui.model.application.ui.menu.MHandledItem;
|
||||
import org.eclipse.e4.ui.workbench.modeling.EModelService;
|
||||
import org.eclipse.jface.preference.IPreferenceStore;
|
||||
|
||||
import com.minres.scviewer.e4.application.preferences.PreferenceConstants;
|
||||
import com.opcoach.e4.preferences.ScopedPreferenceStore;
|
||||
|
||||
public class EnableHover {
|
||||
static final String TAG_NAME = "EnableHover"; //$NON-NLS-1$
|
||||
|
||||
@Inject
|
||||
MApplication application;
|
||||
|
||||
@PostConstruct
|
||||
public void initialize(EModelService modelService) {
|
||||
List<String> tags = new LinkedList<>();
|
||||
tags.add(TAG_NAME);
|
||||
List<MHandledItem> elements = modelService.findElements(application, null, MHandledItem.class, tags );
|
||||
// cover initialization stuff, sync it with code
|
||||
IPreferenceStore store = new ScopedPreferenceStore(ConfigurationScope.INSTANCE, PreferenceConstants.PREFERENCES_SCOPE);
|
||||
boolean state = store.getBoolean(PreferenceConstants.SHOW_HOVER);
|
||||
for( MHandledItem hi : elements ){
|
||||
hi.setSelected(state);
|
||||
}
|
||||
}
|
||||
|
||||
@Execute
|
||||
public void execute(@Active MPart part, @Active MWindow window, MHandledItem handledItem, EModelService modelService ) {
|
||||
IPreferenceStore store = new ScopedPreferenceStore(ConfigurationScope.INSTANCE, PreferenceConstants.PREFERENCES_SCOPE);
|
||||
store.setValue(PreferenceConstants.SHOW_HOVER, handledItem.isSelected());
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,100 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2015 MINRES Technologies GmbH and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* MINRES Technologies GmbH - initial API and implementation
|
||||
*******************************************************************************/
|
||||
package com.minres.scviewer.e4.application.handlers;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import javax.inject.Named;
|
||||
|
||||
import org.eclipse.e4.core.di.annotations.CanExecute;
|
||||
import org.eclipse.e4.core.di.annotations.Execute;
|
||||
import org.eclipse.e4.ui.model.application.MApplication;
|
||||
import org.eclipse.e4.ui.model.application.ui.basic.MPart;
|
||||
import org.eclipse.e4.ui.workbench.modeling.EModelService;
|
||||
import org.eclipse.e4.ui.workbench.modeling.EPartService;
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.widgets.FileDialog;
|
||||
import org.eclipse.swt.widgets.MessageBox;
|
||||
import org.eclipse.swt.widgets.Shell;
|
||||
|
||||
import com.minres.scviewer.e4.application.Messages;
|
||||
import com.minres.scviewer.e4.application.parts.WaveformViewer;
|
||||
public class LoadStoreSettingsHandler {
|
||||
|
||||
static final String PARAMETER_ID="com.minres.scviewer.e4.application.commandparameter.loadStore"; //$NON-NLS-1$
|
||||
|
||||
@CanExecute
|
||||
public boolean canExecute(EPartService partService) {
|
||||
MPart part = partService.getActivePart();
|
||||
if(part==null) return false;
|
||||
return (part.getObject() instanceof WaveformViewer);
|
||||
}
|
||||
|
||||
@Execute
|
||||
public void execute(@Named(PARAMETER_ID) String param, Shell shell, MApplication app, EModelService modelService,
|
||||
EPartService partService){
|
||||
|
||||
boolean load = "load".equals(param); //$NON-NLS-1$
|
||||
FileDialog dialog = new FileDialog(shell, load?SWT.OPEN:SWT.SAVE);
|
||||
dialog.setFilterExtensions (new String []{Messages.LoadStoreSettingsHandler_2});
|
||||
if(!load) dialog.setFileName(Messages.LoadStoreSettingsHandler_3);
|
||||
|
||||
String fileName = null;
|
||||
MPart part = partService.getActivePart();
|
||||
Object obj = part.getObject();
|
||||
|
||||
// Save active tab settings
|
||||
if(!load) {
|
||||
// 3 possible cases when when saving active tab settings:
|
||||
// - user dismisses the dialog by pressing Cancel
|
||||
// - selected file name does not exist
|
||||
// - user agrees to overwrite existing file
|
||||
boolean done = false;
|
||||
while (!done) {
|
||||
// open the File Dialog
|
||||
fileName = dialog.open();
|
||||
if (fileName == null) {
|
||||
// user has cancelled -> quit and return
|
||||
done = true;
|
||||
} else {
|
||||
// user has selected a file -> see if it already exists
|
||||
File file = new File(fileName);
|
||||
if (file.exists()) {
|
||||
// file already exists -> asks for confirmation
|
||||
MessageBox mb = new MessageBox(dialog.getParent(), SWT.ICON_WARNING
|
||||
| SWT.YES | SWT.NO);
|
||||
mb.setText("Confirm overwrite");
|
||||
mb.setMessage(fileName + " already exists. Do you want to overwrite it?");
|
||||
// user clicks Yes -> all done, drop out
|
||||
if(mb.open() == SWT.YES) {
|
||||
((WaveformViewer)obj).saveState(fileName);
|
||||
done = true;
|
||||
} else { // user clicks No -> redisplay the File Dialog
|
||||
done = false;
|
||||
}
|
||||
} else {
|
||||
// file does not exist -> save and drop out
|
||||
((WaveformViewer)obj).saveState(fileName);
|
||||
done = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return;
|
||||
} // end if(!load)
|
||||
|
||||
else { // load active tab settings
|
||||
String res = dialog.open();
|
||||
if(res != null && part!=null && (obj instanceof WaveformViewer)) {
|
||||
((WaveformViewer)obj).loadState(res);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,53 @@
|
||||
/*******************************************************************************
|
||||
* 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 javax.inject.Named;
|
||||
|
||||
import org.eclipse.e4.core.di.annotations.CanExecute;
|
||||
import org.eclipse.e4.core.di.annotations.Execute;
|
||||
import org.eclipse.e4.ui.model.application.ui.basic.MPart;
|
||||
import org.eclipse.e4.ui.workbench.modeling.EPartService;
|
||||
import org.eclipse.e4.ui.workbench.modeling.ESelectionService;
|
||||
import org.eclipse.jface.viewers.IStructuredSelection;
|
||||
|
||||
import com.minres.scviewer.database.ITx;
|
||||
import com.minres.scviewer.database.IWaveform;
|
||||
import com.minres.scviewer.e4.application.parts.WaveformViewer;
|
||||
|
||||
public class MoveWaveformHandler {
|
||||
|
||||
static final String PARAMETER_ID="com.minres.scviewer.e4.application.command.movewaveformupCommand.parameter.dir"; //$NON-NLS-1$
|
||||
|
||||
@CanExecute
|
||||
public Boolean canExecute(ESelectionService selectionService){
|
||||
Object sel = selectionService.getSelection();
|
||||
if( sel instanceof IStructuredSelection) {
|
||||
Object o= ((IStructuredSelection)sel).getFirstElement();
|
||||
return o instanceof IWaveform || o instanceof ITx;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Execute
|
||||
public void execute(@Named(PARAMETER_ID) String param, EPartService partService) {
|
||||
MPart part = partService.getActivePart();
|
||||
Object obj = part.getObject();
|
||||
if(obj instanceof WaveformViewer){
|
||||
if("up".equalsIgnoreCase(param)) //$NON-NLS-1$
|
||||
((WaveformViewer)obj).moveSelected(-1);
|
||||
else if("down".equalsIgnoreCase(param)) //$NON-NLS-1$
|
||||
((WaveformViewer)obj).moveSelected(1);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,55 @@
|
||||
/*******************************************************************************
|
||||
* 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 javax.inject.Named;
|
||||
|
||||
import org.eclipse.e4.core.di.annotations.CanExecute;
|
||||
import org.eclipse.e4.core.di.annotations.Execute;
|
||||
import org.eclipse.e4.ui.model.application.ui.basic.MPart;
|
||||
import org.eclipse.e4.ui.workbench.modeling.EPartService;
|
||||
import org.eclipse.e4.ui.workbench.modeling.ESelectionService;
|
||||
import org.eclipse.jface.viewers.IStructuredSelection;
|
||||
|
||||
import com.minres.scviewer.database.ITx;
|
||||
import com.minres.scviewer.database.IWaveform;
|
||||
import com.minres.scviewer.database.ui.GotoDirection;
|
||||
import com.minres.scviewer.e4.application.parts.WaveformViewer;
|
||||
|
||||
public class NavigateEvent {
|
||||
|
||||
final static String PARAMTER_ID="com.minres.scviewer.e4.application.command.navigateEventCommand.parameter.dir"; //$NON-NLS-1$
|
||||
|
||||
@CanExecute
|
||||
public Boolean canExecute(ESelectionService selectionService){
|
||||
Object sel = selectionService.getSelection();
|
||||
if( sel instanceof IStructuredSelection) {
|
||||
Object o= ((IStructuredSelection)sel).getFirstElement();
|
||||
return o instanceof IWaveform || o instanceof ITx;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Execute
|
||||
public void execute(@Named(PARAMTER_ID) String param, EPartService partService) {
|
||||
// public void execute(EPartService partService) {
|
||||
// String param="next";
|
||||
MPart part = partService.getActivePart();
|
||||
Object obj = part.getObject();
|
||||
if(obj instanceof WaveformViewer){
|
||||
if("next".equalsIgnoreCase(param)) //$NON-NLS-1$
|
||||
((WaveformViewer)obj).moveCursor(GotoDirection.NEXT);
|
||||
else if("prev".equalsIgnoreCase(param)) //$NON-NLS-1$
|
||||
((WaveformViewer)obj).moveCursor(GotoDirection.PREV);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,52 @@
|
||||
/*******************************************************************************
|
||||
* 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 javax.inject.Named;
|
||||
|
||||
import org.eclipse.e4.core.di.annotations.CanExecute;
|
||||
import org.eclipse.e4.core.di.annotations.Execute;
|
||||
import org.eclipse.e4.ui.model.application.ui.basic.MPart;
|
||||
import org.eclipse.e4.ui.workbench.modeling.EPartService;
|
||||
import org.eclipse.e4.ui.workbench.modeling.ESelectionService;
|
||||
import org.eclipse.jface.viewers.IStructuredSelection;
|
||||
|
||||
import com.minres.scviewer.database.ITx;
|
||||
import com.minres.scviewer.database.ui.GotoDirection;
|
||||
import com.minres.scviewer.e4.application.parts.WaveformViewer;
|
||||
|
||||
public class NavigateTrans {
|
||||
|
||||
final static String PARAMTER_ID="com.minres.scviewer.e4.application.command.navigateTransCommand.parameter.dir"; //$NON-NLS-1$
|
||||
|
||||
@CanExecute
|
||||
public Boolean canExecute(ESelectionService selectionService){
|
||||
Object sel = selectionService.getSelection();
|
||||
if( sel instanceof IStructuredSelection) {
|
||||
Object o= ((IStructuredSelection)sel).getFirstElement();
|
||||
return o instanceof ITx;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Execute
|
||||
public void execute(@Named(PARAMTER_ID) String param, EPartService partService) {
|
||||
MPart part = partService.getActivePart();
|
||||
Object obj = part.getObject();
|
||||
if(obj instanceof WaveformViewer){
|
||||
if("next".equalsIgnoreCase(param)) //$NON-NLS-1$
|
||||
((WaveformViewer)obj).moveSelection(GotoDirection.NEXT);
|
||||
else if("prev".equalsIgnoreCase(param)) //$NON-NLS-1$
|
||||
((WaveformViewer)obj).moveSelection(GotoDirection.PREV);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,51 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2015 MINRES Technologies GmbH and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* MINRES Technologies GmbH - initial API and implementation
|
||||
*******************************************************************************/
|
||||
package com.minres.scviewer.e4.application.handlers;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.e4.core.contexts.IEclipseContext;
|
||||
import org.eclipse.e4.core.di.annotations.Execute;
|
||||
import org.eclipse.e4.ui.model.application.MApplication;
|
||||
import org.eclipse.e4.ui.model.application.ui.basic.MPart;
|
||||
import org.eclipse.e4.ui.model.application.ui.basic.MPartStack;
|
||||
import org.eclipse.e4.ui.workbench.modeling.EModelService;
|
||||
import org.eclipse.e4.ui.workbench.modeling.EPartService;
|
||||
import org.eclipse.e4.ui.workbench.modeling.EPartService.PartState;
|
||||
import org.eclipse.jface.window.Window;
|
||||
import org.eclipse.swt.widgets.Shell;
|
||||
|
||||
import com.minres.scviewer.e4.application.Messages;
|
||||
import com.minres.scviewer.e4.application.parts.FileBrowserDialog;
|
||||
public class OpenHandler {
|
||||
|
||||
@Execute
|
||||
public void execute(Shell shell, MApplication app, EModelService modelService, EPartService partService){
|
||||
FileBrowserDialog dlg = new FileBrowserDialog(shell);
|
||||
//dlg.create();
|
||||
dlg.setFilterExtensions (new String []{Messages.OpenHandler_0, "*"});
|
||||
if (dlg.open() != Window.OK) return;
|
||||
List<File> files = dlg.getSelectedFiles();
|
||||
MPart part = partService .createPart("com.minres.scviewer.e4.application.partdescriptor.waveformviewer"); //$NON-NLS-1$
|
||||
part.setLabel(files.get(0).getName());
|
||||
MPartStack partStack = (MPartStack)modelService.find("org.eclipse.editorss", app); //$NON-NLS-1$
|
||||
partStack.getChildren().add(part);
|
||||
partService.showPart(part, PartState.ACTIVATE);
|
||||
final IEclipseContext ctx=part.getContext();
|
||||
files.stream()
|
||||
.map(x -> x.getAbsolutePath())
|
||||
.reduce((s1, s2) -> s1 + "," + s2)
|
||||
.ifPresent(s -> ctx.modify("input", s)); //$NON-NLS-1$
|
||||
ctx.modify("config", ""); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,29 @@
|
||||
/*******************************************************************************
|
||||
* 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;
|
||||
import org.eclipse.e4.ui.workbench.IWorkbench;
|
||||
import org.eclipse.jface.dialogs.MessageDialog;
|
||||
import org.eclipse.swt.widgets.Shell;
|
||||
|
||||
import com.minres.scviewer.e4.application.Messages;
|
||||
|
||||
|
||||
public class QuitHandler {
|
||||
@Execute
|
||||
public void execute(IWorkbench workbench, Shell shell){
|
||||
if (MessageDialog.openConfirm(shell, Messages.QuitHandler_0,
|
||||
Messages.QuitHandler_1)) {
|
||||
workbench.close();
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,31 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2015 MINRES Technologies GmbH and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* MINRES Technologies GmbH - initial API and implementation
|
||||
*******************************************************************************/
|
||||
package com.minres.scviewer.e4.application.handlers;
|
||||
|
||||
import org.eclipse.e4.core.di.annotations.CanExecute;
|
||||
import org.eclipse.e4.core.di.annotations.Execute;
|
||||
import org.eclipse.e4.ui.workbench.modeling.EPartService;
|
||||
|
||||
public class SaveHandler {
|
||||
|
||||
@CanExecute
|
||||
public boolean canExecute(EPartService partService) {
|
||||
if (partService != null) {
|
||||
return !partService.getDirtyParts().isEmpty();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Execute
|
||||
public void execute(EPartService partService) {
|
||||
partService.saveAll(false);
|
||||
}
|
||||
}
|
@ -0,0 +1,43 @@
|
||||
/*******************************************************************************
|
||||
* 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 javax.inject.Inject;
|
||||
|
||||
import org.eclipse.e4.core.di.annotations.Execute;
|
||||
import org.eclipse.e4.core.di.annotations.Optional;
|
||||
import org.eclipse.e4.ui.model.application.ui.basic.MPart;
|
||||
import org.eclipse.e4.ui.workbench.modeling.EPartService;
|
||||
|
||||
import com.minres.scviewer.e4.application.parts.DesignBrowser;
|
||||
|
||||
public class SelectAllHandler {
|
||||
|
||||
@Inject @Optional DesignBrowser designBrowser;
|
||||
|
||||
@Execute
|
||||
public void execute(EPartService partService) {
|
||||
if(designBrowser==null) designBrowser = getListPart(partService);
|
||||
if(designBrowser!=null){
|
||||
designBrowser.selectAllWaveforms();
|
||||
}
|
||||
}
|
||||
|
||||
protected DesignBrowser getListPart(EPartService partService){
|
||||
MPart part = partService.getActivePart();
|
||||
if(part.getObject() instanceof DesignBrowser)
|
||||
return (DesignBrowser) part.getObject();
|
||||
else
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,35 @@
|
||||
/*******************************************************************************
|
||||
* 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 javax.inject.Named;
|
||||
|
||||
import org.eclipse.e4.core.di.annotations.Execute;
|
||||
import org.eclipse.e4.ui.model.application.ui.basic.MPart;
|
||||
import org.eclipse.e4.ui.workbench.modeling.EPartService;
|
||||
|
||||
import com.minres.scviewer.e4.application.parts.WaveformViewer;
|
||||
|
||||
public class SetRelationTypeHandler {
|
||||
final static String PARAMTER_ID="com.minres.scviewer.e4.application.commandparameter.relationName"; //$NON-NLS-1$
|
||||
|
||||
@Execute
|
||||
public void execute(@Named(PARAMTER_ID) String relationName, EPartService partService) {
|
||||
MPart part = partService.getActivePart();
|
||||
Object obj = part.getObject();
|
||||
if(obj instanceof WaveformViewer){
|
||||
WaveformViewer waveformViewerPart = (WaveformViewer) obj;
|
||||
waveformViewerPart.setNavigationRelationType(relationName);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,40 @@
|
||||
/*******************************************************************************
|
||||
* 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 javax.inject.Named;
|
||||
|
||||
import org.eclipse.e4.core.di.annotations.CanExecute;
|
||||
import org.eclipse.e4.core.di.annotations.Execute;
|
||||
import org.eclipse.e4.ui.css.swt.theme.IThemeEngine;
|
||||
import org.eclipse.e4.ui.workbench.modeling.EPartService;
|
||||
|
||||
/*
|
||||
* see http://www.vogella.com/tutorials/Eclipse4CSS/article.html#tutorial_cssstyling
|
||||
*/
|
||||
@SuppressWarnings("restriction")
|
||||
public class ThemeSetHandler {
|
||||
final static String PARAMTER_ID = "com.minres.scviewer.e4.application.command.theme.parameter.id"; //$NON-NLS-1$
|
||||
|
||||
@CanExecute
|
||||
public boolean canExecute(EPartService partService) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Execute
|
||||
public void setTheme(@Named(PARAMTER_ID) String param, IThemeEngine engine) {
|
||||
if (!engine.getActiveTheme().getId().equals(param)) {
|
||||
// second argument defines that change is
|
||||
// persisted and restored on restart
|
||||
engine.setTheme(param, true);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,50 @@
|
||||
/*******************************************************************************
|
||||
* 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 javax.inject.Named;
|
||||
|
||||
import org.eclipse.e4.core.di.annotations.CanExecute;
|
||||
import org.eclipse.e4.core.di.annotations.Execute;
|
||||
import org.eclipse.e4.ui.model.application.ui.basic.MPart;
|
||||
import org.eclipse.e4.ui.workbench.modeling.EPartService;
|
||||
|
||||
import com.minres.scviewer.e4.application.parts.WaveformViewer;
|
||||
|
||||
public class ZoomHandler {
|
||||
|
||||
final static String PARAMTER_ID="com.minres.scviewer.e4.application.command.zoomcommand.parameter.level"; //$NON-NLS-1$
|
||||
|
||||
@CanExecute
|
||||
public boolean canExecute(EPartService partService) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Execute
|
||||
public void execute(@Named(PARAMTER_ID) String level, EPartService partService) {
|
||||
MPart part = partService.getActivePart();
|
||||
Object obj = part.getObject();
|
||||
if(obj instanceof WaveformViewer){
|
||||
WaveformViewer waveformViewerPart = (WaveformViewer) obj;
|
||||
int zoomLevel = waveformViewerPart.getZoomLevel();
|
||||
if("in".equalsIgnoreCase(level)) //$NON-NLS-1$
|
||||
waveformViewerPart.setZoomLevel(zoomLevel-1);
|
||||
else if("out".equalsIgnoreCase(level)) //$NON-NLS-1$
|
||||
waveformViewerPart.setZoomLevel(zoomLevel+1);
|
||||
else if("fit".equalsIgnoreCase(level)) //$NON-NLS-1$
|
||||
waveformViewerPart.setZoomFit();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,779 @@
|
||||
/*******************************************************************************
|
||||
* 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");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,27 @@
|
||||
/*******************************************************************************
|
||||
* 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;
|
||||
/**
|
||||
* Preference constants for the heap status.
|
||||
*/
|
||||
public interface IHeapStatusConstants {
|
||||
|
||||
/**
|
||||
* Preference key for the update interval (value in milliseconds).
|
||||
*/
|
||||
String PREF_UPDATE_INTERVAL = "HeapStatus.updateInterval"; //$NON-NLS-1$
|
||||
|
||||
/**
|
||||
* Preference key for whether to show max heap, if available (value is boolean).
|
||||
*/
|
||||
String PREF_SHOW_MAX = "HeapStatus.showMax"; //$NON-NLS-1$
|
||||
|
||||
}
|
@ -0,0 +1,249 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2015 MINRES Technologies GmbH and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* MINRES Technologies GmbH - initial API and implementation
|
||||
*******************************************************************************/
|
||||
package com.minres.scviewer.e4.application.internal.status;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.annotation.PreDestroy;
|
||||
import javax.inject.Inject;
|
||||
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
import org.eclipse.core.runtime.NullProgressMonitor;
|
||||
import org.eclipse.core.runtime.jobs.IJobChangeEvent;
|
||||
import org.eclipse.core.runtime.jobs.Job;
|
||||
import org.eclipse.core.runtime.jobs.JobChangeAdapter;
|
||||
import org.eclipse.core.runtime.jobs.ProgressProvider;
|
||||
import org.eclipse.e4.core.di.annotations.Optional;
|
||||
import org.eclipse.e4.ui.di.UIEventTopic;
|
||||
import org.eclipse.e4.ui.di.UISynchronize;
|
||||
import org.eclipse.e4.ui.model.application.ui.menu.MToolControl;
|
||||
import org.eclipse.e4.ui.workbench.modeling.EModelService;
|
||||
import org.eclipse.jface.action.StatusLineManager;
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.widgets.Composite;
|
||||
import org.eclipse.swt.widgets.Label;
|
||||
import org.eclipse.swt.widgets.ProgressBar;
|
||||
import org.osgi.service.prefs.PreferencesService;
|
||||
|
||||
import com.minres.scviewer.e4.application.AppModelId;
|
||||
import com.minres.scviewer.e4.application.Messages;
|
||||
|
||||
/**
|
||||
* The Class StatusBarControl.
|
||||
*/
|
||||
public class StatusBarControl {
|
||||
|
||||
/** The Constant STATUS_UPDATE. */
|
||||
public static final String STATUS_UPDATE="StatusUpdate"; //$NON-NLS-1$
|
||||
|
||||
/** The model service. */
|
||||
@Inject EModelService modelService;
|
||||
|
||||
/** The osgi preverences. */
|
||||
@Inject @Optional PreferencesService osgiPreverences;
|
||||
|
||||
/** The sync. */
|
||||
private final UISynchronize sync;
|
||||
|
||||
/** The manager. */
|
||||
protected StatusLineManager manager;
|
||||
|
||||
/** The monitor. */
|
||||
private SyncedProgressMonitor monitor;
|
||||
|
||||
/** The progress bar. */
|
||||
private ProgressBar progressBar;
|
||||
|
||||
/**
|
||||
* Instantiates a new status bar control.
|
||||
*
|
||||
* @param sync the sync
|
||||
*/
|
||||
@Inject
|
||||
public StatusBarControl(UISynchronize sync) {
|
||||
this.sync=sync;
|
||||
manager = new StatusLineManager();
|
||||
manager.update(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates the widget.
|
||||
*
|
||||
* @param parent the parent
|
||||
* @param toolControl the tool control
|
||||
*/
|
||||
@PostConstruct
|
||||
void createWidget(Composite parent, MToolControl toolControl) {
|
||||
if (toolControl.getElementId().equals(AppModelId.TOOLCONTROL_ORG_ECLIPSE_UI_STATUSLINE)) { //$NON-NLS-1$
|
||||
createStatusLine(parent, toolControl);
|
||||
} else if (toolControl.getElementId().equals(AppModelId.TOOLCONTROL_ORG_ECLIPSE_UI_HEAPSTATUS)) { //$NON-NLS-1$
|
||||
createHeapStatus(parent, toolControl);
|
||||
} else if (toolControl.getElementId().equals(AppModelId.TOOLCONTROL_ORG_ECLIPSE_UI_PROGRESSBAR)) { //$NON-NLS-1$
|
||||
createProgressBar(parent, toolControl);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Destroy.
|
||||
*/
|
||||
@PreDestroy
|
||||
void destroy() {
|
||||
if (manager != null) {
|
||||
manager.dispose();
|
||||
manager = null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates the progress bar.
|
||||
*
|
||||
* @param parent the parent
|
||||
* @param toolControl the tool control
|
||||
*/
|
||||
private void createProgressBar(Composite parent, MToolControl toolControl) {
|
||||
new Label(parent, SWT.NONE);
|
||||
progressBar = new ProgressBar(parent, SWT.SMOOTH);
|
||||
progressBar.setBounds(100, 10, 200, 20);
|
||||
new Label(parent, SWT.NONE);
|
||||
monitor=new SyncedProgressMonitor(progressBar);
|
||||
Job.getJobManager().setProgressProvider(new ProgressProvider() {
|
||||
@Override
|
||||
public IProgressMonitor createMonitor(Job job) {
|
||||
return monitor.addJob(job);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates the heap status.
|
||||
*
|
||||
* @param parent the parent
|
||||
* @param toolControl the tool control
|
||||
*/
|
||||
private void createHeapStatus(Composite parent, MToolControl toolControl) {
|
||||
new HeapStatus(parent, osgiPreverences.getSystemPreferences());
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates the status line.
|
||||
*
|
||||
* @param parent the parent
|
||||
* @param toolControl the tool control
|
||||
*/
|
||||
private void createStatusLine(Composite parent, MToolControl toolControl) {
|
||||
// IEclipseContext context = modelService.getContainingContext(toolControl);
|
||||
manager.createControl(parent);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the status event.
|
||||
*
|
||||
* @param text the text
|
||||
* @return the status event
|
||||
*/
|
||||
@Inject @Optional
|
||||
public void getStatusEvent(@UIEventTopic(STATUS_UPDATE) String text) {
|
||||
if(manager!=null ){
|
||||
manager.setMessage(text);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The Class SyncedProgressMonitor.
|
||||
*/
|
||||
private final class SyncedProgressMonitor extends NullProgressMonitor {
|
||||
|
||||
// thread-Safe via thread confinement of the UI-Thread
|
||||
/** The running tasks. */
|
||||
// (means access only via UI-Thread)
|
||||
private long runningTasks = 0L;
|
||||
|
||||
/** The progress bar. */
|
||||
private ProgressBar progressBar;
|
||||
|
||||
/**
|
||||
* Instantiates a new synced progress monitor.
|
||||
*
|
||||
* @param progressBar the progress bar
|
||||
*/
|
||||
public SyncedProgressMonitor(ProgressBar progressBar) {
|
||||
super();
|
||||
this.progressBar = progressBar;
|
||||
runningTasks=0;
|
||||
progressBar.setSelection(0);
|
||||
progressBar.setEnabled(false);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.core.runtime.NullProgressMonitor#beginTask(java.lang.String, int)
|
||||
*/
|
||||
@Override
|
||||
public void beginTask(final String name, final int totalWork) {
|
||||
sync.asyncExec(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
runningTasks++;
|
||||
if(runningTasks == 1) { // --- no task is running at the moment ---
|
||||
progressBar.setEnabled(true);
|
||||
progressBar.setSelection(0);
|
||||
}
|
||||
progressBar.setMaximum(totalWork);
|
||||
progressBar.setToolTipText(Messages.StatusBarControl_1 + runningTasks + Messages.StatusBarControl_2 + name);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.core.runtime.NullProgressMonitor#worked(int)
|
||||
*/
|
||||
@Override
|
||||
public void worked(final int work) {
|
||||
sync.asyncExec(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
progressBar.setSelection(progressBar.getSelection() + work);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the job.
|
||||
*
|
||||
* @param job the job
|
||||
* @return the i progress monitor
|
||||
*/
|
||||
public IProgressMonitor addJob(Job job){
|
||||
if(job != null){
|
||||
job.addJobChangeListener(new JobChangeAdapter() {
|
||||
@Override
|
||||
public void done(final IJobChangeEvent event) {
|
||||
sync.asyncExec(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if(event.getResult()==null) return;
|
||||
if(runningTasks>0) runningTasks--;
|
||||
if (runningTasks > 0){ // --- some tasks are still running ---
|
||||
progressBar.setToolTipText(Messages.StatusBarControl_3 + runningTasks);
|
||||
} else { // --- all tasks are done (a reset of selection could also be done) ---
|
||||
progressBar.setToolTipText(Messages.StatusBarControl_4);
|
||||
progressBar.setSelection(progressBar.getMaximum());
|
||||
progressBar.setEnabled(false);
|
||||
}
|
||||
}
|
||||
});
|
||||
// clean-up
|
||||
event.getJob().removeJobChangeListener(this);
|
||||
}
|
||||
});
|
||||
}
|
||||
return this;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,50 @@
|
||||
/*******************************************************************************
|
||||
* 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 org.eclipse.jface.dialogs.Dialog;
|
||||
import org.eclipse.jface.resource.JFaceResources;
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.graphics.GC;
|
||||
import org.eclipse.swt.graphics.Point;
|
||||
import org.eclipse.swt.layout.GridData;
|
||||
import org.eclipse.swt.layout.GridLayout;
|
||||
import org.eclipse.swt.widgets.Display;
|
||||
import org.eclipse.swt.widgets.Shell;
|
||||
import org.eclipse.swt.widgets.ToolBar;
|
||||
import org.eclipse.swt.widgets.ToolItem;
|
||||
|
||||
/**
|
||||
* Simple class to provide some common internal Trim support.
|
||||
*
|
||||
*/
|
||||
public class TrimUtil {
|
||||
|
||||
/**
|
||||
* Default height for workbench trim.
|
||||
*/
|
||||
public static final int TRIM_DEFAULT_HEIGHT;
|
||||
static {
|
||||
Shell s = new Shell(Display.getCurrent(), SWT.NONE);
|
||||
s.setLayout(new GridLayout());
|
||||
ToolBar t = new ToolBar(s, SWT.NONE);
|
||||
t.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
|
||||
ToolItem ti = new ToolItem(t, SWT.PUSH);
|
||||
ti.setImage(JFaceResources.getImageRegistry().get(Dialog.DLG_IMG_MESSAGE_INFO));
|
||||
s.layout();
|
||||
int toolItemHeight = t.computeSize(SWT.DEFAULT, SWT.DEFAULT).y;
|
||||
GC gc = new GC(s);
|
||||
Point fontSize = gc.textExtent("Wg"); //$NON-NLS-1$
|
||||
gc.dispose();
|
||||
TRIM_DEFAULT_HEIGHT = Math.max(toolItemHeight, fontSize.y);
|
||||
s.dispose();
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,209 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2015 MINRES Technologies GmbH and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* MINRES Technologies GmbH - initial API and implementation
|
||||
*******************************************************************************/
|
||||
package com.minres.scviewer.e4.application.internal.status;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Named;
|
||||
|
||||
import org.eclipse.e4.core.di.annotations.Optional;
|
||||
import org.eclipse.e4.ui.di.UIEventTopic;
|
||||
import org.eclipse.e4.ui.di.UISynchronize;
|
||||
import org.eclipse.e4.ui.services.IServiceConstants;
|
||||
import org.eclipse.e4.ui.workbench.modeling.EModelService;
|
||||
import org.eclipse.jface.action.ContributionItem;
|
||||
import org.eclipse.jface.action.StatusLineManager;
|
||||
import org.eclipse.jface.viewers.IStructuredSelection;
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.custom.CLabel;
|
||||
import org.eclipse.swt.layout.GridData;
|
||||
import org.eclipse.swt.layout.GridLayout;
|
||||
import org.eclipse.swt.widgets.Composite;
|
||||
|
||||
import com.minres.scviewer.e4.application.Messages;
|
||||
|
||||
/**
|
||||
* The Class WaveStatusBarControl.
|
||||
*/
|
||||
public class WaveStatusBarControl extends StatusBarControl {
|
||||
|
||||
/** The Constant ZOOM_LEVEL. */
|
||||
public static final String ZOOM_LEVEL="ZoomLevelUpdate"; //$NON-NLS-1$
|
||||
|
||||
/** The Constant CURSOR_TIME. */
|
||||
public static final String CURSOR_TIME="CursorPosUpdate"; //$NON-NLS-1$
|
||||
|
||||
/** The Constant MARKER_TIME. */
|
||||
public static final String MARKER_TIME="MarkerPosUpdate"; //$NON-NLS-1$
|
||||
|
||||
/** The Constant MARKER_DIFF. */
|
||||
public static final String MARKER_DIFF="MarlerDiffUpdate"; //$NON-NLS-1$
|
||||
|
||||
/** The model service. */
|
||||
@Inject
|
||||
EModelService modelService;
|
||||
|
||||
/**
|
||||
* The Class TextContributionItem.
|
||||
*/
|
||||
class TextContributionItem extends ContributionItem {
|
||||
|
||||
/** The label string. */
|
||||
final String labelString;
|
||||
|
||||
/** The width. */
|
||||
//final int width;
|
||||
|
||||
/** The text. */
|
||||
CLabel label, text;
|
||||
|
||||
/** The content. */
|
||||
private String content;
|
||||
|
||||
/**
|
||||
* Instantiates a new text contribution item.
|
||||
*
|
||||
* @param labelString the label string
|
||||
* @param width the width
|
||||
*/
|
||||
public TextContributionItem(String labelString /*, int width */) {
|
||||
super();
|
||||
this.labelString = labelString;
|
||||
//this.width=width;
|
||||
content=""; //$NON-NLS-1$
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.jface.action.ContributionItem#fill(org.eclipse.swt.widgets.Composite)
|
||||
*/
|
||||
@Override
|
||||
public void fill(Composite parent) {
|
||||
Composite box=new Composite(parent, SWT.NONE); //NONE
|
||||
box.setLayout(new GridLayout(2, false));
|
||||
label=new CLabel(box, SWT.SHADOW_NONE);
|
||||
label.setText(labelString);
|
||||
text=new CLabel(box, SWT.SHADOW_IN);
|
||||
text.setAlignment(SWT.RIGHT);
|
||||
//GridData layoutData=new GridData(SWT.DEFAULT, SWT.DEFAULT, true, false);
|
||||
GridData layoutData=new GridData(SWT.DEFAULT, SWT.DEFAULT, true, false);
|
||||
layoutData.minimumWidth=70;
|
||||
//layoutData.minimumWidth=width;
|
||||
text.setLayoutData(layoutData);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.jface.action.ContributionItem#isDynamic()
|
||||
*/
|
||||
@Override
|
||||
public boolean isDynamic() {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the text.
|
||||
*
|
||||
* @param message the new text
|
||||
*/
|
||||
public void setText(String message){
|
||||
this.content=message;
|
||||
if(text!=null && !text.isDisposed()) text.setText(content);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/** The zoom contribution. */
|
||||
TextContributionItem cursorContribution, markerContribution, markerDiffContribution, zoomContribution;
|
||||
|
||||
/**
|
||||
* Instantiates a new wave status bar control.
|
||||
*
|
||||
* @param sync the sync
|
||||
*/
|
||||
@Inject
|
||||
public WaveStatusBarControl(UISynchronize sync) {
|
||||
super(sync);
|
||||
|
||||
cursorContribution = new TextContributionItem(Messages.WaveStatusBarControl_5 /*, 150 */); //150
|
||||
markerContribution = new TextContributionItem(Messages.WaveStatusBarControl_6 /*, 150 */); //150
|
||||
markerDiffContribution = new TextContributionItem(Messages.WaveStatusBarControl_7 /*, 150 */); //150
|
||||
zoomContribution = new TextContributionItem(Messages.WaveStatusBarControl_8 /*, 60 */); //60
|
||||
manager.appendToGroup(StatusLineManager.BEGIN_GROUP,cursorContribution);
|
||||
manager.appendToGroup(StatusLineManager.BEGIN_GROUP,markerContribution);
|
||||
manager.appendToGroup(StatusLineManager.BEGIN_GROUP,markerDiffContribution);
|
||||
manager.appendToGroup(StatusLineManager.BEGIN_GROUP, zoomContribution);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the selection.
|
||||
*
|
||||
* @param selection the new selection
|
||||
*/
|
||||
@Inject
|
||||
public void setSelection(@Named(IServiceConstants.ACTIVE_SELECTION)@Optional IStructuredSelection selection){
|
||||
if(manager!=null && selection!=null){
|
||||
switch(selection.size()){
|
||||
case 0:
|
||||
manager.setMessage(""); //$NON-NLS-1$
|
||||
break;
|
||||
case 1:
|
||||
manager.setMessage(selection.getFirstElement().getClass().getSimpleName()+Messages.WaveStatusBarControl_10);
|
||||
break;
|
||||
default:
|
||||
manager.setMessage(""+selection.size()+Messages.WaveStatusBarControl_12); //$NON-NLS-1$
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the zoom event.
|
||||
*
|
||||
* @param text the text
|
||||
* @return the zoom event
|
||||
*/
|
||||
@Inject @Optional
|
||||
public void getZoomEvent(@UIEventTopic(ZOOM_LEVEL) String text) {
|
||||
zoomContribution.setText(text);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the cursor event.
|
||||
*
|
||||
* @param text the text
|
||||
* @return the cursor event
|
||||
*/
|
||||
@Inject @Optional
|
||||
public void getCursorEvent(@UIEventTopic(CURSOR_TIME) String text) {
|
||||
cursorContribution.setText(text);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the marker event.
|
||||
*
|
||||
* @param text the text
|
||||
* @return the marker event
|
||||
*/
|
||||
@Inject @Optional
|
||||
public void getMarkerEvent(@UIEventTopic(MARKER_TIME) String text) {
|
||||
markerContribution.setText(text);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the diff event.
|
||||
*
|
||||
* @param text the text
|
||||
* @return the diff event
|
||||
*/
|
||||
@Inject @Optional
|
||||
public void getDiffEvent(@UIEventTopic(MARKER_DIFF) String text) {
|
||||
markerDiffContribution.setText(text);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,180 @@
|
||||
/*******************************************************************************
|
||||
* 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.util;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Hashtable;
|
||||
import java.util.List;
|
||||
import java.util.Timer;
|
||||
import java.util.TimerTask;
|
||||
|
||||
/**
|
||||
* Class monitoring a {@link File} for changes.
|
||||
*
|
||||
*/
|
||||
public class FileMonitor {
|
||||
|
||||
/** The timer. */
|
||||
private Timer timer;
|
||||
|
||||
/** The enabled. */
|
||||
private boolean enabled;
|
||||
|
||||
/** The timer entries. */
|
||||
private Hashtable<String, FileSetMonitorTask> timerEntries;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*/
|
||||
public FileMonitor() {
|
||||
// Create timer, run timer thread as daemon.
|
||||
timer = new Timer(true);
|
||||
timerEntries = new Hashtable<String, FileSetMonitorTask>();
|
||||
enabled=true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a monitored file with a FileChangeListener.
|
||||
*
|
||||
* @param listener listener to notify when the file changed.
|
||||
* @param file the file
|
||||
* @param period polling period in milliseconds.
|
||||
* @return the i modification checker
|
||||
*/
|
||||
public IModificationChecker addFileChangeListener(IFileChangeListener listener, File file, long period) {
|
||||
return addFileChangeListener(listener, Arrays.asList(new File[]{file}), period);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a monitored file with a FileChangeListener.
|
||||
* List<File> filesToLoad
|
||||
*
|
||||
* @param listener listener to notify when the file changed.
|
||||
* @param files the files
|
||||
* @param period polling period in milliseconds.
|
||||
* @return the i modification checker
|
||||
*/
|
||||
public IModificationChecker addFileChangeListener(IFileChangeListener listener, List<File> files, long period) {
|
||||
removeFileChangeListener(listener);
|
||||
FileSetMonitorTask task = new FileSetMonitorTask(listener, files, period);
|
||||
timerEntries.put(Integer.toHexString(listener.hashCode()), task);
|
||||
timer.schedule(task, period, period);
|
||||
return task;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the listener from the notification list.
|
||||
*
|
||||
* @param listener
|
||||
* the listener to be removed.
|
||||
*/
|
||||
public void removeFileChangeListener(IFileChangeListener listener) {
|
||||
FileSetMonitorTask task = timerEntries.remove(Integer.toHexString(listener.hashCode()));
|
||||
if (task != null) task.cancel();
|
||||
}
|
||||
|
||||
/**
|
||||
* Fires notification that a file changed.
|
||||
*
|
||||
* @param listener
|
||||
* file change listener
|
||||
* @param file
|
||||
* the file that changed
|
||||
*/
|
||||
protected void fireFileChangeEvent(IFileChangeListener listener, List<File> file) {
|
||||
if(enabled) listener.fileChanged(file);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if is enabled.
|
||||
*
|
||||
* @return true, if is enabled
|
||||
*/
|
||||
public boolean isEnabled() {
|
||||
return enabled;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the enabled.
|
||||
*
|
||||
* @param enabled the new enabled
|
||||
*/
|
||||
public void setEnabled(boolean enabled) {
|
||||
this.enabled = enabled;
|
||||
}
|
||||
|
||||
/**
|
||||
* File monitoring task.
|
||||
*/
|
||||
class FileSetMonitorTask extends TimerTask implements IModificationChecker{
|
||||
|
||||
/** The listener. */
|
||||
IFileChangeListener listener;
|
||||
|
||||
/** The monitored files. */
|
||||
private List<File> monitoredFiles;
|
||||
|
||||
/** The last modified times. */
|
||||
private List<Long> lastModifiedTimes;
|
||||
|
||||
/** The period. */
|
||||
public final long period;
|
||||
|
||||
/**
|
||||
* Instantiates a new file set monitor task.
|
||||
*
|
||||
* @param listener the listener
|
||||
* @param monitoredFiles the monitored files
|
||||
* @param period the period
|
||||
*/
|
||||
public FileSetMonitorTask(IFileChangeListener listener, List<File> monitoredFiles, long period) {
|
||||
this.period=period;
|
||||
this.monitoredFiles = monitoredFiles;
|
||||
this.listener = listener;
|
||||
lastModifiedTimes= new ArrayList<>();
|
||||
for(File monitoredFile:monitoredFiles){
|
||||
Long lmt = 0L;
|
||||
try {
|
||||
lmt=monitoredFile.lastModified();
|
||||
} catch(Exception e){}
|
||||
lastModifiedTimes.add(lmt);
|
||||
}
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see java.util.TimerTask#run()
|
||||
*/
|
||||
public void run() {
|
||||
check();
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see com.minres.scviewer.e4.application.internal.util.IModificationChecker#check()
|
||||
*/
|
||||
public void check() {
|
||||
boolean res = false;
|
||||
for(int i=0; i<monitoredFiles.size(); ++i){
|
||||
File file = monitoredFiles.get(i);
|
||||
Long lmt = 0L;
|
||||
try {
|
||||
lmt=file.lastModified();
|
||||
} catch(Exception e){}
|
||||
if (!lmt.equals(lastModifiedTimes.get(i)))
|
||||
res |= true;
|
||||
lastModifiedTimes.set(i, lmt);
|
||||
}
|
||||
if(res)
|
||||
fireFileChangeEvent(this.listener, monitoredFiles);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
/*******************************************************************************
|
||||
* 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.util;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Listener interested in {@link File} changes.
|
||||
*
|
||||
*/
|
||||
public interface IFileChangeListener {
|
||||
|
||||
/**
|
||||
* Invoked when a file changes.
|
||||
*
|
||||
* @param file the file
|
||||
*/
|
||||
public void fileChanged(List<File> file);
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
/*******************************************************************************
|
||||
* 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.util;
|
||||
|
||||
/**
|
||||
* The Interface IModificationChecker. Allows to trigger a check independent of the timer
|
||||
*/
|
||||
public interface IModificationChecker {
|
||||
|
||||
/**
|
||||
* Check.
|
||||
*/
|
||||
public void check();
|
||||
|
||||
}
|
@ -0,0 +1,57 @@
|
||||
AboutDialog_0=\nSCViewer - a SystemC waveform viewer\n\nVersion: {0}\n
|
||||
AboutDialog_1=\nCopyright (c) 2015, 2019, 2020 MINRES Technologies GmbH and others.\n\nAll rights reserved. MINRES and the MINRES logo are trademarks of MINRES Technologies GmbH, http://www.minres.com/. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at http://www.eclipse.org/legal/epl-v10.html\n\nParts of the software are governed by the Apache License Version 2.0 available at http://www.apache.org/licenses/. These are namely org.mapdb and org.sqlite JDBC driver\n\nSource code is hosted at https://git.minres.com/VP-Tools/SCViewer and the master branch is mirrored to GitHub: https://github.com/minres/SCViewer\n
|
||||
DesignBrowser_12=Append all after
|
||||
DesignBrowser_16=Insert all before
|
||||
DesignBrowser_2=Enter text to filter waveforms
|
||||
DesignBrowser_3=Enter text to filter hierarchy
|
||||
DesignBrowser_4=Append after
|
||||
DesignBrowser_8=Insert before
|
||||
LoadingWaveformDb_0=Database loading...
|
||||
LoadStoreSettingsHandler_2=*.scview
|
||||
LoadStoreSettingsHandler_3=SCViewer.scview
|
||||
OpenHandler_0=*.vcd;*.txdb;*.txlog;*.fbrdb
|
||||
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
|
||||
SCViewerPreferencesPage_1=Show hover window in waveform
|
||||
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=fbrdb
|
||||
WaveformViewer_37=Database open
|
||||
WaveformViewer_38=Would you like to open the adjacent database
|
||||
WaveformViewer_39=\ as well?
|
||||
WaveStatusBarControl_10=\ selected
|
||||
WaveStatusBarControl_12=\ Elements
|
||||
WaveStatusBarControl_5=C:
|
||||
WaveStatusBarControl_6=M:
|
||||
WaveStatusBarControl_7=C-M:
|
||||
WaveStatusBarControl_8=Z:
|
@ -0,0 +1,275 @@
|
||||
package com.minres.scviewer.e4.application.options;
|
||||
|
||||
/**
|
||||
* This class holds all the data for an option. This includes the prefix, the key, the separator
|
||||
* (for value options), the multiplicity, and all the other settings describing the option. The class
|
||||
* is designed to be only a data container from a user perspective, i. e. the user has read-access to
|
||||
* any data determined by the {@link Options#check()}, but not access to any of the other methods
|
||||
* which are used internally for the operation of the actual check.
|
||||
*/
|
||||
|
||||
public class OptionData {
|
||||
|
||||
private final static String CLASS = "OptionData";
|
||||
|
||||
private Options.Prefix prefix = null;
|
||||
private String key = null;
|
||||
private boolean detail = false;
|
||||
private Options.Separator separator = null;
|
||||
private boolean value = false;
|
||||
private Options.Multiplicity multiplicity = null;
|
||||
private java.util.regex.Pattern pattern = null;
|
||||
private int counter = 0;
|
||||
private java.util.ArrayList<String> values = null;
|
||||
private java.util.ArrayList<String> details = null;
|
||||
|
||||
/**
|
||||
* The constructor
|
||||
*/
|
||||
|
||||
OptionData(Options.Prefix prefix,
|
||||
String key,
|
||||
boolean detail,
|
||||
Options.Separator separator,
|
||||
boolean value,
|
||||
Options.Multiplicity multiplicity) {
|
||||
|
||||
if (prefix == null) throw new IllegalArgumentException(CLASS + ": prefix may not be null");
|
||||
if (key == null) throw new IllegalArgumentException(CLASS + ": key may not be null");
|
||||
if (separator == null) throw new IllegalArgumentException(CLASS + ": separator may not be null");
|
||||
if (multiplicity == null) throw new IllegalArgumentException(CLASS + ": multiplicity may not be null");
|
||||
|
||||
//.... The data describing the option
|
||||
|
||||
this.prefix = prefix;
|
||||
this.key = key;
|
||||
this.detail = detail;
|
||||
this.separator = separator;
|
||||
this.value = value;
|
||||
this.multiplicity = multiplicity;
|
||||
|
||||
//.... Create the pattern to match this option
|
||||
|
||||
if (value) {
|
||||
if (separator == Options.Separator.BLANK) {
|
||||
if (detail) {
|
||||
pattern = java.util.regex.Pattern.compile(prefix.getName() + key + "((\\w|\\.)+)$");
|
||||
} else {
|
||||
pattern = java.util.regex.Pattern.compile(prefix.getName() + key + "$");
|
||||
}
|
||||
} else {
|
||||
if (detail) {
|
||||
pattern = java.util.regex.Pattern.compile(prefix.getName() + key + "((\\w|\\.)+)" + separator.getName() + "(.+)$");
|
||||
} else {
|
||||
pattern = java.util.regex.Pattern.compile(prefix.getName() + key + separator.getName() + "(.+)$");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
pattern = java.util.regex.Pattern.compile(prefix.getName() + key + "$");
|
||||
}
|
||||
|
||||
//.... Structures to hold result data
|
||||
|
||||
if (value) {
|
||||
values = new java.util.ArrayList<String>();
|
||||
if (detail)
|
||||
details = new java.util.ArrayList<String>();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter method for <code>prefix</code> property
|
||||
* <p>
|
||||
* @return The value for the <code>prefix</code> property
|
||||
*/
|
||||
|
||||
Options.Prefix getPrefix() {
|
||||
return prefix;
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter method for <code>key</code> property
|
||||
* <p>
|
||||
* @return The value for the <code>key</code> property
|
||||
*/
|
||||
|
||||
String getKey() {
|
||||
return key;
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter method for <code>detail</code> property
|
||||
* <p>
|
||||
* @return The value for the <code>detail</code> property
|
||||
*/
|
||||
|
||||
boolean useDetail() {
|
||||
return detail;
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter method for <code>separator</code> property
|
||||
* <p>
|
||||
* @return The value for the <code>separator</code> property
|
||||
*/
|
||||
|
||||
Options.Separator getSeparator() {
|
||||
return separator;
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter method for <code>value</code> property
|
||||
* <p>
|
||||
* @return The value for the <code>value</code> property
|
||||
*/
|
||||
|
||||
boolean useValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter method for <code>multiplicity</code> property
|
||||
* <p>
|
||||
* @return The value for the <code>multiplicity</code> property
|
||||
*/
|
||||
|
||||
Options.Multiplicity getMultiplicity() {
|
||||
return multiplicity;
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter method for <code>pattern</code> property
|
||||
* <p>
|
||||
* @return The value for the <code>pattern</code> property
|
||||
*/
|
||||
|
||||
java.util.regex.Pattern getPattern() {
|
||||
return pattern;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the number of results found for this option, which is number of times the key matched
|
||||
* <p>
|
||||
* @return The number of results
|
||||
*/
|
||||
|
||||
public int getResultCount() {
|
||||
if (value) {
|
||||
return values.size();
|
||||
} else {
|
||||
return counter;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the value with the given index. The index can range between 0 and {@link #getResultCount()}<code> - 1</code>.
|
||||
* However, only for value options, a non-<code>null</code> value will be returned. Non-value options always
|
||||
* return <code>null</code>.
|
||||
* <p>
|
||||
* @param index The index for the desired value
|
||||
* <p>
|
||||
* @return The option value with the given index
|
||||
* <p>
|
||||
* @throws IllegalArgumentException If the value for <code>index</code> is out of bounds
|
||||
*/
|
||||
|
||||
public String getResultValue(int index) {
|
||||
if (!value) return null;
|
||||
if (index < 0 || index >= getResultCount()) throw new IllegalArgumentException(CLASS + ": illegal value for index");
|
||||
return values.get(index);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the detail with the given index. The index can range between 0 and {@link #getResultCount()}<code> - 1</code>.
|
||||
* However, only for value options which take details, a non-<code>null</code> detail will be returned. Non-value options
|
||||
* and value options which do not take details always return <code>null</code>.
|
||||
* <p>
|
||||
* @param index The index for the desired value
|
||||
* <p>
|
||||
* @return The option detail with the given index
|
||||
* <p>
|
||||
* @throws IllegalArgumentException If the value for <code>index</code> is out of bounds
|
||||
*/
|
||||
|
||||
public String getResultDetail(int index) {
|
||||
if (!detail) return null;
|
||||
if (index < 0 || index >= getResultCount()) throw new IllegalArgumentException(CLASS + ": illegal value for index");
|
||||
return details.get(index);
|
||||
}
|
||||
|
||||
/**
|
||||
* Store the data for a match found
|
||||
*/
|
||||
|
||||
void addResult(String valueData, String detailData) {
|
||||
if (value) {
|
||||
if (valueData == null) throw new IllegalArgumentException(CLASS + ": valueData may not be null");
|
||||
values.add(valueData);
|
||||
if (detail) {
|
||||
if (detailData == null) throw new IllegalArgumentException(CLASS + ": detailData may not be null");
|
||||
details.add(detailData);
|
||||
}
|
||||
}
|
||||
counter++;
|
||||
}
|
||||
|
||||
/**
|
||||
* This is the overloaded {@link Object#toString()} method, and it is provided mainly for debugging
|
||||
* purposes.
|
||||
* <p>
|
||||
* @return A string representing the instance
|
||||
*/
|
||||
|
||||
public String toString() {
|
||||
|
||||
StringBuffer sb = new StringBuffer();
|
||||
|
||||
sb.append("Prefix : ");
|
||||
sb.append(prefix);
|
||||
sb.append('\n');
|
||||
sb.append("Key : ");
|
||||
sb.append(key);
|
||||
sb.append('\n');
|
||||
sb.append("Detail : ");
|
||||
sb.append(detail);
|
||||
sb.append('\n');
|
||||
sb.append("Separator : ");
|
||||
sb.append(separator);
|
||||
sb.append('\n');
|
||||
sb.append("Value : ");
|
||||
sb.append(value);
|
||||
sb.append('\n');
|
||||
sb.append("Multiplicity: ");
|
||||
sb.append(multiplicity);
|
||||
sb.append('\n');
|
||||
sb.append("Pattern : ");
|
||||
sb.append(pattern);
|
||||
sb.append('\n');
|
||||
|
||||
sb.append("Results : ");
|
||||
sb.append(counter);
|
||||
sb.append('\n');
|
||||
if (value) {
|
||||
if (detail) {
|
||||
for (int i = 0; i < values.size(); i++) {
|
||||
sb.append(details.get(i));
|
||||
sb.append(" / ");
|
||||
sb.append(values.get(i));
|
||||
sb.append('\n');
|
||||
}
|
||||
} else {
|
||||
for (int i = 0; i < values.size(); i++) {
|
||||
sb.append(values.get(i));
|
||||
sb.append('\n');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return sb.toString();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,276 @@
|
||||
package com.minres.scviewer.e4.application.options;
|
||||
|
||||
/**
|
||||
* This class holds the information for a <i>set</i> of options. A set can hold any number of
|
||||
* <code>OptionData</code> instances which are checked together to determine success or failure.
|
||||
* <p>
|
||||
* The approach to use this class looks like this:
|
||||
* <p>
|
||||
* <ol>
|
||||
* <li> The user uses any of the <code>Options.addSet()</code> (e. g. {@link Options#addSet(String)}) to create
|
||||
* any number of sets required (or just relies on the default set, if only one set is required)
|
||||
* <li> The user adds all required option definitions to each set
|
||||
* <li> Using any of the <code>Options.check()</code> methods, each set can be checked whether the options
|
||||
* that were specified on the command line satisfy its requirements
|
||||
* <li> If the check was successful for a given set, several data items are available from this class:
|
||||
* <ul>
|
||||
* <li> All options defined for the set (through with e. g. values, details, and multiplicity are available)
|
||||
* <li> All data items found (these are the items on the command line which do not start with the prefix,
|
||||
* i. e. non-option arguments)
|
||||
* <li> All unmatched arguments on the command line (these are the items on the command line which start
|
||||
* with the prefix, but do not match to one of the options).
|
||||
* Programs can elect to ignore these, or react with an error
|
||||
* </ul>
|
||||
* </ol>
|
||||
*/
|
||||
|
||||
public class OptionSet {
|
||||
|
||||
private final static String CLASS = "OptionSet";
|
||||
|
||||
private java.util.ArrayList<OptionData> options = new java.util.ArrayList<OptionData>();
|
||||
private java.util.HashMap<String, OptionData> keys = new java.util.HashMap<String, OptionData>();
|
||||
private java.util.ArrayList<String> unmatched = new java.util.ArrayList<String>();
|
||||
private java.util.ArrayList<String> data = new java.util.ArrayList<String>();
|
||||
private String setName = null;
|
||||
private int minData = 0;
|
||||
private int maxData = 0;
|
||||
private Options.Prefix prefix = null;
|
||||
private Options.Multiplicity defaultMultiplicity = null;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
|
||||
OptionSet(Options.Prefix prefix, Options.Multiplicity defaultMultiplicity, String setName, int minData, int maxData) {
|
||||
if (setName == null) throw new IllegalArgumentException(CLASS + ": setName may not be null");
|
||||
if (minData < 0) throw new IllegalArgumentException(CLASS + ": minData must be >= 0");
|
||||
if (maxData < minData) throw new IllegalArgumentException(CLASS + ": maxData must be >= minData");
|
||||
this.prefix = prefix;
|
||||
this.defaultMultiplicity = defaultMultiplicity;
|
||||
this.setName = setName;
|
||||
this.minData = minData;
|
||||
this.maxData = maxData;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a list of all the options defined for this set
|
||||
* <p>
|
||||
* @return A list of {@link OptionData} instances defined for this set
|
||||
*/
|
||||
|
||||
public java.util.ArrayList<OptionData> getOptionData() {
|
||||
return options;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the data for a specific option, identified by its key name (which is unique)
|
||||
* <p>
|
||||
* @param key The key for the option
|
||||
* <p>
|
||||
* @return The {@link OptionData} instance
|
||||
* <p>
|
||||
* @throws IllegalArgumentException If the <code>key</code> is <code>null</code> or unknown in this set
|
||||
*/
|
||||
|
||||
public OptionData getOption(String key) {
|
||||
if (key == null) throw new IllegalArgumentException(CLASS + ": key may not be null");
|
||||
if (!keys.containsKey(key)) throw new IllegalArgumentException(CLASS + ": unknown key: " + key);
|
||||
return keys.get(key);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check whether a specific option is set, i. e. whether it was specified at least once on the command line.
|
||||
* <p>
|
||||
* @param key The key for the option
|
||||
* <p>
|
||||
* @return <code>true</code> or <code>false</code>, depending on the outcome of the check
|
||||
* <p>
|
||||
* @throws IllegalArgumentException If the <code>key</code> is <code>null</code> or unknown in this set
|
||||
*/
|
||||
|
||||
public boolean isSet(String key) {
|
||||
if (key == null) throw new IllegalArgumentException(CLASS + ": key may not be null");
|
||||
if (!keys.containsKey(key)) throw new IllegalArgumentException(CLASS + ": unknown key: " + key);
|
||||
return keys.get(key).getResultCount() > 0 ? true : false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter method for <code>setName</code> property
|
||||
* <p>
|
||||
* @return The value for the <code>setName</code> property
|
||||
*/
|
||||
|
||||
public String getSetName() {
|
||||
return setName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter method for <code>minData</code> property
|
||||
* <p>
|
||||
* @return The value for the <code>minData</code> property
|
||||
*/
|
||||
|
||||
public int getMinData() {
|
||||
return minData;
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter method for <code>maxData</code> property
|
||||
* <p>
|
||||
* @return The value for the <code>maxData</code> property
|
||||
*/
|
||||
|
||||
public int getMaxData() {
|
||||
return maxData;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the data items found (these are the items on the command line which do not start with the prefix, i. e. non-option arguments)
|
||||
* <p>
|
||||
* @return A list of strings with all data items found
|
||||
*/
|
||||
|
||||
public java.util.ArrayList<String> getData() {
|
||||
return data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return all unmatched items found (these are the items on the command line which start with the prefix, but do not
|
||||
* match to one of the options)
|
||||
* <p>
|
||||
* @return A list of strings with all unmatched items found
|
||||
*/
|
||||
|
||||
public java.util.ArrayList<String> getUnmatched() {
|
||||
return unmatched;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a non-value option with the given key, and the default prefix and multiplicity
|
||||
* <p>
|
||||
* @param key The key for the option
|
||||
* <p>
|
||||
* @return The set instance itself (to support invocation chaining for <code>addOption()</code> methods)
|
||||
* <p>
|
||||
* @throws IllegalArgumentException If the <code>key</code> is <code>null</code> or a key with this name has already been defined
|
||||
*/
|
||||
|
||||
public OptionSet addOption(String key) {
|
||||
return addOption(key, defaultMultiplicity);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a non-value option with the given key and multiplicity, and the default prefix
|
||||
* <p>
|
||||
* @param key The key for the option
|
||||
* @param multiplicity The multiplicity for the option
|
||||
* <p>
|
||||
* @return The set instance itself (to support invocation chaining for <code>addOption()</code> methods)
|
||||
* <p>
|
||||
* @throws IllegalArgumentException If the <code>key</code> is <code>null</code> or a key with this name has already been defined
|
||||
* or if <code>multiplicity</code> is <code>null</code>
|
||||
*/
|
||||
|
||||
public OptionSet addOption(String key, Options.Multiplicity multiplicity) {
|
||||
return addOption(key, false, Options.Separator.NONE, false, multiplicity);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a value option with the given key and separator, no details, and the default prefix and multiplicity
|
||||
* <p>
|
||||
* @param key The key for the option
|
||||
* @param separator The separator for the option
|
||||
* <p>
|
||||
* @return The set instance itself (to support invocation chaining for <code>addOption()</code> methods)
|
||||
* <p>
|
||||
* @throws IllegalArgumentException If the <code>key</code> is <code>null</code> or a key with this name has already been defined
|
||||
* or if <code>separator</code> is <code>null</code>
|
||||
*/
|
||||
|
||||
public OptionSet addOption(String key, Options.Separator separator) {
|
||||
return addOption(key, false, separator, true, defaultMultiplicity);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a value option with the given key, separator, and multiplicity, no details, and the default prefix
|
||||
* <p>
|
||||
* @param key The key for the option
|
||||
* @param separator The separator for the option
|
||||
* @param multiplicity The multiplicity for the option
|
||||
* <p>
|
||||
* @return The set instance itself (to support invocation chaining for <code>addOption()</code> methods)
|
||||
* <p>
|
||||
* @throws IllegalArgumentException If the <code>key</code> is <code>null</code> or a key with this name has already been defined
|
||||
* or if <code>separator</code> or <code>multiplicity</code> are <code>null</code>
|
||||
*/
|
||||
|
||||
public OptionSet addOption(String key, Options.Separator separator, Options.Multiplicity multiplicity) {
|
||||
return addOption(key, false, separator, true, multiplicity);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Add a value option with the given key and separator, possibly details, and the default prefix and multiplicity
|
||||
* <p>
|
||||
* @param key The key for the option
|
||||
* @param details A boolean indicating whether details are expected for the option
|
||||
* @param separator The separator for the option
|
||||
* <p>
|
||||
* @return The set instance itself (to support invocation chaining for <code>addOption()</code> methods)
|
||||
* <p>
|
||||
* @throws IllegalArgumentException If the <code>key</code> is <code>null</code> or a key with this name has already been defined
|
||||
* or if <code>separator</code> is <code>null</code>
|
||||
*/
|
||||
|
||||
public OptionSet addOption(String key, boolean details, Options.Separator separator) {
|
||||
return addOption(key, details, separator, true, defaultMultiplicity);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a value option with the given key, separator, and multiplicity, possibly details, and the default prefix
|
||||
* <p>
|
||||
* @param key The key for the option
|
||||
* @param details A boolean indicating whether details are expected for the option
|
||||
* @param separator The separator for the option
|
||||
* @param multiplicity The multiplicity for the option
|
||||
* <p>
|
||||
* @return The set instance itself (to support invocation chaining for <code>addOption()</code> methods)
|
||||
* <p>
|
||||
* @throws IllegalArgumentException If the <code>key</code> is <code>null</code> or a key with this name has already been defined
|
||||
* or if <code>separator</code> or <code>multiplicity</code> are <code>null</code>
|
||||
*/
|
||||
|
||||
public OptionSet addOption(String key, boolean details, Options.Separator separator, Options.Multiplicity multiplicity) {
|
||||
return addOption(key, details, separator, true, multiplicity);
|
||||
}
|
||||
|
||||
/**
|
||||
* The master method to add an option. Since there are combinations which are not
|
||||
* acceptable (like a NONE separator and a true value), this method is not public.
|
||||
* Internally, we only supply acceptable combinations.
|
||||
*/
|
||||
|
||||
OptionSet addOption(String key,
|
||||
boolean details,
|
||||
Options.Separator separator,
|
||||
boolean value,
|
||||
Options.Multiplicity multiplicity) {
|
||||
|
||||
if (key == null) throw new IllegalArgumentException(CLASS + ": key may not be null");
|
||||
if (multiplicity == null) throw new IllegalArgumentException(CLASS + ": multiplicity may not be null");
|
||||
if (separator == null) throw new IllegalArgumentException(CLASS + ": separator may not be null");
|
||||
if (keys.containsKey(key)) throw new IllegalArgumentException(CLASS + ": the key "
|
||||
+ key + " has already been defined for this OptionSet");
|
||||
|
||||
OptionData od = new OptionData(prefix, key, details, separator, value, multiplicity);
|
||||
options.add(od);
|
||||
keys.put(key, od);
|
||||
|
||||
return this;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,768 @@
|
||||
package com.minres.scviewer.e4.application.options;
|
||||
|
||||
/**
|
||||
* The central class for option processing. Sets are identified by their name, but there is also
|
||||
* an anonymous default set, which is very convenient if an application requieres only one set.
|
||||
*/
|
||||
|
||||
public class Options {
|
||||
|
||||
private final static String CLASS = "Options";
|
||||
|
||||
/**
|
||||
* The name used internally for the default set
|
||||
*/
|
||||
|
||||
public final static String DEFAULT_SET = "DEFAULT_OPTION_SET";
|
||||
|
||||
/**
|
||||
* An enum encapsulating the possible separators between value options and their actual values.
|
||||
*/
|
||||
|
||||
public enum Separator {
|
||||
|
||||
/**
|
||||
* Separate option and value by ":"
|
||||
*/
|
||||
|
||||
COLON(':'),
|
||||
|
||||
/**
|
||||
* Separate option and value by "="
|
||||
*/
|
||||
|
||||
EQUALS('='),
|
||||
|
||||
/**
|
||||
* Separate option and value by blank space
|
||||
*/
|
||||
|
||||
BLANK(' '), // Or, more precisely, whitespace (as allowed by the CLI)
|
||||
|
||||
/**
|
||||
* This is just a placeholder in case no separator is required (i. e. for non-value options)
|
||||
*/
|
||||
|
||||
NONE('D'); // NONE is a placeholder in case no separator is required, 'D' is just an arbitrary dummy value
|
||||
|
||||
private char c;
|
||||
|
||||
private Separator(char c) {
|
||||
this.c = c;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the actual separator character
|
||||
* <p>
|
||||
* @return The actual separator character
|
||||
*/
|
||||
|
||||
char getName() {
|
||||
return c;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* An enum encapsulating the possible prefixes identifying options (and separating them from command line data items)
|
||||
*/
|
||||
|
||||
public enum Prefix {
|
||||
|
||||
/**
|
||||
* Options start with a "-" (typically on Unix platforms)
|
||||
*/
|
||||
|
||||
DASH('-'),
|
||||
|
||||
/**
|
||||
* Options start with a "/" (typically on Windows platforms)
|
||||
*/
|
||||
|
||||
SLASH('/');
|
||||
|
||||
private char c;
|
||||
|
||||
private Prefix(char c) {
|
||||
this.c = c;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the actual prefix character
|
||||
* <p>
|
||||
* @return The actual prefix character
|
||||
*/
|
||||
|
||||
char getName() {
|
||||
return c;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* An enum encapsulating the possible multiplicities for options
|
||||
*/
|
||||
|
||||
public enum Multiplicity {
|
||||
|
||||
/**
|
||||
* Option needs to occur exactly once
|
||||
*/
|
||||
|
||||
ONCE,
|
||||
|
||||
/**
|
||||
* Option needs to occur at least once
|
||||
*/
|
||||
|
||||
ONCE_OR_MORE,
|
||||
|
||||
/**
|
||||
* Option needs to occur either once or not at all
|
||||
*/
|
||||
|
||||
ZERO_OR_ONE,
|
||||
|
||||
/**
|
||||
* Option can occur any number of times
|
||||
*/
|
||||
|
||||
ZERO_OR_MORE;
|
||||
|
||||
}
|
||||
|
||||
private java.util.HashMap<String, OptionSet> optionSets = new java.util.HashMap<String, OptionSet>();
|
||||
private Prefix prefix = null;
|
||||
private Multiplicity defaultMultiplicity = null;
|
||||
private String[] arguments = null;
|
||||
private int defaultMinData = 0;
|
||||
private int defaultMaxData = 0;
|
||||
private StringBuffer checkErrors = null;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* <p>
|
||||
* @param args The command line arguments to check
|
||||
* @param prefix The prefix to use for all command line options. It can only be set here for all options at
|
||||
* the same time
|
||||
* @param defaultMultiplicity The default multiplicity to use for all options (can be overridden when adding an option)
|
||||
* @param defMinData The default minimum number of data items for all sets (can be overridden when adding a set)
|
||||
* @param defMaxData The default maximum number of data items for all sets (can be overridden when adding a set)
|
||||
* <p>
|
||||
* @throws IllegalArgumentException If either <code>args</code>, <code>prefix</code>, or <code>defaultMultiplicity</code>
|
||||
* is <code>null</code> - or if the data range values don't make sense
|
||||
*/
|
||||
|
||||
public Options(String args[], Prefix prefix, Multiplicity defaultMultiplicity, int defMinData, int defMaxData) {
|
||||
|
||||
if (args == null) throw new IllegalArgumentException(CLASS + ": args may not be null");
|
||||
if (prefix == null) throw new IllegalArgumentException(CLASS + ": prefix may not be null");
|
||||
if (defaultMultiplicity == null) throw new IllegalArgumentException(CLASS + ": defaultMultiplicity may not be null");
|
||||
|
||||
if (defMinData < 0) throw new IllegalArgumentException(CLASS + ": defMinData must be >= 0");
|
||||
if (defMaxData < defMinData) throw new IllegalArgumentException(CLASS + ": defMaxData must be >= defMinData");
|
||||
|
||||
arguments = new String[args.length];
|
||||
int i = 0;
|
||||
for (String s : args)
|
||||
arguments[i++] = s;
|
||||
|
||||
this.prefix = prefix;
|
||||
this.defaultMultiplicity = defaultMultiplicity;
|
||||
this.defaultMinData = defMinData;
|
||||
this.defaultMaxData = defMaxData;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* <p>
|
||||
* @param args The command line arguments to check
|
||||
* @param prefix The prefix to use for all command line options. It can only be set here for all options at
|
||||
* the same time
|
||||
* @param defaultMultiplicity The default multiplicity to use for all options (can be overridden when adding an option)
|
||||
* @param data The default minimum and maximum number of data items for all sets (can be overridden when adding a set)
|
||||
* <p>
|
||||
* @throws IllegalArgumentException If either <code>args</code>, <code>prefix</code>, or <code>defaultMultiplicity</code>
|
||||
* is <code>null</code> - or if the data range value doesn't make sense
|
||||
*/
|
||||
|
||||
public Options(String args[], Prefix prefix, Multiplicity defaultMultiplicity, int data) {
|
||||
this(args, prefix, defaultMultiplicity, data, data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor. The default number of data items is set to 0.
|
||||
* <p>
|
||||
* @param args The command line arguments to check
|
||||
* @param prefix The prefix to use for all command line options. It can only be set here for all options at
|
||||
* the same time
|
||||
* @param defaultMultiplicity The default multiplicity to use for all options (can be overridden when adding an option)
|
||||
* <p>
|
||||
* @throws IllegalArgumentException If either <code>args</code>, <code>prefix</code>, or <code>defaultMultiplicity</code>
|
||||
* is <code>null</code>
|
||||
*/
|
||||
|
||||
public Options(String args[], Prefix prefix, Multiplicity defaultMultiplicity) {
|
||||
this(args, prefix, defaultMultiplicity, 0, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor. The prefix is set to {@link Prefix#DASH}.
|
||||
* <p>
|
||||
* @param args The command line arguments to check
|
||||
* @param defaultMultiplicity The default multiplicity to use for all options (can be overridden when adding an option)
|
||||
* @param defMinData The default minimum number of data items for all sets (can be overridden when adding a set)
|
||||
* @param defMaxData The default maximum number of data items for all sets (can be overridden when adding a set)
|
||||
* <p>
|
||||
* @throws IllegalArgumentException If either <code>args</code> or <code>defaultMultiplicity</code>
|
||||
* is <code>null</code> - or if the data range values don't make sense
|
||||
*/
|
||||
|
||||
public Options(String args[], Multiplicity defaultMultiplicity, int defMinData, int defMaxData) {
|
||||
this(args, Prefix.DASH, defaultMultiplicity, defMinData, defMaxData);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor. The prefix is set to {@link Prefix#DASH}.
|
||||
* <p>
|
||||
* @param args The command line arguments to check
|
||||
* @param defaultMultiplicity The default multiplicity to use for all options (can be overridden when adding an option)
|
||||
* @param data The default minimum and maximum number of data items for all sets (can be overridden when adding a set)
|
||||
* <p>
|
||||
* @throws IllegalArgumentException If either <code>args</code> or <code>defaultMultiplicity</code>
|
||||
* is <code>null</code> - or if the data range value doesn't make sense
|
||||
*/
|
||||
|
||||
public Options(String args[], Multiplicity defaultMultiplicity, int data) {
|
||||
this(args, Prefix.DASH, defaultMultiplicity, data, data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor. The prefix is set to {@link Prefix#DASH}, and the default number of data items is set to 0.
|
||||
* <p>
|
||||
* @param args The command line arguments to check
|
||||
* @param defaultMultiplicity The default multiplicity to use for all options (can be overridden when adding an option)
|
||||
* <p>
|
||||
* @throws IllegalArgumentException If either <code>args</code> or <code>defaultMultiplicity</code>
|
||||
* is <code>null</code>
|
||||
*/
|
||||
|
||||
public Options(String args[], Multiplicity defaultMultiplicity) {
|
||||
this(args, Prefix.DASH, defaultMultiplicity, 0, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor. The prefix is set to {@link Prefix#DASH}, the default number of data items is set to 0, and
|
||||
* the multiplicity is set to {@link Multiplicity#ONCE}.
|
||||
* <p>
|
||||
* @param args The command line arguments to check
|
||||
* <p>
|
||||
* @throws IllegalArgumentException If <code>args</code> is <code>null</code>
|
||||
*/
|
||||
|
||||
public Options(String args[]) {
|
||||
this(args, Prefix.DASH, Multiplicity.ONCE);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor. The prefix is set to {@link Prefix#DASH}, and
|
||||
* the multiplicity is set to {@link Multiplicity#ONCE}.
|
||||
* <p>
|
||||
* @param args The command line arguments to check
|
||||
* @param data The default minimum and maximum number of data items for all sets (can be overridden when adding a set)
|
||||
* <p>
|
||||
* @throws IllegalArgumentException If <code>args</code> is <code>null</code> - or if the data range value doesn't make sense
|
||||
*/
|
||||
|
||||
public Options(String args[], int data) {
|
||||
this(args, Prefix.DASH, Multiplicity.ONCE, data, data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor. The prefix is set to {@link Prefix#DASH}, and
|
||||
* the multiplicity is set to {@link Multiplicity#ONCE}.
|
||||
* <p>
|
||||
* @param args The command line arguments to check
|
||||
* @param defMinData The default minimum number of data items for all sets (can be overridden when adding a set)
|
||||
* @param defMaxData The default maximum number of data items for all sets (can be overridden when adding a set)
|
||||
* <p>
|
||||
* @throws IllegalArgumentException If <code>args</code> is <code>null</code> - or if the data range values don't make sense
|
||||
*/
|
||||
|
||||
public Options(String args[], int defMinData, int defMaxData) {
|
||||
this(args, Prefix.DASH, Multiplicity.ONCE, defMinData, defMaxData);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor. The default number of data items is set to 0, and
|
||||
* the multiplicity is set to {@link Multiplicity#ONCE}.
|
||||
* <p>
|
||||
* @param args The command line arguments to check
|
||||
* @param prefix The prefix to use for all command line options. It can only be set here for all options at
|
||||
* the same time
|
||||
* <p>
|
||||
* @throws IllegalArgumentException If either <code>args</code> or <code>prefix</code> is <code>null</code>
|
||||
*/
|
||||
|
||||
public Options(String args[], Prefix prefix) {
|
||||
this(args, prefix, Multiplicity.ONCE, 0, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor. The multiplicity is set to {@link Multiplicity#ONCE}.
|
||||
* <p>
|
||||
* @param args The command line arguments to check
|
||||
* @param prefix The prefix to use for all command line options. It can only be set here for all options at
|
||||
* @param data The default minimum and maximum number of data items for all sets (can be overridden when adding a set)
|
||||
* <p>
|
||||
* @throws IllegalArgumentException If either <code>args</code> or <code>prefix</code> is <code>null</code>
|
||||
* - or if the data range value doesn't make sense
|
||||
*/
|
||||
|
||||
public Options(String args[], Prefix prefix, int data) {
|
||||
this(args, prefix, Multiplicity.ONCE, data, data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor. The multiplicity is set to {@link Multiplicity#ONCE}.
|
||||
* <p>
|
||||
* @param args The command line arguments to check
|
||||
* @param prefix The prefix to use for all command line options. It can only be set here for all options at
|
||||
* the same time
|
||||
* @param defMinData The default minimum number of data items for all sets (can be overridden when adding a set)
|
||||
* @param defMaxData The default maximum number of data items for all sets (can be overridden when adding a set)
|
||||
* <p>
|
||||
* @throws IllegalArgumentException If either <code>args</code> or <code>prefix</code> is <code>null</code>
|
||||
* - or if the data range values don't make sense
|
||||
*/
|
||||
|
||||
public Options(String args[], Prefix prefix, int defMinData, int defMaxData) {
|
||||
this(args, prefix, Multiplicity.ONCE, defMinData, defMaxData);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the (first) matching set. This invocation does not ignore unmatched options and requires that
|
||||
* data items are the last ones on the command line.
|
||||
* <p>
|
||||
* @return The first set which matches (i. e. the <code>check()</code> method returns <code>true</code>) - or
|
||||
* <code>null</code>, if no set matches.
|
||||
*/
|
||||
|
||||
public OptionSet getMatchingSet() {
|
||||
return getMatchingSet(false, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the (first) matching set.
|
||||
* <p>
|
||||
* @param ignoreUnmatched A boolean to select whether unmatched options can be ignored in the checks or not
|
||||
* @param requireDataLast A boolean to indicate whether the data items have to be the last ones on the command line or not
|
||||
* <p>
|
||||
* @return The first set which matches (i. e. the <code>check()</code> method returns <code>true</code>) - or
|
||||
* <code>null</code>, if no set matches.
|
||||
*/
|
||||
|
||||
public OptionSet getMatchingSet(boolean ignoreUnmatched, boolean requireDataLast) {
|
||||
for (String setName : optionSets.keySet())
|
||||
if (check(setName, ignoreUnmatched, requireDataLast))
|
||||
return optionSets.get(setName);
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add an option set.
|
||||
* <p>
|
||||
* @param setName The name for the set. This must be a unique identifier
|
||||
* @param minData The minimum number of data items for this set
|
||||
* @param maxData The maximum number of data items for this set
|
||||
* <p>
|
||||
* @return The new <code>Optionset</code> instance created. This is useful to allow chaining of <code>addOption()</code>
|
||||
* calls right after this method
|
||||
*/
|
||||
|
||||
public OptionSet addSet(String setName, int minData, int maxData) {
|
||||
if (setName == null) throw new IllegalArgumentException(CLASS + ": setName may not be null");
|
||||
if (optionSets.containsKey(setName)) throw new IllegalArgumentException(CLASS + ": a set with the name "
|
||||
+ setName + " has already been defined");
|
||||
OptionSet os = new OptionSet(prefix, defaultMultiplicity, setName, minData, maxData);
|
||||
optionSets.put(setName, os);
|
||||
return os;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add an option set.
|
||||
* <p>
|
||||
* @param setName The name for the set. This must be a unique identifier
|
||||
* @param data The minimum and maximum number of data items for this set
|
||||
* <p>
|
||||
* @return The new <code>Optionset</code> instance created. This is useful to allow chaining of <code>addOption()</code>
|
||||
* calls right after this method
|
||||
*/
|
||||
|
||||
public OptionSet addSet(String setName, int data) {
|
||||
return addSet(setName, data, data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add an option set. The defaults for the number of data items are used.
|
||||
* <p>
|
||||
* @param setName The name for the set. This must be a unique identifier
|
||||
* <p>
|
||||
* @return The new <code>Optionset</code> instance created. This is useful to allow chaining of <code>addOption()</code>
|
||||
* calls right after this method
|
||||
*/
|
||||
|
||||
public OptionSet addSet(String setName) {
|
||||
return addSet(setName, defaultMinData, defaultMaxData);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return an option set - or <code>null</code>, if no set with the given name exists
|
||||
* <p>
|
||||
* @param setName The name for the set to retrieve
|
||||
* <p>
|
||||
* @return The set to retrieve (or <code>null</code>, if no set with the given name exists)
|
||||
*/
|
||||
|
||||
public OptionSet getSet(String setName) {
|
||||
return optionSets.get(setName);
|
||||
}
|
||||
|
||||
/**
|
||||
* This returns the (anonymous) default set
|
||||
* <p>
|
||||
* @return The default set
|
||||
*/
|
||||
|
||||
public OptionSet getSet() {
|
||||
if (getSet(DEFAULT_SET) == null)
|
||||
addSet(DEFAULT_SET, defaultMinData, defaultMaxData);
|
||||
return getSet(DEFAULT_SET);
|
||||
}
|
||||
|
||||
/**
|
||||
* The error messages collected during the last option check (invocation of any of the <code>check()</code> methods). This
|
||||
* is useful to determine what was wrong with the command line arguments provided
|
||||
* <p>
|
||||
* @return A string with all collected error messages
|
||||
*/
|
||||
|
||||
public String getCheckErrors() {
|
||||
return checkErrors.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Run the checks for the default set. <code>ignoreUnmatched</code> is set to <code>false</code>, and
|
||||
* <code>requireDataLast</code> is set to <code>true</code>.
|
||||
* <p>
|
||||
* @return A boolean indicating whether all checks were successful or not
|
||||
*/
|
||||
|
||||
public boolean check() {
|
||||
return check(DEFAULT_SET, false, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Run the checks for the default set.
|
||||
* <p>
|
||||
* @param ignoreUnmatched A boolean to select whether unmatched options can be ignored in the checks or not
|
||||
* @param requireDataLast A boolean to indicate whether the data items have to be the last ones on the command line or not
|
||||
* <p>
|
||||
* @return A boolean indicating whether all checks were successful or not
|
||||
*/
|
||||
|
||||
public boolean check(boolean ignoreUnmatched, boolean requireDataLast) {
|
||||
return check(DEFAULT_SET, ignoreUnmatched, requireDataLast);
|
||||
}
|
||||
|
||||
/**
|
||||
* Run the checks for the given set. <code>ignoreUnmatched</code> is set to <code>false</code>, and
|
||||
* <code>requireDataLast</code> is set to <code>true</code>.
|
||||
* <p>
|
||||
* @param setName The name for the set to check
|
||||
* <p>
|
||||
* @return A boolean indicating whether all checks were successful or not
|
||||
* <p>
|
||||
* @throws IllegalArgumentException If either <code>setName</code> is <code>null</code>, or the set is unknown.
|
||||
*/
|
||||
|
||||
public boolean check(String setName) {
|
||||
return check(setName, false, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Run the checks for the given set.
|
||||
* <p>
|
||||
* @param setName The name for the set to check
|
||||
* @param ignoreUnmatched A boolean to select whether unmatched options can be ignored in the checks or not
|
||||
* @param requireDataLast A boolean to indicate whether the data items have to be the last ones on the command line or not
|
||||
* <p>
|
||||
* @return A boolean indicating whether all checks were successful or not
|
||||
* <p>
|
||||
* @throws IllegalArgumentException If either <code>setName</code> is <code>null</code>, or the set is unknown.
|
||||
*/
|
||||
|
||||
public boolean check(String setName, boolean ignoreUnmatched, boolean requireDataLast) {
|
||||
|
||||
if (setName == null) throw new IllegalArgumentException(CLASS + ": setName may not be null");
|
||||
if (optionSets.get(setName) == null) throw new IllegalArgumentException(CLASS + ": Unknown OptionSet: " + setName);
|
||||
|
||||
checkErrors = new StringBuffer();
|
||||
checkErrors.append("Checking set ");
|
||||
checkErrors.append(setName);
|
||||
checkErrors.append('\n');
|
||||
|
||||
//.... Access the data for the set to use
|
||||
|
||||
OptionSet set = optionSets.get(setName);
|
||||
java.util.ArrayList<OptionData> options = set.getOptionData();
|
||||
java.util.ArrayList<String> data = set.getData();
|
||||
java.util.ArrayList<String> unmatched = set.getUnmatched();
|
||||
|
||||
//.... Catch some trivial cases
|
||||
|
||||
if (options.size() == 0) { // No options have been defined at all
|
||||
if (arguments.length == 0) { // No arguments have been given: in this case, this is a success
|
||||
return true;
|
||||
} else {
|
||||
checkErrors.append("No options have been defined, nothing to check\n");
|
||||
return false;
|
||||
}
|
||||
} else if (arguments.length == 0) { // Options have been defined, but no arguments given
|
||||
checkErrors.append("Options have been defined, but no arguments have been given; nothing to check\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
//.... Parse all the arguments given
|
||||
|
||||
int ipos = 0;
|
||||
int offset = 0;
|
||||
java.util.regex.Matcher m = null;
|
||||
String value = null;
|
||||
String detail = null;
|
||||
String next = null;
|
||||
String key = null;
|
||||
String pre = Character.toString(prefix.getName());
|
||||
boolean add = true;
|
||||
boolean[] matched = new boolean[arguments.length];
|
||||
|
||||
for (int i = 0; i < matched.length; i++) // Initially, we assume there was no match at all
|
||||
matched[i] = false;
|
||||
|
||||
while (true) {
|
||||
|
||||
value = null;
|
||||
detail = null;
|
||||
offset = 0;
|
||||
add = true;
|
||||
key = arguments[ipos];
|
||||
|
||||
for (OptionData optionData : options) { // For each argument, we may need to check all defined options
|
||||
m = optionData.getPattern().matcher(key);
|
||||
if (m.lookingAt()) {
|
||||
if (optionData.useValue()) { // The code section for value options
|
||||
if (optionData.useDetail()) {
|
||||
detail = m.group(1);
|
||||
offset = 2; // required for correct Matcher.group access below
|
||||
}
|
||||
if (optionData.getSeparator() == Separator.BLANK) { // In this case, the next argument must be the value
|
||||
if (ipos + 1 == arguments.length) { // The last argument, thus no value follows it: Error
|
||||
checkErrors.append("At end of arguments - no value found following argument ");
|
||||
checkErrors.append(key);
|
||||
checkErrors.append('\n');
|
||||
add = false;
|
||||
} else {
|
||||
next = arguments[ipos + 1];
|
||||
if (next.startsWith(pre)) { // The next one is an argument, not a value: Error
|
||||
checkErrors.append("No value found following argument ");
|
||||
checkErrors.append(key);
|
||||
checkErrors.append('\n');
|
||||
add = false;
|
||||
} else {
|
||||
value = next;
|
||||
matched[ipos++] = true; // Mark the key and the value
|
||||
matched[ipos] = true;
|
||||
}
|
||||
}
|
||||
} else { // The value follows the separator in this case
|
||||
value = m.group(1 + offset);
|
||||
matched[ipos] = true;
|
||||
}
|
||||
} else { // Simple, non-value options
|
||||
matched[ipos] = true;
|
||||
}
|
||||
|
||||
if (add) optionData.addResult(value, detail); // Store the result
|
||||
break; // No need to check more options, we have a match
|
||||
}
|
||||
}
|
||||
|
||||
ipos++; // Advance to the next argument to check
|
||||
if (ipos >= arguments.length) break; // Terminating condition for the check loop
|
||||
|
||||
}
|
||||
|
||||
//.... Identify unmatched arguments and actual (non-option) data
|
||||
|
||||
int first = -1; // Required later for requireDataLast
|
||||
for (int i = 0; i < matched.length; i++) { // Assemble the list of unmatched options
|
||||
if (!matched[i]) {
|
||||
if (arguments[i].startsWith(pre)) { // This is an unmatched option
|
||||
unmatched.add(arguments[i]);
|
||||
checkErrors.append("No matching option found for argument ");
|
||||
checkErrors.append(arguments[i]);
|
||||
checkErrors.append('\n');
|
||||
} else { // This is actual data
|
||||
if (first < 0) first = i;
|
||||
data.add(arguments[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//.... Checks to determine overall success; start with multiplicity of options
|
||||
|
||||
boolean err = true;
|
||||
|
||||
for (OptionData optionData : options) {
|
||||
|
||||
key = optionData.getKey();
|
||||
err = false; // Local check result for one option
|
||||
|
||||
switch (optionData.getMultiplicity()) {
|
||||
case ONCE: if (optionData.getResultCount() != 1) err = true; break;
|
||||
case ONCE_OR_MORE: if (optionData.getResultCount() == 0) err = true; break;
|
||||
case ZERO_OR_ONE: if (optionData.getResultCount() > 1) err = true; break;
|
||||
case ZERO_OR_MORE: break;
|
||||
}
|
||||
|
||||
if (err) {
|
||||
checkErrors.append("Wrong number of occurences found for argument ");
|
||||
checkErrors.append(prefix.getName());
|
||||
checkErrors.append(key);
|
||||
checkErrors.append('\n');
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//.... Check range for data
|
||||
|
||||
if (data.size() < set.getMinData() || data.size() > set.getMaxData()) {
|
||||
checkErrors.append("Invalid number of data arguments: ");
|
||||
checkErrors.append(data.size());
|
||||
checkErrors.append(" (allowed range: ");
|
||||
checkErrors.append(set.getMinData());
|
||||
checkErrors.append(" ... ");
|
||||
checkErrors.append(set.getMaxData());
|
||||
checkErrors.append(")\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
//.... Check for location of the data in the list of command line arguments
|
||||
|
||||
if (requireDataLast) {
|
||||
if (first + data.size() != arguments.length) {
|
||||
checkErrors.append("Invalid data specification: data arguments are not the last ones on the command line\n");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
//.... Check for unmatched arguments
|
||||
|
||||
if (!ignoreUnmatched && unmatched.size() > 0) return false; // Don't accept unmatched arguments
|
||||
|
||||
//.... If we made it to here, all checks were successful
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the given non-value option to <i>all</i> known sets.
|
||||
* See {@link OptionSet#addOption(String)} for details.
|
||||
*/
|
||||
|
||||
public void addOptionAllSets(String key) {
|
||||
for (String setName : optionSets.keySet())
|
||||
optionSets.get(setName).addOption(key, defaultMultiplicity);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the given non-value option to <i>all</i> known sets.
|
||||
* See {@link OptionSet#addOption(String, Options.Multiplicity)} for details.
|
||||
*/
|
||||
|
||||
public void addOptionAllSets(String key, Multiplicity multiplicity) {
|
||||
for (String setName : optionSets.keySet())
|
||||
optionSets.get(setName).addOption(key, false, Separator.NONE, false, multiplicity);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the given value option to <i>all</i> known sets.
|
||||
* See {@link OptionSet#addOption(String, Options.Separator)} for details.
|
||||
*/
|
||||
|
||||
public void addOptionAllSets(String key, Separator separator) {
|
||||
for (String setName : optionSets.keySet())
|
||||
optionSets.get(setName).addOption(key, false, separator, true, defaultMultiplicity);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the given value option to <i>all</i> known sets.
|
||||
* See {@link OptionSet#addOption(String, Options.Separator, Options.Multiplicity)} for details.
|
||||
*/
|
||||
|
||||
public void addOptionAllSets(String key, Separator separator, Multiplicity multiplicity) {
|
||||
for (String setName : optionSets.keySet())
|
||||
optionSets.get(setName).addOption(key, false, separator, true, multiplicity);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the given value option to <i>all</i> known sets.
|
||||
* See {@link OptionSet#addOption(String, boolean, Options.Separator)} for details.
|
||||
*/
|
||||
|
||||
public void addOptionAllSets(String key, boolean details, Separator separator) {
|
||||
for (String setName : optionSets.keySet())
|
||||
optionSets.get(setName).addOption(key, details, separator, true, defaultMultiplicity);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the given value option to <i>all</i> known sets.
|
||||
* See {@link OptionSet#addOption(String, boolean, Options.Separator, Options.Multiplicity)} for details.
|
||||
*/
|
||||
|
||||
public void addOptionAllSets(String key, boolean details, Separator separator, Multiplicity multiplicity) {
|
||||
for (String setName : optionSets.keySet())
|
||||
optionSets.get(setName).addOption(key, details, separator, true, multiplicity);
|
||||
}
|
||||
|
||||
/**
|
||||
* This is the overloaded {@link Object#toString()} method, and it is provided mainly for debugging
|
||||
* purposes.
|
||||
* <p>
|
||||
* @return A string representing the instance
|
||||
*/
|
||||
|
||||
public String toString() {
|
||||
|
||||
StringBuffer sb = new StringBuffer();
|
||||
|
||||
for (OptionSet set : optionSets.values()) {
|
||||
sb.append("Set: ");
|
||||
sb.append(set.getSetName());
|
||||
sb.append('\n');
|
||||
for (OptionData data : set.getOptionData()) {
|
||||
sb.append(data.toString());
|
||||
sb.append('\n');
|
||||
}
|
||||
}
|
||||
|
||||
return sb.toString();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,172 @@
|
||||
/*******************************************************************************
|
||||
* 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.awt.Desktop;
|
||||
import java.io.IOException;
|
||||
import java.net.URISyntaxException;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.inject.Inject;
|
||||
|
||||
import org.eclipse.core.runtime.Platform;
|
||||
import org.eclipse.jface.dialogs.Dialog;
|
||||
import org.eclipse.jface.dialogs.IDialogConstants;
|
||||
import org.eclipse.osgi.util.NLS;
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.custom.StyleRange;
|
||||
import org.eclipse.swt.custom.StyledText;
|
||||
import org.eclipse.swt.events.PaintEvent;
|
||||
import org.eclipse.swt.events.PaintListener;
|
||||
import org.eclipse.swt.graphics.Color;
|
||||
import org.eclipse.swt.graphics.Image;
|
||||
import org.eclipse.swt.graphics.Point;
|
||||
import org.eclipse.swt.layout.GridData;
|
||||
import org.eclipse.swt.layout.GridLayout;
|
||||
import org.eclipse.swt.widgets.Canvas;
|
||||
import org.eclipse.swt.widgets.Composite;
|
||||
import org.eclipse.swt.widgets.Control;
|
||||
import org.eclipse.swt.widgets.Event;
|
||||
import org.eclipse.swt.widgets.Listener;
|
||||
import org.eclipse.swt.widgets.Shell;
|
||||
import org.eclipse.wb.swt.ResourceManager;
|
||||
import org.eclipse.wb.swt.SWTResourceManager;
|
||||
import org.osgi.framework.Version;
|
||||
|
||||
import com.minres.scviewer.e4.application.Messages;
|
||||
|
||||
/**
|
||||
* The Class AboutDialog.
|
||||
*/
|
||||
public class AboutDialog extends Dialog {
|
||||
|
||||
/** The copyright text. */
|
||||
private String copyrightText=Messages.AboutDialog_1;
|
||||
|
||||
/**
|
||||
* Create the dialog.
|
||||
*
|
||||
* @param parentShell the parent shell
|
||||
*/
|
||||
@Inject
|
||||
public AboutDialog(Shell parentShell) {
|
||||
super(parentShell);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Create contents of the dialog.
|
||||
*
|
||||
* @param parent the parent
|
||||
* @return the control
|
||||
*/
|
||||
@Override
|
||||
protected Control createDialogArea(Composite parent) {
|
||||
Composite composite = new Composite(parent, SWT.NONE);
|
||||
GridData gd_composite = new GridData(SWT.LEFT, SWT.FILL, true, true);
|
||||
gd_composite.widthHint = 600;
|
||||
gd_composite.heightHint =300;
|
||||
composite.setLayoutData(gd_composite);
|
||||
composite.setLayout(new GridLayout(2, false));
|
||||
|
||||
final Color white=SWTResourceManager.getColor(SWT.COLOR_WHITE);
|
||||
final Image scviewerLogo=ResourceManager.getPluginImage("com.minres.scviewer.e4.application", "icons/SCViewer_logo.png"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
final Image minresLogo=ResourceManager.getPluginImage("com.minres.scviewer.e4.application", "icons/Minres_logo.png"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
|
||||
Canvas canvas = new Canvas(composite,SWT.NO_REDRAW_RESIZE);
|
||||
GridData gd_canvas = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
|
||||
gd_canvas.widthHint = 200;
|
||||
gd_canvas.heightHint =300;
|
||||
canvas.setLayoutData(gd_canvas);
|
||||
canvas.addPaintListener(new PaintListener() {
|
||||
public void paintControl(PaintEvent e) {
|
||||
e.gc.setBackground(white);
|
||||
e.gc.fillRectangle(e.x, e.y, e.width, e.height);
|
||||
e.gc.drawImage(scviewerLogo,4,0);
|
||||
e.gc.drawImage(minresLogo,0,200);
|
||||
}
|
||||
});
|
||||
|
||||
StyledText styledText = new StyledText(composite, SWT.V_SCROLL | SWT.BORDER);
|
||||
styledText.setEditable(false);
|
||||
GridData gd_styledText = new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1);
|
||||
styledText.setLayoutData(gd_styledText);
|
||||
Version version = Platform.getProduct().getDefiningBundle().getVersion();
|
||||
String versionString = String.format("%d.%d.%d", version.getMajor(), version.getMinor(), version.getMicro());
|
||||
String productTitle = NLS.bind(Messages.AboutDialog_0, versionString);
|
||||
styledText.setText(productTitle+copyrightText);
|
||||
styledText.setBackground(white);
|
||||
styledText.setWordWrap(true);
|
||||
styledText.setLeftMargin(5);
|
||||
StyleRange styleRange = new StyleRange();
|
||||
styleRange.start = 0;
|
||||
styleRange.length = productTitle.length();
|
||||
styleRange.fontStyle = SWT.BOLD;
|
||||
styledText.setStyleRange(styleRange);
|
||||
///^(https?:\/\/)?([\da-z\.-]+)\.([a-z\.]{2,6})([\/\w \.-]*)*\/?$/
|
||||
Pattern pattern = Pattern.compile("https?:\\/\\/([\\da-z\\.-]+)\\.([a-z\\.]{2,6})([\\/\\w\\.-]*)*\\/?"); //$NON-NLS-1$
|
||||
// in case you would like to ignore case sensitivity,
|
||||
// you could use this statement:
|
||||
// Pattern pattern = Pattern.compile("\\s+", Pattern.CASE_INSENSITIVE);
|
||||
Matcher matcher = pattern.matcher(productTitle+copyrightText);
|
||||
// check all occurance
|
||||
while (matcher.find()) {
|
||||
styleRange = new StyleRange();
|
||||
styleRange.underline=true;
|
||||
styleRange.underlineStyle = SWT.UNDERLINE_LINK;
|
||||
styleRange.data = matcher.group();
|
||||
styleRange.start = matcher.start();
|
||||
styleRange.length = matcher.end()-matcher.start();
|
||||
styledText.setStyleRange(styleRange);
|
||||
}
|
||||
styledText.addListener(SWT.MouseDown, new Listener() {
|
||||
@Override
|
||||
public void handleEvent(Event event) {
|
||||
// It is up to the application to determine when and how a link should be activated.
|
||||
// links are activated on mouse down when the control key is held down
|
||||
// if ((event.stateMask & SWT.MOD1) != 0) {
|
||||
try {
|
||||
@SuppressWarnings("deprecation")
|
||||
int offset = ((StyledText)event.widget).getOffsetAtLocation(new Point (event.x, event.y));
|
||||
StyleRange style = ((StyledText)event.widget).getStyleRangeAtOffset(offset);
|
||||
if (style != null && style.underline && style.underlineStyle == SWT.UNDERLINE_LINK) {
|
||||
Desktop.getDesktop().browse(new java.net.URI(style.data.toString()));
|
||||
}
|
||||
} catch (IOException | URISyntaxException | IllegalArgumentException e) {}
|
||||
// }
|
||||
}
|
||||
});
|
||||
|
||||
styleRange.start = 0;
|
||||
return composite;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.jface.dialogs.Dialog#createButtonsForButtonBar(org.eclipse.swt.widgets.Composite)
|
||||
*/
|
||||
protected void createButtonsForButtonBar(Composite parent) {
|
||||
// create OK button
|
||||
createButton(parent, IDialogConstants.OK_ID, IDialogConstants.CLOSE_LABEL, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Open the dialog.
|
||||
* @return the result
|
||||
*/
|
||||
@PostConstruct
|
||||
@Override
|
||||
public int open() {
|
||||
return super.open();
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,665 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2015 MINRES Technologies GmbH and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* MINRES Technologies GmbH - initial API and implementation
|
||||
*******************************************************************************/
|
||||
package com.minres.scviewer.e4.application.parts;
|
||||
|
||||
import java.beans.PropertyChangeEvent;
|
||||
import java.beans.PropertyChangeListener;
|
||||
import java.lang.annotation.Annotation;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.regex.PatternSyntaxException;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Named;
|
||||
|
||||
import org.eclipse.e4.core.contexts.ContextInjectionFactory;
|
||||
import org.eclipse.e4.core.contexts.IEclipseContext;
|
||||
import org.eclipse.e4.core.di.annotations.CanExecute;
|
||||
import org.eclipse.e4.core.di.annotations.Execute;
|
||||
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.model.application.ui.basic.MPart;
|
||||
import org.eclipse.e4.ui.services.EMenuService;
|
||||
import org.eclipse.e4.ui.services.IServiceConstants;
|
||||
import org.eclipse.e4.ui.workbench.modeling.EPartService;
|
||||
import org.eclipse.e4.ui.workbench.modeling.ESelectionService;
|
||||
import org.eclipse.jface.viewers.DoubleClickEvent;
|
||||
import org.eclipse.jface.viewers.IContentProvider;
|
||||
import org.eclipse.jface.viewers.IDoubleClickListener;
|
||||
import org.eclipse.jface.viewers.ISelection;
|
||||
import org.eclipse.jface.viewers.ISelectionChangedListener;
|
||||
import org.eclipse.jface.viewers.IStructuredContentProvider;
|
||||
import org.eclipse.jface.viewers.IStructuredSelection;
|
||||
import org.eclipse.jface.viewers.ITreeContentProvider;
|
||||
import org.eclipse.jface.viewers.ITreePathContentProvider;
|
||||
import org.eclipse.jface.viewers.SelectionChangedEvent;
|
||||
import org.eclipse.jface.viewers.StructuredSelection;
|
||||
import org.eclipse.jface.viewers.TableViewer;
|
||||
import org.eclipse.jface.viewers.TreePath;
|
||||
import org.eclipse.jface.viewers.TreeViewer;
|
||||
import org.eclipse.jface.viewers.Viewer;
|
||||
import org.eclipse.jface.viewers.ViewerFilter;
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.custom.SashForm;
|
||||
import org.eclipse.swt.events.ControlAdapter;
|
||||
import org.eclipse.swt.events.ControlEvent;
|
||||
import org.eclipse.swt.events.DisposeEvent;
|
||||
import org.eclipse.swt.events.DisposeListener;
|
||||
import org.eclipse.swt.events.ModifyEvent;
|
||||
import org.eclipse.swt.events.ModifyListener;
|
||||
import org.eclipse.swt.events.PaintEvent;
|
||||
import org.eclipse.swt.events.PaintListener;
|
||||
import org.eclipse.swt.events.SelectionAdapter;
|
||||
import org.eclipse.swt.events.SelectionEvent;
|
||||
import org.eclipse.swt.layout.GridData;
|
||||
import org.eclipse.swt.layout.GridLayout;
|
||||
import org.eclipse.swt.widgets.Composite;
|
||||
import org.eclipse.swt.widgets.Control;
|
||||
import org.eclipse.swt.widgets.Text;
|
||||
import org.eclipse.swt.widgets.ToolBar;
|
||||
import org.eclipse.swt.widgets.ToolItem;
|
||||
import org.eclipse.wb.swt.ResourceManager;
|
||||
import org.eclipse.wb.swt.SWTResourceManager;
|
||||
|
||||
import com.minres.scviewer.database.HierNode;
|
||||
import com.minres.scviewer.database.IHierNode;
|
||||
import com.minres.scviewer.database.ITx;
|
||||
import com.minres.scviewer.database.IWaveform;
|
||||
import com.minres.scviewer.database.IWaveformDb;
|
||||
import com.minres.scviewer.e4.application.Messages;
|
||||
import com.minres.scviewer.e4.application.handlers.AddWaveformHandler;
|
||||
import com.minres.scviewer.e4.application.provider.TxDbContentProvider;
|
||||
import com.minres.scviewer.e4.application.provider.TxDbLabelProvider;
|
||||
|
||||
/**
|
||||
* The Class DesignBrowser. It contains the design tree, a list of Streams & signals and a few buttons to
|
||||
* add them them to the waveform view
|
||||
*/
|
||||
public class DesignBrowser {
|
||||
|
||||
/** The Constant POPUP_ID. */
|
||||
private static final String POPUP_ID="com.minres.scviewer.e4.application.parts.DesignBrowser.popupmenu"; //$NON-NLS-1$
|
||||
|
||||
/** The event broker. */
|
||||
@Inject IEventBroker eventBroker;
|
||||
|
||||
/** The selection service. */
|
||||
@Inject ESelectionService selectionService;
|
||||
|
||||
/** The menu service. */
|
||||
@Inject EMenuService menuService;
|
||||
|
||||
/** The eclipse ctx. */
|
||||
@Inject IEclipseContext eclipseCtx;
|
||||
|
||||
/** The sash form. */
|
||||
private SashForm sashForm;
|
||||
|
||||
/** The top. */
|
||||
Composite top;
|
||||
|
||||
/** The bottom. */
|
||||
private Composite bottom;
|
||||
|
||||
/** The tree viewer. */
|
||||
private TreeViewer treeViewer;
|
||||
|
||||
/** The name filter of the design browser tree. */
|
||||
private Text treeNameFilter;
|
||||
|
||||
/** The attribute filter. */
|
||||
StreamTTreeFilter treeAttributeFilter;
|
||||
|
||||
/** The name filter. */
|
||||
private Text tableNameFilter;
|
||||
|
||||
/** The attribute filter. */
|
||||
StreamTableFilter tableAttributeFilter;
|
||||
|
||||
/** The tx table viewer. */
|
||||
private TableViewer txTableViewer;
|
||||
|
||||
/** The append all item. */
|
||||
ToolItem appendItem, insertItem;
|
||||
|
||||
/** The other selection count. */
|
||||
int thisSelectionCount=0, otherSelectionCount=0;
|
||||
|
||||
/** The tree viewer pcl. */
|
||||
private PropertyChangeListener treeViewerPCL = new PropertyChangeListener() {
|
||||
@Override
|
||||
public void propertyChange(PropertyChangeEvent evt) {
|
||||
if("CHILDS".equals(evt.getPropertyName())){ //$NON-NLS-1$
|
||||
treeViewer.getTree().getDisplay().asyncExec(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
treeViewer.refresh();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/** The waveform viewer part. */
|
||||
private WaveformViewer waveformViewerPart;
|
||||
|
||||
/** The sash paint listener. */
|
||||
protected PaintListener sashPaintListener=new PaintListener() {
|
||||
@Override
|
||||
public void paintControl(PaintEvent e) {
|
||||
int size=Math.min(e.width, e.height)-1;
|
||||
e.gc.setForeground(SWTResourceManager.getColor(SWT.COLOR_DARK_GRAY));
|
||||
e.gc.setFillRule(SWT.FILL_EVEN_ODD);
|
||||
if(e.width>e.height)
|
||||
e.gc.drawArc(e.x+(e.width-size)/2, e.y, size, size, 0, 360);
|
||||
else
|
||||
e.gc.drawArc(e.x, e.y+(e.height-size)/2, size, size, 0, 360);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Creates the composite.
|
||||
*
|
||||
* @param parent the parent
|
||||
*/
|
||||
@PostConstruct
|
||||
public void createComposite(Composite parent) {
|
||||
sashForm = new SashForm(parent, SWT.BORDER | SWT.SMOOTH | SWT.VERTICAL);
|
||||
|
||||
top = new Composite(sashForm, SWT.NONE);
|
||||
createTreeViewerComposite(top);
|
||||
bottom = new Composite(sashForm, SWT.NONE);
|
||||
createTableComposite(bottom);
|
||||
|
||||
sashForm.setWeights(new int[] {100, 100});
|
||||
sashForm.SASH_WIDTH=5;
|
||||
top.addControlListener(new ControlAdapter() {
|
||||
public void controlResized(ControlEvent e) {
|
||||
sashForm.getChildren()[2].addPaintListener(sashPaintListener);
|
||||
top.removeControlListener(this);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates the tree viewer composite.
|
||||
*
|
||||
* @param parent the parent
|
||||
*/
|
||||
public void createTreeViewerComposite(Composite parent) {
|
||||
parent.setLayout(new GridLayout(1, false));
|
||||
|
||||
treeNameFilter = new Text(parent, SWT.BORDER);
|
||||
treeNameFilter.setMessage(Messages.DesignBrowser_3);
|
||||
treeNameFilter.addModifyListener(new ModifyListener() {
|
||||
@Override
|
||||
public void modifyText(ModifyEvent e) {
|
||||
treeAttributeFilter.setSearchText(((Text) e.widget).getText());
|
||||
treeViewer.refresh();
|
||||
}
|
||||
});
|
||||
treeNameFilter.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
|
||||
|
||||
treeAttributeFilter = new StreamTTreeFilter();
|
||||
|
||||
treeViewer = new TreeViewer(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
|
||||
treeViewer.getTree().setLayoutData(new GridData(GridData.FILL_BOTH));
|
||||
treeViewer.setContentProvider(new TxDbContentProvider());
|
||||
treeViewer.setLabelProvider(new TxDbLabelProvider());
|
||||
treeViewer.addFilter(treeAttributeFilter);
|
||||
treeViewer.setUseHashlookup(true);
|
||||
treeViewer.setAutoExpandLevel(2);
|
||||
treeViewer.addSelectionChangedListener(new ISelectionChangedListener() {
|
||||
|
||||
@Override
|
||||
public void selectionChanged(SelectionChangedEvent event) {
|
||||
ISelection selection=event.getSelection();
|
||||
if( selection instanceof IStructuredSelection) {
|
||||
Object object= ((IStructuredSelection)selection).getFirstElement();
|
||||
if(object instanceof IHierNode && ((IHierNode)object).getChildNodes().size()!=0){
|
||||
txTableViewer.setInput(object);
|
||||
updateButtons();
|
||||
}
|
||||
else { //if selection is changed but empty
|
||||
txTableViewer.setInput(null);
|
||||
updateButtons();
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates the table composite.
|
||||
*
|
||||
* @param parent the parent
|
||||
*/
|
||||
public void createTableComposite(Composite parent) {
|
||||
parent.setLayout(new GridLayout(1, false));
|
||||
|
||||
tableNameFilter = new Text(parent, SWT.BORDER);
|
||||
tableNameFilter.setMessage(Messages.DesignBrowser_2);
|
||||
tableNameFilter.addModifyListener(new ModifyListener() {
|
||||
@Override
|
||||
public void modifyText(ModifyEvent e) {
|
||||
tableAttributeFilter.setSearchText(((Text) e.widget).getText());
|
||||
updateButtons();
|
||||
txTableViewer.refresh();
|
||||
}
|
||||
});
|
||||
tableNameFilter.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
|
||||
|
||||
tableAttributeFilter = new StreamTableFilter();
|
||||
|
||||
txTableViewer = new TableViewer(parent);
|
||||
txTableViewer.setContentProvider(new TxDbContentProvider(true));
|
||||
txTableViewer.setLabelProvider(new TxDbLabelProvider());
|
||||
txTableViewer.getTable().setLayoutData(new GridData(GridData.FILL_BOTH));
|
||||
txTableViewer.addFilter(tableAttributeFilter);
|
||||
txTableViewer.addDoubleClickListener(new IDoubleClickListener() {
|
||||
@Override
|
||||
public void doubleClick(DoubleClickEvent event) {
|
||||
AddWaveformHandler myHandler = new AddWaveformHandler();
|
||||
Object result = runCommand(myHandler, CanExecute.class, "after", false); //$NON-NLS-1$
|
||||
if(result!=null && (Boolean)result)
|
||||
ContextInjectionFactory.invoke(myHandler, Execute.class, eclipseCtx);
|
||||
}
|
||||
});
|
||||
txTableViewer.addSelectionChangedListener(new ISelectionChangedListener() {
|
||||
|
||||
@Override
|
||||
public void selectionChanged(SelectionChangedEvent event) {
|
||||
selectionService.setSelection(event.getSelection());
|
||||
updateButtons();
|
||||
}
|
||||
});
|
||||
menuService.registerContextMenu(txTableViewer.getControl(), POPUP_ID);
|
||||
|
||||
ToolBar toolBar = new ToolBar(parent, SWT.FLAT | SWT.RIGHT);
|
||||
toolBar.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1));
|
||||
toolBar.setBounds(0, 0, 87, 20);
|
||||
|
||||
appendItem = new ToolItem(toolBar, SWT.NONE);
|
||||
appendItem.setToolTipText(Messages.DesignBrowser_4);
|
||||
appendItem.setImage(ResourceManager.getPluginImage("com.minres.scviewer.e4.application", "icons/append_wave.png")); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
appendItem.setEnabled(false);
|
||||
appendItem.addSelectionListener(new SelectionAdapter() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent e) {
|
||||
AddWaveformHandler myHandler = new AddWaveformHandler();
|
||||
Object result = runCommand(myHandler, CanExecute.class, "after", false); //$NON-NLS-1$
|
||||
if(result!=null && (Boolean)result)
|
||||
ContextInjectionFactory.invoke(myHandler, Execute.class, eclipseCtx);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
insertItem = new ToolItem(toolBar, SWT.NONE);
|
||||
insertItem.setToolTipText(Messages.DesignBrowser_8);
|
||||
insertItem.setImage(ResourceManager.getPluginImage("com.minres.scviewer.e4.application", "icons/insert_wave.png")); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
insertItem.setEnabled(false);
|
||||
insertItem.addSelectionListener(new SelectionAdapter() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent e) {
|
||||
AddWaveformHandler myHandler = new AddWaveformHandler();
|
||||
Object result = runCommand(myHandler, CanExecute.class, "before", false); //$NON-NLS-1$
|
||||
if(result!=null && (Boolean)result)
|
||||
ContextInjectionFactory.invoke(myHandler, Execute.class, eclipseCtx);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the focus.
|
||||
*/
|
||||
@Focus
|
||||
public void setFocus() {
|
||||
if(txTableViewer!=null) {
|
||||
txTableViewer.getTable().setFocus();
|
||||
IStructuredSelection selection = (IStructuredSelection)txTableViewer.getSelection();
|
||||
if(selection.size()==0){
|
||||
appendItem.setEnabled(false);
|
||||
}
|
||||
selectionService.setSelection(selection);
|
||||
thisSelectionCount=selection.toList().size();
|
||||
}
|
||||
updateButtons();
|
||||
}
|
||||
|
||||
/**
|
||||
* reset tree viewer and tableviewer after every closed tab
|
||||
*/
|
||||
protected void resetTreeViewer() {
|
||||
//reset tree- and tableviewer
|
||||
treeViewer.setInput(null);
|
||||
txTableViewer.setInput(null);
|
||||
txTableViewer.setSelection(null);
|
||||
}
|
||||
|
||||
public void selectAllWaveforms() {
|
||||
int itemCount = txTableViewer.getTable().getItemCount();
|
||||
ArrayList<Object> list = new ArrayList<>();
|
||||
for(int i=0; i<itemCount; i++) {
|
||||
list.add(txTableViewer.getElementAt(i));
|
||||
}
|
||||
StructuredSelection sel = new StructuredSelection(list);
|
||||
txTableViewer.setSelection(sel);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the status event.
|
||||
*
|
||||
* @param waveformViewerPart the waveform viewer part
|
||||
* @return the status event
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
@Inject @Optional
|
||||
public void getActiveWaveformViewerEvent(@UIEventTopic(WaveformViewer.ACTIVE_WAVEFORMVIEW) WaveformViewer waveformViewerPart) {
|
||||
if(this.waveformViewerPart!=null) {
|
||||
this.waveformViewerPart.storeDesignBrowerState(new DBState());
|
||||
}
|
||||
if( this.waveformViewerPart == null || this.waveformViewerPart != waveformViewerPart ) {
|
||||
waveformViewerPart.addDisposeListener( new DisposeListener() {
|
||||
@Override
|
||||
public void widgetDisposed(DisposeEvent e) {
|
||||
Control control = treeViewer.getControl();
|
||||
// check if widget is already disposed (f.ex. because of workbench closing)
|
||||
if (control == null || control.isDisposed()) { //if so: do nothing
|
||||
}else { //reset tree- and tableviewer
|
||||
resetTreeViewer();
|
||||
}
|
||||
}
|
||||
} );
|
||||
}
|
||||
this.waveformViewerPart=waveformViewerPart;
|
||||
IWaveformDb database = waveformViewerPart.getDatabase();
|
||||
Object input = treeViewer.getInput();
|
||||
if(input!=null && input instanceof List<?>){
|
||||
IWaveformDb db = ((List<IWaveformDb>)input).get(0);
|
||||
if(db==database) return; // do nothing if old and new database is the same
|
||||
((List<IWaveformDb>)input).get(0).removePropertyChangeListener(treeViewerPCL);
|
||||
}
|
||||
treeViewer.setInput(Arrays.asList(database.isLoaded()?new IWaveformDb[]{database}:new IWaveformDb[]{new LoadingWaveformDb()}));
|
||||
Object state=this.waveformViewerPart.retrieveDesignBrowerState();
|
||||
if(state!=null && state instanceof DBState)
|
||||
((DBState)state).apply();
|
||||
else
|
||||
txTableViewer.setInput(null);
|
||||
// Set up the tree viewer
|
||||
database.addPropertyChangeListener(treeViewerPCL);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the selection.
|
||||
*
|
||||
* @param selection the selection
|
||||
* @param partService the part service
|
||||
*/
|
||||
@Inject
|
||||
public void setSelection(@Named(IServiceConstants.ACTIVE_SELECTION) @Optional IStructuredSelection selection, EPartService partService){
|
||||
MPart part = partService.getActivePart();
|
||||
if(part!=null && part.getObject() != this && selection!=null){
|
||||
if( selection instanceof IStructuredSelection) {
|
||||
Object object= ((IStructuredSelection)selection).getFirstElement();
|
||||
if(object instanceof IHierNode&& ((IHierNode)object).getChildNodes().size()!=0)
|
||||
txTableViewer.setInput(object);
|
||||
otherSelectionCount = (object instanceof IWaveform || object instanceof ITx)?1:0;
|
||||
}
|
||||
}
|
||||
updateButtons();
|
||||
}
|
||||
|
||||
/**
|
||||
* Update buttons.
|
||||
*/
|
||||
private void updateButtons() {
|
||||
if(txTableViewer!=null && !insertItem.isDisposed() && !appendItem.isDisposed()){
|
||||
AddWaveformHandler myHandler = new AddWaveformHandler();
|
||||
Object result = runCommand(myHandler, CanExecute.class, "after", false); //$NON-NLS-1$
|
||||
appendItem.setEnabled(result instanceof Boolean && (Boolean)result);
|
||||
result = runCommand(myHandler, CanExecute.class, "before", false); //$NON-NLS-1$
|
||||
insertItem.setEnabled(result instanceof Boolean && (Boolean)result);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The Class StreamTableFilter.
|
||||
*/
|
||||
public class StreamTableFilter extends ViewerFilter {
|
||||
|
||||
/** The search string. */
|
||||
private String searchString;
|
||||
private Pattern pattern;
|
||||
|
||||
/**
|
||||
* Sets the search text.
|
||||
*
|
||||
* @param s the new search text
|
||||
*/
|
||||
public void setSearchText(String s) {
|
||||
try {
|
||||
pattern = Pattern.compile(".*" + s + ".*"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
this.searchString = ".*" + s + ".*"; //$NON-NLS-1$ //$NON-NLS-2$
|
||||
} catch (PatternSyntaxException e) {}
|
||||
}
|
||||
|
||||
/* (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 IWaveform) {
|
||||
if (pattern.matcher(((IWaveform) element).getName()).matches())
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public class StreamTTreeFilter extends ViewerFilter {
|
||||
|
||||
/** The search string. */
|
||||
private String searchString;
|
||||
private Pattern pattern;
|
||||
|
||||
/**
|
||||
* Sets the search text.
|
||||
*
|
||||
* @param s the new search text
|
||||
*/
|
||||
public void setSearchText(String s) {
|
||||
try {
|
||||
pattern = Pattern.compile(".*" + s + ".*");
|
||||
this.searchString = ".*" + s + ".*"; //$NON-NLS-1$ //$NON-NLS-2$
|
||||
} catch (PatternSyntaxException e) {}
|
||||
|
||||
}
|
||||
|
||||
/* (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) {
|
||||
return selectTreePath(viewer, new TreePath(new Object[] { parentElement }), element);
|
||||
}
|
||||
|
||||
private boolean selectTreePath(Viewer viewer, TreePath parentPath, Object element) {
|
||||
// Cut off children of elements that are shown repeatedly.
|
||||
for (int i = 0; i < parentPath.getSegmentCount() - 1; i++) {
|
||||
if (element.equals(parentPath.getSegment(i))) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (!(viewer instanceof TreeViewer)) {
|
||||
return true;
|
||||
}
|
||||
if (searchString == null || searchString.length() == 0) {
|
||||
return true;
|
||||
}
|
||||
TreeViewer treeViewer = (TreeViewer) viewer;
|
||||
Boolean matchingResult = isMatchingOrNull(element);
|
||||
if (matchingResult != null) {
|
||||
return matchingResult;
|
||||
}
|
||||
return hasUnfilteredChild(treeViewer, parentPath, element);
|
||||
}
|
||||
|
||||
Boolean isMatchingOrNull(Object element) {
|
||||
if(element instanceof IWaveform) {
|
||||
if (pattern.matcher(((IWaveform) element).getName()).matches())
|
||||
return Boolean.TRUE;
|
||||
} else if(element instanceof IWaveformDb) {
|
||||
return Boolean.TRUE;
|
||||
} else if(element instanceof HierNode) {
|
||||
HierNode n = (HierNode) element;
|
||||
try {
|
||||
if (pattern.matcher(n.getFullName()).matches())
|
||||
return Boolean.TRUE;
|
||||
} catch (PatternSyntaxException e) {
|
||||
return Boolean.TRUE;
|
||||
}
|
||||
} else {
|
||||
return Boolean.FALSE;
|
||||
}
|
||||
/* maybe children are matching */
|
||||
return null;
|
||||
}
|
||||
|
||||
private boolean hasUnfilteredChild(TreeViewer viewer, TreePath parentPath, Object element) {
|
||||
TreePath elementPath = parentPath.createChildPath(element);
|
||||
IContentProvider contentProvider = viewer.getContentProvider();
|
||||
Object[] children = contentProvider instanceof ITreePathContentProvider
|
||||
? ((ITreePathContentProvider) contentProvider).getChildren(elementPath)
|
||||
: ((ITreeContentProvider) contentProvider).getChildren(element);
|
||||
|
||||
/* avoid NPE + guard close */
|
||||
if (children == null || children.length == 0) {
|
||||
return false;
|
||||
}
|
||||
for (int i = 0; i < children.length; i++) {
|
||||
if (selectTreePath(viewer, elementPath, children[i])) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Gets the filtered children.
|
||||
*
|
||||
* @param viewer the viewer
|
||||
* @return the filtered children
|
||||
*/
|
||||
protected Object[] getFilteredChildren(TableViewer viewer){
|
||||
Object parent = viewer.getInput();
|
||||
if(parent==null) return new Object[0];
|
||||
Object[] result = null;
|
||||
if (parent != null) {
|
||||
IStructuredContentProvider cp = (IStructuredContentProvider) viewer.getContentProvider();
|
||||
if (cp != null) {
|
||||
result = cp.getElements(parent);
|
||||
if(result==null) return new Object[0];
|
||||
for (int i = 0, n = result.length; i < n; ++i) {
|
||||
if(result[i]==null) return new Object[0];
|
||||
}
|
||||
}
|
||||
}
|
||||
ViewerFilter[] filters = viewer.getFilters();
|
||||
if (filters != null) {
|
||||
for (ViewerFilter f:filters) {
|
||||
Object[] filteredResult = f.filter(viewer, parent, result);
|
||||
result = filteredResult;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Run command.
|
||||
*
|
||||
* @param handler the handler
|
||||
* @param annotation the annotation
|
||||
* @param where the where
|
||||
* @param all the all
|
||||
* @return the object
|
||||
*/
|
||||
protected Object runCommand(AddWaveformHandler handler, Class<? extends Annotation> annotation, String where, Boolean all) {
|
||||
ContextInjectionFactory.inject(handler, eclipseCtx);
|
||||
eclipseCtx.set(AddWaveformHandler.PARAM_WHERE_ID, where);
|
||||
eclipseCtx.set(AddWaveformHandler.PARAM_ALL_ID, all.toString());
|
||||
eclipseCtx.set(DesignBrowser.class, this);
|
||||
eclipseCtx.set(WaveformViewer.class, waveformViewerPart);
|
||||
Object result = ContextInjectionFactory.invoke(handler, annotation, eclipseCtx);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the filtered children.
|
||||
*
|
||||
* @return the filtered children
|
||||
*/
|
||||
public Object[] getFilteredChildren() {
|
||||
return getFilteredChildren(txTableViewer);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the active waveform viewer part.
|
||||
*
|
||||
* @return the active waveform viewer part
|
||||
*/
|
||||
public WaveformViewer getActiveWaveformViewerPart() {
|
||||
return waveformViewerPart;
|
||||
}
|
||||
|
||||
/**
|
||||
* The Class DBState.
|
||||
*/
|
||||
class DBState {
|
||||
|
||||
/**
|
||||
* Instantiates a new DB state.
|
||||
*/
|
||||
public DBState() {
|
||||
this.expandedElements=treeViewer.getExpandedElements();
|
||||
this.treeSelection=treeViewer.getSelection();
|
||||
this.tableSelection=txTableViewer.getSelection();
|
||||
}
|
||||
|
||||
/**
|
||||
* Apply.
|
||||
*/
|
||||
public void apply() {
|
||||
treeViewer.setExpandedElements(expandedElements);
|
||||
treeViewer.setSelection(treeSelection, true);
|
||||
txTableViewer.setSelection(tableSelection, true);
|
||||
|
||||
}
|
||||
|
||||
/** The expanded elements. */
|
||||
private Object[] expandedElements;
|
||||
|
||||
/** The tree selection. */
|
||||
private ISelection treeSelection;
|
||||
|
||||
/** The table selection. */
|
||||
private ISelection tableSelection;
|
||||
}
|
||||
};
|
@ -0,0 +1,482 @@
|
||||
package com.minres.scviewer.e4.application.parts;
|
||||
|
||||
import java.io.File;
|
||||
import java.nio.file.FileSystems;
|
||||
import java.nio.file.PathMatcher;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.eclipse.jface.dialogs.IDialogConstants;
|
||||
import org.eclipse.jface.dialogs.TrayDialog;
|
||||
import org.eclipse.jface.viewers.ArrayContentProvider;
|
||||
import org.eclipse.jface.viewers.ColumnLabelProvider;
|
||||
import org.eclipse.jface.viewers.ILabelProvider;
|
||||
import org.eclipse.jface.viewers.ILabelProviderListener;
|
||||
import org.eclipse.jface.viewers.IStructuredSelection;
|
||||
import org.eclipse.jface.viewers.ITreeContentProvider;
|
||||
import org.eclipse.jface.viewers.TableViewer;
|
||||
import org.eclipse.jface.viewers.TableViewerColumn;
|
||||
import org.eclipse.jface.viewers.TreePath;
|
||||
import org.eclipse.jface.viewers.TreeSelection;
|
||||
import org.eclipse.jface.viewers.TreeViewer;
|
||||
import org.eclipse.jface.viewers.Viewer;
|
||||
import org.eclipse.jface.viewers.ViewerComparator;
|
||||
import org.eclipse.jface.viewers.ViewerFilter;
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.custom.SashForm;
|
||||
import org.eclipse.swt.events.MouseAdapter;
|
||||
import org.eclipse.swt.events.MouseEvent;
|
||||
import org.eclipse.swt.events.SelectionAdapter;
|
||||
import org.eclipse.swt.events.SelectionEvent;
|
||||
import org.eclipse.swt.graphics.Color;
|
||||
import org.eclipse.swt.graphics.Image;
|
||||
import org.eclipse.swt.graphics.Point;
|
||||
import org.eclipse.swt.layout.GridData;
|
||||
import org.eclipse.swt.layout.GridLayout;
|
||||
import org.eclipse.swt.widgets.Combo;
|
||||
import org.eclipse.swt.widgets.Composite;
|
||||
import org.eclipse.swt.widgets.Control;
|
||||
import org.eclipse.swt.widgets.Shell;
|
||||
import org.eclipse.swt.widgets.Table;
|
||||
import org.eclipse.swt.widgets.TableColumn;
|
||||
import org.eclipse.swt.widgets.TableItem;
|
||||
import org.eclipse.swt.widgets.Text;
|
||||
import org.eclipse.swt.widgets.ToolBar;
|
||||
import org.eclipse.swt.widgets.ToolItem;
|
||||
import org.eclipse.wb.swt.ResourceManager;
|
||||
|
||||
public class FileBrowserDialog extends TrayDialog {
|
||||
|
||||
private Image folderImage;
|
||||
|
||||
private Image fileImage;
|
||||
|
||||
private Image dbImage;
|
||||
|
||||
File currentDirFile;
|
||||
|
||||
TreeViewer dirTreeViewer;
|
||||
|
||||
TableViewer tableViewer;
|
||||
|
||||
Text fileNameEntry;
|
||||
|
||||
Combo filterCombo;
|
||||
|
||||
FileTableComparator fileTableComparator;
|
||||
|
||||
private FileGlobber globber = new FileGlobber();
|
||||
|
||||
private FileGlobber imageGlobber = new FileGlobber();
|
||||
|
||||
private File selectedDir;
|
||||
|
||||
private List<File> selectedFiles;
|
||||
|
||||
String[] filterStrings = new String[] {"*"};
|
||||
|
||||
public FileBrowserDialog(Shell parentShell) {
|
||||
super(parentShell);
|
||||
folderImage=ResourceManager.getPluginImage("com.minres.scviewer.e4.application", "icons/folder.png"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
dbImage=ResourceManager.getPluginImage("com.minres.scviewer.e4.application", "icons/database.png"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
fileImage=ResourceManager.getPluginImage("com.minres.scviewer.e4.application", "icons/page_white.png"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
currentDirFile = new File(".");
|
||||
}
|
||||
|
||||
public void setFilterExtensions(String[] filterStrings) {
|
||||
if(filterStrings.length==0){
|
||||
globber = new FileGlobber();
|
||||
} else {
|
||||
globber= new FileGlobber(filterStrings[0]);
|
||||
imageGlobber = new FileGlobber(filterStrings[0]);
|
||||
if(filterCombo!=null) {
|
||||
filterCombo.setItems(filterStrings);
|
||||
filterCombo.select(0);
|
||||
filterCombo.computeSize(SWT.DEFAULT, SWT.DEFAULT);
|
||||
}
|
||||
}
|
||||
this.filterStrings=filterStrings;
|
||||
}
|
||||
|
||||
public List<File> getSelectedFiles(){
|
||||
return selectedFiles;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Control createContents(Composite parent) {
|
||||
Control ret = super.createContents(parent);
|
||||
setDirSelection(currentDirFile.getAbsoluteFile().getParentFile());
|
||||
getButton(IDialogConstants.OK_ID).setEnabled(!tableViewer.getSelection().isEmpty());
|
||||
if(parent instanceof Shell) {
|
||||
Point size = ((Shell)parent).computeSize(SWT.DEFAULT, SWT.DEFAULT);
|
||||
((Shell)parent).setSize(size.x, 400);
|
||||
((Shell)parent).setText("Select database");
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Control createDialogArea(Composite parent) {
|
||||
Composite area = (Composite) super.createDialogArea(parent);
|
||||
final SashForm sashForm = new SashForm(area, SWT.HORIZONTAL);
|
||||
sashForm.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.FILL_VERTICAL));
|
||||
|
||||
dirTreeViewer = new TreeViewer(sashForm);
|
||||
dirTreeViewer.setContentProvider(new FileTreeContentProvider());
|
||||
dirTreeViewer.setLabelProvider(new FileTreeLabelProvider());
|
||||
dirTreeViewer.addSelectionChangedListener(event -> {
|
||||
IStructuredSelection sel = event.getStructuredSelection();
|
||||
File entry = (File) sel.getFirstElement();
|
||||
if(entry!=null && entry.isDirectory()) {
|
||||
selectedDir = entry;
|
||||
tableViewer.setInput(selectedDir.listFiles());
|
||||
}
|
||||
});
|
||||
dirTreeViewer.setInput("root");
|
||||
|
||||
final Composite tableViewerParent = new Composite(sashForm, SWT.NONE);
|
||||
GridLayout gridLayout = new GridLayout(1, true);
|
||||
gridLayout.horizontalSpacing=0;
|
||||
gridLayout.verticalSpacing=5;
|
||||
gridLayout.marginHeight=0;
|
||||
gridLayout.marginHeight=0;
|
||||
tableViewerParent.setLayout(gridLayout);
|
||||
final ToolBar toolBar = new ToolBar(tableViewerParent, SWT.HORIZONTAL |SWT.SHADOW_OUT);
|
||||
toolBar.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL));
|
||||
final ToolItem toolbarItemUp = new ToolItem(toolBar, SWT.PUSH);
|
||||
toolbarItemUp.setToolTipText("up one level");
|
||||
toolbarItemUp.setImage(ResourceManager.getPluginImage("com.minres.scviewer.e4.application", "icons/arrow_up.png")); //$NON-NLS-1$ //$NON-NLS-2$);
|
||||
toolbarItemUp.addSelectionListener(new SelectionAdapter() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent e) {
|
||||
if(selectedDir.getParentFile()!=null) {
|
||||
selectedDir=selectedDir.getParentFile();
|
||||
tableViewer.setInput(selectedDir.listFiles());
|
||||
}
|
||||
}
|
||||
});
|
||||
tableViewer = new TableViewer(tableViewerParent, SWT.BORDER | SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION | SWT.MULTI);
|
||||
tableViewer.getTable().setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL | GridData.VERTICAL_ALIGN_FILL | GridData.HORIZONTAL_ALIGN_FILL));
|
||||
tableViewer.addSelectionChangedListener(event -> {
|
||||
IStructuredSelection sel = event.getStructuredSelection();
|
||||
getButton(IDialogConstants.OK_ID).setEnabled(!sel.isEmpty());
|
||||
@SuppressWarnings("unchecked")
|
||||
Object text = sel.toList().stream().map(e -> ((File)e).getName()).collect(Collectors.joining(";"));
|
||||
fileNameEntry.setText(text.toString());
|
||||
});
|
||||
tableViewer.addDoubleClickListener(event -> {
|
||||
IStructuredSelection sel = tableViewer.getStructuredSelection();
|
||||
if(sel.isEmpty()) return;
|
||||
if(sel.size()==1) {
|
||||
File elem = (File) sel.getFirstElement();
|
||||
if(globber.matches(elem))
|
||||
buttonPressed(IDialogConstants.OK_ID);
|
||||
else if(elem.isDirectory())
|
||||
setDirSelection(elem);
|
||||
} else
|
||||
buttonPressed(IDialogConstants.OK_ID);
|
||||
});
|
||||
tableViewer.setContentProvider(ArrayContentProvider.getInstance());
|
||||
tableViewer.getTable().setHeaderVisible(true);
|
||||
tableViewer.getTable().setLinesVisible(true);
|
||||
tableViewer.getTable().addMouseListener(new MouseAdapter() {
|
||||
@Override
|
||||
public void mouseDown(MouseEvent e) { mouseUp(e); }
|
||||
@Override
|
||||
public void mouseUp(MouseEvent e) {
|
||||
TableItem element = (TableItem)tableViewer.getTable().getItem(new Point(e.x, e.y));
|
||||
final Table table = tableViewer.getTable();
|
||||
if (element == null )//&& (e.stateMask&SWT.MODIFIER_MASK)!=0)
|
||||
table.deselectAll();
|
||||
else {
|
||||
int[] indices = table.getSelectionIndices();
|
||||
if(indices.length==1) {
|
||||
TableItem ti = table.getItem(indices[0]);
|
||||
if(!globber.matches(ti.getData()) && !((File)ti.getData()).isDirectory())
|
||||
table.deselect(indices[0]);
|
||||
} else {
|
||||
for (int idx : indices) {
|
||||
TableItem ti = table.getItem(idx);
|
||||
if(!globber.matches(ti.getData()))
|
||||
table.deselect(idx);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
TableViewerColumn colName = new TableViewerColumn(tableViewer, SWT.NONE);
|
||||
colName.setLabelProvider(new FileTableLabelProvider() {
|
||||
@Override public String getText(Object element) { return ((File) element).getName(); }
|
||||
@Override public Image getImage(Object element){
|
||||
if(imageGlobber.matches(element)) return dbImage;
|
||||
return ((File) element).isDirectory()?folderImage:fileImage;
|
||||
}
|
||||
});
|
||||
colName.getColumn().setWidth(300);
|
||||
colName.getColumn().setText("Name");
|
||||
colName.getColumn().addSelectionListener(getSelectionAdapter(colName.getColumn(), 0));
|
||||
|
||||
TableViewerColumn colSize = new TableViewerColumn(tableViewer, SWT.RIGHT);
|
||||
colSize.setLabelProvider(new FileTableLabelProvider() {
|
||||
@Override public String getText(Object element) { return String.format("%d", ((File) element).length()); }
|
||||
});
|
||||
colSize.getColumn().setWidth(100);
|
||||
colSize.getColumn().setText("Size");
|
||||
colSize.getColumn().addSelectionListener(getSelectionAdapter(colSize.getColumn(), 1));
|
||||
|
||||
TableViewerColumn colEmpty = new TableViewerColumn(tableViewer, SWT.CENTER);
|
||||
colEmpty.setLabelProvider(new FileTableLabelProvider() {
|
||||
@Override public String getText(Object element) { return ""; }
|
||||
});
|
||||
//colEmpty.getColumn().setWidth(200);
|
||||
colEmpty.getColumn().setText("");
|
||||
|
||||
fileTableComparator = new FileTableComparator();
|
||||
tableViewer.setComparator(fileTableComparator);
|
||||
tableViewer.addFilter(new FileTableFilter());
|
||||
|
||||
Composite bottomBar = new Composite(tableViewerParent, SWT.NONE);
|
||||
bottomBar.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL));
|
||||
GridLayout gridLayoutBottom = new GridLayout(2, false);
|
||||
gridLayoutBottom.horizontalSpacing=0;
|
||||
gridLayoutBottom.verticalSpacing=0;
|
||||
gridLayoutBottom.marginHeight=0;
|
||||
gridLayoutBottom.marginWidth=0;
|
||||
bottomBar.setLayout(gridLayoutBottom);
|
||||
|
||||
fileNameEntry = new Text(bottomBar, SWT.BORDER);
|
||||
fileNameEntry.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL));
|
||||
fileNameEntry.setEditable(false); //TODO: temporary disabled
|
||||
fileNameEntry.setEnabled(false);
|
||||
|
||||
filterCombo = new Combo(bottomBar, SWT.DROP_DOWN | SWT.BORDER | SWT.READ_ONLY);
|
||||
filterCombo.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
|
||||
filterCombo.setItems(filterStrings);
|
||||
filterCombo.select(0);
|
||||
filterCombo.addSelectionListener(new SelectionAdapter() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent e) {
|
||||
globber= new FileGlobber(filterCombo.getText());
|
||||
tableViewer.setInput(selectedDir.listFiles());
|
||||
}
|
||||
});
|
||||
sashForm.setWeights(new int[]{3, 3});
|
||||
return area;
|
||||
}
|
||||
|
||||
private SelectionAdapter getSelectionAdapter(final TableColumn column, final int index) {
|
||||
SelectionAdapter selectionAdapter = new SelectionAdapter() {
|
||||
@Override
|
||||
public void widgetSelected(SelectionEvent e) {
|
||||
fileTableComparator.setColumn(index);
|
||||
int dir = fileTableComparator.getDirection();
|
||||
tableViewer.getTable().setSortDirection(dir);
|
||||
tableViewer.getTable().setSortColumn(column);
|
||||
tableViewer.refresh();
|
||||
}
|
||||
};
|
||||
return selectionAdapter;
|
||||
}
|
||||
|
||||
private void setDirSelection(File f) {
|
||||
ArrayList<File> fileTree = getParentDirList(f);
|
||||
TreeSelection selection = new TreeSelection(new TreePath(fileTree.toArray()));
|
||||
dirTreeViewer.setSelection(selection, true);
|
||||
}
|
||||
|
||||
private ArrayList<File> getParentDirList(File actual){
|
||||
if(actual==null)
|
||||
return new ArrayList<>();
|
||||
else {
|
||||
ArrayList<File> l = getParentDirList(actual.getParentFile());
|
||||
l.add(actual);
|
||||
return l;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean isResizable() {
|
||||
return true;
|
||||
}
|
||||
|
||||
// save content of the Text fields because they get disposed
|
||||
// as soon as the Dialog closes
|
||||
@SuppressWarnings("unchecked")
|
||||
private void saveInput() {
|
||||
selectedFiles= tableViewer.getStructuredSelection().toList();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void okPressed() {
|
||||
saveInput();
|
||||
super.okPressed();
|
||||
}
|
||||
|
||||
class FileGlobber {
|
||||
|
||||
List<PathMatcher> matchers;
|
||||
|
||||
public FileGlobber() {
|
||||
matchers = new ArrayList<>(); }
|
||||
|
||||
public FileGlobber(String expr) {
|
||||
ArrayList<PathMatcher> m = new ArrayList<>();
|
||||
if(expr.length()>0) {
|
||||
String[] tok = expr.split(";");
|
||||
for (String string : tok) {
|
||||
m.add(FileSystems.getDefault().getPathMatcher("glob:**/"+string));
|
||||
}
|
||||
}
|
||||
matchers = m;
|
||||
}
|
||||
|
||||
public boolean matches(Object f) {
|
||||
assert(f instanceof File);
|
||||
if(matchers.size()==0) return true;
|
||||
for (PathMatcher m : matchers) {
|
||||
if(m.matches(((File)f).toPath())) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
class FileTreeContentProvider implements ITreeContentProvider {
|
||||
public Object[] getChildren(Object arg0) {
|
||||
File[] entries = ((File) arg0).listFiles();
|
||||
if(entries != null) {
|
||||
List<File> res = Arrays.stream(entries)
|
||||
.filter(file -> !(file.isFile()||file.getName().startsWith(".") ||globber.matches(file)))
|
||||
.sorted(new Comparator<File>(){
|
||||
public int compare(File f1, File f2){return f1.getName().compareTo(f2.getName());}
|
||||
})
|
||||
.collect(Collectors.toList()); ;
|
||||
return res.toArray();
|
||||
} else
|
||||
return new Object[0];
|
||||
}
|
||||
|
||||
public Object getParent(Object arg0) {
|
||||
return ((File) arg0).getParentFile();
|
||||
}
|
||||
|
||||
public boolean hasChildren(Object arg0) {
|
||||
Object[] obj = getChildren(arg0);
|
||||
return obj == null ? false : obj.length > 0;
|
||||
}
|
||||
|
||||
public Object[] getElements(Object arg0) {
|
||||
return File.listRoots();
|
||||
}
|
||||
|
||||
public void dispose() {
|
||||
}
|
||||
|
||||
public void inputChanged(Viewer arg0, Object arg1, Object arg2) {
|
||||
}
|
||||
}
|
||||
|
||||
class FileTreeLabelProvider implements ILabelProvider {
|
||||
private List<ILabelProviderListener> listeners;
|
||||
|
||||
private Image file;
|
||||
|
||||
private Image dir;
|
||||
|
||||
public FileTreeLabelProvider() {
|
||||
listeners = new ArrayList<ILabelProviderListener>();
|
||||
}
|
||||
|
||||
public Image getImage(Object arg0) {
|
||||
return ((File) arg0).isDirectory() ? folderImage : file;
|
||||
}
|
||||
|
||||
public String getText(Object arg0) {
|
||||
File f = (File)arg0;
|
||||
return f.getName().length() == 0? f.getPath() : f.getName();
|
||||
}
|
||||
|
||||
public void addListener(ILabelProviderListener arg0) {
|
||||
listeners.add(arg0);
|
||||
}
|
||||
|
||||
public void dispose() {
|
||||
// Dispose the images
|
||||
if (dir != null)
|
||||
dir.dispose();
|
||||
if (file != null)
|
||||
file.dispose();
|
||||
}
|
||||
|
||||
public boolean isLabelProperty(Object arg0, String arg1) {
|
||||
return false;
|
||||
}
|
||||
|
||||
public void removeListener(ILabelProviderListener arg0) {
|
||||
listeners.remove(arg0);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public class FileTableFilter extends ViewerFilter {
|
||||
|
||||
@Override
|
||||
public boolean select(Viewer viewer, Object parentElement, Object element) {
|
||||
File p = (File) element;
|
||||
return !p.getName().startsWith(".");
|
||||
}
|
||||
}
|
||||
|
||||
public class FileTableComparator extends ViewerComparator {
|
||||
private int propertyIndex = 0;
|
||||
private boolean descending = false;
|
||||
|
||||
public FileTableComparator() {
|
||||
}
|
||||
|
||||
public int getDirection() {
|
||||
return descending ? SWT.DOWN : SWT.UP;
|
||||
}
|
||||
|
||||
public void setColumn(int column) {
|
||||
descending = column == this.propertyIndex?!descending : false;
|
||||
this.propertyIndex = column;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compare(Viewer viewer, Object e1, Object e2) {
|
||||
File p1 = (File) e1;
|
||||
File p2 = (File) e2;
|
||||
int rc = 0;
|
||||
switch (propertyIndex) {
|
||||
case 0:
|
||||
rc = p1.getName().compareTo(p2.getName());
|
||||
break;
|
||||
case 1:
|
||||
rc = Long.valueOf(p1.length()).compareTo(p2.length());
|
||||
break;
|
||||
default:
|
||||
rc = 0;
|
||||
}
|
||||
// If descending order, flip the direction
|
||||
return descending? -rc : rc;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public class FileTableLabelProvider extends ColumnLabelProvider {
|
||||
@Override
|
||||
public Color getBackground(Object element) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Color getForeground(Object element) {
|
||||
return globber.matches(element) || ((File)element).isDirectory()? null: ResourceManager.getColor(SWT.COLOR_GRAY);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,88 @@
|
||||
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.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() {
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,58 @@
|
||||
/*******************************************************************************
|
||||
* 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 org.eclipse.e4.ui.model.application.ui.basic.MPart;
|
||||
import org.eclipse.e4.ui.workbench.modeling.IPartListener;
|
||||
|
||||
/**
|
||||
* The default implementation of a {@link IPartListener}.
|
||||
* The class that is interested in processing a part
|
||||
* event extends this class overriding the respective method, and the object created
|
||||
* with that class is registered with a component using the
|
||||
* component's <code>addPartListener<code> method. When
|
||||
* the part event occurs, that object's appropriate
|
||||
* method is invoked.
|
||||
*
|
||||
* @see PartEvent
|
||||
*/
|
||||
public class PartListener implements IPartListener {
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.e4.ui.workbench.modeling.IPartListener#partBroughtToTop(org.eclipse.e4.ui.model.application.ui.basic.MPart)
|
||||
*/
|
||||
@Override
|
||||
public void partBroughtToTop(MPart part) {}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.e4.ui.workbench.modeling.IPartListener#partActivated(org.eclipse.e4.ui.model.application.ui.basic.MPart)
|
||||
*/
|
||||
@Override
|
||||
public void partActivated(MPart part) {}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.e4.ui.workbench.modeling.IPartListener#partDeactivated(org.eclipse.e4.ui.model.application.ui.basic.MPart)
|
||||
*/
|
||||
@Override
|
||||
public void partDeactivated(MPart part) {}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.e4.ui.workbench.modeling.IPartListener#partHidden(org.eclipse.e4.ui.model.application.ui.basic.MPart)
|
||||
*/
|
||||
@Override
|
||||
public void partHidden(MPart part) {}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.e4.ui.workbench.modeling.IPartListener#partVisible(org.eclipse.e4.ui.model.application.ui.basic.MPart)
|
||||
*/
|
||||
@Override
|
||||
public void partVisible(MPart part) {}
|
||||
}
|
@ -0,0 +1,748 @@
|
||||
/*******************************************************************************
|
||||
* 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.AbstractMap;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Map;
|
||||
import java.util.TreeMap;
|
||||
import java.util.Vector;
|
||||
import java.util.regex.PatternSyntaxException;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
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.model.application.ui.basic.MPart;
|
||||
import org.eclipse.e4.ui.services.IServiceConstants;
|
||||
import org.eclipse.e4.ui.workbench.modeling.EPartService;
|
||||
import org.eclipse.e4.ui.workbench.modeling.ESelectionService;
|
||||
import org.eclipse.jface.viewers.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.ViewerComparator;
|
||||
import org.eclipse.jface.viewers.ViewerFilter;
|
||||
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.DataType;
|
||||
import com.minres.scviewer.database.ITx;
|
||||
import com.minres.scviewer.database.ITxAttribute;
|
||||
import com.minres.scviewer.database.ITxRelation;
|
||||
import com.minres.scviewer.e4.application.Messages;
|
||||
import com.minres.scviewer.e4.application.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();
|
||||
treeViewer.expandAll(true);
|
||||
}
|
||||
});
|
||||
|
||||
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]));
|
||||
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){
|
||||
ArrayList<String> names = new ArrayList<>();
|
||||
int indexInParent=getTopItemHier(names);
|
||||
ArrayList<Boolean> states = getExpandedState(treeViewer.getTree().getItems());
|
||||
treeViewer.setInput(object);
|
||||
setExpandedState(treeViewer.getTree().getItems(), states);
|
||||
setTopItemFromHier(names, indexInParent);
|
||||
} else {
|
||||
treeViewer.setInput(null);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void setExpandedState(TreeItem[] treeItems, ArrayList<Boolean> states) {
|
||||
for (int i = 0; i < treeItems.length; i++) {
|
||||
treeItems[i].setExpanded(states.size()>i?states.get(i):true);
|
||||
}
|
||||
}
|
||||
|
||||
private ArrayList<Boolean> getExpandedState(TreeItem[] items){
|
||||
ArrayList<Boolean> ret = new ArrayList<>();
|
||||
for (TreeItem treeItem : items)
|
||||
ret.add(treeItem.getItemCount()>0?treeItem.getExpanded():true);
|
||||
return ret;
|
||||
}
|
||||
|
||||
private int getTopItemHier(ArrayList<String> names){
|
||||
int indexInParent=-1;
|
||||
TreeItem obj = treeViewer.getTree().getTopItem();
|
||||
if(obj!=null) {
|
||||
names.add(0, obj.getText(0));
|
||||
if(obj.getParentItem()!=null) {
|
||||
TreeItem pobj=obj.getParentItem();
|
||||
names.add(0, pobj.getText(0));
|
||||
TreeItem[] items = pobj.getItems();
|
||||
for (int i = 0; i < items.length; i++) {
|
||||
if(items[i]==obj) {
|
||||
indexInParent=i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return indexInParent;
|
||||
}
|
||||
|
||||
private void setTopItemFromHier(ArrayList<String> names, int indexInParent) {
|
||||
if(indexInParent<0 || names.size()==0 ) return;
|
||||
TreeItem selItem=null;
|
||||
for (TreeItem item : treeViewer.getTree().getItems()) { // find item from category
|
||||
if(item.getText(0).equals(names.get(0))) {
|
||||
if(names.size()>1) { // if we had an attribute as top item
|
||||
TreeItem[] subItems=item.getItems();
|
||||
for(TreeItem it : subItems) { // try to align by name
|
||||
if(it.getText(0).equals(names.get(1))) {
|
||||
selItem=it;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(selItem==null && indexInParent>=0 && subItems.length>0) // name based match failed so try to use position
|
||||
selItem=subItems[subItems.length>indexInParent?indexInParent:subItems.length-1];
|
||||
}
|
||||
if(selItem==null) // no match in attributes so set the category as top item
|
||||
selItem=item;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(selItem!=null)
|
||||
treeViewer.getTree().setTopItem(selItem);
|
||||
}
|
||||
/**
|
||||
* Sets the selection.
|
||||
*
|
||||
* @param selection the new selection
|
||||
*/
|
||||
@Inject
|
||||
public void setSelection(@Named(IServiceConstants.ACTIVE_SELECTION) @Optional IStructuredSelection selection, EPartService partService){
|
||||
// only react if selection is actually from the WaveformViewer and nothing else
|
||||
MPart part = partService.getActivePart();
|
||||
if( part == null || ! (part.getObject() instanceof WaveformViewer ) )
|
||||
return;
|
||||
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$
|
||||
sb.append(" - ").append(timeToString(tx.getEndTime())).append("]"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* The Class TxAttributeViewerSorter.
|
||||
*/
|
||||
class TxAttributeViewerSorter extends ViewerComparator {
|
||||
|
||||
/** The Constant ASCENDING. */
|
||||
private static final int ASCENDING = 0;
|
||||
|
||||
/** The Constant DESCENDING. */
|
||||
private static final int DESCENDING = 1;
|
||||
|
||||
/** The column. */
|
||||
private int column;
|
||||
|
||||
/** The direction. */
|
||||
private int direction;
|
||||
|
||||
/**
|
||||
* Does the sort. If it's a different column from the previous sort, do an
|
||||
* ascending sort. If it's the same column as the last sort, toggle the sort
|
||||
* direction.
|
||||
*
|
||||
* @param column the column
|
||||
*/
|
||||
public void doSort(int column) {
|
||||
if (column == this.column) {
|
||||
// Same column as last sort; toggle the direction
|
||||
direction = 1 - direction;
|
||||
} else {
|
||||
// New column; do an ascending sort
|
||||
this.column = column;
|
||||
direction = ASCENDING;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Compares the object for sorting.
|
||||
*
|
||||
* @param viewer the viewer
|
||||
* @param e1 the e1
|
||||
* @param e2 the e2
|
||||
* @return the int
|
||||
*/
|
||||
public int compare(Viewer viewer, Object e1, Object e2) {
|
||||
int rc = 0;
|
||||
if(e1 instanceof ITxAttribute && e2 instanceof ITxAttribute){
|
||||
ITxAttribute p1 = (ITxAttribute) e1;
|
||||
ITxAttribute p2 = (ITxAttribute) e2;
|
||||
// Determine which column and do the appropriate sort
|
||||
switch (column) {
|
||||
case COLUMN_FIRST:
|
||||
rc = getComparator().compare(p1.getName(), p2.getName());
|
||||
break;
|
||||
case COLUMN_SECOND:
|
||||
rc = getComparator().compare(p1.getDataType().name(), p2.getDataType().name());
|
||||
break;
|
||||
case COLUMN_THIRD:
|
||||
rc = getComparator().compare(p1.getValue().toString(), p2.getValue().toString());
|
||||
break;
|
||||
}
|
||||
// If descending order, flip the direction
|
||||
if (direction == DESCENDING) rc = -rc;
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The Class TxAttributeFilter.
|
||||
*/
|
||||
class TxAttributeFilter extends ViewerFilter {
|
||||
|
||||
/** The search string. */
|
||||
private String searchString;
|
||||
|
||||
/**
|
||||
* Sets the search text.
|
||||
*
|
||||
* @param s the new search text
|
||||
*/
|
||||
public void setSearchText(String s) {
|
||||
this.searchString = ".*" + s + ".*"; //$NON-NLS-1$ //$NON-NLS-2$
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.jface.viewers.ViewerFilter#select(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)
|
||||
*/
|
||||
@Override
|
||||
public boolean select(Viewer viewer, Object parentElement, Object element) {
|
||||
|
||||
if (searchString == null || searchString.length() == 0) {
|
||||
return true;
|
||||
}
|
||||
if(element instanceof TreeNode) {
|
||||
return true;
|
||||
}
|
||||
if(element instanceof ITxAttribute){
|
||||
try {
|
||||
return (((ITxAttribute) element).getName().toLowerCase().matches(searchString.toLowerCase()));
|
||||
} catch (PatternSyntaxException e) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if(element instanceof Object[]) {
|
||||
try {
|
||||
return (((Object[])element)[0]).toString().toLowerCase().matches(searchString.toLowerCase());
|
||||
} catch (PatternSyntaxException e) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The Enum Type.
|
||||
*/
|
||||
enum Type {
|
||||
PROPS, /** The props. */
|
||||
ATTRS, /** The attrs. */
|
||||
IN_REL, /** The in rel. */
|
||||
OUT_REL,/** The out rel. */
|
||||
HIER
|
||||
}
|
||||
|
||||
/**
|
||||
* The Class TreeNode.
|
||||
*/
|
||||
class TreeNode{
|
||||
|
||||
/** The type. */
|
||||
public Type type;
|
||||
|
||||
/** The element. */
|
||||
public ITx element;
|
||||
|
||||
private String hier_path;
|
||||
/**
|
||||
* Instantiates a new tree node.
|
||||
*
|
||||
* @param element the element
|
||||
* @param type the type
|
||||
*/
|
||||
public TreeNode(ITx element, Type type){
|
||||
this.element=element;
|
||||
this.type=type;
|
||||
this.hier_path="";
|
||||
}
|
||||
|
||||
public TreeNode(ITx element, String path){
|
||||
this.element=element;
|
||||
this.type=Type.HIER;
|
||||
this.hier_path=path;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see java.lang.Object#toString()
|
||||
*/
|
||||
public String toString(){
|
||||
switch(type){
|
||||
case PROPS: return Messages.TransactionDetails_10;
|
||||
case ATTRS: return Messages.TransactionDetails_11;
|
||||
case IN_REL: return Messages.TransactionDetails_12;
|
||||
case OUT_REL: return Messages.TransactionDetails_13;
|
||||
case HIER:{
|
||||
String[] tokens = hier_path.split("\\.");
|
||||
return tokens[tokens.length-1];
|
||||
}
|
||||
}
|
||||
return ""; //$NON-NLS-1$
|
||||
}
|
||||
|
||||
public Object[] getAttributeListForHier() {
|
||||
if(childs==null) {
|
||||
Map<String, Object> res = element.getAttributes().stream()
|
||||
.filter(txAttr -> txAttr.getName().startsWith(hier_path))
|
||||
.map(txAttr -> {
|
||||
String target = hier_path.length()==0?txAttr.getName():txAttr.getName().replace(hier_path+'.', "");
|
||||
String[] tokens = target.split("\\.");
|
||||
if(tokens.length==1)
|
||||
return new AbstractMap.SimpleEntry<>(tokens[0], txAttr);
|
||||
else
|
||||
return new AbstractMap.SimpleEntry<>(tokens[0], new TreeNode(element, hier_path.length()>0?hier_path+"."+tokens[0]:tokens[0]));
|
||||
})
|
||||
.collect(Collectors.toMap(p -> p.getKey(), p -> p.getValue(), (first, second) -> first));
|
||||
childs = new TreeMap<String, Object>(res).values().toArray();
|
||||
}
|
||||
return childs;
|
||||
}
|
||||
|
||||
private Object[] childs=null;
|
||||
}
|
||||
|
||||
/**
|
||||
* The Class TransactionTreeContentProvider.
|
||||
*/
|
||||
class TransactionTreeContentProvider implements ITreeContentProvider {
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.jface.viewers.IContentProvider#dispose()
|
||||
*/
|
||||
@Override
|
||||
public void dispose() { }
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)
|
||||
*/
|
||||
@Override
|
||||
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.jface.viewers.ITreeContentProvider#getElements(java.lang.Object)
|
||||
*/
|
||||
@Override
|
||||
public Object[] getElements(Object element) {
|
||||
return new Object[]{
|
||||
new TreeNode((ITx)element, Type.PROPS),
|
||||
new TreeNode((ITx)element, Type.ATTRS),
|
||||
new TreeNode((ITx)element, Type.IN_REL),
|
||||
new TreeNode((ITx)element, Type.OUT_REL)
|
||||
};
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.jface.viewers.ITreeContentProvider#getChildren(java.lang.Object)
|
||||
*/
|
||||
@Override
|
||||
public Object[] getChildren(Object element) {
|
||||
if(element instanceof TreeNode){
|
||||
TreeNode propertyHolder=(TreeNode) element;
|
||||
if(propertyHolder.type == Type.PROPS){
|
||||
return new Object[][]{
|
||||
{Messages.TransactionDetails_1, Messages.TransactionDetails_16, propertyHolder.element.getStream().getFullName()},
|
||||
{Messages.TransactionDetails_2, Messages.TransactionDetails_16, propertyHolder.element.getGenerator().getName()},
|
||||
{Messages.TransactionDetails_19, Messages.TransactionDetails_20, timeToString(propertyHolder.element.getBeginTime())},
|
||||
{Messages.TransactionDetails_21, Messages.TransactionDetails_20, timeToString(propertyHolder.element.getEndTime())}
|
||||
};
|
||||
}else if(propertyHolder.type == Type.ATTRS || propertyHolder.type == Type.HIER)
|
||||
return propertyHolder.getAttributeListForHier();
|
||||
else if(propertyHolder.type == Type.IN_REL){
|
||||
Vector<Object[] > res = new Vector<>();
|
||||
for(ITxRelation rel:propertyHolder.element.getIncomingRelations()){
|
||||
res.add(new Object[]{
|
||||
rel.getRelationType(),
|
||||
rel.getSource().getGenerator().getName(),
|
||||
rel.getSource()});
|
||||
}
|
||||
return res.toArray();
|
||||
} else if(propertyHolder.type == Type.OUT_REL){
|
||||
Vector<Object[] > res = new Vector<>();
|
||||
for(ITxRelation rel:propertyHolder.element.getOutgoingRelations()){
|
||||
res.add(new Object[]{
|
||||
rel.getRelationType(),
|
||||
rel.getTarget().getGenerator().getName(),
|
||||
rel.getTarget()});
|
||||
}
|
||||
return res.toArray();
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.jface.viewers.ITreeContentProvider#getParent(java.lang.Object)
|
||||
*/
|
||||
@Override
|
||||
public Object getParent(Object element) {
|
||||
return null;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.jface.viewers.ITreeContentProvider#hasChildren(java.lang.Object)
|
||||
*/
|
||||
@Override
|
||||
public boolean hasChildren(Object element) {
|
||||
return getChildren(element)!=null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* The Class AttributeLabelProvider.
|
||||
*/
|
||||
class AttributeLabelProvider extends LabelProvider implements IStyledLabelProvider {
|
||||
|
||||
/** The field. */
|
||||
final int field;
|
||||
|
||||
/** The Constant NAME. */
|
||||
public static final int NAME=0;
|
||||
|
||||
/** The Constant TYPE. */
|
||||
public static final int TYPE=1;
|
||||
|
||||
/** The Constant VALUE. */
|
||||
public static final int VALUE=2;
|
||||
|
||||
/**
|
||||
* Instantiates a new attribute label provider.
|
||||
*
|
||||
* @param field the field
|
||||
*/
|
||||
public AttributeLabelProvider(int field) {
|
||||
this.field=field;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.jface.viewers.DelegatingStyledCellLabelProvider.IStyledLabelProvider#getStyledText(java.lang.Object)
|
||||
*/
|
||||
@Override
|
||||
public StyledString getStyledText(Object element) {
|
||||
switch(field){
|
||||
case NAME:
|
||||
if (element instanceof ITxAttribute) {
|
||||
ITxAttribute attribute = (ITxAttribute) element;
|
||||
String[] tokens = attribute.getName().split("\\.");
|
||||
return new StyledString(tokens[tokens.length-1]);
|
||||
}else if (element instanceof ITxRelation) {
|
||||
return new StyledString(Messages.TransactionDetails_4);
|
||||
}else if(element instanceof Object[]){
|
||||
Object[] elements = (Object[]) element;
|
||||
return new StyledString(elements[field].toString());
|
||||
} else
|
||||
return new StyledString(element.toString());
|
||||
case TYPE:
|
||||
if (element instanceof ITxAttribute) {
|
||||
ITxAttribute attribute = (ITxAttribute) element;
|
||||
return new StyledString(attribute.getDataType().toString());
|
||||
}else if(element instanceof Object[]){
|
||||
Object[] elements = (Object[]) element;
|
||||
return new StyledString(elements[field].toString());
|
||||
}else
|
||||
return new StyledString(""); //$NON-NLS-1$
|
||||
default:
|
||||
if (element instanceof ITxAttribute) {
|
||||
ITxAttribute attribute = (ITxAttribute) element;
|
||||
String value = attribute.getValue().toString();
|
||||
if((DataType.UNSIGNED == attribute.getDataType() || DataType.INTEGER==attribute.getDataType()) && !"0".equals(value)) {
|
||||
try {
|
||||
value += " [0x"+Long.toHexString(Long.parseLong(attribute.getValue().toString()))+"]";
|
||||
} catch(NumberFormatException e) { }
|
||||
}
|
||||
return new StyledString(value);
|
||||
}else if(element instanceof Object[]){
|
||||
Object[] elements = (Object[]) element;
|
||||
Object o = elements[field];
|
||||
if(o instanceof ITx) {
|
||||
ITx tx = (ITx)o;
|
||||
return new StyledString(txToString(tx)+" ("+tx.getStream().getFullName()+")");
|
||||
} else
|
||||
return new StyledString(o.toString());
|
||||
} else if(element instanceof ITx){
|
||||
return new StyledString(txToString((ITx) element));
|
||||
}else
|
||||
return new StyledString(""); //$NON-NLS-1$
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,85 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2015 MINRES Technologies GmbH and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* MINRES Technologies GmbH - initial API and implementation
|
||||
*******************************************************************************/
|
||||
package com.minres.scviewer.e4.application.preferences;
|
||||
|
||||
import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;
|
||||
import org.eclipse.core.runtime.preferences.DefaultScope;
|
||||
import org.eclipse.jface.preference.IPreferenceStore;
|
||||
import org.eclipse.jface.resource.StringConverter;
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.graphics.Color;
|
||||
import org.eclipse.wb.swt.SWTResourceManager;
|
||||
|
||||
import com.minres.scviewer.database.ui.WaveformColors;
|
||||
import com.opcoach.e4.preferences.ScopedPreferenceStore;
|
||||
|
||||
/**
|
||||
* The Class DefaultValuesInitializer.
|
||||
*/
|
||||
public class DefaultValuesInitializer extends AbstractPreferenceInitializer {
|
||||
|
||||
/** The default colors. */
|
||||
public final Color[] colors = new Color[WaveformColors.values().length];
|
||||
|
||||
/**
|
||||
* Instantiates a new default values initializer.
|
||||
*/
|
||||
public DefaultValuesInitializer() {
|
||||
colors[WaveformColors.LINE.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_RED);
|
||||
colors[WaveformColors.LINE_HIGHLITE.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_CYAN);
|
||||
colors[WaveformColors.TRACK_BG_EVEN.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_BLACK);
|
||||
colors[WaveformColors.TRACK_BG_ODD.ordinal()] = SWTResourceManager.getColor(40, 40, 40);
|
||||
colors[WaveformColors.TRACK_BG_HIGHLITE.ordinal()] = SWTResourceManager.getColor(40, 40, 80);
|
||||
colors[WaveformColors.TX_BG.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_GREEN);
|
||||
colors[WaveformColors.TX_BG_HIGHLITE.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_DARK_GREEN);
|
||||
colors[WaveformColors.TX_BORDER.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_RED);
|
||||
colors[WaveformColors.SIGNAL0.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_GREEN);
|
||||
colors[WaveformColors.SIGNAL1.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_GREEN);
|
||||
colors[WaveformColors.SIGNALZ.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_YELLOW);
|
||||
colors[WaveformColors.SIGNALX.ordinal()] = SWTResourceManager.getColor(255, 51, 51);
|
||||
colors[WaveformColors.SIGNALU.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_DARK_YELLOW);
|
||||
colors[WaveformColors.SIGNAL_REAL.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_YELLOW);
|
||||
colors[WaveformColors.SIGNAL_NAN.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_RED);
|
||||
colors[WaveformColors.SIGNAL_TEXT.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_WHITE);
|
||||
colors[WaveformColors.SIGNAL_REAL.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_YELLOW);
|
||||
colors[WaveformColors.CURSOR.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_RED);
|
||||
colors[WaveformColors.CURSOR_DRAG.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_GRAY);
|
||||
colors[WaveformColors.CURSOR_TEXT.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_WHITE);
|
||||
colors[WaveformColors.MARKER.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_DARK_GRAY);
|
||||
colors[WaveformColors.MARKER_TEXT.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_WHITE);
|
||||
colors[WaveformColors.REL_ARROW.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_MAGENTA);
|
||||
colors[WaveformColors.REL_ARROW_HIGHLITE.ordinal()] = SWTResourceManager.getColor(255, 128, 255);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer#initializeDefaultPreferences()
|
||||
*/
|
||||
@Override
|
||||
public void initializeDefaultPreferences() {
|
||||
// IEclipsePreferences node = DefaultScope.INSTANCE.getNode(PreferenceConstants.PREFERENCES_SCOPE);
|
||||
// if (node != null)
|
||||
// {
|
||||
// node.putBoolean(PreferenceConstants.DATABASE_RELOAD, true);
|
||||
// node.putBoolean(PreferenceConstants.SHOW_HOVER, true);
|
||||
// for (WaveformColors c : WaveformColors.values()) {
|
||||
// node.put(c.name()+"_COLOR", StringConverter.asString(colors[c.ordinal()].getRGB())); //$NON-NLS-1$
|
||||
// }
|
||||
// }
|
||||
IPreferenceStore store = new ScopedPreferenceStore(DefaultScope.INSTANCE, PreferenceConstants.PREFERENCES_SCOPE);
|
||||
|
||||
store.setDefault(PreferenceConstants.DATABASE_RELOAD, true);
|
||||
store.setDefault(PreferenceConstants.SHOW_HOVER, true);
|
||||
for (WaveformColors c : WaveformColors.values()) {
|
||||
store.setDefault(c.name()+"_COLOR", StringConverter.asString(colors[c.ordinal()].getRGB())); //$NON-NLS-1$
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,82 @@
|
||||
/*******************************************************************************
|
||||
* 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 DATABASE_RELOAD. */
|
||||
public static final String SHOW_HOVER="showWaveformHover"; //$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$
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
package com.minres.scviewer.e4.application.preferences;
|
||||
import org.eclipse.core.runtime.preferences.ConfigurationScope;
|
||||
import org.eclipse.jface.preference.IPreferenceStore;
|
||||
|
||||
import com.opcoach.e4.preferences.IPreferenceStoreProvider;
|
||||
import com.opcoach.e4.preferences.ScopedPreferenceStore;
|
||||
|
||||
public class PreferencesStoreProvider implements IPreferenceStoreProvider{
|
||||
|
||||
public PreferencesStoreProvider(){
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPreferenceStore getPreferenceStore() {
|
||||
return new ScopedPreferenceStore(ConfigurationScope.INSTANCE, PreferenceConstants.PREFERENCES_SCOPE);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,44 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2015 MINRES Technologies GmbH and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* MINRES Technologies GmbH - initial API and implementation
|
||||
*******************************************************************************/
|
||||
package com.minres.scviewer.e4.application.preferences;
|
||||
|
||||
import org.eclipse.jface.preference.BooleanFieldEditor;
|
||||
import org.eclipse.jface.preference.FieldEditorPreferencePage;
|
||||
|
||||
import com.minres.scviewer.e4.application.Messages;
|
||||
|
||||
|
||||
/**
|
||||
* The Class SCViewerPreferencesPage showing the SCViewer top preferences.
|
||||
*/
|
||||
public class SCViewerPreferencesPage extends FieldEditorPreferencePage {
|
||||
|
||||
/**
|
||||
* Instantiates a new SC viewer preferences page.
|
||||
*/
|
||||
public SCViewerPreferencesPage() {
|
||||
super(GRID);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.jface.preference.FieldEditorPreferencePage#createFieldEditors()
|
||||
*/
|
||||
@Override
|
||||
protected void createFieldEditors() {
|
||||
|
||||
addField(new BooleanFieldEditor(PreferenceConstants.DATABASE_RELOAD, Messages.SCViewerPreferencesPage_0,
|
||||
getFieldEditorParent()));
|
||||
addField(new BooleanFieldEditor(PreferenceConstants.SHOW_HOVER, Messages.SCViewerPreferencesPage_1,
|
||||
getFieldEditorParent()));
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,43 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2015 MINRES Technologies GmbH and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* MINRES Technologies GmbH - initial API and implementation
|
||||
*******************************************************************************/
|
||||
package com.minres.scviewer.e4.application.preferences;
|
||||
|
||||
import org.eclipse.jface.preference.ColorFieldEditor;
|
||||
import org.eclipse.jface.preference.FieldEditorPreferencePage;
|
||||
|
||||
import com.minres.scviewer.database.ui.WaveformColors;
|
||||
import com.minres.scviewer.e4.application.Messages;
|
||||
|
||||
/**
|
||||
* The WaveformView preference page to show the colors to use.
|
||||
*/
|
||||
public class WaveformPreferencesPage extends FieldEditorPreferencePage {
|
||||
|
||||
/**
|
||||
* Instantiates a new waveform preferences page.
|
||||
*/
|
||||
public WaveformPreferencesPage() {
|
||||
super(GRID);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.jface.preference.FieldEditorPreferencePage#createFieldEditors()
|
||||
*/
|
||||
@Override
|
||||
protected void createFieldEditors() {
|
||||
|
||||
for (WaveformColors c : WaveformColors.values()) {
|
||||
addField(new ColorFieldEditor(c.name() + "_COLOR", Messages.WaveformPreferencesPage_1 + c.name().toLowerCase(), //$NON-NLS-1$
|
||||
getFieldEditorParent()));
|
||||
}
|
||||
}
|
||||
|
||||
}
|