Finished version 1.0

- added relation navigation
- improved about dialog
This commit is contained in:
Eyck Jentzsch 2015-11-15 22:15:37 +01:00
parent c4fc4e20a6
commit 89fb6629d0
47 changed files with 1201 additions and 590 deletions

View File

@ -1,28 +0,0 @@
/*******************************************************************************
* Copyright (c) 2015 MINRES Technologies GmbH and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* MINRES Technologies GmbH - initial API and implementation
*******************************************************************************/
package com.minres.scviewer.database.sqlite;
import java.util.HashMap;
import com.minres.scviewer.database.RelationType;
class RelationTypeFactory {
HashMap<String, RelationType> registry=new HashMap<String, RelationType>();
public RelationType getRelationType(String name) {
if(registry.containsKey(name)) return registry.get(name);
RelationType rt = new RelationType(name);
registry.put(name, rt);
return rt;
}
}

View File

@ -16,12 +16,14 @@ import java.io.FileInputStream;
import java.lang.reflect.InvocationTargetException;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import com.minres.scviewer.database.IWaveform;
import com.minres.scviewer.database.IWaveformDb;
import com.minres.scviewer.database.IWaveformDbLoader;
import com.minres.scviewer.database.IWaveformEvent;
import com.minres.scviewer.database.RelationType;
import com.minres.scviewer.database.sqlite.db.IDatabase;
import com.minres.scviewer.database.sqlite.db.SQLiteDatabase;
import com.minres.scviewer.database.sqlite.db.SQLiteDatabaseSelectHandler;
@ -33,7 +35,7 @@ public class SQLiteDbLoader implements IWaveformDbLoader {
protected IDatabase database;
private RelationTypeFactory rtf = new RelationTypeFactory();
private List<RelationType> usedRelationsList = new ArrayList<>();
private IWaveformDb db;
@ -64,7 +66,7 @@ public class SQLiteDbLoader implements IWaveformDbLoader {
try {
for(ScvStream scvStream:handler.selectObjects()){
TxStream stream = new TxStream(database, db, scvStream);
stream.setRelationTypeFactory(rtf);
stream.setRelationTypeList(usedRelationsList);
streams.add(stream);
}
} catch (SecurityException | IllegalArgumentException | InstantiationException | IllegalAccessException
@ -102,4 +104,10 @@ public class SQLiteDbLoader implements IWaveformDbLoader {
}
return false;
}
@Override
public Collection<RelationType> getAllRelationTypes(){
return usedRelationsList;
}
}

View File

@ -55,7 +55,7 @@ public class TxStream extends HierNode implements ITxStream<ITxEvent> {
private TreeMap<Long, List<ITxEvent>> events;
private RelationTypeFactory relationMap;
private List<RelationType> usedRelationsList;
public TxStream(IDatabase database, IWaveformDb waveformDb, ScvStream scvStream) {
super(scvStream.getName());
@ -181,14 +181,14 @@ public class TxStream extends HierNode implements ITxStream<ITxEvent> {
return getEvents().get(time);
}
public void setRelationTypeFactory(RelationTypeFactory rtf) {
this.relationMap=rtf;
public void setRelationTypeList(List<RelationType> usedRelationsList){
this.usedRelationsList=usedRelationsList;
}
public RelationType getRelationType(String name) {
if(relationMap!=null) return relationMap.getRelationType(name);
return null;
RelationType relType=RelationType.create(name);
if(!usedRelationsList.contains(relType)) usedRelationsList.add(relType);
return relType;
}
@Override

View File

@ -10,6 +10,8 @@
*******************************************************************************/
package com.minres.scviewer.database.text;
import java.util.Collection;
import com.minres.scviewer.database.AssociationType
import com.minres.scviewer.database.DataType
import com.minres.scviewer.database.ITxGenerator
@ -145,7 +147,7 @@ public class TextDbLoader implements IWaveformDbLoader{
Tx tr2= transactionsById[Integer.parseInt(tokens[2])]
Tx tr1= transactionsById[Integer.parseInt(tokens[3])]
def relType=tokens[1][1..-2]
if(!relationTypes.containsKey(relType)) relationTypes[relType]=new RelationType(relType)
if(!relationTypes.containsKey(relType)) relationTypes[relType]=RelationType.create(relType)
def rel = new TxRelation(relationTypes[relType], tr1, tr2)
tr1.outgoingRelations<<rel
tr2.incomingRelations<<rel
@ -160,4 +162,10 @@ public class TextDbLoader implements IWaveformDbLoader{
private def calculateConcurrencyIndicees(){
streams.each{ TxStream stream -> stream.getMaxConcurrency() }
}
public Collection<RelationType> getAllRelationTypes(){
return relationTypes.values();
}
}

View File

@ -25,127 +25,154 @@ import org.eclipse.swt.widgets.Display;
import com.minres.scviewer.database.ITx;
import com.minres.scviewer.database.ITxRelation;
import com.minres.scviewer.database.ITxStream;
import com.minres.scviewer.database.RelationType;
import com.minres.scviewer.database.ui.WaveformColors;
public class ArrowPainter implements IPainter {
private final int xCtrlOffset=50;
private final int xCtrlOffset = 50;
private final int yCtrlOffset=30;
private final int yCtrlOffset = 30;
private WaveformCanvas waveCanvas;
private ITx tx;
private List<Rectangle> iRect;
private List<LinkEntry> iRect;
private List<Rectangle> oRect;
private List<LinkEntry> oRect;
private Rectangle txRectangle;
private RelationType highlightType;
long scaleFactor;
boolean deferredUpdate;
public ArrowPainter(WaveformCanvas waveCanvas) {
public ArrowPainter(WaveformCanvas waveCanvas, RelationType relationType) {
this.waveCanvas = waveCanvas;
highlightType=relationType;
setTx(null);
}
public RelationType getHighlightType() {
return highlightType;
}
public void setHighlightType(RelationType highlightType) {
this.highlightType = highlightType;
}
public ITx getTx() {
return tx;
}
public void setTx(ITx newTx) {
this.tx = newTx;
iRect=new LinkedList<>();
oRect=new LinkedList<>();
scaleFactor=waveCanvas.getScaleFactor();
if(tx!=null){
iRect = new LinkedList<>();
oRect = new LinkedList<>();
scaleFactor = waveCanvas.getScaleFactor();
if (tx != null) {
calculateGeometries();
}
}
protected void calculateGeometries() {
deferredUpdate=false;
ITxStream<?> stream=tx.getStream();
IWaveformPainter painter=waveCanvas.wave2painterMap.get(stream);
if(painter==null){ // stream has been added but painter not yet created
deferredUpdate=true;
deferredUpdate = false;
ITxStream<?> stream = tx.getStream();
IWaveformPainter painter = waveCanvas.wave2painterMap.get(stream);
if (painter == null) { // stream has been added but painter not yet
// created
deferredUpdate = true;
return;
}
int laneHeight=painter.getHeight()/stream.getMaxConcurrency();
txRectangle = new Rectangle(
(int)(tx.getBeginTime()/scaleFactor),
waveCanvas.rulerHeight+painter.getVerticalOffset()+laneHeight*tx.getConcurrencyIndex(),
(int)((tx.getEndTime()-tx.getBeginTime())/scaleFactor),
laneHeight);
int laneHeight = painter.getHeight() / stream.getMaxConcurrency();
txRectangle = new Rectangle((int) (tx.getBeginTime() / scaleFactor),
waveCanvas.rulerHeight + painter.getVerticalOffset() + laneHeight * tx.getConcurrencyIndex(),
(int) ((tx.getEndTime() - tx.getBeginTime()) / scaleFactor), laneHeight);
deriveGeom(tx.getIncomingRelations(), iRect, false);
deriveGeom(tx.getOutgoingRelations(), oRect, true);
}
protected void deriveGeom(Collection<ITxRelation> relations, List<Rectangle> res, boolean useTarget) {
for(ITxRelation iTxRelation: relations){
ITx otherTx = useTarget?iTxRelation.getTarget():iTxRelation.getSource();
if(waveCanvas.wave2painterMap.containsKey(otherTx.getStream())){
ITxStream<?> stream=otherTx.getStream();
IWaveformPainter painter=waveCanvas.wave2painterMap.get(stream);
int laneHeight=painter.getHeight()/stream.getMaxConcurrency();
Rectangle bb = new Rectangle(
(int)(otherTx.getBeginTime()/scaleFactor),
waveCanvas.rulerHeight+painter.getVerticalOffset()+laneHeight*otherTx.getConcurrencyIndex(),
(int)((otherTx.getEndTime()-otherTx.getBeginTime())/scaleFactor),
laneHeight);
res.add(bb);
protected void deriveGeom(Collection<ITxRelation> relations, List<LinkEntry> res, boolean useTarget) {
for (ITxRelation iTxRelation : relations) {
ITx otherTx = useTarget ? iTxRelation.getTarget() : iTxRelation.getSource();
if (waveCanvas.wave2painterMap.containsKey(otherTx.getStream())) {
ITxStream<?> stream = otherTx.getStream();
IWaveformPainter painter = waveCanvas.wave2painterMap.get(stream);
int laneHeight = painter.getHeight() / stream.getMaxConcurrency();
Rectangle bb = new Rectangle((int) (otherTx.getBeginTime() / scaleFactor),
waveCanvas.rulerHeight + painter.getVerticalOffset()
+ laneHeight * otherTx.getConcurrencyIndex(),
(int) ((otherTx.getEndTime() - otherTx.getBeginTime()) / scaleFactor), laneHeight);
res.add(new LinkEntry(bb, iTxRelation.getRelationType()));
}
}
}
@Override
public void paintArea(GC gc, Rectangle area) {
Color fgColor=waveCanvas.colors[WaveformColors.REL_ARROW.ordinal()];
if(deferredUpdate || (tx!=null && waveCanvas.getScaleFactor()!=scaleFactor)){
scaleFactor=waveCanvas.getScaleFactor();
Color fgColor = waveCanvas.colors[WaveformColors.REL_ARROW.ordinal()];
Color highliteColor = waveCanvas.colors[WaveformColors.REL_ARROW_HIGHLITE.ordinal()];
if (deferredUpdate || (tx != null && waveCanvas.getScaleFactor() != scaleFactor)) {
scaleFactor = waveCanvas.getScaleFactor();
calculateGeometries();
}
for(Rectangle srcRectangle:iRect){
Point target = drawPath(gc, fgColor, srcRectangle, txRectangle);
gc.drawLine(target.x-8,target.y-5, target.x,target.y);
gc.drawLine(target.x-8,target.y+5, target.x,target.y);
for (LinkEntry entry : iRect) {
Point target = drawPath(gc, highlightType.equals(entry.relationType) ? highliteColor : fgColor,
entry.rectangle, txRectangle);
drawArrow(gc, target);
}
for(Rectangle tgtRectangle:oRect){
Point target = drawPath(gc, fgColor, txRectangle, tgtRectangle);
gc.drawLine(target.x-8,target.y-5, target.x,target.y);
gc.drawLine(target.x-8,target.y+5, target.x,target.y);
for (LinkEntry entry : oRect) {
Point target = drawPath(gc, highlightType.equals(entry.relationType) ? highliteColor : fgColor, txRectangle,
entry.rectangle);
drawArrow(gc, target);
}
}
protected void drawArrow(GC gc, Point target) {
gc.drawLine(target.x - 8, target.y - 5, target.x, target.y);
gc.drawLine(target.x - 8, target.y + 5, target.x, target.y);
}
protected Point drawPath(GC gc, Color fgColor, Rectangle srcRectangle, Rectangle tgtRectangle) {
Point point1=new Point(0, srcRectangle.y+srcRectangle.height/2);
Point point2=new Point(0, tgtRectangle.y+tgtRectangle.height/2);
Point point1 = new Point(0, srcRectangle.y + srcRectangle.height / 2);
Point point2 = new Point(0, tgtRectangle.y + tgtRectangle.height / 2);
point1.x = srcRectangle.x;
point2.x = tgtRectangle.x;
if(point2.x>point1.x+srcRectangle.width) point1.x+=srcRectangle.width;
if(point1.x>point2.x+tgtRectangle.width) point2.x+=tgtRectangle.width;
if (point2.x > point1.x + srcRectangle.width)
point1.x += srcRectangle.width;
if (point1.x > point2.x + tgtRectangle.width)
point2.x += tgtRectangle.width;
Path path=new Path(Display.getCurrent());
path.moveTo(point1.x,point1.y);
if(point1.y==point2.y){
Point center=new Point((point1.x+point2.x)/2, point1.y-yCtrlOffset);
path.cubicTo(point1.x+xCtrlOffset, point1.y,
center.x-xCtrlOffset, center.y,
center.x, center.y);
path.cubicTo(center.x+xCtrlOffset, center.y,
point2.x-xCtrlOffset, point2.y,
point2.x, point2.y);
Path path = new Path(Display.getCurrent());
path.moveTo(point1.x, point1.y);
if (point1.y == point2.y) {
Point center = new Point((point1.x + point2.x) / 2, point1.y - yCtrlOffset);
path.cubicTo(point1.x + xCtrlOffset, point1.y, center.x - xCtrlOffset, center.y, center.x, center.y);
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);
path.cubicTo(point1.x + xCtrlOffset, point1.y, point2.x - xCtrlOffset, point2.y, point2.x, point2.y);
gc.setAntialias(SWT.ON);
gc.setForeground(fgColor);
gc.drawPath(path);
path.dispose();
return point2;
}
class LinkEntry {
public Rectangle rectangle;
public RelationType relationType;
public LinkEntry(Rectangle rectangle, RelationType relationType) {
super();
this.rectangle = rectangle;
this.relationType = relationType;
}
}
}

View File

@ -40,6 +40,8 @@ import com.google.common.collect.Lists;
import com.minres.scviewer.database.ITx;
import com.minres.scviewer.database.IWaveform;
import com.minres.scviewer.database.IWaveformEvent;
import com.minres.scviewer.database.RelationType;
import com.minres.scviewer.database.ui.IWaveformViewer;
import com.minres.scviewer.database.ui.WaveformColors;
public class WaveformCanvas extends Canvas {
@ -115,7 +117,7 @@ public class WaveformCanvas extends Canvas {
painterList.add(trackAreaPainter);
rulerPainter=new RulerPainter(this);
painterList.add(rulerPainter);
arrowPainter=new ArrowPainter(this);
arrowPainter=new ArrowPainter(this, IWaveformViewer.NEXT_PREV_IN_STREAM);
painterList.add(arrowPainter);
CursorPainter cp = new CursorPainter(this, scaleFactor * 10, cursorPainters.size()-1);
painterList.add(cp);
@ -159,10 +161,19 @@ public class WaveformCanvas extends Canvas {
colors[WaveformColors.CURSOR_TEXT.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_WHITE);
colors[WaveformColors.MARKER.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_DARK_GRAY);
colors[WaveformColors.MARKER_TEXT.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_WHITE);
colors[WaveformColors.REL_ARROW.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_YELLOW);
colors[WaveformColors.REL_ARROW.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_MAGENTA);
colors[WaveformColors.REL_ARROW_HIGHLITE.ordinal()] = SWTResourceManager.getColor(255, 128, 255);
}
}
public void setHighliteRelation(RelationType relationType){
if(arrowPainter!=null){
boolean redraw = arrowPainter.getHighlightType()!=relationType;
arrowPainter.setHighlightType(relationType);
if(redraw) redraw();
}
}
public Point getOrigin() {
return origin;
}

View File

@ -13,6 +13,7 @@ package com.minres.scviewer.database.swt.internal;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.LinkedList;
@ -73,9 +74,11 @@ import com.minres.scviewer.database.ISignalChangeMulti;
import com.minres.scviewer.database.ISignalChangeSingle;
import com.minres.scviewer.database.ITx;
import com.minres.scviewer.database.ITxEvent;
import com.minres.scviewer.database.ITxRelation;
import com.minres.scviewer.database.ITxStream;
import com.minres.scviewer.database.IWaveform;
import com.minres.scviewer.database.IWaveformEvent;
import com.minres.scviewer.database.RelationType;
import com.minres.scviewer.database.ui.GotoDirection;
import com.minres.scviewer.database.ui.ICursor;
import com.minres.scviewer.database.ui.IWaveformViewer;
@ -84,7 +87,7 @@ import com.minres.scviewer.database.ui.WaveformColors;
public class WaveformViewer implements IWaveformViewer {
private ListenerList selectionChangedListeners = new ListenerList();
private ListenerList selectionChangedListeners = new ListenerList();
private PropertyChangeSupport pcs;
@ -462,10 +465,10 @@ public class WaveformViewer implements IWaveformViewer {
if(firstTx!=null){
do {
for(ITxEvent evt:firstTx.getValue()){
ITx tx=evt.getTransaction();
ITx tx=evt.getTransaction();
if(evt.getType()==ITxEvent.Type.BEGIN && tx.getBeginTime()<=time && tx.getEndTime()>=time){
if(resultsList[tx.getConcurrencyIndex()]==null)
resultsList[tx.getConcurrencyIndex()]= evt.getTransaction();
resultsList[tx.getConcurrencyIndex()]= evt.getTransaction();
}
}
firstTx=stream.getEvents().lowerEntry(firstTx.getKey());
@ -480,7 +483,7 @@ public class WaveformViewer implements IWaveformViewer {
}
entry.setValue(value);
}
}
}
}
valueList.redraw();
}
@ -613,10 +616,10 @@ public class WaveformViewer implements IWaveformViewer {
IStructuredSelection selection=currentTxSelection!=null?
new StructuredSelection(new Object[]{currentTxSelection, currentWaveformSelection.waveform}):
new StructuredSelection(currentWaveformSelection.waveform);
Object[] list = selectionChangedListeners.getListeners();
for (int i = 0; i < list.length; i++) {
((ISelectionChangedListener) list[i]).selectionChanged(new SelectionChangedEvent(this, selection));
}
Object[] list = selectionChangedListeners.getListeners();
for (int i = 0; i < list.length; i++) {
((ISelectionChangedListener) list[i]).selectionChanged(new SelectionChangedEvent(this, selection));
}
}
/* (non-Javadoc)
@ -624,63 +627,91 @@ public class WaveformViewer implements IWaveformViewer {
*/
@Override
public void moveSelection(GotoDirection direction) {
if (currentWaveformSelection.isStream()) {
ITxStream<? extends ITxEvent> stream = currentWaveformSelection.getStream();
ITx transaction = null;
if (direction == GotoDirection.NEXT) {
List<ITxEvent> thisEntryList = stream.getEvents().get(currentTxSelection.getBeginTime());
boolean meFound=false;
for (ITxEvent evt : thisEntryList) {
if (evt.getType() == ITxEvent.Type.BEGIN) {
if(meFound){
transaction = evt.getTransaction();
break;
}
meFound|= evt.getTransaction().equals(currentTxSelection);
}
}
if (transaction == null){
Entry<Long, List<ITxEvent>> entry = stream.getEvents().higherEntry(currentTxSelection.getBeginTime());
if (entry != null) do {
for (ITxEvent evt : entry.getValue()) {
if (evt.getType() == ITxEvent.Type.BEGIN) {
moveSelection(direction, NEXT_PREV_IN_STREAM) ;
}
/* (non-Javadoc)
* @see com.minres.scviewer.database.swt.IWaveformPanel#moveSelection(com.minres.scviewer.database.swt.GotoDirection, com.minres.scviewer.database.RelationType)
*/
@Override
public void moveSelection(GotoDirection direction, RelationType relationType) {
if (currentWaveformSelection!=null && currentWaveformSelection.isStream() && currentTxSelection!=null) {
if(relationType.equals(IWaveformViewer.NEXT_PREV_IN_STREAM)){
ITxStream<? extends ITxEvent> stream = currentWaveformSelection.getStream();
ITx transaction = null;
if (direction == GotoDirection.NEXT) {
List<ITxEvent> thisEntryList = stream.getEvents().get(currentTxSelection.getBeginTime());
boolean meFound=false;
for (ITxEvent evt : thisEntryList) {
if (evt.getType() == ITxEvent.Type.BEGIN) {
if(meFound){
transaction = evt.getTransaction();
break;
}
meFound|= evt.getTransaction().equals(currentTxSelection);
}
if (transaction == null)
entry = stream.getEvents().higherEntry(entry.getKey());
} while (entry != null && transaction == null);
}
} else if (direction == GotoDirection.PREV) {
List<ITxEvent> thisEntryList = stream.getEvents().get(currentTxSelection.getBeginTime());
boolean meFound=false;
for (ITxEvent evt : Lists.reverse(thisEntryList)) {
if (evt.getType() == ITxEvent.Type.BEGIN) {
if(meFound){
transaction = evt.getTransaction();
break;
}
meFound|= evt.getTransaction().equals(currentTxSelection);
}
}
if (transaction == null){
Entry<Long, List<ITxEvent>> entry = stream.getEvents().lowerEntry(currentTxSelection.getBeginTime());
if (entry != null)
do {
for (ITxEvent evt : Lists.reverse(entry.getValue())) {
if (transaction == null){
Entry<Long, List<ITxEvent>> entry = stream.getEvents().higherEntry(currentTxSelection.getBeginTime());
if (entry != null) do {
for (ITxEvent evt : entry.getValue()) {
if (evt.getType() == ITxEvent.Type.BEGIN) {
transaction = evt.getTransaction();
break;
}
}
if (transaction == null)
entry = stream.getEvents().lowerEntry(entry.getKey());
entry = stream.getEvents().higherEntry(entry.getKey());
} while (entry != null && transaction == null);
}
} else if (direction == GotoDirection.PREV) {
List<ITxEvent> thisEntryList = stream.getEvents().get(currentTxSelection.getBeginTime());
boolean meFound=false;
for (ITxEvent evt : Lists.reverse(thisEntryList)) {
if (evt.getType() == ITxEvent.Type.BEGIN) {
if(meFound){
transaction = evt.getTransaction();
break;
}
meFound|= evt.getTransaction().equals(currentTxSelection);
}
}
if (transaction == null){
Entry<Long, List<ITxEvent>> entry = stream.getEvents().lowerEntry(currentTxSelection.getBeginTime());
if (entry != null)
do {
for (ITxEvent evt : Lists.reverse(entry.getValue())) {
if (evt.getType() == ITxEvent.Type.BEGIN) {
transaction = evt.getTransaction();
break;
}
}
if (transaction == null)
entry = stream.getEvents().lowerEntry(entry.getKey());
} while (entry != null && transaction == null);
}
}
if (transaction != null) {
setSelection(new StructuredSelection(transaction));
}
} else {
if (direction == GotoDirection.NEXT) {
Collection<ITxRelation> outRel=currentTxSelection.getOutgoingRelations();
for(ITxRelation rel:outRel){
if(relationType.equals(rel.getRelationType())){
setSelection(new StructuredSelection(rel.getTarget()), true);
return;
}
}
} else if (direction == GotoDirection.PREV) {
Collection<ITxRelation> inRel=currentTxSelection.getIncomingRelations();
for(ITxRelation rel:inRel){
if(relationType.equals(rel.getRelationType())){
setSelection(new StructuredSelection(rel.getSource()), true);
return;
}
}
}
}
if (transaction != null) {
setSelection(new StructuredSelection(transaction));
}
}
}
@ -721,7 +752,7 @@ public class WaveformViewer implements IWaveformViewer {
* @see com.minres.scviewer.database.swt.IWaveformPanel#moveSelected(int)
*/
@Override
public void moveSelected(int i) {
public void moveSelectedTrack(int i) {
if(currentWaveformSelection!=null){
ITx selectedTx=currentTxSelection;
TrackEntry selectedWaveform=currentWaveformSelection;
@ -815,6 +846,11 @@ public class WaveformViewer implements IWaveformViewer {
gc.drawText(value, subArea.x + 5, subArea.y + yOffset + (waveformCanvas.getTrackHeight() - size.y) / 2, true);
}
public void setHighliteRelation(RelationType relationType){
this.waveformCanvas.setHighliteRelation(relationType);
}
/* (non-Javadoc)
* @see com.minres.scviewer.database.swt.IWaveformPanel#getMaxTime()
*/

View File

@ -21,12 +21,16 @@ import org.eclipse.swt.graphics.RGB;
import org.eclipse.swt.widgets.Control;
import com.minres.scviewer.database.IWaveform;
import com.minres.scviewer.database.RelationType;
public interface IWaveformViewer extends PropertyChangeListener, ISelectionProvider{
String CURSOR_PROPERTY = "cursor_time";
String MARKER_PROPERTY = "marker_time";
public static final RelationType NEXT_PREV_IN_STREAM = RelationType.create("Prev/Next in stream");
public void addSelectionChangedListener(ISelectionChangedListener listener);
public void removeSelectionChangedListener(ISelectionChangedListener listener);
@ -47,13 +51,17 @@ public interface IWaveformViewer extends PropertyChangeListener, ISelectionProvi
public void moveSelection(GotoDirection direction);
public void moveSelection(GotoDirection direction, RelationType relationType);
public void moveCursor(GotoDirection direction);
public List<TrackEntry> getStreamList();
public TrackEntry getEntryForStream(IWaveform<?> source);
public void moveSelected(int i);
public void moveSelectedTrack(int i);
public void setHighliteRelation(RelationType relationType);
public long getMaxTime();

View File

@ -16,5 +16,5 @@ public enum WaveformColors {
TX_BG, TX_BG_HIGHLITE, TX_BORDER,
SIGNAL0, SIGNAL1, SIGNALZ, SIGNALX, SIGNAL_TEXT,
CURSOR, CURSOR_DRAG, CURSOR_TEXT,
MARKER, MARKER_TEXT, REL_ARROW
MARKER, MARKER_TEXT, REL_ARROW, REL_ARROW_HIGHLITE
}

View File

@ -12,6 +12,8 @@ package com.minres.scviewer.database.vcd;
import java.io.File;
import java.io.FileInputStream;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Stack;
import java.util.TreeMap;
@ -27,6 +29,7 @@ import com.minres.scviewer.database.IWaveformDb;
import com.minres.scviewer.database.IWaveformDbLoader;
import com.minres.scviewer.database.IWaveformEvent;
import com.minres.scviewer.database.InputFormatException;
import com.minres.scviewer.database.RelationType;
// TODO: Auto-generated Javadoc
/**
@ -177,4 +180,9 @@ public class VCDDbLoader implements IWaveformDbLoader, IVCDDatabaseBuilder {
}
}
@Override
public Collection<RelationType> getAllRelationTypes(){
return Collections.emptyList();
}
}

View File

@ -1,7 +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="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
<classpathentry kind="output" path="target/classes"/>
</classpath>

View File

@ -22,6 +22,8 @@ public interface IWaveformDb extends IHierNode {
public List<IWaveform<?>> getAllWaves();
public List<RelationType> getAllRelationTypes();
public boolean load(File inp) throws Exception;
public boolean isLoaded();

View File

@ -11,6 +11,7 @@
package com.minres.scviewer.database;
import java.io.File;
import java.util.Collection;
import java.util.List;
public interface IWaveformDbLoader {
@ -21,4 +22,6 @@ public interface IWaveformDbLoader {
public List<IWaveform<? extends IWaveformEvent>> getAllWaves() ;
public Collection<RelationType> getAllRelationTypes() ;
}

View File

@ -10,11 +10,26 @@
*******************************************************************************/
package com.minres.scviewer.database;
import java.util.HashMap;
public class RelationType {
private static HashMap<String, RelationType> registry = new HashMap<>();
private String name;
public RelationType(String name) {
public static RelationType create(String name){
if(registry.containsKey(name)){
return registry.get(name);
}else{
RelationType relType = new RelationType(name);
registry.put(name, relType);
return relType;
}
}
private RelationType(String name) {
super();
this.name = name;
}
@ -30,4 +45,9 @@ public class RelationType {
public String toString(){
return name;
}
@Override
public int hashCode() {
return name.hashCode();
}
}

View File

@ -29,6 +29,7 @@ import com.minres.scviewer.database.IWaveformDb;
import com.minres.scviewer.database.IWaveformDbLoader;
import com.minres.scviewer.database.IWaveformEvent;
import com.minres.scviewer.database.InputFormatException;
import com.minres.scviewer.database.RelationType;
public class WaveformDb extends HierNode implements IWaveformDb {
@ -38,6 +39,8 @@ public class WaveformDb extends HierNode implements IWaveformDb {
private List<IHierNode> childNodes;
private List<RelationType> relationTypes;
private Map<String, IWaveform<?>> waveforms;
private Long maxTime;
@ -59,6 +62,7 @@ public class WaveformDb extends HierNode implements IWaveformDb {
public WaveformDb() {
super();
waveforms = new HashMap<String, IWaveform<?>>();
relationTypes=new ArrayList<>();
maxTime=0L;
}
@ -89,6 +93,7 @@ public class WaveformDb extends HierNode implements IWaveformDb {
}
if(name==null) name=getFileBasename(inp.getName());
buildHierarchyNodes() ;
relationTypes.addAll(loader.getAllRelationTypes());
pcs.firePropertyChange("WAVEFORMS", null, waveforms);
pcs.firePropertyChange("CHILDS", null, childNodes);
loaded = true;
@ -185,4 +190,9 @@ public class WaveformDb extends HierNode implements IWaveformDb {
}
return sb.toString();
}
@Override
public List<RelationType> getAllRelationTypes() {
return relationTypes;
}
}

View File

@ -1,7 +1,12 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.7
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
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.source=1.7

View File

@ -4,29 +4,26 @@
<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:PartSashContainer" xmi:id="_61hA8HTPEeWwZ-9vrAR2UQ" elementId="" containerData="20">
<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">
<children xsi:type="menu:HandledMenuItem" xmi:id="_swdo8Hr9EeWVM_sKoXvptg" 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="_IA_lcHr_EeWVM_sKoXvptg" elementId="com.minres.scviewer.e4.application.parameter.21" name="com.minres.scviewer.e4.application.command.addwaveform.where" value="after"/>
<parameters xmi:id="_B6hTkHwJEeWv0Y5uF2QN5w" 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="_twC2oHr9EeWVM_sKoXvptg" 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="_KQPEMHr_EeWVM_sKoXvptg" elementId="com.minres.scviewer.e4.application.parameter.22" name="com.minres.scviewer.e4.application.command.addwaveform.where" value="before"/>
<parameters xmi:id="_Em0hwHwJEeWv0Y5uF2QN5w" 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="_uMoE8Hr9EeWVM_sKoXvptg" 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="_LpOQYHr_EeWVM_sKoXvptg" elementId="com.minres.scviewer.e4.application.parameter.23" name="com.minres.scviewer.e4.application.command.addwaveform.where" value="after"/>
<parameters xmi:id="_G-T9kHwJEeWv0Y5uF2QN5w" 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="_ukpjYHr9EeWVM_sKoXvptg" 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="_M9U8kHr_EeWVM_sKoXvptg" elementId="com.minres.scviewer.e4.application.parameter.24" name="com.minres.scviewer.e4.application.command.addwaveform.where" value="before"/>
<parameters xmi:id="_ckAToHwJEeWv0Y5uF2QN5w" 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:Part" xmi:id="_95QGynNmEeWBq8z1Dv39LA" elementId="com.minres.scviewer.e4.application.parts.DesignBrowser" containerData="20" contributionURI="bundleclass://com.minres.scviewer.e4.application/com.minres.scviewer.e4.application.parts.DesignBrowser" label="Design Browser">
<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="80">
<children xsi:type="basic:PartStack" xmi:id="_95QGyXNmEeWBq8z1Dv39LA" elementId="org.eclipse.editorss" containerData="75"/>
@ -50,7 +47,7 @@
<parameters xmi:id="_5bKwsHguEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.parameter.16" name="com.minres.scviewer.e4.application.command.movewaveformupCommand.parameter.dir" value="up"/>
</children>
<children xsi:type="menu:HandledMenuItem" xmi:id="_7BRy4HguEeWwZ-9vrAR2UQ" elementId="" label="Move Waveform down" iconURI="platform:/plugin/com.minres.scviewer.e4.application/icons/down_blue.png" command="_N_sOkHXHEeWwZ-9vrAR2UQ">
<parameters xmi:id="_7BRy4XguEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.parameter.16" name="com.minres.scviewer.e4.application.command.movewaveformupCommand.parameter.dir" value="down"/>
<parameters xmi:id="_7BRy4XguEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.parameter.29" name="com.minres.scviewer.e4.application.command.movewaveformupCommand.parameter.dir" value="down"/>
</children>
</children>
<children xsi:type="menu:Menu" xmi:id="_ZywtoHgwEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.menu.cursor" label="Cursor ...">
@ -79,42 +76,48 @@
</mainMenu>
<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"/>
<children xsi:type="menu:HandledToolItem" xmi:id="_95QGznNmEeWBq8z1Dv39LA" iconURI="platform:/plugin/com.minres.scviewer.e4.application/icons/save_edit.png" command="_95Pfw3NmEeWBq8z1Dv39LA"/>
<children xsi:type="menu:HandledToolItem" xmi:id="_95QGzXNmEeWBq8z1Dv39LA" iconURI="platform:/plugin/com.minres.scviewer.e4.application/icons/folder_database.png" tooltip="Open new database" command="_95PfwHNmEeWBq8z1Dv39LA"/>
<children xsi:type="menu:HandledToolItem" xmi:id="_95QGznNmEeWBq8z1Dv39LA" toBeRendered="false" visible="false" iconURI="platform:/plugin/com.minres.scviewer.e4.application/icons/save_edit.png" command="_95Pfw3NmEeWBq8z1Dv39LA"/>
</children>
<children xsi:type="menu:ToolBar" xmi:id="_VUv_AHckEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.toolbar.0">
<children xsi:type="menu:HandledToolItem" xmi:id="_EboiQHcjEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.handledtoolitem.removestream" label="Remove Stream" iconURI="platform:/plugin/com.minres.scviewer.e4.application/icons/cross.png" command="_WUZ2wHXHEeWwZ-9vrAR2UQ"/>
<children xsi:type="menu:HandledToolItem" xmi:id="_EboiQHcjEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.handledtoolitem.removestream" label="Remove Stream" iconURI="platform:/plugin/com.minres.scviewer.e4.application/icons/cross.png" tooltip="Remove stream/waveform from list" command="_WUZ2wHXHEeWwZ-9vrAR2UQ"/>
<children xsi:type="menu:ToolBarSeparator" xmi:id="_rLVjAHgwEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.toolbarseparator.2"/>
<children xsi:type="menu:HandledToolItem" xmi:id="_FE0CIHcjEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.handledtoolitem.movestreamup" label="Move Stream up" iconURI="platform:/plugin/com.minres.scviewer.e4.application/icons/up_blue.png" command="_N_sOkHXHEeWwZ-9vrAR2UQ">
<children xsi:type="menu:HandledToolItem" xmi:id="_FE0CIHcjEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.handledtoolitem.movestreamup" label="Move Stream up" iconURI="platform:/plugin/com.minres.scviewer.e4.application/icons/up_blue.png" tooltip="Move stream/waveform in list up" command="_N_sOkHXHEeWwZ-9vrAR2UQ">
<parameters xmi:id="_S_M5YHcjEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.parameter.8" name="com.minres.scviewer.e4.application.command.movewaveformupCommand.parameter.dir" value="up"/>
</children>
<children xsi:type="menu:HandledToolItem" xmi:id="_FrGmEHcjEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.handledtoolitem.movestreamdown" label="Move Stream down" iconURI="platform:/plugin/com.minres.scviewer.e4.application/icons/down_blue.png" command="_N_sOkHXHEeWwZ-9vrAR2UQ">
<children xsi:type="menu:HandledToolItem" xmi:id="_FrGmEHcjEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.handledtoolitem.movestreamdown" label="Move Stream down" iconURI="platform:/plugin/com.minres.scviewer.e4.application/icons/down_blue.png" tooltip="Move stream/waveform in list down" command="_N_sOkHXHEeWwZ-9vrAR2UQ">
<parameters xmi:id="_VA_yAHcjEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.parameter.9" name="com.minres.scviewer.e4.application.command.movewaveformupCommand.parameter.dir" value="down"/>
</children>
<children xsi:type="menu:ToolBarSeparator" xmi:id="_srcD0HgwEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.toolbarseparator.3"/>
<children xsi:type="menu:HandledToolItem" xmi:id="_GKi7IHcjEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.handledtoolitem.previousevent" label="Previous Event" iconURI="platform:/plugin/com.minres.scviewer.e4.application/icons/reverse_blue.png" command="_79rx4HabEeWwZ-9vrAR2UQ">
<children xsi:type="menu:HandledToolItem" xmi:id="_GKi7IHcjEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.handledtoolitem.previousevent" label="Previous Event" iconURI="platform:/plugin/com.minres.scviewer.e4.application/icons/reverse_blue.png" tooltip="Navigate to previous event in stream/waveform" command="_79rx4HabEeWwZ-9vrAR2UQ">
<parameters xmi:id="_XS7YYHcjEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.parameter.10" name="com.minres.scviewer.e4.application.command.navigateEventCommand.parameter.dir" value="prev"/>
</children>
<children xsi:type="menu:HandledToolItem" xmi:id="_GjlGMHcjEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.handledtoolitem.nextevent" label="Next Event" iconURI="platform:/plugin/com.minres.scviewer.e4.application/icons/play_blue.png" command="_79rx4HabEeWwZ-9vrAR2UQ">
<children xsi:type="menu:HandledToolItem" xmi:id="_GjlGMHcjEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.handledtoolitem.nextevent" label="Next Event" iconURI="platform:/plugin/com.minres.scviewer.e4.application/icons/play_blue.png" tooltip="Navigate to next event in stream/waveform" command="_79rx4HabEeWwZ-9vrAR2UQ">
<parameters xmi:id="_ZzTqcHcjEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.parameter.11" name="com.minres.scviewer.e4.application.command.navigateEventCommand.parameter.dir" value="next"/>
</children>
<children xsi:type="menu:ToolBarSeparator" xmi:id="_tcxaIHgwEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.toolbarseparator.4"/>
<children xsi:type="menu:HandledToolItem" xmi:id="_HdKZkHcjEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.handledtoolitem.previoustransaction" label="Previous Transaction" iconURI="platform:/plugin/com.minres.scviewer.e4.application/icons/reverse_green.png" command="_Gn3lEHXKEeWwZ-9vrAR2UQ">
<children xsi:type="menu:HandledToolItem" xmi:id="_HdKZkHcjEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.handledtoolitem.previoustransaction" label="Previous Transaction" iconURI="platform:/plugin/com.minres.scviewer.e4.application/icons/reverse_green.png" tooltip="Navigate to previous transaction" command="_Gn3lEHXKEeWwZ-9vrAR2UQ">
<parameters xmi:id="_cuGAkHcjEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.parameter.12" name="com.minres.scviewer.e4.application.command.navigateTransCommand.parameter.dir" value="prev"/>
</children>
<children xsi:type="menu:HandledToolItem" xmi:id="_H7bp8HcjEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.handledtoolitem.nexttransaction" label="Next Transaction" iconURI="platform:/plugin/com.minres.scviewer.e4.application/icons/play_green.png" command="_Gn3lEHXKEeWwZ-9vrAR2UQ">
<children xsi:type="menu:ToolControl" xmi:id="_LtQhcIuKEeWid7xO48ZBXw" elementId="com.minres.scviewer.e4.application.toolcontrol.0" contributionURI="bundleclass://com.minres.scviewer.e4.application/com.minres.scviewer.e4.application.elements.RelationTypeToolControl"/>
<children xsi:type="menu:DirectToolItem" xmi:id="_Z7ZQkIuJEeWid7xO48ZBXw" elementId="com.minres.scviewer.e4.application.directtoolitem.nextprevinstream" toBeRendered="false" visible="false" label="Next/Prev in stream" enabled="false">
<menu xmi:id="_aPyMMIuJEeWid7xO48ZBXw" elementId="com.minres.scviewer.e4.application.menu.2">
<children xsi:type="menu:DynamicMenuContribution" xmi:id="_cnNWkIuJEeWid7xO48ZBXw" elementId="com.minres.scviewer.e4.application.dynamicmenucontribution.2" contributionURI="bundleclass://com.minres.scviewer.e4.application/com.minres.scviewer.e4.application.parts.NavigateContribution"/>
</menu>
</children>
<children xsi:type="menu:HandledToolItem" xmi:id="_H7bp8HcjEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.handledtoolitem.nexttransaction" label="Next Transaction" iconURI="platform:/plugin/com.minres.scviewer.e4.application/icons/play_green.png" tooltip="Navigate to next transaction" command="_Gn3lEHXKEeWwZ-9vrAR2UQ">
<parameters xmi:id="_fiO8IHcjEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.parameter.13" name="com.minres.scviewer.e4.application.command.navigateTransCommand.parameter.dir" value="next"/>
</children>
</children>
<children xsi:type="menu:ToolBar" xmi:id="_oQdMUHcqEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.toolbar.1">
<children xsi:type="menu:HandledToolItem" xmi:id="_5DrGQHf4EeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.handledtoolitem.zoomfit" label="Zoom out" iconURI="platform:/plugin/com.minres.scviewer.e4.application/icons/zoom.png" command="_693GoHcqEeWwZ-9vrAR2UQ">
<children xsi:type="menu:HandledToolItem" xmi:id="_5DrGQHf4EeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.handledtoolitem.zoomfit" label="Zoom out" iconURI="platform:/plugin/com.minres.scviewer.e4.application/icons/zoom.png" tooltip="Restore default zoom level" command="_693GoHcqEeWwZ-9vrAR2UQ">
<parameters xmi:id="_5DrGQXf4EeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.parameter.14" name="com.minres.scviewer.e4.application.command.zoomcommand.parameter.level" value="fit"/>
</children>
<children xsi:type="menu:ToolBarSeparator" xmi:id="_p1AvUHcqEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.toolbarseparator.1"/>
<children xsi:type="menu:HandledToolItem" xmi:id="_XMQPAHcrEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.handledtoolitem.zoomin" label="Zoom in" iconURI="platform:/plugin/com.minres.scviewer.e4.application/icons/zoom_in.png" command="_693GoHcqEeWwZ-9vrAR2UQ">
<children xsi:type="menu:HandledToolItem" xmi:id="_XMQPAHcrEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.handledtoolitem.zoomin" label="Zoom in" iconURI="platform:/plugin/com.minres.scviewer.e4.application/icons/zoom_in.png" tooltip="Zoom in by a factor of 3" command="_693GoHcqEeWwZ-9vrAR2UQ">
<parameters xmi:id="_fi5w4HcrEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.parameter.15" name="com.minres.scviewer.e4.application.command.zoomcommand.parameter.level" value="in"/>
</children>
<children xsi:type="menu:HandledToolItem" xmi:id="_XqTc8HcrEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.handledtoolitem.zoomout" label="Zoom out" iconURI="platform:/plugin/com.minres.scviewer.e4.application/icons/zoom_out.png" command="_693GoHcqEeWwZ-9vrAR2UQ">
<children xsi:type="menu:HandledToolItem" xmi:id="_XqTc8HcrEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.handledtoolitem.zoomout" label="Zoom out" iconURI="platform:/plugin/com.minres.scviewer.e4.application/icons/zoom_out.png" tooltip="Zoom out by a factor of 3" command="_693GoHcqEeWwZ-9vrAR2UQ">
<parameters xmi:id="_d7OBYHcrEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.parameter.14" name="com.minres.scviewer.e4.application.command.zoomcommand.parameter.level" value="out"/>
</children>
</children>
@ -138,6 +141,7 @@
<handlers xmi:id="_3ZZhsHXHEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.handler.selectallCommand" contributionURI="bundleclass://com.minres.scviewer.e4.application/com.minres.scviewer.e4.application.handlers.SelectAllHandler" command="_bV-TMHXHEeWwZ-9vrAR2UQ"/>
<handlers xmi:id="_CTcpEIl_EeWxJ_wPkM6yGQ" elementId="com.minres.scviewer.e4.application.handler.preferences" contributionURI="bundleclass://com.opcoach.e4.preferences/com.opcoach.e4.preferences.handlers.E4PreferencesHandler" command="_AxH6sIl_EeWxJ_wPkM6yGQ"/>
<handlers xmi:id="_UUnX8IoNEeWxJ_wPkM6yGQ" elementId="com.minres.scviewer.e4.application.handler.set_them" contributionURI="bundleclass://com.minres.scviewer.e4.application/com.minres.scviewer.e4.application.handlers.ThemeSetHandler" command="_KlGlsIoNEeWxJ_wPkM6yGQ"/>
<handlers xmi:id="_V4EscIuGEeWid7xO48ZBXw" elementId="com.minres.scviewer.e4.application.handler.setreleationtype" contributionURI="bundleclass://com.minres.scviewer.e4.application/com.minres.scviewer.e4.application.handlers.SetRelationTypeHandler" command="_E9lUgIt2EeWid7xO48ZBXw"/>
<bindingTables xmi:id="_95PfvnNmEeWBq8z1Dv39LA" bindingContext="_95PfuXNmEeWBq8z1Dv39LA">
<bindings xmi:id="_95Pfv3NmEeWBq8z1Dv39LA" keySequence="M1+Q" command="_95PfvHNmEeWBq8z1Dv39LA"/>
<bindings xmi:id="_95PfwnNmEeWBq8z1Dv39LA" keySequence="M1+O" command="_95PfwHNmEeWBq8z1Dv39LA"/>
@ -156,15 +160,15 @@
<handlers xmi:id="_2Ai4YHXHEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.handler.movewaveformupCommand" contributionURI="bundleclass://com.minres.scviewer.e4.application/com.minres.scviewer.e4.application.handlers.MoveWaveformHandler" command="_N_sOkHXHEeWwZ-9vrAR2UQ"/>
<handlers xmi:id="_Du1NAHcrEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.handler.zoomCommand" contributionURI="bundleclass://com.minres.scviewer.e4.application/com.minres.scviewer.e4.application.handlers.ZoomHandler" command="_693GoHcqEeWwZ-9vrAR2UQ"/>
<menus xsi:type="menu:PopupMenu" xmi:id="_TwzrsHWSEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.popupmenu.namecontext" label="Name Menu">
<children xsi:type="menu:HandledMenuItem" xmi:id="_Vco7YHWSEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.handledmenuitem.moveup" label="Move up" iconURI="platform:/plugin/com.minres.scviewer.e4.application/icons/up_blue.png" command="_N_sOkHXHEeWwZ-9vrAR2UQ">
<children xsi:type="menu:HandledMenuItem" xmi:id="_Vco7YHWSEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.handledmenuitem.moveup" label="Move up" iconURI="platform:/plugin/com.minres.scviewer.e4.application/icons/up_blue.png" tooltip="Move stream/waveform in list up" command="_N_sOkHXHEeWwZ-9vrAR2UQ">
<visibleWhen xsi:type="ui:CoreExpression" xmi:id="_elFdcHr_EeWVM_sKoXvptg" coreExpressionId="com.minres.scviewer.e4.application.oneWaveSeleted"/>
<parameters xmi:id="_qNG5kHZWEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.parameter.0" name="com.minres.scviewer.e4.application.command.movewaveformupCommand.parameter.dir" value="up"/>
</children>
<children xsi:type="menu:HandledMenuItem" xmi:id="_UlTbMHXIEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.handledmenuitem.movedown" label="Move down" iconURI="platform:/plugin/com.minres.scviewer.e4.application/icons/down_blue.png" command="_N_sOkHXHEeWwZ-9vrAR2UQ">
<children xsi:type="menu:HandledMenuItem" xmi:id="_UlTbMHXIEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.handledmenuitem.movedown" label="Move down" iconURI="platform:/plugin/com.minres.scviewer.e4.application/icons/down_blue.png" tooltip="Move stream/waveform in list down" command="_N_sOkHXHEeWwZ-9vrAR2UQ">
<visibleWhen xsi:type="ui:CoreExpression" xmi:id="_eBN0AHsCEeWVM_sKoXvptg" coreExpressionId="com.minres.scviewer.e4.application.oneWaveSeleted"/>
<parameters xmi:id="_soO4MHZWEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.parameter.1" name="com.minres.scviewer.e4.application.command.movewaveformupCommand.parameter.dir" value="down"/>
</children>
<children xsi:type="menu:HandledMenuItem" xmi:id="_Vj4jUHXIEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.handledmenuitem.remove" label="Remove" iconURI="platform:/plugin/com.minres.scviewer.e4.application/icons/cross.png" command="_WUZ2wHXHEeWwZ-9vrAR2UQ">
<children xsi:type="menu:HandledMenuItem" xmi:id="_Vj4jUHXIEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.handledmenuitem.remove" label="Remove" iconURI="platform:/plugin/com.minres.scviewer.e4.application/icons/cross.png" tooltip="Remove stream/waveform from list" command="_WUZ2wHXHEeWwZ-9vrAR2UQ">
<visibleWhen xsi:type="ui:CoreExpression" xmi:id="_f6MH0HsCEeWVM_sKoXvptg" coreExpressionId="com.minres.scviewer.e4.application.oneWaveSeleted"/>
</children>
</menus>
@ -199,7 +203,7 @@
</commands>
<commands xmi:id="_WUZ2wHXHEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.command.deletewaveformCommand" commandName="deleteWaveformCommand"/>
<commands xmi:id="_bV-TMHXHEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.command.selectallCommand" commandName="selectAllCommand"/>
<commands xmi:id="_Gn3lEHXKEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.command.navigateTransCommand" commandName="navigateTransCommand">
<commands xmi:id="_Gn3lEHXKEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.command.navigateTransCommand" commandName="navigateTransCommand" description="Navigate to related transaction">
<parameters xmi:id="_howw0HXQEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.command.navigateTransCommand.parameter.dir" name="direction" optional="false"/>
</commands>
<commands xmi:id="_79rx4HabEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.command.navigateEventCommand" commandName="navigateEventCommand">
@ -214,7 +218,10 @@
</commands>
<commands xmi:id="_AxH6sIl_EeWxJ_wPkM6yGQ" elementId="org.eclipse.ui.window.preferences" commandName="Preferences"/>
<commands xmi:id="_KlGlsIoNEeWxJ_wPkM6yGQ" elementId="com.minres.scviewer.e4.application.command.set_them" commandName="Set Theme">
<parameters xmi:id="_O8Z9IIoNEeWxJ_wPkM6yGQ" elementId="com.minres.scviewer.e4.application.command.theme.parameter.id" name="themeId"/>
<parameters xmi:id="_O8Z9IIoNEeWxJ_wPkM6yGQ" elementId="com.minres.scviewer.e4.application.command.theme.parameter.id" name="themeId" optional="false"/>
</commands>
<commands xmi:id="_E9lUgIt2EeWid7xO48ZBXw" elementId="com.minres.scviewer.e4.application.command.setrelationtype" commandName="SetRelationType">
<parameters xmi:id="_xnW7IIt_EeWid7xO48ZBXw" elementId="com.minres.scviewer.e4.application.commandparameter.relationName" name="relationName" optional="false"/>
</commands>
<addons xmi:id="_95PfsnNmEeWBq8z1Dv39LA" elementId="org.eclipse.e4.core.commands.service" contributionURI="bundleclass://org.eclipse.e4.core.commands/org.eclipse.e4.core.commands.CommandServiceAddon"/>
<addons xmi:id="_95Pfs3NmEeWBq8z1Dv39LA" elementId="org.eclipse.e4.ui.contexts.service" contributionURI="bundleclass://org.eclipse.e4.ui.services/org.eclipse.e4.ui.services.ContextServiceAddon"/>

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 212 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 37 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 118 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 537 B

View File

@ -0,0 +1,76 @@
/*******************************************************************************
* Copyright (c) 2015 MINRES Technologies GmbH and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* MINRES Technologies GmbH - initial API and implementation
*******************************************************************************/
package com.minres.scviewer.e4.application.elements;
import java.util.List;
import javax.inject.Inject;
import org.eclipse.e4.ui.di.AboutToShow;
import org.eclipse.e4.ui.model.application.MApplication;
import org.eclipse.e4.ui.model.application.commands.MCommand;
import org.eclipse.e4.ui.model.application.commands.MCommandParameter;
import org.eclipse.e4.ui.model.application.commands.MParameter;
import org.eclipse.e4.ui.model.application.ui.basic.MPart;
import org.eclipse.e4.ui.model.application.ui.menu.MHandledMenuItem;
import org.eclipse.e4.ui.model.application.ui.menu.MMenuElement;
import org.eclipse.e4.ui.workbench.modeling.EModelService;
import org.eclipse.e4.ui.workbench.modeling.EPartService;
import com.minres.scviewer.database.RelationType;
import com.minres.scviewer.e4.application.parts.WaveformViewerPart;
public class NavigateContribution {
@Inject EPartService partService;
@AboutToShow
public void aboutToShow(List<MMenuElement> items, MApplication application, EModelService modelService) {
// modelService.getActivePerspective(window)
// modelService.findElements(application,"myID",MPart.class, EModelService.IN_ACTIVE_PERSPECTIVE);
// MDirectMenuItem dynamicItem = MMenuFactory.INSTANCE.createDirectMenuItem();
MPart part = partService.getActivePart();
if(part.getObject()instanceof WaveformViewerPart){
WaveformViewerPart waveformViewerPart = (WaveformViewerPart) part.getObject();
RelationType relationTypeFilter = waveformViewerPart.getRelationTypeFilter();
MCommand command = modelService.findElements(application,
"com.minres.scviewer.e4.application.command.setrelationtype", MCommand.class, null).get(0);
MCommandParameter commandParameter = command.getParameters().get(0);
for(RelationType relationType:waveformViewerPart.getAllRelationTypes()){
// MDirectMenuItem dynamicItem = modelService.createModelElement(MDirectMenuItem.class);
//
// dynamicItem.setLabel(relationType.getName());
// dynamicItem.setIconURI(relationTypeFilter.equals(relationType)?
// "platform:/plugin/com.minres.scviewer.e4.application/icons/tick.png":
// "platform:/plugin/com.minres.scviewer.e4.application/icons/empty.png");
// dynamicItem.setContributorURI("platform:/plugin/com.minres.scviewer.e4.application");
// dynamicItem.setContributionURI("bundleclass://com.minres.scviewer.e4.application/com.minres.scviewer.e4.application.parts.DirectMenuItem?blah=1");
// items.add(dynamicItem);
MParameter parameter=modelService.createModelElement(MParameter.class);
parameter.setName(commandParameter.getElementId());
parameter.setValue(relationType.getName());
parameter.setContributorURI("platform:/plugin/com.minres.scviewer.e4.application");
MHandledMenuItem handledMenuItem= modelService.createModelElement(MHandledMenuItem.class);
handledMenuItem.setLabel(relationType.getName());
if(relationTypeFilter.equals(relationType)){
handledMenuItem.setEnabled(false);
handledMenuItem.setIconURI("platform:/plugin/com.minres.scviewer.e4.application/icons/tick.png");
}else
handledMenuItem.setIconURI("platform:/plugin/com.minres.scviewer.e4.application/icons/empty.png");
handledMenuItem.setContributorURI("platform:/plugin/com.minres.scviewer.e4.application");
handledMenuItem.setCommand(command);
handledMenuItem.getParameters().add(parameter);
items.add(handledMenuItem);
}
}
}
}

View File

@ -0,0 +1,109 @@
/*******************************************************************************
* Copyright (c) 2015 MINRES Technologies GmbH and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* MINRES Technologies GmbH - initial API and implementation
*******************************************************************************/
package com.minres.scviewer.e4.application.elements;
import javax.annotation.PostConstruct;
import javax.inject.Inject;
import javax.inject.Named;
import org.eclipse.e4.core.di.annotations.Optional;
import org.eclipse.e4.ui.model.application.ui.basic.MPart;
import org.eclipse.e4.ui.services.IServiceConstants;
import org.eclipse.e4.ui.workbench.modeling.EPartService;
import org.eclipse.jface.viewers.ArrayContentProvider;
import org.eclipse.jface.viewers.ComboViewer;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.ISelectionChangedListener;
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.widgets.Combo;
import org.eclipse.swt.widgets.Composite;
import com.minres.scviewer.database.ITx;
import com.minres.scviewer.database.RelationType;
import com.minres.scviewer.e4.application.parts.PartListener;
import com.minres.scviewer.e4.application.parts.WaveformViewerPart;
public class RelationTypeToolControl extends PartListener implements ISelectionChangedListener {
EPartService partService;
ComboViewer comboViewer;
WaveformViewerPart waveformViewerPart;
RelationType dummy = RelationType.create("------------");
@Inject
public RelationTypeToolControl(EPartService partService) {
this.partService=partService;
partService.addPartListener(this);
}
@PostConstruct
public void createGui(Composite parent) {
comboViewer = new ComboViewer(parent, SWT.NONE);
Combo comboBox = comboViewer.getCombo();
comboBox.setBounds(0, 0, 26, 22);
comboBox.setText("Select");
comboViewer.setContentProvider(new ArrayContentProvider());
comboViewer.setInput(new RelationType[] {dummy});
comboViewer.setSelection(new StructuredSelection(dummy));
comboViewer.addSelectionChangedListener(this);
}
@Override
public void partActivated(MPart part) {
if(part.getObject() instanceof WaveformViewerPart){
waveformViewerPart=(WaveformViewerPart) part.getObject();
checkSelection(waveformViewerPart.getSelection());
} else {
waveformViewerPart=null;
checkSelection(new StructuredSelection());
}
}
@Inject
public void setSelection(@Named(IServiceConstants.ACTIVE_SELECTION) @Optional IStructuredSelection selection, EPartService partService){
MPart part = partService.getActivePart();
if(part!=null && part.getObject() instanceof WaveformViewerPart && comboViewer!=null){
checkSelection(selection);
}
}
protected void checkSelection(ISelection selection) {
if( selection instanceof IStructuredSelection) {
Object object= ((IStructuredSelection)selection).getFirstElement();
if(object instanceof ITx && waveformViewerPart!=null){
comboViewer.getCombo().setEnabled(true);
comboViewer.setInput(waveformViewerPart.getSelectionRelationTypes());//getAllRelationTypes());
comboViewer.setSelection(new StructuredSelection(waveformViewerPart.getRelationTypeFilter()));
return;
}
}
comboViewer.getCombo().setEnabled(false);
}
@Override
public void selectionChanged(SelectionChangedEvent event) {
MPart part = partService.getActivePart();
if(part!=null && part.getObject() instanceof WaveformViewerPart && !event.getSelection().isEmpty()){
WaveformViewerPart waveformViewerPart=(WaveformViewerPart) part.getObject();
if(event.getSelection() instanceof IStructuredSelection){
waveformViewerPart.setNavigationRelationType(
(RelationType)((IStructuredSelection)event.getSelection()).getFirstElement());
}
}
}
}

View File

@ -12,11 +12,14 @@ package com.minres.scviewer.e4.application.handlers;
import org.eclipse.e4.core.di.annotations.Execute;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Shell;
import com.minres.scviewer.e4.application.parts.AboutDialog;
public class AboutHandler {
@Execute
public void execute(Shell shell) {
MessageDialog.openInformation(shell, "About", "Eclipse 4 Application example.");
AboutDialog.open(shell, SWT.NONE);
}
}

View File

@ -13,6 +13,7 @@ package com.minres.scviewer.e4.application.handlers;
import java.util.List;
import javax.inject.Inject;
import javax.inject.Named;
import org.eclipse.e4.core.di.annotations.CanExecute;
@ -24,44 +25,46 @@ import org.eclipse.e4.ui.workbench.modeling.EPartService;
import org.eclipse.jface.viewers.IStructuredSelection;
import com.minres.scviewer.database.IWaveform;
import com.minres.scviewer.e4.application.parts.WaveformListPart;
import com.minres.scviewer.e4.application.parts.DesignBrowser;
public class AddWaveformHandler {
public final static String PARAM_WHERE_ID="com.minres.scviewer.e4.application.command.addwaveform.where";
public final static String PARAM_ALL_ID="com.minres.scviewer.e4.application.command.addwaveform.all";
@Inject @Optional DesignBrowser designBrowser;
@CanExecute
public boolean canExecute(@Named(PARAM_WHERE_ID) String where, @Named(PARAM_ALL_ID) String all,
EPartService partService,
@Named(IServiceConstants.ACTIVE_SELECTION) @Optional IStructuredSelection selection) {
WaveformListPart listPart = getListPart( partService);
if(listPart==null || listPart.getActiveWaveformViewerPart()==null) return false;
if(designBrowser==null) designBrowser = getListPart( partService);
if(designBrowser==null || designBrowser.getActiveWaveformViewerPart()==null) return false;
Boolean before = "before".equalsIgnoreCase(where);
if("true".equalsIgnoreCase(all))
return listPart.getFilteredChildren().length>0 &&
(!before || ((IStructuredSelection)listPart.getActiveWaveformViewerPart().getSelection()).size()>0);
return designBrowser.getFilteredChildren().length>0 &&
(!before || ((IStructuredSelection)designBrowser.getActiveWaveformViewerPart().getSelection()).size()>0);
else
return selection.size()>0 &&
(!before || ((IStructuredSelection)listPart.getActiveWaveformViewerPart().getSelection()).size()>0);
(!before || ((IStructuredSelection)designBrowser.getActiveWaveformViewerPart().getSelection()).size()>0);
}
@Execute
public void execute(@Named(PARAM_WHERE_ID) String where, @Named(PARAM_ALL_ID) String all,
EPartService partService,
@Named(IServiceConstants.ACTIVE_SELECTION) @Optional IStructuredSelection selection) {
WaveformListPart listPart = getListPart( partService);
if(listPart!=null && selection.size()>0){
if(designBrowser==null) designBrowser = getListPart( partService);
if(designBrowser!=null && selection.size()>0){
List<?> sel=selection.toList();
listPart.getActiveWaveformViewerPart().addStreamsToList(sel.toArray(new IWaveform<?>[]{}),
designBrowser.getActiveWaveformViewerPart().addStreamsToList(sel.toArray(new IWaveform<?>[]{}),
"before".equalsIgnoreCase(where));
}
}
protected WaveformListPart getListPart(EPartService partService){
protected DesignBrowser getListPart(EPartService partService){
MPart part = partService.getActivePart();
if(part.getObject() instanceof WaveformListPart)
return (WaveformListPart) part.getObject();
if(part.getObject() instanceof DesignBrowser)
return (DesignBrowser) part.getObject();
else
return null;
}

View File

@ -0,0 +1,35 @@
/*******************************************************************************
* Copyright (c) 2015 MINRES Technologies GmbH and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* MINRES Technologies GmbH - initial API and implementation
*******************************************************************************/
package com.minres.scviewer.e4.application.handlers;
import javax.inject.Named;
import org.eclipse.e4.core.di.annotations.Execute;
import org.eclipse.e4.ui.model.application.ui.basic.MPart;
import org.eclipse.e4.ui.workbench.modeling.EPartService;
import com.minres.scviewer.e4.application.parts.WaveformViewerPart;
public class SetRelationTypeHandler {
final static String PARAMTER_ID="com.minres.scviewer.e4.application.commandparameter.relationName";
@Execute
public void execute(@Named(PARAMTER_ID) String relationName, EPartService partService) {
MPart part = partService.getActivePart();
Object obj = part.getObject();
if(obj instanceof WaveformViewerPart){
WaveformViewerPart waveformViewerPart = (WaveformViewerPart) obj;
waveformViewerPart.setNavigationRelationType(relationName);
}
}
}

View File

@ -0,0 +1,183 @@
/*******************************************************************************
* Copyright (c) 2015 MINRES Technologies GmbH and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* MINRES Technologies GmbH - initial API and implementation
*******************************************************************************/
package com.minres.scviewer.e4.application.parts;
import java.awt.Desktop;
import java.io.IOException;
import java.net.URISyntaxException;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.StyleRange;
import org.eclipse.swt.custom.StyledText;
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.graphics.Color;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Canvas;
import org.eclipse.swt.widgets.Dialog;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Link;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.wb.swt.ResourceManager;
import org.eclipse.wb.swt.SWTResourceManager;
public class AboutDialog extends Dialog {
protected int result;
protected Shell shell;
private Color white;
protected StyledText styledText;
/*
Eclipse IDE for Java Developers
Version: Mars.1 Release (4.5.1)
Build id: 20150924-1200
(c) Copyright Eclipse contributors and others 2000, 2015. All rights reserved. Eclipse and the Eclipse logo are trademarks of the Eclipse Foundation, Inc., https://www.eclipse.org/. The Eclipse logo cannot be altered without Eclipse's permission. Eclipse logos are provided for use under the Eclipse logo and trademark guidelines, https://www.eclipse.org/logotm/. Oracle and Java are trademarks or registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners.
*/
private String productTitle=
"\nSCViewer - a SystemC waveform viewer\n\nVersion: 1.0\n";
private String copyrightText="\nCopyright (c) 2015 MINRES Technologies GmbH and others.\n"+
"\n"+
"All rights reserved. MINRES and the MINRES logo are trademarks of MINRES Technologies GmbH, http://www.minres.com/ . "+
"This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 "+
"which accompanies this distribution, and is available at http://www.eclipse.org/legal/epl-v10.html\n";
/**
* Create the dialog.
* @param parent
* @param style
*/
public AboutDialog(Shell parent, int style) {
super(parent, style);
setText("SWT Dialog");
white=SWTResourceManager.getColor(SWT.COLOR_WHITE);
}
/**
* Open the dialog.
* @return the result
*/
public int open() {
createContents();
shell.open();
shell.layout();
Display display = getParent().getDisplay();
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
return result;
}
/**
* Create contents of the dialog.
*/
private void createContents() {
shell = new Shell(getParent(), getStyle());
shell.setSize(600, 300);
shell.setText(getText());
shell.setLayout(new GridLayout(2, false));
final Image scviewerLogo=ResourceManager.getPluginImage("com.minres.scviewer.e4.application", "icons/SCViewer_logo.png");
final Image minresLogo=ResourceManager.getPluginImage("com.minres.scviewer.e4.application", "icons/Minres_logo.png");
Canvas canvas = new Canvas(shell,SWT.NO_REDRAW_RESIZE);
GridData gd_canvas = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
gd_canvas.widthHint = 200;
gd_canvas.heightHint =250;
canvas.setLayoutData(gd_canvas);
canvas.addPaintListener(new PaintListener() {
public void paintControl(PaintEvent e) {
e.gc.setBackground(white);
e.gc.fillRectangle(e.x, e.y, e.width, e.height);
e.gc.drawImage(scviewerLogo,4,0);
e.gc.drawImage(minresLogo,0,200);
}
});
styledText = new StyledText(shell, SWT.BORDER);
styledText.setEditable(false);
GridData gd_styledText = new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1);
styledText.setLayoutData(gd_styledText);
styledText.setText(productTitle+copyrightText);
styledText.setBackground(white);
styledText.setWordWrap(true);
styledText.setLeftMargin(5);
StyleRange styleRange = new StyleRange();
styleRange.start = 0;
styleRange.length = productTitle.length();
styleRange.fontStyle = SWT.BOLD;
styledText.setStyleRange(styleRange);
///^(https?:\/\/)?([\da-z\.-]+)\.([a-z\.]{2,6})([\/\w \.-]*)*\/?$/
Pattern pattern = Pattern.compile("https?:\\/\\/([\\da-z\\.-]+)\\.([a-z\\.]{2,6})([\\/\\w\\.-]*)*\\/?");
// in case you would like to ignore case sensitivity,
// you could use this statement:
// Pattern pattern = Pattern.compile("\\s+", Pattern.CASE_INSENSITIVE);
Matcher matcher = pattern.matcher(productTitle+copyrightText);
// check all occurance
while (matcher.find()) {
styleRange = new StyleRange();
styleRange.underline=true;
styleRange.underlineStyle = SWT.UNDERLINE_LINK;
styleRange.data = matcher.group();
styleRange.start = matcher.start();
styleRange.length = matcher.end()-matcher.start();
styledText.setStyleRange(styleRange);
}
styledText.addListener(SWT.MouseDown, new Listener() {
@Override
public void handleEvent(Event event) {
// It is up to the application to determine when and how a link should be activated.
// links are activated on mouse down when the control key is held down
// if ((event.stateMask & SWT.MOD1) != 0) {
try {
int offset = styledText.getOffsetAtLocation(new Point (event.x, event.y));
StyleRange style = styledText.getStyleRangeAtOffset(offset);
if (style != null && style.underline && style.underlineStyle == SWT.UNDERLINE_LINK) {
Desktop.getDesktop().browse(new java.net.URI(style.data.toString()));
}
} catch (IOException | URISyntaxException | IllegalArgumentException e) {}
// }
}
});
styleRange.start = 0;
new Label(shell, SWT.NONE);
Button okButton = new Button(shell, SWT.NONE);
okButton.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
okButton.setBounds(0, 0, 94, 28);
okButton.setText("Close");
okButton.setFocus();
okButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
if(!shell.isDisposed()) shell.dispose();
}
});
}
public static boolean open(Shell parent, int style) {
AboutDialog dialog = new AboutDialog(parent, style | SWT.SHEET);
return dialog.open() == 0;
}
}

View File

@ -12,39 +12,97 @@ package com.minres.scviewer.e4.application.parts;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.lang.annotation.Annotation;
import java.util.Arrays;
import java.util.List;
import javax.annotation.PostConstruct;
import javax.inject.Inject;
import javax.inject.Named;
import org.eclipse.e4.core.contexts.ContextInjectionFactory;
import org.eclipse.e4.core.contexts.IEclipseContext;
import org.eclipse.e4.core.di.annotations.CanExecute;
import org.eclipse.e4.core.di.annotations.Execute;
import org.eclipse.e4.core.di.annotations.Optional;
import org.eclipse.e4.core.services.events.IEventBroker;
import org.eclipse.e4.ui.di.Focus;
import org.eclipse.e4.ui.di.UIEventTopic;
import org.eclipse.e4.ui.model.application.ui.basic.MPart;
import org.eclipse.e4.ui.services.EMenuService;
import org.eclipse.e4.ui.services.IServiceConstants;
import org.eclipse.e4.ui.workbench.modeling.EPartService;
import org.eclipse.e4.ui.workbench.modeling.ESelectionService;
import org.eclipse.jface.viewers.DoubleClickEvent;
import org.eclipse.jface.viewers.IDoubleClickListener;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.IStructuredContentProvider;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jface.viewers.ViewerFilter;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.SashForm;
import org.eclipse.swt.events.ControlAdapter;
import org.eclipse.swt.events.ControlEvent;
import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.events.PaintEvent;
import org.eclipse.swt.events.PaintListener;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Text;
import org.eclipse.swt.widgets.ToolBar;
import org.eclipse.swt.widgets.ToolItem;
import org.eclipse.wb.swt.ResourceManager;
import org.eclipse.wb.swt.SWTResourceManager;
import com.minres.scviewer.database.IHierNode;
import com.minres.scviewer.database.ITx;
import com.minres.scviewer.database.IWaveform;
import com.minres.scviewer.database.IWaveformDb;
import com.minres.scviewer.e4.application.handlers.AddWaveformHandler;
import com.minres.scviewer.e4.application.provider.TxDbContentProvider;
import com.minres.scviewer.e4.application.provider.TxDbLabelProvider;
public class DesignBrowser implements ISelectionChangedListener {
public class DesignBrowser {
private static final String POPUP_ID="com.minres.scviewer.e4.application.parts.DesignBrowser.popupmenu";
@Inject IEventBroker eventBroker;
@Inject ESelectionService selectionService;
@Inject EMenuService menuService;
@Inject IEclipseContext eclipseCtx;
private SashForm sashForm;
Composite top;
private Composite bottom;
private TreeViewer treeViewer;
private Text nameFilter;
private PropertyChangeListener l = new PropertyChangeListener() {
private TableViewer txTableViewer;
ToolItem appendItem, insertItem, insertAllItem, appendAllItem;
WaveformAttributeFilter attributeFilter;
int thisSelectionCount=0, otherSelectionCount=0;
private PropertyChangeListener treeViewerPCL = new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent evt) {
if("CHILDS".equals(evt.getPropertyName())){
@ -58,46 +116,327 @@ public class DesignBrowser implements ISelectionChangedListener {
}
};
private WaveformViewerPart waveformViewerPart;
protected PaintListener sashPaintListener=new PaintListener() {
@Override
public void paintControl(PaintEvent e) {
int size=Math.min(e.width, e.height)-1;
e.gc.setForeground(SWTResourceManager.getColor(SWT.COLOR_DARK_GRAY));
e.gc.setFillRule(SWT.FILL_EVEN_ODD);
if(e.width>e.height)
e.gc.drawArc(e.x+(e.width-size)/2, e.y, size, size, 0, 360);
else
e.gc.drawArc(e.x, e.y+(e.height-size)/2, size, size, 0, 360);
}
};
@PostConstruct
public void createComposite(Composite parent) {
sashForm = new SashForm(parent, SWT.BORDER | SWT.SMOOTH | SWT.VERTICAL);
top = new Composite(sashForm, SWT.NONE);
createTreeViewerComposite(top);
bottom = new Composite(sashForm, SWT.NONE);
createTableComposite(bottom);
sashForm.setWeights(new int[] {100, 100});
sashForm.SASH_WIDTH=5;
top.addControlListener(new ControlAdapter() {
public void controlResized(ControlEvent e) {
sashForm.getChildren()[2].addPaintListener(sashPaintListener);
top.removeControlListener(this);
}
});
}
public void createTreeViewerComposite(Composite parent) {
parent.setLayout(new GridLayout(1, false));
treeViewer = new TreeViewer(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
treeViewer.addSelectionChangedListener(this);
treeViewer.getTree().setLayoutData(new GridData(GridData.FILL_BOTH));
treeViewer.setContentProvider(new TxDbContentProvider());
treeViewer.setLabelProvider(new TxDbLabelProvider());
treeViewer.setUseHashlookup(true);
treeViewer.setAutoExpandLevel(2);
treeViewer.addSelectionChangedListener(new ISelectionChangedListener() {
@Override
public void selectionChanged(SelectionChangedEvent event) {
ISelection selection=event.getSelection();
if( selection instanceof IStructuredSelection) {
Object object= ((IStructuredSelection)selection).getFirstElement();
if(object instanceof IHierNode&& ((IHierNode)object).getChildNodes().size()!=0){
txTableViewer.setInput(object);
updateButtons();
}
}
}
});
}
public void createTableComposite(Composite parent) {
parent.setLayout(new GridLayout(1, false));
nameFilter = new Text(parent, SWT.BORDER);
nameFilter.setMessage("Enter text to filter waveforms");
nameFilter.addModifyListener(new ModifyListener() {
@Override
public void modifyText(ModifyEvent e) {
attributeFilter.setSearchText(((Text) e.widget).getText());
updateButtons();
txTableViewer.refresh();
}
});
nameFilter.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
attributeFilter = new WaveformAttributeFilter();
txTableViewer = new TableViewer(parent);
txTableViewer.setContentProvider(new TxDbContentProvider(true));
txTableViewer.setLabelProvider(new TxDbLabelProvider());
txTableViewer.getTable().setLayoutData(new GridData(GridData.FILL_BOTH));
txTableViewer.addFilter(attributeFilter);
txTableViewer.addDoubleClickListener(new IDoubleClickListener() {
@Override
public void doubleClick(DoubleClickEvent event) {
AddWaveformHandler myHandler = new AddWaveformHandler();
Object result = runCommand(myHandler, CanExecute.class, "after", false);
if(result!=null && (Boolean)result)
ContextInjectionFactory.invoke(myHandler, Execute.class, eclipseCtx);
}
});
txTableViewer.addSelectionChangedListener(new ISelectionChangedListener() {
@Override
public void selectionChanged(SelectionChangedEvent event) {
selectionService.setSelection(event.getSelection());
updateButtons();
}
});
menuService.registerContextMenu(txTableViewer.getControl(), POPUP_ID);
ToolBar toolBar = new ToolBar(parent, SWT.FLAT | SWT.RIGHT);
toolBar.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1));
toolBar.setBounds(0, 0, 87, 20);
appendItem = new ToolItem(toolBar, SWT.NONE);
appendItem.setToolTipText("Append after");
appendItem.setImage(ResourceManager.getPluginImage("com.minres.scviewer.e4.application", "icons/append_wave.png"));
appendItem.setEnabled(false);
appendItem.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
AddWaveformHandler myHandler = new AddWaveformHandler();
Object result = runCommand(myHandler, CanExecute.class, "after", false);
if(result!=null && (Boolean)result)
ContextInjectionFactory.invoke(myHandler, Execute.class, eclipseCtx);
}
});
insertItem = new ToolItem(toolBar, SWT.NONE);
insertItem.setToolTipText("Insert before");
insertItem.setImage(ResourceManager.getPluginImage("com.minres.scviewer.e4.application", "icons/insert_wave.png"));
insertItem.setEnabled(false);
insertItem.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
AddWaveformHandler myHandler = new AddWaveformHandler();
Object result = runCommand(myHandler, CanExecute.class, "before", false);
if(result!=null && (Boolean)result)
ContextInjectionFactory.invoke(myHandler, Execute.class, eclipseCtx);
}
});
new ToolItem(toolBar, SWT.SEPARATOR);
appendAllItem = new ToolItem(toolBar, SWT.NONE);
appendAllItem.setToolTipText("Append all after");
appendAllItem.setImage(ResourceManager.getPluginImage("com.minres.scviewer.e4.application", "icons/append_all_waves.png"));
appendAllItem.setEnabled(false);
new ToolItem(toolBar, SWT.SEPARATOR);
appendAllItem.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
Object[] all = getFilteredChildren(txTableViewer);
if(all.length>0){
Object oldSel=selectionService.getSelection();
selectionService.setSelection(new StructuredSelection(all));
AddWaveformHandler myHandler = new AddWaveformHandler();
Object result = runCommand(myHandler, CanExecute.class, "after", false);
if(result!=null && (Boolean)result)
ContextInjectionFactory.invoke(myHandler, Execute.class, eclipseCtx);
selectionService.setSelection(oldSel);
}
}
});
insertAllItem = new ToolItem(toolBar, SWT.NONE);
insertAllItem.setToolTipText("Insert all before");
insertAllItem.setImage(ResourceManager.getPluginImage("com.minres.scviewer.e4.application", "icons/insert_all_waves.png"));
insertAllItem.setEnabled(false);
insertAllItem.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
Object[] all = getFilteredChildren(txTableViewer);
if(all.length>0){
Object oldSel=selectionService.getSelection();
selectionService.setSelection(new StructuredSelection(all));
AddWaveformHandler myHandler = new AddWaveformHandler();
Object result = runCommand(myHandler, CanExecute.class, "before", false);
if(result!=null && (Boolean)result)
ContextInjectionFactory.invoke(myHandler, Execute.class, eclipseCtx);
selectionService.setSelection(oldSel);
}
}
});
}
@Focus
public void setFocus() {
treeViewer.getTree().setFocus();
selectionService.setSelection(treeViewer.getSelection());
}
@Override
public void selectionChanged(SelectionChangedEvent event) {
selectionService.setSelection(event.getSelection());
txTableViewer.getTable().setFocus();
IStructuredSelection selection = (IStructuredSelection)txTableViewer.getSelection();
if(selection.size()==0){
appendItem.setEnabled(false);
}
selectionService.setSelection(selection);
thisSelectionCount=selection.toList().size();
updateButtons();
}
@SuppressWarnings("unchecked")
@Inject @Optional
public void getStatusEvent(@UIEventTopic(WaveformViewerPart.ACTIVE_WAVEFORMVIEW) WaveformViewerPart waveformViewerPart) {
if(this.waveformViewerPart!=null)
this.waveformViewerPart.storeDesignBrowerState(new DBState());
this.waveformViewerPart=waveformViewerPart;
IWaveformDb database = waveformViewerPart.getDatabase();
Object input = treeViewer.getInput();
if(input!=null && input instanceof List<?>)
((List<IWaveformDb>)input).get(0).removePropertyChangeListener(l);
if(input!=null && input instanceof List<?>){
IWaveformDb db = ((List<IWaveformDb>)input).get(0);
if(db==database) return; // do nothing if old and new daabase is the same
((List<IWaveformDb>)input).get(0).removePropertyChangeListener(treeViewerPCL);
}
treeViewer.setInput(database.isLoaded()?Arrays.asList(new IWaveformDb[]{database}):null);
Object state=this.waveformViewerPart.retrieveDesignBrowerState();
if(state!=null && state instanceof DBState)
((DBState)state).apply();
else
txTableViewer.setInput(null);
// Set up the tree viewer
database.addPropertyChangeListener(l);
database.addPropertyChangeListener(treeViewerPCL);
}
/*
* TODO: needs top be implemented
@Inject @Optional
public void getStatusEvent(@UIEventTopic(WaveformViewerPart.ACTIVE_NODE_PATH) String path) {
@Inject
public void setSelection(@Named(IServiceConstants.ACTIVE_SELECTION) @Optional IStructuredSelection selection, EPartService partService){
MPart part = partService.getActivePart();
if(part!=null && part.getObject() != this && selection!=null){
if( selection instanceof IStructuredSelection) {
Object object= ((IStructuredSelection)selection).getFirstElement();
if(object instanceof IHierNode&& ((IHierNode)object).getChildNodes().size()!=0)
txTableViewer.setInput(object);
otherSelectionCount = (object instanceof IWaveform<?> || object instanceof ITx)?1:0;
}
}
updateButtons();
}
private void updateButtons() {
if(txTableViewer!=null && !insertItem.isDisposed() && !appendItem.isDisposed() &&
!appendAllItem.isDisposed() && !insertAllItem.isDisposed()){
AddWaveformHandler myHandler = new AddWaveformHandler();
Object result = runCommand(myHandler, CanExecute.class, "after", false);
appendItem.setEnabled(result instanceof Boolean && (Boolean)result);
result = runCommand(myHandler, CanExecute.class, "after", true);
appendAllItem.setEnabled(result instanceof Boolean && (Boolean)result);
result = runCommand(myHandler, CanExecute.class, "before", false);
insertItem.setEnabled(result instanceof Boolean && (Boolean)result);
result = runCommand(myHandler, CanExecute.class, "before", true);
insertAllItem.setEnabled(result instanceof Boolean && (Boolean)result);
}
}
public class WaveformAttributeFilter extends ViewerFilter {
private String searchString;
public void setSearchText(String s) {
this.searchString = ".*" + s + ".*";
}
@Override
public boolean select(Viewer viewer, Object parentElement, Object element) {
if (searchString == null || searchString.length() == 0) {
return true;
}
IWaveform<?> p = (IWaveform<?>) element;
if (p.getName().matches(searchString)) {
return true;
}
return false;
}
}
protected Object[] getFilteredChildren(TableViewer viewer){
Object parent = viewer.getInput();
if(parent==null) return new Object[0];
Object[] result = null;
if (parent != null) {
IStructuredContentProvider cp = (IStructuredContentProvider) viewer.getContentProvider();
if (cp != null) {
result = cp.getElements(parent);
if(result==null) return new Object[0];
for (int i = 0, n = result.length; i < n; ++i) {
if(result[i]==null) return new Object[0];
}
}
}
ViewerFilter[] filters = viewer.getFilters();
if (filters != null) {
for (ViewerFilter f:filters) {
Object[] filteredResult = f.filter(viewer, parent, result);
result = filteredResult;
}
}
return result;
}
protected Object runCommand(AddWaveformHandler handler, Class<? extends Annotation> annotation, String where, Boolean all) {
ContextInjectionFactory.inject(handler, eclipseCtx);
eclipseCtx.set(AddWaveformHandler.PARAM_WHERE_ID, where);
eclipseCtx.set(AddWaveformHandler.PARAM_ALL_ID, all.toString());
eclipseCtx.set(DesignBrowser.class, this);
eclipseCtx.set(WaveformViewerPart.class, waveformViewerPart);
Object result = ContextInjectionFactory.invoke(handler, annotation, eclipseCtx);
return result;
}
public Object[] getFilteredChildren() {
return getFilteredChildren(txTableViewer);
}
public WaveformViewerPart getActiveWaveformViewerPart() {
return waveformViewerPart;
}
class DBState {
public DBState() {
this.expandedElements=treeViewer.getExpandedElements();
this.treeSelection=treeViewer.getSelection();
this.tableSelection=txTableViewer.getSelection();
}
public void apply() {
treeViewer.setExpandedElements(expandedElements);
treeViewer.setSelection(treeSelection, true);
txTableViewer.setSelection(tableSelection, true);
}
private Object[] expandedElements;
private ISelection treeSelection;
private ISelection tableSelection;
}
*/
};

View File

@ -1,327 +0,0 @@
/*******************************************************************************
* Copyright (c) 2015 MINRES Technologies GmbH and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* MINRES Technologies GmbH - initial API and implementation
*******************************************************************************/
package com.minres.scviewer.e4.application.parts;
import java.lang.annotation.Annotation;
import javax.annotation.PostConstruct;
import javax.inject.Inject;
import javax.inject.Named;
import org.eclipse.e4.core.contexts.ContextInjectionFactory;
import org.eclipse.e4.core.contexts.IEclipseContext;
import org.eclipse.e4.core.di.annotations.CanExecute;
import org.eclipse.e4.core.di.annotations.Execute;
import org.eclipse.e4.core.di.annotations.Optional;
import org.eclipse.e4.core.services.events.IEventBroker;
import org.eclipse.e4.ui.di.Focus;
import org.eclipse.e4.ui.di.UIEventTopic;
import org.eclipse.e4.ui.model.application.ui.basic.MPart;
import org.eclipse.e4.ui.services.EMenuService;
import org.eclipse.e4.ui.services.IServiceConstants;
import org.eclipse.e4.ui.workbench.modeling.EPartService;
import org.eclipse.e4.ui.workbench.modeling.ESelectionService;
import org.eclipse.jface.viewers.DoubleClickEvent;
import org.eclipse.jface.viewers.IDoubleClickListener;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.IStructuredContentProvider;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jface.viewers.ViewerFilter;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Text;
import org.eclipse.swt.widgets.ToolBar;
import org.eclipse.swt.widgets.ToolItem;
import org.eclipse.wb.swt.ResourceManager;
import com.minres.scviewer.database.IHierNode;
import com.minres.scviewer.database.ITx;
import com.minres.scviewer.database.IWaveform;
import com.minres.scviewer.e4.application.handlers.AddWaveformHandler;
import com.minres.scviewer.e4.application.provider.TxDbContentProvider;
import com.minres.scviewer.e4.application.provider.TxDbLabelProvider;
public class WaveformListPart implements ISelectionChangedListener {
private static final String POPUP_ID="com.minres.scviewer.e4.application.parts.WaveformList.popupmenu";
@Inject IEventBroker eventBroker;
@Inject ESelectionService selectionService;
@Inject EMenuService menuService;
@Inject IEclipseContext eclipseCtx;
private Text nameFilter;
private TableViewer txTableViewer;
ToolItem appendItem, insertItem, insertAllItem, appendAllItem;
WaveformAttributeFilter attributeFilter;
int thisSelectionCount=0, otherSelectionCount=0;
private WaveformViewerPart waveformViewerPart;
@PostConstruct
public void createComposite(Composite parent) {
parent.setLayout(new GridLayout(1, false));
nameFilter = new Text(parent, SWT.BORDER);
nameFilter.setMessage("Enter text to filter waveforms");
nameFilter.addModifyListener(new ModifyListener() {
@Override
public void modifyText(ModifyEvent e) {
attributeFilter.setSearchText(((Text) e.widget).getText());
updateButtons();
txTableViewer.refresh();
}
});
nameFilter.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
attributeFilter = new WaveformAttributeFilter();
txTableViewer = new TableViewer(parent);
txTableViewer.setContentProvider(new TxDbContentProvider(true));
txTableViewer.setLabelProvider(new TxDbLabelProvider());
txTableViewer.getTable().setLayoutData(new GridData(GridData.FILL_BOTH));
txTableViewer.addSelectionChangedListener(this);
txTableViewer.addFilter(attributeFilter);
txTableViewer.addDoubleClickListener(new IDoubleClickListener() {
@Override
public void doubleClick(DoubleClickEvent event) {
AddWaveformHandler myHandler = new AddWaveformHandler();
Object result = runCommand(myHandler, CanExecute.class, "after", false);
if(result!=null && (Boolean)result)
ContextInjectionFactory.invoke(myHandler, Execute.class, eclipseCtx);
}
});
menuService.registerContextMenu(txTableViewer.getControl(), POPUP_ID);
ToolBar toolBar = new ToolBar(parent, SWT.FLAT | SWT.RIGHT);
toolBar.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1));
toolBar.setBounds(0, 0, 87, 20);
appendItem = new ToolItem(toolBar, SWT.NONE);
appendItem.setToolTipText("Append after");
appendItem.setImage(ResourceManager.getPluginImage("com.minres.scviewer.e4.application", "icons/append_wave.png"));
appendItem.setEnabled(false);
appendItem.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
/*
eventBroker.post(WaveformViewerPart.ADD_WAVEFORM,
((IStructuredSelection)txTableViewer.getSelection()).toList());
ECommandService commandService = eclipseCtx.get(ECommandService.class);
EHandlerService handlerService = eclipseCtx.get(EHandlerService.class);
HashMap<String,Object> param=new HashMap<>();
param.clear();
//param.put("where", "after");
ParameterizedCommand myCommand = commandService.createCommand(COMMAND_ID, param);
if(myCommand!=null)handlerService.executeHandler(myCommand);
*/
AddWaveformHandler myHandler = new AddWaveformHandler();
Object result = runCommand(myHandler, CanExecute.class, "after", false);
if(result!=null && (Boolean)result)
ContextInjectionFactory.invoke(myHandler, Execute.class, eclipseCtx);
}
});
insertItem = new ToolItem(toolBar, SWT.NONE);
insertItem.setToolTipText("Insert before");
insertItem.setImage(ResourceManager.getPluginImage("com.minres.scviewer.e4.application", "icons/insert_wave.png"));
insertItem.setEnabled(false);
insertItem.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
AddWaveformHandler myHandler = new AddWaveformHandler();
Object result = runCommand(myHandler, CanExecute.class, "before", false);
if(result!=null && (Boolean)result)
ContextInjectionFactory.invoke(myHandler, Execute.class, eclipseCtx);
}
});
new ToolItem(toolBar, SWT.SEPARATOR);
appendAllItem = new ToolItem(toolBar, SWT.NONE);
appendAllItem.setToolTipText("Append all after");
appendAllItem.setImage(ResourceManager.getPluginImage("com.minres.scviewer.e4.application", "icons/append_all_waves.png"));
appendAllItem.setEnabled(false);
new ToolItem(toolBar, SWT.SEPARATOR);
appendAllItem.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
Object[] all = getFilteredChildren(txTableViewer);
if(all.length>0){
Object oldSel=selectionService.getSelection();
selectionService.setSelection(new StructuredSelection(all));
AddWaveformHandler myHandler = new AddWaveformHandler();
Object result = runCommand(myHandler, CanExecute.class, "after", false);
if(result!=null && (Boolean)result)
ContextInjectionFactory.invoke(myHandler, Execute.class, eclipseCtx);
selectionService.setSelection(oldSel);
}
}
});
insertAllItem = new ToolItem(toolBar, SWT.NONE);
insertAllItem.setToolTipText("Insert all before");
insertAllItem.setImage(ResourceManager.getPluginImage("com.minres.scviewer.e4.application", "icons/insert_all_waves.png"));
insertAllItem.setEnabled(false);
insertAllItem.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
Object[] all = getFilteredChildren(txTableViewer);
if(all.length>0){
Object oldSel=selectionService.getSelection();
selectionService.setSelection(new StructuredSelection(all));
AddWaveformHandler myHandler = new AddWaveformHandler();
Object result = runCommand(myHandler, CanExecute.class, "before", false);
if(result!=null && (Boolean)result)
ContextInjectionFactory.invoke(myHandler, Execute.class, eclipseCtx);
selectionService.setSelection(oldSel);
}
}
});
}
@Focus
public void setFocus() {
txTableViewer.getTable().setFocus();
setSelection(txTableViewer.getSelection());
}
@Inject @Optional
public void getStatusEvent(@UIEventTopic(WaveformViewerPart.ACTIVE_WAVEFORMVIEW) WaveformViewerPart part) {
this.waveformViewerPart=part;
updateButtons();
}
@Override
public void selectionChanged(SelectionChangedEvent event) {
setSelection(event.getSelection());
}
protected void setSelection(ISelection iSelection) {
IStructuredSelection selection = (IStructuredSelection)iSelection;
if(selection.size()==0){
appendItem.setEnabled(false);
}
selectionService.setSelection(selection);
thisSelectionCount=selection.toList().size();
updateButtons();
}
@Inject
public void setSelection(@Named(IServiceConstants.ACTIVE_SELECTION) @Optional IStructuredSelection selection, EPartService partService){
MPart part = partService.getActivePart();
if(part!=null && part.getObject() != this && selection!=null){
if( selection instanceof IStructuredSelection) {
Object object= ((IStructuredSelection)selection).getFirstElement();
if(object instanceof IHierNode&& ((IHierNode)object).getChildNodes().size()!=0)
txTableViewer.setInput(object);
otherSelectionCount = (object instanceof IWaveform<?> || object instanceof ITx)?1:0;
}
}
updateButtons();
}
private void updateButtons() {
if(txTableViewer!=null && !insertItem.isDisposed() && !appendItem.isDisposed() &&
!appendAllItem.isDisposed() && !insertAllItem.isDisposed()){
AddWaveformHandler myHandler = new AddWaveformHandler();
Object result = runCommand(myHandler, CanExecute.class, "after", false);
appendItem.setEnabled(result instanceof Boolean && (Boolean)result);
result = runCommand(myHandler, CanExecute.class, "after", true);
appendAllItem.setEnabled(result instanceof Boolean && (Boolean)result);
result = runCommand(myHandler, CanExecute.class, "before", false);
insertItem.setEnabled(result instanceof Boolean && (Boolean)result);
result = runCommand(myHandler, CanExecute.class, "before", true);
insertAllItem.setEnabled(result instanceof Boolean && (Boolean)result);
}
}
public class WaveformAttributeFilter extends ViewerFilter {
private String searchString;
public void setSearchText(String s) {
this.searchString = ".*" + s + ".*";
}
@Override
public boolean select(Viewer viewer, Object parentElement, Object element) {
if (searchString == null || searchString.length() == 0) {
return true;
}
IWaveform<?> p = (IWaveform<?>) element;
if (p.getName().matches(searchString)) {
return true;
}
return false;
}
}
public Object[] getFilteredChildren(){
return getFilteredChildren(txTableViewer);
}
protected Object[] getFilteredChildren(TableViewer viewer){
Object parent = viewer.getInput();
if(parent==null) return new Object[0];
Object[] result = null;
if (parent != null) {
IStructuredContentProvider cp = (IStructuredContentProvider) viewer.getContentProvider();
if (cp != null) {
result = cp.getElements(parent);
if(result==null) return new Object[0];
for (int i = 0, n = result.length; i < n; ++i) {
if(result[i]==null) return new Object[0];
}
}
}
ViewerFilter[] filters = viewer.getFilters();
if (filters != null) {
for (ViewerFilter f:filters) {
Object[] filteredResult = f.filter(viewer, parent, result);
result = filteredResult;
}
}
return result;
}
public WaveformViewerPart getActiveWaveformViewerPart() {
return waveformViewerPart;
}
protected Object runCommand(AddWaveformHandler myHandler, Class<? extends Annotation> annotation, String where, Boolean all) {
ContextInjectionFactory.inject(myHandler, eclipseCtx);
eclipseCtx.set(AddWaveformHandler.PARAM_WHERE_ID, where);
eclipseCtx.set(AddWaveformHandler.PARAM_ALL_ID, all.toString());
Object result = ContextInjectionFactory.invoke(myHandler, annotation, eclipseCtx);
return result;
}
}

View File

@ -57,10 +57,12 @@ import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import com.minres.scviewer.database.ITx;
import com.minres.scviewer.database.ITxRelation;
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.RelationType;
import com.minres.scviewer.database.swt.WaveformViewerFactory;
import com.minres.scviewer.database.ui.GotoDirection;
import com.minres.scviewer.database.ui.ICursor;
@ -126,6 +128,10 @@ public class WaveformViewerPart implements IFileChangeListener, IPreferenceChang
Map<String, String> persistedState;
private Object browserState;
private RelationType navigationRelationType=IWaveformViewer.NEXT_PREV_IN_STREAM ;
FileMonitor fileMonitor = new FileMonitor();
IModificationChecker fileChecker;
@ -487,11 +493,16 @@ public class WaveformViewerPart implements IFileChangeListener, IPreferenceChang
}
public void moveSelected(int i) {
waveformPane.moveSelected(i);
waveformPane.moveSelectedTrack(i);
}
public void moveSelection(GotoDirection direction) {
waveformPane.moveSelection(direction);
public void moveSelection(GotoDirection direction ) {
moveSelection(direction, navigationRelationType);
}
public void moveSelection(GotoDirection direction, RelationType relationType) {
waveformPane.moveSelection(direction, relationType);
}
public void moveCursor(GotoDirection direction) {
@ -528,4 +539,53 @@ public class WaveformViewerPart implements IFileChangeListener, IPreferenceChang
return waveformPane.getScaledTime(time);
}
public void storeDesignBrowerState(Object browserState) {
this.browserState=browserState;
}
public Object retrieveDesignBrowerState() {
return browserState;
}
public List<RelationType> getAllRelationTypes() {
List<RelationType> res =new ArrayList<>();
res.add(IWaveformViewer.NEXT_PREV_IN_STREAM);
res.addAll(database.getAllRelationTypes());
return res;
}
public List<RelationType> getSelectionRelationTypes() {
List<RelationType> res =new ArrayList<>();
res.add(IWaveformViewer.NEXT_PREV_IN_STREAM);
ISelection selection = waveformPane.getSelection();
if(selection instanceof IStructuredSelection && !selection.isEmpty()){
IStructuredSelection sel=(IStructuredSelection) selection;
if(sel.getFirstElement() instanceof ITx){
ITx tx = (ITx) sel.getFirstElement();
for(ITxRelation rel:tx.getIncomingRelations()){
if(!res.contains(rel.getRelationType()))
res.add(rel.getRelationType());
}
for(ITxRelation rel:tx.getOutgoingRelations()){
if(!res.contains(rel.getRelationType()))
res.add(rel.getRelationType());
}
}
}
return res;
}
public RelationType getRelationTypeFilter() {
return navigationRelationType;
}
public void setNavigationRelationType(String relationName) {
setNavigationRelationType(RelationType.create(relationName));
}
public void setNavigationRelationType(RelationType relationType) {
if(navigationRelationType!=relationType) waveformPane.setHighliteRelation(relationType);
navigationRelationType=relationType;
}
}

View File

@ -44,7 +44,8 @@ public class DefaultValuesInitializer extends AbstractPreferenceInitializer {
colors[WaveformColors.CURSOR_TEXT.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_WHITE);
colors[WaveformColors.MARKER.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_DARK_GRAY);
colors[WaveformColors.MARKER_TEXT.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_WHITE);
colors[WaveformColors.REL_ARROW.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_YELLOW);
colors[WaveformColors.REL_ARROW.ordinal()] = SWTResourceManager.getColor(SWT.COLOR_MAGENTA);
colors[WaveformColors.REL_ARROW_HIGHLITE.ordinal()] = SWTResourceManager.getColor(255, 128, 255);
}
@Override

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.text@default:default,com.minres.scviewer.database.ui.swt@default:default,com.minres.scviewer.database.ui@default:default,com.minres.scviewer.database.vcd@default:default,com.minres.scviewer.database@default:default,com.minres.scviewer.e4.application@default:default"/>
<stringAttribute key="selected_workspace_plugins" value="com.minres.scviewer.database.sqlite@default:default,com.minres.scviewer.database.text@default:default,com.minres.scviewer.database.ui.swt@default:default,com.minres.scviewer.database.ui@default:default,com.minres.scviewer.database.vcd@default:default,com.minres.scviewer.database@default:default,com.minres.scviewer.e4.application@default:default,com.opcoach.e4.preferences@default:default"/>
<booleanAttribute key="show_selected_only" value="false"/>
<booleanAttribute key="tracing" value="false"/>
<booleanAttribute key="useCustomFeatures" value="false"/>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 103 KiB

View File

@ -1,7 +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.6"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
<classpathentry kind="output" path="bin"/>
</classpath>

View File

@ -1,7 +1,12 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
org.eclipse.jdt.core.compiler.compliance=1.6
org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.7
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
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.source=1.6
org.eclipse.jdt.core.compiler.source=1.7

View File

@ -79,7 +79,7 @@ public class ScopedPreferenceStore extends EventManager implements
* The default context is the context where getDefault and setDefault
* methods will search. This context is also used in the search.
*/
private IScopeContext defaultContext = new DefaultScope();
private IScopeContext defaultContext = DefaultScope.INSTANCE;
/**
* The nodeQualifer is the string used to look up the node in the contexts.

View File

@ -26,9 +26,7 @@ import org.eclipse.e4.core.contexts.IEclipseContext;
import org.eclipse.e4.core.di.annotations.Creatable;
import org.eclipse.e4.core.services.contributions.IContributionFactory;
import org.eclipse.e4.core.services.log.Logger;
import org.eclipse.jface.preference.FieldEditorPreferencePage;
import org.eclipse.jface.preference.IPreferenceNode;
import org.eclipse.jface.preference.IPreferencePage;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.preference.PreferenceManager;
import org.eclipse.jface.preference.PreferenceNode;
@ -41,6 +39,7 @@ import org.eclipse.swt.widgets.Label;
import com.opcoach.e4.preferences.IPreferenceStoreProvider;
import com.opcoach.e4.preferences.ScopedPreferenceStore;
@SuppressWarnings("restriction")
@Creatable
public class E4PreferenceRegistry
{