From 694423be3b0a52779aafce488dc87a4467078146 Mon Sep 17 00:00:00 2001 From: Eyck Jentzsch Date: Thu, 11 Oct 2018 14:54:47 +0200 Subject: [PATCH] [WIP] extended application to configure waveform display --- .../Application.e4xmi | 3 +- .../META-INF/MANIFEST.MF | 56 ++++++++-------- ....java => NavigateToolbarContribution.java} | 2 +- .../WaveformPopupMenuContribution.java | 67 +++++++++++++++++++ .../preferences/DefaultValuesInitializer.java | 1 + 5 files changed, 99 insertions(+), 30 deletions(-) rename com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/elements/{NavigateContribution.java => NavigateToolbarContribution.java} (98%) create mode 100644 com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/elements/WaveformPopupMenuContribution.java diff --git a/com.minres.scviewer.e4.application/Application.e4xmi b/com.minres.scviewer.e4.application/Application.e4xmi index 35149e6..6035d3a 100644 --- a/com.minres.scviewer.e4.application/Application.e4xmi +++ b/com.minres.scviewer.e4.application/Application.e4xmi @@ -108,7 +108,7 @@ - + @@ -204,6 +204,7 @@ + diff --git a/com.minres.scviewer.e4.application/META-INF/MANIFEST.MF b/com.minres.scviewer.e4.application/META-INF/MANIFEST.MF index 93b5bc6..ccd278f 100644 --- a/com.minres.scviewer.e4.application/META-INF/MANIFEST.MF +++ b/com.minres.scviewer.e4.application/META-INF/MANIFEST.MF @@ -5,33 +5,33 @@ Bundle-SymbolicName: com.minres.scviewer.e4.application;singleton:=true Bundle-Version: 1.1.1.qualifier Bundle-Vendor: %Bundle-Vendor Require-Bundle: javax.inject;bundle-version="1.0.0", - org.eclipse.core.runtime;bundle-version="3.11.1", - org.eclipse.swt;bundle-version="3.104.1", - org.eclipse.e4.ui.model.workbench;bundle-version="1.1.100", - org.eclipse.jface;bundle-version="3.11.0", - org.eclipse.e4.ui.services;bundle-version="1.2.0", - org.eclipse.e4.ui.workbench;bundle-version="1.3.0", - org.eclipse.e4.core.di;bundle-version="1.5.0", - org.eclipse.e4.ui.di;bundle-version="1.1.0", - org.eclipse.e4.core.contexts;bundle-version="1.4.0", - com.minres.scviewer.database.ui.swt;bundle-version="1.0.0", - com.minres.scviewer.database.ui, - com.minres.scviewer.database;bundle-version="1.0.0", - org.eclipse.equinox.ds;bundle-version="1.4.300", - org.eclipse.equinox.util;bundle-version="1.0.500", - org.eclipse.osgi.services;bundle-version="3.5.0", - org.eclipse.e4.core.services;bundle-version="2.0.0", - org.eclipse.osgi.services;bundle-version="3.5.0", - org.eclipse.core.jobs, - org.eclipse.osgi, - com.google.guava, - org.eclipse.equinox.preferences, - org.eclipse.core.expressions, - org.eclipse.e4.core.commands;bundle-version="0.11.0", - org.eclipse.e4.ui.workbench.addons.swt, - com.opcoach.e4.preferences, - org.eclipse.e4.core.di.extensions, - org.eclipse.e4.ui.css.swt.theme;bundle-version="0.10.0" + org.eclipse.core.runtime;bundle-version="3.11.1", + org.eclipse.swt;bundle-version="3.104.1", + org.eclipse.e4.ui.model.workbench;bundle-version="1.1.100", + org.eclipse.jface;bundle-version="3.11.0", + org.eclipse.e4.ui.services;bundle-version="1.2.0", + org.eclipse.e4.ui.workbench;bundle-version="1.3.0", + org.eclipse.e4.core.di;bundle-version="1.5.0", + org.eclipse.e4.ui.di;bundle-version="1.1.0", + org.eclipse.e4.core.contexts;bundle-version="1.4.0", + com.minres.scviewer.database.ui.swt;bundle-version="1.0.0", + com.minres.scviewer.database.ui, + com.minres.scviewer.database;bundle-version="1.0.0", + org.eclipse.equinox.ds;bundle-version="1.4.300", + org.eclipse.equinox.util;bundle-version="1.0.500", + org.eclipse.osgi.services;bundle-version="3.5.0", + org.eclipse.e4.core.services;bundle-version="2.0.0", + org.eclipse.osgi.services;bundle-version="3.5.0", + org.eclipse.core.jobs, + org.eclipse.osgi, + com.google.guava, + org.eclipse.equinox.preferences, + org.eclipse.core.expressions, + org.eclipse.e4.core.commands;bundle-version="0.11.0", + org.eclipse.e4.ui.workbench.addons.swt, + com.opcoach.e4.preferences, + org.eclipse.e4.core.di.extensions, + org.eclipse.e4.ui.css.swt.theme;bundle-version="0.10.0" Bundle-RequiredExecutionEnvironment: JavaSE-1.8 Import-Package: com.minres.scviewer.database, - javax.inject;version="1.0.0" + javax.inject;version="1.0.0" diff --git a/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/elements/NavigateContribution.java b/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/elements/NavigateToolbarContribution.java similarity index 98% rename from com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/elements/NavigateContribution.java rename to com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/elements/NavigateToolbarContribution.java index cc61765..fc8db23 100644 --- a/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/elements/NavigateContribution.java +++ b/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/elements/NavigateToolbarContribution.java @@ -32,7 +32,7 @@ import com.minres.scviewer.e4.application.parts.WaveformViewer; /** * The Class NavigateContribution. Currently not used in Application.e4xmi */ -public class NavigateContribution { +public class NavigateToolbarContribution { /** The part service. */ @Inject EPartService partService; diff --git a/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/elements/WaveformPopupMenuContribution.java b/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/elements/WaveformPopupMenuContribution.java new file mode 100644 index 0000000..d5d9193 --- /dev/null +++ b/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/elements/WaveformPopupMenuContribution.java @@ -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 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 items) { + + } + +} \ No newline at end of file diff --git a/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/preferences/DefaultValuesInitializer.java b/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/preferences/DefaultValuesInitializer.java index 2851277..17afd9b 100644 --- a/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/preferences/DefaultValuesInitializer.java +++ b/com.minres.scviewer.e4.application/src/com/minres/scviewer/e4/application/preferences/DefaultValuesInitializer.java @@ -49,6 +49,7 @@ public class DefaultValuesInitializer extends AbstractPreferenceInitializer { 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);