Restructured plugins

This commit is contained in:
Eyck Jentzsch 2015-11-03 22:29:42 +01:00
parent 83fd7877f2
commit 7d3c37e989
48 changed files with 472 additions and 162 deletions

View File

@ -3,6 +3,5 @@
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src/"/>
<classpathentry exported="true" kind="lib" path="swing2swt.jar"/>
<classpathentry kind="output" path="target/classes"/>
</classpath>

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>com.minres.scviewer.database.swt</name>
<name>com.minres.scviewer.database.ui.swt</name>
<comment></comment>
<projects>
</projects>

View File

@ -1,7 +1,7 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: SWT widget
Bundle-SymbolicName: com.minres.scviewer.database.swt
Bundle-SymbolicName: com.minres.scviewer.database.ui.swt
Bundle-Version: 1.0.0.qualifier
Bundle-Vendor: MINRES Technologies GmbH
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
@ -9,7 +9,8 @@ Require-Bundle: org.eclipse.swt;bundle-version="3.103.1",
com.minres.scviewer.database;bundle-version="1.0.0",
com.google.guava;bundle-version="15.0.0",
org.eclipse.jface,
org.eclipse.equinox.registry
org.eclipse.equinox.registry,
com.minres.scviewer.database.ui
Export-Package: com.minres.scviewer.database.swt
Bundle-ClassPath: .,
swing2swt.jar

View File

@ -9,7 +9,6 @@
# MINRES Technologies GmbH - initial API and implementation
###############################################################################
bin.includes = META-INF/,\
.,\
swing2swt.jar
.
source.. = src/
jars.compile.order = .

View File

@ -0,0 +1,11 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>com.minres.scviewer.database.ui.swt</artifactId>
<packaging>eclipse-plugin</packaging>
<parent>
<groupId>com.minres.scviewer</groupId>
<artifactId>com.minres.scviewer.parent</artifactId>
<version>1.0.0-SNAPSHOT</version>
<relativePath>../com.minres.scviewer.parent</relativePath>
</parent>
</project>

View File

@ -25,7 +25,6 @@ import org.eclipse.core.runtime.ListenerList;
import org.eclipse.jface.util.LocalSelectionTransfer;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.ISelectionProvider;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.jface.viewers.StructuredSelection;
@ -84,19 +83,15 @@ import com.minres.scviewer.database.swt.internal.SignalPainter;
import com.minres.scviewer.database.swt.internal.StreamPainter;
import com.minres.scviewer.database.swt.internal.TrackPainter;
import com.minres.scviewer.database.swt.internal.WaveformCanvas;
import com.minres.scviewer.database.ui.GotoDirection;
import com.minres.scviewer.database.ui.IWaveformPanel;
import swing2swt.layout.BorderLayout;
public class TxDisplay implements PropertyChangeListener, ISelectionProvider {
public class TxDisplay implements IWaveformPanel {
private ListenerList selectionChangedListeners = new ListenerList();
private PropertyChangeSupport pcs;
public static final String CURSOR_PROPERTY = "cursor_time";
public static final String MARKER_PROPERTY = "marker_time";
private static final String SELECTION = "selection";
private ITx currentTxSelection;
@ -111,7 +106,7 @@ public class TxDisplay implements PropertyChangeListener, ISelectionProvider {
private Canvas valueList;
WaveformCanvas waveformList;
WaveformCanvas waveformCanvas;
private Composite top;
@ -121,8 +116,6 @@ public class TxDisplay implements PropertyChangeListener, ISelectionProvider {
int selectedMarker = 0;
private Composite trackPane;
private int trackVerticalHeight;
private TreeMap<Integer, IWaveform<? extends IWaveformEvent>> trackVerticalOffset;
@ -154,9 +147,9 @@ public class TxDisplay implements PropertyChangeListener, ISelectionProvider {
public void mouseDown(MouseEvent e) {
start=new Point(e.x, e.y);
if (e.button == 1) {
initialSelected = waveformList.getClicked(start);
initialSelected = waveformCanvas.getClicked(start);
} else if (e.button == 3) {
List<Object> hitted = waveformList.getClicked(start);
List<Object> hitted = waveformCanvas.getClicked(start);
for(Object entry:hitted){
if(entry instanceof IWaveform<?>){
setSelection(new StructuredSelection(entry));
@ -182,7 +175,7 @@ public class TxDisplay implements PropertyChangeListener, ISelectionProvider {
e.widget.getDisplay().asyncExec(new Runnable() {
@Override
public void run() {
waveformList.redraw();
waveformCanvas.redraw();
updateValueList();
}
});
@ -192,7 +185,7 @@ public class TxDisplay implements PropertyChangeListener, ISelectionProvider {
e.widget.getDisplay().asyncExec(new Runnable() {
@Override
public void run() {
waveformList.redraw();
waveformCanvas.redraw();
updateValueList();
}
});
@ -200,9 +193,9 @@ public class TxDisplay implements PropertyChangeListener, ISelectionProvider {
}
protected long snapOffsetToEvent(MouseEvent e) {
long time= waveformList.getTimeForOffset(e.x);
long scaling=5*waveformList.getScaleFactor();
for(Object o:waveformList.getClicked(start)){
long time= waveformCanvas.getTimeForOffset(e.x);
long scaling=5*waveformCanvas.getScaleFactor();
for(Object o:waveformCanvas.getClicked(start)){
Entry<Long, ?> floorEntry=null, ceilEntry=null;
if(o instanceof ISignal<?>){
NavigableMap<Long, ?> map = ((ISignal<?>)o).getEvents();
@ -256,11 +249,7 @@ public class TxDisplay implements PropertyChangeListener, ISelectionProvider {
Composite composite = new Composite(topSash, SWT.NONE);
composite.setLayout(new FillLayout(SWT.HORIZONTAL));
trackPane = new Composite(topSash, SWT.NONE);
trackPane.setLayout(new BorderLayout(0, 0));
waveformList = new WaveformCanvas(trackPane, SWT.NONE);
waveformList.setLayoutData(BorderLayout.CENTER);
waveformCanvas = new WaveformCanvas(topSash, SWT.NONE);
SashForm leftSash = new SashForm(composite, SWT.SMOOTH);
leftSash.setBackground(leftSash.getDisplay().getSystemColor(SWT.COLOR_GRAY));
@ -330,39 +319,39 @@ public class TxDisplay implements PropertyChangeListener, ISelectionProvider {
valueList.addMouseListener(nameValueMouseListener);
valueListScrolled.setContent(valueList);
waveformList.setStreams(streams);
waveformCanvas.setStreams(streams);
// order is important: it is bottom to top
waveformList.addPainter(new TrackPainter(waveformList));
waveformList.addPainter(new RulerPainter(
waveformList, waveformList.getDisplay().getSystemColor(SWT.COLOR_BLACK), waveformList.getDisplay().getSystemColor(SWT.COLOR_WHITE)));
CursorPainter cp = new CursorPainter(waveformList, waveformList.getScaleFactor() * 10, cursorPainters.size()-1);
waveformList.addPainter(cp);
waveformCanvas.addPainter(new TrackPainter(waveformCanvas));
waveformCanvas.addPainter(new RulerPainter(
waveformCanvas, waveformCanvas.getDisplay().getSystemColor(SWT.COLOR_BLACK), waveformCanvas.getDisplay().getSystemColor(SWT.COLOR_WHITE)));
CursorPainter cp = new CursorPainter(waveformCanvas, waveformCanvas.getScaleFactor() * 10, cursorPainters.size()-1);
waveformCanvas.addPainter(cp);
cursorPainters.add(cp);
CursorPainter marker = new CursorPainter(waveformList, waveformList.getScaleFactor() * 100, cursorPainters.size()-1);
waveformList.addPainter(marker);
CursorPainter marker = new CursorPainter(waveformCanvas, waveformCanvas.getScaleFactor() * 100, cursorPainters.size()-1);
waveformCanvas.addPainter(marker);
cursorPainters.add(marker);
waveformList.setMaxTime(1);
waveformList.addMouseListener(waveformMouseListener);
waveformCanvas.setMaxTime(1);
waveformCanvas.addMouseListener(waveformMouseListener);
nameListScrolled.getVerticalBar().addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
int y = ((ScrollBar) e.widget).getSelection();
Point v = valueListScrolled.getOrigin();
valueListScrolled.setOrigin(v.x, y);
Point t = waveformList.getOrigin();
waveformList.setOrigin(t.x, -y);
Point t = waveformCanvas.getOrigin();
waveformCanvas.setOrigin(t.x, -y);
}
});
valueListScrolled.getVerticalBar().addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
int y = ((ScrollBar) e.widget).getSelection();
nameListScrolled.setOrigin(nameListScrolled.getOrigin().x, y);
waveformList.setOrigin(waveformList.getOrigin().x, -y);
waveformCanvas.setOrigin(waveformCanvas.getOrigin().x, -y);
}
});
waveformList.addSelectionListener(new SelectionAdapter() {
waveformCanvas.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
int y = waveformList.getVerticalBar().getSelection();
int y = waveformCanvas.getVerticalBar().getSelection();
nameListScrolled.setOrigin(nameListScrolled.getOrigin().x, y);
valueListScrolled.setOrigin(valueListScrolled.getOrigin().x, y);
}
@ -374,8 +363,8 @@ public class TxDisplay implements PropertyChangeListener, ISelectionProvider {
createStreamDragSource(valueList);
createStreamDropTarget(nameList);
createStreamDropTarget(valueList);
createWaveformDragSource(waveformList);
createWaveformDropTarget(waveformList);
createWaveformDragSource(waveformCanvas);
createWaveformDropTarget(waveformCanvas);
}
private Composite createTextPane(SashForm leftSash, String text) {
@ -389,7 +378,7 @@ public class TxDisplay implements PropertyChangeListener, ISelectionProvider {
CLabel nameLabel = new CLabel(namePane, SWT.NONE);
GridData gd_nameLabel = new GridData(SWT.CENTER, SWT.CENTER, true, false, 1, 1);
gd_nameLabel.heightHint = waveformList.getRulerHeight() - 2;
gd_nameLabel.heightHint = waveformCanvas.getRulerHeight() - 2;
nameLabel.setLayoutData(gd_nameLabel);
nameLabel.setText(text);
@ -417,24 +406,24 @@ public class TxDisplay implements PropertyChangeListener, ISelectionProvider {
IWaveformPainter painter = null;
trackVerticalOffset.clear();
actualValues.clear();
waveformList.clearAllWavefromPainter();
waveformCanvas.clearAllWavefromPainter();
boolean even = true;
boolean clearSelection = true;
TextLayout tl = new TextLayout(waveformList.getDisplay());
TextLayout tl = new TextLayout(waveformCanvas.getDisplay());
tl.setFont(nameFontB);
for (IWaveform<? extends IWaveformEvent> waveform : streams) {
int height = waveformList.getTrackHeight();
int height = waveformCanvas.getTrackHeight();
clearSelection &= (waveform != currentWaveformSelection);
if (waveform instanceof ITxStream<?>) {
ITxStream<? extends ITxEvent> stream = (ITxStream<? extends ITxEvent>) waveform;
height *= stream.getMaxConcurrency();
painter = new StreamPainter(waveformList, even, height, (ITxStream<? extends ITxEvent>) waveform);
painter = new StreamPainter(waveformCanvas, even, height, (ITxStream<? extends ITxEvent>) waveform);
actualValues.put(stream, "");
} else if (waveform instanceof ISignal<?>) {
painter = new SignalPainter(waveformList, even, height, (ISignal<?>) waveform);
painter = new SignalPainter(waveformCanvas, even, height, (ISignal<?>) waveform);
actualValues.put(waveform, "---");
}
waveformList.addWavefromPainter(trackVerticalHeight, painter);
waveformCanvas.addWavefromPainter(trackVerticalHeight, painter);
trackVerticalOffset.put(trackVerticalHeight, waveform);
tl.setText(waveform.getFullName());
nameMaxWidth = Math.max(nameMaxWidth, tl.getBounds().width);
@ -447,11 +436,11 @@ public class TxDisplay implements PropertyChangeListener, ISelectionProvider {
valueListScrolled.setMinSize(calculateValueWidth(), trackVerticalHeight);
nameList.redraw();
updateValueList();
waveformList.redraw();
top.layout(new Control[] { valueList, nameList, waveformList });
waveformCanvas.redraw();
top.layout(new Control[] { valueList, nameList, waveformCanvas });
if (trackVerticalOffset.isEmpty() || previousHeight > trackVerticalOffset.lastKey()) {
Point o = waveformList.getOrigin();
waveformList.setOrigin(o.x, o.y - (previousHeight - trackVerticalOffset.lastKey()));
Point o = waveformCanvas.getOrigin();
waveformCanvas.setOrigin(o.x, o.y - (previousHeight - trackVerticalOffset.lastKey()));
}
if(clearSelection) setSelection(new StructuredSelection());
/* System.out.println("updateTracklist() state:");
@ -461,7 +450,7 @@ public class TxDisplay implements PropertyChangeListener, ISelectionProvider {
*/ }
private int calculateValueWidth() {
TextLayout tl = new TextLayout(waveformList.getDisplay());
TextLayout tl = new TextLayout(waveformCanvas.getDisplay());
tl.setFont(nameFontB);
int valueMaxWidth = 0;
for (String v : actualValues.values()) {
@ -518,32 +507,57 @@ public class TxDisplay implements PropertyChangeListener, ISelectionProvider {
return true;
}
/* (non-Javadoc)
* @see com.minres.scviewer.database.swt.IWaveformPanel#addSelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener)
*/
@Override
public void addSelectionChangedListener(ISelectionChangedListener listener) {
selectionChangedListeners.add(listener);
}
/* (non-Javadoc)
* @see com.minres.scviewer.database.swt.IWaveformPanel#removeSelectionChangedListener(org.eclipse.jface.viewers.ISelectionChangedListener)
*/
@Override
public void removeSelectionChangedListener(ISelectionChangedListener listener) {
selectionChangedListeners.remove(listener);
}
/* (non-Javadoc)
* @see com.minres.scviewer.database.swt.IWaveformPanel#getControl()
*/
@Override
public Control getControl() {
return top;
}
/* (non-Javadoc)
* @see com.minres.scviewer.database.swt.IWaveformPanel#getNameControl()
*/
@Override
public Control getNameControl() {
return nameList;
}
/* (non-Javadoc)
* @see com.minres.scviewer.database.swt.IWaveformPanel#getValueControl()
*/
@Override
public Control getValueControl() {
return valueList;
}
/* (non-Javadoc)
* @see com.minres.scviewer.database.swt.IWaveformPanel#getWaveformControl()
*/
@Override
public Control getWaveformControl() {
return waveformList;
return waveformCanvas;
}
/* (non-Javadoc)
* @see com.minres.scviewer.database.swt.IWaveformPanel#getSelection()
*/
@Override
public ISelection getSelection() {
if (currentTxSelection != null)
@ -554,11 +568,18 @@ public class TxDisplay implements PropertyChangeListener, ISelectionProvider {
return new StructuredSelection();
}
/* (non-Javadoc)
* @see com.minres.scviewer.database.swt.IWaveformPanel#setSelection(org.eclipse.jface.viewers.ISelection)
*/
@Override
public void setSelection(ISelection selection) {
setSelection(selection, false);
}
/* (non-Javadoc)
* @see com.minres.scviewer.database.swt.IWaveformPanel#setSelection(org.eclipse.jface.viewers.ISelection, boolean)
*/
@Override
@SuppressWarnings("unchecked")
public void setSelection(ISelection selection, boolean addIfNeeded) {
boolean selectionChanged = false;
@ -595,7 +616,7 @@ public class TxDisplay implements PropertyChangeListener, ISelectionProvider {
currentWaveformSelection = null;
}
if (selectionChanged) {
waveformList.setSelected(currentTxSelection, currentWaveformSelection);
waveformCanvas.setSelected(currentTxSelection, currentWaveformSelection);
nameList.setData(SELECTION, currentWaveformSelection);
valueList.redraw();
nameList.redraw();
@ -606,6 +627,10 @@ public class TxDisplay implements PropertyChangeListener, ISelectionProvider {
}
}
/* (non-Javadoc)
* @see com.minres.scviewer.database.swt.IWaveformPanel#moveSelection(com.minres.scviewer.database.swt.GotoDirection)
*/
@Override
@SuppressWarnings("unchecked")
public void moveSelection(GotoDirection direction) {
if (currentWaveformSelection instanceof ITxStream<?>) {
@ -669,6 +694,10 @@ public class TxDisplay implements PropertyChangeListener, ISelectionProvider {
}
}
/* (non-Javadoc)
* @see com.minres.scviewer.database.swt.IWaveformPanel#moveCursor(com.minres.scviewer.database.swt.GotoDirection)
*/
@Override
public void moveCursor(GotoDirection direction) {
long time = getCursorTime();
NavigableMap<Long, ?> map=null;
@ -682,17 +711,25 @@ public class TxDisplay implements PropertyChangeListener, ISelectionProvider {
if(entry!=null) {
time=entry.getKey();
setCursorTime(time);
waveformList.reveal(time);
waveformList.redraw();
waveformCanvas.reveal(time);
waveformCanvas.redraw();
}
}
}
/* (non-Javadoc)
* @see com.minres.scviewer.database.swt.IWaveformPanel#getStreamList()
*/
@Override
public List<IWaveform<? extends IWaveformEvent>> getStreamList() {
return streams;
}
/* (non-Javadoc)
* @see com.minres.scviewer.database.swt.IWaveformPanel#moveSelected(int)
*/
@Override
public void moveSelected(int i) {
if(currentWaveformSelection!=null){
ITx selectedTx=currentTxSelection;
@ -719,7 +756,7 @@ public class TxDisplay implements PropertyChangeListener, ISelectionProvider {
if (firstKey == null)
firstKey = trackVerticalOffset.firstKey();
Integer lastKey = trackVerticalOffset.floorKey(rect.y + rect.height);
Rectangle subArea = new Rectangle(rect.x, 0, rect.width, waveformList.getTrackHeight());
Rectangle subArea = new Rectangle(rect.x, 0, rect.width, waveformCanvas.getTrackHeight());
if (lastKey == firstKey) {
IWaveform<? extends IWaveformEvent> w = trackVerticalOffset.get(firstKey);
if (w instanceof ITxStream<?>)
@ -729,7 +766,7 @@ public class TxDisplay implements PropertyChangeListener, ISelectionProvider {
for (Entry<Integer, IWaveform<? extends IWaveformEvent>> entry : trackVerticalOffset.subMap(firstKey, true, lastKey, true)
.entrySet()) {
IWaveform<? extends IWaveformEvent> w = entry.getValue();
subArea.height = waveformList.getTrackHeight();
subArea.height = waveformCanvas.getTrackHeight();
if (w instanceof ITxStream<?>)
subArea.height *= ((ITxStream<?>) w).getMaxConcurrency();
drawTextFormat(gc, subArea, entry.getKey(), w.getFullName(), w.equals(wave));
@ -746,7 +783,7 @@ public class TxDisplay implements PropertyChangeListener, ISelectionProvider {
if (firstKey == null)
firstKey = trackVerticalOffset.firstKey();
Integer lastKey = trackVerticalOffset.floorKey(rect.y + rect.height);
Rectangle subArea = new Rectangle(rect.x, 0, rect.width, waveformList.getTrackHeight());
Rectangle subArea = new Rectangle(rect.x, 0, rect.width, waveformCanvas.getTrackHeight());
if (lastKey == firstKey) {
IWaveform<? extends IWaveformEvent> w = trackVerticalOffset.get(firstKey);
if (w instanceof ITxStream<?>)
@ -756,7 +793,7 @@ public class TxDisplay implements PropertyChangeListener, ISelectionProvider {
for (Entry<Integer, IWaveform<? extends IWaveformEvent>> entry : trackVerticalOffset.subMap(firstKey, true, lastKey, true)
.entrySet()) {
IWaveform<? extends IWaveformEvent> w = entry.getValue();
subArea.height = waveformList.getTrackHeight();
subArea.height = waveformCanvas.getTrackHeight();
if (w instanceof ITxStream<?>)
subArea.height *= ((ITxStream<?>) w).getMaxConcurrency();
drawValue(gc, subArea, entry.getKey(), actualValues.get(w), w.equals(wave));
@ -767,10 +804,10 @@ public class TxDisplay implements PropertyChangeListener, ISelectionProvider {
protected void drawValue(GC gc, Rectangle subArea, Integer yOffset, String value, boolean highlite) {
int beginIndex=0;
for(int offset=0; offset<subArea.height; offset+=waveformList.getTrackHeight()){
for(int offset=0; offset<subArea.height; offset+=waveformCanvas.getTrackHeight()){
int endIndex=value.indexOf('|', beginIndex);
String str = endIndex<0?value.substring(beginIndex):value.substring(beginIndex, endIndex);
drawTextFormat(gc, new Rectangle(subArea.x, subArea.y, subArea.width, waveformList.getTrackHeight()), yOffset+offset, str, highlite);
drawTextFormat(gc, new Rectangle(subArea.x, subArea.y, subArea.width, waveformCanvas.getTrackHeight()), yOffset+offset, str, highlite);
beginIndex=endIndex<0?beginIndex:endIndex+1;
}
}
@ -787,32 +824,56 @@ public class TxDisplay implements PropertyChangeListener, ISelectionProvider {
gc.setForeground(SWTResourceManager.getColor(SWT.COLOR_LIST_FOREGROUND));
gc.setFont(nameFont);
}
gc.drawText(value, subArea.x + 5, subArea.y + yOffset + (waveformList.getTrackHeight() - size.y) / 2, true);
gc.drawText(value, subArea.x + 5, subArea.y + yOffset + (waveformCanvas.getTrackHeight() - size.y) / 2, true);
}
/* (non-Javadoc)
* @see com.minres.scviewer.database.swt.IWaveformPanel#getMaxTime()
*/
@Override
public long getMaxTime() {
return waveformList.getMaxTime();
return waveformCanvas.getMaxTime();
}
/* (non-Javadoc)
* @see com.minres.scviewer.database.swt.IWaveformPanel#setMaxTime(long)
*/
@Override
public void setMaxTime(long maxTime) {
this.waveformList.setMaxTime(maxTime);
this.waveformCanvas.setMaxTime(maxTime);
}
/* (non-Javadoc)
* @see com.minres.scviewer.database.swt.IWaveformPanel#setZoomLevel(int)
*/
@Override
public void setZoomLevel(int scale) {
waveformList.setZoomLevel(scale);
waveformList.reveal(getCursorTime());
waveformCanvas.setZoomLevel(scale);
waveformCanvas.reveal(getCursorTime());
}
/* (non-Javadoc)
* @see com.minres.scviewer.database.swt.IWaveformPanel#getZoomLevel()
*/
@Override
public int getZoomLevel() {
return waveformList.getZoomLevel();
return waveformCanvas.getZoomLevel();
}
/* (non-Javadoc)
* @see com.minres.scviewer.database.swt.IWaveformPanel#setCursorTime(long)
*/
@Override
public void setCursorTime(long time){
final Long oldVal= cursorPainters.get(0).getTime();
cursorPainters.get(0).setTime(time);
pcs.firePropertyChange(CURSOR_PROPERTY, oldVal, time);
}
/* (non-Javadoc)
* @see com.minres.scviewer.database.swt.IWaveformPanel#setMarkerTime(long, int)
*/
@Override
public void setMarkerTime(long time, int index){
if(cursorPainters.size()>index+1){
final Long oldVal= cursorPainters.get(1+index).getTime();
@ -821,14 +882,26 @@ public class TxDisplay implements PropertyChangeListener, ISelectionProvider {
}
}
/* (non-Javadoc)
* @see com.minres.scviewer.database.swt.IWaveformPanel#getCursorTime()
*/
@Override
public long getCursorTime(){
return cursorPainters.get(0).getTime();
}
/* (non-Javadoc)
* @see com.minres.scviewer.database.swt.IWaveformPanel#getActMarkerTime()
*/
@Override
public long getActMarkerTime(){
return getMarkerTime(selectedMarker);
}
/* (non-Javadoc)
* @see com.minres.scviewer.database.swt.IWaveformPanel#getMarkerTime(int)
*/
@Override
public long getMarkerTime(int index){
return cursorPainters.get(index+1).getTime();
}
@ -895,7 +968,7 @@ public class TxDisplay implements PropertyChangeListener, ISelectionProvider {
public void dropAccept(DropTargetEvent event) {
Point offset = canvas.toControl(event.x, event.y);
if (event.detail != DND.DROP_MOVE || offset.y > trackVerticalOffset.lastKey() + waveformList.getTrackHeight()) {
if (event.detail != DND.DROP_MOVE || offset.y > trackVerticalOffset.lastKey() + waveformCanvas.getTrackHeight()) {
event.detail = DND.DROP_NONE;
}
}
@ -910,7 +983,7 @@ public class TxDisplay implements PropertyChangeListener, ISelectionProvider {
public void dragStart(DragSourceEvent event) {
System.out.println("dragStart");
event.doit = false;
List<Object> clicked = waveformList.getClicked(new Point(event.x, event.y));
List<Object> clicked = waveformCanvas.getClicked(new Point(event.x, event.y));
for(Object o:clicked){
if(o instanceof CursorPainter){
LocalSelectionTransfer.getTransfer().setSelection(new StructuredSelection(o));
@ -923,7 +996,7 @@ public class TxDisplay implements PropertyChangeListener, ISelectionProvider {
public void dragSetData(DragSourceEvent event) {
if (LocalSelectionTransfer.getTransfer().isSupportedType(event.dataType)) {
event.data=waveformList.getClicked(new Point(event.x, event.y));
event.data=waveformCanvas.getClicked(new Point(event.x, event.y));
}
}
});
@ -948,7 +1021,7 @@ public class TxDisplay implements PropertyChangeListener, ISelectionProvider {
public void dropAccept(DropTargetEvent event) {
Point offset = canvas.toControl(event.x, event.y);
if (event.detail != DND.DROP_MOVE || offset.y > trackVerticalOffset.lastKey() + waveformList.getTrackHeight()) {
if (event.detail != DND.DROP_MOVE || offset.y > trackVerticalOffset.lastKey() + waveformCanvas.getTrackHeight()) {
event.detail = DND.DROP_NONE;
}
}
@ -963,7 +1036,7 @@ public class TxDisplay implements PropertyChangeListener, ISelectionProvider {
protected void updateWaveform(final Canvas canvas, DropTargetEvent event, CursorPainter painter) {
Point dropPoint = canvas.toControl(event.x, event.y);
long time = waveformList.getTimeForOffset(dropPoint.x);
long time = waveformCanvas.getTimeForOffset(dropPoint.x);
final Long oldVal= painter.getTime();
painter.setTime(time);
if(painter.id<0){
@ -986,10 +1059,18 @@ public class TxDisplay implements PropertyChangeListener, ISelectionProvider {
}
/* (non-Javadoc)
* @see com.minres.scviewer.database.swt.IWaveformPanel#addPropertyChangeListener(java.beans.PropertyChangeListener)
*/
@Override
public void addPropertyChangeListener(PropertyChangeListener listener) {
this.pcs.addPropertyChangeListener(listener);
}
/* (non-Javadoc)
* @see com.minres.scviewer.database.swt.IWaveformPanel#addPropertyChangeListener(java.lang.String, java.beans.PropertyChangeListener)
*/
@Override
public void addPropertyChangeListener(String propertyName, PropertyChangeListener listener) {
this.pcs.addPropertyChangeListener(propertyName, listener);
}
@ -1002,10 +1083,18 @@ public class TxDisplay implements PropertyChangeListener, ISelectionProvider {
return this.pcs.getPropertyChangeListeners(propertyName);
}
/* (non-Javadoc)
* @see com.minres.scviewer.database.swt.IWaveformPanel#removePropertyChangeListener(java.beans.PropertyChangeListener)
*/
@Override
public void removePropertyChangeListener(PropertyChangeListener listener) {
this.pcs.removePropertyChangeListener(listener);
}
/* (non-Javadoc)
* @see com.minres.scviewer.database.swt.IWaveformPanel#removePropertyChangeListener(java.lang.String, java.beans.PropertyChangeListener)
*/
@Override
public void removePropertyChangeListener(String propertyName, PropertyChangeListener listener) {
this.pcs.removePropertyChangeListener(propertyName, listener);
}
@ -1014,12 +1103,20 @@ public class TxDisplay implements PropertyChangeListener, ISelectionProvider {
return this.pcs.hasListeners(propertyName);
}
/* (non-Javadoc)
* @see com.minres.scviewer.database.swt.IWaveformPanel#getScaledTime(long)
*/
@Override
public String getScaledTime(long time) {
StringBuilder sb = new StringBuilder();
Double dTime=new Double(time);
return sb.append(dTime/waveformList.getScaleFactorPow10()).append(waveformList.getUnitStr()).toString();
return sb.append(dTime/waveformCanvas.getScaleFactorPow10()).append(waveformCanvas.getUnitStr()).toString();
}
/* (non-Javadoc)
* @see com.minres.scviewer.database.swt.IWaveformPanel#getZoomLevels()
*/
@Override
public String[] getZoomLevels(){
String[] res = new String[WaveformCanvas.unitMultiplier.length*WaveformCanvas.unitString.length];
int index=0;

View File

@ -11,6 +11,7 @@
package com.minres.scviewer.database.swt.internal;
import java.util.Map.Entry;
import java.util.TreeMap;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.GC;
@ -35,18 +36,19 @@ public class TrackPainter implements IPainter {
gc.setBackground(this.waveCanvas.colors[WaveformCanvas.Colors.TRACK_BG_EVEN.ordinal()]);
gc.setFillRule(SWT.FILL_EVEN_ODD);
gc.fillRectangle(area);
TreeMap<Integer, IWaveformPainter> offsets = this.waveCanvas.trackVerticalOffset;
if(this.waveCanvas.streams.size()>0){
Integer firstKey=this.waveCanvas.trackVerticalOffset.floorKey(area.y);
if(firstKey==null) firstKey=this.waveCanvas.trackVerticalOffset.firstKey();
Integer lastKey = this.waveCanvas.trackVerticalOffset.floorKey(area.y+area.height);
Integer firstKey=offsets.floorKey(area.y);
if(firstKey==null) firstKey=offsets.firstKey();
Integer lastKey = offsets.floorKey(area.y+area.height);
Rectangle subArea = new Rectangle(area.x, 0, area.width, 0);
if(lastKey==firstKey){
subArea.y=firstKey;
IWaveformPainter p = this.waveCanvas.trackVerticalOffset.get(firstKey);
IWaveformPainter p = offsets.get(firstKey);
subArea.height=p.getMinHeight();
p.paintArea(gc, subArea);
}else{
for(Entry<Integer, IWaveformPainter> entry : this.waveCanvas.trackVerticalOffset.subMap(firstKey, true, lastKey, true).entrySet()){
for(Entry<Integer, IWaveformPainter> entry : offsets.subMap(firstKey, true, lastKey, true).entrySet()){
subArea.y=entry.getKey();
subArea.height=entry.getValue().getMinHeight();
entry.getValue().paintArea(gc, subArea);

View File

@ -400,7 +400,7 @@ public class WaveformCanvas extends Canvas {
int top = entry.getKey() + trackHeight * tx.getConcurrencyIndex();
int bottom = top + trackHeight;
if (top < -origin.y) {
setOrigin(origin.x, -top);
setOrigin(origin.x, -(top-trackHeight));
} else if (bottom > (size.y - origin.y)) {
setOrigin(origin.x, size.y - bottom);
}

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="output" path="bin"/>
</classpath>

View File

@ -0,0 +1,2 @@
/bin/
/target/

View File

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>com.minres.scviewer.database.ui</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.ManifestBuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.pde.SchemaBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.pde.PluginNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>

View File

@ -0,0 +1,7 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
org.eclipse.jdt.core.compiler.compliance=1.7
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.7

View File

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

View File

@ -0,0 +1,10 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Database UI
Bundle-SymbolicName: com.minres.scviewer.database.ui
Bundle-Version: 1.0.0.qualifier
Bundle-Vendor: MINRES Technologies GmbH
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
Export-Package: com.minres.scviewer.database.ui
Require-Bundle: com.minres.scviewer.database,
org.eclipse.jface

View File

@ -0,0 +1,4 @@
source.. = src/
output.. = bin/
bin.includes = META-INF/,\
.

View File

@ -1,6 +1,6 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>com.minres.scviewer.database.swt</artifactId>
<artifactId>com.minres.scviewer.database.ui</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
<parent>
@ -9,5 +9,4 @@
<version>1.0.0-SNAPSHOT</version>
<relativePath>../com.minres.scviewer.parent</relativePath>
</parent>
<groupId>com.minres.scviewer</groupId>
</project>
</project>

View File

@ -8,6 +8,6 @@
* Contributors:
* MINRES Technologies GmbH - initial API and implementation
*******************************************************************************/
package com.minres.scviewer.database.swt;
package com.minres.scviewer.database.ui;
public enum GotoDirection {PREV, NEXT}

View File

@ -0,0 +1,75 @@
package com.minres.scviewer.database.ui;
import java.beans.PropertyChangeListener;
import java.util.List;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.ISelectionProvider;
import org.eclipse.swt.widgets.Control;
import com.minres.scviewer.database.IWaveform;
import com.minres.scviewer.database.IWaveformEvent;
public interface IWaveformPanel extends PropertyChangeListener, ISelectionProvider{
String CURSOR_PROPERTY = "cursor_time";
String MARKER_PROPERTY = "marker_time";
void addSelectionChangedListener(ISelectionChangedListener listener);
void removeSelectionChangedListener(ISelectionChangedListener listener);
Control getControl();
Control getNameControl();
Control getValueControl();
Control getWaveformControl();
ISelection getSelection();
void setSelection(ISelection selection);
void setSelection(ISelection selection, boolean addIfNeeded);
void moveSelection(GotoDirection direction);
void moveCursor(GotoDirection direction);
List<IWaveform<? extends IWaveformEvent>> getStreamList();
void moveSelected(int i);
long getMaxTime();
void setMaxTime(long maxTime);
void setZoomLevel(int scale);
int getZoomLevel();
void setCursorTime(long time);
void setMarkerTime(long time, int index);
long getCursorTime();
long getActMarkerTime();
long getMarkerTime(int index);
void addPropertyChangeListener(PropertyChangeListener listener);
void addPropertyChangeListener(String propertyName, PropertyChangeListener listener);
void removePropertyChangeListener(PropertyChangeListener listener);
void removePropertyChangeListener(String propertyName, PropertyChangeListener listener);
String getScaledTime(long time);
String[] getZoomLevels();
}

View File

@ -5,7 +5,7 @@
<children xsi:type="advanced:Perspective" xmi:id="_95QGx3NmEeWBq8z1Dv39LA">
<children xsi:type="basic:PartSashContainer" xmi:id="_95QGyHNmEeWBq8z1Dv39LA" horizontal="true">
<children xsi:type="basic:PartSashContainer" xmi:id="_61hA8HTPEeWwZ-9vrAR2UQ" elementId="" containerData="20">
<children xsi:type="basic:Part" xmi:id="_95QGynNmEeWBq8z1Dv39LA" containerData="10" contributionURI="bundleclass://com.minres.scviewer.e4.application/com.minres.scviewer.e4.application.parts.DesignBrowser" label="Design Browser"/>
<children xsi:type="basic:Part" xmi:id="_95QGynNmEeWBq8z1Dv39LA" elementId="com.minres.scviewer.e4.application.parts.DesignBrowser" containerData="10" contributionURI="bundleclass://com.minres.scviewer.e4.application/com.minres.scviewer.e4.application.parts.DesignBrowser" label="Design Browser"/>
<children xsi:type="basic:Part" xmi:id="_8KyKwHTPEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.parts.WaveformList" containerData="9" contributionURI="bundleclass://com.minres.scviewer.e4.application/com.minres.scviewer.e4.application.parts.WaveformListPart" label="Waveform List">
<handlers xmi:id="_Bx9s0Hr-EeWVM_sKoXvptg" 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="_G6xAYHsDEeWVM_sKoXvptg" elementId="com.minres.scviewer.e4.application.parts.WaveformList.popupmenu">
@ -30,7 +30,7 @@
</children>
<children xsi:type="basic:PartSashContainer" xmi:id="_uT9BIHgtEeWwZ-9vrAR2UQ" elementId="" containerData="80">
<children xsi:type="basic:PartStack" xmi:id="_95QGyXNmEeWBq8z1Dv39LA" elementId="org.eclipse.editorss" containerData="75"/>
<children xsi:type="basic:Part" xmi:id="_vtfm8HgtEeWwZ-9vrAR2UQ" elementId="" containerData="25" contributionURI="bundleclass://com.minres.scviewer.e4.application/com.minres.scviewer.e4.application.parts.TransactionDetails"/>
<children xsi:type="basic:Part" xmi:id="_vtfm8HgtEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.parts.WaveformDetails" containerData="25" contributionURI="bundleclass://com.minres.scviewer.e4.application/com.minres.scviewer.e4.application.parts.TransactionDetails" label="Waveform Details"/>
</children>
</children>
</children>
@ -74,7 +74,6 @@
<children xsi:type="menu:HandledMenuItem" xmi:id="_95QGxXNmEeWBq8z1Dv39LA" label="About" command="_95PfxnNmEeWBq8z1Dv39LA"/>
</children>
</mainMenu>
<sharedElements xsi:type="basic:Part" xmi:id="_Oae6kHcvEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.part.0"/>
<trimBars xmi:id="_95QGy3NmEeWBq8z1Dv39LA" elementId="org.eclipse.ui.main.toolbar">
<children xsi:type="menu:ToolBar" xmi:id="_95QGzHNmEeWBq8z1Dv39LA" elementId="toolbar:org.eclipse.ui.main.toolbar">
<children xsi:type="menu:HandledToolItem" xmi:id="_95QGzXNmEeWBq8z1Dv39LA" iconURI="platform:/plugin/com.minres.scviewer.e4.application/icons/folder_database.png" command="_95PfwHNmEeWBq8z1Dv39LA"/>

View File

@ -14,7 +14,7 @@ Require-Bundle: javax.inject;bundle-version="1.0.0",
org.eclipse.e4.core.di;bundle-version="1.5.0",
org.eclipse.e4.ui.di;bundle-version="1.1.0",
org.eclipse.e4.core.contexts;bundle-version="1.4.0",
com.minres.scviewer.database.swt;bundle-version="1.0.0",
com.minres.scviewer.database.ui.swt;bundle-version="1.0.0",
com.minres.scviewer.database;bundle-version="1.0.0",
org.eclipse.equinox.ds;bundle-version="1.4.300",
org.eclipse.equinox.util;bundle-version="1.0.500",
@ -26,7 +26,8 @@ Require-Bundle: javax.inject;bundle-version="1.0.0",
com.google.guava,
org.eclipse.equinox.preferences,
org.eclipse.core.expressions,
org.eclipse.e4.core.commands;bundle-version="0.11.0"
org.eclipse.e4.core.commands;bundle-version="0.11.0",
com.minres.scviewer.database.ui
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
Import-Package: com.minres.scviewer.database,
javax.inject;version="1.0.0"

View File

@ -94,13 +94,14 @@ public class E4LifeCycle {
@Inject EModelService modelService;
@Inject EPartService partService;
public void openViewForFile(String name){
File file = new File(name);
MPart part = partService.createPart("com.minres.scviewer.e4.application.partdescriptor.waveformviewer");
part.setLabel(name);
part.setLabel(file.getName());
MPartStack partStack = (MPartStack)modelService.find("org.eclipse.editorss", app);
partStack.getChildren().add(part);
partService.showPart(part, PartState.ACTIVATE);
IEclipseContext ctx=part.getContext();
ctx.modify("input", new File(name));
ctx.modify("input", file);
ctx.declareModifiable("input");
}
}

View File

@ -22,7 +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.swt.GotoDirection;
import com.minres.scviewer.database.ui.GotoDirection;
import com.minres.scviewer.e4.application.parts.WaveformViewerPart;
public class NavigateEvent {

View File

@ -21,7 +21,7 @@ import org.eclipse.e4.ui.workbench.modeling.ESelectionService;
import org.eclipse.jface.viewers.IStructuredSelection;
import com.minres.scviewer.database.ITx;
import com.minres.scviewer.database.swt.GotoDirection;
import com.minres.scviewer.database.ui.GotoDirection;
import com.minres.scviewer.e4.application.parts.WaveformViewerPart;
public class NavigateTrans {

View File

@ -39,7 +39,7 @@ public class OpenHandler {
// part.setContributionURI("bundleclass://com.minres.scviewer.e4.application/"+
// WaveformViewerPart.class.getName());
MPart part = partService .createPart("com.minres.scviewer.e4.application.partdescriptor.waveformviewer");
part.setLabel(fileName);
part.setLabel(file.getName());
MPartStack partStack = (MPartStack)modelService.find("org.eclipse.editorss", app);

View File

@ -52,8 +52,9 @@ import com.minres.scviewer.database.IWaveform;
import com.minres.scviewer.database.IWaveformDb;
import com.minres.scviewer.database.IWaveformDbFactory;
import com.minres.scviewer.database.IWaveformEvent;
import com.minres.scviewer.database.swt.GotoDirection;
import com.minres.scviewer.database.swt.TxDisplay;
import com.minres.scviewer.database.ui.GotoDirection;
import com.minres.scviewer.database.ui.IWaveformPanel;
import com.minres.scviewer.e4.application.internal.WaveStatusBarControl;
public class WaveformViewerPart {
@ -70,7 +71,7 @@ public class WaveformViewerPart {
public static final String WAVE_ACTION_ID = "com.minres.scviewer.ui.action.AddToWave";
private TxDisplay txDisplay;
private IWaveformPanel waveformPane;
@Inject private IEventBroker eventBroker;
@ -98,41 +99,41 @@ public class WaveformViewerPart {
myParent.getDisplay().syncExec(new Runnable() {
@Override
public void run() {
txDisplay.setMaxTime(database.getMaxTime());
waveformPane.setMaxTime(database.getMaxTime());
}
});
}
}
});
txDisplay = new TxDisplay(parent);
txDisplay.setMaxTime(0);
txDisplay.addPropertyChangeListener(TxDisplay.CURSOR_PROPERTY, new PropertyChangeListener() {
waveformPane = new TxDisplay(parent);
waveformPane.setMaxTime(0);
waveformPane.addPropertyChangeListener(IWaveformPanel.CURSOR_PROPERTY, new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent evt) {
Long time = (Long) evt.getNewValue();
eventBroker.post(WaveStatusBarControl.CURSOR_TIME, txDisplay.getScaledTime(time));
long marker=txDisplay.getActMarkerTime();
eventBroker.post(WaveStatusBarControl.MARKER_DIFF, txDisplay.getScaledTime(time-marker));
eventBroker.post(WaveStatusBarControl.CURSOR_TIME, waveformPane.getScaledTime(time));
long marker=waveformPane.getActMarkerTime();
eventBroker.post(WaveStatusBarControl.MARKER_DIFF, waveformPane.getScaledTime(time-marker));
}
});
txDisplay.addPropertyChangeListener(TxDisplay.MARKER_PROPERTY, new PropertyChangeListener() {
waveformPane.addPropertyChangeListener(IWaveformPanel.MARKER_PROPERTY, new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent evt) {
Long time = (Long) evt.getNewValue();
eventBroker.post(WaveStatusBarControl.MARKER_TIME, txDisplay.getScaledTime(time));
long cursor=txDisplay.getCursorTime();
eventBroker.post(WaveStatusBarControl.MARKER_DIFF, txDisplay.getScaledTime(cursor-time));
eventBroker.post(WaveStatusBarControl.MARKER_TIME, waveformPane.getScaledTime(time));
long cursor=waveformPane.getCursorTime();
eventBroker.post(WaveStatusBarControl.MARKER_DIFF, waveformPane.getScaledTime(cursor-time));
}
});
txDisplay.addSelectionChangedListener(new ISelectionChangedListener() {
waveformPane.addSelectionChangedListener(new ISelectionChangedListener() {
@Override
public void selectionChanged(SelectionChangedEvent event) {
if(event.getSelection() instanceof IStructuredSelection)
selectionService.setSelection(event.getSelection());
}
});
zoomLevel=txDisplay.getZoomLevels();
zoomLevel=waveformPane.getZoomLevels();
filesToLoad=new ArrayList<File>();
persistedState = part.getPersistedState();
Integer files = persistedState.containsKey(DATABASE_FILE+"S")?Integer.parseInt(persistedState.get(DATABASE_FILE+"S")):0;
@ -141,10 +142,10 @@ public class WaveformViewerPart {
}
if(filesToLoad.size()>0)
loadDatabase();
eventBroker.post(WaveStatusBarControl.ZOOM_LEVEL, zoomLevel[txDisplay.getZoomLevel()]);
menuService.registerContextMenu(txDisplay.getNameControl(), "com.minres.scviewer.e4.application.popupmenu.namecontext");
menuService.registerContextMenu(txDisplay.getValueControl(), "com.minres.scviewer.e4.application.popupmenu.namecontext");
menuService.registerContextMenu(txDisplay.getWaveformControl(), "com.minres.scviewer.e4.application.popupmenu.wavecontext");
eventBroker.post(WaveStatusBarControl.ZOOM_LEVEL, zoomLevel[waveformPane.getZoomLevel()]);
menuService.registerContextMenu(waveformPane.getNameControl(), "com.minres.scviewer.e4.application.popupmenu.namecontext");
menuService.registerContextMenu(waveformPane.getValueControl(), "com.minres.scviewer.e4.application.popupmenu.namecontext");
menuService.registerContextMenu(waveformPane.getWaveformControl(), "com.minres.scviewer.e4.application.popupmenu.wavecontext");
}
protected void loadDatabase() {
@ -158,7 +159,7 @@ public class WaveformViewerPart {
for(File file: filesToLoad){
//TimeUnit.SECONDS.sleep(2);
database.load(file);
database.addPropertyChangeListener(txDisplay);
database.addPropertyChangeListener(waveformPane);
subMonitor.worked(1);
if(monitor.isCanceled()) return Status.CANCEL_STATUS;
}
@ -180,7 +181,7 @@ public class WaveformViewerPart {
myParent.getDisplay().asyncExec(new Runnable() {
@Override
public void run() {
txDisplay.setMaxTime(database.getMaxTime());
waveformPane.setMaxTime(database.getMaxTime());
restoreState();
}
});
@ -234,9 +235,9 @@ public class WaveformViewerPart {
persistedState.put(DATABASE_FILE+index, file.getAbsolutePath());
index++;
}
persistedState.put(SHOWN_WAVEFORM+"S", Integer.toString(txDisplay.getStreamList().size()));
persistedState.put(SHOWN_WAVEFORM+"S", Integer.toString(waveformPane.getStreamList().size()));
index=0;
for(IWaveform<? extends IWaveformEvent> waveform:txDisplay.getStreamList()){
for(IWaveform<? extends IWaveformEvent> waveform:waveformPane.getStreamList()){
persistedState.put(SHOWN_WAVEFORM+index, waveform.getFullName());
index++;
}
@ -250,17 +251,17 @@ public class WaveformViewerPart {
IWaveform<? extends IWaveformEvent> waveform = database.getStreamByName(persistedState.get(SHOWN_WAVEFORM+i));
if(waveform!=null) res.add(waveform);
}
if(res.size()>0) txDisplay.getStreamList().addAll(res);
if(res.size()>0) waveformPane.getStreamList().addAll(res);
}
private void updateAll() {
eventBroker.post(ACTIVE_WAVEFORMVIEW, this);
eventBroker.post(WaveStatusBarControl.ZOOM_LEVEL, zoomLevel[txDisplay.getZoomLevel()]);
long cursor=txDisplay.getCursorTime();
long marker=txDisplay.getActMarkerTime();
eventBroker.post(WaveStatusBarControl.CURSOR_TIME, txDisplay.getScaledTime(cursor));
eventBroker.post(WaveStatusBarControl.MARKER_TIME, txDisplay.getScaledTime(marker));
eventBroker.post(WaveStatusBarControl.MARKER_DIFF, txDisplay.getScaledTime(cursor-marker));
eventBroker.post(WaveStatusBarControl.ZOOM_LEVEL, zoomLevel[waveformPane.getZoomLevel()]);
long cursor=waveformPane.getCursorTime();
long marker=waveformPane.getActMarkerTime();
eventBroker.post(WaveStatusBarControl.CURSOR_TIME, waveformPane.getScaledTime(cursor));
eventBroker.post(WaveStatusBarControl.MARKER_TIME, waveformPane.getScaledTime(marker));
eventBroker.post(WaveStatusBarControl.MARKER_DIFF, waveformPane.getScaledTime(cursor-marker));
}
@Inject @Optional
@ -327,20 +328,20 @@ public class WaveformViewerPart {
List<IWaveform<? extends IWaveformEvent>> streams= new LinkedList<>();
for(IWaveform<? extends IWaveformEvent> stream:iWaveforms)
streams.add(stream);
IStructuredSelection selection = (IStructuredSelection) txDisplay.getSelection();
IStructuredSelection selection = (IStructuredSelection) waveformPane.getSelection();
if(selection.size()==0)
txDisplay.getStreamList().addAll(streams);
waveformPane.getStreamList().addAll(streams);
else {
IWaveform<?> selectedStream = (selection.getFirstElement() instanceof ITx)?
((ITx)selection.getFirstElement()).getStream():(IWaveform<?>)selection.getFirstElement();
int index = txDisplay.getStreamList().indexOf(selectedStream);
int index = waveformPane.getStreamList().indexOf(selectedStream);
if(!insert) index++;
txDisplay.getStreamList().addAll(index, streams);
waveformPane.getStreamList().addAll(index, streams);
}
}
public void removeStreamFromList(IWaveform<? extends IWaveformEvent> obj){
txDisplay.getStreamList().remove(obj);
waveformPane.getStreamList().remove(obj);
}
public void removeStreamsFromList(IWaveform<? extends IWaveformEvent>[] iWaveforms){
@ -349,43 +350,43 @@ public class WaveformViewerPart {
}
public List<IWaveform<? extends IWaveformEvent>> getStreamList(){
return txDisplay.getStreamList();
return waveformPane.getStreamList();
}
public void moveSelected(int i) {
txDisplay.moveSelected(i);
waveformPane.moveSelected(i);
}
public void moveSelection(GotoDirection direction) {
txDisplay.moveSelection(direction);
waveformPane.moveSelection(direction);
}
public void moveCursor(GotoDirection direction) {
txDisplay.moveCursor(direction); }
waveformPane.moveCursor(direction); }
public void setZoomLevel(Integer level) {
if(level<0) level=0;
if(level>zoomLevel.length-1) level=zoomLevel.length-1;
txDisplay.setZoomLevel(level);
waveformPane.setZoomLevel(level);
updateAll(); }
public void setZoomFit() {
txDisplay.setZoomLevel(6);
waveformPane.setZoomLevel(6);
updateAll(); }
public int getZoomLevel() {
return txDisplay.getZoomLevel();
return waveformPane.getZoomLevel();
}
public ISelection getSelection() {
return txDisplay.getSelection();
return waveformPane.getSelection();
}
public void setSelection(IStructuredSelection structuredSelection) {
txDisplay.setSelection(structuredSelection, true);
waveformPane.setSelection(structuredSelection, true);
}
public String getScaledTime(Long time) {
return txDisplay.getScaledTime(time);
return waveformPane.getScaledTime(time);
}
}

View File

@ -23,7 +23,7 @@
<stringAttribute key="product" value="com.minres.scviewer.e4.application.product"/>
<stringAttribute key="productFile" value="/com.minres.scviewer.e4.application/com.minres.scviewer.e4.application.product"/>
<stringAttribute key="selected_target_plugins" value="com.google.guava@default:default,com.ibm.icu@default:default,javax.annotation@default:default,javax.inject@default:default,javax.servlet@default:default,javax.xml@default:default,org.apache.ant@default:default,org.apache.batik.css@default:default,org.apache.batik.util.gui@default:default,org.apache.batik.util@default:default,org.apache.commons.jxpath@default:default,org.apache.commons.logging@default:default,org.apache.felix.gogo.command@default:default,org.apache.felix.gogo.runtime@default:default,org.apache.felix.gogo.shell@default:default,org.codehaus.groovy@default:default,org.eclipse.ant.core@default:default,org.eclipse.compare.core@default:default,org.eclipse.core.commands@default:default,org.eclipse.core.contenttype@default:default,org.eclipse.core.databinding.beans@default:default,org.eclipse.core.databinding.observable@default:default,org.eclipse.core.databinding.property@default:default,org.eclipse.core.databinding@default:default,org.eclipse.core.expressions@default:default,org.eclipse.core.filesystem.java7@default:false,org.eclipse.core.filesystem.macosx@default:false,org.eclipse.core.filesystem@default:default,org.eclipse.core.jobs@default:default,org.eclipse.core.resources@default:default,org.eclipse.core.runtime.compatibility.registry@default:false,org.eclipse.core.runtime@default:true,org.eclipse.core.variables@default:default,org.eclipse.e4.core.commands@default:default,org.eclipse.e4.core.contexts@default:default,org.eclipse.e4.core.di.annotations@default:default,org.eclipse.e4.core.di.extensions@default:default,org.eclipse.e4.core.di@default:default,org.eclipse.e4.core.services@default:default,org.eclipse.e4.emf.xpath@default:default,org.eclipse.e4.ui.bindings@default:default,org.eclipse.e4.ui.css.core@default:default,org.eclipse.e4.ui.css.swt.theme@default:default,org.eclipse.e4.ui.css.swt@default:default,org.eclipse.e4.ui.di@default:default,org.eclipse.e4.ui.model.workbench@default:default,org.eclipse.e4.ui.services@default:default,org.eclipse.e4.ui.widgets@default:default,org.eclipse.e4.ui.workbench.addons.swt@default:default,org.eclipse.e4.ui.workbench.renderers.swt.cocoa@default:false,org.eclipse.e4.ui.workbench.renderers.swt@default:default,org.eclipse.e4.ui.workbench.swt@default:default,org.eclipse.e4.ui.workbench3@default:default,org.eclipse.e4.ui.workbench@default:default,org.eclipse.emf.common@default:default,org.eclipse.emf.ecore.change@default:default,org.eclipse.emf.ecore.xmi@default:default,org.eclipse.emf.ecore@default:default,org.eclipse.equinox.app@default:default,org.eclipse.equinox.bidi@default:default,org.eclipse.equinox.common@2:true,org.eclipse.equinox.concurrent@default:default,org.eclipse.equinox.console@default:default,org.eclipse.equinox.ds@1:true,org.eclipse.equinox.event@default:default,org.eclipse.equinox.preferences@default:default,org.eclipse.equinox.registry@default:default,org.eclipse.equinox.util@default:default,org.eclipse.help@default:default,org.eclipse.jface.databinding@default:default,org.eclipse.jface.text@default:default,org.eclipse.jface@default:default,org.eclipse.osgi.compatibility.state@default:false,org.eclipse.osgi.services@default:default,org.eclipse.osgi@-1:true,org.eclipse.swt.cocoa.macosx.x86_64@default:false,org.eclipse.swt@default:default,org.eclipse.team.core@default:default,org.eclipse.text@default:default,org.eclipse.ui.cocoa@default:false,org.eclipse.ui.console@default:default,org.eclipse.ui.workbench.texteditor@default:default,org.eclipse.ui.workbench@default:default,org.eclipse.ui@default:default,org.hamcrest.core@default:default,org.junit@default:default,org.w3c.css.sac@default:default,org.w3c.dom.events@default:default,org.w3c.dom.smil@default:default,org.w3c.dom.svg@default:default"/>
<stringAttribute key="selected_workspace_plugins" value="com.minres.scviewer.database.sqlite@default:default,com.minres.scviewer.database.swt@default:default,com.minres.scviewer.database.text@default:default,com.minres.scviewer.database.vcd@default:default,com.minres.scviewer.database@default:default,com.minres.scviewer.e4.application@default:default"/>
<stringAttribute key="selected_workspace_plugins" value="com.minres.scviewer.database.sqlite@default:default,com.minres.scviewer.database.text@default:default,com.minres.scviewer.database.ui.swt@default:default,com.minres.scviewer.database.ui@default:default,com.minres.scviewer.database.vcd@default:default,com.minres.scviewer.database@default:default,com.minres.scviewer.e4.application@default:default"/>
<booleanAttribute key="show_selected_only" value="false"/>
<booleanAttribute key="tracing" value="false"/>
<booleanAttribute key="useCustomFeatures" value="false"/>

View File

@ -38,8 +38,9 @@
<plugin id="com.ibm.icu"/>
<plugin id="com.minres.scviewer.database"/>
<plugin id="com.minres.scviewer.database.sqlite"/>
<plugin id="com.minres.scviewer.database.swt"/>
<plugin id="com.minres.scviewer.database.text"/>
<plugin id="com.minres.scviewer.database.ui"/>
<plugin id="com.minres.scviewer.database.ui.swt"/>
<plugin id="com.minres.scviewer.database.vcd"/>
<plugin id="com.minres.scviewer.e4.application"/>
<plugin id="javax.annotation"/>

View File

@ -45,7 +45,8 @@ http://www.eclipse.org/legal/epl-v10.html
<import plugin="org.eclipse.swt"/>
<import plugin="org.apache.ant"/>
<import plugin="com.google.guava" version="15.0.0" match="greaterOrEqual"/>
<import plugin="com.minres.scviewer.database.swt" version="1.0.0" match="greaterOrEqual"/>
<import plugin="com.minres.scviewer.database.ui" version="1.0.0" match="greaterOrEqual"/>
<import plugin="com.minres.scviewer.database.ui.swt" version="1.0.0" match="greaterOrEqual"/>
<import plugin="org.eclipse.core.expressions" version="3.4.600" match="greaterOrEqual"/>
<import plugin="org.eclipse.jface"/>
<import plugin="org.junit"/>
@ -88,7 +89,14 @@ http://www.eclipse.org/legal/epl-v10.html
version="0.0.0"/>
<plugin
id="com.minres.scviewer.database.swt"
id="com.minres.scviewer.database.ui"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
<plugin
id="com.minres.scviewer.database.ui.swt"
download-size="0"
install-size="0"
version="0.0.0"

View File

@ -11,20 +11,22 @@
<module>../com.minres.scviewer.database.sqlite</module>
<module>../com.minres.scviewer.database.text</module>
<module>../com.minres.scviewer.database.vcd</module>
<module>../com.minres.scviewer.database.swt</module>
<module>../com.minres.scviewer.database.ui</module>
<module>../com.minres.scviewer.database.ui.swt</module>
<module>../com.minres.scviewer.e4.application</module>
<module>../com.minres.scviewer.ui</module>
<module>../com.minres.scviewer.feature</module>
<module>../com.minres.scviewer.feature</module>
<module>../com.minres.scviewer.updateSite</module>
<module>../com.minres.scviewer.e4.product</module>
</modules>
<properties>
<tycho-version>0.23.1</tycho-version>
<groovy-eclipse-compiler-version>2.8.0-01</groovy-eclipse-compiler-version>
<!-- <groovy-eclipse-batch-version>2.0.5</groovy-eclipse-batch-version> -->
<tycho-extras-version>${tycho-version}</tycho-extras-version>
<groovy-eclipse-compiler-version>2.8.0-01</groovy-eclipse-compiler-version>
<!-- <groovy-eclipse-batch-version>2.0.5</groovy-eclipse-batch-version> -->
<groovy-eclipse-batch-version>2.1.8-01</groovy-eclipse-batch-version>
</properties>
<repositories>
<repository>
@ -82,6 +84,59 @@
</environments>
</configuration>
</plugin>
<plugin>
<groupId>org.eclipse.tycho.extras</groupId>
<artifactId>tycho-source-feature-plugin</artifactId>
<version>${tycho-extras-version}</version>
<executions>
<execution>
<id>source-feature</id>
<phase>package</phase>
<goals>
<goal>source-feature</goal>
</goals>
</execution>
</executions>
<configuration>
<excludes>
<!-- provide plug-ins not containing any source code -->
<plugin id="org.codehaus.groovy" />
</excludes>
</configuration>
</plugin>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-source-plugin</artifactId>
<version>${tycho-version}</version>
<executions>
<execution>
<id>plugin-source</id>
<goals>
<goal>plugin-source</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-p2-plugin</artifactId>
<version>${tycho-version}</version>
<executions>
<execution>
<id>attached-p2-metadata</id>
<phase>package</phase>
<goals>
<goal>p2-metadata</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View File

@ -6,7 +6,8 @@ Bundle-Version: 1.0.0.qualifier
Bundle-Activator: com.minres.scviewer.ui.TxEditorPlugin
Bundle-Vendor: MINRES Technologies GmbH
Require-Bundle: com.minres.scviewer.database;bundle-version="1.0.0",
com.minres.scviewer.database.swt;bundle-version="1.0.0",
com.minres.scviewer.database.ui;bundle-version="1.0.0",
com.minres.scviewer.database.ui.swt;bundle-version="1.0.0",
org.eclipse.core.runtime,
org.eclipse.core.resources,
org.eclipse.jface.text,

View File

@ -48,8 +48,9 @@ import com.minres.scviewer.database.IWaveform;
import com.minres.scviewer.database.IWaveformDb;
import com.minres.scviewer.database.IWaveformDbFactory;
import com.minres.scviewer.database.IWaveformEvent;
import com.minres.scviewer.database.swt.GotoDirection;
import com.minres.scviewer.database.swt.TxDisplay;
import com.minres.scviewer.database.ui.GotoDirection;
import com.minres.scviewer.database.ui.IWaveformPanel;
import com.minres.scviewer.ui.views.TxOutlinePage;
public class TxEditorPart extends EditorPart implements ITabbedPropertySheetPageContributor {
@ -112,7 +113,7 @@ public class TxEditorPart extends EditorPart implements ITabbedPropertySheetPage
});
txDisplay = new TxDisplay(parent);
txDisplay.setMaxTime(0);
txDisplay.addPropertyChangeListener(TxDisplay.CURSOR_PROPERTY, new PropertyChangeListener() {
txDisplay.addPropertyChangeListener(IWaveformPanel.CURSOR_PROPERTY, new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent evt) {
Long time = (Long) evt.getNewValue();

View File

@ -16,7 +16,7 @@ import org.eclipse.core.commands.ExecutionException;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.handlers.HandlerUtil;
import com.minres.scviewer.database.swt.GotoDirection;
import com.minres.scviewer.database.ui.GotoDirection;
import com.minres.scviewer.ui.TxEditorPart;
public class GotoNext extends AbstractHandler {

View File

@ -16,7 +16,7 @@ import org.eclipse.core.commands.ExecutionException;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.handlers.HandlerUtil;
import com.minres.scviewer.database.swt.GotoDirection;
import com.minres.scviewer.database.ui.GotoDirection;
import com.minres.scviewer.ui.TxEditorPart;
public class GotoPrev extends AbstractHandler {

View File

@ -17,6 +17,4 @@
</resource>
</resources>
</build> -->
<groupId>com.minres.scviewer</groupId>
<version>1.0.0-SNAPSHOT</version>
</project>
</project>