re-organize layout and fix drawing errors
This commit is contained in:
parent
675b2ed972
commit
664e99d09e
|
@ -126,24 +126,17 @@ public class ArrowPainter implements IPainter {
|
||||||
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 +153,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 {
|
||||||
|
|
|
@ -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);
|
||||||
}
|
}
|
||||||
|
|
|
@ -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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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();
|
||||||
|
@ -243,18 +243,19 @@ public class WaveformCanvas extends Canvas {
|
||||||
* xcn = tc/newScaleFactor
|
* xcn = tc/newScaleFactor
|
||||||
* t0n = (xcn-xoffs)*scaleFactor
|
* t0n = (xcn-xoffs)*scaleFactor
|
||||||
*/
|
*/
|
||||||
long xc=centerTime/oldScaleFactor; // cursor total x-offset
|
long xc=centerTime/oldScaleFactor; // cursor total x-offset
|
||||||
long xoffs=xc+origin.x; // cursor offset relative to left border
|
long xoffs=xc+origin.x; // cursor offset relative to left border
|
||||||
long xcn=centerTime/scaleFactor; // new total x-offset
|
long xcn=centerTime/scaleFactor; // new total x-offset
|
||||||
long originX=xcn-xoffs;
|
long originX=xcn-xoffs;
|
||||||
if(originX>0) {
|
if(originX>0) {
|
||||||
origin.x=(int) -originX; // new cursor time offset relative to left border
|
origin.x=(int) -originX; // new cursor time offset relative to left border
|
||||||
}else {
|
}else {
|
||||||
origin.x=0;
|
origin.x=0;
|
||||||
}
|
}
|
||||||
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());
|
||||||
|
|
|
@ -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,8 +279,43 @@ 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();
|
||||||
|
|
||||||
public WaveformView(Composite parent) {
|
public WaveformView(Composite parent) {
|
||||||
pcs=new PropertyChangeSupport(this);
|
pcs=new PropertyChangeSupport(this);
|
||||||
|
@ -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()){
|
||||||
|
|
|
@ -3,11 +3,8 @@
|
||||||
<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="_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 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>
|
||||||
|
|
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,6 +47,7 @@ public class OpenHandler {
|
||||||
inputs.add(f.getAbsolutePath());
|
inputs.add(f.getAbsolutePath());
|
||||||
ctx.modify("input", inputs);
|
ctx.modify("input", inputs);
|
||||||
ctx.modify("config", ""); //$NON-NLS-1$
|
ctx.modify("config", ""); //$NON-NLS-1$
|
||||||
|
partStack.setSelectedElement(part);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,575 +0,0 @@
|
||||||
/*******************************************************************************
|
|
||||||
* 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.ui;
|
|
||||||
|
|
||||||
import java.beans.PropertyChangeEvent;
|
|
||||||
import java.beans.PropertyChangeListener;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.regex.Pattern;
|
|
||||||
import java.util.regex.PatternSyntaxException;
|
|
||||||
|
|
||||||
import javax.annotation.PostConstruct;
|
|
||||||
import javax.inject.Inject;
|
|
||||||
import javax.inject.Named;
|
|
||||||
|
|
||||||
import org.eclipse.e4.core.contexts.IEclipseContext;
|
|
||||||
import org.eclipse.e4.core.di.annotations.Optional;
|
|
||||||
import org.eclipse.e4.core.services.events.IEventBroker;
|
|
||||||
import org.eclipse.e4.ui.di.Focus;
|
|
||||||
import org.eclipse.e4.ui.model.application.ui.basic.MPart;
|
|
||||||
import org.eclipse.e4.ui.services.EMenuService;
|
|
||||||
import org.eclipse.e4.ui.services.IServiceConstants;
|
|
||||||
import org.eclipse.e4.ui.workbench.modeling.EPartService;
|
|
||||||
import org.eclipse.e4.ui.workbench.modeling.ESelectionService;
|
|
||||||
import org.eclipse.jface.viewers.IContentProvider;
|
|
||||||
import org.eclipse.jface.viewers.ISelection;
|
|
||||||
import org.eclipse.jface.viewers.ISelectionChangedListener;
|
|
||||||
import org.eclipse.jface.viewers.IStructuredContentProvider;
|
|
||||||
import org.eclipse.jface.viewers.IStructuredSelection;
|
|
||||||
import org.eclipse.jface.viewers.ITreeContentProvider;
|
|
||||||
import org.eclipse.jface.viewers.ITreePathContentProvider;
|
|
||||||
import org.eclipse.jface.viewers.SelectionChangedEvent;
|
|
||||||
import org.eclipse.jface.viewers.StructuredSelection;
|
|
||||||
import org.eclipse.jface.viewers.TableViewer;
|
|
||||||
import org.eclipse.jface.viewers.TreePath;
|
|
||||||
import org.eclipse.jface.viewers.TreeViewer;
|
|
||||||
import org.eclipse.jface.viewers.Viewer;
|
|
||||||
import org.eclipse.jface.viewers.ViewerFilter;
|
|
||||||
import org.eclipse.swt.SWT;
|
|
||||||
import org.eclipse.swt.custom.SashForm;
|
|
||||||
import org.eclipse.swt.events.ControlAdapter;
|
|
||||||
import org.eclipse.swt.events.ControlEvent;
|
|
||||||
import org.eclipse.swt.events.ModifyEvent;
|
|
||||||
import org.eclipse.swt.events.ModifyListener;
|
|
||||||
import org.eclipse.swt.events.PaintEvent;
|
|
||||||
import org.eclipse.swt.events.PaintListener;
|
|
||||||
import org.eclipse.swt.layout.GridData;
|
|
||||||
import org.eclipse.swt.layout.GridLayout;
|
|
||||||
import org.eclipse.swt.widgets.Composite;
|
|
||||||
import org.eclipse.swt.widgets.Text;
|
|
||||||
import org.eclipse.swt.widgets.ToolBar;
|
|
||||||
import org.eclipse.swt.widgets.ToolItem;
|
|
||||||
import org.eclipse.wb.swt.ResourceManager;
|
|
||||||
import org.eclipse.wb.swt.SWTResourceManager;
|
|
||||||
|
|
||||||
import com.minres.scviewer.database.HierNode;
|
|
||||||
import com.minres.scviewer.database.IHierNode;
|
|
||||||
import com.minres.scviewer.database.ITx;
|
|
||||||
import com.minres.scviewer.database.IWaveform;
|
|
||||||
import com.minres.scviewer.database.IWaveformDb;
|
|
||||||
import com.minres.scviewer.e4.application.Messages;
|
|
||||||
import com.minres.scviewer.e4.application.parts.LoadingWaveformDb;
|
|
||||||
import com.minres.scviewer.e4.application.provider.TxDbContentProvider;
|
|
||||||
import com.minres.scviewer.e4.application.provider.TxDbLabelProvider;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The Class DesignBrowser. It contains the design tree, a list of Streams & signals and a few buttons to
|
|
||||||
* add them them to the waveform view
|
|
||||||
*/
|
|
||||||
public abstract class AbstractDesignBrowser {
|
|
||||||
|
|
||||||
public TreeViewer getDbTreeViewer() {
|
|
||||||
return dbTreeViewer;
|
|
||||||
}
|
|
||||||
|
|
||||||
public TableViewer getStreamTableViewer() {
|
|
||||||
return streamTableViewer;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** The Constant POPUP_ID. */
|
|
||||||
private static final String POPUP_ID="com.minres.scviewer.e4.application.parts.DesignBrowser.popupmenu"; //$NON-NLS-1$
|
|
||||||
|
|
||||||
/** The event broker. */
|
|
||||||
@Inject IEventBroker eventBroker;
|
|
||||||
|
|
||||||
/** The selection service. */
|
|
||||||
@Inject ESelectionService selectionService;
|
|
||||||
|
|
||||||
/** The menu service. */
|
|
||||||
@Inject EMenuService menuService;
|
|
||||||
|
|
||||||
/** The eclipse ctx. */
|
|
||||||
@Inject IEclipseContext eclipseCtx;
|
|
||||||
|
|
||||||
/** The sash form. */
|
|
||||||
private SashForm sashForm;
|
|
||||||
|
|
||||||
/** The top. */
|
|
||||||
Composite top;
|
|
||||||
|
|
||||||
/** The bottom. */
|
|
||||||
private Composite bottom;
|
|
||||||
|
|
||||||
/** The tree viewer. */
|
|
||||||
private TreeViewer dbTreeViewer;
|
|
||||||
|
|
||||||
/** The name filter of the design browser tree. */
|
|
||||||
private Text treeNameFilter;
|
|
||||||
|
|
||||||
/** The attribute filter. */
|
|
||||||
StreamTTreeFilter treeAttributeFilter;
|
|
||||||
|
|
||||||
/** The name filter. */
|
|
||||||
private Text tableNameFilter;
|
|
||||||
|
|
||||||
/** The attribute filter. */
|
|
||||||
StreamTableFilter tableAttributeFilter;
|
|
||||||
|
|
||||||
/** The tx table viewer. */
|
|
||||||
protected TableViewer streamTableViewer;
|
|
||||||
|
|
||||||
/** The append all item. */
|
|
||||||
protected ToolItem appendItem, insertItem;
|
|
||||||
|
|
||||||
/** The other selection count. */
|
|
||||||
int thisSelectionCount=0, otherSelectionCount=0;
|
|
||||||
|
|
||||||
IWaveformDb waveformDb=null;
|
|
||||||
|
|
||||||
/** The tree viewer pcl. */
|
|
||||||
private PropertyChangeListener treeViewerPCL = new PropertyChangeListener() {
|
|
||||||
@Override
|
|
||||||
public void propertyChange(PropertyChangeEvent evt) {
|
|
||||||
if("CHILDS".equals(evt.getPropertyName())){ //$NON-NLS-1$
|
|
||||||
dbTreeViewer.getTree().getDisplay().asyncExec(new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
dbTreeViewer.refresh();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
/** The sash paint listener. */
|
|
||||||
protected PaintListener sashPaintListener=new PaintListener() {
|
|
||||||
@Override
|
|
||||||
public void paintControl(PaintEvent e) {
|
|
||||||
int size=Math.min(e.width, e.height)-1;
|
|
||||||
e.gc.setForeground(SWTResourceManager.getColor(SWT.COLOR_DARK_GRAY));
|
|
||||||
e.gc.setFillRule(SWT.FILL_EVEN_ODD);
|
|
||||||
if(e.width>e.height)
|
|
||||||
e.gc.drawArc(e.x+(e.width-size)/2, e.y, size, size, 0, 360);
|
|
||||||
else
|
|
||||||
e.gc.drawArc(e.x, e.y+(e.height-size)/2, size, size, 0, 360);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Creates the composite.
|
|
||||||
*
|
|
||||||
* @param parent the parent
|
|
||||||
*/
|
|
||||||
@PostConstruct
|
|
||||||
public void createComposite(Composite parent) {
|
|
||||||
sashForm = new SashForm(parent, SWT.BORDER | SWT.SMOOTH | SWT.VERTICAL);
|
|
||||||
|
|
||||||
top = new Composite(sashForm, SWT.NONE);
|
|
||||||
createTreeViewerComposite(top);
|
|
||||||
bottom = new Composite(sashForm, SWT.NONE);
|
|
||||||
createTableComposite(bottom);
|
|
||||||
|
|
||||||
sashForm.setWeights(new int[] {100, 100});
|
|
||||||
sashForm.SASH_WIDTH=5;
|
|
||||||
top.addControlListener(new ControlAdapter() {
|
|
||||||
public void controlResized(ControlEvent e) {
|
|
||||||
sashForm.getChildren()[2].addPaintListener(sashPaintListener);
|
|
||||||
top.removeControlListener(this);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Creates the tree viewer composite.
|
|
||||||
*
|
|
||||||
* @param parent the parent
|
|
||||||
*/
|
|
||||||
public void createTreeViewerComposite(Composite parent) {
|
|
||||||
parent.setLayout(new GridLayout(1, false));
|
|
||||||
|
|
||||||
treeNameFilter = new Text(parent, SWT.BORDER);
|
|
||||||
treeNameFilter.setMessage(Messages.DesignBrowser_3);
|
|
||||||
treeNameFilter.addModifyListener(new ModifyListener() {
|
|
||||||
@Override
|
|
||||||
public void modifyText(ModifyEvent e) {
|
|
||||||
treeAttributeFilter.setSearchText(((Text) e.widget).getText());
|
|
||||||
dbTreeViewer.refresh();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
treeNameFilter.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
|
|
||||||
|
|
||||||
treeAttributeFilter = new StreamTTreeFilter();
|
|
||||||
|
|
||||||
dbTreeViewer = new TreeViewer(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
|
|
||||||
dbTreeViewer.getTree().setLayoutData(new GridData(GridData.FILL_BOTH));
|
|
||||||
dbTreeViewer.setContentProvider(new TxDbContentProvider());
|
|
||||||
dbTreeViewer.setLabelProvider(new TxDbLabelProvider());
|
|
||||||
dbTreeViewer.addFilter(treeAttributeFilter);
|
|
||||||
dbTreeViewer.setUseHashlookup(true);
|
|
||||||
dbTreeViewer.setAutoExpandLevel(2);
|
|
||||||
dbTreeViewer.addSelectionChangedListener(new ISelectionChangedListener() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void selectionChanged(SelectionChangedEvent event) {
|
|
||||||
ISelection selection=event.getSelection();
|
|
||||||
if( selection instanceof IStructuredSelection) {
|
|
||||||
Object object= ((IStructuredSelection)selection).getFirstElement();
|
|
||||||
if(object instanceof IHierNode && ((IHierNode)object).getChildNodes().size()!=0){
|
|
||||||
streamTableViewer.setInput(object);
|
|
||||||
updateButtons();
|
|
||||||
}
|
|
||||||
else { //if selection is changed but empty
|
|
||||||
streamTableViewer.setInput(null);
|
|
||||||
updateButtons();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Creates the table composite.
|
|
||||||
*
|
|
||||||
* @param parent the parent
|
|
||||||
*/
|
|
||||||
public void createTableComposite(Composite parent) {
|
|
||||||
parent.setLayout(new GridLayout(1, false));
|
|
||||||
|
|
||||||
tableNameFilter = new Text(parent, SWT.BORDER);
|
|
||||||
tableNameFilter.setMessage(Messages.DesignBrowser_2);
|
|
||||||
tableNameFilter.addModifyListener(new ModifyListener() {
|
|
||||||
@Override
|
|
||||||
public void modifyText(ModifyEvent e) {
|
|
||||||
tableAttributeFilter.setSearchText(((Text) e.widget).getText());
|
|
||||||
updateButtons();
|
|
||||||
streamTableViewer.refresh();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
tableNameFilter.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
|
|
||||||
|
|
||||||
tableAttributeFilter = new StreamTableFilter();
|
|
||||||
|
|
||||||
streamTableViewer = new TableViewer(parent);
|
|
||||||
streamTableViewer.setContentProvider(new TxDbContentProvider(true));
|
|
||||||
streamTableViewer.setLabelProvider(new TxDbLabelProvider());
|
|
||||||
streamTableViewer.getTable().setLayoutData(new GridData(GridData.FILL_BOTH));
|
|
||||||
streamTableViewer.addFilter(tableAttributeFilter);
|
|
||||||
streamTableViewer.addSelectionChangedListener(new ISelectionChangedListener() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void selectionChanged(SelectionChangedEvent event) {
|
|
||||||
selectionService.setSelection(event.getSelection());
|
|
||||||
updateButtons();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
menuService.registerContextMenu(streamTableViewer.getControl(), POPUP_ID);
|
|
||||||
|
|
||||||
ToolBar toolBar = new ToolBar(parent, SWT.FLAT | SWT.RIGHT);
|
|
||||||
toolBar.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1));
|
|
||||||
toolBar.setBounds(0, 0, 87, 20);
|
|
||||||
|
|
||||||
appendItem = new ToolItem(toolBar, SWT.NONE);
|
|
||||||
appendItem.setToolTipText(Messages.DesignBrowser_4);
|
|
||||||
appendItem.setImage(ResourceManager.getPluginImage("com.minres.scviewer.e4.application", "icons/append_wave.png")); //$NON-NLS-1$ //$NON-NLS-2$
|
|
||||||
appendItem.setEnabled(false);
|
|
||||||
|
|
||||||
insertItem = new ToolItem(toolBar, SWT.NONE);
|
|
||||||
insertItem.setToolTipText(Messages.DesignBrowser_8);
|
|
||||||
insertItem.setImage(ResourceManager.getPluginImage("com.minres.scviewer.e4.application", "icons/insert_wave.png")); //$NON-NLS-1$ //$NON-NLS-2$
|
|
||||||
insertItem.setEnabled(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
public IWaveformDb getWaveformDb() {
|
|
||||||
return waveformDb;
|
|
||||||
}
|
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
public void setWaveformDb(IWaveformDb waveformDb) {
|
|
||||||
this.waveformDb = waveformDb;
|
|
||||||
Object input = dbTreeViewer.getInput();
|
|
||||||
if(input!=null && input instanceof List<?>){
|
|
||||||
IWaveformDb db = ((List<IWaveformDb>)input).get(0);
|
|
||||||
if(db==waveformDb) return; // do nothing if old and new database is the same
|
|
||||||
((List<IWaveformDb>)input).get(0).removePropertyChangeListener(treeViewerPCL);
|
|
||||||
}
|
|
||||||
dbTreeViewer.setInput(Arrays.asList(waveformDb.isLoaded()?new IWaveformDb[]{waveformDb}:new IWaveformDb[]{new LoadingWaveformDb()}));
|
|
||||||
// Set up the tree viewer
|
|
||||||
waveformDb.addPropertyChangeListener(treeViewerPCL);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the focus.
|
|
||||||
*/
|
|
||||||
@Focus
|
|
||||||
public void setFocus() {
|
|
||||||
if(streamTableViewer!=null) {
|
|
||||||
streamTableViewer.getTable().setFocus();
|
|
||||||
IStructuredSelection selection = (IStructuredSelection)streamTableViewer.getSelection();
|
|
||||||
if(selection.size()==0){
|
|
||||||
appendItem.setEnabled(false);
|
|
||||||
}
|
|
||||||
selectionService.setSelection(selection);
|
|
||||||
thisSelectionCount=selection.toList().size();
|
|
||||||
}
|
|
||||||
updateButtons();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* reset tree viewer and tableviewer after every closed tab
|
|
||||||
*/
|
|
||||||
protected void resetTreeViewer() {
|
|
||||||
//reset tree- and tableviewer
|
|
||||||
dbTreeViewer.setInput(null);
|
|
||||||
streamTableViewer.setInput(null);
|
|
||||||
streamTableViewer.setSelection(null);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void selectAllWaveforms() {
|
|
||||||
int itemCount = streamTableViewer.getTable().getItemCount();
|
|
||||||
ArrayList<Object> list = new ArrayList<>();
|
|
||||||
for(int i=0; i<itemCount; i++) {
|
|
||||||
list.add(streamTableViewer.getElementAt(i));
|
|
||||||
}
|
|
||||||
StructuredSelection sel = new StructuredSelection(list);
|
|
||||||
streamTableViewer.setSelection(sel);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the selection.
|
|
||||||
*
|
|
||||||
* @param selection the selection
|
|
||||||
* @param partService the part service
|
|
||||||
*/
|
|
||||||
@Inject
|
|
||||||
public void setSelection(@Named(IServiceConstants.ACTIVE_SELECTION) @Optional IStructuredSelection selection, EPartService partService){
|
|
||||||
MPart part = partService.getActivePart();
|
|
||||||
if(part!=null && part.getObject() != this && selection!=null){
|
|
||||||
if( selection instanceof IStructuredSelection) {
|
|
||||||
Object object= ((IStructuredSelection)selection).getFirstElement();
|
|
||||||
if(object instanceof IHierNode&& ((IHierNode)object).getChildNodes().size()!=0)
|
|
||||||
streamTableViewer.setInput(object);
|
|
||||||
otherSelectionCount = (object instanceof IWaveform || object instanceof ITx)?1:0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
updateButtons();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Initialize the listeners for the buttons.
|
|
||||||
*/
|
|
||||||
protected abstract void initializeButtonListeners();
|
|
||||||
/**
|
|
||||||
* Update buttons.
|
|
||||||
*/
|
|
||||||
protected abstract void updateButtons();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The Class StreamTableFilter.
|
|
||||||
*/
|
|
||||||
public class StreamTableFilter extends ViewerFilter {
|
|
||||||
|
|
||||||
/** The search string. */
|
|
||||||
private String searchString;
|
|
||||||
private Pattern pattern;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the search text.
|
|
||||||
*
|
|
||||||
* @param s the new search text
|
|
||||||
*/
|
|
||||||
public void setSearchText(String s) {
|
|
||||||
try {
|
|
||||||
pattern = Pattern.compile(".*" + s + ".*"); //$NON-NLS-1$ //$NON-NLS-2$
|
|
||||||
this.searchString = ".*" + s + ".*"; //$NON-NLS-1$ //$NON-NLS-2$
|
|
||||||
} catch (PatternSyntaxException e) {}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.jface.viewers.ViewerFilter#select(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public boolean select(Viewer viewer, Object parentElement, Object element) {
|
|
||||||
if (searchString == null || searchString.length() == 0) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if(element instanceof IWaveform) {
|
|
||||||
if (pattern.matcher(((IWaveform) element).getName()).matches())
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public class StreamTTreeFilter extends ViewerFilter {
|
|
||||||
|
|
||||||
/** The search string. */
|
|
||||||
private String searchString;
|
|
||||||
private Pattern pattern;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the search text.
|
|
||||||
*
|
|
||||||
* @param s the new search text
|
|
||||||
*/
|
|
||||||
public void setSearchText(String s) {
|
|
||||||
try {
|
|
||||||
pattern = Pattern.compile(".*" + s + ".*");
|
|
||||||
this.searchString = ".*" + s + ".*"; //$NON-NLS-1$ //$NON-NLS-2$
|
|
||||||
} catch (PatternSyntaxException e) {}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
|
||||||
* @see org.eclipse.jface.viewers.ViewerFilter#select(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public boolean select(Viewer viewer, Object parentElement, Object element) {
|
|
||||||
return selectTreePath(viewer, new TreePath(new Object[] { parentElement }), element);
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean selectTreePath(Viewer viewer, TreePath parentPath, Object element) {
|
|
||||||
// Cut off children of elements that are shown repeatedly.
|
|
||||||
for (int i = 0; i < parentPath.getSegmentCount() - 1; i++) {
|
|
||||||
if (element.equals(parentPath.getSegment(i))) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!(viewer instanceof TreeViewer)) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if (searchString == null || searchString.length() == 0) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
TreeViewer treeViewer = (TreeViewer) viewer;
|
|
||||||
Boolean matchingResult = isMatchingOrNull(element);
|
|
||||||
if (matchingResult != null) {
|
|
||||||
return matchingResult;
|
|
||||||
}
|
|
||||||
return hasUnfilteredChild(treeViewer, parentPath, element);
|
|
||||||
}
|
|
||||||
|
|
||||||
Boolean isMatchingOrNull(Object element) {
|
|
||||||
if(element instanceof IWaveform) {
|
|
||||||
if (pattern.matcher(((IWaveform) element).getName()).matches())
|
|
||||||
return Boolean.TRUE;
|
|
||||||
} else if(element instanceof IWaveformDb) {
|
|
||||||
return Boolean.TRUE;
|
|
||||||
} else if(element instanceof HierNode) {
|
|
||||||
HierNode n = (HierNode) element;
|
|
||||||
try {
|
|
||||||
if (pattern.matcher(n.getFullName()).matches())
|
|
||||||
return Boolean.TRUE;
|
|
||||||
} catch (PatternSyntaxException e) {
|
|
||||||
return Boolean.TRUE;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
return Boolean.FALSE;
|
|
||||||
}
|
|
||||||
/* maybe children are matching */
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean hasUnfilteredChild(TreeViewer viewer, TreePath parentPath, Object element) {
|
|
||||||
TreePath elementPath = parentPath.createChildPath(element);
|
|
||||||
IContentProvider contentProvider = viewer.getContentProvider();
|
|
||||||
Object[] children = contentProvider instanceof ITreePathContentProvider
|
|
||||||
? ((ITreePathContentProvider) contentProvider).getChildren(elementPath)
|
|
||||||
: ((ITreeContentProvider) contentProvider).getChildren(element);
|
|
||||||
|
|
||||||
/* avoid NPE + guard close */
|
|
||||||
if (children == null || children.length == 0) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
for (int i = 0; i < children.length; i++) {
|
|
||||||
if (selectTreePath(viewer, elementPath, children[i])) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Gets the filtered children.
|
|
||||||
*
|
|
||||||
* @param viewer the viewer
|
|
||||||
* @return the filtered children
|
|
||||||
*/
|
|
||||||
protected Object[] getFilteredChildren(TableViewer viewer){
|
|
||||||
Object parent = viewer.getInput();
|
|
||||||
if(parent==null) return new Object[0];
|
|
||||||
Object[] result = null;
|
|
||||||
if (parent != null) {
|
|
||||||
IStructuredContentProvider cp = (IStructuredContentProvider) viewer.getContentProvider();
|
|
||||||
if (cp != null) {
|
|
||||||
result = cp.getElements(parent);
|
|
||||||
if(result==null) return new Object[0];
|
|
||||||
for (int i = 0, n = result.length; i < n; ++i) {
|
|
||||||
if(result[i]==null) return new Object[0];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
ViewerFilter[] filters = viewer.getFilters();
|
|
||||||
if (filters != null) {
|
|
||||||
for (ViewerFilter f:filters) {
|
|
||||||
Object[] filteredResult = f.filter(viewer, parent, result);
|
|
||||||
result = filteredResult;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the filtered children.
|
|
||||||
*
|
|
||||||
* @return the filtered children
|
|
||||||
*/
|
|
||||||
public Object[] getFilteredChildren() {
|
|
||||||
return getFilteredChildren(streamTableViewer);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The Class DBState.
|
|
||||||
*/
|
|
||||||
class DBState {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Instantiates a new DB state.
|
|
||||||
*/
|
|
||||||
public DBState() {
|
|
||||||
this.expandedElements=dbTreeViewer.getExpandedElements();
|
|
||||||
this.treeSelection=dbTreeViewer.getSelection();
|
|
||||||
this.tableSelection=streamTableViewer.getSelection();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Apply.
|
|
||||||
*/
|
|
||||||
public void apply() {
|
|
||||||
dbTreeViewer.setExpandedElements(expandedElements);
|
|
||||||
dbTreeViewer.setSelection(treeSelection, true);
|
|
||||||
streamTableViewer.setSelection(tableSelection, true);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/** The expanded elements. */
|
|
||||||
private Object[] expandedElements;
|
|
||||||
|
|
||||||
/** The tree selection. */
|
|
||||||
private ISelection treeSelection;
|
|
||||||
|
|
||||||
/** The table selection. */
|
|
||||||
private ISelection tableSelection;
|
|
||||||
}
|
|
||||||
};
|
|
|
@ -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();
|
||||||
|
|
|
@ -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) {
|
||||||
|
|
|
@ -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);
|
||||||
|
|
|
@ -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,20 +100,17 @@ 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.ui.AbstractDesignBrowser;
|
|
||||||
import com.minres.scviewer.e4.application.internal.util.FileMonitor;
|
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.IFileChangeListener;
|
||||||
import com.minres.scviewer.e4.application.internal.util.IModificationChecker;
|
import com.minres.scviewer.e4.application.internal.util.IModificationChecker;
|
||||||
import com.minres.scviewer.e4.application.preferences.PreferenceConstants;
|
import com.minres.scviewer.e4.application.preferences.PreferenceConstants;
|
||||||
import org.eclipse.swt.custom.SashForm;
|
|
||||||
import org.eclipse.swt.layout.FillLayout;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Class WaveformViewerPart.
|
* The Class WaveformViewerPart.
|
||||||
|
@ -169,20 +170,10 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
|
||||||
/** The factory. */
|
/** The factory. */
|
||||||
WaveformViewFactory factory = new WaveformViewFactory();
|
WaveformViewFactory factory = new WaveformViewFactory();
|
||||||
|
|
||||||
AbstractDesignBrowser browser = new AbstractDesignBrowser() {
|
DesignBrowser browser = null;
|
||||||
|
|
||||||
@Override
|
TransactionDetails detailsView = null;
|
||||||
protected void updateButtons() {
|
|
||||||
// TODO Auto-generated method stub
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void initializeButtonListeners() {
|
|
||||||
// TODO Auto-generated method stub
|
|
||||||
|
|
||||||
}
|
|
||||||
};
|
|
||||||
/** The waveform pane. */
|
/** The waveform pane. */
|
||||||
private IWaveformView waveformPane;
|
private IWaveformView waveformPane;
|
||||||
|
|
||||||
|
@ -280,19 +271,31 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
parent.setLayout(new FillLayout(SWT.HORIZONTAL));
|
parent.setLayout(new FillLayout(SWT.HORIZONTAL));
|
||||||
SashForm sashFormTop = new SashForm(parent, SWT.NONE);
|
SashForm sashFormTop = new SashForm(parent, SWT.BORDER | SWT.SMOOTH);
|
||||||
|
|
||||||
Composite left = new Composite(sashFormTop, SWT.NONE);
|
Composite left = new Composite(sashFormTop, SWT.NONE);
|
||||||
left.setLayout(new FillLayout(SWT.HORIZONTAL));
|
|
||||||
|
|
||||||
browser.createComposite(left);
|
IEclipseContext ctx = myPart.getContext();
|
||||||
browser.setWaveformDb(database);
|
ctx.set(WaveformViewer.class, this);
|
||||||
|
ctx.set(IWaveformDb.class, database);
|
||||||
|
ctx.set(Composite.class, left);
|
||||||
|
|
||||||
Composite right = new Composite(sashFormTop, SWT.NONE);
|
browser = ContextInjectionFactory.make(DesignBrowser.class, ctx);
|
||||||
|
|
||||||
waveformPane = factory.createPanel(right);
|
//Composite right = new Composite(sashFormTop, SWT.NONE);
|
||||||
|
SashForm sashFormRight = new SashForm(sashFormTop, SWT.BORDER | SWT.SMOOTH | SWT.VERTICAL);
|
||||||
sashFormTop.setWeights(new int[] {25, 75});
|
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
|
||||||
|
@ -765,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
|
||||||
|
|
|
@ -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)
|
||||||
|
|
Loading…
Reference in New Issue