Merge branch 'release/2.4.1'
This commit is contained in:
commit
2a930720be
|
@ -14,6 +14,7 @@ import java.beans.IntrospectionException;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileInputStream;
|
import java.io.FileInputStream;
|
||||||
import java.io.FileNotFoundException;
|
import java.io.FileNotFoundException;
|
||||||
|
import java.io.IOException;
|
||||||
import java.lang.reflect.InvocationTargetException;
|
import java.lang.reflect.InvocationTargetException;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
@ -91,6 +92,8 @@ public class SQLiteDbLoader implements IWaveformDbLoader {
|
||||||
if (buffer[i] != x[i]) return false;
|
if (buffer[i] != x[i]) return false;
|
||||||
} catch(FileNotFoundException e) {
|
} catch(FileNotFoundException e) {
|
||||||
return false;
|
return false;
|
||||||
|
} catch(IOException e) { //if an I/O error occurs
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
database=new SQLiteDatabase(file.getAbsolutePath());
|
database=new SQLiteDatabase(file.getAbsolutePath());
|
||||||
database.setData("TIMERESOLUTION", 1L);
|
database.setData("TIMERESOLUTION", 1L);
|
||||||
|
|
|
@ -2,7 +2,7 @@ Manifest-Version: 1.0
|
||||||
Bundle-ManifestVersion: 2
|
Bundle-ManifestVersion: 2
|
||||||
Bundle-Name: SWT widget
|
Bundle-Name: SWT widget
|
||||||
Bundle-SymbolicName: com.minres.scviewer.database.ui.swt
|
Bundle-SymbolicName: com.minres.scviewer.database.ui.swt
|
||||||
Bundle-Version: 2.1.0.qualifier
|
Bundle-Version: 2.2.0.qualifier
|
||||||
Bundle-Vendor: MINRES Technologies GmbH
|
Bundle-Vendor: MINRES Technologies GmbH
|
||||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
|
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
|
||||||
Require-Bundle: org.eclipse.swt;bundle-version="3.103.1",
|
Require-Bundle: org.eclipse.swt;bundle-version="3.103.1",
|
||||||
|
|
|
@ -8,5 +8,5 @@
|
||||||
<version>2.0.0-SNAPSHOT</version>
|
<version>2.0.0-SNAPSHOT</version>
|
||||||
<relativePath>../com.minres.scviewer.parent</relativePath>
|
<relativePath>../com.minres.scviewer.parent</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<version>2.1.0-SNAPSHOT</version>
|
<version>2.2.0-SNAPSHOT</version>
|
||||||
</project>
|
</project>
|
|
@ -2,8 +2,11 @@ package com.minres.scviewer.database.swt;
|
||||||
|
|
||||||
public class Constants {
|
public class Constants {
|
||||||
|
|
||||||
public final static String[] unitString={"fs", "ps", "ns", "us", "ms"};//, "s"};
|
public static final String[] unitString={"fs", "ps", "ns", "us", "ms"};//, "s"};
|
||||||
|
|
||||||
public final static int[] unitMultiplier={1, 3, 10, 30, 100, 300};
|
public static final int[] unitMultiplier={1, 3, 10, 30, 100, 300};
|
||||||
|
|
||||||
|
public static final String CONTENT_PROVIDER_TAG = "TOOLTIP_CONTENT_PROVIDER";
|
||||||
|
public static final String HELP_PROVIDER_TAG = "TOOLTIP_HELP_PROVIDER";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,10 @@
|
||||||
|
package com.minres.scviewer.database.swt;
|
||||||
|
|
||||||
|
import org.eclipse.swt.graphics.Point;
|
||||||
|
import org.eclipse.swt.widgets.Composite;
|
||||||
|
|
||||||
|
public interface ToolTipContentProvider {
|
||||||
|
|
||||||
|
public boolean createContent(Composite parent, Point pt);
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,12 @@
|
||||||
|
package com.minres.scviewer.database.swt;
|
||||||
|
|
||||||
|
import org.eclipse.swt.widgets.Widget;
|
||||||
|
|
||||||
|
public interface ToolTipHelpTextProvider {
|
||||||
|
/**
|
||||||
|
* Get help text
|
||||||
|
* @param widget the widget that is under help
|
||||||
|
* @return a help text string
|
||||||
|
*/
|
||||||
|
public String getHelpText(Widget widget);
|
||||||
|
}
|
|
@ -0,0 +1,73 @@
|
||||||
|
package com.minres.scviewer.database.swt.internal;
|
||||||
|
|
||||||
|
import static org.eclipse.swt.events.SelectionListener.widgetSelectedAdapter;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
import org.eclipse.swt.SWT;
|
||||||
|
import org.eclipse.swt.layout.RowLayout;
|
||||||
|
import org.eclipse.swt.widgets.Button;
|
||||||
|
import org.eclipse.swt.widgets.Dialog;
|
||||||
|
import org.eclipse.swt.widgets.Display;
|
||||||
|
import org.eclipse.swt.widgets.Label;
|
||||||
|
import org.eclipse.swt.widgets.List;
|
||||||
|
import org.eclipse.swt.widgets.Shell;
|
||||||
|
|
||||||
|
import com.minres.scviewer.database.ITx;
|
||||||
|
import com.minres.scviewer.database.ITxRelation;
|
||||||
|
|
||||||
|
class RelSelectionDialog extends Dialog {
|
||||||
|
private java.util.List<ITxRelation> entries;
|
||||||
|
|
||||||
|
private java.util.List<ITx> entryTx;
|
||||||
|
|
||||||
|
private ITxRelation selected = null;
|
||||||
|
|
||||||
|
public RelSelectionDialog(Shell shell, ArrayList<ITxRelation> candidates, boolean target) {
|
||||||
|
super(shell);
|
||||||
|
entries = candidates;
|
||||||
|
entryTx = entries.stream().map(r->target?r.getTarget():r.getSource()).collect(Collectors.toCollection(ArrayList::new));
|
||||||
|
}
|
||||||
|
|
||||||
|
public ITxRelation open() {
|
||||||
|
Shell parent = getParent();
|
||||||
|
Shell dialog = new Shell(parent, SWT.SHEET | SWT.APPLICATION_MODAL);
|
||||||
|
dialog.setMinimumSize(10, 10);
|
||||||
|
|
||||||
|
RowLayout rowLayout = new RowLayout(SWT.VERTICAL);
|
||||||
|
//rowLayout.fill = true; // Overriding default values.
|
||||||
|
rowLayout.marginWidth=3;
|
||||||
|
rowLayout.marginHeight=0;
|
||||||
|
rowLayout.marginLeft = 3;
|
||||||
|
rowLayout.marginTop = 0;
|
||||||
|
rowLayout.marginRight = 3;
|
||||||
|
rowLayout.marginBottom = 0;
|
||||||
|
dialog.setLayout(rowLayout);
|
||||||
|
final Label lbl = new Label(dialog,SWT.NONE);
|
||||||
|
lbl.setText("Select one:");
|
||||||
|
final List list = new List (dialog, SWT.NONE);
|
||||||
|
for (ITx iTx : entryTx) {
|
||||||
|
list.add ("#tx" + iTx.getId()+" ("+iTx.getStream().getFullName()+")");
|
||||||
|
}
|
||||||
|
list.addListener (SWT.Selection, e -> {
|
||||||
|
int selection = list.getSelectionIndex();
|
||||||
|
if(selection>=0) {
|
||||||
|
selected=entries.get(selection);
|
||||||
|
dialog.close();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
final Button bt = new Button(dialog, SWT.PUSH | SWT.RIGHT);
|
||||||
|
bt.setText("Dismiss");
|
||||||
|
bt.setAlignment(SWT.CENTER);
|
||||||
|
bt.addSelectionListener(widgetSelectedAdapter(e -> dialog.close()));
|
||||||
|
dialog.pack();
|
||||||
|
dialog.open();
|
||||||
|
Display display = parent.getDisplay();
|
||||||
|
while (!dialog.isDisposed()) {
|
||||||
|
if (!display.readAndDispatch())
|
||||||
|
display.sleep();
|
||||||
|
}
|
||||||
|
return selected;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,143 @@
|
||||||
|
package com.minres.scviewer.database.swt.internal;
|
||||||
|
|
||||||
|
import org.eclipse.swt.SWT;
|
||||||
|
import org.eclipse.swt.graphics.Point;
|
||||||
|
import org.eclipse.swt.graphics.Rectangle;
|
||||||
|
import org.eclipse.swt.layout.FillLayout;
|
||||||
|
import org.eclipse.swt.layout.GridLayout;
|
||||||
|
import org.eclipse.swt.layout.RowLayout;
|
||||||
|
import org.eclipse.swt.widgets.Control;
|
||||||
|
import org.eclipse.swt.widgets.Display;
|
||||||
|
import org.eclipse.swt.widgets.Event;
|
||||||
|
import org.eclipse.swt.widgets.Label;
|
||||||
|
import org.eclipse.swt.widgets.Listener;
|
||||||
|
import org.eclipse.swt.widgets.Shell;
|
||||||
|
import org.eclipse.swt.widgets.Widget;
|
||||||
|
|
||||||
|
import com.minres.scviewer.database.swt.Constants;
|
||||||
|
import com.minres.scviewer.database.swt.ToolTipContentProvider;
|
||||||
|
import com.minres.scviewer.database.swt.ToolTipHelpTextProvider;
|
||||||
|
|
||||||
|
class ToolTipHandler {
|
||||||
|
|
||||||
|
private final Display display;
|
||||||
|
private Shell parentShell;
|
||||||
|
private Shell shell;
|
||||||
|
|
||||||
|
private Widget tipWidget; // widget this tooltip is hovering over
|
||||||
|
private Point tipPosition; // the position being hovered over
|
||||||
|
|
||||||
|
private static final int hoverYOffset = 1;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a new tooltip handler
|
||||||
|
*
|
||||||
|
* @param parent the parent Shell
|
||||||
|
*/
|
||||||
|
public ToolTipHandler(Shell parent) {
|
||||||
|
display = parent.getDisplay();
|
||||||
|
parentShell = parent;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enables customized hover help for a specified control
|
||||||
|
*
|
||||||
|
* @control the control on which to enable hoverhelp
|
||||||
|
*/
|
||||||
|
public void activateHoverHelp(final Control control) {
|
||||||
|
Listener listener = new Listener () {
|
||||||
|
Shell tip = null;
|
||||||
|
@Override
|
||||||
|
public void handleEvent (Event event) {
|
||||||
|
switch (event.type) {
|
||||||
|
case SWT.KeyDown:{
|
||||||
|
if (tip != null && tip.isVisible() && event.keyCode == SWT.F2) {
|
||||||
|
tip.setFocus();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
case SWT.Dispose:
|
||||||
|
case SWT.MouseMove:
|
||||||
|
case SWT.MouseDown: {
|
||||||
|
if (tip != null){
|
||||||
|
tip.dispose ();
|
||||||
|
tip = null;
|
||||||
|
tipWidget=null;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case SWT.MouseHover: {
|
||||||
|
Object o = control.getData(Constants.CONTENT_PROVIDER_TAG);
|
||||||
|
if(o != null && o instanceof ToolTipContentProvider) {
|
||||||
|
ToolTipContentProvider provider = ((ToolTipContentProvider)o);
|
||||||
|
Point pt = new Point (event.x, event.y);
|
||||||
|
tipPosition = control.toDisplay(pt);
|
||||||
|
if (tip != null && !tip.isDisposed ()) tip.dispose ();
|
||||||
|
tip = new Shell (parentShell, SWT.ON_TOP | SWT.NO_FOCUS | SWT.TOOL);
|
||||||
|
tip.setBackground (display.getSystemColor (SWT.COLOR_INFO_BACKGROUND));
|
||||||
|
GridLayout layout = new GridLayout(1, true);
|
||||||
|
layout.verticalSpacing=0;
|
||||||
|
layout.horizontalSpacing=0;
|
||||||
|
layout.marginWidth = 0;
|
||||||
|
layout.marginHeight = 0;
|
||||||
|
tip.setLayout(layout);
|
||||||
|
boolean visible = provider.createContent(tip, pt);
|
||||||
|
tip.pack();
|
||||||
|
tip.setSize(tip.computeSize(SWT.DEFAULT, SWT.DEFAULT));
|
||||||
|
setHoverLocation(tip, tipPosition);
|
||||||
|
tip.setVisible (visible);
|
||||||
|
if(visible)
|
||||||
|
tipWidget=event.widget;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
control.addListener (SWT.Dispose, listener);
|
||||||
|
control.addListener (SWT.KeyDown, listener);
|
||||||
|
//control.addListener (SWT.MouseMove, listener);
|
||||||
|
control.addListener (SWT.MouseHover, listener);
|
||||||
|
control.addListener (SWT.MouseDown, listener);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Trap F1 Help to pop up a custom help box
|
||||||
|
*/
|
||||||
|
control.addHelpListener(event -> {
|
||||||
|
if (tipWidget == null) return;
|
||||||
|
ToolTipHelpTextProvider handler = (ToolTipHelpTextProvider)tipWidget.getData(Constants.HELP_PROVIDER_TAG);
|
||||||
|
if (handler == null) return;
|
||||||
|
String text = handler.getHelpText(tipWidget);
|
||||||
|
if (text == null) return;
|
||||||
|
|
||||||
|
if (shell.isVisible()) {
|
||||||
|
shell.setVisible(false);
|
||||||
|
Shell helpShell = new Shell(parentShell, SWT.SHELL_TRIM);
|
||||||
|
helpShell.setLayout(new FillLayout());
|
||||||
|
Label label = new Label(helpShell, SWT.NONE);
|
||||||
|
label.setText(text);
|
||||||
|
helpShell.pack();
|
||||||
|
setHoverLocation(helpShell, tipPosition);
|
||||||
|
helpShell.open();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
// control.addKeyListener(KeyListener.keyPressedAdapter( e-> {
|
||||||
|
// if (e.keyCode == SWT.F2 && shell.isVisible()) {
|
||||||
|
// shell.setFocus();
|
||||||
|
// }
|
||||||
|
// }));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the location for a hovering shell
|
||||||
|
* @param shell the object that is to hover
|
||||||
|
* @param position the position of a widget to hover over
|
||||||
|
* @return the top-left location for a hovering box
|
||||||
|
*/
|
||||||
|
private void setHoverLocation(Shell shell, Point position) {
|
||||||
|
Rectangle displayBounds = shell.getDisplay().getBounds();
|
||||||
|
Rectangle shellBounds = shell.getBounds();
|
||||||
|
shellBounds.x = Math.max(Math.min(position.x, displayBounds.width - shellBounds.width), 0);
|
||||||
|
shellBounds.y = Math.max(Math.min(position.y + hoverYOffset, displayBounds.height - shellBounds.height), 0);
|
||||||
|
shell.setBounds(shellBounds);
|
||||||
|
}
|
||||||
|
}
|
|
@ -426,7 +426,7 @@ public class WaveformCanvas extends Canvas{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Object> getClicked(Point point) {
|
public List<Object> getElementsAt(Point point) {
|
||||||
LinkedList<Object> result=new LinkedList<>();
|
LinkedList<Object> result=new LinkedList<>();
|
||||||
for (IPainter p : Lists.reverse(painterList)) {
|
for (IPainter p : Lists.reverse(painterList)) {
|
||||||
if (p instanceof TrackAreaPainter) {
|
if (p instanceof TrackAreaPainter) {
|
||||||
|
|
|
@ -15,6 +15,7 @@ import java.beans.PropertyChangeEvent;
|
||||||
import java.beans.PropertyChangeListener;
|
import java.beans.PropertyChangeListener;
|
||||||
import java.beans.PropertyChangeSupport;
|
import java.beans.PropertyChangeSupport;
|
||||||
import java.text.DecimalFormat;
|
import java.text.DecimalFormat;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
@ -24,6 +25,7 @@ import java.util.Map.Entry;
|
||||||
import java.util.NavigableMap;
|
import java.util.NavigableMap;
|
||||||
import java.util.NoSuchElementException;
|
import java.util.NoSuchElementException;
|
||||||
import java.util.TreeMap;
|
import java.util.TreeMap;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import org.eclipse.core.runtime.ListenerList;
|
import org.eclipse.core.runtime.ListenerList;
|
||||||
import org.eclipse.jface.util.LocalSelectionTransfer;
|
import org.eclipse.jface.util.LocalSelectionTransfer;
|
||||||
|
@ -97,7 +99,7 @@ public class WaveformViewer implements IWaveformViewer {
|
||||||
|
|
||||||
private PropertyChangeSupport pcs;
|
private PropertyChangeSupport pcs;
|
||||||
|
|
||||||
static final DecimalFormat df = new DecimalFormat("#.00####");
|
static final DecimalFormat df = new DecimalFormat("#0.00####");
|
||||||
|
|
||||||
private ITx currentTxSelection;
|
private ITx currentTxSelection;
|
||||||
|
|
||||||
|
@ -115,6 +117,8 @@ public class WaveformViewer implements IWaveformViewer {
|
||||||
|
|
||||||
final WaveformCanvas waveformCanvas;
|
final WaveformCanvas waveformCanvas;
|
||||||
|
|
||||||
|
final ToolTipHandler toolTipHandler;
|
||||||
|
|
||||||
private boolean revealSelected=false;
|
private boolean revealSelected=false;
|
||||||
|
|
||||||
private Composite top;
|
private Composite top;
|
||||||
|
@ -159,7 +163,7 @@ public class WaveformViewer implements IWaveformViewer {
|
||||||
down=true;
|
down=true;
|
||||||
if((e.stateMask&SWT.MODIFIER_MASK)!=0) return; //don't react on modifier
|
if((e.stateMask&SWT.MODIFIER_MASK)!=0) return; //don't react on modifier
|
||||||
if (e.button == 1) {
|
if (e.button == 1) {
|
||||||
initialSelected = waveformCanvas.getClicked(start);
|
initialSelected = waveformCanvas.getElementsAt(start);
|
||||||
} else if (e.button == 3) {
|
} else if (e.button == 3) {
|
||||||
Menu topMenu= top.getMenu();
|
Menu topMenu= top.getMenu();
|
||||||
if(topMenu!=null) topMenu.setVisible(true);
|
if(topMenu!=null) topMenu.setVisible(true);
|
||||||
|
@ -248,7 +252,7 @@ public class WaveformViewer implements IWaveformViewer {
|
||||||
protected long snapOffsetToEvent(Point p) {
|
protected long snapOffsetToEvent(Point p) {
|
||||||
long time= waveformCanvas.getTimeForOffset(p.x);
|
long time= waveformCanvas.getTimeForOffset(p.x);
|
||||||
long scaling=5*waveformCanvas.getScaleFactor();
|
long scaling=5*waveformCanvas.getScaleFactor();
|
||||||
for(Object o:waveformCanvas.getClicked(p)){
|
for(Object o:waveformCanvas.getElementsAt(p)){
|
||||||
Entry<Long, ?> floorEntry=null, ceilEntry=null;
|
Entry<Long, ?> floorEntry=null, ceilEntry=null;
|
||||||
if(o instanceof TrackEntry){
|
if(o instanceof TrackEntry){
|
||||||
TrackEntry entry = (TrackEntry) o;
|
TrackEntry entry = (TrackEntry) o;
|
||||||
|
@ -417,6 +421,9 @@ public class WaveformViewer implements IWaveformViewer {
|
||||||
createStreamDropTarget(valueList);
|
createStreamDropTarget(valueList);
|
||||||
createWaveformDragSource(waveformCanvas);
|
createWaveformDragSource(waveformCanvas);
|
||||||
createWaveformDropTarget(waveformCanvas);
|
createWaveformDropTarget(waveformCanvas);
|
||||||
|
|
||||||
|
toolTipHandler = new ToolTipHandler(parent.getShell());
|
||||||
|
toolTipHandler.activateHoverHelp(waveformCanvas);
|
||||||
}
|
}
|
||||||
|
|
||||||
private Composite createTextPane(SashForm leftSash, String text) {
|
private Composite createTextPane(SashForm leftSash, String text) {
|
||||||
|
@ -809,25 +816,41 @@ public class WaveformViewer implements IWaveformViewer {
|
||||||
} else {
|
} else {
|
||||||
if (direction == GotoDirection.NEXT) {
|
if (direction == GotoDirection.NEXT) {
|
||||||
Collection<ITxRelation> outRel=currentTxSelection.getOutgoingRelations();
|
Collection<ITxRelation> outRel=currentTxSelection.getOutgoingRelations();
|
||||||
for(ITxRelation rel:outRel){
|
ITxRelation tx = selectTxToNavigateTo(outRel, relationType, true);
|
||||||
if(relationType.equals(rel.getRelationType())){
|
if(tx!=null) setSelection(new StructuredSelection(tx.getTarget()), true);
|
||||||
setSelection(new StructuredSelection(rel.getTarget()), true);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if (direction == GotoDirection.PREV) {
|
} else if (direction == GotoDirection.PREV) {
|
||||||
Collection<ITxRelation> inRel=currentTxSelection.getIncomingRelations();
|
Collection<ITxRelation> inRel=currentTxSelection.getIncomingRelations();
|
||||||
for(ITxRelation rel:inRel){
|
ITxRelation tx = selectTxToNavigateTo(inRel, relationType, false);
|
||||||
if(relationType.equals(rel.getRelationType())){
|
if(tx!=null) setSelection(new StructuredSelection(tx.getSource()), true);
|
||||||
setSelection(new StructuredSelection(rel.getSource()), true);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private ITxRelation selectTxToNavigateTo(Collection<ITxRelation> rel, RelationType relationType, boolean target) {
|
||||||
|
ArrayList<ITxRelation> candidates = rel.stream().filter(r -> relationType.equals(r.getRelationType())).collect(Collectors.toCollection(ArrayList::new));
|
||||||
|
//new RelSelectionDialog(waveformCanvas.getShell(), candidates, target).open();
|
||||||
|
switch (candidates.size()) {
|
||||||
|
case 0: return null;
|
||||||
|
case 1: return candidates.get(0);
|
||||||
|
default:
|
||||||
|
ArrayList<ITxRelation> visibleCandidates = candidates.stream().filter(r -> streamsVisible(r)).collect(Collectors.toCollection(ArrayList::new));
|
||||||
|
if(visibleCandidates.size()==0) {
|
||||||
|
return new RelSelectionDialog(waveformCanvas.getShell(), candidates, target).open();
|
||||||
|
} else if(visibleCandidates.size()==1) {
|
||||||
|
return visibleCandidates.size()==1?visibleCandidates.get(0):null;
|
||||||
|
} else {
|
||||||
|
return new RelSelectionDialog(waveformCanvas.getShell(), visibleCandidates, target).open();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean streamsVisible(ITxRelation relation) {
|
||||||
|
final ITxStream<ITxEvent> src = relation.getSource().getStream();
|
||||||
|
final ITxStream<ITxEvent> tgt = relation.getTarget().getStream();
|
||||||
|
return streams.stream().anyMatch(x -> x.waveform == src) && streams.stream().anyMatch(x -> x.waveform == tgt);
|
||||||
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see com.minres.scviewer.database.swt.IWaveformPanel#moveCursor(com.minres.scviewer.database.swt.GotoDirection)
|
* @see com.minres.scviewer.database.swt.IWaveformPanel#moveCursor(com.minres.scviewer.database.swt.GotoDirection)
|
||||||
*/
|
*/
|
||||||
|
@ -1130,6 +1153,10 @@ public class WaveformViewer implements IWaveformViewer {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<Object> getElementsAt(Point pt){
|
||||||
|
return waveformCanvas.getElementsAt(pt);
|
||||||
|
}
|
||||||
|
|
||||||
private void createWaveformDragSource(final Canvas canvas) {
|
private void createWaveformDragSource(final Canvas canvas) {
|
||||||
Transfer[] types = new Transfer[] { LocalSelectionTransfer.getTransfer() };
|
Transfer[] types = new Transfer[] { LocalSelectionTransfer.getTransfer() };
|
||||||
DragSource dragSource = new DragSource(canvas, DND.DROP_MOVE);
|
DragSource dragSource = new DragSource(canvas, DND.DROP_MOVE);
|
||||||
|
@ -1137,7 +1164,7 @@ public class WaveformViewer implements IWaveformViewer {
|
||||||
dragSource.addDragListener(new DragSourceAdapter() {
|
dragSource.addDragListener(new DragSourceAdapter() {
|
||||||
public void dragStart(DragSourceEvent event) {
|
public void dragStart(DragSourceEvent event) {
|
||||||
event.doit = false;
|
event.doit = false;
|
||||||
List<Object> clicked = waveformCanvas.getClicked(new Point(event.x, event.y));
|
List<Object> clicked = waveformCanvas.getElementsAt(new Point(event.x, event.y));
|
||||||
for(Object o:clicked){
|
for(Object o:clicked){
|
||||||
if(o instanceof CursorPainter){
|
if(o instanceof CursorPainter){
|
||||||
LocalSelectionTransfer.getTransfer().setSelection(new StructuredSelection(o));
|
LocalSelectionTransfer.getTransfer().setSelection(new StructuredSelection(o));
|
||||||
|
@ -1150,7 +1177,7 @@ public class WaveformViewer implements IWaveformViewer {
|
||||||
|
|
||||||
public void dragSetData(DragSourceEvent event) {
|
public void dragSetData(DragSourceEvent event) {
|
||||||
if (LocalSelectionTransfer.getTransfer().isSupportedType(event.dataType)) {
|
if (LocalSelectionTransfer.getTransfer().isSupportedType(event.dataType)) {
|
||||||
event.data=waveformCanvas.getClicked(new Point(event.x, event.y));
|
event.data=waveformCanvas.getElementsAt(new Point(event.x, event.y));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -18,6 +18,7 @@ import org.eclipse.jface.viewers.ISelection;
|
||||||
import org.eclipse.jface.viewers.ISelectionChangedListener;
|
import org.eclipse.jface.viewers.ISelectionChangedListener;
|
||||||
import org.eclipse.jface.viewers.ISelectionProvider;
|
import org.eclipse.jface.viewers.ISelectionProvider;
|
||||||
import org.eclipse.swt.events.DisposeListener;
|
import org.eclipse.swt.events.DisposeListener;
|
||||||
|
import org.eclipse.swt.graphics.Point;
|
||||||
import org.eclipse.swt.graphics.RGB;
|
import org.eclipse.swt.graphics.RGB;
|
||||||
import org.eclipse.swt.widgets.Control;
|
import org.eclipse.swt.widgets.Control;
|
||||||
|
|
||||||
|
@ -62,6 +63,8 @@ public interface IWaveformViewer extends PropertyChangeListener, ISelectionProvi
|
||||||
|
|
||||||
public TrackEntry getEntryForStream(IWaveform source);
|
public TrackEntry getEntryForStream(IWaveform source);
|
||||||
|
|
||||||
|
public List<Object> getElementsAt(Point pt);
|
||||||
|
|
||||||
public void moveSelectedTrack(int i);
|
public void moveSelectedTrack(int i);
|
||||||
|
|
||||||
public void setHighliteRelation(RelationType relationType);
|
public void setHighliteRelation(RelationType relationType);
|
||||||
|
|
|
@ -123,17 +123,22 @@
|
||||||
</children>
|
</children>
|
||||||
</children>
|
</children>
|
||||||
<children xsi:type="menu:ToolBar" xmi:id="_oQdMUHcqEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.toolbar.1">
|
<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" tooltip="Restore default zoom level" 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/magnifier.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"/>
|
<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>
|
||||||
<children xsi:type="menu:ToolBarSeparator" xmi:id="_p1AvUHcqEeWwZ-9vrAR2UQ" elementId="com.minres.scviewer.e4.application.toolbarseparator.1"/>
|
<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" tooltip="Zoom in by a factor of 3" 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/magnifier_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"/>
|
<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>
|
||||||
<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">
|
<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/magifier_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"/>
|
<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>
|
||||||
</children>
|
</children>
|
||||||
|
<children xsi:type="menu:ToolBar" xmi:id="_fwn8wGtTEeqmlpoaaMHoiw" elementId="com.minres.scviewer.e4.application.toolbar.2">
|
||||||
|
<children xsi:type="menu:HandledToolItem" xmi:id="_j-XIgGtTEeqmlpoaaMHoiw" elementId="com.minres.scviewer.e4.application.handledtoolitem.hover" label="Hover" iconURI="platform:/plugin/com.minres.scviewer.e4.application/icons/lightbulb.png" tooltip="Enable hover window in waveform" selected="true" type="Check" command="_uyeyYGtTEeqmlpoaaMHoiw">
|
||||||
|
<tags>EnableHover</tags>
|
||||||
|
</children>
|
||||||
|
</children>
|
||||||
</trimBars>
|
</trimBars>
|
||||||
<trimBars xmi:id="_JHMt8HS8EeWBq8z1Dv39LA" elementId="org.eclipse.ui.trim.status" side="Bottom">
|
<trimBars xmi:id="_JHMt8HS8EeWBq8z1Dv39LA" elementId="org.eclipse.ui.trim.status" side="Bottom">
|
||||||
<children xsi:type="menu:ToolControl" xmi:id="_YsBi8HfLEeWwZ-9vrAR2UQ" elementId="org.eclipse.ui.StatusLine" contributionURI="bundleclass://com.minres.scviewer.e4.application/com.minres.scviewer.e4.application.internal.status.WaveStatusBarControl">
|
<children xsi:type="menu:ToolControl" xmi:id="_YsBi8HfLEeWwZ-9vrAR2UQ" elementId="org.eclipse.ui.StatusLine" contributionURI="bundleclass://com.minres.scviewer.e4.application/com.minres.scviewer.e4.application.internal.status.WaveStatusBarControl">
|
||||||
|
@ -156,6 +161,7 @@
|
||||||
<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="_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"/>
|
<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"/>
|
||||||
<handlers xmi:id="__99WoJebEeW09eyIbHsdvg" elementId="com.minres.scviewer.e4.application.handler.loadStoreSettings" contributionURI="bundleclass://com.minres.scviewer.e4.application/com.minres.scviewer.e4.application.handlers.LoadStoreSettingsHandler" command="_7-AIMJebEeW09eyIbHsdvg"/>
|
<handlers xmi:id="__99WoJebEeW09eyIbHsdvg" elementId="com.minres.scviewer.e4.application.handler.loadStoreSettings" contributionURI="bundleclass://com.minres.scviewer.e4.application/com.minres.scviewer.e4.application.handlers.LoadStoreSettingsHandler" command="_7-AIMJebEeW09eyIbHsdvg"/>
|
||||||
|
<handlers xmi:id="_x4pSEGtTEeqmlpoaaMHoiw" elementId="com.minres.scviewer.e4.application.handler.0" contributionURI="bundleclass://com.minres.scviewer.e4.application/com.minres.scviewer.e4.application.handlers.EnableHover" command="_uyeyYGtTEeqmlpoaaMHoiw"/>
|
||||||
<bindingTables xmi:id="_95PfvnNmEeWBq8z1Dv39LA" bindingContext="_95PfuXNmEeWBq8z1Dv39LA">
|
<bindingTables xmi:id="_95PfvnNmEeWBq8z1Dv39LA" bindingContext="_95PfuXNmEeWBq8z1Dv39LA">
|
||||||
<bindings xmi:id="_95Pfv3NmEeWBq8z1Dv39LA" elementId="com.minres.scviewer.e4.application.keybinding.quit" keySequence="M1+Q" command="_95PfvHNmEeWBq8z1Dv39LA">
|
<bindings xmi:id="_95Pfv3NmEeWBq8z1Dv39LA" elementId="com.minres.scviewer.e4.application.keybinding.quit" keySequence="M1+Q" command="_95PfvHNmEeWBq8z1Dv39LA">
|
||||||
<tags>type:user</tags>
|
<tags>type:user</tags>
|
||||||
|
@ -286,6 +292,7 @@
|
||||||
<commands xmi:id="_4C_asM3ZEei6rfTGo88R-w" elementId="com.minres.scviewer.e4.application.command.changevaluedisplay" commandName="Change Value Display Command">
|
<commands xmi:id="_4C_asM3ZEei6rfTGo88R-w" elementId="com.minres.scviewer.e4.application.command.changevaluedisplay" commandName="Change Value Display Command">
|
||||||
<parameters xmi:id="_4C_asc3ZEei6rfTGo88R-w" elementId="com.minres.scviewer.e4.application.commandparameter.changevaluedisplay" name="Type" optional="false"/>
|
<parameters xmi:id="_4C_asc3ZEei6rfTGo88R-w" elementId="com.minres.scviewer.e4.application.commandparameter.changevaluedisplay" name="Type" optional="false"/>
|
||||||
</commands>
|
</commands>
|
||||||
|
<commands xmi:id="_uyeyYGtTEeqmlpoaaMHoiw" elementId="com.minres.scviewer.e4.application.command.enablehover" commandName="Enable hover" description="Enable hover window in waveform"/>
|
||||||
<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="_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"/>
|
<addons xmi:id="_95Pfs3NmEeWBq8z1Dv39LA" elementId="org.eclipse.e4.ui.contexts.service" contributionURI="bundleclass://org.eclipse.e4.ui.services/org.eclipse.e4.ui.services.ContextServiceAddon"/>
|
||||||
<addons xmi:id="_95PftHNmEeWBq8z1Dv39LA" elementId="org.eclipse.e4.ui.bindings.service" contributionURI="bundleclass://org.eclipse.e4.ui.bindings/org.eclipse.e4.ui.bindings.BindingServiceAddon"/>
|
<addons xmi:id="_95PftHNmEeWBq8z1Dv39LA" elementId="org.eclipse.e4.ui.bindings.service" contributionURI="bundleclass://org.eclipse.e4.ui.bindings/org.eclipse.e4.ui.bindings.BindingServiceAddon"/>
|
||||||
|
|
|
@ -2,37 +2,37 @@ Manifest-Version: 1.0
|
||||||
Bundle-ManifestVersion: 2
|
Bundle-ManifestVersion: 2
|
||||||
Bundle-Name: %Bundle-Name
|
Bundle-Name: %Bundle-Name
|
||||||
Bundle-SymbolicName: com.minres.scviewer.e4.application;singleton:=true
|
Bundle-SymbolicName: com.minres.scviewer.e4.application;singleton:=true
|
||||||
Bundle-Version: 2.3.0.qualifier
|
Bundle-Version: 2.4.1.qualifier
|
||||||
Bundle-Vendor: %Bundle-Vendor
|
Bundle-Vendor: %Bundle-Vendor
|
||||||
Require-Bundle: javax.inject;bundle-version="1.0.0",
|
Require-Bundle: javax.inject;bundle-version="1.0.0",
|
||||||
org.eclipse.core.runtime;bundle-version="3.11.1",
|
org.eclipse.core.runtime;bundle-version="3.11.1",
|
||||||
org.eclipse.swt;bundle-version="3.104.1",
|
org.eclipse.swt;bundle-version="3.104.1",
|
||||||
org.eclipse.e4.ui.model.workbench;bundle-version="1.1.100",
|
org.eclipse.e4.ui.model.workbench;bundle-version="1.1.100",
|
||||||
org.eclipse.jface;bundle-version="3.11.0",
|
org.eclipse.jface;bundle-version="3.11.0",
|
||||||
org.eclipse.e4.ui.services;bundle-version="1.2.0",
|
org.eclipse.e4.ui.services;bundle-version="1.2.0",
|
||||||
org.eclipse.e4.ui.workbench;bundle-version="1.3.0",
|
org.eclipse.e4.ui.workbench;bundle-version="1.3.0",
|
||||||
org.eclipse.e4.core.di;bundle-version="1.5.0",
|
org.eclipse.e4.core.di;bundle-version="1.5.0",
|
||||||
org.eclipse.e4.ui.di;bundle-version="1.1.0",
|
org.eclipse.e4.ui.di;bundle-version="1.1.0",
|
||||||
org.eclipse.e4.core.contexts;bundle-version="1.4.0",
|
org.eclipse.e4.core.contexts;bundle-version="1.4.0",
|
||||||
com.minres.scviewer.database.ui.swt;bundle-version="1.0.0",
|
com.minres.scviewer.database.ui.swt;bundle-version="1.0.0",
|
||||||
com.minres.scviewer.database.ui,
|
com.minres.scviewer.database.ui,
|
||||||
com.minres.scviewer.database;bundle-version="1.0.0",
|
com.minres.scviewer.database;bundle-version="1.0.0",
|
||||||
org.eclipse.equinox.ds;bundle-version="1.4.300",
|
org.eclipse.equinox.ds;bundle-version="1.4.300",
|
||||||
org.eclipse.equinox.util;bundle-version="1.0.500",
|
org.eclipse.equinox.util;bundle-version="1.0.500",
|
||||||
org.eclipse.osgi.services;bundle-version="3.5.0",
|
org.eclipse.osgi.services;bundle-version="3.5.0",
|
||||||
org.eclipse.e4.core.services;bundle-version="2.0.0",
|
org.eclipse.e4.core.services;bundle-version="2.0.0",
|
||||||
org.eclipse.osgi.services;bundle-version="3.5.0",
|
org.eclipse.osgi.services;bundle-version="3.5.0",
|
||||||
org.eclipse.core.jobs,
|
org.eclipse.core.jobs,
|
||||||
org.eclipse.osgi,
|
org.eclipse.osgi,
|
||||||
com.google.guava,
|
com.google.guava,
|
||||||
org.eclipse.equinox.preferences,
|
org.eclipse.equinox.preferences,
|
||||||
org.eclipse.core.expressions,
|
org.eclipse.core.expressions,
|
||||||
org.eclipse.e4.core.commands;bundle-version="0.11.0",
|
org.eclipse.e4.core.commands;bundle-version="0.11.0",
|
||||||
org.eclipse.e4.ui.workbench.addons.swt,
|
org.eclipse.e4.ui.workbench.addons.swt,
|
||||||
com.opcoach.e4.preferences,
|
com.opcoach.e4.preferences,
|
||||||
org.eclipse.e4.core.di.extensions,
|
org.eclipse.e4.core.di.extensions,
|
||||||
org.eclipse.e4.ui.css.swt.theme;bundle-version="0.10.0"
|
org.eclipse.e4.ui.css.swt.theme;bundle-version="0.10.0"
|
||||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
|
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
|
||||||
Import-Package: com.minres.scviewer.database,
|
Import-Package: com.minres.scviewer.database,
|
||||||
javax.inject;version="1.0.0"
|
javax.inject;version="1.0.0"
|
||||||
Automatic-Module-Name: com.minres.scviewer.e4.application
|
Automatic-Module-Name: com.minres.scviewer.e4.application
|
||||||
|
|
Binary file not shown.
After Width: | Height: | Size: 782 B |
Binary file not shown.
After Width: | Height: | Size: 657 B |
Binary file not shown.
After Width: | Height: | Size: 615 B |
Binary file not shown.
After Width: | Height: | Size: 680 B |
|
@ -1,7 +1,7 @@
|
||||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<artifactId>com.minres.scviewer.e4.application</artifactId>
|
<artifactId>com.minres.scviewer.e4.application</artifactId>
|
||||||
<version>2.3.0-SNAPSHOT</version>
|
<version>2.4.1-SNAPSHOT</version>
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.minres.scviewer</groupId>
|
<groupId>com.minres.scviewer</groupId>
|
||||||
<artifactId>com.minres.scviewer.parent</artifactId>
|
<artifactId>com.minres.scviewer.parent</artifactId>
|
||||||
|
|
|
@ -86,7 +86,7 @@ public class E4LifeCycle {
|
||||||
ContextInjectionFactory.inject(openViewHandler, ctx);
|
ContextInjectionFactory.inject(openViewHandler, ctx);
|
||||||
eventBroker.unsubscribe(this);
|
eventBroker.unsubscribe(this);
|
||||||
for(String name:opt.getSet().getData()){
|
for(String name:opt.getSet().getData()){
|
||||||
if(new File(name).exists()) openViewHandler.openViewForFile(name);
|
openViewHandler.openViewForFile(name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -159,6 +159,8 @@ public class E4LifeCycle {
|
||||||
*/
|
*/
|
||||||
public void openViewForFile(String name){
|
public void openViewForFile(String name){
|
||||||
File file = new File(getFirstFileName(name));
|
File file = new File(getFirstFileName(name));
|
||||||
|
if(!file.exists())
|
||||||
|
return;
|
||||||
MPart part = partService.createPart("com.minres.scviewer.e4.application.partdescriptor.waveformviewer"); //$NON-NLS-1$
|
MPart part = partService.createPart("com.minres.scviewer.e4.application.partdescriptor.waveformviewer"); //$NON-NLS-1$
|
||||||
part.setLabel(file.getName());
|
part.setLabel(file.getName());
|
||||||
MPartStack partStack = (MPartStack)modelService.find("org.eclipse.editorss", app); //$NON-NLS-1$
|
MPartStack partStack = (MPartStack)modelService.find("org.eclipse.editorss", app); //$NON-NLS-1$
|
||||||
|
@ -172,7 +174,7 @@ public class E4LifeCycle {
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getFirstFileName(String name) {
|
private String getFirstFileName(String name) {
|
||||||
if(name.contains(":")) {
|
if(name.contains(",")) {
|
||||||
String[] tokens = name.split(",");
|
String[] tokens = name.split(",");
|
||||||
return tokens[0];
|
return tokens[0];
|
||||||
} else
|
} else
|
||||||
|
|
|
@ -22,6 +22,7 @@ public class Messages extends NLS {
|
||||||
public static String RelationTypeToolControl_1;
|
public static String RelationTypeToolControl_1;
|
||||||
public static String ResourceManager_0;
|
public static String ResourceManager_0;
|
||||||
public static String SCViewerPreferencesPage_0;
|
public static String SCViewerPreferencesPage_0;
|
||||||
|
public static String SCViewerPreferencesPage_1;
|
||||||
public static String StatusBarControl_1;
|
public static String StatusBarControl_1;
|
||||||
public static String StatusBarControl_2;
|
public static String StatusBarControl_2;
|
||||||
public static String StatusBarControl_3;
|
public static String StatusBarControl_3;
|
||||||
|
|
|
@ -0,0 +1,49 @@
|
||||||
|
|
||||||
|
package com.minres.scviewer.e4.application.handlers;
|
||||||
|
|
||||||
|
import java.util.LinkedList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import javax.annotation.PostConstruct;
|
||||||
|
import javax.inject.Inject;
|
||||||
|
|
||||||
|
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
|
||||||
|
import org.eclipse.e4.core.contexts.Active;
|
||||||
|
import org.eclipse.e4.core.di.annotations.Execute;
|
||||||
|
import org.eclipse.e4.core.di.extensions.Preference;
|
||||||
|
import org.eclipse.e4.ui.model.application.MApplication;
|
||||||
|
import org.eclipse.e4.ui.model.application.ui.basic.MPart;
|
||||||
|
import org.eclipse.e4.ui.model.application.ui.basic.MWindow;
|
||||||
|
import org.eclipse.e4.ui.model.application.ui.menu.MHandledItem;
|
||||||
|
import org.eclipse.e4.ui.workbench.modeling.EModelService;
|
||||||
|
|
||||||
|
import com.minres.scviewer.e4.application.preferences.PreferenceConstants;
|
||||||
|
|
||||||
|
@SuppressWarnings("restriction")
|
||||||
|
public class EnableHover {
|
||||||
|
static final String TAG_NAME = "EnableHover"; //$NON-NLS-1$
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
@Preference(nodePath = PreferenceConstants.PREFERENCES_SCOPE)
|
||||||
|
IEclipsePreferences prefs;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
MApplication application;
|
||||||
|
|
||||||
|
@PostConstruct
|
||||||
|
public void initialize(EModelService modelService) {
|
||||||
|
List<String> tags = new LinkedList<>();
|
||||||
|
tags.add(TAG_NAME);
|
||||||
|
List<MHandledItem> elements = modelService.findElements(application, null, MHandledItem.class, tags );
|
||||||
|
// cover initialization stuff, sync it with code
|
||||||
|
for( MHandledItem hi : elements ){
|
||||||
|
hi.setSelected(prefs.getBoolean(PreferenceConstants.SHOW_HOVER, true));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Execute
|
||||||
|
public void execute(@Active MPart part, @Active MWindow window, MHandledItem handledItem, EModelService modelService ) {
|
||||||
|
prefs.putBoolean(PreferenceConstants.SHOW_HOVER, handledItem.isSelected());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -32,7 +32,9 @@ public class OpenHandler {
|
||||||
public void execute(Shell shell, MApplication app, EModelService modelService, EPartService partService){
|
public void execute(Shell shell, MApplication app, EModelService modelService, EPartService partService){
|
||||||
FileDialog dialog = new FileDialog(shell, SWT.OPEN | SWT.MULTI);
|
FileDialog dialog = new FileDialog(shell, SWT.OPEN | SWT.MULTI);
|
||||||
dialog.setFilterExtensions (new String []{Messages.OpenHandler_0});
|
dialog.setFilterExtensions (new String []{Messages.OpenHandler_0});
|
||||||
dialog.open();
|
String ret = dialog.open();
|
||||||
|
if(ret==null)
|
||||||
|
return;
|
||||||
String path = dialog.getFilterPath();
|
String path = dialog.getFilterPath();
|
||||||
ArrayList<File> files = new ArrayList<File>();
|
ArrayList<File> files = new ArrayList<File>();
|
||||||
for(String fileName: dialog.getFileNames()){
|
for(String fileName: dialog.getFileNames()){
|
||||||
|
|
|
@ -16,6 +16,7 @@ RelationTypeToolControl_0=------------
|
||||||
RelationTypeToolControl_1=Select
|
RelationTypeToolControl_1=Select
|
||||||
ResourceManager_0=Wrong decorate corner
|
ResourceManager_0=Wrong decorate corner
|
||||||
SCViewerPreferencesPage_0=Check for changed database
|
SCViewerPreferencesPage_0=Check for changed database
|
||||||
|
SCViewerPreferencesPage_1=Show hover window in waveform
|
||||||
StatusBarControl_1=Currently running:
|
StatusBarControl_1=Currently running:
|
||||||
StatusBarControl_2=\nLast task:
|
StatusBarControl_2=\nLast task:
|
||||||
StatusBarControl_3=Currently running:
|
StatusBarControl_3=Currently running:
|
||||||
|
|
|
@ -50,9 +50,6 @@ import com.minres.scviewer.e4.application.Messages;
|
||||||
*/
|
*/
|
||||||
public class AboutDialog extends Dialog {
|
public class AboutDialog extends Dialog {
|
||||||
|
|
||||||
/** The product title. */
|
|
||||||
private String productTitle=Messages.AboutDialog_0;
|
|
||||||
|
|
||||||
/** The copyright text. */
|
/** The copyright text. */
|
||||||
private String copyrightText=Messages.AboutDialog_1;
|
private String copyrightText=Messages.AboutDialog_1;
|
||||||
|
|
||||||
|
@ -106,8 +103,8 @@ public class AboutDialog extends Dialog {
|
||||||
styledText.setLayoutData(gd_styledText);
|
styledText.setLayoutData(gd_styledText);
|
||||||
Version version = Platform.getProduct().getDefiningBundle().getVersion();
|
Version version = Platform.getProduct().getDefiningBundle().getVersion();
|
||||||
String versionString = String.format("%d.%d.%d", version.getMajor(), version.getMinor(), version.getMicro());
|
String versionString = String.format("%d.%d.%d", version.getMajor(), version.getMinor(), version.getMicro());
|
||||||
String pt = NLS.bind(Messages.AboutDialog_0, versionString);
|
String productTitle = NLS.bind(Messages.AboutDialog_0, versionString);
|
||||||
styledText.setText(pt+copyrightText);
|
styledText.setText(productTitle+copyrightText);
|
||||||
styledText.setBackground(white);
|
styledText.setBackground(white);
|
||||||
styledText.setWordWrap(true);
|
styledText.setWordWrap(true);
|
||||||
styledText.setLeftMargin(5);
|
styledText.setLeftMargin(5);
|
||||||
|
|
|
@ -188,9 +188,9 @@ public class TransactionDetails {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
// Pack the columns
|
// Pack the columns
|
||||||
// for (int i = 0, n = table.getColumnCount(); i < n; i++) {
|
// for (int i = 0, n = table.getColumnCount(); i < n; i++) {
|
||||||
// table.getColumn(i).pack();
|
// table.getColumn(i).pack();
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// Turn on the header and the lines
|
// Turn on the header and the lines
|
||||||
tree.setHeaderVisible(true);
|
tree.setHeaderVisible(true);
|
||||||
|
@ -375,8 +375,8 @@ public class TransactionDetails {
|
||||||
*/
|
*/
|
||||||
String txToString(ITx tx){
|
String txToString(ITx tx){
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
sb.append("tx#").append(tx.getId()).append("[").append(timeToString(tx.getBeginTime())). //$NON-NLS-1$ //$NON-NLS-2$
|
sb.append("tx#").append(tx.getId()).append("[").append(timeToString(tx.getBeginTime())); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
append(" - ").append(timeToString(tx.getEndTime())).append("]"); //$NON-NLS-1$ //$NON-NLS-2$
|
sb.append(" - ").append(timeToString(tx.getEndTime())).append("]"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
return sb.toString();
|
return sb.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -491,10 +491,10 @@ public class TransactionDetails {
|
||||||
* The Enum Type.
|
* The Enum Type.
|
||||||
*/
|
*/
|
||||||
enum Type {/** The props. */
|
enum Type {/** The props. */
|
||||||
PROPS, /** The attrs. */
|
PROPS, /** The attrs. */
|
||||||
ATTRS, /** The in rel. */
|
ATTRS, /** The in rel. */
|
||||||
IN_REL, /** The out rel. */
|
IN_REL, /** The out rel. */
|
||||||
OUT_REL}
|
OUT_REL}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Class TreeNode.
|
* The Class TreeNode.
|
||||||
|
@ -678,13 +678,18 @@ PROPS, /** The attrs. */
|
||||||
String value = attribute.getValue().toString();
|
String value = attribute.getValue().toString();
|
||||||
if((DataType.UNSIGNED == attribute.getDataType() || DataType.INTEGER==attribute.getDataType()) && !"0".equals(value)) {
|
if((DataType.UNSIGNED == attribute.getDataType() || DataType.INTEGER==attribute.getDataType()) && !"0".equals(value)) {
|
||||||
try {
|
try {
|
||||||
value = attribute.getValue().toString() + " [0x"+Long.toHexString(Long.parseLong(attribute.getValue().toString()))+"]";
|
value += " [0x"+Long.toHexString(Long.parseLong(attribute.getValue().toString()))+"]";
|
||||||
} catch(NumberFormatException e) { }
|
} catch(NumberFormatException e) { }
|
||||||
}
|
}
|
||||||
return new StyledString(value);
|
return new StyledString(value);
|
||||||
}else if(element instanceof Object[]){
|
}else if(element instanceof Object[]){
|
||||||
Object[] elements = (Object[]) element;
|
Object[] elements = (Object[]) element;
|
||||||
return new StyledString(elements[field].toString());
|
Object o = elements[field];
|
||||||
|
if(o instanceof ITx) {
|
||||||
|
ITx tx = (ITx)o;
|
||||||
|
return new StyledString(txToString(tx)+" ("+tx.getStream().getFullName()+")");
|
||||||
|
} else
|
||||||
|
return new StyledString(o.toString());
|
||||||
} else if(element instanceof ITx){
|
} else if(element instanceof ITx){
|
||||||
return new StyledString(txToString((ITx) element));
|
return new StyledString(txToString((ITx) element));
|
||||||
}else
|
}else
|
||||||
|
|
|
@ -31,6 +31,7 @@ import javax.annotation.PostConstruct;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import javax.inject.Named;
|
import javax.inject.Named;
|
||||||
|
|
||||||
|
import org.eclipse.core.internal.preferences.InstancePreferences;
|
||||||
import org.eclipse.core.runtime.IProgressMonitor;
|
import org.eclipse.core.runtime.IProgressMonitor;
|
||||||
import org.eclipse.core.runtime.IStatus;
|
import org.eclipse.core.runtime.IStatus;
|
||||||
import org.eclipse.core.runtime.MultiStatus;
|
import org.eclipse.core.runtime.MultiStatus;
|
||||||
|
@ -41,9 +42,11 @@ import org.eclipse.core.runtime.jobs.IJobChangeEvent;
|
||||||
import org.eclipse.core.runtime.jobs.Job;
|
import org.eclipse.core.runtime.jobs.Job;
|
||||||
import org.eclipse.core.runtime.jobs.JobChangeAdapter;
|
import org.eclipse.core.runtime.jobs.JobChangeAdapter;
|
||||||
import org.eclipse.core.runtime.jobs.JobGroup;
|
import org.eclipse.core.runtime.jobs.JobGroup;
|
||||||
|
import org.eclipse.core.runtime.preferences.ConfigurationScope;
|
||||||
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
|
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
|
||||||
import org.eclipse.core.runtime.preferences.IEclipsePreferences.IPreferenceChangeListener;
|
import org.eclipse.core.runtime.preferences.IEclipsePreferences.IPreferenceChangeListener;
|
||||||
import org.eclipse.core.runtime.preferences.IEclipsePreferences.PreferenceChangeEvent;
|
import org.eclipse.core.runtime.preferences.IEclipsePreferences.PreferenceChangeEvent;
|
||||||
|
import org.eclipse.e4.core.contexts.IEclipseContext;
|
||||||
import org.eclipse.e4.core.di.annotations.Optional;
|
import org.eclipse.e4.core.di.annotations.Optional;
|
||||||
import org.eclipse.e4.core.di.extensions.Preference;
|
import org.eclipse.e4.core.di.extensions.Preference;
|
||||||
import org.eclipse.e4.core.services.events.IEventBroker;
|
import org.eclipse.e4.core.services.events.IEventBroker;
|
||||||
|
@ -65,14 +68,28 @@ import org.eclipse.jface.viewers.StructuredSelection;
|
||||||
import org.eclipse.swt.SWT;
|
import org.eclipse.swt.SWT;
|
||||||
import org.eclipse.swt.events.DisposeEvent;
|
import org.eclipse.swt.events.DisposeEvent;
|
||||||
import org.eclipse.swt.events.DisposeListener;
|
import org.eclipse.swt.events.DisposeListener;
|
||||||
|
import org.eclipse.swt.events.FocusListener;
|
||||||
|
import org.eclipse.swt.events.PaintEvent;
|
||||||
|
import org.eclipse.swt.events.PaintListener;
|
||||||
|
import org.eclipse.swt.graphics.Font;
|
||||||
|
import org.eclipse.swt.graphics.Point;
|
||||||
import org.eclipse.swt.graphics.RGB;
|
import org.eclipse.swt.graphics.RGB;
|
||||||
import org.eclipse.swt.graphics.Rectangle;
|
import org.eclipse.swt.graphics.Rectangle;
|
||||||
|
import org.eclipse.swt.layout.GridData;
|
||||||
import org.eclipse.swt.widgets.Composite;
|
import org.eclipse.swt.widgets.Composite;
|
||||||
import org.eclipse.swt.widgets.Display;
|
import org.eclipse.swt.widgets.Display;
|
||||||
import org.eclipse.swt.widgets.Event;
|
import org.eclipse.swt.widgets.Event;
|
||||||
|
import org.eclipse.swt.widgets.Label;
|
||||||
import org.eclipse.swt.widgets.Listener;
|
import org.eclipse.swt.widgets.Listener;
|
||||||
|
import org.eclipse.swt.widgets.Table;
|
||||||
|
import org.eclipse.swt.widgets.TableColumn;
|
||||||
|
import org.eclipse.swt.widgets.TableItem;
|
||||||
|
import org.eclipse.swt.widgets.Widget;
|
||||||
|
import org.osgi.service.prefs.BackingStoreException;
|
||||||
|
|
||||||
|
import com.minres.scviewer.database.DataType;
|
||||||
import com.minres.scviewer.database.ITx;
|
import com.minres.scviewer.database.ITx;
|
||||||
|
import com.minres.scviewer.database.ITxAttribute;
|
||||||
import com.minres.scviewer.database.ITxEvent;
|
import com.minres.scviewer.database.ITxEvent;
|
||||||
import com.minres.scviewer.database.ITxRelation;
|
import com.minres.scviewer.database.ITxRelation;
|
||||||
import com.minres.scviewer.database.IWaveform;
|
import com.minres.scviewer.database.IWaveform;
|
||||||
|
@ -80,6 +97,8 @@ import com.minres.scviewer.database.IWaveformDb;
|
||||||
import com.minres.scviewer.database.IWaveformDbFactory;
|
import com.minres.scviewer.database.IWaveformDbFactory;
|
||||||
import com.minres.scviewer.database.RelationType;
|
import com.minres.scviewer.database.RelationType;
|
||||||
import com.minres.scviewer.database.swt.Constants;
|
import com.minres.scviewer.database.swt.Constants;
|
||||||
|
import com.minres.scviewer.database.swt.ToolTipContentProvider;
|
||||||
|
import com.minres.scviewer.database.swt.ToolTipHelpTextProvider;
|
||||||
import com.minres.scviewer.database.swt.WaveformViewerFactory;
|
import com.minres.scviewer.database.swt.WaveformViewerFactory;
|
||||||
import com.minres.scviewer.database.ui.GotoDirection;
|
import com.minres.scviewer.database.ui.GotoDirection;
|
||||||
import com.minres.scviewer.database.ui.ICursor;
|
import com.minres.scviewer.database.ui.ICursor;
|
||||||
|
@ -178,8 +197,8 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
|
||||||
|
|
||||||
/** The prefs. */
|
/** The prefs. */
|
||||||
@Inject
|
@Inject
|
||||||
@Preference(nodePath = PreferenceConstants.PREFERENCES_SCOPE)
|
@Preference(value = ConfigurationScope.SCOPE, nodePath = PreferenceConstants.PREFERENCES_SCOPE)
|
||||||
IEclipsePreferences prefs;
|
protected IEclipsePreferences prefs;
|
||||||
|
|
||||||
@Inject @Optional DesignBrowser designBrowser;
|
@Inject @Optional DesignBrowser designBrowser;
|
||||||
|
|
||||||
|
@ -366,6 +385,100 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
|
||||||
prefs.addPreferenceChangeListener(this);
|
prefs.addPreferenceChangeListener(this);
|
||||||
|
|
||||||
waveformPane.addDisposeListener(this);
|
waveformPane.addDisposeListener(this);
|
||||||
|
|
||||||
|
waveformPane.getWaveformControl().setData(Constants.HELP_PROVIDER_TAG, new ToolTipHelpTextProvider() {
|
||||||
|
@Override
|
||||||
|
public String getHelpText(Widget widget) {
|
||||||
|
return "Waveform pane: press F2 to set the focus to the tooltip";
|
||||||
|
}
|
||||||
|
});
|
||||||
|
waveformPane.getWaveformControl().setData(Constants.CONTENT_PROVIDER_TAG, new ToolTipContentProvider() {
|
||||||
|
@Override
|
||||||
|
public boolean createContent(Composite parent, Point pt) {
|
||||||
|
if(!prefs.getBoolean(PreferenceConstants.SHOW_HOVER, true)) return false;
|
||||||
|
List<Object> res = waveformPane.getElementsAt(pt);
|
||||||
|
if(res.size()>0)
|
||||||
|
if(res.get(0) instanceof ITx) {
|
||||||
|
ITx tx = (ITx)res.get(0);
|
||||||
|
final Display display = parent.getDisplay();
|
||||||
|
final Font font = new Font(Display.getCurrent(), "Terminal", 10, SWT.NORMAL);
|
||||||
|
|
||||||
|
final Label label = new Label(parent, SWT.NONE);
|
||||||
|
// label.setForeground(display.getSystemColor(SWT.COLOR_INFO_FOREGROUND));
|
||||||
|
// label.setBackground(display.getSystemColor(SWT.COLOR_INFO_BACKGROUND));
|
||||||
|
label.setText(tx.toString());
|
||||||
|
label.setFont(font);
|
||||||
|
GridData labelGridData = new GridData();
|
||||||
|
labelGridData.horizontalAlignment = GridData.FILL;
|
||||||
|
labelGridData.grabExcessHorizontalSpace = true;
|
||||||
|
label.setLayoutData(labelGridData);
|
||||||
|
|
||||||
|
final Table table = new Table(parent, SWT.NONE);
|
||||||
|
table.setHeaderVisible(true);
|
||||||
|
table.setLinesVisible(true);
|
||||||
|
table.setFont(font);
|
||||||
|
// table.setForeground(display.getSystemColor(SWT.COLOR_INFO_FOREGROUND));
|
||||||
|
// table.setBackground(display.getSystemColor(SWT.COLOR_INFO_BACKGROUND));
|
||||||
|
table.setRedraw(false);
|
||||||
|
GridData tableGridData = new GridData();
|
||||||
|
tableGridData.horizontalAlignment = GridData.FILL;
|
||||||
|
tableGridData.grabExcessHorizontalSpace = true;
|
||||||
|
table.setLayoutData(tableGridData);
|
||||||
|
|
||||||
|
final TableColumn nameCol = new TableColumn(table, SWT.LEFT);
|
||||||
|
nameCol.setText("Attribute");
|
||||||
|
final TableColumn valueCol = new TableColumn(table, SWT.LEFT);
|
||||||
|
valueCol.setText("Value");
|
||||||
|
|
||||||
|
for (ITxAttribute iTxAttribute : tx.getAttributes()) {
|
||||||
|
String value = iTxAttribute.getValue().toString();
|
||||||
|
if((DataType.UNSIGNED == iTxAttribute.getDataType() || DataType.INTEGER==iTxAttribute.getDataType()) && !"0".equals(value)) {
|
||||||
|
try {
|
||||||
|
value += " [0x"+Long.toHexString(Long.parseLong(iTxAttribute.getValue().toString()))+"]";
|
||||||
|
} catch(NumberFormatException e) { }
|
||||||
|
}
|
||||||
|
TableItem item = new TableItem(table, SWT.NONE);
|
||||||
|
item.setText(0, iTxAttribute.getName());
|
||||||
|
item.setText(1, value);
|
||||||
|
}
|
||||||
|
TableItem item = new TableItem(table, SWT.NONE);
|
||||||
|
item.setText(0, "");
|
||||||
|
item.setText(1, "");
|
||||||
|
nameCol.pack();
|
||||||
|
valueCol.pack();
|
||||||
|
table.pack();
|
||||||
|
table.setRedraw(true);
|
||||||
|
|
||||||
|
parent.addPaintListener(new PaintListener() {
|
||||||
|
@Override
|
||||||
|
public void paintControl(PaintEvent e) {
|
||||||
|
Rectangle area = parent.getClientArea();
|
||||||
|
valueCol.setWidth(area.width - nameCol.getWidth());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
parent.addFocusListener(FocusListener.focusGainedAdapter(e -> {
|
||||||
|
table.setFocus();
|
||||||
|
}));
|
||||||
|
return true;
|
||||||
|
} else if(res.get(0) instanceof TrackEntry) {
|
||||||
|
TrackEntry te = (TrackEntry)res.get(0);
|
||||||
|
final Display display = parent.getDisplay();
|
||||||
|
final Font font = new Font(Display.getCurrent(), "Terminal", 10, SWT.NORMAL);
|
||||||
|
|
||||||
|
final Label label = new Label(parent, SWT.NONE);
|
||||||
|
//label.setForeground(display.getSystemColor(SWT.COLOR_INFO_FOREGROUND));
|
||||||
|
//label.setBackground(display.getSystemColor(SWT.COLOR_INFO_BACKGROUND));
|
||||||
|
label.setText(te.waveform.getFullName());
|
||||||
|
label.setFont(font);
|
||||||
|
GridData labelGridData = new GridData();
|
||||||
|
labelGridData.horizontalAlignment = GridData.FILL;
|
||||||
|
labelGridData.grabExcessHorizontalSpace = true;
|
||||||
|
label.setLayoutData(labelGridData);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
|
@ -373,17 +486,21 @@ public class WaveformViewer implements IFileChangeListener, IPreferenceChangeLis
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void preferenceChange(PreferenceChangeEvent event) {
|
public void preferenceChange(PreferenceChangeEvent event) {
|
||||||
|
InstancePreferences pref = (InstancePreferences)event.getSource();
|
||||||
if (PreferenceConstants.DATABASE_RELOAD.equals(event.getKey())) {
|
if (PreferenceConstants.DATABASE_RELOAD.equals(event.getKey())) {
|
||||||
checkForUpdates = (Boolean) event.getNewValue();
|
checkForUpdates = pref.getBoolean(PreferenceConstants.DATABASE_RELOAD, true);
|
||||||
fileChecker = null;
|
fileChecker = null;
|
||||||
if (checkForUpdates)
|
if (checkForUpdates)
|
||||||
fileChecker = fileMonitor.addFileChangeListener(WaveformViewer.this, filesToLoad,
|
fileChecker = fileMonitor.addFileChangeListener(WaveformViewer.this, filesToLoad,
|
||||||
FILE_CHECK_INTERVAL);
|
FILE_CHECK_INTERVAL);
|
||||||
else
|
else
|
||||||
fileMonitor.removeFileChangeListener(this);
|
fileMonitor.removeFileChangeListener(this);
|
||||||
} else {
|
} else if (!PreferenceConstants.SHOW_HOVER.equals(event.getKey())){
|
||||||
setupColors();
|
setupColors();
|
||||||
}
|
}
|
||||||
|
try {
|
||||||
|
pref.flush();
|
||||||
|
} catch (BackingStoreException e) { }
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -11,15 +11,14 @@
|
||||||
package com.minres.scviewer.e4.application.preferences;
|
package com.minres.scviewer.e4.application.preferences;
|
||||||
|
|
||||||
import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;
|
import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;
|
||||||
import org.eclipse.core.runtime.preferences.InstanceScope;
|
import org.eclipse.core.runtime.preferences.DefaultScope;
|
||||||
import org.eclipse.jface.preference.IPreferenceStore;
|
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
|
||||||
import org.eclipse.jface.resource.StringConverter;
|
import org.eclipse.jface.resource.StringConverter;
|
||||||
import org.eclipse.swt.SWT;
|
import org.eclipse.swt.SWT;
|
||||||
import org.eclipse.swt.graphics.Color;
|
import org.eclipse.swt.graphics.Color;
|
||||||
import org.eclipse.wb.swt.SWTResourceManager;
|
import org.eclipse.wb.swt.SWTResourceManager;
|
||||||
|
|
||||||
import com.minres.scviewer.database.ui.WaveformColors;
|
import com.minres.scviewer.database.ui.WaveformColors;
|
||||||
import com.opcoach.e4.preferences.ScopedPreferenceStore;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Class DefaultValuesInitializer.
|
* The Class DefaultValuesInitializer.
|
||||||
|
@ -64,12 +63,22 @@ public class DefaultValuesInitializer extends AbstractPreferenceInitializer {
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void initializeDefaultPreferences() {
|
public void initializeDefaultPreferences() {
|
||||||
IPreferenceStore store = new ScopedPreferenceStore(InstanceScope.INSTANCE, PreferenceConstants.PREFERENCES_SCOPE);
|
IEclipsePreferences node = DefaultScope.INSTANCE.getNode(PreferenceConstants.PREFERENCES_SCOPE);
|
||||||
|
if (node != null)
|
||||||
store.setDefault(PreferenceConstants.DATABASE_RELOAD, true);
|
{
|
||||||
for (WaveformColors c : WaveformColors.values()) {
|
node.putBoolean(PreferenceConstants.DATABASE_RELOAD, true);
|
||||||
store.setDefault(c.name()+"_COLOR", StringConverter.asString(colors[c.ordinal()].getRGB())); //$NON-NLS-1$
|
node.putBoolean(PreferenceConstants.SHOW_HOVER, true);
|
||||||
}
|
for (WaveformColors c : WaveformColors.values()) {
|
||||||
|
node.put(c.name()+"_COLOR", StringConverter.asString(colors[c.ordinal()].getRGB())); //$NON-NLS-1$
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// IPreferenceStore store = new ScopedPreferenceStore(InstanceScope.INSTANCE, PreferenceConstants.PREFERENCES_SCOPE);
|
||||||
|
//
|
||||||
|
// store.setDefault(PreferenceConstants.DATABASE_RELOAD, true);
|
||||||
|
// store.setDefault(PreferenceConstants.SHOW_HOVER, true);
|
||||||
|
// for (WaveformColors c : WaveformColors.values()) {
|
||||||
|
// store.setDefault(c.name()+"_COLOR", StringConverter.asString(colors[c.ordinal()].getRGB())); //$NON-NLS-1$
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,6 +21,9 @@ public class PreferenceConstants {
|
||||||
/** The Constant DATABASE_RELOAD. */
|
/** The Constant DATABASE_RELOAD. */
|
||||||
public static final String DATABASE_RELOAD="databaseReload"; //$NON-NLS-1$
|
public static final String DATABASE_RELOAD="databaseReload"; //$NON-NLS-1$
|
||||||
|
|
||||||
|
/** The Constant DATABASE_RELOAD. */
|
||||||
|
public static final String SHOW_HOVER="showWaveformHover"; //$NON-NLS-1$
|
||||||
|
|
||||||
/** The Constant LINE_COLOR. */
|
/** The Constant LINE_COLOR. */
|
||||||
public static final String LINE_COLOR="LINE_COLOR"; //$NON-NLS-1$
|
public static final String LINE_COLOR="LINE_COLOR"; //$NON-NLS-1$
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,18 @@
|
||||||
|
package com.minres.scviewer.e4.application.preferences;
|
||||||
|
import org.eclipse.core.runtime.preferences.ConfigurationScope;
|
||||||
|
import org.eclipse.jface.preference.IPreferenceStore;
|
||||||
|
|
||||||
|
import com.opcoach.e4.preferences.IPreferenceStoreProvider;
|
||||||
|
import com.opcoach.e4.preferences.ScopedPreferenceStore;
|
||||||
|
|
||||||
|
public class PreferencesStoreProvider implements IPreferenceStoreProvider{
|
||||||
|
|
||||||
|
public PreferencesStoreProvider(){
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IPreferenceStore getPreferenceStore() {
|
||||||
|
return new ScopedPreferenceStore(ConfigurationScope.INSTANCE, PreferenceConstants.PREFERENCES_SCOPE);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -36,6 +36,8 @@ public class SCViewerPreferencesPage extends FieldEditorPreferencePage {
|
||||||
|
|
||||||
addField(new BooleanFieldEditor(PreferenceConstants.DATABASE_RELOAD, Messages.SCViewerPreferencesPage_0,
|
addField(new BooleanFieldEditor(PreferenceConstants.DATABASE_RELOAD, Messages.SCViewerPreferencesPage_0,
|
||||||
getFieldEditorParent()));
|
getFieldEditorParent()));
|
||||||
|
addField(new BooleanFieldEditor(PreferenceConstants.SHOW_HOVER, Messages.SCViewerPreferencesPage_1,
|
||||||
|
getFieldEditorParent()));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
<relativePath>../com.minres.scviewer.parent</relativePath>
|
<relativePath>../com.minres.scviewer.parent</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<artifactId>com.minres.scviewer.e4.product</artifactId>
|
<artifactId>com.minres.scviewer.e4.product</artifactId>
|
||||||
<version>2.3.0-SNAPSHOT</version>
|
<version>2.4.1-SNAPSHOT</version>
|
||||||
<packaging>eclipse-repository</packaging>
|
<packaging>eclipse-repository</packaging>
|
||||||
<groupId>com.minres.scviewer</groupId>
|
<groupId>com.minres.scviewer</groupId>
|
||||||
<build>
|
<build>
|
||||||
|
|
|
@ -1,13 +1,14 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<?pde version="3.5"?>
|
<?pde version="3.5"?>
|
||||||
|
|
||||||
<product name="SCViewer" uid="scviewer" id="com.minres.scviewer.e4.application.product" application="org.eclipse.e4.ui.workbench.swt.E4Application" version="2.3.0.qualifier" useFeatures="false" includeLaunchers="true">
|
<product name="SCViewer" uid="scviewer" id="com.minres.scviewer.e4.application.product" application="org.eclipse.e4.ui.workbench.swt.E4Application" version="2.4.1.qualifier" useFeatures="false" includeLaunchers="true">
|
||||||
|
|
||||||
|
|
||||||
<configIni use="default">
|
<configIni use="default">
|
||||||
</configIni>
|
</configIni>
|
||||||
|
|
||||||
<launcherArgs>
|
<launcherArgs>
|
||||||
<programArgs>-clearPersistedState -data @none
|
<programArgs>-clearPersistedState
|
||||||
</programArgs>
|
</programArgs>
|
||||||
<vmArgs>-Xmx2G
|
<vmArgs>-Xmx2G
|
||||||
</vmArgs>
|
</vmArgs>
|
||||||
|
@ -33,6 +34,7 @@
|
||||||
</win>
|
</win>
|
||||||
</launcher>
|
</launcher>
|
||||||
|
|
||||||
|
|
||||||
<vm>
|
<vm>
|
||||||
<linux include="false">org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8</linux>
|
<linux include="false">org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8</linux>
|
||||||
<macos include="false">org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8</macos>
|
<macos include="false">org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8</macos>
|
||||||
|
@ -47,7 +49,6 @@
|
||||||
<plugin id="com.google.guava"/>
|
<plugin id="com.google.guava"/>
|
||||||
<plugin id="com.ibm.icu"/>
|
<plugin id="com.ibm.icu"/>
|
||||||
<plugin id="com.minres.scviewer.database"/>
|
<plugin id="com.minres.scviewer.database"/>
|
||||||
<plugin id="com.minres.scviewer.database.leveldb"/>
|
|
||||||
<plugin id="com.minres.scviewer.database.sqlite"/>
|
<plugin id="com.minres.scviewer.database.sqlite"/>
|
||||||
<plugin id="com.minres.scviewer.database.text"/>
|
<plugin id="com.minres.scviewer.database.text"/>
|
||||||
<plugin id="com.minres.scviewer.database.ui"/>
|
<plugin id="com.minres.scviewer.database.ui"/>
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
<module>../com.minres.scviewer.database.sqlite</module>
|
<module>../com.minres.scviewer.database.sqlite</module>
|
||||||
<module>../com.minres.scviewer.database.text</module>
|
<module>../com.minres.scviewer.database.text</module>
|
||||||
<module>../com.minres.scviewer.database.vcd</module>
|
<module>../com.minres.scviewer.database.vcd</module>
|
||||||
<module>../com.minres.scviewer.database.leveldb</module>
|
<!-- <module>../com.minres.scviewer.database.leveldb</module> -->
|
||||||
<module>../com.minres.scviewer.database.test</module>
|
<module>../com.minres.scviewer.database.test</module>
|
||||||
<module>../com.minres.scviewer.database.ui</module>
|
<module>../com.minres.scviewer.database.ui</module>
|
||||||
<module>../com.minres.scviewer.database.ui.swt</module>
|
<module>../com.minres.scviewer.database.ui.swt</module>
|
||||||
|
|
|
@ -46,6 +46,7 @@ public class E4PreferenceRegistry
|
||||||
|
|
||||||
public static final String PREFS_PAGE_XP = "com.opcoach.e4.preferences.e4PreferencePages"; // $NON-NLS-1$
|
public static final String PREFS_PAGE_XP = "com.opcoach.e4.preferences.e4PreferencePages"; // $NON-NLS-1$
|
||||||
public static final String PREF_STORE_PROVIDER = "com.opcoach.e4.preferences.e4PreferenceStoreProvider"; // $NON-NLS-1$
|
public static final String PREF_STORE_PROVIDER = "com.opcoach.e4.preferences.e4PreferenceStoreProvider"; // $NON-NLS-1$
|
||||||
|
public static final String KEY_PREF_STORE_PROVIDERS = "com.opcoach.e4.preferences.e4PreferenceStoreProviders"; // $NON-NLS-1$
|
||||||
protected static final String ELMT_PAGE = "page"; // $NON-NLS-1$
|
protected static final String ELMT_PAGE = "page"; // $NON-NLS-1$
|
||||||
protected static final String ATTR_ID = "id"; // $NON-NLS-1$
|
protected static final String ATTR_ID = "id"; // $NON-NLS-1$
|
||||||
protected static final String ATTR_CATEGORY = "category"; // $NON-NLS-1$
|
protected static final String ATTR_CATEGORY = "category"; // $NON-NLS-1$
|
||||||
|
@ -235,6 +236,7 @@ public class E4PreferenceRegistry
|
||||||
IContributionFactory factory = context.get(IContributionFactory.class);
|
IContributionFactory factory = context.get(IContributionFactory.class);
|
||||||
|
|
||||||
psProviders = new HashMap<String, Object>();
|
psProviders = new HashMap<String, Object>();
|
||||||
|
IExtensionRegistry registry = context.get(IExtensionRegistry.class);
|
||||||
|
|
||||||
// Read extensions and fill the map...
|
// Read extensions and fill the map...
|
||||||
for (IConfigurationElement elmt : registry.getConfigurationElementsFor(PREF_STORE_PROVIDER))
|
for (IConfigurationElement elmt : registry.getConfigurationElementsFor(PREF_STORE_PROVIDER))
|
||||||
|
@ -261,7 +263,7 @@ public class E4PreferenceRegistry
|
||||||
Object data = objectId;
|
Object data = objectId;
|
||||||
if (classname != null)
|
if (classname != null)
|
||||||
{
|
{
|
||||||
data = factory.create(classname, context);
|
data = factory.create("bundleclass://"+declaringBundle+"/"+classname, context);
|
||||||
if (!(data instanceof IPreferenceStoreProvider))
|
if (!(data instanceof IPreferenceStoreProvider))
|
||||||
{
|
{
|
||||||
logger.warn("In extension " + PREF_STORE_PROVIDER + " the class must implements IPreferenceStoreProvider. Check the plugin " + declaringBundle);
|
logger.warn("In extension " + PREF_STORE_PROVIDER + " the class must implements IPreferenceStoreProvider. Check the plugin " + declaringBundle);
|
||||||
|
@ -272,6 +274,8 @@ public class E4PreferenceRegistry
|
||||||
psProviders.put(pluginId, data);
|
psProviders.put(pluginId, data);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
context.set(KEY_PREF_STORE_PROVIDERS, psProviders);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue