Merge branch 'feature/unified_window' into develop
This commit is contained in:
commit
b483897769
@ -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.problem.assertIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.release=disabled
|
||||
org.eclipse.jdt.core.compiler.source=1.8
|
||||
|
@ -18,6 +18,5 @@
|
||||
<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/elsa-3.0.0-M5.jar"/>
|
||||
<classpathentry kind="con" path="GROOVY_SUPPORT"/>
|
||||
<classpathentry kind="output" path="target/classes"/>
|
||||
</classpath>
|
||||
|
@ -1,3 +1,3 @@
|
||||
eclipse.preferences.version=1
|
||||
groovy.compiler.level=25
|
||||
groovy.compiler.level=-1
|
||||
groovy.script.filters=**/*.dsld,y,**/*.gradle,n
|
||||
|
@ -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.unusedWarningToken=warning
|
||||
org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
|
||||
org.eclipse.jdt.core.compiler.release=disabled
|
||||
org.eclipse.jdt.core.compiler.source=1.8
|
||||
|
@ -126,24 +126,17 @@ public class ArrowPainter implements IPainter {
|
||||
Rectangle correctedTargetRectangle = new Rectangle(txRectangle.x+correctionValue, txRectangle.y, txRectangle.width, txRectangle.height);
|
||||
for (LinkEntry entry : iRect) {
|
||||
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);
|
||||
drawArrow(proj, target);
|
||||
}
|
||||
for (LinkEntry entry : oRect) {
|
||||
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);
|
||||
drawArrow(proj, target);
|
||||
}
|
||||
}
|
||||
|
||||
protected void drawArrow(Projection proj, Point target) {
|
||||
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) {
|
||||
protected void drawArrow(Projection proj, Color fgColor, Rectangle srcRectangle, Rectangle tgtRectangle) {
|
||||
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));
|
||||
|
||||
@ -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);
|
||||
} else
|
||||
path.cubicTo(point1.x + xCtrlOffset, point1.y, point2.x - xCtrlOffset, point2.y, point2.x, point2.y);
|
||||
|
||||
proj.setAntialias(SWT.ON);
|
||||
proj.setForeground(fgColor);
|
||||
proj.getGC().drawPath(path);
|
||||
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 {
|
||||
|
@ -44,10 +44,6 @@ public class Projection {
|
||||
public void setFillRule(int 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) {
|
||||
gc.setLineStyle(style);
|
||||
}
|
||||
@ -69,6 +65,10 @@ public class Projection {
|
||||
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) {
|
||||
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.width==0){
|
||||
proj.drawLine(bb.x, bb.y, bb.x, bb.y+bb.height);
|
||||
} else if(bb.width<10){
|
||||
proj.fillRectangle(bb);
|
||||
proj.drawRectangle(bb);
|
||||
} else {
|
||||
if(bb.x < area.x) {
|
||||
bb.width = bb.width-(area.x-bb.x)+5;
|
||||
@ -149,8 +146,9 @@ public class StreamPainter extends TrackPainter{
|
||||
bb_x2=area_x2+5;
|
||||
bb.width= bb_x2-bb.x;
|
||||
}
|
||||
proj.fillRoundRectangle(bb.x, bb.y, bb.width, bb.height, 5, 5);
|
||||
proj.drawRoundRectangle(bb.x, bb.y, bb.width, bb.height, 5, 5);
|
||||
int arc = bb.width<10?1: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) {
|
||||
//FIXME: keep center if zoom-out and cursor is not in view
|
||||
long oldScaleFactor=scaleFactor;
|
||||
if(level<0) level = 0;
|
||||
if(level<Constants.unitMultiplier.length*Constants.unitString.length){
|
||||
this.level = level;
|
||||
this.scaleFactor = (long) Math.pow(10, level/2);
|
||||
if(level%2==1) this.scaleFactor*=3;
|
||||
ITx tx = arrowPainter.getTx();
|
||||
@ -243,18 +243,19 @@ public class WaveformCanvas extends Canvas {
|
||||
* xcn = tc/newScaleFactor
|
||||
* t0n = (xcn-xoffs)*scaleFactor
|
||||
*/
|
||||
long xc=centerTime/oldScaleFactor; // cursor total x-offset
|
||||
long xoffs=xc+origin.x; // cursor offset relative to left border
|
||||
long xcn=centerTime/scaleFactor; // new total x-offset
|
||||
long originX=xcn-xoffs;
|
||||
if(originX>0) {
|
||||
origin.x=(int) -originX; // new cursor time offset relative to left border
|
||||
}else {
|
||||
origin.x=0;
|
||||
}
|
||||
long xc=centerTime/oldScaleFactor; // cursor total x-offset
|
||||
long xoffs=xc+origin.x; // cursor offset relative to left border
|
||||
long xcn=centerTime/scaleFactor; // new total x-offset
|
||||
long originX=xcn-xoffs;
|
||||
if(originX>0) {
|
||||
origin.x=(int) -originX; // new cursor time offset relative to left border
|
||||
}else {
|
||||
origin.x=0;
|
||||
}
|
||||
syncScrollBars();
|
||||
arrowPainter.setTx(tx);
|
||||
redraw();
|
||||
this.level = level;
|
||||
}
|
||||
}
|
||||
|
||||
@ -400,12 +401,13 @@ public class WaveformCanvas extends Canvas {
|
||||
|
||||
/* Paint function */
|
||||
private void paint(GC gc) {
|
||||
Point pt = getSize();
|
||||
if(pt.x==0 || pt.y==0) return;
|
||||
Rectangle clientRect = getClientArea(); /* Canvas' painting area */
|
||||
GC thisGc = gc;
|
||||
Image d_backingImg = null;
|
||||
if(doubleBuffering) {
|
||||
Point p = getSize();
|
||||
d_backingImg = new Image(getDisplay(), p.x, p.y);
|
||||
d_backingImg = new Image(getDisplay(), pt.x, pt.y);
|
||||
thisGc = new GC(d_backingImg);
|
||||
thisGc.setBackground(gc.getBackground());
|
||||
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.MouseEvent;
|
||||
import org.eclipse.swt.events.MouseListener;
|
||||
import org.eclipse.swt.events.MouseMoveListener;
|
||||
import org.eclipse.swt.events.PaintEvent;
|
||||
import org.eclipse.swt.events.PaintListener;
|
||||
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;
|
||||
List<Object> initialSelected;
|
||||
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
|
||||
public void paintControl(PaintEvent e) {
|
||||
if(down) {
|
||||
@ -214,8 +187,7 @@ public class WaveformView implements IWaveformView {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseUp(MouseEvent e) {
|
||||
private void mouseUp(MouseEvent e) {
|
||||
down=false;
|
||||
if(start==null) return;
|
||||
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;
|
||||
}
|
||||
|
||||
@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) {
|
||||
pcs=new PropertyChangeSupport(this);
|
||||
@ -322,7 +329,7 @@ public class WaveformView implements IWaveformView {
|
||||
streams = new ObservableList<>();
|
||||
streams.addPropertyChangeListener("content", this);
|
||||
|
||||
top = new Composite(parent, SWT.NONE);
|
||||
top = parent;
|
||||
top.setLayout(new FillLayout(SWT.HORIZONTAL));
|
||||
|
||||
SashForm topSash = new SashForm(top, SWT.SMOOTH);
|
||||
@ -407,9 +414,12 @@ public class WaveformView implements IWaveformView {
|
||||
valueListScrolled.setContent(valueList);
|
||||
|
||||
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() {
|
||||
public void widgetSelected(SelectionEvent e) {
|
||||
@ -895,7 +905,7 @@ public class WaveformView implements IWaveformView {
|
||||
@Override
|
||||
public void moveCursor(GotoDirection direction) {
|
||||
if(currentWaveformSelection.size()!=1) return;
|
||||
TrackEntry sel = currentWaveformSelection.get(1);
|
||||
TrackEntry sel = currentWaveformSelection.get(0);
|
||||
long time = getCursorTime();
|
||||
NavigableMap<Long, ?> map=null;
|
||||
if(sel.isStream()){
|
||||
|
@ -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.problem.assertIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.release=disabled
|
||||
org.eclipse.jdt.core.compiler.source=1.8
|
||||
|
@ -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.enumIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
|
||||
org.eclipse.jdt.core.compiler.release=disabled
|
||||
org.eclipse.jdt.core.compiler.source=1.8
|
||||
|
@ -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.problem.assertIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.release=disabled
|
||||
org.eclipse.jdt.core.compiler.source=1.8
|
||||
|
@ -1,3 +1,2 @@
|
||||
eclipse.preferences.version=1
|
||||
pluginProject.extensions=false
|
||||
resolve.requirebundle=false
|
||||
|
@ -3,34 +3,8 @@
|
||||
<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: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">
|
||||
<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 xsi:type="basic:PartStack" xmi:id="_95QGyXNmEeWBq8z1Dv39LA" elementId="org.eclipse.editorss" containerData="7500">
|
||||
<tags>NoAutoCollapse</tags>
|
||||
</children>
|
||||
</children>
|
||||
</children>
|
||||
|
@ -123,7 +123,7 @@ public class RelationTypeToolControl extends PartListener implements ISelectionC
|
||||
return;
|
||||
}
|
||||
}
|
||||
comboViewer.getCombo().setEnabled(false);
|
||||
if(comboViewer!=null) comboViewer.getCombo().setEnabled(false);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
|
@ -22,6 +22,7 @@ import org.eclipse.jface.viewers.IStructuredSelection;
|
||||
|
||||
import com.minres.scviewer.database.ITx;
|
||||
import com.minres.scviewer.database.IWaveform;
|
||||
import com.minres.scviewer.database.ui.TrackEntry;
|
||||
import com.minres.scviewer.e4.application.parts.WaveformViewer;
|
||||
|
||||
public class MoveWaveformHandler {
|
||||
@ -33,7 +34,7 @@ public class MoveWaveformHandler {
|
||||
Object sel = selectionService.getSelection();
|
||||
if( sel instanceof IStructuredSelection) {
|
||||
Object o= ((IStructuredSelection)sel).getFirstElement();
|
||||
return o instanceof IWaveform || o instanceof ITx;
|
||||
return o instanceof IWaveform || o instanceof ITx | o instanceof TrackEntry;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -23,6 +23,7 @@ import org.eclipse.jface.viewers.IStructuredSelection;
|
||||
import com.minres.scviewer.database.ITx;
|
||||
import com.minres.scviewer.database.IWaveform;
|
||||
import com.minres.scviewer.database.ui.GotoDirection;
|
||||
import com.minres.scviewer.database.ui.TrackEntry;
|
||||
import com.minres.scviewer.e4.application.parts.WaveformViewer;
|
||||
|
||||
public class NavigateEvent {
|
||||
@ -34,7 +35,7 @@ public class NavigateEvent {
|
||||
Object sel = selectionService.getSelection();
|
||||
if( sel instanceof IStructuredSelection) {
|
||||
Object o= ((IStructuredSelection)sel).getFirstElement();
|
||||
return o instanceof IWaveform || o instanceof ITx;
|
||||
return o instanceof IWaveform || o instanceof ITx || o instanceof TrackEntry;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -11,6 +11,7 @@
|
||||
package com.minres.scviewer.e4.application.handlers;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.e4.core.contexts.IEclipseContext;
|
||||
@ -39,13 +40,14 @@ public class OpenHandler {
|
||||
part.setLabel(files.get(0).getName());
|
||||
MPartStack partStack = (MPartStack)modelService.find("org.eclipse.editorss", app); //$NON-NLS-1$
|
||||
partStack.getChildren().add(part);
|
||||
partService.showPart(part, PartState.ACTIVATE);
|
||||
partService.showPart(part, PartState.CREATE);
|
||||
final IEclipseContext ctx=part.getContext();
|
||||
files.stream()
|
||||
.map(x -> x.getAbsolutePath())
|
||||
.reduce((s1, s2) -> s1 + "," + s2)
|
||||
.ifPresent(s -> ctx.modify("input", s)); //$NON-NLS-1$
|
||||
ctx.modify("config", ""); //$NON-NLS-1$
|
||||
List<String> inputs=new ArrayList<>();
|
||||
for(File f: files)
|
||||
inputs.add(f.getAbsolutePath());
|
||||
ctx.modify("input", inputs);
|
||||
ctx.modify("config", ""); //$NON-NLS-1$
|
||||
partStack.setSelectedElement(part);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -64,6 +64,7 @@ import org.eclipse.swt.events.PaintEvent;
|
||||
import org.eclipse.swt.events.PaintListener;
|
||||
import org.eclipse.swt.events.SelectionAdapter;
|
||||
import org.eclipse.swt.events.SelectionEvent;
|
||||
import org.eclipse.swt.layout.FillLayout;
|
||||
import org.eclipse.swt.layout.GridData;
|
||||
import org.eclipse.swt.layout.GridLayout;
|
||||
import org.eclipse.swt.widgets.Composite;
|
||||
@ -149,6 +150,14 @@ public class DesignBrowser {
|
||||
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
|
||||
*/
|
||||
@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);
|
||||
|
||||
top = new Composite(sashForm, SWT.NONE);
|
||||
@ -193,6 +203,8 @@ public class DesignBrowser {
|
||||
top.removeControlListener(this);
|
||||
}
|
||||
});
|
||||
if(waveformViewerPart!=null)
|
||||
setWaveformViewer(waveformViewerPart);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -366,13 +378,11 @@ public class DesignBrowser {
|
||||
* @param waveformViewerPart the waveform viewer part
|
||||
* @return the status event
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
@Inject @Optional
|
||||
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.storeDesignBrowerState(new DBState());
|
||||
waveformViewerPart.addDisposeListener( new DisposeListener() {
|
||||
@Override
|
||||
public void widgetDisposed(DisposeEvent e) {
|
||||
@ -384,7 +394,12 @@ public class DesignBrowser {
|
||||
}
|
||||
}
|
||||
} );
|
||||
setWaveformViewer(waveformViewerPart);
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public void setWaveformViewer(WaveformViewer waveformViewerPart) {
|
||||
this.waveformViewerPart=waveformViewerPart;
|
||||
IWaveformDb database = waveformViewerPart.getDatabase();
|
||||
Object input = treeViewer.getInput();
|
||||
|
@ -381,16 +381,12 @@ public class FileBrowserDialog extends TrayDialog {
|
||||
class FileTreeLabelProvider implements ILabelProvider {
|
||||
private List<ILabelProviderListener> listeners;
|
||||
|
||||
private Image file;
|
||||
|
||||
private Image dir;
|
||||
|
||||
public FileTreeLabelProvider() {
|
||||
listeners = new ArrayList<ILabelProviderListener>();
|
||||
}
|
||||
|
||||
public Image getImage(Object arg0) {
|
||||
return ((File) arg0).isDirectory() ? folderImage : file;
|
||||
return ((File) arg0).isDirectory() ? folderImage : fileImage;
|
||||
}
|
||||
|
||||
public String getText(Object arg0) {
|
||||
@ -402,16 +398,12 @@ public class FileBrowserDialog extends TrayDialog {
|
||||
listeners.add(arg0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dispose() {
|
||||
// Dispose the images
|
||||
if (dir != null)
|
||||
dir.dispose();
|
||||
if (file != null)
|
||||
file.dispose();
|
||||
}
|
||||
|
||||
public boolean isLabelProperty(Object arg0, String arg1) {
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
public void removeListener(ILabelProviderListener arg0) {
|
||||
|
@ -120,7 +120,9 @@ public class TransactionDetails {
|
||||
* @param parent the parent
|
||||
*/
|
||||
@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));
|
||||
|
||||
nameFilter = new Text(parent, SWT.BORDER);
|
||||
@ -262,7 +264,8 @@ public class TransactionDetails {
|
||||
*/
|
||||
@Focus
|
||||
public void setFocus() {
|
||||
treeViewer.getTree().setFocus();
|
||||
if(treeViewer!=null)
|
||||
treeViewer.getTree().setFocus();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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.IPreferenceChangeListener;
|
||||
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.extensions.Preference;
|
||||
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.StructuredSelection;
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.custom.SashForm;
|
||||
import org.eclipse.swt.events.DisposeEvent;
|
||||
import org.eclipse.swt.events.DisposeListener;
|
||||
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.RGB;
|
||||
import org.eclipse.swt.graphics.Rectangle;
|
||||
import org.eclipse.swt.layout.FillLayout;
|
||||
import org.eclipse.swt.layout.GridData;
|
||||
import org.eclipse.swt.widgets.Composite;
|
||||
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.ValueDisplay;
|
||||
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.ToolTipContentProvider;
|
||||
import com.minres.scviewer.database.ui.swt.ToolTipHelpTextProvider;
|
||||
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.internal.status.WaveStatusBarControl;
|
||||
import com.minres.scviewer.e4.application.internal.util.FileMonitor;
|
||||
@ -166,6 +170,10 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
|
||||
/** The factory. */
|
||||
WaveformViewFactory factory = new WaveformViewFactory();
|
||||
|
||||
DesignBrowser browser = null;
|
||||
|
||||
TransactionDetails detailsView = null;
|
||||
|
||||
/** The waveform pane. */
|
||||
private IWaveformView waveformPane;
|
||||
|
||||
@ -199,7 +207,7 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
|
||||
private boolean checkForUpdates;
|
||||
|
||||
/** The my part. */
|
||||
private MPart myPart;
|
||||
@Inject private MPart myPart;
|
||||
|
||||
/** The my parent. */
|
||||
private Composite myParent;
|
||||
@ -207,6 +215,8 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
|
||||
/** The files to load. */
|
||||
ArrayList<File> filesToLoad = new ArrayList<>();
|
||||
|
||||
String partConfig = "";
|
||||
|
||||
/** The persisted state. */
|
||||
Map<String, String> persistedState;
|
||||
|
||||
@ -225,6 +235,10 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
|
||||
/** The file checker. */
|
||||
IModificationChecker fileChecker;
|
||||
|
||||
@Inject IWaveformDbFactory dbFactory;
|
||||
|
||||
@Inject Composite parent;
|
||||
|
||||
private Boolean showHover;
|
||||
|
||||
/**
|
||||
@ -235,7 +249,7 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
|
||||
* @param dbFactory the db factory
|
||||
*/
|
||||
@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;
|
||||
|
||||
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);
|
||||
setupColors();
|
||||
//set selection to empty selection when opening a new waveformPane
|
||||
@ -614,48 +653,21 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
|
||||
*/
|
||||
@Inject
|
||||
@Optional
|
||||
public void setPartInput(@Named("input") Object partInput, @Named("config") Object partConfig) {
|
||||
if (partInput instanceof String) {
|
||||
String name = (String)partInput;
|
||||
filesToLoad = new ArrayList<File>();
|
||||
boolean explicit = name.contains(",");
|
||||
for(String tok: name.split(",")) {
|
||||
File file = new File(tok);
|
||||
if(file.isFile() && "CURRENT".equals(file.getName())){
|
||||
file=file.getParentFile();
|
||||
}
|
||||
if (file.exists()) {
|
||||
filesToLoad.add(file);
|
||||
}
|
||||
if(!explicit)
|
||||
try {
|
||||
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)
|
||||
loadDatabase(persistedState);
|
||||
if(partConfig instanceof String && ((String)partConfig).length()>0) {
|
||||
loadState((String) partConfig);
|
||||
}
|
||||
public void setPartInput(@Named("input") List<String> partInput, @Named("config") String partConfig) {
|
||||
for(String s:partInput) {
|
||||
File file = new File(s);
|
||||
if(file.isFile() && "CURRENT".equals(file.getName()))
|
||||
file=file.getParentFile();
|
||||
if (file.exists())
|
||||
filesToLoad.add(file);
|
||||
}
|
||||
if(partConfig!=null) {
|
||||
this.partConfig=partConfig;
|
||||
}
|
||||
if (filesToLoad.size() > 0)
|
||||
loadDatabase(persistedState);
|
||||
if(partConfig.length()>0)
|
||||
loadState(partConfig);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -663,7 +675,7 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
|
||||
*/
|
||||
@Focus
|
||||
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
|
||||
ISelection selection = waveformPane.getSelection();
|
||||
if (!selection.isEmpty()) {
|
||||
List<Object> t = getISelection(selection);
|
||||
if(t.get(0) instanceof ITx) {
|
||||
ITx tx = (ITx) t.get(0);
|
||||
TrackEntry te = (TrackEntry) t.get(1);
|
||||
List<Object> sel = getISelection(selection);
|
||||
if(sel.size()>1 && sel.get(0) instanceof ITx && sel.get(1) instanceof TrackEntry) {
|
||||
ITx tx = (ITx) sel.get(0);
|
||||
TrackEntry te = (TrackEntry) sel.get(1);
|
||||
// get transaction id
|
||||
persistedState.put(SELECTED_TX_ID, Long.toString(tx.getId()));
|
||||
//get TrackEntry name
|
||||
@ -1108,7 +1120,10 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
|
||||
* @return the selection
|
||||
*/
|
||||
public ISelection getSelection() {
|
||||
return waveformPane.getSelection();
|
||||
if(waveformPane!=null)
|
||||
return waveformPane.getSelection();
|
||||
else
|
||||
return new StructuredSelection();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1259,5 +1274,4 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
|
||||
eventBroker.post(WaveStatusBarControl.MARKER_DIFF, null);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -63,12 +63,6 @@ public class TxDbLabelProvider implements ILabelProvider {
|
||||
*/
|
||||
@Override
|
||||
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)
|
||||
|
@ -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.problem.assertIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.release=disabled
|
||||
org.eclipse.jdt.core.compiler.source=1.8
|
||||
|
@ -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.enumIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
|
||||
org.eclipse.jdt.core.compiler.release=disabled
|
||||
org.eclipse.jdt.core.compiler.source=1.8
|
||||
|
Loading…
Reference in New Issue
Block a user