Merge branch 'release/2.8'

This commit is contained in:
Eyck Jentzsch 2020-10-19 07:09:27 +02:00
commit 5add0e385d
61 changed files with 232 additions and 210 deletions

1
.gitignore vendored
View File

@ -8,3 +8,4 @@ SCViewer.xcf
SCViewer_1.png SCViewer_1.png
*.launch *.launch
copyrightLog.txt copyrightLog.txt
/workspace

View File

@ -4,4 +4,5 @@ org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.compliance=1.8 org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.release=disabled
org.eclipse.jdt.core.compiler.source=1.8 org.eclipse.jdt.core.compiler.source=1.8

View File

@ -18,6 +18,5 @@
<classpathentry exported="true" kind="lib" path="lib/kotlin-stdlib-1.2.42.jar"/> <classpathentry exported="true" kind="lib" path="lib/kotlin-stdlib-1.2.42.jar"/>
<classpathentry exported="true" kind="lib" path="lib/lz4-1.3.0.jar"/> <classpathentry exported="true" kind="lib" path="lib/lz4-1.3.0.jar"/>
<classpathentry exported="true" kind="lib" path="lib/elsa-3.0.0-M5.jar"/> <classpathentry exported="true" kind="lib" path="lib/elsa-3.0.0-M5.jar"/>
<classpathentry kind="con" path="GROOVY_SUPPORT"/>
<classpathentry kind="output" path="target/classes"/> <classpathentry kind="output" path="target/classes"/>
</classpath> </classpath>

View File

@ -1,3 +1,3 @@
eclipse.preferences.version=1 eclipse.preferences.version=1
groovy.compiler.level=25 groovy.compiler.level=-1
groovy.script.filters=**/*.dsld,y,**/*.gradle,n groovy.script.filters=**/*.dsld,y,**/*.gradle,n

View File

@ -98,4 +98,5 @@ org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=ignore org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=ignore
org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
org.eclipse.jdt.core.compiler.release=disabled
org.eclipse.jdt.core.compiler.source=1.8 org.eclipse.jdt.core.compiler.source=1.8

View File

@ -49,7 +49,7 @@ public class ArrowPainter implements IPainter {
long scaleFactor; long scaleFactor;
boolean deferredUpdate; boolean deferUpdate;
public ArrowPainter(WaveformCanvas waveCanvas, RelationType relationType) { public ArrowPainter(WaveformCanvas waveCanvas, RelationType relationType) {
this.waveCanvas = waveCanvas; this.waveCanvas = waveCanvas;
@ -80,12 +80,14 @@ public class ArrowPainter implements IPainter {
} }
protected void calculateGeometries() { protected void calculateGeometries() {
deferredUpdate = false; deferUpdate = false;
iRect.clear();
oRect.clear();
ITxStream<?> stream = tx.getStream(); ITxStream<?> stream = tx.getStream();
IWaveformPainter painter = waveCanvas.wave2painterMap.get(stream); IWaveformPainter painter = waveCanvas.wave2painterMap.get(stream);
if (painter == null) { // stream has been added but painter not yet if (painter == null) { // stream has been added but painter not yet
// created // created
deferredUpdate = true; deferUpdate = true;
return; return;
} }
int laneHeight = painter.getHeight() / stream.getMaxConcurrency(); int laneHeight = painter.getHeight() / stream.getMaxConcurrency();
@ -117,33 +119,27 @@ public class ArrowPainter implements IPainter {
Color fgColor = waveCanvas.colors[WaveformColors.REL_ARROW.ordinal()]; Color fgColor = waveCanvas.colors[WaveformColors.REL_ARROW.ordinal()];
Color highliteColor = waveCanvas.colors[WaveformColors.REL_ARROW_HIGHLITE.ordinal()]; Color highliteColor = waveCanvas.colors[WaveformColors.REL_ARROW_HIGHLITE.ordinal()];
if (deferredUpdate || (tx != null && waveCanvas.getScaleFactor() != scaleFactor)) { if(tx==null) return;
if (!deferUpdate) {
scaleFactor = waveCanvas.getScaleFactor(); scaleFactor = waveCanvas.getScaleFactor();
calculateGeometries(); calculateGeometries();
} }
if(txRectangle == null) return; if(deferUpdate) return;
int correctionValue = (int)(selectionOffset); int correctionValue = (int)(selectionOffset);
Rectangle correctedTargetRectangle = new Rectangle(txRectangle.x+correctionValue, txRectangle.y, txRectangle.width, txRectangle.height); Rectangle correctedTargetRectangle = new Rectangle(txRectangle.x+correctionValue, txRectangle.y, txRectangle.width, txRectangle.height);
for (LinkEntry entry : iRect) { for (LinkEntry entry : iRect) {
Rectangle correctedRectangle = new Rectangle(entry.rectangle.x+correctionValue, entry.rectangle.y, entry.rectangle.width, entry.rectangle.height); Rectangle correctedRectangle = new Rectangle(entry.rectangle.x+correctionValue, entry.rectangle.y, entry.rectangle.width, entry.rectangle.height);
Point target = drawPath(proj, highlightType.equals(entry.relationType) ? highliteColor : fgColor, drawArrow(proj, highlightType.equals(entry.relationType) ? highliteColor : fgColor,
correctedRectangle, correctedTargetRectangle); correctedRectangle, correctedTargetRectangle);
drawArrow(proj, target);
} }
for (LinkEntry entry : oRect) { for (LinkEntry entry : oRect) {
Rectangle correctedRectangle = new Rectangle(entry.rectangle.x+correctionValue, entry.rectangle.y, entry.rectangle.width, entry.rectangle.height); Rectangle correctedRectangle = new Rectangle(entry.rectangle.x+correctionValue, entry.rectangle.y, entry.rectangle.width, entry.rectangle.height);
Point target = drawPath(proj, highlightType.equals(entry.relationType) ? highliteColor : fgColor, correctedTargetRectangle, drawArrow(proj, highlightType.equals(entry.relationType) ? highliteColor : fgColor, correctedTargetRectangle,
correctedRectangle); correctedRectangle);
drawArrow(proj, target);
} }
} }
protected void drawArrow(Projection proj, Point target) { protected void drawArrow(Projection proj, Color fgColor, Rectangle srcRectangle, Rectangle tgtRectangle) {
proj.drawLine(target.x - 8, target.y - 5, target.x, target.y);
proj.drawLine(target.x - 8, target.y + 5, target.x, target.y);
}
protected Point drawPath(Projection proj, Color fgColor, Rectangle srcRectangle, Rectangle tgtRectangle) {
Point point1 = proj.project(new Point(srcRectangle.x, srcRectangle.y + srcRectangle.height / 2)); Point point1 = proj.project(new Point(srcRectangle.x, srcRectangle.y + srcRectangle.height / 2));
Point point2 = proj.project(new Point(tgtRectangle.x, tgtRectangle.y + tgtRectangle.height / 2)); Point point2 = proj.project(new Point(tgtRectangle.x, tgtRectangle.y + tgtRectangle.height / 2));
@ -160,11 +156,15 @@ public class ArrowPainter implements IPainter {
path.cubicTo(center.x + xCtrlOffset, center.y, point2.x - xCtrlOffset, point2.y, point2.x, point2.y); path.cubicTo(center.x + xCtrlOffset, center.y, point2.x - xCtrlOffset, point2.y, point2.x, point2.y);
} else } else
path.cubicTo(point1.x + xCtrlOffset, point1.y, point2.x - xCtrlOffset, point2.y, point2.x, point2.y); path.cubicTo(point1.x + xCtrlOffset, point1.y, point2.x - xCtrlOffset, point2.y, point2.x, point2.y);
proj.setAntialias(SWT.ON); proj.setAntialias(SWT.ON);
proj.setForeground(fgColor); proj.setForeground(fgColor);
proj.getGC().drawPath(path); proj.getGC().drawPath(path);
path.dispose(); path.dispose();
return point2; // now draw the arrow head
proj.getGC().drawLine(point2.x - 8, point2.y - 5, point2.x, point2.y);
proj.getGC().drawLine(point2.x - 8, point2.y + 5, point2.x, point2.y);
} }
class LinkEntry { class LinkEntry {

View File

@ -44,10 +44,6 @@ public class Projection {
public void setFillRule(int rule) { public void setFillRule(int rule) {
gc.setFillRule(rule); gc.setFillRule(rule);
} }
public void fillRectangle(Rectangle rect) {
gc.fillRectangle(rect.x+translation.x, rect.y+translation.y, rect.width, rect.height);
}
public void setLineStyle(int style) { public void setLineStyle(int style) {
gc.setLineStyle(style); gc.setLineStyle(style);
} }
@ -69,6 +65,10 @@ public class Projection {
return gc; return gc;
} }
public void fillRectangle(Rectangle rect) {
gc.fillRectangle(rect.x+translation.x, rect.y+translation.y, rect.width, rect.height);
}
public void drawRectangle(Rectangle rect) { public void drawRectangle(Rectangle rect) {
gc.drawRectangle(rect.x+translation.y, rect.y+translation.y, rect.width, rect.height); gc.drawRectangle(rect.x+translation.y, rect.y+translation.y, rect.width, rect.height);
} }

View File

@ -135,9 +135,6 @@ public class StreamPainter extends TrackPainter{
if(bb.x+bb.width<area.x || bb.x>area.x+area.width) return; if(bb.x+bb.width<area.x || bb.x>area.x+area.width) return;
if(bb.width==0){ if(bb.width==0){
proj.drawLine(bb.x, bb.y, bb.x, bb.y+bb.height); proj.drawLine(bb.x, bb.y, bb.x, bb.y+bb.height);
} else if(bb.width<10){
proj.fillRectangle(bb);
proj.drawRectangle(bb);
} else { } else {
if(bb.x < area.x) { if(bb.x < area.x) {
bb.width = bb.width-(area.x-bb.x)+5; bb.width = bb.width-(area.x-bb.x)+5;
@ -149,8 +146,9 @@ public class StreamPainter extends TrackPainter{
bb_x2=area_x2+5; bb_x2=area_x2+5;
bb.width= bb_x2-bb.x; bb.width= bb_x2-bb.x;
} }
proj.fillRoundRectangle(bb.x, bb.y, bb.width, bb.height, 5, 5); int arc = bb.width<10?1:5;
proj.drawRoundRectangle(bb.x, bb.y, bb.width, bb.height, 5, 5); proj.fillRoundRectangle(bb.x, bb.y, bb.width, bb.height, arc, arc);
proj.drawRoundRectangle(bb.x, bb.y, bb.width, bb.height, arc, arc);
} }
} }

View File

@ -111,10 +111,10 @@ public class WaveformCanvas extends Canvas {
// order is important: it is bottom to top // order is important: it is bottom to top
trackAreaPainter=new TrackAreaPainter(this); trackAreaPainter=new TrackAreaPainter(this);
painterList.add(trackAreaPainter); painterList.add(trackAreaPainter);
rulerPainter=new RulerPainter(this);
painterList.add(rulerPainter);
arrowPainter=new ArrowPainter(this, IWaveformView.NEXT_PREV_IN_STREAM); arrowPainter=new ArrowPainter(this, IWaveformView.NEXT_PREV_IN_STREAM);
painterList.add(arrowPainter); painterList.add(arrowPainter);
rulerPainter=new RulerPainter(this);
painterList.add(rulerPainter);
CursorPainter cp = new CursorPainter(this, scaleFactor * 10, cursorPainters.size()-1); CursorPainter cp = new CursorPainter(this, scaleFactor * 10, cursorPainters.size()-1);
painterList.add(cp); painterList.add(cp);
cursorPainters.add(cp); cursorPainters.add(cp);
@ -229,10 +229,10 @@ public class WaveformCanvas extends Canvas {
} }
public void setZoomLevel(int level, long centerTime) { public void setZoomLevel(int level, long centerTime) {
//FIXME: keep center if zoom-out and cursor is not in view
long oldScaleFactor=scaleFactor; long oldScaleFactor=scaleFactor;
if(level<0) level = 0; if(level<0) level = 0;
if(level<Constants.unitMultiplier.length*Constants.unitString.length){ if(level<Constants.unitMultiplier.length*Constants.unitString.length){
this.level = level;
this.scaleFactor = (long) Math.pow(10, level/2); this.scaleFactor = (long) Math.pow(10, level/2);
if(level%2==1) this.scaleFactor*=3; if(level%2==1) this.scaleFactor*=3;
ITx tx = arrowPainter.getTx(); ITx tx = arrowPainter.getTx();
@ -255,6 +255,7 @@ public class WaveformCanvas extends Canvas {
syncScrollBars(); syncScrollBars();
arrowPainter.setTx(tx); arrowPainter.setTx(tx);
redraw(); redraw();
this.level = level;
} }
} }
@ -400,12 +401,13 @@ public class WaveformCanvas extends Canvas {
/* Paint function */ /* Paint function */
private void paint(GC gc) { private void paint(GC gc) {
Point pt = getSize();
if(pt.x==0 || pt.y==0) return;
Rectangle clientRect = getClientArea(); /* Canvas' painting area */ Rectangle clientRect = getClientArea(); /* Canvas' painting area */
GC thisGc = gc; GC thisGc = gc;
Image d_backingImg = null; Image d_backingImg = null;
if(doubleBuffering) { if(doubleBuffering) {
Point p = getSize(); d_backingImg = new Image(getDisplay(), pt.x, pt.y);
d_backingImg = new Image(getDisplay(), p.x, p.y);
thisGc = new GC(d_backingImg); thisGc = new GC(d_backingImg);
thisGc.setBackground(gc.getBackground()); thisGc.setBackground(gc.getBackground());
thisGc.setForeground(gc.getForeground()); thisGc.setForeground(gc.getForeground());

View File

@ -52,7 +52,6 @@ import org.eclipse.swt.events.DisposeListener;
import org.eclipse.swt.events.MouseAdapter; import org.eclipse.swt.events.MouseAdapter;
import org.eclipse.swt.events.MouseEvent; import org.eclipse.swt.events.MouseEvent;
import org.eclipse.swt.events.MouseListener; import org.eclipse.swt.events.MouseListener;
import org.eclipse.swt.events.MouseMoveListener;
import org.eclipse.swt.events.PaintEvent; import org.eclipse.swt.events.PaintEvent;
import org.eclipse.swt.events.PaintListener; import org.eclipse.swt.events.PaintListener;
import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionAdapter;
@ -170,37 +169,11 @@ public class WaveformView implements IWaveformView {
} }
}; };
class WaveformMouseListener implements MouseMoveListener, MouseListener, PaintListener { class WaveformMouseListener implements PaintListener, Listener {
Point start, end; Point start, end;
List<Object> initialSelected; List<Object> initialSelected;
boolean down=false; boolean down=false;
@Override
public void mouseDoubleClick(MouseEvent e) {
}
@Override
public void mouseDown(MouseEvent e) {
start=new Point(e.x, e.y);
end=new Point(e.x, e.y);
down=true;
if((e.stateMask&SWT.MODIFIER_MASK)!=0) return; //don't react on modifier
if (e.button == 1) {
initialSelected = waveformCanvas.getElementsAt(start);
} else if (e.button == 3) {
Menu topMenu= top.getMenu();
if(topMenu!=null) topMenu.setVisible(true);
}
}
@Override
public void mouseMove(MouseEvent e) {
if(down) {
end=new Point(e.x, e.y);
asyncUpdate(e.widget);
}
}
@Override @Override
public void paintControl(PaintEvent e) { public void paintControl(PaintEvent e) {
if(down) { if(down) {
@ -214,8 +187,7 @@ public class WaveformView implements IWaveformView {
} }
} }
@Override private void mouseUp(MouseEvent e) {
public void mouseUp(MouseEvent e) {
down=false; down=false;
if(start==null) return; if(start==null) return;
if((e.stateMask&SWT.MODIFIER_MASK&~SWT.SHIFT)!=0) return; //don't react on modifier except shift if((e.stateMask&SWT.MODIFIER_MASK&~SWT.SHIFT)!=0) return; //don't react on modifier except shift
@ -307,6 +279,41 @@ public class WaveformView implements IWaveformView {
return time; return time;
} }
@Override
public void handleEvent(Event e) {
switch (e.type) {
case SWT.MouseWheel:
break;
case SWT.MouseDown:
start=new Point(e.x, e.y);
end=new Point(e.x, e.y);
down=true;
if((e.stateMask&SWT.MODIFIER_MASK)!=0) return; //don't react on modifier
if (e.button == 1) {
initialSelected = waveformCanvas.getElementsAt(start);
} else if (e.button == 3) {
Menu topMenu= top.getMenu();
if(topMenu!=null) topMenu.setVisible(true);
}
break;
case SWT.MouseUp:
mouseUp(new MouseEvent(e));
break;
//case SWT.MouseDoubleClick:
//mouseDoubleClick(new MouseEvent(e));
//break;
case SWT.MouseMove:
if(down) {
end=new Point(e.x, e.y);
asyncUpdate(e.widget);
}
break;
default:
break;
}
}
}; };
protected WaveformMouseListener waveformMouseListener = new WaveformMouseListener(); protected WaveformMouseListener waveformMouseListener = new WaveformMouseListener();
@ -322,7 +329,7 @@ public class WaveformView implements IWaveformView {
streams = new ObservableList<>(); streams = new ObservableList<>();
streams.addPropertyChangeListener("content", this); streams.addPropertyChangeListener("content", this);
top = new Composite(parent, SWT.NONE); top = parent;
top.setLayout(new FillLayout(SWT.HORIZONTAL)); top.setLayout(new FillLayout(SWT.HORIZONTAL));
SashForm topSash = new SashForm(top, SWT.SMOOTH); SashForm topSash = new SashForm(top, SWT.SMOOTH);
@ -407,9 +414,12 @@ public class WaveformView implements IWaveformView {
valueListScrolled.setContent(valueList); valueListScrolled.setContent(valueList);
waveformCanvas.setMaxTime(1); waveformCanvas.setMaxTime(1);
waveformCanvas.addMouseListener(waveformMouseListener);
waveformCanvas.addMouseMoveListener(waveformMouseListener);
waveformCanvas.addPaintListener(waveformMouseListener); waveformCanvas.addPaintListener(waveformMouseListener);
waveformCanvas.addListener(SWT.MouseDown,waveformMouseListener);
waveformCanvas.addListener(SWT.MouseUp,waveformMouseListener);
//waveformCanvas.addListener(SWT.MouseDoubleClick,waveformMouseListener);
waveformCanvas.addListener(SWT.MouseMove,waveformMouseListener);
waveformCanvas.addListener(SWT.MouseWheel, waveformMouseListener);
nameListScrolled.getVerticalBar().addSelectionListener(new SelectionAdapter() { nameListScrolled.getVerticalBar().addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) { public void widgetSelected(SelectionEvent e) {
@ -895,7 +905,7 @@ public class WaveformView implements IWaveformView {
@Override @Override
public void moveCursor(GotoDirection direction) { public void moveCursor(GotoDirection direction) {
if(currentWaveformSelection.size()!=1) return; if(currentWaveformSelection.size()!=1) return;
TrackEntry sel = currentWaveformSelection.get(1); TrackEntry sel = currentWaveformSelection.get(0);
long time = getCursorTime(); long time = getCursorTime();
NavigableMap<Long, ?> map=null; NavigableMap<Long, ?> map=null;
if(sel.isStream()){ if(sel.isStream()){

View File

@ -4,4 +4,5 @@ org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.compliance=1.8 org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.release=disabled
org.eclipse.jdt.core.compiler.source=1.8 org.eclipse.jdt.core.compiler.source=1.8

View File

@ -5,4 +5,5 @@ org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
org.eclipse.jdt.core.compiler.release=disabled
org.eclipse.jdt.core.compiler.source=1.8 org.eclipse.jdt.core.compiler.source=1.8

View File

@ -9,4 +9,5 @@ org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.release=disabled
org.eclipse.jdt.core.compiler.source=1.8 org.eclipse.jdt.core.compiler.source=1.8

View File

@ -1,3 +1,2 @@
eclipse.preferences.version=1 eclipse.preferences.version=1
pluginProject.extensions=false pluginProject.extensions=false
resolve.requirebundle=false

View File

@ -3,35 +3,9 @@
<children xsi:type="basic:TrimmedWindow" xmi:id="_95PfsXNmEeWBq8z1Dv39LA" label="SC Viewer" bindingContexts="_95PfunNmEeWBq8z1Dv39LA" width="1280" height="700"> <children xsi:type="basic:TrimmedWindow" xmi:id="_95PfsXNmEeWBq8z1Dv39LA" label="SC Viewer" bindingContexts="_95PfunNmEeWBq8z1Dv39LA" width="1280" height="700">
<children xsi:type="advanced:PerspectiveStack" xmi:id="_95QGxnNmEeWBq8z1Dv39LA"> <children xsi:type="advanced:PerspectiveStack" xmi:id="_95QGxnNmEeWBq8z1Dv39LA">
<children xsi:type="advanced:Perspective" xmi:id="_95QGx3NmEeWBq8z1Dv39LA"> <children xsi:type="advanced:Perspective" xmi:id="_95QGx3NmEeWBq8z1Dv39LA">
<children xsi:type="basic:PartSashContainer" xmi:id="_95QGyHNmEeWBq8z1Dv39LA" horizontal="true">
<children xsi:type="basic:Part" xmi:id="_95QGynNmEeWBq8z1Dv39LA" elementId="com.minres.scviewer.e4.application.parts.DesignBrowser" containerData="2000" contributionURI="bundleclass://com.minres.scviewer.e4.application/com.minres.scviewer.e4.application.parts.DesignBrowser" label="Design Browser" bindingContexts="_iQ3kQGVmEeqSQM-A6dw9ig">
<handlers xmi:id="_JIWOYIq-EeWid7xO48ZBXw" elementId="com.minres.scviewer.e4.application.handler.addWaveformCommand" contributionURI="bundleclass://com.minres.scviewer.e4.application/com.minres.scviewer.e4.application.handlers.AddWaveformHandler" command="_2PehEHr9EeWVM_sKoXvptg"/>
<menus xsi:type="menu:PopupMenu" xmi:id="_HvUl8Iq-EeWid7xO48ZBXw" elementId="com.minres.scviewer.e4.application.parts.DesignBrowser.popupmenu">
<children xsi:type="menu:HandledMenuItem" xmi:id="_HvUl8Yq-EeWid7xO48ZBXw" elementId="com.minres.scviewer.e4.application.handledmenuitem.append" label="Append after" iconURI="platform:/plugin/com.minres.scviewer.e4.application/icons/append_wave.png" command="_2PehEHr9EeWVM_sKoXvptg">
<parameters xmi:id="_HvUl8oq-EeWid7xO48ZBXw" elementId="com.minres.scviewer.e4.application.parameter.21" name="com.minres.scviewer.e4.application.command.addwaveform.where" value="after"/>
<parameters xmi:id="_HvUl84q-EeWid7xO48ZBXw" elementId="com.minres.scviewer.e4.application.parameter.25" name="com.minres.scviewer.e4.application.command.addwaveform.all" value="false"/>
</children>
<children xsi:type="menu:HandledMenuItem" xmi:id="_HvUl9Iq-EeWid7xO48ZBXw" elementId="com.minres.scviewer.e4.application.handledmenuitem.insertbefore" label="Insert before" iconURI="platform:/plugin/com.minres.scviewer.e4.application/icons/insert_wave.png" command="_2PehEHr9EeWVM_sKoXvptg">
<parameters xmi:id="_HvUl9Yq-EeWid7xO48ZBXw" elementId="com.minres.scviewer.e4.application.parameter.22" name="com.minres.scviewer.e4.application.command.addwaveform.where" value="before"/>
<parameters xmi:id="_HvUl9oq-EeWid7xO48ZBXw" elementId="com.minres.scviewer.e4.application.parameter.26" name="com.minres.scviewer.e4.application.command.addwaveform.all" value="false"/>
</children>
<children xsi:type="menu:HandledMenuItem" xmi:id="_HvUl94q-EeWid7xO48ZBXw" elementId="com.minres.scviewer.e4.application.handledmenuitem.appendall" label="Append all" iconURI="platform:/plugin/com.minres.scviewer.e4.application/icons/append_all_waves.png" command="_2PehEHr9EeWVM_sKoXvptg">
<parameters xmi:id="_HvUl-Iq-EeWid7xO48ZBXw" elementId="com.minres.scviewer.e4.application.parameter.23" name="com.minres.scviewer.e4.application.command.addwaveform.where" value="after"/>
<parameters xmi:id="_HvUl-Yq-EeWid7xO48ZBXw" elementId="com.minres.scviewer.e4.application.parameter.27" name="com.minres.scviewer.e4.application.command.addwaveform.all" value="true"/>
</children>
<children xsi:type="menu:HandledMenuItem" xmi:id="_HvUl-oq-EeWid7xO48ZBXw" elementId="com.minres.scviewer.e4.application.handledmenuitem.insertall" label="Insert All" iconURI="platform:/plugin/com.minres.scviewer.e4.application/icons/insert_all_waves.png" command="_2PehEHr9EeWVM_sKoXvptg">
<parameters xmi:id="_HvUl-4q-EeWid7xO48ZBXw" elementId="com.minres.scviewer.e4.application.parameter.24" name="com.minres.scviewer.e4.application.command.addwaveform.where" value="before"/>
<parameters xmi:id="_HvUl_Iq-EeWid7xO48ZBXw" elementId="com.minres.scviewer.e4.application.parameter.28" name="com.minres.scviewer.e4.application.command.addwaveform.all" value="true"/>
</children>
</menus>
</children>
<children xsi:type="basic:PartSashContainer" xmi:id="_uT9BIHgtEeWwZ-9vrAR2UQ" elementId="" containerData="8000">
<children xsi:type="basic:PartStack" xmi:id="_95QGyXNmEeWBq8z1Dv39LA" elementId="org.eclipse.editorss" containerData="7500"> <children xsi:type="basic:PartStack" xmi:id="_95QGyXNmEeWBq8z1Dv39LA" elementId="org.eclipse.editorss" containerData="7500">
<tags>NoAutoCollapse</tags> <tags>NoAutoCollapse</tags>
</children> </children>
<children xsi:type="basic:Part" xmi:id="_vtfm8HgtEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.parts.WaveformDetails" containerData="2500" contributionURI="bundleclass://com.minres.scviewer.e4.application/com.minres.scviewer.e4.application.parts.TransactionDetails" label="Waveform Details"/>
</children>
</children>
</children> </children>
</children> </children>
<children xsi:type="basic:Part" xmi:id="__VNlAIytEeWid7xO48ZBXw" elementId="com.minres.scviewer.e4.application.dialog.aboutscviewer" toBeRendered="false" visible="false" contributionURI="bundleclass://com.minres.scviewer.e4.application/com.minres.scviewer.e4.application.parts.AboutDialog" label="About SCViewer" bindingContexts="_95Pfu3NmEeWBq8z1Dv39LA"/> <children xsi:type="basic:Part" xmi:id="__VNlAIytEeWid7xO48ZBXw" elementId="com.minres.scviewer.e4.application.dialog.aboutscviewer" toBeRendered="false" visible="false" contributionURI="bundleclass://com.minres.scviewer.e4.application/com.minres.scviewer.e4.application.parts.AboutDialog" label="About SCViewer" bindingContexts="_95Pfu3NmEeWBq8z1Dv39LA"/>

View File

@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2 Bundle-ManifestVersion: 2
Bundle-Name: %Bundle-Name Bundle-Name: %Bundle-Name
Bundle-SymbolicName: com.minres.scviewer.e4.application;singleton:=true Bundle-SymbolicName: com.minres.scviewer.e4.application;singleton:=true
Bundle-Version: 2.7.1.qualifier Bundle-Version: 2.8.0.qualifier
Bundle-Vendor: %Bundle-Vendor Bundle-Vendor: %Bundle-Vendor
Require-Bundle: javax.inject;bundle-version="1.0.0", Require-Bundle: javax.inject;bundle-version="1.0.0",
org.eclipse.core.runtime;bundle-version="3.11.1", org.eclipse.core.runtime;bundle-version="3.11.1",

View File

@ -1,7 +1,7 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<artifactId>com.minres.scviewer.e4.application</artifactId> <artifactId>com.minres.scviewer.e4.application</artifactId>
<version>2.7.1-SNAPSHOT</version> <version>2.8.0-SNAPSHOT</version>
<parent> <parent>
<groupId>com.minres.scviewer</groupId> <groupId>com.minres.scviewer</groupId>
<artifactId>com.minres.scviewer.parent</artifactId> <artifactId>com.minres.scviewer.parent</artifactId>

View File

@ -123,7 +123,7 @@ public class RelationTypeToolControl extends PartListener implements ISelectionC
return; return;
} }
} }
comboViewer.getCombo().setEnabled(false); if(comboViewer!=null) comboViewer.getCombo().setEnabled(false);
} }
/* (non-Javadoc) /* (non-Javadoc)

View File

@ -22,6 +22,7 @@ import org.eclipse.jface.viewers.IStructuredSelection;
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.ui.TrackEntry;
import com.minres.scviewer.e4.application.parts.WaveformViewer; import com.minres.scviewer.e4.application.parts.WaveformViewer;
public class MoveWaveformHandler { public class MoveWaveformHandler {
@ -33,7 +34,7 @@ public class MoveWaveformHandler {
Object sel = selectionService.getSelection(); Object sel = selectionService.getSelection();
if( sel instanceof IStructuredSelection) { if( sel instanceof IStructuredSelection) {
Object o= ((IStructuredSelection)sel).getFirstElement(); Object o= ((IStructuredSelection)sel).getFirstElement();
return o instanceof IWaveform || o instanceof ITx; return o instanceof IWaveform || o instanceof ITx | o instanceof TrackEntry;
} }
return false; return false;
} }

View File

@ -23,6 +23,7 @@ import org.eclipse.jface.viewers.IStructuredSelection;
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.ui.GotoDirection; import com.minres.scviewer.database.ui.GotoDirection;
import com.minres.scviewer.database.ui.TrackEntry;
import com.minres.scviewer.e4.application.parts.WaveformViewer; import com.minres.scviewer.e4.application.parts.WaveformViewer;
public class NavigateEvent { public class NavigateEvent {
@ -34,7 +35,7 @@ public class NavigateEvent {
Object sel = selectionService.getSelection(); Object sel = selectionService.getSelection();
if( sel instanceof IStructuredSelection) { if( sel instanceof IStructuredSelection) {
Object o= ((IStructuredSelection)sel).getFirstElement(); Object o= ((IStructuredSelection)sel).getFirstElement();
return o instanceof IWaveform || o instanceof ITx; return o instanceof IWaveform || o instanceof ITx || o instanceof TrackEntry;
} }
return false; return false;
} }

View File

@ -11,6 +11,7 @@
package com.minres.scviewer.e4.application.handlers; package com.minres.scviewer.e4.application.handlers;
import java.io.File; import java.io.File;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import org.eclipse.e4.core.contexts.IEclipseContext; import org.eclipse.e4.core.contexts.IEclipseContext;
@ -39,13 +40,14 @@ public class OpenHandler {
part.setLabel(files.get(0).getName()); part.setLabel(files.get(0).getName());
MPartStack partStack = (MPartStack)modelService.find("org.eclipse.editorss", app); //$NON-NLS-1$ MPartStack partStack = (MPartStack)modelService.find("org.eclipse.editorss", app); //$NON-NLS-1$
partStack.getChildren().add(part); partStack.getChildren().add(part);
partService.showPart(part, PartState.ACTIVATE); partService.showPart(part, PartState.CREATE);
final IEclipseContext ctx=part.getContext(); final IEclipseContext ctx=part.getContext();
files.stream() List<String> inputs=new ArrayList<>();
.map(x -> x.getAbsolutePath()) for(File f: files)
.reduce((s1, s2) -> s1 + "," + s2) inputs.add(f.getAbsolutePath());
.ifPresent(s -> ctx.modify("input", s)); //$NON-NLS-1$ ctx.modify("input", inputs);
ctx.modify("config", ""); //$NON-NLS-1$ ctx.modify("config", ""); //$NON-NLS-1$
partStack.setSelectedElement(part);
} }
} }

View File

@ -64,6 +64,7 @@ import org.eclipse.swt.events.PaintEvent;
import org.eclipse.swt.events.PaintListener; import org.eclipse.swt.events.PaintListener;
import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Composite;
@ -149,6 +150,14 @@ public class DesignBrowser {
treeViewer.refresh(); treeViewer.refresh();
} }
}); });
} else if("WAVEFORMS".equals(evt.getPropertyName())) {
treeViewer.getTree().getDisplay().asyncExec(new Runnable() {
@Override
public void run() {
IWaveformDb database = waveformViewerPart.getDatabase();
treeViewer.setInput(Arrays.asList(database.isLoaded()?new IWaveformDb[]{database}:new IWaveformDb[]{new LoadingWaveformDb()}));
}
});
} }
} }
}; };
@ -177,7 +186,8 @@ public class DesignBrowser {
* @param parent the parent * @param parent the parent
*/ */
@PostConstruct @PostConstruct
public void createComposite(Composite parent) { public void createComposite(Composite parent, @Optional WaveformViewer waveformViewerPart) {
parent.setLayout(new FillLayout(SWT.HORIZONTAL));
sashForm = new SashForm(parent, SWT.BORDER | SWT.SMOOTH | SWT.VERTICAL); sashForm = new SashForm(parent, SWT.BORDER | SWT.SMOOTH | SWT.VERTICAL);
top = new Composite(sashForm, SWT.NONE); top = new Composite(sashForm, SWT.NONE);
@ -193,6 +203,8 @@ public class DesignBrowser {
top.removeControlListener(this); top.removeControlListener(this);
} }
}); });
if(waveformViewerPart!=null)
setWaveformViewer(waveformViewerPart);
} }
/** /**
@ -366,13 +378,11 @@ public class DesignBrowser {
* @param waveformViewerPart the waveform viewer part * @param waveformViewerPart the waveform viewer part
* @return the status event * @return the status event
*/ */
@SuppressWarnings("unchecked")
@Inject @Optional @Inject @Optional
public void getActiveWaveformViewerEvent(@UIEventTopic(WaveformViewer.ACTIVE_WAVEFORMVIEW) WaveformViewer waveformViewerPart) { public void getActiveWaveformViewerEvent(@UIEventTopic(WaveformViewer.ACTIVE_WAVEFORMVIEW) WaveformViewer waveformViewerPart) {
if(this.waveformViewerPart!=null) {
this.waveformViewerPart.storeDesignBrowerState(new DBState());
}
if( this.waveformViewerPart == null || this.waveformViewerPart != waveformViewerPart ) { if( this.waveformViewerPart == null || this.waveformViewerPart != waveformViewerPart ) {
if(this.waveformViewerPart!=null)
this.waveformViewerPart.storeDesignBrowerState(new DBState());
waveformViewerPart.addDisposeListener( new DisposeListener() { waveformViewerPart.addDisposeListener( new DisposeListener() {
@Override @Override
public void widgetDisposed(DisposeEvent e) { public void widgetDisposed(DisposeEvent e) {
@ -384,7 +394,12 @@ public class DesignBrowser {
} }
} }
} ); } );
setWaveformViewer(waveformViewerPart);
} }
}
@SuppressWarnings("unchecked")
public void setWaveformViewer(WaveformViewer waveformViewerPart) {
this.waveformViewerPart=waveformViewerPart; this.waveformViewerPart=waveformViewerPart;
IWaveformDb database = waveformViewerPart.getDatabase(); IWaveformDb database = waveformViewerPart.getDatabase();
Object input = treeViewer.getInput(); Object input = treeViewer.getInput();

View File

@ -381,16 +381,12 @@ public class FileBrowserDialog extends TrayDialog {
class FileTreeLabelProvider implements ILabelProvider { class FileTreeLabelProvider implements ILabelProvider {
private List<ILabelProviderListener> listeners; private List<ILabelProviderListener> listeners;
private Image file;
private Image dir;
public FileTreeLabelProvider() { public FileTreeLabelProvider() {
listeners = new ArrayList<ILabelProviderListener>(); listeners = new ArrayList<ILabelProviderListener>();
} }
public Image getImage(Object arg0) { public Image getImage(Object arg0) {
return ((File) arg0).isDirectory() ? folderImage : file; return ((File) arg0).isDirectory() ? folderImage : fileImage;
} }
public String getText(Object arg0) { public String getText(Object arg0) {
@ -402,16 +398,12 @@ public class FileBrowserDialog extends TrayDialog {
listeners.add(arg0); listeners.add(arg0);
} }
@Override
public void dispose() { public void dispose() {
// Dispose the images
if (dir != null)
dir.dispose();
if (file != null)
file.dispose();
} }
public boolean isLabelProperty(Object arg0, String arg1) { public boolean isLabelProperty(Object arg0, String arg1) {
return false; return true;
} }
public void removeListener(ILabelProviderListener arg0) { public void removeListener(ILabelProviderListener arg0) {

View File

@ -120,7 +120,9 @@ public class TransactionDetails {
* @param parent the parent * @param parent the parent
*/ */
@PostConstruct @PostConstruct
public void createComposite(final Composite parent) { public void createComposite(final Composite parent, @Optional WaveformViewer waveformViewerPart) {
this.waveformViewerPart=waveformViewerPart;
parent.setLayout(new GridLayout(1, false)); parent.setLayout(new GridLayout(1, false));
nameFilter = new Text(parent, SWT.BORDER); nameFilter = new Text(parent, SWT.BORDER);
@ -262,6 +264,7 @@ public class TransactionDetails {
*/ */
@Focus @Focus
public void setFocus() { public void setFocus() {
if(treeViewer!=null)
treeViewer.getTree().setFocus(); treeViewer.getTree().setFocus();
} }
@ -392,7 +395,7 @@ public class TransactionDetails {
if( part == null || ! (part.getObject() instanceof WaveformViewer ) ) if( part == null || ! (part.getObject() instanceof WaveformViewer ) )
return; return;
if(treeViewer!=null && selection!=null && !treeViewer.getTree().isDisposed()){ if(treeViewer!=null && selection!=null && !treeViewer.getTree().isDisposed()){
if( selection instanceof IStructuredSelection) { if( selection instanceof IStructuredSelection && !selection.isEmpty()) {
setInput(((IStructuredSelection)selection).getFirstElement()); setInput(((IStructuredSelection)selection).getFirstElement());
} }
} }

View File

@ -41,6 +41,8 @@ import org.eclipse.core.runtime.preferences.DefaultScope;
import org.eclipse.core.runtime.preferences.IEclipsePreferences; import org.eclipse.core.runtime.preferences.IEclipsePreferences;
import org.eclipse.core.runtime.preferences.IEclipsePreferences.IPreferenceChangeListener; import org.eclipse.core.runtime.preferences.IEclipsePreferences.IPreferenceChangeListener;
import org.eclipse.core.runtime.preferences.IEclipsePreferences.PreferenceChangeEvent; import org.eclipse.core.runtime.preferences.IEclipsePreferences.PreferenceChangeEvent;
import org.eclipse.e4.core.contexts.ContextInjectionFactory;
import org.eclipse.e4.core.contexts.IEclipseContext;
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.di.extensions.Preference;
import org.eclipse.e4.core.services.events.IEventBroker; import org.eclipse.e4.core.services.events.IEventBroker;
@ -60,6 +62,7 @@ import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.SelectionChangedEvent; import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.jface.viewers.StructuredSelection; import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.swt.SWT; import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.SashForm;
import org.eclipse.swt.events.DisposeEvent; import org.eclipse.swt.events.DisposeEvent;
import org.eclipse.swt.events.DisposeListener; import org.eclipse.swt.events.DisposeListener;
import org.eclipse.swt.events.FocusListener; import org.eclipse.swt.events.FocusListener;
@ -69,6 +72,7 @@ import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.graphics.Point; import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.graphics.RGB; import org.eclipse.swt.graphics.RGB;
import org.eclipse.swt.graphics.Rectangle; import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Display;
@ -96,11 +100,11 @@ import com.minres.scviewer.database.ui.IWaveformView;
import com.minres.scviewer.database.ui.TrackEntry; import com.minres.scviewer.database.ui.TrackEntry;
import com.minres.scviewer.database.ui.TrackEntry.ValueDisplay; import com.minres.scviewer.database.ui.TrackEntry.ValueDisplay;
import com.minres.scviewer.database.ui.TrackEntry.WaveDisplay; import com.minres.scviewer.database.ui.TrackEntry.WaveDisplay;
import com.minres.scviewer.database.ui.WaveformColors;
import com.minres.scviewer.database.ui.swt.Constants; import com.minres.scviewer.database.ui.swt.Constants;
import com.minres.scviewer.database.ui.swt.ToolTipContentProvider; import com.minres.scviewer.database.ui.swt.ToolTipContentProvider;
import com.minres.scviewer.database.ui.swt.ToolTipHelpTextProvider; import com.minres.scviewer.database.ui.swt.ToolTipHelpTextProvider;
import com.minres.scviewer.database.ui.swt.WaveformViewFactory; import com.minres.scviewer.database.ui.swt.WaveformViewFactory;
import com.minres.scviewer.database.ui.WaveformColors;
import com.minres.scviewer.e4.application.Messages; import com.minres.scviewer.e4.application.Messages;
import com.minres.scviewer.e4.application.internal.status.WaveStatusBarControl; 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.FileMonitor;
@ -166,6 +170,10 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
/** The factory. */ /** The factory. */
WaveformViewFactory factory = new WaveformViewFactory(); WaveformViewFactory factory = new WaveformViewFactory();
DesignBrowser browser = null;
TransactionDetails detailsView = null;
/** The waveform pane. */ /** The waveform pane. */
private IWaveformView waveformPane; private IWaveformView waveformPane;
@ -199,7 +207,7 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
private boolean checkForUpdates; private boolean checkForUpdates;
/** The my part. */ /** The my part. */
private MPart myPart; @Inject private MPart myPart;
/** The my parent. */ /** The my parent. */
private Composite myParent; private Composite myParent;
@ -207,6 +215,8 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
/** The files to load. */ /** The files to load. */
ArrayList<File> filesToLoad = new ArrayList<>(); ArrayList<File> filesToLoad = new ArrayList<>();
String partConfig = "";
/** The persisted state. */ /** The persisted state. */
Map<String, String> persistedState; Map<String, String> persistedState;
@ -225,6 +235,10 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
/** The file checker. */ /** The file checker. */
IModificationChecker fileChecker; IModificationChecker fileChecker;
@Inject IWaveformDbFactory dbFactory;
@Inject Composite parent;
private Boolean showHover; private Boolean showHover;
/** /**
@ -235,7 +249,7 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
* @param dbFactory the db factory * @param dbFactory the db factory
*/ */
@PostConstruct @PostConstruct
public void createComposite(MPart part, Composite parent, IWaveformDbFactory dbFactory, @Preference(nodePath = PreferenceConstants.PREFERENCES_SCOPE) IEclipsePreferences prefs, @Preference(value = PreferenceConstants.SHOW_HOVER) Boolean hover) { public void createComposite(MPart part, EMenuService menuService, @Preference(nodePath = PreferenceConstants.PREFERENCES_SCOPE) IEclipsePreferences prefs, @Preference(value = PreferenceConstants.SHOW_HOVER) Boolean hover) {
disposeListenerNumber += 1; disposeListenerNumber += 1;
myPart = part; myPart = part;
@ -256,7 +270,32 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
} }
} }
}); });
waveformPane = factory.createPanel(parent); parent.setLayout(new FillLayout(SWT.HORIZONTAL));
SashForm sashFormTop = new SashForm(parent, SWT.BORDER | SWT.SMOOTH);
Composite left = new Composite(sashFormTop, SWT.NONE);
IEclipseContext ctx = myPart.getContext();
ctx.set(WaveformViewer.class, this);
ctx.set(IWaveformDb.class, database);
ctx.set(Composite.class, left);
browser = ContextInjectionFactory.make(DesignBrowser.class, ctx);
//Composite right = new Composite(sashFormTop, SWT.NONE);
SashForm sashFormRight = new SashForm(sashFormTop, SWT.BORDER | SWT.SMOOTH | SWT.VERTICAL);
sashFormTop.setWeights(new int[] {25, 75});
Composite rightTop = new Composite(sashFormRight, SWT.NONE);
Composite rightBottom = new Composite(sashFormRight, SWT.NONE);
sashFormRight.setWeights(new int[] {80, 20});
waveformPane = factory.createPanel(rightTop);
ctx.set(Composite.class, rightBottom);
detailsView = ContextInjectionFactory.make(TransactionDetails.class, ctx);
waveformPane.setMaxTime(0); waveformPane.setMaxTime(0);
setupColors(); setupColors();
//set selection to empty selection when opening a new waveformPane //set selection to empty selection when opening a new waveformPane
@ -614,48 +653,21 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
*/ */
@Inject @Inject
@Optional @Optional
public void setPartInput(@Named("input") Object partInput, @Named("config") Object partConfig) { public void setPartInput(@Named("input") List<String> partInput, @Named("config") String partConfig) {
if (partInput instanceof String) { for(String s:partInput) {
String name = (String)partInput; File file = new File(s);
filesToLoad = new ArrayList<File>(); if(file.isFile() && "CURRENT".equals(file.getName()))
boolean explicit = name.contains(",");
for(String tok: name.split(",")) {
File file = new File(tok);
if(file.isFile() && "CURRENT".equals(file.getName())){
file=file.getParentFile(); file=file.getParentFile();
} if (file.exists())
if (file.exists()) {
filesToLoad.add(file); filesToLoad.add(file);
} }
if(!explicit) if(partConfig!=null) {
try { this.partConfig=partConfig;
String ext = getFileExtension(file.getName());
if (Messages.WaveformViewer_19.equals(ext.toLowerCase())) {
if (askIfToLoad(new File(renameFileExtension(file.getCanonicalPath(), Messages.WaveformViewer_20)))) {
filesToLoad.add(new File(renameFileExtension(file.getCanonicalPath(), Messages.WaveformViewer_20)));
} else if (askIfToLoad(new File(renameFileExtension(file.getCanonicalPath(), Messages.WaveformViewer_21)))) {
filesToLoad.add(new File(renameFileExtension(file.getCanonicalPath(), Messages.WaveformViewer_21)));
} else if (askIfToLoad(new File(renameFileExtension(file.getCanonicalPath(), Messages.WaveformViewer_22)))) {
filesToLoad.add(new File(renameFileExtension(file.getCanonicalPath(), Messages.WaveformViewer_22)));
}
} else if (Messages.WaveformViewer_20.equals(ext.toLowerCase()) ||
Messages.WaveformViewer_21.equals(ext.toLowerCase()) ||
Messages.WaveformViewer_22.equals(ext.toLowerCase())
) {
if (askIfToLoad(new File(renameFileExtension(file.getCanonicalPath(), Messages.WaveformViewer_19)))) {
filesToLoad.add(new File(renameFileExtension(file.getCanonicalPath(), Messages.WaveformViewer_19)));
}
}
} catch (IOException e) { // silently ignore any error
}
} }
if (filesToLoad.size() > 0) if (filesToLoad.size() > 0)
loadDatabase(persistedState); loadDatabase(persistedState);
if(partConfig instanceof String && ((String)partConfig).length()>0) { if(partConfig.length()>0)
loadState((String) partConfig); loadState(partConfig);
}
}
} }
/** /**
@ -663,7 +675,7 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
*/ */
@Focus @Focus
public void setFocus() { public void setFocus() {
waveformPane.getWaveformControl().setFocus(); if(waveformPane!=null) waveformPane.getWaveformControl().setFocus();
} }
/** /**
@ -756,10 +768,10 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
// get selected transaction of a stream // get selected transaction of a stream
ISelection selection = waveformPane.getSelection(); ISelection selection = waveformPane.getSelection();
if (!selection.isEmpty()) { if (!selection.isEmpty()) {
List<Object> t = getISelection(selection); List<Object> sel = getISelection(selection);
if(t.get(0) instanceof ITx) { if(sel.size()>1 && sel.get(0) instanceof ITx && sel.get(1) instanceof TrackEntry) {
ITx tx = (ITx) t.get(0); ITx tx = (ITx) sel.get(0);
TrackEntry te = (TrackEntry) t.get(1); TrackEntry te = (TrackEntry) sel.get(1);
// get transaction id // get transaction id
persistedState.put(SELECTED_TX_ID, Long.toString(tx.getId())); persistedState.put(SELECTED_TX_ID, Long.toString(tx.getId()));
//get TrackEntry name //get TrackEntry name
@ -992,6 +1004,7 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
waveformPane.getStreamList().addAll(streams); waveformPane.getStreamList().addAll(streams);
} else { } else {
Object first = selection.getFirstElement(); Object first = selection.getFirstElement();
if(first instanceof ITx) {
IWaveform stream = (first instanceof ITx) ? ((ITx) first).getStream() : (IWaveform) first; IWaveform stream = (first instanceof ITx) ? ((ITx) first).getStream() : (IWaveform) first;
TrackEntry trackEntry = waveformPane.getEntryForStream(stream); TrackEntry trackEntry = waveformPane.getEntryForStream(stream);
if (insert) { if (insert) {
@ -1000,6 +1013,15 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
} else { } else {
waveformPane.getStreamList().addAll(streams); waveformPane.getStreamList().addAll(streams);
} }
} else if(first instanceof TrackEntry) {
TrackEntry trackEntry = (TrackEntry) first;
if (insert) {
int index = waveformPane.getStreamList().indexOf(trackEntry);
waveformPane.getStreamList().addAll(index, streams);
} else {
waveformPane.getStreamList().addAll(streams);
}
}
} }
setFocus(); setFocus();
@ -1108,7 +1130,10 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
* @return the selection * @return the selection
*/ */
public ISelection getSelection() { public ISelection getSelection() {
if(waveformPane!=null)
return waveformPane.getSelection(); return waveformPane.getSelection();
else
return new StructuredSelection();
} }
/** /**
@ -1259,5 +1284,4 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
eventBroker.post(WaveStatusBarControl.MARKER_DIFF, null); eventBroker.post(WaveStatusBarControl.MARKER_DIFF, null);
} }
} }
} }

View File

@ -63,12 +63,6 @@ public class TxDbLabelProvider implements ILabelProvider {
*/ */
@Override @Override
public void dispose() { public void dispose() {
if(loadinDatabase!=null) database.dispose();
if(database!=null) database.dispose();
if(stream!=null) stream.dispose();
if(folder!=null) folder.dispose();
if(signal!=null) signal.dispose();
if(wave!=null) wave.dispose();
} }
/* (non-Javadoc) /* (non-Javadoc)

View File

@ -9,4 +9,5 @@ org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.release=disabled
org.eclipse.jdt.core.compiler.source=1.8 org.eclipse.jdt.core.compiler.source=1.8

View File

@ -22,8 +22,8 @@
<module>features/com.minres.scviewer.e4.platform.feature</module> <module>features/com.minres.scviewer.e4.platform.feature</module>
<module>features/com.minres.scviewer.e4.feature</module> <module>features/com.minres.scviewer.e4.feature</module>
<module>p2repositories//com.minres.scviewer.updateSite</module> <module>p2repositories//com.minres.scviewer.updateSite</module>
<module>com.minres.scviewer.e4.product</module> <module>products/com.minres.scviewer.e4.product</module>
<module>com.minres.scviewer.e4.product_slim</module> <module>products/com.minres.scviewer.e4.product_slim</module>
</modules> </modules>
<properties> <properties>

View File

Before

Width:  |  Height:  |  Size: 290 KiB

After

Width:  |  Height:  |  Size: 290 KiB

View File

Before

Width:  |  Height:  |  Size: 103 KiB

After

Width:  |  Height:  |  Size: 103 KiB

View File

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

View File

Before

Width:  |  Height:  |  Size: 256 KiB

After

Width:  |  Height:  |  Size: 256 KiB

View File

Before

Width:  |  Height:  |  Size: 4.1 KiB

After

Width:  |  Height:  |  Size: 4.1 KiB

View File

Before

Width:  |  Height:  |  Size: 2.5 KiB

After

Width:  |  Height:  |  Size: 2.5 KiB

View File

Before

Width:  |  Height:  |  Size: 9.1 KiB

After

Width:  |  Height:  |  Size: 9.1 KiB

View File

Before

Width:  |  Height:  |  Size: 3.8 KiB

After

Width:  |  Height:  |  Size: 3.8 KiB

View File

@ -7,10 +7,10 @@
<groupId>com.minres.scviewer</groupId> <groupId>com.minres.scviewer</groupId>
<artifactId>com.minres.scviewer.parent</artifactId> <artifactId>com.minres.scviewer.parent</artifactId>
<version>2.0.0-SNAPSHOT</version> <version>2.0.0-SNAPSHOT</version>
<relativePath>..</relativePath> <relativePath>../..</relativePath>
</parent> </parent>
<artifactId>com.minres.scviewer.e4.product</artifactId> <artifactId>com.minres.scviewer.e4.product</artifactId>
<version>2.7.1-SNAPSHOT</version> <version>2.8.0-SNAPSHOT</version>
<packaging>eclipse-repository</packaging> <packaging>eclipse-repository</packaging>
<groupId>com.minres.scviewer</groupId> <groupId>com.minres.scviewer</groupId>
<build> <build>

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<?pde version="3.5"?> <?pde version="3.5"?>
<product name="SCViewer" uid="product" id="com.minres.scviewer.e4.application.product" application="org.eclipse.e4.ui.workbench.swt.E4Application" version="2.7.1.qualifier" useFeatures="true" includeLaunchers="true"> <product name="SCViewer" uid="product" id="com.minres.scviewer.e4.application.product" application="org.eclipse.e4.ui.workbench.swt.E4Application" version="2.8.0.qualifier" useFeatures="true" includeLaunchers="true">
<configIni use="default"> <configIni use="default">
</configIni> </configIni>

View File

Before

Width:  |  Height:  |  Size: 290 KiB

After

Width:  |  Height:  |  Size: 290 KiB

View File

Before

Width:  |  Height:  |  Size: 103 KiB

After

Width:  |  Height:  |  Size: 103 KiB

View File

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

View File

Before

Width:  |  Height:  |  Size: 256 KiB

After

Width:  |  Height:  |  Size: 256 KiB

View File

Before

Width:  |  Height:  |  Size: 4.1 KiB

After

Width:  |  Height:  |  Size: 4.1 KiB

View File

Before

Width:  |  Height:  |  Size: 2.5 KiB

After

Width:  |  Height:  |  Size: 2.5 KiB

View File

Before

Width:  |  Height:  |  Size: 9.1 KiB

After

Width:  |  Height:  |  Size: 9.1 KiB

View File

Before

Width:  |  Height:  |  Size: 3.8 KiB

After

Width:  |  Height:  |  Size: 3.8 KiB

View File

@ -7,10 +7,10 @@
<groupId>com.minres.scviewer</groupId> <groupId>com.minres.scviewer</groupId>
<artifactId>com.minres.scviewer.parent</artifactId> <artifactId>com.minres.scviewer.parent</artifactId>
<version>2.0.0-SNAPSHOT</version> <version>2.0.0-SNAPSHOT</version>
<relativePath>..</relativePath> <relativePath>../..</relativePath>
</parent> </parent>
<artifactId>com.minres.scviewer.e4.product_slim</artifactId> <artifactId>com.minres.scviewer.e4.product_slim</artifactId>
<version>2.7.1-SNAPSHOT</version> <version>2.8.0-SNAPSHOT</version>
<packaging>eclipse-repository</packaging> <packaging>eclipse-repository</packaging>
<groupId>com.minres.scviewer</groupId> <groupId>com.minres.scviewer</groupId>
<build> <build>
@ -46,7 +46,7 @@
<products> <products>
<product> <product>
<id>product_slim</id> <id>product_slim</id>
<archiveFileName>SCViewer-${project.version}</archiveFileName> <archiveFileName>SCViewer_slim-${project.version}</archiveFileName>
<rootFolders> <rootFolders>
<macosx>SCViewer.app</macosx> <macosx>SCViewer.app</macosx>
</rootFolders> </rootFolders>

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<?pde version="3.5"?> <?pde version="3.5"?>
<product name="SCViewer" uid="product_slim" id="com.minres.scviewer.e4.application.product_slim" application="org.eclipse.e4.ui.workbench.swt.E4Application" version="2.7.1.qualifier" useFeatures="false" includeLaunchers="true"> <product name="SCViewer" uid="product_slim" id="com.minres.scviewer.e4.application.product_slim" application="org.eclipse.e4.ui.workbench.swt.E4Application" version="2.8.0.qualifier" useFeatures="false" includeLaunchers="true">
<configIni use="default"> <configIni use="default">
</configIni> </configIni>

View File

@ -5,4 +5,5 @@ org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
org.eclipse.jdt.core.compiler.release=disabled
org.eclipse.jdt.core.compiler.source=1.8 org.eclipse.jdt.core.compiler.source=1.8