adds blank entry for waveform viewer
This commit is contained in:
parent
a18f72c43f
commit
52232bb0db
@ -1,7 +1,6 @@
|
||||
package com.minres.scviewer.database.fst;
|
||||
|
||||
import com.sun.jna.Native;
|
||||
import com.sun.jna.Platform;
|
||||
import com.sun.jna.Pointer;
|
||||
import com.sun.jna.Structure;
|
||||
import com.sun.jna.Structure.FieldOrder;
|
||||
|
@ -33,7 +33,6 @@ import com.minres.scviewer.database.AssociationType;
|
||||
import com.minres.scviewer.database.DataType;
|
||||
import com.minres.scviewer.database.EventKind;
|
||||
import com.minres.scviewer.database.IWaveform;
|
||||
import com.minres.scviewer.database.IWaveformDb;
|
||||
import com.minres.scviewer.database.IWaveformDbLoader;
|
||||
import com.minres.scviewer.database.InputFormatException;
|
||||
import com.minres.scviewer.database.RelationType;
|
||||
|
@ -46,7 +46,6 @@ import com.minres.scviewer.database.AssociationType;
|
||||
import com.minres.scviewer.database.DataType;
|
||||
import com.minres.scviewer.database.EventKind;
|
||||
import com.minres.scviewer.database.IWaveform;
|
||||
import com.minres.scviewer.database.IWaveformDb;
|
||||
import com.minres.scviewer.database.IWaveformDbLoader;
|
||||
import com.minres.scviewer.database.InputFormatException;
|
||||
import com.minres.scviewer.database.RelationType;
|
||||
|
@ -0,0 +1,21 @@
|
||||
package com.minres.scviewer.database.ui;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.minres.scviewer.database.BlankWaveform;
|
||||
|
||||
public class TrackEntryGroup extends TrackEntry {
|
||||
|
||||
public List<TrackEntry> waveforms = new ArrayList<>();
|
||||
|
||||
public Boolean is_open = true;
|
||||
|
||||
public TrackEntryGroup(TrackEntry[] waveform, IWaveformStyleProvider styleProvider) {
|
||||
super(new BlankWaveform(), styleProvider);
|
||||
for (TrackEntry iWaveform : waveform) {
|
||||
waveforms.add(iWaveform);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -16,5 +16,5 @@ public enum WaveformColors {
|
||||
TX_BG, TX_BG_HIGHLITE, TX_BORDER,
|
||||
SIGNAL0, SIGNAL1, SIGNALZ, SIGNALX, SIGNALU, SIGNAL_TEXT, SIGNAL_REAL, SIGNAL_NAN,
|
||||
CURSOR, CURSOR_DRAG, CURSOR_TEXT,
|
||||
MARKER, MARKER_TEXT, REL_ARROW, REL_ARROW_HIGHLITE
|
||||
MARKER, MARKER_TEXT, REL_ARROW, REL_ARROW_HIGHLITE, BLANK
|
||||
}
|
@ -49,6 +49,7 @@ public class DefaultWaveformStyleProvider implements IWaveformStyleProvider {
|
||||
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);
|
||||
colors[WaveformColors.BLANK.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_DARK_RED);
|
||||
}
|
||||
/**
|
||||
* needs redraw() afterwards
|
||||
|
@ -0,0 +1,45 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2015-2021 MINRES Technologies GmbH and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Eclipse Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/epl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* MINRES Technologies GmbH - initial API and implementation
|
||||
*******************************************************************************/
|
||||
package com.minres.scviewer.database.ui.swt.internal;
|
||||
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.graphics.Rectangle;
|
||||
|
||||
import com.minres.scviewer.database.ui.TrackEntry;
|
||||
import com.minres.scviewer.database.ui.WaveformColors;
|
||||
|
||||
public class BlankPainter extends TrackPainter {
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private final WaveformCanvas waveCanvas;
|
||||
|
||||
public BlankPainter(WaveformCanvas txDisplay, boolean even, TrackEntry trackEntry) {
|
||||
super(trackEntry, even);
|
||||
this.waveCanvas = txDisplay;
|
||||
}
|
||||
|
||||
public void paintArea(Projection proj, Rectangle area) {
|
||||
if (trackEntry.selected)
|
||||
proj.setBackground(this.waveCanvas.styleProvider.getColor(WaveformColors.TRACK_BG_HIGHLITE));
|
||||
else
|
||||
proj.setBackground(this.waveCanvas.styleProvider.getColor(even ? WaveformColors.TRACK_BG_EVEN : WaveformColors.TRACK_BG_ODD));
|
||||
proj.setFillRule(SWT.FILL_EVEN_ODD);
|
||||
proj.fillRectangle(area);
|
||||
int trackHeight=trackEntry.height;
|
||||
int txBase=trackHeight*2/5;
|
||||
int txHeight=trackHeight/5;
|
||||
Rectangle bb = new Rectangle(area.x, area.y+txBase, area.width, txHeight);
|
||||
proj.setBackground(this.waveCanvas.styleProvider.getColor(WaveformColors.BLANK));
|
||||
proj.fillRectangle(bb);
|
||||
|
||||
}
|
||||
}
|
@ -47,7 +47,6 @@ import org.eclipse.swt.dnd.Transfer;
|
||||
import org.eclipse.swt.events.ControlAdapter;
|
||||
import org.eclipse.swt.events.ControlEvent;
|
||||
import org.eclipse.swt.events.DisposeListener;
|
||||
import org.eclipse.swt.events.MouseAdapter;
|
||||
import org.eclipse.swt.events.MouseEvent;
|
||||
import org.eclipse.swt.events.MouseListener;
|
||||
import org.eclipse.swt.events.PaintEvent;
|
||||
@ -91,6 +90,7 @@ import com.minres.scviewer.database.ui.IWaveformStyleProvider;
|
||||
import com.minres.scviewer.database.ui.IWaveformView;
|
||||
import com.minres.scviewer.database.ui.IWaveformZoom;
|
||||
import com.minres.scviewer.database.ui.TrackEntry;
|
||||
import com.minres.scviewer.database.ui.TrackEntryGroup;
|
||||
import com.minres.scviewer.database.ui.swt.internal.slider.ZoomBar;
|
||||
|
||||
public class WaveformView implements IWaveformView {
|
||||
@ -137,7 +137,7 @@ public class WaveformView implements IWaveformView {
|
||||
|
||||
protected TrackEntry lastClickedEntry;
|
||||
|
||||
protected MouseListener nameValueMouseListener = new MouseAdapter() {
|
||||
protected MouseListener nameValueMouseListener = new MouseListener() {
|
||||
|
||||
@Override
|
||||
public void mouseDown(MouseEvent e) {
|
||||
@ -173,6 +173,10 @@ public class WaveformView implements IWaveformView {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseDoubleClick(MouseEvent e) {
|
||||
}
|
||||
};
|
||||
|
||||
class WaveformMouseListener implements PaintListener, Listener {
|
||||
@ -551,29 +555,30 @@ public class WaveformView implements IWaveformView {
|
||||
public void update() {
|
||||
tracksVerticalHeight = 0;
|
||||
int nameMaxWidth = 0;
|
||||
IWaveformPainter painter = null;
|
||||
trackVerticalOffset.clear();
|
||||
waveformCanvas.clearAllWaveformPainter(false);
|
||||
boolean even = true;
|
||||
TextLayout tl = new TextLayout(waveformCanvas.getDisplay());
|
||||
tl.setFont(styleProvider.getNameFont());
|
||||
for (TrackEntry streamEntry : streams) {
|
||||
streamEntry.height = styleProvider.getTrackHeight();
|
||||
streamEntry.vOffset = tracksVerticalHeight;
|
||||
if (streamEntry.waveform.getType() == WaveformType.TRANSACTION) {
|
||||
streamEntry.currentValue = "";
|
||||
streamEntry.height *= streamEntry.waveform.getRowCount();
|
||||
painter = new StreamPainter(waveformCanvas, even, streamEntry);
|
||||
} else if (streamEntry.waveform.getType() == WaveformType.SIGNAL) {
|
||||
streamEntry.currentValue = "---";
|
||||
painter = new SignalPainter(waveformCanvas, even, streamEntry);
|
||||
if(streamEntry instanceof TrackEntryGroup && ((TrackEntryGroup)streamEntry).is_open) {
|
||||
TrackEntryGroup streamEntryGroup = (TrackEntryGroup)streamEntry;
|
||||
for (TrackEntry trackEntry : streamEntryGroup.waveforms) {
|
||||
addPainter(even, trackEntry);
|
||||
trackVerticalOffset.put(tracksVerticalHeight, trackEntry);
|
||||
tl.setText(trackEntry.waveform.getFullName());
|
||||
nameMaxWidth = Math.max(nameMaxWidth, tl.getBounds().width);
|
||||
tracksVerticalHeight += trackEntry.height;
|
||||
even = !even;
|
||||
}
|
||||
} else {
|
||||
addPainter(even, streamEntry);
|
||||
trackVerticalOffset.put(tracksVerticalHeight, streamEntry);
|
||||
tl.setText(streamEntry.waveform.getFullName());
|
||||
nameMaxWidth = Math.max(nameMaxWidth, tl.getBounds().width);
|
||||
tracksVerticalHeight += streamEntry.height;
|
||||
even = !even;
|
||||
}
|
||||
waveformCanvas.addWaveformPainter(painter, false);
|
||||
trackVerticalOffset.put(tracksVerticalHeight, streamEntry);
|
||||
tl.setText(streamEntry.waveform.getFullName());
|
||||
nameMaxWidth = Math.max(nameMaxWidth, tl.getBounds().width);
|
||||
tracksVerticalHeight += streamEntry.height;
|
||||
even = !even;
|
||||
}
|
||||
waveformCanvas.syncSb();
|
||||
nameList.setSize(nameMaxWidth + 15, tracksVerticalHeight);
|
||||
@ -588,6 +593,23 @@ public class WaveformView implements IWaveformView {
|
||||
tl.dispose();
|
||||
}
|
||||
|
||||
private void addPainter(boolean even, TrackEntry streamEntry) {
|
||||
streamEntry.height = styleProvider.getTrackHeight();
|
||||
streamEntry.vOffset = tracksVerticalHeight;
|
||||
if (streamEntry.waveform.getType() == WaveformType.TRANSACTION) {
|
||||
streamEntry.currentValue = "";
|
||||
streamEntry.height *= streamEntry.waveform.getRowCount();
|
||||
IWaveformPainter painter = new StreamPainter(waveformCanvas, even, streamEntry);
|
||||
waveformCanvas.addWaveformPainter(painter, false);
|
||||
} else if (streamEntry.waveform.getType() == WaveformType.SIGNAL) {
|
||||
streamEntry.currentValue = "---";
|
||||
waveformCanvas.addWaveformPainter(new SignalPainter(waveformCanvas, even, streamEntry), false);
|
||||
} else if (streamEntry.waveform.getType() == WaveformType.BLANK) {
|
||||
streamEntry.currentValue = "";
|
||||
waveformCanvas.addWaveformPainter(new BlankPainter(waveformCanvas, even, streamEntry), false);
|
||||
}
|
||||
}
|
||||
|
||||
private int calculateValueWidth() {
|
||||
TextLayout tl = new TextLayout(waveformCanvas.getDisplay());
|
||||
tl.setFont(styleProvider.getNameFontHighlite());
|
||||
|
@ -28,7 +28,6 @@ import com.minres.scviewer.database.BitVector;
|
||||
import com.minres.scviewer.database.DoubleVal;
|
||||
import com.minres.scviewer.database.IEventList;
|
||||
import com.minres.scviewer.database.IWaveform;
|
||||
import com.minres.scviewer.database.IWaveformDb;
|
||||
import com.minres.scviewer.database.IWaveformDbLoader;
|
||||
import com.minres.scviewer.database.InputFormatException;
|
||||
import com.minres.scviewer.database.RelationType;
|
||||
|
@ -0,0 +1,104 @@
|
||||
package com.minres.scviewer.database;
|
||||
|
||||
import java.beans.PropertyChangeListener;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class BlankWaveform implements IWaveform {
|
||||
|
||||
@Override
|
||||
public void addPropertyChangeListener(PropertyChangeListener l) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removePropertyChangeListener(PropertyChangeListener l) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFullName() {
|
||||
return "";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setName(String name) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setParent(IHierNode parent) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public IHierNode getParent() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<IHierNode> getChildNodes() {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addChild(IHierNode child) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public IDerivedWaveform deriveWaveform() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(IHierNode o) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getId() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSame(IWaveform other) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IEventList getEvents() {
|
||||
return new EventList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IEvent[] getEventsAtTime(long time) {
|
||||
return new IEvent[0];
|
||||
}
|
||||
|
||||
@Override
|
||||
public IEvent[] getEventsBeforeTime(long time) {
|
||||
return new IEvent[0];
|
||||
}
|
||||
|
||||
@Override
|
||||
public WaveformType getType() {
|
||||
return WaveformType.BLANK;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getKind() {
|
||||
return "BLANK";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRowCount() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getWidth() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
@ -20,5 +20,7 @@ public enum WaveformType {
|
||||
/** The transaction. */
|
||||
TRANSACTION,
|
||||
/** The filter. */
|
||||
FILTER
|
||||
FILTER,
|
||||
/** The blank line. */
|
||||
BLANK
|
||||
}
|
||||
|
@ -117,6 +117,7 @@
|
||||
<handlers xmi:id="_ru2NIEYEEeyPM8G0E2EYww" elementId="com.minres.scviewer.e4.application.handler.help" contributionURI="bundleclass://com.minres.scviewer.e4.application/com.minres.scviewer.e4.application.handlers.HelpHandler" command="_lqjIYEYEEeyPM8G0E2EYww"/>
|
||||
<handlers xmi:id="_TwU0IEYoEeyKK_icsY7Xjg" elementId="com.minres.scviewer.e4.application.handler.enabletxdetails" contributionURI="bundleclass://com.minres.scviewer.e4.application/com.minres.scviewer.e4.application.handlers.EnableTxDetails" command="_Fj1gQEYoEeyKK_icsY7Xjg"/>
|
||||
<handlers xmi:id="_htyxgHCOEeyub8CfGE1sGA" elementId="com.minres.scviewer.e4.application.handler.helpContent" contributionURI="bundleclass://com.minres.scviewer.e4.application/com.minres.scviewer.e4.application.handlers.HelpContentsHandler" command="_RdUMoHCOEeyub8CfGE1sGA"/>
|
||||
<handlers xmi:id="__Ozu4LcxEe294PIiYLxpfA" elementId="com.minres.scviewer.e4.application.handler.add_blank" contributionURI="bundleclass://com.minres.scviewer.e4.application/com.minres.scviewer.e4.application.handlers.AddBlankWaveformHandler" command="_vYAOQLcxEe294PIiYLxpfA"/>
|
||||
<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>
|
||||
@ -200,6 +201,13 @@
|
||||
<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="_cxgs4Lc0Ee294PIiYLxpfA" elementId="com.minres.scviewer.e4.application.menuseparator.1"/>
|
||||
<children xsi:type="menu:HandledMenuItem" xmi:id="_NFfK0LcyEe294PIiYLxpfA" elementId="com.minres.scviewer.e4.application.handledmenuitem.add_blank" label="Add blank above" command="_vYAOQLcxEe294PIiYLxpfA">
|
||||
<parameters xmi:id="_or7iYLcyEe294PIiYLxpfA" elementId="com.minres.scviewer.e4.application.parameter.15" name="com.minres.scviewer.e4.application.commandparameter.add_blank" value="before"/>
|
||||
</children>
|
||||
<children xsi:type="menu:HandledMenuItem" xmi:id="_ecbWkLc0Ee294PIiYLxpfA" elementId="com.minres.scviewer.e4.application.handledmenuitem.add_blank" visible="false" label="Add blank below" enabled="false" command="_vYAOQLcxEe294PIiYLxpfA">
|
||||
<parameters xmi:id="_ecbWkbc0Ee294PIiYLxpfA" elementId="com.minres.scviewer.e4.application.parameter.15" name="com.minres.scviewer.e4.application.commandparameter.add_blank" value="after"/>
|
||||
</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"/>
|
||||
@ -278,6 +286,9 @@
|
||||
<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="_vYAOQLcxEe294PIiYLxpfA" elementId="com.minres.scviewer.e4.application.command.add_blank" commandName="Add Blank Waveform">
|
||||
<parameters xmi:id="_g_HnsLcyEe294PIiYLxpfA" elementId="com.minres.scviewer.e4.application.commandparameter.add_blank" name="where"/>
|
||||
</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"/>
|
||||
|
@ -84,6 +84,11 @@ public class Messages extends NLS {
|
||||
public static String cursor;
|
||||
public static String cursor_drag;
|
||||
public static String cursor_text;
|
||||
public static String marker;
|
||||
public static String marker_text;
|
||||
public static String rel_arrow;
|
||||
public static String rel_arrow_highlite;
|
||||
public static String blank;
|
||||
public static String HelpBrowser_0;
|
||||
public static String HelpBrowser_1;
|
||||
public static String HelpBrowser_2;
|
||||
@ -92,10 +97,6 @@ public class Messages extends NLS {
|
||||
public static String HelpBrowser_5;
|
||||
public static String HelpBrowser_7;
|
||||
public static String HelpBrowser_8;
|
||||
public static String marker;
|
||||
public static String marker_text;
|
||||
public static String rel_arrow;
|
||||
public static String rel_arrow_highlite;
|
||||
public static String UpdateHandler_URI;
|
||||
public static String UpdateHandler_10;
|
||||
public static String UpdateHandler_11;
|
||||
|
@ -0,0 +1,54 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2023 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.jface.viewers.IStructuredSelection;
|
||||
|
||||
import com.minres.scviewer.database.BlankWaveform;
|
||||
import com.minres.scviewer.database.IWaveform;
|
||||
import com.minres.scviewer.database.ui.TrackEntry;
|
||||
import com.minres.scviewer.e4.application.parts.WaveformViewer;
|
||||
|
||||
public class AddBlankWaveformHandler {
|
||||
|
||||
public static final String PARAM_WHERE_ID="com.minres.scviewer.e4.application.commandparameter.add_blank"; //$NON-NLS-1$
|
||||
|
||||
@CanExecute
|
||||
public Boolean canExecute(EPartService partService){
|
||||
MPart part = partService.getActivePart();
|
||||
if(part!=null && part.getObject() instanceof WaveformViewer){
|
||||
Object sel = ((WaveformViewer)part.getObject()).getSelection();
|
||||
if( sel instanceof IStructuredSelection) {
|
||||
if(((IStructuredSelection)sel).isEmpty()) return false;
|
||||
Object o= ((IStructuredSelection)sel).getFirstElement();
|
||||
return o instanceof TrackEntry;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Execute
|
||||
public void execute(@Named(PARAM_WHERE_ID) String where, EPartService partService) {
|
||||
Object obj = partService.getActivePart().getObject();
|
||||
if(obj instanceof WaveformViewer){
|
||||
((WaveformViewer)obj).addStreamsToList(
|
||||
new IWaveform[]{new BlankWaveform()}, "before".equalsIgnoreCase(where)); //$NON-NLS-1$
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -17,11 +17,8 @@ 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.IWaveform;
|
||||
import com.minres.scviewer.database.tx.ITx;
|
||||
import com.minres.scviewer.database.ui.TrackEntry;
|
||||
import com.minres.scviewer.e4.application.parts.WaveformViewer;
|
||||
|
||||
@ -30,11 +27,15 @@ 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 | o instanceof TrackEntry;
|
||||
public Boolean canExecute(EPartService partService){
|
||||
MPart part = partService.getActivePart();
|
||||
if(part!=null && part.getObject() instanceof WaveformViewer){
|
||||
Object sel = ((WaveformViewer)part.getObject()).getSelection();
|
||||
if( sel instanceof IStructuredSelection) {
|
||||
if(((IStructuredSelection)sel).isEmpty()) return false;
|
||||
Object o= ((IStructuredSelection)sel).getFirstElement();
|
||||
return o instanceof TrackEntry;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -45,7 +45,7 @@ WaveformPopupMenuContribution_10=No command found\!
|
||||
WaveformPopupMenuContribution_12=Render {0}
|
||||
WaveformPopupMenuContribution_15=No command found\!
|
||||
WaveformPreferencesPage_description=Default Waveform Window Settings
|
||||
WaveformPreferencesPage_1=Color for
|
||||
WaveformPreferencesPage_1=Color for {0}
|
||||
WaveformViewer_14=Database Load Cancelled
|
||||
WaveformViewer_15=Database Load Job
|
||||
WaveformViewer_16=Loading
|
||||
@ -78,18 +78,11 @@ signal_nan=Signal NaN Value
|
||||
cursor=Cursor
|
||||
cursor_drag=dragged Cursor
|
||||
cursor_text=Cursor Text
|
||||
HelpBrowser_0=Back
|
||||
HelpBrowser_1=Forward
|
||||
HelpBrowser_2=Stop
|
||||
HelpBrowser_3=Refresh
|
||||
HelpBrowser_4=Go
|
||||
HelpBrowser_5=Address
|
||||
HelpBrowser_7=Error initializing help browser
|
||||
HelpBrowser_8=An error occurred while initializing the help browser:
|
||||
marker=Marker
|
||||
marker_text=Marker TExt
|
||||
rel_arrow=Relation arrow
|
||||
rel_arrow_highlite=highlighted Relation arrorw
|
||||
blank=blank waveform entry
|
||||
UpdateHandler_URI=http://https://minres.github.io/SCViewer/repository
|
||||
UpdateHandler_10=Information
|
||||
UpdateHandler_11=Error
|
||||
@ -101,3 +94,11 @@ UpdateHandler_6=Updates installed, restart?
|
||||
UpdateHandler_7=Updates have been installed successfully, do you want to restart?
|
||||
UpdateHandler_8=Couldn't get provisioning job:
|
||||
UpdateHandler_9=Couldn't resolve provisioning job
|
||||
HelpBrowser_0=Back
|
||||
HelpBrowser_1=Forward
|
||||
HelpBrowser_2=Stop
|
||||
HelpBrowser_3=Refresh
|
||||
HelpBrowser_4=Go
|
||||
HelpBrowser_5=Address
|
||||
HelpBrowser_7=Error initializing help browser
|
||||
HelpBrowser_8=An error occurred while initializing the help browser:
|
||||
|
@ -16,6 +16,7 @@ import org.osgi.service.prefs.Preferences;
|
||||
|
||||
import com.minres.scviewer.database.ui.IWaveformStyleProvider;
|
||||
import com.minres.scviewer.database.ui.WaveformColors;
|
||||
import com.minres.scviewer.database.ui.swt.DefaultWaveformStyleProvider;
|
||||
import com.minres.scviewer.e4.application.preferences.PreferenceConstants;
|
||||
|
||||
public class WaveformStyleProvider implements IWaveformStyleProvider {
|
||||
@ -39,29 +40,9 @@ public class WaveformStyleProvider implements IWaveformStyleProvider {
|
||||
Display display = Display.getCurrent();
|
||||
|
||||
nameFont = display.getSystemFont();
|
||||
colors[WaveformColors.LINE.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_RED);
|
||||
colors[WaveformColors.LINE_HIGHLITE.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_CYAN);
|
||||
colors[WaveformColors.TRACK_BG_EVEN.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_BLACK);
|
||||
colors[WaveformColors.TRACK_BG_ODD.ordinal()] = SWTResourceManager.getColor(40, 40, 40);
|
||||
colors[WaveformColors.TRACK_BG_HIGHLITE.ordinal()] = SWTResourceManager.getColor(40, 40, 80);
|
||||
colors[WaveformColors.TX_BG.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_GREEN);
|
||||
colors[WaveformColors.TX_BG_HIGHLITE.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_DARK_GREEN);
|
||||
colors[WaveformColors.TX_BORDER.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_RED);
|
||||
colors[WaveformColors.SIGNAL0.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_GREEN);
|
||||
colors[WaveformColors.SIGNAL1.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_GREEN);
|
||||
colors[WaveformColors.SIGNALZ.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_DARK_YELLOW);
|
||||
colors[WaveformColors.SIGNALX.ordinal()] = SWTResourceManager.getColor(255, 51, 51);
|
||||
colors[WaveformColors.SIGNALU.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_YELLOW);
|
||||
colors[WaveformColors.SIGNAL_TEXT.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_WHITE);
|
||||
colors[WaveformColors.SIGNAL_REAL.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_YELLOW);
|
||||
colors[WaveformColors.SIGNAL_NAN.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_RED);
|
||||
colors[WaveformColors.CURSOR.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_RED);
|
||||
colors[WaveformColors.CURSOR_DRAG.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_GRAY);
|
||||
colors[WaveformColors.CURSOR_TEXT.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_WHITE);
|
||||
colors[WaveformColors.MARKER.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_DARK_GRAY);
|
||||
colors[WaveformColors.MARKER_TEXT.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_WHITE);
|
||||
colors[WaveformColors.REL_ARROW.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_MAGENTA);
|
||||
colors[WaveformColors.REL_ARROW_HIGHLITE.ordinal()] = SWTResourceManager.getColor(255, 128, 255);
|
||||
DefaultWaveformStyleProvider x = new DefaultWaveformStyleProvider();
|
||||
for (WaveformColors color : WaveformColors.values())
|
||||
colors[color.ordinal()] = x.getColor(color);
|
||||
randomColors = new Color[][] {
|
||||
{ SWTResourceManager.getColor( 170, 66, 37 ), SWTResourceManager.getColor( 190, 66, 37 ) },
|
||||
{ SWTResourceManager.getColor( 96, 74, 110 ), SWTResourceManager.getColor( 96, 74, 130 ) },
|
||||
|
@ -14,64 +14,30 @@ import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;
|
||||
import org.eclipse.core.runtime.preferences.DefaultScope;
|
||||
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
|
||||
import org.eclipse.jface.resource.StringConverter;
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.graphics.Color;
|
||||
import org.eclipse.wb.swt.SWTResourceManager;
|
||||
import org.osgi.framework.FrameworkUtil;
|
||||
|
||||
import com.minres.scviewer.database.ui.WaveformColors;
|
||||
import com.minres.scviewer.database.ui.swt.DefaultWaveformStyleProvider;
|
||||
|
||||
/**
|
||||
* The Class DefaultValuesInitializer.
|
||||
*/
|
||||
public class DefaultValuesInitializer extends AbstractPreferenceInitializer {
|
||||
|
||||
/** The default colors. */
|
||||
public static 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 store = DefaultScope.INSTANCE.getNode(FrameworkUtil.getBundle(getClass()).getSymbolicName());
|
||||
DefaultWaveformStyleProvider styleProvider = new DefaultWaveformStyleProvider();
|
||||
|
||||
store.putBoolean(PreferenceConstants.DATABASE_RELOAD, true);
|
||||
store.putBoolean(PreferenceConstants.SHOW_HOVER, true);
|
||||
store.putBoolean(PreferenceConstants.SHOW_TX_DETAILS, false);
|
||||
store.putInt(PreferenceConstants.TRACK_HEIGHT, 30);
|
||||
for (WaveformColors c : WaveformColors.values()) {
|
||||
store.put(c.name()+"_COLOR", StringConverter.asString(colors[c.ordinal()].getRGB())); //$NON-NLS-1$
|
||||
store.put(c.name()+"_COLOR", StringConverter.asString(styleProvider.getColor(c).getRGB())); //$NON-NLS-1$
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -32,59 +32,5 @@ public class PreferenceConstants {
|
||||
/** The Constant TRACK_HEIGHT. */
|
||||
public static final String TRACK_HEIGHT="trackHeigth"; //$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$
|
||||
|
||||
private PreferenceConstants() {}
|
||||
}
|
||||
|
@ -15,6 +15,7 @@ import java.util.HashMap;
|
||||
|
||||
import org.eclipse.jface.preference.ColorFieldEditor;
|
||||
import org.eclipse.jface.preference.FieldEditorPreferencePage;
|
||||
import org.eclipse.osgi.util.NLS;
|
||||
|
||||
import com.minres.scviewer.database.ui.WaveformColors;
|
||||
import com.minres.scviewer.e4.application.Messages;
|
||||
@ -48,7 +49,7 @@ public class WaveformPreferencesPage extends FieldEditorPreferencePage {
|
||||
}
|
||||
for (WaveformColors c : WaveformColors.values()) {
|
||||
addField(new ColorFieldEditor(c.name() + "_COLOR",
|
||||
Messages.WaveformPreferencesPage_1 + staticFields.get(c.name().toLowerCase()), //$NON-NLS-1$
|
||||
NLS.bind(Messages.WaveformPreferencesPage_1, staticFields.get(c.name().toLowerCase())), //$NON-NLS-1$
|
||||
getFieldEditorParent()));
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user