- added preference dialog
- added preference handling - added file monitor to automatically reload changed database
This commit is contained in:
parent
c1d84ceb01
commit
5680af1b45
|
@ -10,6 +10,10 @@ Require-Bundle: org.eclipse.swt;bundle-version="3.103.1",
|
||||||
com.google.guava;bundle-version="15.0.0",
|
com.google.guava;bundle-version="15.0.0",
|
||||||
org.eclipse.jface,
|
org.eclipse.jface,
|
||||||
org.eclipse.equinox.registry,
|
org.eclipse.equinox.registry,
|
||||||
com.minres.scviewer.database.ui
|
com.minres.scviewer.database.ui,
|
||||||
|
org.eclipse.core.runtime,
|
||||||
|
org.eclipse.osgi
|
||||||
Export-Package: com.minres.scviewer.database.swt
|
Export-Package: com.minres.scviewer.database.swt
|
||||||
Bundle-ClassPath: .
|
Bundle-ClassPath: .
|
||||||
|
Bundle-ActivationPolicy: lazy
|
||||||
|
Bundle-Activator: com.minres.scviewer.database.swt.DatabaseUiPlugin
|
||||||
|
|
|
@ -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.database.swt;
|
||||||
|
|
||||||
|
import org.eclipse.core.runtime.IStatus;
|
||||||
|
import org.eclipse.core.runtime.Plugin;
|
||||||
|
import org.eclipse.core.runtime.Status;
|
||||||
|
import org.osgi.framework.BundleContext;
|
||||||
|
|
||||||
|
public class DatabaseUiPlugin extends Plugin {
|
||||||
|
|
||||||
|
public void start(BundleContext context) throws Exception {
|
||||||
|
getLog().log(new Status(IStatus.OK, "org.eclipse.e4.core", "Starting org.eclipse.e4.core bundle..."));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void stop(BundleContext context) throws Exception {
|
||||||
|
getLog().log(new Status(IStatus.OK, "org.eclipse.e4.core", "Stopping org.eclipse.e4.core bundle..."));
|
||||||
|
}
|
||||||
|
}
|
|
@ -14,7 +14,10 @@ import org.eclipse.swt.graphics.Color;
|
||||||
import org.eclipse.swt.graphics.GC;
|
import org.eclipse.swt.graphics.GC;
|
||||||
import org.eclipse.swt.graphics.Rectangle;
|
import org.eclipse.swt.graphics.Rectangle;
|
||||||
|
|
||||||
public class CursorPainter implements IPainter {
|
import com.minres.scviewer.database.ui.ICursor;
|
||||||
|
import com.minres.scviewer.database.ui.WaveformColors;
|
||||||
|
|
||||||
|
public class CursorPainter implements IPainter, ICursor {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -58,9 +61,9 @@ public class CursorPainter implements IPainter {
|
||||||
long scaleFactor=waveCanvas.getScaleFactor();
|
long scaleFactor=waveCanvas.getScaleFactor();
|
||||||
int x = (int) (time/scaleFactor);
|
int x = (int) (time/scaleFactor);
|
||||||
int top = id<0?area.y:area.y+15;
|
int top = id<0?area.y:area.y+15;
|
||||||
Color drawColor=waveCanvas.colors[id<0?WaveformCanvas.Colors.CURSOR.ordinal():WaveformCanvas.Colors.MARKER.ordinal()];
|
Color drawColor=waveCanvas.colors[id<0?WaveformColors.CURSOR.ordinal():WaveformColors.MARKER.ordinal()];
|
||||||
Color dragColor = waveCanvas.colors[WaveformCanvas.Colors.CURSOR_DRAG.ordinal()];
|
Color dragColor = waveCanvas.colors[WaveformColors.CURSOR_DRAG.ordinal()];
|
||||||
Color textColor=waveCanvas.colors[id<0?WaveformCanvas.Colors.CURSOR_TEXT.ordinal():WaveformCanvas.Colors.MARKER_TEXT.ordinal()];
|
Color textColor=waveCanvas.colors[id<0?WaveformColors.CURSOR_TEXT.ordinal():WaveformColors.MARKER_TEXT.ordinal()];
|
||||||
if(x>=area.x && x<=(area.x+area.width)){
|
if(x>=area.x && x<=(area.x+area.width)){
|
||||||
gc.setForeground(isDragging?dragColor:drawColor);
|
gc.setForeground(isDragging?dragColor:drawColor);
|
||||||
gc.drawLine(x, top, x, area.y+area.height);
|
gc.drawLine(x, top, x, area.y+area.height);
|
||||||
|
|
|
@ -20,10 +20,10 @@ import org.eclipse.swt.graphics.Rectangle;
|
||||||
|
|
||||||
import com.minres.scviewer.database.ISignal;
|
import com.minres.scviewer.database.ISignal;
|
||||||
import com.minres.scviewer.database.ISignalChange;
|
import com.minres.scviewer.database.ISignalChange;
|
||||||
import com.minres.scviewer.database.ui.TrackEntry;
|
|
||||||
import com.minres.scviewer.database.ISignalChangeMulti;
|
import com.minres.scviewer.database.ISignalChangeMulti;
|
||||||
import com.minres.scviewer.database.ISignalChangeSingle;
|
import com.minres.scviewer.database.ISignalChangeSingle;
|
||||||
import com.minres.scviewer.database.IWaveform;
|
import com.minres.scviewer.database.ui.TrackEntry;
|
||||||
|
import com.minres.scviewer.database.ui.WaveformColors;
|
||||||
|
|
||||||
public class SignalPainter extends TrackPainter {
|
public class SignalPainter extends TrackPainter {
|
||||||
|
|
||||||
|
@ -33,7 +33,6 @@ public class SignalPainter extends TrackPainter {
|
||||||
private final WaveformCanvas waveCanvas;
|
private final WaveformCanvas waveCanvas;
|
||||||
private ISignal<? extends ISignalChange> signal;
|
private ISignal<? extends ISignalChange> signal;
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
public SignalPainter(WaveformCanvas txDisplay, boolean even, TrackEntry trackEntry) {
|
public SignalPainter(WaveformCanvas txDisplay, boolean even, TrackEntry trackEntry) {
|
||||||
super(trackEntry, even);
|
super(trackEntry, even);
|
||||||
this.waveCanvas = txDisplay;
|
this.waveCanvas = txDisplay;
|
||||||
|
@ -42,9 +41,9 @@ public class SignalPainter extends TrackPainter {
|
||||||
|
|
||||||
public void paintArea(GC gc, Rectangle area) {
|
public void paintArea(GC gc, Rectangle area) {
|
||||||
if(trackEntry.selected)
|
if(trackEntry.selected)
|
||||||
gc.setBackground(this.waveCanvas.colors[WaveformCanvas.Colors.TRACK_BG_HIGHLITE.ordinal()]);
|
gc.setBackground(this.waveCanvas.colors[WaveformColors.TRACK_BG_HIGHLITE.ordinal()]);
|
||||||
else
|
else
|
||||||
gc.setBackground(this.waveCanvas.colors[even?WaveformCanvas.Colors.TRACK_BG_EVEN.ordinal():WaveformCanvas.Colors.TRACK_BG_ODD.ordinal()]);
|
gc.setBackground(this.waveCanvas.colors[even?WaveformColors.TRACK_BG_EVEN.ordinal():WaveformColors.TRACK_BG_ODD.ordinal()]);
|
||||||
gc.setFillRule(SWT.FILL_EVEN_ODD);
|
gc.setFillRule(SWT.FILL_EVEN_ODD);
|
||||||
gc.fillRectangle(area);
|
gc.fillRectangle(area);
|
||||||
Entry<Long, ? extends ISignalChange> firstChange=signal.getEvents().floorEntry(area.x*this.waveCanvas.getScaleFactor());
|
Entry<Long, ? extends ISignalChange> firstChange=signal.getEvents().floorEntry(area.x*this.waveCanvas.getScaleFactor());
|
||||||
|
@ -55,7 +54,7 @@ public class SignalPainter extends TrackPainter {
|
||||||
} else if(lastTx==null){
|
} else if(lastTx==null){
|
||||||
lastTx=signal.getEvents().lastEntry();
|
lastTx=signal.getEvents().lastEntry();
|
||||||
}
|
}
|
||||||
gc.setForeground(this.waveCanvas.colors[WaveformCanvas.Colors.LINE.ordinal()]);
|
gc.setForeground(this.waveCanvas.colors[WaveformColors.LINE.ordinal()]);
|
||||||
gc.setLineStyle(SWT.LINE_SOLID);
|
gc.setLineStyle(SWT.LINE_SOLID);
|
||||||
gc.setLineWidth(1);
|
gc.setLineWidth(1);
|
||||||
Entry<Long, ? extends ISignalChange> left=firstChange;
|
Entry<Long, ? extends ISignalChange> left=firstChange;
|
||||||
|
@ -66,18 +65,18 @@ public class SignalPainter extends TrackPainter {
|
||||||
int xBegin= (int)(left.getKey()/this.waveCanvas.getScaleFactor());
|
int xBegin= (int)(left.getKey()/this.waveCanvas.getScaleFactor());
|
||||||
if(xEnd>xBegin){
|
if(xEnd>xBegin){
|
||||||
int yOffset = this.waveCanvas.getTrackHeight()/2;
|
int yOffset = this.waveCanvas.getTrackHeight()/2;
|
||||||
Color color = this.waveCanvas.colors[WaveformCanvas.Colors.SIGNALX.ordinal()];
|
Color color = this.waveCanvas.colors[WaveformColors.SIGNALX.ordinal()];
|
||||||
switch(((ISignalChangeSingle) left.getValue()).getValue()){
|
switch(((ISignalChangeSingle) left.getValue()).getValue()){
|
||||||
case '1':
|
case '1':
|
||||||
color=this.waveCanvas.colors[WaveformCanvas.Colors.SIGNAL1.ordinal()];
|
color=this.waveCanvas.colors[WaveformColors.SIGNAL1.ordinal()];
|
||||||
yOffset = this.waveCanvas.getTrackHeight()/5;
|
yOffset = this.waveCanvas.getTrackHeight()/5;
|
||||||
break;
|
break;
|
||||||
case '0':
|
case '0':
|
||||||
color=this.waveCanvas.colors[WaveformCanvas.Colors.SIGNAL0.ordinal()];
|
color=this.waveCanvas.colors[WaveformColors.SIGNAL0.ordinal()];
|
||||||
yOffset = 4*this.waveCanvas.getTrackHeight()/5;
|
yOffset = 4*this.waveCanvas.getTrackHeight()/5;
|
||||||
break;
|
break;
|
||||||
case 'Z':
|
case 'Z':
|
||||||
color=this.waveCanvas.colors[WaveformCanvas.Colors.SIGNALZ.ordinal()];
|
color=this.waveCanvas.colors[WaveformColors.SIGNALZ.ordinal()];
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
}
|
}
|
||||||
|
@ -104,12 +103,12 @@ public class SignalPainter extends TrackPainter {
|
||||||
int yOffsetT = this.waveCanvas.getTrackHeight()/5+area.y;
|
int yOffsetT = this.waveCanvas.getTrackHeight()/5+area.y;
|
||||||
int yOffsetM = this.waveCanvas.getTrackHeight()/2+area.y;
|
int yOffsetM = this.waveCanvas.getTrackHeight()/2+area.y;
|
||||||
int yOffsetB = 4*this.waveCanvas.getTrackHeight()/5+area.y;
|
int yOffsetB = 4*this.waveCanvas.getTrackHeight()/5+area.y;
|
||||||
Color colorBorder = this.waveCanvas.colors[WaveformCanvas.Colors.SIGNAL0.ordinal()];
|
Color colorBorder = this.waveCanvas.colors[WaveformColors.SIGNAL0.ordinal()];
|
||||||
ISignalChangeMulti last = (ISignalChangeMulti) left.getValue();
|
ISignalChangeMulti last = (ISignalChangeMulti) left.getValue();
|
||||||
if(last.getValue().toString().contains("X")){
|
if(last.getValue().toString().contains("X")){
|
||||||
colorBorder=this.waveCanvas.colors[WaveformCanvas.Colors.SIGNALX.ordinal()];
|
colorBorder=this.waveCanvas.colors[WaveformColors.SIGNALX.ordinal()];
|
||||||
}else if(last.getValue().toString().contains("Z")){
|
}else if(last.getValue().toString().contains("Z")){
|
||||||
colorBorder=this.waveCanvas.colors[WaveformCanvas.Colors.SIGNALZ.ordinal()];
|
colorBorder=this.waveCanvas.colors[WaveformColors.SIGNALZ.ordinal()];
|
||||||
}
|
}
|
||||||
int beginTime= (int)(left.getKey()/this.waveCanvas.getScaleFactor());
|
int beginTime= (int)(left.getKey()/this.waveCanvas.getScaleFactor());
|
||||||
int endTime= (int)(right.getKey()/this.waveCanvas.getScaleFactor());
|
int endTime= (int)(right.getKey()/this.waveCanvas.getScaleFactor());
|
||||||
|
@ -123,7 +122,7 @@ public class SignalPainter extends TrackPainter {
|
||||||
};
|
};
|
||||||
gc.setForeground(colorBorder);
|
gc.setForeground(colorBorder);
|
||||||
gc.drawPolygon(points);
|
gc.drawPolygon(points);
|
||||||
gc.setForeground(this.waveCanvas.colors[WaveformCanvas.Colors.SIGNAL_TEXT.ordinal()]);
|
gc.setForeground(this.waveCanvas.colors[WaveformColors.SIGNAL_TEXT.ordinal()]);
|
||||||
int size = gc.getDevice().getDPI().y * gc.getFont().getFontData()[0].getHeight()/72;
|
int size = gc.getDevice().getDPI().y * gc.getFont().getFontData()[0].getHeight()/72;
|
||||||
if(beginTime<area.x) beginTime=area.x;
|
if(beginTime<area.x) beginTime=area.x;
|
||||||
int width=endTime-beginTime;
|
int width=endTime-beginTime;
|
||||||
|
|
|
@ -24,8 +24,8 @@ import org.eclipse.swt.graphics.Rectangle;
|
||||||
import com.minres.scviewer.database.ITx;
|
import com.minres.scviewer.database.ITx;
|
||||||
import com.minres.scviewer.database.ITxEvent;
|
import com.minres.scviewer.database.ITxEvent;
|
||||||
import com.minres.scviewer.database.ITxStream;
|
import com.minres.scviewer.database.ITxStream;
|
||||||
import com.minres.scviewer.database.IWaveform;
|
|
||||||
import com.minres.scviewer.database.ui.TrackEntry;
|
import com.minres.scviewer.database.ui.TrackEntry;
|
||||||
|
import com.minres.scviewer.database.ui.WaveformColors;
|
||||||
|
|
||||||
public class StreamPainter extends TrackPainter{
|
public class StreamPainter extends TrackPainter{
|
||||||
|
|
||||||
|
@ -35,11 +35,9 @@ public class StreamPainter extends TrackPainter{
|
||||||
private final WaveformCanvas waveCanvas;
|
private final WaveformCanvas waveCanvas;
|
||||||
private ITxStream<? extends ITxEvent> stream;
|
private ITxStream<? extends ITxEvent> stream;
|
||||||
private int txBase, txHeight;
|
private int txBase, txHeight;
|
||||||
private int totalHeight;
|
|
||||||
private boolean even;
|
private boolean even;
|
||||||
private TreeSet<ITx> seenTx;
|
private TreeSet<ITx> seenTx;
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
public StreamPainter(WaveformCanvas waveCanvas, boolean even, TrackEntry trackEntry) {
|
public StreamPainter(WaveformCanvas waveCanvas, boolean even, TrackEntry trackEntry) {
|
||||||
super(trackEntry, even);
|
super(trackEntry, even);
|
||||||
this.waveCanvas = waveCanvas;
|
this.waveCanvas = waveCanvas;
|
||||||
|
@ -54,9 +52,9 @@ public class StreamPainter extends TrackPainter{
|
||||||
txBase=trackHeight/5;
|
txBase=trackHeight/5;
|
||||||
txHeight=trackHeight*3/5;
|
txHeight=trackHeight*3/5;
|
||||||
if(trackEntry.selected)
|
if(trackEntry.selected)
|
||||||
gc.setBackground(this.waveCanvas.colors[WaveformCanvas.Colors.TRACK_BG_HIGHLITE.ordinal()]);
|
gc.setBackground(this.waveCanvas.colors[WaveformColors.TRACK_BG_HIGHLITE.ordinal()]);
|
||||||
else
|
else
|
||||||
gc.setBackground(this.waveCanvas.colors[even?WaveformCanvas.Colors.TRACK_BG_EVEN.ordinal():WaveformCanvas.Colors.TRACK_BG_ODD.ordinal()]);
|
gc.setBackground(this.waveCanvas.colors[even?WaveformColors.TRACK_BG_EVEN.ordinal():WaveformColors.TRACK_BG_ODD.ordinal()]);
|
||||||
gc.setFillRule(SWT.FILL_EVEN_ODD);
|
gc.setFillRule(SWT.FILL_EVEN_ODD);
|
||||||
gc.fillRectangle(area);
|
gc.fillRectangle(area);
|
||||||
Entry<Long, ?> firstTx=stream.getEvents().floorEntry(area.x*waveCanvas.getScaleFactor());
|
Entry<Long, ?> firstTx=stream.getEvents().floorEntry(area.x*waveCanvas.getScaleFactor());
|
||||||
|
@ -66,7 +64,7 @@ public class StreamPainter extends TrackPainter{
|
||||||
gc.setFillRule(SWT.FILL_EVEN_ODD);
|
gc.setFillRule(SWT.FILL_EVEN_ODD);
|
||||||
gc.setLineStyle(SWT.LINE_SOLID);
|
gc.setLineStyle(SWT.LINE_SOLID);
|
||||||
gc.setLineWidth(1);
|
gc.setLineWidth(1);
|
||||||
gc.setForeground(this.waveCanvas.colors[WaveformCanvas.Colors.LINE.ordinal()]);
|
gc.setForeground(this.waveCanvas.colors[WaveformColors.LINE.ordinal()]);
|
||||||
for(int y1=area.y+trackHeight/2; y1<area.y+trackEntry.height; y1+=trackHeight)
|
for(int y1=area.y+trackHeight/2; y1<area.y+trackEntry.height; y1+=trackHeight)
|
||||||
gc.drawLine(area.x, y1, area.x+area.width, y1);
|
gc.drawLine(area.x, y1, area.x+area.width, y1);
|
||||||
if(firstTx==lastTx)
|
if(firstTx==lastTx)
|
||||||
|
@ -76,8 +74,8 @@ public class StreamPainter extends TrackPainter{
|
||||||
seenTx.clear();
|
seenTx.clear();
|
||||||
NavigableMap<Long,?> entries = stream.getEvents().subMap(firstTx.getKey(), true, lastTx.getKey(), true);
|
NavigableMap<Long,?> entries = stream.getEvents().subMap(firstTx.getKey(), true, lastTx.getKey(), true);
|
||||||
boolean highlighed=false;
|
boolean highlighed=false;
|
||||||
gc.setForeground(this.waveCanvas.colors[WaveformCanvas.Colors.LINE.ordinal()]);
|
gc.setForeground(this.waveCanvas.colors[WaveformColors.LINE.ordinal()]);
|
||||||
gc.setBackground(this.waveCanvas.colors[WaveformCanvas.Colors.TX_BG.ordinal()]);
|
gc.setBackground(this.waveCanvas.colors[WaveformColors.TX_BG.ordinal()]);
|
||||||
for(Entry<Long, ?> entry: entries.entrySet())
|
for(Entry<Long, ?> entry: entries.entrySet())
|
||||||
for(ITxEvent txEvent:(Collection<? extends ITxEvent>)entry.getValue()){
|
for(ITxEvent txEvent:(Collection<? extends ITxEvent>)entry.getValue()){
|
||||||
if(txEvent.getType()==ITxEvent.Type.BEGIN)
|
if(txEvent.getType()==ITxEvent.Type.BEGIN)
|
||||||
|
@ -93,8 +91,8 @@ public class StreamPainter extends TrackPainter{
|
||||||
drawTx(gc, area, tx);
|
drawTx(gc, area, tx);
|
||||||
}
|
}
|
||||||
if(highlighed){
|
if(highlighed){
|
||||||
gc.setForeground(this.waveCanvas.colors[WaveformCanvas.Colors.LINE_HIGHLITE.ordinal()]);
|
gc.setForeground(this.waveCanvas.colors[WaveformColors.LINE_HIGHLITE.ordinal()]);
|
||||||
gc.setBackground(this.waveCanvas.colors[WaveformCanvas.Colors.TX_BG_HIGHLITE.ordinal()]);
|
gc.setBackground(this.waveCanvas.colors[WaveformColors.TX_BG_HIGHLITE.ordinal()]);
|
||||||
drawTx(gc, area, waveCanvas.currentSelection);
|
drawTx(gc, area, waveCanvas.currentSelection);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,6 +17,8 @@ import org.eclipse.swt.SWT;
|
||||||
import org.eclipse.swt.graphics.GC;
|
import org.eclipse.swt.graphics.GC;
|
||||||
import org.eclipse.swt.graphics.Rectangle;
|
import org.eclipse.swt.graphics.Rectangle;
|
||||||
|
|
||||||
|
import com.minres.scviewer.database.ui.WaveformColors;
|
||||||
|
|
||||||
public class TrackAreaPainter implements IPainter {
|
public class TrackAreaPainter implements IPainter {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -35,7 +37,7 @@ public class TrackAreaPainter implements IPainter {
|
||||||
|
|
||||||
public void paintArea(GC gc, Rectangle a) {
|
public void paintArea(GC gc, Rectangle a) {
|
||||||
Rectangle area = new Rectangle(a.x, a.y+waveCanvas.rulerHeight, a.width, a.height-waveCanvas.rulerHeight);
|
Rectangle area = new Rectangle(a.x, a.y+waveCanvas.rulerHeight, a.width, a.height-waveCanvas.rulerHeight);
|
||||||
gc.setBackground(this.waveCanvas.colors[WaveformCanvas.Colors.TRACK_BG_EVEN.ordinal()]);
|
gc.setBackground(this.waveCanvas.colors[WaveformColors.TRACK_BG_EVEN.ordinal()]);
|
||||||
gc.setFillRule(SWT.FILL_EVEN_ODD);
|
gc.setFillRule(SWT.FILL_EVEN_ODD);
|
||||||
gc.fillRectangle(area);
|
gc.fillRectangle(area);
|
||||||
if(trackVerticalOffset.size()>0){
|
if(trackVerticalOffset.size()>0){
|
||||||
|
|
|
@ -40,18 +40,11 @@ import com.google.common.collect.Lists;
|
||||||
import com.minres.scviewer.database.ITx;
|
import com.minres.scviewer.database.ITx;
|
||||||
import com.minres.scviewer.database.IWaveform;
|
import com.minres.scviewer.database.IWaveform;
|
||||||
import com.minres.scviewer.database.IWaveformEvent;
|
import com.minres.scviewer.database.IWaveformEvent;
|
||||||
|
import com.minres.scviewer.database.ui.WaveformColors;
|
||||||
|
|
||||||
public class WaveformCanvas extends Canvas {
|
public class WaveformCanvas extends Canvas {
|
||||||
public enum Colors {
|
|
||||||
LINE, LINE_HIGHLITE,
|
|
||||||
TRACK_BG_EVEN, TRACK_BG_ODD, TRACK_BG_HIGHLITE,
|
|
||||||
TX_BG, TX_BG_HIGHLITE, TX_BORDER,
|
|
||||||
SIGNAL0, SIGNAL1, SIGNALZ, SIGNALX, SIGNAL_TEXT,
|
|
||||||
CURSOR, CURSOR_DRAG, CURSOR_TEXT,
|
|
||||||
MARKER, MARKER_TEXT
|
|
||||||
}
|
|
||||||
|
|
||||||
Color[] colors = new Color[Colors.values().length];
|
Color[] colors = new Color[WaveformColors.values().length];
|
||||||
|
|
||||||
private int trackHeight = 50;
|
private int trackHeight = 50;
|
||||||
|
|
||||||
|
@ -134,34 +127,34 @@ public class WaveformCanvas extends Canvas {
|
||||||
cursorPainters.add(cursorPainter);
|
cursorPainters.add(cursorPainter);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initColors(HashMap<Colors, RGB> colourMap) {
|
public void initColors(HashMap<WaveformColors, RGB> colourMap) {
|
||||||
Display d = getDisplay();
|
Display d = getDisplay();
|
||||||
if (colourMap != null) {
|
if (colourMap != null) {
|
||||||
for (Colors c : Colors.values()) {
|
for (WaveformColors c : WaveformColors.values()) {
|
||||||
if (colourMap.containsKey(c)) {
|
if (colourMap.containsKey(c)) {
|
||||||
colors[c.ordinal()].dispose();
|
|
||||||
colors[c.ordinal()] = new Color(d, colourMap.get(c));
|
colors[c.ordinal()] = new Color(d, colourMap.get(c));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
redraw();
|
||||||
} else {
|
} else {
|
||||||
colors[Colors.LINE.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_RED);
|
colors[WaveformColors.LINE.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_RED);
|
||||||
colors[Colors.LINE_HIGHLITE.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_CYAN);
|
colors[WaveformColors.LINE_HIGHLITE.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_CYAN);
|
||||||
colors[Colors.TRACK_BG_EVEN.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_BLACK);
|
colors[WaveformColors.TRACK_BG_EVEN.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_BLACK);
|
||||||
colors[Colors.TRACK_BG_ODD.ordinal()] = SWTResourceManager.getColor(40, 40, 40);
|
colors[WaveformColors.TRACK_BG_ODD.ordinal()] = SWTResourceManager.getColor(40, 40, 40);
|
||||||
colors[Colors.TRACK_BG_HIGHLITE.ordinal()] = SWTResourceManager.getColor(40, 40, 80);
|
colors[WaveformColors.TRACK_BG_HIGHLITE.ordinal()] = SWTResourceManager.getColor(40, 40, 80);
|
||||||
colors[Colors.TX_BG.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_GREEN);
|
colors[WaveformColors.TX_BG.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_GREEN);
|
||||||
colors[Colors.TX_BG_HIGHLITE.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_DARK_GREEN);
|
colors[WaveformColors.TX_BG_HIGHLITE.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_DARK_GREEN);
|
||||||
colors[Colors.TX_BORDER.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_RED);
|
colors[WaveformColors.TX_BORDER.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_RED);
|
||||||
colors[Colors.SIGNAL0.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_DARK_GREEN);
|
colors[WaveformColors.SIGNAL0.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_DARK_GREEN);
|
||||||
colors[Colors.SIGNAL1.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_DARK_GREEN);
|
colors[WaveformColors.SIGNAL1.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_DARK_GREEN);
|
||||||
colors[Colors.SIGNALZ.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_GRAY);
|
colors[WaveformColors.SIGNALZ.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_GRAY);
|
||||||
colors[Colors.SIGNALX.ordinal()] = SWTResourceManager.getColor(255, 128, 182);
|
colors[WaveformColors.SIGNALX.ordinal()] = SWTResourceManager.getColor(255, 128, 182);
|
||||||
colors[Colors.SIGNAL_TEXT.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_WHITE);
|
colors[WaveformColors.SIGNAL_TEXT.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_WHITE);
|
||||||
colors[Colors.CURSOR.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_RED);
|
colors[WaveformColors.CURSOR.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_RED);
|
||||||
colors[Colors.CURSOR_DRAG.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_GRAY);
|
colors[WaveformColors.CURSOR_DRAG.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_GRAY);
|
||||||
colors[Colors.CURSOR_TEXT.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_WHITE);
|
colors[WaveformColors.CURSOR_TEXT.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_WHITE);
|
||||||
colors[Colors.MARKER.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_DARK_GRAY);
|
colors[WaveformColors.MARKER.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_DARK_GRAY);
|
||||||
colors[Colors.MARKER_TEXT.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_WHITE);
|
colors[WaveformColors.MARKER_TEXT.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_WHITE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -274,7 +267,7 @@ public class WaveformCanvas extends Canvas {
|
||||||
*/
|
*/
|
||||||
public void dispose() {
|
public void dispose() {
|
||||||
transform.dispose();
|
transform.dispose();
|
||||||
for (Colors c : Colors.values())
|
for (WaveformColors c : WaveformColors.values())
|
||||||
colors[c.ordinal()].dispose();
|
colors[c.ordinal()].dispose();
|
||||||
super.dispose();
|
super.dispose();
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,6 +15,7 @@ import java.beans.PropertyChangeListener;
|
||||||
import java.beans.PropertyChangeSupport;
|
import java.beans.PropertyChangeSupport;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
import java.util.NavigableMap;
|
import java.util.NavigableMap;
|
||||||
|
@ -49,6 +50,7 @@ import org.eclipse.swt.events.SelectionEvent;
|
||||||
import org.eclipse.swt.graphics.Font;
|
import org.eclipse.swt.graphics.Font;
|
||||||
import org.eclipse.swt.graphics.GC;
|
import org.eclipse.swt.graphics.GC;
|
||||||
import org.eclipse.swt.graphics.Point;
|
import org.eclipse.swt.graphics.Point;
|
||||||
|
import org.eclipse.swt.graphics.RGB;
|
||||||
import org.eclipse.swt.graphics.Rectangle;
|
import org.eclipse.swt.graphics.Rectangle;
|
||||||
import org.eclipse.swt.graphics.TextLayout;
|
import org.eclipse.swt.graphics.TextLayout;
|
||||||
import org.eclipse.swt.layout.FillLayout;
|
import org.eclipse.swt.layout.FillLayout;
|
||||||
|
@ -75,8 +77,10 @@ import com.minres.scviewer.database.ITxStream;
|
||||||
import com.minres.scviewer.database.IWaveform;
|
import com.minres.scviewer.database.IWaveform;
|
||||||
import com.minres.scviewer.database.IWaveformEvent;
|
import com.minres.scviewer.database.IWaveformEvent;
|
||||||
import com.minres.scviewer.database.ui.GotoDirection;
|
import com.minres.scviewer.database.ui.GotoDirection;
|
||||||
|
import com.minres.scviewer.database.ui.ICursor;
|
||||||
import com.minres.scviewer.database.ui.IWaveformViewer;
|
import com.minres.scviewer.database.ui.IWaveformViewer;
|
||||||
import com.minres.scviewer.database.ui.TrackEntry;
|
import com.minres.scviewer.database.ui.TrackEntry;
|
||||||
|
import com.minres.scviewer.database.ui.WaveformColors;
|
||||||
|
|
||||||
public class WaveformViewer implements IWaveformViewer {
|
public class WaveformViewer implements IWaveformViewer {
|
||||||
|
|
||||||
|
@ -84,8 +88,6 @@ public class WaveformViewer implements IWaveformViewer {
|
||||||
|
|
||||||
private PropertyChangeSupport pcs;
|
private PropertyChangeSupport pcs;
|
||||||
|
|
||||||
private static final String SELECTION = "selection";
|
|
||||||
|
|
||||||
private ITx currentTxSelection;
|
private ITx currentTxSelection;
|
||||||
|
|
||||||
private TrackEntry currentWaveformSelection;
|
private TrackEntry currentWaveformSelection;
|
||||||
|
@ -120,7 +122,7 @@ public class WaveformViewer implements IWaveformViewer {
|
||||||
if ((e.button == 1 || e.button == 3)) {
|
if ((e.button == 1 || e.button == 3)) {
|
||||||
Entry<Integer, TrackEntry> entry = trackVerticalOffset.floorEntry(e.y);
|
Entry<Integer, TrackEntry> entry = trackVerticalOffset.floorEntry(e.y);
|
||||||
if (entry != null)
|
if (entry != null)
|
||||||
setSelection(new StructuredSelection(entry.getValue().waveform));
|
setSelection(new StructuredSelection(entry.getValue()));
|
||||||
}
|
}
|
||||||
if (e.button == 3) {
|
if (e.button == 3) {
|
||||||
Menu topMenu= top.getMenu();
|
Menu topMenu= top.getMenu();
|
||||||
|
@ -368,11 +370,15 @@ public class WaveformViewer implements IWaveformViewer {
|
||||||
@Override
|
@Override
|
||||||
public void propertyChange(PropertyChangeEvent pce) {
|
public void propertyChange(PropertyChangeEvent pce) {
|
||||||
if ("size".equals(pce.getPropertyName()) || "content".equals(pce.getPropertyName())) {
|
if ("size".equals(pce.getPropertyName()) || "content".equals(pce.getPropertyName())) {
|
||||||
|
waveformCanvas.getDisplay().asyncExec(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
updateTracklist();
|
updateTracklist();
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
protected void updateTracklist() {
|
protected void updateTracklist() {
|
||||||
trackVerticalHeight = 0;
|
trackVerticalHeight = 0;
|
||||||
int nameMaxWidth = 0;
|
int nameMaxWidth = 0;
|
||||||
|
@ -556,7 +562,6 @@ public class WaveformViewer implements IWaveformViewer {
|
||||||
* @see com.minres.scviewer.database.swt.IWaveformPanel#setSelection(org.eclipse.jface.viewers.ISelection, boolean)
|
* @see com.minres.scviewer.database.swt.IWaveformPanel#setSelection(org.eclipse.jface.viewers.ISelection, boolean)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
public void setSelection(ISelection selection, boolean addIfNeeded) {
|
public void setSelection(ISelection selection, boolean addIfNeeded) {
|
||||||
boolean selectionChanged = false;
|
boolean selectionChanged = false;
|
||||||
if(currentWaveformSelection!=null) currentWaveformSelection.selected=false;
|
if(currentWaveformSelection!=null) currentWaveformSelection.selected=false;
|
||||||
|
@ -573,9 +578,9 @@ public class WaveformViewer implements IWaveformViewer {
|
||||||
if(trackEntry==null && addIfNeeded){
|
if(trackEntry==null && addIfNeeded){
|
||||||
trackEntry=new TrackEntry(txSel.getStream());
|
trackEntry=new TrackEntry(txSel.getStream());
|
||||||
streams.add(trackEntry);
|
streams.add(trackEntry);
|
||||||
currentWaveformSelection = trackEntry;
|
|
||||||
}
|
}
|
||||||
currentTxSelection = txSel;
|
currentTxSelection = txSel;
|
||||||
|
if(trackEntry!=null) currentWaveformSelection = trackEntry;
|
||||||
selectionChanged = true;
|
selectionChanged = true;
|
||||||
} else if (sel instanceof TrackEntry && currentWaveformSelection != sel) {
|
} else if (sel instanceof TrackEntry && currentWaveformSelection != sel) {
|
||||||
currentWaveformSelection = (TrackEntry) sel;
|
currentWaveformSelection = (TrackEntry) sel;
|
||||||
|
@ -615,7 +620,6 @@ public class WaveformViewer implements IWaveformViewer {
|
||||||
* @see com.minres.scviewer.database.swt.IWaveformPanel#moveSelection(com.minres.scviewer.database.swt.GotoDirection)
|
* @see com.minres.scviewer.database.swt.IWaveformPanel#moveSelection(com.minres.scviewer.database.swt.GotoDirection)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
public void moveSelection(GotoDirection direction) {
|
public void moveSelection(GotoDirection direction) {
|
||||||
if (currentWaveformSelection.isStream()) {
|
if (currentWaveformSelection.isStream()) {
|
||||||
ITxStream<? extends ITxEvent> stream = currentWaveformSelection.getStream();
|
ITxStream<? extends ITxEvent> stream = currentWaveformSelection.getStream();
|
||||||
|
@ -875,10 +879,17 @@ public class WaveformViewer implements IWaveformViewer {
|
||||||
* @see com.minres.scviewer.database.swt.IWaveformPanel#getActMarkerTime()
|
* @see com.minres.scviewer.database.swt.IWaveformPanel#getActMarkerTime()
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public long getActMarkerTime(){
|
public long getSelectedMarkerTime(){
|
||||||
return getMarkerTime(selectedMarker);
|
return getMarkerTime(selectedMarker);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<ICursor> getCursorList(){
|
||||||
|
List<ICursor> cursors = new LinkedList<>();
|
||||||
|
for(CursorPainter painter:waveformCanvas.getCursorPainters()) cursors.add(painter);
|
||||||
|
return Collections.unmodifiableList(cursors);
|
||||||
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see com.minres.scviewer.database.swt.IWaveformPanel#getMarkerTime(int)
|
* @see com.minres.scviewer.database.swt.IWaveformPanel#getMarkerTime(int)
|
||||||
*/
|
*/
|
||||||
|
@ -894,12 +905,8 @@ public class WaveformViewer implements IWaveformViewer {
|
||||||
dragSource.addDragListener(new DragSourceAdapter() {
|
dragSource.addDragListener(new DragSourceAdapter() {
|
||||||
public void dragStart(DragSourceEvent event) {
|
public void dragStart(DragSourceEvent event) {
|
||||||
if (event.y < trackVerticalHeight) {
|
if (event.y < trackVerticalHeight) {
|
||||||
// event.data =
|
|
||||||
// trackVerticalOffset.floorEntry(event.y).getValue().getFullName();
|
|
||||||
event.doit = true;
|
event.doit = true;
|
||||||
LocalSelectionTransfer.getTransfer().setSelection(new StructuredSelection(currentWaveformSelection));
|
LocalSelectionTransfer.getTransfer().setSelection(new StructuredSelection(currentWaveformSelection));
|
||||||
// System.out.println("dragStart at location "+new
|
|
||||||
// Point(event.x, event.y));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -917,7 +924,6 @@ public class WaveformViewer implements IWaveformViewer {
|
||||||
dropTarget.setTransfer(types);
|
dropTarget.setTransfer(types);
|
||||||
|
|
||||||
dropTarget.addDropListener(new DropTargetAdapter() {
|
dropTarget.addDropListener(new DropTargetAdapter() {
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
public void drop(DropTargetEvent event) {
|
public void drop(DropTargetEvent event) {
|
||||||
if (LocalSelectionTransfer.getTransfer().isSupportedType(event.currentDataType)){
|
if (LocalSelectionTransfer.getTransfer().isSupportedType(event.currentDataType)){
|
||||||
ISelection sel = LocalSelectionTransfer.getTransfer().getSelection();
|
ISelection sel = LocalSelectionTransfer.getTransfer().getSelection();
|
||||||
|
@ -926,18 +932,17 @@ public class WaveformViewer implements IWaveformViewer {
|
||||||
DropTarget tgt = (DropTarget) event.widget;
|
DropTarget tgt = (DropTarget) event.widget;
|
||||||
Point dropPoint = ((Canvas) tgt.getControl()).toControl(event.x, event.y);
|
Point dropPoint = ((Canvas) tgt.getControl()).toControl(event.x, event.y);
|
||||||
Object target = trackVerticalOffset.floorEntry(dropPoint.y).getValue();
|
Object target = trackVerticalOffset.floorEntry(dropPoint.y).getValue();
|
||||||
if(source instanceof IWaveform<?> && target instanceof IWaveform<?>){
|
if(source instanceof TrackEntry && target instanceof TrackEntry){
|
||||||
IWaveform<? extends IWaveformEvent> srcWave=(IWaveform<? extends IWaveformEvent>) source;
|
TrackEntry srcWave=(TrackEntry) source;
|
||||||
int srcIdx=streams.indexOf(srcWave);
|
int srcIdx=streams.indexOf(srcWave);
|
||||||
streams.remove(getEntryForStream((IWaveform<?>)source));
|
streams.remove(srcWave);
|
||||||
int tgtIdx=streams.indexOf(target);
|
int tgtIdx=streams.indexOf(target);
|
||||||
if(srcIdx<=tgtIdx) tgtIdx++;
|
if(srcIdx<=tgtIdx) tgtIdx++;
|
||||||
TrackEntry entry = new TrackEntry(srcWave);
|
|
||||||
if(tgtIdx>=streams.size())
|
if(tgtIdx>=streams.size())
|
||||||
streams.add(entry);
|
streams.add(srcWave);
|
||||||
else
|
else
|
||||||
streams.add(tgtIdx, entry);
|
streams.add(tgtIdx, srcWave);
|
||||||
currentWaveformSelection=entry;
|
currentWaveformSelection=srcWave;
|
||||||
updateTracklist();
|
updateTracklist();
|
||||||
} else if(source instanceof CursorPainter){
|
} else if(source instanceof CursorPainter){
|
||||||
((CursorPainter)source).setTime(0);
|
((CursorPainter)source).setTime(0);
|
||||||
|
@ -969,7 +974,6 @@ public class WaveformViewer implements IWaveformViewer {
|
||||||
dragSource.setTransfer(types);
|
dragSource.setTransfer(types);
|
||||||
dragSource.addDragListener(new DragSourceAdapter() {
|
dragSource.addDragListener(new DragSourceAdapter() {
|
||||||
public void dragStart(DragSourceEvent event) {
|
public void dragStart(DragSourceEvent event) {
|
||||||
System.out.println("dragStart");
|
|
||||||
event.doit = false;
|
event.doit = false;
|
||||||
List<Object> clicked = waveformCanvas.getClicked(new Point(event.x, event.y));
|
List<Object> clicked = waveformCanvas.getClicked(new Point(event.x, event.y));
|
||||||
for(Object o:clicked){
|
for(Object o:clicked){
|
||||||
|
@ -1115,4 +1119,9 @@ public class WaveformViewer implements IWaveformViewer {
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setColors(HashMap<WaveformColors, RGB> colourMap) {
|
||||||
|
waveformCanvas.initColors(colourMap);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,19 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2015 MINRES Technologies GmbH and others.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* MINRES Technologies GmbH - initial API and implementation
|
||||||
|
*******************************************************************************/
|
||||||
|
package com.minres.scviewer.database.ui;
|
||||||
|
|
||||||
|
public interface ICursor {
|
||||||
|
|
||||||
|
public long getTime();
|
||||||
|
|
||||||
|
public void setTime(long time);
|
||||||
|
|
||||||
|
}
|
|
@ -11,11 +11,13 @@
|
||||||
package com.minres.scviewer.database.ui;
|
package com.minres.scviewer.database.ui;
|
||||||
|
|
||||||
import java.beans.PropertyChangeListener;
|
import java.beans.PropertyChangeListener;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.eclipse.jface.viewers.ISelection;
|
import org.eclipse.jface.viewers.ISelection;
|
||||||
import org.eclipse.jface.viewers.ISelectionChangedListener;
|
import org.eclipse.jface.viewers.ISelectionChangedListener;
|
||||||
import org.eclipse.jface.viewers.ISelectionProvider;
|
import org.eclipse.jface.viewers.ISelectionProvider;
|
||||||
|
import org.eclipse.swt.graphics.RGB;
|
||||||
import org.eclipse.swt.widgets.Control;
|
import org.eclipse.swt.widgets.Control;
|
||||||
|
|
||||||
import com.minres.scviewer.database.IWaveform;
|
import com.minres.scviewer.database.IWaveform;
|
||||||
|
@ -25,62 +27,65 @@ public interface IWaveformViewer extends PropertyChangeListener, ISelectionProvi
|
||||||
String CURSOR_PROPERTY = "cursor_time";
|
String CURSOR_PROPERTY = "cursor_time";
|
||||||
String MARKER_PROPERTY = "marker_time";
|
String MARKER_PROPERTY = "marker_time";
|
||||||
|
|
||||||
void addSelectionChangedListener(ISelectionChangedListener listener);
|
public void addSelectionChangedListener(ISelectionChangedListener listener);
|
||||||
|
|
||||||
void removeSelectionChangedListener(ISelectionChangedListener listener);
|
public void removeSelectionChangedListener(ISelectionChangedListener listener);
|
||||||
|
|
||||||
Control getControl();
|
public Control getControl();
|
||||||
|
|
||||||
Control getNameControl();
|
public Control getNameControl();
|
||||||
|
|
||||||
Control getValueControl();
|
public Control getValueControl();
|
||||||
|
|
||||||
Control getWaveformControl();
|
public Control getWaveformControl();
|
||||||
|
|
||||||
ISelection getSelection();
|
public ISelection getSelection();
|
||||||
|
|
||||||
void setSelection(ISelection selection);
|
public void setSelection(ISelection selection);
|
||||||
|
|
||||||
void setSelection(ISelection selection, boolean addIfNeeded);
|
public void setSelection(ISelection selection, boolean addIfNeeded);
|
||||||
|
|
||||||
void moveSelection(GotoDirection direction);
|
public void moveSelection(GotoDirection direction);
|
||||||
|
|
||||||
void moveCursor(GotoDirection direction);
|
public void moveCursor(GotoDirection direction);
|
||||||
|
|
||||||
List<TrackEntry> getStreamList();
|
public List<TrackEntry> getStreamList();
|
||||||
|
|
||||||
public TrackEntry getEntryForStream(IWaveform<?> source);
|
public TrackEntry getEntryForStream(IWaveform<?> source);
|
||||||
|
|
||||||
void moveSelected(int i);
|
public void moveSelected(int i);
|
||||||
|
|
||||||
long getMaxTime();
|
public long getMaxTime();
|
||||||
|
|
||||||
void setMaxTime(long maxTime);
|
public void setMaxTime(long maxTime);
|
||||||
|
|
||||||
void setZoomLevel(int scale);
|
public void setZoomLevel(int scale);
|
||||||
|
|
||||||
int getZoomLevel();
|
public int getZoomLevel();
|
||||||
|
|
||||||
void setCursorTime(long time);
|
public void setCursorTime(long time);
|
||||||
|
|
||||||
void setMarkerTime(long time, int index);
|
public void setMarkerTime(long time, int index);
|
||||||
|
|
||||||
long getCursorTime();
|
public long getCursorTime();
|
||||||
|
|
||||||
long getActMarkerTime();
|
public long getSelectedMarkerTime();
|
||||||
|
|
||||||
long getMarkerTime(int index);
|
public long getMarkerTime(int index);
|
||||||
|
|
||||||
void addPropertyChangeListener(PropertyChangeListener listener);
|
public void addPropertyChangeListener(PropertyChangeListener listener);
|
||||||
|
|
||||||
void addPropertyChangeListener(String propertyName, PropertyChangeListener listener);
|
public void addPropertyChangeListener(String propertyName, PropertyChangeListener listener);
|
||||||
|
|
||||||
void removePropertyChangeListener(PropertyChangeListener listener);
|
public void removePropertyChangeListener(PropertyChangeListener listener);
|
||||||
|
|
||||||
void removePropertyChangeListener(String propertyName, PropertyChangeListener listener);
|
public void removePropertyChangeListener(String propertyName, PropertyChangeListener listener);
|
||||||
|
|
||||||
String getScaledTime(long time);
|
public String getScaledTime(long time);
|
||||||
|
|
||||||
String[] getZoomLevels();
|
public String[] getZoomLevels();
|
||||||
|
|
||||||
|
public List<ICursor> getCursorList();
|
||||||
|
|
||||||
|
public void setColors(HashMap<WaveformColors, RGB> colourMap);
|
||||||
}
|
}
|
|
@ -0,0 +1,20 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2015 MINRES Technologies GmbH and others.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* MINRES Technologies GmbH - initial API and implementation
|
||||||
|
*******************************************************************************/
|
||||||
|
package com.minres.scviewer.database.ui;
|
||||||
|
|
||||||
|
public enum WaveformColors {
|
||||||
|
LINE, LINE_HIGHLITE,
|
||||||
|
TRACK_BG_EVEN, TRACK_BG_ODD, TRACK_BG_HIGHLITE,
|
||||||
|
TX_BG, TX_BG_HIGHLITE, TX_BORDER,
|
||||||
|
SIGNAL0, SIGNAL1, SIGNALZ, SIGNALX, SIGNAL_TEXT,
|
||||||
|
CURSOR, CURSOR_DRAG, CURSOR_TEXT,
|
||||||
|
MARKER, MARKER_TEXT
|
||||||
|
}
|
|
@ -70,6 +70,9 @@
|
||||||
</children>
|
</children>
|
||||||
</children>
|
</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: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 xsi:type="menu:HandledMenuItem" xmi:id="_95QGxXNmEeWBq8z1Dv39LA" label="About" command="_95PfxnNmEeWBq8z1Dv39LA"/>
|
||||||
</children>
|
</children>
|
||||||
|
@ -117,13 +120,13 @@
|
||||||
</children>
|
</children>
|
||||||
</trimBars>
|
</trimBars>
|
||||||
<trimBars xmi:id="_JHMt8HS8EeWBq8z1Dv39LA" elementId="org.eclipse.ui.trim.status" side="Bottom">
|
<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.WaveStatusBarControl">
|
<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>
|
<tags>stretch</tags>
|
||||||
</children>
|
</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.StatusBarControl">
|
<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>
|
<tags>Draggable</tags>
|
||||||
</children>
|
</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.StatusBarControl">
|
<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>
|
<tags>Draggable</tags>
|
||||||
</children>
|
</children>
|
||||||
</trimBars>
|
</trimBars>
|
||||||
|
@ -133,6 +136,7 @@
|
||||||
<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="_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="_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="_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"/>
|
||||||
<bindingTables xmi:id="_95PfvnNmEeWBq8z1Dv39LA" bindingContext="_95PfuXNmEeWBq8z1Dv39LA">
|
<bindingTables xmi:id="_95PfvnNmEeWBq8z1Dv39LA" bindingContext="_95PfuXNmEeWBq8z1Dv39LA">
|
||||||
<bindings xmi:id="_95Pfv3NmEeWBq8z1Dv39LA" keySequence="M1+Q" command="_95PfvHNmEeWBq8z1Dv39LA"/>
|
<bindings xmi:id="_95Pfv3NmEeWBq8z1Dv39LA" keySequence="M1+Q" command="_95PfvHNmEeWBq8z1Dv39LA"/>
|
||||||
<bindings xmi:id="_95PfwnNmEeWBq8z1Dv39LA" keySequence="M1+O" command="_95PfwHNmEeWBq8z1Dv39LA"/>
|
<bindings xmi:id="_95PfwnNmEeWBq8z1Dv39LA" keySequence="M1+O" command="_95PfwHNmEeWBq8z1Dv39LA"/>
|
||||||
|
@ -207,6 +211,7 @@
|
||||||
<parameters xmi:id="_6KsZcHr9EeWVM_sKoXvptg" elementId="com.minres.scviewer.e4.application.command.addwaveform.where" name="where" optional="false"/>
|
<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"/>
|
<parameters xmi:id="_7T1TcHwIEeWv0Y5uF2QN5w" elementId="com.minres.scviewer.e4.application.command.addwaveform.all" name="all" typeId="" optional="false"/>
|
||||||
</commands>
|
</commands>
|
||||||
|
<commands xmi:id="_AxH6sIl_EeWxJ_wPkM6yGQ" elementId="org.eclipse.ui.window.preferences" commandName="Preferences"/>
|
||||||
<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="_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="_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="_95PftHNmEeWBq8z1Dv39LA" elementId="org.eclipse.e4.ui.bindings.service" contributionURI="bundleclass://org.eclipse.e4.ui.bindings/org.eclipse.e4.ui.bindings.BindingServiceAddon"/>
|
||||||
|
@ -214,4 +219,5 @@
|
||||||
<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="_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="_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="_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>
|
</application:Application>
|
||||||
|
|
|
@ -15,6 +15,7 @@ Require-Bundle: javax.inject;bundle-version="1.0.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;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",
|
||||||
|
@ -27,7 +28,9 @@ Require-Bundle: javax.inject;bundle-version="1.0.0",
|
||||||
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",
|
||||||
com.minres.scviewer.database.ui
|
org.eclipse.e4.ui.workbench.addons.swt,
|
||||||
|
com.opcoach.e4.preferences,
|
||||||
|
org.eclipse.e4.core.di.extensions
|
||||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
|
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
|
||||||
Import-Package: com.minres.scviewer.database,
|
Import-Package: com.minres.scviewer.database,
|
||||||
javax.inject;version="1.0.0"
|
javax.inject;version="1.0.0"
|
||||||
|
|
|
@ -64,5 +64,25 @@
|
||||||
</with>
|
</with>
|
||||||
</definition>
|
</definition>
|
||||||
</extension>
|
</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>
|
||||||
|
|
||||||
</plugin>
|
</plugin>
|
||||||
|
|
|
@ -1,3 +1,13 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* 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;
|
package com.minres.scviewer.e4.application.handlers;
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* MINRES Technologies GmbH - initial API and implementation
|
* MINRES Technologies GmbH - initial API and implementation
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package com.minres.scviewer.e4.application.internal;
|
package com.minres.scviewer.e4.application.internal.status;
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
|
|
||||||
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
|
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
|
|
@ -8,7 +8,7 @@
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* MINRES Technologies GmbH - initial API and implementation
|
* MINRES Technologies GmbH - initial API and implementation
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package com.minres.scviewer.e4.application.internal;
|
package com.minres.scviewer.e4.application.internal.status;
|
||||||
/**
|
/**
|
||||||
* Preference constants for the heap status.
|
* Preference constants for the heap status.
|
||||||
*
|
*
|
|
@ -8,7 +8,7 @@
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* MINRES Technologies GmbH - initial API and implementation
|
* MINRES Technologies GmbH - initial API and implementation
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package com.minres.scviewer.e4.application.internal;
|
package com.minres.scviewer.e4.application.internal.status;
|
||||||
|
|
||||||
import javax.annotation.PostConstruct;
|
import javax.annotation.PostConstruct;
|
||||||
import javax.annotation.PreDestroy;
|
import javax.annotation.PreDestroy;
|
|
@ -8,7 +8,7 @@
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* MINRES Technologies GmbH - initial API and implementation
|
* MINRES Technologies GmbH - initial API and implementation
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package com.minres.scviewer.e4.application.internal;
|
package com.minres.scviewer.e4.application.internal.status;
|
||||||
import org.eclipse.jface.dialogs.Dialog;
|
import org.eclipse.jface.dialogs.Dialog;
|
||||||
import org.eclipse.jface.resource.JFaceResources;
|
import org.eclipse.jface.resource.JFaceResources;
|
||||||
import org.eclipse.swt.SWT;
|
import org.eclipse.swt.SWT;
|
|
@ -8,7 +8,7 @@
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* MINRES Technologies GmbH - initial API and implementation
|
* MINRES Technologies GmbH - initial API and implementation
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package com.minres.scviewer.e4.application.internal;
|
package com.minres.scviewer.e4.application.internal.status;
|
||||||
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import javax.inject.Named;
|
import javax.inject.Named;
|
|
@ -0,0 +1,143 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
* @author Pascal Essiembre
|
||||||
|
*/
|
||||||
|
public class FileMonitor {
|
||||||
|
|
||||||
|
private Timer timer;
|
||||||
|
|
||||||
|
private Hashtable<String, FileSetMonitorTask> timerEntries;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor.
|
||||||
|
*/
|
||||||
|
public FileMonitor() {
|
||||||
|
// Create timer, run timer thread as daemon.
|
||||||
|
timer = new Timer(true);
|
||||||
|
timerEntries = new Hashtable<String, FileSetMonitorTask>();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds a monitored file with a FileChangeListener.
|
||||||
|
*
|
||||||
|
* @param listener
|
||||||
|
* listener to notify when the file changed.
|
||||||
|
* @param fileName
|
||||||
|
* name of the file to monitor.
|
||||||
|
* @param period
|
||||||
|
* polling period in milliseconds.
|
||||||
|
*/
|
||||||
|
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 fileName
|
||||||
|
* name of the file to monitor.
|
||||||
|
* @param period
|
||||||
|
* polling period in milliseconds.
|
||||||
|
*/
|
||||||
|
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) {
|
||||||
|
listener.fileChanged(file);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* File monitoring task.
|
||||||
|
*/
|
||||||
|
class FileSetMonitorTask extends TimerTask implements IModificationChecker{
|
||||||
|
|
||||||
|
IFileChangeListener listener;
|
||||||
|
|
||||||
|
private List<File> monitoredFiles;
|
||||||
|
|
||||||
|
private List<Long> lastModifiedTimes;
|
||||||
|
|
||||||
|
public final long 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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void run() {
|
||||||
|
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,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.internal.util;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Listener interested in {@link File} changes.
|
||||||
|
*
|
||||||
|
* @author Pascal Essiembre
|
||||||
|
*/
|
||||||
|
public interface IFileChangeListener {
|
||||||
|
/**
|
||||||
|
* Invoked when a file changes.
|
||||||
|
*
|
||||||
|
* @param fileName
|
||||||
|
* name of changed file.
|
||||||
|
*/
|
||||||
|
public void fileChanged(List<File> file);
|
||||||
|
}
|
|
@ -0,0 +1,17 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* 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;
|
||||||
|
|
||||||
|
public interface IModificationChecker {
|
||||||
|
|
||||||
|
public void check();
|
||||||
|
|
||||||
|
}
|
|
@ -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.parts;
|
||||||
|
|
||||||
|
import org.eclipse.e4.ui.model.application.ui.basic.MPart;
|
||||||
|
import org.eclipse.e4.ui.workbench.modeling.IPartListener;
|
||||||
|
|
||||||
|
public class PartListener implements IPartListener {
|
||||||
|
@Override
|
||||||
|
public void partBroughtToTop(MPart part) {}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void partActivated(MPart part) {}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void partDeactivated(MPart part) {}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void partHidden(MPart part) {}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void partVisible(MPart part) {}
|
||||||
|
}
|
|
@ -321,7 +321,7 @@ public class TransactionDetails {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
enum Type {TIMES, PROPS, IN_REL, OUT_REL}
|
enum Type {PROPS, ATTRS, IN_REL, OUT_REL}
|
||||||
|
|
||||||
class TreeNode{
|
class TreeNode{
|
||||||
public Type type;
|
public Type type;
|
||||||
|
@ -334,8 +334,8 @@ public class TransactionDetails {
|
||||||
|
|
||||||
public String toString(){
|
public String toString(){
|
||||||
switch(type){
|
switch(type){
|
||||||
case TIMES: return "Times";
|
case PROPS: return "Properties";
|
||||||
case PROPS: return "Attributes";
|
case ATTRS: return "Attributes";
|
||||||
case IN_REL: return "Incoming relations";
|
case IN_REL: return "Incoming relations";
|
||||||
case OUT_REL: return "Outgoing relations";
|
case OUT_REL: return "Outgoing relations";
|
||||||
}
|
}
|
||||||
|
@ -355,8 +355,8 @@ public class TransactionDetails {
|
||||||
@Override
|
@Override
|
||||||
public Object[] getElements(Object element) {
|
public Object[] getElements(Object element) {
|
||||||
return new Object[]{
|
return new Object[]{
|
||||||
new TreeNode((ITx)element, Type.TIMES),
|
|
||||||
new TreeNode((ITx)element, Type.PROPS),
|
new TreeNode((ITx)element, Type.PROPS),
|
||||||
|
new TreeNode((ITx)element, Type.ATTRS),
|
||||||
new TreeNode((ITx)element, Type.IN_REL),
|
new TreeNode((ITx)element, Type.IN_REL),
|
||||||
new TreeNode((ITx)element, Type.OUT_REL)
|
new TreeNode((ITx)element, Type.OUT_REL)
|
||||||
};
|
};
|
||||||
|
@ -366,11 +366,14 @@ public class TransactionDetails {
|
||||||
public Object[] getChildren(Object element) {
|
public Object[] getChildren(Object element) {
|
||||||
if(element instanceof TreeNode){
|
if(element instanceof TreeNode){
|
||||||
TreeNode propertyHolder=(TreeNode) element;
|
TreeNode propertyHolder=(TreeNode) element;
|
||||||
if(propertyHolder.type == Type.TIMES)
|
if(propertyHolder.type == Type.PROPS){
|
||||||
return new Object[][]{
|
return new Object[][]{
|
||||||
{"Start time", "", timeToString(propertyHolder.element.getBeginTime())},
|
{"Name", "String", propertyHolder.element.getStream().getFullName()},
|
||||||
{"End time", "", timeToString(propertyHolder.element.getEndTime())}};
|
{"Type", "String", propertyHolder.element.getGenerator().getName()},
|
||||||
else if(propertyHolder.type == Type.PROPS)
|
{"Start time", "Time", timeToString(propertyHolder.element.getBeginTime())},
|
||||||
|
{"End time", "Time", timeToString(propertyHolder.element.getEndTime())}
|
||||||
|
};
|
||||||
|
}else if(propertyHolder.type == Type.ATTRS)
|
||||||
return propertyHolder.element.getAttributes().toArray();
|
return propertyHolder.element.getAttributes().toArray();
|
||||||
else if(propertyHolder.type == Type.IN_REL){
|
else if(propertyHolder.type == Type.IN_REL){
|
||||||
Vector<Object[] > res = new Vector<>();
|
Vector<Object[] > res = new Vector<>();
|
||||||
|
|
|
@ -104,7 +104,7 @@ public class WaveformListPart implements ISelectionChangedListener {
|
||||||
attributeFilter = new WaveformAttributeFilter();
|
attributeFilter = new WaveformAttributeFilter();
|
||||||
|
|
||||||
txTableViewer = new TableViewer(parent);
|
txTableViewer = new TableViewer(parent);
|
||||||
txTableViewer.setContentProvider(new TxDbContentProvider());
|
txTableViewer.setContentProvider(new TxDbContentProvider(true));
|
||||||
txTableViewer.setLabelProvider(new TxDbLabelProvider());
|
txTableViewer.setLabelProvider(new TxDbLabelProvider());
|
||||||
txTableViewer.getTable().setLayoutData(new GridData(GridData.FILL_BOTH));
|
txTableViewer.getTable().setLayoutData(new GridData(GridData.FILL_BOTH));
|
||||||
txTableViewer.addSelectionChangedListener(this);
|
txTableViewer.addSelectionChangedListener(this);
|
||||||
|
@ -240,7 +240,7 @@ public class WaveformListPart implements ISelectionChangedListener {
|
||||||
if(part!=null && part.getObject() != this && selection!=null){
|
if(part!=null && part.getObject() != this && selection!=null){
|
||||||
if( selection instanceof IStructuredSelection) {
|
if( selection instanceof IStructuredSelection) {
|
||||||
Object object= ((IStructuredSelection)selection).getFirstElement();
|
Object object= ((IStructuredSelection)selection).getFirstElement();
|
||||||
if(object instanceof IHierNode&& !(object instanceof IWaveform<?>))
|
if(object instanceof IHierNode&& ((IHierNode)object).getChildNodes().size()!=0)
|
||||||
txTableViewer.setInput(object);
|
txTableViewer.setInput(object);
|
||||||
otherSelectionCount = (object instanceof IWaveform<?> || object instanceof ITx)?1:0;
|
otherSelectionCount = (object instanceof IWaveform<?> || object instanceof ITx)?1:0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,6 +15,7 @@ import java.beans.PropertyChangeListener;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
@ -32,43 +33,60 @@ import org.eclipse.core.runtime.SubMonitor;
|
||||||
import org.eclipse.core.runtime.jobs.IJobChangeEvent;
|
import org.eclipse.core.runtime.jobs.IJobChangeEvent;
|
||||||
import org.eclipse.core.runtime.jobs.Job;
|
import org.eclipse.core.runtime.jobs.Job;
|
||||||
import org.eclipse.core.runtime.jobs.JobChangeAdapter;
|
import org.eclipse.core.runtime.jobs.JobChangeAdapter;
|
||||||
|
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.e4.core.di.annotations.Optional;
|
import org.eclipse.e4.core.di.annotations.Optional;
|
||||||
|
import org.eclipse.e4.core.di.extensions.Preference;
|
||||||
import org.eclipse.e4.core.services.events.IEventBroker;
|
import org.eclipse.e4.core.services.events.IEventBroker;
|
||||||
import org.eclipse.e4.ui.di.Focus;
|
import org.eclipse.e4.ui.di.Focus;
|
||||||
import org.eclipse.e4.ui.di.PersistState;
|
import org.eclipse.e4.ui.di.PersistState;
|
||||||
import org.eclipse.e4.ui.di.UIEventTopic;
|
import org.eclipse.e4.ui.di.UIEventTopic;
|
||||||
import org.eclipse.e4.ui.model.application.ui.basic.MPart;
|
import org.eclipse.e4.ui.model.application.ui.basic.MPart;
|
||||||
import org.eclipse.e4.ui.services.EMenuService;
|
import org.eclipse.e4.ui.services.EMenuService;
|
||||||
|
import org.eclipse.e4.ui.workbench.modeling.EPartService;
|
||||||
import org.eclipse.e4.ui.workbench.modeling.ESelectionService;
|
import org.eclipse.e4.ui.workbench.modeling.ESelectionService;
|
||||||
import org.eclipse.jface.dialogs.MessageDialog;
|
import org.eclipse.jface.dialogs.MessageDialog;
|
||||||
|
import org.eclipse.jface.resource.StringConverter;
|
||||||
import org.eclipse.jface.viewers.ISelection;
|
import org.eclipse.jface.viewers.ISelection;
|
||||||
import org.eclipse.jface.viewers.ISelectionChangedListener;
|
import org.eclipse.jface.viewers.ISelectionChangedListener;
|
||||||
import org.eclipse.jface.viewers.IStructuredSelection;
|
import org.eclipse.jface.viewers.IStructuredSelection;
|
||||||
import org.eclipse.jface.viewers.SelectionChangedEvent;
|
import org.eclipse.jface.viewers.SelectionChangedEvent;
|
||||||
|
import org.eclipse.swt.graphics.RGB;
|
||||||
import org.eclipse.swt.widgets.Composite;
|
import org.eclipse.swt.widgets.Composite;
|
||||||
|
import org.eclipse.swt.widgets.Display;
|
||||||
|
|
||||||
import com.minres.scviewer.database.ITx;
|
import com.minres.scviewer.database.ITx;
|
||||||
import com.minres.scviewer.database.ITxEvent;
|
|
||||||
import com.minres.scviewer.database.ITxStream;
|
|
||||||
import com.minres.scviewer.database.IWaveform;
|
import com.minres.scviewer.database.IWaveform;
|
||||||
import com.minres.scviewer.database.IWaveformDb;
|
import com.minres.scviewer.database.IWaveformDb;
|
||||||
import com.minres.scviewer.database.IWaveformDbFactory;
|
import com.minres.scviewer.database.IWaveformDbFactory;
|
||||||
import com.minres.scviewer.database.IWaveformEvent;
|
import com.minres.scviewer.database.IWaveformEvent;
|
||||||
import com.minres.scviewer.database.swt.WaveformViewerFactory;
|
import com.minres.scviewer.database.swt.WaveformViewerFactory;
|
||||||
import com.minres.scviewer.database.ui.GotoDirection;
|
import com.minres.scviewer.database.ui.GotoDirection;
|
||||||
|
import com.minres.scviewer.database.ui.ICursor;
|
||||||
import com.minres.scviewer.database.ui.IWaveformViewer;
|
import com.minres.scviewer.database.ui.IWaveformViewer;
|
||||||
import com.minres.scviewer.database.ui.TrackEntry;
|
import com.minres.scviewer.database.ui.TrackEntry;
|
||||||
import com.minres.scviewer.e4.application.internal.WaveStatusBarControl;
|
import com.minres.scviewer.database.ui.WaveformColors;
|
||||||
|
import com.minres.scviewer.e4.application.internal.status.WaveStatusBarControl;
|
||||||
|
import com.minres.scviewer.e4.application.internal.util.FileMonitor;
|
||||||
|
import com.minres.scviewer.e4.application.internal.util.IFileChangeListener;
|
||||||
|
import com.minres.scviewer.e4.application.internal.util.IModificationChecker;
|
||||||
|
import com.minres.scviewer.e4.application.preferences.DefaultValuesInitializer;
|
||||||
|
import com.minres.scviewer.e4.application.preferences.PreferenceConstants;
|
||||||
|
|
||||||
public class WaveformViewerPart {
|
@SuppressWarnings("restriction")
|
||||||
|
public class WaveformViewerPart implements IFileChangeListener, IPreferenceChangeListener {
|
||||||
|
|
||||||
public static final String ACTIVE_WAVEFORMVIEW="Active_Waveform_View";
|
public static final String ACTIVE_WAVEFORMVIEW="Active_Waveform_View";
|
||||||
|
|
||||||
public static final String ADD_WAVEFORM="AddWaveform";
|
public static final String ADD_WAVEFORM="AddWaveform";
|
||||||
|
|
||||||
protected static final String DATABASE_FILE = "DATABASE_FILE";
|
protected static final String DATABASE_FILE = "DATABASE_FILE";
|
||||||
|
|
||||||
protected static final String SHOWN_WAVEFORM = "SHOWN_WAVEFORM";
|
protected static final String SHOWN_WAVEFORM = "SHOWN_WAVEFORM";
|
||||||
|
protected static final String SHOWN_CURSOR = "SHOWN_CURSOR";
|
||||||
|
protected static final String ZOOM_LEVEL = "ZOOM_LEVEL";
|
||||||
|
|
||||||
|
protected static final long FILE_CHECK_INTERVAL=60000;
|
||||||
|
|
||||||
private String[] zoomLevel;
|
private String[] zoomLevel;
|
||||||
|
|
||||||
|
@ -86,17 +104,29 @@ public class WaveformViewerPart {
|
||||||
|
|
||||||
@Inject ESelectionService selectionService;
|
@Inject ESelectionService selectionService;
|
||||||
|
|
||||||
|
@Inject EPartService ePartService;
|
||||||
|
|
||||||
|
@Inject @Preference(nodePath = PreferenceConstants.PREFERENCES_SCOPE) IEclipsePreferences prefs;
|
||||||
|
|
||||||
private IWaveformDb database;
|
private IWaveformDb database;
|
||||||
|
|
||||||
|
private boolean checkForUpdates;
|
||||||
|
|
||||||
|
private MPart myPart;
|
||||||
|
|
||||||
private Composite myParent;
|
private Composite myParent;
|
||||||
|
|
||||||
ArrayList<File> filesToLoad;
|
ArrayList<File> filesToLoad;
|
||||||
|
|
||||||
Map<String, String> persistedState;
|
Map<String, String> persistedState;
|
||||||
|
|
||||||
|
FileMonitor fileMonitor = new FileMonitor();
|
||||||
|
|
||||||
|
IModificationChecker fileChecker;
|
||||||
|
|
||||||
@PostConstruct
|
@PostConstruct
|
||||||
public void createComposite(MPart part, Composite parent, IWaveformDbFactory dbFactory) {
|
public void createComposite(MPart part, Composite parent, IWaveformDbFactory dbFactory) {
|
||||||
|
myPart=part;
|
||||||
myParent=parent;
|
myParent=parent;
|
||||||
database=dbFactory.getDatabase();
|
database=dbFactory.getDatabase();
|
||||||
database.addPropertyChangeListener(new PropertyChangeListener() {
|
database.addPropertyChangeListener(new PropertyChangeListener() {
|
||||||
|
@ -119,7 +149,7 @@ public class WaveformViewerPart {
|
||||||
public void propertyChange(PropertyChangeEvent evt) {
|
public void propertyChange(PropertyChangeEvent evt) {
|
||||||
Long time = (Long) evt.getNewValue();
|
Long time = (Long) evt.getNewValue();
|
||||||
eventBroker.post(WaveStatusBarControl.CURSOR_TIME, waveformPane.getScaledTime(time));
|
eventBroker.post(WaveStatusBarControl.CURSOR_TIME, waveformPane.getScaledTime(time));
|
||||||
long marker=waveformPane.getActMarkerTime();
|
long marker=waveformPane.getSelectedMarkerTime();
|
||||||
eventBroker.post(WaveStatusBarControl.MARKER_DIFF, waveformPane.getScaledTime(time-marker));
|
eventBroker.post(WaveStatusBarControl.MARKER_DIFF, waveformPane.getScaledTime(time-marker));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -141,6 +171,8 @@ public class WaveformViewerPart {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
zoomLevel=waveformPane.getZoomLevels();
|
zoomLevel=waveformPane.getZoomLevels();
|
||||||
|
setupColors();
|
||||||
|
checkForUpdates=prefs.getBoolean(PreferenceConstants.DATABASE_RELOAD, true);
|
||||||
filesToLoad=new ArrayList<File>();
|
filesToLoad=new ArrayList<File>();
|
||||||
persistedState = part.getPersistedState();
|
persistedState = part.getPersistedState();
|
||||||
Integer files = persistedState.containsKey(DATABASE_FILE+"S")?Integer.parseInt(persistedState.get(DATABASE_FILE+"S")):0;
|
Integer files = persistedState.containsKey(DATABASE_FILE+"S")?Integer.parseInt(persistedState.get(DATABASE_FILE+"S")):0;
|
||||||
|
@ -148,14 +180,51 @@ public class WaveformViewerPart {
|
||||||
filesToLoad.add(new File(persistedState.get(DATABASE_FILE+i)));
|
filesToLoad.add(new File(persistedState.get(DATABASE_FILE+i)));
|
||||||
}
|
}
|
||||||
if(filesToLoad.size()>0)
|
if(filesToLoad.size()>0)
|
||||||
loadDatabase();
|
loadDatabase(persistedState);
|
||||||
eventBroker.post(WaveStatusBarControl.ZOOM_LEVEL, zoomLevel[waveformPane.getZoomLevel()]);
|
eventBroker.post(WaveStatusBarControl.ZOOM_LEVEL, zoomLevel[waveformPane.getZoomLevel()]);
|
||||||
menuService.registerContextMenu(waveformPane.getNameControl(), "com.minres.scviewer.e4.application.popupmenu.namecontext");
|
menuService.registerContextMenu(waveformPane.getNameControl(), "com.minres.scviewer.e4.application.popupmenu.namecontext");
|
||||||
menuService.registerContextMenu(waveformPane.getValueControl(), "com.minres.scviewer.e4.application.popupmenu.namecontext");
|
menuService.registerContextMenu(waveformPane.getValueControl(), "com.minres.scviewer.e4.application.popupmenu.namecontext");
|
||||||
menuService.registerContextMenu(waveformPane.getWaveformControl(), "com.minres.scviewer.e4.application.popupmenu.wavecontext");
|
menuService.registerContextMenu(waveformPane.getWaveformControl(), "com.minres.scviewer.e4.application.popupmenu.wavecontext");
|
||||||
|
ePartService.addPartListener(new PartListener(){
|
||||||
|
@Override
|
||||||
|
public void partActivated(MPart part) {
|
||||||
|
if (part == myPart) {
|
||||||
|
if(fileChecker!=null) fileChecker.check();
|
||||||
|
updateAll();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
prefs.addPreferenceChangeListener(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void loadDatabase() {
|
@Override
|
||||||
|
public void preferenceChange(PreferenceChangeEvent event) {
|
||||||
|
if(PreferenceConstants.DATABASE_RELOAD.equals(event.getKey())){
|
||||||
|
checkForUpdates = (Boolean) event.getNewValue();
|
||||||
|
fileChecker=null;
|
||||||
|
if(checkForUpdates)
|
||||||
|
fileChecker=fileMonitor.addFileChangeListener(WaveformViewerPart.this,filesToLoad, FILE_CHECK_INTERVAL);
|
||||||
|
else
|
||||||
|
fileMonitor.removeFileChangeListener(this);
|
||||||
|
} else {
|
||||||
|
setupColors();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void setupColors() {
|
||||||
|
DefaultValuesInitializer initializer = new DefaultValuesInitializer();
|
||||||
|
HashMap<WaveformColors, RGB> colorPref=new HashMap<>();
|
||||||
|
for (WaveformColors c : WaveformColors.values()) {
|
||||||
|
String prefValue=prefs.get(c.name() + "_COLOR",
|
||||||
|
StringConverter.asString(initializer.colors[c.ordinal()].getRGB()));
|
||||||
|
RGB rgb = StringConverter.asRGB(prefValue);
|
||||||
|
colorPref.put(c, rgb);
|
||||||
|
}
|
||||||
|
waveformPane.setColors(colorPref);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void loadDatabase(final Map<String, String> state) {
|
||||||
|
fileMonitor.removeFileChangeListener(this);
|
||||||
Job job = new Job(" My Job") {
|
Job job = new Job(" My Job") {
|
||||||
@Override
|
@Override
|
||||||
protected IStatus run( IProgressMonitor monitor) {
|
protected IStatus run( IProgressMonitor monitor) {
|
||||||
|
@ -189,7 +258,10 @@ public class WaveformViewerPart {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
waveformPane.setMaxTime(database.getMaxTime());
|
waveformPane.setMaxTime(database.getMaxTime());
|
||||||
restoreState();
|
if(state!=null) restoreWaveformViewerState(state);
|
||||||
|
fileChecker=null;
|
||||||
|
if(checkForUpdates) fileChecker=fileMonitor.addFileChangeListener(
|
||||||
|
WaveformViewerPart.this,filesToLoad, FILE_CHECK_INTERVAL);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -197,6 +269,23 @@ public class WaveformViewerPart {
|
||||||
job.schedule(0);
|
job.schedule(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void fileChanged(List<File> file) {
|
||||||
|
final Display display = myParent.getDisplay();
|
||||||
|
display.asyncExec(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
if(MessageDialog.openQuestion(display.getActiveShell(), "Database re-load", "Would you like to reload the database?")){
|
||||||
|
Map<String, String> state = new HashMap<>();
|
||||||
|
saveWaveformViewerState(state);
|
||||||
|
waveformPane.getStreamList().clear();
|
||||||
|
database.clear();
|
||||||
|
if(filesToLoad.size()>0) loadDatabase(state);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
@Optional
|
@Optional
|
||||||
public void setPartInput( @Named( "input" ) Object partInput ) {
|
public void setPartInput( @Named( "input" ) Object partInput ) {
|
||||||
|
@ -222,16 +311,16 @@ public class WaveformViewerPart {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(filesToLoad.size()>0)
|
if(filesToLoad.size()>0)
|
||||||
loadDatabase();
|
loadDatabase(persistedState);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Focus
|
@Focus
|
||||||
public void setFocus() {
|
public void setFocus() {
|
||||||
myParent.setFocus();
|
myParent.setFocus();
|
||||||
updateAll();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@PersistState
|
@PersistState
|
||||||
public void saveState(MPart part) {
|
public void saveState(MPart part) {
|
||||||
// save changes
|
// save changes
|
||||||
|
@ -242,30 +331,57 @@ public class WaveformViewerPart {
|
||||||
persistedState.put(DATABASE_FILE+index, file.getAbsolutePath());
|
persistedState.put(DATABASE_FILE+index, file.getAbsolutePath());
|
||||||
index++;
|
index++;
|
||||||
}
|
}
|
||||||
|
saveWaveformViewerState(persistedState);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void saveWaveformViewerState(Map<String, String> persistedState) {
|
||||||
|
Integer index;
|
||||||
persistedState.put(SHOWN_WAVEFORM+"S", Integer.toString(waveformPane.getStreamList().size()));
|
persistedState.put(SHOWN_WAVEFORM+"S", Integer.toString(waveformPane.getStreamList().size()));
|
||||||
index=0;
|
index=0;
|
||||||
for(TrackEntry trackEntry:waveformPane.getStreamList()){
|
for(TrackEntry trackEntry:waveformPane.getStreamList()){
|
||||||
persistedState.put(SHOWN_WAVEFORM+index, trackEntry.waveform.getFullName());
|
persistedState.put(SHOWN_WAVEFORM+index, trackEntry.waveform.getFullName());
|
||||||
index++;
|
index++;
|
||||||
}
|
}
|
||||||
|
List<ICursor> cursors = waveformPane.getCursorList();
|
||||||
|
persistedState.put(SHOWN_CURSOR+"S", Integer.toString(cursors.size()));
|
||||||
|
index=0;
|
||||||
|
for(ICursor cursor:cursors){
|
||||||
|
persistedState.put(SHOWN_CURSOR+index, Long.toString(cursor.getTime()));
|
||||||
|
index++;
|
||||||
|
}
|
||||||
|
persistedState.put(ZOOM_LEVEL, Integer.toString(waveformPane.getZoomLevel()));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void restoreState() {
|
protected void restoreWaveformViewerState(Map<String, String> state) {
|
||||||
updateAll();
|
updateAll();
|
||||||
Integer waves = persistedState.containsKey(SHOWN_WAVEFORM+"S")?Integer.parseInt(persistedState.get(SHOWN_WAVEFORM+"S")):0;
|
Integer waves = state.containsKey(SHOWN_WAVEFORM+"S")?Integer.parseInt(state.get(SHOWN_WAVEFORM+"S")):0;
|
||||||
List<TrackEntry> res = new LinkedList<>();
|
List<TrackEntry> res = new LinkedList<>();
|
||||||
for(int i=0; i<waves;i++){
|
for(int i=0; i<waves;i++){
|
||||||
IWaveform<? extends IWaveformEvent> waveform = database.getStreamByName(persistedState.get(SHOWN_WAVEFORM+i));
|
IWaveform<? extends IWaveformEvent> waveform = database.getStreamByName(state.get(SHOWN_WAVEFORM+i));
|
||||||
if(waveform!=null) res.add(new TrackEntry(waveform));
|
if(waveform!=null) res.add(new TrackEntry(waveform));
|
||||||
}
|
}
|
||||||
if(res.size()>0) waveformPane.getStreamList().addAll(res);
|
if(res.size()>0) waveformPane.getStreamList().addAll(res);
|
||||||
|
Integer cursorLength = state.containsKey(SHOWN_CURSOR+"S")?Integer.parseInt(state.get(SHOWN_CURSOR+"S")):0;
|
||||||
|
List<ICursor> cursors = waveformPane.getCursorList();
|
||||||
|
if(cursorLength==cursors.size()){
|
||||||
|
for(int i=0; i<cursorLength;i++){
|
||||||
|
Long time = Long.parseLong(state.get(SHOWN_CURSOR+i));
|
||||||
|
cursors.get(i).setTime(time);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(state.containsKey(ZOOM_LEVEL)){
|
||||||
|
try {
|
||||||
|
Integer scale = Integer.parseInt(state.get(ZOOM_LEVEL));
|
||||||
|
waveformPane.setZoomLevel(scale);
|
||||||
|
} catch(NumberFormatException e){}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateAll() {
|
private void updateAll() {
|
||||||
eventBroker.post(ACTIVE_WAVEFORMVIEW, this);
|
eventBroker.post(ACTIVE_WAVEFORMVIEW, this);
|
||||||
eventBroker.post(WaveStatusBarControl.ZOOM_LEVEL, zoomLevel[waveformPane.getZoomLevel()]);
|
eventBroker.post(WaveStatusBarControl.ZOOM_LEVEL, zoomLevel[waveformPane.getZoomLevel()]);
|
||||||
long cursor=waveformPane.getCursorTime();
|
long cursor=waveformPane.getCursorTime();
|
||||||
long marker=waveformPane.getActMarkerTime();
|
long marker=waveformPane.getSelectedMarkerTime();
|
||||||
eventBroker.post(WaveStatusBarControl.CURSOR_TIME, waveformPane.getScaledTime(cursor));
|
eventBroker.post(WaveStatusBarControl.CURSOR_TIME, waveformPane.getScaledTime(cursor));
|
||||||
eventBroker.post(WaveStatusBarControl.MARKER_TIME, waveformPane.getScaledTime(marker));
|
eventBroker.post(WaveStatusBarControl.MARKER_TIME, waveformPane.getScaledTime(marker));
|
||||||
eventBroker.post(WaveStatusBarControl.MARKER_DIFF, waveformPane.getScaledTime(cursor-marker));
|
eventBroker.post(WaveStatusBarControl.MARKER_DIFF, waveformPane.getScaledTime(cursor-marker));
|
||||||
|
@ -281,15 +397,7 @@ public class WaveformViewerPart {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
@Inject
|
|
||||||
public void setWaveform(@Optional @Named( IServiceConstants.ACTIVE_SELECTION) IWaveform<?> waveform,
|
|
||||||
@Optional @Named( IServiceConstants.ACTIVE_PART) MPart part) {
|
|
||||||
if (txDisplay!= null && part.getObject()!=this) {
|
|
||||||
txDisplay.setSelection(waveform==null?new StructuredSelection():new StructuredSelection(waveform));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
protected boolean askIfToLoad(File txFile) {
|
protected boolean askIfToLoad(File txFile) {
|
||||||
if(txFile.exists() &&
|
if(txFile.exists() &&
|
||||||
MessageDialog.openQuestion(myParent.getDisplay().getActiveShell(), "Database open",
|
MessageDialog.openQuestion(myParent.getDisplay().getActiveShell(), "Database open",
|
||||||
|
@ -394,4 +502,5 @@ public class WaveformViewerPart {
|
||||||
public String getScaledTime(Long time) {
|
public String getScaledTime(Long time) {
|
||||||
return waveformPane.getScaledTime(time);
|
return waveformPane.getScaledTime(time);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -0,0 +1,60 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* 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.InstanceScope;
|
||||||
|
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;
|
||||||
|
|
||||||
|
public class DefaultValuesInitializer extends AbstractPreferenceInitializer {
|
||||||
|
|
||||||
|
public final Color[] colors = new Color[WaveformColors.values().length];
|
||||||
|
|
||||||
|
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_DARK_GREEN);
|
||||||
|
colors[WaveformColors.SIGNAL1.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_DARK_GREEN);
|
||||||
|
colors[WaveformColors.SIGNALZ.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_GRAY);
|
||||||
|
colors[WaveformColors.SIGNALX.ordinal()] = SWTResourceManager.getColor(255, 128, 182);
|
||||||
|
colors[WaveformColors.SIGNAL_TEXT.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_WHITE);
|
||||||
|
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);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void initializeDefaultPreferences() {
|
||||||
|
IPreferenceStore store = new ScopedPreferenceStore(InstanceScope.INSTANCE, PreferenceConstants.PREFERENCES_SCOPE);
|
||||||
|
|
||||||
|
store.setDefault(PreferenceConstants.DATABASE_RELOAD, true);
|
||||||
|
for (WaveformColors c : WaveformColors.values()) {
|
||||||
|
store.setDefault(c.name()+"_COLOR", StringConverter.asString(colors[c.ordinal()].getRGB()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,37 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* 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;
|
||||||
|
|
||||||
|
public class PreferenceConstants {
|
||||||
|
|
||||||
|
public static final String PREFERENCES_SCOPE="com.minres.scviewer.e4.application";
|
||||||
|
public static final String DATABASE_RELOAD="databaseReload";
|
||||||
|
public static final String LINE_COLOR="LINE_COLOR";
|
||||||
|
public static final String LINE_HIGHLITE_COLOR="LINE_HIGHLITE_COLOR";
|
||||||
|
public static final String TRACK_BG_EVEN_COLOR="TRACK_BG_EVEN_COLOR";
|
||||||
|
public static final String TRACK_BG_ODD_COLOR="TRACK_BG_ODD_COLOR";
|
||||||
|
public static final String TRACK_BG_HIGHLITE_COLOR="TRACK_BG_HIGHLITE_COLOR";
|
||||||
|
public static final String TX_BG_COLOR="TX_BG_COLOR";
|
||||||
|
public static final String TX_BG_HIGHLITE_COLOR="TX_BG_HIGHLITE_COLOR";
|
||||||
|
public static final String TX_BORDER_COLOR="TX_BORDER_COLOR";
|
||||||
|
public static final String SIGNAL0_COLOR="SIGNAL0_COLOR";
|
||||||
|
public static final String SIGNAL1_COLOR="SIGNAL1_COLOR";
|
||||||
|
public static final String SIGNALZ_COLOR="SIGNALZ_COLOR";
|
||||||
|
public static final String SIGNALX_COLOR="SIGNALX_COLOR";
|
||||||
|
public static final String SIGNAL_TEXT_COLOR="SIGNAL_TEXT_COLOR";
|
||||||
|
public static final String CURSOR_COLOR="CURSOR_COLOR";
|
||||||
|
public static final String CURSOR_DRAG_COLOR="CURSOR_DRAG_COLOR";
|
||||||
|
public static final String CURSOR_TEXT_COLOR="CURSOR_TEXT_COLOR";
|
||||||
|
public static final String MARKER_COLOR="MARKER_COLOR";
|
||||||
|
public static final String MARKER_TEXT_COLOR="MARKER_TEXT_COLOR";
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -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.preferences;
|
||||||
|
|
||||||
|
import org.eclipse.jface.preference.BooleanFieldEditor;
|
||||||
|
import org.eclipse.jface.preference.FieldEditorPreferencePage;
|
||||||
|
|
||||||
|
/** A sample preference page to show how it works */
|
||||||
|
public class SCViewerPreferencesPage extends FieldEditorPreferencePage {
|
||||||
|
|
||||||
|
public SCViewerPreferencesPage() {
|
||||||
|
super(GRID);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void createFieldEditors() {
|
||||||
|
|
||||||
|
addField(new BooleanFieldEditor(PreferenceConstants.DATABASE_RELOAD, "Check for changed database",
|
||||||
|
getFieldEditorParent()));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,34 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* 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;
|
||||||
|
|
||||||
|
/** A sample preference page to show how it works */
|
||||||
|
public class WaveformPreferencesPage extends FieldEditorPreferencePage {
|
||||||
|
|
||||||
|
public WaveformPreferencesPage() {
|
||||||
|
super(GRID);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void createFieldEditors() {
|
||||||
|
|
||||||
|
for (WaveformColors c : WaveformColors.values()) {
|
||||||
|
addField(new ColorFieldEditor(c.name() + "_COLOR", "Color for " + c.name().toLowerCase(),
|
||||||
|
getFieldEditorParent()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -10,6 +10,7 @@
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package com.minres.scviewer.e4.application.provider;
|
package com.minres.scviewer.e4.application.provider;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.eclipse.jface.viewers.ITreeContentProvider;
|
import org.eclipse.jface.viewers.ITreeContentProvider;
|
||||||
|
@ -23,25 +24,40 @@ import com.minres.scviewer.database.IWaveform;
|
||||||
public class TxDbContentProvider implements ITreeContentProvider {
|
public class TxDbContentProvider implements ITreeContentProvider {
|
||||||
|
|
||||||
// private List<HierNode> nodes;
|
// private List<HierNode> nodes;
|
||||||
private boolean showNodes=false;
|
private boolean showNodes;
|
||||||
|
|
||||||
|
public TxDbContentProvider() {
|
||||||
|
super();
|
||||||
|
this.showNodes = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public TxDbContentProvider(boolean showNodes) {
|
||||||
|
super();
|
||||||
|
this.showNodes = showNodes;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void dispose() { }
|
public void dispose() { }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
|
public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
|
||||||
showNodes=!(newInput instanceof IHierNode);
|
// showNodes=!(newInput instanceof IHierNode);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object[] getElements(Object inputElement) {
|
public Object[] getElements(Object inputElement) {
|
||||||
if(inputElement instanceof IHierNode){
|
if(inputElement instanceof IHierNode){
|
||||||
return Collections2.filter(((IHierNode)inputElement).getChildNodes(), new Predicate<IHierNode>(){
|
Collection<IHierNode> res = Collections2.filter(((IHierNode)inputElement).getChildNodes(), new Predicate<IHierNode>(){
|
||||||
@Override
|
@Override
|
||||||
public boolean apply(IHierNode arg0) {
|
public boolean apply(IHierNode arg0) {
|
||||||
return (arg0 instanceof IWaveform<?>)!=showNodes;
|
if(showNodes){
|
||||||
|
return arg0 instanceof IWaveform<?>;
|
||||||
|
} else{
|
||||||
|
return arg0.getChildNodes().size()!=0;
|
||||||
}
|
}
|
||||||
}).toArray();
|
}
|
||||||
|
});
|
||||||
|
return res.toArray();
|
||||||
}else if(inputElement instanceof List<?>)
|
}else if(inputElement instanceof List<?>)
|
||||||
return ((List<?>)inputElement).toArray();
|
return ((List<?>)inputElement).toArray();
|
||||||
else
|
else
|
||||||
|
@ -60,7 +76,6 @@ public class TxDbContentProvider implements ITreeContentProvider {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean hasChildren(Object element) {
|
public boolean hasChildren(Object element) {
|
||||||
// Object[] obj = getChildren(element);
|
|
||||||
Object[] obj = getElements(element);
|
Object[] obj = getElements(element);
|
||||||
return obj == null ? false : obj.length > 0;
|
return obj == null ? false : obj.length > 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2011 Google, Inc.
|
* Copyright (c) 2015 MINRES Technologies GmbH and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Google, Inc. - initial API and implementation
|
* MINRES Technologies GmbH - initial API and implementation
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.wb.swt;
|
package org.eclipse.wb.swt;
|
||||||
|
|
||||||
|
|
|
@ -16,14 +16,14 @@
|
||||||
<stringAttribute key="location" value="${workspace_loc}/../runtime-com.minres.scviewer.e4.application.product"/>
|
<stringAttribute key="location" value="${workspace_loc}/../runtime-com.minres.scviewer.e4.application.product"/>
|
||||||
<booleanAttribute key="org.eclipse.jdt.launching.ATTR_USE_START_ON_FIRST_THREAD" value="true"/>
|
<booleanAttribute key="org.eclipse.jdt.launching.ATTR_USE_START_ON_FIRST_THREAD" value="true"/>
|
||||||
<stringAttribute key="org.eclipse.jdt.launching.JRE_CONTAINER" value="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
|
<stringAttribute key="org.eclipse.jdt.launching.JRE_CONTAINER" value="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
|
||||||
<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-os ${target.os} -ws ${target.ws} -arch ${target.arch} -nl ${target.nl} -consoleLog -clearPersistedState /Users/eyck/Workspaces/SCViewer/scv_tr_sqlite/my_db.vcd"/>
|
<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-os ${target.os} -ws ${target.ws} -arch ${target.arch} -nl ${target.nl} -consoleLog -clearPersistedState /Users/eyck/Workspaces/cpp/tlm_router01/top.txlog"/>
|
||||||
<stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.pde.ui.workbenchClasspathProvider"/>
|
<stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.pde.ui.workbenchClasspathProvider"/>
|
||||||
<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Xms40m -Xmx512m -Xdock:icon=../Resources/Eclipse.icns -XstartOnFirstThread -Dorg.eclipse.swt.internal.carbon.smallFonts"/>
|
<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Xms40m -Xmx512m -Xdock:icon=../Resources/Eclipse.icns -XstartOnFirstThread -Dorg.eclipse.swt.internal.carbon.smallFonts"/>
|
||||||
<stringAttribute key="pde.version" value="3.3"/>
|
<stringAttribute key="pde.version" value="3.3"/>
|
||||||
<stringAttribute key="product" value="com.minres.scviewer.e4.application.product"/>
|
<stringAttribute key="product" value="com.minres.scviewer.e4.application.product"/>
|
||||||
<stringAttribute key="productFile" value="/com.minres.scviewer.e4.application/com.minres.scviewer.e4.application.product"/>
|
<stringAttribute key="productFile" value="/com.minres.scviewer.e4.application/com.minres.scviewer.e4.application.product"/>
|
||||||
<stringAttribute key="selected_target_plugins" value="com.google.guava@default:default,com.ibm.icu@default:default,javax.annotation@default:default,javax.inject@default:default,javax.servlet@default:default,javax.xml@default:default,org.apache.ant@default:default,org.apache.batik.css@default:default,org.apache.batik.util.gui@default:default,org.apache.batik.util@default:default,org.apache.commons.jxpath@default:default,org.apache.commons.logging@default:default,org.apache.felix.gogo.command@default:default,org.apache.felix.gogo.runtime@default:default,org.apache.felix.gogo.shell@default:default,org.codehaus.groovy@default:default,org.eclipse.ant.core@default:default,org.eclipse.compare.core@default:default,org.eclipse.core.commands@default:default,org.eclipse.core.contenttype@default:default,org.eclipse.core.databinding.beans@default:default,org.eclipse.core.databinding.observable@default:default,org.eclipse.core.databinding.property@default:default,org.eclipse.core.databinding@default:default,org.eclipse.core.expressions@default:default,org.eclipse.core.filesystem.java7@default:false,org.eclipse.core.filesystem.macosx@default:false,org.eclipse.core.filesystem@default:default,org.eclipse.core.jobs@default:default,org.eclipse.core.resources@default:default,org.eclipse.core.runtime.compatibility.registry@default:false,org.eclipse.core.runtime@default:true,org.eclipse.core.variables@default:default,org.eclipse.e4.core.commands@default:default,org.eclipse.e4.core.contexts@default:default,org.eclipse.e4.core.di.annotations@default:default,org.eclipse.e4.core.di.extensions@default:default,org.eclipse.e4.core.di@default:default,org.eclipse.e4.core.services@default:default,org.eclipse.e4.emf.xpath@default:default,org.eclipse.e4.ui.bindings@default:default,org.eclipse.e4.ui.css.core@default:default,org.eclipse.e4.ui.css.swt.theme@default:default,org.eclipse.e4.ui.css.swt@default:default,org.eclipse.e4.ui.di@default:default,org.eclipse.e4.ui.model.workbench@default:default,org.eclipse.e4.ui.services@default:default,org.eclipse.e4.ui.widgets@default:default,org.eclipse.e4.ui.workbench.addons.swt@default:default,org.eclipse.e4.ui.workbench.renderers.swt.cocoa@default:false,org.eclipse.e4.ui.workbench.renderers.swt@default:default,org.eclipse.e4.ui.workbench.swt@default:default,org.eclipse.e4.ui.workbench3@default:default,org.eclipse.e4.ui.workbench@default:default,org.eclipse.emf.common@default:default,org.eclipse.emf.ecore.change@default:default,org.eclipse.emf.ecore.xmi@default:default,org.eclipse.emf.ecore@default:default,org.eclipse.equinox.app@default:default,org.eclipse.equinox.bidi@default:default,org.eclipse.equinox.common@2:true,org.eclipse.equinox.concurrent@default:default,org.eclipse.equinox.console@default:default,org.eclipse.equinox.ds@1:true,org.eclipse.equinox.event@default:default,org.eclipse.equinox.preferences@default:default,org.eclipse.equinox.registry@default:default,org.eclipse.equinox.util@default:default,org.eclipse.help@default:default,org.eclipse.jface.databinding@default:default,org.eclipse.jface.text@default:default,org.eclipse.jface@default:default,org.eclipse.osgi.compatibility.state@default:false,org.eclipse.osgi.services@default:default,org.eclipse.osgi@-1:true,org.eclipse.swt.cocoa.macosx.x86_64@default:false,org.eclipse.swt@default:default,org.eclipse.team.core@default:default,org.eclipse.text@default:default,org.eclipse.ui.cocoa@default:false,org.eclipse.ui.console@default:default,org.eclipse.ui.workbench.texteditor@default:default,org.eclipse.ui.workbench@default:default,org.eclipse.ui@default:default,org.hamcrest.core@default:default,org.junit@default:default,org.w3c.css.sac@default:default,org.w3c.dom.events@default:default,org.w3c.dom.smil@default:default,org.w3c.dom.svg@default:default"/>
|
<stringAttribute key="selected_target_plugins" value="com.google.guava@default:default,com.ibm.icu@default:default,javax.annotation@default:default,javax.inject@default:default,javax.servlet@default:default,javax.xml@default:default,org.apache.ant@default:default,org.apache.batik.css@default:default,org.apache.batik.util.gui@default:default,org.apache.batik.util@default:default,org.apache.commons.jxpath@default:default,org.apache.commons.logging@default:default,org.apache.felix.gogo.command@default:default,org.apache.felix.gogo.runtime@default:default,org.apache.felix.gogo.shell@default:default,org.codehaus.groovy@default:default,org.eclipse.ant.core@default:default,org.eclipse.compare.core@default:default,org.eclipse.core.commands@default:default,org.eclipse.core.contenttype@default:default,org.eclipse.core.databinding.beans@default:default,org.eclipse.core.databinding.observable@default:default,org.eclipse.core.databinding.property@default:default,org.eclipse.core.databinding@default:default,org.eclipse.core.expressions@default:default,org.eclipse.core.filesystem.java7@default:false,org.eclipse.core.filesystem.macosx@default:false,org.eclipse.core.filesystem@default:default,org.eclipse.core.jobs@default:default,org.eclipse.core.resources@default:default,org.eclipse.core.runtime.compatibility.registry@default:false,org.eclipse.core.runtime@default:true,org.eclipse.core.variables@default:default,org.eclipse.e4.core.commands@default:default,org.eclipse.e4.core.contexts@default:default,org.eclipse.e4.core.di.annotations@default:default,org.eclipse.e4.core.di.extensions@default:default,org.eclipse.e4.core.di@default:default,org.eclipse.e4.core.services@default:default,org.eclipse.e4.emf.xpath@default:default,org.eclipse.e4.ui.bindings@default:default,org.eclipse.e4.ui.css.core@default:default,org.eclipse.e4.ui.css.swt.theme@default:default,org.eclipse.e4.ui.css.swt@default:default,org.eclipse.e4.ui.di@default:default,org.eclipse.e4.ui.model.workbench@default:default,org.eclipse.e4.ui.services@default:default,org.eclipse.e4.ui.widgets@default:default,org.eclipse.e4.ui.workbench.addons.swt@default:default,org.eclipse.e4.ui.workbench.renderers.swt.cocoa@default:false,org.eclipse.e4.ui.workbench.renderers.swt@default:default,org.eclipse.e4.ui.workbench.swt@default:default,org.eclipse.e4.ui.workbench3@default:default,org.eclipse.e4.ui.workbench@default:default,org.eclipse.emf.common@default:default,org.eclipse.emf.ecore.change@default:default,org.eclipse.emf.ecore.xmi@default:default,org.eclipse.emf.ecore@default:default,org.eclipse.equinox.app@default:default,org.eclipse.equinox.bidi@default:default,org.eclipse.equinox.common@2:true,org.eclipse.equinox.concurrent@default:default,org.eclipse.equinox.console@default:default,org.eclipse.equinox.ds@1:true,org.eclipse.equinox.event@default:default,org.eclipse.equinox.preferences@default:default,org.eclipse.equinox.registry@default:default,org.eclipse.equinox.util@default:default,org.eclipse.help@default:default,org.eclipse.jface.databinding@default:default,org.eclipse.jface.text@default:default,org.eclipse.jface@default:default,org.eclipse.osgi.compatibility.state@default:false,org.eclipse.osgi.services@default:default,org.eclipse.osgi@-1:true,org.eclipse.swt.cocoa.macosx.x86_64@default:false,org.eclipse.swt@default:default,org.eclipse.team.core@default:default,org.eclipse.text@default:default,org.eclipse.ui.cocoa@default:false,org.eclipse.ui.console@default:default,org.eclipse.ui.workbench.texteditor@default:default,org.eclipse.ui.workbench@default:default,org.eclipse.ui@default:default,org.hamcrest.core@default:default,org.junit@default:default,org.w3c.css.sac@default:default,org.w3c.dom.events@default:default,org.w3c.dom.smil@default:default,org.w3c.dom.svg@default:default"/>
|
||||||
<stringAttribute key="selected_workspace_plugins" value="com.minres.scviewer.database.sqlite@default:default,com.minres.scviewer.database.text@default:default,com.minres.scviewer.database.ui.swt@default:default,com.minres.scviewer.database.ui@default:default,com.minres.scviewer.database.vcd@default:default,com.minres.scviewer.database@default:default,com.minres.scviewer.e4.application@default:default"/>
|
<stringAttribute key="selected_workspace_plugins" value="com.minres.scviewer.database.sqlite@default:default,com.minres.scviewer.database.text@default:default,com.minres.scviewer.database.ui.swt@default:default,com.minres.scviewer.database.ui@default:default,com.minres.scviewer.database.vcd@default:default,com.minres.scviewer.database@default:default,com.minres.scviewer.e4.application@default:default,com.opcoach.e4.preferences@default:default"/>
|
||||||
<booleanAttribute key="show_selected_only" value="false"/>
|
<booleanAttribute key="show_selected_only" value="false"/>
|
||||||
<booleanAttribute key="tracing" value="false"/>
|
<booleanAttribute key="tracing" value="false"/>
|
||||||
<booleanAttribute key="useCustomFeatures" value="false"/>
|
<booleanAttribute key="useCustomFeatures" value="false"/>
|
||||||
|
|
Loading…
Reference in New Issue