[WIP] extended application to configure waveform display

This commit is contained in:
Eyck Jentzsch 2018-10-11 14:54:47 +02:00
parent 0634b9cfd5
commit 694423be3b
5 changed files with 99 additions and 30 deletions

View File

@ -108,7 +108,7 @@
<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"/> <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>
<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: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" enabled="false"> <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"> <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"/> <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> </menu>
@ -204,6 +204,7 @@
<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"> <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"/> <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>
<children xsi:type="menu:DynamicMenuContribution" xmi:id="_KYI1EMxxEeiQc8UNpkcyEA" elementId="com.minres.scviewer.e4.application.dynamicmenucontribution.0" label="View as..." contributionURI="bundleclass://com.minres.scviewer.e4.application/com.minres.scviewer.e4.application.elements.WaveformPopupMenuContribution"/>
</menus> </menus>
</descriptors> </descriptors>
<commands xmi:id="_95PfvHNmEeWBq8z1Dv39LA" elementId="org.eclipse.ui.file.exit" commandName="quitCommand"/> <commands xmi:id="_95PfvHNmEeWBq8z1Dv39LA" elementId="org.eclipse.ui.file.exit" commandName="quitCommand"/>

View File

@ -5,33 +5,33 @@ Bundle-SymbolicName: com.minres.scviewer.e4.application;singleton:=true
Bundle-Version: 1.1.1.qualifier Bundle-Version: 1.1.1.qualifier
Bundle-Vendor: %Bundle-Vendor Bundle-Vendor: %Bundle-Vendor
Require-Bundle: javax.inject;bundle-version="1.0.0", Require-Bundle: javax.inject;bundle-version="1.0.0",
org.eclipse.core.runtime;bundle-version="3.11.1", org.eclipse.core.runtime;bundle-version="3.11.1",
org.eclipse.swt;bundle-version="3.104.1", org.eclipse.swt;bundle-version="3.104.1",
org.eclipse.e4.ui.model.workbench;bundle-version="1.1.100", org.eclipse.e4.ui.model.workbench;bundle-version="1.1.100",
org.eclipse.jface;bundle-version="3.11.0", org.eclipse.jface;bundle-version="3.11.0",
org.eclipse.e4.ui.services;bundle-version="1.2.0", org.eclipse.e4.ui.services;bundle-version="1.2.0",
org.eclipse.e4.ui.workbench;bundle-version="1.3.0", org.eclipse.e4.ui.workbench;bundle-version="1.3.0",
org.eclipse.e4.core.di;bundle-version="1.5.0", org.eclipse.e4.core.di;bundle-version="1.5.0",
org.eclipse.e4.ui.di;bundle-version="1.1.0", org.eclipse.e4.ui.di;bundle-version="1.1.0",
org.eclipse.e4.core.contexts;bundle-version="1.4.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.swt;bundle-version="1.0.0",
com.minres.scviewer.database.ui, com.minres.scviewer.database.ui,
com.minres.scviewer.database;bundle-version="1.0.0", com.minres.scviewer.database;bundle-version="1.0.0",
org.eclipse.equinox.ds;bundle-version="1.4.300", org.eclipse.equinox.ds;bundle-version="1.4.300",
org.eclipse.equinox.util;bundle-version="1.0.500", org.eclipse.equinox.util;bundle-version="1.0.500",
org.eclipse.osgi.services;bundle-version="3.5.0", org.eclipse.osgi.services;bundle-version="3.5.0",
org.eclipse.e4.core.services;bundle-version="2.0.0", org.eclipse.e4.core.services;bundle-version="2.0.0",
org.eclipse.osgi.services;bundle-version="3.5.0", org.eclipse.osgi.services;bundle-version="3.5.0",
org.eclipse.core.jobs, org.eclipse.core.jobs,
org.eclipse.osgi, org.eclipse.osgi,
com.google.guava, com.google.guava,
org.eclipse.equinox.preferences, org.eclipse.equinox.preferences,
org.eclipse.core.expressions, org.eclipse.core.expressions,
org.eclipse.e4.core.commands;bundle-version="0.11.0", org.eclipse.e4.core.commands;bundle-version="0.11.0",
org.eclipse.e4.ui.workbench.addons.swt, org.eclipse.e4.ui.workbench.addons.swt,
com.opcoach.e4.preferences, com.opcoach.e4.preferences,
org.eclipse.e4.core.di.extensions, org.eclipse.e4.core.di.extensions,
org.eclipse.e4.ui.css.swt.theme;bundle-version="0.10.0" org.eclipse.e4.ui.css.swt.theme;bundle-version="0.10.0"
Bundle-RequiredExecutionEnvironment: JavaSE-1.8 Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Import-Package: com.minres.scviewer.database, Import-Package: com.minres.scviewer.database,
javax.inject;version="1.0.0" javax.inject;version="1.0.0"

View File

@ -32,7 +32,7 @@ import com.minres.scviewer.e4.application.parts.WaveformViewer;
/** /**
* The Class NavigateContribution. Currently not used in Application.e4xmi * The Class NavigateContribution. Currently not used in Application.e4xmi
*/ */
public class NavigateContribution { public class NavigateToolbarContribution {
/** The part service. */ /** The part service. */
@Inject EPartService partService; @Inject EPartService partService;

View File

@ -0,0 +1,67 @@
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.di.AboutToHide;
import org.eclipse.e4.ui.model.application.ui.basic.MPart;
import org.eclipse.e4.ui.model.application.ui.menu.MDirectMenuItem;
import org.eclipse.e4.ui.model.application.ui.menu.MMenuElement;
import org.eclipse.e4.ui.model.application.ui.menu.MMenuFactory;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import com.minres.scviewer.database.ISignal;
import com.minres.scviewer.database.ISignalChange;
import com.minres.scviewer.database.ISignalChangeBit;
import com.minres.scviewer.database.ISignalChangeBitVector;
import com.minres.scviewer.database.ISignalChangeReal;
import com.minres.scviewer.database.ui.GotoDirection;
import com.minres.scviewer.e4.application.parts.WaveformViewer;
public class WaveformPopupMenuContribution {
int counter=0;
@Inject MPart activePart;
@AboutToShow
public void aboutToShow(List<MMenuElement> items) {
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<?>) {
ISignalChange s = (ISignalChange) ((ISignal<?>) selected).getEvents().firstEntry().getValue();
if(s instanceof ISignalChangeReal) {
MDirectMenuItem mdi = MMenuFactory.INSTANCE.createDirectMenuItem();
mdi.setLabel("Analog linear");
items.add(mdi);
mdi = MMenuFactory.INSTANCE.createDirectMenuItem();
mdi.setLabel("Analog step");
items.add(mdi);
} else if(s instanceof ISignalChangeBitVector) {
MDirectMenuItem mdi = MMenuFactory.INSTANCE.createDirectMenuItem();
mdi.setLabel("Analog linear");
items.add(mdi);
mdi = MMenuFactory.INSTANCE.createDirectMenuItem();
mdi.setLabel("Analog step");
items.add(mdi);
}
}
}
}
}
@AboutToHide
public void aboutToHide(List<MMenuElement> items) {
}
}

View File

@ -49,6 +49,7 @@ public class DefaultValuesInitializer extends AbstractPreferenceInitializer {
colors[WaveformColors.SIGNAL_REAL.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_YELLOW); colors[WaveformColors.SIGNAL_REAL.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_YELLOW);
colors[WaveformColors.SIGNAL_NAN.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_RED); colors[WaveformColors.SIGNAL_NAN.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_RED);
colors[WaveformColors.SIGNAL_TEXT.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_WHITE); 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.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_RED);
colors[WaveformColors.CURSOR_DRAG.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_GRAY); colors[WaveformColors.CURSOR_DRAG.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_GRAY);
colors[WaveformColors.CURSOR_TEXT.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_WHITE); colors[WaveformColors.CURSOR_TEXT.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_WHITE);